Lisp from Nothing, Second Edition
1–10 of 109 posts
Re: Lisp from Nothing, Second Edition
#2Re: Lisp from Nothing, Second Edition
#3Second edition, with a new chapter on lambda calculus.
For example, print change-dir make-dir; is equivalent to (print (change-dir (make-dir) ) ) in the old money. I wonder if I am reinventing too much here.
Did LISPers try to get rid of the brackets in the past?
Re: Lisp from Nothing, Second Edition
#4Second edition, with a new chapter on lambda calculus.
Thanks. I recently had to reinvent LISP to script my CRDT database. That was not much work, because I already had the notation (I use RDX, a JSON superset with CRDT types). Still, I stumbled at the idiosyncratic LISP bracketing. Luckily, RDX allows for different tuple notations. So, I styled it to look less alien to a curly-braced developer. Like this https://github.com/gritzko/go-rdx/blob/main/test/13-getput.j... Fo…
Re: Lisp from Nothing, Second Edition
#5Second edition, with a new chapter on lambda calculus.
Thanks. I recently had to reinvent LISP to script my CRDT database. That was not much work, because I already had the notation (I use RDX, a JSON superset with CRDT types). Still, I stumbled at the idiosyncratic LISP bracketing. Luckily, RDX allows for different tuple notations. So, I styled it to look less alien to a curly-braced developer. Like this https://github.com/gritzko/go-rdx/blob/main/test/13-getput.j... Fo…
Probably the best example of a “Lisp without parentheses” is Dylan. Originally, Dylan was developed as a more traditional Lisp with sexprs, but they came up with a non-sexr “surface syntax” before launching it to avoid scaring the public.
Re: Lisp from Nothing, Second Edition
#6Second edition, with a new chapter on lambda calculus.
Thanks. I recently had to reinvent LISP to script my CRDT database. That was not much work, because I already had the notation (I use RDX, a JSON superset with CRDT types). Still, I stumbled at the idiosyncratic LISP bracketing. Luckily, RDX allows for different tuple notations. So, I styled it to look less alien to a curly-braced developer. Like this https://github.com/gritzko/go-rdx/blob/main/test/13-getput.j... Fo…
Re: Lisp from Nothing, Second Edition
#7Re: Lisp from Nothing, Second Edition
#8Earlier quoted context omitted.
Thanks. I recently had to reinvent LISP to script my CRDT database. That was not much work, because I already had the notation (I use RDX, a JSON superset with CRDT types). Still, I stumbled at the idiosyncratic LISP bracketing. Luckily, RDX allows for different tuple notations. So, I styled it to look less alien to a curly-braced developer. Like this https://github.com/gritzko/go-rdx/blob/main/test/13-getput.j... Fo…
Many times. A google for "sweet expressions lisp" will give you a bunch of implementations and opinions.
Re: Lisp from Nothing, Second Edition
#9 (define kons
(lambda (x) (lambda (y) ((pair false) ((pair false) ((pair x) y))))))
(define kar (lambda (x) (first (second (second x)))))
(define kdr (lambda (x) (second (second (second x)))))
(define nil ((pair true) ((pair true) false)))
(define null first)
(define atom (lambda (x) (first (second x))))
That's 2 extra booleans per list element.
While the one for recognizing atoms is probably necessary, the other one for recognizing nil is not: (define kons
(lambda (x) (lambda (y) ((pair false) ((pair x) y)))))
(define kar (lambda (x) (first (second x))))
(define kdr (lambda (x) (second (second x))))
(define nil ((pair true) false))
(define null (lambda (x) (((second x) (lambda (a) (lambda (d) (lambda (z) false)))) true)))
(define atom (lambda (x) (first x)))
The use of null+car+cdr can usually be avoided by using a matching construct instead like (((second list) (lambda (a) (lambda (d) (lambda (z) deal_with_car_a_and_cdr_d ) deal_with_nil)
[1] https://t3x.org/lfn/church.zipRe: Lisp from Nothing, Second Edition
#10Looking at file church.scm from the provided zip file [1], I see the following functions used to construct lists: (define kons (lambda (x) (lambda (y) ((pair false) ((pair false) ((pair x) y)))))) (define kar (lambda (x) (first (second (second x))))) (define kdr (lambda (x) (second (second (second x))))) (define nil ((pair true) ((pair true) false))) (define null first) (define atom (lambda (x) (first (second x)))) T…