4 ms·
Maybe it's just my mental model, or being new to the language. But while going through SICP - 'cdadadr', 'cddaadr', etc. never really "clicked" in my mind. Real
by kaylarose 16y ago
Maybe it's just my mental model, or being new to the language. But while going through SICP - 'cdadadr', 'cddaadr', etc. never really "clicked" in my mind. Really anything past 3 levels (cadar, cddar, etc.) always slowed down reading code, like hitting a speed bump.
I would have to stop and really try to grok what list item it was referring to. Not saying that that is a bad thing, just an observation.
Is there a common way of thinking that makes it easier to comprehend, or is it just something that comes with experience?
- techiferous 16y agoI worked with Scheme (a type of Lisp) professionally for over a year and even after heavy usage there were still lots of syntax "speed bumps" like this that slowed me down. I really enjoyed a lot of the concepts of Scheme but the syntax was a bummer and I'm so glad I'm not programming with it anymore. :)
- kaylarose 16y agoYep Scheme was what I was using with SICP. I've heard of Common Lisp in passing, does it have a more friendly syntax?
- deleted 16y ago[deleted]
- mschaef 16y agoThere's a lot more capability built into the Common Lisp specification than there is in R5RS (dunno much about R6RS), but the syntax is very similar. More than the syntax, Common Lisp is probably best distinguished by the fact it gives you a different set of techniques for partitioning names. Scheme has hygenic macros and a namespace that's unified between functions and values. Common Lisp has non-hygenic macros, but separate namespaces for values and functions, as well as a package construct that lets you use the same spelling of a symbol for different symbols. Common Lisp also has more 'built in' kinds of control flow structures, etc., but it doesn't have anything quite like call/cc.
- mschaef 16y ago> Maybe it's just my mental model, or being new to the language. But while going through SICP - 'cdadadr', 'cddaadr', etc. never really "clicked" in my mind. Really anything past 3 levels (cadar, cddar, etc.) always slowed down reading code, like hitting a speed bump I've used Lisp for a while, and where I tend to wind up on these composite forms is that I use a few of the simpler composites, but tend to switch to either destructuring-bind or some other data type if it gets too complex. (Practically speaking, that means anything much beyond 'car', 'cdr', and 'cadr' gets refactored.)