3 ms·
Cute, but the prefix notation in LISP is not purely aesthetic; it is related to the fact that lists were stored in a first-rest (car-cdr) pair structure, and th
by blahedo 16y ago
Cute, but the prefix notation in LISP is not purely aesthetic; it is related to the fact that lists were stored in a first-rest (car-cdr) pair structure, and thus function calls (a list including the function itself and all its arguments) could be broken into the function and its list of arguments, using mechanisms already present.
I suppose you could then define car-cdr as a last-rest pair, but there are reasons aside from linguistic ones to want the first of a list to be the prominent one.
- Miky 16y agoYou could simply reverse the order of the arguments to cons.
- blahedo 16y agoIt's more subtle than that, though. Every list has a beginning; not all lists have ends. If the 'car' semantics are "last item of the list" this is actually meaningfully different from "first item of the reversed list".
- Miky 16y agoIt's not meaningful at all. The list would just be constructed entirely from right to left. The "first" item in a pair would be on the right, and "car" would just mean "item on the right of a pair", or "first item in a list".
- blahedo 16y agoAre you also writing right-to-left, then? If everything about the system is reflected (including having a reading order of right-to-left), then you're right, it's not meaningful. But it's also not what's proposed in the OP here. When the two-dimensional text on the screen is re-formed into a linear string, it is the right end of line N that is attached to the left end of line N+1, and so the right-hand arguments of functions are "after" the left-hand arguments.