00:03 (quit) Senjai: Ping timeout: 245 seconds 00:41 (quit) jsnikeris: Read error: Connection reset by peer 00:41 (join) jsnikeris 01:00 (quit) mattmight: Ping timeout: 255 seconds 01:25 (quit) mithos28: Quit: mithos28 02:15 (join) Senjai 02:15 Senjai: Hey Geisteskrankh 02:19 (join) mattmight 02:42 (join) Tabemasu 03:30 Senjai: DT``: you around 03:32 Senjai: anyone around? 03:33 Senjai: rudybot: (define (multfunc f n) (* 3 (f n))) 03:33 rudybot: Senjai: Done. 03:34 Senjai: rudybot: (define (add5 n) (+ n 5)) 03:34 rudybot: Senjai: Done. 03:34 Senjai: rudybot: (multfunc (compose add5 sub1) 0) 03:34 rudybot: Senjai: ; Value: 12 03:36 Senjai: rudybot: (multfunc (compose (compose f add5) sub1) 0) 03:36 rudybot: Senjai: error: reference to undefined identifier: f 03:36 Senjai: rudybot: (multfunc (compose (compose multfunc add5) sub1) 0) 03:36 rudybot: Senjai: error: procedure multfunc: expects 2 arguments, given 1: 4 03:43 Senjai: rudybot: (define (tell-the-world n) (cond [(zero? n) "you all are dead"] [else (string-append "you all are dead" (tell-the-world (sub1 n)))])) 03:43 rudybot: Senjai: Done. 03:43 Senjai: (tell-the-word 10) 03:43 Senjai: rudybot: (tell-the-world 10) 03:43 rudybot: Senjai: ; Value: "you all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are dead" 03:44 Senjai: rudybot: (tell-the-world 100) 03:44 rudybot: Senjai: ; Value: "you all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyou all are deadyo 03:45 Senjai: rudybot: (define (tell-the-world n) (cond [(zero? n) "you all are dead"] [else (string-append "you all are dead " (tell-the-world (sub1 n)))])) 03:45 rudybot: Senjai: Done. 03:45 Senjai: rudybot: (tell-the-world 100) 03:45 rudybot: Senjai: ; Value: "you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all ar 03:45 Senjai: Better :) 03:46 Senjai: rudybot: (time (tell-the-world 100)) 03:46 rudybot: Senjai: ; Value: "you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead you all ar 03:46 Senjai: rudybot: (time (tell-the-world 5)) 03:46 rudybot: Senjai: ; Value: "you all are dead you all are dead you all are dead you all are dead you all are dead you all are dead" 03:47 Senjai: rudybot: (^ 5 3) 03:47 rudybot: Senjai: error: reference to undefined identifier: ^ 03:47 Senjai: rudybot: (expt 5 3) 03:47 rudybot: Senjai: ; Value: 125 03:47 Senjai: rudybot: (tell-the-world (expt 10 1000000)) 03:48 Senjai: :/ 03:48 rudybot: Senjai: error: with-limit: out of time 03:48 Senjai: lol 03:48 Senjai: poor rudybot 03:48 Senjai: rudybot: hi 03:48 rudybot: Senjai: error: reference to undefined identifier: hi 03:49 Senjai: rudybot: (define (add1toinfinity) (+ 1 (add1toinfinity))) 03:49 rudybot: Senjai: ; stdout: "cpu time: 0 real time: 0 gc time: 0\ncpu time: 0 real time: 0 gc time: 0\n" 03:49 Senjai: rudybot: (define (add1toinfinity) (+ 1 (add1toinfinity))) 03:49 rudybot: Senjai: Done. 03:50 Senjai: rudybot: (add1toinfinity) 03:50 rudybot: Senjai: error: evaluator: terminated (out-of-memory) 03:50 Senjai: Hehe 03:50 (join) PLT_Notify 03:50 PLT_Notify: racket: master Eli Barzilay * 02f6ef0 (7 files in 4 dirs): New Racket version 5.1.0.4. - http://bit.ly/hcCRnL 03:50 (part) PLT_Notify 03:51 Senjai: rudybot: (require 2htdp/image) 03:51 rudybot: Senjai: your sandbox is ready 03:51 rudybot: Senjai: error: dynamic-require: unknown module: '#%mred-kernel; need to run in gracket instead of racket 03:52 Senjai: rudybot: (require 2htdp/batch-io) 03:52 rudybot: Senjai: Done. 03:52 Senjai: oooo 03:52 Senjai: This could be fun 03:57 Senjai: (find-system-path 'home-dir) 03:57 Senjai: rudybot (find-system-path 'home-dir) 03:57 Senjai: rudybot: (find-system-path 'home-dir) 03:57 rudybot: Senjai: ; Value: # 04:01 Senjai: (directory-exists? "/home/erich/") 04:01 Senjai: (directory-exists? '/home/erich/) 04:02 Senjai: (directory-exists? #) 04:02 Senjai: (+ 1 2) 04:02 (part) Senjai 04:04 (join) Senjai 04:33 (part) Tabemasu 04:49 (quit) misterm: Ping timeout: 255 seconds 05:11 (join) lucian 06:19 (join) masm 06:36 (join) MayDaniel 07:27 askhader: Oh, oh! 07:27 askhader: I know this one! 07:37 Senjai: hm,' 07:57 DT``: rudybot, (directory-exists? "/home/erich") 07:57 rudybot: DT``: error: directory-exists?: `exists' access denied for /home/erich 07:58 (join) tauntaun 08:03 (join) Fisherman 08:04 Fisherman: Hi. Is there a smart way to ignore hidden files/directories with directory-list? 08:14 tauntaun: (filter (curry regexp-match "^\\.") (map path->string (directory-list))) 08:18 DT``: (filter-map (compose (curry regexp-match "^\\.") path->string) (directory-list)) 08:19 DT``: wait, no. 08:19 DT``: we are both wrong. 08:19 tauntaun: Oh? 08:20 DT``: yours matches only the hidden files/directories. 08:20 DT``: mine doesn't work. 08:21 DT``: (filter-map (λ (x) (and (not (regexp-match "^\\." (path->string x))) x)) (directory-list ".")) 08:21 tauntaun: right 08:22 tauntaun: Actually I'd meant to use "^[^\\.\" for the regexp pattern 08:22 tauntaun: I mean: "^[^\\.]" 08:23 tauntaun: So why do you need "." as arg to directory-list? 08:24 DT``: I was testing and I didn't look it up in the docs. 08:26 DT``: But, isn't faster to just (not (char=? (string-ref (path->string x) 0) #\.))? 08:28 (join) Fisherma1 08:30 Fisherma1: thanks 08:31 (quit) Fisherman: Ping timeout: 246 seconds 08:39 (quit) MayDaniel: 08:45 DT``: rudybot, (letrec ((code data) (data code)) (eq? code data)) 08:45 rudybot: DT``: ; Value: #t 09:03 (quit) Fisherma1: Quit: leaving 09:30 (join) anRch 09:45 cpach: hi folks! i'm trying to download a file and saving it to a local copy. i've built a function based on copy-port. it seems to work fine with plain http, but it borks on https. 09:45 cpach: here's my function: http://slexy.org/view/s2Y5IYyHSw 09:45 (join) mceier 09:46 cpach: first, maybe i should ask if this is a sane approach at all? :) 10:44 (quit) anRch: Quit: anRch 10:48 (join) mithos28 10:54 (join) dnolen 10:54 (quit) dnolen: Excess Flood 10:56 (join) dnolen 11:10 offby1: cpach: that code looks fine. But SSL support, if I recall correctly, is sort of half-backed 11:10 offby1: baked 11:10 offby1: lemme see how I've done it 11:13 offby1: cpach: http://ix.io/1xu <-- I'm not sure if this will work "as is", but this is the general idea for doing SSL 11:18 Geisteskrankh: Senjai, still there? 11:19 offby1: cpach: here are some style changes to your function: http://ix.io/1xv 11:19 offby1: I inverted the two "call-with" things, since I figured there's no point opening the output file unless we've successfully connected to the web server 11:19 offby1: also I used "curry" since I like it :) 11:20 bremner: yum 11:20 offby1: with rice. 11:21 (quit) Senjai: Ping timeout: 245 seconds 11:26 cpach: offby1: thank you for the examples! i'll have a look at them later. 11:28 offby1: cpach: pester eli for help; he wrote what I pasted (frankly, I don't understand it) 11:46 (join) studentUK1 11:46 studentUK1: Hi, is anyone here? 11:49 bremner: studentUK1: go ahead and ask your question 11:50 studentUK1: thanks, I've just started looking at the little schemer book and I cant find a lot of the formula to practice with 11:52 studentUK1: one of them I'm stuck on is Is it true that this is an S-expression? xyz 11:53 bremner: unless I miss something subtle, yes it is. 11:54 studentUK1: but how would I go about putting this on DrRacket? 11:55 bremner: one way is (read)xyz 11:56 (quit) dnolen: Quit: dnolen 11:56 studentUK1: I tried that but I get "expand: unbound identifier in module" 11:57 bremner: what language (#lang) do you use? 11:57 studentUK1: racket 11:58 bremner: hmm. It works fine for me. What happens when you type (read) ? 11:58 studentUK1: I get some big box bellow with eof 11:59 bremner: right. so type in that box 11:59 studentUK1: I see 'xyz comes up 11:59 bremner: there yah go. 12:01 bremner: now try something your pretty sure isn't an S-expression 12:01 studentUK1: thanks, thats sorted out that one. Do you know of a website that lists in detail for racket as I've got more than S-expressions to look at. 12:01 bremner: although, that might be tough ;) 12:01 bremner: studentUK1: racket-lang.org has tons of documentation 12:02 bremner: there is a "guide" for getting started. 12:02 (quit) studentUK1: Quit: Page closed 12:40 (join) MayDaniel_ 12:58 (quit) masm: Ping timeout: 255 seconds 13:05 (join) masm 13:18 tauntaun: When is the strictly functional style not appropriate? 13:19 (quit) jsnikeris: Remote host closed the connection 13:19 tauntaun: I mean functional updates, etc. 13:20 tauntaun: I'm trying to write an RPG, which of course has agents, objects, and locations. And it seems to me that certain things might be better done with set! and maybe even with an object-oriented approach. 13:25 DT``: tauntaun, go with functional style until you really can't make it look good. 13:25 DT``: I usually set! only on hash tables. 13:26 tauntaun: Yes, obviously, but the question is where to draw the line. 13:26 tauntaun: OK, consider the following scenario. 13:26 tauntaun: An agent picks up an object. 13:26 tauntaun: Game objects have locations. 13:26 tauntaun: The location must change when the agent picks it up, from the room to the agent. 13:26 tauntaun: Following me so far? 13:26 DT``: yeah. 13:27 tauntaun: Several things need to change because of this action: 13:27 tauntaun: 1. The object's location must now refer to the agent. 13:27 tauntaun: 2. The agent's list of possessions must now include the object. 13:27 tauntaun: 3. The location's list of contents must lose the object. 13:27 DT``: I'd use imperative style here. 13:27 tauntaun: Can these three updates really be done in the functional style without awkwardness? 13:28 tauntaun: ok. 13:28 tauntaun: Anyone else have any opinions? 13:34 offby1: you might look at the "Universe" stuff ... not sure where it lives, but it's mostly or entirely functional 13:34 offby1: and yet it's designed, I think, for writing the sort of games for which you'd think you'd need state. 13:41 tauntaun: offby1: thanks, although it looks like it requires the 2htdp language... 13:43 (quit) masm: Ping timeout: 255 seconds 14:16 (join) dnolen 14:42 (join) masm 15:15 (quit) mithos28: Quit: mithos28 15:20 Geisteskrankh: Who invented syntax-case? 15:20 Geisteskrankh: And when 15:20 Geisteskrankh: and how 15:22 (join) mithos28 15:31 (quit) dnolen: Read error: Connection reset by peer 15:36 (join) dnolen 15:36 (quit) dnolen: Excess Flood 15:37 (join) dnolen 15:37 (quit) mithos28: Quit: mithos28 15:59 (quit) dnolen: Quit: dnolen 16:17 (join) dnolen 16:17 (quit) dnolen: Excess Flood 16:19 (join) dnolen 16:23 (quit) lucian: Remote host closed the connection 17:15 offby1: me, yesterday, I was inspired by some tea leaves 17:16 (quit) MayDaniel_: Read error: Connection reset by peer 17:17 bremner: lies! those were not tea leaves. 17:40 (join) shofetim` 17:42 (quit) shofetim: Ping timeout: 255 seconds 17:44 Geisteskrankh: offby1, you troll me. 17:50 offby1: I do, it's true. 17:56 Geisteskrankh: offby1, what do you have to say about yourself young man? 17:56 offby1: I say: I am not a young man 17:57 offby1: but that's OK 17:57 (quit) DT``: Ping timeout: 240 seconds 17:58 (join) DT`` 18:06 Geisteskrankh: offby1, how old are you? 18:10 (quit) tauntaun: Quit: Ex-Chat 18:37 (quit) dnolen: Quit: dnolen 18:41 (part) shofetim`: "ERC Version 5.3 (IRC client for Emacs)" 18:49 (quit) cow-orker: Ping timeout: 248 seconds 18:50 (join) jonrafkind 18:57 (join) cow-orker 19:00 (join) lucian 19:03 (quit) lucian: Remote host closed the connection 19:33 (nick) coyotama|2 -> lakkris 19:33 lakkris waves hi 19:36 jonrafkind makes a snow angel 19:47 (join) tauntaun 19:59 (join) misterm 20:16 (join) flop 20:17 (nick) flop -> mzlost 20:18 mzlost: howdy, connected from racket website ;o) Examples i'm trying from net only work with "#lang mzscheme" and always give errors i can't solve with "#lang racket"... is mzscheme an old unsupported dialect or something okay to use? 20:21 DT``: racket should be preferred 20:21 DT``: *. 20:21 jonrafkind: what errors do you get? 20:23 mzlost: jonra, have had a few diff. erros... when trying a selection of different macros i got an error: unbound identifier for datum->syntax-object 20:23 jonrafkind: where did you find these examples? 20:24 jonrafkind: datum->syntax-object is named 'datum->syntax' in #lang racket 20:24 Geisteskrankh: You tell 'em. 20:24 mzlost: varried websites... ah, i see.. also found defmacro becomes define-macro 20:24 Geisteskrankh: defmacro and define-macro are baaaad 20:24 Geisteskrankh: I tell 'em. 20:24 mzlost: lol 20:25 Geisteskrankh: mzlost, you should use define-syntax 20:26 mzlost: thanks... i'm really just learning and got sidetracked on these examples. It feels like there are a lot of dialects and a lot of (baaaad advice) out there int he world ;o) 20:26 mzlost: thanks for the tip jonrafkind, and the warning geisteskrankh 20:27 Geisteskrankh: This is no mere warning my padawan. 20:27 Geisteskrankh: This is an order. 20:29 mzlost: lol.. okay.. i'll take it to heart. here is one of the web sites i was getting some examples from: http://is.gd/8qxsKY 20:30 jonrafkind: omfg the first example makes my eyes bleed 20:30 jonrafkind: i want to kill something now 20:31 jonrafkind: he should have just used cut if he wanted a better syntax for lambda instead of making up some lame shorthand 20:31 mzlost: it was the first example i tried, and it didn't work of course... i guess because it made #lang racket bleed too 20:31 Geisteskrankh: mzlost, don't they all use define-syntax there 20:31 Geisteskrankh: jonrafkind, no 20:31 Geisteskrankh: it rocks. 20:32 jonrafkind: what, : ? 20:32 (quit) mceier: Quit: leaving 20:32 Geisteskrankh: jonrafkind, the first example 20:32 Geisteskrankh: The [: / x 2] macro. 20:32 DT``: wait, why is he using syntax-case instead of with-syntax? 20:32 Geisteskrankh: Eh 20:32 Geisteskrankh: [: / _ 2] 20:32 jonrafkind: (define-syntax-rule (i x ...) (if x ...)) wow! what a great macro!!!!!!!!!!1111 20:32 jonrafkind: i saved a whole 1 letter! 20:32 Geisteskrankh: jonrafkind, oh 20:32 Geisteskrankh: no 20:32 Geisteskrankh: that's silly 20:32 Geisteskrankh: [: / _ 2] ; <-- much better than (lambda (x) (/ x 2)) 20:32 jonrafkind: saving 1 letter is silly but saving 4 is not? 20:32 Geisteskrankh: I meant that one. 20:32 Geisteskrankh: No 20:33 Geisteskrankh: it's about not naming a variable when you only use one anyway. 20:33 Geisteskrankh: Like 20:33 Geisteskrankh: I also have this macro 20:33 jonrafkind: yes but theres cut fort hat 20:33 Geisteskrankh: (& ...) 20:33 jonrafkind: where you can do (cut (/ $1 $2 $3)) or something, i forget exactly 20:33 Geisteskrankh: Which is basically (lambda ((X void) (Y void) (Z void)) ...) 20:33 Geisteskrankh: Yeah 20:34 Geisteskrankh: that's cool 20:34 Geisteskrankh: But I have X Y and Z 20:34 Geisteskrankh: don't ask me why 20:34 Geisteskrankh: Oh wait 20:34 Geisteskrankh: ask me why 20:34 Geisteskrankh: it has a reason 20:34 Geisteskrankh: gogogoog, ask me. 20:34 jonrafkind: and aif is just dumb, imo 20:34 jonrafkind: another 5 letters saved 20:34 Geisteskrankh: What does aif do? 20:34 jonrafkind: people who like aif probably like to write C code like if (x++ > 5){ ... } 20:35 DT``: everyone has his personal dirty macros. 20:35 jonrafkind: it binds the result of the condition in the body of the then, I think 20:35 Geisteskrankh: jonrafkind, I do that all the time. 20:35 Geisteskrankh: Isn't that just or? 20:35 DT``: Geisteskrankh, (aif pred true false) is (let ((it pred)) (if it true false)) 20:35 DT``: (with ``it'' being unhygienic) 20:36 Geisteskrankh: What is the use? 20:36 Geisteskrankh: It's just if 20:36 jonrafkind: so you dont have to write the let 20:36 jonrafkind: its a time saving macro 20:36 DT``: Geisteskrankh, you can reference the `pred' part using `it'. 20:36 jonrafkind: it saves exactly 0.00000000000000000000000001 seconds 20:36 Geisteskrankh: Ohhh 20:36 Geisteskrankh: yeah 20:36 tauntaun: does hygiene really make a difference in that example? 20:36 Geisteskrankh: I guess 20:36 Geisteskrankh: tauntaun, that 20:36 jonrafkind: which you can use to look at more lolcat pictures on the internet 20:36 Geisteskrankh: you can reference it. 20:36 Geisteskrankh: That's actually pretty cool. 20:36 Geisteskrankh: Yeah, I like that. 20:36 Geisteskrankh: The less code duplication the better 20:37 Geisteskrankh: If it's a common pattern you see, better abstract it out. 20:37 Geisteskrankh: jonrafkind, also 20:37 tauntaun: Lajla: I'm afraid your answer was a non-answer again. 20:37 Geisteskrankh: this is awesome in javascript: while (obj = obj.nextSibling()) { ....} 20:37 jonrafkind: what a failure 20:37 tauntaun: what a commonplace 20:38 Geisteskrankh: or while(obj = array[i++]) { ... } 20:38 Geisteskrankh: truly so short and elegant. 20:38 jonrafkind barfs 20:38 Geisteskrankh: Baby 20:38 Geisteskrankh: give it to me. 20:38 Geisteskrankh: rawr. 20:38 tauntaun: But someone please confirm, for the record, that hygiene makes no difference to (let ((it pred)) (if it true false)). 20:38 jonrafkind: do you know how many stupid bugs have resulted in such idioms 20:38 DT``: tauntaun, no. 20:38 DT``: you can't reference `it' if it is hygienic. 20:39 tauntaun: jonrafkind: you mean *from* such idioms? 20:39 jonrafkind: yea 20:39 Geisteskrankh: tauntaun, hygiene makes all the difference. 20:39 Geisteskrankh: jonrafkind, no, they remove it if any 20:39 Geisteskrankh: because you take away code duplication 20:39 tauntaun: Then I'm still confused about hygiene. 20:39 tauntaun: It's the macro that introduces the let and the binding to 'it', right? 20:39 jonrafkind: no, it just moves the code to a place where semantics are unclear 20:39 Geisteskrankh: jonrafkind, for you maybe. 20:39 DT``: tauntaun, yes. 20:39 jonrafkind: while (obj = array[i]){ i += 1; } 20:39 Geisteskrankh: But this is lajla you're speaking with. 20:40 DT``: and that *breaks* hygiene. 20:40 tauntaun: So, suppose, the hygiene algorithm renames 'it' to blah. 20:40 Geisteskrankh: jonrafkind, to be honest 20:40 DT``: the hygienic version of aif is (aif var pred true false) 20:40 Geisteskrankh: I'd rather abstract that as 20:40 tauntaun: The let becomes (let ((blah pred)) (if blah true false)) 20:40 DT``: you have to name `it' yourself. 20:40 Geisteskrankh: foreach (obj, array) { ....} 20:40 tauntaun: which has the same semantics. 20:40 jonrafkind: yes of course it needs abstractions, but lacking the proper abstractions I would not recommend using the built-in features to create an ad-hoc version 20:40 jonrafkind: doing so is dangerous 20:40 Geisteskrankh: jonrafkind, hmm, I can see where you get there yeah 20:41 Geisteskrankh: I mean, if the array contains a false value. 20:41 Geisteskrankh: But going over all the elements of an array is a common task 20:41 Geisteskrankh: So basically you want to abstract as much as possible to ensure that if you don't fail in the abstraction, you fail nowhere. 20:41 Geisteskrankh: Of course foreach is better. 20:41 tauntaun: Sorry guys, but could someone please cure my confusion? 20:42 Geisteskrankh: tauntaun, hygiene? 20:42 tauntaun: I made a specific point that went unremarked. 20:42 Geisteskrankh: tauntaun, well, let's take or as an example. 20:42 Geisteskrankh: Yeah, let me get there 20:42 tauntaun: no, lajla. 20:42 tauntaun: let's please take the example I gave above. 20:42 Geisteskrankh: Okay 20:42 tauntaun: First things first. 20:42 tauntaun: Is it not true that... 20:42 tauntaun: hygiene renames (let ((it pred)) (if it true false)) to... 20:43 Geisteskrankh: tauntaun, so, it becomes (let ((it pred)) (if it true false)) 20:43 tauntaun: (let ((something-else pred)) (if something-else true false)) 20:43 DT``: true. 20:43 Geisteskrankh: Yeah 20:43 Geisteskrankh: provided that something-else is not not in the expression itself. 20:43 tauntaun: Then how are the semantics any different? 20:43 Geisteskrankh: Well, consider this example 20:43 tauntaun: (Lajla: yes of course.) 20:44 DT``: tauntaun, the difference is: 20:44 tauntaun: Ah, wait. 20:44 DT``: you don't know the name of `something-else'. 20:44 tauntaun: OK, go ahead. 20:44 tauntaun: Yes, but the macro uses 'something-else' twice. 20:44 Geisteskrankh: (aif (member #\c some-list) (car it) "it is not there!") 20:44 Geisteskrankh: With hygiene, the 'it' in (car it) would be unbound 20:44 tauntaun: Are you saying that the hygiene algorithm will rename only the first 'something-else'? 20:44 Geisteskrankh: without hygiene, it actually gets it. 20:45 Geisteskrankh: tauntaun, the macro doesn't use something-else 20:45 Geisteskrankh: The expander *may* 20:45 Geisteskrankh: Or use whatever trick to get the same semantics. 20:45 Geisteskrankh: the macro uses 'it' 20:46 tauntaun: Look, let's start from the beginning. Hygiene is a renaming of identifiers introduced by the macro that may be captured by bindings in the larger scope, right? 20:46 DT``: right. 20:46 tauntaun: So let's suppose there's a global variable named 'hi'. 20:46 tauntaun: Then I write... 20:46 tauntaun: (let ((hi pred)) (if hi true false)) 20:46 tauntaun: The macro then rewrites this to... 20:46 tauntaun: (let ((bye pred)) (if bye true false))...so as not to conflict with the global hi. Right? 20:47 DT``: if it is the result of a macro expansion, yes. 20:47 tauntaun: What do you mean? 20:47 tauntaun: We're talking about macros, right? 20:47 DT``: if it is generated by a macro. 20:47 DT``: yea. 20:47 DT``: so, yes. 20:47 tauntaun: Why are you restating assumptions? 20:47 tauntaun: Anyway... 20:47 DT``: just to be sure. 20:48 Geisteskrankh: This is actually not needed to do by the expander 20:48 tauntaun: What??! 20:48 Geisteskrankh: As the let shadows the global variable. 20:48 Geisteskrankh: In this case 20:48 Geisteskrankh: could just as well be the same. 20:48 tauntaun: That's exactly my point. 20:48 tauntaun: OMG. 20:48 Geisteskrankh: But that's not what happens here. 20:48 tauntaun: That's what I've been saying the whole time. 20:48 Geisteskrankh: Yeah, and that's not relevant here. 20:49 tauntaun: Lajla: yes or no, does the hygiene algorithm rename the let as I have written it at 20:46? 20:49 Geisteskrankh: See my example: (aif (member #\c some-list) (car it) "it is not there!")) succeeds in a non hygienic example. 20:49 tauntaun: NO!!!! 20:49 Geisteskrankh: It doesn't. 20:49 tauntaun: We were talking about something specific. 20:49 Geisteskrankh: Okay. 20:49 Geisteskrankh: Well, then it doesn't. 20:49 Geisteskrankh: Also, I'm not in your timezone. 20:49 tauntaun: Then why did everyone insist that hygiene "makes all the difference"? 20:49 Geisteskrankh: Minutes suffice. 20:49 Geisteskrankh: Because it does in this example. 20:49 tauntaun: (Fine: 3 minutes ago.) 20:49 Geisteskrankh: the aif 20:49 Geisteskrankh: of which we spoke. 20:50 tauntaun: Please refere to DT``'s utterance at minute 35. 20:50 tauntaun: (*refer) 20:50 Geisteskrankh: CAn't you quote him, I don't have timestamps on. 20:51 tauntaun: Geisteskrankh, (aif pred true false) is (let ((it pred)) (if it true false)) 20:51 tauntaun: (with ``it'' being unhygienic) 20:51 Geisteskrankh: That is true 20:51 tauntaun: What does it mean, "unhygienic", when we've agreed that the let is the binding that wins? 20:51 Geisteskrankh: It expands to that. 20:52 Geisteskrankh: Depends on the body of the let if it matters 20:52 Geisteskrankh: In your body it doesn't. 20:52 tauntaun: The bodies are the same. 20:52 Geisteskrankh: Nope, let me write the difference up: 20:52 tauntaun: Are you saying that true and/or false are expressions that may contain 'it'? 20:53 DT``: tauntaun, 20:53 DT``: rudybot, (define-syntax-rule (aif p t f) (let ((it p)) (if it t f))) 20:53 rudybot: DT``: your sandbox is ready 20:53 rudybot: DT``: Done. 20:53 DT``: this aif is *hygienic*. 20:54 DT``: rudybot, (aif (+ 2 3) it 'false) 20:54 rudybot: DT``: error: reference to undefined identifier: it 20:54 DT``: you can't refer to the `it' declared inside the macro body. 20:54 DT``: rudybot, (define-syntax (aif2 stx) (syntax-case stx () ((aif2 p t f) (with-syntax ((it (datum->syntax stx 'it))) #'(let ((it p)) (if it t f)))))) 20:54 rudybot: DT``: Done. 20:54 DT``: this aif is unhygienic. 20:54 DT``: rudybot, (aif2 (+ 2 3) it 'false) 20:54 rudybot: DT``: ; Value: 5 20:55 DT``: in this aif, I *can* refer to it. 20:55 DT``: this means that if there was some other variable called ``it'', it would be shadowed. 20:55 mzlost: hey.. rudybot is cool. 20:55 DT``: rudybot, (define-syntax-rule (aif3 it p t f) (let ((it p)) (if it t f))) 20:55 rudybot: DT``: Done. 20:56 Geisteskrankh: tauntaun: http://codepad.org/o1MQhcff 20:56 mzlost: the first example on that linked page doesn't work even after subbing datum->syntax... (map [: * _ 2] mylist) gives _: wildcard not allowed as an expression 20:56 DT``: in this hygienic aif, *we* name it. 20:56 tauntaun: excuse me, DT``, while I copy and paste your code into Emacs so I can indent it. 20:56 Geisteskrankh: tauntaun, my link explains it all. 20:59 mzlost: noob question. in your link Geisteskrankh, how do you decide whether aif will be expanded hygienically or not? 20:59 Geisteskrankh: mzlost, I did it manually actually. =P 20:59 Geisteskrankh: How you write the macro determins this 20:59 tauntaun: Lajla: you did not give the macro definition. 20:59 tauntaun: In the codepad. 20:59 Geisteskrankh: (define-syntax-rules (aif p t f) (let ((x p)) (if x t f))) is hygienic. 21:00 Geisteskrankh: tauntaun, I didn't. 21:00 DT``: mzlost, if you write my first aif, it's hygienic. 21:00 DT``: my second example, aif2, it's not. 21:00 Geisteskrankh: I second DT`` 21:00 Geisteskrankh: he's as smart as I am. 21:00 mzlost: lol 21:00 Geisteskrankh: *HUGGLES DT`` 21:00 DT``: lol 21:00 mzlost: thanks DT... i'll scroll back and look 21:00 tauntaun: And now I see that you are using 'it' in the 'true' expression. If you had confirmed that from the beginning, I wouldn't have suffered all this confusion. But thanks anyway. 21:01 Geisteskrankh: I did. 21:01 Geisteskrankh: DT``, didn't 21:01 Geisteskrankh: because he's totally stupid 21:01 Geisteskrankh: oh wait. 21:01 tauntaun: At minute 52: Are you saying that true and/or false are expressions that may contain 'it'? 21:01 DT``: lol. 21:02 DT``: and that is why dirty macros are bad. 21:02 tauntaun: No, that is why imprecise writing is bad. 21:03 DT``: unhygienic macros were shadowing the real answer. 21:03 Geisteskrankh: My IRC senses detect some annoyance. 21:03 tauntaun: Okay, see? 21:03 tauntaun gets grouchy about sloppy writing. 21:04 mzlost: DT``: is the crucial difference the use of define-syntax-rule vs define-syntax ? 21:05 Geisteskrankh: mzlost, nope. 21:05 Geisteskrankh: Best not yet worry about this. 21:05 DT``: mzlost, the crucial difference is using (with-syntax ((it (datum->syntax stx 'it))) ...) 21:05 mzlost: yeah.. i know i'm fixated on stuff beyond my very limited depth 21:05 Geisteskrankh: understanding syntax-case is hard, can only come after you understood women. 21:05 mzlost: Geisteskrankh: then i'll never understand 21:05 DT``: Geisteskrankh, syntax-parse is hard. 21:05 Geisteskrankh: mzlost, let me formalize women for you: 21:06 Geisteskrankh: forall x : woman(x) -> forall y : diamondring (y) -> loves(x,y) 21:06 DT``: formalizing women = proving that the universe is deterministic. 21:06 mzlost: heh 21:07 Geisteskrankh: I heard that a man that can succesfully parse women emotions provably decides the haling problem. 21:09 mzlost: okay, going back to Harry and Gerry lisp videos... thanks for the sage advice and fun.. cheers 21:11 (part) mzlost 21:13 DT``: It's 3:13 AM here, I guess I'll go to sleep. 21:13 DT``: 'night. 21:14 tauntaun: Buona notte. 21:17 Geisteskrankh: hah 21:17 Geisteskrankh: now I am the smartest 21:17 (quit) vdrab: Quit: vdrab 21:18 tauntaun: Well, since you're so smart... 21:19 tauntaun: Where can I read up about hygienic macros? 21:19 tauntaun: I read Dybvig's paper some time ago. 21:19 tauntaun: But I need to see more examples. 21:20 Geisteskrankh: tauntaun, I guess dybvig's on syntax case is one of the most important 21:20 Geisteskrankh: THere's not much to explain about hygienic macros as a general concept 21:20 Geisteskrankh: all bindings refer to what they refer to in the environment of the definition, not the expansion. 21:21 tauntaun: Yes, I knew that Lajla. But... 21:22 tauntaun: I didn't understand how DT`` used with-syntax and datum->syntax to turn off the hygiene algorithm. 21:23 Geisteskrankh: Ahhh 21:23 Geisteskrankh: that's a scheme specific thing 21:24 Geisteskrankh: not about hygienic macros in general. 21:24 Geisteskrankh: But yeah, he basically used datum->syntax to introduce a new binding into the environment. 21:24 Geisteskrankh: Basically 21:25 Geisteskrankh: what (datum->syntax stx obj) does is that it returns a syntax object corresponding to the datum in the environment that it takes from the syntax object stx. 21:25 tauntaun: already understood 21:25 Geisteskrankh: So, what part you don't then? 21:26 tauntaun: No, I understood just that part of the call to datum->syntax 21:26 tauntaun: I guess he's sneaking in the context of stx 21:26 tauntaun: and binding it to 'it in that context? 21:26 tauntaun: (I mean: binding "it" to "'it") 21:27 tauntaun: Anyway, there has to be some book/article/source that sysematically covers hygienic macros. 21:28 Geisteskrankh: tauntaun, well, there is that Dybvig article yeah 21:28 Geisteskrankh: Or jsut the R6RS standard 21:28 Geisteskrankh: But yeah 21:28 tauntaun: They are not tutorials. 21:28 tauntaun: Even Dybvig's is too brief. 21:29 Geisteskrankh: (datum->syntax x y) does use its first argument to determine the context of the resulting syntaxobjecyt. 21:31 Geisteskrankh: You don't technically need with-syntax by the way. 21:31 Geisteskrankh: you can use quasisyntax 21:33 (join) masm1 21:34 (quit) masm: Ping timeout: 250 seconds 21:38 tauntaun: I guess I'll just have to find time to pass over the Racket documentation with a fine-toothed comb. 21:44 (join) vdrab 22:12 (quit) jonrafkind: Ping timeout: 248 seconds 22:39 (quit) tauntaun: Quit: Ex-Chat 22:52 (quit) rudybot: Ping timeout: 276 seconds 22:52 (join) rudybot_ 22:54 (nick) rudybot_ -> rudybot 22:55 (join) mithos28 23:08 (quit) offby1: Read error: Connection reset by peer 23:22 (quit) vdrab: Quit: vdrab