on master help sign in
marks, first draft
85f4bd9Henry Ault
docs/programming/system/marks.md+6−8
@@ -15,10 +15,10 @@ text, but there's no predefined mark for it. This is
15
15
16```
16```
17/? 314
17/? 314
18−|_ cod=@t
18+|_ cod/@t
19++ grab
19++ grab
20 |%
20 |%
21− ++ atom |=(arg=@ `@t`(scot %ud arg))
21+ ++ atom |=(arg/@ `@t`(scot %ud arg))
22 --
22 --
23++ grow
23++ grow
24 |%
24 |%
@@ -34,7 +34,7 @@ case, the argument is the marked data.
34
34
35There are three possible top-level arms in the `|_` core,
35There are three possible top-level arms in the `|_` core,
36`++grab`, `++grow`, and `++grad`. `++grad` is used for revision
36`++grab`, `++grow`, and `++grad`. `++grad` is used for revision
37−control, and it's covered elsewhere. `++grab` specifies
37+control, and is covered elsewhere. `++grab` specifies
38functions to convert from another mark to the current mark.
38functions to convert from another mark to the current mark.
39`++grow` specifies how to convert from the current mark to
39`++grow` specifies how to convert from the current mark to
40another one.
40another one.
@@ -42,16 +42,14 @@ another one.
42In our case, we only define one arm in `++grab`, namely `++atom`.
42In our case, we only define one arm in `++grab`, namely `++atom`.
43This allows us to convert any atom to a cord. `++scot` is a
43This allows us to convert any atom to a cord. `++scot` is a
44standard library function in `hoon.hoon` which pretty-prints
44standard library function in `hoon.hoon` which pretty-prints
45−atoms of various types. We want tot treat the atom as an
45+atoms of various types. We want to treat the atom as an
46unsigned decimal number, so we give `%ud` and the given argument
46unsigned decimal number, so we give `%ud` and the given argument
47to `++scot`. Thus, the form of an arm in `++grab` is
47to `++scot`. Thus, the form of an arm in `++grab` is
48`|=(other-mark-type this-mark-value)`.
48`|=(other-mark-type this-mark-value)`.
49
49
50In `++grow`, we just convert to the `md` mark, which is just a
50In `++grow`, we just convert to the `md` mark, which is just a
51`@t` internally, but it has fancy conversion functions to things
51`@t` internally, but it has fancy conversion functions to things
52−like html. `++md` isn't a function because the "argument" is the
52+like html. `++md` isn't a function because the "argument" is already a `@t`, so we can just produce the new value directly.
53−`cod=@t` on the `|_` line. We just produce the new value
54−directly.
55
53
56Let's play around a bit with this mark. First, let's take a
54Let's play around a bit with this mark. First, let's take a
57marked atom and convert it to our new mark.
55marked atom and convert it to our new mark.
@@ -87,7 +85,7 @@ Let's play around a little more:
87]
85]
88```
86```
89
87
90−Ooh, that was exciting. If you squint at that, but it looks an
88+That was exciting. If you squint at that, it looks an
91awful lot like html. Our value `17` is still in there, in the
89awful lot like html. Our value `17` is still in there, in the
92body. `urb` is the mark we render most web pages to. It makes
90body. `urb` is the mark we render most web pages to. It makes
93sure you have a complete skeleton of a web page. Of course, by
91sure you have a complete skeleton of a web page. Of course, by