on master help sign in
Merge pull request #327 from urbit/2018-era-draft

2018 era draft

commitd1efc798e6962954e0b64b7825bf6e36985c7737 authorAnthony Arroyo <anthony@tlon.io> dateSun 13 Jan 2019, 21:16 (8 years ago) parenta4404fab6d9da7
489 files changed+35309−19918
.gitmodules+3 docs.md−48 docs/about.md−11 docs/about/glossary.md−814 docs/about/objections.md−269 docs/about/overview.md−90 docs/about/source.md−48 docs/arvo.md−14 docs/arvo/basic.md−337 docs/arvo/generators.md−178 docs/arvo/internals/ford/commentary.md−2576 docs/arvo/internals/gall.md−133 docs/arvo/subject.md−105 docs/community.md−31 docs/hall.md−14 docs/hoon.md−13 docs/hoon/atom.md−17 docs/hoon/atom/knit.md−44 docs/hoon/atom/path.md−31 docs/hoon/atom/rock.md−37 docs/hoon/basic.md−234 docs/hoon/concepts.md−260 docs/hoon/demo.md−83 docs/hoon/examples.md−595 docs/hoon/exercises.md−18 docs/hoon/exercises/data-structures.md−62 docs/hoon/exercises/fizzbuzz.md−38 docs/hoon/exercises/life.md−121 docs/hoon/exercises/lists.md−40 docs/hoon/exercises/math.md−27 docs/hoon/library.md−9 docs/hoon/library/2f.md−422 docs/hoon/library/2k.md−343 docs/hoon/library/3b.md−6 docs/hoon/library/4i.md−6 docs/hoon/library/5a.md−6 docs/hoon/library/5b.md−6 docs/hoon/library/5c.md−6 docs/hoon/library/5d.md−6 docs/hoon/library/5e.md−6 docs/hoon/library/5g.md−5 docs/hoon/library/zuse.md−8 docs/hoon/limb.md−25 docs/hoon/limb/limb.md−81 docs/hoon/limb/wing.md−50 docs/hoon/mission.md−46 docs/hoon/reference.md−83 docs/hoon/rune.md−77 docs/hoon/rune/bar.md−27 docs/hoon/rune/bar/cab.md−72 docs/hoon/rune/bar/cen.md−42 docs/hoon/rune/bar/col.md−26 docs/hoon/rune/bar/dot.md−58 docs/hoon/rune/bar/hep.md−52 docs/hoon/rune/bar/ket.md−39 docs/hoon/rune/bar/sig.md−31 docs/hoon/rune/bar/tar.md−57 docs/hoon/rune/bar/tis.md−49 docs/hoon/rune/bar/wut.md−32 docs/hoon/rune/buc.md−53 docs/hoon/rune/buc/base.md−34 docs/hoon/rune/buc/cab.md−42 docs/hoon/rune/buc/cen.md−45 docs/hoon/rune/buc/col.md−45 docs/hoon/rune/buc/hep.md−35 docs/hoon/rune/buc/ket.md−41 docs/hoon/rune/buc/pat.md−43 docs/hoon/rune/buc/tis.md−41 docs/hoon/rune/buc/wut.md−49 docs/hoon/rune/cen.md−16 docs/hoon/rune/cen/cab.md−39 docs/hoon/rune/cen/dot.md−29 docs/hoon/rune/cen/hep.md−48 docs/hoon/rune/cen/ket.md−28 docs/hoon/rune/cen/lus.md−28 docs/hoon/rune/cen/sig.md−42 docs/hoon/rune/cen/tar.md−43 docs/hoon/rune/cen/tis.md−55 docs/hoon/rune/col.md−16 docs/hoon/rune/dot.md−14 docs/hoon/rune/dot/ket.md−22 docs/hoon/rune/dot/lus.md−34 docs/hoon/rune/dot/tar.md−41 docs/hoon/rune/dot/wut.md−27 docs/hoon/rune/ket.md−19 docs/hoon/rune/ket/lus.md−26 docs/hoon/rune/sem.md−13 docs/hoon/rune/sem/fas.md−21 docs/hoon/rune/sig.md−15 docs/hoon/rune/sig/pam.md−35 docs/hoon/rune/sig/tis.md−37 docs/hoon/rune/tis.md−35 docs/hoon/rune/tis/bar.md−36 docs/hoon/rune/tis/com.md−44 docs/hoon/rune/tis/dot.md−39 docs/hoon/rune/tis/fas.md−57 docs/hoon/rune/tis/gal.md−39 docs/hoon/rune/tis/gar.md−27 docs/hoon/rune/tis/hep.md−36 docs/hoon/rune/tis/ket.md−43 docs/hoon/rune/tis/lus.md−35 docs/hoon/rune/tis/sem.md−32 docs/hoon/rune/tis/tar.md−41 docs/hoon/rune/wut/col.md−59 docs/hoon/rune/wut/gal.md−31 docs/hoon/rune/wut/gar.md−30 docs/hoon/rune/wut/ket.md−39 docs/hoon/rune/wut/lus.md−57 docs/hoon/rune/wut/pat.md−33 docs/hoon/rune/wut/sig.md−34 docs/hoon/rune/wut/tis.md−43 docs/hoon/rune/zap.md−12 docs/hoon/rune/zap/gar.md−30 docs/hoon/rune/zap/tis.md−29 docs/hoon/syntax.md−391 docs/nock.md−12 docs/urbyte.md−12 docs/urbyte/0.md−284 docs/urbyte/1.md−365 docs/urbyte/2.md−504 docs/using.md−12 docs/using/filesystem.md−248 docs/using/install.md−398 docs/using/layout.md−140 docs/using/messaging.md−423 docs/using/setup.md−228 docs/using/shell.md−312 docs/using/web.md−312 docs/using/web/blog.md−95 docs/using/web/comments.md−43 docs/using/web/static.md−127 docs/vere/jetting.md−760 getting-started.udon+10 getting-started/.azimuth.udon.swp getting-started/azimuth.udon+8 getting-started/azimuth/managing.udon+6 getting-started/azimuth/using-bridge.udon+6 getting-started/installation.udon+414 getting-started/landscape.udon+9 getting-started/landscape/desktop.udon getting-started/landscape/mobile.udon introduction.udon+47 introduction/arvo-vs-azimuth.udon+30 introduction/community.udon+19 docs/about/contributing.md → introduction/contributing.udon+9−11 introduction/overview.udon+173 introduction/source.udon+89 learn.udon+10 learn/.arvo.udon.swp docs/arvo/internals.md → learn/arvo.udon+36−39 docs/using/admin.md → learn/arvo/admin.udon+76−40 docs/arvo/internals/ames.md → learn/arvo/ames.udon+9−7 docs/arvo/internals/ames/commentary.md → learn/arvo/ames/commentary.udon+182−11 docs/arvo/internals/behn.md → learn/arvo/behn.udon+9−7 docs/arvo/internals/clay.md → learn/arvo/clay.udon+9−7 docs/arvo/internals/clay/architecture.md → learn/arvo/clay/architecture.udon+12−8 docs/arvo/internals/clay/commentary.md → learn/arvo/clay/commentary.udon+206−22 docs/arvo/internals/dill.md → learn/arvo/dill.udon+9−7 docs/arvo/internals/eyre.md → learn/arvo/eyre.udon+9−7 docs/arvo/internals/eyre/commentary.md → learn/arvo/eyre/commentary.udon+13−16 docs/arvo/internals/eyre/specification.md → learn/arvo/eyre/specification.udon+149−81 learn/arvo/filesystem.udon+461 docs/arvo/internals/ford.md → learn/arvo/ford.udon+10−10 docs/arvo/internals/ford/runes.md → learn/arvo/ford/runes.udon+15−5 learn/arvo/gall.udon+17 docs/arvo/api.md → learn/arvo/gall/api.udon+126−143 learn/arvo/gall/generators.udon+172 docs/arvo/http.md → learn/arvo/gall/http.udon+46−61 docs/arvo/marks.md → learn/arvo/gall/marks.udon+30−33 docs/arvo/network.md → learn/arvo/gall/network.udon+158−164 docs/arvo/security-driver.md → learn/arvo/gall/security-driver.udon+46−67 docs/arvo/state.md → learn/arvo/gall/state.udon+74−75 docs/arvo/subscriptions.md → learn/arvo/gall/subscriptions.udon+197−212 docs/arvo/web-apps.md → learn/arvo/gall/web-apps.udon+62−73 learn/arvo/generators.udon+604 learn/arvo/hall.udon+17 docs/hall/architecture.md → learn/arvo/hall/architecture.udon+53−52 docs/hall/interface.md → learn/arvo/hall/interface.udon+28−31 docs/hall/new-gall.md → learn/arvo/hall/new-gall.udon+45−49 docs/hall/new-gall/example.md → learn/arvo/hall/new-gall/example.udon+7−7 docs/hall/new-gall/spec.md → learn/arvo/hall/new-gall/spec.udon+7−8 learn/arvo/layout.udon+177 learn/arvo/messaging.udon+684 learn/arvo/publishing.udon+448 learn/arvo/sail.udon+686 learn/arvo/shell.udon+433 learn/arvo/udon.udon+626 learn/arvo/udon/blog.udon+109 learn/arvo/udon/comments.udon+49 learn/arvo/udon/static.udon+142 learn/azimuth.udon+7 learn/azimuth/blockchain.udon+49 learn/azimuth/constitution.udon+7 learn/azimuth/wallet.udon+76 learn/hoon.udon+34 learn/hoon/hoon-ch1-1.udon+114 learn/hoon/hoon-ch1-2.udon+488 learn/hoon/hoon-ch1-3.udon+658 learn/hoon/hoon-ch1-4.udon+423 learn/hoon/hoon-ch1-5.udon+277 learn/hoon/hoon-ch1-6.udon+507 learn/hoon/hoon-ch2-1.udon+164 learn/hoon/hoon-ch2-10.udon+324 learn/hoon/hoon-ch2-11.udon+491 learn/hoon/hoon-ch2-2.udon+593 learn/hoon/hoon-ch2-3.udon+891 learn/hoon/hoon-ch2-4.udon+780 learn/hoon/hoon-ch2-5.udon+710 learn/hoon/hoon-ch2-6.udon+358 learn/hoon/hoon-ch2-7.udon+399 learn/hoon/hoon-ch2-8.udon+800 learn/hoon/hoon-ch2-9.udon+389 learn/hoon/hoon-ch3-1.udon+578 learn/nock.udon+14 docs/nock/definition.md → learn/nock/definition.udon+87−66 docs/nock/example.md → learn/nock/example.udon+8−7 docs/nock/explanation.md → learn/nock/explanation.udon+85−43 docs/nock/implementations.md → learn/nock/implementations.udon+78−33 docs/nock/implementations/c.md → learn/nock/implementations/c.udon+6−6 docs/nock/implementations/clojure.md → learn/nock/implementations/clojure.udon+6−6 docs/nock/implementations/csharp.md → learn/nock/implementations/csharp.udon+6−6 docs/nock/implementations/groovy.md → learn/nock/implementations/groovy.udon+6−6 docs/nock/implementations/haskell.md → learn/nock/implementations/haskell.udon+6−6 docs/nock/implementations/hoon.md → learn/nock/implementations/hoon.udon+6−5 docs/nock/implementations/javascript.md → learn/nock/implementations/javascript.udon+7−7 docs/nock/implementations/python.md → learn/nock/implementations/python.udon+6−6 docs/nock/implementations/ruby.md → learn/nock/implementations/ruby.udon+6−6 docs/nock/implementations/scala.md → learn/nock/implementations/scala.udon+32−30 docs/nock/implementations/scheme.md → learn/nock/implementations/scheme.udon+6−6 docs/nock/implementations/swift.md → learn/nock/implementations/swift.udon+7−7 docs/vere.md → learn/vere.udon+9−9 docs/vere/api.md → learn/vere/api.udon+123−69 docs/vere/c.md → learn/vere/c.udon+15−9 learn/vere/jetting.udon+777 docs/vere/nouns.md → learn/vere/nouns.udon+41−19 docs/vere/runtime.md → learn/vere/runtime.udon+6−6 readme.md+37−4 reference.udon+9 docs/hoon/cheat-sheet.md → reference/cheat-sheet.udon+12−10 reference/glossary.udon+916 reference/hoon-expressions.udon+6 docs/hoon/advanced.md → reference/hoon-expressions/advanced.udon+41−38 reference/hoon-expressions/basic.udon+180 docs/hoon/irregular.md → reference/hoon-expressions/irregular.udon+72−70 reference/hoon-expressions/limb.udon+19 reference/hoon-expressions/limb/limb.udon+74 reference/hoon-expressions/limb/wing.udon+47 reference/hoon-expressions/rune.udon+105 reference/hoon-expressions/rune/bar.udon+20 reference/hoon-expressions/rune/bar/cab.udon+96 reference/hoon-expressions/rune/bar/cen.udon+66 reference/hoon-expressions/rune/bar/col.udon+54 reference/hoon-expressions/rune/bar/dot.udon+74 reference/hoon-expressions/rune/bar/hep.udon+62 reference/hoon-expressions/rune/bar/ket.udon+65 reference/hoon-expressions/rune/bar/sig.udon+45 reference/hoon-expressions/rune/bar/tar.udon+72 reference/hoon-expressions/rune/bar/tis.udon+66 reference/hoon-expressions/rune/bar/vat.udon+39 reference/hoon-expressions/rune/bar/wut.udon+48 reference/hoon-expressions/rune/bus.udon+41 reference/hoon-expressions/rune/bus/base.udon+23 reference/hoon-expressions/rune/bus/cab.udon+42 reference/hoon-expressions/rune/bus/cen.udon+37 reference/hoon-expressions/rune/bus/col.udon+40 reference/hoon-expressions/rune/bus/hep.udon+34 reference/hoon-expressions/rune/bus/ket.udon+40 reference/hoon-expressions/rune/bus/sig.udon+69 reference/hoon-expressions/rune/bus/tis.udon+41 reference/hoon-expressions/rune/bus/vat.udon+43 reference/hoon-expressions/rune/bus/wut.udon+48 reference/hoon-expressions/rune/cen.udon+16 reference/hoon-expressions/rune/cen/cab.udon+69 reference/hoon-expressions/rune/cen/col.udon+60 reference/hoon-expressions/rune/cen/dot.udon+47 reference/hoon-expressions/rune/cen/hep.udon+55 reference/hoon-expressions/rune/cen/ket.udon+41 reference/hoon-expressions/rune/cen/lus.udon+43 reference/hoon-expressions/rune/cen/sig.udon+58 reference/hoon-expressions/rune/cen/tar.udon+69 reference/hoon-expressions/rune/cen/tis.udon+73 reference/hoon-expressions/rune/col.udon+14 docs/hoon/rune/col/cab.md → reference/hoon-expressions/rune/col/cab.udon+6−6 reference/hoon-expressions/rune/col/col.udon+25 docs/hoon/rune/col/hep.md → reference/hoon-expressions/rune/col/hep.udon+13−10 docs/hoon/rune/col/ket.md → reference/hoon-expressions/rune/col/ket.udon+12−11 docs/hoon/rune/col/lus.md → reference/hoon-expressions/rune/col/lus.udon+8−7 docs/hoon/rune/col/sig.md → reference/hoon-expressions/rune/col/sig.udon+8−5 docs/hoon/rune/col/tar.md → reference/hoon-expressions/rune/col/tar.udon+12−10 reference/hoon-expressions/rune/constants.udon+16 reference/hoon-expressions/rune/constants/cold.udon+41 reference/hoon-expressions/rune/constants/path.udon+35 reference/hoon-expressions/rune/constants/text.udon+54 docs/hoon/atom/sand.md → reference/hoon-expressions/rune/constants/warm.udon+28−9 reference/hoon-expressions/rune/dot.udon+14 reference/hoon-expressions/rune/dot/ket.udon+80 reference/hoon-expressions/rune/dot/lus.udon+36 reference/hoon-expressions/rune/dot/tar.udon+49 docs/hoon/rune/dot/tis.md → reference/hoon-expressions/rune/dot/tis.udon+23−15 reference/hoon-expressions/rune/dot/wut.udon+28 reference/hoon-expressions/rune/ket.udon+19 docs/hoon/rune/ket/bar.md → reference/hoon-expressions/rune/ket/bar.udon+7−7 reference/hoon-expressions/rune/ket/col.udon+42 reference/hoon-expressions/rune/ket/dot.udon+47 docs/hoon/rune/ket/hep.md → reference/hoon-expressions/rune/ket/hep.udon+14−10 reference/hoon-expressions/rune/ket/lus.udon+25 reference/hoon-expressions/rune/ket/pad.udon+59 docs/hoon/rune/ket/sig.md → reference/hoon-expressions/rune/ket/sig.udon+7−7 reference/hoon-expressions/rune/ket/tar.udon+57 docs/hoon/rune/ket/tis.md → reference/hoon-expressions/rune/ket/tis.udon+13−10 docs/hoon/rune/ket/wut.md → reference/hoon-expressions/rune/ket/wut.udon+8−7 reference/hoon-expressions/rune/lus.udon+18 reference/hoon-expressions/rune/lus/bar.udon+54 reference/hoon-expressions/rune/lus/bus.udon+44 reference/hoon-expressions/rune/lus/lus.udon+41 reference/hoon-expressions/rune/lus/tar.udon+47 reference/hoon-expressions/rune/mic.udon+14 docs/hoon/rune/sem/col.md → reference/hoon-expressions/rune/mic/col.udon+10−8 reference/hoon-expressions/rune/mic/lus.udon+65 docs/hoon/rune/sem/sem.md → reference/hoon-expressions/rune/mic/mic.udon+9−17 reference/hoon-expressions/rune/mic/net.udon+23 docs/hoon/rune/sem/sig.md → reference/hoon-expressions/rune/mic/sig.udon+11−12 reference/hoon-expressions/rune/mic/tar.udon+58 reference/hoon-expressions/rune/mic/tis.udon+53 reference/hoon-expressions/rune/sig.udon+14 docs/hoon/rune/sig/gar.md → reference/hoon-expressions/rune/sig/ban.udon+8−8 docs/hoon/rune/sig/bar.md → reference/hoon-expressions/rune/sig/bar.udon+7−7 docs/hoon/rune/sig/buc.md → reference/hoon-expressions/rune/sig/bus.udon+8−8 docs/hoon/rune/sig/cab.md → reference/hoon-expressions/rune/sig/cab.udon+7−7 docs/hoon/rune/sig/cen.md → reference/hoon-expressions/rune/sig/cen.udon+14−15 docs/hoon/rune/sig/gal.md → reference/hoon-expressions/rune/sig/led.udon+11−10 docs/hoon/rune/sig/lus.md → reference/hoon-expressions/rune/sig/lus.udon+7−7 docs/hoon/rune/sig/fas.md → reference/hoon-expressions/rune/sig/net.udon+9−9 reference/hoon-expressions/rune/sig/pad.udon+41 reference/hoon-expressions/rune/sig/tis.udon+38 docs/hoon/rune/sig/wut.md → reference/hoon-expressions/rune/sig/wut.udon+10−10 docs/hoon/rune/sig/zap.md → reference/hoon-expressions/rune/sig/zap.udon+8−8 reference/hoon-expressions/rune/terminators.udon+14 reference/hoon-expressions/rune/terminators/hephep.udon+35 reference/hoon-expressions/rune/terminators/tistis.udon+47 reference/hoon-expressions/rune/tis.udon+30 reference/hoon-expressions/rune/tis/ban.udon+28 reference/hoon-expressions/rune/tis/bar.udon+37 docs/hoon/rune/tis/col.md → reference/hoon-expressions/rune/tis/col.udon+11−7 reference/hoon-expressions/rune/tis/com.udon+41 reference/hoon-expressions/rune/tis/dot.udon+42 reference/hoon-expressions/rune/tis/hep.udon+35 reference/hoon-expressions/rune/tis/ket.udon+46 reference/hoon-expressions/rune/tis/led.udon+43 reference/hoon-expressions/rune/tis/lus.udon+37 reference/hoon-expressions/rune/tis/mic.udon+35 reference/hoon-expressions/rune/tis/net.udon+55 docs/hoon/rune/tis/sig.md → reference/hoon-expressions/rune/tis/sig.udon+16−11 reference/hoon-expressions/rune/tis/tar.udon+39 docs/hoon/rune/tis/wut.md → reference/hoon-expressions/rune/tis/wut.udon+7−7 docs/hoon/rune/wut.md → reference/hoon-expressions/rune/wut.udon+15−14 reference/hoon-expressions/rune/wut/ban.udon+44 docs/hoon/rune/wut/bar.md → reference/hoon-expressions/rune/wut/bar.udon+8−8 reference/hoon-expressions/rune/wut/col.udon+54 docs/hoon/rune/wut/dot.md → reference/hoon-expressions/rune/wut/dot.udon+10−9 docs/hoon/rune/wut/hep.md → reference/hoon-expressions/rune/wut/hep.udon+19−17 reference/hoon-expressions/rune/wut/ket.udon+39 reference/hoon-expressions/rune/wut/led.udon+44 reference/hoon-expressions/rune/wut/lus.udon+63 docs/hoon/rune/wut/pam.md → reference/hoon-expressions/rune/wut/pad.udon+8−8 reference/hoon-expressions/rune/wut/sig.udon+33 reference/hoon-expressions/rune/wut/tis.udon+42 reference/hoon-expressions/rune/wut/vat.udon+38 docs/hoon/rune/wut/zap.md → reference/hoon-expressions/rune/wut/zap.udon+8−8 reference/hoon-expressions/rune/zap.udon+12 reference/hoon-expressions/rune/zap/ban.udon+36 reference/hoon-expressions/rune/zap/col.udon+38 reference/hoon-expressions/rune/zap/dot.udon+50 reference/hoon-expressions/rune/zap/tis.udon+47 docs/hoon/rune/zap/wut.md → reference/hoon-expressions/rune/zap/wut.udon+11−9 docs/hoon/rune/zap/zap.md → reference/hoon-expressions/rune/zap/zap.udon+7−7 reference/library.udon+7 docs/hoon/library/1a.md → reference/library/1a.udon+109−74 docs/hoon/library/1b.md → reference/library/1b.udon+42−27 docs/hoon/library/1c.md → reference/library/1c.udon+86−48 docs/hoon/library/2a.md → reference/library/2a.udon+146−150 docs/hoon/library/2b.md → reference/library/2b.udon+164−92 docs/hoon/library/2c.md → reference/library/2c.udon+143−68 docs/hoon/library/2d.md → reference/library/2d.udon+51−23 docs/hoon/library/2e.md → reference/library/2e.udon+34−20 reference/library/2f.udon+858 docs/hoon/library/2g.md → reference/library/2g.udon+19−10 docs/hoon/library/2h.md → reference/library/2h.udon+106−56 docs/hoon/library/2i.md → reference/library/2i.udon+146−62 docs/hoon/library/2j.md → reference/library/2j.udon+85−34 reference/library/2k.udon+403 docs/hoon/library/2l.md → reference/library/2l.udon+32−14 docs/hoon/library/2m.md → reference/library/2m.udon+59−22 docs/hoon/library/2n.md → reference/library/2n.udon+84−41 docs/hoon/library/2o.md → reference/library/2o.udon+42−25 docs/hoon/library/2p.md → reference/library/2p.udon+33−17 docs/hoon/library/2q.md → reference/library/2q.udon+94−61 docs/hoon/library/3a.md → reference/library/3a.udon+129−46 reference/library/3b.udon+5832 docs/hoon/library/3c.md → reference/library/3c.udon+109−53 docs/hoon/library/3d.md → reference/library/3d.udon+89−34 docs/hoon/library/3e.md → reference/library/3e.udon+6−4 docs/hoon/library/3f.md → reference/library/3f.udon+96−37 docs/hoon/library/3g.md → reference/library/3g.udon+91−53 docs/hoon/library/4a.md → reference/library/4a.udon+36−13 docs/hoon/library/4b.md → reference/library/4b.udon+248−230 docs/hoon/library/4c.md → reference/library/4c.udon+69−63 docs/hoon/library/4d.md → reference/library/4d.udon+16−9 docs/hoon/library/4e.md → reference/library/4e.udon+117−105 docs/hoon/library/4f.md → reference/library/4f.udon+289−268 docs/hoon/library/4g.md → reference/library/4g.udon+55−47 docs/hoon/library/4h.md → reference/library/4h.udon+332−245 reference/library/4i.udon+10 docs/hoon/library/4j.md → reference/library/4j.udon+461−457 docs/hoon/library/4k.md → reference/library/4k.udon+322−263 docs/hoon/library/4l.md → reference/library/4l.udon+96−87 docs/hoon/library/4m.md → reference/library/4m.udon+102−109 docs/hoon/library/4n.md → reference/library/4n.udon+71−79 docs/hoon/library/4o.md → reference/library/4o.udon+439−163 reference/library/5a.udon+10 reference/library/5b.udon+10 reference/library/5c.udon+10 reference/library/5d.udon+11 reference/library/5e.udon+11 docs/hoon/library/5f.md → reference/library/5f.udon+55−51 reference/library/5g.udon+11 reference/library/zuse.udon+13 docs/hoon/library/zuse/core/crua.md → reference/library/zuse/core/crua.udon docs/hoon/library/zuse/core/epur.md → reference/library/zuse/core/epur.udon docs/hoon/library/zuse/core/fu.md → reference/library/zuse/core/fu.udon docs/hoon/library/zuse/core/jo.md → reference/library/zuse/core/jo.udon docs/hoon/library/zuse/core/poja.md → reference/library/zuse/core/poja.udon docs/hoon/library/zuse/core/poxa.md → reference/library/zuse/core/poxa.udon docs/hoon/library/zuse/core/poxo.md → reference/library/zuse/core/poxo.udon docs/hoon/library/zuse/core/yu.md → reference/library/zuse/core/yu.udon docs/hoon/library/zuse/diff.md → reference/library/zuse/diff.udon docs/hoon/library/zuse/gate/clan.md → reference/library/zuse/gate/clan.udon docs/hoon/library/zuse/gate/dawn.md → reference/library/zuse/gate/dawn.udon docs/hoon/library/zuse/gate/daws.md → reference/library/zuse/gate/daws.udon docs/hoon/library/zuse/gate/deal.md → reference/library/zuse/gate/deal.udon docs/hoon/library/zuse/gate/deft.md → reference/library/zuse/gate/deft.udon docs/hoon/library/zuse/gate/dust.md → reference/library/zuse/gate/dust.udon docs/hoon/library/zuse/gate/earl.md → reference/library/zuse/gate/earl.udon docs/hoon/library/zuse/gate/earn.md → reference/library/zuse/gate/earn.udon docs/hoon/library/zuse/gate/fain.md → reference/library/zuse/gate/fain.udon docs/hoon/library/zuse/gate/feel.md → reference/library/zuse/gate/feel.udon docs/hoon/library/zuse/gate/file.md → reference/library/zuse/gate/file.udon docs/hoon/library/zuse/gate/foal.md → reference/library/zuse/gate/foal.udon docs/hoon/library/zuse/gate/fray.md → reference/library/zuse/gate/fray.udon docs/hoon/library/zuse/gate/fuel.md → reference/library/zuse/gate/fuel.udon docs/hoon/library/zuse/gate/furl.md → reference/library/zuse/gate/furl.udon docs/hoon/library/zuse/gate/glam.md → reference/library/zuse/gate/glam.udon docs/hoon/library/zuse/gate/glon.md → reference/library/zuse/gate/glon.udon docs/hoon/library/zuse/gate/gnom.md → reference/library/zuse/gate/gnom.udon docs/hoon/library/zuse/gate/jape.md → reference/library/zuse/gate/jape.udon docs/hoon/library/zuse/gate/jesc.md → reference/library/zuse/gate/jesc.udon docs/hoon/library/zuse/gate/joba.md → reference/library/zuse/gate/joba.udon docs/hoon/library/zuse/gate/jobe.md → reference/library/zuse/gate/jobe.udon docs/hoon/library/zuse/gate/jone.md → reference/library/zuse/gate/jone.udon docs/hoon/library/zuse/gate/lead.md → reference/library/zuse/gate/lead.udon docs/hoon/library/zuse/gate/mang.md → reference/library/zuse/gate/mang.udon docs/hoon/library/zuse/gate/meat.md → reference/library/zuse/gate/meat.udon docs/hoon/library/zuse/gate/moon.md → reference/library/zuse/gate/moon.udon docs/hoon/library/zuse/gate/mung.md → reference/library/zuse/gate/mung.udon docs/hoon/library/zuse/gate/perk.md → reference/library/zuse/gate/perk.udon docs/hoon/library/zuse/gate/pojo.md → reference/library/zuse/gate/pojo.udon docs/hoon/library/zuse/gate/saxo.md → reference/library/zuse/gate/saxo.udon docs/hoon/library/zuse/gate/scanf.md → reference/library/zuse/gate/scanf.udon docs/hoon/library/zuse/gate/sein.md → reference/library/zuse/gate/sein.udon docs/hoon/library/zuse/gate/sifo.md → reference/library/zuse/gate/sifo.udon docs/hoon/library/zuse/gate/stud.md → reference/library/zuse/gate/stud.udon docs/hoon/library/zuse/gate/taco.md → reference/library/zuse/gate/taco.udon docs/hoon/library/zuse/gate/tact.md → reference/library/zuse/gate/tact.udon docs/hoon/library/zuse/gate/tame.md → reference/library/zuse/gate/tame.udon docs/hoon/library/zuse/gate/tell.md → reference/library/zuse/gate/tell.udon docs/hoon/library/zuse/gate/tome.md → reference/library/zuse/gate/tome.udon docs/hoon/library/zuse/gate/tope.md → reference/library/zuse/gate/tope.udon docs/hoon/library/zuse/gate/txml.md → reference/library/zuse/gate/txml.udon docs/hoon/library/zuse/gate/unt.md → reference/library/zuse/gate/unt.udon docs/hoon/library/zuse/gate/urld.md → reference/library/zuse/gate/urld.udon docs/hoon/library/zuse/gate/urle.md → reference/library/zuse/gate/urle.udon docs/hoon/library/zuse/mold/udal.md → reference/library/zuse/mold/udal.udon docs/hoon/library/zuse/mold/udon.md → reference/library/zuse/mold/udon.udon docs/hoon/library/zuse/mold/umph.md → reference/library/zuse/mold/umph.udon docs/hoon/library/zuse/mold/unce.md → reference/library/zuse/mold/unce.udon docs/hoon/library/zuse/mold/upas.md → reference/library/zuse/mold/upas.udon docs/hoon/library/zuse/mold/urge.md → reference/library/zuse/mold/urge.udon docs/hoon/library/zuse/rsa.md → reference/library/zuse/rsa.udon docs/hoon/troubleshooting.md → reference/troubleshooting.udon+12−13
.gitmodulesnew file+3
@@ -0,0 +1,3 @@
1+[submodule "docs/learn/hoon/workbook"]
2+ path = docs/learn/hoon/workbook
3+ url = git@github.com:urbit/hoon-workbook.git
docs.mddeleted−48
@@ -1,48 +0,0 @@
1−---
2−anchor: none
3−footer: true
4−title: Docs
5−sort: 4
6−---
7−
8−<div class="lead">
9− <div class="logo inverse"></div>
10− <h1 class="i-b">Urbit docs</h1>
11−</div>
12−
13−<div class="col-md-12 head">
14−
15−<div class="col-md-8">
16−
17−**Urbit** is a secure peer-to-peer network of personal servers, built on a clean-slate system software stack.
18−
19−Check out the [technical overview](about/overview) for a high-level
20−architecture description. To install and run Urbit, head to the Using section, starting with the [installation guide](using/install) and continuing forward.
21−
22−To begin developing for Urbit, start by walking through [Urbytes](urbyte/0). After that, delve into Hoon [syntax](hoon/syntax) directly, then walk through the [Arvo tutorials](arvo). The examples and exercises in Arvo will teach you to build high-level programs and interact with the network.
23−
24−Dig into the mechanics of Urbit with [Core Hoon](hoon). Refer back
25−there for pure-code exercises and functions in the [standard library](hoon/library).
26−
27−Anyone obsessed with math, theory, fundamentals of computation,
28−etc, should start with the [Nock definition](nock/definition) and work upward from there.
29−
30−</div>
31−
32−<div class="col-md-4">
33−
34−<b>Community & contact</b>
35−<ul>
36−<li>Chat with us on <a href="https://urbit.org/stream">Talk</a></li>
37−<li>Our discussion forum <a href="http://urbit.org/fora">Fora</a></li>
38−<li>On Twitter <a href="https://twitter.com/urbit">@urbit</a></li>
39−<li>Or email us at <a href="mailto:urbit@urbit.org">urbit@urbit.org</a></li>
40−</ul>
41−
42−</div>
43−
44−</div>
45−
46−<div class="sections">
47− <kids grid="true"></kids>
48−</div>
docs/about.mddeleted−11
@@ -1,11 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 2
4−title: About
5−---
6−
7−# About
8−
9−Learn more about the Urbit project here before delving deeper into the developer documentation.
10−
11−<list/>
docs/about/glossary.mddeleted−814
@@ -1,814 +0,0 @@
1−---
2−navhome: /docs/
3−navuptwo: true
4−sort: 5
5−title: Glossary
6−---
7−
8−# Glossary
9−
10−Urbit is renowned for its exotic terminology. Here's a simple overview
11−from the strange words within.
12−
13−As Dijkstra put it: "The purpose of abstraction is not to be vague, but
14−to create a new semantic level in which one can be absolutely precise."
15−
16−### application
17−
18−Also known as an “app,” an *application* is a Hoon program that can hold state.
19−
20−### arm
21−
22−An *arm* is a named, functionally-computed attribute of a [core](#-core).
23−
24−The [hoon](#-a-hoon) of each arm is compiled to a Nock formula, with the
25−enclosing [core](#-core) itself as the subject.
26−
27−There are two kinds of arms: *dry* and *wet*. Most arms are
28−dry.
29−
30−- ##### dry:
31−
32− normal, `++`, polymorphic by means of *variance*
33−
34− For a dry arm, we ask: is the new payload compatible with the old
35− payload (against which the core was compiled)?
36−
37−- ##### wet:
38−
39− unusual, `+-`, polymorphic by means of *genericity*
40−
41− A wet arm uses the hoon as a macro. We create a new type analysis
42− path, which works as if we expanded the callee with the caller's
43− context.
44−
45−*See [advanced types](../../hoon/advanced/)*.
46−
47−
48−### Arvo
49−
50−The Urbit operating system and kernel. Arvo's state is a pure function of its
51−event log, and it serves as the Urbit event manager. It contains vanes, which are
52−kernel modules that perform essential system operations. Arvo itself can only
53−deal with one file at a time. For more, it relies on Ford, the build-system
54−vane.
55−
56−Arvo being purely functional means that the it is a function that is:
57−
58−> (state, event) → (state, effects).
59−
60−Arvo coordinates and reloads vanes. It can be thought of as a traffic-director.
61−Any vane needs to go through Arvo before reaching another vane. Events and
62−their effects happen like so:
63−
64−> Unix event → vere (the virtual machine that runs Urbit) → Arvo → vane → Arvo
65−
66−Arvo is located in `/home/sys/arvo.hoon` within your urbit.
67−
68−More in-depth information on Arvo can be found
69−[`here`](https://urbit.org/docs/arvo/internals/).
70−
71−Below are Arvo modules, which are called "vanes".
72−
73−- #### Ames
74−
75−The networking vane. Ames handles all things UDP. Here live the protocols for
76−discovering and interacting with other urbits. It’s also the name for the Urbit
77−network itself. All communication is signed and encrypted.
78−
79−Ames is located in `/home/sys/vane/ames.hoon` within your urbit.
80−
81−More in-depth information on Ames can be found
82−[`here`](https://urbit.org/docs/arvo/internals/ames/commentary/).
83−
84−- #### Behn
85−
86−The timing vane. Behn allows for applications to schedule events, which are
87−managed in a simple priority queue. For example, Clay, the Urbit filesystem,
88−uses Behn to keep track of time-specific file requests. Eyre, the Urbit web
89−vane, uses Behn for timing-out HTTP sessions.
90−
91−Behn is located in `/home/sys/vane/behn.hoon` within your urbit.
92−
93−- #### Clay
94−
95−The filesystem and typed revision-control vane. Think of Clay as a
96−continuously synced git. It handles file-change events and maps them from Urbit
97−to Unix and vice versa.
98−
99−A common way to use it is to create a pier, a directory that exists in and is
100−visible in Unix. Changes are automatically recorded from Urbit to the Unix
101−directory, and vice versa. Just set it and forget it!
102−
103−Clay is located at `/home/sys/vane/clay.hoon` within your urbit.
104−
105−Basic information on using Clay can be found
106−[`here`](https://urbit.org/docs/using/filesystem/). An in-depth explanation
107−of the architecture can be found
108−[`here`](https://urbit.org/docs/arvo/internals/clay/architecture/).
109−
110−- #### Dill
111−
112−The terminal-driver vane. You run your urbit in your Unix terminal, and
113−Unix sends every event -- such as a keystroke or a change in the dimensions of
114−the terminal window -- to be handled by Dill. Dill acts as an intermediary for
115−anything that uses keyboard events. This is why there’s some input lag in
116−Urbit’s command-line interface. (Optimization will come later!)
117−
118−A keyboard event's journey from Unix to Dojo, the Urbit shell, can be imagined
119− as diagrammed below:
120−
121−> Keystroke in Unix terminal -> Vere (virtual machine) -> Arvo -> Dill ->
122−> the Dojo
123−
124−Dill is located at `/home/sys/vane/clay.hoon` within your urbit.
125−
126−More in-depth information on Eyre can be found
127−[`here`](https://urbit.org/docs/arvo/internals/dill/).
128−
129−- #### Eyre
130−
131−The web-server vane. Anything HTTP-related lives here. Unix sends HTTP messages
132−though to Eyre, and Eyre produces HTTP messages in response.
133−
134−In general, apps and vanes do not call Eyre; rather, Eyre calls apps and vanes.
135−Eyre uses Ford and Gall to functionally publish pages and facilitate
136−communication with apps.
137−
138−Eyre is located at `/home/sys/vane/eyre.hoon` within your urbit.
139−
140−More in-depth information on Eyre can be found
141−[`here`](https://urbit.org/docs/using/web/).
142−
143−- #### Ford
144−
145−The build-system vane. Ford is capable of sequencing generic asynchronous
146−computations. Its uses include linking source files into programs, assembling
147−live-updating websites, and performing file-type conversions.
148−
149−Ford neither accepts Unix events nor produces Unix effects. It exists
150−entirely for the benefit of Urbit applications and other vanes, in particular
151−Gall.
152−
153−Ford is located at `/home/sys/vane/ford.hoon` within your urbit.
154−
155−More in-depth information on Ford can be found
156−[`here`](https://urbit.org/docs/arvo/internals/ford/).
157−
158−- #### Gall
159−
160−The application-management vane. Userspace apps -- daemons, really -- are
161−started, stopped, and sandboxed by Gall. Gall provides developers with a
162−consistent interface for hooking their app up to the operating system. It allows
163−applications and other vanes to send messages to applications and subscribe to
164−data streams. Messages coming into Gall are routed to the intended application,
165−and the response comes back along the same route. If the intended target is on
166−another ship, Gall will route it, behind the scenes, through Ames to the other
167−ship.
168−
169−Gall is located at `/home/sys/vane/gall.hoon` within your urbit.
170−
171−More in-depth information on Ford can be found
172−[`here`](https://urbit.org/docs/arvo/internals/gall/).
173−
174−### atom
175−
176−An atom is any natural number, including zero. The atom is the most basic data
177−type in [Nock](#-nock) and [Hoon](#-hoon). A Hoon atom type describes a Nock
178−atom with two additional pieces of metadata: an [*aura*](#-aura), and an
179−optional constant.
180−
181−An atom type is *warm* or *cold* based on whether the constant exists.
182−
183−- ##### warm:
184− if the constant is `~` (null), any atom is in the type.
185−- ##### cold:
186− if the constant is `[~ atom]`, its only legal value is `atom`.
187−
188−*See [basic types](../../hoon/basic/#-atom-p-term-q-unit-atom)*
189−
190−### Aura
191−
192−An aura a soft atom type. They appear as strings beginning with `@`. Auras
193−represent the structure of an atom, print format, or other semantics. Its
194−constraints on the value of an atom aren't enforced in any way.
195−
196−You can cast something to an aura, like a decimal, and get back its hexademical.
197−For example:
198−
199− > =a `@`29
200− > ^- @ux a
201− 0x1d
202−
203−Auras are an advisory type system. You can go up or down, but not sideways in
204−the hierarchy. `@t` and `@` can each be cast to the other, but @t can’t be cast
205−to `@u`, for example, without first being cast to the empty aura `@`.
206−
207−For example
208−
209− > ^- @ 'c' :: 'c' is of the aura @t
210− 99
211−
212− > ^- @u 'c'
213− ! exit
214−
215−Here is a non-exhaustive list of auras:
216−
217−```
218−Aura Meaning Example Literal Syntax
219−-------------------------------------------------------------------------
220−@d date
221− @da absolute date ~2018.5.14..22.31.46..1435
222−@n nil ~
223−@p phonemic string (ship name) ~sorreg-namtyv
224−@r IEEE floating-point
225− @rd double precision (64 bits) .~6.02214085774e23
226− @rh half precision (16 bits) .~~3.14
227−@s signed integer, sign-bit low
228− @sb signed binary --0b11.1000
229− @sd signed decimal --1.000.056
230− @sx signed hexadecimal -0x5f5.e138
231−@t UTF-8 text (cord) 'howdy'
232− @ta ASCII text (knot) ~.howdy
233− @tas ASCII text symbol (term) %howdy
234−@u unsigned integer
235− @ub unsigned binary 0b11.1000
236− @ud unsigned decimal 1.000.056
237− @ux unsigned hexadecimal 0x5f5.e138
238−```
239−
240−You can find the list of all auras [here](../../hoon/atom/sand/).
241−
242−### blocksize
243−
244−Blocksize is the power-of-two bitwidth of an atom. So, an atom with a blocksize
245−of `3` has a bitwidth of `2^3`, which is 8. A bitwidth of 8, in turn, can
246−represent `2^8` values, or 256.
247−
248−### cast
249−
250−To cast is to put a Hoon expression through the compiler’s type-checker to test
251−whether the expression is guaranteed to evaluate to a product that falls within
252−the desired type. If the expression is not guaranteed to behave in this way,
253−then the compiler will halt with a nest-fail crash. Proper Hoon code will
254−include a cast for the product type of each gate.
255−
256−The cast rune is `^-` (pronounced "ket-hep"). So, to cast to a list of atoms,
257−we write `^- (list @)`. The irregular form of that expression is ``(list @)``.
258−
259−### cell
260−
261−In Nock and Hoon, a *cell* is an ordered pair of [nouns](#-noun).
262−
263−Syntax: `[a b]`.
264−
265−Cells orient to the right; for example, the noun [2 6 14 15] is short for
266−[2 [6 [14 15]]].
267−
268−
269−### clam
270−
271−A clam is the use of a structure as a gate. Usually used to verify marks from
272−other urbits.
273−
274− > ((list @t) [97 98 ~])
275− <|a b|>
276−
277−### cord
278−
279−In Hoon, `cord` is an aura for representing atoms as strings. UTF-8,
280−least-significant bit first. Represented as the aura `@t`.
281−
282− > `@t`478.560.413.032
283− 'hello'
284−
285−#### core
286−
287−A *core* is a [cell](#-nock-cell) of `[code data]`, where we call the
288−code head the *battery* and the data tail the *payload*. All code-data
289−structures in normal languages (functions, objects, modules, etc.)
290−translate to cores in Hoon.
291−
292−- ##### battery
293− The code-containing head of a core.
294−
295−- ##### payload
296− The data-containing tail of a core.
297−
298−*See [basic types](../../hoon/basic)*.
299−
300−### Dojo
301−
302−The Dojo is the Urbit shell; the command line where you run programs,
303−expressions, and system commands. It’s a CLI that is encountered right when
304−an urbit is started for the first time. It is somewhat analogous to Bash, the
305−Unix terminal, and more analogous to a Hoon REPL.
306−
307−You’ll notice that many things can’t be written here; this is normal. The Dojo
308−enforces syntactical correctness right at the command line. Strings that can’t
309−be continued into a valid expression are automatically trimmed back to something
310− that can be. Some syntactically invalid expressions can be completed, but the
311−Dojo will prevent them from being entered as a command. You can play around
312−with this functionality learn what syntax is kosher.
313−
314−
315−### duct
316−
317−A duct is an Arvo-level call stack. At the beginning of every duct is a Unix
318−event, such as a keystroke, network packet, timer event, or file change.
319−
320−A duct is a `list` of `wire`s. A wire is itself a `list` of `knot`s. A `knot`
321−is, in turn, a knot.
322−
323−### face
324−
325−A *face* is the Hoon analog to what is a variable name in most other
326−programming languages. Faces are metadata labels for legs, allowing us to
327−address parts. Because there is no metadata in Nock, faces cannot exist in Nock.
328−
329− > a=2
330− a=2
331−
332−In the above example, `a` is the face and `2` is the value.
333−
334−Hoon has no scope or symbol-table; there is only the subject. To "declare" a
335−"variable" is to construct a new subject: `[name=value old-subject]`.
336−
337−*See [advanced types](../../hoon/advanced/#-face-aliases-and-bridges)*.
338−
339−
340−### flag
341−
342−A `flag` is Hoon's version of a boolean. `0` (`%.y`) is *yes*, `1` (`%.n`) is
343−*no*.
344−
345−> Why? It's fresh, it's different, it's new. And it's annoying. And it
346−> keeps you on your toes. And it's also just intuitively right.
347−
348−### gate
349−
350−A *gate* is a [core](#-core) with one [arm](#-arm) -- Hoon's closest
351−analog to a function. To call a gate on an argument, replace the sample
352−(at [tree address](../../hoon/limb/limb/) `+6`
353−in the core) with the argument, and then compute the arm.
354−
355−The payload of a gate has a shape of `[sample context]`.
356−
357−- ##### sample
358− The argument tuple.
359−- ##### context
360− The subject in which the gate was defined.
361−
362−*See [basic types](../../hoon/basic/#-core-p-type-q-map-term-type),
363−[`%-` ("cenhep")](../../hoon/rune/cen/hep/) (the
364−[rune](#-rune) for calling a `gate`).*
365−
366−### generator
367−
368−A *generator* is like a limited Hoon script: it’s a shell command that produces
369−a value before disappearing. Generators take an input [noun](#-noun) (a value)
370−and produce an output `noun` by performing calculations on its arguments,
371−prompting for input, or making HTTP requests.
372−
373−You need a `bar` rune like `|=` in your generator, because a generator is
374−essentially a function that you’re calling.
375−
376−Generators, unlike [apps](#-application), hold no state. They are pure,
377−stateless functions, and they cannot send [moves](#-move). Because of this,
378−generators are have a more narrow use than apps. Among the non-trivial uses of
379−a a generator is moving data into apps -- they’re the backbone of Urbit’s
380−information pipeline.
381−
382−Generators are run from the `/gen` directory of your current desk. For example,
383−to run a generator named whatever.hoon, you would type `> +whatever` in the
384−[Dojo](../dojo).
385−
386−### glyph
387−
388−A *glyph* is a single, non-alphanumeric ASCII character. Each glyph has its own
389−monosyllabic name, which allows the efficient communication of Hoon-related
390−information in speech. [`Runes`](#-rune) are composed of two glyphs.
391−Below is a complete list of glyphs with their associated pronunciations.
392−
393−```
394−ace [1 space] hep - rob }
395−ban > ket ^ say '
396−bar | lac [ sig ~
397−bat \ led < tar *
398−bus $ lit ( tec `
399−cab _ lob { tis =
400−cen % lus + vat @
401−col : mic ; wut ?
402−com , net / yel "
403−dot . pad & zap !
404−gap [>1 space, nl] rac ]
405−hax # rit )
406−```
407−
408−### Hall
409−
410−*Hall* is the Urbit communication back-end. It’s a messaging bus that can work
411−with clients of all sorts. [`:talk`](#-talk), the built-in chat client, is one
412−such app that uses Hall.
413−
414−*More information on Hall can be found [here](../hall).*
415−
416−- #### circle
417−
418− A circle is the “audience” of your messages -- who can receive them. It can be
419− thought of as a chat channel, but this is a little too narrow. More
420− specifically, it’s a named collection of messages created by and hosted on a
421− ship’s Hall, usually represented as `~ship-name/circle-name`. On Talk,
422− Urbit’s built-in chat front-end, the first circle that you will likely
423− encounter is `/urbit-meta`.
424−
425−### Hood
426−
427−*Hood* orchestrates many of the Urbit initialization systems necessary
428−for boot.
429−
430−### Hoon
431−
432−Hoon is a strict, higher-order typed functional language that compiles itself
433−to Nock.
434−
435−The Hoon source file is located in `/home/sys/hoon.hoon` within your urbit.
436−
437−*More information can be found in the [hoon](../../hoon) section.*
438−
439−- #### Mint
440−
441− *Mint* is the Hoon compiler function. Mint takes the subject type and the
442− expression source (a [hoon](#-a-hoon), for example) and produces the product
443− type and nock formula. So [type hoon] is mapped to [type nock].
444−
445−### <a id="-a-hoon">hoon</a>
446−
447−A *hoon* (lowercase) is the result of parsing a Hoon source expression into an
448−AST node. These AST nodes are nouns, like all other Hoon data. Because every
449−Hoon program is, in its entirety, a single expression of Hoon, the result of
450−parsing the whole thing into an AST is a single `hoon`.
451−
452−A hoon is a tagged union of the form `[%tag data]`, where the tag
453−is a constant such as `%brts` (from the source [rune](#-rune) `|=`,
454−i.e. "bartis"), and is matched up with the appropriate type of data
455−(often more `hoon`s, from source subexpressions). For example, the
456−expression `:-(2 17)`, once parsed into an AST, becomes the following:
457−
458−```
459−[%clhp p=[%sand p=%ud q=2] q=[%sand p=%ud q=17]]
460−```
461−
462−The `%clhp` is produced from the rune `:-` (i.e. "colhep"). The 2 and
463−17 have each been parsed as `%sand`-tagged hoons, which represent
464−atoms (in this case each with an aura of `%ud`, i.e. unsigned
465−decimal).
466−
467−To parse Hoon source into a hoon AST, use `ream` on a `cord`
468−containing Hoon source. Try the following in [Dojo](../../using/shell):
469−
470−```
471−(ream ':+(12 7 %a)')
472−```
473−
474−The result should be:
475−
476−```
477−[%clls p=[%sand p=%ud q=12] q=[%sand p=%ud q=7] r=[%rock p=%tas q=97]]
478−```
479−
480−See [expression reference](../../hoon/reference/) for the
481−full of hoons.
482−
483−### irregular form
484−
485−Irregular forms are alternative ways of writing Hoon expressions, alternatives
486−to the digraphic runes such as `:~`. Irregular forms are usually more compact
487−than regular forms.=
488−
489−*See [irregular forms](../../hoon/irregular).*
490−
491−### jet
492−
493−A *jet* is a piece of C code that have equivalent products to a piece of Hoon or
494− Nock code. They are used for performance reasons; jets are meant to be faster
495−than the code that they are substituting for.
496−
497−Jets are necessary for mathematics, performance-wise, because Nock handles it
498−so inefficiently. Nock, for example, can’t decrement (reduce a number by one)
499−except by starting building a loop that starts from zero and increments to a
500−number just below.
501−
502−*See [API overview](../../vere/api).*
503−
504−### lark
505−
506−A lark is an expression that returns a [limb](#-limb) at the specified
507−address in a cell. Using `-` by itself returns the head of the subject, and
508−using `+` by itself returns the tail:
509−
510−```
511−> -:[[4 5] [6 [14 15]]]
512−[4 5]
513−
514−> +:[[4 5] [6 [14 15]]]
515−[6 14 15]
516−```
517−
518−You can combine `+` or `-` with either of `>` or `<` to get a more specific limb
519−of the subject. `-<` returns the head of the head; `->` returns the tail of the
520−head; `+<` returns the head of the tail; and `+>` returns the tail of the tail.
521−By alternating the `+`/`-` symbols with `<`/`>` symbols, you can go as deep as
522−you desire.
523−
524−```
525−> +>-:[[4 5] [6 [14 15]]]
526−14
527−
528−> +>+:[[4 5] [6 [14 15]]]
529−15
530−```
531−
532−### limb
533−
534−A *limb* is an attribute or variable reference. A limb is an [arm](#-arm) or a
535−[leg](#-leg).
536−
537−To resolve a *limb* named "foo", the subject is searched depth-first,
538−head-first for either a face named "foo" or a core with an arm of
539−"foo". If a face is found, the result is a leg, if a core is
540−found, the result is the product of the arm.
541−
542−- ##### leg
543− a subexpression, or subtree of the
544− [subject](#nock-subject).
545−-
546−- ##### wing
547− a search path into the subject, composed of
548− limbs. Search occurs from right to left (`a.b` means `b` within `a`).
549−
550−*See [Limbs and wings](../../hoon/limb/)*
551−
552−### move
553−
554−A move is the [Arvo](#-arvo) equivalent of a syscall.
555−
556−### noun
557−
558−In [Nock](#-nock) and [Hoon](#-hoon), a *noun* is an atom or a cell.
559−
560−
561−### Nock
562−
563−Nock is Nock is a Turing-complete, non-lambda combinator interpreter. It's
564−Urbit's low-level programming language. Nock is functional and typeless.
565−
566−- <h5 id="-nock-noun">noun:</h5> an *atom* or a *cell*.
567−- <h5 id="-nock-atom">atom:</h5> any natural number, including zero.
568−- <h5 id="-nock-cell">cell:</h5> any ordered pair of nouns.
569−- <h5 id="-nock-subject">subject:</h5> a noun - the data against which a
570− *formula* is evaluated.
571−- <h5 id="-nock-formula">formula:</h5> a noun - a function at the Nock level.
572−- <h5 id="-nock-product">product:</h5> a noun - the result of evaluating a
573− formula against a subject.
574−
575−*See the [Nock definition](../../nock/definition/).*
576−
577−
578−#### mark
579−
580−A *mark* is Urbit's version of a MIME type, if a MIME type was an
581−executable specification. The mark is just a label that's used as a path
582−to a local source file in the Arvo filesystem. This source file defines
583−a core that can mold untrusted data, diff and patch, convert to other
584−marks, etc.
585−
586−If this sounds like magic, it isn't quite magic. There's no way
587−for different urbits to make sure they mean the same thing by the
588−same mark. However, when incompatibility happens, marks ensure
589−that we at least handle the situation in a predictable way.
590−
591−#### metal
592−
593−Every core has a *metal* which defines its variance model (ie, the
594−properties of the type of a compatible core). The default is `gold`
595−(invariant).
596−
597−- `gold`: *invariant*
598−- `lead`: *bivariant*
599−- `zinc`: *covariant*
600−- `iron`: *contravariant*
601−
602−*See [advanced types](../../hoon/advanced)*.
603−
604−### ship
605−
606−An Urbit *ship* is: a cryptographic title on a *will* signed by private key; a
607−human-memorable name; and a packet-routing address. Ships are classed by the
608−number of bits in their address:
609−
610− Size Name Parent Object Example
611− ----- ------ ------ ------ -------
612− 2^8 galaxy ~ supernode ~zod
613− 2^16 star galaxy supernode ~dozbud
614− 2^32 planet star user ~tasfyn-partyv
615− 2^64 moon planet device ~sigsam-nimbot-tasfyn-partyv
616− 2^128 comet ~ bot ~racmus-mollen-fallyt-linpex--watres-sibbur-modlux-rinmex
617−
618−Any ship can be called an *urbit*. The lowercase "u" distinguishes it from Urbit
619− the software stack and Urbit the network.
620−
621−> You can find a longer-form summary here:
622−> [`urbit.org/posts/address-space/`](https://urbit.org/posts/address-space/).
623−
624−An Urbit identity is a string like `~firbyr-napbes`. It means nothing,
625−but it's easy to remember and say out loud. `~firbyr-napbes` is actually
626−just a 32-bit number (`3.237.967.392`, to be exact), like an IP address,
627−that we turn into a human-memorable string. The full name of this string
628−can be viewed by typing `our` in the Dojo, Urbit's shell. This is useful
629−when running a ship with a longer name, such as a *moon* or a *comet*.
630−
631−Technically, an urbit is a secure digital identity that you own and
632−control with a cryptographic key, like a Bitcoin wallet. As in Bitcoin,
633−the supply of urbits is mathematically limited. This keeps the network
634−friendly, by making spam and abuse expensive.
635−
636−An urbit name is just a number; smaller numbers make shorter names.
637−Shorter names are easier to remember, so they're more valuable. So
638−urbits are classified by the number of bits in their name. (A ship name
639−is just a scrambled base-256 representation of the number.)
640−
641−A 32-bit urbit (like `~firbyr-napbes`) is called a *planet.* A 16-bit
642−urbit (like `~pollev)` is a *star.* An 8-bit ship (like `~mun`) is a
643−*galaxy.* A planet is an identity for an independent, adult human. Stars
644−and galaxies are network infrastructure.
645−
646−Each planet or star is launched by its *parent,* the star or galaxy
647−whose number is its bottom half. So the planet `~firbyr-napbes`,
648−`0xdead.beef` or `3.735.928.559`, is the child of `~pollev`, `0xbeef` or
649−`48.879`, whose parent is `~mun`, `0xef`, `239`. The galaxy at the address of
650−`0` is `~zod`.
651−
652−
653− - #### pier
654−
655− A ship's *pier* is its Unix directory. For planets, the name of the pier is
656− usually the planet name.
657−
658−
659−
660−### structure
661−
662−A *structure* is an idempotent [gate](#-gate) (function) that constructs and
663−validates types in Hoon.
664−
665−An example: Arvo [marks](#-marks) use Hoon's type system via structures to
666−validate untrusted network data.
667−
668−Here's some common structure terminology:
669−
670−- #### bunt:
671−
672− A bunt is the default value of a [structure](#-structure). It's also a verb;
673− to *bunt* a structure is to produce the bunt of that structure. For example,
674− bunting `@` results in `0`, and bunting `@t` results in `''`. Bunting is
675− performed with `*` followed by the structure in question:
676− ~~~
677− > *@
678− 0
679− > *@t
680− ''
681− ~~~
682−
683−- #### icon: The type of the mold's range.
684−
685−*See [mold hoons](../../hoon/rune/buc/).*
686−
687−
688−#### rune
689−
690−A Hoon _rune_ is a pair of ASCII symbols used to begin a
691−[Hoon expression](#-a-hoon).
692−
693−For example, the rune [`?:`](../../hoon/rune/wut/col/) is
694−Hoon's most common conditional, a branch on a boolean test. The first
695−symbol in a rune represents a family of related runes. For example, the
696−[`?` family](../../hoon/rune/wut/) are all conditionals.
697−
698−The result of parsing a Hoon source expression&mdash;the rune, followed
699−by its respective children&mdash;into an AST node is simply called
700−a [`hoon`](#-a-hoon).
701−
702−Runes have two syntactic forms, *tall* and *flat*:
703−
704−- ##### tall:
705− multiple lines, no parentheses, two or more spaces between tokens
706−
707− Example:
708−
709− ```
710− ~zod:dojo> %+ add 2 2
711− 4
712− ```
713−- ##### flat:
714− one line, parentheses, one space between tokens
715−
716− Example:
717−
718− ```
719− ~zod:dojo> %+(add 2 2) :: regular flat form
720− 4
721−
722− ~zod:dojo> (add 2 2) :: irregular flat form
723− 4
724− ```
725−
726−Tall hoons can contain flat hoons, but not vice versa. All irregular
727−forms are flat.
728−
729−*See [hoon concept](../../hoon/concepts/#-hoon),
730−[expressions](../../hoon/rune/), and [syntax](../../hoon/syntax/)*.
731−
732−### Sail
733−
734−*Sail* is the Hoon markup language for XML.
735−
736−### scry
737−
738−To *scry* means to request data from the Arvo namespace and bring it
739−to userspace.
740−
741−*See [.^ (dot-ket)](../../hoon/rune/dot/ket/).*
742−
743−### slot
744−
745−`slot` is the name for Hoon's tree-addressing scheme.
746−
747−Every cell has a head and a tail, each of which may be either an atom or
748−a cell. Therefore every noun is a binary tree. `+1` or `.` resolves to
749−the whole cell (technically this would work against an atom as well).
750−The head of `+n` is `+2n`, the tail is `+(2n+1)`.
751−
752−`+7` is a special address for gates, because the position is defined
753−(by convention) as the context of a gate and of all cores.
754−
755−### Talk
756−
757−*Talk* is Urbit's built-in chat app. It’s one example of an app that can be
758−built on top of Hall, the Urbit back-end messaging system.
759−
760−*See [Messaging](../using/messaging). for more information.*
761−
762−### type
763−
764−A Hoon *type* defines a set (finite or infinite) of nouns and ascribes
765−some semantics to it. There is no direct syntax for defining
766−types; they are always defined by inference (i.e., by
767−[`mint`](#-mint)), usually using a constructor ([`mold`](#-mold)).
768−
769−All types are assembled out of base types defined in `++type`.
770−(Look up `++ type` in hoon.hoon for examples.) When the compiler
771−does type-inference on a program, it assembles complex types out
772−of the simpler built-in types.
773−
774−- #### nest
775−
776− `nest` is an internal Hoon function on two types which performs a type
777− compatibility test. `nest` produces yes if the
778− set of nouns in the second type is provably a subset of the first.
779− If `nest` produces no, the Hoon programmer will receive a `nest-fail`
780− error. This is one of the most commons errors in Hoon programming.
781−
782− *See [advanced types](../../hoon/advanced/)*.
783− *See [troubleshooting](../../hoon/troubleshooting/#-nest-fail)*.
784−
785−
786−### Unit
787−
788−Hoon's equivalent of a nullable pointer or a Haskell Maybe. If `q` is `~`,
789−null, the type is *warm*; any atom is in the type. If `q` is `[~ x]`, where
790−`x` is any atom, the type is *cold*; its only legal value is the constant `x`.
791−
792−### Vane
793−
794−A *vane* is an [Arvo](#-arvo) module. Each Vane is a single file because Arvo
795−cannot, on its own, deal with programs that are split between multiple files.
796−Some vanes can do this, however.
797−
798−### Vere (pronounced “vair”)
799−
800−The runtime system, written in C, that implements [Nock](#-nock). All
801−It’s written in C. Vere-level errors are prepended with as `bail:`.
802−
803−Vere is a virtual machine: it pretends to be hardware, and is the single point
804−of contact between your Urbit and the rest of your system. But more than that,
805−Vere handles the Urbit event log and handles jets. It’s also contains the i/o
806−drivers for Urbit’s vanes, responsible for generating events from Unix and
807−applying effects to Unix.
808−
809−### Zuse
810−
811−*Zuse* is a defined interface for vanes. It contains the part of the Hoon
812−standard library that is specific to Arvo functionality.
813−
814−Arvo is located in `/home/sys/zuse.hoon` within your urbit.
docs/about/objections.mddeleted−269
@@ -1,269 +0,0 @@
1−---
2−navhome: /docs/
3−navuptwo: true
4−next: true
5−sort: 2
6−title: Common objections
7−---
8−
9−# Common objections to Urbit
10−
11−"We choose to go to the moon, not because it is easy, but because it is hard." -- John F. Kennedy
12−
13−We're strong believers in crowdsourced criticism. We've heard a lot of great objections from all kinds of directions. Surely there's more out there -- if you think of a reason Urbit can't work, and it's not listed here, please add it in a comment at the bottom, post it somewhere and send us a link, etc, etc.
14−
15−## Urbit is a total scamcoin. It's 100% premined.
16−
17−Like a cryptocurrency, Urbit is a digital title. But Urbit is digital land, not digital money. If you assess it as a currency, it's a lousy currency. If you assess a cat as a dog, it's a lousy dog.
18−
19−In real-world economics, the crucial distinction between land and money is that land (a) has intrinsic utility and (b) is non-fungible.
20−
21−Because of (b) alone, frictionless transactions in land are impossible. A blockchain is only needed to ensure zero-cost high-frequency transactions. So digital land doesn't need a blockchain. Which means it doesn't need mining.
22−
23−Of course, just because a digital title system doesn't need mining, doesn't mean it can't distribute an initial allocation by proof-of-work -- or by any other arbitrary method which is careful not to benefit the system's own developers. Could we give away the Urbit address space randomly? Sure. But why?
24−
25−Probably the purest design is the "proof-of-burn" initial allocation used by some coins. By any standard, proof-of-burn is technically beautiful and results in an extraordinary level of ethical independence. We can't help but admire it.
26−
27−But any altcoin or metacoin is just way less work than Urbit. An altcoin can afford to burn even its creation energy, capturing no value at all from its seigniorage. Your altcoin doesn't have a clean-slate OS to fund, and no one started building it in 2002.
28−
29−Ethically, what makes "premining" feel wrong is that the creators of the currency are rewarded disproportionately for their effort. The scamcoin is a get-rich-quick scheme, vaguely pyramid-shaped. Nothing about Urbit matches this pattern at all.
30−
31−To put it bluntly, Galen drives a 2004 Saab and Curtis drives a moldy '99 Cougar covered with raven shit. And we both love cars. We also have kids. And our spouses are more skeptical of Urbit than anyone else could ever be. (Our next startup definitely *will* be a get-rich-quick scheme, though.)
32−
33−Curtis created Urbit. So by the [homesteading principle](https://en.wikipedia.org/wiki/Homestead_principle), he started out owning all of it. But by now, Urbit's 8-bit galaxies have already been distributed among [57 separate individuals](https://github.com/urbit/arvo/blob/master/sys/vane/ames.hoon#L117-L372). Curtis owns 4 -- or 24, counting his whole family. (Some of whom he still owes money.)
34−
35−Tlon, the corporation which still runs Urbit development, has 95. (Without Tlon, there is basically no Arvo.) 50 are reserved for a hypothetical Urbit Foundation. Tlon employees have another 16.
36−
37−The rest of the galaxies belong to donors, investors, contributors, contest winners, and just random people who were in the right place at the right time. One is a Silicon Valley tycoon. Another is an Orthodox nun in a monastery in Greece. A couple are ex-Tlon employees who might totally hate us. There is nothing they all have in common, which is sort of the point.
38−
39−This property distribution looks a lot like land ownership in the real world -- complex and asymmetrical. That's no accident. If you have a problem living in New York because New York's real estate is not distributed equally among its residents, you may have a similar problem with Urbit. The reality is that Urbit, like New York, wasn't born yesterday and comes with a complex ownership history which we couldn't possibly change, even if we wanted to.
40−
41−Also, even in Manhattan you can just sleep in your van, and in Urbit you can always make your own comet. But people can't be prevented from thinking this means you're a weirdo.
42−
43−## Urbit isn't even really decentralized! It has a government!
44−
45−TLDR: yeah. But at least it's not the DAO.
46−
47−Real TLDR: it's technically impossible for Urbit to be decentralized at this stage of its life. Urbit is designed to achieve decentralization, not be born with it.
48−
49−A young network can't afford to be decentralized. It has to act as a unit. Because it has no network effect, it needs every scrap of efficiency it can get. Right now, Urbit needs a central government about ten times over.
50−
51−As we found out with the DAO, if a network isn't ready to be decentralized, its developers shouldn't even try. If Ethereum is hard-forked to roll back the DAO (which looks like the most probable result), it acknowledges that it both has a central government, and needs a central government. Decentralization is good. Pretend decentralization -- "decentralization theater" -- is harmful, and not a effective path to actual decentralization.
52−
53−Urbit did not have to get hacked to realize that a decentralized network can only be bootstrapped by a central government. It's part of Urbit's basic design. For example, by default your urbit upgrades its OS automatically (like an "evergreen" browser) with signed network updates. Whoever signs these updates is a central government by definition.
54−
55−But the test of a free software project is whether it can fork. So long as the unity of the PKI and the protocol is maintained, Urbit development can fork easily without disrupting the network. Any stress will fragment this central government, and as it fragments it grows more limited and stable.
56−
57−Urbit is designed to govern itself collectively by address space ownership -- effectively, "proof of stake." Any arbitrary power, will tend to fracture along these property lines. For instance, our hot updates are sent through the galaxy hierarchy; in a development fork, active galaxies would pick sides. This would actually be awesome for Urbit.
58−
59−By fragmenting the galaxy space into 57 separate partitions, we've created a global property map which is much more likely to splinter further, than reunite.
60−
61−In the long run, every galaxy should have a separate owner, who is a human being rather than a corporation. Combining galaxy holdings is regarded as creepy, and damages the value of both galaxies. Splitting up any remaining clumps is meritorious.
62−
63−The technical goal of Urbit is to create a network which, *if it actually takes over the world*, inevitably becomes decentralized. Even if Urbit takes over the world, nobody takes over the world. World domination must be technically implausible.
64−
65−This is the goal of all the new "web3" decentralized systems. If IPFS, Sandstorm or Ethereum takes over the world, nobody takes over the world. (The same is almost true of the Internet -- though it wouldn't be that surprising if a time traveler from 2116 revealed that ICANN had become a planetary government.)
66−
67−Urbit, by starting out as a centralized network, just reduces the technical problem to match the actual goal. Only long-term decentralization matters.
68−
69−It's very important that Urbit in 2116 be fully decentralized. For Urbit in 2016, pretending to be decentralized would be a joke at best, and a hoax at worst. And of course, no one can DAO us -- since the property system is still just a central registry.
70−
71−## {Sandstorm, IPFS, Ethereum, ...} is way ahead of Urbit.
72−
73−In general, web3 (next distributed web) solutions don't compete with each other. They support each other. Concretely, they are all part of each others' network effect.
74−
75−IPFS, Sandstorm, Ethereum, ZeroTier, and Urbit can all take over the world at the same time. None of them competes with the others. They enable each other. For instance, IPFS is not a computer; Urbit will be a great computer to use IPFS from; IPFS is a great CDN for Urbit. Moar IPFS now!
76−
77−The closest thing to a competitor that Urbit has is Sandstorm. Sandstorm, which by the way rocks, is also a personal server.
78−
79−But Sandstorm and Urbit compete in the way that, on the PC, the OS and the browser compete. In theory, the OS could solve the problems that the browser solves; or the browser could be the OS. In practice, Windows is a great OS to run a browser on.
80−
81−Similarly, a world in which Sandstorm takes off is an awesome world for Urbit, because everyone who has a Sandstorm instance has a great platform for running Urbit on. (Although Sandstorm could still work on its UDP capabilities.)
82−
83−Urbit on Sandstorm will be a sort of "double-hulled" personal server, even safer and more friendly than either system alone. And Sandstorm is not its own P2P network, like Urbit.
84−
85−## Urbit doesn't have enough planets for every human being.
86−
87−A planet is a tool, not a toy. Like a car, it's a device for a responsible and civilized adult. There aren't 4 billion cars in the world, nor 4 billion responsible adults.
88−
89−And limiting the supply of anything doesn't create a shortage. It sets a price. Ideally, in the long run, we think a planet should cost about $10. This could be off by an order of magnitude either way, and it wouldn't be the end of the world.
90−
91−If a planet costs $10, that means you paid $10 to get a planet. A planet with no reputation has a positive reputation, because someone paid $10 for it and hasn't yet done anything wrong. Positive default reputation is the single quality that makes a social network social.
92−
93−There is always a tradeoff between free speech and free beer. Urbit will always choose free speech.
94−
95−## Cloud computing is inherently non-private.
96−
97−TLDR: a general-purpose cloud computer is much, much more private than a special-purpose cloud computer. In general, a VM is secure against corporations but not governments.
98−
99−One reason we want the decentralized Internet is that we're tired of giant corporations spying on us. Think about it this way: Amazon is Netflix's main competitor. And yet, Netflix runs its whole operation on AWS. Why is Netflix sure that Amazon won't spy on it?
100−
101−A general-purpose virtual machine is special from a privacy standpoint, just because it's commercially realistic to design terms of service that prevent the host from peeking and poking at the customer's machine. Crossing this moat is technically nontrivial and can't possibly happen by any reasonable accident. No hosting contract could contemplate it.
102−
103−Whereas when your cloud computer is a special-purpose machine -- just a database row on some corporation's mainframe -- there is no way these services can promise not to handle your data. Handling your data is *what they do*. On a special-purpose server, the concept of privacy is not even defined.
104−
105−Where even a general-purpose server falls down is where the user has a sovereign adversary, which can secretly violate explicit or implicit hosting contracts. Users with a sovereign adversary must rely only on their own physical security. However, most users don't have a sovereign adversary. And those who do maximize their "herd immunity" if they can use the same protocols as those who don't.
106−
107−Also, the portability of a cloud server image is critical. Of course, since Urbit is formally specified, it's trivially portable. In fact, one strategy against sovereign adversaries may be continuous rotation between hosts, like an MX missile.
108−
109−## "Jets" are, like, a total hoax.
110−
111−TLDR: like, all of computing is a hoax. You can't compare a hoax to nothing. You can only compare it to all the other hoaxes.
112−
113−A "jet" is a sort of software device driver in Urbit. Urbit is precisely defined in terms of an interpreter that fits on a T-shirt, Nock. But a naive implementation of Nock is nowhere near practical, because Nock has only one integer operation: increment. For example, to decrement a number in Nock, you increment a counter up to the number under it.
114−
115−The only way an efficient Nock interpreter can work is to recognize algorithms like decrement, and implement them non-naively. By far the easiest way to do this is not to analyze arbitrary code as it's being executed, but to register and match well-known implementations in the standard library. No one should be writing their own decrement.
116−
117−But the semantics of the interpreter, *so long as the jet and the jet harness are defined correctly*, are exactly those of Nock. We are not extending or changing Nock in any way. We are just taking a shortcut in certain cases we understand perfectly.
118−
119−It's not at all unprecedented to have implementations much more complex than the corresponding specification. The x86 instruction set is relatively simple; the complexity of its decoding and execution path in a modern CPU is enormous. This path may well have "peephole optimizations" that replace matched algorithms, and if it doesn't the modern C compiler does.
120−
121−So jets are *morally* defensible. The fact remains, however, that a Nock interpreter without jets is completely useless. And there is not even an informal document that tells you what jets you need for a reasonably efficient Urbit. (This last, we can agree, should be corrected.)
122−
123−The correct way to think about jets is not to compare them to a perfect interpreter implemented by unicorns. Jets are a combined replacement for two other techniques in language implementation: intrinsics and a foreign-function interface.
124−
125−Compared to both intrinsics and an FFI, your jets have one key disadvantage: they need to be specified in pure code. You may not have this executable specification, which means you need to write it. Is this really so bad for your development process? An executable specification? Which can be trivially tested against the efficient implementation?
126−
127−Compared to intrinsics, jets give you true separation between mechanism and policy; only the interpreter, not the programmer and not the compiler, needs to know what's accelerated.
128−
129−Compared to an FFI, jets preclude I/O, so can be trivially sandboxed. Except that the programmer needs to mark routines which may benefit from optimization with a hint, here too we separate mechanism (efficient implementation) from policy.
130−
131−Yes, formal verification of jet equivalence is desirable. However, in the real world, many specifications, including quite complex ones, are tested into equivalence by brute force.
132−
133−Urbit has some jet abuses. The equivalence between our markdown parser in Hoon and the CommonMark C library is super dubious. It should be taken out and shot.
134−
135−However, the miscomputation resulting from a minor jet discrepancy is not a security hole or even fatal. It effectively means the event history does not match the current state. The way to resolve this conflict is for the current state to win, and the event history to be discarded -- not abnormal anyway. See the next question.
136−
137−## Urbit needs an infinitely extending packet/event log.
138−
139−TLDR: no, it doesn't.
140−
141−We can prune the event log because the Urbit transition function doesn't have any access to the event history -- just the current state and the current event.
142−
143−Urbit defines the semantics of a complete event log. It doesn't and can't require an implementation to maintain the whole log. It can maintain a checkpoint and the log since that checkpoint. The current implementation of Urbit keeps the whole log, but the next release will optionally prune it.
144−
145−## Urbit will never be able to call any existing code.
146−
147−TLDR: neither will Javascript. And dear Unix, the browser does not miss interacting with your `$LD_LIBRARY_PATH` at all.
148−
149−You can't talk to the OS or use system libraries from Javascript. Therefore, there is no point in having any kind of gateway, compatibility bridge, native methods, or other interface between Javascript and C.
150−
151−When in doubt, remember that Urbit is "the browser for the server side." It plays by the same general rules. Isolation means isolation.
152−
153−## There's no way Urbit will ever be adopted. It's too weird.
154−
155−TLDR: Urbit adoption is designed to be driven by ordinary end users. Urbit isn't ready for ordinary end users yet. We're working on it -- come help.
156−
157−Right now, Urbit is a developer tool. Or rather, a developer toy -- since the only thing it's useful for is developing Urbit. It also could be a much better toy. We're working on that too.
158−
159−But it's absolutely wrong to think of Urbit being adopted as a developer tool in the conventional sense. If you think this is almost impossible, you're right.
160−
161−If we look at the way most successful platforms are adopted, they're not adopted for their own virtues. They're adopted because they're part of a larger solution. It's very hard to displace a native component of an existing platform. Urbit is not trying to do this.
162−
163−C is a better language than Pascal, but it didn't beat Pascal because it's a better language. C beat Pascal because C was the native language of Unix, and people wanted to program in Unix. People don't use Javascript because Javascript is a great language, but because it's the native language of the browser. Replacing the native language of a platform may be doable -- but it's incredibly hard.
164−
165−Hoon is not competing with C, or even Haskell, as a Unix programming language. The only reason to program in Hoon is that it's the native language of Urbit. Urbit is not competing with node.js or Rails as a Web backend. The only reason to run Urbit is to run Urbit.
166−
167−Nock is cool, but it only gets adopted if Hoon gets adopted. Hoon is cool, but it only gets adopted if Urbit gets adopted. Urbit only gets adopted if it's useful as a personal server for human beings -- most of whom won't be Hoon programmers, or programmers at all.
168−
169−## Hoon is too weird. No one will be able to program in it.
170−
171−TLDR: Hoon is ridiculously simple. Our documentation and tooling are just immature.
172−
173−It's pretty fair to assume that (a) functional programming is hard and weird, (b) Hoon is weird even for a functional language, so (c) Hoon must be hard-squared.
174−
175−Actually, Hoon is weird even for a functional language because it's an attempt to remove the hardest things about functional programming: category theory, lazy evaluation, and gratuitous abstraction. To know a language is to know what the compiler is doing; all the semantics of the Hoon compiler fit in 2000 lines of code.
176−
177−It's too easy for us to wind up living in Isaac Asimov's Trantor, a world in which everything got invented thousands of years ago and the idea of new technology is just weird and scary. History isn't over yet, and nor is technical history.
178−
179−New things are harder to learn than old things. We ask smart high-school students to learn calculus. Think about how much harder it was for Newton and Leibniz to invent calculus, or for their first students to pick it up.
180−
181−Most of the difference is just the collective certainty that our society conveys to a high-school student that calculus is learnable. When you're learning Urbit, you don't have this collective knowledge; so you don't have the confidence that the problem is solvable. Confidence makes a huge difference. Moreover, any bug or glitch in the developer experience destroys this confidence and takes a long time to heal.
182−
183−Yes, we know: Hoon remains quite hard to learn. Again, we have no reason to think this problem isn't solvable. Public enlightenment remains our main priority.
184−
185−## Urbit programmers are stuck with Hoon.
186−
187−TLDR: patience, grasshopper.
188−
189−There's quite a straightforward way to implement any perfectly specified language with a reliable interpreter in Hoon. First, write an interpreter for that language in Hoon. Second, jet that intepreter function with the existing implementation.
190−
191−It is not clear that Javascript is *quite* well-defined enough for this treatment. But Lua probably is.
192−
193−## Ordinary users will never be able to manage an Urbit server.
194−
195−TLDR: Urbit's technical simplicity has always been designed to drive human usability. But the polish is the last thing that goes on. So we can't evaluate this claim right now.
196−
197−Right now, Urbit is only for geeks. You already need to be able to wrangle a Unix machine to run it. What's the point?
198−
199−This Urbit isn't the real Urbit. It's an early milestone on the way to the real Urbit.
200−
201−The real Urbit -- for normal human beings -- is a hosted service. Getting a planet is as easy as signing up for Facebook. Probably many users will think of it as another web account. They might not even know it can run more apps than the ones they use.
202−
203−A deterministic, persistent cloud computer is something different from a traditional server. Normally when we think of a server in the cloud, we think of it like a live animal -- a creature that needs to be cared for, fed, and herded. A file in the cloud is more like a rock -- you can forget about it for ten years.
204−
205−An urbit is a general-purpose computer, but it doesn't even have the concept of a reboot. It upgrades itself. If you don't feed it any packets for ten years, then turn it back on, it will spend a day or two upgrading itself, then be back to normal. Maybe it's something in between a rock and an animal -- a cactus?
206−
207−Another huge difference versus an Internet server is that we're confident that Urbit's limited supply of identities will make it easy to keep abusers off the network. So far, so good -- but of course, no one abuses a young network.
208−
209−The bottom line is that managing your urbit has to be as easy as managing your iPhone. Normally, it consists of deciding what apps you want to be running, and how much you trust them. Resources can't be free, so sometimes you have to play memory police. Humans have shown that they can handle these tasks.
210−
211−Our '70s OSes and networks, which were great designs in their day and have matured into excellent industrial tools, give us a totally misleading impression of how hard it should be to manage a general-purpose computer. Computing isn't scary or dangerous. Unix and the Internet are scary and dangerous. That's fine for an industrial tool, but not a personal tool.
212−
213−## Urbit has no killer app.
214−
215−TLDR: the killer app is personal API aggregation.
216−
217−It's a truism that any new platform has to be fundamentally much better at solving some problem than the mature platform it seeks to replace.
218−
219−We can look at Urbit's killer app from two perspectives: as a developer, and as a user.
220−
221−From the developer's perspective, Urbit's advantage is that it's a network stack which provides exactly-once delivery of typed, validated, transactional, encrypted and authenticated messages. The difference between an Urbit API and a REST API is like the difference between a paved road and a dirt road. On the other hand, you do need to learn a new functional language.
222−
223−From the user's perspective, there's one task that any personal server can perform, that can't be performed by any Web service: unrestricted API aggregation.
224−
225−Well before Urbit is ready to *replace* any conventional web services, it should be ready to *command* them in place by API. (Or if needed, by scraping.) If all you care about is being in control of your own data, it's fine to leave it in the hands of these services, as you have the API secrets to get it out.
226−
227−Managing a set of security connections to your existing services is one of the first important tasks of a modern personal server. This is a stateful task that typically requires both a durable API key and a temporary OAuth token. APIs change all the time, so connection maintenance also requires evergreen updates.
228−
229−The origin of this API key will vary, but usually the best way to set it is BYOK: the user registers their own urbit as an "app." And the neat thing about having your own API keys, for multiple services, on a single general-purpose computer, is that none of these services really has any practical way to control what you do with your own data.
230−
231−Terms of service which constrain the use of data (as opposed to the abuse of the service) simply aren't realistic and will no longer apply. This enables a variety of novel user experiences which aren't implementable as traditional web services, and also aren't available via conventional third-party API aggregators.
232−
233−Also, since Urbit is after all quite immature, it doesn't make much sense to restrict this security state to code within Urbit. The Urbit interpreter `vere` runs as a Unix daemon that implements the FUSE user-level filesystem protocol, and maps the data on your services into the Unix filesystem. For example, one of our demos lets you `ls` your Github issues.
234−
235−So it's straightforward to build, for instance, a Python app that uses Urbit as a gateway to mash up a bunch of web services. As a Unix programmer, you might even just regard Urbit as a generic Web API gateway daemon, without worrying about its internals.
236−
237−We have other ideas for initial killer apps. But this, we feel, is the best one. API libraries for `npm` et al abound. Stateful, self-updating, generic API aggregators with FUSE integration, also integrated with a reactive web server, are more rare. So perhaps there's a small niche here.
238−
239−## Urbit is sneered at by brilliant talking horses.
240−
241−It's difficult to categorize this [brilliant essay of Fare's](http://ngnghm.github.io/blog/2016/06/11/chapter-10-houyhnhnms-vs-martians/) in a single bullet point. So I've saved it for last.
242−
243−We've already addressed the point most commonly made by others: that jets are a sham. It's not always trivial to decode this critique, which is quite abstract. But Fare' makes a few other points.
244−
245−### Event-sourcing and/or caching is a pattern, not a layer
246−
247−Fare' is perfectly right that "one size does not fit all" in persistence. Generally, Urbit uses event-sourced persistence.
248−
249−But it has multiple layers of event-sourcing: in the definition of Urbit itself; in the application sandbox vane (Gall), and in the application itself. Urbit also has a completely orthogonal revision control system (Clay).
250−
251−And there is not a single cache across the whole system, though arguably there should be; for instance, the functional build system (Ford, which Fare' the master of build systems might appreciate) has its own internal cache.
252−
253−It is a common mistake to confuse a design pattern with a layer or feature, and equally fatal whichever direction you fail.
254−
255−### Let's be clear about why DSLs suck
256−
257−DSLs suck not because they are difficult to newbies in the base language. DSLs suck because every time a programmer, even one *experienced* in the base language, comes into a new codebase or project, she has to learn a new custom language.
258−
259−You need enormous wins to justify this cost. It's the goal of the base language designer to preempt these wins, creating a language which is almost never so tiresome and full of boilerplate that it requires a DSL or template layer.
260−
261−Hoon is almost entirely made of macros -- but they are internal, fixed, built-in macros (with no gensyms). This fixed set of macros is essentially enough. Occasionally we want to add one or two. But we never, ever pine for context-dependent macros.
262−
263−### Determinism is not consensus, and is not constraining
264−
265−Fare' is totally right that an urbit's data is meant for itself alone. In fact, an urbit has the right to compute incorrectly if it wants. We go to considerable lengths to ensure that you can't gain any particular advantage by incorrect computing.
266−
267−The whole point of Nock is that it's so low-level that there is no conceivable advantage in upgrading it. Divergence is just pointless. This is not a question of network integrity, just of practical standardization.
268−
269−This consistency stops at Nock. Without anyone violating the correctness of their lifecycle functions, anyone or everyone in Urbit could replace Hoon with Javascript. Determinism does not cramp Urbit's semantic style in any way, shape or form.
docs/about/overview.mddeleted−90
@@ -1,90 +0,0 @@
1−---
2−navhome: /docs/
3−navuptwo: true
4−next: true
5−sort: 1
6−title: Technical overview
7−---
8−
9−# Technical overview
10−
11−Urbit is a clean-slate system software stack defined as a
12−deterministic computer. An encrypted P2P network, `%ames`, runs
13−on a functional operating system, Arvo, written in a strict,
14−typed functional language, Hoon, which compiles itself to a
15−combinator interpreter, Nock, whose spec gzips to 340 bytes.
16−
17−## Architectural overview
18−
19−A deterministic computer? Urbit's state is a pure function of
20−its event history. In practice it uses a memory checkpoint and
21−an append-only log. Every event is a transaction; Urbit is an
22−ACID database and a single-level store. Urbit runs on Unix now,
23−but it's easy to imagine on a hypervisor or even bare metal.
24−
25−A purely functional OS? Urbit is pure -- no code inside it can
26−make system calls or otherwise affect the underlying platform.
27−Instead, the top-level event function defines an I/O protocol.
28−It maps an input event and the current state to a list of output
29−actions and the subsequent state. In Hoon:
30−
31−```
32−$-([event state] [(list action) state])
33−```
34−
35−### Nock
36−
37−Nock is a sort of nano-Lisp without syntax, symbols or lambdas.
38−Most Lisps are one-layer: they create a practical language by
39−extending a theoretically simple interpreter. The abstraction is
40−simple and the implementation is practical; there is no actual
41−codebase both simple and practical. Hoon and Nock are two
42−layers: Hoon compiles itself to pure Nock. Since Urbit is
43−defined in Nock, not Hoon, we can upgrade Hoon over the air.
44−
45−The Nock data model is especially trivial. A *noun* is an atom
46−or a cell. An atom is any unsigned integer. A cell is an
47−ordered pair of nouns. Nouns are acyclic and expose no pointer
48−equality test.
49−
50−### Hoon
51−
52−Hoon is a strict combinator language that avoids mathematical
53−theory and notation. It aims at a mechanical, imperative feel.
54−Hoon uses ASCII digraphs instead of keywords; there are no
55−user-level macros. The type system infers only forward and does
56−not use unification, but is not much weaker than Haskell's. The
57−compiler and inference engine is about 2000 lines of Hoon.
58−
59−### Arvo
60−
61−Arvo is an event-driven OS written in Hoon. It can upgrade
62−itself and everything inside it over the network. The Arvo
63−kernel proper is 500 lines of Hoon, which implements a typed
64−event system with explicit call-stack structure. Arvo ships
65−with modules that provide P2P networking (Ames), a revision-
66−control system (Clay), a web client/server (Eyre), a
67−functional build system (Ford), and an application engine
68−(Gall).
69−
70−### Ames
71−
72−Ames, the Urbit network, is an encrypted P2P protocol over UDP.
73−Its address space is semi-decentralized; 64-bit addresses are
74−hierarchically distributed, 128-bit addresses are self-created.
75−Addresses (or *plots*) are rendered in a phonemic syntax for
76−memorability. The scarcity of short plots helps control spam and
77−other Sybil attacks. The short plot hierarchy is also reused as
78−a supernode routing system for NAT traversal.
79−
80−### Dojo and talk
81−
82−Urbit ships with two default applications: a REPL and shell
83−_Dojo_, and a distributed user-level message-bus _Hall_.
84−Hall under the hood resembles NNTP; to the user, through the
85−client _Talk_, it looks like a self-hosted Slack or persistent
86−IRC.
87−
88−The full Urbit stack (compiler, standard library, kernel,
89−modules, and applications) is about 30,000 lines of Hoon.
90−Urbit is patent-free and MIT licensed.
docs/about/source.mddeleted−48
@@ -1,48 +0,0 @@
1−---
2−navhome: /docs/
3−navuptwo: true
4−sort: 3
5−title: Source code
6−next: true
7−---
8−
9−# Source code overview
10−
11−We host all our source code on GitHub at [github.com/urbit](https://github.com/urbit).
12−
13−Since there's quite a number of repos, we'll talk about a few of the most important ones here:
14−
15−<ul class="list spaced">
16− <li>
17− <h1><a href="https://github.com/urbit/urbit"><code>urbit/urbit</code></a></h1><br />
18− This is the main Urbit repo. It contains the Urbit interpreter (all of the C code) and is the main entry point if you're going to build from source.
19− </li>
20− <li>
21− <h1><a href="https://github.com/urbit/arvo"><code>urbit/arvo</code></a><br /></h1>
22− Arvo is the Urbit operating system (written in Hoon). When you boot your Urbit, you get this over the air. The source code is kept here, and you'll need it if you want to do any heavy development work.
23− </li>
24− <li><h1><a href="https://github.com/urbit/examples"><code>urbit/examples</code></a></h1><br />
25− At Urbit we love the concept of "see one, do one, teach one". This is the repository for Urbit example apps, generators, libraries, web pages and API connectors. Start with the simple examples taught in the Arvo docs to wrap your head around the fundamental concepts. Then try to understand the more sophisticated web apps. Then make your own app and PR this repo.
26− </li>
27− <li><h1><a href="https://github.com/urbit/docs"><code>urbit/docs</code></a></h1><br />
28− It's become a bit of a rite of passage for new Urbit contributors to solidify their understandings of Hoon and Arvo by contributing to the docs. This repository is where all this collaboration happens. The docs themselves are just markdown files hosted on a live ship.
29− </li>
30− <li><h1><a href="https://github.com/urbit/urbit.org"><code>urbit/urbit.org</code></a></h1><br />
31− This is where the source code for urbit.org lives. Like the docs, the urbit.org website is just a collection of a few markdown files rendered by Tree, the Urbit web publishing system.
32− </li>
33− <li><h1><a href="https://github.com/urbit/base-css"><code>urbit/base-css</code></a></h1><br />
34− We're working on a new Urbit style guide for urbit.org, the docs and Urbit web apps. If you're into visual design or are a CSS fanatic, jump in here.
35− </li>
36− <li><h1><a href="https://github.com/urbit/constitution"><code>urbit/constitution</code></a></h1><br />
37− We're <a href="https://urbit.org/blog/2017.9-eth/">bootstrapping Urbit from Ethereum</a>. This means formally defining the Urbit governance model and public-key infrastructure formally in a simple smart contract deployed on the Ethereum blockchain. If you're into Solidity, or just want to see how this works, check out this repo. Currently getting audited.
38− </li>
39− <li><h1><a href="https://github.com/urbit/etherwallet"><code>urbit/etherwallet</code></a></h1><br />
40− Urbit will soon need a secure, robust frontend interface for buying and selling Urbit address space and interacting directly with the Urbit constitution smart contract. We decided to fork MyEtherWallet, which already has strong security and support for things like multisig and hardware wallet, and modify it to support Urbit. Dive in!
41− </li>
42− <li><h1><a href="https://github.com/urbit/tree"><code>urbit/tree</code></a></h1><br />
43− Tree is the main Urbit web interface written as a React/Flux app in CoffeeScript. We're working on porting this to ES6 and simplifying the architecture generally. If you're into frontend frameworks and web apps, reach out to us and we'll help you get started.
44− </li>
45− <li><h1><a href="https://github.com/urbit/talk"><code>urbit/talk</code></a></h1><br />
46− The main web interface for Urbit's distributed chat and notifications protocol. Currently, like Tree, a simple React/Flux app written in CoffeeScript. With lots of changes happening to the Talk Hoon backend app in the coming releases, our frontend Talk interface will need a lot of development and design work. We've also started the process of porting this to ES6. Ask us how you can start helping out!
47− </li>
48−</ul>
docs/arvo.mddeleted−14
@@ -1,14 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 6
5−title: Arvo
6−---
7−
8−# Arvo
9−
10−Fast, pragmatic tutorials which show you how to build simple programs in Hoon and Arvo.
11−
12−If you learn by getting things done, not by exploring fundamentals, start here.
13−
14−<list/>
docs/arvo/basic.mddeleted−337
@@ -1,337 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 11
4−next: true
5−title: Basic Hoon
6−---
7−
8−Basic Hoon
9−==========
10−
11−Our goal is to get you programming interesting and useful things as soon
12−as possible. To get there, we have to quickly cover some of the
13−fundamentals of [Hoon](/docs/hoon/). To do this, we'll walk through two simple
14−programs: the first [Project Euler](https://projecteuler.net/) problem
15−and [fizzbuzz](https://en.wikipedia.org/wiki/Fizz_buzz).
16−
17−To run this code, you'll need an urbit, and will have to either sync or copy the
18−[examples repo](https://github.com/urbit/examples) into it.
19−
20−## Installation
21−
22−First, you'll need a running urbit. Follow our urbit.org [install
23−instructions](https://urbit.org/docs/using/install), then
24−[setup](https://urbit.org/docs/using/setup) and urbit.
25−
26−Follow the *Network install* below if your urbit is running on the live network
27−(comets are usually best for development). Follow the *Local install* instead
28−if you're on a
29−[fake ship](https://urbit.org/fora/posts/~2017.1.5..21.31.04..20f3~/) or are
30−otherwise experiencing problems with the network install.
31−
32−### Network install
33−
34−In your urbit's `:dojo`, run the command:
35−
36− ~your-urbit:dojo> |sync %examples ~ladnub-lorwyn %examples
37−
38−Depending on network traffic, this initial merge and sync could take anywhere
39−between thirty seconds to several minutes. Upon a successful sync you'll see the
40−output:
41−
42− sync succeeded from %examples on ~ladnub-lorwyn to %examples
43−
44−In which case, next run the commands:
45−
46− ~your-urbit:dojo> =dir /=examples=
47− ~your-urbit:dojo/examples> |serve %/web
48− ~your-urbit:dojo/examples> |mount %
49−
50−If your sync isn't succeeding after a few minutes for whatever reason, run
51−`|cancel %examples` in your `:dojo` and follow the local install below instead.
52−
53−### Local install
54−
55−In your urbit's `:dojo`:
56−
57− ~your-urbit:dojo> |merge %examples our %base, =gem %init
58− ~your-urbit:dojo> =dir /=examples=
59− ~your-urbit:dojo/examples> |serve %/web
60− ~your-urbit:dojo/examples> |mount %
61−
62−If `~your-urbit` was installed at `/urbit/path` on your Unix machine, you can
63−now find your `%examples` desk at the path `/urbit/path/your-urbit/examples`.
64−
65−Lastly, in Unix, clone this repo somewhere and copy in the `examples` files to
66−your urbit's new mounted `%examples` desk. You can run the following shell
67−commands (*replacing your urbit's examples desk path as necessary*):
68−
69− $ git clone https://github.com/urbit/examples
70− $ for dir in {app,gen,lib,mar,sec,sur,web}; do cp -r ./examples/$dir* /urbit/path/your-urbit/examples; done
71−
72−Your `%clay` filesystem should acknowledge the newly added files.
73−
74−## Get started!
75−
76−Run an example to ensure it worked:
77−
78− ~fintud-macrep:dojo/examples> +project-euler-p1
79− 233.168
80−
81−Euler 1
82−-------
83−
84−Let's check out the code for Euler 1. First, the problem:
85−
86− If we list all the natural numbers below 10 that are multiples of
87− 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
88−
89− Find the sum of all the multiples of 3 or 5 below 1000.
90−
91−Here is the hoon solution (which should be in your pier directory under
92−`/examples/gen/project-euler/p1`):
93−
94− :: Project Euler 1
95− :: https://projecteuler.net/problem=1
96− ::
97− :: run in dojo with:
98− :: ~your-urbit:dojo/examples> +project-euler/p1
99− ::
100− :::: /===/gen/project-euler/p1/hoon
101− ::
102− !:
103− ::
104− :- %say |= *
105− :- %noun
106− =< (sum 1.000)
107− ::
108− |%
109− ++ three
110− |= a/@
111− =| b/@
112− |- ^- @u
113− ?: (lth a b)
114− 0
115− (add b $(b (add 3 b)))
116− ::
117− ++ five
118− |= a/@
119− =| b/@
120− |- ^- @
121− ?: (lte a b)
122− 0
123− ?: =((mod b 3) 0)
124− $(b (add b 5))
125− (add b $(b (add b 5)))
126− ::
127− ++ sum
128− |= a/@u
129− (add (five a) (three a))
130− --
131−
132−> Hoon is not generally whitespace sensitive, but we do have two
133−> different kinds of whitespace: a single space and a gap, which is two
134−> or more spaces or a linebreak. Tabs are taboo. Do not use them.
135−> Really. For a more detailed explanation of when to use spaces vs.
136−> gaps, see the syntax section before the first exercises.
137−
138−### Lines 1-13:
139−
140−Any line that begins with `::` is a comment.
141−
142− :- %say |= *
143− :- %noun
144− =< (sum 1.000)
145−
146−All you need to know about the lines above is that they call the `++sum`
147−function with an argument of `1.000`. We'll cover them in more detail
148−later.
149−
150−### How to form expressions
151−
152−Hoon does not typically use reserved words to form expressions. Instead,
153−expressions are formed with *runes*: digraphs of two ASCII symbols. Each
154−rune takes a specific number of children, either expressions formed by
155−other runes or literals that produce their own value (some runes take
156−*N* children, and are usually closed with `==`).
157−
158−For example, the rune `?:` from line 20 is the classic 'if-then-else' statement,
159−and thus takes three children:
160−
161− ?: (lth a b) :: if first child evals to true
162− 0 :: then produce result of second
163− (add b $(b (add 3 b))) :: else, produce result of third
164−
165−Since runes are such a fundamental structure in Hoon, we found ourselves
166−speaking them out loud frequently. It quickly grew cumbersome to have to
167−say "question mark, colon" to describe `?:`. To alleviate this problem,
168−we came up with our own naming scheme: each ASCII glyph has a
169−single-syllable pronunciation phonetically designed to be both easily
170−remembered and easily pronounced in conjunction with the other glyphs
171−(when forming a rune).
172−
173−See the entire naming scheme below.
174−
175− ace [1 space] gal < pal (
176− bar | gap [>1 space, nl] par )
177− bas \ gar > sel [
178− buc $ hax # sem ;
179− cab _ hep - ser ]
180− cen % kel { sig ~
181− col : ker } soq '
182− com , ket ^ tar *
183− doq " lus + tec `
184− dot . pam & tis =
185− fas / pat @ wut ?
186− zap !
187−
188−Using this scheme, we would pronounce `?:` as 'wutcol'.
189−
190−### Lines 14-37
191−
192−Now let's quickly walk through this code line-by-line. Lines 14-37 are wrapped
193−in a `|%` ('[barcen](../../hoon/rune/bar/cen/)'), which produces a
194−core. Cores are a fundamental datatype in Hoon, similar to a struct, class, or
195−object. A core is just a map of names to any kind of code, whether it be
196−functions or data. Each element, called an arm, in this map begins with a `++`
197−followed by the name and the corresponding code. Since `|%` takes an arbitrary
198−number of children, it needs to be closed with a `--`.
199−
200−> `++` ('luslus') is not technically a rune, since it is only used in
201−> core syntax, as shown above.
202−
203−Let's step into each of the three arms within our core.
204−
205−### `++ sum`
206−
207− ++ sum
208− |= a/@u
209− (add (five a) (three a))
210− --
211−
212− `|=` ('[bartis](../../hoon/rune/bar/tis/)') produces a function, much like a lambda in lisp. It
213−takes two children:
214−
215−1. A set of argument(s). In this case our argument set only contains
216− one: `a`, which is required to be an atom or natural number, denoted
217− by `@`.
218−
219−2. The body of the function itself, which is executed when the function is
220− called (in this case, with `(sum 1.000)`). This particular function adds the
221− results of evaluating the gates `++five` and `++three` with each of their
222− respective input parameters set to `a`.
223−
224−### ++ three
225−
226− ++ three
227− |= a/@
228− =| b/@
229− |- ^- @u
230− ?: (lth a b)
231− 0
232− (add b $(b (add 3 b)))
233−
234−As above, `++three` takes an integer argument, `a`, and then executes
235−the remainder of the code with `a` set to the actual arguments.
236−
237−Similarly, `=|` ('[tisbar](../../hoon/rune/tis-flow/bar-new/)') pushes its first child, `b` into our context
238−(in other words, it declares a variable `b`) and executes the remainder
239−of the code. However, `b` is not an argument; `=|` sets `b` to the
240−default value of whatever type it is declared as. Since the default
241−value of an atom is `0`, b is set to `0`.
242−
243−> To produce the default value of any given type, use `*` ('tar')
244−> followed by the type. This operaction is called *bunt*.
245−>
246−> > *@ :: produce the default value of atom @
247−> 0
248−>
249−> > *@p :: produce the phonemic base of atom @
250−> ~zod
251−
252−So now we have two variables: `a` is set to our input, and `b` is
253−initialized to `0`.
254−
255−One way to think about `|-` ('[barhep](../../hoon/rune/bar/hep/)') is that it lays down a recursion
256−point. More on this later.
257−
258−`^-` ('[kethep](../../hoon/rune/ket/hep/)') is just a cast that sets the result of the remainder of
259−the code to an unsigned integer, `@u`.
260−
261−In pseudocode, the last three lines read like this: if `a` is less than
262−`b`, produce zero. Else, add `b` to the result of rerunning the segment
263−of the function following the `|-` with the value of `b` changed to `b`
264−plus three.
265−
266−The only thing that should look completely unfamiliar to you here is the
267−`$(b (add 3 b))`, which causes us to recurse back to our last recursion
268−point with the value of `b` set to `(add 3 b)`. Note that we only
269−specify what changes (`b` in this case). If you recurse by an actual
270−function call, then you have to specify every argument.
271−
272−> If you're familiar with Clojure, `|-` is `loop` and `$()` is `recur`.
273−
274−**Exercises**:
275−
276−Tweak your code to complete the following exercises.
277−
278−There are a few runes and some syntax that we have yet to cover that you
279−will need to complete the exercises below. For these, please refer to
280−our cheatsheat at the bottom.
281−
282−1. Read and understand `++five` line by line.
283−
284−2. Change `++sum` to accept two variables, `a` and `b`. Pass `a` to
285− `three` and `b` to `five`. Then run the code with `a` set to `1.000`
286− and `b` set to `2.000`.
287−
288−3. Check if this new result is under one thousand. If it is, return the
289− string `'result < 1.000'`. If not, return `'result >= 1.000'`.
290−
291−### Review
292−
293− |% ('barcen') start core (collection of named ++ arms; an "object")
294− |= ('bartis') define function
295− =| ('tisbar') define variable from type with default value
296− |- ('barhep') drop a recursion point
297− ^- ('kethep') cast
298− ?: ('wutcol') if-then-else
299− =(a b) test equality
300− (function args ...) call function with args
301−
302−Lookup each of these expressions (and all others!) in the [Rune Expressions](../../hoon/rune/) definition.
303−
304−### New material
305−
306−1. There are two syntaxes for writing Hoon: tallform and wideform.
307−
308− In tallform, expressions are formed with either two spaces or a line
309− break separating both a rune from its children and each of its children
310− from one another. We use tallform when writing multiline expressions.
311−
312− For more concise expressions, we use wideform, which is always a single
313− line. Wideform can be used inside tallform expressions, but not vice
314− versa.
315−
316− Wideform expressions are formed with a rune followed by `()` containing
317− its children, all of which are separated by a single space. For example,
318− to make a cell of two elements, use `:-(a b)`.
319−
320− We've already seen wideform in action, for example with
321− `=((mod b 3) 0)`. In this case, `=` is actually an irregular form of
322− `.=`, which tests its two children for equality.
323−
324− Surrounding a function with `()` is an irregular wide form syntax for
325− calling a function with *N* arguments. More on this later.
326−
327−2. For a set of multiple arguments following `|=` ('[bartis](../../hoon/rune/bar/tis/)'), use `{` 'kel' and `}` 'ker.' For example: `{a/@u b/@u}`.
328−
329−3. `:-` makes a cell of values. The irregular wide form of this is
330− `[a b]`, with two expressions separated by a single space. While the
331− regular form of this rune takes a fixed number of children (two),
332− its irregular wide form can accept *N* expressions: `[a1..an]`.
333−
334−4. Cords are one datatype for text in Hoon. They're just a big atom
335− formed from adjacent unicode bytes -- a "c string". To produce a
336− cord, enclose text within single quotes. To set the type of an
337− argument to a cord, use `@t`.
docs/arvo/generators.mddeleted−178
@@ -1,178 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 18
5−title: Using generators with apps
6−---
7−
8−# Generators
9−
10−Up until now we've poked apps directly. This requires the user to
11−specify the mark, and it requires the app to accept the arguments in a
12−way that's convenient for users to input. This is the "plumbing" way to
13−interact with apps. Generators are the "porcelain" layer. This is why
14−when you run a command like `+ls` or `|merge`, there are no marks in
15−sight.
16−
17−We've used generators before, back in [Basic
18−Operation](/docs/using/admin). At that point, we just used the
19−generators to produce values -- we didn't pipe their results into apps.
20−In the dojo cast, the role of a generator is to take a list of arguments
21−and produce a value, which is often, though not always, piped into an
22−app. Generators are pure, stateless functions, and they cannot send
23−moves.
24−
25−`+ls` and `+cat` are commonly-used generators that produce a directory
26−listing and print out a file, respectively. These are useful in
27−themselves, so we generally don't pipe the results into an app.
28−
29−Another generator is `+hood/merge`. Try running `+hood/merge` with the
30−normal arguments for `|merge`:
31−
32− ~fintud-macrep:dojo> +hood/merge %home our %they
33− [syd=%home her=~fintud-macrep sud=%they gem=%auto]
34− ~fintud-macrep:dojo> +hood/merge %home our %they, =gem %this
35− [syd=%home her=~fintud-macrep sud=%they gem=%auto]
36−
37−This didn't run any merge, it just constructed the command that, if sent
38−to `:hood`, would run it. Note first that, even though it's not printed,
39−this value has mark `kiln-merge`. Also, the merge strategy `gem=%auto`
40−was added automatically. Optional arguments are straightforward with
41−generators.
42−
43−In general, generators are prepended by either `+` or `|`. The general
44−form is `+generator`, but often generators are created specifically to
45−work with a single app, they're usually placed in a subdirectory of gen
46−and run with `|`. Thus, if `my-generator` generator is made for use with
47−`:my-app`, then `my-generator` is put in
48−`/gen/my-app/my-generator.hoon`, and can be run directly with
49−`+my-app/my-generator <args>`. If you want to pipe the result into
50−`:my-app`, then run `:my-app +my-app/my-generator <args>`. Because this
51−pattern is so common, this can be abbreviated to
52−`:my-app|my-generator <args>`. Because most built-in commands are
53−generators for the `:hood` app, `:hood|generator <args>` can be
54−shortened to `|generator <args>`.
55−
56−Let's write a generator for a modified version of `:examples-pong` from
57−the chapter on [Network Messages](/docs/arvo/system/network). Recall
58−that `:examples-pong` takes an urbit address, which is of mark `urbit`,
59−and sends that urbit the message `'howdy'`. First--without a
60−generator--let's make `:examples-ping` that does the same, except that
61−it lets the user optionally specify the message as well.
62−
63−We'll need a new mark for our arguments. Let's call it
64−`examples-ping-message`.
65−
66−> For app-specific marks, it's good style to prefix the name of the mark
67−> with the name of the app. Since many apps have several such marks,
68−> subdirectories in `/mar` are rendered as `-`, so that `ping-message`
69−> is written in (/mar/examples/ping/message.hoon).
70−
71− ::
72− :::: /hoon/message/ping/examples/app
73− ::
74− /? 314
75− |_ {to/@p message/@t}
76− ++ grab
77− |%
78− ++ noun {@p @t}
79− --
80− --
81−
82−The app can easily be modified to use this (`/app/examples/ping.hoon`):
83−
84− :: Allows one ship to ping another with a string of text
85− ::
86− :::: /hoon/ping/examples/app
87− ::
88− /? 314
89− |%
90− ++ move {bone term wire *}
91− --
92− !:
93− |_ {bowl state/$~}
94− ::
95− ++ poke-examples-ping-message
96− |= {to/@p message/@t}
97− ~& 'sent'
98− ^- {(list move) _+>.$}
99− :- ^- (list move)
100− :~ `move`[ost %poke /sending [to dap] %atom message]
101− ==
102− +>.$
103− ::
104− ++ poke-atom
105− |= arg/@
106− ~& 'received'
107− ^- {(list move) _+>.$}
108− ::
109− ~& [%receiving (@t arg)]
110− [~ +>.$]
111− ::
112− ++ coup |=(* `+>)
113− --
114−
115−Now we can run this with:
116−
117− ~fintud-macrep:dojo> |start %examples-ping
118− >=
119− ~fintud-macrep:dojo> :examples-ping &examples-ping-message [~sampel-sipnym 'heyya']
120− >=
121−
122−And on `~sampel-sipnym`, assuming it's running `:examples-ping` as well,
123−we see `[%receiving 'heyya']`.
124−
125−This is an annoying way to invoke the app, though. The `[]` are
126−mandatory, and optional arguments are hard. Let's make a generator,
127−`+examples-send` to make everything nicer. Since it's specific to
128−`:examples-ping`, let's put it in `/gen/examples/ping/send.hoon`:
129−
130− :- %say
131− |= {^ {to/@p message/?($~ {text/@t $~})} $~}
132− [%examples-ping-message to ?~(message 'howdy' text.message)]
133−
134−A couple of new things here. Firstly, `message/?($~ {text/@t $~})`
135−should be read as "the message is either null or a pair of text and
136−null". Generator argument lists are always null-terminated, which makes
137−it convenient to accept lists in tail position (which are particularly
138−annoying without generators). `?(a b)` is the irregular form of
139−`$?(a b)`, which is a union type. Thus, `?(a b)` means the type of
140−anything that's in either `a` or `b`. Thus, in our case,
141−`?(~ [text=@t ~])` is either null or a pair of text and null.
142−
143−Secondly, `?~(a b c)` is a rune which means "if the `a` is null, do `b`,
144−else `c`". It is roughly equivalent to `?:(=(~ a) b c)`.
145−
146−> `?~(a b c)` is actually equivalent to `?:=(?=(~ a) b c)`, which,
147−> although identical at run time, is subtly different at compile time.
148−> Specifically, using `?=` rather than `=` means that we're checking
149−> whether `a` is in the *type* of `~`, and so the compiler knows that in
150−> the `b` case `a` is null, and in the `c` case `a` is not null. Since
151−> `=` is purely a runtime value check with no type implications, the
152−> compiler doesn't gain any information.
153−>
154−> At any rate, this is the reason why we can refer to `text.message` in
155−> the `c` clause. The compiler knows that `message` is not null, so it
156−> must have `text` within it. If you used
157−> `?:(=(~ message) 'howdy' text.message)` the compiler would complain
158−> that it doesn't know whether `message` has `text` within it.
159−
160−This is run as follows:
161−
162− ~fintud-macrep:dojo> :examples-ping|send ~sampel-sipnym
163− >=
164− ~fintud-macrep:dojo> :examples-ping|send ~sampel-sipnym 'how do you do'
165− >=
166−
167−Which causes `~sampel-sipnym` to print `[%receiving 'howdy']` and
168−`[%receiving 'how do you do']`.
169−
170−**Exercises**:
171−
172−- Create a generator for `:examples-sum` from
173− [State](/docs/arvo/state) so that you can run `:examples-sum|add 5`
174− to add numbers to it.
175−
176−- Create a generator for `:examples-click` from [Web
177− Apps](/docs/arvo/web-apps) so that you can run
178− `:examples-click|poke` to poke it.
docs/arvo/internals/ford/commentary.mddeleted−2576
@@ -1,2576 +0,0 @@
1−---
2−navhome: /docs/
3−---
4−
5−
6−Reference
7−=========
8−
9−Data Models
10−-----------
11−
12−### `++axle`, formal state
13−
14− ++ axle :: all %ford state
15− $: %1 :: version for update
16− pol=(map ship baby) ::
17− == ::
18−
19−This is the formal state of our vane. Anything that must be remembered
20−between calls to ford must be stored here. The number `%1` is a version
21−number for our state that allows us to upgrade the structure of our
22−state in the future if we wish.
23−
24−`pol` is the a map from every ship on our pier to their individual ford
25−state. There is no shared ford state -- every ship is entirely separate.
26−
27−### `++baby`, state by ship
28−
29− ++ baby :: state by ship
30− $: tad=[p=@ud q=(map ,@ud task)] :: tasks by number
31− dym=(map duct ,@ud) :: duct to task number
32− jav=(map ,* calx) :: cache
33− == ::
34−
35−This is the state specific to each ship.
36−
37−`tad` and `dym` keep track of the tasks we're currently working on.
38−`dym` is a map from ducts to task numbers, and `q.tad` is a map from
39−task number to the task itself. `p.tad` is the next available task
40−number. Thus, the keys of `q.tad` are a subset of the numbers less than
41−`p.tad`, and ford has attempted exactly `p.tad` tasks so far.
42−
43−`jav` is the cache of previously-solved problems. The keys are a pair of
44−a term (either `%hood`, `%slap`, or `%slam`) and a noun that represents
45−the exact problem solved. In the case of a `%hood`, then, the key is of
46−the form `[%hood beam cage]`. For `%slap`, there is `[%slap vase hoon]`.
47−For `%slam`, there is `[%slam vase vase]`. The values are the result of
48−solving the problem. Note that this cache is wiped in `++stay` when ford
49−is reloaded.
50−
51−### `++task`, problem in progress
52−
53− ++ task :: problem in progress
54− $: nah=duct :: cause
55− kas=silk :: problem
56− kig=[p=@ud q=(map ,@ud beam)] :: blocks
57− == ::
58−
59−This is all the state we keep regarding a particular task. `nah` is the
60−duct which asked us to solve the problem, and `kas` is the most recent
61−statement of the problem.
62−
63−`kig` keeps track of which resources we are blocked on. Our blocks are
64−stored by index in `q.kig`, and the next available index is `p.kig`.
65−
66−### `++silk`, problem
67−
68− ++ silk :: construction layer
69− $& [p=silk q=silk] :: cons
70− $% [%bake p=mark q=beam r=path] :: local synthesis
71− [%boil p=mark q=beam r=path] :: general synthesis
72− [%call p=silk q=silk] :: slam
73− [%cast p=mark q=silk] :: translate
74− [%diff p=silk q=silk] :: diff
75− [%done p=(set beam) q=cage] :: literal
76− [%dude p=tank q=silk] :: error wrap
77− [%dune p=(set beam) q=(unit cage)] :: unit literal
78− [%mute p=silk q=(list (pair wing silk))] :: mutant
79− [%pact p=silk q=silk] :: patch
80− [%plan p=beam q=spur r=hood] :: structured assembly
81− [%reef ~] :: kernel reef
82− [%ride p=hoon q=silk] :: silk thru hoon
83− [%vale p=mark q=ship r=*] :: validate [our his]
84− == ::
85−
86−This is the every type of problem we can solve. Every `%exec` kiss that
87−requests us to solve a problem must choose one of these problems to
88−solve.
89−
90−Because this is both an internal structure used in ford and the public
91−interface to ford, we choose to document this structure in our
92−discussion of the public interface to ford below.
93−
94−### `++calx`, cache line
95−
96− ++ calx :: concrete cache line
97− $% [%hood p=calm q=(pair beam cage) r=hood] :: compile
98− [%slap p=calm q=[p=vase q=hoon] r=vase] :: compute
99− [%slam p=calm q=[p=vase q=vase] r=vase] :: compute
100− == ::
101−
102−There are three kinds of cache entries. Every entry includes some
103−metadata in `p` and is the combination of an input and its output.
104−
105−The input to a `%hood` is the location of the resource and a cage
106−representing the data at that location. The output is the hood found by
107−compiling the given cage at the given location.
108−
109−The input to a `%slap` is the vase of the subject and the hoon of the
110−formula against which we are slapping the subject. The output is the
111−vase produced by slapping them.
112−
113−The input to a `%slam` is the vase of the subject and the vase of the
114−gate which we are slapping. The output is the vase produced by slamming
115−them.
116−
117−### `++calm`, cache line metadata
118−
119− ++ calm :: cache metadata
120− $: laz=@da :: last accessed
121− dep=(set beam) :: dependencies
122− == ::
123−
124−Every line in the cache needs to have two pieces of metadata. We must
125−know the last time this line in the cache was accessed, and we must know
126−what are the dependencies of this line.
127−
128−### `++hood`, assembly components
129−
130− ++ hood :: assembly plan
131− $: zus=@ud :: zuse kelvin
132− sur=(list hoot) :: structures
133− lib=(list hoof) :: libraries
134− fan=(list horn) :: resources
135− src=(list hoop) :: program
136− == ::
137−
138−When assembling a hook file, we split it into several sections.
139−
140−`zus` is the kelvin version of the required zuse. In general, we assume
141−that any newer (lower-numbered) zuse will retain backward compatibility,
142−so any newer zuse is also permissible. This number is set with a `/?` at
143−the beginning of the file.
144−
145−`sur` is the set of structures included. These are included with the
146−`/-` rune. When a structure is included, we look in `/=main=/sur` for
147−the given structure and we load the gate there. When compiling, all the
148−included structures are collected into a single core placed in the
149−subject of the body with a `=>`.
150−
151−`lib` is the set of librarires included. These are included with the
152−`/+` rune. When a library is included, we look in `/=main=/lib` for the
153−given library and we load the library there. As with structures, all the
154−included libraries are collected into a single core placed in the
155−subject of the body with a `=>`.
156−
157−`fan` is the set of resources included. These are loaded in many
158−different ways and may load resources from any location. These are
159−placed in the subject of the body with a `=~`.
160−
161−`src` is the set of hoons or references to hoons in the body of the
162−program. Generally, each of these will represent a core, but this is not
163−required. When compiling, these are strung together in a `=~`.
164−
165−### `++hoot`
166−
167− ++ hoot (pair bean hoof) :: structure gate/core
168−
169−A structures may be either a direct gate or a core. These are
170−syntactically distinguished by adding a `*` to the beginning of the
171−structure name for a core. The structure itself is a `hoof`.
172−
173−### `++hoof`
174−
175− ++ hoof (pair term (unit (pair case ship))) :: resource reference
176−
177−A hoof, which is either a structure or a library, has a name, and it may
178−also specify which version of the resource to use and which ship to
179−retrieve it from.
180−
181−### `++horn`
182−
183− ++ horn :: resource tree
184− $% [%ape p=hoon] :: /~ hoon by hand
185− [%arg p=hoon] :: /$ argument
186− [%day p=horn] :: /| list by @dr
187− [%dub p=term q=horn] :: /= apply face
188− [%fan p=(list horn)] :: /. list
189− [%for p=path q=horn] :: /, descend
190− [%hub p=horn] :: /@ list by @ud
191− [%man p=(map span horn)] :: /* hetero map
192− [%nap p=horn] :: /% homo map
193− [%now p=horn] :: /& list by @da
194− [%saw p=hoon q=horn] :: /; operate on
195− [%see p=beam q=horn] :: /: relative to
196− [%sic p=tile q=horn] :: /^ cast
197− [%toy p=mark] :: /mark/ static
198− == ::
199−
200−This is how we represent the static resources hook files can load. The
201−discussion of their use from a user's perspective is documented in the [runes
202−documentation](https://urbit.org/docs/arvo/internals/runes), so we will here
203−only give a description of the data structure itself.
204−
205−A `%ape` horn is simply a hoon that gets evaluated and placed in the
206−subject.
207−
208−A `%arg` is a gate that gets evaluated with a sample of our location and
209−our heel.
210−
211−A `%day` is a horn that applies to each of a list of `@dr`-named files
212−in the directory.
213−
214−A `%dub` is a term and horn, where the result of a horn is given the
215−face of the term.
216−
217−A `%fan` is a list of horns, all at the current directory level.
218−
219−A `%for` is a path and a horn, where the horn is evaluated relative to
220−the given path, where the given path is relative to the current
221−location.
222−
223−A `%hub` is a horn that applies to each of a list of `@ud`-named files
224−in the directory.
225−
226−A `%man` is a map of spans to horns where the result is a set of each
227−horn applied to the current directory given the associated face.
228−
229−A `%nap` is a homogenous map where each entry in a directory is handled
230−with the same horn and is given a face according to its name.
231−
232−A `%now` is a horn that applies to each of a list of `@da`-named files
233−in the directory.
234−
235−A `%saw` is a hoon and a horn, where the hoon operates on the result of
236−the horn.
237−
238−A `%see` is a beam and a horn, where the horn is evaluated at a location
239−of the given beam.
240−
241−A `%sic` is a tile and a horn, where the horn is evaluated and cast to
242−the type associated with the tile.
243−
244−A `%toy` is simply a mark to be baked.
245−
246−### `++hoop`, body
247−
248− ++ hoop :: source in hood
249− $% [%& p=hoon] :: direct hoon
250− [%| p=beam] :: resource location
251− == ::
252−
253−This is an entry in the body of the hook file. The hoop can either be
254−defined directly in the given file or it can be a reference to another
255−file. The second is specified with a `//` rune.
256−
257−### `++bolt`, monadic edge
258−
259− ++ bolt :: gonadic edge
260− |* a=$+(* *) :: product clam
261− $: p=cafe :: cache
262− $= q ::
263− $% [%0 p=(set beam) q=a] :: depends/product
264− [%1 p=(set ,[p=beam q=(list tank)])] :: blocks
265− [%2 p=(list tank)] :: error
266− == ::
267− == ::
268−
269−Throughout our computation, we let our result flow through with the set
270−of dependencies of the value. At various times, we may wish to either
271−throw an error or declare that the actual result cannot be found until a
272−particular resource is retrieved. This is a perfect case for a monad, so
273−here we define a data structure for it.
274−
275−At every step, we have a cache, so we store that in `p`. In `q` we store
276−the data.
277−
278−In the case of `%0`, we have the result in `q` and the set of
279−dependencies in `p`.
280−
281−In the case of `%1`, we have a set of dependencies on which we are
282−blocking. When this happens, we make a call to clay to get the
283−dependencies, and we proceed with the computation when we receive them.
284−Technically, we restart the computation, but since every expensive step
285−is cached, there is no significant performance penalty to doing this.
286−Referential transparency has its uses.
287−
288−In the case of `%2`, we have a hit an error. This gets passed all the
289−way through to the calling duct. The list of tanks is some description
290−of what went wrong, often including a stack trace.
291−
292−### `++burg`, monadic rule
293−
294− ++ burg :: gonadic rule
295− |* [a=$+(* *) b=$+(* *)] :: from and to
296− $+([c=cafe d=a] (bolt b)) ::
297− :: ::
298−
299−To operate on bolts, we use `++cope` as our bind operator, and the
300−functions it works on are of type `burg`. Our functions that operate on
301−bolts should have a sample of the cache and a value. Their output should
302−be a bolt of the output value. Then, `++cope` will only call the
303−function when necessary (in the `%0` case), and it will do so without
304−the wrapping of a bolt.
305−
306−If you understand monads, this is probably fairly obvious. Otherwise,
307−see the discussion on `++cope` (link).
308−
309−Public Interface
310−----------------
311−
312−Ford does not export a scry interface, so the only way to interact with
313−ford is by sending kisses and receiving gifts. In fact, ford only sends
314−accepts one kiss and gives one gift. This is, of course, misleading
315−because ford actually does many different things. It does, however, only
316−produce one type of thing -- a result of a computation, which is either
317−an error or the value produced along with the set of dependencies
318−referenced by it.
319−
320− ++ kiss :: in request ->$
321− $% [%exec p=@p q=(unit silk)] :: make / kill
322− == ::
323−
324−The `%exec` gift requests ford to perform a computation on behalf of a
325−particular ship. `p` is the ship, and `q` is the computation. If `q` is
326−null, then we are requesting that ford cancel the computation that it is
327−currently being run along this duct. Thus, if you wish to cancel a
328−computation, you must send the kiss along the same duct as the original
329−request.
330−
331−Otherwise, we ask ford to perform a certain computation, as defined in
332−`++silk`. Since all computations produce the same type of result, we
333−will discuss that result before we jump into `++silk`.
334−
335− ++ gift :: out result <-$
336− $% [%made p=(each bead (list tank))] :: computed result
337− == ::
338−
339−We give either a `bead`, which is a result, or a list of tanks, which is
340−an error messge, often including a stack trace.
341−
342− ++ bead ,[p=(set beam) q=cage] :: computed result
343−
344−This is a set of dependencies required to compute this value and a cage
345−of the result with its associated mark.
346−
347−There are twelve possible computations defined in `++silk`.
348−
349− ++ silk :: construction layer
350− $& [p=silk q=silk] :: cons
351− $% [%bake p=mark q=beam r=path] :: local synthesis
352− [%boil p=mark q=beam r=path] :: general synthesis
353− [%call p=silk q=silk] :: slam
354− [%cast p=mark q=silk] :: translate
355− [%done p=(set beam) q=cage] :: literal
356− [%dude p=tank q=silk] :: error wrap
357− [%dune p=(set beam) q=(unit cage)] :: unit literal
358− [%mute p=silk q=(list (pair wing silk))] :: mutant
359− [%plan p=beam q=spur r=hood] :: structured assembly
360− [%reef ~] :: kernel reef
361− [%ride p=hoon q=silk] :: silk thru hoon
362− [%vale p=mark q=ship r=*] :: validate [our his]
363− == ::
364−
365−First, we allow silks to autocons. A cell of silks is also a silk, and
366−the product vase is a cell of the two silks. This obviously extends to
367−an arbitrary number of silks.
368−
369−`%bake` tries to functionally produce the file at a given beam with the
370−given mark and heel. It fails if there is no way to translate at this
371−level.
372−
373−`%boil` functionally produces the file at a given beam with the given
374−mark and heel. If there is no way to translate at this beam, we pop
375−levels off the stack and attempt to bake there until we find a level we
376−can bake. This should almost always be called instead of `%bake`.
377−
378−`%call` slams the result of one silk against the result of another.
379−
380−`%cast` translates the given silk to the given mark, if possible. This
381−is one of the critical and fundamental operations of ford.
382−
383−`%done` produces exactly its input. This is rarely used on its own, but
384−many silks are recursively defined in terms of other silks, so we often
385−need a silk that simply produces its input. A monadic return, if you
386−will.
387−
388−`%diff` diffs the two given silks (which must be of the same mark),
389−producing a cage of the mark specified in `++mark` in `++grad` for the
390−mark of the two silks.
391−
392−`%dude` computes the given silk with the given tank as part of the stack
393−trace if there is an error.
394−
395−`%dune` produces an error if the cage is empty. Otherwise, it produces
396−the value in the unit.
397−
398−`%mute` takes a silk and a list of changes to make to the silk. At each
399−wing in the list we put the value of the associated silk.
400−
401−`%pact` applies the second silk as a patch to the first silk. The second
402−silk must be of the mark specified in `++mark` in `++grad` for the mark
403−of the first silk.
404−
405−`%plan` performs a structured assembly directly. This is not generally
406−directly useful because several other silks perform supersets of this
407−functionality. We don't usually have naked hoods outside ford.
408−
409−`%reef` produces a core containing the entirety of zuse and hoon,
410−suitable for running arbitrary code against. The mark is `%noun`.
411−
412−`%ride` slaps a hoon against a subject silk. The mark of the result is
413−`%noun`.
414−
415−`%vale` validates untyped data from a ship against a given mark. This is
416−an extremely useful function.
417−
418−Commentary
419−==========
420−
421−Parsing Hook Files
422−------------------
423−
424−In the commentary on other vanes, we have traced through the lifecycle
425−of various external requests. This is generally a very reasonable order
426−to examine vanes since it will eventually cover the entire vane, and we
427−are never left wondering why we are doing something.
428−
429−For ford, however, it makes more sense to begin by discussing the
430−parsing and assembliing of hook files. Many of the possible requests
431−require us to assemble hook files, so we may as well examine this
432−immediately.
433−
434−First, we will examine the parsing. We parse a file at a beam to a hood
435−in `++fade:zo:za`. The top-level parsing rule is `++fair`, which takes a
436−beam and produces a rule to parse an entire hood file.
437−
438−A note on the naming scheme: the parsing the combinators that parse into
439−a particular structure are conventionally given the same name as the
440−structure. Although this locally clobbers the type names, this pattern
441−makes obvious the intent of the parsing combinators.
442−
443−We kick off with `++hood:fair`.
444−
445− ++ hood
446− %+ ifix [gay gay]
447− ;~ plug
448− ;~ pose
449− (ifix [;~(plug fas wut gap) gap] dem)
450− (easy zuse)
451− ==
452− ::
453− ;~ pose
454− (ifix [;~(plug fas hep gap) gap] (most ;~(plug com gaw) hoot))
455− (easy ~)
456− ==
457− ::
458− ;~ pose
459− (ifix [;~(plug fas lus gap) gap] (most ;~(plug com gaw) hoof))
460− (easy ~)
461− ==
462− ::
463− (star ;~(sfix horn gap))
464− (most gap hoop)
465− ==
466−
467−There are five sections to a hood: system version, structures,
468−libraries, resources, and body.
469−
470−First, we parse the requested version number of the system. This is
471−specified with a unary `/?` rune. If not present, then we default to the
472−current version.
473−
474−Second, we may have zero or more `/-` runes followed by a parsing of a
475−`++hoot`, which represents a shared structure.
476−
477−Third, we may have zero or more `/+` runes followed by a parsing of a
478−`++hoof`, which represents a shared library.
479−
480−Fourth, we may have zero or more other `/` runes (as described in
481−`++horn`), which represent program-specific resources to be loaded.
482−
483−Fifth and finally, we must have one or more body statements (hoops),
484−which are either direct hoons or `//` runes.
485−
486− ++ hoot
487− ;~ pose
488− (stag %| ;~(pfix tar hoof))
489− (stag %& hoof)
490− ==
491−
492−A structure can either be a direct gate, or it can be a simple core.
493−Either one is parsed with `++hoof`, so we distinguish the two cases by
494−requiring core references to be prefixed by a `*`.
495−
496− ++ hoof
497− %+ cook |=(a=^hoof a)
498− ;~ plug
499− sym
500− ;~ pose
501− %+ stag ~
502− ;~(plug ;~(pfix fas case) ;~(pfix ;~(plug fas sig) fed:ag))
503− (easy ~)
504− ==
505− ==
506−
507−A hoof must have a name, which is a term. Optionally, we also include a
508−case and a ship. This is marked by appending a `/` followed by a case to
509−denote the requested version of the resource and a `/` followed by a
510−ship name to denote the requested source of the resource. For example,
511−`resource/1/~zod` requests the first version of `resource` on `~zod`.
512−
513− ++ case
514− %- sear
515− :_ nuck:so
516− |= a=coin
517− ?. ?=([%$ ?(%da %ud %tas) *] a) ~
518− [~ u=(^case a)]
519−
520−Here, we parse a literal with `++nuck:so`, and we accept the input if it
521−is either an absolute date, an unsigned decimal, or a label.
522−
523−This leaves only horns and hoops to parse. Hoops are much simple to
524−parse, so we'll discuss those first.
525−
526− ++ hoop
527− ;~ pose
528− (stag %| ;~(pfix ;~(plug fas fas gap) have))
529− (stag %& tall:vez)
530− ==
531−
532−There are two types of hoops. Direct hoons are parsed with
533−`++tall:vast`, which is the just the Hoon parser for a tall-form rune.
534−
535−References to external hoons are marked with a `//` rune followed by a
536−beam, which is parsed with `++have`.
537−
538− ++ hath (sear plex:voz (stag %clsg poor:voz)) :: hood path
539− ++ have (sear tome ;~(pfix fas hath)) :: hood beam
540−
541−`++have` parses a path with `++hath`, and then it converts the path into
542−a beam with `++tome`.
543−
544−`++hath` parses a `/`-separated list with `++poor:vast`, then converts
545−it to an actual path with `++plex:vast`.
546−
547−This leaves only horns to parse.
548−
549− ++ horn
550− =< apex
551− =| tol=?
552− |%
553− ++ apex
554− %+ knee *^horn |. ~+
555− ;~ pfix fas
556− ;~ pose
557− (stag %toy ;~(sfix sym fas))
558− (stag %ape ;~(pfix sig ape:read))
559− (stag %arg ;~(pfix buc ape:read))
560− (stag %day ;~(pfix bar day:read))
561− (stag %dub ;~(pfix tis dub:read))
562− (stag %fan ;~(pfix dot fan:read))
563− (stag %for ;~(pfix com for:read))
564− (stag %hub ;~(pfix pat day:read))
565− (stag %man ;~(pfix tar man:read))
566− (stag %nap ;~(pfix cen day:read))
567− (stag %now ;~(pfix pam day:read))
568− (stag %saw ;~(pfix sem saw:read))
569− (stag %see ;~(pfix col see:read))
570− (stag %sic ;~(pfix ket sic:read))
571− ==
572− ==
573−
574−Horn parsing is slightly complex, so we create an internal core to
575−organize our code. Our core has a global variable of `tol`, which is
576−true if tall form is permissible and false if we're already in wide
577−form. We kick off the parsing with `++apex`.
578−
579−`++apex` specifies how each rune is parsed. This allows us to offload
580−the different ways of parsing the arguments to these runes into separate
581−arms. The exception here is that the `%toy` horn is simply of the form
582−`/mark/`.
583−
584−We'll examine each of the horn parsing arms right after we discuss
585−`++rail`, which is used in each one.
586−
587− ++ rail
588− |* [wid=_rule tal=_rule]
589− ?. tol wid
590− ;~(pose wid tal)
591−
592−This takes a wide-form and a tall-form parsing rule. If tall form is
593−permissible, then it allows either rule to match; else, it allows only
594−the wide form rule.
595−
596− ++ read
597− |% ++ ape
598− %+ rail
599− (ifix [sel ser] (stag %cltr (most ace wide:vez)))
600− ;~(pfix gap tall:vez)
601−
602−`++ape:read` parses for both the `/~` and the `/$` runes. It produces a
603−hoon. The wide form is a tuple of one or more ace-separated wide-form
604−hoons parsed with `++wide:vast` and surrounded by `[` and `]`. The tall
605−form is a single tall form hoon parsed by `++tall:vast`
606−
607− ++ day
608− %+ rail
609− apex(tol |)
610− ;~(pfix gap apex)
611−
612−This parses for the `/|`, `/@`, `/%`, and `/&` runes. It produces a
613−horn. The wide form is, recursively, the entire horn parser with tall
614−form disabled. The tall form is a gap followed by, recursively, the
615−entire horn parser.
616−
617− ++ dub
618− %+ rail
619− ;~(plug sym ;~(pfix tis apex(tol |)))
620− ;~(pfix gap ;~(plug sym ;~(pfix gap apex)))
621−
622−This parses for the `/=` rune. It produces a term followed by a horn.
623−The wide form is a symbol name followed by a `=` and, recursively, the
624−entire horn parser with tall form disabled. The tall form is a gap
625−followed by a symbol name, another gap, and, recursively, the entire
626−horn parser.
627−
628− ++ fan
629− %+ rail fail
630− ;~(sfix (star ;~(pfix gap apex)) ;~(plug gap duz))
631−
632−This parses for the `/.` rune. It produces a list of horns. There is no
633−wide form. The tall form is a stet-terminated series of gap-separated
634−recursive calls to the entire horn parser.
635−
636− ++ for
637− %+ rail
638− ;~(plug (ifix [sel ser] hath) apex(tol |))
639− ;~(pfix gap ;~(plug hath ;~(pfix gap apex)))
640−
641−This parses for the `/,` rune. It produces a path and a horn. The wide
642−form is a `[`-`]`-surrounded path followed by, recursively, the entire
643−horn parser with tall form disabled. The tall form is a gap followed by
644−a path, another gap, and, recursively, the entire horn parser.
645−
646− ++ man
647− %+ rail fail
648− %- sear
649− :_ ;~(sfix (star ;~(pfix gap apex)) ;~(plug gap duz))
650− |= fan=(list ^horn)
651− =| naf=(list (pair term ^horn))
652− |- ^- (unit (map term ^horn))
653− ?~ fan (some (~(gas by *(map term ^horn)) naf))
654− ?. ?=(%dub -.i.fan) ~
655− $(fan t.fan, naf [[p.i.fan q.i.fan] naf])
656−
657−This parses for the `/*` rune. It produces a map of spans to horns.
658−There is no wide form. The tall form is a stet-terminated series of
659−gap-separated recursive calls to the entire horn parser. All produced
660−horns are expected to be from `/=` runes. The term and horn in each `/=`
661−horn is inserted into the produced map as a key-value pair.
662−
663− ++ saw
664− %+ rail
665− ;~(plug ;~(sfix wide:vez sem) apex(tol |))
666− ;~(pfix gap ;~(plug tall:vez ;~(pfix gap apex)))
667−
668−This parses for the `/;` rune. It produces a hoon and a horn. The wide
669−form is a wide-form hoon followed by a `;` and, recursively, the entire
670−horn parser with tall form disabled. The tall form is a gap followed by
671−a tall-form hoon, another gap, and, recursively, the entire horn parser.
672−
673− ++ see
674− %+ rail
675− ;~(plug ;~(sfix have col) apex(tol |))
676− ;~(pfix gap ;~(plug have ;~(pfix gap apex)))
677−
678−This parses for the `/:` rune. It produces a beam and a horn. The wide
679−form is a beam followed by a `;` and, recursively, the entire horn
680−parser with tall form disabled. The tall form is a gap followed by a
681−beam, another gap, and, recursively, the entire horn parser.
682−
683− ++ sic
684− %+ rail
685− ;~(plug ;~(sfix toil:vez ket) apex(tol |))
686− ;~(pfix gap ;~(plug howl:vez ;~(pfix gap apex)))
687− --
688−
689−This parses for the `/^` rune. It produces a tile and a horn. The wide
690−form is a wide-form tile, parsed with `++toil:vast`, followed by a `^`
691−and, recursively, the entire horn parser with tall form disabled. The
692−tall form is a gap followed by a tall-form tile, parsed with
693−`++howl:vast`, another gap, and, recursively, the entire horn parser.
694−
695−Assembling Hook Files
696−---------------------
697−
698−At this point, we've parsed a hook file into a hood. We will now
699−describe exactly how this hood is assembled into a vase. The problem of
700−assembling is handled entirely within the `++meow:zo:za` core.
701−
702− ++ meow :: assemble
703− |= [how=beam arg=heel]
704− =| $: rop=(map term (pair hoof hoon)) :: structure/complex
705− zog=(set term) :: structure guard
706− bil=(map term (pair hoof hoon)) :: libraries known
707− lot=(list term) :: library stack
708− zeg=(set term) :: library guard
709− boy=(list hoon) :: body stack
710− hol=? :: horns allowed?
711− ==
712− |%
713−
714−We take two arguments and keep seven pieces of state. `how` is the
715−location of the hook file we're assembling, and `arg` is the heel, or
716−virtual path extension, of the file.
717−
718−In `rop`, we maintain a map of terms to pairs of hooves and hoons to
719−represent the structures we've encountered that we will put together in
720−a core at the top of the file.
721−
722−In `zog`, we maintain the set of structures we're in the middle of
723−loading. If we try to load a structure already in our dependency
724−ancestry, then we fail because we do not allow circular dependencies.
725−This enforces that our structure dependency graph is a DAG.
726−
727−In `bil`, we maintain a map of terms to pairs of hooves and hoons to
728−represent the libraries we've encountered that we will put together in a
729−series of cores after the structure core.
730−
731−In `lot`, we maintain a stack of library names as they are encountered
732−during a depth-first search. More precisely, we push a library onto the
733−stack after we've processed all its children. Thus, every library
734−depends only on things deeper in the list. The libraries must be loaded
735−in the reverse of this order. Concisely, this is a topological sort of
736−the library dependency partial ordering.
737−
738−In `zeg`, we maintain the set of libraries we're in the middle of
739−loading. If we try to load a library already in our dependency ancestry,
740−then we fail because we do not allow circular dependencies. This
741−enforces that our library dependency graph is a DAG.
742−
743−In `boy`, we maintain a stack of body hoons, which we'll put together in
744−a series of cores at the end of the file.
745−
746−In `hol`, we decide if we're allowed to contain horns. Libraries and
747−structures are not allowed to contain horns.
748−
749−We in every case enter `++meow` through `++abut`. You'll notice that
750−there are four (count 'em, four!) calls to `++cope` in `++abut`. If
751−you've glanced at the ford code in general, you've probably seen cope
752−over and over. It is called in 79 different places. We need to discuss
753−the use of this critical function in detail, so we may as well do it
754−here.
755−
756− ++ cope :: bolt along
757− |* [hoc=(bolt) fun=(burg)]
758− ?- -.q.hoc
759− %2 hoc
760− %1 hoc
761− %0 =+ nuf=(fun p.hoc q.q.hoc)
762− :- p=p.nuf
763− ^= q
764− ?- -.q.nuf
765− %2 q.nuf
766− %1 q.nuf
767− %0 [%0 p=(grom `_p.q.nuf`p.q.hoc p.q.nuf) q=q.q.nuf]
768− == ==
769−
770−In monad-speak, this is the bind operator for the bolt monad. If monads
771−aren't your thing, don't worry, we're going to explain the use of cope
772−without further reference to them.
773−
774−Recall that there are three different types of bolt. A `%2` error bolt
775−contains a list of tanks describing the error, a `%1` block bolt
776−contains a set of resources we're blocked on, and a `%0` value bolt
777−contains an actual value and the set of its dependencies.
778−
779−We most commonly want to perform an operation on the value in a bolt if
780−it is a `%0` bolt. If it's not a `%0` bolt, we want to leave it alone.
781−This requires us to write a certain amount of boilerplate between each
782−of our operations to see if any of them produced a `%1` or a `%2` bolt.
783−This gets tiresome, so we pull it out into a separate arm and call it
784−`++cope`.
785−
786−Intuitively, we're calling the function `fun` with the value in `hoc`,
787−where `fun` takes an argument of type whatever is the value in a `%0`
788−case of `hoc`, and it produces a bolt of some (possibly different) type.
789−For brevity, we will refer to the type of the of the value in the `%0`
790−case of a bolt as the "type of the bolt".
791−
792−If the `hoc` bolt we're given as input to `fun` is already a `%1` or a
793−`%2` bolt, then we simply produce that. We don't even try to run `fun`
794−on it.
795−
796−Otherwise, we run `fun` with the arguments from the bolt and, if it
797−produces a `%1` or a `%2` bolt, we simply produce that. If it produces a
798−`%0` bolt, then we produce that with the old set of dependencies merged
799−in with the new set.
800−
801−We'll see more about how the bolt monad works as we run into more
802−interesting uses of it. For now, this is sufficient to move on with
803−`++abut`.
804−
805− ++ abut :: generate
806− |= [cof=cafe hyd=hood]
807− ^- (bolt vase)
808− %+ cope (apex cof hyd)
809− |= [cof=cafe sel=_..abut]
810− =. ..abut sel
811− %+ cope (maim cof pit able)
812− |= [cof=cafe bax=vase]
813− %+ cope (chap cof bax [%fan fan.hyd])
814− |= [cof=cafe gox=vase]
815− %+ cope (maim cof (slop gox bax) [%tssg (flop boy)])
816− |= [cof=cafe fin=vase]
817− (fine cof fin)
818−
819−Our job is simple: we must assemble a hood file into a vase. Hopefully,
820−the usage of `++cope` is fairly understandable. The correct way to read
821−this is that it does essentially five things.
822−
823−First, we call `++apex` to process the structures, libraries, and body.
824−This changes our state, so we set our context to the produced context.
825−Second, we call `++able` to assemble the strucutres and libraries into a
826−hoon, which we slap against zuse with `++maim`. Third, we call `++chap`
827−to process the resources in the context of the already-loaded structures
828−and libraries. Fourth, we slap the body against the structures,
829−libraries, and resources. Fifth and finally, we produce the resultant
830−vase.
831−
832− ++ apex :: build to body
833− |= [cof=cafe hyd=hood]
834− ^- (bolt ,_..apex)
835− ?. |(hol ?=(~ fan.hyd))
836− %+ flaw cof :_ ~ :- %leaf
837− "horns not allowed in structures and libraries: {<[how arg]>}"
838− %+ cope (body cof src.hyd)
839− |= [cof=cafe sel=_..apex]
840− =. ..apex sel
841− %+ cope (neck cof lib.hyd)
842− |= [cof=cafe sel=_..apex]
843− =. ..apex sel(boy boy)
844− %+ cope (head cof sur.hyd)
845− |= [cof=cafe sel=_..apex]
846− (fine cof sel)
847−
848−First, we make sure that if we're not allowed to have horns, we don't.
849−Otherwise, we produce and error with `++flaw`.
850−
851− ++ flaw |=([a=cafe b=(list tank)] [p=a q=[%2 p=b]]) :: bolt from error
852−
853−This produces a `%2` error bolt from a list of tanks. Fairly trivial.
854−
855−We should be starting to get used to the cope syntax, so we can see that
856−we really only do three things here. We process the body with `++body`,
857−the libraries with `++neck`, and the structures with `++head`.
858−
859− ++ body :: produce functions
860− |= [cof=cafe src=(list hoop)]
861− ^- (bolt _..body)
862− ?~ src (fine cof ..body)
863− %+ cope (wilt cof i.src)
864− |= [cof=cafe sel=_..body]
865− ^$(cof cof, src t.src, ..body sel)
866−
867−We must process a list of hoops that represent our body. If there are no
868−more hoops, we just produce our context in a `%0` bolt with `++fine`.
869−
870− ++ fine |* [a=cafe b=*] :: bolt from data
871− [p=`cafe`a q=[%0 p=*(set beam) q=b]] ::
872−
873−In monad-speak, this is the return operator. For us, this just means
874−that we're producing a `%0` bolt, which contains a path and a set of
875−dependencies. We assume there are no dependencies for the given data, or
876−that they will be added later.
877−
878−If there are more hoops in `++body`, we call `++wilt` to process an
879−individual hoop and recurse.
880−
881− ++ wilt :: process body entry
882− |= [cof=cafe hop=hoop]
883− ^- (bolt _..wilt)
884− ?- -.hop
885− %& (fine cof ..wilt(boy [p.hop boy]))
886− %|
887− %+ cool |.(leaf/"ford: wilt {<[(tope p.hop)]>}")
888− %+ cope (lend cof p.hop)
889− |= [cof=cafe arc=arch]
890− ?: (~(has by r.arc) %hoon)
891− %+ cope (fade cof %hoon p.hop)
892− |= [cof=cafe hyd=hood]
893− %+ cope (apex(boy ~) cof hyd)
894− |= [cof=cafe sel=_..wilt]
895− (fine cof sel(boy [[%tssg boy.sel] boy]))
896− =+ [all=(lark (slat %tas) arc) sel=..wilt]
897− %+ cope
898− |- ^- (bolt (pair (map term foot) _..wilt))
899− ?~ all (fine cof ~ ..wilt)
900− %+ cope $(all l.all)
901− |= [cof=cafe lef=(map term foot) sel=_..wilt]
902− %+ cope ^$(all r.all, cof cof, sel sel)
903− |= [cof=cafe rig=(map term foot) sel=_..wilt]
904− %+ cope
905− %= ^^^^$
906− cof cof
907− ..wilt sel(boy ~)
908− s.p.hop [p.n.all s.p.hop]
909− ==
910− |= [cof=cafe sel=_..wilt]
911− %+ fine cof
912− [`(map term foot)`[[p.n.all [%ash [%tssg boy.sel]]] lef rig] sel]
913− |= [cof=cafe mav=(map term foot) sel=_..wilt]
914− ?~ mav
915− (flaw cof [%leaf "source missing: {<(tope p.hop)>}"]~)
916− (fine cof sel(boy [[%brcn mav] boy]))
917− ==
918−
919−In the case of a direct hoon hoop, we just push it onto `boy` and we're
920−done. In the case of an indirect hoop, we must compile the referenced
921−file.
922−
923−First, we push onto the stack trace a message indicating which file
924−exactly we're compiling at the moment with `++cool`.
925−
926− ++ cool :: error caption
927− |* [cyt=trap hoc=(bolt)]
928− ?. ?=(%2 -.q.hoc) hoc
929− [p.hoc [%2 *cyt p.q.hoc]]
930−
931−If an error occurred in computing `hoc`, we put the bunt of `cyt` onto
932−the stack trace. Thus, `cyt` is not evaluated at all unless an error
933−occurred.
934−
935−Next in `++wilt`, we load the information about the filesystem node
936−referenced by the hoop with `++lend`.
937−
938− ++ lend :: load arch
939− |= [cof=cafe bem=beam]
940− ^- (bolt arch)
941− =+ von=(ska %cy (tope bem))
942− ?~ von [p=cof q=[%1 [bem ~] ~ ~]]
943− (fine cof ((hard arch) (need u.von)))
944−
945−This is a simple call to the namespace. If the resource does not yet
946−exist, we block on it by producing a `%1` bolt. Otherwise, we cast it to
947−an arch and produce this.
948−
949−Continuing in `++wilt`, we examine the produced arch. If the referenced
950−filesystem node has a `hoon` child node, then we've found the required
951−source, so we parse it with `++fade`. Recall that we referred earlier to
952−`++fade`. The salient point there is that it takes a beam, reads in the
953−hook file there, and parses it into a hood file with `++fair`.
954−
955−Now, we simply recurse on `++apex` to compile the new hood. Note that,
956−while we do clear the `boy` list, we do not clear the other lists. Thus,
957−we are accumulating all the structures and libraries referenced in all
958−the referenced hook files in one group, which we will put at the top of
959−the product.
960−
961−After this, we put the new list of body hoons into a `=~`, push this
962−onto our old list of body hoons, and produce the result.
963−
964−If there is no hoon file here, then we descend into each of our children
965−until we find a hoon file. First, we produce a list of all our children
966−whose names are terms with `++lark`.
967−
968− ++ lark :: filter arch names
969− |= [wox=$+(span (unit ,@)) arc=arch]
970− ^- (map ,@ span)
971− %- ~(gas by *(map ,@ span))
972− =| rac=(list (pair ,@ span))
973− |- ^+ rac
974− ?~ r.arc rac
975− =. rac $(r.arc l.r.arc, rac $(r.arc r.r.arc))
976− =+ gib=(wox p.n.r.arc)
977− ?~(gib rac [[u.gib p.n.r.arc] rac])
978−
979−We traverse the children map of `arc` to filter out those children whose
980−names aren't accepted by `wox` and produce a map from the product of
981−`wox` to the original name. `++lark` is used in many cases to parse
982−names into other types, like numbers or dates, ignoring those which do
983−not fit the format. In `++wilt`, though, we simply want to filter out
984−those children whose names are not terms.
985−
986−Next, we will produce a map from terms to feet. Each of these feet will
987−be placed in a core named by the child name, and it will contain arms
988−according to its children. Thus, if the indirect hoop references
989−`/path`, then to access the hoon defined in `/path/to/hoon/hoon`, our
990−body must refer to `hoon:to`.
991−
992−If there are no more children, then we are done, so we produce our
993−current context.
994−
995−Else, we recurse into the left and right sides of our map. Finally, we
996−process our current entry in the map. We first recurse by calling
997−`++wilt` one level down. Thus, in the previous example, the first time
998−we get to this point we are processing `/path`, so we recurse on
999−`++wilt` with path `/path/to`. We also remove our current body from the
1000−recursion, so that we may add it back in later the way we want to.
1001−
1002−After recursing, we push the new body onto our map, keyed by its name.
1003−We also produce the new context so that all external structures,
1004−libraries, and resources are collected into the same place.
1005−
1006−Finally, we have a map of names to feet. If this map is empty, then
1007−there were no hoons at the requested path, so we give an error with
1008−`++flaw`.
1009−
1010−If the map is nonempty, then we finally produce our context with with
1011−one thing pushed onto the front: a core made out of the map we just
1012−produced.
1013−
1014−This concludes our discussion of `++wilt` and `++body`. Thus, it remains
1015−in `++apex` to discuss `++neck` and `++head`.
1016−
1017− ++ neck :: consume libraries
1018− |= [cof=cafe bir=(list hoof)]
1019− ^- (bolt ,_..neck)
1020− ?~ bir (fine cof ..neck)
1021− ?: (~(has in zeg) p.i.bir)
1022− (flaw cof [%leaf "circular library dependency: {<i.bir>}"]~)
1023− =+ gez=(~(put in zeg) p.i.bir)
1024− =+ byf=(~(get by bil) p.i.bir)
1025− ?^ byf
1026− ?. =(`hoof`i.bir `hoof`p.u.byf)
1027− (flaw cof [%leaf "library mismatch: {<~[p.u.byf i.bir]>}"]~)
1028− $(bir t.bir)
1029− =+ bem=(hone %core %lib i.bir)
1030− %+ cope (fade cof %hook bem)
1031− |= [cof=cafe hyd=hood]
1032− %+ cope (apex(zeg gez, hol |, boy ~) cof hyd)
1033− |= [cof=cafe sel=_..neck]
1034− =. ..neck
1035− %= sel
1036− zeg zeg
1037− hol hol
1038− lot [p.i.bir lot]
1039− bil (~(put by bil) p.i.bir [i.bir [%tssg (flop boy.sel)]])
1040− ==
1041− ^^$(cof cof, bir t.bir)
1042−
1043−Here, we're going to consume the list of libraries and place them in
1044−`bil`. If there are no more libraries, we're done, so we just produce
1045−our current context.
1046−
1047−Otherwise, we check to see if the next library in the list is in `zeg`.
1048−If so, then this library is one of the libraries that we're already in
1049−the middle of compiling. There is a circular dependency, so we fail.
1050−
1051−Otherwise, we let `gez` be `zeg` plus the current library so that while
1052−compiling the dependencies of this library we don't later create a
1053−circular dependency. We check next to see if this library is alredy in
1054−`bil`. If so, then we have already included this library earlier, so we
1055−check to see if this is the same version of the library as we included
1056−earlier. If so, we skip it. Else, we fail since we can't include two
1057−different versions of a library. We really should allow for newer
1058−versions of a library since in kelvin versioning we assume backwards
1059−compatibility, but for now we require an exact match.
1060−
1061−If we haven't already included this library, then we're going to do
1062−that. First, we get the location of the library with `++hone`.
1063−
1064− ++ hone :: plant hoof
1065− |= [for=@tas way=@tas huf=hoof]
1066− ^- beam
1067− ?~ q.huf
1068− how(s ~[for p.huf way])
1069− [[q.u.q.huf %main p.u.q.huf] ~[for p.huf way]]
1070−
1071−If we haven't specified the version of the library, we use the current
1072−ship, desk, and case. Otherwise, we use the given ship and case on desk
1073−`%main`. In either case, the path is `/way/p.huf/for`. In the case of
1074−`++neck`, this means `/lib/core/[library name]`.
1075−
1076−In `++neck`, we next compile the hook file at that location with
1077−`++fade`. Again, we will delay the discussion of `++fade`, noting only
1078−that it takes a beam and parses the hook file there into a hood.
1079−
1080−We recurse on this to compile the library. During the compilation, we
1081−let `zeg` be `gez` to avoid circular dependencies, we let `hol` be false
1082−since we don't allow horns in libraries, and we let `boy` be null so
1083−that we can isolate the new body hoons.
1084−
1085−Next, we reintegrate the new data into our context. We use the context
1086−created by the recursion with four changes. First, we reset `zeg` to our
1087−old `zeg`. Second, we reset `hol` to our old `hol`. Third, we put the
1088−name of our library onto the stack of libraries. This means all of a
1089−libraries dependencies will be earlier in `lot` than the library itself,
1090−making `lot` a topological ordering on the dependency graph. Fourth, we
1091−put in `bil` the library hoof and body (with all body hoons collected in
1092−a `=~`), keyed by the library name.
1093−
1094−Finally, we recurse, processing the next library in our list.
1095−
1096−To complete our disucssion of `++apex`, we must process our structures.
1097−
1098− ++ head :: consume structures
1099− |= [cof=cafe bir=(list hoot)]
1100− |- ^- (bolt ,_..head)
1101− ?~ bir
1102− (fine cof ..head)
1103− ?: (~(has in zog) p.q.i.bir)
1104− (flaw cof [%leaf "circular structure dependency: {<i.bir>}"]~)
1105− =+ goz=(~(put in zog) p.q.i.bir)
1106− =+ byf=(~(get by rop) p.q.i.bir)
1107− ?^ byf
1108− ?. =(`hoof`q.i.bir `hoof`p.u.byf)
1109− (flaw cof [%leaf "structure mismatch: {<~[p.u.byf q.i.bir]>}"]~)
1110− $(bir t.bir)
1111− =+ bem=(hone ?:(p.i.bir %gate %core) %sur q.i.bir)
1112− %+ cope (fade cof %hook bem)
1113− |= [cof=cafe hyd=hood]
1114− %+ cope (apex(zog goz, hol |, boy ~) cof hyd)
1115− |= [cof=cafe sel=_..head]
1116− ?. =(bil bil.sel)
1117− (flaw cof [%leaf "structures cannot include libraries: {<i.bir>}"]~)
1118− =. ..head
1119− %= sel
1120− boy ?: p.i.bir
1121− boy
1122− (welp boy [[[%cnzy p.q.i.bir] [%$ 1]] ~])
1123− zog zog
1124− hol hol
1125− rop %+ ~(put by (~(uni by rop) rop.sel))
1126− p.q.i.bir
1127− [q.i.bir [%tssg (flop boy.sel)]]
1128− ==
1129− ^^$(cof cof, bir t.bir)
1130−
1131−The processing of our structures is very similar to that of our
1132−libraries. For clarity, we'll use many of the same phrases in describing
1133−the parallel natures. First, we check to see if there are more
1134−structures to process. If not, we're done, so we produce our context.
1135−
1136−Otherwise, we let `goz` be `zog` plus the current structure so that
1137−while compiling the dependencies of this structure we don't later create
1138−a circular dependency. We check next to see if this structure is already
1139−in `rop`. If so, then we have already included this structure earlier,
1140−so we check to see if this is the same version of the structure as we
1141−included earlier. If so, we skip it. Else, we fail since we can't
1142−include two different versions of a structure.
1143−
1144−If we haven't loaded this structure, then we call `++hone` to get the
1145−beam where the file structure should be. If the loobean in the hoot is
1146−true, then we're looking for a gate; otherwise, we're looking for a
1147−core. We parse this file with `++fade`.
1148−
1149−Now, we recurse on this to compile the structure. During the recursion,
1150−there we have three changes. Frist, we let `zog` be `goz` so that we
1151−don't create a circular dependency. Second, we let `hol` be false since
1152−we do not allow horns in structures. Third, we let `boy` be null so that
1153−we can isolate the new body hoons.
1154−
1155−Next, we reintegrate the new data into our context. We use the context
1156−cretaed by the recursion with four changes. First, if we're including a
1157−gate structure, then we reset the body to its original body. Else we put
1158−on the top of our list of body hoons what is essentially a
1159−`=+ structure-name` to take off the face of the structure. Second, we
1160−reset `zog` to our old `zog`. Third, we reset `hol` to our old `hol`.
1161−Finally, we put in `rop` the structure hoof and body (with all body
1162−hoongs collected in a `=~`), keyed by the structure name.
1163−
1164−Finally, we recurse, processing the next structure in our list.
1165−
1166−This concludes our discussion of `++apex`.
1167−
1168− ++ abut :: generate
1169− |= [cof=cafe hyd=hood]
1170− ^- (bolt vase)
1171− %+ cope (apex cof hyd)
1172− |= [cof=cafe sel=_..abut]
1173− =. ..abut sel
1174− %+ cope (maim cof pit able)
1175− |= [cof=cafe bax=vase]
1176− %+ cope (chap cof bax [%fan fan.hyd])
1177− |= [cof=cafe gox=vase]
1178− %+ cope (maim cof (slop gox bax) [%tssg (flop boy)])
1179− |= [cof=cafe fin=vase]
1180− (fine cof fin)
1181−
1182−Returning to `++abut`, we have now processed the structures, libraries
1183−and body hoons. Next, we slap our preamble (structures and libraries)
1184−against zuse. First, we construct our preamble in `++able`.
1185−
1186− ++ able :: assemble preamble
1187− ^- hoon
1188− :+ %tsgr
1189− ?:(=(~ rop) [%$ 1] [%brcn (~(run by rop) |=([* a=hoon] [%ash a]))])
1190− [%tssg (turn (flop lot) |=(a=term q:(need (~(get by bil) a))))]
1191−
1192−We first put the structures in `rop` into a single `|%` at the top and
1193−`=>` it onto a `=~` of our libraries, in the reverse order that they
1194−appear in `lot`. Thus, the structures are in a single core while the
1195−libraries are in consecutive cores.
1196−
1197−We slap the preamble against zuse with `++maim`.
1198−
1199− ++ maim :: slap
1200− |= [cof=cafe vax=vase gen=hoon]
1201− ^- (bolt vase)
1202− %+ (clef %slap) (fine cof vax gen)
1203− |= [cof=cafe vax=vase gen=hoon]
1204− =+ puz=(mule |.((~(mint ut p.vax) [%noun gen])))
1205− ?- -.puz
1206− | (flaw cof p.puz)
1207− & %+ (coup cof) (mock [q.vax q.p.puz] (mole ska))
1208− |= val=*
1209− `vase`[p.p.puz val]
1210− ==
1211−
1212−Here we start to get into ford's caching system. We wrap our computation
1213−in a call to `++clef` so that we only actually compute it if the result
1214−is not already in our cache. First we'll discuss the computation, then
1215−we'll discuss the caching system.
1216−
1217−We call `++mule` with a call to `++mint:ut` on the type of our subject
1218−vase against the given hoon. In other words, we're compiling the hoon
1219−with against the subject type in the given subject vase.
1220−
1221−If compilation fails, then we produce an error bolt with the produced
1222−stack trace. Otherwise, we run the produced nock with `++mock` and our
1223−sky function. We convert the produced toon to a bolt with `++coup` and
1224−use the type from `puz` combined with the value from `mock` to produce
1225−our vase.
1226−
1227−If this process seems harder than just calling `++slap`, it's because it
1228−is. We have two requirements that `++slap` doesn't satisfy. First, we
1229−want the to use an explicit sky function for use with `.^`. With
1230−`++slap`, you get whatever sky function is available in the calling
1231−context, which in ford is none. Second, we want to explicitly handle the
1232−stack trace on failure. `++slap` would cause crash on failure.
1233−
1234−We haven't yet discussed either `++clef` or `++coup`. We'll start with
1235−`++coup` to finish the discussion of the computation.
1236−
1237−\``++ coup :: toon to bolt |= cof=cafe |* [ton=toon fun=$+(* *)] :- p=cof ^= q ?- -.ton %2 [%2 p=p.ton] %0 [%0 p=*(set beam) q=(fun p.ton)] %1 ~& [%coup-need ((list path) p.ton)] =- ?- -.faw & [%1 p=(sa (turn p.faw |=(a=beam [a *(list tank)])))] | [%2 p=p.faw] == ^= faw |- ^- (each (list beam) (list tank)) ?~ p.ton [%& ~] =+ nex=$(p.ton t.p.ton) =+ pax=(path i.p.ton) ?~ pax [%| (smyt pax) ?:(?=(& -.nex) ~ p.nex)] =+ zis=(tome t.pax) ?~ zis [%| (smyt pax) ?:(?=(& -.nex) ~ p.nex)] ?- -.nex & [%& u.zis p.nex] | nex == ==`
1238−
1239−Recall that a toon is either a `%0` value, a `%1` block, or a `%2`
1240−failure. Converting a `%2` toon failure into a `%2` bolt failure is
1241−trivial. Converting a `%0` toon value into a `%0` bolt value is easy
1242−since we assume there were no dependencies. Converting the blocks is
1243−rather more difficult.
1244−
1245−To compute `faw`, we recurse through the list of paths in the `%1` toon.
1246−At each one, we make sure with `++tome` that it is, in fact, a beam. If
1247−so, then we check to see if the later paths succeed as well. If so, we
1248−append the current path to the list of other paths. If not, we produce
1249−the error message we got from processing the rest of the paths. If this
1250−path is not a beam, then we fail, producing a list of tanks including
1251−this path and, if later paths fail too, those paths as well.
1252−
1253−If some paths were not beams, then we produce a `%2` error bolt. If all
1254−paths were correct, then we produce a `%1` blocking bolt.
1255−
1256−We will now discuss `++clef`. This is where the cache magic happens.
1257−
1258− ++ clef :: cache a result
1259− |* sem=*
1260− |* [hoc=(bolt) fun=(burg)]
1261− ?- -.q.hoc
1262− %2 hoc
1263− %1 hoc
1264− %0
1265− =^ cux p.hoc ((calk p.hoc) sem q.q.hoc)
1266− ?~ cux
1267− =+ nuf=(cope hoc fun)
1268− ?- -.q.nuf
1269− %2 nuf
1270− %1 nuf
1271− %0
1272− :- p=(came p.nuf `calx`[sem `calm`[now p.q.nuf] q.q.hoc q.q.nuf])
1273− q=q.nuf
1274− ==
1275− [p=p.hoc q=[%0 p=p.q.hoc q=((calf sem) u.cux)]]
1276− ==
1277−
1278−If the value is already an error or a block, we just pass that through.
1279−Otherwise, we look up the request in the cache with `++calk`.
1280−
1281− ++ calk :: cache lookup
1282− |= a=cafe ::
1283− |= [b=@tas c=*] ::
1284− ^- [(unit calx) cafe] ::
1285− =+ d=(~(get by q.a) [b c]) ::
1286− ?~ d [~ a] ::
1287− [d a(p (~(put in p.a) u.d))] ::
1288−
1289−When looking up something in the cache, we mark it if we find it. This
1290−way, we have in our cache the set of all cache entries that have been
1291−referenced. While we do not at present do anything with this data, it
1292−should be used to clear out old and unused entries in the cache.
1293−
1294−Moving on in `++clef`, we check to see if we actually found anything. If
1295−we didn't find a cache entry, then we run the computation in `fun`, and
1296−examine its result. If it produced a `%2` error or `%1` block bolt, we
1297−just pass that through. Otherwise, we produce both the value and an
1298−updated cache with this new entry. We add the entry with `++came`.
1299−
1300− ++ came ::
1301− |= [a=cafe b=calx] :: cache install
1302− ^- cafe ::
1303− a(q (~(put by q.a) [-.b q.b] b)) ::
1304−
1305−We key cache entries by the type of computation (`-:calx`) and the
1306−inputs to the computation (`q:calc`). This just puts the cache line in
1307−the cache at the correct key.
1308−
1309−Back in `++clef`, if we did find a cache entry, then we just produce the
1310−value at that cache line. We convert the cache line into a value with
1311−`++calf`.
1312−
1313− ++ calf :: reduce calx
1314− |* sem=* :: a typesystem hack
1315− |= cax=calx
1316− ?+ sem !!
1317− %hood ?>(?=(%hood -.cax) r.cax)
1318− %slap ?>(?=(%slap -.cax) r.cax)
1319− %slam ?>(?=(%slam -.cax) r.cax)
1320− ==
1321−
1322−This is simply a typesystem hack. Because the `sem` is passed in through
1323−a wet gate, we know at type time which of the three cases will be
1324−chosen. Thus, the correct type of the value in the cache line gets
1325−passed through to the caller. This also depends on the fact that
1326−`++clef` is wet. The type stuff here is mathematically interesting, but
1327−the action is simple: we get the value from the cache line.
1328−
1329−This concludes our discussion of `++clef` and `++maim`.
1330−
1331−Back in `++abut`, recall that we processed the structures, libraries,
1332−and body with `++apex`. Then, we slapped our preamble (structures and
1333−libraries) against zuse with `++maim`. Next, we process our resources
1334−with `++chap`. Note that we pass in the preamble so that we may refer to
1335−anything in there in our resources.
1336−
1337−`++chap` is broken up into a different case for each horn. We'll go
1338−through them one by one.
1339−
1340− ++ chap :: produce resources
1341− |= [cof=cafe bax=vase hon=horn]
1342− ^- (bolt vase)
1343− ?- -.hon
1344− %ape (maim cof bax p.hon)
1345−
1346−This is `/~`. We slap the hoon against our context.
1347−
1348− %arg
1349− %+ cope (maim cof bax p.hon)
1350− |= [cof=cafe gat=vase]
1351− (maul cof gat !>([how arg]))
1352−
1353−This is `/$`. We slap the hoon against our context, which we expect to
1354−produce a gate. We slam this gate with a sample of `how` and `arg`,
1355−which is our location and the heel (virtual path extension).
1356−
1357−`++maul` is similar to `++maim`, but it slams instead of slaps.
1358−
1359− ++ maul :: slam
1360− |= [cof=cafe gat=vase sam=vase]
1361− ^- (bolt vase)
1362− %+ (clef %slam) (fine cof gat sam)
1363− |= [cof=cafe gat=vase sam=vase]
1364− =+ top=(mule |.((slit p.gat p.sam)))
1365− ?- -.top
1366− | (flaw cof p.top)
1367− & %+ (coup cof) (mong [q.gat q.sam] (mole ska))
1368− |= val=*
1369− `vase`[p.top val]
1370− ==
1371−
1372−We cache slams exactly as we cache slaps. We use `++slit` to find the
1373−type of the product of the slam given the types of the gate and the
1374−sample.
1375−
1376−If this type fails, we produce the given stack trace as a `%2` error
1377−bolt. Otherwise, we produce the top produced above combined with the
1378−value we get from slamming the values in the vases with `++mong`.
1379−
1380−Back to `++chap`.
1381−
1382− %day (chad cof bax %dr p.hon)
1383−
1384−This is `/|`. We call `++chad` to convert textual names to relative
1385−dates and process the next horn against each of the discovered paths.
1386−
1387− ++ chad :: atomic list
1388− |= [cof=cafe bax=vase doe=term hon=horn]
1389− ^- (bolt vase)
1390− %+ cope ((lash (slat doe)) cof how)
1391− |= [cof=cafe yep=(map ,@ span)]
1392− =+ ^= poy ^- (list (pair ,@ span))
1393− %+ sort (~(tap by yep) ~)
1394− |=([a=[@ *] b=[@ *]] (lth -.a -.b))
1395− %+ cope
1396− |- ^- (bolt (list (pair ,@ vase)))
1397− ?~ poy (fine cof ~)
1398− %+ cope $(poy t.poy)
1399− |= [cof=cafe nex=(list (pair ,@ vase))]
1400− %+ cope (chap(s.how [q.i.poy s.how]) cof bax hon)
1401− |= [cof=cafe elt=vase]
1402− (fine cof [[p.i.poy elt] nex])
1403− |= [cof=cafe yal=(list (pair ,@ vase))]
1404− %+ fine cof
1405− |- ^- vase
1406− ?~ yal [[%cube 0 [%atom %n]] 0]
1407− (slop (slop [[%atom doe] p.i.yal] q.i.yal) $(yal t.yal))
1408−
1409−First, we call `++lash` to parse the children of the current beam and
1410−pick out those ones that are of the requested format.
1411−
1412− ++ lash :: atomic sequence
1413− |= wox=$+(span (unit ,@))
1414− |= [cof=cafe bem=beam]
1415− ^- (bolt (map ,@ span))
1416− %+ cope (lend cof bem)
1417− |= [cof=cafe arc=arch]
1418− (fine cof (lark wox arc))
1419−
1420−First, we get the arch with `++lend`, as described above. We filter and
1421−parse the child names with `++lark` according to the given parser
1422−function.
1423−
1424−In `++chad`, this parser function is `(slat doe)`, which will parse a
1425−cord into an atom of the requested odor. For `%day` the odor is for
1426−relative dates.
1427−
1428−Thus, we now have a map from atoms of the given odor to the actual child
1429−names. We next turn this map into a list and sort it in increasing order
1430−by the atom.
1431−
1432−We next convert this list of pairs of atoms and spans to a list of pairs
1433−of atoms and vases. We process the given horn once at every child beam,
1434−producing the resource at that location.
1435−
1436−Finally, we convert this list of pairs of atoms and vases to a vase of a
1437−list of pairs of atoms to (well-typed) values. Each entry in the list is
1438−of type atom with the given odor combined with the type of the produced
1439−vase.
1440−
1441−Back in `++chap`, we continue parsing resources.
1442−
1443− %dub
1444− %+ cope $(hon q.hon)
1445− |= [cof=cafe vax=vase]
1446− (fine cof [[%face p.hon p.vax] q.vax])
1447−
1448−This is `/=`. We process the given horn, giving us a vase. We put as a
1449−face on the vase so that it may be referred to later by name.
1450−
1451− %fan
1452− %+ cope
1453− |- ^- (bolt (list vase))
1454− ?~ p.hon (fine cof ~)
1455− %+ cope ^$(hon i.p.hon)
1456− |= [cof=cafe vax=vase]
1457− %+ cope ^$(cof cof, p.hon t.p.hon)
1458− |= [cof=cafe tev=(list vase)]
1459− (fine cof [vax tev])
1460− |= [cof=cafe tev=(list vase)]
1461− %+ fine cof
1462− |- ^- vase
1463− ?~ tev [[%cube 0 [%atom %n]] 0]
1464− (slop i.tev $(tev t.tev))
1465−
1466−This is `/.`. We first process each of the child horns, producing a list
1467−of vases. This is done by just recursing on `++chap`. Then, we simply
1468−fold over this list to create a vase of the list of values.
1469−
1470− %for $(hon q.hon, s.how (weld (flop p.hon) s.how))
1471−
1472−This is `/,`. We simply recurse on the horn with the given path welded
1473−onto our current beam.
1474−
1475− %hub (chad cof bax %ud p.hon)
1476−
1477−This is `/@`. This is exactly like the processing of `%day` except we
1478−expect the children to be named as unsigned integers rather than
1479−relative dates. We process the horn at each of the children's locations
1480−and produce a list of pairs of absolute dates and values.
1481−
1482− %man
1483− |- ^- (bolt vase)
1484− ?~ p.hon (fine cof [[%cube 0 [%atom %n]] 0])
1485− %+ cope $(p.hon l.p.hon)
1486− |= [cof=cafe lef=vase]
1487− %+ cope ^$(cof cof, p.hon r.p.hon)
1488− |= [cof=cafe rig=vase]
1489− %+ cope ^^^$(cof cof, hon q.n.p.hon)
1490− |= [cof=cafe vax=vase]
1491− %+ fine cof
1492− %+ slop
1493− (slop [[%atom %tas] p.n.p.hon] vax)
1494− (slop lef rig)
1495−
1496−This is `/*`. We process each of the horns in the given map by recursion
1497−through `++chap`. Once we have these vases, we create a vase of a map
1498−from the given textual names to the produced values.
1499−
1500− %now (chad cof bax %da p.hon)
1501−
1502−This is `/&`. This is exactly like the processing of `%now` except we
1503−expect the children to be names as absolute dates rather than relative
1504−dates. We process the horn at each of the children's locations and
1505−produce a list of pairs of absolute dates and values.
1506−
1507− %nap (chai cof bax p.hon)
1508−
1509−This is `/%`. Here, we process the horn at each of our children with
1510−`++chai`.
1511−
1512− ++ chai :: atomic map
1513− |= [cof=cafe bax=vase hon=horn]
1514− ^- (bolt vase)
1515− %+ cope (lend cof how)
1516− |= [cof=cafe arc=arch]
1517− %+ cope
1518− |- ^- (bolt (map ,@ vase))
1519− ?~ r.arc (fine cof ~)
1520− %+ cope $(r.arc l.r.arc)
1521− |= [cof=cafe lef=(map ,@ vase)]
1522− %+ cope `(bolt (map ,@ vase))`^$(cof cof, r.arc r.r.arc)
1523− |= [cof=cafe rig=(map ,@ vase)]
1524− %+ cope (chap(s.how [p.n.r.arc s.how]) cof bax hon)
1525− |= [cof=cafe nod=vase]
1526− (fine cof [[p.n.r.arc nod] lef rig])
1527− |= [cof=cafe doy=(map ,@ vase)]
1528− %+ fine cof
1529− |- ^- vase
1530− ?~ doy [[%cube 0 [%atom %n]] 0]
1531− %+ slop
1532− (slop [[%atom %a] p.n.doy] q.n.doy)
1533− (slop $(doy l.doy) $(doy r.doy))
1534−
1535−We get the arch at our current beam with `++lend`. Then, we process the
1536−horn at each of our children to give us a map of atoms to vases.
1537−Finally, we convert that into a vase of a map of these atoms to the
1538−values. This is very similar to `++chad` and the handling of `%man`.
1539−
1540− %see $(hon q.hon, how p.hon)
1541−
1542−This is `/:`. We process the given horn at the given beam.
1543−
1544− %saw
1545− %+ cope $(hon q.hon)
1546− |= [cof=cafe sam=vase]
1547− %+ cope (maim cof bax p.hon)
1548− |= [cof=cafe gat=vase]
1549− (maul cof gat sam)
1550−
1551−This is `/;`. First, we process the given horn. Then, we slap the given
1552−hoon against our context to produce (hopefully) a gate. Finally, we slam
1553−the vase we got from processing the horn against the gate.
1554−
1555− %sic
1556− %+ cope $(hon q.hon)
1557− |= [cof=cafe vax=vase]
1558− %+ cope (maim cof bax [%bctr p.hon])
1559− |= [cof=cafe tug=vase]
1560− ?. (~(nest ut p.tug) | p.vax)
1561− (flaw cof [%leaf "type error: {<p.hon>} {<q.hon>}"]~)
1562− (fine cof [p.tug q.vax])
1563−
1564−This is `/^`. First, we process the given horn. Then, we slap the the
1565−bunt of the given tile against our context. This will produce a vase
1566−with the correct type. We test to see if this type nests within the type
1567−of the vase we got from processing the horn. If so, we produce the value
1568−from the horn along with the type from the tile. Otherwise, we produce a
1569−`%2` error bolt.
1570−
1571− %toy (cope (make cof %bake p.hon how ~) feel)
1572− ==
1573−
1574−This is `/mark/`. Here, we simply run the `%bake` silk on the given
1575−mark, producing a cage. We convert this cage into a vase with `++feel`,
1576−which is exactly as simple as it sounds like it should be.
1577−
1578− ++ feel |=([a=cafe b=cage] (fine a q.b)) :: cage to vase
1579−
1580−This is trivial.
1581−
1582−We will discuss later `++make` and how `%bake` is processed. Suffice it
1583−to say that baking a resource with a given mark gets the resource and
1584−converts it, if necessary, to the requested mark.
1585−
1586−This concludes our discussion of `++chap`.
1587−
1588−We return once more to `++abut`.
1589−
1590− ++ abut :: generate
1591− |= [cof=cafe hyd=hood]
1592− ^- (bolt vase)
1593− %+ cope (apex cof hyd)
1594− |= [cof=cafe sel=_..abut]
1595− =. ..abut sel
1596− %+ cope (maim cof pit able)
1597− |= [cof=cafe bax=vase]
1598− %+ cope (chap cof bax [%fan fan.hyd])
1599− |= [cof=cafe gox=vase]
1600− %+ cope (maim cof (slop gox bax) [%tssg (flop boy)])
1601− |= [cof=cafe fin=vase]
1602− (fine cof fin)
1603−
1604−Recall that we processed our structures, libraries and body with
1605−`++apex`. We slapped our structures and libraries against zuse with
1606−`++maim`. We processed our resources with `++chap`. Now, all our body
1607−hoons are collected in a `=~` and slapped against our structures,
1608−libraries, and resources. This produces our final result.
1609−
1610−The hook file has been assembled. And there was great rejoicing.
1611−
1612−Lifecycle of a Kiss
1613−-------------------
1614−
1615−We're now going to go through a series of lifecycle descriptions. When a
1616−user of ford sends a kiss, it is one of a dozen different types of silk.
1617−We'll go through each one, tracing through the flow of control of each
1618−of these.
1619−
1620−First, though, we'll describe the common handling to all kisses.
1621−
1622−The silk in a `%exec` kiss to ford ends up in `++apex`, so we'll enter
1623−the narrative here.
1624−
1625− ++ apex :: call
1626− |= kus=(unit silk)
1627− ^+ +>
1628− ?~ kus
1629− =+ nym=(~(get by dym.bay) hen)
1630− ?~ nym :: XX should never
1631− ~& [%ford-mystery hen]
1632− +>.$
1633− =+ tas=(need (~(get by q.tad.bay) u.nym))
1634− amok:~(camo zo [u.nym tas])
1635− =+ num=p.tad.bay
1636− ?< (~(has by dym.bay) hen)
1637− =: p.tad.bay +(p.tad.bay)
1638− dym.bay (~(put by dym.bay) hen num)
1639− ==
1640− ~(exec zo [num `task`[hen u.kus 0 ~]])
1641−
1642−Recall that a `%exec` kiss actually sends a unit silk. If it's null,
1643−we're trying to cancel the request. We first look up the task number
1644−keyed by duct. If we don't find it, then we're trying to cancel a
1645−request that either was never started or has already completed. We print
1646−out `%ford-mystery` and do nothing. If we do find the task number, then
1647−we look up the task from it, call `++camo:zo` to cancel pending
1648−requests, and call `++amok:zo` to remove the task from our task lists.
1649−
1650− ++ camo :: stop requests
1651− ^+ .
1652− =+ kiz=(~(tap by q.kig) *(list ,[p=@ud q=beam]))
1653− |- ^+ +>
1654− ?~ kiz +>
1655− %= $
1656− kiz t.kiz
1657− mow :_ mow
1658− :- hen
1659− :^ %pass [(scot %p our) (scot %ud num) (scot %ud p.i.kiz) ~]
1660− %c
1661− [%warp [our p.q.i.kiz] q.q.i.kiz ~]
1662− ==
1663−
1664−Our list of blocks is in `q.kig`, so we iterate over it, cancelling our
1665−pending requests for each block. Our requests are all to clay, so we
1666−need only to send `%warp` kisses with a null instead of a rave.
1667−
1668− ++ amok
1669− %_ ..zo
1670− q.tad.bay (~(del by q.tad.bay) num)
1671− dym.bay (~(del by dym.bay) nah)
1672− ==
1673−
1674−We remove the task number from the map of numbers to tasks and the duct
1675−from the map of ducts to task numbers.
1676−
1677−Back in `++apex`, if we were given a silk, we need to process it. We add
1678−the task to our maps, increment the next task number, and call
1679−`++exec:zo` on the new task.
1680−
1681− ++ exec :: execute app
1682− ^+ ..zo
1683− ?: !=(~ q.kig) ..zo
1684− |- ^+ ..zo
1685− =+ bot=(make [~ jav.bay] kas)
1686− =. ..exec (dash p.bot)
1687− ?- -.q.bot
1688− %0 amok:(expo [%made %& p.q.bot q.q.bot])
1689− %2 amok:(expo [%made %| p.q.bot])
1690− %1 =+ zuk=(~(tap by p.q.bot) ~)
1691− =< abet
1692− |- ^+ ..exec
1693− ?~ zuk ..exec
1694− =+ foo=`_..exec`(camp %x `beam`p.i.zuk)
1695− $(zuk t.zuk, ..exec foo)
1696− ==
1697−
1698−If we're still blocked on something in `q.kig`, we don't do anything.
1699−
1700−Otherwise, we try to process the silk with `++make`. `++make` handles
1701−each individual request and will be the entire focus of the remainder of
1702−this doc after this section. It produces a bolt of a cage.
1703−
1704−We put the new cache in our state with `++dash`.
1705−
1706− ++ dash :: process cache
1707− |= cof=cafe
1708− ^+ +>
1709− %_(+> jav.bay q.cof)
1710−
1711−The cache is put in the baby so that it gets stored across calls to
1712−ford.
1713−
1714−In `++exec`, we process the bolt in three different ways according to
1715−the type of bolt produced. If we produced a `%0` value bolt, we use
1716−`++expo` to give the produced value and set of dependencies as a `%made`
1717−gift, and we remove ourselves from the task list with `++amok`.
1718−
1719− ++ expo :: return gift
1720− |= gef=gift
1721− %_(+> mow :_(mow [hen %give gef]))
1722−
1723−We simply push the gift onto our list of moves.
1724−
1725−In `++exec`, if we produced a `%2` error bolt, we produce a `%made` gift
1726−with the stack trace.
1727−
1728−If we produced a `%1` block bolt, we iterate through each of the blocks
1729−and call `++camp` to produce a clay request for the resource.
1730−
1731− ++ camp :: request a file
1732− |= [ren=care bem=beam]
1733− ^+ +>
1734− %= +>
1735− kig [+(p.kig) (~(put by q.kig) p.kig bem)]
1736− mow :_ mow
1737− :- hen
1738− :^ %pass [(scot %p our) (scot %ud num) (scot %ud p.kig) ~]
1739− %c
1740− [%warp [our p.bem] q.bem [~ %& %x r.bem s.bem]]
1741− ==
1742−
1743−We put the resource in our block list in `q.kig` so that we save the
1744−fact that we're blocked. We then produce the `%warp` request to clay for
1745−the resource. Our request path has the format
1746−\`/[our-ship]/[task-number]/[block-number]'.
1747−
1748−We'll now describe how each of the individual silks are processed in
1749−`++make`.
1750−
1751−Lifecycle of a Cell
1752−-------------------
1753−
1754− ^
1755− %. [cof p.kas q.kas]
1756− ;~ cope
1757− ;~ coax
1758− |=([cof=cafe p=silk q=silk] ^$(cof cof, kas p.kas))
1759− |=([cof=cafe p=silk q=silk] ^$(cof cof, kas q.kas))
1760− ==
1761− ::
1762− |= [cof=cafe bor=cage heg=cage] ^- (bolt cage)
1763− [p=cof q=[%0 ~ [%$ (slop q.bor q.heg)]]]
1764− ==
1765−
1766−Silks autocons. The product of a cell of silks is a cell of the products
1767−of the silks, so we evaluate the two silks in parallel with `++coax` and
1768−slop together the results in a cell vase. We mark the product with `%$`,
1769−which means we know no more mark information than that it is a noun.
1770−
1771− ++ coax :: bolt across
1772− |* [hoc=(bolt) fun=(burg)]
1773− ?- -.q.hoc
1774− %0 =+ nuf=$:fun(..+<- p.hoc)
1775− :- p=p.nuf
1776− ^= q
1777− ?- -.q.nuf
1778− %0 [%0 p=(grom p.q.hoc p.q.nuf) q=[q.q.hoc q.q.nuf]]
1779− %1 q.nuf
1780− %2 q.nuf
1781− ==
1782− %1 =+ nuf=$:fun(..+<- p.hoc)
1783− :- p=p.nuf
1784− ^= q
1785− ?- -.q.nuf
1786− %0 q.hoc
1787− %1 [%1 p=(grom p.q.nuf p.q.hoc)]
1788− %2 q.nuf
1789− ==
1790− %2 hoc
1791− ==
1792−
1793−If the first bolt is a value, we evaluate the burg to get the next bolt.
1794−If that also produces a value, we merge the dependency sets and produce
1795−a cell of the two values. Otherwise, we produce the block or error of
1796−the second bolt.
1797−
1798−If the first bolt is a block, we evaluate the burg to get the next bolt.
1799−If that produces a value, we just produce the block. If it produces a
1800−block, we merge the two block sets. If it produces an error, we produce
1801−that error.
1802−
1803−If the first bolt is already an error, we just pass that through.
1804−
1805−Note that `++coax` (and, indeed, `++cope`) is reasonable to use with
1806−`;~`.
1807−
1808−Lifecycle of a `%bake`
1809−----------------------
1810−
1811− %bake
1812− %+ cool |.(leaf/"ford: bake {<p.kas>} {<(tope q.kas)>}")
1813− %+ cope (lima cof p.kas q.kas r.kas)
1814− |= [cof=cafe vux=(unit vase)]
1815− ?~ vux
1816− (flaw cof (smyt (tope q.kas)) ~)
1817− (fine cof [p.kas u.vux])
1818−
1819−This is one of the most critical silks. We are going to functionally
1820−produce the hook file at the given beam with the given heel. The result
1821−will be of the correct mark, even if we need to run conversion
1822−functions. The functionality is encapsulated in `++lime`. If it produces
1823−null, then we produce an error. Otherwise, we take the vase produced and
1824−give it the correct mark.
1825−
1826− ++ lima :: load at depth
1827− |= [cof=cafe for=mark bem=beam arg=heel]
1828− ^- (bolt (unit vase))
1829− %+ cope (lend cof bem)
1830− |= [cof=cafe arc=arch]
1831− ^- (bolt (unit vase))
1832− ?: (~(has by r.arc) for)
1833− (lace cof for bem(s [for s.bem]) arg)
1834− =+ haz=(turn (~(tap by r.arc) ~) |=([a=@tas b=~] a))
1835− ?~ haz (fine cof ~)
1836− %+ cope (lion cof for -.bem haz)
1837− |= [cof=cafe wuy=(unit (list ,@tas))]
1838− ?~ wuy (fine cof ~)
1839− ?> ?=(^ u.wuy)
1840− %+ cope (make cof %bake i.u.wuy bem arg)
1841− |= [cof=cafe hoc=cage]
1842− %+ cope (lope cof i.u.wuy t.u.wuy -.bem q.hoc)
1843− |= [cof=cafe vax=vase]
1844− (fine cof ~ vax)
1845−
1846−First, we load the arch at the given beam with `++lend`. If we have a
1847−child named the mark, our job is straightforward, so we go ahead and
1848−load that with `++lace`.
1849−
1850−Otherwise, we iterate through our children. If we have no children, we
1851−produce null, signifying that we didn't find any way to convert to the
1852−requested mark. Otherwise, we call `++lion` to find a translation path
1853−from one of the available marks into the target mark. We recursively
1854−bake the child that has a path to the target mark, and then we call
1855−`++lope` to translate this mark into the target mark.
1856−
1857−We'll first discuss the direct case of when one of our children is of
1858−the correct mark.
1859−
1860− ++ lace :: load and check
1861− |= [cof=cafe for=mark bem=beam arg=heel]
1862− ^- (bolt (unit vase))
1863− =+ bek=`beak`[p.bem q.bem r.bem]
1864− %+ cope (lend cof bem)
1865− |= [cof=cafe arc=arch]
1866− ?^ q.arc
1867− (cope (cope (liar cof bem) (lake for bek)) fest)
1868− ?: (~(has by r.arc) %hook)
1869− %+ cope (fade cof %hook bem)
1870− |= [cof=cafe hyd=hood]
1871− (cope (cope (abut:(meow bem arg) cof hyd) (lake for bek)) fest)
1872− (fine cof ~)
1873−
1874−First, we get the arch at the given beam with `++lend`. If this is a
1875−file, we load the file with `++liar` and coerce the type with `++lake`.
1876−Otherwise, we check to see if we have a hook file here. If so, we parse
1877−it with `++fade`, compile it with `++abut:meow`, and coerce the type
1878−with `++lake`.
1879−
1880−Otherwise, there is no way to translate this, so we produce null.
1881−
1882−`++fest` is one line, so we'll get that one out of the way first.
1883−
1884− ++ fest |*([a=cafe b=*] (fine a [~ u=b])) :: bolt to unit
1885−
1886−This is just `++some` for bolts.
1887−
1888−We've delayed the discussion of `++fade` far too many times. It's not
1889−complicated, we just wanted to spare a premature discussion of `++make`
1890−and the `%bake` silk. We 're now able to discuss everything in `++fade`
1891−with ease.
1892−
1893− ++ fade :: compile to hood
1894− |= [cof=cafe for=mark bem=beam]
1895− ^- (bolt hood)
1896− %+ cool |.(leaf/"ford: fade {<[(tope bem)]>}")
1897− %+ cope (make cof [%bake for bem ~])
1898− |= [cof=cafe cay=cage]
1899− %+ (clef %hood) (fine cof bem cay)
1900− ^- (burg (pair beam cage) hood)
1901− |= [cof=cafe bum=beam cay=cage]
1902− =+ rul=(fair bem)
1903− ?. ?=(@ q.q.cay)
1904− (flaw cof ~)
1905− =+ vex=((full rul) [[1 1] (trip q.q.cay)])
1906− ?~ q.vex
1907− (flaw cof [%leaf "syntax error: {<p.p.vex>} {<q.p.vex>}"] ~)
1908− (fine cof p.u.q.vex)
1909−
1910−We first push a line onto a stack trace to say that we're parsing into a
1911−hood file.
1912−
1913−We bake the given beam with the given mark and no heel. Recall that
1914−baking gate, core, door, hoon, and hook files produces simply an atom of
1915−the text. We check to make sure that our value is an atom, failing
1916−otherwise.
1917−
1918−The parsing step is run within `++clef` so that the result is cached. We
1919−call `++fair` with the current beam to generate the parsing rule, and we
1920−parse the file. If parsing fails, we fail giving a syntax error with the
1921−line and column number. Otherwise, we produce the value.
1922−
1923− ++ liar :: load vase
1924− |= [cof=cafe bem=beam]
1925− ^- (bolt vase)
1926− =+ von=(ska %cx (tope bem))
1927− ?~ von
1928− [p=*cafe q=[%1 [[bem ~] ~ ~]]]
1929− ?~ u.von
1930− (flaw cof (smyt (tope bem)) ~)
1931− (fine cof ?^(u.u.von [%cell %noun %noun] [%atom %$]) u.u.von)
1932−
1933−This takes a beam and loads the file at that location. If our sky
1934−function produces null, that means the resource is currently
1935−unavailable, so we block on it. If it produces `[~ ~]`, that means our
1936−resource is permanently unavailable, so we produce an error. Otherwise,
1937−we produce the value there with a type of either a cell of two nouns or
1938−an atom, depending on whether the value is a cell or not.
1939−
1940−Back in `++lima`, recall that we call `++lion` to find a translation
1941−path.
1942−
1943− ++ lion :: translation search
1944− |= [cof=cafe too=@tas bek=beak fro=(list ,@tas)]
1945− ^- (bolt (unit (list ,@tas)))
1946− =| war=(set ,@tas)
1947− =< -:(apex (fine cof fro))
1948− |%
1949− ++ apex
1950− |= rof=(bolt (list ,@tas))
1951− ^- [(bolt (unit (list ,@tas))) _+>]
1952− ?. ?=(%0 -.q.rof) [rof +>.$]
1953− ?~ q.q.rof
1954− [[p.rof [%0 p.q.rof ~]] +>.$]
1955− =^ orf +>.$ (apse cof i.q.q.rof)
1956− ?. ?=(%0 -.q.orf)
1957− [orf +>.$]
1958− ?~ q.q.orf
1959− $(cof p.orf, q.q.rof t.q.q.rof)
1960− [[p.orf [%0 (grom p.q.rof p.q.orf) q.q.orf]] +>.$]
1961− ::
1962− ++ apse
1963− |= [cof=cafe for=@tas]
1964− ^- [(bolt (unit (list ,@tas))) _+>]
1965− ?: =(for too)
1966− [(fine cof [~ too ~]) +>.$]
1967− ?: (~(has in war) for) [(fine cof ~) +>]
1968− =. war (~(put in war) for)
1969− =^ hoc +>.$ (apex (lily cof for bek))
1970− :_ +>.$
1971− %+ cope hoc
1972− |= [cof=cafe ked=(unit (list ,@tas))]
1973− (fine cof ?~(ked ~ [~ for u.ked]))
1974− --
1975−
1976−At a high level, we have `++apex` and `++apse`. `++apex` takes a list of
1977−marks to try in succession until we find one that can be translated into
1978−the target mark. On each one, it calls `++apse`, which takes a single
1979−mark and tries to find a translation path from this mark to the target.
1980−To do this, it sees which marks we know how to directly translate to,
1981−and calls `++apex` on this list. The result of this mututal recursion is
1982−a depth-first search of the translation graph to find the target mark.
1983−Since the translation graph is not necessarily acyclic, we maintain a
1984−set of marks that we've already tried.
1985−
1986−We kick off our search in `++apex`, starting with the given initial list
1987−of marks that we know how to get to.
1988−
1989−If `++apex` is called with a bolt other than a `%0` value bolt, we
1990−simply produce it. Otherwise, we check to see if the list of available
1991−marks to investigate is null. If so, then we're done, so we produce a
1992−`%0` bolt with a null list of accessible marks.
1993−
1994−Otherwise, we process this next mark with `++apse`, which will produce a
1995−possible list of marks from this one to the target mark. If it fails to
1996−produce a `%0` bolt, we just produce that. Otherwise, if it produces
1997−null, we can't get to our target through this mark, so we move on to the
1998−next one.
1999−
2000−If it doesn't produce null, then we have successfully found a
2001−translation path, so we produce it.
2002−
2003−In `++apse`, we first test to see if we've arrived at the target path.
2004−If so, we're done, so we produce a list including just ourself.
2005−Otherwise, we check to see if we've already tried this mark. If so, we
2006−know we can't succeed here, so we produce null. Otherwise, we put
2007−ourselves in the set of already-tried marks, and we move on.
2008−
2009−We call `++lily` to get the list of marks we can translate this one
2010−into.
2011−
2012− ++ lily :: translation targets
2013− |= [cof=cafe for=mark bek=beak]
2014− ^- (bolt (list ,@tas))
2015− =+ raf=(fang cof for bek)
2016− ?: =(%2 -.q.raf) (fine p.raf ~)
2017− %+ cope raf
2018− |= [cof=cafe vax=vase]
2019− %+ fine cof
2020− %+ weld
2021− ^- (list ,@tas)
2022− ?. (slab %garb p.vax) ~
2023− =+ gav=((soft (list ,@tas)) q:(slap vax [%cnzy %garb]))
2024− ?~(gav ~ u.gav)
2025− ?. (slab %grow p.vax) ~
2026− =+ gow=(slap vax [%cnzy %grow])
2027− (sloe p.gow)
2028−
2029−We call `++fang` to get the mark definition door. This is documented
2030−under `%vale`. If getting the mark fails, we produce null because we
2031−can't translate a non-existent mark into anything.
2032−
2033−Otherwise, we examine the door. The door may have a `++garb`, which is
2034−simply a list of marks which know how to translate from the current one.
2035−There must be a corresponding `++grab` in the definition of the other
2036−mark, though we don't check that here.
2037−
2038−The door may also have a `++grow`, which defines how to translate this
2039−mark into another one. Each arm in `++grow` is the name of a mark we can
2040−translate into. The call to `++sloe` simply produces a list of arm names
2041−in `++grow`.
2042−
2043−Back in `++apse:lion`, we take the list of translation targets we just
2044−found and call `++apex` on it. If we got back a null, we produce a null;
2045−otherwise, we produce the list of marks we got back plus the current
2046−mark.
2047−
2048−This concludes our discussion of `++lion`.
2049−
2050−The final piece of `++lima` is `++lope`, which performs the actual
2051−translation along the path we just computed.
2052−
2053− ++ lope :: translation pipe
2054− |= [cof=cafe for=mark yaw=(list mark) bek=beak vax=vase]
2055− ^- (bolt vase)
2056− ?~ yaw (fine cof vax)
2057− %+ cope (link cof i.yaw for bek vax)
2058− |= [cof=cafe yed=vase]
2059− ^$(cof cof, for i.yaw, yaw t.yaw, vax yed)
2060−
2061−We iterate through our list, calling `++link` on every adjacent pair of
2062−marks, translating from one mark to the next until we finish the list of
2063−marks. A call to `++link` is equivalent to a `%cast` silk, so we
2064−document it there. After we've called performed every step in the
2065−translation pipeline, we're done.
2066−
2067−Lifecycle of a `%boil`
2068−----------------------
2069−
2070− %boil
2071− %+ cool |.(leaf/"ford: boil {<p.kas>} {<(tope q.kas)>} {<r.kas>}")
2072− %+ cope (lamp cof q.kas)
2073− |= [cof=cafe bem=beam]
2074− %+ cope (lime cof p.kas bem r.kas)
2075− |= [cof=cafe vax=vase]
2076− (fine cof `cage`[p.kas vax])
2077−
2078−At a high level, we try to bake at the given beam, and if it fails, we
2079−go up a level and try again. This is the usual semantics of ford, and
2080−this should nearly always be preferred over directly baking.
2081−
2082−First, we normalize the version case to a number with `++lamp`. This
2083−allows caching to be based on revision number rather than something more
2084−ephemeral like a particular time.
2085−
2086− ++ lamp :: normalize version
2087− |= [cof=cafe bem=beam]
2088− ^- (bolt beam)
2089− =+ von=(ska %cw (tope bem(s ~)))
2090− ?~ von [p=cof q=[%1 [bem ~] ~ ~]]
2091− (fine cof bem(r [%ud ((hard ,@) (need u.von))]))
2092−
2093−We call the sky function with `%cw`, asking clay for the revision number
2094−at this case. If the case refers to a revision that isn't there yet, we
2095−produce a `%1` blocking bolt. Otherwise, we require that the value exist
2096−and that it's a number, both of which are guaranteed by clay. We produce
2097−this number.
2098−
2099−Next for `%boil` we call `++lime` to try to load the beam.
2100−
2101− ++ lime :: load beam
2102− |= [cof=cafe for=mark bem=beam arg=heel]
2103− =+ [mob=bem mer=(flop arg)]
2104− |- ^- (bolt vase)
2105− %+ cope (lima cof for mob (flop mer))
2106− |= [cof=cafe vux=(unit vase)]
2107− ?^ vux (fine cof u.vux)
2108− ?~ s.mob
2109− (flaw cof (smyt (tope bem)) ~)
2110− ^$(s.mob t.s.mob, mer [i.s.mob mer])
2111−
2112−We start at the given beam and try to bake it. If it succeeds, we're
2113−good. Otherwise, we pop off the top level of the path and put it in our
2114−heel (virtual path extension). We do this recursively until either we
2115−find something we can bake or we've gone all the way up to the root path
2116−of the desk, in which case we fail.
2117−
2118−Lifecycle of a `%call`
2119−----------------------
2120−
2121− %call
2122− %+ cool |.(leaf/"ford: call {<`@p`(mug kas)>}")
2123− %. [cof p.kas q.kas]
2124− ;~ cope
2125− ;~ coax
2126− |=([cof=cafe p=silk q=silk] ^$(cof cof, kas p))
2127− |=([cof=cafe p=silk q=silk] ^$(cof cof, kas q))
2128− ==
2129− ::
2130− |= [cof=cafe gat=cage sam=cage]
2131− (maul cof q.gat q.sam)
2132− ::
2133− |= [cof=cafe vax=vase]
2134− (fine cof %noun vax)
2135− ==
2136−
2137−This is slam for silks. We process both of the given silks in parallel
2138−with `++coax`. We then slam the two produced vases together with
2139−`++maul` and mark the produced vase with `%noun` since we don't know any
2140−more specific mark.
2141−
2142−`++coax` is documented under Lifecycle of a Cell.
2143−
2144−Lifecycle of a `%cast`
2145−----------------------
2146−
2147− %cast
2148− %+ cool |.(leaf/"ford: cast {<p.kas>}")
2149− %+ cope $(kas q.kas)
2150− |= [cof=cafe cay=cage]
2151− %+ cope (link cof p.kas p.cay [our %main %da now] q.cay)
2152− |= [cof=cafe vax=vase]
2153− (fine cof [p.kas vax])
2154−
2155−This is a request to convert data of one mark to another mark directly.
2156−We evaluate the given silk and pass the result into `++link`, which
2157−performs the actual translation. Note that this will not search for
2158−indirect conversion paths, so the conversion must be defined either in
2159−the `++grow` of the given mark or the `++grab` of the target mark.
2160−
2161− ++ link :: translate
2162− |= [cof=cafe too=mark for=mark bek=beak vax=vase]
2163− ^- (bolt vase)
2164− ?: =(too for) (fine cof vax)
2165− ?: |(=(%noun for) =(%$ for))
2166− ((lake too bek) cof vax)
2167− %+ cope (fang cof for bek)
2168− |= [cof=cafe pro=vase]
2169− ?: &((slab %grow p.pro) (slab too p:(slap pro [%cnzy %grow])))
2170− %+ cope (keel cof pro [[%& 6]~ vax]~)
2171− |= [cof=cafe pox=vase]
2172− (maim cof pox [%tsgr [%cnzy %grow] [%cnzy too]])
2173− %+ cope (fang cof too bek)
2174− |= [cof=cafe pro=vase]
2175− =+ ^= zat ^- (unit vase)
2176− ?. (slab %grab p.pro) ~
2177− =+ gab=(slap pro [%cnzy %grab])
2178− ?. (slab for p.gab) ~
2179− `(slap gab [%cnzy for])
2180− ?~ zat
2181− (flaw cof [%leaf "ford: no link: {<[for too]>}"]~)
2182− (maul cof u.zat vax)
2183−
2184−This performs one step in the translation pipeline. If the given and
2185−target marks are the same, we're done. If we're translating from a noun
2186−or the empty mark, we coerce with `++lake` (documented in `%vale`).
2187−Otherwise, we're translating from a user-defined mark.
2188−
2189−We load the definition of the given mark with `++fang`, and we check to
2190−see if it has an arm in `++grow` named the target mark. If so, we place
2191−our data in the sample of the door with `++keel` and slap the arm.
2192−`++keel` is equivalent to a `%mute` silk, so we document it there.
2193−
2194−If there is no arm in `++grow` of the given mark named the target mark,
2195−we suppose there must be an arm in `++grab` of the target mark named the
2196−given mark. We get the definition of the target mark and check to see if
2197−it has the required arm, failing if it doesn't. Finally, we slam the
2198−data against the correct arm, producing the translated data.
2199−
2200−If you're confused as to why the handling of `++grow` and `++grab` look
2201−superficially so different, remember that the correct arm in `++grow`
2202−does not have a sample while the one in `++grab` does. This means they
2203−must be called rather differently.
2204−
2205−Lifecycle of a `%diff`
2206−----------------------
2207−
2208− %diff
2209− %+ cool |.(leaf/"ford: diff {<`@p`(mug p.kas)>} {<`@p`(mug q.kas)>}")
2210− (diff cof p.kas q.kas)
2211−
2212−We push debug information onto the trace and go right to `++diff`.
2213−
2214− ++ diff
2215− |= [cof=cafe kas=silk kos=silk]
2216− ^- (bolt cage)
2217− %. [cof kas kos]
2218− ;~ cope
2219− ;~ coax
2220− |=([cof=cafe p=silk q=silk] (make cof p))
2221− |=([cof=cafe p=silk q=silk] (make cof q))
2222− ==
2223− |= [cof=cafe cay=cage coy=cage]
2224−
2225−First, we process the two given silks to get our arguments.
2226−
2227− ?. =(p.cay p.coy)
2228− %+ flaw cof :_ ~
2229− leaf/"diff on data of different marks: {(trip p.cay)} {(trip p.coy)}"
2230−
2231−If the two cages have different marks, then we can't diff them, so we
2232−complain.
2233−
2234− %+ cope (fang cof p.cay [our %main %da now])
2235− |= [cof=cafe pro=vase]
2236−
2237−We pull in the relevant mark's definition.
2238−
2239− ?. (slab %grad p.pro)
2240− (flaw cof leaf/"no ++grad" ~)
2241− =+ gar=(slap pro [%cnzy %grad])
2242− ?. (slab %form p.gar)
2243− ?. (slab %sted p.gar)
2244− (flaw cof leaf/"no ++form:grad nor ++sted:grad" ~)
2245− =+ for=((soft ,@tas) q:(slap gar [%cnzy %sted]))
2246− ?~ for
2247− (flaw cof leaf/"bad ++sted:grad" ~)
2248− (make cof %diff [%cast u.for kas] [%cast u.for kos])
2249−
2250−If there's no `++grad`, we complain. If there's no `++form:grad`, then
2251−we look for a `++sted:grad`. If we can't find either, or if
2252−`++sted:grad` isn't a term, then we complain. If `++sted:grad` exists
2253−and is a term, then it represents the mark we should use as a proxy to
2254−get our diff. So, we cast both our given cages to the new mark and start
2255−the dance again.
2256−
2257− ?. (slab %diff p.gar)
2258− (flaw cof leaf/"no ++diff:grad" ~)
2259−
2260−Otherwise, we expect a `++diff:grad`.
2261−
2262− %+ cope (keel cof pro [[%& 6]~ q.cay]~)
2263− |= [cof=cafe pox=vase]
2264−
2265−We put the first cage's data into the sample of the given mark's
2266−definition.
2267−
2268− %+ cope
2269− %^ maul cof
2270− (slap (slap pox [%cnzy %grad]) [%cnzy %diff])
2271− q.coy
2272− |= [cof=cafe dif=vase]
2273−
2274−We run `++diff:grad` with a sample of the second cage's data.
2275−
2276− =+ for=((soft ,@tas) q:(slap gar [%cnzy %form]))
2277− ?~ for
2278− (flaw cof leaf/"bad ++form:grad" ~)
2279− (fine cof u.for dif)
2280− ==
2281−
2282−We check that `++form:grad` exists, and we tag the result with it to
2283−give the final cage.
2284−
2285−Lifecycle of a `%done`
2286−----------------------
2287−
2288− %done [cof %0 p.kas q.kas]
2289−
2290−This is trivial. We simply produce the given cage with the given set of
2291−dependencies. This is used when we already have a cage that we want to
2292−insert into another silk that requires a silk argument. It's analogous
2293−to the return operator in a monad -- which makes it sound way more
2294−complicated than it is.
2295−
2296−Lifecycle of a `%dude`
2297−----------------------
2298−
2299− %dude (cool |.(p.kas) $(kas q.kas))
2300−
2301−This simply puts a given tank on the stack trace if the given silk
2302−produces an error. This is implemented as a simple call to `++cool`.
2303−
2304−Lifecycle of a `%dune`
2305−----------------------
2306−
2307− %dune
2308− ?~ q.kas [cof [%2 [%leaf "no data"]~]]
2309− $(kas [%done p.kas u.q.kas])
2310−
2311−This is a sort of a `++need` for silks. If there is no data in the unit
2312−cage, we produce an error. Else, we simply produce the data in the cage.
2313−
2314−Lifcycle of a `%mute`
2315−---------------------
2316−
2317− %mute (kale cof p.kas q.kas)
2318−
2319−This mutates a silk by putting the values of other silks at particular
2320−axes. This is useful in, for example, replacing the sample of the door
2321−in a mark definition.
2322−
2323− ++ kale :: mutate
2324− |= [cof=cafe kas=silk muy=(list (pair wing silk))]
2325− ^- (bolt cage)
2326− %+ cope
2327− |- ^- (bolt (list (pair wing vase)))
2328− ?~ muy (fine cof ~)
2329− %+ cope (make cof q.i.muy)
2330− |= [cof=cafe cay=cage]
2331− %+ cope ^$(muy t.muy)
2332− |= [cof=cafe rex=(list (pair wing vase))]
2333− (fine cof [[p.i.muy q.cay] rex])
2334− |= [cof=cafe yom=(list (pair wing vase))]
2335− %+ cope (make cof kas)
2336− |= [cof=cafe cay=cage]
2337− %+ cope (keel cof q.cay yom)
2338− |= [cof=cafe vax=vase]
2339− (fine cof p.cay vax)
2340−
2341−First, we process each of the silks by calling `++make` on them. We pass
2342−the resultant vase and list of pairs of wings and silks to `++keel` to
2343−do the actual mutation. We assume the mutation doesn't change the mark
2344−of the main silk, so we mark the produced vase with the original mark.
2345−
2346− ++ keel :: apply mutations
2347− |= [cof=cafe suh=vase yom=(list (pair wing vase))]
2348− ^- (bolt vase)
2349− %^ maim cof
2350− %+ slop suh
2351− |- ^- vase
2352− ?~ yom [[%atom %n] ~]
2353− (slop q.i.yom $(yom t.yom))
2354− ^- hoon
2355− :+ %cncb [%& 2]~
2356− =+ axe=3
2357− |- ^- (list (pair wing hoon))
2358− ?~ yom ~
2359− :- [p.i.yom [%$ (peg axe 2)]]
2360− $(yom t.yom, axe (peg axe 3))
2361−
2362−We first put the vases together in one big tuple starting with the
2363−subject and going through the mutations. We slap against this tuple a
2364−`%_` hoon we directly construct. Since a `%_` hoon takes a list of pairs
2365−of wings and hoons, we simply have to generate hoons referring to the
2366−correct axes in the subject. This is very easy since we just recur on
2367−axis 3 of whatever axis we were already at.
2368−
2369−Note the use of `%_` instead of `%=` enforces that our mutations don't
2370−change the type of the subject, which justifies our use of the original
2371−mark.
2372−
2373−Lifecycle of a `%pact`
2374−----------------------
2375−
2376− %pact
2377− %+ cool |.(leaf/"ford: pact {<`@p`(mug p.kas)>} {<`@p`(mug q.kas)>}")
2378− (pact cof p.kas q.kas)
2379−
2380−We push debug information onto the trace and go right to `++pact`.
2381−
2382− ++ pact :: patch
2383− |= [cof=cafe kas=silk kos=silk]
2384− ^- (bolt cage)
2385− %. [cof kas kos]
2386− ;~ cope
2387− ;~ coax
2388− |=([cof=cafe p=silk q=silk] (make cof p))
2389− |=([cof=cafe p=silk q=silk] (make cof q))
2390− ==
2391− |= [cof=cafe cay=cage coy=cage]
2392−
2393−First, we process the two given silks to get our arguments.
2394−
2395− %+ cope (fang cof p.cay [our %main %da now])
2396− |= [cof=cafe pro=vase]
2397−
2398−We pull in the relevant mark's definition.
2399−
2400− ?. (slab %grad p.pro)
2401− (flaw cof leaf/"no ++grad" ~)
2402− =+ gar=(slap pro [%cnzy %grad])
2403− ?. (slab %form p.gar)
2404− ?. (slab %sted p.gar)
2405− (flaw cof leaf/"no ++form:grad nor ++sted:grad" ~)
2406− =+ for=((soft ,@tas) q:(slap gar [%cnzy %sted]))
2407− ?~ for
2408− (flaw cof leaf/"bad ++sted:grad" ~)
2409− (make cof %cast p.cay %pact [%cast u.for kas] kos)
2410−
2411−If there's no `++grad`, we complain. If there's no `++form:grad`, then
2412−we look for a `++sted:grad`. If we can't find either, or if
2413−`++sted:grad` isn't a term, then we complain. If `++sted:grad` exists
2414−and is a term, then it represents the mark we should use as a proxy to
2415−get our diff. So, we cast the first argument to the new mark, then try
2416−to patch. Afterward, we cast the result back to the original mark.
2417−
2418− =+ for=((soft ,@tas) q:(slap gar [%cnzy %form]))
2419− ?~ for
2420− (flaw cof leaf/"bad ++form:grad" ~)
2421− ?. =(u.for p.coy)
2422− %+ flaw cof :_ ~
2423− =< leaf/"pact on data with wrong form: {-} {+<} {+>}"
2424− [(trip p.cay) (trip u.for) (trip p.coy)]
2425−
2426−If `++form:grad` isn't a term, or else our second argument isn't of that
2427−mark, we complain.
2428−
2429− ?. (slab %pact p.gar)
2430− (flaw cof leaf/"no ++pact:grad" ~)
2431−
2432−If we don't have a `++pact:grad`, we complain.
2433−
2434− %+ cope (keel cof pro [[%& 6]~ q.cay]~)
2435− |= [cof=cafe pox=vase]
2436−
2437−We put the first cage's data into the sample of the given mark's
2438−definition.
2439−
2440− %+ cope
2441− %^ maul cof
2442− (slap (slap pox [%cnzy %grad]) [%cnzy %pact])
2443− q.coy
2444− |= [cof=cafe pat=vase]
2445−
2446−We run `++pact:grad` with a sample of the second cage's data, which is
2447−the diff.
2448−
2449− (fine cof p.cay pat)
2450− ==
2451−
2452−We tag the result with the mark of our first argument.
2453−
2454−Lifecycle of a `%plan`
2455−----------------------
2456−
2457− %plan
2458− %+ cope (abut:(meow p.kas q.kas) cof r.kas)
2459− |= [cof=cafe vax=vase]
2460− (fine cof %noun vax)
2461−
2462−This is a direct request to compile a hood at a given beam with a heel
2463−of the given path. We comply by calling `++abut` with the given
2464−arguments and producing the vase with a mark of `%noun`.
2465−
2466−Lifecycle of a `%reef`
2467−----------------------
2468−
2469− %reef (fine cof %noun pit)
2470−
2471−This is one of the simplest silks. We simply produce our context, which
2472−is zuse compiled against hoon. The mark is a `%noun`.
2473−
2474−Lifcycle of a `%ride`
2475−---------------------
2476−
2477− %ride
2478− %+ cool |.(leaf/"ford: ride {<`@p`(mug kas)>}")
2479− %+ cope $(kas q.kas)
2480− |= [cof=cafe cay=cage]
2481− %+ cope (maim cof q.cay p.kas)
2482− |= [cof=cafe vax=vase]
2483− (fine cof %noun vax)
2484−
2485−This slaps evaluates the given silk, then it slaps the result against
2486−the given hoon. Since we don't know what of what mark (if any) is the
2487−result, we give it a mark of `%noun`.
2488−
2489−Lifecycle of a `%vale`
2490−----------------------
2491−
2492− %vale
2493− %+ cool |.(leaf/"ford: vale {<p.kas>} {<q.kas>} {<`@p`(mug r.kas)>}")
2494− %+ cope (lave cof p.kas q.kas r.kas)
2495− |= [cof=cafe vax=vase]
2496− (fine cof `cage`[p.kas vax])
2497−
2498−This checks whether given data is of the given mark. If we don't have
2499−the definition of the mark, we check the given ship for it.
2500−
2501−We call `++lave` to perform the check, producing a vase. We produce this
2502−vase tagged with the given mark.
2503−
2504− ++ lave :: validate
2505− |= [cof=cafe for=mark his=ship som=*]
2506− ^- (bolt vase)
2507− ((lake for [our %main [%da now]]) cof [%noun som])
2508−
2509−This is a thinly-veiled wrapper over `++lake`. Note that, contrary to
2510−documented opinion, we do not in fact check the other ship's definition
2511−of a mark. This is likely a bug.
2512−
2513−At any rate, `++lake` coerces a noun into the correct type for a mark.
2514−
2515− ++ lake :: check/coerce
2516− |= [for=mark bek=beak]
2517− |= [cof=cafe sam=vase]
2518− ^- (bolt vase)
2519− %+ cool |.(leaf/"ford: check {<[for bek `@p`(mug q.sam)]>}")
2520− ?: ?=(?(%gate %core %door %hoon %hook) for)
2521− :: ~& [%lake-easy for bek]
2522− (fine cof sam)
2523− %+ cope (fang cof for bek)
2524− |= [cof=cafe tux=vase]
2525− =+ bob=(slot 6 tux)
2526− ?: (~(nest ut p.bob) | p.sam)
2527− (fine cof sam)
2528− ?. (slab %grab p.tux)
2529− (flaw cof [%leaf "ford: no grab: {<[for bek]>}"]~)
2530− =+ gab=(slap tux [%cnzy %grab])
2531− ?. (slab %noun p.gab)
2532− (flaw cof [%leaf "ford: no noun: {<[for bek]>}"]~)
2533− %+ cope (maul cof (slap gab [%cnzy %noun]) [%noun q.sam])
2534− |= [cof=cafe pro=vase]
2535− ?: =(+<.q.pro q.sam)
2536− (fine cof (slot 6 pro))
2537− (flaw cof [%leaf "ford: invalid content: {<[for bek]>}"]~)
2538−
2539−This is going to coerce the sample into the correct type for the mark.
2540−First, we push a line onto the stack trace saying that we're checking
2541−the type. If the requested mark is a gate, core, door, hoon, or hook,
2542−then we don't do any more type information than just saying it's a noun,
2543−so we're done.
2544−
2545−Otherwise, we get the mark definition from our `/=main=/mar` directory
2546−with `++fang`, which we'll describe below.
2547−
2548−We check to see if our sample type nests within the type of the sample
2549−to the door. If so, then we're already of the correct type, so we're
2550−done.
2551−
2552−Otherwise, we check to see if there's a `++grab` in the door, and a
2553−`++noun` in the `++grab`. If not, there's no way we can translate to
2554−this mark, so we fail.
2555−
2556−If we have everything we need, we slam our sample (typed as a noun)
2557−against the `++noun` in `++grab`. If the sample of the door is the same
2558−as our sample, then the check succeeded, so we produce the well-typed
2559−sample of the door. Otherwise, we fail.
2560−
2561− ++ fang :: protocol door
2562− |= [cof=cafe for=mark bek=beak]
2563− ^- (bolt vase)
2564− =+ pax=/door/[for]/mar
2565− =+ ^= bem ^- beam
2566− :_ pax
2567− ?: =(p.bek our) bek
2568− =+ oak=[our %main %da now]
2569− ?. =(~ (ska %cy (tope [oak pax]))) oak
2570− bek
2571− (cope (fade cof %hook bem) abut:(meow bem ~))
2572−
2573−A mark's definition is generally in
2574−`/=main=/mar/[mark-name]/door/hook'. If we don't find it there, we look in`/[given-beak]/mar/[mark-name]/door/hook'.
2575−We parse the mark definition with `++fade` and assemble it with
2576−`++abut:meow`. `++fade` is defined under the `%bake` silk.
docs/arvo/internals/gall.mddeleted−133
@@ -1,133 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 7
4−---
5−
6−
7−`%gall`
8−=======
9−
10−Our application server manager.
11−
12−It allows applications and vanes to send messages to applications and
13−subscribe to data streams. This requires `%gall` to be a sort of a
14−hypervisor. Messages coming into `%gall` are routed to the intended
15−application, and the response comes back along the same route. If the
16−intended target is on another ship, `%gall` will behind-the-scenes route
17−it through ames to the other ship to run. This provides an abstraction
18−where all apps on all ships are communicated with over the same
19−interface.
20−
21−`%gall` neither accepts events from unix nor produces effects. It exists
22−entirely for the benefit of other vanes and, in particular,
23−applications. Eyre exposes `%gall`'s interface over http, and ames does
24−the same over the ames network. `%gall` uses ford to compile and run the
25−applications.
26−
27−Cards
28−-----
29−
30−`%gall` accepts the following cards. The first three are the most
31−commonly used, while the others are primarily used internally.
32−
33−### `%mess`
34−
35−Sends a message to an app. This will result in a call to the app's
36−`++poke` arm. The response is exactly one of a `%nice` if the action
37−succeeded or a `%mean` if not.
38−
39−### `%show`
40−
41−Subscribes to a stream from an app. This will result in a call to the
42−app's either `++peek` or `++peer` arm. The first response will always be
43−either a `%nice` or a `%mean`, indicating whether or not the
44−subscription was successful. After the first response, there will be
45−zero or more responses of either `%rush` or `%rust`, which communicate
46−either a differential or full update to the data stream. There may be a
47−`%mean`, which indicates that the subscription has been canceled and no
48−more responses will be received along this stream.
49−
50−
51−### `%nuke`
52−
53−Unsubscribes the current duct from its stream. This receives a response
54−of either a `%nice` or a `%mean`. Note that a response of `%nice` does
55−not imply that the current duct was in fact subscribed to any stream.
56−
57−### `%init`
58−
59−Initializes a ship's apps. This should be called exactly once for each
60−ship on the pier. This produces no moves in response.
61−
62−### `%sire`
63−
64−Instantiates a child app. The app will be at path `[p parent-path]`, and
65−it will be an instance of the `q` app. The only response will be `%gone`
66−when the child dies.
67−
68−
69−### `%rote`
70−
71−Signifies a remote request from ames. `r` should be of type `rook`. This
72−how an app on a foreign ship may send a `%mess`, `%show`, or `%nuke`
73−card. Note that `%gall` automatically converts `%mess`, `%show`, and
74−`%nuke` into ames messages behind the scenes, so the only entity that
75−should use `%rote` and `%roth` is ames. Formally, the response is either
76−a `%nice` or a `%mean`, which ames uses to give a positive or negative
77−ack. A logical response comes by passing a `%roth` card.
78−
79−
80−### `%roth`
81−
82−Gives the response received from a remote request. `r` should be of type
83−`roon`. This is how an app responds to a foreign request with a `%rush`,
84−`%rust`, `%nice`, or `%mean`. The response is either a `%nice` or a
85−`%mean`. Even though we, as the proverb goes, "never ack an ack", we do
86−need to acknowledge these responses since they're really independent
87−one-way messages.
88−
89−
90−### `%wipe`
91−
92−Wipes the given app from memory. This is generally considered a hack,
93−but it is sometimes useful during development to wipe the state of an
94−app. We don't guarantee that this actually completely wipes the app.
95−Generally, you want to use a `%cide` card if you actually want to kill
96−an app. This gives no response.
97−
98−
99−### `%cide`
100−
101−Kills an app and all its children. Even though it's not technically a
102−part of `%gall`'s interface since it's not in `++kiss` and can't be
103−called from the outside, it's worth mentioning `%cide`, which may be
104−called from within `%gall` apps. It should call `++part` to allow the
105−app any last words. This gives no response.
106−
107−Service Gates
108−-------------
109−
110−### `++poke`
111−
112−Handles incoming messages. Most commonly with an associated `%logo`. For
113−example `++poke-json` handles an incoming JSON request from `%eyre`.
114−
115−### `++peer`
116−
117−Handles incoming subscriptions.
118−
119−### `++pull`
120−
121−Handles dropping subscribers.
122−
123−### `++pour`
124−
125−Handles responses to `%pass` moves.
126−
127−### `++park`
128−
129−Save state on update.
130−
131−### `++prep`
132−
133−Load state on update.
docs/arvo/subject.mddeleted−105
@@ -1,105 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 12
4−next: true
5−title: The subject
6−---
7−
8−The subject
9−===========
10−
11−Now we're going to cover the boiler plate that we skimmed over earlier.
12−
13− :- %say |= *
14− :- %noun
15− =< (sum [1.000 2.000])
16−
17−The first rune, `:-` (colhep, aka
18−[:cons](../../hoon/rune/col/hep/)), constructs the 2-element cell
19−that will be our program. The first element, `%say`, tells the
20−interpreter what to produce--in this case a value.
21−
22−The second element is `|=`, which we know produces a function. `|=`'s
23−first child is its argument(s), which in this case is any noun (`*`).
24−Its second child is the remainder of the program.
25−
26−Similarly, the rest of the program (which we construct with another
27−`:-`) is a cell of the literal `%noun`, which tells the shell that we're
28−producing a value of type `noun`, and the code that we run to actually
29−produce our value of the type `noun`.
30−
31−`=<` ([tisgal](../../hoon/rune/tis/gal/)) is a rune that takes two
32−children. The second child is the context against which we run the first
33−child. So in this case, we are running the expression
34−`(sum [1.000 2.000])` against everything contained within the `|%`. In
35−Hoon, we call the code executed the "formula" and its context the
36−"subject".
37−
38− ::::::::::::::::::::::::::::::
39− =< (sum [1.000 2.000]) :: formula
40− ::::::::::::::::::::::::::::::
41− |% ::
42− ++ three ::
43− |= a/@ ::
44− =| b/@ ::
45− |- ^- @u ::
46− ?: (lth a b) ::
47− 0 ::
48− (add b $(b (add 3 b))) ::
49− :: ::
50− ++ five ::
51− |= a/@ :: subject
52− =| b/@ ::
53− |- ^- @ ::
54− ?: (lte a b) ::
55− 0 ::
56− ?: =((mod b 3) 0) ::
57− $(b (add b 5)) ::
58− (add b $(b (add b 5))) ::
59− :: ::
60− ++ sum ::
61− |= {a/@u b/@u} ::
62− (add (five a) (three b)) ::
63− -- ::
64− ::::::::::::::::::::::::::::::
65−
66−In nearly every language there is a similar concept of a "context" in
67−which expressions are executed. For example, in C this includes things
68−like the call stack, stack variables, and so on.
69−
70−Hoon is unique in that this context is a first-class value. Scheme
71−allows a sort of reification of the context through continuations, and
72−some may see a parallel to Forth's stack, but Hoon takes the
73−concept one step further.
74−
75−Our starting subject is the [standard library](../../hoon/library), which is
76−defined in `/arvo/hoon.hoon` and `/arvo/zuse.hoon`. This is where
77−functions like `add` are defined. When we define a core with `|%`, we
78−don't throw away the subject (i.e. the standard library); rather, we
79−stack the new core on top of the old subject so that both are
80−accessible.
81−
82−**Exercises**:
83−
84−- Pass `++sum` its arguments (`2.000` and `3.000`) from the
85− command line.
86−
87−- Comment out all of the arms of the `|%`. Now add another arm and
88− call it `++add`, have it accept two arguments and produce 42
89− (regardless of input). Change the `=<` line to
90− `[(add 5 7) (^add 5 7)]`. Can you recognize what's happening?
91−
92−Cheatsheet:
93−
94−- To pass arguments from the command line to a program, you replace
95− the `*` in the first line of the boiler plate to
96− `[^ [[arg=TYPE ~] ~]]` where `TYPE` is replaced with the type of
97− argument you're expecting. Then `+euler1 a` from the dojo sets `arg`
98− to `a`.
99−- The empty list is `~`
100−- Lisp-style cons (construct a cell/prepend an element) is
101− `[new-element list]`
102−- For example, the first three positive integers are `[1 2 3 ~]`
103−- `(gte a b)` tests whether `a` is greater than or equal to `b`.
104−- `(mod a b)` runs the modulo operation on two atoms.
105−- See the basic math section in `/arvo/hoon.hoon` for more info.
docs/community.mddeleted−31
@@ -1,31 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 9
4−title: Community docs
5−---
6−
7−# Community docs
8−
9−<div>
10−
11−<ul>
12−
13−<li><code>~master-morzod</code>
14−<br />
15−<a href="https://mardev.urbit.org/docs/">Docs</a>, <a href="https://urbit.org/fora/posts/~2016.12.25..06.35.44..a1ec~/">Fora post</a></li>
16−
17−<li><code>~hidduc-posmeg</code>
18−<br />
19−<a href="https://fosnut-dandut.urbit.org/pages/hidducs-notes/tutorial/">Docs</a>, <a href="https://urbit.org/fora/posts/~2017.2.12..21.54.40..6fde~/">Fora post</a></li>
20−
21−<li><code>~palfun-foslup</code>
22−<br />
23−<a href="https://github.com/Fang-/Urbit-By-Doing">Urbit by Doing</a></li>
24−
25−<li><code>@knubie</code>
26−<br />
27−<a href="https://github.com/knubie/learning-hoon">Learning Hoon</a></li>
28−
29−</ul>
30−
31−</div>
docs/hall.mddeleted−14
@@ -1,14 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 8
5−title: Hall
6−---
7−
8−# Hall
9−
10−Hall is the Urbit messaging and notifications protocol. Read up on Hall's
11−architecture, its interfaces and the new Gall model it's built to target
12−in this documentation section.
13−
14−<list/>
docs/hoon.mddeleted−13
@@ -1,13 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 5
5−title: Hoon
6−---
7−
8−# Hoon
9−
10−An in-depth technical reference for Hoon. Best for readers with
11−an interest or background in programming languages.
12−
13−<list/>
docs/hoon/atom.mddeleted−17
@@ -1,17 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 19
5−title: Atoms and strings
6−---
7−
8−# Atoms and strings
9−
10−The simplest expressions in every language are constants:
11−atoms, strings, paths. (Strings aren't all constants per
12−se, because they have interpolations.)
13−
14−## Stems
15−
16−<list dataPreview="true" className="runes"></list>
17−
docs/hoon/atom/knit.mddeleted−44
@@ -1,44 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 3
4−title: Knit
5−---
6−
7−# Knit
8−
9−`[%knit p=(list (each @t hoon))]`: text string with interpolation.
10−
11−### Produces
12−
13−A list-shaped string (`tape`) of the items in `p`, which are
14−either constant `@t` multibyte UTF-8 strings (`cord`) or hoons
15−producing a `tape`.
16−
17−### Syntax
18−
19−Irregular: `"foobar"`.
20−
21−Irregular: `"foo{(weld "moo" "baz")}bar"`.
22−
23−### Examples
24−
25−String:
26−
27−```
28−~zod:dojo> "hello, world."
29−"hello, world."
30−```
31−
32−String with interpolation:
33−
34−```
35−~zod:dojo> =+(planet="world" "hello, {planet}.")
36−"hello, world."
37−```
38−
39−String with interpolated prettyprinting:
40−
41−```
42−~zod:dojo> =+(planet=%world "hello, {<planet>}.")
43−"hello, %world."
44−```
docs/hoon/atom/path.mddeleted−31
@@ -1,31 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 4
4−title: Path
5−---
6−
7−# Path
8−
9−`[%path p=(list (each @ta hoon))]`: path with interpolation.
10−
11−### Produces
12−
13−A null-terminated list if of the items in `p`, which are either constant
14−`@ta` atoms (`knot`), or hoons producing a `knot`.
15−
16−### Syntax
17−
18−Irregular: `/foo/bar/baz`.
19−
20−### Examples
21−
22−```
23−~zod/dojo> /foo/bar/baz
24−/foo/bar/baz
25−
26−~zod/dojo> `path`/foo/[`@ta`(cat 3 %moo %bar)]/baz
27−/foo/moobar/baz/
28−
29−~zod:dojo> /
30−~
31−```
docs/hoon/atom/rock.mddeleted−37
@@ -1,37 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 2
4−title: Rock
5−---
6−
7−# Rock
8−
9−`[%rock p=term q=@]`; a constant, cold atom.
10−
11−### Produces
12−
13−A cold (fixed) atom `q` with aura `a`.
14−
15−### Syntax
16−
17−Irregular: any warm atom [(`%sand`)](../sand/) form, prefixed with `%`.
18−
19−Irregular: `%foo`, `@tas`, symbol. Character constraints: `a-z`
20−lowercase to start, `a-z` or `0-9` thereafter, with infix
21−hyphens (`hep`), "kebab-case."
22−
23−Irregular: `~`, `@n`, null (`0`).
24−
25−### Examples
26−
27−```
28−~zod:dojo> ?? %foobar
29− [%atom %tas [~ u=125.762.588.864.358]]
30−%foobar
31−~zod:dojo> ?? %'foobar'
32− [%atom %t [~ u=125.762.588.864.358]]
33−%'foobar'
34−~zod:dojo> ?? 'foobar'
35− [%atom %t ~]
36−'foobar'
37−```
docs/hoon/basic.mddeleted−234
@@ -1,234 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 15
4−next: true
5−title: Basic types
6−---
7−
8−# Basic types
9−
10−A Hoon `type` is a set of nouns. There is no syntax for directly
11−defining the data type of a Hoon expression. Instead, the compiler
12−infers the type of a Hoon expression by calculating the range of
13−possible values of that expression.
14−
15−Working with a type in Hoon normally requires the use of a `mold`.
16−Each type is defined by a mold. To define a custom type, you must
17−create a custom mold.
18−
19−## Molds
20−
21−A mathematical function is a mapping from one set (the domain) to
22−another (the range). Pass an object from the domain to some
23−function *f*, and *f* returns an object from the range. In Hoon we
24−can think of a `gate` as a function, where the gate's `sample` is
25−its argument.
26−
27−A `mold` is an idempotent function whose domain is the set of all
28−nouns. (That is, it's an idempotent gate that takes any noun for its
29−sample.) An idempotent function *f* is one such that, if *f(x)*
30−terminates, *f(x) = f(f(x))*. The product range of a mold is the
31−type defined by that mold. That is, each mold's type is the set of
32−possible outputs of that mold.
33−
34−Essentially, molds are constructor functions. You can pass a mold
35−any data you like, and the product is guaranteed be of the type
36−defined by that mold. Molds are the perfect tool for validating
37−untrusted foreign data. Just call the relevant mold with that data
38−and check that the input equals the output. This is one reason why
39−molds must be idempotent; if the untrusted data is of the correct
40−type, passing it to the mold shouldn't change it. But this use case
41−is unusual for beginners; in normal practice you shouldn't call
42−molds directly.
43−
44−More frequently, molds are used when we want to `cast`. We use a
45−cast when we want the Hoon compiler's type-checker to test whether
46−a Hoon expression is guaranteed to evaluate to a product of the
47−desired type. If it isn't, then the compiler will halt with a
48−`nest-fail` crash. Proper Hoon code will include a cast for the
49−product type of each gate.
50−
51−The `^` family of runes is for casting. In particular, `^-` allows
52−us to cast with a mold. For example, we can cast for an `atom` using
53−the `@` mold as follows:
54−
55−```
56−^- @
57−17
58−```
59−
60−Evaluating the above in `dojo` should return 17, because 17 is of
61−the type `atom`. On the other hand,
62−
63−```
64−^- @
65−[17 18]
66−```
67−
68−...this should result in a `nest-fail`, because `[17 18]` is a cell,
69−not an atom.
70−
71−See the documentation on the [`^` family](../rune/ket/) of runes
72−for more information on casts. See the documentation on the
73−[`$` family](../rune/buc/) of runes for building molds.
74−(Also check out the irregular `,` operator.)
75−
76−## `type`: a set of types
77−
78−Below is the mold for `type`, which effectively defines all the types
79−available in Hoon.
80−
81−Strictly speaking, this mold defines the tree data structure the Hoon
82−compiler uses to represent type information. It has a label for each
83−of the base types, and it's recursive, so a complex type is
84−represented as a nested combination of base types and various other
85−odds and ends.
86−
87−You haven't seen this syntax before, and we haven't explained it yet;
88−just treat it as pseudocode.
89−
90−This is a slightly simplified version of `type`. We undo and
91−explain the simplifications in the [advanced types](../advanced)
92−section.
93−
94−```
95−++ term @tas
96−++ type
97− $@ $? %noun
98− %void
99− == $% [%atom p=term q=(unit atom)]
100− [%cell p=type q=type]
101− [%core p=type q=(map term hoon)]
102− [%face p=term q=type]
103− [%fork p=(set type)]
104− [%hold p=type q=hoon]
105− ==
106−```
107−
108−If the `type`-tree is an atom, it's either a `%noun` or a `%void`; if
109−the `type`-tree is a cell, it's a tuple with one of the heads `%atom`,
110−`%cell`, `%core`, etc. We'll go through each of these cases below.
111−these cases below.
112−
113−### `?(%noun %void)`
114−
115−`%noun` is the label for the set of all nouns. `%void` is the label
116−for the empty set.
117−
118−(For now, don't worry too much about the switch from `$` to `%`.)
119−
120−### `[%cell p=type q=type]`
121−
122−`[%cell p=type q=type]` is for the set of all cells with head `p` and
123−tail `q`.
124−
125−### `[%fork p=(set type)]`
126−
127−`[%fork p=(set type)]` is for the union of all types in the set `p`.
128−
129−### `[%hold p=type q=hoon]`
130−
131−A `%hold` type, with type `p` and hoon `q`, is a lazy reference
132−to the type of `(mint p q)`. In English, it means: "the type of
133−the product when we compile `q` against subject `p`."
134−
135−Note that this means we can have parsed Hoon AST data in the
136−`type`-tree.
137−
138−### `[%face p=term q=type]`
139−
140−A `[%face p=term q=type]` wraps the label `p` around the type
141−`q`. `p` is a `term` or `@tas`, an atomic ASCII string which
142−obeys symbol rules: lowercase and digit only, infix hyphen,
143−first character must be lowercase.
144−
145−See [`%limb`](../limb/limb/) for how labels are resolved. It's
146−nontrivial.
147−
148−### `[%atom p=term q=(unit atom))]`
149−
150−`%atom` is for an atom, with two twists. `q` is a `unit`, Hoon's
151−equivalent of a nullable pointer or a Haskell `Maybe`. If `q`
152−is `~`, null, the type is *warm*; any atom is in the type.
153−If `q` is `[~ x]`, where `x` is any atom, the type is *cold*;
154−its only legal value is the constant `x`.
155−
156−`p` in the atom is a terminal used as an *aura*, or soft atom
157−type. Auras are a lightweight, advisory representation of the
158−units, semantics, and/or syntax of an atom. An aura is an atomic
159−string; two auras are compatible if one is a prefix of the other.
160−
161−For instance, `@t` means UTF-8 text (LSB low), `@ta` means ASCII
162−text, and `@tas` means an ASCII symbol. `@u` means an unsigned
163−integer, `@ud` an unsigned decimal, `@ux` an unsigned
164−hexadecimal. You can use a `@ud` atom as a `@u` or vice versa,
165−but not as a `@tas`.
166−
167−Auras can also end with an optional, capitalized suffix, which
168−defines the atom's bitwidth as a log starting from `A`. For
169−example, `@udD` is an unsigned decimal byte; `@uxG` is an
170−unsigned 64-bit hexadecimal.
171−
172−You can make up your own auras and are encouraged to do so, but
173−here are some conventions bound to constant syntax:
174−
175−```
176−@c UTF-32 codepoint
177−@d date
178− @da absolute date
179− @dr relative date (ie, timespan)
180−@n nil
181−@p phonemic base (plot)
182−@r IEEE floating-point
183− @rd double precision (64 bits)
184− @rh half precision (16 bits)
185− @rq quad precision (128 bits)
186− @rs single precision (32 bits)
187−@s signed integer, sign bit low
188− @sb signed binary
189− @sd signed decimal
190− @sv signed base32
191− @sw signed base64
192− @sx signed hexadecimal
193−@t UTF-8 text (cord)
194− @ta ASCII text (knot)
195− @tas ASCII text symbol (term)
196−@u unsigned integer
197− @ub unsigned binary
198− @ud unsigned decimal
199− @uv unsigned base32
200− @uw unsigned base64
201− @ux unsigned hexadecimal
202−```
203−
204−Auras are truly soft; you can turn any aura into any other,
205−statically, by casting through the empty aura `@`. Hoon is not
206−dependently typed and can't statically enforce data constraints
207−(for example, it can't enforce that a `@tas` is really a symbol).
208−
209−### `[%core p=type q=(map term type)]`
210−
211−`%core` is for a code-data cell. The data (or *payload*) is the
212−tail; the code (or *battery*) is the head. `p`, a type, is the
213−type of the payload. `q`, a name-hoon table, is the source code
214−for the battery.
215−
216−Each hoon in the battery source is compiled to a formula, with
217−the core itself as the subject. The battery is a tree of these
218−formulas, or *arms*. An arm is a computed attribute against its
219−core.
220−
221−All code-data structures in normal languages (functions, objects,
222−modules, etc) become cores in Hoon. A Hoon battery looks a bit
223−like a method table, but not every arm is a "method" in the OO
224−sense. An arm is a computed attribute. A method is an arm whose
225−product is a Hoon function (or *gate*).
226−
227−A gate (function, lambda, etc) is a core with one arm, whose name
228−is the empty symbol `$`, and a payload whose shape is `[sample
229−context]`. The *context* is the subject in which the gate was
230−defined; the *sample* is the argument.
231−
232−To call this function on an argument `x`, replace the sample (at
233−tree address `6` in the core) with `x`, then compute the arm.
234−(Of course, we don't mutate the noun, we make a mutant copy.)
docs/hoon/concepts.mddeleted−260
@@ -1,260 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 14
4−next: true
5−title: Concepts
6−---
7−
8−# Concepts and terminology
9−
10−Usually, a new language is an improvement on one you already
11−know. If it isn't, it probably at least shares concepts with a
12−large family of relatives. These concepts come with words, like
13−_variable_ or _function_, that map cleanly onto its semantics.
14−
15−In Hoon we throw away many of these words and invent new
16−ones, which mean almost the same things. But why?
17−
18−## Motivation
19−
20−Hoon has no close relatives. The normal jargon of programming
21−maps poorly onto its semantics. Some of the common concepts used
22−only informally in Hoon include "function," "object," "event,"
23−"variable," "label," "closure", "environment," "scope," and probably
24−a few more. We do use these words informally, but we're always
25−making an analogy whose precision depends on context.
26−
27−Hoon has concepts *like* all these abstractions, but they remain
28−*false cognates*. The closer an inexact cognate, the more
29−unsettling it feels when the abstractions don't match. Learning
30−a few new words is a small price for avoiding this pain point.
31−
32−## Concepts
33−
34−A few major Hoon concepts: `noun` (data), `nock` (interpreter),
35−[`hoon`](#-hoon) (AST node), [`mint`](#-mint) (compiler), [`type`](#-type) (type),
36−`gate` (function), `mold` (constructor), `core` (object), `mark`
37−(protocol).
38−
39−### <a name="-noun">`noun`</a> (data value)
40−
41−A value in Hoon is called a `noun`. A noun is either a
42−unsigned integer of any size (`atom`), or an ordered pair of any
43−two nouns (`cell`). Nouns are like Lisp S-expressions, but
44−simpler (Lisp atoms effectively have dynamic type bits).
45−
46−The simplest noun syntax uses brackets, like `[a b]` for the cell
47−of `a` and `b`. Brackets nest right; `[a b c d]` is `[a [b [c
48−d]]]`.
49−
50−A noun list, by convention, goes from left to right and is
51−null-terminated. That said, Hoon uses tuples (improper nouns) more
52−freely than Lisp; only genuinely iterative structures are
53−null-terminated lists.
54−
55−When an atom is used as a string (a `cord`), the bytes are always UTF-8
56−in LSB first order. When you see `'foo'` and `%foo`, this refers to the
57−integer `0x6f.6f66`, aka `7.303.014`. (Hoon syntax uses `.` to break
58−integer atoms in the German style, because `.`'s are URL-safe and `,`'s
59−aren't.)
60−
61−One common operation on nouns is `slot`, a tree addressing
62−scheme which maps an atom to a subtree. The whole noun is slot
63−`1`; the left child of `n` is `2n`, the right child `2n+1`.
64−
65−Nothing in Nock, Hoon, or Urbit can create cycles in a noun or
66−detect pointer equivalence. Nouns are generally implemented
67−with reference counting, and have a lazy short Merkle hash to
68−help with equality testing and associative containers.
69−
70−### <a name="-nock">`nock`</a> (interpreter)
71−
72−Hoon compiles itself to the [Nock](../../nock) VM. Nock is a
73−Turing-complete, non-lambda combinator function. The function
74−takes a cell `{subject formula}`, and produces a noun `product`.
75−
76−To program in Hoon, this is all you need to know about Nock. But
77−it's still fun and useful to [learn more](../../nock).
78−
79−## Compilation concepts
80−
81−### <a name="-hoon">`hoon`</a> (AST node)
82−
83−A [`hoon`](../reference) is the result of parsing a Hoon source
84−expression into an AST node. These AST nodes are nouns, like all
85−other Hoon data. Because every Hoon program is, in its entirety, a
86−single expression of Hoon, the result of parsing the whole thing
87−into an AST is a single `hoon`.
88−
89−A hoon is a tagged union of the form `[%tag data]`, where the tag
90−is a constant such as `%brts` (from the source `|=`, i.e. "bartis"),
91−and is matched up with the appropriate type of data (often more
92−`hoon`s, from source subexpressions). For example, the expression
93−`:-(2 17)`, once parsed into an AST, becomes the following:
94−
95−```
96−[%clhp p=[%sand p=%ud q=2] q=[%sand p=%ud q=17]]
97−```
98−
99−The `%clhp` is produced from the rune `:-` (i.e. "colhep"). The 2 and
100−17 have each been parsed as `%sand`-tagged hoons, which represent
101−atoms (in this case each with an aura of `%ud`, i.e. unsigned
102−decimal).
103−
104−To parse Hoon source into a hoon AST, use `ream` on a `cord`
105−containing Hoon source. Try the following in `dojo`:
106−
107−```
108−(ream ':+(12 7 %a)')
109−```
110−
111−The result should be:
112−
113−```
114−[%clls p=[%sand p=%ud q=12] q=[%sand p=%ud q=7] r=[%rock p=%tas q=97]]
115−```
116−
117−### <a name="-mint">`mint`</a> (compiler)
118−
119−[`mint`](#-mint) is the Hoon compiler. It maps a cell `[type hoon]`
120−to a cell `[type nock]`, where a [`type`](#-type) is type
121−information, a [`hoon`](#-hoon) is a parsed expression (AST), and a
122−`nock` is a Nock formula. `mint` takes as input the subject type
123−and a parsed source expression; it produces a product type and an
124−executable formula.
125−
126−Calculating the output type from the input `hoon` and subject type
127−is called "type inference". If you've used another typed functional
128−language, like Haskell, the Hoon compiler's type inference does the
129−same job but with less intelligence.
130−
131−Haskell infers backward and forward; Hoon only infers forward.
132−Hoon can't figure out the type of a noun from how you use it,
133−only from how you make it. Hoon can infer tail recursion, but
134−not head recursion.
135−
136−Low-powered type inference means you need more type annotations,
137−which makes your program more readable anyway. Also, the dumber
138−the compiler, the easier it is for a dumb human to understand
139−what the compiler is thinking.
140−
141−The `mint` gate is inside the core `++ ut`, so call it using the
142−following syntax:
143−
144−```
145−(~(<gate> <core> <arg 1>) <arg 2> <arg 3>)
146−```
147−
148−The `<gate>` is mint, the `<core>` is `ut`, `<arg 1>` is the subject
149−type, and `<arg 3>` is the parsed Hoon AST (i.e., a `hoon` from the
150−last section). What's `<arg 2>`? It's another piece of type
151−information. As part of the type-checking process, mint checks that
152−the output type "nests" within the input type, i.e. that the output
153−type is a subset of the input type. If not, mint halts with a
154−`nest-fail` crash.
155−
156−Let's compile an example `hoon` from the last subsection into Nock.
157−Try the following in Dojo:
158−
159−(~(mint ut %noun) %noun [%clhp p=[%sand p=%ud q=2] q=[%sand p=%ud q=17]])
160−
161−### <a name="-type">`type`</a> (type, as range)
162−
163−A `type` defines a set (finite or infinite) of nouns and ascribes
164−some semantics to it. There is no direct syntax for defining
165−types; they are always defined by inference (i.e., by
166−[`mint`](#-mint)), usually using a constructor (`mold`).
167−
168−All types are assembled out of base types defined in `++type`.
169−(Look up `++ type` in hoon.hoon for examples.) When the compiler
170−does type-inference on a program, it assembles complex types out
171−of the simpler built-in types.
172−
173−### <a name="-gate">`gate`</a> (function)
174−
175−A `gate` is a Hoon function (lambda or closure). Other
176−constructs in Urbit are functions in the mathematical sense -- for
177−instance, a Nock formula is also a function. But a gate is not a
178−formula. The gate's argument is its *sample*; the result is its
179−*product*.
180−
181−### <a name="-core">`core`</a> (object)
182−
183−A `core` has no exact equivalent in conventional languages, but
184−the closest equivalent is an object. An object has methods; a
185−core has functionally computed attributes (*arms*). An arm that
186−produces a gate is the Hoon equivalent of a conventional method;
187−think of it as a computed attribute whose value is a lambda.
188−
189−A gate is a special case of a core: a core with one arm, whose
190−name is the empty string. The shape of a core is `[battery
191−payload]`, where *battery* is a tree of Nock formulas
192−
193−### <a name="-mold">`mold`</a> (constructor)
194−
195−A `mold` is a constructor function (`gate`). Its sample is any
196−noun; its product is a structured noun. A mold is idempotent;
197−`(mold (mold x))` always equals `(mold x)`.
198−
199−Because there's no such thing as a [`type`](#-type) declaration,
200−we use molds to define useful types by example; we also use them
201−to validate untrusted network data.
202−
203−### <a name="-face">`face`</a> (named variable)
204−
205−In a conventional language, we have a scope, environment or
206−symbol table. Declaring a variable, like e.g. `int foo = 3`,
207−adds the name `foo` to the table with type `int`.
208−
209−The Hoon analogue is `=/(foo atom 3 ...)`, where `foo` is a `face`
210−and `atom` is the type. But Hoon has a homoiconic heap; there is no
211−inscrutable scope or environment. There is just the subject, which
212−is one noun. To "declare a variable" is to make a cell
213−`[variable old-subject]`, and use that as the subject of the next
214−expression.
215−
216−The label `foo` isn't a key in a symbol table; it's stored as a kind
217−of metadata, in the type ([`type`](#-type)) of the new value. It's not
218−a variable named `foo`, whose value is of type `atom`; it's a subtree
219−of type `foo:atom`.
220−
221−### <a name="-limb">`limb`</a> (attribute or variable reference)
222−
223−A [`limb`](../limb/limb/), like `foo`, is Hoon's equivalent of a variable
224−reference. A limb is a [`hoon`](#-hoon); given a subject [`type`](#-type),
225−[`mint`](#-mint) resolves it to a Nock formula and a product [`type`](#-type).
226−
227−To resolve limb `foo`, [`mint`](#-mint) searches the subject depth-first,
228−head-first for either a `face` named `foo`, or a `core` with the
229−arm `foo`. If it finds a face, the product is a *leg*, or
230−subtree of the subject. If it finds a core, it computes the arm
231−formula with that core as the subject. A limb can also be a slot
232−(direct tree address), like `+15`.
233−
234−The hoon compiler always resolves a limb to a tree axis lookup,
235−regardless of the kind of limb.
236−
237−`boo:[foo=12 baz=23 boo=34]` evaluates to `34`.
238−`+6:[foo=12 baz=23 boo=34]` evaluates to `baz=23`.
239−
240−### <a name="-wing">`wing`</a> ([`limb`](#-limb) path)
241−
242−A [wing](../limb/wing/) is a list of limbs. Like attribute
243−references in a conventional language, it uses the syntax `a.b.c`,
244−but inside out: Hoon `a.b.c` means "a within b within c", the equivalent
245−of `c.b.a` in any other language. All limbs but the last, here `a`,
246−must be legs.
247−
248−### <a name="-mark">`mark`</a> (type, as protocol name)
249−
250−A `mark` (really an Arvo concept, not a Hoon concept) is Urbit's
251−version of a MIME type, if a MIME type was an executable
252−specification. The mark is just a label that's used as a path to
253−a local source file in the Arvo filesystem. This source file
254−defines a core that can mold untrusted data, diff and patch,
255−convert to other marks, etc.
256−
257−If this sounds like magic, it isn't quite magic. There's no way
258−for different urbits to make sure they mean the same thing by the
259−same mark. However, when incompatibility happens, marks ensure
260−that we at least handle the situation in a predictable way.
docs/hoon/demo.mddeleted−83
@@ -1,83 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 12
4−next: true
5−title: Demo
6−---
7−
8−# Demo
9−
10−Here's everyone's favorite whiteboard example,
11−[FizzBuzz](https://en.wikipedia.org/wiki/Fizz_buzz). Each
12−line is commented with its number:
13−
14−```
15−|= end=@ :: 1
16−=/ count=@ 1 :: 2
17−|- :: 3
18−^- (list tape) :: 4
19−?: =(end count) :: 5
20− ~ :: 6
21−:- :: 7
22− ?: =(0 (mod count 15)) :: 8
23− "FizzBuzz" :: 9
24− ?: =(0 (mod count 5)) :: 10
25− "Fizz" :: 11
26− ?: =(0 (mod count 3)) :: 12
27− "Buzz" :: 13
28− <count> :: 14
29−$(count (add 1 count)) :: 15
30−```
31−
32−When FizzBuzz is written in non-functional languages, the
33−output is generated as a side effect of the program, e.g., with
34−`printf()`. Hoon is a functional language, so technically it
35−has no side effects. Accordingly, the code above *produces* a
36−list of strings; it doesn't print them. (If you run it from the
37−Urbit shell, [_Dojo_](../../using/shell), you will of course be
38−able to see the product.)
39−
40−The code produces a list in which each item is either a number,
41−"Fizz", "Buzz", or "Fizzbuzz". The value `~` is "null" and indicates
42−the end of the list.
43−
44−Line 1 uses the _[rune](../../about/glossary#rune)_ `|=` to define
45−a function that takes one input, `end`. The input value must be of
46−the type `@`, an atom (i.e., an unsigned integer).
47−
48−Line 2 uses `=/` to declare a variable, `count`, as an atom with an
49−initial value of `1`.
50−
51−Line 3 uses `|-` to indicate the starting point of a loop.
52−
53−Line 4 defines the product of the loop as a list of `tape`s.
54−(A `tape` is a list of characters, one of Hoon's two string
55−types.) The rune `^-` is used for defining the type of value the
56−function is required to produce.
57−
58−Line 5 uses the rune `?:` which is an ordinary "if-then-else"
59−conditional. If `=(end count)` evaluates as true, then line 6 is
60−evaluated next. Otherwise line 7 and on is evaluated.
61−
62−If the values of `count` and `end` are equal then line 6 produces the
63−value `~`, indicating the end of the list. The program is finished.
64−
65−If not, line 7 uses the rune `:-` to produce an
66−[ordered pair](https://en.wikipedia.org/wiki/Ordered_pair) of values.
67−The pair created will be `[a b]`: (a) the product of lines 8-14; and
68−(b) the product of line 15.
69−
70−(a) The first value of the pair is: (i) "FizzBuzz", or "Fizz", or
71−"Buzz", if the respective conditional tests hit; otherwise, it's
72−(ii) the number in question, `count`. In case (ii), line 14
73−uses the `< >` symbols to convert `count` from an `@` to a `tape`.
74−
75−(b) The second value of the pair -- i.e., the rest of the output
76−list -- is produced by line 15. This line uses `$()` to loop back
77−to the `|-` in line 3, but with `count` increased in value by `1`.
78−
79−You can test this code for yourself by (i) entering `|mount %` in the
80−Dojo to mount your home desk, if you haven't already done so; (ii)
81−saving the above code as `home/gen/fizzbuzz.hoon` in your Urbit's
82−[pier](../../about/glossary#pier); then (iii) entering `+fizzbuzz 100`
83−in the dojo.
docs/hoon/examples.mddeleted−595
@@ -1,595 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 21
5−title: Examples
6−---
7−
8−# Examples
9−
10−Now we know enough to write two quick examples: the Sieve of
11−Eratosthenes (a naive prime sieve) and a tic-tac-toe engine.
12−
13−(Note that these are not examples of perfect Hoon code; they are
14−meant for teaching. They err, more than usual for Hoon, on the
15−side of simple manual construction over high-octane FP.)
16−
17−## `sieve`: code in basic style
18−
19−A function that produces the list of primes less than or equal to
20−its argument, an atom:
21−
22−```
23−|= thru=@ :: 1
24−^- (list @) :: 2
25−=/ field=(set @) (sy (gulf 2 thru)) :: 3
26−=< abet:main :: 4
27−|% :: 5
28−++ abet :: 6
29− (sort ~(tap in field) lth) :: 7
30−:: :: 8
31−++ main :: 9
32− =/ factor=@ 2 :: 10
33− |- ^+ ..main :: 11
34− ?: (gth (mul factor factor) thru) :: 12
35− ..main :: 13
36− $(factor +(factor), ..main (reap factor)) :: 14
37−:: :: 15
38−++ reap :: 16
39− |= factor=@ :: 17
40− =/ count=@ (mul 2 factor) :: 18
41− |- ^+ ..reap :: 19
42− ?: (gth count thru) :: 20
43− ..reap :: 21
44− %= $ :: 22
45− count (add count factor) :: 23
46− field (~(del in field) count) :: 24
47− == :: 25
48−-- :: 26
49−```
50−
51−## `sieve`: explanation
52−
53−```
54−|= thru=@ :: 1
55−^- (list @) :: 2
56−=/ field=(set @) (sy (gulf 2 thru)) :: 3
57−```
58−
59−Line `1`: we are building a gate (function) whose sample
60−(argument) is `thru`, an atom.
61−
62−Line `2`: the product of this gate is a list of atoms.
63−
64−Line `3`: we introduce a variable `field`, whose type is a set of
65−atoms. The `sy` function converts a list to a set. The `gulf`
66−function creates the range `2` through `thru` inclusive, as a
67−list of atoms.
68−
69−Line `4`: below, we introduce a core which does our work. With
70−reverse flow, we compute `main` on this core, then `abet` on the
71−product of `main`. (`abet:main` means `=<(abet main)`.)
72−
73−The core is a state machine; `main` produces the core itself,
74−with the computation completed. `abet` then extracts the result.
75−
76−```
77−|% :: 5
78−++ abet :: 6
79− (sort ~(tap in field) lth) :: 7
80−```
81−
82−Line `5`: we wrap a core around our existing subject. The
83−`field` and `thru` atoms are within the payload and of course
84−remain accessible.
85−
86−Lines `6` and `7`: the `abet` arm, which produces the field as a
87−sorted list. `in` is the set core; `tap` is an arm that exports
88−the set as a list. We sort this list in ascending order with
89−`lth` (less-than).
90−
91−```
92−++ main :: 9
93− =/ factor=@ 2 :: 10
94− |- ^+ ..main :: 11
95−```
96−
97−Line `9`: the `main` arm, which performs the main calculation.
98−
99−Line `10`: we declare a counter, `factor`, which will iterate
100−up through the factors we're removing.
101−
102−Line `11`: we start a loop. The product of the loop is cast to
103−`..main`, which is the core we're in (`+1.main`).
104−
105−```
106− ?: (gth (mul factor factor) thru) :: 12
107− ..main :: 13
108− $(factor +(factor), ..main (reap factor)) :: 14
109−```
110−
111−Lines `12` and `13`: we terminate the loop, returning `..main`,
112−if the square of the counter exceeds the range.
113−
114−Line `14`: repeats the loop, incrementing the counter, and
115−replacing the core with a version sieved by `reap`.
116−
117−```
118−++ reap :: 16
119− |= factor=@ :: 17
120− =/ count=@ (mul 2 factor) :: 18
121−```
122−
123−Lines `16` and `17`: the `reap` arm, which produces a gate that
124−removes multiples of a factor from the field (set of possible
125−primes). The sample of this gate is the factor to remove.
126−
127−Line `18`: we declare a variable `count`, an atom, with the
128−initial value `(mul 2 factor)`.
129−
130−```
131− |- ^+ ..reap :: 19
132− ?: (gth count thru) :: 20
133− ..reap :: 21
134− %= $ :: 22
135− count (add count factor) :: 23
136− field (~(del in field) count) :: 24
137− == :: 25
138−-- :: 26
139−```
140−
141−Line `19`: we enter a loop. This loop produces the core itself.
142−
143−Lines `20` and `21`: we are done if the counter is out of range.
144−
145−Lines `22` to `25`: repeat the loop, stepping `count` to the next
146−multiple of `factor`, and deleting it from `field`.
147−
148−## `sieve`: code in kernel style
149−
150−Finally, the same code in a more concise "kernel" style.
151−```
152−|= top=@
153−^- (list @)
154−=+ fed=(sy (gulf 2 top))
155−=< abet:main
156−|%
157−++ abet (sort (~(tap in fed)) lth)
158−++ main
159− =+ fac=2
160− |- ^+ ..main
161− ?: (gth (mul fac fac) top)
162− ..main
163− $(fac +(fac), ..main (reap fac))
164−::
165−++ reap
166− |= fac=@
167− =+ cot=(mul 2 fac)
168− |- ^+ ..reap
169− ?: (gth cot top)
170− ..reap
171− $(cot (add cot fac), fed (~(del in fed) cot))
172−--
173−```
174−
175−### `toe`: tic-tac-toe engine
176−
177−The `toe` tic-tac-toe engine applies a list of events to a game
178−state, producing a list of game actions. Events are tic-tac-toe
179−moves (`move)`; actions are tic-tac-toe results (`fact`).
180−
181−```
182−=< |= feed/(list move) :: 1
183− =| game/game :: 2
184− |- ^- (list fact) :: 3
185− ?~ feed ~ :: 4
186− =^ this/(unit fact) :: 5
187− game :: 6
188− (~(do go game) i.feed) :: 7
189− =/ rest/(list fact) $(feed t.feed) :: 8
190− ?~(this rest [u.this rest]) :: 9
191−:: :: 10
192−=> |% :: 11
193− ++ side @ :: 12
194− ++ spot {x/@ y/@} :: 13
195− ++ fact $% {$tie $~} :: 14
196− {$win p/cord} :: 15
197− == :: 16
198− ++ move $% {$x p/spot} :: 17
199− {$o p/spot} :: 18
200− {$z $~} :: 19
201− == :: 20
202− ++ game $: w/? :: 21
203− a/side :: 22
204− z/side :: 23
205− == :: 24
206− -- :: 25
207−|% :: 26
208−++ bo :: 27
209− |_ half/side :: 28
210− ++ bit |=(a/@ =(1 (cut 0 [a 1] half))) :: 29
211− ++ off |=(a/spot (add x.a (mul 3 y.a))) :: 30
212− ++ get |=(a/spot (bit (off a))) :: 31
213− ++ set |=(a/spot (con half (bex (off a)))) :: 32
214− ++ win %+ lien :: 33
215− (rip 4 0wl04h0.4A0Aw.4A00s.0e070) :: 34
216− |=(a/@ =(a (dis a half))) :: 35
217− -- :: 36
218−++ go :: 37
219− |_ game/game :: 38
220− ++ do :: 39
221− |= act/move :: 40
222− ^- {(unit fact) ^game} :: 41
223− ?- act :: 42
224− {$x *} ?>(w.game ~(mo on p.act)) :: 43
225− {$o *} ?<(w.game ~(mo on p.act)) :: 44
226− {$z *} [~ nu] :: 45
227− == :: 46
228− :: :: 47
229− ++ nu ^+(game [& 0 0]) :: 48
230− ++ on :: 49
231− |_ here/spot :: 50
232− ++ is ?| (~(get bo a.game) here) :: 51
233− (~(get bo z.game) here) :: 52
234− == :: 53
235− ++ mo ^- {(unit fact) ^game} :: 54
236− ?< is :: 55
237− =/ next/side (~(set bo a.game) here) :: 56
238− ?: ~(win bo next) :: 57
239− [[~ %win ?:(w.game %x %o)] nu] :: 58
240− [~ game(w !w.game, a z.game, z next)] :: 59
241− -- :: 60
242− -- :: 62
243−-- :: 63
244−```
245−
246−### `toe`: explanation
247−
248−```
249−=< |= feed/(list move) :: 1
250− =| game/game :: 2
251− |- ^- (list fact) :: 3
252− ?~ feed ~ :: 4
253−```
254−
255−Line `1` wraps a conclusion around a stack of cores. The cores
256−at `11` and `26` are the data structures and functions of the
257−engine; the conclusion is the interface and top-level logic. It
258−produces a gate whose sample is `feed`, a list of `move`.
259−
260−Line `2` declares a blank new variable named `game`, whose type
261−is the `game` mold (tic-tac-toe game state) defined on line `21`.
262−Under line `2`, `game` pulls the variable and `^game` the mold.
263−
264−Line `3` enters a loop producing a list of game events, `fact`.
265−
266−Line `4` produces nil, `~`, if `feed` is empty.
267−
268−```
269− =^ this/(unit fact) :: 5
270− game :: 6
271− (~(do go game) i.feed) :: 7
272−```
273−
274−Lines `5` through `7` apply the move. We open a `go` core on the
275−current game state, produce a `do` gate, and call that gate on
276−the move. The product of the `do` gate is a pair; the head is
277−`(unit fact)`, either `~` or `[~ fact]`; the tail is a new
278−`game`. The `=^` hoon declares the head as a new variable,
279−`this`; it modifies the subject by setting `game` to the tail.
280−
281−```
282− =/ rest/(list fact) $(feed t.feed) :: 8
283− ?~(this rest [u.this rest]) :: 9
284−```
285−
286−Line `8` declares a new variable, `rest`, which is all the facts
287−generated by the moves in `t.feed`, the tail of the move list.
288−(Yes, this is gratuitous head recursion.) Line `9` produces
289−`rest` if the `i.feed` move produced no fact; otherwise it
290−prepends the new fact to `rest`.
291−
292−```
293−=> |% :: 11
294− ++ side @ :: 12
295− ++ spot {x/@ y/@} :: 13
296−```
297−
298−Line `11` wraps a library core around a data structure core, a
299−common pattern. (You could put the molds and the gates in the
300−same core, but the compiler couldn't constant-fold gate samples
301−that use these molds, an efficiency cost.)
302−
303−Line `12` defines the `side` mold, an alias for `atom` (`@`).
304−A side is a half of the board, as a marked/unmarked bitfield.
305−
306−Line `13` defines the `spot` mold, a 2D coordinate.
307−
308−```
309− ++ fact $% {$tie $~} :: 14
310− {$win p/cord} :: 15
311− == :: 16
312−```
313−
314−Lines `14` to `16` define the `fact` mold, a game event (i.e.,
315−output action), as a book (tagged union). There are two forms of
316−`fact`: `[%tie ~]` (reporting a tie), and `[%win cord]`
317−(reporting that `'X'` or `'O'` won a game.
318−
319−```
320− ++ move $% {$x p/spot} :: 17
321− {$o p/spot} :: 18
322− {$z $~} :: 19
323− == :: 20
324−```
325−
326−Lines `17` to `20` define the `move` mold, a game move. This is
327−either `[%x spot]`, `[%o spot]`, or `[%z ~]` to reset the board.
328−
329−```
330− ++ game $: w/? :: 21
331− a/side :: 22
332− z/side :: 23
333− == :: 24
334− -- :: 25
335−```
336−
337−Lines `21` to `23` define the `game` mold, the game state. This
338−is an `a` side, the next side to move; a `z` side, the other
339−side; and `w`, which is `&` (yes) if `a` is X and `b` is O; `|`
340−otherwise. (Obviously, we swap `a` and `z` on every move.)
341−
342−```
343−|% :: 26
344−++ bo :: 27
345− |_ half/side :: 28
346− ++ bit |=(a/@ =(1 (cut 0 [a 1] half))) :: 29
347− ++ off |=(a/spot (add x.a (mul 3 y.a))) :: 30
348− ++ get |=(a/spot (bit (off a))) :: 31
349− ++ set |=(a/spot (con half (bex (off a)))) :: 32
350−```
351−
352−Line `26` introduces the library core, which contains the doors
353−`bo` (for `side` bitfields) and `go` (for game state).
354−
355−Lines `27` to `28` begin the `bo` core, a door around `half`, a
356−board side.
357−
358−Line `29` is the `bit` gate, which tests a bit in `half`.
359−
360−Line `30` is the `off` gate, which maps from a `spot` (coordinate)
361−to a bit index.
362−
363−Line `31` is the `get` gate, which produces the bit at a `spot`.
364−
365−Line `32` is the `set` gate, which produces a new side with the
366−bit at a `spot` set. It works by ORing (`con`) `half` with the
367−binary exponent (`bex`) of the offset (`off`) of the spot.
368−
369−```
370− ++ win %+ lien :: 33
371− (rip 4 0wl04h0.4A0Aw.4A00s.0e070) :: 34
372− |=(a/@ =(a (dis a half))) :: 35
373− -- :: 36
374−```
375−
376−Lines `33` to `35` are a victory test. It calls the
377−standard `lien` function, which iterates a boolean gate over a
378−list and produces `&` (yes) if any item tests as true, against a
379−list of magic bitfields (expanded from a base64 constant), each
380−of which must equal itself when ANDed (`dis`) with `half`.
381−
382−```
383−++ go :: 37
384− |_ game/game :: 38
385− ++ do :: 39
386− |= act/move :: 40
387− ^- {(unit fact) ^game} :: 41
388−```
389−
390−Lines `37` to `38` begin the `go` core, a door around a `game`.
391−Again we name the sample `game`. (This is a legitimate style,
392−but not used much.)
393−
394−Lines `40` to `42` begin the `do` gate, whose sample is `act`, a
395−move. The product is cast to a pair of `(unit fact)` and a new
396−game state, written `^game` to skip to the second binding.
397−
398−```
399− ?- act :: 42
400− {$x *} ?>(w.game ~(mo on p.act)) :: 43
401− {$o *} ?<(w.game ~(mo on p.act)) :: 44
402− {$z *} [~ nu] :: 45
403− == :: 46
404− :: :: 47
405−```
406−
407−Lines `42` through `46` switch on the form of `act`. If it's an
408−`%x` or `%o` move, we assert that it's the right turn, then use
409−the `mo` door to apply the move. If it's a `%z` move, we clear
410−the board.
411−
412−```
413− ++ nu ^+(game [& 0 0]) :: 48
414− ++ on :: 49
415− |_ here/spot :: 50
416− ++ is ?| (~(get bo a.game) here) :: 51
417− (~(get bo z.game) here) :: 52
418− == :: 53
419−```
420−
421−Line `48` is the `nu` arm, which produces a blank game state.
422−
423−Lines `49` to `50` begin the `on` door, a door around `here`, a
424−`spot`. Just as we have multiple computed attributes against the
425−game state, we have multiple computed attributes (`is` and `mo`)
426−against the combination of game state and coordinate.
427−
428−Lines `51` to `53` define the `is` arm, which is `&` (yes) if
429−either `a` or `z` has played `here`.
430−
431−```
432− ++ mo ^- {(unit fact) ^game} :: 54
433− ?< is :: 55
434− =/ next/side (~(set bo a.game) here) :: 56
435− ?: ~(win bo next) :: 57
436− [[~ %win ?:(w.game %x %o)] nu] :: 58
437− [~ game(w !w.game, a z.game, z next)] :: 59
438− -- :: 60
439− -- :: 62
440−-- :: 63
441−```
442−
443−Line `54` begins the `mo` arm, which produces (with a
444−nonessential cast) a pair of `(unit fact)` and game state.
445−Again we see `^game` to pull the mold, since `game` is the
446−current game state in the `go` core.
447−
448−Line `55` asserts that no one has yet played `here`.
449−
450−Line `56` declares a variable `next`, as game side `a` with
451−`here` played in it.
452−
453−Lines `57` and `58` test if `a` has won with this move. If so,
454−we produce the win fact and a blank game state.
455−
456−Line `59` produces no fact (since nothing has happened), but
457−inverts the `w` turn indicator, replaces side `a` with the other
458−side `z`, and replaces `z` with `next`.
459−
460−### `toe`: code, kernel style
461−
462−```
463−=< |= fed/(list move)
464− =| mag/game
465− |- ^- (list fact)
466− ?~ fed ~
467− =^ did/(unit fact) mag (~(do go mag) i.fed)
468− =+ res=$(fed t.fed)
469− ?~(did res [u.did res])
470−=> |%
471− ++ side @
472− ++ spot {x/@ y/@}
473− ++ fact $% {$tie $~}
474− {$win p/cord}
475− ==
476− ++ move $% {$x p/spot}
477− {$o p/spot}
478− {$z $~}
479− ==
480− ++ game $: w/?
481− a/side
482− z/side
483− ==
484− --
485−|%
486−++ bo
487− |_ haf/side
488− ++ bit |=(a/@ =(1 (cut 0 [a 1] haf)))
489− ++ get |=(a/spot (bit (off a)))
490− ++ off |=(a/spot (add x.a (mul 3 y.a)))
491− ++ set |=(a/spot (con haf (bex (off a))))
492− ++ win %+ lien
493− (rip 4 0wl04h0.4A0Aw.4A00s.0e070)
494− |=(a/@ =(a (dis a haf)))
495− --
496−++ go
497− |_ mag/game
498− ++ do
499− |= act/move
500− ^- {(unit fact) game}
501− ?- act
502− {$x *} ?>(w.mag ~(mo on p.act))
503− {$o *} ?<(w.mag ~(mo on p.act))
504− {$z *} [~ nu]
505− ==
506− ::
507− ++ nu `game`[& 0 0]
508− ++ on
509− =| her/spot
510− |%
511− ++ is ?| (~(get bo a.mag) her)
512− (~(get bo z.mag) her)
513− ==
514− ++ mo ^- {(unit fact) game}
515− ?< is
516− =+ next=(~(set bo a.mag) her)
517− ?: ~(win bo next)
518− [[~ %win ?:(w.mag %x %o)] nu]
519− [~ mag(w !w.mag, a z.mag, z next)]
520− --
521− --
522−--
523−```
524−
525−## Basic molds
526−```
527−++ atom @ :: just an atom
528−++ axis @ :: tree address
529−++ bean ? :: 0=&=yes, 1=|=no
530−++ bloq @ :: blockclass
531−++ char @tD :: UTF-8 byte
532−++ cord @t :: text atom (UTF-8)
533−++ gate $-(* *) :: general gate
534−++ knot @ta :: ASCII text
535−++ noun * :: any noun
536−++ null $~ :: null, nil, etc
537−++ time @da :: galactic time
538−++ path (list knot) :: eg, fs location
539−++ tang (list tank) :: error trace
540−++ tank ::
541− $% {$leaf p/tape} :: printing formats
542− $: $palm :: backstep list
543− p/{p/tape q/tape r/tape s/tape} ::
544− q/(list tank) ::
545− == ::
546− $: $rose :: flat list
547− p/{p/tape q/tape r/tape} :: mid open close
548− q/(list tank) ::
549− == ::
550− == ::
551−++ tanq :: future tank
552− $? {$~ p/(list tanq)} :: list of printables
553− {$~ $~ p/tape} :: simple string
554− (pair @tas tanq) :: captioned
555− == ::
556−++ tape (list char) :: string as list
557−++ term @tas :: ascii symbol
558−++ wall (list tape) :: text lines (no \n)
559−++ wain (list cord) :: text lines (no \n)
560−
561−::::
562−::::
563−
564−++ tree |* a/gate :: binary tree
565− $@($~ {n/a l/(tree a) r/(tree a)}) ::
566−++ trap |*(a/_* _|?(*a)) :: makes perfect sense
567−++ trel |* {a/gate b/gate c/gate} :: just a triple
568− {p/a q/b r/c} ::
569−++ each |* {a/gate b/gate} :: either a or b
570− $%({$& p/a} {$| p/b}) :: a default
571−
572−++ qual |* {a/gate b/gate c/gate d/gate} :: just a quadruple
573− {p/a q/b r/c s/d} ::
574−++ pair |*({a/gate b/gate} {p/a q/b}) :: just a pair
575−++ quid |*({a/gate b/*} {a _b}) :: for =^
576−++ quip |*({a/gate b/*} {(list a) _b}) :: for =^
577−++ unit |* a/gate :: maybe
578− $@($~ {$~ u/a}) ::
579−++ list |* a/gate :: null-term list
580− $@($~ {i/a t/(list a)}) ::
581−++ lone |*(a/gate p/a) :: just one thing
582−
583−::::
584−::::
585−++ map |* {a/gate b/gate} :: associative tree
586− $@($~ {n/{p/a q/b} l/(map a b) r/(map a b)}) ::
587−++ qeu |* a/gate :: queue
588− $@($~ {n/a l/(qeu a) r/(qeu a)}) ::
589−++ set |* a/gate :: set
590− $@($~ {n/a l/(set a) r/(set a)}) ::
591−++ jar |*({a/gate b/gate} (map a (list b))) :: map of lists
592−++ jug |*({a/gate b/gate} (map a (set b))) :: map of sets
593−```
594−
595−### Basic libraries
docs/hoon/exercises.mddeleted−18
@@ -1,18 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 22
5−title: Exercises
6−---
7−
8−# Exercises
9−
10−The best way to cement this knowledge in your mind is to do
11−exercises. These are roughly in order of ascending difficulty,
12−and they are intended to form a sort of primer to Hoon.
13−
14−Feel free to ask questions in the comments. You can subscribe to the
15−`/comments` `:talk` channel on this ship to keep abreast of the
16−conversation.
17−
18−<list />
docs/hoon/exercises/data-structures.mddeleted−62
@@ -1,62 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 4
4−comments: true
5−---
6−
7−# Sets and Maps
8−
9−Sets are constructed with `++silt`. A set is a non-ordered
10−collection of unique elements.
11−
12−```
13−(silt `(list @t)`['urbit' 'arvo' 'hoon' 'arvo' ~])
14−```
15−
16−We'll refer to this particular set as `s` in the exercises. It
17−is of type `(set @t)` since each element is a `@t`.
18−
19−The `++in` core contains library functions for dealing with sets.
20−For example, `++has:in` checks whether an element is in the set.
21−Thus, `(~(has in s) 'arvo')` returns yes. To complete these
22−exercises, you'll need to refer to the [library reference for
23−`++in`](/docs/hoon/library/2h).
24−
25−1. Create another set, `l`, with members `'c'`, `'hoon'`,
26− `'javacript'`, `'python'`.
27−
28−1. At the dojo, take the union of `s` and `l`. Delete
29− `'javascript'` from the result, and add `'coffeescript'`.
30−
31−1. Create an alphabetized list of the members of the set created
32− in the previous exercise.
33−
34−1. Take the Cartesian product of `s` and `l`. The Cartesian
35− product of two sets is the set of all cells `[a b]` where
36− `a` is in `s` and `b` is in `l`.
37−
38−The `++by` core is to maps as `++in` is to sets. Refer to its
39−[library reference](/docs/hoon/library/2i). Note that since a
40−map is basically a set of pairs (although not every set of pairs
41−is a map), most functions in `++in` have analogues in `++by`.
42−
43−The constructor for maps is `++malt`.
44−
45−```
46−(malt `(list {@t @ud})`[['kaylee' 3] ['wash' 2] ['mal' 4] ['summer' 1] ~])
47−```
48−
49−Let this map be `m`.
50−
51−1. Create another map, `s`, with `'spring'` mapped to `1`,
52− `'summer'` mapped to `2`, `'autumn'` mapped to `'3'`, and
53− `'winter'` mapped to `4`.
54−
55−1. In `m`, change the value at `'mal'` to 5 and add `'cobb'`
56− with value 4.
57−
58−1. Take the union of `m` and `s`, then get the value at the key
59− `summer`. Try taking the union of `s` and `m` (i.e. flip the
60− order) and see if it makes a difference. Try intersecting
61− them in both orders.
62−
docs/hoon/exercises/fizzbuzz.mddeleted−38
@@ -1,38 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 1
4−comments: true
5−---
6−
7−# Friends of FizzBuzz
8−
9−1. Consider the following implementation of FizzBuzz, which is
10− equivalent to the one in the [Demo](../../demo) section.
11−
12− ```
13− |= end/atom
14− =+ count=1
15− |-
16− ^- (list tape)
17− ?: =(end count)
18− ~
19− :-
20− ?: =(0 (mod count 15))
21− "FizzBuzz"
22− ?: =(0 (mod count 5))
23− "Fizz"
24− ?: =(0 (mod count 3))
25− "Buzz"
26− (scow %ud count)
27− $(count (add 1 count))
28− ```
29−
30− Modify this to produce "Fuzz" when the number is divisible by
31− 7, "Fuzz" when divisible by 21, "FuzzFizz" when divisible by 35,
32− and "FuzzFizzBuzz" when divisible by 105.
33−
34−1. Modify FizzBuzz from the previous exercise to take both a
35− start and an end number.
36−
37−1. Modify FizzBuzz from the previous exercise to count down
38− instead of up.
docs/hoon/exercises/life.mddeleted−121
@@ -1,121 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 5
4−comments: true
5−---
6−
7−# Conway's Game of Life
8−
9−Conway's Game of Life is a zero-player game played on an `n`x`n`
10−grid of spaces, each of which is either "alive" or "dead". Every
11−iteration, some or all of the spaces change from alive to dead or
12−from dead to alive.
13−
14−Specifically, for each iteration, each dead space becomes alive
15−if and only if it is adjacent to exactly three live spaces. Each
16−live remains alive if and only if it is adjacent to either two or
17−three live spaces. In this context, "adjacent to" includes the
18−eight spaces that share either a side or a corner with the space.
19−Thus, in the following map, the center space (dead) is adjacent
20−to exactly three live spaces, so it will be alive in the next
21−iteration. `#` signifies a live space and `.` signifies a dead
22−space.
23−
24− ..#
25− ...
26− ##.
27−
28−
29−1. Write a function `next-generation` that takes nine loobean
30− inputs, `nw`, `nc`, `ne`, `cw`, `cc`, `ce`, `sw`, `sc`, and
31− `se`. Produce 'yes' if the center space will be alive in the
32− next generation and 'no' if it will be dead.
33−
34−1. Write a function `create-board` that takes an integer `n` and
35− produces an `n` by `n` grid of loobeans, (hereafter,
36− "board"), initialized to 'no'. This grid should be
37− represented as a list of `n` lists of length `n`.
38−
39−1. Write a function `toggle-space` that takes a board, a row
40− index, and a column index, and produces a new board,
41− identical to the old except that the state of the space
42− referred to by the row and column indices has been toggled.
43−
44−1. Use the following function `print-board` to pretty-print the
45− board. For bonus points, try to follow what it's doing.
46−
47− ```
48− :: XX test
49− |= board/(list (list ?))
50− ^- tang
51− %+ turn board
52− |= row/(list ?)
53− :- %leaf
54− ^- tape
55− %+ turn row
56− |= space/?
57− ?: space
58− '# '
59− '. '
60− ```
61−
62− If you run this function with a board, you'll get a
63− pretty-printable object (a `tang`), but it won't be
64− pretty-printed. When running the generator from the dojo,
65− run `&tang +generator arguments` to mark the result as a
66− `tang`, which will tell the dojo to intelligently
67− pretty-print it.
68−
69−1. Using the functions created in the previous exercises, create
70− a 10 by 10 board, and flip the states of the spaces at
71− coordinates (counting from the top left, indexed from 0)
72− `(2,1)`, `(3,2)`, `(1,3)`, `(2,3)`, and `(3,3)`. Use the
73− pretty printer to print out the board. Your output should be
74− the following:
75−
76− ```
77− . . . . . . . . . .
78− . . # . . . . . . .
79− . . . # . . . . . .
80− . # # # . . . . . .
81− . . . . . . . . . .
82− . . . . . . . . . .
83− . . . . . . . . . .
84− . . . . . . . . . .
85− . . . . . . . . . .
86− . . . . . . . . . .
87− ```
88−
89−1. Write a function `step` that iterates every space on the
90− board. Print out the new board. It should look like this:
91−
92− ```
93− . . . . . . . . . .
94− . . . . . . . . . .
95− . # . # . . . . . .
96− . . # # . . . . . .
97− . . # . . . . . . .
98− . . . . . . . . . .
99− . . . . . . . . . .
100− . . . . . . . . . .
101− . . . . . . . . . .
102− . . . . . . . . . .
103− ```
104−
105− > Note that the spaces on the edge don't have the full nine
106− > neighbors. For now, assume that they're always dead.
107−
108−1. Write a function `life` that runs the above function `n`
109− times on the board. Observe the board as the game
110− progresses. Congratulations, you've written Conway's Game of
111− Life in Hoon!
112−
113−1. One common way to handle the edge of the board is to pretend
114− that it "wraps around", forming a torus. In other words, say
115− that the spaces on the left edge of the map are adjacent to
116− the ones on the right edge, and the spaces on the top edge
117− are adjacent to the spaces on the bottom edge. Modify `step`
118− to act this way. Pay special attention to the corners.
119−
120−1. Modify `create-board` to use `++og` to randomly initialize
121− the board with live or dead spaces.
docs/hoon/exercises/lists.mddeleted−40
@@ -1,40 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 3
4−comments: true
5−---
6−
7−# Lists
8−
9−In the following exercises, let `l` be `` `(list @t)`['u' 'r' 'b'
10−'i' 't' ~]``
11−
12−1. A list is a null-terminated tuple of values. For example,
13− `[1 2 3 ~]` is a list of three integers, and
14− `['a' 'b' 'c' ~]` is a list of three cords. Try casting
15− `['a' 'b' 'c' ~]` to `(list @t)` and to `(list @)`. Lists
16− are parameterized with the type of the values.
17−
18−1. `++flop` takes a list and produces its reverse. Use it to
19− reverse `l`.
20−
21−1. Repeat the above exercise without using `++flop`.
22−
23−1. `++sort` takes a list and a comparison function to sort a
24− list. The function must take two elements of the list and
25− produce true if the first element is "less than" the other.
26− Sort `l` alphabetically. Sort it reverse alphabetically.
27−
28−1. `++turn` takes a list and a function and applies the function
29− to each element in the list, forming a new list of the
30− results. This is called "map" in many functional languages.
31− The function must accept an element of the list. Use the
32− fact that subtracting 32 from a lowercase letter gives the
33− equivalent uppercase letter (i.e. `(sub 'a' 'A')` is 32) to
34− change every character in `l` to uppercase.
35−
36−1. `++welp` concatentates two lists. Concatenate `l` with the
37− reverse of `l`.
38−
39−1. `++snag` takes a number `n` and a list and produces the
40− element at index `n`. Pull out the `'i'` in `l`.
docs/hoon/exercises/math.mddeleted−27
@@ -1,27 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 2
4−comments: true
5−---
6−
7−# Math
8−
9−1. Write a function that produces a list of the first `n`
10− triangular numbers. The `n`th triangular number is the sum
11− of the first `n` positive integers.
12−
13−1. Using the program from the previous exercise, write a
14− function that produces the first `n` tetrahedral numbers.
15− The `n`th tetrahedral number is the sum of the first `n`
16− triangular numbers.
17−
18−1. The Fibonacci numbers are defined on the natural numbers as
19− follows:
20−
21− ```
22− fib(0) = 0
23− fib(1) = 1
24− fib(n) = fib(n-1) + fib(n-2)
25− ```
26−
27− Write a function that computes the `nth` Fibonacci number.
docs/hoon/library.mddeleted−9
@@ -1,9 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 18
4−title: Standard library
5−---
6−
7−# Standard library
8−
9−<list dataPreview="true" titlesOnly="true"></list>
docs/hoon/library/2f.mddeleted−422
@@ -1,422 +0,0 @@
1−---
2−navhome: /docs/
3−---
4−
5−
6−# 2f: noun ordering
7−### `++aor`
8−
9−Alphabetical order
10−
11−Computes whether `a` and `b` are in alphabetical order, producing a flag.
12−
13−#### Accepts
14−
15−`a` is a noun.
16−
17−`b` is a noun.
18−
19−#### Produces
20−
21−A flag.
22−
23−#### Source
24−
25− ++ aor
26− ~/ %aor
27− |= [a=* b=*]
28− ^- ?
29− ?: =(a b) &
30− ?. ?=(@ a)
31− ?: ?=(@ b) |
32− ?: =(-.a -.b)
33− $(a +.a, b +.b)
34− $(a -.a, b -.b)
35− ?. ?=(@ b) &
36− |-
37− =+ [c=(end 3 1 a) d=(end 3 1 b)]
38− ?: =(c d)
39− $(a (rsh 3 1 a), b (rsh 3 1 b))
40− (lth c d)
41−
42−#### Examples
43−
44− > (aor 'a' 'b')
45− %.y
46−
47− > (aor 'b' 'a')
48− %.n
49−
50− > (aor 'a' 'a')
51− %.y
52−
53− > (aor "foo" "bar")
54− %.n
55−
56− > (aor "bar" "foo")
57− %.y
58−
59− > (aor "abcdefz" "abcdefa")
60− %.n
61−
62− > (aor "abcdefa" "abcdefz")
63− %.y
64−
65− > (aor 10.000 17.000)
66− %.y
67−
68− > (aor 10 9)
69− %.n
70−
71−
72−
73−***
74−### `++dor`
75−
76−Numeric order
77−
78−Computes whether `a` and `b` are in ascending numeric order, producing a flag.
79−
80−#### Accepts
81−
82−`a` is a noun.
83−
84−`b` is a noun.
85−
86−#### Produces
87−
88−A flag.
89−
90−#### Source
91−
92− ++ dor
93− ~/ %dor
94− |= [a=* b=*]
95− ^- ?
96− ?: =(a b) &
97− ?. ?=(@ a)
98− ?: ?=(@ b) |
99− ?: =(-.a -.b)
100− $(a +.a, b +.b)
101− $(a -.a, b -.b)
102− ?. ?=(@ b) &
103− (lth a b)
104−
105−
106−#### Examples
107−
108− > (dor 1 2)
109− %.y
110−
111− > (dor 2 1)
112− %.n
113−
114− > (dor ~[1 2 3] ~[1 2 4])
115− %.y
116−
117− > (dor ~[1 2 4] ~[1 2 3])
118− %.n
119−
120− > (dor `(list @)`~[99 100 10.000] ~[99 101 10.000])
121− %.y
122−
123− > (dor ~[99 101 10.999] `(list @)`~[99 100 10.000])
124− %.n
125−
126−#### Discussion
127−
128−If `a` and `b` are both atoms, `dor` is equivalent to [`lte`](../1a). If they're
129−cells, `dor` recurses on the heads, and then if the heads are the same it checks
130−the tails.
131−
132−If one sample is a cell and the other is an atom, the cell sample is treated as
133−"greater."
134−
135−
136−***
137−### `++gor`
138−
139−Hash order
140−
141−Computes whether of `(mug a)` and `(mug b)` are in ascending numeric order,
142−producing a flag. If the `mug` hashes are equal, `a` and `b` are compared by
143−`dor` instead.
144−
145−[`mug`](../2e) is the the 31-bit nonzero FNV-1a hash algorithm.
146−
147−#### Accepts
148−
149−`a` is a noun.
150−
151−`b` is a noun.
152−
153−#### Produces
154−
155−A flag.
156−
157−#### Source
158−
159− ++ gor
160− ~/ %gor
161− |= [a=* b=*]
162− ^- ?
163− =+ [c=(mug a) d=(mug b)]
164− ?: =(c d)
165− (dor a b)
166− (lth c d)
167−
168−
169−#### Examples
170−
171− > (gor 'd' 'c')
172− %.y
173−
174− > 'd'
175− 'd'
176−
177− > 'c'
178− 'c'
179−
180− > `@ud`'d'
181− 100
182−
183− > `@ud`'c'
184− 99
185−
186− > (mug 'd')
187− 1.628.185.714
188−
189− > (mug 'c')
190− 1.712.073.811
191−
192− > (gor 'd' 'c')
193− %.y
194−
195− > (gor 'c' 'd')
196− %.n
197−
198− > (gor "foo" "bar")
199− %.n
200−
201− > (gor (some 10) `(list @)`[1 2 3 ~])
202− %.n
203−
204−#### Discussion
205−
206−`map`s use `gor` on the key for horizontal ordering and `vor` for
207−vertical order. `map`s only look at the keys (the head of the key-value pair
208−elements) for ordering.
209−
210−***
211−### `++hor`
212−
213−Horizontal hash order
214−
215−If `a` and `b` are atoms, they are computed as samples of `gor`, producing a
216−flag.
217−
218−If `a` and `b` are cells, `hor` checks to see if their heads are equal. If their
219−heads are equal, `gor` is computed on their tails, producing a flag. If their
220−heads are not equal, `gor` is computed on their heads, producing a flag.
221−
222−If `a` is an atom and `b` is not, then `%.y` is produced. If `b` is an atom and
223−`a` is not, `%.n` is produced.
224−
225−#### Accepts
226−
227−`a` is a noun.
228−
229−`b` is a noun.
230−
231−#### Produces
232−
233−A flag.
234−
235−#### Source
236−
237− ++ hor
238− ~/ %hor
239− |= [a=* b=*]
240− ^- ?
241− ?: ?=(@ a)
242− ?. ?=(@ b) &
243− (gor a b)
244− ?: ?=(@ b) |
245− ?: =(-.a -.b)
246− (gor +.a +.b)
247− (gor -.a -.b)
248−
249−
250−#### Examples
251−
252− > (hor . 1)
253− %.n
254−
255− > (hor 1 2)
256− %.y
257−
258− > (hor "abc" "cba")
259− %.y
260−
261− > (hor 'c' 'd')
262− %.n
263−
264− > (hor 100 [1 1])
265− %.y
266−
267− > (hor [1 1] 100)
268− %.n
269−
270− > (hor 500.000.000 "foo")
271− %.y
272−
273− > (hor "foo" 500.000.000)
274− %.n
275−
276− > (hor 0 "foo")
277− %.y
278−
279− > (gor `(list @)`[0 ~] 1)
280− %.n
281−
282− > (hor `(list @)`[50 500 5.000 ~] 1)
283− %.n
284−
285−
286−#### Discussion
287−
288−Sets (+set, +in) use `hor` for their horizontal order and `vor` for their
289−vertical order. See [`apt:in`](../2h) to see how a set verifies its correctness.
290−`vor` is used to verify.
291−
292−***
293−### `++lor`
294−
295−Leg order
296−
297−Computes whether the corresponding legs of `a` and `b` are in ascending
298−numeric order, producing a flag.
299−
300−#### Accepts
301−
302−`a` is a noun.
303−
304−`b` is a noun.
305−
306−#### Accepts
307−
308−A flag.
309−
310−#### Source
311−
312− ++ lor
313− ~/ %lor
314− |= [a=* b=*]
315− ^- ?
316− ?: =(a b) &
317− ?@ a
318− ?^ b &
319− (lth a b)
320− ?: =(-.a -.b)
321− $(a +.a, b +.b)
322− $(a -.a, b -.b)
323−
324−
325−#### Examples
326−
327− > (lor 1 2)
328− %.y
329−
330− > (lor 2 1)
331− %.n
332−
333− > (lor 9 [1 2])
334− %.y
335−
336− > (lor `(list @)`[1 2 3 ~] `(list @)`[1 2 3 4 ~])
337− %.y
338−
339− > (lor `(list @)`[1 2 3 ~] `(list @)`[1 2 2 ~])
340− %.n
341−
342− > (lor `(list @)`[1 2 3 ~] `(list @)`[2 2 ~])
343− %.y
344−
345− > (lor [2 2 5] [1 5 9 8])
346− %.n
347−
348− > (lor [1 5 8] [1 5 9 8])
349− %.y
350−
351− > (lor [1 2 3] [1 2])
352− !! exit
353−
354−
355−#### Discussion
356−
357−`lor` is no longer used internally.
358−
359−***
360−### `++vor`
361−
362−Vertical order
363−
364−Computes whether the double-hashes `(mug (mug a))` and `(mug (mug b))` are in
365−ascending numeric order, producing a flag. If the double-`mug` hashes are
366−equal, `a` and `b` are compared by `dor` instead.
367−
368−[`mug`](../2e) is the the 31-bit nonzero FNV-1a hash algorithm.
369−
370−
371−#### Accepts
372−
373−`a` is a noun
374−
375−`b` is a noun
376−
377−#### Produces
378−
379−A flag.
380−
381−#### Source
382−
383− ++ vor
384− ~/ %vor
385− |= [a=* b=*]
386− ^- ?
387− =+ [c=(mug (mug a)) d=(mug (mug b))]
388− ?: =(c d)
389− (dor a b)
390− (lth c d)
391−
392−
393−#### Examples
394−
395− > (vor 'f' 'g')
396− %.y
397−
398− > [(mug 'f') (mug 'g')]
399− [1.661.740.952 1.644.963.335]
400−
401− > [(mug (mug 'f')) (mug (mug 'g'))]
402− [261.421.509 1.861.258.547]
403−
404− > (vor 'a' 'z')
405− %.n
406−
407− > (vor 43.326 41.106)
408− %.n
409−
410−
411−#### Discussion
412−
413−Maps, sets, and queues all use `vor` to check for vertical ordering. Maps and
414−sets also use `gor` and `hor` for horizontal order, respectively, but queues use
415−vertical ordering alone.
416−
417−Since hashing removes correlation, double-`mug`ging with `vor` removes
418−correlation with single-`mug`ged `hor`. Vertical order becomes uncorrelated
419−with horizontal order.
420−
421−
422−***
docs/hoon/library/2k.mddeleted−343
@@ -1,343 +0,0 @@
1−---
2−navhome: /docs/
3−---
4−
5−
6−# 2k: queue logic
7−### `++to`
8−
9−Queue operations
10−
11−Container arm for queue operation arms. The contained arms inherit its
12−sample `++qeu` `a`.
13−
14−Accepts
15−-------
16−
17−`a` is a queue, ++qeu.
18−
19−Source
20−------
21−
22− ++ to :: queue engine
23− |/ a/(qeu)
24−
25−### `+-bal:to`
26−
27−Balance
28−
29−Vertically rebalances queue `a`.
30−
31−Accepts
32−-------
33−
34−`a` is a queue.
35−
36−Produces
37−--------
38−
39−A queue.
40−
41−Source
42−------
43−
44− +- bal
45− |- ^+ a
46− ?~ a ~
47− ?. |(?=($~ l.a) (vor n.a n.l.a))
48− $(a [n.l.a l.l.a $(a [n.a r.l.a r.a])])
49− ?. |(?=($~ r.a) (vor n.a n.r.a))
50− $(a [n.r.a $(a [n.a l.a l.r.a]) r.r.a])
51− a
52− ::
53−
54−
55−Examples
56−--------
57−
58− > `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~]
59− {"a" "b" "c" "d" "e" "f" "g"}
60− > `*`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~]
61− [[97 0] 0 [98 0] 0 [99 0] 0 [100 0] 0 [101 0] 0 [102 0] 0 [103 0] 0 0]
62− > ~(bal to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~])
63− {"a" "b" "c" "d" "e" "f" "g"}
64− > `*`~(bal to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~])
65− [[100 0] [[99 0] [[98 0] [[97 0] 0 0] 0] 0] [101 0] 0 [102 0] 0 [103 0] 0 0]
66−
67−------------------------------------------------------------------------
68−
69−### `+-dep:to`
70−
71−Maximum Depth
72−
73−Produces the maximum depth of leaves (r.a and l.a) in queue `a`.
74−
75−Accepts
76−-------
77−
78−`a` is a queue.
79−
80−Produces
81−--------
82−
83−An atom.
84−
85−Source
86−------
87−
88− +- dep :: max depth of queue
89− |- ^- @
90− ?~ a 0
91− +((max $(a l.a) $(a r.a)))
92− ::
93−
94−
95−Examples
96−--------
97−
98− > =a (~(gas to `(qeu @)`~) `(list @)`[1 2 3 4 5 6 7 ~])
99− > ~(dep to a)
100− 4
101− > =a (~(gas to `(qeu @)`~) `(list @)`[1 2 3 4 ~])
102− > ~(dep to a)
103− 3
104− > =a (~(gas to `(qeu @)`~) `(list @)`[1 2 ~])
105− > ~(dep to a)
106− 2
107− > ~(dep to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~])
108− 7
109− > ~(dep to ~(bal to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~]))
110− 4
111−
112−------------------------------------------------------------------------
113−
114−### `+-gas`
115−
116−Push list
117−
118−Push all elements of `++list` `b` into the `++queue`.
119−
120−Accepts
121−-------
122−
123−`a` is a queue.
124−
125−`b` is a list.
126−
127−Produces
128−--------
129−
130−A queue.
131−
132−Source
133−------
134−
135− +- gas :: insert list to queue
136− |= b=(list ,_?>(?=(^ a) n.a))
137− |- ^+ a
138− ?~(b a $(b t.b, a (put(+< a) i.b)))
139− ::
140−
141−Examples
142−--------
143−
144− > (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 ~])
145− {3 2 1}
146− > =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 ~])
147− > =b `(list ,@)`[4 5 6 ~]
148− > (~(gas to a) b)
149− {6 5 4 3 2 1}
150−
151−------------------------------------------------------------------------
152−
153−### `+-get:to`
154−
155−Pop
156−
157−Produces the head and tail `++queue` of `a`.
158−
159−Accepts
160−-------
161−
162−`a` is a queue.
163−
164−Produces
165−--------
166−
167−The last element in `a` along with the rest of queue `a`.
168−
169−Source
170−------
171−
172− +- get :: head-tail pair
173− |- ^+ ?>(?=(^ a) [p=n.a q=*(qeu _n.a)])
174− ?~ a
175− !!
176− ?~ r.a
177− [n.a l.a]
178− =+ b=$(a r.a)
179− :- p.b
180− ?: |(?=($~ q.b) (vor n.a n.q.b))
181− [n.a l.a q.b]
182− [n.q.b [n.a l.a l.q.b] r.q.b]
183− ::
184−
185−Examples
186−--------
187−
188− > =s (~(gas to *(qeu @)) `(list @)`~[1 2 3])
189− > ~(get to s)
190− [p=1 q={3 2}]
191− > ~(get to ~)
192− ! exit
193−
194−------------------------------------------------------------------------
195−
196−### `+-nap:to`
197−
198−Remove last element
199−
200−Removes the head of `++queue` `a`, producing the resulting queue.
201−
202−Accepts
203−-------
204−
205−`a` is a queue.
206−
207−Produces
208−--------
209−
210−A queue.
211−
212−Source
213−------
214−
215− +- nap :: removes head
216− ?> ?=(^ a)
217− ?: =(~ l.a) r.a
218− =+ b=get(a l.a)
219− bal(a ^+(a [p.b q.b r.a]))
220− ::
221−
222−Examples
223−--------
224−
225− > =a (~(gas to `(qeu @)`~) `(list @)`[1 2 3 4 5 6 ~])
226− > -.a
227− n=6
228− > =b ~(nap to a)
229− > -.b
230− n=2
231− > b
232− {5 4 3 2 1}
233− > a
234− {6 5 4 3 2 1}
235−
236−------------------------------------------------------------------------
237−
238−### `+-put:to`
239−
240−Insert
241−
242−Accept any noun `b` and adds to `++queue` `a` as the head, producing the
243−resulting queue.
244−
245−Accepts
246−-------
247−
248−`a` is a queue.
249−
250−`b` is any noun.
251−
252−Produces
253−--------
254−
255−A queue.
256−
257−Source
258−------
259−
260− +- put :: insert new tail
261− |* b/*
262− |- ^+ a
263− ?~ a
264− [b ~ ~]
265− bal(a a(l $(a l.a)))
266− ::
267−
268−
269−Examples
270−--------
271−
272− > (~(gas to `(qeu @)`~) `(list @)`[3 1 2 4 5 6 ~])
273− > (~(put to a) 7)
274− {7 6 5 4 2 1 3}
275−
276−------------------------------------------------------------------------
277−
278−### `+-tap:to`
279−
280−Queue to list
281−
282−Produces `++queue` `a` as a `++list` from front to back.
283−
284−Accepts
285−-------
286−
287−`a` is a queue.
288−
289−Source
290−------
291−
292− +- tap :: adds list to end
293− |= b/(list _?>(?=(^ a) n.a))
294− =+ z=0 :: XX breaks jet match
295− ^+ b
296− ?~ a
297− b
298− $(a r.a, b [n.a $(a l.a)])
299− ::
300−
301−Examples
302−--------
303−
304− > =a (~(gas to `(qeu @)`~) `(list @)`[3 1 2 4 5 6 ~])
305− > `*`a
306− [6 0 2 [4 [5 0 0] 0] 1 0 3 0 0]
307− > (~(tap to a) `(list @)`[99 100 101 ~])
308− ~[3 1 2 4 5 6 99 100 101]
309−
310−------------------------------------------------------------------------
311−
312−### `+-top:to`
313−
314−Produces the head of `++queue` `a` as a `++unit` (an empty queue has no head).
315−
316−Accepts
317−-------
318−
319−`a` is a queue.
320−
321−Produces
322−--------
323−
324−A unit.
325−
326−Source
327−------
328−
329− +- top :: produces head
330− |- ^- (unit _?>(?=(^ a) n.a))
331− ?~ a ~
332− ?~(r.a [~ n.a] $(a r.a))
333−
334−Examples
335−--------
336−
337− > =a (~(gas to `(qeu @)`~) `(list @)`[1 2 3 4 5 6 ~])
338− > ~(top to a)
339− [~ 1]
340−
341−
342−
343−***
docs/hoon/library/3b.mddeleted−6
@@ -1,6 +0,0 @@
1−---
2−navhome: /docs/
3−---
4−
5−
6−# 3b: floating point
docs/hoon/library/4i.mddeleted−6
@@ -1,6 +0,0 @@
1−---
2−navhome: /docs/
3−---
4−
5−
6−# 4i: parsing (useful idioms)
docs/hoon/library/5a.mddeleted−6
@@ -1,6 +0,0 @@
1−---
2−navhome: /docs/
3−---
4−
5−
6−# 5a: compiler utilities
docs/hoon/library/5b.mddeleted−6
@@ -1,6 +0,0 @@
1−---
2−navhome: /docs/
3−---
4−
5−
6−# 5b: macro expansion
docs/hoon/library/5c.mddeleted−6
@@ -1,6 +0,0 @@
1−---
2−navhome: /docs/
3−---
4−
5−
6−# 5c: compiler backend and prettyprinter
docs/hoon/library/5d.mddeleted−6
@@ -1,6 +0,0 @@
1−---
2−navhome: /docs/
3−---
4−
5−
6−# 5d: parser
docs/hoon/library/5e.mddeleted−6
@@ -1,6 +0,0 @@
1−---
2−navhome: /docs/
3−---
4−
5−
6−# 5e: caching compiler
docs/hoon/library/5g.mddeleted−5
@@ -1,5 +0,0 @@
1−---
2−navhome: /docs/
3−---
4−
5−
docs/hoon/library/zuse.mddeleted−8
@@ -1,8 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 3
4−---
5−
6−# `%zuse` (Arvo standard library)
7−
8−<list></list>
docs/hoon/limb.mddeleted−25
@@ -1,25 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 20
5−title: Limbs and wings
6−---
7−
8−# Limbs and wings
9−
10−One feature Hoon lacks: a context that isn't a first-class value.
11−Hoon has no concept of scope, environment, etc. A hoon has one
12−data source, the *subject*, a noun like any other.
13−
14−In most languages "variable" and "attribute" are different
15−things. They are both symbols, but a variable is in "the
16−environment" and a attribute is on "an object." In Hoon, "the
17−environment" is "an object" -- the subject.
18−
19−`%limb` and `%wing` are two basic hoon stems that extract
20−information from the subject. A `limb` is an attribute; a `wing`
21−is an attribute path, ie, a list of limbs.
22−
23−## Stems
24−
25−<list dataPreview="true" className="runes"></list>
docs/hoon/limb/limb.mddeleted−81
@@ -1,81 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 1
5−title: Limb
6−---
7−
8−# Limb
9−
10−`[%limb p=(each @ud [p=@ud q=@tas])]`: attribute of subject.
11−
12−### Produces
13−
14−If `p` matches `[%& p=@ud]`, slot `p.p` of the subject.
15−
16−If `p` matches `[%| p=@ud q=@tas]`, the `p`th match for `q`,
17−using the search traverse below.
18−
19−### Syntax
20−
21−Irregular: `+15` is slot `15`, `[%& 15]`.
22−
23−Irregular: `.` is slot `1`, the whole subject.
24−
25−Irregular: `&4` is slot `30`, the 4th element of a tuple
26−with at least 5 elements.
27−
28−Irregular: `|4` is slot `31`, the elements that follow `&4`.
29−
30−Irregular: `foobar` is `[%| 0 %foobar]`.
31−
32−Irregular: `^^^foobar` is `[%| 3 %foobar]`.
33−
34−Irregular: `+<-` is "take the tail, then take the head of
35−that, then the head of that." `+` and `>` mean "tail" while
36−`-` and `<` mean "head." This limb syntax starts on `+` or `-`
37−and alternates for readability.
38−
39−### Traverse
40−
41−The search traverse takes a name `q` and a *skip count* `p`.
42−
43−The search product may be an *arm* or a *leg*. A *leg* is a
44−subtree of the subject. An arm defines a Nock formula and a
45−subject leg to compute the result. Logically, a limb is an
46−attribute -- computation or subtree, "synthesized" or "natural"
47−-- of the subject.
48−
49−We search the subject type headfirst, depth-first, and pre-order.
50−If we descend to a `%face` type whose label matches the limb
51−symbol, the descent address is a leg. The type is the type
52−beneath the label. But if the `%face` label differs, the search
53−skips this whole subtree.
54−
55−If we descend into a `%core` type in which the limb symbol is an
56−arm, we produce that arm. If the limb symbol is not bound, we
57−descend into the payload (data) of the core.
58−
59−If the skip count `p` is nonzero, we pretend our first `p`
60−matches are actually mismatches. This lets the programmer "look
61−through" an overriding label. No label anywhere is inaccessible.
62−
63−### Examples
64−
65−The Dojo prompt gives you a subject with a decent namespace.
66−Try
67−
68−```
69−~zod:dojo> now
70−~2016.4.25..01.39.59..a0f0
71−```
72−
73−You can also add variables to the subject, then use them. (Note
74−that `=variable value` is not Hoon (language) syntax; it's Dojo
75−(shell) syntax.)
76−
77−```
78−~zod:dojo> =foo %bar
79−~zod:dojo> foo
80−%bar
81−```
docs/hoon/limb/wing.mddeleted−50
@@ -1,50 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 2
4−title: Wing
5−---
6−
7−# Wing
8−
9−`[%wing p=(list limb)]`; a limb search path.
10−
11−### Produces
12−
13−If `p` is null, the subject at leg `1`. Otherwise, let `x` be
14−the `%wing` of `t.p`. `x` is either an arm or a leg. We compute
15−limb `i.p` on some subject leg `s`, where:
16−
17−If `x` is a leg/slot number, `s` is `x`.
18−
19−If `x` is an arm/subject-formula pair `[s f]`, `s` is `s.x`.
20−
21−### Syntax
22−
23−Irregular: `a.b` finds limb `a` within limb `b` of the subject.
24−
25−### Discussion
26−
27−It may be slightly hard to follow the formal definition above.
28−
29−Intuitively, Hoon wings are written in the opposite order
30−from attribute dot-paths in most languages. Hoon `a.b.c` is Java
31−`c.b.a`; it means "a within b within c."
32−
33−Any item in the wing can resolve to a leg (fragment) or arm
34−(computation). But if a non-terminal item in the wing would
35−resolve to an arm, it resolves instead to the subject of the arm
36−-- in other words, the core exporting that name.
37−
38−The mysterious idiom `..foo` produces the leg `foo` if `foo`
39−is a leg; the core exporting `foo` if `foo` is an arm. Since `.`
40−is the same limb as `+`, `..foo` is the same wing as `+1.foo`.
41−
42−### Examples
43−
44−```
45−~zod:dojo> =a [foo=3 bar=[baz=1 moo=2]]
46−~zod:dojo> bar.a
47−[baz=1 moo=2]
48−~zod:dojo> moo.bar.a
49−2
50−```
docs/hoon/mission.mddeleted−46
@@ -1,46 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 11
4−next: true
5−title: Mission
6−---
7−
8−# Mission
9−
10−Hoon is a strict, typed functional language which compiles itself
11−to [Nock](../../nock), a combinator interpreter whose spec fits
12−on a T-shirt.
13−
14−Hoon's design goal is to support higher-order typed functional
15−programming without category theory, formal logic, or other
16−interesting math. The reasoning: (a) a programming language is a
17−user interface for programmers; (b) most programmers are not very
18−good at math.
19−
20−Hoon is not quite as expressive as Haskell, though fairly close.
21−But good Hoon style isn't good Haskell style. Hoon encourages
22−coders to use higher-order programming as little as possible --
23−again, simply for UI reasons. For example, multiple arguments
24−are curried by default in Haskell and tupled by default in Hoon.
25−The Hoon style has been described as "procedural programming in
26−a functional language."
27−
28−Hoon is objectively simple: its complexity is bounded by the size
29−of the compiler, about 3000 lines of Hoon. This is split evenly
30−between frontend (parsing and macro expansion) and backend (code
31−generation and type inference).
32−
33−Compared to most languages, Hoon has a heavier front end (more
34−complex syntax) and a lighter back end (less complex semantics).
35−This ratio reflects the belief that our brains are better than
36−everyone thinks at learning languages (symbols and/or grammars),
37−and worse at learning abstractions (proofs and/or algorithms).
38−At first glance, Hoon may look gnarly (though its squiggles are
39−more structured than most ASCII-heavy languages). But under the
40−hood, there's much less complexity than you might expect.
41−
42−Keeping the Hoon-to-Nock mapping simple and transparent is a
43−priority. In a sense, Hoon is to Haskell as C is to Pascal.
44−There is no opaque high-level abstraction of Hoon's semantics;
45−the language is what the compiler does. This design only works
46−when the compilation process is trivial or nearly so.
docs/hoon/reference.mddeleted−83
@@ -1,83 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 24
5−title: Expression reference
6−---
7−
8−# Expression reference
9−
10−#### A catalog of expressions:
11−
12−<div class="book">
13−
14−### [Atoms and strings](../atom/)
15−
16−### [Limbs and wings](../limb/)
17−
18−## `. dot` (nock)
19−
20−<list src="../rune/dot" dataPreview="true" className="runes" childIsFragment="true"></list>
21−
22−---
23−
24−## `! zap` (wild)
25−
26−<list src="../rune/zap" dataPreview="true" className="runes" childIsFragment="true"></list>
27−
28−---
29−
30−## `= tis` (flow)
31−
32−<list src="../rune/tis" dataPreview="true" className="runes" childIsFragment="true"></list>
33−
34−---
35−
36−## `? wut` (test)
37−
38−<list src="../rune/wut" dataPreview="true" className="runes" childIsFragment="true"></list>
39−
40−---
41−
42−## `| bar` (core)
43−
44−<list src="../rune/bar" dataPreview="true" className="runes" childIsFragment="true"></list>
45−
46−---
47−
48−## `~ sig` (hint)
49−
50−<list src="../rune/sig" dataPreview="true" className="runes" childIsFragment="true"></list>
51−
52−---
53−
54−## `: col` (cell)
55−
56−<list src="../rune/col" dataPreview="true" className="runes" childIsFragment="true"></list>
57−
58−---
59−
60−## `% cen` (call)
61−
62−<list src="../rune/cen" dataPreview="true" className="runes" childIsFragment="true"></list>
63−
64−---
65−
66−## `^ ket` (cast)
67−
68−<list src="../rune/ket" dataPreview="true" className="runes" childIsFragment="true"></list>
69−
70−---
71−
72−## `$ buc` (mold)
73−
74−<list src="../rune/buc" dataPreview="true" className="runes" childIsFragment="true"></list>
75−
76−---
77−
78−## `; sem` (make)
79−
80−<list src="../rune/sem" dataPreview="true" className="runes" childIsFragment="true"></list>
81−
82−</div>
83−
docs/hoon/rune.mddeleted−77
@@ -1,77 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 17
5−title: Runes
6−---
7−
8−# Runes
9−
10−<div class="book">
11−
12−## `. dot` (nock)
13−
14−<list src="./dot" dataPreview="true" className="runes" childIsFragment="true"></list>
15−
16−---
17−
18−## `! zap` (wild)
19−
20−<list src="./zap" dataPreview="true" className="runes" childIsFragment="true"></list>
21−
22−---
23−
24−## `= tis` (flow)
25−
26−<list src="./tis" dataPreview="true" className="runes" childIsFragment="true"></list>
27−
28−---
29−
30−## `? wut` (test)
31−
32−<list src="./wut" dataPreview="true" className="runes" childIsFragment="true"></list>
33−
34−---
35−
36−## `| bar` (core)
37−
38−<list src="./bar" dataPreview="true" className="runes" childIsFragment="true"></list>
39−
40−---
41−
42−## `~ sig` (hint)
43−
44−<list src="./sig" dataPreview="true" className="runes" childIsFragment="true"></list>
45−
46−---
47−
48−## `: col` (cell)
49−
50−<list src="./col" dataPreview="true" className="runes" childIsFragment="true"></list>
51−
52−---
53−
54−## `% cen` (call)
55−
56−<list src="./cen" dataPreview="true" className="runes" childIsFragment="true"></list>
57−
58−---
59−
60−## `^ ket` (cast)
61−
62−<list src="./ket" dataPreview="true" className="runes" childIsFragment="true"></list>
63−
64−---
65−
66−## `$ buc` (mold)
67−
68−<list src="./buc" dataPreview="true" className="runes" childIsFragment="true"></list>
69−
70−---
71−
72−## `; sem` (make)
73−
74−<list src="./sem" dataPreview="true" className="runes" childIsFragment="true"></list>
75−
76−</div>
77−
docs/hoon/rune/bar.mddeleted−27
@@ -1,27 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 15
5−title: Core | "bar"
6−---
7−
8−# Core `|` "bar"
9−
10−Core hoons are flow hoons. The compiler essentially pins a Nock
11−formula, or battery of formulas, to the subject.
12−
13−All `|` hoons are macros around `%core`. (See the `%core`
14−section in [`type`](../../basic#-core-p-type-q-map-term-type) above.)
15−`%core` uses the subject as the payload of a battery, whose arms are
16−compiled with the core itself as the subject.
17−
18−Four of these hoons (`|=`, `|.`, `|-`, and `|*`) produce a
19−core with a single arm, named `$`. We can recompute this arm
20−with changes, useful for recursion among other things:
21−
22−> `$()` expands to `%=($)` (["cenhep"](../cen/hep)), accepting
23−> a *jogging* body containing a list of changes to the subject.
24−
25−## Hoons
26−
27−<list dataPreview="true" className="runes"></list>
docs/hoon/rune/bar/cab.mddeleted−72
@@ -1,72 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 3
5−title: |_ "barcab"
6−---
7−
8−# `|_ "barcab"`
9−
10−`[%brcb p=model q=(map term foot)]`: form a door, a many-armed core
11−with a sample.
12−
13−## Expands to
14−
15−```
16−=| p
17−|% q
18−==
19−```
20−
21−## Syntax
22−
23−Regular: *1-fixed*, then *battery*.
24−
25−## Discussion
26−
27−A door is the general case of a gate (function). A gate is a
28−door with only one arm, the empty name `$`.
29−
30−Other languages have no real equivalent of a door, but we often
31−see the pattern of multiple functions with the same argument
32−list, or with shared argument structure. In Hoon, this shared
33−structure becomes a door.
34−
35−Calling a door is just like calling a gate, but the caller needs
36−to specify the arm. For instance, to call the gate `foo` as a
37−door, instead of `(foo bar)` we would write `~($ foo bar)`. This
38−is an irregular form for `%~($ foo bar)`, ["censig"](../../cen/sig).
39−
40−## Examples
41−
42−A trivial door:
43−
44−```
45−/~zod:dojo> =mol |_ a=@ud
46− ++ succ +(a)
47− ++ prev (dec a)
48− --
49−/~zod:dojo> ~(succ mol 1)
50−2
51−/~zod:dojo> ~(succ mol ~(succ mol ~(prev mol 5)))
52−6
53−```
54−
55−A more interesting door, from the kernel library:
56−
57−```
58−++ ne
59− |_ tig=@
60− ++ d (add tig '0')
61− ++ x ?:((gte tig 10) (add tig 87) d)
62− ++ v ?:((gte tig 10) (add tig 87) d)
63− ++ w ?:(=(tig 63) '~' ?:(=(tig 62) '-' ?:((gte tig 36) (add tig 29) x)))
64− --
65−```
66−
67−The `ne` door prints a digit in base 10, 16, 32 or 64:
68−
69−```
70−~zod:dojo> `@t`~(x ne 12)
71−'c'
72−```
docs/hoon/rune/bar/cen.mddeleted−42
@@ -1,42 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 1
5−title: |% "barcen"
6−---
7−
8−# `|% "barcen"`
9−
10−[%brcb p=(map term foot)]: Form a core `[battery payload]` with subject as the payload.
11−
12−## Produces
13−
14−A core with battery `p`. Payload is the subject.
15−
16−## Syntax
17−
18−Regular: *battery*.
19−
20−## Discussion
21−
22−A core is like an "object" in a conventional language, but its
23−attributes (_arms_) are functions on the core, not the core and
24−an argument. A "method" on a core is an arm producing a gate.
25−
26−## Examples
27−
28−A trivial core:
29−
30−```
31−~zod:dojo> =foo =+ x=58
32− |%
33− ++ n (add 42 x)
34− ++ g |= b=@
35− (add b n)
36− --
37−~zod:dojo> n.foo
38−100
39−~zod:dojo> (g.foo 1)
40−101
41−```
42−
docs/hoon/rune/bar/col.mddeleted−26
@@ -1,26 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 8
5−title: |: "barcol"
6−---
7−
8−# `|: "barcol"`
9−
10−`[%brcl p=hoon q=hoon]`: form a gate with burnt sample.
11−
12−## Expands to
13−
14−```
15−=> ^~ p
16− |. q
17−```
18−
19−## Discussion
20−
21−Note that `p` is a hoon, not a model; `|:` doesn't bunt your sample as
22−[`|=`](../tis) does.
23−
24−## Syntax
25−
26−Regular: *2-fixed*.
docs/hoon/rune/bar/dot.mddeleted−58
@@ -1,58 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 4
5−title: |. "bardot"
6−---
7−
8−# `|. "bardot"`
9−
10−`[%brdt p=hoon]`: form a trap, a core with one arm `$`.
11−
12−## Expands to
13−
14−```
15−|% ++ $ p
16−--
17−```
18−
19−## Syntax
20−
21−Regular: *1-fixed*.
22−
23−## Discussion
24−
25−A trap is a deferred computation.
26−
27−## Examples
28−
29−A trivial trap:
30−
31−```
32−~zod:dojo> =foo |.(42)
33−~zod:dojo> $:foo
34−42
35−~zod:dojo> (foo)
36−42
37−```
38−
39−A more interesting trap:
40−
41−```
42−~zod:dojo> =foo =/ reps 10
43− =/ step 0
44− =/ outp 0
45− |.
46− ?: =(step reps)
47− outp
48− $(outp (add outp 2), step +(step))
49−~zod:dojo> (foo)
50−20
51−```
52−
53−Note that we can use `$()` to recurse back into the
54−trap, since it's a core with an `$` arm.
55−
56−> `$()` expands to `%=($)` (["centis"](../../cen/tis)),
57−> accepting a *jogging* body containing a list of changes
58−> to the subject.
docs/hoon/rune/bar/hep.mddeleted−52
@@ -1,52 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 5
5−title: |- "barhep"
6−---
7−
8−# `|- "barhep"`
9−
10−`[%brhp p=hoon]`: form a trap and kick ("*call*") it.
11−
12−## Expands to
13−
14−```
15−=<($ |.(p))
16−```
17−
18−## Syntax
19−
20−Regular: *1-fixed*.
21−
22−## Discussion
23−
24−The `|-` ("barhep") rune can be thought of as a "recursion
25−point". Since `|-` makes a `|.` (["bardot"](../dot), a core
26−with one arm named `$`, we can recurse back into it with `$()`.
27−
28−> `$()` expands to `%=($)` (["centis"](../../cen/tis)),
29−> accepting a *jogging* body containing a list of changes to
30−> the subject.
31−
32−## Examples
33−
34−A trivial loop doesn't even recurse:
35−
36−```
37−~zod:dojo> |-(42)
38−42
39−```
40−
41−The classic loop is a decrement:
42−
43−```
44−~zod:dojo> =foo =/ a 42
45− =/ b 0
46− |-
47− ?: =(a +(b))
48− b
49− $(b +(b))
50−~zod:dojo> foo
51−41
52−```
docs/hoon/rune/bar/ket.mddeleted−39
@@ -1,39 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 6
5−title: |^ "barket"
6−---
7−
8−# `|^ "barket"`
9−
10−`[%brkt p=hoon q=(map term foot)]`: form a core with battery and
11−anonymous arm `$` and kick it.
12−
13−## Expands to
14−
15−```
16−=> |%
17− ++ $ p
18− q
19− --
20−$
21−```
22−
23−## Syntax
24−
25−Regular: *1-fixed*, then *battery*.
26−
27−## Examples
28−
29−A trivial cork:
30−
31−```
32−~zod:dojo> |^
33− (add n g)
34− ++ n 42
35− ++ g 58
36− --
37−100
38−```
39−
docs/hoon/rune/bar/sig.mddeleted−31
@@ -1,31 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 10
5−title: |~ "barsig"
6−---
7−
8−# `|~ "barsig"`
9−
10−`[%brsg p=model q=hoon]`: form an iron gate.
11−
12−## Expands to
13−
14−```
15−^| |=(p q)
16−```
17−
18−## Syntax
19−
20−Regular: *2-fixed*.
21−
22−## Discussion
23−
24−See [this discussion of core variance models](../../../advanced)
25−
26−## Examples
27−
28−```
29−~zod:dojo> => ~ ^+(|~(a=@ *@) |=(a=* *@))
30−<1|usl {a/@ $~}>
31−```
docs/hoon/rune/bar/tar.mddeleted−57
@@ -1,57 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 9
5−title: |* "bartar"
6−---
7−
8−# `|* "bartar"`
9−
10−`[%brtr p=model q=hoon]`: form a gill, a wet one-armed
11−core with sample.
12−
13−## Expands to
14−
15−```
16−=| p
17−|%
18−+- $
19− q
20−--
21−```
22−
23−## Syntax
24−
25−Regular: *2-fixed*.
26−
27−## Discussion
28−
29−In a normal (dry) gate, your argument is converted into the
30−sample type. In a generic (wet) gate or gill, your argument type
31−passes through the function, rather as if it was a macro (there
32−is still only one copy of the code, however).
33−
34−Genericity is a powerful and dangerous tool. Use gills only if
35−you think you know what you're doing.
36−
37−Just as with a [gate](../tis), we can recurse back into a gill
38−with `$()`.
39−
40−> `$()` expands to `%=($)` (["centis"](../../cen/tis)), accepting
41−> a *jogging* body containing a list of changes to the subject.
42−
43−## Examples
44−
45−Wet and dry gates in a nutshell:
46−
47−```
48−~zod:dojo> =foo |=([a=* b=*] [b a])
49−~zod:dojo> =bar |*([a=* b=*] [b a])
50−~zod:dojo> (foo %cat %dog)
51−[6.778.724 7.627.107]
52−~zod:dojo> (bar %cat %dog)
53−[%dog %cat]
54−```
55−
56−The dry gate does not preserve the type of `a` and `b`; the wet
57−gate does.
docs/hoon/rune/bar/tis.mddeleted−49
@@ -1,49 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 2
5−title: |= "bartis"
6−---
7−
8−# `|= "bartis"`
9−
10−`[%brts p=model q=hoon]`: form a gate, a dry one-armed core with sample.
11−
12−## Expands to
13−
14−```
15−=| p
16−|% ++ $ q
17−--
18−```
19−
20−## Syntax
21−
22−Regular: *2-fixed*.
23−
24−## Discussion
25−
26−A gate is a core with one arm named `$`, so, just as with
27−[`|-` ("barhep")](../hep), we can recurse back into it with `$()`.
28−
29−> `$()` expands to `%=($)` (["centis"](../../cen/tis)), accepting
30−> a *jogging* body containing a list of changes to the subject.
31−
32−## Examples
33−
34−A trivial gate:
35−
36−```
37−~zod:dojo> =foo |=(a=@ +(a))
38−~zod:dojo> (foo 20)
39−21
40−```
41−
42−A slightly less trivial gate:
43−
44−```
45−~zod:dojo> =foo |= [a=@ b=@]
46− (add a b)
47−~zod:dojo> (foo 20 400)
48−420
49−```
docs/hoon/rune/bar/wut.mddeleted−32
@@ -1,32 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 11
4−title: |? "barwut"
5−---
6−
7−# `|? "barwut"`
8−
9−`[%brwt p=hoon]`: form a lead trap.
10−
11−## Expands to
12−
13−```
14−^? |. p
15−```
16−
17−## Syntax
18−
19−Regular: *1-fixed*.
20−
21−## Discussion
22−
23−See this [discussion of the core variance model](../../../advanced).
24−
25−## Examples
26−
27−```
28−~zod:dojo> => ~ ^+ |?(%a) |.(%a)
29−<1?pqz $~>
30−~zod:dojo> => ~ ^+ |?(%a) |.(%b)
31−nest-fail
32−```
docs/hoon/rune/buc.mddeleted−53
@@ -1,53 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 20
5−title: Mold $ "buc"
6−---
7−
8−# Mold `$` "buc"
9−
10−A *mold* is a `gate` (function) that helps us build simple and
11−rigorous data structures. (In fact, since "mold" sounds nasty,
12−we often call molds and mold builders "structures.")
13−
14−## Overview
15−
16−A correct mold is a *normalizer*: an idempotent function across
17−all nouns. If the sample of a gate has type `%noun`, and its
18−body obeys the constraint that for any x, `=((mold x) (mold (mold
19−x)))`, it's a normalizer and can be used as a mold.
20−
21−(Hoon is not dependently typed and so can't check idempotence
22−statically, so we can't actually tell if a mold matches this
23−definition perfectly. This is not actually a problem.)
24−
25−Runes in the `$` family are macros designed for making molds.
26−But any hoon may produce a mold. (This is why `model` is a
27−synonym for `hoon`).
28−
29−Many macros *bunt* a mold, producing `^~(=>(mold $))`. This
30−produces a constant default value. The formal range of a mold
31−(the type of its bunt) is called its *icon*.
32−
33−Molds have two uses: defining simple and rigorous structures, and
34−validating untrusted input data. Validation, though very
35−important, is a rare use case. Except for direct raw input,
36−it's generally a faux pas to rectify nouns at runtime -- or even
37−in userspace.
38−
39−As a structure definition, a mold has three common uses. One,
40−we bunt it for a default value (such as the sample in a gate).
41−Two, the product of some computation is cast to its icon, both
42−checking the type and regularizing it. Three, it's used as a
43−building block in other molds.
44−
45−In any case, since molds are just functions, we can use
46−functional programming to assemble interesting molds. For
47−instance, `(map foo bar)` is a table from mold `foo` to mold
48−`bar`. `map` is not a mold; it's a function that makes a mold.
49−Molds and mold builders are generally described together.
50−
51−## Hoons
52−
53−<list dataPreview="true" className="runes"></list>
docs/hoon/rune/buc/base.mddeleted−34
@@ -1,34 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 1
5−title: Base molds
6−---
7−
8−# Base molds
9−
10−`[%base p=$@(?(%noun %cell %bean %null) [%atom p=aura])]`: trivial molds.
11−
12−## Produces
13−
14−A mold for the base in `p`. `%noun` is any noun; `%atom` is any
15−atom; `%cell` is a cell of nouns; `%bean` is a loobean, ``?(`@f`0
16−`@f`1)``. `%null` is zero with aura `@n`.
17−
18−## Syntax
19−
20−Irregular: `*` makes `,%noun`, `^` makes `,%cell`, `?` makes
21−`,%bean`, `,~` makes `,%null`, `@aura` makes atom `aura`.
22−
23−## Examples
24−
25−```
26−~zod:dojo> (* %foo)
27−7.303.014
28−~zod:dojo> (,~ 0)
29−~
30−~zod:dojo> (^ 0)
31−^
32−~zod:dojo> (@ux [1 1])
33−0x0
34−```
docs/hoon/rune/buc/cab.mddeleted−42
@@ -1,42 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 9
5−title: $_ "buccab"
6−---
7−
8−# `$_ "buccab"`
9−
10−`[%bccb p=hoon]`: mold which normalizes to an example.
11−
12−## Expands to
13−
14−```
15−|=(* p)
16−```
17−
18−## Syntax
19−
20−Regular: *1-fixed*.
21−
22−Irregular: `_foo` is `$_(foo)`.
23−
24−## Discussion
25−
26−`$_` ("buccab") discards the sample it's supposedly normalizing
27−and produces its *example* instead.
28−
29−## Examples
30−
31−```
32−~zod:dojo> =foo $_([%foobar %moobaz])
33−
34−~zod:dojo> (foo %foo %bar)
35−[%foobar %moobaz]
36−
37−~zod:dojo> `foo`[%foobar %moobaz]
38−[%foobar %moobaz]
39−
40−~zod:dojo $:foo
41−[%foobar %moobaz]
42−```
docs/hoon/rune/buc/cen.mddeleted−45
@@ -1,45 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 5
5−title: $% "buccen"
6−---
7−
8−# `$% "buccen"`
9−
10−`[%bccn p=(list [[aura @] model])]`: mold which recognizes a union tagged by head atom.
11−
12−## Normalizes to
13−
14−For any item `i` in `p`, a cell whose head is the atom `q.p.i.p`,
15−and whose tail recognizes `q.i.p`.
16−
17−Void if `p` is empty.
18−
19−## Defaults to
20−
21−For the first item `i` in `p`, the cell `[q.p.i.p $:q.i.p]`.
22−Crashes if `p` is empty.
23−
24−## Syntax
25−
26−Regular form: *2-running*.
27−
28−## Discussion
29−
30−A `$%` ("buccen") is a tagged union, an extremely common data model.
31−
32−Make sure the first item in your `$%` terminates, or the default will
33−be an infinite loop!
34−
35−## Examples
36−
37−```
38−~zod:dojo> =foo $%([%foo p=@ud q=@ud] [%bar p=@ud])
39−
40−~zod:dojo> (foo [%bar 37])
41−[%bar p=37]
42−
43−~zod:dojo> $:foo
44−[%foo p=0 q=0]~
45−```
docs/hoon/rune/buc/col.mddeleted−45
@@ -1,45 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 3
5−title: $: "buccol"
6−---
7−
8−# `$: "buccol"`
9−
10−`[%bccl p=(list model)]`: form a mold which recognizes a tuple.
11−
12−## Normalizes
13−
14−The tuple the length of `p`, normalizing each item, defaulting
15−where the tuple does not match.
16−
17−Void if `p` is empty.
18−
19−## Defaults to
20−
21−The tuple the length of `p`, defaulting each items.
22−
23−Crashes if `p` is empty.
24−
25−## Syntax
26−
27−Regular: *running*.
28−
29−Irregular (noun mode): `,[a b c]` is `$:(a b c)`.
30−Irregular (mold mode): `[a b c]` is `$:(a b c)`.
31−
32−## Examples
33−
34−```
35−~zod:dojo> =foo $:(p=@ud q=@tas)
36−
37−~zod:dojo> (foo 33 %foo)
38−[p=33 q=%foo]
39−
40−~zod:dojo> `foo`[33 %foo]
41−[p=33 q=%foo]
42−
43−~zod:dojo> $:foo
44−[p=0 q=%$]
45−```
docs/hoon/rune/buc/hep.mddeleted−35
@@ -1,35 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 10
4−title: $- "buchep"
5−---
6−
7−# `$- "buchep"`
8−
9−`[%bchp p=model q=model]`: mold which normalizes to an example gate.
10−
11−## Expands to
12−
13−```
14−$_ ^|
15−|=(p $:q)
16−```
17−
18−## Syntax
19−
20−Regular: *2-fixed*.
21−
22−## Discussion
23−
24−Since a `$-` ("buchep") is a [`$_` ("buccab")](../cab/), it is not useful for
25−normalizing, just for typechecking. In particular, the existence of `$-`s does
26−*not* let us send gates or other cores over the network!
27−
28−## Examples
29−
30−```
31−~zod:dojo> =foo $-(%foo %bar)
32−
33−~zod:dojo> ($:foo %foo)
34−%bar
35−```
docs/hoon/rune/buc/ket.mddeleted−41
@@ -1,41 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 7
5−title: $^ "bucket"
6−---
7−
8−# `$^ "bucket"`
9−
10−`[%bckt p=model q=model]`: mold which normalizes a union tagged by head depth (cell).
11−
12−## Normalizes to
13−
14−Default, if the sample is an atom; `p`, if the head of the sample
15−is an atom; `q` otherwise.
16−
17−## Defaults to
18−
19−The default of `p`.
20−
21−## Syntax
22−
23−Regular: *2-fixed*.
24−
25−## Examples
26−
27−```
28−~zod:dojo> =a $%([%foo p=@ud q=@ud] [%bar p=@ud])
29−
30−~zod:dojo> =b $^([a a] a)
31−
32−~zod:dojo> (b [[%bar 33] [%foo 19 22]])
33−[[%bar p=33] [%foo p=19 q=22]]
34−
35−~zod:dojo> (b [%foo 19 22])
36−[%foo p=19 q=22]
37−
38−~zod:dojo> $:b
39−[%bar p=0]
40−```
41−
docs/hoon/rune/buc/pat.mddeleted−43
@@ -1,43 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 6
5−title: $@ "bucpat"
6−---
7−
8−# `$@ "bucpat"`
9−
10−`[%bcpt p=model q=model]`: mold which normalizes a union tagged by head depth (atom).
11−
12−## Normalizes to
13−
14−Default, if the sample is an atom; `p`, if the head of the sample
15−is an atom; `q` otherwise.
16−
17−## Defaults to
18−
19−The default of `p`.
20−
21−## Syntax
22−
23−Regular: *2-fixed*.
24−
25−Product: a mold which applies `p` if its sample is an atom,
26−`q` if its sample is a cell.
27−
28−Regular form: *2-fixed*.
29−
30−Example:
31−
32−```
33−~zod:dojo> =a $@(%foo $:(p=%bar q=@ud))
34−
35−~zod:dojo> (a %foo)
36−%foo
37−
38−~zod:dojo> `a`[%bar 99]
39−[p=%bar q=99]
40−
41−~zod:dojo> $:a
42−[%foo p=0 q=0]
43−```
docs/hoon/rune/buc/tis.mddeleted−41
@@ -1,41 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 8
5−title: $= "buctis"
6−---
7−
8−# `$= "buctis"`
9−
10−`[%bcts p=@tas q=model]`: mold which wraps a face around another mold.
11−
12−## Expands to
13−
14−```
15−|= *
16−^=(p %-(q +6))
17−```
18−
19−## Syntax
20−
21−Regular: *2-fixed*.
22−
23−Irregular (mold mode): `foo=bar` is `$=(foo bar)`.
24−
25−## Discussion
26−
27−Note that the Hoon compiler is at least slightly clever about
28−compiling molds, and almost never has to actually put in a gate
29−layer (as seen in the expansion above) to apply a `$=`.
30−
31−## Examples
32−
33−```
34−~zod:dojo> =a $=(p %foo)
35−
36−~zod:dojo> (a %foo)
37−p=%foo
38−
39−~zod:dojo> (a %bar)
40−p=%foo
41−```
docs/hoon/rune/buc/wut.mddeleted−49
@@ -1,49 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 4
5−title: $? "bucwut"
6−---
7−
8−# `$? "bucwut"`
9−
10−`[%bcwt p=(list model)]`: mold which normalizes a general union.
11−
12−## Normalizes to
13−
14−The first item in `p` which normalizes the sample to itself;
15−otherwise, default.
16−
17−Void, if `p` is empty.
18−
19−## Defaults to
20−
21−The first item in `p`.
22−
23−## Syntax
24−
25−Regular: *running*.
26−
27−Irregular: `?(%foo %bar)` is `$?(%foo %bar)`.
28−
29−## Discussion
30−
31−For a union of atoms, a `$?` ("bucwut") is fine. For more complex nouns,
32−always try to use a [`$%` ("buccen")](../cen/), [`$@` ("bucpat")](../pat/) or
33−[`$^` ("bucket")](../ket/), at least if you expect your mold to be used as a
34−normalizer.
35−
36−## Examples
37−
38−```
39−~zod:dojo> =a ?(%foo %bar %baz)
40−
41−~zod:dojo> (a %baz)
42−%baz
43−
44−~zod:dojo> (a [37 45])
45−%baz
46−
47−~zod:dojo> $:a
48−%baz
49−```
docs/hoon/rune/cen.mddeleted−16
@@ -1,16 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 18
5−title: Call % ("cen")
6−---
7−
8−# Call `%` ("cen")
9−
10−We've already covered [`%wing`](../limb/wing) and [`%limb`](../limb/limb). These are simple
11−forms of the *invocation* family of hoons, `%`, whose general
12−form is `%=` ("centis").
13−
14−## Hoons
15−
16−<list dataPreview="true" className="runes"></list>
docs/hoon/rune/cen/cab.mddeleted−39
@@ -1,39 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 8
4−title: %_ "cencab"
5−---
6−
7−# `%_ "cencab"`
8−
9−`[%cncb p=wing q=(list (pair wing hoon))]`: take a wing with changes,
10−preserving type.
11−
12−## Expands to
13−
14−```
15−^+(p %=(p q))
16−```
17−
18−## Syntax
19−
20−Regular: *1-fixed*, then *jogging*.
21−
22−## Discussion
23−
24−`%_` ("cencab") is different from `%=` ("centis") because `%=`
25−can change the type of a limb with mutations.
26−
27−## Examples
28−
29−```
30−~zod:dojo> =foo [p=42 q=6]
31−~zod:dojo> foo(p %bar)
32−[p=%bar q=6]
33−~zod:dojo> foo(p [55 99])
34−[p=[55 99] q=6]
35−~zod:dojo> %_(foo p %bar)
36−[p=7.496.034 99]
37−~zod:dojo> %_(foo p [55 99])
38−! nest-fail
39−```
docs/hoon/rune/cen/dot.mddeleted−29
@@ -1,29 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 3
5−title: %. "cendot"
6−---
7−
8−# `%. "cendot"`
9−
10−`[%cndt p=hoon q=hoon]`: call a gate (function), reversed.
11−
12−## Expands to
13−
14−```
15−%-(q p)
16−```
17−
18−## Syntax
19−
20−Regular: *2-fixed*.
21−
22−## Examples
23−
24−```
25−~zod:dojo> =add-triple |=([a=@ b=@ c=@] :(add a b c))
26−~zod:dojo> %.([1 2 3] add-triple)
27−6
28−```
29−
docs/hoon/rune/cen/hep.mddeleted−48
@@ -1,48 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 2
5−title: %- "cenhep"
6−---
7−
8−# `%- "cenhep"`
9−
10−`[%cnhp p=hoon q=hoon]`: call a gate (function).
11−
12−## Expands to
13−
14−```
15−%~($ p q)
16−```
17−
18−## Syntax
19−
20−Regular: *2-fixed*.
21−
22−Irregular: `(a)` is `$:a`; `(a b c d)` is `%-(a [b c d])`.
23−
24−## Discussion
25−
26−`%-` ("cenhep") is a function call; `p` is the function ([`gate`](../../bar/tis),
27−`q` the argument. `%-` is a special case of [`%~` ("censig")](../sig), and a gate
28−is a special case of a [door](../../bar/cab).
29−
30−In a gate, the modified core has only one anonymous arm; in a
31−door it gets a full battery. Intuitively, a gate defines one
32−algorithm it can compute upon its sample, `+6`. A door defines
33−many such algorithms.
34−
35−In classical languages, doors correspond to groups of functions
36−with the same argument list, or at least sharing a prefix. In
37−Hoon, this shared sample is likely to be pulled into a door.
38−
39−## Examples
40−
41−```
42−~zod:dojo> =add-triple |=([a=@ b=@ c=@] :(add a b c))
43−~zod:dojo> (add-triple 1 2 3)
44−6
45−~zod:dojo> %-(add-triple [1 2 3])
46−6
47−```
48−
docs/hoon/rune/cen/ket.mddeleted−28
@@ -1,28 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 5
5−title: %^ "cenket"
6−---
7−
8−# `%^ "cenket"`
9−
10−`[%cnkt p=hoon q=hoon r=hoon s=hoon]`: call with triple sample.
11−
12−## Expands to
13−
14−```
15−%-(p [q r s])
16−```
17−
18−## Syntax
19−
20−Regular: *4-fixed*.
21−
22−## Examples
23−
24−```
25−~zod:dojo> =add-triple |=([a/@ b/@ c/@] :(add a b c))
26−~zod:dojo> %^(add-triple 1 2 3)
27−6
28−```
docs/hoon/rune/cen/lus.mddeleted−28
@@ -1,28 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 4
5−title: %+ "cenlus"
6−---
7−
8−# `%+ "cenlus"`
9−
10−`[%cnls p=hoon q=hoon r=hoon]`: call with pair sample.
11−
12−## Expands to
13−
14−```
15−%-(p [q r])
16−```
17−
18−## Syntax
19−
20−Regular: *3-fixed*.
21−
22−## Examples
23−
24−```
25−~zod:dojo> =add-triple |=([a=@ b=@ c=@] :(add a b c))
26−~zod:dojo> %+(add-triple 1 [2 3])
27−6
28−```
docs/hoon/rune/cen/sig.mddeleted−42
@@ -1,42 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 6
5−title: %~ "censig"
6−---
7−
8−# `%~ "censig"`
9−
10−`[%cnsg p=wing q=hoon r=(list hoon)]`: call with multi-armed door.
11−
12−## Expands to
13−
14−```
15−=+ a=q
16−=<(p %=(a +6 r))
17−```
18−
19−> Note: the expansion implementation is hygienic -- it doesn't actually add the
20−> `a` face to the subject. It's shown here because `%=` ("centis") requires a `wing`.
21−
22−## Syntax
23−
24−Regular: *3-fixed*.
25−
26−Irregular: `~(a b c)` is `%~(a b c)`; `~(a b c d e)` is `%~(a b
27−[c d e])`.
28−
29−## Discussion
30−
31−`%~` ("censig") is the general case of a function call, `%-` ("cenhep"). In
32−both, we replace the sample (`+6`) of a core. In `%-` the
33−core is a gate and we pull the `$` arm. In `%~` the
34−core is a door and we can pull any of its arms.
35−
36−Most languages do not have cores, doors, or `%~`. "Just
37−learn to step outside your linear, Western way of thinking."
38−
39−## Examples
40−
41−See [`|_`](../../bar/cab).
42−
docs/hoon/rune/cen/tar.mddeleted−43
@@ -1,43 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 7
5−title: %* "centar"
6−---
7−
8−# `%* "centar"`
9−
10−`[%cntr p=wing q=hoon r=(list (pair wing hoon))]`: make
11−with arbitrary hoon.
12−
13−## Expands to
14−
15−```
16−=+ q
17−%= p
18−r
19−```
20−
21−## Syntax
22−
23−Regular: *2-fixed*, then *jogging*.
24−
25−## Discussion
26−
27−`%*` makes a limb from a hoon, with changes. It's useful when you want
28−evaluate a hoon, pull out a single limb from the result,
29−and then change some parts of the limb before using it.
30−
31−## Examples
32−
33−```
34−~zod:dojo> %*($ add a 2, b 3)
35−5
36−~zod:dojo> =foo [a=1 b=2 c=3 d=4]
37−~zod:dojo> %*(+ foo c %hello, d %world)
38−[b=2 c=%hello d=%world]
39−~zod:dojo> =+(foo=[a=1 b=2 c=3] foo(b 7, c 10))
40−[a=1 b=7 c=10]
41−~zod:dojo> %*(foo [foo=[a=1 b=2 c=3]] b 7, c 10)
42−[a=1 b=7 c=10]
43−```
docs/hoon/rune/cen/tis.mddeleted−55
@@ -1,55 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 1
5−title: %= "centis"
6−---
7−
8−# `%= "centis"`
9−
10−`[%cnts p=wing q=(list (pair wing hoon))]`: take a wing with changes.
11−
12−## Produces
13−
14−`p`, modified by the change list `q`.
15−
16−If `p` resolves to a leg, `q` is a list of changes to that leg.
17−If `p` resolves to an arm, `q` is a list of changes to the core
18−containing that arm. We compute the arm on the modified core.
19−
20−## Syntax
21−
22−Regular: *1-fixed*, then *jogging*.
23−
24−Irregular: `foo(x 1, y 2, z 3)` is `%=(foo x 1, y 2, z 3)`.
25−
26−## Discussion
27−
28−Note that `p` is a wing, not a hoon. Knowing that a function
29−call `(foo bar)` involves making `foo`, replacing its sample
30−at slot `+6` with `bar`, and taking the `$` limb, you might think
31−`(foo bar)` would mean `%=(foo +6 bar)`.
32−
33−But it's actually `=+(foo =>(%=(+2 +6 bar) $))`. Even if `foo` is
34−a wing, we would just be mutating `+6` within the core that defines the
35−`foo` arm. Instead we want to modify the *product* of `foo` -- the gate
36−-- so we have to pin it into the subject.
37−
38−Here's that again in tall form:
39−```
40−=+ foo
41−=> %= +2
42− +6 bar
43− ==
44− $
45−```
46−
47−## Examples
48−
49−```
50−~zod:dojo> =foo [p=5 q=6]
51−~zod:dojo> foo(p 42)
52−[p=42 q=6]
53−~zod:dojo> foo(+3 99)
54−[p=5 99]
55−```
docs/hoon/rune/col.mddeleted−16
@@ -1,16 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 17
5−title: Cell : ("col")
6−---
7−
8−# Cell `:` ("col")
9−
10−The `:` ("col") hoons, `:-` and friends, are simple and regular.
11−All `:` hoons expand to `:-` ("colhep"), which makes a pair
12−(just like the Lisp [`cons`](https://en.wikipedia.org/wiki/Cons) operator).
13−
14−## Hoons
15−
16−<list dataPreview="true" className="runes"></list>
docs/hoon/rune/dot.mddeleted−14
@@ -1,14 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 11
5−title: Nock . ("dot")
6−---
7−
8−# Nock `.` ("dot")
9−
10−Anything Nock can do, Hoon can do also.
11−
12−## Hoons
13−
14−<list dataPreview="true" className="runes"></list>
docs/hoon/rune/dot/ket.mddeleted−22
@@ -1,22 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 5
4−title: .^ "dotket"
5−---
6−
7−# `.^ "dotket"`
8−
9−`[%dtkt p=model q=value]`: load from the Arvo namespace with Nock `11`.
10−
11−## Produces
12−
13−The noun whose name is `q`, cast to the icon of `p`.
14−
15−## Discussion
16−
17−Nock has no `11` instruction, of course. But the virtual Nock
18−used to run userspace code does. Nock `11` loads from a
19−typed immutable namespace defined by its virtual context.
20−
21−We don't remold dynamically nouns in a `.^`, but we do check
22−that the type of the value nests in `p`.
docs/hoon/rune/dot/lus.mddeleted−34
@@ -1,34 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 3
5−title: .+ "dotlus"
6−---
7−
8−# `.+ "dotlus"`
9−
10−`[%dtls p=atom]`: increment an atom with Nock `4`.
11−
12−## Produces
13−
14−`p` plus `1` if `p` is an atom; otherwise, crashes. The product
15−atom has no aura.
16−
17−## Syntax
18−
19−Regular: *1-fixed*.
20−
21−Irregular: `+(6)` is `.+(6)`.
22−
23−## Examples
24−
25−```
26−~zod:dojo> .+(6)
27−7
28−~zod:dojo> +(6)
29−7
30−~zod:dojo> +(%foo)
31−7.303.015
32−~zod:dojo> +([1 2])
33−! nest-fail
34−```
docs/hoon/rune/dot/tar.mddeleted−41
@@ -1,41 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 1
5−title: .* "dottar"
6−---
7−
8−# `.* "dottar"`
9−
10−`[%dttr p=hoon q=hoon]`: evaluate with Nock `2`.
11−
12−## Produces
13−
14−Nock of formula `q` and subject `p`, with type `%noun`.
15−
16−## Syntax
17−
18−Regular: *2-fixed*.
19−
20−## Discussion
21−
22−Note that `.*` ("dottar") can be used to bypass the type system,
23−though its product contains no type information. It's
24−perfectly practical to use Hoon as a typeless language.
25−
26−## Examples
27−
28−```
29−~zod:dojo> .*([20 30] [0 2])
30−20
31−~zod:dojo> .*(33 [4 0 1])
32−34
33−~zod:dojo> .*(|.(50) [9 2 0 1])
34−50
35−~zod:dojo> .*(12 [7 [`1 [4 `1]] [`2 `3 `2]])
36−[12 13 12]
37−~zod:dojo> .*(~ [5 1^4 [4 1^3]])
38−0
39−~zod:dojo> .*(~ [5 1^5 [4 1^3]])
40−1
41−```
docs/hoon/rune/dot/wut.mddeleted−27
@@ -1,27 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 2
5−title: .? "dotwut"
6−---
7−
8−# `.? "dotwut"`
9−
10−`[%dtwt p=hoon]`: test for cell or atom with Nock `3`.
11−
12−## Produces
13−
14−`&`, `%.y`, `0` if `p` is a cell; otherwise `|`, `%.n`, `1`.
15−
16−## Syntax
17−
18−Regular: *1-fixed*.
19−
20−## Examples
21−
22−```
23−~zod:dojo> .?(42)
24−%.n
25−~zod:dojo> .?([42 43])
26−%.y
27−```
docs/hoon/rune/ket.mddeleted−19
@@ -1,19 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 19
5−title: Cast ^ ("ket")
6−---
7−
8−# Cast `^` ("ket")
9−
10−[`^-` ("kethep")](./hep/), [`^+` ("ketlus")](./lus/), and
11−[`^=` ("kettis")](./tis/) let us adjust types without violating type
12−constraints.
13−
14−The `nest` algorithm which tests subtyping is conservative;
15−it never allows invalid nests, it sometimes rejects valid nests.
16−
17−## Hoons
18−
19−<list dataPreview="true" className="runes"></list>
docs/hoon/rune/ket/lus.mddeleted−26
@@ -1,26 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 2
5−title: ^+ "ketlus"
6−---
7−
8−# `^+ "ketlus"`
9−
10−`[%ktls p=value q=value]`: typecast by example (hoon).
11−
12−## Produces
13−
14−The value of `q` with the type of `p`, if the type of `q` nests
15−within the type of `p`. Otherwise, `nest-fail`.
16−
17−## Syntax
18−
19−Regular: *2-fixed*.
20−
21−## Examples
22−
23−```
24−~zod:dojo> ^+('text' %a)
25−'a'
26−```
docs/hoon/rune/sem.mddeleted−13
@@ -1,13 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 21
4−title: Make ; ("sem")
5−---
6−
7−# Make `;` ("sem")
8−
9−Miscellaneous useful macros.
10−
11−## Hoons
12−
13−<list dataPreview="true" className="runes"></list>
docs/hoon/rune/sem/fas.mddeleted−21
@@ -1,21 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 4
4−title: ;/ "semfas"
5−---
6−
7−# `;/ "semfas"`
8−
9−`[%smfs p=hoon]`: tape as XML element.
10−
11−## Expands to
12−
13−```
14−~[%$ ~[%$ 'p']]
15−```
16−
17−## Examples
18−```
19−~zod/try=> :/"foo"
20−[[%~. [%~. "foo] ~] ~]
21−```
docs/hoon/rune/sig.mddeleted−15
@@ -1,15 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 16
5−title: Hint ~ ("sig")
6−---
7−
8−# Hint `~` ("sig")
9−
10−Runes that use Nock `10` to pass non-semantic info to the
11−interpreter.
12−
13−## Hoons
14−
15−<list dataPreview="true" className="runes"></list>
docs/hoon/rune/sig/pam.mddeleted−35
@@ -1,35 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 1
5−title: ~& "sigpam"
6−---
7−
8−# `~& "sigpam"`
9−
10−`[%sgpm p=hoon q=hoon]`: debugging printf.
11−
12−## Expands to
13−
14−`q`.
15−
16−## Convention
17−
18−Prettyprints `p` on the console before computing `q`.
19−
20−## Syntax
21−
22−Regular: *2-fixed*.
23−
24−## Examples
25−
26−```
27−~zod:dojo> ~&('halp' ~)
28−'halp'
29−~
30−
31−~zod:dojo> ~& 'halp'
32− ~
33−'halp'
34−~
35−```
docs/hoon/rune/sig/tis.mddeleted−37
@@ -1,37 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 7
5−title: ~= "sigtis"
6−---
7−
8−# `~= "sigtis"`
9−
10−`[%sgts p=hoon q=hoon]`: detect duplicate.
11−
12−## Expands to
13−
14−`q`.
15−
16−## Convention
17−
18−If `p` equals `q`, produce `p` instead of `q`.
19−
20−## Discussion
21−
22−Duplicates are especially bad news in Hoon, because comparing them
23−takes O(n) time. Use `~=` ("sigtis") to kill them as they breed.
24−
25−## Examples
26−
27−This code traverses a tree and replaces all instances of `42` with
28−`420`:
29−
30−```
31−~zod:dojo> =foo |= a=(tree)
32− ?~(a ~ ~=(a [?:(=(n.a 42) 420 n.a) $(a l.a) $(a r.a)]))
33−~zod:dojo> (foo 42 ~ ~)
34−[420 ~ ~]
35−```
36−
37−Without `~=`, it would build a copy of a completely unchanged tree. Sad!
docs/hoon/rune/tis.mddeleted−35
@@ -1,35 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 13
5−title: Flow = ("tis")
6−---
7−
8−# Flow `=` ("tis")
9−
10−Flow hoons change the subject. (Or more precisely, a flow hoon
11−compiles at least one of its subhoons with a different subject.)
12−All non-flow hoons (except cores) pass the subject down unchanged.
13−
14−## Overview
15−
16−The simplest way to change the subject is to compose two hoons,
17−`p` and `q`. Let `x` be `(mint subject p)`, with product type
18−`p.x` and nock formula `q.x`. Let `y` be `(mint p.x q)`. Then
19−their composition is `[p.y [7 q.x q.y]]`.
20−
21−This composition is the `=>` ("tisgar") rune. A close relative is
22−`=+` ("tislus"), which is `=>` over `[p .]`. The new subject is a
23−cell of `p` and the old subject. `=+` is the simplest Hoon equivalent of
24−"declaring a variable" (introducing new data into the subject).
25−
26−Another way to change the subject is to mutate it. With the
27−`=.` ("tisdot") rune, given a wing that resolves to a leg, we can write
28−instead of reading, *installing* a new value at that leg. Of
29−course, we are creating a copy, not modifying the original.
30−
31−There are many flow stems, all small variations on these three.
32−
33−## Hoons
34−
35−<list dataPreview="true" className="runes"></list>
docs/hoon/rune/tis/bar.mddeleted−36
@@ -1,36 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 8
5−title: =| "tisbar"
6−---
7−
8−# `=| "tisbar"`
9−
10−`[%tsbr p=model q=value]`: combine a defaulted mold with the subject.
11−
12−## Expands to
13−
14−```
15−=+(*p q)
16−```
17−
18−## Syntax
19−
20−Regular: *2-fixed*.
21−
22−## Discussion
23−
24−`=|` "declares a variable" which is "uninitialized," presumably
25−because you'll set it in a loop or similar.
26−
27−## Examples
28−
29−```
30−~zod:dojo> =foo |= a=@
31− =| b=@
32− =- :(add a b c)
33− c=2
34−~zod:dojo> (foo 5)
35−7
36−```
docs/hoon/rune/tis/com.mddeleted−44
@@ -1,44 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 13
5−title: =, "tiscom"
6−---
7−
8−# `=, "tiscom"`
9−
10−`[%tscm p=hoon q=hoon]`: expose namespace
11−
12−`p` evaluates to a noun with some namespace. From within `q` you may access `p`'s
13−names without a wing path (i.e., you can use face `b` rather than `b.p`), or without
14−invoking a core name when `p` is a core. This is especially useful for calling arms
15−from an imported library or for calling arms from an stdlib core repeatedly.
16−
17−## Syntax
18−
19−Regular: *2-fixed*.
20−
21−## Examples
22−
23−With a core:
24−
25−```
26−> (sum -7 --7)
27−-find.sum
28−[crash message]
29−
30−> (sum:si -7 --7)
31−--0
32−
33−> =, si (sum -7 --7)
34−--0
35−```
36−
37−With a dojo-defined face:
38−
39−```
40−> =/ fan [bab=2 baz=[3 qux=4]]
41− =, fan
42− [bab qux.baz]
43−[2 4]
44−```
docs/hoon/rune/tis/dot.mddeleted−39
@@ -1,39 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 10
5−title: =. "tisdot"
6−---
7−
8−# `=. "tisdot"`
9−
10−`[%tsdt p=wing q=hoon r=hoon]`: change one leg in the subject.
11−
12−## Expands to
13−
14−```
15−=>(%_(. p q) r)
16−```
17−
18−## Syntax
19−
20−Regular: *3-fixed*.
21−
22−## Discussion
23−
24−As usual, we are not actually mutating the subject, just creating
25−a new subject with a changed value. Note that the mutation uses
26−[`%_` ("cencab")](../../cen/cab/), so the type doesn't change.
27−
28−## Examples
29−
30−```
31−~zod:dojo> =+ a=[b=1 c=2]
32− =. b.a 3
33− a
34−[b=3 c=2]
35−
36−~zod:dojo> =+ a=[b=1 c=2]
37− =.(b.a 3 a)
38−[b=3 c=2]
39−```
docs/hoon/rune/tis/fas.mddeleted−57
@@ -1,57 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 6
5−title: =/ "tisfas"
6−---
7−
8−# `=/ "tisfas"`
9−
10−`[%tsfs p=taco q=hoon r=hoon]`: combine a named and/or typed
11−noun with the subject.
12−
13−## Expands to
14−
15−*if `p` is a symbol*:
16−
17−```
18−=+(^=(p q) r)
19−```
20−
21−*if `p` is a symbol with a mold*:
22−
23−```
24−=+(^-(p q) r)
25−```
26−
27−### Compiler macro
28−
29−```
30−?@ p
31− =+ p=q
32− r
33−=+ ^-($=(p.p q.p) q)
34−r
35−```
36−
37−## Syntax
38−
39−Regular: *3-fixed*.
40−
41−## Discussion
42−
43−`p` can be either a symbol or a symbol/mold. If it's just a symbol,
44−`=/` ("tisfas") "declares a type-inferred variable." If it has a mold, `=/`
45−"declares a type-checked variable."
46−
47−## Examples
48−
49−```
50−~zod:dojo> =foo |= a=@
51− =/ b 1
52− =/ c=@ 2
53− :(add a b c)
54−~zod:dojo> (foo 5)
55−8
56−```
57−
docs/hoon/rune/tis/gal.mddeleted−39
@@ -1,39 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 2
5−title: =< "tisgal"
6−---
7−
8−# `=< "tisgal"`
9−
10−`[%tsgl p=hoon q=hoon]`: compose two hoons, inverted.
11−
12−## Expands to
13−
14−```
15−=>(q p)
16−```
17−
18−## Syntax
19−
20−Regular: *2-fixed*.
21−
22−Irregular: `foo:bar` is `=<(foo bar)`.
23−
24−## Examples
25−
26−```
27−~zod:dojo> =<(b [a=1 b=2 c=3])
28−2
29−
30−~zod:dojo> =< b
31− [a=1 b=2 c=3]
32−2
33−
34−~zod:dojo> b:[a=1 b=2 c=3]
35−2
36−
37−~zod:dojo> [. .]:(add 2 4)
38−[6 6]
39−```
docs/hoon/rune/tis/gar.mddeleted−27
@@ -1,27 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 1
5−title: => "tisgar"
6−---
7−
8−# `=> "tisgar"`
9−
10−`[%tsgr p=hoon q=hoon]`: compose two hoons.
11−
12−## Produces
13−
14−`q`, compiled against the product of `p`.
15−
16−## Syntax
17−
18−Regular: *2-fixed*.
19−
20−## Examples
21−
22−```
23−~zod:dojo> =>([a=1 b=2 c=3] b)
24−2
25−~zod:dojo> =>((add 2 4) [. .])
26−[6 6]
27−```
docs/hoon/rune/tis/hep.mddeleted−36
@@ -1,36 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 5
5−title: =- "tishep"
6−---
7−
8−# `=- "tishep"`
9−
10−`[%tshp p=hoon q=hoon]`: combine a new noun with the subject, inverted.
11−
12−## Expands to
13−
14−```
15−=>([q .] p)
16−```
17−
18−## Syntax
19−
20−Regular: *2-fixed*.
21−
22−## Discussion
23−
24−`=-` looks better than `=+` when the hoon you're pinning
25−is much smaller than the hoon that uses it.
26−
27−## Examples
28−
29−```
30−~zod:dojo> =foo |= a=@
31− =+ b=1
32− =- (add a b c)
33− c=2
34−~zod:dojo> (foo 5)
35−8
36−```
docs/hoon/rune/tis/ket.mddeleted−43
@@ -1,43 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 12
4−title: =^ "tisket"
5−---
6−
7−# `=^ "tisket"`
8−
9−`[%tskt p=taco q=wing r=hoon s=hoon]`: pin the head of a pair; change
10−a leg with the tail.
11−
12−## Expands to
13−
14−```
15−=/(p -.r =.(q +.r s))
16−```
17−
18−## Syntax
19−
20−Regular: *4-fixed*.
21−
22−## Discussion
23−
24−We use `=^` ("tisket" when we have a state machine with a function that
25−produces a cell, whose head is a result and whose tail is a new
26−state. We want to use the head as a new variable, and stuff the
27−tail back into wherever we stored the old state.
28−
29−This may also remind you of Haskell's State monad.
30−
31−## Examples
32−
33−The `og` core is a stateful pseudo-random number generator.
34−We have to change the core state every time we generate a
35−random number, so we use `=^`:
36−
37−```
38−~zod:dojo> =+ rng=~(. og 420)
39− =^ r1 rng (rads:rng 100)
40− =^ r2 rng (rads:rng 100)
41− [r1 r2]
42−[99 46]
43−```
docs/hoon/rune/tis/lus.mddeleted−35
@@ -1,35 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 4
5−title: =+ "tislus"
6−---
7−
8−# `=+ "tislus"`
9−
10−`[%tsls p=hoon q=hoon]`: combine a new noun with the subject.
11−
12−## Expands to
13−
14−```
15−=>([p .] q)
16−```
17−
18−## Syntax
19−
20−Regular: *2-fixed*.
21−
22−## Discussion
23−
24−`=+` ("tislus") is the simplest way of "declaring a variable."
25−
26−## Examples
27−
28−```
29−~zod:dojo> =foo |= a=@
30− =+ b=1
31− =+ c=2
32− :(add a b c)
33−~zod:dojo> (foo 5)
34−8
35−```
docs/hoon/rune/tis/sem.mddeleted−32
@@ -1,32 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 7
5−title: =; "tissem"
6−---
7−
8−# `=; "tissem"`
9−
10−`[%tssm p=taco q=hoon r=hoon]`: combine a named and/or typed noun with the
11−subject, inverted.
12−
13−## Expands to
14−
15−```
16−=/(p r q)
17−```
18−
19−## Syntax
20−
21−Regular: *3-fixed*.
22−
23−## Examples
24−
25−```
26−~zod:dojo> =foo |= a=@
27− =/ b 1
28− =; c=@ :(add a b c)
29− 2
30−~zod:dojo> (foo 5)
31−8
32−```
docs/hoon/rune/tis/tar.mddeleted−41
@@ -1,41 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 9
5−title: =* "tistar"
6−---
7−
8−# `=* "tistar"`
9−
10−`[%tstr p=term q=hoon r=hoon]`: define an alias.
11−
12−## Produces
13−
14−`r`, compiled with a subject in which `p` is aliased to `q`.
15−
16−## Syntax
17−
18−Regular: *3-fixed*.
19−
20−## Discussion
21−
22−The difference between aliasing and pinning is that the subject
23−noun stays the same; the alias is just recorded in its type.
24−`q` is calculated every time you use the `p` alias, of course.
25−
26−## Examples
27−
28−```
29−~zod:dojo>
30− =+ a=1
31− =* b a
32− [a b]
33−[1 1]
34−
35−~zod:dojo>
36− =+ a=1
37− =* b a
38− =. a 2
39− [a b]
40−[2 2]
41−```
docs/hoon/rune/wut/col.mddeleted−59
@@ -1,59 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 1
5−title: ?: "wutcol"
6−---
7−
8−# `?: "wutcol"`
9−
10−`[%wtcl p=hoon q=hoon r=hoon]`: branch on a boolean test.
11−
12−## Produces
13−
14−If `p` produces yes, then `q`. If `p` produces no, `r`.
15−If `p` is not a boolean, compiler yells at you.
16−
17−The subjects of `q` and `r` are constrained to match any
18−pattern-matching algebra in `p`. The analysis, which is
19−conservative, understands any combination of [`?=` ("wuttis")](../tis/),
20−[`?&` ("wutpam")](../pam/), [`?|` ("wutbar")](../bar/), and
21−[`?!` ("wutzap")](../zap/), and reduces the subject appropriately when
22−compiling.
23−
24−If test analysis reveals that either branch is not taken,
25−or if `p` is not a boolean, compilation fails. However,
26−an untaken branch can be indicated with the `%lost` hoon.
27−
28−## Syntax
29−
30−Regular: *3-fixed*.
31−
32−## Discussion
33−
34−Short-circuiting in boolean tests works as you'd expect
35−and includes the expected inference. For instance,
36−if you write `?&(a b)`, `b` is only executed if `a` is
37−positive, and compiled with that assumption.
38−
39−Note also that all other branching hoons reduce to `?:`.
40−
41−## Examples
42−
43−```
44−~zod:dojo> ?:((gth 1 0) 3 4)
45−3
46−
47−~zod:dojo> ?: (gth 1 0)
48− 3
49− 4
50−3
51−
52−~zod:dojo> ?:((gth 1 2) 3 4)
53−4
54−
55−~zod:dojo> ?: (gth 1 2)
56− 3
57− 4
58−4
59−```
docs/hoon/rune/wut/gal.mddeleted−31
@@ -1,31 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 4
5−title: ?< "wutgal"
6−---
7−
8−# `?< "wutgal"`
9−
10−`[%wtgl p=hoon q=hoon]`: negative assertion.
11−
12−## Expands to
13−
14−```
15−?:(p !! q)
16−```
17−
18−## Syntax
19−
20−Regular: *2-fixed*.
21−
22−## Examples
23−
24−```
25−~zod:dojo> ?<(=(3 4) %foo)
26−%foo
27−
28−~zod:dojo> ?<(=(3 3) %foo)
29−ford: build failed
30−```
31−
docs/hoon/rune/wut/gar.mddeleted−30
@@ -1,30 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 3
5−title: ?> "wutgar"
6−---
7−
8−# `?> "wutgar"`
9−
10−`[%wtgr p=hoon q=hoon]`: positive assertion.
11−
12−## Expands to
13−
14−```
15−?.(p !! q)
16−```
17−
18−## Syntax
19−
20−Regular: *2-fixed*.
21−
22−## Examples
23−
24−```
25−~zod:dojo> ?>(=(3 3) %foo)
26−%foo
27−
28−~zod:dojo> ?>(=(3 4) %foo)
29−ford: build failed
30−```
docs/hoon/rune/wut/ket.mddeleted−39
@@ -1,39 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 11
5−title: ?^ "wutket"
6−---
7−
8−# `?^ "wutket"`
9−
10−`[%wtkt p=wing q=hoon r=hoon]`: branch on whether a wing
11−of the subject is a cell.
12−
13−## Expands to
14−
15−```
16−?:(?=(^ p) q r)
17−```
18−
19−## Syntax
20−
21−Regular: *3-fixed*.
22−
23−## Discussion
24−
25−Regular form: *3-fixed*
26−
27−## Examples
28−
29−```
30−~zod:dojo> ?^(0 1 2)
31−! mint-vain
32−! exit
33−
34−~zod:dojo> ?^(`*`0 1 2)
35−2
36−
37−~zod:dojo> ?^(`*`[1 2] 3 4)
38−3
39−```
docs/hoon/rune/wut/lus.mddeleted−57
@@ -1,57 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 13
4−title: ?+ "wutlus"
5−---
6−
7−# `?+ "wutlus"`
8−
9−`[%wtls p=wing q=value r=(list (pair model value))]`: switch against
10−a union, with a default.
11−
12−## Expands to
13−
14−*Pseudocode*: `a`, `b`, `c`, ... as elements of `r`:
15−
16−```
17−?: ?=(p.a) q.a
18−?: ?=(p.b) q.b
19−?: ?=(p.c) q.c
20−...
21−q
22−```
23−
24−### Compiler macro
25−
26−```
27−|-
28−?. r
29− q
30−?: ?=(p.i.r p)
31− q.i.r
32−$(r t.r)
33−```
34−
35−## Syntax
36−
37−Regular: *2-fixed*, then *jogging*.
38−
39−## Discussion
40−
41−An extra case will throw `mint-vain`. A lost case defaults.
42−
43−## Examples
44−
45−```
46−~zod:dojo> =cor |= vat=?($a $b)
47− ?+ vat 240
48− $a 20
49− $b 42
50− ==
51−~zod:dojo> (cor %a)
52−20
53−~zod:dojo> (cor %b)
54−42
55−~zod:dojo> (cor %c)
56−240
57−```
docs/hoon/rune/wut/pat.mddeleted−33
@@ -1,33 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 10
5−title: ?@ "wutpat"
6−---
7−
8−# `?@ "wutpat"`
9−
10−`[%wtpt p=wing q=hoon r=hoon]`: branch on whether a wing
11−of the subject is an atom.
12−
13−## Expands to
14−
15−```
16−?:(?=(@ p) q r)
17−```
18−
19−## Syntax
20−
21−Regular: *3-fixed*.
22−
23−## Examples
24−
25−```
26−~zod:dojo> ?@(0 1 2)
27−! mint-vain
28−! exit
29−~zod:dojo> ?@(`*`0 1 2)
30−1
31−~zod:dojo> ?@(`*`[1 2] 3 4)
32−4
33−```
docs/hoon/rune/wut/sig.mddeleted−34
@@ -1,34 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 9
5−title: ?~ "wutsig"
6−---
7−
8−# `?~ "wutsig"`
9−
10−`[%wtsg p=wing q=hoon r=hoon]`: branch on whether a wing
11−of the subject is null.
12−
13−## Expands to
14−
15−```
16−?:(?=($~ p) q r)
17−```
18−
19−## Syntax
20−
21−Regular: *3-fixed*.
22−
23−## Discussion
24−
25−It's bad style to use `?~` to test for any zero atom. Use it
26−only for a true null, `~`.
27−
28−## Examples
29−
30−```
31−~zod:dojo> =foo ""
32−~zod:dojo> ?~(foo 1 2)
33−1
34−```
docs/hoon/rune/wut/tis.mddeleted−43
@@ -1,43 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 8
5−title: ?= "wuttis"
6−---
7−
8−# `?= "wuttis"`
9−
10−`[%wtts p=model q=wing]`: test pattern match.
11−
12−## Produces
13−
14−`&` (yes) if the noun at `q` is in the icon of `p`;
15−`|` (no) otherwise.
16−
17−## Syntax
18−
19−Regular: *2-fixed*.
20−
21−## Discussion
22−
23−`?=` ("wuttis") is not as powerful as it might seem. For instance, it
24−can't generate a loop -- you cannot (and should not) use it to
25−test whether a `*` is a `(list @)`. Nor can it validate atomic
26−auras.
27−
28−Patterns should be as weak as possible. Unpack one layer of
29−union at a time. Don't confirm things the type system knows.
30−
31−For example, when matching a book containing a page `[%foo p=@
32−q=[@ @]]`, the proper pattern is `[%foo *]`. You have one
33−question, which is whether the head of the noun is `%foo`.
34−
35−A common error is `find.$`, meainng `p` is not a mold.
36−
37−## Examples
38−
39−```
40−~zod:dojo> =bar [%foo %bar %baz]
41−~zod:dojo> ?=([%foo *] bar)
42−%.y
43−```
docs/hoon/rune/zap.mddeleted−12
@@ -1,12 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 12
5−title: Wild ! ("zap")
6−---
7−
8−# Wild `!` ("zap")
9−
10−## Hoons
11−
12−<list dataPreview="true" className="runes"></list>
docs/hoon/rune/zap/gar.mddeleted−30
@@ -1,30 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 3
5−title: !> "zapgar"
6−---
7−
8−# `!> "zapgar"`
9−
10−`[%zpgr p=hoon]`: wrap a noun in its type.
11−
12−## Produces
13−
14−A cell whose tail is `p`, and whose head is the static type of p.
15−
16−## Syntax
17−
18−Regular: *1-fixed*.
19−
20−## Discussion
21−
22−In Hoon, dynamic type is static type compiled at runtime. This
23−type-noun cell is generally called a `vase`.
24−
25−## Examples
26−
27−```
28−~zod:dojo> !>(1)
29−[p=#t/@ud q=1]
30−```
docs/hoon/rune/zap/tis.mddeleted−29
@@ -1,29 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 2
5−title: != "zaptis"
6−---
7−
8−# `!= "zaptis"`
9−
10−`[%zpts p=hoon]`: make the Nock formula for a hoon.
11−
12−## Produces
13−
14−The Nock generated by `p`.
15−
16−## Syntax
17−
18−Regular: *1-fixed*.
19−
20−## Examples
21−
22−```
23−~zod:dojo> !=(20)
24−[1 20]
25−~zod:dojo> !=(~zod)
26−[1 0]
27−~zod:dojo> !=((add 2 2))
28−[8 [9 3.110.356 0 31] 9 2 [0 4] [7 [0 3] 1 2 2] 0 11]
29−```
docs/hoon/syntax.mddeleted−391
@@ -1,391 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 13
4−next: true
5−title: Syntax
6−---
7−
8−# Hoon syntax
9−
10−Hoon's syntax is unusual, and to beginners it can look a lot more
11−complex than it really is. However, we believe that anyone who
12−learns Hoon syntax will find that it has a number of advantages.
13−
14−# Motivation
15−
16−Hoon syntax is trying to solve three serious
17−problems in functional syntax design. These are *terminator
18−piles*, *indentation creep*, and *feature/label confusion*.
19−
20−## Terminator piles
21−
22−*Terminator piles* are like Lisp's stacks of right parentheses.
23−Significant whitespace solves this problem and creates others.
24−
25−Hoon has no terminator piles. Except for a 1-space / more-space
26−distinction, it has no significant whitespace.
27−
28−## Indentation creep
29−
30−*Indentation creep* is a problem caused by indentation conventions
31−where the indentation point is a function of expression tree
32−depth. This problem is especially irritating when working with
33−long functions. It's true that short functions are better, but
34−long ones sometimes need to be written.
35−
36−A procedural block has a backbone of statements which flows
37−straight down. Most expressions are flat and of limited depth.
38−With some bulging, a long function flows *down* the page.
39−
40−A functional language lacks the expression/statement distinction.
41−So a long function means a deep tree. Given normal indentation
42−conventions, a long function wants to flow *down and across*.
43−This *diagonal* shape fits poorly into most editor windows.
44−
45−Thanks to backstep indentation (see below), Hoon programs are
46−shaped more or less like procedural programs.
47−
48−## Feature/label confusion
49−
50−*Feature/label confusion* (FLC) is the result of any syntax that
51−makes it hard for the eye to tell whether a token on the screen is
52−a feature of the language, or a label in the program. For example,
53−in Lisp a special form has the same syntax as a function call.
54−
55−The worst-case result of FLC is "DSL cancer." Every source file
56−is effectively written in its own domain-specific language. To
57−read a new file is to learn a new language&mdash;"write-only code."
58−
59−User-level macros, operator overloading, even excessive use of
60−higher-order programming, can all lead quickly to the tragedy of
61−write-only code.
62−
63−Hoon has no FLC, user-level macros, or overloading. It does
64−support higher-order programming; write-only Hoon can certainly be
65−(and has been) written. But good Hoon style is to avoid it.
66−
67−# Design
68−
69−Hoon has a general syntax design with common principles and
70−regularities. We'll cover those here.
71−
72−## Glyphs and characters
73−
74−Hoon source uses ASCII text. Hoon does not accept non-ASCII
75−text in source files, except UTF-8 in quoted strings. Hard
76−tab characters are illegal.
77−
78−Hoon is a heavy punctuation user. Reading off code aloud
79−using the proper names of ASCII symbols is tedious, so we've
80−mapped each punctuation glyph to a syllable:
81−
82−```
83−ace [1 space] gal < pal (
84−bar | gap [>1 space, nl] par )
85−bas \ gar > sel [
86−buc $ hax # sem ;
87−cab _ hep - ser ]
88−cen % kel { sig ~
89−col : ker } soq '
90−com , ket ^ tar *
91−doq " lus + tec `
92−dot . pam & tis =
93−fas / pat @ wut ?
94−zap !
95−```
96−
97−You don't need to memorize these glyph names, but it might help.
98−Code is often vocalized or subvocalized. "pal" is easier to say,
99−aloud or silently, than "left paren".
100−
101−Note that the list includes two separate whitespace forms: `ace`
102−for a single space; `gap` is either 2+ spaces or a newline. In Hoon,
103−the only significance in whitespace is the difference between
104−`ace` and `gap`. Comments also count as `gap` whitespace&mdash;they
105−start with `::` and run to the end of the line.
106−
107−An 80-column right margin is strongly encouraged. Really
108−well-groomed Hoon uses a 55-column code margin and puts a standard
109−line comment at column 57.
110−
111−## Expressions and Runes
112−
113−Each regular Hoon expression begins with a
114−[rune](../about/glossary/#-rune). A rune is a pair
115−of ASCII punctuation marks (a digraph)&mdash;e.g., `:-`. The first
116−glyph in the rune indicates the category&mdash;e.g., `:` runes make
117−[cells](../about/glossary/#-cell) (i.e., ordered
118−pairs). We pronounce runes using their glyph names&mdash;for `:-`,
119−we say "colhep".
120−
121−Each rune is followed by one or more subexpressions. The number and
122−kind of subexpressions depend on the rune used.
123−
124−```
125−:- 25
126−3
127−```
128−
129−This Hoon uses `:-` to produce a cell: `[25 3]`. There are always two
130−subexpressions following the `:-` in syntactically correct Hoon code,
131−the first of which, when evaluated, becomes the *head* (i.e., the left)
132−and the second of which becomes the *tail* (i.e., the right).
133−
134−Hoon expressions are just called
135−[hoons](../about/glossary/#-a-hoon), because a rune's subexpression can itself
136−be a Hoon expression (i.e. another rune). You'll start to see this tree-like,
137−recursive structure the more you program in Hoon. You can think of one Hoon
138−file being composed of multiple hoons. The subexpressions following the
139−rune are sometimes called the *children* of that hoon.
140−
141−## Tall and flat forms
142−
143−There are two kinds of Hoon expression syntax: *tall* and *flat*.
144−Most runes can be used in both tall and flat hoons. Tall hoons can
145−contain flat hoons, but not vice versa.
146−
147−The `:-` expression in the last subsection was in tall form. Here's
148−the flat equivalent:
149−
150−`:-(25 3)`
151−
152−Visually, a tall hoon looks like a "statement" and a flat hoon
153−like an "expression," preserving the attractive visual shape of
154−procedural code without the nasty side effects.
155−
156−## Regular and irregular forms
157−
158−Most runes have *regular forms*, which share a common design.
159−There is a regular flat form and a regular tall form; most runes
160−have both kinds of implementation. All tall forms are regular.
161−
162−Some runes also have *irregular forms*, which follow no
163−principles at all. All irregular forms are flat.
164−
165−```
166−.= 22
167−23
168−```
169−
170−The `.=` rune tests for equality the two subexpressions that
171−follow, and returns a boolean. Above is the tall, regular form of
172−`.=`. Below is the irregular form:
173−
174−`=(22 23)`
175−
176−Some hoons have *only* irregular forms.
177−
178−## Tall regular form
179−
180−Tall regular forms start with a rune followed by a `gap`.
181−(Remember, a `gap` is any whitespace other than `ace`.) After
182−that are the number and types of subexpressions appropriate for
183−that rune. Each subexpression is separated from its neighboring
184−subexpressions by a `gap`.
185−
186−Let's call everything in the hoon after the initial rune the hoon
187−*body*. There are four body subtypes: *fixed*, *running*, *jogging*,
188−and *[battery](../about/glossary/#-battery)*.
189−
190−Runes with a *fixed* number of subexpressions self-terminate. For
191−instance, the `:-` and `.=` runes each have two subexpressions
192−and are self-terminating. Otherwise the hoon is terminated by both
193−a `gap`, then either `==` (*running* or *jogging*, most hoons) or
194−`--` (*battery*).
195−
196−The *running* body has a list of *children* (i.e., subexpressions).
197−The *jogging* body has a list of child pairs, where the members of
198−each pair are separated by a `gap`. The *battery* body is
199−a list of symbol-child pairs, separated by a gap, prefixed by `++`
200−and then a gap.
201−
202−This definition is enough to write Hoon that will parse. But
203−writing code with optimal whitespace management requires some
204−additional informal conventions.
205−
206−Whitespace design in Hoon is an art, not a science. It involves
207−both tall/flat mode switches and well-shaped gaps. (Hoon layout
208−could probably be done automatically with reasonable quality.
209−But it would at least take machine learning, not a rule engine.)
210−
211−There are only two real *rules* in Hoon whitespace design: don't
212−go past 80 characters, and don't use (completely) blank lines.
213−Otherwise, if it looks good and is easy to read, it's good. The
214−best way to learn the art is to do everything by convention
215−until you know what you're doing. Here are the conventions:
216−
217−### Conventions: *fixed*
218−
219−Rune bodies with *fixed* fanout use "backstep" indentation, which
220−slopes backward and to the right by two spaces per line. The first
221−hoon child is two spaces after the end of the rune.
222−
223−Some *1-fixed*, *2-fixed*, *3-fixed* and *4-fixed* examples:
224−
225−```
226−|.
227−p
228−
229−=| p
230−q
231−
232−?: p
233− q
234−r
235−
236−%^ p
237− q
238− r
239−s
240−```
241−
242−In optimal usage of backstep indentation, the most complicated hoons
243−are at the bottom, keeping code flow vertical rather than diagonal.
244−
245−### Conventions: *running*
246−
247−A *running* hoon body (a simple child list) puts the first child two
248−spaces after the end of the rune, and the following children straight
249−down:
250−
251−A *running* example:
252−
253−```
254−:* p
255− q
256− r
257− s
258− t
259−==
260−```
261−
262−### Conventions: *jogging*
263−
264−A *jogging* hoon body (a list of child pairs) is like a running
265−body, but with a pair of children on each line, separated by
266−two spaces. Most jogging bodies start with a *fixed* sequence;
267−the first jogging pair is below and two steps backward from the
268−last fixed child.
269−
270−There are two jogging conventions: *flat* (pair on one line) and
271−*tall* (pair split across lines).
272−
273−A *flat jogging* example (preceded by *1-fixed* `p`)
274−
275−```
276−?- p
277− q r
278− s t
279− u v
280−==
281−```
282−
283−A *tall jogging* example (preceded by *1-fixed* `p`):
284−
285−```
286−?- p
287− q
288− r
289− s
290− t
291− u
292− v
293−==
294−```
295−
296−### Conventions: *battery*
297−
298−A *battery* body has a list of symbol-child pairs, for the
299−[battery](../about/glossary/#-battery)
300−of a
301−[core](../about/glossary/#-core). A
302−conventional example:
303−
304−```
305−|%
306−++ dry-arm-foo
307− %p
308−++ dry-arm-bar
309− %q
310−+- wet-arm-baz
311− %r
312−--
313−```
314−
315−## Flat regular form
316−
317−Flat regular form starts with the rune, followed by `pal`, `(`
318−(left parenthesis), followed by a body whose subexpressions
319−are separated by `ace` (one space), followed by `par`, `)` (right
320−parenthesis).
321−
322−A hoon in flat form, `?:` ("wutcol"), `[%if p=hoon q=hoon r=hoon]`:
323−
324−`?:(p q r)`
325−
326−The only exception is *jogging* bodies, in which subexpression
327−pairs are separated by commas:
328−
329−```
330−foo(bar 42, baz 55, moo 17)
331−```
332−
333−There is no flat regular form for *battery* bodies. Be tall.
334−
335−## Naming conventions
336−
337−Hoon does not enforce any rule on symbols, except that capitals
338−are not allowed (use kebab-case). However, a lot of system code
339−is written using "lapidary" conventions that need explanation.
340−
341−Naming things is one of the hard problems in CS. Dodging this
342−problem is one of the reasons mathematicians use Greek letters,
343−not variable names. Meaningful names also interpose a verbal
344−interpretation, distracting at best and confusing at worst, on
345−the formula or algorithm. Greek letters are not *meaningful*,
346−but they are *memorable*. And their interpretation is defined by
347−the formula and nothing else.
348−
349−### Lapidary and ultralapidary
350−
351−In the *lapidary* naming style, labels are pronounceable
352−three-letter strings, usually CVC (consonant-vowel-consonant).
353−Sometimes they encode a mnemonic, but usually they are just
354−memorable. Labels are reused wherever the analogy seems
355−appropriate.
356−
357−In the *ultralapidary* naming style, labels are single letters,
358−starting in order of construction from `a`, or within a tuple
359−[mold](../about/glossary/#-mold) `p`. Hoon
360−uses single-letter names for the same reason Algol style
361−languages pass arguments by order, rather than keyword. Naming
362−items by order makes sense when there are no more than three or
363−four; five is stretching it; six is outright ridiculous.
364−
365−For example, when defining `add`, we want to name the operands
366−`a` and `b`. It's silly to call them `foo` and `bar`, let alone
367−`left-operand` and `right-operand`. The smaller the scale of an
368−algorithm, the simpler its names should be.
369−
370−### When in doubt, don't be lapidary
371−
372−This works in the other direction: namelessness doesn't scale.
373−Most normal code shouldn't use lapidary naming at all. (Everyone
374−agrees: there is *way* too much lapidary Hoon in Urbit.)
375−
376−Lapidary naming is only for *inherently simple code*: code that
377−both aspires to high elegance and clarity, and *is solving a
378−simple and elegant problem*.
379−
380−Given an ugly or complex problem, lapidary naming is a liability,
381−no matter the excellence of the programmer. When in doubt, use
382−long names and/or kebab-case.
383−
384−## Freedom
385−
386−If you came all this way to learn how to write apps, you're all
387−set. This is about all you need to know to start getting your
388−hands dirty. Refer back here or to the [standard library](../library/) when
389−needed, but for now, move on to [Arvo](../../arvo/) to continue learning.
390−
391−If, however, good enough is *not* enough, feel free to dive deeper:
docs/nock.mddeleted−12
@@ -1,12 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 4
5−title: Nock
6−---
7−
8−# Nock
9−
10−Nock is our nano-VM. If you want to understand the foundation of Urbit, dive in.
11−
12−<list/>
docs/urbyte.mddeleted−12
@@ -1,12 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 3
5−title: Urbytes
6−---
7−
8−# Urbytes
9−
10−Learn Hoon in short, self-contained, bottom-up tutorials through our in-house Urbyte series. A work in progress. Still ideal for the complete newbie.
11−
12−<list/>
docs/urbyte/0.mddeleted−284
@@ -1,284 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 1
4−next: true
5−title: Setup and nouns
6−---
7−
8−# Urbyte 0: Setup and nouns
9−
10−This is the first post in our new Urbyte series.
11−
12−The Urbyte concept is that you, an ordinary programmer, not a
13−kernel hacker or a Haskell magician (not that there's anything
14−wrong with kernel hackers or Haskell magicians) can learn Hoon,
15−Urbit's programming language.
16−
17−We're going to test this daring idea by teaching you Hoon, in
18−easily digestible, byte-size chunks. Each post in the "Urbytes"
19−series is designed to take about 15 minutes to consume. (Maybe
20−10, if you're a kernel hacker or a Haskell magician.)
21−
22−We'll assume no knowledge of Urbit except for previous lessons.
23−Ideally you have some basic familiarity with programming and can
24−operate the Unix command line.
25−
26−We strongly encourage you to type in all the examples in each
27−Urbyte. Urbytes are short, but not meant to be skimmed.
28−
29−## Install
30−
31−First, [install Urbit](../../using/install/) on any
32−Mac or Unix machine. On Windows, make a virtual Linux machine
33−using VirtualBox or a similar tool.
34−
35−While you're downloading, read about Urbit ships:
36−
37−## Ships
38−
39−In the Urbyte exercises you'll be running what we call a "comet". A string starting with `~`, like `~zod`, is what Urbit
40−calls a *ship*.
41−
42−A *ship* is one number which means four things: a network address,
43−a cryptographic identity, a memorable name, and a single virtual
44−computer.
45−
46−We write this number in a base-256 format, where each digit is a
47−syllable. Imagine if your phone number was a pronounceable
48−string which sounded like a name in a foreign language. `~zod`
49−is ship zero (making it a very important ship indeed!). An ordinary
50−user-level ship is a "planet", a 32-bit number which becomes
51−a four-syllable string, like `~talsur-todres`.
52−
53−*Comets*, at 128-bits or 16 syllables, are
54−disposable identities that anyone can make for free to
55−join the live network. Thus, comets make the ideal ship for
56−playing around with Hoon, asking for help from other Urbit devs in [Talk](../../using/messaging/) if you
57−need it, and showing off Urbit to your hacker friends.
58−
59−## Create and restart
60−
61−To create your comet, run:
62−
63−```
64−$ cd ~
65−$ mkdir urbit
66−$ cd urbit
67−$ urbit -c mycomet
68−```
69−
70−This will take a few minutes and will spin out a bunch of boot
71−messages. At the end, you'll see something like:
72−
73−```
74−ames: on localhost, UDP 31337.
75−http: live (insecure, public) on 8080
76−http: live ("secure", public) on 8443
77−http: live (insecure, loopback) on 12321
78−~palnul_nocser:dojo>
79−```
80−
81−To make sure everything is working, type `(add 2 2)` at the
82−prompt, then hit return. Your screen now shows:
83−
84−```
85−ames: on localhost, UDP 31337.
86−http: live (insecure, public) on 8080
87−http: live ("secure", public) on 8443
88−http: live (insecure, loopback) on 12321
89−> (add 2 2)
90−4
91−~palnul_nocser:dojo>
92−```
93−
94−That's super awesome! You made your first noun! We'll make a
95−few more in a second. First, quit Urbit with `ctrl-d`:
96−
97−```
98−> (add 2 2)
99−4
100−~palnul_nocser:dojo>
101−$
102−```
103−
104−You now have an Urbit image, or *pier*, in the `mycomet` directory.
105−Right now the only thing in your pier is Urbit's system files:
106−
107−```
108−$ ls -a /path/to/mycomet
109−./ ../ .urb/
110−```
111−
112−Restarting uses almost the same command, but without `-c` (which
113−means "create"). There are also fewer startup messages:
114−
115−```
116−$ urbit mycomet
117−[...]
118−ames: on localhost, UDP 31337.
119−http: live (insecure, public) on 8080
120−http: live ("secure", public) on 8443
121−http: live (insecure, loopback) on 12321
122−~palnul_nocser:dojo>
123−```
124−
125−Note also that Urbit is an ACID database. You can stop it
126−politely with `ctrl-d`, abruptly with `ctrl-z`, even violently with `kill
127−-9`. None of these should cause Urbit to lose data. If you do
128−manage to corrupt a pier, it's a bug; please let us know.
129−
130−## Let's make a noun
131−
132−You've already made a noun. Let's make another!
133−
134−*We won't show the `~palnul_nocser:dojo> ` prompt from here on out.
135−We'll just show the echoed command.*
136−
137−
138−```
139−~palnul_nocser:dojo> 42
140−42
141−```
142−
143−You'll see:
144−
145−```
146−> 42
147−42
148−```
149−
150−## Understanding nouns
151−
152−A value in Urbit is called a *noun*. A noun is either an *atom*
153−(an unsigned integer of any size) or a *cell* (an ordered pair of
154−any two nouns).
155−
156−In a sentence, a noun is a binary tree whose leaves are numbers.
157−If you know Lisp, a noun is a minimalist S-expression. A noun
158−can't have cycles (pointer loops). An implementation can use
159−dags (shared subtrees), but the programmer can't detect them
160−(there's no pointer equality test).
161−
162−The absence of graph cycles makes nouns much easier to save in
163−persistent storage, send over the network, manage memory for
164−(Urbit has no tracing garbage collector), etc.
165−
166−## Let's make some atoms
167−
168−So one kind of atom is a number. And the syntax (or at least one
169−syntax) for a number is a decimal, like `42`. Seems legit.
170−
171−But just to be sure we understand this decimal thing, let's make
172−some atoms:
173−
174−```
175−> 4
176−4
177−```
178−
179−Seems pretty straightforward.
180−
181−```
182−> 42
183−42
184−```
185−
186−Why not try it again to make sure?
187−
188−```
189−> 420
190−420
191−```
192−
193−Can we add another zero?
194−
195−```
196−> 420
197−```
198−
199−Wat? When you tried to type that next zero and turn `420` into
200−`4200`, Urbit actually *deleted the `0` and beeped at you.*
201−
202−But isn't an atom an unsigned integer of any size? It is.
203−But the syntax is actually `4.200`:
204−
205−```
206−> 4.200
207−4.200
208−> (mul 42 100)
209−4.200
210−```
211−
212−Just think of it as "4,200", written the German way with a dot.
213−
214−Why? Long decimals are unreadable. Human beings know this, so
215−we group them in threes. For some historical reason, programming
216−languages never copied this marvelous usability innovation.
217−
218−English notation for decimals is more common than German
219−notation. Unfortunately, dot is URL-safe and comma isn't, and
220−it's nice to have a regular syntax for atoms that's URL-safe.
221−
222−As for why Urbit deleted your zero: it parses your command line
223−as you type, and rejects any characters after the parser stops.
224−
225−## Let's make some cells
226−
227−There's not much mystery about cells. A cell has a head and a
228−tail, and puts brackets around them:
229−
230−```
231−> [42 420]
232−[42 420]
233−```
234−
235−`42` is the *head* and `420` is the *tail* of the cell. Cell
236−syntax nests to the right:
237−
238−```
239−> [4 [42 420]]
240−[4 42 420]
241−
242−> [4 42 420]
243−[4 42 420]
244−
245−> [[4 42] 420]
246−[[4 42] 420]
247−```
248−
249−If you look at these nouns as binary trees, you see
250−
251−```
252− [4 [42 420]] [[4 42] 420]
253− . .
254− / \ / \
255− 4 . . 420
256− / \ / \
257− 42 420 4 42
258−```
259−
260−Each number is an atom; each dot is a cell.
261−
262−## And we're done
263−
264−And we're done! Type `|exit` to exit:
265−
266−```
267−~palnul_nocser:dojo> |exit
268−%drum-exit
269−$
270−```
271−
272−## Questions and/or exercises
273−
274−And we're done with our very first Urbyte! Here are some questions to
275−think about. These exercises are never mandatory, but they may
276−be fun and/or interesting. Skip them if they're obvious.
277−
278−* What is the right way to represent common
279−data structures as nouns?
280−* A linked list?
281−* A string? A *signed* integer?
282−* A table or associative array?
283−
284−Just try to picture these structures in your head, or draw them on a piece of paper.
docs/urbyte/1.mddeleted−365
@@ -1,365 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 2
4−next: true
5−title: Atoms, auras, types
6−---
7−
8−# Urbyte 1: Atoms, auras, types
9−
10−Thanks for reading Urbyte 0! In Urbyte 1, we'll look a little
11−more deeply at atoms and other simple noun types.
12−
13−Let's restart our engines:
14−
15−```
16−$ urbit mycomet
17−[...]
18−ames: on localhost, UDP 31337.
19−http: live (insecure, public) on 8080
20−http: live ("secure", public) on 8443
21−http: live (insecure, loopback) on 12321
22−~palnul_nocser:dojo>
23−```
24−
25−## What's in an atom?
26−
27−It seems limiting to have only one kind of atom, the unsigned
28−decimal. How are signed integers represented? Symbols?
29−Floating-point values? Dates? IP addresses? Even just hex?
30−
31−Lisp's S-expression, with its own cells and atoms, is very
32−similar to Hoon's nouns. But languages in the Lisp family mark
33−each atom with a dynamic tag that defines the atom's meaning.
34−These tags are effectively dynamic types.
35−
36−Hoon also tracks the meaning of atoms. But Hoon is statically
37−typed, so an atom description is obviously a type. An atomic type
38−in Hoon is called an *aura*. The aura syntax is just an ASCII
39−string starting with `@`, like `@ud` for unsigned decimal.
40−
41−Hoon has a wide (but not extensible) variety of atom syntaxes.
42−Each syntax for an atom produces an appropriate predefined aura.
43−And Hoon's printer can invertibly print any aura Hoon can parse.
44−Because atoms make great path nodes and paths make great URLs,
45−all regular atom syntaxes use only URL-safe characters.
46−
47−## Examples
48−
49−With the dojo command `? expression`, you tell the dojo to print
50−both the product of the expression, and the product's type.
51−
52−Let's type in some aura examples:
53−
54−### Unsigned integers
55−
56−```
57−> 42
58−42
59−
60−> ? 42
61− @ud
62−42
63−
64−> ? 0x42
65− @ux
66−0x42
67−
68−> ? (add 0x42 42)
69− @
70−108
71−
72−> ? `@ud`0x42
73− @ud
74−66
75−
76−```
77−
78−So decimal is aura `@ud`, hexadecimal is `@ux`. The cast
79−syntax&mdash;`` `@ud` ``&mdash;lets us change the type of an
80−atom, converting hex `0x42` to a decimal `66`.
81−
82−An aura is soft type. The programmer can always insist on how
83−to interpret an atom. Hoon doesn't have "dependent types"; it
84−can't enforce any constraints the aura puts on the atom's value.
85−
86−### Signed integers
87−
88−```
89−> -7
90−-7
91−
92−> ? -7
93− @sd
94−
95−> --7
96−--7
97−
98−> ? --7
99− @sd
100−--7
101−
102−> ? (sum:si -7 --7)
103− @s
104−--0
105−
106−> `@ud`-7
107−13
108−
109−> `@ud`--7
110−14
111−```
112−
113−`--7` means "positive 7." `+7` might have been better, but `+`
114−is not URL-safe.
115−
116−Hoon needs `--` to distinguish positive signed numbers because
117−Hoon's type system doesn't feed back into its parser. The
118−expression itself needs to control whether it's `@sd` or `@ud`.
119−
120−With unlimited atom width, traditional sign extension makes no
121−sense. The sign bit is the low bit. Even atoms are positive,
122−odd atoms are negative.
123−
124−And Hoon has no overloading or type detection; we need to use a
125−different function to add signed integers. We'll always choose
126−slightly clunkier syntax in exchange for much simpler semantics.
127−
128−### Symbols
129−
130−```
131−> ? 'Ürbit'
132− @t
133−'Ürbit'
134−
135−> ? `@ux`'Ürbit'
136− @ux
137−0x7469.6272.9cc3
138−
139−> ? ~.urbit
140− @ta
141−~.urbit
142−
143−> ? `@ux`'foo'
144− @ux
145−0x6f.6f66
146−```
147−
148−The `@t` aura is UTF-8 text, with the first byte low. Again,
149−Hoon doesn't actually have the power to check statically that
150−your UTF-8 is valid. Auras don't tell you what an atom is, just
151−what you think it is.
152−
153−The familiar single-quote syntax for `@t` is an irregular form of
154−the more unusual `~~` prefix. The `~.` prefix, aura `@ta`, is
155−restricted to lowercase ASCII (a great common denominator). Of
156−course, `~` is URL-safe and `'` is not.
157−
158−### Dates, floats, IP addresses...
159−
160−```
161−> ? now
162− @da
163−~2016.7.11..01.32.04..2c0d
164−
165−> ? ~h6
166− @dr
167−~h6
168−
169−> `@ux`~h6
170− @ux
171−0x5460.0000.0000.0000.0000
172−
173−> ? (add ~h6 now)
174− @
175−170.141.184.502.236.089.414.812.327.632.537.911.296
176−
177−> `@da`(add ~h6 now)
178−~2016.7.11..07.32.28..842f
179−
180−> ? .3.14
181− @rs
182−.3.14
183−
184−> ? .127.0.0.1
185− @if
186−.127.0.0.1
187−```
188−
189−`@da` is a 128-bit absolute date (64 bits for fractions of a
190−second, 64 bits for seconds); `@dr` is a relative date; `@rs` is
191−a single-precision IEEE real; `@if` is an IPv4 address. This is
192−not all Hoon's aura syntax, just a good range of examples.
193−
194−`(add ~h6 now)` is a good example of the use and limits of
195−the aura system. Unlike the signed-integer sum, offsetting a
196−date can use plain atomic addition. But the product of `add` is
197−a flavorless atom with no aura, `@`. So we have to cast it back
198−to an absolute date `@da`.
199−
200−## Auras explained
201−
202−Does an aura represent the units of the atom, its syntax, its
203−semantics, its constraints?
204−
205−Any or all of the above. Programmers can even use their own aura
206−strings, which nothing in Hoon recognizes. The set of syntaxes
207−that Hoon knows how to parse and/or print is fixed. But there
208−are plenty of good reasons to use your own user-defined auras.
209−
210−If your program uses both fortnights and furlongs, Hoon will not
211−parse a user-defined fortnight syntax. It will not print furlongs
212−in the dojo. But the type system will keep you from accidentally
213−passing a furlong to a function that expects a fortnight.
214−
215−Hoon does interpret the aura string in one way: auras specialize
216−to the right. For example, `@u` is any unsigned integer; `@ux`
217−is an unsigned integer that likes to be printed as hex.
218−
219−Hoon's typechecker lets you go up or down the specialization
220−ladder. It complains if you try to move across. For example,
221−`@u` can silently convert into `@ux` or `@ux` into `@u`, but
222−turning `@ud` into `@ux`, `@ux` into `@da`, etc, requires an
223−explicit cast.
224−
225−## Constants, symbols, loobeans and null
226−
227−An atom type isn't just an aura. There's another choice: the
228−type can be *general* and contain all atoms (like the types we've
229−seen above), or *constant* and contain just one atom.
230−
231−A type describes a set of values. While auras may informally
232−describe a format for which not all atoms are valid, any atom can
233−be cast into the aura whether valid or invalid. But in a
234−constant, the type contains just one atom.
235−
236−The regular syntax for an atomic constant is just to put `%` in
237−front of the constant. Like:
238−
239−```
240−> ? 42
241− @ud
242−42
243−
244−> ? %42
245− $42
246−%42
247−
248−> ? %~h6
249− $~h6
250−%~h6
251−```
252−
253−The `$` on the type indicates the constant. Note that constants
254−still have auras; `~h6` (6 hours) is still a `@dr`.
255−
256−## Common irregulars
257−
258−There are a few special forms worth learning early: symbols,
259−null, loobeans, and of course ships:
260−
261−```
262−> ? %foo
263− $foo
264−%foo
265−
266−> `@ux`%foo
267−0x6f.6f66
268−
269−> .n
270−%.n
271−
272−> |
273−%.n
274−
275−> .y
276−%.y
277−
278−> &
279−%.y
280−
281−> `@ud`&
282−0
283−
284−> ~
285−~
286−
287−> `@ud`~
288−0
289−
290−> ? ~zod
291− @p
292−~zod
293−
294−> `@ux`~forseg-bolbyn
295−0x885e.8af9
296−```
297−
298−`%symbol` is a constant with aura `@tas` (text, ASCII, symbol).
299−The symbol rules, which are enforced by the Hoon parser but not
300−(as we've discussed) the type system: a symbol is lowercase with
301−infix hyphens ("kebab-case").
302−
303−Loobeans are not true and false, but yes (`%.y` or `&`) and no
304−(`%.n` or `|`). This is because *yes is zero and no is one*.
305−This makes sense at a certain mathematical level, though it
306−was probably a mistake from a practical perspective.
307−
308−`~` is Hoon's nil: constant `0`, aura `@n`.
309−
310−And of course, `@p` is the phonemic base used for ship names.
311−(It's useful for any kind of memorable number.)
312−
313−## Cells and types
314−
315−Naturally, all these atoms fit neatly into cells, and retain
316−their types within the cells.
317−
318−```
319−> ? [~h6 [.3.14 %foo] 0xdead.beef]
320− {@dr {@rs $foo} @ux}
321−[~h6 [.3.14 %foo] 0xdead.beef]
322−
323−> `*`[~h6 [.3.14 %foo] 0xdead.beef]
324−[398.449.671.992.126.314.905.600 [1.078.523.331 7.303.014] 3.735.928.559]
325−```
326−
327−Another fun trick is to cast any noun to the `*` type, ie,
328−generic noun. We then know nothing about the noun, so we print
329−all its atoms as decimals.
330−
331−## And we're done
332−
333−And we're done! Type `|exit` to exit:
334−
335−```
336−~palnul_nocser:dojo> |exit
337−%drum-exit
338−$
339−```
340−
341−## Questions and/or exercises
342−
343−As always, these questions are optional and only for fun.
344−
345−We didn't include anywhere near all Hoon's auras or syntaxes in
346−this lesson. It's just a set of examples.
347−
348−* Try using the dojo's magic error erasure to stumble around the
349−rest of Hoon's atom syntax. Any string that can't be extended
350−into a valid expression will be trimmed back, with a beep, until
351−it can. Return will beep if the expression is not complete.
352−This feedback is harmless and does not use an electric shock.
353−It enables stochastic reinforcement learning of Hoon syntax.
354−
355−* If `~h6` is six hours, how do you write forty-five minutes? Two
356−days, six hours and forty-five minutes?
357−
358−* What would you expect the syntax for double-precision float to
359−be? What about base64?
360−
361−* Does an absolute date have to include every zillisecond, or can
362−it be pruned to a day or a year?
363−
364−* If there's an IP syntax, what about bitcoin addresses? What
365−other auras do you think should be supported?
docs/urbyte/2.mddeleted−504
@@ -1,504 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 3
4−title: Subject-oriented programming
5−---
6−
7−# Urbyte 2: Subject-oriented programming
8−
9−Thanks for reading Urbytes 0 and 1! In Urbyte 2, we'll take
10−nouns for granted and have some real fun with them.
11−
12−Let's restart our engines:
13−
14−```
15−$ urbit mycomet
16−[...]
17−ames: on localhost, UDP 31337.
18−http: live (insecure, public) on 8080
19−http: live ("secure", public) on 8443
20−http: live (insecure, loopback) on 12321
21−~palnul_nocser:dojo>
22−```
23−
24−## Welcome to the dojo
25−
26−Wait, where are we?
27−
28−We're playing in the Urbit `:dojo`. The dojo is sort of like a
29−cross between a Lisp REPL and the Unix shell. (If you know the
30−Unix shell, the Urbit command line has the same history model and
31−Emacs editing commands.)
32−
33−The dojo has its own command language, which is a superset of
34−Hoon. Any Hoon expression is a command. But not all commands
35−are expressions.
36−
37−(The dojo is not the only command-line app on your Urbit. By
38−default there is one other, `:talk`. Since you're on a fakezod,
39−you can only talk to yourself. If you accidentally press `ctrl-x`,
40−it will put you into `:talk`; press `ctrl-x` again to switch back.)
41−
42−### Dojo variables
43−
44−Like the Unix shell, the dojo has command variables. Type
45−
46−```
47−> =a 42
48−```
49−
50−You've set the dojo variable `a` to the value `42`. The dojo
51−puts this binding in the Hoon subject for expressions to use.
52−So you can write:
53−
54−```
55−> a
56−42
57−
58−> [4 a]
59−[4 42]
60−
61−> ? [4 a]
62− {@ud @ud}
63−[4 42]
64−```
65−
66−To unbind `a`, just omit the value:
67−
68−```
69−> =a
70−```
71−
72−You removed `a` from the subject. (We can bind it again later, or
73−bind over it without removing it.)
74−
75−```
76−> [4 a]
77−-find.a
78−```
79−
80−Now trying to use `a` is an error.
81−
82−## Subject-oriented programming
83−
84−What is this *subject* thing, anyway? We put `a` in what?
85−
86−Most programming languages have something called a *scope* or an
87−*environment* or a *context*. This is a data structure that
88−contains the variables and functions an expression can use.
89−
90−In a normal language, the environment is not a first-class value.
91−You cannot save an environment in a variable, compute an
92−expression against the environment in the variable, etc, etc.
93−
94−In Hoon or any "subject-oriented" language, an expression is
95−executed against one normal value, the *subject*. In Hoon, of
96−course, the subject is a noun.
97−
98−## First experiments
99−
100−Up to now, we've only built constants. By definition, a constant
101−doesn't use the subject.
102−
103−It would be nice to start with the subject every dojo expression
104−gets. But that subject is pretty complex. Instead, let's make a
105−simple noun from the kinds of atoms we've already learned about:
106−
107−```
108−> =a [42 [%foo .6.28 ~m45] 0xdead.beef]
109−
110−> ? a
111− {@ud {$foo @rs @dr} @ux}
112−[42 [%foo .3.14 ~m45] 0xdead.beef]
113−
114−> 420:a
115−420
116−```
117−
118−The syntax `expression:expression` uses the product of the second
119−expression as the subject of the first. So we're using `a` as
120−the subject of the expression `420`.
121−
122−Of course, `420` is a constant expression. It doesn't care what
123−the subject is. But:
124−
125−```
126−> (add 2 2):a
127−-find.add
128−```
129−
130−We can't use `a` as the subject of even a simple addition. How
131−could we? There's no `add` function in our `a`. It sometimes
132−takes new Hoon programmers a little while before they realize
133−that there really isn't a scope or environment in Hoon.
134−
135−## Tree geometry
136−
137−So what can we do with this subject? How can we get data out of
138−it? Let's keep working with our little test subject `a`.
139−
140−The most basic way to access the subject is *tree geometry*.
141−Every noun is a binary tree; every noun in the tree has a number
142−which is its address. The root of the tree is `1`. If the
143−address of a cell is `n`, the address of its head is `2n` and the
144−address of its tail is `2n+1`.
145−
146−A picture might help:
147−```
148− 1
149− / \
150− 2 3
151− / \ / \
152− 4 5 6 7
153− / \
154− 14 15
155−```
156−
157−The syntax for a fragment of the subject at a tree address, or
158−*axis*, is just `+axis`. So:
159−
160−```
161−> +3:a
162−[[%foo .3.14 ~m45] 0xdead.beef]
163−
164−> ? +7:a
165− @ux
166−0xdead.beef
167−
168−> ? +13:a
169− {@rs @dr}
170−[.3.14 ~m45]
171−```
172−
173−The fragment retains the type it had when we built it.
174−
175−Another (equivalent) way to think of tree addressing involves
176−binary. As before, the root of the tree is at address `1`. For
177−the node of a tree at some address `b`, where `b` is binary,
178−you get the address of the head by concatenating a `0` to
179−the end of `b`; and to get the tail, concatenate a `1` at the
180−end. For example, the head of the node at binary address `111`
181−is at `1110`, and the tail is at `1111`.
182−
183−## Labeled surfaces
184−
185−We can obviously get anything we want out of the subject by tree
186−geometry. But that's not really how we'd like to program. We'd
187−much rather *label* subtrees with convenient, memorable symbols.
188−
189−For example, suppose our tree looked like:
190−
191−```
192− 1
193− / \
194− x=2 3
195− / \
196− y=6 z=7
197− / \
198− p=14 15
199− / \
200− q=30 r=31
201−```
202−
203−Then instead of writing `+2`, we could write `x`, and so on.
204−
205−Let's replace our test subject `a` with a new noun built around
206−this tree of *labeled surfaces*.
207−
208−```
209−> =a [x=42 y=[p=%foo q=.6.28 r=~m45] z=0xdead.beef]
210−
211−> ? x:a
212− @ud
213−42
214−
215−> ? y:a
216− {p/$foo q/@rs r/@dr}
217−[p=%foo q=.6.28 r=~m45]
218−
219−> ? q.y:a
220− @rs
221−.6.28
222−```
223−
224−Surfaces might remind you of attributes in an object. But again,
225−attributes in an object are a symbol table. There is no symbol
226−table here -- just a tree search.
227−
228−An expression like the label `x` or the axis `+2`, which
229−designates a fragment or feature of the subject, is called a
230−*limb*. A list of limbs connected with `.` is a *wing*.
231−
232−To remind you that you're not in Kansas anymore, the syntax for a
233−wing, like `q.y` above, means means "q inside y." In a classic
234−object-oriented system, of course, this would be written `y.q`,
235−that is, attribute `q` within object `y`. In Hoon, `q.y` means
236−"find limb `y`, then find limb `q` inside that."
237−
238−## Surfaces versus fragments
239−
240−Once again, Hoon has no symbol tables. When we put a surface
241−on a noun, the surface label is part of that noun's type. It's
242−not part of the cell or other structure that contains the noun.
243−This will take a little getting used to:
244−
245−```
246−> ? x:a
247− @ud
248−42
249−
250−> ? +2:a
251− x/@ud
252−x=42
253−
254−? x.+2:a
255− @ud
256−42
257−```
258−
259−When we take fragment 2 of the labeled subject, the *surface
260−comes with it*. `+2` is not `42` but rather `x=42`. We can
261−take the surface off with `x.+2`.
262−
263−## The search algorithm
264−
265−In resolving a label to a fragment axis, we search the subject
266−type in a depth-first traverse.
267−
268−If we find a surface that matches the limb, we succeed. If we
269−find a surface that doesn't match the limb, we fail. If we find
270−a cell, we search first head, then tail.
271−
272−## Skipping
273−
274−What if the same label appears twice in one noun? Let's modify
275−our subject slightly as a test case:
276−
277−```
278−> ? +7:a
279− z/@ux
280−z=0xdead.beef
281−
282−> =a a(+7 x=z:a)
283−
284−> ? a
285− {x/@ud y/{p/$foo q/@rs r/@dr} x/@ux}
286−[x=42 y=[p=%foo q=.6.28 r=~m45] x=0xdead.beef]
287−
288−> ? x:a
289− @ud
290−42
291−
292−> ? ^x:a
293− @ux
294−0xdead.beef
295−```
296−
297−We don't want to hide any part of the noun from an expression.
298−So the modified limb `^x` *skips* the first match with a surface
299−`x`, getting us to our `0xdead.beef`. This is a unary notation:
300−`^^x` would skip the first two matches.
301−
302−## Editing
303−
304−Above, we mutated our first noun with the flashy `a(+7 x=z:a)`.
305−
306−Of course we are not really "modifying" a noun. Hoon is a pure
307−language. We are making an edited copy. `a(+7 x=z:a)` means "a
308−copy of `a`, with limb `+7` replaced by the product of `x=z:a`."
309−
310−We can edit multiple (disjoint) wings in one expression:
311−
312−```
313−> ? a(+7 [%hello %world], q.y .3.14)
314− {x/@ud y/{p/$foo q/@rs r/@dr} $hello $world}
315−[x=42 y=[p=%foo q=.3.14 r=~m45] %hello %world]
316−```
317−
318−Notice that nothing stopped us from changing `+7` from
319−`x=0xdead.beef` to `[%hello %world]`. Since the mutated
320−copy is a different noun, it has a different type.
321−
322−(And remember that since `[x y z]` means `[x [y z]]`,
323−`[x y [%hello %world]]` means `[x y %hello %world]`.)
324−
325−## Cores and arms
326−
327−It should be reasonably clear how Hoon's system of fragments and
328−surfaces parallels variables, records or structures in a
329−classical language. But where is Hoon's equivalent of objects:
330−values which bind code to data?
331−
332−The Hoon equivalent of an object is a *core*. As usual in Hoon,
333−the resemblance is inexact. A core has a set of computed
334−attributes, or *arms*. Each arm is an expression whose subject
335−is the core. There is no argument, so an arm is not a method.
336−
337−Physically, a core is always a cell `[battery payload]`, where
338−the *payload* is any noun, and the *battery* is a tree of
339−formulas in Nock (Hoon's functional assembly language) that
340−implements the arms. (A battery is like a C++ vtable, sort of.)
341−
342−## The search algorithm
343−
344−As you'd expect with a computed attribute, there is only one
345−namespace and one search algorithm. We just extend the algorithm
346−described above. And an expression which uses a label can't know
347−whether the subject will resolve it to a surface fragment (a
348−*leg*) or to an arm.
349−
350−If we're searching a core and the label matches one of the core's
351−arms, we compute the arm against the core. If the label is not
352−found, we search into the payload of the core.
353−
354−## Some core examples
355−
356−When you type these examples, make sure you get the number of
357−spaces exactly right. Hoon syntax is not whitespace-sensitive
358−in general, except that "one space" is always a different token
359−from "two or more spaces."
360−
361−```
362−> ? x:a
363− @ud
364−42
365−
366−> ? => a x
367− @ud
368−42
369−
370−> =b => a |% ++ foo x ++ bar [q.y foo] --
371−```
372−
373−We're seeing some Hoon regular forms for the first time. `x:a`
374−turns out to be an irregular relative of the regular `=>`
375−(["tisgar"](../../hoon/rune/tis/gar)) form.
376−
377−We'll get more into syntax in a later Urbyte. If some of these
378−examples seem syntactically a little funky, this isn't usually
379−way we'd do them in "real life." We don't normally write cores
380−on a single command line. In a file this would be:
381−
382−```
383− => a
384− |%
385− ++ foo x
386− ++ bar [q.y foo]
387− --
388−```
389−
390−which is much more readable, at least once you get used to it.
391−Let's look at the core itself:
392−
393−```
394−> b
395−<2.spy {x/@ud y/{p/$foo q/@rs r/@dr} x/@ux}>
396−
397−> ? +2:b
398− *
399−[[0 6] [0 58] 9 4 0 1]
400−
401−> ? +3:b
402− {x/@ud y/{p/$foo q/@rs r/@dr} x/@ux}
403−[x=42 y=[p=%foo q=.6.28 r=~m45] x=0xdead.beef]
404−```
405−
406−When we print `b`, or any core, we see that typed noun printing
407−can't be an invertible function in Hoon.
408−
409−We actually can read the battery (with `+2:b` above), but it's
410−just Nock code, not typed data. `<2.spy>` tells us the battery
411−has two arms and hashes to the three-letter code `spy`.
412−
413−When printing a full core, we don't even print the payload data,
414−just its type. But our `+3:b` confirms the `[battery payload]`
415−structure of the core. Remember, `+2` is the head and `+3` is
416−the tail.
417−
418−Finally, let's use this thing:
419−
420−```
421−> ? foo:b
422− @ud
423−42
424−
425−> ? bar:b
426− {@rs @ud}
427−[.6.28 42]
428−
429−> ? x:b
430− @ud
431−42
432−```
433−
434−Seems legit.
435−
436−## The dojo subject
437−
438−Now that we've made a test subject which is a core, we can look
439−directly at the real dojo subject:
440−
441−```
442−> +1
443−[ [ [ a=[x=42 y=[p=%foo q=.6.28 r=~m45] x=0xdead.beef]
444− b=<2.spy {x/@ud y/{p/$foo q/@rs r/@dr} x/@ux}>
445− ]
446− now=~2016.7.18..08.05.15..0b5c
447− eny=0vl.hsfrh.tg642.g5o21.1n80b.0h141.0vuan.pm8o4.77ovg.96rk0.n26nn
448− our=~palnul-wolmev-bonfex-danred--tilwen-midlux-bolfus-nocser
449− ]
450− ~
451− <283.xzp 42.ajz 407.xtr 110.xht 1.ztu $151>
452−]
453−```
454−
455−We see a bunch of surfaces: our custom `a` and `b`; standard
456−surfaces for identity, date, and entropy; and a ginormous core
457−stack with *over eight hundred* total arms.
458−
459−To be exact, the syntax `<283.xzp 42.ajz 407.xtr 110.xht 1.ztu
460−$151>` denotes a stack of six cores, each of whose payload is
461−another core, until the innermost payload `%151` (the Hoon
462−version number). This stack is our standard library, from which
463−comes `add` and other fine functions. (We don't know how to
464−write a Hoon function yet, but we're getting way closer.)
465−
466−Let's clean up our subject, just to be hygienic:
467−
468−```
469−> =a
470−> =b
471−
472−> +1
473− now=~2016.7.18..08.10.42..36a0
474− eny=0vf.8j71j.hlqim.k340u.q0ual.v2cd8.cfa65.vkbte.e733g.ehihg.e8aog
475−[ [ our=~palnul-wolmev-bonfex-danred--tilwen-midlux-bolfus-nocser
476− ]
477− ~
478− <283.xzp 42.ajz 407.xtr 110.xht 1.ztu $151>
479−]
480−```
481−
482−Again, remember that `=a` is not Hoon syntax, but `:dojo` syntax.
483−How the dojo assembles this subject remains a mystery. But it's
484−not a particularly interesting mystery.
485−
486−## And we're done
487−
488−And we're done! Type `|exit` to exit:
489−
490−```
491−~palnul_nocser:dojo> |exit
492−%drum-exit
493−$
494−```
495−
496−## Questions and/or exercises
497−
498−As always, these questions are optional and only for fun.
499−
500−What's the best way to construct a core which acts as a function?
501−What do you do to call the function?
502−
503−Why don't any other languages use subject-oriented programming?
504−Which languages are most similar to it?
docs/using.mddeleted−12
@@ -1,12 +0,0 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 1
5−title: Using
6−---
7−
8−# Using
9−
10−These short guides will get you installed, setup, and will walk you through the basic features of Urbit.
11−
12−<list/>
docs/using/filesystem.mddeleted−248
@@ -1,248 +0,0 @@
1−---
2−navhome: /docs/
3−navuptwo: true
4−next: true
5−sort: 7
6−title: Filesystem (Clay)
7−---
8−
9−# Filesystem (Clay)
10−
11−<div class="row">
12−
13−<div class="col-md-8">
14−
15−Urbit has its own revision-controlled filesystem, Clay. Clay is a
16−typed, global, referentially transparent namespace. An easy way to think
17−about it is like typed `git` with continuous sync.
18−
19−The most common way to use Clay is to mount a Clay node in a Unix
20−directory. The Urbit process will watch this directory and automatically
21−record edits as changes, Dropbox style. The mounted directory is always
22−at the root of your pier directory.
23−
24−</div>
25−
26−</div>
27−
28−## Quickstart
29−
30−When developing it's a good idea to use a separate desk.
31−
32−Create a `%sandbox` desk based on the `%home` desk:
33−
34− |merge %sandbox ~your-urbit %home
35−
36−Most of the time we want to use Clay from Unix.
37−
38−Mount the entire contents of your `sandbox` desk to Unix:
39−
40− ~your-urbit:dojo> |mount /=sandbox=
41−
42−To explore the filesystem from inside Urbit `+ls` and `+cat` are useful:
43−
44− ~your-urbit:dojo> +ls /=sandbox=/web
45−
46−Let's see the contents of `/=sandbox=/web/md`:
47−
48− ~your-urbit:dojo> +cat /=sandbox=/web/md
49−
50−Sync from your friend `~some-ship`'s `%experiment` desk to your
51−`%sandbox` desk:
52−
53− |sync %sandbox ~some-ship %experiment
54−
55−## Manual
56−
57−<h3 class="first child">
58−Paths
59−</h3>
60−
61−A path in Clay is a list of URL-safe text, restricted to
62−`[a z]`,`[0 9]`, `.`, `-`, `_` and `~`. Formally this is a `(list knot)`
63−where each segment is a `@ta`.
64−
65−Paths can be expressed as either `/foo/bar/baz` or `[%foo %bar %baz]`.
66−The first three segments of an urbit path are `/plot/desk/case`, for
67−example `/~dozbud/home/1`.
68−
69−#### Relative paths
70−
71−Relative paths are expressed using `%` which is roughly equivalent to
72−Unix `.`. `%%` is `..` and `%%%` is what you would expect `...` to be.
73−There are no local relative paths. `foo/bar` must be written
74−`%/foo/bar`.
75−
76−#### Substitution
77−
78−If the default path is `/foo/bar/baz`, `/=/moo` means `/foo/moo`, and
79−`/=/moo/=/goo` means `/foo/moo/baz/goo`. Also, instead of `/=/=/zoo` or
80−`/=/=/=/voo`, write `/==zoo` or `/===voo`.
81−
82−Most commonly this is used to avoid having to know the current revision
83−number in the `dojo`. Instead of writing
84−`/~your-urbit/home/4/path/to/file` you can just write
85−`/=home=/path/to/file`.
86−
87−### Revision-control
88−
89−<h3 class="first child">
90−<code>|mount clay-path [unix-name]</code>
91−</h3>
92−
93−Mount the `clay-path` at the unix mount point `unix-name`.
94−
95−**Examples:**
96−
97− |mount %/web
98−
99−Mounts `%/web` to `/web` inside your pier directory.
100−
101− |mount %/gen generators
102−
103−Mounts `%/gen` to `/generators` inside your pier directory.
104−
105−### `|unmount [clay-path || unix-name]`
106−
107−Unmount the path or name from Unix.
108−
109−**Examples:**
110−
111− |unmount %/web
112−
113−Unmounts the path `%/web` from whatever name it was mounted as.
114−
115− |unmount %generators
116−
117−Unmounts the Unix path `/generators`.
118−
119−### `|merge desk beak[, =gem strategy]`
120−
121−Merges a `beak` into a `desk` using an optional merge `strategy`.
122−
123−A `beak` is a ship-desk-case triple, encoded as a
124−path(`/~dozbud/home/2`)
125−
126−**Examples:**
127−
128− |merge %home-work /=home=, =gem %fine
129−
130−Merge `/=home=` into `%home-work` using merge strategy `%fine`.
131−
132− |merge %examples ~wacbex-ribmex %examples
133−
134−Merge the `%examples` desk from `~waxbex-ribmex`
135−
136−### `|sync desk plot [plot-desk]`
137−
138−Subscribe to continuous updates from remote `plot` on local `desk`.
139−`plot-desk` can specify the remote `desk` name. When omitted it is
140−defaulted to being the same as `desk`. Non-comet urbits have
141−`|sync %home ~parent %kids` automatically set up (where `~parent` is the
142−planet that issued a moon, the star that issued a planet, or the galaxy
143−that issued a star).
144−
145−**Examples:**
146−
147− |sync %home-local ~dozbud %home
148−
149− |sync %home ~doznec
150−
151−### `|unsync desk plot [plot-desk]`
152−
153−Unsubscribe from updates from remote `plot` on local `desk` with
154−optional `plot-desk`. Arguments must match original `|sync` command.
155−
156−Example:
157−
158− |unsync %home-local ~dozbud %home
159−
160−### `|label desk name`
161−
162−Label the current version of `desk` `name`.
163−
164−Example:
165−
166− |label %home release
167−
168−### Merge strategies
169−
170−`%init` - Used if it's the first commit to a desk. Also can be used to
171−"reinitialize" a desk -- revision numbers keep going up, but the new
172−revision isn't necessarily a descendent of the previously-numbered
173−version, allowing merges to be rerun.
174−
175−`%this` - Keep what's in Bob's desk, but join the ancestry.
176−
177−`%that` - take what's in Alice's desk, but join the ancestry. This is
178−the reverse of `%this`. This is different from `%init` because the new
179−commit has both sides in its ancestry.
180−
181−`%fine` - "fast-forward" merge. This succeeds iff one head is in the
182−ancestry of the other.
183−
184−`%meet`, `%mate`, and `%meld` - find the most recent common ancestor to
185−use as our merge base.
186−
187−A `%meet` merge only succeeds if the changes from the merge base to
188−Alice's head (hereafter, "Alice's changes") are in different files than
189−Bob's changes. In this case, the parents are both Alice's and Bob's
190−heads, and the data is the merge base plus Alice's changed files plus
191−Bob's changed files.
192−
193−A `%mate` merge attempts to merge changes to the same file when both
194−Alice and Bob change it. If the merge is clean, we use it; otherwise, we
195−fail. A merge between different types of changes -- for example,
196−deleting a file vs changing it -- is always a conflict. If we succeed,
197−the parents are both Alice's and Bob's heads, and the data is the merge
198−base plus Alice's changed files plus Bob's changed files plus the merged
199−files.
200−
201−A `%meld` merge will succeed even if there are conflicts. If there are
202−conflicts in a file, then we use the merge base's version of that file,
203−and we produce a set of files with conflicts. The parents are both
204−Alice's and Bob's heads, and the data is the merge base plus Alice's
205−changed files plus Bob's changed files plus the successfully merged
206−files plus the merge base's version of the conflicting files.
207−
208−`%auto` - meta-strategy. Check to see if Bob's desk exists, and if it
209−doesn't we use an `%init` merge. Otherwise, we progressively try
210−`%fine`, `%meet`, and `%mate` until one succeeds. If none succeed, we
211−merge Bob's desk into a scratch desk. Then, we merge Alice's desk into
212−the scratch desk with the `%meld` option to force the merge. Finally, we
213−annotate any conflicts, if we know how.
214−
215−### Manipulation
216−
217−<h3 class="first child">
218−<code>|rm path</code>
219−</h3>
220−
221−Remove the data at `path`. `path` must be a path to actual node, not a
222−'directory'
223−
224−### `|cp to from`
225−
226−Copy the file at `from` into the path `to`.
227−
228−#### `|mv to from`
229−
230−Move the file at `from` into the path `to`.
231−
232−In Clay, `|mv` is just a shorthand for `|cp` then `|rm`. The `|rm`
233−doesn't happen unless the `|cp` succeeds.
234−
235−### Generators
236−
237−<h3 class="first child">
238−<code>+cat path [path ...]</code>
239−</h3>
240−
241−Similar to Unix `cat`. `+cat` takes one or more `path`s, and prints
242−their contents.
243−
244−### `+ls path`
245−
246−Similar to Unix `ls`. `+ls` takes a single `path`.
247−
248−Produces a list of names at the `path`.
docs/using/install.mddeleted−398
@@ -1,398 +0,0 @@
1−---
2−navhome: /docs/
3−navuptwo: true
4−next: true
5−sort: 1
6−title: Install
7−---
8−
9−# Install
10−
11−Installing Urbit is easy. It just takes a few minutes to get an
12−instance up and running on the network.
13−
14−Urbit is designed to run on any Unix box with an internet connection.
15−macOS, Ubuntu/Debian, FreeBSD, and Fedora all work well.
16−
17−If you run into trouble installing Urbit, please let us know via
18−email, [questions@urbit.org](mailto:questions@urbit.org), or on the
19−forum: [fora.urbit.org](https://fora.urbit.org). You can also chat
20−with us at [urbit.org/stream](https://urbit.org/stream).
21−
22−> Urbit is alpha software. It’s not yet completely stable, its crypto
23−> hasn’t been audited, and there are plenty of rough edges. Urbit is
24−> lots of fun to play with, but not quite ready for your important or
25−> sensitive data.
26−
27−## Build from source
28−
29−### Dependencies
30−
31−Urbit depends on:
32−
33−```
34−autoconf
35−automake
36−C compiler (gcc or clang)
37−cmake
38−curses
39−git
40−gmp
41−libcurl
42−libsigsegv
43−libtool
44−libuv
45−meson
46−ninja
47−openssl
48−pkg-config
49−python2
50−ragel
51−re2c
52−```
53−
54−### Instructions
55−
56−First, you'll install the required dependencies to build Urbit from source. Then, you'll clone the Urbit source code, hosted on Github. Next, you'll bootstrap the Git submodules needed for the build. Lastly, you'll run a [Meson](https://github.com/mesonbuild/meson) build on the Urbit source to create your Urbit binary for your host operating system. Then, finally, you'll be able to boot your urbit.
57−
58−For your host OS platform and relevant package installer, run the respective Bash shell commands listed below in a fresh terminal window to get Urbit installed:
59−
60−> For those new to the command line, see:
61−>
62−> - Mac: [Introduction to the Mac OS X Command Line](http://blog.teamtreehouse.com/introduction-to-the-mac-os-x-command-line)
63−> - Linux: [An Introduction to the Linux Terminal](https://www.digitalocean.com/community/tutorials/an-introduction-to-the-linux-terminal)
64−
65−#### macOS
66−
67−##### Homebrew
68−
69−> [Homebrew installation guide](https://treehouse.github.io/installation-guides/mac/homebrew)
70−
71−```
72−# Bash
73−
74−brew update
75−brew install autoconf automake cmake gcc git gmp libsigsegv libtool meson ninja pkg-config python2 openssl re2c
76−git clone https://github.com/urbit/urbit
77−cd urbit
78−./scripts/bootstrap
79−./scripts/build
80−sudo ninja -C ./build/ meson-install
81−urbit
82−```
83−
84−##### Macports
85−
86−```
87−# Bash
88−
89−sudo port selfupdate
90−sudo port install autoconf automake cmake gmp libsigsegv meson openssl
91−git clone https://github.com/urbit/urbit
92−cd urbit
93−./scripts/bootstrap
94−./scripts/build
95−sudo ninja -C ./build/ meson-install
96−urbit
97−```
98−
99−#### Linux
100−
101−##### Linuxbrew
102−
103−> [Linuxbrew](http://linuxbrew.sh/)
104−
105−```
106−# Bash
107−
108−brew update
109−brew install autoconf automake cmake gcc git gmp libsigsegv libtool meson ninja pkg-config python2 openssl re2c
110−git clone https://github.com/urbit/urbit
111−cd urbit
112−./scripts/bootstrap
113−./scripts/build
114−sudo env "PATH=$PATH" ninja -C ./build/ install
115−urbit
116−```
117−
118−N.B. if the step `./scripts/build` fails when attempting to
119−build libh2o, it could be caused by a bug in version 0.46 of meson (the bug
120−is not present in 0.45 and is fixed in 0.47).
121−
122−If the command `meson -v` returns a version starting with 0.46, try these steps:
123−
124−
125−```
126−brew uninstall meson
127−pip install meson=0.47.0
128−rm -rf build
129−build/scripts
130−```
131−
132−If that is successful, resume the above instructions after the `build` step.
133−
134−
135−
136−##### Ubuntu or Debian
137−
138−```
139−# Bash
140−
141−sudo apt-get update
142−sudo apt-get install autoconf automake cmake exuberant-ctags g++ git libcurl4-gnutls-dev libgmp3-dev libncurses5-dev libsigsegv-dev libssl-dev libtool make openssl pkg-config python python3 python3-pip ragel re2c zlib1g-dev
143−sudo -H pip3 install --upgrade pip
144−sudo -H pip3 install meson==0.29
145−
146−# we need ninja 1.5.1
147−# 'apt-get install ninja-build' gives us 0.1.3
148−# 'apt-get install ninja-build' gives us 1.3.4
149−#
150−git clone git://github.com/ninja-build/ninja.git
151−pushd ninja
152− git checkout release
153− ./configure.py --bootstrap
154− sudo cp ./ninja /usr/local/bin
155−popd
156−
157−
158−git clone https://github.com/urbit/urbit
159−cd urbit
160−./scripts/bootstrap
161−./scripts/build
162−sudo ninja -C ./build/ install
163−urbit
164−```
165−
166−
167−
168−(tested on Google Cloud Platform
169− * Ubuntu Trusty Linux (14.04 LTS)
170− * Ubuntu Xenial Linux (16.04 LTS)
171− * Debian 8 (Jessie)
172− * Debian 9 (Stretch)
173−on 6 July 2018)
174−
175−##### Fedora / Redhat
176−
177−```
178−# Bash
179−
180−sudo yum upgrade
181−sudo yum install autoconf automake cmake ctags gcc gcc-c++ git gmp-devel libcurl-devel libsigsegv-devel libtool ncurses-devel ninja-build openssl openssl-devel pkgconfig python2 python3 ragel re2c wget
182−
183−# meson requires python 3.5; RHEL supplies wrong version
184−pushd /usr/src
185− sudo wget https://www.python.org/ftp/python/3.5.5/Python-3.5.5.tgz
186− sudo tar xzf Python-3.5.5.tgz
187− cd Python-3.5.5
188− sudo ./configure --enable--optimizations
189− sudo make altinstall
190− which python3.5
191− cd /usr/local/bin
192− sudo ln -s python3.5 python3
193− hash python3
194−popd
195−
196−curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
197−sudo /usr/local/bin/python3 get-pip.py
198−# downgrade meson to avoid dependencies that redhat can't meet
199−sudo -H /usr/local/bin/pip3 install meson==0.29
200−
201−
202−git clone git://github.com/ninja-build/ninja.git && cd ninja
203−git checkout release
204−./configure.py --boostrap
205−sudo cp ./ninja /usr/local/bin
206−
207−git clone https://github.com/urbit/urbit
208−cd urbit
209−./scripts/bootstrap
210−./scripts/build
211−sudo /usr/local/bin/ninja -C ./build/ install
212−urbit
213−
214−```
215−
216−(tested on Google Cloud Platform
217− * Red Hat Enterprise Linux 6.1
218− * Red Hat Enterprise Linux 7.1
219−on 5 July 2018)
220−
221−
222−##### FreeBSD
223−
224−```
225−# Bash or Sh
226−
227−pkg upgrade
228−sudo pkg install autoconf automake cmake curl gcc git gmake gmp libsigsegv libtool python python3 ragel re2c ncurses openssl gmp
229−curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
230−sudo python3 get-pip.py
231−sudo -H pip install --upgrade pip
232−sudo -H pip install meson
233−sudo pkg install ninja
234−git clone https://github.com/urbit/urbit
235−cd urbit
236−sh ./scripts/bootstrap
237−sh ./scripts/build
238−sudo ninja -C ./build/ meson-install
239−urbit
240−```
241−
242−(tested on Google Cloud Platform
243− * FreeBSD 10.4
244− * FreeBSD 11.2
245−on 4 July 2018)
246−
247−##### Arch
248−
249−```
250−# Bash
251−
252−sudo pacman -Syu
253−sudo pacman -S autoconf automake cmake curl gcc git gmp libsigsegv libtool ncurses ninja openssl python ragel re2c
254−curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
255−sudo python3 get-pip.py
256−git clone https://github.com/urbit/urbit
257−cd urbit
258−./scripts/bootstrap
259−./scripts/build
260−sudo ninja -C ./build/ meson-install
261−urbit
262−```
263−
264−(tested on Amazon EC2 using Amazon Machine Image
265− * Release 2018.06.15 / ebs hvm x86_64 lts ( ami-a40a47db via https://www.uplinklabs.net/projects/arch-linux-on-ec2/ )
266−on 6 July 2018)
267−
268−
269−
270−##### AWS
271−
272−```
273−# Bash
274−
275−sudo yum update
276−sudo yum install autoconf automake cmake ctags gcc gcc-c++ git gmp-devel libcurl-devel libsigsegv-devel libtool ncurses-devel openssl openssl-devel pkgconfig python2 python3 python3-pip ragel re2c wget git
277−sudo env "PATH=$PATH" pip3 install --upgrade pip
278−sudo env "PATH=$PATH" pip3 install meson
279−
280−
281−# we need libsigsegv
282−#
283−
284−wget http://dl.fedoraproject.org/pub/fedora/linux/releases/25/Everything/x86_64/os/Packages/l/libsigsegv-2.10-10.fc24.x86_64.rpm
285−wget http://dl.fedoraproject.org/pub/fedora/linux/releases/25/Everything/x86_64/os/Packages/l/libsigsegv-devel-2.10-10.fc24.x86_64.rpm
286−sudo yum localinstall libsigsegv-2.10-10.fc24.x86_64.rpm
287−sudo yum localinstall libsigsegv-devel-2.10-10.fc24.x86_64.rpm
288−
289−# we need re2c
290−#
291−wget https://rpmfind.net/linux/dag/redhat/el6/en/x86_64/dag/RPMS/re2c-0.13.5-1.el6.rf.x86_64.rpm
292−sudo yum localinstall re2c-0.13.5-1.el6.rf.x86_64.rpm
293−
294−git clone git://github.com/ninja-build/ninja.git
295−pushd ninja
296− git checkout release
297− ./configure.py --bootstrap
298− sudo cp ./ninja /usr/local/bin
299−popd
300−
301−
302−git clone https://github.com/urbit/urbit
303−cd urbit
304−./scripts/bootstrap
305−./scripts/build
306−sudo env "PATH=$PATH" ninja -C ./build/ install
307−
308−urbit
309−```
310−
311−(tested on Amazon EC2 using Amazon Machine Image
312− * Amazon Linux 2 AMI (HVM), SSD Volume Type - ami-b70554c8
313−on 6 July 2018)
314−
315−
316−### Test for successful installation
317−
318−After running your installed `urbit` command, check to see if the following output was printed:
319−
320−```
321−$ urbit
322−Urbit: a personal server operating function
323−https://urbit.org
324−Version 0.5.1
325−
326−Usage: urbit [options...] ship_name
327−where ship_name is a @p phonetic representation of an urbit address
328−without the leading '~', and options is some subset of the following:
329−
330−-A dir Use dir for initial galaxy sync
331−-b Batch create
332−-B pill Bootstrap from this pill
333−-c pier Create a new urbit in pier/
334−-d Daemon mode
335−-D Recompute from events
336−-F Fake keys; also disables networking
337−-f Fuzz testing
338−-g Set GC flag
339−-H domain Set ames bootstrap domain (default urbit.org)
340−-I galaxy Start as ~galaxy
341−-k stage Start at Hoon kernel version stage
342−-l port Initial peer port
343−-M Memory madness
344−-n host Set unix hostname
345−-N Enable networking in fake mode (-F)
346−-p ames_port Set the HTTP port to bind to
347−-P Profiling
348−-q Quiet
349−-r host Initial peer address
350−-R Report urbit build info
351−-s Pill URL from arvo git hash
352−-t ticket Use ~ticket automatically
353−-u url URL from which to download pill
354−-v Verbose
355−-w name Immediately upgrade to ~name
356−-x Exit immediately
357−-Xwtf Skip last event
358−
359−Development Usage:
360− To create a development ship, use a fakezod:
361− urbit -FI zod -A /path/to/arvo/folder -B /path/to/pill -c zod
362−
363− For more information about developing on urbit, see:
364− https://github.com/urbit/urbit/blob/master/CONTRIBUTING.md
365−
366−Simple Usage:
367− urbit -c <mycomet> to create a comet (anonymous urbit)
368− urbit -w <myplanet> -t <myticket> if you have a ticket
369− urbit <myplanet or mycomet> to restart an existing urbit
370−```
371−
372−If so, then you're ready to boot your urbit. If not, check that you entered each Bash command correctly for your host OS platform. If you're still experiencing issues, feel free to drop into [Urbit chat](https://urbit.org/stream) for troubleshooting help.
373−
374−### Boot your urbit
375−
376−You've now installed the Urbit binary. If you're running Urbit on a normal modern PC or Mac, or
377−on a large cloud instance, move onto the next [setup](../setup/) section.
378−
379−If you're running Urbit in the cloud on a small instance, read
380−the below section, as you may need to additionally configure swap space, then continue.
381−
382−### (Set up swap)
383−
384−Urbit wants to map 2GB of memory when it boots up. We won’t necessarily
385−use all this memory, we just want to see it. On a normal modern PC or Mac,
386−or on a large cloud virtual machine, this is not an issue. On some small
387−cloud virtual machines (Amazon or Digital Ocean), the default memory
388−configuration is smaller than this, and you need to manually configure a
389−swapfile.
390−
391−Digital Ocean has a post on adding swap
392−[here](https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04).
393−For Amazon there’s a StackOverflow thread
394−[here](http://stackoverflow.com/questions/17173972/how-do-you-add-swap-to-an-ec2-instance).
395−
396−Don’t spend a lot of time tweaking these settings; the simplest
397−thing is fine.
398−
docs/using/layout.mddeleted−140
@@ -1,140 +0,0 @@
1−---
2−navhome: /docs/
3−navuptwo: true
4−next: true
5−sort: 4
6−title: Source layout
7−---
8−
9−# Arvo source
10−
11−When you boot an Urbit we transfer the current version of the Arvo
12−operating environment to your Urbit over our network. That is, the
13−source for the system lives on your Urbit. Here we'll take a brief tour
14−through the structure of a base Arvo desk.
15−
16−Looking at the top level of
17−[the Arvo repo](http://github.com/urbit/arvo), or any Urbit desk that
18−has been mounted to Unix we see something like:
19−
20−```
21−app/
22−arvo/
23−gen/
24−lib/
25−mar/
26−ren/
27−sec/
28−sur/
29−sys/
30−web/
31−web.md
32−```
33−
34−Let's step through directory by directory.
35−
36−## `sys/`
37−
38−This is where the Arvo kernel lives. `sys/` contains:
39−
40−### `sys/hoon.hoon`
41−
42−Hoon is our programming langauge. Since Hoon compiles itself the
43−language is actually specified in this source file.
44−
45−### `sys/zuse.hoon`
46−
47−Zuse is the Arvo standard library.
48−
49−### `sys/arvo/hoon`
50−
51−This is the source file for the central Arvo event dispatcher.
52−
53−### `sys/vane`
54−
55−Vanes are sort of like kernel modules. These are worth listing one by one:
56−
57−### `sys/vane/ames.hoon`
58−
59−Ames is our network protocol.
60−
61−### `sys/vane/behn.hoon`
62−
63−Behn is a simple timer.
64−
65−### `sys/vane/clay.hoon`
66−
67−Clay is our filesystem.
68−
69−### `sys/vane/dill.hoon`
70−
71−Dill is our terminal driver.
72−
73−### `sys/vane/eyre.hoon`
74−
75−Eyre is our webserver.
76−
77−### `sys/vane/ford.hoon`
78−
79−Ford is our build system.
80−
81−### `sys/vane/gall.hoon`
82−
83−Gall is our application model.
84−
85−### `sys/vane/jael.hoon`
86−
87−Jael is our secret vault.
88−
89−### `sys/vane/xmas.hoon`
90−
91−Xmas is the new Ames, which will go live in our next big release.
92−
93−That's it. That's the whole system.
94−
95−## `app/`
96−
97−This is where Gall apps live. Gall apps are stateful servers, sort of
98−like unix daemons. One familiar one is `app/hall.hoon` which is the
99−source code for Hall, the Urbit messaging transport layer. And there's
100−also `app/dojo.hoon` — that's your shell.
101−
102−## `gen/`
103−
104−`gen/` holds generators. Generators are short Dojo scripts.
105−
106−## `lib/`
107−
108−`lib/` holds shared libraries for programs. `lib/sole` is a good
109−example — that's the console library that's shared by both Dojo in the
110−command line, and the Dojo web client.
111−
112−## `mar/`
113−
114−This is where marks live. Marks are data type definitions used by Ford.
115−A mark is like a mime-type, but specified in executable code.
116−
117−## `ren/`
118−
119−These are web renderers. A renderer handles web requests of a particular
120−type.
121−
122−Default web requests in urbit are handled as a `.urb`, which is caught
123−by the `urb.hoon` renderer. This wraps the request in our default `CSS`
124−and `JS` and adds some routing magic for certain paths.
125−
126−## `sur/`
127−
128−`sur/` contains shared data structures. Files in `sur` are like header
129−files in C.
130−
131−## `web/`
132−
133−There are the files publicly accessible to the web, as made possible by
134−Eyre.
135−
136−## `web.md`
137−
138−This is the homepage for your urbit. You'll see it at
139−`http://localhost:8080/` or `https://your-urbit.urbit.org/`.
140−
docs/using/messaging.mddeleted−423
@@ -1,423 +0,0 @@
1−---
2−navhome: /docs/
3−navuptwo: true
4−next: true
5−sort: 5
6−title: Messaging (Talk and Hall)
7−---
8−
9−# Messaging (Talk and Hall)
10−
11−<div class="row">
12−
13−<div class="col-md-8">
14−
15−Talk is the built-in frontend for the Urbit messaging and notifications
16−protocol, Hall. Today we use Hall to chat and coordinate, but it's really
17−a general purpose piece of infrastructure.
18−
19−For the time being come join us in `/urbit-meta` by using the
20−<a href="#-quickstart">quickstart</a> below.
21−
22−Today, Hall is sort of like a distributed, encrypted Slack that can be
23−used from the CLI and the browser. There’s no central Hall server.
24−Any Urbit can host one.
25−
26−Hall is a general purpose tool for both aggregating and publishing
27−streams of messages. Applications can use Hall as their transport
28−protcol, API connectors can push disparate data sources into Hall,
29−and so on. There are lots of things a distributed message protocol can
30−be used for that we haven't even thought of.
31−
32−Here we'll be discussing how to operate the default CLI frontend, Talk,
33−to send and receive messages. For a more in-depth look at Hall's internals,
34−take a look at its [documentation](../../hall/architecture).
35−
36−</div>
37−
38−</div>
39−
40−## Quickstart
41−
42−For the most part we use Talk as a single-instance of Slack: one main
43−channel (`/urbit-meta`) and direct messages. Everyone is more than welcome
44−in `/urbit-meta`. It's the place to get help, ask questions and chat about
45−Urbit in general.
46−
47−Let's join `/urbit-meta`:
48−
49−Use `ctrl-x` to switch from Dojo to Talk.
50−
51−To join `/urbit-meta`:
52−
53− ~your-urbit:talk> ;join /urbit-meta
54−
55−You'll see something like:
56−
57− --------------| ;join /urbit-meta
58− --------------| :: onn /urbit-meta
59− --------------| bound '=' {[hos=~binzod nom=%urbit-meta]}
60− --------------| new = /urbit-meta
61− --------------| /urbit-meta: cap: For Urbit-related discussion. Politically
62− | correct and safe for work. Don't be rude!
63− --------------| /urbit-meta: fit: caps:n unic:n
64− ~your-urbit:talk=
65−
66−Post a line to `/urbit-meta`:
67−
68− ~your-urbit:talk= Hello, world!
69−
70−You'll see, echoed back at you:
71−
72− ~your-urbit= Hello, world!
73−
74−To send a direct message to someone, first set your audience:
75−
76− ~your-urbit:talk= ;~talsur-todres
77−
78−You'll see your prompt change:
79−
80− ~your-urbit:talk[~talsur-todres]
81−
82−Now you and `~talsur-todres` can exchange messages directly.
83−
84− ~your-urbit:talk[~talsur-todres] Hey buddy!
85−
86−To set your audience back to `/urbit-meta`:
87−
88− ~your-urbit:talk[~talsur-todres] ;/urbit-meta
89−
90−You'll see your prompt change back:
91−
92− ~your-urbit:talk=
93−
94−You can also use the ASCII "glyph" assigned to your `/urbit-meta` circle as a shortcut:
95−
96− ~your-urbit:talk[~talsur-todres] ;=
97− ~your-urbit:talk=
98−
99−(Your ship may have a different glyph than `=` for your circle)
100−
101−Use `;leave` to unsubscribe from a channel:
102−
103− ~your-urbit:talk= ;leave /urbit-meta
104−
105−There are two ways of using Talk: from the CLI or through a web UI
106−available at `http://your-urbit.urbit.org/~~/talk` (or
107−`http://localhost:8080/~~/talk`).
108−
109−The web UI ships as compiled JavaScript on your Urbit, but has its own
110−source repo [here](https://github.com/urbit/talk).
111−
112−Last, let's create a channel we can invite some friends to:
113−
114− ~your-urbit:talk= ;create channel %my-channel 'Some description.'
115−
116−Now you can tell your friends to `;join ~your-urbit/my-channel`.
117−
118−## Manual
119−
120−Hall's design is similar in spirit to
121−[NNTP](https://en.wikipedia.org/wiki/Network_News_Transfer_Protocol),
122−the underlying protocol for Usenet.
123−
124−Our design is pretty simple: Hall messages are called _posts_. Posts
125−go to _circles_. Any urbit can host or subscribe to any number of circles.
126−
127−There are four kinds of circles: a write-only `%mailbox` for direct
128−messages, an invite-only `%village` for private conversation, a read-only
129−`%journal` for curated content, and a public-access `%channel` for
130−general use.
131−
132−### Posts
133−
134−A post can be a variety of different data structures. Let's look at the
135−ones you can use from within Talk: lines, URLs, Hoon and
136−replies.
137−
138−#### Lines
139−
140−A line is simply a string of text. Depending on the filtering rules set
141−by the circle's host, these may or may not include uppercase and Unicode
142−characters.
143−
144−If the line starts with `@`, it's an action (IRC `/me`).
145−
146− ~your-urbit:talk= @sends a message.
147−
148−will print as
149−
150− ~your-urbit sends a message.
151−
152−#### URLs
153−
154−A URL is any valid URL.
155−
156− ~your-urbit:talk= https://example.com/
157−
158−### Hoon
159−
160−You can use Talk to evaluate Hoon code and share the result with everyone in a
161−Hall circle. To do so, preface your Hoon with `#`.
162−
163− ~your-urbit:talk= #(add 2 2)
164−
165−will print as
166−
167− ~your-urbit# (add 2 2)
168− 4
169−
170−### Replies
171−
172−To indicate what you're saying is in direct response to a specific
173−message, select the message (see Activating Lines below) and type your
174−response.
175−
176− ~some-urbit= Hello! How are you?
177− ~your-urbit:talk= ; Good, thanks!
178−
179−will print as
180−
181− ~your-urbit=^ Good, thanks!
182−
183−### Activating Lines
184−
185−A line number identifying the *subsequent* line is displayed every 5
186−lines.
187−
188− ---------[0]
189− ~your-urbit= This is my message.
190− ~your-urbit= This is another message.
191− ~your-urbit sends a message.
192− ~your-urbit/ http://example.com/
193− ~your-urbit# (add 2 2)
194− 4
195− ---------[5]
196− ~your-urbit=^ That's my message!
197−
198−You can use a line number to *activate* a line:
199−
200− ~your-urbit:talk= ;5
201−
202−which prints the number, line identifier, timestamp, sender, audience,
203−and contents:
204−
205− ? 0
206− 0v3.hl51p.jhege.amhec.vb37r.3rejr at ~2016.6.24..04.48.21..a235
207− ~your-urbit to ~another-urbit
208− in reply to: ~your-urbit:
209− > This is my message.
210− That's my message!
211−
212−If information got truncated — like happens for long URLs or expressions —
213−or if there's additional information available — as is the case with
214−replies and attachments — activating the message will show you all the
215−details.
216−
217−You can activate the most recent line with `;`, the second-most recent
218−with `;;`, and so on.
219−
220−### Creating and managing circles
221−
222−###### `;create [type] %name 'description'`
223−Creates and joins a circle, where `[type]` is any of the following:
224−- `channel`: public circle. Has a blacklist for write control.
225−- `village`: invite-only circle.
226−- `journal`: publicly readable, invite-only for writing.
227−- `mailbox`: publicly writeable, can only be read by its host.
228−
229−###### `;delete %name 'optional reason'`
230−Deletes a circle. If a reason is specified, that gets sent to all
231−subscribers before the circle gets deleted.
232−
233−###### `;depict %name 'description'`
234−Changes the description of circle `%name`.
235−
236−###### `;filter %name [capitals] [unicode]`
237−Configures the message filter for circle `%name`: whether to allow
238−capital and/or unicode characters. `y`/`&`/`true` for allowed,
239−`n`/`|`/`false` for disallowed.
240−
241−###### `;invite %name ~someone`
242−Invite someone into your circle `%name`. If they were previously banished,
243−removes them from the blacklist.
244−Can also invite multiple ships at once, `~comma, ~separated`.
245−
246−###### `;banish %name ~someone`
247−Banish someone from your circle `%name`. If they were previously invited,
248−removes them from the whitelist.
249−Can also banish multiple ships at once, `~comma, ~separated`.
250−
251−###### `;source %name ~other/circle`
252−Adds `~other/circle` as a source for circle `%name`. This causes all
253−messages sent to `~other/circle` to also appear in `%name`.
254−
255−###### `;unsource %name ~other/circle`
256−Removes `~other/circle` as a source for circle `%name`.
257−
258−### Membership
259−
260−If you have joined a circle, you can make this information publicly
261−available to help others find that circle as well.
262−
263−###### `;show ~some/circle`
264−Adds a circle to your public membership list.
265−
266−###### `;hide ~some/circle`
267−Removes a circle from your public membership list.
268−
269−### Status
270−
271−You'll see status notifications when people enter or leave stations
272−
273−###### `;set quiet`
274−Turn off status (and config) notifications.
275−
276−###### `;unset quiet`
277−Turn on status (and config) notifications.
278−
279−###### `;who`
280−List everyone in all your subscribed circles. Optionally specify a
281−specific circle to list members of just those.
282−
283−You'll see presence notifications when people enter or leave stations
284−you're subscribed to.
285−
286−###### `;attend ~some/circle [presence]`
287−Manually set your presence to show up as one of the following. (In the
288−future, a sufficiently advanced client can automatically set these for
289−you.)
290−
291−- `talk` - typing
292−- `hear` - listening
293−- `idle` - inactive
294−- `gone` - not present
295−
296−###### `;name ~some/circle 'my handle'`
297−Set a handle ("name") for yourself in a specific circle. It will display
298−to users who have done `;set nicks`, but gets truncated if it's longer
299−than 14 characters.
300−
301−### Audience
302−
303−An audience consists of one or more messaging targets. These can be
304−circles or ships. (In the latter case, it's secretly the `~ship/inbox`
305−circle.)
306−### Circle glyphs
307−
308−Glyphs are assigned by circle hash out of the following list
309−
310− > = + - } ) , . " ' ^ $ % & @
311−
312−Alphanumeric characters and `|#;:*~_` are reserved; all others (the
313−above list, and `\/!?({<`) can be manually assigned.
314−
315−###### `;bind + /urbit-test`
316−Assigns the `+` glyph to `/urbit-test`.
317−
318−###### `;unbind + /urbit-test`
319−Unassigns the `+` glyph from `/urbit-test`.
320−
321−To see what circle is bound to a glyph:
322−
323− ;what +
324− /urbit-test
325−
326−### Prefixes
327−
328−Received posts are prefixed with a glyph to let you know what the
329−audience is. You can activate an individual post to see the full
330−audience.
331−
332−There are a few special-purpose glyphs:
333−
334−- `|` - Informational messages
335−- `:` - Posts directly to you
336−- `;` - Posts to you and others (a multiparty conversation)
337−- `*` - Posts to a complex audience that doesn't directly include you.
338−
339−#### Prompt
340−
341−The audience you're sending to is always shown in your prompt. If
342−there's a glyph for it, it's shown as the glyph.
343−
344−Here we're talking to the station bound to `=`:
345−
346− ~your-urbit:talk=
347−
348−Here we're talking directly to `~dannum-mitryl`:
349−
350− ~your-urbit:talk[~dannum-mitryl]
351−
352−#### Configuration
353−
354−###### `;~urbit/circle`
355−Set audience to `~urbit/circle`.
356−
357−###### `;=`
358−Set audience to the station bound to the `=` glyph
359−
360−###### `;~dannum-mitryl`
361−Set audience to `~dannum-mitryl` (a direct post).
362−
363−###### `;%circle`
364−Set audience to a circle on your own ship
365−
366−###### `;~dannum-mitryl this is a private message`
367−Set the audience and send a post in the same line. This works for all of the above.
368−
369−Your audience is configured with regard to the following rules (in order):
370−
371−- if you manually set the audience, that audience.
372−- if you activated a post, the post you activated.
373−- audience of the last post sent.
374−
375−### Local nicknames
376−
377−###### `;nick`
378−List all local nicknames.
379−
380−###### `;nick ~some-urbit`
381−Look up a nickname.
382−
383−###### `;nick plato`
384−Search in reverse.
385−
386−###### `;nick ~some-urbit plato`
387−Create a nickname.
388−
389−###### `;nick ~some-urbit ~`
390−Clear an assigned nickname.
391−
392−###### `;set nicks`
393−Show nicknames instead of urbit names. If no local nickname is set, uses
394−that user's handle. If the user has no handle, just the urbit name.
395−
396−###### `;unset nicks`
397−Show urbit names instead of nicknames.
398−
399−Nicknames and handles longer than 14 character will be truncated in
400−output. Nicknames are strictly local - like the names on entries in a
401−phonebook.
402−
403−### Miscellaneous configuration
404−
405−###### `;set showtime`
406−Show the timestamp for each message.
407−
408−###### `;unset showtime`
409−Stop showing the timestamp for each message.
410−
411−###### `;set timezone [+/-][hours]`
412−Adjust the display of the timestamps to a specific timezone. Relative to UTC.
413−
414−###### `;set notify`
415−Emit a terminal bell sound if your six-syllable ship name is mentioned in
416−a message.
417−
418−###### `;unset notify`
419−Do not notify when your ship name is mentioned.
420−
421−###### `;set width [number]`
422−Set the rendering width of `:talk` to a specific number of characters.
423−(Minimum of 30.)
docs/using/setup.mddeleted−228
@@ -1,228 +0,0 @@
1−---
2−navhome: /docs/
3−navuptwo: true
4−next: true
5−sort: 2
6−title: Setup
7−---
8−
9−# Getting started
10−
11−On disk your urbit is an append-only log and a checkpoint. Or, in
12−simpler terms, a directory where we keep your urbit’s state. We call
13−this a _pier_.
14−
15−## Initialize
16−
17−To create an urbit, we need an identity. This identity is both a network
18−address and a memorable name.
19−
20−You are probably creating one of two kinds of urbit: a 32-bit _planet_
21−or a 128-bit _comet_. For a quick terminology guide and high-level
22−refresher, refer to this [handy reference sheet](../../about/glossary/).
23−
24−If you have an Urbit invitation, you'll have a planet like
25−`~sampel-palnet` and `~sampel-sompel-simpel-sampel`. To create your
26−pier:
27−
28−```
29−$ urbit -w sampel-palnet -t sampel-sompel-simpel-sampel
30−```
31−
32−This will create a directory `sampel-palnet/` and begin building your
33−urbit. This may take a few minutes.
34−
35−> If you are booting a star, the process is the same as above, with your
36−> respective star name and ticket.
37−>
38−> If you are booting a galaxy, see
39−> [this Fora post](https://urbit.org/fora/posts/~2016.8.17..21.04.11..1450~/).
40−
41−If you do not have a ticket, you can still make a _comet_, a wild urbit
42−drifting through cyberspace. Pick your own directory name, it doesn't
43−matter:
44−
45−```
46−$ urbit -c mycomet
47−```
48−
49−This will create the directory `mycomet/` and generate a 128-bit
50−identity for your urbit.
51−
52−## Orientation
53−
54−After about five to ten minutes, when your urbit is finished booting,
55−you should see a `dojo>` prompt. Welcome!
56−
57−By default your urbit is quite bare-bones. Let's stroll through what's
58−already running:
59−
60−### Shell — Dojo
61−
62−The command prompt in front of you is a simple shell and Hoon REPL.
63−Let's make sure it works:
64−
65−```
66−~your-urbit:dojo> (add 2 2)
67−```
68−
69−Should produce:
70−
71−```
72−> (add 2 2)
73−4
74−```
75−
76−Good.
77−
78−
79−### Messaging — Talk
80−
81−Use `ctrl-x` to change your prompt. Let's join the main Urbit chat
82−channel, `/urbit-meta`:
83−
84−```
85−~your-urbit:talk[] ;join /urbit-meta
86−```
87−
88−Talk is stateful, so your urbit will download a backlog.
89−`/urbit-meta` is the place to ask questions, get help, talk about
90−anything Urbit-related, and meet everyone on here.
91−
92−### Web — Tree
93−
94−Your Urbit is also accessible through its own web interface. If you're
95−running Urbit locally on your own machine, try opening:
96−
97−```
98−http://localhost:8080/~~/
99−```
100−
101−in your favorite browser.
102−
103−Or if you're running your urbit on a cloud instance with a static IP
104−address (which we recommend!), something like `212.131.240.20`, assuming
105−you've opened up the HTTP/HTTPS ports that Urbit uses (`8080` and `8443`
106−by default), try opening:
107−
108−
109−```
110−http://212.131.240.20:8080/~~/
111−```
112−
113−This way, if you keep your urbit running securely in the cloud (usually
114−in a [`screen`](https://www.gnu.org/software/screen/) or
115−[`tmux`](https://github.com/tmux/tmux/wiki) session), you can always
116−access your urbit's web interface in any browser on any device, so long
117−as you have your password on hand.
118−
119−The `/~~/` in the URL will redirect you to a login page, which was
120−generated by Tree, the basic Urbit web interface. The page will tell
121−you to run the `+code` generator (an Urbit functional shell script) in
122−your Dojo to get your password. Copy and paste that into your password
123−input box and hit Enter. After loading, you'll find yourself redirected
124−to your home page, authenticated, where you can then use the navigation
125−bar at the top of the page to visit your Talk web interface and static
126−files.
127−
128−You can also access your urbit through
129−`https://your-urbit.urbit.org/~~/`. Note that this latter approach is
130−slower for the time being because we proxy over the Urbit network, Ames,
131−but a better, faster solution for this is in the works.
132−
133−### Filesystem — Clay
134−
135−Clay, the Urbit filesystem, isn't mounted to Unix by default. Switch
136−to the Dojo prompt and run:
137−
138−```
139−~your-urbit:dojo> |mount %
140−```
141−
142−This should produce:
143−
144−```
145−> |mount %
146−>=
147−```
148−
149−which indicates the command was processed.
150−
151−`|mount %` will cause a `home/` directory to appear inside your pier
152−folder. Changes to these files are automatically synced into your urbit.
153−
154−<br />
155−
156−Here are a few other things you can do to get up and running:
157−
158−### Discussion — Fora
159−
160−Fora is the place for long-form Urbit discussion. It's hosted on an
161−Urbit and served over HTTP via Eyre, Urbit's web server.
162−
163−Head on over to:
164−
165−```
166−https://fora.urbit.org/~~/
167−```
168−
169−Like on your own web interface, you'll be redirected to a login page and
170−prompted to run `+code` in your Dojo to retrive your password and log
171−in.
172−
173−After loading, you'll get redirected to the Fora home page where you
174−can post and comment authenticated as your ship name. Like Talk, Fora
175−is a great place to ask questions, get help, chat about anything Urbit, and
176−see what's going on.
177−
178−### Docs
179−
180−We host our docs on `urbit.org`, but it's faster to view them locally
181−through your own ship's web interface. So we also host the docs on a
182−Clay desk on one of our `urbit.org` planets, which you can merge and
183−sync onto your live ship over the network.
184−
185−Run in your Dojo:
186−
187−```
188−~your-urbit:dojo> |sync %home ~ladnub-lorwyn %docs
189−```
190−
191−Depending on network traffic, this initial merge and sync could take
192−anywhere between thirty seconds to a few minutes.
193−
194−Upon a successful sync you'll see the output:
195−
196−```
197−sync succeeded from %docs on ~ladnub-lorwyn to %home
198−```
199−
200−If for some reason that doesn't work, head to the
201−[urbit/docs](https://github.com/urbit/docs) repo and follow the local
202−install steps.
203−
204−Otherwise, your docs are now live, and you can view them at:
205−
206−```
207−http://localhost:8080/~~/docs
208−```
209−
210−We'll update our planet's desk with new doc changes as they happen. You
211−should get sync updates automatically through Clay over Ames.
212−
213−### Examples
214−
215−Similarly, we host some Urbit examples on our same `urbit.org` planet as
216−above. Head to our [examples repo](https://github.com/urbit/examples) for
217−full instructions if you're interested, though you may want to start
218−with the [Urbyte](../../urbyte/), [Nock](../../nock/),
219−[Hoon](../../hoon/) or [Arvo](../../arvo/) sections so you can really
220−understand the example code.
221−
222−## Learn more
223−
224−If you're eager to get started programming you're ready to head over to
225−[the Hoon section](../../hoon/mission/).
226−
227−To learn more about using the system, let's keep going:
228−
docs/using/shell.mddeleted−312
@@ -1,312 +0,0 @@
1−---
2−navhome: /docs/
3−navuptwo: true
4−next: true
5−sort: 6
6−title: Shell (Dojo)
7−---
8−
9−# Shell (Dojo)
10−
11−<div class="row">
12−
13−<div class="col-md-8">
14−
15−The Dojo is the place to quickly experiment with Urbit. On the
16−surface the Dojo is just a Hoon REPL. On the inside, the Dojo is a
17−system for operating on and transforming data in Urbit.
18−
19−</div>
20−
21−</div>
22−
23−## Quickstart
24−
25−Evaluate a hoon expression (whitespace matters):
26−
27− ~your-urbit:dojo> (add 2 2)
28− ~your-urbit:dojo> %+ add 2 2
29−
30−Tall form Hoon may require multiple lines:
31−
32− ~your-urbit:dojo> %+ add
33− ~your-urbit:dojo< 2
34− ~your-urbit:dojo< 2
35−
36−Use `=var` to save a shell variable:
37−
38− ~your-urbit:dojo> =foo (add 2 2)
39−
40−Use `=dir` to set the current working directory:
41−
42− ~your-urbit:dojo> =dir %/web
43−
44−(`%` represents your current directory. For a complete explanation on urbit paths, see the [filesystem section](/docs/using/filesystem))
45−
46−Generators (files in `/gen`) are run with `+`:
47−
48− ~your-urbit:dojo> +hello 'world'
49−
50−Save output to a file in `%clay` with `*`:
51−
52− ~your-urbit:dojo> *some/file/path/hoon 'hello world'
53−
54−Run system commands from `:hood`, like `reload`, using `|`:
55−
56− ~your-urbit:dojo> |reload %eyre
57−
58−### Generators
59−
60−**`+cat`** - Similar to Unix `cat`. Accepts a path.
61−
62− ~your-urbit:dojo> +cat /~talsur-todres/home/gen/curl/hoon
63−
64−
65−**`+curl`** - Similar to Unix `curl`. Accepts a `tape`.
66−
67− ~your-urbit:dojo> +curl "http://nyt.com"
68−
69−**`+hello`** - Just prints the argument. Accepts a `@ta`.
70−
71− ~your-urbit:dojo> +hello 'mars'
72−
73−**`+ls`** - Similar to Unix `ls`. Accepts a path.
74−
75− ~your-urbit:dojo> +ls %/web
76− ~your-urbit:dojo> +ls /~talsur-todres/home/2/web/notes
77−
78−**`+moon`** - Generate a random moon from a planet. No arguments.
79−
80− ~your-urbit:dojo> +moon
81−
82−**`+solid`** - Compile the current state of the kernel and output a
83−noun. Usually downloaded to a file in unix. No arguments.
84−
85− ~your-urbit:dojo> .urbit/pill +solid
86−
87−**`+ticket`** - Generate a ticket for an Urbit plot. Takes an Urbit name
88−(`@p`).
89−
90− ~your-urbit:dojo> +ticket ~talsur-todres-your-urbit
91−
92−**`+tree`** - Generate a recursive directory listing. Takes a path.
93−
94− ~your-urbit:dojo> +tree %/web
95−
96−### Hood
97−
98−The hood is the system daemon. See `gen/hood` and `app/hood`.
99−
100−**`|hi`** - Sends a direct message. Sort of like Unix `write`. Accepts
101−an urbit name (`@p`) and a string (`tape`, which is text wrapped with double-quotes).
102−
103− ~your-urbit:dojo> |hi ~binzod "you there?"
104−
105−**`|link`** / **`|unlink`** - Link / unlink a remote app. Accepts an
106−Urbit name and an app name.
107−
108− ~your-urbit:dojo> |link ~talsur-todres %octo
109−
110−**`|mass`** - Prints the current memory usage of all the kernel modules.
111−No arguments.
112−
113− ~your-urbit:dojo> |mass
114−
115−**`|reload`** - Reloads a kernel module (vane) from source. Accepts any
116−number of vane names.
117−
118− ~your-urbit:dojo> |reload %clay %eyre
119−
120−**`|reset`** - Reloads `hoon.hoon` and all modules. No arguments.
121−
122− ~your-urbit:dojo> |reset
123−
124−**`|start`** - Starts an app. Accepts an app name.
125−
126− ~your-urbit:dojo> |start %curl
127−
128−## Manual
129−
130−<h3 class="first child">
131−Sources and sinks
132−</h3>
133−
134−A dojo command is either a source or a sink. A source is just something
135−that can be printed to your console or the result of some computation. A
136−sink is an *effect*: a change to the filesystem, a network message, a
137−change to your environment, or typed message to an app.
138−
139−Sources can be chained together, but we can only produce one effect per
140−command.
141−
142−### Sinks
143−
144−#### `=` - Set variable
145−
146−Set any envronment variable:
147−
148− ~your-urbit:dojo> =foo 42
149− ~your-urbit:dojo> (add 2 foo)
150−
151− 44
152−
153−(There are a few special variables that the dojo maintains. See below.)
154−
155−#### `:` - Send to app
156−
157−`:app` goes to a local `app`, `:~ship/app` goes to the `app` on `~ship`.
158−
159−Send a `helm-hi` message to `hood`:
160−
161− ~your-urbit:dojo> :hood &helm-hi 'hi'
162−
163−App usually expect marked data, so `&` is often used here.
164−
165−#### `*` - Save in `%clay`
166−
167−Save a new `md` file in `web`:
168−
169− ~your-urbit:dojo> *%/web/foo/md '# hello'
170−
171−The last component of the path is expected to be the mark (or mime
172−type).
173−
174−#### `.` - Export to Unix
175−
176−Export a noun to Unix with `.`:
177−
178− ~your-urbit:dojo> .foo/bar/baz (add 2 2)
179−
180−Which creates a file at `pier/.urb/put/foo/bar.baz`.
181−
182−This is very often used with `+solid`:
183−
184− ~your-urbit:dojo> .urbit/pill +solid
185−
186−Which outputs a new `urbit.pill` to `pier/.urb/put/urbit.pill`
187−
188−### Sources
189−
190−#### `&` - Mark conversion
191−
192−Convert between marks using `&`:
193−
194− ~your-urbit:dojo> &html &md '# hello'
195− :: produces
196− '<html><head></head><body><div><h1 id="-hello">hello</h1></div></body></html>'
197−
198−#### `_` - Run a function
199−
200−Use `_` to run a gate (or function):
201−
202− :: assign an arbitrary function and pass data to it
203− ~your-urbit:dojo> _|=({a/@} (mul a 3)) 3
204− :: produces
205− 9
206− :: use a function to get the status code from an http request
207− ~your-urbit:dojo> _|=({p/@ud q/* r/*} p) +http://google.com
208− :: produces
209− 301
210−
211−#### `+` `-` - HTTP requests
212−
213−`+http[s]://example.com` - sends a GET request
214−
215−`+http[s]://example.com &json [%s 'hi']` - sends a POST request with the
216−JSON `"hi"` in the body.
217−
218−`-http[s]://example.com &json [%s 'hi']` - sends a PUT request with the
219−JSON `"hi"` in the body.
220−
221−Note that the first of these is a source while the last two are sinks.
222−
223−#### `+` - Generators
224−
225−Generators are simple hoon scripts loaded from the filesystem. They live
226−in `gen/`.
227−
228−Create a random moon (from any planet):
229−
230− ~your-urbit:dojo> +moon
231− :: produces
232− "moon: ~docsun-tamtem-your-urbit; ticket: ~bartug-hodbyr-fognum-ralmud"
233−
234−### Variables
235−
236−You can use `=` to set an environment variable in Dojo, but there are
237−a few reserved names that have special uses.
238−
239−#### `dir`
240−
241−Current working `%clay` desk and revision. Read / write.
242−
243−**Examples:**
244−
245− ~your-urbit:dojo> =dir %/web
246− ~your-urbit:dojo> +ls %
247−
248− 404/hoon docs/ dojo/hoon lib/ listen/hoon md static/md talk/ tree/main/
249−
250−#### `lib`
251−
252−Current set of libraries (`/lib`) in your environment. Can also be set
253−with `/+`. Read / write.
254−
255−**Examples:**
256−
257− ~your-urbit:dojo> =lib ~[[%react ~]]
258− ~your-urbit:dojo> :: this also works:
259− ~your-urbit:dojo> /+ react
260− ~your-urbit:dojo> :: now we can use arms from lib/react.hoon
261− ~your-urbit:dojo> (react-vale:react %div)
262−
263−#### `sur`
264−
265−Current set of structures (`/sur`) in your environment. Can also be set
266−with `/-`. Read / write.
267−
268−**Examples:**
269−
270− ~your-urbit:dojo> =sur ~[[%sole ~]]
271− ~your-urbit:dojo> :: this also works:
272− ~your-urbit:dojo> /- sole
273− ~your-urbit:dojo> :: now we can use arms in sur/sole.hoon
274− ~your-urbit:dojo> `sole-effect:sole`[%bel ~]
275−
276−#### `now`
277−
278−The current (128-bit `@da`) time. Read-only.
279−
280−**Example:**
281−
282− ~your-urbit:dojo> now
283− :: produces
284− ~2016.3.21..21.10.57..429a
285−
286−#### `our`
287−
288−The current urbit plot. Read-only.
289−
290−**Example:**
291−
292− ~your-urbit:dojo> our
293− :: produces
294− ~your-urbit
295−
296−#### `eny`
297−
298−256 bits of entropy. Read-only.
299−
300−**Example:**
301−
302− ~your-urbit:dojo> eny
303− :: produces
304− 0v1o.m2vio.j5ieb.7tq84.5kcnp.gjn04.9gl2e.tkj5v.0oqk3.iugk8.rhu6o
305−
306−
307−## Troubleshooting
308−
309−If you encounter `%dy-edit-busy` while entering commands, it is
310−because your dojo is blocked on a timer or an http request. Type backspace
311−and your dojo will end the blocked command.
312−
docs/using/web.mddeleted−312
@@ -1,312 +0,0 @@
1−---
2−navhome: /docs/
3−navuptwo: true
4−sort: 8
5−title: Web (Eyre)
6−---
7−
8−# Web (Eyre)
9−
10−<div class="row">
11−<div class="col-md-8">
12−
13−Your Urbit runs its own webserver, Eyre, that handles all things HTTP. Here we'll cover the features of Eyre that most resemble a traditional web server.
14−
15−By default Eyre uses Tree, which is sort of like a combination of [Jekyll](https://jekyllrb.com/) or [Kirby](https://getkirby.com/) and Finder on OSX. Tree is a simple ui for browsing the contents of the filesystem, statically publishing a blog or any kind of content and for running single-page apps.
16−
17−Tree was built primarily to display both our documentation and the contents of `urbit.org`. We provide a few simple examples [here](#-examples) of how to publish using Tree. If you're interested in doing anything complex it's worth checking out the [docs source](https://github.com/urbit/docs) and the [urbit.org](https://github.com/urbit/urbit.org) source.
18−
19−We ship `tree` as compiled JavaScript on your Urbit, but the source lives in its own repo [here](https://github.com/urbit/tree).
20−
21−</div>
22−</div>
23−
24−## Quickstart
25−
26−Your Urbit runs a web server and can be found at either `http://localhost:8080/` (or `8081` if you're running other processes that might be occupying `8080`, you can determine which port your urbit is on by looking at your boot sequence — it's specified there), or `http://your-urbit.urbit.org/`.
27−
28−<span class="red">
29−(Make sure you have a desk mounted to unix, as covered in the
30−[filesystem walkthrough](/docs/using/filesystem)).
31−</span>
32−
33−To switch the desk you're serving from:
34−
35− |serve %sandbox
36−
37−To host a file on the web try putting the following in `/sandbox/web/test.md` (from Unix):
38−
39− # Hello
40−
41− This is a simple markdown file.
42−
43−Create the directory `/sandbox/web/test/` and add two more markdown files in it.
44−
45−NOTE: Due to a bug in Urbit you may have to create the directory and the file in it in rapid
46−succession using something like `mkdir sandbox/web/test && touch sandbox/web/test/first.md`.
47−
48−Now modify `/sandbox/web/test.md` to list the children using the `<list/>` JSX:
49−
50− # Hello
51−
52− This is a simple markdown file.
53−
54− <div><list /></div>
55−
56−To view your file rendered using tree:
57−
58− http://localhost:8080/test/
59−
60−To view your file as raw `md`:
61−
62− http://localhost:8080/test.md
63−
64−To view your file as raw `html`:
65−
66− http://localhost:8080/test.html
67−
68−You may have noticed that we just created both `test.md` and `test/`. In Urbit, there is no distinction between a directory and a file. So, if you're adding files directly from unix, simply `mkdir test` and Urbit will treat the file and directory as the same entity.
69−
70−You can use this feature to change your homepage at `your-urbit.urbit.org` with the page `/home/web.md`, where `home` is the current mounted desk. By default, `web.md` will display some info about your urbit, but you can customize it to your heart's content.
71−
72−## Examples
73−
74−We've created a few simple examples of how to get set up publishing content from your Urbit. Feel free to ask questions in the comments.
75−
76−<list/>
77−
78−## Manual
79−
80−## `/web`
81−
82−This is the equivalent of a `public_html` directory. Your Urbit looks in this directory to serve content to the world. You can change what desk you're serving from using `|serve`.
83−
84−Switch to the `%sandbox` desk:
85−
86− |serve %sandbox
87−
88−Let's quickly step through the default contents of `web/`:
89−
90−- `404.hoon` - The default 404 page.
91−- `dojo.hoon` - Page body that loads the `dojo` React module.
92−- `lib/css/bootstrap.css` - The Urbit-flavored bootstrap
93−- `lib/css/codemirror.css` - Syntax highlighting
94−- `lib/css/fonts.css` - The Urbit custom fonts
95−- `lib/js/hoon.js` - Hoon syntax highlighting
96−- `lib/js/sole.js` - `dojo` operational transformation JS
97−- `lib/js/urb.js` - Base Urbit JS library. Handles AJAX and polling.
98−- `static.md` - Sample static file
99−- `talk/` - Talk compiled JS / CSS
100−- `talk.hoon` - Page body that loads the `talk` React module.
101−- `tree/` - Tree compiled JS / CSS
102−- `tree.hoon` - Page body that loads the `tree` React module.
103−
104−## Tree
105−
106−Tree is a simple publishing tool for files that live on your Urbit. You're probably reading this file using Tree right now. The main driving use-case for Tree has been for us to host our own documentation and the surrounding discussion. Tree remains a pretty simple and flexible tool for getting content online. We think it's pretty great.
107−
108−Tree is a simple static publishing tool and the basic UI for browsing the filesystem. We take it one step further and make it possible to write modules (tiny little apps), like Talk and Dojo, that can be run directly inside of Tree.
109−
110−In the browser Tree is a [React](https://facebook.github.io/react/) / [Flux](https://facebook.github.io/react/blog/2014/05/06/flux.html) app that uses a slightly modifed version of [Bootstrap](http://getbootstrap.com/). On your Urbit Tree is a renderer that translates data in `%clay`, our filesystem, into JSON / JSX that can be read by the client.
111−
112−Your Urbit comes with a pre-built copy of the tree (as a single `.js` file). If you're interested in helping to develop tree or learning about how it works, it has its own GitHub repo [here](https://github.com/urbit/tree). We have our own fork of Bootstrap, which lives [here](https://github.com/urbit/bootstrap).
113−
114−## `/web/pages`
115−
116−To render content without the Tree put it in `/web/pages`. Files in this directory aren't wrapped by Tree. For some examples check out [`web/` in the examples repo](https://github.com/urbit/examples/tree/master/web).
117−
118−## Publishing files
119−
120−Publishing files in Tree is simple. Try dropping a file in `/web` (as covered in the Quickstart) and navigating to it.
121−
122−The best example of more complicated usage of Tree is covered by the Urbit docs themselves. See anything while perusing the docs that you'd like to use yourself? The docs are all on GitHub [here](https://github.com/urbit/docs).
123−
124−## YAML
125−
126−We use [YAML](http://yaml.org/)-style frontmatter to do odds and ends like override the title. A YAML block looks something like this:
127−
128−```
129−---
130−next: true
131−sort: 5
132−title: Tree
133−---
134−```
135−
136−and appears at the top of a file. YAML values can't contain newlines but can contain spaces. Here are the fields we support:
137−
138−### `title`
139−
140−String. Example: `title: Tree manual`.
141−
142−This sets the title in the nav or in lists as distinct from the filename.
143−
144−### `next`
145−
146−Boolean. Example: `next: true`
147−
148−Adds a 'next' link at the bottom of the page that links to the next item as decided by the sort order.
149−
150−### `sort`
151−
152−Integer. Example: `sort: 7`
153−
154−User-defined sort. Indicates the sort order as distinct from alphabetical sort. These numbers should not be overlapping.
155−
156−### `hide`
157−
158−Boolean. Example: `hide: true`
159−
160−Whether or not to hide the item from the tree.
161−
162−### `date`
163−
164−Urbit date. Example: `~2016.2.22`
165−
166−Used for sorting posts by date.
167−
168−## Using components
169−
170−Tree is built using React with a small library of components that you can add to your pages using [JSX](https://facebook.github.io/jsx/) tags.
171−
172−If you don't know anything about JSX that's okay: basically we just give you a few custom HTML tags that you can use to create components on the page.
173−
174−For those familiar with React / Flux each JSX tag corresponds to a component in [the source](https://github.com/urbit/tree/tree/master/js/components).
175−
176−### `<list>`
177−
178−Example: `<list src="/posts" titlesOnly="true" />`
179−
180−Creates a list of children at a path. Defaults to the current path.
181−
182−Optional properties:
183−
184−- `src`: Path to load kids from.
185−- `titlesOnly`: Only show the 'title' which is either the filename or the first h1.
186−- `sortBy`: Can be `date` if items have a `date` YAML.
187−- `className`: Class to be assigned to the container.
188−
189−### `<kids>`
190−
191−Example: `<kids src="/posts" />`
192−
193−Includes all the children at the specified path separated by `<hr>` tags.
194−
195−Optional properties:
196−
197−- `src`: Path to load kids from.
198−- `className`: Class to be assigned to the container.
199−
200−### `<toc>`
201−
202−Example: `<toc noHeader="true" />`
203−
204−Creates a table of contents from the `h1` - `h6` tags on the page.
205−
206−Optional properties:
207−
208−- `match`: Tag name to match. If you wanted to only match `h2` tags it could be `match="h2"`
209−- `noHeader`: By default we add a 'Table of Contents' header to the top. Remove it with `noHeader="true"`.
210−
211−## Implementation
212−
213−On the frontend Tree is mostly just a standard Flux app: components generate actions that get dispatched to stores which are picked up by components. If you're not familiar with Flux, [this overview](https://facebook.github.io/flux/docs/overview.html) is a good place to start.
214−
215−As a file browser Tree does a simple job: it fetches data and keeps a cache of what it has seen. To do this simple job we do three fancy things: `manx` to JSON encoding, the Async component and Modules.
216−
217−### `manx` to JSON format
218−
219−Since we want to use React to manage our DOM lifecycle we actually transfer the DOM structure of each page as JSON over the wire, and 'reactify' it on the client side.
220−
221−On the Urbit side we have a type for html: `++manx`. Our wire format for sending HTML as JSON is really similar to a `++manx`. If you're not interested here's what the json looks like:
222−
223−```
224−"string" || {gn:"string", ga:{key:"string", [...]}, c:[...]}
225−```
226−
227−To make this clearer let's look at some HTML and its JSON representation:
228−
229−```
230−<div class="blue">
231− <h1>Title</h1>
232−</div>
233−```
234−
235−```
236−{gn:"div", ga:{className:"blue"}, [
237− {gn:"h1", ga:null, "Title"}
238−]}
239−```
240−
241−To see the mechanics of how this is handled on the frontend, checkout `components/Reactify.coffee` in the `urbit/tree` repo.
242−
243−### Async component
244−
245−Each of our components (even those we fetched from the server) can depend on data that may not exist in our stores, so we wrap our components in a general-purpose Async component. You can find the component in `components/Async.coffee` in the `urbit/tree` repo.
246−
247−When we say that we just fetch HTML as JSON it's actually slightly more complicated. When we fetch a node in the filesystem we might not want to fetch its entire contents. Sometimes we just get the title as a part of a list of children, sometimes we might get a snippet (in a list with previews), and sometimes we get the whole thing. On the Urbit side these results are provided by `ren/tree/json`.
248−
249−From the perspective of the frontend we just send queries on a path that obey a simple API. To see this in action, here's our `BodyComponent`:
250−
251−```
252−query {
253− body:'r'
254− name:'t'
255− path:'t'
256− meta:'j'
257− sein:'t'
258−}
259−```
260−
261−Here we're asking for the body, name, path, metadata and parent of the current path. When it loads that data gets passed to our component as props.
262−
263−### Module basics
264−
265−A module is a special component that can kind of 'take over' the page. It can change properties of the nav bar as well as load custom scripts / css.
266−
267−Talk, for example, looks like this:
268−
269−```
270−<module nav_title="Talk" nav_no-dpad="" nav_no-sibs="" nav_subnav="talk-station">
271− <script src="/~~/~/at/lib/js/urb.js" />
272− <script src="/talk/main.js" />
273− <link href="/talk/main.css" rel="stylesheet" />
274− <talk />
275−</module>
276−```
277−
278−A module will first download all the scripts and styles that it specifies before trying to load any contained components. This means that you can define React components in external scripts and a module can be entirely self contained. The `<talk>` component isn't a part of Tree — it's loaded first before it's executed.
279−
280−If you're interested in seeing how a module works you can check out the source for Talk [here](https://github.com/urbit/talk). Dojo also ships on your Urbit, its source is [here](https://github.com/urbit/sole).
281−
282−## `urb.js`
283−
284−The most basic interface between your browser and your Urbit is `urb.js`. This small library provides the basic utilities for sending and receiving messages from an Urbit.
285−
286−### `window.urb.appl`
287−
288−Each JSON message sent to your Urbit needs an app endpoint. Can be set as a global `window.urb.appl` or set on a per-request basis in the payload to `send()`.
289−
290−### `window.urb.oryx`
291−
292−CSRF token. Written to the page by Eyre, our webserver, when logged in. Required part of any authenticated request and included by default.
293−
294−### `window.urb.req(method,url,params,json,cb)`
295−
296−Our basic request wrapper. You can see here how a request needs to be packaged to be properly understood by your Urbit.
297−
298−### `window.urb.subscribe({path:"string"})`
299−
300−Subscribe to an endpoint. Subscription data is returned through the continuous long poll.
301−
302−### `window.urb.unsubscribe({path:"string"})`
303−
304−Close subscription on specified path.
305−
306−### `window.urb.poll()`
307−
308−Mechanics of the continuous long poll. Used mostly internally.
309−
310−### `window.urb.util`
311−
312−Library of utility and helper functions.
docs/using/web/blog.mddeleted−95
@@ -1,95 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 1
4−title: A simple blog
5−next: true
6−---
7−
8−# A simple blog
9−
10−Publishing markdown using Urbit is really easy. Here we'll create a
11−very simple blog and publish our first posts.
12−
13−First, let's setup a desk to serve our posts from:
14−
15− |merge %site ~your-urbit %home
16−
17−Then let's mount that desk to unix:
18−
19− |mount /=site=
20−
21−You should now be able to find a `/site` folder inside of your pier
22−directory (either `comet/` or `your-urbit/`).
23−
24−To begin serving files from this new desk use `|serve`:
25−
26− |serve %site
27−
28−First let's create the landing page for our blog. Create the file
29−`site/web/blog.md`:
30−
31− ---
32− anchor: none
33− ---
34−
35− # Hello
36−
37− This is a simple blog I built on Urbit.
38−
39− <list dataType="post"></list>
40−
41−Try viewing this file at `http://your-urbit.urbit.org/blog`. The only
42−special thing about this page is the `anchor: none` YAML which simply
43−turns off the Tree navigation. Normally Tree gives navigation
44−controls for walking around the filesystem, but taking them away makes
45−the page seem more like a landing page.
46−
47−The page looks pretty boring now. Let's add our first post. From
48−unix run `mkdir your-urbit/site/web/blog; touch
49−your-urbit/site/web/blog/post-1.md`. (Currently [there's a
50−bug](https://github.com/urbit/urbit/issues/321) that prevents empty
51−directories from getting created, so we have to `touch` a file inside
52−them first.) In `blog/post-1.md` let's add some filler content:
53−
54− ---
55− date: ~2016.4.20
56− title: My first post!
57− type: post
58− navhome: /blog
59− ---
60−
61− Is this a decentralized Medium? Let's find out.
62−
63− But first, how about a long quote from Paramenides:
64−
65− > True, he said; and therefore when ideas are what they are in
66− relation to one another, their essence is determined by a relation
67− among themselves, and has nothing to do with the resemblances, or
68− whatever they are to be termed, which are in our sphere, and from
69− which we receive this or that name when we partake of them. And
70− the things which are within our sphere and have the same names
71− with them, are likewise only relative to one another, and not to
72− the ideas which have the same names with them, but belong to
73− themselves and not to them.
74−
75− Good to get that out of the way.
76−
77−
78−
79−You should be able to view this file at:
80−`http://your-urbit.urbit.org/blog/post-1.md`. You'll also notice that
81−now the list of posts here: `http://your-urbit.urbit.org/blog` has
82−updated.
83−
84−Here we use two pieces of YAML worth noting: `type` and `navhome`.
85−
86−- `type` implies that the page has some special handling by Tree.
87−When `type` is `post` we automatically put in the `date`, `title`
88−and `author` when they're specified and add some styles.
89−
90−- `navhome` sets the path used by the home button (the circle in the
91− top left). Since we want to send people back to the root of our
92− blog, we set this to `/blog`
93−
94−Adding posts is as easy as dropping markdown files into the `blog/`
95−directory. Pretty easy!
docs/using/web/comments.mddeleted−43
@@ -1,43 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 2
4−title: Blog comments
5−next: true
6−---
7−
8−# Blog comments
9−
10−If you followed [our previous example](./blog) you should have a
11−simple blog accessible at `your-urbit.urbit.org/blog`. Here we'll
12−enable comments on a post.
13−
14−First, turn comments on by editing the YAML in `post-1.md`. Your YAML
15−should look like this:
16−
17− ---
18− date: ~2016.4.20
19− title: My first post!
20− type: post
21− navhome: /blog
22− comments: true
23− ---
24−
25−Now try loading your post here: `your-urbit.urbit.org/blog/post-1`.
26−You should see a comments box at the bottom of the page.
27−
28−Try posting a comment! When you do you should see the following in
29−your console:
30−
31− + /~your-urbit/home/55/web/blog/post-1/comments/~2016.4.20..23.20.54..0b88/md
32− ------------[0]
33− ~your-urbit[tree]: receiving comments, ;join %comments for details
34−
35−Comments are written into the filesystem in the `comments/` folder
36−relative to the page they're enabled on. When a new comment is posted
37−a notification is also posted to the `/comments` `:talk` channel.
38−
39−Use `;join` to keep up with comments as they get posted:
40−
41− ;join ~your-urbit/comments
42−
43−That's it! Easy.
docs/using/web/static.mddeleted−127
@@ -1,127 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 3
4−title: A static site
5−---
6−
7−# A static site
8−
9−Hosting a static tree of content is easy. Let's put together a really
10−simple site for an imaginary Urbit meetup group.
11−
12−We assume you have at least followed the beginning of [our first
13−example](./blog) and created a desk called `site` and mounted it to
14−unix.
15−
16−In `site/web/meet.md` put:
17−
18− ---
19− navdpad: false
20− navmode: navbar
21− navpath: /meet
22− navhome: /meet
23− ---
24−
25− # Neo-Tokyo Urbit meetup
26−
27− <img src="https://ofheroesandcliches.files.wordpress.com/2014/06/neo-tokyo.png" width="100%"/>
28−
29− Hi there! We meet once a week at The Chat to work on Urbit projects
30− together.
31−
32− You can find out more about the group on the [about](about) page and
33− follow our projects in [projects](projects).
34−
35−This is our landing page. Here we're using a few new bits of YAML:
36−`navdpad`, `navmode` and `navpath`. `navdpad` just turns off the nav
37−arrows. `navmode` can be set to 'navbar' to switch to a horizontal top
38−nav instead of a left bar. `navpath` sets the path to load the nav
39−items from.
40−
41−Let's create `about.md` and `projects.md`. From Unix use the
42−technique from before to create a new directory: `mkdir
43−your-urbit/site/web/meet/; touch your-urbit/site/web/meet/about.md`.
44−Then put the following in `site/web/about.md`:
45−
46− ---
47− navdpad: false
48− navmode: navbar
49− navpath: /meet
50− navhome: /meet
51− title: About
52− ---
53−
54− # About
55−
56− ## Mission statement
57−
58− The existing framework cannot subdue the new human force that is increasing day by day alongside the irresistible development of technology and the dissatisfaction of its possible uses in our senseless social life.
59−
60− ## Members
61−
62− Membership is open to anyone. Just send a message to `~talsur-todres`.
63−
64− - Shōtarō Kaneda
65− - Motoko Kusanagi
66− - Ishikawa
67− - Faye Valentine
68− - Spike Spiegel
69−
70−And `site/web/projects.md`:
71−
72− ---
73− navdpad: false
74− navmode: navbar
75− navpath: /meet
76− navhome: /meet
77− title: Projects
78− ---
79−
80− # Projects
81−
82− ## Active
83−
84− <list />
85−
86− ## Discussion
87−
88− <div class="mini-module">
89− <script src="/~/at/lib/js/urb.js"/>
90− <script src="https://cdn.rawgit.com/seatgeek/react-infinite/0.8.0/dist/react-infinite.js"/>
91− <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.11.2/moment-with-locales.js"/>
92− <script src="https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.1/moment-timezone.js"/>
93− <script src="/talk/main.js"/>
94− <link href="/talk/main.css" rel="stylesheet" />
95− <talk readonly="" chrono="reverse" station="comments" />
96− </div>
97−
98−This page introduces a new thing: the `:talk` module. Inside of the
99−`mini-module` div we load the scripts needed by the `<talk>`
100−component. The `<talk>` component is a static component for
101−displaying a feed from a talk channel inline. Here we're going to
102−display the discussion from our active projects inline.
103−
104−We'll need a few active projects though. From unix: `mkdir
105−your-urbit/site/web/meet/projects; touch
106−your-urbit/site/web/meet/projects/bike.md`.
107−
108−In `site/web/meet/projects/bike.md`:
109−
110− ---
111− navdpad: false
112− navmode: navbar
113− navpath: /meet
114− navhome: /meet
115− title: Kaneda's Bike
116− comments: true
117− ---
118−
119− # Urbit on a Motorcycle
120−
121− Discussion on getting urbit to power Kaneda's motorcycle.
122−
123−Here we just use the `comments` YAML to enable comments on the page.
124−Adding other imaginary projects is left to the reader.
125−
126−Building a static site takes only a few minutes and a few markdown
127−files. Have fun!
docs/vere/jetting.mddeleted−760
@@ -1,760 +0,0 @@
1−# How to write a jet
2−
3−A guide for new Urbit developers.
4−
5−Problem statement: coder A has written some hoon, and you - coder B - need to jet it.
6−
7−Preconditions:
8−
9−* You have a pill `jetted.pill`, located in ~/tlon.
10−* You have an example of hoon code that, executed in dojo, does the right thing.
11−
12−## Get all the source code you need.
13−
14−The source code you will need to modify lives in two different repos:
15−urbit and arvo. The urbit repo has the source code for the
16−intrepretter / personal server, written in C. The arvo repo has the
17−operating system, written in hoon. Since you're jetting the hoon, you
18−need to modify both.
19−
20−For simplicitly, I'm going to assume that you are doing all of your
21−development in ~/tlon. This saves the bother of writing nonsense like
22−the/path/to/your/sandbox, and also means that one can copy-and-paste
23−these instructions straight into a terminal with zero editing. Do
24−your development elsewhere, if you like, and make a symbolic link.
25−
26−1. mkdir ~/tlon
27−1. cd ~/tlon
28−1. git clone https://github.com/urbit/urbit
29−1. cd urbit
30−1. git fetch
31−1. git checkout <branch> # optional
32−1. scripts/bootstrap
33−1.
34−1. cd ..
35−1. git clone https://github.com/urbit/arvo
36−1. cd arvo
37−1. git fetch
38−1. git checkout <branch> # optional
39−1. cd ..
40−
41−## Add new subprojects / libraries to urbit, if necessary
42−
43−If we have a complicated hoon function that, say, computes square
44−roots, we need to speed it up, and there is an open source library
45−libsquareroots, adding libsquareroots to our build might solve 90% of
46−our problems.
47−
48−If this describes your task, read this section. If not, skip to the next section - none of this is necessary.
49−
50−1. have someone with github.com/urbit repo privileges fork libsquareroots into github.com/urbit
51−1. fork this new repo github.com/urbit/libsquareroots
52−1. cd ~tlon/urbit/subprojects
53−1. git submodule add <url>
54−1. edit ~tlon/urbit/subprojects/meson.build
55− 1. add a line `<foo>_dep = dependency('<foo>', version: '>=0.1.0', fallback: ['<foo>', '<foo>_dep'])`
56− 1. add `<foo>_dep` to the list of dependencies at the bottom of the file. Remember to use a comma.
57−1. generate a meson.build for the new subproject: cd subprojects/<new directory>; meson wrap promote subprojects/secp256k1
58−1. edit the meson.build until it works ("works" is defined as "in the top level ~/tlon/urbit invoking scripts/build builds the library and links it into the urbit executable")
59−1. git add meson.build ; git commit -m"now builds with meson for Tlon" .
60−1. cd .. ; git add .gitmodules ; git commit -m"added submodule" .
61−1. test the whole thing by
62− 1. cd /tmp
63− 1. rm -rf urbit
64− 1. git clone https://github.com/<yourname>/urbit
65− 1. cd urbit
66− 1. scripts/bootstrap
67− 1. verify that the new submodule is present
68− 1. scripts/build
69− 1. verify that the urbit executable is built and linked to the new library
70−1. submit a pull request from your copy of <libsquareroots> to the urbit copy
71−1. submit a pull request from your copy of urbit to the urbit copy
72−
73−### If the submodule is modified
74−
75−The steps above add a submodule to the urbit repo. Or, more specifically, they add a specific version of the submodule to the repo.
76−
77−If the submodule has commits made to it (perhaps, the urbit repo will not track those new commits. XXXX)
78−
79−
80−## Edit the source code
81−
82−There are several things you're going to do:
83−
84−1. hint the hoon code, so that the urbit interpreter will know to look for C code
85−1. for each jet you want you're going to declare two functions in two .h files (one takes the arguments as separate arguments, one takes them as one big tree)
86−1. then implement the two C functions in a single .c file
87−1. register the new C jet functions so the urbit interpretter knows the names / function pointers of the C funcs
88−
89−
90−### Edit the Hoon Source code
91−
92−Let's edit the hoon source code first.
93−
94−There are multiple runes to do hinting, but we're going to concentrate
95−on three. All hinting runes start with a tilda ("sig"). A mnemonic
96−is "we're signalling some information to the interpretter".
97−
98−1. ~/ sigfas: simple jet registration, using defaults for some arguments
99−1. ~% sigcen: more complicated jet registration, specifying all arguments
100−1. ~& sigpam: debugging printf
101−
102−Feel free to use ~& liberally! (Just remove them when you're done).
103−
104−Let's use the three to jet some code. Starting with this example:
105−```
106− ++ aaa
107− ...
108− ++ bbb
109− ++ ccc
110− |= dat=@
111− ^- pont
112− =+ x=(end 3 w a)
113− =+ y=:(add (pow x 3) (mul a x) b)
114− =+ s=(rsh 3 32 dat)
115− :- x
116− ?: =(0x2 s) y
117− ?: =(0x3 s) y
118− ~| [`@ux`s `@ux`dat]
119− !!
120−```
121−
122−our steps are:
123−
124−1. add a line under `++ aaa` like this: `~% %aaa ..is ~`
125−1. add a line under `++ bbb` like this: `~/ %bbb`
126−1. add a line under `++ ccc` like this: `~/ %ccc`
127−
128−What we're doing here is hinting `ccc`, and then adding a string of
129−hints up the enclosing tree of arms. Each of these hints is
130−implemented w the simple / minimalist `~/` rune, which takes one
131−argument: the symbol that should be used to label the hint (these
132−symbols will be used later in the C code to match up C code with hoon code).
133−
134−The top hint (for `aaa`) uses the more verbose `~%` hint syntax, which
135−specifies two additional fields: `...is` means "parent jet can not be
136−determined by context, so use 'is' as the parent" ("is" is the name of a system-supplied jet).
137−
138−[ N.B. saying " `is` is the parent " is a quick-and-dirty lie. The
139−fuller version is: `+is` is an arm of the Arvo core, so `..is` is a
140−reference to the entire Arvo core. The whole Arvo core is hinted with
141−the jet label `%hex`, which is used as the parent for all the
142−top-level jet hints in %zuse. ]
143−
144−When hinting your own code, make sure to hint each nesting arm.
145−Skipping any one will result in the jet code not being run.
146−
147−Note that you do not need to provide C implementations for everything
148−you hint. In this above example we hint aaa, bbb, and ccc - even if
149−our intent is only to jet ccc.
150−
151−### Edit the C Source code (overview)
152−
153−Having hinted our hoon, we now need to write the matching C code. If
154−we don't, there isn't a problem - hinting code merely tells the
155−interpretter to look for a jet, but if a jet is not found, the hoon
156−still runs just fine.
157−
158−There are two distinct tasks to be done in C:
159−1. write the jet
160−1. register the jet
161−
162−For each jet you will write one u3we() function and one u3qe() function.
163−
164−### Edit the C Source code to add registration
165−
166−* edit the header file
167− include/jets/w.h
168− to have a declaration for each of your u3we() functions. Every u3we() function looks the same, e.g.
169− u3_noun u3we_xxx(u3_noun);
170−
171−* edit the header file
172− ~/tlon/urbit/include/jets/q.h
173−
174− to have a declaration for your u3qe() function. u3qe() functions
175− can differ from each other, taking distinct numbers of u3_nouns and/or u3_atoms, e.g
176−
177− u3_noun u3qe_yyy(u3_atom, u3_atom);
178− u3_noun u3qe_zzz(u3_noun, u3_noun, u3_atom, u3_atom);
179−
180−* create a new .c file to hold your jets (both the u3we_() and u3qe_() functions go in the same file). For example, ~/tlon/urbit/jets/e/secp.c
181− (The choice of subdirectory under 'jets' (a through g) is XXX )
182− The new file should have three things:
183− 1. \#include "all.h"
184− 1. the new u3we() function
185− 1. the new u3qe() function
186−
187−* edit ~/tlon/urbit/jets/tree.c to register jet
188−
189−In the hoon code we hinted some leaf node functions (`ccc` in our example) and then hinted each parent node up to the root `aaa`).
190−
191−We need to replicate this structure in C. Here's example C code to jet our above example Hoon:
192−
193−```
194− // 1: register a C func u3we_ccc()
195− static u3j_harm _143_hex_hobo_reco_d[] =
196− {
197− {".2", u3we_ccc, c3y},
198− {}
199− };
200−
201− // 2: that implements a jet for hoon arm 'ccc'
202− static u3j_core _143_hex_hobo_bbb_d[] =
203− {
204− { "ccc", _143_hex_hobo_ccc_d },
205− {}
206− };
207−
208− // 3: ... that is inside a hoon arm 'bbb'
209− static u3j_core _143_hex_hobo_hobo_d[] =
210− {
211− { "bbb", 0, _143_hex_hobo_bbb_d },
212− {}
213− };
214−
215− // 4: ... that is inside a hoon arm 'aaa'
216− static u3j_core _143_hex_d[] =
217− { { "down", 0, _143_hex_down_d },
218− { "lore", _143_hex_lore_a },
219− { "loss", _143_hex_loss_a },
220− { "lune", _143_hex_lune_a },
221− { "coed", 0, _143_hex_coed_d },
222− { "aes", 0, _143_hex_aes_d },
223− { "hmac", 0, _143_hex_hmac_d },
224− { "aaa", 0, _143_hex_hobo_d },
225− {}
226− };
227−
228−```
229−
230−There are 4 things steps here. Let's look at each in turn.
231−
232−Section 1 names the C function that we want to invoke: 'u3we_ccc()'.
233−The precise manner in which it does this is by putting entries in an
234−array of 'u3j_harm's. The first one specifies the jet; the second one
235−is empty and serves as a termination to the array, similar to how a C
236−string is null terminated with a zero. The jet registration supplies
237−two fields {".2", u3we_secp}, but this does not initialize all of the
238−fields of u3j_harm. Other fields can be specified.
239−
240−The first field, with value ".2" in this example, is "arm 2".
241−
242−[ N.B. ".2" labels the axis of the arm in the core. With a %fast hint
243−(~/), we're hinting a gate, so the relevant arm formula is always just
244−the entire battery at +2. I assume the jet dashboard is flexible
245−enough to hint arms at different axes, but I've never seen it done. ]
246−
247−The second field, with value u3we_secp in this example, is a function
248−pointer (to the C implementation of the jet).
249−
250−The third field (absent here) is a flag to turn on verification of C
251−jet vs hoon at run time. It can take value c3n (which means verify at run time) or c3y
252−(which means don't verify). If not present, it is set to don't verify.
253−
254−[N.B. The use of the flags seems inverted. Why is c3y ("yes") used to
255−turn OFF verification? A: because the flag is actually "is the jet
256−already known to be perfect?" ]
257−
258−There are additional flags; see ~/tlon/urbit/include/noun/jets.h
259−
260−
261−Section 2 associated the previous jet registration with the name
262−"ccc". Note that this is the symbol used in the Hoon hint! Note also
263−that we again have a "null terminated" (metaphorically) list, ending with `{}`.
264−
265−Section 3 references structure built in step 2 and slots it under
266−`bbb` (again, note that this is exactly the same symbol used in the
267−hinting in Hoon).
268−
269−The line in section 2
270−```
271− { "ccc", _143_hex_hobo_ccc_a },
272−```
273−
274−looks very similar to the line in section 3
275−```
276− { "bbb", 0, _143_hex_hobo_bbb_d },
277−```
278−
279−But note that the line in section 2 fill in the first 2 fields in the
280−struct, and the line in section 3 fills in the first three fields.
281−Section 2 is registering an array of u3j_harm, i.e. is registering an actual C
282−jet.
283−
284−Section 3 is specifying 0 for the array of u3j_harm and is instead
285−specifying an array of u3j_core, i.e. it is registering nesting of
286−another core which is not a leaf node.
287−
288−Section 4 is much like section 3, but it's the root of this particular
289−tree. Section 4 is also an example of how a given node in the
290−jet-registration tree may have multiple children.
291−
292−Using this example you should be able to register jets whether your
293−nesting is 2 layers deep, 3 (like this example), or more. You should
294−also be able to register multiple jets at the same nesting level (e.g.
295−a function u3we_ddd() which is a sibling of u3we_ccc() inside data structure _143_hex_hobo_reco_d[] ).
296−
297−
298−### Edit the C source code to add the u3we_() function
299−
300−There are two C functions per jet, because separation of concerns is a good thing.
301−
302−The first C function - named u3we_something() - unpacks arguments from
303−the Hoon code and gets them ready.
304−
305−The second C function - named u3qe_something() - takes those arguments
306−and actually performs the operations that parallel the hoon code being
307−jetted.
308−
309−Let's write the u3we_() function.
310−
311−Your function is going to accept one argument, of type u3_noun. This
312−is the same type as a hoon noun ('*').
313−
314−This one argument is the payload.
315−
316−The payload is a tree, obviously.
317−
318−The payload consists of (on the right branch) the context (you'd think
319−of "global variables and available methods", if analogies to other
320−programming languages were allowed!) and on the left branch the
321−sample (the arguments to this particular function call).
322−
323−Your u3we_() function does one thing: unpack the sample from 'cor',
324−sanity check them, and pass them in to the u3qe_() function.
325−
326−To unpack the sample
327−
328−We use the function u3r_mean() to do this, thusly:
329−
330− u3_noun arg_a, arg_b, arg_c ... ;
331−
332− u3r_mean(cor,
333− axis_a, & arg_a,
334− axis_b, & arg_b,
335− axis_c, & arg_c
336− ...
337− 0)
338−
339−
340−If we want to to assign the data located at axis 3 of cor to arg_a, we'd set axis_a = 3.
341−
342−u3r_mean() takes varargs, so we can pass in as many axis /
343−return-argument pairs as we wish, terminated with a 0.
344−
345−When pulling arguments out of a hoon remember that Nock and Hoon store
346−lists as skinny right-descending trees (because a linked list is a
347−degenerate case of a tree).
348−
349−The quick way to figure out axis locations is to remember that we
350−start with axis 1, and left children have axis 2n and right children
351−have axis 2n+1.
352−
353−If one argument is passed in, it is found at axis 1.
354−
355−If we have two arguments, axis 1 holds pointers to the first argument
356−in the left child at axis 2 (when n is 1, 2n = 2 ) and the second
357−arguments in the right child at axis 3 (when n is 1, 2n+1 is 3).
358−
359−If we have three arguments, axis 1 holds pointers to the first
360−argument in the left child at axis 2 (when n is 1, 2n = 2 ) and to the
361−next cell at 3, which doesn't contain an argument, but points to
362−argument 2 in the left child at axis 6 (when n is 3, 2n = 6) and to
363−argument 3 in the right child at axis 7 (when n is 3, 2n + 1 = 7).
364−
365−Note that there are #defines to help you specify the axises you want.
366−They are in include/noun/xtract.h
367−
368−If the sample has one item, that one item it is located at the axis
369−specified by the #define u3x_sam_1.
370−
371−If the sample has 2 items, they are located at the axis specified by
372−the #defines u3x_sam_2 and u3x_sam_3.
373−
374−If the sample has 3 items, they are located at the axis specified by
375−the #defines u3x_sam_2, u3x_sam_6, and u3x_sam_7.
376−
377−etc.
378−
379−If you have four arguments and want to tease them out and verify them, you could use code like this
380−
381−N.B. in our fprintf()s we're using both \n and \r to achieve line feed
382−(move cursor down one line) and carriage return (move it to the left),
383−because Urbit uses ncurses to control the screen and it changes the
384−default behavior you may be used to (where \n accomplishes both).
385−```
386− c3_o ret;
387− u3_noun sample;
388− ret = u3r_mean(cor, u3x_sam_1, &sample, 0);
389− fprintf(stderr, "ret = %i\n\r", ret); // we want ret = 0 = yes
390− u3m_p("sample", sample); // pretty print the entire sample
391−
392− ret = u3r_mean(cor, u3x_sam_2, &sample, 0);
393− fprintf(stderr, "ret = %i\n\r", ret);
394− u3m_p("2: ", sample);
395−
396− ret = u3r_mean(cor, u3x_sam_6, &sample, 0);
397− fprintf(stderr, "ret = %i\n\r", ret);
398− u3m_p("6: ", sample);
399−
400− ret = u3r_mean(cor, u3x_sam_14, &sample, 0);
401− fprintf(stderr, "ret = %i\n\r", ret);
402− u3m_p("14: ", sample);
403−
404− ret = u3r_mean(cor, u3x_sam_15, &sample, 0);
405− fprintf(stderr, "ret = %i\n\r", ret);
406− u3m_p("15: ", sample);
407−```
408−
409−If the hoon that you're jetting looks like this
410−```
411− ++ make-k
412− ~/ %make-k
413− =, mimes:html
414− |= [aaa=@ bbb=@ ccc=@]
415−```
416−In the C code you'd fetch them out of the payload with
417−```
418− u3r_mean(cor,
419− u3x_sam_2, & arg_aaa,
420− u3x_sam_5, & arg_bbb,
421− u3x_sam_6, & arg_ccc
422− ...
423− 0)
424−```
425−If you're confident, go ahead and write code. If you want to inspect
426−your arguments to see what's going on, you can pretty print the
427−sample.
428−
429−You could - IN THEORY - inspect / pretty-print the noun by calling
430−```
431− u3m_p("description", cor); :: DO NOT DO THIS !!!
432−```
433−...but you don't want to do this, because, recall, cor contains the
434−entire context - the whole enchilada.
435−
436−Do instead, perhaps,
437−```
438− c3_o ret;
439− u3_noun sample;
440−
441− ret = u3r_mean(sample, u3x_sam_1, &sample, 0);
442− fprintf(stderr, "ret = %i\n\r", ret); // we want ret = 0 = yes
443− u3m_p("sample", sample); // pretty print the entire sample
444−```
445−
446−After our C function pulls out the arguments it needs to type check them.
447−
448−If arg_a is supposed to be a atom, trust but verify:
449−```
450− u3ud(arg_a); // checks for atomicity; alias for u3a_is_atom()
451−```
452−If it's supposed to be a cell:
453−```
454− u3du(arg_a); // checks for cell-ness
455−```
456−There are other tests you might need to use
457−```
458− u3a_is_cat()
459− u3a_is_dog()
460−
461− u3a_is_pug()
462− u3a_is_pom()
463−```
464−All of these rests return Hoon loobeans (yes/no vs true / false), so
465−check return values vs c3n / c3y. If any of these u3_mean(), u3ud()
466−etc return u3n you have an error and should return
467−```
468− return u3m_bail(c3__exit);
469−```
470−otherwise pass the arguments into your "inner" jet function and return the results of that.
471−
472−### Edit the C source code to add the u3qe_() function
473−
474−The u3qe_() function is the "real" jet - the C code that replaces the hoon.
475−
476−First, you may need to massage your inputs a bit to get them into types that you can use.
477−
478−You have received a bunch of u3_nouns or u3_atoms, but you presumably want to do
479−things in a native C / non-Hoon manner: computing w raw integers, etc.
480−
481−A u3_noun will want to be further diassembled into atoms. XXX
482−
483−A u3_atom represents a simple number, but the implementation may or
484−may not be simple. If the value held in the atom is 31 bits or less,
485−it's stored directly in the atom. If the value is 32 bits the atom
486−holds a pointer into the loom where the actual value is stored. ( see https://urbit.org/docs/vere/nouns/ )
487−
488−You don't want to get bogged down in the details of this - you just
489−want to get data out of your atoms.
490−
491−If you know that the data fits in 32 bits or less, you can use
492−```
493− u3r_word(c3_w a_w, u3_atom b);
494−```
495−
496−If it is longer than 32 bits, use
497−```
498− u3r_words(c3_w a_w, c3_w b_w, c3_w* c_w, u3_atom d);
499−```
500−
501−or
502−```
503− u3r_bytes(c3_w a_w, c3_w b_w, c3_y* c_y, u3_atom d)
504−```
505−
506−(N.B. You may want to use u3r_bytes regardless, as
507−
508−The actual meat of the function is up to you. What is it supposed to do?
509−
510−Now we move on to return semantics.
511−
512−First, you can transfer raw values into nouns using
513−```
514− u3_noun u3i_words(c3_w a_w, const c3_w* b_w)
515−```
516−and you can build cells out of nouns using
517−```
518− u3nc(); // pair
519− u3nt(); // triple
520− u3nq(); // quad
521−
522−```
523−There are two facets here: (i) data format, (ii) memory allocation.
524−
525−Regarding data format, if the hoon is expected to return a single atom (e.g. if the hoon looks like this
526−```
527− ++ make-k
528− ~/ %make-k
529− |= [has=@uvI prv=@] :: <---- input parguments
530− ^- @ :: <---- return value is a single value of type '@' (atom)
531− ...
532−```
533−then your C code - at least when you're stubbing it out - can do something like
534−```
535− return(123);
536−```
537−Or, if you want to create an atom more formally, you can build it like this
538−```
539− // this variable is on the stack and will disappear
540− unsigned char nonce32[32];
541−
542− // this allocates an indirect (> 31 bits) atom in the loom,
543− // does appropriate reference count, and returns the 32 bit handle to the atom
544− u3_noun nonce = u3i_words(8, (const c3_w*) nonce32);
545−
546− // this returns the 32 bit handle to the atom
547− return(nonce);
548−```
549−If, on the other hand, your hoon looks like
550−```
551− ++ ecdsa-raw-sign :: generate signature
552− ~/ %ecdsa-raw-sign
553− |= [has=@uvI prv=@]
554− ^- [v=@ r=@ s=@]
555− ...
556−```
557−ending your C code with
558−```
559− return(123);
560−```
561−is wrong and will result in a dojo error because you are returning a single atom, instead of a list of three atoms.
562−
563−Instead do one of these:
564−```
565− return(u3nc(a, b)); // for two atoms
566− return(u3nt(a, b, c)); // for three atoms
567− return(u3nq(a, b, c, d)); // for four atoms
568−```
569−If you need to return a longer list, you can compose your own. Look
570−at the definitions of these three functions and you will see that they
571−are just recursive calls to the cell constructor u3i_cell() e.g.
572−```
573− u3i_cell(a, u3i_cell(b, u3i_cell(c, d));
574−```
575−
576−XXX more here about memory model, allocation, ownership
577−
578−
579−
580−## Compile the C code
581−
582−You've edited C code; now you need to compile it to build a new urbit executable!
583−
584−
585−1. cd ~/tlon/urbit
586−1. rm -rf build
587−1. configure: choose one of
588− 1. meson configure -Dbuildtype=release build
589− 1. meson configure -Dbuildtype=debugoptimized build
590− 1. meson configure -Dbuildtype=debug build
591− Note that debugoptimized builds run slower than release builds, and debug builds run slower yet. Booting a debug builkd of urbit may take several minutes. [ N.B. compiler flags -O2 vs -O3 ]
592−1. scripts/build
593−
594−## Compile the Hoon code into a pill
595−
596−You've compiled the Hoon code. Now you need to compile it.
597−
598−Wait, compile? Isn't Hoon that one types at the dojo prompt interpretted, or compiled on the fly?
599−
600−Yes. But.
601−
602−When the urbit executable runs the first thing it does is load the
603−complete arvo operating system. That step is much faster if it can
604−load a "jam"-ed "pill", where all of the hoon has already been parsed
605−from text file into Hoon abstract syntax tree, and then compiled from
606−the hoon into the Nock equivalent.
607−
608−Note that this means that if you edit hoon.hoon, zuse.hoon, arvo.hoon,
609−vane/ames.hoon, etc. and then restart the urbit executable **YOU ARE
610−NOT RUNNING YOUR NEW CODE**.
611−
612−The only way to run the new code is to follow the following process:
613−
614−1. start up urbit, tell it to be a fake zod (act as a galaxy and disconnect from the rest of the network) and have it know where your edited arvo files are (although not execute them, as discussed above):
615− 1. rm -rf ~/zod
616− 1. rm -rf ~/tlon/mypill.pill
617− 1. ~/tlon/urbit/build/urbit -FI zod -A ~/bus/tlon/arvo/ -c zod
618− This should take < 90 seconds.
619− 1. If you accidentally exit urbit you can restart it XXX
620−1. inside your urbit, from the dojo command line, load the hoon files and compile them into a pill file:
621− 1. .pill +solid
622− This should take < 90 seconds.
623− 1. examine the output. Expect to see something like this
624− ```
625− %solid-start
626− %solid-loaded
627− %solid-parsed
628− %solid-compiled
629− %solid-arvo
630− [%solid-kernel 0x6aa7.627e]
631− %arvo-assembly
632− [%solid-veer p=%$ q=/zuse]
633− [%tang /~zod/home/~2018.7.25..20.47.51..0027/sys/zuse ~mondyr-rovmes]
634− ```
635− 1. if, on the contrary, you see anything like this:
636− ```
637− syntax error
638− {3,356 7}
639− /~zod/home/~2018.7.25..20.47.51..0027/sys/zuse
640− ```
641− you have an error. In this case the error is on line 3,356, character 7 of file ~/tlon/arvo/sys/zuse.hoon.
642−
643−
644− 1. the urbit executable will not reload the .hoon files as you edit them. Neither `|reset` nor `.pill +solid` will make edits visible. Instead do this:
645− 1. in dojo: `|mount /=base=`
646− 1. in dojo: `|autoload %.y`
647− 1. at the command line : `ln -s ~/tlon/arvo/sys/zuse.hoon ~/zod/base/sys/zuse.hoon ` (make changes to both arguments of the ln command if you're editing, say, base/sys/vane/ford.hoon)
648− This does three things: it makes urbit's file system mount your own, it makes urbit scan its own filesystem for changes and load them automatically, and it keeps your zuse.hoon
649− Make a change to the hoon file. In dojo you should see `<<sync>>`. If you do not, one of the above steps was done incorrectly. If you do see this, it will be followed by any compile errors.
650− 1. Edit the hoon and try again. Keep iterating until the hoon compiles.
651−1. exit urbit with control-D
652−1. save the pill file
653− 1. cp ~/zod/.urb/put.pill ~/tlon/mypill.pill
654−
655−[ N.B. another take on explaining the above:
656−
657−Here's some things to note about the pill (and -A):
658−
659−An urbit has to boot into the Arvo kernel -- a nock core with a
660−particular interface. It'd be possible to make some ad-hoc procedure
661−to initialize Arvo, but it would be a pretty drastic layering
662−violation and couple urbit to all sorts of internal implementation
663−details of Arvo and Hoon. In contrast, the pill is basically a
664−serialized, declarative set of steps to initialize Arvo.
665−
666−Right now, the boot process is something of a hack, and the pill is
667−basically a snapshot of a pristine Arvo kernel. In the future (see
668−+metal or +brass), the pill will contain something like:
669−
670−1. a boot formula
671−1. the hoon compiler as nock
672−1. the hoon compiler as source
673−1. arvo as source
674−1. the vanes as source
675−1. userspace as source (ie, an initial %clay sync)
676−
677−For now, when you boot a ship that's not a galaxy, the initial %clay
678−filesystem is synced in from the parent ship. When you boot a galaxy,
679−you need to pass in a path to a copy of the Arvo repository so that
680−the %clay filesystem can be initialized without recourse to another
681−ship.
682−
683−Hopefully this helps to demystify these startup procedures.
684−
685−]
686−
687−
688−## Run the compiled C / compiled Hoon pill
689−
690−1. type `cd ~`
691−1. type `rm -rf zod`
692−1. type `~/tlon/urbit/build/urbit -FI zod -A ~/tlon/arvo/ -B ~/tlon/mypill.pill -c zod`.
693−
694− N.B. booting should not take more than about 90 seconds. If it
695− goes longer than that you might have created a 'poison pill', which
696− hangs things. Try booting without the -B flag, and/or reverting
697− your hoon changes, generating a new pill based on that, and
698− launching urbit with the known-clean pill. If these steps and boot
699− in < 90 seconds, but a boot with a pill created from your own hoon
700− does not, you have a hoon bug of some sort.
701−
702− Hoon bugs that disable booting can be as simple as the wrong number
703− of spaces. Many, but not all of them, will result in compile
704− errors during the `.pill +solid` step. If your booting takes > 90
705− seconds, abort it, and look at your hoon. Do a git diff, and
706− remove half the edits. Run through the entire process again. If
707− booting from the pill still hangs, remove half of what remains. Do
708− a binary search to find the precise error.
709−
710−1. inside dojo: `|reset`
711−1. You now have created a galaxy fakezod, on its own detached network, running your own strange variant of the OS.
712−1. inside dojo: `(make-k:secp256k1:secp:crypto `@uvI`12 33)` # or whatever command runs the hoon you're jetting
713−1. do your development work
714−1. If you happen to exit, you can restart with
715− `urbit -FI zod zod`
716−
717−To expand:
718−* F means "fake"
719−* I means "run as galaxy zod"
720−* the final argument is the unix directory holding the files for the galaxy
721−
722−## Run the jetted code and compare to the non jetted code
723−
724−You are now running your jetted code in a fake zod.
725−
726−It would be convenient to fire up a second urbit in a terminal next to your fake zod, this one using non-jetted hoon.
727−
728−Then you can run identical commands in each, in parallel, and confirm that they do the same thing.
729−
730−1. edit ~/tlon/urbit/jets/e/secp.c (or whatever) to include `fprintf(stderr, "*** u3we_sign 2\n");`
731−(or similar) in your jetted functions. This will let us verify that the jets exist and are running.
732−1. `cd ~/tlon/ubit ; scripts/build `
733−
734−1. `cp ~/tlon/arvo ~/tlon/arvo_nojet`
735−
736−1. edit ~/tlon/arvo_nojet/sys/zuse_nojetting.hoon to remove jetting
737−
738−1. Because we can not run two instances of the same fake galaxy on the
739−same machine (their ports would conflict), we need to pick a new
740−galaxy name. Galaxy names are not arbitrary. You may not name your
741−galaxy "mygalaxy", "withjet", "withoutjet", or anything like that.
742−Galaxy names are restricted to the range 0-255, converted into
743−pronounceable syllables. 'Zod' is just the pronunciation of '0' ( to
744−see this, in a dojo, cast ~zod to an untyped atom thusly: `@`~zod).
745−Let's pick 1 as our new galaxy id. Use dojo to convert this into a
746−urbit name: `@p`1 yields ~nec.
747−
748−1. Open a new terminal. In that terminal: `cd ~ ; rm -rf nec ; ~/tlon/urbit/build/urbit -FI nec -A ~/tlon/arvo_nojetting/ -c nec`
749−1. This should take < 90 seconds.
750−1. inside your urbit, from the dojo command line, load the hoon files and compile them into a pill file:
751− ` .pill +solid`
752−1. This should take < 90 seconds.
753−1. exit urbit with control-D
754−1. save the pill file
755−1. type `cp ~/nec/.urb/put.pill ~/tlon/mypill_nojetting.pill `
756−1. type `cd ~`
757−1. type `rm -rf nec`
758−1. type `~/tlon/urbit/build/urbit -FI nec -A ~/tlon/arvo_nojetting/ -B ~/tlon/mypill_nojetting.pill -c nec`
759−
760−
getting-started.udonnew file+10
@@ -0,0 +1,10 @@
1+:- :~ navhome/'/docs/'
2+ sort/'2'
3+ title/'Using'
4+ ==
5+;>
6+
7+# Getting Started
8+
9+These short guides will get you installed, setup, and will walk you through the
10+basic features of Urbit.
getting-started/.azimuth.udon.swpnew file

Binary file not shown.

getting-started/azimuth.udonnew file+8
@@ -0,0 +1,8 @@
1+:- :~ title/'Azimuth'
2+ ==
3+;>
4+
5+# Using Azimuth
6+
7+[PLACEHOLDER]
8+
getting-started/azimuth/managing.udonnew file+6
@@ -0,0 +1,6 @@
1+;>
2+
3+
4+# doy
5+
6+stuff
getting-started/azimuth/using-bridge.udonnew file+6
@@ -0,0 +1,6 @@
1+;>
2+
3+
4+# doy
5+
6+stuff
getting-started/installation.udonnew file+414
@@ -0,0 +1,414 @@
1+:- :~ title/'Installation'
2+ preview/'Want to get Urbit running? Look here.'
3+ sort/'1'
4+ ==
5+;>
6+
7+# Installation
8+
9+This guide is broken into five parts:
10+
11++ [Acquiring an Urbit Identity](#acquire)
12++ [Using Bridge](#bridge)
13++ [Installing Arvo](#arvo)
14++ [Booting Your Ship](#boot)
15++ [Basic Operations](#operation)
16+
17+_If you just want to install the Urbit OS, Arvo, and don't need to be on the
18+Urbit network, you can skip to [Installing Arvo](#arvo)._
19+
20+;=
21+ ;h2
22+ ;div(id "acquire"): Acquiring an Urbit Identity
23+ ==
24+==
25+
26+Urbit's identity layer, called Azimuth, is a suite of contracts on the Ethereum
27+blockchain. An Azimuth address, called a *point*, functions as an identity and
28+a network address for Arvo, the Urbit OS. An instance of Arvo is called a
29+*ship*. A ship can't use the Arvo network until it's combined with a point.
30+
31+Throughout this guide, we'll refer to \"Urbit identities\" and \"points\"
32+interchangeably.
33+
34+Points are generally not freely available, so you will need to either
35+purchase one or get one from a friend. This guide assumes you have found a way
36+to acquire a point.
37+
38+If you went through the address registration process and used [Wallet Generator](https://github.com/urbit/urbit-wallet-generator),
39+then you should have have received a .zip file that contains an Ethereum address
40+and cryptographic secrets in the form of a PDF.
41+
42+Your ownership PDF contains two secrets that must be kept safe.
43+
44+- *Master Ticket*: This is a master key that allows you to manage every aspect of
45+ your address.
46+
47+- *Ownership Seed BIP39 Mnemonic*: The master ticket encoded as a BIP39 mnemonic
48+ for compatibility with most Ethereum wallet software, including our own *Bridge*
49+ client.
50+
51+;=
52+ ;h2
53+ ;div(id "bridge"): Using Bridge
54+ ==
55+==
56+
57+Bridge is client that we built for accessing and managing your Urbit identities.
58+Like Wallet Generator, Bridge is a web application that can also be run in offline mode.
59+It can be run in Firefox on all platforms, and also in Chrome if you're using
60+a Mac.
61+
62+Importantly, Bridge also allows you to generate a keyfile that
63+you will need to boot your ship on the Arvo network for the first time. Once a ship
64+with a keyfile, you can restart it later without the keyfile.
65+
66+*Note* Bridge allows you to make _writes_ to the blockchain, but we ask you to confirm
67+anything that will incur a transaction cost. If you plan to do anything heavy-duty, make
68+sure your Ethereum address has some pocket ETH.
69+
70+Download bridge [here](https://github.com/urbit/bridge/releases) and follow
71+the instructions below.
72+
73+#### Step 1: Welcome
74+
75+Click `Open a Wallet`.
76+
77+#### Step 2: Select a Network
78+
79+On the dropdown menu, make sure that `Main Network` is selected. Then click
80+`Continue ->`.
81+
82+#### Step 3: Open a Wallet
83+
84+On this dropdown menu, choose how you'd like to access your Ethereum wallet.
85+If you aren't using a hardware wallet (we support Ledger and Trezor), you'll
86+want to use your Ethereum wallet's BIP39 Mnemonic.
87+
88+If you used Wallet Generator to generate an HD wallet, you have a few choices:
89+you can choose `Urbit Master Ticket,` which is high-value, but allows you unfettered
90+permissions to update your point. The mnemonic associated with your management
91+seed is also useful to perform everyday operations (such as boot your ship!).
92+
93+Select the appropriate option and click `Continue ->`.
94+
95+#### Step 4: (optional) Accept Your Transfer
96+
97+If you were sent a point by a friend, then you should see a graphic under
98+`Incoming Transfers`. Click the `Details ->` link under that graphic.
99+
100+Now you'll be on the management page of your point. The transfer isn't completed
101+yet, so click `Accept incoming transfer`. Then check both boxes and and click
102+their associated `Sign Transaction` and `Send Transaction` buttons.
103+
104+If you already own a point, then click on the `Details ->` under your sigil in the
105+`Your Points` section.
106+
107+#### Step 5: (optional) Set Your Networking Keys
108+
109+If you just accepted a point, you'll be returned to your point screen. Notice that
110+that links and buttons are now clickable. You now own this point!
111+
112+Click the link that says `Generate Urbit networking keys`. Bridge will let you either
113+download a keyfile derived from your networking keys are you can paste in your own
114+network seed and derive a new keyfile. See our
115+[HD Wallet Spec](https://github.com/urbit/proposals/blob/master/proposals/8.md)
116+for more information.
117+
118+#### Step 6: Generate Your Keyfile
119+
120+From the detail page associated with your point, click the `Generate Urbit Keyfile`
121+button and you'll be taken to a page with a field titled `Network key`. If you went
122+through the address registration process, this should be filled in already.
123+Click `Generate ->`, which will download a keyfile onto your machine.
124+
125+With that keyfile in hand, you can now exit Bridge.
126+
127+;=
128+ ;h2
129+ ;div(id "arvo"): Installing Arvo
130+ ==
131+==
132+
133+Now you're ready to run Arvo. You're almost there!
134+
135+But first, some terminology:
136+- `vere` or `urbit`: the interpreter that runs when you run a command like `urbit` or `/bin/urbit` in your command line
137+- `arvo`: the deterministic OS that lives in a directory whose name matches your Azimuth point, ie `~famreb-todmec` lives in `/famreb-todmec`
138+
139+Arvo runs nicely on a Unix-like operating system -- Ubuntu,
140+Fedora, macOS, and FreeBSD. If you're using Windows, you'll need
141+to get one of the aforementioned systems. Don't worry: most of them are free.
142+
143+We have different installation instructions for different platforms. To install
144+and run Arvo, run the commands that are listed for your operating system.
145+
146+On any platform, you can check your Arvo installation by running the `urbit`
147+command. Installation was successful if you get a block of output that begins
148+with the line below:
149+
150+```
151+Urbit: a personal server operating function
152+```
153+
154+#### MacOS
155+
156+We recommend using the Homebrew package manager to run Arvo on MacOS.
157+
158+```
159+#Bash
160+
161+brew update
162+brew install autoconf automake cmake gcc git gmp libsigsegv libtool meson ninja pkg-config python2 openssl re2c
163+git clone https://github.com/urbit/urbit
164+cd urbit
165+./scripts/bootstrap
166+./scripts/build
167+sudo ninja -C ./build/ meson-install
168+urbit
169+```
170+
171+#### Ubuntu or Debian
172+
173+```
174+# Bash
175+
176+sudo apt-get update
177+sudo apt-get install autoconf automake cmake exuberant-ctags g++ git libcurl4-gnutls-dev libgmp3-dev libncurses5-dev libsigsegv-dev libssl-dev libtool make openssl pkg-config python python3 python3-pip ragel re2c zlib1g-dev
178+sudo -H pip3 install --upgrade pip
179+sudo -H pip3 install meson==0.29
180+
181+# we need ninja 1.5.1
182+# 'apt-get install ninja-build' gives us 0.1.3
183+# 'apt-get install ninja-build' gives us 1.3.4
184+#
185+git clone git://github.com/ninja-build/ninja.git
186+pushd ninja
187+ git checkout release
188+ ./configure.py --bootstrap
189+ sudo cp ./ninja /usr/local/bin
190+popd
191+
192+
193+git clone https://github.com/urbit/urbit
194+cd urbit
195+./scripts/bootstrap
196+./scripts/build
197+sudo ninja -C ./build/ install
198+urbit
199+```
200+
201+#### Fedora
202+
203+```
204+# Bash
205+
206+sudo yum upgrade
207+sudo yum install autoconf automake cmake ctags gcc gcc-c++ git gmp-devel libcurl-devel libsigsegv-devel libtool ncurses-devel ninja-build openssl openssl-devel pkgconfig python2 python3 ragel re2c wget
208+
209+# meson requires python 3.5; RHEL supplies wrong version
210+pushd /usr/src
211+ sudo wget https://www.python.org/ftp/python/3.5.5/Python-3.5.5.tgz
212+ sudo tar xzf Python-3.5.5.tgz
213+ cd Python-3.5.5
214+ sudo ./configure --enable--optimizations
215+ sudo make altinstall
216+ which python3.5
217+ cd /usr/local/bin
218+ sudo ln -s python3.5 python3
219+ hash python3
220+popd
221+
222+curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
223+sudo /usr/local/bin/python3 get-pip.py
224+# downgrade meson to avoid dependencies that redhat can't meet
225+sudo -H /usr/local/bin/pip3 install meson==0.29
226+
227+
228+git clone git://github.com/ninja-build/ninja.git && cd ninja
229+git checkout release
230+./configure.py --boostrap
231+sudo cp ./ninja /usr/local/bin
232+
233+git clone https://github.com/urbit/urbit
234+cd urbit
235+./scripts/bootstrap
236+./scripts/build
237+sudo /usr/local/bin/ninja -C ./build/ install
238+urbit
239+```
240+
241+#### Arch Linux
242+
243+```
244+# Bash
245+
246+sudo pacman -Syu
247+sudo pacman -S autoconf automake cmake curl gcc git gmp libsigsegv libtool ncurses ninja openssl python ragel re2c
248+curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
249+sudo python3 get-pip.py
250+git clone https://github.com/urbit/urbit
251+cd urbit
252+./scripts/bootstrap
253+./scripts/build
254+sudo ninja -C ./build/ meson-install
255+urbit
256+```
257+
258+If you just want to use a fake ship for development purposes, you can now use
259+the command of the scheme below to boot a fake `~zod`.
260+
261+```
262+urbit -F zod -A /path/to/arvo -s -c zod
263+```
264+
265+If you want to get on the Arvo network with your point, then continue to the
266+next section.
267+
268+
269+;=
270+ ;h2
271+ ;div(id "boot"): Booting Your Ship
272+ ==
273+==
274+
275+
276+Now the rubber meets the road. You'll be booting your ship with the keyfile
277+that you downloaded from Bridge.
278+
279+#### Step 1: Find Your Point's Name
280+
281+This will look something like `~lodleb-ritrul`. You can see the name of your
282+point(s) when you log into your wallet using the Bridge client.
283+
284+;img@"http://media.urbit.org/site/bridge-0.png"(width "100%");
285+
286+#### Step 2: Find the path to your keyfile
287+
288+Find the absolute path to the keyfile that you downloaded from Bridge. Copy it.
289+
290+#### Step 3: Run the boot command
291+
292+Type `cd` in your terminal to return to your home directory. If you want to
293+store your ship somewhere besides your home directory, change the terminal's
294+working directory to the desired directory.
295+
296+Run the command below, except with `~sample-planet` replaced by the name of your
297+Urbit identity, and `path/to/my-planet.key` replaced with the path to your
298+keyfile:
299+
300+```
301+urbit -w ~sample-planet -k path/to/my-planet.key
302+```
303+
304+if you'd prefer to copy your key in you can run
305+
306+```
307+urbit -w ~sample-planet -G rAnDoMkEy
308+```
309+
310+
311+This will create a directory called `sample-planet/` and begin building your
312+ship. It may take a few minutes.
313+
314+When your ship is finished booting, you will see the `~sample-planet:dojo>`
315+prompt. At that point, you should permanently erase your keyfile from your
316+machine.
317+
318+;=
319+ ;h2
320+ ;div(id "operation"): Basic Operations
321+ ==
322+==
323+
324+Welcome to your urbit! There's a few things you should do to become oriented.
325+
326+#### Dojo
327+
328+Let's try out the Dojo, the Arvo command line and Hoon REPL:
329+
330+```
331+~sample-planet:dojo> (add 2 2)
332+```
333+
334+Should produce:
335+
336+```
337+> (add 2 2)
338+4
339+```
340+
341+Good.
342+
343+#### Mounting
344+
345+Clay, the Arvo filesystem, isn't mounted to Unix by default. Switch to the Dojo
346+prompt and run:
347+
348+```
349+~sample-planet:dojo> |mount %
350+```
351+
352+This should produce:
353+```
354+> |mount %
355+>=
356+```
357+
358+which indicates that the command was processed.
359+
360+`|mount %` will cause a `home/` directory to appear inside your _pier_ folder in
361+Unix (the "pier" is our shorthand for the directory whose name corresponds to your Azimuth point). Changes to these files are automatically synced into your ship.
362+
363+
364+#### Talk
365+
366+Use `ctrl-x` to toggle between the Dojo and the Talk prompts.
367+
368+While on the Talk prompt, let's join the main Urbit support chat channel, `/urbit-help`:
369+
370+```
371+~sample-planet:talk[] ;join /urbit-help
372+```
373+
374+Talk is stateful, so your ship will download a backlog. `/urbit-help` is the
375+place to ask questions about getting up and running.
376+
377+#### Shutting Down and Restarting
378+
379+You can turn your ship off with `ctrl-d` from the Talk or Dojo prompts.
380+
381+To restart your ship, simply pass the name of your pier:
382+
383+```
384+$ urbit some-planet
385+```
386+
387+#### Landscape
388+
389+Your ship is also accessible through its own web interface. Through the web
390+interface you'll have access to our chat and message boards, the two components
391+of our _Landscape_ feature. This is a user-friendly way to chat with Talk on the
392+Arvo network and access and materials you've published on your ship. If You're
393+running Arvo locally on your own machine, try opening `http://localhost/` in
394+your browser.
395+
396+Or if you're running your ship on a cloud instance with a static IP address
397+(which we recommend!), something like 212.131.240.20, assuming you've opened up
398+the HTTP port that Arvo uses -- the default is port 80. So
399+`http://212.131.240.20:80/~~/` would go into your browser's URL bar.
400+
401+This way, if you keep your ship running securely in the cloud (usually in a
402+screen or tmux session), you can always access your ships's web interface in any
403+browser on any device, so long as you have your password on hand.
404+
405+The `/~~/` in the URL will redirect you to a login page, which was generated by
406+Tree, the basic Arvo web interface. The page will tell you to run the +code
407+generator (an Arvo shell script) in your Dojo to get your password. Copy and
408+paste that into your password input box and hit Enter. After loading, you'll
409+find yourself redirected to your home page, authenticated, where you can then
410+use the navigation bar at the top of the page to visit your Talk web interface
411+and static files.
412+
413+When you use the web interface, your urbit is automatically subscribed to
414+`/urbit-meta` and Fora, our message-board system.
getting-started/landscape.udonnew file+9
@@ -0,0 +1,9 @@
1+:- :~ title/'Landscape'
2+ sort/'3'
3+ ==
4+;>
5+
6+# Landscape
7+
8+[PLACEHOLDER]
9+
getting-started/landscape/desktop.udonnew file

No changes to the content.

getting-started/landscape/mobile.udonnew file

No changes to the content.

introduction.udonnew file+47
@@ -0,0 +1,47 @@
1+:- :~ navhome/'/docs/'
2+ sort/'1'
3+ title/'Introduction'
4+ type/'post'
5+ ==
6+;>
7+
8+# Introduction
9+
10+<<<<<<< HEAD
11+Welcome to the documentation for the Urbit project, including the Azimuth identity layer, the Arvo operating system, and the Hoon programming language. This documentation is maintained by [Tlon](https://tlon.io) in a public [Github repository](https://github.com/urbit/docs). Issues and contributions are welcome.
12+
13+The documentation is organized into four high-level sections, and further divided between Azimuth and Arvo. Read on to get acquainted.
14+
15+## [Introduction](docs/introduction)
16+
17+If you're looking for a high-level introduction to the Urbit project and its components, start here.
18+
19+- See [Technical Overview](docs/introduction/technical-overview) for an in-depth description of Urbit.
20+- See [Contributing](docs/introduction/contributing) for a guide to getting involved with the Urbit project.
21+
22+## [Getting Started](docs/getting-started)
23+
24+If you'd like to install Arvo, get an Azimuth point, and/or get on the Urbit network, you'll find guides here. Dive in, and don't be afraid to [ask for help](support@urbit.org)!
25+
26+- [Get started with Azimuth](docs/getting-started/azimuth), the identity system.
27+- [Get started with Arvo](docs/getting-started/arvo), the Urbit OS.
28+
29+## [Learn](docs/learn)
30+
31+If you're interested in contributing to the Urbit project, building applications, or understanding the system technically, find tutorials and explanations of all the compontents of the system.
32+
33+- If you want to dive into learning Urbit, we recommend starting with the [Hoon Tutorial](docs/learn/arvo/hoon).
34+- For Arvo internals, start at [Arvo](docs/learn/arvo).
35+
36+## [Reference](docs/reference)
37+
38+If you're a developer looking for Arvo reference documentation, this section is for you.
39+
40+- Confused about all the new words? Check out the [Glossary](docs/reference/glossary).
41+- Don't miss the helpful Hoon rune [Cheat Sheet](docs/reference/cheat-sheet).
42+=======
43+Urbit is a new software stock for
44+
45+Learn more about the Urbit project here before delving deeper into the developer
46+documentation.
47+>>>>>>> 00f3572eae751223638daa96d6689323ec024b2a
introduction/arvo-vs-azimuth.udonnew file+30
@@ -0,0 +1,30 @@
1+:- :~ title/'Arvo vs. Azimuth'
2+ ==
3+;>
4+
5+# Arvo vs. Azimuth
6+
7+*Arvo* is the Urbit operating system. *Azimuth* is the decentralized ledger
8+that keeps track of identities that are required to use the Arvo network.
9+*Urbit* is the holistic system composed of both Arvo and Azimuth.
10+
11+The Arvo network is composed of virtual machines running our software stack.
12+Using a blockchain for this kind of computing is impossible: there's far too
13+much data involved in an operating system to run on top of a distributed
14+consensus mechanism. And you don't want your private information on a public
15+ledger. The Arvo network is not on a blockchain.
16+
17+But, being a decentralized system, we need some way to cryptographically secure
18+and authenticate your identity on the Arvo network. What keeps track of who
19+owns any given identity? Well, simply matching something to an address is a
20+small piece of computing, and a blockchain are wonderful for such a purpose.
21+That's where the Azimuth comes in.
22+
23+We chose to build Azimuth on the Ethereum blockchain because smart contracts are
24+well-suited for the peculiarities of the identities. Urbit identities
25+are owned by Ethereum addresses.
26+
27+Azimuth and the Arvo network are parallel systems. Azimuth isn't necessarily
28+Arvo-related; it can be used as a generalized identity system for other
29+projects. Azimuth is the equivalent of a bank vault that storess sthe deed to your
30+house. The Arvo network is the neighborhood that you live in.
introduction/community.udonnew file+19
@@ -0,0 +1,19 @@
1+:- :~ navhome/'/docs/'
2+ next/'false'
3+ sort/'9'
4+ title/'Community Tutorials'
5+ ==
6+;>
7+
8+# Community docs
9+
10+Here are some tutorials written by members of the Urbit community. Some are a little outdated, but they may still prove useful.
11+
12+- `~master-morzod`
13+ - [Fora post](https://urbit.org/fora/posts/~2016.12.25..06.35.44..a1ec~/)
14+- `~hidduc-posmeg`
15+ - [Fora post](https://urbit.org/fora/posts/~2017.2.12..21.54.40..6fde~/)
16+- `~palfun-foslup`
17+ - [Urbit by Doing](https://github.com/Fang-/Urbit-By-Doing)
18+- `@knubie`
19+ - [Learning Hoon](https://github.com/knubie/learning-hoon)
docs/about/contributing.md → introduction/contributing.udonrenamed+9−11
@@ -1,9 +1,9 @@
1−---
2−navhome: /docs/
3−navuptwo: true
4−sort: 4
5−title: Contributing
6−---
1+:- :~ navhome/'/docs/'
2+ navuptwo/'true'
3+ sort/'3'
4+ title/'Contributing'
5+ ==
6+;>
77
88# Contributing
99
@@ -15,8 +15,6 @@ for improving our [code](https://github.com/urbit/urbit/) and
1515
1616Our official guide to contributing can be found
1717[here](https://github.com/urbit/urbit/blob/master/CONTRIBUTING.md),
18−which is most useful for large and low-level changes. For simpler
19−revisions, refer to [Hoon Syntax](../../hoon/syntax) for an in-depth guide to
20−good Hoon. Alternatively, [browse the
21−source](https://github.com/urbit/arvo/).
22−
18+which is most useful for large and low-level changes. For a good example of
19+preferred Hoon coding style, see
20+[ford.hoon](https://github.com/urbit/arvo/blob/master/sys/vane/ford.hoon).
introduction/overview.udonnew file+173
@@ -0,0 +1,173 @@
1+:- :~ navhome/'/docs/'
2+ navuptwo/'true'
3+ next/'true'
4+ sort/'1'
5+ title/'Technical overview'
6+ ==
7+;>
8+
9+# Technical overview
10+
11+Urbit is a clean-slate software stack designed to implement an encrypted P2P
12+network of general-purpose personal servers. Each server on this network is a
13+deterministic computer called an 'urbit' that runs on a Unix-based virtual
14+machine.
15+
16+The current Urbit stack includes (among other things):
17+
18+- Arvo: the functional operating system of each urbit, written in Hoon.
19+- Hoon: a strictly typed functional programming language whose standard library
20+ includes a Hoon-to-Nock compiler.
21+- Nock: a low-level combinator language whose formal specification fits readably on a t-shirt.
22+- Vere: a Nock interpreter and Unix-based virtual machine that mediates between
23+ each urbit and the Unix software layer.
24+
25+## Anatomy of a personal server
26+
27+Your urbit is a deterministic computer in the sense that its state is a pure
28+function of its event history. Every event in this history is a
29+[transaction](https://en.wikipedia.org/wiki/Transaction_processing); your
30+urbit's state is effectively an [ACID database](https://en.wikipedia.org/wiki/ACID).
31+
32+Because each urbit is deterministic we can describe its role appropriately in
33+purely functional terms: it maps an input event and the old urbit state to a
34+list of output actions and the subsequent state. This is the Urbit transition
35+function.
36+
37+```
38+<input event, old state> -> <output actions, new state>
39+```
40+
41+For example, one input event could be a keystroke from the terminal, say
42+`[enter]` after having already typed `(add 2 2)`; and an output action could be
43+to print in the terminal window the resulting value of a computation performed
44+when the user hit `[enter]`, in this case `4`. The input event is stored in the
45+urbit's event history.
46+
47+Events always start from outside of your urbit, whether they're local to the
48+computer running the urbit (e.g., a keystroke in the terminal) or they originate
49+elsewhere (e.g., a packet received from another urbit). When an event is
50+processed, various parts of the urbit state can be modified before the resulting
51+list of output actions is returned.
52+
53+Can output actions from your urbit cause side-effects in the outside world?
54+The answer had better be "yes," because a personal server without side effects
55+isn't useful for much. In another sense the answer had better be "no," or else
56+there is a risk of losing functional purity; your urbit cannot _guarantee_ that
57+the side effects in question actually occur. What's the solution?
58+
59+Each urbit is
60+[sandboxed](https://en.wikipedia.org/wiki/Sandbox_(computer_security%29) in a
61+virtual machine, Vere, which runs on Unix. Code running in your urbit cannot
62+make Unix system calls or otherwise directly affect the underlying platform.
63+Strictly speaking, internal urbit code can only change internal urbit state; it
64+has no way of sending events outside of its runtime environment. Functional
65+purity is preserved.
66+
67+In practical terms, however, you don't want your urbit to be an impotent
68+[brain in a vat](https://en.wikipedia.org/wiki/Brain_in_a_vat). That's why
69+Vere also serves as the intermediary between your urbit and Unix. Vere observes
70+the list of output events, and when external action is called for makes the
71+appropriate system calls itself. When external events relevant to your urbit
72+occur in the Unix layer, Vere encodes and delivers them as input events.
73+
74+### Arvo
75+
76+Arvo is a purely functional, [non-preemptive](https://en.wikipedia.org/wiki/Cooperative_multitasking)
77+OS, written in Hoon, that serves as the event manager of your urbit.
78+It can upgrade itself from over the network without downtime. The Arvo kernel
79+proper is quite simple -- it's only about 600 lines of code, excluding its
80+various modules.
81+
82+The Urbit transition function is implemented in Arvo. Upon being 'poked' by
83+Vere with the pair of `<input event, state>`, Arvo directs the event to the
84+appropriate OS module. The result of each Vere 'poke' is a pair of
85+`<output events, new state>`. Events are typed, and each has an explicit
86+call-stack structure indicating the event's source module in Arvo.
87+
88+Arvo modules are also called 'vanes'. Arvo's vanes are:
89+
90+- Ames: defines and implements Urbit's encrypted P2P network protocol, as well
91+ as Urbit's identity protocol.
92+- Behn: manages timer events for other vanes.
93+- Clay: global, version-controlled, and referentially-transparent file system.
94+- Dill: terminal driver.
95+- Eyre: HTTP web client and server.
96+- Ford: typed functional build system.
97+- Gall: application sandbox and manager.
98+ - Dojo (app): Shell and Hoon REPL.
99+ - Talk (app): Chat client.
100+
101+### Hoon
102+
103+Hoon is a strictly typed functional programming language that compiles itself
104+to Nock and is designed to support higher-order functional programming without
105+requiring knowledge of category theory or other advanced mathematics. Haskell
106+is fun but it isn't for everybody.
107+
108+Hoon aspires to a concrete, imperative feel. To discourage the creation of
109+write-only code, Hoon forbids user-level macros and uses ASCII digraphs instead
110+of keywords. The type system infers only forward and does not use unification,
111+but is not much weaker than Haskell's. The compiler and inference engine is
112+about 3000 lines of Hoon.
113+
114+### Nock
115+
116+Nock is a low-level [homoiconic](https://en.wikipedia.org/wiki/Homoiconicity)
117+combinator language. It's so simple that its [specification](../../nock/definition)
118+fits on a t-shirt. In some ways Nock resembles a nano-Lisp but its ambitions
119+are more narrow. Most Lisps are one-layer: a practical language is to be
120+created by extending a theoretically simple interpreter. The abstraction is
121+simple and the implementation is practical. Unfortunately it's far more difficult
122+to enforce both simplicity and practicality in an actual Lisp codebase. Hoon
123+and Nock are two layers: Hoon, the practical layer, compiles itself to Nock, the
124+simple layer. Your urbit runs in Vere, which includes a Nock interpreter, so it
125+can upgrade Hoon over the network without downtime.
126+
127+The Nock data model is quite simple. Every piece of data is a 'noun'. A noun
128+is an atom or a cell. An atom is any unsigned integer. A cell is an ordered
129+pair of nouns. Nouns are acyclic and expose no pointer equality test.
130+
131+### Vere
132+
133+Vere is the Nock runtime environment and Urbit VM. It's written in C, runs on
134+Unix, and is the intermediate layer between your urbit and Unix. As noted
135+earlier, Unix system calls are made by Vere, not Arvo; Vere must also encode
136+and deliver relevant external events to Arvo. Vere is also responsible for
137+implementing jets and maintaining the persistent state of each urbit.
138+
139+In principle, Vere keeps a comprehensive log of every event from the time you
140+initially booted your urbit. What happens if the physical machine loses power
141+and your urbit's state is 'lost' from memory? When your urbit restarts it will
142+replay its entire event history and totally recover its latest state from
143+scratch.
144+
145+In practice, event logs become large and unwieldy over time. Periodically a
146+snapshot of the permanent state is taken and the logs are pruned. You're still
147+able to rebuild your state in case of power outage, down to the last keystroke.
148+
149+Vere is not essential to the Urbit stack; one can imagine using Urbit on a
150+hypervisor, or even bare metal. One member of the community is even working on
151+an independent implementation of Urbit using Graal/Truffle on the JVM.
152+
153+The Urbit stack (compiler, standard library, kernel, modules, and applications,
154+but excluding Vere) is about 30,000 lines of Hoon. Urbit is patent-free and MIT
155+licensed.
156+
157+### Azimuth
158+
159+Azimuth is a general-purpose public-key infrastructure (PKI) on the Ethereum
160+blockchain, used as a decentralized ledger for Urbit identities that we call
161+*points*. Having a point is necessary to use the Urbit network, which makes it
162+important to have a neutral ledger to determine who owns what.
163+
164+Azimuth is not, however, part of the Urbit stack. Azimuth is a parallel system
165+that be used as a generalized identity system for other projects. Azimuth
166+"touches" the Urbit ecosystem when a point is used to boot a virtual computer
167+on the Urbit network for the first time. When that happens, the point considered
168+*linked* to Azimuth and the point’s full powers are available for use. Once a
169+point is linked, it cannot be unlinked.
170+
171+A metaphor might make the relationship between these two systems to understand:
172+Azimuth is the bank vault that stores the deed to your house. The Urbit network
173+is the neighborhood that you live in.
introduction/source.udonnew file+89
@@ -0,0 +1,89 @@
1+:- :~ navhome/'/docs/'
2+ navuptwo/'true'
3+ next/'true'
4+ sort/'2'
5+ title/'Source code'
6+ ==
7+;>
8+
9+# Source code overview
10+
11+We host all our source code on GitHub at [github.com/urbit](https://github.com/urbit).
12+
13+Since there's quite a number of repos, we'll talk about a few of the most
14+important ones here:
15+
16+;ul(class "list spaced")
17+ ;li
18+ ;h1
19+ ;a/"https://github.com/urbit/urbit"
20+ ;code: urbit/urbit
21+ ==
22+ ==
23+ This is the main Urbit repo. It contains the Urbit interpreter (all of the C code) and is the main entry point if you're going to build from source.
24+ ==
25+ ;li
26+ ;h1
27+ ;a/"https://github.com/urbit/arvo"
28+ ;code: urbit/arvo
29+ ==
30+ ==
31+ Arvo is the Urbit operating system (written in Hoon). When you boot your Urbit, you get this over the air. The source code is kept here, and you'll need it if you want to do any heavy development work.
32+ ==
33+ ;li
34+ ;h1
35+ ;a/"https://github.com/urbit/docs"
36+ ;code: urbit/docs
37+ ==
38+ ==
39+ Interesting in working on Urbit documentation? This repository is where all the collaboration happens. The docs themselves are just markdown files hosted on a live ship.
40+ ==
41+ ;li
42+ ;h1
43+ ;a/"https://github.com/urbit/urbit.org"
44+ ;code: urbit/urbit.org
45+ ==
46+ ==
47+ This is where the source code for urbit.org lives. Like the docs, the urbit.org website is just a collection of a few markdown files rendered by Tree, the Urbit web publishing system.
48+ ==
49+ ;li
50+ ;h1
51+ ;a/"https://github.com/urbit/base-css"
52+ ;code: urbit/base-css
53+ ==
54+ ==
55+ We're working on a new Urbit style guide for urbit.org, the docs and Urbit web apps. If you're into visual design or are a CSS fanatic, jump in here.
56+ ==
57+ ;li
58+ ;h1
59+ ;a/"https://github.com/urbit/constitution"
60+ ;code: urbit/constitution
61+ ==
62+ ==
63+ We're [bootstrapping Urbit from Ethereum](https://urbit.org/blog/2017.9-eth/). This means formally defining the Urbit governance model and public-key infrastructure formally in a simple smart contract deployed on the Ethereum blockchain. If you're into Solidity, or just want to see how this works, check out this repo. Currently getting audited.
64+ ==
65+ ;li
66+ ;h1
67+ ;a/"https://github.com/urbit/etherwallet"
68+ ;code: urbit/etherwallet
69+ ==
70+ ==
71+ Urbit will soon need a secure, robust frontend interface for buying and selling Urbit address space and interacting directly with the Urbit constitution smart contract. We decided to fork MyEtherWallet, which already has strong security and support for things like multisig and hardware wallet, and modify it to support Urbit. Dive in!
72+ ==
73+ ;li
74+ ;h1
75+ ;a/"https://github.com/urbit/tree"
76+ ;code: urbit/tree
77+ ==
78+ ==
79+ Tree is the main Urbit web interface written as a React/Flux app in CoffeeScript. We're working on porting this to ES6 and simplifying the architecture generally. If you're into frontend frameworks and web apps, reach out to us and we'll help you get started.
80+ ==
81+ ;li
82+ ;h1
83+ ;a/"https://github.com/urbit/talk"
84+ ;code: urbit/talk
85+ ==
86+ ==
87+ The main web interface for Urbit's distributed chat and notifications protocol. Currently, like Tree, a simple React/Flux app written in CoffeeScript. With lots of changes happening to the Talk Hoon backend app in the coming releases, our frontend Talk interface will need a lot of development and design work. We've also started the process of porting this to ES6. Ask us how you can start helping out!
88+ ==
89+==
learn.udonnew file+10
@@ -0,0 +1,10 @@
1+:- :~ navhome/'/docs/'
2+ sort/'3'
3+ title/'Learn'
4+ ==
5+;>
6+
7+# Learn
8+
9+Whether you want to learn to program in Hoon, walk through the Nock spec, or learn how to use Hoon to interact with Arvo, this is your destination.
10+
learn/.arvo.udon.swpnew file

Binary file not shown.

docs/arvo/internals.md → learn/arvo.udonrenamed+36−39
@@ -1,17 +1,17 @@
1−---
2−navhome: /docs/
3−next: false
4−sort: 22
5−Title: Internals
6−---
1+:- :~ navhome/'/docs/'
2+ next/'true'
3+ sort/'80'
4+ title/'Arvo Internals'
5+ ==
6+;>
77
88# Arvo internals
99
10−Arvo is composed of modules called vanes:
10+> Note: The last major revision of these sections was in 2016. They need to be rewritten: they're outdated in some respects, and also not always as clear as they could be. A rewrite is planned. There is still plenty of good information to be found, but don't bet the farm on anything you read here.
1111
12−<list dataPreview="true"></list>
12+Arvo is composed of modules called vanes:
1313
14−<hr></hr>
14+;list;
1515
1616At a high level `%arvo` takes a mess of Unix I/O events and turns them
1717into something clean and structured for the programmer.
@@ -24,8 +24,7 @@ sync, or timer event. We push every step in the path the request takes
2424onto the chain until we get to the terminal cause of the computation.
2525Then we use this causal stack to route results back to the caller.
2626
27−`++ducts`
28−---------
27+## Ducts
2928
3029The `%arvo` causal stack is called a `++duct`. This is represented
3130simply as a list of paths, where each path represents a step in the
@@ -35,13 +34,15 @@ for Unix.
3534
3635Here's a duct that was recently observed in the wild:
3736
38− ~[
39− /g/a/~zod/4_shell_terminal/u/time
40− /g/a/~zod/shell_terminal/u/child/4/main
41− /g/a/~zod/terminal/u/txt
42− /d/term-mess
43− //term/1
44− ]
37+```
38+~[
39+ /g/a/~zod/4_shell_terminal/u/time
40+ /g/a/~zod/shell_terminal/u/child/4/main
41+ /g/a/~zod/terminal/u/txt
42+ /d/term-mess
43+ //term/1
44+]
45+```
4546
4647This is the duct the timer vane receives when "timer" sample app asks
4748the timer vane to set a timer. This is also the duct over which the
@@ -67,15 +68,16 @@ citizen. You can respond over a duct zero, one, or many times. You can
6768save ducts for later use. There are definitely parallels to Scheme-style
6869continuations, but simpler and with more structure.
6970
70−Making Moves
71−------------
71+## Making Moves
7272
7373If ducts are a call stack, then how do we make calls and produce
7474results? Arvo processes "moves" which are a combination of message data
7575and metadata. There are two types of moves. A `%pass` move is analogous
7676to a call:
7777
78− [duct %pass return-path=path vane-name=@tD data=card]
78+```
79+[duct %pass return-path=path vane-name=@tD data=card]
80+```
7981
8082Arvo pushes the return path (preceded by the first letter of the vane
8183name) onto the duct and sends the given data, a card, to the vane we
@@ -84,13 +86,14 @@ specified. Any response will come along the same duct with the path
8486
8587A `%give` move is analogous to a return:
8688
87− [duct %give data=card]
89+```
90+[duct %give data=card]
91+```
8892
8993Arvo pops the top path off the duct and sends the given card back to the
9094caller.
9195
92−Vanes
93−-----
96+## Vanes
9497
9598As shown above, we use Arvo proper to route and control the flow of
9699moves. However, Arvo proper is rarely directly responsible for
@@ -103,21 +106,15 @@ well-defined, stable, and general-purpose piece of functionality.
103106As of this writing, we have seven vanes, which each provide the
104107following services:
105108
106−- `%ames`: the name of both our network and the vane that communicates over
107− it.
108−- `%behn`: a simple timer.
109−- `%clay`: our version-controlled, referentially- transparent, and global
110− filesystem.
111−- `%dill`: a terminal driver. Unix sends keyboard events to `%dill` from
112− either the console or telnet, and `%dill` produces terminal output.
113−- `%eyre`: an http server. Unix sends http messages to `%eyre`, and
114− `%eyre` produces http messages in response.
115−- `%ford`: handles resources and publishing.
116−- `%gall`: manages our userspace applications. `%gall` keeps state and
117− manages subscribers.
118−
119−Cards
120−-----
109+- `%ames`: the name of both our network and the vane that communicates over it.
110+- `%behn`: a simple timer.
111+- `%clay`: our version-controlled, referentially- transparent, and global filesystem.
112+- `%dill`: a terminal driver. Unix sends keyboard events to `%dill` from either the console or telnet, and `%dill` produces terminal output.
113+- `%eyre`: an http server. Unix sends http messages to `%eyre`, and `%eyre` produces http messages in response.
114+- `%ford`: handles resources and publishing.
115+- `%gall`: manages our userspace applications. `%gall` keeps state and manages subscribers.
116+
117+## Cards
121118
122119Cards are the vane-specific portion of a move. Each vane defines a
123120protocol for interacting with other vanes (via Arvo) by defining four
docs/using/admin.md → learn/arvo/admin.udonrenamed+76−40
@@ -1,23 +1,25 @@
1−---
2−navhome: /docs/
3−navuptwo: true
4−next: true
5−sort: 3
6−title: Administration and operation
7−---
1+:- :~ navhome/'/docs/'
2+ navuptwo/'true'
3+ next/'true'
4+ sort/'3'
5+ title/'Admin and Operations'
6+ ==
7+;>
88
9−# Administration and operation
9+# Admin and operation
1010
11−Your Urbit is a persistent Unix process that you mainly control from the
12−console. For some things, a browser will also work.
11+Your urbit (also called your _ship_) is a persistent Unix process that you
12+mainly control from the console. For some things, a browser will also work.
1313
1414## Shutdown
1515
16−You can turn your Urbit off with `Ctrl-d` from the Talk or Dojo prompts.
16+You can turn your urbit off with `Ctrl-d` from the Talk or Dojo prompts.
17+
18+You can force-quit your urbit with `Ctrl-z` from anywhere.
1719
1820## Restart
1921
20−To restart your Urbit simply pass the name of your pier:
22+To restart your urbit simply pass the name of your pier:
2123
2224```
2325$ urbit some-planet
@@ -31,7 +33,7 @@ $ urbit comet
3133
3234## Logging
3335
34−To log Urbit's command line output to a file, use `script`:
36+To log an urbit's command line output to a file, use `script`:
3537
3638```
3739$ script urbit.log urbit your-urbit
@@ -39,14 +41,13 @@ $ script urbit.log urbit your-urbit
3941
4042## Moving your pier
4143
42−Piers are designed to be portable, but it _must_ be done while the Urbit
44+Piers are designed to be portable, but it _must_ be done while the urbit
4345is turned off. Urbit networking is stateful, so you can't run two copies
44−of the same Urbit in two places.
46+of the same urbit in two places.
4547
4648To move a pier, simply move the contents of the directory it lives in.
4749To keep these files as small as possible we usually use the `--sparse`
48−option in `tar`. With a pier `your-urbit/` something like this (from
49−inside `urbit/`) should work:
50+option in `tar`. With a pier `your-urbit/`, something like this should work:
5051
5152```
5253tar -Scvzf ~/your-urbit.tar.gz ~/your-urbit/
@@ -73,16 +74,19 @@ line) and the record (everything above that). The record is shared; all
7374the output from all the apps in your command set appears in it. The
7475prompt is multiplexed.
7576
76−In the CLI Urbit apps can process your input before you hit return. To
77+In the CLI, Urbit apps can process your input before you hit return. To
7778see this in action try entering `)` as the first character at the Dojo
7879prompt. Since there is no Dojo command or Hoon expression that starts
7980with ')', the Dojo rejects it.
8081
8182`Ctrl-x` - Switches the prompt between running console apps
8283
83−`Ctrl-c` - Crash current event. Processed at the Unix layer and prints a stack trace.
84+`Ctrl-c` - Crash current event. Processed at the Unix layer and prints a stack
85+trace.
86+
87+`Ctrl-d` - From Talk or Dojo, stops your Urbit process.
8488
85−`Ctrl-d` - From Talk or Dojo stops your Urbit process.
89+`Ctrl-z` - Stops the Urbit process from _anywhere_.
8690
8791`↑` / `↓` - History navigation
8892
@@ -109,14 +113,15 @@ Full coverage of the Urbit shell, the Dojo is covered in the
109113
110114## Web
111115
112−On startup Urbit tries to bind to `localhost:8080`. If you're already
113−running something on `8080` you'll find your Urbit on `8081`, and so on.
114−For planets only, we also proxy web domains through Urbit's own servers.
115−Any planet `~your-urbit` is also at `your-urbit.urbit.org`.
116+On startup Urbit tries to bind to `localhost:8080`. If you're already
117+running something on `8080` -- such as another urbit -- you'll find the urbit
118+that you just started on `8081`, and so on. For planets only, we also proxy web
119+domains through Urbit's own servers. Any planet `~your-urbit` is also at
120+`your-urbit.urbit.org`.
116121
117−Your Urbit serves a simple homepage from `http://localhost:8080` or
122+Your urbit serves a simple homepage from `http://localhost:8080` or
118123`https://your-urbit.urbit.org` that should be self-explanatory. Since
119−our HTTPS isn't audited / battle tested we just call it "secure" HTTPS.
124+our HTTPS isn't audited / battle tested, we just call it "secure" HTTPS.
120125You can find that on `8443`. Or `8444` (and so on) if you're already
121126running something on `8443`.
122127
@@ -125,41 +130,72 @@ A complete walkthrough of the Urbit web interface is
125130
126131## Moons
127132
128−Urbit namespace is distributed by having parent nodes sign the keys for child nodes. If you have a planet, your parent star issued your ticket. As a planet you, in turn, can sign the keys for moons. The basic idea is: your planet runs permanently in a data center somewhere and moons run on all your devices. Each planet can issue ~4 billion (`2^32`) moons.
133+Urbit namespace is distributed by having parent nodes sign the keys for child
134+nodes. If you have a planet, your parent star issued your ticket. As a planet
135+you, in turn, can sign the keys for moons. The basic idea is: your planet runs
136+permanently in a data center somewhere and moons run on all your devices. Each
137+planet can issue ~4 billion (`2^32`) moons.
138+
139+To generate a random moon from your planet, run:
140+
141+```
142+~your-urbit:dojo> +moon
143+```
144+
145+You can use the resulting output in the same installation flow from
146+[install](/../install) and [setup](/../setup), following the same scheme as
147+for booting a planet. That scheme is:
129148
130−To generate a random moon from your planet run:
149+```
150+$ urbit -w <moonname> -t <ticket> -c <piername>
151+```
131152
132− ~your-urbit:dojo> +moon
153+The `-c <piername>` argument is not required, but it is recommended; otherwise,
154+the resulting directory is a rather unwieldy moon name.
133155
134−You can use the resulting output in the same installation flow from [install](/docs/using/install) and [setup](/docs/using/setup).
156+Here's how an example moon might be booted:
135157
136−Moons are automatically synced to their parent `%kids` desk, and can control applications on their parent planet using `|link`. You can read more about those things in the [filesystem](/docs/using/filesystem) and [console](/docs/using/shell) walkthroughs.
158+```
159+$ urbit -w faswep-navred-sampel-palnet -t habref-mebsem-parsym-batlus -c mymoon
160+```
161+
162+
163+Moons are automatically synced to their parent `%kids` desk, and can control
164+applications on their parent planet using `|link`. You can read more about
165+those operations in the [filesystem](/../filesystem) and [console](/../shell)
166+walkthroughs, respectively.
137167
138168
139169## Continuity breaches
140170
141−While the Urbit network is in this alpha state we sometimes have to
171+While the Urbit network is in this alpha state, we sometimes have to
142172reboot the whole network. This happens either when major changes need
143173to be shipped or we hit a bug that can't be fixed over the air.
144174
145175Because Urbit networking is stateful we call this a _continuity breach_.
146176Everything has to be restarted from scratch. Your pier will continue to
147177function after we have breached, but it wont connect to the rest of the
148−Urbit network.
178+Urbit network.
149179
150180When this happens, back up any files you'd like to save, shut down your
151−Urbit and recreate it (as if you were starting for the first time).
181+urbit and recreate it (as if you were starting for the first time).
152182
153183## Creating SSL certificates
154184
155−It is possible to create SSL certificates so that you serve files through your ship's webserver using https.
156−To do that you, would need a machine that has OpenSSL installed.
157−In order to create a new private key and a self-signed certificate for your localhost, valid for a year, you can issue the following commands:
185+It is possible to create SSL certificates so that you serve files through your
186+ship's webserver using https. To do that you, would need a machine that has
187+OpenSSL installed. In order to create a new private key and a self-signed
188+certificate for your localhost, valid for a year, you can issue the following
189+commands:
158190
159191```
160192$ openssl req -x509 -sha256 -newkey rsa:4096 -keyout private.pem -out certificate.pem -subj '/CN=localhost' -days 365
161193$ mkdir -p your-urbit/.urb/tls
162−$ mv private.pem certificate.pem your-urbit/.urb/tls
194+$ mv private.pem certificate.pem your-urbit/.urb/tls
163195```
164−These certificates would have to be manually trusted by your browser, and it's advisable that they are used only for your localhost.
165−For public-facing webservers, it would be better to create certificates for your fully qualified domain name using a trusted certificate authority like Let's Encrypt.
196+
197+These certificates would have to be manually trusted by your browser, and it's
198+advisable that they are used only for your localhost.
199+For public-facing webservers, it would be better to create certificates for your
200+fully qualified domain name using a trusted certificate authority like Let's
201+Encrypt.
docs/arvo/internals/ames.md → learn/arvo/ames.udonrenamed+9−7
@@ -1,10 +1,12 @@
1−---
2−navhome: /docs/
3−sort: 1
4−---
1+:- :~ navhome/'/docs/'
2+ navuptwo/'true'
3+ next/'true'
4+ sort/'1'
5+ title/'Ames'
6+ ==
7+;>
58
6−`%ames`
7−=======
9+# Ames
810
911Our networking protocol.
1012
@@ -25,4 +27,4 @@ routing is handled entirely in `%ames`. Finally, the actual `%ames`
2527protocol itself, including how to route incoming packets to the correct
2628vane or app, is defined in `%ames`.
2729
28−<list></list>
30+;list;
docs/arvo/internals/ames/commentary.md → learn/arvo/ames/commentary.udonrenamed+182−11
@@ -1,10 +1,12 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ navuptwo/'true'
3+ sort/'1'
4+ title/'Ames commentary'
5+ ==
6+;>
47
58
6−`%ames` commentary
7−==================
9+# Ames commentary
810
911`%ames` is our networking protocol.
1012
@@ -47,7 +49,9 @@ the path is the same for both.
4749When an app (or a vane) wishes to send a packet to another ship, it must
4850send a `%wont` card:
4951
52+```
5053 [%wont p=sock q=path r=*] :: e2e send message
54+```
5155
5256This card takes three arguments. The `p` is a `sock`, that is, a pair of
5357two ships, the first of which is the sender and the second is the
@@ -76,10 +80,12 @@ find that it appears in exactly two places: at its definition in
7680`++kiss`, and in `++knob`, where it is handled. We see that we go
7781directly into `++wise:am`.
7882
83+```
7984 ++ wise :: wise:am
8085 |= [soq=sock hen=duct cha=path val=* ete=?] :: send a statement
8186 ^- [p=(list boon) q=fort]
8287 zork:zank:(wool:(ho:(um p.soq) q.soq) hen cha val ete)
88+```
8389
8490The inputs to this gate are exactly the sort of thing you'd expect. In
8591particular, everything in the `%wont` gate is here plus the calling duct
@@ -97,6 +103,7 @@ The code predates the widespread usage of that name.
97103The interesting part, then, is in `++wool:ho:um:am`. Let's look at the
98104code.
99105
106+```
100107 ++ wool :: wool:ho:um:am
101108 |= [hen=duct cha=path val=* ete=?] :: send a statement
102109 ^+ +>
@@ -113,6 +120,7 @@ code.
113120 ?: ete
114121 [%bund q.cov cha sex val]
115122 [%bond q.cov cha sex val]
123+```
116124
117125This is slightly more complicated, but it's still not all that bad. Our
118126inputs, at least, are fairly obvious.
@@ -140,13 +148,16 @@ Finally, we call `++wind:ho:um:am` with the `++soup` of the path and
140148message number and the `++meal` of the payload itself. For end-to-end
141149acknowledged messages, we use `%bund`.
142150
151+```
143152 [%bund p=life q=path r=@ud s=*] :: e2e message
153+```
144154
145155Looking at how we create the `%bund`, we can easily see what each field
146156is for.
147157
148158Following the trail a little further, we go to `++wind:ho:um:am`.
149159
160+```
150161 ++ wind :: wind:ho:um:am
151162 |= [gom=soup ham=meal]
152163 :: ~& [%wind her gom]
@@ -154,6 +165,7 @@ Following the trail a little further, we go to `++wind:ho:um:am`.
154165 =^ wyv diz (zuul:diz now ham)
155166 =^ feh puz (whap:puz now gom wyv)
156167 (busk xong:diz feh)
168+```
157169
158170`++wind` does three things: it (1) encodes the message into a list of
159171possibly-encrypted packets, (2) puts the message into the packet pump,
@@ -164,6 +176,7 @@ gate is over. We'll go in order here.
164176`++zuul:lax:as:go` is the what converts a `++meal` into a list of
165177actual, 1KB packets.
166178
179+```
167180 ++ zuul :: zuul:lax:as:go
168181 |= [now=@da ham=meal] :: encode message
169182 ^- [p=(list rock) q=_+>]
@@ -171,6 +184,7 @@ actual, 1KB packets.
171184 ++ wasp :: null security
172185 ++ weft :: fragment message
173186 ++ wisp :: generate message
187+```
174188
175189For organizational purposes, `++zuul` constructs an internal core with
176190three arms. `++wasp` encodes the meal into an atom with no encryption.
@@ -178,28 +192,35 @@ three arms. `++wasp` encodes the meal into an atom with no encryption.
178192`++wasp`). `++weft` takes the result of `++wisp` and splits it into
179193actual packets.
180194
195+```
181196 ++ wasp :: null security
182197 ^-([p=skin q=@] [%none (jam ham)])
198+```
183199
184200This simply jams the meal, wrapping it with the `skin` of `%none`,
185201meaning no encryption.
186202
187203Since `++wisp` is a little long, we'll go through it line-by-line.
188204
205+```
189206 ++ wisp :: generate message
190207 ^- [[p=skin q=@] q=_..wisp]
208+```
191209
192210`++wisp` produces a pair of a `skin` and an atom, which is the meal
193211encoded as a single atom and possibly encrypted.
194212
213+```
195214 ?: =(%carp -.ham)
196215 [wasp ..wisp]
216+```
197217
198218If the meal that we're encoding is a `%carp`, then we don't encrypt it.
199219A `%carp` meal is a partial meal, used when a message is more than 1KB.
200220Since the entire message is already encrypted, we don't need to encrypt
201221each packet individually again.
202222
223+```
203224 ?: !=(~ yed.caq.dur)
204225 ?> ?=(^ yed.caq.dur)
205226 :_ ..wisp
@@ -207,44 +228,54 @@ each packet individually again.
207228 %^ cat 7
208229 p.u.yed.caq.dur
209230 (en:r:cluy q.u.yed.caq.dur (jam ham))
231+```
210232
211233If we have a symmetric key set up with this neighbor, then we simply use
212234it. The skin `%fast` is used to indicate a symmetric key.
213235
236+```
214237 ?: &(=(~ lew.wod.dur) |(=(%back -.ham) =(%buck -.ham)))
215238 [wasp ..wisp]
239+```
216240
217241If we do not yet have our neighbor's will, then there is no way that we
218242can seal the message so that only they may read it. If what we're
219243sending is an acknowledgment, then we go ahead and just send it in the
220244clear.
221245
246+```
222247 =^ tuy +>.$
223248 ?:(=(~ lew.wod.dur) [*code +>.$] (griz now))
249+```
224250
225251If we don't have our neighbor's will, then we "encrypt" with a key of 0.
226252If we do have their will, then we generate a new symmetric key that we
227253will propose.
228254
255+```
229256 :_ ..wisp
230257 =+ yig=sen
231258 =+ bil=law.saf :: XX send whole will
232259 =+ hom=(jam ham)
260+```
233261
234262`yig` will be the life and engine for our current crypto. `bil` is our
235263will. `hom` is the meal encoded as a single atom.
236264
265+```
237266 ?: =(~ lew.wod.dur)
238267 :- %open
239268 %^ jam
240269 [~ `life`p.yig]
241270 bil
242271 (sign:as:q.yig tuy hom)
272+```
243273
244274If we do not have our neighbor's will, then we send our current life
245275along with our will and the message. The message itself is "signed" with
246276a key of 0.
247277
278+```
248279 :- %full
249280 =+ cay=cluy
250281 %^ jam
@@ -252,6 +283,7 @@ a key of 0.
252283 bil
253284 (seal:as:q.yig pub:ex:r.cay tuy hom)
254285 -- :: --zuul:lax:as:go
286+```
255287
256288If we do have our neighbor's will, then we send our perception of their
257289current life, our current life, our will, and the message. The message
@@ -259,36 +291,45 @@ is sealed with their public key so that only they can read our message.
259291
260292Once we have the message encoded as an atom, `++weft` goes to work.
261293
294+```
262295 ++ weft :: fragment message
263296 ^- [p=(list rock) q=_+>.$]
264297 =^ gim ..weft wisp
265298 :_ +>.$
266299 ^- (list rock)
300+```
267301
268302We're going to produce a list of the packets to send. First, we use the
269303aforementioned `++wisp` to get the message as an atom.
270304
305+```
271306 =+ wit=(met 13 q.gim)
272307 ?< =(0 wit)
308+```
273309
274310`wit` is the number of 1KB (2\^13 bit) blocks in the message. We assert
275311that there is at least one block.
276312
313+```
277314 ?: =(1 wit)
278315 =+ yup=(spit [our her] p.gim q.gim)
279316 [yup ~]
317+```
280318
281319If there is exactly one block, then we just call `++spit` to turn the
282320message into a packet. We'll explain what `++spit` does momentarily.
283321
322+```
284323 =+ ruv=(rip 13 q.gim)
285324 =+ gom=(shaf %thug q.gim)
286325 =+ inx=0
326+```
287327
288328If there is more than one block, then we rip it into blocks in `ruv`.
289329`gom` is a hash of the message, used as an id. `inx` is the number of
290330packets we've already made.
291331
332+```
292333 |- ^- (list rock)
293334 ?~ ruv ~
294335 =+ ^= vie
@@ -297,10 +338,12 @@ packets we've already made.
297338 wasp(ham [%carp (ksin p.gim) inx wit gom i.ruv])
298339 :- vie
299340 $(ruv t.ruv, inx +(inx))
341+```
300342
301343Here we package each block into a packet with `++spit` and produce the
302344list of packets.
303345
346+```
304347 ++ spit :: cake to packet
305348 |= kec=cake ^- @
306349 =+ wim=(met 3 p.p.kec)
@@ -320,6 +363,7 @@ list of packets.
320363 [5 tay]
321364 ==
322365 (lsh 5 1 bod)
366+```
323367
324368This is how we turn a message into a real packet. This has the
325369definition of the packet format.
@@ -348,11 +392,13 @@ there are three unused bits here. This adds up to 32 bits of header
348392data. Finally, we concatenate this onto the front of the packet. Thus,
349393we can summarize the packet header format as follows.
350394
395+```
351396 0 1 2 3
352397 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
353398 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
354399 |Proto| Hash of Body |yax|qax| Crypto |
355400 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
401+```
356402
357403After this, there are `yax` bits of the sender name, `qax` bits of the
358404receiver name, and up to 8192 bits of data. Thus, the maximum size of a
@@ -364,6 +410,7 @@ This concludes our discussion of `++zuul:lax:as:go`. If you recall from
364410`++whap:pu` to update the packet pump and get any packets that can be
365411sent immediately.
366412
413+```
367414 ++ whap :: whap:pu
368415 |= [now=@da gom=soup wyv=(list rock)] :: send a message
369416 ^- [(list rock) _+>]
@@ -378,6 +425,7 @@ sent immediately.
378425 puq (~(put to puq) [nus `soul`[gom 0 | ~2000.1.1 i.wyv]])
379426 ==
380427 (harv now)
428+```
381429
382430First, we put into `pyz` the id for this message and the number of its
383431packets that have not yet been acknowledged, which is of course the
@@ -392,6 +440,7 @@ the packet itself.
392440
393441Finally, we harvest the packet pump.
394442
443+```
395444 ++ harv :: harv:pu
396445 |= now=@da :: harvest queue
397446 ^- [(list rock) _+>]
@@ -401,6 +450,7 @@ Finally, we harvest the packet pump.
401450 =| rub=(list rock)
402451 =< abet =< apse
403452 |%
453+```
404454
405455`++harv` contains a core for most of its work. The meat is in `++apse`.
406456First, though, it sets itself up. If there aren't any packets in the
@@ -414,6 +464,7 @@ we initialize `rub` to nil. `rub` will be the list of packets that are
414464ready to be sent. We then call `++apse` and pass the result to `++abet`.
415465`++apse` decides which packets are ready to be sent.
416466
467+```
417468 ++ apse
418469 ^+ .
419470 ?~ puq .
@@ -431,6 +482,7 @@ ready to be sent. We then call `++apse` and pass the result to `++abet`.
431482 nux.q.n.puq +(nux.q.n.puq)
432483 lys.q.n.puq now
433484 ==
485+```
434486
435487If there are no remaining packets to send, or if we've filled the packet
436488window, do nothing. We call `++rigt` and `++left` to process the left
@@ -447,21 +499,25 @@ send; (3) increment `nif`, the number of live packets; (4) set the
447499packet to be live; (5) increment the number of transmissions of the
448500packet; and (6) set the last sent time of the packet to now.
449501
502+```
450503 ++ left
451504 ?> ?=(^ puq)
452505 ^+(. =+(lef=apse(puq l.puq) lef(puq [n.puq puq.lef r.puq])))
453506 ++ rigt
454507 ?> ?=(^ puq)
455508 ^+(. =+(rig=apse(puq r.puq) rig(puq [n.puq l.puq puq.rig])))
509+```
456510
457511These do exactly what you would expect: they traverse the packet queue
458512so that `++apse` gets called recursively through it.
459513
460514Finally, `++abet` gets called, which resolves the changes.
461515
516+```
462517 ++ abet
463518 ?~ rub [~ +>.$]
464519 [(flop rub) +>.$(rtn [~ (add rto now)])]
520+```
465521
466522This returns the packets that we wish to send, and it updates the
467523timeout so that we know when to try resending unacknowledged packets.
@@ -472,6 +528,7 @@ wait, in the call to `++busk`, the first argument is `xong:diz`. What is
472528this? This, my dear reader, is one more detour, this time into
473529`++xong:lax:as:go`.
474530
531+```
475532 ++ xong :: xong:lax:as:go
476533 ^- (list ship) :: route unto
477534 =+ [fro=xen too=xeno]
@@ -483,6 +540,7 @@ this? This, my dear reader, is one more detour, this time into
483540 [i.too $(too t.too)]
484541 :: ~& [%xong-to [our her] (weld oot ?>(?=(^ fro) t.fro))]
485542 (weld oot ?>(?=(^ fro) t.fro))
543+```
486544
487545This gets the list of intermediate ships needed to get a packet from us
488546to our neighbor. First, we get `fro` and `too`, the "canons" of ourself
@@ -492,8 +550,10 @@ What is this "canon", you ask? A canon is simply a ship plus its
492550"ancestors", as defined by `++sein`. For example, the canon of
493551`~hoclur-bicrel` is:
494552
553+```
495554 ~hoclur-bicrel/try=> (saxo ~hoclur-bicrel)
496555 ~[~hoclur-bicrel ~tasruc ~tug]
556+```
497557
498558If we follow the algorithm in `++xong`, we see that we are simply
499559creating a list of ships that form a path from our neighbor to ourself.
@@ -507,6 +567,7 @@ trying, in order, to find a lane to these.
507567
508568Now, we can finally get to `++busk:ho:um:am`.
509569
570+```
510571 ++ busk :: busk:ho:um:am
511572 |= [waz=(list ship) pax=(list rock)] :: send packets
512573 %_ +>
@@ -515,12 +576,14 @@ Now, we can finally get to `++busk:ho:um:am`.
515576 ?~ pax bin
516577 $(pax t.pax, bin (weld (flop (wist:diz now waz ~ i.pax)) bin))
517578 ==
579+```
518580
519581Thankfully, `++busk` is fairly simple. We go through the list of packets
520582and convert them to `++boon`s with `++wist:lax:as:go`. These boons are
521583placed into `bin`, and they end up getting processed by `++clop` (this
522584happens in `++knob`).
523585
586+```
524587 ++ wist :: wist:lax:as:go
525588 |= $: now=@da :: route via
526589 waz=(list ,@p)
@@ -550,6 +613,7 @@ happens in `++knob`).
550613 p.u.yed.caq.dyr
551614 (en:crua q.u.yed.caq.dyr mal)
552615 ==
616+```
553617
554618This takes a sample of the current time, the list of ships that we just
555619generated, a lane if we already know it, and the packet itself.
@@ -586,10 +650,12 @@ of moves. In `++clop`, we see the handling of each specific boon. The
586650one we are interested in is `%ouzo`, since that is the only one we have
587651sent thus far.
588652
653+```
589654 %ouzo
590− :: ~& [%send now p.bon `@p`(mug (shaf %flap q.bon))]
655+ :: ~& [%send now p.bon `@p`(mug (shaf %flap q.bon))]
591656 :_ fox
592657 [[gad.fox [%give %send p.bon q.bon]] ~]
658+```
593659
594660Very simply, we give a `%send` gift along the special duct that goes
595661straight into the bowels of unix. This is the last stop before we drop
@@ -605,8 +671,10 @@ And now we reenter the kernel.
605671The `%hear` kiss goes straight to `++knob`, just as did the `%wont` kiss
606672earlier.
607673
674+```
608675 %hear
609676 (~(gnaw am [now fox]) %good p.kyz q.kyz)
677+```
610678
611679Here, though, we call `++gnaw:am` to process the packet. The arguments
612680to `++gnaw` are the same as those to the `%hear` kiss: the lane on which
@@ -617,6 +685,7 @@ event system, the `%hear` event will never be considered to have
617685actually happened, and unix will send a `%hole` kiss so that we may send
618686a negative acknowledgment.
619687
688+```
620689 ++ gnaw :: gnaw:am
621690 |= [kay=cape ryn=lane pac=rock] :: process packet
622691 ^- [p=(list boon) q=fort]
@@ -629,6 +698,7 @@ a negative acknowledgment.
629698 =< zank
630699 %- ~(chew la:(ho:(um q.p.kec) p.p.kec) kay ryn %none (shaf %flap pac))
631700 [q.kec r.kec]
701+```
632702
633703First, we check the protocol number. If it is not correct, then we
634704simply ignore the packet entirely. Otherwise, we parse the packet with
@@ -636,6 +706,7 @@ simply ignore the packet entirely. Otherwise, we parse the packet with
636706of the `sock` (pair of sender and receiver), the `skin` (encryption
637707type), and the data.
638708
709+```
639710 ++ bite :: packet to cake
640711 |= pac=rock ^- cake
641712 =+ [mag=(end 5 1 pac) bod=(rsh 5 1 pac)]
@@ -650,6 +721,7 @@ type), and the data.
650721 :+ [(end 3 wix bod) (cut 3 [wix vix] bod)]
651722 (kins tay)
652723 (rsh 3 (add wix vix) bod)
724+```
653725
654726This is exactly the inverse of `++spit`. Note that here we check both
655727the protocol number and the hash, crashing on error. Remember that a
@@ -672,6 +744,7 @@ and a hash of the packet, used as an id.
672744contains a little helper core inside of it, which starts immediately
673745with `++apse`.
674746
747+```
675748 ++ apse
676749 ^+ +>.$
677750 =+ oub=bust:puz
@@ -686,6 +759,7 @@ with `++apse`.
686759 ?. &(neg !eng) bin
687760 :_(bin [%wine [our her] " is your neighbor"])
688761 +>.$
762+```
689763
690764First, we let `oub` be true if our neighbor hasn't been responding to us
691765for more than sixteen seconds. Let `neg` be true if we haven't yet
@@ -705,6 +779,7 @@ first decrypts the message, then calls `++chow:la:ho:um:am` with the
705779resultant meal. We'll go through each of the four cases in turn, but
706780first since each one calls `++bilk:pu`, we'll take a brief detour.
707781
782+```
708783 ++ bilk :: bilk:pu
709784 |= now=@da :: inbound packet
710785 ^+ +>
@@ -714,6 +789,7 @@ first since each one calls `++bilk:pu`, we'll take a brief detour.
714789 rto trt
715790 rtn ?~(puq ~ [~ (add now trt)])
716791 ==
792+```
717793
718794This updates the timing information in our packet pump. `rue`, the last
719795time we have heard from this neighbor, is set to now. `rto`, the
@@ -723,9 +799,11 @@ we've just heard a message.
723799
724800Back to `++east`.
725801
802+```
726803 %none
727804 =. puz (bilk:puz now)
728805 (chow ((hard meal) (cue msg)))
806+```
729807
730808The simplest case is when the encryption type is `%none`. We first call
731809`++bilk` to update the packet pump, then we cue (unjam) the message into
@@ -733,6 +811,7 @@ a meal. We hard cast it into a meal -- if the cast fails, then we do
733811want to crash since someone is sending us malformed data. Finally, we
734812send the result to `++chow` for interpretation and handling.
735813
814+```
736815 %fast
737816 =+ [mag=`hand`(end 7 1 msg) bod=(rsh 7 1 msg)]
738817 =+ dey=(kuch:diz mag)
@@ -742,6 +821,7 @@ send the result to `++chow` for interpretation and handling.
742821 =. puz (bilk:puz now)
743822 =^ key diz u.dey
744823 (chow(aut sin) ((hard meal) (cue (dy:q:sen:gus key bod))))
824+```
745825
746826For symmetric encryption, we first get the `hand`, which is the hash of
747827the symmetric key. We pass it to `++kuch:lax:as:go`, which returns the
@@ -753,6 +833,7 @@ message.
753833Otherwise, we call `++bilk` as before to update the packet pump and pass
754834into `++chow` the decrypted data.
755835
836+```
756837 %full
757838 =+ mex=((hard ,[p=[p=life q=life] q=will r=@]) (cue msg))
758839 =. diz (deng:diz q.mex)
@@ -763,6 +844,7 @@ into `++chow` the decrypted data.
763844 =. diz (wasc:diz p.mes)
764845 =. puz (bilk:puz now)
765846 (west(msg q.mes))
847+```
766848
767849For sealed asymmetric encryption, we first take off the the layer of
768850data that gives us the life and will of our neighbor, and we apply try
@@ -776,6 +858,7 @@ key from our neighbor's crypto. We register the proposed symmetric key,
776858update the packet pump, and call `++west`, which simply casts the
777859message to a meal and calls `++chow`, reporting any error.
778860
861+```
779862 %open
780863 =+ mex=((hard ,[p=[~ q=life] q=will r=@]) (cue msg))
781864 =. diz (deng:diz q.mex)
@@ -784,6 +867,7 @@ message to a meal and calls `++chow`, reporting any error.
784867 =+ mes=(need (sure:as:r.wug *code r.mex))
785868 =. puz (bilk:puz now)
786869 (west(msg mes))
870+```
787871
788872Finally, for signed asymmetric encryption, we, as before, take off the
789873layer of data that gives us the life and will of our neighbor. This
@@ -794,11 +878,13 @@ The rest you have seen. We call `++deng` to extend the will, we verify
794878that their crypto life is what we think it ought to be, we "decrypt" the
795879data, we update the packet pump, and we call `++west` to call `++chow`.
796880
881+```
797882 ++ chow :: chow:la:ho:um:am
798883 |= fud=meal :: interpret meal
799884 ^+ +>
800885 =. diz ?:(=(%none aut) diz (wast:diz ryn))
801886 (dine fud)
887+```
802888
803889Here, if the message was encrypted at all, then we call
804890`++wast:lax:as:go`, which simply updates the lane (route) to our
@@ -810,6 +896,7 @@ we want to do with it. The telos is of any meal to be dined on. We will
810896choose out the cases here that are important to our current
811897investigation.
812898
899+```
813900 %fore
814901 =+ ^= lyn ^- lane
815902 ?~ q.fud ryn
@@ -820,6 +907,7 @@ investigation.
820907 (emit %mead lyn r.fud)
821908 =+ zid=(myx:gus p.fud)
822909 (emir (wist:zid now xong:zid [~ lyn] r.fud))
910+```
823911
824912Forwarding is the simplest case, since we've seen all the arms before,
825913except perhaps `++emit` and `++emir`, which simply take a boon or list
@@ -828,6 +916,7 @@ resolves. If we're told to forward a packet to ourselves, then we emit a
828916`%mead` boon which simply sends another `%hear` kiss to ourselves with
829917the data. Otherwise, we try to find a route to the recipient, as before.
830918
919+```
831920 %carp
832921 =+ zol=(~(get by olz.weg) s.fud)
833922 ?^ zol cock(kay u.zol)
@@ -853,6 +942,7 @@ the data. Otherwise, we try to find a route to the recipient, as before.
853942 (golf p.neb r.neb)
854943 =. +>.$ cock
855944 +>.$(nys.weg (~(put by nys.weg) s.fud neb))
945+```
856946
857947Here, we have received a partial message, and we're just assembling the
858948individual packets into a message. Most of this code is fairly
@@ -869,10 +959,12 @@ complete message into `olz.weg`, and call `++golf`, which assembles the
869959message and calls `++chew`, to start the dance again with the complete
870960message.
871961
962+```
872963 %bund
873964 :: ~& [%bund q.fud r.fud]
874965 ?> =(p:sen:gus p.fud)
875966 (deer q.fud r.fud ?-(kay %dead ~, %good [~ s.fud]))
967+```
876968
877969What if we're just receiving a regular old, garden variety message? We
878970call `++deer` with the data from the message. If we already know that
@@ -881,6 +973,7 @@ unix rather than a `%hear` card), then we don't even send the data at
881973all. Remember, if a packet fails to process, it's as if it never even
882974arrived, except that we send a negative acknowledgment.
883975
976+```
884977 ++ deer :: deer:la:ho:um:am
885978 |= [cha=path num=@ud dut=(unit)] :: interpret message
886979 ^+ +>
@@ -897,6 +990,7 @@ arrived, except that we send a negative acknowledgment.
897990 rum(mis (~(put by mis.rum) num [kay ryn dam dut]))
898991 ==
899992 ==
993+```
900994
901995First, we get the race for this particular triple of sender, receiver,
902996and path, creating it if it doesn't exist. If we've already acked the
@@ -919,6 +1013,7 @@ acknowledgment.
9191013
9201014Otherwise, we're ready for a packet, so we process it.
9211015
1016+```
9221017 ++ coat :: coat:ho:um:am
9231018 |= [cha=path rum=race] :: update input race
9241019 ^+ +>
@@ -936,6 +1031,7 @@ Otherwise, we're ready for a packet, so we process it.
9361031 `soap`[[p:sen:gus clon:diz] cha did.rum]
9371032 u.s.u.cun
9381033 ==
1034+```
9391035
9401036First, we grab the message we want to process and store it in `cun`. If
9411037it's a good packet, then we change `dod.rum` to false, meaning that
@@ -952,6 +1048,7 @@ been here before, if you recall, when we handled the `%cake` boon to
9521048send a message. Now, we're handling the `%mulk` boon, which is
9531049unfortunately slightly more complicated.
9541050
1051+```
9551052 %mulk
9561053 :: ~& [%mulk p.bon q.bon]
9571054 ?> ?=([@ @ *] q.q.bon)
@@ -979,6 +1076,7 @@ unfortunately slightly more complicated.
9791076 q.q.bon
9801077 :_ fox [hen %pass pax %g %roth p.bon app r.bon]~
9811078 ==
1079+```
9821080
9831081We're dispatching messages based on the prefix of their path. Since only
9841082`%gall` apps use end-to-end acknowledgments at the moment, every path
@@ -1026,6 +1124,7 @@ After this brief interlude, our story resumes in `++knap`, where we
10261124receive responses. In particular, a `%mean` indicates a negative
10271125acknowledgment while a `%nice` indicates a positive acknowledgment.
10281126
1127+```
10291128 ?(%mean %nice)
10301129 ?> ?=([@ @ @ *] tea)
10311130 =+ soq=[(slav %p i.tea) (slav %p i.t.tea)]
@@ -1041,6 +1140,7 @@ acknowledgment while a `%nice` indicates a positive acknowledgment.
10411140 [(flop out) +>.^$]
10421141 =^ toe fox (clop now hen i.p.fuy)
10431142 $(p.fuy t.p.fuy, out (weld (flop toe) out))
1143+```
10441144
10451145Recall the format of the path we sent the message on, and you'll
10461146understand why `soq` and `pax` are the sender/receiver pair and path on
@@ -1048,11 +1148,13 @@ which the message was sent. The rest of this is structured much like
10481148`++knob`, so we call `++rack:am` and send the resulting boons to
10491149`++clop`. Business as usual.
10501150
1151+```
10511152 ++ rack :: rack:am
10521153 |= [soq=sock cha=path cop=coop] :: e2e ack
10531154 =+ oh=(ho:(um p.soq) q.soq)
10541155 =. oh (cook:oh cop cha ~)
10551156 (cans:oh cha)
1157+```
10561158
10571159First, we set up `++um` and `++ho`, as we've done twice before, for our
10581160domestic and foreign servers, respectively. The other two things are
@@ -1060,6 +1162,7 @@ new, though. Well, `++cook` is not actually new, but we delayed the
10601162explanation saying only that it sends an acknowledgment. The time has
10611163come.
10621164
1165+```
10631166 ++ cook :: cook:ho:um:am
10641167 |= [cop=coop cha=path ram=(unit ,[ryn=lane dam=flap])]
10651168 ^+ +> :: acknowledgment
@@ -1076,6 +1179,7 @@ come.
10761179 rum(dod &, bum ?~(cop bum.rum (~(put by bum.rum) did.rum u.cop)))
10771180 =^ roc diz (zuul:diz now [%buck cop dam ~s0])
10781181 (busk(diz (wast:diz ryn)) xong:diz roc)
1182+```
10791183
10801184If we are acknowledging a message that we have already acked, the `ram`
10811185will contain the new lane and flap to send the duplicate ack to. This
@@ -1133,6 +1237,7 @@ The last thing we need to do on this ship is move on to the next packet
11331237in the queue if there is one. If you recall, in `++rack` after the call
11341238to `++cook` there was a call to `++cans:ho:um:am`.
11351239
1240+```
11361241 ++ cans :: cans:ho:um:am
11371242 |= cha=path
11381243 =+ rum=(need (~(get by raz.bah) cha))
@@ -1142,6 +1247,7 @@ to `++cook` there was a call to `++cans:ho:um:am`.
11421247 mis (~(del by mis.rum) did.rum)
11431248 ==
11441249 (coat cha rum)
1250+```
11451251
11461252This is very simple. We increment the number of packets that we've
11471253acknowledged on this race and we delete the packet that we just
@@ -1163,9 +1269,11 @@ going over to `++chew`, `++apse`, `++chow`, and eventualy to `++dine`.
11631269We've seen most of the cases in `++dine`, but we haven't yet looked at
11641270the handling of this `%buck` meal.
11651271
1272+```
11661273 %buck
11671274 =. +> ?.(=(%full aut) +> cock) :: finish key exch
11681275 +>(..la (tock p.fud q.fud r.fud))
1276+```
11691277
11701278We send a packet level acknowledgment if we're finishing a key exchange,
11711279else we call `++tock` to process the acknowledgment.
@@ -1176,6 +1284,7 @@ as a `%woot` card back to the app who sent it. For those brave souls who
11761284wish to see this thing through to the end, it's once more into the
11771285breach.
11781286
1287+```
11791288 ++ tock :: tock:ho:um:am
11801289 |= [cop=coop fap=flap cot=@dr] :: e2e ack by hash
11811290 ^+ +>
@@ -1191,6 +1300,7 @@ breach.
11911300 `boon`[%cake [our her] [[p:sen:gus clon:diz] u.p.yoh] cop u.hud]
11921301 ==
11931302 (busk xong:diz q.yoh)
1303+```
11941304
11951305We're going to work through this one a little backwards since it's
11961306mostly fairly simple except the call to `++bick:pu`. In fact, we'll just
@@ -1198,6 +1308,7 @@ skip `++bick` for the moment and finish the rest.
11981308
11991309If `++bick` succesfully acks the message, then we call `++done`.
12001310
1311+```
12011312 ++ done :: done:ho:um:am
12021313 |= [cha=path num=@ud] :: complete outgoing
12031314 ^- [(unit duct) _+>]
@@ -1209,6 +1320,7 @@ If `++bick` succesfully acks the message, then we call `++done`.
12091320 ryl.bah
12101321 (~(put by ryl.bah) cha rol(san (~(del by san.rol) num)))
12111322 ==
1323+```
12121324
12131325This very simply gets the rill (the outgoing counterpart to a race, if
12141326you recall), pulls out of the map of outstanding messages the duct over
@@ -1229,10 +1341,12 @@ ones have been acknowledged.
12291341We'll look at the processing of the `%cake` boon in `++clop` before we
12301342get back to talking about `++bick`.
12311343
1344+```
12321345 %cake
12331346 :_ fox
12341347 :~ [s.bon %give %woot q.p.bon r.bon]
12351348 ==
1349+```
12361350
12371351We very simply give, along the duct we found above, a `%woot` card with
12381352the ship who sent us the ack and the ack itself. This allows the
@@ -1244,6 +1358,7 @@ the application. Our job is done.
12441358
12451359Well, except that we skipped `++bick:pu`. Let's go back to that.
12461360
1361+```
12471362 ++ bick :: bick:pu
12481363 |= [now=@da fap=flap] :: ack by hash
12491364 ^- [[p=(unit soup) q=(list rock)] _+>]
@@ -1254,6 +1369,7 @@ Well, except that we skipped `++bick:pu`. Let's go back to that.
12541369 =^ gub +>.$ (bock now u.sun)
12551370 =^ yop +>.$ (harv now)
12561371 [[gub yop] +>.$]
1372+```
12571373
12581374If you recall, in `++whap:pu` we created the packet pump's
12591375representation of the message, which included putting the message into
@@ -1269,6 +1385,7 @@ In `++bock`, there are three arms we haven't seen before: `++bine`,
12691385`+wept`, and `++beet`. We'll describe each of these before we get to
12701386`++bock`. `++bine` looks scariest.
12711387
1388+```
12721389 ++ bine :: bine:pu
12731390 |= [now=@da num=@ud] :: apply ack
12741391 ^- [(unit soup) _+>]
@@ -1292,6 +1409,7 @@ In `++bock`, there are three arms we haven't seen before: `++bine`,
12921409 [~ (~(put by pyz) gom.q.n.puq lez)]
12931410 :- gub
12941411 +>.$(puq ~(nap to puq))
1412+```
12951413
12961414The first few lines are simply looking through the packet queue until we
12971415find the correct packet to ack. This is basic queue manipulation that
@@ -1324,6 +1442,7 @@ message. Otherwise, we simply update `pyz` with the new number of
13241442unacked messages. In either case, we remove the packet from the packet
13251443queue.
13261444
1445+```
13271446 ++ wept :: wept:pu
13281447 |= [fip=@ud lap=@ud] :: fip thru lap-1
13291448 =< abet =< apse
@@ -1345,6 +1464,7 @@ queue.
13451464 ?> ?=(^ puq)
13461465 ^+(. =+(rig=apse(puq r.puq) rig(puq [n.puq l.puq puq.rig])))
13471466 --
1467+```
13481468
13491469The algorithm is a simple case of traversing the packet queue.
13501470Essentialy, we mark as dead all packets in the queue between `fip` and
@@ -1353,6 +1473,7 @@ mourn too much the passing of these packets, know that they shall soon
13531473rise again. Recall that in `++bick` after the call to `++bock` we call
13541474`++harv`. This will resend the packets that have just been labeled dead.
13551475
1476+```
13561477 ++ beet :: beet:pu
13571478 ^+ . :: advance unacked
13581479 =- +(nep ?~(foh nus u.foh))
@@ -1362,6 +1483,7 @@ rise again. Recall that in `++bick` after the call to `++bock` we call
13621483 ?: (lte p.n.puq nep) $(puq l.puq)
13631484 =+ rig=$(puq r.puq)
13641485 ?^(rig rig [~ p.n.puq])
1486+```
13651487
13661488Here we search for the next expected packet number. Basically, we search
13671489the queue for the leftmost packet whose number is greater than the
@@ -1370,6 +1492,7 @@ number of packets sent.
13701492
13711493We can now dive into `++bock`, our last arm.
13721494
1495+```
13731496 ++ bock :: bock:pu
13741497 |= [now=@da num=@ud] :: ack by sequence
13751498 ^- [(unit soup) _+>]
@@ -1386,6 +1509,7 @@ We can now dive into `++bock`, our last arm.
13861509 beet
13871510 :: ~& [%bock-fill num nif caw cag]
13881511 +>.$
1512+```
13891513
13901514First, we call `++bine` to apply the ack to the packet pump information.
13911515We produce `gym`, which, if it exists, is the id of the packet that was
@@ -1411,11 +1535,11 @@ code involves initialization, timeouts, and the like.
14111535Below, we give detailed reference documentation for the data models
14121536involved.
14131537
1414−Data Models
1415−-----------
1538+## Data Models
14161539
14171540### `++fort`, formal state
14181541
1542+```
14191543 ++ fort :: formal state
14201544 $: %0 :: version
14211545 gad=duct :: client interface
@@ -1423,6 +1547,7 @@ Data Models
14231547 ton=town :: security
14241548 zac=(map ship corn) :: flows by server
14251549 == ::
1550+```
14261551
14271552This is the state of our vane. Anything that must be remembered between
14281553calls to ames must be stored in this state.
@@ -1449,12 +1574,14 @@ The keys to this map are the ships on the current pier.
14491574
14501575### `++town`, all security state
14511576
1577+```
14521578 ++ town :: all security state
14531579 $: lit=@ud :: imperial modulus
14541580 any=@ :: entropy
14551581 urb=(map ship sufi) :: all keys and routes
14561582 fak=? ::
14571583 == ::
1584+```
14581585
14591586This is the security state of our pier.
14601587
@@ -1477,6 +1604,7 @@ for development. To use, run vere with the `-F` option (and the
14771604
14781605### `++sufi`, domestic host
14791606
1607+```
14801608 ++ sufi :: domestic host
14811609 $: hoy=(list ship) :: hierarchy
14821610 val=wund :: private keys
@@ -1484,6 +1612,7 @@ for development. To use, run vere with the `-F` option (and the
14841612 seh=(map hand ,[p=ship q=@da]) :: key cache
14851613 hoc=(map ship dore) :: neighborhood
14861614 == ::
1615+```
14871616
14881617This is the security state of a domestic server.
14891618
@@ -1503,7 +1632,9 @@ informatoin about foreign ships. The keys to this map are the neighbors
15031632
15041633### `++wund`, private keys
15051634
1635+```
15061636 ++ wund (list ,[p=life q=ring r=acru]) :: mace in action
1637+```
15071638
15081639This is a list of our own private keys, indexed by life. The key itself
15091640is the `++ring`, and the `++acru` is the encryption engine. We generate
@@ -1513,7 +1644,9 @@ at the head of the list and can be accessed with `++sen:as:go`.
15131644
15141645### `++ring`, private key
15151646
1647+```
15161648 ++ ring ,@ :: private key
1649+```
15171650
15181651This is a private key. The first byte is reserved to identify the type
15191652of cryptography. Lower-case means public key, upper-case means public
@@ -1521,7 +1654,9 @@ key, and the letter identifies which `++acru` to use.
15211654
15221655### `++pass`, public key
15231656
1657+```
15241658 ++ pass ,@ :: public key
1659+```
15251660
15261661This is a public key. The first byte is reserved to identify the type of
15271662cryptography. Lower-case means public key, upper-case means public key,
@@ -1529,14 +1664,18 @@ and the letter identifies which `++acru` to use.
15291664
15301665### `++mace`, private secrets
15311666
1667+```
15321668 ++ mace (list ,[p=life q=ring]) :: private secrets
1669+```
15331670
15341671This is a list of the our private keys, indexed by life. From this we
15351672can generate a `++wund` for actual use.
15361673
15371674### `++skin`, encoding stem
15381675
1676+```
15391677 ++ skin ?(%none %open %fast %full) :: encoding stem
1678+```
15401679
15411680This defines the type of encryption used for each message. `%none`
15421681refers to messages sent in the clear, `%open` refers to signed messages,
@@ -1545,13 +1684,14 @@ encrypted messages. See `++acru` for details.
15451684
15461685### `++acru`, asymmetric cryptosuite
15471686
1687+```
15481688 ++ acru :: asym cryptosuite
15491689 $_ ^? |% :: opaque object
15501690 ++ as ^? :: asym ops
15511691 |% ++ seal |=([a=pass b=@ c=@] _@) :: encrypt to a
15521692 ++ sign |=([a=@ b=@] _@) :: certify as us
15531693 ++ sure |=([a=@ b=@] *(unit ,@)) :: authenticate from us
1554− ++ tear |= [a=pass b=@] :: accept from a
1694+ ++ tear |= [a=pass b=@] :: accept from a
15551695 *(unit ,[p=@ q=@]) ::
15561696 -- ::
15571697 ++ de |+([a=@ b=@] *(unit ,@)) :: symmetric de, soft
@@ -1569,6 +1709,7 @@ encrypted messages. See `++acru` for details.
15691709 ++ com |=(a=@ ^?(..nu)) :: from naked pass
15701710 --
15711711 --
1712+```
15721713
15731714This is an opaque interface for a general asymmetric cryptosuite. Any
15741715form of asymmetric cryptography can be dropped in to be used instead of
@@ -1578,13 +1719,15 @@ mostly stubbed out at the moment.
15781719
15791720#### `++as:acru`, asymmetric operations
15801721
1722+```
15811723 ++ as ^? :: asym ops
15821724 |% ++ seal |=([a=pass b=@ c=@] _@) :: encrypt to a
15831725 ++ sign |=([a=@ b=@] _@) :: certify as us
15841726 ++ sure |=([a=@ b=@] *(unit ,@)) :: authenticate from us
1585− ++ tear |= [a=pass b=@] :: accept from a
1727+ ++ tear |= [a=pass b=@] :: accept from a
15861728 *(unit ,[p=@ q=@]) ::
15871729 -- ::
1730+```
15881731
15891732This is the core that defines the standard asymmetric cryptography
15901733operations.
@@ -1613,9 +1756,11 @@ associated with the `++skin` `%full`.
16131756
16141757#### `++de:acru`, `++dy:acru`, and `++en:acru`, symmetric encryption/decryption
16151758
1759+```
16161760 ++ de |+([a=@ b=@] *(unit ,@)) :: symmetric de, soft
16171761 ++ dy |+([a=@ b=@] _@) :: symmetric de, hard
16181762 ++ en |+([a=@ b=@] _@) :: symmetric en
1763+```
16191764
16201765Symmetric encryption is associated with the `++skin` `%fast`.
16211766
@@ -1630,12 +1775,14 @@ semantically equivalent to, `(need (de a b))`.
16301775
16311776#### `++ex:acru`, exporting data
16321777
1778+```
16331779 ++ ex ^? :: export
16341780 |% ++ fig _@uvH :: fingerprint
16351781 ++ pac _@uvG :: default passcode
16361782 ++ pub *pass :: public key
16371783 ++ sec *ring :: private key
16381784 --
1785+```
16391786
16401787`++fig:ex:acru` is our fingerprint, usually a hash of our public key.
16411788This is used, for example, in `++zeno`, where every carrier owner's
@@ -1650,11 +1797,13 @@ owned by their owners
16501797
16511798#### `++nu:acru`, reconstructors
16521799
1800+```
16531801 ++ nu ^? :: reconstructors
16541802 |% ++ pit |=([a=@ b=@] ^?(..nu)) :: from [width seed]
16551803 ++ nol |=(a=@ ^?(..nu)) :: from naked ring
16561804 ++ com |=(a=@ ^?(..nu)) :: from naked pass
16571805 --
1806+```
16581807
16591808These arms allow us to reconstruct a `++acru` from basic data.
16601809
@@ -1674,7 +1823,9 @@ and `++hail` for `++crub`.
16741823
16751824### `++will`, certificate
16761825
1826+```
16771827 ++ will (list deed) :: certificate
1828+```
16781829
16791830This is a list of deeds associated with the current ship. There should
16801831be an item in this list for every ship from this point up in the
@@ -1685,7 +1836,9 @@ issued \~tasruc's deed).
16851836
16861837### `++deed`, identity
16871838
1839+```
16881840 ++ deed ,[p=@ q=step r=?] :: sig, stage, fake?
1841+```
16891842
16901843`p` is the signature of a particular deed, which is a signed copy of
16911844`q`.
@@ -1698,7 +1851,9 @@ networks for development without interfering with the real network.
16981851
16991852### `++step`, identity stage
17001853
1854+```
17011855 ++ step ,[p=bray q=gens r=pass] :: identity stage
1856+```
17021857
17031858This is a single stage in our identity. Thus, this is specific to a
17041859single life in a single ship. Everything in here may change between
@@ -1712,13 +1867,17 @@ lives.
17121867
17131868### `++bray`
17141869
1870+```
17151871 ++ bray ,[p=life q=(unit life) r=ship s=@da] :: our parent us now
1872+```
17161873
17171874XXX
17181875
17191876### `++gens`, general identity
17201877
1878+```
17211879 ++ gens ,[p=lang q=gcos] :: general identity
1880+```
17221881
17231882`p` is the IETF language code for the preferred language of this
17241883identity. This is unused at the moment, but in the future text should be
@@ -1728,6 +1887,7 @@ localized based on this.
17281887
17291888### `++gcos`, identity description
17301889
1890+```
17311891 ++ gcos :: id description
17321892 $% [%czar ~] :: 8-bit ship
17331893 [%duke p=what] :: 32-bit ship
@@ -1735,6 +1895,7 @@ localized based on this.
17351895 [%king p=@t] :: 16-bit ship
17361896 [%pawn p=(unit ,@t)] :: 128-bit ship
17371897 == ::
1898+```
17381899
17391900This is the description of the identity of a ship. Most types of
17401901identity have a `@t` field, which is their human-readable name. The
@@ -1765,12 +1926,14 @@ This is the underworld of Urbit, where anonymity reigns supreme.
17651926
17661927### `++what`, logical destroyer identity
17671928
1929+```
17681930 ++ what :: logical identity
17691931 $% [%anon ~] :: anonymous
17701932 [%lady p=whom] :: female person ()
17711933 [%lord p=whom] :: male person []
17721934 [%punk p=sect q=@t] :: opaque handle ""
17731935 == ::
1936+```
17741937
17751938This is the logical identity of a destroyer.
17761939
@@ -1787,7 +1950,9 @@ A `%punk` is a person who is identified only by a handle.
17871950
17881951### `++whom`, real person
17891952
1953+```
17901954 ++ whom ,[p=@ud q=govt r=sect s=name] :: year/govt/id
1955+```
17911956
17921957Ths is the information associated with a real person. It is mostly
17931958information that could be observed with the briefest of interactions.
@@ -1802,19 +1967,25 @@ information that could be observed with the briefest of interactions.
18021967
18031968### `++govt`
18041969
1970+```
18051971 ++ govt path :: country/postcode
1972+```
18061973
18071974This is the location of the user, usually of the form "country/zip".
18081975
18091976### `++sect`
18101977
1978+```
18111979 ++ sect ?(%black %blue %red %orange %white) :: banner
1980+```
18121981
18131982XXX
18141983
18151984### `++name`
18161985
1986+```
18171987 ++ name ,[p=@t q=(unit ,@t) r=(unit ,@t) s=@t] :: first mid/nick last
1988+```
18181989
18191990This is the given name, possible middle name/initial, possible nickname,
1820−and surname of a user.
1991+and surname of a user.
docs/arvo/internals/behn.md → learn/arvo/behn.udonrenamed+9−7
@@ -1,10 +1,12 @@
1−---
2−navhome: /docs/
3−sort: 2
4−---
1+:- :~ navhome/'/docs/'
2+ navuptwo/'true'
3+ next/'true'
4+ sort/'2'
5+ title/'Behn'
6+ ==
7+;>
58
6−`%behn`
7−=======
9+# Behn
810
911Our simple timer.
1012
@@ -19,4 +21,4 @@ request to not be woken until after the given time.
1921`%eyre` uses `%behn` for timing out sessions, and `%clay` uses `%behn`
2022for keeping track of time-specified file requests. `%ames` should
2123probably use `%behn` to keep track of things like network timeouts and
22−retry timing, but it currently uses its own alarm system.
24+retry timing, but it currently uses its own alarm system.
docs/arvo/internals/clay.md → learn/arvo/clay.udonrenamed+9−7
@@ -1,10 +1,12 @@
1−---
2−navhome: /docs/
3−sort: 3
4−---
1+:- :~ navhome/'/docs/'
2+ navuptwo/'true'
3+ next/'true'
4+ sort/'3'
5+ title/'Clay'
6+ ==
7+;>
58
6−`%clay`
7−=======
9+# Clay
810
911Our filesystem.
1012
@@ -23,4 +25,4 @@ zuse. Second is the write, query, and subscription logic. Finally, there
2325is the logic for communicating requests to, and receiving requests from,
2426foreign ships.
2527
26−<list></list>
28+;list;
docs/arvo/internals/clay/architecture.md → learn/arvo/clay/architecture.udonrenamed+12−8
@@ -1,13 +1,15 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ navuptwo/'true'
3+ sort/'1'
4+ title/'Clay Architecture'
5+ ==
6+;>
47
5−
6−# clay
8+# Clay
79
810## high-level
911
10−clay is the primary filesystem for the arvo operating system,
12+Clay is the primary filesystem for the arvo operating system,
1113which is the core of an urbit. The architecture of clay is
1214intrinsically connected with arvo, but we assume no knowledge of
1315either arvo or urbit. We will point out only those features of
@@ -21,7 +23,7 @@ log. None of the effects from an event are emitted until the
2123event is entered in the log and persisted, either to disk or
2224another trusted source of persistence, such as a Kafka cluster.
2325Consequently, arvo is a single-level store: everything in its
24−state is persistent.
26+state is persistent.
2527
2628In a more traditional OS, everything in RAM can be erased at any
2729time by power failure, and is always erased on reboot. Thus, a
@@ -46,7 +48,7 @@ do so. clay natively provides the same functionality as modern
4648DVCSes, and more.
4749
4850clay has two other unique properties that we'll cover later on:
49−it supports typed data and is referentially transparent.
51+it supports typed data and is referentially transparent.
5052
5153### Revision Control
5254
@@ -199,6 +201,7 @@ marks. In `++grad` is `++diff`, `++pact`, `++join`, and `++mash`.
199201
200202The types are as follows, in an informal pseudocode:
201203
204+```
202205 ++ grab:
203206 ++ mime: <mime> -> <mark-type>
204207 ++ txt: <txt> -> <mark-type>
@@ -212,6 +215,7 @@ The types are as follows, in an informal pseudocode:
212215 ++ pact: (<mark-type>, <diff-type>) -> <mark-type>
213216 ++ join: (<diff-type>, <diff-type>) -> <diff-type> or NULL
214217 ++ mash: (<diff-type>, <diff-type>) -> <diff-type>
218+```
215219
216220These types are basically what you would expect. Not every mark
217221has each of these functions defined -- all of them are optional
docs/arvo/internals/clay/commentary.md → learn/arvo/clay/commentary.udonrenamed+206−22
@@ -1,10 +1,11 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ navuptwo/'true'
3+ sort/'2'
4+ title/'Clay commentary'
5+ ==
6+;>
47
5−
6−`%clay` commentary
7−==================
8+# Clay commentary
89
910`%clay` is our filesystem.
1011
@@ -26,8 +27,7 @@ filesystem.
2627Finally, we'll dive into the code and the algorithms themselves. You
2728know, the fun part.
2829
29−Data Models
30−-----------
30+## Data Models
3131
3232As you're reading through this section, remember you can always come
3333back to this when you run into these types later on. You're not going to
@@ -44,11 +44,13 @@ back when you need to.
4444
4545### `++raft`, formal state
4646
47+```
4748 ++ raft :: filesystem
4849 $: fat=(map ship room) :: domestic
4950 hoy=(map ship rung) :: foreign
5051 ran=rang :: hashes
5152 == ::
53+```
5254
5355This is the state of our vane. Anything that must be remembered between
5456calls to clay is stored in this state.
@@ -65,11 +67,13 @@ bookkeeping".
6567
6668### `++room`, filesystem per domestic ship
6769
70+```
6871 ++ room :: fs per ship
6972 $: hun=duct :: terminal duct
7073 hez=(unit duct) :: sync duch
7174 dos=(map desk dojo) :: native desk
7275 == ::
76+```
7377
7478This is the representation of the filesystem of a ship on our pier.
7579
@@ -86,7 +90,9 @@ set of desks on this ship, mapped to their data.
8690
8791### `++desk`, filesystem branch
8892
93+```
8994 ++ desk ,@tas :: ship desk case spur
95+```
9096
9197This is the name of a branch of the filesystem. The default desks are
9298"arvo", "main", and "try". More may be created by simply referencing
@@ -95,7 +101,9 @@ merged into each other.
95101
96102### `++dojo`, domestic desk state
97103
104+```
98105 ++ dojo ,[p=cult q=dome] :: domestic desk state
106+```
99107
100108This is the all the data that is specific to a particular desk on a
101109domestic ship. `p` is the set of subscribers to this desk and `q` is the
@@ -103,7 +111,9 @@ data in the desk.
103111
104112### `++cult`, subscriptions
105113
114+```
106115 ++ cult (map duct rave) :: subscriptions
116+```
107117
108118This is the set of subscriptions to a particular desk. The keys are the
109119ducts from where the subscriptions requests came. The results will be
@@ -112,10 +122,12 @@ requested information.
112122
113123### `++rave`, general subscription request
114124
125+```
115126 ++ rave :: general request
116127 $% [& p=mood] :: single request
117128 [| p=moat] :: change range
118129 == ::
130+```
119131
120132This represents a subscription request for a desk. The request can be
121133for either a single item in the desk or else for a range of changes on
@@ -123,7 +135,9 @@ the desk.
123135
124136### `++rove`, stored general subscription request
125137
138+```
126139 ++ rove (each mood moot) :: stored request
140+```
127141
128142When we store a request, we store subscriptions with a little extra
129143information so that we can determine whether new versions actually
@@ -131,7 +145,9 @@ affect the path we're subscribed to.
131145
132146### `++mood`, single subscription request
133147
148+```
134149 ++ mood ,[p=care q=case r=path] :: request in desk
150+```
135151
136152This represents a request for the state of the desk at a particular
137153commit, specfied by `q`. `p` specifies what kind of information is
@@ -139,7 +155,9 @@ desired, and `r` specifies the path we are requesting.
139155
140156### `++moat`, range subscription request
141157
158+```
142159 ++ moat ,[p=case q=case r=path] :: change range
160+```
143161
144162This represents a request for all changes between `p` and `q` on path
145163`r`. You will be notified when a change is made to the node referenced
@@ -147,7 +165,9 @@ by the path or to any of its children.
147165
148166### `++moot`, stored range subscription request
149167
168+```
150169 ++ moot ,[p=case q=case r=path s=(map path lobe)] ::
170+```
151171
152172This is just a `++moat` plus a map of paths to lobes. This map
153173represents the data at the node referenced by the path at case `p`, if
@@ -156,7 +176,9 @@ the subscription if the data at a new revision is different than it was.
156176
157177### `++care`, clay submode
158178
179+```
159180 ++ care ?(%u %v %w %x %y %z) :: clay submode
181+```
160182
161183This specifies what type of information is requested in a subscription
162184or a scry.
@@ -179,7 +201,9 @@ if `q:ankh` is null), then this produces null.
179201
180202### `++arch`, shallow filesystem node
181203
204+```
182205 ++ arch ,[p=@uvI q=(unit ,@uvI) r=(map ,@ta ,~)] :: fundamental node
206+```
183207
184208This is analogous to `++ankh` except that the we have neither our
185209contents nor the ankhs of our children. The other fields are exactly the
@@ -191,11 +215,13 @@ efficient conversion.
191215
192216### `++case`, specifying a commit
193217
218+```
194219 ++ case :: ship desk case spur
195220 $% [%da p=@da] :: date
196221 [%tas p=@tas] :: label
197222 [%ud p=@ud] :: number
198223 == ::
224+```
199225
200226A commit can be referred to in three ways: `%da` refers to the commit
201227that was at the head on date `p`, `%tas` refers to the commit labeled
@@ -205,6 +231,7 @@ referenced with a `++case`.
205231
206232### `++dome`, desk data
207233
234+```
208235 ++ dome :: project state
209236 $: ang=agon :: pedigree
210237 ank=ankh :: state
@@ -212,6 +239,7 @@ referenced with a `++case`.
212239 hit=(map ,@ud tako) :: changes by id
213240 lab=(map ,@tas ,@ud) :: labels
214241 == ::
242+```
215243
216244This is the data that is actually stored in a desk.
217245
@@ -243,11 +271,13 @@ desk.
243271
244272### `++ankh`, filesystem node
245273
274+```
246275 ++ ankh :: fs node (new)
247276 $: p=cash :: recursive hash
248277 q=(unit ,[p=cash q=*]) :: file
249278 r=(map ,@ta ankh) :: folders
250279 == ::
280+```
251281
252282This is a single node in the filesystem. This may be file or a directory
253283or both. In earth filesystems, a node is a file xor a directory. On
@@ -265,7 +295,9 @@ are, recursively, the nodes themselves.
265295
266296### `++cash`, ankh hash
267297
298+```
268299 ++ cash ,@uvH :: ankh hash
300+```
269301
270302This is a 128-bit hash of an ankh. These are mostly stored within ankhs
271303themselves, and they are used to check for changes in possibly-deep
@@ -273,20 +305,24 @@ hierarchies.
273305
274306### `++rung`, filesystem per neighbor ship
275307
308+```
276309 ++ rung $: rus=(map desk rede) :: neighbor desks
277310 == ::
311+```
278312
279313This is the filesystem of a neighbor ship. The keys to this map are all
280314the desks we know about on their ship.
281315
282316### `++rede`, desk state
283317
318+```
284319 ++ rede :: universal project
285320 $: lim=@da :: complete to
286321 qyx=cult :: subscribers
287322 ref=(unit rind) :: outgoing requests
288323 dom=dome :: revision state
289324 == ::
325+```
290326
291327This is our knowledge of the state of a desk, either foreign or
292328domestic.
@@ -305,12 +341,14 @@ null since we handle requests ourselves.
305341
306342### `++rind`, request manager
307343
344+```
308345 ++ rind :: request manager
309346 $: nix=@ud :: request index
310347 bom=(map ,@ud ,[p=duct q=rave]) :: outstanding
311348 fod=(map duct ,@ud) :: current requests
312349 haw=(map mood (unit)) :: simple cache
313350 == ::
351+```
314352
315353This is the request manager for a foreign desk.
316354
@@ -334,9 +372,11 @@ for a particular `++mood` is nearly instantaneous.
334372
335373### `++rang`, data store
336374
375+```
337376 ++ rang $: hut=(map tako yaki) ::
338377 lat=(map lobe blob) ::
339378 == ::
379+```
340380
341381This is a set of data keyed by hash. Thus, this is where the "real" data
342382is stored, but it is only meaningful if we know the hash of what we're
@@ -352,7 +392,9 @@ this map.
352392
353393### `++tako`, commit reference
354394
395+```
355396 ++ tako ,@ :: yaki ref
397+```
356398
357399This is a hash of a `++yaki`, a commit. These are most notably used as
358400the keys in `hut:rang`, where they are associated with the actual
@@ -361,7 +403,9 @@ associated with these.
361403
362404### `++yaki`, commit
363405
406+```
364407 ++ yaki ,[p=(list tako) q=(map path lobe) r=tako t=@da] :: commit
408+```
365409
366410This is a single commit.
367411
@@ -381,7 +425,9 @@ here tells the whole story.
381425
382426### `++lobe`, data reference
383427
428+```
384429 ++ lobe ,@ :: blob ref
430+```
385431
386432This is a hash of a `++blob`. These are most notably used in `lat:rang`,
387433where they are associated with the actual `++blob`, and as the values in
@@ -389,10 +435,12 @@ where they are associated with the actual `++blob`, and as the values in
389435
390436### `++blob`, data
391437
438+```
392439 ++ blob $% [%delta p=lobe q=lobe r=udon] :: delta on q
393440 [%direct p=lobe q=* r=umph] ::
394441 [%indirect p=lobe q=* r=udon s=lobe] ::
395442 == ::
443+```
396444
397445This is a node of data. In every case, `p` is the hash of the blob.
398446
@@ -415,6 +463,7 @@ not have to traverse the delta chain back to the creation of the file.
415463
416464### `++udon`, abstract delta
417465
466+```
418467 ++ udon :: abstract delta
419468 $: p=umph :: preprocessor
420469 $= q :: patch
@@ -424,6 +473,7 @@ not have to traverse the delta chain back to the creation of the file.
424473 [%d p=upas q=upas] :: tree edit
425474 == ::
426475 == ::
476+```
427477
428478This is an abstract change to a file. This is a superset of what would
429479normally be called diffs. Diffs usually refer to changes in lines of
@@ -448,17 +498,21 @@ moment, and may in fact be unimplemented.
448498
449499### `++urge`, list change
450500
501+```
451502 ++ urge |*(a=_,* (list (unce a))) :: list change
503+```
452504
453505This is a parametrized type for list changes. For example, `(urge ,@t)`
454506is a list change for lines of text.
455507
456508### `++unce`, change part of a list.
457509
510+```
458511 ++ unce |* a=_,* :: change part
459512 $% [%& p=@ud] :: skip[copy]
460513 [%| p=(list a) q=(list a)] :: p -> q[chunk]
461− == ::
514+ == ::
515+```
462516
463517This is a single change in a list of elements of type `a`. For example,
464518`(unce ,@t)` is a single change in a lines of text.
@@ -469,6 +523,7 @@ This is a single change in a list of elements of type `a`. For example,
469523
470524### `++umph`, preprocessing information
471525
526+```
472527 ++ umph :: change filter
473528 $| $? %a :: no filter
474529 %b :: jamfile
@@ -476,18 +531,21 @@ This is a single change in a list of elements of type `a`. For example,
476531 == ::
477532 $% [%d p=@ud] :: blocklist
478533 == ::
534+```
479535
480536This space intentionally left undocumented. This stuff will change once
481537we get a well-typed clay.
482538
483539### `++upas`, tree change
484540
541+```
485542 ++ upas :: tree change (%d)
486543 $& [p=upas q=upas] :: cell
487544 $% [%0 p=axis] :: copy old
488545 [%1 p=*] :: insert new
489546 [%2 p=axis q=udon] :: mutate!
490547 == ::
548+```
491549
492550This space intentionally left undocumented. This stuff is not known to
493551work, and will likely change when we get a well-typed clay. Also, this
@@ -495,10 +553,12 @@ is not a complicated type; it is not difficult to work out the meaning.
495553
496554### `++nori`, repository action
497555
556+```
498557 ++ nori :: repository action
499558 $% [& q=soba] :: delta
500559 [| p=@tas] :: label
501560 == ::
561+```
502562
503563This describes a change that we are asking clay to make to the desk.
504564There are two kinds of changes that may be made: we can modify files or
@@ -509,7 +569,9 @@ label. In the `&` case, we will apply the given changes.
509569
510570### `++soba`, delta
511571
572+```
512573 ++ soba ,[p=cart q=(list ,[p=path q=miso])] :: delta
574+```
513575
514576This describes a set of changes to make to a desk. The `cart` is simply
515577a pair of the old hash and the new hash of the desk. The list is a list
@@ -519,11 +581,13 @@ itself.
519581
520582### `++miso`, ankh delta
521583
584+```
522585 ++ miso :: ankh delta
523586 $% [%del p=*] :: delete
524587 [%ins p=*] :: insert
525588 [%mut p=udon] :: mutate
526589 == ::
590+```
527591
528592There are three kinds of changes that may be made to a node in a desk.
529593We can insert a file, in which case `p` is the contents of the new file.
@@ -533,7 +597,9 @@ changes we are applying to the file.
533597
534598### `++mizu`, merged state
535599
600+```
536601 ++ mizu ,[p=@u q=(map ,@ud tako) r=rang] :: new state
602+```
537603
538604This is the input to the `%merg` kiss, which allows us to perform a
539605merge. The `p` is the number of the new head commit. The `q` is a map
@@ -545,7 +611,9 @@ commits or data need be here.
545611
546612### `++riff`, request/desist
547613
614+```
548615 ++ riff ,[p=desk q=(unit rave)] :: request/desist
616+```
549617
550618This represents a request for data about a particular desk. If `q`
551619contains a `rave`, then this opens a subscription to the desk for that
@@ -554,7 +622,9 @@ along this duct.
554622
555623### `++riot`, response
556624
625+```
557626 ++ riot (unit rant) :: response/complete
627+```
558628
559629A riot is a response to a subscription. If null, the subscription has
560630been completed, and no more responses will be sent. Otherwise, the
@@ -562,11 +632,13 @@ been completed, and no more responses will be sent. Otherwise, the
562632
563633### `++rant`, response data
564634
635+```
565636 ++ rant :: namespace binding
566637 $: p=[p=care q=case r=@tas] :: clade release book
567638 q=path :: spur
568639 r=* :: data
569640 == ::
641+```
570642
571643This is the data at a particular node in the filesystem. `p.p` specifies
572644the type of data that was requested (and is produced). `q.p` gives the
@@ -576,11 +648,13 @@ node. `r` is the data itself (in the format specified by `p.p`).
576648
577649### `++nako`, subscription response data
578650
651+```
579652 ++ nako $: gar=(map ,@ud tako) :: new ids
580653 let=@ud :: next id
581654 lar=(set yaki) :: new commits
582655 bar=(set blob) :: new content
583656 == ::
657+```
584658
585659This is the data that is produced by a request for a range of revisions
586660of a desk. This allows us to easily keep track of a remote repository --
@@ -595,14 +669,14 @@ revision number, whichever is smaller.
595669
596670`lar` is the set of new commits, and `bar` is the set of new content.
597671
598−Public Interface
599−----------------
672+## Public Interface
600673
601674As with all vanes, there are exactly two ways to interact with clay.
602675`%clay` exports a namespace accessible through `.^`, which is described
603676above under `++care`. The primary way of interacting with clay, though,
604677is by sending kisses and receiving gifts.
605678
679+```
606680 ++ gift :: out result <-$
607681 $% [%ergo p=@p q=@tas r=@ud] :: version update
608682 [%note p=@tD q=tank] :: debug message
@@ -618,13 +692,16 @@ is by sending kisses and receiving gifts.
618692 [%wart p=sock q=@tas r=path s=*] :: network request
619693 [%warp p=sock q=riff] :: file request
620694 == ::
695+```
621696
622697There are only a small number of possible kisses, so it behooves us to
623698describe each in detail.
624699
700+```
625701 $% [%info p=@p q=@tas r=nori] :: internal edit
626702
627703 [%into p=@p q=@tas r=nori] :: external edit
704+```
628705
629706These two kisses are nearly identical. At a high level, they apply
630707changes to the filesystem. Whenever we add, remove, or edit a file, one
@@ -639,22 +716,28 @@ duct that unix is listening on for changes. From within Arvo, though, we
639716should never send a `%into` kiss. The `%info` kiss is exactly identical
640717except it does not reset the duct.
641718
719+```
642720 [%ingo p=@p q=@tas r=nori] :: internal noun edit
643721
644722 [%invo p=@p q=@tas r=nori] :: external noun edit
723+```
645724
646725These kisses are currently identical to `%info` and `%into`, though this
647726will not always be the case. The intent is for these kisses to allow
648727typed changes to clay so that we may store typed data. This is currently
649728unimplemented.
650729
730+```
651731 [%init p=@p] :: report install
732+```
652733
653734Init is called when a ship is started on our pier. This simply creates a
654735default `room` to go into our `raft`. Essentially, this initializes the
655736filesystem for a ship.
656737
738+```
657739 [%merg p=@p q=@tas r=mizu] :: internal change
740+```
658741
659742This is called to perform a merge. This is most visibly called by
660743:update to update the filesystem of the current ship to that of its
@@ -669,22 +752,25 @@ time is XX usually the closest time specified in a subscription request.
669752When `%wake` is XX called, we update our subscribers if there have been
670753any changes.
671754
755+```
672756 [%wart p=sock q=@tas r=path s=*] :: network request
757+```
673758
674759This is a request that has come across the network for a particular
675760file. When another ship asks for a file from us, that request comes to
676761us in the form of a `%wart` kiss. This is handled by trivially turning
677762it into a `%warp`.
678763
764+```
679765 [%warp p=sock q=riff] :: file request
766+```
680767
681768This is a request for information about a particular desk. This is, in
682769its most general form, a subscription, though in many cases it is the
683770trivial case of a subscription -- a read. See `++riff` for the format of
684771the request.
685772
686−Lifecycle of a Local Read
687−-------------------------
773+## Lifecycle of a Local Read
688774
689775There are two real types of interaction with a filesystem: you can read,
690776and you can write. We'll describe each process, detailing both the flow
@@ -705,6 +791,7 @@ version.
705791As in all vanes, a kiss enters clay via a call to `++call`. Scanning
706792through the arm, we quickly see where `%warp` is handled.
707793
794+```
708795 ?: =(p.p.q.hic q.p.q.hic)
709796 =+ une=(un p.p.q.hic now ruf)
710797 =+ wex=(di:une p.q.q.hic)
@@ -715,6 +802,7 @@ through the arm, we quickly see where `%warp` is handled.
715802 =+ ^= woo
716803 abet:wao
717804 [-.woo abet:(pish:une p.q.q.hic +.woo ran.wao)]
805+```
718806
719807We're following the familar patern of producing a list of moves and an
720808updated state. In this case, the state is `++raft`.
@@ -744,6 +832,7 @@ Although it's called last, it's usually worth examining `++abet` first,
744832since it defines in what ways we can cause side effects. Let's do that,
745833and also a few of the lines at the beginning of `++de`.
746834
835+```
747836 =| yel=(list ,[p=duct q=gift])
748837 =| byn=(list ,[p=duct q=riot])
749838 =| vag=(list ,[p=duct q=gift])
@@ -771,6 +860,7 @@ and also a few of the lines at the beginning of `++de`.
771860 %+ turn (flop tag)
772861 |=([a=duct b=path c=note] [a %pass b c])
773862 ==
863+```
774864
775865This is very simple code. We see there are exactly five different kinds
776866of side effects we can generate.
@@ -798,6 +888,7 @@ the only notes we pass here are `%wait` and `%rest` to the timer vane.
798888Now that we know what kinds of side effects we may have, we can jump
799889into the handling of requests.
800890
891+```
801892 ++ ease :: release request
802893 |= hen=duct
803894 ^+ +>
@@ -814,6 +905,7 @@ into the handling of requests.
814905 fod.u.ref (~(del by fod.u.ref) hen)
815906 bom.u.ref (~(del by bom.u.ref) u.nux)
816907 ==
908+```
817909
818910This is called when we're cancelling a subscription. For domestic desks,
819911`ref` is null, so we're going to cancel any timer we might have created.
@@ -826,14 +918,17 @@ it's easy to see that for foreign desks, we cancel any outstanding
826918requests for this duct and send a message over ames to the other ship
827919telling them to cancel the subscription.
828920
921+```
829922 ++ best
830923 |= [hen=duct tym=@da]
831924 %_(+> tag :_(tag [hen /tyme %t %rest tym]))
925+```
832926
833927This simply pushes a `%rest` note onto `tag`, from where it will be
834928passed back to arvo to be handled. This cancels the timer at the given
835929duct (with the given time).
836930
931+```
837932 ++ mabe :: maybe fire function
838933 |* [rov=rove fun=$+(@da _+>.^$)]
839934 ^+ +>.$
@@ -852,6 +947,7 @@ duct (with the given time).
852947 ?. ?=(%da -.q.mot) ~
853948 ?.((lth now p.q.mot) [~ now] [~ p.q.mot])
854949 ==
950+```
855951
856952This decides whether the given request can only be satsified in the
857953future. In that case, we call the given function with the time in the
@@ -869,6 +965,7 @@ smallest time.
869965The more interesting case is, of course, when we're not cancelling a
870966subscription but starting one.
871967
968+```
872969 ++ eave :: subscribe
873970 |= [hen=duct rav=rave]
874971 ^+ +>
@@ -883,6 +980,7 @@ subscription but starting one.
883980 ?~ u.ver
884981 (blub hen)
885982 (blab hen p.rav u.u.ver)
983+```
886984
887985There are two types of subscriptions -- either we're requesting a single
888986file or we're requesting a range of versions of a desk. We'll dicuss the
@@ -901,6 +999,7 @@ This case occurs when we make a request for a case whose (1) date is
901999after the current date, (2) number is after the current number, or (3)
9021000label is not yet used.
9031001
1002+```
9041003 ++ duce :: produce request
9051004 |= [hen=duct rov=rove]
9061005 ^+ +>
@@ -919,6 +1018,7 @@ label is not yet used.
9191018 bom.u.ref (~(put by bom.u.ref) inx [hen vaw])
9201019 fod.u.ref (~(put by fod.u.ref) hen inx)
9211020 ==
1021+```
9221022
9231023The code for `++duce` is nearly the exact inverse of `++ease`, which in
9241024the case of a domestic desk is very simple -- we simply put the duct and
@@ -927,9 +1027,11 @@ Recall that `ref` is null for domestic desks and that `++mabe` fires the
9271027given function with the time we need to be woken up at, if we need to be
9281028woken up at a particular time.
9291029
1030+```
9301031 ++ bait
9311032 |= [hen=duct tym=@da]
9321033 %_(+> tag :_(tag [hen /tyme %t %wait tym]))
1034+```
9331035
9341036This sets an alarm by sending a `%wait` card with the given time to the
9351037timer vane.
@@ -940,9 +1042,11 @@ that does not exist, (2) a `%w` request with a case that is not a
9401042number, or (3) a `%w` request with a nonempty path. The `++blub` is
9411043exactly what you would expect it to be.
9421044
1045+```
9431046 ++ blub :: ship stop
9441047 |= hen=duct
9451048 %_(+> byn [[hen ~] byn])
1049+```
9461050
9471051We notify the duct that we're cancelling their subscription since it
9481052isn't satisfiable.
@@ -950,14 +1054,17 @@ isn't satisfiable.
9501054Otherwise, we have received the desired information, so we send it on to
9511055the subscriber with `++blab`.
9521056
1057+```
9531058 ++ blab :: ship result
9541059 |= [hen=duct mun=mood dat=*]
9551060 ^+ +>
9561061 +>(byn [[hen ~ [p.mun q.mun syd] r.mun dat] byn])
1062+```
9571063
9581064The most interesting arm called in `++eave` is, of course, `++aver`,
9591065where we actually try to read the data.
9601066
1067+```
9611068 ++ aver :: read
9621069 |= mun=mood
9631070 ^- (unit (unit ,*))
@@ -968,6 +1075,7 @@ where we actually try to read the data.
9681075 ?^ ezy ezy
9691076 =+ nao=(~(case-to-aeon ze lim dom ran) q.mun)
9701077 ?~(nao ~ [~ (~(read-at-aeon ze lim dom ran) u.nao mun)])
1078+```
9711079
9721080We check immediately that we're not requesting the `rang` for any time
9731081other than the present.
@@ -983,6 +1091,7 @@ Here, we jump into `arvo/zuse.hoon`, which is where much of the
9831091algorithmic code is stored, as opposed to the clay interface, which is
9841092stored in `arvo/clay.hoon`. We examine `++case-to-aeon:ze`.
9851093
1094+```
9861095 ++ case-to-aeon :: case-to-aeon:ze
9871096 |= lok=case :: act count through
9881097 ^- (unit aeon)
@@ -991,7 +1100,7 @@ stored in `arvo/clay.hoon`. We examine `++case-to-aeon:ze`.
9911100 ?: (gth p.lok lim) ~
9921101 |- ^- (unit aeon)
9931102 ?: =(0 let) [~ 0] :: avoid underflow
994− ?: %+ gte p.lok
1103+ ?: %+ gte p.lok
9951104 =< t
9961105 %- tako-to-yaki
9971106 %- aeon-to-tako
@@ -1002,6 +1111,7 @@ stored in `arvo/clay.hoon`. We examine `++case-to-aeon:ze`.
10021111 %tas (~(get by lab) p.lok)
10031112 %ud ?:((gth p.lok let) ~ [~ p.lok])
10041113 ==
1114+```
10051115
10061116We handle each type of `case` differently. The latter two types are
10071117easy.
@@ -1022,9 +1132,11 @@ revisions were committed, we produce `0`.
10221132
10231133The definitions of `++aeon-to-tako` and `++tako-to-yaki` are trivial.
10241134
1135+```
10251136 ++ aeon-to-tako ~(got by hit)
10261137
10271138 ++ tako-to-yaki ~(got by hut) :: grab yaki
1139+```
10281140
10291141We simply look up the aeon or tako in their respective maps (`hit` and
10301142`hut`).
@@ -1033,24 +1145,28 @@ Assuming we got a valid version number, `++aver` calls
10331145`++read-at-aeon:ze`, which reads the requested data at the given
10341146revision.
10351147
1148+```
10361149 ++ read-at-aeon :: read-at-aeon:ze
10371150 |= [oan=aeon mun=mood] :: seek and read
10381151 ^- (unit)
10391152 ?: &(?=(%w p.mun) !?=(%ud -.q.mun)) :: NB only for speed
10401153 ?^(r.mun ~ [~ oan])
10411154 (read:(rewind oan) mun)
1155+```
10421156
10431157If we're requesting the revision number with a case other than by
10441158number, then we go ahead and just produce the number we were given.
10451159Otherwise, we call `++rewind` to rewind our state to the given revision,
10461160and then we call `++read` to get the requested information.
10471161
1162+```
10481163 ++ rewind :: rewind:ze
10491164 |= oan=aeon :: rewind to aeon
10501165 ^+ +>
10511166 ?: =(let oan) +>
10521167 ?: (gth oan let) !! :: don't have version
10531168 +>(ank (checkout-ankh q:(tako-to-yaki (aeon-to-tako oan))), let oan)
1169+```
10541170
10551171If we're already at the requested version, we do nothing. If we're
10561172requesting a version later than our head, we are unable to comply.
@@ -1061,6 +1177,7 @@ represents a version of the filesystem. We call `++checkout-ankh` to
10611177checkout the commit, and we replace `ank` in our context with the
10621178result.
10631179
1180+```
10641181 ++ checkout-ankh :: checkout-ankh:ze
10651182 |= hat=(map path lobe) :: checkout commit
10661183 ^- ankh
@@ -1074,21 +1191,25 @@ result.
10741191 ank(q [~ (sham zar) zar])
10751192 =+ nak=(~(get by r.ank) i.pat)
10761193 %= ank
1077− r %+ ~(put by r.ank) i.pat
1194+ r %+ ~(put by r.ank) i.pat
10781195 $(pat t.pat, ank (fall nak _ankh))
10791196 ==
1197+```
10801198
10811199Twice we call `++cosh`, which hashes a commit, updating `p` in an
10821200`ankh`. Let's jump into that algorithm before we describe
10831201`++checkout-ankh`.
10841202
1203+```
10851204 ++ cosh :: locally rehash
10861205 |= ank=ankh :: NB v/unix.c
10871206 ank(p rehash:(zu ank))
1207+```
10881208
10891209We simply replace `p` in the hash with the `cash` we get from a call to
10901210`++rehash:zu`.
10911211
1212+```
10921213 ++ zu !: :: filesystem
10931214 |= ank=ankh :: filesystem state
10941215 =| myz=(list ,[p=path q=miso]) :: changes in reverse
@@ -1105,6 +1226,7 @@ We simply replace `p` in the hash with the `cash` we get from a call to
11051226 $(r.ank l.r.ank, axe (peg axe 2))
11061227 $(r.ank r.r.ank, axe (peg axe 3))
11071228 ==
1229+```
11081230
11091231`++zu` is a core we set up with a particular filesystem node to traverse
11101232a checkout of the filesystem and access the actual data inside it. One
@@ -1125,19 +1247,24 @@ We fold over every path in this version of the filesystem and create a
11251247great ankh out of them. First, we call `++lobe-to-noun` to get the raw
11261248data referred to be each lobe.
11271249
1250+```
11281251 ++ lobe-to-noun :: grab blob
11291252 |= p=lobe :: ^- *
1130− %- blob-to-noun
1253+ %- blob-to-noun
11311254 (lobe-to-blob p)
1255+```
11321256
11331257This converts a lobe into the raw data it refers to by first getting the
11341258blob with `++lobe-to-blob` and converting that into data with
11351259`++blob-to-noun`.
11361260
1261+```
11371262 ++ lobe-to-blob ~(got by lat) :: grab blob
1263+```
11381264
11391265This just grabs the blob that the lobe refers to.
11401266
1267+```
11411268 ++ blob-to-noun :: grab blob
11421269 |= p=blob
11431270 ?- -.p
@@ -1145,12 +1272,14 @@ This just grabs the blob that the lobe refers to.
11451272 %direct q.p
11461273 %indirect q.p
11471274 ==
1275+```
11481276
11491277If we have either a direct or an indirect blob, then the data is stored
11501278right in the blob. Otherwise, we have to reconstruct it from the diffs.
11511279We do this by calling `++lump` on the diff in the blob with the data
11521280obtained by recursively calling the parent of this blob.
11531281
1282+```
11541283 ++ lump :: apply patch
11551284 |= [don=udon src=*]
11561285 ^- *
@@ -1170,6 +1299,7 @@ obtained by recursively calling the parent of this blob.
11701299 %c (lurk dst p.q.don)
11711300 ==
11721301 ==
1302+```
11731303
11741304This is defined in `arvo/hoon.hoon` for historical reasons which are
11751305likely no longer applicable. Since the `++umph` structure will likely
@@ -1179,6 +1309,7 @@ we're performing a trivial replace, so we produce simply `q.q.don`. If
11791309we have a `%c` udon, then we're performing a list merge (as in, for
11801310example, lines of text). The merge is performed by `++lurk`.
11811311
1312+```
11821313 ++ lurk :: apply list patch
11831314 |* [hel=(list) rug=(urge)]
11841315 ^+ hel
@@ -1203,6 +1334,7 @@ example, lines of text). The merge is performed by `++lurk`.
12031334 war (weld q.i.rug war)
12041335 ==
12051336 ==
1337+```
12061338
12071339We accumulate our final result in `war`. If there's nothing more in our
12081340list of merge instructions (unces), we just reverse `war` and produce
@@ -1216,6 +1348,7 @@ crashing on failure. If they're good, then we append the new lines in
12161348And that's really it. List merges are pretty easy. Anyway, if you
12171349recall, we were discussing `++checkout-ankh`.
12181350
1351+```
12191352 ++ checkout-ankh :: checkout-ankh:ze
12201353 |= hat=(map path lobe) :: checkout commit
12211354 ^- ankh
@@ -1229,9 +1362,10 @@ recall, we were discussing `++checkout-ankh`.
12291362 ank(q [~ (sham zar) zar])
12301363 =+ nak=(~(get by r.ank) i.pat)
12311364 %= ank
1232− r %+ ~(put by r.ank) i.pat
1365+ r %+ ~(put by r.ank) i.pat
12331366 $(pat t.pat, ank (fall nak _ankh))
12341367 ==
1368+```
12351369
12361370If the path is null, then we calculate `zar`, the raw data at the path
12371371`pat` in this version. We produce the given ankh with the correct data.
@@ -1246,21 +1380,25 @@ immediately obvious why it works. An example should clear everything up.
12461380
12471381Suppose `hat` is a map of the following information.
12481382
1383+```
12491384 /greeting --> "customary upon meeting"
12501385 /greeting/english --> "hello"
12511386 /greeting/spanish --> "hola"
12521387 /greeting/russian/short --> "привет"
12531388 /greeting/russian/long --> "Здравствуйте"
12541389 /farewell/russian --> "до свидания"
1390+```
12551391
12561392Furthermore, let's say that we process them in this order:
12571393
1394+```
12581395 /greeting/english
12591396 /greeting/russian/short
12601397 /greeting/russian/long
12611398 /greeting
12621399 /greeting/spanish
12631400 /farewell/russian
1401+```
12641402
12651403Then, the first path we process is `/greeting/english` . Since our path
12661404is not null, we try to get `nak`, but because our ankh is blank at this
@@ -1320,6 +1458,7 @@ in which our current state is (very nearly) as it was when the specified
13201458version of the desk was the head. This allows `++read-at-aeon` to call
13211459`++read` to read the requested information.
13221460
1461+```
13231462 ++ read :: read:ze
13241463 |= mun=mood :: read at point
13251464 ^- (unit)
@@ -1335,6 +1474,7 @@ version of the desk was the head. This allows `++read-at-aeon` to call
13351474 ?^(r.mun ~ [~ [t.yak (forge-nori yak)]])
13361475 ::?> ?=(^ hit) ?^(r.mun ~ [~ i.hit]) :: what do?? need [@da nori]
13371476 (query(ank ank:(descend-path:(zu ank) r.mun)) p.mun)
1477+```
13381478
13391479If we're requesting the dome, then we just return that immediately.
13401480
@@ -1350,19 +1490,23 @@ doesn't seem to work, so we'll ignore this case.
13501490Otherwise, we descend into the ankh tree to the given path with
13511491`++descend-path:zu`, and then we handle specific request in `++query`.
13521492
1493+```
13531494 ++ descend-path :: descend recursively
13541495 |= way=path
13551496 ^+ +>
13561497 ?~(way +> $(way t.way, +> (descend i.way)))
1498+```
13571499
13581500This is simple recursion down into the ankh tree. `++descend` descends
13591501one level, so this will eventually get us down to the path we want.
13601502
1503+```
13611504 ++ descend :: descend
13621505 |= lol=@ta
13631506 ^+ +>
13641507 =+ you=(~(get by r.ank) lol)
13651508 +>.$(ram [lol ram], ank ?~(you [*cash ~ ~] u.you))
1509+```
13661510
13671511`ram` is the path that we're at, so to descend one level we push the
13681512name of this level onto that path. We update the ankh with the correct
@@ -1371,6 +1515,7 @@ one at that path if it exists; else we create a blank one.
13711515Once we've decscended to the correct level, we need to actually deal
13721516with the request.
13731517
1518+```
13741519 ++ query :: query:ze
13751520 |= ren=?(%u %v %x %y %z) :: endpoint query
13761521 ^- (unit ,*)
@@ -1381,12 +1526,14 @@ with the request.
13811526 %y [~ as-arch]
13821527 %z [~ ank]
13831528 ==
1529+```
13841530
13851531Now that everything's set up, it's really easy. If they're requesting
13861532the rang, dome, or ankh, we give it to them. If the contents of a file,
13871533we give it to them if it is in fact a file. If the `arch`, then we
13881534calculate it with `++as-arch`.
13891535
1536+```
13901537 ++ as-arch :: as-arch:ze
13911538 ^- arch :: arch report
13921539 :+ p.ank
@@ -1394,19 +1541,20 @@ calculate it with `++as-arch`.
13941541 |- ^- (map ,@ta ,~)
13951542 ?~ r.ank ~
13961543 [[p.n.r.ank ~] $(r.ank l.r.ank) $(r.ank r.r.ank)]
1544+```
13971545
13981546This very simply strips out all the "real" data and returns just our own
13991547hash, the hash of the file contents (if we're a file), and a map of the
14001548names of our immediate children.
14011549
1402−Lifecycle of a Local Subscription
1403−---------------------------------
1550+## Lifecycle of a Local Subscription
14041551
14051552A subscription to a range of revisions of a desk initially follows the
14061553same path that a single read does. In `++aver`, we checked the head of
14071554the given rave. If the head was `&`, then it was a single request, so we
14081555handled it above. If `|`, then we handle it with the following code.
14091556
1557+```
14101558 =+ nab=(~(case-to-aeon ze lim dom ran) p.p.rav)
14111559 ?~ nab
14121560 ?> =(~ (~(case-to-aeon ze lim dom ran) q.p.rav))
@@ -1427,6 +1575,7 @@ handled it above. If `|`, then we handle it with the following code.
14271575 [%ud +(let.dom)]
14281576 (duce hen `rove`[%| ptr q.p.rav r.p.rav ear])
14291577 ==
1578+```
14301579
14311580Recall that `++case-to-aeon:ze` produces the revision number that a case
14321581corresponds to, if it corresponds to any. If it doesn't yet correspond
@@ -1465,10 +1614,12 @@ We glossed over the calls to `++lobes-at-path`, `++make-nako`, and
14651614`++bleb`, so we'll get back to those right now. `++bleb` is simple, so
14661615we'll start with that.
14671616
1617+```
14681618 ++ bleb :: ship sequence
14691619 |= [hen=duct ins=@ud hip=nako]
14701620 ^+ +>
14711621 (blab hen [%w [%ud ins] ~] hip)
1622+```
14721623
14731624We're given a duct, the beginning revision number, and the nako that
14741625contains the updates since that revision. We use `++blab` to produce
@@ -1477,6 +1628,7 @@ of the beginning of the subscription, and the data is the nako itself.
14771628
14781629We call `++lobes-at-path:ze` to get the data at the particular path.
14791630
1631+```
14801632 ++ lobes-at-path :: lobes-at-path:ze
14811633 |= [oan=aeon pax=path] :: data at path
14821634 ^- (map path lobe)
@@ -1495,6 +1647,7 @@ We call `++lobes-at-path:ze` to get the data at the particular path.
14951647 =(-.pax -.p)
14961648 $(p +.p, pax +.pax)
14971649 == ==
1650+```
14981651
14991652At revision zero, the theoretical common revision between all
15001653repositories, there is no data, so we produce null.
@@ -1508,6 +1661,7 @@ tell if a node or its children have changed.
15081661
15091662Finally, we will describe `++make-nako:ze`.
15101663
1664+```
15111665 ++ make-nako :: gack a through b
15121666 |= [a=aeon b=aeon]
15131667 ^- [(map aeon tako) aeon (set yaki) (set blob)]
@@ -1520,6 +1674,7 @@ Finally, we will describe `++make-nako:ze`.
15201674 %- mo %+ skim (~(tap by hit) ~)
15211675 |= [p=aeon *]
15221676 &((gth p a) (lte p b))
1677+```
15231678
15241679We need to produce four things -- the numbers of the new commits, the
15251680number of the latest commit, the new commits themselves, and the new
@@ -1535,10 +1690,11 @@ commit.
15351690The third and fourth are slightly more interesting, though not too
15361691terribly difficult. First, we call `++reachable-between-takos`.
15371692
1693+```
15381694 ++ reachable-between-takos
15391695 |= [a=(unit tako) b=tako] :: pack a through b
15401696 ^- [(set tako) (set lobe)]
1541− =+ ^= sar
1697+ =+ ^= sar
15421698 ?~ a ~
15431699 (reachable-takos r:(tako-to-yaki u.a))
15441700 =+ yak=`yaki`(tako-to-yaki b)
@@ -1556,6 +1712,7 @@ terribly difficult. First, we call `++reachable-between-takos`.
15561712 bar
15571713 %- ~(uni in bar)
15581714 ^$(yak (tako-to-yaki yek))
1715+```
15591716
15601717We take a possible starting commit and a definite ending commit, and we
15611718produce the set of commits and the set of data between them.
@@ -1564,6 +1721,7 @@ We let `sar` be the set of commits reachable from `a`. If `a` is null,
15641721then obviously no commits are reachable. Otherwise, we call
15651722`++reachable-takos` to calculate this.
15661723
1724+```
15671725 ++ reachable-takos :: reachable
15681726 |= p=tako :: XX slow
15691727 ^- (set tako)
@@ -1574,6 +1732,7 @@ then obviously no commits are reachable. Otherwise, we call
15741732 ?: (~(has in s) q) :: already done
15751733 s :: hence skip
15761734 (~(uni in s) ^$(p q)) :: otherwise traverse
1735+```
15771736
15781737We very simply produce the set of the given tako plus its parents,
15791738recursively.
@@ -1587,6 +1746,7 @@ tako referenced by `a`. The result is passed into `++new-lobes-takos` to
15871746do the same, but not recomputing those in already calculated last
15881747sentence. This produces the sets of takos and lobes we need.
15891748
1749+```
15901750 ++ new-lobes :: object hash set
15911751 |= [b=(set lobe) a=(set tako)] :: that aren't in b
15921752 ^- (set lobe)
@@ -1605,6 +1765,7 @@ sentence. This produces the sets of takos and lobes we need.
16051765 %delta (~(put in $(lob q.gar)) lob)
16061766 %indirect (~(put in $(lob s.gar)) lob)
16071767 ==
1768+```
16081769
16091770Here, we're creating a set of lobes referenced in a commit in `a`. We
16101771start out with `b` as the initial set of lobes, so we don't need to
@@ -1616,18 +1777,19 @@ there, and, if it's not already in `b`, we add it to `b`. In the case of
16161777a direct blob, we're done. For a delta or an indirect blob, we
16171778recursively add every blob referenced within the blob.
16181779
1780+```
16191781 ++ new-lobes-takos :: garg & repack
16201782 |= [b=(set lobe) a=(set tako)]
16211783 ^- [(set tako) (set lobe)]
16221784 [a (new-lobes b a)]
1785+```
16231786
16241787Here, we just update the set of lobes we're given with the commits we're
16251788given and produce both sets.
16261789
16271790This concludes our discussion of a local subscription.
16281791
1629−Lifecycle of a Foreign Read or Subscription
1630−-------------------------------------------
1792+## Lifecycle of a Foreign Read or Subscription
16311793
16321794Foreign reads and subscriptions are handled in much the same way as
16331795local ones. The interface is the same -- a vane or app sends a `%warp`
@@ -1638,12 +1800,14 @@ Thus, we start in the same place -- in `++call`, handling `%warp`.
16381800However, since the two side of the `sock` are different, we follow a
16391801different path.
16401802
1803+```
16411804 =+ wex=(do now p.q.hic p.q.q.hic ruf)
16421805 =+ ^= woo
16431806 ?~ q.q.q.hic
16441807 abet:(ease:wex hen)
16451808 abet:(eave:wex hen u.q.q.q.hic)
16461809 [-.woo (posh q.p.q.hic p.q.q.hic +.woo ruf)]
1810+```
16471811
16481812If we compare this to how the local case was handled, we see that it's
16491813not all that different. We use `++do` rather than `++un` and `++de` to
@@ -1656,6 +1820,7 @@ the modified rung into the raft.
16561820
16571821We'll first trace through `++do`.
16581822
1823+```
16591824 ++ do
16601825 |= [now=@da [who=ship him=ship] syd=@tas ruf=raft]
16611826 =+ ^= rug ^- rung
@@ -1665,6 +1830,7 @@ We'll first trace through `++do`.
16651830 =+ yit=(~(get by rus.rug) syd)
16661831 ?^(yit u.yit `rede`[~2000.1.1 ~ [~ *rind] *dome])
16671832 ((de now ~ ~) [who him] syd red ran.ruf)
1833+```
16681834
16691835If we already have a rung for this foreign ship, then we use that.
16701836Otherwise, we create a new blank one. If we already have a rede in this
@@ -1678,6 +1844,7 @@ With this information, we create a `++de` core as usual.
16781844Although we've already covered `++ease` and `++eave`, we'll go through
16791845them quickly again, highlighting the case of foreign request.
16801846
1847+```
16811848 ++ ease :: release request
16821849 |= hen=duct
16831850 ^+ +>
@@ -1694,6 +1861,7 @@ them quickly again, highlighting the case of foreign request.
16941861 fod.u.ref (~(del by fod.u.ref) hen)
16951862 bom.u.ref (~(del by bom.u.ref) u.nux)
16961863 ==
1864+```
16971865
16981866Here, we still remove the duct from our cult (we maintain a cult even
16991867for foreign desks), but we also need to tell the foreign desk to cancel
@@ -1710,6 +1878,7 @@ is exactly identical to the case of the local request except `++duce`.
17101878We said that `++duce` simply puts the request into our cult. This is
17111879true for a domestic request, but distinctly untrue for foreign requests.
17121880
1881+```
17131882 ++ duce :: produce request
17141883 |= [hen=duct rov=rove]
17151884 ^+ +>
@@ -1727,6 +1896,7 @@ true for a domestic request, but distinctly untrue for foreign requests.
17271896 bom.u.ref (~(put by bom.u.ref) inx [hen vaw])
17281897 fod.u.ref (~(put by fod.u.ref) hen inx)
17291898 ==
1899+```
17301900
17311901If we have a request manager (i.e. this is a foreign desk), then we do
17321902the approximate inverse of `++ease`. We create a rave out of the given
@@ -1745,6 +1915,7 @@ ship, that comes to us in the form of a `%wart` from ames.
17451915We handle a `%wart` in `++call`, right next to where we handle the
17461916`%warp` case.
17471917
1918+```
17481919 %wart
17491920 ?> ?=(%re q.q.hic)
17501921 =+ ryf=((hard riff) s.q.hic)
@@ -1754,6 +1925,7 @@ We handle a `%wart` in `++call`, right next to where we handle the
17541925 %c
17551926 [%warp [p.p.q.hic p.p.q.hic] ryf]
17561927 ==
1928+```
17571929
17581930Every request we receive should be of type `riff`, so we coerce it into
17591931that type. We just convert this into a new `%warp` kiss that we pass to
@@ -1761,6 +1933,7 @@ ourself. This gets handled like normal, as a local request. When the
17611933request produces a value, it does so like normal as a `%writ`, which is
17621934returned to `++take` along the path we just sent it on.
17631935
1936+```
17641937 %writ
17651938 ?> ?=([@ @ *] tea)
17661939 =+ our=(need (slaw %p i.tea))
@@ -1769,6 +1942,7 @@ returned to `++take` along the path we just sent it on.
17691942 :~ :- hen
17701943 [%pass ~ %a [%want [our him] [%r %re %c t.t.tea] p.+.q.hin]]
17711944 ==
1945+```
17721946
17731947Since we encoded the ship we need to respond to in the path, we can just
17741948pass our `%want` back to ames, so that we tell the requesting ship about
@@ -1777,6 +1951,7 @@ the new data.
17771951This comes back to the original ship as a `%waft` from ames, which comes
17781952into `++take`, right next to where we handled `%writ`.
17791953
1954+```
17801955 %waft
17811956 ?> ?=([@ @ ~] tea)
17821957 =+ syd=(need (slaw %tas i.tea))
@@ -1788,6 +1963,7 @@ into `++take`, right next to where we handled `%writ`.
17881963 =+ zot=abet.zat
17891964 [-.zot (posh q.p.+.q.hin syd +.zot ruf)]
17901965 [mos ..^$(ran.ruf ran.zat)] :: merge in new obj
1966+```
17911967
17921968This gets the desk and sequence number from the path the request was
17931969sent over. This determines exactly which request is being responded to.
@@ -1797,6 +1973,7 @@ We call `++knit:de` to apply the changes to our local desk, and we call
17971973
17981974We'll examine `++knit` and `++wake`, in that order.
17991975
1976+```
18001977 ++ knit :: external change
18011978 |= [inx=@ud rot=riot]
18021979 ^+ +>
@@ -1833,6 +2010,7 @@ We'll examine `++knit` and `++wake`, in that order.
18332010 %= $
18342011 haw.u.ref (~(del by haw.u.ref) nez)
18352012 ==
2013+```
18362014
18372015This is kind of a long gate, but don't worry, it's not bad at all.
18382016
@@ -1867,6 +2045,7 @@ of the desk. We do so in `++edis`, and then we remove the stuff we just
18672045applied from the cache, since it's not really a true "single read", like
18682046what should really be in the cache.
18692047
2048+```
18702049 ++ edis :: apply subscription
18712050 |= nak=nako
18722051 ^+ +>
@@ -1883,6 +2062,7 @@ what should really be in the cache.
18832062 |= [sar=yaki yeb=(map tako yaki)]
18842063 %+ ~(put by yeb) r.sar sar
18852064 ==
2065+```
18862066
18872067This shows, of course, exactly why nako is defined the way it is. To
18882068become completely up to date with the foreign desk, we need to merge
@@ -1900,6 +2080,7 @@ This concludes our discussion of `++knit`. Now the changes have been
19002080applied to our local copy of the desk, and we just need to update our
19012081subscribers. We do so in `++wake:de`.
19022082
2083+```
19032084 ++ wake :: update subscribers
19042085 ^+ .
19052086 =+ xiq=(~(tap by qyx) ~)
@@ -1948,6 +2129,7 @@ subscribers. We do so in `++wake:de`.
19482129 ==
19492130 ==
19502131 --
2132+```
19512133
19522134This is even longer than `++knit`, but it's pretty similar to `++eave`.
19532135We loop through each of our subscribers `xiq`, processing each in turn.
@@ -1974,11 +2156,13 @@ it.
19742156`++balk` is very simple, so we'll describe it here before we get to the
19752157subscription case.
19762158
2159+```
19772160 ++ balk :: read and send
19782161 |= [hen=duct oan=@ud mun=mood]
19792162 ^+ +>
19802163 =+ vid=(~(read-at-aeon ze lim dom ran) oan mun)
19812164 ?~ vid (blub hen) (blab hen mun u.vid)
2165+```
19822166
19832167We call `++read-at-aeon` on the given request and aeon. If you recall,
19842168this processes a `mood` at a particular aeon and produces the result, if
docs/arvo/internals/dill.md → learn/arvo/dill.udonrenamed+9−7
@@ -1,10 +1,12 @@
1−---
2−navhome: /docs/
3−sort: 4
4−---
1+:- :~ navhome/'/docs/'
2+ navuptwo/'true'
3+ next/'true'
4+ sort/'4'
5+ title/'Dill'
6+ ==
7+;>
58
6−`%dill`
7−=======
9+# Dill
810
911Our terminal driver.
1012
@@ -23,4 +25,4 @@ password), which duct to produce effects on, and so forth. Second, it
2325handles terminal events, keystroke by keystroke. Most characters are
2426simply pushed onto the buffer and blitted to the screen, but some
2527characters, including control-modified keys, arrow keys, etc. require
26−special handling. Most of the readline functionality is in `%dill`.
28+special handling. Most of the readline functionality is in `%dill`.
docs/arvo/internals/eyre.md → learn/arvo/eyre.udonrenamed+9−7
@@ -1,10 +1,12 @@
1−---
2−navhome: /docs/
3−sort: 5
4−---
1+:- :~ navhome/'/docs/'
2+ navuptwo/'true'
3+ next/'true'
4+ sort/'5'
5+ title/'Eyre'
6+ ==
7+;>
58
6−`%eyre`
7−=======
9+# Eyre
810
911Our http server.
1012
@@ -19,4 +21,4 @@ essentially stateless, like functional publishing with `%ford`.
1921Additionally, there's a fairly significant component that handles
2022`%gall` messaging and subscriptions, which must be stateful.
2123
22−<div><list/></div>
24+;list;
docs/arvo/internals/eyre/commentary.md → learn/arvo/eyre/commentary.udonrenamed+13−16
@@ -1,9 +1,11 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ navuptwo/'true'
3+ sort/'1'
4+ title/'Eyre commentary'
5+ ==
6+;>
47
5−Eyre: Reference
6−===============
8+# Eyre: Reference
79
810## State
911
@@ -24,17 +26,16 @@ Runtime
2426
2527- `++handle`
2628 + `++parse`
27− - `++as...`
29+ - `++as...`
2830- `++ya`
2931- `++ix`
3032
31−Eyre: Commentary
32−================
33+## Eyre: Commentary
3334
3435Let us follow the loading of a simple cli app, as it bounces from
3536browser to server to browser and back.
3637
37−## Initial request<a id="init"/>
38+## Initial request ;a(id "init");
3839
3940An http request for `http://sampel-sipnym.urbit.org/cli` will be [redirected](dns)
4041to the `%eyre` on ~sampel-sipnym, and come in as a `%this` kiss.
@@ -155,7 +156,7 @@ requested file. `/~/at/auth.js`, then, is a request for the built-in `auth:js`
155156(parsed to and processed from an `[%auth %js ~]` perk), with session data added
156157as `window.urb`. And indeed, ``[`%js /~/at/auth]`` is parsed to
157158``[%auth at [`%js /auth]``, which in `++process-auth` is re-`process`ed to
158−`[%js ++auth:js]`, which is `++resolve`d after an `++add-json` of
159+`[%js ++auth:js]`, which is `++resolve`d after an `++add-json` of
159160the relevant data. The yac cookies are also passed to `resolve`, which
160161`++add-cookies` injects into the `httr`.
161162
@@ -182,8 +183,6 @@ know to serve the window.urb necessary to make requests, and the `urb.js`
182183standard library which extends it with a number of wrappers to them and other
183184useful functions.
184185
185−---
186−
187186One of those functions is `urb.bind`, which is used to subscribe to application
188187data. Userspace javascript sets `urb.appl` to `/tic`, and binds `lines` to a
189188`;pre;` text display, using a callback.
@@ -212,7 +211,7 @@ is started using `urb.poll`. At `/~/of/{ixor}`, perk
212211`[%view ixor ~ {sequence-number}]`, it is `process`ed by `++poll:ix` (the cyst
213212is retrieved by `++ire-ix` form global state, using the perk `ixor`): the
214213sequence number is in the past, so the previously received `%rush` is
215−`++give-even`. After deleting the previous message in the queue and invoking
214+`++give-even`. After deleting the previous message in the queue and invoking
216215`++pass-took` to signal `%gall` of this occurrence, the data is annotated with
217216the source app+path `++subs-to-json`, and returned to the polling duct.
218217
@@ -220,8 +219,6 @@ On the client, the user callback receives the `/cli` history, and displays it on
220219the page. The `/~/of` long poll is continued, this time reaching `++poll:ix`
221220with the "pending" sequence number, and being stored in the `cyst` for its troubles.
222221
223−---
224−
225222Its next update proceeds idenitcally, but first it must be triggered, which
226223happens when the user enters "(add 2 2)\n", firing an `urb.send` from the event
227224handler. This sends a `POST` request to `/~/to/cli/json.json`, perk `%mess`,
@@ -233,7 +230,7 @@ sent to the client callback.
233230## A path not taken: magic filenames <a id="mage"/>
234231
235232The `/robots.txt` and `/favicon.(ico|png)` files are static, and served
236−immediately when caught by a `++parse`.
233+immediately when caught by a `++parse`.
237234
238235XX index.html?
239236
docs/arvo/internals/eyre/specification.md → learn/arvo/eyre/specification.udonrenamed+149−81
@@ -1,3 +1,10 @@
1+:- :~ navhome/'/docs/'
2+ navuptwo/'true'
3+ sort/'2'
4+ title/'Eyre specification'
5+ ==
6+;>
7+
18# Specification
29
310The `%eyre` vane serves one purpose: receiving inbound HTTP requests from browsers and clients pretending to be browsers. To facilitate this communication, `%eyre` does two things: 1. provide an API for traditional clients to talk to; and 2. provide a mechanism for saving state that allows the server to keep track of identities/sessions, subscription data, and active connections.
@@ -5,39 +12,47 @@ The `%eyre` vane serves one purpose: receiving inbound HTTP requests from browse
512This document outlines the following:
613
7141. [`perk`](#perk), a `pork` subset that defines what URLs the client can send to `%eyre`.
15+
8162. [the values stored on the client](#client), both statically in cookies and dynamically as the `window.urb` object, which facilitate this transaction.
917
10183. [`kiss`](#kiss), the requests `%eyre` will accept.
19+
11204. [`gift`](#gift), the responses it will give to those requests.
1221
13225. [`note`](#note), the set of arvo requests that %eyre makes to the other vanes.
23+
14246. [`whir`](#whir), a `wire` subset, the associated dynamic state
25+
15267. [`sign`](#sign), the responses `%eyre` accepts
27+
16288. [`bolo`](#bolo), the state stored between separate events.
1729
18−# 1. URL structure <a id="perk"/>
19−There exist several URL forms accepted by `%eyre`.
30+;a(id "perk");
31+# 1. URL structure
32+
33+There exist several URL forms accepted by `%eyre`.
2034
2135## 1.1 Functional request
36+
2237The simplest of them is a static `%f` functional publish request:
2338
24− ```hoon
39+```
2540 GET /[ship]/[desk]/[case]/path/to/file.[mark]
26− ```
41+```
2742e.g.
2843
29− ```hoon
44+```
3045 /~pittyp-pittyp/main/5/lib/urb.js
31− ```
46+```
3247A `case` of 0 signifies the most recent version.
3348
3449If no file extension is provided, the default `mark` is `%urb`, which consists of `%html` injected with an auto-refresh script.
3550
3651A shorter form:
3752
38− ```hoon
53+```
3954 /path/to.[mark]
40− ```
55+```
4156is prepended with the [default request path](#prefix). For example, if `%eyre`
4257is configured with a root of `/<our>/main/0/pub`, then `/doc/arvo` is
4358interpreted as a request for `/=main=/pub/doc/arvo.urb`.
@@ -45,60 +60,66 @@ interpreted as a request for `/=main=/pub/doc/arvo.urb`.
4560Auxiliary paths start with `/~/`, and provide other functionality, such as:
4661
4762## 1.2 Auto-reload
63+
4864When a new version of a page becomes available, it is useful to propagate it to the client. The `%f` vane manages the particulars, and provides an update token along with all published pages. The `/~/on` long-polling endpoint makes use of that token, which is a hash of the server-stored dependency set.
4965- `/~/on/[hash].json` retuns `true` when a page may require updating.
5066- `/~/on/[hash].js` is a lightweight script that polls for the above. It is primarily used in error messages.
5167
52−## 1.3 Authentication <a id="auth"/>
68+;a(id "auth");
69+## 1.3 Authentication
70+
5371Authenticated requests are accomplished through sessions, tracked with cookies which are set on the first such request.
54−- `/~/as/[user]/...` is an authenticated request to `...`, where `user` can be a `@p` ship, `'own'`, `'any'`, or `'anon'`.
72+- `/~/as/[user]/...` is an authenticated request to `...`, where `user` can be a `@p` ship, `'own'`, `'any'`, or `'anon'`.
5573 + `'anon'` is a randomly-generated per-session submarine, and requires no further authentication.
5674 + `'own'` represents the serving ship. The short form of `/~/as/own/` is `/~~/`
5775 + `'any'` requires a network ship, chosen with a prompt if unknown. The short form of `/~/as/any/` is `/_/`
5876 + Auth requests are handled in three ways:
59− + I. If the session is associated with the `ship`, serve `...`, storing the ship as the session's default ship.
60− For example,
61− /~/as/sivtyv-barnel/main/pub/test.html
62− is an authenticated request of
63− /main/pub/test.html
64− with the identity of `~sivtyv-barnel`.
77+ + I. If the session is associated with the `ship`, serve `...`, storing the ship as the session's default ship. For example, `/~/as/sivtyv-barnel/main/pub/test.html` is an authenticated request of `/main/pub/test.html` with the identity of `~sivtyv-barnel`.
6578 + II. If the session is not associated with the `ship` in the path, the client is redirected to a login page, where a password can be entered. Successful authentication results in a page refresh to the requested path.
6679 + III. otherwise, [send a message](#foreign) to the claimed ship, and redirect the user to `https://[foreign-host]/~/am/[ses]/...#[current-host]&?code=[code]`
67−
68−
6980- `/~/am/[ses]/...#original-host` similarly serves a login page. Upon success, inform the `ship` of the success and redirect it back to `http://[original-host]/~/as/<this-ship>/...`
7081- `/~/away.html` is a log-out page.
7182- `/~/auth.json` returns `{ship,oryx,user,auth}`: the serving ship, a CSRF token, active user, and all allowed users respectively.
72−- `/~/at/{...}.js` is an alternate form of `/~/auth.json`, which injects a line into the served js file that sets `{ship, oryx, user, auth}` on the `window.urb` object.
83+- `/~/at/{...}.js` is an alternate form of `/~/auth.json`, which injects a line into the served js file that sets `{ship, oryx, user, auth}` on the `window.urb` object.
7384
7485So far, all the paths specified have been GET requests. Authentication, however, requires sending data. This is also done at the `/~/auth.json` endpoint.
7586- `POST {oryx,ship,code} /~/auth.json?PUT` is used by the login script to authorize a user, and returns the same result as `GET`, additionally containing either`{ok:true}` or `{fail:'type',mess:"Error message"}`
7687- `POST {oryx,ship?} /~/auth.json?DELETE` revokes authorization. Response as above.
7788
7889## 1.4 Messaging
90+
7991- `POST {oryx, wire, xyro} /~/to/[app]/[mark].json`, where `xyro` is data that will be converted to the `mark`. In the simplest case, `/~/to/hello/json.json` will pass `xyro` through verbatim, sending `[%json xyro]` to the `++poke` arm of app `%hello`.
8092- `POST {oryx, wire, xyro} /~/to/<ship>/[app]/[mark].json` is a foreign message send, as above.
8193
82−## 1.5 Subscriptions <a id="subs"/>
83−- `/~/of/[ixor]`<a id="of-ixor"/> is an `EventSource`: a conceptually infinite file containing a stream of events. By default, it sends a newline every 30 seconds serving to signal that the connection is alive to both the server and IP middleware.
84− + `/~/of/[ixor]?poll={n}` is a long-polling fallback interface. Produces event number {n}, blocking until it occurs.
94+;a(id "subs");
95+## 1.5 Subscriptions
8596
86−Its contexts can be affected by `POST` requests with a body of `{oryx, wire}`, and a query string of `PUT` or `DELETE`. They return either `{mark}`(which may be `null`), or [`{fail, mess}`](#mean-json)
97+;a(id "of-ixor");
8798
99+- `/~/of/[ixor]` is an `EventSource`: a conceptually infinite file containing a stream of events. By default, it sends a newline every 30 seconds serving to signal that the connection is alive to both the server and IP middleware.
100+ + `/~/of/[ixor]?poll={n}` is a long-polling fallback interface. Produces event number `{n}`, blocking until it occurs. Its contexts can be affected by `POST` requests with a body of `{oryx, wire}`, and a query string of `PUT` or `DELETE`. They return either `{mark}`(which may be `null`), or [`{fail, mess}`](#mean-json)
88101- `/~/in/[hash].json` is a dual to [`/~/on`](#on-change). It binds `mod` events, which echo the requesting token.
89102- `/~/is/[app]/path/to.[mark]` binds `rush` events, formatted with a first line of `[app] /path/to`, and the rest containing subscription data. Additionally, `mean` events formatted similarly may arrive, also converted to the relevant mark.
90103
91−## 1.6 Ablative <a id="temp"/>
104+
105+
106+;a(id "temp");
107+## 1.6 Ablative
108+
92109These interfaces will temporarily exist to aid development, and are to be considered unstable.
93110- `/~/debug/...` access normally inaccessible pages. For example, `/~/debug/as.html` will present the login page, regardless of current session status.
94111
95−# 2. Client state <a id="client"/>
112+
113+# 2. Client state ;a(id "client");
114+
96115Some information is stored on, and provided to, browser clients
97116
98117## 2.1 Cookies
118+
99119Authenticated users receive a cookie on the domain of `*.urbit.org`. The cookie contains a client session token, keyed by the serving ship.
100120
101−## 2.2 Authentication <a id="auth-json"/>
121+## 2.2 Authentication ;a(id "auth-json");
122+
102123It is common(e.g. by the `%urb` mark) to set window.urb to the contents of `/~/auth.json`:
103124- `ship` is the serving ship
104125- `oryx` is a unique CSRF token that identifies this view, bound to the session cookie
@@ -107,26 +128,30 @@ It is common(e.g. by the `%urb` mark) to set window.urb to the contents of `/~/a
107128- `auth` is a list of identities usable by this session
108129
109130## 2.3 Client library
131+
110132To this object, `/main/lib/urb.js` adds helpers:
111−- `app` is an optional app name to send messages to by default
133+- `app` is an optional app name to send messages to by default
112134- `send({data,mark?='json',app?=urb.app,ship?}, cb?)` delivers messages
113135- `bind({path,app?=urb.app}, cb)` subscribes by path
114136- `drop({path,app?=urb.app}, cb?)` pulls the subscription
115137- `util` is an object containing methods for converting between JavaScript types and Hoon atom odors.
116138
117−# 3. Requests <a id="kiss"/>
139+# 3. Requests ;a(id "kiss");
118140
119141## `[%born port=@ud]`, unix init
142+
120143When the `vere` process is re/started, a TCP port is bound, HTTP requests on which are the scope of this document. The `%born` gift informs eyre of this occurrence, which in turn updates [its state.](#bolo)
121144
122−**Gifts given in response:** none.
145+*Gifts given in response:* none.
123146
124147## `[%hiss p=mark q=cage]`, outbound http
148+
125149Userspace http request, converted by `%ford` into an actual `hiss`.
126150
127−**Gifts given in response:** a [`%sigh`]()
151+*Gifts given in response:* a [`%sigh`]()
128152
129153## 3.1 `[%this httq]`, inbound http
154+
130155The primary `%eyre` request type comes from the host system, and constitutes an inbound http request. It consists of five parts:
131156
132157I. `p=[? @if]`: a loobean determining whether the request is being made over https, and the client source, an IPv6 address possibly encoding an IPv4 one as `.0.0.0.0.0.ffff.wwxx.yyzz`
@@ -151,226 +176,269 @@ After `r` is parsed to a `purl`, the `pork`(relative path) determines the resour
151176- `/~/of` fails if the `ixor` is unknown, and otherwise is stored in the `ixor`, receiving a partial response and all events after its [last-seen header](#). If it has a `poll` parameter, the response is full, and only occurs if the body is non-empty. Otherwise the oryx is saved as a [live](#live) request in case of cancellation.
152177- `/~/to` transforms into a [`%g` message](#mess).
153178
154−**Gifts given in response:** a [`%thou`](), or a [`%that`](#that) followed by multiple [`%thar`]()s.
179+*Gifts given in response:* a [`%thou`](), or a [`%that`](#that) followed by multiple [`%thar`]()s.
155180
156181## 3.2 `[%thud ~]`, inbound close
182+
157183Sent when an unresponded-to request is cancelled. The [live](#live) effect of the request is looked up, and
158184- `%exec` ford boil requests are cancelled with `[%exec ~]`
159185- `%wasp` ford deps requests are cancelled with `[%wasp |]`
160186- `%poll` session polls `%rest` the session heartbeat timeout
161187
162188## 3.3 `[%thin p=@ud]`, delivery failure
189+
163190Sent when a partial [response](#that) or [body](#thar) fails to arrive. Its `duct` is the same as that of the original request. This is handled by [waiting](#wait) for the client to reconnect, and if this not occur, unwinding all subscription state.
164191
165−**Gifts given in response:** None.
192+
193+*Gifts given in response:* None.
166194
167195## 3.4 ``[%wart sock [path *]]``, inbound message
196+
168197Sometimes, messages are received from other ships. They are expected to take the from of a [`gram`]().
169198
170−**Gifts given in response:** [`%nice` or `%mean`](#ack).
199+*Gifts given in response:* [`%nice` or `%mean`](#ack).
171200
172201### 3.4.1 `gram` <a id="gram"/>
173202
174203There are three messages of note, all concerning authentication <a id="foreign"/>
175204- `[/lon ses]` <a id="lon"/> is a login request, which contains the session wishing to authenticate.
176−- if the session is already authorized, a reply of `[/aut ses]` from (%eyre on) a foreign ship prescribes that the session is henceforth allowed to act on its behalf.
177−All waiting `/~/as` are resolved as succesful.
178−- otherwise, `[/hat ses hart]` contains the ship's preferred hostname. This can then be used to redirect the client.
179−All waiting `/~/as` are given `307 Redirect`s to `/~/am` on the provided host.
205+- if the session is already authorized, a reply of `[/aut ses]` from (%eyre on) a foreign ship prescribes that the session is henceforth allowed to act on its behalf. All waiting `/~/as` are resolved as successful.
206+- otherwise, `[/hat ses hart]` contains the ship's preferred hostname. This can then be used to redirect the client. All waiting `/~/as` are given `307 Redirect`s to `/~/am` on the provided host.
207+
208+*Gifts given in response:* nice?
209+
210+# 4. Responses ;a(id "gift");
180211
181−**Gifts given in response:** nice?
212+## 4.1 `[%nice ~]`, `[%mean ares]`, network acknowledgement ;a(id "ack");
182213
183−# 4. Responses <a id="gift"/>
184−## 4.1 `[%nice ~]`, `[%mean ares]`, network acknowledgement <a id="ack"/>
185−A `%nice` is given upon receiving an [ames message](#gram), indicating succesful receipt. `%mean` is currently unused directly, but reserved for error conditions.
214+A `%nice` is given upon receiving an [ames message](#gram), indicating succesful receipt. `%mean` is currently unused directly, but reserved for error conditions.
186215
187216## `[%sigh p=cage]`, inbound http response
217+
188218An HTTP response gets converted to the requested mark, or `%tang` in case of error.
189219
190220## 4.2 `[%thou httr]`, full HTTP response
221+
191222Most requests are served with one coherent response, consisting of
192223- `p=@ud`, an HTTP status code
193224- `q=mess`, response headers
194225- `r=(unit octs)`, an optional body
195226
196−## 4.3 `[%that httr]`, partial HTTP response <a id="that"/>
227+## 4.3 `[%that httr]`, partial HTTP response ;a(id "that");
228+
197229[EventStream responses](#of-ixor) consist of multiple sequential chunks. Treated as `%thou`, except the request is kept open.
198230
199−## 4.4 `[%thar (unit octs)]`, partial HTTP body <a id="thar"/>
231+## 4.4 `[%thar (unit octs)]`, partial HTTP body ;a(id "thar");
232+
200233Complementing `%that`, `%thar` is a body chunk, containing an event. An empty `%thar` signals for the connection to be closed.
201234
202235Body chunks, besides `[1 '\0a']`(a heartbeat newline), are encoded from `even` events. The stem becomes the [`event` field](#eventsource), and the content, `data` lines.
203236
204−### 4.4.1 `even`, event types <a id="even"/>
237+### 4.4.1 `even`, event types ;a(id "even");
238+
205239There are three events that a [client subscription](#subs) will be given.
206240
207−- `[%news hash]`<a id="even-news"/> is a `%f` update, and contains the relevant dependency token.
208−- `[%rush [term path] wain]`<a id="even-rush"/> is sourced subscription data.
241+- `[%news hash]`;a(id "even-news"); is a `%f` update, and contains the relevant dependency token.
242+- `[%rush [term path] wain]` ;a(id "even-rush"); is sourced subscription data.
209243- `[%mean [term path] ares]` is a sourced subscription error.
210244
211−# 5. Vane requests <a id="note"/>
245+# 5. Vane requests ;a(id "note");
246+
212247## 5.1 ``[%a %wont sock `[path *]`gram]``, outbound message
248+
213249The `%a` interface provides conveyance of [messages](#gram) over UDP.
214250
215251Signs a `%woot` upon message arrival.
216252
217−## 5.2 `[%b ?(%wait %rest) time]`, timeout set/unset <a id="wait"/>
218−All open [subscriptions](#of-ixor) require a "heartbeat" newline every `~s30`. When this fails to arrive, a complementary timer is set for `~m1`, after which the client is considered to have departed.
219−The `%b` timer interface is used to schedule the next such event, or cancel past scheduled ones when a connection closes.
253+## 5.2 `[%b ?(%wait %rest) time]`, timeout set/unset ;a(id "wait");
254+
255+All open [subscriptions](#of-ixor) require a "heartbeat" newline every `~s30`. When this fails to arrive, a complementary timer is set for `~m1`, after which the client is considered to have departed.
256+The `%b` timer interface is used to schedule the next such event, or cancel past scheduled ones when a connection closes.
220257
221258Signs a `%wake` upon timer activation.
222259
223−## 5.3 `[%f %wasp @uvI]`, dependency listen <a id="wasp"/>
224−Knowledge of filesystem changes, requested by `/~/on` and `/~/in`, is requested the `%wasp` note. It contains the hash token which idenitifes a set of dependencies to query. Saved as a (live[live](#live)#live] request in case of cancellation when caused by `/~/on`.
260+## 5.3 `[%f %wasp @uvI]`, dependency listen ;a(id "wasp");
261+
262+Knowledge of filesystem changes, requested by `/~/on` and `/~/in`, is requested the `%wasp` note. It contains the hash token which identifies a set of dependencies to query. Saved as a (live[live](#live)#live] request in case of cancellation when caused by `/~/on`.
225263
226−Signs a `%writ` upon change.
264+Signs a `%writ` upon change.
227265
228266## 5.4 `[%f %exec (unit silk)]`, functional transformations
267+
229268The `%f` interface converts nouns from one form to another. An empty unit represents cancellation.
230269
231270Signs a `%made` containing the computation result.
232271
233−The `silk`s used are as follows:
272+The `silk`s used are as follows:
234273
235274### `[%cast %mime %boil mark beam [%web span ~]]`, file load
275+
236276The simplest functional request is the construction of a page. Saved as a [live](#live) request in case of cancellation.
237277- The `mark` is the request extension, defaulting to `%html`.
238278- A `beam`(path in `%clay`) is decoded from the request path.
239279- A `/web/<nyp ced quy>` virtual path is appended, span-encoding method, auth, and query string.
240280
241−### `[%cast mark %done ~ cage]`, convert <a id="done"/>
281+### `[%cast mark %done ~ cage]`, convert ;a(id "done");
282+
242283This is used when communicating with apps, in both directions.
243284- Client messages are encoded as JSON objects, but can contain many different marks. Ones sent to non-`json.json` endpoints are `%cast` to he relevant mark, with a `cage` of `[%json p:!>(*json) jon]`, prior to being sent onwards to applications with `[%g %mess]`.
244285- Subscription responses also come in arbitrary marks, but are required to be sent as whichever mark an endpoint is subscribed to. They get `%cast` prior to being sent back as a `%that` EventSource segment.
245286
246287## 5.5 `%g`, app actions
288+
247289The end goal of many a userspace `hymn.hook` is to provide UI for a `%gall` app. To accommodate this, various functionality needs to be interfaced with.
248290
249−### `[%mess hapt ship cage]`, app message <a id="mess"/>
291+### `[%mess hapt ship cage]`, app message ;a(id "mess");
292+
250293After a `/~/to` POST has been received, and possibly converted to the correct mark, it is sent to `%g` for processing. The `hapt` is the destination, the `ship` is the source, the `cage` is the marked message data.
251294
252295Signs a `%nice` or `%mean`, in userspace or upon crashing.
253296
254−### `[%show hapt ship path]`, app subscription<a id="show"/>
297+### `[%show hapt ship path]`, app subscription ;a(id "show");
298+
255299An `/~/is` PUT, if not already registered, results in a new subscription. A request for such contains the destination `hapt`, requesting `ship`, and app-internal `path`.
256300
257301Signs a `%nice` on init, `%rush` on data, and a `%mean` in subscription termination.
258302
259303### `[%took hapt ship]`, %rush confirmation
304+
260305A `%took` must be sent to acknowledge the receipt of subscription data, which in this case occurs automatically.
261306
262307Causes no signs.
263308
264309### `[%nuke hapt $|(ship [ship path])]`, subscription cancel
265−An `/~/is` DELETE is used to remove a subscription, and is converted straightforwardly to a `%nuke`. Additionally, when a client disconnects, all of its subscriptions are `%nuke`d to reflect their experiation.
310+
311+An `/~/is` DELETE is used to remove a subscription, and is converted straightforwardly to a `%nuke`. Additionally, when a client disconnects, all of its subscriptions are `%nuke`d to reflect their expiration.
266312
267313Signs an empty `%mean` for each open subscription that is closed.
268314
269−# 6. In-flight metadata <a id="whir"/>
315+# 6. In-flight metadata ;a(id "whir");
316+
270317Various state can be associated with requests, but not necessarily be returned in responses to them.
271318
272−## 6.1 `~`, dropthrough <a id="wire-drop"/>
319+## 6.1 `~`, dropthrough ;a(id "wire-drop");
320+
273321If the response should be sent statelessly further up the duct, the `wire` is empty. This is used in `%f` pure functional page generation.
274322
275−## 6.2 `[?(%y %n) ...]`, stability <a id="wire-live"/>
323+## 6.2 `[?(%y %n) ...]`, stability ;a(id "wire-live");
324+
276325The first element of a [`%b` timer](#wait) path distinguishes between live(%y) and dying(%n) channels.
277326
278327## 6.3 `/of/[ixor]`, view
328+
279329Designates which stream to act upon. Present on `%b` timer cards.
280330
281331## 6.4 `/on/<deps>`
332+
282333Present on `%f` dependency news. Looked up in [the state](#bolo) to see if any response is necessary.
283334
284−## 6.5 `/to/<hasp>/<ship>`, app <a id="wire-to"/>
335+## 6.5 `/to/<hasp>/<ship>`, app ;a(id "wire-to");
336+
285337Present on `%f` translations of message marks
286338
287−## 6.6 `/is/[ixor]/{hasp path}`, subscription <a id="wire-is"/>
339+## 6.6 `/is/[ixor]/{hasp path}`, subscription ;a(id "wire-is");
340+
288341Subscription requests. Present on `%g` subscription requests, and `%f` translations of [`%rush` subscription data](#show).
289342
290−# 7. Vane responses <a id="sign"/>
291−The goal of requests is to cause some manner of result. Specifically,
343+# 7. Vane responses ;a(id "sign");
344+
345+The goal of requests is to cause some manner of result. Specifically,
292346
293347## 7.1 `[%a %woot ship coop]`, acknowledgement
348+
294349A [message](#mess) which has been acknowledged remotely.
295350
296351## 7.2 `[%b %wake ~]`, timer
352+
297353Timer activate. If this is a `%y` [timer](#wire-live), send a newline to each `/~/of/[oryx]`; if `%n` and the `oryx` still has no listeners, wipe its state/subscriptions.
298354
299355## 7.3 `[%f %news ~]`, dependency update
356+
300357This message signifies a `hash` has changed, and listeners to it should be updated. Results in [`%news` events](#even-news) to concerned streams, and [full responses](#thou) to relevant long-polls.
301358
302359## 7.4 `[%f %made (each bead (list tank))]`, compute result
360+
303361Further action depends on the [`wire`](#whir). It can:
304362- Be empty, designating direct request data, which is [served](#mime) back up the `duct`.
305−- Contain [app and requester identities](#wire-to), which designates an app message has been converted to the correct `mark`, and can now be [sent to the app](#mess) with an empty `wire`.
363+- Contain [app and requester identities](#wire-to), which designates an app message has been converted to the correct `mark`, and can now be [sent to the app](#mess) with an empty `wire`.
306364- Contain an `oryx`, app, and `path`, designating subscription data. If the subscription is active in the relevant `stem`, it is acknowledged with a `%took` and given as a [`%rush` event](#even-rush) to all listeners. Otherwise, the subscription is `%nuke`d.
307365
308366## 7.5 `%g`, applications
367+
309368The `%g` interface sends several responses.
310369
311370### `[%nice ~]` and `[%mean ares]`, acknowledgment
371+
312372These are given as a response to `%mess`, with an empty wire, and `%show`s, with a [subscription wire](#wire-is).
313373The former is [served](#mime) back to the requester(i.e. the remaining duct), and the latter returned to the client.
314374
315375### 7.5 `[%rush cage]`, subscription data
376+
316377A `%rush` arrives on a [subscription wire](#wire-is), and is then sent [for conversion](#done) to the correct mark. An unexpected `%rush` is `%nuke`d.
317378
318−# 8. Server state <a id="bolo"/>
379+# 8. Server state ;a(id "bolo");
380+
319381There is a quantity of data that persists between events.
320382
321383## 8.1 Global
322−- `path` <a id="prefix"/> the default path which is prepended to relative plain requests. Initialized to `/<our>`, the serving ship; this interprets the first element of requests as a desk, and injects a `case` of `0`.
384+
385+- `path` ;a(id "prefix"); the default path which is prepended to relative plain requests. Initialized to `/<our>`, the serving ship; this interprets the first element of requests as a desk, and injects a `case` of `0`.
323386- `(jar ship hart)` remembered hostnames in order of preference, made accessible through `.^`
324387 + The default values(for self) are `http://<ship>.urbit.org:80` if not on a fake network, followed by `https://0.0.0.0:[port]`.
325388- `(jug deps (each duct oryx))`, `/~/on` and `/~/in` endpoints listening to `%c` updates.
326389- `(map duct live)`, inbound request state
327−- `(map ixor oryx)`, open `/~/of` streams.
390+- `(map ixor oryx)`, open `/~/of` streams.
328391- `(map oryx stem)`, open view state.
329392- `(map hole sink)`, session state.
330393- `(map hole ,[ship ?])`, foreign session names, along with their origin ships and whether they are authorized to act on our behalf.
331394
332−## 8.2 `live`, per-request state <a id="live"/>
395+## 8.2 `live`, per-request state ;a(id "live");
396+
333397To honor request cancellations, each unserved request must track which effect it is causing.
334−+ `[%exec whir]` if it is a ford data request
398++ `[%exec whir]` if it is a ford data request
335399+ `[%wasp (list @uvH)]` if it is a ford dependency poll
336400+ `[%xeno ship]` if this is a proxied request
337401+ `[%poll ixor]` if this is a session long-poll
338402
339−## 8.3 `sink`, per-session state <a id="sink"/>
403+## 8.3 `sink`, per-session state ;a(id "sink");
404+
340405Each `hole` has associated authentication state.
341406- `priv`, a random secret that verifies the session, stored in cookie.
342407- `[ship (set ship)]`, the `ship` a session is acting as and any others it has been authorized with.
343408- `(jug ship ,[path duct])`, authentication `/~/as` requests waiting on foreign ships.
344409- `(set oryx)`, views associated with this session. Dual of `hole` in `stem`.
345410
346−## 8.4 `stem`, per-view state <a id="stem"/>
411+## 8.4 `stem`, per-view state ;a(id "stem");
412+
347413Each `oryx` has active subscription state.
348414- `hole`, session in which this view resides. Dual of `(set oryx)` in `sink`.
349−- `ixor`<a id="ixor"/>, a cached hash of the `oryx` that is used as a subscription id, by the `/~/of` EventStream.
415+- `ixor` ;a(id "ixor"); , a cached hash of the `oryx` that is used as a subscription id, by the `/~/of` EventStream.
350416- `[,@u (map ,@u even)]`, queued [events](#even). Has a maximum size.
351417- `(unit ,[duct @u ?])`, http connection, its last received event, and whether it is a long-poll request.
352418- `(set deps)`, subscribed `/~/in` points. Mirrored in `bolo`.
353419- `(map ,[hasp path] mark)`, subscribed `/~/is` points
354−- `(que duct)`, where any `%nice`/`%mean
420+- `(que duct)`, where any `%nice`/`%mean
355421
356422# Appendix A: Glossary
423+
357424- An `oryx` is a CSRF token used for [authenticated requests](#auth)
358−- `mean.json`<a id="mean-json"/> is a rendering of hoon `ares`: an error message formatted as `{fail:'type',mess:"Error message"}`
359−- `urb.js`<a id="urb-js"/> is the standard client-side implementation of the `%eyre` protocols, normally found in `/=main=/lib`
360−- The act of "serving"<a id="mime"/>, refers to the wrapping of a `%mime` cage in an HTTP `200 Success` response, and errors or other marks being [sent to ford](#done) for conversion. Inside a `sign`, this conversion occurs along the same [`wire`](#wire); otherwise, the `wire` is [empty](#wire-drop).
425+- `mean.json` ;a(id "mean-json"); is a rendering of hoon `ares`: an error message formatted as `{fail:'type',mess:"Error message"}`
426+- `urb.js` ;a(id "urb-js"); is the standard client-side implementation of the `%eyre` protocols, normally found in `/=main=/lib`
427+- The act of "serving" ;a(id "mime"); , refers to the wrapping of a `%mime` cage in an HTTP `200 Success` response, and errors or other marks being [sent to ford](#done) for conversion. Inside a `sign`, this conversion occurs along the same [`wire`](#wire); otherwise, the `wire` is [empty](#wire-drop).
361428
362−# Appendix B: EventSource <a id="eventsource"/>
429+# Appendix B: EventSource ;a(id "eventsource");
363430
364431UNIMPLEMENTED
365432
366433For more information, see <http://dev.w3.org/html5/eventsource/>
367434
368435An EventSource is a stream of events, encoded in a conceptually infinite `GET` request. Each event is formatted as
369− ```http
436+```
437+ http
370438 id: {number}
371439 event: {type}
372440 data: {contents}
373441 data: {more-contents}
374− ```
442+```
375443
376444Data lines are joined by ASCII `10` newline characters; multiple newlines signify separate events. The `id` is used in a `Last-Event-ID` HTTP request header upon reconnection.
learn/arvo/filesystem.udonnew file+461
@@ -0,0 +1,461 @@
1+:- :~ navhome/'/docs/'
2+ navuptwo/'true'
3+ next/'true'
4+ sort/'7'
5+ title/'Filesystem (Clay)'
6+ ==
7+;>
8+
9+# Filesystem (Clay)
10+
11+
12+Urbit has its own revision-controlled filesystem, Clay. Clay is a typed, global,
13+referentially transparent namespace. An easy way to think about it is like typed
14+`git` with continuous sync.
15+
16+The most common way to use Clay is to mount a Clay node in a Unix directory. The
17+Urbit process will watch this directory and automatically record edits as
18+changes, Dropbox style. The mounted directory is always at the root of your
19+pier directory.
20+
21+
22+## Quickstart
23+
24+This quick-start guide will walk you through some common commands. Follow along
25+using your Dojo. When you get a `>=` message after entering a command, the means
26+that the command was successful.
27+
28+When developing it's a good idea to use a separate desk. Create a `%sandbox`
29+desk based on the `%home` desk:
30+
31+```
32+|merge %sandbox ~your-urbit %home
33+```
34+
35+Running `our` produces your ship-name, meaning that you can run the following
36+command instead of typing out the entire thing. Useful for comets, due to their
37+very long names.
38+
39+```
40+|merge %sandbox our %home
41+```
42+
43+Most of the time we want to use Clay from Unix. Mount the entire contents of
44+your `sandbox` desk to Unix:
45+
46+```
47+~your-urbit:dojo> |mount /=sandbox=
48+```
49+
50+To explore the filesystem from inside Urbit `+ls` and `+cat` are useful. `+ls`
51+displays files in the current directory, and `+cat` displays the contents of
52+a file.
53+
54+We can use `%` to mean "current directory." The result of the command below
55+is just like using `ls` in a Unix terminal.
56+
57+```
58+~your-urbit:dojo> +ls %
59+```
60+
61+Notice how `+cat %` does the same thing. That's because everything in Clay,
62+including directories, is a file.
63+
64+Let's explore the `/web` directory of the `%sandbox` desk.
65+
66+```
67+~your-urbit:dojo> +ls /=sandbox=/web
68+```
69+
70+Let's see the contents of `/=sandbox=/web/md`:
71+
72+```
73+~your-urbit:dojo> +cat /=sandbox=/web/md
74+```
75+
76+Now let's navigate to that folder using `=dir`, which is a like `cd` in Unix.
77+
78+```
79+~your-urbit:dojo> =dir /=sandbox=/web/md
80+```
81+
82+Youl'll notice that your prompt is now `~your-urbit:dojo/sandbox/web/md>`. To
83+change back to our home directory, we use `=dir` without any path.
84+
85+```
86+~your-urbit:dojo/sandbox/web/md> =dir
87+```
88+
89+Sync from your friend `~some-ship`'s `%experiment` desk to your
90+`%sandbox` desk:
91+
92+```
93+|sync %sandbox ~some-ship %experiment
94+```
95+
96+If and when your sync is successful, you will receive a message:
97+
98+```
99+activated sync from %experiment on ~some-ship to %sandbox
100+```
101+
102+The ship that you sync from will get their own message indicating that you're
103+both connected as peers:
104+
105+```
106+; ~your-urbit is your neighbor.
107+```
108+
109+---
110+
111+## Manual
112+
113+### Paths
114+
115+A path in Clay is a list of URL-safe text, restricted to the characters
116+`[a z]`,`[0 9]`, `.`, `-`, `_`, and `~`. Formally this is a `(list knot)`,
117+meaning that each segment, delineated by `/`, is of the `knot` ASCII-text type.
118+In other words, paths are expressed as `/foo/bar/baz`. File extensions are
119+separated from file names with `/`, not `.`. Extensions are syntactically
120+identical to subdirectories, except that they must terminate the path.
121+
122+Paths begin with a piece of data called a `beak`. A beak is formally a
123+`(p=ship q=desk r=case)`; it has three components, and might look like
124+`/~dozbud-namsep/home/11`.
125+
126+The first `beak` component is `ship`, which is, as you might guess, the name of
127+an Urbit ship. The second component is `desk`, which is a workspace meant to
128+contain other directories; the default desk is `%home`. The third component is
129+`case`, which represents version information in various ways: date and time;
130+a version sequence, which is a value incremented by one whenever a file on the
131+given `desk` is modified; or an arbitrary plaintext label.
132+
133+You can find what your `beak` is at any given moment by
134+typing `%` in the Dojo and looking at the first three results.
135+
136+We use `beak`s because, unlike the current internet, the Urbit network uses a
137+global namespace. That means that a file named `example.hoon` in the `/gen`
138+directory on the `%home` desk of your ship `~lodleb-ritrul` would have a
139+universal address to anyone else on the network:
140+`~lodleb-ritrul/home/186/gen/example.hoon`. That, of
141+course, doesn't mean that everyone on the network has privileges to access that
142+path.
143+
144+The structure that combines a `beak` with further path information is called a
145+`beam`.
146+
147+##### Relative paths
148+
149+The `%` command, which we gestured at in the above section, represents the
150+*relative path*, which is the path where you are currently working. If your
151+working directory is just your home desk, indicated by the
152+prompt `~your-planet:dojo>`, then running the command below will print your
153+working directory's `beam` information: your `beak`, and a `~` that represents
154+the empty list since no path is present.
155+
156+```
157+~your-urbit:dojo> %
158+```
159+
160+`%`s can be stacked to indicate one level further up in the hierarchy for each
161+additional `%`. Try the following command:
162+
163+```
164+~your-planet:dojo> %%%
165+```
166+
167+You'll probably notice that it only has your ship name and the empty list. The
168+two additional `%`s abandoned the `case` and the `desk` information by moving
169+up twice the hierarchy.
170+
171+There are no local relative paths. `/foo/bar` must be written as
172+`%/foo/bar`.
173+
174+##### Substitution
175+
176+You don't need to write out the explicit path every time you want to reference
177+somewhere outside of your working directory. You can substitute `=` for the
178+segments of a path.
179+
180+Recall that a full address in the the Urbit namespace is a `beam`: the
181+`/ship/desk/case/path`. If you've switched to another desk before, you're
182+already familiar with substitution syntax:
183+
184+```
185+~your-urbit:dojo> =dir /=sandbox=
186+```
187+
188+The above command substitutes uses substitution to use your current `ship` and
189+`case`; only the `desk` argument, which is located between the other two, is
190+given something new. Without substitution, you would need to write:
191+
192+```
193+~your-urbit:dojo> =dir /~your-urbit/home/85
194+```
195+
196+Substitutions work the same way in `beak`s (the `ship/desk/case` part) and
197+paths. For example, if you are in the `/gen` directory, you can reference a file
198+in the `/app` directory like below. (`+cat` displays the contents of a file).
199+
200+```
201+~your-urbit:dojo/home/gen> +cat /===/app/curl/hoon
202+```
203+
204+Note what was substituted out, and note that we don't need to separate `=` with
205+`/`.
206+
207+If we changed our working directory to something called `/gen/gmail`, we could
208+access a file called
209+
210+```
211+~fasdul-balsev-lodleb-ritrul:dojo/home/gen/gmail> +cat /===/app/=/split/hoon
212+```
213+
214+Because both paths share a directory named `/gmail` at the same position in the
215+address hierarchy -- which, if you recall, is just a `list` -- the above command
216+works!
217+
218+We can do the same thing between desks. If `%sandbox` has been merged with
219+`%home`, the following command will produce the same results as the above
220+command.
221+
222+```
223+~your-urbit:dojo/home/gen/gmail> +cat /=sandbox=/app/=/split/hoon
224+```
225+
226+Most commonly this is used to avoid having to know the current revision
227+number in the `dojo`: `~lodleb-ritrul/home/~2018.10.2..00.35.44..d7e8/gen/example.hoon`
228+
229+##### Changing directories
230+
231+Change the working directory with `=dir`. It's our equivalent of the Unix `cd`.
232+
233+For example, the syntax to navigate to `/home/gen/ask` is:
234+
235+```
236+~your-urbit:dojo> =dir /=gen=/ask
237+```
238+
239+This command will turn your prompt into something like this:
240+
241+```
242+~your-urbit:dojo/gen/ask>
243+```
244+
245+Using `=dir` without anything else uses the null path, which returns you to
246+your home desk.
247+
248+```
249+~your-urbit:dojo> =dir
250+```
251+
252+To go up levels in the path hierarchy, recall the relative path expression
253+`%`. Stacking them represents another level higher in the hierarchy than
254+the current working directory for each `%` beyond the initial. The command below
255+brings you one level up:
256+
257+```
258+~your-urbit:dojo/gen> =dir %%
259+```
260+
261+### Revision-control
262+
263+##### Mount
264+
265+Syntax: `|mount /clay/path [Unix-name]`
266+
267+Mount the `clay-path` at the Unix mount point `Unix-name`.
268+
269+*Examples:*
270+
271+```
272+|mount %/web
273+```
274+
275+Mounts `%/web` to `/web` inside your pier directory.
276+
277+```
278+|mount %/gen generators
279+```
280+
281+Mounts `%/gen` to `/generators` inside your pier directory.
282+
283+##### Unmount
284+
285+```
286+|unmount [clay-path || Unix-name]
287+```
288+
289+Unmount the path or name from Unix.
290+
291+*Examples:*
292+
293+```
294+|unmount %/web
295+```
296+
297+Unmounts the path `%/web` from whatever name it was mounted as.
298+
299+```
300+|unmount %generators
301+```
302+
303+Unmounts the Unix path `/generators`.
304+
305+```
306+|merge desk beak[, =gem strategy]
307+```
308+
309+Merges a `beak` into a `desk` using an optional merge `strategy`.
310+
311+A `beak` is a ship-desk-case triple, encoded as a
312+path(`/~dozbud/home/2`)
313+
314+*Examples:*
315+
316+```
317+|merge %home-work /=home=, =gem %fine
318+```
319+
320+Merge `/=home=` into `%home-work` using merge strategy `%fine`.
321+
322+```
323+|merge %examples ~wacbex-ribmex %examples
324+```
325+
326+Merge the `%examples` desk from `~waxbex-ribmex`
327+
328+```
329+|sync desk plot [plot-desk]
330+```
331+
332+Subscribe to continuous updates from remote `plot` on local `desk`.
333+`plot-desk` can specify the remote `desk` name. When omitted it is
334+defaulted to being the same as `desk`. Non-comet urbits have
335+`|sync %home ~parent %kids` automatically set up (where `~parent` is the
336+planet that issued a moon, the star that issued a planet, or the galaxy
337+that issued a star).
338+
339+*Examples:*
340+
341+```
342+|sync %home-local ~dozbud %home
343+
344+|sync %home ~doznec
345+```
346+
347+```
348+|unsync desk plot [plot-desk]
349+```
350+
351+Unsubscribe from updates from remote `plot` on local `desk` with
352+optional `plot-desk`. Arguments must match original `|sync` command.
353+
354+Example:
355+
356+```
357+|unsync %home-local ~dozbud %home
358+```
359+
360+```
361+|label desk name`
362+```
363+
364+Label the current version of `desk` `name`.
365+
366+Example:
367+
368+```
369+|label %home release
370+```
371+
372+### Merge strategies
373+
374+`%init` - Used if it's the first commit to a desk. Also can be used to
375+"reinitialize" a desk -- revision numbers keep going up, but the new
376+revision isn't necessarily a descendent of the previously numbered
377+version, allowing merges to be rerun.
378+
379+`%this` - Keep what's in Bob's desk, but join the ancestry.
380+
381+`%that` - take what's in Alice's desk, but join the ancestry. This is
382+the reverse of `%this`. This is different from `%init` because the new
383+commit has both sides in its ancestry.
384+
385+`%fine` - "fast-forward" merge. This succeeds if and only if one head is in the
386+ancestry of the other.
387+
388+`%meet`, `%mate`, and `%meld` - find the most recent common ancestor to
389+use as our merge base.
390+
391+A `%meet` merge only succeeds if the changes from the merge base to
392+Alice's head (hereafter, "Alice's changes") are in different files than
393+Bob's changes. In this case, the parents are both Alice's and Bob's
394+heads, and the data is the merge base plus Alice's changed files plus
395+Bob's changed files.
396+
397+A `%mate` merge attempts to merge changes to the same file when both
398+Alice and Bob change it. If the merge is clean, we use it; otherwise, we
399+fail. A merge between different types of changes -- for example,
400+deleting a file vs changing it -- is always a conflict. If we succeed,
401+the parents are both Alice's and Bob's heads, and the data is the merge
402+base plus Alice's changed files plus Bob's changed files plus the merged
403+files.
404+
405+A `%meld` merge will succeed even if there are conflicts. If there are
406+conflicts in a file, then we use the merge base's version of that file,
407+and we produce a set of files with conflicts. The parents are both
408+Alice's and Bob's heads, and the data is the merge base plus Alice's
409+changed files plus Bob's changed files plus the successfully merged
410+files plus the merge base's version of the conflicting files.
411+
412+`%auto` - meta-strategy. Check to see if Bob's desk exists, and if it
413+doesn't we use an `%init` merge. Otherwise, we progressively try
414+`%fine`, `%meet`, and `%mate` until one succeeds. If none succeed, we
415+merge Bob's desk into a scratch desk. Then, we merge Alice's desk into
416+the scratch desk with the `%meld` option to force the merge. Finally, we
417+annotate any conflicts, if we know how.
418+
419+### Manipulation
420+
421+##### +cat
422+
423+Syntax: `+cat path [path ...]`
424+
425+Similar to Unix `cat`. `+cat` takes one or more `path`s, and prints their
426+contents. If that `path` is a file, the contents of the file is printed. If the
427+`path` terminates in a directory, the list of names at that path is produced.
428+
429+##### +ls
430+
431+Syntax: `+ls path`
432+
433+Similar to Unix `ls`. `+ls` takes a single `path`.
434+
435+Produces a list of names at the `path`.
436+
437+```
438+~your-urbit:dojo> +cat %/our/home/gen/curl/hoon
439+```
440+
441+##### |rm
442+
443+Syntax: `|rm path`
444+
445+Remove the data at `path`. `path` must be a path to actual node, not a
446+'directory'
447+
448+##### |cp
449+
450+Syntax: `|cp to from`
451+
452+Copy the file at `from` into the path `to`.
453+
454+##### |mv
455+
456+Syntax: `|mv to from`
457+
458+Move the file at `from` into the path `to`.
459+
460+In Clay, `|mv` is just a shorthand for `|cp` then `|rm`. The `|rm`
461+doesn't happen unless the `|cp` succeeds.
docs/arvo/internals/ford.md → learn/arvo/ford.udonrenamed+10−10
@@ -1,11 +1,12 @@
1−---
2−navhome: /docs/
3−sort: 6
4−---
1+:- :~ navhome/'/docs/'
2+ navuptwo/'true'
3+ next/'true'
4+ sort/'6'
5+ title/'Ford'
6+ ==
7+;>
58
6−
7−`%ford`
8−=======
9+# Ford
910
1011Our typed and marked computation engine.
1112
@@ -23,10 +24,9 @@ while `%gall` uses `%ford` to control the execution of applications.
2324`%clay` is intended to use `%ford` to managed marked data, but this is
2425not yet reality.
2526
26−<list></list>
27+;list;
2728
28−Cards
29−-----
29+# Cards
3030
3131`%ford` accepts just one card, `%exec`. This is misleading, however,
3232since there are fourteen different `silk`s that may be used with it. In
docs/arvo/internals/ford/runes.md → learn/arvo/ford/runes.udonrenamed+15−5
@@ -1,8 +1,15 @@
1−# `%ford` user manual
1+:- :~ navhome/'/docs/'
2+ navuptwo/'true'
3+ sort/'2'
4+ title/'Ford User Manual'
5+ ==
6+;>
7+
8+# Ford User Manual
29
310## ford runes
411
5−One of the most common ways to use ford is through ford's runes, all of which begin with `/` ("fas"). A ford rune runs a step of a ford build and places the result in the subject. There are various kinds of build steps, some of which take other build steps as parameters. The most common pattern is to have a sequence of ford runes at the top of a hoon source file that import the results of evaluating other hoon files. This is how we "import a library" in urbit: we add the result of compiling another hoon file into the current subject, possibly renaming it by wrapping a face around it.
12+One of the most common ways to use ford is through ford's runes, all of which begin with `/` ("net"). A ford rune runs a step of a ford build and places the result in the subject. There are various kinds of build steps, some of which take other build steps as parameters. The most common pattern is to have a sequence of ford runes at the top of a hoon source file that import the results of evaluating other hoon files. This is how we "import a library" in urbit: we add the result of compiling another hoon file into the current subject, possibly renaming it by wrapping a face around it.
613
714Another common use case is assembling and rendering markdown templates into a single HTML file, to be sent as an HTTP response in urbit's web server `%eyre`. It's important to keep in mind that %ford is quite flexible and generic, and is used in other parts of urbit -- such as the dojo -- that would not traditionally fall under the purview of a build system.
815
@@ -65,11 +72,13 @@ shared structures that can be used by other parts of urbit. This is somewhat
6572similar to including a header file in C.
6673
6774Example:
75+
6876```
6977/- talk
7078::
7179*serial:talk
7280```
81+
7382produces: `0v0`
7483
7584`/-` can also take multiple files as arguments, and the ship and case of those
@@ -84,12 +93,13 @@ the subject. Arbitrary hoon can be in the twig. A
8493structure representing a `%ford` static resource.
8594
8695Example:
96+
8797```
8898/~ [a=0 b=1]
8999[a b]
90100```
91−produces:
92−`[0 1]`
101+
102+produces: `[0 1]`
93103
94104In wide-form, `/~` always takes a tuple (which may be a degenerate tuple of one element), and produces it.
95105
@@ -339,7 +349,7 @@ produces the number of bytes in the file "/%/path/to/hoon/file."
339349### `/,` switch by path
340350
341351`/,` is a switch statement, which picks a branch to evaluate based on
342−whether the current path matches the path in the switch statement.
352+whether the current path matches the path in the switch statement.
343353Takes a sequence of pairs of (path, horn) terminated by a `==`. No wide-form.
344354
345355Example:
learn/arvo/gall.udonnew file+17
@@ -0,0 +1,17 @@
1+:- :~ navhome/'/docs/'
2+ next/'true'
3+ sort/'6'
4+ title/'Gall Apps'
5+ ==
6+;>
7+
8+# Gall Apps
9+
10+This is documentation about how to write Gall apps. Some knowledge of Hoon is assumed.
11+
12+> Note: the last major revision of these lessons was in 2016. They need to be
13+ rewritten; in some ways they are outdated, and in other ways they were not
14+ always accessible enough to beginners. We are planning to rewrite these in the
15+ near future. There is still useful information to be found in the meantime.
16+
17+;list;
docs/arvo/api.md → learn/arvo/gall/api.udonrenamed+126−143
@@ -1,12 +1,14 @@
1−---
2−navhome: /docs/
3−next: true
4−sort: 21
5−title: API Connectors
6−---
1+:- :~ navhome/'/docs/'
2+ navuptwo/'true'
3+ sort/'9'
4+ title/'API Connectors'
5+ ==
6+;>
77
88# API Connectors
99
10+> Note: This lesson depends on some code that needs to be updated before the examples will work correctly. This will be addressed in the near future. We apologize!
11+
1012Most people have lots of data stored in online services, many of
1113which have APIs. API connectors allow the user to access this
1214data from within their Urbit.
@@ -26,35 +28,45 @@ app accomplishes both for Github.
2628After starting `%gh` (`|start %gh`), let's look at the root of
2729the tree that `%gh` exposes:
2830
29− ~your-urbit:dojo> .^(arch %gy /=gh=)
30− [fil=~ dir={[p=~.issues q=~]}]
31+```
32+~your-urbit:dojo> .^(arch %gy /=gh=)
33+[fil=~ dir={[p=~.issues q=~]}]
34+```
3135
3236`%gh` is currently a skeleton -- it contains examples of all the
3337functionality necessary for a connector, but many endpoints
3438aren't implemented. As we can see here, only issues are
3539implemented. We can explore this tree:
3640
37− ~your-urbit:dojo> .^(arch %gy /=gh=/issues)
38− [fil=~ dir={[p=~.by-repo q=~] [p=~.mine q=~]}]
41+```
42+~your-urbit:dojo> .^(arch %gy /=gh=/issues)
43+[fil=~ dir={[p=~.by-repo q=~] [p=~.mine q=~]}]
44+```
3945
4046And eventually:
4147
42− /- gh
43− .^(issue:gh %gx /=gh=/issues/by-repo/philipcmonktest/testing/7)
44− <issue...>
45− login.user:.^(issue:gh %gx /=gh=/issues/by-repo/philipcmonktest/testing/7)
46− 'philipcmonktest'
48+```
49+/- gh
50+.^(issue:gh %gx /=gh=/issues/by-repo/philipcmonktest/testing/7)
51+<issue...>
52+login.user:.^(issue:gh %gx /=gh=/issues/by-repo/philipcmonktest/testing/7)
53+'philipcmonktest'
54+```
4755
4856The other thing an API connector needs to do is expose event
4957streams. One straightforward way to use this capacity is with
5058the `:pipe` app:
5159
52− :pipe|connect %gh /listen/philipcmonktest/testing/issues/'issue_comment' %public
60+```
61+:pipe|connect %gh /listen/philipcmonktest/testing/issues/'issue_comment' %public
62+```
5363
5464Now creating an issue results in the following message in your
5565`%public` `:talk` channel:
5666
57− ~your-urbit[philipcmonktest@github]: opened issue #11: i found a bug!
67+```
68+~your-urbit[philipcmonktest@github]: opened issue #11: i found a bug!
69+```
5870
5971You'll also get notifications of issue status changes and
6072comments.
@@ -76,13 +88,7 @@ for a particular piece of data, while `%y` is a request for a
7688directory listing. Roughly, `%x` means Unix `cat` and `%y` means
7789Unix `ls`.
7890
79−> Sometimes you wish to expose a tree where a part of the path
80−> can't be enumerated. For example, a `%y` of `/issues/by-repo`
81−> "should" produce a list of all Github users, but we don't do
82−> that because it's too long. Instead, we just produce our own
83−> username (from the `web.plan` file). You can still access
84−> repos from other users, you just don't see them in the
85−> directory listing.
91+> Sometimes you wish to expose a tree where a part of the path can't be enumerated. For example, a `%y` of `/issues/by-repo` "should" produce a list of all Github users, but we don't do that because it's too long. Instead, we just produce our own username (from the `web.plan` file). You can still access repos from other users, you just don't see them in the directory listing.
8692
8793The usual flow for implementing this tree of data makes heavy use
8894of the `connector` library. This library is well documented in
@@ -93,40 +99,32 @@ of `move` and `sub-result` (all the types of data that can be
9399returned by a place). This can just be a line at the top of the
94100main core:
95101
96− =+ connector=(connector move sub-result) :: Set up connector library
102+```
103+=+ connector=(connector move sub-result) :: Set up connector library
104+```
97105
98106Most of the Github-specific logic is in `++places`, which is a
99107list of all the places we can request. A place consists of:
100108
101− ++ place
102− $: guard/mold
103− read-x/$-(path move)
104− read-y/$-(path move)
105− sigh-x/$-(jon/json (unit sub-result))
106− sigh-y/$-(jon/json (unit arch))
107− ==
109+```
110+++ place
111+ $: guard/mold
112+ read-x/$-(path move)
113+ read-y/$-(path move)
114+ sigh-x/$-(jon/json (unit sub-result))
115+ sigh-y/$-(jon/json (unit arch))
116+ ==
117+```
108118
109−- `guard`, the type of the paths we should match. For example,
110− to match `/issues/<user>/<repo>` use `{$issues @t @t $~}`.
119+- `guard`, the type of the paths we should match. For example, to match `/issues/<user>/<repo>` use `{$issues @t @t $~}`.
111120
112−- `read-x`, called when someone tries to read the place with
113− `care` `%x`. Should produce a single move, usually either a
114− `%diff` response if we can immediately answer or a `%hiss`
115− http request if we need to make a request to the api. See the
116− `++read-*` functions in `++helpers` for some common handlers.
121+- `read-x`, called when someone tries to read the place with `care` `%x`. Should produce a single move, usually either a `%diff` response if we can immediately answer or a `%hiss` http request if we need to make a request to the api. See the `++read-*` functions in `++helpers` for some common handlers.
117122
118−- `read-y`, same as `read-x` except with care `%y`.
123+- `read-y`, same as `read-x` except with care `%y`.
119124
120−- `sigh-x`, called when an http response comes back on this
121− place. You're given the json of the result, and you should
122− produce either a result or null. Null represents an error.
123− If you didn't create an http request in `read-x`, then this
124− should never be called. Use `++sigh-strange` from `++helpers`
125− to unconditionally signal an error.
125+- `sigh-x`, called when an http response comes back on this place. You're given the json of the result, and you should produce either a result or null. Null represents an error. If you didn't create an http request in `read-x`, then this should never be called. Use `++sigh-strange` from `++helpers` to unconditionally signal an error.
126126
127−- `sigh-y`, same as `sigh-x` except with care `%y`. Note that a
128− `%y` request must produce an arch, unlike a `%x` request,
129− which may produce data of any mark.
127+- `sigh-y`, same as `sigh-x` except with care `%y`. Note that a `%y` request must produce an arch, unlike a `%x` request, which may produce data of any mark.
130128
131129Filling out the list of places is a lot of grunt work, but most
132130places are fairly straightforward, and the `++read-*` helper
@@ -138,33 +136,18 @@ control. `++peek` and `++peer-scry` are the interface we expose
138136to the rest of the system while `++sigh-httr` and `++sigh-tang`
139137are used to handle responses when we make HTTP requests.
140138
141−- `++peek` should usually just produce `~`. If there are cases
142− where we can respond directly to a `.^` request without
143− blocking on anything, we could do it here, but it's generally
144− not worth the hassle since the same logic should be duplicated
145− in `++peer-scry`.
146−
147−- `++peer-scry` is where the actual handling for a read request
148− goes. In general, we just need to call `++read` from the
149− `connector` library with the bone, list of places, care, and
150− path. This will match the path to the appropriate place and
151− run either `++read-x` or `++read-y`, depending on the care.
152−
153−- If `++read-x` or `++read-y` made a successful API request, then
154− the response will come back on `++sigh-httr`. Here, we just
155− need to parse out the wire and call `++sigh` from the
156− `connector` library with the list of places, care, path, and
157− HTTP result. This will match the path to the appropriate place
158− and run either `++sigh-x` or `++sigh-y`, depending on the care.
159−
160−- If `++read-x` or `++read-y` made an API request that failed,
161− then we'll get a stack trace in `++sigh-tang`. Here, we just
162− print it out and move on.
139+- `++peek` should usually just produce `~`. If there are cases where we can respond directly to a `.^` request without blocking on anything, we could do it here, but it's generally not worth the hassle since the same logic should be duplicated in `++peer-scry`.
140+
141+- `++peer-scry` is where the actual handling for a read request goes. In general, we just need to call `++read` from the `connector` library with the bone, list of places, care, and path. This will match the path to the appropriate place and run either `++read-x` or `++read-y`, depending on the care.
142+
143+- If `++read-x` or `++read-y` made a successful API request, then the response will come back on `++sigh-httr`. Here, we just need to parse out the wire and call `++sigh` from the `connector` library with the list of places, care, path, and HTTP result. This will match the path to the appropriate place and run either `++sigh-x` or `++sigh-y`, depending on the care.
144+
145+- If `++read-x` or `++read-y` made an API request that failed, then we'll get a stack trace in `++sigh-tang`. Here, we just print it out and move on.
163146
164147That's really all there is to the reading portion of API
165148connectors.
166149
167−One of the most accessbile ways to jump into Arvo programming is
150+One of the most accessible ways to jump into Arvo programming is
168151to just add more places to an existing API connector. It's
169152useful, small in scope, and comes in bite-sized chunks since most
170153places are less than ten lines of code.
@@ -243,120 +226,120 @@ this doc:
243226::
244227!:
245228=> |%
246− ++ move (pair bone card)
247− ++ card
248− $% {$diff sub-result}
249− {$them wire (unit hiss)}
250− {$hiss wire {$~ $~} $httr {$hiss hiss}}
229+ +$ move (pair bone card)
230+ +$ card
231+ $% [%diff sub-result]
232+ [%them wire (unit hiss:eyre)]
233+ [%hiss wire [%~ %~] %httr [%hiss hiss:eyre]]
251234 ==
252235 ::
253236 :: Types of results we produce to subscribers.
254237 ::
255− ++ sub-result
256− $% {$arch arch}
257− {$gh-issue issue:gh}
258− {$gh-list-issues (list issue:gh)}
259− {$gh-issues issues:gh}
260− {$gh-issue-comment issue-comment:gh}
261− {$json json}
262− {$null $~}
238+ +$ sub-result
239+ $% [%arch arch]
240+ [%gh-issue issue:gh]
241+ [%gh-list-issues (list issue:gh)]
242+ [%gh-issues issues:gh]
243+ [%gh-issue-comment issue-comment:gh]
244+ [%json json]
245+ [%null %~]
263246 ==
264247 ::
265248 :: Types of webhooks we expect.
266249 ::
267− ++ hook-response
268− $% {$gh-issues issues:gh}
269− {$gh-issue-comment issue-comment:gh}
250+ +$ hook-response
251+ $% [%gh-issues issues:gh]
252+ [%gh-issue-comment issue-comment:gh]
270253 ==
271254 --
272255=+ connector=(connector move sub-result) :: Set up connector library
273256::
274−|_ $: hid/bowl
275− hook/(map @t {id/@t listeners/(set bone)}) :: map events to listeners
257+|_ $: hid=bowl:gall
258+ hook=(map @t [id=@t listeners=(set bone)]) :: map events to listeners
276259 ==
277260:: ++ prep _`. :: Clear state when code changes
278261::
279262:: List of endpoints
280263::
281264++ places
282− |= wir/wire
265+ |= wir=wire
283266 ^- (list place:connector)
284267 =+ (helpers:connector ost.hid wir "https://api.github.com")
285268 => |% :: gh-specific helpers
286269 ++ sigh-list-issues-x
287− |= jon/json
270+ |= jon=json
288271 %+ bind ((ar:jo issue:gh-parse) jon)
289− |= issues/(list issue:gh)
272+ |= issues=(list issue:gh)
290273 gh-list-issues+issues
291274 ::
292275 ++ sigh-list-issues-y
293− |= jon/json
276+ |= jon=json
294277 %+ bind ((ar:jo issue:gh-parse) jon)
295− |= issues/(list issue:gh)
278+ |= issues=(list issue:gh)
296279 :- `(shax (jam issues))
297280 (malt (turn issues |=(issue:gh [(rsh 3 2 (scot %ui number)) ~])))
298281 --
299282 :~ ^- place :: /
300− :* guard=$~
283+ :* guard=,%~
301284 read-x=read-null
302285 read-y=(read-static %issues ~)
303286 sigh-x=sigh-strange
304287 sigh-y=sigh-strange
305288 ==
306289 ^- place :: /issues
307− :* guard={$issues $~}
290+ :* guard=,[%issues %~]
308291 read-x=read-null
309292 read-y=(read-static %mine %by-repo ~)
310293 sigh-x=sigh-strange
311294 sigh-y=sigh-strange
312295 ==
313296 ^- place :: /issues/mine
314− :* guard={$issues $mine $~}
297+ :* guard=,[%issues %mine %~]
315298 read-x=(read-get /issues)
316299 read-y=(read-get /issues)
317300 sigh-x=sigh-list-issues-x
318301 sigh-y=sigh-list-issues-y
319302 ==
320303 ^- place :: /issues/by-repo
321− :* guard={$issues $by-repo $~}
304+ :* guard=,[%issues %by-repo %~]
322305 read-x=read-null
323306 ^= read-y
324− |= pax/path
307+ |= pax=path
325308 =+ /(scot %p our.hid)/home/(scot %da now.hid)/web/plan
326− =+ .^({* acc/(map knot plan-acct)} %cx -)
309+ =+ .^([* acc=(map knot plan-acct)] %cx -)
327310 ::
328311 ((read-static usr:(~(got by acc) %github) ~) pax)
329312 sigh-x=sigh-strange
330313 sigh-y=sigh-strange
331314 ==
332315 ^- place :: /issues/by-repo/<user>
333− :* guard={$issues $by-repo @t $~}
316+ :* guard=,[%issues %by-repo @t %~]
334317 read-x=read-null
335− read-y=|=(pax/path (get /users/[-.+>.pax]/repos))
318+ read-y=|=(pax=path (get /users/[-.+>.pax]/repos))
336319 sigh-x=sigh-strange
337320 ^= sigh-y
338− |= jon/json
321+ |= jon=json
339322 %+ bind ((ar:jo repository:gh-parse) jon)
340− |= repos/(list repository:gh)
323+ |= repos=(list repository:gh)
341324 [~ (malt (turn repos |=(repository:gh [name ~])))]
342325 ==
343326 ^- place :: /issues/by-repo/<user>/<repo>
344− :* guard={$issues $by-repo @t @t $~}
345− read-x=|=(pax/path (get /repos/[-.+>.pax]/[-.+>+.pax]/issues))
346− read-y=|=(pax/path (get /repos/[-.+>.pax]/[-.+>+.pax]/issues))
327+ :* guard=,[%issues %by-repo @t @t %~]
328+ read-x=|=(pax=path (get /repos/[-.+>.pax]/[-.+>+.pax]/issues))
329+ read-y=|=(pax=path (get /repos/[-.+>.pax]/[-.+>+.pax]/issues))
347330 sigh-x=sigh-list-issues-x
348331 sigh-y=sigh-list-issues-y
349332 ==
350333 ^- place :: /issues/by-repo/<user>/<repo>
351− :* guard={$issues $by-repo @t @t @t $~}
334+ :* guard=,[%issues %by-repo @t @t @t %~]
352335 ^= read-x
353− |=(pax/path (get /repos/[-.+>.pax]/[-.+>+.pax]/issues/[-.+>+>.pax]))
336+ |=(pax=path (get /repos/[-.+>.pax]/[-.+>+.pax]/issues/[-.+>+>.pax]))
354337 ::
355338 read-y=(read-static ~)
356339 ^= sigh-x
357− |= jon/json
340+ |= jon=json
358341 %+ bind (issue:gh-parse jon)
359− |= issue/issue:gh
342+ |= issue=issue:gh
360343 gh-issue+issue
361344 ::
362345 sigh-y=sigh-strange
@@ -370,9 +353,9 @@ this doc:
370353:: We hand control to ++scry.
371354::
372355++ peer-scry
373− |= pax/path
374− ^- {(list move) _+>.$}
375− ?> ?=({care *} pax)
356+ |= pax=path
357+ ^- [(list move) _+>.$]
358+ ?> ?=([care:clay *] pax)
376359 :_ +>.$ :_ ~
377360 (read:connector ost.hid (places %read pax) i.pax t.pax)
378361::
@@ -380,9 +363,9 @@ this doc:
380363:: produce the result (as JSON) to whoever sent the request.
381364::
382365++ sigh-httr
383− |= {way/wire res/httr}
384− ^- {(list move) _+>.$}
385− ?. ?=({$read care @ *} way)
366+ |= [way=wire res=httr:eyre]
367+ ^- [(list move) _+>.$]
368+ ?. ?=([%read care:clay @ *] way)
386369 ~& res=res
387370 [~ +>.$]
388371 =* style i.way
@@ -396,8 +379,8 @@ this doc:
396379:: also produce a result so that the request doesn't hang?
397380::
398381++ sigh-tang
399− |= {way/wire tan/tang}
400− ^- {(list move) _+>.$}
382+ |= [way=wire tan=tang]
383+ ^- [(list move) _+>.$]
401384 %- (slog >%gh-sigh-tang< tan)
402385 [[ost.hid %diff null+~]~ +>.$]
403386::
@@ -405,9 +388,9 @@ this doc:
405388:: without blocking, so we just block unconditionally.
406389::
407390++ peek
408− |= {ren/@tas tyl/path}
391+ |= [ren=@tas tyl=path]
409392 ^- (unit (unit (pair mark *)))
410− ~ ::``noun/[ren tyl]
393+ ~ ::``noun=[ren tyl]
411394::
412395::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
413396:: Webhook-powered event streams (/listen) ::
@@ -419,9 +402,9 @@ this doc:
419402:: We hand control to ++listen.
420403::
421404++ peer-listen
422− |= pax/path
423− ^- {(list move) _+>.$}
424− ?. ?=({@ @ *} pax)
405+ |= pax=path
406+ ^- [(list move) _+>.$]
407+ ?. ?=([@ @ *] pax)
425408 ~& [%bad-listen-path pax]
426409 [~ +>.$]
427410 (listen pax)
@@ -430,16 +413,16 @@ this doc:
430413:: updating the webhook flow for each event.
431414::
432415++ listen
433− |= pax/path
434− =| mow/(list move)
416+ |= pax=path
417+ =| mow=(list move)
435418 =< abet:listen
436419 |%
437420 ++ abet :: Resolve core.
438− ^- {(list move) _+>.$}
421+ ^- [(list move) _+>.$]
439422 [(flop mow) +>.$]
440423 ::
441424 ++ send-hiss :: Send a hiss
442− |= hiz/hiss
425+ |= hiz=hiss:eyre
443426 ^+ +>
444427 =+ wir=`wire`[%x %listen pax]
445428 +>.$(mow [[ost.hid %hiss wir `~ %httr [%hiss hiz]] mow])
@@ -449,7 +432,7 @@ this doc:
449432 ++ listen
450433 ^+ .
451434 =+ pax=pax :: TMI-proofing
452− ?> ?=({@ @ *} pax)
435+ ?> ?=([@ @ *] pax)
453436 =+ events=t.t.pax
454437 |- ^+ +>+.$
455438 ?~ events
@@ -461,28 +444,28 @@ this doc:
461444 :: Set up a webhook.
462445 ::
463446 ++ create-hook
464− |= event/@t
447+ |= event=@t
465448 ^+ +>
466− ?> ?=({@ @ *} pax)
467− =+ clean-event=`tape`(turn (trip event) |=(a/@tD ?:(=('_' a) '-' a)))
449+ ?> ?=([@ @ *] pax)
450+ =+ clean-event=`tape`(turn (trip event) |=(a=@tD ?:(=('_' a) '-' a)))
468451 =. hook
469452 %+ ~(put by hook) (crip clean-event)
470453 =+ %+ fall
471454 (~(get by hook) (crip clean-event))
472− *{id/@t listeners/(set bone)}
455+ *[id=@t listeners=(set bone)]
473456 [id (~(put in listeners) ost.hid)]
474457 %- send-hiss
475458 :* %+ scan
476459 =+ [(trip i.pax) (trip i.t.pax)]
477460 "https://api.github.com/repos/{-<}/{->}/hooks"
478− auri:epur
461+ auri:de-purl:html
479462 %post ~ ~
480− %- taco %- crip %- pojo %- jobe :~
463+ %- as-octs:mimes:html %- crip %- en-json:html %- pairs:enjs:format :~
481464 name+s+%web
482465 active+b+&
483− events+a+~[s+event] ::(turn `(list ,@t)`t.t.pax |=(a=@t s/a))
466+ events+a+~[s+event] ::(turn `(list ,@t)`t.t.pax |=(a=@t s=a))
484467 :- %config
485− %- jobe :~
468+ %- pairs:enjs:format :~
486469 =+ =+ clean-event
487470 "http://107.170.195.5:8443/~/to/gh/gh-{-}.json?anon&wire=/"
488471 [%url s+(crip -)]
@@ -494,7 +477,7 @@ this doc:
494477 :: Add current bone to the list of subscribers for this event.
495478 ::
496479 ++ update-hook
497− |= event/@t
480+ |= event=@t
498481 ^+ +>
499482 =+ hok=(~(got by hook) event)
500483 %_ +>.$
@@ -511,16 +494,16 @@ this doc:
511494:: listening for that event.
512495::
513496++ poke
514− |= response/hook-response
515− ^- {(list move) _+>.$}
497+ |= response=hook-response
498+ ^- [(list move) _+>.$]
516499 =+ hook-data=(~(get by hook) (rsh 3 3 -.response))
517500 ?~ hook-data
518501 ~& [%strange-hook hook response]
519502 [~ +>.$]
520503 :: ~& response=response
521504 :_ +>.$
522− %+ turn (~(tap in listeners.u.hook-data))
523− |= ost/bone
505+ %+ turn ~(tap in listeners.u.hook-data)
506+ |= ost=bone
524507 [ost %diff response]
525508--
526509```
learn/arvo/gall/generators.udonnew file+172
@@ -0,0 +1,172 @@
1+:- :~ navhome/'/docs/'
2+ navuptwo/'true'
3+ next/'true'
4+ sort/'6'
5+ title/'Using generators with apps'
6+ ==
7+;>
8+
9+# Generators
10+
11+Up until now we've poked apps directly. This requires the user to
12+specify the mark, and it requires the app to accept the arguments in a
13+way that's convenient for users to input. This is the "plumbing" way to
14+interact with apps. Generators are the "porcelain" layer. This is why
15+when you run a command like `+ls` or `|merge`, there are no marks in
16+sight.
17+
18+We've used generators before, back in [Basic
19+Operation](/docs/using/admin). At that point, we just used the
20+generators to produce values -- we didn't pipe their results into apps.
21+In the dojo cast, the role of a generator is to take a list of arguments
22+and produce a value, which is often, though not always, piped into an
23+app. Generators are pure, stateless functions, and they cannot send
24+moves.
25+
26+`+ls` and `+cat` are commonly-used generators that produce a directory
27+listing and print out a file, respectively. These are useful in
28+themselves, so we generally don't pipe the results into an app.
29+
30+Another generator is `+hood/merge`. Try running `+hood/merge` with the
31+normal arguments for `|merge`:
32+
33+```
34+> +hood/merge %home our %they
35+[syd=%home her=~zod sud=%they cas=[%da p=~2018.10.4..21.11.49..901c] gem=%auto]
36+
37+> +hood/merge %home our %they, =gem %this
38+[syd=%home her=~zod sud=%they cas=[%da p=~2018.10.4..21.12.11..ee32] gem=%this]
39+```
40+
41+This didn't run any merge, it just constructed the command that, if sent
42+to `:hood`, would run it. Note first that, even though it's not printed,
43+this value has mark `kiln-merge`. Also, the merge strategy `gem=%auto`
44+was added automatically. Optional arguments are straightforward with
45+generators.
46+
47+In general, generators are prepended by either `+` or `|`. The general
48+form is `+generator`, but often generators are created specifically to
49+work with a single app, they're usually placed in a subdirectory of gen
50+and run with `|`. Thus, if `my-generator` generator is made for use with
51+`:my-app`, then `my-generator` is put in
52+`/gen/my-app/my-generator.hoon`, and can be run directly with
53+`+my-app/my-generator <args>`. If you want to pipe the result into
54+`:my-app`, then run `:my-app +my-app/my-generator <args>`. Because this
55+pattern is so common, this can be abbreviated to
56+`:my-app|my-generator <args>`. Because most built-in commands are
57+generators for the `:hood` app, `:hood|generator <args>` can be
58+shortened to `|generator <args>`.
59+
60+Let's write a generator for a modified version of `:pong` from
61+the chapter on [Network Messages](/docs/arvo/system/network). Recall
62+that `:pong` takes an urbit address, which is of mark `urbit`,
63+and sends that urbit the message `'howdy'`. First--without a
64+generator--let's make `:ping` that does the same, except that
65+it lets the user optionally specify the message as well.
66+
67+We'll need a new mark for our arguments. Let's call it
68+`ping-message`.
69+
70+> For app-specific marks, it's good style to prefix the name of the mark with the name of the app. Since many apps have several such marks, subdirectories in `/mar` are rendered as `-`, so that `ping-message` is written in (/mar/ping/message.hoon).
71+
72+```
73+::
74+:::: /mar/ping/message/hoon
75+ ::
76+/? 314
77+|_ [to=@p message=@t]
78+++ grab
79+ |%
80+ +$ noun [@p @t]
81+ --
82+--
83+```
84+
85+The app can easily be modified to use this (`/app/ping.hoon`):
86+
87+```
88+:: Allows one ship to ping another with a string of text
89+::
90+:::: /app/ping/hoon
91+ ::
92+/? 314
93+|%
94+ +$ move [bone term wire *]
95+--
96+!:
97+|_ [bowl:gall state=%~]
98+::
99+++ poke-ping-message
100+ |= [to=@p message=@t]
101+ ~& 'sent'
102+ ^- [(list move) _+>.$]
103+ :- ^- (list move)
104+ :~ `move`[ost %poke /sending [to dap] %atom message]
105+ ==
106+ +>.$
107+::
108+++ poke-atom
109+ |= arg=@
110+ ~& 'received'
111+ ^- [(list move) _+>.$]
112+ ::
113+ ~& [%receiving (@t arg)]
114+ [~ +>.$]
115+::
116+++ coup |=(* `+>)
117+--
118+```
119+
120+Now we can run this with:
121+
122+```
123+~fintud-macrep:dojo> |start %ping
124+>=
125+
126+~fintud-macrep:dojo> :ping &ping-message [~sampel-sipnym 'heyya']
127+>=
128+```
129+
130+And on `~sampel-sipnym`, assuming it's running `:ping` as well,
131+we see `[%receiving 'heyya']`.
132+
133+This is an annoying way to invoke the app, though. The `[]` are
134+mandatory, and optional arguments are hard. Let's make a generator,
135+`+send` to make everything nicer. Since it's specific to
136+`:ping`, let's put it in `/gen/ping/send.hoon`:
137+
138+```
139+:- %say
140+|= [^ [to=@p message=?(%~ [text=@t %~])] %~]
141+[%ping-message to ?~(message 'howdy' text.message)]
142+```
143+
144+A couple of new things here. Firstly, `message=?(%~ [text=@t %~])] %~]`
145+should be read as "the message is either null or a pair of text and
146+null". Generator argument lists are always null-terminated, which makes
147+it convenient to accept lists in tail position (which are particularly
148+annoying without generators). `?(a b)` is the irregular form of
149+`$?(a b)`, which is a union type. Thus, `?(a b)` means the type of
150+anything that's in either `a` or `b`. Thus, in our case,
151+`?(~ [text=@t ~])` is either null or a pair of text and null.
152+
153+This is run as follows:
154+
155+```
156+~fintud-macrep:dojo> :ping|send ~sampel-sipnym
157+>=
158+
159+~fintud-macrep:dojo> :ping|send ~sampel-sipnym 'how do you do'
160+>=
161+```
162+
163+Which causes `~sampel-sipnym` to print `[%receiving 'howdy']` and
164+`[%receiving 'how do you do']`.
165+
166+(Note: `:ping|send ~sampel-sipnym` is short for `:ping +ping/send ~sampel-sipnym`.)
167+
168+*Exercises*:
169+
170+- Create a generator for `:sum` from [State](../../state) so that you can run `:sum|add 5` to add numbers to it.
171+
172+- Create a generator for `:click` from [Web Apps](../../web-apps) so that you can run `:click|poke` to poke it.
docs/arvo/http.md → learn/arvo/gall/http.udonrenamed+46−61

This diff is too big to show here.

docs/arvo/marks.md → learn/arvo/gall/marks.udonrenamed+30−33

This diff is too big to show here.

docs/arvo/network.md → learn/arvo/gall/network.udonrenamed+158−164

This diff is too big to show here.

docs/arvo/security-driver.md → learn/arvo/gall/security-driver.udonrenamed+46−67

This diff is too big to show here.

docs/arvo/state.md → learn/arvo/gall/state.udonrenamed+74−75

This diff is too big to show here.

docs/arvo/subscriptions.md → learn/arvo/gall/subscriptions.udonrenamed+197−212

This diff is too big to show here.

docs/arvo/web-apps.md → learn/arvo/gall/web-apps.udonrenamed+62−73

This diff is too big to show here.

learn/arvo/generators.udonnew file+604

This diff is too big to show here.

learn/arvo/hall.udonnew file+17

This diff is too big to show here.

docs/hall/architecture.md → learn/arvo/hall/architecture.udonrenamed+53−52

This diff is too big to show here.

docs/hall/interface.md → learn/arvo/hall/interface.udonrenamed+28−31

This diff is too big to show here.

docs/hall/new-gall.md → learn/arvo/hall/new-gall.udonrenamed+45−49

This diff is too big to show here.

docs/hall/new-gall/example.md → learn/arvo/hall/new-gall/example.udonrenamed+7−7

This diff is too big to show here.

docs/hall/new-gall/spec.md → learn/arvo/hall/new-gall/spec.udonrenamed+7−8

This diff is too big to show here.

learn/arvo/layout.udonnew file+177

This diff is too big to show here.

learn/arvo/messaging.udonnew file+684

This diff is too big to show here.

learn/arvo/publishing.udonnew file+448

This diff is too big to show here.

learn/arvo/sail.udonnew file+686

This diff is too big to show here.

learn/arvo/shell.udonnew file+433

This diff is too big to show here.

learn/arvo/udon.udonnew file+626

This diff is too big to show here.

learn/arvo/udon/blog.udonnew file+109

This diff is too big to show here.

learn/arvo/udon/comments.udonnew file+49

This diff is too big to show here.

learn/arvo/udon/static.udonnew file+142

This diff is too big to show here.

learn/azimuth.udonnew file+7

This diff is too big to show here.

learn/azimuth/blockchain.udonnew file+49

This diff is too big to show here.

learn/azimuth/constitution.udonnew file+7

This diff is too big to show here.

learn/azimuth/wallet.udonnew file+76

This diff is too big to show here.

learn/hoon.udonnew file+34

This diff is too big to show here.

learn/hoon/hoon-ch1-1.udonnew file+114

This diff is too big to show here.

learn/hoon/hoon-ch1-2.udonnew file+488

This diff is too big to show here.

learn/hoon/hoon-ch1-3.udonnew file+658

This diff is too big to show here.

learn/hoon/hoon-ch1-4.udonnew file+423

This diff is too big to show here.

learn/hoon/hoon-ch1-5.udonnew file+277

This diff is too big to show here.

learn/hoon/hoon-ch1-6.udonnew file+507

This diff is too big to show here.

learn/hoon/hoon-ch2-1.udonnew file+164

This diff is too big to show here.

learn/hoon/hoon-ch2-10.udonnew file+324

This diff is too big to show here.

learn/hoon/hoon-ch2-11.udonnew file+491

This diff is too big to show here.

learn/hoon/hoon-ch2-2.udonnew file+593

This diff is too big to show here.

learn/hoon/hoon-ch2-3.udonnew file+891

This diff is too big to show here.

learn/hoon/hoon-ch2-4.udonnew file+780

This diff is too big to show here.

learn/hoon/hoon-ch2-5.udonnew file+710

This diff is too big to show here.

learn/hoon/hoon-ch2-6.udonnew file+358

This diff is too big to show here.

learn/hoon/hoon-ch2-7.udonnew file+399

This diff is too big to show here.

learn/hoon/hoon-ch2-8.udonnew file+800

This diff is too big to show here.

learn/hoon/hoon-ch2-9.udonnew file+389

This diff is too big to show here.

learn/hoon/hoon-ch3-1.udonnew file+578

This diff is too big to show here.

learn/nock.udonnew file+14

This diff is too big to show here.

docs/nock/definition.md → learn/nock/definition.udonrenamed+87−66

This diff is too big to show here.

docs/nock/example.md → learn/nock/example.udonrenamed+8−7

This diff is too big to show here.

docs/nock/explanation.md → learn/nock/explanation.udonrenamed+85−43

This diff is too big to show here.

docs/nock/implementations.md → learn/nock/implementations.udonrenamed+78−33

This diff is too big to show here.

docs/nock/implementations/c.md → learn/nock/implementations/c.udonrenamed+6−6

This diff is too big to show here.

docs/nock/implementations/clojure.md → learn/nock/implementations/clojure.udonrenamed+6−6

This diff is too big to show here.

docs/nock/implementations/csharp.md → learn/nock/implementations/csharp.udonrenamed+6−6

This diff is too big to show here.

docs/nock/implementations/groovy.md → learn/nock/implementations/groovy.udonrenamed+6−6

This diff is too big to show here.

docs/nock/implementations/haskell.md → learn/nock/implementations/haskell.udonrenamed+6−6

This diff is too big to show here.

docs/nock/implementations/hoon.md → learn/nock/implementations/hoon.udonrenamed+6−5

This diff is too big to show here.

docs/nock/implementations/javascript.md → learn/nock/implementations/javascript.udonrenamed+7−7

This diff is too big to show here.

docs/nock/implementations/python.md → learn/nock/implementations/python.udonrenamed+6−6

This diff is too big to show here.

docs/nock/implementations/ruby.md → learn/nock/implementations/ruby.udonrenamed+6−6

This diff is too big to show here.

docs/nock/implementations/scala.md → learn/nock/implementations/scala.udonrenamed+32−30

This diff is too big to show here.

docs/nock/implementations/scheme.md → learn/nock/implementations/scheme.udonrenamed+6−6

This diff is too big to show here.

docs/nock/implementations/swift.md → learn/nock/implementations/swift.udonrenamed+7−7

This diff is too big to show here.

docs/vere.md → learn/vere.udonrenamed+9−9

This diff is too big to show here.

docs/vere/api.md → learn/vere/api.udonrenamed+123−69

This diff is too big to show here.

docs/vere/c.md → learn/vere/c.udonrenamed+15−9

This diff is too big to show here.

learn/vere/jetting.udonnew file+777

This diff is too big to show here.

docs/vere/nouns.md → learn/vere/nouns.udonrenamed+41−19

This diff is too big to show here.

docs/vere/runtime.md → learn/vere/runtime.udonrenamed+6−6

This diff is too big to show here.

readme.md+37−4

This diff is too big to show here.

reference.udonnew file+9

This diff is too big to show here.

docs/hoon/cheat-sheet.md → reference/cheat-sheet.udonrenamed+12−10

This diff is too big to show here.

reference/glossary.udonnew file+916

This diff is too big to show here.

reference/hoon-expressions.udonnew file+6

This diff is too big to show here.

docs/hoon/advanced.md → reference/hoon-expressions/advanced.udonrenamed+41−38

This diff is too big to show here.

reference/hoon-expressions/basic.udonnew file+180

This diff is too big to show here.

docs/hoon/irregular.md → reference/hoon-expressions/irregular.udonrenamed+72−70

This diff is too big to show here.

reference/hoon-expressions/limb.udonnew file+19

This diff is too big to show here.

reference/hoon-expressions/limb/limb.udonnew file+74

This diff is too big to show here.

reference/hoon-expressions/limb/wing.udonnew file+47

This diff is too big to show here.

reference/hoon-expressions/rune.udonnew file+105

This diff is too big to show here.

reference/hoon-expressions/rune/bar.udonnew file+20

This diff is too big to show here.

reference/hoon-expressions/rune/bar/cab.udonnew file+96

This diff is too big to show here.

reference/hoon-expressions/rune/bar/cen.udonnew file+66

This diff is too big to show here.

reference/hoon-expressions/rune/bar/col.udonnew file+54

This diff is too big to show here.

reference/hoon-expressions/rune/bar/dot.udonnew file+74

This diff is too big to show here.

reference/hoon-expressions/rune/bar/hep.udonnew file+62

This diff is too big to show here.

reference/hoon-expressions/rune/bar/ket.udonnew file+65

This diff is too big to show here.

reference/hoon-expressions/rune/bar/sig.udonnew file+45

This diff is too big to show here.

reference/hoon-expressions/rune/bar/tar.udonnew file+72

This diff is too big to show here.

reference/hoon-expressions/rune/bar/tis.udonnew file+66

This diff is too big to show here.

reference/hoon-expressions/rune/bar/vat.udonnew file+39

This diff is too big to show here.

reference/hoon-expressions/rune/bar/wut.udonnew file+48

This diff is too big to show here.

reference/hoon-expressions/rune/bus.udonnew file+41

This diff is too big to show here.

reference/hoon-expressions/rune/bus/base.udonnew file+23

This diff is too big to show here.

reference/hoon-expressions/rune/bus/cab.udonnew file+42

This diff is too big to show here.

reference/hoon-expressions/rune/bus/cen.udonnew file+37

This diff is too big to show here.

reference/hoon-expressions/rune/bus/col.udonnew file+40

This diff is too big to show here.

reference/hoon-expressions/rune/bus/hep.udonnew file+34

This diff is too big to show here.

reference/hoon-expressions/rune/bus/ket.udonnew file+40

This diff is too big to show here.

reference/hoon-expressions/rune/bus/sig.udonnew file+69

This diff is too big to show here.

reference/hoon-expressions/rune/bus/tis.udonnew file+41

This diff is too big to show here.

reference/hoon-expressions/rune/bus/vat.udonnew file+43

This diff is too big to show here.

reference/hoon-expressions/rune/bus/wut.udonnew file+48

This diff is too big to show here.

reference/hoon-expressions/rune/cen.udonnew file+16

This diff is too big to show here.

reference/hoon-expressions/rune/cen/cab.udonnew file+69

This diff is too big to show here.

reference/hoon-expressions/rune/cen/col.udonnew file+60

This diff is too big to show here.

reference/hoon-expressions/rune/cen/dot.udonnew file+47

This diff is too big to show here.

reference/hoon-expressions/rune/cen/hep.udonnew file+55

This diff is too big to show here.

reference/hoon-expressions/rune/cen/ket.udonnew file+41

This diff is too big to show here.

reference/hoon-expressions/rune/cen/lus.udonnew file+43

This diff is too big to show here.

reference/hoon-expressions/rune/cen/sig.udonnew file+58

This diff is too big to show here.

reference/hoon-expressions/rune/cen/tar.udonnew file+69

This diff is too big to show here.

reference/hoon-expressions/rune/cen/tis.udonnew file+73

This diff is too big to show here.

reference/hoon-expressions/rune/col.udonnew file+14

This diff is too big to show here.

docs/hoon/rune/col/cab.md → reference/hoon-expressions/rune/col/cab.udonrenamed+6−6

This diff is too big to show here.

reference/hoon-expressions/rune/col/col.udonnew file+25

This diff is too big to show here.

docs/hoon/rune/col/hep.md → reference/hoon-expressions/rune/col/hep.udonrenamed+13−10

This diff is too big to show here.

docs/hoon/rune/col/ket.md → reference/hoon-expressions/rune/col/ket.udonrenamed+12−11

This diff is too big to show here.

docs/hoon/rune/col/lus.md → reference/hoon-expressions/rune/col/lus.udonrenamed+8−7

This diff is too big to show here.

docs/hoon/rune/col/sig.md → reference/hoon-expressions/rune/col/sig.udonrenamed+8−5

This diff is too big to show here.

docs/hoon/rune/col/tar.md → reference/hoon-expressions/rune/col/tar.udonrenamed+12−10

This diff is too big to show here.

reference/hoon-expressions/rune/constants.udonnew file+16

This diff is too big to show here.

reference/hoon-expressions/rune/constants/cold.udonnew file+41

This diff is too big to show here.

reference/hoon-expressions/rune/constants/path.udonnew file+35

This diff is too big to show here.

reference/hoon-expressions/rune/constants/text.udonnew file+54

This diff is too big to show here.

docs/hoon/atom/sand.md → reference/hoon-expressions/rune/constants/warm.udonrenamed+28−9

This diff is too big to show here.

reference/hoon-expressions/rune/dot.udonnew file+14

This diff is too big to show here.

reference/hoon-expressions/rune/dot/ket.udonnew file+80

This diff is too big to show here.

reference/hoon-expressions/rune/dot/lus.udonnew file+36

This diff is too big to show here.

reference/hoon-expressions/rune/dot/tar.udonnew file+49

This diff is too big to show here.

docs/hoon/rune/dot/tis.md → reference/hoon-expressions/rune/dot/tis.udonrenamed+23−15

This diff is too big to show here.

reference/hoon-expressions/rune/dot/wut.udonnew file+28

This diff is too big to show here.

reference/hoon-expressions/rune/ket.udonnew file+19

This diff is too big to show here.

docs/hoon/rune/ket/bar.md → reference/hoon-expressions/rune/ket/bar.udonrenamed+7−7

This diff is too big to show here.

reference/hoon-expressions/rune/ket/col.udonnew file+42

This diff is too big to show here.

reference/hoon-expressions/rune/ket/dot.udonnew file+47

This diff is too big to show here.

docs/hoon/rune/ket/hep.md → reference/hoon-expressions/rune/ket/hep.udonrenamed+14−10

This diff is too big to show here.

reference/hoon-expressions/rune/ket/lus.udonnew file+25

This diff is too big to show here.

reference/hoon-expressions/rune/ket/pad.udonnew file+59

This diff is too big to show here.

docs/hoon/rune/ket/sig.md → reference/hoon-expressions/rune/ket/sig.udonrenamed+7−7

This diff is too big to show here.

reference/hoon-expressions/rune/ket/tar.udonnew file+57

This diff is too big to show here.

docs/hoon/rune/ket/tis.md → reference/hoon-expressions/rune/ket/tis.udonrenamed+13−10

This diff is too big to show here.

docs/hoon/rune/ket/wut.md → reference/hoon-expressions/rune/ket/wut.udonrenamed+8−7

This diff is too big to show here.

reference/hoon-expressions/rune/lus.udonnew file+18

This diff is too big to show here.

reference/hoon-expressions/rune/lus/bar.udonnew file+54

This diff is too big to show here.

reference/hoon-expressions/rune/lus/bus.udonnew file+44

This diff is too big to show here.

reference/hoon-expressions/rune/lus/lus.udonnew file+41

This diff is too big to show here.

reference/hoon-expressions/rune/lus/tar.udonnew file+47

This diff is too big to show here.

reference/hoon-expressions/rune/mic.udonnew file+14

This diff is too big to show here.

docs/hoon/rune/sem/col.md → reference/hoon-expressions/rune/mic/col.udonrenamed+10−8

This diff is too big to show here.

reference/hoon-expressions/rune/mic/lus.udonnew file+65

This diff is too big to show here.

docs/hoon/rune/sem/sem.md → reference/hoon-expressions/rune/mic/mic.udonrenamed+9−17

This diff is too big to show here.

reference/hoon-expressions/rune/mic/net.udonnew file+23

This diff is too big to show here.

docs/hoon/rune/sem/sig.md → reference/hoon-expressions/rune/mic/sig.udonrenamed+11−12

This diff is too big to show here.

reference/hoon-expressions/rune/mic/tar.udonnew file+58

This diff is too big to show here.

reference/hoon-expressions/rune/mic/tis.udonnew file+53

This diff is too big to show here.

reference/hoon-expressions/rune/sig.udonnew file+14

This diff is too big to show here.

docs/hoon/rune/sig/gar.md → reference/hoon-expressions/rune/sig/ban.udonrenamed+8−8

This diff is too big to show here.

docs/hoon/rune/sig/bar.md → reference/hoon-expressions/rune/sig/bar.udonrenamed+7−7

This diff is too big to show here.

docs/hoon/rune/sig/buc.md → reference/hoon-expressions/rune/sig/bus.udonrenamed+8−8

This diff is too big to show here.

docs/hoon/rune/sig/cab.md → reference/hoon-expressions/rune/sig/cab.udonrenamed+7−7

This diff is too big to show here.

docs/hoon/rune/sig/cen.md → reference/hoon-expressions/rune/sig/cen.udonrenamed+14−15

This diff is too big to show here.

docs/hoon/rune/sig/gal.md → reference/hoon-expressions/rune/sig/led.udonrenamed+11−10

This diff is too big to show here.

docs/hoon/rune/sig/lus.md → reference/hoon-expressions/rune/sig/lus.udonrenamed+7−7

This diff is too big to show here.

docs/hoon/rune/sig/fas.md → reference/hoon-expressions/rune/sig/net.udonrenamed+9−9

This diff is too big to show here.

reference/hoon-expressions/rune/sig/pad.udonnew file+41

This diff is too big to show here.

reference/hoon-expressions/rune/sig/tis.udonnew file+38

This diff is too big to show here.

docs/hoon/rune/sig/wut.md → reference/hoon-expressions/rune/sig/wut.udonrenamed+10−10

This diff is too big to show here.

docs/hoon/rune/sig/zap.md → reference/hoon-expressions/rune/sig/zap.udonrenamed+8−8

This diff is too big to show here.

reference/hoon-expressions/rune/terminators.udonnew file+14

This diff is too big to show here.

reference/hoon-expressions/rune/terminators/hephep.udonnew file+35

This diff is too big to show here.

reference/hoon-expressions/rune/terminators/tistis.udonnew file+47

This diff is too big to show here.

reference/hoon-expressions/rune/tis.udonnew file+30

This diff is too big to show here.

reference/hoon-expressions/rune/tis/ban.udonnew file+28

This diff is too big to show here.

reference/hoon-expressions/rune/tis/bar.udonnew file+37

This diff is too big to show here.

docs/hoon/rune/tis/col.md → reference/hoon-expressions/rune/tis/col.udonrenamed+11−7

This diff is too big to show here.

reference/hoon-expressions/rune/tis/com.udonnew file+41

This diff is too big to show here.

reference/hoon-expressions/rune/tis/dot.udonnew file+42

This diff is too big to show here.

reference/hoon-expressions/rune/tis/hep.udonnew file+35

This diff is too big to show here.

reference/hoon-expressions/rune/tis/ket.udonnew file+46

This diff is too big to show here.

reference/hoon-expressions/rune/tis/led.udonnew file+43

This diff is too big to show here.

reference/hoon-expressions/rune/tis/lus.udonnew file+37

This diff is too big to show here.

reference/hoon-expressions/rune/tis/mic.udonnew file+35

This diff is too big to show here.

reference/hoon-expressions/rune/tis/net.udonnew file+55

This diff is too big to show here.

docs/hoon/rune/tis/sig.md → reference/hoon-expressions/rune/tis/sig.udonrenamed+16−11

This diff is too big to show here.

reference/hoon-expressions/rune/tis/tar.udonnew file+39

This diff is too big to show here.

docs/hoon/rune/tis/wut.md → reference/hoon-expressions/rune/tis/wut.udonrenamed+7−7

This diff is too big to show here.

docs/hoon/rune/wut.md → reference/hoon-expressions/rune/wut.udonrenamed+15−14

This diff is too big to show here.

reference/hoon-expressions/rune/wut/ban.udonnew file+44

This diff is too big to show here.

docs/hoon/rune/wut/bar.md → reference/hoon-expressions/rune/wut/bar.udonrenamed+8−8

This diff is too big to show here.

reference/hoon-expressions/rune/wut/col.udonnew file+54

This diff is too big to show here.

docs/hoon/rune/wut/dot.md → reference/hoon-expressions/rune/wut/dot.udonrenamed+10−9

This diff is too big to show here.

docs/hoon/rune/wut/hep.md → reference/hoon-expressions/rune/wut/hep.udonrenamed+19−17

This diff is too big to show here.

reference/hoon-expressions/rune/wut/ket.udonnew file+39

This diff is too big to show here.

reference/hoon-expressions/rune/wut/led.udonnew file+44

This diff is too big to show here.

reference/hoon-expressions/rune/wut/lus.udonnew file+63

This diff is too big to show here.

docs/hoon/rune/wut/pam.md → reference/hoon-expressions/rune/wut/pad.udonrenamed+8−8

This diff is too big to show here.

reference/hoon-expressions/rune/wut/sig.udonnew file+33

This diff is too big to show here.

reference/hoon-expressions/rune/wut/tis.udonnew file+42

This diff is too big to show here.

reference/hoon-expressions/rune/wut/vat.udonnew file+38

This diff is too big to show here.

docs/hoon/rune/wut/zap.md → reference/hoon-expressions/rune/wut/zap.udonrenamed+8−8

This diff is too big to show here.

reference/hoon-expressions/rune/zap.udonnew file+12

This diff is too big to show here.

reference/hoon-expressions/rune/zap/ban.udonnew file+36

This diff is too big to show here.

reference/hoon-expressions/rune/zap/col.udonnew file+38

This diff is too big to show here.

reference/hoon-expressions/rune/zap/dot.udonnew file+50

This diff is too big to show here.

reference/hoon-expressions/rune/zap/tis.udonnew file+47

This diff is too big to show here.

docs/hoon/rune/zap/wut.md → reference/hoon-expressions/rune/zap/wut.udonrenamed+11−9

This diff is too big to show here.

docs/hoon/rune/zap/zap.md → reference/hoon-expressions/rune/zap/zap.udonrenamed+7−7

This diff is too big to show here.

reference/library.udonnew file+7

This diff is too big to show here.

docs/hoon/library/1a.md → reference/library/1a.udonrenamed+109−74

This diff is too big to show here.

docs/hoon/library/1b.md → reference/library/1b.udonrenamed+42−27

This diff is too big to show here.

docs/hoon/library/1c.md → reference/library/1c.udonrenamed+86−48

This diff is too big to show here.

docs/hoon/library/2a.md → reference/library/2a.udonrenamed+146−150

This diff is too big to show here.

docs/hoon/library/2b.md → reference/library/2b.udonrenamed+164−92

This diff is too big to show here.

docs/hoon/library/2c.md → reference/library/2c.udonrenamed+143−68

This diff is too big to show here.

docs/hoon/library/2d.md → reference/library/2d.udonrenamed+51−23

This diff is too big to show here.

docs/hoon/library/2e.md → reference/library/2e.udonrenamed+34−20

This diff is too big to show here.

reference/library/2f.udonnew file+858

This diff is too big to show here.

docs/hoon/library/2g.md → reference/library/2g.udonrenamed+19−10

This diff is too big to show here.

docs/hoon/library/2h.md → reference/library/2h.udonrenamed+106−56

This diff is too big to show here.

docs/hoon/library/2i.md → reference/library/2i.udonrenamed+146−62

This diff is too big to show here.

docs/hoon/library/2j.md → reference/library/2j.udonrenamed+85−34

This diff is too big to show here.

reference/library/2k.udonnew file+403

This diff is too big to show here.

docs/hoon/library/2l.md → reference/library/2l.udonrenamed+32−14

This diff is too big to show here.

docs/hoon/library/2m.md → reference/library/2m.udonrenamed+59−22

This diff is too big to show here.

docs/hoon/library/2n.md → reference/library/2n.udonrenamed+84−41

This diff is too big to show here.

docs/hoon/library/2o.md → reference/library/2o.udonrenamed+42−25

This diff is too big to show here.

docs/hoon/library/2p.md → reference/library/2p.udonrenamed+33−17

This diff is too big to show here.

docs/hoon/library/2q.md → reference/library/2q.udonrenamed+94−61

This diff is too big to show here.

docs/hoon/library/3a.md → reference/library/3a.udonrenamed+129−46

This diff is too big to show here.

reference/library/3b.udonnew file+5832

This diff is too big to show here.

docs/hoon/library/3c.md → reference/library/3c.udonrenamed+109−53

This diff is too big to show here.

docs/hoon/library/3d.md → reference/library/3d.udonrenamed+89−34

This diff is too big to show here.

docs/hoon/library/3e.md → reference/library/3e.udonrenamed+6−4

This diff is too big to show here.

docs/hoon/library/3f.md → reference/library/3f.udonrenamed+96−37

This diff is too big to show here.

docs/hoon/library/3g.md → reference/library/3g.udonrenamed+91−53

This diff is too big to show here.

docs/hoon/library/4a.md → reference/library/4a.udonrenamed+36−13

This diff is too big to show here.

docs/hoon/library/4b.md → reference/library/4b.udonrenamed+248−230

This diff is too big to show here.

docs/hoon/library/4c.md → reference/library/4c.udonrenamed+69−63

This diff is too big to show here.

docs/hoon/library/4d.md → reference/library/4d.udonrenamed+16−9

This diff is too big to show here.

docs/hoon/library/4e.md → reference/library/4e.udonrenamed+117−105

This diff is too big to show here.

docs/hoon/library/4f.md → reference/library/4f.udonrenamed+289−268

This diff is too big to show here.

docs/hoon/library/4g.md → reference/library/4g.udonrenamed+55−47

This diff is too big to show here.

docs/hoon/library/4h.md → reference/library/4h.udonrenamed+332−245

This diff is too big to show here.

reference/library/4i.udonnew file+10

This diff is too big to show here.

docs/hoon/library/4j.md → reference/library/4j.udonrenamed+461−457

This diff is too big to show here.

docs/hoon/library/4k.md → reference/library/4k.udonrenamed+322−263

This diff is too big to show here.

docs/hoon/library/4l.md → reference/library/4l.udonrenamed+96−87

This diff is too big to show here.

docs/hoon/library/4m.md → reference/library/4m.udonrenamed+102−109

This diff is too big to show here.

docs/hoon/library/4n.md → reference/library/4n.udonrenamed+71−79

This diff is too big to show here.

docs/hoon/library/4o.md → reference/library/4o.udonrenamed+439−163

This diff is too big to show here.

reference/library/5a.udonnew file+10

This diff is too big to show here.

reference/library/5b.udonnew file+10

This diff is too big to show here.

reference/library/5c.udonnew file+10

This diff is too big to show here.

reference/library/5d.udonnew file+11

This diff is too big to show here.

reference/library/5e.udonnew file+11

This diff is too big to show here.

docs/hoon/library/5f.md → reference/library/5f.udonrenamed+55−51

This diff is too big to show here.

reference/library/5g.udonnew file+11

This diff is too big to show here.

reference/library/zuse.udonnew file+13

This diff is too big to show here.

docs/hoon/library/zuse/core/crua.md → reference/library/zuse/core/crua.udonrenamed

The content is the same.

docs/hoon/library/zuse/core/epur.md → reference/library/zuse/core/epur.udonrenamed

The content is the same.

docs/hoon/library/zuse/core/fu.md → reference/library/zuse/core/fu.udonrenamed

The content is the same.

docs/hoon/library/zuse/core/jo.md → reference/library/zuse/core/jo.udonrenamed

The content is the same.

docs/hoon/library/zuse/core/poja.md → reference/library/zuse/core/poja.udonrenamed

The content is the same.

docs/hoon/library/zuse/core/poxa.md → reference/library/zuse/core/poxa.udonrenamed

The content is the same.

docs/hoon/library/zuse/core/poxo.md → reference/library/zuse/core/poxo.udonrenamed

The content is the same.

docs/hoon/library/zuse/core/yu.md → reference/library/zuse/core/yu.udonrenamed

The content is the same.

docs/hoon/library/zuse/diff.md → reference/library/zuse/diff.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/clan.md → reference/library/zuse/gate/clan.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/dawn.md → reference/library/zuse/gate/dawn.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/daws.md → reference/library/zuse/gate/daws.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/deal.md → reference/library/zuse/gate/deal.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/deft.md → reference/library/zuse/gate/deft.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/dust.md → reference/library/zuse/gate/dust.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/earl.md → reference/library/zuse/gate/earl.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/earn.md → reference/library/zuse/gate/earn.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/fain.md → reference/library/zuse/gate/fain.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/feel.md → reference/library/zuse/gate/feel.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/file.md → reference/library/zuse/gate/file.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/foal.md → reference/library/zuse/gate/foal.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/fray.md → reference/library/zuse/gate/fray.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/fuel.md → reference/library/zuse/gate/fuel.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/furl.md → reference/library/zuse/gate/furl.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/glam.md → reference/library/zuse/gate/glam.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/glon.md → reference/library/zuse/gate/glon.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/gnom.md → reference/library/zuse/gate/gnom.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/jape.md → reference/library/zuse/gate/jape.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/jesc.md → reference/library/zuse/gate/jesc.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/joba.md → reference/library/zuse/gate/joba.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/jobe.md → reference/library/zuse/gate/jobe.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/jone.md → reference/library/zuse/gate/jone.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/lead.md → reference/library/zuse/gate/lead.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/mang.md → reference/library/zuse/gate/mang.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/meat.md → reference/library/zuse/gate/meat.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/moon.md → reference/library/zuse/gate/moon.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/mung.md → reference/library/zuse/gate/mung.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/perk.md → reference/library/zuse/gate/perk.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/pojo.md → reference/library/zuse/gate/pojo.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/saxo.md → reference/library/zuse/gate/saxo.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/scanf.md → reference/library/zuse/gate/scanf.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/sein.md → reference/library/zuse/gate/sein.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/sifo.md → reference/library/zuse/gate/sifo.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/stud.md → reference/library/zuse/gate/stud.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/taco.md → reference/library/zuse/gate/taco.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/tact.md → reference/library/zuse/gate/tact.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/tame.md → reference/library/zuse/gate/tame.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/tell.md → reference/library/zuse/gate/tell.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/tome.md → reference/library/zuse/gate/tome.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/tope.md → reference/library/zuse/gate/tope.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/txml.md → reference/library/zuse/gate/txml.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/unt.md → reference/library/zuse/gate/unt.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/urld.md → reference/library/zuse/gate/urld.udonrenamed

The content is the same.

docs/hoon/library/zuse/gate/urle.md → reference/library/zuse/gate/urle.udonrenamed

The content is the same.

docs/hoon/library/zuse/mold/udal.md → reference/library/zuse/mold/udal.udonrenamed

The content is the same.

docs/hoon/library/zuse/mold/udon.md → reference/library/zuse/mold/udon.udonrenamed

The content is the same.

docs/hoon/library/zuse/mold/umph.md → reference/library/zuse/mold/umph.udonrenamed

The content is the same.

docs/hoon/library/zuse/mold/unce.md → reference/library/zuse/mold/unce.udonrenamed

The content is the same.

docs/hoon/library/zuse/mold/upas.md → reference/library/zuse/mold/upas.udonrenamed

The content is the same.

docs/hoon/library/zuse/mold/urge.md → reference/library/zuse/mold/urge.udonrenamed

The content is the same.

docs/hoon/library/zuse/rsa.md → reference/library/zuse/rsa.udonrenamed

The content is the same.

docs/hoon/troubleshooting.md → reference/troubleshooting.udonrenamed+12−13

This diff is too big to show here.