@@ -176,7 +176,7 @@ Of course, the fragment retains the type it had when we built it.
176## Labeled surfaces
176## Labeled surfaces
178We can obviously get anything we want out of the subject by tree
178We can obviously get anything we want out of the subject by tree
179−geometry. But it's not really how we'd like to program. We'd
179+geometry. But that's not really how we'd like to program. We'd
180much rather *label* subtrees with convenient, memorable symbols.
180much rather *label* subtrees with convenient, memorable symbols.
182For example, suppose our tree looked like:
182For example, suppose our tree looked like:
@@ -220,7 +220,7 @@ table here -- just a tree search.
221An expression like the label `x` or the axis `+2`, which
221An expression like the label `x` or the axis `+2`, which
222designates a fragment or feature of the subject, is called a
222designates a fragment or feature of the subject, is called a
223−*limb*. Limbs can be connected with a `.`, making a *wing*.
223+*limb*. A list of limbs connected with `.`, is a *wing*.
225To remind you that you're not in Kansas anymore, the syntax for a
225To remind you that you're not in Kansas anymore, the syntax for a
226wing, like `q.y` above, means means "q inside y." In a classic
226wing, like `q.y` above, means means "q inside y." In a classic
@@ -233,7 +233,7 @@ that is, attribute `q` within object `y`. In Hoon, `q.y` means
233Once again, Hoon has no symbol tables. When we put a surface
233Once again, Hoon has no symbol tables. When we put a surface
234on a noun, the surface label is part of that noun's type. It's
234on a noun, the surface label is part of that noun's type. It's
235not part of the cell or other structure that contains the noun.
235not part of the cell or other structure that contains the noun.
236−For example:
236+This will take a little getting used to:
@@ -249,8 +249,8 @@ x=42
252−When we take fragment 2 of the labeled subject the *surface
252+When we take fragment 2 of the labeled subject, the *surface
253−comes with it *. `+2` is not `42` but rather `x=42`. We can
253+comes with it*. `+2` is not `42` but rather `x=42`. We can
254take the surface off with `x.+2`.
254take the surface off with `x.+2`.
256## The search algorithm
256## The search algorithm
@@ -323,18 +323,22 @@ classical language. But where is Hoon's equivalent of objects:
323values which bind code to data?
323values which bind code to data?
325The Hoon equivalent of an object is a *core*. As usual in Hoon,
325The Hoon equivalent of an object is a *core*. As usual in Hoon,
326−the resemblance isn't exact. A core has a set of computed
326+the resemblance is inexact. A core has a set of computed
327attributes, or *arms*. Each arm is an expression whose subject
327attributes, or *arms*. Each arm is an expression whose subject
328is the core. There is no argument, so an arm is not a method.
328is the core. There is no argument, so an arm is not a method.
330Physically, a core is always a cell `[battery payload]`, where
330Physically, a core is always a cell `[battery payload]`, where
331the *payload* is any noun, and the *battery* is a tree of
331the *payload* is any noun, and the *battery* is a tree of
332formulas in Nock (Hoon's functional assembly language) that
332formulas in Nock (Hoon's functional assembly language) that
333−implements the arms.
333+implements the arms. (A battery is like a C++ vtable, sort of.)
335+## The search algorithm
335−As you'd expect with a computed attribute, an expression which
337+As you'd expect with a computed attribute, there is only one
338+namespace and one search algorithm. We just extend the algorithm
339+described above. And an expression which uses a label can't know
336−uses a label can't know whether the subject will resolve it to a
340+whether the subject will resolve it to a surface fragment (a
337−surface fragment (a *leg*) or to an arm.
341+*leg*) or to an arm.
339If we're searching a core and the label matches one of the core's
343If we're searching a core and the label matches one of the core's
340arms, we compute the arm against the core. If the label is not
344arms, we compute the arm against the core. If the label is not
@@ -357,10 +361,55 @@ from "two or more spaces."
359> =b :per a :core ++ foo x ++ bar [q.y foo] --
363> =b :per a :core ++ foo x ++ bar [q.y foo] --
366+We're seeing some Hoon regular forms for the first time. `x:a`
367+turns out to be an irregular relative of the regular `:per` form.
369+We'll get more into syntax in a later Urbyte. If some of these
370+examples seem syntactically a little funky, this isn't usually
371+way we'd do them in "real life." We don't normally write cores
372+on a single command line. In a file this would be:
382+which is much more readable, at least once you get used to it.
383+Let's look at the core itself:
362<2.spy {x/@ud y/{p/$foo q/@rs r/@dr} x/@ux}>
387<2.spy {x/@ud y/{p/$foo q/@rs r/@dr} x/@ux}>
391+[[0 6] [0 58] 9 4 0 1]
394+ {x/@ud y/{p/$foo q/@rs r/@dr} x/@ux}
395+[x=42 y=[p=%foo q=.6.28 r=~m45] x=0xdead.beef]
398+When we print `b`, or any core, we see that typed noun printing
399+can't be an invertible function in Hoon.
401+We 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
403+has two arms and hashes to the three-letter code `spy`.
405+When printing a full core, we don't even print the payload data,
406+just its type. But our `+3:b` confirms the `[battery payload]`
407+structure of the core. Remember, `+2` is the head and `+3` is
410+Finally, let's use this thing:
@@ -372,27 +421,9 @@ from "two or more spaces."
378−[[0 6] [0 58] 9 4 0 1]
381−We're seeing some Hoon regular forms for the first time. `x:a`
426+Seems legit.
382−turns out to be an irregular relative of the regular `:per` form.
384−(We'll get more into syntax in a later Urbyte. If some of these
385−examples seem syntactically a little funky, this isn't usually
386−way we'd do them in "real life." We don't normally write cores
387−on one line in the dojo, for instance.)
389−And when we print `b`, or any core, we see that typed noun
390−printing can't be an invertible function in Hoon.
392−We actually can read the battery (with `+2:b` above), but it's
393−just Nock code, not typed data. We don't even print the payload
394−data, though we print the payload type. The `<2.spy>` just shows
395−a core with two arms, for which `spy` is a hash code.
397## The dojo subject
428## The dojo subject
@@ -415,14 +446,14 @@ directly at the real dojo subject:
416We see a bunch of surfaces: our custom `a` and `b`; standard
447We see a bunch of surfaces: our custom `a` and `b`; standard
417surfaces for identity, date, and entropy; and a ginormous core
448surfaces for identity, date, and entropy; and a ginormous core
418−stack with almost a thousand total arms.
449+stack with *over eight hundred* total arms.
420To be exact, the syntax `<283.xzp 42.ajz 407.xtr 110.xht 1.ztu
451To be exact, the syntax `<283.xzp 42.ajz 407.xtr 110.xht 1.ztu
421−$151>` denotes a system of six cores, each of whose payload is
452+$151>` denotes a stack of six cores, each of whose payload is
422another core, until the innermost payload `%151` (the Hoon
453another core, until the innermost payload `%151` (the Hoon
423−version). This stack is our standard library, from which comes
454+version number). This stack is our standard library, from which
424−`add` and other fine functions. (We don't know how to define a
455+comes `add` and other fine functions. (We don't know how to
425−Hoon function yet, but we're getting close.)
456+write a Hoon function yet, but we're getting way closer.)
427Let's clean up our subject, just to be hygienic:
458Let's clean up our subject, just to be hygienic:
@@ -458,7 +489,7 @@ $
458As always, these questions are optional and only for fun.
489As always, these questions are optional and only for fun.
460What's the best way to construct a core which acts as a function?
491What's the best way to construct a core which acts as a function?
461−How do you call the function?
492+What do you do to call the function?
463Why don't any other languages use subject-oriented programming?
494Why don't any other languages use subject-oriented programming?
464Which languages are most similar to it?
495Which languages are most similar to it?