2015-12-24T00:00:34Z n_blownapart: Little Schemer is written in a series of riddles. Necrosporus 2015-12-24T00:03:37Z oleo__ joined #scheme 2015-12-24T00:05:51Z Necrosporus: I know 2015-12-24T00:06:05Z Necrosporus: but is it supposed to teach something that is not covered in SICP? 2015-12-24T00:06:11Z oleo_ quit (Ping timeout: 264 seconds) 2015-12-24T00:06:31Z wasamasa: nope 2015-12-24T00:06:43Z wasamasa: well, unless you managed finishing SICP without understanding recursion 2015-12-24T00:07:20Z Necrosporus: To understand recursion you first need to understand recursion 2015-12-24T00:07:29Z Menche: :D 2015-12-24T00:09:27Z Necrosporus: The next sentence will help you with understanding mutual recursion. Read the first sentence if you did not understand mutual recursion yet. 2015-12-24T00:10:46Z Menche: does define work differently in r7rs from r5rs? 2015-12-24T00:13:26Z Menche: hrm, getting unbound variable 2015-12-24T00:14:31Z teurastaja: (define (recursion) (recursion)) 2015-12-24T00:15:11Z teurastaja: rudybot: (define (recursion) (recursion)) 2015-12-24T00:15:11Z rudybot: teurastaja: Done. 2015-12-24T00:15:33Z teurastaja: rudybot: (recursion) 2015-12-24T00:15:44Z rudybot: teurastaja: error: with-limit: out of time 2015-12-24T00:16:05Z Menche: IRC REPL? 2015-12-24T00:16:20Z Necrosporus: (+ 2 2) 2015-12-24T00:16:35Z Menche: rudybot, (+ 2 2) 2015-12-24T00:16:36Z rudybot: Menche: your sandbox is ready 2015-12-24T00:16:36Z rudybot: Menche: ; Value: 4 2015-12-24T00:16:46Z teurastaja: rudybot: (exit) 2015-12-24T00:16:46Z rudybot: teurastaja: error: evaluator: terminated (exited) 2015-12-24T00:16:51Z teurastaja: rudybot: (exit) 2015-12-24T00:16:51Z rudybot: teurastaja: your sandbox is ready 2015-12-24T00:16:52Z rudybot: teurastaja: error: evaluator: terminated (exited) 2015-12-24T00:16:57Z Menche: rudybot, (exit) 2015-12-24T00:16:57Z rudybot: Menche: error: evaluator: terminated (exited) 2015-12-24T00:17:12Z teurastaja: hmm 2015-12-24T00:17:28Z Necrosporus: rudybot, (define (exit) (+ 2 2)) 2015-12-24T00:17:28Z rudybot: Necrosporus: your sandbox is ready 2015-12-24T00:17:28Z rudybot: Necrosporus: Done. 2015-12-24T00:17:36Z Necrosporus: rudybot, (exit) 2015-12-24T00:17:37Z rudybot: Necrosporus: ; Value: 4 2015-12-24T00:17:50Z Menche: what does rudybot use to evaluate these? 2015-12-24T00:17:58Z teurastaja: a sandbox 2015-12-24T00:18:27Z teurastaja: on a server 2015-12-24T00:18:27Z Menche: does it use a full scheme implementation? 2015-12-24T00:19:47Z Menche: rudybot, (define fib (lambda (x) (letrec ((inner (lambda (a b n x) (if (>= n x) b (inner b (+ a b) (+ n 1) x))))) (inner 0 1 1 x)))) 2015-12-24T00:19:47Z rudybot: Menche: your sandbox is ready 2015-12-24T00:19:47Z rudybot: Menche: Done. 2015-12-24T00:19:57Z Menche: rudybot, (display (fib 10)) (newline) 2015-12-24T00:19:58Z rudybot: Menche: but forgot about fib define 2015-12-24T00:20:06Z Menche: huh? 2015-12-24T00:20:10Z Menche: rudybot, (define fib (lambda (x) (letrec ((inner (lambda (a b n x) (if (>= n x) b (inner b (+ a b) (+ n 1) x))))) (inner 0 1 1 x)))) 2015-12-24T00:20:11Z rudybot: Menche: Done. 2015-12-24T00:20:15Z Menche: rudybot, (display (fib 10)) 2015-12-24T00:20:15Z rudybot: Menche: ; stdout: "55" 2015-12-24T00:20:18Z teurastaja: rudybot: source 2015-12-24T00:20:19Z rudybot: teurastaja: git clone git://github.com/offby1/rudybot.git 2015-12-24T00:21:02Z Menche: ah, racket 2015-12-24T00:26:46Z Necrosporus: rudybot, (define (fibn n) (if (< n 2) n (+ (fibn (- n 1)) (fibn (- n 2))))) (fibn 12) 2015-12-24T00:26:47Z rudybot: Necrosporus: e.g. (define (make-adder n) (lambda (x) (+ x n))) (define five-adder (make-adder 5)) (five-adder 7) = 12 2015-12-24T00:26:56Z Necrosporus: rudybot, (define (fibn n) (if (< n 2) n (+ (fibn (- n 1)) (fibn (- n 2))))) 2015-12-24T00:26:57Z rudybot: Necrosporus: Done. 2015-12-24T00:26:59Z wildlander quit (Quit: Saliendo) 2015-12-24T00:27:07Z Necrosporus: rudybot, (fibn 100) 2015-12-24T00:27:18Z rudybot: Necrosporus: error: with-limit: out of time 2015-12-24T00:27:48Z Menche: rudybot, (fib 100) 2015-12-24T00:27:48Z rudybot: Menche: ; Value: 354224848179261915075 2015-12-24T00:27:58Z Necrosporus: rudybot, (fibn 40) 2015-12-24T00:28:03Z rudybot: Necrosporus: ; Value: 102334155 2015-12-24T00:28:22Z Necrosporus: Menche, I'm trying to determine its limit. Your fib is too fast for that 2015-12-24T00:28:26Z Necrosporus: rudybot, (fibn 60) 2015-12-24T00:28:28Z Menche: ah 2015-12-24T00:28:37Z rudybot: Necrosporus: error: with-limit: out of time 2015-12-24T00:28:40Z Necrosporus: rudybot, (fibn 50) 2015-12-24T00:28:41Z teurastaja: your implementation is not tail-recursive 2015-12-24T00:28:50Z rudybot: Necrosporus: error: with-limit: out of time 2015-12-24T00:28:51Z Necrosporus: Yes, and it's the point 2015-12-24T00:28:57Z Necrosporus: rudybot, (fibn 45) 2015-12-24T00:29:07Z rudybot: Necrosporus: error: with-limit: out of time 2015-12-24T00:29:12Z Necrosporus: rudybot, (fibn 42) 2015-12-24T00:29:22Z rudybot: Necrosporus: error: with-limit: out of time 2015-12-24T00:29:25Z Necrosporus: rudybot, (fibn 41) 2015-12-24T00:29:32Z rudybot: Necrosporus: ; Value: 165580141 2015-12-24T00:29:37Z Necrosporus: binary search done 2015-12-24T00:30:40Z Necrosporus: So, 42 the smallest number rudybot can't calculate fibn for? 2015-12-24T00:30:50Z Menche: 42 is the answer 2015-12-24T00:31:08Z davexunit joined #scheme 2015-12-24T00:31:13Z teurastaja: make it tail-recursive 2015-12-24T00:31:33Z Necrosporus: It could be sped up without tail-recursion 2015-12-24T00:31:33Z teurastaja: and see 2015-12-24T00:31:39Z Menche: is mine tail recursive? 2015-12-24T00:31:44Z Necrosporus: probably 2015-12-24T00:32:16Z Necrosporus: Yes, it seems it is 2015-12-24T00:33:02Z Necrosporus: teurastaja, memoization could speed up my version so it work for numbers below 1000 or so 2015-12-24T00:33:05Z Menche: rudybot, (fib 4200) 2015-12-24T00:33:05Z rudybot: Menche: ; Value: 2503825439978974638020145090821104155728314551138722626062403478737279959820333765041873146536055041417285119948235556491004732034466831213648254011814573289549047886960606679589457248216019697407611656837749583673582457374615076226179192472662277984207325232662812913339038812962448218903697556962899929258527084880894042829079035368177670073083874174933139159320198415029697782819043657709894985189719470688836 2015-12-24T00:33:16Z Menche: O_O 2015-12-24T00:33:38Z Necrosporus: rudybot, (fib 2503825) 2015-12-24T00:33:38Z rudybot: Necrosporus: error: fib: undefined; cannot reference an identifier before its definition in module: 'program 2015-12-24T00:33:59Z Menche: apparently each of us has our own sandbox 2015-12-24T00:34:22Z Menche: > (define fib (lambda (x) (letrec ((inner (lambda (a b n x) (if (>= n x) b (inner b (+ a b) (+ n 1) x))))) (inner 0 1 1 x)))) 2015-12-24T00:34:33Z Necrosporus: does scheme have an operation to take index from a list? 2015-12-24T00:34:45Z Menche: rudybot, (fib 2503825) 2015-12-24T00:34:53Z Necrosporus: I need an array to implement memoization 2015-12-24T00:34:56Z rudybot: Menche: error: with-limit: out of time 2015-12-24T00:35:00Z Menche: haha! 2015-12-24T00:35:02Z Menche: hit the limit with mine 2015-12-24T00:35:04Z teurastaja: vector 2015-12-24T00:35:20Z Menche: rudybot, (fib 42000) 2015-12-24T00:35:20Z rudybot: Menche: ; Value: 1353335570995040826865997520384898242797717599833170618016386671762125737318228143034971937375552332634103914600837749937513329103838444729643057791378308694807322459285720751909716872107207018119753423181853076684499390425406914461004921194478889245636634331458011796450435767367092615681532032287031000175949332571340209881110189296128485409929404308732912488175086510596969655681259303990394699445666887248448 2015-12-24T00:35:25Z Menche: rudybot, (fib 420000) 2015-12-24T00:35:29Z rudybot: Menche: ; Value: 2880182378079832935639141907001162679844606821600425572539780979479692542695601655192049480971127938500834039838110340483341456530037128447396409837280482447058266144898672828517681965051030610733717165323650223022695376901657775539207848130570003030405358804837159062323397819202270532610176970447487386510883643660711985264476144026686980453871069184625591157172967604612128723374263453542600731541100844315304 2015-12-24T00:35:30Z daviid` joined #scheme 2015-12-24T00:35:50Z Necrosporus: I think that it does not display all digits 2015-12-24T00:35:55Z Menche has no idea if those are accurate 2015-12-24T00:35:55Z Necrosporus: Also try to use log 2015-12-24T00:36:07Z Necrosporus: Menche, try (log (fib number)) 2015-12-24T00:36:11Z teurastaja: rudybot: (vector-ref (vector 1 2 3) 2) 2015-12-24T00:36:11Z rudybot: teurastaja: ; Value: 3 2015-12-24T00:36:17Z Menche: rudybot, (log (fib 420000)) 2015-12-24T00:36:22Z rudybot: Menche: ; Value: 202108.16180607723 2015-12-24T00:36:36Z Necrosporus: Interesting. My guile cant handle that 2015-12-24T00:37:34Z Menche: is vector support from an srfi? 2015-12-24T00:37:48Z teurastaja: its in the standard 2015-12-24T00:43:46Z teurastaja: but in scheme you can make everything from pairs 2015-12-24T00:44:24Z teurastaja: including vectors 2015-12-24T00:44:45Z n_blownapart quit 2015-12-24T00:48:27Z qwan joined #scheme 2015-12-24T00:50:13Z teurastaja quit (Quit: ChatZilla 0.9.92 [SeaMonkey 2.33.1/20150321194901]) 2015-12-24T00:50:17Z Beluki quit (Quit: Beluki) 2015-12-24T00:55:48Z Necrosporus: Menche, so I have read only first chapter of SICP and do not know how to work with vectors in scheme yet. But if you first assign 0 and 1 to vector and then do (define (fib n) (if (is-in-vector n) (take-value-by-index n) (+ (fib (- n 1)) (fib (- n 2))))) 2015-12-24T00:56:20Z Necrosporus: then my version of fib will be fast enough even without tail recursion (though will fail because of memory constraints) 2015-12-24T00:57:11Z Necrosporus: Oh, I forgot to assign to vector before returning 2015-12-24T01:01:50Z Menche: what do you recommend for a scheme reference? 2015-12-24T01:01:57Z Menche: the standard document? 2015-12-24T01:11:37Z Menche: mm, does seem to be fairly easy to read 2015-12-24T01:12:05Z Menche: seems it's designed to be printed, has two columns on each page 2015-12-24T01:19:02Z nilg quit (Remote host closed the connection) 2015-12-24T01:25:38Z aeth quit (Ping timeout: 255 seconds) 2015-12-24T01:34:41Z aeth joined #scheme 2015-12-24T01:36:32Z Necrosporus: Menche, dunno, guile docs? 2015-12-24T01:36:42Z Necrosporus: or racket docs 2015-12-24T01:37:18Z Necrosporus: Why (car) and (cdr) instead of (head) and (tail)? It would be much easier to grasp this way and only one letter longer 2015-12-24T01:50:07Z jcowan joined #scheme 2015-12-24T01:55:23Z Necrosporus: jcowan, hello 2015-12-24T01:55:37Z jcowan: hey ho, Necrosporus 2015-12-24T01:55:39Z Necrosporus: Also... (car) is suddenly not related to automobiles 2015-12-24T01:56:10Z Necrosporus: And (cdr) has no relation to recordable optical discs 2015-12-24T01:56:38Z Necrosporus: Why not tail and head like in haskell? 2015-12-24T01:56:41Z jcowan: The names are historical survivals too entrenched to change. The dial on a modern phone looks nothing like an instrument dial, but we still call it one. 2015-12-24T01:57:57Z Necrosporus: Ah, you mean, that old phones used disk dialer with holes for digits, and modern phones use keyboard or touchscreen 2015-12-24T02:00:54Z jcowan: Just so 2015-12-24T02:01:06Z daviid` quit (Ping timeout: 240 seconds) 2015-12-24T02:01:33Z jcowan: The disk was called a dial because it had the shape of an instrument dial or sundial or (analog) clock dial. 2015-12-24T02:02:34Z jcowan: Now that it no longer does, the name sticks. You're dealing with something almost 60 years old 2015-12-24T02:02:39Z jcowan: Lisp was born in the same year I was 2015-12-24T02:09:11Z Necrosporus: OK, but I guess, that's abbreviations? 2015-12-24T02:15:28Z aap_ joined #scheme 2015-12-24T02:18:59Z aap quit (Ping timeout: 260 seconds) 2015-12-24T02:27:41Z davexunit quit (Quit: Later) 2015-12-24T02:29:39Z joneshf-laptop joined #scheme 2015-12-24T02:33:16Z mumptai quit (Quit: Verlassend) 2015-12-24T02:33:57Z Necrosporus: If I want to make my own lisp. Is there a complete set of primitives a language must support to be called lisp? 2015-12-24T02:34:54Z Necrosporus: For example, car, cdr, arithmetic... 2015-12-24T02:36:04Z Necrosporus: Like list of procedures/special forms language could not work without 2015-12-24T02:36:20Z Necrosporus: Which could not be derived from each other 2015-12-24T02:39:02Z Necrosporus: atom, quote, eq, car, cdr, cons, cond, lambda, label, apply 2015-12-24T02:40:05Z Necrosporus: cons is append 2015-12-24T02:48:51Z magine joined #scheme 2015-12-24T03:34:20Z jcowan: Necrosporus: Cons is not append. It allocates a pair. 2015-12-24T03:37:15Z Necrosporus: I guess that label is something like define, and apply could probably take quoted lambda from a variable and apply it to arguments 2015-12-24T03:37:25Z Necrosporus: though it's just a guess, maybe I'm wrong 2015-12-24T03:40:06Z qwan quit (Read error: Connection reset by peer) 2015-12-24T03:42:21Z ArneBab_ joined #scheme 2015-12-24T03:45:23Z ArneBab quit (Ping timeout: 246 seconds) 2015-12-24T03:49:05Z mbuf joined #scheme 2015-12-24T04:07:29Z githogori joined #scheme 2015-12-24T04:12:00Z lambda-11235 joined #scheme 2015-12-24T04:27:07Z spew joined #scheme 2015-12-24T04:46:31Z Necrosporus: (cons (car list) (cdr list)) == list 2015-12-24T04:48:06Z Necrosporus: I think that TLS has too many questions about same topic... 2015-12-24T04:50:11Z Necrosporus: (((abc)) . b) 2015-12-24T04:56:02Z Menche: what exactly is the history behind the terms car and cdr? 2015-12-24T04:56:23Z Menche: stands for something address record and data record I think? 2015-12-24T04:59:36Z lambda-11235: Menche: https://en.wikipedia.org/wiki/CAR_and_CDR 2015-12-24T05:01:19Z Menche: so they were originally assembly instructions for an old computer that had hardware support for lisp 2015-12-24T05:04:42Z neoncontrails joined #scheme 2015-12-24T05:05:01Z lambda-11235: I don't think it had hardware support for lisp, they just divided the words up for greater efficiency. 2015-12-24T05:06:15Z lambda-11235: They being the lisp devs. 2015-12-24T05:06:40Z spew quit (Quit: leaving) 2015-12-24T05:08:51Z pierpa quit (Quit: ERC Version 5.3 (IRC client for Emacs)) 2015-12-24T05:17:14Z Necrosporus: Is (quote ... ) form necessary or ' notation is enough? 2015-12-24T05:17:16Z pjb: Well, the 7090 had an instruction XEC that executed a code operation stored as data. A kind of assembler EVAL. 2015-12-24T05:17:51Z pjb: Also, CAR and CDR where used to build lists before LISP, in the Fortran library FLPL. So definitely before LISP. 2015-12-24T05:17:57Z Necrosporus: Also I can't find what (label ) is 2015-12-24T05:18:12Z pjb: defines functions. 2015-12-24T05:19:00Z Necrosporus: So it's same as (define)? 2015-12-24T05:19:14Z pjb: More like letrec. 2015-12-24T05:19:43Z Menche: I don't see label in the procedure index of r7rs 2015-12-24T05:20:32Z pjb: Menche: so, the 709 and 7090 computers had 36-bit words. The instructions were one word, organized as 3-bit of opcode, 15 bit of decrement, 3 bits of flags, 15 bits of address. It had only 32-Kword of memory max. 2015-12-24T05:22:06Z pjb: Menche: the "decrement" part was a tric to index arrays and fields, using the address to point to the LAST element of the array or field, and the decrement to offset back into it. This would definitely avoid buffer overflows (back in the 1950's!). 2015-12-24T05:26:03Z pjb: Menche: nonetheless, when you didn't use indexed addressing, the Contents of decrement part of the Register was free to store an address. There were those instructions to extract these fields from an instruction stored in a register (come to think of it, yet another meta-assembler feature): CPR, CDR, CTR, CAR. Hence, you could store two addresses in a word, and there were machine code instructions to extract or store them easily, and 2015-12-24T05:26:03Z pjb: for two convenient 3-bit fields that could be used as type tags! 2015-12-24T05:26:28Z badkins quit (Remote host closed the connection) 2015-12-24T05:26:32Z pjb: FLPL: http://informatimago.com/articles/flpl/flpl.html 2015-12-24T05:32:26Z turtleman_ quit (Ping timeout: 276 seconds) 2015-12-24T06:20:53Z neoncontrails quit (Remote host closed the connection) 2015-12-24T06:25:54Z jusss joined #scheme 2015-12-24T06:44:16Z mutbuerger quit (Read error: Connection reset by peer) 2015-12-24T06:50:08Z jusss: http://community.schemewiki.org/?call-with-current-continuation , I still have a little confused ,(hefty-computation superfluous-computation) let superfluous-computation as (lambda (k) ...), ok , but (set! do-other-stuff (call/cc do-other-stuff))) in superfluous-computation make me confused, like (lambda (k) (set! k (call/cc k)) 2015-12-24T06:52:00Z neoncontrails joined #scheme 2015-12-24T06:52:53Z jusss: taylan: excuse me, are you there? 2015-12-24T07:21:39Z contrapunctus joined #scheme 2015-12-24T07:21:57Z contrapunctus: o/ 2015-12-24T07:23:18Z contrapunctus: I have (odd as it may sound) a CL question which I daren't ask in #lisp, and was advised to give it a shot here - are there any hygienic macro libraries for Common Lisp? 2015-12-24T07:23:28Z contrapunctus: (I've searched quite a bit but couldn't find anything.) 2015-12-24T07:26:29Z jusss: contrapunctus: you can try it in #lisp, and there's no one online it's like 2015-12-24T07:27:09Z lambda-11235: contrapunctus: You might want to ask on ##lisp, which serves all lisps. 2015-12-24T07:27:31Z contrapunctus: ah, yeah, that's another option. 2015-12-24T07:27:39Z contrapunctus: jusss: they'll chuck me out :\ 2015-12-24T07:29:23Z jusss: contrapunctus: I even ask a call/cc problem in #lisp last night, don't be shy 2015-12-24T07:59:15Z Necrosporus: What do you think about Arc? http://www.paulgraham.com/arc0.html 2015-12-24T08:07:52Z wasamasa: arc is a toddler 2015-12-24T08:09:32Z contrapunctus: in the opening image on this page - http://c2.com/cgi/wiki?SmugLispWeenie 2015-12-24T08:13:35Z neoncontrails quit (Remote host closed the connection) 2015-12-24T08:19:37Z Necrosporus: It maybe is 2015-12-24T08:20:36Z alezost joined #scheme 2015-12-24T08:20:40Z Necrosporus: But author thinks that it's already better than scheme and common lisp for example 2015-12-24T08:30:49Z qwan joined #scheme 2015-12-24T08:31:20Z lambda-11235 quit (Quit: Bye) 2015-12-24T08:32:12Z contrapunctus: Necrosporus: it was interesting (atleast for me) to read the text file guide thing they have/had 2015-12-24T08:32:22Z contrapunctus: I might try it one day 2015-12-24T08:34:58Z contrapunctus: but a. I'm not a fan of Racket (not in a technical sense) and b. I'm more interested in a language that provides the stability of a proper spec - and I feel that's best provided for by Common Lisp. (well, desiring that is possibly i. pointless and ii. not relevant anymore, but whatever...) 2015-12-24T08:34:59Z neoncontrails joined #scheme 2015-12-24T08:35:39Z contrapunctus: Common Lisp * (and to a lesser extent, Scheme) 2015-12-24T08:35:40Z qwan quit (Remote host closed the connection) 2015-12-24T08:37:07Z Necrosporus: contrapunctus, try Tcl? 2015-12-24T08:37:44Z Necrosporus: It's just like lisp but without ((())) and with stable api 2015-12-24T08:37:58Z Necrosporus: in fact it's one of most backward-compatible languages 2015-12-24T08:38:13Z contrapunctus: oh, really really really not interested in non-Lisps :| 2015-12-24T08:39:30Z contrapunctus: (even though I'll probably have to learn C at some point, and I should look around other languages - assimilating the strengths of other languages is how Lisps function best, I think.) 2015-12-24T08:42:15Z contrapunctus: Necrosporus: re: 'like lisp but without ((()))' ...are you the developer of Din? 2015-12-24T08:43:13Z Necrosporus: nope 2015-12-24T08:43:30Z contrapunctus: heh, okay 2015-12-24T08:43:35Z Necrosporus: contrapunctus, define lisp 2015-12-24T08:43:42Z Necrosporus: Tcl has all features of lisps 2015-12-24T08:44:06Z Necrosporus: it only represent them in other way, without excessive use of (()) 2015-12-24T08:45:14Z Necrosporus: (define (lat? l) (and (atom? (car l)) (or (null? (cdr l)) (lat? (cdr l))))) 2015-12-24T08:46:44Z contrapunctus: I'm a newbie and will therefore refrain from continuing this discussion. 2015-12-24T08:49:20Z contrapunctus: (Perhaps someone more experienced will offer to flog this dead horse.) 2015-12-24T08:50:36Z Necrosporus: contrapunctus, well, why exactly do you want lisp? 2015-12-24T08:51:33Z Necrosporus: rudybot, (define (lat? l) (or (null? (cdr l)) (and (atom? (car l)) (lat? (cdr l))))) 2015-12-24T08:51:33Z rudybot: Necrosporus: Done. 2015-12-24T08:53:06Z Necrosporus: rudybot, (list (lat? '(a b c)) (lat? '(a)) (lat? '((b))) (lat? '(a (b) c)) (lat? '())) 2015-12-24T08:53:06Z rudybot: Necrosporus: error: atom?: undefined; cannot reference an identifier before its definition in module: 'program 2015-12-24T08:53:14Z Necrosporus: rudybot, (list (lat? '(a b c)) (lat? '(a)) (lat? '((b))) (lat? '(a (b) c)) ) 2015-12-24T08:53:14Z rudybot: Necrosporus: error: atom?: undefined; cannot reference an identifier before its definition in module: 'program 2015-12-24T08:53:39Z Necrosporus: rudybot, (define (atom? x) (and (not (pair? x)) (not (null? x)))) 2015-12-24T08:53:39Z rudybot: Necrosporus: Done. 2015-12-24T08:53:42Z Necrosporus: rudybot, (list (lat? '(a b c)) (lat? '(a)) (lat? '((b))) (lat? '(a (b) c)) (lat? '())) 2015-12-24T08:53:43Z rudybot: Necrosporus: error: cdr: contract violation expected: pair? given: '() 2015-12-24T08:54:08Z Necrosporus: rudybot, (list (lat? '(a b c)) (lat? '(a)) (lat? '((b))) (lat? '(a (b) c)) (lat? '((a) b c))) 2015-12-24T08:54:09Z rudybot: Necrosporus: ; Value: '(#t #t #t #f #f) 2015-12-24T08:54:29Z Necrosporus: My version of lat? works except with null list 2015-12-24T08:54:45Z Necrosporus: And it would work if (or) was lazy 2015-12-24T08:57:56Z Necrosporus: it is actually 2015-12-24T08:59:02Z Necrosporus: rudybot, (define (lat? l) (or (null? l) (and (atom? (car l)) (lat? (cdr l))))) 2015-12-24T08:59:02Z Necrosporus: (list (lat? '(a b c)) (lat? '(a)) (lat? '((b))) (lat? '(a (b) c)) (lat? '((a) b c) (lat? '()))) 2015-12-24T08:59:02Z rudybot: Necrosporus: Done. 2015-12-24T08:59:09Z Necrosporus: rudybot, (list (lat? '(a b c)) (lat? '(a)) (lat? '((b))) (lat? '(a (b) c)) (lat? '((a) b c) (lat? '()))) 2015-12-24T08:59:09Z rudybot: Necrosporus: error: lat?: arity mismatch; the expected number of arguments does not match the given number expected: 1 given: 2 arguments...: '((a) b c) #t 2015-12-24T09:05:31Z Necrosporus: rudybot, (define lt? (lambda (l) (cond ((null? l) #t) ((atom? (car l)) (lt? (cdr l))) (else #f)))) 2015-12-24T09:05:31Z rudybot: Necrosporus: Done. 2015-12-24T09:05:48Z Necrosporus: rudybot, (list (lt? '(a b c)) (lt? '(a)) (lt? '((b))) (lt? '(a (b) c)) (lt? '((a) b c) (lt? '()))) 2015-12-24T09:05:48Z rudybot: Necrosporus: error: lt?: arity mismatch; the expected number of arguments does not match the given number expected: 1 given: 2 arguments...: '((a) b c) #t 2015-12-24T09:05:57Z Necrosporus: rudybot, (list (lt? '(a b c)) (lt? '(a)) (lt? '((b))) (lt? '(a (b) c)) (lt? '((a)) b c) (lt? '())) 2015-12-24T09:05:57Z rudybot: Necrosporus: error: b: undefined; cannot reference an identifier before its definition in module: 'program 2015-12-24T09:08:07Z Necrosporus: Seems my version of lat? is actually shorter that one that presented in TLS 2015-12-24T09:25:39Z neoncont_ joined #scheme 2015-12-24T09:26:16Z neoncontrails quit (Ping timeout: 250 seconds) 2015-12-24T09:26:26Z neoncont_ is now known as neoncontrails 2015-12-24T09:35:09Z mmc joined #scheme 2015-12-24T09:48:28Z neoncontrails quit (Remote host closed the connection) 2015-12-24T09:49:18Z neoncontrails joined #scheme 2015-12-24T09:49:29Z oleo__ quit (Quit: Verlassend) 2015-12-24T09:50:31Z rszeno joined #scheme 2015-12-24T09:51:38Z saul: Necrosporus, your version would result in slightly more complex internal code since the evaluation of the first argument to the OR needs to be saved for potential later use. 2015-12-24T09:52:43Z saul: * first non-false argument 2015-12-24T09:54:20Z Necrosporus: (or a b) could be replaced with (if (not a) b) and (and c d) could be replaced with (if c d) 2015-12-24T09:55:37Z saul: IF is basically just syntactic sugar for COND, and vice-versa. 2015-12-24T09:56:02Z oleo joined #scheme 2015-12-24T09:56:03Z oleo quit (Changing host) 2015-12-24T09:56:03Z oleo joined #scheme 2015-12-24T09:58:16Z Necrosporus: It seems that I'm wrong about equality of if and and 2015-12-24T09:59:35Z Necrosporus: saul, I do not get it anyway. yes, a #t or #f would be saved 2015-12-24T09:59:57Z Necrosporus: and returned 2015-12-24T09:59:58Z saul: Well, AND returns the evaluation of the test -- while for IF an expression is supplied. 2015-12-24T10:00:30Z Necrosporus: (if c d c) actually 2015-12-24T10:02:13Z Necrosporus: (if (not a) b a) 2015-12-24T10:03:16Z saul: That would evaluate 'a' twice (for the #t case). (and b a) would only evaluate 'a' once. 2015-12-24T10:03:35Z saul: *(and a b) 2015-12-24T10:04:24Z saul: You might not want 'a' to be evaluated more than once. 2015-12-24T10:06:21Z Necrosporus: Yes. So I do not see a problem with my code. It's shorter by 3 terms (why do they use lambda if define supports sugar for that?) 2015-12-24T10:06:57Z wasamasa: because they've been reading The Little Schemer 2015-12-24T10:07:25Z wasamasa: the only other reason I can think of is when you have something returning a lambda you'd like to have bound to a suitable name 2015-12-24T10:10:44Z saul: Personally, I would use (define (f x) ... in all cases except when the lambda needs to be wrapped within an environment. For example (define f (let ((value 0)) (lambda (x) (+ value 1))) 2015-12-24T10:13:15Z Necrosporus: rudybot, (define (member? a l) (and (not (null? l)) (or (eq? (car l) a) (member? a (cdr l))))) 2015-12-24T10:13:15Z rudybot: Necrosporus: Done. 2015-12-24T10:14:17Z Necrosporus: (list (member? c '(a b c d)) (member? a '(b c)) (member? a '())) 2015-12-24T10:14:26Z Necrosporus: rudybot, (list (member? c '(a b c d)) (member? a '(b c)) (member? a '())) 2015-12-24T10:14:26Z rudybot: Necrosporus: error: c: undefined; cannot reference an identifier before its definition in module: 'program 2015-12-24T10:14:52Z Necrosporus: rudybot, (list (member? 'c '(a b c d)) (member? 'a '(b c)) (member? 'a '())) 2015-12-24T10:14:53Z rudybot: Necrosporus: ; Value: '(#t #f #f) 2015-12-24T10:15:11Z Necrosporus: saul, is this version bad too? 2015-12-24T10:18:14Z Necrosporus: Their version is again longer, even if you strip lambda: 2015-12-24T10:18:14Z Necrosporus: rudybot, (define (member? a lat) (cond ((null? lat) #f) (else (or (eq? (car lat) a) (member? a (cdr lat)))))) 2015-12-24T10:18:15Z rudybot: Necrosporus: Done. 2015-12-24T10:18:24Z Necrosporus: (list (member? c '(a b c d)) (member? a '(b c)) (member? a '())) 2015-12-24T10:18:39Z Necrosporus: rudybot (list (member? c '(a b c d)) (member? a '(b c)) (member? a '())) 2015-12-24T10:19:57Z Necrosporus: rudybot, (list (member? c '(a b c d)) (member? a '(b c)) (member? a '())) 2015-12-24T10:19:57Z rudybot: Necrosporus: error: c: undefined; cannot reference an identifier before its definition in module: 'program 2015-12-24T10:20:27Z Necrosporus: rudybot, (list (member? 'c '(a b c d)) (member? 'a '(b c)) (member? 'a '())) 2015-12-24T10:20:28Z rudybot: Necrosporus: ; Value: '(#t #f #f) 2015-12-24T10:28:10Z saul: Necrosporus, I'm not saying your code is at all bad, just that the net result would not be an improvement. Even though your code has fewer terms, the internal execution would be the same (possibly a little worse but that would be implementation dependent). 2015-12-24T10:28:11Z alezost quit (Quit: I live in GuixSD and Emacs ) 2015-12-24T10:36:49Z Necrosporus: saul, well, I do not care about performance unless it's slow 2015-12-24T10:38:00Z Steverman joined #scheme 2015-12-24T10:46:10Z jusss: if k is a continuation, what's the mean of (call/cc k) 2015-12-24T10:46:41Z magine quit (Remote host closed the connection) 2015-12-24T10:57:20Z rx80: jusss: https://en.wikipedia.org/wiki/Call-with-current-continuation 2015-12-24T10:58:12Z jusss: rx80: I see it, but it doesn't give me a answer about (call/cc continuation) 2015-12-24T10:58:22Z rx80: jusss: it does 2015-12-24T10:58:35Z rx80: call/cc is short for call-with-current-continuation 2015-12-24T10:58:45Z rx80: look at examples 2015-12-24T10:59:12Z jusss: rx80: http://community.schemewiki.org/?call-with-current-continuation , in (define (superfluous-computation do-other-stuff) I see (call/cc k) I mean k is continuation 2015-12-24T10:59:53Z jusss: rx80: examples in en.wikipedia.org don't show (call/cc continuation) 2015-12-24T11:00:48Z jusss: (call/cc (lambda (k) ...)) yes, k is continuation, so what means (call/cc k) ? 2015-12-24T11:01:15Z rx80: depends what k is? 2015-12-24T11:01:32Z jusss: k is a continuation 2015-12-24T11:01:55Z jusss: the next what to do 2015-12-24T11:02:10Z rx80: then that's what's called 2015-12-24T11:03:11Z jusss: rx80: but I don't see this usage about call/cc 2015-12-24T11:03:12Z rx80: (call/cc k) applies the current continuation to k 2015-12-24T11:04:04Z rx80: of course you won't see all possible usages in documentation 2015-12-24T11:06:45Z jusss: rx80: see this http://community.schemewiki.org/?call-with-current-continuation , coroutines, (hefty-computation superfluous-computation) make superfluous-computation as a (lambda (k) ...) and make superfluous-computation's parameter do-other-stuff as a continuation of hefty-compuatation, so (set! do-other-stuff (call/cc do-other-stuff))) means what ? 2015-12-24T11:07:31Z jusss: (call/cc do-other-sutff) means (call/cc hefty-computation's-continuation) 2015-12-24T11:08:22Z jusss: rx80: so it's the problem, (call/cc continuation) I never see this usage, and I don't know what it means 2015-12-24T11:08:42Z rx80: it means what it means in every other case :) 2015-12-24T11:09:08Z rx80: call some code with the current continuation 2015-12-24T11:09:58Z jusss: rx80: but why there's not document introduce (call/cc continuation) ? 2015-12-24T11:10:19Z jusss: or it's normal or wrong usage? 2015-12-24T11:10:59Z rx80: it's normal 2015-12-24T11:11:11Z jusss: every docs say (call/cc (lambda (k) ...)) but why it have (call/cc k) ? 2015-12-24T11:11:45Z rx80: because (call/cc k) just means "call code k with current continuation" 2015-12-24T11:12:09Z rx80: in your doc example, the "k" is "the code generated by (lambda (k) ..)" 2015-12-24T11:12:44Z rx80: also.... "k" is not same "k" in both examples, of course 2015-12-24T11:13:34Z rx80: i think the "k" got you confused 2015-12-24T11:13:36Z rx80: maybe 2015-12-24T11:14:15Z jusss: rx80: but I think k is same in both examples, do you read this http://community.schemewiki.org/?call-with-current-continuation ? 2015-12-24T11:14:21Z rx80: nono, look 2015-12-24T11:14:38Z jusss: rx80: please read it 2015-12-24T11:14:47Z rx80: (define code (lambda (k) ...)) 2015-12-24T11:14:52Z rx80: (call/cc code) 2015-12-24T11:15:03Z jusss: you'll know what make me confused 2015-12-24T11:15:50Z jusss: rx80: (define code (lambda (k) (call/cc k))) (call/cc code) , ok then , you know the problem ? 2015-12-24T11:16:15Z rx80: there is no problem :) 2015-12-24T11:16:31Z jusss: rx80: (call/cc code) make k as a continuation, and what it means (call/cc k) ? 2015-12-24T11:17:13Z jusss: there's (call/cc k) in (define code ...) ! 2015-12-24T11:17:30Z jusss: and now k is continuation, so what's (call/cc k) ? 2015-12-24T11:18:12Z jusss: k is alway meaning continuation in the examples I said 2015-12-24T11:18:43Z jusss: (call/cc (lambda...)) is normal , but what (call/cc continuation) ? 2015-12-24T11:19:59Z oleo: just call the continuation it is 2015-12-24T11:24:08Z karswell quit (Ping timeout: 265 seconds) 2015-12-24T11:47:11Z jusss: aha, see this (let ((a (call/cc (lambda (z) z)))) (display 0) (call/cc a) (display 1)) 2015-12-24T11:47:20Z jusss: the result: 001 2015-12-24T12:12:57Z rszeno quit (Ping timeout: 265 seconds) 2015-12-24T12:17:24Z Guest62138 quit (Quit: Bye) 2015-12-24T12:29:06Z rszeno joined #scheme 2015-12-24T12:33:29Z davexunit joined #scheme 2015-12-24T12:35:49Z mbuf quit (Quit: Ex-Chat) 2015-12-24T12:43:18Z Beluki joined #scheme 2015-12-24T12:48:03Z blackwolf quit (Quit: ERC Version 5.3 (IRC client for Emacs)) 2015-12-24T13:02:39Z rszeno quit (Quit: Leaving.) 2015-12-24T13:19:38Z aap_ is now known as aap 2015-12-24T13:22:32Z gravicappa joined #scheme 2015-12-24T13:24:17Z jusss quit (Quit: ERC (IRC client for Emacs 24.5.1)) 2015-12-24T14:21:47Z Steverman quit (Ping timeout: 264 seconds) 2015-12-24T14:23:17Z cemerick joined #scheme 2015-12-24T14:25:19Z contrapunctus quit (Quit: "bai") 2015-12-24T14:26:38Z nitrix is now known as nitrixmas 2015-12-24T14:36:12Z Steverman joined #scheme 2015-12-24T14:52:47Z pierpa joined #scheme 2015-12-24T14:54:22Z mmc quit (Quit: Leaving.) 2015-12-24T14:54:41Z mmc joined #scheme 2015-12-24T14:55:30Z mmc quit (Client Quit) 2015-12-24T15:00:06Z jcowan_ joined #scheme 2015-12-24T15:29:57Z spew joined #scheme 2015-12-24T15:30:21Z badkins joined #scheme 2015-12-24T15:34:34Z spew quit (Client Quit) 2015-12-24T15:40:04Z mbuf joined #scheme 2015-12-24T15:45:49Z octo_ is now known as octophore 2015-12-24T15:52:20Z spew joined #scheme 2015-12-24T16:00:03Z jcowan_ quit (Quit: Leaving) 2015-12-24T16:09:01Z mbuf quit (Quit: Ex-Chat) 2015-12-24T16:10:46Z turtleman_ joined #scheme 2015-12-24T16:13:30Z developernotes joined #scheme 2015-12-24T16:13:47Z spew quit (Quit: leaving) 2015-12-24T16:17:33Z vectorman68 quit (Ping timeout: 255 seconds) 2015-12-24T16:21:19Z mbuf joined #scheme 2015-12-24T16:33:52Z wildlander joined #scheme 2015-12-24T16:34:32Z cemerick quit (Remote host closed the connection) 2015-12-24T16:35:26Z Beluki quit (Quit: Beluki) 2015-12-24T16:35:42Z cemerick joined #scheme 2015-12-24T16:50:40Z mbuf quit (Quit: Ex-Chat) 2015-12-24T17:00:48Z alezost joined #scheme 2015-12-24T17:04:21Z Khisanth joined #scheme 2015-12-24T17:10:10Z lambda-11235 joined #scheme 2015-12-24T17:16:22Z developernotes quit (Quit: Textual IRC Client: www.textualapp.com) 2015-12-24T17:40:35Z sz0 joined #scheme 2015-12-24T17:45:06Z cky quit (Ping timeout: 240 seconds) 2015-12-24T17:45:24Z cky joined #scheme 2015-12-24T17:48:54Z davexunit quit (Ping timeout: 245 seconds) 2015-12-24T17:49:24Z daviid` joined #scheme 2015-12-24T17:57:15Z fizzie quit (Ping timeout: 250 seconds) 2015-12-24T17:57:15Z Riviera quit (Ping timeout: 250 seconds) 2015-12-24T17:59:07Z fizzie joined #scheme 2015-12-24T17:59:09Z Riviera joined #scheme 2015-12-24T18:00:43Z karswell joined #scheme 2015-12-24T18:04:15Z Regulator9 joined #scheme 2015-12-24T18:17:01Z Riastradh joined #scheme 2015-12-24T18:24:56Z Riastradh quit (Ping timeout: 246 seconds) 2015-12-24T18:30:44Z cemerick quit (Ping timeout: 255 seconds) 2015-12-24T18:31:12Z Fare joined #scheme 2015-12-24T18:35:48Z Riastradh joined #scheme 2015-12-24T18:50:15Z Beluki joined #scheme 2015-12-24T19:07:32Z Riastradh quit (Ping timeout: 276 seconds) 2015-12-24T19:09:54Z davexunit joined #scheme 2015-12-24T19:11:44Z neoncontrails quit (Remote host closed the connection) 2015-12-24T19:30:50Z Necrosporus: Is it possible to define special forms? 2015-12-24T19:31:11Z C-Keen: macros? 2015-12-24T19:31:25Z Necrosporus: possibly 2015-12-24T19:31:57Z C-Keen: define-syntax 2015-12-24T19:43:39Z Regulator_ joined #scheme 2015-12-24T19:45:23Z newbie joined #scheme 2015-12-24T19:45:47Z newbie is now known as Guest21308 2015-12-24T19:47:26Z Regulator9 quit (Ping timeout: 272 seconds) 2015-12-24T19:49:58Z Regulator_ quit (Ping timeout: 272 seconds) 2015-12-24T19:56:56Z daviid` quit (Ping timeout: 272 seconds) 2015-12-24T19:57:13Z neoncontrails joined #scheme 2015-12-24T20:04:20Z Pixel_Outlaw joined #scheme 2015-12-24T20:04:28Z Pixel_Outlaw: 'lo 2015-12-24T20:21:33Z pjb: Necrosporus: you want macros. 2015-12-24T20:22:34Z pjb: Necrosporus: in CL, the distinction between special form and macros is purely formal, implementations are allowed to implement special forms as macros, and macros as special forms (even functions, since they can be "open-coded" (it's a kind of inlining)). 2015-12-24T20:23:32Z pjb: Necrosporus: you may also have a look at: http://www.pipeline.com/~hbaker1/MetaCircular.html (obviously the same can be done in scheme). 2015-12-24T20:24:03Z Necrosporus: pjb, I am thinking about implementing a simplest possible lisp interpreter 2015-12-24T20:24:47Z Necrosporus: I guess, I will need at least (define) and (define-macro), as they can't be emulated with one other 2015-12-24T20:25:22Z hiroakip joined #scheme 2015-12-24T20:25:24Z pjb: Necrosporus: you should read AIM-8. 2015-12-24T20:25:38Z pjb: http://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/aim-8/ 2015-12-24T20:25:38Z rudybot: http://teensy.info/vomA1gVxNm 2015-12-24T20:26:16Z Necrosporus: Only distinction is that define expands variables and sub-expressions and define-macro does not, right? 2015-12-24T20:26:17Z pjb: Then of course, don't implement the same (there's the famous funarg problem bug in AIM-8, which scheme was invented to correct). 2015-12-24T20:26:47Z Necrosporus: My lisp is not intended to be used by anyone by me 2015-12-24T20:26:56Z Necrosporus: *but 2015-12-24T20:27:08Z pjb: Necrosporus: nope. It's only a way to delimit some kind of "primitive" in terms of semantics. But because of metacircularity between operators, you can break the circle at any operator you want. 2015-12-24T20:27:13Z Necrosporus: There are probably better implementations already around 2015-12-24T20:27:32Z pjb: Remember: you only need one instruction to make a processor Turing Complete. 2015-12-24T20:27:59Z Necrosporus: I know, but I want to make existing scheme code work either verbatim or with small corrections 2015-12-24T20:28:06Z pjb: Of course, writing a lisp is always fun, and a good thing to do early on a Sunday afternoon. 2015-12-24T20:28:07Z Necrosporus: At least simple code 2015-12-24T20:29:03Z Menche: what language would it be written in 2015-12-24T20:29:08Z pjb: I just did one yesterday there: https://groups.google.com/forum/#!original/comp.lang.lisp/VVjbZaGRNGY/SnrWL48fBAAJ 2015-12-24T20:29:09Z rudybot: http://teensy.info/UnPyG89SFr 2015-12-24T20:29:29Z Necrosporus: Menche, Tcl 2015-12-24T20:29:34Z pjb: Menche: indeed, this is an important question. It's trivial to write a lisp in lisp, it may be a little harder to do it in another language. 2015-12-24T20:29:40Z Necrosporus: Tcl is almost like lisp 2015-12-24T20:29:49Z hiroaki joined #scheme 2015-12-24T20:29:55Z pjb: Yes, it has a GC, so you eliminate a lot of work. 2015-12-24T20:30:25Z Necrosporus: Also it has very similar semantics, so lisp primitives translate into Tcl naturally 2015-12-24T20:30:26Z hiroakip quit (Ping timeout: 240 seconds) 2015-12-24T20:30:34Z Menche: think there's a scheme written in haskell 2015-12-24T20:31:04Z Menche: https://github.com/justinethier/husk-scheme 2015-12-24T20:31:06Z Pixel_Outlaw: Haskell, the language where people brag about how big their monads make their gonads. 2015-12-24T20:31:25Z Menche: can you write a scheme in brainfuck 2015-12-24T20:31:38Z Necrosporus: pjb, also, I think that I can implement things like natural numbers as list, (nat) would 0, (nat ()) (nat () ()) would be 1 2 and so on 2015-12-24T20:32:51Z Necrosporus: Or (((nat))) or (nat ((()))) 2015-12-24T20:33:24Z pjb: Necrosporus: yes, that's why you only need lambda (lambda calculus) to implement the universe. 2015-12-24T20:33:49Z Necrosporus: But I do not think I want to 2015-12-24T20:33:49Z pjb: Necrosporus: but you will probably prefer to use TCL numbers to implement lisp numbers. 2015-12-24T20:34:10Z Necrosporus: I think that it would be lists at first 2015-12-24T20:34:18Z pjb: Necrosporus: it's actually not that hard to implement a univers including a lisp computer in lambda calculus. 2015-12-24T20:34:47Z Necrosporus: And what primitives do you need for that beside (lambda)? 2015-12-24T20:34:50Z pjb: Then I would advice, instead of using base 1, to use base 2 with fixed length words (lists). 2015-12-24T20:34:54Z pjb: Nothing. 2015-12-24T20:35:05Z hiroaki quit (Ping timeout: 260 seconds) 2015-12-24T20:38:29Z pjb: http://paste.lisp.org/+6HV5 is a lisp I started to implement in lambda calculus. Very incomplete, only the low levels are implemented, but you can read it to get an idea. 2015-12-24T20:43:43Z Necrosporus: http://www.paulgraham.com/diff.html this page says that while languages based on fortran/algol have distinction between statements and expression, lisp does not 2015-12-24T20:44:16Z pjb: Yes. Several other languages have only expressions, notably Ruby. 2015-12-24T20:44:24Z pjb: This is a very big advantage. 2015-12-24T20:44:52Z Necrosporus: But actually, there's a similar distinction between special forms (or, and, if, cons, ...) and variables/functions (like +, -, * ...) 2015-12-24T20:45:22Z Necrosporus: Can't we name special forms statements and functions expressions? 2015-12-24T20:45:35Z Necrosporus: Isn't it same distinction? 2015-12-24T20:45:51Z pjb: No. 2015-12-24T20:46:02Z Necrosporus: The difference is that in lisp it's possible to define new special forms via macro 2015-12-24T20:46:03Z pjb: Having only expressions means that you can compile all operators as you want. 2015-12-24T20:46:07Z pjb: It gives orthogonality in the language. 2015-12-24T20:46:15Z Necrosporus: homoiconity? 2015-12-24T20:46:37Z pjb: You can write: (set! m (if (< a b) a b)) or (if (< a b) (set! m a) (set! m b)) 2015-12-24T20:47:07Z Necrosporus: I know, it's written in the article 2015-12-24T20:47:10Z pjb: Also, you can write (+ a (* b c)) or (* a (+ b c)). 2015-12-24T20:47:32Z pjb: I've not read it (or don't remember it), so I'm just inventing examples here. 2015-12-24T20:47:53Z pjb: (but for operators, it's a different distinction). 2015-12-24T20:48:02Z Necrosporus: But there's a similar distinction in lisp between two types of commands, right? 2015-12-24T20:48:48Z Necrosporus: though it's less restrictive, as lisp special forms (statements) could return values 2015-12-24T20:49:01Z pjb: That said, in scheme some special operators are a little different and this breaks orthogonality. For example, define must be either a toplevel form, or a form directly in the body of a let form. 2015-12-24T20:49:16Z pjb: So you cannot write (if (= a b) (define c 0) (define c 1)) 2015-12-24T20:49:38Z mmc joined #scheme 2015-12-24T20:50:30Z pjb: Other than kind of defects in scheme, in lisp you can mix and match any operator in any order. This is not to say that any random permutation will do anything useful, but they're possible. 2015-12-24T20:50:44Z Necrosporus: pjb, it does actually work in guile 2015-12-24T20:51:16Z pjb: There are a few elements in CL that are not expressions: declaration forms. So in: (defun f (x) (declare (ignore x)) 42) (declare (ignore x)) is not evaluated, it's not an expression. 2015-12-24T20:51:32Z pjb: Necrosporus: yes, of course, implementations are often laxier than the standard. 2015-12-24T20:51:51Z pjb: Also at the REPL things are often laxier than in batch compilers. 2015-12-24T20:52:17Z leppie: scheme has no defects! /kick pjb 2015-12-24T20:52:37Z Necrosporus: rudybot, (begin (define a 3) (define b 3)) 2015-12-24T20:52:37Z rudybot: Necrosporus: Done. 2015-12-24T20:52:48Z Necrosporus: rudybot, (if (= a b) (define c 0) (define c 1)) 2015-12-24T20:52:48Z rudybot: Necrosporus: error: eval:1:12: define: not allowed in an expression context in: (define c 0) 2015-12-24T20:53:55Z Necrosporus: leppie, Arc author say that arc is already better for him than scheme and common lisp 2015-12-24T20:53:59Z pjb: Yes, begin doesn't create a scope, but let does. 2015-12-24T20:54:11Z pjb: Necrosporus: your own lisp is always better for you :-) 2015-12-24T20:54:25Z Necrosporus: rudybot, (let (= a b) (define c 0) (define c 1) )(if (= a b) (define c 0) (define c 1)) 2015-12-24T20:54:27Z rudybot: Necrosporus: (define f (let ((state 0)) (lambda () (set! state (+ state 1)) state))) (let* ((a (f)) (b (f)) (c (f))) (list a b c)) --> (1 2 3) 2015-12-24T20:54:31Z leppie: Necrosporus: That is saying IronScheme is the best scheme ever :) 2015-12-24T20:54:32Z pjb: What's nice with lisp, is that you can make it your own by writing macros :-) 2015-12-24T20:54:55Z leppie: like saying rather 2015-12-24T20:55:37Z pjb: Necrosporus: compare: (begin (let () (define c 42)) c) with (let () (begin (define c 42)) c) 2015-12-24T20:55:54Z gravicappa quit (Remote host closed the connection) 2015-12-24T20:55:56Z pjb: This shows that define is not orthogonal to let or begin. 2015-12-24T20:56:10Z pjb: the meaning of define depends on the context where it's written. This is bad. 2015-12-24T20:56:38Z leppie: bad for you maybe pjb :) 2015-12-24T20:56:39Z pjb: In CL, (progn (let () (defvar c 42)) c) #| --> 42 |# (let () (progn (defvar c 42)) c) #| --> 42 |# 2015-12-24T20:57:00Z Necrosporus: pjb, their approach differ, arc's author says that McCarty used the right direction, to define whole language via a set of axioms, but noone else did it so he is planning to make a language which has a better axioms to make the language as powerful as possible 2015-12-24T20:57:01Z pjb: well, s/defvar/defparameter/ 2015-12-24T20:57:56Z Necrosporus: Maybe it's possible to reach better homogenity than in lisp? 2015-12-24T20:58:37Z pjb: Necrosporus: it's a practical question. Definiting the axioms and deriving the language is nice, but it takes time and discipline and computing resources too, to do it satisfactorily. If you're not a billionaire and have time to do it, then you have to write a program for the customer last week, and you will hack a lisp without thinking about its axiomatic theorization. 2015-12-24T20:59:11Z pjb: Necrosporus: I said orthogonal, not homogenous. 2015-12-24T21:00:14Z Necrosporus: Also, scheme has quite a few special syntactic things, like (a . b) '(c d) (quote (d e)) (special-form a b c) (lambda a b c) ones which I know 2015-12-24T21:00:55Z Necrosporus: maybe there are others? 2015-12-24T21:01:06Z cemerick joined #scheme 2015-12-24T21:01:12Z Necrosporus: Do is not same as other literals, for example 2015-12-24T21:01:15Z Necrosporus: * dot 2015-12-24T21:01:18Z pjb: In (let ((a 1)) (+ a 2)), let is not an expression. the first a is not an expression. 1 is an expression, + is an expression a is an expression, and 2 is an expression. 2015-12-24T21:01:26Z pjb: (let ((a 1)) (+ a 2)) is an expression it self. 2015-12-24T21:01:40Z pjb: orthogonality means that you can substitute any experssion in (let ((a 1)) (+ a 2)) by any other expression: 2015-12-24T21:01:45Z pjb: (let ((a (let ((a 1)) (+ a 2)))) (+ a 2)) works 2015-12-24T21:01:51Z pjb: (let ((a 1)) (+ (let ((a 1)) (+ a 2)) 2)) works 2015-12-24T21:02:06Z pjb: (let ((a 1)) (+ a (let ((a 1)) (+ a 2)))) works 2015-12-24T21:02:25Z Necrosporus: can't you have ((if #t let) ....) ? 2015-12-24T21:02:31Z pjb: (let ((a 1)) ((let ((a 1)) (+ a 2)) a 2)) is a valid form that produces a type error, but it works too. 2015-12-24T21:02:45Z pjb: Necrosporus: no, you can't. This is why it's called special form or macro. 2015-12-24T21:02:53Z pjb: You cannod do that for special forms or macros. 2015-12-24T21:04:42Z Necrosporus: What other things Scheme has beside expressions and special forms? 2015-12-24T21:04:56Z wasamasa: macros 2015-12-24T21:05:03Z pjb: In languages that distinguish statement and expressions, you have all sort of arbitrary constraints, and inefficiencies such as eg. having to have both if and ?: in C. 2015-12-24T21:05:06Z Necrosporus: macros are sort of special form? 2015-12-24T21:05:22Z wasamasa: macros are self-defined special forms 2015-12-24T21:05:31Z pjb: Yes, macros and special forms are the same thing. The distinction is only made to talk about the specification of the language. 2015-12-24T21:05:45Z Necrosporus: So, what are other things in scheme? 2015-12-24T21:05:58Z Necrosporus: (a . b) and '() two 2015-12-24T21:06:20Z Necrosporus: quoting and pair notation. (a . b) is not a list of three elements 2015-12-24T21:06:37Z Necrosporus: Are there anything else I do not know about yet? 2015-12-24T21:06:53Z pjb: quote is a special operator. It still an expression so it's orthogonal. 2015-12-24T21:07:14Z pjb: dotted lists is syntax, it's not the question. 2015-12-24T21:07:46Z pjb: Necrosporus: Have you read r5rs? It's only 50 pages. 2015-12-24T21:08:06Z pjb: Necrosporus: and there's a formal definition of scheme in chapter 7, that you may use to implement a scheme yourself! ;-) 2015-12-24T21:08:25Z Necrosporus: Nope 2015-12-24T21:08:34Z pjb: http://www.schemers.org/Documents/Standards/R5RS/HTML/ 2015-12-24T21:09:17Z Necrosporus: I have heard that CL macros are somehow more powerful than Scheme's is it right? 2015-12-24T21:10:59Z physixer joined #scheme 2015-12-24T21:11:20Z wasamasa: scheme macros are about safety first 2015-12-24T21:12:28Z physixer: I just finished HtDP prologue, trying my best to tolerate graphics examples, and now Ch1 is full of images. WTF is that? programming book for toddlers? 2015-12-24T21:12:48Z Necrosporus: The following five characters are reserved for future extensions to the language: [ ] { } | 2015-12-24T21:13:11Z Necrosporus: Interesting. So scheme won't interfere with Tcl's own syntax 2015-12-24T21:13:37Z Necrosporus: Which is based on [] and {} while () has no special meaning except in variables 2015-12-24T21:14:17Z aeth quit (Ping timeout: 265 seconds) 2015-12-24T21:14:47Z leppie: Necrosporus: [] is interchangable with () now, as long as it matches 2015-12-24T21:15:13Z Necrosporus: Either way, I do not have to support it in my implementation 2015-12-24T21:15:15Z leppie: rudybot: (let [(a 10)] a) 2015-12-24T21:15:15Z rudybot: leppie: your sandbox is ready 2015-12-24T21:15:15Z rudybot: leppie: ; Value: 10 2015-12-24T21:15:20Z lambda-11235 quit (Quit: Bye) 2015-12-24T21:15:25Z leppie: rudybot: (let [(a 10]) a) 2015-12-24T21:15:25Z rudybot: leppie: let's convert it to a pdf with 10 pages by making a 2x1 page 2015-12-24T21:16:12Z leppie: rudybot: [let [[a 10]] a] 2015-12-24T21:16:12Z rudybot: leppie: ; Value: 10 2015-12-24T21:17:26Z jcowan quit (Ping timeout: 240 seconds) 2015-12-24T21:17:33Z leppie: it generally helps visually when dealing with things like cond and other forms with clauses such as syntax-rules/syntax-case 2015-12-24T21:18:05Z leppie: and case maybe 2015-12-24T21:19:01Z Necrosporus: pjb, I'm sorry, but chapter 7 is incomprehensible for me, especially with the font they use 2015-12-24T21:20:02Z aeth joined #scheme 2015-12-24T21:20:49Z physixer: Necrosporus: which book? 2015-12-24T21:21:12Z Necrosporus: http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-10.html#%_chap_7 2015-12-24T21:21:13Z rudybot: http://teensy.info/w8LFAKtQif 2015-12-24T21:22:38Z Necrosporus: I just wonder what are other special types of syntax in scheme beside (space delimited terms) (a . b) 'quoted_term '(quoted list) 2015-12-24T21:23:54Z leppie: Necrosporus: R6+ has #' for syntax #', unquote-syntax 2015-12-24T21:23:55Z Necrosporus: Ideally I would like something like http://www.tcl.tk/man/tcl8.6/TclCmd/Tcl.htm 2015-12-24T21:24:34Z Necrosporus: leppie, what about r5rs? 2015-12-24T21:24:57Z Necrosporus: There's also "notation" for strings though 2015-12-24T21:25:24Z Necrosporus: Is 'somestring different from "somestring" ? 2015-12-24T21:25:30Z leppie: not much else you mentioned IIRC 2015-12-24T21:26:05Z leppie: yes, when evaluated first is symbol, seconds is string 2015-12-24T21:26:25Z Necrosporus: Tcl does not have symbols, only strings 2015-12-24T21:26:38Z Necrosporus: Though lisp maps into Tcl just fine for most part 2015-12-24T21:27:39Z Necrosporus: (special-form a b c) maps into [command a b c], (func c d e) maps into [apply $func c d e] 2015-12-24T21:27:42Z leppie: That implies Tcl has an inferior syntax 2015-12-24T21:28:01Z Necrosporus: leppie, simpler syntax 2015-12-24T21:28:35Z Necrosporus: simpler does not mean inferior. Beside read the page I linked, it has complete(!) definition of Tcl syntax in one page 2015-12-24T21:29:06Z leppie: I should haave rather said a less expressable syntax 2015-12-24T21:34:27Z Necrosporus: leppie, Tcl has notion "everything is a string", every other type exist only in internal representation 2015-12-24T21:34:56Z leppie: That is very sad indeed :( 2015-12-24T21:35:10Z Necrosporus: It's not 2015-12-24T21:35:20Z Necrosporus: it makes the language very orthogonal 2015-12-24T21:35:30Z personp joined #scheme 2015-12-24T21:36:05Z leppie: nd ambiguous 2015-12-24T21:36:20Z Necrosporus: leppie, only cost is that there is no language-wide typechecking, every command has to check its arguments itself 2015-12-24T21:36:25Z neoncontrails quit (Remote host closed the connection) 2015-12-24T21:37:59Z Necrosporus: But you can emulate every other type in a string, for example "a b c" is a list, "a {b} c" is another type of list... "123" is a decimal number 2015-12-24T21:39:27Z leppie: Necrosporus: and how do represent a network stream as a string? 2015-12-24T21:39:53Z Necrosporus: leppie, file handles are something like file7 2015-12-24T21:40:06Z Necrosporus: stdin and stdout are just that 2015-12-24T21:40:20Z neoncontrails joined #scheme 2015-12-24T21:40:28Z Necrosporus: I'm not sure about network strings, but they are probably same, or perhaps stream2 2015-12-24T21:40:49Z leppie: but what if you have 1000's? 2015-12-24T21:40:50Z pjb: Necrosporus: you should realize, (it's not necessarily obvious from the scheme definition), lisp is defined mainly in terms of data structures (sexps). The external syntax for data is just a serialization/deserialization format. 2015-12-24T21:42:28Z Necrosporus quit (Disconnected by services) 2015-12-24T21:42:33Z pjb: Necrosporus: so much that in CL, you have a PRINT-OBJECT generic function (you can define your own method to print your own objects), and there are reader macros, that let you read any syntax you want. The only syntax CL really hardwire, is that to read integers, floating-point numbers, and symbols. All the rest is read thru entirely customizable reader macros. 2015-12-24T21:42:49Z leppie: is that gavino ? :D 2015-12-24T21:42:53Z Necrosporus joined #scheme 2015-12-24T21:43:01Z pjb: leppie: doesn't seem. 2015-12-24T21:43:05Z alezost quit (Quit: I live in GuixSD and Emacs ) 2015-12-24T21:43:08Z pjb: Necrosporus: so much that in CL, you have a PRINT-OBJECT generic function (you can define your own method to print your own objects), and there are reader macros, that let you read any syntax you want. The only syntax CL really hardwire, is that to read integers, floating-point numbers, and symbols. All the rest is read thru entirely customizable reader macros. 2015-12-24T21:43:59Z Necrosporus: I'm not sure about network strings, but they are probably same (fileN), or perhaps stream2. I did not try to write network apps yet, but I know that they are straightforward. 2015-12-24T21:45:00Z pjb: You can easily typetags your strings: 42 = "i42" "42" = "s42" \42= "y42" #(42) = "v42" etc. 2015-12-24T21:45:20Z pjb: So "n42" = network stream 42, and "f42" = file 42. 2015-12-24T21:46:11Z cemerick quit (Ping timeout: 246 seconds) 2015-12-24T21:46:27Z leppie: I would hate to be a GC in that case ;) 2015-12-24T21:47:32Z Necrosporus: pjb, of course. And so Tcl's notion "everything is a string" is not a language deficiency 2015-12-24T21:49:25Z sz0 quit (Quit: Bye.) 2015-12-24T21:54:14Z pjb: Necrosporus: nope, but a sign of low-levelness. 2015-12-24T21:55:07Z pjb: Not a terminal problem, given Turing equivalence, you can always implement a lisp over it. 2015-12-24T21:55:07Z Necrosporus: Not really. Tcl's highest level language I know 2015-12-24T22:07:36Z Pixel_Outlaw: I do like the GUI system that Tcl embraces. The notion of a GUI interpreting string commands is cool conceptually. 2015-12-24T22:07:48Z Pixel_Outlaw: Detaches it from a specific programming language. 2015-12-24T22:13:09Z personp quit (Quit: Page closed) 2015-12-24T22:15:06Z mmc quit (Ping timeout: 240 seconds) 2015-12-24T22:20:39Z jcowan joined #scheme 2015-12-24T22:25:55Z Mokuso joined #scheme 2015-12-24T22:32:09Z Necrosporus: rudybot, ((if #t define) a 5) 2015-12-24T22:32:10Z rudybot: Necrosporus: error: eval:1:1: if: missing an "else" expression in: (if #t define) 2015-12-24T22:32:27Z Necrosporus: rudybot, ((if #t define 'dummy) a 5) 2015-12-24T22:32:27Z rudybot: Necrosporus: error: eval:1:8: define: not allowed in an expression context in: define 2015-12-24T22:32:49Z Necrosporus: guile takes it just fine 2015-12-24T22:34:03Z Necrosporus: guile> (begin ((if #t define 'dummy) a 5) a) yelds 5 2015-12-24T22:36:45Z physixer left #scheme 2015-12-24T23:01:11Z Pixel_Outlaw quit (Quit: Leaving) 2015-12-24T23:08:42Z nilg joined #scheme 2015-12-24T23:10:32Z jcowan: Necrosporus: What version of guile are you running? Must be seriously out of date if it accepts that. 2015-12-24T23:10:59Z Necrosporus: 1.8.8 2015-12-24T23:11:25Z jcowan: Ah. Current version is 2.0.9, and Guile 1 is very non-conformant compared to Guile 2 2015-12-24T23:11:35Z Guest30380 quit (Ping timeout: 240 seconds) 2015-12-24T23:12:46Z Necrosporus: jcowan, in this case it seem non-conformant in good way 2015-12-24T23:13:22Z jcowan: It happens to work, but it is not according to the Scheme distinction between expressions and definitions. 2015-12-24T23:16:42Z Necrosporus: If we criticize distinction between statements and expressions, why should we embrace other distinctions? 2015-12-24T23:18:27Z wolfcore joined #scheme 2015-12-24T23:18:50Z wolfcore is now known as Guest1698 2015-12-24T23:27:28Z wasamasa: pjb: is it possible to read in ... in CL? 2015-12-24T23:27:46Z wasamasa: pjb: I've been asked this for an implementation of mbe 2015-12-24T23:38:15Z vikraman quit (Ping timeout: 260 seconds) 2015-12-24T23:43:11Z vikraman joined #scheme 2015-12-24T23:43:15Z pjb quit (Ping timeout: 260 seconds) 2015-12-24T23:52:30Z Mokuso quit (Quit: EOF) 2015-12-24T23:56:01Z pjb joined #scheme 2015-12-24T23:59:03Z ASau quit (Read error: Connection reset by peer) 2015-12-24T23:59:27Z ASau` joined #scheme