@@ -31,51 +31,51 @@ demonstrates important principles that more laconic code would not. Save it as
33|= [msg=tape key=@ud]
33|= [msg=tape key=@ud]
36− ++ alpha "abcdefghijklmnopqrstuvwxyz"
38− |= [message=tape key=@ud]
39− (operate message key (encoder key))
41− |= [message=tape key=@ud]
42− (operate message key (decoder key))
44− |= [message=tape key=@ud encoder=(map @t @t)]
48− (~(got by encoder) a)
51− =/ keytape=tape (rott alpha key)
52− (coder alpha keytape)
55− =/ keytape=tape (rott alpha key)
56− (coder keytape alpha)
59− (~(put by (zipper a b)) ' ' ' ')
64− ?. =((lent a) (lent b))
65− ~| %uneven-lengths !!
67− ?: |(?=(~ a) ?=(~ b))
69− $(chart (~(put by chart) i.a i.b), a t.a, b t.b)
72− =/ length=@ud (lent m)
73− =+ s=(trim (mod n length) m)
76=. msg (cass msg)
35=. msg (cass msg)
77−:- (shift.caesar msg key)
36+:- (shift msg key)
78−(unshift.caesar msg key)
37+(unshift msg key)
39+++ alpha "abcdefghijklmnopqrstuvwxyz"
41+ |= [message=tape key=@ud]
42+ (operate message key (encoder key))
44+ |= [message=tape key=@ud]
45+ (operate message key (decoder key))
47+ |= [message=tape key=@ud encoder=(map @t @t)]
51+ (~(got by encoder) a)
54+ =/ keytape=tape (rott alpha key)
55+ (coder alpha keytape)
58+ =/ keytape=tape (rott alpha key)
59+ (coder keytape alpha)
62+ (~(put by (zipper a b)) ' ' ' ')
67+ ?. =((lent a) (lent b))
68+ ~| %uneven-lengths !!
70+ ?: |(?=(~ a) ?=(~ b))
72+ $(chart (~(put by chart) i.a i.b), a t.a, b t.b)
75+ =/ length=@ud (lent m)
76+ =+ s=(trim (mod n length) m)
81This generator takes two arguments: a `tape`, which is your plaintext message,
81This generator takes two arguments: a `tape`, which is your plaintext message,
@@ -124,19 +124,20 @@ event of an error.
125`|= [msg=tape key=@ud]` creates a gate that takes a cell. The head of this cell
125`|= [msg=tape key=@ud]` creates a gate that takes a cell. The head of this cell
126is a `tape`, which is a string type that's a list of `cord`s. Tapes are represented
126is a `tape`, which is a string type that's a list of `cord`s. Tapes are represented
127−as text surrounded by double-quotes, such as this: `"a tape"`. We give this input tape the face `msg`.
127+as text surrounded by double-quotes, such as this: `"a tape"`. We give this input
128−The tail of our cell is a `@ud` -- an unsigned decimal atom -- that we give the face `key`.
128+tape the face `msg`. The tail of our cell is a `@ud` -- an unsigned decimal atom
129−
129+-- that we give the face `key`.
130−`=+` adds a noun to the subject, `=^ caesar` names that noun, and `|%` is used
131−to create a core that contains the following arms. This results in having a core
132−with the face `caesar` that we can call.
134−Now let's look at the rest of the program that is outside of our core:
131+`=<` is the rune that evaluates its first child expression with respect to its
132+second child expression as the subject. In this case, we evaluate the
133+expressions in the code chunk below against the core declared later, which
134+allows us reference the core's contained arms before they are defined. Without
135+`=<`, we would need to put the code chunk below at the bottom of our program.
137=. msg (cass msg)
138=. msg (cass msg)
138−:- (shift.caesar msg key)
139+:- (shift msg key)
139−(unshift.caesar msg key)
140+(unshift msg key)
142`=. msg (cass msg)` changes the input string `msg` to lowercases. `=.` changes
143`=. msg (cass msg)` changes the input string `msg` to lowercases. `=.` changes
@@ -144,7 +145,7 @@ the leg of the subject to something else. In our case, the leg to be changed is
144`msg`, and the thing to replace it is `(cass msg)`. `cass` is a standard-library
145`msg`, and the thing to replace it is `(cass msg)`. `cass` is a standard-library
145gate that converts uppercase letters to lowercase.
146gate that converts uppercase letters to lowercase.
147−`:- (shift.caesar msg key)` and `(unshift.caesar msg key)` simply composes a
148+`:- (caesar msg key)` and `(caesar msg key)` simply composes a
148cell of a right-shifted cipher and a left-shifted cell. This is the final output
149cell of a right-shifted cipher and a left-shifted cell. This is the final output
149of our generator.
150of our generator.
@@ -295,8 +296,8 @@ by.
295`shift` is for encoding, and `unshift` is for decoding. Thus, `shift` calls the
296`shift` is for encoding, and `unshift` is for decoding. Thus, `shift` calls the
296`operate` arm with `(operate message key (encoder key))`, and `unshift` makes
297`operate` arm with `(operate message key (encoder key))`, and `unshift` makes
297that call with `(operate message key (decoder key))`. These both produce the
298that call with `(operate message key (decoder key))`. These both produce the
298−final output of the core, to be called in the form of `(shift.caesar msg key)`
299+final output of the core, to be called in the form of `(caesar msg key)`
299−and `(unshift.caesar msg key)` at the bottom of the program.
300+and `(caesar msg key)` at the bottom of the program.
302++ operate
303++ operate