2015-12-30T00:18:02Z magine joined #scheme 2015-12-30T00:22:15Z magine quit (Ping timeout: 240 seconds) 2015-12-30T00:25:17Z m1dnight1 joined #scheme 2015-12-30T00:27:14Z m1dnight_ quit (Ping timeout: 245 seconds) 2015-12-30T00:27:25Z m1dnight1 is now known as m1dnight_ 2015-12-30T00:29:18Z sethalves quit (Quit: Leaving.) 2015-12-30T00:36:30Z spew joined #scheme 2015-12-30T00:50:09Z spew quit (Ping timeout: 245 seconds) 2015-12-30T01:06:11Z jcowan joined #scheme 2015-12-30T01:08:39Z davexunit joined #scheme 2015-12-30T01:09:43Z jcowan_ joined #scheme 2015-12-30T01:11:40Z jcowan quit (Ping timeout: 260 seconds) 2015-12-30T01:14:51Z mumptai quit (Quit: Verlassend) 2015-12-30T01:18:44Z _sjs quit (Ping timeout: 276 seconds) 2015-12-30T01:26:53Z spew joined #scheme 2015-12-30T01:57:36Z _sjs joined #scheme 2015-12-30T02:04:12Z taylan quit (Remote host closed the connection) 2015-12-30T02:05:41Z rx80 quit (Remote host closed the connection) 2015-12-30T02:05:55Z davexunit quit (Quit: Later) 2015-12-30T02:08:12Z altphi joined #scheme 2015-12-30T02:08:38Z aap_ joined #scheme 2015-12-30T02:09:53Z \var quit (Quit: Leaving) 2015-12-30T02:10:25Z kiasaki joined #scheme 2015-12-30T02:12:11Z aap quit (Ping timeout: 264 seconds) 2015-12-30T02:13:06Z davexunit joined #scheme 2015-12-30T02:21:44Z jrslepak joined #scheme 2015-12-30T02:25:41Z davexunit quit (Quit: Later) 2015-12-30T02:29:14Z magine joined #scheme 2015-12-30T02:29:42Z magine_ joined #scheme 2015-12-30T02:33:55Z magine quit (Ping timeout: 260 seconds) 2015-12-30T02:47:20Z mrowe_away quit (Ping timeout: 260 seconds) 2015-12-30T02:54:37Z mrowe_away joined #scheme 2015-12-30T03:10:08Z spew quit (Read error: Connection reset by peer) 2015-12-30T03:24:03Z jcowan_ quit (Quit: Leaving) 2015-12-30T03:26:27Z cmatei quit (Read error: Connection reset by peer) 2015-12-30T03:28:08Z bb010g joined #scheme 2015-12-30T03:35:14Z ArneBab joined #scheme 2015-12-30T03:39:08Z ArneBab_ quit (Ping timeout: 276 seconds) 2015-12-30T03:46:55Z oleo__ joined #scheme 2015-12-30T03:49:19Z oleo_ quit (Ping timeout: 245 seconds) 2015-12-30T03:55:34Z joneshf-laptop quit (Ping timeout: 245 seconds) 2015-12-30T04:01:00Z joneshf-laptop joined #scheme 2015-12-30T04:05:59Z mlrutherford is now known as mlr|dreaming 2015-12-30T04:29:01Z badkins quit (Remote host closed the connection) 2015-12-30T04:31:54Z spew joined #scheme 2015-12-30T04:40:51Z karswell joined #scheme 2015-12-30T04:43:10Z mlr|dreaming is now known as mlrutherford 2015-12-30T04:45:45Z turtleman_ quit (Quit: Leaving) 2015-12-30T04:48:04Z chu quit (Quit: leaving) 2015-12-30T04:48:12Z pierpa quit (Ping timeout: 264 seconds) 2015-12-30T04:48:37Z chu joined #scheme 2015-12-30T04:51:06Z chu quit (Client Quit) 2015-12-30T04:51:31Z chu joined #scheme 2015-12-30T04:53:39Z chu quit (Client Quit) 2015-12-30T04:54:06Z chu joined #scheme 2015-12-30T04:57:39Z physixer quit (Quit: leaving) 2015-12-30T05:06:45Z spew quit (Ping timeout: 260 seconds) 2015-12-30T05:11:05Z mlrutherford is now known as mlr|dreaming 2015-12-30T05:14:57Z psy_ quit (Remote host closed the connection) 2015-12-30T05:17:22Z mbuf joined #scheme 2015-12-30T05:18:31Z kiasaki quit (Ping timeout: 260 seconds) 2015-12-30T05:29:26Z zbigniew quit (Ping timeout: 256 seconds) 2015-12-30T05:29:42Z zbigniew joined #scheme 2015-12-30T05:47:06Z vectorman69 quit (Ping timeout: 255 seconds) 2015-12-30T05:51:37Z ggole joined #scheme 2015-12-30T05:55:39Z vectorman68 joined #scheme 2015-12-30T05:56:28Z nalaginrut joined #scheme 2015-12-30T06:14:40Z ggole_ joined #scheme 2015-12-30T06:16:55Z ggole quit (Ping timeout: 240 seconds) 2015-12-30T06:20:44Z ggole__ joined #scheme 2015-12-30T06:22:42Z ggole_ quit (Ping timeout: 256 seconds) 2015-12-30T06:26:23Z ggole_ joined #scheme 2015-12-30T06:29:30Z ggole__ quit (Ping timeout: 256 seconds) 2015-12-30T06:30:36Z ggole__ joined #scheme 2015-12-30T06:31:26Z ggole_ quit (Ping timeout: 240 seconds) 2015-12-30T06:32:32Z O7 quit (Ping timeout: 272 seconds) 2015-12-30T06:32:36Z ggole_ joined #scheme 2015-12-30T06:32:36Z ggole_ quit (Client Quit) 2015-12-30T06:33:32Z ggole joined #scheme 2015-12-30T06:33:40Z tmtwd joined #scheme 2015-12-30T06:34:55Z ggole__ quit (Ping timeout: 240 seconds) 2015-12-30T07:08:27Z gravicappa joined #scheme 2015-12-30T07:35:16Z githogori quit (Remote host closed the connection) 2015-12-30T07:44:31Z AlphaFuze joined #scheme 2015-12-30T07:47:25Z AlphaFuze: could some1 here please help me with getting scheme on my computer? 2015-12-30T07:48:21Z nalaginrut: AlphaFuze: what's your operating system? 2015-12-30T07:48:33Z AlphaFuze: windows 64-bit 2015-12-30T07:48:41Z AlphaFuze: windows 8.1 to be more specific 2015-12-30T07:49:19Z nalaginrut: oh, then maybe you could choose http://racket-lang.org/download/ 2015-12-30T07:50:43Z AlphaFuze: I saw racket, but wasn't sure if it was better to go with that or mit-gnu scheme. 2015-12-30T07:53:08Z AlphaFuze left #scheme 2015-12-30T08:02:18Z AlphaFuze joined #scheme 2015-12-30T08:05:42Z jyc quit (Ping timeout: 255 seconds) 2015-12-30T08:06:23Z AlphaFuze: has anyone here ever used chez scheme? I'm hesitant to use racket because it piles a lot of unnecessary stuff that I won't need if I'm only learning scheme. 2015-12-30T08:10:07Z nalaginrut: AlphaFuze: if you just want to learn Scheme in Racket, you can do that http://www.neilvandyke.org/racket-sicp/ 2015-12-30T08:10:44Z nalaginrut: AlphaFuze: and if you don't mind to install a Linux, you may choose GNU Guile too 2015-12-30T08:13:26Z GGMethos quit (Ping timeout: 240 seconds) 2015-12-30T08:17:39Z AlphaFuze: alright, thanks. 2015-12-30T08:17:41Z AlphaFuze left #scheme 2015-12-30T08:26:02Z lambda-11235 quit (Quit: Bye) 2015-12-30T08:32:23Z ggole_ joined #scheme 2015-12-30T08:35:18Z ggole quit (Ping timeout: 256 seconds) 2015-12-30T08:41:48Z GGMethos joined #scheme 2015-12-30T08:48:54Z neoncontrails quit (Remote host closed the connection) 2015-12-30T08:52:28Z jyc joined #scheme 2015-12-30T08:55:44Z ggole__ joined #scheme 2015-12-30T08:58:59Z ggole_ quit (Ping timeout: 264 seconds) 2015-12-30T08:59:37Z ggole joined #scheme 2015-12-30T09:01:40Z altphi quit (Quit: somno opus est.) 2015-12-30T09:02:03Z ggole__ quit (Ping timeout: 260 seconds) 2015-12-30T09:02:04Z altphi joined #scheme 2015-12-30T09:05:55Z tmtwd quit (Ping timeout: 260 seconds) 2015-12-30T09:16:15Z Saeren joined #scheme 2015-12-30T09:16:26Z haasn quit (Ping timeout: 240 seconds) 2015-12-30T09:17:03Z Saeren_ quit (Read error: Connection reset by peer) 2015-12-30T09:18:36Z bb010g quit (Quit: Connection closed for inactivity) 2015-12-30T09:23:33Z altphi quit (Quit: somno opus est.) 2015-12-30T09:24:05Z altphi joined #scheme 2015-12-30T09:25:44Z altphi quit (Client Quit) 2015-12-30T09:27:01Z ByronJoh1son quit (Ping timeout: 250 seconds) 2015-12-30T09:28:45Z haasn joined #scheme 2015-12-30T09:38:38Z GGMethos quit (Ping timeout: 250 seconds) 2015-12-30T09:39:37Z phax joined #scheme 2015-12-30T09:49:54Z phax quit (Quit: phax) 2015-12-30T09:51:07Z ByronJoh1son joined #scheme 2015-12-30T10:00:48Z magine_ is now known as magine 2015-12-30T10:03:15Z phax joined #scheme 2015-12-30T10:03:47Z jrslepak quit (Quit: This computer has gone to sleep) 2015-12-30T10:06:57Z GGMethos joined #scheme 2015-12-30T10:07:05Z aap_ is now known as aap 2015-12-30T10:17:30Z sz0 joined #scheme 2015-12-30T10:30:17Z nilg joined #scheme 2015-12-30T10:42:48Z magine quit (Remote host closed the connection) 2015-12-30T10:48:54Z cemerick joined #scheme 2015-12-30T10:53:37Z magine joined #scheme 2015-12-30T10:57:44Z magine quit (Ping timeout: 246 seconds) 2015-12-30T11:12:30Z nilg` joined #scheme 2015-12-30T11:14:55Z nilg quit (Ping timeout: 240 seconds) 2015-12-30T11:15:46Z phax quit (Quit: phax) 2015-12-30T11:18:46Z nilg`` joined #scheme 2015-12-30T11:19:11Z phax joined #scheme 2015-12-30T11:20:00Z phax quit (Client Quit) 2015-12-30T11:22:10Z mmc joined #scheme 2015-12-30T11:22:35Z nilg` quit (Ping timeout: 276 seconds) 2015-12-30T11:39:21Z xwl joined #scheme 2015-12-30T12:05:05Z xwl quit (Ping timeout: 255 seconds) 2015-12-30T12:18:27Z nilg``` joined #scheme 2015-12-30T12:21:29Z xwl joined #scheme 2015-12-30T12:22:08Z nilg`` quit (Ping timeout: 272 seconds) 2015-12-30T12:23:39Z nilg```` joined #scheme 2015-12-30T12:25:21Z nilg``` quit (Ping timeout: 255 seconds) 2015-12-30T12:28:20Z mbuf quit (Remote host closed the connection) 2015-12-30T12:29:48Z xwl quit (Ping timeout: 250 seconds) 2015-12-30T12:38:36Z nalaginrut quit (Ping timeout: 272 seconds) 2015-12-30T12:51:12Z cemerick quit (Ping timeout: 265 seconds) 2015-12-30T12:55:55Z nilg```` quit (Remote host closed the connection) 2015-12-30T12:56:45Z badkins joined #scheme 2015-12-30T12:58:16Z nilg joined #scheme 2015-12-30T13:05:36Z agumonkey quit (Ping timeout: 264 seconds) 2015-12-30T13:05:40Z agumonkey_ joined #scheme 2015-12-30T13:05:40Z davexunit joined #scheme 2015-12-30T13:06:04Z agumonkey_ is now known as agumonkey 2015-12-30T13:20:52Z nilg`` joined #scheme 2015-12-30T13:22:17Z nilg quit (Ping timeout: 246 seconds) 2015-12-30T13:35:42Z hiroakip joined #scheme 2015-12-30T13:37:23Z eli joined #scheme 2015-12-30T13:37:24Z eli quit (Changing host) 2015-12-30T13:37:24Z eli joined #scheme 2015-12-30T13:41:49Z davexunit quit (Quit: Later) 2015-12-30T13:44:16Z Necrosporus: What's the difference between clojure and regular result of higher-order function? 2015-12-30T13:44:24Z davexunit joined #scheme 2015-12-30T13:44:25Z Necrosporus: rudybot, (define (make-adder n) (lambda (x) (+ x n))) 2015-12-30T13:44:26Z rudybot: Necrosporus: your sandbox is ready 2015-12-30T13:44:28Z rudybot: Necrosporus: Done. 2015-12-30T13:44:55Z Necrosporus: rudybot, (define inc (make-adder 1)) 2015-12-30T13:44:55Z rudybot: Necrosporus: Done. 2015-12-30T13:45:13Z Necrosporus: rudybot, (inc 29) 2015-12-30T13:45:14Z rudybot: Necrosporus: ; Value: 30 2015-12-30T13:46:02Z ggole: I take it you mean closure, not the JVM language 2015-12-30T13:46:13Z Necrosporus: yes 2015-12-30T13:46:57Z pierpa joined #scheme 2015-12-30T13:47:02Z ggole: Closure refers to when a lambda contains a reference to a variable bound outside the lambda 2015-12-30T13:47:35Z ggole: Higher order functions are functions that take or return functions. 2015-12-30T13:50:33Z Necrosporus: Let's say there is: let adder: int -> int -> int = (fn n x => n+x) 2015-12-30T13:51:16Z Necrosporus: Then we define another function: let inc: int -> int = adder 1 2015-12-30T13:51:29Z nanoz joined #scheme 2015-12-30T13:51:51Z Necrosporus: Then we could use (inc 29) to get 30 just like in example above 2015-12-30T13:51:59Z Necrosporus: ggole, would it be a closure too? 2015-12-30T13:52:06Z ggole: Yep 2015-12-30T13:52:31Z ggole: Because a "two argument" SML function is actually a one argument function that returns another function 2015-12-30T13:53:18Z ggole: That is, in fn a => fn b => a + b, the inner function refers to a variable bound outside of itself in the same way that the Scheme function did. 2015-12-30T13:53:24Z Necrosporus: Then I do not get what is special about closures, if they are just regular functions with partial application 2015-12-30T13:54:12Z ggole: One of the major differences here is that scheme variables are mutable 2015-12-30T13:54:26Z micmus joined #scheme 2015-12-30T13:54:46Z ggole: But really the benefit of closures is that you can write code like the SML example easily. 2015-12-30T13:59:38Z Necrosporus: ggole, but Scheme's n-arg functions are not same as a function which returns another function? 2015-12-30T14:00:02Z ggole: Nope. 2015-12-30T14:00:19Z ggole: Currying is very explicit in scheme. 2015-12-30T14:00:48Z Necrosporus: So, do I take it right, that closure is a way to implement things one would use currying for if it was supported? 2015-12-30T14:01:21Z ggole: Closures are a way to implement functions that have variables bound outside their scope. 2015-12-30T14:01:22Z Riastradh joined #scheme 2015-12-30T14:01:23Z nilg`` quit (Remote host closed the connection) 2015-12-30T14:01:32Z ggole: SML-style curried functions are one example of when that happens. 2015-12-30T14:02:08Z jrslepak joined #scheme 2015-12-30T14:06:18Z Necrosporus: ggole, as far as I see, variables are used mostly as notation, they are not variables, actually, but rather labels for arguments 2015-12-30T14:06:46Z Necrosporus: in some languages you can write all of that without variables 2015-12-30T14:07:41Z Necrosporus: let add = (+); let inc = add 1; let x = inc 29 2015-12-30T14:08:32Z eli quit (Remote host closed the connection) 2015-12-30T14:08:45Z ggole: If you think so, consider (define (make-mutable-adder n) (cons (lambda (z) (set! n z)) (lambda (x) (+ x n)))) 2015-12-30T14:09:26Z civodul joined #scheme 2015-12-30T14:09:26Z eli joined #scheme 2015-12-30T14:09:26Z eli quit (Changing host) 2015-12-30T14:09:26Z eli joined #scheme 2015-12-30T14:10:37Z Necrosporus: ggole, but isn't not functional programming any more if you use variables as regular variables instead of labels? 2015-12-30T14:11:21Z ggole: You are certainly no longer programming in the pure subset of Scheme if you do what I did. 2015-12-30T14:12:58Z ggole: In the pure subset of Scheme, arguably variables are just labels for values and don't behave like locations at all. 2015-12-30T14:14:41Z kiasaki joined #scheme 2015-12-30T14:15:44Z Necrosporus: ggole, is it possible to use tacit notation in Scheme? 2015-12-30T14:16:20Z ggole: I'm not sure what you mean by tacit notation. 2015-12-30T14:16:35Z Necrosporus: In some languages, like J it's possible to define functions in term of composing other functions in different ways without using labels for arguments at all 2015-12-30T14:16:49Z wasamasa: ggole: how dare you're not intimately familiar with haskell! 2015-12-30T14:17:01Z ggole: Oh, you mean point-free style 2015-12-30T14:17:31Z Necrosporus: wasamasa, I am not familiar with Haskell, though I have learned J for a little 2015-12-30T14:17:49Z ggole: I would say it is possible but probably not useful 2015-12-30T14:18:19Z ggole: You could write a library of combinators, but they would not interact nicely with Scheme's native n-ary and variadic functions. 2015-12-30T14:18:47Z Necrosporus: It's like Scheme does not have currying ? 2015-12-30T14:19:16Z Necrosporus: I guess it's impossible to combine currying with variadic functions 2015-12-30T14:19:17Z wasamasa: it may be a bit hard to believe, but scheme is not J or haskell or what-have-you 2015-12-30T14:19:49Z wasamasa: you can of course bludgeon it into submission, but eh 2015-12-30T14:20:05Z ggole: You can write curried functions in Scheme, but it won't mesh well with what is already there 2015-12-30T14:20:14Z Necrosporus: How? 2015-12-30T14:20:33Z ggole: Because all of the basic operations are provided in uncurried form. 2015-12-30T14:21:53Z ggole: And the syntax of Scheme is not designed to make either defining or applying curried functions as smooth as it is in ML (or Haskell, or etc) 2015-12-30T14:22:26Z ggole: It's (lambda (a) (lambda (b) ...)) and ((f x) y) instead of fun a b -> ... and f x y 2015-12-30T14:23:13Z wasamasa: perhaps you could abuse cut/cute 2015-12-30T14:23:13Z ggole: (Wait, that's fn a b => ... - I think I just outed myself as an OCaml programmer.) 2015-12-30T14:23:46Z Necrosporus: I think that OCaml is fine 2015-12-30T14:24:00Z Necrosporus: I have read a book about OCaml and tried examples 2015-12-30T14:24:02Z ggole: Yeah, or you could provide some macros. I think you're right to suggest that it would be abuse. 2015-12-30T14:24:17Z Necrosporus: Though I somehow discovered that I forgot all of it 2015-12-30T14:25:07Z Necrosporus: I have also read OCaml and SML comparison because I wanted to run SML examples, and had only OCaml installed 2015-12-30T14:25:37Z ggole: They're much the same until you get into odd corners of the languages. 2015-12-30T14:25:38Z Necrosporus: So I do not really remember what is from OCaml and what's from SML, and what is from Haskell and use them interchageably 2015-12-30T14:25:57Z Necrosporus: Though slightly different syntax for fn, fun, function 2015-12-30T14:26:15Z Necrosporus: -> vs => and so on 2015-12-30T14:31:25Z pjb: (apply + (list (f) (g))) ; works nicely with n-ary functions. It's even primitive, no need for a library. 2015-12-30T14:31:48Z Riastradh quit (Ping timeout: 255 seconds) 2015-12-30T14:37:06Z Necrosporus: I understand that Scheme is not same as *ML/Haskell, but what does make it different beside simpler syntax? 2015-12-30T14:39:06Z davexunit: Necrosporus: latent typing instead of static typing, for example. 2015-12-30T14:39:23Z psy joined #scheme 2015-12-30T14:45:46Z daviid joined #scheme 2015-12-30T14:49:44Z nilg joined #scheme 2015-12-30T14:58:57Z phax joined #scheme 2015-12-30T15:02:28Z nilg` joined #scheme 2015-12-30T15:04:55Z nilg quit (Ping timeout: 240 seconds) 2015-12-30T15:10:42Z O7 joined #scheme 2015-12-30T15:20:15Z nilg`` joined #scheme 2015-12-30T15:23:35Z nilg` quit (Ping timeout: 264 seconds) 2015-12-30T15:27:14Z nilg`` quit (Ping timeout: 246 seconds) 2015-12-30T15:31:01Z Beluki joined #scheme 2015-12-30T15:31:05Z phax quit (Ping timeout: 246 seconds) 2015-12-30T15:34:26Z GGMethos quit (Ping timeout: 240 seconds) 2015-12-30T15:37:05Z jusss joined #scheme 2015-12-30T15:37:45Z jusss: hi there, if there's a list like ('+ 1 2) and how I can eval it like (+ 1 2) ? 2015-12-30T15:38:36Z Riastradh joined #scheme 2015-12-30T15:39:11Z ggole: (apply (car list) (cdr list)) 2015-12-30T15:40:22Z ggole: Or possibly eval, depending on what this form might look like 2015-12-30T15:46:26Z jyc quit (Ping timeout: 240 seconds) 2015-12-30T15:46:52Z nilg joined #scheme 2015-12-30T15:56:05Z jusss: ggole: get error mesg, '+ is not a procedure 2015-12-30T15:58:03Z jusss: ggole: I turn a string like "(+ 1 1)" to a list ('+ '1 '1), now I'd like to eval it like eval (+ 1 1) 2015-12-30T15:58:16Z ggole: O_o 2015-12-30T15:58:20Z ggole: Well, remove the quotes first 2015-12-30T15:58:22Z jusss: but I don't know how to transform 2015-12-30T15:58:44Z Riastradh quit (Ping timeout: 246 seconds) 2015-12-30T16:00:04Z jusss: ggole: how 2015-12-30T16:01:11Z ggole: jusss: figure out how to turn '1 into 1. Then, figure out how to do that for each element of the list. 2015-12-30T16:01:19Z jcowan joined #scheme 2015-12-30T16:01:19Z jcowan_ joined #scheme 2015-12-30T16:01:32Z jcowan_ quit (Read error: Connection reset by peer) 2015-12-30T16:02:53Z GGMethos joined #scheme 2015-12-30T16:03:53Z jusss: ggole: "(+ 1 1)", I can split it turn to ("+" "1" "1") then string->symbol can turn to ('+ '1 '1) 2015-12-30T16:04:58Z jusss: turn '1 into 1, is there symbol->number or what ? and it sounds not good 2015-12-30T16:05:17Z jusss: my thought is really bad 2015-12-30T16:05:47Z jusss: so how to turn "(+ 1 1)" to '(+ 1 1) ? 2015-12-30T16:06:14Z ggole: '1 is (quote 1), which you can get the second element of easily enough 2015-12-30T16:07:04Z ggole: I don't think there's a standard facility to read a sexp from a string though 2015-12-30T16:10:56Z jusss: ggole: do repl work like this ? read a string and eval 2015-12-30T16:15:04Z profan_: ggole: read from string port? 2015-12-30T16:20:49Z nilg` joined #scheme 2015-12-30T16:22:46Z pjb: jusss: you need to use map to remove the quoted form: (map (lambda (quoted-form) (cadr quoted-form)) '('+ '1 '2)) #| --> (+ 1 2) |# 2015-12-30T16:23:50Z nilg quit (Ping timeout: 255 seconds) 2015-12-30T16:24:11Z pjb: jusss: but it's idiotic to turn a string like "(+ 1 2)" into a list ('+ '1 '2). It would be saner to turn it into a list (+ 1 2) directly. 2015-12-30T16:24:41Z jusss: pjb: how ? 2015-12-30T16:24:58Z pjb: read from string port. 2015-12-30T16:25:03Z nilg``` joined #scheme 2015-12-30T16:25:05Z pjb: in CL, just use read-from-string. 2015-12-30T16:25:13Z jusss: pjb: and scheme ? 2015-12-30T16:25:23Z pjb: in scheme read from string port. 2015-12-30T16:26:00Z nilg` quit (Ping timeout: 245 seconds) 2015-12-30T16:26:59Z pjb: jusss: now, of course, string ports are not standard r5rs, so you would first save the string to a file then reopen the file and read from it. 2015-12-30T16:27:26Z jusss: pjb: how repl works ? 2015-12-30T16:27:53Z pjb: you launch a scheme implementation and type stuff 2015-12-30T16:28:52Z jusss: pjb: so repl don't receive your input stuff as strings ? 2015-12-30T16:29:38Z pjb: No, it uses read directly. REPL = (loop (print (eval (read)))). 2015-12-30T16:30:41Z pjb: jusss: you may find string ports in your implementation extensions. 2015-12-30T16:30:54Z cemerick joined #scheme 2015-12-30T16:31:01Z jusss: pjb: now I'm using racket 2015-12-30T16:31:51Z pjb: jusss: but it would be an impair to read lines as strings, to read them again with a string port, because this would prevent to write sexps over multiple lines (or make it exponentially more difficult for you to deal with). 2015-12-30T16:31:57Z pjb: Then read racket doc. 2015-12-30T16:31:59Z jusss: pjb: I have a little confused about symbol type, like (define a 10) so a is symbol type ? 2015-12-30T16:32:44Z pjb: a is a symbol, naming a variable, bound to a lisp object. That lisp object is of type integer, and of value 10. 2015-12-30T16:32:45Z jusss: I don't remember there's symbol type in other languages like c or python 2015-12-30T16:32:56Z _sjs quit (Ping timeout: 272 seconds) 2015-12-30T16:33:35Z wasamasa: it is there in ruby though 2015-12-30T16:34:00Z jyc joined #scheme 2015-12-30T16:37:08Z pjb: in MIT scheme, you can write a REPL as: (let ((env (make-top-level-environment))) (let loop () (display (eval (read) env)) (newline) (loop))) 2015-12-30T16:37:58Z jusss: pjb: can I turn 'a to a ? 2015-12-30T16:38:10Z pjb: (cadr ''a) #| --> a |# 2015-12-30T16:38:39Z pjb: (list 'quote 'a) #| --> 'a |# 2015-12-30T16:38:42Z pjb: (cadr (list 'quote 'a)) #| --> a |# 2015-12-30T16:39:07Z jusss: pjb: no, it's still 'a 2015-12-30T16:39:09Z pjb: Again, you should not have 'a. You should have a. 2015-12-30T16:39:13Z pjb: It is much more complex to have 'a. 2015-12-30T16:39:58Z pjb: 'a is a form: it's a data list representing some code. To obtain it, you have to write a program to build this data representing code. Such as (list 'quote 'a). 2015-12-30T16:40:24Z pjb: Instead just use a. 2015-12-30T16:40:29Z jusss: pjb: so where string->symbol is expected to use ? 2015-12-30T16:40:50Z pjb: (string->symbol "a") #| --> a |# 2015-12-30T16:41:09Z pjb: (list 'quote (string->symbol "a")) #| --> 'a |# ;see, much more complex. 2015-12-30T16:41:33Z jusss: pjb: if a don't exist, so what's the meaning of (string->symbol "a") 2015-12-30T16:41:48Z pjb: (string->symbol "a") returns a symbol named "a". 2015-12-30T16:42:02Z pjb: (string->symbol "a") #| --> a |# 2015-12-30T16:42:40Z pjb: scheme is really too limited. in CL: (type-of (intern "A")) #| --> symbol |# 2015-12-30T16:42:42Z jusss: so here's the stuff to make me confused, 'a is a symbol, also it's a variable name 2015-12-30T16:43:10Z pjb: No. 'a is a list: (list? ''a) #| --> #t |# 2015-12-30T16:43:31Z pjb: a is a symbol: (symbol? 'a) #| --> #t |# 2015-12-30T16:43:42Z jusss: pjb: and 'a is a procedure ? 2015-12-30T16:43:52Z pjb: No, 'a is a list: (list? ''a) #| --> #t |# 2015-12-30T16:44:19Z pjb: (car ''a) #| --> quote |# (cadr ''a) #| --> a |# (length ''a) #| --> 2 |# 2015-12-30T16:44:28Z pjb: (cdr ''a) #| --> (a) |# 2015-12-30T16:44:40Z jusss: ok then, now 'a is a symbol, a variable name, (quote a), and list you said 2015-12-30T16:44:49Z ggole: 'a is not a symbol 2015-12-30T16:44:50Z pjb: (list 'quotex 'a) #| --> (quotex a) |# (list 'quote 'a) #| --> 'a |# 2015-12-30T16:45:23Z pjb: don't let the lisp printer confuse you. It prints lists such as (quote a) as 'a: '(quote a) #| --> a |# But it's still a list containing the two symbols quote and a. 2015-12-30T16:45:34Z jusss: ggole: if it's not a symbol, so what's it ? 2015-12-30T16:45:40Z pjb: a list 2015-12-30T16:46:09Z pjb: Type: (list? (read)) RET 'a RET 2015-12-30T16:46:14Z pjb: Type: (symbol? (read)) RET 'a RET 2015-12-30T16:46:22Z pjb: what do you get for each? 2015-12-30T16:46:38Z ggole: Yep, it's shorthand for the form (quote a) 2015-12-30T16:46:40Z jusss: now what's symbol really 2015-12-30T16:46:55Z pjb: a is a symbol. quote is a symbol. foo is a symbol. 2015-12-30T16:47:26Z jusss: that's why lisp called symbol-expression ? 2015-12-30T16:47:29Z pjb: + is a symbol. * is a symbol. --*-- is a symbol. 2015-12-30T16:47:45Z jusss: because everything is symbol in lisp ? 2015-12-30T16:47:47Z pjb: 42<35 is a symbol. 2015-12-30T16:47:50Z pjb: jusss: nope. 2015-12-30T16:48:05Z jusss: and I found the concept is not easy to understand 2015-12-30T16:48:14Z pjb: #t is not a symbol. 42 is not a symbol. #(1 2 3) is not a symbol. (a b c) is not a symbol. 'a is not a symbol. 2015-12-30T16:49:27Z Beluki quit (Quit: Beluki) 2015-12-30T16:50:12Z jusss: pjb: and symbol is easy to understand in cl ? 2015-12-30T16:50:31Z jusss: it's not between scheme and cl ? 2015-12-30T16:50:40Z pjb: jusss: http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-9.html#%_sec_6.3.3 says that: "The rules for writing a symbol are exactly the same as the rules for writing an identifier; see sections 2.1 and 7.1.1." and http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-5.html#%_sec_2.1 gives the rules. 2015-12-30T16:50:40Z rudybot: http://teensy.info/0MwuZhjr2C 2015-12-30T16:50:40Z rudybot: http://teensy.info/d7ZYtcV4AF 2015-12-30T16:50:58Z pjb: jusss: r5rs is fucking 50 pages only. You can read 50 pages can't you? 2015-12-30T16:51:54Z O7_ joined #scheme 2015-12-30T16:52:27Z jusss: pjb: ok then, so 'a is not a symbol, and why (string->symbol "a") return 'a ? 2015-12-30T16:52:48Z pjb: CL is easier because you have more standardized tools, including introspection tools such as inspect, type-of, etc. REPL can be written conformingly as (loop (print (eval (read)))) instead of (let ((env (make-top-level-environment))) (let loop () (display (eval (read) env)) (newline) (loop))) which is not standard because interaction-environment is not mandatory by r5rs. 2015-12-30T16:52:57Z pjb: jusss: it does not. 2015-12-30T16:53:03Z pjb: (string->symbol "a") returns a. 2015-12-30T16:53:12Z O7 quit (Ping timeout: 272 seconds) 2015-12-30T16:53:18Z pjb: You may be using a deficient implementation that prints 'a instead of a, but it's a. 2015-12-30T16:53:51Z pierpa: he uses an implementation whose output format can be taylored in several ways 2015-12-30T16:53:54Z pjb: racket contains a lot of deficient languages, supposedly pedagogical, but they confuse things more than anything. 2015-12-30T16:54:11Z ggole: There are several implementations which do that. 2015-12-30T16:54:13Z pierpa: some of which looks really obnoxious :) 2015-12-30T16:54:20Z pjb: and dumb. 2015-12-30T16:54:36Z jusss: pjb: (symbol? 'foo) ===> #t 2015-12-30T16:54:40Z ggole: I don't think the decision was made without thought, but I really don't care for it myself. 2015-12-30T16:54:53Z pjb: jusss: here, the object tested is foo. 2015-12-30T16:55:40Z pjb: ggole: deficient thought. 2015-12-30T16:56:01Z O7_ is now known as O7 2015-12-30T16:56:03Z pjb: It ignores the modularity of the lisp reader. 2015-12-30T16:56:04Z jusss: pjb: I will try this (string->symbol "a") in guile 2015-12-30T16:58:52Z pjb: What did you get for 2015-12-30T16:58:52Z pjb: Type: (list? (read)) RET 'a RET 2015-12-30T16:58:52Z pjb: Type: (symbol? (read)) RET 'a RET 2015-12-30T16:58:56Z pjb: 2015-12-30T16:58:59Z pjb: > 2015-12-30T16:59:35Z nilg``` quit (Remote host closed the connection) 2015-12-30T16:59:46Z jusss: pjb: in guile, (define a 10) (symbol? a) => #f 2015-12-30T17:00:27Z jusss: pjb: in guile, 'a => a, (string->symbol "a") => a, (car (cdr ''a)) => a 2015-12-30T17:00:29Z pjb: yes, 10 is not a symbol 2015-12-30T17:00:46Z pjb: (define sym 'a) (symbol? sym) -> #f 2015-12-30T17:01:01Z pjb: 10 is an integer. 2015-12-30T17:01:12Z pjb: have you read 2.1? 2015-12-30T17:01:54Z jcowan_ joined #scheme 2015-12-30T17:02:42Z pjb: Notice that by 2.1 42<35 is not a standard identifier, but implementation dependant. It could be something else than a symbol in a different implementation. DUH. In CL it's a symbol by standard. 2015-12-30T17:03:48Z jcowan__ joined #scheme 2015-12-30T17:04:55Z jcowan quit (Ping timeout: 240 seconds) 2015-12-30T17:05:16Z _sjs joined #scheme 2015-12-30T17:07:17Z jusss: now I'm totally confused about identifer and symbol 2015-12-30T17:07:34Z pjb: Yes, scheme is confusing. Assume they're the same. 2015-12-30T17:07:44Z jcowan_ quit (Ping timeout: 276 seconds) 2015-12-30T17:07:51Z tmtwd joined #scheme 2015-12-30T17:08:19Z ggole: Most of the difference is that you can create symbols from arbitrary strings with string->symbol: identifiers are the subset that read will create for you from scheme source. 2015-12-30T17:08:31Z ggole: (That's probably a bit of a simplification.) 2015-12-30T17:10:42Z jusss: (define a 10) (+ 1 (car (cdr ''a))) 2015-12-30T17:10:51Z jusss: get error 2015-12-30T17:11:43Z pjb: Yes, you cannot add symbols to numbers. 2015-12-30T17:11:52Z pjb: or numbers to symbols. 2015-12-30T17:12:15Z cemerick quit (Ping timeout: 245 seconds) 2015-12-30T17:13:21Z bb010g joined #scheme 2015-12-30T17:13:24Z pjb: Also, (define a 10) defines the variable named a in an environment. To get access to its value from the symbol a, you would have to use eval (there's no symbol-value in scheme), and therefore you would have to find a way to obtain the environment where (define a 10) has defined the variable. Most of the time it will be an implementation dependant way to find this environment. 2015-12-30T17:14:49Z jusss: completely confused now :-( 2015-12-30T17:15:08Z jusss: pjb: (define a 10) a is not a symbol 2015-12-30T17:15:26Z jusss: and now you say it's 2015-12-30T17:15:32Z pjb: jusss: but instead, you can define your own way to map symbols to values. For example, you could use an a-list. (let ((vars '((a . 10) (b . 20)))) (+ (cdr (assoc 'a vars)) (cdr (assoc 'b vars)))) #| --> 30 |# 2015-12-30T17:16:25Z pjb: jusss: in (define a 10), define is a symbol. a is a symbol, 10 is an integer. (define a 10) is a form, which when evaluated in an environment, will define a variable, named by the symbol a, bound to the integer 10. 2015-12-30T17:17:39Z pjb: Now, if you do that at the REPL, and if your implementation provide the semi-standard interaction-environment procedure, then you could use (eval 'a (interaction-environment)) to get the value bound to the variable named a. But it's only semi-standard, and not all implementations provide it. 2015-12-30T17:18:30Z pjb: And then, if you use this define in other environments, such as in a procedure: (lambda () (define a 10) …) then there are no standard way to get the environment allowing you to retrieve the variable named a in that procedure. 2015-12-30T17:19:32Z pjb: So instead, you can program your own kind of environment, for example, an a-list, where you map symbols to values and can do whatever you want. Of course, then you don't use define to put associations in your a-list, you would define your own procedures or macros. 2015-12-30T17:19:56Z badkins quit (Ping timeout: 246 seconds) 2015-12-30T17:20:38Z jusss: pjb: so a is a symbol before (define a 10) and after that a is not a symbol ? 2015-12-30T17:20:54Z pjb: a is always a symbol. 2015-12-30T17:21:13Z pjb: The question is whether there is a way to find the variable named by this symbol or not. 2015-12-30T17:21:54Z pjb: Notice that when you compile a program, the variable names (the symbol identifying those variables, aka the identifiers) are usually throw out. They're forgotten. Only remains native code. 2015-12-30T17:22:40Z jusss: pjb: 'a is (quote a) or a symbol ? 2015-12-30T17:22:42Z pjb: In such an environment (a compiled program), there's no way to go from a symbol to a variable, because the compiler may have even optimize out the variable, or duplicated it; in any case, it has forgotten the naming of the bytes in memory. 2015-12-30T17:22:50Z pjb: 'a is (quote a) 2015-12-30T17:22:53Z lambda-11235 joined #scheme 2015-12-30T17:22:57Z pjb: Try: (read) RET 'a RET 2015-12-30T17:23:04Z pjb: Try: (read) RET (quote a) RET 2015-12-30T17:23:47Z pjb: Try: (let ((x (read)) (y (read))) (equal? x y)) RET 'a RET (quote a) RET 2015-12-30T17:24:58Z jcowan_ joined #scheme 2015-12-30T17:26:10Z pjb: jusss: see: http://paste.lisp.org/display/304200 2015-12-30T17:28:12Z jcowan__ quit (Ping timeout: 255 seconds) 2015-12-30T17:30:02Z jusss: pjb: I really need a time to think about it, thanks very much 2015-12-30T17:30:20Z jusss: I have to go 2015-12-30T17:30:26Z pjb: Good night! 2015-12-30T17:30:35Z jusss: good night 2015-12-30T17:30:59Z mmc quit (Quit: Leaving.) 2015-12-30T17:31:11Z jusss quit (Quit: ERC (IRC client for Emacs 24.5.1)) 2015-12-30T17:31:50Z kiasaki quit (Ping timeout: 272 seconds) 2015-12-30T17:34:16Z jcowan_ quit (Quit: Leaving) 2015-12-30T17:34:26Z jcowan joined #scheme 2015-12-30T17:41:00Z kiasaki joined #scheme 2015-12-30T17:42:46Z kiasaki left #scheme 2015-12-30T17:44:16Z nalaginrut joined #scheme 2015-12-30T17:53:15Z neoncontrails joined #scheme 2015-12-30T17:57:58Z daviid` joined #scheme 2015-12-30T17:59:22Z nilg joined #scheme 2015-12-30T18:00:20Z daviid quit (Ping timeout: 272 seconds) 2015-12-30T18:00:20Z gravicappa quit (Ping timeout: 272 seconds) 2015-12-30T18:06:28Z mlr|dreaming is now known as mlrutherford 2015-12-30T18:09:59Z jrslepak quit (Quit: This computer has gone to sleep) 2015-12-30T18:30:02Z badkins joined #scheme 2015-12-30T18:36:11Z eli quit (Ping timeout: 264 seconds) 2015-12-30T18:41:26Z mmc joined #scheme 2015-12-30T18:59:16Z nalaginrut quit (Ping timeout: 240 seconds) 2015-12-30T19:08:36Z spew joined #scheme 2015-12-30T19:15:29Z jcowan_ joined #scheme 2015-12-30T19:19:02Z jcowan quit (Ping timeout: 276 seconds) 2015-12-30T19:19:43Z ggole quit 2015-12-30T19:25:50Z jcowan_ quit (Ping timeout: 256 seconds) 2015-12-30T19:27:45Z neoncontrails quit (Ping timeout: 260 seconds) 2015-12-30T19:34:35Z nanoz quit (Ping timeout: 240 seconds) 2015-12-30T19:35:52Z spew quit (Read error: Connection reset by peer) 2015-12-30T19:46:38Z lambda-11235 quit (Quit: Bye) 2015-12-30T19:58:12Z superturrican joined #scheme 2015-12-30T20:05:39Z profess quit (Ping timeout: 260 seconds) 2015-12-30T20:06:52Z davexunit quit (Remote host closed the connection) 2015-12-30T20:06:55Z jcowan joined #scheme 2015-12-30T20:07:07Z davexunit joined #scheme 2015-12-30T20:12:21Z profess joined #scheme 2015-12-30T20:23:09Z nilg quit (Remote host closed the connection) 2015-12-30T20:27:13Z rx80 joined #scheme 2015-12-30T20:27:57Z cemerick joined #scheme 2015-12-30T20:30:33Z nilg joined #scheme 2015-12-30T20:30:43Z gublet joined #scheme 2015-12-30T20:31:40Z gublet quit (Client Quit) 2015-12-30T20:31:54Z gublet joined #scheme 2015-12-30T20:32:48Z gublet quit (Client Quit) 2015-12-30T20:40:28Z superturrican_ joined #scheme 2015-12-30T20:41:12Z superturrican quit (Ping timeout: 256 seconds) 2015-12-30T20:41:21Z superturrican_ is now known as superturrican 2015-12-30T20:47:40Z badkins_ joined #scheme 2015-12-30T20:50:15Z badkins quit (Ping timeout: 240 seconds) 2015-12-30T20:58:08Z nilg quit (Remote host closed the connection) 2015-12-30T20:59:40Z superturrican_ joined #scheme 2015-12-30T21:01:18Z superturrican quit (Ping timeout: 265 seconds) 2015-12-30T21:01:33Z superturrican_ is now known as superturrican 2015-12-30T21:03:31Z Steverman joined #scheme 2015-12-30T21:13:12Z vectorman68 quit (Ping timeout: 255 seconds) 2015-12-30T21:19:55Z vectorman68 joined #scheme 2015-12-30T21:27:59Z nilg joined #scheme 2015-12-30T21:30:09Z ELLIOTTCABLE is now known as ec^ 2015-12-30T21:37:24Z hiroakip quit (Remote host closed the connection) 2015-12-30T21:38:36Z bb010g quit (Quit: Connection closed for inactivity) 2015-12-30T21:39:53Z hiroakip joined #scheme 2015-12-30T21:40:37Z jrslepak joined #scheme 2015-12-30T21:43:20Z Necrosporus_ joined #scheme 2015-12-30T21:46:22Z Necrosporus quit (Ping timeout: 256 seconds) 2015-12-30T21:46:43Z n_blownapart joined #scheme 2015-12-30T21:46:47Z n_blownapart: hi jas$om gave me a lot of help last night but I had missed a preliminary version of it that swaps the old with the new arg (at top of paste). Now I am certain I don't know how it works. pastie.org/10661852 2015-12-30T21:47:05Z n_blownapart: it being this example.. 2015-12-30T21:48:01Z n_blownapart: I thought lines 22-23 are not used at all, but when I comment them out I realize they are key to the program. 2015-12-30T21:49:49Z n_blownapart: I'm beginning to dislike the little schemer book... 2015-12-30T21:51:55Z n_blownapart: sorry the program is here now : http://pastie.org/10661874 2015-12-30T21:53:30Z jcowan: (else (cond is mind-boggling 2015-12-30T21:54:05Z n_blownapart: my question is, what does line 11 do aside from returning the recursion part? 2015-12-30T21:54:07Z jcowan: just remove that and align the ((null? lat) ...) with the ((eq? (car lat) old) ...) 2015-12-30T21:54:31Z jcowan: It conses car lat on top of the recursive result 2015-12-30T21:56:12Z n_blownapart: jcowan: thanks so much. one sec... 2015-12-30T21:57:55Z nilg quit (Remote host closed the connection) 2015-12-30T21:59:25Z superturrican quit (Ping timeout: 260 seconds) 2015-12-30T22:00:07Z n_blownapart: looking at line 23-24 (the completed version) once (cons old (cons new (cdr lat))) is completed, the flow goes to line 26 to add (car lat) ... the *only* operation on that line is (car lat) .. the 'insertR new old' part is only used to recurse the (cdr lat) part prior to the final cons car lat. correct? 2015-12-30T22:00:12Z n_blownapart: jcowan: ^ 2015-12-30T22:02:11Z zbigniew quit (Ping timeout: 276 seconds) 2015-12-30T22:02:25Z zbigniew joined #scheme 2015-12-30T22:04:24Z Necrosporus_ is now known as Necrosporus 2015-12-30T22:06:56Z zbigniew quit (Ping timeout: 246 seconds) 2015-12-30T22:08:36Z zbigniew joined #scheme 2015-12-30T22:11:38Z n_blownapart: I am getting warmer, I was under the impression line 26 was where new and old were cons from the innermost in the nest (old) to the left (new) and finally (cons (car lat) ..i.e. that the main part was on line 26 2015-12-30T22:14:50Z LeoNerd quit (Read error: Connection reset by peer) 2015-12-30T22:15:02Z LeoNerd joined #scheme 2015-12-30T22:15:06Z pchrist quit (Ping timeout: 240 seconds) 2015-12-30T22:15:11Z ecraven quit (Ping timeout: 264 seconds) 2015-12-30T22:15:15Z hiroakip quit (Ping timeout: 265 seconds) 2015-12-30T22:15:27Z n_blownapart: any comments on the above ? http://pastie.org/10661874 2015-12-30T22:15:46Z micro` quit (Ping timeout: 240 seconds) 2015-12-30T22:16:12Z wingo quit (Ping timeout: 255 seconds) 2015-12-30T22:17:25Z jcowan: n_blownapart: pastie.org appears to be down, consider using lisppaste 2015-12-30T22:17:37Z n_blownapart: jcowan: sorry will do 2015-12-30T22:17:44Z jcowan: paste.lisp.org 2015-12-30T22:18:23Z LeoNerd quit (Read error: Connection reset by peer) 2015-12-30T22:18:35Z LeoNerd joined #scheme 2015-12-30T22:19:50Z amoe quit (Ping timeout: 260 seconds) 2015-12-30T22:21:23Z n_blownapart: http://paste.lisp.org/display/304210 thanks for looking. ^ 2015-12-30T22:22:46Z LeoNerd quit (Ping timeout: 240 seconds) 2015-12-30T22:23:56Z pchrist joined #scheme 2015-12-30T22:24:03Z micro` joined #scheme 2015-12-30T22:24:21Z LeoNerd joined #scheme 2015-12-30T22:24:28Z micro` is now known as Guest97387 2015-12-30T22:24:34Z ecraven joined #scheme 2015-12-30T22:25:43Z wingo joined #scheme 2015-12-30T22:28:27Z amoe joined #scheme 2015-12-30T22:34:34Z n_blownapart: I still have some questions regarding the finished program here, if anyone has time: the recursions occur at line 8 until the (eq? (car lat) old) is #t, then new and old are consed, and the current (cdr lat) is returned, but at that moment isn't (car lat) old again? (i.e. lines 7-8 don't cause an infinite loop?) http://paste.lisp.org/display/304213 2015-12-30T22:36:32Z n_blownapart: no that can't be, the recursions happen at line 10 with insertR I believe. so I'm confused. 2015-12-30T22:40:41Z badkins_ quit (Remote host closed the connection) 2015-12-30T22:40:59Z cemerick quit (Ping timeout: 264 seconds) 2015-12-30T22:41:22Z jcowan: Right. There is no recursion at line 8 needed, because we are changing only the first occurrence of old to old new, not all occurrences 2015-12-30T22:42:02Z jcowan: So we return the list (old new . ) 2015-12-30T22:43:26Z wingo quit (Ping timeout: 272 seconds) 2015-12-30T22:43:46Z LeoNerd quit (Ping timeout: 265 seconds) 2015-12-30T22:43:59Z ecraven quit (Ping timeout: 264 seconds) 2015-12-30T22:44:13Z LeoNerd joined #scheme 2015-12-30T22:44:42Z wingo joined #scheme 2015-12-30T22:44:44Z Guest97387 quit (Ping timeout: 246 seconds) 2015-12-30T22:45:10Z n_blownapart: jcowan: so actually there is no recursion in this case from line 10 at all? 2015-12-30T22:45:13Z amoe quit (Ping timeout: 265 seconds) 2015-12-30T22:45:20Z jcowan: Right 2015-12-30T22:45:22Z micro`_ joined #scheme 2015-12-30T22:45:29Z jcowan: well, there may be 2015-12-30T22:45:38Z jcowan: There are three cases to the recursion: 2015-12-30T22:45:46Z jcowan: base case: lat is empty, return empty 2015-12-30T22:45:58Z n_blownapart: ok 2015-12-30T22:46:12Z jcowan: active case: car matches old, prepend old and new to the rest of lat without looking at it 2015-12-30T22:46:26Z n_blownapart: without looking at it? 2015-12-30T22:46:27Z jcowan: recursion case: prepend car lat to the result of applying the function to cdr lat 2015-12-30T22:46:30Z jcowan: Right. 2015-12-30T22:47:07Z Steverman quit (Ping timeout: 260 seconds) 2015-12-30T22:47:12Z jcowan: So if your input is '(ice cream with fudge and fudge) you get (ice cream with fudge topping and fudge) 2015-12-30T22:47:21Z jcowan: and not (ice cream with fudge topping and fudge topping) 2015-12-30T22:47:51Z jcowan: so the active case is also a base case 2015-12-30T22:47:58Z n_blownapart: right, it is designed to only insert the first instance... 2015-12-30T22:47:59Z jcowan: because there is no further recursion once you have a match 2015-12-30T22:48:28Z n_blownapart: ok, the thing is... 2015-12-30T22:49:35Z micro`_ quit (Ping timeout: 240 seconds) 2015-12-30T22:49:40Z LeoNerd quit (Read error: Connection reset by peer) 2015-12-30T22:49:52Z LeoNerd joined #scheme 2015-12-30T22:50:03Z wingo quit (Ping timeout: 265 seconds) 2015-12-30T22:50:13Z n_blownapart: where are "Ice cream and" stripped off (popped in ruby) to be put in a buffer / staging area for the final cons.. ie on what line are they taken off to expose (eq? (car lat) old) ? 2015-12-30T22:50:35Z pchrist quit (Ping timeout: 240 seconds) 2015-12-30T22:50:52Z n_blownapart: to expose car lat == old 2015-12-30T22:51:30Z micro`_ joined #scheme 2015-12-30T22:51:33Z wingo joined #scheme 2015-12-30T22:51:55Z jcowan: Well, think it through call by call. 2015-12-30T22:52:10Z pchrist joined #scheme 2015-12-30T22:52:17Z ecraven joined #scheme 2015-12-30T22:52:53Z jcowan: On the first call, is lat empty? No. Is car lat, namely 'ice, equal to old? No. Then the answer is 'ice consed on to the call (insertR 'fudge 'topping '(cream with fudge)) 2015-12-30T22:53:54Z jcowan: s/with fudge/with fudge for dessert 2015-12-30T22:53:56Z amoe joined #scheme 2015-12-30T22:54:36Z jcowan: The recursion takes the structure apart *implicitly* and the calls to cons build it up again. You do not need to maintain the new version anywhere, it is done implicitly for you 2015-12-30T22:54:50Z tmtwd quit (Ping timeout: 272 seconds) 2015-12-30T22:57:00Z n_blownapart: that is trippy. so what was your notation s/with fudge/with fudge for dessert ... the s part ? 2015-12-30T22:57:24Z jcowan: Oh, s/foo/bar/ means "I made a mistake, for 'foo' read 'bar'" 2015-12-30T22:57:46Z jcowan: substitute foo with bar 2015-12-30T22:57:54Z jcowan: Nothing to do with Scheme 2015-12-30T22:58:38Z jcowan: It's like an inductive definition. The inductive definition of n! is: if n is zero, then 1, else n * (n-1)!, right? 2015-12-30T22:59:27Z jcowan: That translates directly into Scheme as (define (fact n) (if (= n 0) 1 (* n (fact (- n 1))))) 2015-12-30T22:59:32Z n_blownapart: ok, thanks kindly jcowan .. I was thinking buffer, but 'Ice' is going along for the ride, then ice cream. There is no 'buffer' where a line of code actually strips of the (car lat) on each recursion... 2015-12-30T22:59:41Z jcowan: Right 2015-12-30T22:59:48Z jcowan: or rather there is, but it is completely behind the scenes 2015-12-30T23:00:01Z jcowan: You don't ask when you multiply 4 * 5 where the four 5s are being held 2015-12-30T23:00:07Z jcowan: It just happens 2015-12-30T23:00:47Z n_blownapart: ok I will ponder that last part .... excellent. yeah that is a big part of my problem. I think coding is like building a motorcycle engine...where nothing is implicit ! 2015-12-30T23:01:13Z n_blownapart: I always look for *precisely where* something is happening. 2015-12-30T23:01:28Z n_blownapart: many thanks. I get it now jcowan 2015-12-30T23:01:57Z jcowan_ joined #scheme 2015-12-30T23:03:14Z n_blownapart: this is key to move on in the book. what do you think of the little schemer, pedagogically speaking? 2015-12-30T23:03:35Z n_blownapart: It is not always thorough, it seems. 2015-12-30T23:03:36Z jcowan_: Hard to say because I already knew Lisp/Scheme when I read it 2015-12-30T23:03:58Z n_blownapart: thank you 2015-12-30T23:04:13Z jcowan_: N0 one book can teach everybody, and no one teacher either 2015-12-30T23:04:19Z jcowan quit (Ping timeout: 245 seconds) 2015-12-30T23:04:42Z n_blownapart: yeah, I heard good things about the scheme programming language. straightforward 2015-12-30T23:04:45Z jcowan_: Socrates, they say, didn't write down his teachings because he believed so strongly in person-to-person work 2015-12-30T23:04:52Z jcowan_ is now known as jcowan 2015-12-30T23:05:23Z n_blownapart: I wish I had a tutor. I spend so much time on details incomprehensible because of wording / phrasing. 2015-12-30T23:07:37Z n_blownapart: Socrates was too much of a rationalist. I've been reading William Blake, an anti-platonist socratist. fantastic btw 2015-12-30T23:08:14Z n_blownapart: a real shaman. anyway, thanks ! 2015-12-30T23:10:38Z karswell quit (Read error: Connection reset by peer) 2015-12-30T23:11:00Z karswell joined #scheme 2015-12-30T23:13:17Z lambda-11235 joined #scheme 2015-12-30T23:16:05Z jcowan: n_blownapart: "What now is Prov'd was once only Imagin'd" 2015-12-30T23:17:09Z jcowan: "To Generalize is to be an Idiot. To Particularize is the Alone Distinction of Merit — General Knowledges are those Knowledges that Idiots possess." 2015-12-30T23:18:02Z jcowan: and finally 2015-12-30T23:18:29Z jcowan: "If the fool would persist in his folly he would become wise", which should be the motto of all Lispers 2015-12-30T23:23:57Z civodul quit (Quit: ERC (IRC client for Emacs 24.5.1)) 2015-12-30T23:24:33Z badkins joined #scheme 2015-12-30T23:25:52Z n_blownapart: jcowan: love it. Drive your cart over the bones of the dead. 2015-12-30T23:27:12Z jcowan: When you meet the Buddha on the road, kill him! 2015-12-30T23:28:03Z n_blownapart: if we fear to do the dictates of our Angels, & tremble at the Tasks set before us; if we refuse to do Spiritual Acts because of Natural Fears or Natural Desires! Who can describe the dismal torments of such a state! -- I too well remember the Threats I heard! -- If you, who are organized by Divine Providence for Spiritual communion, Refuse, & bury your Talent in the Earth, even tho' you should want Natural Bread, Sorrow and Despera 2015-12-30T23:28:03Z n_blownapart: tion pursues you thro' life, & after death shame & confusion of face to eternity. 2015-12-30T23:41:24Z jakk quit (Ping timeout: 256 seconds) 2015-12-30T23:41:34Z jakk joined #scheme 2015-12-30T23:56:03Z taylan joined #scheme 2015-12-30T23:59:20Z daviid` quit (Ping timeout: 245 seconds)