4 ms·
Imagine you were tasked with implementing a linked-list in, let's say 'C', but anything really. So you choose 'cell' as your name for a node. OK, that's .. fin
by jacknews 3y ago
Imagine you were tasked with implementing a linked-list in, let's say 'C', but anything really.
So you choose 'cell' as your name for a node. OK, that's .. fine.
Now you choose 'car' and 'cdr' for each cell's 'data pointer' and 'next-cell-in-list pointer'. How many 'WTF?s'* do you think you'd get in code review? (except from lispers, I guess)
* obviously it's a rhetorical question, no-one writes or says WTF (out loud) in actual code reviews I hope.
- msla 3y ago> Now you choose 'car' and 'cdr' for each cell's 'data pointer' and 'next-cell-in-list pointer'. How many 'WTF?s'* do you think you'd get in code review? Your names are too verbose.
- flqn 3y agostruct node_t* node node->data node->next Zero "WTF"s
- msla 3y agoExcept those names are wrong in some contexts. That's the point.
- deleted 3y ago[deleted]
- jacknews 3y agoYou are tasked with writing a binary tree, and you pick car and cdr ... A key-value tuple-space... Complex numbers... The point is they are 'wrong' in every context. For LISt Processing, they should probably default to something to do with lists. And caaar et al are a fine example of why I completely skipped common lisp in favour of newer lisp-likes. Perhaps it happens to all languages eventually, people add a convenience here, an shortcut there, and a doodad here, and before long you have an impenetrable thicket. And these things seem convenient, but they are a huge extra cognitive load, and impose a further learning cost even to practicing experts who have to keep up with the latest doodads.
- deleted 3y ago[deleted]
- msla 3y agoCons cells aren't a linked list.