Hm. Ok. I think I'm starting to get it. P is the data alphabet, just 0
and 1
. And ignoring the bizarre way they defined it, the Degree function D
of "K"
yields 2. So this (2a) is just notating the variable-capture from the input string, little-delta. In other words, the input string little-delta is implicitly partitioned into a new little-delta (in the example, this is the character K
) and its 2 (degree=2, right?) arguments, πD(δ) .. π1, which is defined as this list so it can extend to any arity. The εP part just means that F must yield 0
or 1
, or more generally, an element of P
F itself is a parameter to the whole thing. It was right at the top. I forgot.
So here's the implementation of the functions K
, A
, and N
. F controls when to call them, but they have to crack their own arguments from the string.
/P(01)def
P{
W 1 ne {ERROR:W_p!=1} if
}forall
/Ptab <<
P {
dup
} forall
>>def
/iP{ % i <- P
P exch search pop length exch pop exch pop
}def
/Pi{ % P <- i
P exch 1 getinterval
}def
/F{
dup 0 get
D 0 gt { % ie. an operator
dup 0 get % (...) K|A|N
exch % K|A|N (...)
1 1 index length 1 sub getinterval % kan (..)
exch Ftab exch get exec % F(d,..)
}{ % leave it alone. F(p)=p
}ifelse
}def
/Ftab <<
(K)0 get { % crack 2 args from string and convert to indices
dup 0 1 getinterval iP
exch 1 1 getinterval iP
and
Pi % convert result back to alphabet P
}
(A)0 get {
dup 0 1 getinterval iP
exch 1 1 getinterval iP
xor
Pi
}
(N)0 get {
0 1 getinterval iP
1 add 2 mod
Pi
}
>>def
(K00) F =
(K01) F =
(K10) F =
(K11) F =
ghostscript output:
0
0
0
1
Aw. Sheesh. They totally say the same thing on the next page.