on master help sign in
henry/runes and master changes
d66c786Galen Wolfe-Pauly
docs/dev/hoon.md+1−1
@@ -17,7 +17,7 @@ Hoon](hoon/principles).
17
17
18If you want to jump into building things right away and prefer to
18If you want to jump into building things right away and prefer to
19learn from the top down, check out [Leap into
19learn from the top down, check out [Leap into
20−Hoon](hoon/leap-in/1-basic).
20+Hoon](hoon/leap-in/basic).
21
21
22Both of these are under active development.
22Both of these are under active development.
23
23
docs/dev/hoon/leap-in/3-app.mddeleted−55
@@ -1,55 +0,0 @@
1−---
2−hide: true
3−next: false
4−sort: 3
5−title: Advanced Applications
6−---
7−
8−XXX PLACEHOLDER
9−
10−But what is our app state, exactly? In Unix systems, application
11−state is just a block of memory, which you need to serialize to
12−disk if you want to keep it around for very long.
13−
14−In urbit, app state is a single (usually complex) value. In our
15−example, we don't have any special state, so we defined
16−`state=~`, meaning that our state is null. Of course, `state` is
17−just a name we're assigning to it, and you're free to use
18−whatever name you want.
19−
20−Since urbit is purely functional, we can't just implicitly "have"
21−and "change" our state. Rather, it's explicitly passed to us, in
22−the `|_ [bowl state=~]` line, and we produce the new state with
23−`+>.$` in the `[~ +>.$]` line.
24−
25−Two points you may be wondering about. Firstly, `bowl` is a set
26−of general global state that is managed by the system. It
27−includes things like `now` (current time), `our` (our urbit
28−identity), and `eny` (256 bits of guaranteed-fresh entropy). For
29−the full list of things in `++bowl`, search for `++ bowl` (note
30−the double space) in `/arvo/zuse.hoon`.
31−
32−> This is a very common technique in learning hoon. While some
33−> documentation exists, often the easiest way to learn about an
34−> identifier you see in code is to search in `/arvo/zuse.hoon`
35−> and `/arvo/hoon.hoon` for it. These are our two "standard
36−> libraries", and they're usually not hard to read. Since
37−> urbit's codebase is relatively small (those two files are less
38−> than 15000 lines of code combined, and besides the standard
39−> library they include the hoon parser and compiler, plus the
40−> /arvo microkernel), you can usually use the code and the
41−> comments as reference doc.
42−
43−Second point is that urbit needs no "serialize to disk" step.
44−Everything you produce in the app state is persistent across
45−calls to the app, restarts of the urbit, and even power failure.
46−If you want to write to the filesystem, you can, but it's not
47−needed for persistence. Urbit has transactional events, which
48−makes it an ACID operating system. Persistence is just another
49−one of those things you don't have to worry about when
50−programming in urbit.
51−
52−As fascinating as state is, we don't actually need any state to
53−accomplish our immediate goal, which is to get apps on two urbits
54−talking to each other. We'll discuss state more in a later
55−chapter.
docs/dev/hoon/leap-in/1-basic.md → docs/dev/hoon/leap-in/basic.mdrenamed+17−20
@@ -239,8 +239,7 @@ every argument.
239> If you're familiar with Clojure, `|-` is `loop` and `$()` is
239> If you're familiar with Clojure, `|-` is `loop` and `$()` is
240> recur.
240> recur.
241
241
242−
242+**Exercises**:
243−## Excercises
244
243
245Please tweak your code to complete the following excercises.
244Please tweak your code to complete the following excercises.
246
245
@@ -248,15 +247,15 @@ There are a few runes and some syntax that we have yet to cover that
248you will need to complete the excercises below. For these, please
247you will need to complete the excercises below. For these, please
249refer to our cheatsheat at the bottom.
248refer to our cheatsheat at the bottom.
250
249
251−1. Read and understand `++five` line by line.
250+- Read and understand `++five` line by line.
252
251
253−2. Change `++sum` to accept two variables, `a` and `b`. Pass `a`
252+- Change `++sum` to accept two variables, `a` and `b`. Pass `a`
254− to three and `b` to five. Then run the code with `a` set to
253+ to three and `b` to five. Then run the code with `a` set to
255− `1.000` and b set to `2.000`.
254+ `1.000` and b set to `2.000`.
256
255
257−3. Check if this new result is under one thousand. If it is,
256+- Check if this new result is under one thousand. If it is,
258− return the string 'result is less than one thousand'. If not,
257+ return the string 'result is less than one thousand'. If not,
259− return 'result is greater than or equal to one thousand'.
258+ return 'result is greater than or equal to one thousand'.
260
259
261```
260```
262Review
261Review
@@ -383,20 +382,18 @@ don't throw away the subject (i.e. the standard library); rather,
383we stack the new core on top of the old subject so that both are
382we stack the new core on top of the old subject so that both are
384accessible.
383accessible.
385
384
386−## Exercises:
385+**Exercises**:
387−
388−4. Pass `++sum` its arguments (`2000` and `3000`) from the
389− commandline.
390
386
391−5. Comment out all of the arms of the `|%`. Now add another arm
387+- Pass `++sum` its arguments (`2000` and `3000`) from the
392− and call it `++add`, have it accept two arguments and procduce
388+ commandline.
393− 42 (regardless of input). Change the `=<` line to `[(add 5 7)
394− (^add 5 7)]`. Can you recognize what's happening?
395
389
396−6. Write fizbuzz:
390+- Comment out all of the arms of the `|%`. Now add another arm
391+ and call it `++add`, have it accept two arguments and procduce
392+ 42 (regardless of input). Change the `=<` line to `[(add 5 7)
393+ (^add 5 7)]`. Can you recognize what's happening?
397
394
398− Write a program that prints the numbers from 1 to 100
395+- Write a program that prints the numbers from 1 to 100 (entered
399− (entered from the command line). But for multiples of three
396+ from the command line), except that for multiples of three
400 print 'Fizz' instead of the number and for the multiples of
397 print 'Fizz' instead of the number and for the multiples of
401 five print 'Buzz'. For numbers which are multiples of both
398 five print 'Buzz'. For numbers which are multiples of both
402 three and five print 'FizzBuzz'.
399 three and five print 'FizzBuzz'.
docs/dev/hoon/leap-in/generators.mdnew file+177
@@ -0,0 +1,177 @@
1+---
2+next: true
3+sort: 7
4+title: Using Generators with Apps
5+---
6+
7+Up until now we've poked apps directly. This requires the user
8+to specify the mark, and it requires the app to accept the
9+arguments in a way that's convenient for users to input. This is
10+the "plumbing" way to interact with apps. Generators are the
11+"porcelain" layer. This is why when you run a command like `+ls` or
12+`|merge`, there are no marks in sight.
13+
14+We've used generators before, back in [Basic
15+Operation](basic). At that point, we just used the generators
16+to produce values -- we didn't pipe their results into apps. In
17+the dojo cast, the role of a generator is to take a list of
18+arguments and produce a value, which is often, though not always,
19+piped into an app. Generators are pure, stateless functions, and
20+they cannot send moves.
21+
22+`+ls` and `+cat` are commonly-used generators that produce a directory
23+listing and print out a file, respectively. These are useful in
24+themselves, so we generally don't pipe the results into an app.
25+
26+Another generator is `+hood/merge`. Try running `+hood/merge`
27+with the normal arguments for `|merge`:
28+
29+```
30+~fintud-macrep:dojo> +hood/merge %home our %they
31+[syd=%home her=~fintud-macrep sud=%they gem=%auto]
32+~fintud-macrep:dojo> +hood/merge %home our %they, =gem %this
33+[syd=%home her=~fintud-macrep sud=%they gem=%auto]
34+```
35+
36+This didn't run any merge, it just constructed the command that,
37+if sent to `:hood`, would run it. Note first that, even though
38+it's not printed, this value has mark `kiln-merge`. Also, the
39+merge strategy `gem=%auto` was added automatically. Optional
40+arguments are straightforward with generators.
41+
42+In general, generators are prepended by either `+` or `|`. The
43+general form is `+generator`, but often generators are created
44+specifically to work with a single app, they're usually placed in
45+a subdirectory of gen and run with `|`. Thus, if `my-generator`
46+generator is made for use with `:my-app`, then `my-generator` is
47+put in `/gen/my-app/my-generator.hoon`, and can be run directly
48+with `+my-app/my-generator <args>`. If you want to pipe the
49+result into `:my-app`, then run `:my-app +my-app/my-generator
50+<args>`. Because this pattern is so common, this can be
51+abbreviated to `:my-app|my-generator <args>`. Because most
52+built-in commands are generators for the `:hood` app,
53+`:hood|generator <args>` can be shortened to `|generator <args>`.
54+
55+XXThe paragraph above is too long and confusing
56+
57+Let's write a generator for a modified version of `:pong` from
58+the chapter on [Network Messages](network). Recall that `:pong`
59+takes an urbit address, which is of mark `urbit`, and sends that
60+urbit the message `'howdy'`. First--without a generator--let's
61+make `:ping` that does the same, except that it lets the user
62+optionally specify the message as well.
63+
64+We'll need a new mark for our arguments. Let's call it
65+`ping-message`.
66+
67+> For app-specific marks, it's good style to prefix the name of
68+> the mark with the name of the app. Since many apps have
69+> several such marks, subdirectories in `/mar` are rendered as
70+> `-`, so that `ping-message` is written in
71+> (`/mar/ping/message.hoon`).
72+
73+```
74+|_ [to=@p message=@t]
75+++ grab
76+ |%
77+ ++ noun ,[@p @t]
78+ --
79+--
80+```
81+
82+The app can easily be modified to use this (`/ape/ping.hoon`):
83+
84+```
85+/? 314
86+|%
87+ ++ move ,[bone term wire *]
88+--
89+!:
90+|_ [bowl state=~]
91+::
92+++ poke-ping-message
93+ |= [to=@p message=@t]
94+ ^- [(list move) _+>.$]
95+ [[[ost %poke /sending [to dap] %atom message] ~] +>.$]
96+::
97+++ poke-atom
98+ |= arg=@
99+ ^- [(list move) _+>.$]
100+ ~& [%receiving (,@t arg)]
101+ [~ +>.$]
102+::
103+++ coup |=(* `+>)
104+--
105+```
106+
107+Now we can run this with:
108+
109+```
110+~fintud-macrep:dojo> |start %ping
111+>=
112+~fintud-macrep:dojo> :ping &ping-message [~sampel-sipnym 'heyya']
113+>=
114+```
115+
116+And on `~sampel-sipnym`, assuming it's running `:ping` as well,
117+we see `[%receiving 'heyya']`.
118+
119+This is an annoying way to invoke the app, though. The `[]` are
120+mandatory, and optional arguments are hard. Let's make a
121+generator, `+send` to make everything nicer. Since it's specific
122+to `:ping`, let's put it in `/gen/ping/send.hoon`:
123+
124+```
125+:- %say
126+|= [^ [[to=@p message=?(~ [text=@t ~])] ~]]
127+[%ping-message to ?~(message 'howdy' text.message)]
128+```
129+
130+A couple of new things here. Firstly, `message=?(~ [text=@t ~])`
131+should be read as "the message is either null or a pair of text
132+and null". Generator argument lists are always null-terminated,
133+which makes it convenient to accept lists in tail position (which
134+are particularly annoying without generators). `?(a b)` is the
135+irregular form of `$?(a b)`, which is a union type. Thus, `?(a
136+b)` means the type of anything that's in either `a` or `b`.
137+Thus, in our case, `?(~ [text=@t ~])` is either null or a pair of
138+text and null.
139+
140+Secondly, `?~(a b c)` is a rune which means "if the `a` is null,
141+do `b`, else `c`". It is roughly equivalent to `?:(=(~ a) b c)`.
142+
143+> `?~(a b c)` is actually equivalent to `?:=(?=(~ a) b c)`,
144+> which, although identical at run time, is subtly different at
145+> compile time. Specifically, using `?=` rather than `=` means
146+> that we're checking whether `a` is in the *type* of `~`, and so
147+> the compiler knows that in the `b` case `a` is null, and in the
148+> `c` case `a` is not null. Since `=` is purely a runtime value
149+> check with no type implications, the compiler doesn't gain any
150+> information.
151+>
152+> At any rate, this is the reason why we can refer to
153+> `text.message` in the `c` clause. The compiler knows that
154+> `message` is not null, so it must have `text` within it. If
155+> you used `?:(=(~ message) 'howdy' text.message)` the compiler
156+> would complain that it doesn't know whether `message` has
157+> `text` within it.
158+
159+This is run as follows:
160+
161+```
162+~fintud-macrep:dojo> :ping|send ~sampel-sipnym
163+>=
164+~fintud-macrep:dojo> :ping|send ~sampel-sipnym 'how do you do'
165+>=
166+```
167+
168+Which causes `~sampel-sipnym` to print `[%receiving 'howdy']` and
169+`[%receiving 'how do you do']`.
170+
171+**Exercises**:
172+
173+- Create a generator for `:sum` from [State](state) so that
174+ you can run `:sum|add 5` to add numbers to it.
175+
176+- Create a generator for `:click` from [Web Apps](web-apps) so
177+ that you can run `:click|poke` to poke it.
docs/dev/hoon/leap-in/http.mdnew file+199
@@ -0,0 +1,199 @@
1+---
2+next: false
3+sort: 8
4+title: HTTP Requests and Timers
5+---
6+
7+There's a variety of arvo services we haven't touched on yet.
8+Let's figure out how to make HTTP requests and set timers.
9+
10+Let's build an uptime-monitoring system. It'll ping a web
11+service periodically and print out an error when the response
12+code isn't 2xx. Here's `ape/up.hoon`:
13+
14+```
15+/? 314
16+|%
17+++ move ,[bone card]
18+++ card
19+ $% [%them wire (unit hiss)]
20+ [%wait wire @da]
21+ ==
22+--
23+|_ [hid=bowl on=_| in-progress=_| target=@t]
24+++ poke-cord
25+ |= url=@t
26+ ^- [(list move) _+>.$]
27+ ?: =('off' url)
28+ [~ +>.$(on |)]
29+ ?: =('on' url)
30+ :_ +>.$(on &, in-progress &)
31+ ?: |(on in-progress)
32+ ~
33+ [ost.hid %them /request ~ (need (epur target)) %get ~ ~]~
34+ [~ +>.$(target url)]
35+++ thou-request
36+ |= [wir=wire code=@ud headers=mess body=(unit octs)]
37+ ^- [(list move) _+>.$]
38+ ?: &((gte code 200) (lth code 300))
39+ ~& [%all-is-well code]
40+ :_ +>.$
41+ ?: on
42+ [ost.hid %wait /timer (add ~s10 now.hid)]~
43+ ~
44+ ~& [%we-have-a-problem code]
45+ ~& [%headers headers]
46+ ~& [%body body]
47+ :_ +>.$
48+ ?: on
49+ [ost.hid %wait /timer (add ~s10 now.hid)]~
50+ ~
51+++ wake-timer
52+ |= [wir=wire ~]
53+ ?: on
54+ :_ +>.$
55+ [ost.hid %them /request ~ (need (epur target)) %get ~ ~]~
56+ [~ +>.$(in-progress |)]
57+--
58+```
59+
60+There's some fancy stuff going on here. We'll go through it line by
61+line, though.
62+
63+Firstly, there's two kinds of cards we're sending to arvo. A
64+`%them` card makes an HTTP requrest out of a unit `hiss`.
65+
66+> Recall that `++unit` means "maybe". Formally, "`(unit a)` is
67+> either null or a pair of null and a value in `a`". Also recall
68+> that to pull a value out of a unit `(u.unit)`, you must first
69+> verify that the unit is not null (for example with `?~`).
70+
71+A `hiss` (all of the following terms are defined in `zuse`) is a
72+pair of a `purl` and a `moth`. A `purl` is a parsed url
73+structure, which can be created with `++epur`, which is a
74+function that takes a url as text and parses it into a `(unit
75+purl)`. Thus, the result is null if and only if the url is malformed.
76+
77+A `moth` is a treble of a `meth`, a `math`, and `(unit octs)`.
78+`meth` is the HTTP method, in this case `%get`. `math` is a map
79+of HTTP headers. The `(unit octs)` is a possible octet stream
80+representing the body. If it's null, then no body is sent (as in
81+this case).
82+
83+> An octect stream is a pair of the length in bytes of the data
84+> plus the data itself. You can use `++taco` takes text and
85+> turns it into an octet strem.
86+
87+When you send this request, you can expect a `%thou` with the
88+response, which we handle later on in `++thou-request`.
89+
90+For `%wait`, you just pass a [`@da`]() (absolute date), and arvo will
91+produce a `%wake` when the time comes.
92+
93+> A timer is guaranteed to not be triggered before the given
94+> time, but it's currently impossible to guarantee the timer will be
95+> triggered at exactly the requested time.
96+
97+Let's take a look at our state:
98+
99+```
100+|_ [hid=bowl on=_| in-progress=_| target=@t]
101+```
102+
103+We have three pieces of app-specific state. `target` is the url
104+we're monitoring. `on` and `in-progress` are booleans
105+representing, respectively, whether or not we're supposed to keep
106+monitoring and whether or not we're in the middle of a request.
107+
108+The type of booleans is usually written as `?`, which is a union
109+of `&` (true) and `|` false. This type defaults to `&` (true). In our
110+case, we want both of these to default to `|` (false). Because
111+of that, we use `_|` as the type. `_value` means "take the type
112+of `value`, but make the default value be `value`". Thus, our
113+type is still a boolean, just like `?`, but the default value is
114+`|` (false).
115+
116+> This is the same `_` used in `_+>.$`, which means "the same
117+> type as the value "+>.$". In other words, the same type as our
118+> current context and state.
119+
120+Let's take a look at `++poke-cord`. When we're poked with a
121+cord, we first check whether it's `'off'`. If so, we set `on` to
122+false.
123+
124+If not, we check whether it's `on`. If so, we set `on` and
125+`in-progress` to true. If it was already either on or in
126+progress, then we don't take any other immediate action. If it
127+was both off and not in progress, then we send an HTTP request.
128+This request follows the pattern in `++hiss` well. `(need (epur
129+target))` is the parsed url, `%get` is the HTTP method, `~`
130+means no extra headers, and another `~` means no body.
131+
132+> Note the `~` at the end of the move. This is a convenient
133+> shortcut for creating a list of a single element. It's part of
134+> a small family of such shortcuts. `~[a b c]` is `[a b c ~]`,
135+> `[a b c]~` is `[[a b c] ~]` and `\`[a b c]` is `[~ a b c]`.
136+> These may be mixed and matched to create various convoluted
137+> structures and emojis.
138+
139+If the argument is neither 'off' nor 'on', then we assume it's an
140+actual url, so we save it in `target`.
141+
142+When the HTTP response comes back, we handle it with
143+`++thou-request`, which, along with the wire the request was sent
144+on, takes the status code, the response headers, and the response
145+body.
146+
147+We check whether the status code is between 200 and 300. If so,
148+all is well, and we print a message saying so. We start the
149+timer for ten seconds after the present time.
150+
151+If we got a bad status code, then we print out the entire
152+response and start the timer again.
153+
154+After ten seconds, arvo will give us a `%wake` event, which will
155+be handled in `++wake-timer`. If we're still supposed to keep
156+monitoring, we send the same HTTP request as before. Otherwise,
157+we set `in-progress` to false.
158+
159+Let's try it out:
160+
161+```
162+~fintud-macrep:dojo> |start %up
163+>=
164+~fintud-macrep:dojo> :up &cord 'http://www.google.com'
165+>=
166+[%all-is-well 200]
167+[%all-is-well 200]
168+~fintud-macrep:dojo> :up &cord 'http://example.com'
169+>=
170+[%all-is-well 200]
171+~fintud-macrep:dojo> :up &cord 'http://google.com'
172+>=
173+[%we-have-a-problem 301]
174+[ %headers
175+ ~[
176+ [p='X-Frame-Options' q='SAMEORIGIN']
177+ [p='X-XSS-Protection' q='1; mode=block']
178+ [p='Content-Length' q='219']
179+ [p='Server' q='gws']
180+ [p='Cache-Control' q='public, max-age=2592000']
181+ [p='Expires' q='Sun, 10 Jan 2016 23:45:05 GMT']
182+ [p='Date' q='Fri, 11 Dec 2015 23:45:05 GMT']
183+ [p='Content-Type' q='text/html; charset=UTF-8']
184+ [p='Location' q='http://www.google.com/']
185+ ]
186+]
187+[ %body
188+ [ ~
189+ [ p=219
190+ q
191+ \/'<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">\0a<TITLE>301 Moved</TI\/
192+ TLE></HEAD><BODY>\0a<H1>301 Moved</H1>\0aThe document has moved\0a<A HREF="http://www.google.com/">her
193+ e</A>.\0d\0a</BODY></HTML>\0d\0a'
194+ \/ \/
195+ ]
196+ ]
197+]
198+~fintud-macrep:dojo> :up &cord 'off'
199+```
docs/dev/hoon/leap-in/marks.mdnew file+129
@@ -0,0 +1,129 @@
1+---
2+next: true
3+sort: 5
4+title: Marks
5+---
6+
7+We've used predefined marks already, but we haven't yet created
8+our own marks. Let's write a sample mark of our own, then chain
9+it together with some preexisting ones to have fun with type
10+conversions.
11+
12+Let's make a small "cord" mark. "Cord" is a name we use for `@t`
13+text, but there's no predefined mark for it. This is
14+`/mar/cord.hoon`:
15+
16+```
17+/? 314
18+|_ cod=@t
19+++ grab
20+ |%
21+ ++ atom |=(arg=@ `@t`(scot %ud arg))
22+ --
23+++ grow
24+ |%
25+ ++ md cod
26+ --
27+--
28+```
29+
30+Let's go through this line by line. `/? 314` is the required
31+version number, just like in apps. After that everything's in a
32+`|_`, which is a `|%` core, but with input arguments. In our
33+case, the argument is the marked data.
34+
35+There are three possible top-level arms in the `|_` core,
36+`++grab`, `++grow`, and `++grad`. `++grad` is used for revision
37+control, and it's covered elsewhere. `++grab` specifies
38+functions to convert from another mark to the current mark.
39+`++grow` specifies how to convert from the current mark to
40+another one.
41+
42+In our case, we only define one arm in `++grab`, namely `++atom`.
43+This allows us to convert any atom to a cord. `++scot` is a
44+standard library function in `hoon.hoon` which pretty-prints
45+atoms of various types. We want tot treat the atom as an
46+unsigned decimal number, so we give `%ud` and the given argument
47+to `++scot`. Thus, the form of an arm in `++grab` is
48+`|=(other-mark-type this-mark-value)`.
49+
50+In `++grow`, we just convert to the `md` mark, which is just a
51+`@t` internally, but it has fancy conversion functions to things
52+like html. `++md` isn't a function because the "argument" is the
53+`cod=@t` on the `|_` line. We just produce the new value
54+directly.
55+
56+Let's play around a bit with this mark. First, let's take a
57+marked atom and convert it to our new mark.
58+
59+```
60+~fintud-macrep:dojo> &atom 9
61+9
62+~fintud-macrep:dojo> &cord &atom 9
63+'9'
64+~fintud-macrep:dojo> &cord &atom &cord &atom 9
65+'57'
66+```
67+
68+ASCII 9 is 57. There's no requirement, implicit or otherwise,
69+that conversions back and forth between marks be inverses of each
70+other. These are semantic conversions, in that they refer to the
71+same concept. They're not isomorphisms.
72+
73+Let's play around a little more:
74+
75+```
76+~fintud-macrep:dojo> &md &cord &atom 17
77+'17'
78+~fintud-macrep:dojo> &hymn &md &cord &atom 17
79+[ [%html ~]
80+ [[%head ~] [[%title ~] [[%~. [%~. "Untitled"] ~] ~] ~] ~]
81+ [ [%body ~]
82+ [ i=[g=[n=%meta a=~[[n=%value v="{}"] [n=%name v="frontmatter"] [n=[%urb %front] v=""]]] c=~]
83+ t=[i=[g=[n=%p a=~] c=~[[g=[n=%$ a=~[[n=%$ v="17"]]] c=~]]] t=~]
84+ ]
85+ ]
86+ ~
87+]
88+```
89+
90+Ooh, that was exciting. If you squint at that, but it looks an
91+awful lot like html. Our value `17` is still in there, in the
92+body. `urb` is the mark we render most web pages to. It makes
93+sure you have a complete skeleton of a web page. Of course, by
94+the time this gets to the web page, it's plain html. Let's do
95+the final step in the conversion.
96+
97+```
98+~fintud-macrep:dojo> &mime &hymn &md &cord &atom 17
99+[ [%text %html ~]
100+ p=121
101+ q='<html><head><title>Untitled</title></head><body><meta value="{}" name="frontmatter" urb:front="" /><p>17</p></body></html>'
102+]
103+```
104+
105+This is a mime-typed octet stream with type `/text/html`, length
106+121 bytes, and our lowly number `17` rendered to a web page.
107+`cord` was just one step in the chain.
108+
109+Of course, arvo can infer some parts of this chain:
110+
111+```
112+~fintud-macrep:dojo> &cord 17
113+'17'
114+```
115+
116+Likewise, `md` is the only way to get from `cord` to `hymn`, so
117+that can be omitted. If we omit the `hymn`, though, we get:
118+
119+```
120+~fintud-macrep:dojo> &mime &cord 17
121+[[%text %x-markdown ~] p=1 q='7']
122+```
123+
124+Here, we converted straight from `cord` to `md` to `mime`. Arvo
125+decided that was the most straightforward conversion, but it
126+gives a different result than passing it through the `hymn`
127+mark.
128+
129+The minimal correct input, then, is `&mime &hymn &cord &atom 17`.
docs/dev/hoon/leap-in/2-network.md → docs/dev/hoon/leap-in/network.mdrenamed+127−83
@@ -4,14 +4,13 @@ sort: 2
4title: Network Messages
4title: Network Messages
5---
5---
6
6
7−Enough of pure hoonery. Let's get to the good stuff. Let's get
7+Now we've learned enough hoon to do more interesting things.
8−our planets to talk to each other.
8+Let's get our planets to talk to each other.
9
9
10−Of course, for talking to be of any use, we need someone
11−listening. What we've written up until now are just shell
10+All we've written up until now are just shell
12commands that produce a value and then disappear. We need an
11commands that produce a value and then disappear. We need an
13actual app to listen for messages from another planet. Let's
12actual app to listen for messages from another planet. Let's
14−take a look at a very basic one.
13+take a look at a very basic app that does this.
15
14
16```
15```
17:: There is no love that is not an echo
16:: There is no love that is not an echo
@@ -29,10 +28,11 @@ take a look at a very basic one.
29--
28--
30```
29```
31
30
31+
32This is a very simple app that does only one thing. If you poke
32This is a very simple app that does only one thing. If you poke
33−it with a value it prints that out. You have to start the app,
33+it with a value, it prints that value out. To try this out, you
34−then you can poke it from the command line with the following
34+have to start the app, then you can poke it from the command line
35−commands:
35+with the following commands:
36
36
37```
37```
38~fintud-macrep:dojo> |start %echo
38~fintud-macrep:dojo> |start %echo
@@ -48,21 +48,25 @@ commands:
48> There is currently a bug where the `%argument` lines are
48> There is currently a bug where the `%argument` lines are
49> printed *above* the line you entered, so your output may not
49> printed *above* the line you entered, so your output may not
50> look exactly like this.
50> look exactly like this.
51+> `>=` means that a command was successfully received and
52+> executed.
51
53
52Most of the app code should be simple enough to guess its
54Most of the app code should be simple enough to guess its
53function. The important part of this code is the definition of
55function. The important part of this code is the definition of
54`++poke-noun`.
56`++poke-noun`.
55
57
56−Once an app starts, it's always on in the background, and you
58+Once an app starts, it's always running in the background and you
57interact with it by sending it messages. The most
59interact with it by sending it messages. The most
58straightforward way to do that is to poke it from the command
60straightforward way to do that is to poke it from the command
59−line. When you do that, `++poke-noun` is called from your app.
61+line, which we we did with `:echo 5` (`:[app-name]
62+[argument(s)]).
60
63
61−In our case, `++poke-noun` takes an argument `arg` and prints it
64+In this case, `++poke-noun` takes an argument `arg` and prints it
62out with `~&`. This is an unusual rune that formally "does
65out with `~&`. This is an unusual rune that formally "does
63nothing", but the interpreter detects it and printfs the first
66nothing", but the interpreter detects it and printfs the first
67+child, before executing the second as if the first didn't exist.
64−child. This is a slightly hacky way of printing to the console,
68+This is a slightly hacky way of printing to the console, but
65−and we'll get to the correct way later on.
69+we'll get to the correct way later on.
66
70
67But what does `++poke-noun` produce? Recall that `^-` casts to a
71But what does `++poke-noun` produce? Recall that `^-` casts to a
68type. In this case, it's declaring that end result of the
72type. In this case, it's declaring that end result of the
@@ -70,10 +74,11 @@ function will be of type `[(list) _+>.$]`. But what does this
70mean?
74mean?
71
75
72The phrase to remember is "a list of moves and our state". Urbit
76The phrase to remember is "a list of moves and our state". Urbit
73−is a message passing system, so whenver we want to do something
77+is a message passing system XX should we mention event
78+driven operating system XX, so whenever we want to do something that
74−that interacts with the rest of the system we send a message.
79+interacts with the rest of the system we send a message. Thus, a
75−Thus, a move is arvo's equivalent of a syscall. The first
80+move is arvo's equivalent of a syscall. The first thing that
76−thing that `++poke-noun` produces is a list of messages, called
81+`++poke-noun` produces is a list of messages, called
77"moves". In this case, we don't actually want the system to do
82"moves". In this case, we don't actually want the system to do
78anything, so we produce the empty list, `~` (in the `[~ +>.$]`
83anything, so we produce the empty list, `~` (in the `[~ +>.$]`
79line).
84line).
@@ -101,25 +106,28 @@ number, and then print out the square of that number.
101```
106```
102
107
103A few things have changed. Firstly, we no longer accept
108A few things have changed. Firstly, we no longer accept
104−arbitrary nouns because we can only square atoms. Thus, our
109+arbitrary nouns because we can only square atoms (integers, in
110+this case an unsigned one). Thus, our argument is now `arg=@`.
105−argument is now `arg=@`. Secondly, it's `++poke-atom` rather
111+Secondly, it's `++poke-atom` rather than `++poke-noun`.
106−than `++poke-noun`.
107
112
108−Are there other `++poke`s? Definitely. In fact, `noun` and
113+Are there other `++poke`s? Yes. In fact, `noun` and
109`atom` are just two of arbitrarily many "marks". A mark is
114`atom` are just two of arbitrarily many "marks". A mark is
110fundamentally a type definition, but accessible at the arvo
115fundamentally a type definition, but accessible at the arvo
111level. Each mark is defined in the `/mar` directory. Some marks
116level. Each mark is defined in the `/mar` directory. Some marks
112have conversion routines to other marks, and some have diff,
117have conversion routines to other marks, and some have diff,
113patch, and merge algorithms. None of these are required for a
118patch, and merge algorithms. None of these are required for a
114−mark to exist, though.
119+mark to exist, however.
115
120
116−`noun` and `atom` are two of dozens of predefined marks, and the
121+`noun` and `atom` are two of dozens of predefined marks (that will
122+already be in your `/mar` directory), and the
117user may add more at will. The type associated with `noun` is
123user may add more at will. The type associated with `noun` is
118`*`, and the type associated with `atom` is `@`.
124`*`, and the type associated with `atom` is `@`.
119
125
126+When we poke an app from anywhere, we do so with a mark that
127+searches for the corresponding (`++poke-[mark]`) arm. Data
120−Data constructed on the command line is by default marked with
128+constructed on the command line is by default marked with `noun`.
121−`noun`. In this case, the app is expecting an atom, so we have
129+In this case, the app is expecting an atom, so we have to
122−to explicitly mark the data with `atom`. Try the following
130+explicitly mark the data with `atom` using `&[mark]`. Try the following
123commands:
131commands:
124
132
125```
133```
@@ -144,7 +152,7 @@ pipeline, so we'll be getting quite used to them.
144 previous section).
152 previous section).
145
153
146- One way of representing strings is with double quoted strings
154- One way of representing strings is with double quoted strings
147− called "tapes". The hoon type is `tape`, and there is a
155+ called "tapes". The hoon type is `++tape`, and there is a
148 corresponding mark with the same name. Write an app that
156 corresponding mark with the same name. Write an app that
149 accepts a tape and prints out `(flop argument)`, where
157 accepts a tape and prints out `(flop argument)`, where
150 `argument` is the input. What does this do?
158 `argument` is the input. What does this do?
@@ -155,7 +163,7 @@ Let's write our first network message! Here's `/ape/pong.hoon`:
155```
163```
156/? 314
164/? 314
157|%
165|%
158− ++ move ,[bone term path *]
166+ ++ move ,[bone term wire *]
159--
167--
160!:
168!:
161|_ [bowl state=~]
169|_ [bowl state=~]
@@ -184,9 +192,10 @@ Run it with these commands:
184>=
192>=
185```
193```
186
194
187−Replace `~sampel-sipnym` with another urbit. Don't forget to
195+Replace `~sampel-sipnym` with another urbit. The easiest thing to
196+do is to start a [moon](), a sub-identity of your urbit. Don't
188−start the `%pong` app on that urbit too. You should see, on the
197+forget to start the `%pong` app on that urbit too. You should
189−foreign urbit, this output:
198+see, on the foreign urbit, this output:
190
199
191```
200```
192[%receiving 'howdy']
201[%receiving 'howdy']
@@ -194,14 +203,16 @@ foreign urbit, this output:
194
203
195Most of the code should be straightforward. In `++poke-atom`,
204Most of the code should be straightforward. In `++poke-atom`,
196the only new thing is the expression `(,@t arg)`. As we already
205the only new thing is the expression `(,@t arg)`. As we already
197−know, `@t` is the type of "cord" text strings. `,` is an
206+know, `@t` is the type of "cord" text strings. `,` is the
198−operator that turns a type into a validator function -- that is,
207+irregular short form of `$,`an operator that turns a type into a
208+validator function (called a "clam" in hoon) -- that is, a
199−a function whose domain is all nouns and range is the given type,
209+function whose domain is all nouns and range is the given type.
200−and which is identity when the domain is restricted to the given
201−type. In simpler terms, it's a function that coerces any value
210+In simpler terms, if a validator function is passed a value that
211+falls within its type, that value is produced. Otherwise, it
212+produces the default value (aka the "bunt") of its type. Here we call
202−to the given type. We call this `,@t` function on the argument.
213+this `,@t` function on the argument. This coerces the argument
203−This coerces the argument to text, so that we can print it out
214+to text, so that we can print it out prettily no matter what
204−prettily.
215+we're passed.
205
216
206The more interesting part is in `++poke-urbit`. The `urbit` mark
217The more interesting part is in `++poke-urbit`. The `urbit` mark
207is an urbit identity, and the hoon type associated with it is
218is an urbit identity, and the hoon type associated with it is
@@ -214,68 +225,101 @@ want to send a message to another urbit. Thus, we produce a list
214with one element:
225with one element:
215
226
216```
227```
217−[ost %poke /sending [to %pong] %atom 'howdy']
228+[ost %poke /sending [to-urbit-address %pong] %atom 'howdy']
218```
229```
230+###Moves
219
231
220The general form of a move is
232The general form of a move is
221
233
234+ >-app/vane-specific part of move
222−`[bone term path *]`
235+`[bone term wire *]`
236+ -arvo part---->
237+ of move
238+
239+Or, in pseudo-code:
240+
241+`["cause" sys-call/action tack-new-layer-on-cause action-specific
242+information]`
243+
244+Let's walk through each of these elements step by step
245+
246+####Bones ("cause")
223
247
224If you look up `++bone` in `hoon.hoon`, you'll see that it's a
248If you look up `++bone` in `hoon.hoon`, you'll see that it's a
225number (`@ud`), and that it's an opaque reference to a duct.
249number (`@ud`), and that it's an opaque reference to a duct.
226`++duct` in hoon.hoon is a list of `wire`s, where `wire` is an
250`++duct` in hoon.hoon is a list of `wire`s, where `wire` is an
227alias for `path`. `++path` is a list of `span`s, which are ASCII
251alias for `path`. `++path` is a list of `span`s, which are ASCII
228text. Thus, a duct is a list of paths, and a bone is an opaque
252text. Thus, a duct is a list of paths, and a bone is an opaque
229−reference to that duct (in the same way that a Unix file
253+reference to it (in the same way that a Unix file
230−descriptor is an opaque reference to a file structure). Thus,
254+descriptor is an opaque reference to a file structure). Thus, to
231−the center of all this is the concept of a "duct".
255+truly understand bones, we must understand ducts.
256+
257+A duct is stack of causes, again, represented as paths, which are
258+called wires. At the bottom of every duct is a unix event, such
259+as a keystroke, network packet, file change, or timer event.
260+When arvo is given this event, it routes the event to appropriate
261+kernel module for handling.
232
262
233−A duct is stack of causes, represented as paths. At the bottom
263+XX[short explanation of the composition of arvo should be here.]
234−of every duct is a unix event, such as a keystroke, network
235−packet, file change, or timer event. When arvo is given this
236−event, it routes the event to appropriate kernel module for
237−handling.
238
264
239Sometimes, the module can immediately handle the event and
265Sometimes, the module can immediately handle the event and
240−produce any necessary results. Otherwise, it asks other kernel
266+produce any necessary results. For example, when we poked the
241−modules or applications to do certain things, and produces the
267+`++poke-atom` arm above, we poked %gall, our application server,
268+which was able to respond to our poke directly. When the module
269+cannot service the request itself, it sends instructions to the other kernel
270+module or application to do a specified action, and produces the
242−result from that. When it sends a message to another kernel
271+result from that. Furthermore, when one module sends a message to another kernel
243−module or application, it sends it "along" the duct it was given,
272+module or application, it also sends along the duct it was given
244−plus with a new path. Arvo pushes the new path onto the duct.
273+with its new wire tacked onto the end. Now the duct has two entries,
245−Now the duct has two entries, with the unix even on the bottom
274+with the unix even on the bottom and the kernel module that
246−and the kernel module that handled it next. This process can
275+handled it next. This process can continue indefinitely, adding
247−continue indefinitely, adding more and more layers onto the duct.
276+more and more layers onto the duct. When an entity finally
248−When an entity produces a result, a layer is popped off the duct.
277+produces a result, a layer is popped off the duct, and the result
249−
278+is passed all the way back down.
279+
250−In effect, a duct is an arvo-level call stack. The duct system
280+In effect, a duct is an arvo-level call stack. It's worth noting
251−creates a structured message-passing system. It's worth noting
252that while in traditional call stacks a function call happens
281that while in traditional call stacks a function call happens
253−synchronously and returns exactly once, in arvo multiple moves
282+synchronously and returns exactly once. In arvo, multiple moves
254−can be sent at once, they are evaluated asynchronously, and each
283+can be sent at once, are evaluated asynchronously, and each
255one may be responded to zero or more times.
284one may be responded to zero or more times.
256
285
257−Anyhow, the point is that whatever caused `++poke-urbit` to be
286+The point to take home is that whatever caused `++poke-urbit` to be
258called is also the root cause for the network message we're
287called is also the root cause for the network message we're
259−trying to send. Thus, we say to send the network message along
288+trying to send. Thus, we say to send the network message along the given bone
289+`ost`.
290+
291+#####Wire ('tack on new layer to duct')
292+
260−the given bone `ost`. Of course, we have to push a layer to the
293+Of course, we have to push a new layer onto our duct
294+before passing it along (or responding to it directly) anywhere This
261−duct. This layer can have any data we want in it, but we don't
295+layer can have any data we want in it, but we don't need anything
262−need anything specific here, so we just use `/sending`. If we
296+specific here, so we just use the wire `/sending`
297+(`/elem1/elem2/elem n` is one syntax used to create `++path`s and
263−were expecting a response (which we're not), it would come back
298+`++wire`s of n elements). If we were expecting a response (which
264−along the `/sending` path. It's a good idea for debugging
299+we're not), it would come back along the `/sending` wire, meaning
300+that the path `/sending` will be passed back to the response
301+handler as an argument. Although it's not required, it's
265−purposes to make the path human-readable, but it's not necessary.
302+generally a good idea to make the wire human-readable for
266−
303+bug-handling purposes.
304+
305+#####Term (sys-call)
306+
267−Looking back at the general form of a move, there is a `term`,
307+Looking back at the general form of a move, there is a
308+`term`--which is text composed lowercase ascii and `-`, and has
268−which in this case is `%poke`. This is the name of the
309+the sign of `@tas`-- which in this case is `%poke`. This is the
269−particular kind of move we're sending. If you think of a move as
310+name of the particular kind of move we're sending. If you think
270−a syscall (which you should), then this `term` is the name of the
311+of a move as a syscall (which you should), then this `term` is
271−syscall. Common ones include: `%poke`, to message an app;
312+the name of the syscall. Common ones include: `%poke`, to
272−`%warp`, to read from the filesystem; `%wait`, to set a timer;
313+message an app; `%warp`, to read from the filesystem; `%wait`, to
273−and `%them`, to send an http request.
314+set a timer; and `%them`, to send an http request.
274−
315+
316+XXDescribe where they can find a list of these things.
317+
275−The general form ends with `*` since each type of move takes
318+The general form ends with `*` (a noun) since each type of move takes
276different data. In our case, a `%poke` move takes a target
319different data. In our case, a `%poke` move takes a target
277−(urbit and app) and marked data and pokes that app on that urbit
320+(urbit and app) and marked data and pokes the arm of the
321+corresponding mark on that app on that urbit
278−with that data. `[to %pong]` is the target urbit and app,
322+with that data. `[to-urbit-address %pong]` is the target urbit and app,
279`%atom` is the mark`, and `'howdy'` is the data.
323`%atom` is the mark`, and `'howdy'` is the data.
280
324
281When arvo receives a `%poke` move, it calls the appropriate
325When arvo receives a `%poke` move, it calls the appropriate
docs/dev/hoon/leap-in/state.mdnew file+107
@@ -0,0 +1,107 @@
1+---
2+next: true
3+sort: 3
4+title: State
5+---
6+
7+In the last section we built a few small apps that sent moves.
8+These apps were entirely stateless, however. Most useful apps
9+require some amount of state. Let's build a trivial stateful
10+app. It'll keep a running the sum of all the atoms we poke it with.
11+Here's `ape/sum.hoon`:
12+
13+```
14+/? 314
15+!:
16+|_ [bowl state=@]
17+++ poke-atom
18+ |= arg=@
19+ ^- [(list) _+>.$]
20+ ~& [%so-far (add state arg)]
21+ [~ +>.$(state (add state arg))]
22+--
23+```
24+
25+We can start it with `|start %sum`, and then run it:
26+
27+```
28+~fintud-macrep:dojo> :sum &atom 5
29+[%so-far 5]
30+>=
31+~fintud-macrep:dojo> :sum &atom 2
32+[%so-far 7]
33+>=
34+~fintud-macrep:dojo> :sum &atom 15
35+[%so-far 22]
36+>=
37+```
38+
39+We can see that app state is being saved, but when, where, and
40+how?
41+
42+The state is stored as the second thing in the `|_` line. In our
43+case, it's simply an atom named `state`. We change it by
44+producing as our state not with (as before) `+>.$` but `+>.$(state (add state
45+arg))`. We've seen all these parts before, but you might not
46+recognize them.
47+
48+Recall in the first chapter that we recursed with the expression
49+`$(b (add 3 b))`. This meant "produce `$` with `b` changed to
50+`(add 3 b)`. Similarly, `+>.$(state (add state arg))` means
51+"produce `+>.$` (i.e. our context, which contains our state) with
52+`state` changed to `(add state arg)`.
53+
54+At a high level, then, when we handle state, we do it explicitly.
55+It's passed in and produced explicitly. In Unix systems,
56+application state is just a block of memory, which you need to
57+serialize to disk if you want to keep it around for very long.
58+
59+In urbit, app state is a single (usually complex) value. In our
60+example, we have very simple state, so we defined `state=@`,
61+meaning that our state is an atom. Of course, `state` is just a
62+name we're assigning to it, and you're free to use whatever name
63+you want.
64+
65+Two points you may be wondering about. Firstly, `bowl` is a set
66+of general global state that is managed by the system. It
67+includes things like `now` (current time), `our` (our urbit
68+identity), and `eny` (256 bits of guaranteed-fresh entropy). For
69+the full list of things in `++bowl`, search for `++ bowl` (note
70+the double space) in `/arvo/zuse.hoon`.
71+
72+> This is a very common technique in learning hoon. While some
73+> documentation exists, often the easiest way to learn about an
74+> identifier you see in code is to search in `/arvo/zuse.hoon`
75+> and `/arvo/hoon.hoon` for it. These are our two "standard
76+> libraries", and they're usually not hard to read. Since
77+> urbit's codebase is relatively small (those two files are less
78+> than 15000 lines of code combined, and besides the standard
79+> library they include the hoon parser and compiler, plus the
80+> /arvo microkernel), you can usually use the code and the
81+> comments as reference doc.
82+
83+The second point is that urbit needs no "serialize to disk" step.
84+Everything you produce in the app state is persistent across
85+calls to the app, restarts of the urbit, and even power failure.
86+If you want to write to the filesystem, you can, but it's not
87+needed for persistence. Urbit has transactional events, which
88+makes it an [ACID operating system](). Thus, you don't have to
89+worry about persistence when programming in urbit or to ever go
90+through the hassle of having to set up and write to a database.
91+
92+**Exercises**:
93+
94+- Modify `:sum` to reset the counter when you poke it with zero.
95+
96+- Write an app that prints out the previous value you poked it
97+ with. Sample output:
98+
99+```
100+~fintud-macrep:dojo> :last 7
101+[%last 0]
102+>=
103+~fintud-macrep:dojo> :last [1 2 3]
104+[%last 7]
105+>=
106+~fintud-macrep:dojo> :last 'howdy'
107+[%last [1 2 3]]
docs/dev/hoon/leap-in/subscriptions.mdnew file+279
@@ -0,0 +1,279 @@
1+---
2+next: true
3+sort: 4
4+title: Subscriptions
5+---
6+
7+We've dealt fairly extensively with "poke" messages to an app,
8+but these are somewhat limited. A poke is a one-way message, but
9+more often we want to subscribe to updates from another app. You
10+could build a subscription model out of one-way pokes, but it's
11+such a common pattern that it's built into arvo.
12+
13+Let's take a look at two apps, `:source` and `:sink`. First,
14+`:source`:
15+
16+```
17+/? 314
18+!:
19+|%
20+++ move ,[bone %diff mark *]
21+--
22+|_ [hid=bowl state=~]
23+++ poke-noun
24+ |= arg=*
25+ ^- [(list move) _+>.$]
26+ :_ +>.$
27+ %+ turn (prey /the-path hid)
28+ |=([o=bone *] [o %diff %noun arg])
29+++ peer
30+ |= pax=path
31+ ^- [(list move) _+>.$]
32+ ~& [%subscribed-to pax=pax]
33+ [~ +>.$]
34+--
35+```
36+
37+And secondly, `:sink`:
38+
39+```
40+/? 314
41+|%
42+++ move ,[bone card]
43+++ card
44+ $% [%peer wire [@p term] path]
45+ [%pull wire [@p term] ~]
46+ ==
47+--
48+!:
49+|_ [bowl available=?]
50+++ poke-noun
51+ |= arg=*
52+ ^- [(list move) _+>.$]
53+ ?: &(=(%on arg) available)
54+ [[[ost %peer /subscribe [our %source] /the-path] ~] +>.$(available |)]
55+ ?: &(=(%off arg) !available)
56+ [[[ost %pull /subscribe [our %source] ~] ~] +>.$(available &)]
57+ ~& ?:(available %not-subscribed %subscribed)
58+ [~ +>.$]
59+++ diff-noun
60+ |= [wir=wire arg=*]
61+ ^- [(list move) _+>.$]
62+ ~& [%recieved-data arg]
63+ [~ +>.$]
64+++ reap
65+ |= [wir=wire error=(unit tang)]
66+ ^- [(list move) _+>.$]
67+ ?~ error
68+ ~& %successfully-subscribed
69+ [~ +>.$]
70+ ~& [%subscription-failed error]
71+ [~ +>.$]
72+--
73+```
74+
75+Cheat sheet:
76+
77+```
78+- `&` can either be the boolean true (along with `%.y`, `0`), or
79+ the irregular wide form of the `$&` rune, which computes the
80+ logical 'and' operation on its two children.
81+
82+- Similar to `&`,`|` is either the boolean false (along with `%.n` and `1`), or
83+ the irregular short for of `?|`, which computes the logical 'or' operation on
84+ its two children
85+
86+- `!` is the irregular wide form of `?!`, which computes the logical `not` on
87+ its child.
88+
89+- `?~` is basically an if-then-else statement that checks whether condition `p`
90+ is `~` (null). `?~` is slightly different to `?:(~ %tru %fal) in that it
91+ reduces to ?:($=(%type value) %tru %false). `$=` tests whether value `q`
92+ falls within type `p`. One thing to watch out for in hoon: if you do `?~`, it
93+ affects the type of the conditional value: XXexample
94+
95+- `:_` is just an inverted `:-`: all it does is accept children `p` and `q` and
96+ produce an inverted tuple of the two, `[q p]`.
97+
98+- `++bowl` is the type of our system state within our app. For example, it
99+ includes things like `our`, the ship name of the host, and `now`, the
100+ current time.
101+
102+- `$%` is a type constructor that defines a type composed of `n`
103+ types that it is passed. For example `$% @ * ^ ==` is the
104+ type of either `@`, `*`, or a cell `^`. XX this a union, right?
105+
106+- You may have noticed the separate `|%` above the application
107+ core `|_`. We usually put our types in another core on top of the
108+ application core. We can access these type from our `|_`
109+ because in hoon.hoon files, all cores are =>'ed (called) against
110+ each other. Thus the `|%` with the types is in the context of
111+ the `|_`, as it lies above it: hoon.hoon `=> |% w types =>
112+ |_`
113+
114+
115+
116+
117+```
118+
119+Here's some sample output of the two working together:
120+
121+```
122+~fintud-macrep:dojo> |start %source
123+>=
124+~fintud-macrep:dojo> |start %sink
125+>=
126+~fintud-macrep:dojo> :sink %on
127+[%subscribed-to pax=/the-path]
128+%successfully-subscribed]
129+>=
130+~fintud-macrep:dojo> :source 5
131+[%received-data 5]
132+>=
133+~fintud-macrep:dojo> :sink %off
134+>=
135+~fintud-macrep:dojo> :source 6
136+>=
137+~fintud-macrep:dojo> :sink %on
138+[%subscribed-to pax=/the-path]
139+%successfully-subscribed]
140+>=
141+~fintud-macrep:dojo> :source 7
142+[%received-data 7]
143+>=
144+```
145+
146+###:source
147+
148+Hopefully you can get a sense for what's happening here. When we
149+poke `:sink` with `%on`, `:sink` subscribes to `:source`, and so
150+whenever we poke `:source`, `:sink` gets the update and prints it
151+out. Then we unsubscribe by poking `:sink` with `%off`, and
152+`:sink` stops getting updates. We then resubscribe.
153+
154+There's a fair bit going on in this code, Let's look at
155+`:source` first.
156+
157+Our definition of `move` is fairly specific, since we're only
158+going to sending one kind of move. The `%diff` move is a
159+subscription update, and its content is marked data which gall
160+routes to our subscribers.
161+
162+This is a slightly different kind of move than we've dealt with
163+so far. It's producing a result rather than calling other code
164+(i.e. it's a return rather than a function call), so if you
165+recall the discussion of ducts, a layer gets popped off the duct
166+rather than added to it. This is why no wire is needed for the
167+move -- we won't receive anything in response to it.
168+
169+Anyways, there're two functions inside the `|_`. We already know
170+when `++poke-noun` is called. `++peer` is called when someone
171+tries to subscribe to our app. Of course, you don't just
172+subscribe to an app; you subscribe to a path on that app. This
173+path comes in as the argument to `++peer`.
174+
175+In our case, we don't care what path you subscribed on, and all
176+we do is print out that you subscribed. Arvo keeps track of your
177+subscriptions, so you don't have to. You can access your
178+subscribers by looking at `sup` in the bowl that's passed in.
179+`sup` is of type `(map bone ,[@p path])`, which associates bones
180+with the urbit who subscribed, and which path they subscribed on.
181+If you want to talk to your subscribers, send them messages along
182+their bone.
183+
184+`++poke-noun` spams the given arguement to all our subscribers.
185+There's a few things we haven't seen before. Firstly, `:_(a b)`
186+is the same as `[b a]`. It's just a convenient way of formatting
187+things when the first thing in a cell is much more complicated
188+than the second. Thus, we're producing our state unchanged.
189+
190+Our list of moves is the result of a call to `++turn`. `++turn`
191+is what many languages call "map" -- it runs a function on every
192+item in a list and collects the results in a list. The list is
193+`(prey /the-path hid)` and the function is the `|=` line right
194+after it.
195+
196+`++prey` is a standard library function defined in `zuse`. It
197+takes a path and a bowl and gives you a list of the subscribers
198+who are subscribed on a path that begins with the given path.
199+"Prey" is short for "prefix".
200+
201+Now we have the list of relevant subscribers. This a list of
202+triples, `[bone @p path]`, where the only thing we really need is
203+the bone because we don't care what urbit they are or what exact
204+path they subscribed on. Thus, our transformer function takes
205+`[o=bone *]` and produces `[o %diff %noun arg]`, which is a move
206+that means "tell bone `o` this subscription update: `[%noun
207+arg]`". This is fairly dense code, but what it's doing is
208+straightforward.
209+
210+###:sink
211+
212+`:source` should now make sense. `:sink` is a little longer,
213+but not much more complicated.
214+
215+In `:sink`, our definition of of `++move` is different. All
216+moves start with a `bone`, and we conventionally refer to the
217+second half as the "card", so that we can say a move is an action
218+that sends a card along a bone.
219+
220+We have two kinds of cards here: we `%peer` to start a
221+subscription, and we `%pull` to stop it. Both of these are
222+"forward" moves that may receive a response, so they need a wire
223+to tack onto the duct before they pass it on. They also need a
224+target, which is a pair of an urbit and an app name. Additionally, `%peer`
225+needs a path on that app to subscribe too. `%pull` doesn't need
226+this, because its semantics are to cancel any subscriptions
227+coming over this duct. If your bone and wire are the same as
228+when you subscribed, then the cancellation will happen correctly.
229+
230+The only state we need for `:sink` is a loobean to tell whether
231+we're already subscribed to `:source`. We use `available=?`,
232+where `?` is the sign of type boolean (similar to `*`, `@`) (which defaults to true).
233+
234+In `++poke-noun` we check our input to see both if it's `%on` and
235+we're available. If so, we produce the move to subscribe to
236+`:source`:
237+
238+```
239+[ost %peer /subscribe [our %source] /the-path]
240+```
241+
242+Also, we set available to false (`|`) with `+>.$(available |)`.
243+
244+Otherwise, if our input is `%off` and we're already subscribed
245+(i.e. `available` is false), then we unsubscribe from
246+`:source`:
247+
248+```
249+[ost %pull /subscribe [our %source] ~]
250+```
251+
252+It's important to send over the same bone and wire (`/subscribe`)
253+as the one we originally subscribed on.
254+
255+We also set `available` to true (`&`).
256+
257+If neither of these cases are true, then we just print out our
258+current subscription state and do nothing.
259+
260+`++diff-noun` is called when we get a `%diff` update along a
261+subscription with a mark of `noun`. `++diff-noun` is given the
262+wire that we originally passed with the `%peer` subscription
263+request along and the data we got back. In our case we just
264+print out the data.
265+
266+`++reap` is called when we receive an acknowledgment as to
267+whether the subscription was handled successfully. You can
268+remember that `++reap` is the counterpart to `++peer` as it's
269+almost spelled the same as 'peer' backwards. Similarly, `coup` is
270+similar to 'poke' backwards.
271+
272+Moving forward, `++reap` is given the wire we attempted to
273+subscribe over, possibly along with an error message in cases of
274+failure. `(unit type)` means "either `~` or `[~ type]`, which
275+means it's used like Haskell's "maybe" or C's nullability. If
276+`error` is `~`, then the subscription was successful, so we tell
277+that to the user. Otherwise, we print out the error message.
278+
279+Excercises XX
docs/dev/hoon/leap-in/web-apps.mdnew file+272
@@ -0,0 +1,272 @@
1+---
2+next: true
3+sort: 6
4+title: Web Apps
5+---
6+
7+We've done purely functional web pages as hook files, and we've
8+done command line apps, so now let's interact with an app over
9+the web. The fundamental concepts are no different than from the
10+command line -- you send "poke" messages to apps and subscribe to
11+data streams. The only difference is that you do it with
12+javascript.
13+
14+Let's create a small web app that counts the number of times you
15+poke it. There'll be a button to poke the app, and line of text
16+below it saying how many times the app has been poked. We can
17+update this by subscribing to that information from the app.
18+
19+Let's first write the app, `/ape/click.hoon`:
20+
21+```
22+/? 314
23+!:
24+|%
25+++ move ,[bone %diff %mark *]
26+--
27+!:
28+|_ [hid=bowl clicks=@]
29+++ poke-click
30+ |= click=%click
31+ ~& [%poked +(clicks)]
32+ :_ +>.$(clicks +(clicks))
33+ %+ turn (prey /the-path hid)
34+ |=([o=bone *] [o %diff %clicks +(clicks)])
35+++ peer-the-path
36+ |= pax=path
37+ [[[ost.hid %diff %clicks clicks] ~] +>.$]
38+--
39+```
40+
41+There's nothing really new here, except that we use a couple of
42+new marks, `click` and `clicks`. When we get poked with a
43+`click`, we increment the variable `clicks` in our state and tell
44+all our subcribers the new value. When someone subscribes to us
45+on the path `/the-path`, we immediately give them the current
46+number of clicks.
47+
48+Let's take a look at the new marks. Here's `/mar/click.hoon`:
49+
50+```
51+|_ click=%click
52+++ grab
53+ |%
54+ ++ noun |=(* %click)
55+ ++ json
56+ |= jon=^json
57+ ?> =('click' (need (so:jo jon)))
58+ %click
59+ --
60+--
61+```
62+
63+The mark `click` has hoon type `%click`, which means the only
64+valid value is `%click`. We can convert from `noun` by just
65+producing `%click`.
66+
67+We also convert from json by parsing a json string with `so:jo`,
68+asserting the parsing succeeded with `need`, and asserting the
69+result was 'click' with `?>`, which asserts that its first child
70+is true.
71+
72+> Note the argument to `++json`is `jon=^json`. Why `^json`?
73+> `++json` shadows the type definition, so if we want to refer to
74+> the type, we have to prepend a `^`. This extends to multiple
75+> levels: `^^^foo` means "not the innermost `foo`, nor the next
76+> innermost, nor the next innermost, but the next innermost".
77+
78+> `++jo` in `zuse` is a useful library for parsing complex json
79+> into hoon structures. In this case, the `:` between `so` and
80+> `jo` means 'inside of', because `so` is an arm contained within
81+> the core `jo`. Our case is actually simple enough that the
82+> `?>` line could have been `?> =([%s 'click'] jon)`.
83+
84+We can test this mark from the command line:
85+
86+```
87+~fintud-macrep:dojo> &click %click
88+%click
89+~fintud-macrep:dojo> &click &json [%s 'click']
90+%click
91+~fintud-macrep:dojo> &click &json &mime [/text/json (taco '"click"')]
92+%click
93+~fintud-macrep:dojo> &click &json &mime [/text/json (taco '"clickety"')]
94+/~fintud-macrep/home/0/mar/click:<[7 5].[8 11]>
95+ford: casting %json to %click
96+ford: cast %click
97+```
98+
99+And `/mar/clicks.hoon`:
100+
101+```
102+|_ clicks=@
103+++ grow
104+ |%
105+ ++ json
106+ (joba %clicks (jone clicks))
107+ --
108+--
109+```
110+
111+`clicks` is just an atom. We convert to json by creating an
112+object with a single field "clicks" with our value.
113+
114+> Be sure to checkout section 3bD, JSON and XML, in zuse.hoon
115+> `++joba` is just a function that takes a key-value pair and
116+> produces a JSON object with one element.
117+
118+```
119+~fintud-macrep:dojo> &json &clicks 6
120+[%o p={[p='clicks' q=[%n p=~.^]]}]
121+~fintud-macrep:dojo> &mime &json &clicks 6
122+[[%text %json ~] p=12 q='{"clicks":6}']
123+```
124+
125+Now that we know the marks involved, take another look at the app
126+above. Everything should be pretty straightforward. Let's poke
127+the app from the command line.
128+
129+```
130+~fintud-macrep:dojo> |start %click
131+>=
132+~fintud-macrep:dojo> :click &click %click
133+[%poked 1]
134+>=
135+~fintud-macrep:dojo> :click &click %click
136+[%poked 2]
137+>=
138+```
139+
140+**Exercise**:
141+
142+- Modify `:sink` from the subcriptions chapter to listen to
143+ `:click` and print out the subscription updates on the command
144+ line.
145+
146+That's all that's needed for the back end. The front end is just
147+some "sail" html and javascript. Here's `/pub/click/hymn.hook`:
148+
149+```
150+;html
151+ ;head
152+ ;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js");
153+ ;script(type "text/javascript", src "/~~/~/at/home/lib/urb.js");
154+ ;title: Clickety!
155+ ==
156+ ;body
157+ ;div#cont
158+ ;input#go(type "button", value "Poke!");
159+ ;div#err(class "disabled");
160+ ;div#clicks;
161+ ==
162+ ;script(type "text/javascript", src "click/main.js");
163+ ==
164+==
165+```
166+
167+You should recognize the sail syntax from an earlier chapter.
168+Aside from jquery, we also include `urb.js`, which is a framework
169+for interacting with urbit.
170+
171+We have a button labeled "Poke!" and a div with id `clicks` where
172+we'll put the number of clicks. We also include a small
173+javascript file where the client-side application logic can be
174+found. It's in `/pub/click/main.js`:
175+
176+```
177+$(function() {
178+ var clicks, $go, $clicks, $err
179+
180+ $go = $('#go')
181+ $clicks = $('#clicks')
182+ $err = $('#err')
183+
184+ window.urb.appl = "click"
185+
186+ $go.on("click",
187+ function() {
188+ window.urb.send(
189+ "click", {mark: "click"}
190+ ,function(err,res) {
191+ if(err)
192+ return $err.text("There was an error. Sorry!")
193+ if(res.data !== undefined &&
194+ res.data.ok !== undefined &&
195+ res.data.ok !== true)
196+ $err.text(res.data.res)
197+ else
198+ console.log("poke succeeded");
199+ })
200+ })
201+
202+ window.urb.bind('/the-path',
203+ function(err,dat) {
204+ clicks = dat.data.clicks
205+ $clicks.text(clicks)
206+ }
207+ )
208+})
209+```
210+
211+We first set the default application to "click". A page can, of
212+course, talk to multiple apps by specifying on each message which
213+app to talk to.
214+
215+We set up two event handlers. When we click the button, we run
216+`window.urb.send`, which sends a poke to an app. The arguments
217+are data, parameters, and callback. The data is the specific
218+data to send. The parameters are all optional, but here's a list
219+of the available ones:
220+
221+- `ship`: target urbit. Defaults to `window.urb.ship`, which
222+ defaults to the urbit which served the page.
223+- `appl`: target app. Defaults to `window.urb.appl`, which
224+ defaults to null.
225+- `mark`: mark of the data. Defaults to `window.urb.send.mark`,
226+ which defaults to "json".
227+- `wire`: wire of the poke. Defaults to `/`.
228+
229+In our case, we specify only that the mark is "click".
230+
231+The callback funciton is called when we receive an
232+acknowledgment. If there was an error, we put it in the `err`
233+div that we defined above. Otherwise, we printf to the console a
234+message saying the poke succeeded. A common pattern is to gray
235+out a button when you click it and only reenable it when you get
236+the positive acknowledgment.
237+
238+We also call `window.urb.bind`, which subscribes to a data stream
239+on an app. It also takes three arguments: path, parameters, and
240+callback. The path is the path on the app to subscribe to. The
241+parameters are all optional (inded, we omit them entirely here),
242+but are similar to those for `send`:
243+
244+- `ship`: target urbit. Defaults to `window.urb.ship`, which
245+ defaults to the urbit which served the page.
246+- `appl`: target app. Defaults to `window.urb.appl`, which
247+ defaults to null.
248+- `mark`: mark of expected data. Data of other marks is
249+ converted to this mark on the server before coming to the web
250+ front end. Defaults to `window.urb.bind.mark`, which defaults
251+ to "json".
252+- `wire`: wire of the subscription. Defaults to the given path.
253+
254+The callback function here just updates the data in the `clicks`
255+div. A truly robust app would intelligently handle errors, of
256+course.
257+
258+This app can be tested from the web by going to
259+`/~~/home/pub/click` on your server. Usually, this is
260+`ship-name.urbit.org/~~/home/pub/click`.
261+
262+Note that the app doesn't have anything web-specific in itself.
263+As far as it knows, it's just receiving pokes and subscriptions.
264+The javascript is fairly pure as well, sending and receiving json
265+everywhere. The marks are the translation layer, and they're the
266+only things that need to know how the hoon types map to json.
267+
268+**Exercise**:
269+
270+- Open the app in multiple tabs, click the button, and verify
271+ that all the tabs stay in sink. Poke it manually from the
272+ command line and verify the tabs are updated as well.
docs/dev/hoon/library/0.md+20−18
@@ -3,14 +3,11 @@ volume 0, Kelvin Versioning.
3
3
4### `++hoon`
4### `++hoon`
5
5
6− ++ hoon %164 :: version stub
7−
8−Declares the current Hoon version number in degrees Kelvin.
6+Hoon version number Kelvin
9
7
10−When normal people release normal software, they count by fractions, and
8+Traditional software versioning schema use fractions, and count up. Thus, they
11−they count up. Thus, they can keep extending and revising their systems
9+can keep extending and revising their systems incrementally. This is generally
12−incrementally. This is generally considered a good thing. It generally
10+considered a good thing, and it generally is.
13−is.
14
11
15In some cases, however, specifications needs to be permanently frozen.
12In some cases, however, specifications needs to be permanently frozen.
16This requirement is generally found in the context of standards. Some
13This requirement is generally found in the context of standards. Some
@@ -21,17 +18,22 @@ have the same ethertype). Moreover, many standards render themselves
21incompatible in practice through excessive enthusiasm for extensibility.
18incompatible in practice through excessive enthusiasm for extensibility.
22They may not be perma-frozen, but they probably should be.
19They may not be perma-frozen, but they probably should be.
23
20
24−The true, Martian way to perma-freeze a system is what I call Kelvin
21+As urbit is designed to be a standard, we devised a versioning scheme that will
25−versioning. In Kelvin versioning, releases count down by integer degrees
22+allow it to eventually be frozen: Kelvin versioning. In Kelvin versioning,
26−Kelvin. At absolute zero, the system can no longer be changed. At 1K,
23+releases count down by integer degrees Kelvin. At absolute zero, the system can
27−one more modification is possible. And so on. For instance, Nock is at
24+no longer be changed. At 1K, one more modification is possible. And so on. For
28−5K. It might change, though it probably won't. Nouns themselves are at
25+instance, Nock is at 5K. It might change, though it probably won't. Nouns
29−0K - it is impossible to imagine changing anything about their three
26+themselves are at 0K - it is impossible to imagine changing anything about
30−sentence definition.
27+their three sentence definition.
28+
29+Source
30+------
31+
32+ ++ hoon %164 :: version stub
31
33
32−------------------------------------------------------------------------
34+Examples
35+--------
33
36
34− ~zod/try=> stub
37+ ~zod/try=> hoon
35− 164
38+ %163
36
39
37−------------------------------------------------------------------------
docs/dev/hoon/library/1.md+795−344
@@ -5,11 +5,15 @@ volume 1, Hoon Structures
5
5
6### `++abel`
6### `++abel`
7
7
8− ++ abel typo :: original sin: type
9−
10Biblical names in hoon are primarily aliases for the compiler.
8Biblical names in hoon are primarily aliases for the compiler.
11
9
12−See also: `++typo`
10+Source
11+------
12+
13+ ++ abel typo :: original sin: type
14+
15+Examples
16+--------
13
17
14 ~zod/try=> *abel
18 ~zod/try=> *abel
15 %void
19 %void
@@ -18,12 +22,18 @@ See also: `++typo`
18
22
19### `++axis`
23### `++axis`
20
24
21− ++ axis ,@ :: tree address
25+Nock axis
26+
27+A Nock axis inside a [noun](). After the leading 1, in binary, a `1` signfies
28+right and `0` left.
22
29
23−A Nock axis inside a noun. After the leading 1, in binary, a 1 signfies
30+Source
24−right and 0 left.
31+------
25
32
26−See also: `++clue`, `++limb`, `++slot`, `++peg`, and Section 2fC
33+ ++ axis ,@ :: tree address
34+
35+Examples
36+--------
27
37
28 ~zod/try=> *axis
38 ~zod/try=> *axis
29 0
39 0
@@ -34,24 +44,22 @@ See also: `++clue`, `++limb`, `++slot`, `++peg`, and Section 2fC
34 ~zod/try=> `axis`0b110
44 ~zod/try=> `axis`0b110
35 6
45 6
36
46
37−------------------------------------------------------------------------
47+-----------------------------------------------------------------------
38−
39−### `++also`
40
48
41− ++ also ,[p=term q=wing r=type] :: alias
49+### `++base`
42
50
43−XX unused?
51+Base type
44
52
45−------------------------------------------------------------------------
53+A base type that [noun]()s are built from. A `++base` is either a noun, cell, boolean or
54+null labelled with an [odor]().
46
55
47−### `++base`
56+Source
57+------
48
58
49 ++ base ?([%atom p=odor] %noun %cell %bean %null) :: axils, @ * ^ ? ~
59 ++ base ?([%atom p=odor] %noun %cell %bean %null) :: axils, @ * ^ ? ~
50
60
51−A base type that nouns are built from. Either a noun, a cell, loobean or
61+Examples
52−null labelled with an odor.
62+--------
53−
54−See also: `++tile`, `++twig`
55
63
56 ~zod/try=> *base
64 ~zod/try=> *base
57 %null
65 %null
@@ -68,10 +76,17 @@ See also: `++tile`, `++twig`
68
76
69### `++bean`
77### `++bean`
70
78
79+Boolean
80+
81+`0`, `&`, or `%.y` are true, and `1`, `|`, and `%.n` are false.
82+
83+Source
84+------
85+
71 ++ bean ,? :: 0=&=yes, 1=|=no
86 ++ bean ,? :: 0=&=yes, 1=|=no
72
87
73−The Urbit version of a boolean, which we call a loobean. 0 or & is
88+Examples
74−"yes", 1 or | is "no".
89+--------
75
90
76 ~zod/try=> *bean
91 ~zod/try=> *bean
77 %.y
92 %.y
@@ -85,11 +100,17 @@ The Urbit version of a boolean, which we call a loobean. 0 or & is
85
100
86### `++beer`
101### `++beer`
87
102
88− ++ beer $|(@ [~ p=twig]) :: simple embed
103+Tape builder
104+
105+Used to build [tape]()s internally.
89
106
90−Used to build tapes internally.
107+Source
108+------
91
109
92−See also: `++phax`, `++scat`, section 2fD
110+ ++ beer $|(@ [~ p=twig]) :: simple embed
111+
112+Examples
113+--------
93
114
94 ~zod/try=> `beer`'as'
115 ~zod/try=> `beer`'as'
95 29.537
116 29.537
@@ -100,6 +121,13 @@ See also: `++phax`, `++scat`, section 2fD
100
121
101### `++beet`
122### `++beet`
102
123
124+XML interpolation cases
125+
126+Used internally.
127+
128+Source
129+------
130+
103 ++ beet $| @ :: advanced embed
131 ++ beet $| @ :: advanced embed
104 $% [%a p=twig] :: take tape
132 $% [%a p=twig] :: take tape
105 [%b p=twig] :: take manx
133 [%b p=twig] :: take manx
@@ -108,19 +136,22 @@ See also: `++phax`, `++scat`, section 2fD
108 [%e p=twig q=(list tuna)] :: element literal
136 [%e p=twig q=(list tuna)] :: element literal
109 == ::
137 == ::
110
138
111−Cases for XML interpolation. Used internally.
112−
113−See also: `++sail`, section 2fD
114−
115------------------------------------------------------------------------
139------------------------------------------------------------------------
116
140
117### `++bloq`
141### `++bloq`
118
142
119− ++ bloq ,@ :: blockclass
143+Blocksize
120
144
121Atom representing a blocksize, by convention expressed as a power of 2.
145Atom representing a blocksize, by convention expressed as a power of 2.
122
146
123−See also: section 2cA
147+
148+Source
149+------
150+
151+ ++ bloq ,@ :: blockclass
152+
153+Examples
154+--------
124
155
125 ~zod/try=> :: ++met measures how many bloqs long an atom is
156 ~zod/try=> :: ++met measures how many bloqs long an atom is
126 ~zod/try=> (met 3 256)
157 ~zod/try=> (met 3 256)
@@ -131,11 +162,17 @@ See also: section 2cA
131
162
132### `++calf`
163### `++calf`
133
164
134− ++ calf ,[p=(map ,@ud wine) q=wine] ::
165+Cyclical backreferences
135
166
136Encodes cyclical backreferences in types. Used in pretty printing.
167Encodes cyclical backreferences in types. Used in pretty printing.
137
168
138−See also: `++wine`, `++dole`, `++doge`, `++dish`, section 2fC
169+Source
170+------
171+
172+ ++ calf ,[p=(map ,@ud wine) q=wine] ::
173+
174+Examples
175+--------
139
176
140 ~zod/try=> `calf`[~ %atom %ta]
177 ~zod/try=> `calf`[~ %atom %ta]
141 [p={} q=[%atom p=%ta]]
178 [p={} q=[%atom p=%ta]]
@@ -152,51 +189,66 @@ See also: `++wine`, `++dole`, `++doge`, `++dish`, section 2fC
152
189
153### `++char`
190### `++char`
154
191
155− ++ char ,@tD :: UTF-8 byte
192+Char
156
193
157−A single character. Odor `@tD` designates a single Unicode byte. All
194+A single character. [odor]() [`@tD`]() designates a single unicode byte. All
158−parsers consume `++tape` (a list of `++char`).
195+parsers consume [`++tape`]()s, which are lists of `++char`.
159
196
160−See also: `++tape`, `++lust`, `++just`, `++mask`, chapter 2f
161
197
162− ~zod/try=> *char
198+Source
163− ~~
199+------
164
200
201+ ++ char ,@tD :: UTF-8 byte
202+
203+Examples
204+--------
205+
165− ~zod/try=> (char 97)
206+ ~zod/try=> *char
207+ ''
208+ ~zod/try> (char 97)
166− ~~a
209+ 'a'
167
210
168------------------------------------------------------------------------
211------------------------------------------------------------------------
169
212
170### `++chub`
213### `++chub`
171
214
215+Attach jets
216+
217+Used by the compiler (implicitly by `%sgcn`) to attach jets.
218+
219+Source
220+------
221+
172 ++ chub :: registered battery
222 ++ chub :: registered battery
173 $: p=(pair chum tyre) :: definition
223 $: p=(pair chum tyre) :: definition
174 q=* :: battery
224 q=* :: battery
175 r=(unit (pair axis chub)) :: parent
225 r=(unit (pair axis chub)) :: parent
176 == ::
226 == ::
177
227
178−Used by the compiler (implicitly by `%sgcn`) to attach jets.
179−
180−See also: Section 2fB.
181−
182------------------------------------------------------------------------
228------------------------------------------------------------------------
183
229
184### `++chum`
230### `++chum`
185
231
232+Jet hint information
233+
234+Jet hint information that must be present in the body of a `~/` or `~%`
235+rune. A `++chum` can optionally contain a kelvin version, jet vendor,
236+and "{major}.{minor}" version number.
237+
238+Source
239+------
240+
186 ++ chum $? lef=term :: jet name
241 ++ chum $? lef=term :: jet name
187 [std=term kel=@] :: kelvin version
242 [std=term kel=@] :: kelvin version
188 [ven=term pro=term kel=@] :: vendor and product
243 [ven=term pro=term kel=@] :: vendor and product
189 [ven=term pro=term ver=@ kel=@] :: all of the above
244 [ven=term pro=term ver=@ kel=@] :: all of the above
190 == ::
245 == ::
191
246
192−Jet hint information that must be present in the body of a \~/ or \~%
247+Examples
193−rune. A `++chum` can optionally contain a kelvin version, jet vendor,
248+--------
194−and major.minor version number.
195
249
196XX there's a ++chum in zuse that's politely causing this not to work
250XX there's a ++chum in zuse that's politely causing this not to work
197
251
198−See also: `++twig`, `++clue`
199−
200 ~zod/try=> `chum`'hi'
252 ~zod/try=> `chum`'hi'
201 lef=%hi
253 lef=%hi
202
254
@@ -207,43 +259,53 @@ See also: `++twig`, `++clue`
207
259
208### `++clue`
260### `++clue`
209
261
210− ++ clue ,[p=axis q=chum r=tyre] :: battery definition
262+Attach jet
211
263
212Used by compiler to attach jets.
264Used by compiler to attach jets.
213
265
214−XX implementation does not currenlty match docs
266+Source
267+------
215
268
216−See also: section 2fB
269+ ++ clue ,[p=axis q=chum r=tyre] :: battery definition
270+
271+XX implementation does not currenlty match docs
217
272
218------------------------------------------------------------------------
273------------------------------------------------------------------------
219
274
220### `++coil`
275### `++coil`
221
276
277+Tuple of core information
278+
279+Variance `p`, subject type `q`, and `q`: optional compiled nock, and arms. Used as an
280+intermediate step within Section 2fB. Converted by `++core` to %core type.
281+
282+Source
283+------
284+
222 ++ coil $: p=?(%gold %iron %lead %zinc) :: core type
285 ++ coil $: p=?(%gold %iron %lead %zinc) :: core type
223 q=type ::
286 q=type ::
224 r=[p=?(~ ^) q=(map term foot)] ::
287 r=[p=?(~ ^) q=(map term foot)] ::
225 == ::
288 == ::
226
289
227−Core information tuple: variance, subject type, optional compiled nock,
228−and arms. Used as an intermediate step within Section 2fB. Converted by
229−`++core` to %core type.
230−
231−See also: `++core`, Section 2fB
232−
233------------------------------------------------------------------------
290------------------------------------------------------------------------
234
291
235### `++coin`
292### `++coin`
236
293
294+Noun literal syntax cases
295+
296+Noun literal syntax cases: atoms, jammed nouns, and nestable tuples.
297+Parsed and printed using [`++so`]() and [`++co`]() cores.
298+
299+Source
300+------
301+
237 ++ coin $% [%$ p=dime] ::
302 ++ coin $% [%$ p=dime] ::
238 [%blob p=*] ::
303 [%blob p=*] ::
239 [%many p=(list coin)] ::
304 [%many p=(list coin)] ::
240 == ::
305 == ::
241
306
242−Noun literal syntax cases: atoms, jammed nouns, and nestable tuples.
307+Examples
243−Parsed and printed using `++so` and `++co` cores in Section 2eL
308+--------
244−respectively.
245−
246−See also: `++so`, `++co`, Section 2eL, `++dime`
247
309
248 ~zod/try=> `coin`(need (slay '~s1'))
310 ~zod/try=> `coin`(need (slay '~s1'))
249 [%$ p=[p=~.dr q=18.446.744.073.709.551.616]]
311 [%$ p=[p=~.dr q=18.446.744.073.709.551.616]]
@@ -266,17 +328,23 @@ See also: `++so`, `++co`, Section 2eL, `++dime`
266
328
267### `++cord`
329### `++cord`
268
330
331+UTF-8 text
332+
333+One of Hoon's two string types (the other being [`++tape`]()). A cord is an
334+atom of UTF-8 text. [`++trip`]() and [`++crip`]() convert between cord and
335+`++tape`.
336+
337+Source
338+------
339+
269 ++ cord ,@t :: text atom (UTF-8)
340 ++ cord ,@t :: text atom (UTF-8)
270
341
271−One of Hoon's two string types (the other being `++tape`). A cord is an
342+Examples
272−atom of UTF-8 text. `++trip` and `++crip` convert between cord and
343+--------
273−`++tape`
274
344
275−Odor `@t` designates a Unicode atom, little-endian: the first character
345+Odor [`@t`]() designates a Unicode atom, little-endian: the first character
276in the text is the low byte.
346in the text is the low byte.
277
347
278−See also: `++trip`, `++crip`, Section 2eJ
279−
280 ~zod/try=> `@ux`'foobar'
348 ~zod/try=> `@ux`'foobar'
281 0x7261.626f.6f66
349 0x7261.626f.6f66
282
350
@@ -289,13 +357,20 @@ See also: `++trip`, `++crip`, Section 2eJ
289
357
290### `++date`
358### `++date`
291
359
292− ++ date ,[[a=? y=@ud] m=@ud t=tarp] :: parsed date
360+Point in time
293
361
294−A point in time. A loobean designating AD or BC, a year atom, a month
362+A boolean designating AD or BC, a year atom, a month
295−atom, and a `++tarp`, which is a day atom and a time.
363+atom, and a [`++tarp`](), which is a day atom and a time.
296
364
365+Source
366+------
367+
368+ ++ date ,[[a=? y=@ud] m=@ud t=tarp] :: parsed date
369+
370+Examples
371+--------
372+
297−See also: `++year`, `++yore`, Section 2cH, `++stud`, `++dust`, Section
373+See also: [`++year`](), [`++yore`]() [`++stud`](), [`++dust`]()
298−3bc
299
374
300 ~zod/try=> `date`(yore ~2014.6.6..21.09.15..0a16)
375 ~zod/try=> `date`(yore ~2014.6.6..21.09.15..0a16)
301 [[a=%.y y=2.014] m=6 t=[d=6 h=21 m=9 s=15 f=~[0xa16]]]
376 [[a=%.y y=2.014] m=6 t=[d=6 h=21 m=9 s=15 f=~[0xa16]]]
@@ -304,40 +379,39 @@ See also: `++year`, `++yore`, Section 2cH, `++stud`, `++dust`, Section
304
379
305### `++dime`
380### `++dime`
306
381
307− ++ dime ,[p=@ta q=@] ::
382+Odor-atom pair
308
383
309−Odor-atom pair, used in `++coin`.
384+Used in [`++coin`](). Convenience methods [`++scot`]() and [`++scow`]() (in
385+Section 2eL) print dimes as [`++cord`]() and [`++tape`](), respectively.
386+[`++slat`](), [`++slav`](), and [`++slaw`]() are used to parse atoms of
387+specific [odor]()s.
310
388
311−Convenience methods `++scot` and `++scow` (in Section 2eL) print dimes
389+Source
312−as cords/tapes, `++slat`, `++slav`, and `++slaw` are used to parse atoms
390+------
313−of specific odor.
314
391
315−See also: `++so`, `++co`, Section 2eL, `++coin`
392+ ++ dime ,[p=@ta q=@] ::
393+
394+Examples
395+--------
316
396
317 ~zod/try=> +>:(slay '0x123')
397 ~zod/try=> +>:(slay '0x123')
318 p=[p=~.ux q=291]
398 p=[p=~.ux q=291]
319
399
320------------------------------------------------------------------------
400------------------------------------------------------------------------
321
401
322−### `++dram`
402+### `++each`
323−
324− ++ dram $% [| p=(map ,@tas dram)] :: simple unix dir
325− [& p=@ud q=@] ::
326− == ::
327−
328−The structure of a unix filesystem tree. A `++dram` is one of two cases:
329−`|` a directory - a map of names to deeper tree structures, `&` a file -
330−a numbered atom of data.
331
403
332−XX Unused
404+Mold of fork between two
333
405
334−------------------------------------------------------------------------
406+[mold]() generator: produces a dicriminated [fork]() between two types.
335
407
336−### `++each`
408+Source
409+------
337
410
338− ++ each |*([a=$+(* *) b=$+(* *)] $%([& p=a] [| p=b])) :: either a or b
411+ ++ each |*([a=$+(* *) b=$+(* *)] $%([& p=a] [| p=b])) :: either a or b
339
412
340−Tile generator: produces a discriminated fork between two types.
413+Examples
414+--------
341
415
342 ~zod/try=> :type; *(each cord time)
416 ~zod/try=> :type; *(each cord time)
343 [%.y p='']
417 [%.y p='']
@@ -347,11 +421,19 @@ Tile generator: produces a discriminated fork between two types.
347
421
348### `++edge`
422### `++edge`
349
423
424+Parsing location metadata
425+
426+Optional result `p` and parsing continuation `q`.
427+
428+Source
429+------
430+
350− ++ edge ,[p=hair q=(unit ,[p=* q=nail])] :: parsing output
431+ ++ edge ,[p=hair q=(unit ,[p=* q=nail])] :: parsing output
351
432
352−Parsing location metadata: optional result and parsing continuation.
433+Examples
434+--------
353
435
354−See also: Section 2eD, `++rule`
436+See also: Section 2eD, [`++rule`]()
355
437
356 ~zod/try=> *edge
438 ~zod/try=> *edge
357 [p=[p=0 q=0] q=~]
439 [p=[p=0 q=0] q=~]
@@ -362,15 +444,23 @@ See also: Section 2eD, `++rule`
362
444
363### `++foot`
445### `++foot`
364
446
447+Cases of arms by variance model.
448+
449+`%ash` arms are [`dry`]() and [geometric]().
450+
451+Source
452+------
453+
365 ++ foot $% [%ash p=twig] :: dry arm, geometric
454 ++ foot $% [%ash p=twig] :: dry arm, geometric
366 [%elm p=twig] :: wet arm, generic
455 [%elm p=twig] :: wet arm, generic
367 [%oak ~] :: XX not used
456 [%oak ~] :: XX not used
368 [%yew p=(map term foot)] :: XX not used
457 [%yew p=(map term foot)] :: XX not used
369 == ::
458 == ::
370
459
371−Cases of arms by variance model.
460+Examples
461+--------
372
462
373−See also: `++ap`, `++ut`, Section 2fB, Section 2fC
463+See also: [`++ap`](), [`++ut`]()
374
464
375 ~zod/try=> *foot
465 ~zod/try=> *foot
376 [%yew p={}]
466 [%yew p={}]
@@ -388,12 +478,21 @@ See also: `++ap`, `++ut`, Section 2fB, Section 2fC
388
478
389### `++gate`
479### `++gate`
390
480
391− ++ gate $+(* *) :: general gate
481+Function
392
482
393−An core with one arm, `$`, which transforms a sample noun into a product
483+A core with one arm, `$`--the empty name--which transforms a sample noun into a product
394−noun. If used dryly as a type, subject must have a sample type of `*`.
484+noun. If used [dryly]() as a type, the [subject]() must have a sample type of [`*`]().
395
485
486+
487+Source
488+------
489+
490+ ++ gate $+(* *) :: general gate
491+
492+Examples
493+--------
494+
396−See also: `++lift`, `++cork`, Core Language Doc
495+See also: [`++lift`](), [`++cork`]()
397
496
398 ~zod/try=> *gate
497 ~zod/try=> *gate
399 <1|mws [* <101.jzo 1.ypj %164>]>
498 <1|mws [* <101.jzo 1.ypj %164>]>
@@ -409,11 +508,17 @@ See also: `++lift`, `++cork`, Core Language Doc
409
508
410### `++hair`
509### `++hair`
411
510
412− ++ hair ,[p=@ud q=@ud] :: parsing trace
511+Parsing line and column
512+
513+A pair of two [`@ud`]() used in parsing indicating line and column number.
413
514
414−A pair of two `@ud` used in parsing indicating line and column number.
515+Source
516+------
415
517
416−See also: `++last`, Section 2eB
518+ ++ hair ,[p=@ud q=@ud] :: parsing trace
519+
520+Examples
521+--------
417
522
418 ~zod/try=> *hair
523 ~zod/try=> *hair
419 [p=0 q=0]
524 [p=0 q=0]
@@ -429,20 +534,20 @@ See also: `++last`, Section 2eB
429
534
430### `++like`
535### `++like`
431
536
537+Mold generator for an edge
538+
539+`++like` generates an `++edge` with a parsed result set to a specific type.
540+
541+Source
542+------
543+
432− ++ like |* a=_,* :: generic edge
544+ ++ like |* a=_,* :: generic edge
433− |= b=_`*`[(hair) ~] ::
434− :- p=(hair -.b) ::
435− ^= q ::
436 ?@ +.b ~ ::
545 ?@ +.b ~ ::
437 :- ~ ::
546 :- ~ ::
438 u=[p=(a +>-.b) q=[p=(hair -.b) q=(tape +.b)]] ::
547 u=[p=(a +>-.b) q=[p=(hair -.b) q=(tape +.b)]] ::
439
548
440−Tile generator for an `++edge`. `++like` generates an `++edge` with a
549+Examples
441−parsed result set to a specific type.
550+--------
442−
443−See also: `++easy`, `++just`/`++jest`, `++knee`, `++mask`, `++shim`,
444−`++stir`, `++stun`, Section 2eC
445−
446 ~zod/try=> *(like char)
551 ~zod/try=> *(like char)
447 [p=[p=0 q=0] q=~]
552 [p=[p=0 q=0] q=~]
448
553
@@ -476,13 +581,16 @@ See also: section 2fC-2fD
476
581
477### `++line`
582### `++line`
478
583
479− ++ line ,[p=[%leaf p=odor q=@] q=tile] :: %kelp case
480−
481XX move to `++ut`
584XX move to `++ut`
482
585
483−Dicriminated union unionee XX
586+Source
587+------
588+
589+ ++ line ,[p=[%leaf p=odor q=@] q=tile] :: %kelp case
590+
484
591
485−Used in compilation and grammar, section 2fC-2fD
592+Examples
593+--------
486
594
487 ~zod/try=> (ream '$%([1 a] [%2 b])')
595 ~zod/try=> (ream '$%([1 a] [%2 b])')
488 [ %bccm
596 [ %bccm
@@ -503,13 +611,21 @@ Used in compilation and grammar, section 2fC-2fD
503
611
504### `++list`
612### `++list`
505
613
506− ++ list |* a=_,* :: null-term list
614+List
507− $|(~ [i=a t=(list a)]) ::
508
615
509−Tile generator. `++list` generates a tile of a null-terminated list of
616+[mold]() generator. `++list` generates a mold of a null-termanated list of a
510homogenous type.
617homogenous type.
511
618
619+
620+Source
621+------
622+
623+ ++ list |* a=_,* :: null-term list
624+
625+Examples
626+--------
627+
512−See also: `++turn`, `++snag`, section 2bB.
628+See also: [`++turn`](), [`++snag`]()
513
629
514 ~zod/try=> *(list)
630 ~zod/try=> *(list)
515 ~
631 ~
@@ -522,22 +638,33 @@ See also: `++turn`, `++snag`, section 2bB.
522
638
523### `++lone`
639### `++lone`
524
640
525− ++ lone |*(a=$+(* *) ,p=a) :: just one thing
641+Tile generator. `++lone` puts face of `p` on something.
526
642
527XX unused
643XX unused
528
644
529−Tile generator. `++lone` puts face of `p` on something.
645+Source
646+------
647+
648+ ++ lone |*(a=$+(* *) ,p=a) :: just one thing
530
649
531------------------------------------------------------------------------
650------------------------------------------------------------------------
532
651
533### `++mane`
652### `++mane`
534
653
535− ++ mane $|(@tas [@tas @tas]) :: XML name/space
654+XML name
655+
656+An XML name (tag name or attribute name) with an optional namespace. Parsed by
657+[`++name`]() within [`++poxa`](), rendered by [`++name`]() within `++poxo`.
658+
659+Source
660+------
536
661
537−An XML name (tag name or attribute name) with an optional namespace.
662+ ++ mane $|(@tas [@tas @tas]) :: XML name/space
538−Parsed by `++name`:poxa, rendered by `++name`:poxo.
539
663
664+Examples
665+--------
666+
540−See also: `++sail` doc, Section 3bD
667+See also: [`++sail`]()
541
668
542 ~zod/try=> *mane
669 ~zod/try=> *mane
543 %$
670 %$
@@ -551,61 +678,88 @@ See also: `++sail` doc, Section 3bD
551
678
552### `++manx`
679### `++manx`
553
680
554− ++ manx ,[g=marx c=marl] :: XML node
555−
556XML node.
681XML node.
557
682
558−Parsed by `++apex`:poxa, rendered by `++poxo`, section 3bD
683+Parsed by [`++apex`]() within [`++poxa`](), rendered by [`++poxo`]().
684+
685+Source
686+------
687+
688+ ++ manx ,[g=marx c=marl] :: XML node
689+
690+Examples
691+--------
559
692
560−See also: `++sail` doc, Section 3bD
693+See also: [`++sail`]() doc
561
694
562------------------------------------------------------------------------
695------------------------------------------------------------------------
563
696
564### `++marl`
697### `++marl`
565
698
566− ++ marl (list manx) :: XML node list
699+List of XML nodes
567
700
568−List of XML nodes.
701+A list of [`++manx`]().
569
702
570−Parsed within `++apex`:poxa, rendered by `++many`:poxo, section 3bD
703+Source
704+------
705+
706+ ++ marl (list manx) :: XML node list
707+
708+Examples
709+--------
571
710
572−See also: `++sail` doc
573
711
574------------------------------------------------------------------------
712------------------------------------------------------------------------
575
713
576### `++mars`
714### `++mars`
577
715
578− ++ mars ,[t=[n=%$ a=[i=[n=%$ v=tape] t=~]] c=~] :: XML cdata
716+XML CDATA
717+
718+Implicitly produced by [`++chrd`]() within [`++poxa`]()
579
719
580−XML CDATA. Implicitly produced by `++chrd`:poxa
720+Source
721+------
581
722
582−See also: `++sail` doc
723+ ++ mars ,[t=[n=%$ a=[i=[n=%$ v=tape] t=~]] c=~] :: XML cdata
724+
725+Examples
726+--------
583
727
584------------------------------------------------------------------------
728------------------------------------------------------------------------
585
729
586### `++mart`
730### `++mart`
587
731
588− ++ mart (list ,[n=mane v=tape]) :: XML attributes
732+List of XML attributes
589
733
590−List of XML attributes. Each `++mart` is a list of pairs of `++mane` and
734+Each `++mart` is a list of pairs of [`++mane`]() and
591−`++tape`.
735+[`++tape`]().
736+
737+Parsed by [`++attr`]() within [`++poxa`](), rendered by `++attr` within [`++poxo`]()
592
738
593−Parsed by `++attr`:poxa, rendered by `++attr`:poxo, section 3bD
739+Source
740+------
594
741
595−See also: `++sail` doc
742+ ++ mart (list ,[n=mane v=tape]) :: XML attributes
743+
744+Examples
745+--------
596
746
597------------------------------------------------------------------------
747------------------------------------------------------------------------
598
748
599### `++marx`
749### `++marx`
600
750
601− ++ marx ,[n=mane a=mart] :: XML tag
751+XML tag
602
752
603−XML tag. A `++marx` is a pair of a tag name, `++mane` and a list of
753+A `++marx` is a pair of a tag name, `++mane` and a list of attributes,
604−attributes, `++mart`.
754+`++mart`. Parsed by [`++head`]() `++poxa`, rendered within `++poxo`.
605
755
606−Parsed by `++head`:poxa, rendered within `++poxo`, section 3bD
756+Source
757+------
607
758
608−See also: `++sail` doc
759+ ++ marx ,[n=mane a=mart] :: XML tag
760+
761+Examples
762+--------
609
763
610------------------------------------------------------------------------
764------------------------------------------------------------------------
611
765
@@ -615,7 +769,7 @@ See also: `++sail` doc
615
769
616XX move to `++ut`
770XX move to `++ut`
617
771
618−See also: `++coil`
772+See also: [`++coil`]()
619
773
620------------------------------------------------------------------------
774------------------------------------------------------------------------
621
775
@@ -644,13 +798,21 @@ Used nowhere XX
644
798
645### `++odor`
799### `++odor`
646
800
647− ++ odor ,@ta :: atom format
801+'type' of atom
648
802
649−By convetion, a short name for a category of atom. `++odor` is
803+By convention, a short name for a category of atom. `++odor` is
650−circularly defined, `@ta` being the `++odor` of the ASCII subset
804+circularly defined, with [`@ta`]() being the `++odor` of the ASCII subset
651commonly used in urbit.
805commonly used in urbit.
652
806
807+Source
808+------
809+
810+ ++ odor ,@ta :: atom format
811+
812+Examples
813+--------
814+
653−See also: `++base`, odor reference
815+See also: [`++base`](), [odor reference]()
654
816
655 ~zod/try=> `odor`%ux
817 ~zod/try=> `odor`%ux
656 ~.ux
818 ~.ux
@@ -659,12 +821,20 @@ See also: `++base`, odor reference
659
821
660### `++tarp`
822### `++tarp`
661
823
824+Day through second
825+
826+The remaining part of a [`++date`](): day, hour, minute, second and a list
827+of [`@ux`]() for precision.
828+
829+Source
830+------
831+
662− ++ tarp ,[d=@ud h=@ud m=@ud s=@ud f=(list ,@ux)] :: parsed time
832+ @ud h=@ud m=@ud s=@ud f=(list ,@ux)] :: parsed time
663
833
664−The remaining part of a `++date`: day, hour, minute, second and a list
834+Examples
665−of `@ux` for precision.
835+--------
666
836
667−See also: `++date`, `++yell`/`++yule`, Section 2cH
837+See also: [`++date`](), [`++yell`[]()/`++yule`]()
668
838
669 ~zod/try=> -<-
839 ~zod/try=> -<-
670 ~2014.9.20..00.43.33..b52a
840 ~2014.9.20..00.43.33..b52a
@@ -679,11 +849,19 @@ See also: `++date`, `++yell`/`++yule`, Section 2cH
679
849
680### `++time`
850### `++time`
681
851
682− ++ time ,@da :: galactic time
852+Absolute date
683
853
684The `@da` odor designates an absolute date atom.
854The `@da` odor designates an absolute date atom.
685
855
856+Source
857+------
858+
859+ ++ time ,@da :: galactic time
860+
861+Examples
862+--------
863+
686−See also: `++date`, odor reference
864+See also: [`++date`](), [odor reference]()
687
865
688 ~zod/try=> `time`-<-
866 ~zod/try=> `time`-<-
689 ~2014.9.25..20.01.47..eeac
867 ~2014.9.25..20.01.47..eeac
@@ -695,11 +873,18 @@ See also: `++date`, odor reference
695
873
696### `++tree`
874### `++tree`
697
875
698− ++ tree |* a=_,* :: binary tree
876+Tree mold generator
699− $|(~ [n=a l=(tree a) r=(tree a)]) ::
877+
878+A `++tree` can be empty, or contain a node of a type and
879+left/right sub `++tree` of the same type. Pretty-printed with `{}`.
880+
881+Source
882+------
700
883
701−Tile generator. A `++tree` can be empty, or contain a node of a type and
884+ ++ tree |* a=_,* :: binary tree
702−left/right sub `++tree`s of the same type. Pretty-printed with `{}`.
885+
886+Examples
887+--------
703
888
704 ~zod/try=> `(tree ,[@ tape])`[[1 "hi"] [[2 "bye"] ~ ~] ~]
889 ~zod/try=> `(tree ,[@ tape])`[[1 "hi"] [[2 "bye"] ~ ~] ~]
705 {[2 "bye"] [1 "hi"]}
890 {[2 "bye"] [1 "hi"]}
@@ -708,12 +893,17 @@ left/right sub `++tree`s of the same type. Pretty-printed with `{}`.
708
893
709### `++nail`
894### `++nail`
710
895
711− ++ nail ,[p=hair q=tape] :: parsing input
896+Location, remainder of parsed text
897+
898+Indicates parsing position `p`, and remaining text to be parsed `q`.
899+
900+Source
901+------
712
902
713−Location in parsed text, and remainder of it. Indicates parsing position
903+ ++ nail ,[p=hair q=tape] :: parsing input
714−and remaining text to be parsed.
715
904
716−See also: `++roll`
905+Examples
906+--------
717
907
718 ~zod/try=> +<:;~(plug cab cab)
908 ~zod/try=> +<:;~(plug cab cab)
719 c=tub=[p=[p=0 q=0] q=""]
909 c=tub=[p=[p=0 q=0] q=""]
@@ -731,9 +921,19 @@ Used nowhere XX
731
921
732### `++pair`
922### `++pair`
733
923
734− ++ pair |*([a=$+(* *) b=$+(* *)] ,[p=a q=b]) :: just a pair
924+Mold of pair of types
925+
926+[mold]() generator. Produces a tuple of two of the types passed in.
927+
735
928
736−Tile generator. Produces a tuple of two of the types passed in.
929+Source
930+------
931+
932+ ++ pair |*([a=$+(* *) b=$+(* *)] ,[p=a q=b]) :: just a pair
933+
934+
935+Examples
936+--------
737
937
738 ~zod/try=> *(pair bean cord)
938 ~zod/try=> *(pair bean cord)
739 [p=%.y q='']
939 [p=%.y q='']
@@ -742,21 +942,32 @@ Tile generator. Produces a tuple of two of the types passed in.
742
942
743### `++pass`
943### `++pass`
744
944
745− ++ pass ,@ :: public key
945+Atom alias
946+
947+Used primarily in crypto.
746
948
747−Atom alias. Used primarily in crypto.
949+Source
950+------
748
951
749−See also: `++acru`, `++crua`, `++crub`
952+ ++ pass ,@ :: public key
750
953
751------------------------------------------------------------------------
954------------------------------------------------------------------------
752
955
753### `++path`
956### `++path`
754
957
755− ++ path (list span) :: filesys location
958+Filesystem path
756
959
757−A filesystem path. A `++path` is a list of `++span`, `@ta`. Used in
960+A `++path` is a list of [`++span`]()s aka [`@ta`](). Used in
758`%clay` and `%eyre` extensively.
961`%clay` and `%eyre` extensively.
759
962
963+Source
964+------
965+
966+ ++ path (list span) :: filesys location
967+
968+Examples
969+--------
970+
760 ~zod/try=> `path`"abc"
971 ~zod/try=> `path`"abc"
761 /a/b/c
972 /a/b/c
762
973
@@ -764,10 +975,18 @@ A filesystem path. A `++path` is a list of `++span`, `@ta`. Used in
764
975
765### `++pint`
976### `++pint`
766
977
767− ++ pint ,[p=[p=@ q=@] q=[p=@ q=@]] :: line/column range
978+Parsing range
979+
980+Mostly used for stacktraces. A `++pint` is a pair of
981+[`++hair`](), indicating from `p` to `q`.
982+
983+Source
984+------
768
985
769−A parsing range, mostly used for stacktraces. A `++pint` is a pair of
986+ ++ pint ,[p=[p=@ q=@] q=[p=@ q=@]] :: line/column range
770−hairs indicating from - to.
987+
988+Examples
989+--------
771
990
772 ~zod/try=> !:(!!)
991 ~zod/try=> !:(!!)
773 ! /~zod/try/~2014.9.20..01.22.04..52e3/:<[1 4].[1 6]>
992 ! /~zod/try/~2014.9.20..01.22.04..52e3/:<[1 4].[1 6]>
@@ -779,11 +998,17 @@ hairs indicating from - to.
779
998
780### `++pole`
999### `++pole`
781
1000
782− ++ pole |* a=_,* :: nameless list
1001+Faceless list
783− $|(~ [a (pole a)]) ::
1002+
1003+A [`++list`]() without the [face]()s `i` and `t`.
1004+
1005+Source
1006+------
784
1007
785−A `++list` without the faces. A `++pole` is a null-terminated tuple
1008+ ++ pole |* a=_,* :: nameless list
786−without the `i=` and `t=`.
1009+
1010+Examples
1011+--------
787
1012
788 ~zod/try=> `(pole char)`"asdf"
1013 ~zod/try=> `(pole char)`"asdf"
789 [~~a [~~s [~~d [~~f ~]]]]
1014 [~~a [~~s [~~d [~~f ~]]]]
@@ -792,6 +1017,13 @@ without the `i=` and `t=`.
792
1017
793### `++port`
1018### `++port`
794
1019
1020+XX move to `++ut`
1021+
1022+Type and location of core-shaped thing? XX Compiler Internals
1023+
1024+Source
1025+------
1026+
795 ++ port $: p=axis ::
1027 ++ port $: p=axis ::
796 $= q ::
1028 $= q ::
797 $% [%& p=type] ::
1029 $% [%& p=type] ::
@@ -799,9 +1031,8 @@ without the `i=` and `t=`.
799 == ::
1031 == ::
800 == ::
1032 == ::
801
1033
802−XX move to `++ut`
1034+Examples
803−
1035+--------
804−Type and location of core-shaped thing? XX Compiler Internals
805
1036
806 ~zod/try=> *port
1037 ~zod/try=> *port
807 [p=0 q=[%.y p=%void]]
1038 [p=0 q=[%.y p=%void]]
@@ -810,6 +1041,13 @@ Type and location of core-shaped thing? XX Compiler Internals
810
1041
811### `++post`
1042### `++post`
812
1043
1044+XX move to `++ut`
1045+
1046+Type and location of possibly core-shaped thing? XX Compiler Internals
1047+
1048+Source
1049+------
1050+
813 ++ post $: p=axis ::
1051 ++ post $: p=axis ::
814 $= q ::
1052 $= q ::
815 $% [0 p=type] ::
1053 $% [0 p=type] ::
@@ -818,9 +1056,8 @@ Type and location of core-shaped thing? XX Compiler Internals
818 == ::
1056 == ::
819 == ::
1057 == ::
820
1058
821−XX move to `++ut`
1059+Examples
822−
1060+--------
823−Type and location of possibly core-shaped thing? XX Compiler Internals
824
1061
825 ~zod/try=> *post
1062 ~zod/try=> *post
826 [p=0 q=[%0 p=%void]]
1063 [p=0 q=[%0 p=%void]]
@@ -829,11 +1066,6 @@ Type and location of possibly core-shaped thing? XX Compiler Internals
829
1066
830### `++prop`
1067### `++prop`
831
1068
832− ++ prop $: p=axis ::
833− $= q ::
834− [p=?(~ axis) q=(list ,[p=type q=foot])] ::
835− == ::
836−
837XX move to `++ut`
1069XX move to `++ut`
838
1070
839Verified core-shaped thing? XX Compiler Internals
1071Verified core-shaped thing? XX Compiler Internals
@@ -845,10 +1077,17 @@ Verified core-shaped thing? XX Compiler Internals
845
1077
846### `++qual`
1078### `++qual`
847
1079
848− ++ qual |* [a=$+(* *) b=$+(* *) c=$+(* *) d=$+(* *)] :: just a quadruple
1080+Mold of 4 type tuple
849− ,[p=a q=b r=c s=d] ::
1081+
1082+A `++qual` is a tuple of four of the types passed in.
1083+
1084+Source
1085+------
850
1086
851−Tile generator. A `++qual` is a tuple of four of the types passed in..
1087+ ++ qual |* [a=$+(* *) b=$+(* *) c=$+(* *) d=$+(* *)] :: just a quadruple
1088+
1089+Examples
1090+--------
852
1091
853 ~zod/try=> *(qual date time tape cord)
1092 ~zod/try=> *(qual date time tape cord)
854 [p=[[a=%.y y=0] m=0 t=[d=0 h=0 m=0 s=0 f=~]] q=~292277024401-.1.1 r="" s='']
1093 [p=[[a=%.y y=0] m=0 t=[d=0 h=0 m=0 s=0 f=~]] q=~292277024401-.1.1 r="" s='']
@@ -857,10 +1096,14 @@ Tile generator. A `++qual` is a tuple of four of the types passed in..
857
1096
858### `++rege`
1097### `++rege`
859
1098
1099+Regex caases
1100+
1101+`++rege` defines the cases of a regular expression.
1102+
1103+Source
1104+------
1105+
860− ++ rege $| ?(%dote %ende %sart %empt %boun %bout) :: parsed regex
1106+ ++ rege $| ?(%dote %ende %sart %empt %boun %bout) :: parsed regex
861− $% [%lite p=char] :: literal
862− [%pair p=rege q=rege] :: ordering
863− [%capt p=rege q=@u] :: capture group
864 [%brac p=@] :: p is 256 bitmask
1107 [%brac p=@] :: p is 256 bitmask
865 [%eith p=rege q=rege] :: either
1108 [%eith p=rege q=rege] :: either
866 [%mant p=rege] :: greedy 0 or more
1109 [%mant p=rege] :: greedy 0 or more
@@ -874,9 +1117,10 @@ Tile generator. A `++qual` is a tuple of four of the types passed in..
874 [%binl p=rege q=@u] :: min q lazy
1117 [%binl p=rege q=@u] :: min q lazy
875 == ::
1118 == ::
876
1119
877−Regular expressions. `++rege` defines the cases of a regex.
1120+Examples
1121+--------
878
1122
879−See also: `++rexp`, `++repg`, `++pars`
1123+See also: [`++rexp`](), [`++repg`](), [`++pars`]()
880
1124
881 ~zod/try=> (pars "[a-z]")
1125 ~zod/try=> (pars "[a-z]")
882 [~ [%brac p=10.633.823.807.823.001.954.701.781.295.154.855.936]]
1126 [~ [%brac p=10.633.823.807.823.001.954.701.781.295.154.855.936]]
@@ -887,22 +1131,32 @@ See also: `++rexp`, `++repg`, `++pars`
887
1131
888### `++ring`
1132### `++ring`
889
1133
890− ++ ring ,@ :: private key
1134+Atom alias
1135+
1136+Used primarily in crypto.
891
1137
892−Atom alias, used primarily in crypto.
1138+Source
1139+------
893
1140
894−See also: `++acru`, `++crua`, `++crub`.
1141+ ++ ring ,@ :: private key
895
1142
896------------------------------------------------------------------------
1143------------------------------------------------------------------------
897
1144
898### `++rule`
1145### `++rule`
899
1146
900− ++ rule |=(tub=nail `edge`[p.tub ~ ~ tub]) :: parsing rule
1147+Parsing rule
901
1148
902−Parsing rule. `++rule` is an empty parsing rule, but it is used to check
1149+`++rule` is an empty parsing rule, but it is used to check
903that parsing rules match this with `_`.
1150that parsing rules match this with `_`.
904
1151
905−See also: `++cold`, Section 2eC
1152+
1153+Source
1154+------
1155+
1156+ ++ rule |=(tub=nail `edge`[p.tub ~ ~ tub]) :: parsing rule
1157+
1158+Examples
1159+--------
906
1160
907 ~zod/try=> *rule
1161 ~zod/try=> *rule
908 [p=[p=0 q=0] q=[~ [p=0 q=[p=[p=0 q=0] q=""]]]]
1162 [p=[p=0 q=0] q=[~ [p=0 q=[p=[p=0 q=0] q=""]]]]
@@ -918,13 +1172,19 @@ See also: `++cold`, Section 2eC
918
1172
919### `++span`
1173### `++span`
920
1174
921− ++ span ,@ta :: text-atom (ASCII)
1175+ASCII atom
922
1176
923A restricted text atom for canonical atom syntaxes. The prefix is `~.`.
1177A restricted text atom for canonical atom syntaxes. The prefix is `~.`.
924There are no escape sequences except `~~`, which means `~`, and `~-`,
1178There are no escape sequences except `~~`, which means `~`, and `~-`,
925which means `_`. `-` and `.` encode themselves. No other characters
1179which means `_`. `-` and `.` encode themselves. No other characters
926besides numbers and lowercase letters are permitted.
1180besides numbers and lowercase letters are permitted.
927
1181
1182+Source
1183+------
1184+
1185+ ++ span ,@ta :: text-atom (ASCII)
1186+Examples
1187+--------
928 ~zod/try=> *span
1188 ~zod/try=> *span
929 ~.
1189 ~.
930
1190
@@ -943,11 +1203,17 @@ besides numbers and lowercase letters are permitted.
943
1203
944### `++spot`
1204### `++spot`
945
1205
946− ++ spot ,[p=path q=pint] :: range in file
1206+Stack trace line
1207+
1208+A [`++spot`]() is what we print after crashing.
947
1209
948−Stack trace line. A `++spot` is what we print after crashing.
1210+Source
1211+------
949
1212
950−See also: `++pint`
1213+ ++ spot ,[p=path q=pint] :: range in file
1214+
1215+Examples
1216+--------
951
1217
952 ~zod/try=> :into /=main=/bin/fail/hoon '!: !!'
1218 ~zod/try=> :into /=main=/bin/fail/hoon '!: !!'
953 + /~zod/main/359/bin/fail/hoon
1219 + /~zod/main/359/bin/fail/hoon
@@ -967,20 +1233,29 @@ Unused XX
967
1233
968### `++tank`
1234### `++tank`
969
1235
1236+Pretty-printing structure.
1237+
1238+A `++tank` is one of three cases: a `%leaf`
1239+is simply a string; a `%palm` is XX need more information; and a `%rose` is a
1240+list of `++tank` delimted by the strings in `p`.
1241+
1242+
1243+Source
1244+------
1245+
970 ++ tank $% [%leaf p=tape] :: printing formats
1246 ++ tank $% [%leaf p=tape] :: printing formats
971− $: %palm ::
1247+ $: %palm :: backstep list
972 p=[p=tape q=tape r=tape s=tape] ::
1248 p=[p=tape q=tape r=tape s=tape] ::
973 q=(list tank) ::
1249 q=(list tank) ::
974 == ::
1250 == ::
975− $: %rose :: delimeted list
1251+ $: %rose :: flat list
976 p=[p=tape q=tape r=tape] :: mid open close
1252 p=[p=tape q=tape r=tape] :: mid open close
977 q=(list tank) ::
1253 q=(list tank) ::
978 == ::
1254 == ::
979− ==
1255+ ==
980
1256
981−Pretty-printing structure. A `++tank` is one of three cases. A `%leaf`
1257+Examples
982−is just a string. A `%palm` is XX need more information. A `%rose` is a
1258+--------
983−list of `++tank` delimted by the strings in `p`.
984
1259
985 ~zod/try=> >(bex 20) (bex 19)<
1260 ~zod/try=> >(bex 20) (bex 19)<
986 [%rose p=[p=" " q="[" r="]"] q=~[[%leaf p="1.048.576"] [%leaf p="524.288"]]]
1261 [%rose p=[p=" " q="[" r="]"] q=~[[%leaf p="1.048.576"] [%leaf p="524.288"]]]
@@ -998,11 +1273,19 @@ list of `++tank` delimted by the strings in `p`.
998
1273
999### `++tape`
1274### `++tape`
1000
1275
1001− ++ tape (list char) :: like a string
1276+List of chars
1002
1277
1003−One of Hoon's two string types, the other being `++cord`. A tape is a
1278+One of Hoon's two string types, the other being [`++cord`](). A tape is a
1004list of chars.
1279list of chars.
1005
1280
1281+Source
1282+------
1283+
1284+ ++ tape (list char) :: like a string
1285+
1286+Examples
1287+--------
1288+
1006 ~zod/try=> `(list ,char)`"foobar"
1289 ~zod/try=> `(list ,char)`"foobar"
1007 "foobar"
1290 "foobar"
1008 ~zod/try=> `(list ,@)`"foobar"
1291 ~zod/try=> `(list ,@)`"foobar"
@@ -1012,13 +1295,22 @@ list of chars.
1012
1295
1013### `++term`
1296### `++term`
1014
1297
1015− ++ term ,@tas :: Hoon ASCII subset
1298+Hoon constants
1016
1299
1017−A restricted text atom for Hoon constants. The only characters permitted
1300+A restricted text atom for Hoon constants. The only characters permitted are
1018−are lowercase ASCII, - except as the first or last character, and 0-9
1301+lowercase ASCII, `-`, and `0-9`, the latter two of which can neither be the first or last
1019−except as the first character. The syntax for `@tas` is the text itself,
1302+character. The syntax for [`@tas`]() is the text itself, always preceded by `%`.
1020−always preceded by `%`. This means a term is always cubical. The empty
1303+This means a term is always [cubical](). The empty `@tas` has a special syntax,
1021−`@tas` has a special syntax, `$`:
1304+`$`.
1305+
1306+
1307+Source
1308+------
1309+
1310+ ++ term ,@tas :: Hoon ASCII subset
1311+
1312+Examples
1313+--------
1022
1314
1023 ~zod/try=> *term
1315 ~zod/try=> *term
1024 %$
1316 %$
@@ -1032,13 +1324,16 @@ always preceded by `%`. This means a term is always cubical. The empty
1032
1324
1033### `++tiki`
1325### `++tiki`
1034
1326
1035− ++ tiki :: test case
1036− $% [& p=(unit term) q=wing] :: simple wing
1037− [| p=(unit term) q=twig] :: named wing
1038− == ::
1039−
1040XX move to `++ut`
1327XX move to `++ut`
1041
1328
1329+Source
1330+------
1331+
1332+ ++ tiki :: test case
1333+
1334+Examples
1335+--------
1336+
1042A `++wing` or `++twig`.
1337A `++wing` or `++twig`.
1043
1338
1044 ~zod/try=> (ream '=+ a=4 ?-(a @ ~)')
1339 ~zod/try=> (ream '=+ a=4 ?-(a @ ~)')
@@ -1062,25 +1357,24 @@ A `++wing` or `++twig`.
1062
1357
1063------------------------------------------------------------------------
1358------------------------------------------------------------------------
1064
1359
1065−### `++tile`
1360+### `++toga`
1066
1361
1067−See the Tile section of the Hoon Reference.
1362+Tree of faces
1068
1363
1069−------------------------------------------------------------------------
1364+A [face](), or tree of faces. A `++toga` is applied to anything assigned
1365+using [`^=`]().
1070
1366
1071−### `++toga`
1367+XX move to `++ut` and rune doc (for \^= examples)
1072
1368
1369+Source
1370+------
1371+
1073− ++ toga :: face control
1372+ ++ toga :: face control
1074− $| p=term :: two togas
1075− $% [0 ~] :: no toga
1076− [1 p=term q=toga] :: deep toga
1077 [2 p=toga q=toga] :: cell toga
1373 [2 p=toga q=toga] :: cell toga
1078 == ::
1374 == ::
1079
1375
1080−XX move to `++ut` and rune doc (for \^= examples)
1376+Examples
1081−
1377+--------
1082−A face, or tree of faces. A `++toga` is applied to anything assigned
1083−using `^=`.
1084
1378
1085 ~zod/try=> a=1
1379 ~zod/try=> a=1
1086 a=1
1380 a=1
@@ -1106,9 +1400,17 @@ using `^=`.
1106
1400
1107### `++trap`
1401### `++trap`
1108
1402
1109− ++ trap ,_|.(_*) :: makes perfect sense
1403+Core with one arm `$`
1404+
1405+A trap is a core with one arm `++$`. Used when XX
1406+
1407+Source
1408+------
1110
1409
1111−A trap is a core with one arm `++$`.
1410+ ++ trap ,_|.(_*) :: makes perfect sense
1411+
1412+Examples
1413+--------
1112
1414
1113See also: `|.`
1415See also: `|.`
1114
1416
@@ -1123,10 +1425,17 @@ See also: `|.`
1123
1425
1124### `++trel`
1426### `++trel`
1125
1427
1126− ++ trel |* [a=$+(* *) b=$+(* *) c=$+(* *)] :: just a triple
1428+Mold of three types
1127− ,[p=a q=b r=c] ::
1429+
1430+[`++mold`]() of the tuple of the three types passed in.
1128
1431
1129−Tile generator. `++trel` is a tuple of three of the types passed in.
1432+Source
1433+------
1434+
1435+ ++ trel |* [a=$+(* *) b=$+(* *) c=$+(* *)] :: just a triple
1436+
1437+Examples
1438+--------
1130
1439
1131 ~zod/try=> *(trel ,@ud ,@t ,@s)
1440 ~zod/try=> *(trel ,@ud ,@t ,@s)
1132 [p=0 q='' r=--0]
1441 [p=0 q='' r=--0]
@@ -1135,39 +1444,53 @@ Tile generator. `++trel` is a tuple of three of the types passed in.
1135
1444
1136### `++tuna`
1445### `++tuna`
1137
1446
1447+XML template tree
1448+
1449+An XML template tree.
1450+
1451+Source
1452+------
1453+
1138− ++ tuna :: tagflow
1454+ ++ tuna :: tagflow
1139− $% [%a p=twig] :: plain text
1140− [%b p=twig] :: single tag
1141− [%c p=twig] :: simple list
1142 [%d p=twig] :: dynamic list
1455 [%d p=twig] :: dynamic list
1143 [%e p=twig q=(list tuna)] :: element
1456 [%e p=twig q=(list tuna)] :: element
1144 [%f p=(list tuna)] :: subflow
1457 [%f p=(list tuna)] :: subflow
1145 == ::
1458 == ::
1146
1459
1147−An XML template tree.
1460+Examples
1461+--------
1148
1462
1149Leaf %a contains plain-text, %b an empty tag, %c a static list, %d a
1463Leaf %a contains plain-text, %b an empty tag, %c a static list, %d a
1150dynamic list, %e a full node element containing a twig and a list of
1464dynamic list, %e a full node element containing a twig and a list of
1151tuna, and %f is a empty node.
1465tuna, and %f is a empty node.
1152
1466
1153−See also: `++sail`
1467+See also: [`++sail`]()
1154
1468
1155------------------------------------------------------------------------
1469------------------------------------------------------------------------
1156
1470
1157### `++twig`
1471### `++twig`
1158
1472
1473+Expression
1474+
1475+An expression, or AST.
1476+
1159See Twig section of Hoon reference
1477See Twig section of Hoon reference
1160
1478
1161------------------------------------------------------------------------
1479------------------------------------------------------------------------
1162
1480
1163### `++tine`
1481### `++tine`
1164
1482
1165− ++ tine (list ,[p=tile q=twig]) ::
1483+Switch statement cases
1166
1484
1167−Switch statement cases. In `?-`, for example, your list of cases is a
1485+In [`?-`](), for example, your list of cases is a `++tine`.
1168−`++tine`.
1169
1486
1170−See also: `++twig`
1487+Source
1488+------
1489+
1490+ ++ tine (list ,[p=tile q=twig]) ::
1491+
1492+Examples
1493+--------
1171
1494
1172 ~zod/try=> (ream '?-(!! @ |, ^ &)')
1495 ~zod/try=> (ream '?-(!! @ |, ^ &)')
1173 [ %wthz
1496 [ %wthz
@@ -1188,12 +1511,18 @@ See also: `++twig`
1188
1511
1189### `++tusk`
1512### `++tusk`
1190
1513
1191− ++ tusk (list twig) ::
1514+List of expressions
1192
1515
1193−Variable-arity expression list. In `:*`, for example, your contents are
1516+List of [`++twig`]()s. In [`:*`](), for example, your contents is
1194a `++tusk`.
1517a `++tusk`.
1195
1518
1196−See also: `++twig`
1519+Source
1520+------
1521+
1522+ ++ tusk (list twig) ::
1523+
1524+Examples
1525+--------
1197
1526
1198 ~zod/try=> (ream '[1 2 3]')
1527 ~zod/try=> (ream '[1 2 3]')
1199 [%cltr p=~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]]
1528 [%cltr p=~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]]
@@ -1204,21 +1533,33 @@ See also: `++twig`
1204
1533
1205### `++tyre`
1534### `++tyre`
1206
1535
1207− ++ tyre (list ,[p=term q=twig]) ::
1536+List, term to twig
1208
1537
1209−Associative list of term to twig, used in jet hint processing.
1538+Associative list of [++term]() [`++twig`](), used in [jet]() hint processing.
1210
1539
1211−See also: `++twig`
1540+Source
1541+------
1542+
1543+ ++ tyre (list ,[p=term q=twig]) ::
1212
1544
1213------------------------------------------------------------------------
1545------------------------------------------------------------------------
1214
1546
1215### `++tyke`
1547### `++tyke`
1216
1548
1217− ++ tyke (list (unit twig)) ::
1549+List of 'maybe' twigs
1550+
1551+List of [`++unit`]() [`++twig`](), or gaps left to be inferred, in [`++path`]()
1552+parsing. When you use a path such as `/=main=/pub/src/doc` the path is in fact
1553+a `++tyke`, where the `=` are inferred from your current path.
1554+
1218
1555
1219−List of twigs, or gaps left to be inferred, in path parsing. When you
1556+Source
1220−use a path such as `/=main=/pub/src/doc` the path is in fact a `++tyke`,
1557+------
1221−where the `=` are inferred from your current path.
1558+
1559+ ++ tyke (list (unit twig)) ::
1560+
1561+Examples
1562+--------
1222
1563
1223 ~zod/try=> (scan "/==as=" porc:vast)
1564 ~zod/try=> (scan "/==as=" porc:vast)
1224 [0 ~[~ ~ [~ [%dtzy p=%tas q=29.537]] ~]]
1565 [0 ~[~ ~ [~ [%dtzy p=%tas q=29.537]] ~]]
@@ -1229,12 +1570,18 @@ where the `=` are inferred from your current path.
1229
1570
1230### `++tram`
1571### `++tram`
1231
1572
1232− ++ tram (list ,[p=wing q=twig]) ::
1573+List of changes
1233
1574
1234−List of changes by location in context. When using `%=`, for example,
1575+List of changes by location in context. When using [`%=`](), for example,
1235the list of changes is a `++tram`.
1576the list of changes is a `++tram`.
1236
1577
1237−See also: `++twig`
1578+Source
1579+------
1580+
1581+ ++ tram (list ,[p=wing q=twig]) ::
1582+
1583+Examples
1584+--------
1238
1585
1239 ~zod/try=> (ream '$(a 1, b 2)')
1586 ~zod/try=> (ream '$(a 1, b 2)')
1240 [ %cnts
1587 [ %cnts
@@ -1248,10 +1595,13 @@ See also: `++twig`
1248
1595
1249### `++nock`
1596### `++nock`
1250
1597
1598+Virtual machine. See [Nock doc]().
1599+
1600+
1601+Source
1602+------
1603+
1251− ++ nock $& [p=nock q=nock] :: autocons
1604+ ++ nock $& [p=nock q=nock] :: autocons
1252− $% [%0 p=@] :: axis select
1253− [%1 p=*] :: constant
1254− [%2 p=nock q=nock] :: compose
1255 [%3 p=nock] :: cell test
1605 [%3 p=nock] :: cell test
1256 [%4 p=nock] :: increment
1606 [%4 p=nock] :: increment
1257 [%5 p=nock q=nock] :: equality test
1607 [%5 p=nock q=nock] :: equality test
@@ -1263,7 +1613,8 @@ See also: `++twig`
1263 [%11 p=nock] :: grab data from sky
1613 [%11 p=nock] :: grab data from sky
1264 == ::
1614 == ::
1265
1615
1266−See Nock doc
1616+Examples
1617+--------
1267
1618
1268 ~zod/try=> !=([+(.) 20 -<])
1619 ~zod/try=> !=([+(.) 20 -<])
1269 [[4 0 1] [1 20] 0 4]
1620 [[4 0 1] [1 20] 0 4]
@@ -1274,13 +1625,17 @@ See Nock doc
1274
1625
1275### `++tone`
1626### `++tone`
1276
1627
1277− ++ tone $% [%0 p=*] :: success
1628+Intermediate Nock computation result
1278− [%1 p=(list)] :: blocks
1629+
1279− [%2 p=(list ,[@ta *])] :: error ~_s
1630+Similar to [`++toon`](), but stack trace is not yet rendered.
1280− == ::
1281
1631
1282−Intermediate Nock computation result. Similar to `++toon`, but stack
1632+Source
1283−trace is not yet rendered.
1633+------
1634+
1635+ ++ tone $% [%0 p=*] :: success
1636+
1637+Examples
1638+--------
1284
1639
1285 ~zod/try=> (mink [[20 21] 0 3] ,~)
1640 ~zod/try=> (mink [[20 21] 0 3] ,~)
1286 [%0 p=21]
1641 [%0 p=21]
@@ -1316,14 +1671,18 @@ trace is not yet rendered.
1316
1671
1317### `++toon`
1672### `++toon`
1318
1673
1319− ++ toon $% [%0 p=*] :: success
1674+Nock computation result
1320− [%1 p=(list)] :: blocks
1675+
1676+Either success (`%0`), a block with list of requests blocked on (`%1`), or
1321− [%2 p=(list tank)] :: stack trace
1677+failure with stack trace (`%2`).
1322− == ::
1678+
1679+Source
1680+------
1323
1681
1324−Nock computation result. Either success (`%0`), a block with list of
1682+ ++ toon $% [%0 p=*] :: success
1325−requests blocked on (`%1`), or failure with stack trace (`%2`).
1326
1683
1684+Examples
1685+--------
1327 ~zod/try=> (mock [[20 21] 0 3] ,~)
1686 ~zod/try=> (mock [[20 21] 0 3] ,~)
1328 [%0 p=21]
1687 [%0 p=21]
1329
1688
@@ -1339,22 +1698,31 @@ requests blocked on (`%1`), or failure with stack trace (`%2`).
1339
1698
1340### `++tune`
1699### `++tune`
1341
1700
1342− ++ tune $% [%0 p=vase] ::
1343− [%1 p=(list)] ::
1344− [%2 p=(list ,[@ta *])] ::
1345− == ::
1346
1701
1347−XX Unused
1702+Source
1703+------
1704+
1705+ ++ tune $% [%0 p=vase] ::
1348
1706
1707+Examples
1708+--------
1349Probably typed `tone`?
1709Probably typed `tone`?
1350
1710
1351------------------------------------------------------------------------
1711------------------------------------------------------------------------
1352
1712
1353### `++twin`
1713### `++twin`
1354
1714
1715+Aliasing
1716+
1717+Used in `%bull` within [`++type`]() to typecheck aliased faces.
1718+
1719+Source
1720+------
1721+
1355− ++ twin ,[p=term q=wing r=axis s=type] :: alias info
1722+ ++ twin ,[p=term q=wing r=axis s=type] :: alias info
1356
1723
1357−Aliasing. Used in `%bull` `++type` to typecheck aliased faces.
1724+Examples
1725+--------
1358
1726
1359 ~zod/try=> (~(busk ut %cell %noun [%atom %ud]) %fal [%& 3]~)
1727 ~zod/try=> (~(busk ut %cell %noun [%atom %ud]) %fal [%& 3]~)
1360 [ %bull
1728 [ %bull
@@ -1376,24 +1744,32 @@ See Type section of Hoon reference
1376
1744
1377### `++typo`
1745### `++typo`
1378
1746
1379− ++ typo type :: old type
1747+Pointer for `++type`
1380
1748
1381−Pointer for `++type`. `++typo` preserves the previous `++type` in your
1749+Pointer for [`++type`](). `++typo` preserves the previous `++type` in your
1382context when upating.
1750context when upating.
1383
1751
1752+Source
1753+------
1754+
1755+ ++ typo type :: old type
1756+
1757+Examples
1758+--------
1759+
1384See also: `++seem`, `++vise`, `++type`
1760See also: `++seem`, `++vise`, `++type`
1385
1761
1386------------------------------------------------------------------------
1762------------------------------------------------------------------------
1387
1763
1388### `++udal`
1764### `++udal`
1389
1765
1390− ++ udal :: atomic change (%b)
1766+Source
1391− $: p=@ud :: blockwidth
1767+------
1392− q=(list ,[p=@ud q=(unit ,[p=@ q=@])]) :: indels
1393− == ::
1394
1768
1395−XX Unused
1769+ ++ udal :: atomic change (%b)
1396
1770
1771+Examples
1772+--------
1397------------------------------------------------------------------------
1773------------------------------------------------------------------------
1398
1774
1399### `++udon`
1775### `++udon`
@@ -1439,13 +1815,21 @@ See `%clay` doc
1439
1815
1440### `++unit`
1816### `++unit`
1441
1817
1442− ++ unit |* a=_,* :: maybe
1818+Maybe
1443− $|(~ [~ u=a]) ::
1444
1819
1445−Tile generator. A `++unit` is either `~` or `[~ u=a]` where `a` is the
1820+[mold]() generator. A `++unit` is either `~` or `[~ u=a]` where `a` is the
1446type that was passed in.
1821type that was passed in.
1447
1822
1823+
1824+Source
1825+------
1826+
1827+ ++ unit |* a=_,* :: maybe
1828+
1829+Examples
1830+--------
1831+
1448−See also: `++bind`, Section 2bA
1832+See also: [`++bind`]()
1449
1833
1450 ~zod/try=> :type; *(unit time)
1834 ~zod/try=> :type; *(unit time)
1451 ~
1835 ~
@@ -1478,11 +1862,17 @@ See `%clay` doc
1478
1862
1479### `++vase`
1863### `++vase`
1480
1864
1481− ++ vase ,[p=type q=*] :: type-value pair
1482−
1483Typed data. A `++vase` is used wherever typed data is explicitly worked
1865Typed data. A `++vase` is used wherever typed data is explicitly worked
1484with.
1866with.
1485
1867
1868+
1869+Source
1870+------
1871+
1872+ ++ vase ,[p=type q=*] :: type-value pair
1873+
1874+Examples
1875+--------
1486See `%arvo` doc
1876See `%arvo` doc
1487
1877
1488 ~zod/try=> `vase`!>(~)
1878 ~zod/try=> `vase`!>(~)
@@ -1492,22 +1882,39 @@ See `%arvo` doc
1492
1882
1493### `++vise`
1883### `++vise`
1494
1884
1495− ++ vise ,[p=typo q=*] :: old vase
1885+Convert during reboot
1496
1886
1497Used to convert from previously-typed data during reboot.
1887Used to convert from previously-typed data during reboot.
1498
1888
1889+Source
1890+------
1891+
1892+ ++ vise ,[p=typo q=*] :: old vase
1893+
1894+Examples
1895+--------
1896+
1499−See `++typo`, `++seer`
1897+See also: [`++typo`](), [`++seer`]()
1500
1898
1501------------------------------------------------------------------------
1899------------------------------------------------------------------------
1502
1900
1503### `++wall`
1901### `++wall`
1504
1902
1505− ++ wall (list tape) :: text lines (no \n)
1903+List of lines
1506
1904
1905+
1507−A list of lines. A `++wall` is used instead of a single `++tape` with
1906+A `++wall` is used instead of a single [`++tape`]() with
1508`\n`.
1907`\n`.
1509
1908
1909+Source
1910+------
1911+
1912+ ++ wall (list tape) :: text lines (no \n)
1913+
1914+Examples
1915+--------
1916+
1510−See also: `++wash`
1917+See also: [`++wash`]()
1511
1918
1512 ~zod/try=> `wall`(wash [0 20] leaf/<(bex 256)>)
1919 ~zod/try=> `wall`(wash [0 20] leaf/<(bex 256)>)
1513 <<
1920 <<
@@ -1527,10 +1934,10 @@ See also: `++wash`
1527
1934
1528 ++ wain (list cord) :: text lines (no \n)
1935 ++ wain (list cord) :: text lines (no \n)
1529
1936
1530−A list of lines. A `++wain` is used instead of a single `++cord` with
1937+A list of lines. A `++wain` is used instead of a single [`++cord`]() with
1531`\n`.
1938`\n`.
1532
1939
1533−See also: `++lore`, `++role`
1940+See also: [`++lore`](), [`++role`]()
1534
1941
1535 ~zod/try=> `wain`/som/del/rok
1942 ~zod/try=> `wain`/som/del/rok
1536 <|som del rok|>
1943 <|som del rok|>
@@ -1574,10 +1981,14 @@ See also: `++twig`
1574
1981
1575### `++wine`
1982### `++wine`
1576
1983
1984+Printable type
1985+
1986+Used for pretty printing.
1987+
1988+Source
1989+------
1990+
1577− ++ wine $| ?(%noun %path %tank %void %wall %wool %yarn)
1991+ ++ wine $| ?(%noun %path %tank %void %wall %wool %yarn)
1578− $% [%atom p=term] ::
1579− [%core p=(list ,@ta) q=wine] ::
1580− [%face p=term q=wine] ::
1581 [%list p=term q=wine] ::
1992 [%list p=term q=wine] ::
1582 [%pear p=term q=@] ::
1993 [%pear p=term q=@] ::
1583 [%pick p=(list wine)] ::
1994 [%pick p=(list wine)] ::
@@ -1587,9 +1998,10 @@ See also: `++twig`
1587 [%unit p=term q=wine] ::
1998 [%unit p=term q=wine] ::
1588 == ::
1999 == ::
1589
2000
1590−Printable type. `++wine` is used for pretty printing.
2001+Examples
2002+--------
1591
2003
1592−See also: `++calf`
2004+See also: [`++calf`]()
1593
2005
1594 ~zod/try=> ~(dole ut p:!>(*@tas))
2006 ~zod/try=> ~(dole ut p:!>(*@tas))
1595 [p={} q=[%atom p=%tas]]
2007 [p={} q=[%atom p=%tas]]
@@ -1656,17 +2068,19 @@ See also: `++calf`
1656
2068
1657### `++wonk`
2069### `++wonk`
1658
2070
1659− ++ wonk |*(veq=edge ?~(q.veq !! p.u.q.veq)) ::
1660− :: ::
1661− :: ::
1662−
1663XX Not a model?
2071XX Not a model?
1664
2072
1665− ++ wonk |*(veq=edge ?~(q.veq !! p.u.q.veq)) ::
1666−
1667Pull result out of a `++edge`, or crash if there's no result.
2073Pull result out of a `++edge`, or crash if there's no result.
1668
2074
2075+Source
2076+------
2077+
2078+ ++ wonk |*(veq=edge ?~(q.veq !! p.u.q.veq)) ::
2079+
2080+Examples
2081+--------
2082+
1669−See also: `++edge`, Section 2eC
2083+See also: [`++edge`]()
1670
2084
1671 ~zod/try=> (wide:vast [1 1] "(add 2 2)")
2085 ~zod/try=> (wide:vast [1 1] "(add 2 2)")
1672 [ p=[p=1 q=10]
2086 [ p=[p=1 q=10]
@@ -1684,13 +2098,21 @@ See also: `++edge`, Section 2eC
1684
2098
1685### `++map`
2099### `++map`
1686
2100
2101+Map
2102+
2103+[mold]() generator. A `++map` is a [treap](http://en.wikipedia.org/wiki/Treap) of
2104+key, value pairs.
2105+
2106+
2107+Source
2108+------
2109+
1687− ++ map |* [a=_,* b=_,*] :: associative tree
2110+ ++ map |* [a=_,* b=_,*] :: associative tree
1688− $|(~ [n=[p=a q=b] l=(map a b) r=(map a b)]) ::
1689
2111
1690−Tile generator. A `++map` is a
2112+Examples
1691−[treap](http://en.wikipedia.org/wiki/Treap) of key, value pairs.
2113+--------
1692
2114
1693−See also: `++by`
2115+See also: [`++by`]()
1694
2116
1695 ~zod/try=> :type; *(map ,@t ,@u)
2117 ~zod/try=> :type; *(map ,@t ,@u)
1696 {}
2118 {}
@@ -1702,13 +2124,21 @@ See also: `++by`
1702
2124
1703### `++qeu`
2125### `++qeu`
1704
2126
2127+Queue
2128+
2129+[mold]() generator. An ordered [treap](http://en.wikipedia.org/wiki/Treap) of
2130+items.
2131+
2132+Source
2133+------
2134+
1705 ++ qeu |* a=_,* :: queue
2135 ++ qeu |* a=_,* :: queue
1706 $|(~ [n=a l=(qeu a) r=(qeu a)]) ::
2136 $|(~ [n=a l=(qeu a) r=(qeu a)]) ::
1707
2137
1708−Tile generator. A `++qeu` is an ordered
2138+See also: [`++to`]()
1709−[treap](http://en.wikipedia.org/wiki/Treap) of items.
1710
2139
1711−See also: `++to`
2140+Examples
2141+--------
1712
2142
1713 ~zod/try=> (qeu time)
2143 ~zod/try=> (qeu time)
1714 <1.qyo [* <1.sxx [a=<1.ebd [* <101.jzo 1.ypj %164>]> <101.jzo 1.ypj %164>]>]>
2144 <1.qyo [* <1.sxx [a=<1.ebd [* <101.jzo 1.ypj %164>]> <101.jzo 1.ypj %164>]>]>
@@ -1719,13 +2149,21 @@ See also: `++to`
1719
2149
1720### `++set`
2150### `++set`
1721
2151
2152+Set
2153+
2154+[mold]() generator. A `++set` is a
2155+[treap](http://en.wikipedia.org/wiki/Treap) with unique values.
2156+
2157+Source
2158+------
2159+
1722 ++ set |* a=_,* :: set
2160 ++ set |* a=_,* :: set
1723 $|(~ [n=a l=(set a) r=(set a)]) ::
2161 $|(~ [n=a l=(set a) r=(set a)]) ::
1724
2162
1725−Tile generator. A `++set` is a
2163+Examples
1726−[treap](http://en.wikipedia.org/wiki/Treap) with unique values.
2164+--------
1727
2165
1728−See also: `++in`
2166+See also: [`++in`]()
1729
2167
1730 ~zod/try=> (sa "abc")
2168 ~zod/try=> (sa "abc")
1731 {~~a ~~c ~~b}
2169 {~~a ~~c ~~b}
@@ -1738,11 +2176,18 @@ See also: `++in`
1738
2176
1739### `++jar`
2177### `++jar`
1740
2178
2179+
2180+Tile generator. A [`++jar`]() is a [`++map`]() of [`++list`]().
2181+
2182+Source
2183+------
2184+
1741 ++ jar |*([a=_,* b=_,*] (map a (list b))) :: map of lists
2185 ++ jar |*([a=_,* b=_,*] (map a (list b))) :: map of lists
1742
2186
1743−Tile generator. A `++jar` is a `++map` of `++list`.
2187+Examples
2188+--------
1744
2189
1745−See also: `++ja`, `++by`, `++map`, `++list`
2190+See also: [`++ja`](), [`++by`](), [`++map`](), [`++list`]()
1746
2191
1747 ~zod/try=> =a (limo [1 2 ~])
2192 ~zod/try=> =a (limo [1 2 ~])
1748 ~zod/try=> a
2193 ~zod/try=> a
@@ -1762,10 +2207,16 @@ See also: `++ja`, `++by`, `++map`, `++list`
1762
2207
1763### `++jug`
2208### `++jug`
1764
2209
2210+
2211+[mold]() generator. A `++jug` is a [`++map`]() of [`++set`]()s.
2212+
2213+Source
2214+------
2215+
1765 ++ jug |*([a=_,* b=_,*] (map a (set b))) :: map of sets
2216 ++ jug |*([a=_,* b=_,*] (map a (set b))) :: map of sets
1766
2217
1767−Tile generator. Similar to `++jar`, but with `++set`. A `++jug` is a
2218+Examples
1768−`++map` of `++set`.
2219+--------
1769
2220
1770See also: `++ju`, `++by`, `++map`, `++set`
2221See also: `++ju`, `++by`, `++map`, `++set`
1771
2222
docs/dev/hoon/library/2a.md+306−78
@@ -1,23 +1,36 @@
1−chapter 2a, basic unsigned math
1+2a - basic unsigned math
2−===============================
2+========================
3
3
4### `++add`
4### `++add`
5
5
6Add
6Add
7
7
8+Produces the sum of `a` and `b`.
9+
10+Accepts
11+-------
12+
13+`a` is an [atom]().
14+
15+`b` is an atom.
16+
17+Produces
18+--------
19+
20+An atom.
21+
22+Source
23+------
24+
8 ++ add :: add
25 ++ add :: add
9 ~/ %add
26 ~/ %add
10 |= [a=@ b=@]
27 |= [a=@ b=@]
11 ^- @
28 ^- @
12 ?: =(0 a) b
29 ?: =(0 a) b
13 $(a (dec a), b +(b))
30 $(a (dec a), b +(b))
14− ::
15−
16−Produces the sum of `a` and `b` as an atom.
17−
18−`a` is an [atom]().
19
31
20−`b` is an [atom]().
32+Examples
33+--------
21
34
22 ~zod/try=> (add 2 2)
35 ~zod/try=> (add 2 2)
23 4
36 4
@@ -32,6 +45,23 @@ Produces the sum of `a` and `b` as an atom.
32
45
33Tree head
46Tree head
34
47
48+Tests whether an `a` is in the head or tail of a [noun](). Produces the
49+[cube]() `%2` if it is within the head, or the cube `%3` if it is
50+within the tail.
51+
52+Accepts
53+-------
54+
55+`a` is an atom.
56+
57+Produces
58+--------
59+
60+A [cube]().
61+
62+Source
63+------
64+
35 ++ cap :: tree head
65 ++ cap :: tree head
36 ~/ %cap
66 ~/ %cap
37 |= a=@
67 |= a=@
@@ -44,11 +74,8 @@ Tree head
44 ==
74 ==
45 ::
75 ::
46
76
47−Tests whether an `a` is in the head or tail of a noun. Produces the
77+Examples
48−[cube]() `%2` if it is within the head, or the [cube]() `%3` if is is
78+--------
49−within the tail.
50−
51−`a` is an [atom]().
52
79
53 ~zod/try=> (cap 4)
80 ~zod/try=> (cap 4)
54 %2
81 %2
@@ -63,6 +90,21 @@ within the tail.
63
90
64Decrement
91Decrement
65
92
93+Decrements `a` by `1`.
94+
95+Accepts
96+-------
97+
98+`a` is an [atom]().
99+
100+Produces
101+--------
102+
103+An atom.
104+
105+Source
106+------
107+
66 ++ dec :: decrement
108 ++ dec :: decrement
67 ~/ %dec
109 ~/ %dec
68 |= a=@
110 |= a=@
@@ -74,9 +116,8 @@ Decrement
74 $(b +(b))
116 $(b +(b))
75 ::
117 ::
76
118
77−Produces `a-1` as an atom.
119+Examples
78−
120+--------
79−`a` is an [atom]().
80
121
81 ~zod/try=> (dec 7)
122 ~zod/try=> (dec 7)
82 6
123 6
@@ -90,6 +131,23 @@ Produces `a-1` as an atom.
90
131
91Divide
132Divide
92
133
134+Computes `a` divided by `b`.
135+
136+Accepts
137+-------
138+
139+`a` is an [atom]().
140+
141+`b` is an [atom]().
142+
143+Produces
144+--------
145+
146+An atom.
147+
148+Source
149+------
150+
93 ++ div :: divide
151 ++ div :: divide
94 ~/ %div
152 ~/ %div
95 |= [a=@ b=@]
153 |= [a=@ b=@]
@@ -102,11 +160,8 @@ Divide
102 $(a (sub a b), c +(c))
160 $(a (sub a b), c +(c))
103 ::
161 ::
104
162
105−Computes `a` divided by `b`, producing an atom.
163+Examples
106−
164+--------
107−`a` is an [atom]().
108−
109−`b` is an [atom]().
110
165
111 ~zod/try=> (div 4 2)
166 ~zod/try=> (div 4 2)
112 2
167 2
@@ -121,6 +176,21 @@ Computes `a` divided by `b`, producing an atom.
121
176
122Factorial
177Factorial
123
178
179+Computes the factorial of `a`.
180+
181+Accepts
182+-------
183+
184+`a` is an [atom]().
185+
186+Produces
187+--------
188+
189+An atom.
190+
191+Source
192+------
193+
124 ++ fac :: factorial
194 ++ fac :: factorial
125 ~/ %fac
195 ~/ %fac
126 |= a=@
196 |= a=@
@@ -129,9 +199,8 @@ Factorial
129 (mul a $(a (dec a)))
199 (mul a $(a (dec a)))
130 ::
200 ::
131
201
132−Computes the factorial of `a`, producing an atom.
202+Examples
133−
203+--------
134−`a` is an [atom]().
135
204
136 ~zod/try=> (fac 3)
205 ~zod/try=> (fac 3)
137 6
206 6
@@ -146,6 +215,23 @@ Computes the factorial of `a`, producing an atom.
146
215
147Greater-than/equal
216Greater-than/equal
148
217
218+Tests whether `a` is greater than a number `b`.
219+
220+Accepts
221+-------
222+
223+`a` is an [atom]().
224+
225+`b` is an atom.
226+
227+Produces
228+--------
229+
230+A boolean.
231+
232+Source
233+------
234+
149 ++ gte :: greater-equal
235 ++ gte :: greater-equal
150 ~/ %gte
236 ~/ %gte
151 |= [a=@ b=@]
237 |= [a=@ b=@]
@@ -153,11 +239,8 @@ Greater-than/equal
153 !(lth a b)
239 !(lth a b)
154 ::
240 ::
155
241
156−Tests whether `a` is greater than a number `b`, producing a loobean.
242+Examples
157−
243+--------
158−`a` is an [atom]().
159−
160−`b` is an [atom]().
161
244
162 ~zod/try=> (gte 100 10)
245 ~zod/try=> (gte 100 10)
163 %.y
246 %.y
@@ -172,6 +255,23 @@ Tests whether `a` is greater than a number `b`, producing a loobean.
172
255
173Greater-than
256Greater-than
174
257
258+Tests whether `a` is greater than `b`.
259+
260+Accepts
261+-------
262+
263+`a` is an [atom]().
264+
265+`b` is an atom.
266+
267+Produces
268+--------
269+
270+A boolean.
271+
272+Source
273+------
274+
175 ++ gth :: greater-than
275 ++ gth :: greater-than
176 ~/ %gth
276 ~/ %gth
177 |= [a=@ b=@]
277 |= [a=@ b=@]
@@ -179,11 +279,8 @@ Greater-than
179 !(lte a b)
279 !(lte a b)
180 ::
280 ::
181
281
182−Tests whether `a` is greater than `b`, producing a loobean.
282+Examples
183−
283+--------
184−`a` is an [atom]().
185−
186−`b` is an [atom]().
187
284
188 ~zod/try=> (gth 'd' 'c')
285 ~zod/try=> (gth 'd' 'c')
189 %.y
286 %.y
@@ -196,17 +293,31 @@ Tests whether `a` is greater than `b`, producing a loobean.
196
293
197Less-than/equal
294Less-than/equal
198
295
296+Tests whether `a` is less than or equal to `b`.
297+
298+Accepts
299+-------
300+
301+`a` is an [atom]().
302+
303+`b` is an atom.
304+
305+Produces
306+--------
307+
308+A boolean.
309+
310+Source
311+------
312+
199 ++ lte :: less-equal
313 ++ lte :: less-equal
200 ~/ %lte
314 ~/ %lte
201 |= [a=@ b=@]
315 |= [a=@ b=@]
202 |(=(a b) (lth a b))
316 |(=(a b) (lth a b))
203 ::
317 ::
204
318
205−Tests whether `a` is less than or equal to `b`, producing a loobean.
319+Examples
206−
320+--------
207−`a` is an [atom]().
208−
209−`b` is an [atom]().
210
321
211 ~zod/try=> (lte 4 5)
322 ~zod/try=> (lte 4 5)
212 %.y
323 %.y
@@ -223,6 +334,23 @@ Tests whether `a` is less than or equal to `b`, producing a loobean.
223
334
224Less-than
335Less-than
225
336
337+Tests whether `a` is less than `b`.
338+
339+Accepts
340+-------
341+
342+`a` is an [atom]().
343+
344+`b` is an atom.
345+
346+Produces
347+--------
348+
349+A boolean.
350+
351+Source
352+------
353+
226 ++ lth :: less-than
354 ++ lth :: less-than
227 ~/ %lth
355 ~/ %lth
228 |= [a=@ b=@]
356 |= [a=@ b=@]
@@ -235,11 +363,8 @@ Less-than
235 == == ==
363 == == ==
236 ::
364 ::
237
365
238−Tests whether `a` is less than `b`, producing a loobean.
366+Examples
239−
367+--------
240−`a` is an [atom]().
241−
242−`b` is an [atom]().
243
368
244 ~zod/try=> (lth 4 5)
369 ~zod/try=> (lth 4 5)
245 %.y
370 %.y
@@ -254,7 +379,22 @@ Tests whether `a` is less than `b`, producing a loobean.
254
379
255### `++mas`
380### `++mas`
256
381
257−Axis within head/tail
382+Axis within head/tail?
383+
384+Computes the axis of `a` within either the head or tail of a noun (depends whether `a` lies within the the head or tail).
385+
386+Accepts
387+-------
388+
389+`a` is an [atom]().
390+
391+Produces
392+--------
393+
394+An atom.
395+
396+Source
397+------
258
398
259 ++ mas :: tree body
399 ++ mas :: tree body
260 ~/ %mas
400 ~/ %mas
@@ -268,9 +408,8 @@ Axis within head/tail
268 ==
408 ==
269 ::
409 ::
270
410
271−Computes the axis of `a` within the head or the tail, producing an atom.
411+Examples
272−
412+--------
273−`a` is an [atom]().
274
413
275 ~zod/try=> (mas 3)
414 ~zod/try=> (mas 3)
276 1
415 1
@@ -285,12 +424,29 @@ Computes the axis of `a` within the head or the tail, producing an atom.
285 ~zod/try=> (mas 1)
424 ~zod/try=> (mas 1)
286 ! exit
425 ! exit
287
426
288−------------------------------------------------------------------------
427+-----------------------------------------------------------------------
289
428
290### `++max`
429### `++max`
291
430
292Maximum
431Maximum
293
432
433+Computes the greater of `a` and `b`.
434+
435+Accepts
436+-------
437+
438+`a` is an [atom]().
439+
440+`b` is an atom.
441+
442+Produces
443+--------
444+
445+An atom.
446+
447+Source
448+------
449+
294 ++ max :: maximum
450 ++ max :: maximum
295 ~/ %max
451 ~/ %max
296 |= [a=@ b=@]
452 |= [a=@ b=@]
@@ -299,11 +455,8 @@ Maximum
299 b
455 b
300 ::
456 ::
301
457
302−Computes the maximum of `a` and `b`, producing an atom.
458+Examples
303−
459+--------
304−`a` is an [atom]().
305−
306−`b` is an [atom]().
307
460
308 ~zod/try=> (max 10 100)
461 ~zod/try=> (max 10 100)
309 100
462 100
@@ -318,6 +471,23 @@ Computes the maximum of `a` and `b`, producing an atom.
318
471
319Minimum
472Minimum
320
473
474+Computes the lesser of `a` and `b`.
475+
476+Accepts
477+-------
478+
479+`a` is an [atom]().
480+
481+`b` is an atom.
482+
483+Produces
484+--------
485+
486+An atom.
487+
488+Source
489+------
490+
321 ++ min :: minimum
491 ++ min :: minimum
322 ~/ %min
492 ~/ %min
323 |= [a=@ b=@]
493 |= [a=@ b=@]
@@ -326,11 +496,8 @@ Minimum
326 b
496 b
327 ::
497 ::
328
498
329−Computes the minimum of `a` and `b`, producing an atom.
499+Examples
330−
500+--------
331−`a` is an [atom]().
332−
333−`b` is an [atom]().
334
501
335 ~zod/try=> (min 10 100)
502 ~zod/try=> (min 10 100)
336 10
503 10
@@ -345,6 +512,23 @@ Computes the minimum of `a` and `b`, producing an atom.
345
512
346Modulus
513Modulus
347
514
515+Computes the remainder of dividing `a` by `b`.
516+
517+Accepts
518+-------
519+
520+`a` is an [atom]().
521+
522+`b` is an atom.
523+
524+Produces
525+--------
526+
527+An atom.
528+
529+Source
530+------
531+
348 ++ mod :: remainder
532 ++ mod :: remainder
349 ~/ %mod
533 ~/ %mod
350 |= [a=@ b=@]
534 |= [a=@ b=@]
@@ -353,11 +537,13 @@ Modulus
353 (sub a (mul b (div a b)))
537 (sub a (mul b (div a b)))
354 ::
538 ::
355
539
356−Computes the remainder of dividing `a` by `b`, producing an atom.
540+Examples
357−
541+--------
358−`a` is an [atom]().
359
542
360−`b` is an [atom]().
543+ ~zod/try=> (mod 5 2)
544+ 1
545+ ~zod/try=> (mod 5 5)
546+ 0
361
547
362------------------------------------------------------------------------
548------------------------------------------------------------------------
363
549
@@ -365,6 +551,23 @@ Computes the remainder of dividing `a` by `b`, producing an atom.
365
551
366Multiply
552Multiply
367
553
554+Multiplies `a` by `b`.
555+
556+Accepts
557+-------
558+
559+`a` is an [atom]().
560+
561+`b` is an atom.
562+
563+Produces
564+--------
565+
566+An atom.
567+
568+Source
569+------
570+
368 ++ mul :: multiply
571 ++ mul :: multiply
369 ~/ %mul
572 ~/ %mul
370 |= [a=@ b=@]
573 |= [a=@ b=@]
@@ -375,11 +578,8 @@ Multiply
375 $(a (dec a), c (add b c))
578 $(a (dec a), c (add b c))
376 ::
579 ::
377
580
378−Multiplies `a` by `b`, producing an atom.
581+Examples
379−
582+--------
380−`a` is an [atom]().
381−
382−`b` is an [atom]().
383
583
384 ~zod/try=> (mul 3 4)
584 ~zod/try=> (mul 3 4)
385 12
585 12
@@ -392,6 +592,23 @@ Multiplies `a` by `b`, producing an atom.
392
592
393Axis within axis
593Axis within axis
394
594
595+Computes the axis of `b` within axis `a`.
596+
597+Accepts
598+-------
599+
600+`a` is an [atom]().
601+
602+`b` is an atom.
603+
604+Produces
605+--------
606+
607+An atom.
608+
609+Source
610+------
611+
395 ++ peg :: tree connect
612 ++ peg :: tree connect
396 ~/ %peg
613 ~/ %peg
397 |= [a=@ b=@]
614 |= [a=@ b=@]
@@ -404,11 +621,8 @@ Axis within axis
404 ==
621 ==
405 ::
622 ::
406
623
407−Computes the axis of `b` within axis `a`, producing an atom.
624+Examples
408−
625+--------
409−`a` is an [atom]().
410−
411−`b` is an [atom]().
412
626
413 ~zod/try=> (peg 4 1)
627 ~zod/try=> (peg 4 1)
414 4
628 4
@@ -423,6 +637,23 @@ Computes the axis of `b` within axis `a`, producing an atom.
423
637
424Subtract
638Subtract
425
639
640+Subtracts `b` from `a`.
641+
642+Accepts
643+-------
644+
645+`a` is an [atom]().
646+
647+`b` is an [atom]().
648+
649+Produces
650+--------
651+
652+An atom.
653+
654+Source
655+------
656+
426 ++ sub :: subtract
657 ++ sub :: subtract
427 ~/ %sub
658 ~/ %sub
428 |= [a=@ b=@]
659 |= [a=@ b=@]
@@ -431,11 +662,8 @@ Subtract
431 ?: =(0 b) a
662 ?: =(0 b) a
432 $(a (dec a), b (dec b))
663 $(a (dec a), b (dec b))
433
664
434−Subtracts `b` from `a`, producing an atom.
665+Examples
435−
666+--------
436−`a` is an [atom]().
437−
438−`b` is an [atom]().
439
667
440 ~zod/try=> (sub 10 5)
668 ~zod/try=> (sub 10 5)
441 5
669 5
docs/dev/hoon/library/2b.md+610−197
@@ -8,17 +8,31 @@ Section 2bA, units
8
8
9Unit as argument
9Unit as argument
10
10
11+Applies a function `b` that produces a unit to the unwrapped value of [++unit]()
12+`a` (`u.a`). If `a` is empty, `~` is produced.
13+
14+Accepts
15+-------
16+
17+`a` is a unit.
18+
19+`b` is a function that accepts a noun and produces a unit.
20+
21+Produces
22+--------
23+
24+A unit.
25+
26+Source
27+------
28+
11 ++ biff :: apply
29 ++ biff :: apply
12 |* [a=(unit) b=$+(* (unit))]
30 |* [a=(unit) b=$+(* (unit))]
13 ?~ a ~
31 ?~ a ~
14 (b u.a)
32 (b u.a)
15
33
16−Applies a gate that produces a unit, `b`, to the value (`u.a`) of a unit
34+Examples
17−`a`. If `a` is empty, `~` is produced.
35+--------
18−
19−`a` is a [unit]().
20−
21−`b` is a [gate]() that accepts a noun and produces a unit.
22
36
23 ~zod/try=> (biff (some 5) |=(a=@ (some (add a 2))))
37 ~zod/try=> (biff (some 5) |=(a=@ (some (add a 2))))
24 [~ u=7]
38 [~ u=7]
@@ -29,19 +43,34 @@ Applies a gate that produces a unit, `b`, to the value (`u.a`) of a unit
29
43
30### `++bind`
44### `++bind`
31
45
32−Bind
46+Non-unit function to unit, producing unit
47+
48+Applies a function `b` to the value (`u.a`) of a [++unit]() `a`, producing
49+a unit. Used when you want a function that does not accept or produce a
50+unit to both accept and produce a unit.
51+
52+Accepts
53+-------
54+
55+`a` is a unit.
56+
57+`b` is a function.
58+
59+Produces
60+--------
61+
62+A unit.
63+
64+Source
65+------
33
66
34 ++ bind :: argue
67 ++ bind :: argue
35 |* [a=(unit) b=gate]
68 |* [a=(unit) b=gate]
36 ?~ a ~
69 ?~ a ~
37 [~ u=(b u.a)]
70 [~ u=(b u.a)]
38
71
39−Applies a function `b` to the value (`u.a`) of a unit `a`, producing a
72+Examples
40−unit.
73+--------
41−
42−`a` is a [unit]()
43−
44−`b` is a [gate]().
45
74
46 ~zod/try=> (bind ((unit ,@) [~ 97]) ,@t)
75 ~zod/try=> (bind ((unit ,@) [~ 97]) ,@t)
47 [~ `a`]
76 [~ `a`]
@@ -55,18 +84,32 @@ unit.
55
84
56Replace null
85Replace null
57
86
87+Replaces an empty [++unit]() `b` with the product of a called [trap]()
88+`a`. If the unit is not empty, then the original unit is produced.
89+
90+Accepts
91+-------
92+
93+`a` is a trap.
94+
95+`b` is a unit.
96+
97+Produces
98+--------
99+
100+Either the product of `a` or the value inside of unit `b`.
101+
102+Source
103+------
104+
58 ++ bond :: replace
105 ++ bond :: replace
59 |* a=trap
106 |* a=trap
60 |* b=(unit)
107 |* b=(unit)
61 ?~ b $:a
108 ?~ b $:a
62 u.b
109 u.b
63
110
64−Replaces an empty unit `b` with the product of a kicked trap `a`. If the
111+Examples
65−unit is not empty, then the original unit is produced.
112+--------
66−
67−`a` is a [trap]().
68−
69−`b` is a [unit]().
70
113
71 ~zod/try=> (bex 10)
114 ~zod/try=> (bex 10)
72 1.024
115 1.024
@@ -79,7 +122,26 @@ unit is not empty, then the original unit is produced.
79
122
80### `++both`
123### `++both`
81
124
82−Group unit values
125+Group unit values into pair
126+
127+Produces `~` if either `a` or `b` are empty. Otherwise, produces a
128+[++unit]() whose value is a cell of the values of two input units `a` and
129+`b`.
130+
131+Accepts
132+-------
133+
134+`a` is a unit.
135+
136+`b` is a unit.
137+
138+Produces
139+--------
140+
141+A unit of the two initial values.
142+
143+Source
144+------
83
145
84 ++ both :: all the above
146 ++ both :: all the above
85 |* [a=(unit) b=(unit)]
147 |* [a=(unit) b=(unit)]
@@ -87,12 +149,8 @@ Group unit values
87 ?~ b ~
149 ?~ b ~
88 [~ u=[u.a u.b]]
150 [~ u=[u.a u.b]]
89
151
90−Produces a unit whose value is a cell of the values of two input units
152+Examples
91−`a` and `b`. If either of the two units are empty, `~` is produced.
153+--------
92−
93−`a` is a [unit]().
94−
95−`b` is a [unit]().
96
154
97 ~zod/try=> (both (some 1) (some %b))
155 ~zod/try=> (both (some 1) (some %b))
98 [~ u=[1 %b]]
156 [~ u=[1 %b]]
@@ -103,7 +161,27 @@ Produces a unit whose value is a cell of the values of two input units
103
161
104### `++clap`
162### `++clap`
105
163
106−Apply gate to two units
164+Apply function to two units
165+
166+Applies a binary function `c`--which does not usually accept or produce a [`++unit`]()--
167+to the values of two units, `a` and `b`, producing a unit.
168+
169+Accepts
170+-------
171+
172+`a` is a unit.
173+
174+`b` is a unit.
175+
176+`c` is a function that performs a binary operation.
177+
178+Produces
179+--------
180+
181+A unit.
182+
183+Source
184+------
107
185
108 ++ clap :: combine
186 ++ clap :: combine
109 |* [a=(unit) b=(unit) c=_|=(^ +<-)]
187 |* [a=(unit) b=(unit) c=_|=(^ +<-)]
@@ -111,14 +189,8 @@ Apply gate to two units
111 ?~ b a
189 ?~ b a
112 [~ u=(c u.a u.b)]
190 [~ u=(c u.a u.b)]
113
191
114−Applies a binary operation `c` which produces a unit to the values of
192+Examples
115−two units `a` and `b`.
193+--------
116−
117−`a` is a [unit]().
118−
119−`b` is a [unit]().
120−
121−`c` is a [gate]() that performs a binary operation.
122
194
123 ~zod/try=> =u ((unit ,@t) [~ 'a'])
195 ~zod/try=> =u ((unit ,@t) [~ 'a'])
124 ~zod/try=> =v ((unit ,@t) [~ 'b'])
196 ~zod/try=> =v ((unit ,@t) [~ 'b'])
@@ -135,16 +207,30 @@ two units `a` and `b`.
135
207
136### `++drop`
208### `++drop`
137
209
138−Unit list
210+Unit to list
211+
212+Makes a [++list]() of the unwrapped value (`u.a`) of a [`++unit`]() `a`.
213+
214+Accepts
215+-------
216+
217+`a` is a unit.
218+
219+Produces
220+--------
221+
222+A list.
223+
224+Source
225+------
139
226
140 ++ drop :: enlist
227 ++ drop :: enlist
141 |* a=(unit)
228 |* a=(unit)
142 ?~ a ~
229 ?~ a ~
143 [i=u.a t=~]
230 [i=u.a t=~]
144
231
145−Produces a [list]() of the value from a unit `a`.
232+Examples
146−
233+--------
147−`a` is a [unit]().
148
234
149 ~zod/try=> =a ((unit ,@) [~ 97])
235 ~zod/try=> =a ((unit ,@) [~ 97])
150 ~zod/try=> (drop a)
236 ~zod/try=> (drop a)
@@ -157,18 +243,31 @@ Produces a [list]() of the value from a unit `a`.
157
243
158### `++fall`
244### `++fall`
159
245
160−Default unit
246+Give unit a default value
247+
248+Produces a default value `b` for a [`++unit`]() `a` in cases where `a` is null.
249+
250+Accepts
251+-------
252+
253+`a` is a unit.
254+
255+`b` is a [noun]() that's used as the default value.
256+
257+Produces
258+--------
259+
260+Either a noun `b` or the unwrapped value of unit `a`.
261+
262+Source
263+------
161
264
162 ++ fall :: default
265 ++ fall :: default
163 |* [a=(unit) b=*]
266 |* [a=(unit) b=*]
164 ?~(a b u.a)
267 ?~(a b u.a)
165
268
166−Produces a default value `b` for a unit `a` in cases where the unit is
269+Examples
167−null.
270+--------
168−
169−`a` is a [unit]().
170−
171−`b` is a [noun]() used as the default value.
172
271
173 ~zod/try=> (fall ~ `a`)
272 ~zod/try=> (fall ~ `a`)
174 `a`
273 `a`
@@ -179,20 +278,34 @@ null.
179
278
180### `++lift`
279### `++lift`
181
280
182−Fmap
281+Curried bind
282+
283+Accepts a [`++gate`]() `a` and produces a function that accepts [`++unit`]()
284+`b` to which it applies `a`. Used when you want a function that does not accept
285+or produce a unit to both accept and produce a unit.
286+
287+Accepts
288+-------
289+
290+`a` is a gate.
291+
292+`b` is a unit.
293+
294+Produces
295+--------
296+
297+A unit.
298+
299+Source
300+------
183
301
184 ++ lift :: lift gate (fmap)
302 ++ lift :: lift gate (fmap)
185 |* a=gate :: flipped
303 |* a=gate :: flipped
186 |* b=(unit) :: curried
304 |* b=(unit) :: curried
187 (bind b a) :: bind
305 (bind b a) :: bind
188
306
189−Similar to `fmap` in Haskell: accepts a gate `a` that accepts and
307+Examples
190−produces an unwrapped value, passes it the value of a unit `b`, and then
308+--------
191−produces a unit value.
192−
193−`a` is a [gate]().
194−
195−`b` is a [unit]().
196
309
197 ~zod/try=> ((lift dec) `(unit ,@)`~)
310 ~zod/try=> ((lift dec) `(unit ,@)`~)
198 ~
311 ~
@@ -205,21 +318,35 @@ produces a unit value.
205
318
206Choose
319Choose
207
320
208− ++ mate :: choose
209− |* [a=(unit) b=(unit)]
210− ?~ b a
211− ?~ a b
212− ?.(=(u.a u.b) ~|('mate' !!) a)
213−
214Accepts two units `a` and `b` whose values are expected to be
321Accepts two units `a` and `b` whose values are expected to be
215equivalent. If either is empty, then the value of the other is produced.
322equivalent. If either is empty, then the value of the other is produced.
216If neither are empty, it asserts that both values are the same and
323If neither are empty, it asserts that both values are the same and
217produces that value. If the assertion fails, `++mate` crashes with
324produces that value. If the assertion fails, `++mate` crashes with
218`'mate'` in the stack trace.
325`'mate'` in the stack trace.
219
326
327+Accepts
328+-------
329+
220−`a` is a [unit]().
330+`a` is a unit.
331+
332+`b` is a unit.
221
333
334+Produces
335+--------
336+
337+A unit or crash.
338+
339+Source
340+------
341+
342+++ mate :: choose
222−`b` is a [unit]().
343+ |* [a=(unit) b=(unit)]
344+ ?~ b a
345+ ?~ a b
346+ ?.(=(u.a u.b) ~|('mate' !!) a)
347+
348+Examples
349+--------
223
350
224 ~zod/try=> =a ((unit ,@) [~ 97])
351 ~zod/try=> =a ((unit ,@) [~ 97])
225 ~zod/try=> =b ((unit ,@) [~ 97])
352 ~zod/try=> =b ((unit ,@) [~ 97])
@@ -239,16 +366,30 @@ produces that value. If the assertion fails, `++mate` crashes with
239
366
240### `++need`
367### `++need`
241
368
242−Unwrap
369+Unwrap unit
370+
371+Retrieve the value from a [`++unit`]() and crash if the unit is null.
372+
373+Accepts
374+-------
375+
376+`a` is a unit.
377+
378+Produces
379+--------
380+
381+Either the unwrapped value of `a` (`u.a`), or crash.
382+
383+Source
384+------
243
385
244 ++ need :: demand
386 ++ need :: demand
245 |* a=(unit)
387 |* a=(unit)
246 ?~ a !!
388 ?~ a !!
247 u.a
389 u.a
248
390
249−Retrieve the value from a unit and crash if the unit is null.
391+Examples
250−
392+--------
251−`a` is a [unit]().
252
393
253 ~zod/try=> =a ((unit ,[@t @t]) [~ ['a' 'b']])
394 ~zod/try=> =a ((unit ,[@t @t]) [~ ['a' 'b']])
254 ~zod/try=> (need a)
395 ~zod/try=> (need a)
@@ -264,15 +405,29 @@ Retrieve the value from a unit and crash if the unit is null.
264
405
265### `++some`
406### `++some`
266
407
267−Unify
408+Wrap value in a unit
409+
410+Takes any atom `a` and produces a [`++unit`]() with the value set to `a`.
411+
412+Accepts
413+-------
414+
415+`a` is a [noun]().
416+
417+Produces
418+--------
419+
420+A unit.
421+
422+Source
423+------
268
424
269 ++ some :: lift (pure)
425 ++ some :: lift (pure)
270 |* a=*
426 |* a=*
271 [~ u=a]
427 [~ u=a]
272
428
273−Takes any atom `a` and produces a unit with the value set to `a`.
429+Examples
274−
430+--------
275−`a` is a [noun]().
276
431
277 ~zod/try=> (some [`a` `b`])
432 ~zod/try=> (some [`a` `b`])
278 [~ u=[`a` `b`]]
433 [~ u=[`a` `b`]]
@@ -284,9 +439,24 @@ Takes any atom `a` and produces a unit with the value set to `a`.
284section 2bB, lists
439section 2bB, lists
285------------------
440------------------
286
441
442+Reverse
443+
287### `++flop`
444### `++flop`
288
445
289−Reverse
446+Produces the list `a` in reverse order.
447+
448+Accepts
449+-------
450+
451+`a` is a list.
452+
453+Produces
454+--------
455+
456+A list.
457+
458+Source
459+------
290
460
291 ++ flop :: reverse
461 ++ flop :: reverse
292 ~/ %flop
462 ~/ %flop
@@ -298,20 +468,34 @@ Reverse
298 ?~ a b
468 ?~ a b
299 $(a t.a, b [i.a b])
469 $(a t.a, b [i.a b])
300
470
301−Produces the list `a` in reverse order.
302
471
303−`a` is a [list]().
472+Examples
473+--------
304
474
305 ~zod/try=> =a (limo [1 2 3 ~])
475 ~zod/try=> =a (limo [1 2 3 ~])
306 ~zod/try=> (flop a)
476 ~zod/try=> (flop a)
307 ~[3 2 1]
477 ~[3 2 1]
308
478
309−------------------------------------------------------------------------
310−
311### `++homo`
479### `++homo`
312
480
313Homogenize
481Homogenize
314
482
483+Produces a [`++list`]() whose type is a fork of all the contained types in the
484+list `a`. Used when you want to make all the types of the elements of a list the same.
485+
486+Accepts
487+-------
488+
489+`a` is a list.
490+
491+Produces
492+--------
493+
494+a list.
495+
496+Source
497+------
498+
315 ++ homo :: homogenize
499 ++ homo :: homogenize
316 |* a=(list)
500 |* a=(list)
317 ^+ =< $
501 ^+ =< $
@@ -319,10 +503,8 @@ Homogenize
319 --
503 --
320 a
504 a
321
505
322−Produces a list whose type is a fork of all the contained types in the
506+Examples
323−list `a`.
507+--------
324−
325−`a` is a [list]().
326
508
327 ~zod/try=> lyst
509 ~zod/try=> lyst
328 [i=1 t=[i=97 t=[i=2 t=[i=98 t=[i=[~ u=10] t=~]]]]]
510 [i=1 t=[i=97 t=[i=2 t=[i=98 t=[i=[~ u=10] t=~]]]]]
@@ -334,12 +516,25 @@ list `a`.
334 ~zod/try=> (homo a)
516 ~zod/try=> (homo a)
335 ~[1 2 3]
517 ~[1 2 3]
336
518
337−------------------------------------------------------------------------
338−
339### `++limo`
519### `++limo`
340
520
341List Constructor
521List Constructor
342
522
523+Turns a null-terminated tuple into a [`++list`]().
524+
525+Accepts
526+-------
527+
528+`a` is a null-terminated tuple.
529+
530+Produces
531+--------
532+
533+A list
534+
535+Source
536+------
537+
343 ++ limo :: listify
538 ++ limo :: listify
344 |* a=*
539 |* a=*
345 ^+ =< $
540 ^+ =< $
@@ -347,19 +542,33 @@ List Constructor
347 --
542 --
348 a
543 a
349
544
350−Turns a null-terminated tuple into a list.
545+Examples
351−
546+--------
352−`a` is a null-terminated tuple.
353
547
354 ~zod/try=> (limo [1 2 3 ~])
548 ~zod/try=> (limo [1 2 3 ~])
355 [i=1 t=[i=2 t=[i=3 t=~]]]
549 [i=1 t=[i=2 t=[i=3 t=~]]]
356
550
357−------------------------------------------------------------------------
551+----------------------------------------------------------------------
358
552
359### `++lent`
553### `++lent`
360
554
361List length
555List length
362
556
557+Produces the length of any [`++list`]() `a` as an atom.
558+
559+Accepts
560+-------
561+
562+`a` is a list.
563+
564+Produces
565+--------
566+
567+an atom.
568+
569+Source
570+------
571+
363 ++ lent :: length
572 ++ lent :: length
364 ~/ %lent
573 ~/ %lent
365 |= a=(list)
574 |= a=(list)
@@ -369,9 +578,8 @@ List length
369 ?~ a b
578 ?~ a b
370 $(a t.a, b +(b))
579 $(a t.a, b +(b))
371
580
372−Produces the length of any list `a` as an atom.
581+Examples
373−
582+--------
374−`a` is a [list]().
375
583
376 ~zod/try=> (lent (limo [1 2 3 4 ~]))
584 ~zod/try=> (lent (limo [1 2 3 4 ~]))
377 4
585 4
@@ -382,7 +590,22 @@ Produces the length of any list `a` as an atom.
382
590
383### `++levy`
591### `++levy`
384
592
385−"and" to list
593+Logical "and" on list
594+
595+Computes the Boolean logical "and" on the results of [gate]() `b` applied to each individual element in [`++list`]() `a`.
596+
597+Accepts
598+-------
599+
600+`a` is a list.
601+
602+`b` is a gate.
603+
604+Produces
605+--------
606+
607+Source
608+------
386
609
387 ++ levy
610 ++ levy
388 ~/ %levy :: all of
611 ~/ %levy :: all of
@@ -392,12 +615,8 @@ Produces the length of any list `a` as an atom.
392 ?. (b i.a) |
615 ?. (b i.a) |
393 $(a t.a)
616 $(a t.a)
394
617
395−Produces the Boolean "and" of the result of every element in list `a`
618+Examples
396−passed to gate `b`.
619+--------
397−
398−`a` is a [list]().
399−
400−`b` is a [gate]().
401
620
402 ~zod/try=> =a |=(a=@ (lte a 1))
621 ~zod/try=> =a |=(a=@ (lte a 1))
403 ~zod/try=> (levy (limo [0 1 2 1 ~]) a)
622 ~zod/try=> (levy (limo [0 1 2 1 ~]) a)
@@ -410,7 +629,7 @@ passed to gate `b`.
410
629
411### `++lien`
630### `++lien`
412
631
413−"or" to list
632+Logical "or" on list
414
633
415 ++ lien :: some of
634 ++ lien :: some of
416 ~/ %lien
635 ~/ %lien
@@ -420,12 +639,11 @@ passed to gate `b`.
420 ?: (b i.a) &
639 ?: (b i.a) &
421 $(a t.a)
640 $(a t.a)
422
641
423−Produces the Boolean "or" of the result of every element in list `a`
642+Computes the Boolean logical "or" on the results of applying [gate]() `b` to every element of [`++list`]() `a`.
424−passed to gate `b`.
425
643
426−`a` is a [list]().
644+`a` is a list.
427
645
428−`b` is a [gate]().
646+`b` is a gate.
429
647
430 ~zod/try=> =a |=(a=@ (gte a 1))
648 ~zod/try=> =a |=(a=@ (gte a 1))
431 ~zod/try=> (lien (limo [0 1 2 1 ~]) a)
649 ~zod/try=> (lien (limo [0 1 2 1 ~]) a)
@@ -440,6 +658,25 @@ passed to gate `b`.
440
658
441Maybe transform
659Maybe transform
442
660
661+Passes each member of [`++list`]() `a` to [gate]() `b`, which must produce a
662+[`++unit`](). Produces a new list with all the results that do not produce
663+`~`.
664+
665+Accepts
666+-------
667+
668+`a` is a [list]().
669+
670+`b` is a [gate]() that produces a [unit]().
671+
672+Produces
673+--------
674+
675+A unit.
676+
677+Source
678+------
679+
443 ++ murn :: maybe transform
680 ++ murn :: maybe transform
444 |* [a=(list) b=$+(* (unit))]
681 |* [a=(list) b=$+(* (unit))]
445 |-
682 |-
@@ -449,34 +686,42 @@ Maybe transform
449 $(a t.a)
686 $(a t.a)
450 [i=u.c t=$(a t.a)]
687 [i=u.c t=$(a t.a)]
451
688
452−Passes each member of list `a` to gate `b`, which must produce a unit.
689+Examples
453−Produces a new list with all the results that do not produce `~`.
690+--------
454−
455−`a` is a [list]().
456−
457−`b` is a [gate]() that produces a [unit]().
458
691
459 ~zod/try=> =a |=(a=@ ?.((gte a 2) ~ (some (add a 10))))
692 ~zod/try=> =a |=(a=@ ?.((gte a 2) ~ (some (add a 10))))
460 ~zod/try=> (murn (limo [0 1 2 3 ~]) a)
693 ~zod/try=> (murn (limo [0 1 2 3 ~]) a)
461 [i=12 t=[i=13 t=~]]
694 [i=12 t=[i=13 t=~]]
462
695
463−------------------------------------------------------------------------
696+-------------------------------------------------------------
464
697
465### `++reap`
698### `++reap`
466
699
467Replicate
700Replicate
468
701
702+Replicate: produces a [`++list`]() containing `a` copies of `b`.
703+
704+Accepts
705+-------
706+
707+`b` is a [noun]()
708+
709+Produces
710+--------
711+
712+A list.
713+
714+Source
715+------
716+
469 ++ reap :: replicate
717 ++ reap :: replicate
470 |* [a=@ b=*]
718 |* [a=@ b=*]
471 |- ^- (list ,_b)
719 |- ^- (list ,_b)
472 ?~ a ~
720 ?~ a ~
473 [b $(a (dec a))]
721 [b $(a (dec a))]
474
722
475−Replicate: produces a list containing `a` copies of `b`.
723+Examples
476−
724+--------
477−`a` is an [atom]()
478−
479−`b` is a [noun]()
480
725
481 ~zod/try=> (reap 20 %a)
726 ~zod/try=> (reap 20 %a)
482 ~[%a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a]
727 ~[%a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a]
@@ -491,6 +736,23 @@ Replicate: produces a list containing `a` copies of `b`.
491
736
492Right fold
737Right fold
493
738
739+Right fold: moves right to left across a [`++list`]() `a`, recursively slamming
740+a binary [gate]() `b` with an element from `a` and an accumulator, producing
741+the final value of the accumulator.
742+
743+Accepts
744+-------
745+
746+`b` is a binary gate.
747+
748+Produces
749+--------
750+
751+The accumulator, which is a [noun]().
752+
753+Source
754+------
755+
494 ++ reel :: right fold
756 ++ reel :: right fold
495 ~/ %reel
757 ~/ %reel
496 |* [a=(list) b=_|=([* *] +<+)]
758 |* [a=(list) b=_|=([* *] +<+)]
@@ -499,13 +761,8 @@ Right fold
499 +<+.b
761 +<+.b
500 (b i.a $(a t.a))
762 (b i.a $(a t.a))
501
763
502−Right fold: moves right to left across a list `a`, recursively slamming
764+Examples
503−a binary gate `b` with an element from `a` and an accumulator, producing
765+--------
504−the final value of the accumulator.
505−
506−`a` is a [list]().
507−
508−`b` is a binary [gate]().
509
766
510 ~zod/try=> =sum =|([p=@ q=@] |.((add p q)))
767 ~zod/try=> =sum =|([p=@ q=@] |.((add p q)))
511 ~zod/try=> (reel (limo [1 2 3 4 5 ~]) sum)
768 ~zod/try=> (reel (limo [1 2 3 4 5 ~]) sum)
@@ -523,6 +780,23 @@ the final value of the accumulator.
523
780
524Left fold
781Left fold
525
782
783+Left fold: moves left to right across a list `a`, recursively slamming a
784+binary [gate]() `b` with an element from the [`++list`]() and an accumulator,
785+producing the final value of the accumulator.
786+
787+Accepts
788+-------
789+
790+`b` is a binary [gate]().
791+
792+Produces
793+--------
794+
795+The accumulator, which is a [noun]().
796+
797+Source
798+------
799+
526 ++ roll :: left fold
800 ++ roll :: left fold
527 ~/ %roll
801 ~/ %roll
528 |* [a=(list) b=_|=([* *] +<+)]
802 |* [a=(list) b=_|=([* *] +<+)]
@@ -531,13 +805,8 @@ Left fold
531 +<+.b
805 +<+.b
532 $(a t.a, b b(+<+ (b i.a +<+.b)))
806 $(a t.a, b b(+<+ (b i.a +<+.b)))
533
807
534−Left fold: moves left to right across a list `a`, recursively slamming a
808+Examples
535−binary gate `b` with an element from the list and an accumulator,
809+--------
536−producing the final value of the accumulator.
537−
538−`a` is a [list]().
539−
540−`b` is a binary [gate]().
541
810
542 ~zod/try=> =sum =|([p=@ q=@] |.((add p q)))
811 ~zod/try=> =sum =|([p=@ q=@] |.((add p q)))
543 ~zod/try=> (roll (limo [1 2 3 4 5 ~]) sum)
812 ~zod/try=> (roll (limo [1 2 3 4 5 ~]) sum)
@@ -555,6 +824,22 @@ producing the final value of the accumulator.
555
824
556Separate
825Separate
557
826
827+Seperates a [`++list`]() `a` into two lists - Those elements of `a` who produce
828+true when slammed to [gate]() `b` and those who produce `%.n`.
829+
830+Accepts
831+-------
832+
833+`b` is a gate that accepts one argument and produces a loobean.
834+
835+Produces
836+--------
837+
838+A cell of two lists.
839+
840+Source
841+------
842+
558 ++ skid :: separate
843 ++ skid :: separate
559 |* [a=(list) b=$+(* ?)]
844 |* [a=(list) b=$+(* ?)]
560 |- ^+ [p=a q=a]
845 |- ^+ [p=a q=a]
@@ -562,12 +847,9 @@ Separate
562 =+ c=$(a t.a)
847 =+ c=$(a t.a)
563 ?:((b i.a) [[i.a p.c] q.c] [p.c [i.a q.c]])
848 ?:((b i.a) [[i.a p.c] q.c] [p.c [i.a q.c]])
564
849
565−Seperates a list `a` into two lists - Those elements of `a` who produce
566−true when slammed to gate `b` and those who produce `%.n`.
567
850
568−`a` is a [list]().
851+Examples
569−
852+--------
570−`b` is a [gate]() that accepts one argument and produces a loobean.
571
853
572 ~zod/try=> =a |=(a=@ (gth a 1))
854 ~zod/try=> =a |=(a=@ (gth a 1))
573 ~zod/try=> (skid (limo [0 1 2 3 ~]) a)
855 ~zod/try=> (skid (limo [0 1 2 3 ~]) a)
@@ -579,22 +861,32 @@ true when slammed to gate `b` and those who produce `%.n`.
579
861
580Suffix
862Suffix
581
863
582− ++ skim :: only
583− ~/ %skim
584− |* [a=(list) b=_|=(p=* .?(p))]
585− |-
586− ^+ a
587− ?~ a ~
588− ?:((b i.a) [i.a $(a t.a)] $(a t.a))
589−
590Cycles through the members of a list `a`, passing them to a gate `b` and
864Cycles through the members of a list `a`, passing them to a gate `b` and
591producing a list of all of the members that produce `%.y`. Inverse of
865producing a list of all of the members that produce `%.y`. Inverse of
592`++skip`.
866`++skip`.
593
867
594−`a` is a [list]().
868+Accepts
869+-------
595
870
596`b` is a [gate]() that accepts one argument and produces a loobean.
871`b` is a [gate]() that accepts one argument and produces a loobean.
597
872
873+Produces
874+--------
875+
876+Source
877+------
878+
879+++ skim :: only
880+ ~/ %skim
881+ |* [a=(list) b=_|=(p=* .?(p))]
882+ |-
883+ ^+ a`
884+ ?~ a ~
885+ ?:((b i.a) [i.a $(a t.a)] $(a t.a))
886+
887+Examples
888+--------
889+
598 ~zod/try=> =a |=(a=@ (gth a 1))
890 ~zod/try=> =a |=(a=@ (gth a 1))
599 ~zod/try=> (skim (limo [0 1 2 3 ~]) a)
891 ~zod/try=> (skim (limo [0 1 2 3 ~]) a)
600 [i=2 t=[i=3 t=~]]
892 [i=2 t=[i=3 t=~]]
@@ -605,6 +897,23 @@ producing a list of all of the members that produce `%.y`. Inverse of
605
897
606Except
898Except
607
899
900+Cycles through the members of [`++list`]() `a`, passing them to a [gate]() `b`.
901+Produces a list of all of the members that produce `%.n`. Inverse of
902+`++skim`.
903+
904+Accepts
905+-------
906+
907+`b` is a [gate]() that accepts one argument and produces a loobean.
908+
909+Produces
910+--------
911+
912+A list of the same type as `a`.
913+
914+Source
915+------
916+
608 ++ skip :: except
917 ++ skip :: except
609 ~/ %skip
918 ~/ %skip
610 |* [a=(list) b=_|=(p=* .?(p))]
919 |* [a=(list) b=_|=(p=* .?(p))]
@@ -613,13 +922,8 @@ Except
613 ?~ a ~
922 ?~ a ~
614 ?:((b i.a) $(a t.a) [i.a $(a t.a)])
923 ?:((b i.a) $(a t.a) [i.a $(a t.a)])
615
924
616−Cycles through the members of a list `a`, passing them to a gate `b` and
925+Examples
617−producing a list of all of the members that produce `%.n`. Inverse of
926+--------
618−`++skim`.
619−
620−`a` is a [list]().
621−
622−`b` is a [gate]() that accepts one argument and produces a loobean.
623
927
624 ~zod/try=> =a |=(a=@ (gth a 1))
928 ~zod/try=> =a |=(a=@ (gth a 1))
625 ~zod/try=> (skip (limo [0 1 2 3 ~]) a)
929 ~zod/try=> (skip (limo [0 1 2 3 ~]) a)
@@ -631,6 +935,22 @@ producing a list of all of the members that produce `%.n`. Inverse of
631
935
632Prefix
936Prefix
633
937
938+Accepts an atom `a` and [list]() `b`, producing the first `a` elements of
939+the front of the list.
940+
941+Accepts
942+-------
943+
944+`b` is a list.
945+
946+Produces
947+--------
948+
949+A list of the same type as `b`.
950+
951+Source
952+------
953+
634 ++ scag :: prefix
954 ++ scag :: prefix
635 ~/ %scag
955 ~/ %scag
636 |* [a=@ b=(list)]
956 |* [a=@ b=(list)]
@@ -638,12 +958,8 @@ Prefix
638 ?: |(?=(~ b) =(0 a)) ~
958 ?: |(?=(~ b) =(0 a)) ~
639 [i.b $(b t.b, a (dec a))]
959 [i.b $(b t.b, a (dec a))]
640
960
641−Accepts an atom `a` and list `b`, producing the first `a` elements of
961+Examples
642−the front of the list.
962+--------
643−
644−`a` is an [atom]().
645−
646−`b` is a [list]().
647
963
648 ~zod/try=> (scag 2 (limo [0 1 2 3 ~]))
964 ~zod/try=> (scag 2 (limo [0 1 2 3 ~]))
649 [i=0 t=[i=1 t=~]]
965 [i=0 t=[i=1 t=~]]
@@ -656,6 +972,22 @@ the front of the list.
656
972
657Suffix
973Suffix
658
974
975+Accepts an atom `a` and list `b`, producing the remaining elements from
976+`b` starting at `a`.
977+
978+Accepts
979+-------
980+
981+`b` is a [list]().
982+
983+Produces
984+--------
985+
986+A list of the same type as `b`.
987+
988+Source
989+------
990+
659 ++ slag :: suffix
991 ++ slag :: suffix
660 ~/ %slag
992 ~/ %slag
661 |* [a=@ b=(list)]
993 |* [a=@ b=(list)]
@@ -664,12 +996,8 @@ Suffix
664 ?~ b ~
996 ?~ b ~
665 $(b t.b, a (dec a))
997 $(b t.b, a (dec a))
666
998
667−Accepts an atom `a` and list `b`, producing the remaining elements from
999+Examples
668−`b` starting at `a`.
1000+--------
669−
670−`a` is an [atom]().
671−
672−`b` is a [list]().
673
1001
674 ~zod/try=> (slag 2 (limo [1 2 3 4 ~]))
1002 ~zod/try=> (slag 2 (limo [1 2 3 4 ~]))
675 [i=3 t=[i=4 t=~]]
1003 [i=3 t=[i=4 t=~]]
@@ -682,6 +1010,22 @@ Accepts an atom `a` and list `b`, producing the remaining elements from
682
1010
683Index
1011Index
684
1012
1013+Accepts an atom `a` and a [`++list`]() `b`, producing the element at the index
1014+of `a`and failing if the list is null. Lists are 0-indexed.
1015+
1016+Accepts
1017+-------
1018+
1019+`b` is a [list]().
1020+
1021+Produces
1022+--------
1023+
1024+Produces an element of `b`, or crashes if no element exists at that index.
1025+
1026+Source
1027+------
1028+
685 ++ snag :: index
1029 ++ snag :: index
686 ~/ %snag
1030 ~/ %snag
687 |* [a=@ b=(list)]
1031 |* [a=@ b=(list)]
@@ -691,12 +1035,8 @@ Index
691 ?: =(0 a) i.b
1035 ?: =(0 a) i.b
692 $(b t.b, a (dec a))
1036 $(b t.b, a (dec a))
693
1037
694−Accepts an atom `a` and a list `b`, producing the element at the index
1038+Examples
695−of `a`and failing if the list is null. Lists are 0-indexed.
1039+--------
696−
697−`a` is an [atom]().
698−
699−`b` is a [list]().
700
1040
701 ~zod/try=> (snag 2 "asdf")
1041 ~zod/try=> (snag 2 "asdf")
702 ~~d
1042 ~~d
@@ -709,6 +1049,23 @@ of `a`and failing if the list is null. Lists are 0-indexed.
709
1049
710Quicksort
1050Quicksort
711
1051
1052+Quicksort: accepts a [`++list`]() `a` and a [gate]() `b` which accepts two nouns and
1053+produces a loobean. `++sort` then produces a list of the elements of `a`,
1054+sorted according to `b`.
1055+
1056+Accepts
1057+-------
1058+
1059+`b` is a gate that ccepts two nouns and produces a boolean.
1060+
1061+Produces
1062+--------
1063+
1064+A list
1065+
1066+Source
1067+------
1068+
712 ++ sort :: quicksort
1069 ++ sort :: quicksort
713 ~/ %sort
1070 ~/ %sort
714 |* [a=(list) b=$+([* *] ?)]
1071 |* [a=(list) b=$+([* *] ?)]
@@ -720,13 +1077,8 @@ Quicksort
720 ^+ t.a
1077 ^+ t.a
721 [i.a $(a (skim t.a |=(c=_i.a !(b c i.a))))]
1078 [i.a $(a (skim t.a |=(c=_i.a !(b c i.a))))]
722
1079
723−Quicksort: accepts a list `a` and a gate `b` which accepts two nouns and
1080+Examples
724−produces a loobean. `++sort` then produces a list of the elements of `a`
1081+--------
725−sorted according to `b`.
726−
727−`a` is an [atom]().
728−
729−`b` is a [gate]() which accepts two nouns and produces a loobean.
730
1082
731 ~zod/try=> =a =|([p=@ q=@] |.((gth p q)))
1083 ~zod/try=> =a =|([p=@ q=@] |.((gth p q)))
732 ~zod/try=> (sort (limo [0 1 2 3 ~]) a)
1084 ~zod/try=> (sort (limo [0 1 2 3 ~]) a)
@@ -738,17 +1090,29 @@ sorted according to `b`.
738
1090
739Infix
1091Infix
740
1092
741− ++ swag :: infix
742− |* [[a=@ b=@] c=(list)]
743− (scag b (slag a c))
744−
745−Similar to `substr` in JavaScript: extracts a string infix, beginning at
1093+Similar to `substr` in Javascript: extracts a string infix, beginning at
746inclusive index `a`, producing `b` number of characters.
1094inclusive index `a`, producing `b` number of characters.
747
1095
748−`a` and `b` are [atom]()s.
1096+Accepts
1097+-------
749
1098
750`c` is a [list]().
1099`c` is a [list]().
751
1100
1101+Produces
1102+--------
1103+
1104+A list of the same type as `c`.
1105+
1106+Source
1107+------
1108+
1109+ ++ swag :: infix
1110+ |* [[a=@ b=@] c=(list)]
1111+ (scag b (slag a c))
1112+
1113+Examples
1114+--------
1115+
752 ~zod/try=> (swag [2 5] "roly poly")
1116 ~zod/try=> (swag [2 5] "roly poly")
753 "ly po"
1117 "ly po"
754 ~zod/try=> (swag [2 2] (limo [1 2 3 4 ~]))
1118 ~zod/try=> (swag [2 2] (limo [1 2 3 4 ~]))
@@ -760,6 +1124,22 @@ inclusive index `a`, producing `b` number of characters.
760
1124
761Gate to list
1125Gate to list
762
1126
1127+Accepts a [`++list`]() `a` and a [gate]() `b`. Produces a list with the gate applied
1128+to each element of the original list.
1129+
1130+Accepts
1131+-------
1132+
1133+`b` is a gate.
1134+
1135+Produces
1136+--------
1137+
1138+A list.
1139+
1140+Source
1141+------
1142+
763 ++ turn :: transform
1143 ++ turn :: transform
764 ~/ %turn
1144 ~/ %turn
765 |* [a=(list) b=_,*]
1145 |* [a=(list) b=_,*]
@@ -767,12 +1147,8 @@ Gate to list
767 ?~ a ~
1147 ?~ a ~
768 [i=(b i.a) t=$(a t.a)]
1148 [i=(b i.a) t=$(a t.a)]
769
1149
770−Accepts a list `a` and a gate `b`. Produces a list with the gate applied
1150+Examples
771−to each element of the original list.
1151+--------
772−
773−`a` is a [list]().
774−
775−`b` is a [gate]().
776
1152
777 ~zod/try=> (turn (limo [104 111 111 110 ~]) ,@t)
1153 ~zod/try=> (turn (limo [104 111 111 110 ~]) ,@t)
778 <|h o o n|>
1154 <|h o o n|>
@@ -786,6 +1162,16 @@ to each element of the original list.
786
1162
787Concatenate
1163Concatenate
788
1164
1165+Concatenate two [`++list`]()s `a` and `b`.
1166+
1167+Accepts
1168+-------
1169+
1170+`a` and `b` are [list]()s.
1171+
1172+Source
1173+------
1174+
789 ++ weld :: concatenate
1175 ++ weld :: concatenate
790 ~/ %weld
1176 ~/ %weld
791 |* [a=(list) b=(list)]
1177 |* [a=(list) b=(list)]
@@ -794,9 +1180,8 @@ Concatenate
794 ?~ a b
1180 ?~ a b
795 [i.a $(a t.a)]
1181 [i.a $(a t.a)]
796
1182
797−Concatenate two lists `a` and `b`.
1183+Examples
798−
1184+--------
799−`a` and `b` are [list]()s.
800
1185
801 ~zod/try=> (weld "urb" "it")
1186 ~zod/try=> (weld "urb" "it")
802 ~[~~u ~~r ~~b ~~i ~~t]
1187 ~[~~u ~~r ~~b ~~i ~~t]
@@ -809,6 +1194,24 @@ Concatenate two lists `a` and `b`.
809
1194
810Perfect weld
1195Perfect weld
811
1196
1197+Concatenate two [`++list`]()s `a` and `b` without losing their type information
1198+to homogenization.
1199+
1200+Accepts
1201+-------
1202+
1203+`a` is a list.
1204+
1205+`b` is a list.
1206+
1207+Produces
1208+--------
1209+
1210+A list.
1211+
1212+Source
1213+------
1214+
812 ++ welp :: perfect weld
1215 ++ welp :: perfect weld
813 =| [* *]
1216 =| [* *]
814 |%
1217 |%
@@ -818,10 +1221,8 @@ Perfect weld
818 +<-(+ $(+<- +<->))
1221 +<-(+ $(+<- +<->))
819 --
1222 --
820
1223
821−Concatenate two lists `a` and `b` without losing their type information
1224+Examples
822−to homogenization.
1225+--------
823−
824−`a` and `b` are [list]()s.
825
1226
826 ~zod/try=> (welp "foo" "bar")
1227 ~zod/try=> (welp "foo" "bar")
827 "foobar"
1228 "foobar"
@@ -885,6 +1286,22 @@ individually.
885
1286
886Cons
1287Cons
887
1288
1289+Turns a [`++list`]() of lists into a single list by promoting the elements of
1290+each sublist into the higher.
1291+
1292+Accepts
1293+-------
1294+
1295+A list of lists.
1296+
1297+Produces
1298+--------
1299+
1300+A list.
1301+
1302+Source
1303+------
1304+
888 ++ zing :: promote
1305 ++ zing :: promote
889 =| *
1306 =| *
890 |%
1307 |%
@@ -894,14 +1311,10 @@ Cons
894 (welp +<- $(+< +<+))
1311 (welp +<- $(+< +<+))
895 --
1312 --
896
1313
897−Turns a list of lists into a single list by promoting the elements of
1314+Examples
898−each sublist into the higher.
1315+--------
899−
900−Accepts a [list]() of lists.
901
1316
902 ~zod/try=> (zing (limo [(limo ['a' 'b' 'c' ~]) (limo ['e' 'f' 'g' ~]) (limo ['h' 'i' 'j' ~]) ~]))
1317 ~zod/try=> (zing (limo [(limo ['a' 'b' 'c' ~]) (limo ['e' 'f' 'g' ~]) (limo ['h' 'i' 'j' ~]) ~]))
903 ~['a' 'b' 'c' 'e' 'f' 'g' 'h' 'i' 'j']
1318 ~['a' 'b' 'c' 'e' 'f' 'g' 'h' 'i' 'j']
904 ~zod/try=> (zing (limo [(limo [1 'a' 2 'b' ~]) (limo [3 'c' 4 'd' ~]) ~]))
1319 ~zod/try=> (zing (limo [(limo [1 'a' 2 'b' ~]) (limo [3 'c' 4 'd' ~]) ~]))
905 ~[1 97 2 98 3 99 4 100]
1320 ~[1 97 2 98 3 99 4 100]
906−
907−------------------------------------------------------------------------
docs/dev/hoon/library/2c.md+1363−321
@@ -8,6 +8,21 @@ section 2cA, bit surgery
8
8
9Binary exponent
9Binary exponent
10
10
11+Computes the result of `2^a`, producing an [atom]().
12+
13+Accepts
14+-------
15+
16+`a` is an atom.
17+
18+Produces
19+--------
20+
21+An atom.
22+
23+Source
24+------
25+
11 ++ bex :: binary exponent
26 ++ bex :: binary exponent
12 ~/ %bex
27 ~/ %bex
13 |= a=@
28 |= a=@
@@ -15,9 +30,8 @@ Binary exponent
15 ?: =(0 a) 1
30 ?: =(0 a) 1
16 (mul 2 $(a (dec a)))
31 (mul 2 $(a (dec a)))
17
32
18−Computes the result of `2^a`, producing an atom.
33+Examples
19−
34+--------
20−`a` is an [atom](atom).
21
35
22 ~zod/try=> (bex 4)
36 ~zod/try=> (bex 4)
23 16
37 16
@@ -32,15 +46,29 @@ Computes the result of `2^a`, producing an atom.
32
46
33Binary logarithm
47Binary logarithm
34
48
49+Computes the base-2 logarithm of `a`, producing an [atom]().
50+
51+Accepts
52+-------
53+
54+`a` is an atom.
55+
56+Produces
57+--------
58+
59+An atom.
60+
61+Source
62+------
63+
35 ++ xeb :: binary logarithm
64 ++ xeb :: binary logarithm
36 :: ~/ %xeb
65 :: ~/ %xeb
37 |= a=@
66 |= a=@
38 ^- @
67 ^- @
39 (met 0 a)
68 (met 0 a)
40
69
41−Computes the base-2 logarithm of `a`, producing an atom.
70+Examples
42−
71+--------
43−`a` is an [atom](atom).
44
72
45 ~zod/try=> (xeb 31)
73 ~zod/try=> (xeb 31)
46 5
74 5
@@ -61,6 +89,25 @@ Computes the base-2 logarithm of `a`, producing an atom.
61
89
62Assemble
90Assemble
63
91
92+Produces an [atom]() from a list `b` of length-value pairs `p` and `q`,
93+where `p` is the length in bloqs of size `a`, and `q` is an atomic
94+value.
95+
96+Accepts
97+-------
98+
99+`a` is a block size (see [`++bloq`]()).
100+
101+`b` is a [`++list`]() of length value pairs, `p` and `q`.
102+
103+Produces
104+--------
105+
106+An atom.
107+
108+Source
109+------
110+
64 ++ can :: assemble
111 ++ can :: assemble
65 ~/ %can
112 ~/ %can
66 |= [a=bloq b=(list ,[p=@ q=@])]
113 |= [a=bloq b=(list ,[p=@ q=@])]
@@ -68,13 +115,8 @@ Assemble
68 ?~ b 0
115 ?~ b 0
69 (mix (end a p.i.b q.i.b) (lsh a p.i.b $(b t.b)))
116 (mix (end a p.i.b q.i.b) (lsh a p.i.b $(b t.b)))
70
117
71−Produces an atom from a list `b` of length-value pairs `p` and `q`,
118+Examples
72−where `p` is the length in bloqs of size `a`, and `q` is an atomic
119+--------
73−value.
74−
75−`a` is a block size (see [++bloq]()).
76−
77−`b` is a [list](list) of length value pairs, `p` and `q`.
78
120
79 ~zod/try=> `@ub`(can 3 ~[[1 1]])
121 ~zod/try=> `@ub`(can 3 ~[[1 1]])
80 0b1
122 0b1
@@ -95,19 +137,33 @@ value.
95
137
96Concatenate
138Concatenate
97
139
140+Concatenates two [atom]()s, `b` and `c`, according to bloq size `a`, producing an
141+atom.
142+
143+Accepts
144+-------
145+
146+`a` is a block size (see [`++bloq`]()).
147+
148+`b` is an atom.
149+
150+`c` is an atom.
151+
152+Produces
153+--------
154+
155+An atom.
156+
157+Source
158+------
159+
98 ++ cat :: concatenate
160 ++ cat :: concatenate
99 ~/ %cat
161 ~/ %cat
100 |= [a=bloq b=@ c=@]
162 |= [a=bloq b=@ c=@]
101 (add (lsh a (met a b) c) b)
163 (add (lsh a (met a b) c) b)
102
164
103−Concatenates two atoms, `b` and `c`, using bloq size `a`, producing an
165+Examples
104−atom.
166+--------
105−
106−`a` is a block size (see [++bloq]()).
107−
108−`b` is an [atom]().
109−
110−`c` is an [atom]().
111
167
112 ~zod/try=> `@ub`(cat 3 1 0)
168 ~zod/try=> `@ub`(cat 3 1 0)
113 0b1
169 0b1
@@ -134,19 +190,32 @@ atom.
134
190
135Slice
191Slice
136
192
137− ++ cut :: slice
138− ~/ %cut
139− |= [a=bloq [b=@ c=@] d=@]
140− (end a c (rsh a b d))
141−
142Slices `c` blocks of size `a` that are `b` blocks from the end of `d`.
193Slices `c` blocks of size `a` that are `b` blocks from the end of `d`.
143−Produces an atom.
194+
195+Accepts
196+-------
144
197
145`a` is a block size (see [++bloq]()).
198`a` is a block size (see [++bloq]()).
146
199
147`b` is an [atom]().
200`b` is an [atom]().
148
201
149−`c` is an [atom]().
202+`c` is an atom.
203+
204+Produces
205+--------
206+
207+An atom.
208+
209+Source
210+------
211+
212+ ++ cut :: slice
213+ ~/ %cut
214+ |= [a=bloq [b=@ c=@] d=@]
215+ (end a c (rsh a b d))
216+
217+Examples
218+--------
150
219
151 ~zod/try=> (cut 0 [1 1] 2)
220 ~zod/try=> (cut 0 [1 1] 2)
152 1
221 1
@@ -171,19 +240,34 @@ Produces an atom.
171
240
172Tail
241Tail
173
242
174− ++ end :: tail
243+Produces an [atom]() by taking the last `b` blocks of size `a` from `c`.
175− ~/ %end
176− |= [a=bloq b=@ c=@]
177− (mod c (bex (mul (bex a) b)))
178
244
179−Produces an atom by taking the last `b` blocks of size `a` from `c`.
245+Accepts
246+-------
180
247
181−`a` is a block size (see [++bloq]()).
248+`a` is a block size (see [`++bloq`]()).
182
249
183−`b` is an [atom]().
250+`b` is an atom.
184
251
185`c` is an [atom]().
252`c` is an [atom]().
186
253
254+Produces
255+--------
256+
257+An atom.
258+
259+
260+Source
261+------
262+
263+ ++ end :: tail
264+ ~/ %end
265+ |= [a=bloq b=@ c=@]
266+ (mod c (bex (mul (bex a) b)))
267+
268+Examples
269+--------
270+
187 ~zod/try=> `@ub`12
271 ~zod/try=> `@ub`12
188 0b1100
272 0b1100
189 ~zod/try=> `@ub`(end 0 3 12)
273 ~zod/try=> `@ub`(end 0 3 12)
@@ -207,6 +291,25 @@ Produces an atom by taking the last `b` blocks of size `a` from `c`.
207
291
208Fill bloqstream
292Fill bloqstream
209
293
294+Produces an [atom]() by repeating `c` for `b` blocks of size `a`.
295+
296+Accepts
297+-------
298+
299+`a` is a block size (see [`++bloq`]()).
300+
301+`b` is an atom.
302+
303+`c` is an [atom]().
304+
305+Produces
306+--------
307+
308+An atom.
309+
310+Source
311+------
312+
210 ++ fil :: fill bloqstream
313 ++ fil :: fill bloqstream
211 |= [a=bloq b=@ c=@]
314 |= [a=bloq b=@ c=@]
212 =+ n=0
315 =+ n=0
@@ -216,13 +319,8 @@ Fill bloqstream
216 (rsh a 1 d)
319 (rsh a 1 d)
217 $(d (add c (lsh a 1 d)), n +(n))
320 $(d (add c (lsh a 1 d)), n +(n))
218
321
219−Produces an atom by repeating `c` for `b` blocks of size `a`.
322+Examples
220−
323+--------
221−`a` is a block size (see [++bloq]()).
222−
223−`b` is an [atom]().
224−
225−`c` is an [atom]().
226
324
227 ~zod/try=> `@t`(fil 3 5 %a)
325 ~zod/try=> `@t`(fil 3 5 %a)
228 'aaaaa'
326 'aaaaa'
@@ -239,18 +337,32 @@ Produces an atom by repeating `c` for `b` blocks of size `a`.
239
337
240Left-shift
338Left-shift
241
339
340+Produces an [atom]() by left-shifting `c` by `b` blocks of size `a`.
341+
342+Accepts
343+-------
344+
345+`a` is a block size (see [`++bloq`]()).
346+
347+`b` is an atom.
348+
349+`c` is an atom.
350+
351+Produces
352+--------
353+
354+An atom.
355+
356+Source
357+------
358+
242 ++ lsh :: left-shift
359 ++ lsh :: left-shift
243 ~/ %lsh
360 ~/ %lsh
244 |= [a=bloq b=@ c=@]
361 |= [a=bloq b=@ c=@]
245 (mul (bex (mul (bex a) b)) c)
362 (mul (bex (mul (bex a) b)) c)
246
363
247−Produces an atom by left-shifting `c` by `b` blocks of size `a`.
364+Examples
248−
365+--------
249−`a` is a block size (see [++bloq]()).
250−
251−`b` is an [atom]().
252−
253−`c` is an [atom]().
254
366
255 ~zod/try=> `@ub`1
367 ~zod/try=> `@ub`1
256 0b1
368 0b1
@@ -267,10 +379,19 @@ Produces an atom by left-shifting `c` by `b` blocks of size `a`.
267
379
268------------------------------------------------------------------------
380------------------------------------------------------------------------
269
381
270−### `++met`
382+### `++me
271
383
272Measure
384Measure
273
385
386+Computes the number of blocks of size `a` in `b`, producing an [atom]().
387+
388+`a` is a block size (see [`++bloq`]()).
389+
390+`b` is an atom.
391+
392+Source
393+------
394+
274 ++ met :: measure
395 ++ met :: measure
275 ~/ %met
396 ~/ %met
276 |= [a=bloq b=@]
397 |= [a=bloq b=@]
@@ -280,11 +401,8 @@ Measure
280 ?: =(0 b) c
401 ?: =(0 b) c
281 $(b (rsh a 1 b), c +(c))
402 $(b (rsh a 1 b), c +(c))
282
403
283−Computes the number of blocks of size `a` in `b`, producing an atom.
404+Examples
284−
405+--------
285−`a` is a block size (see [++bloq]()).
286−
287−`b` is an [atom]().
288
406
289 ~zod/try=> (met 0 1)
407 ~zod/try=> (met 0 1)
290 1
408 1
@@ -303,6 +421,23 @@ Computes the number of blocks of size `a` in `b`, producing an atom.
303
421
304Assemble non-zero
422Assemble non-zero
305
423
424+Concatenates a list of [atom]()s `b` using blocksize `a`, producing an atom.
425+
426+Accepts
427+-------
428+
429+`a` is a block size (see [`++bloq`]()).
430+
431+`b` is a [`++list`]() of [atom]()s.
432+
433+Produces
434+--------
435+
436+An atom.
437+
438+Source
439+------
440+
306 ++ rap :: assemble nonzero
441 ++ rap :: assemble nonzero
307 ~/ %rap
442 ~/ %rap
308 |= [a=bloq b=(list ,@)]
443 |= [a=bloq b=(list ,@)]
@@ -310,11 +445,8 @@ Assemble non-zero
310 ?~ b 0
445 ?~ b 0
311 (cat a i.b $(b t.b))
446 (cat a i.b $(b t.b))
312
447
313−Concatenate a list of atoms `b` using blocksize `a`, producing an atom.
448+Examples
314−
449+--------
315−`a` is a block size (see [++bloq]()).
316−
317−`b` is a [list]() of [atoms]().
318
450
319 ~zod/try=> `@ub`(rap 2 (limo [1 2 3 4 ~]))
451 ~zod/try=> `@ub`(rap 2 (limo [1 2 3 4 ~]))
320 0b100.0011.0010.0001
452 0b100.0011.0010.0001
@@ -331,6 +463,23 @@ Concatenate a list of atoms `b` using blocksize `a`, producing an atom.
331
463
332Assemble single
464Assemble single
333
465
466+Produces an [atom]() by assembling a list of atoms `b` using block size `a`.
467+
468+Accepts
469+-------
470+
471+`a` is a block size (see [`++bloq`]()).
472+
473+`b` is a list of atoms.
474+
475+Produces
476+--------
477+
478+An atom.
479+
480+Source
481+------
482+
334 ++ rep :: assemble single
483 ++ rep :: assemble single
335 ~/ %rep
484 ~/ %rep
336 |= [a=bloq b=(list ,@)]
485 |= [a=bloq b=(list ,@)]
@@ -340,11 +489,8 @@ Assemble single
340 ?~ b 0
489 ?~ b 0
341 (con (lsh a c (end a 1 i.b)) $(c +(c), b t.b))
490 (con (lsh a c (end a 1 i.b)) $(c +(c), b t.b))
342
491
343−Produces an atom by assembling a list of atoms `b` using block size `a`.
492+Examples
344−
493+--------
345−`a` is a block size (see [++bloq]()).
346−
347−`b` is a list of [atoms]().
348
494
349 ~zod/try=> `@ub`(rep 2 (limo [1 2 3 4 ~]))
495 ~zod/try=> `@ub`(rep 2 (limo [1 2 3 4 ~]))
350 0b100.0011.0010.0001
496 0b100.0011.0010.0001
@@ -367,6 +513,23 @@ Produces an atom by assembling a list of atoms `b` using block size `a`.
367
513
368Disassemble
514Disassemble
369
515
516+Produces a list of [atom]()s from the bits of `b` using block size `a`.
517+
518+Accepts
519+-------
520+
521+`a` is a block size (see [`++bloq`]()).
522+
523+`b` is an atom.
524+
525+Produces
526+--------
527+
528+A list of atoms.
529+
530+Source
531+------
532+
370 ++ rip :: disassemble
533 ++ rip :: disassemble
371 ~/ %rip
534 ~/ %rip
372 |= [a=bloq b=@]
535 |= [a=bloq b=@]
@@ -374,11 +537,8 @@ Disassemble
374 ?: =(0 b) ~
537 ?: =(0 b) ~
375 [(end a 1 b) $(b (rsh a 1 b))]
538 [(end a 1 b) $(b (rsh a 1 b))]
376
539
377−Produces a list of atoms from the bits of `b` using block size `a`.
540+Examples
378−
541+--------
379−`a` is a block size (see [++bloq]()).
380−
381−`b` is an [atom]().
382
542
383 ~zod/try=> `@ub`155
543 ~zod/try=> `@ub`155
384 0b1001.1011
544 0b1001.1011
@@ -403,18 +563,32 @@ Produces a list of atoms from the bits of `b` using block size `a`.
403
563
404Right-shift
564Right-shift
405
565
566+Right-shifts `c` by `b` blocks of size `a`, producing an [atom]().
567+
568+Accepts
569+-------
570+
571+`a` is a block size (see [`++bloq`]()).
572+
573+`b` is an atom.
574+
575+`c` is an atom.
576+
577+Produces
578+--------
579+
580+An atom.
581+
582+Source
583+------
584+
406 ++ rsh :: right-shift
585 ++ rsh :: right-shift
407 ~/ %rsh
586 ~/ %rsh
408 |= [a=bloq b=@ c=@]
587 |= [a=bloq b=@ c=@]
409 (div c (bex (mul (bex a) b)))
588 (div c (bex (mul (bex a) b)))
410
589
411−Right-shifts `c` by `b` blocks of size `a`, producing an atom.
590+Examples
412−
591+--------
413−`a` is a block size (see [++bloq]()).
414−
415−`b` is an [atom]().
416−
417−`c` is an [atom]().
418
592
419 ~zod/try=> `@ub`145
593 ~zod/try=> `@ub`145
420 0b1001.0001
594 0b1001.0001
@@ -445,14 +619,29 @@ Right-shifts `c` by `b` blocks of size `a`, producing an atom.
445
619
446Reverse block order
620Reverse block order
447
621
448− ++ swap |=([a=bloq b=@] (rep a (flop (rip a b)))) :: reverse bloq order
449−
450−Switches little ending to big and vice versa: produces an atom by
622+Switches little endian to big and vice versa: produces an [atom]() by
451reversing the block order of `b` using block size `a`.
623reversing the block order of `b` using block size `a`.
452
624
453−`a` is a block size (see [++bloq]()).
454
625
626+Accepts
627+-------
628+
629+`a` is a block size (see [`++bloq`]()).
630+
455−`b` is an [atom]()
631+`b` is an atom.
632+
633+Produces
634+--------
635+
636+An atom
637+
638+Source
639+------
640+
641+ ++ swap |=([a=bloq b=@] (rep a (flop (rip a b)))) :: reverse bloq order
642+
643+Examples
644+--------
456
645
457 ~zod/try=> `@ub`24
646 ~zod/try=> `@ub`24
458 0b1.1000
647 0b1.1000
@@ -474,6 +663,24 @@ section 2cB, bit logic
474
663
475Binary OR
664Binary OR
476
665
666+Computes the bit-wise logical OR of two [atom]()s, `a` and `b`, producing an
667+atom.
668+
669+Accepts
670+-------
671+
672+`a` is an atom
673+
674+`b` is an atom
675+
676+Produces
677+--------
678+
679+An atom.
680+
681+Source
682+------
683+
477 ++ con :: binary or
684 ++ con :: binary or
478 ~/ %con
685 ~/ %con
479 |= [a=@ b=@]
686 |= [a=@ b=@]
@@ -491,12 +698,8 @@ Binary OR
491 ==
698 ==
492 ==
699 ==
493
700
494−Computes the bit-wise logical OR of two atoms, `a` and `b`, producing an
701+Examples
495−atom.
702+--------
496−
497−`a` is an [atom]()
498−
499−`b` is an [atom]()
500
703
501 ~zod/try=> (con 0b0 0b1)
704 ~zod/try=> (con 0b0 0b1)
502 1
705 1
@@ -517,6 +720,24 @@ atom.
517
720
518Binary AND
721Binary AND
519
722
723+Computes the bit-wise logical AND of two [atom]()s `a` and `b`, producing an
724+atom.
725+
726+Accepts
727+-------
728+
729+`a` is an atom.
730+
731+`b` is an atom.
732+
733+Produces
734+--------
735+
736+An atom.
737+
738+Source
739+------
740+
520 ++ dis :: binary and
741 ++ dis :: binary and
521 ~/ %dis
742 ~/ %dis
522 |= [a=@ b=@]
743 |= [a=@ b=@]
@@ -534,12 +755,8 @@ Binary AND
534 ==
755 ==
535 ==
756 ==
536
757
537−Computes the bit-wise logical AND of two atoms `a` and `b`, producing an
758+Examples
538−atom.
759+--------
539−
540−`a` is an [atom]()
541−
542−`b` is an [atom]()
543
760
544 ~zod/try=> `@ub`9
761 ~zod/try=> `@ub`9
545 0b1001
762 0b1001
@@ -564,6 +781,23 @@ atom.
564
781
565Binary XOR
782Binary XOR
566
783
784+Produces the bit-wise logical XOR of `a` and `b`, producing an [atom]().
785+
786+Accepts
787+-------
788+
789+`a` is an atom
790+
791+`b` is an atom
792+
793+Produces
794+--------
795+
796+An atom.
797+
798+Source
799+------
800+
567 ++ mix :: binary xor
801 ++ mix :: binary xor
568 ~/ %mix
802 ~/ %mix
569 |= [a=@ b=@]
803 |= [a=@ b=@]
@@ -578,11 +812,8 @@ Binary XOR
578 d (add d (lsh 0 c =((end 0 1 a) (end 0 1 b))))
812 d (add d (lsh 0 c =((end 0 1 a) (end 0 1 b))))
579 ==
813 ==
580
814
581−Produces the bit-wise logical XOR of `a` and `b`, producing an atom.
815+Examples
582−
816+--------
583−`a` is an [atom]()
584−
585−`b` is an [atom]()
586
817
587 ~zod/try=> `@ub`2
818 ~zod/try=> `@ub`2
588 0b10
819 0b10
@@ -603,17 +834,31 @@ Produces the bit-wise logical XOR of `a` and `b`, producing an atom.
603
834
604Binary NOT
835Binary NOT
605
836
606− ++ not |= [a=bloq b=@ c=@] :: binary not (sized)
607− (mix c (dec (bex (mul b (bex a)))))
608−
609Computes the bit-wise logical NOT of the bottom `b` blocks of size `a`
837Computes the bit-wise logical NOT of the bottom `b` blocks of size `a`
610of `c`.
838of `c`.
611
839
840+Accepts
841+-------
842+
612−`a` is a block size (see [++bloq]()).
843+`a` is a block size (see [`++bloq`]()).
613
844
614`b` is an [atom]().
845`b` is an [atom]().
615
846
616−`c` is an [atom]().
847+`c` is an atom.
848+
849+Produces
850+--------
851+
852+An atom.
853+
854+Source
855+------
856+
857+ ++ not |= [a=bloq b=@ c=@] :: binary not (sized)
858+ (mix c (dec (bex (mul b (bex a)))))
859+
860+Examples
861+--------
617
862
618 ~zod/try=> `@ub`24
863 ~zod/try=> `@ub`24
619 0b1.1000
864 0b1.1000
@@ -637,6 +882,25 @@ section 2cC, noun orders
637
882
638Alphabetic order
883Alphabetic order
639
884
885+Computes whether `a` and `b` are in alphabetical order, producing a
886+boolean.
887+
888+Accepts
889+-------
890+
891+`a` is a [noun]().
892+
893+`b` is a noun.
894+
895+Produces
896+--------
897+
898+A boolean atom.
899+
900+
901+Source
902+------
903+
640 ++ aor :: alphabetic-order
904 ++ aor :: alphabetic-order
641 ~/ %aor
905 ~/ %aor
642 |= [a=* b=*]
906 |= [a=* b=*]
@@ -654,12 +918,8 @@ Alphabetic order
654 $(a (rsh 3 1 a), b (rsh 3 1 b))
918 $(a (rsh 3 1 a), b (rsh 3 1 b))
655 (lth c d)
919 (lth c d)
656
920
657−Computes whether `a` and `b` are in alphabetical order, producing a
921+Examples
658−loobean.
922+--------
659−
660−`a` is a [noun]().
661−
662−`b` is a [noun]().
663
923
664 ~zod/try=> (aor 'a' 'b')
924 ~zod/try=> (aor 'a' 'b')
665 %.y
925 %.y
@@ -684,6 +944,24 @@ loobean.
684
944
685Numeric order
945Numeric order
686
946
947+Computes whether `a` and `b` are in ascending numeric order, producing a
948+boolean.
949+
950+Accepts
951+-------
952+
953+`a` is a [noun]().
954+
955+`b` is a noun.
956+
957+Produces
958+--------
959+
960+A boolean atom.
961+
962+Source
963+------
964+
687 ++ dor :: d-order
965 ++ dor :: d-order
688 ~/ %dor
966 ~/ %dor
689 |= [a=* b=*]
967 |= [a=* b=*]
@@ -697,12 +975,8 @@ Numeric order
697 ?. ?=(@ b) &
975 ?. ?=(@ b) &
698 (lth a b)
976 (lth a b)
699
977
700−Computes whether `a` and `b` are in ascending numeric order, producing a
978+Examples
701−loobean.
979+--------
702−
703−`a` is a [noun]().
704−
705−`b` is a [noun]().
706
980
707 ~zod/try=> (dor 1 2)
981 ~zod/try=> (dor 1 2)
708 %.y
982 %.y
@@ -723,6 +997,23 @@ loobean.
723
997
724Hash order
998Hash order
725
999
1000+XX revisit
1001+
1002+Accepts
1003+-------
1004+
1005+`a` is a [noun]().
1006+
1007+`b` is a noun.
1008+
1009+Produces
1010+--------
1011+
1012+A boolean [atom]().
1013+
1014+Source
1015+------
1016+
726 ++ gor :: g-order
1017 ++ gor :: g-order
727 ~/ %gor
1018 ~/ %gor
728 |= [a=* b=*]
1019 |= [a=* b=*]
@@ -732,7 +1023,8 @@ Hash order
732 (dor a b)
1023 (dor a b)
733 (lth c d)
1024 (lth c d)
734
1025
735−XX revisit
1026+Examples
1027+--------
736
1028
737 ~zod/try=> (gor 'd' 'c')
1029 ~zod/try=> (gor 'd' 'c')
738 %.y
1030 %.y
@@ -762,6 +1054,26 @@ XX revisit
762
1054
763Hash order
1055Hash order
764
1056
1057+XX revisit
1058+
1059+Recursive hash comparator gate.
1060+
1061+Accepts
1062+-------
1063+
1064+`a` is a [noun]().
1065+
1066+`b` is a noun.
1067+
1068+Produces
1069+--------
1070+
1071+A boolean [atom]().
1072+
1073+
1074+Source
1075+------
1076+
765 ++ hor :: h-order
1077 ++ hor :: h-order
766 ~/ %hor
1078 ~/ %hor
767 |= [a=* b=*]
1079 |= [a=* b=*]
@@ -774,9 +1086,8 @@ Hash order
774 (gor +.a +.b)
1086 (gor +.a +.b)
775 (gor -.a -.b)
1087 (gor -.a -.b)
776
1088
777−XX revisit
1089+Examples
778−
1090+--------
779−Recursive hash comparator gate.
780
1091
781 ~zod/try=> (hor . 1)
1092 ~zod/try=> (hor . 1)
782 %.n
1093 %.n
@@ -791,6 +1102,23 @@ Recursive hash comparator gate.
791
1102
792### `++vor`
1103### `++vor`
793
1104
1105+Double hash comparator gate.
1106+
1107+XX revisit
1108+
1109+Accepts
1110+-------
1111+
1112+`a` is a [noun]()
1113+
1114+`b` is a noun
1115+
1116+Produces
1117+-------
1118+
1119+Source
1120+------
1121+
794 ++ vor :: v-order
1122 ++ vor :: v-order
795 ~/ %vor
1123 ~/ %vor
796 |= [a=* b=*]
1124 |= [a=* b=*]
@@ -800,9 +1128,8 @@ Recursive hash comparator gate.
800 (dor a b)
1128 (dor a b)
801 (lth c d)
1129 (lth c d)
802
1130
803−XX revisit
1131+Examples
804−
1132+--------
805−Double hash comparator gate.
806
1133
807 ~zod/try=> (vor 'f' 'g')
1134 ~zod/try=> (vor 'f' 'g')
808 %.y
1135 %.y
@@ -816,13 +1143,28 @@ section 2cD, insecure hashing
816
1143
817### `++fnv`
1144### `++fnv`
818
1145
819− ++ fnv |=(a=@ (end 5 1 (mul 16.777.619 a))) :: FNV scrambler
820−
821Hashes an atom with the 32-bit FNV non-cryptographic hash algorithm.
1146Hashes an atom with the 32-bit FNV non-cryptographic hash algorithm.
822Multiplies `a` by the prime number 16,777,619 and then takes the block
1147Multiplies `a` by the prime number 16,777,619 and then takes the block
823−of size 5 off the product's end, producing atom.
1148+of size 5 off the product's end, producing an [atom]().
824
1149
1150+Accepts
1151+-------
1152+
825−`a` is an [atom]().
1153+`a` is an atom.
1154+
1155+Produces
1156+--------
1157+
1158+An atom.
1159+
1160+
1161+Source
1162+------
1163+
1164+ ++ fnv |=(a=@ (end 5 1 (mul 16.777.619 a))) :: FNV scrambler
1165+
1166+Examples
1167+--------
826
1168
827 ~zod/try=> (fnv 10.000)
1169 ~zod/try=> (fnv 10.000)
828 272.465.456
1170 272.465.456
@@ -835,6 +1177,17 @@ of size 5 off the product's end, producing atom.
835
1177
836### `++mum`
1178### `++mum`
837
1179
1180+XX document
1181+
1182+Accepts
1183+-------
1184+
1185+Produces
1186+--------
1187+
1188+Source
1189+------
1190+
838 ++ mum :: mug with murmur3
1191 ++ mum :: mug with murmur3
839 ~/ %mum
1192 ~/ %mum
840 |= a=*
1193 |= a=*
@@ -876,7 +1229,8 @@ of size 5 off the product's end, producing atom.
876 --
1229 --
877 ::
1230 ::
878
1231
879−XX document
1232+Examples
1233+--------
880
1234
881 ~zod/try=> (mum 10.000)
1235 ~zod/try=> (mum 10.000)
882 1.232.632.901
1236 1.232.632.901
@@ -891,6 +1245,22 @@ XX document
891
1245
892### `++mug`
1246### `++mug`
893
1247
1248+Hashes `a` with the 31-bit nonzero FNV-1a non-cryptographic hash
1249+algorithm, producing an [atom]().
1250+
1251+Accepts
1252+-------
1253+
1254+A is a [noun]().
1255+
1256+Produces
1257+--------
1258+
1259+An atom.
1260+
1261+Source
1262+------
1263+
894 ++ mug :: 31bit nonzero FNV1a
1264 ++ mug :: 31bit nonzero FNV1a
895 ~/ %mug
1265 ~/ %mug
896 |= a=*
1266 |= a=*
@@ -912,8 +1282,8 @@ XX document
912 ^$(b +(b))
1282 ^$(b +(b))
913 $(c (fnv (mix c (cut 3 [d 1] a))), d +(d))
1283 $(c (fnv (mix c (cut 3 [d 1] a))), d +(d))
914
1284
915−Hashes `a` with the 31-bit nonzero FNV-1a non-cryptographic hash
1285+Examples
916−algorithm, producing an atom.
1286+--------
917
1287
918 ~zod/try=> (mug 10.000)
1288 ~zod/try=> (mug 10.000)
919 178.152.889
1289 178.152.889
@@ -931,43 +1301,43 @@ section 2cE, phonetic base
931
1301
932### `++po`
1302### `++po`
933
1303
934− ++ po
1304+++ po
935− ~/ %po
1305+ ~/ %po
936− =+ :- ^= sis :: prefix syllables
1306+ =+ :- ^= sis :: prefix syllables
937− 'dozmarbinwansamlitsighidfidlissogdirwacsabwissib\
1307+ 'dozmarbinwansamlitsighidfidlissogdirwacsabwissib\
938− /rigsoldopmodfoglidhopdardorlorhodfolrintogsilmir\
1308+ /rigsoldopmodfoglidhopdardorlorhodfolrintogsilmir\
939− /holpaslacrovlivdalsatlibtabhanticpidtorbolfosdot\
1309+ /holpaslacrovlivdalsatlibtabhanticpidtorbolfosdot\
940− /losdilforpilramtirwintadbicdifrocwidbisdasmidlop\
1310+ /losdilforpilramtirwintadbicdifrocwidbisdasmidlop\
941− /rilnardapmolsanlocnovsitnidtipsicropwitnatpanmin\
1311+ /rilnardapmolsanlocnovsitnidtipsicropwitnatpanmin\
942− /ritpodmottamtolsavposnapnopsomfinfonbanporworsip\
1312+ /ritpodmottamtolsavposnapnopsomfinfonbanporworsip\
943− /ronnorbotwicsocwatdolmagpicdavbidbaltimtasmallig\
1313+ /ronnorbotwicsocwatdolmagpicdavbidbaltimtasmallig\
944− /sivtagpadsaldivdactansidfabtarmonranniswolmispal\
1314+ /sivtagpadsaldivdactansidfabtarmonranniswolmispal\
945− /lasdismaprabtobrollatlonnodnavfignomnibpagsopral\
1315+ /lasdismaprabtobrollatlonnodnavfignomnibpagsopral\
946− /bilhaddocridmocpacravripfaltodtiltinhapmicfanpat\
1316+ /bilhaddocridmocpacravripfaltodtiltinhapmicfanpat\
947− /taclabmogsimsonpinlomrictapfirhasbosbatpochactid\
1317+ /taclabmogsimsonpinlomrictapfirhasbosbatpochactid\
948− /havsaplindibhosdabbitbarracparloddosbortochilmac\
1318+ /havsaplindibhosdabbitbarracparloddosbortochilmac\
949− /tomdigfilfasmithobharmighinradmashalraglagfadtop\
1319+ /tomdigfilfasmithobharmighinradmashalraglagfadtop\
950− /mophabnilnosmilfopfamdatnoldinhatnacrisfotribhoc\
1320+ /mophabnilnosmilfopfamdatnoldinhatnacrisfotribhoc\
951− /nimlarfitwalrapsarnalmoslandondanladdovrivbacpol\
1321+ /nimlarfitwalrapsarnalmoslandondanladdovrivbacpol\
952− /laptalpitnambonrostonfodponsovnocsorlavmatmipfap'
1322+ /laptalpitnambonrostonfodponsovnocsorlavmatmipfap'
953− ^= dex :: suffix syllables
1323+ ^= dex :: suffix syllables
954− 'zodnecbudwessevpersutletfulpensytdurwepserwylsun\
1324+ 'zodnecbudwessevpersutletfulpensytdurwepserwylsun\
955− /rypsyxdyrnuphebpeglupdepdysputlughecryttyvsydnex\
1325+ /rypsyxdyrnuphebpeglupdepdysputlughecryttyvsydnex\
956− /lunmeplutseppesdelsulpedtemledtulmetwenbynhexfeb\
1326+ /lunmeplutseppesdelsulpedtemledtulmetwenbynhexfeb\
957− /pyldulhetmevruttylwydtepbesdexsefwycburderneppur\
1327+ /pyldulhetmevruttylwydtepbesdexsefwycburderneppur\
958− /rysrebdennutsubpetrulsynregtydsupsemwynrecmegnet\
1328+ /rysrebdennutsubpetrulsynregtydsupsemwynrecmegnet\
959− /secmulnymtevwebsummutnyxrextebfushepbenmuswyxsym\
1329+ /secmulnymtevwebsummutnyxrextebfushepbenmuswyxsym\
960− /selrucdecwexsyrwetdylmynmesdetbetbeltuxtugmyrpel\
1330+ /selrucdecwexsyrwetdylmynmesdetbetbeltuxtugmyrpel\
961− /syptermebsetdutdegtexsurfeltudnuxruxrenwytnubmed\
1331+ /syptermebsetdutdegtexsurfeltudnuxruxrenwytnubmed\
962− /lytdusnebrumtynseglyxpunresredfunrevrefmectedrus\
1332+ /lytdusnebrumtynseglyxpunresredfunrevrefmectedrus\
963− /bexlebduxrynnumpyxrygryxfeptyrtustyclegnemfermer\
1333+ /bexlebduxrynnumpyxrygryxfeptyrtustyclegnemfermer\
964− /tenlusnussyltecmexpubrymtucfyllepdebbermughuttun\
1334+ /tenlusnussyltecmexpubrymtucfyllepdebbermughuttun\
965− /bylsudpemdevlurdefbusbeprunmelpexdytbyttyplevmyl\
1335+ /bylsudpemdevlurdefbusbeprunmelpexdytbyttyplevmyl\
966− /wedducfurfexnulluclennerlexrupnedlecrydlydfenwel\
1336+ /wedducfurfexnulluclennerlexrupnedlecrydlydfenwel\
967− /nydhusrelrudneshesfetdesretdunlernyrsebhulryllud\
1337+ /nydhusrelrudneshesfetdesretdunlernyrsebhulryllud\
968− /remlysfynwerrycsugnysnyllyndyndemluxfedsedbecmun\
1338+ /remlysfynwerrycsugnysnyllyndyndemluxfedsedbecmun\
969− /lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes'
1339+ /lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes'
970− |%
1340+ |%
971
1341
972Provides the phonetic syllables and name generators for the Urbit naming
1342Provides the phonetic syllables and name generators for the Urbit naming
973system. The two faces, `sis` and `dex` are available to the arms
1343system. The two faces, `sis` and `dex` are available to the arms
@@ -979,15 +1349,29 @@ contained in this section.
979
1349
980Parse prefix
1350Parse prefix
981
1351
1352+Produces the byte of the right-hand syllable `a`.
1353+
1354+Accepts
1355+-------
1356+
1357+`a` is an [atom]().
1358+
1359+Produces
1360+--------
1361+
1362+A [`++unit`]() of an atom.
1363+
1364+Source
1365+------
1366+
982 ++ ind ~/ %ind :: parse prefix
1367 ++ ind ~/ %ind :: parse prefix
983 |= a=@
1368 |= a=@
984 =+ b=0
1369 =+ b=0
985 |- ^- (unit ,@)
1370 |- ^- (unit ,@)
986 ?:(=(256 b) ~ ?:(=(a (tod b)) [~ b] $(b +(b))))
1371 ?:(=(256 b) ~ ?:(=(a (tod b)) [~ b] $(b +(b))))
987
1372
988−Produces the byte of the right-hand syllable `a`.
1373+Examples
989−
1374+--------
990−`a` is an [atom]().
991
1375
992 ~zod/try=> (ind:po 'zod')
1376 ~zod/try=> (ind:po 'zod')
993 [~ 0]
1377 [~ 0]
@@ -1002,15 +1386,28 @@ Produces the byte of the right-hand syllable `a`.
1002
1386
1003Parse suffix
1387Parse suffix
1004
1388
1389+Produces the byte of the left-hand phonetic syllable `b`.
1390+
1391+Accepts
1392+-------
1393+
1394+`a` is an [atom]().
1395+
1396+Produces
1397+--------
1398+A [`++unit`]() of an atom.
1399+
1400+Source
1401+------
1402+
1005 ++ ins ~/ %ins :: parse suffix
1403 ++ ins ~/ %ins :: parse suffix
1006 |= a=@
1404 |= a=@
1007 =+ b=0
1405 =+ b=0
1008 |- ^- (unit ,@)
1406 |- ^- (unit ,@)
1009 ?:(=(256 b) ~ ?:(=(a (tos b)) [~ b] $(b +(b))))
1407 ?:(=(256 b) ~ ?:(=(a (tos b)) [~ b] $(b +(b))))
1010
1408
1011−Produces the byte of the left-hand phonetic syllable `b`.
1409+Examples
1012−
1410+--------
1013−`a` is an [atom]().
1014
1411
1015 ~zod/try=> (ins:po 'mar')
1412 ~zod/try=> (ins:po 'mar')
1016 [~ 1]
1413 [~ 1]
@@ -1027,13 +1424,28 @@ Produces the byte of the left-hand phonetic syllable `b`.
1027
1424
1028Fetch prefix
1425Fetch prefix
1029
1426
1427+Produces the phonetic prefix syllable from index `a` within `dex` as an
1428+[atom]().
1429+
1430+Accepts
1431+-------
1432+
1433+`a` is an atom
1434+
1435+Produces
1436+--------
1437+
1438+An atom.
1439+
1440+
1441+Source
1442+------
1443+
1030 ++ tod ~/ %tod :: fetch prefix
1444 ++ tod ~/ %tod :: fetch prefix
1031 |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] dex)))
1445 |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] dex)))
1032
1446
1033−Produces the phonetic prefix syllable from index `a` within `dex` as an
1447+Examples
1034−atom.
1448+--------
1035−
1036−`a` is an [atom]()
1037
1449
1038 ~zod/try=> `@t`(tod:po 1)
1450 ~zod/try=> `@t`(tod:po 1)
1039 'nec'
1451 'nec'
@@ -1054,11 +1466,27 @@ atom.
1054
1466
1055Fetch suffix
1467Fetch suffix
1056
1468
1469+Produces the phonetic prefix syllable from index `a` within `sis` as an
1470+[atom]().
1471+
1472+Accepts
1473+-------
1474+
1475+`a` is an atom.
1476+
1477+Produces
1478+--------
1479+
1480+An atom.
1481+
1482+Source
1483+------
1484+
1057 ++ tos ~/ %tos :: fetch suffix
1485 ++ tos ~/ %tos :: fetch suffix
1058 |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] sis)))
1486 |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] sis)))
1059
1487
1060−Produces the phonetic prefix syllable from index `a` within `sis` as an
1488+Examples
1061−atom.
1489+--------
1062
1490
1063 ~zod/try=> `@t`(tos:po 0)
1491 ~zod/try=> `@t`(tos:po 0)
1064 'doz'
1492 'doz'
@@ -1079,17 +1507,33 @@ section 2cF, signed and modular ints
1079 ++ si !: :: signed integer
1507 ++ si !: :: signed integer
1080 |%
1508 |%
1081
1509
1082−Container for the signed integer functions.
1510+Container core for the signed integer functions.
1083
1511
1084------------------------------------------------------------------------
1512------------------------------------------------------------------------
1085
1513
1086### `++abs`
1514### `++abs`
1087
1515
1088− ++ abs |=(a=@s (add (end 0 1 a) (rsh 0 1 a))) :: absolute value
1516+Absolute value
1089
1517
1090Produces the absolute value of a signed integer.
1518Produces the absolute value of a signed integer.
1091
1519
1520+Accepts
1521+-------
1522+
1092−`a` is a signed integer, `@s`.
1523+`a` is a signed integer, [`@s`]().
1524+
1525+Produces
1526+--------
1527+
1528+An [atom]().
1529+
1530+Source
1531+------
1532+
1533+ ++ abs |=(a=@s (add (end 0 1 a) (rsh 0 1 a))) :: absolute value
1534+
1535+Examples
1536+--------
1093
1537
1094 ~zod/try=> (abs:si -2)
1538 ~zod/try=> (abs:si -2)
1095 2
1539 2
@@ -1102,15 +1546,32 @@ Produces the absolute value of a signed integer.
1102
1546
1103### `++dif`
1547### `++dif`
1104
1548
1105− ++ dif |= [a=@s b=@s] :: subtraction
1549+Difference
1106− (sum a (new !(syn b) (abs b)))
1107
1550
1108Produces the difference between two signed integers `b` and `c`.
1551Produces the difference between two signed integers `b` and `c`.
1109
1552
1553+Accepts
1554+-------
1555+
1110−`a` is a signed integer, `@s`.
1556+`a` is a signed integer, [`@s`]().
1111
1557
1112`b` is a signed integer, `@s`.
1558`b` is a signed integer, `@s`.
1113
1559
1560+Produces
1561+--------
1562+
1563+A [`@s`]().
1564+
1565+
1566+Source
1567+------
1568+
1569+ ++ dif |= [a=@s b=@s] :: subtraction
1570+ (sum a (new !(syn b) (abs b)))
1571+
1572+Examples
1573+--------
1574+
1114 ~zod/try=> (dif:si --10 -7)
1575 ~zod/try=> (dif:si --10 -7)
1115 --17
1576 --17
1116 ~zod/try=> (dif:si --10 --7)
1577 ~zod/try=> (dif:si --10 --7)
@@ -1124,15 +1585,31 @@ Produces the difference between two signed integers `b` and `c`.
1124
1585
1125### `++dul`
1586### `++dul`
1126
1587
1127− ++ dul |= [a=@s b=@] :: modulus
1588+Modulus
1128− =+(c=(old a) ?:(-.c (mod +.c b) (sub b +.c)))
1129
1589
1130Produces the modulus of two signed integers.
1590Produces the modulus of two signed integers.
1131
1591
1592+Accepts
1593+-------
1594+
1132`a` is a signed integer, `@s`.
1595`a` is a signed integer, `@s`.
1133
1596
1134`b` is an [atom]().
1597`b` is an [atom]().
1135
1598
1599+Produces
1600+--------
1601+
1602+An atom.
1603+
1604+Source
1605+------
1606+
1607+ ++ dul |= [a=@s b=@] :: modulus
1608+ =+(c=(old a) ?:(-.c (mod +.c b) (sub b +.c)))
1609+
1610+Examples
1611+--------
1612+
1136 ~zod/try=> (dul:si --9 3)
1613 ~zod/try=> (dul:si --9 3)
1137 0
1614 0
1138 ~zod/try=> (dul:si --9 4)
1615 ~zod/try=> (dul:si --9 4)
@@ -1148,15 +1625,31 @@ Produces the modulus of two signed integers.
1148
1625
1149### `++fra`
1626### `++fra`
1150
1627
1151− ++ fra |= [a=@s b=@s] :: divide
1628+Divide
1152− (new =(0 (mix (syn a) (syn b))) (div (abs a) (abs b)))
1153
1629
1154Produces the quotient of two signed integers.
1630Produces the quotient of two signed integers.
1155
1631
1632+Accepts
1633+-------
1634+
1156−`a` is a signed integer, `@s`.
1635+`a` is a signed integer, [`@s`].
1157
1636
1158`b` is a signed integer, `@s`.
1637`b` is a signed integer, `@s`.
1159
1638
1639+Produces
1640+--------
1641+
1642+An [atom]().
1643+
1644+Source
1645+------
1646+
1647+ ++ fra |= [a=@s b=@s] :: divide
1648+ (new =(0 (mix (syn a) (syn b))) (div (abs a) (abs b)))
1649+
1650+Examples
1651+--------
1652+
1160 ~zod/try=> (fra:si --10 -2)
1653 ~zod/try=> (fra:si --10 -2)
1161 -5
1654 -5
1162 ~zod/try=> (fra:si -20 -5)
1655 ~zod/try=> (fra:si -20 -5)
@@ -1166,14 +1659,30 @@ Produces the quotient of two signed integers.
1166
1659
1167### `++new`
1660### `++new`
1168
1661
1169− ++ new |= [a=? b=@] :: [sign value] to @s
1662+Signed integer
1170− `@s`?:(a (mul 2 b) ?:(=(0 b) 0 +((mul 2 (dec b)))))
1171
1663
1172−Produces a signed integer from a loobean sign value `a` and an atom `b`.
1664+Produces a signed integer from a loobean sign value `a` and an [atom]() `b`.
1665+
1666+Accepts
1667+-------
1173
1668
1174`a` is a loobean.
1669`a` is a loobean.
1175
1670
1176−`b` is an [atom]().
1671+`b` is an atom.
1672+
1673+Produces
1674+--------
1675+
1676+A [`@s`]()
1677+
1678+Source
1679+------
1680+
1681+ ++ new |= [a=? b=@] :: [sign value] to @s
1682+ `@s`?:(a (mul 2 b) ?:(=(0 b) 0 +((mul 2 (dec b)))))
1683+
1684+Examples
1685+--------
1177
1686
1178 ~zod/try=> (new:si [& 10])
1687 ~zod/try=> (new:si [& 10])
1179 --10
1688 --10
@@ -1186,11 +1695,27 @@ Produces a signed integer from a loobean sign value `a` and an atom `b`.
1186
1695
1187### `++old`
1696### `++old`
1188
1697
1189− ++ old |=(a=@s [(syn a) (abs a)]) :: [sign value]
1698+[sign value]
1190
1699
1191Produces the cell `[sign value]` representations of a signed integer.
1700Produces the cell `[sign value]` representations of a signed integer.
1192
1701
1702+Accepts
1703+-------
1704+
1193−`a` is a signed integer, `@s`.
1705+`a` is a [`@s`]().
1706+
1707+Produces
1708+--------
1709+
1710+A cell of a boolean and an [atom]().
1711+
1712+Source
1713+------
1714+
1715+ ++ old |=(a=@s [(syn a) (abs a)]) :: [sign value]
1716+
1717+Examples
1718+--------
1194
1719
1195 ~zod/try=> (old:si 7)
1720 ~zod/try=> (old:si 7)
1196 ! type-fail
1721 ! type-fail
@@ -1208,14 +1733,30 @@ Produces the cell `[sign value]` representations of a signed integer.
1208
1733
1209### `++pro`
1734### `++pro`
1210
1735
1211− ++ pro |= [a=@s b=@s] :: multiplication
1736+Multiply
1212− (new =(0 (mix (syn a) (syn b))) (mul (abs a) (abs b)))
1213
1737
1214Produces the product of two signed integers.
1738Produces the product of two signed integers.
1215
1739
1216−`a` is a signed integer, `@s`.
1740+Accepts
1741+-------
1217
1742
1218−`b` is a signed integer, `@s`.
1743+`a` is a [`@s`]().
1744+
1745+`b` is a `@s`.
1746+
1747+Produces
1748+--------
1749+
1750+A `@s`.
1751+
1752+Source
1753+------
1754+
1755+ ++ pro |= [a=@s b=@s] :: multiplication
1756+ (new =(0 (mix (syn a) (syn b))) (mul (abs a) (abs b)))
1757+
1758+Examples
1759+--------
1219
1760
1220 ~zod/try=> (pro:si -4 --2)
1761 ~zod/try=> (pro:si -4 --2)
1221 -8
1762 -8
@@ -1230,13 +1771,29 @@ Produces the product of two signed integers.
1230
1771
1231### `++rem`
1772### `++rem`
1232
1773
1233− ++ rem |=([a=@s b=@s] (dif a (pro b (fra a b)))) :: remainder
1774+Remainder
1234
1775
1235Produces the remainder from a division of two signed integers.
1776Produces the remainder from a division of two signed integers.
1236
1777
1237−`a` is a signed integer, `@s`.
1778+Accepts
1779+-------
1238
1780
1239−`b` is a signed integer, `@s`.
1781+`a` is a [`@s`]().
1782+
1783+`b` is a `@s`.
1784+
1785+Produces
1786+--------
1787+
1788+A `@sd`.
1789+
1790+Source
1791+------
1792+
1793+ ++ rem |=([a=@s b=@s] (dif a (pro b (fra a b)))) :: remainder
1794+
1795+Examples
1796+--------
1240
1797
1241 ~zod/try=> (rem:si -10 -4)
1798 ~zod/try=> (rem:si -10 -4)
1242 -2
1799 -2
@@ -1253,6 +1810,25 @@ Produces the remainder from a division of two signed integers.
1253
1810
1254### `++sum`
1811### `++sum`
1255
1812
1813+Add
1814+
1815+Sum two signed integers.
1816+
1817+Accepts
1818+-------
1819+
1820+`b` is a [`@s`]().
1821+
1822+`c` is a signed integer `@s`.
1823+
1824+Produces
1825+--------
1826+
1827+A `@s`.
1828+
1829+Source
1830+------
1831+
1256 ++ sum |= [a=@s b=@s] :: addition
1832 ++ sum |= [a=@s b=@s] :: addition
1257 ~| %si-sum
1833 ~| %si-sum
1258 =+ [c=(old a) d=(old b)]
1834 =+ [c=(old a) d=(old b)]
@@ -1268,11 +1844,8 @@ Produces the remainder from a division of two signed integers.
1268 (new & (sub +.d +.c))
1844 (new & (sub +.d +.c))
1269 (new | (add +.c +.d))
1845 (new | (add +.c +.d))
1270
1846
1271−Sum two signed integers.
1847+Examples
1272−
1848+--------
1273−`b` is a signed integer, `@s`.
1274−
1275−`c` is a signed integer, `@s`.
1276
1849
1277 ~zod/try=> (sum:si --10 --10)
1850 ~zod/try=> (sum:si --10 --10)
1278 --20
1851 --20
@@ -1287,14 +1860,30 @@ Sum two signed integers.
1287
1860
1288### `++sun`
1861### `++sun`
1289
1862
1290− ++ sun |=(a=@u (mul 2 a)) :: @u to @s
1863+Signed from unsigned
1291
1864
1292Produces a signed integer from an unsigned integer.
1865Produces a signed integer from an unsigned integer.
1293
1866
1294−Note that the result must be manually cast to some @s odor to be
1867+Note that the result must be manually cast to some [`@s`]() odor to be
1295inferred as an unsigned integer in the type system.
1868inferred as an unsigned integer in the type system.
1296
1869
1297−`a` is an unsigned integer, `@u`.
1870+Accepts
1871+-------
1872+
1873+`a` is a [`@u`]().
1874+
1875+Produces
1876+--------
1877+
1878+A [`@s`]().
1879+
1880+Source
1881+------
1882+
1883+ ++ sun |=(a=@u (mul 2 a)) :: @u to @s
1884+
1885+Examples
1886+--------
1298
1887
1299 ~zod/try=> `@s`10
1888 ~zod/try=> `@s`10
1300 --5
1889 --5
@@ -1311,11 +1900,27 @@ inferred as an unsigned integer in the type system.
1311
1900
1312### `++syn`
1901### `++syn`
1313
1902
1314− ++ syn |=(a=@s =(0 (end 0 1 a))) :: sign test
1903+Sign
1315
1904
1316−Produce the sign of a signed integer, `&` being posiitve, `|` negative.
1905+Produce the sign of a signed integer, where `&` is posiitve, and `|` is negative.
1317
1906
1907+Accepts
1908+-------
1909+
1318−`a` is a signed integer, `@s`.
1910+`a` is a [`@s`]().
1911+
1912+Produces
1913+--------
1914+
1915+A boolean.
1916+
1917+Source
1918+------
1919+
1920+ ++ syn |=(a=@s =(0 (end 0 1 a))) :: sign test
1921+
1922+Examples
1923+--------
1319
1924
1320 ~zod/try=> (syn:si -2)
1925 ~zod/try=> (syn:si -2)
1321 %.n
1926 %.n
@@ -1328,6 +1933,25 @@ Produce the sign of a signed integer, `&` being posiitve, `|` negative.
1328
1933
1329### `++cmp`
1934### `++cmp`
1330
1935
1936+Compare
1937+
1938+Compare two signed integers.
1939+
1940+Accepts
1941+-------
1942+
1943+`b` is a [`@s`]().
1944+
1945+`c` is a `@s`.
1946+
1947+Produces
1948+--------
1949+
1950+A `@s`.
1951+
1952+Source
1953+------
1954+
1331 ++ cmp |= [a=@s b=@s] :: compare
1955 ++ cmp |= [a=@s b=@s] :: compare
1332 ^- @s
1956 ^- @s
1333 ?: =(a b)
1957 ?: =(a b)
@@ -1344,11 +1968,8 @@ Produce the sign of a signed integer, `&` being posiitve, `|` negative.
1344 -1
1968 -1
1345 --1
1969 --1
1346
1970
1347−Compare two signed integers.
1971+Examples
1348−
1972+--------
1349−`b` is a signed integer, `@s`.
1350−
1351−`c` is a signed integer, `@s`.
1352
1973
1353 ~zod/try=> (cmp:si --10 --10)
1974 ~zod/try=> (cmp:si --10 --10)
1354 --0
1975 --0
@@ -1359,18 +1980,49 @@ Compare two signed integers.
1359 ~zod/try=> (cmp:si -10 --7)
1980 ~zod/try=> (cmp:si -10 --7)
1360 -1
1981 -1
1361
1982
1362−------------------------------------------------------------------------
1363
1983
1364−### `++dif`
1984+### `++fe` :: modulo bloq
1365
1985
1366− ++ dif |=([b=@ c=@] (sit (sub (add out (sit b)) (sit c))))
1986+Modulo bloq
1987+
1988+Core containing XX
1989+
1990+Accepts
1991+-------
1992+
1993+`a` is a [`++bloq`]().
1994+
1995+Source
1996+------
1997+
1998+ |_ a=bloq
1999+
2000+### `++dif`
1367
2001
1368−Produces the difference between two atoms in the modular basis
2002+Produces the difference between two [atom]()s in the modular basis
1369representation.
2003representation.
1370
2004
1371−`b` is an [atom]().
2005+Accepts
2006+-------
1372
2007
2008+`a` is a [`++bloq`]().
2009+
2010+`b` is an atom.
2011+
1373−`c` is an [atom]().
2012+`c` is an atom.
2013+
2014+Produces
2015+--------
2016+
2017+A [`@s`]()
2018+
2019+Source
2020+------
2021+
2022+ ++ dif |=([b=@ c=@] (sit (sub (add out (sit b)) (sit c))))
2023+
2024+Examples
2025+--------
1374
2026
1375 ~zod/try=> (~(dif fe 3) 63 64)
2027 ~zod/try=> (~(dif fe 3) 63 64)
1376 255
2028 255
@@ -1393,11 +2045,28 @@ representation.
1393
2045
1394### `++inv`
2046### `++inv`
1395
2047
1396− ++ inv |=(b=@ (sub (dec out) (sit b)))
2048+Invert mod field
1397
2049
1398Inverts the order of the modular field.
2050Inverts the order of the modular field.
1399
2051
1400−`b` is an [atom]().
2052+Accepts
2053+-------
2054+
2055+`b` is a [`++bloq`]().
2056+
2057+Produces
2058+--------
2059+
2060+An atom.
2061+
2062+
2063+Source
2064+------
2065+
2066+ ++ inv |=(b=@ (sub (dec out) (sit b)))
2067+
2068+Examples
2069+--------
1401
2070
1402 ~zod/try=> (~(inv fe 3) 255)
2071 ~zod/try=> (~(inv fe 3) 255)
1403 0
2072 0
@@ -1416,18 +2085,34 @@ Inverts the order of the modular field.
1416
2085
1417### `++net`
2086### `++net`
1418
2087
2088+Reverse bytes
2089+
2090+Revereses bytes within block.
2091+
2092+Accepts
2093+-------
2094+
2095+`b` is a [`++bloq`]().
2096+
2097+Produces
2098+--------
2099+
2100+An atom.=
2101+
2102+Source
2103+------
2104+
1419− ++ net |= b=@ ^- @
2105+ ++ net |= b=@ ^- @
1420− => .(b (sit b))
2106+ => .(b (sit b))
1421− ?: (lte a 3)
2107+ ?: (lte a 3)
1422 b
2108 b
1423 =+ c=(dec a)
2109 =+ c=(dec a)
1424 %+ con
2110 %+ con
1425 (lsh c 1 $(a c, b (cut c [0 1] b)))
2111 (lsh c 1 $(a c, b (cut c [0 1] b)))
1426 $(a c, b (cut c [1 1] b))
2112 $(a c, b (cut c [1 1] b))
1427
2113
1428−Reverse bytes within block.
2114+Examples
1429−
2115+--------
1430−`b` is an [atom]().
1431
2116
1432 ~zod/try=> (~(net fe 3) 64)
2117 ~zod/try=> (~(net fe 3) 64)
1433 64
2118 64
@@ -1480,10 +2165,28 @@ Reverse bytes within block.
1480
2165
1481### `++out`
2166### `++out`
1482
2167
1483− ++ out (bex (bex a))
2168+Max integer value
1484
2169
1485The maximum integer value that the current block can store.
2170The maximum integer value that the current block can store.
1486
2171
2172+Accepts
2173+-------
2174+
2175+A [`++bloq`]().
2176+
2177+Produces
2178+--------
2179+
2180+An [atom]().
2181+
2182+Source
2183+------
2184+
2185+ ++ out (bex (bex a))
2186+
2187+Examples
2188+--------
2189+
1487 ~zod/try=> ~(out fe 0)
2190 ~zod/try=> ~(out fe 0)
1488 2
2191 2
1489 ~zod/try=> ~(out fe 1)
2192 ~zod/try=> ~(out fe 1)
@@ -1507,19 +2210,37 @@ The maximum integer value that the current block can store.
1507
2210
1508### `++rol`
2211### `++rol`
1509
2212
2213+Roll left
2214+
2215+Roll `d` to the left by `c` `b`-sized blocks.
2216+
2217+Accepts
2218+-------
2219+
2220+`a` is a [`++bloq`]().
2221+
2222+`b` is a `++bloq`.
2223+
2224+`c` is an atom.
2225+
2226+`d` is an atom.
2227+
2228+Produces
2229+--------
2230+
2231+An atom.
2232+
2233+Source
2234+------
2235+
1510 ++ rol |= [b=bloq c=@ d=@] ^- @ :: roll left
2236 ++ rol |= [b=bloq c=@ d=@] ^- @ :: roll left
1511 =+ e=(sit d)
2237 =+ e=(sit d)
1512 =+ f=(bex (sub a b))
2238 =+ f=(bex (sub a b))
1513 =+ g=(mod c f)
2239 =+ g=(mod c f)
1514 (sit (con (lsh b g e) (rsh b (sub f g) e)))
2240 (sit (con (lsh b g e) (rsh b (sub f g) e)))
1515
2241
1516−Roll `d` to the left by `c` `b`-sized blocks.
2242+Examples
1517−
2243+--------
1518−`b` is a block size (see [++bloq]()).
1519−
1520−`c` is an [atom]().
1521−
1522−`d` is an [atom]().
1523
2244
1524 ~zod/try=> `@ux`(~(rol fe 6) 4 3 0xabac.dedf.1213)
2245 ~zod/try=> `@ux`(~(rol fe 6) 4 3 0xabac.dedf.1213)
1525 0x1213.0000.abac.dedf
2246 0x1213.0000.abac.dedf
@@ -1536,19 +2257,37 @@ Roll `d` to the left by `c` `b`-sized blocks.
1536
2257
1537### `++ror`
2258### `++ror`
1538
2259
1539− ++ ror |= [b=bloq c=@ d=@] ^- @ :: roll right
2260+Roll right
1540− =+ e=(sit d)
1541− =+ f=(bex (sub a b))
1542− =+ g=(mod c f)
1543− (sit (con (rsh b g e) (lsh b (sub f g) e)))
1544
2261
1545Roll `d` to the right by `c` `b`-sized blocks.
2262Roll `d` to the right by `c` `b`-sized blocks.
1546
2263
2264+Accepts
2265+-------
2266+
1547−`b` is a block size (see [++bloq]()).
2267+`a` is a [`++bloq`]().
2268+
2269+`b` is a `++bloq`.
1548
2270
1549`c` is an [atom]().
2271`c` is an [atom]().
1550
2272
1551−`d` is an [atom]().
2273+`d` is an atom.
2274+
2275+Produces
2276+--------
2277+
2278+An atom.
2279+
2280+Source
2281+------
2282+
2283+ ++ ror |= [b=bloq c=@ d=@] ^- @ :: roll right
2284+ =+ e=(sit d)
2285+ =+ f=(bex (sub a b))
2286+ =+ g=(mod c f)
2287+ (sit (con (rsh b g e) (lsh b (sub f g) e)))
2288+
2289+Examples
2290+--------
1552
2291
1553 ~zod/try=> `@ux`(~(ror fe 6) 4 1 0xabac.dedf.1213)
2292 ~zod/try=> `@ux`(~(ror fe 6) 4 1 0xabac.dedf.1213)
1554 0x1213.0000.abac.dedf
2293 0x1213.0000.abac.dedf
@@ -1567,13 +2306,31 @@ Roll `d` to the right by `c` `b`-sized blocks.
1567
2306
1568### `++sum`
2307### `++sum`
1569
2308
1570− ++ sum |=([b=@ c=@] (sit (add b c))) :: wrapping add
2309+Sum
1571
2310
1572Sum two numbers in this modular field.
2311Sum two numbers in this modular field.
1573
2312
2313+Accepts
2314+-------
2315+
2316+`a` is a [`++bloq`]().
2317+
1574`b` is an [atom]().
2318`b` is an [atom]().
1575
2319
1576−`c` is an [atom]().
2320+`c` is an atom.
2321+
2322+Produces
2323+--------
2324+
2325+An atom.
2326+
2327+Source
2328+------
2329+
2330+ ++ sum |=([b=@ c=@] (sit (add b c))) :: wrapping add
2331+
2332+Examples
2333+--------
1577
2334
1578 ~zod/try=> (~(sum fe 3) 10 250)
2335 ~zod/try=> (~(sum fe 3) 10 250)
1579 4
2336 4
@@ -1590,15 +2347,31 @@ Sum two numbers in this modular field.
1590 ~zod/try=> (~(sum fe 4) 10.000 100.000)
2347 ~zod/try=> (~(sum fe 4) 10.000 100.000)
1591 44.464
2348 44.464
1592
2349
1593−------------------------------------------------------------------------
1594−
1595### `++sit`
2350### `++sit`
1596
2351
1597− ++ sit |=(b=@ (end a 1 b)) :: enforce modulo
2352+Atom in mod block representation
1598
2353
1599−Produce an atom in the current modular block representation.
2354+Produce an [atom]() in the current modular block representation.
1600
2355
1601−`b` is an [atom]().
2356+Accepts
2357+-------
2358+
2359+`a` is a [`++bloq`]().
2360+
2361+`b` is an atom.
2362+
2363+Produces
2364+--------
2365+
2366+An atom.
2367+
2368+Source
2369+------
2370+
2371+ ++ sit |=(b=@ (end a 1 b)) :: enforce modulo
2372+
2373+Examples
2374+--------
1602
2375
1603 ~zod/try=> (~(sit fe 3) 255)
2376 ~zod/try=> (~(sit fe 3) 255)
1604 255
2377 255
@@ -1641,6 +2414,22 @@ format. We use this for many of our examples.
1641
2414
1642### `++year`
2415### `++year`
1643
2416
2417+Accept a parsed date of form `[[a=? y=@ud] m=@ud t=tarp]` and produce
2418+its `@d`representation.
2419+
2420+Accepts
2421+-------
2422+
2423+`det` is a [`++date`]()
2424+
2425+Produces
2426+--------
2427+
2428+A [`@d`]().
2429+
2430+Source
2431+------
2432+
1644 ++ year :: date to @d
2433 ++ year :: date to @d
1645 |= det=date
2434 |= det=date
1646 ^- @d
2435 ^- @d
@@ -1651,10 +2440,8 @@ format. We use this for many of our examples.
1651 =+ day=(yawn yer m.det d.t.det)
2440 =+ day=(yawn yer m.det d.t.det)
1652 (yule day h.t.det m.t.det s.t.det f.t.det)
2441 (yule day h.t.det m.t.det s.t.det f.t.det)
1653
2442
1654−Accept a parsed date of form `[[a=? y=@ud] m=@ud t=tarp]` and produce
2443+Examples
1655−its `@d`representation.
2444+--------
1656−
1657−`det` is a [`++date`]()
1658
2445
1659 ~zod/try=> (year [[a=%.y y=2.014] m=8 t=[d=4 h=20 m=4 s=57 f=~[0xd940]]])
2446 ~zod/try=> (year [[a=%.y y=2.014] m=8 t=[d=4 h=20 m=4 s=57 f=~[0xd940]]])
1660 0x8000000d227df4e9d940000000000000
2447 0x8000000d227df4e9d940000000000000
@@ -1663,6 +2450,21 @@ its `@d`representation.
1663
2450
1664### `++yore`
2451### `++yore`
1665
2452
2453+Produces a `++date` from a `@d`
2454+
2455+Accepts
2456+-------
2457+
2458+`now` is a `@d`.
2459+
2460+Produces
2461+--------
2462+
2463+A [`++date`]().
2464+
2465+Source
2466+------
2467+
1666 ++ yore :: @d to date
2468 ++ yore :: @d to date
1667 |= now=@d
2469 |= now=@d
1668 ^- date
2470 ^- date
@@ -1673,19 +2475,23 @@ its `@d`representation.
1673 [a=| y=+((sub 292.277.024.400 y.ger))]
2475 [a=| y=+((sub 292.277.024.400 y.ger))]
1674 [m.ger d.ger h.rip m.rip s.rip f.rip]
2476 [m.ger d.ger h.rip m.rip s.rip f.rip]
1675
2477
1676−Produces a `++date` from a `@d`
2478+Examples
1677−
2479+--------
1678−`now` is a `@d`.
1679
2480
1680 ~zod/try=> (yore -<-)
2481 ~zod/try=> (yore -<-)
1681 [[a=%.y y=2.014] m=8 t=[d=4 h=20 m=17 s=1 f=~[0x700d]]]
2482 [[a=%.y y=2.014] m=8 t=[d=4 h=20 m=17 s=1 f=~[0x700d]]]
1682 ~zod/try=> (yore -<-)
2483 ~zod/try=> (yore -<-)
1683 [[a=%.y y=2.014] m=8 t=[d=4 h=20 m=28 s=53 f=~[0x7b82]]]
2484 [[a=%.y y=2.014] m=8 t=[d=4 h=20 m=28 s=53 f=~[0x7b82]]]
1684
2485
1685−------------------------------------------------------------------------
1686−
1687### `++yell`
2486### `++yell`
1688
2487
2488+Produce a parsed daily time format from an atomic date.
2489+
2490+`now` is a `@d`.
2491+
2492+Source
2493+------
2494+
1689 ++ yell :: tarp from @d
2495 ++ yell :: tarp from @d
1690 |= now=@d
2496 |= now=@d
1691 ^- tarp
2497 ^- tarp
@@ -1705,9 +2511,8 @@ Produces a `++date` from a `@d`
1705 => .(sec (mod sec mit:yo))
2511 => .(sec (mod sec mit:yo))
1706 [day hor mit sec fan]
2512 [day hor mit sec fan]
1707
2513
1708−Produce a parsed daily time format from an atomic date.
2514+Examples
1709−
2515+--------
1710−`now` is a `@d`.
1711
2516
1712 ~zod/try=> (yell ~2014.3.20..05.42.53..7456)
2517 ~zod/try=> (yell ~2014.3.20..05.42.53..7456)
1713 [d=106.751.991.820.094 h=5 m=42 s=53 f=~[0x7456]]
2518 [d=106.751.991.820.094 h=5 m=42 s=53 f=~[0x7456]]
@@ -1720,6 +2525,24 @@ Produce a parsed daily time format from an atomic date.
1720
2525
1721### `++yule`
2526### `++yule`
1722
2527
2528+Daily time to time atom
2529+
2530+Accept a [`++tarp`](/doc/hoon/library/1#++tarp), a parsed daily time, and produces a time atom,
2531+`@d`.
2532+
2533+Accepts
2534+-------
2535+
2536+`rip` is a [`++tarp`](/doc/hoon/library/1#++tarp).
2537+
2538+Produces
2539+--------
2540+
2541+A [`@d`]().
2542+
2543+Source
2544+------
2545+
1723 ++ yule :: time atom
2546 ++ yule :: time atom
1724 |= rip=tarp
2547 |= rip=tarp
1725 ^- @d
2548 ^- @d
@@ -1737,10 +2560,8 @@ Produce a parsed daily time format from an atomic date.
1737 (add (lsh 4 muc i.f.rip) $(f.rip t.f.rip))
2560 (add (lsh 4 muc i.f.rip) $(f.rip t.f.rip))
1738 (con (lsh 6 1 sec) fac)
2561 (con (lsh 6 1 sec) fac)
1739
2562
1740−Accept a [`++tarp`](/doc/hoon/library/1#++tarp), a parsed daily time, and produces a time atom,
2563+Examples
1741−`@d`.
2564+--------
1742−
1743−`rip` is a [`++tarp`](/doc/hoon/library/1#++tarp).
1744
2565
1745 ~zod/try=> =murica (yell ~1776.7.4)
2566 ~zod/try=> =murica (yell ~1776.7.4)
1746 ~zod/try=> murica
2567 ~zod/try=> murica
@@ -1760,6 +2581,23 @@ Accept a [`++tarp`](/doc/hoon/library/1#++tarp), a parsed daily time, and produc
1760
2581
1761### `++yall`
2582### `++yall`
1762
2583
2584+Time since beginning of time
2585+
2586+Produce the date tuple of `[y=@ud m=@ud d=@ud]` of the year, month, and
2587+day from a number of days from the beginning of time.
2588+
2589+Accepts
2590+-------
2591+
2592+`day` is a [`@ud`]()
2593+
2594+Produces
2595+--------
2596+
2597+
2598+Source
2599+------
2600+
1763 ++ yall :: day # to day of year
2601 ++ yall :: day # to day of year
1764 |= day=@ud
2602 |= day=@ud
1765 ^- [y=@ud m=@ud d=@ud]
2603 ^- [y=@ud m=@ud d=@ud]
@@ -1784,10 +2622,8 @@ Accept a [`++tarp`](/doc/hoon/library/1#++tarp), a parsed daily time, and produc
1784 [yer +(mot) +(day)]
2622 [yer +(mot) +(day)]
1785 $(mot +(mot), day (sub day zis))
2623 $(mot +(mot), day (sub day zis))
1786
2624
1787−Produce the date tuple of `[y=@ud m=@ud d=@ud]` of the year, month, and
2625+Examples
1788−day from a number of days from the beginning of time.
2626+--------
1789−
1790−`day` is an unsigned decimal, `@ud`.
1791
2627
1792 ~zod/try=> (yall 198)
2628 ~zod/try=> (yall 198)
1793 [y=0 m=7 d=17]
2629 [y=0 m=7 d=17]
@@ -1800,6 +2636,28 @@ day from a number of days from the beginning of time.
1800
2636
1801### `++yawn`
2637### `++yawn`
1802
2638
2639+Days since beginning of time
2640+
2641+Inverse of `yall`, computes number of days A.D. from y/m/d date as the
2642+tuple `[yer=@ud mot=@ud day=@ud]`.
2643+
2644+Accepts
2645+-------
2646+
2647+`yer` is an unsigned decimal, `@ud`.
2648+
2649+`mon` is an unsigned decimal, `@ud`.
2650+
2651+`day` is an unsigned decimal, `@ud`.
2652+
2653+Produces
2654+--------
2655+
2656+A [`@ud`]().
2657+
2658+Source
2659+------
2660+
1803 ++ yawn :: days since Jesus
2661 ++ yawn :: days since Jesus
1804 |= [yer=@ud mot=@ud day=@ud]
2662 |= [yer=@ud mot=@ud day=@ud]
1805 ^- @ud
2663 ^- @ud
@@ -1825,14 +2683,8 @@ day from a number of days from the beginning of time.
1825 $(yer nec, day (add day ?:((yelp nec) 36.525 36.524)))
2683 $(yer nec, day (add day ?:((yelp nec) 36.525 36.524)))
1826 (add day (mul (div yer 400) (add 1 (mul 4 36.524))))
2684 (add day (mul (div yer 400) (add 1 (mul 4 36.524))))
1827
2685
1828−Inverse of `yall`, computes number of days A.D. from y/m/d date as the
2686+Examples
1829−tuple `[yer=@ud mot=@ud day=@ud]`.
2687+--------
1830−
1831−`yer` is an unsigned decimal, `@ud`.
1832−
1833−`mon` is an unsigned decimal, `@ud`.
1834−
1835−`day` is an unsigned decimal, `@ud`.
1836
2688
1837 ~zod/try=> (yawn 2.014 8 4)
2689 ~zod/try=> (yawn 2.014 8 4)
1838 735.814
2690 735.814
@@ -1845,15 +2697,31 @@ tuple `[yer=@ud mot=@ud day=@ud]`.
1845
2697
1846### `++yelp`
2698### `++yelp`
1847
2699
1848− ++ yelp :: leap year
2700+Leap-week?
1849− |= yer=@ud ^- ?
1850− &(=(0 (mod yer 4)) |(!=(0 (mod yer 100)) =(0 (mod yer 400))))
1851
2701
1852Determines whether a year contains an ISO 8601 leap week. Produces a
2702Determines whether a year contains an ISO 8601 leap week. Produces a
1853loobean.
2703loobean.
1854
2704
2705+Accepts
2706+-------
2707+
1855`yer` is an unsigned decimal, `@ud`.
2708`yer` is an unsigned decimal, `@ud`.
1856
2709
2710+Produces
2711+--------
2712+
2713+A boolean.
2714+
2715+Source
2716+------
2717+
2718+ ++ yelp :: leap year
2719+ |= yer=@ud ^- ?
2720+ &(=(0 (mod yer 4)) |(!=(0 (mod yer 100)) =(0 (mod yer 400))))
2721+
2722+Examples
2723+--------
2724+
1857 ~zod/try=> (yelp 2.014)
2725 ~zod/try=> (yelp 2.014)
1858 %.n
2726 %.n
1859 ~zod/try=> (yelp 2.008)
2727 ~zod/try=> (yelp 2.008)
@@ -1867,19 +2735,29 @@ loobean.
1867
2735
1868### `++yo`
2736### `++yo`
1869
2737
1870− ++ yo :: time constants
2738+ ++ yo :: time constants core
1871
2739
1872−
1873Useful constants for interacting with earth time.
2740Useful constants for interacting with earth time.
1874
2741
1875### `++cet`
2742### `++cet`
1876
2743
1877− |% ++ cet 36.524 :: (add 24 (mul 100 365))
1878−
1879Days in a century. Derived by multiplying the number of days in a year
2744Days in a century. Derived by multiplying the number of days in a year
1880(365) by the number of years in a century (100), then adding the number
2745(365) by the number of years in a century (100), then adding the number
1881days from leap years in a century (24).
2746days from leap years in a century (24).
1882
2747
2748+Produces
2749+--------
2750+
2751+An [atom]().
2752+
2753+Source
2754+------
2755+
2756+ |% ++ cet 36.524 :: (add 24 (mul 100 365))
2757+
2758+Examples
2759+--------
2760+
1883 ~zod/try=> cet:yo
2761 ~zod/try=> cet:yo
1884 36.524
2762 36.524
1885 ~zod/try=> (add 365 cet:yo)
2763 ~zod/try=> (add 365 cet:yo)
@@ -1891,9 +2769,20 @@ days from leap years in a century (24).
1891
2769
1892### `++day`
2770### `++day`
1893
2771
2772+Number of seconds in a day.
2773+
2774+Produces
2775+--------
2776+
2777+An [atom]().
2778+
2779+Source
2780+------
2781+
1894 ++ day 86.400 :: (mul 24 hor)
2782 ++ day 86.400 :: (mul 24 hor)
1895
2783
1896−Number of seconds in a day.
2784+Examples
2785+--------
1897
2786
1898 ~zod/try=> day:yo
2787 ~zod/try=> day:yo
1899 86.400
2788 86.400
@@ -1904,19 +2793,44 @@ Number of seconds in a day.
1904
2793
1905### `++era`
2794### `++era`
1906
2795
2796+XX Revisit
2797+
2798+Produces
2799+--------
2800+
2801+An [atom]().
2802+
2803+Source
2804+------
2805+
1907 ++ era 146.097 :: (add 1 (mul 4 cet))
2806 ++ era 146.097 :: (add 1 (mul 4 cet))
1908
2807
1909−XX Revisit
2808+Examples
2809+--------
2810+
1910
2811
1911------------------------------------------------------------------------
2812------------------------------------------------------------------------
1912
2813
1913### `++hor`
2814### `++hor`
1914
2815
1915− ++ hor 3.600 :: (mul 60 mit)
2816+Seconds in hour
1916
2817
1917The number of seconds in an hour. Derived by multiplying the number of
2818The number of seconds in an hour. Derived by multiplying the number of
1918seconds in a minute by the minutes in an hour.
2819seconds in a minute by the minutes in an hour.
1919
2820
2821+Produces
2822+--------
2823+
2824+An [atom]().
2825+
2826+Source
2827+------
2828+
2829+ ++ hor 3.600 :: (mul 60 mit)
2830+
2831+Examples
2832+--------
2833+
1920 ~zod/try=> hor:yo
2834 ~zod/try=> hor:yo
1921 3.600
2835 3.600
1922 ~zod/try=> (div hor:yo 60)
2836 ~zod/try=> (div hor:yo 60)
@@ -1926,9 +2840,20 @@ seconds in a minute by the minutes in an hour.
1926
2840
1927### `++jes`
2841### `++jes`
1928
2842
2843+XX Revisit
2844+
2845+Produces
2846+--------
2847+
2848+An atom.
2849+
2850+Source
2851+------
2852+
1929 ++ jes 106.751.991.084.417 :: (mul 730.692.561 era)
2853 ++ jes 106.751.991.084.417 :: (mul 730.692.561 era)
1930
2854
1931−XX Revisit
2855+Examples
2856+--------
1932
2857
1933 ~zod/try=> jes:yo
2858 ~zod/try=> jes:yo
1934 106.751.991.084.417
2859 106.751.991.084.417
@@ -1937,10 +2862,23 @@ XX Revisit
1937
2862
1938### `++mit`
2863### `++mit`
1939
2864
1940− ++ mit 60
2865+Seconds in minute
1941
2866
1942The number of seconds in a minute.
2867The number of seconds in a minute.
1943
2868
2869+Produces
2870+--------
2871+
2872+An [atom]().
2873+
2874+Source
2875+------
2876+
2877+ ++ mit 60
2878+
2879+Examples
2880+--------
2881+
1944 ~zod/try=> mit:yo
2882 ~zod/try=> mit:yo
1945 60
2883 60
1946
2884
@@ -1948,12 +2886,25 @@ The number of seconds in a minute.
1948
2886
1949### `++moh`
2887### `++moh`
1950
2888
1951− ++ moh `(list ,@ud)`[31 28 31 30 31 30 31 31 30 31 30 31 ~]
2889+Days in month
1952
2890
1953The days in each month of the Gregorian common year. A list of unsigned
2891The days in each month of the Gregorian common year. A list of unsigned
1954decimal atoms (Either 28, 30, or 31) denoting the number of days in the
2892decimal atoms (Either 28, 30, or 31) denoting the number of days in the
1955month at the year at that index.
2893month at the year at that index.
1956
2894
2895+Produces
2896+--------
2897+
2898+A [`++list`]() of [`@ud`]()
2899+
2900+Source
2901+------
2902+
2903+ ++ moh `(list ,@ud)`[31 28 31 30 31 30 31 31 30 31 30 31 ~]
2904+
2905+Examples
2906+--------
2907+
1957 ~zod/try=> moh:yo
2908 ~zod/try=> moh:yo
1958 ~[31 28 31 30 31 30 31 31 30 31 30 31]
2909 ~[31 28 31 30 31 30 31 31 30 31 30 31]
1959 ~zod/try=> (snag 4 moh:yo)
2910 ~zod/try=> (snag 4 moh:yo)
@@ -1963,12 +2914,25 @@ month at the year at that index.
1963
2914
1964### `++moy`
2915### `++moy`
1965
2916
1966− ++ moy `(list ,@ud)`[31 29 31 30 31 30 31 31 30 31 30 31 ~]
2917+Moh with leapyear
1967
2918
1968The days in each month of the Gregorian leap-year. A list of unsigned
2919The days in each month of the Gregorian leap-year. A list of unsigned
1969decimal atoms (Either 29,30, or 31) denoting the number of days in the
2920decimal atoms (Either 29,30, or 31) denoting the number of days in the
1970month at the leap-year at that index.
2921month at the leap-year at that index.
1971
2922
2923+Examples
2924+--------
2925+
2926+A [`++list`]() of [`@ud`]()
2927+
2928+Source
2929+------
2930+
2931+ ++ moy `(list ,@ud)`[31 29 31 30 31 30 31 31 30 31 30 31 ~]
2932+
2933+Examples
2934+--------
2935+
1972 ~zod/try=> moy:yo
2936 ~zod/try=> moy:yo
1973 ~[31 29 31 30 31 30 31 31 30 31 30 31]
2937 ~[31 29 31 30 31 30 31 31 30 31 30 31]
1974 ~zod/try=> (snag 1 moy:yo)
2938 ~zod/try=> (snag 1 moy:yo)
@@ -1978,11 +2942,24 @@ month at the leap-year at that index.
1978
2942
1979### `++qad`
2943### `++qad`
1980
2944
1981− ++ qad 126.144.001 :: (add 1 (mul 4 yer))
2945+Seconds in 4 years
1982
2946
1983The number of seconds in four years. Derived by adding one second to the
2947The number of seconds in four years. Derived by adding one second to the
1984number of seconds in four years.
2948number of seconds in four years.
1985
2949
2950+Produces
2951+--------
2952+
2953+An [atom]().
2954+
2955+Source
2956+------
2957+
2958+ ++ qad 126.144.001 :: (add 1 (mul 4 yer))
2959+
2960+Examples
2961+--------
2962+
1986 ~zod/try=> qad:yo
2963 ~zod/try=> qad:yo
1987 126.144.001
2964 126.144.001
1988
2965
@@ -1990,11 +2967,24 @@ number of seconds in four years.
1990
2967
1991### `++yer`
2968### `++yer`
1992
2969
1993− ++ yer 31.536.000 :: (mul 365 day)
2970+Seconds in year
1994
2971
1995The number of seconds in a year. Derived by multiplying the number of
2972The number of seconds in a year. Derived by multiplying the number of
1996seconds in a day by 365.
2973seconds in a day by 365.
1997
2974
2975+Produces
2976+--------
2977+
2978+An [atom]().
2979+
2980+Source
2981+------
2982+
2983+ ++ yer 31.536.000 :: (mul 365 day)
2984+
2985+Examples
2986+--------
2987+
1998 ~zod/try=> yer:yo
2988 ~zod/try=> yer:yo
1999 31.536.000
2989 31.536.000
2000
2990
@@ -2005,16 +2995,30 @@ section 2cI, almost macros
2005
2995
2006### `++cury`
2996### `++cury`
2007
2997
2998+Curry a gate, binding the head of its sample
2999+
3000+Accepts
3001+-------
3002+
3003+`a` is a [gate]().
3004+
3005+`b` is a [noun]().
3006+
3007+Produces
3008+--------
3009+
3010+A [gate]().
3011+
3012+Source
3013+------
3014+
2008 ++ cury
3015 ++ cury
2009 |* [a=_|=(^ _*) b=*]
3016 |* [a=_|=(^ _*) b=*]
2010 |* c=_+<+.a
3017 |* c=_+<+.a
2011 (a b c)
3018 (a b c)
2012
3019
2013−Curry a gate, binding the head of its sample
3020+Examples
2014−
3021+--------
2015−`a` is a [gate]().
2016−
2017−`b` is a noun.
2018
3022
2019 ~zod/try=> =mol (cury add 2)
3023 ~zod/try=> =mol (cury add 2)
2020 ~zod/try=> (mol 4)
3024 ~zod/try=> (mol 4)
@@ -2026,16 +3030,31 @@ Curry a gate, binding the head of its sample
2026
3030
2027### `++curr`
3031### `++curr`
2028
3032
3033+Right curry
3034+
3035+Right curry a gate, binding the tail of its sample
3036+
3037+Accepts
3038+-------
3039+
3040+`a` is a [gate]().
3041+
3042+`c` is a [noun]().
3043+
3044+Produces
3045+--------
3046+
3047+
3048+Source
3049+------
3050+
2029 ++ curr
3051 ++ curr
2030 |* [a=_|=(^ _*) c=*]
3052 |* [a=_|=(^ _*) c=*]
2031 |* b=_+<+.a
3053 |* b=_+<+.a
2032 (a b c)
3054 (a b c)
2033
3055
2034−Right curry a gate, binding the tail of its sample
3056+Examples
2035−
3057+--------
2036−`a` is a gate.
2037−
2038−`c` is a noun.
2039
3058
2040 ~zod/try=> =tep (curr scan sym)
3059 ~zod/try=> =tep (curr scan sym)
2041 ~zod/try=> `@t`(tep "asd")
3060 ~zod/try=> `@t`(tep "asd")
@@ -2046,15 +3065,20 @@ Right curry a gate, binding the tail of its sample
2046------------------------------------------------------------------------
3065------------------------------------------------------------------------
2047
3066
2048### `++cork`
3067### `++cork`
2049−
2050− ++ cork |*([a=_,* b=gate] (corl b a)) :: compose forward
2051−
2052Build `f` such that `(f x) .= (b (a x))`.
3068Build `f` such that `(f x) .= (b (a x))`.
2053
3069
2054`a` is a noun.
3070`a` is a noun.
2055
3071
2056`b` is a gate.
3072`b` is a gate.
2057
3073
3074+Source
3075+------
3076+
3077+ ++ cork |*([a=_,* b=gate] (corl b a)) :: compose forward
3078+
3079+Examples
3080+--------
3081+
2058 ~zod/try=> (:(cork dec dec dec) 20)
3082 ~zod/try=> (:(cork dec dec dec) 20)
2059 17
3083 17
2060 ~zod/try=> =mal (mo (limo a/15 b/23 ~))
3084 ~zod/try=> =mal (mo (limo a/15 b/23 ~))
@@ -2067,11 +3091,6 @@ Build `f` such that `(f x) .= (b (a x))`.
2067
3091
2068### `++corl`
3092### `++corl`
2069
3093
2070− ++ corl :: compose backwards
2071− |* [a=gate b=_,*]
2072− |= c=_+<.b
2073− (a (b c))
2074−
2075Gate compose
3094Gate compose
2076
3095
2077XX Revisit
3096XX Revisit
@@ -2080,6 +3099,17 @@ XX Revisit
2080
3099
2081`b` is a noun.
3100`b` is a noun.
2082
3101
3102+Source
3103+------
3104+
3105+ ++ corl :: compose backwards
3106+ |* [a=gate b=_,*]
3107+ |= c=_+<.b
3108+ (a (b c))
3109+
3110+Examples
3111+--------
3112+
2083 ~zod/try=> ((corl (lift bex) (slat %ud)) '2')
3113 ~zod/try=> ((corl (lift bex) (slat %ud)) '2')
2084 [~ 4]
3114 [~ 4]
2085
3115
@@ -2087,6 +3117,12 @@ XX Revisit
2087
3117
2088### `++hard`
3118### `++hard`
2089
3119
3120+Demands that a specific type be produced, crashing the program is it is
3121+not.
3122+
3123+Source
3124+------
3125+
2090 ++ hard
3126 ++ hard
2091 |* han=$+(* *)
3127 |* han=$+(* *)
2092 |= fud=* ^- han
3128 |= fud=* ^- han
@@ -2094,8 +3130,8 @@ XX Revisit
2094 =+ gol=(han fud)
3130 =+ gol=(han fud)
2095 ?>(=(gol fud) gol)
3131 ?>(=(gol fud) gol)
2096
3132
2097−Demands that a specific type be produced, crashing the program is it is
3133+Examples
2098−not.
3134+--------
2099
3135
2100 ~zod/try=> ((hard (list)) (limo [1 2 3 ~]))
3136 ~zod/try=> ((hard (list)) (limo [1 2 3 ~]))
2101 ~[1 2 3]
3137 ~[1 2 3]
@@ -2111,14 +3147,20 @@ not.
2111
3147
2112### `++soft`
3148### `++soft`
2113
3149
3150+Politely requests a specific type to be produced, producing null if it
3151+is not.
3152+
3153+Source
3154+------
3155+
2114 ++ soft
3156 ++ soft
2115 |* han=$+(* *)
3157 |* han=$+(* *)
2116 |= fud=* ^- (unit han)
3158 |= fud=* ^- (unit han)
2117 =+ gol=(han fud)
3159 =+ gol=(han fud)
2118 ?.(=(gol fud) ~ [~ gol])
3160 ?.(=(gol fud) ~ [~ gol])
2119
3161
2120−Politely requests a specific type to be produced, producing null if it
3162+Examples
2121−is not.
3163+--------
2122
3164
2123 ~zod/try=> ((soft ,%4) (add 2 2))
3165 ~zod/try=> ((soft ,%4) (add 2 2))
2124 [~ %4]
3166 [~ %4]
docs/dev/hoon/library/2da.md+258−61
@@ -5,6 +5,21 @@ section 2dA, sets
5
5
6Set verification
6Set verification
7
7
8+Produces a boolean indicating whether `a` is a [`++set`]() or not.
9+
10+Accepts
11+-------
12+
13+`a` is a [tree]().
14+
15+Produces
16+--------
17+
18+A boolean.
19+
20+Source
21+------
22+
8 ++ apt :: set invariant
23 ++ apt :: set invariant
9 |= a=(tree)
24 |= a=(tree)
10 ?~ a
25 ?~ a
@@ -14,9 +29,8 @@ Set verification
14 ==
29 ==
15 ::
30 ::
16
31
17−Produces a loobean indicating whether `a` is a set or not.
32+Examples
18−
33+--------
19−`a` is a [tree]().
20
34
21 ~zod/try=> =b (sa `(list ,@t)`['john' 'bonita' 'daniel' 'madeleine' ~])
35 ~zod/try=> =b (sa `(list ,@t)`['john' 'bonita' 'daniel' 'madeleine' ~])
22 ~zod/try=> (apt b)
36 ~zod/try=> (apt b)
@@ -33,21 +47,48 @@ Produces a loobean indicating whether `a` is a set or not.
33
47
34Set operations
48Set operations
35
49
50+Core whose [arm]()s contain a variety of functions that operate on [`++set`]()s. Its [sample]() accepts the input [`++set`]() to be manipulated.
51+
52+Accepts
53+-------
54+
55+A `++set`.
56+
57+Source
58+------
59+
36 ++ in :: set engine
60 ++ in :: set engine
37 ~/ %in
61 ~/ %in
38 |/ a=(set)
62 |/ a=(set)
39
63
40−Input arm.
64+Examples
65+--------
41
66
42 ~zod/try=> ~(. in (sa "asd"))
67 ~zod/try=> ~(. in (sa "asd"))
43 <13.evb [nlr(^$1{@tD $1}) <414.fvk 101.jzo 1.ypj %164>]>
68 <13.evb [nlr(^$1{@tD $1}) <414.fvk 101.jzo 1.ypj %164>]>
44
69
45−`a` is a [set]()
46−
47### `+-all:in`
70### `+-all:in`
48
71
49Logical AND
72Logical AND
50
73
74+Computes the logical AND on every element in `a` slammed with `b`,
75+producing a boolean.
76+
77+Accepts
78+-------
79+
80+`a` is a [`++set`]().
81+
82+`b` is a [wet]() [gate]() that accepts a [noun]() and produces a boolean.
83+
84+Produces
85+--------
86+
87+A boolean.
88+
89+Source
90+------
91+
51 +- all :: logical AND
92 +- all :: logical AND
52 ~/ %all
93 ~/ %all
53 |* b=$+(* ?)
94 |* b=$+(* ?)
@@ -57,12 +98,8 @@ Logical AND
57 ?&((b n.a) $(a l.a) $(a r.a))
98 ?&((b n.a) $(a l.a) $(a r.a))
58 ::
99 ::
59
100
60−Computes the logical AND on every element in `a` slammed with `b`,
101+Examples
61−producing a loobean.
102+--------
62−
63−`a` is a [set]().
64−
65−`b` is a [wet gate]() that accepts a noun and produces a loobean.
66
103
67 ~zod/try=> =b (sa `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
104 ~zod/try=> =b (sa `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
68 ~zod/try=> (~(all in b) |=(a=* ?@(+.a & |)))
105 ~zod/try=> (~(all in b) |=(a=* ?@(+.a & |)))
@@ -77,6 +114,23 @@ producing a loobean.
77
114
78Logical OR
115Logical OR
79
116
117+Computes the logical OR on every element of `a` slammed with `b`.
118+
119+Accepts
120+-------
121+
122+`a` is a [`++set`]().
123+
124+`b` is a [gate]() that accepts a noun and produces a boolean.
125+
126+Produces
127+--------
128+
129+A boolean.
130+
131+Source
132+------
133+
80 +- any :: logical OR
134 +- any :: logical OR
81 ~/ %any
135 ~/ %any
82 |* b=$+(* ?)
136 |* b=$+(* ?)
@@ -86,11 +140,8 @@ Logical OR
86 ?|((b n.a) $(a l.a) $(a r.a))
140 ?|((b n.a) $(a l.a) $(a r.a))
87 ::
141 ::
88
142
89−Computes the logical OR on every element of `a` slammed with `b`.
143+Examples
90−
144+--------
91−`a` is a [set]().
92−
93−`b` is a [gate]() that accepts a noun and produces a loobean.
94
145
95 ~zod/try=> =b (sa `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
146 ~zod/try=> =b (sa `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
96 ~zod/try=> (~(any in b) |=(a=* ?@(+.a & |)))
147 ~zod/try=> (~(any in b) |=(a=* ?@(+.a & |)))
@@ -105,6 +156,23 @@ Computes the logical OR on every element of `a` slammed with `b`.
105
156
106Remove noun
157Remove noun
107
158
159+Removes `b` from the [`++set`]() `a`.
160+
161+Accepts
162+-------
163+
164+`a` is a set.
165+
166+`b` is a [noun]().
167+
168+Produces
169+--------
170+
171+A set.
172+
173+Source
174+------
175+
108 +- del :: b without any a
176 +- del :: b without any a
109 ~/ %del
177 ~/ %del
110 |* b=*
178 |* b=*
@@ -123,11 +191,9 @@ Remove noun
123 [n.r.a $(r.a l.r.a) r.r.a]
191 [n.r.a $(r.a l.r.a) r.r.a]
124 ::
192 ::
125
193
126−Removes `b` from the set `a`.
127
194
128−`a` is a [set]().
195+Examples
129−
196+--------
130−`b` is a [noun]().
131
197
132 ~zod/try=> =b (sa `(list ,@t)`['a' 'b' 'c' ~])
198 ~zod/try=> =b (sa `(list ,@t)`['a' 'b' 'c' ~])
133 ~zod/try=> (~(del in b) 'a')
199 ~zod/try=> (~(del in b) 'a')
@@ -144,6 +210,23 @@ Removes `b` from the set `a`.
144
210
145Axis a in b
211Axis a in b
146
212
213+Produce the axis of `b` within `a`.
214+
215+Accepts
216+-------
217+
218+`a` is a [`++set`]().
219+
220+`b` is a [noun]().
221+
222+Produces
223+--------
224+
225+The [`++unit`]() of an atom.
226+
227+Source
228+------
229+
147 +- dig :: axis of a in b
230 +- dig :: axis of a in b
148 |= b=*
231 |= b=*
149 =+ c=1
232 =+ c=1
@@ -155,11 +238,9 @@ Axis a in b
155 $(a r.a, c (peg c 7))
238 $(a r.a, c (peg c 7))
156 ::
239 ::
157
240
158−Produce the axis of `b` within `a`.
159−
160−`a` is a [set]().
161
241
162−`b` is a [noun]().
242+Examples
243+--------
163
244
164 ~zod/try=> =a (sa `(list ,@)`[1 2 3 4 5 6 7 ~])
245 ~zod/try=> =a (sa `(list ,@)`[1 2 3 4 5 6 7 ~])
165 ~zod/try=> a
246 ~zod/try=> a
@@ -179,6 +260,23 @@ Produce the axis of `b` within `a`.
179
260
180Concatenate
261Concatenate
181
262
263+Insert the elements of a [`++list`]() `b` into a [`++set`]() `a`.
264+
265+Accepts
266+-------
267+
268+`a` is a set.
269+
270+`b` is a list.
271+
272+Produces
273+--------
274+
275+A `++set`.
276+
277+Source
278+------
279+
182 +- gas :: concatenate
280 +- gas :: concatenate
183 ~/ %gas
281 ~/ %gas
184 |= b=(list ,_?>(?=(^ a) n.a))
282 |= b=(list ,_?>(?=(^ a) n.a))
@@ -188,11 +286,9 @@ Concatenate
188 $(b t.b, a (put(+< a) i.b))
286 $(b t.b, a (put(+< a) i.b))
189 ::
287 ::
190
288
191−Insert the elements of a list `b` into a set `a`.
192−
193−`a` is a [set]().
194
289
195−`b` is a [list]().
290+Examples
291+--------
196
292
197 ~zod/try=> b
293 ~zod/try=> b
198 {'bonita' 'madeleine' 'rudolf' 'john'}
294 {'bonita' 'madeleine' 'rudolf' 'john'}
@@ -207,6 +303,23 @@ Insert the elements of a list `b` into a set `a`.
207
303
208b in a?
304b in a?
209
305
306+Checks if `b` is an element of `a`, producing a boolean.
307+
308+Accepts
309+-------
310+
311+`a` is a [`++set`]().
312+
313+`b` is a [noun]().
314+
315+Produces
316+--------
317+
318+A boolean.
319+
320+Source
321+------
322+
210 +- has :: b exists in a check
323 +- has :: b exists in a check
211 ~/ %has
324 ~/ %has
212 |* b=*
325 |* b=*
@@ -220,11 +333,9 @@ b in a?
220 $(a r.a)
333 $(a r.a)
221 ::
334 ::
222
335
223−Checks if `b` is an element of `a`, producing a loobean.
224
336
225−`a` is a [set]().
337+Examples
226−
338+--------
227−`b` is a [noun]().
228
339
229 ~zod/try=> =a (~(gas in `(set ,@t)`~) `(list ,@t)`[`a` `b` `c` ~])
340 ~zod/try=> =a (~(gas in `(set ,@t)`~) `(list ,@t)`[`a` `b` `c` ~])
230 ~zod/try=> (~(has in a) `a`)
341 ~zod/try=> (~(has in a) `a`)
@@ -238,6 +349,24 @@ Checks if `b` is an element of `a`, producing a loobean.
238
349
239Intersection
350Intersection
240
351
352+Produces a set of the intersection between two [`++set`]()s of the same type,
353+`a` and `b`.
354+
355+Accepts
356+-------
357+
358+`a` is a set.
359+
360+`b` is a set.
361+
362+Produces
363+--------
364+
365+A [`++set`]().
366+
367+Source
368+------
369+
241 +- int :: intersection
370 +- int :: intersection
242 ~/ %int
371 ~/ %int
243 |* b=_a
372 |* b=_a
@@ -254,12 +383,9 @@ Intersection
254 %- uni(+< $(a l.a, b [n.b l.b ~])) $(b r.b)
383 %- uni(+< $(a l.a, b [n.b l.b ~])) $(b r.b)
255 %- uni(+< $(a r.a, b [n.b ~ r.b])) $(b l.b)
384 %- uni(+< $(a r.a, b [n.b ~ r.b])) $(b l.b)
256
385
257−Produces a set of the intersection between two sets of the same type,
258−`a` and `b`.
259−
260−`a` is a [set]().
261
386
262−`b` is a [set]().
387+Examples
388+--------
263
389
264 ~zod/try=> (~(int in (sa "ac")) (sa "ha"))
390 ~zod/try=> (~(int in (sa "ac")) (sa "ha"))
265 {~~a}
391 {~~a}
@@ -276,6 +402,23 @@ Produces a set of the intersection between two sets of the same type,
276
402
277Put b in a
403Put b in a
278
404
405+Add an element `b` to the [`++set`]() `a`.
406+
407+Accepts
408+-------
409+
410+`a` is a set.
411+
412+`b` is a [noun]().
413+
414+Produces
415+--------
416+
417+A [`++set`]().
418+
419+Source
420+------
421+
279 +- put :: puts b in a
422 +- put :: puts b in a
280 ~/ %put
423 ~/ %put
281 |* b=*
424 |* b=*
@@ -297,11 +440,9 @@ Put b in a
297 [n.c [n.a l.a l.c] r.c]
440 [n.c [n.a l.a l.c] r.c]
298 ::
441 ::
299
442
300−Add an element `b` to the set `a`.
301−
302−`a` is a [set]().
303
443
304−`b` is a [noun]().
444+Examples
445+--------
305
446
306 ~zod/try=> =a (~(gas in `(set ,@t)`~) `(list ,@t)`[`a` `b` `c` ~])
447 ~zod/try=> =a (~(gas in `(set ,@t)`~) `(list ,@t)`[`a` `b` `c` ~])
307 ~zod/try=> =b (~(put in a) `d`)
448 ~zod/try=> =b (~(put in a) `d`)
@@ -316,6 +457,25 @@ Add an element `b` to the set `a`.
316
457
317Accumulate
458Accumulate
318
459
460+Accumulate the elements of `a` using a [gate]() `c` and an accumulator `b`.
461+
462+Accepts
463+--------
464+
465+`a` is a [`++set`]().
466+
467+`b` is a [noun]().
468+
469+`c` is a gate.
470+
471+Produces
472+--------
473+
474+A noun.
475+
476+Source
477+------
478+
319 +- rep :: replace by tile
479 +- rep :: replace by tile
320 |* [b=* c=_,*]
480 |* [b=* c=_,*]
321 |-
481 |-
@@ -323,13 +483,9 @@ Accumulate
323 $(a r.a, b $(a l.a, b (c n.a b)))
483 $(a r.a, b $(a l.a, b (c n.a b)))
324 ::
484 ::
325
485
326−Accumulate the elements of `a` using a gate `c` and an accumulator `b`.
327−
328−`a` is a [set]().
329−
330−`b` is a [noun]() that accepts a noun and produces a loobean.
331
486
332−`c` is a [gate]().
487+Examples
488+--------
333
489
334 ~zod/try=> =a (~(gas in *(set ,@)) [1 2 3 ~])
490 ~zod/try=> =a (~(gas in *(set ,@)) [1 2 3 ~])
335 ~zod/try=> a
491 ~zod/try=> a
@@ -343,6 +499,21 @@ Accumulate the elements of `a` using a gate `c` and an accumulator `b`.
343
499
344Set to list
500Set to list
345
501
502+Flattens the [`++set`]() `a` into a [`++list`]().
503+
504+Accepts
505+-------
506+
507+`a` is an set.
508+
509+Produces
510+--------
511+
512+A list.
513+
514+Source
515+------
516+
346 +- tap :: list tiles a set
517 +- tap :: list tiles a set
347 ~/ %tap
518 ~/ %tap
348 |= b=(list ,_?>(?=(^ a) n.a))
519 |= b=(list ,_?>(?=(^ a) n.a))
@@ -352,13 +523,9 @@ Set to list
352 $(a r.a, b [n.a $(a l.a)])
523 $(a r.a, b [n.a $(a l.a)])
353 ::
524 ::
354
525
355−Flatten the set `a` into a list.
356−
357−`a` is an [set]().
358−
359−`a` is a [set]().
360
526
361−`b` is a [list]().
527+Examples
528+--------
362
529
363 ~zod/try=> =s (sa `(list ,@t)`['a' 'b' 'c' 'd' 'e' ~])
530 ~zod/try=> =s (sa `(list ,@t)`['a' 'b' 'c' 'd' 'e' ~])
364 ~zod/try=> s
531 ~zod/try=> s
@@ -376,6 +543,24 @@ Flatten the set `a` into a list.
376
543
377Union
544Union
378
545
546+Produces a set of the union between two [`++set`]()s of the same type, `a` and
547+`b`.
548+
549+Accepts
550+-------
551+
552+`a` is a set.
553+
554+`b` is a set.
555+
556+Produces
557+--------
558+
559+A set.
560+
561+Source
562+------
563+
379 +- uni :: union
564 +- uni :: union
380 ~/ %uni
565 ~/ %uni
381 |* b=_a
566 |* b=_a
@@ -396,12 +581,9 @@ Union
396 $(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
581 $(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
397 $(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
582 $(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
398
583
399−Produces a set of the union between two sets of the same type, `a` and
400−`b`.
401−
402−`a` is a [set]().
403
584
404−`b` is a [set]().
585+Examples
586+--------
405
587
406 ~zod/try=> (~(uni in (sa "ac")) (sa "ha"))
588 ~zod/try=> (~(uni in (sa "ac")) (sa "ha"))
407 {~~a ~~c ~~h}
589 {~~a ~~c ~~h}
@@ -418,13 +600,28 @@ Produces a set of the union between two sets of the same type, `a` and
418
600
419Set size
601Set size
420
602
603+Produce the number of elements in [`++set`]() `a` as an atom.
604+
605+Accepts
606+-------
607+
608+`a` is an set.
609+
610+Produces
611+--------
612+
613+An atom.
614+
615+Source
616+------
617+
421 +- wyt :: size of set
618 +- wyt :: size of set
422 |- ^- @
619 |- ^- @
423 ?~(a 0 +((add $(a l.a) $(a r.a))))
620 ?~(a 0 +((add $(a l.a) $(a r.a))))
424
621
425−Produce the number of elements in set `a` as an atom.
426
622
427−`a` is an [set]().
623+Examples
624+--------
428
625
429 ~zod/try=> =a (~(put in (~(put in (sa)) 'a')) 'b')
626 ~zod/try=> =a (~(put in (~(put in (sa)) 'a')) 'b')
430 ~zod/try=> ~(wyt in a)
627 ~zod/try=> ~(wyt in a)
docs/dev/hoon/library/2dc.md+149−36
@@ -3,20 +3,41 @@ section 2dC, queues
3
3
4### `++to`
4### `++to`
5
5
6−Queue engine
6+Queue operations
7−
8− ++ to :: queue engine
9− |/ a=(qeu)
10
7
11Container arm for queue operation arms. The contained arms inherit its
8Container arm for queue operation arms. The contained arms inherit its
12[sample]() `++qeu` `a`.
9[sample]() `++qeu` `a`.
13
10
11+Accepts
12+-------
13+
14`a` is a queue, [++qeu]().
14`a` is a queue, [++qeu]().
15
15
16+Source
17+------
18+
19+ ++ to :: queue engine
20+ |/ a=(qeu)
21+
16### `+-bal:to`
22### `+-bal:to`
17
23
18Balance
24Balance
19
25
26+Vertically rebalances queue `a`.
27+
28+Accepts
29+-------
30+
31+`a` is a [queue]().
32+
33+Produces
34+--------
35+
36+A [queue]().
37+
38+Source
39+------
40+
20 +- bal
41 +- bal
21 |- ^+ a
42 |- ^+ a
22 ?~ a ~
43 ?~ a ~
@@ -27,9 +48,8 @@ Balance
27 a
48 a
28 ::
49 ::
29
50
30−Vertically rebalances queue `a`.
51+Examples
31−
52+--------
32−`a` is a [queue]().
33
53
34 ~zod/try=> `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~]
54 ~zod/try=> `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~]
35 {"a" "b" "c" "d" "e" "f" "g"}
55 {"a" "b" "c" "d" "e" "f" "g"}
@@ -46,15 +66,29 @@ Vertically rebalances queue `a`.
46
66
47Maximum Depth
67Maximum Depth
48
68
69+Produces the maximum depth of leaves (r.a and l.a) in queue `a`.
70+
71+Accepts
72+-------
73+
74+`a` is a [queue]().
75+
76+Produces
77+--------
78+
79+An atom.
80+
81+Source
82+------
83+
49 +- dep :: max depth of queue
84 +- dep :: max depth of queue
50 |- ^- @
85 |- ^- @
51 ?~ a 0
86 ?~ a 0
52 +((max $(a l.a) $(a r.a)))
87 +((max $(a l.a) $(a r.a)))
53 ::
88 ::
54
89
55−Produces the maximum depth of leaves (r.a and l.a) in queue `a`.
90+Examples
56−
91+--------
57−`a` is a [queue]().
58
92
59 ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 5 6 7 ~])
93 ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 5 6 7 ~])
60 ~zod/try=> ~(dep to a)
94 ~zod/try=> ~(dep to a)
@@ -76,18 +110,32 @@ Produces the maximum depth of leaves (r.a and l.a) in queue `a`.
76
110
77Push list
111Push list
78
112
79− +- gas :: insert list to queue
113+Push all elements of [`++list`]() `b` into the [`++queue`]().
80− |= b=(list ,_?>(?=(^ a) n.a))
81− |- ^+ a
82− ?~(b a $(b t.b, a (put(+< a) i.b)))
83− ::
84
114
85−Push all elements of list `b` into the queue.
115+Accepts
116+-------
86
117
87−`a` is a [queue]().
118+`a` is a queue.
88
119
89`b` is a list.
120`b` is a list.
90
121
122+Produces
123+--------
124+
125+A queue.
126+
127+Source
128+------
129+
130+ +- gas :: insert list to queue
131+ |= b=(list ,_?>(?=(^ a) n.a))
132+ |- ^+ a
133+ ?~(b a $(b t.b, a (put(+< a) i.b)))
134+ ::
135+
136+Examples
137+--------
138+
91 ~zod/try=> (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 ~])
139 ~zod/try=> (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 ~])
92 {3 2 1}
140 {3 2 1}
93 ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 ~])
141 ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 ~])
@@ -101,6 +149,21 @@ Push all elements of list `b` into the queue.
101
149
102Pop
150Pop
103
151
152+Produces the head and tail [`++queue`]() of `a`.
153+
154+Accepts
155+-------
156+
157+`a` is a queue.
158+
159+Produces
160+--------
161+
162+The last element in `a` along with the rest of queue `a`.
163+
164+Source
165+------
166+
104 +- get :: head-tail pair
167 +- get :: head-tail pair
105 |- ^+ [p=?>(?=(^ a) n.a) q=a]
168 |- ^+ [p=?>(?=(^ a) n.a) q=a]
106 ?~ a
169 ?~ a
@@ -114,9 +177,8 @@ Pop
114 [n.q.b [n.a l.a l.q.b] r.q.b]
177 [n.q.b [n.a l.a l.q.b] r.q.b]
115 ::
178 ::
116
179
117−Produces the head and tail queue of `a`.
180+Examples
118−
181+--------
119−`a` is a [queue]().
120
182
121 ~zod/try=> =s (~(gas to *(qeu ,@)) `(list ,@)`~[1 2 3])
183 ~zod/try=> =s (~(gas to *(qeu ,@)) `(list ,@)`~[1 2 3])
122 ~zod/try=> ~(get to s)
184 ~zod/try=> ~(get to s)
@@ -128,7 +190,22 @@ Produces the head and tail queue of `a`.
128
190
129### `+-nap:to`
191### `+-nap:to`
130
192
131−Remove last in
193+Remove last element
194+
195+Removes the head of [`++queue`]() `a`, producing the resulting queue.
196+
197+Accepts
198+-------
199+
200+`a` is a [queue]().
201+
202+Produces
203+--------
204+
205+A queue.
206+
207+Source
208+------
132
209
133 +- nap :: removes head
210 +- nap :: removes head
134 ?> ?=(^ a)
211 ?> ?=(^ a)
@@ -137,9 +214,8 @@ Remove last in
137 bal(+< ^+(a [p.b q.b r.a]))
214 bal(+< ^+(a [p.b q.b r.a]))
138 ::
215 ::
139
216
140−Removes the head of queue `a`, producing the resulting queue.
217+Examples
141−
218+--------
142−`a` is a [queue]().
143
219
144 ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 5 6 ~])
220 ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 5 6 ~])
145 ~zod/try=> -.a
221 ~zod/try=> -.a
@@ -158,6 +234,24 @@ Removes the head of queue `a`, producing the resulting queue.
158
234
159Insert
235Insert
160
236
237+Accept any [noun]() `b` and adds to [`++queue`]() `a` as the head, producing the
238+resulting queue.
239+
240+Accepts
241+-------
242+
243+`a` is a [queue]().
244+
245+`b` is any noun.
246+
247+Produces
248+--------
249+
250+A queue.
251+
252+Source
253+------
254+
161 +- put :: insert new tail
255 +- put :: insert new tail
162 |* b=*
256 |* b=*
163 |- ^+ a
257 |- ^+ a
@@ -166,12 +260,8 @@ Insert
166 bal(+< a(l $(a l.a)))
260 bal(+< a(l $(a l.a)))
167 ::
261 ::
168
262
169−Accept any noun `b` and adds to queue `a` as the head, producing the
263+Examples
170−resulting queue.
264+--------
171−
172−`a` is a [queue]().
173−
174−`b` is any noun.
175
265
176 ~zod/try=> (~(gas to `(qeu ,@)`~) `(list ,@)`[3 1 2 4 5 6 ~])
266 ~zod/try=> (~(gas to `(qeu ,@)`~) `(list ,@)`[3 1 2 4 5 6 ~])
177 ~zod/try=> (~(put to a) 7)
267 ~zod/try=> (~(put to a) 7)
@@ -183,6 +273,16 @@ resulting queue.
183
273
184Queue to list
274Queue to list
185
275
276+Produces [`++queue`]() `a` as a [`++list`]() from front to back.
277+
278+Accepts
279+-------
280+
281+`a` is a [queue]().
282+
283+Source
284+------
285+
186 +- tap :: queue to list
286 +- tap :: queue to list
187 |= b=(list ,_?>(?=(^ a) n.a))
287 |= b=(list ,_?>(?=(^ a) n.a))
188 ^+ b
288 ^+ b
@@ -191,9 +291,8 @@ Queue to list
191 $(a r.a, b [n.a $(a l.a)])
291 $(a r.a, b [n.a $(a l.a)])
192 ::
292 ::
193
293
194−Produces queue `a` as a list from front to back.
294+Examples
195−
295+--------
196−`a` is a [queue]().
197
296
198 ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[3 1 2 4 5 6 ~])
297 ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[3 1 2 4 5 6 ~])
199 ~zod/try=> `*`a
298 ~zod/try=> `*`a
@@ -205,14 +304,28 @@ Produces queue `a` as a list from front to back.
205
304
206### `+-top:to`
305### `+-top:to`
207
306
307+Produces the head of [`++queue`]() `a` as a [`++unit`]() (an empty queue has no head).
308+
309+Accepts
310+-------
311+
312+`a` is a [queue]().
313+
314+Produces
315+--------
316+
317+A unit.
318+
319+Source
320+------
321+
208 +- top :: produces head
322 +- top :: produces head
209 |- ^- (unit ,_?>(?=(^ a) n.a))
323 |- ^- (unit ,_?>(?=(^ a) n.a))
210 ?~ a ~
324 ?~ a ~
211 ?~(r.a [~ n.a] $(a r.a))
325 ?~(r.a [~ n.a] $(a r.a))
212
326
213−Produces the head of queue `a` as a unit (an empty queue has no head).
327+Examples
214−
328+--------
215−`a` is a [queue]().
216
329
217 ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 5 6 ~])
330 ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 5 6 ~])
218 ~zod/try=> ~(top to a)
331 ~zod/try=> ~(top to a)
docs/dev/hoon/library/2dd.md+51−8
@@ -5,6 +5,21 @@ section 2dD, casual containers
5
5
6Map from list
6Map from list
7
7
8+Produces a map of key-value pairs from the left-right cell pairs of list
9+
10+Accepts
11+-------
12+
13+`a` is a [`++list`]().
14+
15+Produces
16+--------
17+
18+A [`++map]()
19+
20+Source
21+------
22+
8 ++ mo :: map from list
23 ++ mo :: map from list
9 |* a=(list)
24 |* a=(list)
10 => .(a `_(homo a)`a)
25 => .(a `_(homo a)`a)
@@ -13,10 +28,8 @@ Map from list
13 (~(gas by b) a)
28 (~(gas by b) a)
14 ::
29 ::
15
30
16−Produces a map of key-value pairs from the left-right cell pairs of list
31+Examples
17−`a`.
32+--------
18−
19−`a` is a [list]().
20
33
21 ~zod/try=> (mo `(list ,[@t *])`[[`a` 1] [`b` 2] ~])
34 ~zod/try=> (mo `(list ,[@t *])`[[`a` 1] [`b` 2] ~])
22 {[p=`a` q=1] [p=`b` q=2]}
35 {[p=`a` q=1] [p=`b` q=2]}
@@ -27,6 +40,21 @@ Produces a map of key-value pairs from the left-right cell pairs of list
27
40
28Set from list
41Set from list
29
42
43+Produces a set of the elements in list `a`.
44+
45+Accepts
46+-------
47+
48+`a` is a [list]().
49+
50+Produces
51+--------
52+
53+A [`++set`]().
54+
55+Source
56+------
57+
30 ++ sa :: set from list
58 ++ sa :: set from list
31 |* a=(list)
59 |* a=(list)
32 => .(a `_(homo a)`a)
60 => .(a `_(homo a)`a)
@@ -34,9 +62,9 @@ Set from list
34 (~(gas in b) a)
62 (~(gas in b) a)
35 ::
63 ::
36
64
37−Produces a set of the elements in list `a`.
38
65
39−`a` is a [list]().
66+Examples
67+--------
40
68
41 ~zod/try=> (sa `(list ,@)`[1 2 3 4 5 ~])
69 ~zod/try=> (sa `(list ,@)`[1 2 3 4 5 ~])
42 {5 4 1 3 2}
70 {5 4 1 3 2}
@@ -49,15 +77,30 @@ Produces a set of the elements in list `a`.
49
77
50Queue from list
78Queue from list
51
79
80+Produces a queue from list `a`.
81+
82+Accepts
83+-------
84+
85+`a` is a [list]().
86+
87+Produces
88+--------
89+
90+A [`++que`]().
91+
92+Source
93+------
94+
52 ++ qu :: queue from list
95 ++ qu :: queue from list
53 |* a=(list)
96 |* a=(list)
54 => .(a `_(homo a)`a)
97 => .(a `_(homo a)`a)
55 =+ b=*(qeu ,_?>(?=(^ a) i.a))
98 =+ b=*(qeu ,_?>(?=(^ a) i.a))
56 (~(gas to b) a)
99 (~(gas to b) a)
57
100
58−Produces a queue from list `a`.
59
101
60−`a` is a [list]().
102+Examples
103+--------
61
104
62 ~zod/try=> (qu `(list ,@ud)`~[1 2 3 5])
105 ~zod/try=> (qu `(list ,@ud)`~[1 2 3 5])
63 {5 3 2 1}
106 {5 3 2 1}
docs/dev/hoon/library/2ea.md+77−15
@@ -5,6 +5,21 @@ section 2eA, packing
5
5
6Unpack atom to noun
6Unpack atom to noun
7
7
8+Produces a noun unpacked from atom `a`. The inverse of jam.
9+
10+Accepts
11+-------
12+
13+`a` is an [atom]().
14+
15+Produces
16+--------
17+
18+A [`++noun`]().
19+
20+Source
21+------
22+
8 ++ cue :: unpack atom to noun
23 ++ cue :: unpack atom to noun
9 ~/ %cue
24 ~/ %cue
10 |= a=@
25 |= a=@
@@ -26,9 +41,9 @@ Unpack atom to noun
26 [(add 2 p.d) (need (~(get by m) q.d)) m]
41 [(add 2 p.d) (need (~(get by m) q.d)) m]
27 ::
42 ::
28
43
29−Produces a noun unpacked from atom `a`. The inverse of jam.
30
44
31−`a` is an [atom]().
45+Examples
46+--------
32
47
33 ~zod/try=> (cue 12)
48 ~zod/try=> (cue 12)
34 1
49 1
@@ -43,6 +58,23 @@ Produces a noun unpacked from atom `a`. The inverse of jam.
43
58
44### `++jam`
59### `++jam`
45
60
61+Unpack noun to atom
62+
63+Produces an atom unpacked from noun `a`. The inverse of cue.
64+
65+Accepts
66+-------
67+
68+`a` is a [noun]().
69+
70+Produces
71+--------
72+
73+An atom.
74+
75+Source
76+------
77+
46 ++ jam :: pack
78 ++ jam :: pack
47 ~/ %jam
79 ~/ %jam
48 |= a=*
80 |= a=*
@@ -68,9 +100,9 @@ Produces a noun unpacked from atom `a`. The inverse of jam.
68 [(add 2 p.d) (mix 3 (lsh 0 2 q.d)) m]
100 [(add 2 p.d) (mix 3 (lsh 0 2 q.d)) m]
69 ::
101 ::
70
102
71−Produces an atom unpacked from noun `a`. The inverse of cue.
72
103
73−`a` is a [noun]().
104+Examples
105+--------
74
106
75 ~zod/try=> (jam 1)
107 ~zod/try=> (jam 1)
76 12
108 12
@@ -87,6 +119,23 @@ Produces an atom unpacked from noun `a`. The inverse of cue.
87
119
88Length-encode
120Length-encode
89
121
122+Produces a cell whose tail `q` is atom `a` with a bit representation of
123+its length prepended to it (as the least significant bits). The head `p`
124+is the length of `q` in bits.
125+
126+Accepts
127+-------
128+
129+`a` is an atom.
130+
131+Produces
132+--------
133+
134+A cell of two atoms, `p` and `q`.
135+
136+Source
137+------
138+
90 ++ mat :: length-encode
139 ++ mat :: length-encode
91 ~/ %mat
140 ~/ %mat
92 |= a=@
141 |= a=@
@@ -98,11 +147,9 @@ Length-encode
98 :- (add (add c c) b)
147 :- (add (add c c) b)
99 (cat 0 (bex c) (mix (end 0 (dec c) b) (lsh 0 (dec c) a)))
148 (cat 0 (bex c) (mix (end 0 (dec c) b) (lsh 0 (dec c) a)))
100
149
101−Produces a cell whose tail `q` is atom `a` with a bit representation of
102−its length prepended to it (as the least significant bits). The head `p`
103−is the length of `q` in bits.
104
150
105−`a` is an atom.
151+Examples
152+--------
106
153
107 ~zod/try=> (mat 0xaaa)
154 ~zod/try=> (mat 0xaaa)
108 [p=20 q=699.024]
155 [p=20 q=699.024]
@@ -127,6 +174,26 @@ is the length of `q` in bits.
127
174
128Length-decode
175Length-decode
129
176
177+The inverse of `++mat`. Accepts a cell of index `a` and a bitstring `b`
178+and produces the cell whose tail `q` is the decoded atom at index `a`
179+and whose head is the length of the encoded atom `q`, by which the
180+offset `a` is advanced. Only used internally as a helper cue.
181+
182+Accepts
183+-------
184+
185+`a` is an atom.
186+
187+`b` is a bitstring as an atom.
188+
189+Produces
190+--------
191+
192+A cell of two atoms, `p` and `q`.
193+
194+Source
195+------
196+
130 ++ rub :: length-decode
197 ++ rub :: length-decode
131 ~/ %rub
198 ~/ %rub
132 |= [a=@ b=@]
199 |= [a=@ b=@]
@@ -143,14 +210,9 @@ Length-decode
143 =+ e=(add (bex (dec c)) (cut 0 [d (dec c)] b))
210 =+ e=(add (bex (dec c)) (cut 0 [d (dec c)] b))
144 [(add (add c c) e) (cut 0 [(add d (dec c)) e] b)]
211 [(add (add c c) e) (cut 0 [(add d (dec c)) e] b)]
145
212
146−The inverse of `++mat`. Accepts a cell of index `a` and a bitstring `b`
147−and produces the cell whose tail `q` is the decoded atom at index `a`
148−and whose head is the length of the encoded atom `q`, by which the
149−offset `a` is advanced. Only used internally as a helper cue.
150
213
151−`a` is an atom.
214+Examples
152−
215+--------
153−`b` is a bitstring as an atom.
154
216
155 ~zod/try=> `@ub`(jam 0xaaa)
217 ~zod/try=> `@ub`(jam 0xaaa)
156 0b1.0101.0101.0101.0010.0000
218 0b1.0101.0101.0101.0010.0000
docs/dev/hoon/library/2eb.md+40−10
@@ -5,6 +5,24 @@ section 2eB, parsing (tracing)
5
5
6Farther trace
6Farther trace
7
7
8+Compares two line-column pairs, called [`++hair`]()s, `zyc` and `naz`, producing whichever
9+is further along.
10+
11+Accepts
12+-------
13+
14+`naz` is a [hair]().
15+
16+`zyc` is a [hair]().
17+
18+Produces
19+--------
20+
21+a `++hair`.
22+
23+Source
24+------
25+
8 ++ last |= [zyc=hair naz=hair] :: farther trace
26 ++ last |= [zyc=hair naz=hair] :: farther trace
9 ^- hair
27 ^- hair
10 ?: =(p.zyc p.naz)
28 ?: =(p.zyc p.naz)
@@ -12,12 +30,9 @@ Farther trace
12 ?:((gth p.zyc p.naz) zyc naz)
30 ?:((gth p.zyc p.naz) zyc naz)
13 ::
31 ::
14
32
15−Compares two line-column pairs, `zyc` and `naz`, and produces whichever
16−[hair]() is farther along.
17
33
18−`zyc` is a [hair]().
34+Examples
19−
35+--------
20−`naz` is a [hair]().
21
36
22 ~zod/try=> (last [1 1] [1 2])
37 ~zod/try=> (last [1 1] [1 2])
23 [p=1 q=2]
38 [p=1 q=2]
@@ -34,16 +49,31 @@ Compares two line-column pairs, `zyc` and `naz`, and produces whichever
34
49
35Detect newline
50Detect newline
36
51
52+Advances the [`++hair`]() `naz` by a row if the [`++char`]() `weq` is a newline, or by a
53+column if `weq` is any other character.
54+
55+Accepts
56+-------
57+
58+`weq` is a char.
59+
60+`naz` is a hair.
61+
62+Produces
63+--------
64+
65+A hair.
66+
67+Source
68+------
69+
37 ++ lust |= [weq=char naz=hair] :: detect newline
70 ++ lust |= [weq=char naz=hair] :: detect newline
38 ^- hair
71 ^- hair
39 ?:(=(10 weq) [+(p.naz) 1] [p.naz +(q.naz)])
72 ?:(=(10 weq) [+(p.naz) 1] [p.naz +(q.naz)])
40
73
41−Advances the hair `naz` by a row if the char `weq` is a newline, or by a
42−column if `weq` is any other character.
43
74
44−`weq` is a [char]().
75+Examples
45−
76+--------
46−`naz` is a [hair]().
47
77
48 ~zod/try=> (lust `a` [1 1])
78 ~zod/try=> (lust `a` [1 1])
49 [p=1 q=2]
79 [p=1 q=2]
docs/dev/hoon/library/2ec.md+358−87
@@ -5,6 +5,24 @@ section 2eC, parsing (custom rules)
5
5
6Replace with constant
6Replace with constant
7
7
8+Parser modifier. Accepts a [`++rule`]() `sef` and produces a parser that
9+produces a constant `cus`, assuming `sef` is successful.
10+
11+Accepts
12+-------
13+
14+`cus` is a constant [noun]().
15+
16+`sef` is a `++rule`.
17+
18+Produces
19+--------
20+
21+An [`++edge`]().
22+
23+Source
24+------
25+
8 ++ cold :: replace w/ constant
26 ++ cold :: replace w/ constant
9 ~/ %cold
27 ~/ %cold
10 |* [cus=* sef=_rule]
28 |* [cus=* sef=_rule]
@@ -16,12 +34,8 @@ Replace with constant
16 [p=p.vex q=[~ u=[p=cus q=q.u.q.vex]]]
34 [p=p.vex q=[~ u=[p=cus q=q.u.q.vex]]]
17 ::
35 ::
18
36
19−Parser modifier. Accepts a rule `sef` and produces a parser that
37+Examples
20−produces a constant `cus`, if `sef` is successful.
38+--------
21−
22−`cus` is a constant [noun]().
23−
24−`sef` is a [`++rule`]().
25
39
26 ~zod/try=> ((cold %foo (just 'a')) [[1 1] "abc"])
40 ~zod/try=> ((cold %foo (just 'a')) [[1 1] "abc"])
27 [p=[p=1 q=2] q=[~ u=[p=%foo q=[p=[p=1 q=2] q="bc"]]]]
41 [p=[p=1 q=2] q=[~ u=[p=%foo q=[p=[p=1 q=2] q="bc"]]]]
@@ -34,6 +48,24 @@ produces a constant `cus`, if `sef` is successful.
34
48
35Apply gate
49Apply gate
36
50
51+Parser modifier. Produces a parser that takes a (successful) result of a
52+[`++rule`]() `sef` and slams it through `poq`.
53+
54+Accepts
55+-------
56+
57+`poq` is a [gate]().
58+
59+`sef` is a [`++rule`]().
60+
61+Produces
62+--------
63+
64+An [`++rule`]().
65+
66+Source
67+------
68+
37 ++ cook :: apply gate
69 ++ cook :: apply gate
38 ~/ %cook
70 ~/ %cook
39 |* [poq=_,* sef=_rule]
71 |* [poq=_,* sef=_rule]
@@ -45,12 +77,8 @@ Apply gate
45 [p=p.vex q=[~ u=[p=(poq p.u.q.vex) q=q.u.q.vex]]]
77 [p=p.vex q=[~ u=[p=(poq p.u.q.vex) q=q.u.q.vex]]]
46 ::
78 ::
47
79
48−Parser modifier. Produces a parser that takes a (successful) result of a
80+Examples
49−rule `sef` and slams it through `poq`.
81+--------
50−
51−`poq` is a [gate]().
52−
53−`sef` is a [`++rule`]().
54
82
55 ~zod/try=> ((cook ,@ud (just 'a')) [[1 1] "abc"])
83 ~zod/try=> ((cook ,@ud (just 'a')) [[1 1] "abc"])
56 [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]]
84 [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]]
@@ -67,6 +95,22 @@ rule `sef` and slams it through `poq`.
67
95
68Always parse
96Always parse
69
97
98+Parser generator. Produces a parser that succeeds with given [noun]() `huf`
99+without consuming any text.
100+
101+Accepts
102+-------
103+
104+`huf` is a noun.
105+
106+Produces
107+--------
108+
109+A [`++rule`]().
110+
111+Source
112+------
113+
70 ++ easy :: always parse
114 ++ easy :: always parse
71 ~/ %easy
115 ~/ %easy
72 |* huf=*
116 |* huf=*
@@ -76,8 +120,8 @@ Always parse
76 [p=p.tub q=[~ u=[p=huf q=tub]]]
120 [p=p.tub q=[~ u=[p=huf q=tub]]]
77 ::
121 ::
78
122
79−Parser generator. Produces a parser that succeeds with given noun `huf`
123+Examples
80−without consuming any text.
124+--------
81
125
82 ~zod/try=> ((easy %foo) [[1 1] "abc"])
126 ~zod/try=> ((easy %foo) [[1 1] "abc"])
83 [p=[p=1 q=1] q=[~ [p=%foo q=[p=[p=1 q=1] q="abc"]]]]
127 [p=[p=1 q=1] q=[~ [p=%foo q=[p=[p=1 q=1] q="abc"]]]]
@@ -92,13 +136,27 @@ without consuming any text.
92
136
93Never parse
137Never parse
94
138
95− ++ fail |=(tub=nail [p=p.tub q=~]) :: never parse
96−
97−Produces an [edge]() at the same text position ([hair]()) with a failing
139+Produces an [`++edge`]() at the same text position ([`++hair`]()) with a failing
98result (`q=~`).
140result (`q=~`).
99
141
142+Accepts
143+-------
144+
100`tub` is a [`++nail`]().
145`tub` is a [`++nail`]().
101
146
147+Produces
148+--------
149+
150+An `++edge`.
151+
152+Source
153+------
154+
155+ ++ fail |=(tub=nail [p=p.tub q=~]) :: never parse
156+
157+Examples
158+--------
159+
102 ~zod/try=> (fail [[1 1] "abc"])
160 ~zod/try=> (fail [[1 1] "abc"])
103 [p=[p=1 q=1] q=~]
161 [p=[p=1 q=1] q=~]
104 ~zod/try=> (fail [[p=1.337 q=70] "Parse me, please?"])
162 ~zod/try=> (fail [[p=1.337 q=70] "Parse me, please?"])
@@ -110,6 +168,22 @@ result (`q=~`).
110
168
111Parse to end
169Parse to end
112
170
171+Parser modifier. Accepts a [`++rule`]() `sef`, and produces a parser that succeeds only
172+when the of `tub` is fully consumed using `sef`.
173+
174+Accepts
175+-------
176+
177+`sef` is a [`++rule`]().
178+
179+Produces
180+--------
181+
182+A `++rule`.
183+
184+Source
185+------
186+
113 ++ full :: parse to end
187 ++ full :: parse to end
114 |* sef=_rule
188 |* sef=_rule
115 |= tub=nail
189 |= tub=nail
@@ -117,10 +191,8 @@ Parse to end
117 ?~(q.vex vex ?:(=(~ q.q.u.q.vex) vex [p=p.vex q=~]))
191 ?~(q.vex vex ?:(=(~ q.q.u.q.vex) vex [p=p.vex q=~]))
118 ::
192 ::
119
193
120−Accepts a [`++nail`](), `tub`, and produces a parser that succeeds only
194+Examples
121−when a `tub` success consumes the remainder of the [tape]().
195+--------
122−
123−`sef` is a [`++rule`]().
124
196
125 ~zod/try=> ((full (just 'a')) [[1 1] "ab"])
197 ~zod/try=> ((full (just 'a')) [[1 1] "ab"])
126 [p=[p=1 q=2] q=~]
198 [p=[p=1 q=2] q=~]
@@ -135,17 +207,31 @@ when a `tub` success consumes the remainder of the [tape]().
135
207
136Add to tape
208Add to tape
137
209
210+Parser modifier: prepend text to [`++tape`]() before applying parser.
211+
212+Accepts
213+-------
214+
215+`pre` is a `++tape`
216+
217+`sef` is a [`++rule`]()
218+
219+Produces
220+--------
221+
222+A `++rule`.
223+
224+Source
225+------
226+
138 ++ funk :: add to tape first
227 ++ funk :: add to tape first
139 |* [pre=tape sef=_rule]
228 |* [pre=tape sef=_rule]
140 |= tub=nail
229 |= tub=nail
141 (sef p.tub (weld pre q.tub))
230 (sef p.tub (weld pre q.tub))
142 ::
231 ::
143
232
144−Parser modifier: prepend text to tape before applying parser.
233+Examples
145−
234+--------
146−`pre` is a [`++tape`]()
147−
148−`sef` is a [`++rule`]()
149
235
150 ~zod/try=> ((funk "abc prefix-" (jest 'abc')) [[1 1] "to be parsed"])
236 ~zod/try=> ((funk "abc prefix-" (jest 'abc')) [[1 1] "to be parsed"])
151 [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=" prefix-to be parsed"]]]]
237 [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=" prefix-to be parsed"]]]]
@@ -158,6 +244,25 @@ Parser modifier: prepend text to tape before applying parser.
158
244
159Place-based apply
245Place-based apply
160
246
247+Parser modifier. Similar to [`++cook`]() in that it produces a parser that takes a
248+(successful) result of `sef` and slams it through `hez`. `hez` accepts a
249+[`++pint`]() `a` and a [noun]() `b`, which is what the parser parsed.
250+
251+Accepts
252+-------
253+
254+`hez` is a [gate]().
255+
256+`sef` is a [`++rule`]()
257+
258+Produces
259+--------
260+
261+A `++rule`.
262+
263+Source
264+------
265+
161 ++ here :: place-based apply
266 ++ here :: place-based apply
162 ~/ %here
267 ~/ %here
163 |* [hez=_|=([a=pint b=*] [a b]) sef=_rule]
268 |* [hez=_|=([a=pint b=*] [a b]) sef=_rule]
@@ -169,13 +274,8 @@ Place-based apply
169 [p=p.vex q=[~ u=[p=(hez [p.tub p.q.u.q.vex] p.u.q.vex) q=q.u.q.vex]]]
274 [p=p.vex q=[~ u=[p=(hez [p.tub p.q.u.q.vex] p.u.q.vex) q=q.u.q.vex]]]
170 ::
275 ::
171
276
172−Parser modifier. Similar to [`++cook`](), produces a parser that takes a
277+Examples
173−(successful) result of `sef` and slams it through `hez`. `hez` accepts a
278+--------
174−[`++pint`]() `a` and a noun `b`, which is what the parser parsed.
175−
176−`hez` is a [gate]().
177−
178−`sef` is a [`++rule`]()
179
279
180 ~zod/try=> (scan "abc" (star alf))
280 ~zod/try=> (scan "abc" (star alf))
181 "abc"
281 "abc"
@@ -190,6 +290,22 @@ Parser modifier. Similar to [`++cook`](), produces a parser that takes a
190
290
191Indentation block
291Indentation block
192
292
293+Apply [`++rule`]() to indented block starting at current column number, omitting
294+the leading whitespace.
295+
296+Accepts
297+-------
298+
299+`sef` is a [`++rule`]()
300+
301+Produces
302+--------
303+
304+A `++rule`.
305+
306+Source
307+------
308+
193 ++ inde |* sef=_rule :: indentation block
309 ++ inde |* sef=_rule :: indentation block
194 |= nail ^+ (sef)
310 |= nail ^+ (sef)
195 =+ [har tap]=[p q]:+<
311 =+ [har tap]=[p q]:+<
@@ -210,10 +326,8 @@ Indentation block
210 (welp [`@t`10 (trip lev)] $(res +.res))
326 (welp [`@t`10 (trip lev)] $(res +.res))
211 ::
327 ::
212
328
213−Apply rule to indented block starting at current column number, omitting
329+Examples
214−the leading whitespace.
330+--------
215−
216−`sef` is a [`++rule`]()
217
331
218 ~zod/try=> (scan "abc" (inde (star ;~(pose prn (just `@`10)))))
332 ~zod/try=> (scan "abc" (inde (star ;~(pose prn (just `@`10)))))
219 "abc"
333 "abc"
@@ -235,6 +349,21 @@ the leading whitespace.
235
349
236Match a cord
350Match a cord
237
351
352+Match and consume a cord.
353+
354+Accepts
355+-------
356+
357+`daf` is a [`@t`]().
358+
359+Produces
360+--------
361+
362+An [`++edge`]().
363+
364+Source
365+------
366+
238 ++ jest :: match a cord
367 ++ jest :: match a cord
239 |= daf=@t
368 |= daf=@t
240 |= tub=nail
369 |= tub=nail
@@ -247,9 +376,8 @@ Match a cord
247 $(p.tub (lust i.q.tub p.tub), q.tub t.q.tub, daf (rsh 3 1 daf))
376 $(p.tub (lust i.q.tub p.tub), q.tub t.q.tub, daf (rsh 3 1 daf))
248 ::
377 ::
249
378
250−Match and consume a cord.
379+Examples
251−
380+--------
252−`daf` is a `@t`
253
381
254 ~zod/try=> ((jest 'abc') [[1 1] "abc"])
382 ~zod/try=> ((jest 'abc') [[1 1] "abc"])
255 [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=""]]]]
383 [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=""]]]]
@@ -270,6 +398,21 @@ Match and consume a cord.
270
398
271Match a char
399Match a char
272
400
401+Match and consume a single character.
402+
403+Accepts
404+-------
405+
406+`daf` is a [`++char`]()
407+
408+Produces
409+--------
410+
411+A [`++rule`]().
412+
413+Source
414+------
415+
273 ++ just :: XX redundant, jest
416 ++ just :: XX redundant, jest
274 ~/ %just :: match a char
417 ~/ %just :: match a char
275 |= daf=char
418 |= daf=char
@@ -283,9 +426,9 @@ Match a char
283 (next tub)
426 (next tub)
284 ::
427 ::
285
428
286−Match and consume a single character.
287
429
288−`daf` is a [`++char`]()
430+Examples
431+--------
289
432
290 ~zod/try=> ((just 'a') [[1 1] "abc"])
433 ~zod/try=> ((just 'a') [[1 1] "abc"])
291 [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
434 [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
@@ -304,6 +447,24 @@ Match and consume a single character.
304
447
305Recursive parsers
448Recursive parsers
306
449
450+Used for recursive parsers, which would otherwise be infinite when
451+compiled.
452+
453+Accepts
454+-------
455+
456+`gar` is a noun.
457+
458+`sef` is a [gate]() that accepts a [`++rule`]()
459+
460+Produces
461+--------
462+
463+A [`++rule`]().
464+
465+Source
466+------
467+
307 ++ knee :: callbacks
468 ++ knee :: callbacks
308 |* [gar=* sef=_|.(rule)]
469 |* [gar=* sef=_|.(rule)]
309 |= tub=nail
470 |= tub=nail
@@ -311,12 +472,8 @@ Recursive parsers
311 ((sef) tub)
472 ((sef) tub)
312 ::
473 ::
313
474
314−Used for recursive parsers, which would otherwise be infinite when
475+Examples
315−compiled.
476+--------
316−
317−`gar` is a noun.
318−
319−`sef` is a [gate]() that accepts a [`++rule`]()
320
477
321 ~zod/try=> |-(;~(plug prn ;~(pose $ (easy ~))))
478 ~zod/try=> |-(;~(plug prn ;~(pose $ (easy ~))))
322 ! rest-loop
479 ! rest-loop
@@ -345,6 +502,22 @@ compiled.
345
502
346Match char
503Match char
347
504
505+Parser generator. Matches the next character if it is in a list of
506+characters.
507+
508+Accepts
509+-------
510+
511+`bud` is a list of [`++char`]()
512+
513+Produces
514+--------
515+
516+A [`++rule`]().
517+
518+Source
519+------
520+
348 ++ mask :: match char in set
521 ++ mask :: match char in set
349 ~/ %mask
522 ~/ %mask
350 |= bud=(list char)
523 |= bud=(list char)
@@ -358,10 +531,8 @@ Match char
358 (next tub)
531 (next tub)
359 ::
532 ::
360
533
361−Parser generator. Matches the next character if it is in a list of
534+Examples
362−characters.
535+--------
363−
364−`bud` is a list of [`++char`]()
365
536
366 ~zod/try=> (scan "a" (mask "cba"))
537 ~zod/try=> (scan "a" (mask "cba"))
367 ~~a
538 ~~a
@@ -378,6 +549,21 @@ characters.
378
549
379Consume char
550Consume char
380
551
552+Consume any character, producing it as a result.
553+
554+Accepts
555+-------
556+
557+`tub` is a [`++nail`]()
558+
559+Produces
560+--------
561+
562+An [`++edge`]().
563+
564+Source
565+------
566+
381 ++ next :: consume a char
567 ++ next :: consume a char
382 |= tub=nail
568 |= tub=nail
383 ^- (like char)
569 ^- (like char)
@@ -387,9 +573,8 @@ Consume char
387 [zac [~ i.q.tub [zac t.q.tub]]]
573 [zac [~ i.q.tub [zac t.q.tub]]]
388 ::
574 ::
389
575
390−Consume any character, producing it as a result.
576+Examples
391−
577+--------
392−`tub` is a [`++nail`]()
393
578
394 ~zod/try=> (next [[1 1] "ebc"])
579 ~zod/try=> (next [[1 1] "ebc"])
395 [p=[p=1 q=2] q=[~ [p=~~e q=[p=[p=1 q=2] q="bc"]]]]
580 [p=[p=1 q=2] q=[~ [p=~~e q=[p=[p=1 q=2] q="bc"]]]]
@@ -402,6 +587,22 @@ Consume any character, producing it as a result.
402
587
403Conditional `++cook`
588Conditional `++cook`
404
589
590+Conditional [`++cook`](). Slams the result through a gate that produces
591+a unit; if that unit is empty, fail.
592+
593+Accepts
594+-------
595+
596+`tub` is a [`++nail`](/doc/hoon/library/1#++nail)
597+
598+Produces
599+--------
600+
601+A [`++rule`]().
602+
603+Source
604+------
605+
405 ++ sear :: conditional cook
606 ++ sear :: conditional cook
406 |* [pyq=_|=(* *(unit)) sef=_rule]
607 |* [pyq=_|=(* *(unit)) sef=_rule]
407 |= tub=nail
608 |= tub=nail
@@ -414,10 +615,8 @@ Conditional `++cook`
414 [p=p.vex q=[~ u=[p=u.gey q=q.u.q.vex]]]
615 [p=p.vex q=[~ u=[p=u.gey q=q.u.q.vex]]]
415 ::
616 ::
416
617
417−Conditional [`++cook`](). Slams the result through a gate that produces
618+Examples
418−a unit; if that unit is empty, fail.
619+--------
419−
420−`tub` is a [`++nail`](/doc/hoon/library/1#++nail)
421
620
422 ~zod/try=> ((sear |=(a=* ?@(a (some a) ~)) (just `a`)) [[1 1] "abc"])
621 ~zod/try=> ((sear |=(a=* ?@(a (some a) ~)) (just `a`)) [[1 1] "abc"])
423 [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]]
622 [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]]
@@ -430,6 +629,23 @@ a unit; if that unit is empty, fail.
430
629
431Char in range
630Char in range
432
631
632+Match characters ([`++char`]()) within a range.
633+
634+Accepts
635+-------
636+
637+`les` is an atom.
638+
639+`mos` is an atom.
640+
641+Produces
642+--------
643+
644+A [`++rule`]().
645+
646+Source
647+------
648+
433 ++ shim :: match char in range
649 ++ shim :: match char in range
434 ~/ %shim
650 ~/ %shim
435 |= [les=@ mos=@]
651 |= [les=@ mos=@]
@@ -443,9 +659,8 @@ Char in range
443 (next tub)
659 (next tub)
444 ::
660 ::
445
661
446−Match characters within a range.
662+Examples
447−
663+--------
448−`les` and `mos` are atoms, `@`.
449
664
450 ~zod/try=> ((shim 'a' 'z') [[1 1] "abc"])
665 ~zod/try=> ((shim 'a' 'z') [[1 1] "abc"])
451 [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
666 [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
@@ -460,6 +675,23 @@ Match characters within a range.
460
675
461Add label
676Add label
462
677
678+Add a label to an edge parsed by a rule.
679+
680+Accepts
681+-------
682+
683+`gob` is a noun.
684+
685+`sef` is a rule.
686+
687+Produces
688+--------
689+
690+A [`++rule`]().
691+
692+Source
693+------
694+
463 ++ stag :: add a label
695 ++ stag :: add a label
464 ~/ %stag
696 ~/ %stag
465 |* [gob=* sef=_rule]
697 |* [gob=* sef=_rule]
@@ -471,11 +703,8 @@ Add label
471 [p=p.vex q=[~ u=[p=[gob p.u.q.vex] q=q.u.q.vex]]]
703 [p=p.vex q=[~ u=[p=[gob p.u.q.vex] q=q.u.q.vex]]]
472 ::
704 ::
473
705
474−Add a label to an edge parsed by a rule.
706+Examples
475−
707+--------
476−`gob` is a noun.
477−
478−`sef` is a rule.
479
708
480 ~zod/try=> ((stag %foo (just 'a')) [[1 1] "abc"])
709 ~zod/try=> ((stag %foo (just 'a')) [[1 1] "abc"])
481 [p=[p=1 q=2] q=[~ u=[p=[%foo ~~a] q=[p=[p=1 q=2] q="bc"]]]]
710 [p=[p=1 q=2] q=[~ u=[p=[%foo ~~a] q=[p=[p=1 q=2] q="bc"]]]]
@@ -490,6 +719,21 @@ Add a label to an edge parsed by a rule.
490
719
491Add faces
720Add faces
492
721
722+Add faces `[p q]` to range-parser pairs in a list.
723+
724+Accepts
725+-------
726+
727+`leh` is a list of range-parsers.
728+
729+Produces
730+--------
731+
732+
733+
734+Source
735+------
736+
493 ++ stet
737 ++ stet
494 |* leh=(list ,[?(@ [@ @]) _rule])
738 |* leh=(list ,[?(@ [@ @]) _rule])
495 |-
739 |-
@@ -498,9 +742,8 @@ Add faces
498 [i=[p=-.i.leh q=+.i.leh] t=$(leh t.leh)]
742 [i=[p=-.i.leh q=+.i.leh] t=$(leh t.leh)]
499 ::
743 ::
500
744
501−Add `[p q]` faces to range-parser pairs in a list.
745+Examples
502−
746+--------
503−`leh` is a list of range-parsers.
504
747
505 ~zod/try=> (stet (limo [[5 (just 'a')] [1 (jest 'abc')] [[1 1] (shim 0 200)]
748 ~zod/try=> (stet (limo [[5 (just 'a')] [1 (jest 'abc')] [[1 1] (shim 0 200)]
506 [[1 10] (cold %foo (just 'a'))]~]))
749 [[1 10] (cold %foo (just 'a'))]~]))
@@ -572,9 +815,9 @@ Switch by first
572 $(hel r.hel)
815 $(hel r.hel)
573 ::
816 ::
574
817
575−Parser generator. From an associative list of characters or character
818+Parser generator. From an associative [`++list`]() of characters or character
576−ranges to rules, construct a map, and parse tapes only with rules
819+ranges to [`++rule`]()s, construct a [`++map`](), and parse [`++tape`]()s only
577−associated with a range the tape's first character falls in.
820+with `++rules` associated with a range that the `++tape`'s first character falls in.
578
821
579------------------------------------------------------------------------
822------------------------------------------------------------------------
580
823
@@ -582,7 +825,27 @@ associated with a range the tape's first character falls in.
582
825
583Parse repeatedly
826Parse repeatedly
584
827
828+Parse with [`++rule`]() as many times as possible, and fold over results with a
829+binary gate.
830+
831+Accepts
832+-------
833+
834+`rud` is a noun.
835+
836+`raq` is a gate that takes two nouns and produces a cell.
837+
838+`fel` is a rule.
839+
840+Produces
841+--------
842+
843+A rule.
844+
845+Source
846+------
847+
585− ++ stir :: parse repeatedly
848+++ stir :: parse repeatedly
586 ~/ %stir
849 ~/ %stir
587 |* [rud=* raq=_|*([a=* b=*] [a b]) fel=_rule]
850 |* [rud=* raq=_|*([a=* b=*] [a b]) fel=_rule]
588 ~/ %fun
851 ~/ %fun
@@ -596,14 +859,8 @@ Parse repeatedly
596 [(last p.vex p.wag) [~ (raq p.u.q.vex p.u.q.wag) q.u.q.wag]]
859 [(last p.vex p.wag) [~ (raq p.u.q.vex p.u.q.wag) q.u.q.wag]]
597 ::
860 ::
598
861
599−Parse with rule as many times as possible, and fold over results with a
862+Examples
600−binary gate.
863+--------
601−
602−`rud` is a noun.
603−
604−`raq` is a gate that takes two nouns and produces a cell.
605−
606−`fel` is a rule.
607
864
608 ~zod/try=> (scan "abc" (stir *@ add prn))
865 ~zod/try=> (scan "abc" (stir *@ add prn))
609 294
866 294
@@ -616,6 +873,23 @@ binary gate.
616
873
617Parse several times
874Parse several times
618
875
876+Parse bounded number of times.
877+
878+Accepts
879+-------
880+
881+`[les=@ mos=@]` is a cell of atoms indicating the bounds.
882+
883+`fel` is a [`++rule`]().
884+
885+Produces
886+--------
887+
888+A [`++rule`]().
889+
890+Source
891+------
892+
619 ++ stun :: parse several times
893 ++ stun :: parse several times
620 |* [[les=@ mos=@] fel=_rule]
894 |* [[les=@ mos=@] fel=_rule]
621 |= tub=nail
895 |= tub=nail
@@ -636,11 +910,8 @@ Parse several times
636 wag
910 wag
637 [p.wag [~ [p.u.q.vex p.u.q.wag] q.u.q.wag]]
911 [p.wag [~ [p.u.q.vex p.u.q.wag] q.u.q.wag]]
638
912
639−Parse bounded number of times.
913+Examples
640−
914+--------
641−`[les=@ mos=@]` is a cell of atoms indicating the bounds.
642−
643−`fel` is a rule.
644
915
645 ~zod/try=> ((stun [5 10] prn) [1 1] "aquickbrownfoxran")
916 ~zod/try=> ((stun [5 10] prn) [1 1] "aquickbrownfoxran")
646 [p=[p=1 q=11] q=[~ [p="aquickbrow" q=[p=[p=1 q=11] q="nfoxran"]]]]
917 [p=[p=1 q=11] q=[~ [p="aquickbrow" q=[p=[p=1 q=11] q="nfoxran"]]]]
docs/dev/hoon/library/2ed.md+191−65
@@ -5,6 +5,29 @@ section 2eD
5
5
6Conditional composer
6Conditional composer
7
7
8+Parsing composer: connects the [`++edge`]() `vex` with the subsequent [`++rule`]() `sab`
9+as an optional suffix, using [gate]() `raq` to compose or reject its
10+result. If there is no suffix, or if the suffix fails to be composed
11+with the current result, the current result is produced. Used to map a
12+group of rules to a specified output.
13+
14+Accepts
15+-------
16+
17+`raq` is a [gate]().
18+
19+`sab` is a [rule]().
20+
21+`vex` is an [edge]().
22+
23+Produces
24+--------
25+
26+A [`++rule`]().
27+
28+Source
29+------
30+
8 ++ bend :: conditional comp
31 ++ bend :: conditional comp
9 ~/ %bend
32 ~/ %bend
10 |* raq=_|*([a=* b=*] [~ u=[a b]])
33 |* raq=_|*([a=* b=*] [~ u=[a b]])
@@ -22,17 +45,8 @@ Conditional composer
22 [p=yur q=[~ u=[p=u.vux q=q.u.q.yit]]]
45 [p=yur q=[~ u=[p=u.vux q=q.u.q.yit]]]
23 ::
46 ::
24
47
25−Parsing composer: connects the edge `vex` with the subsequent rule `sab`
48+Examples
26−as an optional suffix, using the gate `raq` to compose or reject its
49+--------
27−result. If there is no suffix, or if the suffix fails to be composed
28−with the current result, the current result is produced. Used to map a
29−group of rules to a specified output.
30−
31−`raq` is a [gate]().
32−
33−`sab` is a [rule]().
34−
35−`vex` is an [edge]().
36
50
37 ~zod/try=> (;~((bend |=([a=char b=char] ?.(=(a b) ~ (some +(a))))) prn prn) [1 1] "qs")
51 ~zod/try=> (;~((bend |=([a=char b=char] ?.(=(a b) ~ (some +(a))))) prn prn) [1 1] "qs")
38 [p=[p=1 q=3] q=[~ u=[p=~~q q=[p=[p=1 q=2] q="s"]]]]
52 [p=[p=1 q=3] q=[~ u=[p=~~q q=[p=[p=1 q=2] q="s"]]]]
@@ -54,6 +68,28 @@ group of rules to a specified output.
54
68
55Arbitrary compose
69Arbitrary compose
56
70
71+Parsing composer: connects the [`++edge`]() `vex` with a following [`++rule`]() `sab`,
72+combining the contents of `vex` with the result of `sab` using a binary
73+[gate]() `raq`. Used to fold over the results of several `++rules`.
74+
75+Accepts
76+-------
77+
78+`raq` is a gate that accepts a cell of two [nouns](), `a` and `b`, and
79+produces a cell of two nouns.
80+
81+`sab` is a rule.
82+
83+`vex` is an edge.
84+
85+Produces
86+--------
87+
88+A [`++rule`]().
89+
90+Source
91+------
92+
57 ++ comp
93 ++ comp
58 ~/ %comp
94 ~/ %comp
59 |* raq=_|*([a=* b=*] [a b]) :: arbitrary compose
95 |* raq=_|*([a=* b=*] [a b]) :: arbitrary compose
@@ -68,16 +104,8 @@ Arbitrary compose
68 [p=yur q=[~ u=[p=(raq p.u.q.vex p.u.q.yit) q=q.u.q.yit]]]
104 [p=yur q=[~ u=[p=(raq p.u.q.vex p.u.q.yit) q=q.u.q.yit]]]
69 ::
105 ::
70
106
71−Parsing composer: connects the edge `vex` with a following rule `sab`,
107+Examples
72−combining the contents of `vex` with the result of `sab` using a binary
108+--------
73−gate `raq`. Used to fold over the results of several rules.
74−
75−`raq` is a [gate]() that accepts a cell of two nouns, `a` and `b`, and
76−produces a cell of two nouns.
77−
78−`sab` is a [rule]().
79−
80−`vex` is an [edge]().
81
109
82 ~zod/try=> (scan "123" ;~((comp |=([a=@u b=@u] (add a b))) dit dit dit))
110 ~zod/try=> (scan "123" ;~((comp |=([a=@u b=@u] (add a b))) dit dit dit))
83 6
111 6
@@ -91,6 +119,27 @@ produces a cell of two nouns.
91
119
92Skip delimiter
120Skip delimiter
93
121
122+Parsing composer: connects an [`++edge`]() `vex` with a following [`++rule`]() `sab` by
123+parsing the `++rule` `bus` (the delimiting symbol) and throwing out the
124+result.
125+
126+Accepts
127+-------
128+
129+`bus` is a `++rule`.
130+
131+`sab` is a `++rule`.
132+
133+`vex` is an `++edge`.
134+
135+Produces
136+--------
137+
138+
139+
140+Source
141+------
142+
94 ++ glue :: add rule
143 ++ glue :: add rule
95 ~/ %glue
144 ~/ %glue
96 |* bus=_rule
145 |* bus=_rule
@@ -99,15 +148,8 @@ Skip delimiter
99 (plug vex ;~(pfix bus sab))
148 (plug vex ;~(pfix bus sab))
100 ::
149 ::
101
150
102−Parsing composer: connects an edge `vex` with a following rule `sab` by
151+Examples
103−parsing the rule `bus` (the delimiting symbol) and throwing out the
152+--------
104−result.
105−
106−`bus` is a [rule]().
107−
108−`sab` is a [rule]().
109−
110−`vex` is an [edge]().
111
153
112 ~zod/try=> (scan "200|mal|bon" ;~((glue bar) dem sym sym))
154 ~zod/try=> (scan "200|mal|bon" ;~((glue bar) dem sym sym))
113 [q=200 7.102.829 7.237.474]
155 [q=200 7.102.829 7.237.474]
@@ -124,6 +166,24 @@ result.
124
166
125Parse unless
167Parse unless
126
168
169+Parsing composer: if an [`++edge`]() `vex` reflects a success, fail. Otherwise,
170+connect `vex` with the following [`++rule`]().
171+
172+Accepts
173+-------
174+
175+`sab` is a `++rule`.
176+
177+`vex` is an `++edge`.
178+
179+Produces
180+--------
181+
182+
183+
184+Source
185+------
186+
127 ++ less :: no first and second
187 ++ less :: no first and second
128 |* [vex=edge sab=_rule]
188 |* [vex=edge sab=_rule]
129 ?~ q.vex
189 ?~ q.vex
@@ -132,12 +192,8 @@ Parse unless
132 vex(q ~)
192 vex(q ~)
133 ::
193 ::
134
194
135−Parsing composer: if an edge `vex` reflects a success, fail. Otherwise,
195+Examples
136−connect `vex` with the following rule.
196+--------
137−
138−`sab` is a [rule]().
139−
140−`vex` is an [edge]().
141
197
142 ~zod/try=> (scan "sas-/lo" (star ;~(less lus bar prn)))
198 ~zod/try=> (scan "sas-/lo" (star ;~(less lus bar prn)))
143 "sas-/lo"
199 "sas-/lo"
@@ -154,15 +210,29 @@ connect `vex` with the following rule.
154
210
155Discard first rule
211Discard first rule
156
212
213+Parsing composer: connects an [`++edge`]() `vex` with two subsequent [`++rule`]()s,
214+ignoring the result of the first and producing the result of the second.
215+
216+Accepts
217+-------
218+
219+`vex` is an [edge]().
220+
221+Produces
222+--------
223+
224+
225+
226+Source
227+------
228+
157 ++ pfix :: discard first rule
229 ++ pfix :: discard first rule
158 ~/ %pfix
230 ~/ %pfix
159 (comp |*([a=* b=*] b))
231 (comp |*([a=* b=*] b))
160 ::
232 ::
161
233
162−Parsing composer: connects an [edge]() `vex` with two subsequent rules,
234+Examples
163−ignoring the result of the first and producing the result of the second.
235+--------
164−
165−`vex` is an [edge]().
166
236
167 ~zod/try=> `@t`(scan "%him" ;~(pfix cen sym))
237 ~zod/try=> `@t`(scan "%him" ;~(pfix cen sym))
168 'him'
238 'him'
@@ -175,6 +245,25 @@ ignoring the result of the first and producing the result of the second.
175
245
176Parse to tuple
246Parse to tuple
177
247
248+Parsing composer: connects an [`++edge`]() `vex` with a following [`++rule`]() `sab`, producing
249+a cell of both the results. See also: the monad applicator [;\~]() for a
250+more detailed explanation.
251+
252+Accepts
253+-------
254+
255+`sab` is a `++rule`.
256+
257+`vex` is an `++edge`.
258+
259+Produces
260+--------
261+
262+
263+
264+Source
265+------
266+
178 ++ plug :: first then second
267 ++ plug :: first then second
179 ~/ %plug
268 ~/ %plug
180 |* [vex=edge sab=_rule]
269 |* [vex=edge sab=_rule]
@@ -187,13 +276,8 @@ Parse to tuple
187 [p=yur q=[~ u=[p=[p.u.q.vex p.u.q.yit] q=q.u.q.yit]]]
276 [p=yur q=[~ u=[p=[p.u.q.vex p.u.q.yit] q=q.u.q.yit]]]
188 ::
277 ::
189
278
190−Parsing composer: connects `vex` with a following rule `sab`, producing
279+Examples
191−a cell of both the results. See also: the monad applicator [;\~]() for a
280+--------
192−more detailed explanation.
193−
194−`sab` is a [rule]().
195−
196−`vex` is an [edge]().
197
281
198 ~zod/try=> (scan "1..20" ;~(plug dem dot dot dem))
282 ~zod/try=> (scan "1..20" ;~(plug dem dot dot dem))
199 [q=1 ~~~. ~~~. q=20]
283 [q=1 ~~~. ~~~. q=20]
@@ -208,6 +292,24 @@ more detailed explanation.
208
292
209Parse options
293Parse options
210
294
295+Parsing composer: if `vex` reflects a failure, connect it with the
296+following rule `sab`. See also: the monad applicator [;\~]()
297+
298+Accepts
299+-------
300+
301+`sab` is a [`++rule`]().
302+
303+`vex` is an [`++edge`]().
304+
305+Produces
306+--------
307+
308+
309+
310+Source
311+------
312+
211 ++ pose :: first or second
313 ++ pose :: first or second
212 ~/ %pose
314 ~/ %pose
213 |* [vex=edge sab=_rule]
315 |* [vex=edge sab=_rule]
@@ -216,12 +318,8 @@ Parse options
216 [p=(last p.vex p.roq) q=q.roq]
318 [p=(last p.vex p.roq) q=q.roq]
217 vex
319 vex
218
320
219−Parsing composer: if `vex` reflects a failure, connect it with the
321+Examples
220−following rule `sab`. See also: the monad applicator [;\~]()
322+--------
221−
222−`sab` is a [rule]().
223−
224−`vex` is an [edge]().
225
323
226 ~zod/try=> `@t`(scan "+" ;~(pose lus tar cen))
324 ~zod/try=> `@t`(scan "+" ;~(pose lus tar cen))
227 '+'
325 '+'
@@ -239,6 +337,24 @@ following rule `sab`. See also: the monad applicator [;\~]()
239
337
240First and second
338First and second
241
339
340+Parsing composer: if an [`++edge`]() `vex` reflects a failure, fail. Otherwise,
341+connect `vex` with the following [`++rule`]().
342+
343+Accepts
344+-------
345+
346+`sab` is a `++rule`.
347+
348+`vex` is an `++edge`.
349+
350+Produces
351+--------
352+
353+
354+
355+Source
356+------
357+
242 ++ simu :: first and second
358 ++ simu :: first and second
243 |* [vex=edge sab=_rule]
359 |* [vex=edge sab=_rule]
244 ?~ q.vex
360 ?~ q.vex
@@ -247,12 +363,8 @@ First and second
247 roq
363 roq
248 ::
364 ::
249
365
250−Parsing composer: if an edge `vex` reflects a failure, fail. Otherwise,
366+Examples
251−connect `vex` with the following rule.
367+--------
252−
253−`sab` is a [rule]().
254−
255−`vex` is an [edge]().
256
368
257 ~zod/try=> (scan "~zod" scat:vast)
369 ~zod/try=> (scan "~zod" scat:vast)
258 [%dtzy p=%p q=0]
370 [%dtzy p=%p q=0]
@@ -270,16 +382,30 @@ connect `vex` with the following rule.
270
382
271Discard second rule
383Discard second rule
272
384
385+Parsing composer: connects [`++edge`]()s `vex` with two subsequent [`++rule`]()s returning the
386+result of the first and discarding the result of the second.
387+
388+Accepts
389+-------
390+
391+`a` is the result of parsing the first `++rule`.
392+
393+`b` is the result of of parsing the second `++rule`.
394+
395+Produces
396+--------
397+
398+
399+
400+Source
401+------
402+
273 ++ sfix :: discard second rule
403 ++ sfix :: discard second rule
274 ~/ %sfix
404 ~/ %sfix
275 (comp |*([a=* b=*] a))
405 (comp |*([a=* b=*] a))
276
406
277−Parsing composer: connects `vex` with two subsequent rules returning the
407+Examples
278−result of the first and discarding the result of the second.
408+--------
279−
280−`a` is the result of parsing the first [rule]().
281−
282−`b` is the result of of parsing the second [rule]().
283
409
284 ~zod/try=> `@t`(scan "him%" ;~(sfix sym cen))
410 ~zod/try=> `@t`(scan "him%" ;~(sfix sym cen))
285 'him'
411 'him'
docs/dev/hoon/library/2ee.md+166−56
@@ -1,8 +1,26 @@
1−section 2eE, parsing (composers)
1+section 2ee, parsing (composers)
2================================
2================================
3
3
4### `++bass`
4### `++bass`
5
5
6+Parser modifier: [LSB](http://en.wikipedia.org/wiki/Least_significant_bit)
7+ordered [`++list`]() as atom of a [`++base`]().
8+
9+Accepts
10+-------
11+
12+`wuc` is an atom.
13+
14+`tyd` is a [`++rule`]().
15+
16+Produces
17+--------
18+
19+A [`++rule`]().
20+
21+Source
22+------
23+
6 ++ bass
24 ++ bass
7 |* [wuc=@ tyd=_rule]
25 |* [wuc=@ tyd=_rule]
8 %+ cook
26 %+ cook
@@ -11,16 +29,10 @@ section 2eE, parsing (composers)
11 waq
29 waq
12 =|([p=@ q=@] |.((add p (mul wuc q))))
30 =|([p=@ q=@] |.((add p (mul wuc q))))
13 tyd
31 tyd
14− ::
15−
16−Parser modifier:
17−[LSB](http://en.wikipedia.org/wiki/Least_significant_bit) ordered list
18−as atom of a base.
19−
20−`wuc` is an [atom]().
21−
22−`tyd` is a [rule]().
23
32
33+Examples
34+--------
35+
24 ~zod/try=> (scan "123" (bass 10 (star dit)))
36 ~zod/try=> (scan "123" (bass 10 (star dit)))
25 q=123
37 q=123
26 ~zod/try=> (scan "123" (bass 8 (star dit)))
38 ~zod/try=> (scan "123" (bass 8 (star dit)))
@@ -32,6 +44,24 @@ as atom of a base.
32
44
33### `++boss`
45### `++boss`
34
46
47+Parser modifier: [LSB](http://en.wikipedia.org/wiki/Least_significant_bit)
48+ordered [`++list`]() as atom of a [`++base`]().
49+
50+Accepts
51+-------
52+
53+`wuc` is an atom.
54+
55+`tyd` is a [`++rule`]().
56+
57+Produces
58+--------
59+
60+A [`++rule`]().
61+
62+Source
63+------
64+
35 ++ boss
65 ++ boss
36 |* [wuc=@ tyd=_rule]
66 |* [wuc=@ tyd=_rule]
37 %+ cook
67 %+ cook
@@ -40,16 +70,10 @@ as atom of a base.
40 waq
70 waq
41 =|([p=@ q=@] |.((add p (mul wuc q))))
71 =|([p=@ q=@] |.((add p (mul wuc q))))
42 tyd
72 tyd
43− ::
44−
45−Parser modifier:
46−[LSB](http://en.wikipedia.org/wiki/Least_significant_bit) ordered list
47−as atom of a base.
48−
49−`wuc` is an [atom]().
50−
51−`tyd` is a [rule]().
52
73
74+Examples
75+--------
76+
53 ~zod/try=> (scan "123" (boss 10 (star dit)))
77 ~zod/try=> (scan "123" (boss 10 (star dit)))
54 q=321
78 q=321
55 ~zod/try=> `@t`(scan "bam" (boss 256 (star alp)))
79 ~zod/try=> `@t`(scan "bam" (boss 256 (star alp)))
@@ -61,18 +85,33 @@ as atom of a base.
61
85
62### `++ifix`
86### `++ifix`
63
87
64− ++ ifix
88+Surround
65− |* [fel=[p=_rule q=_rule] hof=_rule]
66− ;~(pfix p.fel ;~(sfix hof q.fel))
67− ::
68
89
69−Parser modifier: surround with pair of rules, output of which is
90+Parser modifier: surround with pair of [`++rule`]()s, the output of which is
70discarded.
91discarded.
71
92
93+Accepts
94+-------
95+
72−`fel` is a pair of [rule]()s.
96+`fel` is a pair of `++rule`s.
97+
98+`hof` is a `++rule`.
73
99
74−`hof` is a [rule]().
100+Produces
101+--------
75
102
103+A `++rule`.
104+
105+Source
106+------
107+
108+ ++ ifix
109+ |* [fel=[p=_rule q=_rule] hof=_rule]
110+ ;~(pfix p.fel ;~(sfix hof q.fel))
111+
112+Examples
113+--------
114+
76 ~zod/try=> (scan "-40-" (ifix [hep hep] dem))
115 ~zod/try=> (scan "-40-" (ifix [hep hep] dem))
77 q=40
116 q=40
78 ~zod/try=> (scan "4my4" (ifix [dit dit] (star alf)))
117 ~zod/try=> (scan "4my4" (ifix [dit dit] (star alf)))
@@ -82,17 +121,32 @@ discarded.
82
121
83### `++more`
122### `++more`
84
123
85− ++ more
124+Parse list with delimiter
86− |* [bus=_rule fel=_rule]
125+
87− ;~(pose (most bus fel) (easy ~))
126+Parser modifier: Parse a list of matches using a delimiter [`++rule`]().
88− ::
127+
128+Accepts
129+-------
130+
131+`bus` is a `++rule`.
132+
133+`fel` is a `++rule`.
134+
135+Produces
136+--------
89
137
90−Parser modifier: using a delimiter rule, parse a list of matches.
138+A `++rule`.
91
139
92−`bus` is a [rule]().
140+Source
141+------
93
142
94−`fel` is a [rule]().
143+ ++ more
144+ |* [bus=_rule fel=_rule]
145+ ;~(pose (most bus fel) (easy ~))
95
146
147+Examples
148+--------
149+
96 ~zod/try=> (scan "" (more ace dem))
150 ~zod/try=> (scan "" (more ace dem))
97 ~
151 ~
98 ~zod/try=> (scan "40 20" (more ace dem))
152 ~zod/try=> (scan "40 20" (more ace dem))
@@ -104,18 +158,32 @@ Parser modifier: using a delimiter rule, parse a list of matches.
104
158
105### `++most`
159### `++most`
106
160
107− ++ most
161+Parse list of at least one match
108− |* [bus=_rule fel=_rule]
162+
109− ;~(plug fel (star ;~(pfix bus fel)))
163+Parser modifier: parse a [`++list`]() of at least one match using a delimiter [`++rule`]().
110− ::
164+
165+Accepts
166+-------
167+
168+`bus` is a `++rule`.
169+
170+`fel` is a `++rule`.
111
171
112−Parser modifier: using a delimiter rule, parse a list of at least one
172+Produces
113−match.
173+--------
114
174
115−`bus` is a [rule]().
175+A `++rule`.
116
176
117−`fel` is a [rule]().
177+Source
178+------
118
179
180+ ++ most
181+ |* [bus=_rule fel=_rule]
182+ ;~(plug fel (star ;~(pfix bus fel)))
183+
184+Examples
185+--------
186+
119 ~zod/try=> (scan "40 20" (most ace dem))
187 ~zod/try=> (scan "40 20" (most ace dem))
120 [q=40 ~[q=20]]
188 [q=40 ~[q=20]]
121 ~zod/try=> (scan "40 20 60 1 5" (most ace dem))
189 ~zod/try=> (scan "40 20 60 1 5" (most ace dem))
@@ -128,12 +196,28 @@ match.
128
196
129### `++plus`
197### `++plus`
130
198
131− ++ plus |*(fel=_rule ;~(plug fel (star fel)))
199+List of at least one match.
132
200
133−Parser modifier: parse list of at least one match
201+Parser modifier: parse [`++list`]() of at least one match.
134
202
135−`fel` is a [rule]().
203+Accepts
204+-------
136
205
206+`fel` is a [`++rule`]().
207+
208+Produces
209+--------
210+
211+A `++rule`.
212+
213+Source
214+------
215+
216+ ++ plus |*(fel=_rule ;~(plug fel (star fel)))
217+
218+Examples
219+--------
220+
137 ~zod/try=> (scan ">>>>" (cook lent (plus gar)))
221 ~zod/try=> (scan ">>>>" (cook lent (plus gar)))
138 4
222 4
139 ~zod/try=> (scan "- - " (plus ;~(pose ace hep)))
223 ~zod/try=> (scan "- - " (plus ;~(pose ace hep)))
@@ -147,19 +231,34 @@ Parser modifier: parse list of at least one match
147
231
148### `++slug`
232### `++slug`
149
233
150− ++ slug
234+Use gate to parse delimited list
151− |* raq=_|*([a=* b=*] [a b])
152− |* [bus=_rule fel=_rule]
153− ;~((comp raq) fel (stir rud raq ;~(pfix bus fel)))
154− ::
155
235
156−Parser modifier: By composing with a gate, parse a delimited list of
236+Parser modifier: By composing with a [gate](), parse a delimited [`++list`]() of
157matches.
237matches.
158
238
239+Accepts
240+-------
241+
159−`bus` is a [rule]().
242+`bus` is a [`++rule`]().
160
243
161−`fel` is a [rule]().
244+`fel` is a `++rule`.
162
245
246+Produces
247+--------
248+
249+A `++rule`.
250+
251+Source
252+------
253+
254+ ++ slug
255+ |* raq=_|*([a=* b=*] [a b])
256+ |* [bus=_rule fel=_rule]
257+ ;~((comp raq) fel (stir +<+.raq raq ;~(pfix bus fel)))
258+
259+Examples
260+--------
261+
163 ~zod/try=> (scan "20+5+110" ((slug add) lus dem))
262 ~zod/try=> (scan "20+5+110" ((slug add) lus dem))
164 135
263 135
165 ~zod/try=> `@t`(scan "a b c" ((slug |=(a=[@ @t] (cat 3 a))) ace alp))
264 ~zod/try=> `@t`(scan "a b c" ((slug |=(a=[@ @t] (cat 3 a))) ace alp))
@@ -169,14 +268,25 @@ matches.
169
268
170### `++star`
269### `++star`
171
270
271+List of matches
272+
273+Parser modifier: parse [`++list`]() of matches.
274+
275+Accepts
276+-------
277+
278+`fel` is a [`++rule`]().
279+
280+Produces
281+--------
282+
172 ++ star :: 0 or more times
283 ++ star :: 0 or more times
173 |* fel=_rule
284 |* fel=_rule
174 (stir `(list ,_(wonk *fel))`~ |*([a=* b=*] [a b]) fel)
285 (stir `(list ,_(wonk *fel))`~ |*([a=* b=*] [a b]) fel)
175
286
176−Parser modifier: parse list of matches.
287+Examples
177−
288+--------
178−`fel` is a [rule]().
289+
179−
180 ~zod/try=> (scan "aaaaa" (just 'a'))
290 ~zod/try=> (scan "aaaaa" (just 'a'))
181 ! {1 2}
291 ! {1 2}
182 ! 'syntax-error'
292 ! 'syntax-error'
docs/dev/hoon/library/2ef.md+241−46
@@ -5,9 +5,15 @@ section 2eF, parsing (ascii)
5
5
6Parse space
6Parse space
7
7
8+Parses ASCII character 32, space.
9+
10+Source
11+------
12+
8 ++ ace (just ' ')
13 ++ ace (just ' ')
9
14
10−Parses ASCII character 32, space.
15+Examples
16+--------
11
17
12 ~zod/try=> (scan " " ace)
18 ~zod/try=> (scan " " ace)
13 ~~.
19 ~~.
@@ -24,9 +30,15 @@ Parses ASCII character 32, space.
24
30
25Parse vertical bar
31Parse vertical bar
26
32
33+Parses ASCII character 124, the vertical bar.
34+
35+Source
36+------
37+
27 ++ bar (just '|')
38 ++ bar (just '|')
28
39
29−Parses ASCII character 124, the vertical bar.
40+Examples
41+--------
30
42
31 ~zod/try=> (scan "|" bar)
43 ~zod/try=> (scan "|" bar)
32 ~~~7c.
44 ~~~7c.
@@ -43,10 +55,17 @@ Parses ASCII character 124, the vertical bar.
43
55
44Parse backslash
56Parse backslash
45
57
58+Parses ASCII character 92, the backslash. Note the extra `\` in the calling of
59+`bas` with [`++just`](/doc/hoon/library/2ec#++just) is to escape the escape
60+character, `\`.
61+
62+Source
63+------
64+
46 ++ bas (just '\\')
65 ++ bas (just '\\')
47
66
48−Parses ASCII character 92, the backslash. Note the extra `\` in the slam
67+Examples
49−of `bas` with [`++just`](/doc/hoon/library/2ec#++just) is to escape the escape character, `\`.
68+--------
50
69
51 ~zod/try=> (scan "\\" bas)
70 ~zod/try=> (scan "\\" bas)
52 ~~~5c.
71 ~~~5c.
@@ -65,9 +84,15 @@ of `bas` with [`++just`](/doc/hoon/library/2ec#++just) is to escape the escape c
65
84
66Parse dollar sign
85Parse dollar sign
67
86
87+Parses ASCII character 36, the dollar sign.
88+
89+Source
90+------
91+
68 ++ buc (just '$')
92 ++ buc (just '$')
69
93
70−Parses ASCII character 36, the dollar sign.
94+Examples
95+--------
71
96
72 ~zod/try=> (scan "$" buc)
97 ~zod/try=> (scan "$" buc)
73 ~~~24.
98 ~~~24.
@@ -84,9 +109,15 @@ Parses ASCII character 36, the dollar sign.
84
109
85Parse underscore
110Parse underscore
86
111
112+Parses ASCII character 95, the underscore.
113+
114+Source
115+------
116+
87 ++ cab (just '_')
117 ++ cab (just '_')
88
118
89−Parses ASCII character 95, the underscore.
119+Examples
120+--------
90
121
91 ~zod/try=> (scan "_" cab)
122 ~zod/try=> (scan "_" cab)
92 ~~~5f.
123 ~~~5f.
@@ -103,9 +134,15 @@ Parses ASCII character 95, the underscore.
103
134
104Parses percent sign
135Parses percent sign
105
136
137+Parses ASCII character 37, the percent sign.
138+
139+Source
140+------
141+
106 ++ cen (just '%')
142 ++ cen (just '%')
107
143
108−Parses ASCII character 37, the percent sign.
144+Examples
145+--------
109
146
110 ~zod/try=> (scan "%" cen)
147 ~zod/try=> (scan "%" cen)
111 ~~~25.
148 ~~~25.
@@ -122,9 +159,15 @@ Parses ASCII character 37, the percent sign.
122
159
123Parse colon
160Parse colon
124
161
162+Parses ASCII character 58, the colon
163+
164+Source
165+------
166+
125 ++ col (just ':')
167 ++ col (just ':')
126
168
127−Parses ASCII character 58, the colon
169+Examples
170+--------
128
171
129 ~zod/try=> (scan ":" col)
172 ~zod/try=> (scan ":" col)
130 ~~~3a.
173 ~~~3a.
@@ -141,9 +184,15 @@ Parses ASCII character 58, the colon
141
184
142Parse comma
185Parse comma
143
186
187+Parses ASCII character 44, the comma.
188+
189+Source
190+------
191+
144 ++ com (just ',')
192 ++ com (just ',')
145
193
146−Parses ASCII character 44, the comma.
194+Examples
195+--------
147
196
148 ~zod/try=> (scan "," com)
197 ~zod/try=> (scan "," com)
149 ~~~2c.
198 ~~~2c.
@@ -160,19 +209,25 @@ Parses ASCII character 44, the comma.
160
209
161Parse double quote
210Parse double quote
162
211
212+Parses ASCII character 34, the double quote.
213+
214+Source
215+------
216+
163 ++ doq (just '"')
217 ++ doq (just '"')
164
218
165−Parses ASCII character 34, the double quote.
219+Examples
220+--------
166
221
167− ~tadbyl-hilbel/try=> (scan "\"" doq)
222+ ~zod/try=> (scan "\"" doq)
168 ~~~22.
223 ~~~22.
169− ~tadbyl-hilbel/try=> `cord`(scan "\"" doq)
224+ ~zod/try=> `cord`(scan "\"" doq)
170 '"'
225 '"'
171− ~tadbyl-hilbel/try=> (doq [[1 1] "\""])
226+ ~zod/try=> (doq [[1 1] "\""])
172 [p=[p=1 q=2] q=[~ [p=~~~22. q=[p=[p=1 q=2] q=""]]]]
227 [p=[p=1 q=2] q=[~ [p=~~~22. q=[p=[p=1 q=2] q=""]]]]
173− ~tadbyl-hilbel/try=> (doq [[1 1] "not successfully parsed"])
228+ ~zod/try=> (doq [[1 1] "not successfully parsed"])
174 [p=[p=1 q=1] q=~]
229 [p=[p=1 q=1] q=~]
175− ~tadbyl-hilbel/try=> (scan "see?" doq)
230+ ~zod/try=> (scan "see?" doq)
176 ! {1 1}
231 ! {1 1}
177 ! 'syntax-error'
232 ! 'syntax-error'
178 ! exit
233 ! exit
@@ -183,9 +238,15 @@ Parses ASCII character 34, the double quote.
183
238
184Parse period
239Parse period
185
240
241+Parses ASCII character 46, the period.
242+
243+Source
244+------
245+
186 ++ dot (just '.')
246 ++ dot (just '.')
187
247
188−Parses ASCII character 46, the period.
248+Examples
249+--------
189
250
190 ~zod/try=> (scan "." dot)
251 ~zod/try=> (scan "." dot)
191 ~~~.
252 ~~~.
@@ -202,9 +263,15 @@ Parses ASCII character 46, the period.
202
263
203Parse forward slash
264Parse forward slash
204
265
266+Parses ASCII character 47, the forward slash.
267+
268+Source
269+------
270+
205 ++ fas (just '/')
271 ++ fas (just '/')
206
272
207−Parses ASCII character 47, the forward slash.
273+Examples
274+--------
208
275
209 ~zod/try=> (scan "/" fas)
276 ~zod/try=> (scan "/" fas)
210 ~~~2f.
277 ~~~2f.
@@ -221,9 +288,15 @@ Parses ASCII character 47, the forward slash.
221
288
222Parse less-than sign
289Parse less-than sign
223
290
291+Parses ASCII character 60, the less-than sign.
292+
293+Source
294+------
295+
224 ++ gal (just '<')
296 ++ gal (just '<')
225
297
226−Parses ASCII character 60, the less-than sign.
298+Examples
299+--------
227
300
228 ~zod/try=> (scan "<" gal)
301 ~zod/try=> (scan "<" gal)
229 ~~~3c.
302 ~~~3c.
@@ -242,9 +315,15 @@ Parses ASCII character 60, the less-than sign.
242
315
243Parse greater-than sign
316Parse greater-than sign
244
317
318+Parses ASCII character 62, the greater-than sign.
319+
320+Source
321+------
322+
245 ++ gar (just '>')
323 ++ gar (just '>')
246
324
247−Parses ASCII character 62, the greater-than sign.
325+Examples
326+--------
248
327
249 ~zod/try=> (scan ">" gar)
328 ~zod/try=> (scan ">" gar)
250 ~~~3e.
329 ~~~3e.
@@ -261,9 +340,15 @@ Parses ASCII character 62, the greater-than sign.
261
340
262Parse number sign
341Parse number sign
263
342
343+Parses ASCII character 35, the number sign.
344+
345+Source
346+------
347+
264 ++ hax (just '#')
348 ++ hax (just '#')
265
349
266−Parses ASCII character 35, the number sign.
350+Examples
351+--------
267
352
268 ~zod/try=> (scan "#" hax)
353 ~zod/try=> (scan "#" hax)
269 ~~~23.
354 ~~~23.
@@ -280,12 +365,18 @@ Parses ASCII character 35, the number sign.
280
365
281Parse left curley bracket
366Parse left curley bracket
282
367
283− ++ kel (just '{')
284−
285Parses ASCII character 123, the left curly bracket. Note that `{`
368Parses ASCII character 123, the left curly bracket. Note that `{`
286(`kel`) and `}` (`ker`) open and close a Hoon expression for Hoon string
369(`kel`) and `}` (`ker`) open and close a Hoon expression for Hoon string
287interpolation. To parse either of them, they must be escaped.
370interpolation. To parse either of them, they must be escaped.
288
371
372+Source
373+------
374+
375+ ++ kel (just '{')
376+
377+Examples
378+--------
379+
289 ~zod/try=> (scan "\{" kel)
380 ~zod/try=> (scan "\{" kel)
290 ~~~7b.
381 ~~~7b.
291 ~zod/try=> `cord`(scan "\{" kel)
382 ~zod/try=> `cord`(scan "\{" kel)
@@ -301,12 +392,18 @@ interpolation. To parse either of them, they must be escaped.
301
392
302Parse right curley bracket
393Parse right curley bracket
303
394
304− ++ ker (just '}')
305−
306Parses ASCII character 125, the right curly bracket. Note that `{`
395Parses ASCII character 125, the right curly bracket. Note that `{`
307(`kel`) and `}` (`ker`) open and close a Hoon expression for Hoon string
396(`kel`) and `}` (`ker`) open and close a Hoon expression for Hoon string
308interpolation. To parse either of them, they must be escaped.
397interpolation. To parse either of them, they must be escaped.
309
398
399+Source
400+------
401+
402+ ++ ker (just '}')
403+
404+Examples
405+--------
406+
310 ~zod/try=> (scan "}" ker)
407 ~zod/try=> (scan "}" ker)
311 ~~~7d.
408 ~~~7d.
312 ~zod/try=> `cord`(scan "}" ker)
409 ~zod/try=> `cord`(scan "}" ker)
@@ -322,9 +419,15 @@ interpolation. To parse either of them, they must be escaped.
322
419
323Parse caret
420Parse caret
324
421
422+Parses ASCII character 94, the caret.
423+
424+Source
425+------
426+
325 ++ ket (just '^')
427 ++ ket (just '^')
326
428
327−Parses ASCII character 94, the caret.
429+Examples
430+--------
328
431
329 ~zod/try=> (scan "^" ket)
432 ~zod/try=> (scan "^" ket)
330 ~~~5e.
433 ~~~5e.
@@ -341,9 +444,15 @@ Parses ASCII character 94, the caret.
341
444
342Parse plus sign
445Parse plus sign
343
446
447+Parses ASCII character 43, the plus sign.
448+
449+Source
450+------
451+
344 ++ lus (just '+')
452 ++ lus (just '+')
345
453
346−Parses ASCII character 43, the plus sign.
454+Examples
455+--------
347
456
348 ~zod/try=> (scan "+" lus)
457 ~zod/try=> (scan "+" lus)
349 ~~~2b.
458 ~~~2b.
@@ -360,9 +469,15 @@ Parses ASCII character 43, the plus sign.
360
469
361Parse hyphen
470Parse hyphen
362
471
472+Parses ASCII character 45, the hyphen.
473+
474+Source
475+------
476+
363 ++ hep (just '-')
477 ++ hep (just '-')
364
478
365−Parses ASCII character 45, the hyphen.
479+Examples
480+--------
366
481
367 ~zod/try=> (scan "-" hep)
482 ~zod/try=> (scan "-" hep)
368 ~~-
483 ~~-
@@ -379,9 +494,15 @@ Parses ASCII character 45, the hyphen.
379
494
380Parse left parenthesis
495Parse left parenthesis
381
496
497+Parses ASCII character 40, the left parenthesis.
498+
499+Source
500+------
501+
382 ++ pel (just '(')
502 ++ pel (just '(')
383
503
384−Parses ASCII character 40, the left parenthesis.
504+Examples
505+--------
385
506
386 ~zod/try=> (scan "(" pel)
507 ~zod/try=> (scan "(" pel)
387 ~~~28.
508 ~~~28.
@@ -398,9 +519,15 @@ Parses ASCII character 40, the left parenthesis.
398
519
399Parse ampersand
520Parse ampersand
400
521
522+Parses ASCII character 38, the ampersand.
523+
524+Source
525+------
526+
401 ++ pam (just '&')
527 ++ pam (just '&')
402
528
403−Parses ASCII character 38, the ampersand.
529+Examples
530+--------
404
531
405 ~zod/try=> (scan "&" pam)
532 ~zod/try=> (scan "&" pam)
406 ~~~26.
533 ~~~26.
@@ -417,9 +544,15 @@ Parses ASCII character 38, the ampersand.
417
544
418Parse right parenthesis
545Parse right parenthesis
419
546
547+Parses ASCII character 41, the right parenthesis.
548+
549+Source
550+------
551+
420 ++ per (just ')')
552 ++ per (just ')')
421
553
422−Parses ASCII character 41, the right parenthesis.
554+Examples
555+--------
423
556
424 ~zod/try=> (scan ")" per)
557 ~zod/try=> (scan ")" per)
425 ~~~29.
558 ~~~29.
@@ -436,9 +569,15 @@ Parses ASCII character 41, the right parenthesis.
436
569
437Parse "at" sign
570Parse "at" sign
438
571
572+Parses ASCII character 64, the "at" sign.
573+
574+Source
575+------
576+
439 ++ pat (just '@')
577 ++ pat (just '@')
440
578
441−Parses ASCII character 64, the "at" sign.
579+Examples
580+--------
442
581
443 ~zod/try=> (scan "@" pat)
582 ~zod/try=> (scan "@" pat)
444 ~~~4.
583 ~~~4.
@@ -455,11 +594,15 @@ Parses ASCII character 64, the "at" sign.
455
594
456Parse left square bracket
595Parse left square bracket
457
596
458−Left square bracket
597+Parses ASCII character 91, the left square bracket.
598+
599+Source
600+------
459
601
460 ++ sel (just '[')
602 ++ sel (just '[')
461
603
462−Parses ASCII character 91, the left square bracket.
604+Examples
605+--------
463
606
464 ~zod/try=> (scan "[" sel)
607 ~zod/try=> (scan "[" sel)
465 ~~~5b.
608 ~~~5b.
@@ -476,11 +619,15 @@ Parses ASCII character 91, the left square bracket.
476
619
477Parse semicolon
620Parse semicolon
478
621
479− ++ sem (just ';')
480−
481Parses ASCII character 59, the semicolon.
622Parses ASCII character 59, the semicolon.
482
623
624+Source
625+------
626+
627+ ++ sem (just ';')
628+
483−### `Examples`
629+Examples
630+--------
484
631
485 ~zod/try=> (scan ";" sem)
632 ~zod/try=> (scan ";" sem)
486 ~~~3b.
633 ~~~3b.
@@ -497,9 +644,15 @@ Parses ASCII character 59, the semicolon.
497
644
498Parse right square bracket
645Parse right square bracket
499
646
647+Parses ASCII character 93, the right square bracket.
648+
649+Source
650+------
651+
500 ++ ser (just ']')
652 ++ ser (just ']')
501
653
502−Parses ASCII character 93, the right square bracket.
654+Examples
655+--------
503
656
504 ~zod/try=> (scan "]" ser)
657 ~zod/try=> (scan "]" ser)
505 ~~~5d.
658 ~~~5d.
@@ -516,9 +669,15 @@ Parses ASCII character 93, the right square bracket.
516
669
517Parse tilde
670Parse tilde
518
671
672+Parses ASCII character 126, the tilde.
673+
674+Source
675+------
676+
519 ++ sig (just '~')
677 ++ sig (just '~')
520
678
521−Parses ASCII character 126, the tilde.
679+Examples
680+--------
522
681
523 ~zod/try=> (scan "~" sig)
682 ~zod/try=> (scan "~" sig)
524 ~~~~
683 ~~~~
@@ -535,10 +694,16 @@ Parses ASCII character 126, the tilde.
535
694
536Parse single quote
695Parse single quote
537
696
697+Parses ASCII character 39, soq. Note the extra '' is to escape the first
698+`soq` because soq delimits a [`++cord`]().
699+
700+Source
701+------
702+
538 ++ soq (just '\'')
703 ++ soq (just '\'')
539
704
540−Parses ASCII character 39, soq. Note the extra '' is to escape the first
705+Examples
541−`soq` because soq delimits a cord.
706+--------
542
707
543 ~zod/try=> (scan "'" soq)
708 ~zod/try=> (scan "'" soq)
544 ~~~27.
709 ~~~27.
@@ -555,9 +720,15 @@ Parses ASCII character 39, soq. Note the extra '' is to escape the first
555
720
556Parse asterisk
721Parse asterisk
557
722
723+Parses ASCII character 42, the asterisk.
724+
725+Source
726+------
727+
558 ++ tar (just '*')
728 ++ tar (just '*')
559
729
560−Parses ASCII character 42, the asterisk.
730+Examples
731+--------
561
732
562 ~zod/try=> (scan "*" tar)
733 ~zod/try=> (scan "*" tar)
563 ~~~2a.
734 ~~~2a.
@@ -574,10 +745,16 @@ Parses ASCII character 42, the asterisk.
574
745
575Parse backtick
746Parse backtick
576
747
748+Parses ASCII character 96, the backtick (also known as the "grave
749+accent").
750+
751+Source
752+------
753+
577 ++ tec (just '`') :: backTiCk
754 ++ tec (just '`') :: backTiCk
578
755
579−Parses ASCII character 96, the backtick (also known as the "grave
756+Examples
580−accent".
757+--------
581
758
582 ~zod/try=> (scan "`" tec)
759 ~zod/try=> (scan "`" tec)
583 ~~~6.
760 ~~~6.
@@ -594,9 +771,15 @@ accent".
594
771
595Parse equals sign
772Parse equals sign
596
773
774+Parses ASCII character 61, the equals sign.
775+
776+Source
777+------
778+
597 ++ tis (just '=')
779 ++ tis (just '=')
598
780
599−Parses ASCII character 61, the equals sign.
781+Examples
782+--------
600
783
601 ~zod/try=> (scan "=" tis)
784 ~zod/try=> (scan "=" tis)
602 ~~~3d.
785 ~~~3d.
@@ -613,9 +796,15 @@ Parses ASCII character 61, the equals sign.
613
796
614Parses question mark
797Parses question mark
615
798
799+Parses ASCII character 63, the question mark.
800+
801+Source
802+------
803+
616 ++ wut (just '?')
804 ++ wut (just '?')
617
805
618−Parses ASCII character 63, wut.
806+Examples
807+--------
619
808
620 ~zod/try=> (scan "?" wut)
809 ~zod/try=> (scan "?" wut)
621 ~~~3f.
810 ~~~3f.
@@ -632,9 +821,15 @@ Parses ASCII character 63, wut.
632
821
633Exclamation point
822Exclamation point
634
823
824+Parses ASCII character 33, the exclamation point zap.
825+
826+Source
827+------
828+
635 ++ zap (just '!')
829 ++ zap (just '!')
636
830
637−Parses ASCII character 33, the exclamation point zap.
831+Examples
832+--------
638
833
639 ~zod/try=> (scan "!" zap)
834 ~zod/try=> (scan "!" zap)
640 ~~~21.
835 ~~~21.
docs/dev/hoon/library/2eg.md+63−12
@@ -5,9 +5,15 @@ section 2eG, parsing (whitespace)
5
5
6`.` optional gap
6`.` optional gap
7
7
8+Dot followed by an optional gap, used with numbers.
9+
10+Source
11+------
12+
8 ++ dog ;~(plug dot gay) ::
13 ++ dog ;~(plug dot gay) ::
9
14
10−Dot followed by an optional gap, used in numbers.
15+Examples
16+--------
11
17
12 /~zod/try=> 1.234.
18 /~zod/try=> 1.234.
13 703
19 703
@@ -21,9 +27,15 @@ Dot followed by an optional gap, used in numbers.
21
27
22`@p` separator
28`@p` separator
23
29
30+Phonetic base phrase separator
31+
32+Source
33+------
34+
24 ++ doh ;~(plug ;~(plug hep hep) gay) ::
35 ++ doh ;~(plug ;~(plug hep hep) gay) ::
25
36
26−Phonetic base phrase separator
37+Examples
38+--------
27
39
28 /~zod/try=> ~nopfel-botduc-nilnev-dolfyn--haspub-natlun-lodmur-holtyd
40 /~zod/try=> ~nopfel-botduc-nilnev-dolfyn--haspub-natlun-lodmur-holtyd
29 ~nopfel-botduc-nilnev-dolfyn--haspub-natlun-lodmur-holtyd
41 ~nopfel-botduc-nilnev-dolfyn--haspub-natlun-lodmur-holtyd
@@ -41,9 +53,15 @@ Phonetic base phrase separator
41
53
42`--` to `~`
54`--` to `~`
43
55
56+Parse phep, `--`, to null, `~`.
57+
58+Source
59+------
60+
44 ++ dun (cold ~ ;~(plug hep hep)) :: -- (phep) to ~
61 ++ dun (cold ~ ;~(plug hep hep)) :: -- (phep) to ~
45
62
46−Parse phep, `--`, to null, `~`.
63+Examples
64+--------
47
65
48 ~zod/try=> (scan "--" dun)
66 ~zod/try=> (scan "--" dun)
49 ~
67 ~
@@ -56,9 +74,15 @@ Parse phep, `--`, to null, `~`.
56
74
57`==` to `~`
75`==` to `~`
58
76
77+Parse stet, `==`, to null `~`.
78+
79+Source
80+------
81+
59 ++ duz (cold ~ ;~(plug tis tis)) :: == (stet) to ~
82 ++ duz (cold ~ ;~(plug tis tis)) :: == (stet) to ~
60
83
61−Parse stet, `==`, to null `~`.
84+Examples
85+--------
62
86
63 ~zod/try=> (scan "==" duz)
87 ~zod/try=> (scan "==" duz)
64 ~
88 ~
@@ -71,9 +95,15 @@ Parse stet, `==`, to null `~`.
71
95
72Newline or ' '
96Newline or ' '
73
97
98+Whitespace component, either newline or space.
99+
100+Source
101+------
102+
74 ++ gah (mask [`@`10 ' ' ~]) :: newline or ace
103 ++ gah (mask [`@`10 ' ' ~]) :: newline or ace
75
104
76−Whitespace component, either newline or space.
105+Examples
106+--------
77
107
78 /~zod/try=> ^- * :: show spaces
108 /~zod/try=> ^- * :: show spaces
79 """
109 """
@@ -100,23 +130,30 @@ Whitespace component, either newline or space.
100
130
101Plural whitespace
131Plural whitespace
102
132
103− ++ gap (cold ~ ;~(plug gaq (star ;~(pose vul gah)))) :: plural whitespace
104−
105Separates tall runes
133Separates tall runes
106
134
135+Source
136+------
137+
138+ ++ gap (cold ~ ;~(plug gaq (star ;~(pose vul gah)))) :: plural whitespace
139+
107------------------------------------------------------------------------
140------------------------------------------------------------------------
108
141
109### `++gaq`
142### `++gaq`
110
143
111End of line
144End of line
112
145
146+Two spaces, a newline, or comment.
147+
148+Source
149+------
150+
113 ++ gaq ;~ pose :: end of line
151 ++ gaq ;~ pose :: end of line
114 (just `@`10)
152 (just `@`10)
115 ;~(plug gah ;~(pose gah vul))
153 ;~(plug gah ;~(pose gah vul))
116 vul
154 vul
117 ==
155 ==
118
156
119−Two spaces, a newline, or comment.
120
157
121------------------------------------------------------------------------
158------------------------------------------------------------------------
122
159
@@ -124,24 +161,35 @@ Two spaces, a newline, or comment.
124
161
125Classic whitespace
162Classic whitespace
126
163
127− ++ gaw (cold ~ (star ;~(pose vul gah))) :: classic white
164+Terran whitespace.
128
165
129−Terran whitespace
166+Source
167+------
168+
169+ ++ gaw (cold ~ (star ;~(pose vul gah))) :: classic white
130
170
131------------------------------------------------------------------------
171------------------------------------------------------------------------
132
172
133### `++gay`
173### `++gay`
134
174
175+Optional gap
176+
135Optional gap.
177Optional gap.
136
178
137− ++ gay ;~(pose gap (easy ~)) ::
179+Source
180+------
138
181
139−Optional gap.
182+ ++ gay ;~(pose gap (easy ~)) ::
140
183
141------------------------------------------------------------------------
184------------------------------------------------------------------------
142
185
143### `++vul`
186### `++vul`
144
187
188+Comments to null
189+
190+Source
191+------
192+
145 ++ vul %- cold :- ~ :: comments
193 ++ vul %- cold :- ~ :: comments
146 ;~ plug col col
194 ;~ plug col col
147 (star prn)
195 (star prn)
@@ -151,6 +199,9 @@ Optional gap.
151Parse comments and produce a null. Note that a comment must be ended
199Parse comments and produce a null. Note that a comment must be ended
152with a newline character.
200with a newline character.
153
201
202+Examples
203+--------
204+
154 ~zod/try=> (scan "::this is a comment \0a" vul)
205 ~zod/try=> (scan "::this is a comment \0a" vul)
155 ~
206 ~
156 ~zod/try=> (scan "::this is a comment " vul)
207 ~zod/try=> (scan "::this is a comment " vul)
docs/dev/hoon/library/2eh.md+187−32
@@ -5,9 +5,15 @@ section 2eH, parsing (idioms)
5
5
6Alphabetic characters
6Alphabetic characters
7
7
8+Parse alphabetic characters, both upper and lowercase.
9+
10+Source
11+------
12+
8 ++ alf ;~(pose low hig) :: alphabetic
13 ++ alf ;~(pose low hig) :: alphabetic
9
14
10−Parse alphabetic characters, both upper and lowercase.
15+Examples
16+--------
11
17
12 ~zod/try=> (scan "a" alf)
18 ~zod/try=> (scan "a" alf)
13 ~~a
19 ~~a
@@ -22,9 +28,15 @@ Parse alphabetic characters, both upper and lowercase.
22
28
23Alphanumeric characters
29Alphanumeric characters
24
30
31+Parse alphanumeric characters - both alphabetic characters and numbers.
32+
33+Source
34+------
35+
25 ++ aln ;~(pose low hig nud) :: alphanumeric
36 ++ aln ;~(pose low hig nud) :: alphanumeric
26
37
27−Parse alphanumeric characters - both alphabetic characters and numbers.
38+Examples
39+--------
28
40
29 ~zod/try=> (scan "0" aln)
41 ~zod/try=> (scan "0" aln)
30 ~~0
42 ~~0
@@ -39,9 +51,15 @@ Parse alphanumeric characters - both alphabetic characters and numbers.
39
51
40Alphanumeric and `-`
52Alphanumeric and `-`
41
53
54+Parse alphanumeric strings and hep, "-".
55+
56+Source
57+------
58+
42 ++ alp ;~(pose low hig nud hep) :: alphanumeric and -
59 ++ alp ;~(pose low hig nud hep) :: alphanumeric and -
43
60
44−Parse alphanumeric strings and hep, "-".
61+Examples
62+--------
45
63
46 ~zod/try=> (scan "7" alp)
64 ~zod/try=> (scan "7" alp)
47 ~~7
65 ~~7
@@ -56,9 +74,15 @@ Parse alphanumeric strings and hep, "-".
56
74
57Axis syntax `-`, `+`
75Axis syntax `-`, `+`
58
76
77+Parse the hep and lus axis syntax.
78+
79+Source
80+------
81+
59 ++ bet ;~(pose (cold 2 hep) (cold 3 lus)) :: axis syntax - +
82 ++ bet ;~(pose (cold 2 hep) (cold 3 lus)) :: axis syntax - +
60
83
61−Parse the hep and lus axis syntax.
84+Examples
85+--------
62
86
63 ~zod/try=> (scan "-" bet)
87 ~zod/try=> (scan "-" bet)
64 2
88 2
@@ -71,10 +95,15 @@ Parse the hep and lus axis syntax.
71
95
72Binary to atom
96Binary to atom
73
97
98+Parse a tape of binary (0s and 1s) and produce its atomic representation.
99+
100+Source
101+------
102+
74 ++ bin (bass 2 (most gon but)) :: binary to atom
103 ++ bin (bass 2 (most gon but)) :: binary to atom
75
104
76−Parse a tape of binary (0s and 1s) and produce its atomic
105+Examples
77−representation.
106+--------
78
107
79 ~zod/try=> (scan "0000" bin)
108 ~zod/try=> (scan "0000" bin)
80 0
109 0
@@ -91,9 +120,15 @@ representation.
91
120
92Binary digit
121Binary digit
93
122
123+Parse a single binary digit.
124+
125+Source
126+------
127+
94 ++ but (cook |=(a=@ (sub a '0')) (shim '0' '1')) :: binary digit
128 ++ but (cook |=(a=@ (sub a '0')) (shim '0' '1')) :: binary digit
95
129
96−Parse a single binary digit.
130+Examples
131+--------
97
132
98 ~zod/try=> (scan "0" but)
133 ~zod/try=> (scan "0" but)
99 0
134 0
@@ -112,9 +147,15 @@ Parse a single binary digit.
112
147
113Octal digit
148Octal digit
114
149
150+Parse a single octal digit.
151+
152+Source
153+------
154+
115 ++ cit (cook |=(a=@ (sub a '0')) (shim '0' '7')) :: octal digit
155 ++ cit (cook |=(a=@ (sub a '0')) (shim '0' '7')) :: octal digit
116
156
117−Parse a single octal digit.
157+Examples
158+--------
118
159
119 ~zod/try=> (scan "1" cit)
160 ~zod/try=> (scan "1" cit)
120 1
161 1
@@ -133,9 +174,15 @@ Parse a single octal digit.
133
174
134Decimal to atom
175Decimal to atom
135
176
177+Parse a decimal number to an atom.
178+
179+Source
180+------
181+
136 ++ dem (bass 10 (most gon dit)) :: decimal to atom
182 ++ dem (bass 10 (most gon dit)) :: decimal to atom
137
183
138−Parse a decimal number to an atom.
184+Examples
185+--------
139
186
140 ~zod/try=> (scan "7" dem)
187 ~zod/try=> (scan "7" dem)
141 7
188 7
@@ -152,9 +199,15 @@ Parse a decimal number to an atom.
152
199
153Decimal digit
200Decimal digit
154
201
202+Parse a single decimal digit.
203+
204+Source
205+------
206+
155 ++ dit (cook |=(a=@ (sub a '0')) (shim '0' '9')) :: decimal digit
207 ++ dit (cook |=(a=@ (sub a '0')) (shim '0' '9')) :: decimal digit
156
208
157−Parse a single decimal digit.
209+Examples
210+--------
158
211
159 ~zod/try=> (scan "7" dit)
212 ~zod/try=> (scan "7" dit)
160 7
213 7
@@ -169,9 +222,15 @@ Parse a single decimal digit.
169
222
170Axis syntax `<` or `>`
223Axis syntax `<` or `>`
171
224
225+Parse the axis gal and gar axis syntax.
226+
227+Source
228+------
229+
172 ++ gul ;~(pose (cold 2 gal) (cold 3 gar)) :: axis syntax < >
230 ++ gul ;~(pose (cold 2 gal) (cold 3 gar)) :: axis syntax < >
173
231
174−Parse the axis gal and gar axis syntax.
232+Examples
233+--------
175
234
176 ~zod/try=> (scan "<" gul)
235 ~zod/try=> (scan "<" gul)
177 2
236 2
@@ -184,10 +243,16 @@ Parse the axis gal and gar axis syntax.
184
243
185Long numbers
244Long numbers
186
245
187− ++ gon ;~(pose ;~(plug bas gay fas) (easy ~)) :: long numbers \ /
188−
189Parse long numbers - Numbers which wrap around the shell with the line
246Parse long numbers - Numbers which wrap around the shell with the line
247+
248+Source
249+------
250+
251+break ++ gon ;~(pose ;~(plug bas gay fas) (easy ~)) :: long numbers \ /
252+
253+Examples
254+--------
190−break characters bas and fas.
255+characters bas and fas.
191
256
192 ~zod/try=> (scan "\\/" gon)
257 ~zod/try=> (scan "\\/" gon)
193 [~~~5c. ~ ~~~2f.]
258 [~~~5c. ~ ~~~2f.]
@@ -200,9 +265,15 @@ break characters bas and fas.
200
265
201Hex to atom
266Hex to atom
202
267
268+Parse any hexadecimal number to an atom.
269+
270+Source
271+------
272+
203 ++ hex (bass 16 (most gon hit)) :: hex to atom
273 ++ hex (bass 16 (most gon hit)) :: hex to atom
204
274
205−Parse any hexadecimal number to an atom.
275+Examples
276+--------
206
277
207 ~zod/try=> (scan "a" hex)
278 ~zod/try=> (scan "a" hex)
208 10
279 10
@@ -225,9 +296,15 @@ Parse any hexadecimal number to an atom.
225
296
226Uppercase
297Uppercase
227
298
299+Parse a single uppercase letter.
300+
301+Source
302+------
303+
228 ++ hig (shim 'A' 'Z') :: uppercase
304 ++ hig (shim 'A' 'Z') :: uppercase
229
305
230−Parse a single uppercase letter.
306+Examples
307+--------
231
308
232 ~zod/try=> (scan "G" hig)
309 ~zod/try=> (scan "G" hig)
233 ~~~47.
310 ~~~47.
@@ -244,13 +321,19 @@ Parse a single uppercase letter.
244
321
245Hex digits
322Hex digits
246
323
324+Parse a single hexadecimal digit.
325+
326+Source
327+------
328+
247 ++ hit ;~ pose :: hex digits
329 ++ hit ;~ pose :: hex digits
248 dit
330 dit
249 (cook |=(a=char (sub a 87)) (shim 'a' 'f'))
331 (cook |=(a=char (sub a 87)) (shim 'a' 'f'))
250 (cook |=(a=char (sub a 55)) (shim 'A' 'F'))
332 (cook |=(a=char (sub a 55)) (shim 'A' 'F'))
251 ==
333 ==
252
334
253−Parse a single hexadecimal digit.
335+Examples
336+--------
254
337
255 ~zod/try=> (scan "a" hit)
338 ~zod/try=> (scan "a" hit)
256 10
339 10
@@ -267,9 +350,15 @@ Parse a single hexadecimal digit.
267
350
268Lowercase
351Lowercase
269
352
353+Parse a single lowercase letter.
354+
355+Source
356+------
357+
270 ++ low (shim 'a' 'z') :: lowercase
358 ++ low (shim 'a' 'z') :: lowercase
271
359
272−Parse a single lowercase letter.
360+Examples
361+--------
273
362
274 ~zod/try=> (scan "g" low)
363 ~zod/try=> (scan "g" low)
275 ~~g
364 ~~g
@@ -286,11 +375,17 @@ Parse a single lowercase letter.
286
375
287Hexbyte
376Hexbyte
288
377
378+Parse a hexbyte.
379+
380+Source
381+------
382+
289 ++ mes %+ cook :: hexbyte
383 ++ mes %+ cook :: hexbyte
290 |=([a=@ b=@] (add (mul 16 a) b))
384 |=([a=@ b=@] (add (mul 16 a) b))
291 ;~(plug hit hit)
385 ;~(plug hit hit)
292
386
293−Parse a hexbyte.
387+Examples
388+--------
294
389
295 ~zod/try=> (scan "2A" mes)
390 ~zod/try=> (scan "2A" mes)
296 42
391 42
@@ -303,11 +398,17 @@ Parse a hexbyte.
303
398
304### `++nix`
399### `++nix`
305
400
306−Letters, `-`, and `_`
401+Letters and `-`
402+
403+Parse Letters and `-`.
404+
405+Source
406+------
307
407
308 ++ nix (boss 256 (star ;~(pose aln cab))) ::
408 ++ nix (boss 256 (star ;~(pose aln cab))) ::
309
409
310−Letters, `-`, and `_`
410+Examples
411+--------
311
412
312 ~zod/try=> (scan "as_me" nix)
413 ~zod/try=> (scan "as_me" nix)
313 q=435.626.668.897
414 q=435.626.668.897
@@ -320,9 +421,15 @@ Letters, `-`, and `_`
320
421
321Numeric
422Numeric
322
423
424+Parse a numeric character - A number.
425+
426+Source
427+------
428+
323 ++ nud (shim '0' '9') :: numeric
429 ++ nud (shim '0' '9') :: numeric
324
430
325−Parse a numeric character - A number.
431+Examples
432+--------
326
433
327 ~zod/try=> (scan "0" nud)
434 ~zod/try=> (scan "0" nud)
328 ~~0
435 ~~0
@@ -339,9 +446,15 @@ Parse a numeric character - A number.
339
446
340Printable character
447Printable character
341
448
449+Parse any printable character.
450+
451+Source
452+------
453+
342 ++ prn ;~(less (just `@`127) (shim 32 256))
454 ++ prn ;~(less (just `@`127) (shim 32 256))
343
455
344−Parse any printable character
456+Examples
457+--------
345
458
346 ~zod/try=> (scan "h" prn)
459 ~zod/try=> (scan "h" prn)
347 ~~h
460 ~~h
@@ -357,12 +470,18 @@ Parse any printable character
357
470
358Chars in blockcord
471Chars in blockcord
359
472
473+Parse character in cord block.
474+
475+Source
476+------
477+
360 ++ qat ;~ pose :: chars in blockcord
478 ++ qat ;~ pose :: chars in blockcord
361 prn
479 prn
362 ;~(less ;~(plug (just `@`10) soqs) (just `@`10))
480 ;~(less ;~(plug (just `@`10) soqs) (just `@`10))
363 ==
481 ==
364
482
365−Parse character in cord block.
483+Examples
484+--------
366
485
367 ~zod/try=> (scan "h" qat)
486 ~zod/try=> (scan "h" qat)
368 ~~h
487 ~~h
@@ -380,12 +499,18 @@ Parse character in cord block.
380
499
381Chars in cord
500Chars in cord
382
501
502+Parse an individual character to its cord atom representation.
503+
504+Source
505+------
506+
383 ++ qit ;~ pose :: chars in a cord
507 ++ qit ;~ pose :: chars in a cord
384 ;~(less bas soq prn)
508 ;~(less bas soq prn)
385 ;~(pfix bas ;~(pose bas soq mes)) :: escape chars
509 ;~(pfix bas ;~(pose bas soq mes)) :: escape chars
386 ==
510 ==
387
511
388−Parse an individual character to its cord atom representation.
512+Examples
513+--------
389
514
390 ~zod/try=> (scan "%" qit)
515 ~zod/try=> (scan "%" qit)
391 37
516 37
@@ -410,7 +535,13 @@ Parse an individual character to its cord atom representation.
410
535
411Cord
536Cord
412
537
538+Parse single-soq cord with `\{gap}/` anywhere in the middle, or triple-single
539+quote (aka triple-soq) cord, between which must be in an indented block.
540+
541+Source
542+------
543+
413− ++ qut ;~ pose :: cord
544+ ++ qut ;~ pose :: cord
414 ;~ less soqs
545 ;~ less soqs
415 (ifix [soq soq] (boss 256 (more gon qit)))
546 (ifix [soq soq] (boss 256 (more gon qit)))
416 ==
547 ==
@@ -423,8 +554,8 @@ Cord
423 ==
554 ==
424 ::
555 ::
425
556
426−Parse single-soq cord with `\{gap}/` anywhere in the middle, or
557+Examples
427−triple-soq cord which must be in an indented block.
558+--------
428
559
429 ~zod/try=> (scan "'cord'" qut)
560 ~zod/try=> (scan "'cord'" qut)
430 q=1.685.221.219
561 q=1.685.221.219
@@ -443,9 +574,15 @@ triple-soq cord which must be in an indented block.
443
574
444Delimiting `'''`
575Delimiting `'''`
445
576
577+Parse a triple-single quote, used for multiline strings.
578+
579+Source
580+------
581+
446 ++ soqs ;~(plug soq soq soq) :: delimiting '''
582 ++ soqs ;~(plug soq soq soq) :: delimiting '''
447
583
448−Triple single quote
584+Examples
585+--------
449
586
450 ~zod/try=> (scan "'''" soqs)
587 ~zod/try=> (scan "'''" soqs)
451 [~~~27. ~~~27. ~~~27.]
588 [~~~27. ~~~27. ~~~27.]
@@ -459,13 +596,19 @@ Triple single quote
459
596
460Term
597Term
461
598
599+A term: a letter(lowercase), followed by letters, numbers, or `-`.
600+
601+Source
602+------
603+
462 ++ sym
604 ++ sym
463 %+ cook
605 %+ cook
464 |=(a=tape (rap 3 ^-((list ,@) a)))
606 |=(a=tape (rap 3 ^-((list ,@) a)))
465 ;~(plug low (star ;~(pose nud low hep)))
607 ;~(plug low (star ;~(pose nud low hep)))
466 ::
608 ::
467
609
468−A term: a letter(lowercase), followed by letters, numbers, or `-`.
610+Examples
611+--------
469
612
470 ~zod/try=> (scan "sam-2" sym)
613 ~zod/try=> (scan "sam-2" sym)
471 215.510.507.891
614 215.510.507.891
@@ -480,6 +623,11 @@ A term: a letter(lowercase), followed by letters, numbers, or `-`.
480
623
481`+>-` axis syntax
624`+>-` axis syntax
482
625
626+Axis syntax parser
627+
628+Source
629+------
630+
483 ++ ven ;~ (comp |=([a=@ b=@] (peg a b))) :: +>- axis syntax
631 ++ ven ;~ (comp |=([a=@ b=@] (peg a b))) :: +>- axis syntax
484 bet
632 bet
485 =+ hom=`?`|
633 =+ hom=`?`|
@@ -493,7 +641,8 @@ A term: a letter(lowercase), followed by letters, numbers, or `-`.
493 [p.wag [~ (peg p.u.q.vex p.u.q.wag) q.u.q.wag]]
641 [p.wag [~ (peg p.u.q.vex p.u.q.wag) q.u.q.wag]]
494 ==
642 ==
495
643
496−Axis syntax parser
644+Examples
645+--------
497
646
498 ~zod/arvo=/hoon/hoon> (scan "->+" ven)
647 ~zod/arvo=/hoon/hoon> (scan "->+" ven)
499 11
648 11
@@ -510,6 +659,11 @@ Axis syntax parser
510
659
511Base64 digit
660Base64 digit
512
661
662+Parse a Terran base64 digit.
663+
664+Source
665+------
666+
513 ++ vit :: base64 digit
667 ++ vit :: base64 digit
514 ;~ pose
668 ;~ pose
515 (cook |=(a=@ (sub a 65)) (shim 'A' 'Z'))
669 (cook |=(a=@ (sub a 65)) (shim 'A' 'Z'))
@@ -519,7 +673,8 @@ Base64 digit
519 (cold 63 (just '+'))
673 (cold 63 (just '+'))
520 ==
674 ==
521
675
522−Terran base64
676+Examples
677+--------
523
678
524 ~zod/arvo=/hoon/hoon> (scan "C" vit)
679 ~zod/arvo=/hoon/hoon> (scan "C" vit)
525 2
680 2
docs/dev/hoon/library/2ei.md+75−19
@@ -5,14 +5,28 @@ section 2eI, parsing (external)
5
5
6Parse or crash
6Parse or crash
7
7
8− ++ rash |*([naf=@ sab=_rule] (scan (trip naf) sab)) ::
9−
10−Parse a cord with a given rule and crash if the cord isn't entirely
8+Parse a cord with a given [`++rule`]() and crash if the [`++cord`]() isn't entirely
11parsed.
9parsed.
12
10
13−`naf` is an [atom]().
11+Accepts
12+-------
14
13
14+`naf` is an atom.
15+
15−`sab` is a [rule]().
16+`sab` is a `++rule`.
17+
18+Produces
19+--------
20+
21+The value of the parse result, or crash.
22+
23+Source
24+------
25+
26+ ++ rash |*([naf=@ sab=_rule] (scan (trip naf) sab)) ::
27+
28+Examples
29+--------
16
30
17 ~zod/try=> (rash 'I was the world in which I walked, and what I saw' (star (shim 0 200)))
31 ~zod/try=> (rash 'I was the world in which I walked, and what I saw' (star (shim 0 200)))
18 "I was the world in which I walked, and what I saw"
32 "I was the world in which I walked, and what I saw"
@@ -33,15 +47,29 @@ parsed.
33
47
34Parse or null
48Parse or null
35
49
36− ++ rush |*([naf=@ sab=_rule] (rust (trip naf) sab))
37−
38Parse a given with a given rule and produce null if the cord isn't
50Parse a given with a given rule and produce null if the cord isn't
39entirely parsed.
51entirely parsed.
40
52
53+Accepts
54+-------
55+
41`naf` is an [atom]().
56`naf` is an [atom]().
42
57
43`sab` is a [rule]().
58`sab` is a [rule]().
44
59
60+Produces
61+--------
62+
63+The value of the parse result, or null.
64+
65+Source
66+------
67+
68+ ++ rush |*([naf=@ sab=_rule] (rust (trip naf) sab))
69+
70+Examples
71+--------
72+
45 ~zod/try=> (rush 'I was the world in which I walked, and what I saw' (star (shim 0 200)))
73 ~zod/try=> (rush 'I was the world in which I walked, and what I saw' (star (shim 0 200)))
46 [~ "I was the world in which I walked, and what I saw"]
74 [~ "I was the world in which I walked, and what I saw"]
47 ~zod/try=> (rush 'abc' (just 'a'))
75 ~zod/try=> (rush 'abc' (just 'a'))
@@ -59,16 +87,30 @@ entirely parsed.
59
87
60Parse tape or null
88Parse tape or null
61
89
90+Parse a [`++tape`]() with a given [`++rule`]() and produce null if the `++tape` isn't
91+entirely parsed.
92+
93+Accepts
94+-------
95+
96+`los` is a `++tape`.
97+
98+`sab` is a `++rule`.
99+
100+Produces
101+--------
102+
103+A `(unit ,@t)`
104+
105+Source
106+------
107+
62 ++ rust |* [los=tape sab=_rule]
108 ++ rust |* [los=tape sab=_rule]
63 =+ vex=((full sab) [[1 1] los])
109 =+ vex=((full sab) [[1 1] los])
64 ?~(q.vex ~ [~ u=p.u.q.vex])
110 ?~(q.vex ~ [~ u=p.u.q.vex])
65
111
66−Parse a tape with a given rule and produce null if the tape isn't
112+Examples
67−entirely parsed.
113+--------
68−
69−`los` is a [tape]().
70−
71−`sab` is a [rule]().
72
114
73 ~zod/try=> (rust "I was the world in which I walked, and what I saw" (star (shim 0 200)))
115 ~zod/try=> (rust "I was the world in which I walked, and what I saw" (star (shim 0 200)))
74 [~ "I was the world in which I walked, and what I saw"]
116 [~ "I was the world in which I walked, and what I saw"]
@@ -83,6 +125,24 @@ entirely parsed.
83
125
84Parse tape or crash
126Parse tape or crash
85
127
128+Parse a [`++tape`]() with a given [`++rule`]() and crash if the `++tape` isn't entirely
129+parsed.
130+
131+Accepts
132+-------
133+
134+`los` is a [tape]().
135+
136+`sab` is a [rule]().
137+
138+Produces
139+--------
140+
141+Either a `++tape` or a crash.
142+
143+Source
144+------
145+
86 ++ scan |* [los=tape sab=_rule]
146 ++ scan |* [los=tape sab=_rule]
87 =+ vex=((full sab) [[1 1] los])
147 =+ vex=((full sab) [[1 1] los])
88 ?~ q.vex
148 ?~ q.vex
@@ -90,12 +150,8 @@ Parse tape or crash
90 ~|('syntax-error' !!)
150 ~|('syntax-error' !!)
91 p.u.q.vex
151 p.u.q.vex
92
152
93−Parse a tape with a given rule and crash if the tape isn't entirely
153+Examples
94−parsed.
154+--------
95−
96−`los` is a [tape]().
97−
98−`sab` is a [rule]().
99
155
100 ~zod/try=> (scan "I was the world in which I walked, and what I saw" (star (shim 0 200)))
156 ~zod/try=> (scan "I was the world in which I walked, and what I saw" (star (shim 0 200)))
101 "I was the world in which I walked, and what I saw"
157 "I was the world in which I walked, and what I saw"
docs/dev/hoon/library/2ej.md+316−64
@@ -5,15 +5,29 @@ section 2eJ, formatting (basic text)
5
5
6To lowercase
6To lowercase
7
7
8+Produce the case insensitive (all lowercase) [`++cord`]() of a [`++tape`]().
9+
10+Accepts
11+-------
12+
13+`vib` is a `++tape`.
14+
15+Produces
16+--------
17+
18+A `++cord`.
19+
20+Source
21+------
22+
8 ++ cass :: lowercase
23 ++ cass :: lowercase
9 |= vib=tape
24 |= vib=tape
10 %+ rap 3
25 %+ rap 3
11 (turn vib |=(a=@ ?.(&((gte a 'A') (lte a 'Z')) a (add 32 a))))
26 (turn vib |=(a=@ ?.(&((gte a 'A') (lte a 'Z')) a (add 32 a))))
12 ::
27 ::
13
28
14−Produce the case insensitive (all lowercase) cord of a tape.
29+Examples
15−
30+--------
16−`vib` is a [tape]().
17
31
18 ~zod/try=> (cass "john doe")
32 ~zod/try=> (cass "john doe")
19 7.309.170.810.699.673.450
33 7.309.170.810.699.673.450
@@ -30,6 +44,22 @@ Produce the case insensitive (all lowercase) cord of a tape.
30
44
31To uppercase
45To uppercase
32
46
47+Turn all occurances of lowercase letters in any [`++tape`]() into uppercase
48+letters, as a [`++cord`]().
49+
50+Accepts
51+-------
52+
53+`vib` is a `++tape`.
54+
55+Produces
56+--------
57+
58+A `++cord`.
59+
60+Source
61+------
62+
33 ++ cuss :: uppercase
63 ++ cuss :: uppercase
34 |= vib=tape
64 |= vib=tape
35 ^- @t
65 ^- @t
@@ -37,10 +67,8 @@ To uppercase
37 (turn vib |=(a=@ ?.(&((gte a 'a') (lte a 'z')) a (sub a 32))))
67 (turn vib |=(a=@ ?.(&((gte a 'a') (lte a 'z')) a (sub a 32))))
38 ::
68 ::
39
69
40−Turn all occurances of lowercase letters in any tape into uppercase
70+Examples
41−letters, as a cord.
71+--------
42−
43−`vib` is a [tape]().
44
72
45 ~zod/try=> (cuss "john doe")
73 ~zod/try=> (cuss "john doe")
46 'JOHN DOE'
74 'JOHN DOE'
@@ -57,11 +85,25 @@ letters, as a cord.
57
85
58Tape to cord
86Tape to cord
59
87
60− ++ crip |=(a=tape `@t`(rap 3 a)) :: tape to cord
88+Produce a [`++cord`]() from a [`++tape`]().
61
89
62−Produce cord from a tape.
90+Accepts
91+-------
63
92
64−`a` is a [tape]().
93+`a` is a `++tape`.
94+
95+Produces
96+--------
97+
98+A `++cord`.
99+
100+Source
101+------
102+
103+ ++ crip |=(a=tape `@t`(rap 3 a)) :: tape to cord
104+
105+Examples
106+--------
65
107
66 ~zod/try=> (crip "john doe")
108 ~zod/try=> (crip "john doe")
67 'john doe'
109 'john doe'
@@ -76,6 +118,21 @@ Produce cord from a tape.
76
118
77Escape special chars
119Escape special chars
78
120
121+Escape special characters, used in [`++show`](/doc/hoon/library/2ez#++show)
122+
123+Accepts
124+-------
125+
126+`vib` is a [`++tape`]().
127+
128+Produces
129+--------
130+
131+A `++tape`.
132+
133+Source
134+------
135+
79 ++ mesc :: ctrl code escape
136 ++ mesc :: ctrl code escape
80 |= vib=tape
137 |= vib=tape
81 ^- tape
138 ^- tape
@@ -88,9 +145,8 @@ Escape special chars
88 [i.vib $(vib t.vib)]
145 [i.vib $(vib t.vib)]
89 ::
146 ::
90
147
91−Escape special characters, used in [`++show`](/doc/hoon/library/2ez#++show)
148+Examples
92−
149+--------
93−`vib` is a [tape]().
94
150
95 /~zod/try=> (mesc "ham lus")
151 /~zod/try=> (mesc "ham lus")
96 "ham lus"
152 "ham lus"
@@ -105,6 +161,23 @@ Escape special characters, used in [`++show`](/doc/hoon/library/2ez#++show)
105
161
106Prepend `n` times
162Prepend `n` times
107
163
164+Add `a` repetitions of character `b` to the head of [`++tape`]() `c`.
165+
166+Accepts
167+-------
168+
169+`a` and `b` are atoms.
170+
171+`c` is a `++tape`.
172+
173+Produces
174+--------
175+
176+A `++tape`.
177+
178+Source
179+------
180+
108 ++ runt :: prepend repeatedly
181 ++ runt :: prepend repeatedly
109 |= [[a=@ b=@] c=tape]
182 |= [[a=@ b=@] c=tape]
110 ^- tape
183 ^- tape
@@ -113,11 +186,8 @@ Prepend `n` times
113 [b $(a (dec a))]
186 [b $(a (dec a))]
114 ::
187 ::
115
188
116−Add `a` repetitions of character `b` to the head of `c`
189+Examples
117−
190+--------
118−`a` and `b` are [atom]()s.
119−
120−`c` is a [tape]().
121
191
122 /~zod/try=> (runt [2 '/'] "ham")
192 /~zod/try=> (runt [2 '/'] "ham")
123 "//ham"
193 "//ham"
@@ -130,17 +200,31 @@ Add `a` repetitions of character `b` to the head of `c`
130
200
131Soft-cast by odor
201Soft-cast by odor
132
202
203+Soft-cast validity by [odor]().
204+
205+Accepts
206+-------
207+
208+`a` is a [`++span`]() (`@ta`).
209+
210+`b` is an atom.
211+
212+Produces
213+--------
214+
215+A `(unit ,@)`.
216+
217+Source
218+------
219+
133 ++ sand :: atom sanity
220 ++ sand :: atom sanity
134 |= a=@ta
221 |= a=@ta
135 |= b=@ ^- (unit ,@)
222 |= b=@ ^- (unit ,@)
136 ?.(((sane a) b) ~ [~ b])
223 ?.(((sane a) b) ~ [~ b])
137 ::
224 ::
138
225
139−Soft-cast validity by odor.
226+Examples
140−
227+--------
141−`a` is a [`@ta`]().
142−
143−`b` is an [atom]().
144
228
145 /~zod/try=> `(unit ,@ta)`((sand %ta) 'sym-som')
229 /~zod/try=> `(unit ,@ta)`((sand %ta) 'sym-som')
146 [~ ~.sym-som]
230 [~ ~.sym-som]
@@ -153,6 +237,23 @@ Soft-cast validity by odor.
153
237
154Check odor validity
238Check odor validity
155
239
240+Check validity by [odor](). Produces a [gate]().
241+
242+Accepts
243+-------
244+
245+`a` is a [`++span`]() (`@ta`).
246+
247+`b` is an [atom]().
248+
249+Produces
250+--------
251+
252+A boolean.
253+
254+Source
255+------
256+
156 ++ sane :: atom sanity
257 ++ sane :: atom sanity
157 |= a=@ta
258 |= a=@ta
158 |= b=@ ^- ?
259 |= b=@ ^- ?
@@ -189,11 +290,8 @@ Check odor validity
189 ==
290 ==
190 ::
291 ::
191
292
192−Check validity by odor. Produces a gate.
293+Examples
193−
294+--------
194−`a` is a [`@ta`]().
195−
196−`b` is an [atom]().
197
295
198 /~zod/try=> ((sane %tas) %mol)
296 /~zod/try=> ((sane %tas) %mol)
199 %.y
297 %.y
@@ -208,6 +306,23 @@ Check validity by odor. Produces a gate.
208
306
209Tape split
307Tape split
210
308
309+Split first `a` characters off [`++tape`]() `b`.
310+
311+Accepts
312+-------
313+
314+`a` is an atom.
315+
316+`b` is a `++tape`.
317+
318+Produces
319+--------
320+
321+A cell of `++tape`s, `p` and `q`.
322+
323+Source
324+------
325+
211 ++ trim :: tape split
326 ++ trim :: tape split
212 |= [a=@ b=tape]
327 |= [a=@ b=tape]
213 ^- [p=tape q=tape]
328 ^- [p=tape q=tape]
@@ -219,11 +334,8 @@ Tape split
219 [[i.b p.c] q.c]
334 [[i.b p.c] q.c]
220 ::
335 ::
221
336
222−Split first `a` characters off tape.
337+Examples
223−
338+--------
224−`a` is an [atom]().
225−
226−`b` is a [tape]().
227
339
228 /~zod/try=> (trim 5 "lasok termun")
340 /~zod/try=> (trim 5 "lasok termun")
229 [p="lasok" q=" termun"]
341 [p="lasok" q=" termun"]
@@ -236,6 +348,21 @@ Split first `a` characters off tape.
236
348
237Cord to tape
349Cord to tape
238
350
351+Produce a [`++tape`]() from [`++cord`]().
352+
353+Accepts
354+-------
355+
356+`a` is an atom.
357+
358+Produces
359+--------
360+
361+A `++tape`.
362+
363+Source
364+------
365+
239 ++ trip :: cord to tape
366 ++ trip :: cord to tape
240 ~/ %trip
367 ~/ %trip
241 |= a=@ ^- tape
368 |= a=@ ^- tape
@@ -244,9 +371,8 @@ Cord to tape
244 [^-(@ta (end 3 1 a)) $(a (rsh 3 1 a))]
371 [^-(@ta (end 3 1 a)) $(a (rsh 3 1 a))]
245 ::
372 ::
246
373
247−Produce tape from cord.
374+Examples
248−
375+--------
249−`a` is an [atom]().
250
376
251 /~zod/try=> (trip 'john doe')
377 /~zod/try=> (trip 'john doe')
252 "john doe"
378 "john doe"
@@ -261,6 +387,21 @@ Produce tape from cord.
261
387
262UTF8 Length
388UTF8 Length
263
389
390+Produces the number of utf8 bytes.
391+
392+Accepts
393+-------
394+
395+`a` is a [`@t`]().
396+
397+Produces
398+--------
399+
400+An atom.
401+
402+Source
403+------
404+
264 ++ teff :: length utf8
405 ++ teff :: length utf8
265 |= a=@t ^- @
406 |= a=@t ^- @
266 =+ b=(end 3 1 a)
407 =+ b=(end 3 1 a)
@@ -270,9 +411,8 @@ UTF8 Length
270 ?:((lte b 127) 1 ?:((lte b 223) 2 ?:((lte b 239) 3 4)))
411 ?:((lte b 127) 1 ?:((lte b 223) 2 ?:((lte b 239) 3 4)))
271 ::
412 ::
272
413
273−Number of utf8 bytes.
414+Examples
274−
415+--------
275−`a` is a [`@t`]().
276
416
277 /~zod/try=> (teff 'a')
417 /~zod/try=> (teff 'a')
278 1
418 1
@@ -285,6 +425,21 @@ Number of utf8 bytes.
285
425
286UTF8 to UTF32 cord
426UTF8 to UTF32 cord
287
427
428+Convert utf8 ([`++cord`]()) to utf32 codepoints.
429+
430+Accepts
431+-------
432+
433+`a` is a [`@t`]().
434+
435+Produces
436+--------
437+
438+A [`@c`](), UTF-32 codepoint.
439+
440+Source
441+------
442+
288 ++ turf :: utf8 to utf32
443 ++ turf :: utf8 to utf32
289 |= a=@t
444 |= a=@t
290 ^- @c
445 ^- @c
@@ -305,9 +460,8 @@ UTF8 to UTF32 cord
305 $(a (rsh 3 b a))
460 $(a (rsh 3 b a))
306 ::
461 ::
307
462
308−Convert utf8 ([cord]()) to utf32 codepoints.
463+Examples
309−
464+--------
310−`a` is a [`@t`]().
311
465
312 /~zod/try=> (turf 'my ßam')
466 /~zod/try=> (turf 'my ßam')
313 ~-my.~df.am
467 ~-my.~df.am
@@ -326,15 +480,29 @@ Convert utf8 ([cord]()) to utf32 codepoints.
326
480
327UTF8 to UTF32 tape
481UTF8 to UTF32 tape
328
482
483+Convert [`++tape`]() to a [`++list`]() of codepoints ([`@c`]()).
484+
485+Accepts
486+-------
487+
488+`a` is a `++tape`.
489+
490+Produces
491+--------
492+
493+A `++list` of codepoints [`@c`]().
494+
495+Source
496+------
497+
329 ++ tuba :: utf8 to utf32 tape
498 ++ tuba :: utf8 to utf32 tape
330 |= a=tape
499 |= a=tape
331 ^- (list ,@c)
500 ^- (list ,@c)
332 (rip 5 (turf (rap 3 a))) :: XX horrible
501 (rip 5 (turf (rap 3 a))) :: XX horrible
333 ::
502 ::
334
503
335−Convert tape to list of codepoints.
504+Examples
336−
505+--------
337−`a` is a [tape]()
338
506
339 /~zod/try=> (tuba "я тут")
507 /~zod/try=> (tuba "я тут")
340 ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.]
508 ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.]
@@ -347,6 +515,21 @@ Convert tape to list of codepoints.
347
515
348UTF32 to UTF8 tape
516UTF32 to UTF8 tape
349
517
518+Wrap a [`++list`]() of utf32 codepoints into a utf8 [`++tape`]().
519+
520+Accepts
521+-------
522+
523+`a` is a `++list` of [`@c`]().
524+
525+Produces
526+--------
527+
528+A `++tape`.
529+
530+Source
531+------
532+
350 ++ tufa :: utf32 to utf8 tape
533 ++ tufa :: utf32 to utf8 tape
351 |= a=(list ,@c)
534 |= a=(list ,@c)
352 ^- tape
535 ^- tape
@@ -354,9 +537,8 @@ UTF32 to UTF8 tape
354 (weld (rip 3 (tuft i.a)) $(a t.a))
537 (weld (rip 3 (tuft i.a)) $(a t.a))
355 ::
538 ::
356
539
357−Wrap list of utf32 codepoints to utf8 [tape]().
540+Examples
358−
541+--------
359−`a` is a [list]() of [`@c`]().
360
542
361 /~zod/try=> (tufa ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.])
543 /~zod/try=> (tufa ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.])
362 "я тут"
544 "я тут"
@@ -369,6 +551,22 @@ Wrap list of utf32 codepoints to utf8 [tape]().
369
551
370UTF32 to UTF8 text
552UTF32 to UTF8 text
371
553
554+Convert utf32 glyph to
555+[LSB](http://en.wikipedia.org/wiki/Least_significant_bit) utf8 [`++cord`]().
556+
557+Accepts
558+-------
559+
560+`a` is a codepoint ([`@c`]()).
561+
562+Produces
563+--------
564+
565+A `++cord`.
566+
567+Source
568+------
569+
372 ++ tuft :: utf32 to utf8 text
570 ++ tuft :: utf32 to utf8 text
373 |= a=@c
571 |= a=@c
374 ^- @t
572 ^- @t
@@ -399,10 +597,8 @@ UTF32 to UTF8 text
399 ==
597 ==
400 ::
598 ::
401
599
402−Convert utf32 glyph to
600+Examples
403−[LSB](http://en.wikipedia.org/wiki/Least_significant_bit) utf8 cord.
601+--------
404−
405−`a` is a [`@c`]().
406
602
407 /~zod/try=> (tuft `@c`%a)
603 /~zod/try=> (tuft `@c`%a)
408 'a'
604 'a'
@@ -415,6 +611,21 @@ Convert utf32 glyph to
415
611
416Coin format encode
612Coin format encode
417
613
614+Escape [`++span`]() `~` as `~~` and `_` as `~-`. Used for printing.
615+
616+Accepts
617+-------
618+
619+`a` is a `++span` (`@ta`).
620+
621+Produces
622+--------
623+
624+A [`++span`]() (`@ta`).
625+
626+Source
627+------
628+
418 ++ wack :: coin format
629 ++ wack :: coin format
419 |= a=@ta
630 |= a=@ta
420 ^- @ta
631 ^- @ta
@@ -428,9 +639,8 @@ Coin format encode
428 [i.b $(b t.b)]
639 [i.b $(b t.b)]
429 ::
640 ::
430
641
431−Escape span `~` as `~~` and `_` as `~-`. Used for printing.
642+Examples
432−
643+--------
433−`a` is a [`@ta`]().
434
644
435 /~zod/try=> (wack '~20_sam~')
645 /~zod/try=> (wack '~20_sam~')
436 ~.~~20~-sam~~
646 ~.~~20~-sam~~
@@ -447,6 +657,21 @@ Escape span `~` as `~~` and `_` as `~-`. Used for printing.
447
657
448Coin format decode
658Coin format decode
449
659
660+Unescape [`++span`]() `~~` as `~` and `~-` as `_`.
661+
662+Accepts
663+-------
664+
665+`a` is a an [atom]().
666+
667+Produces
668+--------
669+
670+A [`++span`]() `@ta`.
671+
672+Source
673+------
674+
450 ++ wick :: coin format
675 ++ wick :: coin format
451 |= a=@
676 |= a=@
452 ^- @ta
677 ^- @ta
@@ -461,9 +686,8 @@ Coin format decode
461 [i.b $(b t.b)]
686 [i.b $(b t.b)]
462 ::
687 ::
463
688
464−Unescape span `~~` as `~` and `~-` as `_`.
689+Examples
465−
690+--------
466−`a` is a an [atom]().
467
691
468 /~zod/try=> `@t`(wick '~-ams~~lop')
692 /~zod/try=> `@t`(wick '~-ams~~lop')
469 '_ams~lop'
693 '_ams~lop'
@@ -476,6 +700,21 @@ Unescape span `~~` as `~` and `~-` as `_`.
476
700
477Unescape cord
701Unescape cord
478
702
703+Unescape [`++cord`]() codepoints.
704+
705+Accepts
706+-------
707+
708+`a` is a [`@ta`]().
709+
710+Produces
711+--------
712+
713+A [`++cord`]().
714+
715+Source
716+------
717+
479 ++ woad :: cord format
718 ++ woad :: cord format
480 |= a=@ta
719 |= a=@ta
481 ^- @t
720 ^- @t
@@ -510,9 +749,8 @@ Unescape cord
510 ==
749 ==
511 ::
750 ::
512
751
513−Unescape cord codepoints.
752+Examples
514−
753+--------
515−`a` is a [`@ta`]().
516
754
517 /~zod/try=> (woad ~.~b6.20.as)
755 /~zod/try=> (woad ~.~b6.20.as)
518 '¶20 as'
756 '¶20 as'
@@ -523,6 +761,21 @@ Unescape cord codepoints.
523
761
524Escape cord
762Escape cord
525
763
764+Escape [`++cord`]() codepoints.
765+
766+Accepts
767+-------
768+
769+`a` is a [`++span`]() (`@ta`).
770+
771+Produces
772+--------
773+
774+A [`++span`]() (`@ta`).
775+
776+Source
777+------
778+
526 ++ wood :: cord format
779 ++ wood :: cord format
527 |= a=@t
780 |= a=@t
528 ^- @ta
781 ^- @ta
@@ -553,9 +806,8 @@ Escape cord
553 %'~' ['~' '~' d]
806 %'~' ['~' '~' d]
554 ==
807 ==
555
808
556−Escape cord codepoints.
809+Examples
557−
810+--------
558−`a` is a [`@ta`]().
559
811
560 /~zod/try=> (wood 'my ßam')
812 /~zod/try=> (wood 'my ßam')
561 ~.my.~df.am
813 ~.my.~df.am
docs/dev/hoon/library/2ek.md+115−13
@@ -5,12 +5,21 @@ section 2eK, formatting (layout)
5
5
6Pretty-printing engine
6Pretty-printing engine
7
7
8+Pretty-printing engine that accepts a [`++tank`](/doc/hoon/library/1#++tank) [sample]() and contains arms that perform computation on it.
9+
10+Accepts
11+-------
12+
13+`tac` is a `++tank`.
14+
15+Produces
16+--------
17+
8 ++ re
18 ++ re
9 |_ tac=tank
19 |_ tac=tank
10
20
11−Pretty-printing engine.
21+Examples
12−
22+--------
13−`tac` is a [`++tank`](/doc/hoon/library/1#++tank).
14
23
15 /~zod/try=> ~(. re leaf/"ham")
24 /~zod/try=> ~(. re leaf/"ham")
16 <2.ghl [[%leaf ""] <414.gly 100.xkc 1.ypj %164>]>
25 <2.ghl [[%leaf ""] <414.gly 100.xkc 1.ypj %164>]>
@@ -19,6 +28,21 @@ Pretty-printing engine.
19
28
20Flatten to tape
29Flatten to tape
21
30
31+Flatten [`++tank`]() out into a [`++tape`]().
32+
33+Accepts
34+-------
35+
36+`tac` is a `++tank`, taken from [sample]() of `++re` [core]().
37+
38+Produces
39+--------
40+
41+A `++tape`.
42+
43+Source
44+------
45+
22 ++ ram
46 ++ ram
23 ^- tape
47 ^- tape
24 ?- -.tac
48 ?- -.tac
@@ -35,7 +59,8 @@ Flatten to tape
35 ==
59 ==
36 ::
60 ::
37
61
38−Flatten tank out into a tape.
62+Examples
63+--------
39
64
40 /~zod/try=> ~(ram re leaf/"foo")
65 /~zod/try=> ~(ram re leaf/"foo")
41 "foo"
66 "foo"
@@ -46,6 +71,23 @@ Flatten tank out into a tape.
46
71
47Render at indent
72Render at indent
48
73
74+Render at indent level `tab` and width `edg`.
75+
76+Accepts
77+-------
78+
79+`tac` is a `++tank`, taken from [sample]() of `++re` [core]().
80+
81+`tab` and `edg` are atoms.
82+
83+Produces
84+--------
85+
86+A [`++wall`]() ([`++list`]() of [`++tapes`]()).
87+
88+Source
89+------
90+
49 ++ win
91 ++ win
50 |= [tab=@ edg=@]
92 |= [tab=@ edg=@]
51 =+ lug=`wall`~
93 =+ lug=`wall`~
@@ -86,9 +128,8 @@ Render at indent
86 ==
128 ==
87 ::
129 ::
88
130
89−Render at indent level `tab` and width `edg`.
131+Examples
90−
132+--------
91−`tab` and `edg` are [atom]()s.
92
133
93 /~zod/try=> (~(win re leaf/"samoltekon-lapdok") 0 20)
134 /~zod/try=> (~(win re leaf/"samoltekon-lapdok") 0 20)
94 <<"samoltekon-lapdok">>
135 <<"samoltekon-lapdok">>
@@ -101,22 +142,70 @@ Render at indent level `tab` and width `edg`.
101
142
102### `++din`
143### `++din`
103
144
145+XX document
146+
147+Accepts
148+-------
149+
150+Produces
151+--------
152+
153+Source
154+------
155+
104 ++ din (mod (add 2 tab) (mul 2 (div edg 3)))
156 ++ din (mod (add 2 tab) (mul 2 (div edg 3)))
105
157
106−XX document
158+
159+----------------------------------------------------------------------
107
160
108### `++fit`
161### `++fit`
109
162
110Fit on one line test
163Fit on one line test
111
164
112− ++ fit (lte (lent ram) (sub edg tab))
113−
114Determine whether `tac` fits on one line. Internal to `++win`
165Determine whether `tac` fits on one line. Internal to `++win`
115
166
167+Accepts
168+-------
169+
170+Produces
171+--------
172+
173+Source
174+------
175+
176+++ fit (lte (lent ram) (sub edg tab))
177+
178+
179+Examples
180+--------
181+
182+
183+
184+
185+----------------------------------------------------------------------
186+
116### `++rig`
187### `++rig`
117
188
118Wrap in `\/`
189Wrap in `\/`
119
190
191+Wrap [`++tape`]() in `\/` if it doesn't fit at current indentation. Internal to
192+[`++win`]()
193+
194+Accepts
195+-------
196+
197+`tac` is a `++tank`, taken from [sample]() of `++re` [core]().
198+
199+`hom` is a `++tape`.
200+
201+Produces
202+--------
203+
204+A [`++wall`]() (list of `++tape`s).
205+
206+Source
207+------
208+
120 ++ rig
209 ++ rig
121 |= hom=tape
210 |= hom=tape
122 ^- wall
211 ^- wall
@@ -136,13 +225,25 @@ Wrap in `\/`
136 [(runt [tab ' '] p.mut) $(hom q.mut)]
225 [(runt [tab ' '] p.mut) $(hom q.mut)]
137 ::
226 ::
138
227
139−Wrap tape in `\/` if it doesn't fit at current indentation. Internal to
228+Examples
140−`++win`
229+--------
141
230
142### `++wig`
231### `++wig`
143
232
144`++win` render tape
233`++win` render tape
145
234
235+Render [`++tape`](). Internal to [`++win`]().
236+
237+Accepts
238+-------
239+
240+`tac` is a `++tank`, taken from [sample]() of `++re` [core]().
241+
242+`hom` is a `++tape`.
243+
244+Produces
245+--------
246+
146 ++ wig
247 ++ wig
147 |= hom=tape
248 |= hom=tape
148 ^- wall
249 ^- wall
@@ -159,4 +260,5 @@ Wrap tape in `\/` if it doesn't fit at current indentation. Internal to
159 --
260 --
160 --
261 --
161
262
162−Render tape. Internal to `++win`.
263+Examples
264+--------
docs/dev/hoon/library/2el.md+1128−136
@@ -5,10 +5,16 @@ section 2eL, formatting (path)
5
5
6Primitive parser engine
6Primitive parser engine
7
7
8+A core containing numeric parser primitives.
9+
10+Source
11+------
12+
8 ++ ab
13 ++ ab
9 |%
14 |%
10
15
11−A core containing numeric parser primitives.
16+Examples
17+--------
12
18
13 ~zod/try=> ab
19 ~zod/try=> ab
14 <36.ecc 414.gly 100.xkc 1.ypj %164>
20 <36.ecc 414.gly 100.xkc 1.ypj %164>
@@ -19,9 +25,25 @@ A core containing numeric parser primitives.
19
25
20Parse hex pair
26Parse hex pair
21
27
28+Parsing [`++rule`](). Parses a pair of base-16 digits. Used in escapes.
29+
30+Accepts
31+-------
32+
33+XX
34+
35+Produces
36+--------
37+
38+A an atom. XX
39+
40+Source
41+------
42+
22 ++ bix (bass 16 (stun [2 2] six))
43 ++ bix (bass 16 (stun [2 2] six))
23
44
24−Parsing rule. Parses a pair of base-16 digits. Used in escapes.
45+Examples
46+--------
25
47
26 ~zod/try=> (scan "07" bix:ab)
48 ~zod/try=> (scan "07" bix:ab)
27 q=7
49 q=7
@@ -36,10 +58,26 @@ Parsing rule. Parses a pair of base-16 digits. Used in escapes.
36
58
37Parse phonetic pair
59Parse phonetic pair
38
60
61+Parsing [`++rule`](). Parses an atom of [odor]() [`@pE`](), a phrase of two bytes
62+encoded phonetically.
63+
64+Accepts
65+-------
66+
67+XX
68+
69+Produces
70+--------
71+
72+An atom.
73+
74+Source
75+------
76+
39 ++ hif (boss 256 ;~(plug tip tiq (easy ~)))
77 ++ hif (boss 256 ;~(plug tip tiq (easy ~)))
40
78
41−Parsing rule. Parses an atom of odor [`@pE`](), a phrase of two bytes
79+Examples
42−encoded phonetically.
80+--------
43
81
44 ~zod/try=> (scan "doznec" hif:ab)
82 ~zod/try=> (scan "doznec" hif:ab)
45 q=256
83 q=256
@@ -52,12 +90,28 @@ encoded phonetically.
52
90
53Parse two phonetic pairs
91Parse two phonetic pairs
54
92
93+Parsing [`++rule`](). Parses and unscrambles an atom of odor [@pF](), a phrase
94+of two two-byte pairs that are encoded (and scrambled) phonetically.
95+
96+Accepts
97+-------
98+
99+XX
100+
101+Produces
102+--------
103+
104+An atom. XX
105+
106+Source
107+------
108+
55 ++ huf %+ cook
109 ++ huf %+ cook
56 |=([a=@ b=@] (wred:un ~(zug mu ~(zag mu [a b]))))
110 |=([a=@ b=@] (wred:un ~(zug mu ~(zag mu [a b]))))
57 ;~(plug hif ;~(pfix hep hif))
111 ;~(plug hif ;~(pfix hep hif))
58
112
59−Parsing rule. Parses and unscrambles an atom of odor [@pF](), a phrase
113+Examples
60−of two two-byte pairs that are encoded (and scrambled) phonetically.
114+--------
61
115
62 ~zod/try=> (scan "pittyp-pittyp" huf:ab)
116 ~zod/try=> (scan "pittyp-pittyp" huf:ab)
63 328.203.557
117 328.203.557
@@ -72,10 +126,26 @@ of two two-byte pairs that are encoded (and scrambled) phonetically.
72
126
73Parse 8 phonetic bytes
127Parse 8 phonetic bytes
74
128
129+Parsing [`++rule`](). Parses an atom of odor [@pG](), a phrase of eight of
130+phonetic bytes.
131+
132+Accepts
133+-------
134+
135+An atom of odor [`@pG`]()
136+
137+Produces
138+--------
139+
140+An atom. XX
141+
142+Source
143+------
144+
75 ++ hyf (bass 0x1.0000.0000 ;~(plug huf ;~(pfix hep huf) (easy ~)))
145 ++ hyf (bass 0x1.0000.0000 ;~(plug huf ;~(pfix hep huf) (easy ~)))
76
146
77−Parsing rule. Parses an atom of odor [@pG](), a phrase of eight of
147+Examples
78−phonetic bytes.
148+--------
79
149
80 ~zod/try=> (scan "sondel-forsut-tillyn-nillyt" hyf:ab)
150 ~zod/try=> (scan "sondel-forsut-tillyn-nillyt" hyf:ab)
81 q=365.637.097.828.335.095
151 q=365.637.097.828.335.095
@@ -88,9 +158,25 @@ phonetic bytes.
88
158
89Parse \<= 5 base-32
159Parse \<= 5 base-32
90
160
161+Parsing [`++rule`](). Parses up to five base-32 digits without a leading zero.
162+
163+Accepts
164+-------
165+
166+Up to five [@uv]() (base 64) digits.
167+
168+Produces
169+--------
170+
171+An atom.
172+
173+Source
174+------
175+
91 ++ pev (bass 32 ;~(plug sev (stun [0 4] siv)))
176 ++ pev (bass 32 ;~(plug sev (stun [0 4] siv)))
92
177
93−Parsing rule. Parses up to five base-32 digits without a leading zero.
178+Examples
179+--------
94
180
95 ~zod/try=> (scan "a" pev:ab)
181 ~zod/try=> (scan "a" pev:ab)
96 q=10
182 q=10
@@ -108,9 +194,25 @@ Parsing rule. Parses up to five base-32 digits without a leading zero.
108
194
109Parse \<= 5 base-64
195Parse \<= 5 base-64
110
196
197+Parsing [`++rule`](). Parses up to five base-64 digits without a leading zero.
198+
199+Accepts
200+-------
201+
202+Up to five [@uw]() (base 64) digits.
203+
204+Produces
205+--------
206+
207+
208+
209+Source
210+------
211+
111 ++ pew (bass 64 ;~(plug sew (stun [0 4] siw)))
212 ++ pew (bass 64 ;~(plug sew (stun [0 4] siw)))
112
213
113−Parsing rule. Parses up to five base-64 digits without a leading zero.
214+Examples
215+--------
114
216
115 ~zod/try=> (scan "Q" pew:ab)
217 ~zod/try=> (scan "Q" pew:ab)
116 q=52
218 q=52
@@ -131,9 +233,21 @@ Parsing rule. Parses up to five base-64 digits without a leading zero.
131
233
132Parse 5 base-32
234Parse 5 base-32
133
235
236+Parsing [`++rule`](). Parses exactly five base-32 digits.
237+
238+Accepts
239+-------
240+
241+Produces
242+--------
243+
244+Source
245+------
246+
134 ++ piv (bass 32 (stun [5 5] siv))
247 ++ piv (bass 32 (stun [5 5] siv))
135
248
136−Parsing rule. Parses exactly five base-32 digits.
249+Examples
250+--------
137
251
138 ~zod/try=> (scan "10b3l" piv:ab)
252 ~zod/try=> (scan "10b3l" piv:ab)
139 q=1.059.957
253 q=1.059.957
@@ -147,9 +261,23 @@ Parsing rule. Parses exactly five base-32 digits.
147
261
148Parse 5 base-64
262Parse 5 base-64
149
263
264+Parsing [`++rule`](). Parses exactly five base-64 digits.
265+
266+Accepts
267+-------
268+
269+Produces
270+--------
271+
272+My name henry let's see how fast I can type.
273+
274+Source
275+------
276+
150 ++ piw (bass 64 (stun [5 5] siw))
277 ++ piw (bass 64 (stun [5 5] siw))
151
278
152−Parsing rule. Parses exactly five base-64 digits.
279+Examples
280+--------
153
281
154 ~zod/try=> (scan "2C-pZ" piw:ab)
282 ~zod/try=> (scan "2C-pZ" piw:ab)
155 q=43.771.517
283 q=43.771.517
@@ -163,10 +291,22 @@ Parsing rule. Parses exactly five base-64 digits.
163
291
164Parse \<= 4 binary
292Parse \<= 4 binary
165
293
294+Parsing [`++rule`](). Parses a binary number of up to 4 digits in length without
295+a leading zero.
296+
297+Accepts
298+-------
299+
300+Produces
301+--------
302+
303+Source
304+------
305+
166 ++ qeb (bass 2 ;~(plug seb (stun [0 3] sib)))
306 ++ qeb (bass 2 ;~(plug seb (stun [0 3] sib)))
167
307
168−Parsing rule. Parses a binary number of up to 4 digits in length without
308+Examples
169−a leading zero.
309+--------
170
310
171 ~zod/try=> (scan "1" qeb:ab)
311 ~zod/try=> (scan "1" qeb:ab)
172 q=1
312 q=1
@@ -187,10 +327,22 @@ a leading zero.
187
327
188Parse \<= 4 hex
328Parse \<= 4 hex
189
329
330+Parsing [`++rule`](). Parses a hexadecimal number of up to 4 digits in length
331+without a leading zero.
332+
333+Accepts
334+-------
335+
336+Produces
337+--------
338+
339+Source
340+------
341+
190 ++ qex (bass 16 ;~(plug sex (stun [0 3] hit)))
342 ++ qex (bass 16 ;~(plug sex (stun [0 3] hit)))
191
343
192−Parsing rule. Parses a hexadecimal number of up to 4 digits in length
344+Examples
193−without a leading zero.
345+--------
194
346
195 ~zod/try=> (scan "ca" qex:ab)
347 ~zod/try=> (scan "ca" qex:ab)
196 q=202
348 q=202
@@ -209,9 +361,21 @@ without a leading zero.
209
361
210Parse 4 binary
362Parse 4 binary
211
363
364+Parsing [`++rule`](). Parses exactly four binary digits.
365+
366+Accepts
367+-------
368+
369+Produces
370+--------
371+
372+Source
373+------
374+
212 ++ qib (bass 2 (stun [4 4] sib))
375 ++ qib (bass 2 (stun [4 4] sib))
213
376
214−Parsing rule. Parses exactly four binary digits.
377+Examples
378+--------
215
379
216 ~zod/try=> (scan "0001" qib:ab)
380 ~zod/try=> (scan "0001" qib:ab)
217 q=1
381 q=1
@@ -227,9 +391,21 @@ Parsing rule. Parses exactly four binary digits.
227
391
228Parse 4 hex
392Parse 4 hex
229
393
394+Parsing [`++rule`](). Parses exactly four hexadecimal digits.
395+
396+Accepts
397+-------
398+
399+Produces
400+--------
401+
402+Source
403+------
404+
230 ++ qix (bass 16 (stun [4 4] six))
405 ++ qix (bass 16 (stun [4 4] six))
231
406
232−Parsing rule. Parses exactly four hexadecimal digits.
407+Examples
408+--------
233
409
234 ~zod/try=> (scan "0100" qix:ab)
410 ~zod/try=> (scan "0100" qix:ab)
235 q=256
411 q=256
@@ -245,9 +421,21 @@ Parsing rule. Parses exactly four hexadecimal digits.
245
421
246Parse 1
422Parse 1
247
423
424+Parsing [`++rule`](). Parses the number 1.
425+
426+Accepts
427+-------
428+
429+Produces
430+--------
431+
432+Source
433+------
434+
248 ++ seb (cold 1 (just '1'))
435 ++ seb (cold 1 (just '1'))
249
436
250−Parsing rule. Parses the number 1.
437+Examples
438+--------
251
439
252 ~zod/try=> (scan "1" seb:ab)
440 ~zod/try=> (scan "1" seb:ab)
253 1
441 1
@@ -264,9 +452,21 @@ Parsing rule. Parses the number 1.
264
452
265Parse decimal
453Parse decimal
266
454
455+Parsing [`++rule`](). Parses a nonzero decimal digit.
456+
457+Accepts
458+-------
459+
460+Produces
461+--------
462+
463+Source
464+------
465+
267 ++ sed (cook |=(a=@ (sub a '0')) (shim '1' '9'))
466 ++ sed (cook |=(a=@ (sub a '0')) (shim '1' '9'))
268
467
269−Parsing rule. Parses a nonzero decimal digit.
468+Examples
469+--------
270
470
271 ~zod/try=> (scan "5" sed:ab)
471 ~zod/try=> (scan "5" sed:ab)
272 5
472 5
@@ -280,9 +480,21 @@ Parsing rule. Parses a nonzero decimal digit.
280
480
281Parse base-32
481Parse base-32
282
482
483+Parsing [`++rule`](). Parses a nonzero base-32 digit
484+
485+Accepts
486+-------
487+
488+Produces
489+--------
490+
491+Source
492+------
493+
283 ++ sev ;~(pose sed sov)
494 ++ sev ;~(pose sed sov)
284
495
285−Parsing rule. Parses a nonzero base-32 digit
496+Examples
497+--------
286
498
287 ~zod/try=> (scan "c" sev:ab)
499 ~zod/try=> (scan "c" sev:ab)
288 12
500 12
@@ -296,9 +508,21 @@ Parsing rule. Parses a nonzero base-32 digit
296
508
297Parse base-64
509Parse base-64
298
510
511+Parsing [`++rule`](). Parses a nonzero base-64 digit
512+
513+Accepts
514+-------
515+
516+Produces
517+--------
518+
519+Source
520+------
521+
299 ++ sew ;~(pose sed sow)
522 ++ sew ;~(pose sed sow)
300
523
301−Parsing rule. Parses a nonzero base-64 digit
524+Examples
525+--------
302
526
303 ~zod/try=> (scan "M" sew:ab)
527 ~zod/try=> (scan "M" sew:ab)
304 48
528 48
@@ -312,9 +536,21 @@ Parsing rule. Parses a nonzero base-64 digit
312
536
313Parse hex
537Parse hex
314
538
539+Parsing [`++rule`](). Parses a nonzero hexadecimal digit.
540+
541+Accepts
542+-------
543+
544+Produces
545+--------
546+
547+Source
548+------
549+
315 ++ sex ;~(pose sed sox)
550 ++ sex ;~(pose sed sox)
316
551
317−Parsing rule. Parses a nonzero hexadecimal digit.
552+Examples
553+--------
318
554
319 ~zod/try=> (scan "e" sex:ab)
555 ~zod/try=> (scan "e" sex:ab)
320 14
556 14
@@ -328,9 +564,21 @@ Parsing rule. Parses a nonzero hexadecimal digit.
328
564
329Parse binary
565Parse binary
330
566
567+Parsing [`++rule`](). Parses a binary digit.
568+
569+Accepts
570+-------
571+
572+Produces
573+--------
574+
575+Source
576+------
577+
331 ++ sib (cook |=(a=@ (sub a '0')) (shim '0' '1'))
578 ++ sib (cook |=(a=@ (sub a '0')) (shim '0' '1'))
332
579
333−Parsing rule. Parses a binary digit.
580+Examples
581+--------
334
582
335 ~zod/try=> (scan "1" sib:ab)
583 ~zod/try=> (scan "1" sib:ab)
336 1
584 1
@@ -343,9 +591,21 @@ Parsing rule. Parses a binary digit.
343
591
344Parse decimal
592Parse decimal
345
593
594+Parsing [`++rule`](). Parses a decimal digit.
595+
596+Accepts
597+-------
598+
599+Produces
600+--------
601+
602+Source
603+------
604+
346 ++ sid (cook |=(a=@ (sub a '0')) (shim '0' '9'))
605 ++ sid (cook |=(a=@ (sub a '0')) (shim '0' '9'))
347
606
348−Parsing rule. Parses a decimal digit.
607+Examples
608+--------
349
609
350 ~zod/try=> (scan "5" sid:ab)
610 ~zod/try=> (scan "5" sid:ab)
351 5
611 5
@@ -356,9 +616,21 @@ Parsing rule. Parses a decimal digit.
356
616
357Parse base-32
617Parse base-32
358
618
619+Parsing [`++rule`](). Parses a base-32 digit.
620+
621+Accepts
622+-------
623+
624+Produces
625+--------
626+
627+Source
628+------
629+
359 ++ siv ;~(pose sid sov)
630 ++ siv ;~(pose sid sov)
360
631
361−Parsing rule. Parses a base-32 digit.
632+Examples
633+--------
362
634
363 ~zod/try=> (scan "c" siv:ab)
635 ~zod/try=> (scan "c" siv:ab)
364 12
636 12
@@ -369,9 +641,21 @@ Parsing rule. Parses a base-32 digit.
369
641
370Parse base-64
642Parse base-64
371
643
644+Parsing [`++rule`](). Parses a base-64 digit.
645+
646+Accepts
647+-------
648+
649+Produces
650+--------
651+
652+Source
653+------
654+
372 ++ siw ;~(pose sid sow)
655 ++ siw ;~(pose sid sow)
373
656
374−Parsing rule. Parses a base-64 digit.
657+Examples
658+--------
375
659
376 ~zod/try=> (scan "M" siw:ab)
660 ~zod/try=> (scan "M" siw:ab)
377 48
661 48
@@ -382,9 +666,21 @@ Parsing rule. Parses a base-64 digit.
382
666
383Parse hex
667Parse hex
384
668
669+Parsing [`++rule`](). Parses a hexadecimal digit.
670+
671+Accepts
672+-------
673+
674+Produces
675+--------
676+
677+Source
678+------
679+
385 ++ six ;~(pose sid sox)
680 ++ six ;~(pose sid sox)
386
681
387−Parsing rule. Parses a hexadecimal digit.
682+Examples
683+--------
388
684
389 ~zod/try=> (scan "e" six:ab)
685 ~zod/try=> (scan "e" six:ab)
390 14
686 14
@@ -395,9 +691,21 @@ Parsing rule. Parses a hexadecimal digit.
395
691
396Parse base-32
692Parse base-32
397
693
694+Parsing [`++rule`](). Parses a base-32 letter.
695+
696+Accepts
697+-------
698+
699+Produces
700+--------
701+
702+Source
703+------
704+
398 ++ sov (cook |=(a=@ (sub a 87)) (shim 'a' 'v'))
705 ++ sov (cook |=(a=@ (sub a 87)) (shim 'a' 'v'))
399
706
400−Parsing rule. Parses a base-32 letter.
707+Examples
708+--------
401
709
402 ~zod/try=> (scan "c" sov:ab)
710 ~zod/try=> (scan "c" sov:ab)
403 12
711 12
@@ -408,6 +716,17 @@ Parsing rule. Parses a base-32 letter.
408
716
409Parse base-64
717Parse base-64
410
718
719+Parsing [`++rule`](). Parses a base-64 letter/symbol.
720+
721+Accepts
722+-------
723+
724+Produces
725+--------
726+
727+Source
728+------
729+
411 ++ sow ;~ pose
730 ++ sow ;~ pose
412 (cook |=(a=@ (sub a 87)) (shim 'a' 'z'))
731 (cook |=(a=@ (sub a 87)) (shim 'a' 'z'))
413 (cook |=(a=@ (sub a 29)) (shim 'A' 'Z'))
732 (cook |=(a=@ (sub a 29)) (shim 'A' 'Z'))
@@ -415,7 +734,8 @@ Parse base-64
415 (cold 63 (just '~'))
734 (cold 63 (just '~'))
416 ==
735 ==
417
736
418−Parsing rule. Parses a base-64 letter/symbol.
737+Examples
738+--------
419
739
420 ~zod/try=> (scan "M" sow:ab)
740 ~zod/try=> (scan "M" sow:ab)
421 48
741 48
@@ -426,9 +746,21 @@ Parsing rule. Parses a base-64 letter/symbol.
426
746
427Parse hex letter
747Parse hex letter
428
748
749+Parsing [`++rule`](). Parses a hexadecimal letter.
750+
751+Accepts
752+-------
753+
754+Produces
755+--------
756+
757+Source
758+------
759+
429 ++ sox (cook |=(a=@ (sub a 87)) (shim 'a' 'f'))
760 ++ sox (cook |=(a=@ (sub a 87)) (shim 'a' 'f'))
430
761
431−Parsing rule. Parses a hexadecimal letter.
762+Examples
763+--------
432
764
433 ~zod/try=> (scan "e" sox:ab)
765 ~zod/try=> (scan "e" sox:ab)
434 14
766 14
@@ -439,10 +771,22 @@ Parsing rule. Parses a hexadecimal letter.
439
771
440Parse \<= 3 decimal
772Parse \<= 3 decimal
441
773
774+Parsing [`++rule`](). Parses a decimal number of up to 3 digits without a
775+leading zero.
776+
777+Accepts
778+-------
779+
780+Produces
781+--------
782+
783+Source
784+------
785+
442 ++ ted (bass 10 ;~(plug sed (stun [0 2] sid)))
786 ++ ted (bass 10 ;~(plug sed (stun [0 2] sid)))
443
787
444−Parsing rule. Parses a decimal number of up to 3 digits without a
788+Examples
445−leading zero.
789+--------
446
790
447 ~zod/try=> (scan "21" ted:ab)
791 ~zod/try=> (scan "21" ted:ab)
448 q=21
792 q=21
@@ -460,10 +804,22 @@ leading zero.
460
804
461Leading phonetic byte
805Leading phonetic byte
462
806
807+Parsing [`++rule`](). Parses the leading phonetic byte, which represents a
808+syllable.
809+
810+Accepts
811+-------
812+
813+Produces
814+--------
815+
816+Source
817+------
818+
463 ++ tip (sear |=(a=@ (ins:po a)) til)
819 ++ tip (sear |=(a=@ (ins:po a)) til)
464
820
465−Parsing rule. Parses the leading phonetic byte, which represents a
821+Examples
466−syllable.
822+--------
467
823
468 ~zod/try=> (scan "doz" tip:ab)
824 ~zod/try=> (scan "doz" tip:ab)
469 0
825 0
@@ -476,10 +832,22 @@ syllable.
476
832
477Trailing phonetic syllable
833Trailing phonetic syllable
478
834
835+Parsing [`++rule`](). Parses the trailing phonetic byte, which represents a
836+syllable.
837+
838+Accepts
839+-------
840+
841+Produces
842+--------
843+
844+Source
845+------
846+
479 ++ tiq (sear |=(a=@ (ind:po a)) til)
847 ++ tiq (sear |=(a=@ (ind:po a)) til)
480
848
481−Parsing rule. Parses the trailing phonetic byte, which represents a
849+Examples
482−syllable.
850+--------
483
851
484 ~zod/try=> (scan "zod" tiq:ab)
852 ~zod/try=> (scan "zod" tiq:ab)
485 0
853 0
@@ -492,9 +860,21 @@ syllable.
492
860
493Parse 3 decimal digits
861Parse 3 decimal digits
494
862
863+Parsing [`++rule`](). Parses exactly three decimal digits.
864+
865+Accepts
866+-------
867+
868+Produces
869+--------
870+
871+Source
872+------
873+
495 ++ tid (bass 10 (stun [3 3] sid))
874 ++ tid (bass 10 (stun [3 3] sid))
496
875
497−Parsing rule. Parses exactly three decimal digits.
876+Examples
877+--------
498
878
499 ~zod/try=> (scan "013" tid:ab)
879 ~zod/try=> (scan "013" tid:ab)
500 q=13
880 q=13
@@ -508,9 +888,21 @@ Parsing rule. Parses exactly three decimal digits.
508
888
509Parse 3 lowercase
889Parse 3 lowercase
510
890
891+Parsing [`++rule`](). Parses exactly three lowercase letters.
892+
893+Accepts
894+-------
895+
896+Produces
897+--------
898+
899+Source
900+------
901+
511 ++ til (boss 256 (stun [3 3] low))
902 ++ til (boss 256 (stun [3 3] low))
512
903
513−Parsing rule. Parses exactly three lowercase letters.
904+Examples
905+--------
514
906
515 ~zod/try=> (scan "mer" til:ab)
907 ~zod/try=> (scan "mer" til:ab)
516 q=7.497.069
908 q=7.497.069
@@ -526,11 +918,23 @@ Parsing rule. Parses exactly three lowercase letters.
526
918
527Parse span characters
919Parse span characters
528
920
921+Parsing rule. Parses characters from an atom of the span odor [`@ta`]().
922+
923+Accepts
924+-------
925+
926+Produces
927+--------
928+
929+Source
930+------
931+
529 ++ urs %+ cook
932 ++ urs %+ cook
530 |=(a=tape (rap 3 ^-((list ,@) a)))
933 |=(a=tape (rap 3 ^-((list ,@) a)))
531 (star ;~(pose nud low hep dot sig cab))
934 (star ;~(pose nud low hep dot sig cab))
532
935
533−Parsing rule. Parses characters from an atom of the span odor [`@ta`]().
936+Examples
937+--------
534
938
535 ~zod/try=> `@ta`(scan "asa-lom_tak" urs:ab)
939 ~zod/try=> `@ta`(scan "asa-lom_tak" urs:ab)
536 ~.asa-lom_tak
940 ~.asa-lom_tak
@@ -543,12 +947,24 @@ Parsing rule. Parses characters from an atom of the span odor [`@ta`]().
543
947
544Parse non-`_` span
948Parse non-`_` span
545
949
950+Parsing rule. Parses all characters of the span odor [`@ta`]() except
951+for cab, `_`.
952+
953+Accepts
954+-------
955+
956+Produces
957+--------
958+
959+Source
960+------
961+
546 ++ urt %+ cook
962 ++ urt %+ cook
547 |=(a=tape (rap 3 ^-((list ,@) a)))
963 |=(a=tape (rap 3 ^-((list ,@) a)))
548 (star ;~(pose nud low hep dot sig))
964 (star ;~(pose nud low hep dot sig))
549
965
550−Parsing rule. Parses all characters of the span odor [`@ta`]() except
966+Examples
551−for cab, `_`.
967+--------
552
968
553 ~zod/try=> `@t`(scan "asa-lom.t0k" urt:ab)
969 ~zod/try=> `@t`(scan "asa-lom.t0k" urt:ab)
554 'asa-lom.t0k'
970 'asa-lom.t0k'
@@ -559,11 +975,23 @@ for cab, `_`.
559
975
560Parse bas, soq, or bix
976Parse bas, soq, or bix
561
977
562− ++ voy ;~(pfix bas ;~(pose bas soq bix))
563−
564Parsing rule. Parses an escaped backslash, single quote, or hex pair
978Parsing rule. Parses an escaped backslash, single quote, or hex pair
565byte.
979byte.
566
980
981+Accepts
982+-------
983+
984+Produces
985+--------
986+
987+Source
988+------
989+
990+ ++ voy ;~(pfix bas ;~(pose bas soq bix))
991+
992+Examples
993+--------
994+
567 ~zod/try=> (scan "\\0a" voy:ab)
995 ~zod/try=> (scan "\\0a" voy:ab)
568 q=10
996 q=10
569 ~zod/try=> (scan "\\'" voy:ab)
997 ~zod/try=> (scan "\\'" voy:ab)
@@ -575,10 +1003,22 @@ byte.
575
1003
576Top-level atom parser engine
1004Top-level atom parser engine
577
1005
1006+A core containing top-level atom parsers.
1007+
1008+Accepts
1009+-------
1010+
1011+Produces
1012+--------
1013+
1014+Source
1015+------
1016+
578 ++ ag
1017 ++ ag
579 |%
1018 |%
580
1019
581−A core containing top-level atom parsers.
1020+Examples
1021+--------
582
1022
583 ~zod/try=> ag
1023 ~zod/try=> ag
584 <14.vpu 414.mof 100.xkc 1.ypj %164>
1024 <14.vpu 414.mof 100.xkc 1.ypj %164>
@@ -589,12 +1029,24 @@ A core containing top-level atom parsers.
589
1029
590Parse 0 or rule
1030Parse 0 or rule
591
1031
592− ++ ape |*(fel=_rule ;~(pose (cold 0 (just '0')) fel))
593−
594Parser modifier. Parses 0 or the sample rule `fel`.
1032Parser modifier. Parses 0 or the sample rule `fel`.
595
1033
1034+Accepts
1035+-------
1036+
1037+Produces
1038+--------
1039+
596`fel` is a [`rule`]().
1040`fel` is a [`rule`]().
597
1041
1042+Source
1043+------
1044+
1045+ ++ ape |*(fel=_rule ;~(pose (cold 0 (just '0')) fel))
1046+
1047+Examples
1048+--------
1049+
598 ~zod/try=> (scan "202" (star (ape:ag (cold 2 (just '2')))))
1050 ~zod/try=> (scan "202" (star (ape:ag (cold 2 (just '2')))))
599 ~[2 0 2]
1051 ~[2 0 2]
600
1052
@@ -604,9 +1056,21 @@ Parser modifier. Parses 0 or the sample rule `fel`.
604
1056
605Parses binary number
1057Parses binary number
606
1058
1059+Parsing rule. Parses a binary number without a leading zero.
1060+
1061+Accepts
1062+-------
1063+
1064+Produces
1065+--------
1066+
1067+Source
1068+------
1069+
607 ++ bay (ape (bass 16 ;~(plug qeb:ab (star ;~(pfix dog qib:ab)))))
1070 ++ bay (ape (bass 16 ;~(plug qeb:ab (star ;~(pfix dog qib:ab)))))
608
1071
609−Parsing rule. Parses a binary number without a leading zero.
1072+Examples
1073+--------
610
1074
611 ~zod/try=> (scan "10.0110" bay:ag)
1075 ~zod/try=> (scan "10.0110" bay:ag)
612 q=38
1076 q=38
@@ -617,10 +1081,22 @@ Parsing rule. Parses a binary number without a leading zero.
617
1081
618Parse IPv6
1082Parse IPv6
619
1083
1084+Parsing rule. Parses a [`@is`](), an IPv6 address.
1085+
1086+Accepts
1087+-------
1088+
1089+Produces
1090+--------
1091+
1092+Source
1093+------
1094+
620 ++ bip =+ tod=(ape qex:ab)
1095 ++ bip =+ tod=(ape qex:ab)
621 (bass 0x1.0000 ;~(plug tod (stun [7 7] ;~(pfix dog tod))))
1096 (bass 0x1.0000 ;~(plug tod (stun [7 7] ;~(pfix dog tod))))
622
1097
623−Parsing rule. Parses a [`@is`](), an IPv6 address.
1098+Examples
1099+--------
624
1100
625 ~zod/try=> (scan "0.0.ea.3e6c.0.0.0.0" bip:ag)
1101 ~zod/try=> (scan "0.0.ea.3e6c.0.0.0.0" bip:ag)
626 q=283.183.420.760.121.105.516.068.864
1102 q=283.183.420.760.121.105.516.068.864
@@ -633,9 +1109,21 @@ Parsing rule. Parses a [`@is`](), an IPv6 address.
633
1109
634Parse decimal with dots
1110Parse decimal with dots
635
1111
1112+Parsing rule. Parses a decimal number that includes dot separators.
1113+
1114+Accepts
1115+-------
1116+
1117+Produces
1118+--------
1119+
1120+Source
1121+------
1122+
636 ++ dem (ape (bass 1.000 ;~(plug ted:ab (star ;~(pfix dog tid:ab)))))
1123 ++ dem (ape (bass 1.000 ;~(plug ted:ab (star ;~(pfix dog tid:ab)))))
637
1124
638−Parsing rule. Parses a decimal number that includes dot separators.
1125+Examples
1126+--------
639
1127
640 ~zod/try=> (scan "52" dem:ag)
1128 ~zod/try=> (scan "52" dem:ag)
641 q=52
1129 q=52
@@ -648,9 +1136,21 @@ Parsing rule. Parses a decimal number that includes dot separators.
648
1136
649Parse decimal number
1137Parse decimal number
650
1138
1139+Parsing rule. Parses a decimal number without a leading zero.
1140+
1141+Accepts
1142+-------
1143+
1144+Produces
1145+--------
1146+
1147+Source
1148+------
1149+
651 ++ dim (ape (bass 10 ;~(plug sed:ab (star sid:ab))))
1150 ++ dim (ape (bass 10 ;~(plug sed:ab (star sid:ab))))
652
1151
653−Parsing rule. Parses a decimal number without a leading zero.
1152+Examples
1153+--------
654
1154
655 ~zod/try=> (scan "52" dim:ag)
1155 ~zod/try=> (scan "52" dim:ag)
656 q=52
1156 q=52
@@ -664,9 +1164,21 @@ Parsing rule. Parses a decimal number without a leading zero.
664
1164
665Parse decimal with leading `0`
1165Parse decimal with leading `0`
666
1166
1167+Parsing rule. Parses a decmial number with leading zeroes.
1168+
1169+Accepts
1170+-------
1171+
1172+Produces
1173+--------
1174+
1175+Source
1176+------
1177+
667 ++ dum (bass 10 (plus sid:ab))
1178 ++ dum (bass 10 (plus sid:ab))
668
1179
669−Parsing rule. Parses a decmial number with leading zeroes.
1180+Examples
1181+--------
670
1182
671 ~zod/try=> (scan "52" dum:ag)
1183 ~zod/try=> (scan "52" dum:ag)
672 q=52
1184 q=52
@@ -681,6 +1193,17 @@ Parsing rule. Parses a decmial number with leading zeroes.
681
1193
682Parse phonetic base
1194Parse phonetic base
683
1195
1196+Parsing rule. Parses an atom of odor [`@p`](), the phonetic base.
1197+
1198+Accepts
1199+-------
1200+
1201+Produces
1202+--------
1203+
1204+Source
1205+------
1206+
684 ++ fed ;~ pose
1207 ++ fed ;~ pose
685 (bass 0x1.0000.0000.0000.0000 (most doh hyf:ab))
1208 (bass 0x1.0000.0000.0000.0000 (most doh hyf:ab))
686 huf:ab
1209 huf:ab
@@ -688,7 +1211,8 @@ Parse phonetic base
688 tiq:ab
1211 tiq:ab
689 ==
1212 ==
690
1213
691−Parsing rule. Parses an atom of odor [`@p`](), the phonetic base.
1214+Examples
1215+--------
692
1216
693 ~zod/try=> (scan "zod" fed:ag)
1217 ~zod/try=> (scan "zod" fed:ag)
694 0
1218 0
@@ -711,9 +1235,21 @@ Parsing rule. Parses an atom of odor [`@p`](), the phonetic base.
711
1235
712Parse hex
1236Parse hex
713
1237
1238+Parsing rule. Parses a hexadecimal number
1239+
1240+Accepts
1241+-------
1242+
1243+Produces
1244+--------
1245+
1246+Source
1247+------
1248+
714 ++ hex (ape (bass 0x1.0000 ;~(plug qex:ab (star ;~(pfix dog qix:ab)))))
1249 ++ hex (ape (bass 0x1.0000 ;~(plug qex:ab (star ;~(pfix dog qix:ab)))))
715
1250
716−Parsing rule. Parses a hexadecimal number
1251+Examples
1252+--------
717
1253
718 ~zod/try=> (scan "4" hex:ag)
1254 ~zod/try=> (scan "4" hex:ag)
719 q=4
1255 q=4
@@ -730,10 +1266,22 @@ Parsing rule. Parses a hexadecimal number
730
1266
731Parse IPv4 address
1267Parse IPv4 address
732
1268
1269+Parsing rule. Parses an IPv4 address.
1270+
1271+Accepts
1272+-------
1273+
1274+Produces
1275+--------
1276+
1277+Source
1278+------
1279+
733 ++ lip =+ tod=(ape ted:ab)
1280 ++ lip =+ tod=(ape ted:ab)
734 (bass 256 ;~(plug tod (stun [3 3] ;~(pfix dog tod))))
1281 (bass 256 ;~(plug tod (stun [3 3] ;~(pfix dog tod))))
735
1282
736−Parsing rule. Parses an IPv4 address.
1283+Examples
1284+--------
737
1285
738 ~zod/try=> (scan "127.0.0.1" lip:ag)
1286 ~zod/try=> (scan "127.0.0.1" lip:ag)
739 q=2.130.706.433
1287 q=2.130.706.433
@@ -748,9 +1296,21 @@ Parsing rule. Parses an IPv4 address.
748
1296
749Parse Base-32 with dots
1297Parse Base-32 with dots
750
1298
1299+Parsing rule. Parses a Base-32 number with dot separators.
1300+
1301+Accepts
1302+-------
1303+
1304+Produces
1305+--------
1306+
1307+Source
1308+------
1309+
751 ++ viz (ape (bass 0x200.0000 ;~(plug pev:ab (star ;~(pfix dog piv:ab)))))
1310 ++ viz (ape (bass 0x200.0000 ;~(plug pev:ab (star ;~(pfix dog piv:ab)))))
752
1311
753−Parsing rule. Parses a Base-32 number with dot separators.
1312+Examples
1313+--------
754
1314
755 ~zod/try=> (scan "e2.ol4pm" viz:ag)
1315 ~zod/try=> (scan "e2.ol4pm" viz:ag)
756 q=15.125.353.270
1316 q=15.125.353.270
@@ -761,9 +1321,21 @@ Parsing rule. Parses a Base-32 number with dot separators.
761
1321
762Parse base-32 string
1322Parse base-32 string
763
1323
1324+Parsing rule. Parses a raw base-32 string.
1325+
1326+Accepts
1327+-------
1328+
1329+Produces
1330+--------
1331+
1332+Source
1333+------
1334+
764 ++ vum (bass 32 (plus siv:ab))
1335 ++ vum (bass 32 (plus siv:ab))
765
1336
766−Parsing rule. Parses a raw base-32 string.
1337+Examples
1338+--------
767
1339
768 ~zod/try=> (scan "e2ol4pm" vum:ag)
1340 ~zod/try=> (scan "e2ol4pm" vum:ag)
769 q=15.125.353.270
1341 q=15.125.353.270
@@ -774,11 +1346,23 @@ Parsing rule. Parses a raw base-32 string.
774
1346
775Parse base-64
1347Parse base-64
776
1348
1349+Parsing rule. Parses a base-64 number.
1350+
1351+Accepts
1352+-------
1353+
1354+Produces
1355+--------
1356+
1357+Source
1358+------
1359+
777 ++ wiz (ape (bass 0x4000.0000 ;~(plug pew:ab (star ;~(pfix dog piw:ab)))))
1360 ++ wiz (ape (bass 0x4000.0000 ;~(plug pew:ab (star ;~(pfix dog piw:ab)))))
778 --
1361 --
779 ::
1362 ::
780
1363
781−Parsing rule. Parses a base-64 number.
1364+Examples
1365+--------
782
1366
783 ~zod/try=> (scan "e2O.l4Xpm" wiz:ag)
1367 ~zod/try=> (scan "e2O.l4Xpm" wiz:ag)
784 q=61.764.130.813.526
1368 q=61.764.130.813.526
@@ -789,13 +1373,25 @@ Parsing rule. Parses a base-64 number.
789
1373
790Literal rendering engine
1374Literal rendering engine
791
1375
792− ++ co
793− =< |_ lot=coin
794−
795A [door]() that contains arms that operate on the sample coin `lot`.
1376A [door]() that contains arms that operate on the sample coin `lot`.
796
1377
1378+Accepts
1379+-------
1380+
1381+Produces
1382+--------
1383+
797`lot` is a [`++coin`]().
1384`lot` is a [`++coin`]().
798
1385
1386+Source
1387+------
1388+
1389+ ++ co
1390+ =< |_ lot=coin
1391+
1392+Examples
1393+--------
1394+
799 ~zod/try=> ~(. co many/~[`ta/'mo' `ud/5])
1395 ~zod/try=> ~(. co many/~[`ta/'mo' `ud/5])
800 < 3.dhd
1396 < 3.dhd
801 [ [ %many
1397 [ [ %many
@@ -813,14 +1409,26 @@ A [door]() that contains arms that operate on the sample coin `lot`.
813
1409
814Prepend & render as tape
1410Prepend & render as tape
815
1411
816− ++ rear |=(rom=tape =>(.(rex rom) rend))
817−
818Renders a coin `lot` as a [tape]() prepended to the sample tape `rom`.
1412Renders a coin `lot` as a [tape]() prepended to the sample tape `rom`.
819
1413
1414+Accepts
1415+-------
1416+
1417+Produces
1418+--------
1419+
820`rom` is a [`pe`]()
1420`rom` is a [`pe`]()
821
1421
822`lot` is a [`++coin`]().
1422`lot` is a [`++coin`]().
823
1423
1424+Source
1425+------
1426+
1427+ ++ rear |=(rom=tape =>(.(rex rom) rend))
1428+
1429+Examples
1430+--------
1431+
824 ~zod/try=> (~(rear co %$ %ux 200) "--ha")
1432 ~zod/try=> (~(rear co %$ %ux 200) "--ha")
825 "0xc8--ha"
1433 "0xc8--ha"
826
1434
@@ -830,12 +1438,24 @@ Renders a coin `lot` as a [tape]() prepended to the sample tape `rom`.
830
1438
831Render as span
1439Render as span
832
1440
833− ++ rent `@ta`(rap 3 rend)
834−
835Renders a coin `lot` as a span.
1441Renders a coin `lot` as a span.
836
1442
1443+Accepts
1444+-------
1445+
1446+Produces
1447+--------
1448+
837`lot` is a [`++coin`]().
1449`lot` is a [`++coin`]().
838
1450
1451+Source
1452+------
1453+
1454+ ++ rent `@ta`(rap 3 rend)
1455+
1456+Examples
1457+--------
1458+
839 ~zod/try=> ~(rent co %$ %ux 200)
1459 ~zod/try=> ~(rent co %$ %ux 200)
840 ~.0xc8
1460 ~.0xc8
841 ~zod/try=> `@t`~(rent co %$ %ux 200)
1461 ~zod/try=> `@t`~(rent co %$ %ux 200)
@@ -847,6 +1467,19 @@ Renders a coin `lot` as a span.
847
1467
848Render as tape
1468Render as tape
849
1469
1470+Renders a coin `lot` as a tape.
1471+
1472+Accepts
1473+-------
1474+
1475+Produces
1476+--------
1477+
1478+`lot` is a [`++coin`]().
1479+
1480+Source
1481+------
1482+
850 ++ rend
1483 ++ rend
851 ^- tape
1484 ^- tape
852 ?: ?=(%blob -.lot)
1485 ?: ?=(%blob -.lot)
@@ -1046,9 +1679,8 @@ Render as tape
1046 --
1679 --
1047 ::
1680 ::
1048
1681
1049−Renders a coin `lot` as a tape.
1682+Examples
1050−
1683+--------
1051−`lot` is a [`++coin`]().
1052
1684
1053 ~zod/try=> ~(rend co ~ %ux 200)
1685 ~zod/try=> ~(rend co ~ %ux 200)
1054 "0xc8"
1686 "0xc8"
@@ -1077,14 +1709,26 @@ Renders a coin `lot` as a tape.
1077
1709
1078Digit rendering engine
1710Digit rendering engine
1079
1711
1080− ++ ne
1081− |_ tig=@
1082−
1083A [door]() containing arms that render digits at bases 10, 16, 32, and
1712A [door]() containing arms that render digits at bases 10, 16, 32, and
108464.
171364.
1085
1714
1715+Accepts
1716+-------
1717+
1718+Produces
1719+--------
1720+
1086`tig` is an [`atom`]().
1721`tig` is an [`atom`]().
1087
1722
1723+Source
1724+------
1725+
1726+ ++ ne
1727+ |_ tig=@
1728+
1729+Examples
1730+--------
1731+
1088 ~zod/try=> ~(. ne 20)
1732 ~zod/try=> ~(. ne 20)
1089 <4.gut [@ud <414.hhh 100.xkc 1.ypj %164>]>
1733 <4.gut [@ud <414.hhh 100.xkc 1.ypj %164>]>
1090
1734
@@ -1094,12 +1738,24 @@ A [door]() containing arms that render digits at bases 10, 16, 32, and
1094
1738
1095Render decimal
1739Render decimal
1096
1740
1097− ++ d (add tig '0')
1098−
1099Renders a decimal digit as an atom of an ACII byte value.
1741Renders a decimal digit as an atom of an ACII byte value.
1100
1742
1743+Accepts
1744+-------
1745+
1746+Produces
1747+--------
1748+
1101`tig` is an [`atom`]().
1749`tig` is an [`atom`]().
1102
1750
1751+Source
1752+------
1753+
1754+ ++ d (add tig '0')
1755+
1756+Examples
1757+--------
1758+
1103 ~zod/try=> `@t`~(d ne 7)
1759 ~zod/try=> `@t`~(d ne 7)
1104 '7'
1760 '7'
1105
1761
@@ -1109,12 +1765,24 @@ Renders a decimal digit as an atom of an ACII byte value.
1109
1765
1110Render hex
1766Render hex
1111
1767
1112− ++ x ?:((gte tig 10) (add tig 87) d)
1113−
1114Renders a hexadecimal digit as an atom of an ASCII byte value.
1768Renders a hexadecimal digit as an atom of an ASCII byte value.
1115
1769
1770+Accepts
1771+-------
1772+
1773+Produces
1774+--------
1775+
1116`tig` is an [`atom`]().
1776`tig` is an [`atom`]().
1117
1777
1778+Source
1779+------
1780+
1781+ ++ x ?:((gte tig 10) (add tig 87) d)
1782+
1783+Examples
1784+--------
1785+
1118 ~zod/try=> `@t`~(x ne 7)
1786 ~zod/try=> `@t`~(x ne 7)
1119 '7'
1787 '7'
1120 ~zod/try=> `@t`~(x ne 14)
1788 ~zod/try=> `@t`~(x ne 14)
@@ -1126,9 +1794,21 @@ Renders a hexadecimal digit as an atom of an ASCII byte value.
1126
1794
1127Render base-32
1795Render base-32
1128
1796
1797+Renders a base-32 digit as an atom of an ASCII byte value.
1798+
1799+Accepts
1800+-------
1801+
1802+Produces
1803+--------
1804+
1805+Source
1806+------
1807+
1129 ++ v ?:((gte tig 10) (add tig 87) d)
1808 ++ v ?:((gte tig 10) (add tig 87) d)
1130
1809
1131−Renders a base-32 digit as an atom of an ASCII byte value.
1810+Examples
1811+--------
1132
1812
1133 ~zod/try=> `@t`~(v ne 7)
1813 ~zod/try=> `@t`~(v ne 7)
1134 '7'
1814 '7'
@@ -1143,13 +1823,25 @@ Renders a base-32 digit as an atom of an ASCII byte value.
1143
1823
1144Render base-64
1824Render base-64
1145
1825
1826+Renders a base-64 digit as an atom of an ASCII byte value.
1827+
1828+Accepts
1829+-------
1830+
1831+Produces
1832+--------
1833+
1834+`tig` is an [`atom`]().
1835+
1836+Source
1837+------
1838+
1146 ++ w ?:(=(tig 63) '~' ?:(=(tig 62) '-' ?:((gte tig 36) (add tig 29) x)))
1839 ++ w ?:(=(tig 63) '~' ?:(=(tig 62) '-' ?:((gte tig 36) (add tig 29) x)))
1147 --
1840 --
1148 ::
1841 ::
1149
1842
1150−Renders a base-64 digit as an atom of an ASCII byte value.
1843+Examples
1151−
1844+--------
1152−`tig` is an [`atom`]().
1153
1845
1154 ~zod/try=> `@t`~(w ne 7)
1846 ~zod/try=> `@t`~(w ne 7)
1155 '7'
1847 '7'
@@ -1172,17 +1864,29 @@ Renders a base-64 digit as an atom of an ASCII byte value.
1172
1864
1173Core used to scramble 16-bit atoms
1865Core used to scramble 16-bit atoms
1174
1866
1175− ++ mu
1176− |_ [top=@ bot=@]
1177−
1178A [door]() that contains arms that are used to scramble two atoms, `top`
1867A [door]() that contains arms that are used to scramble two atoms, `top`
1179and `bot`. Used especially in the phonetic base to disguise the
1868and `bot`. Used especially in the phonetic base to disguise the
1180relationship between a destroyer and its cruiser.
1869relationship between a destroyer and its cruiser.
1181
1870
1871+Accepts
1872+-------
1873+
1874+Produces
1875+--------
1876+
1182`bot` is an [atom]().
1877`bot` is an [atom]().
1183
1878
1184`top` is an [atom]().
1879`top` is an [atom]().
1185
1880
1881+Source
1882+------
1883+
1884+ ++ mu
1885+ |_ [top=@ bot=@]
1886+
1887+Examples
1888+--------
1889+
1186 ~zod/try=> ~(. mu 0x20e5 0x5901)
1890 ~zod/try=> ~(. mu 0x20e5 0x5901)
1187 <3.sjm [[@ux @ux] <414.hhh 100.xkc 1.ypj %164>]>
1891 <3.sjm [[@ux @ux] <414.hhh 100.xkc 1.ypj %164>]>
1188
1892
@@ -1192,16 +1896,28 @@ relationship between a destroyer and its cruiser.
1192
1896
1193Add bottom into top
1897Add bottom into top
1194
1898
1195− ++ zag [p=(end 4 1 (add top bot)) q=bot]
1196−
1197Produces the cell of `top` and `bot` with `top` scrambled to the result
1899Produces the cell of `top` and `bot` with `top` scrambled to the result
1198of adding `bot` to `top` modulo 16. Used to scramble the name of a
1900of adding `bot` to `top` modulo 16. Used to scramble the name of a
1199destroyer.
1901destroyer.
1200
1902
1903+Accepts
1904+-------
1905+
1906+Produces
1907+--------
1908+
1201`bot` is an [atom]().
1909`bot` is an [atom]().
1202
1910
1203`top` is an [atom]().
1911`top` is an [atom]().
1204
1912
1913+Source
1914+------
1915+
1916+ ++ zag [p=(end 4 1 (add top bot)) q=bot]
1917+
1918+Examples
1919+--------
1920+
1205 ~zod/try=> `[@ux @ux]`~(zag mu 0x20e0 0x201)
1921 ~zod/try=> `[@ux @ux]`~(zag mu 0x20e0 0x201)
1206 [0x22e1 0x201]
1922 [0x22e1 0x201]
1207
1923
@@ -1211,17 +1927,29 @@ destroyer.
1211
1927
1212Subtract bottom from top
1928Subtract bottom from top
1213
1929
1214− ++ zig [p=(end 4 1 (add top (sub 0x1.0000 bot))) q=bot]
1215−
1216The inverse of [`++zag`](). Produces the cell of `top` and `bot` with
1930The inverse of [`++zag`](). Produces the cell of `top` and `bot` with
1217`top` unscrambled. The unscrambled `top` is the sum of the sample `top`
1931`top` unscrambled. The unscrambled `top` is the sum of the sample `top`
1218and the 16-bit complement of `bot`. Used to unscramble the name of the
1932and the 16-bit complement of `bot`. Used to unscramble the name of the
1219destroyer.
1933destroyer.
1220
1934
1935+Accepts
1936+-------
1937+
1938+Produces
1939+--------
1940+
1221`bot` is an [atom]().
1941`bot` is an [atom]().
1222
1942
1223`top` is an [atom]().
1943`top` is an [atom]().
1224
1944
1945+Source
1946+------
1947+
1948+ ++ zig [p=(end 4 1 (add top (sub 0x1.0000 bot))) q=bot]
1949+
1950+Examples
1951+--------
1952+
1225 ~zod/try=> `[@ux @ux]`~(zig mu 0x2f46 0x1042)
1953 ~zod/try=> `[@ux @ux]`~(zig mu 0x2f46 0x1042)
1226 [0x1f04 0x1042]
1954 [0x1f04 0x1042]
1227
1955
@@ -1231,15 +1959,27 @@ destroyer.
1231
1959
1232Concatenate into atom
1960Concatenate into atom
1233
1961
1234− ++ zug (mix (lsh 4 1 top) bot)
1235−
1236Produces the concatenation of `top` and `bot`. Used to assemble a
1962Produces the concatenation of `top` and `bot`. Used to assemble a
1237destroyer name.
1963destroyer name.
1238
1964
1965+Accepts
1966+-------
1967+
1968+Produces
1969+--------
1970+
1239`bot` is an [atom]().
1971`bot` is an [atom]().
1240
1972
1241`top` is an [atom]().
1973`top` is an [atom]().
1242
1974
1975+Source
1976+------
1977+
1978+ ++ zug (mix (lsh 4 1 top) bot)
1979+
1980+Examples
1981+--------
1982+
1243 ~zod/try=> `@ux`~(zug mu 0x10e1 0xfa)
1983 ~zod/try=> `@ux`~(zug mu 0x10e1 0xfa)
1244 0x10e1.00fa
1984 0x10e1.00fa
1245
1985
@@ -1249,10 +1989,22 @@ destroyer name.
1249
1989
1250Coin parser engine
1990Coin parser engine
1251
1991
1992+Core containing arms that parse [`++coin`]s.
1993+
1994+Accepts
1995+-------
1996+
1997+Produces
1998+--------
1999+
2000+Source
2001+------
2002+
1252 ++ so
2003 ++ so
1253 |%
2004 |%
1254
2005
1255−Core containing arms that parse [`++coin`]s.
2006+Examples
2007+--------
1256
2008
1257 ~zod/try=> so
2009 ~zod/try=> so
1258 <10.mkn 414.hhh 100.xkc 1.ypj %164>
2010 <10.mkn 414.hhh 100.xkc 1.ypj %164>
@@ -1263,6 +2015,18 @@ Core containing arms that parse [`++coin`]s.
1263
2015
1264Parse odor-atom pair
2016Parse odor-atom pair
1265
2017
2018+Parsing rule. Parses an unsigned integer of any permitted base,
2019+producing a [`++dime`]().
2020+
2021+Accepts
2022+-------
2023+
2024+Produces
2025+--------
2026+
2027+Source
2028+------
2029+
1266 ++ bisk
2030 ++ bisk
1267 ;~ pose
2031 ;~ pose
1268 ;~ pfix (just '0')
2032 ;~ pfix (just '0')
@@ -1277,8 +2041,8 @@ Parse odor-atom pair
1277 (stag %ud dem:ag)
2041 (stag %ud dem:ag)
1278 ==
2042 ==
1279
2043
1280−Parsing rule. Parses an unsigned integer of any permitted base,
2044+Examples
1281−producing a [`++dime`]().
2045+--------
1282
2046
1283 ~zod/try=> (scan "25" bisk:so)
2047 ~zod/try=> (scan "25" bisk:so)
1284 [%ud q=25]
2048 [%ud q=25]
@@ -1291,6 +2055,19 @@ producing a [`++dime`]().
1291
2055
1292Parse `@da`, `@dr`, `@p`, `@t`
2056Parse `@da`, `@dr`, `@p`, `@t`
1293
2057
2058+Parsing rule. Parses any atom of any of the following odors after a
2059+leading sig, `~` into a [`++dime`](): [`@da`](), [`@dr`](), [`@p`](),
2060+and [`@t`](), producing a [`++dime`]().
2061+
2062+Accepts
2063+-------
2064+
2065+Produces
2066+--------
2067+
2068+Source
2069+------
2070+
1294 ++ crub
2071 ++ crub
1295 ;~ pose
2072 ;~ pose
1296 %+ cook
2073 %+ cook
@@ -1345,9 +2122,8 @@ Parse `@da`, `@dr`, `@p`, `@t`
1345 ;~(pfix hep (stag %c (cook turf (cook woad urs:ab))))
2122 ;~(pfix hep (stag %c (cook turf (cook woad urs:ab))))
1346 ==
2123 ==
1347
2124
1348−Parsing rule. Parses any atom of any of the following odors after a
2125+Examples
1349−leading sig, `~` into a [`++dime`](): [`@da`](), [`@dr`](), [`@p`](),
2126+--------
1350−and [`@t`](), producing a [`++dime`]().
1351
2127
1352 ~zod/try=> (scan "1926.5.12" crub:so)
2128 ~zod/try=> (scan "1926.5.12" crub:so)
1353 [p=~.da q=170.141.184.449.747.016.871.285.095.307.149.312.000]
2129 [p=~.da q=170.141.184.449.747.016.871.285.095.307.149.312.000]
@@ -1368,6 +2144,18 @@ and [`@t`](), producing a [`++dime`]().
1368
2144
1369Top-level coin parser
2145Top-level coin parser
1370
2146
2147+Parsing rule. Switches on the first character and applies the
2148+corresponding [`++coin`]() parser.
2149+
2150+Accepts
2151+-------
2152+
2153+Produces
2154+--------
2155+
2156+Source
2157+------
2158+
1371 ++ nuck
2159 ++ nuck
1372 %+ knee *coin |. ~+
2160 %+ knee *coin |. ~+
1373 %- stew
2161 %- stew
@@ -1379,8 +2167,8 @@ Top-level coin parser
1379 :- '~' ;~(pfix sig ;~(pose twid (easy [~ %n 0])))
2167 :- '~' ;~(pfix sig ;~(pose twid (easy [~ %n 0])))
1380 ==
2168 ==
1381
2169
1382−Parsing rule. Switches on the first character and applies the
2170+Examples
1383−corresponding [`++coin`]() parser.
2171+--------
1384
2172
1385 ~zod/try=> (scan "~pillyt" nuck:so)
2173 ~zod/try=> (scan "~pillyt" nuck:so)
1386 [% p=[p=~.p q=32.819]]
2174 [% p=[p=~.p q=32.819]]
@@ -1410,11 +2198,23 @@ corresponding [`++coin`]() parser.
1410
2198
1411Parse coin literal with escapes
2199Parse coin literal with escapes
1412
2200
2201+Parsing rule. Parses a coin literal with escapes. (See also: xx tuple
2202+formatting).
2203+
2204+Accepts
2205+-------
2206+
2207+Produces
2208+--------
2209+
2210+Source
2211+------
2212+
1413 ++ nusk
2213 ++ nusk
1414 (sear |=(a=@ta (rush (wick a) nuck)) urt:ab)
2214 (sear |=(a=@ta (rush (wick a) nuck)) urt:ab)
1415
2215
1416−Parsing rule. Parses a coin literal with escapes. (See also: xx tuple
2216+Examples
1417−formatting).
2217+--------
1418
2218
1419 ~zod/try=> ~.asd_a
2219 ~zod/try=> ~.asd_a
1420 ~.asd_a
2220 ~.asd_a
@@ -1431,14 +2231,26 @@ formatting).
1431
2231
1432Parsing rule.
2232Parsing rule.
1433
2233
2234+Parsing rule. Parses a dime or tuple without their respective standard
2235+prefixes.
2236+
2237+Accepts
2238+-------
2239+
2240+Produces
2241+--------
2242+
2243+Source
2244+------
2245+
1434 ++ perd
2246 ++ perd
1435 ;~ pose
2247 ;~ pose
1436 (stag ~ zust)
2248 (stag ~ zust)
1437 (stag %many (ifix [cab ;~(plug cab cab)] (more cab nusk)))
2249 (stag %many (ifix [cab ;~(plug cab cab)] (more cab nusk)))
1438 ==
2250 ==
1439
2251
1440−Parsing rule. Parses a dime or tuple without their respective standard
2252+Examples
1441−prefixes.
2253+--------
1442
2254
1443 ~zod/try=> (scan "y" perd:so)
2255 ~zod/try=> (scan "y" perd:so)
1444 [~ [%f %.y]]
2256 [~ [%f %.y]]
@@ -1455,6 +2267,17 @@ prefixes.
1455
2267
1456Parse dime float
2268Parse dime float
1457
2269
2270+Parsing rule. Parses a number into a [`++dime`]() float.
2271+
2272+Accepts
2273+-------
2274+
2275+Produces
2276+--------
2277+
2278+Source
2279+------
2280+
1458 ++ royl
2281 ++ royl
1459 =+ ^= zer
2282 =+ ^= zer
1460 (cook lent (star (just '0')))
2283 (cook lent (star (just '0')))
@@ -1478,7 +2301,8 @@ Parse dime float
1478 (stag %rs (cook ryls voy)
2301 (stag %rs (cook ryls voy)
1479 ==
2302 ==
1480
2303
1481−Parsing rule. Parses a number into a [`++dime`]() float.
2304+Examples
2305+--------
1482
2306
1483 ~zod/try=> (scan "~3.14" royl:so)
2307 ~zod/try=> (scan "~3.14" royl:so)
1484 [%rd .~3.13999999999999]
2308 [%rd .~3.13999999999999]
@@ -1491,6 +2315,31 @@ Parsing rule. Parses a number into a [`++dime`]() float.
1491
2315
1492XX still not fully functional
2316XX still not fully functional
1493
2317
2318+Intermediate parsed float convereter
2319+
2320+------------------------------------------------------------------------
2321+
2322+### `++tash`
2323+
2324+Parse signed dime
2325+
2326+Accepts
2327+-------
2328+
2329+Accepts
2330+-------
2331+
2332+Produces
2333+--------
2334+
2335+Produces
2336+--------
2337+
2338+Parsing rule. Parses a signed number into a [`++dime`]().
2339+
2340+Source
2341+------
2342+
1494 ++ royl-cell
2343 ++ royl-cell
1495 |= [a=? b=[c=@ d=@ e=@] f=(unit ,[h=? i=@])]
2344 |= [a=? b=[c=@ d=@ e=@] f=(unit ,[h=? i=@])]
1496 ^- [? @ @ @ (unit ,@s)]
2345 ^- [? @ @ @ (unit ,@s)]
@@ -1500,13 +2349,11 @@ XX still not fully functional
1500 [a c.b d.b e.b [~ (mul i.u.f 2)]]
2349 [a c.b d.b e.b [~ (mul i.u.f 2)]]
1501 [a c.b d.b e.b [~ (dec (mul i.u.f 2))]]
2350 [a c.b d.b e.b [~ (dec (mul i.u.f 2))]]
1502
2351
1503−Intermediate parsed float convereter
2352+Examples
1504−
2353+--------
1505−------------------------------------------------------------------------
1506−
1507−### `++tash`
1508
2354
1509−Parse signed dime
2355+Source
2356+------
1510
2357
1511 ++ tash
2358 ++ tash
1512 =+ ^= neg
2359 =+ ^= neg
@@ -1520,7 +2367,8 @@ Parse signed dime
1520 ==
2367 ==
1521 ==
2368 ==
1522
2369
1523−Parsing rule. Parses a signed number into a [`++dime`]().
2370+Examples
2371+--------
1524
2372
1525 ~zod/try=> (scan "-20" tash:so)
2373 ~zod/try=> (scan "-20" tash:so)
1526 [p=~.sd q=39]
2374 [p=~.sd q=39]
@@ -1537,6 +2385,17 @@ Parsing rule. Parses a signed number into a [`++dime`]().
1537
2385
1538Parse coins without `~` prefix
2386Parse coins without `~` prefix
1539
2387
2388+Parsing rule. Parses coins after a leading sig, `~`.
2389+
2390+Accepts
2391+-------
2392+
2393+Produces
2394+--------
2395+
2396+Source
2397+------
2398+
1540 ++ twid
2399 ++ twid
1541 ;~ pose
2400 ;~ pose
1542 (cook |=(a=@ [%blob (cue a)]) ;~(pfix (just '0') vum:ag))
2401 (cook |=(a=@ [%blob (cue a)]) ;~(pfix (just '0') vum:ag))
@@ -1544,7 +2403,8 @@ Parse coins without `~` prefix
1544 ==
2403 ==
1545 ::
2404 ::
1546
2405
1547−Parsing rule. Parses coins after a leading sig, `~`.
2406+Examples
2407+--------
1548
2408
1549 ~zod/try=> (scan "zod" twid:so)
2409 ~zod/try=> (scan "zod" twid:so)
1550 [~ [%p 0]]
2410 [~ [%p 0]]
@@ -1563,6 +2423,18 @@ Parsing rule. Parses coins after a leading sig, `~`.
1563
2423
1564Parse prefixed dimes from `@if`, `@f`, `@rd`
2424Parse prefixed dimes from `@if`, `@f`, `@rd`
1565
2425
2426+Parsing rule. Parses an atom of either [`@if`]() (IP address), [`@f`]()
2427+(loobean), or [`rf`]()(floating point) into a [`++dime`]().
2428+
2429+Accepts
2430+-------
2431+
2432+Produces
2433+--------
2434+
2435+Source
2436+------
2437+
1566 ++ zust
2438 ++ zust
1567 ;~ pose
2439 ;~ pose
1568 (stag %is bip:ag)
2440 (stag %is bip:ag)
@@ -1572,8 +2444,8 @@ Parse prefixed dimes from `@if`, `@f`, `@rd`
1572 ==
2444 ==
1573 --
2445 --
1574
2446
1575−Parsing rule. Parses an atom of either [`@if`]() (IP address), [`@f`]()
2447+Examples
1576−(loobean), or [`rf`]()(floating point) into a [`++dime`]().
2448+--------
1577
2449
1578 ~zod/try=> (scan "127.0.0.1" zust:so)
2450 ~zod/try=> (scan "127.0.0.1" zust:so)
1579 [%if q=2.130.706.433]
2451 [%if q=2.130.706.433]
@@ -1594,12 +2466,24 @@ Parsing rule. Parses an atom of either [`@if`]() (IP address), [`@f`]()
1594
2466
1595Render dime as cord
2467Render dime as cord
1596
2468
1597− ++ scot |=(mol=dime ~(rent co %$ mol))
1598−
1599Renders a dime `mol` as a cord.
2469Renders a dime `mol` as a cord.
1600
2470
2471+Accepts
2472+-------
2473+
2474+Produces
2475+--------
2476+
1601`mol` is a [`++dime`]().
2477`mol` is a [`++dime`]().
1602
2478
2479+Source
2480+------
2481+
2482+ ++ scot |=(mol=dime ~(rent co %$ mol))
2483+
2484+Examples
2485+--------
2486+
1603 ~zod/try=> (scot %p ~pillyt)
2487 ~zod/try=> (scot %p ~pillyt)
1604 ~.~pillyt
2488 ~.~pillyt
1605 ~zod/try=> `@t`(scot %p ~pillyt)
2489 ~zod/try=> `@t`(scot %p ~pillyt)
@@ -1623,12 +2507,24 @@ Renders a dime `mol` as a cord.
1623
2507
1624Render dime as tape
2508Render dime as tape
1625
2509
1626− ++ scow |=(mol=dime ~(rend co %$ mol))
1627−
1628Renders `mol` as a tape.
2510Renders `mol` as a tape.
1629
2511
2512+Accepts
2513+-------
2514+
2515+Produces
2516+--------
2517+
1630`mol` is a [`++dime`]().
2518`mol` is a [`++dime`]().
1631
2519
2520+Source
2521+------
2522+
2523+ ++ scow |=(mol=dime ~(rend co %$ mol))
2524+
2525+Examples
2526+--------
2527+
1632 ~zod/try=> (scow %p ~pillyt)
2528 ~zod/try=> (scow %p ~pillyt)
1633 "~pillyt"
2529 "~pillyt"
1634 ~zod/try=> (scow %ux 0x12)
2530 ~zod/try=> (scow %ux 0x12)
@@ -1644,15 +2540,27 @@ Renders `mol` as a tape.
1644
2540
1645Curried slaw
2541Curried slaw
1646
2542
1647− ++ slat |=(mod=@tas |=(txt=@ta (slaw mod txt)))
1648−
1649Produces a [`gate`]() that parses a [`term`]() `txt` to an atom of the
2543Produces a [`gate`]() that parses a [`term`]() `txt` to an atom of the
1650odor specified by `mod`.
2544odor specified by `mod`.
1651
2545
2546+Accepts
2547+-------
2548+
2549+Produces
2550+--------
2551+
1652`mod` is a term, an atom of odor [`@tas`]().
2552`mod` is a term, an atom of odor [`@tas`]().
1653
2553
1654`txt` is a span, an atom of odor [`@ta`]().
2554`txt` is a span, an atom of odor [`@ta`]().
1655
2555
2556+Source
2557+------
2558+
2559+ ++ slat |=(mod=@tas |=(txt=@ta (slaw mod txt)))
2560+
2561+Examples
2562+--------
2563+
1656 ~zod/try=> `(unit ,@p)`((slat %p) '~pillyt')
2564 ~zod/try=> `(unit ,@p)`((slat %p) '~pillyt')
1657 [~ ~pillyt]
2565 [~ ~pillyt]
1658 ~zod/try=> `(unit ,@ux)`((slat %ux) '0x12')
2566 ~zod/try=> `(unit ,@ux)`((slat %ux) '0x12')
@@ -1668,15 +2576,27 @@ odor specified by `mod`.
1668
2576
1669Demand: parse span with input odor
2577Demand: parse span with input odor
1670
2578
1671− ++ slav |=([mod=@tas txt=@ta] (need (slaw mod txt)))
1672−
1673Parses a span `txt` to an atom of the odor specificed by `mod`. Crashes
2579Parses a span `txt` to an atom of the odor specificed by `mod`. Crashes
1674if it failes to parse.
2580if it failes to parse.
1675
2581
2582+Accepts
2583+-------
2584+
2585+Produces
2586+--------
2587+
1676`mod` is a term, an atom of odor [`@tas`]().
2588`mod` is a term, an atom of odor [`@tas`]().
1677
2589
1678`txt` is a span, an atom of odor [`@ta`]().
2590`txt` is a span, an atom of odor [`@ta`]().
1679
2591
2592+Source
2593+------
2594+
2595+ ++ slav |=([mod=@tas txt=@ta] (need (slaw mod txt)))
2596+
2597+Examples
2598+--------
2599+
1680 ~zod/try=> `@p`(slav %p '~pillyt')
2600 ~zod/try=> `@p`(slav %p '~pillyt')
1681 ~pillyt
2601 ~pillyt
1682 ~zod/try=> `@p`(slav %p '~pillam')
2602 ~zod/try=> `@p`(slav %p '~pillam')
@@ -1700,6 +2620,21 @@ if it failes to parse.
1700
2620
1701Parse span to input odor
2621Parse span to input odor
1702
2622
2623+Parses a span `txt` to an atom of the odor specified by `mod`.
2624+
2625+Accepts
2626+-------
2627+
2628+Produces
2629+--------
2630+
2631+`mod` is a term, an atom of odor [`@tas`]().
2632+
2633+`txt` is a span, an atom of odor [`@ta`]().
2634+
2635+Source
2636+------
2637+
1703 ++ slaw
2638 ++ slaw
1704 |= [mod=@tas txt=@ta]
2639 |= [mod=@tas txt=@ta]
1705 ^- (unit ,@)
2640 ^- (unit ,@)
@@ -1707,11 +2642,8 @@ Parse span to input odor
1707 ?.(&(?=([~ %$ @ @] con) =(p.p.u.con mod)) ~ [~ q.p.u.con])
2642 ?.(&(?=([~ %$ @ @] con) =(p.p.u.con mod)) ~ [~ q.p.u.con])
1708 ::
2643 ::
1709
2644
1710−Parses a span `txt` to an atom of the odor specified by `mod`.
2645+Examples
1711−
2646+--------
1712−`mod` is a term, an atom of odor [`@tas`]().
1713−
1714−`txt` is a span, an atom of odor [`@ta`]().
1715
2647
1716 ~zod/try=> `(unit ,@p)`(slaw %p '~pillyt')
2648 ~zod/try=> `(unit ,@p)`(slaw %p '~pillyt')
1717 [~ ~pillyt]
2649 [~ ~pillyt]
@@ -1736,6 +2668,19 @@ Parses a span `txt` to an atom of the odor specified by `mod`.
1736
2668
1737Parse span to coin
2669Parse span to coin
1738
2670
2671+Parses a span `txt` to the unit of a [`++coin`]().
2672+
2673+Accepts
2674+-------
2675+
2676+Produces
2677+--------
2678+
2679+`txt` is a [`@ta`]().
2680+
2681+Source
2682+------
2683+
1739 ++ slay
2684 ++ slay
1740 |= txt=@ta ^- (unit coin)
2685 |= txt=@ta ^- (unit coin)
1741 =+ vex=((full nuck:so) [[1 1] (trip txt)])
2686 =+ vex=((full nuck:so) [[1 1] (trip txt)])
@@ -1744,9 +2689,8 @@ Parse span to coin
1744 [~ p.u.q.vex]
2689 [~ p.u.q.vex]
1745 ::
2690 ::
1746
2691
1747−Parses a span `txt` to the unit of a [`++coin`]().
2692+Examples
1748−
2693+--------
1749−`txt` is a [`@ta`]().
1750
2694
1751 ~zod/try=> (slay '~pillyt')
2695 ~zod/try=> (slay '~pillyt')
1752 [~ [% p=[p=~.p q=32.819]]]
2696 [~ [% p=[p=~.p q=32.819]]]
@@ -1781,16 +2725,28 @@ Parses a span `txt` to the unit of a [`++coin`]().
1781
2725
1782Render path as tank
2726Render path as tank
1783
2727
2728+Renders the path `bon` as a [`tank`](), which is used for
2729+pretty-printing.
2730+
2731+Accepts
2732+-------
2733+
2734+Produces
2735+--------
2736+
2737+`bon` is a [`++path`]().
2738+
2739+Source
2740+------
2741+
1784 ++ smyt
2742 ++ smyt
1785 |= bon=path ^- tank
2743 |= bon=path ^- tank
1786 :+ %rose [['/' ~] ['/' ~] ['/' ~]]
2744 :+ %rose [['/' ~] ['/' ~] ['/' ~]]
1787 |- ^- (list tank)
2745 |- ^- (list tank)
1788 (turn bon |=(a=@ [%leaf (rip 3 a)]))
2746 (turn bon |=(a=@ [%leaf (rip 3 a)]))
1789
2747
1790−Renders the path `bon` as a [`tank`](), which is used for
2748+Examples
1791−pretty-printing.
2749+--------
1792−
1793−`bon` is a [`++path`]().
1794
2750
1795 ~zod/try=> (smyt %)
2751 ~zod/try=> (smyt %)
1796 [ %rose
2752 [ %rose
@@ -1813,12 +2769,24 @@ pretty-printing.
1813
2769
1814Render path as cord
2770Render path as cord
1815
2771
1816− ++ spat |=(pax=path (crip (spud pax))) :: path to cord
1817−
1818Renders a path `pax` as cord.
2772Renders a path `pax` as cord.
1819
2773
2774+Accepts
2775+-------
2776+
2777+Produces
2778+--------
2779+
1820`pax` is a [`path`]().
2780`pax` is a [`path`]().
1821
2781
2782+Source
2783+------
2784+
2785+ ++ spat |=(pax=path (crip (spud pax))) :: path to cord
2786+
2787+Examples
2788+--------
2789+
1822 ~zod/try=> (spat %)
2790 ~zod/try=> (spat %)
1823 '~zod/try/~2014.10.28..18.40.20..4287'
2791 '~zod/try/~2014.10.28..18.40.20..4287'
1824 ~zod/try=> (spat %/bin)
2792 ~zod/try=> (spat %/bin)
@@ -1832,12 +2800,24 @@ Renders a path `pax` as cord.
1832
2800
1833Render path as tape
2801Render path as tape
1834
2802
1835− ++ spud |=(pax=path ~(ram re (smyt pax))) :: path to tape
1836−
1837Renders a path `pax` as [tape]().
2803Renders a path `pax` as [tape]().
1838
2804
2805+Accepts
2806+-------
2807+
2808+Produces
2809+--------
2810+
1839`pax` is a [`path`]().
2811`pax` is a [`path`]().
1840
2812
2813+Source
2814+------
2815+
2816+ ++ spud |=(pax=path ~(ram re (smyt pax))) :: path to tape
2817+
2818+Examples
2819+--------
2820+
1841 ~zod/try=> (spud %)
2821 ~zod/try=> (spud %)
1842 "~zod/try/~2014.10.28..18.40.46..e951"
2822 "~zod/try/~2014.10.28..18.40.46..e951"
1843 ~zod/try=> (spud %/bin)
2823 ~zod/try=> (spud %/bin)
@@ -1851,11 +2831,23 @@ Renders a path `pax` as [tape]().
1851
2831
1852Parse span to path
2832Parse span to path
1853
2833
2834+Parsing rule. Parses a span `zep` to a static [`++path`](/doc/hoon/library/1#++path).
2835+
2836+Accepts
2837+-------
2838+
2839+Produces
2840+--------
2841+
2842+Source
2843+------
2844+
1854 ++ stab :: parse span to path
2845 ++ stab :: parse span to path
1855 |= zep=@ta ^- path
2846 |= zep=@ta ^- path
1856 (rash zep ;~(pfix fas ;~(sfix (more fas urs:ab) fas)))
2847 (rash zep ;~(pfix fas ;~(sfix (more fas urs:ab) fas)))
1857
2848
1858−Parsing rule. Parses a span `zep` to a static [`++path`](/doc/hoon/library/1#++path).
2849+Examples
2850+--------
1859
2851
1860 ~zod/try=> (stab '/as/lek/tor')
2852 ~zod/try=> (stab '/as/lek/tor')
1861 /as/lek/tor
2853 /as/lek/tor
docs/dev/hoon/library/2en.md+279−36
@@ -17,6 +17,22 @@ Used in the `@p` phonetic base.
17
17
18Conceal structure
18Conceal structure
19
19
20+Scrambles a bytestring `pyn` by adding the current position to each
21+byte, looking it up in an s-box, and then performing the XOR operation
22+on the result, pushing it forward. Produces an atom.
23+
24+Accepts
25+-------
26+
27+`pyn` is an [atom]().
28+
29+
30+Produces
31+--------
32+
33+Source
34+------
35+
20 ++ wren :: conceal structure
36 ++ wren :: conceal structure
21 |= pyn=@ ^- @
37 |= pyn=@ ^- @
22 =+ len=(met 3 pyn)
38 =+ len=(met 3 pyn)
@@ -35,11 +51,8 @@ Conceal structure
35 [[1 mog] $(mig mog)]
51 [[1 mog] $(mig mog)]
36 ::
52 ::
37
53
38−Scrambles a bytestring `pyn` by adding the current position to each
54+Examples
39−byte, looking it up in an s-box, and then performing the XOR operation
55+--------
40−on the result, pushing it forward. Produces an atom.
41−
42−`pyn` is an [atom]().
43
56
44 ~zod/try=> `@ux`(wren:un 'testing')
57 ~zod/try=> `@ux`(wren:un 'testing')
45 0x30.bf6a.b9fe.7d8f
58 0x30.bf6a.b9fe.7d8f
@@ -54,6 +67,21 @@ on the result, pushing it forward. Produces an atom.
54
67
55Restore structure
68Restore structure
56
69
70+Unscrambles a bytestring `cry` by subtracting the current position from
71+each byte, looking it up in an s-box, and performing the XOR operation
72+on the result, pushing it forward. Produces an atom.
73+
74+Accepts
75+-------
76+
77+`cry` is an [atom]().
78+
79+Produces
80+--------
81+
82+Source
83+------
84+
57 ++ wred :: restore structure
85 ++ wred :: restore structure
58 |= cry=@ ^- @
86 |= cry=@ ^- @
59 =+ len=(met 3 cry)
87 =+ len=(met 3 cry)
@@ -72,11 +100,8 @@ Restore structure
72 [[1 :(mix mig (end 3 1 len) (zyrt mog))] $(mig mog)]
100 [[1 :(mix mig (end 3 1 len) (zyrt mog))] $(mig mog)]
73 ::
101 ::
74
102
75−Unscrambles a bytestring `cry` by subtracting the current position from
103+Examples
76−each byte, looking it up in an s-box, and performing the XOR operation
104+--------
77−on the result, pushing it forward. Produces an atom.
78−
79−`cry` is an [atom]().
80
105
81 ~zod/try=> (wred:un 0x30.bf6a.b9fe.7d8f)
106 ~zod/try=> (wred:un 0x30.bf6a.b9fe.7d8f)
82 29.113.321.805.538.676
107 29.113.321.805.538.676
@@ -91,9 +116,20 @@ on the result, pushing it forward. Produces an atom.
91
116
92Add modulo 255
117Add modulo 255
93
118
119+Produces the sum of two atoms modulo 255, encoded as a nonzero byte.
120+
121+Accepts
122+-------
123+
124+A cell of two atoms, `a` and `b`.
125+
126+Source
127+------
128+
94 ++ xafo |=([a=@ b=@] +((mod (add (dec b) a) 255)))
129 ++ xafo |=([a=@ b=@] +((mod (add (dec b) a) 255)))
95
130
96−Produces the sum of two atoms modulo 255, encoded as a nonzero byte.
131+Examples
132+--------
97
133
98 ~zod/try=> (xafo:un 5 6)
134 ~zod/try=> (xafo:un 5 6)
99 11
135 11
@@ -106,11 +142,27 @@ Produces the sum of two atoms modulo 255, encoded as a nonzero byte.
106
142
107Subtract modulo 255
143Subtract modulo 255
108
144
109− ++ xaro |=([a=@ b=@] +((mod (add (dec b) (sub 255 (mod a 255))) 255)))
110−
111Produces the difference between two atoms modulo 255, encoded as a
145Produces the difference between two atoms modulo 255, encoded as a
112nonzero byte.
146nonzero byte.
113
147
148+Accepts
149+-------
150+
151+A cell of two atoms, `a` and `b`.
152+
153+Produces
154+--------
155+
156+An atom.
157+
158+Source
159+------
160+
161+ ++ xaro |=([a=@ b=@] +((mod (add (dec b) (sub 255 (mod a 255))) 255)))
162+
163+Examples
164+--------
165+
114 ~zod/try=> (xaro:un 17 57)
166 ~zod/try=> (xaro:un 17 57)
115 40
167 40
116 ~zod/try=> (xaro:un 265 12)
168 ~zod/try=> (xaro:un 265 12)
@@ -122,6 +174,23 @@ nonzero byte.
122
174
123Look up in 255 sub box
175Look up in 255 sub box
124
176
177+The inverse of [`++zart`](). Looks up a nonzero byte`a\` in a substiution
178+box with 255 values, producing a unique nonzero byte.
179+
180+Accepts
181+-------
182+
183+`a` is an atom of one byte in length.
184+
185+
186+Produces
187+--------
188+
189+An atom.
190+
191+Source
192+------
193+
125 ++ zaft :: forward 255-sbox
194 ++ zaft :: forward 255-sbox
126 |= a=@D
195 |= a=@D
127 =+ ^= b
196 =+ ^= b
@@ -139,10 +208,8 @@ Look up in 255 sub box
139 (cut 3 [(dec a) 1] b)
208 (cut 3 [(dec a) 1] b)
140 ::
209 ::
141
210
142−The inverse of [`++zart`](). Looks up a nonzero byte`a\` in a substiution
211+Examples
143−box with 255 values, producing a unique nonzero byte.
212+--------
144−
145−`a` is an [atom]() of one byte in length.
146
213
147 ~zod/try=> (zaft:un 0x12)
214 ~zod/try=> (zaft:un 0x12)
148 42
215 42
@@ -158,6 +225,22 @@ box with 255 values, producing a unique nonzero byte.
158
225
159Reverse look up in 255 sub box
226Reverse look up in 255 sub box
160
227
228+The inverse of [`++zaft`](). Looks up the index of a nonzero byte `a` in
229+the substitution box with 255 values, producing a unique nonzero byte.
230+
231+Accepts
232+-------
233+
234+`a` is an atom of one byte in length.
235+
236+Produces
237+--------
238+
239+An atom.
240+
241+Source
242+------
243+
161 ++ zart :: reverse 255-sbox
244 ++ zart :: reverse 255-sbox
162 |= a=@D
245 |= a=@D
163 =+ ^= b
246 =+ ^= b
@@ -175,10 +258,8 @@ Reverse look up in 255 sub box
175 (cut 3 [(dec a) 1] b)
258 (cut 3 [(dec a) 1] b)
176 ::
259 ::
177
260
178−The inverse of [`++zaft`](). Looks up the index of a nonzero byte `a` in
261+Examples
179−the substitution box with 255 values, producing a unique nonzero byte.
262+--------
180−
181−`a` is an [atom]() of one byte in length.
182
263
183 ~zod/try=> `@ux`(zart:un 204)
264 ~zod/try=> `@ux`(zart:un 204)
184 0xff
265 0xff
@@ -191,6 +272,22 @@ the substitution box with 255 values, producing a unique nonzero byte.
191
272
192Lookup byte in 256 sub box
273Lookup byte in 256 sub box
193
274
275+The inverse of [`++zyrt`](). Looks up a byte `a` in a substituion box
276+with 256 values, producing a byte.
277+
278+Accepts
279+-------
280+
281+`a` is an [atom]() of one byte in length.
282+
283+Produces
284+--------
285+
286+An atom.
287+
288+Source
289+------
290+
194 ++ zyft :: forward 256-sbox
291 ++ zyft :: forward 256-sbox
195 |= a=@D
292 |= a=@D
196 =+ ^= b
293 =+ ^= b
@@ -209,10 +306,8 @@ Lookup byte in 256 sub box
209 (cut 3 [a 1] b)
306 (cut 3 [a 1] b)
210 ::
307 ::
211
308
212−The inverse of [`++zyrt`](). Looks up a byte `a` in a substituion box
309+Examples
213−with 256 values, producing a byte.
310+--------
214−
215−`a` is an [atom]() of one byte in length.
216
311
217 ~zod/try=> (zyft:un 0x12)
312 ~zod/try=> (zyft:un 0x12)
218 57
313 57
@@ -227,6 +322,22 @@ with 256 values, producing a byte.
227
322
228Reverse lookup byte in 256 sub box
323Reverse lookup byte in 256 sub box
229
324
325+The inverse of [`++zyft`](/doc/hoon/library/2en#++zyft). Looks up a byte `a` in a substituion box
326+with 256 values, producing a byte.
327+
328+Accepts
329+-------
330+
331+`a` is an [atom]() of one byte in length.
332+
333+Produces
334+--------
335+
336+An atom.
337+
338+Source
339+------
340+
230 ++ zyrt :: reverse 256-sbox
341 ++ zyrt :: reverse 256-sbox
231 |= a=@D
342 |= a=@D
232 =+ ^= b
343 =+ ^= b
@@ -244,10 +355,8 @@ Reverse lookup byte in 256 sub box
244 df4d.225e.2d56.7fd6.1395.a3f8.c582
355 df4d.225e.2d56.7fd6.1395.a3f8.c582
245 (cut 3 [a 1] b)
356 (cut 3 [a 1] b)
246
357
247−The inverse of [`++zyft`](/doc/hoon/library/2en#++zyft). Looks up a byte `a` in a substituion box
358+Examples
248−with 256 values, producing a byte.
359+--------
249−
250−`a` is an [atom]() of one byte in length.
251
360
252 ~zod/try=> `@ux`(zyrt:un 57)
361 ~zod/try=> `@ux`(zyrt:un 57)
253 0x12
362 0x12
@@ -271,6 +380,23 @@ A core for performing reversible scrambling operations for the `@p` phonetic bas
271
380
272Conceal structure, v2
381Conceal structure, v2
273
382
383+Randomly permutes atoms that fit into 17 to 32 bits into one another. If the
384+atom fits into 33 to 64 bits, does the same permutation on the low 32 bits
385+only. Otherwise, passes the atom through unchanged.
386+
387+Accepts
388+-------
389+
390+An atom.
391+
392+Produces
393+--------
394+
395+An atom.
396+
397+Source
398+------
399+
274 ++ feen :: conceal structure v2
400 ++ feen :: conceal structure v2
275 |= pyn=@ ^- @
401 |= pyn=@ ^- @
276 ?: &((gte pyn 0x1.0000) (lte pyn 0xffff.ffff))
402 ?: &((gte pyn 0x1.0000) (lte pyn 0xffff.ffff))
@@ -282,12 +408,34 @@ Conceal structure, v2
282 (add 0x1.0000 (fice (sub lo 0x1.0000)))
408 (add 0x1.0000 (fice (sub lo 0x1.0000)))
283 pyn
409 pyn
284
410
285−Randomly permutes atoms that fit into 17 to 32 bits into one another. If the atom fits into 33 to 64 bits, does the same permutation on the low 32 bits only. Otherwise, passes the atom through unchanged.
411+Examples
412+--------
413+
286
414
287------------------------------------------------------------------------
415------------------------------------------------------------------------
288
416
289### `++fend`
417### `++fend`
290
418
419+XX
420+
421+Randomly permutes atoms that fit into 17 to 32 bits into one another, and
422+randomly permutes the low 32 bits of atoms that fit into 33 to 64 bits;
423+otherwise, passes the atom through unchanged. The permutation is the inverse of
424+the one applied by [`++feen`]().
425+
426+Accepts
427+-------
428+
429+An atom.
430+
431+Produces
432+--------
433+
434+An atom.
435+
436+Source
437+------
438+
291 ++ fend :: restore structure v2
439 ++ fend :: restore structure v2
292 |= cry=@ ^- @
440 |= cry=@ ^- @
293 ?: &((gte cry 0x1.0000) (lte cry 0xffff.ffff))
441 ?: &((gte cry 0x1.0000) (lte cry 0xffff.ffff))
@@ -299,12 +447,30 @@ Randomly permutes atoms that fit into 17 to 32 bits into one another. If the ato
299 (add 0x1.0000 (teil (sub lo 0x1.0000)))
447 (add 0x1.0000 (teil (sub lo 0x1.0000)))
300 cry
448 cry
301
449
302−Randomly permutes atoms that fit into 17 to 32 bits into one another, and randomly permutes the low 32 bits of atoms that fit into 33 to 64 bits; otherwise, passes the atom through unchanged. The permutation is the inverse of the one applied by [`++feen`]().
450+Examples
451+--------
303
452
304------------------------------------------------------------------------
453------------------------------------------------------------------------
305
454
306### `++fice`
455### `++fice`
307
456
457+XX
458+
459+Applies a 3-round Feistel-like cipher to randomly permute atoms in the range `0` to `2^32 - 2^16`. The construction given in Black and Rogaway is ideal for a domain with a size of that form, and as with a conventionel Feistel cipher, three rounds suffice to make the permutation pseudorandom.
460+
461+Accepts
462+-------
463+
464+An atom.
465+
466+Produces
467+--------
468+
469+An atom.
470+
471+Source
472+------
473+
308 ++ fice :: adapted from
474 ++ fice :: adapted from
309 |= nor=@ :: black and rogaway
475 |= nor=@ :: black and rogaway
310 ^- @ :: "ciphers with
476 ^- @ :: "ciphers with
@@ -315,12 +481,33 @@ Randomly permutes atoms that fit into 17 to 32 bits into one another, and random
315 [(mod nor 65.535) (div nor 65.535)]
481 [(mod nor 65.535) (div nor 65.535)]
316 (add (mul 65.535 -.sel) +.sel)
482 (add (mul 65.535 -.sel) +.sel)
317
483
318−Applies a 3-round Feistel-like cipher to randomly permute atoms in the range `0` to `2^32 - 2^16`. The construction given in Black and Rogaway is ideal for a domain with a size of that form, and as with a conventionel Feistel cipher, three rounds suffice to make the permutation pseudorandom.
484+Examples
485+--------
319
486
320------------------------------------------------------------------------
487------------------------------------------------------------------------
321
488
322### `++teil`
489### `++teil`
323
490
491+XX
492+
493+Applies the reverse of the Feistel-like cipher applied by [`++fice`](). Unlike
494+a conventional Feistel cipher that is its own inverse if keys are used in
495+reverse order, this Feistel-like cipher uses two moduli that must be swapped
496+when applying the reverse transformation.
497+
498+Accepts
499+-------
500+
501+An atom.
502+
503+Produces
504+--------
505+
506+An atom.
507+
508+Source
509+------
510+
324 ++ teil :: reverse ++fice
511 ++ teil :: reverse ++fice
325 |= vip=@
512 |= vip=@
326 ^- @
513 ^- @
@@ -331,12 +518,31 @@ Applies a 3-round Feistel-like cipher to randomly permute atoms in the range `0`
331 [(mod vip 65.535) (div vip 65.535)]
518 [(mod vip 65.535) (div vip 65.535)]
332 (add (mul 65.535 -.sel) +.sel)
519 (add (mul 65.535 -.sel) +.sel)
333
520
334−Applies the reverse of the Feistel-like cipher applied by [`++fice`](). Unlike a conventional Feistel cipher that is its own inverse if keys are used in reverse order, this Feistel-like cipher uses two moduli that must be swapped when applying the reverse transformation.
521+Examples
522+--------
335
523
336------------------------------------------------------------------------
524------------------------------------------------------------------------
337
525
338### `++rynd`
526### `++rynd`
339
527
528+XX
529+
530+A single round of the Feistel-like cipher [`++fice`](). AES ([`++aesc`]()) is
531+used as the round function.
532+
533+Accepts
534+-------
535+
536+A cell of three atoms, `n`, `l`, and `r`.
537+
538+Produces
539+--------
540+
541+A cell of two atoms.
542+
543+Source
544+------
545+
340 ++ rynd :: feistel round
546 ++ rynd :: feistel round
341 |= [n=@ l=@ r=@]
547 |= [n=@ l=@ r=@]
342 ^- [@ @]
548 ^- [@ @]
@@ -345,12 +551,30 @@ Applies the reverse of the Feistel-like cipher applied by [`++fice`](). Unlike a
345 (~(sum fo 65.535) l (en:aesc (snag n raku) r))
551 (~(sum fo 65.535) l (en:aesc (snag n raku) r))
346 (~(sum fo 65.536) l (en:aesc (snag n raku) r))
552 (~(sum fo 65.536) l (en:aesc (snag n raku) r))
347
553
348−A single round of the Feistel-like cipher [`++fice`](). AES ([`++aesc`]()) is used as the round function.
554+Examples
555+--------
349
556
350------------------------------------------------------------------------
557------------------------------------------------------------------------
351
558
352### `++rund`
559### `++rund`
353
560
561+XX
562+
563+A single round of the Feistel-like reverse cipher [`++teil`]().
564+
565+Accepts
566+-------
567+
568+A cell of three atoms, `n`, `l`, and `r`.
569+
570+Produces
571+--------
572+
573+A cell of two atoms.
574+
575+Source
576+------
577+
354 ++ rund :: reverse round
578 ++ rund :: reverse round
355 |= [n=@ l=@ r=@]
579 |= [n=@ l=@ r=@]
356 ^- [@ @]
580 ^- [@ @]
@@ -359,12 +583,29 @@ A single round of the Feistel-like cipher [`++fice`](). AES ([`++aesc`]()) is us
359 (~(dif fo 65.535) l (en:aesc (snag n raku) r))
583 (~(dif fo 65.535) l (en:aesc (snag n raku) r))
360 (~(dif fo 65.536) l (en:aesc (snag n raku) r))
584 (~(dif fo 65.536) l (en:aesc (snag n raku) r))
361
585
362−A single round of the Feistel-like reverse cipher [`++teil`]().
586+Examples
587+--------
363
588
364------------------------------------------------------------------------
589------------------------------------------------------------------------
365
590
366### `++raku`
591### `++raku`
367
592
593+XX
594+
595+
596+Accepts
597+-------
598+
599+A list of atoms of [odor]() [`@ux`]() (hexadecimal).
600+
601+Produces
602+--------
603+
604+Arbitrary keys for use with [`++aesc`]().
605+
606+Source
607+------
608+
368 ++ raku
609 ++ raku
369 ^- (list ,@ux)
610 ^- (list ,@ux)
370 :~ 0x15f6.25e3.083a.eb3e.7a55.d4db.fb99.32a3.
611 :~ 0x15f6.25e3.083a.eb3e.7a55.d4db.fb99.32a3.
@@ -375,4 +616,6 @@ A single round of the Feistel-like reverse cipher [`++teil`]().
375 6f5f.ab8e.88b9.c089.b2dc.95a6.aed5.e3a4
616 6f5f.ab8e.88b9.c089.b2dc.95a6.aed5.e3a4
376 ==
617 ==
377
618
378−Arbitrary keys for use with [`++aesc`]().
619+Examples
620+--------
621+
docs/dev/hoon/library/2eo.md+185−60
@@ -5,6 +5,25 @@ section 2eO, virtualization
5
5
6Nock subject to unit
6Nock subject to unit
7
7
8+Accepts a nock subject-formula cell and wraps it into a [`++unit`]().
9+`fol` is pure nock, meaning that nock `11` operations result in a block,
10+producing a `~`.
11+
12+Accepts
13+-------
14+
15+`sub` is a subject [noun]().
16+
17+`fol` is a formula noun, which is generally a `++nock`.
18+
19+Produces
20+--------
21+
22+The `++unit` of a noun.
23+
24+Source
25+------
26+
8 ++ mack
27 ++ mack
9 |= [sub=* fol=*]
28 |= [sub=* fol=*]
10 ^- (unit)
29 ^- (unit)
@@ -12,13 +31,8 @@ Nock subject to unit
12 ?.(?=([0 *] ton) ~ [~ p.ton])
31 ?.(?=([0 *] ton) ~ [~ p.ton])
13 ::
32 ::
14
33
15−Accepts a nock subject-formula cell and wraps it into a [`++unit`]().
34+Examples
16−`fol` is pure nock, meaning that nock `11` operations result in a block,
35+--------
17−producing a `~`.
18−
19−`sub` is a subject [noun]().
20−
21−`fol` is a formula [noun](), which is generally a `++nock`.
22
36
23 ~zod/try=> (mack [[1 2 3] [0 1]])
37 ~zod/try=> (mack [[1 2 3] [0 1]])
24 [~ [1 2 3]]
38 [~ [1 2 3]]
@@ -37,6 +51,28 @@ producing a `~`.
37
51
38Mock interpreter
52Mock interpreter
39
53
54+Bottom-level [mock]() (virtual nock) interpreter. Produces a
55+[`++tone`](), a nock computation result. If nock 11 is invoked, `sky`
56+computes on the subject and produces a [`++unit`]() result. An empty
57+result becomes a `%1` `++tone`, indicating a block.
58+
59+Accepts
60+-------
61+
62+`sub` is the subject as a [noun]().
63+
64+`fol` is the formula as a noun.
65+
66+`sky` is an [`%iron`]() gate invoked with [nock operator 11]().
67+
68+Produces
69+--------
70+
71+A `++tone`.
72+
73+Source
74+------
75+
40 ++ mink
76 ++ mink
41 ~/ %mink
77 ~/ %mink
42 |= [[sub=* fol=*] sky=$+(* (unit))]
78 |= [[sub=* fol=*] sky=$+(* (unit))]
@@ -113,16 +149,8 @@ Mock interpreter
113 ==
149 ==
114 ::
150 ::
115
151
116−Bottom-level [mock]() (virtual nock) interpreter. Produces a
152+Examples
117−[`++tone`](), a nock computation result. If nock 11 is invoked, `sky`
153+--------
118−computes on the subject and produces a [`++unit`]() result. An empty
119−result becomes a `%1` `++tone`, indicating a block.
120−
121−`sub` is the subject as a [noun]().
122−
123−`fol` is the formula as a [noun]().
124−
125−`sky` is an [`%iron`]() gate invoked with [nock operator 11]().
126
154
127 ~zod/try=> (mink [20 [4 0 1]] ,~)
155 ~zod/try=> (mink [20 [4 0 1]] ,~)
128 [%0 p=21]
156 [%0 p=21]
@@ -147,22 +175,36 @@ result becomes a `%1` `++tone`, indicating a block.
147
175
148Compute formula on subject with hint
176Compute formula on subject with hint
149
177
150− ++ mock
151− |= [[sub=* fol=*] sky=$+(* (unit))]
152− (mook (mink [sub fol] sky))
153− ::
154−
155Produces a [`++toon`](), which is either a sucessful, blocked, or
178Produces a [`++toon`](), which is either a sucessful, blocked, or
156crashed result. If nock 11 is invoked, `sky` computes on the subject and
179crashed result. If nock 11 is invoked, `sky` computes on the subject and
157produces a [`++unit`]() result. An empty result becomes a `%1` `++tune`,
180produces a [`++unit`]() result. An empty result becomes a `%1` `++tune`,
158indicating a block.
181indicating a block.
159
182
183+Accepts
184+-------
185+
160`sub` is the subject as a [noun]().
186`sub` is the subject as a [noun]().
161
187
162−`fol` is the formula as a [noun]().
188+`fol` is the formula as a noun.
163
189
164`sky` is an [%iron]() gate invoked with [nock operator 11]().
190`sky` is an [%iron]() gate invoked with [nock operator 11]().
165
191
192+Produces
193+--------
194+
195+The `++unit` of a noun.
196+
197+Source
198+------
199+
200+ ++ mock
201+ |= [[sub=* fol=*] sky=$+(* (unit))]
202+ (mook (mink [sub fol] sky))
203+ ::
204+
205+Examples
206+--------
207+
166 ~zod/try=> (mock [5 4 0 1] ,~)
208 ~zod/try=> (mock [5 4 0 1] ,~)
167 [%0 p=6]
209 [%0 p=6]
168 ~zod/try=> (mock [~ 11 1 0] |=(* `999))
210 ~zod/try=> (mock [~ 11 1 0] |=(* `999))
@@ -184,6 +226,22 @@ indicating a block.
184
226
185Intelligently render crash annotation
227Intelligently render crash annotation
186
228
229+Converts a `%2` `++tone` nock stack trace to a list of [`++tank`]().
230+Each may be a tank, cord, [`++spot`](), or trapped tank.
231+
232+Accepts
233+-------
234+
235+`ton` is a [`++tone`]().
236+
237+Produces
238+--------
239+
240+A [`++toon`]().
241+
242+Source
243+------
244+
187 ++ mook
245 ++ mook
188 |= ton=tone
246 |= ton=tone
189 ^- toon
247 ^- toon
@@ -231,11 +289,8 @@ Intelligently render crash annotation
231 ==
289 ==
232 ::
290 ::
233
291
234−Converts a `%2` `++tone` nock stack trace to a list of [`++tank`]().
292+Examples
235−Each may be a tank, cord, [`++spot`](), or trapped tank. Produces a
293+--------
236−[`++toon`]().
237−
238−`ton` is a [`++tone`]().
239
294
240 ~zod/try=> (mook [%0 5 4 5 1])
295 ~zod/try=> (mook [%0 5 4 5 1])
241 [%0 p=[5 4 5 1]]
296 [%0 p=[5 4 5 1]]
@@ -254,23 +309,37 @@ Each may be a tank, cord, [`++spot`](), or trapped tank. Produces a
254
309
255Unit: Slam gate with sample
310Unit: Slam gate with sample
256
311
257− ++ mang
258− |= [[gat=* sam=*] sky=$+(* (unit))]
259− ^- (unit)
260− =+ ton=(mong [[gat sam] sky])
261− ?.(?=([0 *] ton) ~ [~ p.ton])
262− ::
263−
264Produces a [`++unit`]() computation result from slamming `gat` with
312Produces a [`++unit`]() computation result from slamming `gat` with
265`sam`, using `sky` to compute or block on nock 11 when applicable.
313`sam`, using `sky` to compute or block on nock 11 when applicable.
266Similar to [`++mong`]().
314Similar to [`++mong`]().
267
315
316+Accepts
317+-------
318+
268`gat` is a [noun]() that is generally a [`gate`]().
319`gat` is a [noun]() that is generally a [`gate`]().
269
320
270`sam` is a [`sample`]() noun.
321`sam` is a [`sample`]() noun.
271
322
272`sky` is an [%iron]() gate invoked with [nock operator 11]().
323`sky` is an [%iron]() gate invoked with [nock operator 11]().
273
324
325+Produces
326+--------
327+
328+The `++unit` of a noun.
329+
330+Source
331+------
332+
333+ ++ mang
334+ |= [[gat=* sam=*] sky=$+(* (unit))]
335+ ^- (unit)
336+ =+ ton=(mong [[gat sam] sky])
337+ ?.(?=([0 *] ton) ~ [~ p.ton])
338+ ::
339+
340+Examples
341+--------
342+
274 ~zod/try=> (mang [|=(@ 20) ~] ,~)
343 ~zod/try=> (mang [|=(@ 20) ~] ,~)
275 [~ 20]
344 [~ 20]
276 ~zod/try=> (mang [|=(@ !!) ~] ,~)
345 ~zod/try=> (mang [|=(@ !!) ~] ,~)
@@ -296,23 +365,37 @@ Similar to [`++mong`]().
296
365
297Slam gate with sample
366Slam gate with sample
298
367
299− ++ mong
300− |= [[gat=* sam=*] sky=$+(* (unit))]
301− ^- toon
302− ?. &(?=(^ gat) ?=(^ +.gat))
303− [%2 ~]
304− (mock [[-.gat [sam +>.gat]] -.gat] sky)
305− ::
306−
307Produces a [`++toon`]() computation result from slamming `gat` with
368Produces a [`++toon`]() computation result from slamming `gat` with
308`sam`, using `sky` to compute or block on nock 11 when applicable.
369`sam`, using `sky` to compute or block on nock 11 when applicable.
309
370
371+Accepts
372+-------
373+
310`gat` is a [noun]() that is generally a [`gate`]().
374`gat` is a [noun]() that is generally a [`gate`]().
311
375
312`sam` is a [`sample`]() noun.
376`sam` is a [`sample`]() noun.
313
377
314`sky` is an [%iron]() gate invoked with [nock operator 11]().
378`sky` is an [%iron]() gate invoked with [nock operator 11]().
315
379
380+Produces
381+--------
382+
383+A `++toon`.
384+
385+Source
386+------
387+
388+ ++ mong
389+ |= [[gat=* sam=*] sky=$+(* (unit))]
390+ ^- toon
391+ ?. &(?=(^ gat) ?=(^ +.gat))
392+ [%2 ~]
393+ (mock [[-.gat [sam +>.gat]] -.gat] sky)
394+ ::
395+
396+Examples
397+--------
398+
316 ~zod/try=> (mong [|=(@ 20) ~] ,~)
399 ~zod/try=> (mong [|=(@ 20) ~] ,~)
317 [%0 p=20]
400 [%0 p=20]
318 ~zod/try=> (mong [|=(@ !!) ~] ,~)
401 ~zod/try=> (mong [|=(@ !!) ~] ,~)
@@ -338,23 +421,37 @@ Produces a [`++toon`]() computation result from slamming `gat` with
338
421
339Virtualize slamming gate
422Virtualize slamming gate
340
423
341− ++ mung
342− |= [[gat=* sam=*] sky=$+(* (unit))]
343− ^- tone
344− ?. &(?=(^ gat) ?=(^ +.gat))
345− [%2 ~]
346− (mink [[-.gat [sam +>.gat]] -.gat] sky)
347− ::
348−
349Produces a [`++tone`]() computation result from slamming `gat` with
424Produces a [`++tone`]() computation result from slamming `gat` with
350`sam`, using `sky` to compute or block on nock 11 when applicable.
425`sam`, using `sky` to compute or block on nock 11 when applicable.
351
426
427+Accepts
428+-------
429+
352`gat` is a [noun]() that is generally a [`gate`]().
430`gat` is a [noun]() that is generally a [`gate`]().
353
431
354`sam` is a [`sample`]() noun.
432`sam` is a [`sample`]() noun.
355
433
356`sky` is an [%iron]() gate invoked with [nock operator 11]().
434`sky` is an [%iron]() gate invoked with [nock operator 11]().
357
435
436+Produces
437+--------
438+
439+A `++tone`.
440+
441+Source
442+------
443+
444+ ++ mung
445+ |= [[gat=* sam=*] sky=$+(* (unit))]
446+ ^- tone
447+ ?. &(?=(^ gat) ?=(^ +.gat))
448+ [%2 ~]
449+ (mink [[-.gat [sam +>.gat]] -.gat] sky)
450+ ::
451+
452+Examples
453+--------
454+
358 ~zod/try=> (mung [|=(@ 20) ~] ,~)
455 ~zod/try=> (mung [|=(@ 20) ~] ,~)
359 [%0 p=20]
456 [%0 p=20]
360 ~zod/try=> (mung [|=(@ !!) ~] ,~)
457 ~zod/try=> (mung [|=(@ !!) ~] ,~)
@@ -380,6 +477,22 @@ Produces a [`++tone`]() computation result from slamming `gat` with
380
477
381Typed virtual
478Typed virtual
382
479
480+Kicks a [`++trap`](), producing its results or any errors that occur along
481+the way. Used to lazily compute stack traces.
482+
483+Accepts
484+-------
485+
486+`taq` is a [`++trap`](), generally producing a list of [`++tank`]()s.
487+
488+Produces
489+--------
490+
491+XX
492+
493+Source
494+------
495+
383 ++ mule :: typed virtual
496 ++ mule :: typed virtual
384 ~/ %mule
497 ~/ %mule
385 |* taq=_|.(_*)
498 |* taq=_|.(_*)
@@ -390,10 +503,8 @@ Typed virtual
390 ==
503 ==
391 ::
504 ::
392
505
393−Kicks a `++trap`, producing its results or any errors that occur along
506+Examples
394−the way. Used to lazily compute stack traces.
507+--------
395−
396−`taq` is a [`++trap`](), generally producing a list of [`++tank`]()s.
397
508
398 ~zod/try=> (mule |.(leaf/"hello"))
509 ~zod/try=> (mule |.(leaf/"hello"))
399 [%.y p=[%leaf "hello"]]
510 [%.y p=[%leaf "hello"]]
@@ -419,6 +530,23 @@ the way. Used to lazily compute stack traces.
419
530
420Untyped virtual
531Untyped virtual
421
532
533+Kicks a `++trap`, producing its result as a noun or the tanks of any
534+error that occurs. Similar to [`++mule`](), but preserves no type
535+information.
536+
537+Accepts
538+-------
539+
540+`taq` is a [`++trap`](/doc/hoon/library/1#++trap).
541+
542+Produces
543+--------
544+
545+Either a noun or a [`++list`]() of [`++tank`]().
546+
547+Source
548+------
549+
422 ++ mute :: untyped virtual
550 ++ mute :: untyped virtual
423 |= taq=_^?(|.(_*))
551 |= taq=_^?(|.(_*))
424 ^- (each ,* (list tank))
552 ^- (each ,* (list tank))
@@ -429,11 +557,8 @@ Untyped virtual
429 %2 [%| p.ton]
557 %2 [%| p.ton]
430 ==
558 ==
431
559
432−Kicks a `++trap`, producing its result as a noun or the tanks of any
560+Examples
433−error that occurs. Similar to [`++mule`](), but preserves no type
561+--------
434−information.
435−
436−`taq` is a [`++trap`](/doc/hoon/library/1#++trap).
437
562
438 ~zod/try=> (mute |.(leaf/"hello"))
563 ~zod/try=> (mute |.(leaf/"hello"))
439 [%.y p=[1.717.658.988 104 101 108 108 111 0]]
564 [%.y p=[1.717.658.988 104 101 108 108 111 0]]
docs/dev/hoon/library/2ep.md+249−26
@@ -12,6 +12,22 @@ anyway.
12
12
13Invert diff patches
13Invert diff patches
14
14
15+Inverts a list of changes `bur`. Skips stay constant and replaces are
16+swapped. Produces a `bur`.
17+
18+Accepts
19+-------
20+
21+`bur` is a [`++urge`]().
22+
23+Produces
24+--------
25+
26+The `++urge` of a noun.
27+
28+Source
29+------
30+
15 ++ berk :: invert diff patch
31 ++ berk :: invert diff patch
16 |* bur=(urge)
32 |* bur=(urge)
17 |- ^+ bur
33 |- ^+ bur
@@ -23,10 +39,8 @@ Invert diff patches
23 ==
39 ==
24 ::
40 ::
25
41
26−Inverts a list of changes `bur`. Skips stay constant and replaces are
42+Examples
27−swapped. Produces a `bur`.
43+--------
28−
29−`bur` is a [`++urge`]().
30
44
31 ~zod/try=> (berk `(urge)`~[`10 %|^[~[2] ~[3 4]] `5])
45 ~zod/try=> (berk `(urge)`~[`10 %|^[~[2] ~[3 4]] `5])
32 ~[[%.y p=10] [%.n p=~[3 4] q=~[2]] [%.y p=5]]
46 ~[[%.y p=10] [%.n p=~[3 4] q=~[2]] [%.y p=5]]
@@ -43,6 +57,21 @@ swapped. Produces a `bur`.
43
57
44Generate patch
58Generate patch
45
59
60+Produces a patch between two nouns, by change type
61+
62+Accepts
63+-------
64+
65+`pum` is an [`++umph`]().
66+
67+Produces
68+--------
69+
70+An [`++udon`]()
71+
72+Source
73+------
74+
46 ++ diff :: generate patch
75 ++ diff :: generate patch
47 |= pum=umph
76 |= pum=umph
48 |= [old=* new=*] ^- udon
77 |= [old=* new=*] ^- udon
@@ -56,9 +85,8 @@ Generate patch
56 ==
85 ==
57 ::
86 ::
58
87
59−Produces a patch between two nouns, by change type
88+Examples
60−
89+--------
61−`pum` is an [`++umph`]().
62
90
63 ~zod/try=> ((diff %a) 20 21)
91 ~zod/try=> ((diff %a) 20 21)
64 [p=%a q=[%d p=[%1 p=21] q=[%1 p=20]]]
92 [p=%a q=[%d p=[%1 p=21] q=[%1 p=20]]]
@@ -88,6 +116,26 @@ Produces a patch between two nouns, by change type
88
116
89Longest subsequence
117Longest subsequence
90
118
119+Finds a subsequence of repeated elements within two [`++list`]()s, using
120+several internal helper arms. Produces a [`++tape`]().
121+
122+Accepts
123+-------
124+
125+`hel` is a [`++list`]() of [nouns]().
126+
127+`hev` is a [++list`]() of nouns.
128+
129+Produces
130+--------
131+
132+XX
133+
134+A [++list`]() of nouns.
135+
136+Source
137+------
138+
91 ++ loss :: longest subsequence
139 ++ loss :: longest subsequence
92 ~/ %loss
140 ~/ %loss
93 |* [hel=(list) hev=(list)]
141 |* [hel=(list) hev=(list)]
@@ -153,12 +201,8 @@ Longest subsequence
153 $(hel t.hel, hev t.hev, rag (done %| [i.hel ~] [i.hev ~]))
201 $(hel t.hel, hev t.hev, rag (done %| [i.hel ~] [i.hev ~]))
154 --
202 --
155
203
156−Finds a subsequence of repeated elements within two [`++list`]()s, using
204+Examples
157−several internal helper arms. Produces a [`++tape`]().
205+--------
158−
159−`hel` is a [`++list`]() of characters.
160−
161−`hev` is a [++list\`]() of characters.
162
206
163 ~zod/try=> (loss "sam" "sem")
207 ~zod/try=> (loss "sam" "sem")
164 "sm"
208 "sm"
@@ -177,6 +221,22 @@ several internal helper arms. Produces a [`++tape`]().
177
221
178Find common
222Find common
179
223
224+Finds a subsequence of repeated elements within two
225+[`++list`](/doc/hoon/library/1#++list)s, producing a [\`++tape]().
226+
227+Accepts
228+-------
229+
230+A cell of two `++tape`s, `hel` and `hev`.
231+
232+Produces
233+--------
234+
235+A `++tape`.
236+
237+Source
238+------
239+
180 ++ locz :: trivial algorithm
240 ++ locz :: trivial algorithm
181 |= [hel=tape hev=tape]
241 |= [hel=tape hev=tape]
182 ^- tape
242 ^- tape
@@ -194,8 +254,8 @@ Find common
194 ?:((gth p.lef p.rig) lef rig)
254 ?:((gth p.lef p.rig) lef rig)
195 ::
255 ::
196
256
197−Finds a subsequence of repeated elements within two [`++list`](/doc/hoon/library/1#++list)s,
257+Examples
198−producing a [\`++tape]().
258+--------
199
259
200 ~zod/try=> (locz "samukot" "semelkot")
260 ~zod/try=> (locz "samukot" "semelkot")
201 "smkot"
261 "smkot"
@@ -208,6 +268,22 @@ producing a [\`++tape]().
208
268
209Split on `\n`
269Split on `\n`
210
270
271+Split on newlines, ascii `10`
272+
273+Accepts
274+-------
275+
276+`lub` is an atom.
277+
278+Produces
279+--------
280+
281+XX
282+
283+A `++list` of atoms of odor [`@t`]() ([`++cord`]()).
284+
285+Source
286+------
211 ++ lore :: atom to line list
287 ++ lore :: atom to line list
212 ~/ %lore
288 ~/ %lore
213 |= lub=@
289 |= lub=@
@@ -225,7 +301,8 @@ Split on `\n`
225 $(lub res, tez [(end 3 meg lub) tez])
301 $(lub res, tez [(end 3 meg lub) tez])
226 ::
302 ::
227
303
228−Split on newlines, ascii `10`
304+Examples
305+--------
229
306
230 ~zod/try=> (lore 'soke\0alas\0amep')
307 ~zod/try=> (lore 'soke\0alas\0amep')
231 <|soke las mep|>
308 <|soke las mep|>
@@ -244,12 +321,30 @@ Split on newlines, ascii `10`
244
321
245Join with `\n`
322Join with `\n`
246
323
324+Join line list with newlines.
325+
326+Accepts
327+-------
328+
329+A `++list` of atoms of [odor]() [`@t`]() ([`++cord`]()).
330+
331+Produces
332+--------
333+
334+XX
335+
336+An atom of [odor]() [`@t`]() ([`++cord`]().
337+
338+Source
339+------
340+
247 ++ role :: line list to atom
341 ++ role :: line list to atom
248 |= tez=(list ,@t)
342 |= tez=(list ,@t)
249 (rap 3 (turn tez |=(a=@t (cat 3 a 10))))
343 (rap 3 (turn tez |=(a=@t (cat 3 a 10))))
250 ::
344 ::
251
345
252−Join line list with newlines.
346+Examples
347+--------
253
348
254 ~zod/try=> (role 'sep' 'tek' 'lap' ~)
349 ~zod/try=> (role 'sep' 'tek' 'lap' ~)
255 3.230.709.852.558.292.782.985.274.739
350 3.230.709.852.558.292.782.985.274.739
@@ -266,6 +361,21 @@ Join line list with newlines.
266
361
267Change with `++udon`
362Change with `++udon`
268
363
364+Use [`++udon`]() to change [noun]().
365+
366+Accepts
367+-------
368+
369+A cell of an `++udon`, `don`, and a noun, `src`.
370+
371+Produces
372+--------
373+
374+A noun.
375+
376+Source
377+------
378+
269 ++ lump :: apply patch
379 ++ lump :: apply patch
270 |= [don=udon src=*]
380 |= [don=udon src=*]
271 ^- *
381 ^- *
@@ -287,7 +397,8 @@ Change with `++udon`
287 ==
397 ==
288 ::
398 ::
289
399
290−Use udon to change noun
400+Examples
401+--------
291
402
292 ~zod/try=> (lump [%a %a 20 25] 20)
403 ~zod/try=> (lump [%a %a 20 25] 20)
293 25
404 25
@@ -313,6 +424,21 @@ Use udon to change noun
313
424
314Patch `a`
425Patch `a`
315
426
427+Patch a by references to axis and literal.
428+
429+Accepts
430+-------
431+
432+A cell of a [noun](), `a`, and an [`++upas`](), `b`.
433+
434+Produces
435+--------
436+
437+A noun.
438+
439+Source
440+------
441+
316 ++ lure :: apply tree diff
442 ++ lure :: apply tree diff
317 |= [a=* b=upas]
443 |= [a=* b=upas]
318 ^- *
444 ^- *
@@ -323,7 +449,8 @@ Patch `a`
323 %1 .*(a [1 p.b])
449 %1 .*(a [1 p.b])
324 ==
450 ==
325
451
326−Patch a by references to axis and literal.
452+Examples
453+--------
327
454
328 ~zod/try=> (lure ~[1 2] [[%0 2] [%1 3] [%0 7]])
455 ~zod/try=> (lure ~[1 2] [[%0 2] [%1 3] [%0 7]])
329 [1 3 0]
456 [1 3 0]
@@ -336,6 +463,21 @@ Patch a by references to axis and literal.
336
463
337Reverse patch
464Reverse patch
338
465
466+Reverse a patch (preprocessor unchanged)
467+
468+Accepts
469+-------
470+
471+`don` is an [`++udon`]().
472+
473+Produces
474+--------
475+
476+An `++udon`.
477+
478+Source
479+------
480+
339 ++ limp :: invert patch
481 ++ limp :: invert patch
340 |= don=udon ^- udon
482 |= don=udon ^- udon
341 :- p.don
483 :- p.don
@@ -346,7 +488,8 @@ Reverse patch
346 ==
488 ==
347 ::
489 ::
348
490
349−Reverse a patch (preprocessor unchanged)
491+Examples
492+--------
350
493
351 ~zod/try=> (limp [%a %a 20 40])
494 ~zod/try=> (limp [%a %a 20 40])
352 [p=%a q=[%a p=40 q=20]]
495 [p=%a q=[%a p=40 q=20]]
@@ -361,6 +504,21 @@ Reverse a patch (preprocessor unchanged)
361
504
362Prep for diff
505Prep for diff
363
506
507+Prep atom for diff: leave alone, cue, or split by newlines.
508+
509+Accepts
510+-------
511+
512+A cell of an [`++umph`](), `pum`, and a [noun](), `src`.
513+
514+Produces
515+--------
516+
517+A noun.
518+
519+Source
520+------
521+
364 ++ hump :: general prepatch
522 ++ hump :: general prepatch
365 |= [pum=umph src=*] ^- *
523 |= [pum=umph src=*] ^- *
366 ?+ pum ~|(%unsupported !!)
524 ?+ pum ~|(%unsupported !!)
@@ -370,7 +528,8 @@ Prep for diff
370 ==
528 ==
371 ::
529 ::
372
530
373−Prep atom for diff: leave alone, cue, or split by newlines.
531+Examples
532+--------
374
533
375 ~zod/try=> (hump %a ~)
534 ~zod/try=> (hump %a ~)
376 0
535 0
@@ -391,6 +550,21 @@ Prep atom for diff: leave alone, cue, or split by newlines.
391
550
392Atomize post diff
551Atomize post diff
393
552
553+Re-atomize after diff: leave alone, jam, or join with newlines.
554+
555+Accepts
556+-------
557+
558+A cell of an [`++umph`](), `pum`, and a [noun](), `dst`.
559+
560+Produces
561+--------
562+
563+A noun.
564+
565+Source
566+------
567+
394 ++ husk :: unprepatch
568 ++ husk :: unprepatch
395 |= [pum=umph dst=*] ^- *
569 |= [pum=umph dst=*] ^- *
396 ?+ pum ~|(%unsupported !!)
570 ?+ pum ~|(%unsupported !!)
@@ -400,7 +574,8 @@ Atomize post diff
400 ==
574 ==
401 ::
575 ::
402
576
403−Re-atomize after diff: leave alone, jam, or join with newlines.
577+Examples
578+--------
404
579
405 ~zod/try=> (husk %a 0)
580 ~zod/try=> (husk %a 0)
406 0
581 0
@@ -438,6 +613,23 @@ Re-atomize after diff: leave alone, jam, or join with newlines.
438
613
439Apply list patch
614Apply list patch
440
615
616+Amend list using an urge: [`++list`]() of `[%& {number skipped}]` and
617+`[%| old new]`
618+
619+
620+Accepts
621+-------
622+
623+A cell of a `++list` of [noun]()s, `hel`, and an [`++urge`]() of a noun, `rug`.
624+
625+Produces
626+--------
627+
628+A `++list` of nouns.
629+
630+Source
631+------
632+
441 ++ lurk :: apply list patch
633 ++ lurk :: apply list patch
442 |* [hel=(list) rug=(urge)]
634 |* [hel=(list) rug=(urge)]
443 ^+ hel
635 ^+ hel
@@ -464,8 +656,8 @@ Apply list patch
464 ==
656 ==
465 ::
657 ::
466
658
467−Amend list using an urge: list of `[%& {number skipped}]` and
659+Examples
468−`[%| old new]`
660+--------
469
661
470 ~zod/try=> (lurk "hema" `(urge char)`~[`1 [%| "e" "ru"] `2])
662 ~zod/try=> (lurk "hema" `(urge char)`~[`1 [%| "e" "ru"] `2])
471 "hurma"
663 "hurma"
@@ -478,6 +670,20 @@ Amend list using an urge: list of `[%& {number skipped}]` and
478
670
479`lcs` to list patch
671`lcs` to list patch
480
672
673+Using a common sequence, generate urge from two [`++list`]()s.
674+
675+
676+Accepts
677+-------
678+
679+A cell of three `++list`s of [noun](), `hel`, `hev`, and `lcs`.
680+
681+Produces
682+--------
683+
684+Source
685+------
686+
481 ++ lusk :: lcs to list patch
687 ++ lusk :: lcs to list patch
482 |* [hel=(list) hev=(list) lcs=(list)]
688 |* [hel=(list) hev=(list) lcs=(list)]
483 =+ ^= rag
689 =+ ^= rag
@@ -522,7 +728,8 @@ Amend list using an urge: list of `[%& {number skipped}]` and
522 $(hel t.hel, hev t.hev, rag (done %| [i.hel ~] [i.hev ~]))
728 $(hel t.hel, hev t.hev, rag (done %| [i.hel ~] [i.hev ~]))
523 --
729 --
524
730
525−Using a common sequence, generate urge from two lists
731+Examples
732+--------
526
733
527 ~zod/try=> (lusk "hamok" "hasok" "haok")
734 ~zod/try=> (lusk "hamok" "hasok" "haok")
528 ~[[%.y p=2] [%.n p="m" q="s"] [%.y p=2]]
735 ~[[%.y p=2] [%.n p="m" q="s"] [%.y p=2]]
@@ -539,6 +746,21 @@ Using a common sequence, generate urge from two lists
539
746
540Tree change
747Tree change
541
748
749+Generate tree diff from two nouns.
750+
751+Accepts
752+-------
753+
754+A cell of two nouns, `a` and `b`.
755+
756+Produces
757+--------
758+
759+A cell of two [`++upas`](), `p` and `q`.
760+
761+Source
762+------
763+
542 ++ nude :: tree change
764 ++ nude :: tree change
543 |= [a=* b=*]
765 |= [a=* b=*]
544 ^- [p=upas q=upas]
766 ^- [p=upas q=upas]
@@ -572,7 +794,8 @@ Tree change
572 [%0 u.c]
794 [%0 u.c]
573 --
795 --
574
796
575−Generate tree diff from two nouns.
797+Examples
798+--------
576
799
577 ~zod/try=> (nude 40 20)
800 ~zod/try=> (nude 40 20)
578 [p=[%1 p=20] q=[%1 p=40]]
801 [p=[%1 p=20] q=[%1 p=40]]
docs/dev/hoon/library/3bc.md+174−30
@@ -5,6 +5,22 @@ section 3bC, Gregorian UTC
5
5
6Weekday of Jan 1
6Weekday of Jan 1
7
7
8+Computes which day of the week January 1st falls on for a year `yer`,
9+producing an atom. Weeks are zero-indexed beginning on Sunday.
10+
11+Accepts
12+-------
13+
14+`yer` is an unsigned decimal, [`@ud`]().
15+
16+Produces
17+--------
18+
19+An atom.
20+
21+Source
22+------
23+
8 ++ dawn :: weekday of jan 1
24 ++ dawn :: weekday of jan 1
9 |= yer=@ud
25 |= yer=@ud
10 =+ yet=(sub yer 1)
26 =+ yet=(sub yer 1)
@@ -12,10 +28,8 @@ Weekday of Jan 1
12 :(add 1 (mul 5 (mod yet 4)) (mul 4 (mod yet 100)) (mul 6 (mod yet 400)))
28 :(add 1 (mul 5 (mod yet 4)) (mul 4 (mod yet 100)) (mul 6 (mod yet 400)))
13 ::
29 ::
14
30
15−Computes which day of the week January 1st falls on for a year `yer`,
31+Examples
16−producing an atom. Weeks are zero-indexed beginning on Sunday.
32+--------
17−
18−`yer` is an unsigned decimal, [`@ud`]().
19
33
20 ~zod/try=> (dawn 2.015)
34 ~zod/try=> (dawn 2.015)
21 4
35 4
@@ -27,20 +41,36 @@ producing an atom. Weeks are zero-indexed beginning on Sunday.
27
41
28------------------------------------------------------------------------
42------------------------------------------------------------------------
29
43
44+
45+
30### `++daws`
46### `++daws`
31
47
32Weekday of date
48Weekday of date
33
49
50+Produces the day of the week of a given date `yed` as an atom. Weeks are
51+zero-indexed beginning on Sunday.
52+
53+Accepts
54+-------
55+
56+`yed` is a [`++date`]().
57+
58+Produces
59+--------
60+
61+An atom.
62+
63+Source
64+------
65+
34 ++ daws :: weekday of date
66 ++ daws :: weekday of date
35 |= yed=date
67 |= yed=date
36 %- mod :_ 7
68 %- mod :_ 7
37 (add (dawn y.yed) (sub (yawn [y.yed m.yed d.t.yed]) (yawn y.yed 1 1)))
69 (add (dawn y.yed) (sub (yawn [y.yed m.yed d.t.yed]) (yawn y.yed 1 1)))
38 ::
70 ::
39
71
40−Produces the day of the week of a given date `yed` as an atom. Weeks are
72+Examples
41−zero-indexed beginning on Sunday.
73+--------
42−
43−`yed` is a [`date`]().
44
74
45 ~zod/try=> (daws [[a=%.y y=2.014] m=6 t=[d=6 h=21 m=9 s=15 f=~[0xa16]]])
75 ~zod/try=> (daws [[a=%.y y=2.014] m=6 t=[d=6 h=21 m=9 s=15 f=~[0xa16]]])
46 5
76 5
@@ -55,6 +85,21 @@ zero-indexed beginning on Sunday.
55
85
56Add leap seconds
86Add leap seconds
57
87
88+Produces a [`++date`]() with the 25 leap seconds added.
89+
90+Accepts
91+-------
92+
93+`yer` is an absolute date, [`@da`]().
94+
95+Produces
96+--------
97+
98+A `++date`.
99+
100+Source
101+------
102+
58 ++ deal :: to leap sec time
103 ++ deal :: to leap sec time
59 |= yer=@da
104 |= yer=@da
60 =+ n=0
105 =+ n=0
@@ -69,9 +114,8 @@ Add leap seconds
69 $(n +(n))
114 $(n +(n))
70 ::
115 ::
71
116
72−Produces a [`date`]() with the 25 leap seconds added.
117+Examples
73−
118+--------
74−`yer` is an absolute date, [`@da`]().
75
119
76 ~zod/try=> (yore (bex 127))
120 ~zod/try=> (yore (bex 127))
77 [[a=%.y y=226] m=12 t=[d=5 h=15 m=30 s=8 f=~]]
121 [[a=%.y y=226] m=12 t=[d=5 h=15 m=30 s=8 f=~]]
@@ -86,6 +130,22 @@ Produces a [`date`]() with the 25 leap seconds added.
86
130
87Subtract leap seconds
131Subtract leap seconds
88
132
133+Produces an absolute date ([`@ud`]()) with the 25 leap seconds
134+subtracted.
135+
136+Accepts
137+-------
138+
139+`ley` is a [`++date`]().
140+
141+Produces
142+--------
143+
144+An atom of [odor]() [`@da`](), which represents an absolute date.
145+
146+Source
147+------
148+
89 ++ lead :: from leap sec time
149 ++ lead :: from leap sec time
90 |= ley=date
150 |= ley=date
91 =+ ler=(year ley)
151 =+ ler=(year ley)
@@ -103,10 +163,8 @@ Subtract leap seconds
103 $(n +(n))
163 $(n +(n))
104 ::
164 ::
105
165
106−Produces an absolute date ([`@ud`]()) with the 25 leap seconds
166+Examples
107−subtracted.
167+--------
108−
109−`ley` is a [`date`]().
110
168
111 ~zod/try=> (yore `@da`(bex 127))
169 ~zod/try=> (yore `@da`(bex 127))
112 [[a=%.y y=226] m=12 t=[d=5 h=15 m=30 s=8 f=~]]
170 [[a=%.y y=226] m=12 t=[d=5 h=15 m=30 s=8 f=~]]
@@ -121,6 +179,21 @@ subtracted.
121
179
122Print UTC format
180Print UTC format
123
181
182+Produces a [`++tape`]() of the date in UTC format.
183+
184+Accepts
185+-------
186+
187+`yed` is a [`++date`]().
188+
189+Produces
190+--------
191+
192+A `++tape`.
193+
194+Source
195+------
196+
124 ++ dust :: print UTC format
197 ++ dust :: print UTC format
125 |= yed=date
198 |= yed=date
126 ^- tape
199 ^- tape
@@ -135,9 +208,8 @@ Print UTC format
135 ==
208 ==
136 ::
209 ::
137
210
138−Produces a [tape]() of the date in UTC format.
211+Examples
139−
212+--------
140−`yed` is a [`date`]().
141
213
142 ~zod/try=> (dust (yore ->-))
214 ~zod/try=> (dust (yore ->-))
143 "Tue, 21 Oct 2014 21:35:12 +0000"
215 "Tue, 21 Oct 2014 21:35:12 +0000"
@@ -150,6 +222,22 @@ Produces a [tape]() of the date in UTC format.
150
222
151Parse UTC format
223Parse UTC format
152
224
225+Accepts a [`++tape`]() containing a date in UTC format and produces the
226+[`++unit`]() of a [`++date`]().
227+
228+Accepts
229+-------
230+
231+`cud` is a `++tape`.
232+
233+Produces
234+--------
235+
236+The `++unit` of a `++date`.
237+
238+Source
239+------
240+
153 ++ stud :: parse UTC format
241 ++ stud :: parse UTC format
154 |= cud=tape
242 |= cud=tape
155 ^- (unit date)
243 ^- (unit date)
@@ -177,8 +265,8 @@ Parse UTC format
177 ==
265 ==
178 ::
266 ::
179
267
180−Accepts a [tape]() containing a date in UTC format and produces the
268+Examples
181−[unit]() of a [`date`]().
269+--------
182
270
183 ~zod/try=> (stud "Tue, 21 Oct 2014 21:21:55 +0000")
271 ~zod/try=> (stud "Tue, 21 Oct 2014 21:21:55 +0000")
184 [~ [[a=%.y y=2.014] m=10 t=[d=21 h=21 m=21 s=55 f=~]]]
272 [~ [[a=%.y y=2.014] m=10 t=[d=21 h=21 m=21 s=55 f=~]]]
@@ -193,11 +281,29 @@ Accepts a [tape]() containing a date in UTC format and produces the
193
281
194UGT to UTC time
282UGT to UTC time
195
283
284+Transforms Urbit Galactic Time to UTC time, producing an atom.
285+
286+Accepts
287+-------
288+
289+An atom of [odor]() [`@da`](), representing an absolute date.
290+
291+Produces
292+--------
293+
294+An atom.
295+
296+Source
297+------
298+
196 ++ unt :: UGT to UTC time
299 ++ unt :: UGT to UTC time
197 |= a=@da
300 |= a=@da
198 (div (sub a ~1970.1.1) (bex 64))
301 (div (sub a ~1970.1.1) (bex 64))
199 ::
302 ::
200
303
304+Examples
305+--------
306+
201 ~zod/try=/hom> (unt -<-)
307 ~zod/try=/hom> (unt -<-)
202 1.413.927.704
308 1.413.927.704
203 ~zod/try=> (unt ~20014.1.1)
309 ~zod/try=> (unt ~20014.1.1)
@@ -205,16 +311,15 @@ UGT to UTC time
205 ~zod/try=> (unt ~2014.1.1)
311 ~zod/try=> (unt ~2014.1.1)
206 1.388.534.400
312 1.388.534.400
207
313
208−Transforms Urbit Galactic Time to UTC time, producing an atom.
209−
210−`a` is an [atom]().
211−
212------------------------------------------------------------------------
314------------------------------------------------------------------------
213
315
214### `++yu`
316### `++yu`
215
317
216UTC format constants
318UTC format constants
217
319
320+Source
321+------
322+
218 ++ yu :: UTC format constants
323 ++ yu :: UTC format constants
219 |%
324 |%
220
325
@@ -227,13 +332,24 @@ UTC format constants
227
332
228Months
333Months
229
334
335+Produces a list of [`++tapes`]() containing the 12 months of the year.
336+
337+Produces
338+--------
339+
340+A `++list` of `++tape`s.
341+
342+Source
343+------
344+
230 ++ mon ^- (list tape)
345 ++ mon ^- (list tape)
231 :~ "January" "February" "March" "April" "May" "June" "July"
346 :~ "January" "February" "March" "April" "May" "June" "July"
232 "August" "September" "October" "November" "December"
347 "August" "September" "October" "November" "December"
233 ==
348 ==
234 ::
349 ::
235
350
236−Produces a list of [tapes]() containing the 12 months of the year.
351+Examples
352+--------
237
353
238 ~zod/try=/hom> mon:yu
354 ~zod/try=/hom> mon:yu
239 <<
355 <<
@@ -259,14 +375,20 @@ Produces a list of [tapes]() containing the 12 months of the year.
259
375
260Weeks
376Weeks
261
377
378+Produces a list of [tapes]() containing the 7 days of the week,
379+beginning with Sunday.
380+
381+Source
382+------
383+
262 ++ wik ^- (list tape)
384 ++ wik ^- (list tape)
263 :~ "Sunday" "Monday" "Tuesday" "Wednesday" "Thursday"
385 :~ "Sunday" "Monday" "Tuesday" "Wednesday" "Thursday"
264 "Friday" "Saturday"
386 "Friday" "Saturday"
265 ==
387 ==
266 ::
388 ::
267
389
268−Produces a list of [tapes]() containing the 7 days of the week,
390+Examples
269−beginning with Sunday.
391+--------
270
392
271 ~zod/try=/hom> wik:yu
393 ~zod/try=/hom> wik:yu
272 <<"Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday">>
394 <<"Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday">>
@@ -281,6 +403,16 @@ beginning with Sunday.
281
403
282Leap second dates
404Leap second dates
283
405
406+Produces a [`++list`]() of the (absolute) dates ([`@da`]) of the 25 leap seconds.
407+
408+Produces
409+--------
410+
411+A `++list` of atoms of odor `@da`.
412+
413+Source
414+------
415+
284 ++ les ^- (list ,@da)
416 ++ les ^- (list ,@da)
285 :~ ~2015.7.1 ~2012.7.1 ~2009.1.1 ~2006.1.1 ~1999.1.1 ~1997.7.1
417 :~ ~2015.7.1 ~2012.7.1 ~2009.1.1 ~2006.1.1 ~1999.1.1 ~1997.7.1
286 ~1996.1.1 ~1994.7.1 ~1993.7.1 ~1992.7.1 ~1991.1.1 ~1990.1.1
418 ~1996.1.1 ~1994.7.1 ~1993.7.1 ~1992.7.1 ~1991.1.1 ~1990.1.1
@@ -289,7 +421,8 @@ Leap second dates
289 ~1973.1.1 ~1972.7.1
421 ~1973.1.1 ~1972.7.1
290 ==
422 ==
291
423
292−Produces a list of the (absolute) dates ([`@da`]) of the 25 leap seconds
424+Examples
425+--------
293
426
294 ~zod/try=/hom> les:yu
427 ~zod/try=/hom> les:yu
295 ~[
428 ~[
@@ -329,6 +462,17 @@ Produces a list of the (absolute) dates ([`@da`]) of the 25 leap seconds
329
462
330Back-shifted leap second dates
463Back-shifted leap second dates
331
464
465+Produces a [`++list`]() of absolute dates ([`@da`]()s) that represent the Urbit
466+Galactc Time equivalents of the UTC leap second dates in [`++les`](/doc/hoon/library/3bc#++les).
467+
468+Produces
469+--------
470+
471+A `++list` of atoms of odor `@da`.
472+
473+Source
474+------
475+
332 ++ lef ^- (list ,@da)
476 ++ lef ^- (list ,@da)
333 :~ ~2015.6.30..23.59.59 ~2012.6.30..23.59.59
477 :~ ~2015.6.30..23.59.59 ~2012.6.30..23.59.59
334 ~2008.12.31..23.59.58 ~2005.12.31..23.59.57
478 ~2008.12.31..23.59.58 ~2005.12.31..23.59.57
@@ -346,8 +490,8 @@ Back-shifted leap second dates
346 ==
490 ==
347 ::
491 ::
348
492
349−Produces a list of absolute dates ([`@da`]()) that represent the Urbit
493+Examples
350−Galactc Time equivalents of the UTC leap second dates in [`++les`](/doc/hoon/library/3bc#++les).
494+--------
351
495
352 ~zod/try=/hom> lef:yu
496 ~zod/try=/hom> lef:yu
353 ~[
497 ~[
docs/dev/hoon/library/3bd.md+1384−269
@@ -5,6 +5,21 @@ section 3bD, JSON and XML
5
5
6Mime type to `++cord`
6Mime type to `++cord`
7
7
8+Renders a [mime](http://en.wikipedia.org/wiki/MIME) type path with infix
9+`/` to a [`++cord`]().
10+Accepts
11+-------
12+
13+`myn` is a ++[`mite`](), a [`++list`]() of [`@ta`]().
14+
15+Produces
16+--------
17+
18+A `++cord`.
19+
20+Source
21+------
22+
8 ++ moon :: mime type to text
23 ++ moon :: mime type to text
9 |= myn=mite
24 |= myn=mite
10 %+ rap
25 %+ rap
@@ -15,10 +30,8 @@ Mime type to `++cord`
15 (weld (trip i.myn) `tape`['/' $(myn t.myn)])
30 (weld (trip i.myn) `tape`['/' $(myn t.myn)])
16 ::
31 ::
17
32
18−Renders a [mime](http://en.wikipedia.org/wiki/MIME) type path with infix
33+Examples
19−`/` to a [cord]().
34+--------
20−
21−`myn` is a ++[mite](), a list of [@ta]().
22
35
23 ~zod/try=> `@t`(moon /image/png)
36 ~zod/try=> `@t`(moon /image/png)
24 'image/png'
37 'image/png'
@@ -31,29 +44,43 @@ Renders a [mime](http://en.wikipedia.org/wiki/MIME) type path with infix
31
44
32Parse cube with fork
45Parse cube with fork
33
46
34− ++ perk :: parse cube with fork
35− |* a=(pole ,@tas)
36− ?~ a fail
37− ;~ pose
38− (cold -.a (jest -.a))
39− $(a +.a)
40− ==
41− ::
42−
43Parser generator. Produces a parser that succeeds upon encountering one
47Parser generator. Produces a parser that succeeds upon encountering one
44of the [`++term`]()s in a faceless list `a`.
48of the [`++term`]()s in a faceless list `a`.
45
49
46−A- perk is an arm used to parse one of a finite set of options, formally
50+A perk is an arm used to parse one of a finite set of options, formally
47−a choice between terms: if you want to match "true" or "false", and
51+a choice between [`++term`]()s: if you want to match "true" or "false", and
48nothing else, (perk \~[%true %false]) produces the relevant parser,
52nothing else, (perk \~[%true %false]) produces the relevant parser,
49whose result type is `?(%true %false)`. For more complicated
53whose result type is `?(%true %false)`. For more complicated
50−transformations, a combintation of ++sear and map ++get is recommended,
54+transformations, a combintation of ++[`++sear`]() and map ++[`++get`]() is recommended,
51e.g. `(sear ~(get by (mo ~[[%true &] [%false |]]))) sym)` will have a
55e.g. `(sear ~(get by (mo ~[[%true &] [%false |]]))) sym)` will have a
52−similar effect but produce `?(& |)` ,a loobean. However, constructions
56+similar effect but produce `?(& |)` , a [boolean](). However, constructions
53such as `(sear (flit ~(has in (sa %true %false %other ~))) sym)` are
57such as `(sear (flit ~(has in (sa %true %false %other ~))) sym)` are
54needlessly unwieldy.
58needlessly unwieldy.
55
59
60+Accepts
61+-------
62+
56−`a` is a [`++pole`](), which is a [`++list`]() without [`%face`]()s
63+`a` is a [`++pole`](), which is a [`++list`]() without [`%face`]()s.
64+
65+Produces
66+--------
67+
68+XX
69+
70+Source
71+------
72+
73+ ++ perk :: parse cube with fork
74+ |* a=(pole ,@tas)
75+ ?~ a fail
76+ ;~ pose
77+ (cold -.a (jest -.a))
78+ $(a +.a)
79+ ==
80+ ::
81+
82+Examples
83+--------
57
84
58 ~zod/try=> (scan "ham" (perk %sam %ham %lam ~))
85 ~zod/try=> (scan "ham" (perk %sam %ham %lam ~))
59 %ham
86 %ham
@@ -65,14 +92,29 @@ needlessly unwieldy.
65
92
66JSON parser core
93JSON parser core
67
94
95+JSON parser core: parses a [`++cord`]() `a` to the hoon structure for JSON,
96+a [`++json`]().
97+
98+Accepts
99+-------
100+
101+`a` is [`++cord`]().
102+
103+Produces
104+--------
105+
106+
107+A `(like json)`.
108+
109+Source
110+------
111+
68 ++ poja :: JSON parser core
112 ++ poja :: JSON parser core
69 =< |=(a=cord (rush a apex))
113 =< |=(a=cord (rush a apex))
70 |%
114 |%
71
115
72−JSON parser core: parses a `++cord` `a` to the hoon structure for JSON,
116+Examples
73−a [`++json`]().
117+--------
74−
75−`a` is [`++cord`]().
76
118
77 ~zod/try=> (poja '[1,2,3]')
119 ~zod/try=> (poja '[1,2,3]')
78 [~ [%a p=~[[%n p=~.1] [%n p=~.2] [%n p=~.3]]]]
120 [~ [%a p=~[[%n p=~.1] [%n p=~.2] [%n p=~.3]]]]
@@ -81,19 +123,30 @@ a [`++json`]().
81 ~zod/try=> (poja 'invalid{json')
123 ~zod/try=> (poja 'invalid{json')
82 ~
124 ~
83
125
84−### `++apex`
126+### `++tops`
85
127
86Parse object
128Parse object
87
129
88− ++ apex ;~(pose abox obox) :: JSON object
89−
90−Top level parsing rule. Parses either a single JSON object, or an array
130+Top level parsing [`++rule`](). Parses either a single JSON object, or an array
91of JSON objects to a [`++json`](). See also: [`++abox`](), [`++obox`]().
131of JSON objects to a [`++json`](). See also: [`++abox`](), [`++obox`]().
92
132
93−A- this is now called ++tops, and ++apex is the old ++valu, which
133+Accepts
94−apparently didn't make its way into the docs. Apologies for the
134+-------
95−confusion, many things have been restructured in ++shell inconsistently
135+
96−with current test:urbit.git
136+A [`++nail`]().
137+
138+Produces
139+--------
140+
141+A `(like json)`.
142+
143+Source
144+------
145+
146+ ++ apex ;~(pose abox obox) :: JSON object
147+
148+Examples
149+--------
97
150
98 ~zod/try=> (rash '[1,2]' apex:poja)
151 ~zod/try=> (rash '[1,2]' apex:poja)
99 [%a p=~[[%n p=~.1] [%n p=~.2]]]
152 [%a p=~[[%n p=~.1] [%n p=~.2]]]
@@ -103,10 +156,25 @@ with current test:urbit.git
103 ! {1 1}
156 ! {1 1}
104 ! exit
157 ! exit
105
158
106−### `++valu`
159+### `++apex`
107
160
108Parse value
161Parse value
109
162
163+Parsing [`++rule`](). Parses JSON values to [`++json`]().
164+
165+Accepts
166+-------
167+
168+A [`++nail`]().
169+
170+Produces
171+--------
172+
173+A `(like json)`.
174+
175+Source
176+------
177+
110 ++ valu :: JSON value
178 ++ valu :: JSON value
111 %+ knee *json |. ~+
179 %+ knee *json |. ~+
112 ;~ pfix spac
180 ;~ pfix spac
@@ -120,7 +188,8 @@ Parse value
120 ==
188 ==
121 ==
189 ==
122
190
123−Parsing rule. Parses JSON values to [`++json`]().
191+Examples
192+--------
124
193
125 ~zod/try=> (rash '[1,2]' valu:poja)
194 ~zod/try=> (rash '[1,2]' valu:poja)
126 [%a p=~[[%n p=~.1] [%n p=~.2]]]
195 [%a p=~[[%n p=~.1] [%n p=~.2]]]
@@ -139,11 +208,27 @@ Parsing rule. Parses JSON values to [`++json`]().
139
208
140Parse array
209Parse array
141
210
142− ++ abox (stag %a (ifix [sel (ws ser)] (more (ws com) valu)))
143−
144Parsing rule. Parses a JSON array with values enclosed within `[]` and
211Parsing rule. Parses a JSON array with values enclosed within `[]` and
145delimited by a `,`.
212delimited by a `,`.
146
213
214+Accepts
215+-------
216+
217+A [`++nail`]().
218+
219+Produces
220+--------
221+
222+A `(like json)`.
223+
224+Source
225+------
226+
227+ ++ abox (stag %a (ifix [sel (ws ser)] (more (ws com) valu)))
228+
229+Examples
230+--------
231+
147 ~zod/try=> (rash '[1, 2,4]' abox:poja)
232 ~zod/try=> (rash '[1, 2,4]' abox:poja)
148 [[%n p=~.1] ~[[%n p=~.2] [%n p=~.4]]]
233 [[%n p=~.1] ~[[%n p=~.2] [%n p=~.4]]]
149
234
@@ -154,11 +239,27 @@ JSON Objects
154
239
155Parse key value pair
240Parse key value pair
156
241
157− ++ pair ;~(plug ;~(sfix (ws stri) (ws col)) valu)
158−
159Parsing rule. Parses a [`++json`]() from a JSON key-value pair of a
242Parsing rule. Parses a [`++json`]() from a JSON key-value pair of a
160string and value delimited by `:`.
243string and value delimited by `:`.
161
244
245+Accepts
246+-------
247+
248+A [`++nail`]().
249+
250+Produces
251+--------
252+
253+A `(like json)`.
254+
255+Source
256+------
257+
258+ ++ pair ;~(plug ;~(sfix (ws stri) (ws col)) valu)
259+
260+Examples
261+--------
262+
162 ~zod/try=> (rash '"ham": 2' pair:poja)
263 ~zod/try=> (rash '"ham": 2' pair:poja)
163 ['ham' [%n p=~.2]]
264 ['ham' [%n p=~.2]]
164
265
@@ -166,11 +267,27 @@ string and value delimited by `:`.
166
267
167Parse array of objects
268Parse array of objects
168
269
169− ++ obje (ifix [(ws kel) (ws ker)] (more (ws com) pair))
170−
171Parsing rule. Parses a [`++json`]() from an array of JSON object
270Parsing rule. Parses a [`++json`]() from an array of JSON object
172key-value pairs that are enclosed within `{}` and separated by `,`.
271key-value pairs that are enclosed within `{}` and separated by `,`.
173
272
273+Accepts
274+-------
275+
276+A [`++nail`]().
277+
278+Produces
279+--------
280+
281+A `(like ,[%o p=(map ,@t json)])`
282+
283+Source
284+------
285+
286+ ++ obje (ifix [(ws kel) (ws ker)] (more (ws com) pair))
287+
288+Examples
289+--------
290+
174 ~zod/try=> (rash '{"ham": 2, "lam":true}' obje:poja)
291 ~zod/try=> (rash '{"ham": 2, "lam":true}' obje:poja)
175 [['ham' [%n p=~.2]] ~[['lam' [%b p=%.y]]]]
292 [['ham' [%n p=~.2]] ~[['lam' [%b p=%.y]]]]
176
293
@@ -178,10 +295,25 @@ key-value pairs that are enclosed within `{}` and separated by `,`.
178
295
179Parse boxed object
296Parse boxed object
180
297
298+Parsing rule. Parses an array of JSON objects to an object of [`++json`](). See also: [`++json`]().
299+
300+Accepts
301+-------
302+
303+A [`++nail`]().
304+
305+Produces
306+--------
307+
308+A `(like ,[%o p=(map ,@t json)])`
309+
310+Source
311+------
312+
181 ++ obox (stag %o (cook mo obje))
313 ++ obox (stag %o (cook mo obje))
182
314
183−Parsing rule. Parses an array of JSON objects to a [`++json`]() map with
315+Examples
184−a tag of `%o`. See also: [`++json`]().
316+--------
185
317
186 ~zod/try=> (rash '{"ham": 2, "lam":true}' obox:poja)
318 ~zod/try=> (rash '{"ham": 2, "lam":true}' obox:poja)
187 [%o {[p='lam' q=[%b p=%.y]] [p='ham' q=[%n p=~.2]]}]
319 [%o {[p='lam' q=[%b p=%.y]] [p='ham' q=[%n p=~.2]]}]
@@ -193,11 +325,29 @@ JSON Booleans
193
325
194Parse boolean
326Parse boolean
195
327
196− ++ bool ;~(pose (cold & (jest 'true')) (cold | (jest 'false')))
197−
198Parsing rule. Parses a string of either `true` or `false` to a
328Parsing rule. Parses a string of either `true` or `false` to a
199[`++json`]() boolean.
329[`++json`]() boolean.
200
330
331+
332+Accepts
333+-------
334+
335+A [`++nail`]().
336+
337+Produces
338+--------
339+
340+
341+A `(like ,[%b p=?])`
342+
343+Source
344+------
345+
346+ ++ bool ;~(pose (cold & (jest 'true')) (cold | (jest 'false')))
347+
348+Examples
349+--------
350+
201 ~zod/try=> (rash 'true' bool:poja)
351 ~zod/try=> (rash 'true' bool:poja)
202 %.y
352 %.y
203 ~zod/try=> (rash 'false' bool:poja)
353 ~zod/try=> (rash 'false' bool:poja)
@@ -213,13 +363,29 @@ JSON strings
213
363
214Parse string
364Parse string
215
365
216− ++ stri
217− (cook crip (ifix [doq doq] (star jcha)))
218−
219Parsing rule. Parse a string to a [`++cord`](). A JSON string is a list
366Parsing rule. Parse a string to a [`++cord`](). A JSON string is a list
220of characters enclosed in double quotes along with escaping `\`s, to a
367of characters enclosed in double quotes along with escaping `\`s, to a
221[`++cord`](). See also [`++jcha`]().
368[`++cord`](). See also [`++jcha`]().
222
369
370+Accepts
371+-------
372+
373+A [`++nail`]().
374+
375+Produces
376+--------
377+
378+A `(like ,[%s p=@t])`.
379+
380+Source
381+------
382+
383+ ++ stri
384+ (cook crip (ifix [doq doq] (star jcha)))
385+
386+Examples
387+--------
388+
223 ~zod/try=> (rash '"ham"' stri:poja)
389 ~zod/try=> (rash '"ham"' stri:poja)
224 'ham'
390 'ham'
225 ~zod/try=> (rash '"h\\nam"' stri:poja)
391 ~zod/try=> (rash '"h\\nam"' stri:poja)
@@ -232,11 +398,28 @@ of characters enclosed in double quotes along with escaping `\`s, to a
232
398
233Parse char from string
399Parse char from string
234
400
235− ++ jcha ;~(pose ;~(less doq bas prn) esca) :: character in string
236−
237Parsing rule. Parses either a literal or escaped character from a JSON
401Parsing rule. Parses either a literal or escaped character from a JSON
238string to a [`++cord`]().
402string to a [`++cord`]().
239
403
404+
405+Accepts
406+-------
407+
408+A [`++nail`]().
409+
410+Produces
411+--------
412+
413+A `(like cord)`.
414+
415+Source
416+------
417+
418+ ++ jcha ;~(pose ;~(less doq bas prn) esca) :: character in string
419+
420+Examples
421+--------
422+
240 ~zod/try=> (rash 'a' jcha:poja)
423 ~zod/try=> (rash 'a' jcha:poja)
241 'a'.
424 'a'.
242 ~zod/try=> (rash '!' jcha:poja)
425 ~zod/try=> (rash '!' jcha:poja)
@@ -253,6 +436,23 @@ string to a [`++cord`]().
253
436
254Parse escaped char
437Parse escaped char
255
438
439+Parsing rule. Parses a backslash-escaped special character, low ASCII,
440+or UTF16 codepoint, to a [`++cord`]().
441+
442+
443+Accepts
444+-------
445+
446+A [`++nail`]().
447+
448+Produces
449+--------
450+
451+A `(like cord)`.
452+
453+Source
454+------
455+
256 ++ esca :: Escaped character
456 ++ esca :: Escaped character
257 ;~ pfix bas
457 ;~ pfix bas
258 ;~ pose
458 ;~ pose
@@ -261,8 +461,8 @@ Parse escaped char
261 ;~(pfix (just 'u') (cook tuft qix:ab)) :: 4-digit hex to UTF-8
461 ;~(pfix (just 'u') (cook tuft qix:ab)) :: 4-digit hex to UTF-8
262 ==
462 ==
263
463
264−Parsing rule. Parses a backslash-escaped special character, low ASCII,
464+Examples
265−or UTF16 codepoint, to a [`++cord`]().
465+--------
266
466
267 ~zod/try=> (rash 'b' esca:poja)
467 ~zod/try=> (rash 'b' esca:poja)
268 ! {1 1}
468 ! {1 1}
@@ -282,7 +482,7 @@ or UTF16 codepoint, to a [`++cord`]().
282JSON numbers
482JSON numbers
283------------
483------------
284
484
285−A- JSON numbers are stored as cords internally in lieu of full float
485+A JSON numbers are stored as cords internally in lieu of full float
286support, so ++numb and subarms are really more *validators* than parsers
486support, so ++numb and subarms are really more *validators* than parsers
287per se.
487per se.
288
488
@@ -290,6 +490,22 @@ per se.
290
490
291Parse number
491Parse number
292
492
493+Parsing rule. Parses decimal numbers with an optional `-`, fractional
494+part, or exponent part, to a [`++tape`]().
495+
496+Accepts
497+-------
498+
499+A [`++nail`]().
500+
501+Produces
502+--------
503+
504+An [`++edge`]() of a [`++tape`]().
505+
506+Source
507+------
508+
293 ++ numb
509 ++ numb
294 ;~ (comp twel)
510 ;~ (comp twel)
295 (mayb (piec hep))
511 (mayb (piec hep))
@@ -301,8 +517,8 @@ Parse number
301 (mayb expo)
517 (mayb expo)
302 ==
518 ==
303
519
304−Parsing rule. Parses decimal numbers with an optional `-`, fractional
520+Examples
305−part, or exponent part, to a [`++cord`]().
521+--------
306
522
307 ~zod/try=> (rash '0' numb:poja)
523 ~zod/try=> (rash '0' numb:poja)
308 ~[~~0]
524 ~[~~0]
@@ -322,9 +538,25 @@ part, or exponent part, to a [`++cord`]().
322
538
323Parse 1-9
539Parse 1-9
324
540
541+Parsing rule. Parses digits `0` through `9` to a [`++tape`]().
542+
543+Accepts
544+-------
545+
546+A [`++nail`]().
547+
548+Produces
549+--------
550+
551+The [`++edge`]() of a `++tape`.
552+
553+Source
554+------
555+
325 ++ digs (star (shim '0' '9'))
556 ++ digs (star (shim '0' '9'))
326
557
327−Parsing rule. Parses digits `0` through `9` to a [`++tape`]().
558+Examples
559+--------
328
560
329 ~zod/try=> (rash '' digs:poja)
561 ~zod/try=> (rash '' digs:poja)
330 ""
562 ""
@@ -339,6 +571,22 @@ Parsing rule. Parses digits `0` through `9` to a [`++tape`]().
339
571
340Parse exponent part
572Parse exponent part
341
573
574+Parsing rule. Parses an exponent to a [`++tape`]() .An exponent is an
575+`e` or 'E', followed by an optional `+` or `-`, and then by digits.
576+
577+Accepts
578+-------
579+
580+A [`++nail`]().
581+
582+Produces
583+--------
584+
585+The [`++edge`]() of a `++tape`.
586+
587+Source
588+------
589+
342 ++ expo :: Exponent part
590 ++ expo :: Exponent part
343 ;~ (comp twel)
591 ;~ (comp twel)
344 (piec (mask "eE"))
592 (piec (mask "eE"))
@@ -346,8 +594,8 @@ Parse exponent part
346 digs
594 digs
347 ==
595 ==
348
596
349−Parsing rule. Parses an exponent to a [`++cord`](). An exponent is an
597+Examples
350−`e`, followed by an optional `+` or `-`, followed by digits.
598+--------
351
599
352 ~zod/try=> `tape`(rash 'e7' expo:poja)
600 ~zod/try=> `tape`(rash 'e7' expo:poja)
353 "e7"
601 "e7"
@@ -360,9 +608,25 @@ Parsing rule. Parses an exponent to a [`++cord`](). An exponent is an
360
608
361Fractional part
609Fractional part
362
610
611+Parsing rule. Parses a dot followed by digits to a [`++cord`]().
612+
613+Accepts
614+-------
615+
616+A `++nail`.
617+
618+Produces
619+--------
620+
621+The [`++edge`]() of a `++tape`.
622+
623+Source
624+------
625+
363 ++ frac ;~(plug dot digs) :: Fractional part
626 ++ frac ;~(plug dot digs) :: Fractional part
364
627
365−Parsing rule. Parses a dot followed by digits to a [`++cord`]().
628+Examples
629+--------
366
630
367 ~zod/try=> (rash '.25' frac:poja)
631 ~zod/try=> (rash '.25' frac:poja)
368 [~~~. "25"]
632 [~~~. "25"]
@@ -378,9 +642,25 @@ whitespace
378
642
379Parse whitespace
643Parse whitespace
380
644
645+Parsing rule. Parses a whitespace to a [`++tape`]().
646+
647+Accepts
648+-------
649+
650+A [`++nail`]().
651+
652+Produces
653+--------
654+
655+A `(like tape)`.
656+
657+Source
658+------
659+
381 ++ spac (star (mask [`@`9 `@`10 `@`13 ' ' ~]))
660 ++ spac (star (mask [`@`9 `@`10 `@`13 ' ' ~]))
382
661
383−Parsing rule. Parses a whitespace to a [`++tape`]().
662+Examples
663+--------
384
664
385 ~zod/try=> (scan "" spac:poja)
665 ~zod/try=> (scan "" spac:poja)
386 ""
666 ""
@@ -396,13 +676,27 @@ Parsing rule. Parses a whitespace to a [`++tape`]().
396
676
397Allow prefix whitespace
677Allow prefix whitespace
398
678
399− ++ ws |*(sef=_rule ;~(pfix spac sef))
400−
401Parser modifier. Produces a rule that allows for a whitespace before
679Parser modifier. Produces a rule that allows for a whitespace before
402applying `sef`.
680applying `sef`.
403
681
682+Accepts
683+-------
684+
404`sef` is a [`++rule`]().
685`sef` is a [`++rule`]().
405
686
687+Produces
688+--------
689+
690+A `++rule`.
691+
692+Source
693+------
694+
695+ ++ ws |*(sef=_rule ;~(pfix spac sef))
696+
697+Examples
698+--------
699+
406 ~zod/try=> (rash ' 4' digs:poja)
700 ~zod/try=> (rash ' 4' digs:poja)
407 ! {1 1}
701 ! {1 1}
408 ! exit
702 ! exit
@@ -421,9 +715,25 @@ Plumbing
421
715
422Maybe parse
716Maybe parse
423
717
718+Parser modifier. Need to document, an example showing failure.
719+
720+Accepts
721+-------
722+
723+XX
724+
725+Produces
726+--------
727+
728+XX
729+
730+Source
731+------
732+
424 ++ mayb |*(bus=_rule ;~(pose bus (easy "")))
733 ++ mayb |*(bus=_rule ;~(pose bus (easy "")))
425
734
426−Parser modifier. Need to document, an example showing failure.
735+Examples
736+--------
427
737
428 ~zod/try=> (abox:poja 1^1 "not-an-array")
738 ~zod/try=> (abox:poja 1^1 "not-an-array")
429 [p=[p=1 q=1] q=~]
739 [p=[p=1 q=1] q=~]
@@ -434,14 +744,28 @@ Parser modifier. Need to document, an example showing failure.
434
744
435Weld two tapes
745Weld two tapes
436
746
437− ++ twel |=([a=tape b=tape] (weld a b))
747+Concatenates two tapes, `a` and `b`, producing a [`++tape`]().
438
748
439−Concatenates two tapes, `a` and `b`, producing a `++tape`.
749+Accepts
750+-------
440
751
441`a` is a [`++tape`]().
752`a` is a [`++tape`]().
442
753
443`b` is a [`++tape`]().
754`b` is a [`++tape`]().
444
755
756+Produces
757+--------
758+
759+The [`++edge`]() of a `++tape`.
760+
761+Source
762+------
763+
764+ ++ twel |=([a=tape b=tape] (weld a b))
765+
766+Examples
767+--------
768+
445 ~zod/try=> (twel "sam" "hok"):poja
769 ~zod/try=> (twel "sam" "hok"):poja
446 ~[~~s ~~a ~~m ~~h ~~o ~~k]
770 ~[~~s ~~a ~~m ~~h ~~o ~~k]
447 ~zod/try=> (twel "kre" ""):poja
771 ~zod/try=> (twel "kre" ""):poja
@@ -451,23 +775,52 @@ Concatenates two tapes, `a` and `b`, producing a `++tape`.
451
775
452Parse char to list
776Parse char to list
453
777
778+Parser modifer. Parses an atom with `bus` and then wraps it in a
779+[`++list`]().
780+
781+Accepts
782+-------
783+
784+`bus` is a [`++rule`]().
785+
786+Produces
787+--------
788+
789+A `++rule`.
790+
791+Source
792+------
793+
454 ++ piec
794 ++ piec
455 |* bus=_rule
795 |* bus=_rule
456 (cook |=(a=@ [a ~]) bus)
796 (cook |=(a=@ [a ~]) bus)
457 ::
797 ::
458
798
459−Parser modifer. Parses an atom with `bus` and then wraps it in a
799+Examples
460−[`++list`]().
800+--------
461−
462−`bus` is a [`++rule`]().
463
801
464− ~zod/try=> (scan "4" (piec:poja dem:ag))
802+ d~zod/try=> (scan "4" (piec:poja dem:ag))
465 [4 ~]
803 [4 ~]
466
804
467### `++pojo`
805### `++pojo`
468
806
469Print JSON
807Print JSON
470
808
809+Renders a [`++json`]() `val` as a [`++tape`]().
810+
811+Accepts
812+-------
813+
814+`val` is a [`json`]().
815+
816+Produces
817+--------
818+
819+A `++tape`.
820+
821+Source
822+------
823+
471 ++ pojo :: print json
824 ++ pojo :: print json
472 |= val=json
825 |= val=json
473 ^- tape
826 ^- tape
@@ -510,9 +863,8 @@ Print JSON
510 ==
863 ==
511 ::
864 ::
512
865
513−Renders a `++json` `val` as a [`++tape`]().
866+Examples
514−
867+--------
515−`val` is a [`json`]().
516
868
517 ~zod/try=> (pojo [%n '12.6'])
869 ~zod/try=> (pojo [%n '12.6'])
518 "12.6"
870 "12.6"
@@ -531,13 +883,27 @@ Renders a `++json` `val` as a [`++tape`]().
531
883
532Print XML
884Print XML
533
885
886+Renders a `++manx` `a` as a [`++tape`]().
887+
888+Accepts
889+-------
890+
891+`a` is a [`++manx`]().
892+
893+Produces
894+--------
895+
896+A `++tape`.
897+
898+Source
899+------
900+
534 ++ poxo :: node to tape
901 ++ poxo :: node to tape
535 =< |=(a=manx `tape`(apex a ~))
902 =< |=(a=manx `tape`(apex a ~))
536 |_ unq=? :: unq
903 |_ unq=? :: unq
537
904
538−Renders a `++manx` `a` as a [`++tape`]().
905+Examples
539−
906+--------
540−`a` is a [`++manx`]().
541
907
542 ~zod/try=> (poxo ;div;)
908 ~zod/try=> (poxo ;div;)
543 "<div></div>"
909 "<div></div>"
@@ -550,6 +916,23 @@ Renders a `++manx` `a` as a [`++tape`]().
550
916
551Inner XML printer
917Inner XML printer
552
918
919+Renders a [`++manx`]() as a [`++tape`](), appending a suffix `rez`.
920+
921+XX is `rez/` a typo or is the `/` intentional
922+
923+Accepts
924+-------
925+
926+`rez` is a [`++tape`]().
927+
928+Produces
929+--------
930+
931+A `++tape`.
932+
933+Source
934+------
935+
553 ++ apex :: top level
936 ++ apex :: top level
554 |= [mex=manx rez=tape]
937 |= [mex=manx rez=tape]
555 ^- tape
938 ^- tape
@@ -566,9 +949,8 @@ Inner XML printer
566 ?~(att rez [' ' (attr att rez)])
949 ?~(att rez [' ' (attr att rez)])
567 ::
950 ::
568
951
569−Renders a `++manx` as a [`++tape`](), appending a suffix `rez\`.
952+Examples
570−
953+--------
571−`rez` is a [`++tape`]().
572
954
573 ~zod/try=> (apex:poxo ;div; "")
955 ~zod/try=> (apex:poxo ;div; "")
574 "<div></div>"
956 "<div></div>"
@@ -585,6 +967,23 @@ Renders a `++manx` as a [`++tape`](), appending a suffix `rez\`.
585
967
586Print attributes
968Print attributes
587
969
970+Render XML attributes as a [`++tape`]().
971+
972+Accepts
973+-------
974+
975+`tat` is a [`++mart`]().
976+
977+`rez` is a `++tape`.
978+
979+Produces
980+--------
981+
982+A `++tape`.
983+
984+Source
985+------
986+
588 ++ attr :: attributes to tape
987 ++ attr :: attributes to tape
589 |= [tat=mart rez=tape]
988 |= [tat=mart rez=tape]
590 ^- tape
989 ^- tape
@@ -596,11 +995,8 @@ Print attributes
596 (escp(unq |) v.i.tat '"' ?~(t.tat rez [' ' rez]))
995 (escp(unq |) v.i.tat '"' ?~(t.tat rez [' ' rez]))
597 ==
996 ==
598
997
599−Render XML attributes as a [`++tape`]().
998+Examples
600−
999+--------
601−`tat` is a [`++mart`]().
602−
603−`rez` is a [`++tape`]().
604
1000
605 ~zod/try=> (attr:poxo ~ "")
1001 ~zod/try=> (attr:poxo ~ "")
606 ""
1002 ""
@@ -613,6 +1009,23 @@ Render XML attributes as a [`++tape`]().
613
1009
614Escape XML
1010Escape XML
615
1011
1012+Escapes the XML special characters `"`, `&`, `'`, `<`, `>`.
1013+
1014+Accepts
1015+-------
1016+
1017+`tex`is a [`++tape`]().
1018+
1019+`rez` is a `++tape`.
1020+
1021+Produces
1022+--------
1023+
1024+`++tape`.
1025+
1026+Source
1027+------
1028+
616 ++ escp :: escape for xml
1029 ++ escp :: escape for xml
617 |= [tex=tape rez=tape]
1030 |= [tex=tape rez=tape]
618 ?: unq
1031 ?: unq
@@ -633,11 +1046,8 @@ Escape XML
633 ==
1046 ==
634 ::
1047 ::
635
1048
636−Escapes the XML special characters `"`, `&`, `'`, `<`, `>`.
1049+Examples
637−
1050+--------
638−`tex`is a [`++tape`]().
639−
640−`rez` is a [`++tape`]().
641
1051
642 ~zod/try=> (escp:poxo "astra" ~)
1052 ~zod/try=> (escp:poxo "astra" ~)
643 ~[~~a ~~s ~~t ~~r ~~a]
1053 ~[~~a ~~s ~~t ~~r ~~a]
@@ -652,15 +1062,29 @@ Escapes the XML special characters `"`, `&`, `'`, `<`, `>`.
652
1062
653Print name
1063Print name
654
1064
1065+Renders a [`++mane`]() as a [`++tape`]().
1066+
1067+Accepts
1068+-------
1069+
1070+`man` is a `++mane`.
1071+
1072+Produces
1073+--------
1074+
1075+A `++tape`.
1076+
1077+Source
1078+------
1079+
655 ++ name :: name to tape
1080 ++ name :: name to tape
656 |= man=mane ^- tape
1081 |= man=mane ^- tape
657 ?@ man (trip man)
1082 ?@ man (trip man)
658 (weld (trip -.man) `tape`[':' (trip +.man)])
1083 (weld (trip -.man) `tape`[':' (trip +.man)])
659 ::
1084 ::
660
1085
661−Renders a `++mane` as a `++tape`.
1086+Examples
662−
1087+--------
663−`man` is a [`++mane`]().
664
1088
665 ~zod/try=> (name:poxo %$)
1089 ~zod/try=> (name:poxo %$)
666 ""
1090 ""
@@ -673,6 +1097,23 @@ Renders a `++mane` as a `++tape`.
673
1097
674Print node list
1098Print node list
675
1099
1100+Renders multiple XML nodes as a [`++tape`]().
1101+
1102+Accepts
1103+-------
1104+
1105+`lix` is a [`++list`]() of [`++manx`]().
1106+
1107+`rez` is a `++tape`.
1108+
1109+Produces
1110+--------
1111+
1112+A `++tape`.
1113+
1114+Source
1115+------
1116+
676 ++ many :: nodelist to tape
1117 ++ many :: nodelist to tape
677 |= [lix=(list manx) rez=tape]
1118 |= [lix=(list manx) rez=tape]
678 |- ^- tape
1119 |- ^- tape
@@ -680,11 +1121,8 @@ Print node list
680 (apex i.lix $(lix t.lix))
1121 (apex i.lix $(lix t.lix))
681 ::
1122 ::
682
1123
683−Renders multiple XML nodes as a [`++tape`]()
1124+Examples
684−
1125+--------
685−`lix` is a [`++list`]() of [`++manx`]().
686−
687−`rez` is a [`++tape`]().
688
1126
689 ~zod/try=> (many:poxo ~ "")
1127 ~zod/try=> (many:poxo ~ "")
690 ""
1128 ""
@@ -701,13 +1139,27 @@ Renders multiple XML nodes as a [`++tape`]()
701
1139
702Parse XML
1140Parse XML
703
1141
1142+Parses an XML node from a [`++cord`](), producing a [`++unit`]() [`++manx`]().
1143+
1144+Accepts
1145+-------
1146+
1147+`a` is a [`++cord`]().
1148+
1149+Produces
1150+--------
1151+
1152+A `(unit manx)`.
1153+
1154+Source
1155+------
1156+
704 ++ poxa :: xml parser
1157 ++ poxa :: xml parser
705 =< |=(a=cord (rush a apex))
1158 =< |=(a=cord (rush a apex))
706 |%
1159 |%
707
1160
708−Parses an XML node from a [`++cord`](), producing a unit [`++manx`]().
1161+Examples
709−
1162+--------
710−`a` is a [`++cord`]().
711
1163
712 ~zod/try=> (poxa '<div />')
1164 ~zod/try=> (poxa '<div />')
713 [~ [g=[n=%div a=~] c=~]]
1165 [~ [g=[n=%div a=~] c=~]]
@@ -722,6 +1174,21 @@ Parses an XML node from a [`++cord`](), producing a unit [`++manx`]().
722
1174
723Top level parser
1175Top level parser
724
1176
1177+Parses a node of XML, type [`++manx`]().
1178+
1179+Accepts
1180+-------
1181+
1182+A [`++nail`]().
1183+
1184+Produces
1185+--------
1186+
1187+A `++manx`.
1188+
1189+Source
1190+------
1191+
725 ++ apex
1192 ++ apex
726 =+ spa=;~(pose comt whit)
1193 =+ spa=;~(pose comt whit)
727 %+ knee *manx |. ~+
1194 %+ knee *manx |. ~+
@@ -733,21 +1200,38 @@ Top level parser
733 ==
1200 ==
734 ::
1201 ::
735
1202
736−Parses a node of XML, type [`++manx`]().
1203+Examples
1204+--------
737
1205
738− ~zod/try=> (rash '<div />' apex:xmlp)
1206+ ~zod/try=> (rash '<div />' apex:poxa)
739 [g=[n=%div a=~] c=~]
1207 [g=[n=%div a=~] c=~]
740− ~zod/try=> (rash '<html><head/> <body/></html>' apex:xmlp)
1208+ ~zod/try=> (rash '<html><head/> <body/></html>' apex:poxa)
741 [g=[n=%html a=~] c=~[[g=[n=%head a=~] c=~] [g=[n=%body a=~] c=~]]]
1209 [g=[n=%html a=~] c=~[[g=[n=%head a=~] c=~] [g=[n=%body a=~] c=~]]]
742− ~zod/try=> (rash '<script src="/gep/hart.js"/>' apex:xmlp)
1210+ ~zod/try=> (rash '<script src="/gep/hart.js"/>' apex:poxa)
743 [g=[n=%script a=~[[n=%src v="/gep/hart.js"]]] c=~]
1211 [g=[n=%script a=~[[n=%src v="/gep/hart.js"]]] c=~]
744− ~zod/try=> (rash '<<<<' apex:xmlp)
1212+ ~zod/try=> (rash '<<<<' apex:poxa)
745 ! {1 2}
1213 ! {1 2}
746 ! exit
1214 ! exit
747
1215
748−### `++attr`
1216+### `++attr`
1217+
1218+Parse XML attributes
1219+
1220+Parses the list of attributes inside the opening XML tag, which is zero
1221+or more space-prefixed name to string values.
1222+
1223+Accepts
1224+-------
749
1225
750−Parse XML attributes
1226+A [`++nail`]().
1227+
1228+Produces
1229+--------
1230+
1231+A [`++mart`]().
1232+
1233+Source
1234+------
751
1235
752 ++ attr :: attributes
1236 ++ attr :: attributes
753 %+ knee *mart |. ~+
1237 %+ knee *mart |. ~+
@@ -761,23 +1245,23 @@ Parse XML attributes
761 ==
1245 ==
762 ::
1246 ::
763
1247
764−Parses the list of attributes inside the opening XML tag, which is zero
1248+Examples
765−or more space-prefixed name to string values. Result type [`++mart`]()
1249+--------
766
1250
767− ~zod/try=> (rash '' attr:xmlp)
1251+ ~zod/try=> (rash '' attr:poxa)
768 ~
1252 ~
769− ~zod/try=> (rash 'sam=""' attr:xmlp)
1253+ ~zod/try=> (rash 'sam=""' attr:poxa)
770 ! {1 1}
1254 ! {1 1}
771 ! exit
1255 ! exit
772− ~zod/try=> (rash ' sam=""' attr:xmlp)
1256+ ~zod/try=> (rash ' sam=""' attr:poxa)
773 ~[[n=%sam v=""]]
1257 ~[[n=%sam v=""]]
774− ~zod/try=> (rash ' sam="hek"' attr:xmlp)
1258+ ~zod/try=> (rash ' sam="hek"' attr:poxa)
775 ~[[n=%sam v="hek"]]
1259 ~[[n=%sam v="hek"]]
776− ~zod/try=> (rash ' sam="hek" res="actor"' attr:xmlp)
1260+ ~zod/try=> (rash ' sam="hek" res="actor"' attr:poxa)
777 ~[[n=%sam v="hek"] [n=%res v="actor"]]
1261 ~[[n=%sam v="hek"] [n=%res v="actor"]]
778− ~zod/try=> (rash ' sam=\'hek\' res="actor"' attr:xmlp)
1262+ ~zod/try=> (rash ' sam=\'hek\' res="actor"' attr:poxa)
779 ~[[n=%sam v="hek"] [n=%res v="actor"]]
1263 ~[[n=%sam v="hek"] [n=%res v="actor"]]
780− ~zod/try=> (rash ' sam=\'hek" res="actor"' attr:xmlp)
1264+ ~zod/try=> (rash ' sam=\'hek" res="actor"' attr:poxa)
781 ! {1 23}
1265 ! {1 23}
782 ! exit
1266 ! exit
783
1267
@@ -785,18 +1269,34 @@ or more space-prefixed name to string values. Result type [`++mart`]()
785
1269
786Parse character data
1270Parse character data
787
1271
1272+Parsing rule. Parses XML character data.
1273+
1274+Accepts
1275+-------
1276+
1277+A [`++nail`]().
1278+
1279+Produces
1280+--------
1281+
1282+A [`++mars`]().
1283+
1284+Source
1285+------
1286+
788 ++ chrd :: character data
1287 ++ chrd :: character data
789 %+ cook |=(a=tape ^-(mars :/(a)))
1288 %+ cook |=(a=tape ^-(mars :/(a)))
790 (plus ;~(less soq doq ;~(pose (just `@`10) escp)))
1289 (plus ;~(less soq doq ;~(pose (just `@`10) escp)))
791 ::
1290 ::
792
1291
793−Parsing rule. Parses XML character data. Result type [`++mars`]()
1292+Examples
1293+--------
794
1294
795− ~zod/try=> (rash 'asa' chrd:xmlp)
1295+ ~zod/try=> (rash 'asa' chrd:poxa)
796 [g=[n=%$ a=~[[n=%$ v="asa"]]] c=~]
1296 [g=[n=%$ a=~[[n=%$ v="asa"]]] c=~]
797− ~zod/try=> (rash 'asa &gt; are' chrd:xmlp)
1297+ ~zod/try=> (rash 'asa &gt; are' chrd:poxa)
798 [g=[n=%$ a=~[[n=%$ v="asa > are"]]] c=~]
1298 [g=[n=%$ a=~[[n=%$ v="asa > are"]]] c=~]
799− ~zod/try=> (rash 'asa > are' chrd:xmlp)
1299+ ~zod/try=> (rash 'asa > are' chrd:poxa)
800 ! {1 6}
1300 ! {1 6}
801 ! exit
1301 ! exit
802
1302
@@ -804,6 +1304,21 @@ Parsing rule. Parses XML character data. Result type [`++mars`]()
804
1304
805Parses comments
1305Parses comments
806
1306
1307+Parsing rule. Parses XML comment blocks.
1308+
1309+Accepts
1310+-------
1311+
1312+A [`++nail`]().
1313+
1314+Produces
1315+--------
1316+
1317+A [`++like`]().
1318+
1319+Source
1320+------
1321+
807 ++ comt :: comments
1322 ++ comt :: comments
808 =- (ifix [(jest '<!--') (jest '-->')] (star -))
1323 =- (ifix [(jest '<!--') (jest '-->')] (star -))
809 ;~ pose
1324 ;~ pose
@@ -812,14 +1327,16 @@ Parses comments
812 ;~(less (jest '-->') hep)
1327 ;~(less (jest '-->') hep)
813 ==
1328 ==
814 ::
1329 ::
1330+A [`++unit`]() of.
815
1331
816−Parsing rule. Parses XML comment blocks.
1332+Examples
1333+--------
817
1334
818− ~zod/try=> (rash '<!-- bye -->' comt:xmlp)
1335+ ~zod/try=> (rash '<!-- bye -->' comt:poxa)
819 " bye "
1336 " bye "
820− ~zod/try=> (rash '<!-- bye ><<<>< - - -->' comt:xmlp)
1337+ ~zod/try=> (rash '<!-- bye ><<<>< - - -->' comt:poxa)
821 " bye ><<<>< - - "
1338 " bye ><<<>< - - "
822− ~zod/try=> (rash '<!-- invalid -->-->' comt:xmlp)
1339+ ~zod/try=> (rash '<!-- invalid -->-->' comt:poxa)
823 ! {1 18}
1340 ! {1 18}
824 ! exit
1341 ! exit
825
1342
@@ -827,6 +1344,22 @@ Parsing rule. Parses XML comment blocks.
827
1344
828Parse (possibly) escaped char
1345Parse (possibly) escaped char
829
1346
1347+Parsing rule. Parses a nonspecial or escaped character. Result type
1348+[`++char`]()
1349+
1350+Accepts
1351+-------
1352+
1353+A [`++nail`]().
1354+
1355+Produces
1356+--------
1357+
1358+The [`++edge`]() of a [`++cord`]().
1359+
1360+Source
1361+------
1362+
830 ++ escp
1363 ++ escp
831 ;~ pose
1364 ;~ pose
832 ;~(less gal gar pam prn)
1365 ;~(less gal gar pam prn)
@@ -837,42 +1370,59 @@ Parse (possibly) escaped char
837 (cold '\'' (jest '&apos;'))
1370 (cold '\'' (jest '&apos;'))
838 ==
1371 ==
839
1372
840−Parsing rule. Parses a nonspecial or escaped character. Result type
1373+Examples
841−[`++char`]()
1374+--------
842
1375
843− ~zod/try=> (rash 'a' escp:xmlp)
1376+ ~zod/try=> (rash 'a' escp:poxa)
844 'a'
1377 'a'
845− ~zod/try=> (rash 'ab' escp:xmlp)
1378+ ~zod/try=> (rash 'ab' escp:poxa)
846 ! {1 2}
1379 ! {1 2}
847 ! exit
1380 ! exit
848− ~zod/try=> (rash '.' escp:xmlp)
1381+ ~zod/try=> (rash '.' escp:poxa)
849 '.'
1382 '.'
850− ~zod/try=> (rash '!' escp:xmlp)
1383+ ~zod/try=> (rash '!' escp:poxa)
851 '!'
1384 '!'
852− ~zod/try=> (rash '>' escp:xmlp)
1385+ ~zod/try=> (rash '>' escp:poxa)
853 ! {1 2}
1386 ! {1 2}
854 ! exit
1387 ! exit
855− ~zod/try=> (rash '&gt;' escp:xmlp)
1388+ ~zod/try=> (rash '&gt;' escp:poxa)
856 '>'
1389 '>'
857− ~zod/try=> (rash '&quot;' escp:xmlp)
1390+ ~zod/try=> (rash '&quot;' escp:poxa)
858 '"'
1391 '"'
859
1392
860### `++empt`
1393### `++empt`
861
1394
862Parse self-closing tag
1395Parse self-closing tag
863
1396
1397+Parsing rule. Parses self-closing XML tags that end in `/>`.
1398+
1399+Accepts
1400+-------
1401+
1402+A [`++nail`]().
1403+
1404+Produces
1405+--------
1406+
1407+
1408+A `(like tape)`.
1409+
1410+Source
1411+------
1412+
864 ++ empt :: self-closing tag
1413 ++ empt :: self-closing tag
865 %+ ifix [gal (jest '/>')]
1414 %+ ifix [gal (jest '/>')]
866 ;~(plug ;~(plug name attr) (cold ~ (star whit)))
1415 ;~(plug ;~(plug name attr) (cold ~ (star whit)))
867 ::
1416 ::
868
1417
869−Parsing rule. Parses self-closing XML tags that end in `/>`.
1418+Examples
1419+--------
870
1420
871− ~zod/try=> (rash '<div/>' empt:xmlp)
1421+ ~zod/try=> (rash '<div/>' empt:poxa)
872 [[%div ~] ~]
1422 [[%div ~] ~]
873− ~zod/try=> (rash '<pre color="#eeffee" />' empt:xmlp)
1423+ ~zod/try=> (rash '<pre color="#eeffee" />' empt:poxa)
874 [[%pre ~[[n=%color v="#eeffee"]]] ~]
1424 [[%pre ~[[n=%color v="#eeffee"]]] ~]
875− ~zod/try=> (rash '<pre color="#eeffee"></pre>' empt:xmlp)
1425+ ~zod/try=> (rash '<pre color="#eeffee"></pre>' empt:poxa)
876 ! {1 21}
1426 ! {1 21}
877 ! exit
1427 ! exit
878
1428
@@ -880,18 +1430,34 @@ Parsing rule. Parses self-closing XML tags that end in `/>`.
880
1430
881Parse opening tag
1431Parse opening tag
882
1432
1433+Parsing rule. Parses the opening tag of an XML node. Result type
1434+[`++marx`]()
1435+
1436+Accepts
1437+-------
1438+
1439+A [`++nail`]().
1440+
1441+Produces
1442+--------
1443+
1444+A `(like marx)`.
1445+
1446+Source
1447+------
1448+
883 ++ head :: opening tag
1449 ++ head :: opening tag
884 (ifix [gal gar] ;~(plug name attr))
1450 (ifix [gal gar] ;~(plug name attr))
885 ::
1451 ::
886
1452
887−Parsing rule. Parses the opening tag of an XML node. Result type
1453+Examples
888−[`++marx`]()
1454+--------
889
1455
890− ~zod/try=> (rash '<a>' head:xmlp)
1456+ ~zod/try=> (rash '<a>' head:poxa)
891 [n=%a a=~]
1457 [n=%a a=~]
892− ~zod/try=> (rash '<div mal="tok">' head:xmlp)
1458+ ~zod/try=> (rash '<div mal="tok">' head:poxa)
893 [n=%div a=~[[n=%mal v="tok"]]]
1459 [n=%div a=~[[n=%mal v="tok"]]]
894− ~zod/try=> (rash '<div mal="tok" />' head:xmlp)
1460+ ~zod/try=> (rash '<div mal="tok" />' head:poxa)
895 ! {1 16}
1461 ! {1 16}
896 ! exit
1462 ! exit
897
1463
@@ -899,6 +1465,21 @@ Parsing rule. Parses the opening tag of an XML node. Result type
899
1465
900Parse tag name
1466Parse tag name
901
1467
1468+Parsing rule. Parses the name of an XML tag.
1469+
1470+Accepts
1471+-------
1472+
1473+A [`++nail`]().
1474+
1475+Produces
1476+--------
1477+
1478+An [`++edge`]() of a [`++mane`]().
1479+
1480+Source
1481+------
1482+
902 ++ name :: tag name
1483 ++ name :: tag name
903 %+ knee *mane |. ~+
1484 %+ knee *mane |. ~+
904 =+ ^= chx
1485 =+ ^= chx
@@ -910,15 +1491,16 @@ Parse tag name
910 ;~(pose ;~(plug ;~(sfix chx col) chx) chx)
1491 ;~(pose ;~(plug ;~(sfix chx col) chx) chx)
911 ::
1492 ::
912
1493
913−Parsing rule. Parses the name of an XML tag. Result type [`++mane`]()
1494+Examples
1495+--------
914
1496
915− ~zod/try=> (scan "ham" name:xmlp)
1497+ ~zod/try=> (scan "ham" name:poxa)
916 %ham
1498 %ham
917− ~zod/try=> (scan "ham:tor" name:xmlp)
1499+ ~zod/try=> (scan "ham:tor" name:poxa)
918 [%ham %tor]
1500 [%ham %tor]
919− ~zod/try=> (scan "ham-tor" name:xmlp)
1501+ ~zod/try=> (scan "ham-tor" name:poxa)
920 %ham-tor
1502 %ham-tor
921− ~zod/try=> (scan "ham tor" name:xmlp)
1503+ ~zod/try=> (scan "ham tor" name:poxa)
922 ! {1 4}
1504 ! {1 4}
923 ! exit
1505 ! exit
924
1506
@@ -926,15 +1508,31 @@ Parsing rule. Parses the name of an XML tag. Result type [`++mane`]()
926
1508
927Parse closing tag
1509Parse closing tag
928
1510
1511+Parsing rule. Parses an XML closing tag.
1512+
1513+Accepts
1514+-------
1515+
1516+A [`++nail`]().
1517+
1518+Produces
1519+--------
1520+
1521+A `(like tail)`.
1522+
1523+Source
1524+------
1525+
929 ++ tail (ifix [(jest '</') gar] name) :: closing tag
1526 ++ tail (ifix [(jest '</') gar] name) :: closing tag
930
1527
931−Parsing rule. Parses an XML closing tag.
1528+Examples
1529+--------
932
1530
933− ~zod/try=> (scan "</div>" tail:xmlp)
1531+ ~zod/try=> (scan "</div>" tail:poxa)
934 %div
1532 %div
935− ~zod/try=> (scan "</a>" tail:xmlp)
1533+ ~zod/try=> (scan "</a>" tail:poxa)
936 %a
1534 %a
937− ~zod/try=> (scan "</>" tail:xmlp)
1535+ ~zod/try=> (scan "</>" tail:poxa)
938 ! {1 3}
1536 ! {1 3}
939 ! exit
1537 ! exit
940
1538
@@ -942,21 +1540,37 @@ Parsing rule. Parses an XML closing tag.
942
1540
943Parse whitespace, etc.
1541Parse whitespace, etc.
944
1542
1543+Parsing rule. Parses newlines, tabs, and spaces.
1544+
1545+Accepts
1546+-------
1547+
1548+A [`++nail`]().
1549+
1550+Produces
1551+--------
1552+
1553+A `(like char)`.
1554+
1555+Source
1556+------
1557+
945 ++ whit (mask ~[' ' `@`0x9 `@`0xa]) :: whitespace
1558 ++ whit (mask ~[' ' `@`0x9 `@`0xa]) :: whitespace
946 ::
1559 ::
947
1560
948−Parsing rule. Parses newlines, tabs, and spaces.
1561+Examples
1562+--------
949
1563
950− ~zod/try=> `@`(scan " " whit:xmlp)
1564+ ~zod/try=> `@`(scan " " whit:poxa)
951 32
1565 32
952− ~zod/try=> `@`(scan " " whit:xmlp)
1566+ ~zod/try=> `@`(scan " " whit:poxa)
953 ! {1 2}
1567 ! {1 2}
954 ! exit
1568 ! exit
955− ~zod/try=> `@`(scan "\0a" whit:xmlp)
1569+ ~zod/try=> `@`(scan "\0a" whit:poxa)
956 10
1570 10
957− ~zod/try=> `@`(scan "\09" whit:xmlp)
1571+ ~zod/try=> `@`(scan "\09" whit:poxa)
958 9
1572 9
959− ~zod/try=> `@`(scan "\08" whit:xmlp)
1573+ ~zod/try=> `@`(scan "\08" whit:poxa)
960 ! {1 1}
1574 ! {1 1}
961 ! exit
1575 ! exit
962
1576
@@ -964,21 +1578,46 @@ Parsing rule. Parses newlines, tabs, and spaces.
964
1578
965JSON reparsing core
1579JSON reparsing core
966
1580
967− ++ jo :: json reparser
1581+Contains converters of [`++json`]() to [`++unit`]()s of well-typed structures.
968− => |% ++ grub (unit ,*)
969− ++ fist $+(json grub)
970− |%
971
1582
972−Contains converters of ++json to [`++unit`]() well-typed structures.
1583+Accepts
1584+-------
973
1585
974A `fist` is a gate that produces a `grub`.
1586A `fist` is a gate that produces a `grub`.
975
1587
976A `grub` is a unit of some JSON value.
1588A `grub` is a unit of some JSON value.
977
1589
1590+Source
1591+------
1592+
1593+ ++ jo :: json reparser
1594+ => |% ++ grub (unit ,*)
1595+ ++ fist $+(json grub)
1596+ |%
1597+
1598+
978### `++ar`
1599### `++ar`
979
1600
980Parse array to list
1601Parse array to list
981
1602
1603+Reparser modifier. Reparses an array to the [`++unit`]() of a homogenous
1604+[`++list`]() using `wit` to reparse every element.
1605+
1606+`wit` is a [`++fist`](), a JSON reparser.
1607+
1608+
1609+Accepts
1610+-------
1611+
1612+A [`++fist`]().
1613+
1614+Produces
1615+--------
1616+
1617+A [`++rule`]().
1618+
1619+Source
1620+------
982 ++ ar :: array as list
1621 ++ ar :: array as list
983 |* wit=fist
1622 |* wit=fist
984 |= jon=json
1623 |= jon=json
@@ -989,19 +1628,34 @@ Parse array to list
989 [i=(wit i.p.jon) t=$(p.jon t.p.jon)]
1628 [i=(wit i.p.jon) t=$(p.jon t.p.jon)]
990 ::
1629 ::
991
1630
992−Reparser modifier. Reparses an array to the [`++unit`]() of a homogenous
1631+Examples
993−[`++list`]() using `wit` to reparse every element.
1632+--------
994−
995−`wit` is a [`++fist`](), a JSON reparser.
996
1633
997 ~zod/try=> :type; ((ar ni):jo a/~[n/'1' n/'2'])
1634 ~zod/try=> :type; ((ar ni):jo a/~[n/'1' n/'2'])
998 [~ u=~[1 2]]
1635 [~ u=~[1 2]]
999 {[%~ u=it(@)] %~}
1636 {[%~ u=it(@)] %~}
1000
1637
1638+
1001### `++at`
1639### `++at`
1002
1640
1003Reparse array as tuple
1641Reparse array as tuple
1004
1642
1643+Reparser generator. Reparses an array as a fixed-length tuple of
1644+[`++unit`]()s, using a list of `++fist`s.
1645+
1646+Accepts
1647+-------
1648+
1649+`wil` is a [`++pole`](), a [`face`]()less list of [`++fist`]()s.
1650+
1651+Produces
1652+--------
1653+
1654+A [`++rule`]().
1655+
1656+Source
1657+------
1658+
1005 ++ at :: array as tuple
1659 ++ at :: array as tuple
1006 |* wil=(pole fist)
1660 |* wil=(pole fist)
1007 |= jon=json
1661 |= jon=json
@@ -1010,10 +1664,8 @@ Reparse array as tuple
1010 ?.((za raw) ~ (some (zp raw)))
1664 ?.((za raw) ~ (some (zp raw)))
1011 ::
1665 ::
1012
1666
1013−Reparser generator. Reparses an array as a fixed-length tuple of
1667+Examples
1014−[`++unit`]()s, using a list of `++fist`s.
1668+--------
1015−
1016−`wil` is a [`++pole`]() a [`face`]()less list of [`++fist`]()s.
1017
1669
1018 ~zod/try=> ((at ni so ni ~):jo a/~[n/'3' s/'to' n/'4'])
1670 ~zod/try=> ((at ni so ni ~):jo a/~[n/'3' s/'to' n/'4'])
1019 [~ u=[q=3 ~.to q=4]]
1671 [~ u=[q=3 ~.to q=4]]
@@ -1027,6 +1679,21 @@ Reparser generator. Reparses an array as a fixed-length tuple of
1027
1679
1028Reparse array to tuple
1680Reparse array to tuple
1029
1681
1682+Reparser generator. Reparses a list of [`++json`]() with `wil` to a tuple of [`++unit`]()s.
1683+
1684+Accepts
1685+-------
1686+
1687+`wil` is a [`++pole`](), a [face]()less list of [`++fist`]()s.
1688+
1689+Produces
1690+--------
1691+
1692+A [`++rule`]().
1693+
1694+Source
1695+------
1696+
1030 ++ at-raw :: array as tuple
1697 ++ at-raw :: array as tuple
1031 |* wil=(pole fist)
1698 |* wil=(pole fist)
1032 |= jol=(list json)
1699 |= jol=(list json)
@@ -1035,10 +1702,8 @@ Reparse array to tuple
1035 ((at-raw +.wil) ?~(jol ~ t.jol))
1702 ((at-raw +.wil) ?~(jol ~ t.jol))
1036 ::
1703 ::
1037
1704
1038−Reparser generator. Reparses a list of [`++json`]() to a tuple of
1705+Examples
1039−[`++unit`]() using `wil`.
1706+--------
1040−
1041−`wil` is a [`++pole`](), a [face]()less list of [`++fist`]()s.
1042
1707
1043 ~zod/try=> ((at-raw ni ni bo ~):jo ~[s/'hi' n/'1' b/&])
1708 ~zod/try=> ((at-raw ni ni bo ~):jo ~[s/'hi' n/'1' b/&])
1044 [~ [~ 1] [~ u=%.y] ~]
1709 [~ [~ 1] [~ u=%.y] ~]
@@ -1047,12 +1712,28 @@ Reparser generator. Reparses a list of [`++json`]() to a tuple of
1047
1712
1048Reparse boolean
1713Reparse boolean
1049
1714
1715+Reparser modifier. Reparses a boolean to the [`++unit`]() of a
1716+boolean.
1717+
1718+Accepts
1719+-------
1720+
1721+A [`++json`]().
1722+
1723+Produces
1724+--------
1725+
1726+A [`++fist`]().
1727+
1728+Source
1729+------
1730+
1050 ++ bo :: boolean
1731 ++ bo :: boolean
1051 |=(jon=json ?.(?=([%b *] jon) ~ [~ u=p.jon]))
1732 |=(jon=json ?.(?=([%b *] jon) ~ [~ u=p.jon]))
1052 ::
1733 ::
1053
1734
1054−Reparser modifier. Reparses a boolean to the [`++unit`]() of a
1735+Examples
1055−[`loobean`]().
1736+--------
1056
1737
1057 ~zod/try=> (bo:jo [%b &])
1738 ~zod/try=> (bo:jo [%b &])
1058 [~ u=%.y]
1739 [~ u=%.y]
@@ -1065,12 +1746,29 @@ Reparser modifier. Reparses a boolean to the [`++unit`]() of a
1065
1746
1066Reparse boolean not
1747Reparse boolean not
1067
1748
1749+Reparser modifier. Reparses the inverse of a boolean to the [`++unit`]()
1750+of a loobean.
1751+
1752+
1753+Accepts
1754+-------
1755+
1756+A [`++json`]().
1757+
1758+Produces
1759+--------
1760+
1761+A [`++fist`]().
1762+
1763+Source
1764+------
1765+
1068 ++ bu :: boolean not
1766 ++ bu :: boolean not
1069 |=(jon=json ?.(?=([%b *] jon) ~ [~ u=!p.jon]))
1767 |=(jon=json ?.(?=([%b *] jon) ~ [~ u=!p.jon]))
1070 ::
1768 ::
1071
1769
1072−Reparser modifier. Reparses the inverse of a boolean to the [`++unit`]()
1770+Examples
1073−of a loobean.
1771+--------
1074
1772
1075 ~zod/try=> (bu:jo [%b &])
1773 ~zod/try=> (bu:jo [%b &])
1076 [~ u=%.n]
1774 [~ u=%.n]
@@ -1083,19 +1781,33 @@ of a loobean.
1083
1781
1084Reparse and transform
1782Reparse and transform
1085
1783
1086− ++ cu :: transform
1087− |* [poq=$+(* *) wit=fist]
1088− |= jon=json
1089− (bind (wit jon) poq)
1090− ::
1091−
1092Reparser modifier. Reparses `jon` and slams the result through `wit`,
1784Reparser modifier. Reparses `jon` and slams the result through `wit`,
1093producing a [`++unit`]().
1785producing a [`++unit`]().
1094
1786
1787+Accepts
1788+-------
1789+
1095`wit` is a [`++fist`]().
1790`wit` is a [`++fist`]().
1096
1791
1097`poq` is a [`gate`]() that accepts and returns a [noun]().
1792`poq` is a [`gate`]() that accepts and returns a [noun]().
1098
1793
1794+Produces
1795+--------
1796+
1797+A [`++fist`]().
1798+
1799+Source
1800+------
1801+
1802+ ++ cu :: transform
1803+ |* [poq=$+(* *) wit=fist]
1804+ |= jon=json
1805+ (bind (wit jon) poq)
1806+ ::
1807+
1808+Examples
1809+--------
1810+
1099 ~zod/try=> ((cu dec ni):jo [%n '20'])
1811 ~zod/try=> ((cu dec ni):jo [%n '20'])
1100 [~ 19]
1812 [~ 19]
1101 ~zod/try=> ((cu dec ni):jo [%b &])
1813 ~zod/try=> ((cu dec ni):jo [%b &])
@@ -1105,13 +1817,29 @@ producing a [`++unit`]().
1105
1817
1106Reparse UTC date
1818Reparse UTC date
1107
1819
1820+Reparser modifier. Reparses a UTC date string to a [`++unit`]().
1821+
1822+Accepts
1823+-------
1824+
1825+`jon` is a [`++json`]().
1826+
1827+Produces
1828+--------
1829+
1830+A [`++fist`]().
1831+
1832+Source
1833+------
1834+
1108 ++ da :: UTC date
1835 ++ da :: UTC date
1109 |= jon=json
1836 |= jon=json
1110 ?. ?=([%s *] jon) ~
1837 ?. ?=([%s *] jon) ~
1111 (bind (stud (trip p.jon)) |=(a=date (year a)))
1838 (bind (stud (trip p.jon)) |=(a=date (year a)))
1112 ::
1839 ::
1113
1840
1114−Reparser modifier. Reparses a UTC date string to a [`++unit`]().
1841+Examples
1842+--------
1115
1843
1116 ~zod/try=> (da:jo [%s 'Wed, 29 Oct 2014 0:26:15 +0000'])
1844 ~zod/try=> (da:jo [%s 'Wed, 29 Oct 2014 0:26:15 +0000'])
1117 [~ ~2014.10.29..00.26.15]
1845 [~ ~2014.10.29..00.26.15]
@@ -1124,6 +1852,22 @@ Reparser modifier. Reparses a UTC date string to a [`++unit`]().
1124
1852
1125Reparse millisecond date
1853Reparse millisecond date
1126
1854
1855+Reparser modifier. Reparses the javascript millisecond date integer to a
1856+[`++unit`]().
1857+
1858+Accepts
1859+-------
1860+
1861+`jon` is a [`++json`]().
1862+
1863+Produces
1864+--------
1865+
1866+A [`++fist`]().
1867+
1868+Source
1869+------
1870+
1127 ++ di :: millisecond date
1871 ++ di :: millisecond date
1128 |= jon=json
1872 |= jon=json
1129 %+ bind (ni jon)
1873 %+ bind (ni jon)
@@ -1131,8 +1875,8 @@ Reparse millisecond date
1131 (add ~1970.1.1 (div (mul ~s1 a) 1.000))
1875 (add ~1970.1.1 (div (mul ~s1 a) 1.000))
1132 ::
1876 ::
1133
1877
1134−Reparser modifier. Reparses the JavaScript millisecond date integer to a
1878+Examples
1135−[`++unit`]().
1879+--------
1136
1880
1137 ~zod/try=> (di:jo [%s '2014-10-29'])
1881 ~zod/try=> (di:jo [%s '2014-10-29'])
1138 ~
1882 ~
@@ -1147,18 +1891,32 @@ Reparser modifier. Reparses the JavaScript millisecond date integer to a
1147
1891
1148Reparse unit
1892Reparse unit
1149
1893
1894+Reparser modifier. Reparses `wit` to a [`++unit`]().
1895+
1896+JSON units are considered to be either JSON null or the requested
1897+value, and are reparsed to results of \~ or (some {value}) respectively.
1898+
1899+Accepts
1900+-------
1901+
1902+`wit` is a [`++fist`]().
1903+
1904+Produces
1905+--------
1906+
1907+A [`++fist`]().
1908+
1909+Source
1910+------
1911+
1150 ++ mu :: true unit
1912 ++ mu :: true unit
1151 |* wit=fist
1913 |* wit=fist
1152 |= jon=json
1914 |= jon=json
1153 ?~(jon (some ~) (bind (wit jon) some))
1915 ?~(jon (some ~) (bind (wit jon) some))
1154 ::
1916 ::
1155
1917
1156−Reparser modifier. Reparses `wit` to a [`++unit`]().
1918+Examples
1157−
1919+--------
1158−A- JSON units are considered to be either JSON null or the requested
1159−value, and are reparsed to results of \~ or (some {value}) respectively
1160−
1161−`wit` is a [`++fist`]().
1162
1920
1163 ~zod/try=> ((mu ni):jo [%n '20'])
1921 ~zod/try=> ((mu ni):jo [%n '20'])
1164 [~ [~ u=q=20]]
1922 [~ [~ u=q=20]]
@@ -1173,12 +1931,6 @@ value, and are reparsed to results of \~ or (some {value}) respectively
1173
1931
1174Reparse number as real
1932Reparse number as real
1175
1933
1176− ++ ne :: number as real
1177− |= jon=json
1178− ^- (unit ,@rd)
1179− !!
1180− ::
1181−
1182XX Currently unimplemented
1934XX Currently unimplemented
1183
1935
1184A- yup, this will eventually reparse a floating point atom, but
1936A- yup, this will eventually reparse a floating point atom, but
@@ -1188,13 +1940,29 @@ interfaces for the latter are not currently stable.
1188
1940
1189Reparse number as integer
1941Reparse number as integer
1190
1942
1943+Reparser modifier. Reparses an integer representation to a [`++unit]().
1944+
1945+Accepts
1946+-------
1947+
1948+`jon` is a ++[`++json`]().
1949+
1950+Produces
1951+--------
1952+
1953+The `++unit` of an atom.
1954+
1955+Source
1956+------
1957+
1191 ++ ni :: number as integer
1958 ++ ni :: number as integer
1192 |= jon=json
1959 |= jon=json
1193 ?. ?=([%n *] jon) ~
1960 ?. ?=([%n *] jon) ~
1194 (rush p.jon dem)
1961 (rush p.jon dem)
1195 ::
1962 ::
1196
1963
1197−Reparser modifier. Reparses an integer representation to a [\`++unit]().
1964+Examples
1965+--------
1198
1966
1199 ~zod/try=> (ni:jo [%n '0'])
1967 ~zod/try=> (ni:jo [%n '0'])
1200 [~ q=0]
1968 [~ q=0]
@@ -1215,13 +1983,29 @@ Reparser modifier. Reparses an integer representation to a [\`++unit]().
1215
1983
1216Reparse number as text
1984Reparse number as text
1217
1985
1986+Reparser modifier. Reparses a numeric representation to a [++cord]().
1987+
1988+Accepts
1989+-------
1990+
1991+`jon` is a `++json`.
1992+
1993+Produces
1994+--------
1995+
1996+The [`++unit`]() of a `++cord`.
1997+
1998+Source
1999+------
2000+
1218 ++ no :: number as text
2001 ++ no :: number as text
1219 |= jon=json
2002 |= jon=json
1220 ?. ?=([%n *] jon) ~
2003 ?. ?=([%n *] jon) ~
1221 (some p.jon)
2004 (some p.jon)
1222 ::
2005 ::
1223
2006
1224−Reparser modifier. Reparses a numeric representation to a [++cord]().
2007+Examples
2008+--------
1225
2009
1226 ~zod/try=> (no:jo [%n '0'])
2010 ~zod/try=> (no:jo [%n '0'])
1227 [~ u=~.0]
2011 [~ u=~.0]
@@ -1242,6 +2026,23 @@ Reparser modifier. Reparses a numeric representation to a [++cord]().
1242
2026
1243Reparse object to frond
2027Reparse object to frond
1244
2028
2029+Reparser generator. Reparses an object, succeeding if it corresponds to
2030+one of the key-value pairs in `wer`.
2031+
2032+Accepts
2033+-------
2034+
2035+`wer` is a [`++pole`](), a [`++face`]()less list of [`++cord`]() and
2036+[`++fist`]() key-value pairs.
2037+
2038+Produces
2039+--------
2040+
2041+The [`++unit`]() of a cell of a.....
2042+
2043+Source
2044+------
2045+
1245 ++ of :: object as frond
2046 ++ of :: object as frond
1246 |* wer=(pole ,[cord fist])
2047 |* wer=(pole ,[cord fist])
1247 |= jon=json
2048 |= jon=json
@@ -1253,11 +2054,8 @@ Reparse object to frond
1253 ((of +.wer) jon)
2054 ((of +.wer) jon)
1254 ::
2055 ::
1255
2056
1256−Reparser generator. Reparses an object, succeeding if it corresponds to
2057+Examples
1257−one of the key-value pairs in `wer`.
2058+--------
1258−
1259−`wer` is a [`++pole`](), a [`++face`]()less list of [`++cord`]() and
1260−[`++fist`]() key-value pairs.
1261
2059
1262 ~zod/try=> ((of sem/sa som/ni ~):jo %o [%sem s/'hi'] ~ ~)
2060 ~zod/try=> ((of sem/sa som/ni ~):jo %o [%sem s/'hi'] ~ ~)
1263 [~ [%sem "hi"]]
2061 [~ [%sem "hi"]]
@@ -1282,6 +2080,24 @@ one of the key-value pairs in `wer`.
1282
2080
1283Reparse object as tuple
2081Reparse object as tuple
1284
2082
2083+Reparser generator. For every key in `wer` that matches a key in the
2084+[`++edge`], the fist in `wer` is applied to the corresponding value in
2085+the [`++edge`](), the results of which are produced in a tuple.
2086+
2087+
2088+Accepts
2089+-------
2090+
2091+`wer` is a [`++pole`]() of [`++cord`]() to [`++fist`]() key-value pairs.
2092+
2093+Produces
2094+--------
2095+
2096+A [`++unit`]() of a tuple XX?
2097+
2098+Source
2099+------
2100+
1285 ++ ot :: object as tuple
2101 ++ ot :: object as tuple
1286 |* wer=(pole ,[cord fist])
2102 |* wer=(pole ,[cord fist])
1287 |= jon=json
2103 |= jon=json
@@ -1290,11 +2106,8 @@ Reparse object as tuple
1290 ?.((za raw) ~ (some (zp raw)))
2106 ?.((za raw) ~ (some (zp raw)))
1291 ::
2107 ::
1292
2108
1293−Reparser generator. For every key in `wer` that matches a key in the
2109+Examples
1294−[`++edge`], the fist in `wer` is applied to the corresponding value in
2110+--------
1295−the [`++edge`](), the results of which are produced in a tuple.
1296−
1297−`wer` is a [`++pole`]() of [`++cord`]() to [`++fist`]() key-value pairs.
1298
2111
1299 ~zod/try=> (jobe [%sem s/'ha'] [%som n/'20'] ~)
2112 ~zod/try=> (jobe [%sem s/'ha'] [%som n/'20'] ~)
1300 [%o p={[p='sem' q=[%s p=~.ha]] [p='som' q=[%n p=~.20]]}]
2113 [%o p={[p='sem' q=[%s p=~.ha]] [p='som' q=[%n p=~.20]]}]
@@ -1303,6 +2116,25 @@ the [`++edge`](), the results of which are produced in a tuple.
1303
2116
1304### `++ot-raw`
2117### `++ot-raw`
1305
2118
2119+Reparser generator. Reparses a map `jom` using `wer`; for every key in
2120+`wer` that matches a key in `map`, the corresponding `++fist` is applied
2121+to the corresponding value in `jom`, the results of which are produced
2122+in a tuple.
2123+
2124+
2125+Accepts
2126+-------
2127+
2128+`wer` is a [`++pole`]() of [`++cord`]() to [`++fist`]() key-value pairs.
2129+
2130+Produces
2131+--------
2132+
2133+A [`++unit`]() of.
2134+
2135+Source
2136+------
2137+
1306 ++ ot-raw :: object as tuple
2138 ++ ot-raw :: object as tuple
1307 |* wer=(pole ,[cord fist])
2139 |* wer=(pole ,[cord fist])
1308 |= jom=(map ,@t json)
2140 |= jom=(map ,@t json)
@@ -1311,10 +2143,8 @@ the [`++edge`](), the results of which are produced in a tuple.
1311 [?~(ten ~ (+.-.wer u.ten)) ((ot-raw +.wer) jom)]
2143 [?~(ten ~ (+.-.wer u.ten)) ((ot-raw +.wer) jom)]
1312 ::
2144 ::
1313
2145
1314−Reparser generator. Reparses a map `jom` using `wer`; for every key in
2146+Examples
1315−`wer` that matches a key in `map`, the corresponding `++fist` is applied
2147+--------
1316−to the corresponding value in `jom`, the results of which are produced
1317−in a tuple.
1318
2148
1319 ~zod/try=> ((ot-raw sem/sa som/ni sem/sa ~):jo (mo [%sem s/'ha'] [%som n/'20'] ~))
2149 ~zod/try=> ((ot-raw sem/sa som/ni sem/sa ~):jo (mo [%sem s/'ha'] [%som n/'20'] ~))
1320 [[~ u="ha"] [~ q=20] [~ u="ha"] ~]
2150 [[~ u="ha"] [~ q=20] [~ u="ha"] ~]
@@ -1325,6 +2155,22 @@ in a tuple.
1325
2155
1326Parse object to map
2156Parse object to map
1327
2157
2158+Reparser modifier. Reparses a [`++json`]() object to a homogenous map
2159+using `wit`.
2160+
2161+Accepts
2162+-------
2163+
2164+`wit` is a [`++fist`]().
2165+
2166+Produces
2167+--------
2168+
2169+A [`++unit`]() of...
2170+
2171+Source
2172+------
2173+
1328 ++ om :: object as map
2174 ++ om :: object as map
1329 |* wit=fist
2175 |* wit=fist
1330 |= jon=json
2176 |= jon=json
@@ -1332,10 +2178,8 @@ Parse object to map
1332 (zm ~(run by p.jon) wit)
2178 (zm ~(run by p.jon) wit)
1333 ::
2179 ::
1334
2180
1335−Reparser modifier. Reparses a [`++json`]() object to a homogenous map
2181+Examples
1336−using `wit`.
2182+--------
1337−
1338−`wit` is a [`++fist`]().
1339
2183
1340 ~zod/try=> ((om ni):jo (jobe [%sap n/'20'] [%sup n/'5'] [%sop n/'177'] ~))
2184 ~zod/try=> ((om ni):jo (jobe [%sap n/'20'] [%sup n/'5'] [%sop n/'177'] ~))
1341 [~ {[p='sup' q=q=5] [p='sop' q=q=177] [p='sap' q=q=20]}]
2185 [~ {[p='sup' q=q=5] [p='sop' q=q=177] [p='sap' q=q=20]}]
@@ -1346,15 +2190,29 @@ using `wit`.
1346
2190
1347Add prefix
2191Add prefix
1348
2192
2193+Reparser modifier. Adds a static prefix `pre` to the parse result of
2194+`wit`. See also: [`++stag`]().
2195+
2196+Accepts
2197+-------
2198+
2199+`pre` is a prefix [`noun`]().
2200+
2201+Produces
2202+--------
2203+
2204+The [`++unit`]() of a cell of [noun]() and the result of parsing `wit`.
2205+
2206+Source
2207+------
2208+
1349 ++ pe :: prefix
2209 ++ pe :: prefix
1350 |* [pre=* wit=fist]
2210 |* [pre=* wit=fist]
1351 (cu |*(a=* [pre a]) wit)
2211 (cu |*(a=* [pre a]) wit)
1352 ::
2212 ::
1353
2213
1354−Reparser modifier. Adds a static prefix `pre` to the parse result of
2214+Examples
1355−`wit`. See also: [`++stag`]().
2215+--------
1356−
1357−`pre` is a prefix [`noun`]().
1358
2216
1359 ~zod/try=> (ni:jo n/'2')
2217 ~zod/try=> (ni:jo n/'2')
1360 [~ q=2]
2218 [~ q=2]
@@ -1369,12 +2227,28 @@ Reparser modifier. Adds a static prefix `pre` to the parse result of
1369
2227
1370Reparse string to tape
2228Reparse string to tape
1371
2229
2230+Reparser modifier. Reparses a [`++json`]() string to a [`++tape`]().
2231+
2232+Accepts
2233+-------
2234+
2235+`jon` is a [`++json`]().
2236+
2237+Produces
2238+--------
2239+
2240+The [`++unit`]() of a [`++tape`]().
2241+
2242+Source
2243+------
2244+
1372 ++ sa :: string as tape
2245 ++ sa :: string as tape
1373 |= jon=json
2246 |= jon=json
1374 ?.(?=([%s *] jon) ~ (some (trip p.jon)))
2247 ?.(?=([%s *] jon) ~ (some (trip p.jon)))
1375 ::
2248 ::
1376
2249
1377−Reparser modifier. Reparses a [`++json`]() string to a [`++tape`]().
2250+Examples
2251+--------
1378
2252
1379 ~zod/try=> (sa:jo s/'value')
2253 ~zod/try=> (sa:jo s/'value')
1380 [~ u="value"]
2254 [~ u="value"]
@@ -1387,12 +2261,28 @@ Reparser modifier. Reparses a [`++json`]() string to a [`++tape`]().
1387
2261
1388Reparse string to cord
2262Reparse string to cord
1389
2263
2264+Reparser modifier. Reparses a string to a [`++cord`]().
2265+
2266+Accepts
2267+-------
2268+
2269+`jon` is a [`++json`]().
2270+
2271+Produces
2272+--------
2273+
2274+The [`++unit`]() of a [`++cord`]().
2275+
2276+Source
2277+------
2278+
1390 ++ so :: string as cord
2279 ++ so :: string as cord
1391 |= jon=json
2280 |= jon=json
1392 ?.(?=([%s *] jon) ~ (some p.jon))
2281 ?.(?=([%s *] jon) ~ (some p.jon))
1393 ::
2282 ::
1394
2283
1395−Reparser modifier. Reparses a string to a [`++cord`]().
2284+Examples
2285+--------
1396
2286
1397 ~zod/try=> (so:jo s/'value')
2287 ~zod/try=> (so:jo s/'value')
1398 [~ u=~.value]
2288 [~ u=~.value]
@@ -1405,6 +2295,21 @@ Reparser modifier. Reparses a string to a [`++cord`]().
1405
2295
1406Reparse string
2296Reparse string
1407
2297
2298+Reparser generator. Produces a reparser that applies `sab` to a string.
2299+
2300+Accepts
2301+-------
2302+
2303+`sab` is a [`++rule`].
2304+
2305+Produces
2306+--------
2307+
2308+A [`++rule`]().
2309+
2310+Source
2311+------
2312+
1408 ++ su :: parse string
2313 ++ su :: parse string
1409 |* sab=rule
2314 |* sab=rule
1410 |= jon=json
2315 |= jon=json
@@ -1412,9 +2317,8 @@ Reparse string
1412 (rush p.jon sab)
2317 (rush p.jon sab)
1413 ::
2318 ::
1414
2319
1415−Reparser generator. Produces a reparser that applies `sab` to a string.
2320+Examples
1416−
2321+--------
1417−`sab` is a [`++rule`]().
1418
2322
1419 ~zod/try=> ((su:jo fed:ag) s/'zod')
2323 ~zod/try=> ((su:jo fed:ag) s/'zod')
1420 [~ 0]
2324 [~ 0]
@@ -1429,9 +2333,25 @@ Reparser generator. Produces a reparser that applies `sab` to a string.
1429
2333
1430Reparse null
2334Reparse null
1431
2335
2336+Reparser modifier. Reparses a null value.
2337+
2338+Accepts
2339+-------
2340+
2341+`jon` is a [`++json`]().
2342+
2343+Produces
2344+--------
2345+
2346+The [`++unit`]() of null.
2347+
2348+Source
2349+------
2350+
1432 ++ ul |=(jon=json ?~(jon (some ~) ~)) :: null
2351 ++ ul |=(jon=json ?~(jon (some ~) ~)) :: null
1433
2352
1434−Reparser modifier. Reparses a null value.
2353+Examples
2354+--------
1435
2355
1436 ~zod/try=> (ul:jo `json`~)
2356 ~zod/try=> (ul:jo `json`~)
1437 [~ u=~]
2357 [~ u=~]
@@ -1446,6 +2366,22 @@ Reparser modifier. Reparses a null value.
1446
2366
1447Pole of nonempty units
2367Pole of nonempty units
1448
2368
2369+Determines if `pod` contains all non-empty units, producing a boolean. Used
2370+internally.
2371+
2372+Accepts
2373+-------
2374+
2375+`pod` is a [`++pole`]() of [`++unit`]().
2376+
2377+Produces
2378+--------
2379+
2380+A boolean.
2381+
2382+Source
2383+------
2384+
1449 ++ za :: full unit pole
2385 ++ za :: full unit pole
1450 |* pod=(pole (unit))
2386 |* pod=(pole (unit))
1451 ?~ pod &
2387 ?~ pod &
@@ -1453,10 +2389,8 @@ Pole of nonempty units
1453 (za +.pod)
2389 (za +.pod)
1454 ::
2390 ::
1455
2391
1456−Determines if `pod` contains no empty units, producing a loobean. Used
2392+Examples
1457−internally.
2393+--------
1458−
1459−`pod` is a [`++pole`]() of [`++unit`]().
1460
2394
1461 ~zod/try=> (za:jo ~[`1 `2 `3])
2395 ~zod/try=> (za:jo ~[`1 `2 `3])
1462 %.y
2396 %.y
@@ -1467,6 +2401,22 @@ internally.
1467
2401
1468Collapse unit list
2402Collapse unit list
1469
2403
2404+Produces a unit of the values of `lut` if every unit in `lut` is
2405+nonempty. Otherwise, produces `~`.
2406+
2407+Accepts
2408+-------
2409+
2410+`lut` is a [`++list`]() of [`++unit`]()s.
2411+
2412+Produces
2413+--------
2414+
2415+A boolean.
2416+
2417+Source
2418+------
2419+
1470 ++ zl :: collapse unit list
2420 ++ zl :: collapse unit list
1471 |* lut=(list (unit))
2421 |* lut=(list (unit))
1472 ?. |- ^- ?
2422 ?. |- ^- ?
@@ -1478,11 +2428,8 @@ Collapse unit list
1478 [i=u:+.i.lut t=$(lut t.lut)]
2428 [i=u:+.i.lut t=$(lut t.lut)]
1479 ::
2429 ::
1480
2430
1481−Produces a unit of the values of `lut` if every unit in `lut` is
2431+Examples
1482−nonempty. Otherwise, produces `~`. If any of the `++unit`s in `lut` are
2432+--------
1483−empty, produces null.
1484−
1485−`lut` is a [`++list`]() of [`++unit`]()s.
1486
2433
1487 ~zod/try=> (zl:jo `(list (unit))`~[`1 `2 `3])
2434 ~zod/try=> (zl:jo `(list (unit))`~[`1 `2 `3])
1488 [~ u=~[1 2 3]]
2435 [~ u=~[1 2 3]]
@@ -1493,7 +2440,22 @@ empty, produces null.
1493
2440
1494### `++zp`
2441### `++zp`
1495
2442
1496−Parses a
2443+XX
2444+
2445+Collapses a `++pole` of `++unit`s `but`, producing a tuple.
2446+
2447+Accepts
2448+-------
2449+
2450+`but` is a [`++pole`]() of [`++unit`]().
2451+
2452+Produces
2453+--------
2454+
2455+??
2456+
2457+Source
2458+------
1497
2459
1498 ++ zp :: unit tuple
2460 ++ zp :: unit tuple
1499 |* but=(pole (unit))
2461 |* but=(pole (unit))
@@ -1503,9 +2465,8 @@ Parses a
1503 [u:->.but (zp +.but)]
2465 [u:->.but (zp +.but)]
1504 ::
2466 ::
1505
2467
1506−Collapses a `++pole` of `++unit`s `but`, producing a tuple.
2468+Examples
1507−
2469+--------
1508−`but` is a [`++pole`]() of [`++unit`]().
1509
2470
1510 ~zod/try=> (zp:jo `(pole (unit))`~[`1 `2 `3])
2471 ~zod/try=> (zp:jo `(pole (unit))`~[`1 `2 `3])
1511 [1 2 3]
2472 [1 2 3]
@@ -1518,6 +2479,24 @@ Collapses a `++pole` of `++unit`s `but`, producing a tuple.
1518
2479
1519Collapse unit map
2480Collapse unit map
1520
2481
2482+Produces a [`++unit`]() of the [`++map`]() `lum` of term to `++unit` key value
2483+pairs, with all of the nonempty values stripped of their `++unit`
2484+wrappers. If any of the `++units` in `lum` are empty, `~` is produced.
2485+See also: [`++zp`](), [`++zl`]().
2486+
2487+Accepts
2488+-------
2489+
2490+`lum` is a map of [`++term`]() to [`++unit`]()s.
2491+
2492+Produces
2493+--------
2494+
2495+The `++unit` of a tuple of what were the key-value pairs of `lum`.
2496+
2497+Source
2498+------
2499+
1521 ++ zm :: collapse unit map
2500 ++ zm :: collapse unit map
1522 |* lum=(map term (unit))
2501 |* lum=(map term (unit))
1523 ?: (~(rep by lum) | |=([[@ a=(unit)] b=?] |(b ?=(~ a))))
2502 ?: (~(rep by lum) | |=([[@ a=(unit)] b=?] |(b ?=(~ a))))
@@ -1525,12 +2504,8 @@ Collapse unit map
1525 (some (~(run by lum) need))
2504 (some (~(run by lum) need))
1526 ::
2505 ::
1527
2506
1528−Produces a `++unit` of the map `lum` of term to `++unit` key value
2507+Examples
1529−pairs, with all of the nonempty values stripped of their `++unit`
2508+--------
1530−wrappers. If any of the `++units` in `lum` are empty, `~` is produced.
1531−See also: [`++zp`](), [`++zl`]().
1532−
1533−`lum` is a map of [`++term`]() to [`++unit`]()s.
1534
2509
1535 ~zod/try=> (zm:jo `(map term (unit ,@u))`(mo a/`4 b/`1 c/`2 ~))
2510 ~zod/try=> (zm:jo `(map term (unit ,@u))`(mo a/`4 b/`1 c/`2 ~))
1536 [~ {[p=%a q=4] [p=%c q=2] [p=%b q=1]}]
2511 [~ {[p=%a q=4] [p=%c q=2] [p=%b q=1]}]
@@ -1549,17 +2524,31 @@ See also: [`++zp`](), [`++zl`]().
1549
2524
1550`++json` from key-value pair
2525`++json` from key-value pair
1551
2526
2527+Produces a ++json object with one key-value pair.
2528+
2529+Accepts
2530+-------
2531+
2532+`p` is a `@t` key.
2533+
2534+`q` is a [`++json`]().
2535+
2536+Produces
2537+--------
2538+
2539+A [`++json`]().
2540+
2541+Source
2542+------
2543+
1552 ++ joba :: object from k-v pair
2544 ++ joba :: object from k-v pair
1553 |= [p=@t q=json]
2545 |= [p=@t q=json]
1554 ^- json
2546 ^- json
1555 [%o [[p q] ~ ~]]
2547 [%o [[p q] ~ ~]]
1556 ::
2548 ::
1557
2549
1558−Produces a ++json object with one key.
2550+Examples
1559−
2551+--------
1560−`p` is a `@t` key.
1561−
1562−`q` is a [`++json`]().
1563
2552
1564 ~zod/try=> (joba %hi %b |)
2553 ~zod/try=> (joba %hi %b |)
1565 [%o p={[p='hi' q=[%b p=%.n]]}]
2554 [%o p={[p='hi' q=[%b p=%.n]]}]
@@ -1574,15 +2563,29 @@ Produces a ++json object with one key.
1574
2563
1575Object from key-value list
2564Object from key-value list
1576
2565
2566+Produces a `++json` object from a [`++list`]() `a` of key to `++json` values.
2567+
2568+Accepts
2569+-------
2570+
2571+`a` is a [`++list`]() of [`++cord`]() to [`++json`]() values.
2572+
2573+Produces
2574+--------
2575+
2576+A `++json`.
2577+
2578+Source
2579+------
2580+
1577 ++ jobe :: object from k-v list
2581 ++ jobe :: object from k-v list
1578 |= a=(list ,[p=@t q=json])
2582 |= a=(list ,[p=@t q=json])
1579 ^- json
2583 ^- json
1580 [%o (~(gas by *(map ,@t json)) a)]
2584 [%o (~(gas by *(map ,@t json)) a)]
1581 ::
2585 ::
1582
2586
1583−Produces a `++json` object from a list `a` of key to `++json` values.
2587+Examples
1584−
2588+--------
1585−`a` is a [`++list`]() of [`++cord`]() to [`++json`]() values.
1586
2589
1587 ~zod/try=> (jobe a/n/'20' b/~ c/a/~[s/'mol'] ~)
2590 ~zod/try=> (jobe a/n/'20' b/~ c/a/~[s/'mol'] ~)
1588 [%o p={[p='a' q=[%n p=~.20]] [p='c' q=[%a p=~[[%s p=~.mol]]]] [p='b' q=~]}]
2591 [%o p={[p='a' q=[%n p=~.20]] [p='c' q=[%a p=~[[%s p=~.mol]]]] [p='b' q=~]}]
@@ -1593,13 +2596,29 @@ Produces a `++json` object from a list `a` of key to `++json` values.
1593
2596
1594`++json` string from tape
2597`++json` string from tape
1595
2598
2599+Produces a [`++json`]() string from a [`++tape`]().
2600+
2601+Accepts
2602+-------
2603+
2604+A [`++tape`]().
2605+
2606+Produces
2607+--------
2608+
2609+A `++json`.
2610+
2611+Source
2612+------
2613+
1596 ++ jape :: string from tape
2614 ++ jape :: string from tape
1597 |= a=tape
2615 |= a=tape
1598 ^- json
2616 ^- json
1599 [%s (crip a)]
2617 [%s (crip a)]
1600 ::
2618 ::
1601
2619
1602−Produces a [`++json`]() string from a [`++tape`]().
2620+Examples
2621+--------
1603
2622
1604 ~zod/try=> (jape ~)
2623 ~zod/try=> (jape ~)
1605 [%s p=~.]
2624 [%s p=~.]
@@ -1614,6 +2633,21 @@ Produces a [`++json`]() string from a [`++tape`]().
1614
2633
1615`++json` number from unigned
2634`++json` number from unigned
1616
2635
2636+Produces a `++json` number from an unsigned atom.
2637+
2638+Accepts
2639+-------
2640+
2641+`a` is an atom of odor [`@u`]().
2642+
2643+Produces
2644+--------
2645+
2646+A [`++json`]().
2647+
2648+Source
2649+------
2650+
1617 ++ jone :: number from unsigned
2651 ++ jone :: number from unsigned
1618 |= a=@u
2652 |= a=@u
1619 ^- json
2653 ^- json
@@ -1622,9 +2656,8 @@ Produces a [`++json`]() string from a [`++tape`]().
1622 (crip (flop |-(^-(tape ?:(=(0 a) ~ [(add '0' (mod a 10)) $(a (div a 10))])))))
2656 (crip (flop |-(^-(tape ?:(=(0 a) ~ [(add '0' (mod a 10)) $(a (div a 10))])))))
1623 ::
2657 ::
1624
2658
1625−Produces a `++json` number from an unsigned atom.
2659+Examples
1626−
2660+--------
1627−`a` is a [`@u`]().
1628
2661
1629 ~zod/try=> (jone 1)
2662 ~zod/try=> (jone 1)
1630 [%n p=~.1]
2663 [%n p=~.1]
@@ -1639,6 +2672,21 @@ Produces a `++json` number from an unsigned atom.
1639
2672
1640Escape JSON character
2673Escape JSON character
1641
2674
2675+Produces a [`++tape`]() of an escaped [`++json`](/doc/hoon/library/3bi#++json) character `a`.
2676+
2677+Accepts
2678+-------
2679+
2680+`a` is an atom of odor [`@tD`](), aka a [`++char`]().
2681+
2682+Produces
2683+--------
2684+
2685+A [`++tape`]().
2686+
2687+Source
2688+------
2689+
1642 ++ jesc
2690 ++ jesc
1643 |= a=@ ^- tape
2691 |= a=@ ^- tape
1644 ?+ a [a ~]
2692 ?+ a [a ~]
@@ -1648,9 +2696,8 @@ Escape JSON character
1648 ==
2696 ==
1649 ::
2697 ::
1650
2698
1651−Produces a `++tape` of an escaped [`++json`](/doc/hoon/library/3bi#++json) character `a`.
2699+Examples
1652−
2700+--------
1653−`a` is an atom
1654
2701
1655 ~zod/try=> (jesc 'a')
2702 ~zod/try=> (jesc 'a')
1656 "a"
2703 "a"
@@ -1661,7 +2708,7 @@ Produces a `++tape` of an escaped [`++json`](/doc/hoon/library/3bi#++json) chara
1661 ~zod/try=> (jesc '"')
2708 ~zod/try=> (jesc '"')
1662 "\""
2709 "\""
1663
2710
1664−### `++scanf`
2711+### `++scanf` XX
1665
2712
1666Formatted scan
2713Formatted scan
1667
2714
@@ -1693,7 +2740,7 @@ collapses the result list to a tuple, such that (scanf "foo 1 2 bar"
1693 ~zod/try=> `@da`(year `date`dat(- [%& -.dat], |6 ~[(div (mul |6.dat (bex 16)) 1.000)]))
2740 ~zod/try=> `@da`(year `date`dat(- [%& -.dat], |6 ~[(div (mul |6.dat (bex 16)) 1.000)]))
1694 ~2014.8.12..23.10.58..ee56
2741 ~2014.8.12..23.10.58..ee56
1695
2742
1696−### `++parsf`
2743+### `++parsf` XX
1697
2744
1698 ++ parsf :: make parser from:
2745 ++ parsf :: make parser from:
1699 |^ |* a=(pole ,_:/(*$&(_rule tape))) :: ;"chars{rule}chars"
2746 |^ |* a=(pole ,_:/(*$&(_rule tape))) :: ;"chars{rule}chars"
@@ -1710,7 +2757,7 @@ the embedded rules' results.
1710
2757
1711Two intermediate arms are used:
2758Two intermediate arms are used:
1712
2759
1713−#### ++norm
2760+#### ++norm XX
1714
2761
1715 :: .= (norm [;"{n}, {n}"]:n=dim:ag) ~[[& dim] [| ", "] [& dim]]:ag
2762 :: .= (norm [;"{n}, {n}"]:n=dim:ag) ~[[& dim] [| ", "] [& dim]]:ag
1716 ++ norm
2763 ++ norm
@@ -1729,7 +2776,7 @@ Two intermediate arms are used:
1729`norm` converts a `;"` pole of `[[%~. [%~. ?(tape _rule)] ~] ~]` into a
2776`norm` converts a `;"` pole of `[[%~. [%~. ?(tape _rule)] ~] ~]` into a
1730more convenient list of discriminated tapes and rules.
2777more convenient list of discriminated tapes and rules.
1731
2778
1732−#### ++bill
2779+#### ++bill XX
1733
2780
1734 :: .= (bill ~[[& dim] [| ", "] [& dim]]:ag)
2781 :: .= (bill ~[[& dim] [| ", "] [& dim]]:ag)
1735 :: ;~(plug dim ;~(pfix com ace ;~(plug dim (easy)))):ag
2782 :: ;~(plug dim ;~(pfix com ace ;~(plug dim (easy)))):ag
@@ -1747,12 +2794,24 @@ sections and producing a list of the rules' results.
1747
2794
1748### `++taco`
2795### `++taco`
1749
2796
2797+Converts an atom to an octet stream [`++octs`](), which contains a length, to
2798+encode trailing zeroes.
2799+
2800+Produces
2801+--------
2802+
2803+An `++octs`.
2804+
2805+Source
2806+------
2807+
1750 ++ taco :: atom to octstream
2808 ++ taco :: atom to octstream
1751 |= tam=@ ^- octs
2809 |= tam=@ ^- octs
1752 [(met 3 tam) tam]
2810 [(met 3 tam) tam]
1753 ::
2811 ::
1754
2812
1755−An [octs] contains a length, to encode trailing zeroes.
2813+Examples
2814+--------
1756
2815
1757 ~zod/try=> (taco 'abc')
2816 ~zod/try=> (taco 'abc')
1758 [p=3 q=6.513.249]
2817 [p=3 q=6.513.249]
@@ -1761,12 +2820,31 @@ An [octs] contains a length, to encode trailing zeroes.
1761
2820
1762### `++tact`
2821### `++tact`
1763
2822
2823+tape to octs
2824+
2825+Converts a `++tape` to an octet stream ([`++octs`](), which contains a length
2826+to encode trailing zeroes.
2827+
2828+Accepts
2829+-------
2830+
2831+A `++tape`.
2832+
2833+Produces
2834+--------
2835+
2836+An [`++octs`]().
2837+
2838+Source
2839+------
2840+
1764 ++ tact :: tape to octstream
2841 ++ tact :: tape to octstream
1765 |= tep=tape ^- octs
2842 |= tep=tape ^- octs
1766 (taco (rap 3 tep))
2843 (taco (rap 3 tep))
1767 ::
2844 ::
1768
2845
1769−octs from tape
2846+Examples
2847+--------
1770
2848
1771 ~zod/try=> (tact "abc")
2849 ~zod/try=> (tact "abc")
1772 [p=3 q=6.513.249]
2850 [p=3 q=6.513.249]
@@ -1775,13 +2853,32 @@ octs from tape
1775
2853
1776### `++tell`
2854### `++tell`
1777
2855
2856+octs from wall
2857+
2858+Converts a [`++wall`]() to an octet stream ([`++octs`](), which contains a length
2859+to encode trailing zeroes.
2860+
2861+Accepts
2862+-------
2863+
2864+`wol` is a [`++wall`]().
2865+
2866+Produces
2867+--------
2868+
2869+An `++octs`.
2870+
2871+Source
2872+------
2873+
1778 ++ tell :: wall to octstream
2874 ++ tell :: wall to octstream
1779 |= wol=wall ^- octs
2875 |= wol=wall ^- octs
1780 =+ buf=(rap 3 (turn wol |=(a=tape (crip (weld a `tape`[`@`10 ~])))))
2876 =+ buf=(rap 3 (turn wol |=(a=tape (crip (weld a `tape`[`@`10 ~])))))
1781 [(met 3 buf) buf]
2877 [(met 3 buf) buf]
1782 ::
2878 ::
1783
2879
1784−octs from wall
2880+Examples
2881+--------
1785
2882
1786 ~zod/try=> (tell ~["abc" "line" "3"])
2883 ~zod/try=> (tell ~["abc" "line" "3"])
1787 [p=11 q=12.330.290.663.108.538.769.039.969]
2884 [p=11 q=12.330.290.663.108.538.769.039.969]
@@ -1794,14 +2891,32 @@ octs from wall
1794
2891
1795### `++txml`
2892### `++txml`
1796
2893
2894+Tape to xml CDATA node
2895+
2896+Converts a [`++tape`]() to an xml CDATA node XX
2897+
2898+Accepts
2899+-------
2900+
2901+`tep` is a [`++tape`]().
2902+
2903+Produces
2904+--------
2905+
2906+A [`++manx`]().
2907+
2908+Source
2909+------
2910+
1797 ++ txml :: string to xml
2911 ++ txml :: string to xml
1798 |= tep=tape ^- manx
2912 |= tep=tape ^- manx
1799 [[%$ [%$ tep] ~] ~]
2913 [[%$ [%$ tep] ~] ~]
1800 ::
2914 ::
1801
2915
1802−Tape to xml CDATA node
2916+Examples
2917+--------
1803
2918
1804 ~zod/try=> (txml "hi")
2919 ~zod/try=> (txml "hi")
1805 [g=[n=%$ a=~[[n=%$ v="hi"]]] c=~]
2920 [g=[n=%$ a=~[[n=%$ v="hi"]]] c=~]
1806 ~zod/try=> (txml "larton bestok")
2921 ~zod/try=> (txml "larton bestok")
1807− [g=[n=%$ a=~[[n=%$ v="larton bestok"]]] c=~]
2922+ [
docs/dev/hoon/library/3bf.md+218−91
@@ -5,23 +5,37 @@ section 3bF, filesystem interface
5
5
6Generate file diff
6Generate file diff
7
7
8− ++ feel :: simple file write
9− |= [pax=path val=*]
10− ^- miso
11− =+ dir=((hard arch) .^(%cy pax))
12− ?~ q.dir [%ins val]
13− :- %mut
14− ^- udon
15− [%a %a .^(%cx pax) val]
16− ::
17−
18Generates a diff between a file located at `pax` and an input value
8Generates a diff between a file located at `pax` and an input value
19`val`.
9`val`.
20
10
11+Accepts
12+-------
13+
21`pax` is a [`++path`]().
14`pax` is a [`++path`]().
22
15
23`val` is a value as a [noun]().
16`val` is a value as a [noun]().
24
17
18+Produces
19+--------
20+
21+A [`++miso`]().
22+
23+Source
24+------
25+
26+ ++ feel :: simple file write
27+ |= [pax=path val=*]
28+ ^- miso
29+ =+ dir=((hard arch) .^(%cy pax))
30+ ?~ q.dir [%ins val]
31+ :- %mut
32+ ^- udon
33+ [%a %a .^(%cx pax) val]
34+ ::
35+
36+Examples
37+--------
38+
25 ~zod/try=> + %/mel 'test'
39 ~zod/try=> + %/mel 'test'
26 + /~zod/try/2/mel
40 + /~zod/try/2/mel
27 ~zod/try=> (feel %/mel 'tesh?')
41 ~zod/try=> (feel %/mel 'tesh?')
@@ -37,18 +51,32 @@ Generates a diff between a file located at `pax` and an input value
37
51
38Simple file load
52Simple file load
39
53
40− ++ file :: simple file load
41− |= pax=path
42− ^- (unit)
43− =+ dir=((hard arch) .^(%cy pax))
44− ?~(q.dir ~ [~ .^(%cx pax)])
45− ::
46−
47Reads the value of a file located at `pax` and renders it as a
54Reads the value of a file located at `pax` and renders it as a
48[`++unit`]().
55[`++unit`]().
49
56
57+Accepts
58+-------
59+
50`pax` is a [`++path`]().
60`pax` is a [`++path`]().
51
61
62+Produces
63+--------
64+
65+The `++unit` of a [`++noun`]().
66+
67+Source
68+------
69+
70+ ++ file :: simple file load
71+ |= pax=path
72+ ^- (unit)
73+ =+ dir=((hard arch) .^(%cy pax))
74+ ?~(q.dir ~ [~ .^(%cx pax)])
75+ ::
76+
77+Examples
78+--------
79+
52 ~zod/try=> %/zak
80 ~zod/try=> %/zak
53 ~zod/try=/zak> :ls %
81 ~zod/try=/zak> :ls %
54 ~zod/try=/zak> + %/mop 20
82 ~zod/try=/zak> + %/mop 20
@@ -66,20 +94,34 @@ Reads the value of a file located at `pax` and renders it as a
66
94
67Write high-level change
95Write high-level change
68
96
69− ++ foal :: high-level write
70− |= [pax=path val=*]
71− ^- toro
72− ?> ?=([* * * *] pax)
73− [i.t.pax [%& [*cart [[t.t.t.pax (feel pax val)] ~]]]]
74− ::
75−
76Produces a [`++toro`](), a change intended for whatever file is located
97Produces a [`++toro`](), a change intended for whatever file is located
77at `pax`. Handled by `%clay`.
98at `pax`. Handled by `%clay`.
78
99
100+Accepts
101+-------
102+
79`pax` is a [`++path`]().
103`pax` is a [`++path`]().
80
104
81`val` is a value as a [noun]().
105`val` is a value as a [noun]().
82
106
107+Produces
108+--------
109+
110+A [`++toro`]().
111+
112+Source
113+------
114+
115+ ++ foal :: high-level write
116+ |= [pax=path val=*]
117+ ^- toro
118+ ?> ?=([* * * *] pax)
119+ [i.t.pax [%& [*cart [[t.t.t.pax (feel pax val)] ~]]]]
120+ ::
121+
122+Examples
123+--------
124+
83 ~zod/try=> + %/mek 'a'
125 ~zod/try=> + %/mek 'a'
84 + /~zod/try/4/mek
126 + /~zod/try/4/mek
85 ~zod/try=> (foal %/mek 'b')
127 ~zod/try=> (foal %/mek 'b')
@@ -94,18 +136,32 @@ at `pax`. Handled by `%clay`.
94
136
95High-level delete
137High-level delete
96
138
97− ++ fray :: high-level delete
98− |= pax=path
99− ^- toro
100− ?> ?=([* * * *] pax)
101− [i.t.pax [%& [*cart [[t.t.t.pax [%del .^(%cx pax)]] ~]]]]
102− ::
103−
104Produces a deletion [`++toro`]() for a file located at path `pax`.
139Produces a deletion [`++toro`]() for a file located at path `pax`.
105Handled by `%clay`.
140Handled by `%clay`.
106
141
142+Accepts
143+-------
144+
107`pax` is a [`++path`]().
145`pax` is a [`++path`]().
108
146
147+Produces
148+--------
149+
150+A `++toro`.
151+
152+Source
153+------
154+
155+ ++ fray :: high-level delete
156+ |= pax=path
157+ ^- toro
158+ ?> ?=([* * * *] pax)
159+ [i.t.pax [%& [*cart [[t.t.t.pax [%del .^(%cx pax)]] ~]]]]
160+ ::
161+
162+Examples
163+--------
164+
109 ~zod/try=> + %/mek 'a'
165 ~zod/try=> + %/mek 'a'
110 + /~zod/try/4/mek
166 + /~zod/try/4/mek
111 ~zod/try=> (fray %/mek)
167 ~zod/try=> (fray %/mek)
@@ -117,22 +173,36 @@ Handled by `%clay`.
117
173
118Unify changes
174Unify changes
119
175
120− ++ furl :: unify changes
121− |= [one=toro two=toro]
122− ^- toro
123− ~| %furl
124− ?> ?& =(p.one p.two) :: same path
125− &(?=(& -.q.one) ?=(& -.q.two)) :: both deltas
126− ==
127− [p.one [%& [*cart (weld q.q.q.one q.q.q.two)]]]
128− ::
129−
130Merge two [`++toro`]()s `one` and `two` that are in the same [`desk`]()
176Merge two [`++toro`]()s `one` and `two` that are in the same [`desk`]()
131and pointed at the same [`++path`]().
177and pointed at the same [`++path`]().
132
178
179+Accepts
180+-------
181+
133−`one` is a [`++toro`]().
182+`one` is a `++toro`.
183+
184+`two` is a `++toro`.
185+
186+Produces
187+--------
188+
189+A `++toro`.
134
190
135−`two` is a [`++toro`]().
191+Source
192+------
193+
194+ ++ furl :: unify changes
195+ |= [one=toro two=toro]
196+ ^- toro
197+ ~| %furl
198+ ?> ?& =(p.one p.two) :: same path
199+ &(?=(& -.q.one) ?=(& -.q.two)) :: both deltas
200+ ==
201+ [p.one [%& [*cart (weld q.q.q.one q.q.q.two)]]]
202+ ::
203+
204+Examples
205+--------
136
206
137 ~zod/try=> %/zak
207 ~zod/try=> %/zak
138 ~zod/try=/zak> :ls %
208 ~zod/try=/zak> :ls %
@@ -150,18 +220,32 @@ and pointed at the same [`++path`]().
150
220
151### `++meat`
221### `++meat`
152
222
153−Kite to .\^ path
223+Kite to .^ path
154−
155− ++ meat :: kite to .^ path
156− |= kit=kite
157− ^- path
158− [(cat 3 'c' p.kit) (scot %p r.kit) s.kit (scot `dime`q.kit) t.kit]
159− ::
160
224
161Converts a type request name to a [`++path`]().
225Converts a type request name to a [`++path`]().
162
226
227+Accepts
228+-------
229+
163`kit` is a [`++kite`]().
230`kit` is a [`++kite`]().
164
231
232+Produces
233+--------
234+
235+A `++path`.
236+
237+Source
238+------
239+
240+ ++ meat :: kite to .^ path
241+ |= kit=kite
242+ ^- path
243+ [(cat 3 'c' p.kit) (scot %p r.kit) s.kit (scot `dime`q.kit) t.kit]
244+ ::
245+
246+Examples
247+--------
248+
165 zod/try=/zop> `kite`[%x ud/1 ~zod %main /sur/down/gate/hook]
249 zod/try=/zop> `kite`[%x ud/1 ~zod %main /sur/down/gate/hook]
166 [p=%x q=[%ud p=1] r=~zod s=%main t=/sur/down/gate/hook]
250 [p=%x q=[%ud p=1] r=~zod s=%main t=/sur/down/gate/hook]
167 ~zod/try=/zop> (meat [%x ud/1 ~zod %main /sur/down/gate/hook])
251 ~zod/try=/zop> (meat [%x ud/1 ~zod %main /sur/down/gate/hook])
@@ -185,34 +269,48 @@ Converts a type request name to a [`++path`]().
185
269
186Parse kite path
270Parse kite path
187
271
188− ++ tame :: parse kite path
189− |= hap=path
190− ^- (unit kite)
191− ?. ?=([@ @ @ @ *] hap) ~
192− =+ :* hyr=(slay i.hap)
193− fal=(slay i.t.hap)
194− dyc=(slay i.t.t.hap)
195− ved=(slay i.t.t.t.hap)
196− :: ved=(slay i.t.hap)
197− :: fal=(slay i.t.t.hap)
198− :: dyc=(slay i.t.t.t.hap)
199− tyl=t.t.t.t.hap
200− ==
201− ?. ?=([~ %$ %tas @] hyr) ~
202− ?. ?=([~ %$ %p @] fal) ~
203− ?. ?=([~ %$ %tas @] dyc) ~
204− ?. ?=([~ %$ case] ved) ~
205− =+ his=`@p`q.p.u.fal
206− =+ [dis=(end 3 1 q.p.u.hyr) rem=(rsh 3 1 q.p.u.hyr)]
207− ?. ?&(?=(%c dis) ?=(?(%v %w %x %y %z) rem)) ~
208− [~ rem p.u.ved q.p.u.fal q.p.u.dyc tyl]
209− ::
210−
211Parses a clay [.\^]()
272Parses a clay [.\^]()
212[`++path` ]()to request details. Produces the [`++unit`]() of a [`++kite`]().
273[`++path` ]()to request details. Produces the [`++unit`]() of a [`++kite`]().
213
274
275+Accepts
276+-------
277+
214`hap` is a [`++path`]().
278`hap` is a [`++path`]().
215
279
280+Produces
281+--------
282+
283+A `(unit kite)`.
284+
285+Source
286+------
287+
288+ ++ tame :: parse kite path
289+ |= hap=path
290+ ^- (unit kite)
291+ ?. ?=([@ @ @ @ *] hap) ~
292+ =+ :* hyr=(slay i.hap)
293+ fal=(slay i.t.hap)
294+ dyc=(slay i.t.t.hap)
295+ ved=(slay i.t.t.t.hap)
296+ :: ved=(slay i.t.hap)
297+ :: fal=(slay i.t.t.hap)
298+ :: dyc=(slay i.t.t.t.hap))
299+ tyl=t.t.t.t.hap
300+ ==
301+ ?. ?=([~ %$ %tas @] hyr) ~
302+ ?. ?=([~ %$ %p @] fal) ~
303+ ?. ?=([~ %$ %tas @] dyc) ~
304+ ?. ?=([~ %$ case] ved) ~
305+ =+ his=`@p`q.p.u.fal
306+ =+ [dis=(end 3 1 q.p.u.hyr) rem=(rsh 3 1 q.p.u.hyr)]
307+ ?. ?&(?=(%c dis) ?=(?(%v %w %x %y %z) rem)) ~
308+ [~ rem p.u.ved q.p.u.fal q.p.u.dyc tyl]
309+ ::
310+
311+Examples
312+--------
313+
216 ~zod/try=/zop> (tame /cx/~zod/main/1/sur/down/gate/hook)
314 ~zod/try=/zop> (tame /cx/~zod/main/1/sur/down/gate/hook)
217 [~ [p=%x q=[%ud p=1] r=~zod s=%main t=/sur/down/gate/hook]]
315 [~ [p=%x q=[%ud p=1] r=~zod s=%main t=/sur/down/gate/hook]]
218 ~zod/try=/zop> (tame /cx/0/main/1/sur/down/gate/hook)
316 ~zod/try=/zop> (tame /cx/0/main/1/sur/down/gate/hook)
@@ -224,21 +322,37 @@ Parses a clay [.\^]()
224
322
225Parse path to beam
323Parse path to beam
226
324
227− ++ tome :: parse path to beam
325+Parses a [`++path`]() `pax` to a [`++beam](), a well-typed location.
228− |= pax=path
326+
229− ^- (unit beam)
327+Accepts
230− ?. ?=([* * * *] pax) ~
328+-------
231− %+ biff (slaw %p i.pax)
329+
232− |= who=ship
330+`pax` is a [`++path`]().
233− %+ biff (slaw %tas i.t.pax)
331+
234− |= dex=desk
332+Produces
235− %+ biff (slay i.t.t.pax)
333+--------
236− |= cis=coin
334+
237− ?. ?=([%$ case] cis) ~
335+A `(unit beam)`.
238− `(unit beam)`[~ [who dex `case`p.cis] (flop t.t.t.pax)]
239− ::
240
336
241−Parses a [`++path`]() `pax` to a [\`++beam](), a well-typed location.
337+Source
338+------
339+
340+ ++ tome :: parse path to beam
341+ |= pax=path
342+ ^- (unit beam)
343+ ?. ?=([* * * *] pax) ~
344+ %+ biff (slaw %p i.pax)
345+ |= who=ship
346+ %+ biff (slaw %tas i.t.pax)
347+ |= dex=desk
348+ %+ biff (slay i.t.t.pax)
349+ |= cis=coin
350+ ?. ?=([%$ case] cis) ~
351+ `(unit beam)`[~ [who dex `case`p.cis] (flop t.t.t.pax)]
352+ ::
353+
354+Examples
355+--------
242
356
243 ~zod/try=/zop> (tome /~fyr/try/2/for/me)
357 ~zod/try=/zop> (tome /~fyr/try/2/for/me)
244 [~ [[p=~fyr q=%try r=[%ud p=2]] s=/me/for]]
358 [~ [[p=~fyr q=%try r=[%ud p=2]] s=/me/for]]
@@ -249,13 +363,26 @@ Parses a [`++path`]() `pax` to a [\`++beam](), a well-typed location.
249 ~zod/try=/zop> (tome /~zod/main/0x12)
363 ~zod/try=/zop> (tome /~zod/main/0x12)
250 ~
364 ~
251
365
252−### `++tope :: beam to path`
366+### `++tope`
253
367
254Parse beam to path
368Parse beam to path
255
369
256− |= bem=beam
370+Parses a [`++beam`]() `bem` to a [`++path`]().
257− ^- path
371+
258− [(scot %p p.bem) q.bem (scot r.bem) (flop s.bem)]
372+Accepts
373+-------
374+
375+`bem` is a `++beam`.
376+
377+Produces
378+--------
379+
380+A `++path`.
381+
382+ ++tope
383+ |= bem=beam
384+ ^- path
385+ [(scot %p p.bem) q.bem (scot r.bem) (flop s.bem)]
259
386
260Parses a [`++beam`]() to a [`++path`](/doc/hoon/library/1#++path).
387Parses a [`++beam`]() to a [`++path`](/doc/hoon/library/1#++path).
261
388
docs/dev/hoon/library/3bg.md+787−305

This diff is too big to show here.

docs/dev/hoon/library/3bh.md+102−9

This diff is too big to show here.

docs/dev/hoon/library/3bi.md+2076

This diff is too big to show here.

docs/dev/hoon/reference/cheat-sheet.mdnew file+532

This diff is too big to show here.

docs/dev/hoon/runes/bc.mddeleted−49

This diff is too big to show here.

docs/dev/hoon/runes/bc/bcbr.md+13−24

This diff is too big to show here.

docs/dev/hoon/runes/bc/bccb.md+18−9

This diff is too big to show here.

docs/dev/hoon/runes/bc/bccl.md+14−14

This diff is too big to show here.

docs/dev/hoon/runes/bc/bccm.mddeleted−61

This diff is too big to show here.

docs/dev/hoon/runes/bc/bccn.md+7−19

This diff is too big to show here.

docs/dev/hoon/runes/bc/bckt.mddeleted−49

This diff is too big to show here.

docs/dev/hoon/runes/bc/bcls.md+11−16

This diff is too big to show here.

docs/dev/hoon/runes/bc/bcpm.md+8−17

This diff is too big to show here.

docs/dev/hoon/runes/bc/bcpt.mddeleted−37

This diff is too big to show here.

docs/dev/hoon/runes/bc/bctr.md+10−7

This diff is too big to show here.

docs/dev/hoon/runes/bc/bcts.md+18−12

This diff is too big to show here.

docs/dev/hoon/runes/bc/bcwt.md+9−15

This diff is too big to show here.

docs/dev/hoon/runes/bc/bczp.mddeleted−40

This diff is too big to show here.

docs/dev/hoon/runes/br.mddeleted−47

This diff is too big to show here.

docs/dev/hoon/runes/br/brcb.md+14−33

This diff is too big to show here.

docs/dev/hoon/runes/br/brcn.md+12−32

This diff is too big to show here.

docs/dev/hoon/runes/br/brdt.md+8−21

This diff is too big to show here.

docs/dev/hoon/runes/br/brfs.md+12−28

This diff is too big to show here.

docs/dev/hoon/runes/br/brhp.md+7−23

This diff is too big to show here.

docs/dev/hoon/runes/br/brkt.md+9−27

This diff is too big to show here.

docs/dev/hoon/runes/br/brls.md+10−24

This diff is too big to show here.

docs/dev/hoon/runes/br/brtr.md+11−26

This diff is too big to show here.

docs/dev/hoon/runes/br/brts.md+9−20

This diff is too big to show here.

docs/dev/hoon/runes/br/brwt.md+10−16

This diff is too big to show here.

docs/dev/hoon/runes/cl.mddeleted−44

This diff is too big to show here.

docs/dev/hoon/runes/cl/clcb.md+7−13

This diff is too big to show here.

docs/dev/hoon/runes/cl/clfs.md+7−17

This diff is too big to show here.

docs/dev/hoon/runes/cl/clhp.md+10−16

This diff is too big to show here.

docs/dev/hoon/runes/cl/clkt.md+8−15

This diff is too big to show here.

docs/dev/hoon/runes/cl/clls.md+7−14

This diff is too big to show here.

docs/dev/hoon/runes/cl/clsg.md+8−10

This diff is too big to show here.

docs/dev/hoon/runes/cl/cltr.md+9−10

This diff is too big to show here.

docs/dev/hoon/runes/cn.mddeleted−41

This diff is too big to show here.

docs/dev/hoon/runes/cn/cncb.md+23−23

This diff is too big to show here.

docs/dev/hoon/runes/cn/cncl.mddeleted−55

This diff is too big to show here.

docs/dev/hoon/runes/cn/cndt.md+10−19

This diff is too big to show here.

docs/dev/hoon/runes/cn/cnhp.md+16−9

This diff is too big to show here.

docs/dev/hoon/runes/cn/cnkt.md+7−24

This diff is too big to show here.

docs/dev/hoon/runes/cn/cnls.md+9−16

This diff is too big to show here.

docs/dev/hoon/runes/cn/cnsg.md+15−8

This diff is too big to show here.

docs/dev/hoon/runes/cn/cntr.md+4−16

This diff is too big to show here.

docs/dev/hoon/runes/cn/cnts.md+10−13

This diff is too big to show here.

docs/dev/hoon/runes/cn/cnzy.mddeleted−40

This diff is too big to show here.

docs/dev/hoon/runes/cn/cnzz.mddeleted−43

This diff is too big to show here.

docs/dev/hoon/runes/dt.mddeleted−33

This diff is too big to show here.

docs/dev/hoon/runes/dt/dtkt.md+9−14

This diff is too big to show here.

docs/dev/hoon/runes/dt/dtls.md+7−7

This diff is too big to show here.

docs/dev/hoon/runes/dt/dttr.md+8−15

This diff is too big to show here.

docs/dev/hoon/runes/dt/dtts.md+9−15

This diff is too big to show here.

docs/dev/hoon/runes/dt/dtwt.md+8−14

This diff is too big to show here.

docs/dev/hoon/runes/dt/dtzz.md−5

This diff is too big to show here.

docs/dev/hoon/runes/hx.mddeleted−19

This diff is too big to show here.

docs/dev/hoon/runes/hx/hxgl.md+3−4

This diff is too big to show here.

docs/dev/hoon/runes/kt.mddeleted−40

This diff is too big to show here.

docs/dev/hoon/runes/kt/ktbr.md+10−25

This diff is too big to show here.

docs/dev/hoon/runes/kt/ktdt.md+11−20

This diff is too big to show here.

docs/dev/hoon/runes/kt/kthp.md+10−22

This diff is too big to show here.

docs/dev/hoon/runes/kt/ktls.md+11−24

This diff is too big to show here.

docs/dev/hoon/runes/kt/ktsg.md+10−16

This diff is too big to show here.

docs/dev/hoon/runes/kt/ktts.md+7−6

This diff is too big to show here.

docs/dev/hoon/runes/kt/ktwt.md+4−13

This diff is too big to show here.

docs/dev/hoon/runes/sg.mddeleted−32

This diff is too big to show here.

docs/dev/hoon/runes/sg/sgbc.md+6−12

This diff is too big to show here.

docs/dev/hoon/runes/sg/sgbr.md+8−16

This diff is too big to show here.

docs/dev/hoon/runes/sg/sgcb.md+8−13

This diff is too big to show here.

docs/dev/hoon/runes/sg/sgcn.md+8−17

This diff is too big to show here.

docs/dev/hoon/runes/sg/sgfs.md+8−14

This diff is too big to show here.

docs/dev/hoon/runes/sg/sggl.md+5−10

This diff is too big to show here.

docs/dev/hoon/runes/sg/sggr.md+6−11

This diff is too big to show here.

docs/dev/hoon/runes/sg/sgls.md+7−13

This diff is too big to show here.

docs/dev/hoon/runes/sg/sgpm.md+9−10

This diff is too big to show here.

docs/dev/hoon/runes/sg/sgts.md+8−13

This diff is too big to show here.

docs/dev/hoon/runes/sg/sgwt.md+10−15

This diff is too big to show here.

docs/dev/hoon/runes/sg/sgzp.md+3−3

This diff is too big to show here.

docs/dev/hoon/runes/sm/smcl.md+8−6

This diff is too big to show here.

docs/dev/hoon/runes/sm/smcn.md+9−20

This diff is too big to show here.

docs/dev/hoon/runes/sm/smdq.md+5−15

This diff is too big to show here.

docs/dev/hoon/runes/sm/smhp.md+6−16

This diff is too big to show here.

docs/dev/hoon/runes/sm/smls.md+3−13

This diff is too big to show here.

docs/dev/hoon/runes/sm/smsg.md+5−10

This diff is too big to show here.

docs/dev/hoon/runes/sm/smsm.md+5−10

This diff is too big to show here.

docs/dev/hoon/runes/sm/smtr.md+7−18

This diff is too big to show here.

docs/dev/hoon/runes/sm/smzz.md+6−11

This diff is too big to show here.

docs/dev/hoon/runes/ts.mddeleted−49

This diff is too big to show here.

docs/dev/hoon/runes/ts/tsbr.md+9−17

This diff is too big to show here.

docs/dev/hoon/runes/ts/tscl.md+7−21

This diff is too big to show here.

docs/dev/hoon/runes/ts/tsdt.md+7−10

This diff is too big to show here.

docs/dev/hoon/runes/ts/tsgl.md+8−11

This diff is too big to show here.

docs/dev/hoon/runes/ts/tsgr.md+4−15

This diff is too big to show here.

docs/dev/hoon/runes/ts/tshp.md+9−16

This diff is too big to show here.

docs/dev/hoon/runes/ts/tskt.md+11−10

This diff is too big to show here.

docs/dev/hoon/runes/ts/tsls.md+7−16

This diff is too big to show here.

docs/dev/hoon/runes/ts/tssg.md+5−9

This diff is too big to show here.

docs/dev/hoon/runes/ts/tstr.md+7−10

This diff is too big to show here.

docs/dev/hoon/runes/wt.mddeleted−39

This diff is too big to show here.

docs/dev/hoon/runes/wt/wtbr.md+7−8

This diff is too big to show here.

docs/dev/hoon/runes/wt/wtcl.md+7−23

This diff is too big to show here.

docs/dev/hoon/runes/wt/wtdt.md+8−21

This diff is too big to show here.

docs/dev/hoon/runes/wt/wtgl.md+7−19

This diff is too big to show here.

docs/dev/hoon/runes/wt/wtgr.md+7−19

This diff is too big to show here.

docs/dev/hoon/runes/wt/wthp.md+9−23

This diff is too big to show here.

docs/dev/hoon/runes/wt/wthz.md+1−1

This diff is too big to show here.

docs/dev/hoon/runes/wt/wtkt.md+7−15

This diff is too big to show here.

docs/dev/hoon/runes/wt/wtls.md+10−21

This diff is too big to show here.

docs/dev/hoon/runes/wt/wtpm.md+7−8

This diff is too big to show here.

docs/dev/hoon/runes/wt/wtpt.md+7−13

This diff is too big to show here.

docs/dev/hoon/runes/wt/wtsg.md+8−12

This diff is too big to show here.

docs/dev/hoon/runes/wt/wtts.md+6−12

This diff is too big to show here.

docs/dev/hoon/runes/wt/wttz.md+2−2

This diff is too big to show here.

docs/dev/hoon/runes/wt/wtzp.md+7−7

This diff is too big to show here.

docs/dev/hoon/runes/zp.mddeleted−23

This diff is too big to show here.

docs/dev/hoon/runes/zp/zpcb.md+8−8

This diff is too big to show here.

docs/dev/hoon/runes/zp/zpcm.md+9−14

This diff is too big to show here.

docs/dev/hoon/runes/zp/zpfs.md+4−9

This diff is too big to show here.

docs/dev/hoon/runes/zp/zpgr.md+9−14

This diff is too big to show here.

docs/dev/hoon/runes/zp/zpsm.md+5−10

This diff is too big to show here.

docs/dev/hoon/runes/zp/zpts.md+8−13

This diff is too big to show here.

docs/dev/hoon/runes/zp/zpwt.md+5−15

This diff is too big to show here.

docs/dev/hoon/runes/zp/zpzp.md+11−17

This diff is too big to show here.

docs/user/clay.md+14−16

This diff is too big to show here.