4 ms·
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, b
by abecedarius 10y ago
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.
- dang 10y agoWhat did you do recently?
- metaobject 10y agoTo add to that question ... how did you use pattern matching to replace the composability of car/cdr?
- abecedarius 10y agoMy new Lisp dialect is https://github.com/darius/squeam 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 http://okmij.org/ftp/Scheme/macros.html#match-case-simple
- kruhft 10y agoThank you for sharing your work. I could see some good use out of it.
- abecedarius 10y agoI hope it does become useful, thanks! So far it's more of a hobby.