Archive:
Subtopics:
Comments disabled |
Mon, 01 Nov 2021 !!\def\zpr#1#2{\langle{#1},{#2}\rangle}\def\zkp#1#2{\{\{{#1}\}, \{{#1},{#2}\}\}}!!In Friday's article about the cartesian product I needed to show what the Kuratowski ordered-pair construction looks like when you nest the pairs. I originally wrote out the TeX for these by hand, but later decided I ought to use TeX macros to generate the formulas. First I did
so that Then I defined a macro for Kuratowski pairs. The Kuratowski pair for !!\zpr ab!! is the set !!\zkp ab!!, which is kind of a mess:
Then the nested Kuratowski pairs turn into: $$\begin{array}{cc} \verb+\kp a{\kp bc}+ & \zkp a{\zkp bc} \\ \verb+\kp{\kp ab}c+ & \zkp{\zkp ab}c \\ \end{array} $$ When I got this far I realized that my hand-expansion of
(There's a pair of braces missing around the first of the two !!\zkp ab!!.) I used to give classes on programming style and technique, and one of the maxims I taught was “let the computer do the work”: use the computer to automate repetitive or error-prone tasks. I was going to say I wish I'd taken my own advice here but hey — I did take my own advice, and it worked! [Other articles in category /prog] permanent link |