@@ -1,10 +1,9 @@
2navhome: /docs
2navhome: /docs
5title: Subject-oriented programming
4title: Subject-oriented programming
8# Urbyte 2: subject-oriented programming
7# Urbyte 2: subject-oriented programming
10Thanks for reading Urbytes 0 and 1! In Urbyte 2, we'll take
9Thanks for reading Urbytes 0 and 1! In Urbyte 2, we'll take
@@ -37,7 +36,7 @@ are expressions.
38(The dojo is not the only command-line app on your Urbit. By
37(The dojo is not the only command-line app on your Urbit. By
39default there is one other, `:talk`. Since you're on a fakezod,
38default there is one other, `:talk`. Since you're on a fakezod,
40−you can only talk to yourself. If you accidentally press `^X`,
39+you can only talk to yourself. If you accidentally press `^X`,
41it will put you into `:talk`; press `^X` again to switch back.)
40it will put you into `:talk`; press `^X` again to switch back.)
43### Dojo variables
42### Dojo variables
@@ -96,7 +95,7 @@ In Hoon or any "subject-oriented" language, an expression is
96executed against one normal value, the *subject*. In Hoon, of
95executed against one normal value, the *subject*. In Hoon, of
97course, the subject is a noun.
96course, the subject is a noun.
99−## First experiments
98+## First experiments
101Up to now, we've only built constants. By definition, a constant
100Up to now, we've only built constants. By definition, a constant
102doesn't use the subject.
101doesn't use the subject.
@@ -142,20 +141,20 @@ The most basic way to access the subject is *tree geometry*.
142Every noun is a binary tree; every noun in the tree has a number
141Every noun is a binary tree; every noun in the tree has a number
143which is its address. The root of the tree is `1`; if the
142which is its address. The root of the tree is `1`; if the
144address of a cell is `n`, its head is `2n` and its tail is
143address of a cell is `n`, its head is `2n` and its tail is
147A picture might help::
146A picture might help::
158−The syntax for a fragment of the subject at a tree address, or
157+The syntax for a fragment of the subject at a tree address, or
159*axis*, is just `+axis`. So:
158*axis*, is just `+axis`. So:
@@ -184,7 +183,7 @@ For example, suppose our tree looked like:
@@ -298,7 +297,7 @@ Above, we mutated our first noun with the flashy `a(+7 x=z:a)`.
299Of course we are not really "modifying" a noun. Hoon is a pure
298Of course we are not really "modifying" a noun. Hoon is a pure
300language. We are making an edited copy. `a(+7 x=z:a)` means "a
299language. We are making an edited copy. `a(+7 x=z:a)` means "a
301−copy of `a`, with limb `+7` replaced by the product of `x=z:a`."
300+copy of `a`, with limb `+7` replaced by the product of `x=z:a`."
303We can edit multiple (disjoint) wings in one expression:
302We can edit multiple (disjoint) wings in one expression:
@@ -349,7 +348,7 @@ found, we search into the payload of the core.
349When you type these examples, make sure you get the number of
348When you type these examples, make sure you get the number of
350spaces exactly right. Hoon syntax is not whitespace-sensitive
349spaces exactly right. Hoon syntax is not whitespace-sensitive
351in general, except that "one space" is always a different token
350in general, except that "one space" is always a different token
352−from "two or more spaces."
351+from "two or more spaces."
@@ -384,7 +383,7 @@ Let's look at the core itself:
387−<2.spy {x/@ud y/{p/$foo q/@rs r/@dr} x/@ux}>
386+<2.spy {x/@ud y/{p/$foo q/@rs r/@dr} x/@ux}>
@@ -396,11 +395,11 @@ Let's look at the core itself:
398When we print `b`, or any core, we see that typed noun printing
397When we print `b`, or any core, we see that typed noun printing
399−can't be an invertible function in Hoon.
398+can't be an invertible function in Hoon.
401We actually can read the battery (with `+2:b` above), but it's
400We actually can read the battery (with `+2:b` above), but it's
402−just Nock code, not typed data. `<2.spy>` tells us the battery
401+just Nock code, not typed data. `<2.spy>` tells us the battery
403−has two arms and hashes to the three-letter code `spy`.
402+has two arms and hashes to the three-letter code `spy`.
405When printing a full core, we don't even print the payload data,
404When printing a full core, we don't even print the payload data,
406just its type. But our `+3:b` confirms the `[battery payload]`
405just its type. But our `+3:b` confirms the `[battery payload]`