Re:The Origin of CAR and CDR in Lisp (2005)
by abecedarius on Monday December 26, 2016 @06:34PM
(#13260342)
When I made my own Schemes back in the 90s, I included the ca/dr primitives, because yes, they were handy -- but coming back to this recently I didn't bother, because I built in pattern matching instead. I imagine that'll finally kill off the caaddars in most new Lisps.
[ Parent
| on HN ]
Re:The Origin of CAR and CDR in Lisp (2005)
by dang on Monday December 26, 2016 @06:43PM
(#13260374)
What did you do recently?
Re:The Origin of CAR and CDR in Lisp (2005)
by metaobject on Monday December 26, 2016 @06:53PM
(#13260407)
To add to that question ... how did you use pattern matching to replace the composability of car/cdr?
Re:The Origin of CAR and CDR in Lisp (2005)
by abecedarius on Monday December 26, 2016 @07:53PM
(#13260609)
My new Lisp dialect is https://github.com/darius/squeam (and as it says, I'm not wishing it on anyone else).
Pattern matching would replace a call like cadar with a pattern like ((_ x @_) @_). Using cadar is sort of like point-free style in Haskell: they both invite you to mentally run a chain of operations to understand the meaning, in contrast to patterns and expressions with named variables, which are more like a picture of the input and output.
Of course pattern matching goes way back, but I used to think of it as less settled -- people might want to extend the kernel language with pattern matching in many different ways. Now I'd be more surprised by a new Lisp without some sensible default; plus if it is absent, you can add it in under a page of code, like http://okmij.org/ftp/Scheme/macros.html#match-case-simple
Re:The Origin of CAR and CDR in Lisp (2005)
by kruhft on Monday December 26, 2016 @10:03PM
(#13261022)
Thank you for sharing your work. I could see some good use out of it.
Re:The Origin of CAR and CDR in Lisp (2005)
by abecedarius on Tuesday December 27, 2016 @05:51PM
(#13266937)
I hope it does become useful, thanks! So far it's more of a hobby.