8## Irregular forms, a compilation
13*Original `fora` post* [*here*](http://urbit.org/fora/posts/~2016.12.29..19.37.08..89d5~/).
16Headings contain runes, phonetics and tokens. Description contains a link to the docs and a short description of the rune. Both regular (R) and irregular (I) forms are given.
18Want to `ctrl-f` to find out the meaning of something weird you saw? Search for `\symbol`. ie `\?` or `\=`. It'll show you to the irregular forms that uses that symbol.
22Anything Nock can do, Hoon can do also.
26[docs](https://urbit.org/docs/hoon/twig/dot-nock/lus-bump/) \\+
27`{$bump p/atom}`: increment an atom with Nock 4.
34[docs](https://urbit.org/docs/hoon/twig/dot-nock/tis-same/) \\=
35`{$same p/seed q/seed}`: test for equality with Nock 5.
42Miscellaneous useful macros.
46[docs](https://urbit.org/docs/hoon/twig/sem-make/col-wad/) \\:
47`{$wad p/seed q/(list seed)}`: call a binary function as an n-ary function.
58[docs](https://urbit.org/docs/hoon/twig/col-cell/hep-cons/) \\[\\]\\^\\+\\\`\\~
59`{$cons p/seed q/seed}`: construct a cell (2-tuple).
76Flow twigs change the subject. All non-flow twigs (except cores) pass the subject down unchanged.
80[docs](https://urbit.org/docs/hoon/twig/tis-flow/gal-rap/) \\:
81`{$rap p/seed q/seed}`: compose two twigs, inverted.
88[docs](https://urbit.org/docs/hoon/twig/bar-core/) \\$
89Core twigs are flow twigs.
91Technically not irregular syntax, but worth mentioning.
98The above runes produce a core with a single arm, named `$` (or `:moar`). We can recompute this arm with changes, useful for recursion among other things. Commonly used with the irregular syntax for `%=`, `:make`, like so: `$()`.
102The invocation family of twigs.
106[docs](https://urbit.org/docs/hoon/twig/cen-call/tis-make/) \\(\\)
107`{$make p/wing q/(list (pair wing seed))}`: take a wing with changes.
114[docs](https://urbit.org/docs/hoon/twig/cen-call/sig-open/) \\~
115`{$cnsg p/wing q/seed r/seed}`: call with multi-armed door.
122[docs](https://urbit.org/~~/docs/hoon/twig/cen-call/hep-call/) \\(\\)
123`{$call p/seed q/seed}`: call a gate (function).
128Note: `(p)` becomes `$:p` (`=<($ p)`), which behaves as you would expect (func call w/o args).
132A mold is a gate (function) that helps us build simple and rigorous data structures.
136[docs](https://urbit.org/docs/hoon/twig/buc-mold/col-bank/) \\{\\}
137`{$bank p/(list moss)}`: form a mold which recognizes a tuple.
144[docs](https://urbit.org/docs/hoon/twig/buc-mold/tis-coat/) \\/
145`{$coat p/@tas q/moss}`: mold which wraps a face around another mold.
152[docs](https://urbit.org/docs/hoon/twig/buc-mold/wut-pick/) \\?
153`{$pick p/(list moss)}`: mold which normalizes a general union.
160[docs](https://urbit.org/docs/hoon/twig/buc-mold/cab-shoe/) \\_
161`{$shoe p/seed}`: mold which normalizes to an example.
168Hoon has the usual branches and logical tests.
172[docs](https://urbit.org/docs/hoon/twig/wut-test/zap-not/) \\!
173`{$not p/seed}`: logical not.
180[docs](https://urbit.org/docs/hoon/twig/wut-test/pam-and/) \\&
181`{$and p/(list seed)}`: logical and.
188[docs](https://urbit.org/docs/hoon/twig/wut-test/bar-or/) \\|
189`{$or p/(list seed)}`: logical or.
196Lets us adjust spans without violating type constraints.
200[docs](https://urbit.org/docs/hoon/twig/ket-cast/hep-cast/) \\\`
201`{$cast p/moss q/seed}`: typecast by mold.
208[docs](https://urbit.org/docs/hoon/twig/ket-cast/tis-name/) \\=
209`{$name p/toga q/seed}`: name a value.
232* `%a` constant `a`, where `a` can be an ((ir)regularly defined) atom or a symbol.
234See [:sand](https://urbit.org/docs/hoon/twig/atom/sand/) for other irregular definitions of atoms.
237* `&n` nth element of a list.
238* `|n` tail of list after nth element (i.e. n is the head).
242[docs](https://urbit.org/docs/hoon/twig/limb/limb/) \\+\\.\\^
243`{$limb p/(each @ud {p/@ud q/@tas})}`: attribute of subject.
246* `.` is the whole subject (slot 1)
247* `^a` is the `a` "of a higher scope", i.e. "resolve variable a, ignoring the first one found".
248* `^^p` even higher, etc.
249* 'Lark' syntax for slots / tree addressing:
265[docs](https://urbit.org/~~/docs/hoon/twig/limb/wing/) \\.
266`{$wing p/(list limb)`; a limb search path.
268`a.b` finds limb `a` within limb `b` ("var" `a` within "var" `b`).
272* `<a b c>` prints a [tape](https://urbit.org/docs/hoon/library/2q/#-tape).
273* `>a b c<` prints a [tank](https://urbit.org/docs/hoon/library/2q/#-tank).
277 In our in-house examples throughout our documentation, we use irregular forms instead of regular for the sake of verbosity. But remember with irregular forms: everything is just runes! Like magic. In general, irregular forms (usually) read better, but of course regular forms provide more information about what you're doing by showing you the full rune. Of course, it's up to you, the Hoon programmer, as to whether or not you want to use these.
279 ##### If we missed any, or if you saw something weird that's not in here, feel free to comment below!
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list