4 ms·
> Now CAR and CDR don't convey a lot of meaning I agree. But that's just a matter of poor naming. They should (in my opinion) be called 'first' and 'rest', or s
by msla 4y ago
> Now CAR and CDR don't convey a lot of meaning I agree. But that's just a matter of poor naming. They should (in my opinion) be called 'first' and 'rest', or something similarly meaningful and descriptive.
Some Lisps do that, but I think it's important to remember what CAR and CDR actually do, which isn't always related to lists: They access what's being pointed to by the pointers in a cons cell, which can be used to create multiple data structures in a given Lisp, so keeping the names abstract prevents the code from having the wrong names all over the place. For example, if I'm using cons cells to construct a key-value store, CAR isn't "head of list" it's "key" and CDR isn't "tail of list" it's "value" especially if the cons cell looks like this: (a . b) such that the CDR isn't a list of any kind.
In Common Lisp, of course, there are more efficient data structures for a lot of what older Lisps used cons cells for, so this is less of a concern, but I still think it's important to prevent confusion.
- galaxyLogic 4y agoGood to understand. So maybe key() and value() would be good, more descriptive names for them then. But I do think using a natural-language name like CAR even if very specialized, is better than using single-char symbols as function names.
- msla 4y ago> So maybe key() and value() would be good, more descriptive names for them then. My point is that they can be used in many different ways, and are, such that any mnemonic name would be misleading in some contexts.
- galaxyLogic 4y agoThey could have multiple aliases, and you could pick the one that fits the context
- kazinator 4y agoBy my estimation, it seems you've now spent about ∞× more time making suggestions how to improve Lisp than actually working in it. Without working in in Lisp solidly for a good 6 months, you don't know where the actual pain points are.
- galaxyLogic 4y agoWhat in your estimation are the actual pain points of Lisp?
- kazinator 4y agoIt depends exactly on which implementation and dialect we are talking about. Mainly people sometimes report things lacking in the ecosystem. The number of people doing any kind of Lisp are relatively small. If you're doing FOSS, you might find it hard to get collaborators and pull it solo.