The Misp Chronicles VI: Pair, Hd, and Tl

To make a pair of things you say (pair ‘of ‘things). The result of evaluating (pair ‘of ‘things) is (of . things). To get the head of a pair say (hd ‘(the-head the-tail)). Here, the answer is the-head. To get the tail say (tl ‘(the-head the-tail)). The answer is (the-tail). Remember, (the-head the-tail) is short for (the-head . (the-tail . nil)). So (tl ‘(the-tail)) is nil. What’s (hd ‘just-try-to-take-my-head)? There’s no answer. Symbols aren’t pairs so they don’t have heads. The answer isn’t yes or no, it just doesn’t make any sense. If I were to ask you the question, “Are you still studying blacksmithing?” Both “yes” or “no” seem funny if you’ve never studied blacksmithing. Same thing with (hd ‘just-try-to-take-my-head). Even Common Lisp and Scheme disagree about the answer. If you ask Common Lisp about nil by saying (car nil), it says nil. If you ask Scheme, it by saying (car ()), it says huh? Specifically, the Scheme I use says, Error in car: expected type pair, got ‘()’. Since no two Lisps can agree, I’m not going to say what Misp does. To make a meta-interpreter you don’t need to specify. The meta-interpreter will do whatever the underlying hd or tl operator does. Take your pick.