From 8eacf51ab729e40164484f975ad1d2425eb9556a Mon Sep 17 00:00:00 2001 From: johncburnham Date: Fri, 1 Aug 2014 14:14:23 -0700 Subject: [PATCH] sane doc structure --- urb/zod/main/doc/ref/doc-split-me.txt | 8780 ----------------- urb/zod/main/doc/ref/originalUnsplitDocs.txt | 8780 ----------------- .../main/doc/ref/splitDocs/ForwardNock.txt | 2 - .../main/doc/ref/splitDocs/hoonPreface.txt | 2 - urb/zod/main/doc/ref/splitDocs/volume0.txt | 15 - urb/zod/main/doc/ref/splitDocs/volume1.txt | 2705 ----- urb/zod/main/doc/ref/splitDocs/volume2.txt | 5967 ----------- urb/zod/main/doc/ref/splitDocs/volume3.txt | 90 - 8 files changed, 26341 deletions(-) delete mode 100644 urb/zod/main/doc/ref/doc-split-me.txt delete mode 100644 urb/zod/main/doc/ref/originalUnsplitDocs.txt delete mode 100644 urb/zod/main/doc/ref/splitDocs/ForwardNock.txt delete mode 100644 urb/zod/main/doc/ref/splitDocs/hoonPreface.txt delete mode 100644 urb/zod/main/doc/ref/splitDocs/volume0.txt delete mode 100644 urb/zod/main/doc/ref/splitDocs/volume1.txt delete mode 100644 urb/zod/main/doc/ref/splitDocs/volume2.txt delete mode 100644 urb/zod/main/doc/ref/splitDocs/volume3.txt diff --git a/urb/zod/main/doc/ref/doc-split-me.txt b/urb/zod/main/doc/ref/doc-split-me.txt deleted file mode 100644 index 37d8a4c6a..000000000 --- a/urb/zod/main/doc/ref/doc-split-me.txt +++ /dev/null @@ -1,8780 +0,0 @@ -Foreword -Nock - -Hoon -Preface - -volume 0, version stub - - ++ stub - Declares the current Hoon version number in degrees Kelvin. - - In Kelvin versioning -the true Martian way to permanently freeze a - system- releases count down by integer degrees Kelvin. At absolute - zero, the system can no longer be changed. At 1K, one more - modification is possible. And so on. - --- - ~zod/try=> stub - 164 - --- - -volume 1, Hoon models - - ++ abel - XX biblical - --- - Aliases ++typo. [#typo] - --- - - ++ axis - A Nock axis, an address inside a Nock noun. - --- - Clammed atom [#axil]. - --- - - ++ also - XX unused? - - ++ base - The cases of an %axil tile [#tile]. - --- - See %axil in ++tile. --- - - ++ beer - ++ beet - - ++ bloq - An atom representing a blocksize, by convention expressed as a power of 2. - - Clammed atom [#axil]. - --- - ++met measures how many bloqs long an atom is. It takes a bloq - and an atom. In the below example, the 256 is 2 bloqs of 2^3 long. That - is, it takes two bytes to represent the atom 256 - - ~zod/try=> (met 3 256) - 2 - --- - - ++ calf - - ++ char - A single character. - --- - Atom with odor [#type]. A @tD is a single Unicode byte. - --- - ++tape [#tape], which is a string type, is a list of chars. - --- - - ++ chum - The jet hint information that must be present in the body of a ~/ - or ~% rune. - --- - A %fern of the following cases: - - the jet's name - - the jet's name and the kelvin number - - the jet's vendor, name and kelvin number - - the jet's vendor, name, legacy major.minor version and kelvin number - --- - - ++ claw - XX unused? - - ++ coat - ++ coil - ++ coin - - ++ cord - One of Hoon's two string types (the other being ++tape). A cord is an - atom of UTF-8 text. - --- - Atom with odor. @t is a Unicode atom. The order of bytes in a @t are - little-endian, i.e. the first character in the text is the low byte of - the atom. - --- - ~zod/try=> `@ux`'foobar' - 0x7261.626f.6f66 - --- - - ++ date - A point in time. - --- - A loobean designating AD or BC, a year atom, a month atom, and a ++tarp - , which is a day atom and a time. - --- - ++yell produces a ++date from a @da (a date atom) - - ~zod/try=> (yell ~2014.6.6..21.09.15..0a16) - [d=106.751.991.820.172 h=21 m=9 s=15 f=~[0xa16]] - --- - - ++ dime - ++ dram - The structure of a unix filesystem tree. - --- - One of two cases: - | a directory - a map of names to deeper tree structures. - % a file - a numbered atom of data. - --- - Cards %dire and %pour in zuse require a ++dram argument to target. - --- - ++ each - ++ edge - ++ foot - ++ gear - ++ hair - ++ hapt - ++ like - ++ limb - ++ line - ++ list - ++ mane - ++ mano - ++ manx - ++ marl - ++ mars - ++ mart - ++ marx - ++ metl - ++ null - ++ odor - ++ tarp - ++ time - ++ tree - ++ nail - ++ numb - ++ pair - ++ pass - ++ path - ++ pint - ++ port - ++ post - ++ prop - ++ qual - ++ rege - ++ ring - ++ rule - ++ span - A restricted text atom for canonical atom syntaxes. The prefix is `~.`. - There are no escape sequences except `~~`, which means `~`, and `~-`, - which means `_`. - and . encode themselves. No other characters - besides numbers and lowercase letters are permitted. - --- - ~zod/try=> `@t`~.foo - 'foo' - --- - ~zod/try=> `@t`~.foo.bar - 'foo.bar' - --- - ~zod/try=> `@t`~.foo~~bar - 'foo~bar' - --- - ~zod/try=> `@t`~.foo~-bar - 'foo_bar' - --- - ~zod/try=> `@t`~.foo-bar - 'foo-bar' - --- - ++ spot - ++ tank - ++ tape - One of Hoon's two string types (the other being ++cord). A tape is a - list of chars. - --- - ~zod/try=> `(list ,char)`"foobar" - "foobar" - --- - ~zod/try=> `(list ,@)`"foobar" - ~[102 111 111 98 97 114] - --- - ++ term - A restricted text atom for Hoon constants. The only characters - permitted are lowercase ASCII, - except as the first or last character, - and 0-9 except as the first character. - - The syntax for @tas is the text itself, always preceded by %. This - means a term is always cubical. You can cast it to @tas if you like, - but we just about always want the cube: - --- - ~zod/try=> %dead-fish9 - %dead-fish9 - --- - ~zod/try=> -:!>(%dead-fish9) - [%cube p=271.101.667.197.767.630.546.276 q=[%atom p=%tas]] - --- - The empty @tas has a special syntax, $: - - ~zod/try=> %$ - %$ - --- - A term without % is not a constant, but a name: - - ~zod/try=> dead-fish9 - ! -find-limb.dead-fish9 - ! find-none - ! exit - --- - - ++ tiki - - ++ tile - - A tile is a convenient way of making a well-typed noun. It can be - reduced in four ways - cryptically called bunt, clam, - fish, and whip. each tile corresponds to a well-defined - type, called its icon. A tile is converted statically into a twig, - which in turn may (depending on the conversion) produce the icon, test - for it, etc. And always, the icon is some function of the tile and its - subject. - --- - There are nine cases within ++tile: - - [p=tile q=tile] - - Tiles autocons, just like twigs - a cell of tiles is a tile of a - cell. - - (,[@ @] [4 5]) is [4 5], which is the same as [(,@ 4) (,@ 5)], - producing [4 5]. Clearly, (,[@ @] [4 5]) should not be the same as - [(,@ [4 5]) (,@ [4 5])] - which would produce merely [0 0].) - - The irregular wide syntax for tile autocons is the same as the - syntax for twig autocons - eg, [@ @], a cell of atoms. But there is - also a regular tall/wide tuple syntax, with $: (buccol, %bccl). - Thus instead of [@ @] we could write: - - $: @ - @ - == - - [%axil p=base] - - An %axil is a simple built-in mechanism for a few basic icons: an - atom of any odor (@odor, or just @ for the odorless base atom); a - noun (*); a cell of nouns (^); a loobean ?; and null ~. - - [%bark p=term q=tile] - - Wrap a name round a tile. a=* parses as [%bark %a %noun]. - - This is another case where the tile syntax matches the twig syntax, - but only in the irregular form. The twig equivalent of %bark is of - course ^= (kettis, %ktts). But the tile is $= (buctis): - - $= a - * - - Obviously a silly syntactic arrangement. But you can need it if q - is really big. - - [%bush p=tile q=tile] - - A %bush is a tile in which there are two kinds of nouns: cells - whose head is a cell (tile p) and cells whose head is an atom (tile - q). Its default value is the value of q. - - We don't have to look very far to find a %bush - ++tile is one, as - is ++twig and ++nock. The rune is $& (bucpam). See ++tile above - p - is [p=tile q=tile], q is the $%. There is no irregular form. - - What's the use of a %bush? Often in a variety of data structures we - have something like autocons, in which forming a cell of two - instances has an obvious default semantics. - - Sure, we could attach these semantics to an atom, and just use a - %kelp. In twigs, tiles, or nock formulas, we could have an explicit - cons stem of some sort. But it would be a bulky as compared to - autocons. - - [%fern p=[i=tile t=(list tile)]] - - A %fern is a non-empty list of cases; its icon is naturally a - %fork. The programmer is responsible for ensuring that the cases - are actually orthogonal (unlike with the structured forks, %bush, - %kelp and %reed). A good general practice is to use %ferns only - with %leafs. - - For example, a fern that could be %foo or %bar has the irregular - form ?(%foo %bar), or the regular form - - $? %foo - %bar - == - - The default value is the first - in this case, %foo. - - [%kelp p=[i=line t=(list line)]] - - A kelp is the workhorse of tiles - it provides the most common data - structure in any language, the discriminated union. - - In Hoon, the head (which must be a leaf) is called the stem. The - tail (which can be anything) is the bulb. Cases of a kelp are known - inevitably as fronds. - - (Yes. We're aware that "kelp" is not properly a singular noun. In - Hoon - it is properly a singular noun. And that's that. And oddly, - it's not that hard to run out of four-letter plants.) - - $%, buccen, is a tile rune that produces a %kelp. $% takes a list - of lines, which are labelled cases, closed by ==. - - $% p - q - == - [%leaf p=term q=@] - - A %leaf is an atomic constant of value q and odor p. Obviously its - icon is a %cube. - - The syntax for a leaf is the same as the twig syntax, except that % - is never required to generate a cube. For instance, as a twig, 7 - has a type of [%atom %ud]; %7 has a type of [%cube 7 [%atom %ud]]. - But the icon of the leaf 7 is, again, [%cube 7 [%atom %ud]]. - - [%reed p=tile q=tile] - - A %reed is a tile whose icon contains two kinds of nouns: atoms of - tile p and cells of tile q. - - There is no irregular form of %reed. The regular form is: - - $| ~ [@ @] == - - or in wide mode $|(~ [@ @]) - - [%herb p=twig] - - You can write your own tile which is just a gate, accepting a - sample of * and normalizing it as you choose. If you use a twig as - a tile, it's treated as an herb. - - For example, when we define a gate like ++base, as defined above - (remember that when we use a tile as a twig, we get the clam, ie, - the normalizing gate) base is just an arm which produces a gate. - Nothing has any idea that this gate is built from a tile of its - own. - - So when we parse [p=base q=base] as a tile, the parser builds the - noun: - - [[%bark %p %herb %cnzy %base] [%bark %q %herb %cnzy %base]] In - other words, base in p=base is actually a twig, but this twig - happens to produce a normalizing gate generated by clamming a tile. - In time this will come to seem totally straightforward, but don't - be surprised if it confuses you now. - - The important thing to remember about %herb is that the actual twig - we provide will be applied when we whip or clam. Hence, arbitrary - normalization and/or verification procedures may be part of the - herbaceous custom tile. - --- - - ++ toga - ++ trel - ++ tuna - - An XML template tree. - - Leaf %a contains plain-text, %b an empty tag, %c a static list, %d a - dynamic list, %e a full node element containing a twig and a list of - tuna, and %f is a empty node. - - ++ twig TODO: delete Form, normalize indentation - - A twig is an abstract syntax tree or AST, which we produce when we - parse a Hoon expression, file, etc. A twig is a noun that's converted - into a Nock formula, with the assistance of a type which describes the - subject of the formula: - - [subject-type twig] => formula - - But actually this isn't quite right, because Hoon does something called - "type inference." When we have a type that describes the subject for - the formula we're trying to generate, as we generate that formula we - want to also generate a type for the product of that formula on that - subject. So our compiler computes: - - [subject-type twig] => [product-type formula] - - As long as subject-type is a correct description of some subject, you - can take any twig and compile it against subject-type, producing a - formula such that *(subject formula) is a product correctly described - by product-type. - - Actually, this works well enough that in Hoon there is no direct syntax - for defining or declaring a type. There is only a syntax for - constructing twigs. Types are always produced by inference. - --- - - There are 112 cases of ++twig - - [p=twig q=twig] - - A twig can be a pair of twigs. - - [%$ p=axis] - - Refers to a nock axis. - - [%bccb p=tile] - - $_ ("buccab") is a synthetic hoon that produces the bunt (default - value) for p. - - Tall - $_ p - - Wide - $_(p) - - Irregular - _p - - Reduction - See ++open - - [%bccm p=tile] - - $, ("buccom") is a synthetic rune that produces a normalizing gate - (clam) for p. - - Talln - $, p - - Wide - none - - Irregular - ,p - - Reduction - ~(clam al p) - - See ++clam in ++al. - - [%bcpt p=wing q=tile] - - $@ ("bucpat") is a (just barely) natural hoon that whips wing p - into tile q. - - Tall - $@ p - q - - Wide - $@(p q) - - Irregular - p@q - - Reduction - none, natural - - [%bctr p=tile] - - $* ("buctar") is a synthetic rune that produces the bunt (default - value) for p as a compile-time constant. - - Tall - $* p - - Wide - $*(p) - - Reduction - ^~ ~(bunt al p) - - See ++bunt in al. - - [%bczp p=base] - - $! ("buczap") is a synthetic internal rune that produces the bunt - (default value) for [%axil p]. - - Reduction - See ++open - - [%brcb p=tile q=(map term foot)] - - |_ ("barcab") is a synthetic rune that produces a %gold tray with - sample p, arms q. q is an associative array of names and - expressions, each pair of which is called an arm. After any number - of dry (%ash, ++) and/or wet (%elm, +-) arms, the array is - terminated with -- - - Tall - |_ p - ++ p.n.q - q.n.q - -- - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%brcn p=(map term foot)] - - |% ("barcen") is a natural rune that produces a %gold core from an - associative array of names and expressions, each pair of which is - called an arm. After any number of dry (%ash, ++) and/or wet (%elm, - +-) arms, the array is terminated with -- - - Tall - |% - ++ p.n.q - q.n.q - +- p.n.l.q - q.n.l.q - -- - - Wide - none - - Irregular - none - - Reduction - none, natural - - [%brdt p=twig] - - |. ("bardot") is a synthetic rune that produces a dry %gold trap - from twig p. - - Tall - |. p - - Wide - |.(p) - - Irregular - none - - Reduction - See ++open - - [%brfs p=tile q=(map term foot)] - - |/ ("barfas") is a synthetic rune that produces a vulcanized %gold - tray with arms q, sample p. - - Tall - |/ p - +- p.n.q - q.n.q - -- - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%brkt p=twig q=(map term foot)] - - |^ ("barket") is a synthetic rune that produces a %gold book with - arms q, with p as %$, and kicks it. - - Tall - |^ p - ++ p.n.q - q.n.q - -- - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%brhp p=twig] - - |- ("barhep") is a synthetic rune that produces a dry %gold trap - from twig p, and kicks it. - - Tall - |- - p - - Wide - |-(p) - - Irregular - none - - Reduction - See ++open - - [%brls p=tile q=twig] - - |+ ("barlus") is a synthetic rune that produces a dry %iron gate - with arm q, sample p. - - Tall - |+ p - q - - Wide - |+(p q) - - Irregular - none - - Reduction - See ++open - - [%brpt p=tile q=tile r=twig] - - XX not used - - [%brtr p=tile q=twig] - - |* ("bartar") is a synthetic rune that produces a vulcanized wet - gate with arm q, sample p. - - Tall - |* p - q - - Wide - |*(p q) - - Irregular - none - - Reduction - See ++open - - [%brts p=tile q=twig] - - |= ("bartis") is a synthetic hoon that produces a dry %gold gate - with arm q, sample p. - - Tall - |= p - q - - Wide - |=(p q) - - Irregular - none - - Reduction - See ++open - - [%brwt p=twig] - - |? ("barwut") is a synthetic rune that produces a dry %lead trap. - - Tall - |? p - - Wide - |?(p) - - Irregular - none - - Reduction - See ++open - - [%clcb p=twig q=twig] - - :_ ("colcab") is a synthetic rune that produces the cell [q p]. - - Tall - :_ p - q - - Wide - :_(p q) - - Irregular - none - - Reduction - See ++open - - [%clcn p=tusk] - - :% ("colcen") is a synthetic rune that produces a cell [[p ~] ~] - from a list of twigs p, terminated by a == - - Tall - :% i.p - i.t.p - i.t.t.p - == - - Wide - :%(i.p i.t.p i.t.t.p) - - Irregular - %[i.p i.t.p i.t.t.p] - - Reduction - See ++open - - [%clfs p=twig] - - :/ ("colfas") is a synthetic rune that, given a twig p, produces - [%$ [%$ p ~] ~], i.e., [0 [0 p 0] 0]. Used in practice only in - string interpolation. - - Tall - :/ p - - Wide - :/(p) - - Irregular - none - - Reduction - See ++open - - [%clkt p=twig q=twig r=twig s=twig] - - :^ ("colket") is a synthetic rune that produces a cell [p q r s] - from twigs p, q, r, and s. - - Tall - :^ p - q - r - s - - Wide - :^(p q r s) - - Irregular - none - - Reduction - See ++open - - [%clhp p=twig q=twig] - - :- ("colhep") is a synthetic rune that produces the cell [p q] from - twigs p and q. - - Tall - :- p - q - - Wide - :-(p q) - - Irregular - [p q] - - Reduction - See ++open - - [%clls p=twig q=twig r=twig] - - :+ ("collus") is a synthetic rune that produces a cell [p q r] from - twigs p, q, and r. - - Tall - :+ p - q - r - - Wide - :+(p q r) - - Irregular - none - - Reduction - See ++open - - [%clsg p=tusk] - - :~ ("colsig") is a synthetic rune that produces a null-terminated - tuple of a list of twigs p. - - Tall - :~ i.p - i.t.p - i.t.t.p - == - - Wide - :~(i.p i.t.p i.t.t.p) - - Irregular - ~[i.p i.t.p i.t.t.p] - - Reduction - See ++open - - [%cltr p=tusk] - - :* ("coltar") is a synthetic hoon that produces a tuple from p, a - list of twigs. - - Tall - :* i.p - i.t.p - i.t.t.p - == - - Wide - :*(i.p i.t.p i.t.t.p) - - Irregular - [i.p i.t.p i.t.t.p] - - Reduction - See ++open - - [%clzz p=tusk] - - "colzaz" is a synthetic internal rune that promotes its tusk p - within a %clsg or %cltr tusk. - - Not used at present. - - [%cncb p=wing q=tram] - - %_ ("cencab") is a synthetic rune that evaluates the wing p with - the changes specified in tram q, then casts the product back to p. - - Tall - %_ p - p.i.q q.i.q - p.i.t.q q.i.t.q - == - - Wide - %_(p p.i.q q.i.q, p.i.t.q q.i.t.q) - - Irregular - none - - Reduction - See ++open - - [%cncl p=twig q=twig] - - %: ("cencol") is a synthetic rune that pulls %$ from the twig p - with the with its sample set to q. - - Tall - %: p - q - - Wide - %:(p q) - - Irregular - none - - Reduction - See ++open - - [%cndt p=twig q=twig] - - %. ("cendot") is a synthetic rune that slams the gate q with - [%cltr p]. The dual of %cnhp. - - Tall - %. p - q - - Wide - %.(p q) - - Irregular - none - - Reduction - %- q - p - - See ++open - - [%cnhp p=twig q=tusk] - - %- ("cenhep") is a synthetic rune that slams the gate p with - [%cltr q]. - - Tall - %- p - q - - Wide - %-(p q) - - Irregular - (p q) - - Reduction - See ++open - - [%cntr p=wing q=twig r=tram] - - %* is a synthetic rune that pulls the wing p from tray q with changes r. - - Tall - %* p q - p.i.r q.i.r - p.i.t.r q.i.t.r - == - - Wide - %*(p q p.i.r q.i.r, p.i.t.r q.i.t.r) - - Irregular - none - - Reduction - See ++open - - [%cnkt p=twig q=twig r=twig s=twig] - - %^ ("cenket") is a synthetic rune that slams gate p with [%cntr q r s]. - - Tall - %^ p - q - r - s - - Wide - %^(p q r s) - - Irregular - none - - Reduction - See ++open - - [%cnls p=twig q=twig r=twig] - - %+ ("cenlus") is a synthetic rune that slams gate p with [%cntr q r]. - - Tall - %+ p - r - s - - Wide - %+(p q r) - - Irregular - none - - Reduction - See ++open - - [%cnsg p=wing q=twig r=twig] - - %~ ("censig") is a synthetic rune that pulls p from the tray q with its - sample set to r. - - Tall - %~ p - q - r - - Wide - %~(p q r) - - Irregular - ~(p q r) - - Reduction - See ++open - - [%cnts p=wing q=tram] - - %= ("centis") is a natural rune that evaluates p with the changes - specified in q. - - Tall - %= p - p.i.q q.i.q - p.i.t.q q.i.t.q - == - - Wide - %=(p p.i.q q.i.q, p.i.t.q q.i.t.q) - - Irregular - p(p.i.q q.i.q, p.i.t.q q.i.t.q) - - Reduction - See ++open - - [%cnzy p=term] - - "cenzey" is a synthetic internal rune that pulls limb p from the subject. - - Tall/Wide/Irregular - none, internal - - Reduction - See ++open - - [%cnzz p=wing] - - "cenzaz" is a synthetic internal rune that pulls wing p from the subject. - - Form - none, internal - - Reduction - See ++open - - [%dtkt p=twig] - - .^ ("dotket") is a natural rune that generates Nock operator 11, which in - virtual userspace Nock (++mock) loads a file from the global namespace. - - Tall - .^ p - - Wide - .^(p) - - Irregular - ^:type/path - - ^/path - - Reduction - none, natural - - [%dtls p=twig] - - .+ ("dotlus") is a natural rune that generates Nock operator 4, which - increments an atomic operand. - - Tall - .+ p - - Wide - .+(p) - - Irregular - +(p) - - Reduction - none, natural - - [%dtzy p=term q=@] - - "dotzey" is a natural internal rune that produces a non-cubed atomic - constant of odor p and value q. - - Tall/Wide/Irregular - none, internal - - Reduction - none, natural - - [%dtzz p=term q=*] - - "dotzaz" is a natural internal rune that produces a cubed noun constant of - value q and odor p, if q is an atom. - - Tall/Wide/Irregular - none, internal - - Reduction - none, natural - - [%dttr p=twig q=twig] - - .* ("dottar") is a natural rune that calculates the Nock of subject p, - formula q. - - Tall - .* p - q - - Wide - .*(p q) - - Irregular - none - - Reduction - none, natural - - [%dtts p=twig q=twig] - - .= ("dottis") is a natural rune that applies Nock 5 (equals) to determine - if the products of p and q are equivalent. - - Tall - .= p - q - - Wide - .=(p q) - - Irregular - =(p q) - - Reduction - none, natural - - [%dtwt p=twig] - - .? ("dotwut") is a natural hoon that applies Nock 3 to a noun: if the - noun is a cell, it returns the loobean & (true); if the noun is an atom, - it returns the loobean | (false). - - Tall - .? p - - Wide - .?(p) - - Irregular - none - - Reduction - none, natural - - [%hxgl p=tusk] - - #< ("haxgal") is a synthetic rune that slams the assumed gate noah on - [%zpgr %cntr p]. See the Biblical names. - - Tall/Wide - none - - Irregular - >i.p i.t.p i.t.t.p< - - Reduction - See ++open - - [%hxgr p=tusk] - - #> ("haxgar") is a synthetic rune that slams the assumed gate cain on - [%zpgr %cntr p]. See the Biblical names. - - Tall/Wide - none - - Irregular - - - Reduction - See ++open - - [%ktbr p=twig] - - ^| ("ketbar") is a natural rune that converts a %gold core into an %iron - core. See geometric polymorphism. - - Tall - ^| p - - Wide - ^|(p) - - Irregular - none - - Reduction - none, natural - - [%ktdt p=twig q=twig] - - ^. ("ketdot") is a synthetic rune that casts q to the type of (p q). - - Tall - ^. p - q - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%ktls p=twig q=twig] - - ^+ ("ketlus") is a natural rune that casts the product of q to the - type of p, verifying that it contains the type of q. - - Tall - +^ p - q - - Wide - ^+(p q) - - Irregular - none - - Reduction - none, natural - - [%kthp p=tile q=twig] - - ^- ("kethep") is a synthetic rune that casts q to ~(bunt al p), - i.e., the icon of p. - - Tall - ^- p - q - - Wide - ^-(p q) - - Irregular - `p`q - - Reduction - See ++open - - [%ktpm p=twig] - - ^& ("ketpam") is a natural rune that converts a %gold core to %zinc core. - See geometric polymorphism. - - Tall - ^& p - - Wide - ^&(p) - - Irregular - none - - Reduction - none, natural - - [%ktsg p=twig] - - ^~ ("ketsig") is a natural rune that tries to execute p statically at - compile time; if this fails, p remains dynamic. - - Tall - ^~ p - - Wide - ^~(a) - - Irregular - none - - Reduction - none, natural - - [%ktts p=toga q=twig] - - ^= ("kettis") is a natural rune that wraps q in the toga p. The - toga is a powerful naming device that can assign an entire name - tree to a properly typed result. For instance, if foo produces - an unlabeled tuple [x y z], [a b=[c d]]=foo produces - [a=x b=[c=y d=z]]. - - Tall - ^= p - q - - Wide - ^=(p q) - - Irregular - none - - Reduction - none, natural - - [%ktwt p=twig] - - ^? ("ketwut") is a natural hoon that converts a %gold core into a - %lead core. See geometric polymorphism. - - Tall - ^? p - - Wide - ^?(p) - - Irregular - none - - Reduction - none, natural - - [%sgbr p=twig q=twig] - - ~| ("sigbar") is a synthetic rune that presents the product of p - in the stack trace if q crashes. Only performed as needed. - Generates %cain - see the Biblical names. - - Tall - ~| p - q - - Wide - ~|(p q) - - Irregular - none - - Reduction - See ++open, ++feck - - [%sgcb p=twig q=twig] - - ~_ ("sigcab") is a synthetic rune that inserts p, a trap producing a tank, - into the trace of q. - - Tall - ~_ p - q - - Wide - ~_(p q) - - Irregular - none - - Reduction - See ++open - - [%sgcn p=chum q=twig r=tyre s=twig] - - ~% ("sigcen") is a synthetic rune that identifies a core for specific - optimization. See jet propulsion. - - Tall - ~% p - q - == - p.i.r q.i.r - p.i.t.r q.i.t.r - == - s - - ~% p - q - ~ - s - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%sgfs p=chum q=twig] - - ~/ ("sigfas") is a synthetic rune that identifies an arm for specific - optimization. See jet propulsion. - - Tall - ~/ p - q - - Wide - ~/(p q) - - Irregular - none - - Reduction - See ++open - - [%sggl p=$|(term [p=term q=twig]) q=twig] - - ~< ("siggal") is a synthetic rune that applies arbitrary hint p to - the product of q. Does not wake the hint engine until the - computation is finished. - - Tall - ~< p - q - - Wide - ~<(p q) - - Irregular - none - - Reduction - See ++open - - [%sggr p=$|(term [p=term q=twig]) q=twig] - - ~> ("siggar") is a natural rune that applies arbitrary hint p to q. - - Tall - ~> p - q - - Wide - ~>(p q) - - Irregular - none - - Reduction - See ++open - - [%sgbc p=term q=twig] - - ~$ ("sigbuc") is a synthetic rune that labels computation q as p - for profiling (not currently enabled). - - Tall - ~$ p - q - - Wide - ~$(p q) - - Irregular - none - - Reduction - See ++open - - [%sgls p=@ q=twig] - -XX Solve ~+ ("siglus") is a synthetic rune that memoizes computation q - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%sgpm p=@ud q=twig r=twig] - - ~& ("sigpam") is a synthetic rune that prints q on the console - before computing r. p is the log priority 0-3, defaulting to 0. - - Tall - 0, debug - ~& q - r - - 1, notice - ~& > q - r - - 2, warning - ~& >> q - r - - 3, alarm - ~& >>> q - r - - Wide - ~&(>>> q r) - - Irregular - none - - Reduction - See ++open - - [%sgts p=twig q=twig] - - ~= ("sigtis") is a synthetic rune that hints to the interpreter - that q may produce a noun equal to the already existing p, - avoiding duplication. - - Tall - ~= p - q - - Wide - ~=(p q) - - Irregular - none - - Reduction - See ++open - - [%sgwt p=@ud q=twig r=twig s=twig] - - ~? ("sigwut") is a synthetic rune that prints r to the console - before computing s, iff q produces yes. p is the log priority, - 0-3, 0 by default - - Tall - 0, debug - ~? q - r - s - - 1, notice - ~? > q - r - s - - 2, warning - ~? >> q - r - s - - 3, alarm - ~? >>> q - r - s - - Wide - ~?(>>> q r s) - - Irregular - none - - Reduction - See ++open - - [%sgzp p=twig q=twig] - - ~! ("sigzap") is a natural rune for debugging uses only, - semantically equivalent to its own twig q. Should compilation - fail within q, ~! will show the type of p on the stacktrace. - - Tall - ~! p - q - - Wide - ~!(p q) - - Irregular - none - - Reduction - none, natural - - [%smcl p=twig q=tusk] - - ;: ("semcol") is a synthetic gate that applies p, a binary gate, - to the n-ary tuple q. - - Tall - ;: p - i.q - i.t.q - i.t.t.q - == - - Wide - ;:(p i.q i.t.q i.t.t.q) - - Irregular - :(p i.q i.t.q i.t.t.q) - - Reduction - See ++open - - [%smdt p=twig q=tusk] -XX determine function - - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%smdq p=(list beer)] -XX determine if internal/external - - ;" ("semdoq") is a synthetic rune used to make strings, - interpolated or not. - - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%smsg p=twig q=tusk] - -XX to do - - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%smsm p=twig q=twig] - - ;; ("semsem") is a synthetic rune that types q as a fixpoint of p. - Semantically identical to ((hard p) q). - - Tall - ;; p - q - - Wide - ;;(p q) - - Irregular - none - - Reduction - See ++open - - [%tsbr p=tile q=twig] - - =| ("tisbar") is a synthetic rune that pushes ~(bunt al p) on the - subject and sends it to q. - - Tall - =| p - q - - Wide - =|(p q) - - Irregular - none - - Reduction - =+(_p q) - See ++open, ++bunt in ++al - - [%tscl p=tram q=twig] - - =: ("tiscol") is a synthetic rune that produces q with the subject - by p. Uses %cncb, and so cannot change the subject type. - - Tall - =: p.i.p q.i.p - p.i.t.p q.i.t.p - p.i.t.t.p q.i.t.t.p - == - q - - Wide - none - - Irregular - noen - - Reduction - See ++open - - [%tscn p=twig q=twig] -XX to do - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%tsdt p=wing q=twig r=twig] - - =. ("tisdot") is a synthetic rune that produces r with p in the - subject set to q. Uses %cncb, and so cannot change the subject - p. - - Tall - =. p - q - r - - =. p q - r - - Wide - =.(p q r) - - Irregular - none - - Reduction - See ++open - - [%tsfs p=twig q=twig] - XX not used - - [%tsgl p=twig q=twig] - - =< ("tisgal") is a synthetic rune that uses the product of q as - the subject of p. - - Tall - =< p - q - - Wide - =<(p q) - - Irregular - - Reduction - See ++open - - [%tshp p=twig q=twig] - - =- ("tishep") is a synthetic rune that pushes q on the subject - and sends it to p. Dual of =+ ("tislup") - - - Tall - =- p - q - - Wide - =- - - Irregular - none - - Reduction - See ++open - - [%tsgr p=twig q=twig] - - => ("tisgar") is a natural rune that uses the product of p as the - subject of q. - - Tall - => p - q - - Wide - =>(p q) - - Irregular - none - - Reduction - none, natural - - [%tskt p=twig q=twig r=twig s=twig] - - =^ ("tisket") is a synthetic rune that handles a product which is - a cell of the new result, and a mutation to the subject. - - Tall - Kingside - =^ p - q - r - s - - Queenside - =^ p q - r - s - - Wide - =^(p q r s) - - Irregular - none - - Reduction - See ++open - - [%tsls p=twig q=twig] - - =+ ("tislus") is a synthetic rune that pushes p on the subject - and sends it to q. Semantically equavlent to Nock 8.Dual of =- ("tishep") - - Tall - =+ p - q - - Wide - =+(p q) - - Irregular - none - - Reduction - See ++open - - [%tspm p=tile q=twig] - - XX not used - - [%tspt p=tile q=twig] - - XX not used - - [%tstr p=term q=wing r=twig] - - =* ("tistar") is a natural rune that creates a %bull, or alias, - type. - - Tall - =* p q - r - - Wide - =*(p q r) - - Irregular - none - - Reduction - none, natural - - [%tssg p=tusk] - - =~ ("tissig") is a synthetic rune that composes a list of twigs. - - Tall - Kingside - =~ i.p - i.t.p - i.t.t.p - == - - Queenside - =~ i.p - i.t.p - i.t.t.p - == - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%wtbr p=tusk] - - ?| ("wutbar") is a synthetic rune that computes the "or" of the - loobeans in p. - - Tall - ?| i.p - i.t.p - i.t.t.p - == - - Wide - ?|(i.p i.t.p i.t.t.p) - - Irregular - |(i.p i.t.p i.t.t.p) - - Reduction - See ++open - - [%wthp p=wing q=tine] - - ?- ("wuthep") is a synthetic rune that selects a case in q for - the actual type of p. - - Tall - Kingside - ?- p - p.i.q q.i.q - p.i.t.q q.i.t.q - p.i.t.t.q q.i.t.t.q - == - - Queenside - ?- p - p.i.q - q.i.q - p.i.t.q - q.i.t.q - p.i.t.t.q - q.i.t.t.q - == - - Wide - ?-(p p.i.q q.i.q, p.i.t.q q.i.t.q, p.i.t.t.q q.i.t.t.q) - - Irregular - none - - Reduction - See ++open - - [%wthz p=tiki q=tine] - - "wuthaz" is a synthetic internal rune that selects a case in q - for the actual type of p. - - Tall/Wide/Irregular - none, internal - - Reduction - See ++open - - [%wtcl p=twig q=twig r=twig] - - ?: ("wutcol") is a natural rune that produces q if p is yes (&, 0), - or r if p is no (|, 1). - - Tall - ?: p - q - r - - Wide - ?:(p q r) - - Irregular - none - - Reduction - none, natural - - [%wtdt p=twig q=twig r=twig] - - ?. ("wutdot") is a synthetic rune that prduces r if p is yes - (&, 0), of q if p is no (|, 1). - - Tall - ?. p - q - r - - Wide - ?:(p q r) - - Irregular - none - - Reduction - none, natural - - [%wtkt p=wing q=twig r=twig] - - ?^ ("wutkey") is a synthetic rune that evaluates r if p is - equivalent to the bunt for its tile, otherwise q is evaluted. - - Tall - ?^ p - q - r - - Wide - ?^(p q r) - - Irregular - none - - Reduction - See ++open - - [%wtkz p=tiki q=twig r=twig] - - "wutkaz" is a synthetic, internal rune that evaluates r if p is - equivalent to the bunt for its tile, otherwise q is evaluated. - See tikis. - - Tall - ?^ p - q - r - - Wide - ?^(p q r) - - Irregular - none - - Reduction - See ++open - - [%wtgl p=twig q=twig] - - ?< ("wutgal") is a synthetic hoon that produces q, asserting that - p is no (|, 1). - - Tall - ?< p - q - - Wide - ?<(p q) - - Irregular - none - - Reduction - See ++open - - [%wtgr p=twig q=twig] - - ?> ("wutgar") is a synthetic hoon that produces q, asserting that - p is yes (&, 0). - - Tall - ?> p - q - - Wide - ?>(p q) - - Irregular - none - - Reduction - See ++open - - [%wtls p=wing q=twig r=tine] - - ?+ ("wutlus") is a synthetic rune that selects a case in q for - the actual type of p. - - Tall - Kingside - ?+ p - q - p.i.r q.i.r - p.i.t.r q.i.t.r - p.i.t.t.r q.i.t.t.r - == - - Queenside - ?+ p - q - p.i.r - q.i.r - p.i.t.r - q.i.t.r - p.i.t.t.r - q.i.t.t.r - == - - Wide - ?+(p p.i.r q.i.r, p.i.t.r q.i.t.r, p.i.t.t.r q.i.t.t.r) - - Irregular - none - - Reduction - See ++open - - [%wtlz p=tiki q=twig r=tine] - - "wutlaz" is a synthetic, internal rune that selects a case in q for - the actual type of p. - - Tall/Wide/Irregular - none, internal - - Reduction - See ++open - - [%wtpm p=tusk] - - ?& ("wutpam") is a synthetic hoon that computes the "and" of the - loobeans in p. - - Tall - ?& i.p - i.t.p - i.t.t.p - == - - Wide - ?&(i.p i.t.p i.t.t.p) - - Irregular - none - - Reduction - See ++open - - [%wtpt p=wing q=twig r=twig] - - ?@ ("wutpat") is a synthetic hoon that produces q if p is an - atom, r otherwise. - - Tall - Kingside - ?@ p - q - r - - Queenside - ?@ p - q - r - - Wide - ?@(p q r) - - Irregular - none - - Reduction - See ++open - - [%wtpz p=tiki q=twig r=twig] - - "wutpaz" is a synthetic hoon that produces q if p is an atom, r - otherwise. - - Tall - ?@ p - q - r - - Wide - ?@(p q r) - - Irregular - none - - Reduction - See ++open - - [%wtsg p=wing q=twig r=twig] - - ?~ ("wutsig") is a synthetic rune that produces q if p is ~, r - otherwise. - - Tall - ?~ p - q - r - - Wide - ?~(p q r) - - Irregular - none - - Reduction - See ++open - - [%wtsz p=tiki q=twig r=twig] - - "wutsaz" is a synthetic internal rune that produces q if p is ~, - r otherwise. - - Tall/Wide/Irregular - none, internal - - Reduction - See ++open - - [%wtts p=tile q=wing] - - ?= ("wuttis") is a natural rune that produces true if the leg at - wing q is in tile p. - - Tall - ?= p - q - - Wide - ?=(p q) - - Irregular - none - - Reduction - none, natural - - [%wtzp p=twig] - - ?! ("wutzap") is a synthetic rune that produces the logical "not" - of p. - - Tall - ?! p - - Wide - ?!(p) - - Irregular - !p - - Reduction - See ++open - - [%zpcb p=spot q=twig] -XX tall/wide form - !_ ("zapcab") is a natural rune that puts debugging information - in the stack trace. - - Tall - - Wide - - Irregular - none - - Reduction - none, natural - - [%zpcm p=twig q=twig] - - !, ("zapcom") is a natural rune that inserts twig q as a - constant, typed with the type of twig p. - - Tall - !, p - q - - Wide - !,(p q) - - Irregular - none - - Reduction - none, natural - - [%zpcn ~] -XX determine function - !% ("zapcen") - - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%zpfs p=twig] -XX tall/wide - !/ ("zapfas") is a natural rune that should never be compiled. - When compiled with error checking turned on, it reports its - subject as an error. - - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%zpgr p=twig] - - !> ("zapgar") is a synthetic rune that produces a vase (a - [type noun] cell) with the value p. - - Tall - !> p - - Wide - !>(p) - - Irregular - none - - Reduction - See ++open - - [%zpsm p=twig q=twig] - - !; ("zapsem") is a natural rune that produces the product of twig - q as a [type noun] pair, with twig p defining the type of the type. - - Tall - !; p - q - - Wide - !;(p q) - - Irregular - none - - Reduction - none, natural - - [%zpts p=twig] - - != ("zaptis") is a natural rune that produces the formula of twig - p as a noun. - - Tall - != p - - Wide - !=(p) - - Irregular - none - - Reduction - none, natural - - [%zpwt p=$|(p=@ [p=@ q=@]) q=twig] - - !? ("zapwut") is a synthetic rune that enforces a Hoon version - restriction. - - Tall - !? p - q - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%zpzp ~] - - !! ("zapzap") is a natural rune that always causes a crash when - executed. - - Tall - none - - Wide - !! - - Irregular - none - - Reduction - none, natural - - ++ tine - ++ tusk - ++ tyre - ++ tyke - ++ tram - ++ tone - ++ nock - ++ toon - ++ tune - ++ twin - ++ type - - A type is a noun that: - - One, it defines a set of nouns. Any finite noun is either in this set, or - not in it. - - Two, it ascribes semantics to all nouns in this set. For example, a Hoon - type exports a semantic namespace. - - A lot of other languages use dynamic types, in which the type of a - value is carried along with the data as you use it. Even languages like - Lisp, which are nominally typeless, look rather typed from the Hoon - perspective. For example, a Lisp atom knows dynamically whether it's a - symbol or an integer. A Hoon atom is just a Nock atom, which is just a - number. So without a static type, Hoon doesn't even know how to print - an atom properly. - --- - - There are 9 cases of ++type: - - ?(%noun %void) - - Either %noun or %void. %noun is the set of all nouns. %void is the - set of no nouns. - - ~zod/try=> :type; * - 0 - * - - ~zod/try=> -:!>(*) - %noun - - ~zod/try=> :type; `*`%noun - 1.853.189.998 - * - - ~zod/try=> -:!>(`*`%noun) - %noun - - We can't show any examples producing %void - by definition, none of - them would terminate. Because that's what %void means. All other - cases in ++type are subsets of %noun. - - [%atom p=term] - - An atom is a natural number, with a term (known as an - odor) that specificies an atomic subtype. - - An odor is an ASCII span. This span is a taxonomy which - grows more specific to the right. For instance, @t - for UTF-8 text, @ta for URL-safe ASCII text, @tas for - a Hoon symbol; or @u for an unsigned integer, @ux for - an unsigned integer formatted as hexadecimal. - - Hoon knows about the following odors, with defined meanings: - - @c UTF-32 codepoint - @d date - @da absolute date - @dr relative date (ie, timespan) - @f yes or no (inverse boolean) - @n nil - @p phonemic base - @r IEEE floating-point - @rd double precision (64 bits) - @rh half precision (16 bits) - @rq quad precision (128 bits) - @rs single precision (32 bits) - @s signed integer, sign bit low - @sb signed binary - @sd signed decimal - @sv signed base32 - @sw signed base64 - @sx signed hexadecimal - @t UTF-8 text (cord) - @ta ASCII text (span) - @tas ASCII symbol (term) - @u unsigned integer - @ub unsigned binary - @ud unsigned decimal - @uv unsigned base32 - @uw unsigned base64 - @ux unsigned hexadecimal - - Atoms change freely either up or down the taxonomy, - but not across. You can treat a @tas as - a @t, as in a strong type system; but you can also - treat a @t as a @tas, or an @ as anything. However, - passing a @t to a function that expects an @ux is a - type error. - - Each of these forms has a URL-safe syntax. Each - parses as an atomic constant in Hoon, and each is - printed by the Hoon prettyprinter. - --- - - ~zod/try=> :type; 0x42 - 0x42 - @ux - - ~zod/try=> `@ud`0x42 - 66 - - ~zod/try=> :type; 'foo' - 'foo' - @ta - - ~zod/try=> `@ud`'foo' - 7.303.014 - - ~zod/try=> :type; ~2013.12.6 - ~2013.12.6 - @da - - ~zod/try=> `@ud`~2013.12.6 - 170.141.184.500.724.667.905.957.736.036.171.776.000 - - ~zod/try=> `@ud`.127.0.0.1 - 2.130.706.433 - - ~zod/try=> :type; .127.0.0.1 - .127.0.0.1 - @if - - ~zod/try=> :type; ~m45 - ~m45 - @dr - - ~zod/try=> `@ud`~m45 - 49.806.208.999.015.789.363.200 - - ~zod/try=> :type; `@da`(add ~2013.12.6 ~m45) - ~2013.12.6..00.45.00 - @da - - --- - The variety of units and formats which an atom can - represent is essentially infinite. The set of - syntaxes which Hoon can parse and print is - fundamentally limited. - - For instance, Hoon has no syntax which means "number - of miles." But within your program, nothing stops you - from using the odor system to distinguish a number of - miles from, for instance, a number of kilometers: - - ~zod/try=> `@udm`25.717 - 25.717 - ~zod/try=> `@udk`25.717 - 25.717 - - The printer has no idea what a @udm is, but it knows - what a @ud is and can print accordingly. Then, if you - have a function which expects a @udm and you try to - pass it a @udk, it will fail. - --- - - Besides these prefixes, which indicate the rendering - and/or meaning of atoms, the odor system has another - orthogonal mechanism to restrict the size of atoms. - Like the prefix, this mechanism is weak - it is not - enforced and trivially evaded. - - An odor span contains two parts, both optional: a - lowercase prefix and an uppercase suffix. The suffix, - if present, is a single character A-Z c which - indicates an atom of size less than or equal to n - bits, where n is 1 << (c - 'A'). Thus, @tD is one - UTF-8 byte (whatever that means); @tN is a kilobyte - or less of UTF-8. - - When enforcing conversions, @t has no size - information and can be used as @tD; and @tD, of - course, can be used as @t. But using @tN as @tD is an - error. There is no way to generate the smell of size - from a constant without a cast. And of course - arithmetic results have no odor at all. - - A full table for convenience: - - A 1 bit - B 2 bits - C 4 bits - D 1 byte - E 2 bytes - F 4 bytes - G 8 bytes - H 16 bytes - I 32 bytes - J 64 bytes - K 128 bytes - L 256 bytes - M 512 bytes - N 1K - O 2K - P 4K - Q 8K - R 16K - S 32K - T 64K - U 128K - V 256K - W 512K - X 1MB - Y 2MB - Z 4MB - - You of course can build an atom larger than 4MB, but - the type system cannot express a size odor above 4MB. - - - [%bull p=twin q=type] - - [%cell p=type q=type] - - A pair of types. Set: all cells of p and q. - - ~zod/try=> :type; [3 4] - [3 4] - [@ud @ud] - - ~zod/try=> -:!>([3 4]) - - ~zod/try=> :type; [3 4] - [3 4] - [@ud @ud] - - ~zod/try=> -:!>([3 4]) - [%cell p=[%atom p=%ud] q=[%atom p=%ud]] - - [%core p=type q=coil] - - [%cube p=* q=type] - - When we enter an ordinary constant, like 42, its type [%atom %ud] - is the set of all atoms (with odor @ud, but any atom can have that - or any odor). Its type is certainly not the set consisting - exclusively of the value 42. - - But here's how we produce this "cubical" constant: - - ~zod/try=> :type; %42 - %42 - %42 - - ~zod/try=> -:!>(%42) - [%cube p=42 q=[%atom p=%ud]] - - In general, a %cube type contains p, a single noun, and q, a base - type which provides semantics. - - Syntactically, any atomic constant can be preceded by % to generate - a cube. The exception is @tas, which always needs % and is always - cubical. - - [%face p=term q=type] - - A type is not just a set of nouns - it's also a meaning which makes - sense of any noun in that set. The typed noun exports a namespace - - give it a name, and it gives you another noun. - - ~zod/try=> foo=42 - foo=42 - ~zod/try=> :type; foo=42 - foo=42 - foo=@ud - ~zod/try=> -:!>(foo=42) - [%face p=%foo q=[%atom p=%ud]] - - With %face, we've simply wrapped a label around another type. Note - that this doesn't impair our ability to compute with the value. - Computationally, foo=42 is just 42: - - ~zod/try=> (add 17 foo=42) - 59 - --- - - [%fork p=type q=type] - - A union type. [%fork p q] means "it could be a p, or maybe a q." - - Any branching computation in which different branches produce - different types will generate a fork. For example: - - ~zod/try=> :type; ?:(& %foo [13 10]) - %foo - { %foo [@ud @ud] } - - ~zod/try=> -:!>(?:(& %foo [13 10])) - [ %fork - p=[%cube p=7.303.014 q=[%atom p=%tas]] - q=[%cell p=[%atom p=%ud] q=[%atom p=%ud]] - ] - - Here we start to understand why the type renderer is useful, as - { %foo [@ud @ud] } (which is not in any way Hoon syntax) is a - little easier to read than the actual type noun. - - (Readers of a mathematical bent may ask: since Hoon has a union - type, where is the intersection type? There is none. Hoon is not - one of these languages whose goal is to be as mathematically - powerful as possible. Since a programming language is a UI for - programmers, and programmers are not mathematicians, Hoon is - designed to be as powerful as it has to be - and no more.) - - [%hold p=(list ,[p=type q=twig])] - - ++ typo - ++ udal - ++ udon - ++ umph - ++ unce - ++ unit - ++ upas - ++ urge - ++ vase - ++ vise - ++ wall - ++ wain - ++ wing - ++ wine - ++ woof - ++ wonk - ++ map - ++ qeu - ++ set - ++ jar - ++ jug - -volume 2, Hoon libraries and compiler - - chapter 2a, basic unsigned math - - ++ add - Sum two numbers. - --- - Activate jet. - Build dry %gold gate with sample atoms a and b - Yield atom - If: a is 0 - Then: Produce `b` - Else: Produce the slam of the gate with (dec a) and +(b). - --- - ~palryp-hocsyt/try=> (add 2 2) - 4 - ~palryp-hocsyt/try=> (add 1 1.000.000) - 1.000.001 - ~palryp-hocsyt/try=> (add 1.333 (mul 2 2)) - 1.337 - - ++ cap - Test if an atom is in the head or tail of a noun. - --- - Activate jet. - Build dry %gold gate with sample atom a - Yield either %2 or %3 - Switch on type of a - if %2, produce %2 - if %3, produce %3 - if either %0 or %1, fail - if noun, slam gate with (div a 2) - Terminate switch statement. - --- - ~palryp-hocsyt/try=> (cap 4) - %2 - ~palryp-hocsyt/try=> (cap 6) - %3 - ~palryp-hocsyt/try=> (cap (add 10 9)) - %2 - - ++ dec - Decrement a number - Subtracts one. - --- - Activate jet. - Build dry %gold gate with sample atom a - Error on crash: %decrement-underflow - Deny that a is 0 - Let b be 0 - Kick dry %gold trap that yields atom. - If: a is +(b) - Then: Produce b. - Else, slam trap with +(b) - --- - ~palryp-hocsyt/try=> (dec 7) - 6 - ~palryp-hocsyt/try=> (dec 0) - ! decrement-underflow - ! exit - - ++ div - Divide one number by another. - --- - Activate jet. - Build dry %gold gate with sample atom a, atom b. - Yield atom - Error on crash: 'div' - Deny that b is 0 - Push `c` is 0. - Kick dry %gold trap - If: a is less than b - Then: Produce c. - Else, slam trap with (sub a b) +(c) - --- - ~palryp-hocsyt/try=> (div 4 2) - 2 - ~palryp-hocsyt/try=> (div 17 8) - 2 - ~palryp-hocsyt/try=> (div 20 30) - 0 - - ++ fac - Produce the factorial of a number n, n!. - --- - Activate jet. - Build dry %gold gate with sample atom a and atom b. - Yield atom - If: a is 0 - Then: Produce 1. - Else: slam gate with dec a - and multiply by a - --- - ~palryp-hocsyt/try=> (fac 3) - 6 - ~palryp-hocsyt/try=> (fac 0) - 1 - ~palryp-hocsyt/try=> (fac 11) - 39.916.800 - - ++ gte - Is the first greater than or equal to the second? - --- - Activate jet. - Build dry %gold gate with sample atom a and atom b - Yield bean - a is NOT less-than b - --- - ~palryp-hocsyt/try=> (gte 100 10) - %.y - ~palryp-hocsyt/try=> (gte 4 4) - %.y - ~palryp-hocsyt/try=> (gte 3 4) - %.n - - ++ gth - Is the first greater than the second? - --- - Activate jet. - Build dry %gold gate with sample atom a and atom b - Yield bean. - a is NOT less-equal b - --- - ~ronrem-lonsem/try=> (gth 4 5) - %.n - ~ronrem-lonsem/try=> (gth 5 4) - %.y - ~ronrem-lonsem/try=> (gth 5 5) - %.n - ~ronrem-lonsem/try=> (gth 0 0) - %.n - ++ lte - Is the first less than or equal to the second? - --- - Activate jet - Build dry %gold gate with sample atom a and atom b - Yield bean - a is b OR a is less-than b - --- - ~ronrem-lonsem/try=> (lte 4 5) - %.y - ~ronrem-lonsem/try=> (lte 5 4) - %.n - ~ronrem-lonsem/try=> (lte 5 5) - %.y - ~ronrem-lonsem/try=> (lte 0 0) - %.y - ++ lth - Is the first less than the second? - --- - Activate jet - Build dry %gold gate with a sample atom a and atom b - Yield bean - Use logical AND, and produce %.n if a is b. - Kick a dry %gold trap - produce %.y if a is 0 - produce %.n if a is NOT 0 AND b=0. - Else, toss a for (dec a), and b for (dec b) - --- - ~ronrem-lonsem/try=> (lth 4 5) - %.y - ~ronrem-lonsem/try=> (lth 5 4) - %.n - ~ronrem-lonsem/try=> (lth 5 5) - %.n - ~ronrem-lonsem/try=> (lth 5 0) - %.n - ++ mas - Produce the axis of a within the head or the tail. - --- - Activate jet - Build dry %gold gate with sample atom a - Yield atom. - Switch on a: - if 1, fail - if 2, produce 1 - if 3, produce 1 - Else, add a modulo 2 to 2 times the toss of a for (div a 2) - --- - 1 ~ronrem-lonsem/try=> (mas 3) - 1 - ~ronrem-lonsem/try=> (mas 4) - 2 - ~ronrem-lonsem/try=> (mas 5) - 3 - ~ronrem-lonsem/try=> (mas 6) - 2 - ~ronrem-lonsem/try=> (mas 7) - 3 - ~ronrem-lonsem/try=> (mas 8) - 4 - ~ronrem-lonsem/try=> (mas 0) - ! exit - ~ronrem-lonsem/try=> (mas 1) - ! exit - - ++ max - Produce the larger of two atoms. - --- - Activate jet - Build dry %gold gate with sample atom a and atom b - Yield atom - If: a is greater than b - Then: produce a - Else: produce b - --- - ~palryp-hocsyt/try=> (max 10 100) - 100 - ~palryp-hocsyt/try=> (max 10.443 9) - 10.443 - ~palryp-hocsyt/try=> (max 0 1) - 1 - - ++ min - Produce the smaller of two atoms. - --- - Activate jet - Build dry %gold gate with sample atom a and atom b - Yield atom. - If: a is less than b - Then: produce a - Else: produce b - --- - ~palryp-hocsyt/try=> (min 10 100) - 10 - ~palryp-hocsyt/try=> (min 10.443 9) - 9 - ~palryp-hocsyt/try=> (min 0 1) - 0 - - ++ mod - Produce a modulo b - --- - Activate jet - Build dry %gold gate with sample atom a and atom b - Yield atom - Deny that b is 0 - Subtract from a the product of b and a divided by b - --- - - ++ mul - Multiply two numbers - --- - Activate jet - Build dry %gold gate with sample atom a and atom b - Yield atom - Push 'c' is 0 - Kick a dry %gold trap. - If: a is 0 - Then: produce c. - Else: toss a for (dec a) and c for (add b c - Examples: - - ++ peg - Produces the axis of b within the axis of a. - --- - Activate jet - Build dry %gold gate with sample atom a and atom b - Yield atom - Switch on b - if 1, produce a - if 2, produce (mul a 2) - if 3, produce +((mul a 2)) - else, add (mod b 2) to 2 times the toss of b for (div b 2) - --- - ~ronrem-lonsem/try=> (mul 5 3) - 15 - --- - ~ronrem-lonsem/try=> (mul 1 0) - 0 - - ++ sub - Subtract two numbers - --- - Activate jet - Build dry %gold gate with sample atom a and atom b - Error on crash "%subtract-underflow" - Yield atom - If: b is 0 - Then: produce a. - Else: toss a for (dec a) and b for (dec b) - --- - ~ronrem-lonsem/try=> (sub 10 5) - 5 - --- - ~ronrem-lonsem/try=> (sub 243 44) - 199 - --- - ~ronrem-lonsem/try=> (sub 5 0) - 5 - --- - ~ronrem-lonsem/try=> (sub 0 5) - ! subtract-underflow - ! exit - -chapter 2b, basic containers - -Section 2bA, units - - ++ biff - Apply a function which yields a unit to the value of a unit - --- - Build wet gate with a sample unit a and tiled gate b - If: a is null - Then: produce null - Else: slam b with u.a. - --- - ~palryp-hocsyt/try=> (biff (some 5) |=(a=@ (some (add a 2)))) - [~ u=7] - --- - ~palryp-hocsyt/try=> (biff ~ |=(a=@ (some (add a 2)))) - ~ - ++ bind - Apply a function to the value of a unit. - --- - Build wet %gold gate with sample unit a and gate b - If: a is null - Then: produce null - Else, the unit of the slam of 'b' with u.a. - --- - ~talsur-todres/try=> (bind ((unit ,@) [~ 97]) ,@t) - [~ `a`] - --- - ~talsur-todres/try=> =a |=(a=@ (add a 1)) - ~talsur-todres/try=> (bind ((unit ,@) [~ 2]) a) - [~ 3] - - ++ clap - Apply a binary operation which yields a unit to the values of two units - --- - Build wet %gold gate with a sample unit a, unit b and gate c - If: a is null - Then: produce b - Else: If: b is null - Then: produce a - Else: the unit of the slam of c with [u.a u.b] - --- - ~palryp-hocsyt/try=> =u ((unit ,@t) [~ 'a']) - ~palryp-hocsyt/try=> =v ((unit ,@t) [~ 'b']) - ~palryp-hocsyt/try=> (clap u v |=([a=@t b=@t] (welp (trip a) (trip b)))) - [~ u="ab"] - --- - ~talsur-todres/try=> =a ((unit ,@u) [~ 1]) - ~talsur-todres/try=> =b ((unit ,@u) [~ 2]) - ~talsur-todres/try=> =c |=([a=@ b=@] (add a b)) - ~talsur-todres/try=> (clap a b c) - [~ 3] - - ++ drop - Produce a list of the unit-value - --- - Build wet %gold gate with sample unit a - If: a is null - Then: produce null - Else, produce the list [u.a ~] - --- - ~divreg-misdef/try=> =a ((unit ,@) [~ 97]) - ~divreg-misdef/try=> (drop a) - [i=97 t=~] - --- - ~divreg-misdef/try=> =a ((unit ,@) [~]) - ~divreg-misdef/try=> (drop a) - ~ - - ++ fall - A default value 'b' for the unit 'a' when 'a' is null - --- - Build wet %gold gate with sample unit a and noun b - If: a is null - Then: produce b - Else: produce the unit-value of a - --- - ~talsur-todres/try=> (fall ~ `a`) - `a` - --- - ~talsur-todres/try=> (fall [~ u=0] `a`) - 0 -++ mate - Produce the unit 'a' or 'b' which is not null and crashes with error "mate" if they are equal. - --- - Creates a wet %gold gate with a sample which accepts a two units. - Builds an if-then-else statement on "b is null." - If so, produce a. - Else, build an if-then-else statement on "a is null." - If so, produce b. - Else, build an if-else-then statement on u.a=u.b. Crash on "mate" if false, produce a if true. - Examples: - ~divreg-misdef/try=> =a ((unit ,@) [~ 97]) - ~divreg-misdef/try=> =b ((unit ,@) [~ 97]) - ~divreg-misdef/try=> (mate a b) - [~ 97] - --- - ~divreg-misdef/try=> =a ((unit ,@) [~ 97]) - ~divreg-misdef/try=> =b ((unit ,@) [~]) - ~divreg-misdef/try=> (mate a b) - [~ 97] - --- - ~divreg-misdef/try=> =a ((unit ,@) [~ 97]) - ~divreg-misdef/try=> =b ((unit ,@) [~ 98]) - ~divreg-misdef/try=> (mate a b) - ! 'mate' - ! exit -++ need - Retrieve the value from a unit, crashing if the unit is null. - --- - Build wet %gold gate with sample unit a of any type. - If: p is null, - Then: fail, - Else: u.a, the value of the unit. - --- - ~divreg-misdef/try=> =a ((unit ,[@t @t]) [~ [`a` ' b']]) - ~divreg-misdef/try=> (need a) - [`a` ' b'] - ~divreg-misdef/try=> =a ((unit ,@) [~]) - ~divreg-misdef/try=> (need a) - ! exit -++ some - lift - Description: - Casts any noun a to its unit, [~ a]. - --- - Creates a wet %gold gate with a sample which accepts any noun. - Produces the tuple [~ u=a], the unit of value a. - Examples: - ~divreg-misdef/try=> (some [`a` `b`]) - [~ u=[`a` `b`]] - --- - ~divreg-misdef/try=> (some &) - [~ u=%.y] - -Section 2bB, lists - -++ flop - reverse - Description: - Produces the list 'a' with the elements reversed. - --- - Activate jet. - Creates a wet %gold gate with a sample which accepts a single list. - 'a' is then replaced with (homo a) and used as the subject for the code below (=>). - The type of the result must be the same as a, our argument list. - Let b be a list of the type of the icon of a, as it is bunted. - Create and kick a dry %gold trap - Builds an if-then-else statement on "a is an atom." - If so, produce b. - Else, recursively call flop with a replaced by it's tail and b replaced by [i.a b], where - i.a is the head of a. - Examples: - ~palryp-hocsyt/try=> =lyst (limo [1 2 3 4 ~]) - ~palryp-hocsyt/try=> lyst - [i=1 t=[i=2 t=[i=3 t=[i=4 t=~]]]] - ~palryp-hocsyt/try=> (flop lyst) - ~[4 3 2 1] - --- - ~palryp-hocsyt/try=> (flop (limo [1 'a' 2 'b' (some 10) ~])) - ~[[~ u=10] 98 2 97 1] -++ homo - homogenize - Description: - Homogenizes a lists' type information. - --- - Creates a wet %gold gate with a sample which accepts a single list. - Makes the type of the result the type of the product of the code below (^+). - The subject of the arm ($) is then the product of the barcen statement below (=<). - Creates a %gold core (|%) and the arm '+- $'. - XXX BLACK BOX, ABANDON ALL HOPE YE WHO ENTER HERE XXX - Terminates the core. - Produces list a. - Examples: - ~palryp-hocsyt/try=> lyst - [i=1 t=[i=97 t=[i=2 t=[i=98 t=[i=[~ u=10] t=~]]]]] - ~palryp-hocsyt/try=> (homo lyst) - ~[1 97 2 98 [~ u=10]] - --- - ~palryp-hocsyt/try=> =a (limo [1 2 3 ~]) - ~palryp-hocsyt/try=> a - [i=1 t=[i=2 t=[i=3 t=~]]] - ~palryp-hocsyt/try=> (homo a) - ~[1 2 3] -++ limo - listify - Description: - Produces a list from any null-terminated tuple. - --- - Creates a wet %gold gate with a sample which accepts a single list. - Makes the type of the result the type of the product of the code below (^+). - The subject of the arm ($) is then the product of the barcen statement below (=<). - Creates a %gold core (|%) and the arm '+- $'. - XXX BLACK BOX, ABANDON ALL HOPE YE WHO ENTER HERE XXX - Terminates the core. - Produces list a. - Examples: - ~palryp-hocsyt/try=> (limo [1 'a' 2 'b' (some 10) ~]) - [i=1 t=[i=97 t=[i=2 t=[i=98 t=[i=[~ u=10] t=~]]]]] - --- - ~palryp-hocsyt/try=> (limo [`a` `b` ~]) - [i=`a` t=[i=`b` t=~]] - --- - ~palryp-hocsyt/try=> (limo [2 1 ~]) - [i=2 t=[i=1 t=~]] -++ lent - length - Description: - Produces the atomic length of any list. - --- - Activate jet. - Creates a dry %gold gate with a sample which accpets a single list. - Must produce an atom. - Let b be 0. - Creates and kicks a dry %gold trap. - Builds an if-then-else statement on "a is an atom." If so, produces b. - Else, recursively calls length with the list set to the tail of a and the accumulator, b, incremented. - Examples: - ~palryp-hocsyt/try=> (lent (limo [1 2 3 4 ~])) - 4 - --- - ~palryp-hocsyt/try=> (lent (limo [1 'a' 2 'b' (some 10) ~])) - 5 -++ levy - all of - Description: - Applies the loobean gate 'b' to every element of the list 'a', producing the logical AND of all the results. - --- - Activate jet. - Creates a wet %gold gate with a sample which accepts a list and a gate with a sample of any noun - and produces a loobean. - Then, a dry %gold trap is created and kicked. It must produce a loobean. - Builds an if-then-else statement on "a is an atom." - If so, produce true. - Else, build an if-then-else statement on (b i.a) - If so, then recursively call levy with a replaced by the tail of a. - Else, produce no. - Examples: - ~palryp-hocsyt/try=> =b |=(a=@ (gte a 1)) - ~palryp-hocsyt/try=> (levy (limo [0 1 2 1 ~]) b) - %.n - --- - ~palryp-hocsyt/try=> =b |=(a=@ (gte a 0)) - ~palryp-hocsyt/try=> (levy (limo [0 1 2 1 ~]) b) - %.y -++ lien - Is the slam of any element in list `a` to `b` true? - --- - Activate jet. - Build wet %gold gate with sample list `a`, gate which accepts a noun and produces a bean `b` - Kick dry %gold trap. Yield bean. - If: `a` is null, - Then: Produce false. - Else: Unless the slam of the head of `a` to `b`, - Then: Produce true. - Else: Produce the toss of `a` for `t.a` - --- - ~palryp-hocsyt/try=> =a |=(a=@ (gte a 1)) - ~palryp-hocsyt/try=> (lien (limo [0 1 2 1 ~]) a) - %.y - ~palryp-hocsyt/try=> =a |=(a=@ (gte a 3)) - ~palryp-hocsyt/try=> (lien (limo [0 1 2 1 ~]) a) - %.n -++ reel - Right fold - Move right to left recursively slamming a binary gate with an element from the list and an accumulator, - producing the final value of the accumulator. - --- - Activate jet. - Build wet %gold gate sample list `a`, bunt of gate `b` which accepts two nouns and produces `q` - Kick dry %gold trap. Cast the result to the type of `q` in `b` - If: a is an atom: - Then: Produce the noun `q` in the sample of `b` - Else: Produce `b` slammed by: - The head of `a` - The toss of `a` for the tail of `a` - --- - ~palryp-hocsyt/try=> =sum =|([p=@ q=@] |.((add p q))) - ~palryp-hocsyt/try=> (reel (limo [1 2 3 4 5 ~]) sum) - 15 - ~palryp-hocsyt/try=> =a =|([p=@ q=@] |.((sub p q))) - ~palryp-hocsyt/try=> (reel (limo [6 3 1 ~]) a) - 4 - ~palryp-hocsyt/try=> (reel (limo [3 6 1 ~]) a) - ! subtract-underflow - ! exit -++ roll - Left fold - Move left to right recursively slamming a binary gate with an element from the list and an accumulator, - producing the final value of the accumulator. - --- - Activate jet. - Build wet %gold gate with sample list `a`, bunt of gate `b` which accepts two nouns and produces `q` - Kick dry %gold trap. Cast the result to the type of `q` in `b` - If: a is an atom, - Then: Produce `q` in `b` - Else: Produce the toss of `a` for the tail of `a`, `b` for `b` with `q` replaced by `b` slammed by the head of `a` - and `q` in `b` - --- - ~barred-tidset/try=> =a =|([p=@ q=@] |.((sub p q))) - ~barred-tidset/try=> (roll (limo [1 2 3 ~]) a) - 2 - ~barred-tidset/try=> (roll (limo [3 6 3 ~]) a) - 0 -++ skid - Seperate a list `a` into two lists - Those elements of `a` who produce true when slammed to `b` and those who produce false. - --- - Activate jet. - Build wet %gold gate with sample list `a`, tile of gate `b` accepting a noun and producing a loobean. - Kick a dry %gold trap. Cast the result to the type of [p=a q=a], a cell of lists of type `a` - If: a is null, - Then: Produce [~ ~] a cell of null and null, - Else: Push `c` is the toss of `a` for the tail of `a` - If: The slam of the head of `a` to `b`, - Then: Produce the cell with the head of `a` added to the left element, - Else: Produce the cell with the head of `a` added to the right element. - Where `p.c` and `q.c` are the left and right elements, respectively. - --- - ~dovryp-toblug/try=> =a |=(a=@ (gth a 1)) - ~dovryp-toblug/try=> (skid (limo [0 1 2 3 ~]) a) - [p=[i=2 t=[i=3 t=~]] q=[i=0 t=[i=1 t=~]]] -++ skim - only - Description: - Accepts a list 'a' and a gate 'b' which takes any noun and produces loobean. - Produces the sublist of 'a' whose elements produce true by slamming the gate with them. - --- - Activate jet. - Creates a wet %gold gate with a sample which accepts a list and a gate which accepts any noun and - produces a loobean. - Creates and kicks a dry %gold trap. - Which must produce a list of a's type. - Builds an if-then-else statement on "a is an atom." - If so, prodoce null. - Else, build an if-then-else statement on (b i.a). If so, produce [i.a $(a t.a)], where $(a t.a) is the recursive - call of skim with a replaced by the tail of a. - Else, produce $(a t.a). - Examples: - ~dovryp-toblug/try=> =a |=(a=@ (gth a 1)) - ~dovryp-toblug/try=> (skim (limo [0 1 2 3 ~]) a) - [i=2 t=[i=3 t=~]] -++ skip - except - Description: - Accepts a 'a' list and a gate 'b' which takes any noun and produces a loobean. - Produces the sublist of 'a' whose elments produce false by slamming the gate with them. - --- - Activate jet. - Creates a wet %gold gate with a sample which accepts a list and a gate which accepts any noun and - produces a loobean. - Creates and kicks a dry %gold trap. - Which must produce a list of a's type. - Builds an if-then-else statement on "a is an atom." - If so, produce null. - Else build na if-then-else statement on (b i.a). If so, produce the recursive call of skip with a replacd by - the tail of a. - Else, produce [i.a $(a t.a)]. - Examples: - ~dovryp-toblug/try=> =a |=(a=@ (gth a 1)) - ~dovryp-toblug/try=> (skip (limo [0 1 2 3 ~]) a) - [i=0 t=[i=1 t=~]] -++ scag - prefix - Description: - Accepts an atom 'n' and list 'b', producing the first n elements at the front of the list. - --- - Activate jet. - Creates a wet %gold gate which accepts an atom and a list. - A dry %gold trap is created and kicked. It must produce a list of the same type as 'b'. - Builds an if-then-else statement on the logical OR statement (a=0 or b is in null). - If so, produce null. - Else, produce [i.b $(b t.b, a (dec a))] where 'i.b' is the head of 'b' and $(b t.b, a (dec a)) - is the recursive call of scag with 'b' replaced by the tail of 'b' and 'a' decremented. - Examples: - ~palryp-hocsyt/try=> (scag 2 (limo [0 1 2 3 ~])) - [i=0 t=[i=1 t=~]] - --- - ~palryp-hocsyt/try=> (scag 10 (limo [1 2 3 4 ~])) - [i=1 t=[i=2 t=[i=3 t=[i=4 t=~]]]] -++ slag - suffix - Description: - Accepts an atom 'n' and a list 'b', producing the last n elemnents at the back of the list. - --- - Activate jet. - Creates a wet %gold gate which accepts an atom and a list. - A dry %gold trap is created and kicked. It must produce a list of the same type as 'b'. - Builds an if-then-else statement on a=0. - If so, produce 'b'. - Else, build an if-then-else statement on "b is an atom." - If so, produce null. - Else, call slag recursively with b replaced by the tail of b, a replaced by the decrement of a. - Examples: - ~palryp-hocsyt/try=> (slag 2 (limo [0 1 2 3 ~])) - [i=2 t=[i=3 t=~]] - --- - ~palryp-hocsyt/try=> (slag 2 (limo [1 2 3 4 ~])) - [i=3 t=[i=4 t=~]] -++ snag - index - Description: - Accepts an atom and a list, producing the element at the index of the atom in the list and failing is the list - is null. - --- - Activate jet. - Creates a wet %gold gate which accepts an atom and a list. - A dry %gold trap is created and kicked. - Builds an if-then-else statement on "b is null." - If so, fail with "snag-fail" in the stack trace. - Else, build an if-then-else statement on a=0. - If so, produce the head of 'b'. - Else, recursively call snag with 'b' replaced by the tail of 'b' and 'a' decremented. - Examples: - ~palryp-hocsyt/try=> (snag 2 (limo [3 2 1 0 ~])) - 1 - --- - ~palryp-hocsyt/try=> (snag 4 (limo [1 2 3 4 5 6 7 8 ~])) - 5 -++ sort - quicksort - Description: - Accepts a list and a gate with a sample which accepts two nouns and produces a loobean. 'sort' then produces a - list of the elements of 'a' sorted according to 'b'. - --- - Activate jet. - Creates a wet %gold gate with a sample which accepts a list and a gate which accepts two nouns and - produces a loobean. - Homogenizes the list and makes it the subject of the following code, casting the following to the - homogenized list type. - Creates and kicks dry %gold trap. It must produce a list of a's type. - Builds an if-then-else statement on "a is null." If so, produce null. - Slam the weld gate with the q and r below. - The q and r are then defined to be the recursive call of the trap with the skim of the tail by our sort gate. - For q, it skims by (b c i.a). For r, by !(b c i.a). - r is first cast to the type of the tail of 'a' and produced as a tuple behind the head of 'a'. - Examples: - ~dovryp-toblug/try=> =a =|([p=@ q=@] |.((gth p q))) - ~dovryp-toblug/try=> (sort (limo [0 1 2 3 ~]) a) - ~[3 2 1 0] -++ swag - infix - Description: - A range in a list - Produces the values in list 'c' starting at index 'a' and spanning 'b' elements - more than that. - --- - Creates a wet %gold gate with a sample which gate which accepts a tuple of atoms and a list 'c'. - The last 'a' elements in 'c' are selected by slag. Then the first 'b' elements of - those last elements are selected and produced by scag. - Examples: - ~palryp-hocsyt/try=> (swag [0 5] (limo [1 2 3 4 5 6 7 8 9 10 ~])) - [i=1 t=[i=2 t=[i=3 t=[i=4 t=[i=5 t=~]]]]] - --- - ~palryp-hocsyt/try=> (swag [3 5] (limo [1 2 3 4 5 6 7 8 9 10 ~])) - [i=4 t=[i=5 t=[i=6 t=[i=7 t=[i=8 t=~]]]]] - --- - ~palryp-hocsyt/try=> (swag [1 2] (limo [1 2 3 ~])) - [i=2 t=[i=3 t=~]] -++ turn - Accepts a list and a gate. Produces the list with the gate applied to each element of the original list. - --- - Activate jet. - Creates a wet %gold gate which accepts a list and a gate. - Creates and kicks a dry %gold trap. - Builds an if-then-else statement on "a is an atom." - If so, produce null. - Else, produce the tuple with head (b i.a) and tail that is turn applied recursively to the tail of 'a'. - --- - ~dovryp-toblug/try=> (turn (limo [104 111 111 110 ~]) ,@t) - <|h o o n|> -++ weld - concatenate - Description: - Concatenates two lists. - --- - Activate jet. - Creates a wet %gold gate which accepts two lists. - Homogenizes both lists and makes them the subject of the following code. - A dry %gold trap is created and kicked. It must produce the type of list 'b'. - Builds an if-then-else statement on "a is null." If so, produce 'b'. - Else, produce the tuple [i.a $(a t.a)]. 'i.a' is the head of 'a', $(a t.a) the recursive call of weld - with 'a' replaced by the tail of a. - Examples: - ~palryp-hocsyt/try=> (weld (limo [1 2 3 ~]) (limo [4 5 6 ~])) - ~[1 2 3 4 5 6] - ~palryp-hocsyt/try=> (weld "foo" "bar") - ~[~~f ~~o ~~o ~~b ~~a ~~r] -++ welp - perfect weld - Description: - Concatenates two lists without losing their type information to homogenization. - Produces a tape when passed two tapes. - --- - XXX DON'T WORRY ABOUT HOW THIS WORKS, IT IS A PERPETUAL MIYSTERY TO US ALL. XXX - Examples: - ~palryp-hocsyt/try=> (welp "foo" "bar") - "foobar" -++ wild - concatenate - Description: - Concatenates two lists without casting the product back to a list. - --- - Creates a wet %gold gate with a sample which accepts two lists. - Homogenizes both lists and makes them the subject of the following code. - A dry %gold gate is created and kicked. - Builds an if-then-else statement on "a is null." If so, produce 'b'. - Else, produce the tuple with head (b i.a) and tail that is turn applied recursively to the tail of 'a'. - Examples: - ~palryp-hocsyt/try=> =norm (limo [1 2 3 4 5 ~]) - ~palryp-hocsyt/try=> =norm2 (limo [6 7 8 ~]) - ~palryp-hocsyt/try=> (wild norm norm2) - ~[1 2 3 4 5 6 7 8] - --- - ~palryp-hocsyt/try=> (wild "foo" "bar") - ~[~~f ~~o ~~o ~~b ~~a ~~r] - --- - ~palryp-hocsyt/try=> (homo (weld "foo" "bar")) - ~[~~f ~~o ~~o ~~b ~~a ~~r] - ~palryp-hocsyt/try=> (homo (wild "foo" "bar")) - ! -find-limb.t - ! find-fork - ! exit -++ zing - promote - Description: - Turns a list of lists into a single list by promoting the elements of each sublist into the higher. - --- - Creates a wet %gold gate with a sample that accepts a list of lists. - Casts the result to the type the homogenized list head, asserting that 'a' is at least a cell. - A dry %gold trap is created and kicked. - Builds an if-then-else statement on "a is null." If so, produce null. - Else, weld together the head of a with the recrusive call of zing on the tail of a. - Examples: - ~palryp-hocsyt/try=> (zing (limo [(limo ['a' 'b' 'c' ~]) (limo ['e' 'f' 'g' ~]) (limo ['h' 'i' 'j' ~]) ~])) - ~['a' 'b' 'c' 'e' 'f' 'g' 'h' 'i' 'j'] - ~palryp-hocsyt/try=> (zing (limo [(limo [1 'a' 2 'b' ~]) (limo [3 'c' 4 'd' ~]) ~])) - ~[1 97 2 98 3 99 4 100] - -chapter 2c, simple noun surgery - -section 2cA, bit surgery **capitalization of "section" inconsistent in source** - -++ bex - binary exponent - Description: - Produces 2 to the nth power for some atom 'n'. - --- - Activate jet. - Creates a dry %gold gate which accepts a single atom. - Casts the result to an atom. - Builds an if-then-else statement on a=0. - If so, produce 1. - Else, multiply two by the recursive call of bex on the decrement of a. - Examples: - ~palryp-hocsyt/try=> (bex 4) - 16 - ~palryp-hocsyt/try=> (bex (add 19 1)) - 1.048.576 - ~palryp-hocsyt/try=> (bex 0) - 1 -++ xeb - binary logarithm - Description: - Takes the base-2 logarithm of an atom. - --- - Creates a dry %gold gate with a sample which accepts an atom. - Casts the result to an atom. - Evaluates the logarithm by counting the number of bits the number in question occupies. - Examples: - ~palryp-hocsyt/try=> (xeb 31) - 5 - -- - ~palryp-hocsyt/try=> (xeb 32) - 6 - -- - ~palryp-hocsyt/try=> (xeb 49) - 6 - -- - ~palryp-hocsyt/try=> (xeb 0) - 0 - -- - ~palryp-hocsyt/try=> (xeb 1) - 1 - -- - ~palryp-hocsyt/try=> (xeb 2) - 2 -++ can - assemble - Description: - Assembles a - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a bloq size (an atom) and - a list of atomic tuples. - Casts the result to an atom. - Builds an if-then-else statement on "b is null." - If so, produce 0. - Else, - Examples: - ~ronrem-lonsem/try=> `@ub`(can 3 ~[[1 1]]) - 0b1 - --- - ~ronrem-lonsem/try=> `@ub`(can 0 ~[[1 255]]) - 0b1 - --- - ~ronrem-lonsem/try=> `@ub`(can 1 ~[[1 2]]) - 0b10 - --- - ~ronrem-lonsem/try=> `@ub`(can 1 ~[[1 3]]) - 0b11 - --- - ~ronrem-lonsem/try=> `@ub`(can 1 ~[[1 4]]) - 0b0 - --- - ~ronrem-lonsem/try=> `@ub`(can 1 ~[[2 4]]) - 0b100 -++ cat - concatenate - Description: - Concatenates two atoms, obeying the given block size. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a bloq size (an atom) and - two atoms. - Measures the number of blocks of size 'a' are in 'b'. - Left shifts 'c' that many times the bock size of 'a'. - Sums the result of the left shift with 'b'. - Examples: - ~ronrem-lonsem/try=> `@ub`(cat 1 1 0) - 0b1 - ~ronrem-lonsem/try=> `@ub`(cat 2 1 0) - 0b1 - ~ronrem-lonsem/try=> `@ub`(cat 4 1 0) - 0b1 - ~ronrem-lonsem/try=> `@ub`(cat 0 1 1) - 0b11 - ~ronrem-lonsem/try=> `@ub`(cat 0 2 1) - 0b110 - ~ronrem-lonsem/try=> `@ub`(cat 2 1 1) - 0b1.0001 - ~ronrem-lonsem/try=> `@ub`256 - 0b1.0000.0000 - ~ronrem-lonsem/try=> `@ub`255 - 0b1111.1111 - ~ronrem-lonsem/try=> `@ub`(cat 3 256 255) - 0b1111.1111.0000.0001.0000.0000 - ~ronrem-lonsem/try=> `@ub`(cat 2 256 255) - 0b1111.1111.0001.0000.0000 - ~ronrem-lonsem/try=> (cat 3 256 255) - 16.711.936 -++ cut - slice - Description: - Accepts a block size 'a', a cell of two atoms 'b' and 'c' and another atom 'd'. - Produces the tail of 'd' that is 'c' blocks long after right-shifting 'd' 'b'-blocks. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a block size (an atom), - a cell of two atoms, and another atom which will be "cut." - Right-shifts 'd' by 'b' blocks. Then produces the 'c' block long tail of this right-shift. - Examples: - ~ronrem-lonsem/try=> (cut 0 [1 1] 2) - 1 - ~ronrem-lonsem/try=> (cut 0 [2 1] 4) - 1 - ~ronrem-lonsem/try=> (cut 3 [1 1] 256) - 1 - ~ronrem-lonsem/try=> (cut 2 [1 1] 255) - 15 - ~ronrem-lonsem/try=> (cut 1 [1 1] 255) - 3 - ~ronrem-lonsem/try=> (cut 1 [1 2] 255) - 15 -++ end - tail - Description: - Accepts a block 'a' and two atoms, 'b' and 'c'. - Produces the 'b' blocks of length 'a' on the end of 'c'. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a block (an atom) and - two atoms. - Multiplies the binary exponent of 'a' (2^a) with 'b', then takes the binary exponent - of that (2^((2^a)*b)) to finally produce the modulus of 'c' and the ensuing product. - Examples: - ~ronrem-lonsem/try=> `@ub`12 - 0b1100 - --- - ~ronrem-lonsem/try=> `@ub`(end 0 3 12) - 0b100 - --- - ~ronrem-lonsem/try=> (end 0 3 12) - 4 - --- - ~ronrem-lonsem/try=> `@ub`(end 1 3 12) - 0b1100 - --- - ~ronrem-lonsem/try=> (end 1 3 12) - 12 - --- - ~ronrem-lonsem/try=> (end 3 1 256) - 0 - --- - ~ronrem-lonsem/try=> (end 3 1 255) - 255 -++ fil - fill bloqstream - Description: - - --- - Creates a dry %gold gate with a sample which accepts a block size (an atom) and - two other atoms. - Let 'n' be 0. - Let 'd' be 'c'. - Creates and kicks a dry %gold trap whose result is cast to a atom. - Builds an if-then-else statement on n=b. - If so, produce the right-shift of 'd' by one block. - Else, recursively call the trap with 'd' replaced by the sum of 'c' and the one block - left-shift of 'b', n replaced by the increment of n. - Examples: - -++ lsh - left shift - Description: - Accepts a block size 'a' and two atoms 'b' and 'c'. Produces 'c' left-shifted - 'b' times by the block size. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a block (an atom) and - two atoms. - Multiplies 'c' times the binary exponent of the binary exponent of 'a' times 'b', - that is ((2^((2^a)*b))*c), this producing the desired left-shift on 'c'. - Examples: - ~ronrem-lonsem/try=> `@ub`1 - 0b1 - --- - ~ronrem-lonsem/try=> `@ub`(lsh 0 1 1) - 0b10 - --- - ~ronrem-lonsem/try=> (lsh 0 1 1) - 2 - --- - ~ronrem-lonsem/try=> `@ub`255 - 0b1111.1111 - --- - ~ronrem-lonsem/try=> `@ub`(lsh 3 1 255) - 0b1111.1111.0000.0000 - --- - ~ronrem-lonsem/try=> (lsh 3 1 255) - 65.280 -++ met - measure - Description: - Measures the number of blocks of size 'a' are in 'b'. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a block size (an atom) and - an atom. - Casts the result to an atom. - Let 'c' be 0. - Creates and kicks a dry %gold trap. - Builds an if-then-else statement on b=0. - If so, produce c. - Else, recursively call the trap, with - 'b' replaced by the single-block right-shift of 'b' and 'c' by the increment of 'c'. - Examples: - ~ronrem-lonsem/try=> (met 0 1) - 1 - ~ronrem-lonsem/try=> (met 0 2) - 2 - ~ronrem-lonsem/try=> (met 3 255) - 1 - ~ronrem-lonsem/try=> (met 3 256) - 2 -++ rap - Concatenate a list of atoms while obeying a given blocksize. - --- - Activate jet. - Build a dry %gold gate with sample bloq `a`, list of atoms `b` - Yield atom - If: `b` is null, - Then: Produce 0. - Else: Produce cat slammed with `a`, the head of `b`, and the toss of `b` for the tail of `b` - --- - ~palryp-hocsyt/try=> (rap 2 (limo [1 2 3 4 ~])) - 17.185 - ~palryp-hocsyt/try=> (rap 1 (limo [1 2 3 4 ~])) - 313 - ~palryp-hocsyt/try=> (rap 0 (limo [0 0 0 ~])) - 0 - ~palryp-hocsyt/try=> (rap 0 (limo [0 0 1 ~])) - 1 -++ rep - Assembles - - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a block size (an atom) and - a list of atoms. - Casts the result to an atom. - Let 'c' be 0. - Creates and kicks a dry %gold trap. - Build an if-then-else statement on "b is an atom." - If so, produce 0. - Else, produce the binary logical OR of the 'c' time left-shift on the last block - of the head of 'b' and the recursive call of the trap with: - 'c' replaced by the increment of 'c'. - 'b' replaced by the tail of 'b'. - Examples: - ~palryp-hocsyt/try=> (rep 0 (limo [1 2 3 4 ~])) - 5 - --- - ~palryp-hocsyt/try=> (rep 1 (limo [1 2 3 4 ~])) - 57 - --- - ~palryp-hocsyt/try=> (rep 0 (limo [1 0 0 ~])) - 1 - --- - ~palryp-hocsyt/try=> (rep 0 (limo [1 0 0 0 ~])) - 1 - --- - ~palryp-hocsyt/try=> (rep 0 (limo [0 1 0 0 ~])) - 2 - --- - ~palryp-hocsyt/try=> (rep 0 (limo [0 1 0 1 ~])) - 10 - --- - ~palryp-hocsyt/try=> (rep 0 (limo [0 1 0 1 0 1 ~])) - 42 -++ rip - disassemble - Description: - Produces a list of the bits of an atom, in little endian order, according to - block size. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a block size (an atom) and - any number. - Cast the result to a list of atoms. - Builds an if-then-else statement on b=0. - If so, produce null. - Else, produce a tuple with head of (end a 1 b), the single-block tail of 'b', and - the resursive call of rip with 'b' replaced by the single-block right-shift of 'b'. - in little endian. - Examples: - palryp-hocsyt/try=> `@ub`155 - 0b1001.1011 - --- - ~palryp-hocsyt/try=> (rip 0 155) - ~[1 1 0 1 1 0 0 1] - --- - ~palryp-hocsyt/try=> (rip 2 155) - ~[11 9] - --- - ~palryp-hocsyt/try=> (rip 1 155) - ~[3 2 1 2] - --- - ~palryp-hocsyt/try=> `@ub`256 - 0b1.0000.0000 - --- - ~palryp-hocsyt/try=> (rip 0 256) - ~[0 0 0 0 0 0 0 0 1] - --- - ~palryp-hocsyt/try=> (rip 2 256) - ~[0 0 1] - --- - ~palryp-hocsyt/try=> (rip 3 256) - ~[0 1] - -++ rsh - right shift - Description: - Accepts a block size 'a' and two atoms, 'b' and 'c'. Right-shifts 'c' by 'b' blocks - of size 'a'. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a block size (an atom) and - two atoms. - Takes the binary exponent of the binary exponent of 'a' multiplied by 'b', - that is (2^(((2^a)*b))) and divides 'c' by it, producing the desired - right-shift on 'c'. - Examples: - ~ronrem-lonsem/try=> `@ub`145 - 0b1001.0001 - --- - ~ronrem-lonsem/try=> `@ub`(rsh 1 1 145) - 0b10.0100 - --- - ~ronrem-lonsem/try=> (rsh 1 1 145) - 36 - --- - ~ronrem-lonsem/try=> `@ub`(rsh 2 1 145) - 0b1001 - --- - ~ronrem-lonsem/try=> (rsh 2 1 145) - 9 - --- - ~ronrem-lonsem/try=> `@ub`10 - 0b1010 - --- - ~ronrem-lonsem/try=> `@ub`(rsh 0 1 10) - 0b101 - --- - ~ronrem-lonsem/try=> (rsh 0 1 10) - 5 - --- - ~ronrem-lonsem/try=> `@ub`1 - 0b1 - --- - ~ronrem-lonsem/try=> (rsh 0 1 1) - 0 - --- - ~ronrem-lonsem/try=> (rsh 0 1 1) - 0 -++ swap - reverse bloq order - Description: - Produces the reversed block order of a number, obeying block number. - Switches little ending to big and vice versa. - --- - Creates a dry %gold gate with a sample which accepts a block size (an atom) and - an atom. - Rips apart the atom by the block size, then reverses the tape that is produced. - Once it is reversed, it is re-assembled using rep. - Examples: - ~palryp-hocsyt/try=> `@ub`24 - 0b1.1000 - --- - ~palryp-hocsyt/try=> (swap 0 24) - 3 - --- - ~palryp-hocsyt/try=> `@ub`3 - 0b11 - --- - ~palryp-hocsyt/try=> (swap 0 0) - 0 - --- - ~palryp-hocsyt/try=> (swap 1 24) - 9 - --- - ~palryp-hocsyt/try=> (swap 0 128) - 1 -section 2cB, bit logic - -++ con - binary or - Description: - Produces the bit-wise logical OR of two atoms. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts two atoms. - Let 'c' be 0, d be 0. - Creates and kicks a dry %gold trap. Casts the result to an atom. - Builds an if-then-else statement on a=b AND b=0. - If so, produce 'd'. - Else, recursively call the trap with: - 'a' replaced by the single 0-block right shift of 'a'. - 'b' replaced by the single 0-block right-shift of 'b'. - 'c' replaced by the increment of c. - 'd' replaced by the sum of 'd' and the 'c' 0-block left-shift of the - logical AND of (last bit of 'a')=0 AND (last bit of 'b')=0. - (==) terminates the list of changes. - Examples: - ~palryp-hocsyt/try=> (con 0 1) - 1 - --- - ~palryp-hocsyt/try=> (con 1 0) - 1 - --- - ~palryp-hocsyt/try=> (con 0 0) - 0 - --- - ~palryp-hocsyt/try=> (con 4 4) - 4 - --- - ~palryp-hocsyt/try=> (con 10.000 234) - 10.234 -++ dis - binary and - Description: - Produces the bit-wise logical AND of two atoms. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts two atoms. - Pushes the bunt of a two atom tuple onto the subject. - Creates and kicks a dry %gold trap. Casts its result to an atom. - Builds an if-then-else statement on a=0 or b=0. - If so, produce 'd'. - Else, recursively call the trap with: - 'a' replaced by the single 0-block right-shift of 'a'. - 'b' replaced by the single 0-block right-shift of 'b'. - 'c' replaced by the increent of 'c'. - 'd' replaced by the sum of 'd' and the 'c' 0-block left-shift of the - logical OR of (last bit of 'a')=0 OR (last bit of 'b')=0. - (==) terminates the list of changes. - Examples: - ~ronrem-lonsem/try=> `@ub`9 - 0b1001 - --- - ~ronrem-lonsem/try=> `@ub`5 - 0b101 - --- - ~ronrem-lonsem/try=> `@ub`(dis 9 5) - 0b1 - --- - ~ronrem-lonsem/try=> (dis 9 5) - 1 - --- - ~ronrem-lonsem/try=> `@ub`534 - 0b10.0001.0110 - --- - ~ronrem-lonsem/try=> `@ub`987 - 0b11.1101.1011 - --- - ~ronrem-lonsem/try=> `@ub`(dis 534 987) - 0b10.0001.0010 - --- - ~ronrem-lonsem/try=> (dis 534 987) - 530 -++ mix - binary xor - Description: - Produces the bit-wise logical exclusive OR of two atoms. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts two atoms. - Casts the result to an atom. - Let 'c' be 0, 'd' be 0. - A dry %gold trap is created and kicked. - Builds an if-then-else statement on a=0 AND b=0. - If so, produce 'd'. - Else, recursively call mix with: - 'a' replaced by - 'b' replaced by - 'c' replaced by the increment of 'c'. - 'd' replaced by - (==) terminates the list of changes. - Examples: - ~ronrem-lonsem/try=> `@ub`2 - 0b10 - ~ronrem-lonsem/try=> `@ub`3 - 0b11 - ~ronrem-lonsem/try=> `@ub`(mix 2 3) - 0b1 - ~ronrem-lonsem/try=> (mix 2 3) - 1 - ~ronrem-lonsem/try=> `@ub`(mix 2 2) - 0b0 - ~ronrem-lonsem/try=> (mix 2 2) - 0 -++ not - binary not (sized) - Description: - Produces the bit-wise logical NOT over 'b' blocks of the given blocksize. - --- - First produces the binary exponent of the binary exponent of the block size times - 'b'. This is decremented before being multiplied by 'c'. - Finally, this product is exclusive ORed and produced. - Examples: - ~palryp-hocsyt/try=> `@ub`24 - 0b1.1000 - --- - ~palryp-hocsyt/try=> (not 0 5 24) - 7 - --- - ~palryp-hocsyt/try=> `@ub`7 - 0b111 - --- - ~palryp-hocsyt/try=> (not 2 5 24) - 1.048.551 - --- - ~palryp-hocsyt/try=> (not 2 5 1.048.551) - 24 - --- - ~palryp-hocsyt/try=> (not 1 1 (not 1 1 10)) - 10 - -section 2cC, noun orders - -++ aor - a-order - Description: - Alphabetic comparator gate. - --- - Activate jet. - Creates a dry %gold gate which accepts two nouns. - Casts the result to a loobean. - Builds an if-then-else statement on a=b. - If so, produce true. - Else, build an unless-then-else statement on "a is an atom." - If 'a' is not an atom, build an unless-then-else statement on "b is an atom." - If so, build an if-then-else statement on (-.a=-.b) where -.a is the head of 'a'. - If so, recursively call aor with 'a' and 'b' replaced by their respecitve tails. - Else, recursively call aor with 'a' and 'b' replaced by their respective heads. - Else (if 'b' is an atom), produce false. - Else (if 'a' is an atom), build an unless-then-else statement on "b is an atom." - If so, produce true. - Else, create and kick a dry %gold gate. - Let 'c' be the byte tail of 'a', 'd' be the byte tail of 'b'. - Builds an if-then-else statement on (c=d). - If so, produce the recursive call to the trap with 'a' replaced by the byte right-shift of 'a' - and 'b' replaced by the byte right-shift of 'b'. - Else (if !(c=d)), produce (c (aor 'a' 'b') - %.y - ~tadbyl-hilbel/try=> (aor 'b' 'a') - %.n - --- - ~tadbyl-hilbel/try=> (aor "foo" "bar") - %.n - ~tadbyl-hilbel/try=> (aor "bar" "foo") - %.y - --- - ~tadbyl-hilbel/try=> (aor "abcdefz" "abcdefa") - %.n - ~tadbyl-hilbel/try=> (aor "abcdefa" "abcdefz") - %.y - --- - ~tadbyl-hilbel/try=> (aor 10.000 17.000) - %.y - ~tadbyl-hilbel/try=> (aor 10 9) - %.n -++ dor - d-order - Description: - Numeric comparator gate. - --- - Activate jet. - Creates a dry %gold gate which accepts two nouns. - Casts the result to a loobean. - Builds an if-then-else statement on a=b. - If so, produce true. - Else, build an unless-then-else statement on "a is an atom." - If 'a' is not an atom, build an unless-then-else statement on "b is an atom." - If so, build an if-then-else statement on (-.a=-.b) where -.a is the head of 'a'. - If so, recursively call dor with 'a' and 'b' replaced by their respecitve tails. - Else, recursively call dor with 'a' and 'b' replaced by their respective heads. - Else ('b' is an atom), produce false. - Else ('a' is an atom), build an unless-then-else statement on "b is an atom." - If so, produce true. - Else, produce (a (dor 1 2) - %.y - ~tadbyl-hilbel/try=> (dor 2 1) - %.n - --- - ~tadbyl-hilbel/try=> (dor ~[1 2 3] ~[1 2 4]) - %.y - ~tadbyl-hilbel/try=> (dor ~[1 2 4] ~[1 2 3]) - %.n - --- - ~tadbyl-hilbel/try=> (dor (limo ~[99 100 10.000]) ~[99 101 10.000]) - %.y - ~tadbyl-hilbel/try=> (dor ~[99 101 10.999] (limo ~[99 100 10.000])) - %.n -++ gor - g-order - Description: - Hash comparator gate. - --- - Activate jet. - Creates a dry %gold gate which accepts two nouns. - Casts the result to a loobean. - Let 'c' be the mug (FNV-1a hash) of 'a' an 'd' the mug of 'b'. - Create an if-then-else statement on c=d. - If so, produce the d-order of 'a' and 'd'. - Else, produce the loobean (c (gor 'd' 'c') - %.y - ~palryp-hocsyt/try=> 'd' - 'd' - ~palryp-hocsyt/try=> 'c' - ~palryp-hocsyt/try=> `@ud`'d' - 100 - ~palryp-hocsyt/try=> `@ud`'c' - 99 - ~palryp-hocsyt/try=> (mug 'd') - 1.628.185.714 - ~palryp-hocsyt/try=> (mug 'c') - 1.712.073.811 - ~palryp-hocsyt/try=> (gor 'd' 'c') - %.y - ~palryp-hocsyt/try=> (gor 'c' 'd') - %.n - --- - ~palryp-hocsyt/try=> (gor "foo" "bar") - %.n - --- - ~palryp-hocsyt/try=> (gor (some 10) (limo [1 2 3 ~])) - %.n -++ hor - h-order - Description: - Recursive hash comparator gate. - --- - Activate jet. - Creates a dry %gold gate which accepts two nouns. - Casts the result to a loobean. - Build an if-then-else statement on "a is an atom." - If so, build na if-then-else statment on "b is an atom." - If so, produce the g-order of 'a' and 'b'. - Else (if 'b' is not an atom), produce true. - Else (if 'a' is not an atom), build an if-then-else statement on "b is an atom." - If so, produce false. - Else, build an if-then-else statement on (-.a=-.b), where '-.a' is the head of 'a'. - If so, produce the g-order of the tails of 'a' and 'b'. - Else (if the heads of 'a' and 'b' are not equal), produce the g-order of the tails of 'a', 'b'. - Examples: - -++ vor - v-order - Description: - Double hash comparator gate. - --- - Activate jet. - Creates a dry %gold gate which accepts two nouns. - Casts the result to a loobean. - Let 'c' be the double mug (FNV-1a hash) of 'a', 'd' that of 'b'. - Builds an if-then-else statement on (c=d). - If so, produce the d-order of 'a' and 'b'. - Else, produce the loobean of (c (vor 'f' 'g') - %.y - --- - ~palryp-hocsyt/try=> (vor 'a' 'z') - %.n - --- - ~palryp-hocsyt/try=> (vor 43.326 41.106) - %.n - -section 2cD, insecure hashing - -++ fnv - FNV scrambler - Description: - Hashes an atom with the 32-bit FNV non-cryptographic hash algorithm. - --- - Multiplies 'a' by the prime number 16,777,619 and then takes the block of - size 5 off the product's end. - Examples: - ~palryp-hocsyt/try=> (fnv 10.000) - 272.465.456 - --- - ~palryp-hocsyt/try=> (fnv 10.001) - 289.243.075 - --- - ~palryp-hocsyt/try=> (fnv 1) - 16.777.619 -++ mug - 31bit nonzero FNV1a - Description: - Hashes any noun with the 31-bit nonzero FNV-1a non-cryptographic hash algorithm. - --- - Activate jet. - Creates a dry %gold gate with a sample accepting any noun. - - (?^ and 'p' subsection fill in.) - - Let 'b' be 2,166,136,261. - Create and kick a dry %gold gate. Cast its result to an atom. - Let 'c' be 'b'. - Let 'd' be 0, 'e' be the number of bytes in 'a'. - Create and kick a dry %gold gate. Cast its result to an atom. - Builds an if-then-else statement on d=e. - If so, let 'f' be the bit-wise XOR on the 31 0-block shift on 'c' and the last - 31 blocks of 'c'. - Builds an unless-then-else statement on f=0. If then, produce 'f'. - Else, recursively call the trap above our current trap with 'b' replaced by +(b). - Else (d isn't equal to e), then recursively call the trap with 'c' replaced by - the fnv hash of the logical XOR of 'c' and (cut 3 [d 1] a), 'd' replaced by - the increment of 'd'. - - Examples: - ~palryp-hocsyt/try=> (mug 10.000) - 178.152.889 - --- - ~palryp-hocsyt/try=> (mug 10.001) - 714.838.017 - --- - ~palryp-hocsyt/try=> (mug 1) - 67.918.732 - --- - ~palryp-hocsyt/try=> (mug (some 10)) - 1.872.403.737 - --- - ~palryp-hocsyt/try=> (mug (limo [1 2 3 4 5 ~])) - 1.067.931.605 - -section 2cE, phonetic base - -++ po - left-right syllable - Description: - Provides the phonetic syllables and name generators for the Urbit naming system. - --- - Activate jet. - Create the cell [sis dex] where 'sis' and 'dex' are the togas on the - left-hand ("sinister") and right-hand ("Dexter") phonetic syllable cords, respectively. - Build %gold core to contain the following arms. - ++ ind - - Description: - --- - Activate jet. - Creates a dry %gold gate which accepts and atom. - Let 'b' be 0. - Creates and kicks a dry %gold trap, casting the result to an atomic unit. - Builds an if-then-else statement on (b=256). If so, produce null. - Else, build an if-then-else statement on (a=(tod b)). If so, produce the atomic unit [~ b]. - Else, recursively call the trap with 'b' replaced by the increment of 'b'. - Examples: - - ++ ins - - Description: - --- - Activate jet. - Creates a dry %gold gate which accepts and atom. - Let 'b' be 0. - Creates and kicks a dry %gold trap with the result cast to an atomic unit. - Builds an if-then-else statement on (b=256). If so, produce null. - Else, build an if-then-else statement on (a=(tos b)). If so, produce the atomic unit [~ b]. - Else, recursively call the trap with 'b' replaced by the increment of 'b'. - Examples: - - ++ tod - Description: - Selects right-hand phonetic syllable from 'dex'. - --- - Activate jet. - Creates a dry %gold gate which accepts and atom. - Assert that 'a' is less than 256. - Produce the three tail-end byte blocks in the rght-shift of dex. - Examples: - ~palryp-hocsyt/try=> (tod:po 98) - 6.514.020 - --- - ~palryp-hocsyt/try=> (tod:po 150) - 6.781.298 - --- - ~palryp-hocsyt/try=> (tod:po 255) - 7.562.598 - --- - ~palryp-hocsyt/try=> (tod:po 256) - ! exit - ++ tos - Selects left-hand phonetic syllable from 'sin'. - --- - Activate jet. - Creates a dry %gold gate which accepts and atom. - Assert that 'a' is less than 256. - Produce the three tail-end byte blocks in the rght-shift of dex. - Examples: -section 2cF, signed and modular ints - -++ si - signed integer - ++ abs - absolute value - Description: - Produces the absolute value of a signed integer. - --- - Creates a dry %gold gate with a sample which accepts a single atom. - Sums the last bit of the atom with the single bit-wise block right-shift of the atom, - producing the absolute value. - Examples: - ~palryp-hocsyt/try=> (abs:si -2) - 2 - --- - ~palryp-hocsyt/try=> (abs:si -10.000) - 10.000 - --- - ~palryp-hocsyt/try=> (abs:si --2) - 2 - ++ dif - subtraction - Description: - Produces the difference between two signed integers. - --- - Creates a dry %gold gate with a sample which accepts two signed integers. - Sums the first signed integer with a new signed integer, made from the second by - (new !(syn b) (abs b)), where !(syn b) is the negative of the second integer's sign. - This sum, produced, is the difference. - Examples: - ~palryp-hocsyt/try=> (dif:si --10 -7) - --17 - --- - ~palryp-hocsyt/try=> (dif:si --10 --7) - --3 - --- - ~palryp-hocsyt/try=> (dif:si `@s`0 --7) - -7 - --- - ~palryp-hocsyt/try=> (dif:si `@s`0 `@s`7) - --4 - ++ dul - modulus - Description: - Produces the modulus of two signed integers. - --- - Creates a dry %gold gate which accepts a signed integer and an atom. - Let 'c' be the [sign value] representation of 'a'. - Builds an if-then-else statement on -.c, the sign of 'a'. - If so ('a' is positive.), produce the modulus of the absolute value of 'c' and 'b'. - Else, produce the differenece between 'b' and the absolute value of 'c'. - Examples: - ~palryp-hocsyt/try=> (dul:si --9 3) - 0 - --- - ~palryp-hocsyt/try=> (dul:si --9 4) - 1 - --- - ~palryp-hocsyt/try=> (dul:si --9 5) - 4 - --- - ~palryp-hocsyt/try=> (dul:si --9 6) - 3 - --- - ~palryp-hocsyt/try=> (dul:si --90 --10) - 10 - ++ fra - divide - Description: - Produces the quotient of two signed integers. - --- - Creates a dry %gold gate with a sample which accepts two signed integers. - Divides the absolute value of 'a', the dividend, and 'b', the divisor, and - passes that value as the unsigned integer value of a new signed integer. - The sign of the new signed integer is the bitwise logical XOR of the two integer's - signs, meaning the quotient is only positive when both factors are positive. - This new signed integer is produced. - Examples: - ~palryp-hocsyt/try=> (fra:si --4 --2) - --2 - --- - ~palryp-hocsyt/try=> (fra:si -4 -2) - --2 - --- - ~palryp-hocsyt/try=> (fra:si -4 --2) - -2 - --- - ~palryp-hocsyt/try=> (fra:si --4 -2) - -2 - --- - ~palryp-hocsyt/try=> (fra:si `@s`4 `@s`2) - --2 - --- - ~palryp-hocsyt/try=> (fra:si `@s`4 2) - ! type-fail - ! exit - ++ new - [sign value] to @s - Description: - Produces a signed integer from a sign value (either & or |) and an atom. - --- - Creates a dry %gold gate with a sample which acccepts a loobean and an atom - Builds an if-then-else statement on the sign value 'a'. - If so, just produce 'b' multiplied by 2. - Else, build an if-then-else statement on b=0. If so, produce 0. - Else, produce the increment of (2*(dec b)). - The result is then cast to an integer and produced from new:si. - Examples: - ~palryp-hocsyt/try=> (new:si [& 10]) - --10 - ~palryp-hocsyt/try=> (new:si [| 10]) - -10 - ~palryp-hocsyt/try=> (new:si [%.y 7]) - --7 - ++ old - [sign value] - Description: - Produces the cell [sign value] representations of a signed integer. - --- - Create a dry %gold date with a with a sample which accepts a signed integer. - Produce a cell with head (syn a), the sign of 'a', and tail (abs), the absolute value of 'a'. - Examples: - ~palryp-hocsyt/try=> (old:si 7) - ! type-fail - ! exit - --- - ~palryp-hocsyt/try=> (old:si -7) - [%.n 7] - --- - ~palryp-hocsyt/try=> (old:si --7) - [%.y 7] - --- - ~palryp-hocsyt/try=> (old:si `@s`7) - [%.n 4] - --- - ~palryp-hocsyt/try=> (old:si -0) - [%.y 0] - ++ pro - Produces the product of two signed integers. - --- - Creates a dry %gold gate with a sample which accepts two signed integers. - Produces their product by evaluating a new signed integer whose sign is the bitwise - XOR of the two number's signs and whose value is the product of their two absolute values. - --- - palryp-hocsyt/try=> (pro:si -4 --2) - -8 - ~palryp-hocsyt/try=> (pro:si -4 -2) - --8 - ~palryp-hocsyt/try=> (pro:si --10.000.000 -10) - -100.000.000 - ~palryp-hocsyt/try=> (pro:si -1.337 --0) - --0 - ++ rem - Produces the remainder from a division of two signed integers. - --- - Creates a dry %gold gate with a sample which accepts two signed integers. - Produces the difference between 'a' and the (b*(a/b)). - --- - ~palryp-hocsyt/try=> (rem:si -10 -4) - -2 - ~palryp-hocsyt/try=> (rem:si --10 --4) - --2 - ~palryp-hocsyt/try=> (rem:si --10 -4) - --2 - ~palryp-hocsyt/try=> (rem:si --7 --3) - --1 - ~palryp-hocsyt/try=> (rem:si --0 --10.000) - --0 - ++ sum - Sum two signed integers. - --- - Creates a dry %gold gate which accepts two signed integers. - Prints '%si-sum' in the stack trace if the following code crashes. - Let 'c' and 'd' be the [sign value] representation of 'a' and 'b', respectively. - Builds an if-then-else statement on "c is positive". - If so, build an if-then-else statement on "d is positive". - If so, produce a new, positive signed integer with value ((abs a)+(abs b)) - Else, build an if-then-else statement on (abs a)>=(abs b) - If so, produce a new, positive integer with value ((abs a)-(abs d)). - Else (if !((abs a)>=(abs b))), produce a new, negative signed integer - with value ((abs d)-(abs c)). - Else (if c is not positive), build an if-then-else statement on "d is positive". - If so, build an if-then-else statement on (abs a)>=(abs b). - If so, produce a new, negative signed intger with value ((abs a)-(abs b)) - Else, produce a new, positive signed integer with value ((abs c)-(abs d)) - Else (if d is not positive), produce a new, negative signed with value ((abs c)+(abs d)). - --- - ~palryp-hocsyt/try=> (sum:si --10 --10) - --20 - --- - ~palryp-hocsyt/try=> (sum:si --10 -0) - --10 - --- - ~palryp-hocsyt/try=> (sum:si -10 -7) - -17 - --- - ~palryp-hocsyt/try=> (sum:si -10 --7) - -3 - ++ sun - Produces a signed integer from an unsigned integer. - Note that the result must be manually cast to some @s odor to be inferred as an - unsigned integer in the type system. - --- - Build dry %gold gate with sample unsigned integer `a` - Produce the integer multiplied by 2. - --- - ~palryp-hocsyt/try=> `@s`10 - --5 - ~palryp-hocsyt/try=> (sun:si 10) - 20 - ~palryp-hocsyt/try=> `@s`(sun:si 10) - --10 - ~palryp-hocsyt/try=> `@sd`(sun:si 10) - --10 - ~palryp-hocsyt/try=> `@sd`(sun:si 12.345) - --12.345 - ++ syn - Is a signed integer positive? - Produce the sign of a signed integer - & being posiitve, | negative. - --- - Build dry %gold gate with sample signed integer `a` - Is the last bit of 'a' 0? - --- - ~palryp-hocsyt/try=> (syn:si -7) - %.n - ~palryp-hocsyt/try=> (syn:si --7) - %.y - ~palryp-hocsyt/try=> (syn:si (new:si [& 7])) - %.y - ~palryp-hocsyt/try=> (syn:si -0) - %.y - ~palryp-hocsyt/try=> (syn:si --0) - %.y -++ fe - Binary block modulo math engine. Defaults to bloq size 1. - --- - Build dry %gold tray with sample bloq `a` - ++ dif - Produces the difference between two atoms in the modular basis representation. - --- - Build dry %gold gate wtih sample atom `b`, atom `c` - Produce sit slammed with: - The difference between: - The sum of: - `out` and slam of `b` to sit - Slam of `c` to sit - --- - ~tadbyl-hilbel/try=> (~(dif fe 3) 63 64) - 255 - ~tadbyl-hilbel/try=> (~(dif fe 3) 5 10) - 251 - ~tadbyl-hilbel/try=> (~(dif fe 3) 0 1) - 255 - ~tadbyl-hilbel/try=> (~(dif fe 0) 9 10) - 1 - ~tadbyl-hilbel/try=> (~(dif fe 0) 9 11) - 0 - ~tadbyl-hilbel/try=> (~(dif fe 0) 9 12) - 1 - ~tadbyl-hilbel/try=> (~(dif fe 2) 9 12) - 13 - ~tadbyl-hilbel/try=> (~(dif fe 2) 63 64) - 15 - ++ inv - Inverts the order of the modular field. - --- - Build dry %gold gate with sample atom `b` - Produce the difference between: - The decrement of `out` - Slam of `b` to sit. - --- - palryp-hocsyt/try=> (~(inv fe 3) 255) - 0 - ~palryp-hocsyt/try=> (~(inv fe 3) 256) - 255 - ~palryp-hocsyt/try=> (~(inv fe 3) 0) - 255 - ~palryp-hocsyt/try=> (~(inv fe 3) 1) - 254 - ~palryp-hocsyt/try=> (~(inv fe 3) 2) - 253 - ~palryp-hocsyt/try=> (~(inv fe 3) 3) - 252 - ++ net - - --- - Build dry %gold gate with sample atom `b`. Yield atom. - Push toss of `b` for the slam of `b` to sit on the context. - Unless: `a` is less than or equal to 3, - Then: Produce `b`, - Else: Push `c` is the decrement of `a` - Produce the slam of con with: - The single c-block left-shift of: - The toss of `a` for `c`, `b` for the c-block [0 1] cut of `b` - The toss of `a` for `c`, `b` for the c-block [1 1] cut of `b` - --- - ~tadbyl-hilbel/try=> (~(net fe 3) 64) - 64 - ~tadbyl-hilbel/try=> (~(net fe 3) 128) - 128 - ~tadbyl-hilbel/try=> (~(net fe 3) 255) - 255 - ~tadbyl-hilbel/try=> (~(net fe 3) 256) - 0 - ~tadbyl-hilbel/try=> (~(net fe 3) 257) - 1 - ~tadbyl-hilbel/try=> (~(net fe 3) 500) - 244 - ~tadbyl-hilbel/try=> (~(net fe 3) 511) - 255 - ~tadbyl-hilbel/try=> (~(net fe 3) 512) - 0 - ~tadbyl-hilbel/try=> (~(net fe 3) 513) - 1 - ~tadbyl-hilbel/try=> (~(net fe 3) 0) - 0 - ~tadbyl-hilbel/try=> (~(net fe 3) 1) - 1 - ~tadbyl-hilbel/try=> (~(net fe 0) 1) - 1 - ~tadbyl-hilbel/try=> (~(net fe 0) 2) - 0 - ~tadbyl-hilbel/try=> (~(net fe 0) 3) - 1 - ~tadbyl-hilbel/try=> (~(net fe 6) 1) - 72.057.594.037.927.936 - ~tadbyl-hilbel/try=> (~(net fe 6) 2) - 144.115.188.075.855.872 - ~tadbyl-hilbel/try=> (~(net fe 6) 3) - 216.172.782.113.783.808 - ~tadbyl-hilbel/try=> (~(net fe 6) 4) - 288.230.376.151.711.744 - ~tadbyl-hilbel/try=> (~(net fe 6) 5) - 360.287.970.189.639.680 - ~tadbyl-hilbel/try=> (~(net fe 6) 6) - 432.345.564.227.567.616 - ~tadbyl-hilbel/try=> (~(net fe 6) 7) - 504.403.158.265.495.552 - ~tadbyl-hilbel/try=> (~(net fe 6) 512) - 562.949.953.421.312 - ~tadbyl-hilbel/try=> (~(net fe 6) 513) - 72.620.543.991.349.248 - ++ out - Description: - The maximum integer value that the current block can store. - --- - Produce the binary exponent of: - The binary expoenent of the block size, `a` - --- - ~tadbyl-hilbel/try=> ~(out fe 0) - 2 - ~tadbyl-hilbel/try=> ~(out fe 1) - 4 - ~tadbyl-hilbel/try=> ~(out fe 2) - 16 - ~tadbyl-hilbel/try=> ~(out fe 3) - 256 - ~tadbyl-hilbel/try=> ~(out fe 4) - 65.536 - ~tadbyl-hilbel/try=> ~(out fe 10) - 179.769.313.486.231.590.772.930.519.078.902.473.361.797.697.894.230.657.273.430.081. - 157.732.675.805.500.963.132.708.477.322.407.536.021.120.113.879.871.393.357.658.789. - 768.814.416.622.492.847.430.639.474.124.377.767.893.424.865.485.276.302.219.601.246. - 094.119.453.082.952.085.005.768.838.150.682.342.462.881.473.913.110.540.827.237.163. - 350.510.684.586.298.239.947.245.938.479.716.304.835.356.329.624.224.137.216 - ++ rol - - --- - Build dry %gold gate with sample bloq `b`, atom `c`, atom `d`. Yield atom. - Push `e` is sit slammed with `d`, the modular representation of `d` - Push `f` is the binary expoenent of: - The difference between 'a' and 'b' - Push `g` is `c` modulus `f` - Produce sit slammed with: - con slammed with: - The `g` b-blocks right-shift of `e` - The difference between `f` and `g` b-blocks left-shift of `e` - --- - - - ++ ror - - --- - Build dry %gold gate with sample bloq `b`, atom `c`, atom `d`. Yield atom. - Push `e` is sit slammed with `d`, the modular representation of `d` - Push `f` is the binary expoenent of: - The difference between 'a' and 'b' - Push `g` is `c` modulus `f` - Produce sit slammed with: - con slammed with: - The `g` b-blocks left-shift of `e` - The difference between `f` and `g` b-blocks right-shift of `e` - --- - - ++ sum - Sum two numbers in this modular field. - --- - Build dry %gold gate with sample atom `b`, atom `c` - Produce sit slammed with the sum of `b` and `c` - --- - ~tadbyl-hilbel/try=> (~(sum fe 3) 10 250) - 4 - ~tadbyl-hilbel/try=> (~(sum fe 0) 0 1) - 1 - ~tadbyl-hilbel/try=> (~(sum fe 0) 0 2) - 0 - ~tadbyl-hilbel/try=> (~(sum fe 2) 14 2) - 0 - ~tadbyl-hilbel/try=> (~(sum fe 2) 14 3) - 1 - ~tadbyl-hilbel/try=> (~(sum fe 4) 10.000 256) - 10.256 - ~tadbyl-hilbel/try=> (~(sum fe 4) 10.000 100.000) - 44.464 - ++ sit - Produce an atom in the current modular block representation. - --- - Build dry %gold gate with sample atom `b` - Produce the last block of size `a` in `b` - --- - ~tadbyl-hilbel/try=> (~(sit fe 3) 255) - 255 - ~tadbyl-hilbel/try=> (~(sit fe 3) 256) - 0 - ~tadbyl-hilbel/try=> (~(sit fe 3) 257) - 1 - ~tadbyl-hilbel/try=> (~(sit fe 2) 257) - 1 - ~tadbyl-hilbel/try=> (~(sit fe 2) 10.000) - 0 - ~tadbyl-hilbel/try=> (~(sit fe 2) 100) - 4 - ~tadbyl-hilbel/try=> (~(sit fe 2) 16) - 0 - ~tadbyl-hilbel/try=> (~(sit fe 2) 17) - 1 - ~tadbyl-hilbel/try=> (~(sit fe 0) 17) - 1 - ~tadbyl-hilbel/try=> (~(sit fe 0) 0) - 0 - ~tadbyl-hilbel/try=> (~(sit fe 0) 1) - 1 - -section 2cG, floating point - -++ rlyd -++ rlyh -++ rlyq -++ rlys -++ ryld -++ rylh -++ rylq -++ ryls - -section 2cH, urbit time - -++ year - Accept a parsed date of form [[a=? y=@ud] m=@ud t=tarp] and produce - its @d representation. - --- - Build dry %gold gate with sample parsed date `det` - Yield @d. - Push `yer` is: - If: `a.det` is true. I.e. - Then: The sum of 292,277,024,400 and `y.det`, the year. - Else: The difference of 292,277,024,400 and the decrement of `y.det`, the year. - Push `day` is yawn slammed with: - `yer`, `m.det`, `d.t.det` - Produce yule slammed with: - `day`, `h.t.det`, `m.t.det`, `s.t.det`, `f.t.det` - --- - -++ yore - Produce the parsed date [[a=? y=@ud] m=@ud t=tarp] representation of a @d date. - --- - Build dry %gold gate with sample @d `now`. - Yield date. - Push `rip` is yell slammed with `now`, the - Push `ger` is yall slammed with `d.rip`, the - Pair: - If: y.ger is greater than , - Then: , - Else: with, - - --- - -++ yell - Produce a parsed daily time format from an atomic date. - --- - Creates a dry %gold gate which accepts an atomic date, @d. - Casts the result to a tarp. - Let 'sec' be the single 64-bit block right-shift of 'now'. - - Creates and kicks a dry %gold trap. Casts the result to a list of unsigned hexadecimal atoms. - If (0=raw) OR (0=muc), produce null. - Replace 'muc' with the decrement of 'muc' (3). - Produce the cell [(cut 4 [muc 1] raw) $(raw (end 4 muc raw))], where - (cut 4 [muc 1] raw) is the cut of 'raw' of 1-block of size 4 starting at 'muc'. - $(raw (end 4 muc raw)) is the recursive call to the trap with 'raw' replaced by - the last 'muc' blockcs of size - 4 in 'raw'. - Examples: - ~dovryp-toblug/try=> (yell ~2014.3.20..05.42.53..7456) - [d=106.751.991.820.094 h=5 m=42 s=53 f=~[0x7456]] - --- - ~tadbyl-hilbel/try=> (yell ~2014.6.9..19.09.40..8b66) - [d=106.751.991.820.175 h=19 m=9 s=40 f=~[0x8b66]] - --- - ~tadbyl-hilbel/try=> (yell ~1776.7.4) - [d=106.751.991.733.273 h=0 m=0 s=0 f=~] -++ yule - time atom - Description: - Accepts a tarp, a parsed daily time, and produces a time atom, @d. - --- - Creates a dry %gold gate which accepts a tarp. - Casts the result to an atomic date. - Let - - The product of d.rip, , and day:yo, . - Let - - - Examples: - ~tadbyl-hilbel/try=> =murica (yell ~1776.7.4) - ~tadbyl-hilbel/try=> murica - [d=106.751.991.733.273 h=0 m=0 s=0 f=~] - ~tadbyl-hilbel/try=> (yule murica) - 0x8000000b62aaf5800000000000000000 - --- - ~dovryp-toblug/try=> (yule (yell ~2014.3.20..05.42.53..7456)) - 0x8000000d21c88d5d7456000000000000 - --- - ~tadbyl-hilbel/try=> (yule (yell ~2014.6.9..19.09.40..8b66)) - 0x8000000d223413f48b66000000000000 -++ yall - day # to day of year - Description: - Produces what day of the year in year, month, day format a day of - --- - Examples: -++ yawn - days since Jesus - Description: - Accepts a year, month, and day (Three unsigned decimal integers) and produces the date's - CE representation. - --- - Creates a dry %gold gate which accepts three unsigned decimal integers. - Casts the result to an unsigned decimal integer. - Replaces the month and day values on the subject with their decrements. - Replaces the subject of the following with the type of the context. - Evaluates the context with the changes specified below: - - Lets - - Examples: -++ yelp - leap year - Description: - Produces a loobean indicating whether the given Common Era year is a leap year. - --- - Creates a dry %gold gate which accepts an unsigned decimal integer. Casts the result to a loobean. - Produces the logical AND of (0=(mod yer 4)) and the logical OR of (0=(mod yer 100)) and - (0=(mod yer 400)). - Examples: - ~tadbyl-hilbel/try=> (yelp 2.014) - %.n - --- - ~tadbyl-hilbel/try=> (yelp 2.008) - %.y - --- - ~tadbyl-hilbel/try=> (yelp 0) - %.y - --- - ~tadbyl-hilbel/try=> (yelp 14.011) - %.n -++ yo - time constants - Description: - Constants of time referenced in the urbit time section. - --- - Produces a %gold core with |%. - ++ cet - (add 24 (mul 100 365)) - Description: - The number of days in a century. - --- - Derived by multiplying the number of days in a year (365) by the number of yaers in a century (100), - then adding the number days from leap years in a century (24). - Examples: - ~tadbyl-hilbel/try=> cet:yo - 36.524 - --- - ~tadbyl-hilbel/try=> (add 365 cet:yo) - 36.889 - --- - ~tadbyl-hilbel/try=> (sub (add 24 (mul 100 365)) cet:yo) - 0 - ++ day - (mul 24 hor) - Description: - The number of seconds in a day. - --- - Derived by multiplying the the number of seconds in an hour by the hours in a day. - Examples: - ~tadbyl-hilbel/try=> day:yo - 86.400 - --- - ~tadbyl-hilbel/try=> (add 60 day:yo) - 86.460 - ++ era - (add 1 (mul 4 cet)) - Description: - - --- - - Examples: - - ++ hor - (mul 60 mit) - Description: - The number of seconds in an hour. - --- - Derived by multiplying the number of seconds in a minute by the minutes in an hour. - Examples: - ~tadbyl-hilbel/try=> hor:yo - 3.600 - ++ jes - (mul 730.692.561 era) - Description: - - --- - - Examples: - - ++ mit - seconds per minute - Description: - The number of seconds in a minute. - --- - We just knew this one. - Examples: - ~tadbyl-hilbel/try=> mit:yo - 60 - ++ moh - Description: - The days in each month of the Gregorian common year. - --- - A list of unsigned decimal atoms (Either 28, 30, or 31) denoting the number of days in the month at the - year at that index. - Examples: - ~tadbyl-hilbel/try=> moh:yo - ~[31 28 31 30 31 30 31 31 30 31 30 31] - ++ moy - Description: - The days in each month of the Gregorian leap-year. - --- - A list of unsigned decimal atoms (Either 29,30, or 31) denoting the number of days in the month at the - leap-year at that index. - Examples: - ~tadbyl-hilbel/try=> moy:yo - ~[31 29 31 30 31 30 31 31 30 31 30 31] - ++ qad - (add 1 (mul 4 yer)) - Description: - The number of seconds in four years - --- - Derived by adding one second to the number of seconds in four years. - Examples: - ~tadbyl-hilbel/try=> qad:yo - 126.144.001 - ++ yer - (mul 365 day) - Description: - The number of seconds in a year. - --- - Derived by multiplying the number of seconds in a day by 365. - Examples: - ~tadbyl-hilbel/try=> yer:yo - 31.536.000 - -section 2cI, almost macros - -++ hard - demand result type - Description: - Ruthlessly demands that a specific type be produced, crashing the program is it is not. - --- - Creates a vulanized wet gate which accepts any gate which accepts any noun and produces - any noun. - Creates a dry %gold gate which accepts any noun and casts the result to the - higher gate argument's icon. - Prints "%hard" in the stack trace if the code below crashes. - Let gol be the higher gate argument slammed with the lower arbitrary noun. - Assert that the result's icon is equal to that of the lower arbitrary noun - before producing said result. - Examples: - ~palryp-hocsyt/try=> ((hard (list)) (limo [1 2 3 ~])) - ~[1 2 3] - ~tadbyl-hilbel/try=> ((hard ,@) (add 2 2)) - 4 - ~tadbyl-hilbel/try=> ((hard ,@t) (crip "Tape to cord, bro!")) - 'Tape to cord, bro' - ~tadbyl-hilbel/try=> ((hard tape) (crip "...Tape to cord, bro?...")) - ! hard - ! exit -++ soft - politely demand - Description: - Politely requests a specific type to be produced, producing null if it is not. - --- - Creates a vulanized wet gate which accepts any gate which accepts any noun and produces - any noun. - Creates a dry %gold gate which accepts any noun and casts the result to the - a unit of the higher gate argument's icon. - Let gol be the higher gate argument slammed with the lower arbitrary noun. - Build an unless-then-else statement on the result icon's being equal to that of - the lower arbitrary noun. - If so, produce null. - Else, produce the unit of the result. - Examples: - ~tadbyl-hilbel/try=> ((soft ,%4) (add 2 2)) - [~ %4] - ~tadbyl-hilbel/try=> ((soft ,@) (add 2 2)) - [~ 4] - ~tadbyl-hilbel/try=> ((soft ,%5) (add 2 2)) - ~ - ~tadbyl-hilbel/try=> ((soft ,@t) (crip "Tape to cord, Woohoo!")) - [~ 'Tape to cord, Woohoo!'] - ~tadbyl-hilbel/try=> ((soft ,@t) (trip 'Cmon man... Tape to cord? Please?!')) - ~ - -chapter 2d, containers - -section 2dA, sets - -++ apt - set invariant - Description: - Accepts any tree and produces a loobean indicating whether the tree is a set. - --- - Creates a dry %gold gate which accepts a tree. - Builds an if-then-else statement on "a is an atom." - If so, produce true. - Else, compute and produce the logical AND of: - The if "l.a is an atom" then produce true, else (produce the logical AND of the - v-order of n.a and n.l.a and the h-order of n.l.a and n.a) if-then-else statement. - The if "r.a is an atom" then produce true, else (produce the logical AND of the - v-order of n.a and n.r.a and the h-order of n.a and n.r.a) if-then-else statement. - (==) terminates the tall logical AND statement. - Examples - ~tadbyl-hilbel/try=> =b (sa `(list ,@t)`['john' 'bonita' 'daniel' 'madeleine' ~]) - ~tadbyl-hilbel/try=> (apt b) - %.y - --- - ~tadbyl-hilbel/try=> =m (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ['c' 4] ['d' 5] ~]) - ~tadbyl-hilbel/try=> m - {[p='d' q=5] [p='a' q=1] [p='c' q=4] [p='b' q=[2 3]]} - ~tadbyl-hilbel/try=> (apt m) - %.y -++ in - set engine - Description: - Container arm for set operation arms. The contained arms inherit it's sample set, 'a'. - --- - Activate jet. - Creates a %gold trap with sample 'a', a set. - +- all - logical AND - Description: - Accepts a gate which accepts any noun and produces a loobean. Slams the gate with each member - of set 'a', produce the logical AND of the transformed set. - --- - Activate jet. - Creates a wet %gold gate which accepts any gate which produces a loobean. - Creates and kicks a dry %gold gate, casts the result to a loobean. - Builds an if-then-else statement on "a is an atom." - If so, produce true. - Else, produce the logical AND of (b n.a) and the recursive calls of the trap with - 'a' replaced by 'l.a' and 'a' replaced by 'r.a'. - Examples: - ~dovryp-toblug/try=> =b (sa `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~]) - ~dovryp-toblug/try=> (~(all in b) |=(a=* ?@(-.a & |))) - %.n - ~tadbyl-hilbel/try=> =b (sa `(list ,@t)`['john' 'bonita' 'daniel' 'madeleine' ~]) - ~tadbyl-hilbel/try=> (~(all in b) |=(a=@t (gte a 100))) - %.y - +- any - logical OR - Description: - Accepts a gate which accepts any noun and produces a loobean. Slams the gate with each member - of set 'a', produce the logical OR of the transformed set. - --- - Activate jet. - Creates a wet %gold gate which accepts any gate which produces a loobean. - Creates and kicks a dry %gold gate, casts the result to a loobean. - Builds an if-then-else statement on "a is an atom." - If so, produce false. - Else, produce the logical OR of (b n.a) and the recursive calls of the trap with - 'a' replaced by 'l.a' and 'a' replaced by 'r.a'. - Examples: - ~dovryp-toblug/try=> =b (sa `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~]) - ~dovryp-toblug/try=> (~(any in b) |=(a=* ?@(+.a & |))) - %.y - ~tadbyl-hilbel/try=> =b (sa `(list ,@t)`['john' 'bonita' 'daniel' 'madeleine' ~]) - ~tadbyl-hilbel/try=> (~(any in b) |=(a=@t (lte a 100))) - %.n - +- del - b without any a - Description: - Accepts any noun 'b' and removes it from the set 'a'. - --- - Activate jet. - Creates a wet %gold gate which accepts any noun. - Creates and kicks a dry %gold gate, casts the result to the type of 'a'. - Builds an if-then-else statement on "a is null." - If so, produce null. - Else, builds an unless-then-else on (b=n.a) - If so, build an if-then-else statement by testing the h-order of 'b' and 'n.a'. - If so, produce a the cell [n.a $(a l.a) r.a], where $(a l.a) is the recursive call of - the trap with 'a' replaced by the left - Examples: - ~dovryp-toblug/try=> =b (sa `(list ,@t)`[`a` `b` `c` ~]) - ~dovryp-toblug/try=> (~(del in b) `a`) - {`c` `b`} - --- - ~tadbyl-hilbel/try=> =b (sa `(list ,@t)`['john' 'bonita' 'daniel' 'madeleine' ~]) - ~tadbyl-hilbel/try=> (~(del in b) 'john') - {'bonita' 'madeleine' 'daniel'} - --- - ~tadbyl-hilbel/try=> (~(del in b) 'susan') - {'bonita' 'madeleine' 'daniel' 'john'} - - +- dig - axis of b in a - Description: - Produces - --- - Creates a dry %gold gate which accepts a single noun. - Let 'c' be 1. - Creates and kicks a dry %gold trap. Casts the result to an atomic unit. - Builds an if-then-else statement on "a is null." If so, produce null. - Else, build an if-then-else statement on (b=n.a). If so, produce the unit [~ u=(peg c 2)]. - Else, build an if-then-else statement on the g-order of 'b' and 'n.a' - If so, produce the recursive call of the trap with 'a' replaced by 'l.a' and 'c' replaced by (peg c 6). - Else, produce the recursive call of the trap with 'a' replaced by 'r.a' and 'c' replaced by (peg c 7). - Examples: - ~talsur-todres/try=> =a (sa `(list ,@)`[1 2 3 4 5 6 7 ~]) - ~talsur-todres/try=> a - {5 4 7 6 1 3 2} - ~talsur-todres/try=> -.a - n=6 - ~talsur-todres/try=> (~(dig in a) 7) - [~ 12] - ~talsur-todres/try=> (~(dig in a) 2) - [~ 14] - ~talsur-todres/try=> (~(dig in a) 6) - [~ 2] - +- gas - concatenate - Description: - Accepts a list 'b' with members of the same type as the set 'a' and produces - the union set of 'a' and 'b'. - --- - Activate jet. - Creates a dry %gold gate which accepts a list of elements of the same type as 'a'. - Creates and kicks a dry %gold trap whose result is cast to the type of 'a'. - Builds an if-then-else statement on "b is an atom." - If so, produce 'a'. - Else, recursively call the trap with 'b' replaced by the tail of 'b' and the head of 'b' - put into 'a'. - Examples: - ~tadbyl-hilbel/try=> b - {'bonita' 'madeleine' 'rudolf' 'john'} - ~tadbyl-hilbel/try=> (~(gas in b) `(list ,@t)`['14' 'things' 'number' '1.337' ~]) - {'1.337' '14' 'number' 'things' 'bonita' 'madeleine' 'rudolf' 'john'} - --- - ~tadbyl-hilbel/try=> (~(gas in s) `(list ,@t)`['1' '2' '3' ~]) - {'1' '3' '2' 'e' 'd' 'a' 'c' 'b'} - +- has - b exists in a check - Description: - Accepts any noun and produces the loobean indicating whether or not that value (n.a) exists in 'a'. - --- - Activate jet. - Creates a wet %gold gate which accepts any noun. - Creates and kicks a dry %gold trap. Casts the result to a loobean. - Builds an if-then-else statement on "The set (a) is an atom." If so, produce false. - Else, build an if-then-else statement on (b=n.a). - If so, produce true. - Else, build an if-then-else statement on the h-order of 'b' and 'n.a' - If so, produce the recursive call to the trap with 'a' replaced by 'l.a' - If so, produce the recursive call to the trap with 'a' replaced by 'r.a' - Examples: - ~dovryp-toblug/try=> =a (~(gas in `(set ,@t)`~) `(list ,@t)`[`a` `b` `c` ~]) - ~dovryp-toblug/try=> (~(has in a) `a`) - %.y - ~dovryp-toblug/try=> (~(has in a) 'z') - %.n - +- put - Accept any noun 'b' and produce the set 'a' with 'b' added to its sorted location. - --- - Activate jet. - Creates a wet %gold gate which accepts any atom. - Creates and kicks a dry %gold gate. Casts the result to the type of set 'a'. - Builds an if-then-else statement on "a is an atom." - If so, produce the null-terminated tuple [b ~ ~]. - Else, build an if-then-else statement on (b=n.a). - If so, produce the set 'a'. - Else, build an if-then-else statement on the h-order of 'b' and 'n.a'. - If so, let 'c' be the recursive call of the trap with 'a' replaced by 'l.a'. - Then, assert that 'c' is a cell. - Build an if-then-else statement on the v-order of 'n.a' and 'n.c'. - If so (their v-order is true), produce the tuple [n.a c r.a] - Else, produce [n.c l.c [n.a r.c r.a]]. - Else (if 'b' and 'n.a' are not well h-ordered.), let 'c' be the recursive call of the trap with - 'c' replaced 'r.a'. - Then, assert that 'c' is a cell. - Builds an if-then-else statement on the v-order of 'n.a' and 'n.c' - If so, produce [n.a l.a c] - Else, produce [n.c [n.a l.a l.c] r.c]. - Examples: - ~talsur-todres/try=> =a (~(gas in `(set ,@t)`~) `(list ,@t)`[`a` `b` `c` ~]) - ~talsur-todres/try=> =b (~(put in a) `d`) - ~talsur-todres/try=> b - {`d` `a` `c` `b`} - ~talsur-todres/try=> -.l.+.b - n=`d` - +- rep - Accept a noun and a binary gate. Produce the 'a' with each member 'n.a' replaced by (c n.a b). - --- - XXX - Creates a wet %gold gate which accpets a noun and a tile, 'a' and 'b'. - Creates and kicks a dry %gold gate. - Builds an if-then-else statement on "a is null." If so, produce 'b'. - Else, recursively call the trap with 'a' replaced by 'r.a' and - 'b' replaced by the recursive call of the trap with 'a' replaced by 'l.a' and 'b' replaced by - (c n.a b). - --- - ~talsur-todres/try=> =a (~(gas in *(set ,@)) [1 2 3 ~]) - ~talsur-todres/try=> a - {1 3 2} - ~talsur-todres/try=> (~(rep in a) 0 |=([a=@ b=@] (add a b))) - 6 - --- - XXX - - +- tap - Accept a list of elements of the set and produce a cell of the set with the list concatenated. - --- - Activate jet. - Build dry %gold gate with sample list of the same - Cast the following to the type of `b` - If: `a` is null, - Then: Produce `b`, - Else: Produce the toss of `a` for `r.a`, `b` for [n.a $(a l.a)]), - where $(a l.a) is the toss of `a` for the left twig of `a`. - --- - ~tadbyl-hilbel/try=> =s (sa `(list ,@t)`['a' 'b' 'c' 'd' 'e' ~]) - ~tadbyl-hilbel/try=> s - {'e' 'd' 'a' 'c' 'b'} - --- - ~tadbyl-hilbel/try=> (~(tap in s) `(list ,@t)`['1' '2' '3' ~]) - ~['b' 'c' 'a' 'd' 'e' '1' '2' '3'] - --- - ~tadbyl-hilbel/try=> b - {'bonita' 'madeleine' 'daniel' 'john'} - ~tadbyl-hilbel/try=> (~(tap in b) `(list ,@t)`['david' 'people' ~]) - ~['john' 'daniel' 'madeleine' 'bonita' 'david' 'people'] - +- wyt - Produce the cardinality (number of elements) of the set. - --- - Increment the following. - Kick dry %gold trap. Yield atom. - If: `a` is null, - Then: Produce 0. - Else: Produce the increment of the sum of: - The toss of `a` for `l.a`, the left twig of `a`. - The toss of `a` for `r.a`, the right twig of `a`. - --- - ~talsur-todres/try=> =a (~(gas in `(set ,@t)`~) `(list ,@t)`[`a` `b` `c` ~]) - ~talsur-todres/try=> ~(wyt in a) - 4 - --- - ~tadbyl-hilbel/try=> b - {'bonita' 'madeleine' 'daniel' 'john'} - ~tadbyl-hilbel/try=> ~(wyt in b) - 5 - -section 2dB, maps - -++ ept - map invariant - Description: - Accepts a tree of cell paris and produces the loobean indicating whther the tree is a map - or not. - --- - Creates a dry %gold gate which accepts a tree of cell pairs. - If "a is an atom", produce true. - Else, produce the logical AND of: - If "l.a is an atom", produce true. Else, produce the logical AND of the v-order of 'p.n.a' precedes 'p.n.l.a' - and the h-order of 'p.n.l.a' precedes 'p.n.a'. - If "r.a is an atom" produce true. Else, produce the logical AND of the v-oreder of 'p.n.a' precedes 'p.n.r.a' - and the h-roder of 'p.n.a' precedes 'p.n.r.a'. - (==) terminates the AND statement. - Examples: - ~tadbyl-hilbel/try=> m - {[p='d' q=5] [p='a' q=1] [p='c' q=4] [p='b' q=[2 3]]} - ~tadbyl-hilbel/try=> (ept m) - %.y - --- - ~tadbyl-hilbel/try=> b - {'bonita' 'madeleine' 'daniel' 'john'} - ~tadbyl-hilbel/try=> (ept b) - ! type-fail - ! exit - --- -++ ja - The jar engine: A container arm for jar operation arms. Jars are maps of lists. - The contained arms inherit it's sample jar. 'a'. - --- - Build a wet %gold tray with a sample jar `a`... - +- get - Retrieve a list from the map by its key. - --- - Build wet %gold gate with sample noun `b` - Push `d` is the slug of by to get with `a` slammed with `b`. - If: `c` is null, - Then: Produce null, - Else: Produce `u.c`, the unit value of `c` - --- - - - +- add - Add a key-list value to the jar. - --- - Build wet %gold gate with sample noun `b`, noun `c` - Push `d` is the call of get with the subject replaced by `a`, slammed with `b` - Produce the slam of by to put with `a` slammed with `b` and [c d]. - --- - - --- - Terminate the core. - -++ ju - The jug engine: container arm for jug operation arms. Jugs are maps of sets. - The contained arms inherit it's sample jug, 'a'. - --- - Build a wet %gold tray with a sample jug `a`. - +- del - Delete a value in a set and produce the resulting jug. - --- - Build wet %gold gate with sample noun `b`, noun `c` - Cast the following to the type of `a` - Push `d` is the call of get with the subject replaced by `a`, slammed with `b` - Push `e` is slug del to in by `d` slammed with `c` - If: `e` is null, - Then: Slug tray by to del with `a` slammed with `b` - Else: Produce the slug tray by to put with `a` slammedw ith `b`, `e`. - --- - - +- get - Retrieve a set from the map by its key. - --- - Build wet %gold gate with sample noun `b` - Push `c` is the slug of by to get with `a` slammed with `b` - If: `c` is null, - Then: Produce null, - Else: Produce `u.c`, the unit value of `c` - --- - - +- has - Is the element `c` in the set `b`? - --- - Build wet %gold gate with sample noun `b`, noun `c` - Yield boolean. - Produce the slug of in to has with the call of get with the subject replaced by `a` slammed with: - `b`, a set., slammed with: - slammed with `c`. - I.e.: Check if `c` is in the set which is the value of the map key `b`. - --- - - +- put - Add a value to a specific set in the jug. - --- - Build wet %gold gate with sample noun b. noun c. - Yield bean. - Push `d` is the call of get with the subject replaced by `a`, slammed with `b` - Produce the slug of by to put with `a` slammed with: - `b`, slammed with: - The slug of in to put by `d` slammed with `c`. - --- - -++ by - Container arm for map operation arms. The contained arms inherit it's sample map, 'a'. - --- - Activate jet. - Builds a %gold tray with a sample which accepts a map. - +- all - Accepts a gate which accepts any noun and produces a loobean. Slams the gate with each member - of map 'a', produce the logical AND of the transformed map. - --- - Activate jet. - Builds a wet %gold gate which accepts the tile of a gate accepts any noun and produces a loobean. - Creates and kicks a dry %gold gate. Casts the result to loobean. - Builds an if-then-else statement on "a is an atom." - If so, produce true. - Else, produce the logical AND of (b q.n.a), the recursive call of the trap with 'a' replaced by - 'l.a', and the recursive call of the trap with 'a' replaced by 'r.a'. - Examples: - ~talsur-todres/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~]) - ~talsur-todres/try=> (~(all by b) |=(a=* ?@(a & |))) - %.n - --- - ~tadbyl-hilbel/try=> =a (mo `(list ,[@t @u])`[['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~]) - ~tadbyl-hilbel/try=> (~(all by a) |=(a=@ (lte a 6))) - %.y - ~tadbyl-hilbel/try=> (~(all by a) |=(a=@ (lte a 4))) - %.n - +- any - Accepts a gate which accepts any noun and produces a loobean. Slams the gate with each member - of map 'a', produce the logical OR of the transformed map. - --- - Activate jet. - Builds a wet %gold gate which accepts the tile of a gate accepts any noun and produces a loobean. - Creates and kicks a dry %gold gate. Casts the result to loobean. - Builds an if-then-else statement on "a is an atom." - If so, produce false. - Else, produce the logical OR of (b q.n.a), the recursive call of the trap with 'a' replaced by - 'l.a', and the recursive call of the trap with 'a' replaced by 'r.a'. - Examples: - ~talsur-todres/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~]) - ~talsur-todres/try=> (~(all by b) |=(a=* ?@(a & |))) - %.y - --- - ~tadbyl-hilbel/try=> =a (mo `(list ,[@t @u])`[['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~]) - ~tadbyl-hilbel/try=> (~(any by a) |=(a=@ (lte a 4))) - %.y - +- del - delete at key b - Description: - Accepts a noun 'b', producing the map with the key-value pair of key 'b' removed. - --- - Activate jet. - Creates a wet %gold gate which accepts a noun. - Creates and kicks a dry %gold trap. Casts the result to the type of map 'a'. - Builds an if-then-else statement on "a is null." - If so, produce null. - Else, build an unless-then-else statement on (b=(p.n.a)). - If so, build the if-then-else statement on the g-order of 'b' and 'p.n.a'. - If so, produce the the tuple [n.a $(a l.a) r.a] where $(a l.a) is the recursive call of the - trap with 'a' replaced by 'l.a'. - Else (g-order of 'b' and 'p.n.a' is not true.), produce [n.a l.a $(a r.a)]. - Else (!(b=(p.n.a))), create and kick a dry %gold trap. - Cast the result to a fork between null and the tile of the map 'a'. - Builds an if-then-else statement on "l.a is null." If so, produce 'r.a'. - Else, build an if-then-else statement on "r.a is null." If so, produce 'l.a'. - Else, build an if-then-else statement on the v-order of 'p.n.l.a' and 'p.n.r.a'. - If so, produce [n.l.a l.l.a $(l.a r.l.a)],where $(l.a r.l.a) is the recursive call of the - trap with 'l.a' replaced by 'r.l.a'. - Else, produce [n.r.a $(r.a l.r.a) r.r.a], ,where $(r.a l.r.a) is the recursive call of the - trap with 'r.a' replaced by 'l.r.a'. - Examples: - ~talsur-todres/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~]) - ~talsur-todres/try=> (~(del by b) `a`) - {[p=`b` q=[2 3]]} - - +- dig - axis of 'b' key - Description: - Accepts any noun 'b' and produces the axis of 'b' in within the values of 'p.a' in map 'a'. - --- - Creates a wet %gold gate which accepts a noun. - Let 'c' be 1. - Creates and kicks a dry %gold gate. Casts the result to an atomic unit. - Builds an if-then-else statement on "a is null." If so, produce null. - Else, build an if-then-else statement on (b=(p.n.a.)). If so, produce the unit [~ u=(peg c 2)]. - Else, build an if-then-else statement on the g-order of 'b' and 'p.n.a'. - If so, recursively call the trap with 'a' replaced by 'l.a' and 'c' by (peg c 6). - Else, recursively call the trap with 'a' replaced by 'r.a' and 'c' by (peg c 7). - Examples: - ~talsur-todres/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~]) - ~talsur-todres/try=> (~(dig by b) `b`) - [~ 2] - - +- gas - concatenate - Description: - Accepts any list 'b' of key-value pair cells and produces the map 'a' with the members of 'b' added. - --- - Activate jet. - Creates a wet %gold gate which accepts a list of cells. - Replaces 'b' in the subject with the cast of 'b' to a list whose members have the - same type as the members of 'a'. - Creates and kicks a dry %gold trap. Casts the result to the type of map 'a'. - Builds an if-then-else statement on "b is an atom." - If so, produce 'a'. - Else, recursively call the trap iwth 'b' replaced by the tail of 'b' and 'a' replaced by - 'a' with the key and value of the head of 'b' added to it. - Examples: - ~talsur-todres/try=> =a (mo `(list ,[@t *])`[[`a` 1] [`b` 2] ~]) - ~talsur-todres/try=> =b `(list ,[@t *])`[[`c` 3] [`d` 4] ~] - ~talsur-todres/try=> (~(gas by a) b) - {[p=`d` q=4] [p=`a` q=1] [p=`c` q=3] [p=`b` q=2]} - +- get - grab value by key - Description: - Produces the value in the map at key 'b'. - --- - Creates a wet %gold gate which accepts a noun. - Creates and kicks a dry %gold trap. Casts its result to the type of the map's values. - Builds an if-then-else statement on "a is an atom." - If so, produces null. - Else, build an if-then-else statement on (b=(p.n.a)). - If so, produce the unit [~ u=p.n.a]. - Else, build an if-then-else statement on the g-order of 'b' and 'p.n.a'. - If so, produce the recursive call to the trap with 'a' replaced by 'l.a'. - Else, produce the recursive call to the trap with 'a' replaced by 'r.a'. - Examples: - ~talsur-todres/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~]) - ~talsur-todres/try=> (~(get by b) `b`) - [~ [2 3]] - +- has - key existence check - Description: - Accepts any noun 'b' and produces the loobean indicating whether the noun exists in map 'a'. - --- - Activate jet. - Creates a wet %gold gate which accepts a noun. - Attempts to get 'b' from 'a', then produces the logical NOT of the loobean "get 'b' in 'a' is null" - Examples: - ~talsur-todres/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~]) - ~talsur-todres/try=> (~(has by b) `b`) - %.y - ~talsur-todres/try=> (~(has by b) `c`) - %.n - +- mar - add with validation - Description: - Accepts two nouns of the types of the map's keys and values, respectively. - Validates that the value is not null and puts the pair in the map. If the value is null, - it deletes the key. - --- - Creates a wet %gold gate which accepts a cell of two nouns: one of the type of the map's keys - and one a unit of the map's value type. - If "c is null", produce the map with 'b' deleted. - Else, produce the map with the 'b' and 'u.c' key-value pair added. - Examples: - - +- put - - --- - Activate jet. - Build a wet %gold gate with sample noun `b`, noun `c` - - Creates and kicks a dry %gold trap. Casts the result to the type of the map 'a'. - If "a is an atom", produce the cell [[b c] ~ ~]. - Else, build the if-then-else statement if - --- - - +- rep - replace by product - Description: - Walks through the map, replacing 'b' with the product of (c n.a b). Produces the resulting - map. - --- - Creates a wet %gold gate which accepts a noun and a gate. - Creates and kicks a dry %gold trap. - If "a is null", produce 'b'. - Else, produce the recursive call to the trap with 'a' replaced by 'r.a' and 'b' replaced by - the recursive call to the trap with 'a' replaced by 'l.a' and b replaced by - the product (c n.a b). - Examples: - - +- rib - transform + product - Description: - - --- - - Examples: - - +- run - turns to tuples - Description: - --- - Examples: - +- tap - listify pairs - Description: - --- - Examples: - +- uni - union, merge - Description: - --- - Examples: - +- wyt - depth of map - Description: - --- - Examples: - -section 2dC, queues - -++ to - queue engine - Description: - Container arm for queue operation arms. The contained arms inherit it's sample queue, 'a'. - --- - Builds a wet %gold tray with sample 'a' of type 'qeu'. - +- bal - v-order queue - Description: - Walks through the queue using vor (v-order check) on all eleements. - --- - Creates and kicks a dry %gold trap. Casts the result to the type of the queue 'a'. - If "a is null", produce null. - Else, build an unless-then-else statement on the logical OR of: - "null is in l.a" - "n.a" precedes "n.l.a" in v-order. - If so, produce the recursive call to the trap with 'a' replaced by [n.l.a l.l.a $(a [n.a r.l.a r.a])] - Else, build an unless-then-else statement on the logical OR of: - "null is in r.a" - "n.a" precedes "n.r.a" in v-order. - If so, produce the recursvie call to the trap with 'a' replaced by [n.r.a $(a [n.a l.a l.r.a]) r.r.a]. - Examples: - ~palryp-hocsyt/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[6 1 3 6 1 3 4 6 ~]) - ~palryp-hocsyt/try=> a - {6 4 3 1 6 3 1 6} - ~palryp-hocsyt/try=> ~(bal to a) - {6 4 3 1 6 3 1 6} - --- - - +- dep - max depth of queue - Description: - Produces the maximum depth of leaves (r.a and l.a) in the queue 'a'. - --- - Creates and kicks a dry %gold trap. Casts the result to an atom. - If "a is null", produce 0. - Else, increment the maximum of the recursive calls of the 'dep' to the left and right leaves of 'a', - $(a l.a) and $(a r.a). - Examples: - ~palryp-hocsyt/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 5 6 7 ~]) - ~palryp-hocsyt/try=> ~(dep to a) - 4 - --- - ~palryp-hocsyt/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 ~]) - ~palryp-hocsyt/try=> ~(dep to a) - 3 - --- - ~palryp-hocsyt/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 ~]) - ~palryp-hocsyt/try=> ~(dep to a) - 2 - +- gas - insert list to que - Description: - Accepts a - --- - Creates a dry %gold gate which accepts a list of the elements of the queue. - Creates and kicks a dry %gold gate. Casts the result to the type of 'a', the queue. - If "b is null", produce 'a'. - Else, Produce the recursive call to the trap with 'b' replaced by the tail of 'b' and 'a' replaced by the - result of putting the head of 'b' into 'a'. - Examples: - ~palryp-hocsyt/try=> (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 ~]) - {3 2 1} - --- - ~palryp-hocsyt/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 ~]) - ~palryp-hocsyt/try=> =b `(list ,@)`[4 5 6 ~] - ~palryp-hocsyt/try=> (~(gas to a) b) - {6 5 4 3 2 1} - +- get - head-tail pair - Description: - Produces the queue 'a' in the format [p=head q=tail]. - --- - Creates and kicks a dry %gold trap. Casts the head term of the resulting tuple to the type of the queue's elements - and the tail type to that of the queue itself. - If "a is null", crash the program. - Else, if "r.a is null", produce [n.a l.a]. - Else, let 'b' be the recursive call of the trap with 'a' replaced by 'r.a'. - Produce the the following as a [p q] cell: - As the p term, 'p.b' - As the q term, the result of the if-then-else statement: - If "null is in q.b" OR 'n.a' precedes 'n.q.b' in the v-order, - produce [n.a l.a q.b]. - Else, produce [n.q.b [n.a l.q.b] r.q.b]. - Examples: - - +- nap - removes head - Description: - Removes the head of a queue, producing the resulting queue. - --- - Assert that 'a' is a cell. - Builds an if-then-else statement on "l.a is null". If so, produce r.a. - Else, let 'b' be the result of getting the [p=head q=tail] pair from 'l.a'. - Produce the queue v-order of bal(+< ^+(a [p.b q.b r.a])). - Examples: - ~talsur-todres/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 5 6 ~]) - ~talsur-todres/try=> -.a - n=6 - ~talsur-todres/try=> =b ~(nap to a) - ~talsur-todres/try=> -.b - n=2 - ~talsur-todres/try=> b - {5 4 3 2 1} - ~talsur-todres/try=> a - {6 5 4 3 2 1} - +- put - insert new head - Description: - Accepts any noun and adds to the queue as the head, producing the resutling queue. - --- - Creates a wet %gold gate which accepts any noun. - Creates and kicks a dry %gold trap. Casts the result to the type of the queue 'a'. - If "a is null", produce [b ~ ~]. - Else, produce bal(+< a(l $(a l.a))). - - Examples: - ~dovryp-toblug/try=> (~(gas to `(qeu ,@)`~) `(list ,@)`[3 1 2 4 5 6 ~]) - ~dovryp-toblug/try=> (~(put to a) 7) - {7 6 5 4 2 1 3} - +- tap - adds list to end - Description: - Concatenates two lists from the first - --- - Creates a dry %gold gate which accepts a list of elements of the type of the queue's elements. - Casts the result to the type of 'b', the list. - If "a is null", produce 'b'. - Else, produce the recursive call to the gate with 'a' replaced by 'r.a' and 'b' replaced by [n.a $(a l.a)], - where $(a l.a) is the recursive call to the trap with 'a' replaced by 'l.a'. - Examples: - ~dovryp-toblug/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[3 1 2 4 5 6 ~]) - ~dovryp-toblug/try=> (~(tap to a) `(list ,@)`[99 100 101 ~]) - ~[3 1 2 4 5 6 99 100 101] - +- top - produces head - Description: - - --- - Creates and kicks a dry %gold trap. Casts the result to a unit of the type of the queue's element. - If "a is null", produce null. - Else, if "the right leaf of 'a' is null", produce [~ n.a]. - Else, produce $(a r.a), the recursive call to the trap with 'a' replaced by 'r.a'. - Examples: - ~talsur-todres/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 5 6 ~]) - ~talsur-todres/try=> ~(top to a) - [~ 1] - -section 2dD, casual containers - -++ mo - make a map - Description: - Mapifiy. Accepts a list of cells and produces a map of key-value pairs from the left-right cell pairs of the list. - --- - Creates a wet %gold gate which accepts a list, 'a'. - Pushes the homogenized list onto the context. - Casts the list 'a' to a list of cells whose left-right types correspond to the key-value type pairs. - Let 'b' be the bunt of the map with the properly typed keys and values from the cell at the head of our list. - Concatenate the elements of 'a' into the empty map of bunt 'b', and produce the result. - Examples: - ~talsur-todres/try=> (mo `(list ,[@t *])`[[`a` 1] [`b` 2] ~]) - {[p=`a` q=1] [p=`b` q=2]} - -++ sa - make a set - Description: - Setify. Accepts a list and produces a set of the list's elements. - --- - Creates a wet %gold gate which accepts a list, 'a'. - Pushes the homogenized list onto the context. - Let 'b' be the bunt of the set with elements of the same type of the elements of 'a'. - Concatenate the elements of 'a' into the empty set of bunt 'b', and produce the result. - Examples: - ~talsur-todres/try=> (sa `(list ,@)`[1 2 3 4 5 ~]) - {5 4 1 3 2} - --- - ~talsur-todres/try=> (sa `(list ,[@t *])`[[`a` 1] [`b` 2] ~]) - {[`a` 1] [`b` 2]} -++ qu - make a set - Description: - XXX THIS APPEARS TO BE A COPY OF ++sa. QUEUIFY IS NOT IMPLEMENTED YET. XXX - --- - Examples: - -chapter 2e, miscellaneous libs - -section 2eA, packing - -++ cue - Unpack an atom to a noun. The inverse of jam. - --- - Activate jet. - Build dry %gold gate with sample atom `a`. - Yield noun. - Push `b` is 0. - Push `m` is empty map of type (map ,@ ,*). - Seek subject for q. - Kick dry %gold trap, yield tuple [p=@ q=* r=_m] - If (0=(cut 0 [b 1] a)), - Then, push `c` is (rub +(b) a). - Produce - - --- - ~midlys-rocpet/try=> (cue (jam 1)) - 1 - ~midlys-rocpet/try=> (cue 4.657) - [1 2] - ~midlys-rocpet/try=> (cue (jam [1 1])) - [1 1] - ~tadbyl-hilbel/try=> (cue 39.689) - [0 19] -++ jam - Compress a noun to an atom. The inverse of cue. - --- - Activate jet. - Build wet %gold gate with sample noun `a`. - Yield atom. - Push `b` is 0. - Push `m` is empty may of type (map ,@ ,*). - - --- - ~midlys-rocpet/try=> (jam 1) - 12 - ~midlys-rocpet/try=> (jam [1 1]) - 817 - ~tadbyl-hilbel/try=> (jam [~ u=19]) - 39.689 -++ mat - Encodes length. Only used internally as helper function to jam and cue. - --- - Activate jet. - Build dry %gold gate with sample atom a. - Yield atom a, atom b. - If: a is 0. - Then: Produce [1 1] - Else, push `b` is (met 0 a), the number of bits in `a`. - Push `c` is (met 0 b), the number of bits in `b`. - Produce pair: - (add (add c c) b) and - (cat 0 (bex c) (mix (end 0 (dec c) b) (lsh 0 (dec c) a))) -++ rub - Decodes length. Only used internally as a helper function to jam and cue. - --- - Activate jet. - Build wet %gold gold with sample atom a, atom b. - Yield atom p, atom q. - Push label `c` on: - Push `c` is 0, m is (met 0 b), the number of bits in `b`. - Kick dry %gold trap. Deny that (gth c m), `c` is greater than `m`. - Unless: (cut 0 [(add a c) 1] b)) is 0, - Then: `c` - Else: Slam trap with +(c) - If: c is 0, - Then: Produce [1 0]. - Else, push `d` is (add a +(c)) - Push `e` is (add (bex (dec c)) (cut 0 [d (dec c)] b)). - Produce [(add (add c c) e) (cut 0 [(add d (dec c)) e] b)] - -section 2eB, parsing (tracing) - -++ last - Compare two [line column] pairs and produce the one which is farther along in text. - --- - Build dry %gold gate with sample hair `zyc`, hair `naz` - Yield hair. - If: p.zyc is p.naz, - Then: If: q.zyc is greater than q.naz, - Then: Produce zyc, - Else: Produce naz. - Else: If: p.zyc is greater than p.naz, - Then: Produce zyc, - Else: Produce naz. - --- - ~tadbyl-hilbel/try=> (last [1 1] [1 2]) - [p=1 q=2] - ~tadbyl-hilbel/try=> (last [2 1] [1 2]) - [p=2 q=1] - ~tadbyl-hilbel/try=> (last [0 0] [99 0]) - [p=99 q=0] - ~tadbyl-hilbel/try=> (last [7 7] [7 7]) - [p=7 q=7] -++ lust - Produce the beginning of the next line after a newline character or increment the column number - The index of the next character to be parsed. - --- - Build dry %gold gate with sample char `weq`, hair `naz` - Yield hair. - If: `weq` is 10, - Then: Produce [+(p.naz) 1]. - Else: Produce [p.naz +(q.naz)]. - --- - ~tadbyl-hilbel/try=> (lust `a` [1 1]) - [p=1 q=2] - ~tadbyl-hilbel/try=> (lust `@t`10 [1 1]) - [p=2 q=1] - ~tadbyl-hilbel/try=> (lust '9' [10 10]) - [p=10 q=11] - ~tadbyl-hilbel/try=> (lust `@t`10 [0 0]) - [p=1 q=1] - -section 2eC, parsing (custom rules) - -++ cold - Build gate to parse a nail with a rule, then replaced the parsed texted with a constant. - --- - Activate jet. - Build wet %gold gate with sample noun `cus`, bunt of a rule `sef`. - Activate extra parsing jet. - Build dry %gold gate with sample nail `tub`. - Push `vex` is the rule `sef` slammed by the nail `tub`, an edge. - If: q.vex is an atom, - Then: Produce `vex` - Else: Produce [p=p.vex q=[~ u=[p=cus q=q.u.q.vex]]] - --- - ~midlys-rocpet/try=> ((cold %foo (just `a`)) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=%foo q=[p=[p=1 q=2] q="bc"]]]] - ~midlys-rocpet/try=> ((cold %foo (just `a`)) [[1 1] "bc"]) - [p=[p=1 q=1] q=~] -++ cook - Build gate to parse a nail with a rule, then slam a gate with the parsed text. - --- - Activate jet. - Build wet %gold gate with sample clam gate `poq`, bunt of a rule `sef`. - Activate extra parsing jet. - Build dry %gold gate with sample nail `tub`. - Push `vex` is the rule `sef` slammed by the nail `tub`, an edge. - If: `q.vex` is an atom, - Then: Produce `vex` - Else: Produce [p=p.vex q=[~ u=[p=(poq p.u.q.vex) q=q.u.q.vex]]], - where (poq p.u.q.vex) is gate `poq` slammed with the parsed text. - --- - ~midlys-rocpet/try=> ((cook ,@ud (just `a`)) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]] - ~midlys-rocpet/try=> ((cook ,@tas (just `a`)) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=%a q=[p=[p=1 q=2] q="bc"]]]] - ~midlys-rocpet/try=> ((cook |=(a=@ +(a)) (just `a`)) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=98 q=[p=[p=1 q=2] q="bc"]]]] - ~midlys-rocpet/try=> ((cook |=(a=@ `@t`+(a)) (just `a`)) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=`b` q=[p=[p=1 q=2] q="bc"]]]] -++ easy - Succeed but consume no characters - Produce an edge at the same text position with the text to parse unchanged, but with a - --- - Activate jet. - Build wet %gold gate with sample noun, `huf`, a noun to produce as the parsed value. - Activate extra parsing jet. - Build dry %gold date with sample nail, `tub` - Yield edge of type `huf` - Produce [p=p.tub q=[~ u=[p=huf q=tub]]], the edge with the noun `huf` as it's parsed value and `tub` as unparsed. - --- - ~tadbyl-hilbel/try=> ((easy %foo) [[1 1] "abc"]) - [p=[p=1 q=1] q=[~ [p=%foo q=[p=[p=1 q=1] q="abc"]]]] - ~tadbyl-hilbel/try=> ((easy %foo) [[1 1] "bc"]) - [p=[p=1 q=1] q=[~ [p=%foo q=[p=[p=1 q=1] q="bc"]]]] - ~tadbyl-hilbel/try=> ((easy 'a') [[1 1] "bc"]) - [p=[p=1 q=1] q=[~ [p='a' q=[p=[p=1 q=1] q="bc"]]]] -++ fail - Fail to parse - Produce a nail at the same text position but with null text. - --- - Build wet %gold gate with sample nail, `tub`. - Produce nail [p=p.tub q=~]. - --- - ~tadbyl-hilbel/try=> (fail [[1 1] "abc"]) - [p=[p=1 q=1] q=~] - ~tadbyl-hilbel/try=> (fail [[p=1.337 q=70] "Parse me, please?"]) - [p=[p=1.337 q=70] q=~] -++ full - Demand politely that the parsing rule parse the entire sample nail, produce a null edge otherwise. - --- - Build wet %gold gate with sample rule, `sab` - Build dry %gold gate with sample nail `tub` - Push `vex` is the rule slammed with the text to parse. - If: Parse of `vex` is null, - Then: Produce `vex` - Else: If: The unparsed text in the produced edge is nulll, - Then: Produce `vex` - Else: Produce [p=p.vex q=~], the edge with a null unit nail. - --- - ~tadbyl-hilbel/try=> ((full (just 'a')) [[1 1] "ab"]) - [p=[p=1 q=2] q=~] - ~tadbyl-hilbel/try=> ((full (jest 'ab')) [[1 1] "ab"]) - [p=[p=1 q=3] q=[~ u=[p='ab' q=[p=[p=1 q=3] q=""]]]] - ~tadbyl-hilbel/try=> ((full ;~(plug (just 'a') (just 'b'))) [[1 1] "ab"]) - [p=[p=1 q=3] q=[~ u=[p=[~~a ~~b] q=[p=[p=1 q=3] q=""]]]] -++ funk - Prepend a tape to the text to be parsed, then parse the new tape. - --- - Build wet %gold gate with sample tape `pre`, rule `sef` - Build dry %gold gate with sample nail, `tub` - Produce the rule slammed with the hair index of `tub` and the concatenation of - the prefix tape and the `tub` tape. - --- - ~tadbyl-hilbel/try=> ((funk "abc prefix-" (jest 'abc')) [[1 1] "to be parsed"]) - [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=" prefix-to be parsed"]]]] - ~tadbyl-hilbel/try=> ((funk "parse" (just 'a')) [[1 4] " me"]) - [p=[p=1 q=4] q=~] -++ here - Apply rule if parsing within a specific line and column range. - --- - Activate jet. - Build wet %gold gate with sample bunted gate accepting pint `a`, noun `b` and producing cell [a b], and bunt of rule `sef` - Activate extra parsing jet. - Build dry %gold gate with sample nail `tub` - Push `vex` is the rule `sef` slammed by the nail `tub`, an edge. - If: `q.vex` is an atom, - Then: Produce `vex`, - Else: Produce the hair, - p is `q.tub` - q is the unit: - Null - u is: - p is `hez` slammed with the pint cell of tub's position and vex's position. - q is `q.u.q.vex`, the text not parsed. - --- - -++ inde - Apply rule to indented block starting at current column number, - omitting the leading whitespace. - --- - Build wet %gold gate with sample rule, 'sef' - Build dry %gold gate with sample nail and the same product type as sef. - Let 'har' and 'tap' be p and q within that nail - Let 'lev' be ' ' repeated once less than the column number in har. - Let roq be the result of parsing the nail as any number of either - Printable characters, or - Newlines followed by ignored lev. - If roq is a failure produce it. - Let 'vex' be the result of parsing with sef, with column restarted to - 1, the result in roq which must be a tape. - If vex is a failure produce it with its p set to that of roq. - Produce an edge with parse reach from roq, succesful result from vex, - hair from vex with column number advanced by q.har - 1 (which was - subtracted prior passing it to sef), and a continuation tape of: - Let res be the continuation in vex(section of block unconsumed). - Build an kick a trap (Do): - If res is empty produce the continuation in roq. - Unless res starts with newline produce the head of res followed - by the result of tossing res for its tail. - Welp together a newline, lev, and the result of tossing res for - its tail. - --- - -++ jest - Match and consume a cord. - --- - Build dry %gold gate with sample cord `daf` - Build dry %gold gate with sample nail `tub` - Push `fad` is `daf` - Kick dry %gold trap. Yield edge of cord text. - If: `daf` is 0, - Then: Produce the edge with: - p is `p.tub` - q is the unit: - Null - u is the cell [p=fad q=tub] - Else: If: fish for null in q.tub OR compile to Nock the last byte in `daf` and the - Then: Produce the failed parse of `tub`, - Else: Toss `p.tub` for the index of the next character to be parsed, `q.tub` for the tail of `q.tub`, `daf` for the single byte right-shift of `daf` - --- - ~tadbyl-hilbel/try=> ((jest 'abc') [[1 1] "abc"]) - [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=""]]]] - ~tadbyl-hilbel/try=> (scan "abc" (jest 'abc')) - 'abc' - ~tadbyl-hilbel/try=> (scan "abc" (jest 'acb')) - ! {1 2} - ! 'syntax-error' - ! exit - ~tadbyl-hilbel/try=> ((jest 'john doe') [[1 1] "john smith"]) - [p=[p=1 q=6] q=~] - ~tadbyl-hilbel/try=> ((jest 'john doe') [[1 1] "john doe"]) - [p=[p=1 q=9] q=[~ [p='john doe' q=[p=[p=1 q=9] q=""]]]] -++ just - Match and consume a single character. - --- - Activate jet. - Build dry %gold gate with sample char `daf` - Activate extra parsing jet. - Build dry %gold gate wtih sample nail `tub` - Yield char edge. - If: `q.tub` is null, - Then: Produce the failed parse of `tub`, - Else: Unless: `daf` is `i.q.tub`, - Then: Produce the failed parse of `tub`, - Else: Produce the parse of the next character of `tub` - --- - ~tadbyl-hilbel/try=> ((just 'a') [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]] - ~tadbyl-hilbel/try=> (scan "abc" (just 'a')) - ! {1 2} - ! 'syntax-error' - ! exit - ~tadbyl-hilbel/try=> (scan "a" (just 'a')) - ~~a - ~tadbyl-hilbel/try=> (scan "%" (just '%')) - ~~~25. -++ knee - Callback - --- - Build wet %gold gate with sample noun `gar`, rule trap `sef` - Build dry %gold gate with sample nail `tub` - Yield char edge. - Produce `tub` slammed to `sef` - --- - - -++ mask - Match the next char to a list of chars, a tape. - --- - Activate jet. - Build wet %gold gate with sample (list char) `bud` - Activate extra parsing jet. - Build dry %gold gate with sample nail `tub` - Yield char edge. - If: `q.tub` is an atom, - Then: Produce the failed parse of `tub` - Else: Unless: - - --- - ~tadbyl-hilbel/try=> (scan "a" (mask "cba")) - ~~a - ~midlys-rocpet/try=> ((mask "abc") [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]] - ~midlys-rocpet/try=> ((mask "abc") [[1 1] "bbc"]) - [p=[p=1 q=2] q=[~ [p=~~b q=[p=[p=1 q=2] q="bc"]]]] - ~midlys-rocpet/try=> ((mask "abc") [[1 1] "dbc"]) - [p=[p=1 q=1] q=~] -++ next - Always succeeds and consumes a character. - --- - Build dry %gold gate with sample nail `tub` - Yield char edge. - If: The text to parse `q.tub` is an atom, - Then: Produce the failed parse of `tub` - Else: Push `zac` is lust slammed with: - The first chaarcter to parse (The head of `q.tub`) and its location in the text. - Produce the edge with the hair `zac` and unit nail with: - The character successfully consumed, the head of the text to parse. - A nail of hair index `zac`, text to be parsed `t.q.tub` (The tail of the text to parse.) - --- - ~tadbyl-hilbel/try=> (next [[1 1] "ebc"]) - [p=[p=1 q=2] q=[~ [p=~~e q=[p=[p=1 q=2] q="bc"]]]] - ~tadbyl-hilbel/try=> (next [[1 1] "john jumps jones"]) - [p=[p=1 q=2] q=[~ [p=~~j q=[p=[p=1 q=2] q="ohn jumps jones"]]]] -++ sear - Conditional cook - Produce the slam of the parsed texted to `b` only if the result is not null. - Else, produce null. - --- - Activate jet. - Build wet %gold gate with sample tile of gate accepting a noun and producing a unit `pyq`, rule `sef` - Activate extra parsing jet. - Build dry %gold with sample nail `tub` - Push `vex` is the rule `sef` slammed by the nail `tub`, an edge. - If: The text to be parsed is an atom, - Then: Produce `vex`, - Else: Push `gey` is `pyq` slammed with the - If: `gey` is an atom, - Then: Produce the cell with: - p is the hair index of the parse failure. - Else: Produce the cell with: - p is the hair index of the parse. - q is the unit with value u is: - p is the value of the parsed text slammed to `pyq` - q is the value of the unparsed text. - --- - ~midlys-rocpet/try=> ((sear |=(a=* ?@(a (some a) ~)) (just `a`)) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]] - ~midlys-rocpet/try=> ((sear |=(a=* ?@(a [~ u=a] ~)) (just `a`)) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]] -++ shim - Match characters within a range. - --- - Activate jet. - Build wet %gold gate with sample atom `les`, atom `mos` - Activate extra parsing jet. - Build dry %gold gate with sample nail, `tub` - Yield char edge. - If: `q.tub` is an atom, - Then: Produce the failed parse of `tub`, - Else: Unless: `i.q.tub` is greater than or equal to `les` AND `i.q.tub` is less than or equal to `mos`, - Then: Produce the failed parse of `tub`, - Else: Produce the single character parse of `tub` - --- - ~midlys-rocpet/try=> ((shim `a` 'z') [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]] - ~midlys-rocpet/try=> ((shim `a` 'Z') [[1 1] "abc"]) - [p=[p=1 q=1] q=~] - ~midlys-rocpet/try=> ((shim `a` 'Z') [[1 1] "Abc"]) - [p=[p=1 q=2] q=[~ [p=~~~41. q=[p=[p=1 q=2] q="bc"]]]] -++ stag - Add a label to an edge parsed by a rule. - --- - Activate jet. - Build wet %gold gate with sample noun `gob`, bunt of a rule `sef` - Activate extra parsing jet. - Build dry %gold gate with sample nail `tub` - Push `vex` is the rule `sef` slammed by the nail `tub`, an edge. - If: `q.vex` is an atom, - Then: Produce `vex` - Else: Produce the edge with hair `p.vex` and unit with value hair u=[p=[gob p.u.q.vex] q=q.u.q.vex] - --- - ~tadbyl-hilbel/try=> ((stag %foo (just 'a')) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=[%foo ~~a] q=[p=[p=1 q=2] q="bc"]]]] - ~tadbyl-hilbel/try=> ((stag "xyz" (jest 'abc')) [[1 1] "abc"]) - [p=[p=1 q=4] q=[~ u=[p=["xyz" 'abc'] q=[p=[p=1 q=4] q=""]]]] - ~tadbyl-hilbel/try=> ((stag 10.000 (shim 0 100)) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=[10.000 ~~a] q=[p=[p=1 q=2] q="bc"]]]] -++ stet - Listify a list of text position and bunt of rule pairs. - --- - Build wet %gold gate with sample list of position and bunt of rule pairs `leh` - Kick dry %gold trap. - If: `leh` is null, - Then: Produce null. - Else: Produce the cell, - with head: The cell of the head of the head of `leh`, p=-.i.leh, the tail of the head of `leh, q=+.i.leh. - with tail: Toss `leh` for `t.leh` - --- - ~tadbyl-hilbel/try=> (stet (limo [[5 (just 'a')] [1 (jest 'abc')] [[1 1] (shim 0 200)] [[1 10] (cold %foo (just 'a'))]~])) - ~[ - [p=5 q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>] - [p=1 q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>] - [p=[1 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>] - [p=[1 10] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>] - ] - ~tadbyl-hilbel/try=> (stet (limo [[[1 1] (just 'a')] [[2 1] (shim 0 200)] ~])) - ~[ - [p=[1 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>] - [p=[2 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>] - ] -++ stew - - --- - Activate jet. - Build wet %gold gate with sample list of position and bunt of rule pairs `leh` - Push label `wor` on: - Build dry %gold gate with sample fork between `ort` , fork `wan` - --- -++ stir - - --- - Activate jet. - Build wet %gold gate with sample noun `rud`, gate accepting two nouns and producing , rule `fel` - Activate extra parsing jet. - Build dry %gold with sample nail `tub` - Yield edge of type of `rud` - Push `vex` is the rule `fel` slammed with the nail `tub`A - If: The parsed text is null, - Then: Produce the edge of unit nail `rud` and `tub` at the hair index of `vex` - Else: Push `wag` is the toss of `tub` for the unparsed text in the unit nail of `vex` - Assert that the value - - Produce the edge with: - The farthest along hair index of `vex` and `wag` - The unit nail of - - --- - -++ stun - Parse several times - --- - Activate jet. - Build wet %gold gate with sample atom `les`, atom `mos`, rule `fel` - Activate extra parsing jet. - Build wet %gold gate with sample nail `tub` - Yield edge of - - If: `mos` is 0, - Then: Produce the edge with - --- - -section 2eD, parsing (combinators) - -++ bend - - --- - Activate jet. - Build wet %gold gate with sample gate accepting a noun `a`, noun `b` and producing the unit of [a b] - Activate extra parsing jet. - Build wet %gold gate with sample edge `vex`, rule `sab` - If: `q.vex` is an atom, - Then: Produce `vex`, - Else: Push `yit` is sab slammed with - --- - -++ comp - Arbitrary compose - --- - Activate jet. - Build wet %gold gate with sample gate accepting noun a, noun b and producing [a b], `raq` - Activate extra parsing jet. - Build wet %gold gate with sample edge `vex`, rule `sab` - If: The parsing output in `vex` is an atom, - Then: Produce the edge `vex` - Else: Push `yit` is the rule slammed with the text to parse in `vex` - Push `yur` is the hair of the edge that is farther along of `vex` and `yit` - If: The unit of parsed text in `yit` is null, - Then: Produce the edge with hair `yur` and unit nail from `yit`, which is null. - Else: Produce the edge with hair `yur`, unit [p=* q=nail] cell where: - p is `raq` slammed with `p.u.q.vex` and `p.u.q.yit`, the parsed results `yit` and `vex` - q is `q.u.q.yit`, the unparsed text of `yit` - --- - - -++ glue - Add rule. - --- - Activate jet. - Build wet %gold gate with sample rule `bus` - Activate extra parsing jet. - Build wet %gold gate with sample edge `vex`, rule `sab` - Slam plug with: - The edge `vex` - The tuple of slamming bus and sab with pfix - --- -++ less - No first and second. - --- - Build wet %gold gate with sample edge `vex`, rule `sab` - If: `q.vex` is null, - Then: Push `roq` is `sab`. Produce [p=(last p.vex p.roq) q=q.roq] - Else: Produce vex with q tossed for null. - --- - -++ pfix - Discard the first rule of a two rule cell. - --- - Activate jet. - Produce comp slammed with: - Build wet %gold gate slammed with sample noun `a`, noun `b`. - Produce `b` - --- - - -++ plug - Apply parsing rules in order to an edge. - --- - Activate jet. - Build wet %gold gate with sample edge `vex`, rule `sab` - If: The unit of text to parse is null, - Then: Produce null. - Else: Push `yit` is the rule `sab` slammed with the text to be parsed. - Push `yur` is the hair of the edge that is farther along of `vex` and `yit` - If: The unit of text parsed is null, - Then: Produce the edge [p=yur q=null]. - Else: Produce the edge [p=yur q=[~ u=[p=[p.u.q.vex p.u.q.yit] q=q.u.q.yit]]], - the edge of the text parsed with the rule. - --- - ~tadbyl-hilbel/try=> (;~(plug lus lus) [[1 1] "++"]) - [p=[p=1 q=3] q=[~ u=[p=[~~~2b. ~~~2b.] q=[p=[p=1 q=3] q=""]]]] - ~tadbyl-hilbel/try=> (scan "++" ;~(plug lus lus)) - [~~~2b. ~~~2b.] - ~tadbyl-hilbel/try=> (scan "++" (cold "slus" ;~(plug lus lus))) - "slus" - ~tadbyl-hilbel/try=> (scan "john doe" ;~(plug (jest 'john') ace (jest 'doe'))) - ['john' ~~. 'doe'] - ~tadbyl-hilbel/try=> (scan "john doe" ;~(plug (jest 'doe') ace (jest 'john'))) - ! {1 1} - ! 'syntax-error' - ! exit - ~tadbyl-hilbel/try=> (;~(plug bar hep) [[1 1] "|-"]) - [p=[p=1 q=3] q=[~ u=[p=[~~~7c. ~~-] q=[p=[p=1 q=3] q=""]]]] - ~tadbyl-hilbel/try=> (;~(plug bar hep lus) [[1 1] "|-"]) - [p=[p=1 q=3] q=~] - ~tadbyl-hilbel/try=> (scan "|-" ;~(plug bar hep lus)) - ! {1 3} - ! 'syntax-error' - ! exit -++ pose - Build list of parsing rules and try to use any of them in order. - `pose` has the same usage as `plug`, but does not fail if the rules are not - successful in a certain order. - --- - Activate jet. - Build wet %gold gate with sample edge `vex`, rule `sab` - If: The unit of text to parse is null, - Then: Push `roq` is the edge result of the rule `sab` applied to the - Produce the edge with the hair that is farther along of `vex` and `yit` and the parse - results of the rule. - Else: Produce the initial edge, `vex` - --- - ~tadbyl-hilbel/try=> (;~(pose (just 'a') (just 'b') (just 'c')) [[1 1] "c"]) - [p=[p=1 q=2] q=[~ [p=~~c q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (scan "c" ;~(pose (just 'a') (just 'b') (just 'c'))) - ~~c - ~tadbyl-hilbel/try=> (;~(pose bar hep) [[1 1] "|-"]) - [p=[p=1 q=2] q=[~ [p=~~~7c. q=[p=[p=1 q=2] q="-"]]]] - ~tadbyl-hilbel/try=> (scan "|-" (star ;~(pose bar hep))) - "|-" - ~tadbyl-hilbel/try=> (scan "|-" (star ;~(pose bar hep lus))) - "|-" - ~tadbyl-hilbel/try=> (scan "john doe" (star ;~(pose (jest 'doe') ace (jest 'john')))) - ~['john' ' ' 'doe'] - -++ sfix - Discard second rule. - --- - Activate jet. - Slam comp with a wet %gold gate accepting noun `a`, noun `b` and producing noun `a` - --- - -section 2eE, parsing (composers) - -++ bass - --- - Build wet %gold gate with sample atom `wuc`, rule `tyd` - Slam cook with: - Build dry %gold gate with sample list of atoms, `waq` - Slam roll with: - --- -++ boss - --- - Build wet %gold gate with sample atom `wuc`, rule `tyd` - --- -++ ifix - - --- - Build wet %gold gate with sample cell of rules `fel`, rule `hof` - Produce pfix gonadified with: - `p.fel`, the first rule in `fel` - Gonadify sfix with `hof` and `q.fel`, the second rule in `fel` - --- - -++ more - --- - Build wet %gold gate with sample rule `bus`, rule `fel` - Produce the gonadified: - --- -++ most - Parse to a list elements of the second rule seperated by the second. - - --- - Build wet %gold gate with sample rule `bus`, rule `fel` - Produce gonadified: - Plug slammed with `fel`, - star slammed with gonadified: - pfix slammed with `bus` and `fel`, `bus` added as the prefix of `fel` - --- - -++ plus - Like 'star', but "one or more" instead of "0 or more" - - --- - Build wet %gold gate with sample rule `fel` - Produce gonadified: - plug slammed with `fel` and star slammed with `fel`, the repeated application of `fel`. - --- - - -++ slug - - --- - Build wet %gold gate with sample noun `rud`, gate accepting cell of two nouns and producing [a b] `raq` - Build wet %gold gate with sample rule `bus`, rule `fel` - Produce the gonadified: - comp slammed with `raq`, - slammed with `fel`, - slammed with, - stir slammed with `rud`, `raq`, and `fel` prefixed with `bus` - --- - -++ star - Apply the parsing rule repeatedly until it fails. - --- - Build wet %gold gate with sample rule `fel, - Produce stir slammed with: - The list of elements of type of the icon of `fel` slammed to `wonk` - - --- - ~tadbyl-hilbel/try=> (scan "aaaaa" (just 'a')) - ! {1 2} - ! 'syntax-error' - ! exit - ~tadbyl-hilbel/try=> (scan "aaaaa" (star (just 'a'))) - "aaaaa" - ~tadbyl-hilbel/try=> (scan "abcdef" (star (just 'a'))) - ! {1 2} - ! 'syntax-error' - ! exit - ~tadbyl-hilbel/try=> (scan "abcabc" (star (jest 'abc'))) - <|abc abc|> - ~tadbyl-hilbel/try=> (scan "john smith" (star (shim 0 200))) - "john smith" - -section 2eF, parsing (ascii) - -++ ace - Parse ASCII character 32, ace. - --- - Produce the rule just slammed with ' ' - --- - ~tadbyl-hilbel/try=> (scan " " ace) - ~~. - ~tadbyl-hilbel/try=> `cord`(scan " " ace) - ' ' - ~tadbyl-hilbel/try=> (ace [[1 1] " "]) - [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (ace [[1 1] " abc "]) - [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q="abc "]]]] -++ bar - Parse ASCII character 124, bar. - --- - Produce the rule just slammed with '|' - --- - ~tadbyl-hilbel/try=> (scan "|" bar) - ~~~7c. - ~tadbyl-hilbel/try=> `cord`(scan "|" bar) - '|' - ~tadbyl-hilbel/try=> (bar [[1 1] "|"]) - [p=[p=1 q=2] q=[~ [p=~~~7c. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (bar [[1 1] "|="]) - [p=[p=1 q=2] q=[~ [p=~~~7c. q=[p=[p=1 q=2] q="="]]]] -++ bas - Parse ASCII character 92, bas. - Note the extra '\' in the slam of bas with just is to escape the escape character, bas. - --- - Produce the rule just slammed with '\\' - --- - ~tadbyl-hilbel/try=> (scan "\\" bas) - ~~~5c. - ~tadbyl-hilbel/try=> `cord`(scan "\\" bas) - '\' - ~tadbyl-hilbel/try=> (bas [[1 1] "\"]) - ~ - ~tadbyl-hilbel/try=> (bas [[1 1] "\\"]) - [p=[p=1 q=2] q=[~ [p=~~~5c. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (bas [[1 1] "\""]) - [p=[p=1 q=1] q=~] -++ buc - Parse ASCII character 36, buc. - --- - Produce the rule just slammed with '$' - --- - ~tadbyl-hilbel/try=> (scan "$" buc) - ~~~24. - ~tadbyl-hilbel/try=> `cord`(scan "$" buc) - '$' - ~tadbyl-hilbel/try=> (buc [[1 1] "$"]) - [p=[p=1 q=2] q=[~ [p=~~~24. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (buc [[1 1] "$%"]) - [p=[p=1 q=2] q=[~ [p=~~~24. q=[p=[p=1 q=2] q="%"]]]] -++ cab - Parse ASCII character 95, cab. - --- - Produce the rule just slammed with '_' - --- - ~tadbyl-hilbel/try=> (scan "_" cab) - ~~~5f. - ~tadbyl-hilbel/try=> `cord`(scan "_" cab) - '_' - ~tadbyl-hilbel/try=> (cab [[1 1] "_"]) - [p=[p=1 q=2] q=[~ [p=~~~5f. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (cab [[1 1] "|_"]) - [p=[p=1 q=1] q=~] -++ cen - Parse ASCII character 37, cen. - --- - Produce the rule just slammed with '%' - --- - ~tadbyl-hilbel/try=> (scan "%" cen) - ~~~25. - ~tadbyl-hilbel/try=> `cord`(scan "%" cen) - '%' - ~tadbyl-hilbel/try=> (cen [[1 1] "%"]) - [p=[p=1 q=2] q=[~ [p=~~~25. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (cen [[1 1] "%^"]) - [p=[p=1 q=2] q=[~ [p=~~~25. q=[p=[p=1 q=2] q="^"]]]] -++ col - Parse ASCII character 58, col. - --- - Produce the rule just slammed with ':' - --- - ~tadbyl-hilbel/try=> (scan ":" col) - ~~~3a. - ~tadbyl-hilbel/try=> `cord`(scan ":" col) - ':' - ~tadbyl-hilbel/try=> (col [[1 1] ":"]) - [p=[p=1 q=2] q=[~ [p=~~~3a. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (col [[1 1] ":-"]) - [p=[p=1 q=2] q=[~ [p=~~~3a. q=[p=[p=1 q=2] q="-"]]]] -++ com - Parse ASCII character 44, com. - --- - Produce the rule just slammed with ',' - --- - ~tadbyl-hilbel/try=> (scan "," com) - ~~~2c. - ~tadbyl-hilbel/try=> `cord`(scan "," com) - ',' - ~tadbyl-hilbel/try=> (com [[1 1] ","]) - [p=[p=1 q=2] q=[~ [p=~~~2c. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (com [[1 1] "not com"]) - [p=[p=1 q=1] q=~] -++ doq - Parse ASCII character 34, doq. - --- - Produce the rule just slammed with '"' - --- - ~tadbyl-hilbel/try=> (scan "\"" doq) - ~~~22. - ~tadbyl-hilbel/try=> `cord`(scan "\"" doq) - '"' - ~tadbyl-hilbel/try=> (doq [[1 1] "\""]) - [p=[p=1 q=2] q=[~ [p=~~~22. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (doq [[1 1] "not successfully parsed"]) - [p=[p=1 q=1] q=~] - ~tadbyl-hilbel/try=> (scan "see?" doq) - ! {1 1} - ! 'syntax-error' - ! exit -++ dot - Parse ASCII character 46, dot. - --- - Produce the rule just slammed with '.' - --- - ~tadbyl-hilbel/try=> (scan "." dot) - ~~~. - ~tadbyl-hilbel/try=> `cord`(scan "." dot) - '.' - ~tadbyl-hilbel/try=> (dot [[1 1] "."]) - [p=[p=1 q=2] q=[~ [p=~~~. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (dot [[1 1] ".^"]) - [p=[p=1 q=2] q=[~ [p=~~~. q=[p=[p=1 q=2] q="^"]]]] -++ fas - Parse ASCII character 47, fas. - --- - Produce the rule just slammed with '/' - --- - ~tadbyl-hilbel/try=> (scan "/" fas) - ~~~2f. - ~tadbyl-hilbel/try=> `cord`(scan "/" fas) - '/' - ~tadbyl-hilbel/try=> (fas [[1 1] "/"]) - [p=[p=1 q=2] q=[~ [p=~~~2f. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (fas [[1 1] "|/"]) - [p=[p=1 q=1] q=~] -++ gal - Parse ASCII character 60, gal. - --- - Produce the rule just slammed with '<' - --- - ~tadbyl-hilbel/try=> (scan "<" gal) - ~~~3c. - ~tadbyl-hilbel/try=> `cord`(scan "<" gal) - '<' - ~tadbyl-hilbel/try=> (gal [[1 1] "<"]) - [p=[p=1 q=2] q=[~ [p=~~~3c. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (gal [[1 1] "<+"]) - [p=[p=1 q=2] q=[~ [p=~~~3c. q=[p=[p=1 q=2] q="+"]]]] - ~tadbyl-hilbel/try=> (gal [[1 1] "+<"]) - [p=[p=1 q=1] q=~] -++ gar - Parse ASCII character 62, gar. - --- - Produce the rule just slammed with '>' - --- - ~tadbyl-hilbel/try=> (scan ">" gar) - ~~~3e. - ~tadbyl-hilbel/try=> `cord`(scan ">" gar) - '>' - ~tadbyl-hilbel/try=> (gar [[1 1] ">"]) - [p=[p=1 q=2] q=[~ [p=~~~3e. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (gar [[1 1] "=>"]) - [p=[p=1 q=1] q=~] -++ hax - Parse ASCII character 35, hax. - --- - Produce the rule just slammed with '#' - --- - ~tadbyl-hilbel/try=> (scan "#" hax) - ~~~23. - ~tadbyl-hilbel/try=> `cord`(scan "#" hax) - '#' - ~tadbyl-hilbel/try=> (hax [[1 1] "#"]) - [p=[p=1 q=2] q=[~ [p=~~~23. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (hax [[1 1] "#!"]) - [p=[p=1 q=2] q=[~ [p=~~~23. q=[p=[p=1 q=2] q="!"]]]] -++ kel - Parse ASCII character 123, kel. - Note that this, with ker, opens and closes a Hoon expression for Hoon string interpolation. Escape kel to parse it. - --- - Produce the rule just slammed with '{' - --- - ~tadbyl-hilbel/try=> (scan "\{" kel) - ~~~7b. - ~tadbyl-hilbel/try=> `cord`(scan "\{" kel) - '{' - ~tadbyl-hilbel/try=> (kel [[1 1] "\{"]) - [p=[p=1 q=2] q=[~ [p=~~~7b. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (kel [[1 1] " \{"]) - [p=[p=1 q=1] q=~] -++ ker - Parse ASCII character 125, ker. - --- - Produce the rule just slammed with '}' - --- - ~tadbyl-hilbel/try=> (scan "}" ker) - ~~~7d. - ~tadbyl-hilbel/try=> `cord`(scan "}" ker) - '}' - ~tadbyl-hilbel/try=> (ker [[1 1] "}"]) - [p=[p=1 q=2] q=[~ [p=~~~7d. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (ker [[1 1] "\{}"]) - [p=[p=1 q=1] q=~] -++ ket - Parse ASCII character 94, ket. - --- - Produce the rule just slammed with '^' - --- - ~tadbyl-hilbel/try=> (scan "^" ket) - ~~~5e. - ~tadbyl-hilbel/try=> `cord`(scan "^" ket) - '^' - ~tadbyl-hilbel/try=> (ket [[1 1] "^"]) - [p=[p=1 q=2] q=[~ [p=~~~5e. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (ket [[1 1] ".^"]) - [p=[p=1 q=1] q=~] -++ lus - Parse ASCII character 43, lus. - --- - Produce the rule just slammed with '+' - --- - ~tadbyl-hilbel/try=> (scan "+" lus) - ~~~2b. - ~tadbyl-hilbel/try=> `cord`(scan "+" lus) - '+' - ~tadbyl-hilbel/try=> (lus [[1 1] "+"]) - [p=[p=1 q=2] q=[~ [p=~~~2b. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (lus [[1 1] ".+"]) - [p=[p=1 q=1] q=~] -++ hep - Parse ASCII character 45, hep. - --- - Produce the rule just slammed with '-' - --- - ~tadbyl-hilbel/try=> (scan "-" hep) - ~~- - ~tadbyl-hilbel/try=> `cord`(scan "-" hep) - '-' - ~tadbyl-hilbel/try=> (hep [[1 1] "-"]) - [p=[p=1 q=2] q=[~ [p=~~- q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (hep [[1 1] ":-"]) - [p=[p=1 q=1] q=~] -++ pel - Parse ASCII character 40, pel. - --- - Produce the rule just slammed with '(' - --- - ~tadbyl-hilbel/try=> (scan "(" pel) - ~~~28. - ~tadbyl-hilbel/try=> `cord`(scan "(" pel) - '(' - ~tadbyl-hilbel/try=> (pel [[1 1] "("]) - [p=[p=1 q=2] q=[~ [p=~~~28. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (pel [[1 1] ";("]) - [p=[p=1 q=1] q=~] -++ pam - Parse ASCII character 38, pam. - --- - Produce the rule just slammed with '&' - --- - ~tadbyl-hilbel/try=> (scan "&" pam) - ~~~26. - ~tadbyl-hilbel/try=> `cord`(scan "&" pam) - '&' - ~tadbyl-hilbel/try=> (pam [[1 1] "&"]) - [p=[p=1 q=2] q=[~ [p=~~~26. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (pam [[1 1] "?&"]) - [p=[p=1 q=1] q=~] -++ per - Parse ASCII character 41, per. - --- - Produce the rule just slammed with ')' - --- - ~tadbyl-hilbel/try=> (scan ")" per) - ~~~29. - ~tadbyl-hilbel/try=> `cord`(scan ")" per) - ')' - ~tadbyl-hilbel/try=> (per [[1 1] ")"]) - [p=[p=1 q=2] q=[~ [p=~~~29. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (per [[1 1] " )"]) - [p=[p=1 q=1] q=~] -++ pat - Parse ASCII character 64, pat. - --- - Produce the rule just slammed with '@' - --- - ~tadbyl-hilbel/try=> (scan "@" pat) - ~~~4. - ~tadbyl-hilbel/try=> `cord`(scan "@" pat) - '@' - ~tadbyl-hilbel/try=> (pat [[1 1] "@"]) - [p=[p=1 q=2] q=[~ [p=~~~4. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (pat [[1 1] "?@"]) - [p=[p=1 q=1] q=~] -++ sel - Parse ASCII character 91, sel. - --- - Produce the rule just slammed with '[' - --- - ~tadbyl-hilbel/try=> (scan "[" sel) - ~~~5b. - ~tadbyl-hilbel/try=> `cord`(scan "[" sel) - '[' - ~tadbyl-hilbel/try=> (sel [[1 1] "["]) - [p=[p=1 q=2] q=[~ [p=~~~5b. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (sel [[1 1] "-["]) - [p=[p=1 q=1] q=~] -++ sem - Parse ASCII character 59, sem. - --- - Produce the rule just slammed with ';' - --- - ~tadbyl-hilbel/try=> (scan ";" sem) - ~~~3b. - ~tadbyl-hilbel/try=> `cord`(scan ";" sem) - ';' - ~tadbyl-hilbel/try=> (sem [[1 1] ";"]) - [p=[p=1 q=2] q=[~ [p=~~~3b. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (sem [[1 1] " ;"]) - [p=[p=1 q=1] q=~] -++ ser - Parse ASCII character 93, ser. - --- - Produce the rule just slammed with ']' - --- - ~tadbyl-hilbel/try=> (scan "]" ser) - ~~~5d. - ~tadbyl-hilbel/try=> `cord`(scan "]" ser) - ']' - ~tadbyl-hilbel/try=> (ser [[1 1] "]"]) - [p=[p=1 q=2] q=[~ [p=~~~5d. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (ser [[1 1] "[ ]"]) - [p=[p=1 q=1] q=~] -++ sig - Parse ASCII character 126, sig. - --- - Produce the rule just slammed with '~' - --- - ~tadbyl-hilbel/try=> (scan "~" sig) - ~~~~ - ~tadbyl-hilbel/try=> `cord`(scan "~" sig) - '~' - ~tadbyl-hilbel/try=> (sig [[1 1] "~"]) - [p=[p=1 q=2] q=[~ [p=~~~~ q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (sig [[1 1] "?~"]) - [p=[p=1 q=1] q=~] -++ soq - Parse ASCII character 39, soq. - Note the extra '\' in the slam of soq with just is to escape the first soq because soq denotes a crip. - --- - Produce the rule just slammed with '\'' - --- - ~tadbyl-hilbel/try=> (scan "'" soq) - ~~~27. - ~tadbyl-hilbel/try=> `cord`(scan "'" soq) - ''' - ~tadbyl-hilbel/try=> (soq [[1 1] "'"]) - [p=[p=1 q=2] q=[~ [p=~~~27. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (soq [[1 1] ">'"]) - [p=[p=1 q=1] q=~] -++ tar - Parse ASCII character 42, tar. - --- - Produce the rule just slammed with '*' - --- - ~tadbyl-hilbel/try=> (scan "*" tar) - ~~~2a. - ~tadbyl-hilbel/try=> `cord`(scan "*" tar) - '*' - ~tadbyl-hilbel/try=> (tar [[1 1] "*"]) - [p=[p=1 q=2] q=[~ [p=~~~2a. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (tar [[1 1] ".*"]) - [p=[p=1 q=1] q=~] -++ tec - Parse ASCII character 96, tec. - --- - Produce the rule just slammed with '`' - --- - ~tadbyl-hilbel/try=> (scan "`" tec) - ~~~6. - ~tadbyl-hilbel/try=> `cord`(scan "`" tec) - '`' - ~tadbyl-hilbel/try=> (tec [[1 1] "`"]) - [p=[p=1 q=2] q=[~ [p=~~~6. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (tec [[1 1] " `"]) - [p=[p=1 q=1] q=~] -++ tis - Parse ASCII character 61, tis. - --- - Produce the rule just slammed with '=' - --- - ~tadbyl-hilbel/try=> (scan "=" tis) - ~~~3d. - ~tadbyl-hilbel/try=> `cord`(scan "=" tis) - '=' - ~tadbyl-hilbel/try=> (tis [[1 1] "="]) - [p=[p=1 q=2] q=[~ [p=~~~3d. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (tis [[1 1] "|="]) - [p=[p=1 q=1] q=~] -++ wut - Parse ASCII character 63, wut. - --- - Produce the rule just slammed with '?' - --- - ~tadbyl-hilbel/try=> (scan "?" wut) - ~~~3f. - ~tadbyl-hilbel/try=> `cord`(scan "?" wut) - '?' - ~tadbyl-hilbel/try=> (wut [[1 1] "?"]) - [p=[p=1 q=2] q=[~ [p=~~~3f. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (wut [[1 1] ".?"]) - [p=[p=1 q=1] q=~] -++ zap - Parse ASCII character 33, zap. - --- - Produce the rule just slammed with '!' - --- - ~tadbyl-hilbel/try=> (scan "!" zap) - ~~~21. - ~tadbyl-hilbel/try=> `cord`(scan "!" zap) - '!' - ~tadbyl-hilbel/try=> (zap [[1 1] "!"]) - [p=[p=1 q=2] q=[~ [p=~~~21. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (zap [[1 1] "?!"]) - [p=[p=1 q=1] q=~] - -section 2eG, parsing (whitespace) - -++ dog -++ doh - Parse - --- - Produce plug gonadified with dot and gay. - --- - -++ dun - Parse phep (--) to null (~). - --- - Produce cold slammed with: - null - plug gonadified with hep and hep, to parse phep. - --- - ~tadbyl-hilbel/try=> (scan "--" dun) - ~ - ~tadbyl-hilbel/try=> (dun [[1 1] "--"]) - [p=[p=1 q=3] q=[~ u=[p=~ q=[p=[p=1 q=3] q=""]]]] -++ duz - Parse stet (==) to null (~). - --- - Produce cold slammed with: - null - plug gonadified with tis and tis, to parse stet - --- - ~tadbyl-hilbel/try=> (scan "==" duz) - ~ - ~tadbyl-hilbel/try=> (duz [[1 1] "== |=..."]) - [p=[p=1 q=3] q=[~ u=[p=~ q=[p=[p=1 q=3] q=" |=..."]]]] -++ gah - - --- - Produce mask slammed with the tuple: - `@`10, the newline character - ' ', the ace character - null - --- - -++ gap - - --- - Produce cold slammed with: - null - Plug gonadified with: - gaq - star slammed with pose gonadified with vul and gah - --- -++ gaq - - --- - Produce pose gonadifed with: - just slammed with the newline character. - Plug gonadified with gah and pose gonadified with gah and vul. - vul - --- - -++ gay - - --- - Produce pose gonadified with: - gap, which - Slam of easy with null - --- - -++ vul - Parse comments and replace them with null. - Note that a comment must be ended with a newline character. - --- - Produce cold slammed with: Pair null and, - plug gonadified with col, col, and, - pose gonadified with: - shim slammed with 32 and 126 - shim slammed with 128 and 255 - just slammed with the newline operator. - (==) Terminates the pair. - --- - - -section 2eH, parsing (idioms) - -++ alf - Parse alphabetic characters, both upper and lowercase. - --- - Produce the rule of pose gonadified with low and hig. - --- - ~tadbyl-hilbel/try=> (scan "a" alf) - ~~a - ~tadbyl-hilbel/try=> (scan "A" alf) - ~~~41. - ~tadbyl-hilbel/try=> (scan "AaBbCc" (star alf)) - "AaBbCc" -++ aln - Parse alphanumeric characters - both alphabetic characters and numbers. - --- - Produce the rule of pose gonadified with low,hig, and nud. - --- - ~tadbyl-hilbel/try=> (scan "0" aln) - ~~0 - ~tadbyl-hilbel/try=> (scan "alf42" (star aln)) - "alf42" - ~tadbyl-hilbel/try=> (scan "0123456789abcdef" (star aln)) - "0123456789abcdef" -++ alp - Parse alphanumeric strings and hep, "-". - --- - Produce the rule pose gonadified with low, hig, nud, hep. - --- - ~tadbyl-hilbel/try=> (scan "7" alp) - ~~7 - ~tadbyl-hilbel/try=> (scan "s" alp) - ~~s - ~tadbyl-hilbel/try=> (scan "123abc-" (star alp)) - "123abc-" -++ bet - Parse the hep and lus axis syntax. - --- - Produce the rule pose gonadified with: - (cold 2 hep), which replaces parsed heps with 2s. - (cold 3 lus), which replaced parsed luses with 3s. - --- - ~tadbyl-hilbel/try=> (scan "-" bet) - 2 - ~tadbyl-hilbel/try=> (scan "+" bet) - 3 -++ bin - Parse a tape of binary (0s and 1s) and produce its atomic representation. - --- - Produce the slam of bass with 2 and the (most gon but), which produces - - --- - ~tadbyl-hilbel/try=> (scan "0000" bin) - 0 - ~tadbyl-hilbel/try=> (scan "0001" bin) - 1 - ~tadbyl-hilbel/try=> (scan "0010" bin) - 2 - ~tadbyl-hilbel/try=> (scan "100000001111" bin) - 2.063 -++ but - Parse a single binary digit. - --- - Produce rule cook slammed with a gate: - With sample atom `a` that results in the difference between `a` and '0' (48). - All slammed with the rule shim slammed with '0' and '1', to parse either of those characters. - --- - ~tadbyl-hilbel/try=> (scan "0" but) - 0 - ~tadbyl-hilbel/try=> (scan "1" but) - 1 - ~tadbyl-hilbel/try=> (scan "01" but) - ! {1 2} - ! 'syntax-error' - ! exit - ~tadbyl-hilbel/try=> (scan "01" (star but)) - ~[0 1] -++ cit - Parse a single octal digit. - --- - Produce rule cook slammed with a gate: - With sample atom `a` that results in the difference between `a` and '0' (48). - All slammed with the rule shim slammed with '0' and '7', to parse any number between 0 and 7. - --- - ~tadbyl-hilbel/try=> (scan "1" cit) - 1 - ~tadbyl-hilbel/try=> (scan "7" cit) - 7 - ~tadbyl-hilbel/try=> (scan "8" cit) - ! {1 1} - ! 'syntax-error' - ! exit - ~tadbyl-hilbel/try=> (scan "60" (star cit)) - ~[6 0] -++ dem - Parse a decimal number to an atom. - --- - Produce the slam of bass with 10 (The base number system) and (most gon dit), which produces - - --- - ~tadbyl-hilbel/try=> (scan "7" dem) - 7 - ~tadbyl-hilbel/try=> (scan "42" dem) - 42 - ~tadbyl-hilbel/try=> (scan "150000000" dem) - 150.000.000 - ~tadbyl-hilbel/try=> (scan "12456" dem) - 12.456 -++ dit - Parse a single decimal digit. - --- - Produce the rule cook slammed with a gate: - With sample atom `a` that results in the difference between `a` and '0' (48). - All slammed with the rule shim slammed with '0' and '9', to parse any number. - --- - ~tadbyl-hilbel/try=> (scan "7" dit) - 7 - ~tadbyl-hilbel/try=> (scan "42" (star dit)) - ~[4 2] - ~tadbyl-hilbel/try=> (scan "26000" (star dit)) - ~[2 6 0 0 0] -++ gul - Parse the axis gal and gar axis syntax. - --- - Produce the rule pose gonadified with: - (cold 2 gal), which replaces parsed gals with 2s. - (cold 3 gar), which replaced parsed gars with 3s. - --- - ~tadbyl-hilbel/try=> (scan "<" gul) - 2 - ~tadbyl-hilbel/try=> (scan ">" gul) - 3 -++ gon - Parse long numbers - Numbers which wrap around the shell with the line break characters bas and fas. - --- - Produce the rule pose gonadified with: - The rule plug gonadified with: - bas, gay, and fas, to succeed to parse a bas, fas, or a gap in text. - The rule (easy ~), to succeed to parse but produces null as the parsed text. - --- - ~tadbyl-hilbel/try=> (scan "\\/" gon) - [~~~5c. ~ ~~~2f.] - ~tadbyl-hilbel/try=> (gon [[1 1] "\\/"]) - [p=[p=1 q=3] q=[~ u=[p=[~~~5c. ~ ~~~2f.] q=[p=[p=1 q=3] q=""]]]] -++ hex - Parse any hexadecimal number to an atom. - --- - Produce bass slammed with 16 (The base number system) and (most gon hit), which produces the atom - - --- - ~tadbyl-hilbel/try=> (scan "a" hex) - 10 - ~tadbyl-hilbel/try=> (scan "A" hex) - 10 - ~tadbyl-hilbel/try=> (scan "2A" hex) - 42 - ~tadbyl-hilbel/try=> (scan "1ee7" hex) - 7.911 - ~tadbyl-hilbel/try=> (scan "1EE7" hex) - 7.911 -++ hig - Parse a single uppercase letter. - --- - Produce the slam of shim with the characters 'A' (65) and 'Z' (90), to parse any character between them, inclusive. - --- - ~tadbyl-hilbel/try=> (scan "G" hig) - ~~~47. - ~tadbyl-hilbel/try=> `cord`(scan "G" hig) - 'G' - ~tadbyl-hilbel/try=> (scan "ABCDEFGHIJKLMNOPQRSTUVWXYZ" (star hig)) - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - ~tadbyl-hilbel/try=> (hig [[1 1] "G"]) - [p=[p=1 q=2] q=[~ [p=~~~47. q=[p=[p=1 q=2] q=""]]]] -++ hit - Parse a hexadecimal digit. - --- - Pose gonadified with: - dit, parse a single decimnal digit. - Slam cook with: - Build dry %gold gate with sample char `a`. Produce the difference between `a` and 87. - The slam of shim with the characters 'a' (97) and 'z' (122), to parse any character between them, inclusive. - The slam of shim with the characters 'A' () and 'Z' (), to parse any character between them, inclusive. - Terminate the gonadification. - --- - ~tadbyl-hilbel/try=> (scan "a" hit) - 10 - ~tadbyl-hilbel/try=> (scan "A" hit) - 10 - ~tadbyl-hilbel/try=> (hit [[1 1] "a"]) - [p=[p=1 q=2] q=[~ [p=10 q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (scan "2A" (star hit)) - ~[2 10] -++ low - Parse a single lowercase letter. - --- - Produce the slam of shim with the characters 'a' (97) and 'z' (122), to parse any character between them, inclusive. - --- - ~tadbyl-hilbel/try=> (scan "g" low) - ~~g - ~tadbyl-hilbel/try=> `cord`(scan "g" low) - 'g' - ~tadbyl-hilbel/try=> (scan "abcdefghijklmnopqrstuvwxyz" (star low)) - "abcdefghijklmnopqrstuvwxyz" - ~tadbyl-hilbel/try=> (low [[1 1] "g"]) - [p=[p=1 q=2] q=[~ [p=~~g q=[p=[p=1 q=2] q=""]]]] -++ mes - Parse a hexbyte. - --- - Slam cook with: - Build dry %gold gate with sample atom `a`, atom `b`. Produce the sum of `a` multiplied by 16 and `b` - Plug gonadified with hit and hit, parse two consecutive hex digits. - --- - ~tadbyl-hilbel/try=> (scan "2A" mes) - 42 - ~tadbyl-hilbel/try=> (mes [[1 1] "2A"]) - [p=[p=1 q=3] q=[~ u=[p=42 q=[p=[p=1 q=3] q=""]]]] - ~tadbyl-hilbel/try=> (scan "42" mes) - 66 -++ nix - - --- - Slam boss with 256 - --- - -++ nud - Parse a numeric character - A number. - --- - Produce the slam of shim with the characters '0' (48) and '9' (57), to parse any character between them, inclusive. - --- - ~tadbyl-hilbel/try=> (scan "0" nud) - ~~0 - ~tadbyl-hilbel/try=> (scan "7" nud) - ~~7 - ~tadbyl-hilbel/try=> (nud [[1 1] "1"]) - [p=[p=1 q=2] q=[~ [p=~~1 q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (scan "0123456789" (star nud)) - "0123456789" -++ poy - Parse an escape character. - --- - Produce pfix gonadified with: - bas - pose gonadifided with: - bas - soq - mes, to parse a hexbyte. - --- - -++ qit - Parse an individual character to its cord atom representation. - --- - Produce pose gonadified with: - The slam of shim with 32 and 38, to parse any characters between them, inclusive. - The slam of shim with 40 and 91, to parse any characters between them, inclusive. - The slam of shim with 93 and 126, to parse any characters between them, inclusive. - The slam of shim with 128 and 255, to parse any characters between them, inclusive. - --- - ~tadbyl-hilbel/try=> (scan "%" qit) - 37 - ~tadbyl-hilbel/try=> (scan "0" qit) - 48 - ~tadbyl-hilbel/try=> (scan "E" qit) - 69 - ~tadbyl-hilbel/try=> (scan "a" qit) - 97 - ~tadbyl-hilbel/try=> (scan "cord" (star qit)) - ~[99 111 114 100] -++ qut - Parse - --- - Slam ifix with: - [soq soq] - boss slammed with 256 and (most gon qit) - --- - - -++ sym - - --- - - --- - -++ ven - - --- - - --- - -++ vit - Parse a text and produce its base 64 encoding - --- - Build list of falling rules to match on with ';~' and pose. - Encodes capital letters by - - --- - -section 2eI, parsing (external) - -++ rash - Parse a cord with a given rule and crash if the cord isn't entirely parsed. - --- - Build wet %gold gate with sample atom `naf`, rule `sab` - Produce the slam of scan with: - Trip slammed with `naf`, to turn `naf` into a tape. - The rule `sab` - --- - ~tadbyl-hilbel/try=> (rash 'I was the world in which I walked, and what I saw' (star (shim 0 200))) - "I was the world in which I walked, and what I saw" - ~tadbyl-hilbel/try=> (rash 'abc' (just 'a')) - ! {1 2} - ! 'syntax-error' - ! exit - ~tadbyl-hilbel/try=> (rash 'abc' (jest 'abc')) - 'abc' - `~tadbyl-hilbel/try=> (rash 'abc' (jest 'ab')) - ! {1 3} - ! 'syntax-error' - ! exit -++ rush - Parse a given with a given rule and produce null if the cord isn't entirely parsed. - --- - Build wet %gold gate with sample atom `naf`, rule `sab` - Produce the slam of scan with: - Trip slammed with `naf`, to turn `naf` into a tape. - The rule `sab` - --- - ~tadbyl-hilbel/try=> (rush 'I was the world in which I walked, and what I saw' (star (shim 0 200))) - [~ "I was the world in which I walked, and what I saw"] - ~tadbyl-hilbel/try=> (rush 'abc' (just 'a')) - ~ - ~tadbyl-hilbel/try=> (rush 'abc' (jest 'abc')) - [~ 'abc'] - ~tadbyl-hilbel/try=> (rush 'abc' (jest 'ac')) - ~ - ~tadbyl-hilbel/try=> (rush 'abc' (jest 'ab')) - ~ -++ rust - Parse a tape with a given rule and produce null if the tape isn't entirely parsed. - --- - Build wet %gold gate with sample tape `los`, rule `sab` - Push `vex` is the rule (full sab) slammed with the beginning of the `los` tape. - If: `q.vex`, the parsed result, is null, - Then: Produce null. - Else: Produce the unit with value 'p.u.q.vex', the parsed text. - --- - ~tadbyl-hilbel/try=> (rust "I was the world in which I walked, and what I saw" (star (shim 0 200))) - [~ "I was the world in which I walked, and what I saw"] - ~tadbyl-hilbel/try=> (rust "Or heard or felt came not but from myself;" (star (shim 0 200))) - [~ "Or heard or felt came not but from myself;"] - ~tadbyl-hilbel/try=> (rust "And there I found myself more truly and more strange." (jest 'And there I')) - ~ -++ scan - Parse a tape with a given rule and crash if the tape isn't entirely parsed. - --- - Build wet %gold gate with sample tape `los`, rule `sab` - Push `vex` is the rule (full sab) slammed with the beginning of the `los` tape. - If: `q.vex` is null, - Then: Add to the crash with message 'syntax-error''s trace: - show slammed with [%m '{%d %d}'], `p.p.vex`, `q.p.vex`, and null - Else: Produce the parsing output of `vex` - --- - ~tadbyl-hilbel/try=> (scan "I was the world in which I walked, and what I saw" (star (shim 0 200))) - "I was the world in which I walked, and what I saw" - ~tadbyl-hilbel/try=> (scan "Or heard or felt came not but from myself;" (star (shim 0 200))) - "Or heard or felt came not but from myself;" - ~tadbyl-hilbel/try=> (scan "And there I found myself more truly and more strange." (jest 'And there I')) - ! {1 12} - ! 'syntax-error' - ! exit - -section 2eJ, formatting (basic text) - -++ cass - Produce the case insensitive (all lowercase) cord of a tape. - --- - Build wet %gold gate with sample tape `vib` - Slam rap with: - 3, to rap by bytes - Slam turn with: - `vib` - Build dry %gold gate with sample atom `a`, - Unless: `a` is greater than or equal to 'A' or less than or equal to 'Z', - Then: Produce `a`, - Else: Produce the difference between `a` and 32. - --- - ~tadbyl-hilbel/try=> (cass "john doe") - 7.309.170.810.699.673.450 - ~tadbyl-hilbel/try=> `cord`(cass "john doe") - 'john doe' - ~tadbyl-hilbel/try=> (cass "abc, 123, !@#") - 2.792.832.775.110.938.439.066.079.945.313 - ~tadbyl-hilbel/try=> `cord`(cass "abc, 123, !@#") - 'abc, 123, !@#' -++ cuss - Turn all occurances of lowercase letters in any tape into uppercase letters, as a cord. - --- - Build dry %gold gate with sample tape `vib` - Yield cord - Slam rap with: - 3, to rap by bytes - Slam turn with: - `vib` - Build dry %gold gate with sample atom `a`, - Unless: `a` is greater than or equal to 'A' or less than or equal to 'Z', - Then: Produce `a`, - Else: Produce the difference between `a` and 32. - --- - ~tadbyl-hilbel/try=> (cuss "john doe") - 'JOHN DOE' - ~tadbyl-hilbel/try=> (cuss "abc ABC 123 !@#") - 'ABC ABC 123 !@#' - ~tadbyl-hilbel/try=> `@ud`(cuss "abc") - 4.407.873 - ~tadbyl-hilbel/try=> (cuss "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsQqRrVvWwXxYyZz") - 'AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSQQRRVVWWXXYYZZ' -++ crip - Produce the cord of a tape. - --- - Build dry %gold with sample tape `a` - Produce the rap of `a` by bytes, cast to a cord. - --- - ~tadbyl-hilbel/try=> (crip "john doe") - 'john doe' - ~tadbyl-hilbel/try=> (crip "abc 123 !@#") - 'abc 123 !@#' - ~tadbyl-hilbel/try=> `@ud`(crip "abc") - 6.513.249 -++ mesc -++ runt -++ sand -++ sane -++ trim -++ trip -++ teff -++ turf -++ tuba -++ tufa -++ tuft -++ wack -++ wick -++ woad -++ wood - -section 2eK, formatting (layout) - -++ re - ++ ram - ++ win - ++ din - ++ fit - ++ rig - ++ wig - -section 2eL, formatting (path) - -++ ab - ++ bix - ++ hif - ++ huf - ++ hyf - ++ pev - ++ pew - ++ piv - ++ piw - ++ qeb - ++ qex - ++ qib - ++ qix - ++ seb - ++ sed - ++ sev - ++ sew - ++ sex - ++ sib - ++ siq - ++ sid - ++ siv - ++ siw - ++ six - ++ sov - ++ sow - ++ sox - ++ ted - ++ tip - ++ tiq - ++ tid - ++ til - ++ urs - ++ urt - ++ voy - ++ vym - ++ vyn -++ ag - ++ ape - ++ bay - ++ bip - ++ dem - ++ dim - ++ dum - ++ fed - ++ hex - ++ lip - ++ qut - ++ sym - ++ tyq - ++ viz - ++ vum - ++ wiz -++ co - ++ rear - ++ rent - ++ rend - ++ a-co - ++ d-co - ++ r-co - ++ s-co - ++ v-co - ++ w-co - ++ x-co - ++ y-co - ++ z-co - ++ em-co - ++ ox-co - ++ ro-co -++ ne - ++ d - ++ x - ++ v - ++ w -++ mu - ++ zag - ++ zig - ++ zug -++ so - ++ bisk - ++ crub - ++ nuck - ++ nusk - ++ perd - ++ royl - ++ tash - ++ twid - ++ zust -++ scot -++ scow -++ slav -++ slaw -++ slay -++ smyt - -section 2eM, regular-expressions - -++ pars -++ nor -++ les -++ lep -++ alm -++ alb -++ mis -++ anns -++ mall -++ bets -++ ranc -++ flap -++ rang -++ chun -++ seac -++ sead -++ sade -++ seap -++ cape -++ lower -++ upper -++ digit -++ print -++ graph -++ blank -++ space -++ cntrl -++ alpha -++ alnum -++ punct -++ wordc -++ white -++ xdigi -++ chad -++ escd -++ escp -++ unid -++ proc -++ cont -++ abor -++ matc -++ chet -++ blak -++ deep -++ rexp -++ repg - -section 2eN, pseudo-cryptography - -++ un - ++ wre - ++ wre - ++ xaf - ++ xar - ++ zaf - ++ zar - ++ zyf - ++ zyr - -section 2eO, virtualization - -++ mack - Accpet a nock subject-formula cell. - Produce a unit result, treating 11 as a crash (i.e. pure nock). - --- - Creates a dry %gold gate accepting cell ['sub' 'fol']. - Its output is a unit (of a noun). - Let 'ton' be the result of minking the sample, with a sky that produces - ~ on any input, halting interpretation. - Unless ton has stem 0, produce the empty unit, otherwise produce one - containing ton's bulb. - --- - ~zod/try=> (mack [[1 2 3] [0 1]]) - [~ [1 2 3]] - ~zod/try=> (mack [41 4 0 1]) - [~ 42] - ~zod/try=> (mack [4 0 4]) - ~ - ~zod/try=> (mack [[[0 2] [1 3]] 4 4 4 4 0 5]) - [~ 6] - ~zod/try=> ;;((unit ,@tas) (mack [[1 %yes %no] 6 [0 2] [0 6] 0 7])) - [~ %no] -++ mink - XX - Description: - Bottom-level mock (virtual nock) interpreter. - Accepts a nock subject-formula cell, and an %iron gate which - accepts any noun and produces a unit, which is defined to be mock 11. - Produces a ++tone, which is the result of the virtualized computation. - --- - For clarity, a ++tone with stem %0 will be referred to as a "success", - one with stem %1 as a "block", and one with stem %2 as a "crash". - --- - Activate jet. - Creates a dry %gold gate accepting cell ['sub' 'fol'] and gate 'sky'. - Let 'tax' be a statically bunted list of term-noun pairs. (hint list) - Do (recursion point) produce a tone: - If fol is an atom - Produce a crash of fol. - Else if the head of fol is a cell - Let hed be the result of recurring with fol replaced by its head. - If hed is a crash - Yield it - Otherwise let 'tal' be the result of recurring with fol replaced - by its tail. - Switch on the type of tal by stem: - If tal is a success - If hed is a block produce hed. - Else (success) produce a success of a cell of the bulbs of hed - and tal. - If tal is a block - If hed is a success produce tal. - Else (block) produce a block of welding the bulbs of hed and tal. - Else (crash) produce tal - Otherwise (the head of fol is an atom) switch on fol, - by default producing a crash of tax. - If fol has stem 0 and an atom bulb we name 'b' - If b is 0 produce a crash of tax. - If b is 1 produce a success of sub. - If sub is an atom produce a crash of tax - Otherwise let 'now' be the cap of b, and 'lat' be the mas of b - Tail-recur with b replaced by lat, and sub replaced by: if now is 2, - its head, else its tail. - If fol has stem 1 and a bulb we name 'b' - Produce a success of b - If fol has stem 2 and a bulb whose head is a cell. - Let 'ben' be the result of recurring with fol replaced by its bulb. - Unless ben is a success, produce ben. - Else assert that ben contains a cell, and tail-recur with - sub and fol replaced by the head and tail of ben's bulb - If fol has stem 3 and a bulb we name 'b' - Let 'ben' be the result of recurring with fol replaced by b. - Unless ben is a success, produce ben. - Else produce a success of (loobean) whether ben contains a cell. - If fol has stem 4 and a bulb we name 'b' - Let 'ben' be the result of recurring with fol replaced by b. - Unless ben is a success, produce ben. - Else unless ben contains an atom produce a crash of tax. - Otherwise produce a success of ben's contents, incremented. - If fol has stem 5 and a bulb we name 'b' - Let 'ben' be the result of recurring with fol replaced by b. - Unless ben is a success, produce ben. - Else unless ben contains a cell produce a crash of tax. - Otherwise produce a success of (loobean) whether the bulb of ben has - a tail equal to its head. - If fol has stem 6, 7, 8, or 9 - Tail-recur with its bulb expanded per nock specification. - If fol has stem 10 and a cell bulb whose head is an atom - Tail-recur with for replaced by its bulb's tail - If fol has stem 10 and a bulb that can be destructured as [[b c] d] - Let ben be the result of recurring with fol replaced by v. - Unless ben is a success, produce ben. - If b is %hunk, %lose, %mean, or %spot - Tail-recur with fol replaced by d and tax prepended with a pair of - b and the bulb of ben. - Else tail-recur with just fol replaced by d. - Examples: - XX -++ mock - XX - Description: - Accepts a nock subject-formula cell and an %iron gate which - accepts any noun and produces a unit (this is used as nock 11). - Produces a ++toon, which is a sucesful, blocked, or crashed result. - --- - Compose ++mook and ++mink. - Examples - ~zod/try=> (mock [5 4 0 1] ,~) - [%0 p=6] - ~zod/try=> (mock [~ 11 1 0] |=(* `999)) - [%0 p=999] - ~zod/try=> (mock [~ 0 1.337] ,~) - [%2 p=~] - ~zod/try=> (mock [~ 11 1 1.337] ,~) - [%1 p=~[1.337]] - ~zod/try=> (mock [[[4 4 4 4 0 3] 10] 11 9 2 0 1] |=(* `[+<])) - [%0 p=14] - ~zod/try=> (mock [[[4 4 4 4 0 3] 10] 11 9 2 0 1] |=(* `[<+<>])) - [%0 p=[49 52 0]] - ~zod/try=> ;;(tape +:(mock [[[4 4 4 4 0 3] 10] 11 9 2 0 1] |=(* `[<+<>]))) - "14" - -++ mook - XX - Description: - Intelligently render crash annotation. - Accepts a ++tone, produces a ++toon - --- - Create a dry %gold gate accepting a tone we name 'ton' - Its output is a toon. - Unless the stem of ton is %2, produce ton. - Produce a frond with a stem of 2 and the following bulb: - Let yel be the length of ton's bulb. - Replace the bulb of ton, - If yel > 256 (otherwise keep it static) - With the weld of - its top 128 elements - And a list of term-noun pairs: - The last 128 elements of ton's bulb - Preceded by a %lose-stemmed frond of - A cord from the tape - "[skipped " - A @ud rendering of yel - 256 - " frames]" - Do (*recursion point*) produce a list of tanks: - For each element in the bulb of ton - Switch on its leaf, by default leaving the element out of the product - For each %hunk, clam it to a tank - For each %lose, produce a leaf with the element clammed to an atom - and tripped (to a tape). - For each %mean, if the elment is an atom treat it as a %lose - Otherwise let mac be the element macked by its tail. - If the computation fails, produce a "####" leaf, else clam - the result to a tank. - For each %spot, let sot be the element clammed to a spot. - Produce a leaf with - The weld of - The path in sot converted to a tank and then a tape - ":<[" - [[p.p ] ] in the pint in sot rendered as @ud - " " - [[ q.p] ] in the pint in sot rendered as @ud - "].[" - [ [p.q ]] in the pint in sot rendered as @ud - " " - [ [ q.p]] in the pint in sot rendered as @ud - "]>" - - Examples - ~zod/try=> (mook [%0 5 4 5 1]) - [%0 p=[5 4 5 1]] - ~zod/try=> (mook [%2 ~[[%hunk %rose ["<" "," ">"] ~[[%leaf "err"]]]]]) - [%2 p=~[[%rose p=[p="<" q="," r=">"] q=[i=[%leaf p="err"] t=~]]]] - ~zod/try=> (mook [%2 ~[[%malformed %elem] [%lose 'do print']]]) - [%2 p=~[[%leaf p="do print"]]] - ~zod/try=> (mook [%2 ~[[%spot /b/repl [[1 1] 1 2]] [%mean |.(!!)]]]) - [%2 p=~[[%leaf p="/b/repl/:<[1 1].[1 2]>"] [%leaf p="####"]]] -++ mang - XX - Description: - XX - --- - XX - Examples - XX -++ mong - XX - Comment: - XX - Description: - Mang is just like mack, but accepting a sky. - It produces a unit computation result. - --- - Creates a dry %gold gate accepting cell ['sub' 'fol'] and an - %iron unit-clam 'sky'. - Its output is a unit (of a noun). - Let 'ton' be the result of monging the sample. - Unless ton has stem 0, produce the empty unit, otherwise produce one - containing ton's bulb. -++ mung - XX - Description: - XX - --- - XX - Examples - XX -++ mule - XX - Description: - XX - --- - XX - Examples - XX -++ mute - XX - Description: - XX - --- - XX - Examples - XX - -section 2eP, diff **noted as "(move me)" in source** - -++ berk -++ diff -++ loss - ++ abet - ++ hink - ++ lonk - ++ lune - ++ merg - ++ main -++ locz -++ lore -++ role -++ lump -++ lure -++ limp -++ hump -++ husk -++ lurk -++ lusk - ++ abet - ++ done - ++ main -++ nude - ++ axes - ++ tred - -section 2eW, lite number theory - -++ egcd -++ pram -++ ramp -++ fo - ++ dif - ++ exp - ++ fra - ++ inv - ++ pro - ++ sit - ++ sum -++ ga - ++ dif - ++ dub - ++ pro - ++ toe - ++ sit - ++ fra - ++ inv - ++ pow - ++ pro - -section 2eX, jetted crypto - -++ aesc - ++ en - ++ de -++ ahem - ++ cipa - ++ co - ++ ix - ++ ro - ++ su - ++ pen - ++ co - ++ ix - ++ ro - ++ su - ++ pin - ++ co - ++ ix - ++ ro - ++ su - ++ mcol - ++ pode - ++ sube - ++ be - ++ ankh - ++ sark - ++ srow - ++ subs - ++ ex - ++ ix -++ curt - ++ cla - ++ sqr - ++ inv - ++ cad - ++ cub -++ ed - ++ norm - ++ xrec - ++ ward - ++ scam - ++ etch - ++ curv - ++ deco - ++ bb - ++ puck - ++ suck - ++ sign - ++ veri - -section 2eY, SHA-256 - -++ shad -++ shaf -++ shak -++ sham -++ shas -++ shax -++ shaw -++ og - ++ rad - ++ raw -++ shaz -++ shal -++ shan - -section 2eZ, OLD rendering - -++ show - ++ shep - ++ shop -++ at - ++ r - ++ rf - ++ rn - ++ rt - ++ rta - ++ rtam - ++ rub - ++ rud - ++ rum - ++ rup - ++ ruv - ++ rux - -chapter 2f, Hoon proper - -section 2fA, miscellaneous funs - -++ bull -++ cain -++ cell -++ core -++ cube -++ face -++ bean -++ flay -++ flee -++ foil -++ fork -++ cove -++ comb -++ cond -++ cons -++ fitz -++ flan -++ flip -++ flor -++ hike -++ hoax -++ hoof -++ jock -++ look -++ make -++ noah -++ onan -++ rain -++ ream -++ reck -++ seed -++ seem -++ seer -++ sell -++ pave -++ loot -++ slam -++ slim -++ slit -++ slym -++ slap -++ slop -++ skol -++ spat -++ spuc -++ spec -++ spud -++ slot -++ slum -++ stab -++ wash - -section 2fB, macro expansion - -++ ah - ++ blue - ++ gray - ++ puce -++ al - ++ blah - ++ home - ++ bunt - ++ clam - ++ cloq - ++ whip -++ ap - ++ etch - ++ feck - ++ hock - ++ open - ++ rake - ++ rusk - -section 2fC, compilation proper - -++ ut - ++ burn - ++ busk - ++ conk - ++ crop - ++ dext - ++ sint - ++ cool - ++ dank - ++ dart - ++ deal - ++ dial - ++ dish - ++ doge - ++ dole - ++ duck - ++ dune - ++ dunk - ++ fino - ++ fink - ++ finq - ++ fire - ++ firm - ++ fish - ++ fuse - ++ gain - ++ hang - ++ harp - ++ lose - ++ chip - ++ heal - ++ mint - ++ nice - ++ grow - ++ moot - ++ mull - ++ both - ++ nice - ++ grow - ++ bake - ++ meet - ++ nest - ++ cong - ++ cram - ++ dext - ++ sint - ++ park - ++ peek - ++ play - ++ reco - ++ repo - ++ rest - ++ seek - ++ seep - ++ sift - ++ snub - ++ tack - ++ tock - ++ wrap - -section 2fD, grammar - -++ vang -++ vast - ++ gash - ++ gasp - ++ glam - ++ hasp - ++ mota - ++ plex - ++ pray - ++ prey - ++ phax - ++ posh - ++ poof - ++ poon - ++ poor - ++ porc - ++ rump - ++ rood - ++ rupl - ++ sail - Templating language for rendering HTML web documents. - --- - Build dry %gold gate with sample bean `tol`. - Push bunt of bean `lin` onto the core below. - Build core, - --- - ++ ape - The apex node of - --- - Slam cook with: - The reverse of `amp` and the following gate: - Build dry %gold gate with sample tuna `tum`. Yield twig. - If: `tum` is [%e *], an element, - Then: Produce the twig of twig `p.tum` and sag slammed with `q.tum` - Else: Produce the sag slammed with `tum` and null, the twig of `tum` - --- - ++ amp - Entry point of the XML tree. Start parsing a template at `sem`. - Continue to parse with ++ba if in tall form and ++bat if in wide form. - --- - Gonadify pfix with: - sem, - If: tol, - Then: bam, - Else: bat - --- - ++ bam - Begin to parse the template in tall form. - --- - Slam knee with: - The bunt of tuna. - Build dry %gold trap which is cached (memoized) - Gonadify pose with: - Stag slammed with %f, pfix gonadified with: - (plus ace), 1 or whitespaces, - Cook slammed with rab, puv - Stag slammed with %e, pfix gonadified with: - `ag, - nal - Stag slammed with %e, hul, - Stag slammed with %f, nup, - Gonadify pfix with: - tis, - Stag slammed with %f, nol - Gonadify pfix with: - hep - Stag slammed with: - %a, - Gonadify pfix with gap, talL - Gonadify pfix with: - lus - Stag slammed with: - %b, - Gonadiffy pfix with gap, tall - Gonadify pfix with: - tar - Stag slammed with: - %c, - Gonadify pfix with gap, tall - Gonadify pfix with: - cen - Stag slammed with: - %d, - Gonadify pfix with gap, tall - Slam easy with [%f [%a [%smdq 10 ~]] ~] - --- - ++ bat - Begin to parse an entire template line in wide form. - --- - Slam knee with: - The bunt of tuna - Build dry %gold trap which is cached (memoized) - Gonadify pose with: - Stag slammed with %f, nup - Stag slammed with %f, ped - Stag slammed with: - %e, - Gonadify plug with hip, lif - Terminate pose gonadification. - --- - ++ bet - Begin to parse an inner line section in wide form. - --- - Slam knee with: - The bunt of tuna - Build dry %gold trap which is cached (memoized) - Gonadify pose with: - bat, - Gonadify pfix with: - hep - Stag slammed with %a, wide - Gonadify pfix with: - lus - Stag slammed with %b, wide - Gonadify pfix with: - tar - Stag slammed with %c, wide - Gonadify pfix with: - cen - Stag slammed with %d, wide - Terminate pose gonadification. - --- - ++ fry - Element or attribute name. - May contain '_', signifying ':', optionally followed by - class and/org id - --- - Slam cook with: - Build dry %gold gate with sample term `a`, unit term `b`: - If: `b` is null, - Then: Produce [%dtzz %tas a], - Else: Produce [[%dtzz %tas a] [%dtzz %tas u.b]] - Gonadify plug with: - sym, - Gonadify pose with: - Stag slammed with null, pfix gonadified with cab, sym. - Easy slammed with null. - ++ hag - Tag head - --- - Slam cook with: - Build dry %gold gate with sample twig `a` and produces `a`. - Gonadify plug with: - Stag slammed with: - %dtzz, - Stag slammed with: - %tas - Pose gonadified with: - Jest slammed with %script, - Jest slammed with %style, - Stag slammed with %clsg, jaw - Terminate plug gonadification. - ++ hig - Simple tag head. - --- - Slam cook with: - Build dry %gold gate with sample twig `a`, list of twigs `b`. Produce [a %clsg b]. - hog. - ++ hog - Tag head. - --- - Slam cook with: - Build dry %gold gate with sample tile: - twig `a` - unit term `b` - unit term `c` - unit twig `d` - list of twigs `e` - Terminate tile construction. - Yield pair of twig, list of twigs. - Set `e` to: If: `b` is null, - Then: Produce `e`, - Else: Produce [[[%dtzz %tas %class] [%smdq (trip u.b)]] e] - Set `e` to: If: `c` is null, - Then: Produce `e`, - Else: Produce [[[%dtzz %tas %id] [%smdq (trip u.c)]] e] - Set `e` to: If: `d` is null, - Then: Produce `e`, - Else: Produce [[[%dtzz %tas %href] u.d] e] - Produce pair [a e]. - Gonadify plug with: - fry, - Pose gonadified with: - Stag slammed with null, pfix gonadified with dot, sym - Easy slammed with null, - Pose gonadified with stag slammed with - Stag slammed with null, pfix gonadified with hax, sym - Easy slammed with null, - Pose gonadified with stag slammed with - Stag slammed with null, pfix gonadified with dot, stag slammed with %smdg, soil - Easy slammed with null, - Pose gonadified with: - ifix slammed with [pel per] and, - More slammed with plug gonadified with com, ace and, - Plug gonadified with fry, pfix gonadified with ace, wide - Easy slammed with null - Terminate pose gonadification. - Terminate plug gonadification. - ++ hoy - Tail attributes. - --- - Star slammed with: - pfix gonadified with: - plug gonadified with gap, tis - plug gonadified with fry, pfix gonadified with gap, tall - Terminate pfix gonadification. - ++ hul - Tall preface. - --- - Cook slammed with: - Build dry %gold gate with sample element tuna `a`, list twig `b`, list tuna `c`, - Yield [twig (list tuna)] element tuna. - Produce [[p.a %clsg (weld q.a b)] c] - Gonadify plug with hog, hoy, nol - ++ jaw - Wide attributes - --- - Gonadify pose with: - ifix slammed with [pel per] and, - More slammed with plug gonadified with com, ace, and, - plug gonadified fry, pfix gonadified with ace, wide - Easy slammed with null. - Terminate pose gonadification. - ++ lif - Wide elements. - --- - Slam cook with: - Build dry %gold gate with sample list of tuna `a` which produces `a` - Gonadify pose with: - pfix gonadied with col, pep - cold slammed with null, sem - easy slammed with null - --- - ++ luf - Wide elements. - --- - Slam cook with: - Build dry %gold gate with sample list of tuna `a` which produces `a` - Star slammed with: - Gonadify pfix with ace, bet. - --- - ++ nal - Unescaped tall tail. - --- - Slam cook with sample: - Build dry %gold gate with sample list of tuna `a` which produces `a`, - Slam ifix with: - Tile autoons gap and plug gonadified with gap, duz, - Slam most with: - gap, - Gonadify pfix with: - Gonadify pose with: - Gonadify pfix with: - ace, - Cook slammed with: - Build dry %gold gate with sample tape `a` which produces: - [%a %smdq (weld a `tape`[`@`10 ~])], - where (weld a `tape`[`@`10 ~] is the concatenation - of tape `a` with the newline character. - Star slammed with shim slamme with 32, 255. - Terminate pfix gonadification. - Terminate pose gonadification. - Terminate pfix gonadification. - - --- - ++ nol - Tall tail. - --- - Assert that tol is true, that we are parsing a tall form part of the template. - Slam cook with: - Build dry %gold gate with sample list of tuna `a` which produces `a`, - Gonadify pose with: - Slam cold with null, sem - pfix gonadified with col, pep called with tol replaced by false, to continue to parse in wide form. - pfix gonadified with: - Gonadify plug with col, ace. - Slam cook with rab called with tol replaced by false, to continue to parse in wide form, and puv. - ifix slammed with: - [gap :~(plug gap duz)], which disregards non-code before plug gonadifed with gap and duz. - Most slammed with gap, amp. - Temrinate pose gonadification. - --- - ++ nup - Wide quote. - --- - Slam cook with: - Build dry %gold gate with sample list of tuna `a` which produces `a` - Gonadify pose with: - Gonadify less with: - jest slammed with '"""'< - ifix slammed with: - [doq doq] - Cook slammed with rab, puv - inde slammed with: - ifix slammed with: - Jest slammed with '"""\0a' and jest slammed with '\0a"""', - Cook slammed with rab, puv called with `lin` tossed for false. - Terminate pose gonnadification. - --- - - ++ pab - Bracketed element. - --- - Slam ifix with [kel ker], plug gonadified with: - hig, to parse an uppercase letter followed by, - luf, to parse wide elements. - --- - - ++ ped - Wide flow. - --- - Slam cook with: - Dry %gold gate with sample list of tuna `a` which produces `a` - ifix slammed with [pel per], more slammed with ace, bet. - --- - - ++ pep - Wrapper tuna. - --- - Slam cook with: - Build dry %gold gate with sample list of tuna `a` which produces `a` - Gonadify pose with: - ped, - ifix slammed with: - [pel per], - More slammed with ace, bet - cook slammed with: - Build dry %gold gate with sample cord, - Which produces list of element [%a %smdg (trip +<)]. - qut - Gonadify plug with bat, easy slammed with null. - Terminate plug gonadification. - Terminate pose gonadification. - --- - - ++ puv - Wide/tall flow. Parse wide form interpolated Hoon code in any tag, - - --- - Slam cook with: - Build dry %gold with samlpe list of beets `a` which produces `a` - The slam of star with: - Gonadify pose with: - pfix gonadified with: - bas, - pose slammed with: - mask slammed with tape "-+*%;\{", - bas, doq, bix:ab. - pfix gonadified with hep, stag slammed with %a, sump - pfix gonadified with lus, stag slammed with %b, sump - pfix gonadified with tar, stag slammed with %c, sump - pfix gonadified with cen, stag slammed with %d, sump - pfix gonadified with sem, stag slammed with %e, - less gonadified with: - bas, kel, - If: tol, Then: fail, Else: doq - prn - If: lin, Then: fail, - Else: Gonadify less with: - Jest slammed with '\0a"""', - Just slammed with '\0a' - Stag slammed with %a, sump - Terminate pose gonadification. - --- - ++ rab - Beet to tuna. - --- - Build a dry %gold gate with sample list of beets, `reb` - Yield list of tuna. - Push bunt of [sim=(list ,@) tuz=(list tuna)] - Kick dry %gold trap. Yield list of tuna. - If: `reb` is null, - Then: Set `sim` to Unless: tol, Then: Produce sim, - Else: Produce [10 |-(?~(sim sim ?:(=(32 i.sim) $(sim t.tim) sim)))] - Else: If: The head of `reb` is an atom, - Then: Produce the toss `reb` for the tail of `reb`, `sim` for [i.reb sim] - Else: Push `zut` is the toss of `reb` for the tail of `reb`, `sim` for null - If: `sim` is null, Then: Produce [i.reb zut], - Else: Produce [[%a %smdq (flop sim)] i.reb zut] - ++ sag - Produce a twig from a tuna. - --- - Build dry %gold gate with sample list of tunas, `lut` - Yield twig. - Pair %cltr and, - Build dry %gold trap. Yield list of twigs. - If: `lut` is null, - Then: Produce [[%dtzz %n ~] ~], - Else: Switch on the head of the head of `lut`, - if %a, produce [[%clfs p.i.lut] $(lut, t.lut)], - if %b, produce [p.i.lut $(lut t.lut)] - if %c, produce the reverse cell of null and, - Triple %cndt, cast of [p.i.lut $(lut t.lut)] to a twig and, - Triple %tsbr, cast of [[%axil %noun] [%axil %noun]] to a tile and, - Pair %brcn and, - Yield a map of terms to feet, - Reverse cell of [~ ~] and, - Push `sug` is [[%& 12] ~] - Triple %$, %elm, and, - Quad %wtsg, `sug`, [%cnts `sug` [[[%& 1] ~] [~ 13]]] - if %d, produce [%cnhp] - if %e, produce - if %f, produce - where $(lut, t.lut) is the toss of `lut` for the tail of `lut`. - Terminate switch statement. - --- - ++ scat - ++ soil - ++ sump - ++ noil - ++ toad - ++ rung - ++ gunk - ++ muck - ++ butt - ++ loaf - ++ lobe - ++ exqa - ++ exqb - ++ exqc - ++ exqd - ++ exqe - ++ norm - ++ boog - ++ wisp - ++ toad - ++ rune - ++ glop - ++ gunk - ++ butt - ++ ulva - ++ hank - ++ loaf - ++ lobe - ++ mash - ++ muck - ++ teak - ++ race - ++ rack - ++ rick - ++ expa - ++ expb - ++ expc - ++ expd - ++ expe - ++ expf - ++ expg - ++ exph - ++ expi - ++ expj - ++ expk - ++ expm - ++ expn - ++ expo - ++ expp - ++ expq - ++ expr - ++ exps - ++ expt - ++ expu - ++ expv - ++ expw - ++ expx - ++ expy - ++ expz - ++ hina - ++ hinb - ++ hinc - ++ hind - ++ hine - ++ hinf - ++ hing - ++ bonk - ++ bont - ++ bony - ++ bonz - ++ lung - ++ long - ++ lobo - ++ loon - ++ lute - ++ rope - ++ tall - ++ wide - ++ hill - ++ howl - ++ toil - ++ wart -++ vest -++ vice - -volume 3, Arvo models and skeleton - -++ arch -++ bead -++ care -++ case -++ desk -++ cage -++ chop -++ curd -++ disk -++ duct -++ gene -++ glob -++ herd -++ hilt -++ hypo -++ khan -++ lens - ++ v - ++ w - ++ x - ++ y - ++ z -++ logo -++ lode -++ mark -++ mill -++ milt -++ monk -++ mold -++ muse -++ mosh -++ move -++ ovum -++ pane -++ pone -++ ship -++ sled -++ slut -++ vile -++ wire -++ slod -++ slub - -section 3bE, Arvo core - -++ vent - ++ ruck - ++ wink - ++ doze - ++ sike - ++ souk - ++ sunk - ++ song - ++ spuc - ++ sump - ++ said - ++ scry - ++ soar - ++ swim -++ vint -++ viol -++ is - ++ beck - ++ dink - ++ dint - ++ doos - ++ hurl - ++ race - ++ fire - ++ jack - ++ kick - -Postface - - ++ come - ++ keep - ++ load - ++ peek - ++ poke - ++ wish -++ come -++ keep -++ load -++ peek -++ poke -++ vega -++ veer -++ wish diff --git a/urb/zod/main/doc/ref/originalUnsplitDocs.txt b/urb/zod/main/doc/ref/originalUnsplitDocs.txt deleted file mode 100644 index 37d8a4c6a..000000000 --- a/urb/zod/main/doc/ref/originalUnsplitDocs.txt +++ /dev/null @@ -1,8780 +0,0 @@ -Foreword -Nock - -Hoon -Preface - -volume 0, version stub - - ++ stub - Declares the current Hoon version number in degrees Kelvin. - - In Kelvin versioning -the true Martian way to permanently freeze a - system- releases count down by integer degrees Kelvin. At absolute - zero, the system can no longer be changed. At 1K, one more - modification is possible. And so on. - --- - ~zod/try=> stub - 164 - --- - -volume 1, Hoon models - - ++ abel - XX biblical - --- - Aliases ++typo. [#typo] - --- - - ++ axis - A Nock axis, an address inside a Nock noun. - --- - Clammed atom [#axil]. - --- - - ++ also - XX unused? - - ++ base - The cases of an %axil tile [#tile]. - --- - See %axil in ++tile. --- - - ++ beer - ++ beet - - ++ bloq - An atom representing a blocksize, by convention expressed as a power of 2. - - Clammed atom [#axil]. - --- - ++met measures how many bloqs long an atom is. It takes a bloq - and an atom. In the below example, the 256 is 2 bloqs of 2^3 long. That - is, it takes two bytes to represent the atom 256 - - ~zod/try=> (met 3 256) - 2 - --- - - ++ calf - - ++ char - A single character. - --- - Atom with odor [#type]. A @tD is a single Unicode byte. - --- - ++tape [#tape], which is a string type, is a list of chars. - --- - - ++ chum - The jet hint information that must be present in the body of a ~/ - or ~% rune. - --- - A %fern of the following cases: - - the jet's name - - the jet's name and the kelvin number - - the jet's vendor, name and kelvin number - - the jet's vendor, name, legacy major.minor version and kelvin number - --- - - ++ claw - XX unused? - - ++ coat - ++ coil - ++ coin - - ++ cord - One of Hoon's two string types (the other being ++tape). A cord is an - atom of UTF-8 text. - --- - Atom with odor. @t is a Unicode atom. The order of bytes in a @t are - little-endian, i.e. the first character in the text is the low byte of - the atom. - --- - ~zod/try=> `@ux`'foobar' - 0x7261.626f.6f66 - --- - - ++ date - A point in time. - --- - A loobean designating AD or BC, a year atom, a month atom, and a ++tarp - , which is a day atom and a time. - --- - ++yell produces a ++date from a @da (a date atom) - - ~zod/try=> (yell ~2014.6.6..21.09.15..0a16) - [d=106.751.991.820.172 h=21 m=9 s=15 f=~[0xa16]] - --- - - ++ dime - ++ dram - The structure of a unix filesystem tree. - --- - One of two cases: - | a directory - a map of names to deeper tree structures. - % a file - a numbered atom of data. - --- - Cards %dire and %pour in zuse require a ++dram argument to target. - --- - ++ each - ++ edge - ++ foot - ++ gear - ++ hair - ++ hapt - ++ like - ++ limb - ++ line - ++ list - ++ mane - ++ mano - ++ manx - ++ marl - ++ mars - ++ mart - ++ marx - ++ metl - ++ null - ++ odor - ++ tarp - ++ time - ++ tree - ++ nail - ++ numb - ++ pair - ++ pass - ++ path - ++ pint - ++ port - ++ post - ++ prop - ++ qual - ++ rege - ++ ring - ++ rule - ++ span - A restricted text atom for canonical atom syntaxes. The prefix is `~.`. - There are no escape sequences except `~~`, which means `~`, and `~-`, - which means `_`. - and . encode themselves. No other characters - besides numbers and lowercase letters are permitted. - --- - ~zod/try=> `@t`~.foo - 'foo' - --- - ~zod/try=> `@t`~.foo.bar - 'foo.bar' - --- - ~zod/try=> `@t`~.foo~~bar - 'foo~bar' - --- - ~zod/try=> `@t`~.foo~-bar - 'foo_bar' - --- - ~zod/try=> `@t`~.foo-bar - 'foo-bar' - --- - ++ spot - ++ tank - ++ tape - One of Hoon's two string types (the other being ++cord). A tape is a - list of chars. - --- - ~zod/try=> `(list ,char)`"foobar" - "foobar" - --- - ~zod/try=> `(list ,@)`"foobar" - ~[102 111 111 98 97 114] - --- - ++ term - A restricted text atom for Hoon constants. The only characters - permitted are lowercase ASCII, - except as the first or last character, - and 0-9 except as the first character. - - The syntax for @tas is the text itself, always preceded by %. This - means a term is always cubical. You can cast it to @tas if you like, - but we just about always want the cube: - --- - ~zod/try=> %dead-fish9 - %dead-fish9 - --- - ~zod/try=> -:!>(%dead-fish9) - [%cube p=271.101.667.197.767.630.546.276 q=[%atom p=%tas]] - --- - The empty @tas has a special syntax, $: - - ~zod/try=> %$ - %$ - --- - A term without % is not a constant, but a name: - - ~zod/try=> dead-fish9 - ! -find-limb.dead-fish9 - ! find-none - ! exit - --- - - ++ tiki - - ++ tile - - A tile is a convenient way of making a well-typed noun. It can be - reduced in four ways - cryptically called bunt, clam, - fish, and whip. each tile corresponds to a well-defined - type, called its icon. A tile is converted statically into a twig, - which in turn may (depending on the conversion) produce the icon, test - for it, etc. And always, the icon is some function of the tile and its - subject. - --- - There are nine cases within ++tile: - - [p=tile q=tile] - - Tiles autocons, just like twigs - a cell of tiles is a tile of a - cell. - - (,[@ @] [4 5]) is [4 5], which is the same as [(,@ 4) (,@ 5)], - producing [4 5]. Clearly, (,[@ @] [4 5]) should not be the same as - [(,@ [4 5]) (,@ [4 5])] - which would produce merely [0 0].) - - The irregular wide syntax for tile autocons is the same as the - syntax for twig autocons - eg, [@ @], a cell of atoms. But there is - also a regular tall/wide tuple syntax, with $: (buccol, %bccl). - Thus instead of [@ @] we could write: - - $: @ - @ - == - - [%axil p=base] - - An %axil is a simple built-in mechanism for a few basic icons: an - atom of any odor (@odor, or just @ for the odorless base atom); a - noun (*); a cell of nouns (^); a loobean ?; and null ~. - - [%bark p=term q=tile] - - Wrap a name round a tile. a=* parses as [%bark %a %noun]. - - This is another case where the tile syntax matches the twig syntax, - but only in the irregular form. The twig equivalent of %bark is of - course ^= (kettis, %ktts). But the tile is $= (buctis): - - $= a - * - - Obviously a silly syntactic arrangement. But you can need it if q - is really big. - - [%bush p=tile q=tile] - - A %bush is a tile in which there are two kinds of nouns: cells - whose head is a cell (tile p) and cells whose head is an atom (tile - q). Its default value is the value of q. - - We don't have to look very far to find a %bush - ++tile is one, as - is ++twig and ++nock. The rune is $& (bucpam). See ++tile above - p - is [p=tile q=tile], q is the $%. There is no irregular form. - - What's the use of a %bush? Often in a variety of data structures we - have something like autocons, in which forming a cell of two - instances has an obvious default semantics. - - Sure, we could attach these semantics to an atom, and just use a - %kelp. In twigs, tiles, or nock formulas, we could have an explicit - cons stem of some sort. But it would be a bulky as compared to - autocons. - - [%fern p=[i=tile t=(list tile)]] - - A %fern is a non-empty list of cases; its icon is naturally a - %fork. The programmer is responsible for ensuring that the cases - are actually orthogonal (unlike with the structured forks, %bush, - %kelp and %reed). A good general practice is to use %ferns only - with %leafs. - - For example, a fern that could be %foo or %bar has the irregular - form ?(%foo %bar), or the regular form - - $? %foo - %bar - == - - The default value is the first - in this case, %foo. - - [%kelp p=[i=line t=(list line)]] - - A kelp is the workhorse of tiles - it provides the most common data - structure in any language, the discriminated union. - - In Hoon, the head (which must be a leaf) is called the stem. The - tail (which can be anything) is the bulb. Cases of a kelp are known - inevitably as fronds. - - (Yes. We're aware that "kelp" is not properly a singular noun. In - Hoon - it is properly a singular noun. And that's that. And oddly, - it's not that hard to run out of four-letter plants.) - - $%, buccen, is a tile rune that produces a %kelp. $% takes a list - of lines, which are labelled cases, closed by ==. - - $% p - q - == - [%leaf p=term q=@] - - A %leaf is an atomic constant of value q and odor p. Obviously its - icon is a %cube. - - The syntax for a leaf is the same as the twig syntax, except that % - is never required to generate a cube. For instance, as a twig, 7 - has a type of [%atom %ud]; %7 has a type of [%cube 7 [%atom %ud]]. - But the icon of the leaf 7 is, again, [%cube 7 [%atom %ud]]. - - [%reed p=tile q=tile] - - A %reed is a tile whose icon contains two kinds of nouns: atoms of - tile p and cells of tile q. - - There is no irregular form of %reed. The regular form is: - - $| ~ [@ @] == - - or in wide mode $|(~ [@ @]) - - [%herb p=twig] - - You can write your own tile which is just a gate, accepting a - sample of * and normalizing it as you choose. If you use a twig as - a tile, it's treated as an herb. - - For example, when we define a gate like ++base, as defined above - (remember that when we use a tile as a twig, we get the clam, ie, - the normalizing gate) base is just an arm which produces a gate. - Nothing has any idea that this gate is built from a tile of its - own. - - So when we parse [p=base q=base] as a tile, the parser builds the - noun: - - [[%bark %p %herb %cnzy %base] [%bark %q %herb %cnzy %base]] In - other words, base in p=base is actually a twig, but this twig - happens to produce a normalizing gate generated by clamming a tile. - In time this will come to seem totally straightforward, but don't - be surprised if it confuses you now. - - The important thing to remember about %herb is that the actual twig - we provide will be applied when we whip or clam. Hence, arbitrary - normalization and/or verification procedures may be part of the - herbaceous custom tile. - --- - - ++ toga - ++ trel - ++ tuna - - An XML template tree. - - Leaf %a contains plain-text, %b an empty tag, %c a static list, %d a - dynamic list, %e a full node element containing a twig and a list of - tuna, and %f is a empty node. - - ++ twig TODO: delete Form, normalize indentation - - A twig is an abstract syntax tree or AST, which we produce when we - parse a Hoon expression, file, etc. A twig is a noun that's converted - into a Nock formula, with the assistance of a type which describes the - subject of the formula: - - [subject-type twig] => formula - - But actually this isn't quite right, because Hoon does something called - "type inference." When we have a type that describes the subject for - the formula we're trying to generate, as we generate that formula we - want to also generate a type for the product of that formula on that - subject. So our compiler computes: - - [subject-type twig] => [product-type formula] - - As long as subject-type is a correct description of some subject, you - can take any twig and compile it against subject-type, producing a - formula such that *(subject formula) is a product correctly described - by product-type. - - Actually, this works well enough that in Hoon there is no direct syntax - for defining or declaring a type. There is only a syntax for - constructing twigs. Types are always produced by inference. - --- - - There are 112 cases of ++twig - - [p=twig q=twig] - - A twig can be a pair of twigs. - - [%$ p=axis] - - Refers to a nock axis. - - [%bccb p=tile] - - $_ ("buccab") is a synthetic hoon that produces the bunt (default - value) for p. - - Tall - $_ p - - Wide - $_(p) - - Irregular - _p - - Reduction - See ++open - - [%bccm p=tile] - - $, ("buccom") is a synthetic rune that produces a normalizing gate - (clam) for p. - - Talln - $, p - - Wide - none - - Irregular - ,p - - Reduction - ~(clam al p) - - See ++clam in ++al. - - [%bcpt p=wing q=tile] - - $@ ("bucpat") is a (just barely) natural hoon that whips wing p - into tile q. - - Tall - $@ p - q - - Wide - $@(p q) - - Irregular - p@q - - Reduction - none, natural - - [%bctr p=tile] - - $* ("buctar") is a synthetic rune that produces the bunt (default - value) for p as a compile-time constant. - - Tall - $* p - - Wide - $*(p) - - Reduction - ^~ ~(bunt al p) - - See ++bunt in al. - - [%bczp p=base] - - $! ("buczap") is a synthetic internal rune that produces the bunt - (default value) for [%axil p]. - - Reduction - See ++open - - [%brcb p=tile q=(map term foot)] - - |_ ("barcab") is a synthetic rune that produces a %gold tray with - sample p, arms q. q is an associative array of names and - expressions, each pair of which is called an arm. After any number - of dry (%ash, ++) and/or wet (%elm, +-) arms, the array is - terminated with -- - - Tall - |_ p - ++ p.n.q - q.n.q - -- - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%brcn p=(map term foot)] - - |% ("barcen") is a natural rune that produces a %gold core from an - associative array of names and expressions, each pair of which is - called an arm. After any number of dry (%ash, ++) and/or wet (%elm, - +-) arms, the array is terminated with -- - - Tall - |% - ++ p.n.q - q.n.q - +- p.n.l.q - q.n.l.q - -- - - Wide - none - - Irregular - none - - Reduction - none, natural - - [%brdt p=twig] - - |. ("bardot") is a synthetic rune that produces a dry %gold trap - from twig p. - - Tall - |. p - - Wide - |.(p) - - Irregular - none - - Reduction - See ++open - - [%brfs p=tile q=(map term foot)] - - |/ ("barfas") is a synthetic rune that produces a vulcanized %gold - tray with arms q, sample p. - - Tall - |/ p - +- p.n.q - q.n.q - -- - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%brkt p=twig q=(map term foot)] - - |^ ("barket") is a synthetic rune that produces a %gold book with - arms q, with p as %$, and kicks it. - - Tall - |^ p - ++ p.n.q - q.n.q - -- - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%brhp p=twig] - - |- ("barhep") is a synthetic rune that produces a dry %gold trap - from twig p, and kicks it. - - Tall - |- - p - - Wide - |-(p) - - Irregular - none - - Reduction - See ++open - - [%brls p=tile q=twig] - - |+ ("barlus") is a synthetic rune that produces a dry %iron gate - with arm q, sample p. - - Tall - |+ p - q - - Wide - |+(p q) - - Irregular - none - - Reduction - See ++open - - [%brpt p=tile q=tile r=twig] - - XX not used - - [%brtr p=tile q=twig] - - |* ("bartar") is a synthetic rune that produces a vulcanized wet - gate with arm q, sample p. - - Tall - |* p - q - - Wide - |*(p q) - - Irregular - none - - Reduction - See ++open - - [%brts p=tile q=twig] - - |= ("bartis") is a synthetic hoon that produces a dry %gold gate - with arm q, sample p. - - Tall - |= p - q - - Wide - |=(p q) - - Irregular - none - - Reduction - See ++open - - [%brwt p=twig] - - |? ("barwut") is a synthetic rune that produces a dry %lead trap. - - Tall - |? p - - Wide - |?(p) - - Irregular - none - - Reduction - See ++open - - [%clcb p=twig q=twig] - - :_ ("colcab") is a synthetic rune that produces the cell [q p]. - - Tall - :_ p - q - - Wide - :_(p q) - - Irregular - none - - Reduction - See ++open - - [%clcn p=tusk] - - :% ("colcen") is a synthetic rune that produces a cell [[p ~] ~] - from a list of twigs p, terminated by a == - - Tall - :% i.p - i.t.p - i.t.t.p - == - - Wide - :%(i.p i.t.p i.t.t.p) - - Irregular - %[i.p i.t.p i.t.t.p] - - Reduction - See ++open - - [%clfs p=twig] - - :/ ("colfas") is a synthetic rune that, given a twig p, produces - [%$ [%$ p ~] ~], i.e., [0 [0 p 0] 0]. Used in practice only in - string interpolation. - - Tall - :/ p - - Wide - :/(p) - - Irregular - none - - Reduction - See ++open - - [%clkt p=twig q=twig r=twig s=twig] - - :^ ("colket") is a synthetic rune that produces a cell [p q r s] - from twigs p, q, r, and s. - - Tall - :^ p - q - r - s - - Wide - :^(p q r s) - - Irregular - none - - Reduction - See ++open - - [%clhp p=twig q=twig] - - :- ("colhep") is a synthetic rune that produces the cell [p q] from - twigs p and q. - - Tall - :- p - q - - Wide - :-(p q) - - Irregular - [p q] - - Reduction - See ++open - - [%clls p=twig q=twig r=twig] - - :+ ("collus") is a synthetic rune that produces a cell [p q r] from - twigs p, q, and r. - - Tall - :+ p - q - r - - Wide - :+(p q r) - - Irregular - none - - Reduction - See ++open - - [%clsg p=tusk] - - :~ ("colsig") is a synthetic rune that produces a null-terminated - tuple of a list of twigs p. - - Tall - :~ i.p - i.t.p - i.t.t.p - == - - Wide - :~(i.p i.t.p i.t.t.p) - - Irregular - ~[i.p i.t.p i.t.t.p] - - Reduction - See ++open - - [%cltr p=tusk] - - :* ("coltar") is a synthetic hoon that produces a tuple from p, a - list of twigs. - - Tall - :* i.p - i.t.p - i.t.t.p - == - - Wide - :*(i.p i.t.p i.t.t.p) - - Irregular - [i.p i.t.p i.t.t.p] - - Reduction - See ++open - - [%clzz p=tusk] - - "colzaz" is a synthetic internal rune that promotes its tusk p - within a %clsg or %cltr tusk. - - Not used at present. - - [%cncb p=wing q=tram] - - %_ ("cencab") is a synthetic rune that evaluates the wing p with - the changes specified in tram q, then casts the product back to p. - - Tall - %_ p - p.i.q q.i.q - p.i.t.q q.i.t.q - == - - Wide - %_(p p.i.q q.i.q, p.i.t.q q.i.t.q) - - Irregular - none - - Reduction - See ++open - - [%cncl p=twig q=twig] - - %: ("cencol") is a synthetic rune that pulls %$ from the twig p - with the with its sample set to q. - - Tall - %: p - q - - Wide - %:(p q) - - Irregular - none - - Reduction - See ++open - - [%cndt p=twig q=twig] - - %. ("cendot") is a synthetic rune that slams the gate q with - [%cltr p]. The dual of %cnhp. - - Tall - %. p - q - - Wide - %.(p q) - - Irregular - none - - Reduction - %- q - p - - See ++open - - [%cnhp p=twig q=tusk] - - %- ("cenhep") is a synthetic rune that slams the gate p with - [%cltr q]. - - Tall - %- p - q - - Wide - %-(p q) - - Irregular - (p q) - - Reduction - See ++open - - [%cntr p=wing q=twig r=tram] - - %* is a synthetic rune that pulls the wing p from tray q with changes r. - - Tall - %* p q - p.i.r q.i.r - p.i.t.r q.i.t.r - == - - Wide - %*(p q p.i.r q.i.r, p.i.t.r q.i.t.r) - - Irregular - none - - Reduction - See ++open - - [%cnkt p=twig q=twig r=twig s=twig] - - %^ ("cenket") is a synthetic rune that slams gate p with [%cntr q r s]. - - Tall - %^ p - q - r - s - - Wide - %^(p q r s) - - Irregular - none - - Reduction - See ++open - - [%cnls p=twig q=twig r=twig] - - %+ ("cenlus") is a synthetic rune that slams gate p with [%cntr q r]. - - Tall - %+ p - r - s - - Wide - %+(p q r) - - Irregular - none - - Reduction - See ++open - - [%cnsg p=wing q=twig r=twig] - - %~ ("censig") is a synthetic rune that pulls p from the tray q with its - sample set to r. - - Tall - %~ p - q - r - - Wide - %~(p q r) - - Irregular - ~(p q r) - - Reduction - See ++open - - [%cnts p=wing q=tram] - - %= ("centis") is a natural rune that evaluates p with the changes - specified in q. - - Tall - %= p - p.i.q q.i.q - p.i.t.q q.i.t.q - == - - Wide - %=(p p.i.q q.i.q, p.i.t.q q.i.t.q) - - Irregular - p(p.i.q q.i.q, p.i.t.q q.i.t.q) - - Reduction - See ++open - - [%cnzy p=term] - - "cenzey" is a synthetic internal rune that pulls limb p from the subject. - - Tall/Wide/Irregular - none, internal - - Reduction - See ++open - - [%cnzz p=wing] - - "cenzaz" is a synthetic internal rune that pulls wing p from the subject. - - Form - none, internal - - Reduction - See ++open - - [%dtkt p=twig] - - .^ ("dotket") is a natural rune that generates Nock operator 11, which in - virtual userspace Nock (++mock) loads a file from the global namespace. - - Tall - .^ p - - Wide - .^(p) - - Irregular - ^:type/path - - ^/path - - Reduction - none, natural - - [%dtls p=twig] - - .+ ("dotlus") is a natural rune that generates Nock operator 4, which - increments an atomic operand. - - Tall - .+ p - - Wide - .+(p) - - Irregular - +(p) - - Reduction - none, natural - - [%dtzy p=term q=@] - - "dotzey" is a natural internal rune that produces a non-cubed atomic - constant of odor p and value q. - - Tall/Wide/Irregular - none, internal - - Reduction - none, natural - - [%dtzz p=term q=*] - - "dotzaz" is a natural internal rune that produces a cubed noun constant of - value q and odor p, if q is an atom. - - Tall/Wide/Irregular - none, internal - - Reduction - none, natural - - [%dttr p=twig q=twig] - - .* ("dottar") is a natural rune that calculates the Nock of subject p, - formula q. - - Tall - .* p - q - - Wide - .*(p q) - - Irregular - none - - Reduction - none, natural - - [%dtts p=twig q=twig] - - .= ("dottis") is a natural rune that applies Nock 5 (equals) to determine - if the products of p and q are equivalent. - - Tall - .= p - q - - Wide - .=(p q) - - Irregular - =(p q) - - Reduction - none, natural - - [%dtwt p=twig] - - .? ("dotwut") is a natural hoon that applies Nock 3 to a noun: if the - noun is a cell, it returns the loobean & (true); if the noun is an atom, - it returns the loobean | (false). - - Tall - .? p - - Wide - .?(p) - - Irregular - none - - Reduction - none, natural - - [%hxgl p=tusk] - - #< ("haxgal") is a synthetic rune that slams the assumed gate noah on - [%zpgr %cntr p]. See the Biblical names. - - Tall/Wide - none - - Irregular - >i.p i.t.p i.t.t.p< - - Reduction - See ++open - - [%hxgr p=tusk] - - #> ("haxgar") is a synthetic rune that slams the assumed gate cain on - [%zpgr %cntr p]. See the Biblical names. - - Tall/Wide - none - - Irregular - - - Reduction - See ++open - - [%ktbr p=twig] - - ^| ("ketbar") is a natural rune that converts a %gold core into an %iron - core. See geometric polymorphism. - - Tall - ^| p - - Wide - ^|(p) - - Irregular - none - - Reduction - none, natural - - [%ktdt p=twig q=twig] - - ^. ("ketdot") is a synthetic rune that casts q to the type of (p q). - - Tall - ^. p - q - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%ktls p=twig q=twig] - - ^+ ("ketlus") is a natural rune that casts the product of q to the - type of p, verifying that it contains the type of q. - - Tall - +^ p - q - - Wide - ^+(p q) - - Irregular - none - - Reduction - none, natural - - [%kthp p=tile q=twig] - - ^- ("kethep") is a synthetic rune that casts q to ~(bunt al p), - i.e., the icon of p. - - Tall - ^- p - q - - Wide - ^-(p q) - - Irregular - `p`q - - Reduction - See ++open - - [%ktpm p=twig] - - ^& ("ketpam") is a natural rune that converts a %gold core to %zinc core. - See geometric polymorphism. - - Tall - ^& p - - Wide - ^&(p) - - Irregular - none - - Reduction - none, natural - - [%ktsg p=twig] - - ^~ ("ketsig") is a natural rune that tries to execute p statically at - compile time; if this fails, p remains dynamic. - - Tall - ^~ p - - Wide - ^~(a) - - Irregular - none - - Reduction - none, natural - - [%ktts p=toga q=twig] - - ^= ("kettis") is a natural rune that wraps q in the toga p. The - toga is a powerful naming device that can assign an entire name - tree to a properly typed result. For instance, if foo produces - an unlabeled tuple [x y z], [a b=[c d]]=foo produces - [a=x b=[c=y d=z]]. - - Tall - ^= p - q - - Wide - ^=(p q) - - Irregular - none - - Reduction - none, natural - - [%ktwt p=twig] - - ^? ("ketwut") is a natural hoon that converts a %gold core into a - %lead core. See geometric polymorphism. - - Tall - ^? p - - Wide - ^?(p) - - Irregular - none - - Reduction - none, natural - - [%sgbr p=twig q=twig] - - ~| ("sigbar") is a synthetic rune that presents the product of p - in the stack trace if q crashes. Only performed as needed. - Generates %cain - see the Biblical names. - - Tall - ~| p - q - - Wide - ~|(p q) - - Irregular - none - - Reduction - See ++open, ++feck - - [%sgcb p=twig q=twig] - - ~_ ("sigcab") is a synthetic rune that inserts p, a trap producing a tank, - into the trace of q. - - Tall - ~_ p - q - - Wide - ~_(p q) - - Irregular - none - - Reduction - See ++open - - [%sgcn p=chum q=twig r=tyre s=twig] - - ~% ("sigcen") is a synthetic rune that identifies a core for specific - optimization. See jet propulsion. - - Tall - ~% p - q - == - p.i.r q.i.r - p.i.t.r q.i.t.r - == - s - - ~% p - q - ~ - s - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%sgfs p=chum q=twig] - - ~/ ("sigfas") is a synthetic rune that identifies an arm for specific - optimization. See jet propulsion. - - Tall - ~/ p - q - - Wide - ~/(p q) - - Irregular - none - - Reduction - See ++open - - [%sggl p=$|(term [p=term q=twig]) q=twig] - - ~< ("siggal") is a synthetic rune that applies arbitrary hint p to - the product of q. Does not wake the hint engine until the - computation is finished. - - Tall - ~< p - q - - Wide - ~<(p q) - - Irregular - none - - Reduction - See ++open - - [%sggr p=$|(term [p=term q=twig]) q=twig] - - ~> ("siggar") is a natural rune that applies arbitrary hint p to q. - - Tall - ~> p - q - - Wide - ~>(p q) - - Irregular - none - - Reduction - See ++open - - [%sgbc p=term q=twig] - - ~$ ("sigbuc") is a synthetic rune that labels computation q as p - for profiling (not currently enabled). - - Tall - ~$ p - q - - Wide - ~$(p q) - - Irregular - none - - Reduction - See ++open - - [%sgls p=@ q=twig] - -XX Solve ~+ ("siglus") is a synthetic rune that memoizes computation q - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%sgpm p=@ud q=twig r=twig] - - ~& ("sigpam") is a synthetic rune that prints q on the console - before computing r. p is the log priority 0-3, defaulting to 0. - - Tall - 0, debug - ~& q - r - - 1, notice - ~& > q - r - - 2, warning - ~& >> q - r - - 3, alarm - ~& >>> q - r - - Wide - ~&(>>> q r) - - Irregular - none - - Reduction - See ++open - - [%sgts p=twig q=twig] - - ~= ("sigtis") is a synthetic rune that hints to the interpreter - that q may produce a noun equal to the already existing p, - avoiding duplication. - - Tall - ~= p - q - - Wide - ~=(p q) - - Irregular - none - - Reduction - See ++open - - [%sgwt p=@ud q=twig r=twig s=twig] - - ~? ("sigwut") is a synthetic rune that prints r to the console - before computing s, iff q produces yes. p is the log priority, - 0-3, 0 by default - - Tall - 0, debug - ~? q - r - s - - 1, notice - ~? > q - r - s - - 2, warning - ~? >> q - r - s - - 3, alarm - ~? >>> q - r - s - - Wide - ~?(>>> q r s) - - Irregular - none - - Reduction - See ++open - - [%sgzp p=twig q=twig] - - ~! ("sigzap") is a natural rune for debugging uses only, - semantically equivalent to its own twig q. Should compilation - fail within q, ~! will show the type of p on the stacktrace. - - Tall - ~! p - q - - Wide - ~!(p q) - - Irregular - none - - Reduction - none, natural - - [%smcl p=twig q=tusk] - - ;: ("semcol") is a synthetic gate that applies p, a binary gate, - to the n-ary tuple q. - - Tall - ;: p - i.q - i.t.q - i.t.t.q - == - - Wide - ;:(p i.q i.t.q i.t.t.q) - - Irregular - :(p i.q i.t.q i.t.t.q) - - Reduction - See ++open - - [%smdt p=twig q=tusk] -XX determine function - - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%smdq p=(list beer)] -XX determine if internal/external - - ;" ("semdoq") is a synthetic rune used to make strings, - interpolated or not. - - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%smsg p=twig q=tusk] - -XX to do - - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%smsm p=twig q=twig] - - ;; ("semsem") is a synthetic rune that types q as a fixpoint of p. - Semantically identical to ((hard p) q). - - Tall - ;; p - q - - Wide - ;;(p q) - - Irregular - none - - Reduction - See ++open - - [%tsbr p=tile q=twig] - - =| ("tisbar") is a synthetic rune that pushes ~(bunt al p) on the - subject and sends it to q. - - Tall - =| p - q - - Wide - =|(p q) - - Irregular - none - - Reduction - =+(_p q) - See ++open, ++bunt in ++al - - [%tscl p=tram q=twig] - - =: ("tiscol") is a synthetic rune that produces q with the subject - by p. Uses %cncb, and so cannot change the subject type. - - Tall - =: p.i.p q.i.p - p.i.t.p q.i.t.p - p.i.t.t.p q.i.t.t.p - == - q - - Wide - none - - Irregular - noen - - Reduction - See ++open - - [%tscn p=twig q=twig] -XX to do - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%tsdt p=wing q=twig r=twig] - - =. ("tisdot") is a synthetic rune that produces r with p in the - subject set to q. Uses %cncb, and so cannot change the subject - p. - - Tall - =. p - q - r - - =. p q - r - - Wide - =.(p q r) - - Irregular - none - - Reduction - See ++open - - [%tsfs p=twig q=twig] - XX not used - - [%tsgl p=twig q=twig] - - =< ("tisgal") is a synthetic rune that uses the product of q as - the subject of p. - - Tall - =< p - q - - Wide - =<(p q) - - Irregular - - Reduction - See ++open - - [%tshp p=twig q=twig] - - =- ("tishep") is a synthetic rune that pushes q on the subject - and sends it to p. Dual of =+ ("tislup") - - - Tall - =- p - q - - Wide - =- - - Irregular - none - - Reduction - See ++open - - [%tsgr p=twig q=twig] - - => ("tisgar") is a natural rune that uses the product of p as the - subject of q. - - Tall - => p - q - - Wide - =>(p q) - - Irregular - none - - Reduction - none, natural - - [%tskt p=twig q=twig r=twig s=twig] - - =^ ("tisket") is a synthetic rune that handles a product which is - a cell of the new result, and a mutation to the subject. - - Tall - Kingside - =^ p - q - r - s - - Queenside - =^ p q - r - s - - Wide - =^(p q r s) - - Irregular - none - - Reduction - See ++open - - [%tsls p=twig q=twig] - - =+ ("tislus") is a synthetic rune that pushes p on the subject - and sends it to q. Semantically equavlent to Nock 8.Dual of =- ("tishep") - - Tall - =+ p - q - - Wide - =+(p q) - - Irregular - none - - Reduction - See ++open - - [%tspm p=tile q=twig] - - XX not used - - [%tspt p=tile q=twig] - - XX not used - - [%tstr p=term q=wing r=twig] - - =* ("tistar") is a natural rune that creates a %bull, or alias, - type. - - Tall - =* p q - r - - Wide - =*(p q r) - - Irregular - none - - Reduction - none, natural - - [%tssg p=tusk] - - =~ ("tissig") is a synthetic rune that composes a list of twigs. - - Tall - Kingside - =~ i.p - i.t.p - i.t.t.p - == - - Queenside - =~ i.p - i.t.p - i.t.t.p - == - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%wtbr p=tusk] - - ?| ("wutbar") is a synthetic rune that computes the "or" of the - loobeans in p. - - Tall - ?| i.p - i.t.p - i.t.t.p - == - - Wide - ?|(i.p i.t.p i.t.t.p) - - Irregular - |(i.p i.t.p i.t.t.p) - - Reduction - See ++open - - [%wthp p=wing q=tine] - - ?- ("wuthep") is a synthetic rune that selects a case in q for - the actual type of p. - - Tall - Kingside - ?- p - p.i.q q.i.q - p.i.t.q q.i.t.q - p.i.t.t.q q.i.t.t.q - == - - Queenside - ?- p - p.i.q - q.i.q - p.i.t.q - q.i.t.q - p.i.t.t.q - q.i.t.t.q - == - - Wide - ?-(p p.i.q q.i.q, p.i.t.q q.i.t.q, p.i.t.t.q q.i.t.t.q) - - Irregular - none - - Reduction - See ++open - - [%wthz p=tiki q=tine] - - "wuthaz" is a synthetic internal rune that selects a case in q - for the actual type of p. - - Tall/Wide/Irregular - none, internal - - Reduction - See ++open - - [%wtcl p=twig q=twig r=twig] - - ?: ("wutcol") is a natural rune that produces q if p is yes (&, 0), - or r if p is no (|, 1). - - Tall - ?: p - q - r - - Wide - ?:(p q r) - - Irregular - none - - Reduction - none, natural - - [%wtdt p=twig q=twig r=twig] - - ?. ("wutdot") is a synthetic rune that prduces r if p is yes - (&, 0), of q if p is no (|, 1). - - Tall - ?. p - q - r - - Wide - ?:(p q r) - - Irregular - none - - Reduction - none, natural - - [%wtkt p=wing q=twig r=twig] - - ?^ ("wutkey") is a synthetic rune that evaluates r if p is - equivalent to the bunt for its tile, otherwise q is evaluted. - - Tall - ?^ p - q - r - - Wide - ?^(p q r) - - Irregular - none - - Reduction - See ++open - - [%wtkz p=tiki q=twig r=twig] - - "wutkaz" is a synthetic, internal rune that evaluates r if p is - equivalent to the bunt for its tile, otherwise q is evaluated. - See tikis. - - Tall - ?^ p - q - r - - Wide - ?^(p q r) - - Irregular - none - - Reduction - See ++open - - [%wtgl p=twig q=twig] - - ?< ("wutgal") is a synthetic hoon that produces q, asserting that - p is no (|, 1). - - Tall - ?< p - q - - Wide - ?<(p q) - - Irregular - none - - Reduction - See ++open - - [%wtgr p=twig q=twig] - - ?> ("wutgar") is a synthetic hoon that produces q, asserting that - p is yes (&, 0). - - Tall - ?> p - q - - Wide - ?>(p q) - - Irregular - none - - Reduction - See ++open - - [%wtls p=wing q=twig r=tine] - - ?+ ("wutlus") is a synthetic rune that selects a case in q for - the actual type of p. - - Tall - Kingside - ?+ p - q - p.i.r q.i.r - p.i.t.r q.i.t.r - p.i.t.t.r q.i.t.t.r - == - - Queenside - ?+ p - q - p.i.r - q.i.r - p.i.t.r - q.i.t.r - p.i.t.t.r - q.i.t.t.r - == - - Wide - ?+(p p.i.r q.i.r, p.i.t.r q.i.t.r, p.i.t.t.r q.i.t.t.r) - - Irregular - none - - Reduction - See ++open - - [%wtlz p=tiki q=twig r=tine] - - "wutlaz" is a synthetic, internal rune that selects a case in q for - the actual type of p. - - Tall/Wide/Irregular - none, internal - - Reduction - See ++open - - [%wtpm p=tusk] - - ?& ("wutpam") is a synthetic hoon that computes the "and" of the - loobeans in p. - - Tall - ?& i.p - i.t.p - i.t.t.p - == - - Wide - ?&(i.p i.t.p i.t.t.p) - - Irregular - none - - Reduction - See ++open - - [%wtpt p=wing q=twig r=twig] - - ?@ ("wutpat") is a synthetic hoon that produces q if p is an - atom, r otherwise. - - Tall - Kingside - ?@ p - q - r - - Queenside - ?@ p - q - r - - Wide - ?@(p q r) - - Irregular - none - - Reduction - See ++open - - [%wtpz p=tiki q=twig r=twig] - - "wutpaz" is a synthetic hoon that produces q if p is an atom, r - otherwise. - - Tall - ?@ p - q - r - - Wide - ?@(p q r) - - Irregular - none - - Reduction - See ++open - - [%wtsg p=wing q=twig r=twig] - - ?~ ("wutsig") is a synthetic rune that produces q if p is ~, r - otherwise. - - Tall - ?~ p - q - r - - Wide - ?~(p q r) - - Irregular - none - - Reduction - See ++open - - [%wtsz p=tiki q=twig r=twig] - - "wutsaz" is a synthetic internal rune that produces q if p is ~, - r otherwise. - - Tall/Wide/Irregular - none, internal - - Reduction - See ++open - - [%wtts p=tile q=wing] - - ?= ("wuttis") is a natural rune that produces true if the leg at - wing q is in tile p. - - Tall - ?= p - q - - Wide - ?=(p q) - - Irregular - none - - Reduction - none, natural - - [%wtzp p=twig] - - ?! ("wutzap") is a synthetic rune that produces the logical "not" - of p. - - Tall - ?! p - - Wide - ?!(p) - - Irregular - !p - - Reduction - See ++open - - [%zpcb p=spot q=twig] -XX tall/wide form - !_ ("zapcab") is a natural rune that puts debugging information - in the stack trace. - - Tall - - Wide - - Irregular - none - - Reduction - none, natural - - [%zpcm p=twig q=twig] - - !, ("zapcom") is a natural rune that inserts twig q as a - constant, typed with the type of twig p. - - Tall - !, p - q - - Wide - !,(p q) - - Irregular - none - - Reduction - none, natural - - [%zpcn ~] -XX determine function - !% ("zapcen") - - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%zpfs p=twig] -XX tall/wide - !/ ("zapfas") is a natural rune that should never be compiled. - When compiled with error checking turned on, it reports its - subject as an error. - - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%zpgr p=twig] - - !> ("zapgar") is a synthetic rune that produces a vase (a - [type noun] cell) with the value p. - - Tall - !> p - - Wide - !>(p) - - Irregular - none - - Reduction - See ++open - - [%zpsm p=twig q=twig] - - !; ("zapsem") is a natural rune that produces the product of twig - q as a [type noun] pair, with twig p defining the type of the type. - - Tall - !; p - q - - Wide - !;(p q) - - Irregular - none - - Reduction - none, natural - - [%zpts p=twig] - - != ("zaptis") is a natural rune that produces the formula of twig - p as a noun. - - Tall - != p - - Wide - !=(p) - - Irregular - none - - Reduction - none, natural - - [%zpwt p=$|(p=@ [p=@ q=@]) q=twig] - - !? ("zapwut") is a synthetic rune that enforces a Hoon version - restriction. - - Tall - !? p - q - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%zpzp ~] - - !! ("zapzap") is a natural rune that always causes a crash when - executed. - - Tall - none - - Wide - !! - - Irregular - none - - Reduction - none, natural - - ++ tine - ++ tusk - ++ tyre - ++ tyke - ++ tram - ++ tone - ++ nock - ++ toon - ++ tune - ++ twin - ++ type - - A type is a noun that: - - One, it defines a set of nouns. Any finite noun is either in this set, or - not in it. - - Two, it ascribes semantics to all nouns in this set. For example, a Hoon - type exports a semantic namespace. - - A lot of other languages use dynamic types, in which the type of a - value is carried along with the data as you use it. Even languages like - Lisp, which are nominally typeless, look rather typed from the Hoon - perspective. For example, a Lisp atom knows dynamically whether it's a - symbol or an integer. A Hoon atom is just a Nock atom, which is just a - number. So without a static type, Hoon doesn't even know how to print - an atom properly. - --- - - There are 9 cases of ++type: - - ?(%noun %void) - - Either %noun or %void. %noun is the set of all nouns. %void is the - set of no nouns. - - ~zod/try=> :type; * - 0 - * - - ~zod/try=> -:!>(*) - %noun - - ~zod/try=> :type; `*`%noun - 1.853.189.998 - * - - ~zod/try=> -:!>(`*`%noun) - %noun - - We can't show any examples producing %void - by definition, none of - them would terminate. Because that's what %void means. All other - cases in ++type are subsets of %noun. - - [%atom p=term] - - An atom is a natural number, with a term (known as an - odor) that specificies an atomic subtype. - - An odor is an ASCII span. This span is a taxonomy which - grows more specific to the right. For instance, @t - for UTF-8 text, @ta for URL-safe ASCII text, @tas for - a Hoon symbol; or @u for an unsigned integer, @ux for - an unsigned integer formatted as hexadecimal. - - Hoon knows about the following odors, with defined meanings: - - @c UTF-32 codepoint - @d date - @da absolute date - @dr relative date (ie, timespan) - @f yes or no (inverse boolean) - @n nil - @p phonemic base - @r IEEE floating-point - @rd double precision (64 bits) - @rh half precision (16 bits) - @rq quad precision (128 bits) - @rs single precision (32 bits) - @s signed integer, sign bit low - @sb signed binary - @sd signed decimal - @sv signed base32 - @sw signed base64 - @sx signed hexadecimal - @t UTF-8 text (cord) - @ta ASCII text (span) - @tas ASCII symbol (term) - @u unsigned integer - @ub unsigned binary - @ud unsigned decimal - @uv unsigned base32 - @uw unsigned base64 - @ux unsigned hexadecimal - - Atoms change freely either up or down the taxonomy, - but not across. You can treat a @tas as - a @t, as in a strong type system; but you can also - treat a @t as a @tas, or an @ as anything. However, - passing a @t to a function that expects an @ux is a - type error. - - Each of these forms has a URL-safe syntax. Each - parses as an atomic constant in Hoon, and each is - printed by the Hoon prettyprinter. - --- - - ~zod/try=> :type; 0x42 - 0x42 - @ux - - ~zod/try=> `@ud`0x42 - 66 - - ~zod/try=> :type; 'foo' - 'foo' - @ta - - ~zod/try=> `@ud`'foo' - 7.303.014 - - ~zod/try=> :type; ~2013.12.6 - ~2013.12.6 - @da - - ~zod/try=> `@ud`~2013.12.6 - 170.141.184.500.724.667.905.957.736.036.171.776.000 - - ~zod/try=> `@ud`.127.0.0.1 - 2.130.706.433 - - ~zod/try=> :type; .127.0.0.1 - .127.0.0.1 - @if - - ~zod/try=> :type; ~m45 - ~m45 - @dr - - ~zod/try=> `@ud`~m45 - 49.806.208.999.015.789.363.200 - - ~zod/try=> :type; `@da`(add ~2013.12.6 ~m45) - ~2013.12.6..00.45.00 - @da - - --- - The variety of units and formats which an atom can - represent is essentially infinite. The set of - syntaxes which Hoon can parse and print is - fundamentally limited. - - For instance, Hoon has no syntax which means "number - of miles." But within your program, nothing stops you - from using the odor system to distinguish a number of - miles from, for instance, a number of kilometers: - - ~zod/try=> `@udm`25.717 - 25.717 - ~zod/try=> `@udk`25.717 - 25.717 - - The printer has no idea what a @udm is, but it knows - what a @ud is and can print accordingly. Then, if you - have a function which expects a @udm and you try to - pass it a @udk, it will fail. - --- - - Besides these prefixes, which indicate the rendering - and/or meaning of atoms, the odor system has another - orthogonal mechanism to restrict the size of atoms. - Like the prefix, this mechanism is weak - it is not - enforced and trivially evaded. - - An odor span contains two parts, both optional: a - lowercase prefix and an uppercase suffix. The suffix, - if present, is a single character A-Z c which - indicates an atom of size less than or equal to n - bits, where n is 1 << (c - 'A'). Thus, @tD is one - UTF-8 byte (whatever that means); @tN is a kilobyte - or less of UTF-8. - - When enforcing conversions, @t has no size - information and can be used as @tD; and @tD, of - course, can be used as @t. But using @tN as @tD is an - error. There is no way to generate the smell of size - from a constant without a cast. And of course - arithmetic results have no odor at all. - - A full table for convenience: - - A 1 bit - B 2 bits - C 4 bits - D 1 byte - E 2 bytes - F 4 bytes - G 8 bytes - H 16 bytes - I 32 bytes - J 64 bytes - K 128 bytes - L 256 bytes - M 512 bytes - N 1K - O 2K - P 4K - Q 8K - R 16K - S 32K - T 64K - U 128K - V 256K - W 512K - X 1MB - Y 2MB - Z 4MB - - You of course can build an atom larger than 4MB, but - the type system cannot express a size odor above 4MB. - - - [%bull p=twin q=type] - - [%cell p=type q=type] - - A pair of types. Set: all cells of p and q. - - ~zod/try=> :type; [3 4] - [3 4] - [@ud @ud] - - ~zod/try=> -:!>([3 4]) - - ~zod/try=> :type; [3 4] - [3 4] - [@ud @ud] - - ~zod/try=> -:!>([3 4]) - [%cell p=[%atom p=%ud] q=[%atom p=%ud]] - - [%core p=type q=coil] - - [%cube p=* q=type] - - When we enter an ordinary constant, like 42, its type [%atom %ud] - is the set of all atoms (with odor @ud, but any atom can have that - or any odor). Its type is certainly not the set consisting - exclusively of the value 42. - - But here's how we produce this "cubical" constant: - - ~zod/try=> :type; %42 - %42 - %42 - - ~zod/try=> -:!>(%42) - [%cube p=42 q=[%atom p=%ud]] - - In general, a %cube type contains p, a single noun, and q, a base - type which provides semantics. - - Syntactically, any atomic constant can be preceded by % to generate - a cube. The exception is @tas, which always needs % and is always - cubical. - - [%face p=term q=type] - - A type is not just a set of nouns - it's also a meaning which makes - sense of any noun in that set. The typed noun exports a namespace - - give it a name, and it gives you another noun. - - ~zod/try=> foo=42 - foo=42 - ~zod/try=> :type; foo=42 - foo=42 - foo=@ud - ~zod/try=> -:!>(foo=42) - [%face p=%foo q=[%atom p=%ud]] - - With %face, we've simply wrapped a label around another type. Note - that this doesn't impair our ability to compute with the value. - Computationally, foo=42 is just 42: - - ~zod/try=> (add 17 foo=42) - 59 - --- - - [%fork p=type q=type] - - A union type. [%fork p q] means "it could be a p, or maybe a q." - - Any branching computation in which different branches produce - different types will generate a fork. For example: - - ~zod/try=> :type; ?:(& %foo [13 10]) - %foo - { %foo [@ud @ud] } - - ~zod/try=> -:!>(?:(& %foo [13 10])) - [ %fork - p=[%cube p=7.303.014 q=[%atom p=%tas]] - q=[%cell p=[%atom p=%ud] q=[%atom p=%ud]] - ] - - Here we start to understand why the type renderer is useful, as - { %foo [@ud @ud] } (which is not in any way Hoon syntax) is a - little easier to read than the actual type noun. - - (Readers of a mathematical bent may ask: since Hoon has a union - type, where is the intersection type? There is none. Hoon is not - one of these languages whose goal is to be as mathematically - powerful as possible. Since a programming language is a UI for - programmers, and programmers are not mathematicians, Hoon is - designed to be as powerful as it has to be - and no more.) - - [%hold p=(list ,[p=type q=twig])] - - ++ typo - ++ udal - ++ udon - ++ umph - ++ unce - ++ unit - ++ upas - ++ urge - ++ vase - ++ vise - ++ wall - ++ wain - ++ wing - ++ wine - ++ woof - ++ wonk - ++ map - ++ qeu - ++ set - ++ jar - ++ jug - -volume 2, Hoon libraries and compiler - - chapter 2a, basic unsigned math - - ++ add - Sum two numbers. - --- - Activate jet. - Build dry %gold gate with sample atoms a and b - Yield atom - If: a is 0 - Then: Produce `b` - Else: Produce the slam of the gate with (dec a) and +(b). - --- - ~palryp-hocsyt/try=> (add 2 2) - 4 - ~palryp-hocsyt/try=> (add 1 1.000.000) - 1.000.001 - ~palryp-hocsyt/try=> (add 1.333 (mul 2 2)) - 1.337 - - ++ cap - Test if an atom is in the head or tail of a noun. - --- - Activate jet. - Build dry %gold gate with sample atom a - Yield either %2 or %3 - Switch on type of a - if %2, produce %2 - if %3, produce %3 - if either %0 or %1, fail - if noun, slam gate with (div a 2) - Terminate switch statement. - --- - ~palryp-hocsyt/try=> (cap 4) - %2 - ~palryp-hocsyt/try=> (cap 6) - %3 - ~palryp-hocsyt/try=> (cap (add 10 9)) - %2 - - ++ dec - Decrement a number - Subtracts one. - --- - Activate jet. - Build dry %gold gate with sample atom a - Error on crash: %decrement-underflow - Deny that a is 0 - Let b be 0 - Kick dry %gold trap that yields atom. - If: a is +(b) - Then: Produce b. - Else, slam trap with +(b) - --- - ~palryp-hocsyt/try=> (dec 7) - 6 - ~palryp-hocsyt/try=> (dec 0) - ! decrement-underflow - ! exit - - ++ div - Divide one number by another. - --- - Activate jet. - Build dry %gold gate with sample atom a, atom b. - Yield atom - Error on crash: 'div' - Deny that b is 0 - Push `c` is 0. - Kick dry %gold trap - If: a is less than b - Then: Produce c. - Else, slam trap with (sub a b) +(c) - --- - ~palryp-hocsyt/try=> (div 4 2) - 2 - ~palryp-hocsyt/try=> (div 17 8) - 2 - ~palryp-hocsyt/try=> (div 20 30) - 0 - - ++ fac - Produce the factorial of a number n, n!. - --- - Activate jet. - Build dry %gold gate with sample atom a and atom b. - Yield atom - If: a is 0 - Then: Produce 1. - Else: slam gate with dec a - and multiply by a - --- - ~palryp-hocsyt/try=> (fac 3) - 6 - ~palryp-hocsyt/try=> (fac 0) - 1 - ~palryp-hocsyt/try=> (fac 11) - 39.916.800 - - ++ gte - Is the first greater than or equal to the second? - --- - Activate jet. - Build dry %gold gate with sample atom a and atom b - Yield bean - a is NOT less-than b - --- - ~palryp-hocsyt/try=> (gte 100 10) - %.y - ~palryp-hocsyt/try=> (gte 4 4) - %.y - ~palryp-hocsyt/try=> (gte 3 4) - %.n - - ++ gth - Is the first greater than the second? - --- - Activate jet. - Build dry %gold gate with sample atom a and atom b - Yield bean. - a is NOT less-equal b - --- - ~ronrem-lonsem/try=> (gth 4 5) - %.n - ~ronrem-lonsem/try=> (gth 5 4) - %.y - ~ronrem-lonsem/try=> (gth 5 5) - %.n - ~ronrem-lonsem/try=> (gth 0 0) - %.n - ++ lte - Is the first less than or equal to the second? - --- - Activate jet - Build dry %gold gate with sample atom a and atom b - Yield bean - a is b OR a is less-than b - --- - ~ronrem-lonsem/try=> (lte 4 5) - %.y - ~ronrem-lonsem/try=> (lte 5 4) - %.n - ~ronrem-lonsem/try=> (lte 5 5) - %.y - ~ronrem-lonsem/try=> (lte 0 0) - %.y - ++ lth - Is the first less than the second? - --- - Activate jet - Build dry %gold gate with a sample atom a and atom b - Yield bean - Use logical AND, and produce %.n if a is b. - Kick a dry %gold trap - produce %.y if a is 0 - produce %.n if a is NOT 0 AND b=0. - Else, toss a for (dec a), and b for (dec b) - --- - ~ronrem-lonsem/try=> (lth 4 5) - %.y - ~ronrem-lonsem/try=> (lth 5 4) - %.n - ~ronrem-lonsem/try=> (lth 5 5) - %.n - ~ronrem-lonsem/try=> (lth 5 0) - %.n - ++ mas - Produce the axis of a within the head or the tail. - --- - Activate jet - Build dry %gold gate with sample atom a - Yield atom. - Switch on a: - if 1, fail - if 2, produce 1 - if 3, produce 1 - Else, add a modulo 2 to 2 times the toss of a for (div a 2) - --- - 1 ~ronrem-lonsem/try=> (mas 3) - 1 - ~ronrem-lonsem/try=> (mas 4) - 2 - ~ronrem-lonsem/try=> (mas 5) - 3 - ~ronrem-lonsem/try=> (mas 6) - 2 - ~ronrem-lonsem/try=> (mas 7) - 3 - ~ronrem-lonsem/try=> (mas 8) - 4 - ~ronrem-lonsem/try=> (mas 0) - ! exit - ~ronrem-lonsem/try=> (mas 1) - ! exit - - ++ max - Produce the larger of two atoms. - --- - Activate jet - Build dry %gold gate with sample atom a and atom b - Yield atom - If: a is greater than b - Then: produce a - Else: produce b - --- - ~palryp-hocsyt/try=> (max 10 100) - 100 - ~palryp-hocsyt/try=> (max 10.443 9) - 10.443 - ~palryp-hocsyt/try=> (max 0 1) - 1 - - ++ min - Produce the smaller of two atoms. - --- - Activate jet - Build dry %gold gate with sample atom a and atom b - Yield atom. - If: a is less than b - Then: produce a - Else: produce b - --- - ~palryp-hocsyt/try=> (min 10 100) - 10 - ~palryp-hocsyt/try=> (min 10.443 9) - 9 - ~palryp-hocsyt/try=> (min 0 1) - 0 - - ++ mod - Produce a modulo b - --- - Activate jet - Build dry %gold gate with sample atom a and atom b - Yield atom - Deny that b is 0 - Subtract from a the product of b and a divided by b - --- - - ++ mul - Multiply two numbers - --- - Activate jet - Build dry %gold gate with sample atom a and atom b - Yield atom - Push 'c' is 0 - Kick a dry %gold trap. - If: a is 0 - Then: produce c. - Else: toss a for (dec a) and c for (add b c - Examples: - - ++ peg - Produces the axis of b within the axis of a. - --- - Activate jet - Build dry %gold gate with sample atom a and atom b - Yield atom - Switch on b - if 1, produce a - if 2, produce (mul a 2) - if 3, produce +((mul a 2)) - else, add (mod b 2) to 2 times the toss of b for (div b 2) - --- - ~ronrem-lonsem/try=> (mul 5 3) - 15 - --- - ~ronrem-lonsem/try=> (mul 1 0) - 0 - - ++ sub - Subtract two numbers - --- - Activate jet - Build dry %gold gate with sample atom a and atom b - Error on crash "%subtract-underflow" - Yield atom - If: b is 0 - Then: produce a. - Else: toss a for (dec a) and b for (dec b) - --- - ~ronrem-lonsem/try=> (sub 10 5) - 5 - --- - ~ronrem-lonsem/try=> (sub 243 44) - 199 - --- - ~ronrem-lonsem/try=> (sub 5 0) - 5 - --- - ~ronrem-lonsem/try=> (sub 0 5) - ! subtract-underflow - ! exit - -chapter 2b, basic containers - -Section 2bA, units - - ++ biff - Apply a function which yields a unit to the value of a unit - --- - Build wet gate with a sample unit a and tiled gate b - If: a is null - Then: produce null - Else: slam b with u.a. - --- - ~palryp-hocsyt/try=> (biff (some 5) |=(a=@ (some (add a 2)))) - [~ u=7] - --- - ~palryp-hocsyt/try=> (biff ~ |=(a=@ (some (add a 2)))) - ~ - ++ bind - Apply a function to the value of a unit. - --- - Build wet %gold gate with sample unit a and gate b - If: a is null - Then: produce null - Else, the unit of the slam of 'b' with u.a. - --- - ~talsur-todres/try=> (bind ((unit ,@) [~ 97]) ,@t) - [~ `a`] - --- - ~talsur-todres/try=> =a |=(a=@ (add a 1)) - ~talsur-todres/try=> (bind ((unit ,@) [~ 2]) a) - [~ 3] - - ++ clap - Apply a binary operation which yields a unit to the values of two units - --- - Build wet %gold gate with a sample unit a, unit b and gate c - If: a is null - Then: produce b - Else: If: b is null - Then: produce a - Else: the unit of the slam of c with [u.a u.b] - --- - ~palryp-hocsyt/try=> =u ((unit ,@t) [~ 'a']) - ~palryp-hocsyt/try=> =v ((unit ,@t) [~ 'b']) - ~palryp-hocsyt/try=> (clap u v |=([a=@t b=@t] (welp (trip a) (trip b)))) - [~ u="ab"] - --- - ~talsur-todres/try=> =a ((unit ,@u) [~ 1]) - ~talsur-todres/try=> =b ((unit ,@u) [~ 2]) - ~talsur-todres/try=> =c |=([a=@ b=@] (add a b)) - ~talsur-todres/try=> (clap a b c) - [~ 3] - - ++ drop - Produce a list of the unit-value - --- - Build wet %gold gate with sample unit a - If: a is null - Then: produce null - Else, produce the list [u.a ~] - --- - ~divreg-misdef/try=> =a ((unit ,@) [~ 97]) - ~divreg-misdef/try=> (drop a) - [i=97 t=~] - --- - ~divreg-misdef/try=> =a ((unit ,@) [~]) - ~divreg-misdef/try=> (drop a) - ~ - - ++ fall - A default value 'b' for the unit 'a' when 'a' is null - --- - Build wet %gold gate with sample unit a and noun b - If: a is null - Then: produce b - Else: produce the unit-value of a - --- - ~talsur-todres/try=> (fall ~ `a`) - `a` - --- - ~talsur-todres/try=> (fall [~ u=0] `a`) - 0 -++ mate - Produce the unit 'a' or 'b' which is not null and crashes with error "mate" if they are equal. - --- - Creates a wet %gold gate with a sample which accepts a two units. - Builds an if-then-else statement on "b is null." - If so, produce a. - Else, build an if-then-else statement on "a is null." - If so, produce b. - Else, build an if-else-then statement on u.a=u.b. Crash on "mate" if false, produce a if true. - Examples: - ~divreg-misdef/try=> =a ((unit ,@) [~ 97]) - ~divreg-misdef/try=> =b ((unit ,@) [~ 97]) - ~divreg-misdef/try=> (mate a b) - [~ 97] - --- - ~divreg-misdef/try=> =a ((unit ,@) [~ 97]) - ~divreg-misdef/try=> =b ((unit ,@) [~]) - ~divreg-misdef/try=> (mate a b) - [~ 97] - --- - ~divreg-misdef/try=> =a ((unit ,@) [~ 97]) - ~divreg-misdef/try=> =b ((unit ,@) [~ 98]) - ~divreg-misdef/try=> (mate a b) - ! 'mate' - ! exit -++ need - Retrieve the value from a unit, crashing if the unit is null. - --- - Build wet %gold gate with sample unit a of any type. - If: p is null, - Then: fail, - Else: u.a, the value of the unit. - --- - ~divreg-misdef/try=> =a ((unit ,[@t @t]) [~ [`a` ' b']]) - ~divreg-misdef/try=> (need a) - [`a` ' b'] - ~divreg-misdef/try=> =a ((unit ,@) [~]) - ~divreg-misdef/try=> (need a) - ! exit -++ some - lift - Description: - Casts any noun a to its unit, [~ a]. - --- - Creates a wet %gold gate with a sample which accepts any noun. - Produces the tuple [~ u=a], the unit of value a. - Examples: - ~divreg-misdef/try=> (some [`a` `b`]) - [~ u=[`a` `b`]] - --- - ~divreg-misdef/try=> (some &) - [~ u=%.y] - -Section 2bB, lists - -++ flop - reverse - Description: - Produces the list 'a' with the elements reversed. - --- - Activate jet. - Creates a wet %gold gate with a sample which accepts a single list. - 'a' is then replaced with (homo a) and used as the subject for the code below (=>). - The type of the result must be the same as a, our argument list. - Let b be a list of the type of the icon of a, as it is bunted. - Create and kick a dry %gold trap - Builds an if-then-else statement on "a is an atom." - If so, produce b. - Else, recursively call flop with a replaced by it's tail and b replaced by [i.a b], where - i.a is the head of a. - Examples: - ~palryp-hocsyt/try=> =lyst (limo [1 2 3 4 ~]) - ~palryp-hocsyt/try=> lyst - [i=1 t=[i=2 t=[i=3 t=[i=4 t=~]]]] - ~palryp-hocsyt/try=> (flop lyst) - ~[4 3 2 1] - --- - ~palryp-hocsyt/try=> (flop (limo [1 'a' 2 'b' (some 10) ~])) - ~[[~ u=10] 98 2 97 1] -++ homo - homogenize - Description: - Homogenizes a lists' type information. - --- - Creates a wet %gold gate with a sample which accepts a single list. - Makes the type of the result the type of the product of the code below (^+). - The subject of the arm ($) is then the product of the barcen statement below (=<). - Creates a %gold core (|%) and the arm '+- $'. - XXX BLACK BOX, ABANDON ALL HOPE YE WHO ENTER HERE XXX - Terminates the core. - Produces list a. - Examples: - ~palryp-hocsyt/try=> lyst - [i=1 t=[i=97 t=[i=2 t=[i=98 t=[i=[~ u=10] t=~]]]]] - ~palryp-hocsyt/try=> (homo lyst) - ~[1 97 2 98 [~ u=10]] - --- - ~palryp-hocsyt/try=> =a (limo [1 2 3 ~]) - ~palryp-hocsyt/try=> a - [i=1 t=[i=2 t=[i=3 t=~]]] - ~palryp-hocsyt/try=> (homo a) - ~[1 2 3] -++ limo - listify - Description: - Produces a list from any null-terminated tuple. - --- - Creates a wet %gold gate with a sample which accepts a single list. - Makes the type of the result the type of the product of the code below (^+). - The subject of the arm ($) is then the product of the barcen statement below (=<). - Creates a %gold core (|%) and the arm '+- $'. - XXX BLACK BOX, ABANDON ALL HOPE YE WHO ENTER HERE XXX - Terminates the core. - Produces list a. - Examples: - ~palryp-hocsyt/try=> (limo [1 'a' 2 'b' (some 10) ~]) - [i=1 t=[i=97 t=[i=2 t=[i=98 t=[i=[~ u=10] t=~]]]]] - --- - ~palryp-hocsyt/try=> (limo [`a` `b` ~]) - [i=`a` t=[i=`b` t=~]] - --- - ~palryp-hocsyt/try=> (limo [2 1 ~]) - [i=2 t=[i=1 t=~]] -++ lent - length - Description: - Produces the atomic length of any list. - --- - Activate jet. - Creates a dry %gold gate with a sample which accpets a single list. - Must produce an atom. - Let b be 0. - Creates and kicks a dry %gold trap. - Builds an if-then-else statement on "a is an atom." If so, produces b. - Else, recursively calls length with the list set to the tail of a and the accumulator, b, incremented. - Examples: - ~palryp-hocsyt/try=> (lent (limo [1 2 3 4 ~])) - 4 - --- - ~palryp-hocsyt/try=> (lent (limo [1 'a' 2 'b' (some 10) ~])) - 5 -++ levy - all of - Description: - Applies the loobean gate 'b' to every element of the list 'a', producing the logical AND of all the results. - --- - Activate jet. - Creates a wet %gold gate with a sample which accepts a list and a gate with a sample of any noun - and produces a loobean. - Then, a dry %gold trap is created and kicked. It must produce a loobean. - Builds an if-then-else statement on "a is an atom." - If so, produce true. - Else, build an if-then-else statement on (b i.a) - If so, then recursively call levy with a replaced by the tail of a. - Else, produce no. - Examples: - ~palryp-hocsyt/try=> =b |=(a=@ (gte a 1)) - ~palryp-hocsyt/try=> (levy (limo [0 1 2 1 ~]) b) - %.n - --- - ~palryp-hocsyt/try=> =b |=(a=@ (gte a 0)) - ~palryp-hocsyt/try=> (levy (limo [0 1 2 1 ~]) b) - %.y -++ lien - Is the slam of any element in list `a` to `b` true? - --- - Activate jet. - Build wet %gold gate with sample list `a`, gate which accepts a noun and produces a bean `b` - Kick dry %gold trap. Yield bean. - If: `a` is null, - Then: Produce false. - Else: Unless the slam of the head of `a` to `b`, - Then: Produce true. - Else: Produce the toss of `a` for `t.a` - --- - ~palryp-hocsyt/try=> =a |=(a=@ (gte a 1)) - ~palryp-hocsyt/try=> (lien (limo [0 1 2 1 ~]) a) - %.y - ~palryp-hocsyt/try=> =a |=(a=@ (gte a 3)) - ~palryp-hocsyt/try=> (lien (limo [0 1 2 1 ~]) a) - %.n -++ reel - Right fold - Move right to left recursively slamming a binary gate with an element from the list and an accumulator, - producing the final value of the accumulator. - --- - Activate jet. - Build wet %gold gate sample list `a`, bunt of gate `b` which accepts two nouns and produces `q` - Kick dry %gold trap. Cast the result to the type of `q` in `b` - If: a is an atom: - Then: Produce the noun `q` in the sample of `b` - Else: Produce `b` slammed by: - The head of `a` - The toss of `a` for the tail of `a` - --- - ~palryp-hocsyt/try=> =sum =|([p=@ q=@] |.((add p q))) - ~palryp-hocsyt/try=> (reel (limo [1 2 3 4 5 ~]) sum) - 15 - ~palryp-hocsyt/try=> =a =|([p=@ q=@] |.((sub p q))) - ~palryp-hocsyt/try=> (reel (limo [6 3 1 ~]) a) - 4 - ~palryp-hocsyt/try=> (reel (limo [3 6 1 ~]) a) - ! subtract-underflow - ! exit -++ roll - Left fold - Move left to right recursively slamming a binary gate with an element from the list and an accumulator, - producing the final value of the accumulator. - --- - Activate jet. - Build wet %gold gate with sample list `a`, bunt of gate `b` which accepts two nouns and produces `q` - Kick dry %gold trap. Cast the result to the type of `q` in `b` - If: a is an atom, - Then: Produce `q` in `b` - Else: Produce the toss of `a` for the tail of `a`, `b` for `b` with `q` replaced by `b` slammed by the head of `a` - and `q` in `b` - --- - ~barred-tidset/try=> =a =|([p=@ q=@] |.((sub p q))) - ~barred-tidset/try=> (roll (limo [1 2 3 ~]) a) - 2 - ~barred-tidset/try=> (roll (limo [3 6 3 ~]) a) - 0 -++ skid - Seperate a list `a` into two lists - Those elements of `a` who produce true when slammed to `b` and those who produce false. - --- - Activate jet. - Build wet %gold gate with sample list `a`, tile of gate `b` accepting a noun and producing a loobean. - Kick a dry %gold trap. Cast the result to the type of [p=a q=a], a cell of lists of type `a` - If: a is null, - Then: Produce [~ ~] a cell of null and null, - Else: Push `c` is the toss of `a` for the tail of `a` - If: The slam of the head of `a` to `b`, - Then: Produce the cell with the head of `a` added to the left element, - Else: Produce the cell with the head of `a` added to the right element. - Where `p.c` and `q.c` are the left and right elements, respectively. - --- - ~dovryp-toblug/try=> =a |=(a=@ (gth a 1)) - ~dovryp-toblug/try=> (skid (limo [0 1 2 3 ~]) a) - [p=[i=2 t=[i=3 t=~]] q=[i=0 t=[i=1 t=~]]] -++ skim - only - Description: - Accepts a list 'a' and a gate 'b' which takes any noun and produces loobean. - Produces the sublist of 'a' whose elements produce true by slamming the gate with them. - --- - Activate jet. - Creates a wet %gold gate with a sample which accepts a list and a gate which accepts any noun and - produces a loobean. - Creates and kicks a dry %gold trap. - Which must produce a list of a's type. - Builds an if-then-else statement on "a is an atom." - If so, prodoce null. - Else, build an if-then-else statement on (b i.a). If so, produce [i.a $(a t.a)], where $(a t.a) is the recursive - call of skim with a replaced by the tail of a. - Else, produce $(a t.a). - Examples: - ~dovryp-toblug/try=> =a |=(a=@ (gth a 1)) - ~dovryp-toblug/try=> (skim (limo [0 1 2 3 ~]) a) - [i=2 t=[i=3 t=~]] -++ skip - except - Description: - Accepts a 'a' list and a gate 'b' which takes any noun and produces a loobean. - Produces the sublist of 'a' whose elments produce false by slamming the gate with them. - --- - Activate jet. - Creates a wet %gold gate with a sample which accepts a list and a gate which accepts any noun and - produces a loobean. - Creates and kicks a dry %gold trap. - Which must produce a list of a's type. - Builds an if-then-else statement on "a is an atom." - If so, produce null. - Else build na if-then-else statement on (b i.a). If so, produce the recursive call of skip with a replacd by - the tail of a. - Else, produce [i.a $(a t.a)]. - Examples: - ~dovryp-toblug/try=> =a |=(a=@ (gth a 1)) - ~dovryp-toblug/try=> (skip (limo [0 1 2 3 ~]) a) - [i=0 t=[i=1 t=~]] -++ scag - prefix - Description: - Accepts an atom 'n' and list 'b', producing the first n elements at the front of the list. - --- - Activate jet. - Creates a wet %gold gate which accepts an atom and a list. - A dry %gold trap is created and kicked. It must produce a list of the same type as 'b'. - Builds an if-then-else statement on the logical OR statement (a=0 or b is in null). - If so, produce null. - Else, produce [i.b $(b t.b, a (dec a))] where 'i.b' is the head of 'b' and $(b t.b, a (dec a)) - is the recursive call of scag with 'b' replaced by the tail of 'b' and 'a' decremented. - Examples: - ~palryp-hocsyt/try=> (scag 2 (limo [0 1 2 3 ~])) - [i=0 t=[i=1 t=~]] - --- - ~palryp-hocsyt/try=> (scag 10 (limo [1 2 3 4 ~])) - [i=1 t=[i=2 t=[i=3 t=[i=4 t=~]]]] -++ slag - suffix - Description: - Accepts an atom 'n' and a list 'b', producing the last n elemnents at the back of the list. - --- - Activate jet. - Creates a wet %gold gate which accepts an atom and a list. - A dry %gold trap is created and kicked. It must produce a list of the same type as 'b'. - Builds an if-then-else statement on a=0. - If so, produce 'b'. - Else, build an if-then-else statement on "b is an atom." - If so, produce null. - Else, call slag recursively with b replaced by the tail of b, a replaced by the decrement of a. - Examples: - ~palryp-hocsyt/try=> (slag 2 (limo [0 1 2 3 ~])) - [i=2 t=[i=3 t=~]] - --- - ~palryp-hocsyt/try=> (slag 2 (limo [1 2 3 4 ~])) - [i=3 t=[i=4 t=~]] -++ snag - index - Description: - Accepts an atom and a list, producing the element at the index of the atom in the list and failing is the list - is null. - --- - Activate jet. - Creates a wet %gold gate which accepts an atom and a list. - A dry %gold trap is created and kicked. - Builds an if-then-else statement on "b is null." - If so, fail with "snag-fail" in the stack trace. - Else, build an if-then-else statement on a=0. - If so, produce the head of 'b'. - Else, recursively call snag with 'b' replaced by the tail of 'b' and 'a' decremented. - Examples: - ~palryp-hocsyt/try=> (snag 2 (limo [3 2 1 0 ~])) - 1 - --- - ~palryp-hocsyt/try=> (snag 4 (limo [1 2 3 4 5 6 7 8 ~])) - 5 -++ sort - quicksort - Description: - Accepts a list and a gate with a sample which accepts two nouns and produces a loobean. 'sort' then produces a - list of the elements of 'a' sorted according to 'b'. - --- - Activate jet. - Creates a wet %gold gate with a sample which accepts a list and a gate which accepts two nouns and - produces a loobean. - Homogenizes the list and makes it the subject of the following code, casting the following to the - homogenized list type. - Creates and kicks dry %gold trap. It must produce a list of a's type. - Builds an if-then-else statement on "a is null." If so, produce null. - Slam the weld gate with the q and r below. - The q and r are then defined to be the recursive call of the trap with the skim of the tail by our sort gate. - For q, it skims by (b c i.a). For r, by !(b c i.a). - r is first cast to the type of the tail of 'a' and produced as a tuple behind the head of 'a'. - Examples: - ~dovryp-toblug/try=> =a =|([p=@ q=@] |.((gth p q))) - ~dovryp-toblug/try=> (sort (limo [0 1 2 3 ~]) a) - ~[3 2 1 0] -++ swag - infix - Description: - A range in a list - Produces the values in list 'c' starting at index 'a' and spanning 'b' elements - more than that. - --- - Creates a wet %gold gate with a sample which gate which accepts a tuple of atoms and a list 'c'. - The last 'a' elements in 'c' are selected by slag. Then the first 'b' elements of - those last elements are selected and produced by scag. - Examples: - ~palryp-hocsyt/try=> (swag [0 5] (limo [1 2 3 4 5 6 7 8 9 10 ~])) - [i=1 t=[i=2 t=[i=3 t=[i=4 t=[i=5 t=~]]]]] - --- - ~palryp-hocsyt/try=> (swag [3 5] (limo [1 2 3 4 5 6 7 8 9 10 ~])) - [i=4 t=[i=5 t=[i=6 t=[i=7 t=[i=8 t=~]]]]] - --- - ~palryp-hocsyt/try=> (swag [1 2] (limo [1 2 3 ~])) - [i=2 t=[i=3 t=~]] -++ turn - Accepts a list and a gate. Produces the list with the gate applied to each element of the original list. - --- - Activate jet. - Creates a wet %gold gate which accepts a list and a gate. - Creates and kicks a dry %gold trap. - Builds an if-then-else statement on "a is an atom." - If so, produce null. - Else, produce the tuple with head (b i.a) and tail that is turn applied recursively to the tail of 'a'. - --- - ~dovryp-toblug/try=> (turn (limo [104 111 111 110 ~]) ,@t) - <|h o o n|> -++ weld - concatenate - Description: - Concatenates two lists. - --- - Activate jet. - Creates a wet %gold gate which accepts two lists. - Homogenizes both lists and makes them the subject of the following code. - A dry %gold trap is created and kicked. It must produce the type of list 'b'. - Builds an if-then-else statement on "a is null." If so, produce 'b'. - Else, produce the tuple [i.a $(a t.a)]. 'i.a' is the head of 'a', $(a t.a) the recursive call of weld - with 'a' replaced by the tail of a. - Examples: - ~palryp-hocsyt/try=> (weld (limo [1 2 3 ~]) (limo [4 5 6 ~])) - ~[1 2 3 4 5 6] - ~palryp-hocsyt/try=> (weld "foo" "bar") - ~[~~f ~~o ~~o ~~b ~~a ~~r] -++ welp - perfect weld - Description: - Concatenates two lists without losing their type information to homogenization. - Produces a tape when passed two tapes. - --- - XXX DON'T WORRY ABOUT HOW THIS WORKS, IT IS A PERPETUAL MIYSTERY TO US ALL. XXX - Examples: - ~palryp-hocsyt/try=> (welp "foo" "bar") - "foobar" -++ wild - concatenate - Description: - Concatenates two lists without casting the product back to a list. - --- - Creates a wet %gold gate with a sample which accepts two lists. - Homogenizes both lists and makes them the subject of the following code. - A dry %gold gate is created and kicked. - Builds an if-then-else statement on "a is null." If so, produce 'b'. - Else, produce the tuple with head (b i.a) and tail that is turn applied recursively to the tail of 'a'. - Examples: - ~palryp-hocsyt/try=> =norm (limo [1 2 3 4 5 ~]) - ~palryp-hocsyt/try=> =norm2 (limo [6 7 8 ~]) - ~palryp-hocsyt/try=> (wild norm norm2) - ~[1 2 3 4 5 6 7 8] - --- - ~palryp-hocsyt/try=> (wild "foo" "bar") - ~[~~f ~~o ~~o ~~b ~~a ~~r] - --- - ~palryp-hocsyt/try=> (homo (weld "foo" "bar")) - ~[~~f ~~o ~~o ~~b ~~a ~~r] - ~palryp-hocsyt/try=> (homo (wild "foo" "bar")) - ! -find-limb.t - ! find-fork - ! exit -++ zing - promote - Description: - Turns a list of lists into a single list by promoting the elements of each sublist into the higher. - --- - Creates a wet %gold gate with a sample that accepts a list of lists. - Casts the result to the type the homogenized list head, asserting that 'a' is at least a cell. - A dry %gold trap is created and kicked. - Builds an if-then-else statement on "a is null." If so, produce null. - Else, weld together the head of a with the recrusive call of zing on the tail of a. - Examples: - ~palryp-hocsyt/try=> (zing (limo [(limo ['a' 'b' 'c' ~]) (limo ['e' 'f' 'g' ~]) (limo ['h' 'i' 'j' ~]) ~])) - ~['a' 'b' 'c' 'e' 'f' 'g' 'h' 'i' 'j'] - ~palryp-hocsyt/try=> (zing (limo [(limo [1 'a' 2 'b' ~]) (limo [3 'c' 4 'd' ~]) ~])) - ~[1 97 2 98 3 99 4 100] - -chapter 2c, simple noun surgery - -section 2cA, bit surgery **capitalization of "section" inconsistent in source** - -++ bex - binary exponent - Description: - Produces 2 to the nth power for some atom 'n'. - --- - Activate jet. - Creates a dry %gold gate which accepts a single atom. - Casts the result to an atom. - Builds an if-then-else statement on a=0. - If so, produce 1. - Else, multiply two by the recursive call of bex on the decrement of a. - Examples: - ~palryp-hocsyt/try=> (bex 4) - 16 - ~palryp-hocsyt/try=> (bex (add 19 1)) - 1.048.576 - ~palryp-hocsyt/try=> (bex 0) - 1 -++ xeb - binary logarithm - Description: - Takes the base-2 logarithm of an atom. - --- - Creates a dry %gold gate with a sample which accepts an atom. - Casts the result to an atom. - Evaluates the logarithm by counting the number of bits the number in question occupies. - Examples: - ~palryp-hocsyt/try=> (xeb 31) - 5 - -- - ~palryp-hocsyt/try=> (xeb 32) - 6 - -- - ~palryp-hocsyt/try=> (xeb 49) - 6 - -- - ~palryp-hocsyt/try=> (xeb 0) - 0 - -- - ~palryp-hocsyt/try=> (xeb 1) - 1 - -- - ~palryp-hocsyt/try=> (xeb 2) - 2 -++ can - assemble - Description: - Assembles a - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a bloq size (an atom) and - a list of atomic tuples. - Casts the result to an atom. - Builds an if-then-else statement on "b is null." - If so, produce 0. - Else, - Examples: - ~ronrem-lonsem/try=> `@ub`(can 3 ~[[1 1]]) - 0b1 - --- - ~ronrem-lonsem/try=> `@ub`(can 0 ~[[1 255]]) - 0b1 - --- - ~ronrem-lonsem/try=> `@ub`(can 1 ~[[1 2]]) - 0b10 - --- - ~ronrem-lonsem/try=> `@ub`(can 1 ~[[1 3]]) - 0b11 - --- - ~ronrem-lonsem/try=> `@ub`(can 1 ~[[1 4]]) - 0b0 - --- - ~ronrem-lonsem/try=> `@ub`(can 1 ~[[2 4]]) - 0b100 -++ cat - concatenate - Description: - Concatenates two atoms, obeying the given block size. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a bloq size (an atom) and - two atoms. - Measures the number of blocks of size 'a' are in 'b'. - Left shifts 'c' that many times the bock size of 'a'. - Sums the result of the left shift with 'b'. - Examples: - ~ronrem-lonsem/try=> `@ub`(cat 1 1 0) - 0b1 - ~ronrem-lonsem/try=> `@ub`(cat 2 1 0) - 0b1 - ~ronrem-lonsem/try=> `@ub`(cat 4 1 0) - 0b1 - ~ronrem-lonsem/try=> `@ub`(cat 0 1 1) - 0b11 - ~ronrem-lonsem/try=> `@ub`(cat 0 2 1) - 0b110 - ~ronrem-lonsem/try=> `@ub`(cat 2 1 1) - 0b1.0001 - ~ronrem-lonsem/try=> `@ub`256 - 0b1.0000.0000 - ~ronrem-lonsem/try=> `@ub`255 - 0b1111.1111 - ~ronrem-lonsem/try=> `@ub`(cat 3 256 255) - 0b1111.1111.0000.0001.0000.0000 - ~ronrem-lonsem/try=> `@ub`(cat 2 256 255) - 0b1111.1111.0001.0000.0000 - ~ronrem-lonsem/try=> (cat 3 256 255) - 16.711.936 -++ cut - slice - Description: - Accepts a block size 'a', a cell of two atoms 'b' and 'c' and another atom 'd'. - Produces the tail of 'd' that is 'c' blocks long after right-shifting 'd' 'b'-blocks. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a block size (an atom), - a cell of two atoms, and another atom which will be "cut." - Right-shifts 'd' by 'b' blocks. Then produces the 'c' block long tail of this right-shift. - Examples: - ~ronrem-lonsem/try=> (cut 0 [1 1] 2) - 1 - ~ronrem-lonsem/try=> (cut 0 [2 1] 4) - 1 - ~ronrem-lonsem/try=> (cut 3 [1 1] 256) - 1 - ~ronrem-lonsem/try=> (cut 2 [1 1] 255) - 15 - ~ronrem-lonsem/try=> (cut 1 [1 1] 255) - 3 - ~ronrem-lonsem/try=> (cut 1 [1 2] 255) - 15 -++ end - tail - Description: - Accepts a block 'a' and two atoms, 'b' and 'c'. - Produces the 'b' blocks of length 'a' on the end of 'c'. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a block (an atom) and - two atoms. - Multiplies the binary exponent of 'a' (2^a) with 'b', then takes the binary exponent - of that (2^((2^a)*b)) to finally produce the modulus of 'c' and the ensuing product. - Examples: - ~ronrem-lonsem/try=> `@ub`12 - 0b1100 - --- - ~ronrem-lonsem/try=> `@ub`(end 0 3 12) - 0b100 - --- - ~ronrem-lonsem/try=> (end 0 3 12) - 4 - --- - ~ronrem-lonsem/try=> `@ub`(end 1 3 12) - 0b1100 - --- - ~ronrem-lonsem/try=> (end 1 3 12) - 12 - --- - ~ronrem-lonsem/try=> (end 3 1 256) - 0 - --- - ~ronrem-lonsem/try=> (end 3 1 255) - 255 -++ fil - fill bloqstream - Description: - - --- - Creates a dry %gold gate with a sample which accepts a block size (an atom) and - two other atoms. - Let 'n' be 0. - Let 'd' be 'c'. - Creates and kicks a dry %gold trap whose result is cast to a atom. - Builds an if-then-else statement on n=b. - If so, produce the right-shift of 'd' by one block. - Else, recursively call the trap with 'd' replaced by the sum of 'c' and the one block - left-shift of 'b', n replaced by the increment of n. - Examples: - -++ lsh - left shift - Description: - Accepts a block size 'a' and two atoms 'b' and 'c'. Produces 'c' left-shifted - 'b' times by the block size. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a block (an atom) and - two atoms. - Multiplies 'c' times the binary exponent of the binary exponent of 'a' times 'b', - that is ((2^((2^a)*b))*c), this producing the desired left-shift on 'c'. - Examples: - ~ronrem-lonsem/try=> `@ub`1 - 0b1 - --- - ~ronrem-lonsem/try=> `@ub`(lsh 0 1 1) - 0b10 - --- - ~ronrem-lonsem/try=> (lsh 0 1 1) - 2 - --- - ~ronrem-lonsem/try=> `@ub`255 - 0b1111.1111 - --- - ~ronrem-lonsem/try=> `@ub`(lsh 3 1 255) - 0b1111.1111.0000.0000 - --- - ~ronrem-lonsem/try=> (lsh 3 1 255) - 65.280 -++ met - measure - Description: - Measures the number of blocks of size 'a' are in 'b'. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a block size (an atom) and - an atom. - Casts the result to an atom. - Let 'c' be 0. - Creates and kicks a dry %gold trap. - Builds an if-then-else statement on b=0. - If so, produce c. - Else, recursively call the trap, with - 'b' replaced by the single-block right-shift of 'b' and 'c' by the increment of 'c'. - Examples: - ~ronrem-lonsem/try=> (met 0 1) - 1 - ~ronrem-lonsem/try=> (met 0 2) - 2 - ~ronrem-lonsem/try=> (met 3 255) - 1 - ~ronrem-lonsem/try=> (met 3 256) - 2 -++ rap - Concatenate a list of atoms while obeying a given blocksize. - --- - Activate jet. - Build a dry %gold gate with sample bloq `a`, list of atoms `b` - Yield atom - If: `b` is null, - Then: Produce 0. - Else: Produce cat slammed with `a`, the head of `b`, and the toss of `b` for the tail of `b` - --- - ~palryp-hocsyt/try=> (rap 2 (limo [1 2 3 4 ~])) - 17.185 - ~palryp-hocsyt/try=> (rap 1 (limo [1 2 3 4 ~])) - 313 - ~palryp-hocsyt/try=> (rap 0 (limo [0 0 0 ~])) - 0 - ~palryp-hocsyt/try=> (rap 0 (limo [0 0 1 ~])) - 1 -++ rep - Assembles - - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a block size (an atom) and - a list of atoms. - Casts the result to an atom. - Let 'c' be 0. - Creates and kicks a dry %gold trap. - Build an if-then-else statement on "b is an atom." - If so, produce 0. - Else, produce the binary logical OR of the 'c' time left-shift on the last block - of the head of 'b' and the recursive call of the trap with: - 'c' replaced by the increment of 'c'. - 'b' replaced by the tail of 'b'. - Examples: - ~palryp-hocsyt/try=> (rep 0 (limo [1 2 3 4 ~])) - 5 - --- - ~palryp-hocsyt/try=> (rep 1 (limo [1 2 3 4 ~])) - 57 - --- - ~palryp-hocsyt/try=> (rep 0 (limo [1 0 0 ~])) - 1 - --- - ~palryp-hocsyt/try=> (rep 0 (limo [1 0 0 0 ~])) - 1 - --- - ~palryp-hocsyt/try=> (rep 0 (limo [0 1 0 0 ~])) - 2 - --- - ~palryp-hocsyt/try=> (rep 0 (limo [0 1 0 1 ~])) - 10 - --- - ~palryp-hocsyt/try=> (rep 0 (limo [0 1 0 1 0 1 ~])) - 42 -++ rip - disassemble - Description: - Produces a list of the bits of an atom, in little endian order, according to - block size. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a block size (an atom) and - any number. - Cast the result to a list of atoms. - Builds an if-then-else statement on b=0. - If so, produce null. - Else, produce a tuple with head of (end a 1 b), the single-block tail of 'b', and - the resursive call of rip with 'b' replaced by the single-block right-shift of 'b'. - in little endian. - Examples: - palryp-hocsyt/try=> `@ub`155 - 0b1001.1011 - --- - ~palryp-hocsyt/try=> (rip 0 155) - ~[1 1 0 1 1 0 0 1] - --- - ~palryp-hocsyt/try=> (rip 2 155) - ~[11 9] - --- - ~palryp-hocsyt/try=> (rip 1 155) - ~[3 2 1 2] - --- - ~palryp-hocsyt/try=> `@ub`256 - 0b1.0000.0000 - --- - ~palryp-hocsyt/try=> (rip 0 256) - ~[0 0 0 0 0 0 0 0 1] - --- - ~palryp-hocsyt/try=> (rip 2 256) - ~[0 0 1] - --- - ~palryp-hocsyt/try=> (rip 3 256) - ~[0 1] - -++ rsh - right shift - Description: - Accepts a block size 'a' and two atoms, 'b' and 'c'. Right-shifts 'c' by 'b' blocks - of size 'a'. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a block size (an atom) and - two atoms. - Takes the binary exponent of the binary exponent of 'a' multiplied by 'b', - that is (2^(((2^a)*b))) and divides 'c' by it, producing the desired - right-shift on 'c'. - Examples: - ~ronrem-lonsem/try=> `@ub`145 - 0b1001.0001 - --- - ~ronrem-lonsem/try=> `@ub`(rsh 1 1 145) - 0b10.0100 - --- - ~ronrem-lonsem/try=> (rsh 1 1 145) - 36 - --- - ~ronrem-lonsem/try=> `@ub`(rsh 2 1 145) - 0b1001 - --- - ~ronrem-lonsem/try=> (rsh 2 1 145) - 9 - --- - ~ronrem-lonsem/try=> `@ub`10 - 0b1010 - --- - ~ronrem-lonsem/try=> `@ub`(rsh 0 1 10) - 0b101 - --- - ~ronrem-lonsem/try=> (rsh 0 1 10) - 5 - --- - ~ronrem-lonsem/try=> `@ub`1 - 0b1 - --- - ~ronrem-lonsem/try=> (rsh 0 1 1) - 0 - --- - ~ronrem-lonsem/try=> (rsh 0 1 1) - 0 -++ swap - reverse bloq order - Description: - Produces the reversed block order of a number, obeying block number. - Switches little ending to big and vice versa. - --- - Creates a dry %gold gate with a sample which accepts a block size (an atom) and - an atom. - Rips apart the atom by the block size, then reverses the tape that is produced. - Once it is reversed, it is re-assembled using rep. - Examples: - ~palryp-hocsyt/try=> `@ub`24 - 0b1.1000 - --- - ~palryp-hocsyt/try=> (swap 0 24) - 3 - --- - ~palryp-hocsyt/try=> `@ub`3 - 0b11 - --- - ~palryp-hocsyt/try=> (swap 0 0) - 0 - --- - ~palryp-hocsyt/try=> (swap 1 24) - 9 - --- - ~palryp-hocsyt/try=> (swap 0 128) - 1 -section 2cB, bit logic - -++ con - binary or - Description: - Produces the bit-wise logical OR of two atoms. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts two atoms. - Let 'c' be 0, d be 0. - Creates and kicks a dry %gold trap. Casts the result to an atom. - Builds an if-then-else statement on a=b AND b=0. - If so, produce 'd'. - Else, recursively call the trap with: - 'a' replaced by the single 0-block right shift of 'a'. - 'b' replaced by the single 0-block right-shift of 'b'. - 'c' replaced by the increment of c. - 'd' replaced by the sum of 'd' and the 'c' 0-block left-shift of the - logical AND of (last bit of 'a')=0 AND (last bit of 'b')=0. - (==) terminates the list of changes. - Examples: - ~palryp-hocsyt/try=> (con 0 1) - 1 - --- - ~palryp-hocsyt/try=> (con 1 0) - 1 - --- - ~palryp-hocsyt/try=> (con 0 0) - 0 - --- - ~palryp-hocsyt/try=> (con 4 4) - 4 - --- - ~palryp-hocsyt/try=> (con 10.000 234) - 10.234 -++ dis - binary and - Description: - Produces the bit-wise logical AND of two atoms. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts two atoms. - Pushes the bunt of a two atom tuple onto the subject. - Creates and kicks a dry %gold trap. Casts its result to an atom. - Builds an if-then-else statement on a=0 or b=0. - If so, produce 'd'. - Else, recursively call the trap with: - 'a' replaced by the single 0-block right-shift of 'a'. - 'b' replaced by the single 0-block right-shift of 'b'. - 'c' replaced by the increent of 'c'. - 'd' replaced by the sum of 'd' and the 'c' 0-block left-shift of the - logical OR of (last bit of 'a')=0 OR (last bit of 'b')=0. - (==) terminates the list of changes. - Examples: - ~ronrem-lonsem/try=> `@ub`9 - 0b1001 - --- - ~ronrem-lonsem/try=> `@ub`5 - 0b101 - --- - ~ronrem-lonsem/try=> `@ub`(dis 9 5) - 0b1 - --- - ~ronrem-lonsem/try=> (dis 9 5) - 1 - --- - ~ronrem-lonsem/try=> `@ub`534 - 0b10.0001.0110 - --- - ~ronrem-lonsem/try=> `@ub`987 - 0b11.1101.1011 - --- - ~ronrem-lonsem/try=> `@ub`(dis 534 987) - 0b10.0001.0010 - --- - ~ronrem-lonsem/try=> (dis 534 987) - 530 -++ mix - binary xor - Description: - Produces the bit-wise logical exclusive OR of two atoms. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts two atoms. - Casts the result to an atom. - Let 'c' be 0, 'd' be 0. - A dry %gold trap is created and kicked. - Builds an if-then-else statement on a=0 AND b=0. - If so, produce 'd'. - Else, recursively call mix with: - 'a' replaced by - 'b' replaced by - 'c' replaced by the increment of 'c'. - 'd' replaced by - (==) terminates the list of changes. - Examples: - ~ronrem-lonsem/try=> `@ub`2 - 0b10 - ~ronrem-lonsem/try=> `@ub`3 - 0b11 - ~ronrem-lonsem/try=> `@ub`(mix 2 3) - 0b1 - ~ronrem-lonsem/try=> (mix 2 3) - 1 - ~ronrem-lonsem/try=> `@ub`(mix 2 2) - 0b0 - ~ronrem-lonsem/try=> (mix 2 2) - 0 -++ not - binary not (sized) - Description: - Produces the bit-wise logical NOT over 'b' blocks of the given blocksize. - --- - First produces the binary exponent of the binary exponent of the block size times - 'b'. This is decremented before being multiplied by 'c'. - Finally, this product is exclusive ORed and produced. - Examples: - ~palryp-hocsyt/try=> `@ub`24 - 0b1.1000 - --- - ~palryp-hocsyt/try=> (not 0 5 24) - 7 - --- - ~palryp-hocsyt/try=> `@ub`7 - 0b111 - --- - ~palryp-hocsyt/try=> (not 2 5 24) - 1.048.551 - --- - ~palryp-hocsyt/try=> (not 2 5 1.048.551) - 24 - --- - ~palryp-hocsyt/try=> (not 1 1 (not 1 1 10)) - 10 - -section 2cC, noun orders - -++ aor - a-order - Description: - Alphabetic comparator gate. - --- - Activate jet. - Creates a dry %gold gate which accepts two nouns. - Casts the result to a loobean. - Builds an if-then-else statement on a=b. - If so, produce true. - Else, build an unless-then-else statement on "a is an atom." - If 'a' is not an atom, build an unless-then-else statement on "b is an atom." - If so, build an if-then-else statement on (-.a=-.b) where -.a is the head of 'a'. - If so, recursively call aor with 'a' and 'b' replaced by their respecitve tails. - Else, recursively call aor with 'a' and 'b' replaced by their respective heads. - Else (if 'b' is an atom), produce false. - Else (if 'a' is an atom), build an unless-then-else statement on "b is an atom." - If so, produce true. - Else, create and kick a dry %gold gate. - Let 'c' be the byte tail of 'a', 'd' be the byte tail of 'b'. - Builds an if-then-else statement on (c=d). - If so, produce the recursive call to the trap with 'a' replaced by the byte right-shift of 'a' - and 'b' replaced by the byte right-shift of 'b'. - Else (if !(c=d)), produce (c (aor 'a' 'b') - %.y - ~tadbyl-hilbel/try=> (aor 'b' 'a') - %.n - --- - ~tadbyl-hilbel/try=> (aor "foo" "bar") - %.n - ~tadbyl-hilbel/try=> (aor "bar" "foo") - %.y - --- - ~tadbyl-hilbel/try=> (aor "abcdefz" "abcdefa") - %.n - ~tadbyl-hilbel/try=> (aor "abcdefa" "abcdefz") - %.y - --- - ~tadbyl-hilbel/try=> (aor 10.000 17.000) - %.y - ~tadbyl-hilbel/try=> (aor 10 9) - %.n -++ dor - d-order - Description: - Numeric comparator gate. - --- - Activate jet. - Creates a dry %gold gate which accepts two nouns. - Casts the result to a loobean. - Builds an if-then-else statement on a=b. - If so, produce true. - Else, build an unless-then-else statement on "a is an atom." - If 'a' is not an atom, build an unless-then-else statement on "b is an atom." - If so, build an if-then-else statement on (-.a=-.b) where -.a is the head of 'a'. - If so, recursively call dor with 'a' and 'b' replaced by their respecitve tails. - Else, recursively call dor with 'a' and 'b' replaced by their respective heads. - Else ('b' is an atom), produce false. - Else ('a' is an atom), build an unless-then-else statement on "b is an atom." - If so, produce true. - Else, produce (a (dor 1 2) - %.y - ~tadbyl-hilbel/try=> (dor 2 1) - %.n - --- - ~tadbyl-hilbel/try=> (dor ~[1 2 3] ~[1 2 4]) - %.y - ~tadbyl-hilbel/try=> (dor ~[1 2 4] ~[1 2 3]) - %.n - --- - ~tadbyl-hilbel/try=> (dor (limo ~[99 100 10.000]) ~[99 101 10.000]) - %.y - ~tadbyl-hilbel/try=> (dor ~[99 101 10.999] (limo ~[99 100 10.000])) - %.n -++ gor - g-order - Description: - Hash comparator gate. - --- - Activate jet. - Creates a dry %gold gate which accepts two nouns. - Casts the result to a loobean. - Let 'c' be the mug (FNV-1a hash) of 'a' an 'd' the mug of 'b'. - Create an if-then-else statement on c=d. - If so, produce the d-order of 'a' and 'd'. - Else, produce the loobean (c (gor 'd' 'c') - %.y - ~palryp-hocsyt/try=> 'd' - 'd' - ~palryp-hocsyt/try=> 'c' - ~palryp-hocsyt/try=> `@ud`'d' - 100 - ~palryp-hocsyt/try=> `@ud`'c' - 99 - ~palryp-hocsyt/try=> (mug 'd') - 1.628.185.714 - ~palryp-hocsyt/try=> (mug 'c') - 1.712.073.811 - ~palryp-hocsyt/try=> (gor 'd' 'c') - %.y - ~palryp-hocsyt/try=> (gor 'c' 'd') - %.n - --- - ~palryp-hocsyt/try=> (gor "foo" "bar") - %.n - --- - ~palryp-hocsyt/try=> (gor (some 10) (limo [1 2 3 ~])) - %.n -++ hor - h-order - Description: - Recursive hash comparator gate. - --- - Activate jet. - Creates a dry %gold gate which accepts two nouns. - Casts the result to a loobean. - Build an if-then-else statement on "a is an atom." - If so, build na if-then-else statment on "b is an atom." - If so, produce the g-order of 'a' and 'b'. - Else (if 'b' is not an atom), produce true. - Else (if 'a' is not an atom), build an if-then-else statement on "b is an atom." - If so, produce false. - Else, build an if-then-else statement on (-.a=-.b), where '-.a' is the head of 'a'. - If so, produce the g-order of the tails of 'a' and 'b'. - Else (if the heads of 'a' and 'b' are not equal), produce the g-order of the tails of 'a', 'b'. - Examples: - -++ vor - v-order - Description: - Double hash comparator gate. - --- - Activate jet. - Creates a dry %gold gate which accepts two nouns. - Casts the result to a loobean. - Let 'c' be the double mug (FNV-1a hash) of 'a', 'd' that of 'b'. - Builds an if-then-else statement on (c=d). - If so, produce the d-order of 'a' and 'b'. - Else, produce the loobean of (c (vor 'f' 'g') - %.y - --- - ~palryp-hocsyt/try=> (vor 'a' 'z') - %.n - --- - ~palryp-hocsyt/try=> (vor 43.326 41.106) - %.n - -section 2cD, insecure hashing - -++ fnv - FNV scrambler - Description: - Hashes an atom with the 32-bit FNV non-cryptographic hash algorithm. - --- - Multiplies 'a' by the prime number 16,777,619 and then takes the block of - size 5 off the product's end. - Examples: - ~palryp-hocsyt/try=> (fnv 10.000) - 272.465.456 - --- - ~palryp-hocsyt/try=> (fnv 10.001) - 289.243.075 - --- - ~palryp-hocsyt/try=> (fnv 1) - 16.777.619 -++ mug - 31bit nonzero FNV1a - Description: - Hashes any noun with the 31-bit nonzero FNV-1a non-cryptographic hash algorithm. - --- - Activate jet. - Creates a dry %gold gate with a sample accepting any noun. - - (?^ and 'p' subsection fill in.) - - Let 'b' be 2,166,136,261. - Create and kick a dry %gold gate. Cast its result to an atom. - Let 'c' be 'b'. - Let 'd' be 0, 'e' be the number of bytes in 'a'. - Create and kick a dry %gold gate. Cast its result to an atom. - Builds an if-then-else statement on d=e. - If so, let 'f' be the bit-wise XOR on the 31 0-block shift on 'c' and the last - 31 blocks of 'c'. - Builds an unless-then-else statement on f=0. If then, produce 'f'. - Else, recursively call the trap above our current trap with 'b' replaced by +(b). - Else (d isn't equal to e), then recursively call the trap with 'c' replaced by - the fnv hash of the logical XOR of 'c' and (cut 3 [d 1] a), 'd' replaced by - the increment of 'd'. - - Examples: - ~palryp-hocsyt/try=> (mug 10.000) - 178.152.889 - --- - ~palryp-hocsyt/try=> (mug 10.001) - 714.838.017 - --- - ~palryp-hocsyt/try=> (mug 1) - 67.918.732 - --- - ~palryp-hocsyt/try=> (mug (some 10)) - 1.872.403.737 - --- - ~palryp-hocsyt/try=> (mug (limo [1 2 3 4 5 ~])) - 1.067.931.605 - -section 2cE, phonetic base - -++ po - left-right syllable - Description: - Provides the phonetic syllables and name generators for the Urbit naming system. - --- - Activate jet. - Create the cell [sis dex] where 'sis' and 'dex' are the togas on the - left-hand ("sinister") and right-hand ("Dexter") phonetic syllable cords, respectively. - Build %gold core to contain the following arms. - ++ ind - - Description: - --- - Activate jet. - Creates a dry %gold gate which accepts and atom. - Let 'b' be 0. - Creates and kicks a dry %gold trap, casting the result to an atomic unit. - Builds an if-then-else statement on (b=256). If so, produce null. - Else, build an if-then-else statement on (a=(tod b)). If so, produce the atomic unit [~ b]. - Else, recursively call the trap with 'b' replaced by the increment of 'b'. - Examples: - - ++ ins - - Description: - --- - Activate jet. - Creates a dry %gold gate which accepts and atom. - Let 'b' be 0. - Creates and kicks a dry %gold trap with the result cast to an atomic unit. - Builds an if-then-else statement on (b=256). If so, produce null. - Else, build an if-then-else statement on (a=(tos b)). If so, produce the atomic unit [~ b]. - Else, recursively call the trap with 'b' replaced by the increment of 'b'. - Examples: - - ++ tod - Description: - Selects right-hand phonetic syllable from 'dex'. - --- - Activate jet. - Creates a dry %gold gate which accepts and atom. - Assert that 'a' is less than 256. - Produce the three tail-end byte blocks in the rght-shift of dex. - Examples: - ~palryp-hocsyt/try=> (tod:po 98) - 6.514.020 - --- - ~palryp-hocsyt/try=> (tod:po 150) - 6.781.298 - --- - ~palryp-hocsyt/try=> (tod:po 255) - 7.562.598 - --- - ~palryp-hocsyt/try=> (tod:po 256) - ! exit - ++ tos - Selects left-hand phonetic syllable from 'sin'. - --- - Activate jet. - Creates a dry %gold gate which accepts and atom. - Assert that 'a' is less than 256. - Produce the three tail-end byte blocks in the rght-shift of dex. - Examples: -section 2cF, signed and modular ints - -++ si - signed integer - ++ abs - absolute value - Description: - Produces the absolute value of a signed integer. - --- - Creates a dry %gold gate with a sample which accepts a single atom. - Sums the last bit of the atom with the single bit-wise block right-shift of the atom, - producing the absolute value. - Examples: - ~palryp-hocsyt/try=> (abs:si -2) - 2 - --- - ~palryp-hocsyt/try=> (abs:si -10.000) - 10.000 - --- - ~palryp-hocsyt/try=> (abs:si --2) - 2 - ++ dif - subtraction - Description: - Produces the difference between two signed integers. - --- - Creates a dry %gold gate with a sample which accepts two signed integers. - Sums the first signed integer with a new signed integer, made from the second by - (new !(syn b) (abs b)), where !(syn b) is the negative of the second integer's sign. - This sum, produced, is the difference. - Examples: - ~palryp-hocsyt/try=> (dif:si --10 -7) - --17 - --- - ~palryp-hocsyt/try=> (dif:si --10 --7) - --3 - --- - ~palryp-hocsyt/try=> (dif:si `@s`0 --7) - -7 - --- - ~palryp-hocsyt/try=> (dif:si `@s`0 `@s`7) - --4 - ++ dul - modulus - Description: - Produces the modulus of two signed integers. - --- - Creates a dry %gold gate which accepts a signed integer and an atom. - Let 'c' be the [sign value] representation of 'a'. - Builds an if-then-else statement on -.c, the sign of 'a'. - If so ('a' is positive.), produce the modulus of the absolute value of 'c' and 'b'. - Else, produce the differenece between 'b' and the absolute value of 'c'. - Examples: - ~palryp-hocsyt/try=> (dul:si --9 3) - 0 - --- - ~palryp-hocsyt/try=> (dul:si --9 4) - 1 - --- - ~palryp-hocsyt/try=> (dul:si --9 5) - 4 - --- - ~palryp-hocsyt/try=> (dul:si --9 6) - 3 - --- - ~palryp-hocsyt/try=> (dul:si --90 --10) - 10 - ++ fra - divide - Description: - Produces the quotient of two signed integers. - --- - Creates a dry %gold gate with a sample which accepts two signed integers. - Divides the absolute value of 'a', the dividend, and 'b', the divisor, and - passes that value as the unsigned integer value of a new signed integer. - The sign of the new signed integer is the bitwise logical XOR of the two integer's - signs, meaning the quotient is only positive when both factors are positive. - This new signed integer is produced. - Examples: - ~palryp-hocsyt/try=> (fra:si --4 --2) - --2 - --- - ~palryp-hocsyt/try=> (fra:si -4 -2) - --2 - --- - ~palryp-hocsyt/try=> (fra:si -4 --2) - -2 - --- - ~palryp-hocsyt/try=> (fra:si --4 -2) - -2 - --- - ~palryp-hocsyt/try=> (fra:si `@s`4 `@s`2) - --2 - --- - ~palryp-hocsyt/try=> (fra:si `@s`4 2) - ! type-fail - ! exit - ++ new - [sign value] to @s - Description: - Produces a signed integer from a sign value (either & or |) and an atom. - --- - Creates a dry %gold gate with a sample which acccepts a loobean and an atom - Builds an if-then-else statement on the sign value 'a'. - If so, just produce 'b' multiplied by 2. - Else, build an if-then-else statement on b=0. If so, produce 0. - Else, produce the increment of (2*(dec b)). - The result is then cast to an integer and produced from new:si. - Examples: - ~palryp-hocsyt/try=> (new:si [& 10]) - --10 - ~palryp-hocsyt/try=> (new:si [| 10]) - -10 - ~palryp-hocsyt/try=> (new:si [%.y 7]) - --7 - ++ old - [sign value] - Description: - Produces the cell [sign value] representations of a signed integer. - --- - Create a dry %gold date with a with a sample which accepts a signed integer. - Produce a cell with head (syn a), the sign of 'a', and tail (abs), the absolute value of 'a'. - Examples: - ~palryp-hocsyt/try=> (old:si 7) - ! type-fail - ! exit - --- - ~palryp-hocsyt/try=> (old:si -7) - [%.n 7] - --- - ~palryp-hocsyt/try=> (old:si --7) - [%.y 7] - --- - ~palryp-hocsyt/try=> (old:si `@s`7) - [%.n 4] - --- - ~palryp-hocsyt/try=> (old:si -0) - [%.y 0] - ++ pro - Produces the product of two signed integers. - --- - Creates a dry %gold gate with a sample which accepts two signed integers. - Produces their product by evaluating a new signed integer whose sign is the bitwise - XOR of the two number's signs and whose value is the product of their two absolute values. - --- - palryp-hocsyt/try=> (pro:si -4 --2) - -8 - ~palryp-hocsyt/try=> (pro:si -4 -2) - --8 - ~palryp-hocsyt/try=> (pro:si --10.000.000 -10) - -100.000.000 - ~palryp-hocsyt/try=> (pro:si -1.337 --0) - --0 - ++ rem - Produces the remainder from a division of two signed integers. - --- - Creates a dry %gold gate with a sample which accepts two signed integers. - Produces the difference between 'a' and the (b*(a/b)). - --- - ~palryp-hocsyt/try=> (rem:si -10 -4) - -2 - ~palryp-hocsyt/try=> (rem:si --10 --4) - --2 - ~palryp-hocsyt/try=> (rem:si --10 -4) - --2 - ~palryp-hocsyt/try=> (rem:si --7 --3) - --1 - ~palryp-hocsyt/try=> (rem:si --0 --10.000) - --0 - ++ sum - Sum two signed integers. - --- - Creates a dry %gold gate which accepts two signed integers. - Prints '%si-sum' in the stack trace if the following code crashes. - Let 'c' and 'd' be the [sign value] representation of 'a' and 'b', respectively. - Builds an if-then-else statement on "c is positive". - If so, build an if-then-else statement on "d is positive". - If so, produce a new, positive signed integer with value ((abs a)+(abs b)) - Else, build an if-then-else statement on (abs a)>=(abs b) - If so, produce a new, positive integer with value ((abs a)-(abs d)). - Else (if !((abs a)>=(abs b))), produce a new, negative signed integer - with value ((abs d)-(abs c)). - Else (if c is not positive), build an if-then-else statement on "d is positive". - If so, build an if-then-else statement on (abs a)>=(abs b). - If so, produce a new, negative signed intger with value ((abs a)-(abs b)) - Else, produce a new, positive signed integer with value ((abs c)-(abs d)) - Else (if d is not positive), produce a new, negative signed with value ((abs c)+(abs d)). - --- - ~palryp-hocsyt/try=> (sum:si --10 --10) - --20 - --- - ~palryp-hocsyt/try=> (sum:si --10 -0) - --10 - --- - ~palryp-hocsyt/try=> (sum:si -10 -7) - -17 - --- - ~palryp-hocsyt/try=> (sum:si -10 --7) - -3 - ++ sun - Produces a signed integer from an unsigned integer. - Note that the result must be manually cast to some @s odor to be inferred as an - unsigned integer in the type system. - --- - Build dry %gold gate with sample unsigned integer `a` - Produce the integer multiplied by 2. - --- - ~palryp-hocsyt/try=> `@s`10 - --5 - ~palryp-hocsyt/try=> (sun:si 10) - 20 - ~palryp-hocsyt/try=> `@s`(sun:si 10) - --10 - ~palryp-hocsyt/try=> `@sd`(sun:si 10) - --10 - ~palryp-hocsyt/try=> `@sd`(sun:si 12.345) - --12.345 - ++ syn - Is a signed integer positive? - Produce the sign of a signed integer - & being posiitve, | negative. - --- - Build dry %gold gate with sample signed integer `a` - Is the last bit of 'a' 0? - --- - ~palryp-hocsyt/try=> (syn:si -7) - %.n - ~palryp-hocsyt/try=> (syn:si --7) - %.y - ~palryp-hocsyt/try=> (syn:si (new:si [& 7])) - %.y - ~palryp-hocsyt/try=> (syn:si -0) - %.y - ~palryp-hocsyt/try=> (syn:si --0) - %.y -++ fe - Binary block modulo math engine. Defaults to bloq size 1. - --- - Build dry %gold tray with sample bloq `a` - ++ dif - Produces the difference between two atoms in the modular basis representation. - --- - Build dry %gold gate wtih sample atom `b`, atom `c` - Produce sit slammed with: - The difference between: - The sum of: - `out` and slam of `b` to sit - Slam of `c` to sit - --- - ~tadbyl-hilbel/try=> (~(dif fe 3) 63 64) - 255 - ~tadbyl-hilbel/try=> (~(dif fe 3) 5 10) - 251 - ~tadbyl-hilbel/try=> (~(dif fe 3) 0 1) - 255 - ~tadbyl-hilbel/try=> (~(dif fe 0) 9 10) - 1 - ~tadbyl-hilbel/try=> (~(dif fe 0) 9 11) - 0 - ~tadbyl-hilbel/try=> (~(dif fe 0) 9 12) - 1 - ~tadbyl-hilbel/try=> (~(dif fe 2) 9 12) - 13 - ~tadbyl-hilbel/try=> (~(dif fe 2) 63 64) - 15 - ++ inv - Inverts the order of the modular field. - --- - Build dry %gold gate with sample atom `b` - Produce the difference between: - The decrement of `out` - Slam of `b` to sit. - --- - palryp-hocsyt/try=> (~(inv fe 3) 255) - 0 - ~palryp-hocsyt/try=> (~(inv fe 3) 256) - 255 - ~palryp-hocsyt/try=> (~(inv fe 3) 0) - 255 - ~palryp-hocsyt/try=> (~(inv fe 3) 1) - 254 - ~palryp-hocsyt/try=> (~(inv fe 3) 2) - 253 - ~palryp-hocsyt/try=> (~(inv fe 3) 3) - 252 - ++ net - - --- - Build dry %gold gate with sample atom `b`. Yield atom. - Push toss of `b` for the slam of `b` to sit on the context. - Unless: `a` is less than or equal to 3, - Then: Produce `b`, - Else: Push `c` is the decrement of `a` - Produce the slam of con with: - The single c-block left-shift of: - The toss of `a` for `c`, `b` for the c-block [0 1] cut of `b` - The toss of `a` for `c`, `b` for the c-block [1 1] cut of `b` - --- - ~tadbyl-hilbel/try=> (~(net fe 3) 64) - 64 - ~tadbyl-hilbel/try=> (~(net fe 3) 128) - 128 - ~tadbyl-hilbel/try=> (~(net fe 3) 255) - 255 - ~tadbyl-hilbel/try=> (~(net fe 3) 256) - 0 - ~tadbyl-hilbel/try=> (~(net fe 3) 257) - 1 - ~tadbyl-hilbel/try=> (~(net fe 3) 500) - 244 - ~tadbyl-hilbel/try=> (~(net fe 3) 511) - 255 - ~tadbyl-hilbel/try=> (~(net fe 3) 512) - 0 - ~tadbyl-hilbel/try=> (~(net fe 3) 513) - 1 - ~tadbyl-hilbel/try=> (~(net fe 3) 0) - 0 - ~tadbyl-hilbel/try=> (~(net fe 3) 1) - 1 - ~tadbyl-hilbel/try=> (~(net fe 0) 1) - 1 - ~tadbyl-hilbel/try=> (~(net fe 0) 2) - 0 - ~tadbyl-hilbel/try=> (~(net fe 0) 3) - 1 - ~tadbyl-hilbel/try=> (~(net fe 6) 1) - 72.057.594.037.927.936 - ~tadbyl-hilbel/try=> (~(net fe 6) 2) - 144.115.188.075.855.872 - ~tadbyl-hilbel/try=> (~(net fe 6) 3) - 216.172.782.113.783.808 - ~tadbyl-hilbel/try=> (~(net fe 6) 4) - 288.230.376.151.711.744 - ~tadbyl-hilbel/try=> (~(net fe 6) 5) - 360.287.970.189.639.680 - ~tadbyl-hilbel/try=> (~(net fe 6) 6) - 432.345.564.227.567.616 - ~tadbyl-hilbel/try=> (~(net fe 6) 7) - 504.403.158.265.495.552 - ~tadbyl-hilbel/try=> (~(net fe 6) 512) - 562.949.953.421.312 - ~tadbyl-hilbel/try=> (~(net fe 6) 513) - 72.620.543.991.349.248 - ++ out - Description: - The maximum integer value that the current block can store. - --- - Produce the binary exponent of: - The binary expoenent of the block size, `a` - --- - ~tadbyl-hilbel/try=> ~(out fe 0) - 2 - ~tadbyl-hilbel/try=> ~(out fe 1) - 4 - ~tadbyl-hilbel/try=> ~(out fe 2) - 16 - ~tadbyl-hilbel/try=> ~(out fe 3) - 256 - ~tadbyl-hilbel/try=> ~(out fe 4) - 65.536 - ~tadbyl-hilbel/try=> ~(out fe 10) - 179.769.313.486.231.590.772.930.519.078.902.473.361.797.697.894.230.657.273.430.081. - 157.732.675.805.500.963.132.708.477.322.407.536.021.120.113.879.871.393.357.658.789. - 768.814.416.622.492.847.430.639.474.124.377.767.893.424.865.485.276.302.219.601.246. - 094.119.453.082.952.085.005.768.838.150.682.342.462.881.473.913.110.540.827.237.163. - 350.510.684.586.298.239.947.245.938.479.716.304.835.356.329.624.224.137.216 - ++ rol - - --- - Build dry %gold gate with sample bloq `b`, atom `c`, atom `d`. Yield atom. - Push `e` is sit slammed with `d`, the modular representation of `d` - Push `f` is the binary expoenent of: - The difference between 'a' and 'b' - Push `g` is `c` modulus `f` - Produce sit slammed with: - con slammed with: - The `g` b-blocks right-shift of `e` - The difference between `f` and `g` b-blocks left-shift of `e` - --- - - - ++ ror - - --- - Build dry %gold gate with sample bloq `b`, atom `c`, atom `d`. Yield atom. - Push `e` is sit slammed with `d`, the modular representation of `d` - Push `f` is the binary expoenent of: - The difference between 'a' and 'b' - Push `g` is `c` modulus `f` - Produce sit slammed with: - con slammed with: - The `g` b-blocks left-shift of `e` - The difference between `f` and `g` b-blocks right-shift of `e` - --- - - ++ sum - Sum two numbers in this modular field. - --- - Build dry %gold gate with sample atom `b`, atom `c` - Produce sit slammed with the sum of `b` and `c` - --- - ~tadbyl-hilbel/try=> (~(sum fe 3) 10 250) - 4 - ~tadbyl-hilbel/try=> (~(sum fe 0) 0 1) - 1 - ~tadbyl-hilbel/try=> (~(sum fe 0) 0 2) - 0 - ~tadbyl-hilbel/try=> (~(sum fe 2) 14 2) - 0 - ~tadbyl-hilbel/try=> (~(sum fe 2) 14 3) - 1 - ~tadbyl-hilbel/try=> (~(sum fe 4) 10.000 256) - 10.256 - ~tadbyl-hilbel/try=> (~(sum fe 4) 10.000 100.000) - 44.464 - ++ sit - Produce an atom in the current modular block representation. - --- - Build dry %gold gate with sample atom `b` - Produce the last block of size `a` in `b` - --- - ~tadbyl-hilbel/try=> (~(sit fe 3) 255) - 255 - ~tadbyl-hilbel/try=> (~(sit fe 3) 256) - 0 - ~tadbyl-hilbel/try=> (~(sit fe 3) 257) - 1 - ~tadbyl-hilbel/try=> (~(sit fe 2) 257) - 1 - ~tadbyl-hilbel/try=> (~(sit fe 2) 10.000) - 0 - ~tadbyl-hilbel/try=> (~(sit fe 2) 100) - 4 - ~tadbyl-hilbel/try=> (~(sit fe 2) 16) - 0 - ~tadbyl-hilbel/try=> (~(sit fe 2) 17) - 1 - ~tadbyl-hilbel/try=> (~(sit fe 0) 17) - 1 - ~tadbyl-hilbel/try=> (~(sit fe 0) 0) - 0 - ~tadbyl-hilbel/try=> (~(sit fe 0) 1) - 1 - -section 2cG, floating point - -++ rlyd -++ rlyh -++ rlyq -++ rlys -++ ryld -++ rylh -++ rylq -++ ryls - -section 2cH, urbit time - -++ year - Accept a parsed date of form [[a=? y=@ud] m=@ud t=tarp] and produce - its @d representation. - --- - Build dry %gold gate with sample parsed date `det` - Yield @d. - Push `yer` is: - If: `a.det` is true. I.e. - Then: The sum of 292,277,024,400 and `y.det`, the year. - Else: The difference of 292,277,024,400 and the decrement of `y.det`, the year. - Push `day` is yawn slammed with: - `yer`, `m.det`, `d.t.det` - Produce yule slammed with: - `day`, `h.t.det`, `m.t.det`, `s.t.det`, `f.t.det` - --- - -++ yore - Produce the parsed date [[a=? y=@ud] m=@ud t=tarp] representation of a @d date. - --- - Build dry %gold gate with sample @d `now`. - Yield date. - Push `rip` is yell slammed with `now`, the - Push `ger` is yall slammed with `d.rip`, the - Pair: - If: y.ger is greater than , - Then: , - Else: with, - - --- - -++ yell - Produce a parsed daily time format from an atomic date. - --- - Creates a dry %gold gate which accepts an atomic date, @d. - Casts the result to a tarp. - Let 'sec' be the single 64-bit block right-shift of 'now'. - - Creates and kicks a dry %gold trap. Casts the result to a list of unsigned hexadecimal atoms. - If (0=raw) OR (0=muc), produce null. - Replace 'muc' with the decrement of 'muc' (3). - Produce the cell [(cut 4 [muc 1] raw) $(raw (end 4 muc raw))], where - (cut 4 [muc 1] raw) is the cut of 'raw' of 1-block of size 4 starting at 'muc'. - $(raw (end 4 muc raw)) is the recursive call to the trap with 'raw' replaced by - the last 'muc' blockcs of size - 4 in 'raw'. - Examples: - ~dovryp-toblug/try=> (yell ~2014.3.20..05.42.53..7456) - [d=106.751.991.820.094 h=5 m=42 s=53 f=~[0x7456]] - --- - ~tadbyl-hilbel/try=> (yell ~2014.6.9..19.09.40..8b66) - [d=106.751.991.820.175 h=19 m=9 s=40 f=~[0x8b66]] - --- - ~tadbyl-hilbel/try=> (yell ~1776.7.4) - [d=106.751.991.733.273 h=0 m=0 s=0 f=~] -++ yule - time atom - Description: - Accepts a tarp, a parsed daily time, and produces a time atom, @d. - --- - Creates a dry %gold gate which accepts a tarp. - Casts the result to an atomic date. - Let - - The product of d.rip, , and day:yo, . - Let - - - Examples: - ~tadbyl-hilbel/try=> =murica (yell ~1776.7.4) - ~tadbyl-hilbel/try=> murica - [d=106.751.991.733.273 h=0 m=0 s=0 f=~] - ~tadbyl-hilbel/try=> (yule murica) - 0x8000000b62aaf5800000000000000000 - --- - ~dovryp-toblug/try=> (yule (yell ~2014.3.20..05.42.53..7456)) - 0x8000000d21c88d5d7456000000000000 - --- - ~tadbyl-hilbel/try=> (yule (yell ~2014.6.9..19.09.40..8b66)) - 0x8000000d223413f48b66000000000000 -++ yall - day # to day of year - Description: - Produces what day of the year in year, month, day format a day of - --- - Examples: -++ yawn - days since Jesus - Description: - Accepts a year, month, and day (Three unsigned decimal integers) and produces the date's - CE representation. - --- - Creates a dry %gold gate which accepts three unsigned decimal integers. - Casts the result to an unsigned decimal integer. - Replaces the month and day values on the subject with their decrements. - Replaces the subject of the following with the type of the context. - Evaluates the context with the changes specified below: - - Lets - - Examples: -++ yelp - leap year - Description: - Produces a loobean indicating whether the given Common Era year is a leap year. - --- - Creates a dry %gold gate which accepts an unsigned decimal integer. Casts the result to a loobean. - Produces the logical AND of (0=(mod yer 4)) and the logical OR of (0=(mod yer 100)) and - (0=(mod yer 400)). - Examples: - ~tadbyl-hilbel/try=> (yelp 2.014) - %.n - --- - ~tadbyl-hilbel/try=> (yelp 2.008) - %.y - --- - ~tadbyl-hilbel/try=> (yelp 0) - %.y - --- - ~tadbyl-hilbel/try=> (yelp 14.011) - %.n -++ yo - time constants - Description: - Constants of time referenced in the urbit time section. - --- - Produces a %gold core with |%. - ++ cet - (add 24 (mul 100 365)) - Description: - The number of days in a century. - --- - Derived by multiplying the number of days in a year (365) by the number of yaers in a century (100), - then adding the number days from leap years in a century (24). - Examples: - ~tadbyl-hilbel/try=> cet:yo - 36.524 - --- - ~tadbyl-hilbel/try=> (add 365 cet:yo) - 36.889 - --- - ~tadbyl-hilbel/try=> (sub (add 24 (mul 100 365)) cet:yo) - 0 - ++ day - (mul 24 hor) - Description: - The number of seconds in a day. - --- - Derived by multiplying the the number of seconds in an hour by the hours in a day. - Examples: - ~tadbyl-hilbel/try=> day:yo - 86.400 - --- - ~tadbyl-hilbel/try=> (add 60 day:yo) - 86.460 - ++ era - (add 1 (mul 4 cet)) - Description: - - --- - - Examples: - - ++ hor - (mul 60 mit) - Description: - The number of seconds in an hour. - --- - Derived by multiplying the number of seconds in a minute by the minutes in an hour. - Examples: - ~tadbyl-hilbel/try=> hor:yo - 3.600 - ++ jes - (mul 730.692.561 era) - Description: - - --- - - Examples: - - ++ mit - seconds per minute - Description: - The number of seconds in a minute. - --- - We just knew this one. - Examples: - ~tadbyl-hilbel/try=> mit:yo - 60 - ++ moh - Description: - The days in each month of the Gregorian common year. - --- - A list of unsigned decimal atoms (Either 28, 30, or 31) denoting the number of days in the month at the - year at that index. - Examples: - ~tadbyl-hilbel/try=> moh:yo - ~[31 28 31 30 31 30 31 31 30 31 30 31] - ++ moy - Description: - The days in each month of the Gregorian leap-year. - --- - A list of unsigned decimal atoms (Either 29,30, or 31) denoting the number of days in the month at the - leap-year at that index. - Examples: - ~tadbyl-hilbel/try=> moy:yo - ~[31 29 31 30 31 30 31 31 30 31 30 31] - ++ qad - (add 1 (mul 4 yer)) - Description: - The number of seconds in four years - --- - Derived by adding one second to the number of seconds in four years. - Examples: - ~tadbyl-hilbel/try=> qad:yo - 126.144.001 - ++ yer - (mul 365 day) - Description: - The number of seconds in a year. - --- - Derived by multiplying the number of seconds in a day by 365. - Examples: - ~tadbyl-hilbel/try=> yer:yo - 31.536.000 - -section 2cI, almost macros - -++ hard - demand result type - Description: - Ruthlessly demands that a specific type be produced, crashing the program is it is not. - --- - Creates a vulanized wet gate which accepts any gate which accepts any noun and produces - any noun. - Creates a dry %gold gate which accepts any noun and casts the result to the - higher gate argument's icon. - Prints "%hard" in the stack trace if the code below crashes. - Let gol be the higher gate argument slammed with the lower arbitrary noun. - Assert that the result's icon is equal to that of the lower arbitrary noun - before producing said result. - Examples: - ~palryp-hocsyt/try=> ((hard (list)) (limo [1 2 3 ~])) - ~[1 2 3] - ~tadbyl-hilbel/try=> ((hard ,@) (add 2 2)) - 4 - ~tadbyl-hilbel/try=> ((hard ,@t) (crip "Tape to cord, bro!")) - 'Tape to cord, bro' - ~tadbyl-hilbel/try=> ((hard tape) (crip "...Tape to cord, bro?...")) - ! hard - ! exit -++ soft - politely demand - Description: - Politely requests a specific type to be produced, producing null if it is not. - --- - Creates a vulanized wet gate which accepts any gate which accepts any noun and produces - any noun. - Creates a dry %gold gate which accepts any noun and casts the result to the - a unit of the higher gate argument's icon. - Let gol be the higher gate argument slammed with the lower arbitrary noun. - Build an unless-then-else statement on the result icon's being equal to that of - the lower arbitrary noun. - If so, produce null. - Else, produce the unit of the result. - Examples: - ~tadbyl-hilbel/try=> ((soft ,%4) (add 2 2)) - [~ %4] - ~tadbyl-hilbel/try=> ((soft ,@) (add 2 2)) - [~ 4] - ~tadbyl-hilbel/try=> ((soft ,%5) (add 2 2)) - ~ - ~tadbyl-hilbel/try=> ((soft ,@t) (crip "Tape to cord, Woohoo!")) - [~ 'Tape to cord, Woohoo!'] - ~tadbyl-hilbel/try=> ((soft ,@t) (trip 'Cmon man... Tape to cord? Please?!')) - ~ - -chapter 2d, containers - -section 2dA, sets - -++ apt - set invariant - Description: - Accepts any tree and produces a loobean indicating whether the tree is a set. - --- - Creates a dry %gold gate which accepts a tree. - Builds an if-then-else statement on "a is an atom." - If so, produce true. - Else, compute and produce the logical AND of: - The if "l.a is an atom" then produce true, else (produce the logical AND of the - v-order of n.a and n.l.a and the h-order of n.l.a and n.a) if-then-else statement. - The if "r.a is an atom" then produce true, else (produce the logical AND of the - v-order of n.a and n.r.a and the h-order of n.a and n.r.a) if-then-else statement. - (==) terminates the tall logical AND statement. - Examples - ~tadbyl-hilbel/try=> =b (sa `(list ,@t)`['john' 'bonita' 'daniel' 'madeleine' ~]) - ~tadbyl-hilbel/try=> (apt b) - %.y - --- - ~tadbyl-hilbel/try=> =m (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ['c' 4] ['d' 5] ~]) - ~tadbyl-hilbel/try=> m - {[p='d' q=5] [p='a' q=1] [p='c' q=4] [p='b' q=[2 3]]} - ~tadbyl-hilbel/try=> (apt m) - %.y -++ in - set engine - Description: - Container arm for set operation arms. The contained arms inherit it's sample set, 'a'. - --- - Activate jet. - Creates a %gold trap with sample 'a', a set. - +- all - logical AND - Description: - Accepts a gate which accepts any noun and produces a loobean. Slams the gate with each member - of set 'a', produce the logical AND of the transformed set. - --- - Activate jet. - Creates a wet %gold gate which accepts any gate which produces a loobean. - Creates and kicks a dry %gold gate, casts the result to a loobean. - Builds an if-then-else statement on "a is an atom." - If so, produce true. - Else, produce the logical AND of (b n.a) and the recursive calls of the trap with - 'a' replaced by 'l.a' and 'a' replaced by 'r.a'. - Examples: - ~dovryp-toblug/try=> =b (sa `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~]) - ~dovryp-toblug/try=> (~(all in b) |=(a=* ?@(-.a & |))) - %.n - ~tadbyl-hilbel/try=> =b (sa `(list ,@t)`['john' 'bonita' 'daniel' 'madeleine' ~]) - ~tadbyl-hilbel/try=> (~(all in b) |=(a=@t (gte a 100))) - %.y - +- any - logical OR - Description: - Accepts a gate which accepts any noun and produces a loobean. Slams the gate with each member - of set 'a', produce the logical OR of the transformed set. - --- - Activate jet. - Creates a wet %gold gate which accepts any gate which produces a loobean. - Creates and kicks a dry %gold gate, casts the result to a loobean. - Builds an if-then-else statement on "a is an atom." - If so, produce false. - Else, produce the logical OR of (b n.a) and the recursive calls of the trap with - 'a' replaced by 'l.a' and 'a' replaced by 'r.a'. - Examples: - ~dovryp-toblug/try=> =b (sa `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~]) - ~dovryp-toblug/try=> (~(any in b) |=(a=* ?@(+.a & |))) - %.y - ~tadbyl-hilbel/try=> =b (sa `(list ,@t)`['john' 'bonita' 'daniel' 'madeleine' ~]) - ~tadbyl-hilbel/try=> (~(any in b) |=(a=@t (lte a 100))) - %.n - +- del - b without any a - Description: - Accepts any noun 'b' and removes it from the set 'a'. - --- - Activate jet. - Creates a wet %gold gate which accepts any noun. - Creates and kicks a dry %gold gate, casts the result to the type of 'a'. - Builds an if-then-else statement on "a is null." - If so, produce null. - Else, builds an unless-then-else on (b=n.a) - If so, build an if-then-else statement by testing the h-order of 'b' and 'n.a'. - If so, produce a the cell [n.a $(a l.a) r.a], where $(a l.a) is the recursive call of - the trap with 'a' replaced by the left - Examples: - ~dovryp-toblug/try=> =b (sa `(list ,@t)`[`a` `b` `c` ~]) - ~dovryp-toblug/try=> (~(del in b) `a`) - {`c` `b`} - --- - ~tadbyl-hilbel/try=> =b (sa `(list ,@t)`['john' 'bonita' 'daniel' 'madeleine' ~]) - ~tadbyl-hilbel/try=> (~(del in b) 'john') - {'bonita' 'madeleine' 'daniel'} - --- - ~tadbyl-hilbel/try=> (~(del in b) 'susan') - {'bonita' 'madeleine' 'daniel' 'john'} - - +- dig - axis of b in a - Description: - Produces - --- - Creates a dry %gold gate which accepts a single noun. - Let 'c' be 1. - Creates and kicks a dry %gold trap. Casts the result to an atomic unit. - Builds an if-then-else statement on "a is null." If so, produce null. - Else, build an if-then-else statement on (b=n.a). If so, produce the unit [~ u=(peg c 2)]. - Else, build an if-then-else statement on the g-order of 'b' and 'n.a' - If so, produce the recursive call of the trap with 'a' replaced by 'l.a' and 'c' replaced by (peg c 6). - Else, produce the recursive call of the trap with 'a' replaced by 'r.a' and 'c' replaced by (peg c 7). - Examples: - ~talsur-todres/try=> =a (sa `(list ,@)`[1 2 3 4 5 6 7 ~]) - ~talsur-todres/try=> a - {5 4 7 6 1 3 2} - ~talsur-todres/try=> -.a - n=6 - ~talsur-todres/try=> (~(dig in a) 7) - [~ 12] - ~talsur-todres/try=> (~(dig in a) 2) - [~ 14] - ~talsur-todres/try=> (~(dig in a) 6) - [~ 2] - +- gas - concatenate - Description: - Accepts a list 'b' with members of the same type as the set 'a' and produces - the union set of 'a' and 'b'. - --- - Activate jet. - Creates a dry %gold gate which accepts a list of elements of the same type as 'a'. - Creates and kicks a dry %gold trap whose result is cast to the type of 'a'. - Builds an if-then-else statement on "b is an atom." - If so, produce 'a'. - Else, recursively call the trap with 'b' replaced by the tail of 'b' and the head of 'b' - put into 'a'. - Examples: - ~tadbyl-hilbel/try=> b - {'bonita' 'madeleine' 'rudolf' 'john'} - ~tadbyl-hilbel/try=> (~(gas in b) `(list ,@t)`['14' 'things' 'number' '1.337' ~]) - {'1.337' '14' 'number' 'things' 'bonita' 'madeleine' 'rudolf' 'john'} - --- - ~tadbyl-hilbel/try=> (~(gas in s) `(list ,@t)`['1' '2' '3' ~]) - {'1' '3' '2' 'e' 'd' 'a' 'c' 'b'} - +- has - b exists in a check - Description: - Accepts any noun and produces the loobean indicating whether or not that value (n.a) exists in 'a'. - --- - Activate jet. - Creates a wet %gold gate which accepts any noun. - Creates and kicks a dry %gold trap. Casts the result to a loobean. - Builds an if-then-else statement on "The set (a) is an atom." If so, produce false. - Else, build an if-then-else statement on (b=n.a). - If so, produce true. - Else, build an if-then-else statement on the h-order of 'b' and 'n.a' - If so, produce the recursive call to the trap with 'a' replaced by 'l.a' - If so, produce the recursive call to the trap with 'a' replaced by 'r.a' - Examples: - ~dovryp-toblug/try=> =a (~(gas in `(set ,@t)`~) `(list ,@t)`[`a` `b` `c` ~]) - ~dovryp-toblug/try=> (~(has in a) `a`) - %.y - ~dovryp-toblug/try=> (~(has in a) 'z') - %.n - +- put - Accept any noun 'b' and produce the set 'a' with 'b' added to its sorted location. - --- - Activate jet. - Creates a wet %gold gate which accepts any atom. - Creates and kicks a dry %gold gate. Casts the result to the type of set 'a'. - Builds an if-then-else statement on "a is an atom." - If so, produce the null-terminated tuple [b ~ ~]. - Else, build an if-then-else statement on (b=n.a). - If so, produce the set 'a'. - Else, build an if-then-else statement on the h-order of 'b' and 'n.a'. - If so, let 'c' be the recursive call of the trap with 'a' replaced by 'l.a'. - Then, assert that 'c' is a cell. - Build an if-then-else statement on the v-order of 'n.a' and 'n.c'. - If so (their v-order is true), produce the tuple [n.a c r.a] - Else, produce [n.c l.c [n.a r.c r.a]]. - Else (if 'b' and 'n.a' are not well h-ordered.), let 'c' be the recursive call of the trap with - 'c' replaced 'r.a'. - Then, assert that 'c' is a cell. - Builds an if-then-else statement on the v-order of 'n.a' and 'n.c' - If so, produce [n.a l.a c] - Else, produce [n.c [n.a l.a l.c] r.c]. - Examples: - ~talsur-todres/try=> =a (~(gas in `(set ,@t)`~) `(list ,@t)`[`a` `b` `c` ~]) - ~talsur-todres/try=> =b (~(put in a) `d`) - ~talsur-todres/try=> b - {`d` `a` `c` `b`} - ~talsur-todres/try=> -.l.+.b - n=`d` - +- rep - Accept a noun and a binary gate. Produce the 'a' with each member 'n.a' replaced by (c n.a b). - --- - XXX - Creates a wet %gold gate which accpets a noun and a tile, 'a' and 'b'. - Creates and kicks a dry %gold gate. - Builds an if-then-else statement on "a is null." If so, produce 'b'. - Else, recursively call the trap with 'a' replaced by 'r.a' and - 'b' replaced by the recursive call of the trap with 'a' replaced by 'l.a' and 'b' replaced by - (c n.a b). - --- - ~talsur-todres/try=> =a (~(gas in *(set ,@)) [1 2 3 ~]) - ~talsur-todres/try=> a - {1 3 2} - ~talsur-todres/try=> (~(rep in a) 0 |=([a=@ b=@] (add a b))) - 6 - --- - XXX - - +- tap - Accept a list of elements of the set and produce a cell of the set with the list concatenated. - --- - Activate jet. - Build dry %gold gate with sample list of the same - Cast the following to the type of `b` - If: `a` is null, - Then: Produce `b`, - Else: Produce the toss of `a` for `r.a`, `b` for [n.a $(a l.a)]), - where $(a l.a) is the toss of `a` for the left twig of `a`. - --- - ~tadbyl-hilbel/try=> =s (sa `(list ,@t)`['a' 'b' 'c' 'd' 'e' ~]) - ~tadbyl-hilbel/try=> s - {'e' 'd' 'a' 'c' 'b'} - --- - ~tadbyl-hilbel/try=> (~(tap in s) `(list ,@t)`['1' '2' '3' ~]) - ~['b' 'c' 'a' 'd' 'e' '1' '2' '3'] - --- - ~tadbyl-hilbel/try=> b - {'bonita' 'madeleine' 'daniel' 'john'} - ~tadbyl-hilbel/try=> (~(tap in b) `(list ,@t)`['david' 'people' ~]) - ~['john' 'daniel' 'madeleine' 'bonita' 'david' 'people'] - +- wyt - Produce the cardinality (number of elements) of the set. - --- - Increment the following. - Kick dry %gold trap. Yield atom. - If: `a` is null, - Then: Produce 0. - Else: Produce the increment of the sum of: - The toss of `a` for `l.a`, the left twig of `a`. - The toss of `a` for `r.a`, the right twig of `a`. - --- - ~talsur-todres/try=> =a (~(gas in `(set ,@t)`~) `(list ,@t)`[`a` `b` `c` ~]) - ~talsur-todres/try=> ~(wyt in a) - 4 - --- - ~tadbyl-hilbel/try=> b - {'bonita' 'madeleine' 'daniel' 'john'} - ~tadbyl-hilbel/try=> ~(wyt in b) - 5 - -section 2dB, maps - -++ ept - map invariant - Description: - Accepts a tree of cell paris and produces the loobean indicating whther the tree is a map - or not. - --- - Creates a dry %gold gate which accepts a tree of cell pairs. - If "a is an atom", produce true. - Else, produce the logical AND of: - If "l.a is an atom", produce true. Else, produce the logical AND of the v-order of 'p.n.a' precedes 'p.n.l.a' - and the h-order of 'p.n.l.a' precedes 'p.n.a'. - If "r.a is an atom" produce true. Else, produce the logical AND of the v-oreder of 'p.n.a' precedes 'p.n.r.a' - and the h-roder of 'p.n.a' precedes 'p.n.r.a'. - (==) terminates the AND statement. - Examples: - ~tadbyl-hilbel/try=> m - {[p='d' q=5] [p='a' q=1] [p='c' q=4] [p='b' q=[2 3]]} - ~tadbyl-hilbel/try=> (ept m) - %.y - --- - ~tadbyl-hilbel/try=> b - {'bonita' 'madeleine' 'daniel' 'john'} - ~tadbyl-hilbel/try=> (ept b) - ! type-fail - ! exit - --- -++ ja - The jar engine: A container arm for jar operation arms. Jars are maps of lists. - The contained arms inherit it's sample jar. 'a'. - --- - Build a wet %gold tray with a sample jar `a`... - +- get - Retrieve a list from the map by its key. - --- - Build wet %gold gate with sample noun `b` - Push `d` is the slug of by to get with `a` slammed with `b`. - If: `c` is null, - Then: Produce null, - Else: Produce `u.c`, the unit value of `c` - --- - - - +- add - Add a key-list value to the jar. - --- - Build wet %gold gate with sample noun `b`, noun `c` - Push `d` is the call of get with the subject replaced by `a`, slammed with `b` - Produce the slam of by to put with `a` slammed with `b` and [c d]. - --- - - --- - Terminate the core. - -++ ju - The jug engine: container arm for jug operation arms. Jugs are maps of sets. - The contained arms inherit it's sample jug, 'a'. - --- - Build a wet %gold tray with a sample jug `a`. - +- del - Delete a value in a set and produce the resulting jug. - --- - Build wet %gold gate with sample noun `b`, noun `c` - Cast the following to the type of `a` - Push `d` is the call of get with the subject replaced by `a`, slammed with `b` - Push `e` is slug del to in by `d` slammed with `c` - If: `e` is null, - Then: Slug tray by to del with `a` slammed with `b` - Else: Produce the slug tray by to put with `a` slammedw ith `b`, `e`. - --- - - +- get - Retrieve a set from the map by its key. - --- - Build wet %gold gate with sample noun `b` - Push `c` is the slug of by to get with `a` slammed with `b` - If: `c` is null, - Then: Produce null, - Else: Produce `u.c`, the unit value of `c` - --- - - +- has - Is the element `c` in the set `b`? - --- - Build wet %gold gate with sample noun `b`, noun `c` - Yield boolean. - Produce the slug of in to has with the call of get with the subject replaced by `a` slammed with: - `b`, a set., slammed with: - slammed with `c`. - I.e.: Check if `c` is in the set which is the value of the map key `b`. - --- - - +- put - Add a value to a specific set in the jug. - --- - Build wet %gold gate with sample noun b. noun c. - Yield bean. - Push `d` is the call of get with the subject replaced by `a`, slammed with `b` - Produce the slug of by to put with `a` slammed with: - `b`, slammed with: - The slug of in to put by `d` slammed with `c`. - --- - -++ by - Container arm for map operation arms. The contained arms inherit it's sample map, 'a'. - --- - Activate jet. - Builds a %gold tray with a sample which accepts a map. - +- all - Accepts a gate which accepts any noun and produces a loobean. Slams the gate with each member - of map 'a', produce the logical AND of the transformed map. - --- - Activate jet. - Builds a wet %gold gate which accepts the tile of a gate accepts any noun and produces a loobean. - Creates and kicks a dry %gold gate. Casts the result to loobean. - Builds an if-then-else statement on "a is an atom." - If so, produce true. - Else, produce the logical AND of (b q.n.a), the recursive call of the trap with 'a' replaced by - 'l.a', and the recursive call of the trap with 'a' replaced by 'r.a'. - Examples: - ~talsur-todres/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~]) - ~talsur-todres/try=> (~(all by b) |=(a=* ?@(a & |))) - %.n - --- - ~tadbyl-hilbel/try=> =a (mo `(list ,[@t @u])`[['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~]) - ~tadbyl-hilbel/try=> (~(all by a) |=(a=@ (lte a 6))) - %.y - ~tadbyl-hilbel/try=> (~(all by a) |=(a=@ (lte a 4))) - %.n - +- any - Accepts a gate which accepts any noun and produces a loobean. Slams the gate with each member - of map 'a', produce the logical OR of the transformed map. - --- - Activate jet. - Builds a wet %gold gate which accepts the tile of a gate accepts any noun and produces a loobean. - Creates and kicks a dry %gold gate. Casts the result to loobean. - Builds an if-then-else statement on "a is an atom." - If so, produce false. - Else, produce the logical OR of (b q.n.a), the recursive call of the trap with 'a' replaced by - 'l.a', and the recursive call of the trap with 'a' replaced by 'r.a'. - Examples: - ~talsur-todres/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~]) - ~talsur-todres/try=> (~(all by b) |=(a=* ?@(a & |))) - %.y - --- - ~tadbyl-hilbel/try=> =a (mo `(list ,[@t @u])`[['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~]) - ~tadbyl-hilbel/try=> (~(any by a) |=(a=@ (lte a 4))) - %.y - +- del - delete at key b - Description: - Accepts a noun 'b', producing the map with the key-value pair of key 'b' removed. - --- - Activate jet. - Creates a wet %gold gate which accepts a noun. - Creates and kicks a dry %gold trap. Casts the result to the type of map 'a'. - Builds an if-then-else statement on "a is null." - If so, produce null. - Else, build an unless-then-else statement on (b=(p.n.a)). - If so, build the if-then-else statement on the g-order of 'b' and 'p.n.a'. - If so, produce the the tuple [n.a $(a l.a) r.a] where $(a l.a) is the recursive call of the - trap with 'a' replaced by 'l.a'. - Else (g-order of 'b' and 'p.n.a' is not true.), produce [n.a l.a $(a r.a)]. - Else (!(b=(p.n.a))), create and kick a dry %gold trap. - Cast the result to a fork between null and the tile of the map 'a'. - Builds an if-then-else statement on "l.a is null." If so, produce 'r.a'. - Else, build an if-then-else statement on "r.a is null." If so, produce 'l.a'. - Else, build an if-then-else statement on the v-order of 'p.n.l.a' and 'p.n.r.a'. - If so, produce [n.l.a l.l.a $(l.a r.l.a)],where $(l.a r.l.a) is the recursive call of the - trap with 'l.a' replaced by 'r.l.a'. - Else, produce [n.r.a $(r.a l.r.a) r.r.a], ,where $(r.a l.r.a) is the recursive call of the - trap with 'r.a' replaced by 'l.r.a'. - Examples: - ~talsur-todres/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~]) - ~talsur-todres/try=> (~(del by b) `a`) - {[p=`b` q=[2 3]]} - - +- dig - axis of 'b' key - Description: - Accepts any noun 'b' and produces the axis of 'b' in within the values of 'p.a' in map 'a'. - --- - Creates a wet %gold gate which accepts a noun. - Let 'c' be 1. - Creates and kicks a dry %gold gate. Casts the result to an atomic unit. - Builds an if-then-else statement on "a is null." If so, produce null. - Else, build an if-then-else statement on (b=(p.n.a.)). If so, produce the unit [~ u=(peg c 2)]. - Else, build an if-then-else statement on the g-order of 'b' and 'p.n.a'. - If so, recursively call the trap with 'a' replaced by 'l.a' and 'c' by (peg c 6). - Else, recursively call the trap with 'a' replaced by 'r.a' and 'c' by (peg c 7). - Examples: - ~talsur-todres/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~]) - ~talsur-todres/try=> (~(dig by b) `b`) - [~ 2] - - +- gas - concatenate - Description: - Accepts any list 'b' of key-value pair cells and produces the map 'a' with the members of 'b' added. - --- - Activate jet. - Creates a wet %gold gate which accepts a list of cells. - Replaces 'b' in the subject with the cast of 'b' to a list whose members have the - same type as the members of 'a'. - Creates and kicks a dry %gold trap. Casts the result to the type of map 'a'. - Builds an if-then-else statement on "b is an atom." - If so, produce 'a'. - Else, recursively call the trap iwth 'b' replaced by the tail of 'b' and 'a' replaced by - 'a' with the key and value of the head of 'b' added to it. - Examples: - ~talsur-todres/try=> =a (mo `(list ,[@t *])`[[`a` 1] [`b` 2] ~]) - ~talsur-todres/try=> =b `(list ,[@t *])`[[`c` 3] [`d` 4] ~] - ~talsur-todres/try=> (~(gas by a) b) - {[p=`d` q=4] [p=`a` q=1] [p=`c` q=3] [p=`b` q=2]} - +- get - grab value by key - Description: - Produces the value in the map at key 'b'. - --- - Creates a wet %gold gate which accepts a noun. - Creates and kicks a dry %gold trap. Casts its result to the type of the map's values. - Builds an if-then-else statement on "a is an atom." - If so, produces null. - Else, build an if-then-else statement on (b=(p.n.a)). - If so, produce the unit [~ u=p.n.a]. - Else, build an if-then-else statement on the g-order of 'b' and 'p.n.a'. - If so, produce the recursive call to the trap with 'a' replaced by 'l.a'. - Else, produce the recursive call to the trap with 'a' replaced by 'r.a'. - Examples: - ~talsur-todres/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~]) - ~talsur-todres/try=> (~(get by b) `b`) - [~ [2 3]] - +- has - key existence check - Description: - Accepts any noun 'b' and produces the loobean indicating whether the noun exists in map 'a'. - --- - Activate jet. - Creates a wet %gold gate which accepts a noun. - Attempts to get 'b' from 'a', then produces the logical NOT of the loobean "get 'b' in 'a' is null" - Examples: - ~talsur-todres/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~]) - ~talsur-todres/try=> (~(has by b) `b`) - %.y - ~talsur-todres/try=> (~(has by b) `c`) - %.n - +- mar - add with validation - Description: - Accepts two nouns of the types of the map's keys and values, respectively. - Validates that the value is not null and puts the pair in the map. If the value is null, - it deletes the key. - --- - Creates a wet %gold gate which accepts a cell of two nouns: one of the type of the map's keys - and one a unit of the map's value type. - If "c is null", produce the map with 'b' deleted. - Else, produce the map with the 'b' and 'u.c' key-value pair added. - Examples: - - +- put - - --- - Activate jet. - Build a wet %gold gate with sample noun `b`, noun `c` - - Creates and kicks a dry %gold trap. Casts the result to the type of the map 'a'. - If "a is an atom", produce the cell [[b c] ~ ~]. - Else, build the if-then-else statement if - --- - - +- rep - replace by product - Description: - Walks through the map, replacing 'b' with the product of (c n.a b). Produces the resulting - map. - --- - Creates a wet %gold gate which accepts a noun and a gate. - Creates and kicks a dry %gold trap. - If "a is null", produce 'b'. - Else, produce the recursive call to the trap with 'a' replaced by 'r.a' and 'b' replaced by - the recursive call to the trap with 'a' replaced by 'l.a' and b replaced by - the product (c n.a b). - Examples: - - +- rib - transform + product - Description: - - --- - - Examples: - - +- run - turns to tuples - Description: - --- - Examples: - +- tap - listify pairs - Description: - --- - Examples: - +- uni - union, merge - Description: - --- - Examples: - +- wyt - depth of map - Description: - --- - Examples: - -section 2dC, queues - -++ to - queue engine - Description: - Container arm for queue operation arms. The contained arms inherit it's sample queue, 'a'. - --- - Builds a wet %gold tray with sample 'a' of type 'qeu'. - +- bal - v-order queue - Description: - Walks through the queue using vor (v-order check) on all eleements. - --- - Creates and kicks a dry %gold trap. Casts the result to the type of the queue 'a'. - If "a is null", produce null. - Else, build an unless-then-else statement on the logical OR of: - "null is in l.a" - "n.a" precedes "n.l.a" in v-order. - If so, produce the recursive call to the trap with 'a' replaced by [n.l.a l.l.a $(a [n.a r.l.a r.a])] - Else, build an unless-then-else statement on the logical OR of: - "null is in r.a" - "n.a" precedes "n.r.a" in v-order. - If so, produce the recursvie call to the trap with 'a' replaced by [n.r.a $(a [n.a l.a l.r.a]) r.r.a]. - Examples: - ~palryp-hocsyt/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[6 1 3 6 1 3 4 6 ~]) - ~palryp-hocsyt/try=> a - {6 4 3 1 6 3 1 6} - ~palryp-hocsyt/try=> ~(bal to a) - {6 4 3 1 6 3 1 6} - --- - - +- dep - max depth of queue - Description: - Produces the maximum depth of leaves (r.a and l.a) in the queue 'a'. - --- - Creates and kicks a dry %gold trap. Casts the result to an atom. - If "a is null", produce 0. - Else, increment the maximum of the recursive calls of the 'dep' to the left and right leaves of 'a', - $(a l.a) and $(a r.a). - Examples: - ~palryp-hocsyt/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 5 6 7 ~]) - ~palryp-hocsyt/try=> ~(dep to a) - 4 - --- - ~palryp-hocsyt/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 ~]) - ~palryp-hocsyt/try=> ~(dep to a) - 3 - --- - ~palryp-hocsyt/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 ~]) - ~palryp-hocsyt/try=> ~(dep to a) - 2 - +- gas - insert list to que - Description: - Accepts a - --- - Creates a dry %gold gate which accepts a list of the elements of the queue. - Creates and kicks a dry %gold gate. Casts the result to the type of 'a', the queue. - If "b is null", produce 'a'. - Else, Produce the recursive call to the trap with 'b' replaced by the tail of 'b' and 'a' replaced by the - result of putting the head of 'b' into 'a'. - Examples: - ~palryp-hocsyt/try=> (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 ~]) - {3 2 1} - --- - ~palryp-hocsyt/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 ~]) - ~palryp-hocsyt/try=> =b `(list ,@)`[4 5 6 ~] - ~palryp-hocsyt/try=> (~(gas to a) b) - {6 5 4 3 2 1} - +- get - head-tail pair - Description: - Produces the queue 'a' in the format [p=head q=tail]. - --- - Creates and kicks a dry %gold trap. Casts the head term of the resulting tuple to the type of the queue's elements - and the tail type to that of the queue itself. - If "a is null", crash the program. - Else, if "r.a is null", produce [n.a l.a]. - Else, let 'b' be the recursive call of the trap with 'a' replaced by 'r.a'. - Produce the the following as a [p q] cell: - As the p term, 'p.b' - As the q term, the result of the if-then-else statement: - If "null is in q.b" OR 'n.a' precedes 'n.q.b' in the v-order, - produce [n.a l.a q.b]. - Else, produce [n.q.b [n.a l.q.b] r.q.b]. - Examples: - - +- nap - removes head - Description: - Removes the head of a queue, producing the resulting queue. - --- - Assert that 'a' is a cell. - Builds an if-then-else statement on "l.a is null". If so, produce r.a. - Else, let 'b' be the result of getting the [p=head q=tail] pair from 'l.a'. - Produce the queue v-order of bal(+< ^+(a [p.b q.b r.a])). - Examples: - ~talsur-todres/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 5 6 ~]) - ~talsur-todres/try=> -.a - n=6 - ~talsur-todres/try=> =b ~(nap to a) - ~talsur-todres/try=> -.b - n=2 - ~talsur-todres/try=> b - {5 4 3 2 1} - ~talsur-todres/try=> a - {6 5 4 3 2 1} - +- put - insert new head - Description: - Accepts any noun and adds to the queue as the head, producing the resutling queue. - --- - Creates a wet %gold gate which accepts any noun. - Creates and kicks a dry %gold trap. Casts the result to the type of the queue 'a'. - If "a is null", produce [b ~ ~]. - Else, produce bal(+< a(l $(a l.a))). - - Examples: - ~dovryp-toblug/try=> (~(gas to `(qeu ,@)`~) `(list ,@)`[3 1 2 4 5 6 ~]) - ~dovryp-toblug/try=> (~(put to a) 7) - {7 6 5 4 2 1 3} - +- tap - adds list to end - Description: - Concatenates two lists from the first - --- - Creates a dry %gold gate which accepts a list of elements of the type of the queue's elements. - Casts the result to the type of 'b', the list. - If "a is null", produce 'b'. - Else, produce the recursive call to the gate with 'a' replaced by 'r.a' and 'b' replaced by [n.a $(a l.a)], - where $(a l.a) is the recursive call to the trap with 'a' replaced by 'l.a'. - Examples: - ~dovryp-toblug/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[3 1 2 4 5 6 ~]) - ~dovryp-toblug/try=> (~(tap to a) `(list ,@)`[99 100 101 ~]) - ~[3 1 2 4 5 6 99 100 101] - +- top - produces head - Description: - - --- - Creates and kicks a dry %gold trap. Casts the result to a unit of the type of the queue's element. - If "a is null", produce null. - Else, if "the right leaf of 'a' is null", produce [~ n.a]. - Else, produce $(a r.a), the recursive call to the trap with 'a' replaced by 'r.a'. - Examples: - ~talsur-todres/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 5 6 ~]) - ~talsur-todres/try=> ~(top to a) - [~ 1] - -section 2dD, casual containers - -++ mo - make a map - Description: - Mapifiy. Accepts a list of cells and produces a map of key-value pairs from the left-right cell pairs of the list. - --- - Creates a wet %gold gate which accepts a list, 'a'. - Pushes the homogenized list onto the context. - Casts the list 'a' to a list of cells whose left-right types correspond to the key-value type pairs. - Let 'b' be the bunt of the map with the properly typed keys and values from the cell at the head of our list. - Concatenate the elements of 'a' into the empty map of bunt 'b', and produce the result. - Examples: - ~talsur-todres/try=> (mo `(list ,[@t *])`[[`a` 1] [`b` 2] ~]) - {[p=`a` q=1] [p=`b` q=2]} - -++ sa - make a set - Description: - Setify. Accepts a list and produces a set of the list's elements. - --- - Creates a wet %gold gate which accepts a list, 'a'. - Pushes the homogenized list onto the context. - Let 'b' be the bunt of the set with elements of the same type of the elements of 'a'. - Concatenate the elements of 'a' into the empty set of bunt 'b', and produce the result. - Examples: - ~talsur-todres/try=> (sa `(list ,@)`[1 2 3 4 5 ~]) - {5 4 1 3 2} - --- - ~talsur-todres/try=> (sa `(list ,[@t *])`[[`a` 1] [`b` 2] ~]) - {[`a` 1] [`b` 2]} -++ qu - make a set - Description: - XXX THIS APPEARS TO BE A COPY OF ++sa. QUEUIFY IS NOT IMPLEMENTED YET. XXX - --- - Examples: - -chapter 2e, miscellaneous libs - -section 2eA, packing - -++ cue - Unpack an atom to a noun. The inverse of jam. - --- - Activate jet. - Build dry %gold gate with sample atom `a`. - Yield noun. - Push `b` is 0. - Push `m` is empty map of type (map ,@ ,*). - Seek subject for q. - Kick dry %gold trap, yield tuple [p=@ q=* r=_m] - If (0=(cut 0 [b 1] a)), - Then, push `c` is (rub +(b) a). - Produce - - --- - ~midlys-rocpet/try=> (cue (jam 1)) - 1 - ~midlys-rocpet/try=> (cue 4.657) - [1 2] - ~midlys-rocpet/try=> (cue (jam [1 1])) - [1 1] - ~tadbyl-hilbel/try=> (cue 39.689) - [0 19] -++ jam - Compress a noun to an atom. The inverse of cue. - --- - Activate jet. - Build wet %gold gate with sample noun `a`. - Yield atom. - Push `b` is 0. - Push `m` is empty may of type (map ,@ ,*). - - --- - ~midlys-rocpet/try=> (jam 1) - 12 - ~midlys-rocpet/try=> (jam [1 1]) - 817 - ~tadbyl-hilbel/try=> (jam [~ u=19]) - 39.689 -++ mat - Encodes length. Only used internally as helper function to jam and cue. - --- - Activate jet. - Build dry %gold gate with sample atom a. - Yield atom a, atom b. - If: a is 0. - Then: Produce [1 1] - Else, push `b` is (met 0 a), the number of bits in `a`. - Push `c` is (met 0 b), the number of bits in `b`. - Produce pair: - (add (add c c) b) and - (cat 0 (bex c) (mix (end 0 (dec c) b) (lsh 0 (dec c) a))) -++ rub - Decodes length. Only used internally as a helper function to jam and cue. - --- - Activate jet. - Build wet %gold gold with sample atom a, atom b. - Yield atom p, atom q. - Push label `c` on: - Push `c` is 0, m is (met 0 b), the number of bits in `b`. - Kick dry %gold trap. Deny that (gth c m), `c` is greater than `m`. - Unless: (cut 0 [(add a c) 1] b)) is 0, - Then: `c` - Else: Slam trap with +(c) - If: c is 0, - Then: Produce [1 0]. - Else, push `d` is (add a +(c)) - Push `e` is (add (bex (dec c)) (cut 0 [d (dec c)] b)). - Produce [(add (add c c) e) (cut 0 [(add d (dec c)) e] b)] - -section 2eB, parsing (tracing) - -++ last - Compare two [line column] pairs and produce the one which is farther along in text. - --- - Build dry %gold gate with sample hair `zyc`, hair `naz` - Yield hair. - If: p.zyc is p.naz, - Then: If: q.zyc is greater than q.naz, - Then: Produce zyc, - Else: Produce naz. - Else: If: p.zyc is greater than p.naz, - Then: Produce zyc, - Else: Produce naz. - --- - ~tadbyl-hilbel/try=> (last [1 1] [1 2]) - [p=1 q=2] - ~tadbyl-hilbel/try=> (last [2 1] [1 2]) - [p=2 q=1] - ~tadbyl-hilbel/try=> (last [0 0] [99 0]) - [p=99 q=0] - ~tadbyl-hilbel/try=> (last [7 7] [7 7]) - [p=7 q=7] -++ lust - Produce the beginning of the next line after a newline character or increment the column number - The index of the next character to be parsed. - --- - Build dry %gold gate with sample char `weq`, hair `naz` - Yield hair. - If: `weq` is 10, - Then: Produce [+(p.naz) 1]. - Else: Produce [p.naz +(q.naz)]. - --- - ~tadbyl-hilbel/try=> (lust `a` [1 1]) - [p=1 q=2] - ~tadbyl-hilbel/try=> (lust `@t`10 [1 1]) - [p=2 q=1] - ~tadbyl-hilbel/try=> (lust '9' [10 10]) - [p=10 q=11] - ~tadbyl-hilbel/try=> (lust `@t`10 [0 0]) - [p=1 q=1] - -section 2eC, parsing (custom rules) - -++ cold - Build gate to parse a nail with a rule, then replaced the parsed texted with a constant. - --- - Activate jet. - Build wet %gold gate with sample noun `cus`, bunt of a rule `sef`. - Activate extra parsing jet. - Build dry %gold gate with sample nail `tub`. - Push `vex` is the rule `sef` slammed by the nail `tub`, an edge. - If: q.vex is an atom, - Then: Produce `vex` - Else: Produce [p=p.vex q=[~ u=[p=cus q=q.u.q.vex]]] - --- - ~midlys-rocpet/try=> ((cold %foo (just `a`)) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=%foo q=[p=[p=1 q=2] q="bc"]]]] - ~midlys-rocpet/try=> ((cold %foo (just `a`)) [[1 1] "bc"]) - [p=[p=1 q=1] q=~] -++ cook - Build gate to parse a nail with a rule, then slam a gate with the parsed text. - --- - Activate jet. - Build wet %gold gate with sample clam gate `poq`, bunt of a rule `sef`. - Activate extra parsing jet. - Build dry %gold gate with sample nail `tub`. - Push `vex` is the rule `sef` slammed by the nail `tub`, an edge. - If: `q.vex` is an atom, - Then: Produce `vex` - Else: Produce [p=p.vex q=[~ u=[p=(poq p.u.q.vex) q=q.u.q.vex]]], - where (poq p.u.q.vex) is gate `poq` slammed with the parsed text. - --- - ~midlys-rocpet/try=> ((cook ,@ud (just `a`)) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]] - ~midlys-rocpet/try=> ((cook ,@tas (just `a`)) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=%a q=[p=[p=1 q=2] q="bc"]]]] - ~midlys-rocpet/try=> ((cook |=(a=@ +(a)) (just `a`)) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=98 q=[p=[p=1 q=2] q="bc"]]]] - ~midlys-rocpet/try=> ((cook |=(a=@ `@t`+(a)) (just `a`)) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=`b` q=[p=[p=1 q=2] q="bc"]]]] -++ easy - Succeed but consume no characters - Produce an edge at the same text position with the text to parse unchanged, but with a - --- - Activate jet. - Build wet %gold gate with sample noun, `huf`, a noun to produce as the parsed value. - Activate extra parsing jet. - Build dry %gold date with sample nail, `tub` - Yield edge of type `huf` - Produce [p=p.tub q=[~ u=[p=huf q=tub]]], the edge with the noun `huf` as it's parsed value and `tub` as unparsed. - --- - ~tadbyl-hilbel/try=> ((easy %foo) [[1 1] "abc"]) - [p=[p=1 q=1] q=[~ [p=%foo q=[p=[p=1 q=1] q="abc"]]]] - ~tadbyl-hilbel/try=> ((easy %foo) [[1 1] "bc"]) - [p=[p=1 q=1] q=[~ [p=%foo q=[p=[p=1 q=1] q="bc"]]]] - ~tadbyl-hilbel/try=> ((easy 'a') [[1 1] "bc"]) - [p=[p=1 q=1] q=[~ [p='a' q=[p=[p=1 q=1] q="bc"]]]] -++ fail - Fail to parse - Produce a nail at the same text position but with null text. - --- - Build wet %gold gate with sample nail, `tub`. - Produce nail [p=p.tub q=~]. - --- - ~tadbyl-hilbel/try=> (fail [[1 1] "abc"]) - [p=[p=1 q=1] q=~] - ~tadbyl-hilbel/try=> (fail [[p=1.337 q=70] "Parse me, please?"]) - [p=[p=1.337 q=70] q=~] -++ full - Demand politely that the parsing rule parse the entire sample nail, produce a null edge otherwise. - --- - Build wet %gold gate with sample rule, `sab` - Build dry %gold gate with sample nail `tub` - Push `vex` is the rule slammed with the text to parse. - If: Parse of `vex` is null, - Then: Produce `vex` - Else: If: The unparsed text in the produced edge is nulll, - Then: Produce `vex` - Else: Produce [p=p.vex q=~], the edge with a null unit nail. - --- - ~tadbyl-hilbel/try=> ((full (just 'a')) [[1 1] "ab"]) - [p=[p=1 q=2] q=~] - ~tadbyl-hilbel/try=> ((full (jest 'ab')) [[1 1] "ab"]) - [p=[p=1 q=3] q=[~ u=[p='ab' q=[p=[p=1 q=3] q=""]]]] - ~tadbyl-hilbel/try=> ((full ;~(plug (just 'a') (just 'b'))) [[1 1] "ab"]) - [p=[p=1 q=3] q=[~ u=[p=[~~a ~~b] q=[p=[p=1 q=3] q=""]]]] -++ funk - Prepend a tape to the text to be parsed, then parse the new tape. - --- - Build wet %gold gate with sample tape `pre`, rule `sef` - Build dry %gold gate with sample nail, `tub` - Produce the rule slammed with the hair index of `tub` and the concatenation of - the prefix tape and the `tub` tape. - --- - ~tadbyl-hilbel/try=> ((funk "abc prefix-" (jest 'abc')) [[1 1] "to be parsed"]) - [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=" prefix-to be parsed"]]]] - ~tadbyl-hilbel/try=> ((funk "parse" (just 'a')) [[1 4] " me"]) - [p=[p=1 q=4] q=~] -++ here - Apply rule if parsing within a specific line and column range. - --- - Activate jet. - Build wet %gold gate with sample bunted gate accepting pint `a`, noun `b` and producing cell [a b], and bunt of rule `sef` - Activate extra parsing jet. - Build dry %gold gate with sample nail `tub` - Push `vex` is the rule `sef` slammed by the nail `tub`, an edge. - If: `q.vex` is an atom, - Then: Produce `vex`, - Else: Produce the hair, - p is `q.tub` - q is the unit: - Null - u is: - p is `hez` slammed with the pint cell of tub's position and vex's position. - q is `q.u.q.vex`, the text not parsed. - --- - -++ inde - Apply rule to indented block starting at current column number, - omitting the leading whitespace. - --- - Build wet %gold gate with sample rule, 'sef' - Build dry %gold gate with sample nail and the same product type as sef. - Let 'har' and 'tap' be p and q within that nail - Let 'lev' be ' ' repeated once less than the column number in har. - Let roq be the result of parsing the nail as any number of either - Printable characters, or - Newlines followed by ignored lev. - If roq is a failure produce it. - Let 'vex' be the result of parsing with sef, with column restarted to - 1, the result in roq which must be a tape. - If vex is a failure produce it with its p set to that of roq. - Produce an edge with parse reach from roq, succesful result from vex, - hair from vex with column number advanced by q.har - 1 (which was - subtracted prior passing it to sef), and a continuation tape of: - Let res be the continuation in vex(section of block unconsumed). - Build an kick a trap (Do): - If res is empty produce the continuation in roq. - Unless res starts with newline produce the head of res followed - by the result of tossing res for its tail. - Welp together a newline, lev, and the result of tossing res for - its tail. - --- - -++ jest - Match and consume a cord. - --- - Build dry %gold gate with sample cord `daf` - Build dry %gold gate with sample nail `tub` - Push `fad` is `daf` - Kick dry %gold trap. Yield edge of cord text. - If: `daf` is 0, - Then: Produce the edge with: - p is `p.tub` - q is the unit: - Null - u is the cell [p=fad q=tub] - Else: If: fish for null in q.tub OR compile to Nock the last byte in `daf` and the - Then: Produce the failed parse of `tub`, - Else: Toss `p.tub` for the index of the next character to be parsed, `q.tub` for the tail of `q.tub`, `daf` for the single byte right-shift of `daf` - --- - ~tadbyl-hilbel/try=> ((jest 'abc') [[1 1] "abc"]) - [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=""]]]] - ~tadbyl-hilbel/try=> (scan "abc" (jest 'abc')) - 'abc' - ~tadbyl-hilbel/try=> (scan "abc" (jest 'acb')) - ! {1 2} - ! 'syntax-error' - ! exit - ~tadbyl-hilbel/try=> ((jest 'john doe') [[1 1] "john smith"]) - [p=[p=1 q=6] q=~] - ~tadbyl-hilbel/try=> ((jest 'john doe') [[1 1] "john doe"]) - [p=[p=1 q=9] q=[~ [p='john doe' q=[p=[p=1 q=9] q=""]]]] -++ just - Match and consume a single character. - --- - Activate jet. - Build dry %gold gate with sample char `daf` - Activate extra parsing jet. - Build dry %gold gate wtih sample nail `tub` - Yield char edge. - If: `q.tub` is null, - Then: Produce the failed parse of `tub`, - Else: Unless: `daf` is `i.q.tub`, - Then: Produce the failed parse of `tub`, - Else: Produce the parse of the next character of `tub` - --- - ~tadbyl-hilbel/try=> ((just 'a') [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]] - ~tadbyl-hilbel/try=> (scan "abc" (just 'a')) - ! {1 2} - ! 'syntax-error' - ! exit - ~tadbyl-hilbel/try=> (scan "a" (just 'a')) - ~~a - ~tadbyl-hilbel/try=> (scan "%" (just '%')) - ~~~25. -++ knee - Callback - --- - Build wet %gold gate with sample noun `gar`, rule trap `sef` - Build dry %gold gate with sample nail `tub` - Yield char edge. - Produce `tub` slammed to `sef` - --- - - -++ mask - Match the next char to a list of chars, a tape. - --- - Activate jet. - Build wet %gold gate with sample (list char) `bud` - Activate extra parsing jet. - Build dry %gold gate with sample nail `tub` - Yield char edge. - If: `q.tub` is an atom, - Then: Produce the failed parse of `tub` - Else: Unless: - - --- - ~tadbyl-hilbel/try=> (scan "a" (mask "cba")) - ~~a - ~midlys-rocpet/try=> ((mask "abc") [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]] - ~midlys-rocpet/try=> ((mask "abc") [[1 1] "bbc"]) - [p=[p=1 q=2] q=[~ [p=~~b q=[p=[p=1 q=2] q="bc"]]]] - ~midlys-rocpet/try=> ((mask "abc") [[1 1] "dbc"]) - [p=[p=1 q=1] q=~] -++ next - Always succeeds and consumes a character. - --- - Build dry %gold gate with sample nail `tub` - Yield char edge. - If: The text to parse `q.tub` is an atom, - Then: Produce the failed parse of `tub` - Else: Push `zac` is lust slammed with: - The first chaarcter to parse (The head of `q.tub`) and its location in the text. - Produce the edge with the hair `zac` and unit nail with: - The character successfully consumed, the head of the text to parse. - A nail of hair index `zac`, text to be parsed `t.q.tub` (The tail of the text to parse.) - --- - ~tadbyl-hilbel/try=> (next [[1 1] "ebc"]) - [p=[p=1 q=2] q=[~ [p=~~e q=[p=[p=1 q=2] q="bc"]]]] - ~tadbyl-hilbel/try=> (next [[1 1] "john jumps jones"]) - [p=[p=1 q=2] q=[~ [p=~~j q=[p=[p=1 q=2] q="ohn jumps jones"]]]] -++ sear - Conditional cook - Produce the slam of the parsed texted to `b` only if the result is not null. - Else, produce null. - --- - Activate jet. - Build wet %gold gate with sample tile of gate accepting a noun and producing a unit `pyq`, rule `sef` - Activate extra parsing jet. - Build dry %gold with sample nail `tub` - Push `vex` is the rule `sef` slammed by the nail `tub`, an edge. - If: The text to be parsed is an atom, - Then: Produce `vex`, - Else: Push `gey` is `pyq` slammed with the - If: `gey` is an atom, - Then: Produce the cell with: - p is the hair index of the parse failure. - Else: Produce the cell with: - p is the hair index of the parse. - q is the unit with value u is: - p is the value of the parsed text slammed to `pyq` - q is the value of the unparsed text. - --- - ~midlys-rocpet/try=> ((sear |=(a=* ?@(a (some a) ~)) (just `a`)) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]] - ~midlys-rocpet/try=> ((sear |=(a=* ?@(a [~ u=a] ~)) (just `a`)) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]] -++ shim - Match characters within a range. - --- - Activate jet. - Build wet %gold gate with sample atom `les`, atom `mos` - Activate extra parsing jet. - Build dry %gold gate with sample nail, `tub` - Yield char edge. - If: `q.tub` is an atom, - Then: Produce the failed parse of `tub`, - Else: Unless: `i.q.tub` is greater than or equal to `les` AND `i.q.tub` is less than or equal to `mos`, - Then: Produce the failed parse of `tub`, - Else: Produce the single character parse of `tub` - --- - ~midlys-rocpet/try=> ((shim `a` 'z') [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]] - ~midlys-rocpet/try=> ((shim `a` 'Z') [[1 1] "abc"]) - [p=[p=1 q=1] q=~] - ~midlys-rocpet/try=> ((shim `a` 'Z') [[1 1] "Abc"]) - [p=[p=1 q=2] q=[~ [p=~~~41. q=[p=[p=1 q=2] q="bc"]]]] -++ stag - Add a label to an edge parsed by a rule. - --- - Activate jet. - Build wet %gold gate with sample noun `gob`, bunt of a rule `sef` - Activate extra parsing jet. - Build dry %gold gate with sample nail `tub` - Push `vex` is the rule `sef` slammed by the nail `tub`, an edge. - If: `q.vex` is an atom, - Then: Produce `vex` - Else: Produce the edge with hair `p.vex` and unit with value hair u=[p=[gob p.u.q.vex] q=q.u.q.vex] - --- - ~tadbyl-hilbel/try=> ((stag %foo (just 'a')) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=[%foo ~~a] q=[p=[p=1 q=2] q="bc"]]]] - ~tadbyl-hilbel/try=> ((stag "xyz" (jest 'abc')) [[1 1] "abc"]) - [p=[p=1 q=4] q=[~ u=[p=["xyz" 'abc'] q=[p=[p=1 q=4] q=""]]]] - ~tadbyl-hilbel/try=> ((stag 10.000 (shim 0 100)) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=[10.000 ~~a] q=[p=[p=1 q=2] q="bc"]]]] -++ stet - Listify a list of text position and bunt of rule pairs. - --- - Build wet %gold gate with sample list of position and bunt of rule pairs `leh` - Kick dry %gold trap. - If: `leh` is null, - Then: Produce null. - Else: Produce the cell, - with head: The cell of the head of the head of `leh`, p=-.i.leh, the tail of the head of `leh, q=+.i.leh. - with tail: Toss `leh` for `t.leh` - --- - ~tadbyl-hilbel/try=> (stet (limo [[5 (just 'a')] [1 (jest 'abc')] [[1 1] (shim 0 200)] [[1 10] (cold %foo (just 'a'))]~])) - ~[ - [p=5 q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>] - [p=1 q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>] - [p=[1 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>] - [p=[1 10] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>] - ] - ~tadbyl-hilbel/try=> (stet (limo [[[1 1] (just 'a')] [[2 1] (shim 0 200)] ~])) - ~[ - [p=[1 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>] - [p=[2 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>] - ] -++ stew - - --- - Activate jet. - Build wet %gold gate with sample list of position and bunt of rule pairs `leh` - Push label `wor` on: - Build dry %gold gate with sample fork between `ort` , fork `wan` - --- -++ stir - - --- - Activate jet. - Build wet %gold gate with sample noun `rud`, gate accepting two nouns and producing , rule `fel` - Activate extra parsing jet. - Build dry %gold with sample nail `tub` - Yield edge of type of `rud` - Push `vex` is the rule `fel` slammed with the nail `tub`A - If: The parsed text is null, - Then: Produce the edge of unit nail `rud` and `tub` at the hair index of `vex` - Else: Push `wag` is the toss of `tub` for the unparsed text in the unit nail of `vex` - Assert that the value - - Produce the edge with: - The farthest along hair index of `vex` and `wag` - The unit nail of - - --- - -++ stun - Parse several times - --- - Activate jet. - Build wet %gold gate with sample atom `les`, atom `mos`, rule `fel` - Activate extra parsing jet. - Build wet %gold gate with sample nail `tub` - Yield edge of - - If: `mos` is 0, - Then: Produce the edge with - --- - -section 2eD, parsing (combinators) - -++ bend - - --- - Activate jet. - Build wet %gold gate with sample gate accepting a noun `a`, noun `b` and producing the unit of [a b] - Activate extra parsing jet. - Build wet %gold gate with sample edge `vex`, rule `sab` - If: `q.vex` is an atom, - Then: Produce `vex`, - Else: Push `yit` is sab slammed with - --- - -++ comp - Arbitrary compose - --- - Activate jet. - Build wet %gold gate with sample gate accepting noun a, noun b and producing [a b], `raq` - Activate extra parsing jet. - Build wet %gold gate with sample edge `vex`, rule `sab` - If: The parsing output in `vex` is an atom, - Then: Produce the edge `vex` - Else: Push `yit` is the rule slammed with the text to parse in `vex` - Push `yur` is the hair of the edge that is farther along of `vex` and `yit` - If: The unit of parsed text in `yit` is null, - Then: Produce the edge with hair `yur` and unit nail from `yit`, which is null. - Else: Produce the edge with hair `yur`, unit [p=* q=nail] cell where: - p is `raq` slammed with `p.u.q.vex` and `p.u.q.yit`, the parsed results `yit` and `vex` - q is `q.u.q.yit`, the unparsed text of `yit` - --- - - -++ glue - Add rule. - --- - Activate jet. - Build wet %gold gate with sample rule `bus` - Activate extra parsing jet. - Build wet %gold gate with sample edge `vex`, rule `sab` - Slam plug with: - The edge `vex` - The tuple of slamming bus and sab with pfix - --- -++ less - No first and second. - --- - Build wet %gold gate with sample edge `vex`, rule `sab` - If: `q.vex` is null, - Then: Push `roq` is `sab`. Produce [p=(last p.vex p.roq) q=q.roq] - Else: Produce vex with q tossed for null. - --- - -++ pfix - Discard the first rule of a two rule cell. - --- - Activate jet. - Produce comp slammed with: - Build wet %gold gate slammed with sample noun `a`, noun `b`. - Produce `b` - --- - - -++ plug - Apply parsing rules in order to an edge. - --- - Activate jet. - Build wet %gold gate with sample edge `vex`, rule `sab` - If: The unit of text to parse is null, - Then: Produce null. - Else: Push `yit` is the rule `sab` slammed with the text to be parsed. - Push `yur` is the hair of the edge that is farther along of `vex` and `yit` - If: The unit of text parsed is null, - Then: Produce the edge [p=yur q=null]. - Else: Produce the edge [p=yur q=[~ u=[p=[p.u.q.vex p.u.q.yit] q=q.u.q.yit]]], - the edge of the text parsed with the rule. - --- - ~tadbyl-hilbel/try=> (;~(plug lus lus) [[1 1] "++"]) - [p=[p=1 q=3] q=[~ u=[p=[~~~2b. ~~~2b.] q=[p=[p=1 q=3] q=""]]]] - ~tadbyl-hilbel/try=> (scan "++" ;~(plug lus lus)) - [~~~2b. ~~~2b.] - ~tadbyl-hilbel/try=> (scan "++" (cold "slus" ;~(plug lus lus))) - "slus" - ~tadbyl-hilbel/try=> (scan "john doe" ;~(plug (jest 'john') ace (jest 'doe'))) - ['john' ~~. 'doe'] - ~tadbyl-hilbel/try=> (scan "john doe" ;~(plug (jest 'doe') ace (jest 'john'))) - ! {1 1} - ! 'syntax-error' - ! exit - ~tadbyl-hilbel/try=> (;~(plug bar hep) [[1 1] "|-"]) - [p=[p=1 q=3] q=[~ u=[p=[~~~7c. ~~-] q=[p=[p=1 q=3] q=""]]]] - ~tadbyl-hilbel/try=> (;~(plug bar hep lus) [[1 1] "|-"]) - [p=[p=1 q=3] q=~] - ~tadbyl-hilbel/try=> (scan "|-" ;~(plug bar hep lus)) - ! {1 3} - ! 'syntax-error' - ! exit -++ pose - Build list of parsing rules and try to use any of them in order. - `pose` has the same usage as `plug`, but does not fail if the rules are not - successful in a certain order. - --- - Activate jet. - Build wet %gold gate with sample edge `vex`, rule `sab` - If: The unit of text to parse is null, - Then: Push `roq` is the edge result of the rule `sab` applied to the - Produce the edge with the hair that is farther along of `vex` and `yit` and the parse - results of the rule. - Else: Produce the initial edge, `vex` - --- - ~tadbyl-hilbel/try=> (;~(pose (just 'a') (just 'b') (just 'c')) [[1 1] "c"]) - [p=[p=1 q=2] q=[~ [p=~~c q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (scan "c" ;~(pose (just 'a') (just 'b') (just 'c'))) - ~~c - ~tadbyl-hilbel/try=> (;~(pose bar hep) [[1 1] "|-"]) - [p=[p=1 q=2] q=[~ [p=~~~7c. q=[p=[p=1 q=2] q="-"]]]] - ~tadbyl-hilbel/try=> (scan "|-" (star ;~(pose bar hep))) - "|-" - ~tadbyl-hilbel/try=> (scan "|-" (star ;~(pose bar hep lus))) - "|-" - ~tadbyl-hilbel/try=> (scan "john doe" (star ;~(pose (jest 'doe') ace (jest 'john')))) - ~['john' ' ' 'doe'] - -++ sfix - Discard second rule. - --- - Activate jet. - Slam comp with a wet %gold gate accepting noun `a`, noun `b` and producing noun `a` - --- - -section 2eE, parsing (composers) - -++ bass - --- - Build wet %gold gate with sample atom `wuc`, rule `tyd` - Slam cook with: - Build dry %gold gate with sample list of atoms, `waq` - Slam roll with: - --- -++ boss - --- - Build wet %gold gate with sample atom `wuc`, rule `tyd` - --- -++ ifix - - --- - Build wet %gold gate with sample cell of rules `fel`, rule `hof` - Produce pfix gonadified with: - `p.fel`, the first rule in `fel` - Gonadify sfix with `hof` and `q.fel`, the second rule in `fel` - --- - -++ more - --- - Build wet %gold gate with sample rule `bus`, rule `fel` - Produce the gonadified: - --- -++ most - Parse to a list elements of the second rule seperated by the second. - - --- - Build wet %gold gate with sample rule `bus`, rule `fel` - Produce gonadified: - Plug slammed with `fel`, - star slammed with gonadified: - pfix slammed with `bus` and `fel`, `bus` added as the prefix of `fel` - --- - -++ plus - Like 'star', but "one or more" instead of "0 or more" - - --- - Build wet %gold gate with sample rule `fel` - Produce gonadified: - plug slammed with `fel` and star slammed with `fel`, the repeated application of `fel`. - --- - - -++ slug - - --- - Build wet %gold gate with sample noun `rud`, gate accepting cell of two nouns and producing [a b] `raq` - Build wet %gold gate with sample rule `bus`, rule `fel` - Produce the gonadified: - comp slammed with `raq`, - slammed with `fel`, - slammed with, - stir slammed with `rud`, `raq`, and `fel` prefixed with `bus` - --- - -++ star - Apply the parsing rule repeatedly until it fails. - --- - Build wet %gold gate with sample rule `fel, - Produce stir slammed with: - The list of elements of type of the icon of `fel` slammed to `wonk` - - --- - ~tadbyl-hilbel/try=> (scan "aaaaa" (just 'a')) - ! {1 2} - ! 'syntax-error' - ! exit - ~tadbyl-hilbel/try=> (scan "aaaaa" (star (just 'a'))) - "aaaaa" - ~tadbyl-hilbel/try=> (scan "abcdef" (star (just 'a'))) - ! {1 2} - ! 'syntax-error' - ! exit - ~tadbyl-hilbel/try=> (scan "abcabc" (star (jest 'abc'))) - <|abc abc|> - ~tadbyl-hilbel/try=> (scan "john smith" (star (shim 0 200))) - "john smith" - -section 2eF, parsing (ascii) - -++ ace - Parse ASCII character 32, ace. - --- - Produce the rule just slammed with ' ' - --- - ~tadbyl-hilbel/try=> (scan " " ace) - ~~. - ~tadbyl-hilbel/try=> `cord`(scan " " ace) - ' ' - ~tadbyl-hilbel/try=> (ace [[1 1] " "]) - [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (ace [[1 1] " abc "]) - [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q="abc "]]]] -++ bar - Parse ASCII character 124, bar. - --- - Produce the rule just slammed with '|' - --- - ~tadbyl-hilbel/try=> (scan "|" bar) - ~~~7c. - ~tadbyl-hilbel/try=> `cord`(scan "|" bar) - '|' - ~tadbyl-hilbel/try=> (bar [[1 1] "|"]) - [p=[p=1 q=2] q=[~ [p=~~~7c. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (bar [[1 1] "|="]) - [p=[p=1 q=2] q=[~ [p=~~~7c. q=[p=[p=1 q=2] q="="]]]] -++ bas - Parse ASCII character 92, bas. - Note the extra '\' in the slam of bas with just is to escape the escape character, bas. - --- - Produce the rule just slammed with '\\' - --- - ~tadbyl-hilbel/try=> (scan "\\" bas) - ~~~5c. - ~tadbyl-hilbel/try=> `cord`(scan "\\" bas) - '\' - ~tadbyl-hilbel/try=> (bas [[1 1] "\"]) - ~ - ~tadbyl-hilbel/try=> (bas [[1 1] "\\"]) - [p=[p=1 q=2] q=[~ [p=~~~5c. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (bas [[1 1] "\""]) - [p=[p=1 q=1] q=~] -++ buc - Parse ASCII character 36, buc. - --- - Produce the rule just slammed with '$' - --- - ~tadbyl-hilbel/try=> (scan "$" buc) - ~~~24. - ~tadbyl-hilbel/try=> `cord`(scan "$" buc) - '$' - ~tadbyl-hilbel/try=> (buc [[1 1] "$"]) - [p=[p=1 q=2] q=[~ [p=~~~24. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (buc [[1 1] "$%"]) - [p=[p=1 q=2] q=[~ [p=~~~24. q=[p=[p=1 q=2] q="%"]]]] -++ cab - Parse ASCII character 95, cab. - --- - Produce the rule just slammed with '_' - --- - ~tadbyl-hilbel/try=> (scan "_" cab) - ~~~5f. - ~tadbyl-hilbel/try=> `cord`(scan "_" cab) - '_' - ~tadbyl-hilbel/try=> (cab [[1 1] "_"]) - [p=[p=1 q=2] q=[~ [p=~~~5f. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (cab [[1 1] "|_"]) - [p=[p=1 q=1] q=~] -++ cen - Parse ASCII character 37, cen. - --- - Produce the rule just slammed with '%' - --- - ~tadbyl-hilbel/try=> (scan "%" cen) - ~~~25. - ~tadbyl-hilbel/try=> `cord`(scan "%" cen) - '%' - ~tadbyl-hilbel/try=> (cen [[1 1] "%"]) - [p=[p=1 q=2] q=[~ [p=~~~25. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (cen [[1 1] "%^"]) - [p=[p=1 q=2] q=[~ [p=~~~25. q=[p=[p=1 q=2] q="^"]]]] -++ col - Parse ASCII character 58, col. - --- - Produce the rule just slammed with ':' - --- - ~tadbyl-hilbel/try=> (scan ":" col) - ~~~3a. - ~tadbyl-hilbel/try=> `cord`(scan ":" col) - ':' - ~tadbyl-hilbel/try=> (col [[1 1] ":"]) - [p=[p=1 q=2] q=[~ [p=~~~3a. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (col [[1 1] ":-"]) - [p=[p=1 q=2] q=[~ [p=~~~3a. q=[p=[p=1 q=2] q="-"]]]] -++ com - Parse ASCII character 44, com. - --- - Produce the rule just slammed with ',' - --- - ~tadbyl-hilbel/try=> (scan "," com) - ~~~2c. - ~tadbyl-hilbel/try=> `cord`(scan "," com) - ',' - ~tadbyl-hilbel/try=> (com [[1 1] ","]) - [p=[p=1 q=2] q=[~ [p=~~~2c. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (com [[1 1] "not com"]) - [p=[p=1 q=1] q=~] -++ doq - Parse ASCII character 34, doq. - --- - Produce the rule just slammed with '"' - --- - ~tadbyl-hilbel/try=> (scan "\"" doq) - ~~~22. - ~tadbyl-hilbel/try=> `cord`(scan "\"" doq) - '"' - ~tadbyl-hilbel/try=> (doq [[1 1] "\""]) - [p=[p=1 q=2] q=[~ [p=~~~22. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (doq [[1 1] "not successfully parsed"]) - [p=[p=1 q=1] q=~] - ~tadbyl-hilbel/try=> (scan "see?" doq) - ! {1 1} - ! 'syntax-error' - ! exit -++ dot - Parse ASCII character 46, dot. - --- - Produce the rule just slammed with '.' - --- - ~tadbyl-hilbel/try=> (scan "." dot) - ~~~. - ~tadbyl-hilbel/try=> `cord`(scan "." dot) - '.' - ~tadbyl-hilbel/try=> (dot [[1 1] "."]) - [p=[p=1 q=2] q=[~ [p=~~~. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (dot [[1 1] ".^"]) - [p=[p=1 q=2] q=[~ [p=~~~. q=[p=[p=1 q=2] q="^"]]]] -++ fas - Parse ASCII character 47, fas. - --- - Produce the rule just slammed with '/' - --- - ~tadbyl-hilbel/try=> (scan "/" fas) - ~~~2f. - ~tadbyl-hilbel/try=> `cord`(scan "/" fas) - '/' - ~tadbyl-hilbel/try=> (fas [[1 1] "/"]) - [p=[p=1 q=2] q=[~ [p=~~~2f. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (fas [[1 1] "|/"]) - [p=[p=1 q=1] q=~] -++ gal - Parse ASCII character 60, gal. - --- - Produce the rule just slammed with '<' - --- - ~tadbyl-hilbel/try=> (scan "<" gal) - ~~~3c. - ~tadbyl-hilbel/try=> `cord`(scan "<" gal) - '<' - ~tadbyl-hilbel/try=> (gal [[1 1] "<"]) - [p=[p=1 q=2] q=[~ [p=~~~3c. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (gal [[1 1] "<+"]) - [p=[p=1 q=2] q=[~ [p=~~~3c. q=[p=[p=1 q=2] q="+"]]]] - ~tadbyl-hilbel/try=> (gal [[1 1] "+<"]) - [p=[p=1 q=1] q=~] -++ gar - Parse ASCII character 62, gar. - --- - Produce the rule just slammed with '>' - --- - ~tadbyl-hilbel/try=> (scan ">" gar) - ~~~3e. - ~tadbyl-hilbel/try=> `cord`(scan ">" gar) - '>' - ~tadbyl-hilbel/try=> (gar [[1 1] ">"]) - [p=[p=1 q=2] q=[~ [p=~~~3e. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (gar [[1 1] "=>"]) - [p=[p=1 q=1] q=~] -++ hax - Parse ASCII character 35, hax. - --- - Produce the rule just slammed with '#' - --- - ~tadbyl-hilbel/try=> (scan "#" hax) - ~~~23. - ~tadbyl-hilbel/try=> `cord`(scan "#" hax) - '#' - ~tadbyl-hilbel/try=> (hax [[1 1] "#"]) - [p=[p=1 q=2] q=[~ [p=~~~23. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (hax [[1 1] "#!"]) - [p=[p=1 q=2] q=[~ [p=~~~23. q=[p=[p=1 q=2] q="!"]]]] -++ kel - Parse ASCII character 123, kel. - Note that this, with ker, opens and closes a Hoon expression for Hoon string interpolation. Escape kel to parse it. - --- - Produce the rule just slammed with '{' - --- - ~tadbyl-hilbel/try=> (scan "\{" kel) - ~~~7b. - ~tadbyl-hilbel/try=> `cord`(scan "\{" kel) - '{' - ~tadbyl-hilbel/try=> (kel [[1 1] "\{"]) - [p=[p=1 q=2] q=[~ [p=~~~7b. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (kel [[1 1] " \{"]) - [p=[p=1 q=1] q=~] -++ ker - Parse ASCII character 125, ker. - --- - Produce the rule just slammed with '}' - --- - ~tadbyl-hilbel/try=> (scan "}" ker) - ~~~7d. - ~tadbyl-hilbel/try=> `cord`(scan "}" ker) - '}' - ~tadbyl-hilbel/try=> (ker [[1 1] "}"]) - [p=[p=1 q=2] q=[~ [p=~~~7d. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (ker [[1 1] "\{}"]) - [p=[p=1 q=1] q=~] -++ ket - Parse ASCII character 94, ket. - --- - Produce the rule just slammed with '^' - --- - ~tadbyl-hilbel/try=> (scan "^" ket) - ~~~5e. - ~tadbyl-hilbel/try=> `cord`(scan "^" ket) - '^' - ~tadbyl-hilbel/try=> (ket [[1 1] "^"]) - [p=[p=1 q=2] q=[~ [p=~~~5e. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (ket [[1 1] ".^"]) - [p=[p=1 q=1] q=~] -++ lus - Parse ASCII character 43, lus. - --- - Produce the rule just slammed with '+' - --- - ~tadbyl-hilbel/try=> (scan "+" lus) - ~~~2b. - ~tadbyl-hilbel/try=> `cord`(scan "+" lus) - '+' - ~tadbyl-hilbel/try=> (lus [[1 1] "+"]) - [p=[p=1 q=2] q=[~ [p=~~~2b. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (lus [[1 1] ".+"]) - [p=[p=1 q=1] q=~] -++ hep - Parse ASCII character 45, hep. - --- - Produce the rule just slammed with '-' - --- - ~tadbyl-hilbel/try=> (scan "-" hep) - ~~- - ~tadbyl-hilbel/try=> `cord`(scan "-" hep) - '-' - ~tadbyl-hilbel/try=> (hep [[1 1] "-"]) - [p=[p=1 q=2] q=[~ [p=~~- q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (hep [[1 1] ":-"]) - [p=[p=1 q=1] q=~] -++ pel - Parse ASCII character 40, pel. - --- - Produce the rule just slammed with '(' - --- - ~tadbyl-hilbel/try=> (scan "(" pel) - ~~~28. - ~tadbyl-hilbel/try=> `cord`(scan "(" pel) - '(' - ~tadbyl-hilbel/try=> (pel [[1 1] "("]) - [p=[p=1 q=2] q=[~ [p=~~~28. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (pel [[1 1] ";("]) - [p=[p=1 q=1] q=~] -++ pam - Parse ASCII character 38, pam. - --- - Produce the rule just slammed with '&' - --- - ~tadbyl-hilbel/try=> (scan "&" pam) - ~~~26. - ~tadbyl-hilbel/try=> `cord`(scan "&" pam) - '&' - ~tadbyl-hilbel/try=> (pam [[1 1] "&"]) - [p=[p=1 q=2] q=[~ [p=~~~26. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (pam [[1 1] "?&"]) - [p=[p=1 q=1] q=~] -++ per - Parse ASCII character 41, per. - --- - Produce the rule just slammed with ')' - --- - ~tadbyl-hilbel/try=> (scan ")" per) - ~~~29. - ~tadbyl-hilbel/try=> `cord`(scan ")" per) - ')' - ~tadbyl-hilbel/try=> (per [[1 1] ")"]) - [p=[p=1 q=2] q=[~ [p=~~~29. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (per [[1 1] " )"]) - [p=[p=1 q=1] q=~] -++ pat - Parse ASCII character 64, pat. - --- - Produce the rule just slammed with '@' - --- - ~tadbyl-hilbel/try=> (scan "@" pat) - ~~~4. - ~tadbyl-hilbel/try=> `cord`(scan "@" pat) - '@' - ~tadbyl-hilbel/try=> (pat [[1 1] "@"]) - [p=[p=1 q=2] q=[~ [p=~~~4. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (pat [[1 1] "?@"]) - [p=[p=1 q=1] q=~] -++ sel - Parse ASCII character 91, sel. - --- - Produce the rule just slammed with '[' - --- - ~tadbyl-hilbel/try=> (scan "[" sel) - ~~~5b. - ~tadbyl-hilbel/try=> `cord`(scan "[" sel) - '[' - ~tadbyl-hilbel/try=> (sel [[1 1] "["]) - [p=[p=1 q=2] q=[~ [p=~~~5b. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (sel [[1 1] "-["]) - [p=[p=1 q=1] q=~] -++ sem - Parse ASCII character 59, sem. - --- - Produce the rule just slammed with ';' - --- - ~tadbyl-hilbel/try=> (scan ";" sem) - ~~~3b. - ~tadbyl-hilbel/try=> `cord`(scan ";" sem) - ';' - ~tadbyl-hilbel/try=> (sem [[1 1] ";"]) - [p=[p=1 q=2] q=[~ [p=~~~3b. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (sem [[1 1] " ;"]) - [p=[p=1 q=1] q=~] -++ ser - Parse ASCII character 93, ser. - --- - Produce the rule just slammed with ']' - --- - ~tadbyl-hilbel/try=> (scan "]" ser) - ~~~5d. - ~tadbyl-hilbel/try=> `cord`(scan "]" ser) - ']' - ~tadbyl-hilbel/try=> (ser [[1 1] "]"]) - [p=[p=1 q=2] q=[~ [p=~~~5d. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (ser [[1 1] "[ ]"]) - [p=[p=1 q=1] q=~] -++ sig - Parse ASCII character 126, sig. - --- - Produce the rule just slammed with '~' - --- - ~tadbyl-hilbel/try=> (scan "~" sig) - ~~~~ - ~tadbyl-hilbel/try=> `cord`(scan "~" sig) - '~' - ~tadbyl-hilbel/try=> (sig [[1 1] "~"]) - [p=[p=1 q=2] q=[~ [p=~~~~ q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (sig [[1 1] "?~"]) - [p=[p=1 q=1] q=~] -++ soq - Parse ASCII character 39, soq. - Note the extra '\' in the slam of soq with just is to escape the first soq because soq denotes a crip. - --- - Produce the rule just slammed with '\'' - --- - ~tadbyl-hilbel/try=> (scan "'" soq) - ~~~27. - ~tadbyl-hilbel/try=> `cord`(scan "'" soq) - ''' - ~tadbyl-hilbel/try=> (soq [[1 1] "'"]) - [p=[p=1 q=2] q=[~ [p=~~~27. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (soq [[1 1] ">'"]) - [p=[p=1 q=1] q=~] -++ tar - Parse ASCII character 42, tar. - --- - Produce the rule just slammed with '*' - --- - ~tadbyl-hilbel/try=> (scan "*" tar) - ~~~2a. - ~tadbyl-hilbel/try=> `cord`(scan "*" tar) - '*' - ~tadbyl-hilbel/try=> (tar [[1 1] "*"]) - [p=[p=1 q=2] q=[~ [p=~~~2a. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (tar [[1 1] ".*"]) - [p=[p=1 q=1] q=~] -++ tec - Parse ASCII character 96, tec. - --- - Produce the rule just slammed with '`' - --- - ~tadbyl-hilbel/try=> (scan "`" tec) - ~~~6. - ~tadbyl-hilbel/try=> `cord`(scan "`" tec) - '`' - ~tadbyl-hilbel/try=> (tec [[1 1] "`"]) - [p=[p=1 q=2] q=[~ [p=~~~6. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (tec [[1 1] " `"]) - [p=[p=1 q=1] q=~] -++ tis - Parse ASCII character 61, tis. - --- - Produce the rule just slammed with '=' - --- - ~tadbyl-hilbel/try=> (scan "=" tis) - ~~~3d. - ~tadbyl-hilbel/try=> `cord`(scan "=" tis) - '=' - ~tadbyl-hilbel/try=> (tis [[1 1] "="]) - [p=[p=1 q=2] q=[~ [p=~~~3d. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (tis [[1 1] "|="]) - [p=[p=1 q=1] q=~] -++ wut - Parse ASCII character 63, wut. - --- - Produce the rule just slammed with '?' - --- - ~tadbyl-hilbel/try=> (scan "?" wut) - ~~~3f. - ~tadbyl-hilbel/try=> `cord`(scan "?" wut) - '?' - ~tadbyl-hilbel/try=> (wut [[1 1] "?"]) - [p=[p=1 q=2] q=[~ [p=~~~3f. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (wut [[1 1] ".?"]) - [p=[p=1 q=1] q=~] -++ zap - Parse ASCII character 33, zap. - --- - Produce the rule just slammed with '!' - --- - ~tadbyl-hilbel/try=> (scan "!" zap) - ~~~21. - ~tadbyl-hilbel/try=> `cord`(scan "!" zap) - '!' - ~tadbyl-hilbel/try=> (zap [[1 1] "!"]) - [p=[p=1 q=2] q=[~ [p=~~~21. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (zap [[1 1] "?!"]) - [p=[p=1 q=1] q=~] - -section 2eG, parsing (whitespace) - -++ dog -++ doh - Parse - --- - Produce plug gonadified with dot and gay. - --- - -++ dun - Parse phep (--) to null (~). - --- - Produce cold slammed with: - null - plug gonadified with hep and hep, to parse phep. - --- - ~tadbyl-hilbel/try=> (scan "--" dun) - ~ - ~tadbyl-hilbel/try=> (dun [[1 1] "--"]) - [p=[p=1 q=3] q=[~ u=[p=~ q=[p=[p=1 q=3] q=""]]]] -++ duz - Parse stet (==) to null (~). - --- - Produce cold slammed with: - null - plug gonadified with tis and tis, to parse stet - --- - ~tadbyl-hilbel/try=> (scan "==" duz) - ~ - ~tadbyl-hilbel/try=> (duz [[1 1] "== |=..."]) - [p=[p=1 q=3] q=[~ u=[p=~ q=[p=[p=1 q=3] q=" |=..."]]]] -++ gah - - --- - Produce mask slammed with the tuple: - `@`10, the newline character - ' ', the ace character - null - --- - -++ gap - - --- - Produce cold slammed with: - null - Plug gonadified with: - gaq - star slammed with pose gonadified with vul and gah - --- -++ gaq - - --- - Produce pose gonadifed with: - just slammed with the newline character. - Plug gonadified with gah and pose gonadified with gah and vul. - vul - --- - -++ gay - - --- - Produce pose gonadified with: - gap, which - Slam of easy with null - --- - -++ vul - Parse comments and replace them with null. - Note that a comment must be ended with a newline character. - --- - Produce cold slammed with: Pair null and, - plug gonadified with col, col, and, - pose gonadified with: - shim slammed with 32 and 126 - shim slammed with 128 and 255 - just slammed with the newline operator. - (==) Terminates the pair. - --- - - -section 2eH, parsing (idioms) - -++ alf - Parse alphabetic characters, both upper and lowercase. - --- - Produce the rule of pose gonadified with low and hig. - --- - ~tadbyl-hilbel/try=> (scan "a" alf) - ~~a - ~tadbyl-hilbel/try=> (scan "A" alf) - ~~~41. - ~tadbyl-hilbel/try=> (scan "AaBbCc" (star alf)) - "AaBbCc" -++ aln - Parse alphanumeric characters - both alphabetic characters and numbers. - --- - Produce the rule of pose gonadified with low,hig, and nud. - --- - ~tadbyl-hilbel/try=> (scan "0" aln) - ~~0 - ~tadbyl-hilbel/try=> (scan "alf42" (star aln)) - "alf42" - ~tadbyl-hilbel/try=> (scan "0123456789abcdef" (star aln)) - "0123456789abcdef" -++ alp - Parse alphanumeric strings and hep, "-". - --- - Produce the rule pose gonadified with low, hig, nud, hep. - --- - ~tadbyl-hilbel/try=> (scan "7" alp) - ~~7 - ~tadbyl-hilbel/try=> (scan "s" alp) - ~~s - ~tadbyl-hilbel/try=> (scan "123abc-" (star alp)) - "123abc-" -++ bet - Parse the hep and lus axis syntax. - --- - Produce the rule pose gonadified with: - (cold 2 hep), which replaces parsed heps with 2s. - (cold 3 lus), which replaced parsed luses with 3s. - --- - ~tadbyl-hilbel/try=> (scan "-" bet) - 2 - ~tadbyl-hilbel/try=> (scan "+" bet) - 3 -++ bin - Parse a tape of binary (0s and 1s) and produce its atomic representation. - --- - Produce the slam of bass with 2 and the (most gon but), which produces - - --- - ~tadbyl-hilbel/try=> (scan "0000" bin) - 0 - ~tadbyl-hilbel/try=> (scan "0001" bin) - 1 - ~tadbyl-hilbel/try=> (scan "0010" bin) - 2 - ~tadbyl-hilbel/try=> (scan "100000001111" bin) - 2.063 -++ but - Parse a single binary digit. - --- - Produce rule cook slammed with a gate: - With sample atom `a` that results in the difference between `a` and '0' (48). - All slammed with the rule shim slammed with '0' and '1', to parse either of those characters. - --- - ~tadbyl-hilbel/try=> (scan "0" but) - 0 - ~tadbyl-hilbel/try=> (scan "1" but) - 1 - ~tadbyl-hilbel/try=> (scan "01" but) - ! {1 2} - ! 'syntax-error' - ! exit - ~tadbyl-hilbel/try=> (scan "01" (star but)) - ~[0 1] -++ cit - Parse a single octal digit. - --- - Produce rule cook slammed with a gate: - With sample atom `a` that results in the difference between `a` and '0' (48). - All slammed with the rule shim slammed with '0' and '7', to parse any number between 0 and 7. - --- - ~tadbyl-hilbel/try=> (scan "1" cit) - 1 - ~tadbyl-hilbel/try=> (scan "7" cit) - 7 - ~tadbyl-hilbel/try=> (scan "8" cit) - ! {1 1} - ! 'syntax-error' - ! exit - ~tadbyl-hilbel/try=> (scan "60" (star cit)) - ~[6 0] -++ dem - Parse a decimal number to an atom. - --- - Produce the slam of bass with 10 (The base number system) and (most gon dit), which produces - - --- - ~tadbyl-hilbel/try=> (scan "7" dem) - 7 - ~tadbyl-hilbel/try=> (scan "42" dem) - 42 - ~tadbyl-hilbel/try=> (scan "150000000" dem) - 150.000.000 - ~tadbyl-hilbel/try=> (scan "12456" dem) - 12.456 -++ dit - Parse a single decimal digit. - --- - Produce the rule cook slammed with a gate: - With sample atom `a` that results in the difference between `a` and '0' (48). - All slammed with the rule shim slammed with '0' and '9', to parse any number. - --- - ~tadbyl-hilbel/try=> (scan "7" dit) - 7 - ~tadbyl-hilbel/try=> (scan "42" (star dit)) - ~[4 2] - ~tadbyl-hilbel/try=> (scan "26000" (star dit)) - ~[2 6 0 0 0] -++ gul - Parse the axis gal and gar axis syntax. - --- - Produce the rule pose gonadified with: - (cold 2 gal), which replaces parsed gals with 2s. - (cold 3 gar), which replaced parsed gars with 3s. - --- - ~tadbyl-hilbel/try=> (scan "<" gul) - 2 - ~tadbyl-hilbel/try=> (scan ">" gul) - 3 -++ gon - Parse long numbers - Numbers which wrap around the shell with the line break characters bas and fas. - --- - Produce the rule pose gonadified with: - The rule plug gonadified with: - bas, gay, and fas, to succeed to parse a bas, fas, or a gap in text. - The rule (easy ~), to succeed to parse but produces null as the parsed text. - --- - ~tadbyl-hilbel/try=> (scan "\\/" gon) - [~~~5c. ~ ~~~2f.] - ~tadbyl-hilbel/try=> (gon [[1 1] "\\/"]) - [p=[p=1 q=3] q=[~ u=[p=[~~~5c. ~ ~~~2f.] q=[p=[p=1 q=3] q=""]]]] -++ hex - Parse any hexadecimal number to an atom. - --- - Produce bass slammed with 16 (The base number system) and (most gon hit), which produces the atom - - --- - ~tadbyl-hilbel/try=> (scan "a" hex) - 10 - ~tadbyl-hilbel/try=> (scan "A" hex) - 10 - ~tadbyl-hilbel/try=> (scan "2A" hex) - 42 - ~tadbyl-hilbel/try=> (scan "1ee7" hex) - 7.911 - ~tadbyl-hilbel/try=> (scan "1EE7" hex) - 7.911 -++ hig - Parse a single uppercase letter. - --- - Produce the slam of shim with the characters 'A' (65) and 'Z' (90), to parse any character between them, inclusive. - --- - ~tadbyl-hilbel/try=> (scan "G" hig) - ~~~47. - ~tadbyl-hilbel/try=> `cord`(scan "G" hig) - 'G' - ~tadbyl-hilbel/try=> (scan "ABCDEFGHIJKLMNOPQRSTUVWXYZ" (star hig)) - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - ~tadbyl-hilbel/try=> (hig [[1 1] "G"]) - [p=[p=1 q=2] q=[~ [p=~~~47. q=[p=[p=1 q=2] q=""]]]] -++ hit - Parse a hexadecimal digit. - --- - Pose gonadified with: - dit, parse a single decimnal digit. - Slam cook with: - Build dry %gold gate with sample char `a`. Produce the difference between `a` and 87. - The slam of shim with the characters 'a' (97) and 'z' (122), to parse any character between them, inclusive. - The slam of shim with the characters 'A' () and 'Z' (), to parse any character between them, inclusive. - Terminate the gonadification. - --- - ~tadbyl-hilbel/try=> (scan "a" hit) - 10 - ~tadbyl-hilbel/try=> (scan "A" hit) - 10 - ~tadbyl-hilbel/try=> (hit [[1 1] "a"]) - [p=[p=1 q=2] q=[~ [p=10 q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (scan "2A" (star hit)) - ~[2 10] -++ low - Parse a single lowercase letter. - --- - Produce the slam of shim with the characters 'a' (97) and 'z' (122), to parse any character between them, inclusive. - --- - ~tadbyl-hilbel/try=> (scan "g" low) - ~~g - ~tadbyl-hilbel/try=> `cord`(scan "g" low) - 'g' - ~tadbyl-hilbel/try=> (scan "abcdefghijklmnopqrstuvwxyz" (star low)) - "abcdefghijklmnopqrstuvwxyz" - ~tadbyl-hilbel/try=> (low [[1 1] "g"]) - [p=[p=1 q=2] q=[~ [p=~~g q=[p=[p=1 q=2] q=""]]]] -++ mes - Parse a hexbyte. - --- - Slam cook with: - Build dry %gold gate with sample atom `a`, atom `b`. Produce the sum of `a` multiplied by 16 and `b` - Plug gonadified with hit and hit, parse two consecutive hex digits. - --- - ~tadbyl-hilbel/try=> (scan "2A" mes) - 42 - ~tadbyl-hilbel/try=> (mes [[1 1] "2A"]) - [p=[p=1 q=3] q=[~ u=[p=42 q=[p=[p=1 q=3] q=""]]]] - ~tadbyl-hilbel/try=> (scan "42" mes) - 66 -++ nix - - --- - Slam boss with 256 - --- - -++ nud - Parse a numeric character - A number. - --- - Produce the slam of shim with the characters '0' (48) and '9' (57), to parse any character between them, inclusive. - --- - ~tadbyl-hilbel/try=> (scan "0" nud) - ~~0 - ~tadbyl-hilbel/try=> (scan "7" nud) - ~~7 - ~tadbyl-hilbel/try=> (nud [[1 1] "1"]) - [p=[p=1 q=2] q=[~ [p=~~1 q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (scan "0123456789" (star nud)) - "0123456789" -++ poy - Parse an escape character. - --- - Produce pfix gonadified with: - bas - pose gonadifided with: - bas - soq - mes, to parse a hexbyte. - --- - -++ qit - Parse an individual character to its cord atom representation. - --- - Produce pose gonadified with: - The slam of shim with 32 and 38, to parse any characters between them, inclusive. - The slam of shim with 40 and 91, to parse any characters between them, inclusive. - The slam of shim with 93 and 126, to parse any characters between them, inclusive. - The slam of shim with 128 and 255, to parse any characters between them, inclusive. - --- - ~tadbyl-hilbel/try=> (scan "%" qit) - 37 - ~tadbyl-hilbel/try=> (scan "0" qit) - 48 - ~tadbyl-hilbel/try=> (scan "E" qit) - 69 - ~tadbyl-hilbel/try=> (scan "a" qit) - 97 - ~tadbyl-hilbel/try=> (scan "cord" (star qit)) - ~[99 111 114 100] -++ qut - Parse - --- - Slam ifix with: - [soq soq] - boss slammed with 256 and (most gon qit) - --- - - -++ sym - - --- - - --- - -++ ven - - --- - - --- - -++ vit - Parse a text and produce its base 64 encoding - --- - Build list of falling rules to match on with ';~' and pose. - Encodes capital letters by - - --- - -section 2eI, parsing (external) - -++ rash - Parse a cord with a given rule and crash if the cord isn't entirely parsed. - --- - Build wet %gold gate with sample atom `naf`, rule `sab` - Produce the slam of scan with: - Trip slammed with `naf`, to turn `naf` into a tape. - The rule `sab` - --- - ~tadbyl-hilbel/try=> (rash 'I was the world in which I walked, and what I saw' (star (shim 0 200))) - "I was the world in which I walked, and what I saw" - ~tadbyl-hilbel/try=> (rash 'abc' (just 'a')) - ! {1 2} - ! 'syntax-error' - ! exit - ~tadbyl-hilbel/try=> (rash 'abc' (jest 'abc')) - 'abc' - `~tadbyl-hilbel/try=> (rash 'abc' (jest 'ab')) - ! {1 3} - ! 'syntax-error' - ! exit -++ rush - Parse a given with a given rule and produce null if the cord isn't entirely parsed. - --- - Build wet %gold gate with sample atom `naf`, rule `sab` - Produce the slam of scan with: - Trip slammed with `naf`, to turn `naf` into a tape. - The rule `sab` - --- - ~tadbyl-hilbel/try=> (rush 'I was the world in which I walked, and what I saw' (star (shim 0 200))) - [~ "I was the world in which I walked, and what I saw"] - ~tadbyl-hilbel/try=> (rush 'abc' (just 'a')) - ~ - ~tadbyl-hilbel/try=> (rush 'abc' (jest 'abc')) - [~ 'abc'] - ~tadbyl-hilbel/try=> (rush 'abc' (jest 'ac')) - ~ - ~tadbyl-hilbel/try=> (rush 'abc' (jest 'ab')) - ~ -++ rust - Parse a tape with a given rule and produce null if the tape isn't entirely parsed. - --- - Build wet %gold gate with sample tape `los`, rule `sab` - Push `vex` is the rule (full sab) slammed with the beginning of the `los` tape. - If: `q.vex`, the parsed result, is null, - Then: Produce null. - Else: Produce the unit with value 'p.u.q.vex', the parsed text. - --- - ~tadbyl-hilbel/try=> (rust "I was the world in which I walked, and what I saw" (star (shim 0 200))) - [~ "I was the world in which I walked, and what I saw"] - ~tadbyl-hilbel/try=> (rust "Or heard or felt came not but from myself;" (star (shim 0 200))) - [~ "Or heard or felt came not but from myself;"] - ~tadbyl-hilbel/try=> (rust "And there I found myself more truly and more strange." (jest 'And there I')) - ~ -++ scan - Parse a tape with a given rule and crash if the tape isn't entirely parsed. - --- - Build wet %gold gate with sample tape `los`, rule `sab` - Push `vex` is the rule (full sab) slammed with the beginning of the `los` tape. - If: `q.vex` is null, - Then: Add to the crash with message 'syntax-error''s trace: - show slammed with [%m '{%d %d}'], `p.p.vex`, `q.p.vex`, and null - Else: Produce the parsing output of `vex` - --- - ~tadbyl-hilbel/try=> (scan "I was the world in which I walked, and what I saw" (star (shim 0 200))) - "I was the world in which I walked, and what I saw" - ~tadbyl-hilbel/try=> (scan "Or heard or felt came not but from myself;" (star (shim 0 200))) - "Or heard or felt came not but from myself;" - ~tadbyl-hilbel/try=> (scan "And there I found myself more truly and more strange." (jest 'And there I')) - ! {1 12} - ! 'syntax-error' - ! exit - -section 2eJ, formatting (basic text) - -++ cass - Produce the case insensitive (all lowercase) cord of a tape. - --- - Build wet %gold gate with sample tape `vib` - Slam rap with: - 3, to rap by bytes - Slam turn with: - `vib` - Build dry %gold gate with sample atom `a`, - Unless: `a` is greater than or equal to 'A' or less than or equal to 'Z', - Then: Produce `a`, - Else: Produce the difference between `a` and 32. - --- - ~tadbyl-hilbel/try=> (cass "john doe") - 7.309.170.810.699.673.450 - ~tadbyl-hilbel/try=> `cord`(cass "john doe") - 'john doe' - ~tadbyl-hilbel/try=> (cass "abc, 123, !@#") - 2.792.832.775.110.938.439.066.079.945.313 - ~tadbyl-hilbel/try=> `cord`(cass "abc, 123, !@#") - 'abc, 123, !@#' -++ cuss - Turn all occurances of lowercase letters in any tape into uppercase letters, as a cord. - --- - Build dry %gold gate with sample tape `vib` - Yield cord - Slam rap with: - 3, to rap by bytes - Slam turn with: - `vib` - Build dry %gold gate with sample atom `a`, - Unless: `a` is greater than or equal to 'A' or less than or equal to 'Z', - Then: Produce `a`, - Else: Produce the difference between `a` and 32. - --- - ~tadbyl-hilbel/try=> (cuss "john doe") - 'JOHN DOE' - ~tadbyl-hilbel/try=> (cuss "abc ABC 123 !@#") - 'ABC ABC 123 !@#' - ~tadbyl-hilbel/try=> `@ud`(cuss "abc") - 4.407.873 - ~tadbyl-hilbel/try=> (cuss "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsQqRrVvWwXxYyZz") - 'AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSQQRRVVWWXXYYZZ' -++ crip - Produce the cord of a tape. - --- - Build dry %gold with sample tape `a` - Produce the rap of `a` by bytes, cast to a cord. - --- - ~tadbyl-hilbel/try=> (crip "john doe") - 'john doe' - ~tadbyl-hilbel/try=> (crip "abc 123 !@#") - 'abc 123 !@#' - ~tadbyl-hilbel/try=> `@ud`(crip "abc") - 6.513.249 -++ mesc -++ runt -++ sand -++ sane -++ trim -++ trip -++ teff -++ turf -++ tuba -++ tufa -++ tuft -++ wack -++ wick -++ woad -++ wood - -section 2eK, formatting (layout) - -++ re - ++ ram - ++ win - ++ din - ++ fit - ++ rig - ++ wig - -section 2eL, formatting (path) - -++ ab - ++ bix - ++ hif - ++ huf - ++ hyf - ++ pev - ++ pew - ++ piv - ++ piw - ++ qeb - ++ qex - ++ qib - ++ qix - ++ seb - ++ sed - ++ sev - ++ sew - ++ sex - ++ sib - ++ siq - ++ sid - ++ siv - ++ siw - ++ six - ++ sov - ++ sow - ++ sox - ++ ted - ++ tip - ++ tiq - ++ tid - ++ til - ++ urs - ++ urt - ++ voy - ++ vym - ++ vyn -++ ag - ++ ape - ++ bay - ++ bip - ++ dem - ++ dim - ++ dum - ++ fed - ++ hex - ++ lip - ++ qut - ++ sym - ++ tyq - ++ viz - ++ vum - ++ wiz -++ co - ++ rear - ++ rent - ++ rend - ++ a-co - ++ d-co - ++ r-co - ++ s-co - ++ v-co - ++ w-co - ++ x-co - ++ y-co - ++ z-co - ++ em-co - ++ ox-co - ++ ro-co -++ ne - ++ d - ++ x - ++ v - ++ w -++ mu - ++ zag - ++ zig - ++ zug -++ so - ++ bisk - ++ crub - ++ nuck - ++ nusk - ++ perd - ++ royl - ++ tash - ++ twid - ++ zust -++ scot -++ scow -++ slav -++ slaw -++ slay -++ smyt - -section 2eM, regular-expressions - -++ pars -++ nor -++ les -++ lep -++ alm -++ alb -++ mis -++ anns -++ mall -++ bets -++ ranc -++ flap -++ rang -++ chun -++ seac -++ sead -++ sade -++ seap -++ cape -++ lower -++ upper -++ digit -++ print -++ graph -++ blank -++ space -++ cntrl -++ alpha -++ alnum -++ punct -++ wordc -++ white -++ xdigi -++ chad -++ escd -++ escp -++ unid -++ proc -++ cont -++ abor -++ matc -++ chet -++ blak -++ deep -++ rexp -++ repg - -section 2eN, pseudo-cryptography - -++ un - ++ wre - ++ wre - ++ xaf - ++ xar - ++ zaf - ++ zar - ++ zyf - ++ zyr - -section 2eO, virtualization - -++ mack - Accpet a nock subject-formula cell. - Produce a unit result, treating 11 as a crash (i.e. pure nock). - --- - Creates a dry %gold gate accepting cell ['sub' 'fol']. - Its output is a unit (of a noun). - Let 'ton' be the result of minking the sample, with a sky that produces - ~ on any input, halting interpretation. - Unless ton has stem 0, produce the empty unit, otherwise produce one - containing ton's bulb. - --- - ~zod/try=> (mack [[1 2 3] [0 1]]) - [~ [1 2 3]] - ~zod/try=> (mack [41 4 0 1]) - [~ 42] - ~zod/try=> (mack [4 0 4]) - ~ - ~zod/try=> (mack [[[0 2] [1 3]] 4 4 4 4 0 5]) - [~ 6] - ~zod/try=> ;;((unit ,@tas) (mack [[1 %yes %no] 6 [0 2] [0 6] 0 7])) - [~ %no] -++ mink - XX - Description: - Bottom-level mock (virtual nock) interpreter. - Accepts a nock subject-formula cell, and an %iron gate which - accepts any noun and produces a unit, which is defined to be mock 11. - Produces a ++tone, which is the result of the virtualized computation. - --- - For clarity, a ++tone with stem %0 will be referred to as a "success", - one with stem %1 as a "block", and one with stem %2 as a "crash". - --- - Activate jet. - Creates a dry %gold gate accepting cell ['sub' 'fol'] and gate 'sky'. - Let 'tax' be a statically bunted list of term-noun pairs. (hint list) - Do (recursion point) produce a tone: - If fol is an atom - Produce a crash of fol. - Else if the head of fol is a cell - Let hed be the result of recurring with fol replaced by its head. - If hed is a crash - Yield it - Otherwise let 'tal' be the result of recurring with fol replaced - by its tail. - Switch on the type of tal by stem: - If tal is a success - If hed is a block produce hed. - Else (success) produce a success of a cell of the bulbs of hed - and tal. - If tal is a block - If hed is a success produce tal. - Else (block) produce a block of welding the bulbs of hed and tal. - Else (crash) produce tal - Otherwise (the head of fol is an atom) switch on fol, - by default producing a crash of tax. - If fol has stem 0 and an atom bulb we name 'b' - If b is 0 produce a crash of tax. - If b is 1 produce a success of sub. - If sub is an atom produce a crash of tax - Otherwise let 'now' be the cap of b, and 'lat' be the mas of b - Tail-recur with b replaced by lat, and sub replaced by: if now is 2, - its head, else its tail. - If fol has stem 1 and a bulb we name 'b' - Produce a success of b - If fol has stem 2 and a bulb whose head is a cell. - Let 'ben' be the result of recurring with fol replaced by its bulb. - Unless ben is a success, produce ben. - Else assert that ben contains a cell, and tail-recur with - sub and fol replaced by the head and tail of ben's bulb - If fol has stem 3 and a bulb we name 'b' - Let 'ben' be the result of recurring with fol replaced by b. - Unless ben is a success, produce ben. - Else produce a success of (loobean) whether ben contains a cell. - If fol has stem 4 and a bulb we name 'b' - Let 'ben' be the result of recurring with fol replaced by b. - Unless ben is a success, produce ben. - Else unless ben contains an atom produce a crash of tax. - Otherwise produce a success of ben's contents, incremented. - If fol has stem 5 and a bulb we name 'b' - Let 'ben' be the result of recurring with fol replaced by b. - Unless ben is a success, produce ben. - Else unless ben contains a cell produce a crash of tax. - Otherwise produce a success of (loobean) whether the bulb of ben has - a tail equal to its head. - If fol has stem 6, 7, 8, or 9 - Tail-recur with its bulb expanded per nock specification. - If fol has stem 10 and a cell bulb whose head is an atom - Tail-recur with for replaced by its bulb's tail - If fol has stem 10 and a bulb that can be destructured as [[b c] d] - Let ben be the result of recurring with fol replaced by v. - Unless ben is a success, produce ben. - If b is %hunk, %lose, %mean, or %spot - Tail-recur with fol replaced by d and tax prepended with a pair of - b and the bulb of ben. - Else tail-recur with just fol replaced by d. - Examples: - XX -++ mock - XX - Description: - Accepts a nock subject-formula cell and an %iron gate which - accepts any noun and produces a unit (this is used as nock 11). - Produces a ++toon, which is a sucesful, blocked, or crashed result. - --- - Compose ++mook and ++mink. - Examples - ~zod/try=> (mock [5 4 0 1] ,~) - [%0 p=6] - ~zod/try=> (mock [~ 11 1 0] |=(* `999)) - [%0 p=999] - ~zod/try=> (mock [~ 0 1.337] ,~) - [%2 p=~] - ~zod/try=> (mock [~ 11 1 1.337] ,~) - [%1 p=~[1.337]] - ~zod/try=> (mock [[[4 4 4 4 0 3] 10] 11 9 2 0 1] |=(* `[+<])) - [%0 p=14] - ~zod/try=> (mock [[[4 4 4 4 0 3] 10] 11 9 2 0 1] |=(* `[<+<>])) - [%0 p=[49 52 0]] - ~zod/try=> ;;(tape +:(mock [[[4 4 4 4 0 3] 10] 11 9 2 0 1] |=(* `[<+<>]))) - "14" - -++ mook - XX - Description: - Intelligently render crash annotation. - Accepts a ++tone, produces a ++toon - --- - Create a dry %gold gate accepting a tone we name 'ton' - Its output is a toon. - Unless the stem of ton is %2, produce ton. - Produce a frond with a stem of 2 and the following bulb: - Let yel be the length of ton's bulb. - Replace the bulb of ton, - If yel > 256 (otherwise keep it static) - With the weld of - its top 128 elements - And a list of term-noun pairs: - The last 128 elements of ton's bulb - Preceded by a %lose-stemmed frond of - A cord from the tape - "[skipped " - A @ud rendering of yel - 256 - " frames]" - Do (*recursion point*) produce a list of tanks: - For each element in the bulb of ton - Switch on its leaf, by default leaving the element out of the product - For each %hunk, clam it to a tank - For each %lose, produce a leaf with the element clammed to an atom - and tripped (to a tape). - For each %mean, if the elment is an atom treat it as a %lose - Otherwise let mac be the element macked by its tail. - If the computation fails, produce a "####" leaf, else clam - the result to a tank. - For each %spot, let sot be the element clammed to a spot. - Produce a leaf with - The weld of - The path in sot converted to a tank and then a tape - ":<[" - [[p.p ] ] in the pint in sot rendered as @ud - " " - [[ q.p] ] in the pint in sot rendered as @ud - "].[" - [ [p.q ]] in the pint in sot rendered as @ud - " " - [ [ q.p]] in the pint in sot rendered as @ud - "]>" - - Examples - ~zod/try=> (mook [%0 5 4 5 1]) - [%0 p=[5 4 5 1]] - ~zod/try=> (mook [%2 ~[[%hunk %rose ["<" "," ">"] ~[[%leaf "err"]]]]]) - [%2 p=~[[%rose p=[p="<" q="," r=">"] q=[i=[%leaf p="err"] t=~]]]] - ~zod/try=> (mook [%2 ~[[%malformed %elem] [%lose 'do print']]]) - [%2 p=~[[%leaf p="do print"]]] - ~zod/try=> (mook [%2 ~[[%spot /b/repl [[1 1] 1 2]] [%mean |.(!!)]]]) - [%2 p=~[[%leaf p="/b/repl/:<[1 1].[1 2]>"] [%leaf p="####"]]] -++ mang - XX - Description: - XX - --- - XX - Examples - XX -++ mong - XX - Comment: - XX - Description: - Mang is just like mack, but accepting a sky. - It produces a unit computation result. - --- - Creates a dry %gold gate accepting cell ['sub' 'fol'] and an - %iron unit-clam 'sky'. - Its output is a unit (of a noun). - Let 'ton' be the result of monging the sample. - Unless ton has stem 0, produce the empty unit, otherwise produce one - containing ton's bulb. -++ mung - XX - Description: - XX - --- - XX - Examples - XX -++ mule - XX - Description: - XX - --- - XX - Examples - XX -++ mute - XX - Description: - XX - --- - XX - Examples - XX - -section 2eP, diff **noted as "(move me)" in source** - -++ berk -++ diff -++ loss - ++ abet - ++ hink - ++ lonk - ++ lune - ++ merg - ++ main -++ locz -++ lore -++ role -++ lump -++ lure -++ limp -++ hump -++ husk -++ lurk -++ lusk - ++ abet - ++ done - ++ main -++ nude - ++ axes - ++ tred - -section 2eW, lite number theory - -++ egcd -++ pram -++ ramp -++ fo - ++ dif - ++ exp - ++ fra - ++ inv - ++ pro - ++ sit - ++ sum -++ ga - ++ dif - ++ dub - ++ pro - ++ toe - ++ sit - ++ fra - ++ inv - ++ pow - ++ pro - -section 2eX, jetted crypto - -++ aesc - ++ en - ++ de -++ ahem - ++ cipa - ++ co - ++ ix - ++ ro - ++ su - ++ pen - ++ co - ++ ix - ++ ro - ++ su - ++ pin - ++ co - ++ ix - ++ ro - ++ su - ++ mcol - ++ pode - ++ sube - ++ be - ++ ankh - ++ sark - ++ srow - ++ subs - ++ ex - ++ ix -++ curt - ++ cla - ++ sqr - ++ inv - ++ cad - ++ cub -++ ed - ++ norm - ++ xrec - ++ ward - ++ scam - ++ etch - ++ curv - ++ deco - ++ bb - ++ puck - ++ suck - ++ sign - ++ veri - -section 2eY, SHA-256 - -++ shad -++ shaf -++ shak -++ sham -++ shas -++ shax -++ shaw -++ og - ++ rad - ++ raw -++ shaz -++ shal -++ shan - -section 2eZ, OLD rendering - -++ show - ++ shep - ++ shop -++ at - ++ r - ++ rf - ++ rn - ++ rt - ++ rta - ++ rtam - ++ rub - ++ rud - ++ rum - ++ rup - ++ ruv - ++ rux - -chapter 2f, Hoon proper - -section 2fA, miscellaneous funs - -++ bull -++ cain -++ cell -++ core -++ cube -++ face -++ bean -++ flay -++ flee -++ foil -++ fork -++ cove -++ comb -++ cond -++ cons -++ fitz -++ flan -++ flip -++ flor -++ hike -++ hoax -++ hoof -++ jock -++ look -++ make -++ noah -++ onan -++ rain -++ ream -++ reck -++ seed -++ seem -++ seer -++ sell -++ pave -++ loot -++ slam -++ slim -++ slit -++ slym -++ slap -++ slop -++ skol -++ spat -++ spuc -++ spec -++ spud -++ slot -++ slum -++ stab -++ wash - -section 2fB, macro expansion - -++ ah - ++ blue - ++ gray - ++ puce -++ al - ++ blah - ++ home - ++ bunt - ++ clam - ++ cloq - ++ whip -++ ap - ++ etch - ++ feck - ++ hock - ++ open - ++ rake - ++ rusk - -section 2fC, compilation proper - -++ ut - ++ burn - ++ busk - ++ conk - ++ crop - ++ dext - ++ sint - ++ cool - ++ dank - ++ dart - ++ deal - ++ dial - ++ dish - ++ doge - ++ dole - ++ duck - ++ dune - ++ dunk - ++ fino - ++ fink - ++ finq - ++ fire - ++ firm - ++ fish - ++ fuse - ++ gain - ++ hang - ++ harp - ++ lose - ++ chip - ++ heal - ++ mint - ++ nice - ++ grow - ++ moot - ++ mull - ++ both - ++ nice - ++ grow - ++ bake - ++ meet - ++ nest - ++ cong - ++ cram - ++ dext - ++ sint - ++ park - ++ peek - ++ play - ++ reco - ++ repo - ++ rest - ++ seek - ++ seep - ++ sift - ++ snub - ++ tack - ++ tock - ++ wrap - -section 2fD, grammar - -++ vang -++ vast - ++ gash - ++ gasp - ++ glam - ++ hasp - ++ mota - ++ plex - ++ pray - ++ prey - ++ phax - ++ posh - ++ poof - ++ poon - ++ poor - ++ porc - ++ rump - ++ rood - ++ rupl - ++ sail - Templating language for rendering HTML web documents. - --- - Build dry %gold gate with sample bean `tol`. - Push bunt of bean `lin` onto the core below. - Build core, - --- - ++ ape - The apex node of - --- - Slam cook with: - The reverse of `amp` and the following gate: - Build dry %gold gate with sample tuna `tum`. Yield twig. - If: `tum` is [%e *], an element, - Then: Produce the twig of twig `p.tum` and sag slammed with `q.tum` - Else: Produce the sag slammed with `tum` and null, the twig of `tum` - --- - ++ amp - Entry point of the XML tree. Start parsing a template at `sem`. - Continue to parse with ++ba if in tall form and ++bat if in wide form. - --- - Gonadify pfix with: - sem, - If: tol, - Then: bam, - Else: bat - --- - ++ bam - Begin to parse the template in tall form. - --- - Slam knee with: - The bunt of tuna. - Build dry %gold trap which is cached (memoized) - Gonadify pose with: - Stag slammed with %f, pfix gonadified with: - (plus ace), 1 or whitespaces, - Cook slammed with rab, puv - Stag slammed with %e, pfix gonadified with: - `ag, - nal - Stag slammed with %e, hul, - Stag slammed with %f, nup, - Gonadify pfix with: - tis, - Stag slammed with %f, nol - Gonadify pfix with: - hep - Stag slammed with: - %a, - Gonadify pfix with gap, talL - Gonadify pfix with: - lus - Stag slammed with: - %b, - Gonadiffy pfix with gap, tall - Gonadify pfix with: - tar - Stag slammed with: - %c, - Gonadify pfix with gap, tall - Gonadify pfix with: - cen - Stag slammed with: - %d, - Gonadify pfix with gap, tall - Slam easy with [%f [%a [%smdq 10 ~]] ~] - --- - ++ bat - Begin to parse an entire template line in wide form. - --- - Slam knee with: - The bunt of tuna - Build dry %gold trap which is cached (memoized) - Gonadify pose with: - Stag slammed with %f, nup - Stag slammed with %f, ped - Stag slammed with: - %e, - Gonadify plug with hip, lif - Terminate pose gonadification. - --- - ++ bet - Begin to parse an inner line section in wide form. - --- - Slam knee with: - The bunt of tuna - Build dry %gold trap which is cached (memoized) - Gonadify pose with: - bat, - Gonadify pfix with: - hep - Stag slammed with %a, wide - Gonadify pfix with: - lus - Stag slammed with %b, wide - Gonadify pfix with: - tar - Stag slammed with %c, wide - Gonadify pfix with: - cen - Stag slammed with %d, wide - Terminate pose gonadification. - --- - ++ fry - Element or attribute name. - May contain '_', signifying ':', optionally followed by - class and/org id - --- - Slam cook with: - Build dry %gold gate with sample term `a`, unit term `b`: - If: `b` is null, - Then: Produce [%dtzz %tas a], - Else: Produce [[%dtzz %tas a] [%dtzz %tas u.b]] - Gonadify plug with: - sym, - Gonadify pose with: - Stag slammed with null, pfix gonadified with cab, sym. - Easy slammed with null. - ++ hag - Tag head - --- - Slam cook with: - Build dry %gold gate with sample twig `a` and produces `a`. - Gonadify plug with: - Stag slammed with: - %dtzz, - Stag slammed with: - %tas - Pose gonadified with: - Jest slammed with %script, - Jest slammed with %style, - Stag slammed with %clsg, jaw - Terminate plug gonadification. - ++ hig - Simple tag head. - --- - Slam cook with: - Build dry %gold gate with sample twig `a`, list of twigs `b`. Produce [a %clsg b]. - hog. - ++ hog - Tag head. - --- - Slam cook with: - Build dry %gold gate with sample tile: - twig `a` - unit term `b` - unit term `c` - unit twig `d` - list of twigs `e` - Terminate tile construction. - Yield pair of twig, list of twigs. - Set `e` to: If: `b` is null, - Then: Produce `e`, - Else: Produce [[[%dtzz %tas %class] [%smdq (trip u.b)]] e] - Set `e` to: If: `c` is null, - Then: Produce `e`, - Else: Produce [[[%dtzz %tas %id] [%smdq (trip u.c)]] e] - Set `e` to: If: `d` is null, - Then: Produce `e`, - Else: Produce [[[%dtzz %tas %href] u.d] e] - Produce pair [a e]. - Gonadify plug with: - fry, - Pose gonadified with: - Stag slammed with null, pfix gonadified with dot, sym - Easy slammed with null, - Pose gonadified with stag slammed with - Stag slammed with null, pfix gonadified with hax, sym - Easy slammed with null, - Pose gonadified with stag slammed with - Stag slammed with null, pfix gonadified with dot, stag slammed with %smdg, soil - Easy slammed with null, - Pose gonadified with: - ifix slammed with [pel per] and, - More slammed with plug gonadified with com, ace and, - Plug gonadified with fry, pfix gonadified with ace, wide - Easy slammed with null - Terminate pose gonadification. - Terminate plug gonadification. - ++ hoy - Tail attributes. - --- - Star slammed with: - pfix gonadified with: - plug gonadified with gap, tis - plug gonadified with fry, pfix gonadified with gap, tall - Terminate pfix gonadification. - ++ hul - Tall preface. - --- - Cook slammed with: - Build dry %gold gate with sample element tuna `a`, list twig `b`, list tuna `c`, - Yield [twig (list tuna)] element tuna. - Produce [[p.a %clsg (weld q.a b)] c] - Gonadify plug with hog, hoy, nol - ++ jaw - Wide attributes - --- - Gonadify pose with: - ifix slammed with [pel per] and, - More slammed with plug gonadified with com, ace, and, - plug gonadified fry, pfix gonadified with ace, wide - Easy slammed with null. - Terminate pose gonadification. - ++ lif - Wide elements. - --- - Slam cook with: - Build dry %gold gate with sample list of tuna `a` which produces `a` - Gonadify pose with: - pfix gonadied with col, pep - cold slammed with null, sem - easy slammed with null - --- - ++ luf - Wide elements. - --- - Slam cook with: - Build dry %gold gate with sample list of tuna `a` which produces `a` - Star slammed with: - Gonadify pfix with ace, bet. - --- - ++ nal - Unescaped tall tail. - --- - Slam cook with sample: - Build dry %gold gate with sample list of tuna `a` which produces `a`, - Slam ifix with: - Tile autoons gap and plug gonadified with gap, duz, - Slam most with: - gap, - Gonadify pfix with: - Gonadify pose with: - Gonadify pfix with: - ace, - Cook slammed with: - Build dry %gold gate with sample tape `a` which produces: - [%a %smdq (weld a `tape`[`@`10 ~])], - where (weld a `tape`[`@`10 ~] is the concatenation - of tape `a` with the newline character. - Star slammed with shim slamme with 32, 255. - Terminate pfix gonadification. - Terminate pose gonadification. - Terminate pfix gonadification. - - --- - ++ nol - Tall tail. - --- - Assert that tol is true, that we are parsing a tall form part of the template. - Slam cook with: - Build dry %gold gate with sample list of tuna `a` which produces `a`, - Gonadify pose with: - Slam cold with null, sem - pfix gonadified with col, pep called with tol replaced by false, to continue to parse in wide form. - pfix gonadified with: - Gonadify plug with col, ace. - Slam cook with rab called with tol replaced by false, to continue to parse in wide form, and puv. - ifix slammed with: - [gap :~(plug gap duz)], which disregards non-code before plug gonadifed with gap and duz. - Most slammed with gap, amp. - Temrinate pose gonadification. - --- - ++ nup - Wide quote. - --- - Slam cook with: - Build dry %gold gate with sample list of tuna `a` which produces `a` - Gonadify pose with: - Gonadify less with: - jest slammed with '"""'< - ifix slammed with: - [doq doq] - Cook slammed with rab, puv - inde slammed with: - ifix slammed with: - Jest slammed with '"""\0a' and jest slammed with '\0a"""', - Cook slammed with rab, puv called with `lin` tossed for false. - Terminate pose gonnadification. - --- - - ++ pab - Bracketed element. - --- - Slam ifix with [kel ker], plug gonadified with: - hig, to parse an uppercase letter followed by, - luf, to parse wide elements. - --- - - ++ ped - Wide flow. - --- - Slam cook with: - Dry %gold gate with sample list of tuna `a` which produces `a` - ifix slammed with [pel per], more slammed with ace, bet. - --- - - ++ pep - Wrapper tuna. - --- - Slam cook with: - Build dry %gold gate with sample list of tuna `a` which produces `a` - Gonadify pose with: - ped, - ifix slammed with: - [pel per], - More slammed with ace, bet - cook slammed with: - Build dry %gold gate with sample cord, - Which produces list of element [%a %smdg (trip +<)]. - qut - Gonadify plug with bat, easy slammed with null. - Terminate plug gonadification. - Terminate pose gonadification. - --- - - ++ puv - Wide/tall flow. Parse wide form interpolated Hoon code in any tag, - - --- - Slam cook with: - Build dry %gold with samlpe list of beets `a` which produces `a` - The slam of star with: - Gonadify pose with: - pfix gonadified with: - bas, - pose slammed with: - mask slammed with tape "-+*%;\{", - bas, doq, bix:ab. - pfix gonadified with hep, stag slammed with %a, sump - pfix gonadified with lus, stag slammed with %b, sump - pfix gonadified with tar, stag slammed with %c, sump - pfix gonadified with cen, stag slammed with %d, sump - pfix gonadified with sem, stag slammed with %e, - less gonadified with: - bas, kel, - If: tol, Then: fail, Else: doq - prn - If: lin, Then: fail, - Else: Gonadify less with: - Jest slammed with '\0a"""', - Just slammed with '\0a' - Stag slammed with %a, sump - Terminate pose gonadification. - --- - ++ rab - Beet to tuna. - --- - Build a dry %gold gate with sample list of beets, `reb` - Yield list of tuna. - Push bunt of [sim=(list ,@) tuz=(list tuna)] - Kick dry %gold trap. Yield list of tuna. - If: `reb` is null, - Then: Set `sim` to Unless: tol, Then: Produce sim, - Else: Produce [10 |-(?~(sim sim ?:(=(32 i.sim) $(sim t.tim) sim)))] - Else: If: The head of `reb` is an atom, - Then: Produce the toss `reb` for the tail of `reb`, `sim` for [i.reb sim] - Else: Push `zut` is the toss of `reb` for the tail of `reb`, `sim` for null - If: `sim` is null, Then: Produce [i.reb zut], - Else: Produce [[%a %smdq (flop sim)] i.reb zut] - ++ sag - Produce a twig from a tuna. - --- - Build dry %gold gate with sample list of tunas, `lut` - Yield twig. - Pair %cltr and, - Build dry %gold trap. Yield list of twigs. - If: `lut` is null, - Then: Produce [[%dtzz %n ~] ~], - Else: Switch on the head of the head of `lut`, - if %a, produce [[%clfs p.i.lut] $(lut, t.lut)], - if %b, produce [p.i.lut $(lut t.lut)] - if %c, produce the reverse cell of null and, - Triple %cndt, cast of [p.i.lut $(lut t.lut)] to a twig and, - Triple %tsbr, cast of [[%axil %noun] [%axil %noun]] to a tile and, - Pair %brcn and, - Yield a map of terms to feet, - Reverse cell of [~ ~] and, - Push `sug` is [[%& 12] ~] - Triple %$, %elm, and, - Quad %wtsg, `sug`, [%cnts `sug` [[[%& 1] ~] [~ 13]]] - if %d, produce [%cnhp] - if %e, produce - if %f, produce - where $(lut, t.lut) is the toss of `lut` for the tail of `lut`. - Terminate switch statement. - --- - ++ scat - ++ soil - ++ sump - ++ noil - ++ toad - ++ rung - ++ gunk - ++ muck - ++ butt - ++ loaf - ++ lobe - ++ exqa - ++ exqb - ++ exqc - ++ exqd - ++ exqe - ++ norm - ++ boog - ++ wisp - ++ toad - ++ rune - ++ glop - ++ gunk - ++ butt - ++ ulva - ++ hank - ++ loaf - ++ lobe - ++ mash - ++ muck - ++ teak - ++ race - ++ rack - ++ rick - ++ expa - ++ expb - ++ expc - ++ expd - ++ expe - ++ expf - ++ expg - ++ exph - ++ expi - ++ expj - ++ expk - ++ expm - ++ expn - ++ expo - ++ expp - ++ expq - ++ expr - ++ exps - ++ expt - ++ expu - ++ expv - ++ expw - ++ expx - ++ expy - ++ expz - ++ hina - ++ hinb - ++ hinc - ++ hind - ++ hine - ++ hinf - ++ hing - ++ bonk - ++ bont - ++ bony - ++ bonz - ++ lung - ++ long - ++ lobo - ++ loon - ++ lute - ++ rope - ++ tall - ++ wide - ++ hill - ++ howl - ++ toil - ++ wart -++ vest -++ vice - -volume 3, Arvo models and skeleton - -++ arch -++ bead -++ care -++ case -++ desk -++ cage -++ chop -++ curd -++ disk -++ duct -++ gene -++ glob -++ herd -++ hilt -++ hypo -++ khan -++ lens - ++ v - ++ w - ++ x - ++ y - ++ z -++ logo -++ lode -++ mark -++ mill -++ milt -++ monk -++ mold -++ muse -++ mosh -++ move -++ ovum -++ pane -++ pone -++ ship -++ sled -++ slut -++ vile -++ wire -++ slod -++ slub - -section 3bE, Arvo core - -++ vent - ++ ruck - ++ wink - ++ doze - ++ sike - ++ souk - ++ sunk - ++ song - ++ spuc - ++ sump - ++ said - ++ scry - ++ soar - ++ swim -++ vint -++ viol -++ is - ++ beck - ++ dink - ++ dint - ++ doos - ++ hurl - ++ race - ++ fire - ++ jack - ++ kick - -Postface - - ++ come - ++ keep - ++ load - ++ peek - ++ poke - ++ wish -++ come -++ keep -++ load -++ peek -++ poke -++ vega -++ veer -++ wish diff --git a/urb/zod/main/doc/ref/splitDocs/ForwardNock.txt b/urb/zod/main/doc/ref/splitDocs/ForwardNock.txt deleted file mode 100644 index 13683bdee..000000000 --- a/urb/zod/main/doc/ref/splitDocs/ForwardNock.txt +++ /dev/null @@ -1,2 +0,0 @@ -Forward -Nock diff --git a/urb/zod/main/doc/ref/splitDocs/hoonPreface.txt b/urb/zod/main/doc/ref/splitDocs/hoonPreface.txt deleted file mode 100644 index 264fb8c23..000000000 --- a/urb/zod/main/doc/ref/splitDocs/hoonPreface.txt +++ /dev/null @@ -1,2 +0,0 @@ -Hoon -Preface diff --git a/urb/zod/main/doc/ref/splitDocs/volume0.txt b/urb/zod/main/doc/ref/splitDocs/volume0.txt deleted file mode 100644 index b5be75ce2..000000000 --- a/urb/zod/main/doc/ref/splitDocs/volume0.txt +++ /dev/null @@ -1,15 +0,0 @@ -volume 0, version stub - - ++ stub - Declares the current Hoon version number in degrees Kelvin. - - In Kelvin versioning -the true Martian way to permanently freeze a - system- releases count down by integer degrees Kelvin. At absolute - zero, the system can no longer be changed. At 1K, one more - modification is possible. And so on. - --- - ~zod/try=> stub - 164 - --- - - diff --git a/urb/zod/main/doc/ref/splitDocs/volume1.txt b/urb/zod/main/doc/ref/splitDocs/volume1.txt deleted file mode 100644 index 91d10cfd7..000000000 --- a/urb/zod/main/doc/ref/splitDocs/volume1.txt +++ /dev/null @@ -1,2705 +0,0 @@ -volume 1, Hoon models - - ++ abel - XX biblical - --- - Aliases ++typo. [#typo] - --- - - ++ axis - A Nock axis, an address inside a Nock noun. - --- - Clammed atom [#axil]. - --- - - ++ also - XX unused? - - ++ base - The cases of an %axil tile [#tile]. - --- - See %axil in ++tile. --- - - ++ beer - ++ beet - - ++ bloq - An atom representing a blocksize, by convention expressed as a power of 2. - - Clammed atom [#axil]. - --- - ++met measures how many bloqs long an atom is. It takes a bloq - and an atom. In the below example, the 256 is 2 bloqs of 2^3 long. That - is, it takes two bytes to represent the atom 256 - - ~zod/try=> (met 3 256) - 2 - --- - - ++ calf - - ++ char - A single character. - --- - Atom with odor [#type]. A @tD is a single Unicode byte. - --- - ++tape [#tape], which is a string type, is a list of chars. - --- - - ++ chum - The jet hint information that must be present in the body of a ~/ - or ~% rune. - --- - A %fern of the following cases: - - the jet's name - - the jet's name and the kelvin number - - the jet's vendor, name and kelvin number - - the jet's vendor, name, legacy major.minor version and kelvin number - --- - - ++ claw - XX unused? - - ++ coat - ++ coil - ++ coin - - ++ cord - One of Hoon's two string types (the other being ++tape). A cord is an - atom of UTF-8 text. - --- - Atom with odor. @t is a Unicode atom. The order of bytes in a @t are - little-endian, i.e. the first character in the text is the low byte of - the atom. - --- - ~zod/try=> `@ux`'foobar' - 0x7261.626f.6f66 - --- - - ++ date - A point in time. - --- - A loobean designating AD or BC, a year atom, a month atom, and a ++tarp - , which is a day atom and a time. - --- - ++yell produces a ++date from a @da (a date atom) - - ~zod/try=> (yell ~2014.6.6..21.09.15..0a16) - [d=106.751.991.820.172 h=21 m=9 s=15 f=~[0xa16]] - --- - - ++ dime - ++ dram - The structure of a unix filesystem tree. - --- - One of two cases: - | a directory - a map of names to deeper tree structures. - % a file - a numbered atom of data. - --- - Cards %dire and %pour in zuse require a ++dram argument to target. - --- - ++ each - ++ edge - ++ foot - ++ gear - ++ hair - ++ hapt - ++ like - ++ limb - ++ line - ++ list - ++ mane - ++ mano - ++ manx - ++ marl - ++ mars - ++ mart - ++ marx - ++ metl - ++ null - ++ odor - ++ tarp - ++ time - ++ tree - ++ nail - ++ numb - ++ pair - ++ pass - ++ path - ++ pint - ++ port - ++ post - ++ prop - ++ qual - ++ rege - ++ ring - ++ rule - ++ span - A restricted text atom for canonical atom syntaxes. The prefix is `~.`. - There are no escape sequences except `~~`, which means `~`, and `~-`, - which means `_`. - and . encode themselves. No other characters - besides numbers and lowercase letters are permitted. - --- - ~zod/try=> `@t`~.foo - 'foo' - --- - ~zod/try=> `@t`~.foo.bar - 'foo.bar' - --- - ~zod/try=> `@t`~.foo~~bar - 'foo~bar' - --- - ~zod/try=> `@t`~.foo~-bar - 'foo_bar' - --- - ~zod/try=> `@t`~.foo-bar - 'foo-bar' - --- - ++ spot - ++ tank - ++ tape - One of Hoon's two string types (the other being ++cord). A tape is a - list of chars. - --- - ~zod/try=> `(list ,char)`"foobar" - "foobar" - --- - ~zod/try=> `(list ,@)`"foobar" - ~[102 111 111 98 97 114] - --- - ++ term - A restricted text atom for Hoon constants. The only characters - permitted are lowercase ASCII, - except as the first or last character, - and 0-9 except as the first character. - - The syntax for @tas is the text itself, always preceded by %. This - means a term is always cubical. You can cast it to @tas if you like, - but we just about always want the cube: - --- - ~zod/try=> %dead-fish9 - %dead-fish9 - --- - ~zod/try=> -:!>(%dead-fish9) - [%cube p=271.101.667.197.767.630.546.276 q=[%atom p=%tas]] - --- - The empty @tas has a special syntax, $: - - ~zod/try=> %$ - %$ - --- - A term without % is not a constant, but a name: - - ~zod/try=> dead-fish9 - ! -find-limb.dead-fish9 - ! find-none - ! exit - --- - - ++ tiki - - ++ tile - - A tile is a convenient way of making a well-typed noun. It can be - reduced in four ways - cryptically called bunt, clam, - fish, and whip. each tile corresponds to a well-defined - type, called its icon. A tile is converted statically into a twig, - which in turn may (depending on the conversion) produce the icon, test - for it, etc. And always, the icon is some function of the tile and its - subject. - --- - There are nine cases within ++tile: - - [p=tile q=tile] - - Tiles autocons, just like twigs - a cell of tiles is a tile of a - cell. - - (,[@ @] [4 5]) is [4 5], which is the same as [(,@ 4) (,@ 5)], - producing [4 5]. Clearly, (,[@ @] [4 5]) should not be the same as - [(,@ [4 5]) (,@ [4 5])] - which would produce merely [0 0].) - - The irregular wide syntax for tile autocons is the same as the - syntax for twig autocons - eg, [@ @], a cell of atoms. But there is - also a regular tall/wide tuple syntax, with $: (buccol, %bccl). - Thus instead of [@ @] we could write: - - $: @ - @ - == - - [%axil p=base] - - An %axil is a simple built-in mechanism for a few basic icons: an - atom of any odor (@odor, or just @ for the odorless base atom); a - noun (*); a cell of nouns (^); a loobean ?; and null ~. - - [%bark p=term q=tile] - - Wrap a name round a tile. a=* parses as [%bark %a %noun]. - - This is another case where the tile syntax matches the twig syntax, - but only in the irregular form. The twig equivalent of %bark is of - course ^= (kettis, %ktts). But the tile is $= (buctis): - - $= a - * - - Obviously a silly syntactic arrangement. But you can need it if q - is really big. - - [%bush p=tile q=tile] - - A %bush is a tile in which there are two kinds of nouns: cells - whose head is a cell (tile p) and cells whose head is an atom (tile - q). Its default value is the value of q. - - We don't have to look very far to find a %bush - ++tile is one, as - is ++twig and ++nock. The rune is $& (bucpam). See ++tile above - p - is [p=tile q=tile], q is the $%. There is no irregular form. - - What's the use of a %bush? Often in a variety of data structures we - have something like autocons, in which forming a cell of two - instances has an obvious default semantics. - - Sure, we could attach these semantics to an atom, and just use a - %kelp. In twigs, tiles, or nock formulas, we could have an explicit - cons stem of some sort. But it would be a bulky as compared to - autocons. - - [%fern p=[i=tile t=(list tile)]] - - A %fern is a non-empty list of cases; its icon is naturally a - %fork. The programmer is responsible for ensuring that the cases - are actually orthogonal (unlike with the structured forks, %bush, - %kelp and %reed). A good general practice is to use %ferns only - with %leafs. - - For example, a fern that could be %foo or %bar has the irregular - form ?(%foo %bar), or the regular form - - $? %foo - %bar - == - - The default value is the first - in this case, %foo. - - [%kelp p=[i=line t=(list line)]] - - A kelp is the workhorse of tiles - it provides the most common data - structure in any language, the discriminated union. - - In Hoon, the head (which must be a leaf) is called the stem. The - tail (which can be anything) is the bulb. Cases of a kelp are known - inevitably as fronds. - - (Yes. We're aware that "kelp" is not properly a singular noun. In - Hoon - it is properly a singular noun. And that's that. And oddly, - it's not that hard to run out of four-letter plants.) - - $%, buccen, is a tile rune that produces a %kelp. $% takes a list - of lines, which are labelled cases, closed by ==. - - $% p - q - == - [%leaf p=term q=@] - - A %leaf is an atomic constant of value q and odor p. Obviously its - icon is a %cube. - - The syntax for a leaf is the same as the twig syntax, except that % - is never required to generate a cube. For instance, as a twig, 7 - has a type of [%atom %ud]; %7 has a type of [%cube 7 [%atom %ud]]. - But the icon of the leaf 7 is, again, [%cube 7 [%atom %ud]]. - - [%reed p=tile q=tile] - - A %reed is a tile whose icon contains two kinds of nouns: atoms of - tile p and cells of tile q. - - There is no irregular form of %reed. The regular form is: - - $| ~ [@ @] == - - or in wide mode $|(~ [@ @]) - - [%herb p=twig] - - You can write your own tile which is just a gate, accepting a - sample of * and normalizing it as you choose. If you use a twig as - a tile, it's treated as an herb. - - For example, when we define a gate like ++base, as defined above - (remember that when we use a tile as a twig, we get the clam, ie, - the normalizing gate) base is just an arm which produces a gate. - Nothing has any idea that this gate is built from a tile of its - own. - - So when we parse [p=base q=base] as a tile, the parser builds the - noun: - - [[%bark %p %herb %cnzy %base] [%bark %q %herb %cnzy %base]] In - other words, base in p=base is actually a twig, but this twig - happens to produce a normalizing gate generated by clamming a tile. - In time this will come to seem totally straightforward, but don't - be surprised if it confuses you now. - - The important thing to remember about %herb is that the actual twig - we provide will be applied when we whip or clam. Hence, arbitrary - normalization and/or verification procedures may be part of the - herbaceous custom tile. - --- - - ++ toga - ++ trel - ++ tuna - - An XML template tree. - - Leaf %a contains plain-text, %b an empty tag, %c a static list, %d a - dynamic list, %e a full node element containing a twig and a list of - tuna, and %f is a empty node. - - ++ twig TODO: delete Form, normalize indentation - - A twig is an abstract syntax tree or AST, which we produce when we - parse a Hoon expression, file, etc. A twig is a noun that's converted - into a Nock formula, with the assistance of a type which describes the - subject of the formula: - - [subject-type twig] => formula - - But actually this isn't quite right, because Hoon does something called - "type inference." When we have a type that describes the subject for - the formula we're trying to generate, as we generate that formula we - want to also generate a type for the product of that formula on that - subject. So our compiler computes: - - [subject-type twig] => [product-type formula] - - As long as subject-type is a correct description of some subject, you - can take any twig and compile it against subject-type, producing a - formula such that *(subject formula) is a product correctly described - by product-type. - - Actually, this works well enough that in Hoon there is no direct syntax - for defining or declaring a type. There is only a syntax for - constructing twigs. Types are always produced by inference. - --- - - There are 112 cases of ++twig - - [p=twig q=twig] - - A twig can be a pair of twigs. - - [%$ p=axis] - - Refers to a nock axis. - - [%bccb p=tile] - - $_ ("buccab") is a synthetic hoon that produces the bunt (default - value) for p. - - Tall - $_ p - - Wide - $_(p) - - Irregular - _p - - Reduction - See ++open - - [%bccm p=tile] - - $, ("buccom") is a synthetic rune that produces a normalizing gate - (clam) for p. - - Talln - $, p - - Wide - none - - Irregular - ,p - - Reduction - ~(clam al p) - - See ++clam in ++al. - - [%bcpt p=wing q=tile] - - $@ ("bucpat") is a (just barely) natural hoon that whips wing p - into tile q. - - Tall - $@ p - q - - Wide - $@(p q) - - Irregular - p@q - - Reduction - none, natural - - [%bctr p=tile] - - $* ("buctar") is a synthetic rune that produces the bunt (default - value) for p as a compile-time constant. - - Tall - $* p - - Wide - $*(p) - - Reduction - ^~ ~(bunt al p) - - See ++bunt in al. - - [%bczp p=base] - - $! ("buczap") is a synthetic internal rune that produces the bunt - (default value) for [%axil p]. - - Reduction - See ++open - - [%brcb p=tile q=(map term foot)] - - |_ ("barcab") is a synthetic rune that produces a %gold tray with - sample p, arms q. q is an associative array of names and - expressions, each pair of which is called an arm. After any number - of dry (%ash, ++) and/or wet (%elm, +-) arms, the array is - terminated with -- - - Tall - |_ p - ++ p.n.q - q.n.q - -- - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%brcn p=(map term foot)] - - |% ("barcen") is a natural rune that produces a %gold core from an - associative array of names and expressions, each pair of which is - called an arm. After any number of dry (%ash, ++) and/or wet (%elm, - +-) arms, the array is terminated with -- - - Tall - |% - ++ p.n.q - q.n.q - +- p.n.l.q - q.n.l.q - -- - - Wide - none - - Irregular - none - - Reduction - none, natural - - [%brdt p=twig] - - |. ("bardot") is a synthetic rune that produces a dry %gold trap - from twig p. - - Tall - |. p - - Wide - |.(p) - - Irregular - none - - Reduction - See ++open - - [%brfs p=tile q=(map term foot)] - - |/ ("barfas") is a synthetic rune that produces a vulcanized %gold - tray with arms q, sample p. - - Tall - |/ p - +- p.n.q - q.n.q - -- - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%brkt p=twig q=(map term foot)] - - |^ ("barket") is a synthetic rune that produces a %gold book with - arms q, with p as %$, and kicks it. - - Tall - |^ p - ++ p.n.q - q.n.q - -- - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%brhp p=twig] - - |- ("barhep") is a synthetic rune that produces a dry %gold trap - from twig p, and kicks it. - - Tall - |- - p - - Wide - |-(p) - - Irregular - none - - Reduction - See ++open - - [%brls p=tile q=twig] - - |+ ("barlus") is a synthetic rune that produces a dry %iron gate - with arm q, sample p. - - Tall - |+ p - q - - Wide - |+(p q) - - Irregular - none - - Reduction - See ++open - - [%brpt p=tile q=tile r=twig] - - XX not used - - [%brtr p=tile q=twig] - - |* ("bartar") is a synthetic rune that produces a vulcanized wet - gate with arm q, sample p. - - Tall - |* p - q - - Wide - |*(p q) - - Irregular - none - - Reduction - See ++open - - [%brts p=tile q=twig] - - |= ("bartis") is a synthetic hoon that produces a dry %gold gate - with arm q, sample p. - - Tall - |= p - q - - Wide - |=(p q) - - Irregular - none - - Reduction - See ++open - - [%brwt p=twig] - - |? ("barwut") is a synthetic rune that produces a dry %lead trap. - - Tall - |? p - - Wide - |?(p) - - Irregular - none - - Reduction - See ++open - - [%clcb p=twig q=twig] - - :_ ("colcab") is a synthetic rune that produces the cell [q p]. - - Tall - :_ p - q - - Wide - :_(p q) - - Irregular - none - - Reduction - See ++open - - [%clcn p=tusk] - - :% ("colcen") is a synthetic rune that produces a cell [[p ~] ~] - from a list of twigs p, terminated by a == - - Tall - :% i.p - i.t.p - i.t.t.p - == - - Wide - :%(i.p i.t.p i.t.t.p) - - Irregular - %[i.p i.t.p i.t.t.p] - - Reduction - See ++open - - [%clfs p=twig] - - :/ ("colfas") is a synthetic rune that, given a twig p, produces - [%$ [%$ p ~] ~], i.e., [0 [0 p 0] 0]. Used in practice only in - string interpolation. - - Tall - :/ p - - Wide - :/(p) - - Irregular - none - - Reduction - See ++open - - [%clkt p=twig q=twig r=twig s=twig] - - :^ ("colket") is a synthetic rune that produces a cell [p q r s] - from twigs p, q, r, and s. - - Tall - :^ p - q - r - s - - Wide - :^(p q r s) - - Irregular - none - - Reduction - See ++open - - [%clhp p=twig q=twig] - - :- ("colhep") is a synthetic rune that produces the cell [p q] from - twigs p and q. - - Tall - :- p - q - - Wide - :-(p q) - - Irregular - [p q] - - Reduction - See ++open - - [%clls p=twig q=twig r=twig] - - :+ ("collus") is a synthetic rune that produces a cell [p q r] from - twigs p, q, and r. - - Tall - :+ p - q - r - - Wide - :+(p q r) - - Irregular - none - - Reduction - See ++open - - [%clsg p=tusk] - - :~ ("colsig") is a synthetic rune that produces a null-terminated - tuple of a list of twigs p. - - Tall - :~ i.p - i.t.p - i.t.t.p - == - - Wide - :~(i.p i.t.p i.t.t.p) - - Irregular - ~[i.p i.t.p i.t.t.p] - - Reduction - See ++open - - [%cltr p=tusk] - - :* ("coltar") is a synthetic hoon that produces a tuple from p, a - list of twigs. - - Tall - :* i.p - i.t.p - i.t.t.p - == - - Wide - :*(i.p i.t.p i.t.t.p) - - Irregular - [i.p i.t.p i.t.t.p] - - Reduction - See ++open - - [%clzz p=tusk] - - "colzaz" is a synthetic internal rune that promotes its tusk p - within a %clsg or %cltr tusk. - - Not used at present. - - [%cncb p=wing q=tram] - - %_ ("cencab") is a synthetic rune that evaluates the wing p with - the changes specified in tram q, then casts the product back to p. - - Tall - %_ p - p.i.q q.i.q - p.i.t.q q.i.t.q - == - - Wide - %_(p p.i.q q.i.q, p.i.t.q q.i.t.q) - - Irregular - none - - Reduction - See ++open - - [%cncl p=twig q=twig] - - %: ("cencol") is a synthetic rune that pulls %$ from the twig p - with the with its sample set to q. - - Tall - %: p - q - - Wide - %:(p q) - - Irregular - none - - Reduction - See ++open - - [%cndt p=twig q=twig] - - %. ("cendot") is a synthetic rune that slams the gate q with - [%cltr p]. The dual of %cnhp. - - Tall - %. p - q - - Wide - %.(p q) - - Irregular - none - - Reduction - %- q - p - - See ++open - - [%cnhp p=twig q=tusk] - - %- ("cenhep") is a synthetic rune that slams the gate p with - [%cltr q]. - - Tall - %- p - q - - Wide - %-(p q) - - Irregular - (p q) - - Reduction - See ++open - - [%cntr p=wing q=twig r=tram] - - %* is a synthetic rune that pulls the wing p from tray q with changes r. - - Tall - %* p q - p.i.r q.i.r - p.i.t.r q.i.t.r - == - - Wide - %*(p q p.i.r q.i.r, p.i.t.r q.i.t.r) - - Irregular - none - - Reduction - See ++open - - [%cnkt p=twig q=twig r=twig s=twig] - - %^ ("cenket") is a synthetic rune that slams gate p with [%cntr q r s]. - - Tall - %^ p - q - r - s - - Wide - %^(p q r s) - - Irregular - none - - Reduction - See ++open - - [%cnls p=twig q=twig r=twig] - - %+ ("cenlus") is a synthetic rune that slams gate p with [%cntr q r]. - - Tall - %+ p - r - s - - Wide - %+(p q r) - - Irregular - none - - Reduction - See ++open - - [%cnsg p=wing q=twig r=twig] - - %~ ("censig") is a synthetic rune that pulls p from the tray q with its - sample set to r. - - Tall - %~ p - q - r - - Wide - %~(p q r) - - Irregular - ~(p q r) - - Reduction - See ++open - - [%cnts p=wing q=tram] - - %= ("centis") is a natural rune that evaluates p with the changes - specified in q. - - Tall - %= p - p.i.q q.i.q - p.i.t.q q.i.t.q - == - - Wide - %=(p p.i.q q.i.q, p.i.t.q q.i.t.q) - - Irregular - p(p.i.q q.i.q, p.i.t.q q.i.t.q) - - Reduction - See ++open - - [%cnzy p=term] - - "cenzey" is a synthetic internal rune that pulls limb p from the subject. - - Tall/Wide/Irregular - none, internal - - Reduction - See ++open - - [%cnzz p=wing] - - "cenzaz" is a synthetic internal rune that pulls wing p from the subject. - - Form - none, internal - - Reduction - See ++open - - [%dtkt p=twig] - - .^ ("dotket") is a natural rune that generates Nock operator 11, which in - virtual userspace Nock (++mock) loads a file from the global namespace. - - Tall - .^ p - - Wide - .^(p) - - Irregular - ^:type/path - - ^/path - - Reduction - none, natural - - [%dtls p=twig] - - .+ ("dotlus") is a natural rune that generates Nock operator 4, which - increments an atomic operand. - - Tall - .+ p - - Wide - .+(p) - - Irregular - +(p) - - Reduction - none, natural - - [%dtzy p=term q=@] - - "dotzey" is a natural internal rune that produces a non-cubed atomic - constant of odor p and value q. - - Tall/Wide/Irregular - none, internal - - Reduction - none, natural - - [%dtzz p=term q=*] - - "dotzaz" is a natural internal rune that produces a cubed noun constant of - value q and odor p, if q is an atom. - - Tall/Wide/Irregular - none, internal - - Reduction - none, natural - - [%dttr p=twig q=twig] - - .* ("dottar") is a natural rune that calculates the Nock of subject p, - formula q. - - Tall - .* p - q - - Wide - .*(p q) - - Irregular - none - - Reduction - none, natural - - [%dtts p=twig q=twig] - - .= ("dottis") is a natural rune that applies Nock 5 (equals) to determine - if the products of p and q are equivalent. - - Tall - .= p - q - - Wide - .=(p q) - - Irregular - =(p q) - - Reduction - none, natural - - [%dtwt p=twig] - - .? ("dotwut") is a natural hoon that applies Nock 3 to a noun: if the - noun is a cell, it returns the loobean & (true); if the noun is an atom, - it returns the loobean | (false). - - Tall - .? p - - Wide - .?(p) - - Irregular - none - - Reduction - none, natural - - [%hxgl p=tusk] - - #< ("haxgal") is a synthetic rune that slams the assumed gate noah on - [%zpgr %cntr p]. See the Biblical names. - - Tall/Wide - none - - Irregular - >i.p i.t.p i.t.t.p< - - Reduction - See ++open - - [%hxgr p=tusk] - - #> ("haxgar") is a synthetic rune that slams the assumed gate cain on - [%zpgr %cntr p]. See the Biblical names. - - Tall/Wide - none - - Irregular - - - Reduction - See ++open - - [%ktbr p=twig] - - ^| ("ketbar") is a natural rune that converts a %gold core into an %iron - core. See geometric polymorphism. - - Tall - ^| p - - Wide - ^|(p) - - Irregular - none - - Reduction - none, natural - - [%ktdt p=twig q=twig] - - ^. ("ketdot") is a synthetic rune that casts q to the type of (p q). - - Tall - ^. p - q - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%ktls p=twig q=twig] - - ^+ ("ketlus") is a natural rune that casts the product of q to the - type of p, verifying that it contains the type of q. - - Tall - +^ p - q - - Wide - ^+(p q) - - Irregular - none - - Reduction - none, natural - - [%kthp p=tile q=twig] - - ^- ("kethep") is a synthetic rune that casts q to ~(bunt al p), - i.e., the icon of p. - - Tall - ^- p - q - - Wide - ^-(p q) - - Irregular - `p`q - - Reduction - See ++open - - [%ktpm p=twig] - - ^& ("ketpam") is a natural rune that converts a %gold core to %zinc core. - See geometric polymorphism. - - Tall - ^& p - - Wide - ^&(p) - - Irregular - none - - Reduction - none, natural - - [%ktsg p=twig] - - ^~ ("ketsig") is a natural rune that tries to execute p statically at - compile time; if this fails, p remains dynamic. - - Tall - ^~ p - - Wide - ^~(a) - - Irregular - none - - Reduction - none, natural - - [%ktts p=toga q=twig] - - ^= ("kettis") is a natural rune that wraps q in the toga p. The - toga is a powerful naming device that can assign an entire name - tree to a properly typed result. For instance, if foo produces - an unlabeled tuple [x y z], [a b=[c d]]=foo produces - [a=x b=[c=y d=z]]. - - Tall - ^= p - q - - Wide - ^=(p q) - - Irregular - none - - Reduction - none, natural - - [%ktwt p=twig] - - ^? ("ketwut") is a natural hoon that converts a %gold core into a - %lead core. See geometric polymorphism. - - Tall - ^? p - - Wide - ^?(p) - - Irregular - none - - Reduction - none, natural - - [%sgbr p=twig q=twig] - - ~| ("sigbar") is a synthetic rune that presents the product of p - in the stack trace if q crashes. Only performed as needed. - Generates %cain - see the Biblical names. - - Tall - ~| p - q - - Wide - ~|(p q) - - Irregular - none - - Reduction - See ++open, ++feck - - [%sgcb p=twig q=twig] - - ~_ ("sigcab") is a synthetic rune that inserts p, a trap producing a tank, - into the trace of q. - - Tall - ~_ p - q - - Wide - ~_(p q) - - Irregular - none - - Reduction - See ++open - - [%sgcn p=chum q=twig r=tyre s=twig] - - ~% ("sigcen") is a synthetic rune that identifies a core for specific - optimization. See jet propulsion. - - Tall - ~% p - q - == - p.i.r q.i.r - p.i.t.r q.i.t.r - == - s - - ~% p - q - ~ - s - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%sgfs p=chum q=twig] - - ~/ ("sigfas") is a synthetic rune that identifies an arm for specific - optimization. See jet propulsion. - - Tall - ~/ p - q - - Wide - ~/(p q) - - Irregular - none - - Reduction - See ++open - - [%sggl p=$|(term [p=term q=twig]) q=twig] - - ~< ("siggal") is a synthetic rune that applies arbitrary hint p to - the product of q. Does not wake the hint engine until the - computation is finished. - - Tall - ~< p - q - - Wide - ~<(p q) - - Irregular - none - - Reduction - See ++open - - [%sggr p=$|(term [p=term q=twig]) q=twig] - - ~> ("siggar") is a natural rune that applies arbitrary hint p to q. - - Tall - ~> p - q - - Wide - ~>(p q) - - Irregular - none - - Reduction - See ++open - - [%sgbc p=term q=twig] - - ~$ ("sigbuc") is a synthetic rune that labels computation q as p - for profiling (not currently enabled). - - Tall - ~$ p - q - - Wide - ~$(p q) - - Irregular - none - - Reduction - See ++open - - [%sgls p=@ q=twig] - -XX Solve ~+ ("siglus") is a synthetic rune that memoizes computation q - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%sgpm p=@ud q=twig r=twig] - - ~& ("sigpam") is a synthetic rune that prints q on the console - before computing r. p is the log priority 0-3, defaulting to 0. - - Tall - 0, debug - ~& q - r - - 1, notice - ~& > q - r - - 2, warning - ~& >> q - r - - 3, alarm - ~& >>> q - r - - Wide - ~&(>>> q r) - - Irregular - none - - Reduction - See ++open - - [%sgts p=twig q=twig] - - ~= ("sigtis") is a synthetic rune that hints to the interpreter - that q may produce a noun equal to the already existing p, - avoiding duplication. - - Tall - ~= p - q - - Wide - ~=(p q) - - Irregular - none - - Reduction - See ++open - - [%sgwt p=@ud q=twig r=twig s=twig] - - ~? ("sigwut") is a synthetic rune that prints r to the console - before computing s, iff q produces yes. p is the log priority, - 0-3, 0 by default - - Tall - 0, debug - ~? q - r - s - - 1, notice - ~? > q - r - s - - 2, warning - ~? >> q - r - s - - 3, alarm - ~? >>> q - r - s - - Wide - ~?(>>> q r s) - - Irregular - none - - Reduction - See ++open - - [%sgzp p=twig q=twig] - - ~! ("sigzap") is a natural rune for debugging uses only, - semantically equivalent to its own twig q. Should compilation - fail within q, ~! will show the type of p on the stacktrace. - - Tall - ~! p - q - - Wide - ~!(p q) - - Irregular - none - - Reduction - none, natural - - [%smcl p=twig q=tusk] - - ;: ("semcol") is a synthetic gate that applies p, a binary gate, - to the n-ary tuple q. - - Tall - ;: p - i.q - i.t.q - i.t.t.q - == - - Wide - ;:(p i.q i.t.q i.t.t.q) - - Irregular - :(p i.q i.t.q i.t.t.q) - - Reduction - See ++open - - [%smdt p=twig q=tusk] -XX determine function - - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%smdq p=(list beer)] -XX determine if internal/external - - ;" ("semdoq") is a synthetic rune used to make strings, - interpolated or not. - - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%smsg p=twig q=tusk] - -XX to do - - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%smsm p=twig q=twig] - - ;; ("semsem") is a synthetic rune that types q as a fixpoint of p. - Semantically identical to ((hard p) q). - - Tall - ;; p - q - - Wide - ;;(p q) - - Irregular - none - - Reduction - See ++open - - [%tsbr p=tile q=twig] - - =| ("tisbar") is a synthetic rune that pushes ~(bunt al p) on the - subject and sends it to q. - - Tall - =| p - q - - Wide - =|(p q) - - Irregular - none - - Reduction - =+(_p q) - See ++open, ++bunt in ++al - - [%tscl p=tram q=twig] - - =: ("tiscol") is a synthetic rune that produces q with the subject - by p. Uses %cncb, and so cannot change the subject type. - - Tall - =: p.i.p q.i.p - p.i.t.p q.i.t.p - p.i.t.t.p q.i.t.t.p - == - q - - Wide - none - - Irregular - noen - - Reduction - See ++open - - [%tscn p=twig q=twig] -XX to do - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%tsdt p=wing q=twig r=twig] - - =. ("tisdot") is a synthetic rune that produces r with p in the - subject set to q. Uses %cncb, and so cannot change the subject - p. - - Tall - =. p - q - r - - =. p q - r - - Wide - =.(p q r) - - Irregular - none - - Reduction - See ++open - - [%tsfs p=twig q=twig] - XX not used - - [%tsgl p=twig q=twig] - - =< ("tisgal") is a synthetic rune that uses the product of q as - the subject of p. - - Tall - =< p - q - - Wide - =<(p q) - - Irregular - - Reduction - See ++open - - [%tshp p=twig q=twig] - - =- ("tishep") is a synthetic rune that pushes q on the subject - and sends it to p. Dual of =+ ("tislup") - - - Tall - =- p - q - - Wide - =- - - Irregular - none - - Reduction - See ++open - - [%tsgr p=twig q=twig] - - => ("tisgar") is a natural rune that uses the product of p as the - subject of q. - - Tall - => p - q - - Wide - =>(p q) - - Irregular - none - - Reduction - none, natural - - [%tskt p=twig q=twig r=twig s=twig] - - =^ ("tisket") is a synthetic rune that handles a product which is - a cell of the new result, and a mutation to the subject. - - Tall - Kingside - =^ p - q - r - s - - Queenside - =^ p q - r - s - - Wide - =^(p q r s) - - Irregular - none - - Reduction - See ++open - - [%tsls p=twig q=twig] - - =+ ("tislus") is a synthetic rune that pushes p on the subject - and sends it to q. Semantically equavlent to Nock 8.Dual of =- ("tishep") - - Tall - =+ p - q - - Wide - =+(p q) - - Irregular - none - - Reduction - See ++open - - [%tspm p=tile q=twig] - - XX not used - - [%tspt p=tile q=twig] - - XX not used - - [%tstr p=term q=wing r=twig] - - =* ("tistar") is a natural rune that creates a %bull, or alias, - type. - - Tall - =* p q - r - - Wide - =*(p q r) - - Irregular - none - - Reduction - none, natural - - [%tssg p=tusk] - - =~ ("tissig") is a synthetic rune that composes a list of twigs. - - Tall - Kingside - =~ i.p - i.t.p - i.t.t.p - == - - Queenside - =~ i.p - i.t.p - i.t.t.p - == - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%wtbr p=tusk] - - ?| ("wutbar") is a synthetic rune that computes the "or" of the - loobeans in p. - - Tall - ?| i.p - i.t.p - i.t.t.p - == - - Wide - ?|(i.p i.t.p i.t.t.p) - - Irregular - |(i.p i.t.p i.t.t.p) - - Reduction - See ++open - - [%wthp p=wing q=tine] - - ?- ("wuthep") is a synthetic rune that selects a case in q for - the actual type of p. - - Tall - Kingside - ?- p - p.i.q q.i.q - p.i.t.q q.i.t.q - p.i.t.t.q q.i.t.t.q - == - - Queenside - ?- p - p.i.q - q.i.q - p.i.t.q - q.i.t.q - p.i.t.t.q - q.i.t.t.q - == - - Wide - ?-(p p.i.q q.i.q, p.i.t.q q.i.t.q, p.i.t.t.q q.i.t.t.q) - - Irregular - none - - Reduction - See ++open - - [%wthz p=tiki q=tine] - - "wuthaz" is a synthetic internal rune that selects a case in q - for the actual type of p. - - Tall/Wide/Irregular - none, internal - - Reduction - See ++open - - [%wtcl p=twig q=twig r=twig] - - ?: ("wutcol") is a natural rune that produces q if p is yes (&, 0), - or r if p is no (|, 1). - - Tall - ?: p - q - r - - Wide - ?:(p q r) - - Irregular - none - - Reduction - none, natural - - [%wtdt p=twig q=twig r=twig] - - ?. ("wutdot") is a synthetic rune that prduces r if p is yes - (&, 0), of q if p is no (|, 1). - - Tall - ?. p - q - r - - Wide - ?:(p q r) - - Irregular - none - - Reduction - none, natural - - [%wtkt p=wing q=twig r=twig] - - ?^ ("wutkey") is a synthetic rune that evaluates r if p is - equivalent to the bunt for its tile, otherwise q is evaluted. - - Tall - ?^ p - q - r - - Wide - ?^(p q r) - - Irregular - none - - Reduction - See ++open - - [%wtkz p=tiki q=twig r=twig] - - "wutkaz" is a synthetic, internal rune that evaluates r if p is - equivalent to the bunt for its tile, otherwise q is evaluated. - See tikis. - - Tall - ?^ p - q - r - - Wide - ?^(p q r) - - Irregular - none - - Reduction - See ++open - - [%wtgl p=twig q=twig] - - ?< ("wutgal") is a synthetic hoon that produces q, asserting that - p is no (|, 1). - - Tall - ?< p - q - - Wide - ?<(p q) - - Irregular - none - - Reduction - See ++open - - [%wtgr p=twig q=twig] - - ?> ("wutgar") is a synthetic hoon that produces q, asserting that - p is yes (&, 0). - - Tall - ?> p - q - - Wide - ?>(p q) - - Irregular - none - - Reduction - See ++open - - [%wtls p=wing q=twig r=tine] - - ?+ ("wutlus") is a synthetic rune that selects a case in q for - the actual type of p. - - Tall - Kingside - ?+ p - q - p.i.r q.i.r - p.i.t.r q.i.t.r - p.i.t.t.r q.i.t.t.r - == - - Queenside - ?+ p - q - p.i.r - q.i.r - p.i.t.r - q.i.t.r - p.i.t.t.r - q.i.t.t.r - == - - Wide - ?+(p p.i.r q.i.r, p.i.t.r q.i.t.r, p.i.t.t.r q.i.t.t.r) - - Irregular - none - - Reduction - See ++open - - [%wtlz p=tiki q=twig r=tine] - - "wutlaz" is a synthetic, internal rune that selects a case in q for - the actual type of p. - - Tall/Wide/Irregular - none, internal - - Reduction - See ++open - - [%wtpm p=tusk] - - ?& ("wutpam") is a synthetic hoon that computes the "and" of the - loobeans in p. - - Tall - ?& i.p - i.t.p - i.t.t.p - == - - Wide - ?&(i.p i.t.p i.t.t.p) - - Irregular - none - - Reduction - See ++open - - [%wtpt p=wing q=twig r=twig] - - ?@ ("wutpat") is a synthetic hoon that produces q if p is an - atom, r otherwise. - - Tall - Kingside - ?@ p - q - r - - Queenside - ?@ p - q - r - - Wide - ?@(p q r) - - Irregular - none - - Reduction - See ++open - - [%wtpz p=tiki q=twig r=twig] - - "wutpaz" is a synthetic hoon that produces q if p is an atom, r - otherwise. - - Tall - ?@ p - q - r - - Wide - ?@(p q r) - - Irregular - none - - Reduction - See ++open - - [%wtsg p=wing q=twig r=twig] - - ?~ ("wutsig") is a synthetic rune that produces q if p is ~, r - otherwise. - - Tall - ?~ p - q - r - - Wide - ?~(p q r) - - Irregular - none - - Reduction - See ++open - - [%wtsz p=tiki q=twig r=twig] - - "wutsaz" is a synthetic internal rune that produces q if p is ~, - r otherwise. - - Tall/Wide/Irregular - none, internal - - Reduction - See ++open - - [%wtts p=tile q=wing] - - ?= ("wuttis") is a natural rune that produces true if the leg at - wing q is in tile p. - - Tall - ?= p - q - - Wide - ?=(p q) - - Irregular - none - - Reduction - none, natural - - [%wtzp p=twig] - - ?! ("wutzap") is a synthetic rune that produces the logical "not" - of p. - - Tall - ?! p - - Wide - ?!(p) - - Irregular - !p - - Reduction - See ++open - - [%zpcb p=spot q=twig] -XX tall/wide form - !_ ("zapcab") is a natural rune that puts debugging information - in the stack trace. - - Tall - - Wide - - Irregular - none - - Reduction - none, natural - - [%zpcm p=twig q=twig] - - !, ("zapcom") is a natural rune that inserts twig q as a - constant, typed with the type of twig p. - - Tall - !, p - q - - Wide - !,(p q) - - Irregular - none - - Reduction - none, natural - - [%zpcn ~] -XX determine function - !% ("zapcen") - - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%zpfs p=twig] -XX tall/wide - !/ ("zapfas") is a natural rune that should never be compiled. - When compiled with error checking turned on, it reports its - subject as an error. - - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%zpgr p=twig] - - !> ("zapgar") is a synthetic rune that produces a vase (a - [type noun] cell) with the value p. - - Tall - !> p - - Wide - !>(p) - - Irregular - none - - Reduction - See ++open - - [%zpsm p=twig q=twig] - - !; ("zapsem") is a natural rune that produces the product of twig - q as a [type noun] pair, with twig p defining the type of the type. - - Tall - !; p - q - - Wide - !;(p q) - - Irregular - none - - Reduction - none, natural - - [%zpts p=twig] - - != ("zaptis") is a natural rune that produces the formula of twig - p as a noun. - - Tall - != p - - Wide - !=(p) - - Irregular - none - - Reduction - none, natural - - [%zpwt p=$|(p=@ [p=@ q=@]) q=twig] - - !? ("zapwut") is a synthetic rune that enforces a Hoon version - restriction. - - Tall - !? p - q - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%zpzp ~] - - !! ("zapzap") is a natural rune that always causes a crash when - executed. - - Tall - none - - Wide - !! - - Irregular - none - - Reduction - none, natural - - ++ tine - ++ tusk - ++ tyre - ++ tyke - ++ tram - ++ tone - ++ nock - ++ toon - ++ tune - ++ twin - ++ type - - A type is a noun that: - - One, it defines a set of nouns. Any finite noun is either in this set, or - not in it. - - Two, it ascribes semantics to all nouns in this set. For example, a Hoon - type exports a semantic namespace. - - A lot of other languages use dynamic types, in which the type of a - value is carried along with the data as you use it. Even languages like - Lisp, which are nominally typeless, look rather typed from the Hoon - perspective. For example, a Lisp atom knows dynamically whether it's a - symbol or an integer. A Hoon atom is just a Nock atom, which is just a - number. So without a static type, Hoon doesn't even know how to print - an atom properly. - --- - - There are 9 cases of ++type: - - ?(%noun %void) - - Either %noun or %void. %noun is the set of all nouns. %void is the - set of no nouns. - - ~zod/try=> :type; * - 0 - * - - ~zod/try=> -:!>(*) - %noun - - ~zod/try=> :type; `*`%noun - 1.853.189.998 - * - - ~zod/try=> -:!>(`*`%noun) - %noun - - We can't show any examples producing %void - by definition, none of - them would terminate. Because that's what %void means. All other - cases in ++type are subsets of %noun. - - [%atom p=term] - - An atom is a natural number, with a term (known as an - odor) that specificies an atomic subtype. - - An odor is an ASCII span. This span is a taxonomy which - grows more specific to the right. For instance, @t - for UTF-8 text, @ta for URL-safe ASCII text, @tas for - a Hoon symbol; or @u for an unsigned integer, @ux for - an unsigned integer formatted as hexadecimal. - - Hoon knows about the following odors, with defined meanings: - - @c UTF-32 codepoint - @d date - @da absolute date - @dr relative date (ie, timespan) - @f yes or no (inverse boolean) - @n nil - @p phonemic base - @r IEEE floating-point - @rd double precision (64 bits) - @rh half precision (16 bits) - @rq quad precision (128 bits) - @rs single precision (32 bits) - @s signed integer, sign bit low - @sb signed binary - @sd signed decimal - @sv signed base32 - @sw signed base64 - @sx signed hexadecimal - @t UTF-8 text (cord) - @ta ASCII text (span) - @tas ASCII symbol (term) - @u unsigned integer - @ub unsigned binary - @ud unsigned decimal - @uv unsigned base32 - @uw unsigned base64 - @ux unsigned hexadecimal - - Atoms change freely either up or down the taxonomy, - but not across. You can treat a @tas as - a @t, as in a strong type system; but you can also - treat a @t as a @tas, or an @ as anything. However, - passing a @t to a function that expects an @ux is a - type error. - - Each of these forms has a URL-safe syntax. Each - parses as an atomic constant in Hoon, and each is - printed by the Hoon prettyprinter. - --- - - ~zod/try=> :type; 0x42 - 0x42 - @ux - - ~zod/try=> `@ud`0x42 - 66 - - ~zod/try=> :type; 'foo' - 'foo' - @ta - - ~zod/try=> `@ud`'foo' - 7.303.014 - - ~zod/try=> :type; ~2013.12.6 - ~2013.12.6 - @da - - ~zod/try=> `@ud`~2013.12.6 - 170.141.184.500.724.667.905.957.736.036.171.776.000 - - ~zod/try=> `@ud`.127.0.0.1 - 2.130.706.433 - - ~zod/try=> :type; .127.0.0.1 - .127.0.0.1 - @if - - ~zod/try=> :type; ~m45 - ~m45 - @dr - - ~zod/try=> `@ud`~m45 - 49.806.208.999.015.789.363.200 - - ~zod/try=> :type; `@da`(add ~2013.12.6 ~m45) - ~2013.12.6..00.45.00 - @da - - --- - The variety of units and formats which an atom can - represent is essentially infinite. The set of - syntaxes which Hoon can parse and print is - fundamentally limited. - - For instance, Hoon has no syntax which means "number - of miles." But within your program, nothing stops you - from using the odor system to distinguish a number of - miles from, for instance, a number of kilometers: - - ~zod/try=> `@udm`25.717 - 25.717 - ~zod/try=> `@udk`25.717 - 25.717 - - The printer has no idea what a @udm is, but it knows - what a @ud is and can print accordingly. Then, if you - have a function which expects a @udm and you try to - pass it a @udk, it will fail. - --- - - Besides these prefixes, which indicate the rendering - and/or meaning of atoms, the odor system has another - orthogonal mechanism to restrict the size of atoms. - Like the prefix, this mechanism is weak - it is not - enforced and trivially evaded. - - An odor span contains two parts, both optional: a - lowercase prefix and an uppercase suffix. The suffix, - if present, is a single character A-Z c which - indicates an atom of size less than or equal to n - bits, where n is 1 << (c - 'A'). Thus, @tD is one - UTF-8 byte (whatever that means); @tN is a kilobyte - or less of UTF-8. - - When enforcing conversions, @t has no size - information and can be used as @tD; and @tD, of - course, can be used as @t. But using @tN as @tD is an - error. There is no way to generate the smell of size - from a constant without a cast. And of course - arithmetic results have no odor at all. - - A full table for convenience: - - A 1 bit - B 2 bits - C 4 bits - D 1 byte - E 2 bytes - F 4 bytes - G 8 bytes - H 16 bytes - I 32 bytes - J 64 bytes - K 128 bytes - L 256 bytes - M 512 bytes - N 1K - O 2K - P 4K - Q 8K - R 16K - S 32K - T 64K - U 128K - V 256K - W 512K - X 1MB - Y 2MB - Z 4MB - - You of course can build an atom larger than 4MB, but - the type system cannot express a size odor above 4MB. - - - [%bull p=twin q=type] - - [%cell p=type q=type] - - A pair of types. Set: all cells of p and q. - - ~zod/try=> :type; [3 4] - [3 4] - [@ud @ud] - - ~zod/try=> -:!>([3 4]) - - ~zod/try=> :type; [3 4] - [3 4] - [@ud @ud] - - ~zod/try=> -:!>([3 4]) - [%cell p=[%atom p=%ud] q=[%atom p=%ud]] - - [%core p=type q=coil] - - [%cube p=* q=type] - - When we enter an ordinary constant, like 42, its type [%atom %ud] - is the set of all atoms (with odor @ud, but any atom can have that - or any odor). Its type is certainly not the set consisting - exclusively of the value 42. - - But here's how we produce this "cubical" constant: - - ~zod/try=> :type; %42 - %42 - %42 - - ~zod/try=> -:!>(%42) - [%cube p=42 q=[%atom p=%ud]] - - In general, a %cube type contains p, a single noun, and q, a base - type which provides semantics. - - Syntactically, any atomic constant can be preceded by % to generate - a cube. The exception is @tas, which always needs % and is always - cubical. - - [%face p=term q=type] - - A type is not just a set of nouns - it's also a meaning which makes - sense of any noun in that set. The typed noun exports a namespace - - give it a name, and it gives you another noun. - - ~zod/try=> foo=42 - foo=42 - ~zod/try=> :type; foo=42 - foo=42 - foo=@ud - ~zod/try=> -:!>(foo=42) - [%face p=%foo q=[%atom p=%ud]] - - With %face, we've simply wrapped a label around another type. Note - that this doesn't impair our ability to compute with the value. - Computationally, foo=42 is just 42: - - ~zod/try=> (add 17 foo=42) - 59 - --- - - [%fork p=type q=type] - - A union type. [%fork p q] means "it could be a p, or maybe a q." - - Any branching computation in which different branches produce - different types will generate a fork. For example: - - ~zod/try=> :type; ?:(& %foo [13 10]) - %foo - { %foo [@ud @ud] } - - ~zod/try=> -:!>(?:(& %foo [13 10])) - [ %fork - p=[%cube p=7.303.014 q=[%atom p=%tas]] - q=[%cell p=[%atom p=%ud] q=[%atom p=%ud]] - ] - - Here we start to understand why the type renderer is useful, as - { %foo [@ud @ud] } (which is not in any way Hoon syntax) is a - little easier to read than the actual type noun. - - (Readers of a mathematical bent may ask: since Hoon has a union - type, where is the intersection type? There is none. Hoon is not - one of these languages whose goal is to be as mathematically - powerful as possible. Since a programming language is a UI for - programmers, and programmers are not mathematicians, Hoon is - designed to be as powerful as it has to be - and no more.) - - [%hold p=(list ,[p=type q=twig])] - - ++ typo - ++ udal - ++ udon - ++ umph - ++ unce - ++ unit - ++ upas - ++ urge - ++ vase - ++ vise - ++ wall - ++ wain - ++ wing - ++ wine - ++ woof - ++ wonk - ++ map - ++ qeu - ++ set - ++ jar - ++ jug - - diff --git a/urb/zod/main/doc/ref/splitDocs/volume2.txt b/urb/zod/main/doc/ref/splitDocs/volume2.txt deleted file mode 100644 index abf8b61e8..000000000 --- a/urb/zod/main/doc/ref/splitDocs/volume2.txt +++ /dev/null @@ -1,5967 +0,0 @@ -volume 2, Hoon libraries and compiler - - chapter 2a, basic unsigned math - - ++ add - Sum two numbers. - --- - Activate jet. - Build dry %gold gate with sample atoms a and b - Yield atom - If: a is 0 - Then: Produce `b` - Else: Produce the slam of the gate with (dec a) and +(b). - --- - ~palryp-hocsyt/try=> (add 2 2) - 4 - ~palryp-hocsyt/try=> (add 1 1.000.000) - 1.000.001 - ~palryp-hocsyt/try=> (add 1.333 (mul 2 2)) - 1.337 - - ++ cap - Test if an atom is in the head or tail of a noun. - --- - Activate jet. - Build dry %gold gate with sample atom a - Yield either %2 or %3 - Switch on type of a - if %2, produce %2 - if %3, produce %3 - if either %0 or %1, fail - if noun, slam gate with (div a 2) - Terminate switch statement. - --- - ~palryp-hocsyt/try=> (cap 4) - %2 - ~palryp-hocsyt/try=> (cap 6) - %3 - ~palryp-hocsyt/try=> (cap (add 10 9)) - %2 - - ++ dec - Decrement a number - Subtracts one. - --- - Activate jet. - Build dry %gold gate with sample atom a - Error on crash: %decrement-underflow - Deny that a is 0 - Let b be 0 - Kick dry %gold trap that yields atom. - If: a is +(b) - Then: Produce b. - Else, slam trap with +(b) - --- - ~palryp-hocsyt/try=> (dec 7) - 6 - ~palryp-hocsyt/try=> (dec 0) - ! decrement-underflow - ! exit - - ++ div - Divide one number by another. - --- - Activate jet. - Build dry %gold gate with sample atom a, atom b. - Yield atom - Error on crash: 'div' - Deny that b is 0 - Push `c` is 0. - Kick dry %gold trap - If: a is less than b - Then: Produce c. - Else, slam trap with (sub a b) +(c) - --- - ~palryp-hocsyt/try=> (div 4 2) - 2 - ~palryp-hocsyt/try=> (div 17 8) - 2 - ~palryp-hocsyt/try=> (div 20 30) - 0 - - ++ fac - Produce the factorial of a number n, n!. - --- - Activate jet. - Build dry %gold gate with sample atom a and atom b. - Yield atom - If: a is 0 - Then: Produce 1. - Else: slam gate with dec a - and multiply by a - --- - ~palryp-hocsyt/try=> (fac 3) - 6 - ~palryp-hocsyt/try=> (fac 0) - 1 - ~palryp-hocsyt/try=> (fac 11) - 39.916.800 - - ++ gte - Is the first greater than or equal to the second? - --- - Activate jet. - Build dry %gold gate with sample atom a and atom b - Yield bean - a is NOT less-than b - --- - ~palryp-hocsyt/try=> (gte 100 10) - %.y - ~palryp-hocsyt/try=> (gte 4 4) - %.y - ~palryp-hocsyt/try=> (gte 3 4) - %.n - - ++ gth - Is the first greater than the second? - --- - Activate jet. - Build dry %gold gate with sample atom a and atom b - Yield bean. - a is NOT less-equal b - --- - ~ronrem-lonsem/try=> (gth 4 5) - %.n - ~ronrem-lonsem/try=> (gth 5 4) - %.y - ~ronrem-lonsem/try=> (gth 5 5) - %.n - ~ronrem-lonsem/try=> (gth 0 0) - %.n - ++ lte - Is the first less than or equal to the second? - --- - Activate jet - Build dry %gold gate with sample atom a and atom b - Yield bean - a is b OR a is less-than b - --- - ~ronrem-lonsem/try=> (lte 4 5) - %.y - ~ronrem-lonsem/try=> (lte 5 4) - %.n - ~ronrem-lonsem/try=> (lte 5 5) - %.y - ~ronrem-lonsem/try=> (lte 0 0) - %.y - ++ lth - Is the first less than the second? - --- - Activate jet - Build dry %gold gate with a sample atom a and atom b - Yield bean - Use logical AND, and produce %.n if a is b. - Kick a dry %gold trap - produce %.y if a is 0 - produce %.n if a is NOT 0 AND b=0. - Else, toss a for (dec a), and b for (dec b) - --- - ~ronrem-lonsem/try=> (lth 4 5) - %.y - ~ronrem-lonsem/try=> (lth 5 4) - %.n - ~ronrem-lonsem/try=> (lth 5 5) - %.n - ~ronrem-lonsem/try=> (lth 5 0) - %.n - ++ mas - Produce the axis of a within the head or the tail. - --- - Activate jet - Build dry %gold gate with sample atom a - Yield atom. - Switch on a: - if 1, fail - if 2, produce 1 - if 3, produce 1 - Else, add a modulo 2 to 2 times the toss of a for (div a 2) - --- - 1 ~ronrem-lonsem/try=> (mas 3) - 1 - ~ronrem-lonsem/try=> (mas 4) - 2 - ~ronrem-lonsem/try=> (mas 5) - 3 - ~ronrem-lonsem/try=> (mas 6) - 2 - ~ronrem-lonsem/try=> (mas 7) - 3 - ~ronrem-lonsem/try=> (mas 8) - 4 - ~ronrem-lonsem/try=> (mas 0) - ! exit - ~ronrem-lonsem/try=> (mas 1) - ! exit - - ++ max - Produce the larger of two atoms. - --- - Activate jet - Build dry %gold gate with sample atom a and atom b - Yield atom - If: a is greater than b - Then: produce a - Else: produce b - --- - ~palryp-hocsyt/try=> (max 10 100) - 100 - ~palryp-hocsyt/try=> (max 10.443 9) - 10.443 - ~palryp-hocsyt/try=> (max 0 1) - 1 - - ++ min - Produce the smaller of two atoms. - --- - Activate jet - Build dry %gold gate with sample atom a and atom b - Yield atom. - If: a is less than b - Then: produce a - Else: produce b - --- - ~palryp-hocsyt/try=> (min 10 100) - 10 - ~palryp-hocsyt/try=> (min 10.443 9) - 9 - ~palryp-hocsyt/try=> (min 0 1) - 0 - - ++ mod - Produce a modulo b - --- - Activate jet - Build dry %gold gate with sample atom a and atom b - Yield atom - Deny that b is 0 - Subtract from a the product of b and a divided by b - --- - - ++ mul - Multiply two numbers - --- - Activate jet - Build dry %gold gate with sample atom a and atom b - Yield atom - Push 'c' is 0 - Kick a dry %gold trap. - If: a is 0 - Then: produce c. - Else: toss a for (dec a) and c for (add b c - Examples: - - ++ peg - Produces the axis of b within the axis of a. - --- - Activate jet - Build dry %gold gate with sample atom a and atom b - Yield atom - Switch on b - if 1, produce a - if 2, produce (mul a 2) - if 3, produce +((mul a 2)) - else, add (mod b 2) to 2 times the toss of b for (div b 2) - --- - ~ronrem-lonsem/try=> (mul 5 3) - 15 - --- - ~ronrem-lonsem/try=> (mul 1 0) - 0 - - ++ sub - Subtract two numbers - --- - Activate jet - Build dry %gold gate with sample atom a and atom b - Error on crash "%subtract-underflow" - Yield atom - If: b is 0 - Then: produce a. - Else: toss a for (dec a) and b for (dec b) - --- - ~ronrem-lonsem/try=> (sub 10 5) - 5 - --- - ~ronrem-lonsem/try=> (sub 243 44) - 199 - --- - ~ronrem-lonsem/try=> (sub 5 0) - 5 - --- - ~ronrem-lonsem/try=> (sub 0 5) - ! subtract-underflow - ! exit - -chapter 2b, basic containers - -Section 2bA, units - - ++ biff - Apply a function which yields a unit to the value of a unit - --- - Build wet gate with a sample unit a and tiled gate b - If: a is null - Then: produce null - Else: slam b with u.a. - --- - ~palryp-hocsyt/try=> (biff (some 5) |=(a=@ (some (add a 2)))) - [~ u=7] - --- - ~palryp-hocsyt/try=> (biff ~ |=(a=@ (some (add a 2)))) - ~ - ++ bind - Apply a function to the value of a unit. - --- - Build wet %gold gate with sample unit a and gate b - If: a is null - Then: produce null - Else, the unit of the slam of 'b' with u.a. - --- - ~talsur-todres/try=> (bind ((unit ,@) [~ 97]) ,@t) - [~ `a`] - --- - ~talsur-todres/try=> =a |=(a=@ (add a 1)) - ~talsur-todres/try=> (bind ((unit ,@) [~ 2]) a) - [~ 3] - - ++ clap - Apply a binary operation which yields a unit to the values of two units - --- - Build wet %gold gate with a sample unit a, unit b and gate c - If: a is null - Then: produce b - Else: If: b is null - Then: produce a - Else: the unit of the slam of c with [u.a u.b] - --- - ~palryp-hocsyt/try=> =u ((unit ,@t) [~ 'a']) - ~palryp-hocsyt/try=> =v ((unit ,@t) [~ 'b']) - ~palryp-hocsyt/try=> (clap u v |=([a=@t b=@t] (welp (trip a) (trip b)))) - [~ u="ab"] - --- - ~talsur-todres/try=> =a ((unit ,@u) [~ 1]) - ~talsur-todres/try=> =b ((unit ,@u) [~ 2]) - ~talsur-todres/try=> =c |=([a=@ b=@] (add a b)) - ~talsur-todres/try=> (clap a b c) - [~ 3] - - ++ drop - Produce a list of the unit-value - --- - Build wet %gold gate with sample unit a - If: a is null - Then: produce null - Else, produce the list [u.a ~] - --- - ~divreg-misdef/try=> =a ((unit ,@) [~ 97]) - ~divreg-misdef/try=> (drop a) - [i=97 t=~] - --- - ~divreg-misdef/try=> =a ((unit ,@) [~]) - ~divreg-misdef/try=> (drop a) - ~ - - ++ fall - A default value 'b' for the unit 'a' when 'a' is null - --- - Build wet %gold gate with sample unit a and noun b - If: a is null - Then: produce b - Else: produce the unit-value of a - --- - ~talsur-todres/try=> (fall ~ `a`) - `a` - --- - ~talsur-todres/try=> (fall [~ u=0] `a`) - 0 -++ mate - Produce the unit 'a' or 'b' which is not null and crashes with error "mate" if they are equal. - --- - Creates a wet %gold gate with a sample which accepts a two units. - Builds an if-then-else statement on "b is null." - If so, produce a. - Else, build an if-then-else statement on "a is null." - If so, produce b. - Else, build an if-else-then statement on u.a=u.b. Crash on "mate" if false, produce a if true. - Examples: - ~divreg-misdef/try=> =a ((unit ,@) [~ 97]) - ~divreg-misdef/try=> =b ((unit ,@) [~ 97]) - ~divreg-misdef/try=> (mate a b) - [~ 97] - --- - ~divreg-misdef/try=> =a ((unit ,@) [~ 97]) - ~divreg-misdef/try=> =b ((unit ,@) [~]) - ~divreg-misdef/try=> (mate a b) - [~ 97] - --- - ~divreg-misdef/try=> =a ((unit ,@) [~ 97]) - ~divreg-misdef/try=> =b ((unit ,@) [~ 98]) - ~divreg-misdef/try=> (mate a b) - ! 'mate' - ! exit -++ need - Retrieve the value from a unit, crashing if the unit is null. - --- - Build wet %gold gate with sample unit a of any type. - If: p is null, - Then: fail, - Else: u.a, the value of the unit. - --- - ~divreg-misdef/try=> =a ((unit ,[@t @t]) [~ [`a` ' b']]) - ~divreg-misdef/try=> (need a) - [`a` ' b'] - ~divreg-misdef/try=> =a ((unit ,@) [~]) - ~divreg-misdef/try=> (need a) - ! exit -++ some - lift - Description: - Casts any noun a to its unit, [~ a]. - --- - Creates a wet %gold gate with a sample which accepts any noun. - Produces the tuple [~ u=a], the unit of value a. - Examples: - ~divreg-misdef/try=> (some [`a` `b`]) - [~ u=[`a` `b`]] - --- - ~divreg-misdef/try=> (some &) - [~ u=%.y] - -Section 2bB, lists - -++ flop - reverse - Description: - Produces the list 'a' with the elements reversed. - --- - Activate jet. - Creates a wet %gold gate with a sample which accepts a single list. - 'a' is then replaced with (homo a) and used as the subject for the code below (=>). - The type of the result must be the same as a, our argument list. - Let b be a list of the type of the icon of a, as it is bunted. - Create and kick a dry %gold trap - Builds an if-then-else statement on "a is an atom." - If so, produce b. - Else, recursively call flop with a replaced by it's tail and b replaced by [i.a b], where - i.a is the head of a. - Examples: - ~palryp-hocsyt/try=> =lyst (limo [1 2 3 4 ~]) - ~palryp-hocsyt/try=> lyst - [i=1 t=[i=2 t=[i=3 t=[i=4 t=~]]]] - ~palryp-hocsyt/try=> (flop lyst) - ~[4 3 2 1] - --- - ~palryp-hocsyt/try=> (flop (limo [1 'a' 2 'b' (some 10) ~])) - ~[[~ u=10] 98 2 97 1] -++ homo - homogenize - Description: - Homogenizes a lists' type information. - --- - Creates a wet %gold gate with a sample which accepts a single list. - Makes the type of the result the type of the product of the code below (^+). - The subject of the arm ($) is then the product of the barcen statement below (=<). - Creates a %gold core (|%) and the arm '+- $'. - XXX BLACK BOX, ABANDON ALL HOPE YE WHO ENTER HERE XXX - Terminates the core. - Produces list a. - Examples: - ~palryp-hocsyt/try=> lyst - [i=1 t=[i=97 t=[i=2 t=[i=98 t=[i=[~ u=10] t=~]]]]] - ~palryp-hocsyt/try=> (homo lyst) - ~[1 97 2 98 [~ u=10]] - --- - ~palryp-hocsyt/try=> =a (limo [1 2 3 ~]) - ~palryp-hocsyt/try=> a - [i=1 t=[i=2 t=[i=3 t=~]]] - ~palryp-hocsyt/try=> (homo a) - ~[1 2 3] -++ limo - listify - Description: - Produces a list from any null-terminated tuple. - --- - Creates a wet %gold gate with a sample which accepts a single list. - Makes the type of the result the type of the product of the code below (^+). - The subject of the arm ($) is then the product of the barcen statement below (=<). - Creates a %gold core (|%) and the arm '+- $'. - XXX BLACK BOX, ABANDON ALL HOPE YE WHO ENTER HERE XXX - Terminates the core. - Produces list a. - Examples: - ~palryp-hocsyt/try=> (limo [1 'a' 2 'b' (some 10) ~]) - [i=1 t=[i=97 t=[i=2 t=[i=98 t=[i=[~ u=10] t=~]]]]] - --- - ~palryp-hocsyt/try=> (limo [`a` `b` ~]) - [i=`a` t=[i=`b` t=~]] - --- - ~palryp-hocsyt/try=> (limo [2 1 ~]) - [i=2 t=[i=1 t=~]] -++ lent - length - Description: - Produces the atomic length of any list. - --- - Activate jet. - Creates a dry %gold gate with a sample which accpets a single list. - Must produce an atom. - Let b be 0. - Creates and kicks a dry %gold trap. - Builds an if-then-else statement on "a is an atom." If so, produces b. - Else, recursively calls length with the list set to the tail of a and the accumulator, b, incremented. - Examples: - ~palryp-hocsyt/try=> (lent (limo [1 2 3 4 ~])) - 4 - --- - ~palryp-hocsyt/try=> (lent (limo [1 'a' 2 'b' (some 10) ~])) - 5 -++ levy - all of - Description: - Applies the loobean gate 'b' to every element of the list 'a', producing the logical AND of all the results. - --- - Activate jet. - Creates a wet %gold gate with a sample which accepts a list and a gate with a sample of any noun - and produces a loobean. - Then, a dry %gold trap is created and kicked. It must produce a loobean. - Builds an if-then-else statement on "a is an atom." - If so, produce true. - Else, build an if-then-else statement on (b i.a) - If so, then recursively call levy with a replaced by the tail of a. - Else, produce no. - Examples: - ~palryp-hocsyt/try=> =b |=(a=@ (gte a 1)) - ~palryp-hocsyt/try=> (levy (limo [0 1 2 1 ~]) b) - %.n - --- - ~palryp-hocsyt/try=> =b |=(a=@ (gte a 0)) - ~palryp-hocsyt/try=> (levy (limo [0 1 2 1 ~]) b) - %.y -++ lien - Is the slam of any element in list `a` to `b` true? - --- - Activate jet. - Build wet %gold gate with sample list `a`, gate which accepts a noun and produces a bean `b` - Kick dry %gold trap. Yield bean. - If: `a` is null, - Then: Produce false. - Else: Unless the slam of the head of `a` to `b`, - Then: Produce true. - Else: Produce the toss of `a` for `t.a` - --- - ~palryp-hocsyt/try=> =a |=(a=@ (gte a 1)) - ~palryp-hocsyt/try=> (lien (limo [0 1 2 1 ~]) a) - %.y - ~palryp-hocsyt/try=> =a |=(a=@ (gte a 3)) - ~palryp-hocsyt/try=> (lien (limo [0 1 2 1 ~]) a) - %.n -++ reel - Right fold - Move right to left recursively slamming a binary gate with an element from the list and an accumulator, - producing the final value of the accumulator. - --- - Activate jet. - Build wet %gold gate sample list `a`, bunt of gate `b` which accepts two nouns and produces `q` - Kick dry %gold trap. Cast the result to the type of `q` in `b` - If: a is an atom: - Then: Produce the noun `q` in the sample of `b` - Else: Produce `b` slammed by: - The head of `a` - The toss of `a` for the tail of `a` - --- - ~palryp-hocsyt/try=> =sum =|([p=@ q=@] |.((add p q))) - ~palryp-hocsyt/try=> (reel (limo [1 2 3 4 5 ~]) sum) - 15 - ~palryp-hocsyt/try=> =a =|([p=@ q=@] |.((sub p q))) - ~palryp-hocsyt/try=> (reel (limo [6 3 1 ~]) a) - 4 - ~palryp-hocsyt/try=> (reel (limo [3 6 1 ~]) a) - ! subtract-underflow - ! exit -++ roll - Left fold - Move left to right recursively slamming a binary gate with an element from the list and an accumulator, - producing the final value of the accumulator. - --- - Activate jet. - Build wet %gold gate with sample list `a`, bunt of gate `b` which accepts two nouns and produces `q` - Kick dry %gold trap. Cast the result to the type of `q` in `b` - If: a is an atom, - Then: Produce `q` in `b` - Else: Produce the toss of `a` for the tail of `a`, `b` for `b` with `q` replaced by `b` slammed by the head of `a` - and `q` in `b` - --- - ~barred-tidset/try=> =a =|([p=@ q=@] |.((sub p q))) - ~barred-tidset/try=> (roll (limo [1 2 3 ~]) a) - 2 - ~barred-tidset/try=> (roll (limo [3 6 3 ~]) a) - 0 -++ skid - Seperate a list `a` into two lists - Those elements of `a` who produce true when slammed to `b` and those who produce false. - --- - Activate jet. - Build wet %gold gate with sample list `a`, tile of gate `b` accepting a noun and producing a loobean. - Kick a dry %gold trap. Cast the result to the type of [p=a q=a], a cell of lists of type `a` - If: a is null, - Then: Produce [~ ~] a cell of null and null, - Else: Push `c` is the toss of `a` for the tail of `a` - If: The slam of the head of `a` to `b`, - Then: Produce the cell with the head of `a` added to the left element, - Else: Produce the cell with the head of `a` added to the right element. - Where `p.c` and `q.c` are the left and right elements, respectively. - --- - ~dovryp-toblug/try=> =a |=(a=@ (gth a 1)) - ~dovryp-toblug/try=> (skid (limo [0 1 2 3 ~]) a) - [p=[i=2 t=[i=3 t=~]] q=[i=0 t=[i=1 t=~]]] -++ skim - only - Description: - Accepts a list 'a' and a gate 'b' which takes any noun and produces loobean. - Produces the sublist of 'a' whose elements produce true by slamming the gate with them. - --- - Activate jet. - Creates a wet %gold gate with a sample which accepts a list and a gate which accepts any noun and - produces a loobean. - Creates and kicks a dry %gold trap. - Which must produce a list of a's type. - Builds an if-then-else statement on "a is an atom." - If so, prodoce null. - Else, build an if-then-else statement on (b i.a). If so, produce [i.a $(a t.a)], where $(a t.a) is the recursive - call of skim with a replaced by the tail of a. - Else, produce $(a t.a). - Examples: - ~dovryp-toblug/try=> =a |=(a=@ (gth a 1)) - ~dovryp-toblug/try=> (skim (limo [0 1 2 3 ~]) a) - [i=2 t=[i=3 t=~]] -++ skip - except - Description: - Accepts a 'a' list and a gate 'b' which takes any noun and produces a loobean. - Produces the sublist of 'a' whose elments produce false by slamming the gate with them. - --- - Activate jet. - Creates a wet %gold gate with a sample which accepts a list and a gate which accepts any noun and - produces a loobean. - Creates and kicks a dry %gold trap. - Which must produce a list of a's type. - Builds an if-then-else statement on "a is an atom." - If so, produce null. - Else build na if-then-else statement on (b i.a). If so, produce the recursive call of skip with a replacd by - the tail of a. - Else, produce [i.a $(a t.a)]. - Examples: - ~dovryp-toblug/try=> =a |=(a=@ (gth a 1)) - ~dovryp-toblug/try=> (skip (limo [0 1 2 3 ~]) a) - [i=0 t=[i=1 t=~]] -++ scag - prefix - Description: - Accepts an atom 'n' and list 'b', producing the first n elements at the front of the list. - --- - Activate jet. - Creates a wet %gold gate which accepts an atom and a list. - A dry %gold trap is created and kicked. It must produce a list of the same type as 'b'. - Builds an if-then-else statement on the logical OR statement (a=0 or b is in null). - If so, produce null. - Else, produce [i.b $(b t.b, a (dec a))] where 'i.b' is the head of 'b' and $(b t.b, a (dec a)) - is the recursive call of scag with 'b' replaced by the tail of 'b' and 'a' decremented. - Examples: - ~palryp-hocsyt/try=> (scag 2 (limo [0 1 2 3 ~])) - [i=0 t=[i=1 t=~]] - --- - ~palryp-hocsyt/try=> (scag 10 (limo [1 2 3 4 ~])) - [i=1 t=[i=2 t=[i=3 t=[i=4 t=~]]]] -++ slag - suffix - Description: - Accepts an atom 'n' and a list 'b', producing the last n elemnents at the back of the list. - --- - Activate jet. - Creates a wet %gold gate which accepts an atom and a list. - A dry %gold trap is created and kicked. It must produce a list of the same type as 'b'. - Builds an if-then-else statement on a=0. - If so, produce 'b'. - Else, build an if-then-else statement on "b is an atom." - If so, produce null. - Else, call slag recursively with b replaced by the tail of b, a replaced by the decrement of a. - Examples: - ~palryp-hocsyt/try=> (slag 2 (limo [0 1 2 3 ~])) - [i=2 t=[i=3 t=~]] - --- - ~palryp-hocsyt/try=> (slag 2 (limo [1 2 3 4 ~])) - [i=3 t=[i=4 t=~]] -++ snag - index - Description: - Accepts an atom and a list, producing the element at the index of the atom in the list and failing is the list - is null. - --- - Activate jet. - Creates a wet %gold gate which accepts an atom and a list. - A dry %gold trap is created and kicked. - Builds an if-then-else statement on "b is null." - If so, fail with "snag-fail" in the stack trace. - Else, build an if-then-else statement on a=0. - If so, produce the head of 'b'. - Else, recursively call snag with 'b' replaced by the tail of 'b' and 'a' decremented. - Examples: - ~palryp-hocsyt/try=> (snag 2 (limo [3 2 1 0 ~])) - 1 - --- - ~palryp-hocsyt/try=> (snag 4 (limo [1 2 3 4 5 6 7 8 ~])) - 5 -++ sort - quicksort - Description: - Accepts a list and a gate with a sample which accepts two nouns and produces a loobean. 'sort' then produces a - list of the elements of 'a' sorted according to 'b'. - --- - Activate jet. - Creates a wet %gold gate with a sample which accepts a list and a gate which accepts two nouns and - produces a loobean. - Homogenizes the list and makes it the subject of the following code, casting the following to the - homogenized list type. - Creates and kicks dry %gold trap. It must produce a list of a's type. - Builds an if-then-else statement on "a is null." If so, produce null. - Slam the weld gate with the q and r below. - The q and r are then defined to be the recursive call of the trap with the skim of the tail by our sort gate. - For q, it skims by (b c i.a). For r, by !(b c i.a). - r is first cast to the type of the tail of 'a' and produced as a tuple behind the head of 'a'. - Examples: - ~dovryp-toblug/try=> =a =|([p=@ q=@] |.((gth p q))) - ~dovryp-toblug/try=> (sort (limo [0 1 2 3 ~]) a) - ~[3 2 1 0] -++ swag - infix - Description: - A range in a list - Produces the values in list 'c' starting at index 'a' and spanning 'b' elements - more than that. - --- - Creates a wet %gold gate with a sample which gate which accepts a tuple of atoms and a list 'c'. - The last 'a' elements in 'c' are selected by slag. Then the first 'b' elements of - those last elements are selected and produced by scag. - Examples: - ~palryp-hocsyt/try=> (swag [0 5] (limo [1 2 3 4 5 6 7 8 9 10 ~])) - [i=1 t=[i=2 t=[i=3 t=[i=4 t=[i=5 t=~]]]]] - --- - ~palryp-hocsyt/try=> (swag [3 5] (limo [1 2 3 4 5 6 7 8 9 10 ~])) - [i=4 t=[i=5 t=[i=6 t=[i=7 t=[i=8 t=~]]]]] - --- - ~palryp-hocsyt/try=> (swag [1 2] (limo [1 2 3 ~])) - [i=2 t=[i=3 t=~]] -++ turn - Accepts a list and a gate. Produces the list with the gate applied to each element of the original list. - --- - Activate jet. - Creates a wet %gold gate which accepts a list and a gate. - Creates and kicks a dry %gold trap. - Builds an if-then-else statement on "a is an atom." - If so, produce null. - Else, produce the tuple with head (b i.a) and tail that is turn applied recursively to the tail of 'a'. - --- - ~dovryp-toblug/try=> (turn (limo [104 111 111 110 ~]) ,@t) - <|h o o n|> -++ weld - concatenate - Description: - Concatenates two lists. - --- - Activate jet. - Creates a wet %gold gate which accepts two lists. - Homogenizes both lists and makes them the subject of the following code. - A dry %gold trap is created and kicked. It must produce the type of list 'b'. - Builds an if-then-else statement on "a is null." If so, produce 'b'. - Else, produce the tuple [i.a $(a t.a)]. 'i.a' is the head of 'a', $(a t.a) the recursive call of weld - with 'a' replaced by the tail of a. - Examples: - ~palryp-hocsyt/try=> (weld (limo [1 2 3 ~]) (limo [4 5 6 ~])) - ~[1 2 3 4 5 6] - ~palryp-hocsyt/try=> (weld "foo" "bar") - ~[~~f ~~o ~~o ~~b ~~a ~~r] -++ welp - perfect weld - Description: - Concatenates two lists without losing their type information to homogenization. - Produces a tape when passed two tapes. - --- - XXX DON'T WORRY ABOUT HOW THIS WORKS, IT IS A PERPETUAL MIYSTERY TO US ALL. XXX - Examples: - ~palryp-hocsyt/try=> (welp "foo" "bar") - "foobar" -++ wild - concatenate - Description: - Concatenates two lists without casting the product back to a list. - --- - Creates a wet %gold gate with a sample which accepts two lists. - Homogenizes both lists and makes them the subject of the following code. - A dry %gold gate is created and kicked. - Builds an if-then-else statement on "a is null." If so, produce 'b'. - Else, produce the tuple with head (b i.a) and tail that is turn applied recursively to the tail of 'a'. - Examples: - ~palryp-hocsyt/try=> =norm (limo [1 2 3 4 5 ~]) - ~palryp-hocsyt/try=> =norm2 (limo [6 7 8 ~]) - ~palryp-hocsyt/try=> (wild norm norm2) - ~[1 2 3 4 5 6 7 8] - --- - ~palryp-hocsyt/try=> (wild "foo" "bar") - ~[~~f ~~o ~~o ~~b ~~a ~~r] - --- - ~palryp-hocsyt/try=> (homo (weld "foo" "bar")) - ~[~~f ~~o ~~o ~~b ~~a ~~r] - ~palryp-hocsyt/try=> (homo (wild "foo" "bar")) - ! -find-limb.t - ! find-fork - ! exit -++ zing - promote - Description: - Turns a list of lists into a single list by promoting the elements of each sublist into the higher. - --- - Creates a wet %gold gate with a sample that accepts a list of lists. - Casts the result to the type the homogenized list head, asserting that 'a' is at least a cell. - A dry %gold trap is created and kicked. - Builds an if-then-else statement on "a is null." If so, produce null. - Else, weld together the head of a with the recrusive call of zing on the tail of a. - Examples: - ~palryp-hocsyt/try=> (zing (limo [(limo ['a' 'b' 'c' ~]) (limo ['e' 'f' 'g' ~]) (limo ['h' 'i' 'j' ~]) ~])) - ~['a' 'b' 'c' 'e' 'f' 'g' 'h' 'i' 'j'] - ~palryp-hocsyt/try=> (zing (limo [(limo [1 'a' 2 'b' ~]) (limo [3 'c' 4 'd' ~]) ~])) - ~[1 97 2 98 3 99 4 100] - -chapter 2c, simple noun surgery - -section 2cA, bit surgery **capitalization of "section" inconsistent in source** - -++ bex - binary exponent - Description: - Produces 2 to the nth power for some atom 'n'. - --- - Activate jet. - Creates a dry %gold gate which accepts a single atom. - Casts the result to an atom. - Builds an if-then-else statement on a=0. - If so, produce 1. - Else, multiply two by the recursive call of bex on the decrement of a. - Examples: - ~palryp-hocsyt/try=> (bex 4) - 16 - ~palryp-hocsyt/try=> (bex (add 19 1)) - 1.048.576 - ~palryp-hocsyt/try=> (bex 0) - 1 -++ xeb - binary logarithm - Description: - Takes the base-2 logarithm of an atom. - --- - Creates a dry %gold gate with a sample which accepts an atom. - Casts the result to an atom. - Evaluates the logarithm by counting the number of bits the number in question occupies. - Examples: - ~palryp-hocsyt/try=> (xeb 31) - 5 - -- - ~palryp-hocsyt/try=> (xeb 32) - 6 - -- - ~palryp-hocsyt/try=> (xeb 49) - 6 - -- - ~palryp-hocsyt/try=> (xeb 0) - 0 - -- - ~palryp-hocsyt/try=> (xeb 1) - 1 - -- - ~palryp-hocsyt/try=> (xeb 2) - 2 -++ can - assemble - Description: - Assembles a - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a bloq size (an atom) and - a list of atomic tuples. - Casts the result to an atom. - Builds an if-then-else statement on "b is null." - If so, produce 0. - Else, - Examples: - ~ronrem-lonsem/try=> `@ub`(can 3 ~[[1 1]]) - 0b1 - --- - ~ronrem-lonsem/try=> `@ub`(can 0 ~[[1 255]]) - 0b1 - --- - ~ronrem-lonsem/try=> `@ub`(can 1 ~[[1 2]]) - 0b10 - --- - ~ronrem-lonsem/try=> `@ub`(can 1 ~[[1 3]]) - 0b11 - --- - ~ronrem-lonsem/try=> `@ub`(can 1 ~[[1 4]]) - 0b0 - --- - ~ronrem-lonsem/try=> `@ub`(can 1 ~[[2 4]]) - 0b100 -++ cat - concatenate - Description: - Concatenates two atoms, obeying the given block size. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a bloq size (an atom) and - two atoms. - Measures the number of blocks of size 'a' are in 'b'. - Left shifts 'c' that many times the bock size of 'a'. - Sums the result of the left shift with 'b'. - Examples: - ~ronrem-lonsem/try=> `@ub`(cat 1 1 0) - 0b1 - ~ronrem-lonsem/try=> `@ub`(cat 2 1 0) - 0b1 - ~ronrem-lonsem/try=> `@ub`(cat 4 1 0) - 0b1 - ~ronrem-lonsem/try=> `@ub`(cat 0 1 1) - 0b11 - ~ronrem-lonsem/try=> `@ub`(cat 0 2 1) - 0b110 - ~ronrem-lonsem/try=> `@ub`(cat 2 1 1) - 0b1.0001 - ~ronrem-lonsem/try=> `@ub`256 - 0b1.0000.0000 - ~ronrem-lonsem/try=> `@ub`255 - 0b1111.1111 - ~ronrem-lonsem/try=> `@ub`(cat 3 256 255) - 0b1111.1111.0000.0001.0000.0000 - ~ronrem-lonsem/try=> `@ub`(cat 2 256 255) - 0b1111.1111.0001.0000.0000 - ~ronrem-lonsem/try=> (cat 3 256 255) - 16.711.936 -++ cut - slice - Description: - Accepts a block size 'a', a cell of two atoms 'b' and 'c' and another atom 'd'. - Produces the tail of 'd' that is 'c' blocks long after right-shifting 'd' 'b'-blocks. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a block size (an atom), - a cell of two atoms, and another atom which will be "cut." - Right-shifts 'd' by 'b' blocks. Then produces the 'c' block long tail of this right-shift. - Examples: - ~ronrem-lonsem/try=> (cut 0 [1 1] 2) - 1 - ~ronrem-lonsem/try=> (cut 0 [2 1] 4) - 1 - ~ronrem-lonsem/try=> (cut 3 [1 1] 256) - 1 - ~ronrem-lonsem/try=> (cut 2 [1 1] 255) - 15 - ~ronrem-lonsem/try=> (cut 1 [1 1] 255) - 3 - ~ronrem-lonsem/try=> (cut 1 [1 2] 255) - 15 -++ end - tail - Description: - Accepts a block 'a' and two atoms, 'b' and 'c'. - Produces the 'b' blocks of length 'a' on the end of 'c'. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a block (an atom) and - two atoms. - Multiplies the binary exponent of 'a' (2^a) with 'b', then takes the binary exponent - of that (2^((2^a)*b)) to finally produce the modulus of 'c' and the ensuing product. - Examples: - ~ronrem-lonsem/try=> `@ub`12 - 0b1100 - --- - ~ronrem-lonsem/try=> `@ub`(end 0 3 12) - 0b100 - --- - ~ronrem-lonsem/try=> (end 0 3 12) - 4 - --- - ~ronrem-lonsem/try=> `@ub`(end 1 3 12) - 0b1100 - --- - ~ronrem-lonsem/try=> (end 1 3 12) - 12 - --- - ~ronrem-lonsem/try=> (end 3 1 256) - 0 - --- - ~ronrem-lonsem/try=> (end 3 1 255) - 255 -++ fil - fill bloqstream - Description: - - --- - Creates a dry %gold gate with a sample which accepts a block size (an atom) and - two other atoms. - Let 'n' be 0. - Let 'd' be 'c'. - Creates and kicks a dry %gold trap whose result is cast to a atom. - Builds an if-then-else statement on n=b. - If so, produce the right-shift of 'd' by one block. - Else, recursively call the trap with 'd' replaced by the sum of 'c' and the one block - left-shift of 'b', n replaced by the increment of n. - Examples: - -++ lsh - left shift - Description: - Accepts a block size 'a' and two atoms 'b' and 'c'. Produces 'c' left-shifted - 'b' times by the block size. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a block (an atom) and - two atoms. - Multiplies 'c' times the binary exponent of the binary exponent of 'a' times 'b', - that is ((2^((2^a)*b))*c), this producing the desired left-shift on 'c'. - Examples: - ~ronrem-lonsem/try=> `@ub`1 - 0b1 - --- - ~ronrem-lonsem/try=> `@ub`(lsh 0 1 1) - 0b10 - --- - ~ronrem-lonsem/try=> (lsh 0 1 1) - 2 - --- - ~ronrem-lonsem/try=> `@ub`255 - 0b1111.1111 - --- - ~ronrem-lonsem/try=> `@ub`(lsh 3 1 255) - 0b1111.1111.0000.0000 - --- - ~ronrem-lonsem/try=> (lsh 3 1 255) - 65.280 -++ met - measure - Description: - Measures the number of blocks of size 'a' are in 'b'. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a block size (an atom) and - an atom. - Casts the result to an atom. - Let 'c' be 0. - Creates and kicks a dry %gold trap. - Builds an if-then-else statement on b=0. - If so, produce c. - Else, recursively call the trap, with - 'b' replaced by the single-block right-shift of 'b' and 'c' by the increment of 'c'. - Examples: - ~ronrem-lonsem/try=> (met 0 1) - 1 - ~ronrem-lonsem/try=> (met 0 2) - 2 - ~ronrem-lonsem/try=> (met 3 255) - 1 - ~ronrem-lonsem/try=> (met 3 256) - 2 -++ rap - Concatenate a list of atoms while obeying a given blocksize. - --- - Activate jet. - Build a dry %gold gate with sample bloq `a`, list of atoms `b` - Yield atom - If: `b` is null, - Then: Produce 0. - Else: Produce cat slammed with `a`, the head of `b`, and the toss of `b` for the tail of `b` - --- - ~palryp-hocsyt/try=> (rap 2 (limo [1 2 3 4 ~])) - 17.185 - ~palryp-hocsyt/try=> (rap 1 (limo [1 2 3 4 ~])) - 313 - ~palryp-hocsyt/try=> (rap 0 (limo [0 0 0 ~])) - 0 - ~palryp-hocsyt/try=> (rap 0 (limo [0 0 1 ~])) - 1 -++ rep - Assembles - - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a block size (an atom) and - a list of atoms. - Casts the result to an atom. - Let 'c' be 0. - Creates and kicks a dry %gold trap. - Build an if-then-else statement on "b is an atom." - If so, produce 0. - Else, produce the binary logical OR of the 'c' time left-shift on the last block - of the head of 'b' and the recursive call of the trap with: - 'c' replaced by the increment of 'c'. - 'b' replaced by the tail of 'b'. - Examples: - ~palryp-hocsyt/try=> (rep 0 (limo [1 2 3 4 ~])) - 5 - --- - ~palryp-hocsyt/try=> (rep 1 (limo [1 2 3 4 ~])) - 57 - --- - ~palryp-hocsyt/try=> (rep 0 (limo [1 0 0 ~])) - 1 - --- - ~palryp-hocsyt/try=> (rep 0 (limo [1 0 0 0 ~])) - 1 - --- - ~palryp-hocsyt/try=> (rep 0 (limo [0 1 0 0 ~])) - 2 - --- - ~palryp-hocsyt/try=> (rep 0 (limo [0 1 0 1 ~])) - 10 - --- - ~palryp-hocsyt/try=> (rep 0 (limo [0 1 0 1 0 1 ~])) - 42 -++ rip - disassemble - Description: - Produces a list of the bits of an atom, in little endian order, according to - block size. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a block size (an atom) and - any number. - Cast the result to a list of atoms. - Builds an if-then-else statement on b=0. - If so, produce null. - Else, produce a tuple with head of (end a 1 b), the single-block tail of 'b', and - the resursive call of rip with 'b' replaced by the single-block right-shift of 'b'. - in little endian. - Examples: - palryp-hocsyt/try=> `@ub`155 - 0b1001.1011 - --- - ~palryp-hocsyt/try=> (rip 0 155) - ~[1 1 0 1 1 0 0 1] - --- - ~palryp-hocsyt/try=> (rip 2 155) - ~[11 9] - --- - ~palryp-hocsyt/try=> (rip 1 155) - ~[3 2 1 2] - --- - ~palryp-hocsyt/try=> `@ub`256 - 0b1.0000.0000 - --- - ~palryp-hocsyt/try=> (rip 0 256) - ~[0 0 0 0 0 0 0 0 1] - --- - ~palryp-hocsyt/try=> (rip 2 256) - ~[0 0 1] - --- - ~palryp-hocsyt/try=> (rip 3 256) - ~[0 1] - -++ rsh - right shift - Description: - Accepts a block size 'a' and two atoms, 'b' and 'c'. Right-shifts 'c' by 'b' blocks - of size 'a'. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts a block size (an atom) and - two atoms. - Takes the binary exponent of the binary exponent of 'a' multiplied by 'b', - that is (2^(((2^a)*b))) and divides 'c' by it, producing the desired - right-shift on 'c'. - Examples: - ~ronrem-lonsem/try=> `@ub`145 - 0b1001.0001 - --- - ~ronrem-lonsem/try=> `@ub`(rsh 1 1 145) - 0b10.0100 - --- - ~ronrem-lonsem/try=> (rsh 1 1 145) - 36 - --- - ~ronrem-lonsem/try=> `@ub`(rsh 2 1 145) - 0b1001 - --- - ~ronrem-lonsem/try=> (rsh 2 1 145) - 9 - --- - ~ronrem-lonsem/try=> `@ub`10 - 0b1010 - --- - ~ronrem-lonsem/try=> `@ub`(rsh 0 1 10) - 0b101 - --- - ~ronrem-lonsem/try=> (rsh 0 1 10) - 5 - --- - ~ronrem-lonsem/try=> `@ub`1 - 0b1 - --- - ~ronrem-lonsem/try=> (rsh 0 1 1) - 0 - --- - ~ronrem-lonsem/try=> (rsh 0 1 1) - 0 -++ swap - reverse bloq order - Description: - Produces the reversed block order of a number, obeying block number. - Switches little ending to big and vice versa. - --- - Creates a dry %gold gate with a sample which accepts a block size (an atom) and - an atom. - Rips apart the atom by the block size, then reverses the tape that is produced. - Once it is reversed, it is re-assembled using rep. - Examples: - ~palryp-hocsyt/try=> `@ub`24 - 0b1.1000 - --- - ~palryp-hocsyt/try=> (swap 0 24) - 3 - --- - ~palryp-hocsyt/try=> `@ub`3 - 0b11 - --- - ~palryp-hocsyt/try=> (swap 0 0) - 0 - --- - ~palryp-hocsyt/try=> (swap 1 24) - 9 - --- - ~palryp-hocsyt/try=> (swap 0 128) - 1 -section 2cB, bit logic - -++ con - binary or - Description: - Produces the bit-wise logical OR of two atoms. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts two atoms. - Let 'c' be 0, d be 0. - Creates and kicks a dry %gold trap. Casts the result to an atom. - Builds an if-then-else statement on a=b AND b=0. - If so, produce 'd'. - Else, recursively call the trap with: - 'a' replaced by the single 0-block right shift of 'a'. - 'b' replaced by the single 0-block right-shift of 'b'. - 'c' replaced by the increment of c. - 'd' replaced by the sum of 'd' and the 'c' 0-block left-shift of the - logical AND of (last bit of 'a')=0 AND (last bit of 'b')=0. - (==) terminates the list of changes. - Examples: - ~palryp-hocsyt/try=> (con 0 1) - 1 - --- - ~palryp-hocsyt/try=> (con 1 0) - 1 - --- - ~palryp-hocsyt/try=> (con 0 0) - 0 - --- - ~palryp-hocsyt/try=> (con 4 4) - 4 - --- - ~palryp-hocsyt/try=> (con 10.000 234) - 10.234 -++ dis - binary and - Description: - Produces the bit-wise logical AND of two atoms. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts two atoms. - Pushes the bunt of a two atom tuple onto the subject. - Creates and kicks a dry %gold trap. Casts its result to an atom. - Builds an if-then-else statement on a=0 or b=0. - If so, produce 'd'. - Else, recursively call the trap with: - 'a' replaced by the single 0-block right-shift of 'a'. - 'b' replaced by the single 0-block right-shift of 'b'. - 'c' replaced by the increent of 'c'. - 'd' replaced by the sum of 'd' and the 'c' 0-block left-shift of the - logical OR of (last bit of 'a')=0 OR (last bit of 'b')=0. - (==) terminates the list of changes. - Examples: - ~ronrem-lonsem/try=> `@ub`9 - 0b1001 - --- - ~ronrem-lonsem/try=> `@ub`5 - 0b101 - --- - ~ronrem-lonsem/try=> `@ub`(dis 9 5) - 0b1 - --- - ~ronrem-lonsem/try=> (dis 9 5) - 1 - --- - ~ronrem-lonsem/try=> `@ub`534 - 0b10.0001.0110 - --- - ~ronrem-lonsem/try=> `@ub`987 - 0b11.1101.1011 - --- - ~ronrem-lonsem/try=> `@ub`(dis 534 987) - 0b10.0001.0010 - --- - ~ronrem-lonsem/try=> (dis 534 987) - 530 -++ mix - binary xor - Description: - Produces the bit-wise logical exclusive OR of two atoms. - --- - Activate jet. - Creates a dry %gold gate with a sample which accepts two atoms. - Casts the result to an atom. - Let 'c' be 0, 'd' be 0. - A dry %gold trap is created and kicked. - Builds an if-then-else statement on a=0 AND b=0. - If so, produce 'd'. - Else, recursively call mix with: - 'a' replaced by - 'b' replaced by - 'c' replaced by the increment of 'c'. - 'd' replaced by - (==) terminates the list of changes. - Examples: - ~ronrem-lonsem/try=> `@ub`2 - 0b10 - ~ronrem-lonsem/try=> `@ub`3 - 0b11 - ~ronrem-lonsem/try=> `@ub`(mix 2 3) - 0b1 - ~ronrem-lonsem/try=> (mix 2 3) - 1 - ~ronrem-lonsem/try=> `@ub`(mix 2 2) - 0b0 - ~ronrem-lonsem/try=> (mix 2 2) - 0 -++ not - binary not (sized) - Description: - Produces the bit-wise logical NOT over 'b' blocks of the given blocksize. - --- - First produces the binary exponent of the binary exponent of the block size times - 'b'. This is decremented before being multiplied by 'c'. - Finally, this product is exclusive ORed and produced. - Examples: - ~palryp-hocsyt/try=> `@ub`24 - 0b1.1000 - --- - ~palryp-hocsyt/try=> (not 0 5 24) - 7 - --- - ~palryp-hocsyt/try=> `@ub`7 - 0b111 - --- - ~palryp-hocsyt/try=> (not 2 5 24) - 1.048.551 - --- - ~palryp-hocsyt/try=> (not 2 5 1.048.551) - 24 - --- - ~palryp-hocsyt/try=> (not 1 1 (not 1 1 10)) - 10 - -section 2cC, noun orders - -++ aor - a-order - Description: - Alphabetic comparator gate. - --- - Activate jet. - Creates a dry %gold gate which accepts two nouns. - Casts the result to a loobean. - Builds an if-then-else statement on a=b. - If so, produce true. - Else, build an unless-then-else statement on "a is an atom." - If 'a' is not an atom, build an unless-then-else statement on "b is an atom." - If so, build an if-then-else statement on (-.a=-.b) where -.a is the head of 'a'. - If so, recursively call aor with 'a' and 'b' replaced by their respecitve tails. - Else, recursively call aor with 'a' and 'b' replaced by their respective heads. - Else (if 'b' is an atom), produce false. - Else (if 'a' is an atom), build an unless-then-else statement on "b is an atom." - If so, produce true. - Else, create and kick a dry %gold gate. - Let 'c' be the byte tail of 'a', 'd' be the byte tail of 'b'. - Builds an if-then-else statement on (c=d). - If so, produce the recursive call to the trap with 'a' replaced by the byte right-shift of 'a' - and 'b' replaced by the byte right-shift of 'b'. - Else (if !(c=d)), produce (c (aor 'a' 'b') - %.y - ~tadbyl-hilbel/try=> (aor 'b' 'a') - %.n - --- - ~tadbyl-hilbel/try=> (aor "foo" "bar") - %.n - ~tadbyl-hilbel/try=> (aor "bar" "foo") - %.y - --- - ~tadbyl-hilbel/try=> (aor "abcdefz" "abcdefa") - %.n - ~tadbyl-hilbel/try=> (aor "abcdefa" "abcdefz") - %.y - --- - ~tadbyl-hilbel/try=> (aor 10.000 17.000) - %.y - ~tadbyl-hilbel/try=> (aor 10 9) - %.n -++ dor - d-order - Description: - Numeric comparator gate. - --- - Activate jet. - Creates a dry %gold gate which accepts two nouns. - Casts the result to a loobean. - Builds an if-then-else statement on a=b. - If so, produce true. - Else, build an unless-then-else statement on "a is an atom." - If 'a' is not an atom, build an unless-then-else statement on "b is an atom." - If so, build an if-then-else statement on (-.a=-.b) where -.a is the head of 'a'. - If so, recursively call dor with 'a' and 'b' replaced by their respecitve tails. - Else, recursively call dor with 'a' and 'b' replaced by their respective heads. - Else ('b' is an atom), produce false. - Else ('a' is an atom), build an unless-then-else statement on "b is an atom." - If so, produce true. - Else, produce (a (dor 1 2) - %.y - ~tadbyl-hilbel/try=> (dor 2 1) - %.n - --- - ~tadbyl-hilbel/try=> (dor ~[1 2 3] ~[1 2 4]) - %.y - ~tadbyl-hilbel/try=> (dor ~[1 2 4] ~[1 2 3]) - %.n - --- - ~tadbyl-hilbel/try=> (dor (limo ~[99 100 10.000]) ~[99 101 10.000]) - %.y - ~tadbyl-hilbel/try=> (dor ~[99 101 10.999] (limo ~[99 100 10.000])) - %.n -++ gor - g-order - Description: - Hash comparator gate. - --- - Activate jet. - Creates a dry %gold gate which accepts two nouns. - Casts the result to a loobean. - Let 'c' be the mug (FNV-1a hash) of 'a' an 'd' the mug of 'b'. - Create an if-then-else statement on c=d. - If so, produce the d-order of 'a' and 'd'. - Else, produce the loobean (c (gor 'd' 'c') - %.y - ~palryp-hocsyt/try=> 'd' - 'd' - ~palryp-hocsyt/try=> 'c' - ~palryp-hocsyt/try=> `@ud`'d' - 100 - ~palryp-hocsyt/try=> `@ud`'c' - 99 - ~palryp-hocsyt/try=> (mug 'd') - 1.628.185.714 - ~palryp-hocsyt/try=> (mug 'c') - 1.712.073.811 - ~palryp-hocsyt/try=> (gor 'd' 'c') - %.y - ~palryp-hocsyt/try=> (gor 'c' 'd') - %.n - --- - ~palryp-hocsyt/try=> (gor "foo" "bar") - %.n - --- - ~palryp-hocsyt/try=> (gor (some 10) (limo [1 2 3 ~])) - %.n -++ hor - h-order - Description: - Recursive hash comparator gate. - --- - Activate jet. - Creates a dry %gold gate which accepts two nouns. - Casts the result to a loobean. - Build an if-then-else statement on "a is an atom." - If so, build na if-then-else statment on "b is an atom." - If so, produce the g-order of 'a' and 'b'. - Else (if 'b' is not an atom), produce true. - Else (if 'a' is not an atom), build an if-then-else statement on "b is an atom." - If so, produce false. - Else, build an if-then-else statement on (-.a=-.b), where '-.a' is the head of 'a'. - If so, produce the g-order of the tails of 'a' and 'b'. - Else (if the heads of 'a' and 'b' are not equal), produce the g-order of the tails of 'a', 'b'. - Examples: - -++ vor - v-order - Description: - Double hash comparator gate. - --- - Activate jet. - Creates a dry %gold gate which accepts two nouns. - Casts the result to a loobean. - Let 'c' be the double mug (FNV-1a hash) of 'a', 'd' that of 'b'. - Builds an if-then-else statement on (c=d). - If so, produce the d-order of 'a' and 'b'. - Else, produce the loobean of (c (vor 'f' 'g') - %.y - --- - ~palryp-hocsyt/try=> (vor 'a' 'z') - %.n - --- - ~palryp-hocsyt/try=> (vor 43.326 41.106) - %.n - -section 2cD, insecure hashing - -++ fnv - FNV scrambler - Description: - Hashes an atom with the 32-bit FNV non-cryptographic hash algorithm. - --- - Multiplies 'a' by the prime number 16,777,619 and then takes the block of - size 5 off the product's end. - Examples: - ~palryp-hocsyt/try=> (fnv 10.000) - 272.465.456 - --- - ~palryp-hocsyt/try=> (fnv 10.001) - 289.243.075 - --- - ~palryp-hocsyt/try=> (fnv 1) - 16.777.619 -++ mug - 31bit nonzero FNV1a - Description: - Hashes any noun with the 31-bit nonzero FNV-1a non-cryptographic hash algorithm. - --- - Activate jet. - Creates a dry %gold gate with a sample accepting any noun. - - (?^ and 'p' subsection fill in.) - - Let 'b' be 2,166,136,261. - Create and kick a dry %gold gate. Cast its result to an atom. - Let 'c' be 'b'. - Let 'd' be 0, 'e' be the number of bytes in 'a'. - Create and kick a dry %gold gate. Cast its result to an atom. - Builds an if-then-else statement on d=e. - If so, let 'f' be the bit-wise XOR on the 31 0-block shift on 'c' and the last - 31 blocks of 'c'. - Builds an unless-then-else statement on f=0. If then, produce 'f'. - Else, recursively call the trap above our current trap with 'b' replaced by +(b). - Else (d isn't equal to e), then recursively call the trap with 'c' replaced by - the fnv hash of the logical XOR of 'c' and (cut 3 [d 1] a), 'd' replaced by - the increment of 'd'. - - Examples: - ~palryp-hocsyt/try=> (mug 10.000) - 178.152.889 - --- - ~palryp-hocsyt/try=> (mug 10.001) - 714.838.017 - --- - ~palryp-hocsyt/try=> (mug 1) - 67.918.732 - --- - ~palryp-hocsyt/try=> (mug (some 10)) - 1.872.403.737 - --- - ~palryp-hocsyt/try=> (mug (limo [1 2 3 4 5 ~])) - 1.067.931.605 - -section 2cE, phonetic base - -++ po - left-right syllable - Description: - Provides the phonetic syllables and name generators for the Urbit naming system. - --- - Activate jet. - Create the cell [sis dex] where 'sis' and 'dex' are the togas on the - left-hand ("sinister") and right-hand ("Dexter") phonetic syllable cords, respectively. - Build %gold core to contain the following arms. - ++ ind - - Description: - --- - Activate jet. - Creates a dry %gold gate which accepts and atom. - Let 'b' be 0. - Creates and kicks a dry %gold trap, casting the result to an atomic unit. - Builds an if-then-else statement on (b=256). If so, produce null. - Else, build an if-then-else statement on (a=(tod b)). If so, produce the atomic unit [~ b]. - Else, recursively call the trap with 'b' replaced by the increment of 'b'. - Examples: - - ++ ins - - Description: - --- - Activate jet. - Creates a dry %gold gate which accepts and atom. - Let 'b' be 0. - Creates and kicks a dry %gold trap with the result cast to an atomic unit. - Builds an if-then-else statement on (b=256). If so, produce null. - Else, build an if-then-else statement on (a=(tos b)). If so, produce the atomic unit [~ b]. - Else, recursively call the trap with 'b' replaced by the increment of 'b'. - Examples: - - ++ tod - Description: - Selects right-hand phonetic syllable from 'dex'. - --- - Activate jet. - Creates a dry %gold gate which accepts and atom. - Assert that 'a' is less than 256. - Produce the three tail-end byte blocks in the rght-shift of dex. - Examples: - ~palryp-hocsyt/try=> (tod:po 98) - 6.514.020 - --- - ~palryp-hocsyt/try=> (tod:po 150) - 6.781.298 - --- - ~palryp-hocsyt/try=> (tod:po 255) - 7.562.598 - --- - ~palryp-hocsyt/try=> (tod:po 256) - ! exit - ++ tos - Selects left-hand phonetic syllable from 'sin'. - --- - Activate jet. - Creates a dry %gold gate which accepts and atom. - Assert that 'a' is less than 256. - Produce the three tail-end byte blocks in the rght-shift of dex. - Examples: -section 2cF, signed and modular ints - -++ si - signed integer - ++ abs - absolute value - Description: - Produces the absolute value of a signed integer. - --- - Creates a dry %gold gate with a sample which accepts a single atom. - Sums the last bit of the atom with the single bit-wise block right-shift of the atom, - producing the absolute value. - Examples: - ~palryp-hocsyt/try=> (abs:si -2) - 2 - --- - ~palryp-hocsyt/try=> (abs:si -10.000) - 10.000 - --- - ~palryp-hocsyt/try=> (abs:si --2) - 2 - ++ dif - subtraction - Description: - Produces the difference between two signed integers. - --- - Creates a dry %gold gate with a sample which accepts two signed integers. - Sums the first signed integer with a new signed integer, made from the second by - (new !(syn b) (abs b)), where !(syn b) is the negative of the second integer's sign. - This sum, produced, is the difference. - Examples: - ~palryp-hocsyt/try=> (dif:si --10 -7) - --17 - --- - ~palryp-hocsyt/try=> (dif:si --10 --7) - --3 - --- - ~palryp-hocsyt/try=> (dif:si `@s`0 --7) - -7 - --- - ~palryp-hocsyt/try=> (dif:si `@s`0 `@s`7) - --4 - ++ dul - modulus - Description: - Produces the modulus of two signed integers. - --- - Creates a dry %gold gate which accepts a signed integer and an atom. - Let 'c' be the [sign value] representation of 'a'. - Builds an if-then-else statement on -.c, the sign of 'a'. - If so ('a' is positive.), produce the modulus of the absolute value of 'c' and 'b'. - Else, produce the differenece between 'b' and the absolute value of 'c'. - Examples: - ~palryp-hocsyt/try=> (dul:si --9 3) - 0 - --- - ~palryp-hocsyt/try=> (dul:si --9 4) - 1 - --- - ~palryp-hocsyt/try=> (dul:si --9 5) - 4 - --- - ~palryp-hocsyt/try=> (dul:si --9 6) - 3 - --- - ~palryp-hocsyt/try=> (dul:si --90 --10) - 10 - ++ fra - divide - Description: - Produces the quotient of two signed integers. - --- - Creates a dry %gold gate with a sample which accepts two signed integers. - Divides the absolute value of 'a', the dividend, and 'b', the divisor, and - passes that value as the unsigned integer value of a new signed integer. - The sign of the new signed integer is the bitwise logical XOR of the two integer's - signs, meaning the quotient is only positive when both factors are positive. - This new signed integer is produced. - Examples: - ~palryp-hocsyt/try=> (fra:si --4 --2) - --2 - --- - ~palryp-hocsyt/try=> (fra:si -4 -2) - --2 - --- - ~palryp-hocsyt/try=> (fra:si -4 --2) - -2 - --- - ~palryp-hocsyt/try=> (fra:si --4 -2) - -2 - --- - ~palryp-hocsyt/try=> (fra:si `@s`4 `@s`2) - --2 - --- - ~palryp-hocsyt/try=> (fra:si `@s`4 2) - ! type-fail - ! exit - ++ new - [sign value] to @s - Description: - Produces a signed integer from a sign value (either & or |) and an atom. - --- - Creates a dry %gold gate with a sample which acccepts a loobean and an atom - Builds an if-then-else statement on the sign value 'a'. - If so, just produce 'b' multiplied by 2. - Else, build an if-then-else statement on b=0. If so, produce 0. - Else, produce the increment of (2*(dec b)). - The result is then cast to an integer and produced from new:si. - Examples: - ~palryp-hocsyt/try=> (new:si [& 10]) - --10 - ~palryp-hocsyt/try=> (new:si [| 10]) - -10 - ~palryp-hocsyt/try=> (new:si [%.y 7]) - --7 - ++ old - [sign value] - Description: - Produces the cell [sign value] representations of a signed integer. - --- - Create a dry %gold date with a with a sample which accepts a signed integer. - Produce a cell with head (syn a), the sign of 'a', and tail (abs), the absolute value of 'a'. - Examples: - ~palryp-hocsyt/try=> (old:si 7) - ! type-fail - ! exit - --- - ~palryp-hocsyt/try=> (old:si -7) - [%.n 7] - --- - ~palryp-hocsyt/try=> (old:si --7) - [%.y 7] - --- - ~palryp-hocsyt/try=> (old:si `@s`7) - [%.n 4] - --- - ~palryp-hocsyt/try=> (old:si -0) - [%.y 0] - ++ pro - Produces the product of two signed integers. - --- - Creates a dry %gold gate with a sample which accepts two signed integers. - Produces their product by evaluating a new signed integer whose sign is the bitwise - XOR of the two number's signs and whose value is the product of their two absolute values. - --- - palryp-hocsyt/try=> (pro:si -4 --2) - -8 - ~palryp-hocsyt/try=> (pro:si -4 -2) - --8 - ~palryp-hocsyt/try=> (pro:si --10.000.000 -10) - -100.000.000 - ~palryp-hocsyt/try=> (pro:si -1.337 --0) - --0 - ++ rem - Produces the remainder from a division of two signed integers. - --- - Creates a dry %gold gate with a sample which accepts two signed integers. - Produces the difference between 'a' and the (b*(a/b)). - --- - ~palryp-hocsyt/try=> (rem:si -10 -4) - -2 - ~palryp-hocsyt/try=> (rem:si --10 --4) - --2 - ~palryp-hocsyt/try=> (rem:si --10 -4) - --2 - ~palryp-hocsyt/try=> (rem:si --7 --3) - --1 - ~palryp-hocsyt/try=> (rem:si --0 --10.000) - --0 - ++ sum - Sum two signed integers. - --- - Creates a dry %gold gate which accepts two signed integers. - Prints '%si-sum' in the stack trace if the following code crashes. - Let 'c' and 'd' be the [sign value] representation of 'a' and 'b', respectively. - Builds an if-then-else statement on "c is positive". - If so, build an if-then-else statement on "d is positive". - If so, produce a new, positive signed integer with value ((abs a)+(abs b)) - Else, build an if-then-else statement on (abs a)>=(abs b) - If so, produce a new, positive integer with value ((abs a)-(abs d)). - Else (if !((abs a)>=(abs b))), produce a new, negative signed integer - with value ((abs d)-(abs c)). - Else (if c is not positive), build an if-then-else statement on "d is positive". - If so, build an if-then-else statement on (abs a)>=(abs b). - If so, produce a new, negative signed intger with value ((abs a)-(abs b)) - Else, produce a new, positive signed integer with value ((abs c)-(abs d)) - Else (if d is not positive), produce a new, negative signed with value ((abs c)+(abs d)). - --- - ~palryp-hocsyt/try=> (sum:si --10 --10) - --20 - --- - ~palryp-hocsyt/try=> (sum:si --10 -0) - --10 - --- - ~palryp-hocsyt/try=> (sum:si -10 -7) - -17 - --- - ~palryp-hocsyt/try=> (sum:si -10 --7) - -3 - ++ sun - Produces a signed integer from an unsigned integer. - Note that the result must be manually cast to some @s odor to be inferred as an - unsigned integer in the type system. - --- - Build dry %gold gate with sample unsigned integer `a` - Produce the integer multiplied by 2. - --- - ~palryp-hocsyt/try=> `@s`10 - --5 - ~palryp-hocsyt/try=> (sun:si 10) - 20 - ~palryp-hocsyt/try=> `@s`(sun:si 10) - --10 - ~palryp-hocsyt/try=> `@sd`(sun:si 10) - --10 - ~palryp-hocsyt/try=> `@sd`(sun:si 12.345) - --12.345 - ++ syn - Is a signed integer positive? - Produce the sign of a signed integer - & being posiitve, | negative. - --- - Build dry %gold gate with sample signed integer `a` - Is the last bit of 'a' 0? - --- - ~palryp-hocsyt/try=> (syn:si -7) - %.n - ~palryp-hocsyt/try=> (syn:si --7) - %.y - ~palryp-hocsyt/try=> (syn:si (new:si [& 7])) - %.y - ~palryp-hocsyt/try=> (syn:si -0) - %.y - ~palryp-hocsyt/try=> (syn:si --0) - %.y -++ fe - Binary block modulo math engine. Defaults to bloq size 1. - --- - Build dry %gold tray with sample bloq `a` - ++ dif - Produces the difference between two atoms in the modular basis representation. - --- - Build dry %gold gate wtih sample atom `b`, atom `c` - Produce sit slammed with: - The difference between: - The sum of: - `out` and slam of `b` to sit - Slam of `c` to sit - --- - ~tadbyl-hilbel/try=> (~(dif fe 3) 63 64) - 255 - ~tadbyl-hilbel/try=> (~(dif fe 3) 5 10) - 251 - ~tadbyl-hilbel/try=> (~(dif fe 3) 0 1) - 255 - ~tadbyl-hilbel/try=> (~(dif fe 0) 9 10) - 1 - ~tadbyl-hilbel/try=> (~(dif fe 0) 9 11) - 0 - ~tadbyl-hilbel/try=> (~(dif fe 0) 9 12) - 1 - ~tadbyl-hilbel/try=> (~(dif fe 2) 9 12) - 13 - ~tadbyl-hilbel/try=> (~(dif fe 2) 63 64) - 15 - ++ inv - Inverts the order of the modular field. - --- - Build dry %gold gate with sample atom `b` - Produce the difference between: - The decrement of `out` - Slam of `b` to sit. - --- - palryp-hocsyt/try=> (~(inv fe 3) 255) - 0 - ~palryp-hocsyt/try=> (~(inv fe 3) 256) - 255 - ~palryp-hocsyt/try=> (~(inv fe 3) 0) - 255 - ~palryp-hocsyt/try=> (~(inv fe 3) 1) - 254 - ~palryp-hocsyt/try=> (~(inv fe 3) 2) - 253 - ~palryp-hocsyt/try=> (~(inv fe 3) 3) - 252 - ++ net - - --- - Build dry %gold gate with sample atom `b`. Yield atom. - Push toss of `b` for the slam of `b` to sit on the context. - Unless: `a` is less than or equal to 3, - Then: Produce `b`, - Else: Push `c` is the decrement of `a` - Produce the slam of con with: - The single c-block left-shift of: - The toss of `a` for `c`, `b` for the c-block [0 1] cut of `b` - The toss of `a` for `c`, `b` for the c-block [1 1] cut of `b` - --- - ~tadbyl-hilbel/try=> (~(net fe 3) 64) - 64 - ~tadbyl-hilbel/try=> (~(net fe 3) 128) - 128 - ~tadbyl-hilbel/try=> (~(net fe 3) 255) - 255 - ~tadbyl-hilbel/try=> (~(net fe 3) 256) - 0 - ~tadbyl-hilbel/try=> (~(net fe 3) 257) - 1 - ~tadbyl-hilbel/try=> (~(net fe 3) 500) - 244 - ~tadbyl-hilbel/try=> (~(net fe 3) 511) - 255 - ~tadbyl-hilbel/try=> (~(net fe 3) 512) - 0 - ~tadbyl-hilbel/try=> (~(net fe 3) 513) - 1 - ~tadbyl-hilbel/try=> (~(net fe 3) 0) - 0 - ~tadbyl-hilbel/try=> (~(net fe 3) 1) - 1 - ~tadbyl-hilbel/try=> (~(net fe 0) 1) - 1 - ~tadbyl-hilbel/try=> (~(net fe 0) 2) - 0 - ~tadbyl-hilbel/try=> (~(net fe 0) 3) - 1 - ~tadbyl-hilbel/try=> (~(net fe 6) 1) - 72.057.594.037.927.936 - ~tadbyl-hilbel/try=> (~(net fe 6) 2) - 144.115.188.075.855.872 - ~tadbyl-hilbel/try=> (~(net fe 6) 3) - 216.172.782.113.783.808 - ~tadbyl-hilbel/try=> (~(net fe 6) 4) - 288.230.376.151.711.744 - ~tadbyl-hilbel/try=> (~(net fe 6) 5) - 360.287.970.189.639.680 - ~tadbyl-hilbel/try=> (~(net fe 6) 6) - 432.345.564.227.567.616 - ~tadbyl-hilbel/try=> (~(net fe 6) 7) - 504.403.158.265.495.552 - ~tadbyl-hilbel/try=> (~(net fe 6) 512) - 562.949.953.421.312 - ~tadbyl-hilbel/try=> (~(net fe 6) 513) - 72.620.543.991.349.248 - ++ out - Description: - The maximum integer value that the current block can store. - --- - Produce the binary exponent of: - The binary expoenent of the block size, `a` - --- - ~tadbyl-hilbel/try=> ~(out fe 0) - 2 - ~tadbyl-hilbel/try=> ~(out fe 1) - 4 - ~tadbyl-hilbel/try=> ~(out fe 2) - 16 - ~tadbyl-hilbel/try=> ~(out fe 3) - 256 - ~tadbyl-hilbel/try=> ~(out fe 4) - 65.536 - ~tadbyl-hilbel/try=> ~(out fe 10) - 179.769.313.486.231.590.772.930.519.078.902.473.361.797.697.894.230.657.273.430.081. - 157.732.675.805.500.963.132.708.477.322.407.536.021.120.113.879.871.393.357.658.789. - 768.814.416.622.492.847.430.639.474.124.377.767.893.424.865.485.276.302.219.601.246. - 094.119.453.082.952.085.005.768.838.150.682.342.462.881.473.913.110.540.827.237.163. - 350.510.684.586.298.239.947.245.938.479.716.304.835.356.329.624.224.137.216 - ++ rol - - --- - Build dry %gold gate with sample bloq `b`, atom `c`, atom `d`. Yield atom. - Push `e` is sit slammed with `d`, the modular representation of `d` - Push `f` is the binary expoenent of: - The difference between 'a' and 'b' - Push `g` is `c` modulus `f` - Produce sit slammed with: - con slammed with: - The `g` b-blocks right-shift of `e` - The difference between `f` and `g` b-blocks left-shift of `e` - --- - - - ++ ror - - --- - Build dry %gold gate with sample bloq `b`, atom `c`, atom `d`. Yield atom. - Push `e` is sit slammed with `d`, the modular representation of `d` - Push `f` is the binary expoenent of: - The difference between 'a' and 'b' - Push `g` is `c` modulus `f` - Produce sit slammed with: - con slammed with: - The `g` b-blocks left-shift of `e` - The difference between `f` and `g` b-blocks right-shift of `e` - --- - - ++ sum - Sum two numbers in this modular field. - --- - Build dry %gold gate with sample atom `b`, atom `c` - Produce sit slammed with the sum of `b` and `c` - --- - ~tadbyl-hilbel/try=> (~(sum fe 3) 10 250) - 4 - ~tadbyl-hilbel/try=> (~(sum fe 0) 0 1) - 1 - ~tadbyl-hilbel/try=> (~(sum fe 0) 0 2) - 0 - ~tadbyl-hilbel/try=> (~(sum fe 2) 14 2) - 0 - ~tadbyl-hilbel/try=> (~(sum fe 2) 14 3) - 1 - ~tadbyl-hilbel/try=> (~(sum fe 4) 10.000 256) - 10.256 - ~tadbyl-hilbel/try=> (~(sum fe 4) 10.000 100.000) - 44.464 - ++ sit - Produce an atom in the current modular block representation. - --- - Build dry %gold gate with sample atom `b` - Produce the last block of size `a` in `b` - --- - ~tadbyl-hilbel/try=> (~(sit fe 3) 255) - 255 - ~tadbyl-hilbel/try=> (~(sit fe 3) 256) - 0 - ~tadbyl-hilbel/try=> (~(sit fe 3) 257) - 1 - ~tadbyl-hilbel/try=> (~(sit fe 2) 257) - 1 - ~tadbyl-hilbel/try=> (~(sit fe 2) 10.000) - 0 - ~tadbyl-hilbel/try=> (~(sit fe 2) 100) - 4 - ~tadbyl-hilbel/try=> (~(sit fe 2) 16) - 0 - ~tadbyl-hilbel/try=> (~(sit fe 2) 17) - 1 - ~tadbyl-hilbel/try=> (~(sit fe 0) 17) - 1 - ~tadbyl-hilbel/try=> (~(sit fe 0) 0) - 0 - ~tadbyl-hilbel/try=> (~(sit fe 0) 1) - 1 - -section 2cG, floating point - -++ rlyd -++ rlyh -++ rlyq -++ rlys -++ ryld -++ rylh -++ rylq -++ ryls - -section 2cH, urbit time - -++ year - Accept a parsed date of form [[a=? y=@ud] m=@ud t=tarp] and produce - its @d representation. - --- - Build dry %gold gate with sample parsed date `det` - Yield @d. - Push `yer` is: - If: `a.det` is true. I.e. - Then: The sum of 292,277,024,400 and `y.det`, the year. - Else: The difference of 292,277,024,400 and the decrement of `y.det`, the year. - Push `day` is yawn slammed with: - `yer`, `m.det`, `d.t.det` - Produce yule slammed with: - `day`, `h.t.det`, `m.t.det`, `s.t.det`, `f.t.det` - --- - -++ yore - Produce the parsed date [[a=? y=@ud] m=@ud t=tarp] representation of a @d date. - --- - Build dry %gold gate with sample @d `now`. - Yield date. - Push `rip` is yell slammed with `now`, the - Push `ger` is yall slammed with `d.rip`, the - Pair: - If: y.ger is greater than , - Then: , - Else: with, - - --- - -++ yell - Produce a parsed daily time format from an atomic date. - --- - Creates a dry %gold gate which accepts an atomic date, @d. - Casts the result to a tarp. - Let 'sec' be the single 64-bit block right-shift of 'now'. - - Creates and kicks a dry %gold trap. Casts the result to a list of unsigned hexadecimal atoms. - If (0=raw) OR (0=muc), produce null. - Replace 'muc' with the decrement of 'muc' (3). - Produce the cell [(cut 4 [muc 1] raw) $(raw (end 4 muc raw))], where - (cut 4 [muc 1] raw) is the cut of 'raw' of 1-block of size 4 starting at 'muc'. - $(raw (end 4 muc raw)) is the recursive call to the trap with 'raw' replaced by - the last 'muc' blockcs of size - 4 in 'raw'. - Examples: - ~dovryp-toblug/try=> (yell ~2014.3.20..05.42.53..7456) - [d=106.751.991.820.094 h=5 m=42 s=53 f=~[0x7456]] - --- - ~tadbyl-hilbel/try=> (yell ~2014.6.9..19.09.40..8b66) - [d=106.751.991.820.175 h=19 m=9 s=40 f=~[0x8b66]] - --- - ~tadbyl-hilbel/try=> (yell ~1776.7.4) - [d=106.751.991.733.273 h=0 m=0 s=0 f=~] -++ yule - time atom - Description: - Accepts a tarp, a parsed daily time, and produces a time atom, @d. - --- - Creates a dry %gold gate which accepts a tarp. - Casts the result to an atomic date. - Let - - The product of d.rip, , and day:yo, . - Let - - - Examples: - ~tadbyl-hilbel/try=> =murica (yell ~1776.7.4) - ~tadbyl-hilbel/try=> murica - [d=106.751.991.733.273 h=0 m=0 s=0 f=~] - ~tadbyl-hilbel/try=> (yule murica) - 0x8000000b62aaf5800000000000000000 - --- - ~dovryp-toblug/try=> (yule (yell ~2014.3.20..05.42.53..7456)) - 0x8000000d21c88d5d7456000000000000 - --- - ~tadbyl-hilbel/try=> (yule (yell ~2014.6.9..19.09.40..8b66)) - 0x8000000d223413f48b66000000000000 -++ yall - day # to day of year - Description: - Produces what day of the year in year, month, day format a day of - --- - Examples: -++ yawn - days since Jesus - Description: - Accepts a year, month, and day (Three unsigned decimal integers) and produces the date's - CE representation. - --- - Creates a dry %gold gate which accepts three unsigned decimal integers. - Casts the result to an unsigned decimal integer. - Replaces the month and day values on the subject with their decrements. - Replaces the subject of the following with the type of the context. - Evaluates the context with the changes specified below: - - Lets - - Examples: -++ yelp - leap year - Description: - Produces a loobean indicating whether the given Common Era year is a leap year. - --- - Creates a dry %gold gate which accepts an unsigned decimal integer. Casts the result to a loobean. - Produces the logical AND of (0=(mod yer 4)) and the logical OR of (0=(mod yer 100)) and - (0=(mod yer 400)). - Examples: - ~tadbyl-hilbel/try=> (yelp 2.014) - %.n - --- - ~tadbyl-hilbel/try=> (yelp 2.008) - %.y - --- - ~tadbyl-hilbel/try=> (yelp 0) - %.y - --- - ~tadbyl-hilbel/try=> (yelp 14.011) - %.n -++ yo - time constants - Description: - Constants of time referenced in the urbit time section. - --- - Produces a %gold core with |%. - ++ cet - (add 24 (mul 100 365)) - Description: - The number of days in a century. - --- - Derived by multiplying the number of days in a year (365) by the number of yaers in a century (100), - then adding the number days from leap years in a century (24). - Examples: - ~tadbyl-hilbel/try=> cet:yo - 36.524 - --- - ~tadbyl-hilbel/try=> (add 365 cet:yo) - 36.889 - --- - ~tadbyl-hilbel/try=> (sub (add 24 (mul 100 365)) cet:yo) - 0 - ++ day - (mul 24 hor) - Description: - The number of seconds in a day. - --- - Derived by multiplying the the number of seconds in an hour by the hours in a day. - Examples: - ~tadbyl-hilbel/try=> day:yo - 86.400 - --- - ~tadbyl-hilbel/try=> (add 60 day:yo) - 86.460 - ++ era - (add 1 (mul 4 cet)) - Description: - - --- - - Examples: - - ++ hor - (mul 60 mit) - Description: - The number of seconds in an hour. - --- - Derived by multiplying the number of seconds in a minute by the minutes in an hour. - Examples: - ~tadbyl-hilbel/try=> hor:yo - 3.600 - ++ jes - (mul 730.692.561 era) - Description: - - --- - - Examples: - - ++ mit - seconds per minute - Description: - The number of seconds in a minute. - --- - We just knew this one. - Examples: - ~tadbyl-hilbel/try=> mit:yo - 60 - ++ moh - Description: - The days in each month of the Gregorian common year. - --- - A list of unsigned decimal atoms (Either 28, 30, or 31) denoting the number of days in the month at the - year at that index. - Examples: - ~tadbyl-hilbel/try=> moh:yo - ~[31 28 31 30 31 30 31 31 30 31 30 31] - ++ moy - Description: - The days in each month of the Gregorian leap-year. - --- - A list of unsigned decimal atoms (Either 29,30, or 31) denoting the number of days in the month at the - leap-year at that index. - Examples: - ~tadbyl-hilbel/try=> moy:yo - ~[31 29 31 30 31 30 31 31 30 31 30 31] - ++ qad - (add 1 (mul 4 yer)) - Description: - The number of seconds in four years - --- - Derived by adding one second to the number of seconds in four years. - Examples: - ~tadbyl-hilbel/try=> qad:yo - 126.144.001 - ++ yer - (mul 365 day) - Description: - The number of seconds in a year. - --- - Derived by multiplying the number of seconds in a day by 365. - Examples: - ~tadbyl-hilbel/try=> yer:yo - 31.536.000 - -section 2cI, almost macros - -++ hard - demand result type - Description: - Ruthlessly demands that a specific type be produced, crashing the program is it is not. - --- - Creates a vulanized wet gate which accepts any gate which accepts any noun and produces - any noun. - Creates a dry %gold gate which accepts any noun and casts the result to the - higher gate argument's icon. - Prints "%hard" in the stack trace if the code below crashes. - Let gol be the higher gate argument slammed with the lower arbitrary noun. - Assert that the result's icon is equal to that of the lower arbitrary noun - before producing said result. - Examples: - ~palryp-hocsyt/try=> ((hard (list)) (limo [1 2 3 ~])) - ~[1 2 3] - ~tadbyl-hilbel/try=> ((hard ,@) (add 2 2)) - 4 - ~tadbyl-hilbel/try=> ((hard ,@t) (crip "Tape to cord, bro!")) - 'Tape to cord, bro' - ~tadbyl-hilbel/try=> ((hard tape) (crip "...Tape to cord, bro?...")) - ! hard - ! exit -++ soft - politely demand - Description: - Politely requests a specific type to be produced, producing null if it is not. - --- - Creates a vulanized wet gate which accepts any gate which accepts any noun and produces - any noun. - Creates a dry %gold gate which accepts any noun and casts the result to the - a unit of the higher gate argument's icon. - Let gol be the higher gate argument slammed with the lower arbitrary noun. - Build an unless-then-else statement on the result icon's being equal to that of - the lower arbitrary noun. - If so, produce null. - Else, produce the unit of the result. - Examples: - ~tadbyl-hilbel/try=> ((soft ,%4) (add 2 2)) - [~ %4] - ~tadbyl-hilbel/try=> ((soft ,@) (add 2 2)) - [~ 4] - ~tadbyl-hilbel/try=> ((soft ,%5) (add 2 2)) - ~ - ~tadbyl-hilbel/try=> ((soft ,@t) (crip "Tape to cord, Woohoo!")) - [~ 'Tape to cord, Woohoo!'] - ~tadbyl-hilbel/try=> ((soft ,@t) (trip 'Cmon man... Tape to cord? Please?!')) - ~ - -chapter 2d, containers - -section 2dA, sets - -++ apt - set invariant - Description: - Accepts any tree and produces a loobean indicating whether the tree is a set. - --- - Creates a dry %gold gate which accepts a tree. - Builds an if-then-else statement on "a is an atom." - If so, produce true. - Else, compute and produce the logical AND of: - The if "l.a is an atom" then produce true, else (produce the logical AND of the - v-order of n.a and n.l.a and the h-order of n.l.a and n.a) if-then-else statement. - The if "r.a is an atom" then produce true, else (produce the logical AND of the - v-order of n.a and n.r.a and the h-order of n.a and n.r.a) if-then-else statement. - (==) terminates the tall logical AND statement. - Examples - ~tadbyl-hilbel/try=> =b (sa `(list ,@t)`['john' 'bonita' 'daniel' 'madeleine' ~]) - ~tadbyl-hilbel/try=> (apt b) - %.y - --- - ~tadbyl-hilbel/try=> =m (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ['c' 4] ['d' 5] ~]) - ~tadbyl-hilbel/try=> m - {[p='d' q=5] [p='a' q=1] [p='c' q=4] [p='b' q=[2 3]]} - ~tadbyl-hilbel/try=> (apt m) - %.y -++ in - set engine - Description: - Container arm for set operation arms. The contained arms inherit it's sample set, 'a'. - --- - Activate jet. - Creates a %gold trap with sample 'a', a set. - +- all - logical AND - Description: - Accepts a gate which accepts any noun and produces a loobean. Slams the gate with each member - of set 'a', produce the logical AND of the transformed set. - --- - Activate jet. - Creates a wet %gold gate which accepts any gate which produces a loobean. - Creates and kicks a dry %gold gate, casts the result to a loobean. - Builds an if-then-else statement on "a is an atom." - If so, produce true. - Else, produce the logical AND of (b n.a) and the recursive calls of the trap with - 'a' replaced by 'l.a' and 'a' replaced by 'r.a'. - Examples: - ~dovryp-toblug/try=> =b (sa `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~]) - ~dovryp-toblug/try=> (~(all in b) |=(a=* ?@(-.a & |))) - %.n - ~tadbyl-hilbel/try=> =b (sa `(list ,@t)`['john' 'bonita' 'daniel' 'madeleine' ~]) - ~tadbyl-hilbel/try=> (~(all in b) |=(a=@t (gte a 100))) - %.y - +- any - logical OR - Description: - Accepts a gate which accepts any noun and produces a loobean. Slams the gate with each member - of set 'a', produce the logical OR of the transformed set. - --- - Activate jet. - Creates a wet %gold gate which accepts any gate which produces a loobean. - Creates and kicks a dry %gold gate, casts the result to a loobean. - Builds an if-then-else statement on "a is an atom." - If so, produce false. - Else, produce the logical OR of (b n.a) and the recursive calls of the trap with - 'a' replaced by 'l.a' and 'a' replaced by 'r.a'. - Examples: - ~dovryp-toblug/try=> =b (sa `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~]) - ~dovryp-toblug/try=> (~(any in b) |=(a=* ?@(+.a & |))) - %.y - ~tadbyl-hilbel/try=> =b (sa `(list ,@t)`['john' 'bonita' 'daniel' 'madeleine' ~]) - ~tadbyl-hilbel/try=> (~(any in b) |=(a=@t (lte a 100))) - %.n - +- del - b without any a - Description: - Accepts any noun 'b' and removes it from the set 'a'. - --- - Activate jet. - Creates a wet %gold gate which accepts any noun. - Creates and kicks a dry %gold gate, casts the result to the type of 'a'. - Builds an if-then-else statement on "a is null." - If so, produce null. - Else, builds an unless-then-else on (b=n.a) - If so, build an if-then-else statement by testing the h-order of 'b' and 'n.a'. - If so, produce a the cell [n.a $(a l.a) r.a], where $(a l.a) is the recursive call of - the trap with 'a' replaced by the left - Examples: - ~dovryp-toblug/try=> =b (sa `(list ,@t)`[`a` `b` `c` ~]) - ~dovryp-toblug/try=> (~(del in b) `a`) - {`c` `b`} - --- - ~tadbyl-hilbel/try=> =b (sa `(list ,@t)`['john' 'bonita' 'daniel' 'madeleine' ~]) - ~tadbyl-hilbel/try=> (~(del in b) 'john') - {'bonita' 'madeleine' 'daniel'} - --- - ~tadbyl-hilbel/try=> (~(del in b) 'susan') - {'bonita' 'madeleine' 'daniel' 'john'} - - +- dig - axis of b in a - Description: - Produces - --- - Creates a dry %gold gate which accepts a single noun. - Let 'c' be 1. - Creates and kicks a dry %gold trap. Casts the result to an atomic unit. - Builds an if-then-else statement on "a is null." If so, produce null. - Else, build an if-then-else statement on (b=n.a). If so, produce the unit [~ u=(peg c 2)]. - Else, build an if-then-else statement on the g-order of 'b' and 'n.a' - If so, produce the recursive call of the trap with 'a' replaced by 'l.a' and 'c' replaced by (peg c 6). - Else, produce the recursive call of the trap with 'a' replaced by 'r.a' and 'c' replaced by (peg c 7). - Examples: - ~talsur-todres/try=> =a (sa `(list ,@)`[1 2 3 4 5 6 7 ~]) - ~talsur-todres/try=> a - {5 4 7 6 1 3 2} - ~talsur-todres/try=> -.a - n=6 - ~talsur-todres/try=> (~(dig in a) 7) - [~ 12] - ~talsur-todres/try=> (~(dig in a) 2) - [~ 14] - ~talsur-todres/try=> (~(dig in a) 6) - [~ 2] - +- gas - concatenate - Description: - Accepts a list 'b' with members of the same type as the set 'a' and produces - the union set of 'a' and 'b'. - --- - Activate jet. - Creates a dry %gold gate which accepts a list of elements of the same type as 'a'. - Creates and kicks a dry %gold trap whose result is cast to the type of 'a'. - Builds an if-then-else statement on "b is an atom." - If so, produce 'a'. - Else, recursively call the trap with 'b' replaced by the tail of 'b' and the head of 'b' - put into 'a'. - Examples: - ~tadbyl-hilbel/try=> b - {'bonita' 'madeleine' 'rudolf' 'john'} - ~tadbyl-hilbel/try=> (~(gas in b) `(list ,@t)`['14' 'things' 'number' '1.337' ~]) - {'1.337' '14' 'number' 'things' 'bonita' 'madeleine' 'rudolf' 'john'} - --- - ~tadbyl-hilbel/try=> (~(gas in s) `(list ,@t)`['1' '2' '3' ~]) - {'1' '3' '2' 'e' 'd' 'a' 'c' 'b'} - +- has - b exists in a check - Description: - Accepts any noun and produces the loobean indicating whether or not that value (n.a) exists in 'a'. - --- - Activate jet. - Creates a wet %gold gate which accepts any noun. - Creates and kicks a dry %gold trap. Casts the result to a loobean. - Builds an if-then-else statement on "The set (a) is an atom." If so, produce false. - Else, build an if-then-else statement on (b=n.a). - If so, produce true. - Else, build an if-then-else statement on the h-order of 'b' and 'n.a' - If so, produce the recursive call to the trap with 'a' replaced by 'l.a' - If so, produce the recursive call to the trap with 'a' replaced by 'r.a' - Examples: - ~dovryp-toblug/try=> =a (~(gas in `(set ,@t)`~) `(list ,@t)`[`a` `b` `c` ~]) - ~dovryp-toblug/try=> (~(has in a) `a`) - %.y - ~dovryp-toblug/try=> (~(has in a) 'z') - %.n - +- put - Accept any noun 'b' and produce the set 'a' with 'b' added to its sorted location. - --- - Activate jet. - Creates a wet %gold gate which accepts any atom. - Creates and kicks a dry %gold gate. Casts the result to the type of set 'a'. - Builds an if-then-else statement on "a is an atom." - If so, produce the null-terminated tuple [b ~ ~]. - Else, build an if-then-else statement on (b=n.a). - If so, produce the set 'a'. - Else, build an if-then-else statement on the h-order of 'b' and 'n.a'. - If so, let 'c' be the recursive call of the trap with 'a' replaced by 'l.a'. - Then, assert that 'c' is a cell. - Build an if-then-else statement on the v-order of 'n.a' and 'n.c'. - If so (their v-order is true), produce the tuple [n.a c r.a] - Else, produce [n.c l.c [n.a r.c r.a]]. - Else (if 'b' and 'n.a' are not well h-ordered.), let 'c' be the recursive call of the trap with - 'c' replaced 'r.a'. - Then, assert that 'c' is a cell. - Builds an if-then-else statement on the v-order of 'n.a' and 'n.c' - If so, produce [n.a l.a c] - Else, produce [n.c [n.a l.a l.c] r.c]. - Examples: - ~talsur-todres/try=> =a (~(gas in `(set ,@t)`~) `(list ,@t)`[`a` `b` `c` ~]) - ~talsur-todres/try=> =b (~(put in a) `d`) - ~talsur-todres/try=> b - {`d` `a` `c` `b`} - ~talsur-todres/try=> -.l.+.b - n=`d` - +- rep - Accept a noun and a binary gate. Produce the 'a' with each member 'n.a' replaced by (c n.a b). - --- - XXX - Creates a wet %gold gate which accpets a noun and a tile, 'a' and 'b'. - Creates and kicks a dry %gold gate. - Builds an if-then-else statement on "a is null." If so, produce 'b'. - Else, recursively call the trap with 'a' replaced by 'r.a' and - 'b' replaced by the recursive call of the trap with 'a' replaced by 'l.a' and 'b' replaced by - (c n.a b). - --- - ~talsur-todres/try=> =a (~(gas in *(set ,@)) [1 2 3 ~]) - ~talsur-todres/try=> a - {1 3 2} - ~talsur-todres/try=> (~(rep in a) 0 |=([a=@ b=@] (add a b))) - 6 - --- - XXX - - +- tap - Accept a list of elements of the set and produce a cell of the set with the list concatenated. - --- - Activate jet. - Build dry %gold gate with sample list of the same - Cast the following to the type of `b` - If: `a` is null, - Then: Produce `b`, - Else: Produce the toss of `a` for `r.a`, `b` for [n.a $(a l.a)]), - where $(a l.a) is the toss of `a` for the left twig of `a`. - --- - ~tadbyl-hilbel/try=> =s (sa `(list ,@t)`['a' 'b' 'c' 'd' 'e' ~]) - ~tadbyl-hilbel/try=> s - {'e' 'd' 'a' 'c' 'b'} - --- - ~tadbyl-hilbel/try=> (~(tap in s) `(list ,@t)`['1' '2' '3' ~]) - ~['b' 'c' 'a' 'd' 'e' '1' '2' '3'] - --- - ~tadbyl-hilbel/try=> b - {'bonita' 'madeleine' 'daniel' 'john'} - ~tadbyl-hilbel/try=> (~(tap in b) `(list ,@t)`['david' 'people' ~]) - ~['john' 'daniel' 'madeleine' 'bonita' 'david' 'people'] - +- wyt - Produce the cardinality (number of elements) of the set. - --- - Increment the following. - Kick dry %gold trap. Yield atom. - If: `a` is null, - Then: Produce 0. - Else: Produce the increment of the sum of: - The toss of `a` for `l.a`, the left twig of `a`. - The toss of `a` for `r.a`, the right twig of `a`. - --- - ~talsur-todres/try=> =a (~(gas in `(set ,@t)`~) `(list ,@t)`[`a` `b` `c` ~]) - ~talsur-todres/try=> ~(wyt in a) - 4 - --- - ~tadbyl-hilbel/try=> b - {'bonita' 'madeleine' 'daniel' 'john'} - ~tadbyl-hilbel/try=> ~(wyt in b) - 5 - -section 2dB, maps - -++ ept - map invariant - Description: - Accepts a tree of cell paris and produces the loobean indicating whther the tree is a map - or not. - --- - Creates a dry %gold gate which accepts a tree of cell pairs. - If "a is an atom", produce true. - Else, produce the logical AND of: - If "l.a is an atom", produce true. Else, produce the logical AND of the v-order of 'p.n.a' precedes 'p.n.l.a' - and the h-order of 'p.n.l.a' precedes 'p.n.a'. - If "r.a is an atom" produce true. Else, produce the logical AND of the v-oreder of 'p.n.a' precedes 'p.n.r.a' - and the h-roder of 'p.n.a' precedes 'p.n.r.a'. - (==) terminates the AND statement. - Examples: - ~tadbyl-hilbel/try=> m - {[p='d' q=5] [p='a' q=1] [p='c' q=4] [p='b' q=[2 3]]} - ~tadbyl-hilbel/try=> (ept m) - %.y - --- - ~tadbyl-hilbel/try=> b - {'bonita' 'madeleine' 'daniel' 'john'} - ~tadbyl-hilbel/try=> (ept b) - ! type-fail - ! exit - --- -++ ja - The jar engine: A container arm for jar operation arms. Jars are maps of lists. - The contained arms inherit it's sample jar. 'a'. - --- - Build a wet %gold tray with a sample jar `a`... - +- get - Retrieve a list from the map by its key. - --- - Build wet %gold gate with sample noun `b` - Push `d` is the slug of by to get with `a` slammed with `b`. - If: `c` is null, - Then: Produce null, - Else: Produce `u.c`, the unit value of `c` - --- - - - +- add - Add a key-list value to the jar. - --- - Build wet %gold gate with sample noun `b`, noun `c` - Push `d` is the call of get with the subject replaced by `a`, slammed with `b` - Produce the slam of by to put with `a` slammed with `b` and [c d]. - --- - - --- - Terminate the core. - -++ ju - The jug engine: container arm for jug operation arms. Jugs are maps of sets. - The contained arms inherit it's sample jug, 'a'. - --- - Build a wet %gold tray with a sample jug `a`. - +- del - Delete a value in a set and produce the resulting jug. - --- - Build wet %gold gate with sample noun `b`, noun `c` - Cast the following to the type of `a` - Push `d` is the call of get with the subject replaced by `a`, slammed with `b` - Push `e` is slug del to in by `d` slammed with `c` - If: `e` is null, - Then: Slug tray by to del with `a` slammed with `b` - Else: Produce the slug tray by to put with `a` slammedw ith `b`, `e`. - --- - - +- get - Retrieve a set from the map by its key. - --- - Build wet %gold gate with sample noun `b` - Push `c` is the slug of by to get with `a` slammed with `b` - If: `c` is null, - Then: Produce null, - Else: Produce `u.c`, the unit value of `c` - --- - - +- has - Is the element `c` in the set `b`? - --- - Build wet %gold gate with sample noun `b`, noun `c` - Yield boolean. - Produce the slug of in to has with the call of get with the subject replaced by `a` slammed with: - `b`, a set., slammed with: - slammed with `c`. - I.e.: Check if `c` is in the set which is the value of the map key `b`. - --- - - +- put - Add a value to a specific set in the jug. - --- - Build wet %gold gate with sample noun b. noun c. - Yield bean. - Push `d` is the call of get with the subject replaced by `a`, slammed with `b` - Produce the slug of by to put with `a` slammed with: - `b`, slammed with: - The slug of in to put by `d` slammed with `c`. - --- - -++ by - Container arm for map operation arms. The contained arms inherit it's sample map, 'a'. - --- - Activate jet. - Builds a %gold tray with a sample which accepts a map. - +- all - Accepts a gate which accepts any noun and produces a loobean. Slams the gate with each member - of map 'a', produce the logical AND of the transformed map. - --- - Activate jet. - Builds a wet %gold gate which accepts the tile of a gate accepts any noun and produces a loobean. - Creates and kicks a dry %gold gate. Casts the result to loobean. - Builds an if-then-else statement on "a is an atom." - If so, produce true. - Else, produce the logical AND of (b q.n.a), the recursive call of the trap with 'a' replaced by - 'l.a', and the recursive call of the trap with 'a' replaced by 'r.a'. - Examples: - ~talsur-todres/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~]) - ~talsur-todres/try=> (~(all by b) |=(a=* ?@(a & |))) - %.n - --- - ~tadbyl-hilbel/try=> =a (mo `(list ,[@t @u])`[['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~]) - ~tadbyl-hilbel/try=> (~(all by a) |=(a=@ (lte a 6))) - %.y - ~tadbyl-hilbel/try=> (~(all by a) |=(a=@ (lte a 4))) - %.n - +- any - Accepts a gate which accepts any noun and produces a loobean. Slams the gate with each member - of map 'a', produce the logical OR of the transformed map. - --- - Activate jet. - Builds a wet %gold gate which accepts the tile of a gate accepts any noun and produces a loobean. - Creates and kicks a dry %gold gate. Casts the result to loobean. - Builds an if-then-else statement on "a is an atom." - If so, produce false. - Else, produce the logical OR of (b q.n.a), the recursive call of the trap with 'a' replaced by - 'l.a', and the recursive call of the trap with 'a' replaced by 'r.a'. - Examples: - ~talsur-todres/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~]) - ~talsur-todres/try=> (~(all by b) |=(a=* ?@(a & |))) - %.y - --- - ~tadbyl-hilbel/try=> =a (mo `(list ,[@t @u])`[['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~]) - ~tadbyl-hilbel/try=> (~(any by a) |=(a=@ (lte a 4))) - %.y - +- del - delete at key b - Description: - Accepts a noun 'b', producing the map with the key-value pair of key 'b' removed. - --- - Activate jet. - Creates a wet %gold gate which accepts a noun. - Creates and kicks a dry %gold trap. Casts the result to the type of map 'a'. - Builds an if-then-else statement on "a is null." - If so, produce null. - Else, build an unless-then-else statement on (b=(p.n.a)). - If so, build the if-then-else statement on the g-order of 'b' and 'p.n.a'. - If so, produce the the tuple [n.a $(a l.a) r.a] where $(a l.a) is the recursive call of the - trap with 'a' replaced by 'l.a'. - Else (g-order of 'b' and 'p.n.a' is not true.), produce [n.a l.a $(a r.a)]. - Else (!(b=(p.n.a))), create and kick a dry %gold trap. - Cast the result to a fork between null and the tile of the map 'a'. - Builds an if-then-else statement on "l.a is null." If so, produce 'r.a'. - Else, build an if-then-else statement on "r.a is null." If so, produce 'l.a'. - Else, build an if-then-else statement on the v-order of 'p.n.l.a' and 'p.n.r.a'. - If so, produce [n.l.a l.l.a $(l.a r.l.a)],where $(l.a r.l.a) is the recursive call of the - trap with 'l.a' replaced by 'r.l.a'. - Else, produce [n.r.a $(r.a l.r.a) r.r.a], ,where $(r.a l.r.a) is the recursive call of the - trap with 'r.a' replaced by 'l.r.a'. - Examples: - ~talsur-todres/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~]) - ~talsur-todres/try=> (~(del by b) `a`) - {[p=`b` q=[2 3]]} - - +- dig - axis of 'b' key - Description: - Accepts any noun 'b' and produces the axis of 'b' in within the values of 'p.a' in map 'a'. - --- - Creates a wet %gold gate which accepts a noun. - Let 'c' be 1. - Creates and kicks a dry %gold gate. Casts the result to an atomic unit. - Builds an if-then-else statement on "a is null." If so, produce null. - Else, build an if-then-else statement on (b=(p.n.a.)). If so, produce the unit [~ u=(peg c 2)]. - Else, build an if-then-else statement on the g-order of 'b' and 'p.n.a'. - If so, recursively call the trap with 'a' replaced by 'l.a' and 'c' by (peg c 6). - Else, recursively call the trap with 'a' replaced by 'r.a' and 'c' by (peg c 7). - Examples: - ~talsur-todres/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~]) - ~talsur-todres/try=> (~(dig by b) `b`) - [~ 2] - - +- gas - concatenate - Description: - Accepts any list 'b' of key-value pair cells and produces the map 'a' with the members of 'b' added. - --- - Activate jet. - Creates a wet %gold gate which accepts a list of cells. - Replaces 'b' in the subject with the cast of 'b' to a list whose members have the - same type as the members of 'a'. - Creates and kicks a dry %gold trap. Casts the result to the type of map 'a'. - Builds an if-then-else statement on "b is an atom." - If so, produce 'a'. - Else, recursively call the trap iwth 'b' replaced by the tail of 'b' and 'a' replaced by - 'a' with the key and value of the head of 'b' added to it. - Examples: - ~talsur-todres/try=> =a (mo `(list ,[@t *])`[[`a` 1] [`b` 2] ~]) - ~talsur-todres/try=> =b `(list ,[@t *])`[[`c` 3] [`d` 4] ~] - ~talsur-todres/try=> (~(gas by a) b) - {[p=`d` q=4] [p=`a` q=1] [p=`c` q=3] [p=`b` q=2]} - +- get - grab value by key - Description: - Produces the value in the map at key 'b'. - --- - Creates a wet %gold gate which accepts a noun. - Creates and kicks a dry %gold trap. Casts its result to the type of the map's values. - Builds an if-then-else statement on "a is an atom." - If so, produces null. - Else, build an if-then-else statement on (b=(p.n.a)). - If so, produce the unit [~ u=p.n.a]. - Else, build an if-then-else statement on the g-order of 'b' and 'p.n.a'. - If so, produce the recursive call to the trap with 'a' replaced by 'l.a'. - Else, produce the recursive call to the trap with 'a' replaced by 'r.a'. - Examples: - ~talsur-todres/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~]) - ~talsur-todres/try=> (~(get by b) `b`) - [~ [2 3]] - +- has - key existence check - Description: - Accepts any noun 'b' and produces the loobean indicating whether the noun exists in map 'a'. - --- - Activate jet. - Creates a wet %gold gate which accepts a noun. - Attempts to get 'b' from 'a', then produces the logical NOT of the loobean "get 'b' in 'a' is null" - Examples: - ~talsur-todres/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~]) - ~talsur-todres/try=> (~(has by b) `b`) - %.y - ~talsur-todres/try=> (~(has by b) `c`) - %.n - +- mar - add with validation - Description: - Accepts two nouns of the types of the map's keys and values, respectively. - Validates that the value is not null and puts the pair in the map. If the value is null, - it deletes the key. - --- - Creates a wet %gold gate which accepts a cell of two nouns: one of the type of the map's keys - and one a unit of the map's value type. - If "c is null", produce the map with 'b' deleted. - Else, produce the map with the 'b' and 'u.c' key-value pair added. - Examples: - - +- put - - --- - Activate jet. - Build a wet %gold gate with sample noun `b`, noun `c` - - Creates and kicks a dry %gold trap. Casts the result to the type of the map 'a'. - If "a is an atom", produce the cell [[b c] ~ ~]. - Else, build the if-then-else statement if - --- - - +- rep - replace by product - Description: - Walks through the map, replacing 'b' with the product of (c n.a b). Produces the resulting - map. - --- - Creates a wet %gold gate which accepts a noun and a gate. - Creates and kicks a dry %gold trap. - If "a is null", produce 'b'. - Else, produce the recursive call to the trap with 'a' replaced by 'r.a' and 'b' replaced by - the recursive call to the trap with 'a' replaced by 'l.a' and b replaced by - the product (c n.a b). - Examples: - - +- rib - transform + product - Description: - - --- - - Examples: - - +- run - turns to tuples - Description: - --- - Examples: - +- tap - listify pairs - Description: - --- - Examples: - +- uni - union, merge - Description: - --- - Examples: - +- wyt - depth of map - Description: - --- - Examples: - -section 2dC, queues - -++ to - queue engine - Description: - Container arm for queue operation arms. The contained arms inherit it's sample queue, 'a'. - --- - Builds a wet %gold tray with sample 'a' of type 'qeu'. - +- bal - v-order queue - Description: - Walks through the queue using vor (v-order check) on all eleements. - --- - Creates and kicks a dry %gold trap. Casts the result to the type of the queue 'a'. - If "a is null", produce null. - Else, build an unless-then-else statement on the logical OR of: - "null is in l.a" - "n.a" precedes "n.l.a" in v-order. - If so, produce the recursive call to the trap with 'a' replaced by [n.l.a l.l.a $(a [n.a r.l.a r.a])] - Else, build an unless-then-else statement on the logical OR of: - "null is in r.a" - "n.a" precedes "n.r.a" in v-order. - If so, produce the recursvie call to the trap with 'a' replaced by [n.r.a $(a [n.a l.a l.r.a]) r.r.a]. - Examples: - ~palryp-hocsyt/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[6 1 3 6 1 3 4 6 ~]) - ~palryp-hocsyt/try=> a - {6 4 3 1 6 3 1 6} - ~palryp-hocsyt/try=> ~(bal to a) - {6 4 3 1 6 3 1 6} - --- - - +- dep - max depth of queue - Description: - Produces the maximum depth of leaves (r.a and l.a) in the queue 'a'. - --- - Creates and kicks a dry %gold trap. Casts the result to an atom. - If "a is null", produce 0. - Else, increment the maximum of the recursive calls of the 'dep' to the left and right leaves of 'a', - $(a l.a) and $(a r.a). - Examples: - ~palryp-hocsyt/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 5 6 7 ~]) - ~palryp-hocsyt/try=> ~(dep to a) - 4 - --- - ~palryp-hocsyt/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 ~]) - ~palryp-hocsyt/try=> ~(dep to a) - 3 - --- - ~palryp-hocsyt/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 ~]) - ~palryp-hocsyt/try=> ~(dep to a) - 2 - +- gas - insert list to que - Description: - Accepts a - --- - Creates a dry %gold gate which accepts a list of the elements of the queue. - Creates and kicks a dry %gold gate. Casts the result to the type of 'a', the queue. - If "b is null", produce 'a'. - Else, Produce the recursive call to the trap with 'b' replaced by the tail of 'b' and 'a' replaced by the - result of putting the head of 'b' into 'a'. - Examples: - ~palryp-hocsyt/try=> (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 ~]) - {3 2 1} - --- - ~palryp-hocsyt/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 ~]) - ~palryp-hocsyt/try=> =b `(list ,@)`[4 5 6 ~] - ~palryp-hocsyt/try=> (~(gas to a) b) - {6 5 4 3 2 1} - +- get - head-tail pair - Description: - Produces the queue 'a' in the format [p=head q=tail]. - --- - Creates and kicks a dry %gold trap. Casts the head term of the resulting tuple to the type of the queue's elements - and the tail type to that of the queue itself. - If "a is null", crash the program. - Else, if "r.a is null", produce [n.a l.a]. - Else, let 'b' be the recursive call of the trap with 'a' replaced by 'r.a'. - Produce the the following as a [p q] cell: - As the p term, 'p.b' - As the q term, the result of the if-then-else statement: - If "null is in q.b" OR 'n.a' precedes 'n.q.b' in the v-order, - produce [n.a l.a q.b]. - Else, produce [n.q.b [n.a l.q.b] r.q.b]. - Examples: - - +- nap - removes head - Description: - Removes the head of a queue, producing the resulting queue. - --- - Assert that 'a' is a cell. - Builds an if-then-else statement on "l.a is null". If so, produce r.a. - Else, let 'b' be the result of getting the [p=head q=tail] pair from 'l.a'. - Produce the queue v-order of bal(+< ^+(a [p.b q.b r.a])). - Examples: - ~talsur-todres/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 5 6 ~]) - ~talsur-todres/try=> -.a - n=6 - ~talsur-todres/try=> =b ~(nap to a) - ~talsur-todres/try=> -.b - n=2 - ~talsur-todres/try=> b - {5 4 3 2 1} - ~talsur-todres/try=> a - {6 5 4 3 2 1} - +- put - insert new head - Description: - Accepts any noun and adds to the queue as the head, producing the resutling queue. - --- - Creates a wet %gold gate which accepts any noun. - Creates and kicks a dry %gold trap. Casts the result to the type of the queue 'a'. - If "a is null", produce [b ~ ~]. - Else, produce bal(+< a(l $(a l.a))). - - Examples: - ~dovryp-toblug/try=> (~(gas to `(qeu ,@)`~) `(list ,@)`[3 1 2 4 5 6 ~]) - ~dovryp-toblug/try=> (~(put to a) 7) - {7 6 5 4 2 1 3} - +- tap - adds list to end - Description: - Concatenates two lists from the first - --- - Creates a dry %gold gate which accepts a list of elements of the type of the queue's elements. - Casts the result to the type of 'b', the list. - If "a is null", produce 'b'. - Else, produce the recursive call to the gate with 'a' replaced by 'r.a' and 'b' replaced by [n.a $(a l.a)], - where $(a l.a) is the recursive call to the trap with 'a' replaced by 'l.a'. - Examples: - ~dovryp-toblug/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[3 1 2 4 5 6 ~]) - ~dovryp-toblug/try=> (~(tap to a) `(list ,@)`[99 100 101 ~]) - ~[3 1 2 4 5 6 99 100 101] - +- top - produces head - Description: - - --- - Creates and kicks a dry %gold trap. Casts the result to a unit of the type of the queue's element. - If "a is null", produce null. - Else, if "the right leaf of 'a' is null", produce [~ n.a]. - Else, produce $(a r.a), the recursive call to the trap with 'a' replaced by 'r.a'. - Examples: - ~talsur-todres/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 5 6 ~]) - ~talsur-todres/try=> ~(top to a) - [~ 1] - -section 2dD, casual containers - -++ mo - make a map - Description: - Mapifiy. Accepts a list of cells and produces a map of key-value pairs from the left-right cell pairs of the list. - --- - Creates a wet %gold gate which accepts a list, 'a'. - Pushes the homogenized list onto the context. - Casts the list 'a' to a list of cells whose left-right types correspond to the key-value type pairs. - Let 'b' be the bunt of the map with the properly typed keys and values from the cell at the head of our list. - Concatenate the elements of 'a' into the empty map of bunt 'b', and produce the result. - Examples: - ~talsur-todres/try=> (mo `(list ,[@t *])`[[`a` 1] [`b` 2] ~]) - {[p=`a` q=1] [p=`b` q=2]} - -++ sa - make a set - Description: - Setify. Accepts a list and produces a set of the list's elements. - --- - Creates a wet %gold gate which accepts a list, 'a'. - Pushes the homogenized list onto the context. - Let 'b' be the bunt of the set with elements of the same type of the elements of 'a'. - Concatenate the elements of 'a' into the empty set of bunt 'b', and produce the result. - Examples: - ~talsur-todres/try=> (sa `(list ,@)`[1 2 3 4 5 ~]) - {5 4 1 3 2} - --- - ~talsur-todres/try=> (sa `(list ,[@t *])`[[`a` 1] [`b` 2] ~]) - {[`a` 1] [`b` 2]} -++ qu - make a set - Description: - XXX THIS APPEARS TO BE A COPY OF ++sa. QUEUIFY IS NOT IMPLEMENTED YET. XXX - --- - Examples: - -chapter 2e, miscellaneous libs - -section 2eA, packing - -++ cue - Unpack an atom to a noun. The inverse of jam. - --- - Activate jet. - Build dry %gold gate with sample atom `a`. - Yield noun. - Push `b` is 0. - Push `m` is empty map of type (map ,@ ,*). - Seek subject for q. - Kick dry %gold trap, yield tuple [p=@ q=* r=_m] - If (0=(cut 0 [b 1] a)), - Then, push `c` is (rub +(b) a). - Produce - - --- - ~midlys-rocpet/try=> (cue (jam 1)) - 1 - ~midlys-rocpet/try=> (cue 4.657) - [1 2] - ~midlys-rocpet/try=> (cue (jam [1 1])) - [1 1] - ~tadbyl-hilbel/try=> (cue 39.689) - [0 19] -++ jam - Compress a noun to an atom. The inverse of cue. - --- - Activate jet. - Build wet %gold gate with sample noun `a`. - Yield atom. - Push `b` is 0. - Push `m` is empty may of type (map ,@ ,*). - - --- - ~midlys-rocpet/try=> (jam 1) - 12 - ~midlys-rocpet/try=> (jam [1 1]) - 817 - ~tadbyl-hilbel/try=> (jam [~ u=19]) - 39.689 -++ mat - Encodes length. Only used internally as helper function to jam and cue. - --- - Activate jet. - Build dry %gold gate with sample atom a. - Yield atom a, atom b. - If: a is 0. - Then: Produce [1 1] - Else, push `b` is (met 0 a), the number of bits in `a`. - Push `c` is (met 0 b), the number of bits in `b`. - Produce pair: - (add (add c c) b) and - (cat 0 (bex c) (mix (end 0 (dec c) b) (lsh 0 (dec c) a))) -++ rub - Decodes length. Only used internally as a helper function to jam and cue. - --- - Activate jet. - Build wet %gold gold with sample atom a, atom b. - Yield atom p, atom q. - Push label `c` on: - Push `c` is 0, m is (met 0 b), the number of bits in `b`. - Kick dry %gold trap. Deny that (gth c m), `c` is greater than `m`. - Unless: (cut 0 [(add a c) 1] b)) is 0, - Then: `c` - Else: Slam trap with +(c) - If: c is 0, - Then: Produce [1 0]. - Else, push `d` is (add a +(c)) - Push `e` is (add (bex (dec c)) (cut 0 [d (dec c)] b)). - Produce [(add (add c c) e) (cut 0 [(add d (dec c)) e] b)] - -section 2eB, parsing (tracing) - -++ last - Compare two [line column] pairs and produce the one which is farther along in text. - --- - Build dry %gold gate with sample hair `zyc`, hair `naz` - Yield hair. - If: p.zyc is p.naz, - Then: If: q.zyc is greater than q.naz, - Then: Produce zyc, - Else: Produce naz. - Else: If: p.zyc is greater than p.naz, - Then: Produce zyc, - Else: Produce naz. - --- - ~tadbyl-hilbel/try=> (last [1 1] [1 2]) - [p=1 q=2] - ~tadbyl-hilbel/try=> (last [2 1] [1 2]) - [p=2 q=1] - ~tadbyl-hilbel/try=> (last [0 0] [99 0]) - [p=99 q=0] - ~tadbyl-hilbel/try=> (last [7 7] [7 7]) - [p=7 q=7] -++ lust - Produce the beginning of the next line after a newline character or increment the column number - The index of the next character to be parsed. - --- - Build dry %gold gate with sample char `weq`, hair `naz` - Yield hair. - If: `weq` is 10, - Then: Produce [+(p.naz) 1]. - Else: Produce [p.naz +(q.naz)]. - --- - ~tadbyl-hilbel/try=> (lust `a` [1 1]) - [p=1 q=2] - ~tadbyl-hilbel/try=> (lust `@t`10 [1 1]) - [p=2 q=1] - ~tadbyl-hilbel/try=> (lust '9' [10 10]) - [p=10 q=11] - ~tadbyl-hilbel/try=> (lust `@t`10 [0 0]) - [p=1 q=1] - -section 2eC, parsing (custom rules) - -++ cold - Build gate to parse a nail with a rule, then replaced the parsed texted with a constant. - --- - Activate jet. - Build wet %gold gate with sample noun `cus`, bunt of a rule `sef`. - Activate extra parsing jet. - Build dry %gold gate with sample nail `tub`. - Push `vex` is the rule `sef` slammed by the nail `tub`, an edge. - If: q.vex is an atom, - Then: Produce `vex` - Else: Produce [p=p.vex q=[~ u=[p=cus q=q.u.q.vex]]] - --- - ~midlys-rocpet/try=> ((cold %foo (just `a`)) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=%foo q=[p=[p=1 q=2] q="bc"]]]] - ~midlys-rocpet/try=> ((cold %foo (just `a`)) [[1 1] "bc"]) - [p=[p=1 q=1] q=~] -++ cook - Build gate to parse a nail with a rule, then slam a gate with the parsed text. - --- - Activate jet. - Build wet %gold gate with sample clam gate `poq`, bunt of a rule `sef`. - Activate extra parsing jet. - Build dry %gold gate with sample nail `tub`. - Push `vex` is the rule `sef` slammed by the nail `tub`, an edge. - If: `q.vex` is an atom, - Then: Produce `vex` - Else: Produce [p=p.vex q=[~ u=[p=(poq p.u.q.vex) q=q.u.q.vex]]], - where (poq p.u.q.vex) is gate `poq` slammed with the parsed text. - --- - ~midlys-rocpet/try=> ((cook ,@ud (just `a`)) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]] - ~midlys-rocpet/try=> ((cook ,@tas (just `a`)) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=%a q=[p=[p=1 q=2] q="bc"]]]] - ~midlys-rocpet/try=> ((cook |=(a=@ +(a)) (just `a`)) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=98 q=[p=[p=1 q=2] q="bc"]]]] - ~midlys-rocpet/try=> ((cook |=(a=@ `@t`+(a)) (just `a`)) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=`b` q=[p=[p=1 q=2] q="bc"]]]] -++ easy - Succeed but consume no characters - Produce an edge at the same text position with the text to parse unchanged, but with a - --- - Activate jet. - Build wet %gold gate with sample noun, `huf`, a noun to produce as the parsed value. - Activate extra parsing jet. - Build dry %gold date with sample nail, `tub` - Yield edge of type `huf` - Produce [p=p.tub q=[~ u=[p=huf q=tub]]], the edge with the noun `huf` as it's parsed value and `tub` as unparsed. - --- - ~tadbyl-hilbel/try=> ((easy %foo) [[1 1] "abc"]) - [p=[p=1 q=1] q=[~ [p=%foo q=[p=[p=1 q=1] q="abc"]]]] - ~tadbyl-hilbel/try=> ((easy %foo) [[1 1] "bc"]) - [p=[p=1 q=1] q=[~ [p=%foo q=[p=[p=1 q=1] q="bc"]]]] - ~tadbyl-hilbel/try=> ((easy 'a') [[1 1] "bc"]) - [p=[p=1 q=1] q=[~ [p='a' q=[p=[p=1 q=1] q="bc"]]]] -++ fail - Fail to parse - Produce a nail at the same text position but with null text. - --- - Build wet %gold gate with sample nail, `tub`. - Produce nail [p=p.tub q=~]. - --- - ~tadbyl-hilbel/try=> (fail [[1 1] "abc"]) - [p=[p=1 q=1] q=~] - ~tadbyl-hilbel/try=> (fail [[p=1.337 q=70] "Parse me, please?"]) - [p=[p=1.337 q=70] q=~] -++ full - Demand politely that the parsing rule parse the entire sample nail, produce a null edge otherwise. - --- - Build wet %gold gate with sample rule, `sab` - Build dry %gold gate with sample nail `tub` - Push `vex` is the rule slammed with the text to parse. - If: Parse of `vex` is null, - Then: Produce `vex` - Else: If: The unparsed text in the produced edge is nulll, - Then: Produce `vex` - Else: Produce [p=p.vex q=~], the edge with a null unit nail. - --- - ~tadbyl-hilbel/try=> ((full (just 'a')) [[1 1] "ab"]) - [p=[p=1 q=2] q=~] - ~tadbyl-hilbel/try=> ((full (jest 'ab')) [[1 1] "ab"]) - [p=[p=1 q=3] q=[~ u=[p='ab' q=[p=[p=1 q=3] q=""]]]] - ~tadbyl-hilbel/try=> ((full ;~(plug (just 'a') (just 'b'))) [[1 1] "ab"]) - [p=[p=1 q=3] q=[~ u=[p=[~~a ~~b] q=[p=[p=1 q=3] q=""]]]] -++ funk - Prepend a tape to the text to be parsed, then parse the new tape. - --- - Build wet %gold gate with sample tape `pre`, rule `sef` - Build dry %gold gate with sample nail, `tub` - Produce the rule slammed with the hair index of `tub` and the concatenation of - the prefix tape and the `tub` tape. - --- - ~tadbyl-hilbel/try=> ((funk "abc prefix-" (jest 'abc')) [[1 1] "to be parsed"]) - [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=" prefix-to be parsed"]]]] - ~tadbyl-hilbel/try=> ((funk "parse" (just 'a')) [[1 4] " me"]) - [p=[p=1 q=4] q=~] -++ here - Apply rule if parsing within a specific line and column range. - --- - Activate jet. - Build wet %gold gate with sample bunted gate accepting pint `a`, noun `b` and producing cell [a b], and bunt of rule `sef` - Activate extra parsing jet. - Build dry %gold gate with sample nail `tub` - Push `vex` is the rule `sef` slammed by the nail `tub`, an edge. - If: `q.vex` is an atom, - Then: Produce `vex`, - Else: Produce the hair, - p is `q.tub` - q is the unit: - Null - u is: - p is `hez` slammed with the pint cell of tub's position and vex's position. - q is `q.u.q.vex`, the text not parsed. - --- - -++ inde - Apply rule to indented block starting at current column number, - omitting the leading whitespace. - --- - Build wet %gold gate with sample rule, 'sef' - Build dry %gold gate with sample nail and the same product type as sef. - Let 'har' and 'tap' be p and q within that nail - Let 'lev' be ' ' repeated once less than the column number in har. - Let roq be the result of parsing the nail as any number of either - Printable characters, or - Newlines followed by ignored lev. - If roq is a failure produce it. - Let 'vex' be the result of parsing with sef, with column restarted to - 1, the result in roq which must be a tape. - If vex is a failure produce it with its p set to that of roq. - Produce an edge with parse reach from roq, succesful result from vex, - hair from vex with column number advanced by q.har - 1 (which was - subtracted prior passing it to sef), and a continuation tape of: - Let res be the continuation in vex(section of block unconsumed). - Build an kick a trap (Do): - If res is empty produce the continuation in roq. - Unless res starts with newline produce the head of res followed - by the result of tossing res for its tail. - Welp together a newline, lev, and the result of tossing res for - its tail. - --- - -++ jest - Match and consume a cord. - --- - Build dry %gold gate with sample cord `daf` - Build dry %gold gate with sample nail `tub` - Push `fad` is `daf` - Kick dry %gold trap. Yield edge of cord text. - If: `daf` is 0, - Then: Produce the edge with: - p is `p.tub` - q is the unit: - Null - u is the cell [p=fad q=tub] - Else: If: fish for null in q.tub OR compile to Nock the last byte in `daf` and the - Then: Produce the failed parse of `tub`, - Else: Toss `p.tub` for the index of the next character to be parsed, `q.tub` for the tail of `q.tub`, `daf` for the single byte right-shift of `daf` - --- - ~tadbyl-hilbel/try=> ((jest 'abc') [[1 1] "abc"]) - [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=""]]]] - ~tadbyl-hilbel/try=> (scan "abc" (jest 'abc')) - 'abc' - ~tadbyl-hilbel/try=> (scan "abc" (jest 'acb')) - ! {1 2} - ! 'syntax-error' - ! exit - ~tadbyl-hilbel/try=> ((jest 'john doe') [[1 1] "john smith"]) - [p=[p=1 q=6] q=~] - ~tadbyl-hilbel/try=> ((jest 'john doe') [[1 1] "john doe"]) - [p=[p=1 q=9] q=[~ [p='john doe' q=[p=[p=1 q=9] q=""]]]] -++ just - Match and consume a single character. - --- - Activate jet. - Build dry %gold gate with sample char `daf` - Activate extra parsing jet. - Build dry %gold gate wtih sample nail `tub` - Yield char edge. - If: `q.tub` is null, - Then: Produce the failed parse of `tub`, - Else: Unless: `daf` is `i.q.tub`, - Then: Produce the failed parse of `tub`, - Else: Produce the parse of the next character of `tub` - --- - ~tadbyl-hilbel/try=> ((just 'a') [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]] - ~tadbyl-hilbel/try=> (scan "abc" (just 'a')) - ! {1 2} - ! 'syntax-error' - ! exit - ~tadbyl-hilbel/try=> (scan "a" (just 'a')) - ~~a - ~tadbyl-hilbel/try=> (scan "%" (just '%')) - ~~~25. -++ knee - Callback - --- - Build wet %gold gate with sample noun `gar`, rule trap `sef` - Build dry %gold gate with sample nail `tub` - Yield char edge. - Produce `tub` slammed to `sef` - --- - - -++ mask - Match the next char to a list of chars, a tape. - --- - Activate jet. - Build wet %gold gate with sample (list char) `bud` - Activate extra parsing jet. - Build dry %gold gate with sample nail `tub` - Yield char edge. - If: `q.tub` is an atom, - Then: Produce the failed parse of `tub` - Else: Unless: - - --- - ~tadbyl-hilbel/try=> (scan "a" (mask "cba")) - ~~a - ~midlys-rocpet/try=> ((mask "abc") [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]] - ~midlys-rocpet/try=> ((mask "abc") [[1 1] "bbc"]) - [p=[p=1 q=2] q=[~ [p=~~b q=[p=[p=1 q=2] q="bc"]]]] - ~midlys-rocpet/try=> ((mask "abc") [[1 1] "dbc"]) - [p=[p=1 q=1] q=~] -++ next - Always succeeds and consumes a character. - --- - Build dry %gold gate with sample nail `tub` - Yield char edge. - If: The text to parse `q.tub` is an atom, - Then: Produce the failed parse of `tub` - Else: Push `zac` is lust slammed with: - The first chaarcter to parse (The head of `q.tub`) and its location in the text. - Produce the edge with the hair `zac` and unit nail with: - The character successfully consumed, the head of the text to parse. - A nail of hair index `zac`, text to be parsed `t.q.tub` (The tail of the text to parse.) - --- - ~tadbyl-hilbel/try=> (next [[1 1] "ebc"]) - [p=[p=1 q=2] q=[~ [p=~~e q=[p=[p=1 q=2] q="bc"]]]] - ~tadbyl-hilbel/try=> (next [[1 1] "john jumps jones"]) - [p=[p=1 q=2] q=[~ [p=~~j q=[p=[p=1 q=2] q="ohn jumps jones"]]]] -++ sear - Conditional cook - Produce the slam of the parsed texted to `b` only if the result is not null. - Else, produce null. - --- - Activate jet. - Build wet %gold gate with sample tile of gate accepting a noun and producing a unit `pyq`, rule `sef` - Activate extra parsing jet. - Build dry %gold with sample nail `tub` - Push `vex` is the rule `sef` slammed by the nail `tub`, an edge. - If: The text to be parsed is an atom, - Then: Produce `vex`, - Else: Push `gey` is `pyq` slammed with the - If: `gey` is an atom, - Then: Produce the cell with: - p is the hair index of the parse failure. - Else: Produce the cell with: - p is the hair index of the parse. - q is the unit with value u is: - p is the value of the parsed text slammed to `pyq` - q is the value of the unparsed text. - --- - ~midlys-rocpet/try=> ((sear |=(a=* ?@(a (some a) ~)) (just `a`)) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]] - ~midlys-rocpet/try=> ((sear |=(a=* ?@(a [~ u=a] ~)) (just `a`)) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]] -++ shim - Match characters within a range. - --- - Activate jet. - Build wet %gold gate with sample atom `les`, atom `mos` - Activate extra parsing jet. - Build dry %gold gate with sample nail, `tub` - Yield char edge. - If: `q.tub` is an atom, - Then: Produce the failed parse of `tub`, - Else: Unless: `i.q.tub` is greater than or equal to `les` AND `i.q.tub` is less than or equal to `mos`, - Then: Produce the failed parse of `tub`, - Else: Produce the single character parse of `tub` - --- - ~midlys-rocpet/try=> ((shim `a` 'z') [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]] - ~midlys-rocpet/try=> ((shim `a` 'Z') [[1 1] "abc"]) - [p=[p=1 q=1] q=~] - ~midlys-rocpet/try=> ((shim `a` 'Z') [[1 1] "Abc"]) - [p=[p=1 q=2] q=[~ [p=~~~41. q=[p=[p=1 q=2] q="bc"]]]] -++ stag - Add a label to an edge parsed by a rule. - --- - Activate jet. - Build wet %gold gate with sample noun `gob`, bunt of a rule `sef` - Activate extra parsing jet. - Build dry %gold gate with sample nail `tub` - Push `vex` is the rule `sef` slammed by the nail `tub`, an edge. - If: `q.vex` is an atom, - Then: Produce `vex` - Else: Produce the edge with hair `p.vex` and unit with value hair u=[p=[gob p.u.q.vex] q=q.u.q.vex] - --- - ~tadbyl-hilbel/try=> ((stag %foo (just 'a')) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=[%foo ~~a] q=[p=[p=1 q=2] q="bc"]]]] - ~tadbyl-hilbel/try=> ((stag "xyz" (jest 'abc')) [[1 1] "abc"]) - [p=[p=1 q=4] q=[~ u=[p=["xyz" 'abc'] q=[p=[p=1 q=4] q=""]]]] - ~tadbyl-hilbel/try=> ((stag 10.000 (shim 0 100)) [[1 1] "abc"]) - [p=[p=1 q=2] q=[~ u=[p=[10.000 ~~a] q=[p=[p=1 q=2] q="bc"]]]] -++ stet - Listify a list of text position and bunt of rule pairs. - --- - Build wet %gold gate with sample list of position and bunt of rule pairs `leh` - Kick dry %gold trap. - If: `leh` is null, - Then: Produce null. - Else: Produce the cell, - with head: The cell of the head of the head of `leh`, p=-.i.leh, the tail of the head of `leh, q=+.i.leh. - with tail: Toss `leh` for `t.leh` - --- - ~tadbyl-hilbel/try=> (stet (limo [[5 (just 'a')] [1 (jest 'abc')] [[1 1] (shim 0 200)] [[1 10] (cold %foo (just 'a'))]~])) - ~[ - [p=5 q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>] - [p=1 q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>] - [p=[1 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>] - [p=[1 10] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>] - ] - ~tadbyl-hilbel/try=> (stet (limo [[[1 1] (just 'a')] [[2 1] (shim 0 200)] ~])) - ~[ - [p=[1 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>] - [p=[2 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>] - ] -++ stew - - --- - Activate jet. - Build wet %gold gate with sample list of position and bunt of rule pairs `leh` - Push label `wor` on: - Build dry %gold gate with sample fork between `ort` , fork `wan` - --- -++ stir - - --- - Activate jet. - Build wet %gold gate with sample noun `rud`, gate accepting two nouns and producing , rule `fel` - Activate extra parsing jet. - Build dry %gold with sample nail `tub` - Yield edge of type of `rud` - Push `vex` is the rule `fel` slammed with the nail `tub`A - If: The parsed text is null, - Then: Produce the edge of unit nail `rud` and `tub` at the hair index of `vex` - Else: Push `wag` is the toss of `tub` for the unparsed text in the unit nail of `vex` - Assert that the value - - Produce the edge with: - The farthest along hair index of `vex` and `wag` - The unit nail of - - --- - -++ stun - Parse several times - --- - Activate jet. - Build wet %gold gate with sample atom `les`, atom `mos`, rule `fel` - Activate extra parsing jet. - Build wet %gold gate with sample nail `tub` - Yield edge of - - If: `mos` is 0, - Then: Produce the edge with - --- - -section 2eD, parsing (combinators) - -++ bend - - --- - Activate jet. - Build wet %gold gate with sample gate accepting a noun `a`, noun `b` and producing the unit of [a b] - Activate extra parsing jet. - Build wet %gold gate with sample edge `vex`, rule `sab` - If: `q.vex` is an atom, - Then: Produce `vex`, - Else: Push `yit` is sab slammed with - --- - -++ comp - Arbitrary compose - --- - Activate jet. - Build wet %gold gate with sample gate accepting noun a, noun b and producing [a b], `raq` - Activate extra parsing jet. - Build wet %gold gate with sample edge `vex`, rule `sab` - If: The parsing output in `vex` is an atom, - Then: Produce the edge `vex` - Else: Push `yit` is the rule slammed with the text to parse in `vex` - Push `yur` is the hair of the edge that is farther along of `vex` and `yit` - If: The unit of parsed text in `yit` is null, - Then: Produce the edge with hair `yur` and unit nail from `yit`, which is null. - Else: Produce the edge with hair `yur`, unit [p=* q=nail] cell where: - p is `raq` slammed with `p.u.q.vex` and `p.u.q.yit`, the parsed results `yit` and `vex` - q is `q.u.q.yit`, the unparsed text of `yit` - --- - - -++ glue - Add rule. - --- - Activate jet. - Build wet %gold gate with sample rule `bus` - Activate extra parsing jet. - Build wet %gold gate with sample edge `vex`, rule `sab` - Slam plug with: - The edge `vex` - The tuple of slamming bus and sab with pfix - --- -++ less - No first and second. - --- - Build wet %gold gate with sample edge `vex`, rule `sab` - If: `q.vex` is null, - Then: Push `roq` is `sab`. Produce [p=(last p.vex p.roq) q=q.roq] - Else: Produce vex with q tossed for null. - --- - -++ pfix - Discard the first rule of a two rule cell. - --- - Activate jet. - Produce comp slammed with: - Build wet %gold gate slammed with sample noun `a`, noun `b`. - Produce `b` - --- - - -++ plug - Apply parsing rules in order to an edge. - --- - Activate jet. - Build wet %gold gate with sample edge `vex`, rule `sab` - If: The unit of text to parse is null, - Then: Produce null. - Else: Push `yit` is the rule `sab` slammed with the text to be parsed. - Push `yur` is the hair of the edge that is farther along of `vex` and `yit` - If: The unit of text parsed is null, - Then: Produce the edge [p=yur q=null]. - Else: Produce the edge [p=yur q=[~ u=[p=[p.u.q.vex p.u.q.yit] q=q.u.q.yit]]], - the edge of the text parsed with the rule. - --- - ~tadbyl-hilbel/try=> (;~(plug lus lus) [[1 1] "++"]) - [p=[p=1 q=3] q=[~ u=[p=[~~~2b. ~~~2b.] q=[p=[p=1 q=3] q=""]]]] - ~tadbyl-hilbel/try=> (scan "++" ;~(plug lus lus)) - [~~~2b. ~~~2b.] - ~tadbyl-hilbel/try=> (scan "++" (cold "slus" ;~(plug lus lus))) - "slus" - ~tadbyl-hilbel/try=> (scan "john doe" ;~(plug (jest 'john') ace (jest 'doe'))) - ['john' ~~. 'doe'] - ~tadbyl-hilbel/try=> (scan "john doe" ;~(plug (jest 'doe') ace (jest 'john'))) - ! {1 1} - ! 'syntax-error' - ! exit - ~tadbyl-hilbel/try=> (;~(plug bar hep) [[1 1] "|-"]) - [p=[p=1 q=3] q=[~ u=[p=[~~~7c. ~~-] q=[p=[p=1 q=3] q=""]]]] - ~tadbyl-hilbel/try=> (;~(plug bar hep lus) [[1 1] "|-"]) - [p=[p=1 q=3] q=~] - ~tadbyl-hilbel/try=> (scan "|-" ;~(plug bar hep lus)) - ! {1 3} - ! 'syntax-error' - ! exit -++ pose - Build list of parsing rules and try to use any of them in order. - `pose` has the same usage as `plug`, but does not fail if the rules are not - successful in a certain order. - --- - Activate jet. - Build wet %gold gate with sample edge `vex`, rule `sab` - If: The unit of text to parse is null, - Then: Push `roq` is the edge result of the rule `sab` applied to the - Produce the edge with the hair that is farther along of `vex` and `yit` and the parse - results of the rule. - Else: Produce the initial edge, `vex` - --- - ~tadbyl-hilbel/try=> (;~(pose (just 'a') (just 'b') (just 'c')) [[1 1] "c"]) - [p=[p=1 q=2] q=[~ [p=~~c q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (scan "c" ;~(pose (just 'a') (just 'b') (just 'c'))) - ~~c - ~tadbyl-hilbel/try=> (;~(pose bar hep) [[1 1] "|-"]) - [p=[p=1 q=2] q=[~ [p=~~~7c. q=[p=[p=1 q=2] q="-"]]]] - ~tadbyl-hilbel/try=> (scan "|-" (star ;~(pose bar hep))) - "|-" - ~tadbyl-hilbel/try=> (scan "|-" (star ;~(pose bar hep lus))) - "|-" - ~tadbyl-hilbel/try=> (scan "john doe" (star ;~(pose (jest 'doe') ace (jest 'john')))) - ~['john' ' ' 'doe'] - -++ sfix - Discard second rule. - --- - Activate jet. - Slam comp with a wet %gold gate accepting noun `a`, noun `b` and producing noun `a` - --- - -section 2eE, parsing (composers) - -++ bass - --- - Build wet %gold gate with sample atom `wuc`, rule `tyd` - Slam cook with: - Build dry %gold gate with sample list of atoms, `waq` - Slam roll with: - --- -++ boss - --- - Build wet %gold gate with sample atom `wuc`, rule `tyd` - --- -++ ifix - - --- - Build wet %gold gate with sample cell of rules `fel`, rule `hof` - Produce pfix gonadified with: - `p.fel`, the first rule in `fel` - Gonadify sfix with `hof` and `q.fel`, the second rule in `fel` - --- - -++ more - --- - Build wet %gold gate with sample rule `bus`, rule `fel` - Produce the gonadified: - --- -++ most - Parse to a list elements of the second rule seperated by the second. - - --- - Build wet %gold gate with sample rule `bus`, rule `fel` - Produce gonadified: - Plug slammed with `fel`, - star slammed with gonadified: - pfix slammed with `bus` and `fel`, `bus` added as the prefix of `fel` - --- - -++ plus - Like 'star', but "one or more" instead of "0 or more" - - --- - Build wet %gold gate with sample rule `fel` - Produce gonadified: - plug slammed with `fel` and star slammed with `fel`, the repeated application of `fel`. - --- - - -++ slug - - --- - Build wet %gold gate with sample noun `rud`, gate accepting cell of two nouns and producing [a b] `raq` - Build wet %gold gate with sample rule `bus`, rule `fel` - Produce the gonadified: - comp slammed with `raq`, - slammed with `fel`, - slammed with, - stir slammed with `rud`, `raq`, and `fel` prefixed with `bus` - --- - -++ star - Apply the parsing rule repeatedly until it fails. - --- - Build wet %gold gate with sample rule `fel, - Produce stir slammed with: - The list of elements of type of the icon of `fel` slammed to `wonk` - - --- - ~tadbyl-hilbel/try=> (scan "aaaaa" (just 'a')) - ! {1 2} - ! 'syntax-error' - ! exit - ~tadbyl-hilbel/try=> (scan "aaaaa" (star (just 'a'))) - "aaaaa" - ~tadbyl-hilbel/try=> (scan "abcdef" (star (just 'a'))) - ! {1 2} - ! 'syntax-error' - ! exit - ~tadbyl-hilbel/try=> (scan "abcabc" (star (jest 'abc'))) - <|abc abc|> - ~tadbyl-hilbel/try=> (scan "john smith" (star (shim 0 200))) - "john smith" - -section 2eF, parsing (ascii) - -++ ace - Parse ASCII character 32, ace. - --- - Produce the rule just slammed with ' ' - --- - ~tadbyl-hilbel/try=> (scan " " ace) - ~~. - ~tadbyl-hilbel/try=> `cord`(scan " " ace) - ' ' - ~tadbyl-hilbel/try=> (ace [[1 1] " "]) - [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (ace [[1 1] " abc "]) - [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q="abc "]]]] -++ bar - Parse ASCII character 124, bar. - --- - Produce the rule just slammed with '|' - --- - ~tadbyl-hilbel/try=> (scan "|" bar) - ~~~7c. - ~tadbyl-hilbel/try=> `cord`(scan "|" bar) - '|' - ~tadbyl-hilbel/try=> (bar [[1 1] "|"]) - [p=[p=1 q=2] q=[~ [p=~~~7c. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (bar [[1 1] "|="]) - [p=[p=1 q=2] q=[~ [p=~~~7c. q=[p=[p=1 q=2] q="="]]]] -++ bas - Parse ASCII character 92, bas. - Note the extra '\' in the slam of bas with just is to escape the escape character, bas. - --- - Produce the rule just slammed with '\\' - --- - ~tadbyl-hilbel/try=> (scan "\\" bas) - ~~~5c. - ~tadbyl-hilbel/try=> `cord`(scan "\\" bas) - '\' - ~tadbyl-hilbel/try=> (bas [[1 1] "\"]) - ~ - ~tadbyl-hilbel/try=> (bas [[1 1] "\\"]) - [p=[p=1 q=2] q=[~ [p=~~~5c. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (bas [[1 1] "\""]) - [p=[p=1 q=1] q=~] -++ buc - Parse ASCII character 36, buc. - --- - Produce the rule just slammed with '$' - --- - ~tadbyl-hilbel/try=> (scan "$" buc) - ~~~24. - ~tadbyl-hilbel/try=> `cord`(scan "$" buc) - '$' - ~tadbyl-hilbel/try=> (buc [[1 1] "$"]) - [p=[p=1 q=2] q=[~ [p=~~~24. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (buc [[1 1] "$%"]) - [p=[p=1 q=2] q=[~ [p=~~~24. q=[p=[p=1 q=2] q="%"]]]] -++ cab - Parse ASCII character 95, cab. - --- - Produce the rule just slammed with '_' - --- - ~tadbyl-hilbel/try=> (scan "_" cab) - ~~~5f. - ~tadbyl-hilbel/try=> `cord`(scan "_" cab) - '_' - ~tadbyl-hilbel/try=> (cab [[1 1] "_"]) - [p=[p=1 q=2] q=[~ [p=~~~5f. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (cab [[1 1] "|_"]) - [p=[p=1 q=1] q=~] -++ cen - Parse ASCII character 37, cen. - --- - Produce the rule just slammed with '%' - --- - ~tadbyl-hilbel/try=> (scan "%" cen) - ~~~25. - ~tadbyl-hilbel/try=> `cord`(scan "%" cen) - '%' - ~tadbyl-hilbel/try=> (cen [[1 1] "%"]) - [p=[p=1 q=2] q=[~ [p=~~~25. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (cen [[1 1] "%^"]) - [p=[p=1 q=2] q=[~ [p=~~~25. q=[p=[p=1 q=2] q="^"]]]] -++ col - Parse ASCII character 58, col. - --- - Produce the rule just slammed with ':' - --- - ~tadbyl-hilbel/try=> (scan ":" col) - ~~~3a. - ~tadbyl-hilbel/try=> `cord`(scan ":" col) - ':' - ~tadbyl-hilbel/try=> (col [[1 1] ":"]) - [p=[p=1 q=2] q=[~ [p=~~~3a. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (col [[1 1] ":-"]) - [p=[p=1 q=2] q=[~ [p=~~~3a. q=[p=[p=1 q=2] q="-"]]]] -++ com - Parse ASCII character 44, com. - --- - Produce the rule just slammed with ',' - --- - ~tadbyl-hilbel/try=> (scan "," com) - ~~~2c. - ~tadbyl-hilbel/try=> `cord`(scan "," com) - ',' - ~tadbyl-hilbel/try=> (com [[1 1] ","]) - [p=[p=1 q=2] q=[~ [p=~~~2c. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (com [[1 1] "not com"]) - [p=[p=1 q=1] q=~] -++ doq - Parse ASCII character 34, doq. - --- - Produce the rule just slammed with '"' - --- - ~tadbyl-hilbel/try=> (scan "\"" doq) - ~~~22. - ~tadbyl-hilbel/try=> `cord`(scan "\"" doq) - '"' - ~tadbyl-hilbel/try=> (doq [[1 1] "\""]) - [p=[p=1 q=2] q=[~ [p=~~~22. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (doq [[1 1] "not successfully parsed"]) - [p=[p=1 q=1] q=~] - ~tadbyl-hilbel/try=> (scan "see?" doq) - ! {1 1} - ! 'syntax-error' - ! exit -++ dot - Parse ASCII character 46, dot. - --- - Produce the rule just slammed with '.' - --- - ~tadbyl-hilbel/try=> (scan "." dot) - ~~~. - ~tadbyl-hilbel/try=> `cord`(scan "." dot) - '.' - ~tadbyl-hilbel/try=> (dot [[1 1] "."]) - [p=[p=1 q=2] q=[~ [p=~~~. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (dot [[1 1] ".^"]) - [p=[p=1 q=2] q=[~ [p=~~~. q=[p=[p=1 q=2] q="^"]]]] -++ fas - Parse ASCII character 47, fas. - --- - Produce the rule just slammed with '/' - --- - ~tadbyl-hilbel/try=> (scan "/" fas) - ~~~2f. - ~tadbyl-hilbel/try=> `cord`(scan "/" fas) - '/' - ~tadbyl-hilbel/try=> (fas [[1 1] "/"]) - [p=[p=1 q=2] q=[~ [p=~~~2f. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (fas [[1 1] "|/"]) - [p=[p=1 q=1] q=~] -++ gal - Parse ASCII character 60, gal. - --- - Produce the rule just slammed with '<' - --- - ~tadbyl-hilbel/try=> (scan "<" gal) - ~~~3c. - ~tadbyl-hilbel/try=> `cord`(scan "<" gal) - '<' - ~tadbyl-hilbel/try=> (gal [[1 1] "<"]) - [p=[p=1 q=2] q=[~ [p=~~~3c. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (gal [[1 1] "<+"]) - [p=[p=1 q=2] q=[~ [p=~~~3c. q=[p=[p=1 q=2] q="+"]]]] - ~tadbyl-hilbel/try=> (gal [[1 1] "+<"]) - [p=[p=1 q=1] q=~] -++ gar - Parse ASCII character 62, gar. - --- - Produce the rule just slammed with '>' - --- - ~tadbyl-hilbel/try=> (scan ">" gar) - ~~~3e. - ~tadbyl-hilbel/try=> `cord`(scan ">" gar) - '>' - ~tadbyl-hilbel/try=> (gar [[1 1] ">"]) - [p=[p=1 q=2] q=[~ [p=~~~3e. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (gar [[1 1] "=>"]) - [p=[p=1 q=1] q=~] -++ hax - Parse ASCII character 35, hax. - --- - Produce the rule just slammed with '#' - --- - ~tadbyl-hilbel/try=> (scan "#" hax) - ~~~23. - ~tadbyl-hilbel/try=> `cord`(scan "#" hax) - '#' - ~tadbyl-hilbel/try=> (hax [[1 1] "#"]) - [p=[p=1 q=2] q=[~ [p=~~~23. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (hax [[1 1] "#!"]) - [p=[p=1 q=2] q=[~ [p=~~~23. q=[p=[p=1 q=2] q="!"]]]] -++ kel - Parse ASCII character 123, kel. - Note that this, with ker, opens and closes a Hoon expression for Hoon string interpolation. Escape kel to parse it. - --- - Produce the rule just slammed with '{' - --- - ~tadbyl-hilbel/try=> (scan "\{" kel) - ~~~7b. - ~tadbyl-hilbel/try=> `cord`(scan "\{" kel) - '{' - ~tadbyl-hilbel/try=> (kel [[1 1] "\{"]) - [p=[p=1 q=2] q=[~ [p=~~~7b. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (kel [[1 1] " \{"]) - [p=[p=1 q=1] q=~] -++ ker - Parse ASCII character 125, ker. - --- - Produce the rule just slammed with '}' - --- - ~tadbyl-hilbel/try=> (scan "}" ker) - ~~~7d. - ~tadbyl-hilbel/try=> `cord`(scan "}" ker) - '}' - ~tadbyl-hilbel/try=> (ker [[1 1] "}"]) - [p=[p=1 q=2] q=[~ [p=~~~7d. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (ker [[1 1] "\{}"]) - [p=[p=1 q=1] q=~] -++ ket - Parse ASCII character 94, ket. - --- - Produce the rule just slammed with '^' - --- - ~tadbyl-hilbel/try=> (scan "^" ket) - ~~~5e. - ~tadbyl-hilbel/try=> `cord`(scan "^" ket) - '^' - ~tadbyl-hilbel/try=> (ket [[1 1] "^"]) - [p=[p=1 q=2] q=[~ [p=~~~5e. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (ket [[1 1] ".^"]) - [p=[p=1 q=1] q=~] -++ lus - Parse ASCII character 43, lus. - --- - Produce the rule just slammed with '+' - --- - ~tadbyl-hilbel/try=> (scan "+" lus) - ~~~2b. - ~tadbyl-hilbel/try=> `cord`(scan "+" lus) - '+' - ~tadbyl-hilbel/try=> (lus [[1 1] "+"]) - [p=[p=1 q=2] q=[~ [p=~~~2b. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (lus [[1 1] ".+"]) - [p=[p=1 q=1] q=~] -++ hep - Parse ASCII character 45, hep. - --- - Produce the rule just slammed with '-' - --- - ~tadbyl-hilbel/try=> (scan "-" hep) - ~~- - ~tadbyl-hilbel/try=> `cord`(scan "-" hep) - '-' - ~tadbyl-hilbel/try=> (hep [[1 1] "-"]) - [p=[p=1 q=2] q=[~ [p=~~- q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (hep [[1 1] ":-"]) - [p=[p=1 q=1] q=~] -++ pel - Parse ASCII character 40, pel. - --- - Produce the rule just slammed with '(' - --- - ~tadbyl-hilbel/try=> (scan "(" pel) - ~~~28. - ~tadbyl-hilbel/try=> `cord`(scan "(" pel) - '(' - ~tadbyl-hilbel/try=> (pel [[1 1] "("]) - [p=[p=1 q=2] q=[~ [p=~~~28. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (pel [[1 1] ";("]) - [p=[p=1 q=1] q=~] -++ pam - Parse ASCII character 38, pam. - --- - Produce the rule just slammed with '&' - --- - ~tadbyl-hilbel/try=> (scan "&" pam) - ~~~26. - ~tadbyl-hilbel/try=> `cord`(scan "&" pam) - '&' - ~tadbyl-hilbel/try=> (pam [[1 1] "&"]) - [p=[p=1 q=2] q=[~ [p=~~~26. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (pam [[1 1] "?&"]) - [p=[p=1 q=1] q=~] -++ per - Parse ASCII character 41, per. - --- - Produce the rule just slammed with ')' - --- - ~tadbyl-hilbel/try=> (scan ")" per) - ~~~29. - ~tadbyl-hilbel/try=> `cord`(scan ")" per) - ')' - ~tadbyl-hilbel/try=> (per [[1 1] ")"]) - [p=[p=1 q=2] q=[~ [p=~~~29. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (per [[1 1] " )"]) - [p=[p=1 q=1] q=~] -++ pat - Parse ASCII character 64, pat. - --- - Produce the rule just slammed with '@' - --- - ~tadbyl-hilbel/try=> (scan "@" pat) - ~~~4. - ~tadbyl-hilbel/try=> `cord`(scan "@" pat) - '@' - ~tadbyl-hilbel/try=> (pat [[1 1] "@"]) - [p=[p=1 q=2] q=[~ [p=~~~4. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (pat [[1 1] "?@"]) - [p=[p=1 q=1] q=~] -++ sel - Parse ASCII character 91, sel. - --- - Produce the rule just slammed with '[' - --- - ~tadbyl-hilbel/try=> (scan "[" sel) - ~~~5b. - ~tadbyl-hilbel/try=> `cord`(scan "[" sel) - '[' - ~tadbyl-hilbel/try=> (sel [[1 1] "["]) - [p=[p=1 q=2] q=[~ [p=~~~5b. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (sel [[1 1] "-["]) - [p=[p=1 q=1] q=~] -++ sem - Parse ASCII character 59, sem. - --- - Produce the rule just slammed with ';' - --- - ~tadbyl-hilbel/try=> (scan ";" sem) - ~~~3b. - ~tadbyl-hilbel/try=> `cord`(scan ";" sem) - ';' - ~tadbyl-hilbel/try=> (sem [[1 1] ";"]) - [p=[p=1 q=2] q=[~ [p=~~~3b. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (sem [[1 1] " ;"]) - [p=[p=1 q=1] q=~] -++ ser - Parse ASCII character 93, ser. - --- - Produce the rule just slammed with ']' - --- - ~tadbyl-hilbel/try=> (scan "]" ser) - ~~~5d. - ~tadbyl-hilbel/try=> `cord`(scan "]" ser) - ']' - ~tadbyl-hilbel/try=> (ser [[1 1] "]"]) - [p=[p=1 q=2] q=[~ [p=~~~5d. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (ser [[1 1] "[ ]"]) - [p=[p=1 q=1] q=~] -++ sig - Parse ASCII character 126, sig. - --- - Produce the rule just slammed with '~' - --- - ~tadbyl-hilbel/try=> (scan "~" sig) - ~~~~ - ~tadbyl-hilbel/try=> `cord`(scan "~" sig) - '~' - ~tadbyl-hilbel/try=> (sig [[1 1] "~"]) - [p=[p=1 q=2] q=[~ [p=~~~~ q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (sig [[1 1] "?~"]) - [p=[p=1 q=1] q=~] -++ soq - Parse ASCII character 39, soq. - Note the extra '\' in the slam of soq with just is to escape the first soq because soq denotes a crip. - --- - Produce the rule just slammed with '\'' - --- - ~tadbyl-hilbel/try=> (scan "'" soq) - ~~~27. - ~tadbyl-hilbel/try=> `cord`(scan "'" soq) - ''' - ~tadbyl-hilbel/try=> (soq [[1 1] "'"]) - [p=[p=1 q=2] q=[~ [p=~~~27. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (soq [[1 1] ">'"]) - [p=[p=1 q=1] q=~] -++ tar - Parse ASCII character 42, tar. - --- - Produce the rule just slammed with '*' - --- - ~tadbyl-hilbel/try=> (scan "*" tar) - ~~~2a. - ~tadbyl-hilbel/try=> `cord`(scan "*" tar) - '*' - ~tadbyl-hilbel/try=> (tar [[1 1] "*"]) - [p=[p=1 q=2] q=[~ [p=~~~2a. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (tar [[1 1] ".*"]) - [p=[p=1 q=1] q=~] -++ tec - Parse ASCII character 96, tec. - --- - Produce the rule just slammed with '`' - --- - ~tadbyl-hilbel/try=> (scan "`" tec) - ~~~6. - ~tadbyl-hilbel/try=> `cord`(scan "`" tec) - '`' - ~tadbyl-hilbel/try=> (tec [[1 1] "`"]) - [p=[p=1 q=2] q=[~ [p=~~~6. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (tec [[1 1] " `"]) - [p=[p=1 q=1] q=~] -++ tis - Parse ASCII character 61, tis. - --- - Produce the rule just slammed with '=' - --- - ~tadbyl-hilbel/try=> (scan "=" tis) - ~~~3d. - ~tadbyl-hilbel/try=> `cord`(scan "=" tis) - '=' - ~tadbyl-hilbel/try=> (tis [[1 1] "="]) - [p=[p=1 q=2] q=[~ [p=~~~3d. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (tis [[1 1] "|="]) - [p=[p=1 q=1] q=~] -++ wut - Parse ASCII character 63, wut. - --- - Produce the rule just slammed with '?' - --- - ~tadbyl-hilbel/try=> (scan "?" wut) - ~~~3f. - ~tadbyl-hilbel/try=> `cord`(scan "?" wut) - '?' - ~tadbyl-hilbel/try=> (wut [[1 1] "?"]) - [p=[p=1 q=2] q=[~ [p=~~~3f. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (wut [[1 1] ".?"]) - [p=[p=1 q=1] q=~] -++ zap - Parse ASCII character 33, zap. - --- - Produce the rule just slammed with '!' - --- - ~tadbyl-hilbel/try=> (scan "!" zap) - ~~~21. - ~tadbyl-hilbel/try=> `cord`(scan "!" zap) - '!' - ~tadbyl-hilbel/try=> (zap [[1 1] "!"]) - [p=[p=1 q=2] q=[~ [p=~~~21. q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (zap [[1 1] "?!"]) - [p=[p=1 q=1] q=~] - -section 2eG, parsing (whitespace) - -++ dog -++ doh - Parse - --- - Produce plug gonadified with dot and gay. - --- - -++ dun - Parse phep (--) to null (~). - --- - Produce cold slammed with: - null - plug gonadified with hep and hep, to parse phep. - --- - ~tadbyl-hilbel/try=> (scan "--" dun) - ~ - ~tadbyl-hilbel/try=> (dun [[1 1] "--"]) - [p=[p=1 q=3] q=[~ u=[p=~ q=[p=[p=1 q=3] q=""]]]] -++ duz - Parse stet (==) to null (~). - --- - Produce cold slammed with: - null - plug gonadified with tis and tis, to parse stet - --- - ~tadbyl-hilbel/try=> (scan "==" duz) - ~ - ~tadbyl-hilbel/try=> (duz [[1 1] "== |=..."]) - [p=[p=1 q=3] q=[~ u=[p=~ q=[p=[p=1 q=3] q=" |=..."]]]] -++ gah - - --- - Produce mask slammed with the tuple: - `@`10, the newline character - ' ', the ace character - null - --- - -++ gap - - --- - Produce cold slammed with: - null - Plug gonadified with: - gaq - star slammed with pose gonadified with vul and gah - --- -++ gaq - - --- - Produce pose gonadifed with: - just slammed with the newline character. - Plug gonadified with gah and pose gonadified with gah and vul. - vul - --- - -++ gay - - --- - Produce pose gonadified with: - gap, which - Slam of easy with null - --- - -++ vul - Parse comments and replace them with null. - Note that a comment must be ended with a newline character. - --- - Produce cold slammed with: Pair null and, - plug gonadified with col, col, and, - pose gonadified with: - shim slammed with 32 and 126 - shim slammed with 128 and 255 - just slammed with the newline operator. - (==) Terminates the pair. - --- - - -section 2eH, parsing (idioms) - -++ alf - Parse alphabetic characters, both upper and lowercase. - --- - Produce the rule of pose gonadified with low and hig. - --- - ~tadbyl-hilbel/try=> (scan "a" alf) - ~~a - ~tadbyl-hilbel/try=> (scan "A" alf) - ~~~41. - ~tadbyl-hilbel/try=> (scan "AaBbCc" (star alf)) - "AaBbCc" -++ aln - Parse alphanumeric characters - both alphabetic characters and numbers. - --- - Produce the rule of pose gonadified with low,hig, and nud. - --- - ~tadbyl-hilbel/try=> (scan "0" aln) - ~~0 - ~tadbyl-hilbel/try=> (scan "alf42" (star aln)) - "alf42" - ~tadbyl-hilbel/try=> (scan "0123456789abcdef" (star aln)) - "0123456789abcdef" -++ alp - Parse alphanumeric strings and hep, "-". - --- - Produce the rule pose gonadified with low, hig, nud, hep. - --- - ~tadbyl-hilbel/try=> (scan "7" alp) - ~~7 - ~tadbyl-hilbel/try=> (scan "s" alp) - ~~s - ~tadbyl-hilbel/try=> (scan "123abc-" (star alp)) - "123abc-" -++ bet - Parse the hep and lus axis syntax. - --- - Produce the rule pose gonadified with: - (cold 2 hep), which replaces parsed heps with 2s. - (cold 3 lus), which replaced parsed luses with 3s. - --- - ~tadbyl-hilbel/try=> (scan "-" bet) - 2 - ~tadbyl-hilbel/try=> (scan "+" bet) - 3 -++ bin - Parse a tape of binary (0s and 1s) and produce its atomic representation. - --- - Produce the slam of bass with 2 and the (most gon but), which produces - - --- - ~tadbyl-hilbel/try=> (scan "0000" bin) - 0 - ~tadbyl-hilbel/try=> (scan "0001" bin) - 1 - ~tadbyl-hilbel/try=> (scan "0010" bin) - 2 - ~tadbyl-hilbel/try=> (scan "100000001111" bin) - 2.063 -++ but - Parse a single binary digit. - --- - Produce rule cook slammed with a gate: - With sample atom `a` that results in the difference between `a` and '0' (48). - All slammed with the rule shim slammed with '0' and '1', to parse either of those characters. - --- - ~tadbyl-hilbel/try=> (scan "0" but) - 0 - ~tadbyl-hilbel/try=> (scan "1" but) - 1 - ~tadbyl-hilbel/try=> (scan "01" but) - ! {1 2} - ! 'syntax-error' - ! exit - ~tadbyl-hilbel/try=> (scan "01" (star but)) - ~[0 1] -++ cit - Parse a single octal digit. - --- - Produce rule cook slammed with a gate: - With sample atom `a` that results in the difference between `a` and '0' (48). - All slammed with the rule shim slammed with '0' and '7', to parse any number between 0 and 7. - --- - ~tadbyl-hilbel/try=> (scan "1" cit) - 1 - ~tadbyl-hilbel/try=> (scan "7" cit) - 7 - ~tadbyl-hilbel/try=> (scan "8" cit) - ! {1 1} - ! 'syntax-error' - ! exit - ~tadbyl-hilbel/try=> (scan "60" (star cit)) - ~[6 0] -++ dem - Parse a decimal number to an atom. - --- - Produce the slam of bass with 10 (The base number system) and (most gon dit), which produces - - --- - ~tadbyl-hilbel/try=> (scan "7" dem) - 7 - ~tadbyl-hilbel/try=> (scan "42" dem) - 42 - ~tadbyl-hilbel/try=> (scan "150000000" dem) - 150.000.000 - ~tadbyl-hilbel/try=> (scan "12456" dem) - 12.456 -++ dit - Parse a single decimal digit. - --- - Produce the rule cook slammed with a gate: - With sample atom `a` that results in the difference between `a` and '0' (48). - All slammed with the rule shim slammed with '0' and '9', to parse any number. - --- - ~tadbyl-hilbel/try=> (scan "7" dit) - 7 - ~tadbyl-hilbel/try=> (scan "42" (star dit)) - ~[4 2] - ~tadbyl-hilbel/try=> (scan "26000" (star dit)) - ~[2 6 0 0 0] -++ gul - Parse the axis gal and gar axis syntax. - --- - Produce the rule pose gonadified with: - (cold 2 gal), which replaces parsed gals with 2s. - (cold 3 gar), which replaced parsed gars with 3s. - --- - ~tadbyl-hilbel/try=> (scan "<" gul) - 2 - ~tadbyl-hilbel/try=> (scan ">" gul) - 3 -++ gon - Parse long numbers - Numbers which wrap around the shell with the line break characters bas and fas. - --- - Produce the rule pose gonadified with: - The rule plug gonadified with: - bas, gay, and fas, to succeed to parse a bas, fas, or a gap in text. - The rule (easy ~), to succeed to parse but produces null as the parsed text. - --- - ~tadbyl-hilbel/try=> (scan "\\/" gon) - [~~~5c. ~ ~~~2f.] - ~tadbyl-hilbel/try=> (gon [[1 1] "\\/"]) - [p=[p=1 q=3] q=[~ u=[p=[~~~5c. ~ ~~~2f.] q=[p=[p=1 q=3] q=""]]]] -++ hex - Parse any hexadecimal number to an atom. - --- - Produce bass slammed with 16 (The base number system) and (most gon hit), which produces the atom - - --- - ~tadbyl-hilbel/try=> (scan "a" hex) - 10 - ~tadbyl-hilbel/try=> (scan "A" hex) - 10 - ~tadbyl-hilbel/try=> (scan "2A" hex) - 42 - ~tadbyl-hilbel/try=> (scan "1ee7" hex) - 7.911 - ~tadbyl-hilbel/try=> (scan "1EE7" hex) - 7.911 -++ hig - Parse a single uppercase letter. - --- - Produce the slam of shim with the characters 'A' (65) and 'Z' (90), to parse any character between them, inclusive. - --- - ~tadbyl-hilbel/try=> (scan "G" hig) - ~~~47. - ~tadbyl-hilbel/try=> `cord`(scan "G" hig) - 'G' - ~tadbyl-hilbel/try=> (scan "ABCDEFGHIJKLMNOPQRSTUVWXYZ" (star hig)) - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - ~tadbyl-hilbel/try=> (hig [[1 1] "G"]) - [p=[p=1 q=2] q=[~ [p=~~~47. q=[p=[p=1 q=2] q=""]]]] -++ hit - Parse a hexadecimal digit. - --- - Pose gonadified with: - dit, parse a single decimnal digit. - Slam cook with: - Build dry %gold gate with sample char `a`. Produce the difference between `a` and 87. - The slam of shim with the characters 'a' (97) and 'z' (122), to parse any character between them, inclusive. - The slam of shim with the characters 'A' () and 'Z' (), to parse any character between them, inclusive. - Terminate the gonadification. - --- - ~tadbyl-hilbel/try=> (scan "a" hit) - 10 - ~tadbyl-hilbel/try=> (scan "A" hit) - 10 - ~tadbyl-hilbel/try=> (hit [[1 1] "a"]) - [p=[p=1 q=2] q=[~ [p=10 q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (scan "2A" (star hit)) - ~[2 10] -++ low - Parse a single lowercase letter. - --- - Produce the slam of shim with the characters 'a' (97) and 'z' (122), to parse any character between them, inclusive. - --- - ~tadbyl-hilbel/try=> (scan "g" low) - ~~g - ~tadbyl-hilbel/try=> `cord`(scan "g" low) - 'g' - ~tadbyl-hilbel/try=> (scan "abcdefghijklmnopqrstuvwxyz" (star low)) - "abcdefghijklmnopqrstuvwxyz" - ~tadbyl-hilbel/try=> (low [[1 1] "g"]) - [p=[p=1 q=2] q=[~ [p=~~g q=[p=[p=1 q=2] q=""]]]] -++ mes - Parse a hexbyte. - --- - Slam cook with: - Build dry %gold gate with sample atom `a`, atom `b`. Produce the sum of `a` multiplied by 16 and `b` - Plug gonadified with hit and hit, parse two consecutive hex digits. - --- - ~tadbyl-hilbel/try=> (scan "2A" mes) - 42 - ~tadbyl-hilbel/try=> (mes [[1 1] "2A"]) - [p=[p=1 q=3] q=[~ u=[p=42 q=[p=[p=1 q=3] q=""]]]] - ~tadbyl-hilbel/try=> (scan "42" mes) - 66 -++ nix - - --- - Slam boss with 256 - --- - -++ nud - Parse a numeric character - A number. - --- - Produce the slam of shim with the characters '0' (48) and '9' (57), to parse any character between them, inclusive. - --- - ~tadbyl-hilbel/try=> (scan "0" nud) - ~~0 - ~tadbyl-hilbel/try=> (scan "7" nud) - ~~7 - ~tadbyl-hilbel/try=> (nud [[1 1] "1"]) - [p=[p=1 q=2] q=[~ [p=~~1 q=[p=[p=1 q=2] q=""]]]] - ~tadbyl-hilbel/try=> (scan "0123456789" (star nud)) - "0123456789" -++ poy - Parse an escape character. - --- - Produce pfix gonadified with: - bas - pose gonadifided with: - bas - soq - mes, to parse a hexbyte. - --- - -++ qit - Parse an individual character to its cord atom representation. - --- - Produce pose gonadified with: - The slam of shim with 32 and 38, to parse any characters between them, inclusive. - The slam of shim with 40 and 91, to parse any characters between them, inclusive. - The slam of shim with 93 and 126, to parse any characters between them, inclusive. - The slam of shim with 128 and 255, to parse any characters between them, inclusive. - --- - ~tadbyl-hilbel/try=> (scan "%" qit) - 37 - ~tadbyl-hilbel/try=> (scan "0" qit) - 48 - ~tadbyl-hilbel/try=> (scan "E" qit) - 69 - ~tadbyl-hilbel/try=> (scan "a" qit) - 97 - ~tadbyl-hilbel/try=> (scan "cord" (star qit)) - ~[99 111 114 100] -++ qut - Parse - --- - Slam ifix with: - [soq soq] - boss slammed with 256 and (most gon qit) - --- - - -++ sym - - --- - - --- - -++ ven - - --- - - --- - -++ vit - Parse a text and produce its base 64 encoding - --- - Build list of falling rules to match on with ';~' and pose. - Encodes capital letters by - - --- - -section 2eI, parsing (external) - -++ rash - Parse a cord with a given rule and crash if the cord isn't entirely parsed. - --- - Build wet %gold gate with sample atom `naf`, rule `sab` - Produce the slam of scan with: - Trip slammed with `naf`, to turn `naf` into a tape. - The rule `sab` - --- - ~tadbyl-hilbel/try=> (rash 'I was the world in which I walked, and what I saw' (star (shim 0 200))) - "I was the world in which I walked, and what I saw" - ~tadbyl-hilbel/try=> (rash 'abc' (just 'a')) - ! {1 2} - ! 'syntax-error' - ! exit - ~tadbyl-hilbel/try=> (rash 'abc' (jest 'abc')) - 'abc' - `~tadbyl-hilbel/try=> (rash 'abc' (jest 'ab')) - ! {1 3} - ! 'syntax-error' - ! exit -++ rush - Parse a given with a given rule and produce null if the cord isn't entirely parsed. - --- - Build wet %gold gate with sample atom `naf`, rule `sab` - Produce the slam of scan with: - Trip slammed with `naf`, to turn `naf` into a tape. - The rule `sab` - --- - ~tadbyl-hilbel/try=> (rush 'I was the world in which I walked, and what I saw' (star (shim 0 200))) - [~ "I was the world in which I walked, and what I saw"] - ~tadbyl-hilbel/try=> (rush 'abc' (just 'a')) - ~ - ~tadbyl-hilbel/try=> (rush 'abc' (jest 'abc')) - [~ 'abc'] - ~tadbyl-hilbel/try=> (rush 'abc' (jest 'ac')) - ~ - ~tadbyl-hilbel/try=> (rush 'abc' (jest 'ab')) - ~ -++ rust - Parse a tape with a given rule and produce null if the tape isn't entirely parsed. - --- - Build wet %gold gate with sample tape `los`, rule `sab` - Push `vex` is the rule (full sab) slammed with the beginning of the `los` tape. - If: `q.vex`, the parsed result, is null, - Then: Produce null. - Else: Produce the unit with value 'p.u.q.vex', the parsed text. - --- - ~tadbyl-hilbel/try=> (rust "I was the world in which I walked, and what I saw" (star (shim 0 200))) - [~ "I was the world in which I walked, and what I saw"] - ~tadbyl-hilbel/try=> (rust "Or heard or felt came not but from myself;" (star (shim 0 200))) - [~ "Or heard or felt came not but from myself;"] - ~tadbyl-hilbel/try=> (rust "And there I found myself more truly and more strange." (jest 'And there I')) - ~ -++ scan - Parse a tape with a given rule and crash if the tape isn't entirely parsed. - --- - Build wet %gold gate with sample tape `los`, rule `sab` - Push `vex` is the rule (full sab) slammed with the beginning of the `los` tape. - If: `q.vex` is null, - Then: Add to the crash with message 'syntax-error''s trace: - show slammed with [%m '{%d %d}'], `p.p.vex`, `q.p.vex`, and null - Else: Produce the parsing output of `vex` - --- - ~tadbyl-hilbel/try=> (scan "I was the world in which I walked, and what I saw" (star (shim 0 200))) - "I was the world in which I walked, and what I saw" - ~tadbyl-hilbel/try=> (scan "Or heard or felt came not but from myself;" (star (shim 0 200))) - "Or heard or felt came not but from myself;" - ~tadbyl-hilbel/try=> (scan "And there I found myself more truly and more strange." (jest 'And there I')) - ! {1 12} - ! 'syntax-error' - ! exit - -section 2eJ, formatting (basic text) - -++ cass - Produce the case insensitive (all lowercase) cord of a tape. - --- - Build wet %gold gate with sample tape `vib` - Slam rap with: - 3, to rap by bytes - Slam turn with: - `vib` - Build dry %gold gate with sample atom `a`, - Unless: `a` is greater than or equal to 'A' or less than or equal to 'Z', - Then: Produce `a`, - Else: Produce the difference between `a` and 32. - --- - ~tadbyl-hilbel/try=> (cass "john doe") - 7.309.170.810.699.673.450 - ~tadbyl-hilbel/try=> `cord`(cass "john doe") - 'john doe' - ~tadbyl-hilbel/try=> (cass "abc, 123, !@#") - 2.792.832.775.110.938.439.066.079.945.313 - ~tadbyl-hilbel/try=> `cord`(cass "abc, 123, !@#") - 'abc, 123, !@#' -++ cuss - Turn all occurances of lowercase letters in any tape into uppercase letters, as a cord. - --- - Build dry %gold gate with sample tape `vib` - Yield cord - Slam rap with: - 3, to rap by bytes - Slam turn with: - `vib` - Build dry %gold gate with sample atom `a`, - Unless: `a` is greater than or equal to 'A' or less than or equal to 'Z', - Then: Produce `a`, - Else: Produce the difference between `a` and 32. - --- - ~tadbyl-hilbel/try=> (cuss "john doe") - 'JOHN DOE' - ~tadbyl-hilbel/try=> (cuss "abc ABC 123 !@#") - 'ABC ABC 123 !@#' - ~tadbyl-hilbel/try=> `@ud`(cuss "abc") - 4.407.873 - ~tadbyl-hilbel/try=> (cuss "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsQqRrVvWwXxYyZz") - 'AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSQQRRVVWWXXYYZZ' -++ crip - Produce the cord of a tape. - --- - Build dry %gold with sample tape `a` - Produce the rap of `a` by bytes, cast to a cord. - --- - ~tadbyl-hilbel/try=> (crip "john doe") - 'john doe' - ~tadbyl-hilbel/try=> (crip "abc 123 !@#") - 'abc 123 !@#' - ~tadbyl-hilbel/try=> `@ud`(crip "abc") - 6.513.249 -++ mesc -++ runt -++ sand -++ sane -++ trim -++ trip -++ teff -++ turf -++ tuba -++ tufa -++ tuft -++ wack -++ wick -++ woad -++ wood - -section 2eK, formatting (layout) - -++ re - ++ ram - ++ win - ++ din - ++ fit - ++ rig - ++ wig - -section 2eL, formatting (path) - -++ ab - ++ bix - ++ hif - ++ huf - ++ hyf - ++ pev - ++ pew - ++ piv - ++ piw - ++ qeb - ++ qex - ++ qib - ++ qix - ++ seb - ++ sed - ++ sev - ++ sew - ++ sex - ++ sib - ++ siq - ++ sid - ++ siv - ++ siw - ++ six - ++ sov - ++ sow - ++ sox - ++ ted - ++ tip - ++ tiq - ++ tid - ++ til - ++ urs - ++ urt - ++ voy - ++ vym - ++ vyn -++ ag - ++ ape - ++ bay - ++ bip - ++ dem - ++ dim - ++ dum - ++ fed - ++ hex - ++ lip - ++ qut - ++ sym - ++ tyq - ++ viz - ++ vum - ++ wiz -++ co - ++ rear - ++ rent - ++ rend - ++ a-co - ++ d-co - ++ r-co - ++ s-co - ++ v-co - ++ w-co - ++ x-co - ++ y-co - ++ z-co - ++ em-co - ++ ox-co - ++ ro-co -++ ne - ++ d - ++ x - ++ v - ++ w -++ mu - ++ zag - ++ zig - ++ zug -++ so - ++ bisk - ++ crub - ++ nuck - ++ nusk - ++ perd - ++ royl - ++ tash - ++ twid - ++ zust -++ scot -++ scow -++ slav -++ slaw -++ slay -++ smyt - -section 2eM, regular-expressions - -++ pars -++ nor -++ les -++ lep -++ alm -++ alb -++ mis -++ anns -++ mall -++ bets -++ ranc -++ flap -++ rang -++ chun -++ seac -++ sead -++ sade -++ seap -++ cape -++ lower -++ upper -++ digit -++ print -++ graph -++ blank -++ space -++ cntrl -++ alpha -++ alnum -++ punct -++ wordc -++ white -++ xdigi -++ chad -++ escd -++ escp -++ unid -++ proc -++ cont -++ abor -++ matc -++ chet -++ blak -++ deep -++ rexp -++ repg - -section 2eN, pseudo-cryptography - -++ un - ++ wre - ++ wre - ++ xaf - ++ xar - ++ zaf - ++ zar - ++ zyf - ++ zyr - -section 2eO, virtualization - -++ mack - Accpet a nock subject-formula cell. - Produce a unit result, treating 11 as a crash (i.e. pure nock). - --- - Creates a dry %gold gate accepting cell ['sub' 'fol']. - Its output is a unit (of a noun). - Let 'ton' be the result of minking the sample, with a sky that produces - ~ on any input, halting interpretation. - Unless ton has stem 0, produce the empty unit, otherwise produce one - containing ton's bulb. - --- - ~zod/try=> (mack [[1 2 3] [0 1]]) - [~ [1 2 3]] - ~zod/try=> (mack [41 4 0 1]) - [~ 42] - ~zod/try=> (mack [4 0 4]) - ~ - ~zod/try=> (mack [[[0 2] [1 3]] 4 4 4 4 0 5]) - [~ 6] - ~zod/try=> ;;((unit ,@tas) (mack [[1 %yes %no] 6 [0 2] [0 6] 0 7])) - [~ %no] -++ mink - XX - Description: - Bottom-level mock (virtual nock) interpreter. - Accepts a nock subject-formula cell, and an %iron gate which - accepts any noun and produces a unit, which is defined to be mock 11. - Produces a ++tone, which is the result of the virtualized computation. - --- - For clarity, a ++tone with stem %0 will be referred to as a "success", - one with stem %1 as a "block", and one with stem %2 as a "crash". - --- - Activate jet. - Creates a dry %gold gate accepting cell ['sub' 'fol'] and gate 'sky'. - Let 'tax' be a statically bunted list of term-noun pairs. (hint list) - Do (recursion point) produce a tone: - If fol is an atom - Produce a crash of fol. - Else if the head of fol is a cell - Let hed be the result of recurring with fol replaced by its head. - If hed is a crash - Yield it - Otherwise let 'tal' be the result of recurring with fol replaced - by its tail. - Switch on the type of tal by stem: - If tal is a success - If hed is a block produce hed. - Else (success) produce a success of a cell of the bulbs of hed - and tal. - If tal is a block - If hed is a success produce tal. - Else (block) produce a block of welding the bulbs of hed and tal. - Else (crash) produce tal - Otherwise (the head of fol is an atom) switch on fol, - by default producing a crash of tax. - If fol has stem 0 and an atom bulb we name 'b' - If b is 0 produce a crash of tax. - If b is 1 produce a success of sub. - If sub is an atom produce a crash of tax - Otherwise let 'now' be the cap of b, and 'lat' be the mas of b - Tail-recur with b replaced by lat, and sub replaced by: if now is 2, - its head, else its tail. - If fol has stem 1 and a bulb we name 'b' - Produce a success of b - If fol has stem 2 and a bulb whose head is a cell. - Let 'ben' be the result of recurring with fol replaced by its bulb. - Unless ben is a success, produce ben. - Else assert that ben contains a cell, and tail-recur with - sub and fol replaced by the head and tail of ben's bulb - If fol has stem 3 and a bulb we name 'b' - Let 'ben' be the result of recurring with fol replaced by b. - Unless ben is a success, produce ben. - Else produce a success of (loobean) whether ben contains a cell. - If fol has stem 4 and a bulb we name 'b' - Let 'ben' be the result of recurring with fol replaced by b. - Unless ben is a success, produce ben. - Else unless ben contains an atom produce a crash of tax. - Otherwise produce a success of ben's contents, incremented. - If fol has stem 5 and a bulb we name 'b' - Let 'ben' be the result of recurring with fol replaced by b. - Unless ben is a success, produce ben. - Else unless ben contains a cell produce a crash of tax. - Otherwise produce a success of (loobean) whether the bulb of ben has - a tail equal to its head. - If fol has stem 6, 7, 8, or 9 - Tail-recur with its bulb expanded per nock specification. - If fol has stem 10 and a cell bulb whose head is an atom - Tail-recur with for replaced by its bulb's tail - If fol has stem 10 and a bulb that can be destructured as [[b c] d] - Let ben be the result of recurring with fol replaced by v. - Unless ben is a success, produce ben. - If b is %hunk, %lose, %mean, or %spot - Tail-recur with fol replaced by d and tax prepended with a pair of - b and the bulb of ben. - Else tail-recur with just fol replaced by d. - Examples: - XX -++ mock - XX - Description: - Accepts a nock subject-formula cell and an %iron gate which - accepts any noun and produces a unit (this is used as nock 11). - Produces a ++toon, which is a sucesful, blocked, or crashed result. - --- - Compose ++mook and ++mink. - Examples - ~zod/try=> (mock [5 4 0 1] ,~) - [%0 p=6] - ~zod/try=> (mock [~ 11 1 0] |=(* `999)) - [%0 p=999] - ~zod/try=> (mock [~ 0 1.337] ,~) - [%2 p=~] - ~zod/try=> (mock [~ 11 1 1.337] ,~) - [%1 p=~[1.337]] - ~zod/try=> (mock [[[4 4 4 4 0 3] 10] 11 9 2 0 1] |=(* `[+<])) - [%0 p=14] - ~zod/try=> (mock [[[4 4 4 4 0 3] 10] 11 9 2 0 1] |=(* `[<+<>])) - [%0 p=[49 52 0]] - ~zod/try=> ;;(tape +:(mock [[[4 4 4 4 0 3] 10] 11 9 2 0 1] |=(* `[<+<>]))) - "14" - -++ mook - XX - Description: - Intelligently render crash annotation. - Accepts a ++tone, produces a ++toon - --- - Create a dry %gold gate accepting a tone we name 'ton' - Its output is a toon. - Unless the stem of ton is %2, produce ton. - Produce a frond with a stem of 2 and the following bulb: - Let yel be the length of ton's bulb. - Replace the bulb of ton, - If yel > 256 (otherwise keep it static) - With the weld of - its top 128 elements - And a list of term-noun pairs: - The last 128 elements of ton's bulb - Preceded by a %lose-stemmed frond of - A cord from the tape - "[skipped " - A @ud rendering of yel - 256 - " frames]" - Do (*recursion point*) produce a list of tanks: - For each element in the bulb of ton - Switch on its leaf, by default leaving the element out of the product - For each %hunk, clam it to a tank - For each %lose, produce a leaf with the element clammed to an atom - and tripped (to a tape). - For each %mean, if the elment is an atom treat it as a %lose - Otherwise let mac be the element macked by its tail. - If the computation fails, produce a "####" leaf, else clam - the result to a tank. - For each %spot, let sot be the element clammed to a spot. - Produce a leaf with - The weld of - The path in sot converted to a tank and then a tape - ":<[" - [[p.p ] ] in the pint in sot rendered as @ud - " " - [[ q.p] ] in the pint in sot rendered as @ud - "].[" - [ [p.q ]] in the pint in sot rendered as @ud - " " - [ [ q.p]] in the pint in sot rendered as @ud - "]>" - - Examples - ~zod/try=> (mook [%0 5 4 5 1]) - [%0 p=[5 4 5 1]] - ~zod/try=> (mook [%2 ~[[%hunk %rose ["<" "," ">"] ~[[%leaf "err"]]]]]) - [%2 p=~[[%rose p=[p="<" q="," r=">"] q=[i=[%leaf p="err"] t=~]]]] - ~zod/try=> (mook [%2 ~[[%malformed %elem] [%lose 'do print']]]) - [%2 p=~[[%leaf p="do print"]]] - ~zod/try=> (mook [%2 ~[[%spot /b/repl [[1 1] 1 2]] [%mean |.(!!)]]]) - [%2 p=~[[%leaf p="/b/repl/:<[1 1].[1 2]>"] [%leaf p="####"]]] -++ mang - XX - Description: - XX - --- - XX - Examples - XX -++ mong - XX - Comment: - XX - Description: - Mang is just like mack, but accepting a sky. - It produces a unit computation result. - --- - Creates a dry %gold gate accepting cell ['sub' 'fol'] and an - %iron unit-clam 'sky'. - Its output is a unit (of a noun). - Let 'ton' be the result of monging the sample. - Unless ton has stem 0, produce the empty unit, otherwise produce one - containing ton's bulb. -++ mung - XX - Description: - XX - --- - XX - Examples - XX -++ mule - XX - Description: - XX - --- - XX - Examples - XX -++ mute - XX - Description: - XX - --- - XX - Examples - XX - -section 2eP, diff **noted as "(move me)" in source** - -++ berk -++ diff -++ loss - ++ abet - ++ hink - ++ lonk - ++ lune - ++ merg - ++ main -++ locz -++ lore -++ role -++ lump -++ lure -++ limp -++ hump -++ husk -++ lurk -++ lusk - ++ abet - ++ done - ++ main -++ nude - ++ axes - ++ tred - -section 2eW, lite number theory - -++ egcd -++ pram -++ ramp -++ fo - ++ dif - ++ exp - ++ fra - ++ inv - ++ pro - ++ sit - ++ sum -++ ga - ++ dif - ++ dub - ++ pro - ++ toe - ++ sit - ++ fra - ++ inv - ++ pow - ++ pro - -section 2eX, jetted crypto - -++ aesc - ++ en - ++ de -++ ahem - ++ cipa - ++ co - ++ ix - ++ ro - ++ su - ++ pen - ++ co - ++ ix - ++ ro - ++ su - ++ pin - ++ co - ++ ix - ++ ro - ++ su - ++ mcol - ++ pode - ++ sube - ++ be - ++ ankh - ++ sark - ++ srow - ++ subs - ++ ex - ++ ix -++ curt - ++ cla - ++ sqr - ++ inv - ++ cad - ++ cub -++ ed - ++ norm - ++ xrec - ++ ward - ++ scam - ++ etch - ++ curv - ++ deco - ++ bb - ++ puck - ++ suck - ++ sign - ++ veri - -section 2eY, SHA-256 - -++ shad -++ shaf -++ shak -++ sham -++ shas -++ shax -++ shaw -++ og - ++ rad - ++ raw -++ shaz -++ shal -++ shan - -section 2eZ, OLD rendering - -++ show - ++ shep - ++ shop -++ at - ++ r - ++ rf - ++ rn - ++ rt - ++ rta - ++ rtam - ++ rub - ++ rud - ++ rum - ++ rup - ++ ruv - ++ rux - -chapter 2f, Hoon proper - -section 2fA, miscellaneous funs - -++ bull -++ cain -++ cell -++ core -++ cube -++ face -++ bean -++ flay -++ flee -++ foil -++ fork -++ cove -++ comb -++ cond -++ cons -++ fitz -++ flan -++ flip -++ flor -++ hike -++ hoax -++ hoof -++ jock -++ look -++ make -++ noah -++ onan -++ rain -++ ream -++ reck -++ seed -++ seem -++ seer -++ sell -++ pave -++ loot -++ slam -++ slim -++ slit -++ slym -++ slap -++ slop -++ skol -++ spat -++ spuc -++ spec -++ spud -++ slot -++ slum -++ stab -++ wash - -section 2fB, macro expansion - -++ ah - ++ blue - ++ gray - ++ puce -++ al - ++ blah - ++ home - ++ bunt - ++ clam - ++ cloq - ++ whip -++ ap - ++ etch - ++ feck - ++ hock - ++ open - ++ rake - ++ rusk - -section 2fC, compilation proper - -++ ut - ++ burn - ++ busk - ++ conk - ++ crop - ++ dext - ++ sint - ++ cool - ++ dank - ++ dart - ++ deal - ++ dial - ++ dish - ++ doge - ++ dole - ++ duck - ++ dune - ++ dunk - ++ fino - ++ fink - ++ finq - ++ fire - ++ firm - ++ fish - ++ fuse - ++ gain - ++ hang - ++ harp - ++ lose - ++ chip - ++ heal - ++ mint - ++ nice - ++ grow - ++ moot - ++ mull - ++ both - ++ nice - ++ grow - ++ bake - ++ meet - ++ nest - ++ cong - ++ cram - ++ dext - ++ sint - ++ park - ++ peek - ++ play - ++ reco - ++ repo - ++ rest - ++ seek - ++ seep - ++ sift - ++ snub - ++ tack - ++ tock - ++ wrap - -section 2fD, grammar - -++ vang -++ vast - ++ gash - ++ gasp - ++ glam - ++ hasp - ++ mota - ++ plex - ++ pray - ++ prey - ++ phax - ++ posh - ++ poof - ++ poon - ++ poor - ++ porc - ++ rump - ++ rood - ++ rupl - ++ sail - Templating language for rendering HTML web documents. - --- - Build dry %gold gate with sample bean `tol`. - Push bunt of bean `lin` onto the core below. - Build core, - --- - ++ ape - The apex node of - --- - Slam cook with: - The reverse of `amp` and the following gate: - Build dry %gold gate with sample tuna `tum`. Yield twig. - If: `tum` is [%e *], an element, - Then: Produce the twig of twig `p.tum` and sag slammed with `q.tum` - Else: Produce the sag slammed with `tum` and null, the twig of `tum` - --- - ++ amp - Entry point of the XML tree. Start parsing a template at `sem`. - Continue to parse with ++ba if in tall form and ++bat if in wide form. - --- - Gonadify pfix with: - sem, - If: tol, - Then: bam, - Else: bat - --- - ++ bam - Begin to parse the template in tall form. - --- - Slam knee with: - The bunt of tuna. - Build dry %gold trap which is cached (memoized) - Gonadify pose with: - Stag slammed with %f, pfix gonadified with: - (plus ace), 1 or whitespaces, - Cook slammed with rab, puv - Stag slammed with %e, pfix gonadified with: - `ag, - nal - Stag slammed with %e, hul, - Stag slammed with %f, nup, - Gonadify pfix with: - tis, - Stag slammed with %f, nol - Gonadify pfix with: - hep - Stag slammed with: - %a, - Gonadify pfix with gap, talL - Gonadify pfix with: - lus - Stag slammed with: - %b, - Gonadiffy pfix with gap, tall - Gonadify pfix with: - tar - Stag slammed with: - %c, - Gonadify pfix with gap, tall - Gonadify pfix with: - cen - Stag slammed with: - %d, - Gonadify pfix with gap, tall - Slam easy with [%f [%a [%smdq 10 ~]] ~] - --- - ++ bat - Begin to parse an entire template line in wide form. - --- - Slam knee with: - The bunt of tuna - Build dry %gold trap which is cached (memoized) - Gonadify pose with: - Stag slammed with %f, nup - Stag slammed with %f, ped - Stag slammed with: - %e, - Gonadify plug with hip, lif - Terminate pose gonadification. - --- - ++ bet - Begin to parse an inner line section in wide form. - --- - Slam knee with: - The bunt of tuna - Build dry %gold trap which is cached (memoized) - Gonadify pose with: - bat, - Gonadify pfix with: - hep - Stag slammed with %a, wide - Gonadify pfix with: - lus - Stag slammed with %b, wide - Gonadify pfix with: - tar - Stag slammed with %c, wide - Gonadify pfix with: - cen - Stag slammed with %d, wide - Terminate pose gonadification. - --- - ++ fry - Element or attribute name. - May contain '_', signifying ':', optionally followed by - class and/org id - --- - Slam cook with: - Build dry %gold gate with sample term `a`, unit term `b`: - If: `b` is null, - Then: Produce [%dtzz %tas a], - Else: Produce [[%dtzz %tas a] [%dtzz %tas u.b]] - Gonadify plug with: - sym, - Gonadify pose with: - Stag slammed with null, pfix gonadified with cab, sym. - Easy slammed with null. - ++ hag - Tag head - --- - Slam cook with: - Build dry %gold gate with sample twig `a` and produces `a`. - Gonadify plug with: - Stag slammed with: - %dtzz, - Stag slammed with: - %tas - Pose gonadified with: - Jest slammed with %script, - Jest slammed with %style, - Stag slammed with %clsg, jaw - Terminate plug gonadification. - ++ hig - Simple tag head. - --- - Slam cook with: - Build dry %gold gate with sample twig `a`, list of twigs `b`. Produce [a %clsg b]. - hog. - ++ hog - Tag head. - --- - Slam cook with: - Build dry %gold gate with sample tile: - twig `a` - unit term `b` - unit term `c` - unit twig `d` - list of twigs `e` - Terminate tile construction. - Yield pair of twig, list of twigs. - Set `e` to: If: `b` is null, - Then: Produce `e`, - Else: Produce [[[%dtzz %tas %class] [%smdq (trip u.b)]] e] - Set `e` to: If: `c` is null, - Then: Produce `e`, - Else: Produce [[[%dtzz %tas %id] [%smdq (trip u.c)]] e] - Set `e` to: If: `d` is null, - Then: Produce `e`, - Else: Produce [[[%dtzz %tas %href] u.d] e] - Produce pair [a e]. - Gonadify plug with: - fry, - Pose gonadified with: - Stag slammed with null, pfix gonadified with dot, sym - Easy slammed with null, - Pose gonadified with stag slammed with - Stag slammed with null, pfix gonadified with hax, sym - Easy slammed with null, - Pose gonadified with stag slammed with - Stag slammed with null, pfix gonadified with dot, stag slammed with %smdg, soil - Easy slammed with null, - Pose gonadified with: - ifix slammed with [pel per] and, - More slammed with plug gonadified with com, ace and, - Plug gonadified with fry, pfix gonadified with ace, wide - Easy slammed with null - Terminate pose gonadification. - Terminate plug gonadification. - ++ hoy - Tail attributes. - --- - Star slammed with: - pfix gonadified with: - plug gonadified with gap, tis - plug gonadified with fry, pfix gonadified with gap, tall - Terminate pfix gonadification. - ++ hul - Tall preface. - --- - Cook slammed with: - Build dry %gold gate with sample element tuna `a`, list twig `b`, list tuna `c`, - Yield [twig (list tuna)] element tuna. - Produce [[p.a %clsg (weld q.a b)] c] - Gonadify plug with hog, hoy, nol - ++ jaw - Wide attributes - --- - Gonadify pose with: - ifix slammed with [pel per] and, - More slammed with plug gonadified with com, ace, and, - plug gonadified fry, pfix gonadified with ace, wide - Easy slammed with null. - Terminate pose gonadification. - ++ lif - Wide elements. - --- - Slam cook with: - Build dry %gold gate with sample list of tuna `a` which produces `a` - Gonadify pose with: - pfix gonadied with col, pep - cold slammed with null, sem - easy slammed with null - --- - ++ luf - Wide elements. - --- - Slam cook with: - Build dry %gold gate with sample list of tuna `a` which produces `a` - Star slammed with: - Gonadify pfix with ace, bet. - --- - ++ nal - Unescaped tall tail. - --- - Slam cook with sample: - Build dry %gold gate with sample list of tuna `a` which produces `a`, - Slam ifix with: - Tile autoons gap and plug gonadified with gap, duz, - Slam most with: - gap, - Gonadify pfix with: - Gonadify pose with: - Gonadify pfix with: - ace, - Cook slammed with: - Build dry %gold gate with sample tape `a` which produces: - [%a %smdq (weld a `tape`[`@`10 ~])], - where (weld a `tape`[`@`10 ~] is the concatenation - of tape `a` with the newline character. - Star slammed with shim slamme with 32, 255. - Terminate pfix gonadification. - Terminate pose gonadification. - Terminate pfix gonadification. - - --- - ++ nol - Tall tail. - --- - Assert that tol is true, that we are parsing a tall form part of the template. - Slam cook with: - Build dry %gold gate with sample list of tuna `a` which produces `a`, - Gonadify pose with: - Slam cold with null, sem - pfix gonadified with col, pep called with tol replaced by false, to continue to parse in wide form. - pfix gonadified with: - Gonadify plug with col, ace. - Slam cook with rab called with tol replaced by false, to continue to parse in wide form, and puv. - ifix slammed with: - [gap :~(plug gap duz)], which disregards non-code before plug gonadifed with gap and duz. - Most slammed with gap, amp. - Temrinate pose gonadification. - --- - ++ nup - Wide quote. - --- - Slam cook with: - Build dry %gold gate with sample list of tuna `a` which produces `a` - Gonadify pose with: - Gonadify less with: - jest slammed with '"""'< - ifix slammed with: - [doq doq] - Cook slammed with rab, puv - inde slammed with: - ifix slammed with: - Jest slammed with '"""\0a' and jest slammed with '\0a"""', - Cook slammed with rab, puv called with `lin` tossed for false. - Terminate pose gonnadification. - --- - - ++ pab - Bracketed element. - --- - Slam ifix with [kel ker], plug gonadified with: - hig, to parse an uppercase letter followed by, - luf, to parse wide elements. - --- - - ++ ped - Wide flow. - --- - Slam cook with: - Dry %gold gate with sample list of tuna `a` which produces `a` - ifix slammed with [pel per], more slammed with ace, bet. - --- - - ++ pep - Wrapper tuna. - --- - Slam cook with: - Build dry %gold gate with sample list of tuna `a` which produces `a` - Gonadify pose with: - ped, - ifix slammed with: - [pel per], - More slammed with ace, bet - cook slammed with: - Build dry %gold gate with sample cord, - Which produces list of element [%a %smdg (trip +<)]. - qut - Gonadify plug with bat, easy slammed with null. - Terminate plug gonadification. - Terminate pose gonadification. - --- - - ++ puv - Wide/tall flow. Parse wide form interpolated Hoon code in any tag, - - --- - Slam cook with: - Build dry %gold with samlpe list of beets `a` which produces `a` - The slam of star with: - Gonadify pose with: - pfix gonadified with: - bas, - pose slammed with: - mask slammed with tape "-+*%;\{", - bas, doq, bix:ab. - pfix gonadified with hep, stag slammed with %a, sump - pfix gonadified with lus, stag slammed with %b, sump - pfix gonadified with tar, stag slammed with %c, sump - pfix gonadified with cen, stag slammed with %d, sump - pfix gonadified with sem, stag slammed with %e, - less gonadified with: - bas, kel, - If: tol, Then: fail, Else: doq - prn - If: lin, Then: fail, - Else: Gonadify less with: - Jest slammed with '\0a"""', - Just slammed with '\0a' - Stag slammed with %a, sump - Terminate pose gonadification. - --- - ++ rab - Beet to tuna. - --- - Build a dry %gold gate with sample list of beets, `reb` - Yield list of tuna. - Push bunt of [sim=(list ,@) tuz=(list tuna)] - Kick dry %gold trap. Yield list of tuna. - If: `reb` is null, - Then: Set `sim` to Unless: tol, Then: Produce sim, - Else: Produce [10 |-(?~(sim sim ?:(=(32 i.sim) $(sim t.tim) sim)))] - Else: If: The head of `reb` is an atom, - Then: Produce the toss `reb` for the tail of `reb`, `sim` for [i.reb sim] - Else: Push `zut` is the toss of `reb` for the tail of `reb`, `sim` for null - If: `sim` is null, Then: Produce [i.reb zut], - Else: Produce [[%a %smdq (flop sim)] i.reb zut] - ++ sag - Produce a twig from a tuna. - --- - Build dry %gold gate with sample list of tunas, `lut` - Yield twig. - Pair %cltr and, - Build dry %gold trap. Yield list of twigs. - If: `lut` is null, - Then: Produce [[%dtzz %n ~] ~], - Else: Switch on the head of the head of `lut`, - if %a, produce [[%clfs p.i.lut] $(lut, t.lut)], - if %b, produce [p.i.lut $(lut t.lut)] - if %c, produce the reverse cell of null and, - Triple %cndt, cast of [p.i.lut $(lut t.lut)] to a twig and, - Triple %tsbr, cast of [[%axil %noun] [%axil %noun]] to a tile and, - Pair %brcn and, - Yield a map of terms to feet, - Reverse cell of [~ ~] and, - Push `sug` is [[%& 12] ~] - Triple %$, %elm, and, - Quad %wtsg, `sug`, [%cnts `sug` [[[%& 1] ~] [~ 13]]] - if %d, produce [%cnhp] - if %e, produce - if %f, produce - where $(lut, t.lut) is the toss of `lut` for the tail of `lut`. - Terminate switch statement. - --- - ++ scat - ++ soil - ++ sump - ++ noil - ++ toad - ++ rung - ++ gunk - ++ muck - ++ butt - ++ loaf - ++ lobe - ++ exqa - ++ exqb - ++ exqc - ++ exqd - ++ exqe - ++ norm - ++ boog - ++ wisp - ++ toad - ++ rune - ++ glop - ++ gunk - ++ butt - ++ ulva - ++ hank - ++ loaf - ++ lobe - ++ mash - ++ muck - ++ teak - ++ race - ++ rack - ++ rick - ++ expa - ++ expb - ++ expc - ++ expd - ++ expe - ++ expf - ++ expg - ++ exph - ++ expi - ++ expj - ++ expk - ++ expm - ++ expn - ++ expo - ++ expp - ++ expq - ++ expr - ++ exps - ++ expt - ++ expu - ++ expv - ++ expw - ++ expx - ++ expy - ++ expz - ++ hina - ++ hinb - ++ hinc - ++ hind - ++ hine - ++ hinf - ++ hing - ++ bonk - ++ bont - ++ bony - ++ bonz - ++ lung - ++ long - ++ lobo - ++ loon - ++ lute - ++ rope - ++ tall - ++ wide - ++ hill - ++ howl - ++ toil - ++ wart -++ vest -++ vice - - diff --git a/urb/zod/main/doc/ref/splitDocs/volume3.txt b/urb/zod/main/doc/ref/splitDocs/volume3.txt deleted file mode 100644 index 80cfc9dfc..000000000 --- a/urb/zod/main/doc/ref/splitDocs/volume3.txt +++ /dev/null @@ -1,90 +0,0 @@ -volume 3, Arvo models and skeleton - -++ arch -++ bead -++ care -++ case -++ desk -++ cage -++ chop -++ curd -++ disk -++ duct -++ gene -++ glob -++ herd -++ hilt -++ hypo -++ khan -++ lens - ++ v - ++ w - ++ x - ++ y - ++ z -++ logo -++ lode -++ mark -++ mill -++ milt -++ monk -++ mold -++ muse -++ mosh -++ move -++ ovum -++ pane -++ pone -++ ship -++ sled -++ slut -++ vile -++ wire -++ slod -++ slub - -section 3bE, Arvo core - -++ vent - ++ ruck - ++ wink - ++ doze - ++ sike - ++ souk - ++ sunk - ++ song - ++ spuc - ++ sump - ++ said - ++ scry - ++ soar - ++ swim -++ vint -++ viol -++ is - ++ beck - ++ dink - ++ dint - ++ doos - ++ hurl - ++ race - ++ fire - ++ jack - ++ kick - -Postface - - ++ come - ++ keep - ++ load - ++ peek - ++ poke - ++ wish -++ come -++ keep -++ load -++ peek -++ poke -++ vega -++ veer -++ wish