Re:A Year in Clojure
by vnorilo on Sunday October 07, 2018 @10:34AM
(#18160720)
Homoiconicity is the googlable term. The first Lisp book that blew my mind is SICP, nowadays free: https://sicp.me/sicp.pdf
I think you need a big picture to appreciate the depth of homoiconicism and meta-circularity.
It's a big one, but well worth it IMO.
[ Parent
| on HN ]
I remember finding it pretty revelatory the first time I saw LET defined as a macro like
(defmacro let (bindings &body body)
`((lambda ,(mapcar #'first bindings) ,@body)
,@(mapcar #'second bindings)))
Seeing it use MAPCAR like that just made something click for me for whatever reason.
Re:A Year in Clojure
by disconcision on Sunday October 07, 2018 @02:11PM
(#18161862)
To add on, Racket in particular has some very slick syntax for writing these kinds of things:
(define-syntax-rule
(let ([id expr] ...) body ...)
((λ (id ...) body ...) expr ...))I definitely liked this about Racket but I did also find the elipses to be a bit magic to begin with...
Re:A Year in Clojure
by disconcision on Sunday October 07, 2018 @07:57PM
(#18163285)
As with all things, the trick to chase the magic away is to implement them. I recently made a little term rewriting library using racket/match syntax but with the pattern/templates specifiable at runtime. Ellipses were a bit confusing to begin with but when you break list patterns down into cons pairs + a cons-like pattern binary combinator to represent ellipses, it started making sense. The unexpected thing for me was that I thought nested ellipses were going to be the tough part, but it turns out they actually just... work.
Re:A Year in Clojure
by taylorwood on Sunday October 07, 2018 @11:28AM
(#18161022)
Stuart Sierra has an interesting talk on homoiconicity and its history: https://www.youtube.com/watch?v=o7zyGMcav3c