2014-11-29T00:04:09Z vraid: theseb: do you have to do it recursively, or can you use higher order functions? 2014-11-29T00:04:27Z theseb: vraid: sure 2014-11-29T00:04:36Z theseb: vraid: well i like recursion..it is simple 2014-11-29T00:04:47Z theseb: vraid: i don't know what higher order funcs are 2014-11-29T00:04:59Z theseb: vraid: this is for pedagogy so i don't want to get too fancy 2014-11-29T00:06:10Z vraid: theseb: (map list '(x y z) '(a b c)) 2014-11-29T00:08:44Z theseb: vraid: almost! 2014-11-29T00:09:05Z theseb: vraid: i did (map list '(1 2 3) '(4 5 6)) and i got ((1) (2) (3)) 2014-11-29T00:09:37Z theseb: wait..n/m 2014-11-29T00:09:40Z vraid: it shouldn't do that.. 2014-11-29T00:09:41Z theseb: yes it works 2014-11-29T00:09:47Z theseb: guile gave right answer 2014-11-29T00:11:47Z theseb: vraid: i didn't know map can accept more than 1 list 2014-11-29T00:12:10Z vraid: map and fold accept *any* number of lists, as long as it matches the number of arguments of the function 2014-11-29T00:12:22Z theseb: vraid: i want to find other examples but hard to google for it....is there a standard name for what i'm doing? python calls it zip 2014-11-29T00:12:41Z theseb: vraid: my baby lisp i wrote has a primitive map that only uses 1 list 2014-11-29T00:12:47Z vraid: haskell calls it zip aswell. it's not common to use in scheme, since there is rarely any need for it 2014-11-29T00:13:02Z theseb: vraid: paul graham needed it to implement eval in lisp 2014-11-29T00:13:12Z theseb: in his Roots Of Lisp paper 2014-11-29T00:13:16Z theseb: that 's why i'm doing this 2014-11-29T00:14:11Z annodomini quit (Quit: annodomini) 2014-11-29T00:14:58Z vraid: i didn't know that 2014-11-29T00:15:22Z theseb: http://www.cse.sc.edu/~mgv/csce531sp07/jmc.pdf 2014-11-29T00:35:39Z jumblerg quit (Quit: My Mac has gone to sleep. ZZZzzz…) 2014-11-29T00:35:44Z mdibound joined #scheme 2014-11-29T00:36:31Z fizzie: SRFI 1 calls it zip too. 2014-11-29T00:37:13Z fizzie: "zip clist1 clist2 ... -> list: (lambda lists (apply map list lists))" http://srfi.schemers.org/srfi-1/srfi-1.html#Miscellaneous 2014-11-29T00:41:18Z fizzie: Though you could argue that a "normal" zip would only take two lists and return pairs instead of lists. (The operation that takes a list of lists, and returns a list of lists of corresponding elements from each of the lists is sometimes called "transpose". At least that's the Haskell name for it.) 2014-11-29T00:47:49Z phipes quit (Read error: Connection reset by peer) 2014-11-29T00:58:23Z jeapostrophe joined #scheme 2014-11-29T01:01:53Z adu joined #scheme 2014-11-29T01:02:30Z BitPuffin joined #scheme 2014-11-29T01:05:48Z adu quit (Client Quit) 2014-11-29T01:06:35Z annodomini joined #scheme 2014-11-29T01:06:41Z annodomini quit (Client Quit) 2014-11-29T01:29:35Z xyh joined #scheme 2014-11-29T01:38:20Z xyh quit (Remote host closed the connection) 2014-11-29T01:43:39Z sstrickl left #scheme 2014-11-29T01:46:11Z adu joined #scheme 2014-11-29T01:57:01Z jumblerg joined #scheme 2014-11-29T02:05:57Z davexunit quit (Quit: Later) 2014-11-29T02:07:13Z TheCommieDuck quit (Read error: Connection reset by peer) 2014-11-29T02:08:31Z davexunit joined #scheme 2014-11-29T02:26:12Z xyh joined #scheme 2014-11-29T02:31:24Z tobik quit (Ping timeout: 265 seconds) 2014-11-29T02:32:21Z tobik joined #scheme 2014-11-29T02:38:14Z excelsior joined #scheme 2014-11-29T02:46:05Z Khisanth quit (Ping timeout: 264 seconds) 2014-11-29T02:48:10Z Khisanth joined #scheme 2014-11-29T02:50:10Z teleScope joined #scheme 2014-11-29T02:52:30Z araujo quit (Quit: Leaving) 2014-11-29T02:55:28Z acarrico joined #scheme 2014-11-29T02:57:52Z BitPuffin quit (Ping timeout: 240 seconds) 2014-11-29T03:03:17Z acarrico quit (Ping timeout: 240 seconds) 2014-11-29T03:09:21Z vinleod quit (Quit: ["Textual IRC Client: www.textualapp.com"]) 2014-11-29T03:19:10Z acarrico joined #scheme 2014-11-29T03:23:30Z xyh quit (Remote host closed the connection) 2014-11-29T03:23:56Z jumblerg quit (Quit: My Mac has gone to sleep. ZZZzzz…) 2014-11-29T03:24:22Z teleScope quit (Ping timeout: 240 seconds) 2014-11-29T03:31:53Z kongtomorrow quit 2014-11-29T03:32:53Z theseb quit (Quit: Leaving) 2014-11-29T03:40:02Z acarrico quit (Ping timeout: 265 seconds) 2014-11-29T03:44:05Z The joined #scheme 2014-11-29T03:46:22Z oleo__ joined #scheme 2014-11-29T03:47:03Z oleo is now known as Guest27064 2014-11-29T03:48:03Z Guest27064 quit (Ping timeout: 244 seconds) 2014-11-29T03:50:31Z jeapostrophe quit (Ping timeout: 255 seconds) 2014-11-29T03:54:20Z Riastradh: gnomon: Well...did you read any of it? (PoC||GTFO) I mean, I could tell you it's a friendly samizdat periodical about instructional hacking with eighties-era computer magazine advertisements, edited by Pastor Manul Laphroaig. But I'm not sure that tells you more than you already know by now. 2014-11-29T03:58:49Z adu quit (Quit: adu) 2014-11-29T04:01:30Z leo2007 quit (Quit: rcirc on GNU Emacs 25.0.50.1) 2014-11-29T04:07:10Z xyh joined #scheme 2014-11-29T04:17:29Z b4283 joined #scheme 2014-11-29T04:17:45Z offby1: c 2014-11-29T04:17:46Z offby1 rubs chin 2014-11-29T04:29:02Z mdibound quit (Quit: Be back later ...) 2014-11-29T04:29:37Z mdibound joined #scheme 2014-11-29T04:30:26Z kongtomorrow joined #scheme 2014-11-29T04:32:52Z jumblerg joined #scheme 2014-11-29T04:33:57Z mdibound quit (Ping timeout: 240 seconds) 2014-11-29T04:36:22Z xyh quit (Remote host closed the connection) 2014-11-29T04:44:30Z jumblerg quit (Quit: My Mac has gone to sleep. ZZZzzz…) 2014-11-29T04:46:28Z jumblerg joined #scheme 2014-11-29T04:56:33Z jumblerg quit (Quit: My Mac has gone to sleep. ZZZzzz…) 2014-11-29T05:00:43Z b4283 quit (Quit: Konversation terminated!) 2014-11-29T05:03:39Z jumblerg joined #scheme 2014-11-29T05:05:02Z leo2007 joined #scheme 2014-11-29T05:08:56Z b4283 joined #scheme 2014-11-29T05:13:32Z pjb` joined #scheme 2014-11-29T05:14:53Z pjb quit (Ping timeout: 264 seconds) 2014-11-29T05:16:47Z pjb joined #scheme 2014-11-29T05:17:06Z pjb is now known as Guest84771 2014-11-29T05:18:44Z Guest84771 is now known as pjb 2014-11-29T05:18:47Z pjb` quit (Ping timeout: 272 seconds) 2014-11-29T05:30:09Z mdibound joined #scheme 2014-11-29T05:31:44Z daviid joined #scheme 2014-11-29T05:34:33Z mdibound quit (Ping timeout: 255 seconds) 2014-11-29T05:44:39Z psy quit (Remote host closed the connection) 2014-11-29T05:46:39Z psy joined #scheme 2014-11-29T05:51:12Z jumblerg quit (Quit: My Mac has gone to sleep. ZZZzzz…) 2014-11-29T06:06:46Z alezost joined #scheme 2014-11-29T06:12:19Z jumblerg joined #scheme 2014-11-29T06:15:54Z b4284 joined #scheme 2014-11-29T06:18:11Z b4283 quit (Ping timeout: 255 seconds) 2014-11-29T06:26:31Z frkout_ joined #scheme 2014-11-29T06:28:04Z offby1` joined #scheme 2014-11-29T06:30:37Z dsp__ joined #scheme 2014-11-29T06:30:38Z bars0_ joined #scheme 2014-11-29T06:34:11Z agumonkey_ joined #scheme 2014-11-29T06:37:14Z agumonkey quit (*.net *.split) 2014-11-29T06:37:14Z frkout quit (*.net *.split) 2014-11-29T06:37:14Z _5kg quit (*.net *.split) 2014-11-29T06:37:15Z offby1 quit (*.net *.split) 2014-11-29T06:37:15Z bars0 quit (*.net *.split) 2014-11-29T06:37:15Z dsp quit (*.net *.split) 2014-11-29T06:38:39Z _5kg joined #scheme 2014-11-29T06:49:36Z mdibound joined #scheme 2014-11-29T06:51:19Z daviid quit (Ping timeout: 258 seconds) 2014-11-29T06:54:08Z mdibound quit (Ping timeout: 264 seconds) 2014-11-29T07:03:18Z b4284 quit (Read error: Connection reset by peer) 2014-11-29T07:15:17Z hypermagic quit (Ping timeout: 240 seconds) 2014-11-29T07:19:32Z rszeno joined #scheme 2014-11-29T07:23:59Z jumblerg quit (Quit: My Mac has gone to sleep. ZZZzzz…) 2014-11-29T07:28:51Z hypermagic joined #scheme 2014-11-29T07:29:21Z alezost quit (Remote host closed the connection) 2014-11-29T07:45:26Z alezost joined #scheme 2014-11-29T07:50:53Z kongtomorrow quit 2014-11-29T07:51:49Z The quit (Quit: Leaving) 2014-11-29T07:53:56Z kongtomorrow joined #scheme 2014-11-29T08:04:35Z Vutral quit (Read error: Connection reset by peer) 2014-11-29T08:05:59Z alexey1 joined #scheme 2014-11-29T08:07:50Z kongtomorrow quit 2014-11-29T08:13:56Z jewel quit (Ping timeout: 256 seconds) 2014-11-29T08:20:20Z mdibound joined #scheme 2014-11-29T08:22:24Z Vutral joined #scheme 2014-11-29T08:22:27Z Vutral quit (Excess Flood) 2014-11-29T08:25:05Z mdibound quit (Ping timeout: 264 seconds) 2014-11-29T08:28:05Z nehaljwani quit (Ping timeout: 264 seconds) 2014-11-29T08:31:12Z Vutral joined #scheme 2014-11-29T08:36:42Z alexey1 quit (Remote host closed the connection) 2014-11-29T08:37:49Z ASau` joined #scheme 2014-11-29T08:41:27Z ASau quit (Ping timeout: 272 seconds) 2014-11-29T08:58:48Z rszeno quit (Quit: Leaving.) 2014-11-29T09:08:13Z alexey1 joined #scheme 2014-11-29T09:09:16Z oleo__ quit (Quit: Verlassend) 2014-11-29T09:16:48Z kongtomorrow joined #scheme 2014-11-29T09:17:56Z bjz joined #scheme 2014-11-29T09:30:52Z oleo joined #scheme 2014-11-29T09:31:06Z leo2007 quit (Quit: rcirc on GNU Emacs 25.0.50.1) 2014-11-29T09:33:39Z vukcrni quit (Read error: Connection reset by peer) 2014-11-29T09:38:34Z vukcrni joined #scheme 2014-11-29T09:51:57Z leppie quit (Ping timeout: 240 seconds) 2014-11-29T09:56:54Z leppie joined #scheme 2014-11-29T10:06:34Z fikusz quit (Quit: Leaving) 2014-11-29T10:08:49Z fikusz joined #scheme 2014-11-29T10:09:04Z mdibound joined #scheme 2014-11-29T10:11:06Z BitPuffin joined #scheme 2014-11-29T10:13:55Z mdibound quit (Ping timeout: 272 seconds) 2014-11-29T10:15:47Z alexey1 quit (Remote host closed the connection) 2014-11-29T10:20:27Z kongtomorrow quit 2014-11-29T10:25:06Z amgarchIn9 joined #scheme 2014-11-29T10:32:31Z Vutral quit (Excess Flood) 2014-11-29T10:44:09Z Vutral joined #scheme 2014-11-29T10:45:52Z BitPuffin quit (Ping timeout: 240 seconds) 2014-11-29T11:01:30Z oldskirt joined #scheme 2014-11-29T11:05:04Z oldskirt_ quit (Ping timeout: 256 seconds) 2014-11-29T11:13:17Z pnpuff joined #scheme 2014-11-29T11:15:44Z amgarchIn9 quit (Ping timeout: 264 seconds) 2014-11-29T11:19:33Z pnpuff quit (Quit: Lost terminal) 2014-11-29T11:39:47Z mdibound joined #scheme 2014-11-29T11:43:54Z mdibound quit (Ping timeout: 244 seconds) 2014-11-29T11:48:03Z jeapostrophe joined #scheme 2014-11-29T11:49:29Z oldskirt_ joined #scheme 2014-11-29T11:49:29Z oldskirt_ quit (Changing host) 2014-11-29T11:49:29Z oldskirt_ joined #scheme 2014-11-29T11:51:22Z benaiah quit (Ping timeout: 240 seconds) 2014-11-29T11:53:11Z oldskirt quit (Ping timeout: 252 seconds) 2014-11-29T12:02:51Z benaiah joined #scheme 2014-11-29T12:03:52Z twem2 quit (Ping timeout: 240 seconds) 2014-11-29T12:09:40Z benaiah quit (Ping timeout: 256 seconds) 2014-11-29T12:10:23Z benaiah joined #scheme 2014-11-29T12:10:33Z alexey1 joined #scheme 2014-11-29T12:11:27Z BitPuffin joined #scheme 2014-11-29T12:14:46Z benaiah quit (Ping timeout: 256 seconds) 2014-11-29T12:21:05Z b4285 joined #scheme 2014-11-29T12:23:49Z ASau` is now known as ASau 2014-11-29T12:26:59Z alexey1 quit (Remote host closed the connection) 2014-11-29T12:32:47Z benaiah joined #scheme 2014-11-29T12:42:12Z jeapostrophe quit (Ping timeout: 250 seconds) 2014-11-29T12:46:35Z excelsior quit (Quit: leaving) 2014-11-29T12:49:57Z daviid joined #scheme 2014-11-29T13:02:15Z davexunit quit (Remote host closed the connection) 2014-11-29T13:04:56Z alexey1 joined #scheme 2014-11-29T13:06:38Z davexunit joined #scheme 2014-11-29T13:14:16Z hiroaki joined #scheme 2014-11-29T13:22:51Z Riastradh quit (Ping timeout: 250 seconds) 2014-11-29T13:24:43Z Riastradh joined #scheme 2014-11-29T13:27:15Z civodul joined #scheme 2014-11-29T13:28:08Z BitPuffin quit (Ping timeout: 250 seconds) 2014-11-29T13:28:32Z mdibound joined #scheme 2014-11-29T13:32:55Z mdibound quit (Ping timeout: 244 seconds) 2014-11-29T13:38:29Z jeapostrophe joined #scheme 2014-11-29T13:38:29Z jeapostrophe quit (Changing host) 2014-11-29T13:38:29Z jeapostrophe joined #scheme 2014-11-29T13:42:26Z hiroaki quit (Ping timeout: 250 seconds) 2014-11-29T13:43:59Z taylanub quit (Disconnected by services) 2014-11-29T13:44:31Z taylanub joined #scheme 2014-11-29T13:52:59Z hiroaki joined #scheme 2014-11-29T13:55:05Z alexey1 quit (Remote host closed the connection) 2014-11-29T14:01:07Z hiroaki quit (Ping timeout: 265 seconds) 2014-11-29T14:14:13Z jeapostrophe quit (Ping timeout: 255 seconds) 2014-11-29T14:29:19Z mdibound joined #scheme 2014-11-29T14:34:20Z mdibound quit (Ping timeout: 264 seconds) 2014-11-29T14:36:00Z rc- joined #scheme 2014-11-29T14:36:53Z bbowes joined #scheme 2014-11-29T14:50:53Z bbowes left #scheme 2014-11-29T14:57:21Z civodul quit (Quit: ERC Version 5.3 (IRC client for Emacs)) 2014-11-29T15:02:23Z oldskirt joined #scheme 2014-11-29T15:05:17Z oldskirt_ quit (Ping timeout: 240 seconds) 2014-11-29T15:06:27Z araujo joined #scheme 2014-11-29T15:10:16Z jeapostrophe joined #scheme 2014-11-29T15:10:23Z jeapostrophe quit (Changing host) 2014-11-29T15:10:23Z jeapostrophe joined #scheme 2014-11-29T15:14:18Z b4285 quit (Ping timeout: 250 seconds) 2014-11-29T15:15:33Z Nshag quit (Read error: Connection reset by peer) 2014-11-29T15:15:36Z jeapostrophe quit (Ping timeout: 250 seconds) 2014-11-29T15:15:53Z jeapostrophe joined #scheme 2014-11-29T15:15:53Z jeapostrophe quit (Changing host) 2014-11-29T15:15:53Z jeapostrophe joined #scheme 2014-11-29T15:16:06Z Nshag joined #scheme 2014-11-29T15:22:18Z b4285 joined #scheme 2014-11-29T15:29:03Z acarrico joined #scheme 2014-11-29T15:30:03Z mdibound joined #scheme 2014-11-29T15:34:41Z mdibound quit (Ping timeout: 264 seconds) 2014-11-29T15:36:08Z acarrico quit (Ping timeout: 264 seconds) 2014-11-29T15:37:46Z alezost quit (Quit: ERC Version 5.3 (IRC client for Emacs)) 2014-11-29T15:37:54Z rc- quit (Quit: leaving) 2014-11-29T15:39:37Z rc- joined #scheme 2014-11-29T15:52:56Z oleo__ joined #scheme 2014-11-29T15:53:33Z alezost joined #scheme 2014-11-29T15:53:36Z oleo is now known as Guest99591 2014-11-29T15:54:10Z Guest99591 quit (Ping timeout: 250 seconds) 2014-11-29T16:01:40Z mdibound joined #scheme 2014-11-29T16:05:17Z Vutral quit (Ping timeout: 245 seconds) 2014-11-29T16:08:18Z oleo__ quit (Quit: Verlassend) 2014-11-29T16:08:54Z lazyden joined #scheme 2014-11-29T16:10:13Z lazyden quit (Client Quit) 2014-11-29T16:10:39Z lazyden joined #scheme 2014-11-29T16:15:56Z ijp joined #scheme 2014-11-29T16:18:28Z oleo__ joined #scheme 2014-11-29T16:22:36Z pjdelport quit (Quit: Connection closed for inactivity) 2014-11-29T16:24:29Z Vutral joined #scheme 2014-11-29T16:26:31Z psy quit (Quit: Leaving) 2014-11-29T16:30:30Z mdibound quit (Quit: Be back later ...) 2014-11-29T16:38:17Z Bahman joined #scheme 2014-11-29T16:38:58Z oleo__ is now known as oleo 2014-11-29T16:40:55Z lazyden quit (Quit: lazyden) 2014-11-29T16:41:40Z lazyden joined #scheme 2014-11-29T16:44:58Z daviid quit (Ping timeout: 255 seconds) 2014-11-29T16:50:32Z kazimir42 joined #scheme 2014-11-29T16:53:53Z jeapostrophe quit (Ping timeout: 264 seconds) 2014-11-29T16:54:57Z jeapostrophe joined #scheme 2014-11-29T16:55:59Z lazyden quit (Quit: lazyden) 2014-11-29T16:58:03Z lazyden joined #scheme 2014-11-29T17:00:02Z jeapostrophe quit (Ping timeout: 250 seconds) 2014-11-29T17:03:23Z Vutral quit (Ping timeout: 252 seconds) 2014-11-29T17:05:43Z theseb joined #scheme 2014-11-29T17:06:04Z Vutral joined #scheme 2014-11-29T17:08:10Z theseb: please explain difference between (not ,(first args)) and ,(not (first args)) in a macro.....trying to get a sense of what moving COMMA does 2014-11-29T17:09:17Z MichaelRaskin: The difference is whether the not occurs in run-time or in expand-time 2014-11-29T17:09:32Z ijp: theseb: the form after a comma in a quasiquotation is evaluted before being inserted into the output 2014-11-29T17:09:49Z MichaelRaskin: I.e. if you (first args) is a variable name, the second will expand just to #f 2014-11-29T17:09:53Z ijp: rudybot: `(2 + 2 = ,(+ 2 2)) 2014-11-29T17:09:54Z rudybot: ijp: your sandbox is ready 2014-11-29T17:09:54Z rudybot: ijp: ; Value: '(2 + 2 = 4) 2014-11-29T17:10:12Z theseb: ug...i know what you are both saying....i just can't see it in my brain that fast.....dunno if one develop an intuition for this stuff 2014-11-29T17:10:33Z theseb: thanks btw 2014-11-29T17:13:48Z offby1` is now known as offby1 2014-11-29T17:13:48Z offby1 quit (Changing host) 2014-11-29T17:13:48Z offby1 joined #scheme 2014-11-29T17:17:17Z lazyden quit (Quit: lazyden) 2014-11-29T17:17:46Z lazyden joined #scheme 2014-11-29T17:18:32Z scoofy: what do these different quoting modes mean? ` ' , 2014-11-29T17:18:42Z lazyden quit (Client Quit) 2014-11-29T17:19:00Z ijp: scoofy: ' means "don't evaluate". ` means "don't evaluate, unless it follows a ," 2014-11-29T17:19:28Z scoofy: so ,`(...) equals (...) ? 2014-11-29T17:20:03Z ijp: scoofy: not quite, (+ 3 3) is 6, '(+ 3 3) and `(+ 3 3) are lists of three items 2014-11-29T17:20:03Z MichaelRaskin: Only inside ` 2014-11-29T17:20:24Z MichaelRaskin: `,(..) is always the same as (..) 2014-11-29T17:20:50Z scoofy: so '(...) means "literal" (no evaluation) 2014-11-29T17:20:55Z MichaelRaskin: ,`(+ 2 3) should be a syntax error 2014-11-29T17:21:00Z scoofy: '(+ 3 3) means (+ 3 3) 2014-11-29T17:21:02Z scoofy: so far corretc?? 2014-11-29T17:21:19Z ijp: depends what you think means means 2014-11-29T17:21:45Z scoofy: i think the ascii characters '(', '+', ' ', '3', ' ' , '3', ')' 2014-11-29T17:21:46Z ijp: '(+ 3 3) is a list, you can car it, cdr it, take its length, etc. (+ 3 3) is six 2014-11-29T17:22:04Z scoofy: but before parsint, it is a sequence of ascii characters 2014-11-29T17:22:06Z scoofy: parsing 2014-11-29T17:22:22Z scoofy: so ... '(+ 3 3) treats it as a string of chars, or it parses it to binary tree, without evaluation? 2014-11-29T17:22:23Z ijp: '(lambda (x) x) is a list, (lambda (x) x) is the identity function 2014-11-29T17:22:41Z ijp: '(let ((x 10)) (+ x x)) is a list, (let ((x 10)) (+ x x)) is 20 2014-11-29T17:22:45Z scoofy: ok, got that, but 'list' can mean various things 2014-11-29T17:22:59Z ijp: scoofy: it is a list at run time which you can car, cdr, take the length of 2014-11-29T17:23:08Z ijp: it is not code, but data 2014-11-29T17:23:21Z scoofy: i'm asking about representation, if that list is represented as string of chars, or it is parsed into a binary tree with its car, cdr etc. records 2014-11-29T17:23:36Z scoofy: ok, so it's parsed but not evaluated 2014-11-29T17:24:14Z scoofy: how can I quote "(+ 3 3)", that is , the sequence of ASCII characters (, +, ' ', +, 3, ' ', 3, ) ? 2014-11-29T17:24:39Z ijp: "(+ 3 3)" is the string with those ascii characters 2014-11-29T17:24:46Z scoofy: so "" is regular quoting 2014-11-29T17:24:55Z scoofy: and '(...) is 'parse, but don't eval' quoting 2014-11-29T17:25:12Z ijp: scoofy: quote is a term of art here 2014-11-29T17:25:31Z scoofy: well, i'm just trying to understand all these various forms of quoting lisp has 2014-11-29T17:25:42Z ijp: I wouldn't call "" quoting 2014-11-29T17:25:50Z scoofy: what do you call that 2014-11-29T17:25:52Z ijp: it's a string 2014-11-29T17:26:36Z scoofy: well, in other languages, that's called "string quoting" 2014-11-29T17:27:26Z scoofy: are there any substitutions done inside a "..." string? or it is always taken as literal 2014-11-29T17:27:31Z ijp: always literal 2014-11-29T17:27:37Z scoofy: how do you quote a quote? 2014-11-29T17:27:47Z ijp: ''foo 2014-11-29T17:27:48Z scoofy: sorry, how do you put a quote mark inside a string? 2014-11-29T17:27:53Z ijp: "'" 2014-11-29T17:28:15Z scoofy: so "this is a 'quoted' string" means --> this is a "quoted" string 2014-11-29T17:28:16Z scoofy: ? 2014-11-29T17:28:19Z ijp: oh right "\"" 2014-11-29T17:28:34Z scoofy: ok. do \n, \t, \r also work? 2014-11-29T17:28:37Z ijp: depends 2014-11-29T17:28:41Z ijp: usually 2014-11-29T17:28:41Z scoofy: i see. 2014-11-29T17:29:27Z scoofy: so '(+ 3 3) creates a binary tree, each with it's car and cdr records 2014-11-29T17:29:38Z scoofy: the 'car' of this is '+ ? 2014-11-29T17:29:43Z scoofy: or how do you represent it 2014-11-29T17:29:53Z ijp: '+ isn't a list 2014-11-29T17:29:58Z scoofy: why 2014-11-29T17:30:00Z ijp: it's a symboo 2014-11-29T17:30:03Z scoofy: can't a list be a single element list? 2014-11-29T17:30:15Z scoofy: what happens to a symbol if you put it into an empty list 2014-11-29T17:30:16Z ijp: scoofy: a single element list looks like '(foo) 2014-11-29T17:30:24Z ijp: scoofy: then it wouldn't be empty? 2014-11-29T17:30:29Z taylanub: scoofy: 'foo for any "foo" is just an abbreviation for (quote foo). like '(foo bar baz) is actually (quote (foo bar baz)), etc. 2014-11-29T17:31:00Z scoofy: so, you mean '(...) is actually translated by the parser to (quote (...)) ? 2014-11-29T17:31:20Z mdibound joined #scheme 2014-11-29T17:31:20Z ijp: rudybot: ''''(foo) 2014-11-29T17:31:21Z rudybot: ijp: ; Value: ''''(foo) 2014-11-29T17:31:27Z ijp: well, that backfired 2014-11-29T17:32:17Z taylanub: scoofy: s-expressions (the "parenthesis syntax") are actually a stand-alone data format, like JSON or XML, with no intrinsic meaning to it other than its structure; say: (cat (name "Johnny") (color blue) (fur-length (centimeters 20))). however, if the structure conforms to the rules of lisp, the data structure can be passed to an 'evaluator' (interpreter, compiler, whatever) and will gain meaning 2014-11-29T17:32:18Z taylanub: as program code. 2014-11-29T17:32:23Z ijp: rudybot: (let ((quote (lambda (x) (+ x x)))) '10) 2014-11-29T17:32:23Z rudybot: ijp: ; Value: 20 2014-11-29T17:32:23Z taylanub: and the rules of lisp include that, when a part of the structure looks like (quote ), then it *doesn't* evaluate any of the part, which could be an arbitrarily large sub-structure. 2014-11-29T17:32:38Z taylanub: (copypaste from the other day. tell me if this explanation is overly complicated or something.) 2014-11-29T17:32:39Z ijp: scoofy: basically, or ^^ wouldn't work 2014-11-29T17:33:01Z scoofy: sure. that's clear. 2014-11-29T17:33:18Z scoofy: that's similar to block quoting in tcl using {...} 2014-11-29T17:33:29Z scoofy: except the representation there is different (not a binary tree) 2014-11-29T17:33:38Z scoofy: but it skips evaluation 2014-11-29T17:34:28Z scoofy: so... i think '(...) is clear. now what are the `(...) and ,`(...) stuff? 2014-11-29T17:34:42Z scoofy: and the other 'predator symbols'? :) 2014-11-29T17:35:04Z ijp: scoofy: the last one doesn't make any sense 2014-11-29T17:35:15Z ijp: but as already discussed, ` is selective quoting 2014-11-29T17:35:16Z scoofy: why> 2014-11-29T17:35:21Z scoofy: yea, but what does that mean 2014-11-29T17:35:24Z scoofy: I don't understand 2014-11-29T17:35:44Z ijp: rudybot: `(not evaluated: (+ 1 1) evaluated: ,(+ 1 1)) 2014-11-29T17:35:44Z rudybot: ijp: ; Value: '(not evaluated: (+ 1 1) evaluated: 2) 2014-11-29T17:35:49Z mdibound quit (Ping timeout: 255 seconds) 2014-11-29T17:36:25Z scoofy: hm... so inside a `(...) block, you can evaluate a sub-block by writing ,(...) ? 2014-11-29T17:36:32Z ijp: yes 2014-11-29T17:36:35Z scoofy: ok, clear 2014-11-29T17:36:36Z taylanub: "`foo" = (quasiquote foo), and ",foo" = (unquote foo). quasiquote is a macro which is like quote (i.e. '), but goes through its given sub-structure seeking for two-element lists whose first element is 'unquote' and evaluates the second element, substituting it for the whole (unquote foo). 2014-11-29T17:36:49Z scoofy: pretty weird syntax, but i understand it 2014-11-29T17:37:18Z taylanub: (it's noteworthy that 'unquote' is not a macro; it's just a "keyword" of sorts which 'quasiquote' scans for.) 2014-11-29T17:37:22Z scoofy: in tcl, '(...) would be written as {...}. and `(... ,(xyz) ...) would be written as "... [xyz] ..." 2014-11-29T17:37:26Z ijp: taylanub: well.... 2014-11-29T17:37:47Z ijp: ...it often is, so you get an error when it is used outside a ` 2014-11-29T17:38:05Z taylanub: indeed 2014-11-29T17:38:39Z scoofy: rudybot: '(xyz ,(+ 1 1)) 2014-11-29T17:38:40Z rudybot: scoofy: your sandbox is ready 2014-11-29T17:38:40Z rudybot: scoofy: ; Value: '(xyz ,(+ 1 1)) 2014-11-29T17:39:00Z taylanub: 'quote' doesn't care about any 'unquote'; it's absolute. 2014-11-29T17:40:11Z taylanub: by the way I dislike it how rudybot shows results as code snippets ... only makes explaining stuff harder 2014-11-29T17:40:34Z offby1: ? 2014-11-29T17:40:35Z scoofy: what would be better? 2014-11-29T17:41:00Z taylanub: it should have just displayed (xyz ,(+ 1 1)) or even (xyz (unquote (+ 1 1))), without the ' at the beginning 2014-11-29T17:41:14Z taylanub: rudybot: `(xyz ,(+ 1 1)) 2014-11-29T17:41:15Z rudybot: taylanub: your sandbox is ready 2014-11-29T17:41:15Z rudybot: taylanub: ; Value: '(xyz 2) 2014-11-29T17:41:26Z scoofy: no, it was fine, i understood what it did 2014-11-29T17:41:38Z scoofy: -> nothing, as the whole thing was quoted with '(...) 2014-11-29T17:41:38Z MichaelRaskin: rudybot: 1 2014-11-29T17:41:39Z rudybot: MichaelRaskin: your sandbox is ready 2014-11-29T17:41:39Z rudybot: MichaelRaskin: ; Value: 1 2014-11-29T17:41:55Z offby1: taylanub: that might actually be possible 2014-11-29T17:42:08Z scoofy: but, interesting that ` turned into ' after the internal evaluation 2014-11-29T17:42:17Z scoofy: so... `(+ 3 3) makes no sense? 2014-11-29T17:42:21Z scoofy: is that not valid? 2014-11-29T17:42:31Z offby1: rudybot: `(+ 3 3) 2014-11-29T17:42:32Z rudybot: *offby1: your sandbox is ready 2014-11-29T17:42:32Z rudybot: *offby1: ; Value: '(+ 3 3) 2014-11-29T17:42:52Z offby1: it only makes no sense in that you _could_ have written it wth ' instead of ` 2014-11-29T17:42:55Z scoofy: ok, it just evals to '(+ 3 3) 2014-11-29T17:43:00Z taylanub: scoofy: it doesn't "turn" into '. that's just rudybot being stupid (IMO) and showing the result as a theoretical code snippet that evaluates to the same result 2014-11-29T17:43:02Z offby1: generally you only use ` if you're also using , or @, 2014-11-29T17:43:16Z scoofy: @ ? what is @ 2014-11-29T17:43:22Z scoofy: @, 2014-11-29T17:43:23Z offby1: that's a "Strudel" 2014-11-29T17:43:27Z offby1: a delicious dessert 2014-11-29T17:43:28Z scoofy: never heard of. 2014-11-29T17:43:30Z taylanub: rudybot: `(foo ,@(list 'one 'two 'three) bar) 2014-11-29T17:43:30Z rudybot: taylanub: ; Value: '(foo one two three bar) 2014-11-29T17:43:33Z MichaelRaskin: rudybot: `(1 2 3 ,@(list 4 5 )) 2014-11-29T17:43:33Z rudybot: MichaelRaskin: ; Value: '(1 2 3 4 5) 2014-11-29T17:43:35Z taylanub: rudybot: `(foo ,(list 'one 'two 'three) bar) 2014-11-29T17:43:36Z rudybot: taylanub: ; Value: '(foo (one two three) bar) 2014-11-29T17:43:58Z offby1: ` and , and ,@ are basically a simple but handy templating system. 2014-11-29T17:44:00Z scoofy: ok, got it 2014-11-29T17:44:06Z scoofy: i think it's the same as {*} in tcl 2014-11-29T17:44:11Z offby1: could be 2014-11-29T17:44:13Z scoofy: take list as literal sequence of elements 2014-11-29T17:44:14Z scoofy: is that? 2014-11-29T17:44:19Z taylanub: yeah 2014-11-29T17:44:22Z scoofy: ok, got it 2014-11-29T17:44:35Z taylanub: rudybot: `(foo ,@(+ 1 2)) 2014-11-29T17:44:35Z rudybot: taylanub: ; Value: '(foo . 3) 2014-11-29T17:44:40Z scoofy: rudybot: ,@(list 1 2 3) 2014-11-29T17:44:42Z taylanub: huh .. expected an error, but whatever 2014-11-29T17:44:42Z rudybot: scoofy: your sandbox is ready 2014-11-29T17:44:42Z rudybot: scoofy: error: eval:1:0: unquote-splicing: not in quasiquote in: (unquote-splicing (list 1 2 3)) 2014-11-29T17:44:52Z scoofy: why the error? 2014-11-29T17:45:07Z offby1: In lisp terms (I think), in TCL most arguments are unevaluated, and you have to explicitly ask to have them evaluated 2014-11-29T17:45:08Z offby1: I think 2014-11-29T17:45:20Z taylanub: because 'unquote-splicing' (i.e. what ,@ turns into) is not a valid function or macro; only a "keyword" of sorts which the 'quasiquote' macro scans for. 2014-11-29T17:45:36Z MichaelRaskin: rudybot: ,1 2014-11-29T17:45:36Z rudybot: MichaelRaskin: error: eval:1:0: unquote: not in quasiquote in: (unquote 1) 2014-11-29T17:45:41Z scoofy: offby1, well... i think they're similar, but with a different syntax 2014-11-29T17:46:00Z scoofy: taylanub, so ,@ is only valid inside `( ... ) 2014-11-29T17:46:09Z scoofy: `(,@(list 1 3 3)) 2014-11-29T17:46:13Z scoofy: rudybot: `(,@(list 1 3 3)) 2014-11-29T17:46:14Z rudybot: scoofy: ; Value: '(1 3 3) 2014-11-29T17:46:27Z taylanub: ,@foo is literally the same thing as (unquote-splicing foo), and 'unquote-splicing' is not a valid macro or function. (of course, you could bind it to one.) 2014-11-29T17:47:14Z taylanub: rudybot: (let ((unquote (lambda (x) (+ x 1)))) ,5) 2014-11-29T17:47:14Z rudybot: taylanub: ; Value: 6 2014-11-29T17:47:18Z b4285 quit (Quit: Konversation terminated!) 2014-11-29T17:47:23Z taylanub: rudybot: (let ((unquote-splicing (lambda (x) (+ x 1)))) ,@5) 2014-11-29T17:47:24Z rudybot: taylanub: ; Value: 6 2014-11-29T17:47:47Z taylanub: don't ever do that in real code, of course. it's one of the few dirty corners of Scheme. 2014-11-29T17:47:53Z taylanub: (that this works like this) 2014-11-29T17:48:09Z scoofy: what i find interesting, is that in tcl, {*} works anywhere, not just inside quotes (that does the same thing) 2014-11-29T17:48:16Z scoofy: as ,@ 2014-11-29T17:48:19Z ijp: well, scheme isn't tcl 2014-11-29T17:48:28Z scoofy: obviously. 2014-11-29T17:48:45Z taylanub: rudybot: (equal? (apply + (list 1 2 3)) (+ 1 2 3)) 2014-11-29T17:48:46Z rudybot: taylanub: ; Value: #t 2014-11-29T17:48:53Z scoofy: but one language out of the two, made that a syntax construct in the language 2014-11-29T17:48:56Z scoofy: the other solves it with macros 2014-11-29T17:49:15Z ijp: well, ' is a "syntax construct in the language" 2014-11-29T17:49:25Z ijp: you can't create it from other parts 2014-11-29T17:49:30Z scoofy: i'm speaking about {*} vs. `( ,@ ) 2014-11-29T17:50:00Z scoofy: that ,@ works only inside `( ... ), whereas (in tcl) {*} works anywhere, not just inside quotes 2014-11-29T17:50:27Z taylanub: what does this {*} even do when not inside some kind of quoting? 2014-11-29T17:50:39Z scoofy: return literal list of elements 2014-11-29T17:51:09Z taylanub: eh? that sounds more like 'quote'. 2014-11-29T17:51:32Z scoofy: say... proc cmd {args} {anothercmd {*}$args} 2014-11-29T17:51:49Z scoofy: args is a list, and {*} passes those arguments to another command 2014-11-29T17:52:26Z mdibound joined #scheme 2014-11-29T17:52:26Z taylanub: that needn't be part of the syntax; see my usage of 'apply' above. I anticipated it would be this... 2014-11-29T17:52:33Z scoofy: well, { } itself is a quote, but similar to '(...) 2014-11-29T17:52:37Z mdibound quit (Client Quit) 2014-11-29T17:53:59Z taylanub: rudybot: (define (cmd . args) (apply anothercmd args)) (define (anothercmd x y) (* x y)) (cmd 2 3) 2014-11-29T17:54:00Z rudybot: taylanub: "s-" is cmd? 2014-11-29T17:54:08Z taylanub: rudybot: (let () (define (cmd . args) (apply anothercmd args)) (define (anothercmd x y) (* x y)) (cmd 2 3)) 2014-11-29T17:54:09Z rudybot: taylanub: ; Value: 6 2014-11-29T17:55:10Z scoofy: how do you call 'anothercmd' with (apply) ? why is it not (anothercmd ...) 2014-11-29T17:55:37Z psy joined #scheme 2014-11-29T17:56:45Z scoofy: hm, ok, i think i get 2014-11-29T17:57:20Z taylanub: when 'cmd' is called, the arguments 2 and 3 are filled into the list 'args'. this happens at run-time, where syntax is long gone, so we can't put the elements of that run-time list into a syntax list like (anothercmd arg1 arg2), therefore we need a run-time construct to do such things, which is 'apply'. it's a function that applies a given function to a (run-time-)list of arguments. 2014-11-29T17:57:44Z taylanub: a clean separation of compile-time syntax, and run-time data. 2014-11-29T17:57:48Z scoofy: so (x . y) is a way of separating 'head' and 'rest' of the list? 2014-11-29T17:58:12Z scoofy: or that's what it refers to in the cmd definition 2014-11-29T17:58:17Z taylanub: (x . y) is a piece of s-expression data; it's a pair whose left element is x and its right element y. 2014-11-29T17:58:39Z scoofy: but the right element y is usually a sub-tree? 2014-11-29T17:58:51Z taylanub: the 'define' special form accepts usage of pairs (or improper lists) to define a function which receives a variable-length list of arguments. 2014-11-29T17:58:53Z scoofy: so (x . y . z) is how a 3 element list is represented 2014-11-29T17:59:05Z taylanub: no, (x . (y . (z . ()))) 2014-11-29T17:59:06Z scoofy: i see. 2014-11-29T17:59:20Z scoofy: () is always the end element? is that called NIL 2014-11-29T17:59:21Z scoofy: ? 2014-11-29T17:59:31Z taylanub: null, or the empty list. 2014-11-29T17:59:35Z scoofy: rudybot: (x . (y . (z . ()))) 2014-11-29T17:59:36Z rudybot: scoofy: error: x: undefined; cannot reference an identifier before its definition in module: 'program 2014-11-29T18:00:10Z taylanub: you need to quote that, else it's equivalent to (x y z) meaning it will try to reference those as variables (and call the value of x (a function) on the vaules of y and z) 2014-11-29T18:00:16Z taylanub: (or x could be the name of a macro) 2014-11-29T18:00:41Z scoofy: ok, thanks all the explanations 2014-11-29T18:00:46Z scoofy: i learned a lot 2014-11-29T18:01:34Z scoofy: brb 2014-11-29T18:05:33Z taylanub: for people who are already programmers I wrote http://taylanub.github.io/doc/lisp-rundown.txt some time, might be helpful too. mostly the same stuff we just went through though. 2014-11-29T18:06:16Z jeapostrophe joined #scheme 2014-11-29T18:06:16Z jeapostrophe quit (Changing host) 2014-11-29T18:06:16Z jeapostrophe joined #scheme 2014-11-29T18:10:36Z scoofy: i'll check out. 2014-11-29T18:10:56Z jeapostrophe quit (Ping timeout: 264 seconds) 2014-11-29T18:11:58Z leppie quit (Ping timeout: 265 seconds) 2014-11-29T18:27:09Z psy quit (Remote host closed the connection) 2014-11-29T18:34:07Z pjdelport joined #scheme 2014-11-29T18:42:09Z superjudge quit (Ping timeout: 256 seconds) 2014-11-29T18:43:20Z eagleflo quit (Ping timeout: 264 seconds) 2014-11-29T18:43:38Z eagleflo joined #scheme 2014-11-29T18:44:09Z superjudge joined #scheme 2014-11-29T18:48:09Z jeapostrophe joined #scheme 2014-11-29T18:48:09Z jeapostrophe quit (Changing host) 2014-11-29T18:48:09Z jeapostrophe joined #scheme 2014-11-29T18:50:32Z ASau quit (Ping timeout: 264 seconds) 2014-11-29T18:53:27Z mdibound joined #scheme 2014-11-29T18:56:35Z Khisanth quit (Quit: Leaving) 2014-11-29T18:57:54Z mdibound quit (Ping timeout: 250 seconds) 2014-11-29T18:58:09Z Khisanth joined #scheme 2014-11-29T18:58:56Z adu joined #scheme 2014-11-29T18:59:13Z adu quit (Client Quit) 2014-11-29T19:00:17Z jeapostrophe quit (Ping timeout: 240 seconds) 2014-11-29T19:01:16Z Vutral quit (Ping timeout: 265 seconds) 2014-11-29T19:06:02Z BitPuffin joined #scheme 2014-11-29T19:08:03Z Vutral joined #scheme 2014-11-29T19:12:57Z ASau joined #scheme 2014-11-29T19:18:53Z psy joined #scheme 2014-11-29T19:19:01Z jumblerg joined #scheme 2014-11-29T19:24:48Z jewel joined #scheme 2014-11-29T19:27:29Z scoofy: it was said earlier, that at runtime, no functions are called directly. 2014-11-29T19:27:45Z scoofy: but instead, (apply) is used. could someone explain to me, how is this scheme executed? 2014-11-29T19:31:51Z BitPuffin quit (Ping timeout: 258 seconds) 2014-11-29T19:32:48Z leppie joined #scheme 2014-11-29T19:33:43Z pnpuff joined #scheme 2014-11-29T19:36:54Z rszeno joined #scheme 2014-11-29T19:40:27Z BitPuffin joined #scheme 2014-11-29T19:44:15Z amgarchIn9 joined #scheme 2014-11-29T19:47:11Z rszeno quit (Ping timeout: 265 seconds) 2014-11-29T19:51:51Z jumblerg quit (Quit: My Mac has gone to sleep. ZZZzzz…) 2014-11-29T19:53:10Z offby1: sounds like a pedantic distinction 2014-11-29T19:54:14Z mdibound joined #scheme 2014-11-29T19:57:59Z systemovich joined #scheme 2014-11-29T19:58:17Z mdibound quit (Ping timeout: 240 seconds) 2014-11-29T20:07:39Z taylanub: scoofy: "directly" is not a good way of putting it. a list structure like (foo bar baz) is what represents a fixed-arity function-call in sexpr structure. building up such a structure at run-time, to represent a function call, would imply then using 'eval' on the constructed list, which is possible but such a generic/powerful feature that it thwarts optimization and programmer intuition. 2014-11-29T20:08:47Z taylanub: to keep things to "one layer" of evaluation, but still support applying a function to a run-time list of arguments, there is 'apply'. 2014-11-29T20:13:32Z scoofy: does this apply to interpretation, compilation, or both? 2014-11-29T20:14:47Z amgarchIn9 quit (Ping timeout: 252 seconds) 2014-11-29T20:15:34Z alexey1 joined #scheme 2014-11-29T20:16:27Z taylanub: there is generally supposed to be no difference between interpretation and compilation. it makes more sense to just think of "reading," "macro expansion," and "execution" in lisp, however keeping in mind that there can be a time and platform difference between expansion and execution, since if the code is compiled, expansion happens during compilation. 2014-11-29T20:17:04Z scoofy: 'macro expansion' means substitution? how is that different from 'eval' ? 2014-11-29T20:17:18Z taylanub: I once forgot about that and thought it would be neat to make data available at expansion time (since macros can be arbitrary code, they can throw around arbitrary data) also available to execution time... 2014-11-29T20:18:48Z taylanub: scoofy: expansion means turning any macros in the code into raw code. 2014-11-29T20:19:11Z scoofy: how is a 'macro' different from code? 2014-11-29T20:19:28Z scoofy: or what does 'raw' code mean 2014-11-29T20:20:04Z alexey1 quit (Ping timeout: 255 seconds) 2014-11-29T20:20:36Z offby1: a macro is code that runs at compile time 2014-11-29T20:20:42Z offby1: other code runs at run time 2014-11-29T20:21:01Z scoofy: how does that look like in code? 2014-11-29T20:21:08Z scoofy: can you give me an example? 2014-11-29T20:21:28Z offby1: macros can look like anything 2014-11-29T20:21:35Z offby1: (or 1 2) could be a macro 2014-11-29T20:21:36Z taylanub: a macro is a function that takes and returns syntax objects. it's called at expansion time. (define-syntax when (lambda () (syntax-case ((when condition consequent ...) #'(if condition (begin consequent ...)))))). here 'when' is bound, in the "syntax namespace," to a "syntax transformer" function which will be called at expansion time whenever a piece of code like (when x y z) is encountered. 2014-11-29T20:21:37Z scoofy: how to distinguish then 2014-11-29T20:21:56Z offby1: either ask your IDE, or just memorize 'em 2014-11-29T20:22:21Z offby1: good question though 2014-11-29T20:22:24Z ijp: taylanub: spot the three things wrong with that code 2014-11-29T20:22:35Z scoofy: so... i guess the symbol 'when' is put into some symbol tree 2014-11-29T20:22:42Z scoofy: is it represented as a token in the interpreter? 2014-11-29T20:22:59Z ijp: maybe four, but I'd need to doublecheck 2014-11-29T20:23:05Z taylanub: ijp: forgot lambda arg, forgot syntax case obj, forgot list of literals 2014-11-29T20:23:20Z taylanub: let's ignore these for the example :P 2014-11-29T20:23:29Z civodul joined #scheme 2014-11-29T20:23:32Z amgarchIn9 joined #scheme 2014-11-29T20:23:58Z ijp: the fourth one is harder to spot 2014-11-29T20:24:27Z scoofy: so basically this modifies the interpreter state? how does this become a macro in the interpreter that modifies code? 2014-11-29T20:24:33Z taylanub: ijp: begin accepts at least one expression in RnRS, if that's what you mean, so we might get unintuitive error messages 2014-11-29T20:24:43Z taylanub: s/accepts/expects/ 2014-11-29T20:25:10Z taylanub: scoofy: not interpreter. expander. 2014-11-29T20:25:18Z ijp: taylanub: yes, and also when takes 1 or more expressions :) 2014-11-29T20:25:24Z scoofy: so that's like a parser preprocessor? 2014-11-29T20:26:02Z Vutral quit (Ping timeout: 244 seconds) 2014-11-29T20:26:12Z taylanub: scoofy: the transformer I wrote takes e.g. (when x y z), but not as a list but as a syntax object so there's special context-specific information attached to it like what value 'x' is bound to as a variable, then it matches this syntax object against the pattern (when condition consequent ...) where the 'when' is really just decoration because we already know what it is (otherwise we wouldn't have 2014-11-29T20:26:12Z taylanub: been called), and the ellipsis is a special marker saying there can be any number of consequents. 2014-11-29T20:26:42Z scoofy: what does this (when x y z) do? 2014-11-29T20:26:59Z scoofy: 'x' is a condition to test? y = true case, z = false case? 2014-11-29T20:27:48Z taylanub: scoofy: it then outputs (if x (begin y z)), which is our raw code. however, again, it doesn't return that as a list but as a syntax object, where all of 'if', 'x', 'begin', 'y', and 'z' are loaded with the additional information saying what they were bound to in the (when x y z) snippet for x y and z, and what they were bound to during the creation of the macro for if and begin. 2014-11-29T20:28:16Z taylanub: scoofy: it's an if without an else. there can be any number of 'then' (consequent) expressions. 2014-11-29T20:28:23Z scoofy: so that's like substitution of the arguments 2014-11-29T20:29:21Z scoofy: are s-expressions ever represented as trees in practice? 2014-11-29T20:29:37Z scoofy: (instead (of (((parens))))) 2014-11-29T20:30:08Z taylanub: how else would you represent trees in flat text? 2014-11-29T20:30:10Z scoofy: if all objects are like (a . b) pairs, then it could be visualized like a binary tree 2014-11-29T20:30:12Z scoofy: binary tree 2014-11-29T20:30:28Z scoofy: like, how syntax trees are drawn in grammar 2014-11-29T20:30:34Z scoofy: let me try to find an example 2014-11-29T20:30:46Z scoofy: or draw one 2014-11-29T20:30:50Z taylanub: sure could, for educational purposes I guess? 2014-11-29T20:30:54Z scoofy: yep 2014-11-29T20:30:57Z scoofy: a sec, i'll make a sketch 2014-11-29T20:31:08Z taylanub: just google images for "syntax tree" 2014-11-29T20:31:13Z scoofy: something similar that we used to draw in English syntax grammar lessons 2014-11-29T20:31:20Z scoofy: yep, but i want do do it it ascii flat text 2014-11-29T20:31:29Z scoofy: to show how it *actually* looks like in plaintext 2014-11-29T20:31:33Z ijp: I can honestly say I was never made to draw trees in any of my english lessons 2014-11-29T20:31:53Z scoofy: it was in univ 2014-11-29T20:31:56Z offby1 spent a lot of time doodling 2014-11-29T20:32:10Z scoofy: basically they have a 'LISP' way of representing any english grammar 2014-11-29T20:32:17Z scoofy: everything they represent using a binary tree 2014-11-29T20:32:34Z scoofy: so interestingly, essentially it's same as an S-exp, or can be thought of... 2014-11-29T20:34:37Z scoofy: what is the standard variable assignment command in lisp? (if there's one) 2014-11-29T20:34:46Z scoofy: that equals the "x=5;" command in C 2014-11-29T20:35:54Z offby1: rudybot: (define x 3) 2014-11-29T20:35:54Z rudybot: *offby1: your sandbox is ready 2014-11-29T20:35:54Z rudybot: *offby1: Done. 2014-11-29T20:35:58Z offby1: rudybot: x 2014-11-29T20:35:58Z rudybot: *offby1: ; Value: 3 2014-11-29T20:36:02Z offby1: rudybot: (set! x 99) 2014-11-29T20:36:02Z rudybot: *offby1: Done. 2014-11-29T20:36:04Z offby1: rudybot: x 2014-11-29T20:36:04Z rudybot: *offby1: ; Value: 99 2014-11-29T20:36:26Z scoofy: hm... i thought 'define' is only used for functions 2014-11-29T20:36:44Z Vutral joined #scheme 2014-11-29T20:36:54Z offby1: you thought wrong 2014-11-29T20:37:13Z scoofy: indeed 2014-11-29T20:37:13Z ijp: you define a value, and functions are values 2014-11-29T20:37:23Z scoofy: how it that different from 'set!' ? 2014-11-29T20:37:34Z ijp: you can't set! a variable that has not been defined 2014-11-29T20:37:46Z ijp: rudybot: (set! this-variable-does-not-exist 10) 2014-11-29T20:37:47Z rudybot: ijp: your sandbox is ready 2014-11-29T20:37:47Z rudybot: ijp: error: set!: assignment disallowed; cannot set variable before its definition variable: this-variable-does-not-exist in module: 'program 2014-11-29T20:38:49Z offby1: scoofy: I'm not convinced that there's a good reason to have both "define" and "set!" 2014-11-29T20:40:41Z scoofy: so... I made a little plain text sketch of how S-Expressions could be represented in plaintext as binary tree: 2014-11-29T20:40:42Z scoofy: http://morpheus.spectralhead.com/s/s-tree.txt 2014-11-29T20:41:00Z taylanub: offby1: there really is IMO 2014-11-29T20:41:15Z scoofy: there's an element that I named set!*, which is an implied element in set! 2014-11-29T20:41:18Z ijp: there is, once you get rid of the set! behaviour of define 2014-11-29T20:42:23Z systemovich quit (Ping timeout: 245 seconds) 2014-11-29T20:42:24Z scoofy: so... how do you like that textmode syntax tree? 2014-11-29T20:42:34Z taylanub: ... basic? :P 2014-11-29T20:42:44Z taylanub: I don't see the point of set!* 2014-11-29T20:43:10Z scoofy: sorry, that's a mistake I think 2014-11-29T20:43:11Z scoofy: a sec 2014-11-29T20:43:37Z scoofy: yep, you don't need that, please refresh file 2014-11-29T20:43:58Z scoofy: (there are some such bizarre constructs in english binary grammar syntax, but that doesn't apply here) 2014-11-29T20:43:59Z ijp: that representation loses information 2014-11-29T20:44:06Z scoofy: ..namely? 2014-11-29T20:44:16Z scoofy: you can reconstruct it perfectly 2014-11-29T20:44:18Z ijp: how do you tell between a cons of two elements and a list? 2014-11-29T20:44:20Z scoofy: using tree traversal 2014-11-29T20:44:28Z scoofy: if you traverse from the root (set!) 2014-11-29T20:44:28Z ijp: (foo bar . baz) vs (foo bar baz) 2014-11-29T20:44:40Z scoofy: aren't they equivalent? 2014-11-29T20:44:51Z ijp: no 2014-11-29T20:45:18Z scoofy: well, then it's a representation that loses some information, but makes fancy textmode trees anyways 2014-11-29T20:45:33Z scoofy: nothing can be perfect :) 2014-11-29T20:46:26Z scoofy: anyways it could be useful for visualizing where the data flows 2014-11-29T20:46:37Z scoofy: it flows from bottom to top, in this diagram 2014-11-29T20:46:44Z scoofy: instead of, 'from inside to the outside' 2014-11-29T20:47:17Z scoofy: of course you can turn it upside down, and it becomes a tree whose root at the bottom is 'set!' (or whatever it actually is) 2014-11-29T20:47:35Z scoofy: and you have a visualization of the structure as an actual tree. 2014-11-29T20:48:21Z scoofy: would be interesting to make this algorithmically, and test how it looks for large, complex trees 2014-11-29T20:48:38Z pnpuff left #scheme 2014-11-29T20:54:58Z mdibound joined #scheme 2014-11-29T20:55:58Z theseb quit (Quit: Leaving) 2014-11-29T20:59:41Z mdibound quit (Ping timeout: 265 seconds) 2014-11-29T21:01:32Z scoofy: here's an example where a * version is in the binary three: 2014-11-29T21:01:33Z scoofy: http://morpheus.spectralhead.com/s/if.txt 2014-11-29T21:01:45Z scoofy: if has 3 arguments, so you cannot directly represent that in a binary tree 2014-11-29T21:02:11Z kazimir42 quit (Ping timeout: 250 seconds) 2014-11-29T21:06:02Z amgarchIn9 quit (Ping timeout: 244 seconds) 2014-11-29T21:11:45Z amgarchIn9 joined #scheme 2014-11-29T21:14:09Z systemovich joined #scheme 2014-11-29T21:22:04Z adu joined #scheme 2014-11-29T21:28:21Z hiroaki joined #scheme 2014-11-29T21:31:21Z amgarchIn9 quit (Ping timeout: 244 seconds) 2014-11-29T21:31:27Z systemovich quit (Ping timeout: 258 seconds) 2014-11-29T21:37:21Z civodul quit (Quit: ERC Version 5.3 (IRC client for Emacs)) 2014-11-29T21:42:10Z systemovich joined #scheme 2014-11-29T21:53:38Z Vutral quit (Ping timeout: 245 seconds) 2014-11-29T21:55:41Z mdibound joined #scheme 2014-11-29T21:59:54Z mdibound quit (Ping timeout: 245 seconds) 2014-11-29T22:07:31Z Vutral joined #scheme 2014-11-29T22:07:41Z hiroaki quit (Ping timeout: 264 seconds) 2014-11-29T22:09:19Z ManDay joined #scheme 2014-11-29T22:11:49Z ManDay quit (Client Quit) 2014-11-29T22:16:35Z alexey1 joined #scheme 2014-11-29T22:21:22Z alexey1 quit (Ping timeout: 265 seconds) 2014-11-29T22:21:44Z adu quit (Ping timeout: 264 seconds) 2014-11-29T22:41:57Z theseb joined #scheme 2014-11-29T22:46:15Z ManDay joined #scheme 2014-11-29T22:46:54Z ManDay: Can anyone explain to me why that (let) here: 2014-11-29T22:47:06Z ManDay: God dammit 2014-11-29T22:47:45Z ManDay: I can't paste that link into weechat. Incapable X cutbuffer 2014-11-29T22:47:51Z alezost quit (Quit: ERC Version 5.3 (IRC client for Emacs)) 2014-11-29T22:49:02Z ManDay: www.scheme.com/tspl4/further.html#def:or 2014-11-29T22:49:33Z ManDay: What would go wrong if I left out the (let) and simply wrote if e1 e1 ...etc... ? 2014-11-29T22:51:25Z jumblerg joined #scheme 2014-11-29T22:56:30Z ManDay: http://www.scheme.com/tspl4/further.html#defn:or 2014-11-29T22:56:50Z theseb quit (Quit: Leaving) 2014-11-29T22:58:21Z scoofy: is there a way to define "default value" for an argument for a function? 2014-11-29T22:58:41Z scoofy: say (define (add x (n 1)) (+ x n)) where n defaults to 1 2014-11-29T23:00:08Z vraid: racket has that option 2014-11-29T23:01:24Z ManDay: is my question not well posed? 2014-11-29T23:03:13Z ManDay: scoofy: (define add lambda (x . n) (if (?null n) (set! x (+ x 1)) (set! x (+ x n)))) should work 2014-11-29T23:04:37Z vraid: ManDay: which let? 2014-11-29T23:04:56Z vraid: your link doesn't go to any specific section 2014-11-29T23:04:58Z ManDay: vraid: There is a "let" in that code 2014-11-29T23:05:10Z ManDay: http://www.scheme.com/tspl4/further.html#defn:or this one should 2014-11-29T23:05:17Z ManDay: It should point to a code snippet 2014-11-29T23:06:03Z rc- left #scheme 2014-11-29T23:06:37Z scoofy: ManDay, thanks 2014-11-29T23:08:04Z vraid: ManDay: i think they're introducing t just to demonstrate that the macros are hygienic 2014-11-29T23:08:12Z ManDay: vraid: I don't understand. 2014-11-29T23:08:29Z ManDay: I think it has an actual purpose 2014-11-29T23:08:40Z vraid: " even if one of the expressions e2 e3 ... contains a reference to t, the introduced binding for t does not "capture" those references" 2014-11-29T23:08:46Z ManDay: They mention something in the text about something being "captured", but I don't what that means 2014-11-29T23:08:55Z ManDay: vraid: Yes I don't understand their point there 2014-11-29T23:09:04Z vraid: e.g if e2 is defined as t outside of the macro, the t inside does not affect that 2014-11-29T23:09:11Z ManDay: Also, in the paragraph above they mention that it is NEEDED 2014-11-29T23:09:23Z ManDay: vraid: I don't think that's the only point 2014-11-29T23:09:36Z ManDay: They say something about a temp var being needed 2014-11-29T23:09:40Z ManDay: But I don't see why or how 2014-11-29T23:10:36Z vraid: ManDay: ah, i get it now 2014-11-29T23:10:49Z acarrico joined #scheme 2014-11-29T23:11:02Z vraid: binding e1 to t guarantees that the expression is only evaluated once 2014-11-29T23:11:13Z amgarchIn9 joined #scheme 2014-11-29T23:11:42Z ManDay: You mean w.r.t. sideeffects? 2014-11-29T23:11:44Z vraid: this is important in case e1 is an impure function or computationally heavy 2014-11-29T23:12:06Z ManDay: hm 2014-11-29T23:12:24Z ManDay: I don't understand why they don't explain that the way you just did, then 2014-11-29T23:12:38Z ManDay: Nothing up to that point has mentioned sideffects or would suggest that as a reason 2014-11-29T23:13:05Z ManDay: Also "Since there is only one false value #f" doesn't appear to make sense in that case 2014-11-29T23:13:09Z ManDay: What does that mean? 2014-11-29T23:15:46Z vraid: ManDay: and only returns once it has tested *all* values 2014-11-29T23:16:06Z amgarchIn9 quit (Ping timeout: 258 seconds) 2014-11-29T23:16:18Z vraid: in the case of (and e1 e2 e3), the non-false values are not interesting 2014-11-29T23:16:29Z vraid: if e1 and e2 are non-false, the expression evaluates to e3 2014-11-29T23:16:49Z vraid: if e3 is false, the expression is false. if e3 is not false, the expression is still e3 2014-11-29T23:17:01Z taylanub: scoofy: the recent standard way of optional arguments is with `case-lambda': (define add (case-lambda ((x) (add x 1)) ((x n) (+ x n)))) 2014-11-29T23:17:02Z vraid: so it's returned just as it is 2014-11-29T23:17:35Z taylanub: ManDay's code above using a rest-argument list has several issues... 2014-11-29T23:17:44Z vraid: whereas or returns as soon as it encounters a non-false value 2014-11-29T23:18:03Z ManDay: taylanub: such as? 2014-11-29T23:18:13Z taylanub: a correct version would be (define (add x . n) (let ((n (if (null? n) 1 (car n)))) (+ x n))) 2014-11-29T23:18:41Z ManDay: taylanub: yeah sorry, should have been car. newbie error 2014-11-29T23:18:47Z taylanub: (and that does no error checking for redundant extra arguments) 2014-11-29T23:19:05Z ManDay: vraid: what are you saying, and only returns once it has tested all values? no, it returns as soon as it finds a value to be #f 2014-11-29T23:19:14Z ManDay: we are talking about the OR anyway?! 2014-11-29T23:19:23Z vraid: ManDay: ah, you're right 2014-11-29T23:19:25Z taylanub: ManDay: you also messed up the parenthesizing. and set! usage should be kept to a minimum. 2014-11-29T23:19:36Z vraid: ManDay: but it doesn't return a non-false value without testing all but the last values 2014-11-29T23:19:55Z ManDay: taylanub: well i thought that's what he wanted with a set! 2014-11-29T23:19:59Z ManDay: you just returned the new value 2014-11-29T23:20:03Z taylanub: ManDay: oh, you're actually using set! totally wrong there. you're not actually returning a value, just setting the local variable 'x'... 2014-11-29T23:20:12Z ManDay: oh 2014-11-29T23:20:20Z taylanub: that won't affect any variable outside the lambda. 2014-11-29T23:21:13Z ManDay: how would I affect the variable outside the lambda? Would I have to use (define add (lambda ls ( .... (set! (car ls) (+ (car ls) 1)) ? 2014-11-29T23:21:29Z ManDay: (sorry scoofy for misleading you btw) 2014-11-29T23:22:19Z scoofy: no prob, it's good to be aware of various ways 2014-11-29T23:22:26Z jumblerg quit (Quit: My Mac has gone to sleep. ZZZzzz…) 2014-11-29T23:23:44Z ManDay: taylanub: mind to explain how do it such that the lambda actually modifies the passed-in value? 2014-11-29T23:23:59Z ManDay: such that (add x) would result in x being one greater? 2014-11-29T23:24:06Z ManDay: or nvm me then 2014-11-29T23:24:15Z ManDay: I guess I'll learn about it (assuming my attempt was wrong) 2014-11-29T23:25:09Z ManDay quit (Quit: WeeChat 0.4.3) 2014-11-29T23:26:06Z taylanub: that would only be possible with a macro. variables themselves can't be passed into a function; only the value they're bound to. 2014-11-29T23:28:45Z jumblerg joined #scheme 2014-11-29T23:32:25Z scoofy: taylanub, how is 'variable number of args' implemented? like (define (func args) (...)) where args can be aribtrary number of arguments 2014-11-29T23:33:07Z vraid: scoofy: (func . args) will get args as a list 2014-11-29T23:33:23Z scoofy: so (define (func . args) ( ... ))? 2014-11-29T23:34:00Z vraid: yes. the lambda form is (lambda ls ...), instead of (lambda (a b etc) ..) 2014-11-29T23:34:37Z scoofy: ah, so i don't need to type arguments, just the name of the func... 2014-11-29T23:44:26Z mdibound joined #scheme 2014-11-29T23:46:16Z derek_c joined #scheme 2014-11-29T23:46:41Z derek_c quit (Client Quit) 2014-11-29T23:47:32Z Vutral quit (Ping timeout: 244 seconds) 2014-11-29T23:48:52Z mdibound quit (Ping timeout: 255 seconds) 2014-11-29T23:49:09Z derek_c joined #scheme 2014-11-29T23:51:31Z Rodya_ joined #scheme