8 ms·
So you mean a meta-circular OOP implementation, where the hosting language already has car, cdr and cons. Alright. I thought what you wrote was supposed to be
by mahmud 17y ago
So you mean a meta-circular OOP implementation, where the hosting language already has car, cdr and cons. Alright.
I thought what you wrote was supposed to be a primitive implementation of the functions.
- twilightsentry 17y agoNo, not really, unless you're running the code in a metacircular interpreter. Imagine encoding the pair ('hello . 'world) into a function. You might say: (lambda (msg) (if (eq msg 'car) 'hello 'world)) You could get 'hello by applying that function to the 'car symbol, or 'world by applying it to anything else. Wrapping that in another function lets us generalise to any CAR/CDR. (lambda (car-value cdr-value) (lambda (msg) (if (eq msg 'car) car-value cdr-value)))