on master help sign in
More on subject-oriented programming.
8bdec56C. Guy Yarvin
main/blog/bytes/2.md+26−7
@@ -1,18 +1,22 @@
1
1
2−## The dojo
2+## The dojo and you
3
3
4You're playing in the Urbit REPL/shell (`:dojo`). (If you
4You're playing in the Urbit REPL/shell (`:dojo`). (If you
5accidentally press `^X`, it will put you into the other default
5accidentally press `^X`, it will put you into the other default
6app, `:talk`; press `^X` again to switch back.)
6app, `:talk`; press `^X` again to switch back.)
7
7
8The dojo actually has its own command language, which is a
8The dojo actually has its own command language, which is a
9+superset of Hoon. Any input string which parses as a Hoon
9−superset of Hoon. Any Hoon expression is a dojo command that
10+expression is a dojo command that prints the product of the
10−prints the product of the expression. But there are other dojo
11+expression. In the space of strings which don't parse as Hoon
11−commands.
12+expressions, the dojo has other commands.
12
13
13−### Setting variables
14+If this is just too abstract, think of the dojo as half Lisp
15+REPL, half Unix shell.
14
16
15−Another command sets a dojo variable. Type
17+### Setting dojo variables
18+
19+Like the Unix shell, the dojo has command variables. Type
16
20
17```
21```
18> =a 42
22> =a 42
@@ -20,7 +24,7 @@ Another command sets a dojo variable. Type
20
24
21You've set the dojo variable `a` to the value `42`. The dojo
25You've set the dojo variable `a` to the value `42`. The dojo
22puts this binding in the Hoon subject for expressions to use.
26puts this binding in the Hoon subject for expressions to use.
23−(We'll see how this works in a later Urbyte.) So you can write:
27+So you can write:
24
28
25```
29```
26> a
30> a
@@ -28,6 +32,10 @@ puts this binding in the Hoon subject for expressions to use.
28
32
29> [4 a]
33> [4 a]
30[4 42]
34[4 42]
35+
36+> ? [4 a]
37+ {@ud @ud}
38+[4 42]
31```
39```
32
40
33To unbind `a`, just omit the value:
41To unbind `a`, just omit the value:
@@ -36,3 +44,14 @@ To unbind `a`, just omit the value:
36> =a
44> =a
37```
45```
38
46
47+You removed `a` from the subject. (We can bind it again later, or
48+bind over it without removing it.)
49+
50+```
51+> [4 a]
52+-find.a
53+```
54+
55+Now it's
56+
57+## The sub