00:23 (join) dnolen 00:24 (join) jhemann 00:28 (quit) jhemann__: Ping timeout: 244 seconds 00:35 (join) noam 00:50 (quit) jeapostrophe: Ping timeout: 276 seconds 00:55 (join) Ish_Kgisl 00:56 (nick) Ish_Kgisl -> ramrad 00:58 (quit) EmmanuelOga: Ping timeout: 245 seconds 00:58 ramrad: can anyone tell how to program for "reverse a number" using recursion in racket? 01:02 (quit) dnolen: Remote host closed the connection 01:07 ramrad: anyone there to help? 01:08 mithos28: what do you mean by reverse a number? 01:10 (quit) jonrafkind: Ping timeout: 252 seconds 01:12 ramrad: reversing a number using recursion. for example 1234 -> 4321 01:13 mithos28: so how would you explain how to do that in english 01:15 (join) ramrad_ 01:17 (quit) ramrad: Ping timeout: 240 seconds 01:18 (join) ramrad 01:19 (join) ramrad__ 01:20 (quit) ramrad_: Ping timeout: 240 seconds 01:21 ramrad: mithos28 : are you able to understand? 01:21 mithos28: so how would you explain how to do that in english? 01:23 ramrad__: suppose if i give number 1234 i should get back 4321. This has to be done using recursive function 01:23 mithos28: if I put in the number 1235 should I get back 4321? 01:24 (join) ramrad_ 01:24 ramrad__: no you should get 5321 01:24 mithos28: how did you get that answer? 01:25 ramrad__: ; revNumStr : string -> string ;(EXAMPLE (revNumStr "123") ("321")) ;(EXAMPLE (revNumStr "2233") ("3322")) (define (revNumStr myStr) ( list->string( reverse (string->list myStr)) ) ) ; reverseNum : number -> number ;(EXAMPLE (reverseNum 12345) (54321)) ;(EXAMPLE (reverseNum 22334) (43322)) (define (reverseNum num) (string->number( revNumStr(number->s 01:25 (quit) ramrad: Ping timeout: 240 seconds 01:25 ramrad__: this is done without recursion function 01:25 (nick) ramrad_ -> ramrad 01:25 mithos28: use a paste board for pasting code. gist.github.com 01:27 mithos28: did you use that function to get that answer, or did you do it in your head? 01:28 (quit) yoklov: Quit: bye! 01:28 ramrad: I used those functions to get the answer 01:29 mithos28: could you do it in your head? 01:30 ramrad: mithos28: https://gist.github.com/90bb9f49999d49d54146 pls click this link 01:31 mithos28: ok 01:31 mithos28: can you explain to me how you would reverse a number? 01:33 ramrad__: yes but can you understand from the code? 01:33 mithos28: yes 01:34 mithos28: you want help with your homework problem, and I can help but I am not going to give you the answer 01:35 mithos28: Have you written a function to reverse a list? 01:35 ramrad__: this is not a homework problem. I'm trying to code myself since I'm a trainer 01:36 mithos28: ok, what do you want as help? 01:44 (join) ramrad_ 01:45 (quit) ramrad: Ping timeout: 240 seconds 01:45 (nick) ramrad_ -> ramrad 01:48 (quit) Kaylin: Read error: Connection reset by peer 01:48 ramrad: i wanted to know how this can be done using recursion 01:48 mithos28: ok, well start with reversing a list using recursion 01:49 ramrad: number -> list? 01:50 mithos28: what is the question? 01:52 ramrad: Or please explain it. It will be helpful 01:53 mithos28: I'm confused on why you are comfortable using the function reverse, but not with writing it 01:54 ramrad: I'm trying to figure it out since yesterday but I don't get it 01:55 mithos28: what functions have you written? 01:59 ramrad: I have written the algorithm for it 01:59 ramrad: let me share it with you 02:02 ramrad: https://gist.github.com/ddb00e6db37db37dedb9 02:02 ramrad: pls click it 02:02 (quit) djcb````: Read error: Connection reset by peer 02:03 mithos28: ok, and why cannot you not write that as code 02:03 (quit) noam: Read error: Connection reset by peer 02:04 (join) noam 02:05 ramrad: since i get this error I expected only a test, a consequence, and an alternative, but I see more than three of these. 02:06 mithos28: That is saying that if only takes three things after it 02:06 mithos28: you probably have 4 02:07 ramrad: yeah 02:12 ramrad: I couldn't get a clear idea 02:12 ramrad: Anyways thank for your help. Good day 02:20 (join) noam_ 02:21 (quit) mithos28: Quit: mithos28 02:22 (quit) ramrad: Quit: ChatZilla 0.9.88 [Firefox 10.0.2/20120215223356] 02:22 (quit) noam: Ping timeout: 260 seconds 02:22 (quit) ramrad__: Quit: Page closed 02:28 (join) Kaylin 02:46 (join) djcb 02:47 (quit) jhemann: Ping timeout: 272 seconds 02:48 (quit) Kaylin: Ping timeout: 252 seconds 02:52 (join) Kaylin 02:54 (nick) LeNsTR -> LeNsTR|off 02:56 (quit) Enoria: Remote host closed the connection 02:58 (join) Enoria 03:07 (join) noam 03:08 (quit) noam_: Ping timeout: 246 seconds 03:11 (quit) Enoria: Read error: Connection reset by peer 03:11 (join) bluezenix 03:21 (join) Enoria 03:32 (join) hkBst 03:40 (join) Blkt 04:37 (quit) realitygrill: Quit: realitygrill 04:42 (quit) karswell: Ping timeout: 248 seconds 04:46 (join) karswell 04:54 (quit) noam: Read error: Connection reset by peer 04:55 (join) noam 05:17 (join) ahinki 05:24 (join) noelw 05:33 (quit) Kaylin: Quit: Leaving. 05:57 (join) bas_ 05:57 (nick) bas_ -> Skola 06:06 (join) dzhus 06:08 (quit) cdidd: Ping timeout: 240 seconds 06:20 (join) cdidd 06:45 (quit) bluezenix: Quit: Leaving. 06:47 (join) dme 06:51 (join) masm 06:55 (join) EmmanuelOga 07:08 (join) mceier 07:10 (quit) Skola: Quit: Lost terminal 07:13 (join) bluezenix 07:14 (join) bas___ 07:14 (nick) bas___ -> Skola 07:14 (quit) kvda: Quit: -___- 07:38 (quit) dous_: Remote host closed the connection 07:41 (quit) noam: Read error: Connection reset by peer 07:42 (join) noam 07:46 (join) RacketCommitBot 07:46 RacketCommitBot: [racket] plt pushed 3 new commits to master: http://git.io/V2QABA 07:46 RacketCommitBot: [racket/master] syntax/parse: add attribute-prefix check to template form - Ryan Culpepper 07:46 RacketCommitBot: [racket/master] syntax/parse: optimize common ellipsis patterns - Ryan Culpepper 07:46 RacketCommitBot: [racket/master] setup "images" collection earlier, "drracket" at end - Ryan Culpepper 07:46 (part) RacketCommitBot 07:51 (join) jeapostrophe 08:04 (quit) noam: Ping timeout: 244 seconds 08:05 (join) noam 08:30 (nick) LeNsTR|off -> LeNsTR 08:30 (quit) jrslepak: Quit: This computer has gone to sleep 08:43 (nick) LeNsTR -> LeNsTR|off 08:56 (quit) djcb: Remote host closed the connection 09:00 (join) djcb 09:03 (join) jhemann 09:08 (quit) hkBst: Remote host closed the connection 09:09 (join) hkBst 09:09 (quit) hkBst: Changing host 09:09 (join) hkBst 09:24 (join) dous 09:40 (join) crichards 09:40 crichards: Hello 09:41 noelw: Hi 09:42 crichards: I'm a noob to scheme and racket in general, I'm trying to build a list with (define l '(a b c)) and then (set! 'hey l) but racket throws an error 09:43 crichards: If I just type it in the REPL it works :( 09:44 noelw: The difference between the REPL and within a module is moderately subtle 09:44 noelw: Do you have experience programming in any other language? 09:44 crichards: yes, JavaScript, C#, Objective-C, C 09:45 noelw: Ok. 09:45 noelw: Racket, like most languages (but not Javascript), is lexically scoped 09:45 noelw: You can't set! a variable before you've defined it. 09:46 noelw: However, in the REPL you can. 09:46 noelw: 'cause the REPL is designed for interactive fooling around 09:46 noelw: That's the small scale answer 09:47 crichards: Ahh, i get it 09:47 noelw: On a larger scale, Racket encourages a functional style. 09:47 noelw: set! (mutation) is considered a bad thing 09:47 crichards: I'm trying to learn the functional style 09:47 noelw: Ok, you probably don't want to use set! then. 09:48 crichards: I want to build a list of user input, wouldn't I need to save it to a list or a vector? 09:48 noelw: Not necessarily 09:49 noelw: You can write a loop like (untested): 09:49 (nick) LeNsTR|off -> LeNsTR 09:49 (quit) dme: Ping timeout: 246 seconds 09:49 noelw: (define (accumulate-input input) 09:49 noelw: (displayln "Say something!") 09:49 noelw: (accumulate-input (cons (read-line) input)) 09:49 noelw: ) 09:49 noelw: (Last closing karen should go on the previous line… ) 09:49 (join) jrslepak 09:50 crichards: so I use the result from that method as the param for whatever I want to use the list, correcT? 09:52 noelw: Yeah, though that function will loop 4eva 09:53 crichards: Intresting, this will take some time to get used to 09:53 crichards: I just finished the little schemer yesterday 09:55 (join) dnolen 09:57 noelw: That's a good start 09:57 noelw: The key thing is to get the functional patterns 09:57 noelw: The little scheme goes into them, but a bit obliquely 09:59 crichards: So as a general rule I should try to avoid mutators as much as possible? 10:03 noelw: Yes 10:05 crichards: Seems like that will cause programs to be either very short lived, or have long running loops 10:05 bremner: man, DrRacket feels slow to me. I wonder if I have screwed up and not compiled something. 10:06 crichards: DrRacket takes a bit to start up for me 10:06 bremner: yeah, I don't mind the startup time. But e.g. opening a file seems pretty slow, and to involve a bunch of garbage collection. 10:07 samth: bremner: i would guess something isn't compiled 10:12 bremner: oh, it must setting the "pl" language as default. A racket/base tab fires up instantly, but pl takes about 5 to 10 seconds 10:12 bremner: could it just be expensive to start up this typed/racket variant? 10:13 crichards: Ok, instead of using set!, I did this instead (define getTimes 10:13 crichards: (lambda (x) 10:13 crichards: (cond 10:13 crichards: ([zero? x] '()) 10:13 crichards: (else (cons (read) (getTimes (sub1 x))))))) 10:21 (quit) dzhus: Read error: Connection reset by peer 10:21 (join) dzhus 10:23 (quit) cdidd: *.net *.split 10:23 (quit) asumu: *.net *.split 10:23 (quit) abbe: *.net *.split 10:23 (quit) stchang: *.net *.split 10:23 (quit) DraX: *.net *.split 10:23 (join) mithos28 10:23 (join) DraX 10:23 (quit) DraX: Changing host 10:23 (join) DraX 10:23 (join) asumu 10:23 (join) cdidd 10:24 (join) abbe 10:26 (nick) LeNsTR -> LeNsTR|off 10:31 (join) dme 10:34 tim-brown: is it possible to use a place in-line in code? (i.e. without implementing a separate module source file) 10:35 samth: tim-brown: yes 10:35 samth: see, for example: https://github.com/plt/racket/blob/master/collects/tests/racket/benchmarks/shootout/binarytrees-places.rkt 10:35 rudybot: http://tinyurl.com/7rc3yc4 10:35 (quit) hkBst: Quit: Konversation terminated! 10:35 samth: which uses the `place' form 10:35 samth: rudybot: doc place 10:35 rudybot: samth: http://docs.racket-lang.org/reference/places.html#(form._((lib._racket%2Fplace..rkt)._place)) 10:38 tim-brown: samth: thank you 10:38 samth: np 10:38 tim-brown: rudybot: thank you 10:38 rudybot: tim-brown: editland with truth? He can destroy you if He wills and bring into 10:39 tim-brown: what's that insane robot going on about? 10:43 (quit) jhemann: Ping timeout: 245 seconds 10:45 (join) gciolli 10:46 (quit) gciolli: Client Quit 10:48 (quit) dnolen: Ping timeout: 240 seconds 10:50 (quit) ahinki: Quit: ChatZilla 0.9.88 [Firefox 11.0/20120222074758] 10:56 (quit) crichards: Remote host closed the connection 11:00 (join) jhemann 11:08 (quit) Shviller: Ping timeout: 276 seconds 11:09 (join) Shviller 11:10 (join) Sicp 11:10 (quit) Sicp: Changing host 11:10 (join) Sicp 11:12 (quit) jhemann: Ping timeout: 276 seconds 11:25 (quit) jrslepak: Quit: This computer has gone to sleep 11:25 (quit) jeapostrophe: Ping timeout: 248 seconds 11:25 (quit) Skola: Ping timeout: 248 seconds 11:34 (quit) Sicp: Remote host closed the connection 11:43 (join) anRch 11:44 (join) dnolen 11:47 (quit) djcb: Remote host closed the connection 11:51 (quit) bluezenix: Quit: Leaving. 11:54 (join) francisl 11:54 (part) francisl 11:59 (join) realitygrill 12:06 (quit) EmmanuelOga: Quit: WeeChat 0.3.7-dev 12:06 (join) MayDaniel 12:09 (quit) anRch: Quit: anRch 12:09 (join) jonrafkind 12:18 (join) anRch 12:33 (quit) Blkt: Remote host closed the connection 12:34 (join) bluezenix 12:35 (join) djcb 12:45 (join) jhemann 12:46 (join) gciolli 12:49 (join) Sicp 12:49 (quit) Sicp: Changing host 12:49 (join) Sicp 12:50 (quit) anRch: Read error: Connection reset by peer 12:51 (join) anRch 12:51 (join) jhemann_ 12:54 (quit) gciolli: Quit: Leaving. 12:54 (quit) jhemann: Ping timeout: 260 seconds 12:55 (quit) anRch: Client Quit 12:57 (quit) MayDaniel: Read error: Connection reset by peer 12:59 (quit) bluezenix: Quit: Leaving. 13:00 bremner: the question kindof answers itself 13:02 (join) bluezenix 13:07 (quit) bluezenix: Client Quit 13:14 (join) Skola 13:17 (join) jeapostrophe 13:34 (join) jhemann 13:37 (quit) jhemann_: Ping timeout: 252 seconds 13:45 (quit) jhemann: Ping timeout: 265 seconds 13:46 (join) MayDaniel 13:50 bremner: eli: does it make sense that "#lang typed/racket\n(display "hello world")" takes about twice as long if I replace "typed/racket" with pl? 13:51 bremner: Obviously that is a silly example, but I'm trying see if the performance issues I'm having are because I've forgotten to compile something, or something similar. 13:51 (quit) MayDaniel: Read error: Connection reset by peer 13:52 (join) jhemann 13:52 (join) Kaylin 13:53 (quit) dous: Remote host closed the connection 13:55 bremner: eli: Oh, nevermind, it isn't even true. Stupid mistake. 13:58 (nick) LeNsTR|off -> LeNsTR 14:00 (quit) Skola: Quit: leaving 14:00 (join) Skola 14:03 (quit) djcb: Read error: Connection reset by peer 14:05 (nick) LeNsTR -> LeNsTR|off 14:05 (join) djcb 14:07 (nick) LeNsTR|off -> LeNsTR 14:12 (nick) LeNsTR -> LeNsTR|off 14:28 (join) MayDaniel 14:46 (quit) mario-goulart: Remote host closed the connection 14:46 (quit) dsantiago: Quit: Computer has gone to sleep. 14:50 (quit) jhemann: Ping timeout: 260 seconds 14:51 (nick) LeNsTR|off -> LeNsTR 14:53 (join) jhemann 14:58 (quit) MayDaniel: Read error: Connection reset by peer 15:05 (join) mario-goulart 15:17 (join) bmp 15:29 (quit) Sicp: Ping timeout: 252 seconds 15:30 (quit) Skola: Quit: Lost terminal 15:33 (join) Sicp 15:33 (quit) Sicp: Changing host 15:33 (join) Sicp 15:39 (join) MayDaniel 15:42 (quit) jhemann: Ping timeout: 240 seconds 15:47 (join) bluezenix 15:52 (join) jhemann 15:57 (join) vkz 15:58 (quit) jhemann: Ping timeout: 265 seconds 16:00 (quit) mario-goulart: Remote host closed the connection 16:04 (join) mario-goulart 16:17 (quit) realitygrill: *.net *.split 16:17 (quit) mithos28: *.net *.split 16:17 (quit) masm: *.net *.split 16:17 (quit) jrslepak_: *.net *.split 16:17 (quit) ivan`: *.net *.split 16:17 (quit) shachaf: *.net *.split 16:17 (quit) swartzcr: *.net *.split 16:17 (quit) rapacity: *.net *.split 16:17 (quit) noelw: *.net *.split 16:17 (quit) AlbireoX: *.net *.split 16:17 (quit) rmrfchik: *.net *.split 16:17 (quit) m4burns: *.net *.split 16:17 (quit) jschuster: *.net *.split 16:17 (quit) ChanServ: *.net *.split 16:17 (quit) djcb: *.net *.split 16:17 (quit) jonrafkind: *.net *.split 16:17 (quit) karswell: *.net *.split 16:17 (quit) SeanTAllen: *.net *.split 16:17 (quit) vkz: *.net *.split 16:17 (quit) MayDaniel: *.net *.split 16:17 (quit) DraX: *.net *.split 16:17 (quit) sid0: *.net *.split 16:17 (quit) shaatar: *.net *.split 16:17 (quit) gf3: *.net *.split 16:17 (quit) kandinski: *.net *.split 16:17 (quit) em: *.net *.split 16:17 (quit) bill_h: *.net *.split 16:17 (quit) dnolen: *.net *.split 16:17 (quit) mario-goulart: *.net *.split 16:17 (quit) bmp: *.net *.split 16:17 (quit) stamourv: *.net *.split 16:17 (quit) sethalves: *.net *.split 16:17 (quit) tgilray: *.net *.split 16:17 (quit) danking: *.net *.split 16:17 (quit) cataska: *.net *.split 16:17 (quit) turon: *.net *.split 16:17 (quit) cky: *.net *.split 16:17 (quit) cipher: *.net *.split 16:17 (nick) LeNsTR -> LeNsTR|off 16:18 (join) jhemann 16:18 (join) vkz 16:18 (join) MayDaniel 16:18 (join) bmp 16:18 (join) djcb 16:18 (join) jonrafkind 16:18 (join) realitygrill 16:18 (join) dnolen 16:18 (join) DraX 16:18 (join) mithos28 16:18 (join) masm 16:18 (join) noelw 16:18 (join) karswell 16:18 (join) stamourv 16:18 (join) sid0 16:18 (join) SeanTAllen 16:18 (join) shaatar 16:18 (join) AlbireoX 16:18 (join) sethalves 16:18 (join) rmrfchik 16:18 (join) tgilray 16:18 (join) danking 16:18 (join) cataska 16:18 (join) ivan` 16:18 (join) m4burns 16:18 (join) gf3 16:18 (join) jschuster 16:18 (join) turon 16:18 (join) kandinski 16:18 (join) jrslepak_ 16:18 (join) shachaf 16:18 (join) swartzcr 16:18 (join) rapacity 16:18 (join) cky 16:18 (join) em 16:18 (join) ChanServ 16:18 (join) cipher 16:18 (join) bill_h 16:18 (quit) em: Max SendQ exceeded 16:18 (quit) AlbireoX: Max SendQ exceeded 16:21 (join) em 16:22 (quit) dnolen: Ping timeout: 245 seconds 16:23 (join) dnolen 16:25 (join) AlbireoX 16:31 (join) kvda 16:39 (join) jrslepak 16:43 (join) mario-goulart 16:53 (quit) Sicp: Ping timeout: 260 seconds 17:02 (quit) tgilray: Quit: Coyote finally caught me 17:09 (quit) dzhus: Remote host closed the connection 17:12 (quit) jhemann: Ping timeout: 245 seconds 17:14 (quit) MayDaniel: Read error: Connection reset by peer 17:15 (join) tgilray 17:24 (join) dsantiago 17:26 (join) RacketCommitBot 17:26 RacketCommitBot: [racket] plt pushed 1 new commit to master: http://git.io/EDwwQw 17:26 RacketCommitBot: [racket/master] Remove dependency on unstable/port. - Vincent St-Amour 17:26 (part) RacketCommitBot 17:29 (join) EmmanuelOga 17:32 (join) jhemann 17:33 (nick) LeNsTR|off -> LeNsTR 17:38 (nick) LeNsTR -> LeNsTR|off 17:39 (quit) noam: Ping timeout: 260 seconds 17:42 (quit) jrslepak: Quit: This computer has gone to sleep 17:44 (nick) LeNsTR|off -> LeNsTR 17:46 (quit) dnolen: Quit: Page closed 17:47 (quit) bmp: Quit: Bye! 17:48 (nick) LeNsTR -> LeNsTR|off 17:48 (join) RacketCommitBot 17:48 RacketCommitBot: [racket] plt pushed 3 new commits to master: http://git.io/UW4QXg 17:48 RacketCommitBot: [racket/master] fix problem with continuations - Matthew Flatt 17:48 RacketCommitBot: [racket/master] fix problem with continuations - Matthew Flatt 17:48 RacketCommitBot: [racket/master] add some interpreter vs. closure compiler benchmarks - Matthew Flatt 17:48 (part) RacketCommitBot 17:49 (quit) jeapostrophe: Ping timeout: 265 seconds 17:50 (quit) Kaylin: Read error: Connection reset by peer 17:56 (quit) jhemann: Ping timeout: 260 seconds 18:12 (join) jao 18:14 (join) offby1 18:29 (join) jhemann 18:32 (quit) dsantiago: Quit: Computer has gone to sleep. 18:39 em: how does racket do list comprehensions?? 18:46 (quit) bluezenix: Quit: Leaving. 18:49 em: I found it -- http://docs.racket-lang.org/guide/for.html 18:55 offby1: rather nicely, if I may say so 18:55 offby1: rudybot: (for*/list ([x (in-range 10)][y (in-range x)]) (cons x y)) 18:55 rudybot: offby1: ; Value: ((1 . 0) (2 . 0) (2 . 1) (3 . 0) (3 . 1) (3 . 2) (4 . 0) (4 . 1) (4 . 2) (4 . 3) (5 . 0) (5 . 1) (5 . 2) (5 . 3) (5 . 4) (6 . 0) (6 . 1) (6 . 2) (6 . 3) (6 . 4) (6 . 5) (7 . 0) (7 . 1) (7 . 2) (7 . 3) (7 . 4) (7 . 5) (7 . 6) (8 . 0) (8 . 1) (8 . 2) (8 . 3) (8 . 4) (8 . 5) (8 . 6) (8 . 7) (9 . 0) (9 . 1) (9 . 2) (9 . 3) (9 . 4) (9 . 5) (9 . 6) (9 . 7) (9 . 8)) 19:00 (quit) mceier: Quit: leaving 19:00 samth: rudybot: (for*/list ([x 10][y x]) (cons x y)) 19:00 rudybot: samth: ; Value: ((1 . 0) (2 . 0) (2 . 1) (3 . 0) (3 . 1) (3 . 2) (4 . 0) (4 . 1) (4 . 2) (4 . 3) (5 . 0) (5 . 1) (5 . 2) (5 . 3) (5 . 4) (6 . 0) (6 . 1) (6 . 2) (6 . 3) (6 . 4) (6 . 5) (7 . 0) (7 . 1) (7 . 2) (7 . 3) (7 . 4) (7 . 5) (7 . 6) (8 . 0) (8 . 1) (8 . 2) (8 . 3) (8 . 4) (8 . 5) (8 . 6) (8 . 7) (9 . 0) (9 . 1) (9 . 2) (9 . 3) (9 . 4) (9 . 5) (9 . 6) (9 . 7) (9 . 8)) 19:00 samth: offby1: ha 19:03 em: offby1: say you have (define (square x) (* x x)) how would racket handle: (map square (in-naturals 6)) 19:03 samth: rudybot: (sequence-map sqr (in-naturals 6)) 19:03 rudybot: samth: ; Value: #(struct:stream {eager . #(struct:stream-pare #(struct:stream {lazy . #}) #(struct:stream {lazy . #}))}) 19:03 samth: rudybot: (define s (sequence-map sqr (in-naturals 6))) 19:03 rudybot: samth: Done. 19:04 samth: rudybot: (sequence-take s 10) 19:04 rudybot: samth: error: reference to an identifier before its definition: sequence-take in module: 'program 19:04 samth: rudybot: (sequence-head s) 19:04 rudybot: samth: error: reference to an identifier before its definition: sequence-head in module: 'program 19:04 PfhorSlayer: Is it possible to define a function inside of a let expression? 19:04 em: samth: how would we have racket square every natural number greater than 5, and return the list of the results? 19:05 samth: em: that's what i just did 19:05 PfhorSlayer: like, I want to have a function that only exists inside of the scope of the let 19:05 samth: PfhorSlayer: like this: 19:05 chandler: PfhorSlayer: You mean something like (let ((x 1)) (define (f) x) (f)) ? Sure, that works fine. 19:05 em: oh i see you have to use sequence map 19:05 samth: rudybot: (let ([x 1]) (define (f y) (+ y x)) (f 7)) 19:05 rudybot: samth: ; Value: 8 19:05 em: is sqr built in? 19:05 PfhorSlayer: I tried that 19:05 samth: em: yup 19:05 PfhorSlayer: I must have fucked up my parens, let me double check :) 19:06 em: samth: the sequence-take s 10 did not work. 19:06 samth: rudybot: (stream-ref s 15) 19:06 rudybot: samth: ; Value: 441 19:06 PfhorSlayer: oh, I was trying to put the function inside of the values list in the let 19:06 samth: rudybot: (stream-ref s 16) 19:06 (join) RacketCommitBot 19:06 RacketCommitBot: [racket] plt pushed 1 new commit to master: http://git.io/JaZOXw 19:06 RacketCommitBot: [racket/master] Rename scratch to avoid running by DrDr. - David Van Horn 19:06 (part) RacketCommitBot 19:06 rudybot: samth: ; Value: 484 19:07 samth: rudybot: (sqrt 484) 19:07 rudybot: samth: ; Value: 22 19:07 PfhorSlayer: Yeah, that works. Thanks! 19:07 samth: em: sequence-take isn't defined, but you can write it pretty easily 19:08 samth: rudybot: (define (sequence-take s n) (for/list ([_ n] [e s]) e)) 19:08 rudybot: samth: Done. 19:08 samth: rudybot: (sequence-take s 10) 19:08 rudybot: samth: ; Value: (36 49 64 81 100 121 144 169 196 225) 19:08 samth: em: ta da 19:09 PfhorSlayer: does rudybot ever clear out its environment? 19:09 samth: PfhorSlayer: yeah, i think it has a timeout 19:09 samth: and the environments are per-user 19:09 PfhorSlayer: oh, that's smart :) 19:09 samth: rudybot: init racket 19:09 rudybot: samth: your sandbox is ready 19:09 samth: and now i have a fresh one 19:09 PfhorSlayer: super cool. 19:10 samth: PfhorSlayer: and it's sandboxed 19:10 samth: rudybot: (let L () (L)) 19:10 rudybot: samth: error: with-limit: out of time 19:10 samth: like that 19:12 em: samth: is it doing this with lazy evaluation? 19:12 samth: em: yes, roughly 19:14 em: samth: why did i get invalid syntax from (define (sequence-take s n) (for/list ([_ n] [e s]) e)) 19:16 samth: em: i don't know 19:16 samth: what language are you using? 19:16 em: Racket 20:19 (topic) -: Racket -- http://racket-lang.org -- logs @ http://racket-lang.org/irc-logs 20:19 (names) -: gabot jrslepak samth turon jrslepak_ jschuster dyoo Kaylin dous dsantiago offby1 jao EmmanuelOga tgilray mario-goulart kvda AlbireoX em bill_h cipher @ChanServ cky rapacity swartzcr shachaf kandinski gf3 m4burns ivan` cataska rmrfchik sethalves shaatar SeanTAllen sid0 karswell noelw masm mithos28 DraX realitygrill jonrafkind djcb vkz Shviller dme abbe cdidd asumu Enoria PfhorSlayer kanak Shvillr tim-brown SHODAN bluephoenix47 ivan\ Fulax dsp1 Diarmid hyko 20:19 (names) -: _p4bl0 snorble_ LeNsTR|off Demosthenes ec tewk rudybot eMBee shadgregory aidy Twey mattmight acarrico jasinai scyrmion chandler ozzloy jamessan bremner 20:20 (quit) vkz: Quit: vkz 20:30 (quit) jrslepak: Quit: This computer has gone to sleep 20:34 (quit) jonrafkind: Ping timeout: 246 seconds 20:43 (join) jeapostrophe 20:44 (part) dyoo 20:44 PfhorSlayer: If I have a macro that defines a couple functions inside a let, how can I then invoke another macro from inside the first one and have the second macro be able to use those functions? 20:45 PfhorSlayer: basically I have an outer construct that needs to keep track of stuff, and multiple inner constructs that manipulate what's being tracked 20:48 samth: PfhorSlayer: yes, you can do that, if i understand you correctly 20:48 (join) vkz 20:49 PfhorSlayer: I was getting an error from the inner macro, about the symbol I defined in the outer macro being unbound 20:49 samth: can you create a gist with an example? 20:50 PfhorSlayer: I can try, give me a couple minutes :) 20:54 PfhorSlayer: What's the paste bot here? 20:54 samth: just go to gist.github.com 20:55 PfhorSlayer: https://gist.github.com/1936915 20:56 PfhorSlayer: Basically, I want to pass a list to the inner macro whose elements are either a value, or another list with a name and a value 20:56 PfhorSlayer: then later in the outer macro (after the inner macro runs), I want to be able to use the names that were passed to the inner macro to get an index of what element that name mapped to 20:57 PfhorSlayer: so I'd want to be able to, after the "init0 ..." line, do something like (get-name-index 'fraggle) and have it return 2 20:58 samth: PfhorSlayer: aaaaah, the newlines with ) 20:58 PfhorSlayer: Sorry, forgot to clean it up 20:58 PfhorSlayer: forgive me :P 20:59 samth: you just need them to know to have the same name 20:59 samth: so change outer-macro and inner-macro to both take a name argument, and pass in the same one 20:59 (quit) jeapostrophe: Ping timeout: 260 seconds 21:00 samth: or, change outer-macro to provide the name as an argument to all the calls to inner-macro 21:00 PfhorSlayer: No, inner-macro is only called once 21:01 PfhorSlayer: I don't understand what you mean by passing in the same name though? 21:01 samth: change it to be (outer-macro getter foo (inner-macro getter ('blaggle 'item0) ('item1) ('fraggle 'item2))) 21:02 samth: and then use that argument as the name for get-name-index 21:02 samth: although you probably need `setter' as well 21:02 PfhorSlayer: I don't think I explained it correctly 21:03 PfhorSlayer: The idea is that the inner macro creates a list of objects that other code just deals with by index 21:03 PfhorSlayer: But inside of the outer macro, I want to be able to give these objects symbol names, and get them by name instead of by index 21:04 PfhorSlayer: so say 'itemN were all different objects, not just symbols, and I didn't want to have to remember which one item1 actualy was 21:05 samth: PfhorSlayer: i don't see why these can't just be functions 21:05 PfhorSlayer: I could give it a name 'foo, and instead of saying "get this property of index 1" I could say "get this property of (get-item-index 'foo)" 21:05 samth: inner macro is just constructing a list 21:06 PfhorSlayer: If there's a better way to do this I'm all ears! This is just the first thing I've tried :) 21:06 (quit) jao: Ping timeout: 245 seconds 21:07 PfhorSlayer: Do you mean just lift the mapping structures to outside of these syntaxes, and then just reset them each time? 21:07 PfhorSlayer: I was thinking of doing that if I couldn't get it working this way 21:07 samth: PfhorSlayer: just have inner-macro be a function, with it's current body 21:07 samth: as in: 21:08 PfhorSlayer: But I also wanted to be able to pass the syntax objects around so I could get good error reporting 21:08 samth: (define (inner-macro . items) (let ([input items] [items '()]) ...)) 21:08 samth: first get it working 21:08 samth: then worry about error reporting 21:09 (join) jrslepak 21:10 samth: PfhorSlayer: sorry, gotta go 21:10 (nick) samth -> samth_away 21:10 PfhorSlayer: Alright, thanks 21:10 PfhorSlayer: I'll figure it out :) 21:10 samth_away: ask on the mailing list if you don't figure it out 21:16 (join) RacketCommitBot 21:16 RacketCommitBot: [racket] plt pushed 2 new commits to master: http://git.io/on9usg 21:16 RacketCommitBot: [racket/master] Fix contract on filebox to reflect documentation. - David Van Horn 21:16 RacketCommitBot: [racket/master] fix error in blame assignment for -> with dot-args. - Robby Findler 21:16 (part) RacketCommitBot 21:20 (nick) LeNsTR|off -> LeNsTR 21:25 (nick) LeNsTR -> LeNsTR|off 21:33 PfhorSlayer: Okay, so my issue now is that I can't seem to get the inner macro to recognize the define I've created in the outer macro 21:34 PfhorSlayer: I guess because they're processed at different levels? 21:49 (quit) vkz: Ping timeout: 276 seconds 22:22 (join) jeapostrophe 22:53 (join) jonrafkind 22:53 (join) RacketCommitBot 22:53 RacketCommitBot: [racket] plt pushed 1 new commit to master: http://git.io/0fu-Eg 22:53 RacketCommitBot: [racket/master] Make the "F" in "Search in Files" get the underline in the menu - Robby Findler 22:53 (part) RacketCommitBot 23:01 (join) vkz 23:03 (quit) kvda: Quit: -___- 23:09 (join) yin 23:44 (quit) masm: Quit: Leaving. 23:45 (quit) vkz: Quit: vkz 23:51 (join) Skola