2015-01-20T00:01:21Z alexander-01 joined #scheme 2015-01-20T00:02:42Z turtleman_ joined #scheme 2015-01-20T00:03:03Z alexander-01: can anyone point me to documentation on opening and writing to a binary file .. thanks 2015-01-20T00:03:33Z pjdelport quit (Quit: Connection closed for inactivity) 2015-01-20T00:06:32Z zachstone joined #scheme 2015-01-20T00:14:12Z xyh quit (Remote host closed the connection) 2015-01-20T00:14:27Z pera quit (Quit: leaving) 2015-01-20T00:15:41Z zachstone quit (Ping timeout: 244 seconds) 2015-01-20T00:17:25Z racycle joined #scheme 2015-01-20T00:21:17Z uris77 quit (Quit: leaving) 2015-01-20T00:26:31Z pjb: alexander-01: there's nothing in the r5rs standard. http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-9.html#%_sec_6.6 You will have to look at your implementation documentation, or perhaps in the r7rs standard. 2015-01-20T00:26:31Z rudybot: http://tinyurl.com/3f2se39 2015-01-20T00:26:39Z pjb: lrs: I will. Good night. 2015-01-20T00:28:46Z alexander-01: pjb: thanks 2015-01-20T00:32:15Z kongtomorrow: pjb: I did the other person's problem just 'cause I kind of felt like it. Any particular comments? https://gist.github.com/kongtomorrow/5cf71dd76151293eb976 2015-01-20T00:35:43Z pjb: kongtomorrow: it's ok. I would still advise to replace car/cadr by giving them names, eg. (define rule-antecendent car) (define rule-result-type cadr). 2015-01-20T00:38:03Z kongtomorrow: pjb: 👍 2015-01-20T00:45:23Z echo-area quit (Remote host closed the connection) 2015-01-20T00:45:33Z masm quit (Ping timeout: 265 seconds) 2015-01-20T00:54:20Z araujo quit (Read error: Connection reset by peer) 2015-01-20T00:54:49Z araujo joined #scheme 2015-01-20T00:55:11Z kongtomorrow quit 2015-01-20T00:55:51Z enitiz quit (Ping timeout: 264 seconds) 2015-01-20T00:58:24Z kongtomorrow joined #scheme 2015-01-20T01:00:29Z daviid quit (Ping timeout: 264 seconds) 2015-01-20T01:03:19Z robot-beethoven joined #scheme 2015-01-20T01:03:52Z mutley89 joined #scheme 2015-01-20T01:19:15Z theseb joined #scheme 2015-01-20T01:23:46Z Bahman quit (Quit: zzZZ) 2015-01-20T01:26:09Z hiroakip quit (Ping timeout: 265 seconds) 2015-01-20T01:31:30Z senoj joined #scheme 2015-01-20T01:38:50Z kongtomorrow quit 2015-01-20T01:50:08Z iKlsR quit (Quit: Respawning..) 2015-01-20T01:52:19Z theseb quit (Remote host closed the connection) 2015-01-20T01:53:21Z alexander-01 quit (Remote host closed the connection) 2015-01-20T01:56:23Z vdamewood joined #scheme 2015-01-20T02:00:27Z fsckd quit (Ping timeout: 276 seconds) 2015-01-20T02:03:18Z zachstone joined #scheme 2015-01-20T02:03:18Z mdln quit (Remote host closed the connection) 2015-01-20T02:06:13Z fsckd joined #scheme 2015-01-20T02:07:11Z echo-area joined #scheme 2015-01-20T02:11:28Z senoj quit (Quit: /quit) 2015-01-20T02:15:46Z tm_ quit (Quit: Leaving) 2015-01-20T02:17:49Z Rptx joined #scheme 2015-01-20T02:20:00Z Vutral quit (Ping timeout: 244 seconds) 2015-01-20T02:20:39Z tobik quit (Ping timeout: 245 seconds) 2015-01-20T02:22:50Z excelsior joined #scheme 2015-01-20T02:22:51Z tobik joined #scheme 2015-01-20T02:23:04Z enitiz joined #scheme 2015-01-20T02:26:39Z turbofail quit (Read error: Connection reset by peer) 2015-01-20T02:27:21Z turbofail joined #scheme 2015-01-20T02:29:34Z hiyosi quit (Quit: My Mac has gone to sleep. ZZZzzz…) 2015-01-20T02:29:43Z mdln joined #scheme 2015-01-20T02:35:00Z Vutral joined #scheme 2015-01-20T02:45:04Z frkout_ joined #scheme 2015-01-20T02:48:06Z frkout quit (Ping timeout: 244 seconds) 2015-01-20T02:51:38Z kongtomorrow joined #scheme 2015-01-20T03:07:20Z fsckd quit (Ping timeout: 246 seconds) 2015-01-20T03:17:02Z kongtomorrow quit 2015-01-20T03:17:50Z DrDuck quit (Ping timeout: 246 seconds) 2015-01-20T03:20:53Z zachstone quit (Ping timeout: 264 seconds) 2015-01-20T03:30:57Z DrDuck joined #scheme 2015-01-20T03:31:53Z Rptx quit (Remote host closed the connection) 2015-01-20T03:32:33Z frkout_ quit (Remote host closed the connection) 2015-01-20T03:33:01Z frkout joined #scheme 2015-01-20T03:42:18Z Rptx joined #scheme 2015-01-20T03:43:35Z zachstone joined #scheme 2015-01-20T03:43:37Z vdamewood quit (Quit: ["Textual IRC Client: www.textualapp.com"]) 2015-01-20T03:51:22Z davexunit quit (Quit: Later) 2015-01-20T04:02:29Z turtleman_ quit (Ping timeout: 256 seconds) 2015-01-20T04:14:22Z zachstone quit (Ping timeout: 255 seconds) 2015-01-20T04:22:10Z kongtomorrow joined #scheme 2015-01-20T04:24:45Z alexei___ joined #scheme 2015-01-20T04:28:41Z Rptx quit (Remote host closed the connection) 2015-01-20T04:29:01Z alexei_ quit (Ping timeout: 272 seconds) 2015-01-20T04:29:09Z Rptx joined #scheme 2015-01-20T04:33:45Z Rptx quit (Remote host closed the connection) 2015-01-20T04:34:15Z Rptx joined #scheme 2015-01-20T04:37:32Z Rptx quit (Remote host closed the connection) 2015-01-20T04:38:00Z Rptx joined #scheme 2015-01-20T04:41:20Z theseb joined #scheme 2015-01-20T04:45:39Z MichaelRaskin quit (Quit: MichaelRaskin) 2015-01-20T04:54:10Z enitiz quit (Ping timeout: 244 seconds) 2015-01-20T05:16:15Z Rptx quit (Remote host closed the connection) 2015-01-20T05:16:46Z Rptx joined #scheme 2015-01-20T05:19:43Z arrdem quit (Quit: leaving) 2015-01-20T05:20:55Z Rptx quit (Remote host closed the connection) 2015-01-20T05:30:20Z slucx joined #scheme 2015-01-20T05:34:51Z Shadox quit (Quit: Leaving) 2015-01-20T05:35:51Z vdamewood joined #scheme 2015-01-20T05:44:01Z zachstone joined #scheme 2015-01-20T05:47:47Z theseb quit (Quit: Leaving) 2015-01-20T05:54:05Z pjdelport joined #scheme 2015-01-20T05:57:03Z booly-yam-5194_ quit (Ping timeout: 264 seconds) 2015-01-20T05:58:52Z frkout_ joined #scheme 2015-01-20T06:00:55Z booly-yam-5194_ joined #scheme 2015-01-20T06:01:16Z oleo__ quit (Quit: Verlassend) 2015-01-20T06:02:54Z frkout quit (Ping timeout: 276 seconds) 2015-01-20T06:09:14Z badkins quit (Remote host closed the connection) 2015-01-20T06:16:22Z racycle quit (Quit: ZZZzzz…) 2015-01-20T06:17:45Z slucx quit (Read error: Connection reset by peer) 2015-01-20T06:30:45Z vanila joined #scheme 2015-01-20T06:45:44Z primafacie joined #scheme 2015-01-20T06:55:18Z hiroakip joined #scheme 2015-01-20T07:05:41Z girrig quit (Ping timeout: 246 seconds) 2015-01-20T07:06:49Z girrig joined #scheme 2015-01-20T07:13:03Z hiroakip quit (Ping timeout: 272 seconds) 2015-01-20T07:13:12Z frkout_ quit (Remote host closed the connection) 2015-01-20T07:13:39Z frkout joined #scheme 2015-01-20T07:14:11Z Isp-sec joined #scheme 2015-01-20T07:15:03Z zachstone quit (Ping timeout: 264 seconds) 2015-01-20T07:23:22Z booly-yam-5194_ quit (Ping timeout: 240 seconds) 2015-01-20T07:25:21Z alexei___ quit (Ping timeout: 256 seconds) 2015-01-20T07:27:08Z adu quit (Quit: adu) 2015-01-20T07:28:37Z Vutral quit (Ping timeout: 245 seconds) 2015-01-20T07:44:56Z mumptai joined #scheme 2015-01-20T07:54:29Z kazimir42 joined #scheme 2015-01-20T07:54:50Z Vutral joined #scheme 2015-01-20T07:57:41Z badkins joined #scheme 2015-01-20T08:02:51Z badkins quit (Ping timeout: 252 seconds) 2015-01-20T08:04:18Z srenatus joined #scheme 2015-01-20T08:06:05Z wingo joined #scheme 2015-01-20T08:11:56Z fikusz quit (Quit: Leaving) 2015-01-20T08:14:11Z fikusz joined #scheme 2015-01-20T08:22:59Z booly-yam-5194_ joined #scheme 2015-01-20T08:31:28Z zacts: hi 2015-01-20T08:31:31Z zacts: I <3 scheme 2015-01-20T08:32:34Z benregn joined #scheme 2015-01-20T08:34:21Z wingo quit (Ping timeout: 276 seconds) 2015-01-20T08:36:46Z masm joined #scheme 2015-01-20T08:37:47Z psy_ quit (Ping timeout: 245 seconds) 2015-01-20T08:45:13Z civodul joined #scheme 2015-01-20T08:49:29Z msgodf joined #scheme 2015-01-20T08:50:47Z wingo joined #scheme 2015-01-20T08:51:42Z mumptai quit (Remote host closed the connection) 2015-01-20T08:52:16Z rtra quit (Ping timeout: 265 seconds) 2015-01-20T08:57:00Z rtra joined #scheme 2015-01-20T09:13:06Z redeemed joined #scheme 2015-01-20T09:13:18Z mihai_ joined #scheme 2015-01-20T09:13:22Z mihai_ quit (Remote host closed the connection) 2015-01-20T09:14:45Z taraz`` joined #scheme 2015-01-20T09:28:53Z Vutral quit (Ping timeout: 240 seconds) 2015-01-20T09:35:54Z Vutral joined #scheme 2015-01-20T09:36:21Z civodul quit (Quit: ERC Version 5.3 (IRC client for Emacs)) 2015-01-20T09:42:12Z aretecode quit (Read error: Connection reset by peer) 2015-01-20T09:53:59Z Isp-sec quit (Ping timeout: 245 seconds) 2015-01-20T09:54:59Z aretecode joined #scheme 2015-01-20T10:03:07Z agumonkey quit (Ping timeout: 255 seconds) 2015-01-20T10:03:39Z agumonkey joined #scheme 2015-01-20T10:27:56Z psy_ joined #scheme 2015-01-20T10:27:57Z boycottg00gle joined #scheme 2015-01-20T10:28:35Z psy_ quit (Max SendQ exceeded) 2015-01-20T10:28:56Z psy_ joined #scheme 2015-01-20T10:40:17Z stepnem quit (Ping timeout: 245 seconds) 2015-01-20T10:46:02Z stepnem joined #scheme 2015-01-20T10:49:40Z zadock joined #scheme 2015-01-20T10:55:23Z lrs quit (Ping timeout: 245 seconds) 2015-01-20T11:02:46Z booly-yam-5194_ quit (Ping timeout: 265 seconds) 2015-01-20T11:03:32Z boycottg00gle quit (Remote host closed the connection) 2015-01-20T11:07:10Z gravicappa joined #scheme 2015-01-20T11:09:17Z hellofunk: zacts: yeah, you do! 2015-01-20T11:16:48Z echo-area quit (Remote host closed the connection) 2015-01-20T11:18:47Z taraz`` quit (Ping timeout: 272 seconds) 2015-01-20T11:19:14Z jeapostrophe joined #scheme 2015-01-20T11:22:07Z hellofun` joined #scheme 2015-01-20T11:24:29Z hellofunk quit (Ping timeout: 264 seconds) 2015-01-20T11:28:00Z taraz`` joined #scheme 2015-01-20T11:30:47Z b4283 joined #scheme 2015-01-20T11:38:24Z booly-yam-5194_ joined #scheme 2015-01-20T11:41:37Z zwer_e joined #scheme 2015-01-20T11:44:03Z zwer quit (Ping timeout: 250 seconds) 2015-01-20T11:51:59Z zadock quit (Quit: Leaving) 2015-01-20T11:59:27Z jeapostrophe quit (Ping timeout: 264 seconds) 2015-01-20T12:03:53Z zadock joined #scheme 2015-01-20T12:05:15Z robot-beethoven quit (Quit: ERC Version 5.3 (IRC client for Emacs)) 2015-01-20T12:06:03Z Vutral quit (Ping timeout: 264 seconds) 2015-01-20T12:08:00Z vdamewood quit (Quit: Computer has gone to sleep.) 2015-01-20T12:08:04Z pnkfelix joined #scheme 2015-01-20T12:10:48Z Kruppe quit (Ping timeout: 245 seconds) 2015-01-20T12:19:07Z kongtomorrow quit 2015-01-20T12:19:07Z Kruppe joined #scheme 2015-01-20T12:32:18Z hellofun` is now known as hellofunk 2015-01-20T12:40:05Z vanila quit (Quit: Leaving) 2015-01-20T12:57:56Z cocosp joined #scheme 2015-01-20T12:58:08Z cocosp quit (Client Quit) 2015-01-20T13:00:42Z ohama quit (Ping timeout: 265 seconds) 2015-01-20T13:02:42Z Rptx joined #scheme 2015-01-20T13:16:50Z enitiz joined #scheme 2015-01-20T13:17:39Z fsckd joined #scheme 2015-01-20T13:18:11Z ski quit (Ping timeout: 252 seconds) 2015-01-20T13:22:40Z pera joined #scheme 2015-01-20T13:24:29Z narendraj9 joined #scheme 2015-01-20T13:25:27Z zadock quit (Ping timeout: 250 seconds) 2015-01-20T13:26:53Z alezost joined #scheme 2015-01-20T13:34:00Z _5kg quit (Ping timeout: 276 seconds) 2015-01-20T13:39:18Z jeapostrophe joined #scheme 2015-01-20T13:39:18Z jeapostrophe quit (Changing host) 2015-01-20T13:39:18Z jeapostrophe joined #scheme 2015-01-20T13:42:26Z zadock joined #scheme 2015-01-20T13:45:47Z taylanub quit (Disconnected by services) 2015-01-20T13:46:19Z taylanub joined #scheme 2015-01-20T13:52:00Z hiyosi joined #scheme 2015-01-20T13:53:12Z bjz joined #scheme 2015-01-20T13:58:09Z enitiz quit (Ping timeout: 252 seconds) 2015-01-20T13:59:20Z turtleman_ joined #scheme 2015-01-20T14:01:39Z ohama joined #scheme 2015-01-20T14:02:07Z civodul joined #scheme 2015-01-20T14:03:30Z uris77 joined #scheme 2015-01-20T14:08:23Z psy_ quit (Quit: Leaving) 2015-01-20T14:09:04Z taraz`` quit (Ping timeout: 244 seconds) 2015-01-20T14:10:44Z taraz`` joined #scheme 2015-01-20T14:13:44Z davexunit joined #scheme 2015-01-20T14:13:45Z davexunit quit (Changing host) 2015-01-20T14:13:46Z davexunit joined #scheme 2015-01-20T14:17:17Z _5kg joined #scheme 2015-01-20T14:18:24Z hellofunk quit (Remote host closed the connection) 2015-01-20T14:20:01Z davexuni` joined #scheme 2015-01-20T14:20:10Z hellofunk joined #scheme 2015-01-20T14:22:11Z davexunit quit (Disconnected by services) 2015-01-20T14:22:35Z davexuni` is now known as davexunit 2015-01-20T14:23:04Z davexunit quit (Changing host) 2015-01-20T14:23:04Z davexunit joined #scheme 2015-01-20T14:25:18Z oleo joined #scheme 2015-01-20T14:26:34Z narendraj9 quit (Quit: WeeChat 1.1) 2015-01-20T14:31:02Z davexunit quit (Remote host closed the connection) 2015-01-20T14:32:56Z Rptx` joined #scheme 2015-01-20T14:37:16Z adu joined #scheme 2015-01-20T14:39:34Z davexunit joined #scheme 2015-01-20T14:43:13Z Rptx quit (Quit: gone!) 2015-01-20T14:43:32Z Rptx` left #scheme 2015-01-20T14:43:49Z racycle joined #scheme 2015-01-20T14:49:58Z C-Keen quit (Quit: brb) 2015-01-20T14:51:08Z C-Keen joined #scheme 2015-01-20T14:53:08Z narendraj9 joined #scheme 2015-01-20T14:57:46Z narendraj9 quit (Client Quit) 2015-01-20T15:04:03Z gravicappa quit (Remote host closed the connection) 2015-01-20T15:04:12Z Vutral joined #scheme 2015-01-20T15:06:01Z enitiz joined #scheme 2015-01-20T15:13:33Z Rptx joined #scheme 2015-01-20T15:21:25Z racycle quit (Quit: ZZZzzz…) 2015-01-20T15:22:08Z badkins joined #scheme 2015-01-20T15:29:53Z snits quit (Ping timeout: 264 seconds) 2015-01-20T15:30:03Z psy_ joined #scheme 2015-01-20T15:34:55Z benregn quit (Quit: My Mac has gone to sleep. ZZZzzz…) 2015-01-20T15:36:33Z booly-yam-5194_ quit (Ping timeout: 272 seconds) 2015-01-20T15:37:49Z Vutral quit (Ping timeout: 272 seconds) 2015-01-20T15:38:07Z learningmore joined #scheme 2015-01-20T15:38:55Z learningmore: what should one go over first 2015-01-20T15:38:59Z learningmore: SICP or HTDP? 2015-01-20T15:41:10Z z0d: they serve different purposes, but HTDP is easier 2015-01-20T15:42:21Z pjb: To learn how to program, sicp. To learn scheme, htdp. 2015-01-20T15:42:40Z booly-yam-5194_ joined #scheme 2015-01-20T15:42:50Z z0d: SICP is more about computer science IMO 2015-01-20T15:43:43Z learningmore: trying to use MIT-GNU Scheme along with SICP, but the Emacs commands are bugging me a bit 2015-01-20T15:43:56Z learningmore: is there a better REPL I could be using? 2015-01-20T15:45:15Z pjb: Did you use M-x run-scheme RET ? 2015-01-20T15:46:49Z learningmore: no 2015-01-20T15:48:56Z wasamasa: you should 2015-01-20T15:57:28Z adu quit (Quit: adu) 2015-01-20T15:58:07Z Vutral joined #scheme 2015-01-20T15:58:54Z zadock quit (Quit: Leaving) 2015-01-20T15:59:38Z booly-yam-5194_ quit (Ping timeout: 244 seconds) 2015-01-20T15:59:56Z jbkcc joined #scheme 2015-01-20T16:01:22Z xyh joined #scheme 2015-01-20T16:12:17Z Riastradh quit (Ping timeout: 250 seconds) 2015-01-20T16:16:27Z wingo quit (Ping timeout: 272 seconds) 2015-01-20T16:23:22Z daviid joined #scheme 2015-01-20T16:23:29Z theseb joined #scheme 2015-01-20T16:24:23Z suppi joined #scheme 2015-01-20T16:24:23Z suppi quit (Changing host) 2015-01-20T16:24:23Z suppi joined #scheme 2015-01-20T16:24:27Z msgodf quit (Ping timeout: 252 seconds) 2015-01-20T16:30:59Z wingo joined #scheme 2015-01-20T16:31:53Z wingo quit (Client Quit) 2015-01-20T16:37:11Z Bahman joined #scheme 2015-01-20T16:40:53Z kazimir42 quit (Ping timeout: 250 seconds) 2015-01-20T16:46:55Z gravicappa joined #scheme 2015-01-20T16:48:52Z ventonegro quit (Read error: Connection reset by peer) 2015-01-20T16:50:01Z lrs joined #scheme 2015-01-20T16:50:07Z ventonegro joined #scheme 2015-01-20T16:50:14Z redeemed quit (Quit: q) 2015-01-20T16:51:29Z jbkcc quit (Quit: My Mac has gone to sleep. ZZZzzz…) 2015-01-20T16:52:48Z b4283 quit (Quit: Konversation terminated!) 2015-01-20T16:58:27Z Riastradh joined #scheme 2015-01-20T16:59:03Z jeapostrophe quit (Ping timeout: 244 seconds) 2015-01-20T17:00:41Z booly-yam-5194_ joined #scheme 2015-01-20T17:03:59Z jbkcc joined #scheme 2015-01-20T17:05:53Z jeapostrophe joined #scheme 2015-01-20T17:05:54Z psy_ quit (Quit: Leaving) 2015-01-20T17:06:11Z Vutral quit (Ping timeout: 256 seconds) 2015-01-20T17:08:23Z jgrant quit (Remote host closed the connection) 2015-01-20T17:08:46Z jgrant joined #scheme 2015-01-20T17:09:21Z Vutral joined #scheme 2015-01-20T17:21:23Z jeapostrophe quit (Ping timeout: 240 seconds) 2015-01-20T17:21:37Z theseb quit (Remote host closed the connection) 2015-01-20T17:22:28Z learningmore quit (Quit: Page closed) 2015-01-20T17:22:53Z theseb joined #scheme 2015-01-20T17:27:56Z alexei___ joined #scheme 2015-01-20T17:28:24Z mumptai joined #scheme 2015-01-20T17:31:22Z civodul quit (Quit: ERC Version 5.3 (IRC client for Emacs)) 2015-01-20T17:33:53Z alexei___ quit (Ping timeout: 240 seconds) 2015-01-20T17:36:28Z jeapostrophe joined #scheme 2015-01-20T17:36:28Z jeapostrophe quit (Changing host) 2015-01-20T17:36:28Z jeapostrophe joined #scheme 2015-01-20T17:38:21Z sheilong joined #scheme 2015-01-20T17:39:00Z alexei___ joined #scheme 2015-01-20T17:58:25Z kazimir42 joined #scheme 2015-01-20T18:00:56Z jlongster joined #scheme 2015-01-20T18:01:09Z fgudin quit (Ping timeout: 276 seconds) 2015-01-20T18:01:49Z mlaine quit (Ping timeout: 265 seconds) 2015-01-20T18:02:17Z fgudin joined #scheme 2015-01-20T18:03:11Z mlaine joined #scheme 2015-01-20T18:07:12Z msgodf joined #scheme 2015-01-20T18:07:51Z booly-yam-5194_ quit (Ping timeout: 252 seconds) 2015-01-20T18:08:41Z ski joined #scheme 2015-01-20T18:09:45Z booly-yam-5194_ joined #scheme 2015-01-20T18:11:06Z psy_ joined #scheme 2015-01-20T18:16:26Z steenuil joined #scheme 2015-01-20T18:18:30Z booly-yam-5194_ quit (Remote host closed the connection) 2015-01-20T18:20:14Z booly-yam-5194_ joined #scheme 2015-01-20T18:24:44Z theseb quit (Remote host closed the connection) 2015-01-20T18:25:58Z msgodf quit (Remote host closed the connection) 2015-01-20T18:26:49Z fsckd_ joined #scheme 2015-01-20T18:27:34Z fsckd quit (Ping timeout: 255 seconds) 2015-01-20T18:27:44Z booly-yam-5194_ quit (Remote host closed the connection) 2015-01-20T18:28:35Z booly-yam-5194_ joined #scheme 2015-01-20T18:33:26Z srenatus quit (Quit: Connection closed for inactivity) 2015-01-20T18:36:38Z jeapostrophe quit (Ping timeout: 245 seconds) 2015-01-20T18:39:31Z alexei___ quit (Ping timeout: 265 seconds) 2015-01-20T18:43:46Z taraz`` quit (Ping timeout: 255 seconds) 2015-01-20T18:44:09Z masm quit (Ping timeout: 252 seconds) 2015-01-20T18:55:57Z adu joined #scheme 2015-01-20T18:58:22Z xyh quit (Ping timeout: 265 seconds) 2015-01-20T19:00:04Z xyh joined #scheme 2015-01-20T19:02:21Z hiyosi quit (Quit: My Mac has gone to sleep. ZZZzzz…) 2015-01-20T19:03:22Z booly-yam-5194_ quit (Ping timeout: 240 seconds) 2015-01-20T19:09:56Z theseb joined #scheme 2015-01-20T19:13:34Z MichaelRaskin joined #scheme 2015-01-20T19:17:07Z alexei___ joined #scheme 2015-01-20T19:25:34Z jeapostrophe joined #scheme 2015-01-20T19:25:34Z jeapostrophe quit (Changing host) 2015-01-20T19:25:34Z jeapostrophe joined #scheme 2015-01-20T19:26:03Z lrs_ joined #scheme 2015-01-20T19:26:13Z lrs_: pjb, There? 2015-01-20T19:27:32Z pjb: yes 2015-01-20T19:27:52Z kazimir42 quit (Remote host closed the connection) 2015-01-20T19:27:55Z lrs_: pjb, Do you feel like lecturing me with the problem i had before? 2015-01-20T19:28:08Z pjb: ok. 2015-01-20T19:28:19Z kazimir42 joined #scheme 2015-01-20T19:29:58Z jeapostrophe quit (Ping timeout: 245 seconds) 2015-01-20T19:30:38Z lrs_: pjb, I was thinking of doing the quotient, /, * operators 2015-01-20T19:30:45Z lrs_: But Im not really sure how t ostart 2015-01-20T19:31:04Z pjb: Just add rules to the rules list. 2015-01-20T19:31:45Z lrs_: pjb, What was the rules list? 2015-01-20T19:31:51Z pjb: (define rules '( (--> (quotient int non-zero-int) int) (--> (/ int non-zero-int) real) …) 2015-01-20T19:31:53Z pjb: ) 2015-01-20T19:32:10Z lrs_: pjb, I dont get what that means 2015-01-20T19:32:14Z lrs_: What you just wrote 2015-01-20T19:32:35Z lrs_: Mainly the '( and --> 2015-01-20T19:32:35Z pjb: it means that when you (check '(quotient int non-zero-int)) you get int as result. 2015-01-20T19:32:47Z pjb: 'x = (quote x) 2015-01-20T19:33:06Z pnkfelix quit (Quit: rcirc on GNU Emacs 24.3.92.1) 2015-01-20T19:33:18Z pjb: (quote x) --> x 2015-01-20T19:33:20Z lrs_: pjb http://lpaste.net/118869 2015-01-20T19:33:27Z pjb: quote returns its argument without evaluating it. 2015-01-20T19:33:28Z lrs_: Thats how it look like right now 2015-01-20T19:33:38Z pjb: it is used to introduce literals. 2015-01-20T19:34:13Z lrs_: pjb, Whats literals 2015-01-20T19:34:51Z pjb: At that point, I would advise to pause with sicp, and use another book to learn some scheme programming first. 2015-01-20T19:35:39Z mdln quit (Remote host closed the connection) 2015-01-20T19:35:41Z pjb: lrs_: you should consider studing http://htdp.org/2003-09-26/ first. 2015-01-20T19:35:53Z lrs_: pjb, Well, Im swedish so I have ahard time with difficult english words 2015-01-20T19:36:08Z pjb: ok. 2015-01-20T19:36:21Z pjb: literals are data that are present literally in the source code of the program. 2015-01-20T19:36:56Z pjb: Now, in lisp, it is a little difficult to differentiate data from code, since we write lisp code using the syntax defined to write lisp data: sexp (symbolic expressions). 2015-01-20T19:36:56Z lrs_: So, it is stuff that is preset in scheme? 2015-01-20T19:37:23Z pjb: So to prevent the evaluator to evaluate the data that is really data and that should not be considered code, we use the quote operator. 2015-01-20T19:37:35Z pjb: Yes. 2015-01-20T19:37:49Z pjb: lrs_: you should also consider reading r5rs. This is less than 50 pages. 2015-01-20T19:37:50Z lrs_: Ah, ok. I figured it was something like that. But when you say introduce literals? 2015-01-20T19:37:55Z lrs_: pjb, Yeah, I have 2015-01-20T19:38:01Z lrs_: I have it printed out 2015-01-20T19:38:17Z pjb: Well, when I say reading, I mean memorizing. Not priting it out. 2015-01-20T19:38:23Z lrs_: Oh, ok 2015-01-20T19:39:00Z lrs_: Well, when I said that I meant. "I know what it is and I have read *some* of it" 2015-01-20T19:39:39Z pjb: Since r5rs is less than 50 pages, it should be read and know entirely. 2015-01-20T19:41:04Z lrs_: pjb, Well, I know most of it 2015-01-20T19:41:21Z lrs_: But are you suggesting that there is some chapter there that is beneficial to me 2015-01-20T19:42:49Z pjb: 100% of r5rs. Perhaps not the whole htdp, because it's big, and you may want to come back to sicp before finishing htdp, but you should read enough of it to know some basics such as what a literal is and what quote is used for. 2015-01-20T19:43:18Z alexei___ quit (Ping timeout: 245 seconds) 2015-01-20T19:45:02Z lrs_: pjb, Oh. Ok, I get know what you mean. Of course I know what ' i.e quote means 2015-01-20T19:45:27Z pjb: What occured in 1959, is that Steve Russell, a student of John McCarthy, implemented the eval function from the AIM-8 paper, and therefore, used S-expr to write programs which were passed as data to the eval function. 2015-01-20T19:45:46Z pjb: And it just worked, S-expr data were programs when interpreted by eval. 2015-01-20T19:46:35Z pjb: This is important, because it shows that the notion of program, depends on the processor you have for this class of programs. 2015-01-20T19:47:02Z pjb: The rules we are defining are actually a program, for the processor named apply-rules. 2015-01-20T19:47:28Z lrs_: Right 2015-01-20T19:49:23Z lrs_: pjb, But what does quote and literals has to to with our program rule 2015-01-20T19:50:01Z pjb: Since you are writing it in a file named something.scm, it will be interpreted by a scheme processor! 2015-01-20T19:50:16Z pjb: Therefore if you don't quote it, it will be taken as lisp (scheme) program. 2015-01-20T19:50:37Z lrs_: You mean if I use define? 2015-01-20T19:50:43Z lrs_: I need to use quote instead of define? 2015-01-20T19:50:44Z pjb: But --> is not a scheme operator, and ((--> (a i) i) (--> (b r) r)) is not a valid scheme form. 2015-01-20T19:51:13Z pjb: However you use it, you cannot write ((--> (a i) i) (--> (b r) r)) in a scheme program while --> is not an adequately defined scheme operator. 2015-01-20T19:51:31Z lrs_: Yes, I get that 2015-01-20T19:52:12Z pjb: Therefore we quote it, and then it becomes lisp data. (that will be used as apply-rules program). 2015-01-20T19:53:06Z lrs_: Ok 2015-01-20T19:53:35Z pjb: And keeping the list of rules in a list bound to a variable named rules is logical and practical. 2015-01-20T19:54:03Z pjb: It's better to name the variable rules than schmiblick, because we can then easily infer that this variable holds rules. 2015-01-20T19:54:05Z lrs_: So I start with writing in my something.scm , (quote (quotient int non-zero-int) int) 2015-01-20T19:54:32Z jbkcc quit (Quit: My Mac has gone to sleep. ZZZzzz…) 2015-01-20T19:54:33Z pjb: And having the rules in a list bound to a variable allows us to update this list easily, and even not necessarily in one place. 2015-01-20T19:54:54Z pjb: lrs_: no, you start by reading htdp. 2015-01-20T19:55:38Z lrs_: Where would I read the thing that would benefit me? 2015-01-20T19:55:46Z lrs_: I have studied scheme for 4-5 months 2015-01-20T19:56:11Z lrs_: I dont really feel like spending alot of hours on a book if it is jus old news 2015-01-20T19:56:22Z lrs_: I need to find stuff that helps me with this particular problem.. 2015-01-20T19:56:24Z pjb: You are asking very naive questions, so I doubt you've studied scheme programming for 4 months. 2015-01-20T19:57:23Z lrs_: Naive how? 2015-01-20T19:57:37Z pjb: lrs_: let's start by the apply-rules function. If you've studied scheme programming for 4 months, could you tell me what apply-rules does? 2015-01-20T19:58:38Z lrs_: In what sense? 2015-01-20T19:58:47Z pnkfelix joined #scheme 2015-01-20T19:58:57Z lrs_: What it does in the chain of programs? 2015-01-20T19:59:00Z lrs_: OR what its purpose is 2015-01-20T19:59:24Z pjb: Could you describe in english the purpose of apply-rules? 2015-01-20T19:59:27Z lrs_: As in pre and post 2015-01-20T19:59:31Z pjb: Yes. 2015-01-20T20:00:04Z lrs_: It takes rules and applies them 2015-01-20T20:00:31Z pjb: More or less. 2015-01-20T20:01:16Z pjb: It searches for a rule, and if it finds it, then it applies only this rule and returns the result of this rule application. 2015-01-20T20:01:24Z lrs_: My main problem is basically that 1. I dont know how I should define int, bool, *, quotient. 2. I dont know how to structure up all the chains of programs 3. I dont know how I should iterate through something like this > (check '(= (< (+ int int) (quotient int int)) (> int int))) 2015-01-20T20:01:45Z alexei___ joined #scheme 2015-01-20T20:01:58Z pjb: 2. this "iteration" is actually a recursion, and it's performed by the check procedure. 2015-01-20T20:02:01Z lrs_: Thats my problem 2015-01-20T20:02:07Z lrs_: Sorry, recursion 2015-01-20T20:02:10Z pjb: It's the (map check args) call. 2015-01-20T20:02:32Z lrs_: YEs 2015-01-20T20:02:36Z lrs_: That I understand 2015-01-20T20:02:47Z pjb: We will be able to see that by adding a few display in the procedures when we'll have a complete program. 2015-01-20T20:03:08Z lrs_: Yes 2015-01-20T20:03:13Z pjb: 1. the definition of int bool * quotient, etc is given implicitely by the rules where they are present. 2015-01-20T20:03:21Z pjb: hence the importance of writing the rules list. 2015-01-20T20:04:36Z lrs_: Yes 2015-01-20T20:04:41Z lrs_: And how do I do that 2015-01-20T20:04:58Z lrs_: You said i need to use quote, because otherwise scheme interprets it as a program 2015-01-20T20:05:00Z Fare joined #scheme 2015-01-20T20:05:04Z pjb: But before, can you explain HOW apply-rules does what it does? 2015-01-20T20:06:15Z lrs_: How do you mean how? In what sense? 2015-01-20T20:06:29Z pjb: explaining the code of apply-rules. 2015-01-20T20:06:32Z pjb: What does it does? 2015-01-20T20:06:38Z pjb: How does it do it? 2015-01-20T20:06:42Z lrs_: (define (apply-rules operator arg-types) (find-if operator arg-types) real) 2015-01-20T20:06:46Z lrs_: Is how it looks like right now 2015-01-20T20:06:56Z pjb: Right. Can you explain it in English? 2015-01-20T20:07:37Z pjb: This definition is wrong. There's another definition below. You have duplicate definition in your scheme source file. This is not allowed by the scheme standard. 2015-01-20T20:07:57Z lrs_: It takes a operator and applies it to arg-types? And then uses find-if operator is a arg-types.. and the ngive real. I really need yo uto explain what you want this to do because I dont understand it. And also (find-if predicate? list) so I dont really know what it does 2015-01-20T20:08:27Z kazimir42 quit (Ping timeout: 250 seconds) 2015-01-20T20:09:19Z lrs: Sorry 2015-01-20T20:09:22Z lrs: This was some old stuff 2015-01-20T20:09:31Z daviid quit (Ping timeout: 272 seconds) 2015-01-20T20:09:39Z lrs: pjb, http://lpaste.net/118875 Is this the apply rule you are talking about? 2015-01-20T20:10:05Z kongtomorrow joined #scheme 2015-01-20T20:10:43Z pjb: lrs: Have a look at this: http://paste.lisp.org/+3440 2015-01-20T20:11:06Z pjb: Better use paste.lisp.org for pasting lisp/scheme code. 2015-01-20T20:11:23Z lrs: Ok 2015-01-20T20:11:34Z pjb: lrs: notice the newlines I inserted. DrRacket didn't insert them as you said yesterday… 2015-01-20T20:11:48Z pjb: lrs: now can you see better what apply-rules does? 2015-01-20T20:11:58Z lrs: Yeah, sorry. I meant that when you press shift it just oders them correctly 2015-01-20T20:12:06Z pjb: What's the operator of the expression in the body of apply-rules? 2015-01-20T20:12:08Z lrs: IT doesnt make newlines correct so youre right 2015-01-20T20:12:51Z lrs: pjb, YEs. Maybe I have a bit difficult understanding what matchingrule does and the lambda inside the function does 2015-01-20T20:13:06Z pjb: lrs: you are looking too deep. 2015-01-20T20:13:14Z pjb: reading lisp is very easy, but you should not skip steps. 2015-01-20T20:13:25Z pjb: first you have to look at the first element of the toplevel sexp. 2015-01-20T20:13:41Z lrs: Check? 2015-01-20T20:14:06Z pjb: So, it's define. The first argument is (apply-rules operator arg-types) which means that we are defining a function named apply-rules, with two arguments, named operator and arg-types. 2015-01-20T20:14:13Z pjb: Then follows the body of the function. 2015-01-20T20:14:32Z pjb: the body of apply-rules has only one expression. What's the operator of the expression in that body? 2015-01-20T20:15:37Z lrs: Sorry, my english is bad. What do you mean when you say expression 2015-01-20T20:15:55Z lrs: Do you mean let? 2015-01-20T20:15:58Z pjb: expression = s-expression = atom or list of s-expression. 2015-01-20T20:16:00Z pjb: Yes, it's let. 2015-01-20T20:16:03Z pjb: What does let do? 2015-01-20T20:16:30Z lrs: Evaluates 2015-01-20T20:16:44Z pjb: what else? 2015-01-20T20:16:48Z excelsior quit (Quit: Lost terminal) 2015-01-20T20:17:20Z fsckd_ is now known as fsckd 2015-01-20T20:17:39Z pjb: lrs: you have the right to cheat, and to go read the r5rs to answer my questions! 2015-01-20T20:17:40Z pjb: http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-7.html#%_idx_124 2015-01-20T20:17:40Z rudybot: http://tinyurl.com/695ay7 2015-01-20T20:18:21Z lrs: ömb 2015-01-20T20:18:24Z lrs: Woops 2015-01-20T20:18:30Z lrs: pjb, You mean it gives values to things? 2015-01-20T20:18:35Z pjb: Yes. 2015-01-20T20:18:52Z pjb: That's its purpose in life, to bind values to variables. 2015-01-20T20:19:01Z lrs: Correct 2015-01-20T20:19:44Z pjb: In the semantic section of let, in r5rs, you see that it does several things: evaluates the init forms first. Bind the results of those inits to their corresponding variables, then it evaluates the body expressions and finally it returns the result of the last expression of the body. 2015-01-20T20:19:54Z pjb: So our let in apply-rules, what does it do? 2015-01-20T20:20:06Z pjb: How many variables does it bind? 2015-01-20T20:21:07Z lrs: pjb, one? rule? 2015-01-20T20:21:16Z pjb: one, named matching-rule 2015-01-20T20:21:35Z pjb: Notice that the semantics gives order of processing: eval init(s), bind variable(s), eval body, return result. 2015-01-20T20:21:35Z lrs: Ah, right 2015-01-20T20:21:42Z pjb: But I ask first what variable(s) is bound. 2015-01-20T20:21:59Z pjb: That's because variables serve as intermediary between the init(s) forms and the body forms. 2015-01-20T20:22:30Z pjb: And with their names, they can give good hint of the meaning of the the values they're bound to. (and therefore of the meaning of the init(s) forms). 2015-01-20T20:22:56Z pjb: So you can often read a let form without reading the details of the init(s) form, just by reading the name of the variables, and the body forms. 2015-01-20T20:23:21Z pjb: But of course, you may enter into the details and see what the init(s) forms are , which we're going to do now. 2015-01-20T20:23:37Z pjb: How is matching-rule initialized? What's the operator of its init form? 2015-01-20T20:24:40Z lrs: matching rule is initzialized by let? 2015-01-20T20:24:50Z msgodf joined #scheme 2015-01-20T20:25:21Z pjb: Well, let binds the result of the init form to the variable matching-rule. But this init form, which is evaluated by let, what is it? What's its operator? 2015-01-20T20:25:44Z githogori joined #scheme 2015-01-20T20:25:46Z lrs: The operator of let? 2015-01-20T20:25:54Z pjb: It's find-if 2015-01-20T20:25:56Z githogori quit (Max SendQ exceeded) 2015-01-20T20:26:12Z bjz_ joined #scheme 2015-01-20T20:26:16Z githogori joined #scheme 2015-01-20T20:26:16Z pjb: The init form for matching-rule, is the expressions just after matching-rule in the binding list. 2015-01-20T20:26:18Z lrs: I have a bit trouble understanding what you mean with init form 2015-01-20T20:26:32Z pjb: Check the syntax of let in the r5rs page linked above. 2015-01-20T20:26:53Z lrs: Ah, ok 2015-01-20T20:27:00Z githogori quit (Client Quit) 2015-01-20T20:27:01Z pjb: (let ) bindings ::= (( ) bindings ::= (( ) …) 2015-01-20T20:27:14Z githogori joined #scheme 2015-01-20T20:27:26Z lrs: Yes, well then it naturally is matching-rule. I get now what you mean 2015-01-20T20:28:15Z pjb: the variable is matching-rule. The init form of the matching-rule variable is (find-if …). The operator of the init form of the matching-rule variable is find-if. 2015-01-20T20:28:21Z pjb: What is find-if? 2015-01-20T20:28:46Z pjb: procedure, macro, syntax ? 2015-01-20T20:29:08Z bjz quit (Ping timeout: 245 seconds) 2015-01-20T20:29:27Z lrs: Find-if is a function that checks if a list is a predicate or not 2015-01-20T20:29:45Z lrs: find-if predicate? lst 2015-01-20T20:29:54Z pjb: not exactly. it's a procedure (in scheme terminology), or a function (in general lisp terminology). 2015-01-20T20:30:05Z lrs: Right, a procedure 2015-01-20T20:30:11Z pjb: It finds the first element in the list for which the predicate? function returns true. 2015-01-20T20:30:44Z msgodf quit (Remote host closed the connection) 2015-01-20T20:30:48Z pjb: I'm more of a lisper than a schemer, so I often use function instead of procedure. Furthermore, since I learned pascal, procedures don't return values, while functions do ;-) 2015-01-20T20:31:10Z pjb: Ok, this find-if function is not a standard function. You will have to write it. 2015-01-20T20:31:17Z pjb: How many arguments does it take? 2015-01-20T20:31:17Z lrs: Thats right 2015-01-20T20:31:26Z lrs: 2 2015-01-20T20:31:31Z pjb: What's the first argument? 2015-01-20T20:31:36Z lrs: predicate? 2015-01-20T20:31:42Z pjb: Yes. What is a predicate? 2015-01-20T20:31:55Z lrs: predicate? checks if something is a predicate or not 2015-01-20T20:32:39Z lrs: Its a boolean basically 2015-01-20T20:32:53Z lrs: If something is this then it is that 2015-01-20T20:33:17Z pjb: Yes but no :-) A predicate is a function that returns a boolean determined by an object. Predicate functions are often named with a question mark at the end of their names. But here, we write predicate? as parameter name with the question mark, which is a little redundant. 2015-01-20T20:33:34Z pjb: predicate? will be the name of the parameter, but it will be bound to a function passed as argument to find-if. 2015-01-20T20:33:51Z pjb: A predicate is a function returning a boolean, not a mere boolean. 2015-01-20T20:33:54Z pjb: Ok. 2015-01-20T20:34:00Z pjb: What's the second argument to find-if? 2015-01-20T20:35:33Z lrs: list 2015-01-20T20:35:34Z lrs: lst 2015-01-20T20:35:48Z pjb: Yes, it will be a list of objects. 2015-01-20T20:36:05Z pjb: Now, in the case of matching-rule, what is this second argument to find-if? 2015-01-20T20:36:27Z lrs: The whole lambda functon 2015-01-20T20:36:44Z pjb: this would be the first argument. The lambda function is our predicate. 2015-01-20T20:36:49Z pjb: What about the second argument? 2015-01-20T20:37:02Z lrs: Oh, sorry, rules 2015-01-20T20:37:21Z pjb: Right. So rules will have to be a variable bound to a list of rules. 2015-01-20T20:37:40Z pjb: Our lambda function has as parameter a rule, a single element of the list bound to rules. 2015-01-20T20:37:51Z pjb: Ok? 2015-01-20T20:38:27Z lrs: Ah ok 2015-01-20T20:38:54Z pjb: Let's look this lambda predicate. What's the operator of the expression in its body? 2015-01-20T20:39:09Z lrs: and 2015-01-20T20:39:24Z pjb: Ok, so we can assume it will return a boolean, which is good, since it is a predicate :-) 2015-01-20T20:39:34Z lrs: Yes 2015-01-20T20:39:37Z pjb: What does this test mean (the whole and form)? 2015-01-20T20:40:27Z lrs: IT checks if the first and second argument in apply-rules is eq to the rule-iperator and that arg-types is equalt to rule-argument-types rule 2015-01-20T20:40:39Z pjb: Good. 2015-01-20T20:41:02Z pjb: Notice that in the paste, there's a bug, since eq? is used to both. We want to use equal? for the arg-types, since it's a list. 2015-01-20T20:41:20Z pjb: eq? would test whether the two lists are actually the same identical list. 2015-01-20T20:41:23Z lrs: YEs, so I figured. eq? is for numerical things i think? 2015-01-20T20:41:27Z lrs: Oh 2015-01-20T20:41:31Z pjb: No. For numbers use = 2015-01-20T20:41:35Z lrs: Right 2015-01-20T20:41:46Z pjb: eq? should be avoided actually. It's better in general to use eql? 2015-01-20T20:41:55Z pjb: equal? will test whether the two lists contain the same elements. 2015-01-20T20:42:21Z pjb: Ok. so that means the find-if will find a rule that has the operator and arg-types. 2015-01-20T20:42:33Z pjb: Let's look at the body of the let form now. 2015-01-20T20:42:37Z pjb: What's the operator? 2015-01-20T20:43:06Z lrs: matching-rule? 2015-01-20T20:43:23Z pjb: This is the variable bound by let. What's in the body of the let form? 2015-01-20T20:44:29Z lrs: Everything except the if statement? 2015-01-20T20:44:45Z pjb: On the contrary. The body of the let form contains only this if expression. 2015-01-20T20:44:53Z pjb: In lisp, there are no statement, only expressions. 2015-01-20T20:45:33Z lrs: Right 2015-01-20T20:45:48Z pjb: Once let has evaluated the init form, the find-if call, it will bind the result of find-if (hopefully a rule) to the variable matching-rule, and then evaluate its body, this if form. 2015-01-20T20:45:54Z pjb: What do we test with this if? 2015-01-20T20:46:33Z mdln joined #scheme 2015-01-20T20:48:04Z lrs: pjb, Right. If matching-rule is nil. Then it gives an error. Otherwise.. Im not sure.. It does something with rule-result-type 2015-01-20T20:48:32Z pjb: ok. Remember that let returns as result, the result of the last expression in its body. 2015-01-20T20:48:46Z lrs: Aha 2015-01-20T20:48:51Z pjb: Since we have only one expression, this if form, then it's the result of this if form that will become the result of the let form. 2015-01-20T20:48:53Z lrs: So the last line 2015-01-20T20:49:01Z lrs: Is a way to save the stuff 2015-01-20T20:49:01Z lrs: ? 2015-01-20T20:49:18Z pjb: In the case of error, it won't return. In the other case, it will return the (rule-result-type matching-rule). 2015-01-20T20:49:28Z pjb: It's not a "saving" it's a _returning_. 2015-01-20T20:49:52Z pjb: (let ((a 0)) (+ (if (= 0 a) 1 2) 3)) --> 4 2015-01-20T20:49:55Z lrs: It returns the value of matching-rule to rule-result? 2015-01-20T20:50:14Z pjb: Since there are only expressions, an expression like if has a value, a result. 2015-01-20T20:50:42Z pjb: No rule-result-type is (will be) a function taking matching-rule as argument. 2015-01-20T20:50:52Z pjb: And this function will return a result, the result type of the rule. 2015-01-20T20:51:12Z pjb: remember the rule format: (--> (operator . argument-types) result-type) 2015-01-20T20:52:01Z pjb: Now, we have all those functions that are undefined: rule-operator rule-argument-types rule-result-type find-if ; you should start by implementing the rule-… functions. Annotate the lisp paste. 2015-01-20T20:53:14Z lrs: Annotate = Comment ? 2015-01-20T20:53:56Z bjz_ quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) 2015-01-20T20:54:00Z lrs: Ok, Im gonna try to write some crappy code 2015-01-20T20:54:05Z pjb: It's more like a new version of the paste. Click on the Annotate button, and you can add your code. 2015-01-20T20:55:06Z lrs: pjb, Do I need to alter "rule" in some way 2015-01-20T20:55:25Z pjb: No. 2015-01-20T20:55:46Z pjb: In general, we avoid, or just don't need to modify variables or data structures. 2015-01-20T20:56:01Z lrs: Ok, so ill only focus on the ones you mentioned. Got it 2015-01-20T20:56:03Z pjb: By avoiding mutation, we can avoid a lot of bugs. 2015-01-20T21:03:21Z lrs: pjb, This is the hardest part 2015-01-20T21:03:34Z pjb: Ok, let's consider rule-operator. 2015-01-20T21:03:44Z pjb: Can you give me a rule as an example? 2015-01-20T21:04:10Z lrs: > (+ int int) 2015-01-20T21:04:10Z lrs: int 2015-01-20T21:04:28Z pjb: The format of a rule would be: (--> (operator . argument-types) result-type) 2015-01-20T21:04:38Z pjb: So an example of a rule would be: (--> (+ int int) int) 2015-01-20T21:04:40Z pjb: right? 2015-01-20T21:04:48Z lrs: Yes 2015-01-20T21:05:00Z pjb: So what should (rule-operator '(--> (+ int int) int)) return? 2015-01-20T21:05:38Z lrs: Error? (+ int int) int) doesnt work 2015-01-20T21:05:49Z lrs: Or wait 2015-01-20T21:05:59Z lrs: Sorry 2015-01-20T21:06:00Z lrs: #t 2015-01-20T21:06:01Z pjb: the operator in the rule (--> (+ int int) int) is + 2015-01-20T21:06:09Z lrs: Oh 2015-01-20T21:06:12Z pjb: the operator in the rule (--> (* int int) int) is * 2015-01-20T21:06:13Z lrs: Ah, yes 2015-01-20T21:06:14Z pjb: etc. 2015-01-20T21:06:22Z lrs: But why int at the end? 2015-01-20T21:06:22Z pjb: How can we get this operator from the rule? 2015-01-20T21:06:31Z pjb: the int at the end is the result-type. 2015-01-20T21:06:37Z pjb: rule format: (--> (operator . argument-types) result-type) 2015-01-20T21:06:53Z lrs: Why is result-type conencted to rule operator 2015-01-20T21:07:22Z pjb: because the meaning of the rule, is that when we apply the operator to arguments of the given type, we obtain a value of the result type. 2015-01-20T21:07:30Z pjb: given argument types 2015-01-20T21:08:05Z pjb: The purpose of the rules, is to memorize the correspondance between the operator argument-types tuples, and the result types. 2015-01-20T21:08:16Z pjb: --> is only there to make it beautiful 2015-01-20T21:08:29Z pjb: Notice that we could choose another format, such as: ((+ int int) --> int) 2015-01-20T21:09:02Z pjb: It's just because we are used to Polish notation in lisp that I put the --> first. 2015-01-20T21:09:34Z pjb: But there would be good arguments to choose this ((+ int int) --> int) format. 2015-01-20T21:10:02Z pjb: That's the point of using rule-operator rule-argument-types and rule-result-type functions: this will let us change the format easily. 2015-01-20T21:10:23Z pjb: So, given (--> (* int int) int), how can we obtain the *? 2015-01-20T21:10:37Z pjb: So, given a list such as: (--> (* int int) int), how can we obtain the *? 2015-01-20T21:12:06Z lrs: if operator equal * -> save it in some way 2015-01-20T21:12:28Z pjb: No, don't think "saving". Saving is mutating some variable. 2015-01-20T21:12:30Z pjb: We don't need that. 2015-01-20T21:12:41Z lrs: Yeah I knw 2015-01-20T21:12:44Z pjb: We have functions to cut lists: car and cdr. 2015-01-20T21:12:56Z vdamewood joined #scheme 2015-01-20T21:12:58Z pjb: What is (car '(--> (* int int) int)) ? 2015-01-20T21:13:04Z lrs: Ah, right 2015-01-20T21:13:23Z davexunit quit (Quit: Later) 2015-01-20T21:13:39Z lrs: * 2015-01-20T21:13:52Z pjb: (car '(--> (* int int) int)) returns --> ; says my scheme. 2015-01-20T21:13:59Z pjb: So it's not good. 2015-01-20T21:14:11Z pjb: What about (cdr '(--> (* int int) int)) ? 2015-01-20T21:14:14Z mrowe is now known as mrowe_away 2015-01-20T21:14:25Z lrs: (1 1) 2015-01-20T21:14:30Z lrs: I dont really understand the --> thing 2015-01-20T21:14:36Z pjb: --> is a symbol. 2015-01-20T21:14:47Z lrs: A procedure symbol? 2015-01-20T21:14:52Z pjb: like gives or rule or thingy. 2015-01-20T21:14:55Z pjb: No, just a symbol. 2015-01-20T21:14:57Z lrs: Ok 2015-01-20T21:15:02Z sheilong quit (Quit: Konversation terminated!) 2015-01-20T21:15:10Z pjb: Lisp is a symbolic language. 2015-01-20T21:15:20Z pjb: (cdr '(--> (* int int) int)) returns: ((* int int) int) 2015-01-20T21:15:24Z pjb: not good, but it's better. 2015-01-20T21:15:34Z pjb: What about (car (cdr '(--> (* int int) int))) ? 2015-01-20T21:15:49Z boycottg00gle joined #scheme 2015-01-20T21:16:36Z lrs: Oh 2015-01-20T21:16:55Z bjz joined #scheme 2015-01-20T21:16:56Z lrs: But (cdr '(* int int)) gives (int int) 2015-01-20T21:17:24Z pjb: Yes, but let's build a complete expression, starting from the rule. 2015-01-20T21:17:35Z pjb: You should evaluate those things in the REPL of course. 2015-01-20T21:17:49Z pjb: We could bind the rule to a variable: 2015-01-20T21:18:20Z pjb: (let ((rule '(--> (* int int) int))) (car (cdr rule))) returns: (* int int) 2015-01-20T21:18:29Z pjb: better, but not yet. 2015-01-20T21:18:41Z lrs: yes 2015-01-20T21:18:54Z pjb: So what could we use instead of ??? to get the *? (let ((rule '(--> (* int int) int))) (??? (car (cdr rule)))) 2015-01-20T21:19:38Z lrs: (cdr (car)) 2015-01-20T21:20:04Z pjb: If you use copy and paste, you can easily answer complete expressions. 2015-01-20T21:20:14Z pjb: (let ((rule '(--> (* int int) int))) (car (car (cdr rule)))) returns: * ; yay! 2015-01-20T21:20:41Z pjb: So we may (define (rule-operator rule) (car (car (cdr rule)))) 2015-01-20T21:20:59Z pjb: Try it: (let ((rule '(--> (* int int) int))) (rule-operator rule)) 2015-01-20T21:21:19Z Vutral quit (Ping timeout: 244 seconds) 2015-01-20T21:21:40Z lrs: pjb, Im not sure.. What should I try? 2015-01-20T21:21:59Z pjb: All the expression that I type here, you should evaluate them in a scheme REPL! 2015-01-20T21:22:13Z lrs: Yeah, I do. But the --> is strange 2015-01-20T21:22:29Z lrs: And (let ((rule '(--> (* int int) int))) (rule-operator rule)) doesnt work since rule-operator is not defined yet 2015-01-20T21:22:31Z pjb: We could use another format. 2015-01-20T21:22:55Z pjb: We could use the format: (when applying * on arguments of type (int int) we obtain a value of type int) 2015-01-20T21:22:59Z turtleman_ quit (Ping timeout: 272 seconds) 2015-01-20T21:23:01Z boycottg00gle left #scheme 2015-01-20T21:23:13Z lrs: Right 2015-01-20T21:23:14Z pjb: Then (define (rule-operator rule) (car (cdr (cdr rule)))) 2015-01-20T21:23:36Z pjb: (rule-operator '(when applying * on arguments of type (int int) we obtain a value of type int)) returns: * 2015-01-20T21:23:58Z pjb: but it's simplier to write (--> (* int int) int) 2015-01-20T21:24:09Z lrs: Oh, I get it 2015-01-20T21:24:16Z lrs: But, we need to make it recursive 2015-01-20T21:24:20Z pjb: It's like (+ 2 3) which is written in maths 2 + 3. 2015-01-20T21:24:35Z pjb: Here (--> (* int int) int) would be written in maths (* int int) --> int 2015-01-20T21:24:42Z pjb: No we do not. 2015-01-20T21:24:49Z pjb: That's the point of using rules. 2015-01-20T21:24:57Z pjb: You don't need to make recursive rules. 2015-01-20T21:25:00Z lrs: Hmmm 2015-01-20T21:25:06Z pjb: The recusivity is managed by the check function itself. 2015-01-20T21:25:19Z lrs: So I dont have to make rule operator recursive so it always takes the first operator.. right? 2015-01-20T21:25:21Z lrs: What about 2015-01-20T21:25:26Z pjb: Yes. 2015-01-20T21:25:29Z lrs: > (check '(= (< (+ int int) (quotient int int)) (> int int))) 2015-01-20T21:25:31Z pjb: We only consider one operator at a time. 2015-01-20T21:25:41Z lrs: WHat does rule operator do here.. Or lets say. I put rule-operator there instead. 2015-01-20T21:25:44Z pjb: Now, write the three rule-… function, and paste them. 2015-01-20T21:25:55Z lrs: Or, wait, it only checks one list at a a time? one cons of a pair? 2015-01-20T21:26:04Z pjb: one rule yes,. 2015-01-20T21:26:09Z lrs: Im not really sure about the structure of rule-operator 2015-01-20T21:26:17Z lrs: Or how it correlates to the other programs 2015-01-20T21:26:54Z pjb: it is called by our lambda predicate. 2015-01-20T21:27:00Z pjb: So we have to implement it. 2015-01-20T21:28:56Z kongtomorrow quit 2015-01-20T21:29:50Z lrs: pjb, Why do you call it lambda? 2015-01-20T21:30:00Z suppi quit (Quit: Leaving) 2015-01-20T21:30:04Z pjb: It's because it has no name. 2015-01-20T21:30:12Z lrs: I mean, why do yo ustart calling it lambda now? We had previous ones that have lambda in them right 2015-01-20T21:30:14Z lrs: Ah ok 2015-01-20T21:30:15Z pjb: lambda is the operator used to introduce unnamed functions. 2015-01-20T21:30:27Z bjz quit (Ping timeout: 276 seconds) 2015-01-20T21:30:39Z lrs: But when you write define, you have a lambda in it still am i not right? 2015-01-20T21:30:59Z pjb: Yes, but those functions are "named" by the variable to which we bind them. 2015-01-20T21:31:10Z lrs: YOu write (define(function x) or (define function (lambda (x)) 2015-01-20T21:31:14Z lrs: And its the smae hting. 2015-01-20T21:31:15Z pjb: Yes. 2015-01-20T21:31:26Z lrs: Right. Ok. I just wanted to be sure so it wasnt something weird thing about predicate 2015-01-20T21:31:35Z pjb: No, nothing weird. 2015-01-20T21:32:17Z lrs: Ok 2015-01-20T21:32:27Z pjb: We could have named it, but since we use variable from the outer scope, the parameters operator and arg-types, this lambda predicate is actually a closure, and we would have to give it a name inside the apply-rules function. 2015-01-20T21:33:04Z pjb: We could have written: (let* ((match? (lambda (rule) (and …))) (matching-rule (find-if match? rule) )) (if …)) 2015-01-20T21:33:58Z pjb: But actually, this init form for the matching-rule, we should probably extract it into its own function (matching-rule operator arg-types), because such a function could be useful to perform other operations than just apply-rule. 2015-01-20T21:34:23Z pjb: But for now, write the three rule-… functions and paste them in the annotation. 2015-01-20T21:34:53Z pjb: http://paste.lisp.org/display/145296 2015-01-20T21:35:02Z turtleman_ joined #scheme 2015-01-20T21:37:58Z lrs: pjb, Ok, give me a minute to think 2015-01-20T21:38:04Z pjb: sure. 2015-01-20T21:38:14Z githogori quit (Read error: Connection reset by peer) 2015-01-20T21:43:19Z mrowe_away is now known as mrowe 2015-01-20T21:46:18Z githogori joined #scheme 2015-01-20T21:51:25Z Riastradh quit (Write error: Broken pipe) 2015-01-20T21:51:25Z zwer_e quit (Write error: Connection reset by peer) 2015-01-20T21:53:05Z davexunit joined #scheme 2015-01-20T21:53:53Z kongtomorrow joined #scheme 2015-01-20T21:54:15Z zwer joined #scheme 2015-01-20T21:54:32Z Riastradh joined #scheme 2015-01-20T22:04:48Z mdln quit (Remote host closed the connection) 2015-01-20T22:07:56Z kongtomorrow quit 2015-01-20T22:08:26Z robot-beethoven joined #scheme 2015-01-20T22:10:55Z lrs: pjb, http://paste.lisp.org/display/145296#1 I suck so bad 2015-01-20T22:13:01Z pjb: Have you tested them? 2015-01-20T22:13:23Z lrs: Im not sure how to test them. I dont get your symbol thing... 2015-01-20T22:13:23Z senoj joined #scheme 2015-01-20T22:13:44Z pjb: lrs: http://paste.lisp.org/+3440/2 2015-01-20T22:13:49Z pjb: use this definition for rules. 2015-01-20T22:14:00Z pjb: Then type in the REPL: (car rules) to find the first rule. 2015-01-20T22:14:23Z pjb: and type: (rule-argument-types (car rules)) to find the argument types of the first rule. It should be (int int) 2015-01-20T22:14:59Z pjb: similarly, (rule-operator (car rules)) should return + 2015-01-20T22:15:56Z pjb: unfortunately, I can't find your annotation a rule-result-type definition (the parentheses don't balance). The least thing is to ensure that parentheses balance. 2015-01-20T22:16:11Z pjb: You should use emacs with paredit-mode to help you ensure it. 2015-01-20T22:16:42Z pjb: I'm sorry that I don't know the features available in DrRacket. Why does it let you write such incomplete expressions? 2015-01-20T22:16:45Z senoj left #scheme 2015-01-20T22:18:03Z pjb: I've added a test function: http://paste.lisp.org/display/145296#3 2015-01-20T22:18:10Z lrs: rules : undefined 2015-01-20T22:18:33Z pjb: You should define it. In paste #2, there's a definition. 2015-01-20T22:18:48Z pjb: copy and paste that text to your REPL and to your source file. 2015-01-20T22:18:55Z lrs: I did 2015-01-20T22:19:31Z mrowe is now known as mrowe_away 2015-01-20T22:20:41Z pjb: In emacs, I type M-x run-scheme RET to launch mit-scheme in an inferior scheme process, and then I just type scheme code in lrs.scm and then C-x C-s to save the file, and C-x C-l to load the file in the inferior scheme process (mit-scheme). The results are printed in the *scheme* buffer. 2015-01-20T22:21:56Z pjb: I can try out expressions in the source buffer by typing C-x C-e after an expression (result printed in the *scheme* buffer), or I can type expressions followed by RET in the REPL (the *scheme* buffer). 2015-01-20T22:22:36Z pjb: So when I write a function, I actually write little subexpressions, and evaluate them to check them while I build the more complex expression. 2015-01-20T22:22:59Z kongtomorrow joined #scheme 2015-01-20T22:23:00Z pjb: I may define test data or use let as I've shown above. 2015-01-20T22:23:21Z pjb: Probably something similar can be done in DrRacket. 2015-01-20T22:23:30Z kongtomorrow quit (Read error: Connection reset by peer) 2015-01-20T22:23:59Z kongtomorrow joined #scheme 2015-01-20T22:28:35Z lrs: pjb, You mean that i should paste in the "terminal" ? 2015-01-20T22:28:43Z mumptai quit (Quit: Verlassend) 2015-01-20T22:29:09Z lrs: pjb, Ah, that works 2015-01-20T22:29:17Z lrs: It gives me int 2015-01-20T22:29:58Z pjb: it's wrong the argument types should be a list of types (int int) in the case of the first rule. 2015-01-20T22:30:13Z pjb: And here I get (int), not int. 2015-01-20T22:30:28Z pjb: parentheses are very very very important in lisp. 2015-01-20T22:32:14Z lrs: I get int 2015-01-20T22:33:31Z pjb: Then your function is wrong. Correct it. 2015-01-20T22:33:42Z lrs: (car (cdr (cdr rule)))) 2015-01-20T22:33:49Z lrs: Oh fk 2015-01-20T22:34:21Z LeoNerd: (caddr rule) surely? ;) 2015-01-20T22:34:49Z pjb: (define (rule-argument-types rule) …) evaluate, try out, check result. 2015-01-20T22:35:36Z lrs: pjb, What does --> do to the cdr and whatever 2015-01-20T22:35:41Z lrs: It doesnt destroy it right 2015-01-20T22:35:52Z mrowe_away is now known as mrowe 2015-01-20T22:36:20Z pjb: --> doesn't do anything. It's a symbol. Same as whatchamacall, thingy, schmiblick, + or blah. 2015-01-20T22:37:09Z lrs: pjb, What do you want the output to be? 2015-01-20T22:37:14Z gravicappa quit (Remote host closed the connection) 2015-01-20T22:37:54Z lrs: (car (cdr (cdr rule)))) 2015-01-20T22:37:59Z lrs: (rule-operator (car rules)) 2015-01-20T22:38:00Z lrs: = int 2015-01-20T22:38:47Z pjb: So it's wrong. 2015-01-20T22:38:57Z pjb: (rule-operator (car rules)) should be + 2015-01-20T22:39:05Z pjb: (rule-argument-types (car rules)) should be (int int) 2015-01-20T22:39:10Z pjb: (rule-result-type (car rules)) should be int 2015-01-20T22:40:54Z kongtomorrow quit 2015-01-20T22:49:53Z pjb: You know what car and cdr do? 2015-01-20T22:49:57Z lrs: Yeah 2015-01-20T22:50:02Z lrs: Im just having trouble with argument-types 2015-01-20T22:50:05Z pjb: Why? 2015-01-20T22:50:39Z pjb: (rule-argument-types '(--> (+ int int) int)) = (int int). What is (int int) in the rule? 2015-01-20T22:51:33Z pjb: It's the rest of the second element of that list. 2015-01-20T22:51:35Z lrs: (cdr (car rule)) 2015-01-20T22:51:45Z pjb: rest is cdr, and second is cadr or (car (cdr .)) 2015-01-20T22:51:46Z pjb: (cdr (car (cdr '(--> (+ int int) int)))) = (int int) 2015-01-20T22:52:03Z pjb: So (define (rule-argument-types rule) (cdr (car (cdr rule)))) 2015-01-20T22:52:14Z pjb: It's not more complicated. 2015-01-20T22:53:26Z pjb: And similarly, rule-result-type is the third element of the list. so (car (cdr (cdr rule))) 2015-01-20T22:55:43Z lrs: > (rule-result-types (car rules)) int > (rule-argument-types (car rules)) (int int) > (rule-operator (car rules)) + 2015-01-20T22:58:17Z uris77 quit (Quit: leaving) 2015-01-20T22:59:16Z pjb: good. Now paste them, and start writing find-if. 2015-01-20T23:00:19Z daviid joined #scheme 2015-01-20T23:01:17Z davexunit quit (Quit: Later) 2015-01-20T23:01:19Z lrs: pjb, Ok, give me some time to think 2015-01-20T23:05:49Z theseb quit (Quit: Leaving) 2015-01-20T23:10:27Z Riastradh quit (Ping timeout: 250 seconds) 2015-01-20T23:14:07Z lrs: pjb, Could you tell me the purpose of find-if again? 2015-01-20T23:14:38Z pjb: return the first element in the list for which predicate? returns true, or else the symbol nil. 2015-01-20T23:14:38Z pjb: 2015-01-20T23:15:44Z lrs: pjb, Dont I need to write out predicate too then 2015-01-20T23:16:09Z pjb: No. The predicate is a parameter. 2015-01-20T23:16:20Z pjb: (define (find-if predicate? list) …) 2015-01-20T23:20:50Z oleo is now known as Guest88962 2015-01-20T23:21:14Z alezost quit (Quit: I use GNU Guix ) 2015-01-20T23:22:16Z jlongster quit (Ping timeout: 265 seconds) 2015-01-20T23:22:26Z oleo__ joined #scheme 2015-01-20T23:23:34Z Guest88962 quit (Ping timeout: 245 seconds) 2015-01-20T23:32:23Z hiyosi joined #scheme 2015-01-20T23:32:56Z adu quit (Quit: adu) 2015-01-20T23:35:06Z lrs: pjb, (define (find-if predicate lst) 2015-01-20T23:35:07Z lrs: (if (predicate? lst))(car lst) 2015-01-20T23:35:07Z lrs: 'nil) 2015-01-20T23:35:10Z lrs: :S 2015-01-20T23:36:58Z pjb: return the first element in the list for which predicate? returns true, or else the symbol nil. 2015-01-20T23:37:12Z pjb: It should call predicate? on elements of the list. Not on the whole list. 2015-01-20T23:37:25Z pjb: And for that, the list must not be empty. 2015-01-20T23:37:45Z lrs: pjb, Right. So it needs a recursion thing 2015-01-20T23:37:48Z lrs: BUt I dont know how to write it 2015-01-20T23:37:53Z pjb: In general, when you process a list, the first thing you must do is to test whether the list is empty. 2015-01-20T23:38:02Z lrs: Yes 2015-01-20T23:38:07Z lrs: So (null? lst) 2015-01-20T23:38:48Z pjb: yes. 2015-01-20T23:39:29Z lrs: (define (find-if predicate lst) 2015-01-20T23:39:29Z lrs: (if ((null? lst) 'nil) 2015-01-20T23:39:29Z lrs: (if (predicate? lst))(car lst) 2015-01-20T23:39:34Z pjb: If you read from the start to the point where this problem was given to you, you should find explications about how to write a recursive function. 2015-01-20T23:39:39Z lrs: I know i need to fix the syntax somehow 2015-01-20T23:39:53Z pjb: You should use cond instead of if, since you will have several tests to check in sequence. 2015-01-20T23:39:55Z lrs: How do you mean from the start? 2015-01-20T23:40:38Z pjb: Because using car/cdr to find elements in a list, and writing a recursive procedure is explained in general between the start of the book/tutorial, and the point where they ask you to write procedures requiring it. 2015-01-20T23:41:10Z pjb: What book do you read? Where did you find this exercice? 2015-01-20T23:41:30Z lrs: This is an exercise from my course 2015-01-20T23:41:49Z pjb: So, what did your teacher tell you about recursive functions? 2015-01-20T23:42:14Z lrs: Well, I know how it work. BUt i forget the "standard way" of writing it in scheme 2015-01-20T23:42:33Z hiroakip joined #scheme 2015-01-20T23:43:03Z lrs: pjb, find-if is a boolean right? 2015-01-20T23:43:10Z pjb: No. 2015-01-20T23:43:15Z pjb: It's a selector. 2015-01-20T23:43:17Z vdamewood quit (Quit: Computer has gone to sleep.) 2015-01-20T23:43:20Z lrs: No wait, forget what i sad 2015-01-20T23:43:22Z pjb: It selects an element from the list. 2015-01-20T23:43:38Z pjb: And unless the predicate returns true for #f, it will always return a true value. 2015-01-20T23:43:58Z lrs: (define (find-if predicate lst) 2015-01-20T23:43:59Z lrs: (cond ((null? lst) ... ) 2015-01-20T23:43:59Z lrs: ((predicate? lst))(car lst))) 2015-01-20T23:44:13Z pjb: http://htdp.org/2003-09-26/Book/curriculum-Z-H-7.html#node_sec_4.3 2015-01-20T23:44:15Z pjb: http://htdp.org/2003-09-26/Book/curriculum-Z-H-13.html#node_idx_896 2015-01-20T23:44:34Z pjb: Don't call predicate on the list! 2015-01-20T23:44:43Z pjb: Only on _elements_ of the list. 2015-01-20T23:44:58Z lrs: (define (find-if predicate lst) 2015-01-20T23:44:58Z lrs: (cond ((null? (car lst)) ... ) 2015-01-20T23:44:58Z lrs: ((predicate? lst))(car lst))) 2015-01-20T23:44:59Z pjb: And you must do something when predicate? returns false. 2015-01-20T23:45:01Z lrs: woops 2015-01-20T23:45:16Z iKlsR joined #scheme 2015-01-20T23:45:21Z lrs: (define (find-if predicate lst) 2015-01-20T23:45:22Z lrs: (cond ((null? (car lst)) ... ) 2015-01-20T23:45:22Z lrs: ((predicate? (car lst))...))) 2015-01-20T23:45:23Z pjb: You should really study htdp. 2015-01-20T23:45:26Z lrs: Sorry if I spam too much 2015-01-20T23:45:51Z pjb: What do you return when the list is empty? 2015-01-20T23:46:00Z pjb: (find-if even? '()) --> ? 2015-01-20T23:46:29Z lrs: (car lst) 2015-01-20T23:47:08Z lrs: "return the first element in the list for which predicate? returns tru" 2015-01-20T23:47:09Z pjb: find-if returns the first element in the list for which predicate? returns true, or else the symbol nil. 2015-01-20T23:47:23Z pjb: If there's no element in the list, then we are in the "else" case. 2015-01-20T23:47:29Z pjb: else the symbol nil is returned. 2015-01-20T23:47:35Z pjb: So you should return the symbol nil. 2015-01-20T23:47:57Z lrs: (define (find-if predicate lst) 2015-01-20T23:47:57Z lrs: (cond ((null? (car lst)) 'nil ) 2015-01-20T23:47:57Z lrs: ((predicate? (car lst))...))) 2015-01-20T23:48:07Z pjb: Notice that in scheme when lst is (), (car lst) will signal an error. 2015-01-20T23:48:12Z pjb: Ok. 2015-01-20T23:48:25Z pjb: Now when (predicate? (car lst)) is true, what should be returned? 2015-01-20T23:48:40Z lrs: (car lst) ? 2015-01-20T23:48:50Z pjb: yes. 2015-01-20T23:48:59Z jlongster joined #scheme 2015-01-20T23:49:13Z lrs: (define (find-if predicate lst) 2015-01-20T23:49:13Z lrs: (cond ((null? (car lst)) 'nil ) 2015-01-20T23:49:13Z lrs: ((predicate? (car lst))(car lst)))) 2015-01-20T23:49:19Z pjb: and finally, if predicate? returns false, for the first element of the list , what should we return? 2015-01-20T23:49:52Z lrs: When predicate is false, that means there is no predicate soooo 2015-01-20T23:50:12Z pjb: No. that just means that (predicate? (car lst)) is false. But what about (cdr lst)? 2015-01-20T23:50:28Z lrs: oh right, thats where the recursion comes in 2015-01-20T23:50:33Z pjb: yes 2015-01-20T23:50:44Z lrs: (find-if (cdr lst)) 2015-01-20T23:50:53Z pjb: takes two arguments. 2015-01-20T23:51:32Z pjb: (find-if predicate? (cdr lst)) 2015-01-20T23:51:40Z lrs: Ah 2015-01-20T23:52:35Z lrs: (define (find-if predicate lst) 2015-01-20T23:52:36Z lrs: (cond ((null? (car lst)) 'nil ) 2015-01-20T23:52:36Z lrs: ((predicate? (car lst)) 2015-01-20T23:52:36Z lrs: (find-if predicate? (car lst))))) 2015-01-20T23:53:19Z pjb: Check http://htdp.org/2003-09-26/Book/curriculum-Z-H-7.html#node_sec_4.3 or http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-7.html#%_idx_106 for the syntax of cond. 2015-01-20T23:53:19Z rudybot: http://tinyurl.com/3gogwm 2015-01-20T23:53:54Z jlongster quit (Ping timeout: 264 seconds) 2015-01-20T23:53:54Z pjb: And you seem to have some problem with your short term memory. 2015-01-20T23:54:42Z pjb: how ((predicate? (car lst))(car lst)) and (find-if predicate? (cdr lst)) get merged into (define (find-if predicate lst) (cond ((null? (car lst)) 'nil ) ((predicate? (car lst)) (find-if predicate? (car lst))))) ? 2015-01-20T23:54:56Z pjb: Do you use emacs? 2015-01-20T23:55:21Z pjb: You should use emacs, to edit text and code, while IRCing. 2015-01-20T23:59:31Z lrs_: pjb, I have ADHD