00:00:32 how does "let" looks like in the source? 00:01:09 DT-sama [~Feeock@net-93-149-41-158.cust.dsl.teletu.it] has joined #scheme 00:01:26 -!- DT`` [~Feeock@net-93-149-63-132.cust.dsl.teletu.it] has quit [Ping timeout: 240 seconds] 00:01:30 -!- DT-sama is now known as DT`` 00:02:49 rageous [~Adium@173-160-119-114-Minnesota.hfc.comcastbusiness.net] has joined #scheme 00:03:01 Harrold 00:03:05 it's a special form 00:03:15 let is just 00:03:19 a lambda expression 00:03:32 (let ((x 0)) (body...) 00:03:33 =- 00:03:43 ((lambda (x) (body...)) 0) 00:03:51 hmm 00:04:04 but how do they do cascading in let? 00:04:05 -!- tronador_ [~guille@190.66.173.210] has quit [Ping timeout: 255 seconds] 00:04:12 what do you mean cascading? 00:04:16 like let*? 00:04:36 let* is just a 00:04:39 let within a let 00:04:46 (let* ((x 0) (y 1)) ...) -> (let ((x 0)) (let ((y 1)) ...)) 00:04:49 translate that into a lambda expression and you get some weird shit 00:04:52 hmm 00:04:55 well 00:04:56 not weird 00:05:03 -> ((lambda (x) ((lambda (y) ...) 1)) 0) 00:05:04 but complicated compared to the let* stynax 00:05:17 ^ 00:05:18 that 00:05:19 Mango-chan: Well, that's the power of macros. 00:05:28 i've yet to learn macros :3 00:05:36 Mango-chan: Which is why languages that don't provide macros are teh suck. ;-) 00:05:53 Yeah, let can be expanded to a lambda form, like DT`` just said. (I was writing it too, but, not as fast. :-P) 00:06:01 Mango-chan: let and let* (and letrec, in many implementations) are all macros. 00:06:24 i guess (define (... 00:06:26 is also a macro? 00:06:32 hmm 00:06:33 in Racket. 00:06:33 implicit lambda etc 00:06:37 becasue I have to rewrite "let" :/ 00:06:40 what about STk 00:06:43 Harrold 00:06:43 it expands to (define-values (id) (lambda ...)) 00:06:45 -!- copumpkin [~pumpkin@unaffiliated/pumpkingod] has quit [Quit: Computer has gone to sleep.] 00:06:54 yeah DT`` it's the same for STk 00:07:13 fds, you can't match parens with the eyes? It's one of the super powers you acquire by learning Lisp! 00:07:21 Harrold: just understand that let is basically a lambda executed with the giving parems 00:07:28 ok 00:07:34 given 00:07:44 DT``: Maybe I'm too Emacs-reliant. :-P 00:07:52 i need to learn vim 00:07:52 :x 00:08:02 Mango-chan: No you don't. 00:08:03 what if I do: (let ((= x 5)) ((= y 9)) ((= z 10 ) ) 00:08:03 vim with Lisp? 00:08:06 Not for Scheme coding, at least. 00:08:09 why would you *ever* do that? 00:08:20 The one true editor for Scheme code is Paredit. 00:08:21 Harrold, syntax error, probably. 00:08:23 not for lisp 00:08:35 Harrold that's a syntax error 00:08:44 rudybot, (let ((= x 5) (= y 9) (= z 10)) (+ x y z)) 00:08:44 DT``: error: eval:1:6: let: bad syntax (not an identifier and expression for a binding) at: (= x 5) in: (let ((= x 5) (= y 9) (= z 10)) (+ x y z)) 00:09:01 (let ( ) (body...)) 00:09:03 _reid [~reid@pool-71-186-124-126.chi01.dsl-w.verizon.net] has joined #scheme 00:09:05 rudybot, (let ((x 5) (y 9) (z 10)) (+ x y z)) ; correct 00:09:05 DT``: ; Value: 24 00:09:07 is how let works 00:09:26 rudybot, (define make-count 00:09:26 Mango-chan: is there an advantage in writing a procedure (define foo (lambda arg) ...) rather than (define (foo arg) ...) ? 00:09:26 (let ((glob 0)) 00:09:26 (lambda () 00:09:26 (let ((loc 0)) 00:09:26 (lambda () 00:09:27 (set! loc (+ loc 1)) 00:09:27 (set! glob (+glob 1)) 00:09:28 (list loc glob)))))) 00:09:35 rudybot, ((lambda (x y z) (+ x y z)) 5 9 10) 00:09:35 DT``: ; Value: 24 00:09:36 rudybot: (let ((= 5) (* 9) (/ 10)) (+ = * /)) 00:09:36 pjb: your sandbox is ready 00:09:37 pjb: ; Value: 24 00:09:37 stupid bot 00:09:45 STUPID BOT 00:10:02 rudybot, ((()( ))(()( ))) 00:10:12 DT``: error: with-limit: out of time 00:10:19 rudybot, (define make-count (let ((glob 0)) (lambda () (let ((loc 0)) (lambda () (set! loc (+ loc 1)) (set! glob (+glob 1)) (list loc glob)))))) 00:10:20 Mango-chan: your sandbox is ready 00:10:20 Mango-chan: Done. 00:10:22 this should be the standardized Scheme fork bomb. 00:10:35 DT``: Try ((call/cc call/cc) (call/cc call/cc)) ;-) 00:10:36 DT``: so I am allowed only to do: (let ((= x 5) ) ) 00:10:37 rudybot, (define c1 (make-count)) 00:10:37 Mango-chan: Done. 00:10:42 rudybot, (c1) 00:10:42 Mango-chan: error: reference to undefined identifier: +glob 00:10:42 like let allows me to set only a single value per let? 00:10:46 what! 00:10:50 no 00:10:51 Harrold 00:10:53 Harrold, without the =. 00:11:12 -!- pdlogan [~patrick@75-175-5-194.ptld.qwest.net] has left #scheme 00:11:13 that part is the BINDING 00:11:23 you're binding a value to a variable 00:11:34 Mango-chan: (+glob 1) is not the same as (+ glob 1). 00:11:43 oh 00:11:44 i typoed 00:11:45 Mango-chan: Also, using set! is frowned upon in most code. 00:11:45 :3 00:11:46 sorry 00:11:53 how come? 00:11:54 rudybot, (define fib(let*((5 (inexact->exact (sqrt 5)))( (/ (add1 5) 2)))(lambda (n)(round (/ (- (expt  n) (expt (sub1 ) n)) 5))))) 00:11:54 DT``: Done. 00:11:59 rudybot, (define make-count (let ((glob 0)) (lambda () (let ((loc 0)) (lambda () (set! loc (+ loc 1)) (set! glob (+ glob 1)) (list loc glob)))))) 00:11:59 Mango-chan: Done. 00:12:02 rudybot, (fib 15) 00:12:02 DT``: ; Value: 610 00:12:09 rudybot, (define c1 (make-count)) 00:12:09 Mango-chan: Done. 00:12:14 rudybot, (c1) 00:12:15 Mango-chan: ; Value: (1 1) 00:12:16 rudybot, (c1) 00:12:16 Mango-chan: ; Value: (2 2) 00:12:17 rudybot, (c1) 00:12:17 Mango-chan: ; Value: (3 3) 00:12:22 rudybot, (define c2 (make-count)) 00:12:22 Mango-chan: Done. 00:12:24 cky, in that case, I guess set! is ok. 00:12:24 rudybot, (c2) 00:12:25 Mango-chan: ; Value: (1 4) 00:12:26 rudybot, (c2) 00:12:26 Mango-chan: ; Value: (2 5) 00:12:29 rudybot, (c2) 00:12:29 Mango-chan: ; Value: (3 6) 00:12:40 magic 00:12:40 ! 00:13:04 ah ok 00:13:06 DT``: True, now that I reread the function. 00:13:07 what would you use instead of set!? 00:13:18 Mango-chan: In this case, just use set!. In general, use a named let. 00:13:20 rudybot, set!? 00:13:20 DT``: what would you use instead of set!? 00:13:28 so it is (let ((x 2) (y 3) (z 5)) 00:13:30 rudybot, (define set!? set!) 00:13:30 DT``: error: eval:1:14: set!: bad syntax in: set! 00:13:38 I hate you, rudybot. 00:13:41 cky 00:13:46 DT``: Syntax is not first-class in Scheme. 00:13:47 that code was to demonstrate lexical scoping 00:13:52 and OOP magic 00:13:53 Mango-chan: *nods* 00:13:58 but 00:14:09 you said set! is frowned upon 00:14:11 what would you use instead 00:14:11 ? 00:14:16 let. 00:14:21 You want OOP-type stuff? Here's an example: 00:14:28 DT`` example? 00:14:53 heh, I don't know now. 00:15:24 rudybot: (define pocket (let make ((num 8)) (lambda (x) (if (null? x) num (make x))))) 00:15:24 cky: your racket sandbox is ready 00:15:24 cky: Done. 00:15:45 rudybot: (define pocket (let make ((num 8)) (lambda (x) (if (not x) num (make x))))) 00:15:46 cky: Done. 00:15:52 rudybot: (pocket #f) 00:15:52 cky: ; Value: 8 00:15:57 wait 00:16:00 how does let 00:16:01 work like that 00:16:03 (let make... 00:16:06 rudybot: (define pocket2 (pocket 42)) 00:16:07 cky: Done. 00:16:09 isn't the syntax (let ( 00:16:11 It's a named let 00:16:15 rudybot: (pocket2 #f) 00:16:15 cky: ; Value: 42 00:16:18 rudybot: (pocket #f) 00:16:18 cky: ; Value: 8 00:16:19 hm 00:16:21 guess i've yet to learn it 00:17:00 (That example came straight out of an Andrew Plotkin IF work called "Lists and Lists".) 00:17:42 Mango-chan: Right, named let is very powerful. 00:18:16 hm 00:18:19 hopefully we'll learn it soon 00:18:38 *nods* 00:19:38 DT`` pasted "Hardcore closure OOP leverage synergy etc" at http://paste.lisp.org/display/120441 00:19:44 there. 00:20:36 Uh.... 00:20:47 *cky* is too tired for this. ;-) 00:21:15 actually, I don't even remember why it works. 00:23:56 -!- araujo [~araujo@gentoo/developer/araujo] has quit [Ping timeout: 250 seconds] 00:32:47 -!- rageous [~Adium@173-160-119-114-Minnesota.hfc.comcastbusiness.net] has quit [Quit: Leaving.] 00:33:54 tronador_ [~guille@190.66.173.210] has joined #scheme 00:37:03 araujo [~araujo@gentoo/developer/araujo] has joined #scheme 00:39:12 myu2 [~myu2@58x5x224x106.ap58.ftth.ucom.ne.jp] has joined #scheme 00:39:41 -!- myu2 [~myu2@58x5x224x106.ap58.ftth.ucom.ne.jp] has quit [Remote host closed the connection] 00:39:44 has anyone used chicken's awful egg? I'm trying to do db interaction but the $db function just keeps saying "bad argument type -not a structure of the requred type" but i'm just supposed to be able to pass it a sql query as a string 00:41:27 ooooh. the connection failed. well that's a really helpful way to tell me that -_- 00:42:03 -!- Mango-chan [Mango-chan@unaffiliated/mango-chan] has quit [Ping timeout: 248 seconds] 01:04:25 -!- sysop_fb [fb@cpe-098-121-141-115.nc.res.rr.com] has quit [] 01:04:26 -!- DT`` [~Feeock@net-93-149-41-158.cust.dsl.teletu.it] has quit [Read error: Connection reset by peer] 01:12:47 pnkfelix [~Adium@c-71-224-241-168.hsd1.nj.comcast.net] has joined #scheme 01:17:08 -!- ckrailo [~ckrailo@208.86.167.249] has quit [Quit: Computer has gone to sleep.] 01:17:14 docgnome: good error handling might easily multiply the size of a program by ten. 01:17:56 docgnome: and in scheme (r5rs) it's agravated by the fact that error handling is not defined by the standard, so you have to wrap over implementation differences. 01:20:32 DT`` [~Feeock@net-93-149-40-89.cust.dsl.teletu.it] has joined #scheme 01:20:47 -!- masm [~masm@bl16-168-147.dsl.telepac.pt] has quit [Quit: Leaving.] 01:22:29 What do Schemers think of JavaScript? I myself haven't had any pleasant experiences with it. 01:22:47 ive heard some schemers claim javascript is lisp with a new syntax 01:23:00 i like js. but it also has a lot of crufty parts 01:23:53 -!- pnkfelix [~Adium@c-71-224-241-168.hsd1.nj.comcast.net] has quit [Quit: Leaving.] 01:24:06 Just on an aesthetic note, wouldn't lisp's syntax fit better with XML than that of JS? 01:24:50 well I guess you could use xml instead of s-expressions.. but that would be horrible 01:25:21 The only solution is to embed scheme in firefox, and to develop a "must use" web site that use scheme scripts. So people will definitely need to download the firefox with scheme embedded to use this web site, and once scheme is in 99% of the browsers, the other web sites will be able to use scheme too. 01:25:34 embedding scheme in firefox is the easy part. 01:25:45 No, I meant wouldn't embedded scheme fit better with XML than JS does? 01:26:02 aidalgol: once you have sexps, you can reject XML and JSON. 01:26:18 That is, don't s-expressions look more like XML than JS expressions? 01:26:20 Imagine: Content-Type: application/sexp 01:26:36 pjb: That would be nice. 01:26:53 -!- DT`` [~Feeock@net-93-149-40-89.cust.dsl.teletu.it] has quit [Ping timeout: 255 seconds] 01:27:01 yea right, now get the browser vendors to agree on a set of features to support 01:27:05 r5rs aint gonna cut it 01:27:23 Perhaps r7rs/small + web stuff? 01:27:35 yea, maybe 01:28:28 alternatively there are scheme->js compilers, so thats a reasonable compromise I guess 01:29:03 Is there a Scheme implemented in Common Lisp? 01:31:04 aidalgol: there is pseudo-scheme, a r4rs implemented in Common Lisp. 01:31:19 Available from CMU AILab Repository. 01:36:54 -!- pdelgallego [~pdelgalle@1385159852.dhcp.dbnet.dk] has quit [Ping timeout: 246 seconds] 01:39:27 DT`` [~Feeock@net-93-149-43-56.cust.dsl.teletu.it] has joined #scheme 01:39:47 xwl [~user@114.241.245.172] has joined #scheme 01:46:35 -!- jonrafkind [~jon@crystalis.cs.utah.edu] has quit [Ping timeout: 248 seconds] 01:49:56 ijp [~user@host86-148-145-84.range86-148.btcentralplus.com] has joined #scheme 01:50:59 -!- zmv___ [~daniel@c934a9f5.virtua.com.br] has quit [Ping timeout: 252 seconds] 01:56:44 -!- dnolen [~davidnole@184.152.69.75] has quit [Quit: dnolen] 02:02:19 Adamant [~Adamant@unaffiliated/adamant] has joined #scheme 02:08:54 rageous [~Adium@user-38q461p.cable.mindspring.com] has joined #scheme 02:09:00 dnolen [~davidnole@184.152.69.75] has joined #scheme 02:09:02 -!- dnolen [~davidnole@184.152.69.75] has quit [Client Quit] 02:20:53 -!- DT`` [~Feeock@net-93-149-43-56.cust.dsl.teletu.it] has quit [Ping timeout: 255 seconds] 02:26:42 pnkfelix [~Adium@c-71-224-241-168.hsd1.nj.comcast.net] has joined #scheme 02:33:57 DT`` [~Feeock@net-93-149-41-103.cust.dsl.teletu.it] has joined #scheme 02:35:54 -!- tr3x [~tr3x@93-141-3-50.adsl.net.t-com.hr] has quit [Excess Flood] 02:37:58 tr3x [~tr3x@93-141-3-50.adsl.net.t-com.hr] has joined #scheme 02:39:42 -!- pnkfelix [~Adium@c-71-224-241-168.hsd1.nj.comcast.net] has quit [Quit: Leaving.] 02:59:17 -!- xwl [~user@114.241.245.172] has quit [Remote host closed the connection] 03:00:05 xwl [~user@114.241.245.172] has joined #scheme 03:03:51 bharath_g [~bharath10@117.211.88.150] has joined #scheme 03:16:32 -!- Adamant [~Adamant@unaffiliated/adamant] has quit [Quit: Adamant] 03:27:02 -!- DT`` [~Feeock@net-93-149-41-103.cust.dsl.teletu.it] has quit [Read error: Connection reset by peer] 03:30:42 -!- homie [~levgue@xdsl-78-35-161-124.netcologne.de] has quit [Read error: Operation timed out] 03:31:08 dfeuer [~dfeuer@wikimedia/Dfeuer] has joined #scheme 03:31:17 homie` [~levgue@xdsl-78-35-174-85.netcologne.de] has joined #scheme 03:34:13 -!- dfeuer [~dfeuer@wikimedia/Dfeuer] has quit [Remote host closed the connection] 03:35:04 myu2 [~myu2@x108121.dynamic.ppp.asahi-net.or.jp] has joined #scheme 03:36:18 dfeuer [~dfeuer@wikimedia/Dfeuer] has joined #scheme 03:41:14 DT`` [~Feeock@net-93-149-39-135.cust.dsl.teletu.it] has joined #scheme 04:00:46 -!- Harrold [~quassel@bas1-ottawa11-1176121672.dsl.bell.ca] has quit [Ping timeout: 240 seconds] 04:10:56 -!- saccade [~saccade@74-95-7-186-SFBA.hfc.comcastbusiness.net] has quit [Ping timeout: 276 seconds] 04:21:20 ysph [~user@adsl-89-38-168.mgm.bellsouth.net] has joined #scheme 04:36:20 -!- tr3x [~tr3x@93-141-3-50.adsl.net.t-com.hr] has quit [Ping timeout: 255 seconds] 04:37:58 tr3x [~tr3x@93-139-97-119.adsl.net.t-com.hr] has joined #scheme 04:38:10 -!- bgs100 [~ian@unaffiliated/bgs100] has quit [Quit: Night.] 04:56:47 peterhil` [~peterhil@a91-153-112-241.elisa-laajakaista.fi] has joined #scheme 05:04:41 -!- MrFahrenheit [~RageOfTho@users-151-187.vinet.ba] has quit [Ping timeout: 255 seconds] 05:10:03 copumpkin [~pumpkin@209-6-232-56.c3-0.sbo-ubr1.sbo.ma.cable.rcn.com] has joined #scheme 05:10:03 -!- copumpkin [~pumpkin@209-6-232-56.c3-0.sbo-ubr1.sbo.ma.cable.rcn.com] has quit [Changing host] 05:10:03 copumpkin [~pumpkin@unaffiliated/pumpkingod] has joined #scheme 05:24:24 -!- MichaelRaskin [~MichaelRa@195.91.224.225] has quit [Ping timeout: 240 seconds] 05:24:29 -!- copumpkin [~pumpkin@unaffiliated/pumpkingod] has quit [Quit: Computer has gone to sleep.] 05:55:04 blueadept [~blueadept@unaffiliated/blueadept] has joined #scheme 06:07:41 -!- tupi [~david@189.60.162.71] has quit [Quit: Leaving] 06:37:14 -!- blueadept [~blueadept@unaffiliated/blueadept] has quit [Quit: Leaving] 06:54:54 nilg [~user@77.70.2.229] has joined #scheme 06:58:10 -!- tronador_ [~guille@190.66.173.210] has quit [Quit: tronador_] 07:01:11 -!- Khisanth [~Khisanth@pool-96-250-21-139.nycmny.east.verizon.net] has quit [Ping timeout: 252 seconds] 07:09:36 -!- bharath_g [~bharath10@117.211.88.150] has quit [Remote host closed the connection] 07:14:19 Khisanth [~Khisanth@pool-96-246-9-42.nycmny.east.verizon.net] has joined #scheme 07:21:14 ccorn [~ccorn@j109182.upc-j.chello.nl] has joined #scheme 07:36:43 gravicappa [~gravicapp@ppp91-77-183-134.pppoe.mtu-net.ru] has joined #scheme 07:51:47 -!- kilimanjaro [~kilimanja@unaffiliated/kilimanjaro] has quit [Ping timeout: 252 seconds] 07:52:30 -!- nteon [~nteon@c-98-210-195-105.hsd1.ca.comcast.net] has quit [Remote host closed the connection] 07:53:07 mmc2 [~michal@82-148-210-75.fiber.unet.nl] has joined #scheme 07:56:48 -!- ysph [~user@adsl-89-38-168.mgm.bellsouth.net] has quit [Read error: Operation timed out] 08:26:36 pdelgallego [~pdelgalle@1385159852.dhcp.dbnet.dk] has joined #scheme 08:45:18 -!- Nisstyre [~nisstyre@infocalypse-net.info] has quit [Ping timeout: 250 seconds] 08:53:02 maxs42 [~MaxSchobe@chello213047131061.5.11.vie.surfer.at] has joined #scheme 08:57:55 -!- maxs42 [~MaxSchobe@chello213047131061.5.11.vie.surfer.at] has left #scheme 09:07:34 saccade [~saccade@74-95-7-186-SFBA.hfc.comcastbusiness.net] has joined #scheme 09:08:15 -!- homie` [~levgue@xdsl-78-35-174-85.netcologne.de] has quit [Quit: ERC Version 5.3 (IRC client for Emacs)] 09:12:09 homie [~levgue@xdsl-78-35-174-85.netcologne.de] has joined #scheme 09:15:46 -!- saccade [~saccade@74-95-7-186-SFBA.hfc.comcastbusiness.net] has quit [Ping timeout: 240 seconds] 09:24:42 kuribas [~user@d54C47196.access.telenet.be] has joined #scheme 09:44:11 Administrator_ [~Administr@222.212.2.127] has joined #scheme 09:47:36 -!- sth0KK [~Administr@125.71.39.215] has quit [Ping timeout: 260 seconds] 09:53:08 -!- mmc2 [~michal@82-148-210-75.fiber.unet.nl] has quit [Quit: Leaving.] 09:53:20 mmc2 [~michal@82-148-210-75.fiber.unet.nl] has joined #scheme 10:03:18 -!- xwl [~user@114.241.245.172] has quit [Remote host closed the connection] 10:04:43 -!- mmc2 [~michal@82-148-210-75.fiber.unet.nl] has quit [Ping timeout: 248 seconds] 10:09:03 DrDuck [~duck@216.186.151.63] has joined #scheme 10:11:46 saccade [~saccade@74-95-7-186-SFBA.hfc.comcastbusiness.net] has joined #scheme 10:17:39 -!- Administrator_ [~Administr@222.212.2.127] has quit [Quit: Leaving] 10:24:41 -!- gravicappa [~gravicapp@ppp91-77-183-134.pppoe.mtu-net.ru] has quit [Ping timeout: 276 seconds] 10:28:40 xwl [~user@114.241.245.172] has joined #scheme 10:35:08 -!- saccade [~saccade@74-95-7-186-SFBA.hfc.comcastbusiness.net] has quit [Quit: This computer has gone to sleep] 10:57:42 nilg` [~user@77.70.2.229] has joined #scheme 11:06:26 taylanub [~taylanub@p4FD936A8.dip.t-dialin.net] has joined #scheme 11:12:36 -!- xwl [~user@114.241.245.172] has quit [Remote host closed the connection] 11:14:08 -!- ijp [~user@host86-148-145-84.range86-148.btcentralplus.com] has quit [Ping timeout: 255 seconds] 11:19:53 masm [~masm@bl16-168-147.dsl.telepac.pt] has joined #scheme 11:20:29 snorble_ [~snorble@s83-179-14-105.cust.tele2.se] has joined #scheme 11:21:44 choas [~lars@p578F6A6B.dip.t-dialin.net] has joined #scheme 11:23:11 -!- snorble [~snorble@s83-179-14-105.cust.tele2.se] has quit [Ping timeout: 246 seconds] 11:35:23 gravicappa [~gravicapp@ppp91-77-183-134.pppoe.mtu-net.ru] has joined #scheme 12:08:11 -!- pdelgallego [~pdelgalle@1385159852.dhcp.dbnet.dk] has quit [Ping timeout: 260 seconds] 12:16:03 femtoo [~femto@95-89-198-8-dynip.superkabel.de] has joined #scheme 12:23:35 MrFahrenheit [~RageOfTho@users-151-187.vinet.ba] has joined #scheme 12:30:30 -!- nilg` [~user@77.70.2.229] has quit [Read error: Connection reset by peer] 12:36:45 -!- ccorn [~ccorn@j109182.upc-j.chello.nl] has quit [Quit: ccorn] 12:50:11 pdelgallego [~pdelgalle@1385159852.dhcp.dbnet.dk] has joined #scheme 12:55:08 xwl [~user@114.241.245.172] has joined #scheme 12:58:34 tauntaun [~icarus@64.134.66.112] has joined #scheme 12:58:46 -!- xwl [~user@114.241.245.172] has quit [Remote host closed the connection] 12:59:48 xwl [~user@114.241.245.172] has joined #scheme 13:21:28 -!- xwl [~user@114.241.245.172] has quit [Remote host closed the connection] 13:21:51 xwl [~user@114.241.245.172] has joined #scheme 13:23:26 -!- gravicappa [~gravicapp@ppp91-77-183-134.pppoe.mtu-net.ru] has quit [Ping timeout: 240 seconds] 13:26:24 gravicappa [~gravicapp@ppp91-77-183-134.pppoe.mtu-net.ru] has joined #scheme 13:38:02 Adamant [~Adamant@c-68-51-145-83.hsd1.ga.comcast.net] has joined #scheme 13:38:02 -!- Adamant [~Adamant@c-68-51-145-83.hsd1.ga.comcast.net] has quit [Changing host] 13:38:02 Adamant [~Adamant@unaffiliated/adamant] has joined #scheme 13:39:41 MichaelRaskin [~MichaelRa@195.91.224.225] has joined #scheme 13:39:50 -!- Adamant [~Adamant@unaffiliated/adamant] has quit [Client Quit] 13:44:28 ccorn [~ccorn@j109182.upc-j.chello.nl] has joined #scheme 13:46:43 -!- xwl [~user@114.241.245.172] has quit [Remote host closed the connection] 13:50:50 xwl [~user@114.241.245.172] has joined #scheme 13:52:17 bgs100 [~ian@unaffiliated/bgs100] has joined #scheme 13:56:11 -!- MapMan [mapman@dynamic-78-8-226-30.ssp.dialog.net.pl] has quit [Ping timeout: 248 seconds] 13:58:38 -!- femtoo [~femto@95-89-198-8-dynip.superkabel.de] has quit [Read error: Connection reset by peer] 14:00:20 -!- xwl [~user@114.241.245.172] has quit [Remote host closed the connection] 14:01:06 xwl [~user@114.241.245.172] has joined #scheme 14:02:01 -!- ccorn [~ccorn@j109182.upc-j.chello.nl] has quit [Quit: ccorn] 14:03:03 MapMan [mapman@host-62-141-192-113.swidnica.mm.pl] has joined #scheme 14:15:02 Harrold [~quassel@bas1-ottawa11-1176120975.dsl.bell.ca] has joined #scheme 14:30:07 -!- gravicappa [~gravicapp@ppp91-77-183-134.pppoe.mtu-net.ru] has quit [Read error: Connection reset by peer] 14:30:32 Nisstyre [~nisstyre@infocalypse-net.info] has joined #scheme 14:32:21 mmc2 [~michal@82-148-210-75.fiber.unet.nl] has joined #scheme 14:34:43 femtoo [~femto@95-89-198-8-dynip.superkabel.de] has joined #scheme 14:41:55 kilimanjaro [~kilimanja@unaffiliated/kilimanjaro] has joined #scheme 14:42:24 gravicappa [~gravicapp@ppp91-77-219-134.pppoe.mtu-net.ru] has joined #scheme 14:43:06 tupi [~david@189.60.162.71] has joined #scheme 14:54:04 pjb` [~t@81.202.16.46.dyn.user.ono.com] has joined #scheme 14:55:34 -!- pjb [~t@81.202.16.46.dyn.user.ono.com] has quit [Ping timeout: 246 seconds] 15:03:55 Caleb-- [thedude@bzq-79-176-206-190.red.bezeqint.net] has joined #scheme 15:06:58 copumpkin [~pumpkin@209-6-232-56.c3-0.sbo-ubr1.sbo.ma.cable.rcn.com] has joined #scheme 15:06:59 -!- copumpkin [~pumpkin@209-6-232-56.c3-0.sbo-ubr1.sbo.ma.cable.rcn.com] has quit [Changing host] 15:06:59 copumpkin [~pumpkin@unaffiliated/pumpkingod] has joined #scheme 15:22:48 kauwgom [~reid@pool-173-53-249-101.chi01.dsl-w.verizon.net] has joined #scheme 15:25:15 -!- _reid [~reid@pool-71-186-124-126.chi01.dsl-w.verizon.net] has quit [Ping timeout: 248 seconds] 15:26:27 LN^^ [~LN@91.206.142.29] has joined #scheme 15:27:44 sysop_fb [fb@cpe-098-121-141-115.nc.res.rr.com] has joined #scheme 15:43:16 homie` [~levgue@xdsl-78-35-177-201.netcologne.de] has joined #scheme 15:44:42 -!- homie` [~levgue@xdsl-78-35-177-201.netcologne.de] has quit [Client Quit] 15:44:59 -!- homie [~levgue@xdsl-78-35-174-85.netcologne.de] has quit [Ping timeout: 248 seconds] 15:46:21 tronador_ [~guille@190.66.173.210] has joined #scheme 15:48:19 homie [~levgue@xdsl-78-35-177-201.netcologne.de] has joined #scheme 15:53:03 -!- kuribas [~user@d54C47196.access.telenet.be] has quit [Quit: ERC Version 5.3 (IRC client for Emacs)] 15:54:14 dnolen [~davidnole@184.152.69.75] has joined #scheme 15:54:14 -!- dnolen [~davidnole@184.152.69.75] has quit [Excess Flood] 15:56:36 dnolen [~davidnole@184.152.69.75] has joined #scheme 16:02:35 -!- Hal9k [~Lernaean@unaffiliated/kusanagi] has quit [Ping timeout: 255 seconds] 16:05:44 -!- DrDuck [~duck@216.186.151.63] has quit [Ping timeout: 255 seconds] 16:06:16 -!- sysop_fb [fb@cpe-098-121-141-115.nc.res.rr.com] has quit [] 16:09:41 Hal9k [~Lernaean@24-107-60-232.dhcp.stls.mo.charter.com] has joined #scheme 16:09:41 -!- Hal9k [~Lernaean@24-107-60-232.dhcp.stls.mo.charter.com] has quit [Changing host] 16:09:41 Hal9k [~Lernaean@unaffiliated/kusanagi] has joined #scheme 16:10:11 ijp [~user@host86-163-223-209.range86-163.btcentralplus.com] has joined #scheme 16:12:48 -!- copumpkin [~pumpkin@unaffiliated/pumpkingod] has quit [Ping timeout: 252 seconds] 16:13:15 -!- mmc2 [~michal@82-148-210-75.fiber.unet.nl] has quit [Ping timeout: 248 seconds] 16:13:30 copumpkin [~pumpkin@209-6-232-56.c3-0.sbo-ubr1.sbo.ma.cable.rcn.com] has joined #scheme 16:13:30 -!- copumpkin [~pumpkin@209-6-232-56.c3-0.sbo-ubr1.sbo.ma.cable.rcn.com] has quit [Changing host] 16:13:30 copumpkin [~pumpkin@unaffiliated/pumpkingod] has joined #scheme 16:14:18 -!- pjb` [~t@81.202.16.46.dyn.user.ono.com] has quit [Remote host closed the connection] 16:14:49 pjb [~t@81.202.16.46.dyn.user.ono.com] has joined #scheme 16:19:37 -!- xwl [~user@114.241.245.172] has quit [Ping timeout: 252 seconds] 16:24:44 -!- Hal9k [~Lernaean@unaffiliated/kusanagi] has quit [Ping timeout: 252 seconds] 16:25:05 -!- femtoo [~femto@95-89-198-8-dynip.superkabel.de] has quit [Ping timeout: 255 seconds] 16:26:13 Hal9k [~Lernaean@24-107-60-232.dhcp.stls.mo.charter.com] has joined #scheme 16:26:13 -!- Hal9k [~Lernaean@24-107-60-232.dhcp.stls.mo.charter.com] has quit [Changing host] 16:26:13 Hal9k [~Lernaean@unaffiliated/kusanagi] has joined #scheme 16:32:17 ysph [~user@75-143-92-146.dhcp.aubn.al.charter.com] has joined #scheme 16:34:47 heeheehee [~sleepiest@hil-101-172.ResHall.Berkeley.EDU] has joined #scheme 16:37:25 -!- heeheehee [~sleepiest@hil-101-172.ResHall.Berkeley.EDU] has left #scheme 16:54:54 -!- dsmith [~dsmith@cpe-184-56-129-232.neo.res.rr.com] has quit [Quit: Leaving] 16:56:34 -!- dnolen [~davidnole@184.152.69.75] has quit [Quit: dnolen] 16:56:53 zmv [~daniel@c934a9f5.virtua.com.br] has joined #scheme 17:08:44 -!- gravicappa [~gravicapp@ppp91-77-219-134.pppoe.mtu-net.ru] has quit [Read error: Operation timed out] 17:11:26 gravicappa [~gravicapp@ppp91-77-219-134.pppoe.mtu-net.ru] has joined #scheme 17:29:01 fantazo [~fantazo@178-191-170-197.adsl.highway.telekom.at] has joined #scheme 17:38:44 femtoo [~femto@95-89-198-8-dynip.superkabel.de] has joined #scheme 17:46:39 ijp` [~user@host109-152-159-11.range109-152.btcentralplus.com] has joined #scheme 17:47:26 -!- ijp` [~user@host109-152-159-11.range109-152.btcentralplus.com] has quit [Client Quit] 17:48:43 -!- ijp [~user@host86-163-223-209.range86-163.btcentralplus.com] has quit [Ping timeout: 248 seconds] 17:53:10 -!- nilg [~user@77.70.2.229] has quit [Read error: Connection reset by peer] 17:58:14 -!- masm [~masm@bl16-168-147.dsl.telepac.pt] has quit [Ping timeout: 255 seconds] 18:00:29 -!- kauwgom [~reid@pool-173-53-249-101.chi01.dsl-w.verizon.net] has quit [Ping timeout: 255 seconds] 18:05:19 masm [~masm@bl16-168-147.dsl.telepac.pt] has joined #scheme 18:08:42 lbc [~quassel@1908ds1-aboes.0.fullrate.dk] has joined #scheme 18:11:45 rononovski_ [~rononovsk@bzq-79-177-185-192.red.bezeqint.net] has joined #scheme 18:12:34 -!- skeptical_p [~rononovsk@109.66.184.174] has quit [Ping timeout: 250 seconds] 18:36:09 -!- rageous [~Adium@user-38q461p.cable.mindspring.com] has quit [Quit: Leaving.] 18:37:28 nilg [~user@77.70.2.229] has joined #scheme 18:43:41 -!- masm [~masm@bl16-168-147.dsl.telepac.pt] has quit [Ping timeout: 255 seconds] 18:48:46 -!- Harrold [~quassel@bas1-ottawa11-1176120975.dsl.bell.ca] has quit [Ping timeout: 240 seconds] 18:52:39 christopher [~christoph@c-98-201-58-105.hsd1.tx.comcast.net] has joined #scheme 18:54:45 -!- ysph [~user@75-143-92-146.dhcp.aubn.al.charter.com] has quit [Read error: Operation timed out] 19:13:47 Absolutely nothing has been said in here all day?! Madness. 19:14:36 -!- pchrist [~spirit@gentoo/developer/pchrist] has quit [Quit: leaving] 19:15:25 pchrist [~spirit@gentoo/developer/pchrist] has joined #scheme 19:16:38 dnolen [~davidnole@184.152.69.75] has joined #scheme 19:17:12 scheme is dead 19:17:14 *taylanub* runs away 19:17:19 xD 19:21:15 Nietche is Dead -- God. 19:21:38 Heh 19:24:52 If that's so, you're all welcomed on #lisp. We promize not to try to make a new Common Lisp standard for at least ten years. 19:29:05 I'm not sure if that's a great selling-point for me. :-P 19:29:16 -!- copumpkin [~pumpkin@unaffiliated/pumpkingod] has quit [Ping timeout: 246 seconds] 19:29:44 Stability is great: you can start ambitious projects without spending all your time upgrading and changing languages. 19:30:10 copumpkin [~pumpkin@209-6-232-56.c3-0.sbo-ubr1.sbo.ma.cable.rcn.com] has joined #scheme 19:30:10 -!- copumpkin [~pumpkin@209-6-232-56.c3-0.sbo-ubr1.sbo.ma.cable.rcn.com] has quit [Changing host] 19:30:10 copumpkin [~pumpkin@unaffiliated/pumpkingod] has joined #scheme 19:30:51 Right, but I'd like to see some changes to Common Lisp _before_ I start my project in it. ;-) 19:32:47 fds, (remove-if-not #'like *common-lisp-std-lib*) 19:33:58 Could I make CL a Lisp-1 without just writing a Scheme in it? :-P 19:34:15 fds: there are macros do to that locally if needed. 19:34:34 There's also pseudo, a r4rs implementation in CL... 19:42:35 masm [~masm@bl16-168-147.dsl.telepac.pt] has joined #scheme 19:54:58 We should implement CL in Scheme, then implement Scheme with that CL. 19:55:26 For some value of `should'. :-P 20:00:44 and call the result CommonCriminal 20:02:03 why do some CLers dislike scheme's continuations? 20:02:21 Richard P Gabriel in "How to win Big" says: "continuations remain an ugly stain on the otherwise clean manuscript of Scheme" 20:02:42 I never understood that. 20:02:45 rien: It's not that we dislike them, it's that continuations are a low level mechanism that is at odd with CL defined primitives. 20:02:51 Well, they don't, really. What he meant to say was `first-class continuations', or `reusable continuations'. 20:02:51 something about unwind-protect that can't be implementend well that I don't remember. 20:03:08 Riastradh: yes, I mean first-class continuations too. 20:03:27 DT``: couldn't unwind-protect be implemented in terms of continuations? 20:03:40 pjb: how is it at odds exactly? 20:03:49 rien, I don't remember exactly. 20:03:49 They make programs harder to reason about. For example, they have the consequence that what might otherwise have been invisible mutation becomes visible mutation. Take a straightforward definition of MAP: 20:03:58 we've got dynamic-wind, so. 20:04:12 it shouldn't be a problem. 20:04:14 (define (map procedure list) (let ((pair (cons 0 '()))) (for-each (lambda (x) (set-cdr! pair (cons (procedure x) '()))) list) (cdr pair] 20:05:21 If continuations are not reifiable, then this definition is semantically indistinguishable from the usual recursive one: (define (map procedure list) (if (pair? list) (cons (procedure (car list)) (map procedure (cdr list))) '(] 20:06:11 and is there an advantage to having that equivalence? 20:06:13 But in Scheme, continuations are reifiable, so the two are semantically distinguishable. 20:06:33 Certainly. You must decide which one you want. If you make the `wrong' decision, then certain uses of MAP will break. 20:07:15 I put `wrong' in scare quotes here, because there is no wrong decision -- the R5RS doesn't say one way or another which one to use. But that means that some uses of MAP may work on some Scheme systems and fail on others. 20:07:22 but things only get hairy if one actually uses reified continuations with those maps, right? otherwise, they always work? 20:07:59 *...they always work in every scheme? 20:08:28 (Of course, that last sentence will always be the case, but most of the time the different behaviour will be caused by environmental issues such as the size of the heap, the load on the machine, &c., not semantic differences in the language) 20:09:41 The problem may manifest itself in obscure ways. For example, suppose you write a program in a nondeterministic style with AMB, using lots of lists and MAP and such. It works great on Scheme48. Then you run it on MIT Scheme and it suddenly starts giving you bogus answers. 20:10:29 and you are saying that it would always work in a language that doesn't offer a way to reify continuations, e.g. CL? 20:11:04 Well, sort of. The problems that I'm alluding to won't manifest themselves at all in Common Lisp -- but neither will AMB manifest itself, because you can't express it in Common Lisp! 20:11:10 Intensity [ABmPaJzNgn@unaffiliated/intensity] has joined #scheme 20:11:32 mmc2 [~michal@82-148-210-75.fiber.unet.nl] has joined #scheme 20:12:48 hmm because you need call/cc to write amb 20:13:40 but what I'm asking is, does that problem manifest itself because of the way the language is implemented? we could write reifiable continuations in CL like On Lisp does by converting everything to CPS and so on and then be able to write amb 20:13:47 would that problem then manifest itself? 20:13:55 rien: you can implement amb with CPS as well 20:14:14 C-Keen: right, because it gives you first-class continuations for free :) 20:14:26 hence my question above 20:14:27 that's not what I meant 20:14:31 oh? 20:14:37 That's a global transformation. If you want to use MAP in your AMB-world, you need to transform the definition of MAP too. In that case, you would need to choose what definition of MAP to use. 20:15:30 Riastradh: that is starting to sound to me like it's not that big of a problem like I thought it was from reading How to Win Big 20:17:46 rien: IIRC SICP shows an amb operator that uses explicitly passed continuations, no need for being able to reify a continuation from the scheme system 20:18:24 C-Keen, it requires a global transformation of the interpreter. 20:18:36 C-Keen: that means they're one-shot continuations, right? 20:18:43 Riastradh: ye 20:18:44 s 20:19:23 Riastradh: ah now I see what you meant by that above 20:20:13 is it that big of a problem that if CL had continuations programs would be less reliable? (existing programs, not new ones using amb and call/cc) 20:21:32 ijp [~user@host86-144-96-172.range86-144.btcentralplus.com] has joined #scheme 20:23:32 emporas_ [~emporas@athedsl-169451.home.otenet.gr] has joined #scheme 20:24:58 Riastradh: I appreciate the exposition. I'll save that text for the future when I know a bit more that I can revisit it and understand it better. :) 20:26:44 -!- emporas [~emporas@athedsl-171948.home.otenet.gr] has quit [Ping timeout: 255 seconds] 20:31:25 -!- dnolen [~davidnole@184.152.69.75] has quit [Read error: Connection reset by peer] 20:36:46 dnolen [~davidnole@184.152.69.75] has joined #scheme 20:36:46 -!- dnolen [~davidnole@184.152.69.75] has quit [Excess Flood] 20:37:17 dnolen [~davidnole@184.152.69.75] has joined #scheme 20:58:34 -!- kilimanjaro [~kilimanja@unaffiliated/kilimanjaro] has quit [Read error: Operation timed out] 20:59:39 -!- mmc2 [~michal@82-148-210-75.fiber.unet.nl] has quit [Ping timeout: 248 seconds] 20:59:57 -!- dnolen [~davidnole@184.152.69.75] has quit [Quit: dnolen] 21:04:08 femtooo [~femto@95-89-198-8-dynip.superkabel.de] has joined #scheme 21:07:14 -!- femtoo [~femto@95-89-198-8-dynip.superkabel.de] has quit [Ping timeout: 255 seconds] 21:08:03 -!- nilg [~user@77.70.2.229] has quit [Read error: Connection reset by peer] 21:14:04 -!- MichaelRaskin [~MichaelRa@195.91.224.225] has quit [Remote host closed the connection] 21:17:13 rien: cll has discussed the subject a lot. eg. http://groups.google.com/group/comp.lang.lisp/browse_frm/thread/efa810f1721b0cac/d5fdfb22c322c892?hl=en&q=continuation+unwind-protect+group:comp.lang.lisp#d5fdfb22c322c892 21:17:14 http://tinyurl.com/49cgqw9 21:17:15 dnolen [~davidnole@184.152.69.75] has joined #scheme 21:17:15 -!- dnolen [~davidnole@184.152.69.75] has quit [Excess Flood] 21:17:48 Most of the discussion surrounding UNWIND-PROTECT is hopelessly confused. 21:18:03 -!- fantazo [~fantazo@178-191-170-197.adsl.highway.telekom.at] has quit [Remote host closed the connection] 21:18:42 Perhaps. I'm not saying that cll is the reference. 21:18:50 See the 2009-03-28 entry about it at for a much less confused discussion. 21:19:35 dnolen [~davidnole@184.152.69.75] has joined #scheme 21:20:34 pjb: thanks for the link! 21:21:34 MichaelRaskin [~MichaelRa@195.91.224.225] has joined #scheme 21:24:43 -!- LN^^ is now known as LN^off 21:27:21 -!- lbc [~quassel@1908ds1-aboes.0.fullrate.dk] has quit [Remote host closed the connection] 21:28:03 lbc [~quassel@1908ds1-aboes.0.fullrate.dk] has joined #scheme 21:39:17 ccorn [~ccorn@j109182.upc-j.chello.nl] has joined #scheme 21:47:33 mmc2 [~michal@82-148-210-75.fiber.unet.nl] has joined #scheme 22:04:20 ijp` [~user@host86-147-169-81.range86-147.btcentralplus.com] has joined #scheme 22:04:20 -!- ijp` [~user@host86-147-169-81.range86-147.btcentralplus.com] has quit [Client Quit] 22:06:19 -!- ijp [~user@host86-144-96-172.range86-144.btcentralplus.com] has quit [Ping timeout: 248 seconds] 22:07:10 -!- femtooo [~femto@95-89-198-8-dynip.superkabel.de] has quit [Read error: Connection reset by peer] 22:19:19 -!- ccorn [~ccorn@j109182.upc-j.chello.nl] has quit [Quit: ccorn] 22:23:53 ysph [~user@adsl-89-38-168.mgm.bellsouth.net] has joined #scheme 22:26:10 ccorn [~ccorn@j109182.upc-j.chello.nl] has joined #scheme 22:33:46 -!- lechon [~l@unaffiliated/keram] has quit [Ping timeout: 240 seconds] 22:37:04 -!- ccorn [~ccorn@j109182.upc-j.chello.nl] has quit [Quit: ccorn] 22:39:21 lingrush [~klol@99-150-247-108.lightspeed.sndgca.sbcglobal.net] has joined #scheme 22:40:49 Hello! 22:42:24 I was wondering how length is defined, could anybody help me with that? 22:43:41 lingrush, you iterate over the list incrementing a counter. 22:44:53 Would I define a counter separately and then call it in the length function? 22:45:19 I would do: 22:46:01 (define (length xs) (let loop ((xs xs) (length 0)) (if (null? xs) length (loop (cdr xs) (+ length 1))))) 22:46:16 of course, pretty printed. 22:46:22 Yeah haha 22:52:28 -!- choas [~lars@p578F6A6B.dip.t-dialin.net] has quit [Quit: leaving] 22:54:32 DT``: thanks! 22:55:30 -!- zmv [~daniel@c934a9f5.virtua.com.br] has quit [Ping timeout: 250 seconds] 22:55:38 I actually have to use only a limited set of predefined terms define lambda cond else empty empty? first rest cons list 22:55:38 list? = equal? and or not + - * / < <= > >= 22:55:39 so I'm trying to understand the logic 22:56:24 -!- LN^off is now known as LN^^ 22:56:52 lingrush: have you learned about recursion? 22:57:26 -!- DT`` [~Feeock@net-93-149-39-135.cust.dsl.teletu.it] has quit [Ping timeout: 240 seconds] 22:57:35 ijp [~user@host86-147-169-81.range86-147.btcentralplus.com] has joined #scheme 22:57:39 rien: yeah, I believe so 22:58:36 DT`` [~Feeock@net-93-149-39-135.cust.dsl.teletu.it] has joined #scheme 22:58:57 Then just recurse down the list and increment a counter for each element until you reach the end. Then the counter is the number of elements in the list, or, as it is sometimes known, the `length'. :-P 22:59:05 lingrush: it's very simple to write a recursive length function 22:59:45 I wouldn't increment a counter. I'd define a helper function that takes two parameters 23:01:06 Right, but one of those arguments would be a coutner. 23:01:12 Ooh, I see 23:01:33 yes 23:01:55 but there's no mutation (not that I'm an immutability freak...) 23:02:24 what about the counter? 23:02:40 it doesn't really get mutated, just replaced. 23:02:47 oh 23:02:48 hm 23:03:09 and this is how you do loops in Scheme. 23:03:10 minsa [~minsa@c-24-5-121-157.hsd1.ca.comcast.net] has joined #scheme 23:04:11 Well, I was actually thinking of the naive recursive definition, where you just increment the return value of the next recursion. But, without giving away anyone's homework solutions, there are many ways to implement it. :-P 23:04:21 The named let is the best though. :-) 23:04:22 hahaha 23:04:26 (I think.) 23:04:41 fds, it can be shorter with a do loop. 23:04:42 fds: that's what I'm thinking. 23:04:45 (I love do loops) 23:05:01 -!- emporas_ [~emporas@athedsl-169451.home.otenet.gr] has quit [Ping timeout: 260 seconds] 23:05:09 (define (length xs) (do ((xs xs (cdr xs)) (i 0 (+ i 1))) ((null? xs) i))) 23:05:40 Shorter isn't always better, but do is cool too. 23:06:04 do basically expands to the named let. 23:06:49 emporas_ [~emporas@athedsl-166449.home.otenet.gr] has joined #scheme 23:07:14 I see. I love named lets. :-P 23:10:30 (define (length2 xs c) (cond ((equal? xs '()) c) (else (length2 (cdr xs) (+ 1 c))))) 23:10:43 -!- tauntaun [~icarus@64.134.66.112] has quit [Quit: Ex-Chat] 23:11:11 I miss "case" or pattern matching 23:12:39 Erm, Scheme has `case' 23:13:39 there we go: 23:13:39 (define (length3 xs c) (case xs ((()) c) (else (length3 (cdr xs) (+ 1 c))))) 23:14:05 ((()) makes my eyes cry, and I'm one of the paren-lovers. 23:14:37 yeah it does look pretty weird 23:14:55 just do (Define empty '()) before and then you can use ((empty) c) :) 23:15:13 it would match with 'empty, then. 23:15:52 rudybot, (define empty '()) 23:15:52 DT``: Done. 23:16:16 rudybot, (case empty ((()) 1) (else 2)) 23:16:16 DT``: ; Value: 1 23:16:20 hmm you're right 23:16:28 I did it here in the repl 23:16:29 rudybot, (case empty ((empty) 1) (else 2)) 23:16:29 DT``: ; Value: 2 23:17:12 case would be useful if it did also match agains functions (e.g. list?, string?, etc.) and variables. 23:17:13 so no way to use empty with case? 23:17:22 yea. 23:17:57 I usually extend it, if the clause is an identifier, it treats it as a variable or function. 23:18:00 case should take the args quasiquoted 23:18:06 so that I'd pass '() instead of () 23:18:10 that too. 23:18:32 hmm not too useful in its current form then :) 23:18:53 it's useful when doing some trivial parsing. 23:19:06 to match with characters. 23:19:18 or some fixed message map (made of symbols) 23:19:29 s/fixed/fixed-length/ 23:19:50 speaking of parsing, I really need to write/find a parser combinator library 23:19:56 to really grok it 23:20:13 I tried learning it when I was learning haskell but it was a bit confusing there :) 23:21:11 I found it on reddit some days ago. 23:21:19 let me check. 23:21:38 cool 23:23:22 I think it'd be fun to rewrite that "write a scheme in 48 hours tutorial" into scheme 23:24:51 mh, I can't find it. 23:26:01 DT``: http://shaurz.wordpress.com/2008/03/11/haskell-style-parser-combinators-in-scheme/ 23:26:01 http://tinyurl.com/ysphwg 23:26:55 rien, http://shaurz.wordpress.com/2008/03/11/haskell-style-parser-combinators-in-scheme/ 23:26:56 http://tinyurl.com/ysphwg 23:26:56 oh. 23:27:00 is that it? 23:27:00 nevermind. 23:27:09 it should be that. 23:27:36 Okay, so I am terrible with scheme, apparently 23:27:50 http://pastebin.com/BzLhu4ZY 23:28:19 it's not '0 23:28:21 it's '() 23:28:27 that's ' ( ) 23:28:42 rudybot, '((((((((((((((())))))))))))))) 23:28:42 DT``: ; Value: ((((((((((((((())))))))))))))) 23:28:47 wow. 23:28:52 I'm good at matching parens. 23:28:57 I thought I would just return the number zero 23:29:16 You don't ned to quote numbers 23:29:21 oh, alright 23:29:21 s/ned/need/ 23:29:25 Just write 0 23:29:31 lingrush: what does (= S 1) do? 23:29:48 if it's the first element in the list, it makes s = 1? 23:30:01 (= is not an assignment function 23:30:11 crap 23:30:20 So it's just (S 1)? 23:30:24 plus (first L) returns the first element of the list L 23:30:29 assignment is bad. 23:30:31 lechon [~l@Macaw.cens.UCLA.EDU] has joined #scheme 23:30:31 -!- lechon [~l@Macaw.cens.UCLA.EDU] has quit [Changing host] 23:30:31 lechon [~l@unaffiliated/keram] has joined #scheme 23:30:33 rudybot: (let ([S 10]) (= S 1)) 23:30:33 offby1: your racket sandbox is ready 23:30:33 offby1: ; Value: #f 23:30:37 rudybot: (let ([S 1]) (= S 1)) 23:30:37 offby1: ; Value: #t 23:30:37 lingrush: it is that inside a let but that's no what you want 23:30:43 lingrush: now do you know what it does? 23:31:20 offby1: yeah T_T 23:31:40 lingrush: do you also understand that you do not want to use first and rest? 23:32:08 rien: Yes, but what are the alternatives/ 23:32:14 lingrush: what does (help-length 0 '()) do? 23:32:21 lingrush: why don't you tell me in your words what you want to be asking in each case 23:32:28 lingrush: then I'll tell you what function to use :) 23:32:37 haha okay 23:32:39 ijp: it's calling a helper function that recurses 23:32:52 yes, but what would the result be? 23:33:06 actually, it doesn't recurse 23:33:36 ijp: not yet, we're fixing it :) 23:34:40 rien: So i made help-length to allow for a second parameter, and it would iterate through each element in the list, then increment the counter (which is S in this case) 23:35:25 lingrush: ok. but because it recurses, it has to return values, not set them 23:35:36 otherwise it won't know when to top recursing 23:35:41 ah, okay 23:36:03 so tell me what questions the cond has to ask 23:36:10 just the questions ,not the answers 23:36:19 there's only one important question really 23:37:10 well originally I thought I was supposed to as 'is it the first element" and then "is it the rest of the elements" 23:37:13 hm 23:37:20 I think you're thinking backwards about recursion. the way you defined your helper tells me you think you can tell it what to do with the first element and what to do with the "rest" of the elements, right? 23:37:34 Haha yes >_> 23:37:35 oh we're inthe same page :) 23:37:40 -!- dnolen [~davidnole@184.152.69.75] has quit [Quit: dnolen] 23:37:41 -!- emporas_ [~emporas@athedsl-166449.home.otenet.gr] has quit [Ping timeout: 260 seconds] 23:37:47 emporas_ [~emporas@athedsl-171982.home.otenet.gr] has joined #scheme 23:37:53 lingrush: you should read up on recursion again. it works sort of backwards from what you think 23:37:58 okay 23:38:10 lingrush: you have to define a base case that tells it when to stop recursing 23:38:46 so you would have a function that traverses a list by recursion and the cond would check when to stop. that is the base case. 23:38:52 -!- rononovski_ [~rononovsk@bzq-79-177-185-192.red.bezeqint.net] has quit [Ping timeout: 250 seconds] 23:39:03 oh, wel 23:39:04 l 23:39:20 lingrush: but most importantly, stop thinking in terms of assignment :) there's no assignment at all for that function 23:39:55 So how do I address the counter? 23:41:55 lingrush: the counter will be "updated" because each call will have the last value + 1 23:42:29 -!- mmc2 [~michal@82-148-210-75.fiber.unet.nl] has quit [Ping timeout: 255 seconds] 23:43:50 lingrush: try to understand how this works: 23:43:57 rudybot: (define (count-helper x) (cond ((equal? x 10) 10) (else (count-helper (+ x 1))))) 23:43:57 rien: your r5rs sandbox is ready 23:43:57 rien: Done. 23:44:03 rudybot: (count-helper 1) 23:44:03 rien: ; Value: 10 23:44:05 rudybot: (count-helper 2) 23:44:05 rien: ; Value: 10 23:44:32 rudybot: (define (count-helper x) (cond ((equal? x 10) 10) (else (count-helper (+ x 23:44:32 1))))) 23:44:32 pjb: (The best example of this (which I see very frequently) is ending up with an `equal?' test for some function result that needs set equality.) 23:44:32 (don't pass any number larger than 10 to it ;) ) 23:45:22 rudybot: (define (iota min max) (if (= min max) (list min) (cons min (iota (+ 1 min) max)))) 23:45:23 pjb: your sandbox is ready 23:45:23 pjb: Done. 23:45:38 rudybot: (define (count-helper x) (cond ((equal? x 10) 10) (else (count-helper (+ x 1))))) 23:45:38 pjb: Done. 23:45:40 lingrush: gotta go now. good luck! 23:45:47 Thanks rien! 23:45:48 rudybot: (map count-helper (iota 20)) 23:45:48 pjb: error: procedure iota: expects 2 arguments, given 1: 20 23:45:53 rudybot: (map count-helper (iota 1 20)) 23:46:04 pjb: can't be larger than 10 23:46:04 pjb: error: with-limit: out of time 23:46:21 do iota 1 9 :) 23:46:22 rien: it can, if what you want is an infinite loop. 23:46:29 :P 23:46:43 What about: 23:46:48 But how can I set my base case as the end of the list? 23:46:52 rudybot: (define (count-helper x) (cond ((>= x 10) 10) (else (count-helper (+ x 1))))) 23:46:52 pjb: Done. 23:46:55 rudybot: (map count-helper (iota 1 20)) 23:46:56 pjb: ; Value: (10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10) 23:47:04 lingrush: Well, what is the end of the list? 23:47:19 ijp: when there are no more elements? 23:47:25 or just (define (count-helper x) 10). 23:47:26 -!- gravicappa [~gravicapp@ppp91-77-219-134.pppoe.mtu-net.ru] has quit [Remote host closed the connection] 23:47:34 or would that be "empty?" ;) 23:47:43 oooooh 23:47:59 lingrush: you're asking the right questions now :) 23:48:04 hehe 23:48:10 '() means "empty list" 23:48:57 gravicappa [~gravicapp@ppp91-77-219-134.pppoe.mtu-net.ru] has joined #scheme 23:49:55 -!- gravicappa [~gravicapp@ppp91-77-219-134.pppoe.mtu-net.ru] has quit [Remote host closed the connection] 23:50:42 jonrafkind [~jon@jonr5.dsl.xmission.com] has joined #scheme 23:52:10 rononovski_ [~rononovsk@109.67.184.139] has joined #scheme 23:53:30 -!- emporas_ [~emporas@athedsl-171982.home.otenet.gr] has quit [Ping timeout: 252 seconds] 23:55:20 If I should not use first and rest, what are my alternatives? 23:56:49 lingrush: Do you understand what COND does? 23:58:06 It checks if the first statement in the argument is true, then returns it if it is true? 23:59:23 And when will FIRST and REST return #t?