3 ms·
One of the things I find fascinating about the use of the names 'car' and 'cdr' is the 'c' part of it. As a developer who rights a small to moderate amount of a
by addaon 5y ago
One of the things I find fascinating about the use of the names 'car' and 'cdr' is the 'c' part of it. As a developer who rights a small to moderate amount of assembly, I would tend to refer to the value in, say, 'r8' as 'r8' almost always -- I recognize the difference between "the register named r8" and "the value stored in the register named r8", but it's rare that I need to draw that distinction.
On the other hand, in writing (and more importantly in teaching!) C and C-style languages, I find that one of the strongest tools for ensuring understanding is to distinguish between "the variable named x", "the value of the variable named x", and "the value at the memory location named by the value of the variable named x." In C we use * for part of this distinction; it seems like the 'car'/'cdr'-era equivalent would be to distinguish between 'r8' and 'cr8'/'*r8'.
- dfox 5y agoMy understanding is that the original vacuum tube based IBM computers on which Lisp was implemented were accumulator based architectures (ie. had one register usually named "accumulator") with some instructions using parts of the accumulator in particular harwired ways. Also, for CISC architectures that can do indirect loads on the ISA level (nowadays this is the only remaining practical difference between RISC and CISC), the difference between value of register (for i386: eax or %eax) and value referenced by that register ([eax] or $(%eax)) leads to different syntax of the assembly with same mnemonic. i386 with intel assembly syntax is particularly good example of this as 'mov' refers to at least a two dozens of different opcodes depending on the syntax of its two arguments and current mode of the assembler.
- kazinator 5y agoWhat's mind boggling is that in this historic thing called FLPL (Fortran List Programming Language), these names were complicated further with X...F wrapping. So CAR was spelled XCARF, CDR spelled XCDRF and so on.