on master help sign in
Forgot to add.
commitfd1eeed7932d32e6ee0cf5bb92646490b921db3f authorC. Guy Yarvin <cgyarvin@gmail.com> dateFri 11 Mar 2016, 16:18 (11 years ago) parentd30c2ff
410 files changed+26465
docs/system/hoon/library/src/1a/gate/add.md+39 docs/system/hoon/library/src/1a/gate/dec.md+40 docs/system/hoon/library/src/1a/gate/div.md+43 docs/system/hoon/library/src/1a/gate/gte.md+39 docs/system/hoon/library/src/1a/gate/gth.md+37 docs/system/hoon/library/src/1a/gate/lte.md+40 docs/system/hoon/library/src/1a/gate/lth.md+45 docs/system/hoon/library/src/1a/gate/max.md+40 docs/system/hoon/library/src/1a/gate/min.md+40 docs/system/hoon/library/src/1a/gate/mod.md+38 docs/system/hoon/library/src/1a/gate/mul.md+40 docs/system/hoon/library/src/1a/gate/sub.md+43 docs/system/hoon/library/src/1a/title.md+1 docs/system/hoon/library/src/1b/gate/cap.md+44 docs/system/hoon/library/src/1b/gate/mas.md+48 docs/system/hoon/library/src/1b/gate/peg.md+44 docs/system/hoon/library/src/1c/mold/bloq.md+20 docs/system/hoon/library/src/1c/mold/each.md+19 docs/system/hoon/library/src/1c/mold/gate.md+29 docs/system/hoon/library/src/1c/mold/list.md+26 docs/system/hoon/library/src/1c/mold/lone.md+12 docs/system/hoon/library/src/1c/mold/pair.md+20 docs/system/hoon/library/src/1c/mold/pole.md+18 docs/system/hoon/library/src/1c/mold/qual.md+18 docs/system/hoon/library/src/1c/mold/trap.md+24 docs/system/hoon/library/src/1c/mold/tree.md+19 docs/system/hoon/library/src/1c/mold/trel.md+18 docs/system/hoon/library/src/1c/mold/unit.md+25 docs/system/hoon/library/src/2a/gate/biff.md+36 docs/system/hoon/library/src/2a/gate/bind.md+38 docs/system/hoon/library/src/2a/gate/bond.md+39 docs/system/hoon/library/src/2a/gate/both.md+37 docs/system/hoon/library/src/2a/gate/clap.md+44 docs/system/hoon/library/src/2a/gate/drop.md+35 docs/system/hoon/library/src/2a/gate/fall.md+34 docs/system/hoon/library/src/2a/gate/lift.md+37 docs/system/hoon/library/src/2a/gate/mate.md+49 docs/system/hoon/library/src/2a/gate/need.md+38 docs/system/hoon/library/src/2a/gate/some.md+32 docs/system/hoon/library/src/2b/gate/flop.md+38 docs/system/hoon/library/src/2b/gate/homo.md+41 docs/system/hoon/library/src/2b/gate/lent.md+37 docs/system/hoon/library/src/2b/gate/levy.md+38 docs/system/hoon/library/src/2b/gate/lien.md+26 docs/system/hoon/library/src/2b/gate/limo.md+33 docs/system/hoon/library/src/2b/gate/murn.md+40 docs/system/hoon/library/src/2b/gate/reap.md+36 docs/system/hoon/library/src/2b/gate/reel.md+43 docs/system/hoon/library/src/2b/gate/roll.md+43 docs/system/hoon/library/src/2b/gate/scag.md+36 docs/system/hoon/library/src/2b/gate/skid.md+36 docs/system/hoon/library/src/2b/gate/skim.md+35 docs/system/hoon/library/src/2b/gate/skip.md+37 docs/system/hoon/library/src/2b/gate/slag.md+37 docs/system/hoon/library/src/2b/gate/snag.md+38 docs/system/hoon/library/src/2b/gate/sort.md+40 docs/system/hoon/library/src/2b/gate/swag.md+33 docs/system/hoon/library/src/2b/gate/turn.md+37 docs/system/hoon/library/src/2b/gate/weld.md+31 docs/system/hoon/library/src/2b/gate/welp.md+45 docs/system/hoon/library/src/2b/gate/zing.md+37 docs/system/hoon/library/src/2c/gate/bex.md+37 docs/system/hoon/library/src/2c/gate/can.md+47 docs/system/hoon/library/src/2c/gate/cat.md+52 docs/system/hoon/library/src/2c/gate/cut.md+49 docs/system/hoon/library/src/2c/gate/end.md+50 docs/system/hoon/library/src/2c/gate/fil.md+45 docs/system/hoon/library/src/2c/gate/lsh.md+45 docs/system/hoon/library/src/2c/gate/met.md+37 docs/system/hoon/library/src/2c/gate/rap.md+41 docs/system/hoon/library/src/2c/gate/rep.md+49 docs/system/hoon/library/src/2c/gate/rip.md+49 docs/system/hoon/library/src/2c/gate/rsh.md+55 docs/system/hoon/library/src/2c/gate/swp.md+40 docs/system/hoon/library/src/2c/gate/xeb.md+42 docs/system/hoon/library/src/2d/gate/con.md+56 docs/system/hoon/library/src/2d/gate/dis.md+60 docs/system/hoon/library/src/2d/gate/mix.md+52 docs/system/hoon/library/src/2d/gate/not.md+44 docs/system/hoon/library/src/2e/gate/fnv.md+33 docs/system/hoon/library/src/2e/gate/mug.md+54 docs/system/hoon/library/src/2e/gate/mum.md+69 docs/system/hoon/library/src/2f/gate/aor.md+61 docs/system/hoon/library/src/2f/gate/dor.md+52 docs/system/hoon/library/src/2f/gate/gor.md+56 docs/system/hoon/library/src/2f/gate/hor.md+49 docs/system/hoon/library/src/2f/gate/vor.md+39 docs/system/hoon/library/src/2h/core/in.md+589 docs/system/hoon/library/src/2i/core/by.md+569 docs/system/hoon/library/src/2j/core/ja.md+229 docs/system/hoon/library/src/2j/core/ju.md+135 docs/system/hoon/library/src/2k/core/to.md+331 docs/system/hoon/library/src/2n/gate/cork.md+25 docs/system/hoon/library/src/2n/gate/corl.md+25 docs/system/hoon/library/src/2n/gate/curr.md+35 docs/system/hoon/library/src/2n/gate/cury.md+34 docs/system/hoon/library/src/2n/gate/hard.md+29 docs/system/hoon/library/src/2n/gate/soft.md+29 docs/system/hoon/library/src/2o/mold/jar.md+30 docs/system/hoon/library/src/2o/mold/jug.md+28 docs/system/hoon/library/src/2o/mold/map.md+25 docs/system/hoon/library/src/2o/mold/qeu.md+24 docs/system/hoon/library/src/2o/mold/set.md+26 docs/system/hoon/library/src/2p/gate/cue.md+53 docs/system/hoon/library/src/2p/gate/jam.md+58 docs/system/hoon/library/src/2p/gate/mat.md+54 docs/system/hoon/library/src/2p/gate/rub.md+50 docs/system/hoon/library/src/2q/mold/char.md+22 docs/system/hoon/library/src/2q/mold/cord.md+28 docs/system/hoon/library/src/2q/mold/date.md+20 docs/system/hoon/library/src/2q/mold/tang.md+7 docs/system/hoon/library/src/2q/mold/tank.md+39 docs/system/hoon/library/src/2q/mold/tape.md+21 docs/system/hoon/library/src/2q/mold/tarp.md+27 docs/system/hoon/library/src/2q/mold/term.md+28 docs/system/hoon/library/src/2q/mold/wain.md+32 docs/system/hoon/library/src/2q/mold/wall.md+31 docs/system/hoon/library/src/3a/core/fe.md+416 docs/system/hoon/library/src/3a/core/si.md+478 docs/system/hoon/library/src/3a/gate/egcd.md+39 docs/system/hoon/library/src/3c/core/yo.md+256 docs/system/hoon/library/src/3c/gate/yall.md+54 docs/system/hoon/library/src/3c/gate/yawn.md+60 docs/system/hoon/library/src/3c/gate/year.md+35 docs/system/hoon/library/src/3c/gate/yell.md+38 docs/system/hoon/library/src/3c/gate/yelp.md+37 docs/system/hoon/library/src/3c/gate/yore.md+36 docs/system/hoon/library/src/3c/gate/yule.md+55 docs/system/hoon/library/src/3d/core/og.md+55 docs/system/hoon/library/src/3d/gate/shad.md+7 docs/system/hoon/library/src/3d/gate/shaf.md+11 docs/system/hoon/library/src/3d/gate/shak.md+10 docs/system/hoon/library/src/3d/gate/shal.md+118 docs/system/hoon/library/src/3d/gate/sham.md+12 docs/system/hoon/library/src/3d/gate/shan.md+71 docs/system/hoon/library/src/3d/gate/shas.md+10 docs/system/hoon/library/src/3d/gate/shaw.md+8 docs/system/hoon/library/src/3d/gate/shax.md+92 docs/system/hoon/library/src/3d/gate/shaz.md+7 docs/system/hoon/library/src/3e/core/aesc.md+712 docs/system/hoon/library/src/3f/core/ob.md+255 docs/system/hoon/library/src/3f/core/un.md+364 docs/system/hoon/library/src/3g/mold/coin.md+36 docs/system/hoon/library/src/3g/mold/dime.md+21 docs/system/hoon/library/src/3g/mold/edge.md+22 docs/system/hoon/library/src/3g/mold/hair.md+25 docs/system/hoon/library/src/3g/mold/like.md+27 docs/system/hoon/library/src/3g/mold/nail.md+19 docs/system/hoon/library/src/3g/mold/path.md+19 docs/system/hoon/library/src/3g/mold/pint.md+22 docs/system/hoon/library/src/3g/mold/rule.md+27 docs/system/hoon/library/src/3g/mold/spot.md+21 docs/system/hoon/library/src/3g/mold/toon.md+26 docs/system/hoon/library/src/3g/mold/wonk.md+29 docs/system/hoon/library/src/4a/core/po.md+200 docs/system/hoon/library/src/4b/core/at.md+146 docs/system/hoon/library/src/4b/gate/cass.md+38 docs/system/hoon/library/src/4b/gate/crip.md+31 docs/system/hoon/library/src/4b/gate/cuss.md+39 docs/system/hoon/library/src/4b/gate/mesc.md+42 docs/system/hoon/library/src/4b/gate/runt.md+38 docs/system/hoon/library/src/4b/gate/sand.md+36 docs/system/hoon/library/src/4b/gate/sane.md+68 docs/system/hoon/library/src/4b/gate/teff.md+37 docs/system/hoon/library/src/4b/gate/trim.md+41 docs/system/hoon/library/src/4b/gate/trip.md+38 docs/system/hoon/library/src/4b/gate/tuba.md+34 docs/system/hoon/library/src/4b/gate/tufa.md+35 docs/system/hoon/library/src/4b/gate/tuft.md+59 docs/system/hoon/library/src/4b/gate/turf.md+54 docs/system/hoon/library/src/4b/gate/wack.md+45 docs/system/hoon/library/src/4b/gate/wick.md+42 docs/system/hoon/library/src/4b/gate/woad.md+60 docs/system/hoon/library/src/4b/gate/wood.md+55 docs/system/hoon/library/src/4c/core/re.md+260 docs/system/hoon/library/src/4c/gate/show.md+103 docs/system/hoon/library/src/4d/gate/last.md+42 docs/system/hoon/library/src/4d/gate/lust.md+46 docs/system/hoon/library/src/4e/gate/bend.md+62 docs/system/hoon/library/src/4e/gate/comp.md+48 docs/system/hoon/library/src/4e/gate/fail.md+31 docs/system/hoon/library/src/4e/gate/glue.md+46 docs/system/hoon/library/src/4e/gate/less.md+43 docs/system/hoon/library/src/4e/gate/pfix.md+34 docs/system/hoon/library/src/4e/gate/plug.md+46 docs/system/hoon/library/src/4e/gate/pose.md+44 docs/system/hoon/library/src/4e/gate/sfix.md+35 docs/system/hoon/library/src/4e/gate/simu.md+44 docs/system/hoon/library/src/4f/gate/bass.md+40 docs/system/hoon/library/src/4f/gate/boss.md+40 docs/system/hoon/library/src/4f/gate/cold.md+42 docs/system/hoon/library/src/4f/gate/cook.md+46 docs/system/hoon/library/src/4f/gate/easy.md+40 docs/system/hoon/library/src/4f/gate/full.md+38 docs/system/hoon/library/src/4f/gate/funk.md+36 docs/system/hoon/library/src/4f/gate/here.md+45 docs/system/hoon/library/src/4f/gate/ifix.md+35 docs/system/hoon/library/src/4f/gate/jest.md+48 docs/system/hoon/library/src/4f/gate/just.md+48 docs/system/hoon/library/src/4f/gate/knee.md+54 docs/system/hoon/library/src/4f/gate/mask.md+46 docs/system/hoon/library/src/4f/gate/more.md+36 docs/system/hoon/library/src/4f/gate/most.md+37 docs/system/hoon/library/src/4f/gate/next.md+37 docs/system/hoon/library/src/4f/gate/plus.md+35 docs/system/hoon/library/src/4f/gate/sear.md+41 docs/system/hoon/library/src/4f/gate/shim.md+45 docs/system/hoon/library/src/4f/gate/slug.md+36 docs/system/hoon/library/src/4f/gate/stag.md+43 docs/system/hoon/library/src/4f/gate/star.md+37 docs/system/hoon/library/src/4f/gate/stet.md+50 docs/system/hoon/library/src/4f/gate/stew.md+54 docs/system/hoon/library/src/4f/gate/stir.md+47 docs/system/hoon/library/src/4f/gate/stun.md+50 docs/system/hoon/library/src/4g/gate/rash.md+41 docs/system/hoon/library/src/4g/gate/rush.md+39 docs/system/hoon/library/src/4g/gate/rust.md+37 docs/system/hoon/library/src/4g/gate/scan.md+41 docs/system/hoon/library/src/4h/gate/ace.md+24 docs/system/hoon/library/src/4h/gate/bar.md+24 docs/system/hoon/library/src/4h/gate/bas.md+28 docs/system/hoon/library/src/4h/gate/buc.md+24 docs/system/hoon/library/src/4h/gate/cab.md+24 docs/system/hoon/library/src/4h/gate/cen.md+24 docs/system/hoon/library/src/4h/gate/col.md+24 docs/system/hoon/library/src/4h/gate/com.md+24 docs/system/hoon/library/src/4h/gate/doq.md+28 docs/system/hoon/library/src/4h/gate/dot.md+24 docs/system/hoon/library/src/4h/gate/fas.md+24 docs/system/hoon/library/src/4h/gate/gal.md+26 docs/system/hoon/library/src/4h/gate/gar.md+24 docs/system/hoon/library/src/4h/gate/hax.md+24 docs/system/hoon/library/src/4h/gate/hep.md+24 docs/system/hoon/library/src/4h/gate/kel.md+26 docs/system/hoon/library/src/4h/gate/ker.md+26 docs/system/hoon/library/src/4h/gate/ket.md+23 docs/system/hoon/library/src/4h/gate/lus.md+24 docs/system/hoon/library/src/4h/gate/pam.md+24 docs/system/hoon/library/src/4h/gate/pat.md+24 docs/system/hoon/library/src/4h/gate/pel.md+24 docs/system/hoon/library/src/4h/gate/per.md+24 docs/system/hoon/library/src/4h/gate/sel.md+24 docs/system/hoon/library/src/4h/gate/sem.md+24 docs/system/hoon/library/src/4h/gate/ser.md+24 docs/system/hoon/library/src/4h/gate/sig.md+24 docs/system/hoon/library/src/4h/gate/soq.md+25 docs/system/hoon/library/src/4h/gate/tar.md+24 docs/system/hoon/library/src/4h/gate/tec.md+25 docs/system/hoon/library/src/4h/gate/tis.md+24 docs/system/hoon/library/src/4h/gate/wut.md+24 docs/system/hoon/library/src/4h/gate/zap.md+24 docs/system/hoon/library/src/4j/core/ab.md+1365 docs/system/hoon/library/src/4j/core/mu.md+124 docs/system/hoon/library/src/4j/core/ne.md+154 docs/system/hoon/library/src/4k/core/co.md+335 docs/system/hoon/library/src/4k/gate/alf.md+22 docs/system/hoon/library/src/4k/gate/aln.md+22 docs/system/hoon/library/src/4k/gate/alp.md+22 docs/system/hoon/library/src/4k/gate/bet.md+21 docs/system/hoon/library/src/4k/gate/bin.md+24 docs/system/hoon/library/src/4k/gate/but.md+26 docs/system/hoon/library/src/4k/gate/cit.md+26 docs/system/hoon/library/src/4k/gate/dem.md+24 docs/system/hoon/library/src/4k/gate/dit.md+22 docs/system/hoon/library/src/4k/gate/dog.md+21 docs/system/hoon/library/src/4k/gate/doh.md+25 docs/system/hoon/library/src/4k/gate/dun.md+20 docs/system/hoon/library/src/4k/gate/duz.md+21 docs/system/hoon/library/src/4k/gate/gah.md+35 docs/system/hoon/library/src/4k/gate/gap.md+12 docs/system/hoon/library/src/4k/gate/gaq.md+17 docs/system/hoon/library/src/4k/gate/gaw.md+12 docs/system/hoon/library/src/4k/gate/gay.md+12 docs/system/hoon/library/src/4k/gate/gon.md+21 docs/system/hoon/library/src/4k/gate/gul.md+20 docs/system/hoon/library/src/4k/gate/hex.md+29 docs/system/hoon/library/src/4k/gate/hig.md+24 docs/system/hoon/library/src/4k/gate/hit.md+27 docs/system/hoon/library/src/4k/gate/iny.md+58 docs/system/hoon/library/src/4k/gate/low.md+24 docs/system/hoon/library/src/4k/gate/mes.md+24 docs/system/hoon/library/src/4k/gate/nix.md+20 docs/system/hoon/library/src/4k/gate/nud.md+24 docs/system/hoon/library/src/4k/gate/prn.md+23 docs/system/hoon/library/src/4k/gate/qat.md+35 docs/system/hoon/library/src/4k/gate/qit.md+36 docs/system/hoon/library/src/4k/gate/qut.md+38 docs/system/hoon/library/src/4k/gate/soz.md+21 docs/system/hoon/library/src/4k/gate/sym.md+26 docs/system/hoon/library/src/4k/gate/ven.md+35 docs/system/hoon/library/src/4k/gate/vit.md+30 docs/system/hoon/library/src/4k/gate/vul.md+26 docs/system/hoon/library/src/4l/core/so.md+476 docs/system/hoon/library/src/4m/gate/scot.md+40 docs/system/hoon/library/src/4m/gate/scow.md+32 docs/system/hoon/library/src/4m/gate/slat.md+35 docs/system/hoon/library/src/4m/gate/slav.md+43 docs/system/hoon/library/src/4m/gate/slaw.md+47 docs/system/hoon/library/src/4m/gate/slay.md+54 docs/system/hoon/library/src/4m/gate/smyt.md+43 docs/system/hoon/library/src/4m/gate/spat.md+30 docs/system/hoon/library/src/4m/gate/spud.md+30 docs/system/hoon/library/src/4m/gate/stab.md+35 docs/system/hoon/library/src/4n/gate/mack.md+45 docs/system/hoon/library/src/4n/gate/mink.md+122 docs/system/hoon/library/src/4n/gate/mock.md+50 docs/system/hoon/library/src/4n/gate/mong.md+55 docs/system/hoon/library/src/4n/gate/mook.md+82 docs/system/hoon/library/src/4n/gate/mule.md+52 docs/system/hoon/library/src/4n/gate/mute.md+50 docs/system/hoon/library/src/4o/mold/abel.md+16 docs/system/hoon/library/src/4o/mold/aura.md+22 docs/system/hoon/library/src/4o/mold/axis.md+25 docs/system/hoon/library/src/4o/mold/base.md+27 docs/system/hoon/library/src/4o/mold/bean.md+23 docs/system/hoon/library/src/4o/mold/beer.md+19 docs/system/hoon/library/src/4o/mold/beet.md+18 docs/system/hoon/library/src/4o/mold/chum.md+29 docs/system/hoon/library/src/4o/mold/coil.md+16 docs/system/hoon/library/src/4o/mold/foot.md+31 docs/system/hoon/library/src/4o/mold/limb.md+18 docs/system/hoon/library/src/4o/mold/line.md+28 docs/system/hoon/library/src/4o/mold/metl.md+9 docs/system/hoon/library/src/4o/mold/nock.md+29 docs/system/hoon/library/src/4o/mold/noun.md+10 docs/system/hoon/library/src/4o/mold/null.md+11 docs/system/hoon/library/src/4o/mold/port.md+23 docs/system/hoon/library/src/4o/mold/span.md+30 docs/system/hoon/library/src/4o/mold/tiki.md+34 docs/system/hoon/library/src/4o/mold/toga.md+40 docs/system/hoon/library/src/4o/mold/tone.md+45 docs/system/hoon/library/src/4o/mold/tuna.md+25 docs/system/hoon/library/src/4o/mold/tusk.md+21 docs/system/hoon/library/src/4o/mold/twig.md+9 docs/system/hoon/library/src/4o/mold/tyke.md+23 docs/system/hoon/library/src/4o/mold/typo.md+18 docs/system/hoon/library/src/4o/mold/tyre.md+12 docs/system/hoon/library/src/4o/mold/vase.md+19 docs/system/hoon/library/src/4o/mold/vise.md+17 docs/system/hoon/library/src/4o/mold/wing.md+15 docs/system/hoon/library/src/5f/mold/mane.md+26 docs/system/hoon/library/src/5f/mold/manx.md+17 docs/system/hoon/library/src/5f/mold/marl.md+16 docs/system/hoon/library/src/5f/mold/mars.md+15 docs/system/hoon/library/src/5f/mold/mart.md+18 docs/system/hoon/library/src/5f/mold/marx.md+16 docs/system/hoon/library/src/5f/mold/pass.md+12 docs/system/hoon/library/src/5f/mold/ring.md+12 docs/system/hoon/library/src/5f/mold/time.md+23 docs/system/hoon/zuse/core/crua.md+598 docs/system/hoon/zuse/core/epur.md+885 docs/system/hoon/zuse/core/fu.md+68 docs/system/hoon/zuse/core/jo.md+948 docs/system/hoon/zuse/core/poja.md+715 docs/system/hoon/zuse/core/poxa.md+440 docs/system/hoon/zuse/core/poxo.md+255 docs/system/hoon/zuse/core/yu.md+212 docs/system/hoon/zuse/diff.md+810 docs/system/hoon/zuse/gate/clan.md+40 docs/system/hoon/zuse/gate/dawn.md+39 docs/system/hoon/zuse/gate/daws.md+37 docs/system/hoon/zuse/gate/deal.md+44 docs/system/hoon/zuse/gate/deft.md+48 docs/system/hoon/zuse/gate/dust.md+42 docs/system/hoon/zuse/gate/earl.md+40 docs/system/hoon/zuse/gate/earn.md+180 docs/system/hoon/zuse/gate/fain.md+56 docs/system/hoon/zuse/gate/feel.md+47 docs/system/hoon/zuse/gate/file.md+44 docs/system/hoon/zuse/gate/foal.md+43 docs/system/hoon/zuse/gate/fray.md+38 docs/system/hoon/zuse/gate/fuel.md+77 docs/system/hoon/zuse/gate/furl.md+50 docs/system/hoon/zuse/gate/glam.md+84 docs/system/hoon/zuse/gate/glon.md+216 docs/system/hoon/zuse/gate/gnom.md+38 docs/system/hoon/zuse/gate/jape.md+38 docs/system/hoon/zuse/gate/jesc.md+41 docs/system/hoon/zuse/gate/joba.md+40 docs/system/hoon/zuse/gate/jobe.md+34 docs/system/hoon/zuse/gate/jone.md+40 docs/system/hoon/zuse/gate/lead.md+48 docs/system/hoon/zuse/gate/mang.md+55 docs/system/hoon/zuse/gate/meat.md+48 docs/system/hoon/zuse/gate/moon.md+40 docs/system/hoon/zuse/gate/mung.md+55 docs/system/hoon/zuse/gate/perk.md+49 docs/system/hoon/zuse/gate/pojo.md+78 docs/system/hoon/zuse/gate/saxo.md+37 docs/system/hoon/zuse/gate/scanf.md+83 docs/system/hoon/zuse/gate/sein.md+56 docs/system/hoon/zuse/gate/sifo.md+46 docs/system/hoon/zuse/gate/stud.md+58 docs/system/hoon/zuse/gate/taco.md+27 docs/system/hoon/zuse/gate/tact.md+34 docs/system/hoon/zuse/gate/tame.md+54 docs/system/hoon/zuse/gate/tell.md+39 docs/system/hoon/zuse/gate/tome.md+46 docs/system/hoon/zuse/gate/tope.md+30 docs/system/hoon/zuse/gate/txml.md+32 docs/system/hoon/zuse/gate/unt.md+35 docs/system/hoon/zuse/gate/urld.md+48 docs/system/hoon/zuse/gate/urle.md+51 docs/system/hoon/zuse/mold/udal.md+10 docs/system/hoon/zuse/mold/udon.md+15 docs/system/hoon/zuse/mold/umph.md+13 docs/system/hoon/zuse/mold/unce.md+8 docs/system/hoon/zuse/mold/upas.md+12 docs/system/hoon/zuse/mold/urge.md+7 docs/system/hoon/zuse/rsa.md+399
docs/system/hoon/library/src/1a/gate/add.mdnew file+39
@@ -0,0 +1,39 @@
1+### `++add`
2+
3+Add
4+
5+Produces the sum of `a` and `b`.
6+
7+Accepts
8+-------
9+
10+`a` is an [atom]().
11+
12+`b` is an atom.
13+
14+Produces
15+--------
16+
17+An atom.
18+
19+Source
20+------
21+
22+ ++ add :: add
23+ ~/ %add
24+ |= [a=@ b=@]
25+ ^- @
26+ ?: =(0 a) b
27+ $(a (dec a), b +(b))
28+
29+Examples
30+--------
31+
32+ ~zod/try=> (add 2 2)
33+ 4
34+ ~zod/try=> (add 1 1.000.000)
35+ 1.000.001
36+ ~zod/try=> (add 1.333 (mul 2 2))
37+ 1.337
38+
39+
docs/system/hoon/library/src/1a/gate/dec.mdnew file+40
@@ -0,0 +1,40 @@
1+### `++dec`
2+
3+Decrement
4+
5+Decrements `a` by `1`.
6+
7+Accepts
8+-------
9+
10+`a` is an [atom]().
11+
12+Produces
13+--------
14+
15+An atom.
16+
17+Source
18+------
19+
20+ ++ dec :: decrement
21+ ~/ %dec
22+ |= a=@
23+ ~| %decrement-underflow
24+ ?< =(0 a)
25+ =+ b=0
26+ |- ^- @
27+ ?: =(a +(b)) b
28+ $(b +(b))
29+ ::
30+
31+Examples
32+--------
33+
34+ ~zod/try=> (dec 7)
35+ 6
36+ ~zod/try=> (dec 0)
37+ ! decrement-underflow
38+ ! exit
39+
40+
docs/system/hoon/library/src/1a/gate/div.mdnew file+43
@@ -0,0 +1,43 @@
1+### `++div`
2+
3+Divide
4+
5+Computes `a` divided by `b`.
6+
7+Accepts
8+-------
9+
10+`a` is an [atom]().
11+
12+`b` is an [atom]().
13+
14+Produces
15+--------
16+
17+An atom.
18+
19+Source
20+------
21+
22+ ++ div :: divide
23+ ~/ %div
24+ |= [a=@ b=@]
25+ ^- @
26+ ~| 'div'
27+ ?< =(0 b)
28+ =+ c=0
29+ |-
30+ ?: (lth a b) c
31+ $(a (sub a b), c +(c))
32+ ::
33+
34+Examples
35+--------
36+
37+ ~zod/try=> (div 4 2)
38+ 2
39+ ~zod/try=> (div 17 8)
40+ 2
41+ ~zod/try=> (div 20 30)
42+ 0
43+
docs/system/hoon/library/src/1a/gate/gte.mdnew file+39
@@ -0,0 +1,39 @@
1+### `++gte`
2+
3+Greater-than/equal
4+
5+Tests whether `a` is greater than a number `b`.
6+
7+Accepts
8+-------
9+
10+`a` is an [atom]().
11+
12+`b` is an atom.
13+
14+Produces
15+--------
16+
17+A boolean.
18+
19+Source
20+------
21+
22+ ++ gte :: greater-equal
23+ ~/ %gte
24+ |= [a=@ b=@]
25+ ^- ?
26+ !(lth a b)
27+ ::
28+
29+Examples
30+--------
31+
32+ ~zod/try=> (gte 100 10)
33+ %.y
34+ ~zod/try=> (gte 4 4)
35+ %.y
36+ ~zod/try=> (gte 3 4)
37+ %.n
38+
39+
docs/system/hoon/library/src/1a/gate/gth.mdnew file+37
@@ -0,0 +1,37 @@
1+### `++gth`
2+
3+Greater-than
4+
5+Tests whether `a` is greater than `b`.
6+
7+Accepts
8+-------
9+
10+`a` is an [atom]().
11+
12+`b` is an atom.
13+
14+Produces
15+--------
16+
17+A boolean.
18+
19+Source
20+------
21+
22+ ++ gth :: greater-than
23+ ~/ %gth
24+ |= [a=@ b=@]
25+ ^- ?
26+ !(lte a b)
27+ ::
28+
29+Examples
30+--------
31+
32+ ~zod/try=> (gth 'd' 'c')
33+ %.y
34+ ~zod/try=> (gth ~h1 ~m61)
35+ %.n
36+
37+
docs/system/hoon/library/src/1a/gate/lte.mdnew file+40
@@ -0,0 +1,40 @@
1+### `++lte`
2+
3+Less-than/equal
4+
5+Tests whether `a` is less than or equal to `b`.
6+
7+Accepts
8+-------
9+
10+`a` is an [atom]().
11+
12+`b` is an atom.
13+
14+Produces
15+--------
16+
17+A boolean.
18+
19+Source
20+------
21+
22+ ++ lte :: less-equal
23+ ~/ %lte
24+ |= [a=@ b=@]
25+ |(=(a b) (lth a b))
26+ ::
27+
28+Examples
29+--------
30+
31+ ~zod/try=> (lte 4 5)
32+ %.y
33+ ~zod/try=> (lte 5 4)
34+ %.n
35+ ~zod/try=> (lte 5 5)
36+ %.y
37+ ~zod/try=> (lte 0 0)
38+ %.y
39+
40+
docs/system/hoon/library/src/1a/gate/lth.mdnew file+45
@@ -0,0 +1,45 @@
1+### `++lth`
2+
3+Less-than
4+
5+Tests whether `a` is less than `b`.
6+
7+Accepts
8+-------
9+
10+`a` is an [atom]().
11+
12+`b` is an atom.
13+
14+Produces
15+--------
16+
17+A boolean.
18+
19+Source
20+------
21+
22+ ++ lth :: less-than
23+ ~/ %lth
24+ |= [a=@ b=@]
25+ ^- ?
26+ ?& !=(a b)
27+ |-
28+ ?| =(0 a)
29+ ?& !=(0 b)
30+ $(a (dec a), b (dec b))
31+ == == ==
32+ ::
33+
34+Examples
35+--------
36+
37+ ~zod/try=> (lth 4 5)
38+ %.y
39+ ~zod/try=> (lth 5 4)
40+ %.n
41+ ~zod/try=> (lth 5 5)
42+ %.n
43+ ~zod/try=> (lth 5 0)
44+ %.n
45+
docs/system/hoon/library/src/1a/gate/max.mdnew file+40
@@ -0,0 +1,40 @@
1+### `++max`
2+
3+Maximum
4+
5+Computes the greater of `a` and `b`.
6+
7+Accepts
8+-------
9+
10+`a` is an [atom]().
11+
12+`b` is an atom.
13+
14+Produces
15+--------
16+
17+An atom.
18+
19+Source
20+------
21+
22+ ++ max :: maximum
23+ ~/ %max
24+ |= [a=@ b=@]
25+ ^- @
26+ ?: (gth a b) a
27+ b
28+ ::
29+
30+Examples
31+--------
32+
33+ ~zod/try=> (max 10 100)
34+ 100
35+ ~zod/try=> (max 10.443 9)
36+ 10.443
37+ ~zod/try=> (max 0 1)
38+ 1
39+
40+
docs/system/hoon/library/src/1a/gate/min.mdnew file+40
@@ -0,0 +1,40 @@
1+### `++min`
2+
3+Minimum
4+
5+Computes the lesser of `a` and `b`.
6+
7+Accepts
8+-------
9+
10+`a` is an [atom]().
11+
12+`b` is an atom.
13+
14+Produces
15+--------
16+
17+An atom.
18+
19+Source
20+------
21+
22+ ++ min :: minimum
23+ ~/ %min
24+ |= [a=@ b=@]
25+ ^- @
26+ ?: (lth a b) a
27+ b
28+ ::
29+
30+Examples
31+--------
32+
33+ ~zod/try=> (min 10 100)
34+ 10
35+ ~zod/try=> (min 10.443 9)
36+ 9
37+ ~zod/try=> (min 0 1)
38+ 0
39+
40+
docs/system/hoon/library/src/1a/gate/mod.mdnew file+38
@@ -0,0 +1,38 @@
1+### `++mod`
2+
3+Modulus
4+
5+Computes the remainder of dividing `a` by `b`.
6+
7+Accepts
8+-------
9+
10+`a` is an [atom]().
11+
12+`b` is an atom.
13+
14+Produces
15+--------
16+
17+An atom.
18+
19+Source
20+------
21+
22+ ++ mod :: remainder
23+ ~/ %mod
24+ |= [a=@ b=@]
25+ ^- @
26+ ?< =(0 b)
27+ (sub a (mul b (div a b)))
28+ ::
29+
30+Examples
31+--------
32+
33+ ~zod/try=> (mod 5 2)
34+ 1
35+ ~zod/try=> (mod 5 5)
36+ 0
37+
38+
docs/system/hoon/library/src/1a/gate/mul.mdnew file+40
@@ -0,0 +1,40 @@
1+### `++mul`
2+
3+Multiply
4+
5+Multiplies `a` by `b`.
6+
7+Accepts
8+-------
9+
10+`a` is an [atom]().
11+
12+`b` is an atom.
13+
14+Produces
15+--------
16+
17+An atom.
18+
19+Source
20+------
21+
22+ ++ mul :: multiply
23+ ~/ %mul
24+ |= [a=@ b=@]
25+ ^- @
26+ =+ c=0
27+ |-
28+ ?: =(0 a) c
29+ $(a (dec a), c (add b c))
30+ ::
31+
32+Examples
33+--------
34+
35+ ~zod/try=> (mul 3 4)
36+ 12
37+ ~zod/try=> (mul 0 1)
38+ 0
39+
40+
docs/system/hoon/library/src/1a/gate/sub.mdnew file+43
@@ -0,0 +1,43 @@
1+### `++sub`
2+
3+Subtract
4+
5+Subtracts `b` from `a`.
6+
7+Accepts
8+-------
9+
10+`a` is an [atom]().
11+
12+`b` is an [atom]().
13+
14+Produces
15+--------
16+
17+An atom.
18+
19+Source
20+------
21+
22+ ++ sub :: subtract
23+ ~/ %sub
24+ |= [a=@ b=@]
25+ ~| %subtract-underflow
26+ ^- @
27+ ?: =(0 b) a
28+ $(a (dec a), b (dec b))
29+
30+Examples
31+--------
32+
33+ ~zod/try=> (sub 10 5)
34+ 5
35+ ~zod/try=> (sub 243 44)
36+ 199
37+ ~zod/try=> (sub 5 0)
38+ 5
39+ ~zod/try=> (sub 0 5)
40+ ! subtract-underflow
41+ ! exit
42+
43+
docs/system/hoon/library/src/1a/title.mdnew file+1
@@ -0,0 +1 @@
1+## 1a: basic arithmetic
docs/system/hoon/library/src/1b/gate/cap.mdnew file+44
@@ -0,0 +1,44 @@
1+### `++cap`
2+
3+Tree head
4+
5+Tests whether an `a` is in the head or tail of a [noun](). Produces the
6+[cube]() `%2` if it is within the head, or the cube `%3` if it is
7+within the tail.
8+
9+Accepts
10+-------
11+
12+`a` is an atom.
13+
14+Produces
15+--------
16+
17+A [cube]().
18+
19+Source
20+------
21+
22+ ++ cap :: tree head
23+ ~/ %cap
24+ |= a=@
25+ ^- ?(%2 %3)
26+ ?- a
27+ %2 %2
28+ %3 %3
29+ ?(%0 %1) !!
30+ * $(a (div a 2))
31+ ==
32+ ::
33+
34+Examples
35+--------
36+
37+ ~zod/try=> (cap 4)
38+ %2
39+ ~zod/try=> (cap 6)
40+ %3
41+ ~zod/try=> (cap (add 10 9))
42+ %2
43+
44+
docs/system/hoon/library/src/1b/gate/mas.mdnew file+48
@@ -0,0 +1,48 @@
1+### `++mas`
2+
3+Axis within head/tail?
4+
5+Computes the axis of `a` within either the head or tail of a noun (depends whether `a` lies within the the head or tail).
6+
7+Accepts
8+-------
9+
10+`a` is an [atom]().
11+
12+Produces
13+--------
14+
15+An atom.
16+
17+Source
18+------
19+
20+ ++ mas :: tree body
21+ ~/ %mas
22+ |= a=@
23+ ^- @
24+ ?- a
25+ 1 !!
26+ 2 1
27+ 3 1
28+ * (add (mod a 2) (mul $(a (div a 2)) 2))
29+ ==
30+ ::
31+
32+Examples
33+--------
34+
35+ ~zod/try=> (mas 3)
36+ 1
37+ ~zod/try=> (mas 4)
38+ 2
39+ ~zod/try=> (mas 5)
40+ 3
41+ ~zod/try=> (mas 6)
42+ 2
43+ ~zod/try=> (mas 0)
44+ ! exit
45+ ~zod/try=> (mas 1)
46+ ! exit
47+
48+
docs/system/hoon/library/src/1b/gate/peg.mdnew file+44
@@ -0,0 +1,44 @@
1+### `++peg`
2+
3+Axis within axis
4+
5+Computes the axis of `b` within axis `a`.
6+
7+Accepts
8+-------
9+
10+`a` is an [atom]().
11+
12+`b` is an atom.
13+
14+Produces
15+--------
16+
17+An atom.
18+
19+Source
20+------
21+
22+ ++ peg :: tree connect
23+ ~/ %peg
24+ |= [a=@ b=@]
25+ ^- @
26+ ?- b
27+ 1 a
28+ 2 (mul a 2)
29+ 3 +((mul a 2))
30+ * (add (mod b 2) (mul $(b (div b 2)) 2))
31+ ==
32+ ::
33+
34+Examples
35+--------
36+
37+ ~zod/try=> (peg 4 1)
38+ 4
39+ ~zod/try=> (peg 4 2)
40+ 8
41+ ~zod/try=> (peg 8 45)
42+ 269
43+
44+
docs/system/hoon/library/src/1c/mold/bloq.mdnew file+20
@@ -0,0 +1,20 @@
1+### `++bloq`
2+
3+Blocksize
4+
5+Atom representing a blocksize, by convention expressed as a power of 2.
6+
7+
8+Source
9+------
10+
11+ ++ bloq ,@ :: blockclass
12+
13+Examples
14+--------
15+
16+ ~zod/try=> :: ++met measures how many bloqs long an atom is
17+ ~zod/try=> (met 3 256)
18+ 2
19+ ~zod/try=> :: 256 is 2 bloqs of 2^3
20+
docs/system/hoon/library/src/1c/mold/each.mdnew file+19
@@ -0,0 +1,19 @@
1+### `++each`
2+
3+Mold of fork between two
4+
5+[mold]() generator: produces a dicriminated [fork]() between two types.
6+
7+Source
8+------
9+
10+ ++ each |*([a=$+(* *) b=$+(* *)] $%([& p=a] [| p=b])) :: either a or b
11+
12+Examples
13+--------
14+
15+ ~zod/try=> :type; *(each cord time)
16+ [%.y p='']
17+ {[%.y p=@t] [%.n p=@da]}
18+
19+
docs/system/hoon/library/src/1c/mold/gate.mdnew file+29
@@ -0,0 +1,29 @@
1+### `++gate`
2+
3+Function
4+
5+A core with one arm, `$`--the empty name--which transforms a sample noun into a product
6+noun. If used [dryly]() as a type, the [subject]() must have a sample type of [`*`]().
7+
8+
9+Source
10+------
11+
12+ ++ gate $+(* *) :: general gate
13+
14+Examples
15+--------
16+
17+See also: [`++lift`](), [`++cork`]()
18+
19+ ~zod/try=> *gate
20+ <1|mws [* <101.jzo 1.ypj %164>]>
21+ ~zod/try=> `gate`|=(* 0)
22+ <1|mws [* <101.jzo 1.ypj %164>]>
23+
24+ ~zod/try=> (|=(a=* [a 'b']) 'c')
25+ [99 'b']
26+ ~zod/try=> (`gate`|=(a=* [a 'b']) 'c')
27+ [99 98]
28+
29+
docs/system/hoon/library/src/1c/mold/list.mdnew file+26
@@ -0,0 +1,26 @@
1+### `++list`
2+
3+List
4+
5+[mold]() generator. `++list` generates a mold of a null-termanated list of a
6+homogenous type.
7+
8+
9+Source
10+------
11+
12+ ++ list |* a=_,* :: null-term list
13+
14+Examples
15+--------
16+
17+See also: [`++turn`](), [`++snag`]()
18+
19+ ~zod/try=> *(list)
20+ ~
21+ ~zod/try=> `(list ,@)`"abc"
22+ ~[97 98 99]
23+ ~zod/try=> (snag 0 "abc")
24+ ~~a
25+
26+
docs/system/hoon/library/src/1c/mold/lone.mdnew file+12
@@ -0,0 +1,12 @@
1+### `++lone`
2+
3+Tile generator. `++lone` puts face of `p` on something.
4+
5+XX unused
6+
7+Source
8+------
9+
10+ ++ lone |*(a=$+(* *) ,p=a) :: just one thing
11+
12+
docs/system/hoon/library/src/1c/mold/pair.mdnew file+20
@@ -0,0 +1,20 @@
1+### `++pair`
2+
3+Mold of pair of types
4+
5+[mold]() generator. Produces a tuple of two of the types passed in.
6+
7+
8+Source
9+------
10+
11+ ++ pair |*([a=$+(* *) b=$+(* *)] ,[p=a q=b]) :: just a pair
12+
13+
14+Examples
15+--------
16+
17+ ~zod/try=> *(pair bean cord)
18+ [p=%.y q='']
19+
20+
docs/system/hoon/library/src/1c/mold/pole.mdnew file+18
@@ -0,0 +1,18 @@
1+### `++pole`
2+
3+Faceless list
4+
5+A [`++list`]() without the [face]()s `i` and `t`.
6+
7+Source
8+------
9+
10+ ++ pole |* a=_,* :: nameless list
11+
12+Examples
13+--------
14+
15+ ~zod/try=> `(pole char)`"asdf"
16+ [~~a [~~s [~~d [~~f ~]]]]
17+
18+
docs/system/hoon/library/src/1c/mold/qual.mdnew file+18
@@ -0,0 +1,18 @@
1+### `++qual`
2+
3+Mold of 4 type tuple
4+
5+A `++qual` is a tuple of four of the types passed in.
6+
7+Source
8+------
9+
10+ ++ qual |* [a=$+(* *) b=$+(* *) c=$+(* *) d=$+(* *)] :: just a quadruple
11+
12+Examples
13+--------
14+
15+ ~zod/try=> *(qual date time tape cord)
16+ [p=[[a=%.y y=0] m=0 t=[d=0 h=0 m=0 s=0 f=~]] q=~292277024401-.1.1 r="" s='']
17+
18+
docs/system/hoon/library/src/1c/mold/trap.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++trap`
2+
3+Core with one arm `$`
4+
5+A trap is a core with one arm `++$`. Used when XX
6+
7+Source
8+------
9+
10+ ++ trap ,_|.(_*) :: makes perfect sense
11+
12+Examples
13+--------
14+
15+See also: `|.`
16+
17+ ~zod/try=> *trap
18+ <1.mws 101.jzo 1.ypj %164>
19+ ~zod/try=> (*trap)
20+ 0
21+ ~zod/try=> (|.(42))
22+ 42
23+
24+
docs/system/hoon/library/src/1c/mold/tree.mdnew file+19
@@ -0,0 +1,19 @@
1+### `++tree`
2+
3+Tree mold generator
4+
5+A `++tree` can be empty, or contain a node of a type and
6+left/right sub `++tree` of the same type. Pretty-printed with `{}`.
7+
8+Source
9+------
10+
11+ ++ tree |* a=_,* :: binary tree
12+
13+Examples
14+--------
15+
16+ ~zod/try=> `(tree ,[@ tape])`[[1 "hi"] [[2 "bye"] ~ ~] ~]
17+ {[2 "bye"] [1 "hi"]}
18+
19+
docs/system/hoon/library/src/1c/mold/trel.mdnew file+18
@@ -0,0 +1,18 @@
1+### `++trel`
2+
3+Mold of three types
4+
5+[`++mold`]() of the tuple of the three types passed in.
6+
7+Source
8+------
9+
10+ ++ trel |* [a=$+(* *) b=$+(* *) c=$+(* *)] :: just a triple
11+
12+Examples
13+--------
14+
15+ ~zod/try=> *(trel ,@ud ,@t ,@s)
16+ [p=0 q='' r=--0]
17+
18+
docs/system/hoon/library/src/1c/mold/unit.mdnew file+25
@@ -0,0 +1,25 @@
1+### `++unit`
2+
3+Maybe
4+
5+[mold]() generator. A `++unit` is either `~` or `[~ u=a]` where `a` is the
6+type that was passed in.
7+
8+
9+Source
10+------
11+
12+ ++ unit |* a=_,* :: maybe
13+
14+Examples
15+--------
16+
17+See also: [`++bind`]()
18+
19+ ~zod/try=> :type; *(unit time)
20+ ~
21+ u(@da)
22+ ~zod/try=> `(unit time)`[~ -<-]
23+ [~ ~2014.9.24..19.25.10..7dd5]
24+
25+
docs/system/hoon/library/src/2a/gate/biff.mdnew file+36
@@ -0,0 +1,36 @@
1+### `++biff`
2+
3+Unit as argument
4+
5+Applies a function `b` that produces a unit to the unwrapped value of [++unit]()
6+`a` (`u.a`). If `a` is empty, `~` is produced.
7+
8+Accepts
9+-------
10+
11+`a` is a unit.
12+
13+`b` is a function that accepts a noun and produces a unit.
14+
15+Produces
16+--------
17+
18+A unit.
19+
20+Source
21+------
22+
23+ ++ biff :: apply
24+ |* [a=(unit) b=$+(* (unit))]
25+ ?~ a ~
26+ (b u.a)
27+
28+Examples
29+--------
30+
31+ ~zod/try=> (biff (some 5) |=(a=@ (some (add a 2))))
32+ [~ u=7]
33+ ~zod/try=> (biff ~ |=(a=@ (some (add a 2))))
34+ ~
35+
36+
docs/system/hoon/library/src/2a/gate/bind.mdnew file+38
@@ -0,0 +1,38 @@
1+### `++bind`
2+
3+Non-unit function to unit, producing unit
4+
5+Applies a function `b` to the value (`u.a`) of a [++unit]() `a`, producing
6+a unit. Used when you want a function that does not accept or produce a
7+unit to both accept and produce a unit.
8+
9+Accepts
10+-------
11+
12+`a` is a unit.
13+
14+`b` is a function.
15+
16+Produces
17+--------
18+
19+A unit.
20+
21+Source
22+------
23+
24+ ++ bind :: argue
25+ |* [a=(unit) b=gate]
26+ ?~ a ~
27+ [~ u=(b u.a)]
28+
29+Examples
30+--------
31+
32+ ~zod/try=> (bind ((unit ,@) [~ 97]) ,@t)
33+ [~ `a`]
34+ ~zod/try=> =a |=(a=@ (add a 1))
35+ ~zod/try=> (bind ((unit ,@) [~ 2]) a)
36+ [~ 3]
37+
38+
docs/system/hoon/library/src/2a/gate/bond.mdnew file+39
@@ -0,0 +1,39 @@
1+### `++bond`
2+
3+Replace null
4+
5+Replaces an empty [++unit]() `b` with the product of a called [trap]()
6+`a`. If the unit is not empty, then the original unit is produced.
7+
8+Accepts
9+-------
10+
11+`a` is a trap.
12+
13+`b` is a unit.
14+
15+Produces
16+--------
17+
18+Either the product of `a` or the value inside of unit `b`.
19+
20+Source
21+------
22+
23+ ++ bond :: replace
24+ |* a=trap
25+ |* b=(unit)
26+ ?~ b $:a
27+ u.b
28+
29+Examples
30+--------
31+
32+ ~zod/try=> (bex 10)
33+ 1.024
34+ ~zod/try=> ((bond |.((bex 10))) ~)
35+ 1.024
36+ ~zod/try=> ((bond |.((bex 10))) (slaw %ud '123'))
37+ 123
38+
39+
docs/system/hoon/library/src/2a/gate/both.mdnew file+37
@@ -0,0 +1,37 @@
1+### `++both`
2+
3+Group unit values into pair
4+
5+Produces `~` if either `a` or `b` are empty. Otherwise, produces a
6+[++unit]() whose value is a cell of the values of two input units `a` and
7+`b`.
8+
9+Accepts
10+-------
11+
12+`a` is a unit.
13+
14+`b` is a unit.
15+
16+Produces
17+--------
18+
19+A unit of the two initial values.
20+
21+Source
22+------
23+
24+ ++ both :: all the above
25+ |* [a=(unit) b=(unit)]
26+ ?~ a ~
27+ ?~ b ~
28+ [~ u=[u.a u.b]]
29+
30+Examples
31+--------
32+
33+ ~zod/try=> (both (some 1) (some %b))
34+ [~ u=[1 %b]]
35+ ~zod/try=> (both ~ (some %b))
36+ ~
37+
docs/system/hoon/library/src/2a/gate/clap.mdnew file+44
@@ -0,0 +1,44 @@
1+### `++clap`
2+
3+Apply function to two units
4+
5+Applies a binary function `c`--which does not usually accept or produce a [`++unit`]()--
6+to the values of two units, `a` and `b`, producing a unit.
7+
8+Accepts
9+-------
10+
11+`a` is a unit.
12+
13+`b` is a unit.
14+
15+`c` is a function that performs a binary operation.
16+
17+Produces
18+--------
19+
20+A unit.
21+
22+Source
23+------
24+
25+ ++ clap :: combine
26+ |* [a=(unit) b=(unit) c=_|=(^ +<-)]
27+ ?~ a b
28+ ?~ b a
29+ [~ u=(c u.a u.b)]
30+
31+Examples
32+--------
33+
34+ ~zod/try=> =u ((unit ,@t) [~ 'a'])
35+ ~zod/try=> =v ((unit ,@t) [~ 'b'])
36+ ~zod/try=> (clap u v |=([a=@t b=@t] (welp (trip a) (trip b))))
37+ [~ u="ab"]
38+ ~zod/try=> =a ((unit ,@u) [~ 1])
39+ ~zod/try=> =b ((unit ,@u) [~ 2])
40+ ~zod/try=> =c |=([a=@ b=@] (add a b))
41+ ~zod/try=> (clap a b c)
42+ [~ 3]
43+
44+
docs/system/hoon/library/src/2a/gate/drop.mdnew file+35
@@ -0,0 +1,35 @@
1+### `++drop`
2+
3+Unit to list
4+
5+Makes a [++list]() of the unwrapped value (`u.a`) of a [`++unit`]() `a`.
6+
7+Accepts
8+-------
9+
10+`a` is a unit.
11+
12+Produces
13+--------
14+
15+A list.
16+
17+Source
18+------
19+
20+ ++ drop :: enlist
21+ |* a=(unit)
22+ ?~ a ~
23+ [i=u.a t=~]
24+
25+Examples
26+--------
27+
28+ ~zod/try=> =a ((unit ,@) [~ 97])
29+ ~zod/try=> (drop a)
30+ [i=97 t=~]
31+ ~zod/try=> =a ((unit ,@) [~])
32+ ~zod/try=> (drop a)
33+ ~
34+
35+
docs/system/hoon/library/src/2a/gate/fall.mdnew file+34
@@ -0,0 +1,34 @@
1+### `++fall`
2+
3+Give unit a default value
4+
5+Produces a default value `b` for a [`++unit`]() `a` in cases where `a` is null.
6+
7+Accepts
8+-------
9+
10+`a` is a unit.
11+
12+`b` is a [noun]() that's used as the default value.
13+
14+Produces
15+--------
16+
17+Either a noun `b` or the unwrapped value of unit `a`.
18+
19+Source
20+------
21+
22+ ++ fall :: default
23+ |* [a=(unit) b=*]
24+ ?~(a b u.a)
25+
26+Examples
27+--------
28+
29+ ~zod/try=> (fall ~ `a`)
30+ `a`
31+ ~zod/try=> (fall [~ u=0] `a`)
32+ 0
33+
34+
docs/system/hoon/library/src/2a/gate/lift.mdnew file+37
@@ -0,0 +1,37 @@
1+### `++lift`
2+
3+Curried bind
4+
5+Accepts a [`++gate`]() `a` and produces a function that accepts [`++unit`]()
6+`b` to which it applies `a`. Used when you want a function that does not accept
7+or produce a unit to both accept and produce a unit.
8+
9+Accepts
10+-------
11+
12+`a` is a gate.
13+
14+`b` is a unit.
15+
16+Produces
17+--------
18+
19+A unit.
20+
21+Source
22+------
23+
24+ ++ lift :: lift gate (fmap)
25+ |* a=gate :: flipped
26+ |* b=(unit) :: curried
27+ (bind b a) :: bind
28+
29+Examples
30+--------
31+
32+ ~zod/try=> ((lift dec) `(unit ,@)`~)
33+ ~
34+ ~zod/try=> ((lift dec) `(unit ,@)`[~ 20])
35+ [~ 19]
36+
37+
docs/system/hoon/library/src/2a/gate/mate.mdnew file+49
@@ -0,0 +1,49 @@
1+### `++mate`
2+
3+Choose
4+
5+Accepts two units `a` and `b` whose values are expected to be
6+equivalent. If either is empty, then the value of the other is produced.
7+If neither are empty, it asserts that both values are the same and
8+produces that value. If the assertion fails, `++mate` crashes with
9+`'mate'` in the stack trace.
10+
11+Accepts
12+-------
13+
14+`a` is a unit.
15+
16+`b` is a unit.
17+
18+Produces
19+--------
20+
21+A unit or crash.
22+
23+Source
24+------
25+
26+++ mate :: choose
27+ |* [a=(unit) b=(unit)]
28+ ?~ b a
29+ ?~ a b
30+ ?.(=(u.a u.b) ~|('mate' !!) a)
31+
32+Examples
33+--------
34+
35+ ~zod/try=> =a ((unit ,@) [~ 97])
36+ ~zod/try=> =b ((unit ,@) [~ 97])
37+ ~zod/try=> (mate a b)
38+ [~ 97]
39+ ~zod/try=> =a ((unit ,@) [~ 97])
40+ ~zod/try=> =b ((unit ,@) [~])
41+ ~zod/try=> (mate a b)
42+ [~ 97]
43+ ~zod/try=> =a ((unit ,@) [~ 97])
44+ ~zod/try=> =b ((unit ,@) [~ 98])
45+ ~zod/try=> (mate a b)
46+ ! 'mate'
47+ ! exit
48+
49+
docs/system/hoon/library/src/2a/gate/need.mdnew file+38
@@ -0,0 +1,38 @@
1+### `++need`
2+
3+Unwrap unit
4+
5+Retrieve the value from a [`++unit`]() and crash if the unit is null.
6+
7+Accepts
8+-------
9+
10+`a` is a unit.
11+
12+Produces
13+--------
14+
15+Either the unwrapped value of `a` (`u.a`), or crash.
16+
17+Source
18+------
19+
20+ ++ need :: demand
21+ |* a=(unit)
22+ ?~ a !!
23+ u.a
24+
25+Examples
26+--------
27+
28+ ~zod/try=> =a ((unit ,[@t @t]) [~ ['a' 'b']])
29+ ~zod/try=> (need a)
30+ ['a' 'b']
31+ ~zod/try=> =a ((unit ,@ud) [~ 17])
32+ ~zod/try=> (need a)
33+ 17
34+ ~zod/try=> =a ((unit ,@) [~])
35+ ~zod/try=> (need a)
36+ ! exit
37+
38+
docs/system/hoon/library/src/2a/gate/some.mdnew file+32
@@ -0,0 +1,32 @@
1+### `++some`
2+
3+Wrap value in a unit
4+
5+Takes any atom `a` and produces a [`++unit`]() with the value set to `a`.
6+
7+Accepts
8+-------
9+
10+`a` is a [noun]().
11+
12+Produces
13+--------
14+
15+A unit.
16+
17+Source
18+------
19+
20+ ++ some :: lift (pure)
21+ |* a=*
22+ [~ u=a]
23+
24+Examples
25+--------
26+
27+ ~zod/try=> (some [`a` `b`])
28+ [~ u=[`a` `b`]]
29+ ~zod/try=> (some &)
30+ [~ u=%.y]
31+
32+
docs/system/hoon/library/src/2b/gate/flop.mdnew file+38
@@ -0,0 +1,38 @@
1+Reverse
2+
3+### `++flop`
4+
5+Produces the list `a` in reverse order.
6+
7+Accepts
8+-------
9+
10+`a` is a list.
11+
12+Produces
13+--------
14+
15+A list.
16+
17+Source
18+------
19+
20+ ++ flop :: reverse
21+ ~/ %flop
22+ |* a=(list)
23+ => .(a (homo a))
24+ ^+ a
25+ =+ b=`_a`~
26+ |-
27+ ?~ a b
28+ $(a t.a, b [i.a b])
29+
30+
31+Examples
32+--------
33+
34+ ~zod/try=> =a (limo [1 2 3 ~])
35+ ~zod/try=> (flop a)
36+ ~[3 2 1]
37+
38+
docs/system/hoon/library/src/2b/gate/homo.mdnew file+41
@@ -0,0 +1,41 @@
1+### `++homo`
2+
3+Homogenize
4+
5+Produces a [`++list`]() whose type is a fork of all the contained types in the
6+list `a`. Used when you want to make all the types of the elements of a list the same.
7+
8+Accepts
9+-------
10+
11+`a` is a list.
12+
13+Produces
14+--------
15+
16+a list.
17+
18+Source
19+------
20+
21+ ++ homo :: homogenize
22+ |* a=(list)
23+ ^+ =< $
24+ |% +- $ ?:(_? ~ [i=(snag 0 a) t=$])
25+ --
26+ a
27+
28+Examples
29+--------
30+
31+ ~zod/try=> lyst
32+ [i=1 t=[i=97 t=[i=2 t=[i=98 t=[i=[~ u=10] t=~]]]]]
33+ ~zod/try=> (homo lyst)
34+ ~[1 97 2 98 [~ u=10]]
35+ ~zod/try=> =a (limo [1 2 3 ~])
36+ ~zod/try=> a
37+ [i=1 t=[i=2 t=[i=3 t=~]]]
38+ ~zod/try=> (homo a)
39+ ~[1 2 3]
40+
41+
docs/system/hoon/library/src/2b/gate/lent.mdnew file+37
@@ -0,0 +1,37 @@
1+### `++lent`
2+
3+List length
4+
5+Produces the length of any [`++list`]() `a` as an atom.
6+
7+Accepts
8+-------
9+
10+`a` is a list.
11+
12+Produces
13+--------
14+
15+an atom.
16+
17+Source
18+------
19+
20+ ++ lent :: length
21+ ~/ %lent
22+ |= a=(list)
23+ ^- @
24+ =+ b=0
25+ |-
26+ ?~ a b
27+ $(a t.a, b +(b))
28+
29+Examples
30+--------
31+
32+ ~zod/try=> (lent (limo [1 2 3 4 ~]))
33+ 4
34+ ~zod/try=> (lent (limo [1 'a' 2 'b' (some 10) ~]))
35+ 5
36+
37+
docs/system/hoon/library/src/2b/gate/levy.mdnew file+38
@@ -0,0 +1,38 @@
1+### `++levy`
2+
3+Logical "and" on list
4+
5+Computes the Boolean logical "and" on the results of [gate]() `b` applied to each individual element in [`++list`]() `a`.
6+
7+Accepts
8+-------
9+
10+`a` is a list.
11+
12+`b` is a gate.
13+
14+Produces
15+--------
16+
17+Source
18+------
19+
20+ ++ levy
21+ ~/ %levy :: all of
22+ |* [a=(list) b=_|=(p=* .?(p))]
23+ |- ^- ?
24+ ?~ a &
25+ ?. (b i.a) |
26+ $(a t.a)
27+
28+Examples
29+--------
30+
31+ ~zod/try=> =a |=(a=@ (lte a 1))
32+ ~zod/try=> (levy (limo [0 1 2 1 ~]) a)
33+ %.n
34+ ~zod/try=> =a |=(a=@ (lte a 3))
35+ ~zod/try=> (levy (limo [0 1 2 1 ~]) a)
36+ %.y
37+
38+
docs/system/hoon/library/src/2b/gate/lien.mdnew file+26
@@ -0,0 +1,26 @@
1+### `++lien`
2+
3+Logical "or" on list
4+
5+ ++ lien :: some of
6+ ~/ %lien
7+ |* [a=(list) b=$+(* ?)]
8+ |- ^- ?
9+ ?~ a |
10+ ?: (b i.a) &
11+ $(a t.a)
12+
13+Computes the Boolean logical "or" on the results of applying [gate]() `b` to every element of [`++list`]() `a`.
14+
15+`a` is a list.
16+
17+`b` is a gate.
18+
19+ ~zod/try=> =a |=(a=@ (gte a 1))
20+ ~zod/try=> (lien (limo [0 1 2 1 ~]) a)
21+ %.y
22+ ~zod/try=> =a |=(a=@ (gte a 3))
23+ ~zod/try=> (lien (limo [0 1 2 1 ~]) a)
24+ %.n
25+
26+
docs/system/hoon/library/src/2b/gate/limo.mdnew file+33
@@ -0,0 +1,33 @@
1+### `++limo`
2+
3+List Constructor
4+
5+Turns a null-terminated tuple into a [`++list`]().
6+
7+Accepts
8+-------
9+
10+`a` is a null-terminated tuple.
11+
12+Produces
13+--------
14+
15+A list
16+
17+Source
18+------
19+
20+ ++ limo :: listify
21+ |* a=*
22+ ^+ =< $
23+ |% +- $ ?~(a ~ ?:(_? i=-.a t=$ $(a +.a)))
24+ --
25+ a
26+
27+Examples
28+--------
29+
30+ ~zod/try=> (limo [1 2 3 ~])
31+ [i=1 t=[i=2 t=[i=3 t=~]]]
32+
33+
docs/system/hoon/library/src/2b/gate/murn.mdnew file+40
@@ -0,0 +1,40 @@
1+### `++murn`
2+
3+Maybe transform
4+
5+Passes each member of [`++list`]() `a` to [gate]() `b`, which must produce a
6+[`++unit`](). Produces a new list with all the results that do not produce
7+`~`.
8+
9+Accepts
10+-------
11+
12+`a` is a [list]().
13+
14+`b` is a [gate]() that produces a [unit]().
15+
16+Produces
17+--------
18+
19+A unit.
20+
21+Source
22+------
23+
24+ ++ murn :: maybe transform
25+ |* [a=(list) b=$+(* (unit))]
26+ |-
27+ ?~ a ~
28+ =+ c=(b i.a)
29+ ?~ c
30+ $(a t.a)
31+ [i=u.c t=$(a t.a)]
32+
33+Examples
34+--------
35+
36+ ~zod/try=> =a |=(a=@ ?.((gte a 2) ~ (some (add a 10))))
37+ ~zod/try=> (murn (limo [0 1 2 3 ~]) a)
38+ [i=12 t=[i=13 t=~]]
39+
40+
docs/system/hoon/library/src/2b/gate/reap.mdnew file+36
@@ -0,0 +1,36 @@
1+### `++reap`
2+
3+Replicate
4+
5+Replicate: produces a [`++list`]() containing `a` copies of `b`.
6+
7+Accepts
8+-------
9+
10+`b` is a [noun]()
11+
12+Produces
13+--------
14+
15+A list.
16+
17+Source
18+------
19+
20+ ++ reap :: replicate
21+ |* [a=@ b=*]
22+ |- ^- (list ,_b)
23+ ?~ a ~
24+ [b $(a (dec a))]
25+
26+Examples
27+--------
28+
29+ ~zod/try=> (reap 20 %a)
30+ ~[%a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a]
31+ ~zod/try=> (reap 5 ~s1)
32+ ~[~s1 ~s1 ~s1 ~s1 ~s1]
33+ ~zod/try=> `@dr`(roll (reap 5 ~s1) add)
34+ ~s5
35+
36+
docs/system/hoon/library/src/2b/gate/reel.mdnew file+43
@@ -0,0 +1,43 @@
1+### `++reel`
2+
3+Right fold
4+
5+Right fold: moves right to left across a [`++list`]() `a`, recursively slamming
6+a binary [gate]() `b` with an element from `a` and an accumulator, producing
7+the final value of the accumulator.
8+
9+Accepts
10+-------
11+
12+`b` is a binary gate.
13+
14+Produces
15+--------
16+
17+The accumulator, which is a [noun]().
18+
19+Source
20+------
21+
22+ ++ reel :: right fold
23+ ~/ %reel
24+ |* [a=(list) b=_|=([* *] +<+)]
25+ |- ^+ +<+.b
26+ ?~ a
27+ +<+.b
28+ (b i.a $(a t.a))
29+
30+Examples
31+--------
32+
33+ ~zod/try=> =sum =|([p=@ q=@] |.((add p q)))
34+ ~zod/try=> (reel (limo [1 2 3 4 5 ~]) sum)
35+ 15
36+ ~zod/try=> =a =|([p=@ q=@] |.((sub p q)))
37+ ~zod/try=> (reel (limo [6 3 1 ~]) a)
38+ 4
39+ ~zod/try=> (reel (limo [3 6 1 ~]) a)
40+ ! subtract-underflow
41+ ! exit
42+
43+
docs/system/hoon/library/src/2b/gate/roll.mdnew file+43
@@ -0,0 +1,43 @@
1+### `++roll`
2+
3+Left fold
4+
5+Left fold: moves left to right across a list `a`, recursively slamming a
6+binary [gate]() `b` with an element from the [`++list`]() and an accumulator,
7+producing the final value of the accumulator.
8+
9+Accepts
10+-------
11+
12+`b` is a binary [gate]().
13+
14+Produces
15+--------
16+
17+The accumulator, which is a [noun]().
18+
19+Source
20+------
21+
22+ ++ roll :: left fold
23+ ~/ %roll
24+ |* [a=(list) b=_|=([* *] +<+)]
25+ |- ^+ +<+.b
26+ ?~ a
27+ +<+.b
28+ $(a t.a, b b(+<+ (b i.a +<+.b)))
29+
30+Examples
31+--------
32+
33+ ~zod/try=> =sum =|([p=@ q=@] |.((add p q)))
34+ ~zod/try=> (roll (limo [1 2 3 4 5 ~]) sum)
35+ q=15
36+ ~zod/try=> =a =|([p=@ q=@] |.((sub p q)))
37+ ~zod/try=> (roll (limo [6 3 1 ~]) a)
38+ ! subtract-underflow
39+ ! exit
40+ ~zod/try=> (roll (limo [1 3 6 ~]) a)
41+ q=4
42+
43+
docs/system/hoon/library/src/2b/gate/scag.mdnew file+36
@@ -0,0 +1,36 @@
1+### `++scag`
2+
3+Prefix
4+
5+Accepts an atom `a` and [list]() `b`, producing the first `a` elements of
6+the front of the list.
7+
8+Accepts
9+-------
10+
11+`b` is a list.
12+
13+Produces
14+--------
15+
16+A list of the same type as `b`.
17+
18+Source
19+------
20+
21+ ++ scag :: prefix
22+ ~/ %scag
23+ |* [a=@ b=(list)]
24+ |- ^+ b
25+ ?: |(?=(~ b) =(0 a)) ~
26+ [i.b $(b t.b, a (dec a))]
27+
28+Examples
29+--------
30+
31+ ~zod/try=> (scag 2 (limo [0 1 2 3 ~]))
32+ [i=0 t=[i=1 t=~]]
33+ ~zod/try=> (scag 10 (limo [1 2 3 4 ~]))
34+ [i=1 t=[i=2 t=[i=3 t=[i=4 t=~]]]]
35+
36+
docs/system/hoon/library/src/2b/gate/skid.mdnew file+36
@@ -0,0 +1,36 @@
1+### `++skid`
2+
3+Separate
4+
5+Separates a [`++list`]() `a` into two lists - Those elements of `a` who produce
6+true when slammed to [gate]() `b` and those who produce `%.n`.
7+
8+Accepts
9+-------
10+
11+`b` is a gate that accepts one argument and produces a loobean.
12+
13+Produces
14+--------
15+
16+A cell of two lists.
17+
18+Source
19+------
20+
21+ ++ skid :: separate
22+ |* [a=(list) b=$+(* ?)]
23+ |- ^+ [p=a q=a]
24+ ?~ a [~ ~]
25+ =+ c=$(a t.a)
26+ ?:((b i.a) [[i.a p.c] q.c] [p.c [i.a q.c]])
27+
28+
29+Examples
30+--------
31+
32+ ~zod/try=> =a |=(a=@ (gth a 1))
33+ ~zod/try=> (skid (limo [0 1 2 3 ~]) a)
34+ [p=[i=2 t=[i=3 t=~]] q=[i=0 t=[i=1 t=~]]]
35+
36+
docs/system/hoon/library/src/2b/gate/skim.mdnew file+35
@@ -0,0 +1,35 @@
1+### `++skim`
2+
3+Suffix
4+
5+Cycles through the members of a list `a`, passing them to a gate `b` and
6+producing a list of all of the members that produce `%.y`. Inverse of
7+`++skip`.
8+
9+Accepts
10+-------
11+
12+`b` is a [gate]() that accepts one argument and produces a loobean.
13+
14+Produces
15+--------
16+
17+Source
18+------
19+
20+++ skim :: only
21+ ~/ %skim
22+ |* [a=(list) b=_|=(p=* .?(p))]
23+ |-
24+ ^+ a`
25+ ?~ a ~
26+ ?:((b i.a) [i.a $(a t.a)] $(a t.a))
27+
28+Examples
29+--------
30+
31+ ~zod/try=> =a |=(a=@ (gth a 1))
32+ ~zod/try=> (skim (limo [0 1 2 3 ~]) a)
33+ [i=2 t=[i=3 t=~]]
34+
35+
docs/system/hoon/library/src/2b/gate/skip.mdnew file+37
@@ -0,0 +1,37 @@
1+### `++skip`
2+
3+Except
4+
5+Cycles through the members of [`++list`]() `a`, passing them to a [gate]() `b`.
6+Produces a list of all of the members that produce `%.n`. Inverse of
7+`++skim`.
8+
9+Accepts
10+-------
11+
12+`b` is a [gate]() that accepts one argument and produces a loobean.
13+
14+Produces
15+--------
16+
17+A list of the same type as `a`.
18+
19+Source
20+------
21+
22+ ++ skip :: except
23+ ~/ %skip
24+ |* [a=(list) b=_|=(p=* .?(p))]
25+ |-
26+ ^+ a
27+ ?~ a ~
28+ ?:((b i.a) $(a t.a) [i.a $(a t.a)])
29+
30+Examples
31+--------
32+
33+ ~zod/try=> =a |=(a=@ (gth a 1))
34+ ~zod/try=> (skip (limo [0 1 2 3 ~]) a)
35+ [i=0 t=[i=1 t=~]]
36+
37+
docs/system/hoon/library/src/2b/gate/slag.mdnew file+37
@@ -0,0 +1,37 @@
1+### `++slag`
2+
3+Suffix
4+
5+Accepts an atom `a` and list `b`, producing the remaining elements from
6+`b` starting at `a`.
7+
8+Accepts
9+-------
10+
11+`b` is a [list]().
12+
13+Produces
14+--------
15+
16+A list of the same type as `b`.
17+
18+Source
19+------
20+
21+ ++ slag :: suffix
22+ ~/ %slag
23+ |* [a=@ b=(list)]
24+ |- ^+ b
25+ ?: =(0 a) b
26+ ?~ b ~
27+ $(b t.b, a (dec a))
28+
29+Examples
30+--------
31+
32+ ~zod/try=> (slag 2 (limo [1 2 3 4 ~]))
33+ [i=3 t=[i=4 t=~]]
34+ ~zod/try=> (slag 1 (limo [1 2 3 4 ~]))
35+ [i=2 t=[i=3 t=[i=4 t=~]]]
36+
37+
docs/system/hoon/library/src/2b/gate/snag.mdnew file+38
@@ -0,0 +1,38 @@
1+### `++snag`
2+
3+Index
4+
5+Accepts an atom `a` and a [`++list`]() `b`, producing the element at the index
6+of `a`and failing if the list is null. Lists are 0-indexed.
7+
8+Accepts
9+-------
10+
11+`b` is a [list]().
12+
13+Produces
14+--------
15+
16+Produces an element of `b`, or crashes if no element exists at that index.
17+
18+Source
19+------
20+
21+ ++ snag :: index
22+ ~/ %snag
23+ |* [a=@ b=(list)]
24+ |-
25+ ?~ b
26+ ~|('snag-fail' !!)
27+ ?: =(0 a) i.b
28+ $(b t.b, a (dec a))
29+
30+Examples
31+--------
32+
33+ ~zod/try=> (snag 2 "asdf")
34+ ~~d
35+ ~zod/try=> (snag 0 `(list ,@ud)`~[1 2 3 4])
36+ 1
37+
38+
docs/system/hoon/library/src/2b/gate/sort.mdnew file+40
@@ -0,0 +1,40 @@
1+### `++sort`
2+
3+Quicksort
4+
5+Quicksort: accepts a [`++list`]() `a` and a [gate]() `b` which accepts two nouns and
6+produces a loobean. `++sort` then produces a list of the elements of `a`,
7+sorted according to `b`.
8+
9+Accepts
10+-------
11+
12+`b` is a gate that ccepts two nouns and produces a boolean.
13+
14+Produces
15+--------
16+
17+A list
18+
19+Source
20+------
21+
22+ ++ sort :: quicksort
23+ ~/ %sort
24+ |* [a=(list) b=$+([* *] ?)]
25+ => .(a ^.(homo a))
26+ |- ^+ a
27+ ?~ a ~
28+ %+ weld
29+ $(a (skim t.a |=(c=_i.a (b c i.a))))
30+ ^+ t.a
31+ [i.a $(a (skim t.a |=(c=_i.a !(b c i.a))))]
32+
33+Examples
34+--------
35+
36+ ~zod/try=> =a =|([p=@ q=@] |.((gth p q)))
37+ ~zod/try=> (sort (limo [0 1 2 3 ~]) a)
38+ ~[3 2 1 0]
39+
40+
docs/system/hoon/library/src/2b/gate/swag.mdnew file+33
@@ -0,0 +1,33 @@
1+### `++swag`
2+
3+Infix
4+
5+Similar to `substr` in Javascript: extracts a string infix, beginning at
6+inclusive index `a`, producing `b` number of characters.
7+
8+Accepts
9+-------
10+
11+`c` is a [list]().
12+
13+Produces
14+--------
15+
16+A list of the same type as `c`.
17+
18+Source
19+------
20+
21+ ++ swag :: infix
22+ |* [[a=@ b=@] c=(list)]
23+ (scag b (slag a c))
24+
25+Examples
26+--------
27+
28+ ~zod/try=> (swag [2 5] "roly poly")
29+ "ly po"
30+ ~zod/try=> (swag [2 2] (limo [1 2 3 4 ~]))
31+ [i=3 t=[i=4 t=~]]
32+
33+
docs/system/hoon/library/src/2b/gate/turn.mdnew file+37
@@ -0,0 +1,37 @@
1+### `++turn`
2+
3+Gate to list
4+
5+Accepts a [`++list`]() `a` and a [gate]() `b`. Produces a list with the gate applied
6+to each element of the original list.
7+
8+Accepts
9+-------
10+
11+`b` is a gate.
12+
13+Produces
14+--------
15+
16+A list.
17+
18+Source
19+------
20+
21+ ++ turn :: transform
22+ ~/ %turn
23+ |* [a=(list) b=_,*]
24+ |-
25+ ?~ a ~
26+ [i=(b i.a) t=$(a t.a)]
27+
28+Examples
29+--------
30+
31+ ~zod/try=> (turn (limo [104 111 111 110 ~]) ,@t)
32+ <|h o o n|>
33+ ~zod/try=> =a |=(a=@ (add a 4))
34+ ~zod/try=> (turn (limo [1 2 3 4 ~]) a)
35+ ~[5 6 7 8]
36+
37+
docs/system/hoon/library/src/2b/gate/weld.mdnew file+31
@@ -0,0 +1,31 @@
1+### `++weld`
2+
3+Concatenate
4+
5+Concatenate two [`++list`]()s `a` and `b`.
6+
7+Accepts
8+-------
9+
10+`a` and `b` are [list]()s.
11+
12+Source
13+------
14+
15+ ++ weld :: concatenate
16+ ~/ %weld
17+ |* [a=(list) b=(list)]
18+ => .(a ^.(homo a), b ^.(homo b))
19+ |- ^+ b
20+ ?~ a b
21+ [i.a $(a t.a)]
22+
23+Examples
24+--------
25+
26+ ~zod/try=> (weld "urb" "it")
27+ ~[~~u ~~r ~~b ~~i ~~t]
28+ ~zod/try=> (weld (limo [1 2 ~]) (limo [3 4 ~]))
29+ ~[1 2 3 4]
30+
31+
docs/system/hoon/library/src/2b/gate/welp.mdnew file+45
@@ -0,0 +1,45 @@
1+### `++welp`
2+
3+Perfect weld
4+
5+Concatenate two [`++list`]()s `a` and `b` without losing their type information
6+to homogenization.
7+
8+Accepts
9+-------
10+
11+`a` is a list.
12+
13+`b` is a list.
14+
15+Produces
16+--------
17+
18+A list.
19+
20+Source
21+------
22+
23+ ++ welp :: perfect weld
24+ =| [* *]
25+ |%
26+ +- $
27+ ?~ +<-
28+ +<-(. +<+)
29+ +<-(+ $(+<- +<->))
30+ --
31+
32+Examples
33+--------
34+
35+ ~zod/try=> (welp "foo" "bar")
36+ "foobar"
37+ ~zod/arvo=/hoon/hoon> (welp ~[60 61 62] ~[%a %b %c])
38+ [60 61 62 %a %b %c ~]
39+ ~zod/arvo=/hoon/hoon> :type; (welp ~[60 61 62] ~[%a %b %c])
40+ [60 61 62 %a %b %c ~]
41+ [@ud @ud @ud %a %b %c %~]
42+ ~zod/arvo=/hoon/hoon> (welp [sa/1 so/2 ~] si/3)
43+ [[%sa 1] [%so 2] %si 3]
44+
45+
docs/system/hoon/library/src/2b/gate/zing.mdnew file+37
@@ -0,0 +1,37 @@
1+### `++zing`
2+
3+Cons
4+
5+Turns a [`++list`]() of lists into a single list by promoting the elements of
6+each sublist into the higher.
7+
8+Accepts
9+-------
10+
11+A list of lists.
12+
13+Produces
14+--------
15+
16+A list.
17+
18+Source
19+------
20+
21+ ++ zing :: promote
22+ =| *
23+ |%
24+ +- $
25+ ?~ +<
26+ +<
27+ (welp +<- $(+< +<+))
28+ --
29+
30+Examples
31+--------
32+
33+ ~zod/try=> (zing (limo [(limo ['a' 'b' 'c' ~]) (limo ['e' 'f' 'g' ~]) (limo ['h' 'i' 'j' ~]) ~]))
34+ ~['a' 'b' 'c' 'e' 'f' 'g' 'h' 'i' 'j']
35+ ~zod/try=> (zing (limo [(limo [1 'a' 2 'b' ~]) (limo [3 'c' 4 'd' ~]) ~]))
36+ ~[1 97 2 98 3 99 4 100]
37+
docs/system/hoon/library/src/2c/gate/bex.mdnew file+37
@@ -0,0 +1,37 @@
1+### `++bex`
2+
3+Binary exponent
4+
5+Computes the result of `2^a`, producing an [atom]().
6+
7+Accepts
8+-------
9+
10+`a` is an atom.
11+
12+Produces
13+--------
14+
15+An atom.
16+
17+Source
18+------
19+
20+ ++ bex :: binary exponent
21+ ~/ %bex
22+ |= a=@
23+ ^- @
24+ ?: =(0 a) 1
25+ (mul 2 $(a (dec a)))
26+
27+Examples
28+--------
29+
30+ ~zod/try=> (bex 4)
31+ 16
32+ ~zod/try=> (bex (add 19 1))
33+ 1.048.576
34+ ~zod/try=> (bex 0)
35+ 1
36+
37+
docs/system/hoon/library/src/2c/gate/can.mdnew file+47
@@ -0,0 +1,47 @@
1+
2+### `++can`
3+
4+Assemble
5+
6+Produces an [atom]() from a list `b` of length-value pairs `p` and `q`,
7+where `p` is the length in bloqs of size `a`, and `q` is an atomic
8+value.
9+
10+Accepts
11+-------
12+
13+`a` is a block size (see [`++bloq`]()).
14+
15+`b` is a [`++list`]() of length value pairs, `p` and `q`.
16+
17+Produces
18+--------
19+
20+An atom.
21+
22+Source
23+------
24+
25+ ++ can :: assemble
26+ ~/ %can
27+ |= [a=bloq b=(list ,[p=@ q=@])]
28+ ^- @
29+ ?~ b 0
30+ (mix (end a p.i.b q.i.b) (lsh a p.i.b $(b t.b)))
31+
32+Examples
33+--------
34+
35+ ~zod/try=> `@ub`(can 3 ~[[1 1]])
36+ 0b1
37+ ~zod/try=> `@ub`(can 0 ~[[1 255]])
38+ 0b1
39+ ~zod/try=> `@ux`(can 3 [3 0xc1] [1 0xa] ~)
40+ 0xa00.00c1
41+ ~zod/try=> `@ux`(can 3 [3 0xc1] [1 0xa] [1 0x23] ~)
42+ 0x23.0a00.00c1
43+ ~zod/try=> `@ux`(can 4 [3 0xc1] [1 0xa] [1 0x23] ~)
44+ 0x23.000a.0000.0000.00c1
45+ ~zod/try=> `@ux`(can 3 ~[[1 'a'] [2 'bc']])
46+ 0x63.6261
47+
docs/system/hoon/library/src/2c/gate/cat.mdnew file+52
@@ -0,0 +1,52 @@
1+### `++cat`
2+
3+Concatenate
4+
5+Concatenates two [atom]()s, `b` and `c`, according to bloq size `a`, producing an
6+atom.
7+
8+Accepts
9+-------
10+
11+`a` is a block size (see [`++bloq`]()).
12+
13+`b` is an atom.
14+
15+`c` is an atom.
16+
17+Produces
18+--------
19+
20+An atom.
21+
22+Source
23+------
24+
25+ ++ cat :: concatenate
26+ ~/ %cat
27+ |= [a=bloq b=@ c=@]
28+ (add (lsh a (met a b) c) b)
29+
30+Examples
31+--------
32+
33+ ~zod/try=> `@ub`(cat 3 1 0)
34+ 0b1
35+ ~zod/try=> `@ub`(cat 0 1 1)
36+ 0b11
37+ ~zod/try=> `@ub`(cat 0 2 1)
38+ 0b110
39+ ~zod/try=> `@ub`(cat 2 1 1)
40+ 0b1.0001
41+ ~zod/try=> `@ub`256
42+ 0b1.0000.0000
43+ ~zod/try=> `@ub`255
44+ 0b1111.1111
45+ ~zod/try=> `@ub`(cat 3 256 255)
46+ 0b1111.1111.0000.0001.0000.0000
47+ ~zod/try=> `@ub`(cat 2 256 255)
48+ 0b1111.1111.0001.0000.0000
49+ ~zod/try=> (cat 3 256 255)
50+ 16.711.936
51+
52+
docs/system/hoon/library/src/2c/gate/cut.mdnew file+49
@@ -0,0 +1,49 @@
1+### `++cut`
2+
3+Slice
4+
5+Slices `c` blocks of size `a` that are `b` blocks from the end of `d`.
6+
7+Accepts
8+-------
9+
10+`a` is a block size (see [++bloq]()).
11+
12+`b` is an [atom]().
13+
14+`c` is an atom.
15+
16+Produces
17+--------
18+
19+An atom.
20+
21+Source
22+------
23+
24+ ++ cut :: slice
25+ ~/ %cut
26+ |= [a=bloq [b=@ c=@] d=@]
27+ (end a c (rsh a b d))
28+
29+Examples
30+--------
31+
32+ ~zod/try=> (cut 0 [1 1] 2)
33+ 1
34+ ~zod/try=> (cut 0 [2 1] 4)
35+ 1
36+ ~zod/try=> `@t`(cut 3 [0 3] 'abcdefgh')
37+ 'abc'
38+ ~zod/try=> `@t`(cut 3 [1 3] 'abcdefgh')
39+ 'bcd'
40+ ~zod/try=> `@ub`(cut 0 [0 3] 0b1111.0000.1101)
41+ 0b101
42+ ~zod/try=> `@ub`(cut 0 [0 6] 0b1111.0000.1101)
43+ 0b1101
44+ ~zod/try=> `@ub`(cut 0 [4 6] 0b1111.0000.1101)
45+ 0b11.0000
46+ ~zod/try=> `@ub`(cut 0 [3 6] 0b1111.0000.1101)
47+ 0b10.0001
48+
49+
docs/system/hoon/library/src/2c/gate/end.mdnew file+50
@@ -0,0 +1,50 @@
1+### `++end`
2+
3+Tail
4+
5+Produces an [atom]() by taking the last `b` blocks of size `a` from `c`.
6+
7+Accepts
8+-------
9+
10+`a` is a block size (see [`++bloq`]()).
11+
12+`b` is an atom.
13+
14+`c` is an [atom]().
15+
16+Produces
17+--------
18+
19+An atom.
20+
21+
22+Source
23+------
24+
25+ ++ end :: tail
26+ ~/ %end
27+ |= [a=bloq b=@ c=@]
28+ (mod c (bex (mul (bex a) b)))
29+
30+Examples
31+--------
32+
33+ ~zod/try=> `@ub`12
34+ 0b1100
35+ ~zod/try=> `@ub`(end 0 3 12)
36+ 0b100
37+ ~zod/try=> (end 0 3 12)
38+ 4
39+ ~zod/try=> `@ub`(end 1 3 12)
40+ 0b1100
41+ ~zod/try=> (end 1 3 12)
42+ 12
43+ ~zod/try=> `@ux`'abc'
44+ 0x63.6261
45+ ~zod/try=> `@ux`(end 3 2 'abc')
46+ 0x6261
47+ ~zod/try=> `@t`(end 3 2 'abc')
48+ 'ab'
49+
50+
docs/system/hoon/library/src/2c/gate/fil.mdnew file+45
@@ -0,0 +1,45 @@
1+### `++fil`
2+
3+Fill bloqstream
4+
5+Produces an [atom]() by repeating `c` for `b` blocks of size `a`.
6+
7+Accepts
8+-------
9+
10+`a` is a block size (see [`++bloq`]()).
11+
12+`b` is an atom.
13+
14+`c` is an [atom]().
15+
16+Produces
17+--------
18+
19+An atom.
20+
21+Source
22+------
23+
24+ ++ fil :: fill bloqstream
25+ |= [a=bloq b=@ c=@]
26+ =+ n=0
27+ =+ d=c
28+ |- ^- @
29+ ?: =(n b)
30+ (rsh a 1 d)
31+ $(d (add c (lsh a 1 d)), n +(n))
32+
33+Examples
34+--------
35+
36+ ~zod/try=> `@t`(fil 3 5 %a)
37+ 'aaaaa'
38+ ~zod/try=> `@t`(fil 5 10 %ceeb)
39+ 'ceebceebceebceebceebceebceebceebceebceeb'
40+ ~zod/try=> `@t`(fil 4 10 %eced)
41+ 'ʇʇʇʇʇʇʇʇʇʇed'
42+ ~zod/try=> `@tas`(fil 4 10 %bf)
43+ %bfbfbfbfbfbfbfbfbfbf
44+
45+
docs/system/hoon/library/src/2c/gate/lsh.mdnew file+45
@@ -0,0 +1,45 @@
1+### `++lsh`
2+
3+Left-shift
4+
5+Produces an [atom]() by left-shifting `c` by `b` blocks of size `a`.
6+
7+Accepts
8+-------
9+
10+`a` is a block size (see [`++bloq`]()).
11+
12+`b` is an atom.
13+
14+`c` is an atom.
15+
16+Produces
17+--------
18+
19+An atom.
20+
21+Source
22+------
23+
24+ ++ lsh :: left-shift
25+ ~/ %lsh
26+ |= [a=bloq b=@ c=@]
27+ (mul (bex (mul (bex a) b)) c)
28+
29+Examples
30+--------
31+
32+ ~zod/try=> `@ub`1
33+ 0b1
34+ ~zod/try=> `@ub`(lsh 0 1 1)
35+ 0b10
36+ ~zod/try=> (lsh 0 1 1)
37+ 2
38+ ~zod/try=> `@ub`255
39+ 0b1111.1111
40+ ~zod/try=> `@ub`(lsh 3 1 255)
41+ 0b1111.1111.0000.0000
42+ ~zod/try=> (lsh 3 1 255)
43+ 65.280
44+
45+
docs/system/hoon/library/src/2c/gate/met.mdnew file+37
@@ -0,0 +1,37 @@
1+### `++met`
2+
3+Measure
4+
5+Computes the number of blocks of size `a` in `b`, producing an [atom]().
6+
7+`a` is a block size (see [`++bloq`]()).
8+
9+`b` is an atom.
10+
11+Source
12+------
13+
14+ ++ met :: measure
15+ ~/ %met
16+ |= [a=bloq b=@]
17+ ^- @
18+ =+ c=0
19+ |-
20+ ?: =(0 b) c
21+ $(b (rsh a 1 b), c +(c))
22+
23+Examples
24+--------
25+
26+ ~zod/try=> (met 0 1)
27+ 1
28+ ~zod/try=> (met 0 2)
29+ 2
30+ ~zod/try=> (met 3 255)
31+ 1
32+ ~zod/try=> (met 3 256)
33+ 2
34+ ~zod/try=> (met 3 'abcde')
35+ 5
36+
37+
docs/system/hoon/library/src/2c/gate/rap.mdnew file+41
@@ -0,0 +1,41 @@
1+### `++rap`
2+
3+Assemble non-zero
4+
5+Concatenates a list of [atom]()s `b` using blocksize `a`, producing an atom.
6+
7+Accepts
8+-------
9+
10+`a` is a block size (see [`++bloq`]()).
11+
12+`b` is a [`++list`]() of [atom]()s.
13+
14+Produces
15+--------
16+
17+An atom.
18+
19+Source
20+------
21+
22+ ++ rap :: assemble nonzero
23+ ~/ %rap
24+ |= [a=bloq b=(list ,@)]
25+ ^- @
26+ ?~ b 0
27+ (cat a i.b $(b t.b))
28+
29+Examples
30+--------
31+
32+ ~zod/try=> `@ub`(rap 2 (limo [1 2 3 4 ~]))
33+ 0b100.0011.0010.0001
34+ ~zod/try=> `@ub`(rap 1 (limo [1 2 3 4 ~]))
35+ 0b1.0011.1001
36+ ~zod/try=> (rap 0 (limo [0 0 0 ~]))
37+ 0
38+ ~zod/try=> (rap 0 (limo [1 0 1 ~]))
39+ 3
40+
41+
docs/system/hoon/library/src/2c/gate/rep.mdnew file+49
@@ -0,0 +1,49 @@
1+### `++rep`
2+
3+Assemble single
4+
5+Produces an [atom]() by assembling a list of atoms `b` using block size `a`.
6+
7+Accepts
8+-------
9+
10+`a` is a block size (see [`++bloq`]()).
11+
12+`b` is a list of atoms.
13+
14+Produces
15+--------
16+
17+An atom.
18+
19+Source
20+------
21+
22+ ++ rep :: assemble single
23+ ~/ %rep
24+ |= [a=bloq b=(list ,@)]
25+ ^- @
26+ =+ c=0
27+ |-
28+ ?~ b 0
29+ (con (lsh a c (end a 1 i.b)) $(c +(c), b t.b))
30+
31+Examples
32+--------
33+
34+ ~zod/try=> `@ub`(rep 2 (limo [1 2 3 4 ~]))
35+ 0b100.0011.0010.0001
36+ ~zod/try=> (rep 0 (limo [0 0 1 ~]))
37+ 4
38+ ~zod/try=> (rep 0 (limo [0 0 0 1 ~]))
39+ 8
40+ ~zod/try=> (rep 0 (limo [0 1 0 0 ~]))
41+ 2
42+ ~zod/try=> (rep 0 (limo [0 1 0 1 ~]))
43+ 10
44+ ~zod/try=> (rep 0 (limo [0 1 0 1 0 1 ~]))
45+ 42
46+ ~zod/try=> `@ub`42
47+ 0b10.1010
48+
49+
docs/system/hoon/library/src/2c/gate/rip.mdnew file+49
@@ -0,0 +1,49 @@
1+### `++rip`
2+
3+Disassemble
4+
5+Produces a list of [atom]()s from the bits of `b` using block size `a`.
6+
7+Accepts
8+-------
9+
10+`a` is a block size (see [`++bloq`]()).
11+
12+`b` is an atom.
13+
14+Produces
15+--------
16+
17+A list of atoms.
18+
19+Source
20+------
21+
22+ ++ rip :: disassemble
23+ ~/ %rip
24+ |= [a=bloq b=@]
25+ ^- (list ,@)
26+ ?: =(0 b) ~
27+ [(end a 1 b) $(b (rsh a 1 b))]
28+
29+Examples
30+--------
31+
32+ ~zod/try=> `@ub`155
33+ 0b1001.1011
34+ ~zod/try=> (rip 0 155)
35+ ~[1 1 0 1 1 0 0 1]
36+ ~zod/try=> (rip 2 155)
37+ ~[11 9]
38+ ~zod/try=> (rip 1 155)
39+ ~[3 2 1 2]
40+ ~zod/try=> `@ub`256
41+ 0b1.0000.0000
42+ ~zod/try=> (rip 0 256)
43+ ~[0 0 0 0 0 0 0 0 1]
44+ ~zod/try=> (rip 2 256)
45+ ~[0 0 1]
46+ ~zod/try=> (rip 3 256)
47+ ~[0 1]
48+
49+
docs/system/hoon/library/src/2c/gate/rsh.mdnew file+55
@@ -0,0 +1,55 @@
1+### `++rsh`
2+
3+Right-shift
4+
5+Right-shifts `c` by `b` blocks of size `a`, producing an [atom]().
6+
7+Accepts
8+-------
9+
10+`a` is a block size (see [`++bloq`]()).
11+
12+`b` is an atom.
13+
14+`c` is an atom.
15+
16+Produces
17+--------
18+
19+An atom.
20+
21+Source
22+------
23+
24+ ++ rsh :: right-shift
25+ ~/ %rsh
26+ |= [a=bloq b=@ c=@]
27+ (div c (bex (mul (bex a) b)))
28+
29+Examples
30+--------
31+
32+ ~zod/try=> `@ub`145
33+ 0b1001.0001
34+ ~zod/try=> `@ub`(rsh 1 1 145)
35+ 0b10.0100
36+ ~zod/try=> (rsh 1 1 145)
37+ 36
38+ ~zod/try=> `@ub`(rsh 2 1 145)
39+ 0b1001
40+ ~zod/try=> (rsh 2 1 145)
41+ 9
42+ ~zod/try=> `@ub`10
43+ 0b1010
44+ ~zod/try=> `@ub`(rsh 0 1 10)
45+ 0b101
46+ ~zod/try=> (rsh 0 1 10)
47+ 5
48+ ~zod/try=> `@ux`'abc'
49+ 0x63.6261
50+ ~zod/try=> `@t`(rsh 3 1 'abc')
51+ 'bc'
52+ ~zod/try=> `@ux`(rsh 3 1 'abc')
53+ 0x6362
54+
55+
docs/system/hoon/library/src/2c/gate/swp.mdnew file+40
@@ -0,0 +1,40 @@
1+### `++swp`
2+
3+Reverse block order
4+
5+Switches little endian to big and vice versa: produces an [atom]() by
6+reversing the block order of `b` using block size `a`.
7+
8+
9+Accepts
10+-------
11+
12+`a` is a block size (see [`++bloq`]()).
13+
14+`b` is an atom.
15+
16+Produces
17+--------
18+
19+An atom
20+
21+Source
22+------
23+
24+ ++ swap |=([a=bloq b=@] (rep a (flop (rip a b)))) :: reverse bloq order
25+
26+Examples
27+--------
28+
29+ ~zod/try=> `@ub`24
30+ 0b1.1000
31+ ~zod/try=> (swap 0 24)
32+ 3
33+ ~zod/try=> `@ub`3
34+ 0b11
35+ ~zod/try=> (swap 0 0)
36+ 0
37+ ~zod/try=> (swap 0 128)
38+ 1
39+
40+
docs/system/hoon/library/src/2c/gate/xeb.mdnew file+42
@@ -0,0 +1,42 @@
1+### `++xeb`
2+
3+Binary logarithm
4+
5+Computes the base-2 logarithm of `a`, producing an [atom]().
6+
7+Accepts
8+-------
9+
10+`a` is an atom.
11+
12+Produces
13+--------
14+
15+An atom.
16+
17+Source
18+------
19+
20+ ++ xeb :: binary logarithm
21+ :: ~/ %xeb
22+ |= a=@
23+ ^- @
24+ (met 0 a)
25+
26+Examples
27+--------
28+
29+ ~zod/try=> (xeb 31)
30+ 5
31+ ~zod/try=> (xeb 32)
32+ 6
33+ ~zod/try=> (xeb 49)
34+ 6
35+ ~zod/try=> (xeb 0)
36+ 0
37+ ~zod/try=> (xeb 1)
38+ 1
39+ ~zod/try=> (xeb 2)
40+ 2
41+
42+
docs/system/hoon/library/src/2d/gate/con.mdnew file+56
@@ -0,0 +1,56 @@
1+### `++con`
2+
3+Binary OR
4+
5+Computes the bit-wise logical OR of two [atom]()s, `a` and `b`, producing an
6+atom.
7+
8+Accepts
9+-------
10+
11+`a` is an atom
12+
13+`b` is an atom
14+
15+Produces
16+--------
17+
18+An atom.
19+
20+Source
21+------
22+
23+ ++ con :: binary or
24+ ~/ %con
25+ |= [a=@ b=@]
26+ =+ [c=0 d=0]
27+ |- ^- @
28+ ?: ?&(=(0 a) =(0 b)) d
29+ %= $
30+ a (rsh 0 1 a)
31+ b (rsh 0 1 b)
32+ c +(c)
33+ d %+ add d
34+ %^ lsh 0 c
35+ ?& =(0 (end 0 1 a))
36+ =(0 (end 0 1 b))
37+ ==
38+ ==
39+
40+Examples
41+--------
42+
43+ ~zod/try=> (con 0b0 0b1)
44+ 1
45+ ~zod/try=> (con 0 1)
46+ 1
47+ ~zod/try=> (con 0 0)
48+ 0
49+ ~zod/try=> `@ub`(con 0b1111.0000 0b1.0011)
50+ 0b1111.0011
51+ ~zod/try=> (con 4 4)
52+ 4
53+ ~zod/try=> (con 10.000 234)
54+ 10.234
55+
56+
docs/system/hoon/library/src/2d/gate/dis.mdnew file+60
@@ -0,0 +1,60 @@
1+### `++dis`
2+
3+Binary AND
4+
5+Computes the bit-wise logical AND of two [atom]()s `a` and `b`, producing an
6+atom.
7+
8+Accepts
9+-------
10+
11+`a` is an atom.
12+
13+`b` is an atom.
14+
15+Produces
16+--------
17+
18+An atom.
19+
20+Source
21+------
22+
23+ ++ dis :: binary and
24+ ~/ %dis
25+ |= [a=@ b=@]
26+ =| [c=@ d=@]
27+ |- ^- @
28+ ?: ?|(=(0 a) =(0 b)) d
29+ %= $
30+ a (rsh 0 1 a)
31+ b (rsh 0 1 b)
32+ c +(c)
33+ d %+ add d
34+ %^ lsh 0 c
35+ ?| =(0 (end 0 1 a))
36+ =(0 (end 0 1 b))
37+ ==
38+ ==
39+
40+Examples
41+--------
42+
43+ ~zod/try=> `@ub`9
44+ 0b1001
45+ ~zod/try=> `@ub`5
46+ 0b101
47+ ~zod/try=> `@ub`(dis 9 5)
48+ 0b1
49+ ~zod/try=> (dis 9 5)
50+ 1
51+ ~zod/try=> `@ub`534
52+ 0b10.0001.0110
53+ ~zod/try=> `@ub`987
54+ 0b11.1101.1011
55+ ~zod/try=> `@ub`(dis 534 987)
56+ 0b10.0001.0010
57+ ~zod/try=> (dis 534 987)
58+ 530
59+
60+
docs/system/hoon/library/src/2d/gate/mix.mdnew file+52
@@ -0,0 +1,52 @@
1+### `++mix`
2+
3+Binary XOR
4+
5+Produces the bit-wise logical XOR of `a` and `b`, producing an [atom]().
6+
7+Accepts
8+-------
9+
10+`a` is an atom
11+
12+`b` is an atom
13+
14+Produces
15+--------
16+
17+An atom.
18+
19+Source
20+------
21+
22+ ++ mix :: binary xor
23+ ~/ %mix
24+ |= [a=@ b=@]
25+ ^- @
26+ =+ [c=0 d=0]
27+ |-
28+ ?: ?&(=(0 a) =(0 b)) d
29+ %= $
30+ a (rsh 0 1 a)
31+ b (rsh 0 1 b)
32+ c +(c)
33+ d (add d (lsh 0 c =((end 0 1 a) (end 0 1 b))))
34+ ==
35+
36+Examples
37+--------
38+
39+ ~zod/try=> `@ub`2
40+ 0b10
41+ ~zod/try=> `@ub`3
42+ 0b11
43+ ~zod/try=> `@ub`(mix 2 3)
44+ 0b1
45+ ~zod/try=> (mix 2 3)
46+ 1
47+ ~zod/try=> `@ub`(mix 2 2)
48+ 0b0
49+ ~zod/try=> (mix 2 2)
50+ 0
51+
52+
docs/system/hoon/library/src/2d/gate/not.mdnew file+44
@@ -0,0 +1,44 @@
1+### `++not`
2+
3+Binary NOT
4+
5+Computes the bit-wise logical NOT of the bottom `b` blocks of size `a`
6+of `c`.
7+
8+Accepts
9+-------
10+
11+`a` is a block size (see [`++bloq`]()).
12+
13+`b` is an [atom]().
14+
15+`c` is an atom.
16+
17+Produces
18+--------
19+
20+An atom.
21+
22+Source
23+------
24+
25+ ++ not |= [a=bloq b=@ c=@] :: binary not (sized)
26+ (mix c (dec (bex (mul b (bex a)))))
27+
28+Examples
29+--------
30+
31+ ~zod/try=> `@ub`24
32+ 0b1.1000
33+ ~zod/try=> (not 0 5 24)
34+ 7
35+ ~zod/try=> `@ub`7
36+ 0b111
37+ ~zod/try=> (not 2 5 24)
38+ 1.048.551
39+ ~zod/try=> (not 2 5 1.048.551)
40+ 24
41+ ~zod/try=> (not 1 1 (not 1 1 10))
42+ 10
43+
44+
docs/system/hoon/library/src/2e/gate/fnv.mdnew file+33
@@ -0,0 +1,33 @@
1+### `++fnv`
2+
3+Hashes an atom with the 32-bit FNV non-cryptographic hash algorithm.
4+Multiplies `a` by the prime number 16,777,619 and then takes the block
5+of size 5 off the product's end, producing an [atom]().
6+
7+Accepts
8+-------
9+
10+`a` is an atom.
11+
12+Produces
13+--------
14+
15+An atom.
16+
17+
18+Source
19+------
20+
21+ ++ fnv |=(a=@ (end 5 1 (mul 16.777.619 a))) :: FNV scrambler
22+
23+Examples
24+--------
25+
26+ ~zod/try=> (fnv 10.000)
27+ 272.465.456
28+ ~zod/try=> (fnv 10.001)
29+ 289.243.075
30+ ~zod/try=> (fnv 1)
31+ 16.777.619
32+
33+
docs/system/hoon/library/src/2e/gate/mug.mdnew file+54
@@ -0,0 +1,54 @@
1+### `++mug`
2+
3+Hashes `a` with the 31-bit nonzero FNV-1a non-cryptographic hash
4+algorithm, producing an [atom]().
5+
6+Accepts
7+-------
8+
9+A is a [noun]().
10+
11+Produces
12+--------
13+
14+An atom.
15+
16+Source
17+------
18+
19+ ++ mug :: 31bit nonzero FNV1a
20+ ~/ %mug
21+ |= a=*
22+ ?^ a
23+ =+ b=[p=$(a -.a) q=$(a +.a)]
24+ |- ^- @
25+ =+ c=(fnv (mix p.b (fnv q.b)))
26+ =+ d=(mix (rsh 0 31 c) (end 0 31 c))
27+ ?. =(0 c) c
28+ $(q.b +(q.b))
29+ =+ b=2.166.136.261
30+ |- ^- @
31+ =+ c=b
32+ =+ [d=0 e=(met 3 a)]
33+ |- ^- @
34+ ?: =(d e)
35+ =+ f=(mix (rsh 0 31 c) (end 0 31 c))
36+ ?. =(0 f) f
37+ ^$(b +(b))
38+ $(c (fnv (mix c (cut 3 [d 1] a))), d +(d))
39+
40+Examples
41+--------
42+
43+ ~zod/try=> (mug 10.000)
44+ 178.152.889
45+ ~zod/try=> (mug 10.001)
46+ 714.838.017
47+ ~zod/try=> (mug 1)
48+ 67.918.732
49+ ~zod/try=> (mug (some 10))
50+ 1.872.403.737
51+ ~zod/try=> (mug (limo [1 2 3 4 5 ~]))
52+ 1.067.931.605
53+
54+
docs/system/hoon/library/src/2e/gate/mum.mdnew file+69
@@ -0,0 +1,69 @@
1+### `++mum`
2+
3+XX document
4+
5+Accepts
6+-------
7+
8+Produces
9+--------
10+
11+Source
12+------
13+
14+ ++ mum :: mug with murmur3
15+ ~/ %mum
16+ |= a=*
17+ |^ (trim ?@(a a (mix $(a -.a) (mix 0x7fff.ffff $(a +.a)))))
18+ ++ spec :: standard murmur3
19+ |= [syd=@ key=@]
20+ ?> (lte (met 5 syd) 1)
21+ =+ ^= row
22+ |= [a=@ b=@]
23+ (con (end 5 1 (lsh 0 a b)) (rsh 0 (sub 32 a) b))
24+ =+ mow=|=([a=@ b=@] (end 5 1 (mul a b)))
25+ =+ len=(met 5 key)
26+ =- =. goc (mix goc len)
27+ =. goc (mix goc (rsh 4 1 goc))
28+ =. goc (mow goc 0x85eb.ca6b)
29+ =. goc (mix goc (rsh 0 13 goc))
30+ =. goc (mow goc 0xc2b2.ae35)
31+ (mix goc (rsh 4 1 goc))
32+ ^= goc
33+ =+ [inx=0 goc=syd]
34+ |- ^- @
35+ ?: =(inx len) goc
36+ =+ kop=(cut 5 [inx 1] key)
37+ =. kop (mow kop 0xcc9e.2d51)
38+ =. kop (row 15 kop)
39+ =. kop (mow kop 0x1b87.3593)
40+ =. goc (mix kop goc)
41+ =. goc (row 13 goc)
42+ =. goc (end 5 1 (add 0xe654.6b64 (mul 5 goc)))
43+ $(inx +(inx))
44+ ::
45+ ++ trim :: 31-bit nonzero
46+ |= key=@
47+ =+ syd=0xcafe.babe
48+ |- ^- @
49+ =+ haz=(spec syd key)
50+ =+ ham=(mix (rsh 0 31 haz) (end 0 31 haz))
51+ ?.(=(0 ham) ham $(syd +(syd)))
52+ --
53+ ::
54+
55+Examples
56+--------
57+
58+ ~zod/try=> (mum 10.000)
59+ 1.232.632.901
60+ ~zod/try=> (mum 10.001)
61+ 658.093.079
62+ ~zod/try=> (mum 1)
63+ 818.387.364
64+ ~zod/try=> (mum (some 10))
65+ 1.177.215.703
66+ ~zod/try=> (mum ~[1 2 3 4 5])
67+ 1.517.902.092
68+
69+
docs/system/hoon/library/src/2f/gate/aor.mdnew file+61
@@ -0,0 +1,61 @@
1+### `++aor`
2+
3+Alphabetic order
4+
5+Computes whether `a` and `b` are in alphabetical order, producing a
6+boolean.
7+
8+Accepts
9+-------
10+
11+`a` is a [noun]().
12+
13+`b` is a noun.
14+
15+Produces
16+--------
17+
18+A boolean atom.
19+
20+
21+Source
22+------
23+
24+ ++ aor :: alphabetic-order
25+ ~/ %aor
26+ |= [a=* b=*]
27+ ^- ?
28+ ?: =(a b) &
29+ ?. ?=(@ a)
30+ ?: ?=(@ b) |
31+ ?: =(-.a -.b)
32+ $(a +.a, b +.b)
33+ $(a -.a, b -.b)
34+ ?. ?=(@ b) &
35+ |-
36+ =+ [c=(end 3 1 a) d=(end 3 1 b)]
37+ ?: =(c d)
38+ $(a (rsh 3 1 a), b (rsh 3 1 b))
39+ (lth c d)
40+
41+Examples
42+--------
43+
44+ ~zod/try=> (aor 'a' 'b')
45+ %.y
46+ ~zod/try=> (aor 'b' 'a')
47+ %.n
48+ ~zod/try=> (aor "foo" "bar")
49+ %.n
50+ ~zod/try=> (aor "bar" "foo")
51+ %.y
52+ ~zod/try=> (aor "abcdefz" "abcdefa")
53+ %.n
54+ ~zod/try=> (aor "abcdefa" "abcdefz")
55+ %.y
56+ ~zod/try=> (aor 10.000 17.000)
57+ %.y
58+ ~zod/try=> (aor 10 9)
59+ %.n
60+
61+
docs/system/hoon/library/src/2f/gate/dor.mdnew file+52
@@ -0,0 +1,52 @@
1+### `++dor`
2+
3+Numeric order
4+
5+Computes whether `a` and `b` are in ascending numeric order, producing a
6+boolean.
7+
8+Accepts
9+-------
10+
11+`a` is a [noun]().
12+
13+`b` is a noun.
14+
15+Produces
16+--------
17+
18+A boolean atom.
19+
20+Source
21+------
22+
23+ ++ dor :: d-order
24+ ~/ %dor
25+ |= [a=* b=*]
26+ ^- ?
27+ ?: =(a b) &
28+ ?. ?=(@ a)
29+ ?: ?=(@ b) |
30+ ?: =(-.a -.b)
31+ $(a +.a, b +.b)
32+ $(a -.a, b -.b)
33+ ?. ?=(@ b) &
34+ (lth a b)
35+
36+Examples
37+--------
38+
39+ ~zod/try=> (dor 1 2)
40+ %.y
41+ ~zod/try=> (dor 2 1)
42+ %.n
43+ ~zod/try=> (dor ~[1 2 3] ~[1 2 4])
44+ %.y
45+ ~zod/try=> (dor ~[1 2 4] ~[1 2 3])
46+ %.n
47+ ~zod/try=> (dor (limo ~[99 100 10.000]) ~[99 101 10.000])
48+ %.y
49+ ~zod/try=> (dor ~[99 101 10.999] (limo ~[99 100 10.000]))
50+ %.n
51+
52+
docs/system/hoon/library/src/2f/gate/gor.mdnew file+56
@@ -0,0 +1,56 @@
1+### `++gor`
2+
3+Hash order
4+
5+XX revisit
6+
7+Accepts
8+-------
9+
10+`a` is a [noun]().
11+
12+`b` is a noun.
13+
14+Produces
15+--------
16+
17+A boolean [atom]().
18+
19+Source
20+------
21+
22+ ++ gor :: g-order
23+ ~/ %gor
24+ |= [a=* b=*]
25+ ^- ?
26+ =+ [c=(mug a) d=(mug b)]
27+ ?: =(c d)
28+ (dor a b)
29+ (lth c d)
30+
31+Examples
32+--------
33+
34+ ~zod/try=> (gor 'd' 'c')
35+ %.y
36+ ~zod/try=> 'd'
37+ 'd'
38+ ~zod/try=> 'c'
39+ ~zod/try=> `@ud`'d'
40+ 100
41+ ~zod/try=> `@ud`'c'
42+ 99
43+ ~zod/try=> (mug 'd')
44+ 1.628.185.714
45+ ~zod/try=> (mug 'c')
46+ 1.712.073.811
47+ ~zod/try=> (gor 'd' 'c')
48+ %.y
49+ ~zod/try=> (gor 'c' 'd')
50+ %.n
51+ ~zod/try=> (gor "foo" "bar")
52+ %.n
53+ ~zod/try=> (gor (some 10) (limo [1 2 3 ~]))
54+ %.n
55+
56+
docs/system/hoon/library/src/2f/gate/hor.mdnew file+49
@@ -0,0 +1,49 @@
1+### `++hor`
2+
3+Hash order
4+
5+XX revisit
6+
7+Recursive hash comparator gate.
8+
9+Accepts
10+-------
11+
12+`a` is a [noun]().
13+
14+`b` is a noun.
15+
16+Produces
17+--------
18+
19+A boolean [atom]().
20+
21+
22+Source
23+------
24+
25+ ++ hor :: h-order
26+ ~/ %hor
27+ |= [a=* b=*]
28+ ^- ?
29+ ?: ?=(@ a)
30+ ?. ?=(@ b) &
31+ (gor a b)
32+ ?: ?=(@ b) |
33+ ?: =(-.a -.b)
34+ (gor +.a +.b)
35+ (gor -.a -.b)
36+
37+Examples
38+--------
39+
40+ ~zod/try=> (hor . 1)
41+ %.n
42+ ~zod/try=> (hor 1 2)
43+ %.y
44+ ~zod/try=> (hor "abc" "cba")
45+ %.y
46+ ~zod/try=> (hor 'c' 'd')
47+ %.n
48+
49+
docs/system/hoon/library/src/2f/gate/vor.mdnew file+39
@@ -0,0 +1,39 @@
1+### `++vor`
2+
3+Double hash comparator gate.
4+
5+XX revisit
6+
7+Accepts
8+-------
9+
10+`a` is a [noun]()
11+
12+`b` is a noun
13+
14+Produces
15+-------
16+
17+Source
18+------
19+
20+ ++ vor :: v-order
21+ ~/ %vor
22+ |= [a=* b=*]
23+ ^- ?
24+ =+ [c=(mug (mug a)) d=(mug (mug b))]
25+ ?: =(c d)
26+ (dor a b)
27+ (lth c d)
28+
29+Examples
30+--------
31+
32+ ~zod/try=> (vor 'f' 'g')
33+ %.y
34+ ~zod/try=> (vor 'a' 'z')
35+ %.n
36+ ~zod/try=> (vor 43.326 41.106)
37+ %.n
38+
39+
docs/system/hoon/library/src/2h/core/in.mdnew file+589
@@ -0,0 +1,589 @@
1+
2+### `++in`
3+
4+Set operations
5+
6+Core whose [arm]()s contain a variety of functions that operate on [`++set`]()s. Its [sample]() accepts the input [`++set`]() to be manipulated.
7+
8+Accepts
9+-------
10+
11+A `++set`.
12+
13+Source
14+------
15+
16+ ++ in :: set engine
17+ ~/ %in
18+ |/ a=(set)
19+
20+Examples
21+--------
22+
23+ ~zod/try=> ~(. in (sa "asd"))
24+ <13.evb [nlr(^$1{@tD $1}) <414.fvk 101.jzo 1.ypj %164>]>
25+
26+### `+-all:in`
27+
28+Logical AND
29+
30+Computes the logical AND on every element in `a` slammed with `b`,
31+producing a boolean.
32+
33+Accepts
34+-------
35+
36+`a` is a [`++set`]().
37+
38+`b` is a [wet]() [gate]() that accepts a [noun]() and produces a boolean.
39+
40+Produces
41+--------
42+
43+A boolean.
44+
45+Source
46+------
47+
48+ +- all :: logical AND
49+ ~/ %all
50+ |* b=$+(* ?)
51+ |- ^- ?
52+ ?~ a
53+ &
54+ ?&((b n.a) $(a l.a) $(a r.a))
55+ ::
56+
57+Examples
58+--------
59+
60+ ~zod/try=> =b (sa `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
61+ ~zod/try=> (~(all in b) |=(a=* ?@(+.a & |)))
62+ %.n
63+ ~zod/try=> =b (sa `(list ,@t)`['john' 'bonita' 'daniel' 'madeleine' ~])
64+ ~zod/try=> (~(all in b) |=(a=@t (gte a 100)))
65+ %.y
66+
67+------------------------------------------------------------------------
68+
69+### `+-any:in`
70+
71+Logical OR
72+
73+Computes the logical OR on every element of `a` slammed with `b`.
74+
75+Accepts
76+-------
77+
78+`a` is a [`++set`]().
79+
80+`b` is a [gate]() that accepts a noun and produces a boolean.
81+
82+Produces
83+--------
84+
85+A boolean.
86+
87+Source
88+------
89+
90+ +- any :: logical OR
91+ ~/ %any
92+ |* b=$+(* ?)
93+ |- ^- ?
94+ ?~ a
95+ |
96+ ?|((b n.a) $(a l.a) $(a r.a))
97+ ::
98+
99+Examples
100+--------
101+
102+ ~zod/try=> =b (sa `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
103+ ~zod/try=> (~(any in b) |=(a=* ?@(+.a & |)))
104+ %.y
105+ ~zod/try=> =b (sa `(list ,@t)`['john' 'bonita' 'daniel' 'madeleine' ~])
106+ ~zod/try=> (~(any in b) |=(a=@t (lte a 100)))
107+ %.n
108+
109+------------------------------------------------------------------------
110+
111+### `+-del:in`
112+
113+Remove noun
114+
115+Removes `b` from the [`++set`]() `a`.
116+
117+Accepts
118+-------
119+
120+`a` is a set.
121+
122+`b` is a [noun]().
123+
124+Produces
125+--------
126+
127+A set.
128+
129+Source
130+------
131+
132+ +- del :: b without any a
133+ ~/ %del
134+ |* b=*
135+ |- ^+ a
136+ ?~ a
137+ ~
138+ ?. =(b n.a)
139+ ?: (hor b n.a)
140+ [n.a $(a l.a) r.a]
141+ [n.a l.a $(a r.a)]
142+ |- ^- ?(~ _a)
143+ ?~ l.a r.a
144+ ?~ r.a l.a
145+ ?: (vor n.l.a n.r.a)
146+ [n.l.a l.l.a $(l.a r.l.a)]
147+ [n.r.a $(r.a l.r.a) r.r.a]
148+ ::
149+
150+
151+Examples
152+--------
153+
154+ ~zod/try=> =b (sa `(list ,@t)`['a' 'b' 'c' ~])
155+ ~zod/try=> (~(del in b) 'a')
156+ {'c' 'b'}
157+ ~zod/try=> =b (sa `(list ,@t)`['john' 'bonita' 'daniel' 'madeleine' ~])
158+ ~zod/try=> (~(del in b) 'john')
159+ {'bonita' 'madeleine' 'daniel'}
160+ ~zod/try=> (~(del in b) 'susan')
161+ {'bonita' 'madeleine' 'daniel' 'john'}
162+
163+------------------------------------------------------------------------
164+
165+### `+-dig:in`
166+
167+Axis a in b
168+
169+Produce the axis of `b` within `a`.
170+
171+Accepts
172+-------
173+
174+`a` is a [`++set`]().
175+
176+`b` is a [noun]().
177+
178+Produces
179+--------
180+
181+The [`++unit`]() of an atom.
182+
183+Source
184+------
185+
186+ +- dig :: axis of a in b
187+ |= b=*
188+ =+ c=1
189+ |- ^- (unit ,@)
190+ ?~ a ~
191+ ?: =(b n.a) [~ u=(peg c 2)]
192+ ?: (gor b n.a)
193+ $(a l.a, c (peg c 6))
194+ $(a r.a, c (peg c 7))
195+ ::
196+
197+
198+Examples
199+--------
200+
201+ ~zod/try=> =a (sa `(list ,@)`[1 2 3 4 5 6 7 ~])
202+ ~zod/try=> a
203+ {5 4 7 6 1 3 2}
204+ ~zod/try=> -.a
205+ n=6
206+ ~zod/try=> (~(dig in a) 7)
207+ [~ 12]
208+ ~zod/try=> (~(dig in a) 2)
209+ [~ 14]
210+ ~zod/try=> (~(dig in a) 6)
211+ [~ 2]
212+
213+------------------------------------------------------------------------
214+
215+### `+-gas:in`
216+
217+Concatenate
218+
219+Insert the elements of a [`++list`]() `b` into a [`++set`]() `a`.
220+
221+Accepts
222+-------
223+
224+`a` is a set.
225+
226+`b` is a list.
227+
228+Produces
229+--------
230+
231+A `++set`.
232+
233+Source
234+------
235+
236+ +- gas :: concatenate
237+ ~/ %gas
238+ |= b=(list ,_?>(?=(^ a) n.a))
239+ |- ^+ a
240+ ?~ b
241+ a
242+ $(b t.b, a (put(+< a) i.b))
243+ ::
244+
245+
246+Examples
247+--------
248+
249+ ~zod/try=> b
250+ {'bonita' 'madeleine' 'rudolf' 'john'}
251+ ~zod/try=> (~(gas in b) `(list ,@t)`['14' 'things' 'number' '1.337' ~])
252+ {'1.337' '14' 'number' 'things' 'bonita' 'madeleine' 'rudolf' 'john'}
253+ ~zod/try=> (~(gas in s) `(list ,@t)`['1' '2' '3' ~])
254+ {'1' '3' '2' 'e' 'd' 'a' 'c' 'b'}
255+
256+------------------------------------------------------------------------
257+
258+### `+-has:in`
259+
260+b in a?
261+
262+Checks if `b` is an element of `a`, producing a boolean.
263+
264+Accepts
265+-------
266+
267+`a` is a [`++set`]().
268+
269+`b` is a [noun]().
270+
271+Produces
272+--------
273+
274+A boolean.
275+
276+Source
277+------
278+
279+ +- has :: b exists in a check
280+ ~/ %has
281+ |* b=*
282+ |- ^- ?
283+ ?~ a
284+ |
285+ ?: =(b n.a)
286+ &
287+ ?: (hor b n.a)
288+ $(a l.a)
289+ $(a r.a)
290+ ::
291+
292+
293+Examples
294+--------
295+
296+ ~zod/try=> =a (~(gas in `(set ,@t)`~) `(list ,@t)`[`a` `b` `c` ~])
297+ ~zod/try=> (~(has in a) `a`)
298+ %.y
299+ ~zod/try=> (~(has in a) 'z')
300+ %.n
301+
302+------------------------------------------------------------------------
303+
304+### `+-int:in`
305+
306+Intersection
307+
308+Produces a set of the intersection between two [`++set`]()s of the same type,
309+`a` and `b`.
310+
311+Accepts
312+-------
313+
314+`a` is a set.
315+
316+`b` is a set.
317+
318+Produces
319+--------
320+
321+A [`++set`]().
322+
323+Source
324+------
325+
326+ +- int :: intersection
327+ ~/ %int
328+ |* b=_a
329+ |- ^+ a
330+ ?~ b
331+ ~
332+ ?~ a
333+ ~
334+ ?. (vor n.a n.b)
335+ $(a b, b a)
336+ ?: =(n.b n.a)
337+ [n.a $(a l.a, b l.b) $(a r.a, b r.b)]
338+ ?: (hor n.b n.a)
339+ %- uni(+< $(a l.a, b [n.b l.b ~])) $(b r.b)
340+ %- uni(+< $(a r.a, b [n.b ~ r.b])) $(b l.b)
341+
342+
343+Examples
344+--------
345+
346+ ~zod/try=> (~(int in (sa "ac")) (sa "ha"))
347+ {~~a}
348+ ~zod/try=> (~(int in (sa "acmo")) ~)
349+ {}
350+ ~zod/try=> (~(int in (sa "acmo")) (sa "ham"))
351+ {~~a ~~m}
352+ ~zod/try=> (~(int in (sa "acmo")) (sa "lep"))
353+ {}
354+
355+------------------------------------------------------------------------
356+
357+### `+-put:in`
358+
359+Put b in a
360+
361+Add an element `b` to the [`++set`]() `a`.
362+
363+Accepts
364+-------
365+
366+`a` is a set.
367+
368+`b` is a [noun]().
369+
370+Produces
371+--------
372+
373+A [`++set`]().
374+
375+Source
376+------
377+
378+ +- put :: puts b in a
379+ ~/ %put
380+ |* b=*
381+ |- ^+ a
382+ ?~ a
383+ [b ~ ~]
384+ ?: =(b n.a)
385+ a
386+ ?: (hor b n.a)
387+ =+ c=$(a l.a)
388+ ?> ?=(^ c)
389+ ?: (vor n.a n.c)
390+ [n.a c r.a]
391+ [n.c l.c [n.a r.c r.a]]
392+ =+ c=$(a r.a)
393+ ?> ?=(^ c)
394+ ?: (vor n.a n.c)
395+ [n.a l.a c]
396+ [n.c [n.a l.a l.c] r.c]
397+ ::
398+
399+
400+Examples
401+--------
402+
403+ ~zod/try=> =a (~(gas in `(set ,@t)`~) `(list ,@t)`[`a` `b` `c` ~])
404+ ~zod/try=> =b (~(put in a) `d`)
405+ ~zod/try=> b
406+ {`d` `a` `c` `b`}
407+ ~zod/try=> -.l.+.b
408+ n=`d`
409+
410+------------------------------------------------------------------------
411+
412+### `+-rep:in`
413+
414+Accumulate
415+
416+Accumulate the elements of `a` using a [gate]() `c` and an accumulator `b`.
417+
418+Accepts
419+--------
420+
421+`a` is a [`++set`]().
422+
423+`b` is a [noun]().
424+
425+`c` is a gate.
426+
427+Produces
428+--------
429+
430+A noun.
431+
432+Source
433+------
434+
435+ +- rep :: replace by tile
436+ |* [b=* c=_,*]
437+ |-
438+ ?~ a b
439+ $(a r.a, b $(a l.a, b (c n.a b)))
440+ ::
441+
442+
443+Examples
444+--------
445+
446+ ~zod/try=> =a (~(gas in *(set ,@)) [1 2 3 ~])
447+ ~zod/try=> a
448+ {1 3 2}
449+ ~zod/try=> (~(rep in a) 0 |=([a=@ b=@] (add a b)))
450+ 6
451+
452+------------------------------------------------------------------------
453+
454+### `+-tap:in`
455+
456+Set to list
457+
458+Flattens the [`++set`]() `a` into a [`++list`]().
459+
460+Accepts
461+-------
462+
463+`a` is an set.
464+
465+Produces
466+--------
467+
468+A list.
469+
470+Source
471+------
472+
473+ +- tap :: list tiles a set
474+ ~/ %tap
475+ |= b=(list ,_?>(?=(^ a) n.a))
476+ ^+ b
477+ ?~ a
478+ b
479+ $(a r.a, b [n.a $(a l.a)])
480+ ::
481+
482+
483+Examples
484+--------
485+
486+ ~zod/try=> =s (sa `(list ,@t)`['a' 'b' 'c' 'd' 'e' ~])
487+ ~zod/try=> s
488+ {'e' 'd' 'a' 'c' 'b'}
489+ ~zod/try=> (~(tap in s) `(list ,@t)`['1' '2' '3' ~])
490+ ~['b' 'c' 'a' 'd' 'e' '1' '2' '3']
491+ ~zod/try=> b
492+ {'bonita' 'madeleine' 'daniel' 'john'}
493+ ~zod/try=> (~(tap in b) `(list ,@t)`['david' 'people' ~])
494+ ~['john' 'daniel' 'madeleine' 'bonita' 'david' 'people']
495+
496+------------------------------------------------------------------------
497+
498+### `+-uni:in`
499+
500+Union
501+
502+Produces a set of the union between two [`++set`]()s of the same type, `a` and
503+`b`.
504+
505+Accepts
506+-------
507+
508+`a` is a set.
509+
510+`b` is a set.
511+
512+Produces
513+--------
514+
515+A set.
516+
517+Source
518+------
519+
520+ +- uni :: union
521+ ~/ %uni
522+ |* b=_a
523+ |- ^+ a
524+ ?~ b
525+ a
526+ ?~ a
527+ b
528+ ?: (vor n.a n.b)
529+ ?: =(n.b n.a)
530+ [n.b $(a l.a, b l.b) $(a r.a, b r.b)]
531+ ?: (hor n.b n.a)
532+ $(a [n.a $(a l.a, b [n.b l.b ~]) r.a], b r.b)
533+ $(a [n.a l.a $(a r.a, b [n.b ~ r.b])], b l.b)
534+ ?: =(n.a n.b)
535+ [n.b $(b l.b, a l.a) $(b r.b, a r.a)]
536+ ?: (hor n.a n.b)
537+ $(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
538+ $(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
539+
540+
541+Examples
542+--------
543+
544+ ~zod/try=> (~(uni in (sa "ac")) (sa "ha"))
545+ {~~a ~~c ~~h}
546+ ~zod/try=> (~(uni in (sa "acmo")) ~)
547+ {~~a ~~c ~~m ~~o}
548+ ~zod/try=> (~(uni in (sa "acmo")) (sa "ham"))
549+ {~~a ~~c ~~m ~~o ~~h}
550+ ~zod/try=> (~(uni in (sa "acmo")) (sa "lep"))
551+ {~~e ~~a ~~c ~~m ~~l ~~o ~~p}
552+
553+------------------------------------------------------------------------
554+
555+### `+-wyt:in`
556+
557+Set size
558+
559+Produce the number of elements in [`++set`]() `a` as an atom.
560+
561+Accepts
562+-------
563+
564+`a` is an set.
565+
566+Produces
567+--------
568+
569+An atom.
570+
571+Source
572+------
573+
574+ +- wyt :: size of set
575+ |- ^- @
576+ ?~(a 0 +((add $(a l.a) $(a r.a))))
577+
578+
579+Examples
580+--------
581+
582+ ~zod/try=> =a (~(put in (~(put in (sa)) 'a')) 'b')
583+ ~zod/try=> ~(wyt in a)
584+ 2
585+ ~zod/try=> b
586+ {'bonita' 'madeleine' 'daniel' 'john'}
587+ ~zod/try=> ~(wyt in b)
588+ 4
589+
docs/system/hoon/library/src/2i/core/by.mdnew file+569
@@ -0,0 +1,569 @@
1+### `++by`
2+
3+Map operations
4+
5+ ++ by :: map engine
6+ ~/ %by
7+ |/ a=(map)
8+
9+Container arm for map operation arms. A map is a set of key, value
10+pairs. The contained arms inherit it's [sample]() [map](), `a`.
11+
12+`a` is a [map]().
13+
14+ ~zod/try=> ~(. by (mo (limo [%a 1] [%b 2] ~)))
15+ <19.irb [nlr([p={%a %b} q=@ud]) <414.rvm 101.jzo 1.ypj %164>]>
16+
17+------------------------------------------------------------------------
18+
19+### `+-all:by`
20+
21+Logical AND
22+
23+ +- all :: logical AND
24+ ~/ %all
25+ |* b=$+(* ?)
26+ |- ^- ?
27+ ?~ a
28+ &
29+ ?&((b q.n.a) $(a l.a) $(a r.a))
30+
31+Computes the logical AND on the results of slamming every element in map
32+`a` with gate `b`. Produces a loobean.
33+
34+`a` is a [map]().
35+
36+`b` is a [wet gate]().
37+
38+ ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
39+ ~zod/try=> (~(all by b) |=(a=* ?@(a & |)))
40+ %.n
41+ ~zod/try=> =a (mo `(list ,[@t @u])`[['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~])
42+ ~zod/try=> (~(all by a) |=(a=@ (lte a 6)))
43+ %.y
44+ ~zod/try=> (~(all by a) |=(a=@ (lte a 4)))
45+ %.n
46+
47+------------------------------------------------------------------------
48+
49+### `+-any:by`
50+
51+Logical OR
52+
53+ +- any :: logical OR
54+ ~/ %any
55+ |* b=$+(* ?)
56+ |- ^- ?
57+ ?~ a
58+ |
59+ ?|((b q.n.a) $(a l.a) $(a r.a))
60+
61+Computes the logical OR on the results of slamming every element with
62+gate `b`. Produces a loobean.
63+
64+`a` is a [map]().
65+
66+`b` is a [wet gate]().
67+
68+ ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
69+ ~zod/try=> (~(all by b) |=(a=* ?@(a & |)))
70+ %.y
71+ ~zod/try=> =a (mo `(list ,[@t @u])`[['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~])
72+ ~zod/try=> (~(any by a) |=(a=@ (lte a 4)))
73+ %.y
74+
75+------------------------------------------------------------------------
76+
77+### `+-del:by`
78+
79+Delete
80+
81+ +- del :: delete at key b
82+ ~/ %del
83+ |* b=*
84+ |- ^+ a
85+ ?~ a
86+ ~
87+ ?. =(b p.n.a)
88+ ?: (gor b p.n.a)
89+ [n.a $(a l.a) r.a]
90+ [n.a l.a $(a r.a)]
91+ |- ^- ?(~ _a)
92+ ?~ l.a r.a
93+ ?~ r.a l.a
94+ ?: (vor p.n.l.a p.n.r.a)
95+ [n.l.a l.l.a $(l.a r.l.a)]
96+ [n.r.a $(r.a l.r.a) r.r.a]
97+
98+Produces map `a` with the element located at key `b` removed.
99+
100+`a` is a [map]().
101+
102+`b` is a key as a [noun]().
103+
104+ ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
105+ ~zod/try=> (~(del by b) `a`)
106+ {[p=`b` q=[2 3]]}
107+
108+------------------------------------------------------------------------
109+
110+### `+-dig:by`
111+
112+Axis of key
113+
114+ +- dig :: axis of key
115+ |= b=*
116+ =+ c=1
117+ |- ^- (unit ,@)
118+ ?~ a ~
119+ ?: =(b p.n.a) [~ u=(peg c 2)]
120+ ?: (gor b p.n.a)
121+ $(a l.a, c (peg c 6))
122+ $(a r.a, c (peg c 7))
123+
124+Produce the axis of key `b` within map `a`.
125+
126+`a` is a [map]().
127+
128+`b` is a key as a [noun]().
129+
130+ ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
131+ ~zod/try=> (~(dig by b) `b`)
132+ [~ 2]
133+
134+------------------------------------------------------------------------
135+
136+### `+-gas:by`
137+
138+Concatenate
139+
140+ +- gas :: concatenate
141+ ~/ %gas
142+ |* b=(list ,[p=* q=*])
143+ => .(b `(list ,_?>(?=(^ a) n.a))`b)
144+ |- ^+ a
145+ ?~ b
146+ a
147+ $(b t.b, a (put(+< a) p.i.b q.i.b))
148+
149+Insert a list of key-value pairs `b` into map `a`.
150+
151+`a` is a [map]().
152+
153+`b` is a [list]() of [cells]() of key-value nouns `p` and `q`.
154+
155+ ~zod/try=> =a (mo `(list ,[@t *])`[[`a` 1] [`b` 2] ~])
156+ ~zod/try=> =b `(list ,[@t *])`[[`c` 3] [`d` 4] ~]
157+ ~zod/try=> (~(gas by a) b)
158+ {[p=`d` q=4] [p=`a` q=1] [p=`c` q=3] [p=`b` q=2]}
159+
160+------------------------------------------------------------------------
161+
162+### `+-get:by`
163+
164+Grab unit value
165+
166+ +- get :: unit value by key
167+ ~/ %get
168+ |* b=*
169+ |- ^- ?(~ [~ u=_?>(?=(^ a) q.n.a)])
170+ ?~ a
171+ ~
172+ ?: =(b p.n.a)
173+ [~ u=q.n.a]
174+ ?: (gor b p.n.a)
175+ $(a l.a)
176+ $(a r.a)
177+
178+Produce the unit value of the value located at key `b` within map `a`.
179+
180+`a` is a [map]()
181+
182+`b` is a [key]() as a [noun]()
183+
184+ ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
185+ ~zod/try=> (~(get by b) `b`)
186+ [~ [2 3]]
187+
188+------------------------------------------------------------------------
189+
190+### `+-got:by`
191+
192+Assert
193+
194+ +- got
195+ |* b=*
196+ %- need
197+ %- get(+< a) b
198+
199+Produce the value located at key `b` within map `a`. Crash if key `b`
200+does not exist.
201+
202+`a` is a [map]().
203+
204+`b` is a [key]().
205+
206+ ~zod/try=> =m (mo `(list ,[@t *])`[['a' 1] ['b' 2] ~])
207+ ~zod/try=> m
208+ {[p='a' q=1] [p='b' q=2]}
209+ ~zod/try=> (~(get by m) 'a')
210+ [~ 1]
211+ ~zod/try=> (~(got by m) 'a')
212+ 1
213+ ~zod/try=> (~(got by m) 'c')
214+ ! exit
215+
216+------------------------------------------------------------------------
217+
218+### `+-has:by`
219+
220+Key existence check
221+
222+ +- has :: key existence check
223+ ~/ %has
224+ |* b=*
225+ !=(~ (get(+< a) b))
226+
227+Checks whether map `a` contains an element with key `b`, producing a
228+loobean.
229+
230+`a` is a [map]().
231+
232+`b` is a key as a [noun]().
233+
234+ ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
235+ ~zod/try=> (~(has by b) `b`)
236+ %.y
237+ ~zod/try=> (~(has by b) `c`)
238+ %.n
239+
240+------------------------------------------------------------------------
241+
242+### `+-int:by`
243+
244+Intersection
245+
246+ +- int :: intersection
247+ ~/ %int
248+ |* b=_a
249+ |- ^+ a
250+ ?~ b
251+ ~
252+ ?~ a
253+ ~
254+ ?: (vor p.n.a p.n.b)
255+ ?: =(p.n.b p.n.a)
256+ [n.b $(a l.a, b l.b) $(a r.a, b r.b)]
257+ ?: (hor p.n.b p.n.a)
258+ %- uni(+< $(a l.a, b [n.b l.b ~])) $(b r.b)
259+ %- uni(+< $(a r.a, b [n.b ~ r.b])) $(b l.b)
260+ ?: =(p.n.a p.n.b)
261+ [n.b $(b l.b, a l.a) $(b r.b, a r.a)]
262+ ?: (hor p.n.a p.n.b)
263+ %- uni(+< $(b l.b, a [n.a l.a ~])) $(a r.a)
264+ %- uni(+< $(b r.b, a [n.a ~ r.a])) $(a l.a)
265+
266+Produces a map of the (key) intersection between two maps of the same
267+type, `a` and `b`. If both maps have an identical key that point to
268+different values, the element from map `b` is used.
269+
270+`a` is a [map]().
271+
272+`b` is a [map]().
273+
274+ ~zod/try=> =n (mo `(list ,[@t *])`[['a' 1] ['c' 3] ~])
275+ ~zod/try=> n
276+ {[p='a' q=1] [p='c' q=3]}
277+ ~zod/try=> m
278+ {[p='a' q=1] [p='b' q=2]}
279+ ~zod/try=> (~(int by m) n)
280+ {[p='a' q=1]}
281+ ~ravpel-holber/try=> =p (mo `(list ,[@t *])`[['a' 2] ['b' 2] ~])
282+ ~zod/try=> p
283+ {[p='a' q=2] [p='b' q=2]}
284+ ~zod/try=> (~(int by p) n)
285+ {[p='a' q=2]}
286+ ~zod/try=> =q (mo `(list ,[@t *])`[['a' 2] ['c' 2] ~])
287+ ~zod/try=> q
288+ {[p='a' q=2] [p='b' q=2]}
289+ ~zod/try=> (~(int by p) q)
290+ {[p='a' q=2] [p='b' q=2]}
291+ ~zod/try=> =o (mo `(list ,[@t *])`[['c' 3] ['d' 4] ~])
292+ ~zod/try=> (~(int by m) o)
293+ {}
294+
295+
296+------------------------------------------------------------------------
297+
298+### `+-mar:by`
299+
300+Assert and Add
301+
302+ +- mar :: add with validation
303+ |* [b=_?>(?=(^ a) p.n.a) c=(unit ,_?>(?=(^ a) q.n.a))]
304+ ?~ c
305+ (del b)
306+ (put b u.c)
307+
308+Produces map `a` with the addition of a key-value pair, where the value
309+is a nonempty unit.
310+
311+Accept a noun and a unit of a noun of the type of the map's keys and
312+values, respectively. Validate that the value is not null and put the
313+pair in the map. If the value is null, delete the key.
314+
315+XX This arm is broken, asana task 15186618346453
316+
317+ ~zod/try=> m
318+ {[p='a' q=1] [p='b' q=2]}
319+ ~zod/try=> (~(mar by m) 'c' (some 3))
320+ ! -find-limb.n
321+ ! find-none
322+ ! exit
323+ ~zod/try=> (~(mar by m) 'c' ~)
324+ ! -find-limb.n
325+ ! find-none
326+ ! exit
327+ ~zod/try=> (~(mar by m) 'b' ~)
328+ ! -find-limb.n
329+ ! find-none
330+ ! exit
331+
332+------------------------------------------------------------------------
333+
334+### `+-put:by`
335+
336+Add key-value pair
337+
338+ +- put :: adds key-value pair
339+ ~/ %put
340+ |* [b=* c=*]
341+ |- ^+ a
342+ ?~ a
343+ [[b c] ~ ~]
344+ ?: =(b p.n.a)
345+ ?: =(c q.n.a)
346+ a
347+ [[b c] l.a r.a]
348+ ?: (gor b p.n.a)
349+ =+ d=$(a l.a)
350+ ?> ?=(^ d)
351+ ?: (vor p.n.a p.n.d)
352+ [n.a d r.a]
353+ [n.d l.d [n.a r.d r.a]]
354+ =+ d=$(a r.a)
355+ ?> ?=(^ d)
356+ ?: (vor p.n.a p.n.d)
357+ [n.a l.a d]
358+ [n.d [n.a l.a l.d] r.d]
359+
360+Produces `a` with the addition of the key-value pair of `b` and `c`.
361+
362+`a` is a [map]().
363+
364+`b` is a key of the same type as the keys in `a`.
365+
366+`c` is a value of the same type of the values in `a`.
367+
368+ ~zod/try=> m
369+ {[p='a' q=1] [p='b' q=2]}
370+ ~zod/try=> (~(put by m) 'c' 3)
371+ {[p='a' q=1] [p='c' q=3] [p='b' q=2]}
372+ ~zod/try=> (~(put by m) "zod" 26)
373+ ! type-fail
374+ ! exit
375+ ~zod/try=> (~(put by m) 'a' 2)
376+ {[p='a' q=2] [p='b' q=2]}
377+
378+------------------------------------------------------------------------
379+
380+### `+-rep:by`
381+
382+ +- rep :: replace by product
383+ |* [b=* c=_,*]
384+ |-
385+ ?~ a b
386+ $(a r.a, b $(a l.a, b (c q.n.a b)))
387+
388+Accumulate using gate from values in map
389+
390+XX interface changing.
391+
392+------------------------------------------------------------------------
393+
394+### `+-rib:by`
395+
396+ +- rib :: transform + product
397+ |* [b=* c=_,*]
398+ |- ^+ [b a]
399+ ?~ a [b ~]
400+ =+ d=(c n.a b)
401+ =. n.a +.d
402+ =+ e=$(a l.a, b -.d)
403+ =+ f=$(a r.a, b -.e)
404+ [-.f [n.a +.e +.f]]
405+
406+Replace values with accumulator
407+
408+XX interface changing, possibly disappearing
409+
410+------------------------------------------------------------------------
411+
412+### `+-run:by`
413+
414+Transform values
415+
416+ +- run :: turns to tuples
417+ |* b=_,*
418+ |-
419+ ?~ a a
420+ a(n (b q.n.a), l $(a l.a), r $(a r.a))
421+
422+Iterates over every value in set `a` using gate `b`. Produces a map.
423+
424+`a` is a [map]().
425+
426+`b` is a [wet gate]().
427+
428+ ~zod/try=> m
429+ {[p='a' q=1] [p='b' q=2]}
430+ ~zod/try=> ^+(m (~(run by m) dec))
431+ {[p='a' q=0] [p='b' q=1]}
432+ ~zod/try=> `(map ,@tas ,@t)`(~(run by m) (cury scot %ux))
433+ {[p=%a q='0x1'] [p=%b q='0x2']}
434+
435+------------------------------------------------------------------------
436+
437+### `+-tap:by`
438+
439+Listify pairs
440+
441+ +- tap :: listify pairs
442+ ~/ %tap
443+ |= b=(list ,_?>(?=(^ a) n.a))
444+ ^+ b
445+ ?~ a
446+ b
447+ $(a r.a, b [n.a $(a l.a)])
448+
449+Produces the list of all elements in map `a` that is prepended to list
450+`b`, which is empty by default.
451+
452+`a` is a [map]().
453+
454+`b` is a [list]().
455+
456+ {[p='a' q=1] [p='b' q=2]}
457+ ~zod/try=> `*`m
458+ [[98 2] [[97 1] 0 0] 0]
459+ ~zod/try=> (~(tap by m))
460+ ~[[p='b' q=2] [p='a' q=1]]
461+ ~zod/try=> `*`(~(tap by m))
462+ [[98 2] [97 1] 0]
463+
464+------------------------------------------------------------------------
465+
466+### `+-uni:by`
467+
468+Union
469+
470+ +- uni :: union, merge
471+ ~/ %uni
472+ |* b=_a
473+ |- ^+ a
474+ ?~ b
475+ a
476+ ?~ a
477+ b
478+ ?: (vor p.n.a p.n.b)
479+ ?: =(p.n.b p.n.a)
480+ [n.b $(a l.a, b l.b) $(a r.a, b r.b)]
481+ ?: (hor p.n.b p.n.a)
482+ $(a [n.a $(a l.a, b [n.b l.b ~]) r.a], b r.b)
483+ $(a [n.a l.a $(a r.a, b [n.b ~ r.b])], b l.b)
484+ ?: =(p.n.a p.n.b)
485+ [n.b $(b l.b, a l.a) $(b r.b, a r.a)]
486+ ?: (hor p.n.a p.n.b)
487+ $(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
488+ $(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
489+
490+Produces a map of the union between the keys of `a` and `b`. If `b`
491+shares a key with `a`, the tuple from `a` is preserved.
492+
493+`a` is a [map]().
494+
495+`b` is a [map]().
496+
497+ ~zod/try=> m
498+ {[p='a' q=1] [p='b' q=2]}
499+ ~zod/try=> o
500+ {[p='d' q=4] [p='c' q=3]}
501+ ~zod/try=> (~(uni by m) o)
502+ {[p='d' q=4] [p='a' q=1] [p='c' q=3] [p='b' q=2]}
503+ ~zod/try=> (~(uni by m) ~)
504+ {[p='a' q=1] [p='b' q=2]}
505+ ~zod/try=> n
506+ {[p='a' q=1] [p='c' q=9]}
507+ ~zod/try=> (~(uni by o) n)
508+ {[p='d' q=4] [p='a' q=1] [p='c' q=3]}
509+ ~zod/try=> =n (mo `(list ,[@t *])`[['a' 1] ['c' 9] ~])
510+ ~zod/try=> n
511+ {[p='a' q=1] [p='c' q=9]}
512+ ~zod/try=> (~(uni by o) n)
513+ {[p='d' q=4] [p='a' q=1] [p='c' q=9]}
514+
515+------------------------------------------------------------------------
516+
517+### `+-urn:by`
518+
519+Turn (with key)
520+
521+ +- urn :: turn
522+ |* b=$+([* *] *)
523+ |-
524+ ?~ a ~
525+ [n=[p=p.n.a q=(b p.n.a q.n.a)] l=$(a l.a) r=$(a r.a)]
526+
527+Iterates over every value in map `a` using gate `b`, which accepts both
528+the key and the value of each element as its sample.
529+
530+`a` is a [map]().
531+
532+`b` is a [wet gate]() that accepts two nouns (a key and a value) and
533+produces a noun (the new value).
534+
535+ ~zod/try=> m
536+ {[p='a' q=1] [p='b' q=2]}
537+ ~zod/try=> (~(urn by m) |=(a=[p=* q=*] q.a))
538+ {[p='a' q=1] [p='b' q=2]}
539+ ~zod/try=> (~(urn by m) |=(a=[p=* q=*] 7))
540+ {[p='a' q=7] [p='b' q=7]}
541+ ~zod/try=> (~(urn by m) |=(a=[p=* q=*] p.a))
542+ {[p='a' q=97] [p='b' q=98]}
543+
544+------------------------------------------------------------------------
545+
546+### `+-wyt:by`
547+
548+Depth
549+
550+ +- wyt :: depth of map
551+ |- ^- @
552+ ?~(a 0 +((add $(a l.a) $(a r.a))))
553+
554+Produce the depth of the tree map `a`.
555+
556+`a` is a [map]().
557+
558+ ~zod/try=> m
559+ {[p='a' q=1] [p='b' q=2]}
560+ ~zod/try=> o
561+ {[p='d' q=4] [p='c' q=3]}
562+ ~zod/try=> ~(wyt by m)
563+ 2
564+ ~zod/try=> ~(wyt by o)
565+ 2
566+ ~zod/try=> ~(wyt by (~(uni by m) o))
567+ 4
568+
569+
docs/system/hoon/library/src/2j/core/ja.mdnew file+229
@@ -0,0 +1,229 @@
1+### `++ja`
2+
3+Jar engine
4+
5+ ++ ja :: jar engine
6+ |/ a=(jar)
7+
8+A container arm for `++jar` operation arms. A `++jar` is a `++map` of
9+`++list`s. The contained arms inherit the [sample]() jar.
10+
11+`a` is a [jar]().
12+
13+ ~zod/try=> ~(. ja (mo (limo a/"ho" b/"he" ~)))
14+ <2.dgz [nlr([p={%a %b} q=""]) <414.fvk 101.jzo 1.ypj %164>]>
15+
16+------------------------------------------------------------------------
17+
18+### `+-get:ja`
19+
20+Grab value by key
21+
22+ +- get :: grab value by key
23+ |* b=*
24+ =+ c=(~(get by a) b)
25+ ?~(c ~ u.c)
26+
27+Produces a list retrieved from jar `a` using the key `b`.
28+
29+`a` is a [`++jar`](/doc/hoon/library/1#++jar).
30+
31+`b` is a key of the same type as the keys in `a`.
32+
33+ ~zod/try=> =l (mo `(list ,[@t (list ,@)])`[['a' `(list ,@)`[1 2 3 ~]] ['b' `(list ,@)`[4 5 6 ~]] ~])
34+ ~zod/try=> l
35+ {[p='a' q=~[1 2 3]] [p='b' q=~[4 5 6]]}
36+ ~zod/try=> (~(get ja l) 'a')
37+ ~[1 2 3]
38+ ~zod/try=> (~(get ja l) 'b')
39+ ~[4 5 6]
40+ ~zod/try=> (~(get ja l) 'c')
41+ ~
42+
43+------------------------------------------------------------------------
44+
45+### `+-add:ja`
46+
47+Prepend to list
48+
49+ +- add :: adds key-list pair
50+ |* [b=* c=*]
51+ =+ d=(get(+< a) b)
52+ (~(put by a) b [c d])
53+
54+Produces jar `a` with value `c` prepended to the list located at key
55+`b`.
56+
57+`a` is a [jar]().
58+
59+`b` is a key of the same type as the keys in `a`.
60+
61+`c` is a value of the same type as the values in `a`.
62+
63+ ~zod/try=> =l (mo `(list ,[@t (list ,@)])`[['a' `(list ,@)`[1 2 3 ~]] ['b' `(list ,@)`[4 5 6 ~]] ~])
64+ ~zod/try=> l
65+ {[p='a' q=~[1 2 3]] [p='b' q=~[4 5 6]]}
66+ ~zod/try=> (~(add ja l) 'b' 7)
67+ {[p='a' q=~[1 2 3]] [p='b' q=~[7 4 5 6]]}
68+ ~zod/try=> (~(add ja l) 'a' 100)
69+ {[p='a' q=~[100 1 2 3]] [p='b' q=~[4 5 6]]}
70+ ~zod/try=> (~(add ja l) 'c' 7)
71+ {[p='a' q=~[1 2 3]] [p='c' q=~[7]] [p='b' q=~[4 5 6]]}
72+ ~zod/try=> (~(add ja l) 'c' `(list ,@)`[7 8 9 ~])
73+ ! type-fail
74+ ! exit
75+
76+------------------------------------------------------------------------
77+
78+### `++ju`
79+
80+Jug operations
81+
82+ ++ ju :: jug engine
83+ |/ a=(jug)
84+
85+Container arm for jug operation arms. A `++jug` is a `++map` of
86+`++sets`. The contained arms inherit its [sample]() jug, `a`.
87+
88+`a` is a [jug]().
89+
90+ ~zod/try=> ~(. ju (mo (limo a/(sa "ho") b/(sa "he") ~)))
91+ <2.dgz [nlr([p={%a %b} q={nlr(^$1{@tD $1}) nlr(^$3{@tD $3})}]) <414.fvk 101.jzo 1.ypj %164>]>
92+
93+### `+-del:ju`
94+
95+Remove
96+
97+ +- del :: delete at key b
98+ |* [b=* c=*]
99+ ^+ a
100+ =+ d=(get(+< a) b)
101+ =+ e=(~(del in d) c)
102+ ?~ e
103+ (~(del by a) b)
104+ (~(put by a) b e)
105+
106+Produces jug `a` with value `c` removed from set located at key `b`.
107+
108+`a` is a [jug]().
109+
110+`b` is a key of the same type as the keys in `a`.
111+
112+`c` is the value of the same type of the keys in `a` that is to be
113+removed.
114+
115+ ~zod/try=> s
116+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
117+ ~zod/try=> (~(del ju s) 'a' 1)
118+ {[p='a' q={3 2}] [p='b' q={5 4 6}]}
119+ ~zod/try=> (~(del ju s) 'c' 7)
120+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
121+
122+------------------------------------------------------------------------
123+
124+### `+-get:ju`
125+
126+Retrieve set
127+
128+ +- get :: gets set by key
129+ |* b=*
130+ =+ c=(~(get by a) b)
131+ ?~(c ~ u.c)
132+
133+Produces a set retrieved from jar `a` using key `b`.
134+
135+`a` is a [jar]().
136+
137+`b` is a key of the same type as the keys in `a`.
138+
139+ ~zod/try=> s
140+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
141+ ~zod/try=> (~(get ju s) 'a')
142+ {1 3 2}
143+ ~zod/try=> (~(get ju s) 'b')
144+ {5 4 6}
145+ ~zod/try=> (~(get ju s) 'c')
146+ ~
147+
148+------------------------------------------------------------------------
149+
150+### `+-has:ju`
151+
152+Check contents
153+
154+ +- has :: existence check
155+ |* [b=* c=*]
156+ ^- ?
157+ (~(has in (get(+< a) b)) c)
158+
159+Computes whether a value `c` exists within the set located at key `b`
160+with jar `a`. Produces a loobean.
161+
162+`a` is a [set]().
163+
164+`b` is a key as a [noun]().
165+
166+`c` is a value as a [noun]().
167+
168+ ~zod/try=> s
169+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
170+ ~zod/try=> (~(has ju s) 'a' 3)
171+ %.y
172+ ~zod/try=> (~(has ju s) 'b' 6)
173+ %.y
174+ ~zod/try=> (~(has ju s) 'a' 7)
175+ %.n
176+ ~zod/try=> (~(has jus s) 'c' 7)
177+ ! -find-limb.jus
178+ ! find-none
179+ ! exit
180+ ~zod/try=> (~(has ju s) 'c' 7)
181+ %.n
182+
183+------------------------------------------------------------------------
184+
185+### `+-put:ju`
186+
187+Add key-set pair
188+
189+ +- put :: adds key-element pair
190+ |* [b=* c=*]
191+ ^+ a
192+ =+ d=(get(+< a) b)
193+ (~(put by a) b (~(put in d) c))
194+
195+Produces jar `a` with `c` added to the set value located at key `b`.
196+
197+`a` is a [set]().
198+
199+`b` is a key as a [noun]().
200+
201+`c` is a [value]().
202+
203+ ~zod/try=> s
204+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
205+ ~zod/try=> (~(put ju s) 'a' 7)
206+ {[p='a' q={7 1 3 2}] [p='b' q={5 4 6}]}
207+ ~zod/try=> (~(put ju s) 'a' 1)
208+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
209+ ~zod/try=> (~(put ju s) 'c' 7)
210+ {[p='a' q={1 3 2}] [p='c' q={7}] [p='b' q={5 4 6}]}
211+
212+------------------------------------------------------------------------
213+
214+### `++by`
215+
216+Map operations
217+
218+ ++ by :: map engine
219+ ~/ %by
220+ |/ a=(map)
221+
222+Container arm for map operation arms. A map is a set of key, value
223+pairs. The contained arms inherit it's [sample]() [map](), `a`.
224+
225+`a` is a [map]().
226+
227+ ~zod/try=> ~(. by (mo (limo [%a 1] [%b 2] ~)))
228+ <19.irb [nlr([p={%a %b} q=@ud]) <414.rvm 101.jzo 1.ypj %164>]>
229+
docs/system/hoon/library/src/2j/core/ju.mdnew file+135
@@ -0,0 +1,135 @@
1+### `++ju`
2+
3+Jug operations
4+
5+ ++ ju :: jug engine
6+ |/ a=(jug)
7+
8+Container arm for jug operation arms. A `++jug` is a `++map` of
9+`++sets`. The contained arms inherit its [sample]() jug, `a`.
10+
11+`a` is a [jug]().
12+
13+ ~zod/try=> ~(. ju (mo (limo a/(sa "ho") b/(sa "he") ~)))
14+ <2.dgz [nlr([p={%a %b} q={nlr(^$1{@tD $1}) nlr(^$3{@tD $3})}]) <414.fvk 101.jzo 1.ypj %164>]>
15+
16+### `+-del:ju`
17+
18+Remove
19+
20+ +- del :: delete at key b
21+ |* [b=* c=*]
22+ ^+ a
23+ =+ d=(get(+< a) b)
24+ =+ e=(~(del in d) c)
25+ ?~ e
26+ (~(del by a) b)
27+ (~(put by a) b e)
28+
29+Produces jug `a` with value `c` removed from set located at key `b`.
30+
31+`a` is a [jug]().
32+
33+`b` is a key of the same type as the keys in `a`.
34+
35+`c` is the value of the same type of the keys in `a` that is to be
36+removed.
37+
38+ ~zod/try=> s
39+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
40+ ~zod/try=> (~(del ju s) 'a' 1)
41+ {[p='a' q={3 2}] [p='b' q={5 4 6}]}
42+ ~zod/try=> (~(del ju s) 'c' 7)
43+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
44+
45+------------------------------------------------------------------------
46+
47+### `+-get:ju`
48+
49+Retrieve set
50+
51+ +- get :: gets set by key
52+ |* b=*
53+ =+ c=(~(get by a) b)
54+ ?~(c ~ u.c)
55+
56+Produces a set retrieved from jar `a` using key `b`.
57+
58+`a` is a [jar]().
59+
60+`b` is a key of the same type as the keys in `a`.
61+
62+ ~zod/try=> s
63+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
64+ ~zod/try=> (~(get ju s) 'a')
65+ {1 3 2}
66+ ~zod/try=> (~(get ju s) 'b')
67+ {5 4 6}
68+ ~zod/try=> (~(get ju s) 'c')
69+ ~
70+
71+------------------------------------------------------------------------
72+
73+### `+-has:ju`
74+
75+Check contents
76+
77+ +- has :: existence check
78+ |* [b=* c=*]
79+ ^- ?
80+ (~(has in (get(+< a) b)) c)
81+
82+Computes whether a value `c` exists within the set located at key `b`
83+with jar `a`. Produces a loobean.
84+
85+`a` is a [set]().
86+
87+`b` is a key as a [noun]().
88+
89+`c` is a value as a [noun]().
90+
91+ ~zod/try=> s
92+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
93+ ~zod/try=> (~(has ju s) 'a' 3)
94+ %.y
95+ ~zod/try=> (~(has ju s) 'b' 6)
96+ %.y
97+ ~zod/try=> (~(has ju s) 'a' 7)
98+ %.n
99+ ~zod/try=> (~(has jus s) 'c' 7)
100+ ! -find-limb.jus
101+ ! find-none
102+ ! exit
103+ ~zod/try=> (~(has ju s) 'c' 7)
104+ %.n
105+
106+------------------------------------------------------------------------
107+
108+### `+-put:ju`
109+
110+Add key-set pair
111+
112+ +- put :: adds key-element pair
113+ |* [b=* c=*]
114+ ^+ a
115+ =+ d=(get(+< a) b)
116+ (~(put by a) b (~(put in d) c))
117+
118+Produces jar `a` with `c` added to the set value located at key `b`.
119+
120+`a` is a [set]().
121+
122+`b` is a key as a [noun]().
123+
124+`c` is a [value]().
125+
126+ ~zod/try=> s
127+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
128+ ~zod/try=> (~(put ju s) 'a' 7)
129+ {[p='a' q={7 1 3 2}] [p='b' q={5 4 6}]}
130+ ~zod/try=> (~(put ju s) 'a' 1)
131+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
132+ ~zod/try=> (~(put ju s) 'c' 7)
133+ {[p='a' q={1 3 2}] [p='c' q={7}] [p='b' q={5 4 6}]}
134+
135+
docs/system/hoon/library/src/2k/core/to.mdnew file+331
@@ -0,0 +1,331 @@
1+### `++to`
2+
3+Queue operations
4+
5+Container arm for queue operation arms. The contained arms inherit its
6+[sample]() `++qeu` `a`.
7+
8+Accepts
9+-------
10+
11+`a` is a queue, [++qeu]().
12+
13+Source
14+------
15+
16+ ++ to :: queue engine
17+ |/ a=(qeu)
18+
19+### `+-bal:to`
20+
21+Balance
22+
23+Vertically rebalances queue `a`.
24+
25+Accepts
26+-------
27+
28+`a` is a [queue]().
29+
30+Produces
31+--------
32+
33+A [queue]().
34+
35+Source
36+------
37+
38+ +- bal
39+ |- ^+ a
40+ ?~ a ~
41+ ?. |(?=(~ l.a) (vor n.a n.l.a))
42+ $(a [n.l.a l.l.a $(a [n.a r.l.a r.a])])
43+ ?. |(?=(~ r.a) (vor n.a n.r.a))
44+ $(a [n.r.a $(a [n.a l.a l.r.a]) r.r.a])
45+ a
46+ ::
47+
48+Examples
49+--------
50+
51+ ~zod/try=> `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~]
52+ {"a" "b" "c" "d" "e" "f" "g"}
53+ ~zod/try=> `*`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~]
54+ [[97 0] 0 [98 0] 0 [99 0] 0 [100 0] 0 [101 0] 0 [102 0] 0 [103 0] 0 0]
55+ ~zod/try=> ~(bal to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~])
56+ {"a" "b" "c" "d" "e" "f" "g"}
57+ ~zod/try=> `*`~(bal to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~])
58+ [[100 0] [[99 0] [[98 0] [[97 0] 0 0] 0] 0] [101 0] 0 [102 0] 0 [103 0] 0 0]
59+
60+------------------------------------------------------------------------
61+
62+### `+-dep:to`
63+
64+Maximum Depth
65+
66+Produces the maximum depth of leaves (r.a and l.a) in queue `a`.
67+
68+Accepts
69+-------
70+
71+`a` is a [queue]().
72+
73+Produces
74+--------
75+
76+An atom.
77+
78+Source
79+------
80+
81+ +- dep :: max depth of queue
82+ |- ^- @
83+ ?~ a 0
84+ +((max $(a l.a) $(a r.a)))
85+ ::
86+
87+Examples
88+--------
89+
90+ ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 5 6 7 ~])
91+ ~zod/try=> ~(dep to a)
92+ 4
93+ ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 ~])
94+ ~zod/try=> ~(dep to a)
95+ 3
96+ ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 ~])
97+ ~zod/try=> ~(dep to a)
98+ 2
99+ ~zod/try=> ~(dep to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~])
100+ 7
101+ ~zod/try=> ~(dep to ~(bal to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~]))
102+ 4
103+
104+------------------------------------------------------------------------
105+
106+### `+-gas`
107+
108+Push list
109+
110+Push all elements of [`++list`]() `b` into the [`++queue`]().
111+
112+Accepts
113+-------
114+
115+`a` is a queue.
116+
117+`b` is a list.
118+
119+Produces
120+--------
121+
122+A queue.
123+
124+Source
125+------
126+
127+ +- gas :: insert list to queue
128+ |= b=(list ,_?>(?=(^ a) n.a))
129+ |- ^+ a
130+ ?~(b a $(b t.b, a (put(+< a) i.b)))
131+ ::
132+
133+Examples
134+--------
135+
136+ ~zod/try=> (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 ~])
137+ {3 2 1}
138+ ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 ~])
139+ ~zod/try=> =b `(list ,@)`[4 5 6 ~]
140+ ~zod/try=> (~(gas to a) b)
141+ {6 5 4 3 2 1}
142+
143+------------------------------------------------------------------------
144+
145+### `+-get:to`
146+
147+Pop
148+
149+Produces the head and tail [`++queue`]() of `a`.
150+
151+Accepts
152+-------
153+
154+`a` is a queue.
155+
156+Produces
157+--------
158+
159+The last element in `a` along with the rest of queue `a`.
160+
161+Source
162+------
163+
164+ +- get :: head-tail pair
165+ |- ^+ [p=?>(?=(^ a) n.a) q=a]
166+ ?~ a
167+ !!
168+ ?~ r.a
169+ [n.a l.a]
170+ =+ b=$(a r.a)
171+ :- p.b
172+ ?: |(?=(~ q.b) (vor n.a n.q.b))
173+ [n.a l.a q.b]
174+ [n.q.b [n.a l.a l.q.b] r.q.b]
175+ ::
176+
177+Examples
178+--------
179+
180+ ~zod/try=> =s (~(gas to *(qeu ,@)) `(list ,@)`~[1 2 3])
181+ ~zod/try=> ~(get to s)
182+ [p=1 q={3 2}]
183+ ~zod/try=> ~(get to ~)
184+ ! exit
185+
186+------------------------------------------------------------------------
187+
188+### `+-nap:to`
189+
190+Remove last element
191+
192+Removes the head of [`++queue`]() `a`, producing the resulting queue.
193+
194+Accepts
195+-------
196+
197+`a` is a [queue]().
198+
199+Produces
200+--------
201+
202+A queue.
203+
204+Source
205+------
206+
207+ +- nap :: removes head
208+ ?> ?=(^ a)
209+ ?: =(~ l.a) r.a
210+ =+ b=get(+< l.a)
211+ bal(+< ^+(a [p.b q.b r.a]))
212+ ::
213+
214+Examples
215+--------
216+
217+ ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 5 6 ~])
218+ ~zod/try=> -.a
219+ n=6
220+ ~zod/try=> =b ~(nap to a)
221+ ~zod/try=> -.b
222+ n=2
223+ ~zod/try=> b
224+ {5 4 3 2 1}
225+ ~zod/try=> a
226+ {6 5 4 3 2 1}
227+
228+------------------------------------------------------------------------
229+
230+### `+-put:to`
231+
232+Insert
233+
234+Accept any [noun]() `b` and adds to [`++queue`]() `a` as the head, producing the
235+resulting queue.
236+
237+Accepts
238+-------
239+
240+`a` is a [queue]().
241+
242+`b` is any noun.
243+
244+Produces
245+--------
246+
247+A queue.
248+
249+Source
250+------
251+
252+ +- put :: insert new tail
253+ |* b=*
254+ |- ^+ a
255+ ?~ a
256+ [b ~ ~]
257+ bal(+< a(l $(a l.a)))
258+ ::
259+
260+Examples
261+--------
262+
263+ ~zod/try=> (~(gas to `(qeu ,@)`~) `(list ,@)`[3 1 2 4 5 6 ~])
264+ ~zod/try=> (~(put to a) 7)
265+ {7 6 5 4 2 1 3}
266+
267+------------------------------------------------------------------------
268+
269+### `+-tap:to`
270+
271+Queue to list
272+
273+Produces [`++queue`]() `a` as a [`++list`]() from front to back.
274+
275+Accepts
276+-------
277+
278+`a` is a [queue]().
279+
280+Source
281+------
282+
283+ +- tap :: queue to list
284+ |= b=(list ,_?>(?=(^ a) n.a))
285+ ^+ b
286+ ?~ a
287+ b
288+ $(a r.a, b [n.a $(a l.a)])
289+ ::
290+
291+Examples
292+--------
293+
294+ ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[3 1 2 4 5 6 ~])
295+ ~zod/try=> `*`a
296+ [6 0 2 [4 [5 0 0] 0] 1 0 3 0 0]
297+ ~zod/try=> (~(tap to a) `(list ,@)`[99 100 101 ~])
298+ ~[3 1 2 4 5 6 99 100 101]
299+
300+------------------------------------------------------------------------
301+
302+### `+-top:to`
303+
304+Produces the head of [`++queue`]() `a` as a [`++unit`]() (an empty queue has no head).
305+
306+Accepts
307+-------
308+
309+`a` is a [queue]().
310+
311+Produces
312+--------
313+
314+A unit.
315+
316+Source
317+------
318+
319+ +- top :: produces head
320+ |- ^- (unit ,_?>(?=(^ a) n.a))
321+ ?~ a ~
322+ ?~(r.a [~ n.a] $(a r.a))
323+
324+Examples
325+--------
326+
327+ ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 5 6 ~])
328+ ~zod/try=> ~(top to a)
329+ [~ 1]
330+
331+
docs/system/hoon/library/src/2n/gate/cork.mdnew file+25
@@ -0,0 +1,25 @@
1+### `++cork`
2+
3+Build `f` such that `(f x) .= (b (a x))`.
4+
5+`a` is a noun.
6+
7+`b` is a gate.
8+
9+Source
10+------
11+
12+ ++ cork |*([a=_,* b=gate] (corl b a)) :: compose forward
13+
14+Examples
15+--------
16+
17+ ~zod/try=> (:(cork dec dec dec) 20)
18+ 17
19+ ~zod/try=> =mal (mo (limo a/15 b/23 ~))
20+ ~zod/try=> ((cork ~(got by mal) dec) %a)
21+ 14
22+ ~zod/try=> ((cork ~(got by mal) dec) %b)
23+ 22
24+
25+
docs/system/hoon/library/src/2n/gate/corl.mdnew file+25
@@ -0,0 +1,25 @@
1+### `++corl`
2+
3+Gate compose
4+
5+XX Revisit
6+
7+`a` is a gate.
8+
9+`b` is a noun.
10+
11+Source
12+------
13+
14+ ++ corl :: compose backwards
15+ |* [a=gate b=_,*]
16+ |= c=_+<.b
17+ (a (b c))
18+
19+Examples
20+--------
21+
22+ ~zod/try=> ((corl (lift bex) (slat %ud)) '2')
23+ [~ 4]
24+
25+
docs/system/hoon/library/src/2n/gate/curr.mdnew file+35
@@ -0,0 +1,35 @@
1+### `++curr`
2+
3+Right curry
4+
5+Right curry a gate, binding the tail of its sample
6+
7+Accepts
8+-------
9+
10+`a` is a [gate]().
11+
12+`c` is a [noun]().
13+
14+Produces
15+--------
16+
17+
18+Source
19+------
20+
21+ ++ curr
22+ |* [a=_|=(^ _*) c=*]
23+ |* b=_+<+.a
24+ (a b c)
25+
26+Examples
27+--------
28+
29+ ~zod/try=> =tep (curr scan sym)
30+ ~zod/try=> `@t`(tep "asd")
31+ 'asd'
32+ ~zod/try=> `@t`(tep "lek-om")
33+ 'lek-om'
34+
35+
docs/system/hoon/library/src/2n/gate/cury.mdnew file+34
@@ -0,0 +1,34 @@
1+### `++cury`
2+
3+Curry a gate, binding the head of its sample
4+
5+Accepts
6+-------
7+
8+`a` is a [gate]().
9+
10+`b` is a [noun]().
11+
12+Produces
13+--------
14+
15+A [gate]().
16+
17+Source
18+------
19+
20+ ++ cury
21+ |* [a=_|=(^ _*) b=*]
22+ |* c=_+<+.a
23+ (a b c)
24+
25+Examples
26+--------
27+
28+ ~zod/try=> =mol (cury add 2)
29+ ~zod/try=> (mol 4)
30+ 6
31+ ~zod/try=> (mol 7)
32+ 9
33+
34+
docs/system/hoon/library/src/2n/gate/hard.mdnew file+29
@@ -0,0 +1,29 @@
1+### `++hard`
2+
3+Demands that a specific type be produced, crashing the program is it is
4+not.
5+
6+Source
7+------
8+
9+ ++ hard
10+ |* han=$+(* *)
11+ |= fud=* ^- han
12+ ~| %hard
13+ =+ gol=(han fud)
14+ ?>(=(gol fud) gol)
15+
16+Examples
17+--------
18+
19+ ~zod/try=> ((hard (list)) (limo [1 2 3 ~]))
20+ ~[1 2 3]
21+ ~zod/try=> ((hard ,@) (add 2 2))
22+ 4
23+ ~zod/try=> ((hard ,@t) (crip "Tape to cord, bro!"))
24+ 'Tape to cord, bro'
25+ ~zod/try=> ((hard tape) (crip "...Tape to cord, bro?..."))
26+ ! hard
27+ ! exit
28+
29+
docs/system/hoon/library/src/2n/gate/soft.mdnew file+29
@@ -0,0 +1,29 @@
1+### `++soft`
2+
3+Politely requests a specific type to be produced, producing null if it
4+is not.
5+
6+Source
7+------
8+
9+ ++ soft
10+ |* han=$+(* *)
11+ |= fud=* ^- (unit han)
12+ =+ gol=(han fud)
13+ ?.(=(gol fud) ~ [~ gol])
14+
15+Examples
16+--------
17+
18+ ~zod/try=> ((soft ,%4) (add 2 2))
19+ [~ %4]
20+ ~zod/try=> ((soft ,@) (add 2 2))
21+ [~ 4]
22+ ~zod/try=> ((soft ,%5) (add 2 2))
23+ ~
24+ ~zod/try=> ((soft ,@t) (crip "Tape to cord, Woohoo!"))
25+ [~ 'Tape to cord, Woohoo!']
26+ ~zod/try=> ((soft ,@t) (trip 'Cmon man... Tape to cord? Please?!'))
27+ ~
28+
29+
docs/system/hoon/library/src/2o/mold/jar.mdnew file+30
@@ -0,0 +1,30 @@
1+### `++jar`
2+
3+
4+Tile generator. A [`++jar`]() is a [`++map`]() of [`++list`]().
5+
6+Source
7+------
8+
9+ ++ jar |*([a=_,* b=_,*] (map a (list b))) :: map of lists
10+
11+Examples
12+--------
13+
14+See also: [`++ja`](), [`++by`](), [`++map`](), [`++list`]()
15+
16+ ~zod/try=> =a (limo [1 2 ~])
17+ ~zod/try=> a
18+ [i=1 t=[i=2 t=~]]
19+ ~zod/try=> =b (limo [3 4 ~])
20+ ~zod/try=> b
21+ [i=3 t=[i=4 t=~]]
22+ ~zod/try=> =c (mo (limo [[%a a] [%b b] ~]))
23+ ~zod/try=> c
24+ {[p=%a q=[i=1 t=[i=2 t=~]]] [p=%b q=[i=3 t=[i=4 t=~]]]}
25+ ~zod/try=> (~(get ja c) %a)
26+ [i=1 t=[i=2 t=~]]
27+ ~zod/try=> (~(get ja c) %c)
28+ ~
29+
30+
docs/system/hoon/library/src/2o/mold/jug.mdnew file+28
@@ -0,0 +1,28 @@
1+### `++jug`
2+
3+[mold]() generator. A `++jug` is a [`++map`]() of [`++set`]()s.
4+
5+Source
6+------
7+
8+ ++ jug |*([a=_,* b=_,*] (map a (set b))) :: map of sets
9+
10+Examples
11+--------
12+
13+See also: `++ju`, `++by`, `++map`, `++set`
14+
15+ ~zod/try=> =a (sa (limo [1 2 ~]))
16+ ~zod/try=> a
17+ {1 2}
18+ ~zod/try=> =b (sa (limo [3 4 ~]))
19+ ~zod/try=> b
20+ {4 3}
21+ ~zod/try=> =c (mo (limo [[%a a] [%b b] ~]))
22+ ~zod/try=> c
23+ {[p=%a q={1 2}] [p=%b q={4 3}]}
24+ ~zod/try=> (~(get ju c) %b)
25+ {4 3}
26+ ~zod/try=> (~(put ju c) [%b 5])
27+ {[p=%a q={1 2}] [p=%b q={5 4 3}]}
28+
docs/system/hoon/library/src/2o/mold/map.mdnew file+25
@@ -0,0 +1,25 @@
1+### `++map`
2+
3+Map
4+
5+[mold]() generator. A `++map` is a [treap](http://en.wikipedia.org/wiki/Treap) of
6+key, value pairs.
7+
8+
9+Source
10+------
11+
12+ ++ map |* [a=_,* b=_,*] :: associative tree
13+
14+Examples
15+--------
16+
17+See also: [`++by`]()
18+
19+ ~zod/try=> :type; *(map ,@t ,@u)
20+ {}
21+ nlr([p=@t q=@u])
22+ ~zod/try=> `(map ,@ta ,@ud)`(mo (limo a/1 b/2 ~))
23+ {[p=~.a q=1] [p=~.b q=2]}
24+
25+
docs/system/hoon/library/src/2o/mold/qeu.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++qeu`
2+
3+Queue
4+
5+[mold]() generator. An ordered [treap](http://en.wikipedia.org/wiki/Treap) of
6+items.
7+
8+Source
9+------
10+
11+ ++ qeu |* a=_,* :: queue
12+ $|(~ [n=a l=(qeu a) r=(qeu a)]) ::
13+
14+See also: [`++to`]()
15+
16+Examples
17+--------
18+
19+ ~zod/try=> (qeu time)
20+ <1.qyo [* <1.sxx [a=<1.ebd [* <101.jzo 1.ypj %164>]> <101.jzo 1.ypj %164>]>]>
21+ ~zod/try=> (~(gas to *(qeu time)) [~2014.1.1 ~2014.1.2 ~])
22+ {~2014.1.2 ~2014.1.1}
23+
24+
docs/system/hoon/library/src/2o/mold/set.mdnew file+26
@@ -0,0 +1,26 @@
1+### `++set`
2+
3+Set
4+
5+[mold]() generator. A `++set` is a
6+[treap](http://en.wikipedia.org/wiki/Treap) with unique values.
7+
8+Source
9+------
10+
11+ ++ set |* a=_,* :: set
12+ $|(~ [n=a l=(set a) r=(set a)]) ::
13+
14+Examples
15+--------
16+
17+See also: [`++in`]()
18+
19+ ~zod/try=> (sa "abc")
20+ {~~a ~~c ~~b}
21+ ~zod/try=> (~(put in (sa "abc")) %d)
22+ {~~d ~~a ~~c ~~b}
23+ ~zod/try=> (~(put in (sa "abc")) %a)
24+ {~~a ~~c ~~b}
25+
26+
docs/system/hoon/library/src/2p/gate/cue.mdnew file+53
@@ -0,0 +1,53 @@
1+### `++cue`
2+
3+Unpack atom to noun
4+
5+Produces a noun unpacked from atom `a`. The inverse of jam.
6+
7+Accepts
8+-------
9+
10+`a` is an [atom]().
11+
12+Produces
13+--------
14+
15+A [`++noun`]().
16+
17+Source
18+------
19+
20+ ++ cue :: unpack atom to noun
21+ ~/ %cue
22+ |= a=@
23+ ^- *
24+ =+ b=0
25+ =+ m=`(map ,@ ,*)`~
26+ =< q
27+ |- ^- [p=@ q=* r=_m]
28+ ?: =(0 (cut 0 [b 1] a))
29+ =+ c=(rub +(b) a)
30+ [+(p.c) q.c (~(put by m) b q.c)]
31+ =+ c=(add 2 b)
32+ ?: =(0 (cut 0 [+(b) 1] a))
33+ =+ u=$(b c)
34+ =+ v=$(b (add p.u c), m r.u)
35+ =+ w=[q.u q.v]
36+ [(add 2 (add p.u p.v)) w (~(put by r.v) b w)]
37+ =+ d=(rub c a)
38+ [(add 2 p.d) (need (~(get by m) q.d)) m]
39+ ::
40+
41+
42+Examples
43+--------
44+
45+ ~zod/try=> (cue 12)
46+ 1
47+ ~zod/try=> (cue 817)
48+ [1 1]
49+ ~zod/try=> (cue 4.657)
50+ [1 2]
51+ ~zod/try=> (cue 39.689)
52+ [0 19]
53+
docs/system/hoon/library/src/2p/gate/jam.mdnew file+58
@@ -0,0 +1,58 @@
1+### `++jam`
2+
3+Unpack noun to atom
4+
5+Produces an atom unpacked from noun `a`. The inverse of cue.
6+
7+Accepts
8+-------
9+
10+`a` is a [noun]().
11+
12+Produces
13+--------
14+
15+An atom.
16+
17+Source
18+------
19+
20+ ++ jam :: pack
21+ ~/ %jam
22+ |= a=*
23+ ^- @
24+ =+ b=0
25+ =+ m=`(map ,* ,@)`~
26+ =< q
27+ |- ^- [p=@ q=@ r=_m]
28+ =+ c=(~(get by m) a)
29+ ?~ c
30+ => .(m (~(put by m) a b))
31+ ?: ?=(@ a)
32+ =+ d=(mat a)
33+ [(add 1 p.d) (lsh 0 1 q.d) m]
34+ => .(b (add 2 b))
35+ =+ d=$(a -.a)
36+ =+ e=$(a +.a, b (add b p.d), m r.d)
37+ [(add 2 (add p.d p.e)) (mix 1 (lsh 0 2 (cat 0 q.d q.e))) r.e]
38+ ?: ?&(?=(@ a) (lte (met 0 a) (met 0 u.c)))
39+ =+ d=(mat a)
40+ [(add 1 p.d) (lsh 0 1 q.d) m]
41+ =+ d=(mat u.c)
42+ [(add 2 p.d) (mix 3 (lsh 0 2 q.d)) m]
43+ ::
44+
45+
46+Examples
47+--------
48+
49+ ~zod/try=> (jam 1)
50+ 12
51+ ~zod/try=> (jam [1 1])
52+ 817
53+ ~zod/try=> (jam [1 2])
54+ 4.657
55+ ~zod/try=> (jam [~ u=19])
56+ 39.689
57+
58+
docs/system/hoon/library/src/2p/gate/mat.mdnew file+54
@@ -0,0 +1,54 @@
1+### `++mat`
2+
3+Length-encode
4+
5+Produces a cell whose tail `q` is atom `a` with a bit representation of
6+its length prepended to it (as the least significant bits). The head `p`
7+is the length of `q` in bits.
8+
9+Accepts
10+-------
11+
12+`a` is an atom.
13+
14+Produces
15+--------
16+
17+A cell of two atoms, `p` and `q`.
18+
19+Source
20+------
21+
22+ ++ mat :: length-encode
23+ ~/ %mat
24+ |= a=@
25+ ^- [p=@ q=@]
26+ ?: =(0 a)
27+ [1 1]
28+ =+ b=(met 0 a)
29+ =+ c=(met 0 b)
30+ :- (add (add c c) b)
31+ (cat 0 (bex c) (mix (end 0 (dec c) b) (lsh 0 (dec c) a)))
32+
33+
34+Examples
35+--------
36+
37+ ~zod/try=> (mat 0xaaa)
38+ [p=20 q=699.024]
39+ ~zod/try=> (met 0 q:(mat 0xaaa))
40+ 20
41+ ~zod/try=> `@ub`q:(mat 0xaaa)
42+ 0b1010.1010.1010.1001.0000
43+ ~zod/try=> =a =-(~&(- -) `@ub`0xaaa)
44+ 0b1010.1010.1010
45+ ~zod/try=> =b =-(~&(- -) `@ub`(xeb a))
46+ 0b1100
47+ ~zod/try=> =b =-(~&(- -) `@ub`(met 0 a))
48+ 0b1100
49+ ~zod/try=> =c =-(~&(- -) (xeb b))
50+ 4
51+ ~zod/try=> [`@ub`a `@ub`(end 0 (dec c) b) `@ub`(bex c)]
52+ [0b1010.1010.1010 0b100 0b1.0000]
53+
54+
docs/system/hoon/library/src/2p/gate/rub.mdnew file+50
@@ -0,0 +1,50 @@
1+### `++rub`
2+
3+Length-decode
4+
5+The inverse of `++mat`. Accepts a cell of index `a` and a bitstring `b`
6+and produces the cell whose tail `q` is the decoded atom at index `a`
7+and whose head is the length of the encoded atom `q`, by which the
8+offset `a` is advanced. Only used internally as a helper cue.
9+
10+Accepts
11+-------
12+
13+`a` is an atom.
14+
15+`b` is a bitstring as an atom.
16+
17+Produces
18+--------
19+
20+A cell of two atoms, `p` and `q`.
21+
22+Source
23+------
24+
25+ ++ rub :: length-decode
26+ ~/ %rub
27+ |= [a=@ b=@]
28+ ^- [p=@ q=@]
29+ =+ ^= c
30+ =+ [c=0 m=(met 0 b)]
31+ |- ?< (gth c m)
32+ ?. =(0 (cut 0 [(add a c) 1] b))
33+ c
34+ $(c +(c))
35+ ?: =(0 c)
36+ [1 0]
37+ =+ d=(add a +(c))
38+ =+ e=(add (bex (dec c)) (cut 0 [d (dec c)] b))
39+ [(add (add c c) e) (cut 0 [(add d (dec c)) e] b)]
40+
41+
42+Examples
43+--------
44+
45+ ~zod/try=> `@ub`(jam 0xaaa)
46+ 0b1.0101.0101.0101.0010.0000
47+ ~zod/try=> (rub 1 0b1.0101.0101.0101.0010.0000)
48+ [p=20 q=2.730]
49+ ~zod/try=> `@ux`q:(rub 1 0b1.0101.0101.0101.0010.0000)
50+ 0xaaa
docs/system/hoon/library/src/2q/mold/char.mdnew file+22
@@ -0,0 +1,22 @@
1+### `++char`
2+
3+Char
4+
5+A single character. [odor]() [`@tD`]() designates a single unicode byte. All
6+parsers consume [`++tape`]()s, which are lists of `++char`.
7+
8+
9+Source
10+------
11+
12+ ++ char ,@tD :: UTF-8 byte
13+
14+Examples
15+--------
16+
17+ ~zod/try=> *char
18+ ''
19+ ~zod/try> (char 97)
20+ 'a'
21+
22+
docs/system/hoon/library/src/2q/mold/cord.mdnew file+28
@@ -0,0 +1,28 @@
1+### `++cord`
2+
3+UTF-8 text
4+
5+One of Hoon's two string types (the other being [`++tape`]()). A cord is an
6+atom of UTF-8 text. [`++trip`]() and [`++crip`]() convert between cord and
7+`++tape`.
8+
9+Source
10+------
11+
12+ ++ cord ,@t :: text atom (UTF-8)
13+
14+Examples
15+--------
16+
17+Odor [`@t`]() designates a Unicode atom, little-endian: the first character
18+in the text is the low byte.
19+
20+ ~zod/try=> `@ux`'foobar'
21+ 0x7261.626f.6f66
22+
23+ ~zod/try=> `@`'urbit'
24+ 499.984.265.845
25+ ~zod/try=> (cord 499.984.265.845)
26+ 'urbit'
27+
28+
docs/system/hoon/library/src/2q/mold/date.mdnew file+20
@@ -0,0 +1,20 @@
1+### `++date`
2+
3+Point in time
4+
5+A boolean designating AD or BC, a year atom, a month
6+atom, and a [`++tarp`](), which is a day atom and a time.
7+
8+Source
9+------
10+
11+ ++ date ,[[a=? y=@ud] m=@ud t=tarp] :: parsed date
12+
13+Examples
14+--------
15+
16+See also: [`++year`](), [`++yore`]() [`++stud`](), [`++dust`]()
17+
18+ ~zod/try=> `date`(yore ~2014.6.6..21.09.15..0a16)
19+ [[a=%.y y=2.014] m=6 t=[d=6 h=21 m=9 s=15 f=~[0xa16]]]
20+
docs/system/hoon/library/src/2q/mold/tang.mdnew file+7
@@ -0,0 +1,7 @@
1+### `++tang`
2+
3+ ++ tang (list tank) :: general error
4+
5+Unused XX
6+
7+
docs/system/hoon/library/src/2q/mold/tank.mdnew file+39
@@ -0,0 +1,39 @@
1+### `++tank`
2+
3+Pretty-printing structure.
4+
5+A `++tank` is one of three cases: a `%leaf`
6+is simply a string; a `%palm` is XX need more information; and a `%rose` is a
7+list of `++tank` delimted by the strings in `p`.
8+
9+
10+Source
11+------
12+
13+ ++ tank $% [%leaf p=tape] :: printing formats
14+ $: %palm :: backstep list
15+ p=[p=tape q=tape r=tape s=tape] ::
16+ q=(list tank) ::
17+ == ::
18+ $: %rose :: flat list
19+ p=[p=tape q=tape r=tape] :: mid open close
20+ q=(list tank) ::
21+ == ::
22+ ==
23+
24+Examples
25+--------
26+
27+ ~zod/try=> >(bex 20) (bex 19)<
28+ [%rose p=[p=" " q="[" r="]"] q=~[[%leaf p="1.048.576"] [%leaf p="524.288"]]]
29+ ~zod/try=> (wash [0 80] >(bex 20) (bex 19)<) :: at 80 cols
30+ <<"[1.048.576 524.288]">>
31+ ~zod/try=> (wash [0 15] >(bex 20) (bex 19)<) :: at 15 cols (two lines)
32+ <<"[ 1.048.576" " 524.288" "]">>
33+
34+ ~zod/try=> [(bex 150) (bex 151)] :: at 80 cols
35+ [ 1.427.247.692.705.959.881.058.285.969.449.495.136.382.746.624
36+ 2.854.495.385.411.919.762.116.571.938.898.990.272.765.493.248
37+ ]
38+
39+
docs/system/hoon/library/src/2q/mold/tape.mdnew file+21
@@ -0,0 +1,21 @@
1+
2+### `++tape`
3+
4+List of chars
5+
6+One of Hoon's two string types, the other being [`++cord`](). A tape is a
7+list of chars.
8+
9+Source
10+------
11+
12+ ++ tape (list char) :: like a string
13+
14+Examples
15+--------
16+
17+ ~zod/try=> `(list ,char)`"foobar"
18+ "foobar"
19+ ~zod/try=> `(list ,@)`"foobar"
20+ ~[102 111 111 98 97 114]
21+
docs/system/hoon/library/src/2q/mold/tarp.mdnew file+27
@@ -0,0 +1,27 @@
1+### `++tarp`
2+
3+Day through second
4+
5+The remaining part of a [`++date`](): day, hour, minute, second and a list
6+of [`@ux`]() for precision.
7+
8+Source
9+------
10+
11+ @ud h=@ud m=@ud s=@ud f=(list ,@ux)] :: parsed time
12+
13+Examples
14+--------
15+
16+See also: [`++date`](), [`++yell`[]()/`++yule`]()
17+
18+ ~zod/try=> -<-
19+ ~2014.9.20..00.43.33..b52a
20+ ~zod/try=> :: the time is always in your context at -<-
21+ ~zod/try=> (yell -<-)
22+ [d=106.751.991.820.278 h=0 m=43 s=39 f=~[0x54d1]]
23+
24+ ~zod/try=> (yell ~d20)
25+ [d=20 h=0 m=0 s=0 f=~]
26+
27+
docs/system/hoon/library/src/2q/mold/term.mdnew file+28
@@ -0,0 +1,28 @@
1+### `++term`
2+
3+Hoon constants
4+
5+A restricted text atom for Hoon constants. The only characters permitted are
6+lowercase ASCII, `-`, and `0-9`, the latter two of which can neither be the first or last
7+character. The syntax for [`@tas`]() is the text itself, always preceded by `%`.
8+This means a term is always [cubical](). The empty `@tas` has a special syntax,
9+`$`.
10+
11+
12+Source
13+------
14+
15+ ++ term ,@tas :: Hoon ASCII subset
16+
17+Examples
18+--------
19+
20+ ~zod/try=> *term
21+ %$
22+
23+ ~zod/try=> %dead-fish9
24+ %dead-fish9
25+ ~zod/try=> -:!>(%dead-fish9)
26+ [%cube p=271.101.667.197.767.630.546.276 q=[%atom p=%tas]]
27+
28+
docs/system/hoon/library/src/2q/mold/wain.mdnew file+32
@@ -0,0 +1,32 @@
1+### `++wain`
2+
3+ ++ wain (list cord) :: text lines (no \n)
4+
5+A list of lines. A `++wain` is used instead of a single [`++cord`]() with
6+`\n`.
7+
8+See also: [`++lore`](), [`++role`]()
9+
10+ ~zod/try=> `wain`/som/del/rok
11+ <|som del rok|>
12+ ~zod/try=> `wain`(lore ^:@t/=main=/bin/tree/hoon)
13+ <|
14+ !:
15+ :: /===/bin/tree/hoon
16+ |= ^
17+ |= [pax=path fla=$|(~ [%full ~])]
18+ =- ~[te/-]~
19+ =+ len=(lent pax)
20+ =+ rend=?~(fla |=(a=path +:(spud (slag len a))) spud)
21+ |- ^- wain
22+ =+ ark=;;(arch .^(cy/pax))
23+ =- ?~ q.ark -
24+ [(crip (rend pax)) -]
25+ %- zing
26+ %- turn :_ |=(a=@t ^$(pax (weld pax `path`/[a])))
27+ %- sort :_ aor
28+ %- turn :_ |=([a=@t ~] a)
29+ (~(tap by r.ark))
30+ |>
31+
32+
docs/system/hoon/library/src/2q/mold/wall.mdnew file+31
@@ -0,0 +1,31 @@
1+### `++wall`
2+
3+List of lines
4+
5+
6+A `++wall` is used instead of a single [`++tape`]() with
7+`\n`.
8+
9+Source
10+------
11+
12+ ++ wall (list tape) :: text lines (no \n)
13+
14+Examples
15+--------
16+
17+See also: [`++wash`]()
18+
19+ ~zod/try=> `wall`(wash [0 20] leaf/<(bex 256)>)
20+ <<
21+ "\/115.792.089.237.\/"
22+ " 316.195.423.570."
23+ " 985.008.687.907."
24+ " 853.269.984.665."
25+ " 640.564.039.457."
26+ " 584.007.913.129."
27+ " 639.936"
28+ "\/ \/"
29+ >>
30+
31+
docs/system/hoon/library/src/3a/core/fe.mdnew file+416
@@ -0,0 +1,416 @@
1+### `++fe` :: modulo bloq
2+
3+Modulo bloq
4+
5+Core containing XX
6+
7+Accepts
8+-------
9+
10+`a` is a [`++bloq`]().
11+
12+Source
13+------
14+
15+ |_ a=bloq
16+
17+### `++dif`
18+
19+Produces the difference between two [atom]()s in the modular basis
20+representation.
21+
22+Accepts
23+-------
24+
25+`a` is a [`++bloq`]().
26+
27+`b` is an atom.
28+
29+`c` is an atom.
30+
31+Produces
32+--------
33+
34+A [`@s`]()
35+
36+Source
37+------
38+
39+ ++ dif |=([b=@ c=@] (sit (sub (add out (sit b)) (sit c))))
40+
41+Examples
42+--------
43+
44+ ~zod/try=> (~(dif fe 3) 63 64)
45+ 255
46+ ~zod/try=> (~(dif fe 3) 5 10)
47+ 251
48+ ~zod/try=> (~(dif fe 3) 0 1)
49+ 255
50+ ~zod/try=> (~(dif fe 0) 9 10)
51+ 1
52+ ~zod/try=> (~(dif fe 0) 9 11)
53+ 0
54+ ~zod/try=> (~(dif fe 0) 9 12)
55+ 1
56+ ~zod/try=> (~(dif fe 2) 9 12)
57+ 13
58+ ~zod/try=> (~(dif fe 2) 63 64)
59+ 15
60+
61+------------------------------------------------------------------------
62+
63+### `++inv`
64+
65+Invert mod field
66+
67+Inverts the order of the modular field.
68+
69+Accepts
70+-------
71+
72+`b` is a [`++bloq`]().
73+
74+Produces
75+--------
76+
77+An atom.
78+
79+
80+Source
81+------
82+
83+ ++ inv |=(b=@ (sub (dec out) (sit b)))
84+
85+Examples
86+--------
87+
88+ ~zod/try=> (~(inv fe 3) 255)
89+ 0
90+ ~zod/try=> (~(inv fe 3) 256)
91+ 255
92+ ~zod/try=> (~(inv fe 3) 0)
93+ 255
94+ ~zod/try=> (~(inv fe 3) 1)
95+ 254
96+ ~zod/try=> (~(inv fe 3) 2)
97+ 253
98+ ~zod/try=> (~(inv fe 3) 55)
99+ 200
100+
101+------------------------------------------------------------------------
102+
103+### `++net`
104+
105+Reverse bytes
106+
107+Revereses bytes within block.
108+
109+Accepts
110+-------
111+
112+`b` is a [`++bloq`]().
113+
114+Produces
115+--------
116+
117+An atom.=
118+
119+Source
120+------
121+
122+ ++ net |= b=@ ^- @
123+ => .(b (sit b))
124+ ?: (lte a 3)
125+ b
126+ =+ c=(dec a)
127+ %+ con
128+ (lsh c 1 $(a c, b (cut c [0 1] b)))
129+ $(a c, b (cut c [1 1] b))
130+
131+Examples
132+--------
133+
134+ ~zod/try=> (~(net fe 3) 64)
135+ 64
136+ ~zod/try=> (~(net fe 3) 128)
137+ 128
138+ ~zod/try=> (~(net fe 3) 255)
139+ 255
140+ ~zod/try=> (~(net fe 3) 256)
141+ 0
142+ ~zod/try=> (~(net fe 3) 257)
143+ 1
144+ ~zod/try=> (~(net fe 3) 500)
145+ 244
146+ ~zod/try=> (~(net fe 3) 511)
147+ 255
148+ ~zod/try=> (~(net fe 3) 512)
149+ 0
150+ ~zod/try=> (~(net fe 3) 513)
151+ 1
152+ ~zod/try=> (~(net fe 3) 0)
153+ 0
154+ ~zod/try=> (~(net fe 3) 1)
155+ 1
156+ ~zod/try=> (~(net fe 0) 1)
157+ 1
158+ ~zod/try=> (~(net fe 0) 2)
159+ 0
160+ ~zod/try=> (~(net fe 0) 3)
161+ 1
162+ ~zod/try=> (~(net fe 6) 1)
163+ 72.057.594.037.927.936
164+ ~zod/try=> (~(net fe 6) 2)
165+ 144.115.188.075.855.872
166+ ~zod/try=> (~(net fe 6) 3)
167+ 216.172.782.113.783.808
168+ ~zod/try=> (~(net fe 6) 4)
169+ 288.230.376.151.711.744
170+ ~zod/try=> (~(net fe 6) 5)
171+ 360.287.970.189.639.680
172+ ~zod/try=> (~(net fe 6) 6)
173+ 432.345.564.227.567.616
174+ ~zod/try=> (~(net fe 6) 7)
175+ 504.403.158.265.495.552
176+ ~zod/try=> (~(net fe 6) 512)
177+ 562.949.953.421.312
178+ ~zod/try=> (~(net fe 6) 513)
179+ 72.620.543.991.349.248
180+
181+------------------------------------------------------------------------
182+
183+### `++out`
184+
185+Max integer value
186+
187+The maximum integer value that the current block can store.
188+
189+Accepts
190+-------
191+
192+A [`++bloq`]().
193+
194+Produces
195+--------
196+
197+An [atom]().
198+
199+Source
200+------
201+
202+ ++ out (bex (bex a))
203+
204+Examples
205+--------
206+
207+ ~zod/try=> ~(out fe 0)
208+ 2
209+ ~zod/try=> ~(out fe 1)
210+ 4
211+ ~zod/try=> ~(out fe 2)
212+ 16
213+ ~zod/try=> ~(out fe 3)
214+ 256
215+ ~zod/try=> ~(out fe 4)
216+ 65.536
217+ ~zod/try=> ~(out fe 10)
218+ \/179.769.313.486.231.590.772.930.519.078.902.473.361.797.697.894.230.657.\/
219+ 273.430.081.157.732.675.805.500.963.132.708.477.322.407.536.021.120.113.
220+ 879.871.393.357.658.789.768.814.416.622.492.847.430.639.474.124.377.767.
221+ 893.424.865.485.276.302.219.601.246.094.119.453.082.952.085.005.768.838.
222+ 150.682.342.462.881.473.913.110.540.827.237.163.350.510.684.586.298.239.
223+ 947.245.938.479.716.304.835.356.329.624.224.137.216
224+ \/ \/
225+
226+------------------------------------------------------------------------
227+
228+### `++rol`
229+
230+Roll left
231+
232+Roll `d` to the left by `c` `b`-sized blocks.
233+
234+Accepts
235+-------
236+
237+`a` is a [`++bloq`]().
238+
239+`b` is a `++bloq`.
240+
241+`c` is an atom.
242+
243+`d` is an atom.
244+
245+Produces
246+--------
247+
248+An atom.
249+
250+Source
251+------
252+
253+ ++ rol |= [b=bloq c=@ d=@] ^- @ :: roll left
254+ =+ e=(sit d)
255+ =+ f=(bex (sub a b))
256+ =+ g=(mod c f)
257+ (sit (con (lsh b g e) (rsh b (sub f g) e)))
258+
259+Examples
260+--------
261+
262+ ~zod/try=> `@ux`(~(rol fe 6) 4 3 0xabac.dedf.1213)
263+ 0x1213.0000.abac.dedf
264+ ~zod/try=> `@ux`(~(rol fe 6) 4 2 0xabac.dedf.1213)
265+ 0xdedf.1213.0000.abac
266+ ~zod/try=> `@t`(~(rol fe 5) 3 1 'dfgh')
267+ 'hdfg'
268+ ~zod/try=> `@t`(~(rol fe 5) 3 2 'dfgh')
269+ 'ghdf'
270+ ~zod/try=> `@t`(~(rol fe 5) 3 0 'dfgh')
271+ 'dfgh'
272+
273+------------------------------------------------------------------------
274+
275+### `++ror`
276+
277+Roll right
278+
279+Roll `d` to the right by `c` `b`-sized blocks.
280+
281+Accepts
282+-------
283+
284+`a` is a [`++bloq`]().
285+
286+`b` is a `++bloq`.
287+
288+`c` is an [atom]().
289+
290+`d` is an atom.
291+
292+Produces
293+--------
294+
295+An atom.
296+
297+Source
298+------
299+
300+ ++ ror |= [b=bloq c=@ d=@] ^- @ :: roll right
301+ =+ e=(sit d)
302+ =+ f=(bex (sub a b))
303+ =+ g=(mod c f)
304+ (sit (con (rsh b g e) (lsh b (sub f g) e)))
305+
306+Examples
307+--------
308+
309+ ~zod/try=> `@ux`(~(ror fe 6) 4 1 0xabac.dedf.1213)
310+ 0x1213.0000.abac.dedf
311+ ~zod/try=> `@ux`(~(ror fe 6) 3 5 0xabac.dedf.1213)
312+ 0xacde.df12.1300.00ab
313+ ~zod/try=> `@ux`(~(ror fe 6) 3 3 0xabac.dedf.1213)
314+ 0xdf12.1300.00ab.acde
315+ ~zod/try=> `@t`(~(rol fe 5) 3 0 'hijk')
316+ 'hijk'
317+ ~zod/try=> `@t`(~(rol fe 5) 3 1 'hijk')
318+ 'khij'
319+ ~zod/try=> `@t`(~(rol fe 5) 3 2 'hijk')
320+ 'jkhi'
321+
322+------------------------------------------------------------------------
323+
324+### `++sum`
325+
326+Sum
327+
328+Sum two numbers in this modular field.
329+
330+Accepts
331+-------
332+
333+`a` is a [`++bloq`]().
334+
335+`b` is an [atom]().
336+
337+`c` is an atom.
338+
339+Produces
340+--------
341+
342+An atom.
343+
344+Source
345+------
346+
347+ ++ sum |=([b=@ c=@] (sit (add b c))) :: wrapping add
348+
349+Examples
350+--------
351+
352+ ~zod/try=> (~(sum fe 3) 10 250)
353+ 4
354+ ~zod/try=> (~(sum fe 0) 0 1)
355+ 1
356+ ~zod/try=> (~(sum fe 0) 0 2)
357+ 0
358+ ~zod/try=> (~(sum fe 2) 14 2)
359+ 0
360+ ~zod/try=> (~(sum fe 2) 14 3)
361+ 1
362+ ~zod/try=> (~(sum fe 4) 10.000 256)
363+ 10.256
364+ ~zod/try=> (~(sum fe 4) 10.000 100.000)
365+ 44.464
366+
367+### `++sit`
368+
369+Atom in mod block representation
370+
371+Produce an [atom]() in the current modular block representation.
372+
373+Accepts
374+-------
375+
376+`a` is a [`++bloq`]().
377+
378+`b` is an atom.
379+
380+Produces
381+--------
382+
383+An atom.
384+
385+Source
386+------
387+
388+ ++ sit |=(b=@ (end a 1 b)) :: enforce modulo
389+
390+Examples
391+--------
392+
393+ ~zod/try=> (~(sit fe 3) 255)
394+ 255
395+ ~zod/try=> (~(sit fe 3) 256)
396+ 0
397+ ~zod/try=> (~(sit fe 3) 257)
398+ 1
399+ ~zod/try=> (~(sit fe 2) 257)
400+ 1
401+ ~zod/try=> (~(sit fe 2) 10.000)
402+ 0
403+ ~zod/try=> (~(sit fe 2) 100)
404+ 4
405+ ~zod/try=> (~(sit fe 2) 19)
406+ 3
407+ ~zod/try=> (~(sit fe 2) 17)
408+ 1
409+ ~zod/try=> (~(sit fe 0) 17)
410+ 1
411+ ~zod/try=> (~(sit fe 0) 0)
412+ 0
413+ ~zod/try=> (~(sit fe 0) 1)
414+ 1
415+
416+
docs/system/hoon/library/src/3a/core/si.mdnew file+478
@@ -0,0 +1,478 @@
1+### `++si`
2+
3+ ++ si !: :: signed integer
4+ |%
5+
6+Container core for the signed integer functions.
7+
8+------------------------------------------------------------------------
9+
10+### `++abs`
11+
12+Absolute value
13+
14+Produces the absolute value of a signed integer.
15+
16+Accepts
17+-------
18+
19+`a` is a signed integer, [`@s`]().
20+
21+Produces
22+--------
23+
24+An [atom]().
25+
26+Source
27+------
28+
29+ ++ abs |=(a=@s (add (end 0 1 a) (rsh 0 1 a))) :: absolute value
30+
31+Examples
32+--------
33+
34+ ~zod/try=> (abs:si -2)
35+ 2
36+ ~zod/try=> (abs:si -10.000)
37+ 10.000
38+ ~zod/try=> (abs:si --2)
39+ 2
40+
41+------------------------------------------------------------------------
42+
43+### `++dif`
44+
45+Difference
46+
47+Produces the difference between two signed integers `b` and `c`.
48+
49+Accepts
50+-------
51+
52+`a` is a signed integer, [`@s`]().
53+
54+`b` is a signed integer, `@s`.
55+
56+Produces
57+--------
58+
59+A [`@s`]().
60+
61+
62+Source
63+------
64+
65+ ++ dif |= [a=@s b=@s] :: subtraction
66+ (sum a (new !(syn b) (abs b)))
67+
68+Examples
69+--------
70+
71+ ~zod/try=> (dif:si --10 -7)
72+ --17
73+ ~zod/try=> (dif:si --10 --7)
74+ --3
75+ ~zod/try=> (dif:si `@s`0 --7)
76+ -7
77+ ~zod/try=> (dif:si `@s`0 `@s`7)
78+ --4
79+
80+------------------------------------------------------------------------
81+
82+### `++dul`
83+
84+Modulus
85+
86+Produces the modulus of two signed integers.
87+
88+Accepts
89+-------
90+
91+`a` is a signed integer, `@s`.
92+
93+`b` is an [atom]().
94+
95+Produces
96+--------
97+
98+An atom.
99+
100+Source
101+------
102+
103+ ++ dul |= [a=@s b=@] :: modulus
104+ =+(c=(old a) ?:(-.c (mod +.c b) (sub b +.c)))
105+
106+Examples
107+--------
108+
109+ ~zod/try=> (dul:si --9 3)
110+ 0
111+ ~zod/try=> (dul:si --9 4)
112+ 1
113+ ~zod/try=> (dul:si --9 5)
114+ 4
115+ ~zod/try=> (dul:si --9 6)
116+ 3
117+ ~zod/try=> (dul:si --90 --10)
118+ 10
119+
120+------------------------------------------------------------------------
121+
122+### `++fra`
123+
124+Divide
125+
126+Produces the quotient of two signed integers.
127+
128+Accepts
129+-------
130+
131+`a` is a signed integer, [`@s`].
132+
133+`b` is a signed integer, `@s`.
134+
135+Produces
136+--------
137+
138+An [atom]().
139+
140+Source
141+------
142+
143+ ++ fra |= [a=@s b=@s] :: divide
144+ (new =(0 (mix (syn a) (syn b))) (div (abs a) (abs b)))
145+
146+Examples
147+--------
148+
149+ ~zod/try=> (fra:si --10 -2)
150+ -5
151+ ~zod/try=> (fra:si -20 -5)
152+ --4
153+
154+------------------------------------------------------------------------
155+
156+### `++new`
157+
158+Signed integer
159+
160+Produces a signed integer from a loobean sign value `a` and an [atom]() `b`.
161+
162+Accepts
163+-------
164+
165+`a` is a loobean.
166+
167+`b` is an atom.
168+
169+Produces
170+--------
171+
172+A [`@s`]()
173+
174+Source
175+------
176+
177+ ++ new |= [a=? b=@] :: [sign value] to @s
178+ `@s`?:(a (mul 2 b) ?:(=(0 b) 0 +((mul 2 (dec b)))))
179+
180+Examples
181+--------
182+
183+ ~zod/try=> (new:si [& 10])
184+ --10
185+ ~zod/try=> (new:si [| 10])
186+ -10
187+ ~zod/try=> (new:si [%.y 7])
188+ --7
189+
190+------------------------------------------------------------------------
191+
192+### `++old`
193+
194+[sign value]
195+
196+Produces the cell `[sign value]` representations of a signed integer.
197+
198+Accepts
199+-------
200+
201+`a` is a [`@s`]().
202+
203+Produces
204+--------
205+
206+A cell of a boolean and an [atom]().
207+
208+Source
209+------
210+
211+ ++ old |=(a=@s [(syn a) (abs a)]) :: [sign value]
212+
213+Examples
214+--------
215+
216+ ~zod/try=> (old:si 7)
217+ ! type-fail
218+ ! exit
219+ ~zod/try=> (old:si -7)
220+ [%.n 7]
221+ ~zod/try=> (old:si --7)
222+ [%.y 7]
223+ ~zod/try=> (old:si `@s`7)
224+ [%.n 4]
225+ ~zod/try=> (old:si -0)
226+ [%.y 0]
227+
228+------------------------------------------------------------------------
229+
230+### `++pro`
231+
232+Multiply
233+
234+Produces the product of two signed integers.
235+
236+Accepts
237+-------
238+
239+`a` is a [`@s`]().
240+
241+`b` is a `@s`.
242+
243+Produces
244+--------
245+
246+A `@s`.
247+
248+Source
249+------
250+
251+ ++ pro |= [a=@s b=@s] :: multiplication
252+ (new =(0 (mix (syn a) (syn b))) (mul (abs a) (abs b)))
253+
254+Examples
255+--------
256+
257+ ~zod/try=> (pro:si -4 --2)
258+ -8
259+ ~zod/try=> (pro:si -4 -2)
260+ --8
261+ ~zod/try=> (pro:si --10.000.000 -10)
262+ -100.000.000
263+ ~zod/try=> (pro:si -1.337 --0)
264+ --0
265+
266+------------------------------------------------------------------------
267+
268+### `++rem`
269+
270+Remainder
271+
272+Produces the remainder from a division of two signed integers.
273+
274+Accepts
275+-------
276+
277+`a` is a [`@s`]().
278+
279+`b` is a `@s`.
280+
281+Produces
282+--------
283+
284+A `@sd`.
285+
286+Source
287+------
288+
289+ ++ rem |=([a=@s b=@s] (dif a (pro b (fra a b)))) :: remainder
290+
291+Examples
292+--------
293+
294+ ~zod/try=> (rem:si -10 -4)
295+ -2
296+ ~zod/try=> (rem:si --10 --4)
297+ --2
298+ ~zod/try=> (rem:si --10 -4)
299+ --2
300+ ~zod/try=> (rem:si --7 --3)
301+ --1
302+ ~zod/try=> (rem:si --0 --10.000)
303+ --0
304+
305+------------------------------------------------------------------------
306+
307+### `++sum`
308+
309+Add
310+
311+Sum two signed integers.
312+
313+Accepts
314+-------
315+
316+`b` is a [`@s`]().
317+
318+`c` is a signed integer `@s`.
319+
320+Produces
321+--------
322+
323+A `@s`.
324+
325+Source
326+------
327+
328+ ++ sum |= [a=@s b=@s] :: addition
329+ ~| %si-sum
330+ =+ [c=(old a) d=(old b)]
331+ ?: -.c
332+ ?: -.d
333+ (new & (add +.c +.d))
334+ ?: (gte +.c +.d)
335+ (new & (sub +.c +.d))
336+ (new | (sub +.d +.c))
337+ ?: -.d
338+ ?: (gte +.c +.d)
339+ (new | (sub +.c +.d))
340+ (new & (sub +.d +.c))
341+ (new | (add +.c +.d))
342+
343+Examples
344+--------
345+
346+ ~zod/try=> (sum:si --10 --10)
347+ --20
348+ ~zod/try=> (sum:si --10 -0)
349+ --10
350+ ~zod/try=> (sum:si -10 -7)
351+ -17
352+ ~zod/try=> (sum:si -10 --7)
353+ -3
354+
355+------------------------------------------------------------------------
356+
357+### `++sun`
358+
359+Signed from unsigned
360+
361+Produces a signed integer from an unsigned integer.
362+
363+Note that the result must be manually cast to some [`@s`]() odor to be
364+inferred as an unsigned integer in the type system.
365+
366+Accepts
367+-------
368+
369+`a` is a [`@u`]().
370+
371+Produces
372+--------
373+
374+A [`@s`]().
375+
376+Source
377+------
378+
379+ ++ sun |=(a=@u (mul 2 a)) :: @u to @s
380+
381+Examples
382+--------
383+
384+ ~zod/try=> `@s`10
385+ --5
386+ ~zod/try=> (sun:si 10)
387+ 20
388+ ~zod/try=> `@s`(sun:si 10)
389+ --10
390+ ~zod/try=> `@sd`(sun:si 10)
391+ --10
392+ ~zod/try=> `@sd`(sun:si 12.345)
393+ --12.345
394+
395+------------------------------------------------------------------------
396+
397+### `++syn`
398+
399+Sign
400+
401+Produce the sign of a signed integer, where `&` is posiitve, and `|` is negative.
402+
403+Accepts
404+-------
405+
406+`a` is a [`@s`]().
407+
408+Produces
409+--------
410+
411+A boolean.
412+
413+Source
414+------
415+
416+ ++ syn |=(a=@s =(0 (end 0 1 a))) :: sign test
417+
418+Examples
419+--------
420+
421+ ~zod/try=> (syn:si -2)
422+ %.n
423+ ~zod/try=> (syn:si --2)
424+ %.y
425+ ~zod/try=> (syn:si -0)
426+ %.y
427+
428+------------------------------------------------------------------------
429+
430+### `++cmp`
431+
432+Compare
433+
434+Compare two signed integers.
435+
436+Accepts
437+-------
438+
439+`b` is a [`@s`]().
440+
441+`c` is a `@s`.
442+
443+Produces
444+--------
445+
446+A `@s`.
447+
448+Source
449+------
450+
451+ ++ cmp |= [a=@s b=@s] :: compare
452+ ^- @s
453+ ?: =(a b)
454+ --0
455+ ?: (syn a)
456+ ?: (syn b)
457+ ?: (gth a b)
458+ --1
459+ -1
460+ --1
461+ ?: (syn b)
462+ -1
463+ ?: (gth a b)
464+ -1
465+ --1
466+
467+Examples
468+--------
469+
470+ ~zod/try=> (cmp:si --10 --10)
471+ --0
472+ ~zod/try=> (cmp:si --10 -0)
473+ --1
474+ ~zod/try=> (cmp:si -10 -7)
475+ -1
476+ ~zod/try=> (cmp:si -10 --7)
477+ -1
478+
docs/system/hoon/library/src/3a/gate/egcd.mdnew file+39
@@ -0,0 +1,39 @@
1+### `++egcd`
2+
3+GCD
4+
5+ ++ egcd :: schneier's egcd
6+ |= [a=@ b=@]
7+ =+ si
8+ =+ [c=(sun a) d=(sun b)]
9+ =+ [u=[c=(sun 1) d=--0] v=[c=--0 d=(sun 1)]]
10+ |- ^- [d=@ u=@ v=@]
11+ ?: =(--0 c)
12+ [(abs d) d.u d.v]
13+ :: ?> ?& =(c (sum (pro (sun a) c.u) (pro (sun b) c.v)))
14+ :: =(d (sum (pro (sun a) d.u) (pro (sun b) d.v)))
15+ :: ==
16+ =+ q=(fra d c)
17+ %= $
18+ c (dif d (pro q c))
19+ d c
20+ u [(dif d.u (pro q c.u)) c.u]
21+ v [(dif d.v (pro q c.v)) c.v]
22+ ==
23+ ::
24+
25+Greatest common denominator
26+
27+ ~zod/try=> (egcd 20 15)
28+ [d=5 u=2 v=1]
29+ ~zod/try=> (egcd 24 16)
30+ [d=8 u=2 v=1]
31+ ~zod/try=> (egcd 7 5)
32+ [d=1 u=3 v=6]
33+ ~zod/try=> (egcd (shaf ~ %ham) (shaf ~ %sam))
34+ [ d=1
35+ u=59.983.396.314.566.203.239.184.568.129.921.874.787
36+ v=38.716.650.351.034.402.960.165.718.823.532.275.722
37+ ]
38+
39+
docs/system/hoon/library/src/3c/core/yo.mdnew file+256
@@ -0,0 +1,256 @@
1+### `++yo`
2+
3+ ++ yo :: time constants core
4+
5+Useful constants for interacting with earth time.
6+
7+### `++cet`
8+
9+Days in a century. Derived by multiplying the number of days in a year
10+(365) by the number of years in a century (100), then adding the number
11+days from leap years in a century (24).
12+
13+Produces
14+--------
15+
16+An [atom]().
17+
18+Source
19+------
20+
21+ |% ++ cet 36.524 :: (add 24 (mul 100 365))
22+
23+Examples
24+--------
25+
26+ ~zod/try=> cet:yo
27+ 36.524
28+ ~zod/try=> (add 365 cet:yo)
29+ 36.889
30+ ~zod/try=> (sub (add 24 (mul 100 365)) cet:yo)
31+ 0
32+
33+------------------------------------------------------------------------
34+
35+### `++day`
36+
37+Number of seconds in a day.
38+
39+Produces
40+--------
41+
42+An [atom]().
43+
44+Source
45+------
46+
47+ ++ day 86.400 :: (mul 24 hor)
48+
49+Examples
50+--------
51+
52+ ~zod/try=> day:yo
53+ 86.400
54+ ~zod/try=> (add 60 day:yo)
55+ 86.460
56+
57+------------------------------------------------------------------------
58+
59+### `++era`
60+
61+XX Revisit
62+
63+Produces
64+--------
65+
66+An [atom]().
67+
68+Source
69+------
70+
71+ ++ era 146.097 :: (add 1 (mul 4 cet))
72+
73+Examples
74+--------
75+
76+
77+------------------------------------------------------------------------
78+
79+### `++hor`
80+
81+Seconds in hour
82+
83+The number of seconds in an hour. Derived by multiplying the number of
84+seconds in a minute by the minutes in an hour.
85+
86+Produces
87+--------
88+
89+An [atom]().
90+
91+Source
92+------
93+
94+ ++ hor 3.600 :: (mul 60 mit)
95+
96+Examples
97+--------
98+
99+ ~zod/try=> hor:yo
100+ 3.600
101+ ~zod/try=> (div hor:yo 60)
102+ 60
103+
104+------------------------------------------------------------------------
105+
106+### `++jes`
107+
108+XX Revisit
109+
110+Produces
111+--------
112+
113+An atom.
114+
115+Source
116+------
117+
118+ ++ jes 106.751.991.084.417 :: (mul 730.692.561 era)
119+
120+Examples
121+--------
122+
123+ ~zod/try=> jes:yo
124+ 106.751.991.084.417
125+
126+------------------------------------------------------------------------
127+
128+### `++mit`
129+
130+Seconds in minute
131+
132+The number of seconds in a minute.
133+
134+Produces
135+--------
136+
137+An [atom]().
138+
139+Source
140+------
141+
142+ ++ mit 60
143+
144+Examples
145+--------
146+
147+ ~zod/try=> mit:yo
148+ 60
149+
150+------------------------------------------------------------------------
151+
152+### `++moh`
153+
154+Days in month
155+
156+The days in each month of the Gregorian common year. A list of unsigned
157+decimal atoms (Either 28, 30, or 31) denoting the number of days in the
158+month at the year at that index.
159+
160+Produces
161+--------
162+
163+A [`++list`]() of [`@ud`]()
164+
165+Source
166+------
167+
168+ ++ moh `(list ,@ud)`[31 28 31 30 31 30 31 31 30 31 30 31 ~]
169+
170+Examples
171+--------
172+
173+ ~zod/try=> moh:yo
174+ ~[31 28 31 30 31 30 31 31 30 31 30 31]
175+ ~zod/try=> (snag 4 moh:yo)
176+ 31
177+
178+------------------------------------------------------------------------
179+
180+### `++moy`
181+
182+Moh with leapyear
183+
184+The days in each month of the Gregorian leap-year. A list of unsigned
185+decimal atoms (Either 29,30, or 31) denoting the number of days in the
186+month at the leap-year at that index.
187+
188+Examples
189+--------
190+
191+A [`++list`]() of [`@ud`]()
192+
193+Source
194+------
195+
196+ ++ moy `(list ,@ud)`[31 29 31 30 31 30 31 31 30 31 30 31 ~]
197+
198+Examples
199+--------
200+
201+ ~zod/try=> moy:yo
202+ ~[31 29 31 30 31 30 31 31 30 31 30 31]
203+ ~zod/try=> (snag 1 moy:yo)
204+ 29
205+
206+------------------------------------------------------------------------
207+
208+### `++qad`
209+
210+Seconds in 4 years
211+
212+The number of seconds in four years. Derived by adding one second to the
213+number of seconds in four years.
214+
215+Produces
216+--------
217+
218+An [atom]().
219+
220+Source
221+------
222+
223+ ++ qad 126.144.001 :: (add 1 (mul 4 yer))
224+
225+Examples
226+--------
227+
228+ ~zod/try=> qad:yo
229+ 126.144.001
230+
231+------------------------------------------------------------------------
232+
233+### `++yer`
234+
235+Seconds in year
236+
237+The number of seconds in a year. Derived by multiplying the number of
238+seconds in a day by 365.
239+
240+Produces
241+--------
242+
243+An [atom]().
244+
245+Source
246+------
247+
248+ ++ yer 31.536.000 :: (mul 365 day)
249+
250+Examples
251+--------
252+
253+ ~zod/try=> yer:yo
254+ 31.536.000
255+
256+
docs/system/hoon/library/src/3c/gate/yall.mdnew file+54
@@ -0,0 +1,54 @@
1+### `++yall`
2+
3+Time since beginning of time
4+
5+Produce the date tuple of `[y=@ud m=@ud d=@ud]` of the year, month, and
6+day from a number of days from the beginning of time.
7+
8+Accepts
9+-------
10+
11+`day` is a [`@ud`]()
12+
13+Produces
14+--------
15+
16+
17+Source
18+------
19+
20+ ++ yall :: day # to day of year
21+ |= day=@ud
22+ ^- [y=@ud m=@ud d=@ud]
23+ =+ [era=0 cet=0 lep=_?]
24+ => .(era (div day era:yo), day (mod day era:yo))
25+ => ^+ .
26+ ?: (lth day +(cet:yo))
27+ .(lep &, cet 0)
28+ => .(lep |, cet 1, day (sub day +(cet:yo)))
29+ .(cet (add cet (div day cet:yo)), day (mod day cet:yo))
30+ =+ yer=(add (mul 400 era) (mul 100 cet))
31+ |- ^- [y=@ud m=@ud d=@ud]
32+ =+ dis=?:(lep 366 365)
33+ ?. (lth day dis)
34+ =+ ner=+(yer)
35+ $(yer ner, day (sub day dis), lep =(0 (end 0 2 ner)))
36+ |- ^- [y=@ud m=@ud d=@ud]
37+ =+ [mot=0 cah=?:(lep moy:yo moh:yo)]
38+ |- ^- [y=@ud m=@ud d=@ud]
39+ =+ zis=(snag mot cah)
40+ ?: (lth day zis)
41+ [yer +(mot) +(day)]
42+ $(mot +(mot), day (sub day zis))
43+
44+Examples
45+--------
46+
47+ ~zod/try=> (yall 198)
48+ [y=0 m=7 d=17]
49+ ~zod/try=> (yall 90.398)
50+ [y=247 m=7 d=3]
51+ ~zod/try=> (yall 0)
52+ [y=0 m=1 d=1]
53+
54+
docs/system/hoon/library/src/3c/gate/yawn.mdnew file+60
@@ -0,0 +1,60 @@
1+### `++yawn`
2+
3+Days since beginning of time
4+
5+Inverse of `yall`, computes number of days A.D. from y/m/d date as the
6+tuple `[yer=@ud mot=@ud day=@ud]`.
7+
8+Accepts
9+-------
10+
11+`yer` is an unsigned decimal, `@ud`.
12+
13+`mon` is an unsigned decimal, `@ud`.
14+
15+`day` is an unsigned decimal, `@ud`.
16+
17+Produces
18+--------
19+
20+A [`@ud`]().
21+
22+Source
23+------
24+
25+ ++ yawn :: days since Jesus
26+ |= [yer=@ud mot=@ud day=@ud]
27+ ^- @ud
28+ => .(mot (dec mot), day (dec day))
29+ => ^+ .
30+ %= .
31+ day
32+ =+ cah=?:((yelp yer) moy:yo moh:yo)
33+ |- ^- @ud
34+ ?: =(0 mot)
35+ day
36+ $(mot (dec mot), cah (slag 1 cah), day (add day (snag 0 cah)))
37+ ==
38+ |- ^- @ud
39+ ?. =(0 (mod yer 4))
40+ =+ ney=(dec yer)
41+ $(yer ney, day (add day ?:((yelp ney) 366 365)))
42+ ?. =(0 (mod yer 100))
43+ =+ nef=(sub yer 4)
44+ $(yer nef, day (add day ?:((yelp nef) 1.461 1.460)))
45+ ?. =(0 (mod yer 400))
46+ =+ nec=(sub yer 100)
47+ $(yer nec, day (add day ?:((yelp nec) 36.525 36.524)))
48+ (add day (mul (div yer 400) (add 1 (mul 4 36.524))))
49+
50+Examples
51+--------
52+
53+ ~zod/try=> (yawn 2.014 8 4)
54+ 735.814
55+ ~zod/try=> (yawn 1.776 7 4)
56+ 648.856
57+ ~zod/try=> (yawn 1.990 10 11)
58+ 727.116
59+
60+
docs/system/hoon/library/src/3c/gate/year.mdnew file+35
@@ -0,0 +1,35 @@
1+### `++year`
2+
3+Accept a parsed date of form `[[a=? y=@ud] m=@ud t=tarp]` and produce
4+its `@d`representation.
5+
6+Accepts
7+-------
8+
9+`det` is a [`++date`]()
10+
11+Produces
12+--------
13+
14+A [`@d`]().
15+
16+Source
17+------
18+
19+ ++ year :: date to @d
20+ |= det=date
21+ ^- @d
22+ =+ ^= yer
23+ ?: a.det
24+ (add 292.277.024.400 y.det)
25+ (sub 292.277.024.400 (dec y.det))
26+ =+ day=(yawn yer m.det d.t.det)
27+ (yule day h.t.det m.t.det s.t.det f.t.det)
28+
29+Examples
30+--------
31+
32+ ~zod/try=> (year [[a=%.y y=2.014] m=8 t=[d=4 h=20 m=4 s=57 f=~[0xd940]]])
33+ 0x8000000d227df4e9d940000000000000
34+
35+
docs/system/hoon/library/src/3c/gate/yell.mdnew file+38
@@ -0,0 +1,38 @@
1+### `++yell`
2+
3+Produce a parsed daily time format from an atomic date.
4+
5+`now` is a `@d`.
6+
7+Source
8+------
9+
10+ ++ yell :: tarp from @d
11+ |= now=@d
12+ ^- tarp
13+ =+ sec=(rsh 6 1 now)
14+ =+ ^= fan
15+ =+ [muc=4 raw=(end 6 1 now)]
16+ |- ^- (list ,@ux)
17+ ?: |(=(0 raw) =(0 muc))
18+ ~
19+ => .(muc (dec muc))
20+ [(cut 4 [muc 1] raw) $(raw (end 4 muc raw))]
21+ =+ day=(div sec day:yo)
22+ => .(sec (mod sec day:yo))
23+ =+ hor=(div sec hor:yo)
24+ => .(sec (mod sec hor:yo))
25+ =+ mit=(div sec mit:yo)
26+ => .(sec (mod sec mit:yo))
27+ [day hor mit sec fan]
28+
29+Examples
30+--------
31+
32+ ~zod/try=> (yell ~2014.3.20..05.42.53..7456)
33+ [d=106.751.991.820.094 h=5 m=42 s=53 f=~[0x7456]]
34+ ~zod/try=> (yell ~2014.6.9..19.09.40..8b66)
35+ [d=106.751.991.820.175 h=19 m=9 s=40 f=~[0x8b66]]
36+ ~zod/try=> (yell ~1776.7.4)
37+ [d=106.751.991.733.273 h=0 m=0 s=0 f=~]
38+
docs/system/hoon/library/src/3c/gate/yelp.mdnew file+37
@@ -0,0 +1,37 @@
1+### `++yelp`
2+
3+Leap-week?
4+
5+Determines whether a year contains an ISO 8601 leap week. Produces a
6+loobean.
7+
8+Accepts
9+-------
10+
11+`yer` is an unsigned decimal, `@ud`.
12+
13+Produces
14+--------
15+
16+A boolean.
17+
18+Source
19+------
20+
21+ ++ yelp :: leap year
22+ |= yer=@ud ^- ?
23+ &(=(0 (mod yer 4)) |(!=(0 (mod yer 100)) =(0 (mod yer 400))))
24+
25+Examples
26+--------
27+
28+ ~zod/try=> (yelp 2.014)
29+ %.n
30+ ~zod/try=> (yelp 2.008)
31+ %.y
32+ ~zod/try=> (yelp 0)
33+ %.y
34+ ~zod/try=> (yelp 14.011)
35+ %.n
36+
37+
docs/system/hoon/library/src/3c/gate/yore.mdnew file+36
@@ -0,0 +1,36 @@
1+### `++yore`
2+
3+Produces a `++date` from a `@d`
4+
5+Accepts
6+-------
7+
8+`now` is a `@d`.
9+
10+Produces
11+--------
12+
13+A [`++date`]().
14+
15+Source
16+------
17+
18+ ++ yore :: @d to date
19+ |= now=@d
20+ ^- date
21+ =+ rip=(yell now)
22+ =+ ger=(yall d.rip)
23+ :- ?: (gth y.ger 292.277.024.400)
24+ [a=& y=(sub y.ger 292.277.024.400)]
25+ [a=| y=+((sub 292.277.024.400 y.ger))]
26+ [m.ger d.ger h.rip m.rip s.rip f.rip]
27+
28+Examples
29+--------
30+
31+ ~zod/try=> (yore -<-)
32+ [[a=%.y y=2.014] m=8 t=[d=4 h=20 m=17 s=1 f=~[0x700d]]]
33+ ~zod/try=> (yore -<-)
34+ [[a=%.y y=2.014] m=8 t=[d=4 h=20 m=28 s=53 f=~[0x7b82]]]
35+
36+
docs/system/hoon/library/src/3c/gate/yule.mdnew file+55
@@ -0,0 +1,55 @@
1+### `++yule`
2+
3+Daily time to time atom
4+
5+Accept a [`++tarp`](/doc/hoon/library/1#++tarp), a parsed daily time, and produces a time atom,
6+`@d`.
7+
8+Accepts
9+-------
10+
11+`rip` is a [`++tarp`](/doc/hoon/library/1#++tarp).
12+
13+Produces
14+--------
15+
16+A [`@d`]().
17+
18+Source
19+------
20+
21+ ++ yule :: time atom
22+ |= rip=tarp
23+ ^- @d
24+ =+ ^= sec ;: add
25+ (mul d.rip day:yo)
26+ (mul h.rip hor:yo)
27+ (mul m.rip mit:yo)
28+ s.rip
29+ ==
30+ =+ ^= fac =+ muc=4
31+ |- ^- @
32+ ?~ f.rip
33+ 0
34+ => .(muc (dec muc))
35+ (add (lsh 4 muc i.f.rip) $(f.rip t.f.rip))
36+ (con (lsh 6 1 sec) fac)
37+
38+Examples
39+--------
40+
41+ ~zod/try=> =murica (yell ~1776.7.4)
42+ ~zod/try=> murica
43+ [d=106.751.991.733.273 h=0 m=0 s=0 f=~]
44+ ~zod/try=> (yule murica)
45+ 0x8000000b62aaf5800000000000000000
46+ ~zod/try=> `@da`(yule murica)
47+ ~1776.7.4
48+ ~zod/try=> `@da`(yule (yell ~2014.3.20..05.42.53..7456))
49+ ~2014.3.20..05.42.53..7456
50+ ~zod/try=> `tarp`[31 12 30 0 ~]
51+ [d=31 h=12 m=30 s=0 f=~]
52+ ~zod/try=> `@dr`(yule `tarp`[31 12 30 0 ~])
53+ ~d31.h12.m30
54+
55+
docs/system/hoon/library/src/3d/core/og.mdnew file+55
@@ -0,0 +1,55 @@
1+
2+### `++og`
3+
4+ ++ og :: shax-powered rng
5+ ~/ %og
6+ |_ a=@
7+
8+XX document
9+
10+### `++rad`
11+
12+ ++ rad :: random in range
13+ |= b=@ ^- @
14+ =+ c=(raw (met 0 b))
15+ ?:((lth c b) c $(a +(a)))
16+ ::
17+
18+XX document
19+
20+### `++rads`
21+
22+ ++ rads :: random continuation
23+ |= b=@
24+ =+ r=(rad b)
25+ [r +>.$(a (shas %og-s r))]
26+
27+XX document
28+
29+### `++raw`
30+
31+ ++ raw :: random bits
32+ ~/ %raw
33+ |= b=@ ^- @
34+ %+ can
35+ 0
36+ =+ c=(shas %og-a (mix b a))
37+ |- ^- (list ,[@ @])
38+ ?: =(0 b)
39+ ~
40+ =+ d=(shas %og-b (mix b (mix a c)))
41+ ?: (lth b 256)
42+ [[b (end 0 b d)] ~]
43+ [[256 d] $(c d, b (sub b 256))]
44+
45+XX document
46+
47+### `++raws`
48+
49+ ++ raws :: random bits continuation
50+ |= b=@
51+ =+ r=(raw b)
52+ [r +>.$(a (shas %og-s r))]
53+ --
54+
55+
docs/system/hoon/library/src/3d/gate/shad.mdnew file+7
@@ -0,0 +1,7 @@
1+### `++shad`
2+
3+ ++ shad |=(ruz=@ (shax (shax ruz))) :: double sha-256
4+
5+XX document
6+
7+
docs/system/hoon/library/src/3d/gate/shaf.mdnew file+11
@@ -0,0 +1,11 @@
1+### `++shaf`
2+
3+ ++ shaf :: half sha-256
4+ |= [sal=@ ruz=@]
5+ =+ haz=(shas sal ruz)
6+ (mix (end 7 1 haz) (rsh 7 1 haz))
7+ ::
8+
9+XX document
10+
11+
docs/system/hoon/library/src/3d/gate/shak.mdnew file+10
@@ -0,0 +1,10 @@
1+### `++shak`
2+
3+ ++ shak :: XX shd be PBKDF
4+ |= [who=@p wud=@]
5+ (shas (mix %shak who) wud)
6+ ::
7+
8+XX document
9+
10+
docs/system/hoon/library/src/3d/gate/shal.mdnew file+118
@@ -0,0 +1,118 @@
1+### `++shal`
2+
3+ ++ shal :: sha-512 with length
4+ ~/ %shal
5+ |= [len=@ ruz=@] ^- @
6+ => .(ruz (cut 3 [0 len] ruz))
7+ =+ [few==>(fe .(a 6)) wac=|=([a=@ b=@] (cut 6 [a 1] b))]
8+ =+ [sum=sum.few ror=ror.few net=net.few inv=inv.few]
9+ =+ ral=(lsh 0 3 len)
10+ =+ ^= ful
11+ %+ can 0
12+ :~ [ral ruz]
13+ [8 128]
14+ [(mod (sub 1.920 (mod (add 8 ral) 1.024)) 1.024) 0]
15+ [128 (~(net fe 7) ral)]
16+ ==
17+ =+ lex=(met 10 ful)
18+ =+ ^= kbx 0x6c44.198c.4a47.5817.5fcb.6fab.3ad6.faec.
19+ 597f.299c.fc65.7e2a.4cc5.d4be.cb3e.42b6.
20+ 431d.67c4.9c10.0d4c.3c9e.be0a.15c9.bebc.
21+ 32ca.ab7b.40c7.2493.28db.77f5.2304.7d84.
22+ 1b71.0b35.131c.471b.113f.9804.bef9.0dae.
23+ 0a63.7dc5.a2c8.98a6.06f0.67aa.7217.6fba.
24+ f57d.4f7f.ee6e.d178.eada.7dd6.cde0.eb1e.
25+ d186.b8c7.21c0.c207.ca27.3ece.ea26.619c.
26+ c671.78f2.e372.532b.bef9.a3f7.b2c6.7915.
27+ a450.6ceb.de82.bde9.90be.fffa.2363.1e28.
28+ 8cc7.0208.1a64.39ec.84c8.7814.a1f0.ab72.
29+ 78a5.636f.4317.2f60.748f.82ee.5def.b2fc.
30+ 682e.6ff3.d6b2.b8a3.5b9c.ca4f.7763.e373.
31+ 4ed8.aa4a.e341.8acb.391c.0cb3.c5c9.5a63.
32+ 34b0.bcb5.e19b.48a8.2748.774c.df8e.eb99.
33+ 1e37.6c08.5141.ab53.19a4.c116.b8d2.d0c8.
34+ 106a.a070.32bb.d1b8.f40e.3585.5771.202a.
35+ d699.0624.5565.a910.d192.e819.d6ef.5218.
36+ c76c.51a3.0654.be30.c24b.8b70.d0f8.9791.
37+ a81a.664b.bc42.3001.a2bf.e8a1.4cf1.0364.
38+ 9272.2c85.1482.353b.81c2.c92e.47ed.aee6.
39+ 766a.0abb.3c77.b2a8.650a.7354.8baf.63de.
40+ 5338.0d13.9d95.b3df.4d2c.6dfc.5ac4.2aed.
41+ 2e1b.2138.5c26.c926.27b7.0a85.46d2.2ffc.
42+ 1429.2967.0a0e.6e70.06ca.6351.e003.826f.
43+ d5a7.9147.930a.a725.c6e0.0bf3.3da8.8fc2.
44+ bf59.7fc7.beef.0ee4.b003.27c8.98fb.213f.
45+ a831.c66d.2db4.3210.983e.5152.ee66.dfab.
46+ 76f9.88da.8311.53b5.5cb0.a9dc.bd41.fbd4.
47+ 4a74.84aa.6ea6.e483.2de9.2c6f.592b.0275.
48+ 240c.a1cc.77ac.9c65.0fc1.9dc6.8b8c.d5b5.
49+ efbe.4786.384f.25e3.e49b.69c1.9ef1.4ad2.
50+ c19b.f174.cf69.2694.9bdc.06a7.25c7.1235.
51+ 80de.b1fe.3b16.96b1.72be.5d74.f27b.896f.
52+ 550c.7dc3.d5ff.b4e2.2431.85be.4ee4.b28c.
53+ 1283.5b01.4570.6fbe.d807.aa98.a303.0242.
54+ ab1c.5ed5.da6d.8118.923f.82a4.af19.4f9b.
55+ 59f1.11f1.b605.d019.3956.c25b.f348.b538.
56+ e9b5.dba5.8189.dbbc.b5c0.fbcf.ec4d.3b2f.
57+ 7137.4491.23ef.65cd.428a.2f98.d728.ae22
58+ =+ ^= hax 0x5be0.cd19.137e.2179.1f83.d9ab.fb41.bd6b.
59+ 9b05.688c.2b3e.6c1f.510e.527f.ade6.82d1.
60+ a54f.f53a.5f1d.36f1.3c6e.f372.fe94.f82b.
61+ bb67.ae85.84ca.a73b.6a09.e667.f3bc.c908
62+ =+ i=0
63+ |- ^- @
64+ ?: =(i lex)
65+ (rep 6 (turn (rip 6 hax) net))
66+ =+ ^= wox
67+ =+ dux=(cut 10 [i 1] ful)
68+ =+ wox=(rep 6 (turn (rip 6 dux) net))
69+ =+ j=16
70+ |- ^- @
71+ ?: =(80 j)
72+ wox
73+ =+ :* l=(wac (sub j 15) wox)
74+ m=(wac (sub j 2) wox)
75+ n=(wac (sub j 16) wox)
76+ o=(wac (sub j 7) wox)
77+ ==
78+ =+ x=:(mix (ror 0 1 l) (ror 0 8 l) (rsh 0 7 l))
79+ =+ y=:(mix (ror 0 19 m) (ror 0 61 m) (rsh 0 6 m))
80+ =+ z=:(sum n x o y)
81+ $(wox (con (lsh 6 j z) wox), j +(j))
82+ =+ j=0
83+ =+ :* a=(wac 0 hax)
84+ b=(wac 1 hax)
85+ c=(wac 2 hax)
86+ d=(wac 3 hax)
87+ e=(wac 4 hax)
88+ f=(wac 5 hax)
89+ g=(wac 6 hax)
90+ h=(wac 7 hax)
91+ ==
92+ |- ^- @
93+ ?: =(80 j)
94+ %= ^$
95+ i +(i)
96+ hax %+ rep 6
97+ :~ (sum a (wac 0 hax))
98+ (sum b (wac 1 hax))
99+ (sum c (wac 2 hax))
100+ (sum d (wac 3 hax))
101+ (sum e (wac 4 hax))
102+ (sum f (wac 5 hax))
103+ (sum g (wac 6 hax))
104+ (sum h (wac 7 hax))
105+ ==
106+ ==
107+ =+ l=:(mix (ror 0 28 a) (ror 0 34 a) (ror 0 39 a)) :: S0
108+ =+ m=:(mix (dis a b) (dis a c) (dis b c)) :: maj
109+ =+ n=(sum l m) :: t2
110+ =+ o=:(mix (ror 0 14 e) (ror 0 18 e) (ror 0 41 e)) :: S1
111+ =+ p=(mix (dis e f) (dis (inv e) g)) :: ch
112+ =+ q=:(sum h o p (wac j kbx) (wac j wox)) :: t1
113+ $(j +(j), a (sum q n), b a, c b, d c, e (sum d q), f e, g f, h g)
114+ ::
115+
116+XX document
117+
118+
docs/system/hoon/library/src/3d/gate/sham.mdnew file+12
@@ -0,0 +1,12 @@
1+### `++sham`
2+
3+ ++ sham :: noun hash
4+ |= yux=* ^- @uvH ^- @
5+ ?@ yux
6+ (shaf %mash yux)
7+ (shaf %sham (jam yux))
8+ ::
9+
10+XX document
11+
12+
docs/system/hoon/library/src/3d/gate/shan.mdnew file+71
@@ -0,0 +1,71 @@
1+### `++shan`
2+
3+ ++ shan :: sha-1 (deprecated)
4+ |= ruz=@
5+ =+ [few==>(fe .(a 5)) wac=|=([a=@ b=@] (cut 5 [a 1] b))]
6+ =+ [sum=sum.few ror=ror.few rol=rol.few net=net.few inv=inv.few]
7+ =+ ral=(lsh 0 3 (met 3 ruz))
8+ =+ ^= ful
9+ %+ can 0
10+ :~ [ral ruz]
11+ [8 128]
12+ [(mod (sub 960 (mod (add 8 ral) 512)) 512) 0]
13+ [64 (~(net fe 6) ral)]
14+ ==
15+ =+ lex=(met 9 ful)
16+ =+ kbx=0xca62.c1d6.8f1b.bcdc.6ed9.eba1.5a82.7999
17+ =+ hax=0xc3d2.e1f0.1032.5476.98ba.dcfe.efcd.ab89.6745.2301
18+ =+ i=0
19+ |-
20+ ?: =(i lex)
21+ (rep 5 (flop (rip 5 hax)))
22+ =+ ^= wox
23+ =+ dux=(cut 9 [i 1] ful)
24+ =+ wox=(rep 5 (turn (rip 5 dux) net))
25+ =+ j=16
26+ |- ^- @
27+ ?: =(80 j)
28+ wox
29+ =+ :* l=(wac (sub j 3) wox)
30+ m=(wac (sub j 8) wox)
31+ n=(wac (sub j 14) wox)
32+ o=(wac (sub j 16) wox)
33+ ==
34+ =+ z=(rol 0 1 :(mix l m n o))
35+ $(wox (con (lsh 5 j z) wox), j +(j))
36+ =+ j=0
37+ =+ :* a=(wac 0 hax)
38+ b=(wac 1 hax)
39+ c=(wac 2 hax)
40+ d=(wac 3 hax)
41+ e=(wac 4 hax)
42+ ==
43+ |- ^- @
44+ ?: =(80 j)
45+ %= ^$
46+ i +(i)
47+ hax %+ rep 5
48+ :~
49+ (sum a (wac 0 hax))
50+ (sum b (wac 1 hax))
51+ (sum c (wac 2 hax))
52+ (sum d (wac 3 hax))
53+ (sum e (wac 4 hax))
54+ ==
55+ ==
56+ =+ fx=(con (dis b c) (dis (not 5 1 b) d))
57+ =+ fy=:(mix b c d)
58+ =+ fz=:(con (dis b c) (dis b d) (dis c d))
59+ =+ ^= tem
60+ ?: &((gte j 0) (lte j 19))
61+ :(sum (rol 0 5 a) fx e (wac 0 kbx) (wac j wox))
62+ ?: &((gte j 20) (lte j 39))
63+ :(sum (rol 0 5 a) fy e (wac 1 kbx) (wac j wox))
64+ ?: &((gte j 40) (lte j 59))
65+ :(sum (rol 0 5 a) fz e (wac 2 kbx) (wac j wox))
66+ :(sum (rol 0 5 a) fy e (wac 3 kbx) (wac j wox))
67+ $(j +(j), a tem, b a, c (rol 0 30 b), d c, e d)
68+
69+XX document
70+
71+
docs/system/hoon/library/src/3d/gate/shas.mdnew file+10
@@ -0,0 +1,10 @@
1+### `++shas`
2+
3+ ++ shas :: salted hash
4+ |= [sal=@ ruz=@]
5+ (shax (mix sal (shax ruz)))
6+ ::
7+
8+XX document
9+
10+
docs/system/hoon/library/src/3d/gate/shaw.mdnew file+8
@@ -0,0 +1,8 @@
1+### `++shaw`
2+
3+ ++ shaw :: hash to nbits
4+ |= [sal=@ len=@ ruz=@]
5+ (~(raw og (shas sal (mix len ruz))) len)
6+ ::
7+
8+
docs/system/hoon/library/src/3d/gate/shax.mdnew file+92
@@ -0,0 +1,92 @@
1+### `++shax`
2+
3+ ++ shax :: sha-256
4+ ~/ %shax
5+ |= ruz=@ ^- @
6+ ~| %sha
7+ =+ [few==>(fe .(a 5)) wac=|=([a=@ b=@] (cut 5 [a 1] b))]
8+ =+ [sum=sum.few ror=ror.few net=net.few inv=inv.few]
9+ =+ ral=(lsh 0 3 (met 3 ruz))
10+ =+ ^= ful
11+ %+ can 0
12+ :~ [ral ruz]
13+ [8 128]
14+ [(mod (sub 960 (mod (add 8 ral) 512)) 512) 0]
15+ [64 (~(net fe 6) ral)]
16+ ==
17+ =+ lex=(met 9 ful)
18+ =+ ^= kbx 0xc671.78f2.bef9.a3f7.a450.6ceb.90be.fffa.
19+ 8cc7.0208.84c8.7814.78a5.636f.748f.82ee.
20+ 682e.6ff3.5b9c.ca4f.4ed8.aa4a.391c.0cb3.
21+ 34b0.bcb5.2748.774c.1e37.6c08.19a4.c116.
22+ 106a.a070.f40e.3585.d699.0624.d192.e819.
23+ c76c.51a3.c24b.8b70.a81a.664b.a2bf.e8a1.
24+ 9272.2c85.81c2.c92e.766a.0abb.650a.7354.
25+ 5338.0d13.4d2c.6dfc.2e1b.2138.27b7.0a85.
26+ 1429.2967.06ca.6351.d5a7.9147.c6e0.0bf3.
27+ bf59.7fc7.b003.27c8.a831.c66d.983e.5152.
28+ 76f9.88da.5cb0.a9dc.4a74.84aa.2de9.2c6f.
29+ 240c.a1cc.0fc1.9dc6.efbe.4786.e49b.69c1.
30+ c19b.f174.9bdc.06a7.80de.b1fe.72be.5d74.
31+ 550c.7dc3.2431.85be.1283.5b01.d807.aa98.
32+ ab1c.5ed5.923f.82a4.59f1.11f1.3956.c25b.
33+ e9b5.dba5.b5c0.fbcf.7137.4491.428a.2f98
34+ =+ ^= hax 0x5be0.cd19.1f83.d9ab.9b05.688c.510e.527f.
35+ a54f.f53a.3c6e.f372.bb67.ae85.6a09.e667
36+ =+ i=0
37+ |- ^- @
38+ ?: =(i lex)
39+ (rep 5 (turn (rip 5 hax) net))
40+ =+ ^= wox
41+ =+ dux=(cut 9 [i 1] ful)
42+ =+ wox=(rep 5 (turn (rip 5 dux) net))
43+ =+ j=16
44+ |- ^- @
45+ ?: =(64 j)
46+ wox
47+ =+ :* l=(wac (sub j 15) wox)
48+ m=(wac (sub j 2) wox)
49+ n=(wac (sub j 16) wox)
50+ o=(wac (sub j 7) wox)
51+ ==
52+ =+ x=:(mix (ror 0 7 l) (ror 0 18 l) (rsh 0 3 l))
53+ =+ y=:(mix (ror 0 17 m) (ror 0 19 m) (rsh 0 10 m))
54+ =+ z=:(sum n x o y)
55+ $(wox (con (lsh 5 j z) wox), j +(j))
56+ =+ j=0
57+ =+ :* a=(wac 0 hax)
58+ b=(wac 1 hax)
59+ c=(wac 2 hax)
60+ d=(wac 3 hax)
61+ e=(wac 4 hax)
62+ f=(wac 5 hax)
63+ g=(wac 6 hax)
64+ h=(wac 7 hax)
65+ ==
66+ |- ^- @
67+ ?: =(64 j)
68+ %= ^$
69+ i +(i)
70+ hax %+ rep 5
71+ :~ (sum a (wac 0 hax))
72+ (sum b (wac 1 hax))
73+ (sum c (wac 2 hax))
74+ (sum d (wac 3 hax))
75+ (sum e (wac 4 hax))
76+ (sum f (wac 5 hax))
77+ (sum g (wac 6 hax))
78+ (sum h (wac 7 hax))
79+ ==
80+ ==
81+ =+ l=:(mix (ror 0 2 a) (ror 0 13 a) (ror 0 22 a)) :: s0
82+ =+ m=:(mix (dis a b) (dis a c) (dis b c)) :: maj
83+ =+ n=(sum l m) :: t2
84+ =+ o=:(mix (ror 0 6 e) (ror 0 11 e) (ror 0 25 e)) :: s1
85+ =+ p=(mix (dis e f) (dis (inv e) g)) :: ch
86+ =+ q=:(sum h o p (wac j kbx) (wac j wox)) :: t1
87+ $(j +(j), a (sum q n), b a, c b, d c, e (sum d q), f e, g f, h g)
88+ ::
89+
90+XX document
91+
92+
docs/system/hoon/library/src/3d/gate/shaz.mdnew file+7
@@ -0,0 +1,7 @@
1+### `++shaz`
2+
3+ ++ shaz :: sha-512
4+ |= ruz=@ ^- @
5+ (shal [(met 3 ruz) ruz])
6+
7+
docs/system/hoon/library/src/3e/core/aesc.mdnew file+712
@@ -0,0 +1,712 @@
1+### `++aesc`
2+
3+ ++ aesc :: AES-256
4+ ~% %aesc + ~
5+ |%
6+
7+XX document
8+
9+### `++en`
10+
11+ ++ en :: ECB enc
12+ ~/ %en
13+ |= [a=@I b=@H] ^- @uxH
14+ =+ ahem
15+ (be & (ex a) b)
16+
17+XX document
18+
19+### `++de`
20+
21+ ++ de :: ECB dec
22+ ~/ %de
23+ |= [a=@I b=@H] ^- @uxH
24+ =+ ahem
25+ (be | (ix (ex a)) b)
26+ --
27+
28+XX document
29+
30+### `++ahem`
31+
32+ ++ ahem :: AES helpers
33+ :: XX should be in aesc, isn't for performance reasons
34+ =>
35+ =+ =+ [gr=(ga 8 0x11b 3) few==>(fe .(a 5))]
36+ =+ [pro=pro.gr dif=dif.gr pow=pow.gr ror=ror.few]
37+ [pro=pro dif=dif pow=pow ror=ror nnk=8 nnb=4 nnr=14]
38+ => |%
39+
40+XX document
41+
42+### `++cipa`
43+
44+ ++ cipa :: AES params
45+ $_ ^? |%
46+
47+XX document
48+
49+### `++co`
50+
51+ ++ co [0xe 0xb 0xd 0x9]
52+
53+XX document
54+
55+### `++ix`
56+
57+ ++ ix :: key expand, inv
58+ |= a=@ ^- @
59+ =+ [i=1 j=_@ b=_@ c=co:pin]
60+ |-
61+ ?: =(nnr i)
62+ a
63+ => .(b (cut 7 [i 1] a))
64+ => .(b (rep 5 (mcol (pode 5 4 b) c)))
65+ => .(j (sub nnr i))
66+ %= $
67+ i +(i)
68+ a
69+ %+ can 7
70+ :~ [i (cut 7 [0 i] a)]
71+ [1 b]
72+ [j (cut 7 [+(i) j] a)]
73+ ==
74+ ==
75+ --
76+ ::
77+
78+XX document
79+
80+### `++ro`
81+
82+ ++ ro [0 3 2 1]
83+
84+XX document
85+
86+### `++su`
87+
88+ ++ su 0x7d0c.2155.6314.69e1.26d6.77ba.7e04.2b17.
89+ 6199.5383.3cbb.ebc8.b0f5.2aae.4d3b.e0a0.
90+ ef9c.c993.9f7a.e52d.0d4a.b519.a97f.5160.
91+ 5fec.8027.5910.12b1.31c7.0788.33a8.dd1f.
92+ f45a.cd78.fec0.db9a.2079.d2c6.4b3e.56fc.
93+ 1bbe.18aa.0e62.b76f.89c5.291d.711a.f147.
94+ 6edf.751c.e837.f9e2.8535.ade7.2274.ac96.
95+ 73e6.b4f0.cecf.f297.eadc.674f.4111.913a.
96+ 6b8a.1301.03bd.afc1.020f.3fca.8f1e.2cd0.
97+ 0645.b3b8.0558.e4f7.0ad3.bc8c.00ab.d890.
98+ 849d.8da7.5746.155e.dab9.edfd.5048.706c.
99+ 92b6.655d.cc5c.a4d4.1698.6886.64f6.f872.
100+ 25d1.8b6d.49a2.5b76.b224.d928.66a1.2e08.
101+ 4ec3.fa42.0b95.4cee.3d23.c2a6.3294.7b54.
102+ cbe9.dec4.4443.8e34.87ff.2f9b.8239.e37c.
103+ fbd7.f381.9ea3.40bf.38a5.3630.d56a.0952
104+ --
105+ ::
106+
107+XX document
108+
109+### `++pen`
110+
111+ ++ pen :: encrypt
112+ ^- cipa
113+ |%
114+
115+XX document
116+
117+### `++co`
118+
119+ ++ co [0xe 0xb 0xd 0x9]
120+
121+XX document
122+
123+### `++ix`
124+
125+ ++ ix :: key expand, inv
126+ |= a=@ ^- @
127+ =+ [i=1 j=_@ b=_@ c=co:pin]
128+ |-
129+ ?: =(nnr i)
130+ a
131+ => .(b (cut 7 [i 1] a))
132+ => .(b (rep 5 (mcol (pode 5 4 b) c)))
133+ => .(j (sub nnr i))
134+ %= $
135+ i +(i)
136+ a
137+ %+ can 7
138+ :~ [i (cut 7 [0 i] a)]
139+ [1 b]
140+ [j (cut 7 [+(i) j] a)]
141+ ==
142+ ==
143+ --
144+ ::
145+
146+XX document
147+
148+### `++ro`
149+
150+ ++ ro [0 3 2 1]
151+
152+XX document
153+
154+### `++su`
155+
156+ ++ su 0x7d0c.2155.6314.69e1.26d6.77ba.7e04.2b17.
157+ 6199.5383.3cbb.ebc8.b0f5.2aae.4d3b.e0a0.
158+ ef9c.c993.9f7a.e52d.0d4a.b519.a97f.5160.
159+ 5fec.8027.5910.12b1.31c7.0788.33a8.dd1f.
160+ f45a.cd78.fec0.db9a.2079.d2c6.4b3e.56fc.
161+ 1bbe.18aa.0e62.b76f.89c5.291d.711a.f147.
162+ 6edf.751c.e837.f9e2.8535.ade7.2274.ac96.
163+ 73e6.b4f0.cecf.f297.eadc.674f.4111.913a.
164+ 6b8a.1301.03bd.afc1.020f.3fca.8f1e.2cd0.
165+ 0645.b3b8.0558.e4f7.0ad3.bc8c.00ab.d890.
166+ 849d.8da7.5746.155e.dab9.edfd.5048.706c.
167+ 92b6.655d.cc5c.a4d4.1698.6886.64f6.f872.
168+ 25d1.8b6d.49a2.5b76.b224.d928.66a1.2e08.
169+ 4ec3.fa42.0b95.4cee.3d23.c2a6.3294.7b54.
170+ cbe9.dec4.4443.8e34.87ff.2f9b.8239.e37c.
171+ fbd7.f381.9ea3.40bf.38a5.3630.d56a.0952
172+ --
173+ ::
174+
175+XX document
176+
177+### `++pin`
178+
179+ ++ pin :: decrypt
180+ ^- cipa
181+ |%
182+
183+XX document
184+
185+### `++co`
186+
187+ ++ co [0xe 0xb 0xd 0x9]
188+
189+XX document
190+
191+### `++ix`
192+
193+ ++ ix :: key expand, inv
194+ |= a=@ ^- @
195+ =+ [i=1 j=_@ b=_@ c=co:pin]
196+ |-
197+ ?: =(nnr i)
198+ a
199+ => .(b (cut 7 [i 1] a))
200+ => .(b (rep 5 (mcol (pode 5 4 b) c)))
201+ => .(j (sub nnr i))
202+ %= $
203+ i +(i)
204+ a
205+ %+ can 7
206+ :~ [i (cut 7 [0 i] a)]
207+ [1 b]
208+ [j (cut 7 [+(i) j] a)]
209+ ==
210+ ==
211+ --
212+ ::
213+
214+XX document
215+
216+### `++ro`
217+
218+ ++ ro [0 3 2 1]
219+
220+XX document
221+
222+### `++su`
223+
224+ ++ su 0x7d0c.2155.6314.69e1.26d6.77ba.7e04.2b17.
225+ 6199.5383.3cbb.ebc8.b0f5.2aae.4d3b.e0a0.
226+ ef9c.c993.9f7a.e52d.0d4a.b519.a97f.5160.
227+ 5fec.8027.5910.12b1.31c7.0788.33a8.dd1f.
228+ f45a.cd78.fec0.db9a.2079.d2c6.4b3e.56fc.
229+ 1bbe.18aa.0e62.b76f.89c5.291d.711a.f147.
230+ 6edf.751c.e837.f9e2.8535.ade7.2274.ac96.
231+ 73e6.b4f0.cecf.f297.eadc.674f.4111.913a.
232+ 6b8a.1301.03bd.afc1.020f.3fca.8f1e.2cd0.
233+ 0645.b3b8.0558.e4f7.0ad3.bc8c.00ab.d890.
234+ 849d.8da7.5746.155e.dab9.edfd.5048.706c.
235+ 92b6.655d.cc5c.a4d4.1698.6886.64f6.f872.
236+ 25d1.8b6d.49a2.5b76.b224.d928.66a1.2e08.
237+ 4ec3.fa42.0b95.4cee.3d23.c2a6.3294.7b54.
238+ cbe9.dec4.4443.8e34.87ff.2f9b.8239.e37c.
239+ fbd7.f381.9ea3.40bf.38a5.3630.d56a.0952
240+ --
241+ ::
242+
243+XX document
244+
245+### `++mcol`
246+
247+ ++ mcol
248+ |= [a=(list ,@) b=[p=@ q=@ r=@ s=@]] ^- (list ,@)
249+ =+ c=[p=_@ q=_@ r=_@ s=_@]
250+ |- ^- (list ,@)
251+ ?~ a ~
252+ => .(p.c (cut 3 [0 1] i.a))
253+ => .(q.c (cut 3 [1 1] i.a))
254+ => .(r.c (cut 3 [2 1] i.a))
255+ => .(s.c (cut 3 [3 1] i.a))
256+ :_ $(a t.a)
257+ %+ rep 3
258+ %+ turn
259+ %- limo
260+ :~ [[p.c p.b] [q.c q.b] [r.c r.b] [s.c s.b]]
261+ [[p.c s.b] [q.c p.b] [r.c q.b] [s.c r.b]]
262+ [[p.c r.b] [q.c s.b] [r.c p.b] [s.c q.b]]
263+ [[p.c q.b] [q.c r.b] [r.c s.b] [s.c p.b]]
264+ ==
265+ |= [a=[@ @] b=[@ @] c=[@ @] d=[@ @]]
266+ :(dif (pro a) (pro b) (pro c) (pro d))
267+ ::
268+
269+XX document
270+
271+### `++pode`
272+
273+ ++ pode :: explode to block
274+ |= [a=bloq b=@ c=@] ^- (list ,@)
275+ =+ d=(rip a c)
276+ =+ m=(met a c)
277+ |-
278+ ?: =(m b)
279+ d
280+ $(m +(m), d (weld d (limo [0 ~])))
281+
282+XX document
283+
284+### `++sube`
285+
286+ ++ sube :: s-box word
287+ |= [a=@ b=@] ^- @
288+ (rep 3 (turn (pode 3 4 a) |=(c=@ (cut 3 [c 1] b))))
289+ --
290+ |%
291+
292+XX document
293+
294+### `++be`
295+
296+ ++ be :: block cipher
297+ |= [a=? b=@ c=@H] ^- @uxH
298+ ~| %be-aesc
299+ => %= .
300+ +
301+ => +
302+ |%
303+
304+XX document
305+
306+### `++ankh`
307+
308+ ++ ankh
309+ |= [a=cipa b=@ c=@]
310+ (pode 5 nnb (cut 5 [(mul (ix.a b) nnb) nnb] c))
311+
312+XX document
313+
314+### `++sark`
315+
316+ ++ sark
317+ |= [c=(list ,@) d=(list ,@)] ^- (list ,@)
318+ ?~ c ~
319+ ?~ d !!
320+ [(mix i.c i.d) $(c t.c, d t.d)]
321+
322+XX document
323+
324+### `++srow`
325+
326+ ++ srow
327+ |= [a=cipa b=(list ,@)] ^- (list ,@)
328+ =+ [c=0 d=~ e=ro.a]
329+ |-
330+ ?: =(c nnb)
331+ d
332+ :_ $(c +(c))
333+ %+ rep 3
334+ %+ turn
335+ (limo [0 p.e] [1 q.e] [2 r.e] [3 s.e] ~)
336+ |= [f=@ g=@]
337+ (cut 3 [f 1] (snag (mod (add g c) nnb) b))
338+
339+XX document
340+
341+### `++subs`
342+
343+ ++ subs
344+ |= [a=cipa b=(list ,@)] ^- (list ,@)
345+ ?~ b ~
346+ [(sube i.b su.a) $(b t.b)]
347+ --
348+ ==
349+ =+ [d=?:(a pen pin) e=(pode 5 nnb c) f=1]
350+ => .(e (sark e (ankh d 0 b)))
351+ |-
352+ ?. =(nnr f)
353+ => .(e (subs d e))
354+ => .(e (srow d e))
355+ => .(e (mcol e co.d))
356+ => .(e (sark e (ankh d f b)))
357+ $(f +(f))
358+ => .(e (subs d e))
359+ => .(e (srow d e))
360+ => .(e (sark e (ankh d nnr b)))
361+ (rep 5 e)
362+
363+XX document
364+
365+### `++ex`
366+
367+ ++ ex :: key expand
368+ |= a=@I ^- @
369+ =+ [b=a c=0 d=su:pen i=nnk]
370+ |-
371+ ?: =(i (mul nnb +(nnr)))
372+ b
373+ => .(c (cut 5 [(dec i) 1] b))
374+ => ?: =(0 (mod i nnk))
375+ => .(c (ror 3 1 c))
376+ => .(c (sube c d))
377+ .(c (mix c (pow (dec (div i nnk)) 2)))
378+ ?: &((gth nnk 6) =(4 (mod i nnk)))
379+ .(c (sube c d))
380+ .
381+ => .(c (mix c (cut 5 [(sub i nnk) 1] b)))
382+ => .(b (can 5 [i b] [1 c] ~))
383+ $(i +(i))
384+
385+XX document
386+
387+### `++ix`
388+
389+ ++ ix :: key expand, inv
390+ |= a=@ ^- @
391+ =+ [i=1 j=_@ b=_@ c=co:pin]
392+ |-
393+ ?: =(nnr i)
394+ a
395+ => .(b (cut 7 [i 1] a))
396+ => .(b (rep 5 (mcol (pode 5 4 b) c)))
397+ => .(j (sub nnr i))
398+ %= $
399+ i +(i)
400+ a
401+ %+ can 7
402+ :~ [i (cut 7 [0 i] a)]
403+ [1 b]
404+ [j (cut 7 [+(i) j] a)]
405+ ==
406+ ==
407+ --
408+ ::
409+
410+XX document
411+
412+### `++curt`
413+
414+ ++ curt :: curve25519
415+ |= [a=@ b=@]
416+ => %= .
417+ +
418+ => +
419+ =+ =+ [p=486.662 q=(sub (bex 255) 19)]
420+ =+ fq=~(. fo q)
421+ [p=p q=q fq=fq]
422+ |%
423+
424+XX document
425+
426+### `++cla`
427+
428+ ++ cla
429+ |= raw=@
430+ =+ low=(dis 248 (cut 3 [0 1] raw))
431+ =+ hih=(con 64 (dis 127 (cut 3 [31 1] raw)))
432+ =+ mid=(cut 3 [1 30] raw)
433+ (can 3 [[1 low] [30 mid] [1 hih] ~])
434+
435+XX document
436+
437+### `++sqr`
438+
439+ ++ sqr |=(a=@ (mul a a))
440+
441+XX document
442+
443+### `++inv`
444+
445+ ++ inv |=(a=@ (~(exp fo q) (sub q 2) a))
446+
447+XX document
448+
449+### `++cad`
450+
451+ ++ cad
452+ |= [n=[x=@ z=@] m=[x=@ z=@] d=[x=@ z=@]]
453+ =+ ^= xx
454+ ;: mul 4 z.d
455+ %- sqr %- abs:si
456+ %+ dif:si
457+ (sun:si (mul x.m x.n))
458+ (sun:si (mul z.m z.n))
459+ ==
460+ =+ ^= zz
461+ ;: mul 4 x.d
462+ %- sqr %- abs:si
463+ %+ dif:si
464+ (sun:si (mul x.m z.n))
465+ (sun:si (mul z.m x.n))
466+ ==
467+ [(sit.fq xx) (sit.fq zz)]
468+
469+XX document
470+
471+### `++cub`
472+
473+ ++ cub
474+ |= [x=@ z=@]
475+ =+ ^= xx
476+ %+ mul
477+ %- sqr %- abs:si
478+ (dif:si (sun:si x) (sun:si z))
479+ (sqr (add x z))
480+ =+ ^= zz
481+ ;: mul 4 x z
482+ :(add (sqr x) :(mul p x z) (sqr z))
483+ ==
484+ [(sit.fq xx) (sit.fq zz)]
485+ --
486+ ==
487+ =+ one=[b 1]
488+ =+ i=253
489+ =+ r=one
490+ =+ s=(cub one)
491+ |-
492+ ?: =(i 0)
493+ =+ x=(cub r)
494+ (sit.fq (mul -.x (inv +.x)))
495+ =+ m=(rsh 0 i a)
496+ ?: =(0 (mod m 2))
497+ $(i (dec i), s (cad r s one), r (cub r))
498+ $(i (dec i), r (cad r s one), s (cub s))
499+ ::
500+
501+XX document
502+
503+### `++ed`
504+
505+ ++ ed :: ed25519
506+ =>
507+ =+ =+ [b=256 q=(sub (bex 255) 19)]
508+ =+ fq=~(. fo q)
509+ =+ ^= l
510+ %+ add
511+ (bex 252)
512+ 27.742.317.777.372.353.535.851.937.790.883.648.493
513+ =+ d=(dif.fq 0 (fra.fq 121.665 121.666))
514+ =+ ii=(exp.fq (div (dec q) 4) 2)
515+ [b=b q=q fq=fq l=l d=d ii=ii]
516+ ~% %coed +> ~
517+ |%
518+
519+### `++norm`
520+
521+ ++ norm |=(x=@ ?:(=(0 (mod x 2)) x (sub q x)))
522+ ::
523+
524+XX document
525+
526+### `++xrec`
527+
528+ ++ xrec :: recover x-coord
529+ |= y=@ ^- @
530+ =+ ^= xx
531+ %+ mul (dif.fq (mul y y) 1)
532+ (inv.fq +(:(mul d y y)))
533+ =+ x=(exp.fq (div (add 3 q) 8) xx)
534+ ?: !=(0 (dif.fq (mul x x) (sit.fq xx)))
535+ (norm (pro.fq x ii))
536+ (norm x)
537+ ::
538+
539+XX document
540+
541+### `++ward`
542+
543+ ++ ward :: edwards multiply
544+ |= [pp=[@ @] qq=[@ @]] ^- [@ @]
545+ =+ dp=:(pro.fq d -.pp -.qq +.pp +.qq)
546+ =+ ^= xt
547+ %+ pro.fq
548+ %+ sum.fq
549+ (pro.fq -.pp +.qq)
550+ (pro.fq -.qq +.pp)
551+ (inv.fq (sum.fq 1 dp))
552+ =+ ^= yt
553+ %+ pro.fq
554+ %+ sum.fq
555+ (pro.fq +.pp +.qq)
556+ (pro.fq -.pp -.qq)
557+ (inv.fq (dif.fq 1 dp))
558+ [xt yt]
559+ ::
560+
561+XX document
562+
563+### `++scam`
564+
565+ ++ scam :: scalar multiply
566+ |= [pp=[@ @] e=@] ^- [@ @]
567+ ?: =(0 e)
568+ [0 1]
569+ =+ qq=$(e (div e 2))
570+ => .(qq (ward qq qq))
571+ ?: =(1 (dis 1 e))
572+ (ward qq pp)
573+ qq
574+ ::
575+
576+XX document
577+
578+### `++etch`
579+
580+ ++ etch :: encode point
581+ |= pp=[@ @] ^- @
582+ (can 0 ~[[(sub b 1) +.pp] [1 (dis 1 -.pp)]])
583+ ::
584+
585+XX document
586+
587+### `++curv`
588+
589+ ++ curv :: point on curve?
590+ |= [x=@ y=@] ^- ?
591+ .= 0
592+ %+ dif.fq
593+ %+ sum.fq
594+ (pro.fq (sub q (sit.fq x)) x)
595+ (pro.fq y y)
596+ (sum.fq 1 :(pro.fq d x x y y))
597+ ::
598+
599+XX document
600+
601+### `++deco`
602+
603+ ++ deco :: decode point
604+ |= s=@ ^- (unit ,[@ @])
605+ =+ y=(cut 0 [0 (dec b)] s)
606+ =+ si=(cut 0 [(dec b) 1] s)
607+ =+ x=(xrec y)
608+ => .(x ?:(!=(si (dis 1 x)) (sub q x) x))
609+ =+ pp=[x y]
610+ ?. (curv pp)
611+ ~
612+ [~ pp]
613+ ::
614+
615+XX document
616+
617+### `++bb`
618+
619+ ++ bb
620+ =+ bby=(pro.fq 4 (inv.fq 5))
621+ [(xrec bby) bby]
622+ ::
623+ --
624+ ~% %ed + ~
625+ |%
626+
627+XX document
628+
629+### `++puck`
630+
631+ ++ puck :: public key
632+ ~/ %puck
633+ |= sk=@I ^- @
634+ ?: (gth (met 3 sk) 32) !!
635+ =+ h=(shal (rsh 0 3 b) sk)
636+ =+ ^= a
637+ %+ add
638+ (bex (sub b 2))
639+ (lsh 0 3 (cut 0 [3 (sub b 5)] h))
640+ =+ aa=(scam bb a)
641+ (etch aa)
642+
643+XX document
644+
645+### `++suck`
646+
647+ ++ suck :: keypair from seed
648+ |= se=@I ^- @uJ
649+ =+ pu=(puck se)
650+ (can 0 ~[[b se] [b pu]])
651+ ::
652+
653+XX document
654+
655+### `++sign`
656+
657+ ++ sign :: certify
658+ ~/ %sign
659+ |= [m=@ se=@] ^- @
660+ =+ sk=(suck se)
661+ =+ pk=(cut 0 [b b] sk)
662+ =+ h=(shal (rsh 0 3 b) sk)
663+ =+ ^= a
664+ %+ add
665+ (bex (sub b 2))
666+ (lsh 0 3 (cut 0 [3 (sub b 5)] h))
667+ =+ ^= r
668+ =+ hm=(cut 0 [b b] h)
669+ =+ ^= i
670+ %+ can 0
671+ :~ [b hm]
672+ [(met 0 m) m]
673+ ==
674+ (shaz i)
675+ =+ rr=(scam bb r)
676+ =+ ^= ss
677+ =+ er=(etch rr)
678+ =+ ^= ha
679+ %+ can 0
680+ :~ [b er]
681+ [b pk]
682+ [(met 0 m) m]
683+ ==
684+ (~(sit fo l) (add r (mul (shaz ha) a)))
685+ (can 0 ~[[b (etch rr)] [b ss]])
686+ ::
687+
688+XX document
689+
690+### `++veri`
691+
692+ ++ veri :: validate
693+ ~/ %veri
694+ |= [s=@ m=@ pk=@] ^- ?
695+ ?: (gth (div b 4) (met 3 s)) |
696+ ?: (gth (div b 8) (met 3 pk)) |
697+ =+ cb=(rsh 0 3 b)
698+ =+ rr=(deco (cut 0 [0 b] s))
699+ ?~ rr |
700+ =+ aa=(deco pk)
701+ ?~ aa |
702+ =+ ss=(cut 0 [b b] s)
703+ =+ ha=(can 3 ~[[cb (etch u.rr)] [cb pk] [(met 3 m) m]])
704+ =+ h=(shaz ha)
705+ =((scam bb ss) (ward u.rr (scam u.aa h)))
706+ ::
707+ --
708+ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
709+
710+XX document
711+
712+
docs/system/hoon/library/src/3f/core/ob.mdnew file+255
@@ -0,0 +1,255 @@
1+### `++ob`
2+
3+Reversible scrambling core, v2
4+
5+ ++ ob
6+ |%
7+
8+A core for performing reversible scrambling operations for the `@p` phonetic base.
9+
10+------------------------------------------------------------------------
11+
12+### `++feen`
13+
14+Conceal structure, v2
15+
16+Randomly permutes atoms that fit into 17 to 32 bits into one another. If the
17+atom fits into 33 to 64 bits, does the same permutation on the low 32 bits
18+only. Otherwise, passes the atom through unchanged.
19+
20+Accepts
21+-------
22+
23+An atom.
24+
25+Produces
26+--------
27+
28+An atom.
29+
30+Source
31+------
32+
33+ ++ feen :: conceal structure v2
34+ |= pyn=@ ^- @
35+ ?: &((gte pyn 0x1.0000) (lte pyn 0xffff.ffff))
36+ (add 0x1.0000 (fice (sub pyn 0x1.0000)))
37+ ?: &((gte pyn 0x1.0000.0000) (lte pyn 0xffff.ffff.ffff.ffff))
38+ =+ lo=(dis pyn 0xffff.ffff)
39+ =+ hi=(dis pyn 0xffff.ffff.0000.0000)
40+ %+ con hi
41+ (add 0x1.0000 (fice (sub lo 0x1.0000)))
42+ pyn
43+
44+Examples
45+--------
46+
47+
48+------------------------------------------------------------------------
49+
50+### `++fend`
51+
52+XX
53+
54+Randomly permutes atoms that fit into 17 to 32 bits into one another, and
55+randomly permutes the low 32 bits of atoms that fit into 33 to 64 bits;
56+otherwise, passes the atom through unchanged. The permutation is the inverse of
57+the one applied by [`++feen`]().
58+
59+Accepts
60+-------
61+
62+An atom.
63+
64+Produces
65+--------
66+
67+An atom.
68+
69+Source
70+------
71+
72+ ++ fend :: restore structure v2
73+ |= cry=@ ^- @
74+ ?: &((gte cry 0x1.0000) (lte cry 0xffff.ffff))
75+ (add 0x1.0000 (teil (sub cry 0x1.0000)))
76+ ?: &((gte cry 0x1.0000.0000) (lte cry 0xffff.ffff.ffff.ffff))
77+ =+ lo=(dis cry 0xffff.ffff)
78+ =+ hi=(dis cry 0xffff.ffff.0000.0000)
79+ %+ con hi
80+ (add 0x1.0000 (teil (sub lo 0x1.0000)))
81+ cry
82+
83+Examples
84+--------
85+
86+------------------------------------------------------------------------
87+
88+### `++fice`
89+
90+XX
91+
92+Applies a 3-round Feistel-like cipher to randomly permute atoms in the range `0` to `2^32 - 2^16`. The construction given in Black and Rogaway is ideal for a domain with a size of that form, and as with a conventionel Feistel cipher, three rounds suffice to make the permutation pseudorandom.
93+
94+Accepts
95+-------
96+
97+An atom.
98+
99+Produces
100+--------
101+
102+An atom.
103+
104+Source
105+------
106+
107+ ++ fice :: adapted from
108+ |= nor=@ :: black and rogaway
109+ ^- @ :: "ciphers with
110+ =+ ^= sel :: arbitrary finite
111+ %+ rynd 2 :: domains", 2002
112+ %+ rynd 1
113+ %+ rynd 0
114+ [(mod nor 65.535) (div nor 65.535)]
115+ (add (mul 65.535 -.sel) +.sel)
116+
117+Examples
118+--------
119+
120+------------------------------------------------------------------------
121+
122+### `++teil`
123+
124+XX
125+
126+Applies the reverse of the Feistel-like cipher applied by [`++fice`](). Unlike
127+a conventional Feistel cipher that is its own inverse if keys are used in
128+reverse order, this Feistel-like cipher uses two moduli that must be swapped
129+when applying the reverse transformation.
130+
131+Accepts
132+-------
133+
134+An atom.
135+
136+Produces
137+--------
138+
139+An atom.
140+
141+Source
142+------
143+
144+ ++ teil :: reverse ++fice
145+ |= vip=@
146+ ^- @
147+ =+ ^= sel
148+ %+ rund 0
149+ %+ rund 1
150+ %+ rund 2
151+ [(mod vip 65.535) (div vip 65.535)]
152+ (add (mul 65.535 -.sel) +.sel)
153+
154+Examples
155+--------
156+
157+------------------------------------------------------------------------
158+
159+### `++rynd`
160+
161+XX
162+
163+A single round of the Feistel-like cipher [`++fice`](). AES ([`++aesc`]()) is
164+used as the round function.
165+
166+Accepts
167+-------
168+
169+A cell of three atoms, `n`, `l`, and `r`.
170+
171+Produces
172+--------
173+
174+A cell of two atoms.
175+
176+Source
177+------
178+
179+ ++ rynd :: feistel round
180+ |= [n=@ l=@ r=@]
181+ ^- [@ @]
182+ :- r
183+ ?~ (mod n 2)
184+ (~(sum fo 65.535) l (en:aesc (snag n raku) r))
185+ (~(sum fo 65.536) l (en:aesc (snag n raku) r))
186+
187+Examples
188+--------
189+
190+------------------------------------------------------------------------
191+
192+### `++rund`
193+
194+XX
195+
196+A single round of the Feistel-like reverse cipher [`++teil`]().
197+
198+Accepts
199+-------
200+
201+A cell of three atoms, `n`, `l`, and `r`.
202+
203+Produces
204+--------
205+
206+A cell of two atoms.
207+
208+Source
209+------
210+
211+ ++ rund :: reverse round
212+ |= [n=@ l=@ r=@]
213+ ^- [@ @]
214+ :- r
215+ ?~ (mod n 2)
216+ (~(dif fo 65.535) l (en:aesc (snag n raku) r))
217+ (~(dif fo 65.536) l (en:aesc (snag n raku) r))
218+
219+Examples
220+--------
221+
222+------------------------------------------------------------------------
223+
224+### `++raku`
225+
226+XX
227+
228+
229+Accepts
230+-------
231+
232+A list of atoms of [odor]() [`@ux`]() (hexadecimal).
233+
234+Produces
235+--------
236+
237+Arbitrary keys for use with [`++aesc`]().
238+
239+Source
240+------
241+
242+ ++ raku
243+ ^- (list ,@ux)
244+ :~ 0x15f6.25e3.083a.eb3e.7a55.d4db.fb99.32a3.
245+ 43af.2750.219e.8a24.e5f8.fac3.6c36.f968
246+ 0xf2ff.24fe.54d0.1abd.4b2a.d8aa.4402.8e88.
247+ e82f.19ec.948d.b1bb.ed2e.f791.83a3.8133
248+ 0xa3d8.6a7b.400e.9e91.187d.91a7.6942.f34a.
249+ 6f5f.ab8e.88b9.c089.b2dc.95a6.aed5.e3a4
250+ ==
251+
252+Examples
253+--------
254+
255+
docs/system/hoon/library/src/3f/core/un.mdnew file+364
@@ -0,0 +1,364 @@
1+### `++un`
2+
3+Reversible scrambling core
4+
5+ ++ un :: =(x (wred (wren x)))
6+ |%
7+
8+A core that contains arms that perform reversible scrambling operations.
9+Used in the `@p` phonetic base.
10+
11+------------------------------------------------------------------------
12+
13+### `++wren`
14+
15+Conceal structure
16+
17+Scrambles a bytestring `pyn` by adding the current position to each
18+byte, looking it up in an s-box, and then performing the XOR operation
19+on the result, pushing it forward. Produces an atom.
20+
21+Accepts
22+-------
23+
24+`pyn` is an [atom]().
25+
26+
27+Produces
28+--------
29+
30+Source
31+------
32+
33+ ++ wren :: conceal structure
34+ |= pyn=@ ^- @
35+ =+ len=(met 3 pyn)
36+ ?: =(0 len)
37+ 0
38+ => .(len (dec len))
39+ =+ mig=(zaft (xafo len (cut 3 [len 1] pyn)))
40+ %+ can 3
41+ %- flop ^- (list ,[@ @])
42+ :- [1 mig]
43+ |- ^- (list ,[@ @])
44+ ?: =(0 len)
45+ ~
46+ => .(len (dec len))
47+ =+ mog=(zyft :(mix mig (end 3 1 len) (cut 3 [len 1] pyn)))
48+ [[1 mog] $(mig mog)]
49+ ::
50+
51+Examples
52+--------
53+
54+ ~zod/try=> `@ux`(wren:un 'testing')
55+ 0x30.bf6a.b9fe.7d8f
56+ ~zod/try=> `@ux`'testing'
57+ 0x67.6e69.7473.6574
58+ ~zod/try=> `@da`(wred:un (wren:un ~2001.2.5))
59+ ~2001.2.5
60+
61+------------------------------------------------------------------------
62+
63+### `++wred`
64+
65+Restore structure
66+
67+Unscrambles a bytestring `cry` by subtracting the current position from
68+each byte, looking it up in an s-box, and performing the XOR operation
69+on the result, pushing it forward. Produces an atom.
70+
71+Accepts
72+-------
73+
74+`cry` is an [atom]().
75+
76+Produces
77+--------
78+
79+Source
80+------
81+
82+ ++ wred :: restore structure
83+ |= cry=@ ^- @
84+ =+ len=(met 3 cry)
85+ ?: =(0 len)
86+ 0
87+ => .(len (dec len))
88+ =+ mig=(cut 3 [len 1] cry)
89+ %+ can 3
90+ %- flop ^- (list ,[@ @])
91+ :- [1 (xaro len (zart mig))]
92+ |- ^- (list ,[@ @])
93+ ?: =(0 len)
94+ ~
95+ => .(len (dec len))
96+ =+ mog=(cut 3 [len 1] cry)
97+ [[1 :(mix mig (end 3 1 len) (zyrt mog))] $(mig mog)]
98+ ::
99+
100+Examples
101+--------
102+
103+ ~zod/try=> (wred:un 0x30.bf6a.b9fe.7d8f)
104+ 29.113.321.805.538.676
105+ ~zod/try=> `@t`(wred:un 0x30.bf6a.b9fe.7d8f)
106+ 'testing'
107+ ~zod/try=> (wred:un (wren:un 200.038.426))
108+ 200.038.426
109+
110+------------------------------------------------------------------------
111+
112+### `++xafo`
113+
114+Add modulo 255
115+
116+Produces the sum of two atoms modulo 255, encoded as a nonzero byte.
117+
118+Accepts
119+-------
120+
121+A cell of two atoms, `a` and `b`.
122+
123+Source
124+------
125+
126+ ++ xafo |=([a=@ b=@] +((mod (add (dec b) a) 255)))
127+
128+Examples
129+--------
130+
131+ ~zod/try=> (xafo:un 5 6)
132+ 11
133+ ~zod/try=> (xafo:un 256 20)
134+ 21
135+
136+------------------------------------------------------------------------
137+
138+### `++xaro`
139+
140+Subtract modulo 255
141+
142+Produces the difference between two atoms modulo 255, encoded as a
143+nonzero byte.
144+
145+Accepts
146+-------
147+
148+A cell of two atoms, `a` and `b`.
149+
150+Produces
151+--------
152+
153+An atom.
154+
155+Source
156+------
157+
158+ ++ xaro |=([a=@ b=@] +((mod (add (dec b) (sub 255 (mod a 255))) 255)))
159+
160+Examples
161+--------
162+
163+ ~zod/try=> (xaro:un 17 57)
164+ 40
165+ ~zod/try=> (xaro:un 265 12)
166+ 2
167+
168+------------------------------------------------------------------------
169+
170+### `++zaft`
171+
172+Look up in 255 sub box
173+
174+The inverse of [`++zart`](). Looks up a nonzero byte`a\` in a substiution
175+box with 255 values, producing a unique nonzero byte.
176+
177+Accepts
178+-------
179+
180+`a` is an atom of one byte in length.
181+
182+
183+Produces
184+--------
185+
186+An atom.
187+
188+Source
189+------
190+
191+ ++ zaft :: forward 255-sbox
192+ |= a=@D
193+ =+ ^= b
194+ 0xcc.75bc.86c8.2fb1.9a42.f0b3.79a0.92ca.21f6.1e41.cde5.fcc0.
195+ 7e85.51ae.1005.c72d.1246.07e8.7c64.a914.8d69.d9f4.59c2.8038.
196+ 1f4a.dca2.6fdf.66f9.f561.a12e.5a16.f7b0.a39f.364e.cb70.7318.
197+ 1de1.ad31.63d1.abd4.db68.6a33.134d.a760.edee.5434.493a.e323.
198+ 930d.8f3d.3562.bb81.0b24.43cf.bea5.a6eb.52b4.0229.06b2.6704.
199+ 78c9.45ec.d75e.58af.c577.b7b9.c40e.017d.90c3.87f8.96fa.1153.
200+ 0372.7f30.1c32.ac83.ff17.c6e4.d36d.6b55.e2ce.8c71.8a5b.b6f3.
201+ 9d4b.eab5.8b3c.e7f2.a8fe.9574.5de0.bf20.3f15.9784.9939.5f9c.
202+ e609.564f.d8a4.b825.9819.94aa.2c08.8e4c.9b22.477a.2840.3ed6.
203+ 3750.6ef1.44dd.89ef.6576.d00a.fbda.9ed2.3b6c.7b0c.bde9.2ade.
204+ 5c88.c182.481a.1b0f.2bfd.d591.2726.57ba
205+ (cut 3 [(dec a) 1] b)
206+ ::
207+
208+Examples
209+--------
210+
211+ ~zod/try=> (zaft:un 0x12)
212+ 42
213+ ~zod/try=> (zaft:un 0xff)
214+ 204
215+ ~zod/try=> (zaft:un 0x0)
216+ ! decrement-underflow
217+ ! exit
218+
219+------------------------------------------------------------------------
220+
221+### `++zart`
222+
223+Reverse look up in 255 sub box
224+
225+The inverse of [`++zaft`](). Looks up the index of a nonzero byte `a` in
226+the substitution box with 255 values, producing a unique nonzero byte.
227+
228+Accepts
229+-------
230+
231+`a` is an atom of one byte in length.
232+
233+Produces
234+--------
235+
236+An atom.
237+
238+Source
239+------
240+
241+ ++ zart :: reverse 255-sbox
242+ |= a=@D
243+ =+ ^= b
244+ 0x68.4f07.ea1c.73c9.75c2.efc8.d559.5125.f621.a7a8.8591.5613.
245+ dd52.40eb.65a2.60b7.4bcb.1123.ceb0.1bd6.3c84.2906.b164.19b3.
246+ 1e95.5fec.ffbc.f187.fbe2.6680.7c77.d30e.e94a.9414.fd9a.017d.
247+ 3a7e.5a55.8ff5.8bf9.c181.e5b6.6ab2.35da.50aa.9293.3bc0.cdc6.
248+ f3bf.1a58.4130.f844.3846.744e.36a0.f205.789e.32d8.5e54.5c22.
249+ 0f76.fce7.4569.0d99.d26e.e879.dc16.2df4.887f.1ffe.4dba.6f5d.
250+ bbcc.2663.1762.aed7.af8a.ca20.dbb4.9bc7.a942.834c.105b.c4d4.
251+ 8202.3e61.a671.90e6.273d.bdab.3157.cfa4.0c2e.df86.2496.f7ed.
252+ 2b48.2a9d.5318.a343.d128.be9c.a5ad.6bb5.6dfa.c5e1.3408.128d.
253+ 2c04.0339.97a1.2ff0.49d0.eeb8.6c0a.0b37.b967.c347.d9ac.e072.
254+ e409.7b9f.1598.1d3f.33de.8ce3.8970.8e7a
255+ (cut 3 [(dec a) 1] b)
256+ ::
257+
258+Examples
259+--------
260+
261+ ~zod/try=> `@ux`(zart:un 204)
262+ 0xff
263+ ~zod/try=> `@ux`(zart:un 42)
264+ 0x12
265+
266+------------------------------------------------------------------------
267+
268+### `++zyft`
269+
270+Lookup byte in 256 sub box
271+
272+The inverse of [`++zyrt`](). Looks up a byte `a` in a substituion box
273+with 256 values, producing a byte.
274+
275+Accepts
276+-------
277+
278+`a` is an [atom]() of one byte in length.
279+
280+Produces
281+--------
282+
283+An atom.
284+
285+Source
286+------
287+
288+ ++ zyft :: forward 256-sbox
289+ |= a=@D
290+ =+ ^= b
291+ 0xbb49.b71f.b881.b402.17e4.6b86.69b5.1647.115f.dddb.7ca5.
292+ 8371.4bd5.19a9.b092.605d.0d9b.e030.a0cc.78ba.5706.4d2d.
293+ 986a.768c.f8e8.c4c7.2f1c.effe.3cae.01c0.253e.65d3.3872.
294+ ce0e.7a74.8ac6.daac.7e5c.6479.44ec.4143.3d20.4af0.ee6c.
295+ c828.deca.0377.249f.ffcd.7b4f.eb7d.66f2.8951.042e.595a.
296+ 8e13.f9c3.a79a.f788.6199.9391.7fab.6200.4ce5.0758.e2f1.
297+ 7594.c945.d218.4248.afa1.e61a.54fb.1482.bea4.96a2.3473.
298+ 63c2.e7cb.155b.120a.4ed7.bfd8.b31b.4008.f329.fca3.5380.
299+ 9556.0cb2.8722.2bea.e96e.3ac5.d1bc.10e3.2c52.a62a.b1d6.
300+ 35aa.d05e.f6a8.0f3b.31ed.559d.09ad.f585.6d21.fd1d.8d67.
301+ 370b.26f4.70c1.b923.4684.6fbd.cf8b.5036.0539.9cdc.d93f.
302+ 9068.1edf.8f33.b632.d427.97fa.9ee1
303+ (cut 3 [a 1] b)
304+ ::
305+
306+Examples
307+--------
308+
309+ ~zod/try=> (zyft:un 0x12)
310+ 57
311+ ~zod/try=> (zyft:un 0x0)
312+ 225
313+ ~zod/try=> (zyft:un 0xff)
314+ 187
315+
316+------------------------------------------------------------------------
317+
318+### `++zyrt`
319+
320+Reverse lookup byte in 256 sub box
321+
322+The inverse of [`++zyft`](/doc/hoon/library/2en#++zyft). Looks up a byte `a` in a substituion box
323+with 256 values, producing a byte.
324+
325+Accepts
326+-------
327+
328+`a` is an [atom]() of one byte in length.
329+
330+Produces
331+--------
332+
333+An atom.
334+
335+Source
336+------
337+
338+ ++ zyrt :: reverse 256-sbox
339+ |= a=@D
340+ =+ ^= b
341+ 0x9fc8.2753.6e02.8fcf.8b35.2b20.5598.7caa.c9a9.30b0.9b48.
342+ 47ce.6371.80f6.407d.00dd.0aa5.ed10.ecb7.0f5a.5c3a.e605.
343+ c077.4337.17bd.9eda.62a4.79a7.ccb8.44cd.8e64.1ec4.5b6b.
344+ 1842.ffd8.1dfb.fd07.f2f9.594c.3be3.73c6.2cb6.8438.e434.
345+ 8d3d.ea6a.5268.72db.a001.2e11.de8c.88d3.0369.4f7a.87e2.
346+ 860d.0991.25d0.16b9.978a.4bf4.2a1a.e96c.fa50.85b5.9aeb.
347+ 9dbb.b2d9.a2d1.7bba.66be.e81f.1946.29a8.f5d2.f30c.2499.
348+ c1b3.6583.89e1.ee36.e0b4.6092.937e.d74e.2f6f.513e.9615.
349+ 9c5d.d581.e7ab.fe74.f01b.78b1.ae75.af57.0ec2.adc7.3245.
350+ 12bf.2314.3967.0806.31dc.cb94.d43f.493c.54a6.0421.c3a1.
351+ 1c4a.28ac.fc0b.26ca.5870.e576.f7f1.616d.905f.ef41.33bc.
352+ df4d.225e.2d56.7fd6.1395.a3f8.c582
353+ (cut 3 [a 1] b)
354+
355+Examples
356+--------
357+
358+ ~zod/try=> `@ux`(zyrt:un 57)
359+ 0x12
360+ ~zod/try=> `@ux`(zyrt:un 225)
361+ 0x0
362+ ~zod/try=> `@ux`(zyrt:un 187)
363+ 0xff
364+
docs/system/hoon/library/src/3g/mold/coin.mdnew file+36
@@ -0,0 +1,36 @@
1+### `++coin`
2+
3+Noun literal syntax cases
4+
5+Noun literal syntax cases: atoms, jammed nouns, and nestable tuples.
6+Parsed and printed using [`++so`]() and [`++co`]() cores.
7+
8+Source
9+------
10+
11+ ++ coin $% [%$ p=dime] ::
12+ [%blob p=*] ::
13+ [%many p=(list coin)] ::
14+ == ::
15+
16+Examples
17+--------
18+
19+ ~zod/try=> `coin`(need (slay '~s1'))
20+ [%$ p=[p=~.dr q=18.446.744.073.709.551.616]]
21+ ~zod/try=> `coin`(need (slay '0x2b59'))
22+ [%$ p=[p=~.ux q=11.097]]
23+
24+ ~zod/try=> ~(rend co [%many ~[[%$ %ud 1] [%$ %tas 'a'] [%$ %s -2]]])
25+ "._1_a_-2__"
26+ ~zod/try=> ._1_a_-2__
27+ [1 %a -2]
28+
29+ ~zod/try=> `@uv`(jam [3 4])
30+ 0v2cd1
31+ ~zod/try=> (slay '~02cd1')
32+ [~ [%blob p=[3 4]]]
33+ ~zod/try=> ~02cd1
34+ [3 4]
35+
36+
docs/system/hoon/library/src/3g/mold/dime.mdnew file+21
@@ -0,0 +1,21 @@
1+### `++dime`
2+
3+Odor-atom pair
4+
5+Used in [`++coin`](). Convenience methods [`++scot`]() and [`++scow`]() (in
6+Section 2eL) print dimes as [`++cord`]() and [`++tape`](), respectively.
7+[`++slat`](), [`++slav`](), and [`++slaw`]() are used to parse atoms of
8+specific [odor]()s.
9+
10+Source
11+------
12+
13+ ++ dime ,[p=@ta q=@] ::
14+
15+Examples
16+--------
17+
18+ ~zod/try=> +>:(slay '0x123')
19+ p=[p=~.ux q=291]
20+
21+
docs/system/hoon/library/src/3g/mold/edge.mdnew file+22
@@ -0,0 +1,22 @@
1+### `++edge`
2+
3+Parsing location metadata
4+
5+Optional result `p` and parsing continuation `q`.
6+
7+Source
8+------
9+
10+ ++ edge ,[p=hair q=(unit ,[p=* q=nail])] :: parsing output
11+
12+Examples
13+--------
14+
15+See also: Section 2eD, [`++rule`]()
16+
17+ ~zod/try=> *edge
18+ [p=[p=0 q=0] q=~]
19+ ~zod/try=> (tall:vast [1 1] "a b")
20+ [p=[p=1 q=2] q=[~ [p=[%cnzz p=~[%a]] q=[p=[p=1 q=2] q=" b"]]]]
21+
22+
docs/system/hoon/library/src/3g/mold/hair.mdnew file+25
@@ -0,0 +1,25 @@
1+### `++hair`
2+
3+Parsing line and column
4+
5+A pair of two [`@ud`]() used in parsing indicating line and column number.
6+
7+Source
8+------
9+
10+ ++ hair ,[p=@ud q=@ud] :: parsing trace
11+
12+Examples
13+--------
14+
15+ ~zod/try=> *hair
16+ [p=0 q=0]
17+
18+ ~zod/try=> `hair`[1 1] :: parsing starts at [1 1] as a convention.
19+ [p=1 q=1]
20+ ~zod/try=> ((plus ace) [1 1] " --")
21+ [p=[p=1 q=4] q=[~ u=[p=[~~. " "] q=[p=[p=1 q=4] q="--"]]]]
22+ ~zod/try=> `hair`p:((plus ace) [1 1] " --")
23+ [p=1 q=4]
24+
25+
docs/system/hoon/library/src/3g/mold/like.mdnew file+27
@@ -0,0 +1,27 @@
1+### `++like`
2+
3+Mold generator for an edge
4+
5+`++like` generates an `++edge` with a parsed result set to a specific type.
6+
7+Source
8+------
9+
10+ ++ like |* a=_,* :: generic edge
11+ ?@ +.b ~ ::
12+ :- ~ ::
13+ u=[p=(a +>-.b) q=[p=(hair -.b) q=(tape +.b)]] ::
14+
15+Examples
16+--------
17+ ~zod/try=> *(like char)
18+ [p=[p=0 q=0] q=~]
19+
20+ ~zod/try=> (ace [1 1] " a")
21+ [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q="a"]]]]
22+ ~zod/try=> `(like char)`(ace [1 1] " a")
23+ [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q="a"]]]]
24+ ~zod/try=> `(like ,@)`(ace [1 1] " a")
25+ [p=[p=1 q=2] q=[~ [p=32 q=[p=[p=1 q=2] q="a"]]]]
26+
27+
docs/system/hoon/library/src/3g/mold/nail.mdnew file+19
@@ -0,0 +1,19 @@
1+### `++nail`
2+
3+Location, remainder of parsed text
4+
5+Indicates parsing position `p`, and remaining text to be parsed `q`.
6+
7+Source
8+------
9+
10+ ++ nail ,[p=hair q=tape] :: parsing input
11+
12+Examples
13+--------
14+
15+ ~zod/try=> +<:;~(plug cab cab)
16+ c=tub=[p=[p=0 q=0] q=""]
17+ ~zod/try=> :: tub is a ++nail
18+
19+
docs/system/hoon/library/src/3g/mold/path.mdnew file+19
@@ -0,0 +1,19 @@
1+### `++path`
2+
3+Filesystem path
4+
5+A `++path` is a list of [`++span`]()s aka [`@ta`](). Used in
6+`%clay` and `%eyre` extensively.
7+
8+Source
9+------
10+
11+ ++ path (list span) :: filesys location
12+
13+Examples
14+--------
15+
16+ ~zod/try=> `path`"abc"
17+ /a/b/c
18+
19+
docs/system/hoon/library/src/3g/mold/pint.mdnew file+22
@@ -0,0 +1,22 @@
1+### `++pint`
2+
3+Parsing range
4+
5+Mostly used for stacktraces. A `++pint` is a pair of
6+[`++hair`](), indicating from `p` to `q`.
7+
8+Source
9+------
10+
11+ ++ pint ,[p=[p=@ q=@] q=[p=@ q=@]] :: line/column range
12+
13+Examples
14+--------
15+
16+ ~zod/try=> !:(!!)
17+ ! /~zod/try/~2014.9.20..01.22.04..52e3/:<[1 4].[1 6]>
18+ ~zod/try=> :: !! always produces a crash
19+ ~zod/try=> `pint`[[1 4] [1 6]]
20+ [p=[p=1 q=4] q=[p=1 q=6]]
21+
22+
docs/system/hoon/library/src/3g/mold/rule.mdnew file+27
@@ -0,0 +1,27 @@
1+### `++rule`
2+
3+Parsing rule
4+
5+`++rule` is an empty parsing rule, but it is used to check
6+that parsing rules match this with `_`.
7+
8+
9+Source
10+------
11+
12+ ++ rule |=(tub=nail `edge`[p.tub ~ ~ tub]) :: parsing rule
13+
14+Examples
15+--------
16+
17+ ~zod/try=> *rule
18+ [p=[p=0 q=0] q=[~ [p=0 q=[p=[p=0 q=0] q=""]]]]
19+
20+ ~zod/try=> ^+(rule [|=(a=nail [p.a ~])]:|6)
21+ <1.dww [tub=[p=[p=@ud q=@ud] q=""] <101.jzo 1.ypj %164>]>
22+ ~zod/try=> (^+(rule [|=(a=nail [p.a ~ u=['a' a]])]:|6) [1 1] "hi")
23+ [p=[p=1 q=1] q=[~ [p=97 q=[p=[p=1 q=1] q="hi"]]]]
24+ ~zod/try=> ([|=(a=nail [p.a ~ u=['a' a]])]:|6 [1 1] "hi")
25+ [[p=1 q=1] ~ u=['a' p=[p=1 q=1] q="hi"]]
26+
27+
docs/system/hoon/library/src/3g/mold/spot.mdnew file+21
@@ -0,0 +1,21 @@
1+### `++spot`
2+
3+Stack trace line
4+
5+A [`++spot`]() is what we print after crashing.
6+
7+Source
8+------
9+
10+ ++ spot ,[p=path q=pint] :: range in file
11+
12+Examples
13+--------
14+
15+ ~zod/try=> :into /=main=/bin/fail/hoon '!: !!'
16+ + /~zod/main/359/bin/fail/hoon
17+ ~zod/try=> :fail
18+ ! /~zod/main/~2014.9.22..18.40.56..ef04/bin/fail/:<[1 5].[1 7]>
19+ ! exit
20+
21+
docs/system/hoon/library/src/3g/mold/toon.mdnew file+26
@@ -0,0 +1,26 @@
1+### `++toon`
2+
3+Nock computation result
4+
5+Either success (`%0`), a block with list of requests blocked on (`%1`), or
6+failure with stack trace (`%2`).
7+
8+Source
9+------
10+
11+ ++ toon $% [%0 p=*] :: success
12+
13+Examples
14+--------
15+ ~zod/try=> (mock [[20 21] 0 3] ,~)
16+ [%0 p=21]
17+
18+ ~zod/try=> (mock [[0] !=(.^(cy//=main/1))] ,~)
19+ [%1 p=~[[31.075 1.685.027.454 1.852.399.981 49 0]]]
20+ ~zod/try=> (path [31.075 1.685.027.454 1.852.399.981 49 0])
21+ /cy/~zod/main/1
22+
23+ ~zod/try=> (mock [[1 2] !=(!:(+(.)))] ,~)
24+ [%2 p=~[[%leaf p="/~zod/try/~2014.9.23..18.34.32..d3c5/:<[1 20].[1 24]>"]]]
25+
26+
docs/system/hoon/library/src/3g/mold/wonk.mdnew file+29
@@ -0,0 +1,29 @@
1+### `++wonk`
2+
3+XX Not a model?
4+
5+Pull result out of a `++edge`, or crash if there's no result.
6+
7+Source
8+------
9+
10+ ++ wonk |*(veq=edge ?~(q.veq !! p.u.q.veq)) ::
11+
12+Examples
13+--------
14+
15+See also: [`++edge`]()
16+
17+ ~zod/try=> (wide:vast [1 1] "(add 2 2)")
18+ [ p=[p=1 q=10]
19+ q
20+ [ ~
21+ [ p=[%cnhp p=[%cnzz p=~[%add]] q=~[[%dtzy p=%ud q=2] [%dtzy p=%ud q=2]]]
22+ q=[p=[p=1 q=10] q=""]
23+ ]
24+ ]
25+ ]
26+ ~zod/try=> (wonk (wide:vast [1 1] "(add 2 2)"))
27+ [%cnhp p=[%cnzz p=~[%add]] q=~[[%dtzy p=%ud q=2] [%dtzy p=%ud q=2]]]
28+
29+
docs/system/hoon/library/src/4a/core/po.mdnew file+200
@@ -0,0 +1,200 @@
1+### `++po`
2+
3+++ po
4+ ~/ %po
5+ =+ :- ^= sis :: prefix syllables
6+ 'dozmarbinwansamlitsighidfidlissogdirwacsabwissib\
7+ /rigsoldopmodfoglidhopdardorlorhodfolrintogsilmir\
8+ /holpaslacrovlivdalsatlibtabhanticpidtorbolfosdot\
9+ /losdilforpilramtirwintadbicdifrocwidbisdasmidlop\
10+ /rilnardapmolsanlocnovsitnidtipsicropwitnatpanmin\
11+ /ritpodmottamtolsavposnapnopsomfinfonbanporworsip\
12+ /ronnorbotwicsocwatdolmagpicdavbidbaltimtasmallig\
13+ /sivtagpadsaldivdactansidfabtarmonranniswolmispal\
14+ /lasdismaprabtobrollatlonnodnavfignomnibpagsopral\
15+ /bilhaddocridmocpacravripfaltodtiltinhapmicfanpat\
16+ /taclabmogsimsonpinlomrictapfirhasbosbatpochactid\
17+ /havsaplindibhosdabbitbarracparloddosbortochilmac\
18+ /tomdigfilfasmithobharmighinradmashalraglagfadtop\
19+ /mophabnilnosmilfopfamdatnoldinhatnacrisfotribhoc\
20+ /nimlarfitwalrapsarnalmoslandondanladdovrivbacpol\
21+ /laptalpitnambonrostonfodponsovnocsorlavmatmipfap'
22+ ^= dex :: suffix syllables
23+ 'zodnecbudwessevpersutletfulpensytdurwepserwylsun\
24+ /rypsyxdyrnuphebpeglupdepdysputlughecryttyvsydnex\
25+ /lunmeplutseppesdelsulpedtemledtulmetwenbynhexfeb\
26+ /pyldulhetmevruttylwydtepbesdexsefwycburderneppur\
27+ /rysrebdennutsubpetrulsynregtydsupsemwynrecmegnet\
28+ /secmulnymtevwebsummutnyxrextebfushepbenmuswyxsym\
29+ /selrucdecwexsyrwetdylmynmesdetbetbeltuxtugmyrpel\
30+ /syptermebsetdutdegtexsurfeltudnuxruxrenwytnubmed\
31+ /lytdusnebrumtynseglyxpunresredfunrevrefmectedrus\
32+ /bexlebduxrynnumpyxrygryxfeptyrtustyclegnemfermer\
33+ /tenlusnussyltecmexpubrymtucfyllepdebbermughuttun\
34+ /bylsudpemdevlurdefbusbeprunmelpexdytbyttyplevmyl\
35+ /wedducfurfexnulluclennerlexrupnedlecrydlydfenwel\
36+ /nydhusrelrudneshesfetdesretdunlernyrsebhulryllud\
37+ /remlysfynwerrycsugnysnyllyndyndemluxfedsedbecmun\
38+ /lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes'
39+ |%
40+
41+Provides the phonetic syllables and name generators for the Urbit naming
42+system. The two faces, `sis` and `dex` are available to the arms
43+contained in this section.
44+
45+
46+------------------------------------------------------------------------
47+
48+### `++ind`
49+
50+Parse prefix
51+
52+Produces the byte of the right-hand syllable `a`.
53+
54+Accepts
55+-------
56+
57+`a` is an [atom]().
58+
59+Produces
60+--------
61+
62+A [`++unit`]() of an atom.
63+
64+Source
65+------
66+
67+ ++ ind ~/ %ind :: parse prefix
68+ |= a=@
69+ =+ b=0
70+ |- ^- (unit ,@)
71+ ?:(=(256 b) ~ ?:(=(a (tod b)) [~ b] $(b +(b))))
72+
73+Examples
74+--------
75+
76+ ~zod/try=> (ind:po 'zod')
77+ [~ 0]
78+ ~zod/try=> (ind:po 'zam')
79+ ~
80+ ~zod/try=> (ind:po 'del')
81+ [~ 37]
82+
83+------------------------------------------------------------------------
84+
85+### `++ins`
86+
87+Parse suffix
88+
89+Produces the byte of the left-hand phonetic syllable `b`.
90+
91+Accepts
92+-------
93+
94+`a` is an [atom]().
95+
96+Produces
97+--------
98+A [`++unit`]() of an atom.
99+
100+Source
101+------
102+
103+ ++ ins ~/ %ins :: parse suffix
104+ |= a=@
105+ =+ b=0
106+ |- ^- (unit ,@)
107+ ?:(=(256 b) ~ ?:(=(a (tos b)) [~ b] $(b +(b))))
108+
109+Examples
110+--------
111+
112+ ~zod/try=> (ins:po 'mar')
113+ [~ 1]
114+ ~zod/try=> (ins:po 'son')
115+ [~ 164]
116+ ~zod/try=> (ins:po 'pit')
117+ [~ 242]
118+ ~zod/try=> (ins:po 'pok')
119+ ~
120+
121+------------------------------------------------------------------------
122+
123+### `++tod`
124+
125+Fetch prefix
126+
127+Produces the phonetic prefix syllable from index `a` within `dex` as an
128+[atom]().
129+
130+Accepts
131+-------
132+
133+`a` is an atom
134+
135+Produces
136+--------
137+
138+An atom.
139+
140+
141+Source
142+------
143+
144+ ++ tod ~/ %tod :: fetch prefix
145+ |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] dex)))
146+
147+Examples
148+--------
149+
150+ ~zod/try=> `@t`(tod:po 1)
151+ 'nec'
152+ ~zod/try=> `@t`(tod:po 98)
153+ 'dec'
154+ ~zod/try=> `@t`(tod:po 0)
155+ 'zod'
156+ ~zod/try=> `@t`(tod:po 150)
157+ 'ryg'
158+ ~zod/try=> `@t`(tod:po 255)
159+ 'fes'
160+ ~zod/try=> `@t`(tod:po 256)
161+ ! exit
162+
163+------------------------------------------------------------------------
164+
165+### `++tos`
166+
167+Fetch suffix
168+
169+Produces the phonetic prefix syllable from index `a` within `sis` as an
170+[atom]().
171+
172+Accepts
173+-------
174+
175+`a` is an atom.
176+
177+Produces
178+--------
179+
180+An atom.
181+
182+Source
183+------
184+
185+ ++ tos ~/ %tos :: fetch suffix
186+ |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] sis)))
187+
188+Examples
189+--------
190+
191+ ~zod/try=> `@t`(tos:po 0)
192+ 'doz'
193+ ~zod/try=> `@t`(tos:po 120)
194+ 'fab'
195+ ~zod/try=> `@t`(tos:po 43)
196+ 'pid'
197+ ~zod/try=> `@t`(tos:po 253)
198+ 'mat'
199+
200+------------------------------------------------------------------------
docs/system/hoon/library/src/4b/core/at.mdnew file+146
@@ -0,0 +1,146 @@
1+### `++at`
2+
3+ ++ at
4+ |_ a=@
5+
6+XX document
7+
8+### `++r`
9+
10+ ++ r
11+ ?: ?& (gte (met 3 a) 2)
12+ |-
13+ ?: =(0 a)
14+ &
15+ =+ vis=(end 3 1 a)
16+ ?& ?|(=('-' vis) ?&((gte vis 'a') (lte vis 'z')))
17+ $(a (rsh 3 1 a))
18+ ==
19+ ==
20+ rtam
21+ ?: (lte (met 3 a) 2)
22+ rud
23+ rux
24+ ::
25+
26+XX document
27+
28+### `++rf`
29+
30+ ++ rf `tape`[?-(a & '&', | '|', * !!) ~]
31+
32+XX document
33+
34+### `++rn`
35+
36+ ++ rn `tape`[?>(=(0 a) '~') ~]
37+
38+XX document
39+
40+### `++rt`
41+
42+ ++ rt `tape`['\'' (weld (mesc (trip a)) `tape`['\'' ~])]
43+
44+XX document
45+
46+### `++rta`
47+
48+ ++ rta rt
49+
50+XX document
51+
52+### `++rtam`
53+
54+ ++ rtam `tape`['%' (trip a)]
55+
56+XX document
57+
58+### `++rub`
59+
60+ ++ rub `tape`['0' 'b' (rum 2 ~ |=(b=@ (add '0' b)))]
61+
62+XX document
63+
64+### `++rud`
65+
66+ ++ rud (rum 10 ~ |=(b=@ (add '0' b)))
67+
68+XX document
69+
70+### `++rum`
71+
72+ ++ rum
73+ |= [b=@ c=tape d=$+(@ @)]
74+ ^- tape
75+ ?: =(0 a)
76+ [(d 0) c]
77+ =+ e=0
78+ |- ^- tape
79+ ?: =(0 a)
80+ c
81+ =+ f=&(!=(0 e) =(0 (mod e ?:(=(10 b) 3 4))))
82+ %= $
83+ a (div a b)
84+ c [(d (mod a b)) ?:(f [?:(=(10 b) ',' '-') c] c)]
85+ e +(e)
86+ ==
87+ ::
88+
89+XX document
90+
91+### `++rup`
92+
93+ ++ rup
94+ =+ b=(met 3 a)
95+ ^- tape
96+ :- '-'
97+ |- ^- tape
98+ ?: (gth (met 5 a) 1)
99+ %+ weld
100+ $(a (rsh 5 1 a), b (sub b 4))
101+ `tape`['-' '-' $(a (end 5 1 a), b 4)]
102+ ?: =(0 b)
103+ ['~' ~]
104+ ?: (lte b 1)
105+ (trip (tos:po a))
106+ |- ^- tape
107+ ?: =(2 b)
108+ =+ c=(rsh 3 1 a)
109+ =+ d=(end 3 1 a)
110+ (weld (trip (tod:po c)) (trip (tos:po (mix c d))))
111+ =+ c=(rsh 3 2 a)
112+ =+ d=(end 3 2 a)
113+ (weld ^$(a c, b (met 3 c)) `tape`['-' $(a (mix c d), b 2)])
114+ ::
115+
116+XX document
117+
118+### `++ruv`
119+
120+ ++ ruv
121+ ^- tape
122+ :+ '0'
123+ 'v'
124+ %^ rum
125+ 64
126+ ~
127+ |= b=@
128+ ?: =(63 b)
129+ '+'
130+ ?: =(62 b)
131+ '-'
132+ ?:((lth b 26) (add 65 b) ?:((lth b 52) (add 71 b) (sub b 4)))
133+ ::
134+
135+XX document
136+
137+### `++rux`
138+
139+ ++ rux `tape`['0' 'x' (rum 16 ~ |=(b=@ (add b ?:((lth b 10) 48 87))))]
140+ --
141+ :::::::::::::::::::::::::::::::::::::::::::::::::::::: ::
142+
143+XX document
144+
145+------------------------------------------------------------------------
146+
docs/system/hoon/library/src/4b/gate/cass.mdnew file+38
@@ -0,0 +1,38 @@
1+
2+### `++cass`
3+
4+To lowercase
5+
6+Produce the case insensitive (all lowercase) [`++cord`]() of a [`++tape`]().
7+
8+Accepts
9+-------
10+
11+`vib` is a `++tape`.
12+
13+Produces
14+--------
15+
16+A `++cord`.
17+
18+Source
19+------
20+
21+ ++ cass :: lowercase
22+ |= vib=tape
23+ %+ rap 3
24+ (turn vib |=(a=@ ?.(&((gte a 'A') (lte a 'Z')) a (add 32 a))))
25+ ::
26+
27+Examples
28+--------
29+
30+ ~zod/try=> (cass "john doe")
31+ 7.309.170.810.699.673.450
32+ ~zod/try=> `cord`(cass "john doe")
33+ 'john doe'
34+ ~zod/try=> (cass "abc, 123, !@#")
35+ 2.792.832.775.110.938.439.066.079.945.313
36+ ~zod/try=> `cord`(cass "abc, 123, !@#")
37+ 'abc, 123, !@#'
38+
docs/system/hoon/library/src/4b/gate/crip.mdnew file+31
@@ -0,0 +1,31 @@
1+### `++crip`
2+
3+Tape to cord
4+
5+Produce a [`++cord`]() from a [`++tape`]().
6+
7+Accepts
8+-------
9+
10+`a` is a `++tape`.
11+
12+Produces
13+--------
14+
15+A `++cord`.
16+
17+Source
18+------
19+
20+ ++ crip |=(a=tape `@t`(rap 3 a)) :: tape to cord
21+
22+Examples
23+--------
24+
25+ ~zod/try=> (crip "john doe")
26+ 'john doe'
27+ ~zod/try=> (crip "abc 123 !@#")
28+ 'abc 123 !@#'
29+ ~zod/try=> `@ud`(crip "abc")
30+ 6.513.249
31+
docs/system/hoon/library/src/4b/gate/cuss.mdnew file+39
@@ -0,0 +1,39 @@
1+### `++cuss`
2+
3+To uppercase
4+
5+Turn all occurances of lowercase letters in any [`++tape`]() into uppercase
6+letters, as a [`++cord`]().
7+
8+Accepts
9+-------
10+
11+`vib` is a `++tape`.
12+
13+Produces
14+--------
15+
16+A `++cord`.
17+
18+Source
19+------
20+
21+ ++ cuss :: uppercase
22+ |= vib=tape
23+ ^- @t
24+ %+ rap 3
25+ (turn vib |=(a=@ ?.(&((gte a 'a') (lte a 'z')) a (sub a 32))))
26+ ::
27+
28+Examples
29+--------
30+
31+ ~zod/try=> (cuss "john doe")
32+ 'JOHN DOE'
33+ ~zod/try=> (cuss "abc ABC 123 !@#")
34+ 'ABC ABC 123 !@#'
35+ ~zod/try=> `@ud`(cuss "abc")
36+ 4.407.873
37+ ~zod/try=> (cuss "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsQqRrVvWwXxYyZz")
38+ 'AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSQQRRVVWWXXYYZZ'
39+
docs/system/hoon/library/src/4b/gate/mesc.mdnew file+42
@@ -0,0 +1,42 @@
1+### `++mesc`
2+
3+Escape special chars
4+
5+Escape special characters, used in [`++show`](/doc/hoon/library/2ez#++show)
6+
7+Accepts
8+-------
9+
10+`vib` is a [`++tape`]().
11+
12+Produces
13+--------
14+
15+A `++tape`.
16+
17+Source
18+------
19+
20+ ++ mesc :: ctrl code escape
21+ |= vib=tape
22+ ^- tape
23+ ?~ vib
24+ ~
25+ ?: =('\\' i.vib)
26+ ['\\' '\\' $(vib t.vib)]
27+ ?: ?|((gth i.vib 126) (lth i.vib 32) =(39 i.vib))
28+ ['\\' (welp ~(rux at i.vib) '/' $(vib t.vib))]
29+ [i.vib $(vib t.vib)]
30+ ::
31+
32+Examples
33+--------
34+
35+ /~zod/try=> (mesc "ham lus")
36+ "ham lus"
37+ /~zod/try=> (mesc "bas\\hur")
38+ "bas\\\\hur"
39+ /~zod/try=> (mesc "as'saß")
40+ "as\0x27/sa\0xc3/\0x9f/"
41+
42+
docs/system/hoon/library/src/4b/gate/runt.mdnew file+38
@@ -0,0 +1,38 @@
1+### `++runt`
2+
3+Prepend `n` times
4+
5+Add `a` repetitions of character `b` to the head of [`++tape`]() `c`.
6+
7+Accepts
8+-------
9+
10+`a` and `b` are atoms.
11+
12+`c` is a `++tape`.
13+
14+Produces
15+--------
16+
17+A `++tape`.
18+
19+Source
20+------
21+
22+ ++ runt :: prepend repeatedly
23+ |= [[a=@ b=@] c=tape]
24+ ^- tape
25+ ?: =(0 a)
26+ c
27+ [b $(a (dec a))]
28+ ::
29+
30+Examples
31+--------
32+
33+ /~zod/try=> (runt [2 '/'] "ham")
34+ "//ham"
35+ /~zod/try=> (runt [10 'a'] "")
36+ "aaaaaaaaaa"
37+
38+
docs/system/hoon/library/src/4b/gate/sand.mdnew file+36
@@ -0,0 +1,36 @@
1+### `++sand`
2+
3+Soft-cast by odor
4+
5+Soft-cast validity by [odor]().
6+
7+Accepts
8+-------
9+
10+`a` is a [`++span`]() (`@ta`).
11+
12+`b` is an atom.
13+
14+Produces
15+--------
16+
17+A `(unit ,@)`.
18+
19+Source
20+------
21+
22+ ++ sand :: atom sanity
23+ |= a=@ta
24+ |= b=@ ^- (unit ,@)
25+ ?.(((sane a) b) ~ [~ b])
26+ ::
27+
28+Examples
29+--------
30+
31+ /~zod/try=> `(unit ,@ta)`((sand %ta) 'sym-som')
32+ [~ ~.sym-som]
33+ /~zod/try=> `(unit ,@ta)`((sand %ta) 'err!')
34+ ~
35+
36+
docs/system/hoon/library/src/4b/gate/sane.mdnew file+68
@@ -0,0 +1,68 @@
1+### `++sane`
2+
3+Check odor validity
4+
5+Check validity by [odor](). Produces a [gate]().
6+
7+Accepts
8+-------
9+
10+`a` is a [`++span`]() (`@ta`).
11+
12+`b` is an [atom]().
13+
14+Produces
15+--------
16+
17+A boolean.
18+
19+Source
20+------
21+
22+ ++ sane :: atom sanity
23+ |= a=@ta
24+ |= b=@ ^- ?
25+ ?. =(%t (end 3 1 a))
26+ ~|(%sane-stub !!)
27+ =+ [inx=0 len=(met 3 b)]
28+ ?: =(%tas a)
29+ |- ^- ?
30+ ?: =(inx len) &
31+ =+ cur=(cut 3 [inx 1] b)
32+ ?& ?| &((gte cur 'a') (lte cur 'z'))
33+ &(=('-' cur) !=(0 inx) !=(len inx))
34+ &(&((gte cur '0') (lte cur '9')) !=(0 inx))
35+ ==
36+ $(inx +(inx))
37+ ==
38+ ?: =(%ta a)
39+ |- ^- ?
40+ ?: =(inx len) &
41+ =+ cur=(cut 3 [inx 1] b)
42+ ?& ?| &((gte cur 'a') (lte cur 'z'))
43+ &((gte cur '0') (lte cur '9'))
44+ |(=('-' cur) =('~' cur) =('_' cur) =('.' cur))
45+ ==
46+ $(inx +(inx))
47+ ==
48+ |- ^- ?
49+ ?: =(0 b) &
50+ =+ cur=(end 3 1 b)
51+ ?: &((lth cur 32) !=(10 cur)) |
52+ =+ len=(teff cur)
53+ ?& |(=(1 len) =+(i=1 |-(|(=(i len) &((gte (cut 3 [i 1] b) 128) $(i +(i)))))))
54+ $(b (rsh 3 len b))
55+ ==
56+ ::
57+
58+Examples
59+--------
60+
61+ /~zod/try=> ((sane %tas) %mol)
62+ %.y
63+ /~zod/try=> ((sane %tas) 'lam')
64+ %.y
65+ /~zod/try=> ((sane %tas) 'more ace')
66+ %.n
67+
68+
docs/system/hoon/library/src/4b/gate/teff.mdnew file+37
@@ -0,0 +1,37 @@
1+### `++teff`
2+
3+UTF8 Length
4+
5+Produces the number of utf8 bytes.
6+
7+Accepts
8+-------
9+
10+`a` is a [`@t`]().
11+
12+Produces
13+--------
14+
15+An atom.
16+
17+Source
18+------
19+
20+ ++ teff :: length utf8
21+ |= a=@t ^- @
22+ =+ b=(end 3 1 a)
23+ ?: =(0 b)
24+ ?>(=(0 a) 0)
25+ ?> |((gte b 32) =(10 b))
26+ ?:((lte b 127) 1 ?:((lte b 223) 2 ?:((lte b 239) 3 4)))
27+ ::
28+
29+Examples
30+--------
31+
32+ /~zod/try=> (teff 'a')
33+ 1
34+ /~zod/try=> (teff 'ß')
35+ 2
36+
37+
docs/system/hoon/library/src/4b/gate/trim.mdnew file+41
@@ -0,0 +1,41 @@
1+### `++trim`
2+
3+Tape split
4+
5+Split first `a` characters off [`++tape`]() `b`.
6+
7+Accepts
8+-------
9+
10+`a` is an atom.
11+
12+`b` is a `++tape`.
13+
14+Produces
15+--------
16+
17+A cell of `++tape`s, `p` and `q`.
18+
19+Source
20+------
21+
22+ ++ trim :: tape split
23+ |= [a=@ b=tape]
24+ ^- [p=tape q=tape]
25+ ?~ b
26+ [~ ~]
27+ ?: =(0 a)
28+ [~ b]
29+ =+ c=$(a (dec a), b t.b)
30+ [[i.b p.c] q.c]
31+ ::
32+
33+Examples
34+--------
35+
36+ /~zod/try=> (trim 5 "lasok termun")
37+ [p="lasok" q=" termun"]
38+ /~zod/try=> (trim 5 "zam")
39+ [p="zam" q=""]
40+
41+
docs/system/hoon/library/src/4b/gate/trip.mdnew file+38
@@ -0,0 +1,38 @@
1+### `++trip`
2+
3+Cord to tape
4+
5+Produce a [`++tape`]() from [`++cord`]().
6+
7+Accepts
8+-------
9+
10+`a` is an atom.
11+
12+Produces
13+--------
14+
15+A `++tape`.
16+
17+Source
18+------
19+
20+ ++ trip :: cord to tape
21+ ~/ %trip
22+ |= a=@ ^- tape
23+ ?: =(0 (met 3 a))
24+ ~
25+ [^-(@ta (end 3 1 a)) $(a (rsh 3 1 a))]
26+ ::
27+
28+Examples
29+--------
30+
31+ /~zod/try=> (trip 'john doe')
32+ "john doe"
33+ /~zod/try=> (trip 'abc 123 !@#')
34+ "abc 123 !@#"
35+ /~zod/try=> (trip 'abc')
36+ "abc"
37+
38+
docs/system/hoon/library/src/4b/gate/tuba.mdnew file+34
@@ -0,0 +1,34 @@
1+### `++tuba`
2+
3+UTF8 to UTF32 tape
4+
5+Convert [`++tape`]() to a [`++list`]() of codepoints ([`@c`]()).
6+
7+Accepts
8+-------
9+
10+`a` is a `++tape`.
11+
12+Produces
13+--------
14+
15+A `++list` of codepoints [`@c`]().
16+
17+Source
18+------
19+
20+ ++ tuba :: utf8 to utf32 tape
21+ |= a=tape
22+ ^- (list ,@c)
23+ (rip 5 (turf (rap 3 a))) :: XX horrible
24+ ::
25+
26+Examples
27+--------
28+
29+ /~zod/try=> (tuba "я тут")
30+ ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.]
31+ /~zod/try=> (tuba "chars")
32+ ~[~-c ~-h ~-a ~-r ~-s]
33+
34+
docs/system/hoon/library/src/4b/gate/tufa.mdnew file+35
@@ -0,0 +1,35 @@
1+### `++tufa`
2+
3+UTF32 to UTF8 tape
4+
5+Wrap a [`++list`]() of utf32 codepoints into a utf8 [`++tape`]().
6+
7+Accepts
8+-------
9+
10+`a` is a `++list` of [`@c`]().
11+
12+Produces
13+--------
14+
15+A `++tape`.
16+
17+Source
18+------
19+
20+ ++ tufa :: utf32 to utf8 tape
21+ |= a=(list ,@c)
22+ ^- tape
23+ ?~ a ""
24+ (weld (rip 3 (tuft i.a)) $(a t.a))
25+ ::
26+
27+Examples
28+--------
29+
30+ /~zod/try=> (tufa ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.])
31+ "я тут"
32+ /~zod/try=> (tufa ((list ,@c) ~[%a %b 0xb1 %c]))
33+ "ab±c"
34+
35+
docs/system/hoon/library/src/4b/gate/tuft.mdnew file+59
@@ -0,0 +1,59 @@
1+### `++tuft`
2+
3+UTF32 to UTF8 text
4+
5+Convert utf32 glyph to
6+[LSB](http://en.wikipedia.org/wiki/Least_significant_bit) utf8 [`++cord`]().
7+
8+Accepts
9+-------
10+
11+`a` is a codepoint ([`@c`]()).
12+
13+Produces
14+--------
15+
16+A `++cord`.
17+
18+Source
19+------
20+
21+ ++ tuft :: utf32 to utf8 text
22+ |= a=@c
23+ ^- @t
24+ %+ rap 3
25+ |- ^- (list ,@)
26+ ?: =(0 a)
27+ ~
28+ =+ b=(end 5 1 a)
29+ =+ c=$(a (rsh 5 1 a))
30+ ?: (lth b 0x7f)
31+ [b c]
32+ ?: (lth b 0x7ff)
33+ :* (mix 0b1100.0000 (cut 0 [6 5] b))
34+ (mix 0b1000.0000 (end 0 6 b))
35+ c
36+ ==
37+ ?: (lth b 0xffff)
38+ :* (mix 0b1110.0000 (cut 0 [12 4] b))
39+ (mix 0b1000.0000 (cut 0 [6 6] b))
40+ (mix 0b1000.0000 (end 0 6 b))
41+ c
42+ ==
43+ :* (mix 0b1111.0000 (cut 0 [18 3] b))
44+ (mix 0b1000.0000 (cut 0 [12 6] b))
45+ (mix 0b1000.0000 (cut 0 [6 6] b))
46+ (mix 0b1000.0000 (end 0 6 b))
47+ c
48+ ==
49+ ::
50+
51+Examples
52+--------
53+
54+ /~zod/try=> (tuft `@c`%a)
55+ 'a'
56+ /~zod/try=> (tuft `@c`0xb6)
57+ '¶'
58+
59+
docs/system/hoon/library/src/4b/gate/turf.mdnew file+54
@@ -0,0 +1,54 @@
1+### `++turf`
2+
3+UTF8 to UTF32 cord
4+
5+Convert utf8 ([`++cord`]()) to utf32 codepoints.
6+
7+Accepts
8+-------
9+
10+`a` is a [`@t`]().
11+
12+Produces
13+--------
14+
15+A [`@c`](), UTF-32 codepoint.
16+
17+Source
18+------
19+
20+ ++ turf :: utf8 to utf32
21+ |= a=@t
22+ ^- @c
23+ %+ rap 5
24+ |- ^- (list ,@c)
25+ =+ b=(teff a)
26+ ?: =(0 b) ~
27+ :- %+ can 0
28+ %+ turn
29+ ^- (list ,[p=@ q=@])
30+ ?+ b !!
31+ 1 [[0 7] ~]
32+ 2 [[8 6] [0 5] ~]
33+ 3 [[16 6] [8 6] [0 4] ~]
34+ 4 [[24 6] [16 6] [8 6] [0 3] ~]
35+ ==
36+ |=([p=@ q=@] [q (cut 0 [p q] a)])
37+ $(a (rsh 3 b a))
38+ ::
39+
40+Examples
41+--------
42+
43+ /~zod/try=> (turf 'my ßam')
44+ ~-my.~df.am
45+ /~zod/try=> 'я тут'
46+ 'я тут'
47+ /~zod/try=> (turf 'я тут')
48+ ~-~44f..~442.~443.~442.
49+ /~zod/try=> `@ux`'я тут'
50+ 0x82.d183.d182.d120.8fd1
51+ /~zod/try=> `@ux`(turf 'я тут')
52+ 0x442.0000.0443.0000.0442.0000.0020.0000.044f
53+
54+
docs/system/hoon/library/src/4b/gate/wack.mdnew file+45
@@ -0,0 +1,45 @@
1+### `++wack`
2+
3+Coin format encode
4+
5+Escape [`++span`]() `~` as `~~` and `_` as `~-`. Used for printing.
6+
7+Accepts
8+-------
9+
10+`a` is a `++span` (`@ta`).
11+
12+Produces
13+--------
14+
15+A [`++span`]() (`@ta`).
16+
17+Source
18+------
19+
20+ ++ wack :: coin format
21+ |= a=@ta
22+ ^- @ta
23+ =+ b=(rip 3 a)
24+ %+ rap 3
25+ |- ^- tape
26+ ?~ b
27+ ~
28+ ?: =('~' i.b) ['~' '~' $(b t.b)]
29+ ?: =('_' i.b) ['~' '-' $(b t.b)]
30+ [i.b $(b t.b)]
31+ ::
32+
33+Examples
34+--------
35+
36+ /~zod/try=> (wack '~20_sam~')
37+ ~.~~20~-sam~~
38+ /~zod/try=> `@t`(wack '~20_sam~')
39+ '~~20~-sam~~'
40+ ~zod/try=> ~(rend co %many ~[`ud/5 `ta/'~20_sam'])
41+ "._5_~~.~~20~-sam__"
42+ ~zod/try=> ._5_~~.~~20~-sam__
43+ [5 ~.~20_sam]
44+
45+
docs/system/hoon/library/src/4b/gate/wick.mdnew file+42
@@ -0,0 +1,42 @@
1+### `++wick`
2+
3+Coin format decode
4+
5+Unescape [`++span`]() `~~` as `~` and `~-` as `_`.
6+
7+Accepts
8+-------
9+
10+`a` is a an [atom]().
11+
12+Produces
13+--------
14+
15+A [`++span`]() `@ta`.
16+
17+Source
18+------
19+
20+ ++ wick :: coin format
21+ |= a=@
22+ ^- @ta
23+ =+ b=(rip 3 a)
24+ %+ rap 3
25+ |- ^- tape
26+ ?~ b
27+ ~
28+ ?: =('~' i.b)
29+ ?~ t.b !!
30+ [?:(=('~' i.t.b) '~' ?>(=('-' i.t.b) '_')) $(b t.t.b)]
31+ [i.b $(b t.b)]
32+ ::
33+
34+Examples
35+--------
36+
37+ /~zod/try=> `@t`(wick '~-ams~~lop')
38+ '_ams~lop'
39+ /~zod/try=> `@t`(wick (wack '~20_sam~'))
40+ '~20_sam~'
41+
42+
docs/system/hoon/library/src/4b/gate/woad.mdnew file+60
@@ -0,0 +1,60 @@
1+### `++woad`
2+
3+Unescape cord
4+
5+Unescape [`++cord`]() codepoints.
6+
7+Accepts
8+-------
9+
10+`a` is a [`@ta`]().
11+
12+Produces
13+--------
14+
15+A [`++cord`]().
16+
17+Source
18+------
19+
20+ ++ woad :: cord format
21+ |= a=@ta
22+ ^- @t
23+ %+ rap 3
24+ |- ^- (list ,@)
25+ ?: =(0 a)
26+ ~
27+ =+ b=(end 3 1 a)
28+ =+ c=(rsh 3 1 a)
29+ ?: =('.' b)
30+ [' ' $(a c)]
31+ ?. =('~' b)
32+ [b $(a c)]
33+ => .(b (end 3 1 c), c (rsh 3 1 c))
34+ ?+ b =- (weld (rip 3 (tuft p.d)) $(a q.d))
35+ ^= d
36+ =+ d=0
37+ |- ^- [p=@ q=@]
38+ ?: =('.' b)
39+ [d c]
40+ ?< =(0 c)
41+ %= $
42+ b (end 3 1 c)
43+ c (rsh 3 1 c)
44+ d %+ add (mul 16 d)
45+ %+ sub b
46+ ?: &((gte b '0') (lte b '9')) 48
47+ ?>(&((gte b 'a') (lte b 'z')) 87)
48+ ==
49+ %'.' ['.' $(a c)]
50+ %'~' ['~' $(a c)]
51+ ==
52+ ::
53+
54+Examples
55+--------
56+
57+ /~zod/try=> (woad ~.~b6.20.as)
58+ '¶20 as'
59+
60+
docs/system/hoon/library/src/4b/gate/wood.mdnew file+55
@@ -0,0 +1,55 @@
1+### `++wood`
2+
3+Escape cord
4+
5+Escape [`++cord`]() codepoints.
6+
7+Accepts
8+-------
9+
10+`a` is a [`++span`]() (`@ta`).
11+
12+Produces
13+--------
14+
15+A [`++span`]() (`@ta`).
16+
17+Source
18+------
19+
20+ ++ wood :: cord format
21+ |= a=@t
22+ ^- @ta
23+ %+ rap 3
24+ |- ^- (list ,@)
25+ ?: =(0 a)
26+ ~
27+ =+ b=(teff a)
28+ =+ c=(turf (end 3 b a))
29+ =+ d=$(a (rsh 3 b a))
30+ ?: ?| &((gte c 'a') (lte c 'z'))
31+ &((gte c '0') (lte c '9'))
32+ =('-' c)
33+ ==
34+ [c d]
35+ ?+ c
36+ :- '~'
37+ =+ e=(met 2 c)
38+ |- ^- tape
39+ ?: =(0 c)
40+ ['.' d]
41+ =. e (dec e)
42+ =+ f=(rsh 2 e c)
43+ [(add ?:((lte f 9) 48 87) f) $(c (end 2 e c))]
44+ ::
45+ %' ' ['.' d]
46+ %'.' ['~' '.' d]
47+ %'~' ['~' '~' d]
48+ ==
49+
50+Examples
51+--------
52+
53+ /~zod/try=> (wood 'my ßam')
54+ ~.my.~df.am
55+
docs/system/hoon/library/src/4c/core/re.mdnew file+260
@@ -0,0 +1,260 @@
1+### `++re`
2+
3+Pretty-printing engine
4+
5+Pretty-printing engine that accepts a [`++tank`](/doc/hoon/library/1#++tank) [sample]() and contains arms that perform computation on it.
6+
7+Accepts
8+-------
9+
10+`tac` is a `++tank`.
11+
12+Produces
13+--------
14+
15+ ++ re
16+ |_ tac=tank
17+
18+Examples
19+--------
20+
21+ /~zod/try=> ~(. re leaf/"ham")
22+ <2.ghl [[%leaf ""] <414.gly 100.xkc 1.ypj %164>]>
23+
24+### `++ram`
25+
26+Flatten to tape
27+
28+Flatten [`++tank`]() out into a [`++tape`]().
29+
30+Accepts
31+-------
32+
33+`tac` is a `++tank`, taken from [sample]() of `++re` [core]().
34+
35+Produces
36+--------
37+
38+A `++tape`.
39+
40+Source
41+------
42+
43+ ++ ram
44+ ^- tape
45+ ?- -.tac
46+ %leaf p.tac
47+ %palm ram(tac [%rose [p.p.tac (weld q.p.tac r.p.tac) s.p.tac] q.tac])
48+ %rose
49+ %+ weld
50+ q.p.tac
51+ |- ^- tape
52+ ?~ q.tac
53+ r.p.tac
54+ =+ voz=$(q.tac t.q.tac)
55+ (weld ram(tac i.q.tac) ?~(t.q.tac voz (weld p.p.tac voz)))
56+ ==
57+ ::
58+
59+Examples
60+--------
61+
62+ /~zod/try=> ~(ram re leaf/"foo")
63+ "foo"
64+ /~zod/try=> ~(ram re rose/["." "(" ")"]^~[leaf/"bar" leaf/"baz" leaf/"bam"])
65+ "(bar.baz.bam)"
66+
67+### `++win`
68+
69+Render at indent
70+
71+Render at indent level `tab` and width `edg`.
72+
73+Accepts
74+-------
75+
76+`tac` is a `++tank`, taken from [sample]() of `++re` [core]().
77+
78+`tab` and `edg` are atoms.
79+
80+Produces
81+--------
82+
83+A [`++wall`]() ([`++list`]() of [`++tapes`]()).
84+
85+Source
86+------
87+
88+ ++ win
89+ |= [tab=@ edg=@]
90+ =+ lug=`wall`~
91+ |^ |- ^- wall
92+ ?- -.tac
93+ %leaf (rig p.tac)
94+ %palm
95+ ?: fit
96+ (rig ram)
97+ ?~ q.tac
98+ (rig q.p.tac)
99+ ?~ t.q.tac
100+ (rig(tab (add 2 tab), lug $(tac i.q.tac)) q.p.tac)
101+ => .(q.tac `(list tank)`q.tac)
102+ =+ lyn=(mul 2 (lent q.tac))
103+ =+ ^= qyr
104+ |- ^- wall
105+ ?~ q.tac
106+ lug
107+ %= ^$
108+ tac i.q.tac
109+ tab (add tab (sub lyn 2))
110+ lug $(q.tac t.q.tac, lyn (sub lyn 2))
111+ ==
112+ (wig(lug qyr) q.p.tac)
113+ ::
114+ %rose
115+ ?: fit
116+ (rig ram)
117+ =+ ^= gyl
118+ |- ^- wall
119+ ?~ q.tac
120+ ?:(=(%$ r.p.tac) lug (rig r.p.tac))
121+ ^$(tac i.q.tac, lug $(q.tac t.q.tac), tab din)
122+ ?: =(%$ q.p.tac)
123+ gyl
124+ (wig(lug gyl) q.p.tac)
125+ ==
126+ ::
127+
128+Examples
129+--------
130+
131+ /~zod/try=> (~(win re leaf/"samoltekon-lapdok") 0 20)
132+ <<"samoltekon-lapdok">>
133+ /~zod/try=> (~(win re leaf/"samoltekon-lapdok") 0 10)
134+ <<"\/samolt\/" " ekon-l" " apdok" "\/ \/">>
135+ /~zod/try=> (~(win re rose/["--" "[" "]"]^~[leaf/"1423" leaf/"2316"]) 0 20)
136+ <<"[1423--2316]">>
137+ /~zod/try=> (~(win re rose/["--" "[" "]"]^~[leaf/"1423" leaf/"2316"]) 0 10)
138+ <<"[ 1423" " 2316" "]">>
139+
140+### `++din`
141+
142+XX document
143+
144+Accepts
145+-------
146+
147+Produces
148+--------
149+
150+Source
151+------
152+
153+ ++ din (mod (add 2 tab) (mul 2 (div edg 3)))
154+
155+
156+----------------------------------------------------------------------
157+
158+### `++fit`
159+
160+Fit on one line test
161+
162+Determine whether `tac` fits on one line. Internal to `++win`
163+
164+Accepts
165+-------
166+
167+Produces
168+--------
169+
170+Source
171+------
172+
173+++ fit (lte (lent ram) (sub edg tab))
174+
175+
176+Examples
177+--------
178+
179+
180+
181+
182+----------------------------------------------------------------------
183+
184+### `++rig`
185+
186+Wrap in `\/`
187+
188+Wrap [`++tape`]() in `\/` if it doesn't fit at current indentation. Internal to
189+[`++win`]()
190+
191+Accepts
192+-------
193+
194+`tac` is a `++tank`, taken from [sample]() of `++re` [core]().
195+
196+`hom` is a `++tape`.
197+
198+Produces
199+--------
200+
201+A [`++wall`]() (list of `++tape`s).
202+
203+Source
204+------
205+
206+ ++ rig
207+ |= hom=tape
208+ ^- wall
209+ ?: (lte (lent hom) (sub edg tab))
210+ [(runt [tab ' '] hom) lug]
211+ => .(tab (add tab 2), edg (sub edg 2))
212+ =+ mut=(trim (sub edg tab) hom)
213+ :- (runt [(sub tab 2) ' '] ['\\' '/' (weld p.mut `_hom`['\\' '/' ~])])
214+ => .(hom q.mut)
215+ |-
216+ ?~ hom
217+ :- %+ runt
218+ [(sub tab 2) ' ']
219+ ['\\' '/' (runt [(sub edg tab) ' '] ['\\' '/' ~])]
220+ lug
221+ => .(mut (trim (sub edg tab) hom))
222+ [(runt [tab ' '] p.mut) $(hom q.mut)]
223+ ::
224+
225+Examples
226+--------
227+
228+### `++wig`
229+
230+`++win` render tape
231+
232+Render [`++tape`](). Internal to [`++win`]().
233+
234+Accepts
235+-------
236+
237+`tac` is a `++tank`, taken from [sample]() of `++re` [core]().
238+
239+`hom` is a `++tape`.
240+
241+Produces
242+--------
243+
244+ ++ wig
245+ |= hom=tape
246+ ^- wall
247+ ?~ lug
248+ (rig hom)
249+ =+ lin=(lent hom)
250+ =+ wug=:(add 1 tab lin)
251+ ?. =+ mir=i.lug
252+ |- ?~ mir
253+ |
254+ ?|(=(0 wug) ?&(=(' ' i.mir) $(mir t.mir, wug (dec wug))))
255+ (rig hom) :: ^ XX regular form?
256+ [(runt [tab ' '] (weld hom `tape`[' ' (slag wug i.lug)])) t.lug]
257+ --
258+ --
259+
260+
docs/system/hoon/library/src/4c/gate/show.mdnew file+103
@@ -0,0 +1,103 @@
1+### `++show`
2+
3+ ++ show :: XX deprecated, use type
4+ |= vem=*
5+ |^ ^- tank
6+ ?: ?=(@ vem)
7+ [%leaf (mesc (trip vem))]
8+ ?- vem
9+ [s=~ c=*]
10+ [%leaf '\'' (weld (mesc (tape +.vem)) `tape`['\'' ~])]
11+ ::
12+ [s=%a c=@] [%leaf (mesc (trip c.vem))]
13+ [s=%b c=*] (shop c.vem |=(a=@ ~(rub at a)))
14+ [s=[%c p=@] c=*]
15+ :+ %palm
16+ [['.' ~] ['-' ~] ~ ~]
17+ [[%leaf (mesc (trip p.s.vem))] $(vem c.vem) ~]
18+ ::
19+ [s=%d c=*] (shop c.vem |=(a=@ ~(rud at a)))
20+ [s=%k c=*] (tank c.vem)
21+ [s=%h c=*]
22+ ?: =(0 c.vem) :: XX remove after 220
23+ [%leaf '#' ~]
24+ :+ %rose
25+ [['/' ~] ['/' ~] ~]
26+ =+ yol=((list ,@ta) c.vem)
27+ (turn yol |=(a=@ta [%leaf (trip a)]))
28+ ::
29+ [s=%o c=*]
30+ %= $
31+ vem
32+ :- [%m '%h:<[%d %d].[%d %d]>']
33+ [-.c.vem +<-.c.vem +<+.c.vem +>-.c.vem +>+.c.vem ~]
34+ ==
35+ ::
36+ [s=%p c=*] (shop c.vem |=(a=@ ~(rup at a)))
37+ [s=%q c=*] (shop c.vem |=(a=@ ~(r at a)))
38+ [s=%r c=*] $(vem [[%r ' ' '{' '}'] c.vem])
39+ [s=%t c=*] (shop c.vem |=(a=@ ~(rt at a)))
40+ [s=%v c=*] (shop c.vem |=(a=@ ~(ruv at a)))
41+ [s=%x c=*] (shop c.vem |=(a=@ ~(rux at a)))
42+ [s=[%m p=@] c=*] (shep p.s.vem c.vem)
43+ [s=[%r p=@] c=*]
44+ $(vem [[%r ' ' (cut 3 [0 1] p.s.vem) (cut 3 [1 1] p.s.vem)] c.vem])
45+ ::
46+ [s=[%r p=@ q=@ r=@] c=*]
47+ :+ %rose
48+ :* p=(mesc (trip p.s.vem))
49+ q=(mesc (trip q.s.vem))
50+ r=(mesc (trip r.s.vem))
51+ ==
52+ |- ^- (list tank)
53+ ?@ c.vem
54+ ~
55+ [^$(vem -.c.vem) $(c.vem +.c.vem)]
56+ ::
57+ [s=%z c=*] $(vem [[%r %$ %$ %$] c.vem])
58+ * !!
59+ ==
60+
61+XX document
62+
63+### `++shep`
64+
65+ ++ shep
66+ |= [fom=@ gar=*]
67+ ^- tank
68+ =+ l=(met 3 fom)
69+ =+ i=0
70+ :- %leaf
71+ |- ^- tape
72+ ?: (gte i l)
73+ ~
74+ =+ c=(cut 3 [i 1] fom)
75+ ?. =(37 c)
76+ (weld (mesc [c ~]) $(i +(i)))
77+ =+ d=(cut 3 [+(i) 1] fom)
78+ ?. .?(gar)
79+ ['\\' '#' $(i (add 2 i))]
80+ (weld ~(ram re (show d -.gar)) $(i (add 2 i), gar +.gar))
81+ ::
82+
83+XX document
84+
85+### `++shop`
86+
87+ ++ shop
88+ |= [aug=* vel=$+(a=@ tape)]
89+ ^- tank
90+ ?: ?=(@ aug)
91+ [%leaf (vel aug)]
92+ :+ %rose
93+ [[' ' ~] ['[' ~] [']' ~]]
94+ => .(aug `*`aug)
95+ |- ^- (list tank)
96+ ?: ?=(@ aug)
97+ [^$ ~]
98+ [^$(aug -.aug) $(aug +.aug)]
99+ --
100+
101+XX document
102+
103+
docs/system/hoon/library/src/4d/gate/last.mdnew file+42
@@ -0,0 +1,42 @@
1+### `++last`
2+
3+Farther trace
4+
5+Compares two line-column pairs, called [`++hair`]()s, `zyc` and `naz`, producing whichever
6+is further along.
7+
8+Accepts
9+-------
10+
11+`naz` is a [hair]().
12+
13+`zyc` is a [hair]().
14+
15+Produces
16+--------
17+
18+a `++hair`.
19+
20+Source
21+------
22+
23+ ++ last |= [zyc=hair naz=hair] :: farther trace
24+ ^- hair
25+ ?: =(p.zyc p.naz)
26+ ?:((gth q.zyc q.naz) zyc naz)
27+ ?:((gth p.zyc p.naz) zyc naz)
28+ ::
29+
30+
31+Examples
32+--------
33+
34+ ~zod/try=> (last [1 1] [1 2])
35+ [p=1 q=2]
36+ ~zod/try=> (last [2 1] [1 2])
37+ [p=2 q=1]
38+ ~zod/try=> (last [0 0] [99 0])
39+ [p=99 q=0]
40+ ~zod/try=> (last [7 7] [7 7])
41+ [p=7 q=7]
42+
docs/system/hoon/library/src/4d/gate/lust.mdnew file+46
@@ -0,0 +1,46 @@
1+
2+### `++lust`
3+
4+Detect newline
5+
6+Advances the [`++hair`]() `naz` by a row if the [`++char`]() `weq` is a newline, or by a
7+column if `weq` is any other character.
8+
9+Accepts
10+-------
11+
12+`weq` is a char.
13+
14+`naz` is a hair.
15+
16+Produces
17+--------
18+
19+A hair.
20+
21+Source
22+------
23+
24+ ++ lust |= [weq=char naz=hair] :: detect newline
25+ ^- hair
26+ ?:(=(10 weq) [+(p.naz) 1] [p.naz +(q.naz)])
27+
28+
29+Examples
30+--------
31+
32+ ~zod/try=> (lust `a` [1 1])
33+ [p=1 q=2]
34+ ~zod/try=> (lust `@t`10 [1 1])
35+ [p=2 q=1]
36+ ~zod/try=> (lust '9' [10 10])
37+ [p=10 q=11]
38+ /~zod/try=> (roll "maze" [.(+<+ [1 1])]:lust)
39+ [1 5]
40+ /~zod/try=> %- roll :_ [.(+<+ [1 1])]:lust
41+ """
42+ Sam
43+ lokes
44+ """
45+ [2 6]
46+
docs/system/hoon/library/src/4e/gate/bend.mdnew file+62
@@ -0,0 +1,62 @@
1+### `++bend`
2+
3+Conditional composer
4+
5+Parsing composer: connects the [`++edge`]() `vex` with the subsequent [`++rule`]() `sab`
6+as an optional suffix, using [gate]() `raq` to compose or reject its
7+result. If there is no suffix, or if the suffix fails to be composed
8+with the current result, the current result is produced. Used to map a
9+group of rules to a specified output.
10+
11+Accepts
12+-------
13+
14+`raq` is a [gate]().
15+
16+`sab` is a [rule]().
17+
18+`vex` is an [edge]().
19+
20+Produces
21+--------
22+
23+A [`++rule`]().
24+
25+Source
26+------
27+
28+ ++ bend :: conditional comp
29+ ~/ %bend
30+ |* raq=_|*([a=* b=*] [~ u=[a b]])
31+ ~/ %fun
32+ |* [vex=edge sab=_rule]
33+ ?~ q.vex
34+ vex
35+ =+ yit=(sab q.u.q.vex)
36+ =+ yur=(last p.vex p.yit)
37+ ?~ q.yit
38+ [p=yur q=q.vex]
39+ =+ vux=(raq p.u.q.vex p.u.q.yit)
40+ ?~ vux
41+ [p=yur q=q.vex]
42+ [p=yur q=[~ u=[p=u.vux q=q.u.q.yit]]]
43+ ::
44+
45+Examples
46+--------
47+
48+ ~zod/try=> (;~((bend |=([a=char b=char] ?.(=(a b) ~ (some +(a))))) prn prn) [1 1] "qs")
49+ [p=[p=1 q=3] q=[~ u=[p=~~q q=[p=[p=1 q=2] q="s"]]]]
50+ ~zod/try=> (;~((bend |=([a=char b=char] ?.(=(a b) ~ (some +(a))))) prn prn) [1 1] "qqq")
51+ [p=[p=1 q=3] q=[~ u=[p=~~r q=[p=[p=1 q=3] q="q"]]]]
52+ ~zod/try=> (scan "aa" ;~((bend |=([a=char b=char] ?.(=(a b) ~ (some +(a))))) prn prn))
53+ ~~b
54+ ~zod/try=> (scan "ba" ;~((bend |=([a=char b=char] ?.(=(a b) ~ (some +(a))))) prn prn))
55+ ! {1 3}
56+ ! exit
57+ ~zod/try=> `(unit ,@tas)`(scan "" ;~((bend) (easy ~) sym))
58+ ~
59+ ~zod/try=> `(unit ,@tas)`(scan "sep" ;~((bend) (easy ~) sym))
60+ [~ %sep]
61+
62+
docs/system/hoon/library/src/4e/gate/comp.mdnew file+48
@@ -0,0 +1,48 @@
1+### `++comp`
2+
3+Arbitrary compose
4+
5+Parsing composer: connects the [`++edge`]() `vex` with a following [`++rule`]() `sab`,
6+combining the contents of `vex` with the result of `sab` using a binary
7+[gate]() `raq`. Used to fold over the results of several `++rules`.
8+
9+Accepts
10+-------
11+
12+`raq` is a gate that accepts a cell of two [nouns](), `a` and `b`, and
13+produces a cell of two nouns.
14+
15+`sab` is a rule.
16+
17+`vex` is an edge.
18+
19+Produces
20+--------
21+
22+A [`++rule`]().
23+
24+Source
25+------
26+
27+ ++ comp
28+ ~/ %comp
29+ |* raq=_|*([a=* b=*] [a b]) :: arbitrary compose
30+ ~/ %fun
31+ |* [vex=edge sab=_rule]
32+ ?~ q.vex
33+ vex
34+ =+ yit=(sab q.u.q.vex)
35+ =+ yur=(last p.vex p.yit)
36+ ?~ q.yit
37+ [p=yur q=q.yit]
38+ [p=yur q=[~ u=[p=(raq p.u.q.vex p.u.q.yit) q=q.u.q.yit]]]
39+ ::
40+
41+Examples
42+--------
43+
44+ ~zod/try=> (scan "123" ;~((comp |=([a=@u b=@u] (add a b))) dit dit dit))
45+ 6
46+ ~zod/try=> (scan "12" ;~((comp |=([a=@u b=@u] (add a b))) dit dit dit))
47+ ! {1 3}
48+ ! exit
docs/system/hoon/library/src/4e/gate/fail.mdnew file+31
@@ -0,0 +1,31 @@
1+### `++fail`
2+
3+Never parse
4+
5+Produces an [`++edge`]() at the same text position ([`++hair`]()) with a failing
6+result (`q=~`).
7+
8+Accepts
9+-------
10+
11+`tub` is a [`++nail`]().
12+
13+Produces
14+--------
15+
16+An `++edge`.
17+
18+Source
19+------
20+
21+ ++ fail |=(tub=nail [p=p.tub q=~]) :: never parse
22+
23+Examples
24+--------
25+
26+ ~zod/try=> (fail [[1 1] "abc"])
27+ [p=[p=1 q=1] q=~]
28+ ~zod/try=> (fail [[p=1.337 q=70] "Parse me, please?"])
29+ [p=[p=1.337 q=70] q=~]
30+
31+
docs/system/hoon/library/src/4e/gate/glue.mdnew file+46
@@ -0,0 +1,46 @@
1+### `++glue`
2+
3+Skip delimiter
4+
5+Parsing composer: connects an [`++edge`]() `vex` with a following [`++rule`]() `sab` by
6+parsing the `++rule` `bus` (the delimiting symbol) and throwing out the
7+result.
8+
9+Accepts
10+-------
11+
12+`bus` is a `++rule`.
13+
14+`sab` is a `++rule`.
15+
16+`vex` is an `++edge`.
17+
18+Produces
19+--------
20+
21+
22+
23+Source
24+------
25+
26+ ++ glue :: add rule
27+ ~/ %glue
28+ |* bus=_rule
29+ ~/ %fun
30+ |* [vex=edge sab=_rule]
31+ (plug vex ;~(pfix bus sab))
32+ ::
33+
34+Examples
35+--------
36+
37+ ~zod/try=> (scan "200|mal|bon" ;~((glue bar) dem sym sym))
38+ [q=200 7.102.829 7.237.474]
39+ ~zod/try=> `[@u @tas @tas]`(scan "200|mal|bon" ;~((glue bar) dem sym sym))
40+ [200 %mal %bon]
41+ ~zod/try=> (scan "200|;|bon" ;~((glue bar) dem sem sym))
42+ [q=200 ~~~3b. 7.237.474]
43+ ~zod/try=> (scan "200.;.bon" ;~((glue dot) dem sem sym))
44+ [q=200 ~~~3b. 7.237.474]
45+
46+
docs/system/hoon/library/src/4e/gate/less.mdnew file+43
@@ -0,0 +1,43 @@
1+### `++less`
2+
3+Parse unless
4+
5+Parsing composer: if an [`++edge`]() `vex` reflects a success, fail. Otherwise,
6+connect `vex` with the following [`++rule`]().
7+
8+Accepts
9+-------
10+
11+`sab` is a `++rule`.
12+
13+`vex` is an `++edge`.
14+
15+Produces
16+--------
17+
18+
19+
20+Source
21+------
22+
23+ ++ less :: no first and second
24+ |* [vex=edge sab=_rule]
25+ ?~ q.vex
26+ =+ roq=(sab)
27+ [p=(last p.vex p.roq) q=q.roq]
28+ vex(q ~)
29+ ::
30+
31+Examples
32+--------
33+
34+ ~zod/try=> (scan "sas-/lo" (star ;~(less lus bar prn)))
35+ "sas-/lo"
36+ ~zod/try=> (scan "sas-/l+o" (star ;~(less lus bar prn)))
37+ ! {1 8}
38+ ! exit
39+ ~zod/try=> (scan "sas|-/lo" (star ;~(less lus bar prn)))
40+ ! {1 5}
41+ ! exit
42+
43+
docs/system/hoon/library/src/4e/gate/pfix.mdnew file+34
@@ -0,0 +1,34 @@
1+### `++pfix`
2+
3+Discard first rule
4+
5+Parsing composer: connects an [`++edge`]() `vex` with two subsequent [`++rule`]()s,
6+ignoring the result of the first and producing the result of the second.
7+
8+Accepts
9+-------
10+
11+`vex` is an [edge]().
12+
13+Produces
14+--------
15+
16+
17+
18+Source
19+------
20+
21+ ++ pfix :: discard first rule
22+ ~/ %pfix
23+ (comp |*([a=* b=*] b))
24+ ::
25+
26+Examples
27+--------
28+
29+ ~zod/try=> `@t`(scan "%him" ;~(pfix cen sym))
30+ 'him'
31+ ~zod/try=> (scan "+++10" ;~(pfix (star lus) dem))
32+ q=10
33+
34+
docs/system/hoon/library/src/4e/gate/plug.mdnew file+46
@@ -0,0 +1,46 @@
1+### `++plug`
2+
3+Parse to tuple
4+
5+Parsing composer: connects an [`++edge`]() `vex` with a following [`++rule`]() `sab`, producing
6+a cell of both the results. See also: the monad applicator [;\~]() for a
7+more detailed explanation.
8+
9+Accepts
10+-------
11+
12+`sab` is a `++rule`.
13+
14+`vex` is an `++edge`.
15+
16+Produces
17+--------
18+
19+
20+
21+Source
22+------
23+
24+ ++ plug :: first then second
25+ ~/ %plug
26+ |* [vex=edge sab=_rule]
27+ ?~ q.vex
28+ vex
29+ =+ yit=(sab q.u.q.vex)
30+ =+ yur=(last p.vex p.yit)
31+ ?~ q.yit
32+ [p=yur q=q.yit]
33+ [p=yur q=[~ u=[p=[p.u.q.vex p.u.q.yit] q=q.u.q.yit]]]
34+ ::
35+
36+Examples
37+--------
38+
39+ ~zod/try=> (scan "1..20" ;~(plug dem dot dot dem))
40+ [q=1 ~~~. ~~~. q=20]
41+ ~zod/try=> (scan "moke/~2014.1.1" ;~(plug sym fas nuck:so))
42+ [1.701.539.693 ~~~2f. [% p=[p=~.da q=170.141.184.500.766.106.671.844.917.172.921.958.400]]]
43+ ~zod/try=> ;;(,[@tas @t ~ %da @da] (scan "moke/~2014.1.1" ;~(plug sym fas nuck:so)))
44+ [%moke '/' ~ %da ~2014.1.1]
45+
46+
docs/system/hoon/library/src/4e/gate/pose.mdnew file+44
@@ -0,0 +1,44 @@
1+### `++pose`
2+
3+Parse options
4+
5+Parsing composer: if `vex` reflects a failure, connect it with the
6+following rule `sab`. See also: the monad applicator [;\~]()
7+
8+Accepts
9+-------
10+
11+`sab` is a [`++rule`]().
12+
13+`vex` is an [`++edge`]().
14+
15+Produces
16+--------
17+
18+
19+
20+Source
21+------
22+
23+ ++ pose :: first or second
24+ ~/ %pose
25+ |* [vex=edge sab=_rule]
26+ ?~ q.vex
27+ =+ roq=(sab)
28+ [p=(last p.vex p.roq) q=q.roq]
29+ vex
30+
31+Examples
32+--------
33+
34+ ~zod/try=> `@t`(scan "+" ;~(pose lus tar cen))
35+ '+'
36+ ~zod/try=> `@t`(scan "*" ;~(pose lus tar cen))
37+ '*'
38+ ~zod/try=> `@t`(scan "%" ;~(pose lus tar cen))
39+ '%'
40+ ~zod/try=> `@t`(scan "-" ;~(pose lus tar cen))
41+ ! {1 1}
42+ ! exit
43+
44+
docs/system/hoon/library/src/4e/gate/sfix.mdnew file+35
@@ -0,0 +1,35 @@
1+### `++sfix`
2+
3+Discard second rule
4+
5+Parsing composer: connects [`++edge`]()s `vex` with two subsequent [`++rule`]()s returning the
6+result of the first and discarding the result of the second.
7+
8+Accepts
9+-------
10+
11+`a` is the result of parsing the first `++rule`.
12+
13+`b` is the result of of parsing the second `++rule`.
14+
15+Produces
16+--------
17+
18+
19+
20+Source
21+------
22+
23+ ++ sfix :: discard second rule
24+ ~/ %sfix
25+ (comp |*([a=* b=*] a))
26+
27+Examples
28+--------
29+
30+ ~zod/try=> `@t`(scan "him%" ;~(sfix sym cen))
31+ 'him'
32+ ~zod/try=> (scan "10+++" ;~(sfix dem (star lus)))
33+ q=10
34+
35+
docs/system/hoon/library/src/4e/gate/simu.mdnew file+44
@@ -0,0 +1,44 @@
1+### `++simu`
2+
3+First and second
4+
5+Parsing composer: if an [`++edge`]() `vex` reflects a failure, fail. Otherwise,
6+connect `vex` with the following [`++rule`]().
7+
8+Accepts
9+-------
10+
11+`sab` is a `++rule`.
12+
13+`vex` is an `++edge`.
14+
15+Produces
16+--------
17+
18+
19+
20+Source
21+------
22+
23+ ++ simu :: first and second
24+ |* [vex=edge sab=_rule]
25+ ?~ q.vex
26+ vex
27+ =+ roq=(sab)
28+ roq
29+ ::
30+
31+Examples
32+--------
33+
34+ ~zod/try=> (scan "~zod" scat:vast)
35+ [%dtzy p=%p q=0]
36+ ~zod/try=> (scan "%zod" scat:vast)
37+ [%dtzz p=%tas q=6.582.138]
38+ ~zod/try=> (scan "%zod" ;~(simu cen scat:vast))
39+ [%dtzz p=%tas q=6.582.138]
40+ ~zod/try=> (scan "~zod" ;~(simu cen scat:vast))
41+ ! {1 1}
42+ ! exit
43+
44+
docs/system/hoon/library/src/4f/gate/bass.mdnew file+40
@@ -0,0 +1,40 @@
1+### `++bass`
2+
3+Parser modifier: [LSB](http://en.wikipedia.org/wiki/Least_significant_bit)
4+ordered [`++list`]() as atom of a [`++base`]().
5+
6+Accepts
7+-------
8+
9+`wuc` is an atom.
10+
11+`tyd` is a [`++rule`]().
12+
13+Produces
14+--------
15+
16+A [`++rule`]().
17+
18+Source
19+------
20+
21+ ++ bass
22+ |* [wuc=@ tyd=_rule]
23+ %+ cook
24+ |= waq=(list ,@)
25+ %+ roll
26+ waq
27+ =|([p=@ q=@] |.((add p (mul wuc q))))
28+ tyd
29+
30+Examples
31+--------
32+
33+ ~zod/try=> (scan "123" (bass 10 (star dit)))
34+ q=123
35+ ~zod/try=> (scan "123" (bass 8 (star dit)))
36+ q=83
37+ ~zod/try=> `@ub`(scan "123" (bass 8 (star dit)))
38+ 0b101.0011
39+
40+
docs/system/hoon/library/src/4f/gate/boss.mdnew file+40
@@ -0,0 +1,40 @@
1+
2+### `++boss`
3+
4+Parser modifier: [LSB](http://en.wikipedia.org/wiki/Least_significant_bit)
5+ordered [`++list`]() as atom of a [`++base`]().
6+
7+Accepts
8+-------
9+
10+`wuc` is an atom.
11+
12+`tyd` is a [`++rule`]().
13+
14+Produces
15+--------
16+
17+A [`++rule`]().
18+
19+Source
20+------
21+
22+ ++ boss
23+ |* [wuc=@ tyd=_rule]
24+ %+ cook
25+ |= waq=(list ,@)
26+ %+ reel
27+ waq
28+ =|([p=@ q=@] |.((add p (mul wuc q))))
29+ tyd
30+
31+Examples
32+--------
33+
34+ ~zod/try=> (scan "123" (boss 10 (star dit)))
35+ q=321
36+ ~zod/try=> `@t`(scan "bam" (boss 256 (star alp)))
37+ 'bam'
38+ ~zod/try=> `@ux`(scan "bam" (boss 256 (star alp)))
39+ 0x6d.6162
40+
docs/system/hoon/library/src/4f/gate/cold.mdnew file+42
@@ -0,0 +1,42 @@
1+### `++cold`
2+
3+Replace with constant
4+
5+Parser modifier. Accepts a [`++rule`]() `sef` and produces a parser that
6+produces a constant `cus`, assuming `sef` is successful.
7+
8+Accepts
9+-------
10+
11+`cus` is a constant [noun]().
12+
13+`sef` is a `++rule`.
14+
15+Produces
16+--------
17+
18+An [`++edge`]().
19+
20+Source
21+------
22+
23+ ++ cold :: replace w/ constant
24+ ~/ %cold
25+ |* [cus=* sef=_rule]
26+ ~/ %fun
27+ |= tub=nail
28+ =+ vex=(sef tub)
29+ ?~ q.vex
30+ vex
31+ [p=p.vex q=[~ u=[p=cus q=q.u.q.vex]]]
32+ ::
33+
34+Examples
35+--------
36+
37+ ~zod/try=> ((cold %foo (just 'a')) [[1 1] "abc"])
38+ [p=[p=1 q=2] q=[~ u=[p=%foo q=[p=[p=1 q=2] q="bc"]]]]
39+ ~zod/try=> ((cold %foo (just 'a')) [[1 1] "bc"])
40+ [p=[p=1 q=1] q=~]
41+
42+
docs/system/hoon/library/src/4f/gate/cook.mdnew file+46
@@ -0,0 +1,46 @@
1+### `++cook`
2+
3+Apply gate
4+
5+Parser modifier. Produces a parser that takes a (successful) result of a
6+[`++rule`]() `sef` and slams it through `poq`.
7+
8+Accepts
9+-------
10+
11+`poq` is a [gate]().
12+
13+`sef` is a [`++rule`]().
14+
15+Produces
16+--------
17+
18+An [`++rule`]().
19+
20+Source
21+------
22+
23+ ++ cook :: apply gate
24+ ~/ %cook
25+ |* [poq=_,* sef=_rule]
26+ ~/ %fun
27+ |= tub=nail
28+ =+ vex=(sef tub)
29+ ?~ q.vex
30+ vex
31+ [p=p.vex q=[~ u=[p=(poq p.u.q.vex) q=q.u.q.vex]]]
32+ ::
33+
34+Examples
35+--------
36+
37+ ~zod/try=> ((cook ,@ud (just 'a')) [[1 1] "abc"])
38+ [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]]
39+ ~zod/try=> ((cook ,@tas (just 'a')) [[1 1] "abc"])
40+ [p=[p=1 q=2] q=[~ u=[p=%a q=[p=[p=1 q=2] q="bc"]]]]
41+ ~zod/try=> ((cook |=(a=@ +(a)) (just 'a')) [[1 1] "abc"])
42+ [p=[p=1 q=2] q=[~ u=[p=98 q=[p=[p=1 q=2] q="bc"]]]]
43+ ~zod/try=> ((cook |=(a=@ `@t`+(a)) (just 'a')) [[1 1] "abc"])
44+ [p=[p=1 q=2] q=[~ u=[p='b' q=[p=[p=1 q=2] q="bc"]]]]
45+
46+
docs/system/hoon/library/src/4f/gate/easy.mdnew file+40
@@ -0,0 +1,40 @@
1+### `++easy`
2+
3+Always parse
4+
5+Parser generator. Produces a parser that succeeds with given [noun]() `huf`
6+without consuming any text.
7+
8+Accepts
9+-------
10+
11+`huf` is a noun.
12+
13+Produces
14+--------
15+
16+A [`++rule`]().
17+
18+Source
19+------
20+
21+ ++ easy :: always parse
22+ ~/ %easy
23+ |* huf=*
24+ ~/ %fun
25+ |= tub=nail
26+ ^- (like ,_huf)
27+ [p=p.tub q=[~ u=[p=huf q=tub]]]
28+ ::
29+
30+Examples
31+--------
32+
33+ ~zod/try=> ((easy %foo) [[1 1] "abc"])
34+ [p=[p=1 q=1] q=[~ [p=%foo q=[p=[p=1 q=1] q="abc"]]]]
35+ ~zod/try=> ((easy %foo) [[1 1] "bc"])
36+ [p=[p=1 q=1] q=[~ [p=%foo q=[p=[p=1 q=1] q="bc"]]]]
37+ ~zod/try=> ((easy 'a') [[1 1] "bc"])
38+ [p=[p=1 q=1] q=[~ [p='a' q=[p=[p=1 q=1] q="bc"]]]]
39+
40+
docs/system/hoon/library/src/4f/gate/full.mdnew file+38
@@ -0,0 +1,38 @@
1+### `++full`
2+
3+Parse to end
4+
5+Parser modifier. Accepts a [`++rule`]() `sef`, and produces a parser that succeeds only
6+when the of `tub` is fully consumed using `sef`.
7+
8+Accepts
9+-------
10+
11+`sef` is a [`++rule`]().
12+
13+Produces
14+--------
15+
16+A `++rule`.
17+
18+Source
19+------
20+
21+ ++ full :: parse to end
22+ |* sef=_rule
23+ |= tub=nail
24+ =+ vex=(sef tub)
25+ ?~(q.vex vex ?:(=(~ q.q.u.q.vex) vex [p=p.vex q=~]))
26+ ::
27+
28+Examples
29+--------
30+
31+ ~zod/try=> ((full (just 'a')) [[1 1] "ab"])
32+ [p=[p=1 q=2] q=~]
33+ ~zod/try=> ((full (jest 'ab')) [[1 1] "ab"])
34+ [p=[p=1 q=3] q=[~ u=[p='ab' q=[p=[p=1 q=3] q=""]]]]
35+ ~zod/try=> ((full ;~(plug (just 'a') (just 'b'))) [[1 1] "ab"])
36+ [p=[p=1 q=3] q=[~ u=[p=[~~a ~~b] q=[p=[p=1 q=3] q=""]]]]
37+
38+
docs/system/hoon/library/src/4f/gate/funk.mdnew file+36
@@ -0,0 +1,36 @@
1+### `++funk`
2+
3+Add to tape
4+
5+Parser modifier: prepend text to [`++tape`]() before applying parser.
6+
7+Accepts
8+-------
9+
10+`pre` is a `++tape`
11+
12+`sef` is a [`++rule`]()
13+
14+Produces
15+--------
16+
17+A `++rule`.
18+
19+Source
20+------
21+
22+ ++ funk :: add to tape first
23+ |* [pre=tape sef=_rule]
24+ |= tub=nail
25+ (sef p.tub (weld pre q.tub))
26+ ::
27+
28+Examples
29+--------
30+
31+ ~zod/try=> ((funk "abc prefix-" (jest 'abc')) [[1 1] "to be parsed"])
32+ [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=" prefix-to be parsed"]]]]
33+ ~zod/try=> ((funk "parse" (just 'a')) [[1 4] " me"])
34+ [p=[p=1 q=4] q=~]
35+
36+
docs/system/hoon/library/src/4f/gate/here.mdnew file+45
@@ -0,0 +1,45 @@
1+### `++here`
2+
3+Place-based apply
4+
5+Parser modifier. Similar to [`++cook`]() in that it produces a parser that takes a
6+(successful) result of `sef` and slams it through `hez`. `hez` accepts a
7+[`++pint`]() `a` and a [noun]() `b`, which is what the parser parsed.
8+
9+Accepts
10+-------
11+
12+`hez` is a [gate]().
13+
14+`sef` is a [`++rule`]()
15+
16+Produces
17+--------
18+
19+A `++rule`.
20+
21+Source
22+------
23+
24+ ++ here :: place-based apply
25+ ~/ %here
26+ |* [hez=_|=([a=pint b=*] [a b]) sef=_rule]
27+ ~/ %fun
28+ |= tub=nail
29+ =+ vex=(sef tub)
30+ ?~ q.vex
31+ vex
32+ [p=p.vex q=[~ u=[p=(hez [p.tub p.q.u.q.vex] p.u.q.vex) q=q.u.q.vex]]]
33+ ::
34+
35+Examples
36+--------
37+
38+ ~zod/try=> (scan "abc" (star alf))
39+ "abc"
40+ ~zod/try=> (scan "abc" (here |*(^ +<) (star alf)))
41+ [[[p=1 q=1] p=1 q=4] "abc"]
42+ ~zod/try=> (scan "abc" (star (here |*(^ +<) alf)))
43+ ~[[[[p=1 q=1] p=1 q=2] ~~a] [[[p=1 q=2] p=1 q=3] ~~b] [[[p=1 q=3] p=1 q=4] ~~c]]
44+
45+
docs/system/hoon/library/src/4f/gate/ifix.mdnew file+35
@@ -0,0 +1,35 @@
1+### `++ifix`
2+
3+Infix
4+
5+Parser modifier: surround with pair of [`++rule`]()s, the output of which is
6+discarded.
7+
8+Accepts
9+-------
10+
11+`fel` is a pair of `++rule`s.
12+
13+`hof` is a `++rule`.
14+
15+Produces
16+--------
17+
18+A `++rule`.
19+
20+Source
21+------
22+
23+ ++ ifix
24+ |* [fel=[p=_rule q=_rule] hof=_rule]
25+ ;~(pfix p.fel ;~(sfix hof q.fel))
26+
27+Examples
28+--------
29+
30+ ~zod/try=> (scan "-40-" (ifix [hep hep] dem))
31+ q=40
32+ ~zod/try=> (scan "4my4" (ifix [dit dit] (star alf)))
33+ "my"
34+
35+
docs/system/hoon/library/src/4f/gate/jest.mdnew file+48
@@ -0,0 +1,48 @@
1+### `++jest`
2+
3+Match a cord
4+
5+Match and consume a cord.
6+
7+Accepts
8+-------
9+
10+`daf` is a [`@t`]().
11+
12+Produces
13+--------
14+
15+An [`++edge`]().
16+
17+Source
18+------
19+
20+ ++ jest :: match a cord
21+ |= daf=@t
22+ |= tub=nail
23+ =+ fad=daf
24+ |- ^- (like ,@t)
25+ ?: =(0 daf)
26+ [p=p.tub q=[~ u=[p=fad q=tub]]]
27+ ?: |(?=(~ q.tub) !=((end 3 1 daf) i.q.tub))
28+ (fail tub)
29+ $(p.tub (lust i.q.tub p.tub), q.tub t.q.tub, daf (rsh 3 1 daf))
30+ ::
31+
32+Examples
33+--------
34+
35+ ~zod/try=> ((jest 'abc') [[1 1] "abc"])
36+ [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=""]]]]
37+ ~zod/try=> (scan "abc" (jest 'abc'))
38+ 'abc'
39+ ~zod/try=> (scan "abc" (jest 'acb'))
40+ ! {1 2}
41+ ! 'syntax-error'
42+ ! exit
43+ ~zod/try=> ((jest 'john doe') [[1 1] "john smith"])
44+ [p=[p=1 q=6] q=~]
45+ ~zod/try=> ((jest 'john doe') [[1 1] "john doe"])
46+ [p=[p=1 q=9] q=[~ [p='john doe' q=[p=[p=1 q=9] q=""]]]]
47+
48+
docs/system/hoon/library/src/4f/gate/just.mdnew file+48
@@ -0,0 +1,48 @@
1+### `++just`
2+
3+Match a char
4+
5+Match and consume a single character.
6+
7+Accepts
8+-------
9+
10+`daf` is a [`++char`]()
11+
12+Produces
13+--------
14+
15+A [`++rule`]().
16+
17+Source
18+------
19+
20+ ++ just :: XX redundant, jest
21+ ~/ %just :: match a char
22+ |= daf=char
23+ ~/ %fun
24+ |= tub=nail
25+ ^- (like char)
26+ ?~ q.tub
27+ (fail tub)
28+ ?. =(daf i.q.tub)
29+ (fail tub)
30+ (next tub)
31+ ::
32+
33+
34+Examples
35+--------
36+
37+ ~zod/try=> ((just 'a') [[1 1] "abc"])
38+ [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
39+ ~zod/try=> (scan "abc" (just 'a'))
40+ ! {1 2}
41+ ! 'syntax-error'
42+ ! exit
43+ ~zod/try=> (scan "a" (just 'a'))
44+ ~~a
45+ ~zod/try=> (scan "%" (just '%'))
46+ ~~~25.
47+
48+
docs/system/hoon/library/src/4f/gate/knee.mdnew file+54
@@ -0,0 +1,54 @@
1+### `++knee`
2+
3+Recursive parsers
4+
5+Used for recursive parsers, which would otherwise be infinite when
6+compiled.
7+
8+Accepts
9+-------
10+
11+`gar` is a noun.
12+
13+`sef` is a [gate]() that accepts a [`++rule`]()
14+
15+Produces
16+--------
17+
18+A [`++rule`]().
19+
20+Source
21+------
22+
23+ ++ knee :: callbacks
24+ |* [gar=* sef=_|.(rule)]
25+ |= tub=nail
26+ ^- (like ,_gar)
27+ ((sef) tub)
28+ ::
29+
30+Examples
31+--------
32+
33+ ~zod/try=> |-(;~(plug prn ;~(pose $ (easy ~))))
34+ ! rest-loop
35+ ! exit
36+ ~zod/try=> |-(;~(plug prn ;~(pose (knee *tape |.(^$)) (easy ~))))
37+ < 1.obo
38+ [ c=c=tub=[p=[p=@ud q=@ud] q=""]
39+ b
40+ < 1.bes
41+ [ c=tub=[p=[p=@ud q=@ud] q=""]
42+ b=<1.tnv [tub=[p=[p=@ud q=@ud] q=""] <1.ktu [daf=@tD <414.fvk 101.jzo 1.ypj %164>]>]>
43+ a=<1.fvg [tub=[p=[p=@ud q=@ud] q=""] <1.khu [[les=@ mos=@] <414.fvk 101.jzo 1.ypj %164>]>]>
44+ v=<414.fvk 101.jzo 1.ypj %164>
45+ ]
46+ >
47+ a
48+ ... 450 lines omitted ...
49+ ]
50+ >
51+ ~zod/try=> (scan "abcd" |-(;~(plug prn ;~(pose (knee *tape |.(^$)) (easy ~)))))
52+ [~~a "bcd"]
53+
54+
docs/system/hoon/library/src/4f/gate/mask.mdnew file+46
@@ -0,0 +1,46 @@
1+### `++mask`
2+
3+Match char
4+
5+Parser generator. Matches the next character if it is in a list of
6+characters.
7+
8+Accepts
9+-------
10+
11+`bud` is a list of [`++char`]()
12+
13+Produces
14+--------
15+
16+A [`++rule`]().
17+
18+Source
19+------
20+
21+ ++ mask :: match char in set
22+ ~/ %mask
23+ |= bud=(list char)
24+ ~/ %fun
25+ |= tub=nail
26+ ^- (like char)
27+ ?~ q.tub
28+ (fail tub)
29+ ?. (lien bud |=(a=char =(i.q.tub a)))
30+ (fail tub)
31+ (next tub)
32+ ::
33+
34+Examples
35+--------
36+
37+ ~zod/try=> (scan "a" (mask "cba"))
38+ ~~a
39+ ~zod/try=> ((mask "abc") [[1 1] "abc"])
40+ [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
41+ ~zod/try=> ((mask "abc") [[1 1] "bbc"])
42+ [p=[p=1 q=2] q=[~ [p=~~b q=[p=[p=1 q=2] q="bc"]]]]
43+ ~zod/try=> ((mask "abc") [[1 1] "dbc"])
44+ [p=[p=1 q=1] q=~]
45+
46+
docs/system/hoon/library/src/4f/gate/more.mdnew file+36
@@ -0,0 +1,36 @@
1+### `++more`
2+
3+Parse list with delimiter
4+
5+Parser modifier: Parse a list of matches using a delimiter [`++rule`]().
6+
7+Accepts
8+-------
9+
10+`bus` is a `++rule`.
11+
12+`fel` is a `++rule`.
13+
14+Produces
15+--------
16+
17+A `++rule`.
18+
19+Source
20+------
21+
22+ ++ more
23+ |* [bus=_rule fel=_rule]
24+ ;~(pose (most bus fel) (easy ~))
25+
26+Examples
27+--------
28+
29+ ~zod/try=> (scan "" (more ace dem))
30+ ~
31+ ~zod/try=> (scan "40 20" (more ace dem))
32+ [q=40 ~[q=20]]
33+ ~zod/try=> (scan "40 20 60 1 5" (more ace dem))
34+ [q=40 ~[q=20 q=60 q=1 q=5]]
35+
36+
docs/system/hoon/library/src/4f/gate/most.mdnew file+37
@@ -0,0 +1,37 @@
1+### `++most`
2+
3+Parse list of at least one match
4+
5+Parser modifier: parse a [`++list`]() of at least one match using a delimiter [`++rule`]().
6+
7+Accepts
8+-------
9+
10+`bus` is a `++rule`.
11+
12+`fel` is a `++rule`.
13+
14+Produces
15+--------
16+
17+A `++rule`.
18+
19+Source
20+------
21+
22+ ++ most
23+ |* [bus=_rule fel=_rule]
24+ ;~(plug fel (star ;~(pfix bus fel)))
25+
26+Examples
27+--------
28+
29+ ~zod/try=> (scan "40 20" (most ace dem))
30+ [q=40 ~[q=20]]
31+ ~zod/try=> (scan "40 20 60 1 5" (most ace dem))
32+ [q=40 ~[q=20 q=60 q=1 q=5]]
33+ ~zod/try=> (scan "" (most ace dem))
34+ ! {1 1}
35+ ! exit
36+
37+
docs/system/hoon/library/src/4f/gate/next.mdnew file+37
@@ -0,0 +1,37 @@
1+### `++next`
2+
3+Consume char
4+
5+Consume any character, producing it as a result.
6+
7+Accepts
8+-------
9+
10+`tub` is a [`++nail`]()
11+
12+Produces
13+--------
14+
15+An [`++edge`]().
16+
17+Source
18+------
19+
20+ ++ next :: consume a char
21+ |= tub=nail
22+ ^- (like char)
23+ ?~ q.tub
24+ (fail tub)
25+ =+ zac=(lust i.q.tub p.tub)
26+ [zac [~ i.q.tub [zac t.q.tub]]]
27+ ::
28+
29+Examples
30+--------
31+
32+ ~zod/try=> (next [[1 1] "ebc"])
33+ [p=[p=1 q=2] q=[~ [p=~~e q=[p=[p=1 q=2] q="bc"]]]]
34+ ~zod/try=> (next [[1 1] "john jumps jones"])
35+ [p=[p=1 q=2] q=[~ [p=~~j q=[p=[p=1 q=2] q="ohn jumps jones"]]]]
36+
37+
docs/system/hoon/library/src/4f/gate/plus.mdnew file+35
@@ -0,0 +1,35 @@
1+
2+### `++plus`
3+
4+List of at least one match.
5+
6+Parser modifier: parse [`++list`]() of at least one match.
7+
8+Accepts
9+-------
10+
11+`fel` is a [`++rule`]().
12+
13+Produces
14+--------
15+
16+A `++rule`.
17+
18+Source
19+------
20+
21+ ++ plus |*(fel=_rule ;~(plug fel (star fel)))
22+
23+Examples
24+--------
25+
26+ ~zod/try=> (scan ">>>>" (cook lent (plus gar)))
27+ 4
28+ ~zod/try=> (scan "- - " (plus ;~(pose ace hep)))
29+ [~~- " - "]
30+ ~zod/try=> `tape`(scan "- - " (plus ;~(pose ace hep)))
31+ "- - "
32+ ~zod/try=> `(pole ,@t)`(scan "- - " (plus ;~(pose ace hep)))
33+ ['-' [' ' [' ' ['-' [' ' ~]]]]]
34+
35+
docs/system/hoon/library/src/4f/gate/sear.mdnew file+41
@@ -0,0 +1,41 @@
1+### `++sear`
2+
3+Conditional `++cook`
4+
5+Conditional [`++cook`](). Slams the result through a gate that produces
6+a unit; if that unit is empty, fail.
7+
8+Accepts
9+-------
10+
11+`tub` is a [`++nail`](/doc/hoon/library/1#++nail)
12+
13+Produces
14+--------
15+
16+A [`++rule`]().
17+
18+Source
19+------
20+
21+ ++ sear :: conditional cook
22+ |* [pyq=_|=(* *(unit)) sef=_rule]
23+ |= tub=nail
24+ =+ vex=(sef tub)
25+ ?~ q.vex
26+ vex
27+ =+ gey=(pyq p.u.q.vex)
28+ ?~ gey
29+ [p=p.vex q=~]
30+ [p=p.vex q=[~ u=[p=u.gey q=q.u.q.vex]]]
31+ ::
32+
33+Examples
34+--------
35+
36+ ~zod/try=> ((sear |=(a=* ?@(a (some a) ~)) (just `a`)) [[1 1] "abc"])
37+ [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]]
38+ ~zod/try=> ((sear |=(* ~) (just 'a')) [[1 1] "abc"])
39+ [p=[p=1 q=2] q=~]
40+
41+
docs/system/hoon/library/src/4f/gate/shim.mdnew file+45
@@ -0,0 +1,45 @@
1+### `++shim`
2+
3+Char in range
4+
5+Match characters ([`++char`]()) within a range.
6+
7+Accepts
8+-------
9+
10+`les` is an atom.
11+
12+`mos` is an atom.
13+
14+Produces
15+--------
16+
17+A [`++rule`]().
18+
19+Source
20+------
21+
22+ ++ shim :: match char in range
23+ ~/ %shim
24+ |= [les=@ mos=@]
25+ ~/ %fun
26+ |= tub=nail
27+ ^- (like char)
28+ ?~ q.tub
29+ (fail tub)
30+ ?. ?&((gte i.q.tub les) (lte i.q.tub mos))
31+ (fail tub)
32+ (next tub)
33+ ::
34+
35+Examples
36+--------
37+
38+ ~zod/try=> ((shim 'a' 'z') [[1 1] "abc"])
39+ [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
40+ ~zod/try=> ((shim 'a' 'Z') [[1 1] "abc"])
41+ [p=[p=1 q=1] q=~]
42+ ~zod/try=> ((shim 'a' 'Z') [[1 1] "Abc"])
43+ [p=[p=1 q=2] q=[~ [p=~~~41. q=[p=[p=1 q=2] q="bc"]]]]
44+
45+
docs/system/hoon/library/src/4f/gate/slug.mdnew file+36
@@ -0,0 +1,36 @@
1+### `++slug`
2+
3+Use gate to parse delimited list
4+
5+Parser modifier: By composing with a [gate](), parse a delimited [`++list`]() of
6+matches.
7+
8+Accepts
9+-------
10+
11+`bus` is a [`++rule`]().
12+
13+`fel` is a `++rule`.
14+
15+Produces
16+--------
17+
18+A `++rule`.
19+
20+Source
21+------
22+
23+ ++ slug
24+ |* raq=_|*([a=* b=*] [a b])
25+ |* [bus=_rule fel=_rule]
26+ ;~((comp raq) fel (stir +<+.raq raq ;~(pfix bus fel)))
27+
28+Examples
29+--------
30+
31+ ~zod/try=> (scan "20+5+110" ((slug add) lus dem))
32+ 135
33+ ~zod/try=> `@t`(scan "a b c" ((slug |=(a=[@ @t] (cat 3 a))) ace alp))
34+ 'abc'
35+
36+
docs/system/hoon/library/src/4f/gate/stag.mdnew file+43
@@ -0,0 +1,43 @@
1+### `++stag`
2+
3+Add label
4+
5+Add a label to an edge parsed by a rule.
6+
7+Accepts
8+-------
9+
10+`gob` is a noun.
11+
12+`sef` is a rule.
13+
14+Produces
15+--------
16+
17+A [`++rule`]().
18+
19+Source
20+------
21+
22+ ++ stag :: add a label
23+ ~/ %stag
24+ |* [gob=* sef=_rule]
25+ ~/ %fun
26+ |= tub=nail
27+ =+ vex=(sef tub)
28+ ?~ q.vex
29+ vex
30+ [p=p.vex q=[~ u=[p=[gob p.u.q.vex] q=q.u.q.vex]]]
31+ ::
32+
33+Examples
34+--------
35+
36+ ~zod/try=> ((stag %foo (just 'a')) [[1 1] "abc"])
37+ [p=[p=1 q=2] q=[~ u=[p=[%foo ~~a] q=[p=[p=1 q=2] q="bc"]]]]
38+ ~zod/try=> ((stag "xyz" (jest 'abc')) [[1 1] "abc"])
39+ [p=[p=1 q=4] q=[~ u=[p=["xyz" 'abc'] q=[p=[p=1 q=4] q=""]]]]
40+ ~zod/try=> ((stag 10.000 (shim 0 100)) [[1 1] "abc"])
41+ [p=[p=1 q=2] q=[~ u=[p=[10.000 ~~a] q=[p=[p=1 q=2] q="bc"]]]]
42+
43+
docs/system/hoon/library/src/4f/gate/star.mdnew file+37
@@ -0,0 +1,37 @@
1+### `++star`
2+
3+List of matches
4+
5+Parser modifier: parse [`++list`]() of matches.
6+
7+Accepts
8+-------
9+
10+`fel` is a [`++rule`]().
11+
12+Produces
13+--------
14+
15+ ++ star :: 0 or more times
16+ |* fel=_rule
17+ (stir `(list ,_(wonk *fel))`~ |*([a=* b=*] [a b]) fel)
18+
19+Examples
20+--------
21+
22+ ~zod/try=> (scan "aaaaa" (just 'a'))
23+ ! {1 2}
24+ ! 'syntax-error'
25+ ! exit
26+ ~zod/try=> (scan "aaaaa" (star (just 'a')))
27+ "aaaaa"
28+ ~zod/try=> (scan "abcdef" (star (just 'a')))
29+ ! {1 2}
30+ ! 'syntax-error'
31+ ! exit
32+ ~zod/try=> (scan "abcabc" (star (jest 'abc')))
33+ <|abc abc|>
34+ ~zod/try=> (scan "john smith" (star (shim 0 200)))
35+ "john smith"
36+
37+
docs/system/hoon/library/src/4f/gate/stet.mdnew file+50
@@ -0,0 +1,50 @@
1+### `++stet`
2+
3+Add faces
4+
5+Add faces `[p q]` to range-parser pairs in a list.
6+
7+Accepts
8+-------
9+
10+`leh` is a list of range-parsers.
11+
12+Produces
13+--------
14+
15+
16+
17+Source
18+------
19+
20+ ++ stet
21+ |* leh=(list ,[?(@ [@ @]) _rule])
22+ |-
23+ ?~ leh
24+ ~
25+ [i=[p=-.i.leh q=+.i.leh] t=$(leh t.leh)]
26+ ::
27+
28+Examples
29+--------
30+
31+ ~zod/try=> (stet (limo [[5 (just 'a')] [1 (jest 'abc')] [[1 1] (shim 0 200)]
32+ [[1 10] (cold %foo (just 'a'))]~]))
33+ ~[
34+ [p=5 q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
35+ [p=1 q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
36+ [p=[1 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
37+ [p=[1 10] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
38+ ]
39+ ~zod/try=> [[[1 1] (just 'a')] [[2 1] (shim 0 200)] ~]
40+ [ [[1 1] <1.tnv [tub=[p=[p=@ud q=@ud] q=""] <1.ktu [daf=@tD <414.fvk 101.jzo 1.ypj %164>]>]>]
41+ [[2 1] <1.fvg [tub=[p=[p=@ud q=@ud] q=""] <1.khu [[les=@ mos=@] <414.fvk 101.jzo 1.ypj %164>]>]>]
42+ ~
43+ ]
44+ ~zod/try=> (stet (limo [[[1 1] (just 'a')] [[2 1] (shim 0 200)] ~]))
45+ ~[
46+ [p=[1 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
47+ [p=[2 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
48+ ]
49+
50+
docs/system/hoon/library/src/4f/gate/stew.mdnew file+54
@@ -0,0 +1,54 @@
1+### `++stew`
2+
3+Switch by first
4+
5+ ++ stew :: switch by first char
6+ ~/ %stew
7+ |* leh=(list ,[p=?(@ [@ @]) q=_rule]) :: char/range keys
8+ =+ ^= wor :: range complete lth
9+ |= [ort=?(@ [@ @]) wan=?(@ [@ @])]
10+ ?@ ort
11+ ?@(wan (lth ort wan) (lth ort -.wan))
12+ ?@(wan (lth +.ort wan) (lth +.ort -.wan))
13+ =+ ^= hel :: build parser map
14+ =+ hel=`(tree $_(?>(?=(^ leh) i.leh)))`~
15+ |- ^+ hel
16+ ?~ leh
17+ ~
18+ =+ yal=$(leh t.leh)
19+ |- ^+ hel
20+ ?~ yal
21+ [i.leh ~ ~]
22+ ?: (wor p.i.leh p.n.yal)
23+ =+ nuc=$(yal l.yal)
24+ ?> ?=(^ nuc)
25+ ?: (vor p.n.yal p.n.nuc)
26+ [n.yal nuc r.yal]
27+ [n.nuc l.nuc [n.yal r.nuc r.yal]]
28+ =+ nuc=$(yal r.yal)
29+ ?> ?=(^ nuc)
30+ ?: (vor p.n.yal p.n.nuc)
31+ [n.yal l.yal nuc]
32+ [n.nuc [n.yal l.yal l.nuc] r.nuc]
33+ ~% %fun ..^$ ~
34+ |= tub=nail
35+ ?~ q.tub
36+ (fail tub)
37+ |-
38+ ?~ hel
39+ (fail tub)
40+ ?: ?@ p.n.hel
41+ =(p.n.hel i.q.tub)
42+ ?&((gte i.q.tub -.p.n.hel) (lte i.q.tub +.p.n.hel))
43+ :: (q.n.hel [(lust i.q.tub p.tub) t.q.tub])
44+ (q.n.hel tub)
45+ ?: (wor i.q.tub p.n.hel)
46+ $(hel l.hel)
47+ $(hel r.hel)
48+ ::
49+
50+Parser generator. From an associative [`++list`]() of characters or character
51+ranges to [`++rule`]()s, construct a [`++map`](), and parse [`++tape`]()s only
52+with `++rules` associated with a range that the `++tape`'s first character falls in.
53+
54+
docs/system/hoon/library/src/4f/gate/stir.mdnew file+47
@@ -0,0 +1,47 @@
1+### `++stir`
2+
3+Parse repeatedly
4+
5+Parse with [`++rule`]() as many times as possible, and fold over results with a
6+binary gate.
7+
8+Accepts
9+-------
10+
11+`rud` is a noun.
12+
13+`raq` is a gate that takes two nouns and produces a cell.
14+
15+`fel` is a rule.
16+
17+Produces
18+--------
19+
20+A rule.
21+
22+Source
23+------
24+
25+++ stir :: parse repeatedly
26+ ~/ %stir
27+ |* [rud=* raq=_|*([a=* b=*] [a b]) fel=_rule]
28+ ~/ %fun
29+ |= tub=nail
30+ ^- (like ,_rud)
31+ =+ vex=(fel tub)
32+ ?~ q.vex
33+ [p.vex [~ rud tub]]
34+ =+ wag=$(tub q.u.q.vex)
35+ ?> ?=(^ q.wag)
36+ [(last p.vex p.wag) [~ (raq p.u.q.vex p.u.q.wag) q.u.q.wag]]
37+ ::
38+
39+Examples
40+--------
41+
42+ ~zod/try=> (scan "abc" (stir *@ add prn))
43+ 294
44+ ~zod/try=> (roll "abc" add)
45+ b=294
46+
47+
docs/system/hoon/library/src/4f/gate/stun.mdnew file+50
@@ -0,0 +1,50 @@
1+### `++stun`
2+
3+Parse several times
4+
5+Parse bounded number of times.
6+
7+Accepts
8+-------
9+
10+`[les=@ mos=@]` is a cell of atoms indicating the bounds.
11+
12+`fel` is a [`++rule`]().
13+
14+Produces
15+--------
16+
17+A [`++rule`]().
18+
19+Source
20+------
21+
22+ ++ stun :: parse several times
23+ |* [[les=@ mos=@] fel=_rule]
24+ |= tub=nail
25+ ^- (like (list ,_(wonk (fel))))
26+ ?: =(0 mos)
27+ [p.tub [~ ~ tub]]
28+ =+ vex=(fel tub)
29+ ?~ q.vex
30+ ?: =(0 les)
31+ [p.vex [~ ~ tub]]
32+ vex
33+ =+ ^= wag %= $
34+ les ?:(=(0 les) 0 (dec les))
35+ mos ?:(=(0 mos) 0 (dec mos))
36+ tub q.u.q.vex
37+ ==
38+ ?~ q.wag
39+ wag
40+ [p.wag [~ [p.u.q.vex p.u.q.wag] q.u.q.wag]]
41+
42+Examples
43+--------
44+
45+ ~zod/try=> ((stun [5 10] prn) [1 1] "aquickbrownfoxran")
46+ [p=[p=1 q=11] q=[~ [p="aquickbrow" q=[p=[p=1 q=11] q="nfoxran"]]]]
47+ ~zod/try=> ((stun [5 10] prn) [1 1] "aquickbro")
48+ [p=[p=1 q=10] q=[~ [p="aquickbro" q=[p=[p=1 q=10] q=""]]]]
49+ ~zod/try=> ((stun [5 10] prn) [1 1] "aqui")
50+ [p=[p=1 q=5] q=~]
docs/system/hoon/library/src/4g/gate/rash.mdnew file+41
@@ -0,0 +1,41 @@
1+### `++rash`
2+
3+Parse or crash
4+
5+Parse a cord with a given [`++rule`]() and crash if the [`++cord`]() isn't entirely
6+parsed.
7+
8+Accepts
9+-------
10+
11+`naf` is an atom.
12+
13+`sab` is a `++rule`.
14+
15+Produces
16+--------
17+
18+The value of the parse result, or crash.
19+
20+Source
21+------
22+
23+ ++ rash |*([naf=@ sab=_rule] (scan (trip naf) sab)) ::
24+
25+Examples
26+--------
27+
28+ ~zod/try=> (rash 'I was the world in which I walked, and what I saw' (star (shim 0 200)))
29+ "I was the world in which I walked, and what I saw"
30+ ~zod/try=> (rash 'abc' (just 'a'))
31+ ! {1 2}
32+ ! 'syntax-error'
33+ ! exit
34+ ~zod/try=> (rash 'abc' (jest 'abc'))
35+ 'abc'
36+ `~zod/try=> (rash 'abc' (jest 'ab'))
37+ ! {1 3}
38+ ! 'syntax-error'
39+ ! exit
40+
41+
docs/system/hoon/library/src/4g/gate/rush.mdnew file+39
@@ -0,0 +1,39 @@
1+### `++rush`
2+
3+Parse or null
4+
5+Parse a given with a given rule and produce null if the cord isn't
6+entirely parsed.
7+
8+Accepts
9+-------
10+
11+`naf` is an [atom]().
12+
13+`sab` is a [rule]().
14+
15+Produces
16+--------
17+
18+The value of the parse result, or null.
19+
20+Source
21+------
22+
23+ ++ rush |*([naf=@ sab=_rule] (rust (trip naf) sab))
24+
25+Examples
26+--------
27+
28+ ~zod/try=> (rush 'I was the world in which I walked, and what I saw' (star (shim 0 200)))
29+ [~ "I was the world in which I walked, and what I saw"]
30+ ~zod/try=> (rush 'abc' (just 'a'))
31+ ~
32+ ~zod/try=> (rush 'abc' (jest 'abc'))
33+ [~ 'abc']
34+ ~zod/try=> (rush 'abc' (jest 'ac'))
35+ ~
36+ ~zod/try=> (rush 'abc' (jest 'ab'))
37+ ~
38+
39+
docs/system/hoon/library/src/4g/gate/rust.mdnew file+37
@@ -0,0 +1,37 @@
1+### `++rust`
2+
3+Parse tape or null
4+
5+Parse a [`++tape`]() with a given [`++rule`]() and produce null if the `++tape` isn't
6+entirely parsed.
7+
8+Accepts
9+-------
10+
11+`los` is a `++tape`.
12+
13+`sab` is a `++rule`.
14+
15+Produces
16+--------
17+
18+A `(unit ,@t)`
19+
20+Source
21+------
22+
23+ ++ rust |* [los=tape sab=_rule]
24+ =+ vex=((full sab) [[1 1] los])
25+ ?~(q.vex ~ [~ u=p.u.q.vex])
26+
27+Examples
28+--------
29+
30+ ~zod/try=> (rust "I was the world in which I walked, and what I saw" (star (shim 0 200)))
31+ [~ "I was the world in which I walked, and what I saw"]
32+ ~zod/try=> (rust "Or heard or felt came not but from myself;" (star (shim 0 200)))
33+ [~ "Or heard or felt came not but from myself;"]
34+ ~zod/try=> (rust "And there I found myself more truly and more strange." (jest 'And there I'))
35+ ~
36+
37+
docs/system/hoon/library/src/4g/gate/scan.mdnew file+41
@@ -0,0 +1,41 @@
1+### `++scan`
2+
3+Parse tape or crash
4+
5+Parse a [`++tape`]() with a given [`++rule`]() and crash if the `++tape` isn't entirely
6+parsed.
7+
8+Accepts
9+-------
10+
11+`los` is a [tape]().
12+
13+`sab` is a [rule]().
14+
15+Produces
16+--------
17+
18+Either a `++tape` or a crash.
19+
20+Source
21+------
22+
23+ ++ scan |* [los=tape sab=_rule]
24+ =+ vex=((full sab) [[1 1] los])
25+ ?~ q.vex
26+ ~_ (show [%m '{%d %d}'] p.p.vex q.p.vex ~)
27+ ~|('syntax-error' !!)
28+ p.u.q.vex
29+
30+Examples
31+--------
32+
33+ ~zod/try=> (scan "I was the world in which I walked, and what I saw" (star (shim 0 200)))
34+ "I was the world in which I walked, and what I saw"
35+ ~zod/try=> (scan "Or heard or felt came not but from myself;" (star (shim 0 200)))
36+ "Or heard or felt came not but from myself;"
37+ ~zod/try=> (scan "And there I found myself more truly and more strange." (jest 'And there I'))
38+ ! {1 12}
39+ ! 'syntax-error'
40+ ! exit
41+
docs/system/hoon/library/src/4h/gate/ace.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++ace`
2+
3+Parse space
4+
5+Parses ASCII character 32, space.
6+
7+Source
8+------
9+
10+ ++ ace (just ' ')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan " " ace)
16+ ~~.
17+ ~zod/try=> `cord`(scan " " ace)
18+ ' '
19+ ~zod/try=> (ace [[1 1] " "])
20+ [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (ace [[1 1] " abc "])
22+ [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q="abc "]]]]
23+
24+
docs/system/hoon/library/src/4h/gate/bar.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++bar`
2+
3+Parse vertical bar
4+
5+Parses ASCII character 124, the vertical bar.
6+
7+Source
8+------
9+
10+ ++ bar (just '|')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "|" bar)
16+ ~~~7c.
17+ ~zod/try=> `cord`(scan "|" bar)
18+ '|'
19+ ~zod/try=> (bar [[1 1] "|"])
20+ [p=[p=1 q=2] q=[~ [p=~~~7c. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (bar [[1 1] "|="])
22+ [p=[p=1 q=2] q=[~ [p=~~~7c. q=[p=[p=1 q=2] q="="]]]]
23+
24+
docs/system/hoon/library/src/4h/gate/bas.mdnew file+28
@@ -0,0 +1,28 @@
1+### `++bas`
2+
3+Parse backslash
4+
5+Parses ASCII character 92, the backslash. Note the extra `\` in the calling of
6+`bas` with [`++just`](/doc/hoon/library/2ec#++just) is to escape the escape
7+character, `\`.
8+
9+Source
10+------
11+
12+ ++ bas (just '\\')
13+
14+Examples
15+--------
16+
17+ ~zod/try=> (scan "\\" bas)
18+ ~~~5c.
19+ ~zod/try=> `cord`(scan "\\" bas)
20+ '\'
21+ ~zod/try=> (bas [[1 1] "\"])
22+ ~ <syntax error at [1 18]>
23+ ~zod/try=> (bas [[1 1] "\\"])
24+ [p=[p=1 q=2] q=[~ [p=~~~5c. q=[p=[p=1 q=2] q=""]]]]
25+ ~zod/try=> (bas [[1 1] "\""])
26+ [p=[p=1 q=1] q=~]
27+
28+
docs/system/hoon/library/src/4h/gate/buc.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++buc`
2+
3+Parse dollar sign
4+
5+Parses ASCII character 36, the dollar sign.
6+
7+Source
8+------
9+
10+ ++ buc (just '$')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "$" buc)
16+ ~~~24.
17+ ~zod/try=> `cord`(scan "$" buc)
18+ '$'
19+ ~zod/try=> (buc [[1 1] "$"])
20+ [p=[p=1 q=2] q=[~ [p=~~~24. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (buc [[1 1] "$%"])
22+ [p=[p=1 q=2] q=[~ [p=~~~24. q=[p=[p=1 q=2] q="%"]]]]
23+
24+
docs/system/hoon/library/src/4h/gate/cab.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++cab`
2+
3+Parse underscore
4+
5+Parses ASCII character 95, the underscore.
6+
7+Source
8+------
9+
10+ ++ cab (just '_')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "_" cab)
16+ ~~~5f.
17+ ~zod/try=> `cord`(scan "_" cab)
18+ '_'
19+ ~zod/try=> (cab [[1 1] "_"])
20+ [p=[p=1 q=2] q=[~ [p=~~~5f. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (cab [[1 1] "|_"])
22+ [p=[p=1 q=1] q=~]
23+
24+
docs/system/hoon/library/src/4h/gate/cen.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++cen`
2+
3+Parses percent sign
4+
5+Parses ASCII character 37, the percent sign.
6+
7+Source
8+------
9+
10+ ++ cen (just '%')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "%" cen)
16+ ~~~25.
17+ ~zod/try=> `cord`(scan "%" cen)
18+ '%'
19+ ~zod/try=> (cen [[1 1] "%"])
20+ [p=[p=1 q=2] q=[~ [p=~~~25. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (cen [[1 1] "%^"])
22+ [p=[p=1 q=2] q=[~ [p=~~~25. q=[p=[p=1 q=2] q="^"]]]]
23+
24+
docs/system/hoon/library/src/4h/gate/col.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++col`
2+
3+Parse colon
4+
5+Parses ASCII character 58, the colon
6+
7+Source
8+------
9+
10+ ++ col (just ':')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan ":" col)
16+ ~~~3a.
17+ ~zod/try=> `cord`(scan ":" col)
18+ ':'
19+ ~zod/try=> (col [[1 1] ":"])
20+ [p=[p=1 q=2] q=[~ [p=~~~3a. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (col [[1 1] ":-"])
22+ [p=[p=1 q=2] q=[~ [p=~~~3a. q=[p=[p=1 q=2] q="-"]]]]
23+
24+
docs/system/hoon/library/src/4h/gate/com.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++com`
2+
3+Parse comma
4+
5+Parses ASCII character 44, the comma.
6+
7+Source
8+------
9+
10+ ++ com (just ',')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "," com)
16+ ~~~2c.
17+ ~zod/try=> `cord`(scan "," com)
18+ ','
19+ ~zod/try=> (com [[1 1] ","])
20+ [p=[p=1 q=2] q=[~ [p=~~~2c. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (com [[1 1] "not com"])
22+ [p=[p=1 q=1] q=~]
23+
24+
docs/system/hoon/library/src/4h/gate/doq.mdnew file+28
@@ -0,0 +1,28 @@
1+### `++doq`
2+
3+Parse double quote
4+
5+Parses ASCII character 34, the double quote.
6+
7+Source
8+------
9+
10+ ++ doq (just '"')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "\"" doq)
16+ ~~~22.
17+ ~zod/try=> `cord`(scan "\"" doq)
18+ '"'
19+ ~zod/try=> (doq [[1 1] "\""])
20+ [p=[p=1 q=2] q=[~ [p=~~~22. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (doq [[1 1] "not successfully parsed"])
22+ [p=[p=1 q=1] q=~]
23+ ~zod/try=> (scan "see?" doq)
24+ ! {1 1}
25+ ! 'syntax-error'
26+ ! exit
27+
28+
docs/system/hoon/library/src/4h/gate/dot.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++dot`
2+
3+Parse period
4+
5+Parses ASCII character 46, the period.
6+
7+Source
8+------
9+
10+ ++ dot (just '.')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "." dot)
16+ ~~~.
17+ ~zod/try=> `cord`(scan "." dot)
18+ '.'
19+ ~zod/try=> (dot [[1 1] "."])
20+ [p=[p=1 q=2] q=[~ [p=~~~. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (dot [[1 1] ".^"])
22+ [p=[p=1 q=2] q=[~ [p=~~~. q=[p=[p=1 q=2] q="^"]]]]
23+
24+
docs/system/hoon/library/src/4h/gate/fas.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++fas`
2+
3+Parse forward slash
4+
5+Parses ASCII character 47, the forward slash.
6+
7+Source
8+------
9+
10+ ++ fas (just '/')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "/" fas)
16+ ~~~2f.
17+ ~zod/try=> `cord`(scan "/" fas)
18+ '/'
19+ ~zod/try=> (fas [[1 1] "/"])
20+ [p=[p=1 q=2] q=[~ [p=~~~2f. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (fas [[1 1] "|/"])
22+ [p=[p=1 q=1] q=~]
23+
24+
docs/system/hoon/library/src/4h/gate/gal.mdnew file+26
@@ -0,0 +1,26 @@
1+### `++gal`
2+
3+Parse less-than sign
4+
5+Parses ASCII character 60, the less-than sign.
6+
7+Source
8+------
9+
10+ ++ gal (just '<')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "<" gal)
16+ ~~~3c.
17+ ~zod/try=> `cord`(scan "<" gal)
18+ '<'
19+ ~zod/try=> (gal [[1 1] "<"])
20+ [p=[p=1 q=2] q=[~ [p=~~~3c. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (gal [[1 1] "<+"])
22+ [p=[p=1 q=2] q=[~ [p=~~~3c. q=[p=[p=1 q=2] q="+"]]]]
23+ ~zod/try=> (gal [[1 1] "+<"])
24+ [p=[p=1 q=1] q=~]
25+
26+
docs/system/hoon/library/src/4h/gate/gar.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++gar`
2+
3+Parse greater-than sign
4+
5+Parses ASCII character 62, the greater-than sign.
6+
7+Source
8+------
9+
10+ ++ gar (just '>')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan ">" gar)
16+ ~~~3e.
17+ ~zod/try=> `cord`(scan ">" gar)
18+ '>'
19+ ~zod/try=> (gar [[1 1] ">"])
20+ [p=[p=1 q=2] q=[~ [p=~~~3e. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (gar [[1 1] "=>"])
22+ [p=[p=1 q=1] q=~]
23+
24+
docs/system/hoon/library/src/4h/gate/hax.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++hax`
2+
3+Parse number sign
4+
5+Parses ASCII character 35, the number sign.
6+
7+Source
8+------
9+
10+ ++ hax (just '#')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "#" hax)
16+ ~~~23.
17+ ~zod/try=> `cord`(scan "#" hax)
18+ '#'
19+ ~zod/try=> (hax [[1 1] "#"])
20+ [p=[p=1 q=2] q=[~ [p=~~~23. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (hax [[1 1] "#!"])
22+ [p=[p=1 q=2] q=[~ [p=~~~23. q=[p=[p=1 q=2] q="!"]]]]
23+
24+
docs/system/hoon/library/src/4h/gate/hep.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++hep`
2+
3+Parse hyphen
4+
5+Parses ASCII character 45, the hyphen.
6+
7+Source
8+------
9+
10+ ++ hep (just '-')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "-" hep)
16+ ~~-
17+ ~zod/try=> `cord`(scan "-" hep)
18+ '-'
19+ ~zod/try=> (hep [[1 1] "-"])
20+ [p=[p=1 q=2] q=[~ [p=~~- q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (hep [[1 1] ":-"])
22+ [p=[p=1 q=1] q=~]
23+
24+
docs/system/hoon/library/src/4h/gate/kel.mdnew file+26
@@ -0,0 +1,26 @@
1+### `++kel`
2+
3+Parse left curley bracket
4+
5+Parses ASCII character 123, the left curly bracket. Note that `{`
6+(`kel`) and `}` (`ker`) open and close a Hoon expression for Hoon string
7+interpolation. To parse either of them, they must be escaped.
8+
9+Source
10+------
11+
12+ ++ kel (just '{')
13+
14+Examples
15+--------
16+
17+ ~zod/try=> (scan "\{" kel)
18+ ~~~7b.
19+ ~zod/try=> `cord`(scan "\{" kel)
20+ '{'
21+ ~zod/try=> (kel [[1 1] "\{"])
22+ [p=[p=1 q=2] q=[~ [p=~~~7b. q=[p=[p=1 q=2] q=""]]]]
23+ ~zod/try=> (kel [[1 1] " \{"])
24+ [p=[p=1 q=1] q=~]
25+
26+
docs/system/hoon/library/src/4h/gate/ker.mdnew file+26
@@ -0,0 +1,26 @@
1+### `++ker`
2+
3+Parse right curley bracket
4+
5+Parses ASCII character 125, the right curly bracket. Note that `{`
6+(`kel`) and `}` (`ker`) open and close a Hoon expression for Hoon string
7+interpolation. To parse either of them, they must be escaped.
8+
9+Source
10+------
11+
12+ ++ ker (just '}')
13+
14+Examples
15+--------
16+
17+ ~zod/try=> (scan "}" ker)
18+ ~~~7d.
19+ ~zod/try=> `cord`(scan "}" ker)
20+ '}'
21+ ~zod/try=> (ker [[1 1] "}"])
22+ [p=[p=1 q=2] q=[~ [p=~~~7d. q=[p=[p=1 q=2] q=""]]]]
23+ ~zod/try=> (ker [[1 1] "\{}"])
24+ [p=[p=1 q=1] q=~]
25+
26+
docs/system/hoon/library/src/4h/gate/ket.mdnew file+23
@@ -0,0 +1,23 @@
1+### `++ket`
2+
3+Parse caret
4+
5+Parses ASCII character 94, the caret.
6+
7+Source
8+------
9+
10+ ++ ket (just '^')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "^" ket)
16+ ~~~5e.
17+ ~zod/try=> `cord`(scan "^" ket)
18+ '^'
19+ ~zod/try=> (ket [[1 1] "^"])
20+ [p=[p=1 q=2] q=[~ [p=~~~5e. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (ket [[1 1] ".^"])
22+ [p=[p=1 q=1] q=~]
23+
docs/system/hoon/library/src/4h/gate/lus.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++lus`
2+
3+Parse plus sign
4+
5+Parses ASCII character 43, the plus sign.
6+
7+Source
8+------
9+
10+ ++ lus (just '+')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "+" lus)
16+ ~~~2b.
17+ ~zod/try=> `cord`(scan "+" lus)
18+ '+'
19+ ~zod/try=> (lus [[1 1] "+"])
20+ [p=[p=1 q=2] q=[~ [p=~~~2b. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (lus [[1 1] ".+"])
22+ [p=[p=1 q=1] q=~]
23+
24+
docs/system/hoon/library/src/4h/gate/pam.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++pam`
2+
3+Parse ampersand
4+
5+Parses ASCII character 38, the ampersand.
6+
7+Source
8+------
9+
10+ ++ pam (just '&')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "&" pam)
16+ ~~~26.
17+ ~zod/try=> `cord`(scan "&" pam)
18+ '&'
19+ ~zod/try=> (pam [[1 1] "&"])
20+ [p=[p=1 q=2] q=[~ [p=~~~26. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (pam [[1 1] "?&"])
22+ [p=[p=1 q=1] q=~]
23+
24+
docs/system/hoon/library/src/4h/gate/pat.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++pat`
2+
3+Parse "at" sign
4+
5+Parses ASCII character 64, the "at" sign.
6+
7+Source
8+------
9+
10+ ++ pat (just '@')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "@" pat)
16+ ~~~4.
17+ ~zod/try=> `cord`(scan "@" pat)
18+ '@'
19+ ~zod/try=> (pat [[1 1] "@"])
20+ [p=[p=1 q=2] q=[~ [p=~~~4. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (pat [[1 1] "?@"])
22+ [p=[p=1 q=1] q=~]
23+
24+
docs/system/hoon/library/src/4h/gate/pel.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++pel`
2+
3+Parse left parenthesis
4+
5+Parses ASCII character 40, the left parenthesis.
6+
7+Source
8+------
9+
10+ ++ pel (just '(')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "(" pel)
16+ ~~~28.
17+ ~zod/try=> `cord`(scan "(" pel)
18+ '('
19+ ~zod/try=> (pel [[1 1] "("])
20+ [p=[p=1 q=2] q=[~ [p=~~~28. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (pel [[1 1] ";("])
22+ [p=[p=1 q=1] q=~]
23+
24+
docs/system/hoon/library/src/4h/gate/per.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++per`
2+
3+Parse right parenthesis
4+
5+Parses ASCII character 41, the right parenthesis.
6+
7+Source
8+------
9+
10+ ++ per (just ')')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan ")" per)
16+ ~~~29.
17+ ~zod/try=> `cord`(scan ")" per)
18+ ')'
19+ ~zod/try=> (per [[1 1] ")"])
20+ [p=[p=1 q=2] q=[~ [p=~~~29. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (per [[1 1] " )"])
22+ [p=[p=1 q=1] q=~]
23+
24+
docs/system/hoon/library/src/4h/gate/sel.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++sel`
2+
3+Parse left square bracket
4+
5+Parses ASCII character 91, the left square bracket.
6+
7+Source
8+------
9+
10+ ++ sel (just '[')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "[" sel)
16+ ~~~5b.
17+ ~zod/try=> `cord`(scan "[" sel)
18+ '['
19+ ~zod/try=> (sel [[1 1] "["])
20+ [p=[p=1 q=2] q=[~ [p=~~~5b. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (sel [[1 1] "-["])
22+ [p=[p=1 q=1] q=~]
23+
24+
docs/system/hoon/library/src/4h/gate/sem.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++sem`
2+
3+Parse semicolon
4+
5+Parses ASCII character 59, the semicolon.
6+
7+Source
8+------
9+
10+ ++ sem (just ';')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan ";" sem)
16+ ~~~3b.
17+ ~zod/try=> `cord`(scan ";" sem)
18+ ';'
19+ ~zod/try=> (sem [[1 1] ";"])
20+ [p=[p=1 q=2] q=[~ [p=~~~3b. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (sem [[1 1] " ;"])
22+ [p=[p=1 q=1] q=~]
23+
24+
docs/system/hoon/library/src/4h/gate/ser.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++ser`
2+
3+Parse right square bracket
4+
5+Parses ASCII character 93, the right square bracket.
6+
7+Source
8+------
9+
10+ ++ ser (just ']')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "]" ser)
16+ ~~~5d.
17+ ~zod/try=> `cord`(scan "]" ser)
18+ ']'
19+ ~zod/try=> (ser [[1 1] "]"])
20+ [p=[p=1 q=2] q=[~ [p=~~~5d. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (ser [[1 1] "[ ]"])
22+ [p=[p=1 q=1] q=~]
23+
24+
docs/system/hoon/library/src/4h/gate/sig.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++sig`
2+
3+Parse tilde
4+
5+Parses ASCII character 126, the tilde.
6+
7+Source
8+------
9+
10+ ++ sig (just '~')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "~" sig)
16+ ~~~~
17+ ~zod/try=> `cord`(scan "~" sig)
18+ '~'
19+ ~zod/try=> (sig [[1 1] "~"])
20+ [p=[p=1 q=2] q=[~ [p=~~~~ q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (sig [[1 1] "?~"])
22+ [p=[p=1 q=1] q=~]
23+
24+
docs/system/hoon/library/src/4h/gate/soq.mdnew file+25
@@ -0,0 +1,25 @@
1+### `++soq`
2+
3+Parse single quote
4+
5+Parses ASCII character 39, soq. Note the extra '' is to escape the first
6+`soq` because soq delimits a [`++cord`]().
7+
8+Source
9+------
10+
11+ ++ soq (just '\'')
12+
13+Examples
14+--------
15+
16+ ~zod/try=> (scan "'" soq)
17+ ~~~27.
18+ ~zod/try=> `cord`(scan "'" soq)
19+ '''
20+ ~zod/try=> (soq [[1 1] "'"])
21+ [p=[p=1 q=2] q=[~ [p=~~~27. q=[p=[p=1 q=2] q=""]]]]
22+ ~zod/try=> (soq [[1 1] ">'"])
23+ [p=[p=1 q=1] q=~]
24+
25+
docs/system/hoon/library/src/4h/gate/tar.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++tar`
2+
3+Parse asterisk
4+
5+Parses ASCII character 42, the asterisk.
6+
7+Source
8+------
9+
10+ ++ tar (just '*')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "*" tar)
16+ ~~~2a.
17+ ~zod/try=> `cord`(scan "*" tar)
18+ '*'
19+ ~zod/try=> (tar [[1 1] "*"])
20+ [p=[p=1 q=2] q=[~ [p=~~~2a. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (tar [[1 1] ".*"])
22+ [p=[p=1 q=1] q=~]
23+
24+
docs/system/hoon/library/src/4h/gate/tec.mdnew file+25
@@ -0,0 +1,25 @@
1+### `++tec`
2+
3+Parse backtick
4+
5+Parses ASCII character 96, the backtick (also known as the "grave
6+accent").
7+
8+Source
9+------
10+
11+ ++ tec (just '`') :: backTiCk
12+
13+Examples
14+--------
15+
16+ ~zod/try=> (scan "`" tec)
17+ ~~~6.
18+ ~zod/try=> `cord`(scan "`" tec)
19+ '`'
20+ ~zod/try=> (tec [[1 1] "`"])
21+ [p=[p=1 q=2] q=[~ [p=~~~6. q=[p=[p=1 q=2] q=""]]]]
22+ ~zod/try=> (tec [[1 1] " `"])
23+ [p=[p=1 q=1] q=~]
24+
25+
docs/system/hoon/library/src/4h/gate/tis.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++tis`
2+
3+Parse equals sign
4+
5+Parses ASCII character 61, the equals sign.
6+
7+Source
8+------
9+
10+ ++ tis (just '=')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "=" tis)
16+ ~~~3d.
17+ ~zod/try=> `cord`(scan "=" tis)
18+ '='
19+ ~zod/try=> (tis [[1 1] "="])
20+ [p=[p=1 q=2] q=[~ [p=~~~3d. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (tis [[1 1] "|="])
22+ [p=[p=1 q=1] q=~]
23+
24+
docs/system/hoon/library/src/4h/gate/wut.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++wut`
2+
3+Parses question mark
4+
5+Parses ASCII character 63, the question mark.
6+
7+Source
8+------
9+
10+ ++ wut (just '?')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "?" wut)
16+ ~~~3f.
17+ ~zod/try=> `cord`(scan "?" wut)
18+ '?'
19+ ~zod/try=> (wut [[1 1] "?"])
20+ [p=[p=1 q=2] q=[~ [p=~~~3f. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (wut [[1 1] ".?"])
22+ [p=[p=1 q=1] q=~]
23+
24+
docs/system/hoon/library/src/4h/gate/zap.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++zap`
2+
3+Exclamation point
4+
5+Parses ASCII character 33, the exclamation point zap.
6+
7+Source
8+------
9+
10+ ++ zap (just '!')
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "!" zap)
16+ ~~~21.
17+ ~zod/try=> `cord`(scan "!" zap)
18+ '!'
19+ ~zod/try=> (zap [[1 1] "!"])
20+ [p=[p=1 q=2] q=[~ [p=~~~21. q=[p=[p=1 q=2] q=""]]]]
21+ ~zod/try=> (zap [[1 1] "?!"])
22+ [p=[p=1 q=1] q=~]
23+
24+
docs/system/hoon/library/src/4j/core/ab.mdnew file+1365
@@ -0,0 +1,1365 @@
1+### `++ab`
2+
3+Primitive parser engine
4+
5+A core containing numeric parser primitives.
6+
7+Source
8+------
9+
10+ ++ ab
11+ |%
12+
13+Examples
14+--------
15+
16+ ~zod/try=> ab
17+ <36.ecc 414.gly 100.xkc 1.ypj %164>
18+
19+------------------------------------------------------------------------
20+
21+### `++bix`
22+
23+Parse hex pair
24+
25+Parsing [`++rule`](). Parses a pair of base-16 digits. Used in escapes.
26+
27+Accepts
28+-------
29+
30+XX
31+
32+Produces
33+--------
34+
35+A an atom. XX
36+
37+Source
38+------
39+
40+ ++ bix (bass 16 (stun [2 2] six))
41+
42+Examples
43+--------
44+
45+ ~zod/try=> (scan "07" bix:ab)
46+ q=7
47+ ~zod/try=> (scan "51" bix:ab)
48+ q=81
49+ ~zod/try=> (scan "a3" bix:ab)
50+ q=163
51+
52+------------------------------------------------------------------------
53+
54+### `++hif`
55+
56+Parse phonetic pair
57+
58+Parsing [`++rule`](). Parses an atom of [odor]() [`@pE`](), a phrase of two bytes
59+encoded phonetically.
60+
61+Accepts
62+-------
63+
64+XX
65+
66+Produces
67+--------
68+
69+An atom.
70+
71+Source
72+------
73+
74+ ++ hif (boss 256 ;~(plug tip tiq (easy ~)))
75+
76+Examples
77+--------
78+
79+ ~zod/try=> (scan "doznec" hif:ab)
80+ q=256
81+ ~zod/try=> (scan "pittyp" hif:ab)
82+ q=48.626
83+
84+------------------------------------------------------------------------
85+
86+### `++huf`
87+
88+Parse two phonetic pairs
89+
90+Parsing [`++rule`](). Parses and unscrambles an atom of odor [@pF](), a phrase
91+of two two-byte pairs that are encoded (and scrambled) phonetically.
92+
93+Accepts
94+-------
95+
96+XX
97+
98+Produces
99+--------
100+
101+An atom. XX
102+
103+Source
104+------
105+
106+ ++ huf %+ cook
107+ |=([a=@ b=@] (wred:un ~(zug mu ~(zag mu [a b]))))
108+ ;~(plug hif ;~(pfix hep hif))
109+
110+Examples
111+--------
112+
113+ ~zod/try=> (scan "pittyp-pittyp" huf:ab)
114+ 328.203.557
115+ ~zod/try=> (scan "tasfyn-partyv" huf:ab)
116+ 65.792
117+ ~zod/try=> `@ux`(scan "tasfyn-partyv" huf:ab)
118+ 0x1.0100
119+
120+------------------------------------------------------------------------
121+
122+### `++hyf`
123+
124+Parse 8 phonetic bytes
125+
126+Parsing [`++rule`](). Parses an atom of odor [@pG](), a phrase of eight of
127+phonetic bytes.
128+
129+Accepts
130+-------
131+
132+An atom of odor [`@pG`]()
133+
134+Produces
135+--------
136+
137+An atom. XX
138+
139+Source
140+------
141+
142+ ++ hyf (bass 0x1.0000.0000 ;~(plug huf ;~(pfix hep huf) (easy ~)))
143+
144+Examples
145+--------
146+
147+ ~zod/try=> (scan "sondel-forsut-tillyn-nillyt" hyf:ab)
148+ q=365.637.097.828.335.095
149+ ~zod/try=> `@u`~sondel-forsut-tillyn-nillyt
150+ 365.637.097.828.335.095
151+
152+------------------------------------------------------------------------
153+
154+### `++pev`
155+
156+Parse \<= 5 base-32
157+
158+Parsing [`++rule`](). Parses up to five base-32 digits without a leading zero.
159+
160+Accepts
161+-------
162+
163+Up to five [@uv]() (base 64) digits.
164+
165+Produces
166+--------
167+
168+An atom.
169+
170+Source
171+------
172+
173+ ++ pev (bass 32 ;~(plug sev (stun [0 4] siv)))
174+
175+Examples
176+--------
177+
178+ ~zod/try=> (scan "a" pev:ab)
179+ q=10
180+ ~zod/try=> (scan "290j" pev:ab)
181+ q=74.771
182+ ~zod/try=> (scan "123456" pev:ab)
183+ ! {1 6}
184+ ! exit
185+ ~zod/try=> (scan "090j" pev:ab)
186+ ~ <syntax error at [1 11]>
187+
188+------------------------------------------------------------------------
189+
190+### `++pew`
191+
192+Parse \<= 5 base-64
193+
194+Parsing [`++rule`](). Parses up to five base-64 digits without a leading zero.
195+
196+Accepts
197+-------
198+
199+Up to five [@uw]() (base 64) digits.
200+
201+Produces
202+--------
203+
204+
205+
206+Source
207+------
208+
209+ ++ pew (bass 64 ;~(plug sew (stun [0 4] siw)))
210+
211+Examples
212+--------
213+
214+ ~zod/try=> (scan "Q" pew:ab)
215+ q=52
216+ ~zod/try=> (scan "aQ~9" pew:ab)
217+ q=2.838.473
218+ ~zod/try=> `@`0waQ~9
219+ 2.838.473
220+ ~zod/try=> (scan "123456" pew:ab)
221+ ! {1 6}
222+ ! exit
223+ ~zod/try=> (scan "012345" pew:ab)
224+ ! {1 1}
225+ ! exit
226+
227+------------------------------------------------------------------------
228+
229+### `++piv`
230+
231+Parse 5 base-32
232+
233+Parsing [`++rule`](). Parses exactly five base-32 digits.
234+
235+Accepts
236+-------
237+
238+Produces
239+--------
240+
241+Source
242+------
243+
244+ ++ piv (bass 32 (stun [5 5] siv))
245+
246+Examples
247+--------
248+
249+ ~zod/try=> (scan "10b3l" piv:ab)
250+ q=1.059.957
251+ ~zod/try=> (scan "1" piv:ab)
252+ ! {1 2}
253+ ! exit
254+
255+------------------------------------------------------------------------
256+
257+### `++piw`
258+
259+Parse 5 base-64
260+
261+Parsing [`++rule`](). Parses exactly five base-64 digits.
262+
263+Accepts
264+-------
265+
266+Produces
267+--------
268+
269+My name henry let's see how fast I can type.
270+
271+Source
272+------
273+
274+ ++ piw (bass 64 (stun [5 5] siw))
275+
276+Examples
277+--------
278+
279+ ~zod/try=> (scan "2C-pZ" piw:ab)
280+ q=43.771.517
281+ ~zod/try=> (scan "2" piv:ab)
282+ ! {1 2}
283+ ! exit
284+
285+------------------------------------------------------------------------
286+
287+### `++qeb`
288+
289+Parse \<= 4 binary
290+
291+Parsing [`++rule`](). Parses a binary number of up to 4 digits in length without
292+a leading zero.
293+
294+Accepts
295+-------
296+
297+Produces
298+--------
299+
300+Source
301+------
302+
303+ ++ qeb (bass 2 ;~(plug seb (stun [0 3] sib)))
304+
305+Examples
306+--------
307+
308+ ~zod/try=> (scan "1" qeb:ab)
309+ q=1
310+ ~zod/try=> (scan "101" qeb:ab)
311+ q=5
312+ ~zod/try=> (scan "1111" qeb:ab)
313+ q=15
314+ ~zod/try=> (scan "11111" qeb:ab)
315+ ! {1 5}
316+ ! exit
317+ ~zod/try=> (scan "01" qeb:ab)
318+ ! {1 1}
319+ ! exit
320+
321+------------------------------------------------------------------------
322+
323+### `++qex`
324+
325+Parse \<= 4 hex
326+
327+Parsing [`++rule`](). Parses a hexadecimal number of up to 4 digits in length
328+without a leading zero.
329+
330+Accepts
331+-------
332+
333+Produces
334+--------
335+
336+Source
337+------
338+
339+ ++ qex (bass 16 ;~(plug sex (stun [0 3] hit)))
340+
341+Examples
342+--------
343+
344+ ~zod/try=> (scan "ca" qex:ab)
345+ q=202
346+ ~zod/try=> (scan "18ac" qex:ab)
347+ q=6.316
348+ ~zod/try=> (scan "18acc" qex:ab)
349+ ! {1 5}
350+ ! exit
351+ ~zod/try=> (scan "08ac" qex:ab)
352+ ! {1 1}
353+ ! exit
354+
355+------------------------------------------------------------------------
356+
357+### `++qib`
358+
359+Parse 4 binary
360+
361+Parsing [`++rule`](). Parses exactly four binary digits.
362+
363+Accepts
364+-------
365+
366+Produces
367+--------
368+
369+Source
370+------
371+
372+ ++ qib (bass 2 (stun [4 4] sib))
373+
374+Examples
375+--------
376+
377+ ~zod/try=> (scan "0001" qib:ab)
378+ q=1
379+ ~zod/try=> (scan "0100" qib:ab)
380+ q=4
381+ ~zod/try=> (scan "110" qib:ab)
382+ ! {1 4}
383+ ! exit
384+
385+------------------------------------------------------------------------
386+
387+### `++qix`
388+
389+Parse 4 hex
390+
391+Parsing [`++rule`](). Parses exactly four hexadecimal digits.
392+
393+Accepts
394+-------
395+
396+Produces
397+--------
398+
399+Source
400+------
401+
402+ ++ qix (bass 16 (stun [4 4] six))
403+
404+Examples
405+--------
406+
407+ ~zod/try=> (scan "0100" qix:ab)
408+ q=256
409+ ~zod/try=> (scan "10ff" qix:ab)
410+ q=4.351
411+ ~zod/try=> (scan "0" qix:ab)
412+ ! {1 2}
413+ ! exit
414+
415+------------------------------------------------------------------------
416+
417+### `++seb`
418+
419+Parse 1
420+
421+Parsing [`++rule`](). Parses the number 1.
422+
423+Accepts
424+-------
425+
426+Produces
427+--------
428+
429+Source
430+------
431+
432+ ++ seb (cold 1 (just '1'))
433+
434+Examples
435+--------
436+
437+ ~zod/try=> (scan "1" seb:ab)
438+ 1
439+ ~zod/try=> (scan "0" seb:ab)
440+ ! ~zod/try/~2014.10.23..22.34.21..bfdd/:<[1 1].[1 18]>
441+ ! {1 1}
442+ ~zod/try=> (scan "2" seb:ab)
443+ ! ~zod/try/~2014.10.23..22.34.29..d399/:<[1 1].[1 18]>
444+ ! {1 1}
445+
446+------------------------------------------------------------------------
447+
448+### `++sed`
449+
450+Parse decimal
451+
452+Parsing [`++rule`](). Parses a nonzero decimal digit.
453+
454+Accepts
455+-------
456+
457+Produces
458+--------
459+
460+Source
461+------
462+
463+ ++ sed (cook |=(a=@ (sub a '0')) (shim '1' '9'))
464+
465+Examples
466+--------
467+
468+ ~zod/try=> (scan "5" sed:ab)
469+ 5
470+ ~zod/try=> (scan "0" sed:ab)
471+ ! {1 1}
472+ ! exit
473+
474+------------------------------------------------------------------------
475+
476+### `++sev`
477+
478+Parse base-32
479+
480+Parsing [`++rule`](). Parses a nonzero base-32 digit
481+
482+Accepts
483+-------
484+
485+Produces
486+--------
487+
488+Source
489+------
490+
491+ ++ sev ;~(pose sed sov)
492+
493+Examples
494+--------
495+
496+ ~zod/try=> (scan "c" sev:ab)
497+ 12
498+ ~zod/socialnet=> (scan "0" sev:ab)
499+ ! {1 1}
500+ ! exit
501+
502+------------------------------------------------------------------------
503+
504+### `++sew`
505+
506+Parse base-64
507+
508+Parsing [`++rule`](). Parses a nonzero base-64 digit
509+
510+Accepts
511+-------
512+
513+Produces
514+--------
515+
516+Source
517+------
518+
519+ ++ sew ;~(pose sed sow)
520+
521+Examples
522+--------
523+
524+ ~zod/try=> (scan "M" sew:ab)
525+ 48
526+ ~zod/try=> (scan "0" sew:ab)
527+ ! {1 1}
528+ ! exit
529+
530+------------------------------------------------------------------------
531+
532+### `++sex`
533+
534+Parse hex
535+
536+Parsing [`++rule`](). Parses a nonzero hexadecimal digit.
537+
538+Accepts
539+-------
540+
541+Produces
542+--------
543+
544+Source
545+------
546+
547+ ++ sex ;~(pose sed sox)
548+
549+Examples
550+--------
551+
552+ ~zod/try=> (scan "e" sex:ab)
553+ 14
554+ ~zod/try=> (scan "0" sex:ab)
555+ ! {1 1}
556+ ! exit
557+
558+------------------------------------------------------------------------
559+
560+### `++sib`
561+
562+Parse binary
563+
564+Parsing [`++rule`](). Parses a binary digit.
565+
566+Accepts
567+-------
568+
569+Produces
570+--------
571+
572+Source
573+------
574+
575+ ++ sib (cook |=(a=@ (sub a '0')) (shim '0' '1'))
576+
577+Examples
578+--------
579+
580+ ~zod/try=> (scan "1" sib:ab)
581+ 1
582+ ~zod/socialnet=> (scan "0" sib:ab)
583+ 0
584+
585+------------------------------------------------------------------------
586+
587+### `++sid`
588+
589+Parse decimal
590+
591+Parsing [`++rule`](). Parses a decimal digit.
592+
593+Accepts
594+-------
595+
596+Produces
597+--------
598+
599+Source
600+------
601+
602+ ++ sid (cook |=(a=@ (sub a '0')) (shim '0' '9'))
603+
604+Examples
605+--------
606+
607+ ~zod/try=> (scan "5" sid:ab)
608+ 5
609+
610+------------------------------------------------------------------------
611+
612+### `++siv`
613+
614+Parse base-32
615+
616+Parsing [`++rule`](). Parses a base-32 digit.
617+
618+Accepts
619+-------
620+
621+Produces
622+--------
623+
624+Source
625+------
626+
627+ ++ siv ;~(pose sid sov)
628+
629+Examples
630+--------
631+
632+ ~zod/try=> (scan "c" siv:ab)
633+ 12
634+
635+------------------------------------------------------------------------
636+
637+### `++siw`
638+
639+Parse base-64
640+
641+Parsing [`++rule`](). Parses a base-64 digit.
642+
643+Accepts
644+-------
645+
646+Produces
647+--------
648+
649+Source
650+------
651+
652+ ++ siw ;~(pose sid sow)
653+
654+Examples
655+--------
656+
657+ ~zod/try=> (scan "M" siw:ab)
658+ 48
659+
660+------------------------------------------------------------------------
661+
662+### `++six`
663+
664+Parse hex
665+
666+Parsing [`++rule`](). Parses a hexadecimal digit.
667+
668+Accepts
669+-------
670+
671+Produces
672+--------
673+
674+Source
675+------
676+
677+ ++ six ;~(pose sid sox)
678+
679+Examples
680+--------
681+
682+ ~zod/try=> (scan "e" six:ab)
683+ 14
684+
685+------------------------------------------------------------------------
686+
687+### `++sov`
688+
689+Parse base-32
690+
691+Parsing [`++rule`](). Parses a base-32 letter.
692+
693+Accepts
694+-------
695+
696+Produces
697+--------
698+
699+Source
700+------
701+
702+ ++ sov (cook |=(a=@ (sub a 87)) (shim 'a' 'v'))
703+
704+Examples
705+--------
706+
707+ ~zod/try=> (scan "c" sov:ab)
708+ 12
709+
710+------------------------------------------------------------------------
711+
712+### `++sow`
713+
714+Parse base-64
715+
716+Parsing [`++rule`](). Parses a base-64 letter/symbol.
717+
718+Accepts
719+-------
720+
721+Produces
722+--------
723+
724+Source
725+------
726+
727+ ++ sow ;~ pose
728+ (cook |=(a=@ (sub a 87)) (shim 'a' 'z'))
729+ (cook |=(a=@ (sub a 29)) (shim 'A' 'Z'))
730+ (cold 62 (just '-'))
731+ (cold 63 (just '~'))
732+ ==
733+
734+Examples
735+--------
736+
737+ ~zod/try=> (scan "M" sow:ab)
738+ 48
739+
740+------------------------------------------------------------------------
741+
742+### `++sox`
743+
744+Parse hex letter
745+
746+Parsing [`++rule`](). Parses a hexadecimal letter.
747+
748+Accepts
749+-------
750+
751+Produces
752+--------
753+
754+Source
755+------
756+
757+ ++ sox (cook |=(a=@ (sub a 87)) (shim 'a' 'f'))
758+
759+Examples
760+--------
761+
762+ ~zod/try=> (scan "e" sox:ab)
763+ 14
764+
765+------------------------------------------------------------------------
766+
767+### `++ted`
768+
769+Parse \<= 3 decimal
770+
771+Parsing [`++rule`](). Parses a decimal number of up to 3 digits without a
772+leading zero.
773+
774+Accepts
775+-------
776+
777+Produces
778+--------
779+
780+Source
781+------
782+
783+ ++ ted (bass 10 ;~(plug sed (stun [0 2] sid)))
784+
785+Examples
786+--------
787+
788+ ~zod/try=> (scan "21" ted:ab)
789+ q=21
790+ ~zod/try=> (scan "214" ted:ab)
791+ q=214
792+ ~zod/try=> (scan "2140" ted:ab)
793+ {1 4}
794+ ~zod/try=> (scan "0" ted:ab)
795+ ! {1 1}
796+ ! exit
797+
798+------------------------------------------------------------------------
799+
800+### `++tip`
801+
802+Leading phonetic byte
803+
804+Parsing [`++rule`](). Parses the leading phonetic byte, which represents a
805+syllable.
806+
807+Accepts
808+-------
809+
810+Produces
811+--------
812+
813+Source
814+------
815+
816+ ++ tip (sear |=(a=@ (ins:po a)) til)
817+
818+Examples
819+--------
820+
821+ ~zod/try=> (scan "doz" tip:ab)
822+ 0
823+ ~zod/try=> (scan "pit" tip:ab)
824+ 242
825+
826+------------------------------------------------------------------------
827+
828+### `++tiq`
829+
830+Trailing phonetic syllable
831+
832+Parsing [`++rule`](). Parses the trailing phonetic byte, which represents a
833+syllable.
834+
835+Accepts
836+-------
837+
838+Produces
839+--------
840+
841+Source
842+------
843+
844+ ++ tiq (sear |=(a=@ (ind:po a)) til)
845+
846+Examples
847+--------
848+
849+ ~zod/try=> (scan "zod" tiq:ab)
850+ 0
851+ ~zod/try=> (scan "nec" tiq:ab)
852+ 1
853+
854+------------------------------------------------------------------------
855+
856+### `++tid`
857+
858+Parse 3 decimal digits
859+
860+Parsing [`++rule`](). Parses exactly three decimal digits.
861+
862+Accepts
863+-------
864+
865+Produces
866+--------
867+
868+Source
869+------
870+
871+ ++ tid (bass 10 (stun [3 3] sid))
872+
873+Examples
874+--------
875+
876+ ~zod/try=> (scan "013" tid:ab)
877+ q=13
878+ ~zod/try=> (scan "01" tid:ab)
879+ ! {1 3}
880+ ! exit
881+
882+------------------------------------------------------------------------
883+
884+### `++til`
885+
886+Parse 3 lowercase
887+
888+Parsing [`++rule`](). Parses exactly three lowercase letters.
889+
890+Accepts
891+-------
892+
893+Produces
894+--------
895+
896+Source
897+------
898+
899+ ++ til (boss 256 (stun [3 3] low))
900+
901+Examples
902+--------
903+
904+ ~zod/try=> (scan "mer" til:ab)
905+ q=7.497.069
906+ ~zod/try=> `@t`(scan "mer" til:ab)
907+ 'mer'
908+ ~zod/try=> (scan "me" til:ab)
909+ ! {1 3}
910+ ! exit
911+
912+------------------------------------------------------------------------
913+
914+### `++urs`
915+
916+Parse span characters
917+
918+Parsing rule. Parses characters from an atom of the span odor [`@ta`]().
919+
920+Accepts
921+-------
922+
923+Produces
924+--------
925+
926+Source
927+------
928+
929+ ++ urs %+ cook
930+ |=(a=tape (rap 3 ^-((list ,@) a)))
931+ (star ;~(pose nud low hep dot sig cab))
932+
933+Examples
934+--------
935+
936+ ~zod/try=> `@ta`(scan "asa-lom_tak" urs:ab)
937+ ~.asa-lom_tak
938+ ~zod/try=> `@t`(scan "asa-lom_tak" urs:ab)
939+ 'asa-lom_tak'
940+
941+------------------------------------------------------------------------
942+
943+### `++urt`
944+
945+Parse non-`_` span
946+
947+Parsing rule. Parses all characters of the span odor [`@ta`]() except
948+for cab, `_`.
949+
950+Accepts
951+-------
952+
953+Produces
954+--------
955+
956+Source
957+------
958+
959+ ++ urt %+ cook
960+ |=(a=tape (rap 3 ^-((list ,@) a)))
961+ (star ;~(pose nud low hep dot sig))
962+
963+Examples
964+--------
965+
966+ ~zod/try=> `@t`(scan "asa-lom.t0k" urt:ab)
967+ 'asa-lom.t0k'
968+
969+------------------------------------------------------------------------
970+
971+### `++voy`
972+
973+Parse bas, soq, or bix
974+
975+Parsing rule. Parses an escaped backslash, single quote, or hex pair
976+byte.
977+
978+Accepts
979+-------
980+
981+Produces
982+--------
983+
984+Source
985+------
986+
987+ ++ voy ;~(pfix bas ;~(pose bas soq bix))
988+
989+Examples
990+--------
991+
992+ ~zod/try=> (scan "\\0a" voy:ab)
993+ q=10
994+ ~zod/try=> (scan "\\'" voy:ab)
995+ q=39
996+
997+------------------------------------------------------------------------
998+
999+### `++ag`
1000+
1001+Top-level atom parser engine
1002+
1003+A core containing top-level atom parsers.
1004+
1005+Accepts
1006+-------
1007+
1008+Produces
1009+--------
1010+
1011+Source
1012+------
1013+
1014+ ++ ag
1015+ |%
1016+
1017+Examples
1018+--------
1019+
1020+ ~zod/try=> ag
1021+ <14.vpu 414.mof 100.xkc 1.ypj %164>
1022+
1023+------------------------------------------------------------------------
1024+
1025+### `++ape`
1026+
1027+Parse 0 or rule
1028+
1029+Parser modifier. Parses 0 or the sample rule `fel`.
1030+
1031+Accepts
1032+-------
1033+
1034+Produces
1035+--------
1036+
1037+`fel` is a [`rule`]().
1038+
1039+Source
1040+------
1041+
1042+ ++ ape |*(fel=_rule ;~(pose (cold 0 (just '0')) fel))
1043+
1044+Examples
1045+--------
1046+
1047+ ~zod/try=> (scan "202" (star (ape:ag (cold 2 (just '2')))))
1048+ ~[2 0 2]
1049+
1050+------------------------------------------------------------------------
1051+
1052+### `++bay`
1053+
1054+Parses binary number
1055+
1056+Parsing rule. Parses a binary number without a leading zero.
1057+
1058+Accepts
1059+-------
1060+
1061+Produces
1062+--------
1063+
1064+Source
1065+------
1066+
1067+ ++ bay (ape (bass 16 ;~(plug qeb:ab (star ;~(pfix dog qib:ab)))))
1068+
1069+Examples
1070+--------
1071+
1072+ ~zod/try=> (scan "10.0110" bay:ag)
1073+ q=38
1074+
1075+------------------------------------------------------------------------
1076+
1077+### `++bip`
1078+
1079+Parse IPv6
1080+
1081+Parsing rule. Parses a [`@is`](), an IPv6 address.
1082+
1083+Accepts
1084+-------
1085+
1086+Produces
1087+--------
1088+
1089+Source
1090+------
1091+
1092+ ++ bip =+ tod=(ape qex:ab)
1093+ (bass 0x1.0000 ;~(plug tod (stun [7 7] ;~(pfix dog tod))))
1094+
1095+Examples
1096+--------
1097+
1098+ ~zod/try=> (scan "0.0.ea.3e6c.0.0.0.0" bip:ag)
1099+ q=283.183.420.760.121.105.516.068.864
1100+ ~zod/try=> `@is`(scan "0.0.ea.3e6c.0.0.0.0" bip:ag)
1101+ .0.0.ea.3e6c.0.0.0.0
1102+
1103+------------------------------------------------------------------------
1104+
1105+### `++dem`
1106+
1107+Parse decimal with dots
1108+
1109+Parsing rule. Parses a decimal number that includes dot separators.
1110+
1111+Accepts
1112+-------
1113+
1114+Produces
1115+--------
1116+
1117+Source
1118+------
1119+
1120+ ++ dem (ape (bass 1.000 ;~(plug ted:ab (star ;~(pfix dog tid:ab)))))
1121+
1122+Examples
1123+--------
1124+
1125+ ~zod/try=> (scan "52" dem:ag)
1126+ q=52
1127+ ~zod/try=> (scan "13.507" dem:ag)
1128+ q=13.507
1129+
1130+------------------------------------------------------------------------
1131+
1132+### `++dim`
1133+
1134+Parse decimal number
1135+
1136+Parsing rule. Parses a decimal number without a leading zero.
1137+
1138+Accepts
1139+-------
1140+
1141+Produces
1142+--------
1143+
1144+Source
1145+------
1146+
1147+ ++ dim (ape (bass 10 ;~(plug sed:ab (star sid:ab))))
1148+
1149+Examples
1150+--------
1151+
1152+ ~zod/try=> (scan "52" dim:ag)
1153+ q=52
1154+ ~zod/try=> (scan "013507" dim:ag)
1155+ ! {1 2}
1156+ ! exit
1157+
1158+------------------------------------------------------------------------
1159+
1160+### `++dum`
1161+
1162+Parse decimal with leading `0`
1163+
1164+Parsing rule. Parses a decmial number with leading zeroes.
1165+
1166+Accepts
1167+-------
1168+
1169+Produces
1170+--------
1171+
1172+Source
1173+------
1174+
1175+ ++ dum (bass 10 (plus sid:ab))
1176+
1177+Examples
1178+--------
1179+
1180+ ~zod/try=> (scan "52" dum:ag)
1181+ q=52
1182+ ~zod/try=> (scan "0000052" dum:ag)
1183+ q=52
1184+ ~zod/try=> (scan "13507" dim:ag)
1185+ q=13.507
1186+
1187+------------------------------------------------------------------------
1188+
1189+### `++fed`
1190+
1191+Parse phonetic base
1192+
1193+Parsing rule. Parses an atom of odor [`@p`](), the phonetic base.
1194+
1195+Accepts
1196+-------
1197+
1198+Produces
1199+--------
1200+
1201+Source
1202+------
1203+
1204+ ++ fed ;~ pose
1205+ (bass 0x1.0000.0000.0000.0000 (most doh hyf:ab))
1206+ huf:ab
1207+ hif:ab
1208+ tiq:ab
1209+ ==
1210+
1211+Examples
1212+--------
1213+
1214+ ~zod/try=> (scan "zod" fed:ag)
1215+ 0
1216+ ~zod/try=> (scan "nec" fed:ag)
1217+ 1
1218+ ~zod/try=> (scan "sondel" fed:ag)
1219+ 9.636
1220+ ~zod/try=> ~tillyn-nillyt
1221+ ~tillyn-nillyt
1222+ ~zod/try=> (scan "tillyn-nillyt" fed:ag)
1223+ 3.569.565.175
1224+ ~zod/try=> (scan "tillyn-nillyt-tasfyn-partyv" fed:ag)
1225+ 15.331.165.687.565.582.592
1226+ ~zod/try=> (scan "tillyn-nillyt-tasfyn-partyv--novweb-talrud-talmud-sonfyr" fed:ag)
1227+ 282.810.089.790.159.633.869.501.053.313.363.681.181
1228+
1229+------------------------------------------------------------------------
1230+
1231+### `++hex`
1232+
1233+Parse hex
1234+
1235+Parsing rule. Parses a hexadecimal number
1236+
1237+Accepts
1238+-------
1239+
1240+Produces
1241+--------
1242+
1243+Source
1244+------
1245+
1246+ ++ hex (ape (bass 0x1.0000 ;~(plug qex:ab (star ;~(pfix dog qix:ab)))))
1247+
1248+Examples
1249+--------
1250+
1251+ ~zod/try=> (scan "4" hex:ag)
1252+ q=4
1253+ ~zod/try=> (scan "1a" hex:ag)
1254+ q=26
1255+ ~zod/try=> (scan "3.ac8d" hex:ag)
1256+ q=240.781
1257+ ~zod/try=> `@ux`(scan "3.ac8d" hex:ag)
1258+ 0x3.ac8d
1259+
1260+------------------------------------------------------------------------
1261+
1262+### `++lip`
1263+
1264+Parse IPv4 address
1265+
1266+Parsing rule. Parses an IPv4 address.
1267+
1268+Accepts
1269+-------
1270+
1271+Produces
1272+--------
1273+
1274+Source
1275+------
1276+
1277+ ++ lip =+ tod=(ape ted:ab)
1278+ (bass 256 ;~(plug tod (stun [3 3] ;~(pfix dog tod))))
1279+
1280+Examples
1281+--------
1282+
1283+ ~zod/try=> (scan "127.0.0.1" lip:ag)
1284+ q=2.130.706.433
1285+ ~zod/try=> `@if`(scan "127.0.0.1" lip:ag)
1286+ .127.0.0.1
1287+ ~zod/try=> `@if`(scan "8.8.8.8" lip:ag)
1288+ .8.8.8.8
1289+
1290+------------------------------------------------------------------------
1291+
1292+### `++viz`
1293+
1294+Parse Base-32 with dots
1295+
1296+Parsing rule. Parses a Base-32 number with dot separators.
1297+
1298+Accepts
1299+-------
1300+
1301+Produces
1302+--------
1303+
1304+Source
1305+------
1306+
1307+ ++ viz (ape (bass 0x200.0000 ;~(plug pev:ab (star ;~(pfix dog piv:ab)))))
1308+
1309+Examples
1310+--------
1311+
1312+ ~zod/try=> (scan "e2.ol4pm" viz:ag)
1313+ q=15.125.353.270
1314+
1315+------------------------------------------------------------------------
1316+
1317+### `++vum`
1318+
1319+Parse base-32 string
1320+
1321+Parsing rule. Parses a raw base-32 string.
1322+
1323+Accepts
1324+-------
1325+
1326+Produces
1327+--------
1328+
1329+Source
1330+------
1331+
1332+ ++ vum (bass 32 (plus siv:ab))
1333+
1334+Examples
1335+--------
1336+
1337+ ~zod/try=> (scan "e2ol4pm" vum:ag)
1338+ q=15.125.353.270
1339+
1340+------------------------------------------------------------------------
1341+
1342+### `++wiz`
1343+
1344+Parse base-64
1345+
1346+Parsing rule. Parses a base-64 number.
1347+
1348+Accepts
1349+-------
1350+
1351+Produces
1352+--------
1353+
1354+Source
1355+------
1356+
1357+ ++ wiz (ape (bass 0x4000.0000 ;~(plug pew:ab (star ;~(pfix dog piw:ab)))))
1358+ --
1359+ ::
1360+
1361+Examples
1362+--------
1363+
1364+ ~zod/try=> (scan "e2O.l4Xpm" wiz:ag)
1365+ q=61.764.130.813.526
docs/system/hoon/library/src/4j/core/mu.mdnew file+124
@@ -0,0 +1,124 @@
1+### `++mu`
2+
3+Core used to scramble 16-bit atoms
4+
5+A [door]() that contains arms that are used to scramble two atoms, `top`
6+and `bot`. Used especially in the phonetic base to disguise the
7+relationship between a destroyer and its cruiser.
8+
9+Accepts
10+-------
11+
12+Produces
13+--------
14+
15+`bot` is an [atom]().
16+
17+`top` is an [atom]().
18+
19+Source
20+------
21+
22+ ++ mu
23+ |_ [top=@ bot=@]
24+
25+Examples
26+--------
27+
28+ ~zod/try=> ~(. mu 0x20e5 0x5901)
29+ <3.sjm [[@ux @ux] <414.hhh 100.xkc 1.ypj %164>]>
30+
31+------------------------------------------------------------------------
32+
33+### `++zag`
34+
35+Add bottom into top
36+
37+Produces the cell of `top` and `bot` with `top` scrambled to the result
38+of adding `bot` to `top` modulo 16. Used to scramble the name of a
39+destroyer.
40+
41+Accepts
42+-------
43+
44+Produces
45+--------
46+
47+`bot` is an [atom]().
48+
49+`top` is an [atom]().
50+
51+Source
52+------
53+
54+ ++ zag [p=(end 4 1 (add top bot)) q=bot]
55+
56+Examples
57+--------
58+
59+ ~zod/try=> `[@ux @ux]`~(zag mu 0x20e0 0x201)
60+ [0x22e1 0x201]
61+
62+------------------------------------------------------------------------
63+
64+### `++zig`
65+
66+Subtract bottom from top
67+
68+The inverse of [`++zag`](). Produces the cell of `top` and `bot` with
69+`top` unscrambled. The unscrambled `top` is the sum of the sample `top`
70+and the 16-bit complement of `bot`. Used to unscramble the name of the
71+destroyer.
72+
73+Accepts
74+-------
75+
76+Produces
77+--------
78+
79+`bot` is an [atom]().
80+
81+`top` is an [atom]().
82+
83+Source
84+------
85+
86+ ++ zig [p=(end 4 1 (add top (sub 0x1.0000 bot))) q=bot]
87+
88+Examples
89+--------
90+
91+ ~zod/try=> `[@ux @ux]`~(zig mu 0x2f46 0x1042)
92+ [0x1f04 0x1042]
93+
94+------------------------------------------------------------------------
95+
96+### `++zug`
97+
98+Concatenate into atom
99+
100+Produces the concatenation of `top` and `bot`. Used to assemble a
101+destroyer name.
102+
103+Accepts
104+-------
105+
106+Produces
107+--------
108+
109+`bot` is an [atom]().
110+
111+`top` is an [atom]().
112+
113+Source
114+------
115+
116+ ++ zug (mix (lsh 4 1 top) bot)
117+
118+Examples
119+--------
120+
121+ ~zod/try=> `@ux`~(zug mu 0x10e1 0xfa)
122+ 0x10e1.00fa
123+
124+
docs/system/hoon/library/src/4j/core/ne.mdnew file+154
@@ -0,0 +1,154 @@
1+### `++ne`
2+
3+Digit rendering engine
4+
5+A [door]() containing arms that render digits at bases 10, 16, 32, and
6+64.
7+
8+Accepts
9+-------
10+
11+Produces
12+--------
13+
14+`tig` is an [`atom`]().
15+
16+Source
17+------
18+
19+ ++ ne
20+ |_ tig=@
21+
22+Examples
23+--------
24+
25+ ~zod/try=> ~(. ne 20)
26+ <4.gut [@ud <414.hhh 100.xkc 1.ypj %164>]>
27+
28+------------------------------------------------------------------------
29+
30+### `++d`
31+
32+Render decimal
33+
34+Renders a decimal digit as an atom of an ACII byte value.
35+
36+Accepts
37+-------
38+
39+Produces
40+--------
41+
42+`tig` is an [`atom`]().
43+
44+Source
45+------
46+
47+ ++ d (add tig '0')
48+
49+Examples
50+--------
51+
52+ ~zod/try=> `@t`~(d ne 7)
53+ '7'
54+
55+------------------------------------------------------------------------
56+
57+### `++x`
58+
59+Render hex
60+
61+Renders a hexadecimal digit as an atom of an ASCII byte value.
62+
63+Accepts
64+-------
65+
66+Produces
67+--------
68+
69+`tig` is an [`atom`]().
70+
71+Source
72+------
73+
74+ ++ x ?:((gte tig 10) (add tig 87) d)
75+
76+Examples
77+--------
78+
79+ ~zod/try=> `@t`~(x ne 7)
80+ '7'
81+ ~zod/try=> `@t`~(x ne 14)
82+ 'e'
83+
84+------------------------------------------------------------------------
85+
86+### `++v`
87+
88+Render base-32
89+
90+Renders a base-32 digit as an atom of an ASCII byte value.
91+
92+Accepts
93+-------
94+
95+Produces
96+--------
97+
98+Source
99+------
100+
101+ ++ v ?:((gte tig 10) (add tig 87) d)
102+
103+Examples
104+--------
105+
106+ ~zod/try=> `@t`~(v ne 7)
107+ '7'
108+ ~zod/try=> `@t`~(v ne 14)
109+ 'e'
110+ ~zod/try=> `@t`~(v ne 25)
111+ 'p'
112+
113+------------------------------------------------------------------------
114+
115+### `++w`
116+
117+Render base-64
118+
119+Renders a base-64 digit as an atom of an ASCII byte value.
120+
121+Accepts
122+-------
123+
124+Produces
125+--------
126+
127+`tig` is an [`atom`]().
128+
129+Source
130+------
131+
132+ ++ w ?:(=(tig 63) '~' ?:(=(tig 62) '-' ?:((gte tig 36) (add tig 29) x)))
133+ --
134+ ::
135+
136+Examples
137+--------
138+
139+ ~zod/try=> `@t`~(w ne 7)
140+ '7'
141+ ~zod/try=> `@t`~(w ne 14)
142+ 'e'
143+ ~zod/try=> `@t`~(w ne 25)
144+ 'p'
145+ ~zod/try=> `@t`~(w ne 52)
146+ 'Q'
147+ ~zod/try=> `@t`~(w ne 61)
148+ 'Z'
149+ ~zod/try=> `@t`~(w ne 63)
150+ '~'
151+ ~zod/try=> `@t`~(w ne 62)
152+ '-'
153+
154+
docs/system/hoon/library/src/4k/core/co.mdnew file+335
@@ -0,0 +1,335 @@
1+### `++co`
2+
3+Literal rendering engine
4+
5+A [door]() that contains arms that operate on the sample coin `lot`.
6+
7+Accepts
8+-------
9+
10+Produces
11+--------
12+
13+`lot` is a [`++coin`]().
14+
15+Source
16+------
17+
18+ ++ co
19+ =< |_ lot=coin
20+
21+Examples
22+--------
23+
24+ ~zod/try=> ~(. co many/~[`ta/'mo' `ud/5])
25+ < 3.dhd
26+ [ [ %many
27+ [%~ %ta @t]
28+ [%~ %ud @ud]
29+ %~
30+ ]
31+ <10.utz 3.zid [rex="" <414.hmb 100.xkc 1.ypj %164>]>
32+ ]
33+ >
34+
35+------------------------------------------------------------------------
36+
37+### `++rear`
38+
39+Prepend & render as tape
40+
41+Renders a coin `lot` as a [tape]() prepended to the sample tape `rom`.
42+
43+Accepts
44+-------
45+
46+Produces
47+--------
48+
49+`rom` is a [`pe`]()
50+
51+`lot` is a [`++coin`]().
52+
53+Source
54+------
55+
56+ ++ rear |=(rom=tape =>(.(rex rom) rend))
57+
58+Examples
59+--------
60+
61+ ~zod/try=> (~(rear co %$ %ux 200) "--ha")
62+ "0xc8--ha"
63+
64+------------------------------------------------------------------------
65+
66+### `++rent`
67+
68+Render as span
69+
70+Renders a coin `lot` as a span.
71+
72+Accepts
73+-------
74+
75+Produces
76+--------
77+
78+`lot` is a [`++coin`]().
79+
80+Source
81+------
82+
83+ ++ rent `@ta`(rap 3 rend)
84+
85+Examples
86+--------
87+
88+ ~zod/try=> ~(rent co %$ %ux 200)
89+ ~.0xc8
90+ ~zod/try=> `@t`~(rent co %$ %ux 200)
91+ '0xc8'
92+
93+------------------------------------------------------------------------
94+
95+### `++rend`
96+
97+Render as tape
98+
99+Renders a coin `lot` as a tape.
100+
101+Accepts
102+-------
103+
104+Produces
105+--------
106+
107+`lot` is a [`++coin`]().
108+
109+Source
110+------
111+
112+ ++ rend
113+ ^- tape
114+ ?: ?=(%blob -.lot)
115+ ['~' '0' ((v-co 1) (jam p.lot))]
116+ ?: ?=(%many -.lot)
117+ :- '.'
118+ |- ^- tape
119+ ?~ p.lot
120+ ['_' '_' rex]
121+ ['_' (weld (trip (wack rent(lot i.p.lot))) $(p.lot t.p.lot))]
122+ =+ [yed=(end 3 1 p.p.lot) hay=(cut 3 [1 1] p.p.lot)]
123+ |- ^- tape
124+ ?+ yed (z-co q.p.lot)
125+ %c ['~' '-' (weld (rip 3 (wood (tuft q.p.lot))) rex)]
126+ %d
127+ ?+ hay (z-co q.p.lot)
128+ %a
129+ =+ yod=(yore q.p.lot)
130+ => ^+(. .(rex ?~(f.t.yod rex ['.' (s-co f.t.yod)])))
131+ => ^+ .
132+ %= .
133+ rex
134+ ?: &(=(~ f.t.yod) =(0 h.t.yod) =(0 m.t.yod) =(0 s.t.yod))
135+ rex
136+ => .(rex ['.' (y-co s.t.yod)])
137+ => .(rex ['.' (y-co m.t.yod)])
138+ ['.' '.' (y-co h.t.yod)]
139+ ==
140+ => .(rex ['.' (a-co d.t.yod)])
141+ => .(rex ['.' (a-co m.yod)])
142+ => .(rex ?:(a.yod rex ['-' rex]))
143+ ['~' (a-co y.yod)]
144+ ::
145+ %r
146+ =+ yug=(yell q.p.lot)
147+ => ^+(. .(rex ?~(f.yug rex ['.' (s-co f.yug)])))
148+ :- '~'
149+ ?: &(=(0 d.yug) =(0 m.yug) =(0 h.yug) =(0 s.yug))
150+ ['.' 's' '0' rex]
151+ => ^+(. ?:(=(0 s.yug) . .(rex ['.' 's' (a-co s.yug)])))
152+ => ^+(. ?:(=(0 m.yug) . .(rex ['.' 'm' (a-co m.yug)])))
153+ => ^+(. ?:(=(0 h.yug) . .(rex ['.' 'h' (a-co h.yug)])))
154+ => ^+(. ?:(=(0 d.yug) . .(rex ['.' 'd' (a-co d.yug)])))
155+ +.rex
156+ ==
157+ ::
158+ %f
159+ ?: =(& q.p.lot)
160+ ['.' 'y' rex]
161+ ?:(=(| q.p.lot) ['.' 'n' rex] (z-co q.p.lot))
162+ ::
163+ %n ['~' rex]
164+ %i
165+ ?+ hay (z-co q.p.lot)
166+ %f ((ro-co [3 10 4] |=(a=@ ~(d ne a))) q.p.lot)
167+ %s ((ro-co [4 16 8] |=(a=@ ~(x ne a))) q.p.lot)
168+ ==
169+ ::
170+ %p
171+ =+ dyx=(met 3 q.p.lot)
172+ :- '~'
173+ ?: (lte dyx 1)
174+ (weld (trip (tod:po q.p.lot)) rex)
175+ ?: =(2 dyx)
176+ ;: weld
177+ (trip (tos:po (end 3 1 q.p.lot)))
178+ (trip (tod:po (rsh 3 1 q.p.lot)))
179+ rex
180+ ==
181+ =+ [dyz=(met 5 q.p.lot) fin=|]
182+ |- ^- tape
183+ ?: =(0 dyz)
184+ rex
185+ %= $
186+ fin &
187+ dyz (dec dyz)
188+ q.p.lot (rsh 5 1 q.p.lot)
189+ rex
190+ =+ syb=(wren:un (end 5 1 q.p.lot))
191+ =+ cog=~(zig mu [(rsh 4 1 syb) (end 4 1 syb)])
192+ ;: weld
193+ (trip (tos:po (end 3 1 p.cog)))
194+ (trip (tod:po (rsh 3 1 p.cog)))
195+ `tape`['-' ~]
196+ (trip (tos:po (end 3 1 q.cog)))
197+ (trip (tod:po (rsh 3 1 q.cog)))
198+ `tape`?:(fin ['-' ?:(=(1 (end 0 1 dyz)) ~ ['-' ~])] ~)
199+ rex
200+ ==
201+ ==
202+ ::
203+ %r
204+ ?+ hay (z-co q.p.lot)
205+ %d
206+ =+ r=(rlyd q.p.lot)
207+ ?~ e.r
208+ ['.' '~' (r-co r)]
209+ ['.' '~' u.e.r]
210+ %h ['.' '~' '~' (r-co (rlyh q.p.lot))]
211+ %q ['.' '~' '~' '~' (r-co (rlyq q.p.lot))]
212+ %s ['.' (r-co (rlys q.p.lot))]
213+ ==
214+ ::
215+ %u
216+ =- (weld p.gam ?:(=(0 q.p.lot) `tape`['0' ~] q.gam))
217+ ^= gam ^- [p=tape q=tape]
218+ ?+ hay [~ ((ox-co [10 3] |=(a=@ ~(d ne a))) q.p.lot)]
219+ %b [['0' 'b' ~] ((ox-co [2 4] |=(a=@ ~(d ne a))) q.p.lot)]
220+ %i [['0' 'i' ~] ((d-co 1) q.p.lot)]
221+ %x [['0' 'x' ~] ((ox-co [16 4] |=(a=@ ~(x ne a))) q.p.lot)]
222+ %v [['0' 'v' ~] ((ox-co [32 5] |=(a=@ ~(x ne a))) q.p.lot)]
223+ %w [['0' 'w' ~] ((ox-co [64 5] |=(a=@ ~(w ne a))) q.p.lot)]
224+ ==
225+ ::
226+ %s
227+ %+ weld
228+ ?:((syn:si q.p.lot) "--" "-")
229+ $(yed 'u', q.p.lot (abs:si q.p.lot))
230+ ::
231+ %t
232+ ?: =('a' hay)
233+ ?: =('s' (cut 3 [2 1] p.p.lot))
234+
235+ (weld (rip 3 q.p.lot) rex)
236+ ['~' '.' (weld (rip 3 q.p.lot) rex)]
237+ ['~' '~' (weld (rip 3 (wood q.p.lot)) rex)]
238+ ==
239+ --
240+ =+ rex=*tape
241+ =< |%
242+ ++ a-co |=(dat=@ ((d-co 1) dat))
243+ ++ d-co |=(min=@ (em-co [10 min] |=([? b=@ c=tape] [~(d ne b) c])))
244+ ++ r-co
245+ |= [syn=? nub=@ der=@ ign=(unit tape) ne=?]
246+ => .(rex ['.' (t-co ((d-co 1) der) ne)])
247+ => .(rex ((d-co 1) nub))
248+ ?:(syn rex ['-' rex])
249+ ++ t-co |= [a=tape n=?] ^- tape
250+ ?: n a
251+ ?~ a ~|(%empty-frac !!) t.a
252+ ::
253+ ++ s-co
254+ |= esc=(list ,@) ^- tape
255+ ~| [%so-co esc]
256+ ?~ esc
257+ rex
258+ :- '.'
259+ =>(.(rex $(esc t.esc)) ((x-co 4) i.esc))
260+
261+ ::
262+ ++ v-co |=(min=@ (em-co [32 min] |=([? b=@ c=tape] [~(v ne b) c])))
263+ ++ w-co |=(min=@ (em-co [64 min] |=([? b=@ c=tape] [~(w ne b) c])))
264+ ++ x-co |=(min=@ (em-co [16 min] |=([? b=@ c=tape] [~(x ne b) c])))
265+ ++ y-co |=(dat=@ ((d-co 2) dat))
266+ ++ z-co |=(dat=@ `tape`['0' 'x' ((x-co 1) dat)])
267+ --
268+ ~% %co +> ~
269+ |%
270+ ++ em-co
271+ ~/ %emco
272+ |= [[bas=@ min=@] [par=$+([? @ tape] tape)]]
273+ |= hol=@
274+ ^- tape
275+ ?: &(=(0 hol) =(0 min))
276+ rex
277+ =+ [rad=(mod hol bas) dar=(div hol bas)]
278+ %= $
279+ min ?:(=(0 min) 0 (dec min))
280+ hol dar
281+ rex (par =(0 dar) rad rex)
282+ ==
283+ ::
284+ ++ ox-co
285+ ~/ %oxco
286+ |= [[bas=@ gop=@] dug=$+(@ @)]
287+ %+ em-co
288+ [|-(?:(=(0 gop) 1 (mul bas $(gop (dec gop))))) 0]
289+ |= [top=? seg=@ res=tape]
290+ %+ weld
291+ ?:(top ~ `tape`['.' ~])
292+ %. seg
293+ %+ em-co(rex res)
294+ [bas ?:(top 0 gop)]
295+ |=([? b=@ c=tape] [(dug b) c])
296+ ::
297+ ++ ro-co
298+ ~/ %roco
299+ |= [[buz=@ bas=@ dop=@] dug=$+(@ @)]
300+ |= hol=@
301+ ^- tape
302+ ?: =(0 dop)
303+ rex
304+ => .(rex $(dop (dec dop)))
305+ :- '.'
306+ %- (em-co [bas 1] |=([? b=@ c=tape] [(dug b) c]))
307+ [(cut buz [(dec dop) 1] hol)]
308+ --
309+ ::
310+
311+Examples
312+--------
313+
314+ ~zod/try=> ~(rend co ~ %ux 200)
315+ "0xc8"
316+ ~zod/try=> ~(rend co %many ~[[%$ ux/200] [%$ p/40]])
317+ "._0xc8_~~tem__"
318+ ~zod/try=> ~(rend co ~ %p 32.819)
319+ "~pillyt"
320+ ~zod/try=> ~(rend co ~ %ux 18)
321+ "0x12"
322+ ~zod/try=> ~(rend co [~ p=[p=%if q=0x7f00.0001]])
323+ ".127.0.0.1"
324+ ~zod/try=> `@ux`.127.0.0.1
325+ 2.130.706.433
326+ ~zod/try=> ~(rend co %many ~[[~ %ud 20] [~ %uw 133] [~ %tas 'sam']])
327+ "._20_0w25_sam__"
328+ ~zod/try=> ~(rend co %blob [1 1])
329+ "~0ph"
330+ ~zod/try=> ~0ph
331+ [1 1]
332+ ~zod/try=> `@uv`(jam [1 1])
333+ 0vph
334+
335+
docs/system/hoon/library/src/4k/gate/alf.mdnew file+22
@@ -0,0 +1,22 @@
1+### `++alf`
2+
3+Alphabetic characters
4+
5+Parse alphabetic characters, both upper and lowercase.
6+
7+Source
8+------
9+
10+ ++ alf ;~(pose low hig) :: alphabetic
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "a" alf)
16+ ~~a
17+ ~zod/try=> (scan "A" alf)
18+ ~~~41.
19+ ~zod/try=> (scan "AaBbCc" (star alf))
20+ "AaBbCc"
21+
22+
docs/system/hoon/library/src/4k/gate/aln.mdnew file+22
@@ -0,0 +1,22 @@
1+### `++aln`
2+
3+Alphanumeric characters
4+
5+Parse alphanumeric characters - both alphabetic characters and numbers.
6+
7+Source
8+------
9+
10+ ++ aln ;~(pose low hig nud) :: alphanumeric
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "0" aln)
16+ ~~0
17+ ~zod/try=> (scan "alf42" (star aln))
18+ "alf42"
19+ ~zod/try=> (scan "0123456789abcdef" (star aln))
20+ "0123456789abcdef"
21+
22+
docs/system/hoon/library/src/4k/gate/alp.mdnew file+22
@@ -0,0 +1,22 @@
1+### `++alp`
2+
3+Alphanumeric and `-`
4+
5+Parse alphanumeric strings and hep, "-".
6+
7+Source
8+------
9+
10+ ++ alp ;~(pose low hig nud hep) :: alphanumeric and -
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "7" alp)
16+ ~~7
17+ ~zod/try=> (scan "s" alp)
18+ ~~s
19+ ~zod/try=> (scan "123abc-" (star alp))
20+ "123abc-"
21+
22+
docs/system/hoon/library/src/4k/gate/bet.mdnew file+21
@@ -0,0 +1,21 @@
1+
2+### `++bet`
3+
4+Axis syntax `-`, `+`
5+
6+Parse the hep and lus axis syntax.
7+
8+Source
9+------
10+
11+ ++ bet ;~(pose (cold 2 hep) (cold 3 lus)) :: axis syntax - +
12+
13+Examples
14+--------
15+
16+ ~zod/try=> (scan "-" bet)
17+ 2
18+ ~zod/try=> (scan "+" bet)
19+ 3
20+
21+
docs/system/hoon/library/src/4k/gate/bin.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++bin`
2+
3+Binary to atom
4+
5+Parse a tape of binary (0s and 1s) and produce its atomic representation.
6+
7+Source
8+------
9+
10+ ++ bin (bass 2 (most gon but)) :: binary to atom
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "0000" bin)
16+ 0
17+ ~zod/try=> (scan "0001" bin)
18+ 1
19+ ~zod/try=> (scan "0010" bin)
20+ 2
21+ ~zod/try=> (scan "100000001111" bin)
22+ 2.063
23+
24+
docs/system/hoon/library/src/4k/gate/but.mdnew file+26
@@ -0,0 +1,26 @@
1+### `++but`
2+
3+Binary digit
4+
5+Parse a single binary digit.
6+
7+Source
8+------
9+
10+ ++ but (cook |=(a=@ (sub a '0')) (shim '0' '1')) :: binary digit
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "0" but)
16+ 0
17+ ~zod/try=> (scan "1" but)
18+ 1
19+ ~zod/try=> (scan "01" but)
20+ ! {1 2}
21+ ! 'syntax-error'
22+ ! exit
23+ ~zod/try=> (scan "01" (star but))
24+ ~[0 1]
25+
26+
docs/system/hoon/library/src/4k/gate/cit.mdnew file+26
@@ -0,0 +1,26 @@
1+### `++cit`
2+
3+Octal digit
4+
5+Parse a single octal digit.
6+
7+Source
8+------
9+
10+ ++ cit (cook |=(a=@ (sub a '0')) (shim '0' '7')) :: octal digit
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "1" cit)
16+ 1
17+ ~zod/try=> (scan "7" cit)
18+ 7
19+ ~zod/try=> (scan "8" cit)
20+ ! {1 1}
21+ ! 'syntax-error'
22+ ! exit
23+ ~zod/try=> (scan "60" (star cit))
24+ ~[6 0]
25+
26+
docs/system/hoon/library/src/4k/gate/dem.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++dem`
2+
3+Decimal to atom
4+
5+Parse a decimal number to an atom.
6+
7+Source
8+------
9+
10+ ++ dem (bass 10 (most gon dit)) :: decimal to atom
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "7" dem)
16+ 7
17+ ~zod/try=> (scan "42" dem)
18+ 42
19+ ~zod/try=> (scan "150000000" dem)
20+ 150.000.000
21+ ~zod/try=> (scan "12456" dem)
22+ 12.456
23+
24+
docs/system/hoon/library/src/4k/gate/dit.mdnew file+22
@@ -0,0 +1,22 @@
1+### `++dit`
2+
3+Decimal digit
4+
5+Parse a single decimal digit.
6+
7+Source
8+------
9+
10+ ++ dit (cook |=(a=@ (sub a '0')) (shim '0' '9')) :: decimal digit
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "7" dit)
16+ 7
17+ ~zod/try=> (scan "42" (star dit))
18+ ~[4 2]
19+ ~zod/try=> (scan "26000" (star dit))
20+ ~[2 6 0 0 0]
21+
22+
docs/system/hoon/library/src/4k/gate/dog.mdnew file+21
@@ -0,0 +1,21 @@
1+### `++dog`
2+
3+`.` optional gap
4+
5+Dot followed by an optional gap, used with numbers.
6+
7+Source
8+------
9+
10+ ++ dog ;~(plug dot gay) ::
11+
12+Examples
13+--------
14+
15+ /~zod/try=> 1.234.
16+ 703
17+ 1.234.703
18+ ~zod/try=> (scan "a. " ;~(pfix alf dog))
19+ [~~~. ~]
20+
21+
docs/system/hoon/library/src/4k/gate/doh.mdnew file+25
@@ -0,0 +1,25 @@
1+### `++doh`
2+
3+`@p` separator
4+
5+Phonetic base phrase separator
6+
7+Source
8+------
9+
10+ ++ doh ;~(plug ;~(plug hep hep) gay) ::
11+
12+Examples
13+--------
14+
15+ /~zod/try=> ~nopfel-botduc-nilnev-dolfyn--haspub-natlun-lodmur-holtyd
16+ ~nopfel-botduc-nilnev-dolfyn--haspub-natlun-lodmur-holtyd
17+ /~zod/try=> ~nopfel-botduc-nilnev-dolfyn--
18+ haspub-natlun-lodmur-holtyd
19+ ~nopfel-botduc-nilnev-dolfyn--haspub-natlun-lodmur-holtyd
20+ ~zod/try=> (scan "--" doh)
21+ [[~~- ~~-] ~]
22+ ~zod/try=> (scan "-- " doh)
23+ [[~~- ~~-] ~]
24+
25+
docs/system/hoon/library/src/4k/gate/dun.mdnew file+20
@@ -0,0 +1,20 @@
1+### `++dun`
2+
3+`--` to `~`
4+
5+Parse phep, `--`, to null, `~`.
6+
7+Source
8+------
9+
10+ ++ dun (cold ~ ;~(plug hep hep)) :: -- (phep) to ~
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "--" dun)
16+ ~
17+ ~zod/try=> (dun [[1 1] "--"])
18+ [p=[p=1 q=3] q=[~ u=[p=~ q=[p=[p=1 q=3] q=""]]]]
19+
20+
docs/system/hoon/library/src/4k/gate/duz.mdnew file+21
@@ -0,0 +1,21 @@
1+
2+### `++duz`
3+
4+`==` to `~`
5+
6+Parse stet, `==`, to null `~`.
7+
8+Source
9+------
10+
11+ ++ duz (cold ~ ;~(plug tis tis)) :: == (stet) to ~
12+
13+Examples
14+--------
15+
16+ ~zod/try=> (scan "==" duz)
17+ ~
18+ ~zod/try=> (duz [[1 1] "== |=..."])
19+ [p=[p=1 q=3] q=[~ u=[p=~ q=[p=[p=1 q=3] q=" |=..."]]]]
20+
21+
docs/system/hoon/library/src/4k/gate/gah.mdnew file+35
@@ -0,0 +1,35 @@
1+
2+### `++gah`
3+
4+Newline or ' '
5+
6+Whitespace component, either newline or space.
7+
8+Source
9+------
10+
11+ ++ gah (mask [`@`10 ' ' ~]) :: newline or ace
12+
13+Examples
14+--------
15+
16+ /~zod/try=> ^- * :: show spaces
17+ """
18+ -
19+ -
20+ -
21+ """
22+ [32 32 32 45 10 32 45 10 32 32 45 0]
23+ /~zod/try=> ^- *
24+ """
25+
26+ """
27+ [32 32 32 10 32 10 32 32 0]
28+ /~zod/try=> ^- (list ,@)
29+ %- scan :_ (star gah)
30+ """
31+
32+ """
33+ ~[32 32 32 10 32 10 32 32]
34+
35+
docs/system/hoon/library/src/4k/gate/gap.mdnew file+12
@@ -0,0 +1,12 @@
1+### `++gap`
2+
3+Plural whitespace
4+
5+Separates tall runes
6+
7+Source
8+------
9+
10+ ++ gap (cold ~ ;~(plug gaq (star ;~(pose vul gah)))) :: plural whitespace
11+
12+
docs/system/hoon/library/src/4k/gate/gaq.mdnew file+17
@@ -0,0 +1,17 @@
1+### `++gaq`
2+
3+End of line
4+
5+Two spaces, a newline, or comment.
6+
7+Source
8+------
9+
10+ ++ gaq ;~ pose :: end of line
11+ (just `@`10)
12+ ;~(plug gah ;~(pose gah vul))
13+ vul
14+ ==
15+
16+
17+
docs/system/hoon/library/src/4k/gate/gaw.mdnew file+12
@@ -0,0 +1,12 @@
1+### `++gaw`
2+
3+Classic whitespace
4+
5+Terran whitespace.
6+
7+Source
8+------
9+
10+ ++ gaw (cold ~ (star ;~(pose vul gah))) :: classic white
11+
12+
docs/system/hoon/library/src/4k/gate/gay.mdnew file+12
@@ -0,0 +1,12 @@
1+### `++gay`
2+
3+Optional gap
4+
5+Optional gap.
6+
7+Source
8+------
9+
10+ ++ gay ;~(pose gap (easy ~)) ::
11+
12+
docs/system/hoon/library/src/4k/gate/gon.mdnew file+21
@@ -0,0 +1,21 @@
1+### `++gon`
2+
3+Long numbers
4+
5+Parse long numbers - Numbers which wrap around the shell with the line
6+
7+Source
8+------
9+
10+break ++ gon ;~(pose ;~(plug bas gay fas) (easy ~)) :: long numbers \ /
11+
12+Examples
13+--------
14+characters bas and fas.
15+
16+ ~zod/try=> (scan "\\/" gon)
17+ [~~~5c. ~ ~~~2f.]
18+ ~zod/try=> (gon [[1 1] "\\/"])
19+ [p=[p=1 q=3] q=[~ u=[p=[~~~5c. ~ ~~~2f.] q=[p=[p=1 q=3] q=""]]]]
20+
21+
docs/system/hoon/library/src/4k/gate/gul.mdnew file+20
@@ -0,0 +1,20 @@
1+### `++gul`
2+
3+Axis syntax `<` or `>`
4+
5+Parse the axis gal and gar axis syntax.
6+
7+Source
8+------
9+
10+ ++ gul ;~(pose (cold 2 gal) (cold 3 gar)) :: axis syntax < >
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "<" gul)
16+ 2
17+ ~zod/try=> (scan ">" gul)
18+ 3
19+
20+
docs/system/hoon/library/src/4k/gate/hex.mdnew file+29
@@ -0,0 +1,29 @@
1+### `++hex`
2+
3+Hex to atom
4+
5+Parse any hexadecimal number to an atom.
6+
7+Source
8+------
9+
10+ ++ hex (bass 16 (most gon hit)) :: hex to atom
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "a" hex)
16+ 10
17+ ~zod/try=> (scan "A" hex)
18+ 10
19+ ~zod/try=> (scan "2A" hex)
20+ 42
21+ ~zod/try=> (scan "1ee7" hex)
22+ 7.911
23+ ~zod/try=> (scan "1EE7" hex)
24+ 7.911
25+ ~zod/try=> (scan "1EE7F7" hex)
26+ 2.025.463
27+ ~zod/try=> `@ux`(scan "1EE7F7" hex)
28+ 0x1e.e7f7
29+
docs/system/hoon/library/src/4k/gate/hig.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++hig`
2+
3+Uppercase
4+
5+Parse a single uppercase letter.
6+
7+Source
8+------
9+
10+ ++ hig (shim 'A' 'Z') :: uppercase
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "G" hig)
16+ ~~~47.
17+ ~zod/try=> `cord`(scan "G" hig)
18+ 'G'
19+ ~zod/try=> (scan "ABCDEFGHIJKLMNOPQRSTUVWXYZ" (star hig))
20+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
21+ ~zod/try=> (hig [[1 1] "G"])
22+ [p=[p=1 q=2] q=[~ [p=~~~47. q=[p=[p=1 q=2] q=""]]]]
23+
24+
docs/system/hoon/library/src/4k/gate/hit.mdnew file+27
@@ -0,0 +1,27 @@
1+### `++hit`
2+
3+Hex digits
4+
5+Parse a single hexadecimal digit.
6+
7+Source
8+------
9+
10+ ++ hit ;~ pose :: hex digits
11+ dit
12+ (cook |=(a=char (sub a 87)) (shim 'a' 'f'))
13+ (cook |=(a=char (sub a 55)) (shim 'A' 'F'))
14+ ==
15+
16+Examples
17+--------
18+
19+ ~zod/try=> (scan "a" hit)
20+ 10
21+ ~zod/try=> (scan "A" hit)
22+ 10
23+ ~zod/try=> (hit [[1 1] "a"])
24+ [p=[p=1 q=2] q=[~ [p=10 q=[p=[p=1 q=2] q=""]]]]
25+ ~zod/try=> (scan "2A" (star hit))
26+ ~[2 10]
27+
docs/system/hoon/library/src/4k/gate/iny.mdnew file+58
@@ -0,0 +1,58 @@
1+### `++iny`
2+
3+Indentation block
4+
5+Apply [`++rule`]() to indented block starting at current column number, omitting
6+the leading whitespace.
7+
8+Accepts
9+-------
10+
11+`sef` is a [`++rule`]()
12+
13+Produces
14+--------
15+
16+A `++rule`.
17+
18+Source
19+------
20+
21+ ++ iny |* sef=_rule :: indentation block
22+ |= nail ^+ (sef)
23+ =+ [har tap]=[p q]:+<
24+ =+ lev=(fil 3 (dec q.har) ' ')
25+ =+ eol=(just `@t`10)
26+ =+ =- roq=((star ;~(pose prn ;~(sfix eol (jest lev)) -)) har tap)
27+ ;~(simu ;~(plug eol eol) eol)
28+ ?~ q.roq roq
29+ =+ vex=(sef har(q 1) p.u.q.roq)
30+ =+ fur=p.vex(q (add (dec q.har) q.p.vex))
31+ ?~ q.vex vex(p fur)
32+ =- vex(p fur, u.q -)
33+ :+ &3.vex
34+ &4.vex(q.p (add (dec q.har) q.p.&4.vex))
35+ =+ res=|4.vex
36+ |- ?~ res |4.roq
37+ ?. =(10 -.res) [-.res $(res +.res)]
38+ (welp [`@t`10 (trip lev)] $(res +.res))
39+ ::
40+
41+Examples
42+--------
43+
44+ ~zod/try=> (scan "abc" (iny (star ;~(pose prn (just `@`10)))))
45+ "abc"
46+ ~zod/try=> (scan "abc" (star ;~(pose prn (just `@`10))))
47+ "abc"
48+ ~zod/try=> (scan " abc\0ade" ;~(pfix ace ace (star ;~(pose prn (just `@`10)))))
49+ "abc
50+ de"
51+ ~zod/try=> (scan " abc\0ade" ;~(pfix ace ace (iny (star ;~(pose prn (just `@`10))))))
52+ ! {1 6}
53+ ! exit
54+ ~zod/try=> (scan " abc\0a de" ;~(pfix ace ace (iny (star ;~(pose prn (just `@`10))))))
55+ "abc
56+ de"
57+
58+
docs/system/hoon/library/src/4k/gate/low.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++low`
2+
3+Lowercase
4+
5+Parse a single lowercase letter.
6+
7+Source
8+------
9+
10+ ++ low (shim 'a' 'z') :: lowercase
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "g" low)
16+ ~~g
17+ ~zod/try=> `cord`(scan "g" low)
18+ 'g'
19+ ~zod/try=> (scan "abcdefghijklmnopqrstuvwxyz" (star low))
20+ "abcdefghijklmnopqrstuvwxyz"
21+ ~zod/try=> (low [[1 1] "g"])
22+ [p=[p=1 q=2] q=[~ [p=~~g q=[p=[p=1 q=2] q=""]]]]
23+
24+
docs/system/hoon/library/src/4k/gate/mes.mdnew file+24
@@ -0,0 +1,24 @@
1+### `++mes`
2+
3+Hexbyte
4+
5+Parse a hexbyte.
6+
7+Source
8+------
9+
10+ ++ mes %+ cook :: hexbyte
11+ |=([a=@ b=@] (add (mul 16 a) b))
12+ ;~(plug hit hit)
13+
14+Examples
15+--------
16+
17+ ~zod/try=> (scan "2A" mes)
18+ 42
19+ ~zod/try=> (mes [[1 1] "2A"])
20+ [p=[p=1 q=3] q=[~ u=[p=42 q=[p=[p=1 q=3] q=""]]]]
21+ ~zod/try=> (scan "42" mes)
22+ 66
23+
24+
docs/system/hoon/library/src/4k/gate/nix.mdnew file+20
@@ -0,0 +1,20 @@
1+### `++nix`
2+
3+Letters and `-`
4+
5+Parse Letters and `-`.
6+
7+Source
8+------
9+
10+ ++ nix (boss 256 (star ;~(pose aln cab))) ::
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "as_me" nix)
16+ q=435.626.668.897
17+ ~zod/try=> `@t`(scan "as_me" nix)
18+ 'as_me'
19+
20+
docs/system/hoon/library/src/4k/gate/nud.mdnew file+24
@@ -0,0 +1,24 @@
1+
2+### `++nud`
3+
4+Numeric
5+
6+Parse a numeric character - A number.
7+
8+Source
9+------
10+
11+ ++ nud (shim '0' '9') :: numeric
12+
13+Examples
14+--------
15+
16+ ~zod/try=> (scan "0" nud)
17+ ~~0
18+ ~zod/try=> (scan "7" nud)
19+ ~~7
20+ ~zod/try=> (nud [[1 1] "1"])
21+ [p=[p=1 q=2] q=[~ [p=~~1 q=[p=[p=1 q=2] q=""]]]]
22+ ~zod/try=> (scan "0123456789" (star nud))
23+ "0123456789"
24+
docs/system/hoon/library/src/4k/gate/prn.mdnew file+23
@@ -0,0 +1,23 @@
1+### `++prn`
2+
3+Printable character
4+
5+Parse any printable character.
6+
7+Source
8+------
9+
10+ ++ prn ;~(less (just `@`127) (shim 32 256))
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "h" prn)
16+ ~~h
17+ ~zod/try=> (scan "!" prn)
18+ ~~~21.
19+ ~zod/try=> (scan "\01" prn)
20+ ! {1 1}
21+ ! exit
22+
23+
docs/system/hoon/library/src/4k/gate/qat.mdnew file+35
@@ -0,0 +1,35 @@
1+### `++qit`
2+
3+Chars in cord
4+
5+Parse an individual character to its cord atom representation.
6+
7+Source
8+------
9+
10+ ++ qit ;~ pose :: chars in a cord
11+ ;~(less bas soq prn)
12+ ;~(pfix bas ;~(pose bas soq mes)) :: escape chars
13+ ==
14+
15+Examples
16+--------
17+
18+ ~zod/try=> (scan "%" qit)
19+ 37
20+ ~zod/try=> `@t`(scan "%" qit)
21+ '%'
22+ ~zod/try=> (scan "0" qit)
23+ 48
24+ ~zod/try=> (scan "E" qit)
25+ 69
26+ ~zod/try=> (scan "a" qit)
27+ 97
28+ ~zod/try=> (scan "\\0a" qit)
29+ 10
30+ ~zod/try=> `@ux`(scan "\\0a" qit)
31+ 0xa
32+ ~zod/try=> (scan "cord" (star qit))
33+ ~[99 111 114 100]
34+
35+
docs/system/hoon/library/src/4k/gate/qit.mdnew file+36
@@ -0,0 +1,36 @@
1+### `++qit`
2+
3+Chars in cord
4+
5+Parse an individual character to its cord atom representation.
6+
7+Source
8+------
9+
10+ ++ qit ;~ pose :: chars in a cord
11+ ;~(less bas soq prn)
12+ ;~(pfix bas ;~(pose bas soq mes)) :: escape chars
13+ ==
14+
15+Examples
16+--------
17+
18+ ~zod/try=> (scan "%" qit)
19+ 37
20+ ~zod/try=> `@t`(scan "%" qit)
21+ '%'
22+ ~zod/try=> (scan "0" qit)
23+ 48
24+ ~zod/try=> (scan "E" qit)
25+ 69
26+ ~zod/try=> (scan "a" qit)
27+ 97
28+ ~zod/try=> (scan "\\0a" qit)
29+ 10
30+ ~zod/try=> `@ux`(scan "\\0a" qit)
31+ 0xa
32+ ~zod/try=> (scan "cord" (star qit))
33+ ~[99 111 114 100]
34+
35+
36+
docs/system/hoon/library/src/4k/gate/qut.mdnew file+38
@@ -0,0 +1,38 @@
1+### `++qut`
2+
3+Cord
4+
5+Parse single-soq cord with `\{gap}/` anywhere in the middle, or triple-single
6+quote (aka triple-soq) cord, between which must be in an indented block.
7+
8+Source
9+------
10+
11+ ++ qut ;~ pose :: cord
12+ ;~ less soqs
13+ (ifix [soq soq] (boss 256 (more gon qit)))
14+ ==
15+ %- inde %+ ifix
16+ :- ;~ plug soqs
17+ ;~(pose ;~(plug (plus ace) vul) (just '\0a'))
18+ ==
19+ ;~(plug (just '\0a') soqs)
20+ (boss 256 (star qat))
21+ ==
22+ ::
23+
24+Examples
25+--------
26+
27+ ~zod/try=> (scan "'cord'" qut)
28+ q=1.685.221.219
29+ ~zod/try=> 'cord'
30+ 'cord'
31+ ~zod/try=> `@ud`'cord'
32+ 1.685.221.219
33+ /~zod/try=> '''
34+ Heredoc isn't prohibited from containing quotes
35+ '''
36+ 'Heredoc isn't prohibited from containing quotes'
37+
38+
docs/system/hoon/library/src/4k/gate/soz.mdnew file+21
@@ -0,0 +1,21 @@
1+### `++soz`
2+
3+Delimiting `'''`
4+
5+Parse a triple-single quote, used for multiline strings.
6+
7+Source
8+------
9+
10+ ++ soz ;~(plug soq soq soq) :: delimiting '''
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (scan "'''" soz)
16+ [~~~27. ~~~27. ~~~27.]
17+ ~zod/try=> (rash '"""' soz)
18+ ! {1 1}
19+ ! exit
20+
21+
docs/system/hoon/library/src/4k/gate/sym.mdnew file+26
@@ -0,0 +1,26 @@
1+### `++sym`
2+
3+Term
4+
5+A term: a letter(lowercase), followed by letters, numbers, or `-`.
6+
7+Source
8+------
9+
10+ ++ sym
11+ %+ cook
12+ |=(a=tape (rap 3 ^-((list ,@) a)))
13+ ;~(plug low (star ;~(pose nud low hep)))
14+ ::
15+
16+Examples
17+--------
18+
19+ ~zod/try=> (scan "sam-2" sym)
20+ 215.510.507.891
21+ ~zod/try=> `@t`(scan "sam-2" sym)
22+ 'sam-2'
23+ ~zod/try=> (scan "sym" sym)
24+ 7.174.515
25+
26+
docs/system/hoon/library/src/4k/gate/ven.mdnew file+35
@@ -0,0 +1,35 @@
1+### `++ven`
2+
3+`+>-` axis syntax
4+
5+Axis syntax parser
6+
7+Source
8+------
9+
10+ ++ ven ;~ (comp |=([a=@ b=@] (peg a b))) :: +>- axis syntax
11+ bet
12+ =+ hom=`?`|
13+ |= tub=nail
14+ ^- (like axis)
15+ =+ vex=?:(hom (bet tub) (gul tub))
16+ ?~ q.vex
17+ [p.tub [~ 1 tub]]
18+ =+ wag=$(p.tub p.vex, hom !hom, tub q.u.q.vex)
19+ ?> ?=(^ q.wag)
20+ [p.wag [~ (peg p.u.q.vex p.u.q.wag) q.u.q.wag]]
21+ ==
22+
23+Examples
24+--------
25+
26+ ~zod/arvo=/hoon/hoon> (scan "->+" ven)
27+ 11
28+ ~zod/arvo=/hoon/hoon> `@ub`(scan "->+" ven)
29+ 0b1011
30+ ~zod/arvo=/hoon/hoon> (peg (scan "->" ven) (scan "+" ven))
31+ 11
32+ ~zod/arvo=/hoon/hoon> ->+:[[1 2 [3 4]] 5]
33+ [3 4]
34+
35+
docs/system/hoon/library/src/4k/gate/vit.mdnew file+30
@@ -0,0 +1,30 @@
1+### `++vit`
2+
3+Base64 digit
4+
5+Parse a standard base64 digit.
6+
7+Source
8+------
9+
10+ ++ vit :: base64 digit
11+ ;~ pose
12+ (cook |=(a=@ (sub a 65)) (shim 'A' 'Z'))
13+ (cook |=(a=@ (sub a 71)) (shim 'a' 'z'))
14+ (cook |=(a=@ (add a 4)) (shim '0' '9'))
15+ (cold 62 (just '-'))
16+ (cold 63 (just '+'))
17+ ==
18+
19+Examples
20+--------
21+
22+ ~zod/arvo=/hoon/hoon> (scan "C" vit)
23+ 2
24+ ~zod/arvo=/hoon/hoon> (scan "c" vit)
25+ 28
26+ ~zod/arvo=/hoon/hoon> (scan "2" vit)
27+ 54
28+ ~zod/arvo=/hoon/hoon> (scan "-" vit)
29+ 62
30+
docs/system/hoon/library/src/4k/gate/vul.mdnew file+26
@@ -0,0 +1,26 @@
1+### `++vul`
2+
3+Comments to null
4+
5+Source
6+------
7+
8+ ++ vul %- cold :- ~ :: comments
9+ ;~ plug col col
10+ (star prn)
11+ (just `@`10)
12+ ==
13+
14+Parse comments and produce a null. Note that a comment must be ended
15+with a newline character.
16+
17+Examples
18+--------
19+
20+ ~zod/try=> (scan "::this is a comment \0a" vul)
21+ ~
22+ ~zod/try=> (scan "::this is a comment " vul)
23+ ! {1 21}
24+ ! exit
25+
26+
docs/system/hoon/library/src/4l/core/so.mdnew file+476
@@ -0,0 +1,476 @@
1+### `++so`
2+
3+Coin parser engine
4+
5+Core containing arms that parse [`++coin`]s.
6+
7+Accepts
8+-------
9+
10+Produces
11+--------
12+
13+Source
14+------
15+
16+ ++ so
17+ |%
18+
19+Examples
20+--------
21+
22+ ~zod/try=> so
23+ <10.mkn 414.hhh 100.xkc 1.ypj %164>
24+
25+------------------------------------------------------------------------
26+
27+### `++bisk`
28+
29+Parse odor-atom pair
30+
31+Parsing rule. Parses an unsigned integer of any permitted base,
32+producing a [`++dime`]().
33+
34+Accepts
35+-------
36+
37+Produces
38+--------
39+
40+Source
41+------
42+
43+ ++ bisk
44+ ;~ pose
45+ ;~ pfix (just '0')
46+ ;~ pose
47+ (stag %ub ;~(pfix (just 'b') bay:ag))
48+ (stag %ui ;~(pfix (just 'i') dim:ag))
49+ (stag %ux ;~(pfix (just 'x') hex:ag))
50+ (stag %uv ;~(pfix (just 'v') viz:ag))
51+ (stag %uw ;~(pfix (just 'w') wiz:ag))
52+ ==
53+ ==
54+ (stag %ud dem:ag)
55+ ==
56+
57+Examples
58+--------
59+
60+ ~zod/try=> (scan "25" bisk:so)
61+ [%ud q=25]
62+ ~zod/try=> (scan "0x12.6401" bisk:so)
63+ [%ux q=1.205.249]
64+
65+------------------------------------------------------------------------
66+
67+### `++crub`
68+
69+Parse `@da`, `@dr`, `@p`, `@t`
70+
71+Parsing rule. Parses any atom of any of the following odors after a
72+leading sig, `~` into a [`++dime`](): [`@da`](), [`@dr`](), [`@p`](),
73+and [`@t`](), producing a [`++dime`]().
74+
75+Accepts
76+-------
77+
78+Produces
79+--------
80+
81+Source
82+------
83+
84+ ++ crub
85+ ;~ pose
86+ %+ cook
87+ |=(det=date `dime`[%da (year det)])
88+ ;~ plug
89+ %+ cook
90+ |=([a=@ b=?] [b a])
91+ ;~(plug dim:ag ;~(pose (cold | hep) (easy &)))
92+ ;~(pfix dot dim:ag) :: month
93+ ;~(pfix dot dim:ag) :: day
94+ ;~ pose
95+ ;~ pfix
96+ ;~(plug dot dot)
97+ ;~ plug
98+ dum:ag
99+ ;~(pfix dot dum:ag)
100+ ;~(pfix dot dum:ag)
101+ ;~(pose ;~(pfix ;~(plug dot dot) (most dot qix:ab)) (easy ~))
102+ ==
103+ ==
104+ (easy [0 0 0 ~])
105+ ==
106+ ==
107+ ::
108+ %+ cook
109+ |= [a=(list ,[p=?(%d %h %m %s) q=@]) b=(list ,@)]
110+ =+ rop=`tarp`[0 0 0 0 b]
111+ |- ^- dime
112+ ?~ a
113+ [%dr (yule rop)]
114+ ?- p.i.a
115+ %d $(a t.a, d.rop (add q.i.a d.rop))
116+ %h $(a t.a, h.rop (add q.i.a h.rop))
117+ %m $(a t.a, m.rop (add q.i.a m.rop))
118+ %s $(a t.a, s.rop (add q.i.a s.rop))
119+ ==
120+ ;~ plug
121+ %+ most
122+ dot
123+ ;~ pose
124+ ;~(pfix (just 'd') (stag %d dim:ag))
125+ ;~(pfix (just 'h') (stag %h dim:ag))
126+ ;~(pfix (just 'm') (stag %m dim:ag))
127+ ;~(pfix (just 's') (stag %s dim:ag))
128+ ==
129+ ;~(pose ;~(pfix ;~(plug dot dot) (most dot qix:ab)) (easy ~))
130+ ==
131+ ::
132+ (stag %p fed:ag)
133+ ;~(pfix dot (stag %ta urs:ab))
134+ ;~(pfix sig (stag %t (cook woad urs:ab)))
135+ ;~(pfix hep (stag %c (cook turf (cook woad urs:ab))))
136+ ==
137+
138+Examples
139+--------
140+
141+ ~zod/try=> (scan "1926.5.12" crub:so)
142+ [p=~.da q=170.141.184.449.747.016.871.285.095.307.149.312.000]
143+ ~zod/try=> (,[%da @da] (scan "1926.5.12" crub:so))
144+ [%da ~1926.5.12]
145+ ~zod/try=> (scan "s10" crub:so)
146+ [p=~.dr q=184.467.440.737.095.516.160]
147+ ~zod/try=> (,[%dr @dr] (scan "s10" crub:so))
148+ [%dr ~s10]
149+ ~zod/try=> (scan "doznec" crub:so)
150+ [%p 256]
151+ ~zod/try=> (scan ".mas" crub:so)
152+ [%ta 7.561.581]
153+
154+------------------------------------------------------------------------
155+
156+### `++nuck`
157+
158+Top-level coin parser
159+
160+Parsing rule. Switches on the first character and applies the
161+corresponding [`++coin`]() parser.
162+
163+Accepts
164+-------
165+
166+Produces
167+--------
168+
169+Source
170+------
171+
172+ ++ nuck
173+ %+ knee *coin |. ~+
174+ %- stew
175+ ^. stet ^. limo
176+ :~ :- ['a' 'z'] (cook |=(a=@ta [~ %tas a]) sym)
177+ :- ['0' '9'] (stag ~ bisk)
178+ :- '-' (stag ~ tash)
179+ :- '.' ;~(pfix dot perd)
180+ :- '~' ;~(pfix sig ;~(pose twid (easy [~ %n 0])))
181+ ==
182+
183+Examples
184+--------
185+
186+ ~zod/try=> (scan "~pillyt" nuck:so)
187+ [% p=[p=~.p q=32.819]]
188+ ~zod/try=> (scan "0x12" nuck:so)
189+ [% p=[p=~.ux q=18]]
190+ ~zod/try=> (scan ".127.0.0.1" nuck:so)
191+ [% p=[p=~.if q=2.130.706.433]]
192+ ~zod/try=> `@ud`.127.0.0.1
193+ 2.130.706.433
194+ ~zod/try=> (scan "._20_0w25_sam__" nuck:so)
195+ [ %many
196+ p
197+ ~[[% p=[p=~.ud q=20]] [% p=[p=~.uw q=133]] [% p=[p=~.tas q=7.168.371]]]
198+ ]
199+ ~zod/try=> `@`%sam
200+ 7.168.371
201+ ~zod/try=> (scan "~0ph" nuck:so)
202+ [%blob p=[1 1]]
203+ ~zod/try=> ~0ph
204+ [1 1]
205+ ~zod/try=> `@uv`(jam [1 1])
206+ 0vph
207+
208+------------------------------------------------------------------------
209+
210+### `++nusk`
211+
212+Parse coin literal with escapes
213+
214+Parsing rule. Parses a coin literal with escapes. (See also: xx tuple
215+formatting).
216+
217+Accepts
218+-------
219+
220+Produces
221+--------
222+
223+Source
224+------
225+
226+ ++ nusk
227+ (sear |=(a=@ta (rush (wick a) nuck)) urt:ab)
228+
229+Examples
230+--------
231+
232+ ~zod/try=> ~.asd_a
233+ ~.asd_a
234+ ~zod/try=> ._1_~~.asd~-a__
235+ [1 ~.asd_a]
236+ ~zod/try=> (scan "~~.asd~-a" nusk:so)
237+ [% p=[p=~.ta q=418.212.246.369]]
238+ ~zod/try=> (,[~ %ta @ta] (scan "~~.asd~-a" nusk:so))
239+ [~ %ta ~.asd_a]
240+
241+------------------------------------------------------------------------
242+
243+### `++perd`
244+
245+Parsing rule.
246+
247+Parsing rule. Parses a dime or tuple without their respective standard
248+prefixes.
249+
250+Accepts
251+-------
252+
253+Produces
254+--------
255+
256+Source
257+------
258+
259+ ++ perd
260+ ;~ pose
261+ (stag ~ zust)
262+ (stag %many (ifix [cab ;~(plug cab cab)] (more cab nusk)))
263+ ==
264+
265+Examples
266+--------
267+
268+ ~zod/try=> (scan "y" perd:so)
269+ [~ [%f %.y]]
270+ ~zod/try=> (scan "n" perd:so)
271+ [~ [%f %.n]]
272+ ~zod/try=> |
273+ %.n
274+ ~zod/try=> (scan "_20_x__" perd:so)
275+ [%many [[% p=[p=~.ud q=20]] ~[[% p=[p=~.tas q=120]]]]]
276+
277+------------------------------------------------------------------------
278+
279+### `++royl`
280+
281+Parse dime float
282+
283+Parsing rule. Parses a number into a [`++dime`]() float.
284+
285+Accepts
286+-------
287+
288+Produces
289+--------
290+
291+Source
292+------
293+
294+ ++ royl
295+ =+ ^= zer
296+ (cook lent (star (just '0')))
297+ =+ ^= voy
298+ %+ cook royl-cell
299+ ;~ plug
300+ ;~(pose (cold | hep) (easy &))
301+ ;~(plug dim:ag ;~(pose ;~(pfix dot ;~(plug zer dim:ag)) (easy [0 0])))
302+ ;~ pose
303+ ;~ pfix
304+ (just 'e')
305+ (cook some ;~(plug ;~(pose (cold | hep) (easy &)) dim:ag))
306+ ==
307+ (easy ~)
308+ ==
309+ ==
310+ ;~ pose
311+ (stag %rh (cook rylh ;~(pfix ;~(plug sig sig) voy)))
312+ (stag %rq (cook rylq ;~(pfix ;~(plug sig sig sig) voy)))
313+ (stag %rd (cook ryld ;~(pfix sig voy)))
314+ (stag %rs (cook ryls voy)
315+ ==
316+
317+Examples
318+--------
319+
320+ ~zod/try=> (scan "~3.14" royl:so)
321+ [%rd .~3.13999999999999]
322+ ~zod/try=> .~3.14
323+ .~3.13999999999999
324+
325+------------------------------------------------------------------------
326+
327+### `++royl-cell`
328+
329+XX still not fully functional
330+
331+Intermediate parsed float convereter
332+
333+------------------------------------------------------------------------
334+
335+### `++tash`
336+
337+Parse signed dime
338+
339+Accepts
340+-------
341+
342+Accepts
343+-------
344+
345+Produces
346+--------
347+
348+Produces
349+--------
350+
351+Parsing rule. Parses a signed number into a [`++dime`]().
352+
353+Source
354+------
355+
356+ ++ royl-cell
357+ |= [a=? b=[c=@ d=@ e=@] f=(unit ,[h=? i=@])]
358+ ^- [? @ @ @ (unit ,@s)]
359+ ?~ f
360+ [a c.b d.b e.b ~]
361+ ?: h.u.f
362+ [a c.b d.b e.b [~ (mul i.u.f 2)]]
363+ [a c.b d.b e.b [~ (dec (mul i.u.f 2))]]
364+
365+Examples
366+--------
367+
368+Source
369+------
370+
371+ ++ tash
372+ =+ ^= neg
373+ |= [syn=? mol=dime] ^- dime
374+ ?> =('u' (end 3 1 p.mol))
375+ [(cat 3 's' (rsh 3 1 p.mol)) (new:si syn q.mol)]
376+ ;~ pfix hep
377+ ;~ pose
378+ (cook |=(a=dime (neg | a)) bisk)
379+ ;~(pfix hep (cook |=(a=dime (neg & a)) bisk))
380+ ==
381+ ==
382+
383+Examples
384+--------
385+
386+ ~zod/try=> (scan "-20" tash:so)
387+ [p=~.sd q=39]
388+ ~zod/try=> (,[%sd @sd] (scan "-20" tash:so))
389+ [%sd -20]
390+ ~zod/try=> (,[%sd @sd] (scan "--20" tash:so))
391+ [%sd --20]
392+ ~zod/try=> (,[%sx @sx] (scan "--0x2e" tash:so))
393+ [%sx --0x2e]
394+
395+------------------------------------------------------------------------
396+
397+### `++twid`
398+
399+Parse coins without `~` prefix
400+
401+Parsing rule. Parses coins after a leading sig, `~`.
402+
403+Accepts
404+-------
405+
406+Produces
407+--------
408+
409+Source
410+------
411+
412+ ++ twid
413+ ;~ pose
414+ (cook |=(a=@ [%blob (cue a)]) ;~(pfix (just '0') vum:ag))
415+ (stag ~ crub)
416+ ==
417+ ::
418+
419+Examples
420+--------
421+
422+ ~zod/try=> (scan "zod" twid:so)
423+ [~ [%p 0]]
424+ ~zod/try=> (scan ".sam" twid:so)
425+ [~ [%ta 7.168.371]]
426+ ~zod/try=> `@ud`~.sam
427+ 7.168.371
428+ ~zod/try=> `@t`~.sam
429+ 'sam'
430+ ~zod/try=> (scan "0ph" twid:so)
431+ [%blob [1 1]]
432+
433+------------------------------------------------------------------------
434+
435+### `++zust`
436+
437+Parse prefixed dimes from `@if`, `@f`, `@rd`
438+
439+Parsing rule. Parses an atom of either [`@if`]() (IP address), [`@f`]()
440+(loobean), or [`rf`]()(floating point) into a [`++dime`]().
441+
442+Accepts
443+-------
444+
445+Produces
446+--------
447+
448+Source
449+------
450+
451+ ++ zust
452+ ;~ pose
453+ (stag %is bip:ag)
454+ (stag %if lip:ag)
455+ (stag %f ;~(pose (cold & (just 'y')) (cold | (just 'n'))))
456+ royl
457+ ==
458+ --
459+
460+Examples
461+--------
462+
463+ ~zod/try=> (scan "127.0.0.1" zust:so)
464+ [%if q=2.130.706.433]
465+ ~zod/try=> (scan "af.0.0.0.0.e7a5.30d2.7" zust:so)
466+ [%is q=908.651.950.243.594.834.993.091.554.288.205.831]
467+ ~zod/try=> (,[%is @is] (scan "af.0.0.0.0.e7a5.30d2.7" zust:so))
468+ [%is .af.0.0.0.0.e7a5.30d2.7]
469+ ~zod/try=> (,[%is @ux] (scan "af.0.0.0.0.e7a5.30d2.7" zust:so))
470+ [%is 0xaf.0000.0000.0000.0000.e7a5.30d2.0007]
471+ ~zod/try=> (scan "y" zust:so)
472+ [%f %.y]
473+ ~zod/try=> (scan "12.09" zust:so)
474+ [%rd .~12.00999999999999]
475+
476+
docs/system/hoon/library/src/4m/gate/scot.mdnew file+40
@@ -0,0 +1,40 @@
1+### `++scot`
2+
3+Render dime as cord
4+
5+Renders a dime `mol` as a cord.
6+
7+Accepts
8+-------
9+
10+Produces
11+--------
12+
13+`mol` is a [`++dime`]().
14+
15+Source
16+------
17+
18+ ++ scot |=(mol=dime ~(rent co %$ mol))
19+
20+Examples
21+--------
22+
23+ ~zod/try=> (scot %p ~pillyt)
24+ ~.~pillyt
25+ ~zod/try=> `@t`(scot %p ~pillyt)
26+ '~pillyt'
27+ ~zod/try=> (scot %ux 0x12)
28+ ~.0x12
29+ ~zod/try=> `@t`(scot %ux 0x12)
30+ '0x12'
31+ ~zod/try=> (scot %if .127.0.0.1)
32+ ~..127.0.0.1
33+ ~zod/try=> `@t`(scot %if .127.0.0.1)
34+ '.127.0.0.1'
35+ ~zod/try=> (scot %ta ~.asd_a)
36+ ~.~.asd_a
37+ ~zod/try=> `@t`(scot %ta ~.asd_a)
38+ '~.asd_a'
39+
40+
docs/system/hoon/library/src/4m/gate/scow.mdnew file+32
@@ -0,0 +1,32 @@
1+### `++scow`
2+
3+Render dime as tape
4+
5+Renders `mol` as a tape.
6+
7+Accepts
8+-------
9+
10+Produces
11+--------
12+
13+`mol` is a [`++dime`]().
14+
15+Source
16+------
17+
18+ ++ scow |=(mol=dime ~(rend co %$ mol))
19+
20+Examples
21+--------
22+
23+ ~zod/try=> (scow %p ~pillyt)
24+ "~pillyt"
25+ ~zod/try=> (scow %ux 0x12)
26+ "0x12"
27+ ~zod/try=> (scow %if .127.0.0.1)
28+ ".127.0.0.1"
29+ ~zod/try=> (scow %ta ~.asd_a)
30+ "~.asd_a"
31+
32+
docs/system/hoon/library/src/4m/gate/slat.mdnew file+35
@@ -0,0 +1,35 @@
1+### `++slat`
2+
3+Curried slaw
4+
5+Produces a [`gate`]() that parses a [`term`]() `txt` to an atom of the
6+odor specified by `mod`.
7+
8+Accepts
9+-------
10+
11+Produces
12+--------
13+
14+`mod` is a term, an atom of odor [`@tas`]().
15+
16+`txt` is a span, an atom of odor [`@ta`]().
17+
18+Source
19+------
20+
21+ ++ slat |=(mod=@tas |=(txt=@ta (slaw mod txt)))
22+
23+Examples
24+--------
25+
26+ ~zod/try=> `(unit ,@p)`((slat %p) '~pillyt')
27+ [~ ~pillyt]
28+ ~zod/try=> `(unit ,@ux)`((slat %ux) '0x12')
29+ [~ 0x12]
30+ ~zod/try=> `(unit ,@if)`((slat %if) '.127.0.0.1')
31+ [~ .127.0.0.1]
32+ ~zod/try=> `(unit ,@ta)`((slat %ta) '~.asd_a')
33+ [~ ~.asd_a
34+
35+
docs/system/hoon/library/src/4m/gate/slav.mdnew file+43
@@ -0,0 +1,43 @@
1+### `++slav`
2+
3+Demand: parse span with input odor
4+
5+Parses a span `txt` to an atom of the odor specificed by `mod`. Crashes
6+if it failes to parse.
7+
8+Accepts
9+-------
10+
11+Produces
12+--------
13+
14+`mod` is a term, an atom of odor [`@tas`]().
15+
16+`txt` is a span, an atom of odor [`@ta`]().
17+
18+Source
19+------
20+
21+ ++ slav |=([mod=@tas txt=@ta] (need (slaw mod txt)))
22+
23+Examples
24+--------
25+
26+ ~zod/try=> `@p`(slav %p '~pillyt')
27+ ~pillyt
28+ ~zod/try=> `@p`(slav %p '~pillam')
29+ ! exit
30+ ~zod/try=> `@ux`(slav %ux '0x12')
31+ 0x12
32+ ~zod/try=> `@ux`(slav %ux '0b10')
33+ ! exit
34+ ~zod/try=> `@if`(slav %if '.127.0.0.1')
35+ .127.0.0.1
36+ ~zod/try=> `@if`(slav %if '.fe80.0.0.202')
37+ ! exit
38+ ~zod/try=> `@ta`(slav %ta '~.asd_a')
39+ ~.asd_a
40+ ~zod/try=> `@ta`(slav %ta '~~asd-a')
41+ ! exit
42+
43+
docs/system/hoon/library/src/4m/gate/slaw.mdnew file+47
@@ -0,0 +1,47 @@
1+### `++slaw`
2+
3+Parse span to input odor
4+
5+Parses a span `txt` to an atom of the odor specified by `mod`.
6+
7+Accepts
8+-------
9+
10+Produces
11+--------
12+
13+`mod` is a term, an atom of odor [`@tas`]().
14+
15+`txt` is a span, an atom of odor [`@ta`]().
16+
17+Source
18+------
19+
20+ ++ slaw
21+ |= [mod=@tas txt=@ta]
22+ ^- (unit ,@)
23+ =+ con=(slay txt)
24+ ?.(&(?=([~ %$ @ @] con) =(p.p.u.con mod)) ~ [~ q.p.u.con])
25+ ::
26+
27+Examples
28+--------
29+
30+ ~zod/try=> `(unit ,@p)`(slaw %p '~pillyt')
31+ [~ ~pillyt]
32+ ~zod/try=> `(unit ,@p)`(slaw %p '~pillam')
33+ ~
34+ ~zod/try=> `(unit ,@ux)`(slaw %ux '0x12')
35+ [~ 0x12]
36+ ~zod/try=> `(unit ,@ux)`(slaw %ux '0b10')
37+ ~
38+ ~zod/try=> `(unit ,@if)`(slaw %if '.127.0.0.1')
39+ [~ .127.0.0.1]
40+ ~zod/try=> `(unit ,@if)`(slaw %if '.fe80.0.0.202')
41+ ~
42+ ~zod/try=> `(unit ,@ta)`(slaw %ta '~.asd_a')
43+ [~ ~.asd_a]
44+ ~zod/try=> `(unit ,@ta)`(slaw %ta '~~asd-a')
45+ ~
46+
47+
docs/system/hoon/library/src/4m/gate/slay.mdnew file+54
@@ -0,0 +1,54 @@
1+### `++slay`
2+
3+Parse span to coin
4+
5+Parses a span `txt` to the unit of a [`++coin`]().
6+
7+Accepts
8+-------
9+
10+Produces
11+--------
12+
13+`txt` is a [`@ta`]().
14+
15+Source
16+------
17+
18+ ++ slay
19+ |= txt=@ta ^- (unit coin)
20+ =+ vex=((full nuck:so) [[1 1] (trip txt)])
21+ ?~ q.vex
22+ ~
23+ [~ p.u.q.vex]
24+ ::
25+
26+Examples
27+--------
28+
29+ ~zod/try=> (slay '~pillyt')
30+ [~ [% p=[p=~.p q=32.819]]]
31+ ~zod/try=> (slay '0x12')
32+ [~ [% p=[p=~.ux q=18]]]
33+ ~zod/try=> (slay '.127.0.0.1')
34+ [~ [% p=[p=~.if q=2.130.706.433]]]
35+ ~zod/try=> `@ud`.127.0.0.1
36+ 2.130.706.433
37+ ~zod/try=> (slay '._20_0w25_sam__')
38+ [ ~
39+ [ %many
40+ p=~[[% p=[p=~.ud q=20]] [% p=[p=~.uw q=133]] [% p=[p=~.tas q=7.168.371]]]
41+ ]
42+ ]
43+ ~zod/try=> `@`%sam
44+ 7.168.371
45+ ~zod/try=> (slay '~0ph')
46+ [~ [%blob p=[1 1]]]
47+ ~zod/try=> 0ph
48+ ~ <syntax error at [1 2]>
49+ ~zod/try=> ~0ph
50+ [1 1]
51+ ~zod/try=> `@uv`(jam [1 1])
52+ 0vph
53+
54+
docs/system/hoon/library/src/4m/gate/smyt.mdnew file+43
@@ -0,0 +1,43 @@
1+### `++smyt`
2+
3+Render path as tank
4+
5+Renders the path `bon` as a [`tank`](), which is used for
6+pretty-printing.
7+
8+Accepts
9+-------
10+
11+Produces
12+--------
13+
14+`bon` is a [`++path`]().
15+
16+Source
17+------
18+
19+ ++ smyt
20+ |= bon=path ^- tank
21+ :+ %rose [['/' ~] ['/' ~] ['/' ~]]
22+ |- ^- (list tank)
23+ (turn bon |=(a=@ [%leaf (rip 3 a)]))
24+
25+Examples
26+--------
27+
28+ ~zod/try=> (smyt %)
29+ [ %rose
30+ p=[p="/" q="/" r="/"]
31+ q
32+ ~[ [%leaf p="~zod"]
33+ [%leaf p="try"]
34+ [%leaf p="~2014.10.28..18.36.58..a280"]
35+ ]
36+ ]
37+ ~zod/try=> (smyt /as/les/top)
38+ [ %rose
39+ p=[p="/" q="/" r="/"]
40+ q=~[[%leaf p="as"] [%leaf p="les"] [%leaf p="top"]]
41+ ]
42+
43+
docs/system/hoon/library/src/4m/gate/spat.mdnew file+30
@@ -0,0 +1,30 @@
1+### `++spat`
2+
3+Render path as cord
4+
5+Renders a path `pax` as cord.
6+
7+Accepts
8+-------
9+
10+Produces
11+--------
12+
13+`pax` is a [`path`]().
14+
15+Source
16+------
17+
18+ ++ spat |=(pax=path (crip (spud pax))) :: path to cord
19+
20+Examples
21+--------
22+
23+ ~zod/try=> (spat %)
24+ '~zod/try/~2014.10.28..18.40.20..4287'
25+ ~zod/try=> (spat %/bin)
26+ '~zod/try/~2014.10.28..18.41.12..3bcd/bin'
27+ ~zod/try=> (spat /as/les/top)
28+ '/as/les/top'
29+
30+
docs/system/hoon/library/src/4m/gate/spud.mdnew file+30
@@ -0,0 +1,30 @@
1+### `++spud`
2+
3+Render path as tape
4+
5+Renders a path `pax` as [tape]().
6+
7+Accepts
8+-------
9+
10+Produces
11+--------
12+
13+`pax` is a [`path`]().
14+
15+Source
16+------
17+
18+ ++ spud |=(pax=path ~(ram re (smyt pax))) :: path to tape
19+
20+Examples
21+--------
22+
23+ ~zod/try=> (spud %)
24+ "~zod/try/~2014.10.28..18.40.46..e951"
25+ ~zod/try=> (spud %/bin)
26+ "~zod/try/~2014.10.28..18.41.05..16f2/bin"
27+ ~zod/try=> (spud /as/les/top)
28+ "/as/les/top"
29+
30+
docs/system/hoon/library/src/4m/gate/stab.mdnew file+35
@@ -0,0 +1,35 @@
1+### `++stab`
2+
3+Parse span to path
4+
5+Parsing rule. Parses a span `zep` to a static [`++path`](/doc/hoon/library/1#++path).
6+
7+Accepts
8+-------
9+
10+Produces
11+--------
12+
13+Source
14+------
15+
16+ ++ stab :: parse span to path
17+ |= zep=@ta ^- path
18+ (rash zep ;~(pfix fas ;~(sfix (more fas urs:ab) fas)))
19+
20+Examples
21+--------
22+
23+ ~zod/try=> (stab '/as/lek/tor')
24+ /as/lek/tor
25+ ~zod/try=> `(pole ,@ta)`(stab '/as/lek/tor')
26+ [~.as [~.lek [~.tor ~]]]
27+ ~zod/try=> (stab '~zod/arvo/~2014.10.28..18.48.41..335f/zuse')
28+ ~zod/arvo/~2014.10.28..18.48.41..335f/zuse
29+ ~zod/try=> `(pole ,@ta)`(stab '~zod/arvo/~2014.10.28..18.48.41..335f/zuse')
30+ [~.~zod [~.arvo [~.~2014.10.28..18.48.41..335f [~.zuse ~]]]]
31+ ~zod/try=> (stab '/a/~pillyt/pals/1')
32+ /a/~pillyt/pals/1
33+ ~zod/try=> `(pole ,@ta)`(stab '/a/~pillyt/pals/1')
34+ [~.a [~.~pillyt [~.pals [~.1 ~]]]]
35+
docs/system/hoon/library/src/4n/gate/mack.mdnew file+45
@@ -0,0 +1,45 @@
1+### `++mack`
2+
3+Nock subject to unit
4+
5+Accepts a nock subject-formula cell and wraps it into a [`++unit`]().
6+`fol` is pure nock, meaning that nock `11` operations result in a block,
7+producing a `~`.
8+
9+Accepts
10+-------
11+
12+`sub` is a subject [noun]().
13+
14+`fol` is a formula noun, which is generally a `++nock`.
15+
16+Produces
17+--------
18+
19+The `++unit` of a noun.
20+
21+Source
22+------
23+
24+ ++ mack
25+ |= [sub=* fol=*]
26+ ^- (unit)
27+ =+ ton=(mink [sub fol] |=(* ~))
28+ ?.(?=([0 *] ton) ~ [~ p.ton])
29+ ::
30+
31+Examples
32+--------
33+
34+ ~zod/try=> (mack [[1 2 3] [0 1]])
35+ [~ [1 2 3]]
36+ ~zod/try=> (mack [41 4 0 1])
37+ [~ 42]
38+ ~zod/try=> (mack [4 0 4])
39+ ~
40+ ~zod/try=> (mack [[[0 2] [1 3]] 4 4 4 4 0 5])
41+ [~ 6]
42+ ~zod/try=> ;;((unit ,@tas) (mack [[1 %yes %no] 6 [0 2] [0 6] 0 7]))
43+ [~ %no]
44+
45+
docs/system/hoon/library/src/4n/gate/mink.mdnew file+122
@@ -0,0 +1,122 @@
1+### `++mink`
2+
3+Mock interpreter
4+
5+Bottom-level [mock]() (virtual nock) interpreter. Produces a
6+[`++tone`](), a nock computation result. If nock 11 is invoked, `sky`
7+computes on the subject and produces a [`++unit`]() result. An empty
8+result becomes a `%1` `++tone`, indicating a block.
9+
10+Accepts
11+-------
12+
13+`sub` is the subject as a [noun]().
14+
15+`fol` is the formula as a noun.
16+
17+`sky` is an [`%iron`]() gate invoked with [nock operator 11]().
18+
19+Produces
20+--------
21+
22+A `++tone`.
23+
24+Source
25+------
26+
27+ ++ mink
28+ ~/ %mink
29+ |= [[sub=* fol=*] sky=$+(* (unit))]
30+ =+ tax=*(list ,[@ta *])
31+ |- ^- tone
32+ ?@ fol
33+ [%2 tax]
34+ ?: ?=(^ -.fol)
35+ =+ hed=$(fol -.fol)
36+ ?: ?=(%2 -.hed)
37+ hed
38+ =+ tal=$(fol +.fol)
39+ ?- -.tal
40+ %0 ?-(-.hed %0 [%0 p.hed p.tal], %1 hed)
41+ %1 ?-(-.hed %0 tal, %1 [%1 (weld p.hed p.tal)])
42+ %2 tal
43+ ==
44+ ?+ fol
45+ [%2 tax]
46+ ::
47+ [0 b=@]
48+ ?: =(0 b.fol) [%2 tax]
49+ ?: =(1 b.fol) [%0 sub]
50+ ?: ?=(@ sub) [%2 tax]
51+ =+ [now=(cap b.fol) lat=(mas b.fol)]
52+ $(b.fol lat, sub ?:(=(2 now) -.sub +.sub))
53+ ::
54+ [1 b=*]
55+ [%0 b.fol]
56+ ::
57+ [2 b=[^ *]]
58+ =+ ben=$(fol b.fol)
59+ ?. ?=(%0 -.ben) ben
60+ ?>(?=(^ p.ben) $(sub -.p.ben, fol +.p.ben))
61+ ::?>(?=(^ p.ben) $([sub fol] p.ben)
62+ ::
63+ [3 b=*]
64+ =+ ben=$(fol b.fol)
65+ ?. ?=(%0 -.ben) ben
66+ [%0 .?(p.ben)]
67+ ::
68+ [4 b=*]
69+ =+ ben=$(fol b.fol)
70+ ?. ?=(%0 -.ben) ben
71+ ?. ?=(@ p.ben) [%2 tax]
72+ [%0 .+(p.ben)]
73+ ::
74+ [5 b=*]
75+ =+ ben=$(fol b.fol)
76+ ?. ?=(%0 -.ben) ben
77+ ?. ?=(^ p.ben) [%2 tax]
78+ [%0 =(-.p.ben +.p.ben)]
79+ ::
80+ [6 b=* c=* d=*]
81+ $(fol =>(fol [2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b]))
82+ ::
83+ [7 b=* c=*] $(fol =>(fol [2 b 1 c]))
84+ [8 b=* c=*] $(fol =>(fol [7 [[0 1] b] c]))
85+ [9 b=* c=*] $(fol =>(fol [7 c 0 b]))
86+ [10 @ c=*] $(fol c.fol)
87+ [10 [b=* c=*] d=*]
88+ =+ ben=$(fol c.fol)
89+ ?. ?=(%0 -.ben) ben
90+ ?: ?=(?(%hunk %lose %mean %spot) b.fol)
91+ $(fol d.fol, tax [[b.fol p.ben] tax])
92+ $(fol d.fol)
93+ ::
94+ [11 b=*]
95+ =+ ben=$(fol b.fol)
96+ ?. ?=(%0 -.ben) ben
97+ =+ val=(sky p.ben)
98+ ?~(val [%1 p.ben ~] [%0 u.val])
99+ ::
100+ ==
101+ ::
102+
103+Examples
104+--------
105+
106+ ~zod/try=> (mink [20 [4 0 1]] ,~)
107+ [%0 p=21]
108+ ~zod/try=> (mink [[90 5 3] [0 3]] ,~)
109+ [%0 p=[5 3]]
110+ ~zod/try=> (mink 20^[4 0 1] ,~)
111+ [%0 p=21]
112+ ~zod/try=> (mink [90 5 3]^[0 3] ,~)
113+ [%0 p=[5 3]]
114+ ~zod/try=> (mink [0]^[11 1 20] ,~)
115+ [%1 p=~[20]]
116+ ~zod/try=> (mink [0]^[11 1 20] |=(a=* `[40 a]))
117+ [%0 p=[40 20]]
118+ ~zod/try=> (mink [5]^[0 2] ,~)
119+ [%2 p=~]
120+ ~zod/try=> (mink [5]^[10 yelp/[0 1] 0 0] ,~)
121+ [%2 p=~[[~.yelp 5]]]
122+
docs/system/hoon/library/src/4n/gate/mock.mdnew file+50
@@ -0,0 +1,50 @@
1+### `++mock`
2+
3+Compute formula on subject with hint
4+
5+Produces a [`++toon`](), which is either a sucessful, blocked, or
6+crashed result. If nock 11 is invoked, `sky` computes on the subject and
7+produces a [`++unit`]() result. An empty result becomes a `%1` `++tune`,
8+indicating a block.
9+
10+Accepts
11+-------
12+
13+`sub` is the subject as a [noun]().
14+
15+`fol` is the formula as a noun.
16+
17+`sky` is an [%iron]() gate invoked with [nock operator 11]().
18+
19+Produces
20+--------
21+
22+The `++unit` of a noun.
23+
24+Source
25+------
26+
27+ ++ mock
28+ |= [[sub=* fol=*] sky=$+(* (unit))]
29+ (mook (mink [sub fol] sky))
30+ ::
31+
32+Examples
33+--------
34+
35+ ~zod/try=> (mock [5 4 0 1] ,~)
36+ [%0 p=6]
37+ ~zod/try=> (mock [~ 11 1 0] |=(* `999))
38+ [%0 p=999]
39+ ~zod/try=> (mock [~ 0 1.337] ,~)
40+ [%2 p=~]
41+ ~zod/try=> (mock [~ 11 1 1.337] ,~)
42+ [%1 p=~[1.337]]
43+ ~zod/try=> (mock [[[4 4 4 4 0 3] 10] 11 9 2 0 1] |=(* `[+<]))
44+ [%0 p=14]
45+ ~zod/try=> (mock [[[4 4 4 4 0 3] 10] 11 9 2 0 1] |=(* `[<+<>]))
46+ [%0 p=[49 52 0]]
47+ ~zod/try=> ;;(tape +:(mock [[[4 4 4 4 0 3] 10] 11 9 2 0 1] |=(* `[<+<>])))
48+ "14"
49+
50+
docs/system/hoon/library/src/4n/gate/mong.mdnew file+55
@@ -0,0 +1,55 @@
1+### `++mong`
2+
3+Slam gate with sample
4+
5+Produces a [`++toon`]() computation result from slamming `gat` with
6+`sam`, using `sky` to compute or block on nock 11 when applicable.
7+
8+Accepts
9+-------
10+
11+`gat` is a [noun]() that is generally a [`gate`]().
12+
13+`sam` is a [`sample`]() noun.
14+
15+`sky` is an [%iron]() gate invoked with [nock operator 11]().
16+
17+Produces
18+--------
19+
20+A `++toon`.
21+
22+Source
23+------
24+
25+ ++ mong
26+ |= [[gat=* sam=*] sky=$+(* (unit))]
27+ ^- toon
28+ ?. &(?=(^ gat) ?=(^ +.gat))
29+ [%2 ~]
30+ (mock [[-.gat [sam +>.gat]] -.gat] sky)
31+ ::
32+
33+Examples
34+--------
35+
36+ ~zod/try=> (mong [|=(@ 20) ~] ,~)
37+ [%0 p=20]
38+ ~zod/try=> (mong [|=(@ !!) ~] ,~)
39+ [%2 p=~]
40+ ~zod/try=> (mong [|=(a=@ (add 20 a)) ~] ,~)
41+ [%0 p=20]
42+ ~zod/try=> (mong [|=(a=[@ @] (add 20 -.a)) ~] ,~)
43+ [%2 p=~]
44+ ~zod/try=> (mong [|=(a=[@ @] (add 20 -.a)) [4 6]] ,~)
45+ [%0 p=24]
46+ ~zod/try=> (mong [|=(a=@ .^(a)) ~] ,~)
47+ [%1 p=~[0]]
48+ ~zod/try=> (mong [|=(a=@ .^(a)) ~] ,[~ %42])
49+ [%0 p=42]
50+ ~zod/try=> (mong [|=(a=@ .^(a)) ~] |=(a=* [~ a 6]))
51+ [%0 p=[0 6]]
52+ ~zod/try=> (mong [|=(a=@ .^(a)) 8] |=(a=* [~ a 6]))
53+ [%0 p=[8 6]]
54+
55+
docs/system/hoon/library/src/4n/gate/mook.mdnew file+82
@@ -0,0 +1,82 @@
1+### `++mook`
2+
3+Intelligently render crash annotation
4+
5+Converts a `%2` `++tone` nock stack trace to a list of [`++tank`]().
6+Each may be a tank, cord, [`++spot`](), or trapped tank.
7+
8+Accepts
9+-------
10+
11+`ton` is a [`++tone`]().
12+
13+Produces
14+--------
15+
16+A [`++toon`]().
17+
18+Source
19+------
20+
21+ ++ mook
22+ |= ton=tone
23+ ^- toon
24+ ?. ?=([2 *] ton) ton
25+ :- %2
26+ =+ yel=(lent p.ton)
27+ =. p.ton
28+ ?. (gth yel 256) p.ton
29+ %+ weld
30+ (scag 128 p.ton)
31+ ^- (list ,[@ta *])
32+ :_ (slag (sub yel 128) p.ton)
33+ :- %lose
34+ %+ rap 3
35+ ;: weld
36+ "[skipped "
37+ ~(rend co %$ %ud (sub yel 256))
38+ " frames]"
39+ ==
40+ |- ^- (list tank)
41+ ?~ p.ton ~
42+ =+ rex=$(p.ton t.p.ton)
43+ ?+ -.i.p.ton rex
44+ %hunk [(tank +.i.p.ton) rex]
45+ %lose [[%leaf (rip 3 (,@ +.i.p.ton))] rex]
46+ %mean :_ rex
47+ ?@ +.i.p.ton [%leaf (rip 3 (,@ +.i.p.ton))]
48+ =+ mac=(mack +.i.p.ton +<.i.p.ton)
49+ ?~(mac [%leaf "####"] (tank u.mac))
50+ %spot :_ rex
51+ =+ sot=(spot +.i.p.ton)
52+ :- %leaf
53+ ;: weld
54+ ~(ram re (smyt p.sot))
55+ ":<["
56+ ~(rend co ~ %ud p.p.q.sot)
57+ " "
58+ ~(rend co ~ %ud q.p.q.sot)
59+ "].["
60+ ~(rend co ~ %ud p.q.q.sot)
61+ " "
62+ ~(rend co ~ %ud q.q.q.sot)
63+ "]>"
64+ ==
65+ ==
66+ ::
67+
68+Examples
69+--------
70+
71+ ~zod/try=> (mook [%0 5 4 5 1])
72+ [%0 p=[5 4 5 1]]
73+ ~zod/try=> (mook [%2 ~[[%hunk %rose ["<" "," ">"] ~[[%leaf "err"]]]]])
74+ [%2 p=~[[%rose p=[p="<" q="," r=">"] q=[i=[%leaf p="err"] t=~]]]]
75+ ~zod/try=> (mook [%2 ~[[%malformed %elem] [%lose 'do print']]])
76+ [%2 p=~[[%leaf p="do print"]]]
77+ ~zod/try=> (mook [%2 ~[[%mean |.(>(add 5 6)<)]]])
78+ [%2 p=~[[%leaf p="11"]]]
79+ ~zod/try=> (mook [%2 ~[[%spot /b/repl [1 1]^[1 2]] [%mean |.(!!)]]])
80+ [%2 p=~[[%leaf p="/b/repl/:<[1 1].[1 2]>"] [%leaf p="####"]]]
81+
82+
docs/system/hoon/library/src/4n/gate/mule.mdnew file+52
@@ -0,0 +1,52 @@
1+### `++mule`
2+
3+Typed virtual
4+
5+Kicks a [`++trap`](), producing its results or any errors that occur along
6+the way. Used to lazily compute stack traces.
7+
8+Accepts
9+-------
10+
11+`taq` is a [`++trap`](), generally producing a list of [`++tank`]()s.
12+
13+Produces
14+--------
15+
16+XX
17+
18+Source
19+------
20+
21+ ++ mule :: typed virtual
22+ ~/ %mule
23+ |* taq=_|.(_*)
24+ =+ mud=(mute taq)
25+ ?- -.mud
26+ & [%& p=$:taq]
27+ | [%| p=p.mud]
28+ ==
29+ ::
30+
31+Examples
32+--------
33+
34+ ~zod/try=> (mule |.(leaf/"hello"))
35+ [%.y p=[%leaf "hello"]]
36+ ~zod/try=> (mule |.(!!))
37+ [%.n p=~]
38+ ~zod/try=> (mule |.(.^(a//=pals/1)))
39+ [ %.n
40+ p
41+ ~[
42+ [ %rose
43+ p=[p="/" q="/" r="/"]
44+ q
45+ [ i=[%leaf p="a"]
46+ t=[i=[%leaf p="~zod"] t=[i=[%leaf p="pals"] t=[i=[%leaf p="1"] t=~]]]
47+ ]
48+ ]
49+ ]
50+ ]
51+
52+
docs/system/hoon/library/src/4n/gate/mute.mdnew file+50
@@ -0,0 +1,50 @@
1+### `++mute`
2+
3+Untyped virtual
4+
5+Kicks a `++trap`, producing its result as a noun or the tanks of any
6+error that occurs. Similar to [`++mule`](), but preserves no type
7+information.
8+
9+Accepts
10+-------
11+
12+`taq` is a [`++trap`](/doc/hoon/library/1#++trap).
13+
14+Produces
15+--------
16+
17+Either a noun or a [`++list`]() of [`++tank`]().
18+
19+Source
20+------
21+
22+ ++ mute :: untyped virtual
23+ |= taq=_^?(|.(_*))
24+ ^- (each ,* (list tank))
25+ =+ ton=(mock [taq 9 2 0 1] |=(* ~))
26+ ?- -.ton
27+ %0 [%& p.ton]
28+ %1 [%| (turn p.ton |=(a=* (smyt (path a))))]
29+ %2 [%| p.ton]
30+ ==
31+
32+Examples
33+--------
34+
35+ ~zod/try=> (mute |.(leaf/"hello"))
36+ [%.y p=[1.717.658.988 104 101 108 108 111 0]]
37+ ~zod/try=> (mute |.(!!))
38+ [%.n p=~]
39+ ~zod/try=> (mute |.(.^(a//=pals/1)))
40+ [ %.n
41+ p
42+ ~[
43+ [ %rose
44+ p=[p="/" q="/" r="/"]
45+ q=[i=[%leaf p="a"] t=[i=[%leaf p="~zod"] t=[i=[%leaf p="pals"] t=[i=[%leaf p="1"] t=~]]]]
46+ ]
47+ ]
48+ ]
49+
50+
docs/system/hoon/library/src/4o/mold/abel.mdnew file+16
@@ -0,0 +1,16 @@
1+### `++abel`
2+
3+Biblical names in hoon are primarily aliases for the compiler.
4+
5+Source
6+------
7+
8+ ++ abel typo :: original sin: type
9+
10+Examples
11+--------
12+
13+ ~zod/try=> *abel
14+ %void
15+
16+
docs/system/hoon/library/src/4o/mold/aura.mdnew file+22
@@ -0,0 +1,22 @@
1+### `++aura`
2+
3+'type' of atom
4+
5+By convention, a short name for a category of atom. `++aura` is
6+circularly defined, with [`@ta`]() being the `++aura` of the ASCII subset
7+commonly used in urbit.
8+
9+Source
10+------
11+
12+ ++ aura ,@ta :: atom format
13+
14+Examples
15+--------
16+
17+See also: [`++base`](), [aura reference]()
18+
19+ ~zod/try=> `aura`%ux
20+ ~.ux
21+
22+
docs/system/hoon/library/src/4o/mold/axis.mdnew file+25
@@ -0,0 +1,25 @@
1+
2+### `++axis`
3+
4+Nock axis
5+
6+A Nock axis inside a [noun](). After the leading 1, in binary, a `1` signfies
7+right and `0` left.
8+
9+Source
10+------
11+
12+ ++ axis ,@ :: tree address
13+
14+Examples
15+--------
16+
17+ ~zod/try=> *axis
18+ 0
19+
20+ ~zod/try=> :: 0 is not actually a valid axis
21+ ~zod/try=> [[4 5] 6 7]
22+ [[4 5] 6 7]
23+ ~zod/try=> `axis`0b110
24+ 6
25+
docs/system/hoon/library/src/4o/mold/base.mdnew file+27
@@ -0,0 +1,27 @@
1+
2+### `++base`
3+
4+Base type
5+
6+A base type that [noun]()s are built from. A `++base` is either a noun, cell, boolean or
7+null labelled with an [odor]().
8+
9+Source
10+------
11+
12+ ++ base ?([%atom p=odor] %noun %cell %bean %null) :: axils, @ * ^ ? ~
13+
14+Examples
15+--------
16+
17+ ~zod/try=> *base
18+ %null
19+
20+ ~zod/try=> (ream '=|(^ !!)')
21+ [%tsbr p=[%axil p=%cell] q=[%zpzp ~]]
22+ ~zod/try=> :: p.p is a ++base
23+ ~zod/try=> (ream '=|(@t !!)')
24+ [%tsbr p=[%axil p=[%atom p=~.t]] q=[%zpzp ~]]
25+ ~zod/try=> (ream '=|(? !!)')
26+ [%tsbr p=[%axil p=%bean] q=[%zpzp ~]]
27+
docs/system/hoon/library/src/4o/mold/bean.mdnew file+23
@@ -0,0 +1,23 @@
1+### `++bean`
2+
3+Boolean
4+
5+`0`, `&`, or `%.y` are true, and `1`, `|`, and `%.n` are false.
6+
7+Source
8+------
9+
10+ ++ bean ,? :: 0=&=yes, 1=|=no
11+
12+Examples
13+--------
14+
15+ ~zod/try=> *bean
16+ %.y
17+
18+ ~zod/try=> `bean`&
19+ %.y
20+ ~zod/try=> `bean`|
21+ %.n
22+
23+
docs/system/hoon/library/src/4o/mold/beer.mdnew file+19
@@ -0,0 +1,19 @@
1+### `++beer`
2+
3+Tape builder
4+
5+Used to build [tape]()s internally.
6+
7+Source
8+------
9+
10+ ++ beer $|(@ [~ p=twig]) :: simple embed
11+
12+Examples
13+--------
14+
15+ ~zod/try=> `beer`'as'
16+ 29.537
17+ ~zod/try=> `beer`[~ (ream 'lan')]
18+ [~ p=[%cnzz p=~[%lan]]]
19+
docs/system/hoon/library/src/4o/mold/beet.mdnew file+18
@@ -0,0 +1,18 @@
1+### `++beet`
2+
3+XML interpolation cases
4+
5+Used internally.
6+
7+Source
8+------
9+
10+ ++ beet $| @ :: advanced embed
11+ $% [%a p=twig] :: take tape
12+ [%b p=twig] :: take manx
13+ [%c p=twig] :: take marl
14+ [%d p=twig] :: take $+(marl marl)
15+ [%e p=twig q=(list tuna)] :: element literal
16+ == ::
17+
18+
docs/system/hoon/library/src/4o/mold/chum.mdnew file+29
@@ -0,0 +1,29 @@
1+### `++chum`
2+
3+Jet hint information
4+
5+Jet hint information that must be present in the body of a `~/` or `~%`
6+rune. A `++chum` can optionally contain a kelvin version, jet vendor,
7+and "{major}.{minor}" version number.
8+
9+Source
10+------
11+
12+ ++ chum $? lef=term :: jet name
13+ [std=term kel=@] :: kelvin version
14+ [ven=term pro=term kel=@] :: vendor and product
15+ [ven=term pro=term ver=@ kel=@] :: all of the above
16+ == ::
17+
18+Examples
19+--------
20+
21+XX there's a ++chum in zuse that's politely causing this not to work
22+
23+ ~zod/try=> `chum`'hi'
24+ lef=%hi
25+
26+ ~zod/try=> (ream '~/(%lob.314 !!)')
27+ [%sgfs p=[std=%lob kel=314] q=[%zpzp ~]]
28+
29+
docs/system/hoon/library/src/4o/mold/coil.mdnew file+16
@@ -0,0 +1,16 @@
1+### `++coil`
2+
3+Tuple of core information
4+
5+Variance `p`, subject type `q`, and `q`: optional compiled nock, and arms. Used as an
6+intermediate step within Section 2fB. Converted by `++core` to %core type.
7+
8+Source
9+------
10+
11+ ++ coil $: p=?(%gold %iron %lead %zinc) :: core type
12+ q=type ::
13+ r=[p=?(~ ^) q=(map term foot)] ::
14+ == ::
15+
16+
docs/system/hoon/library/src/4o/mold/foot.mdnew file+31
@@ -0,0 +1,31 @@
1+### `++foot`
2+
3+Cases of arms by variance model.
4+
5+`%ash` arms are [`dry`]() and [geometric]().
6+
7+Source
8+------
9+
10+ ++ foot $% [%ash p=twig] :: dry arm, geometric
11+ [%elm p=twig] :: wet arm, generic
12+ [%oak ~] :: XX not used
13+ [%yew p=(map term foot)] :: XX not used
14+ == ::
15+
16+Examples
17+--------
18+
19+See also: [`++ap`](), [`++ut`]()
20+
21+ ~zod/try=> *foot
22+ [%yew p={}]
23+
24+ ~zod/try=> (ream '|% ++ $ foo --')
25+ [%brcn p={[p=%$ q=[%ash p=[%cnzz p=~[%foo]]]]}]
26+ ~zod/try=> +<+:(ream '|% ++ $ foo --')
27+ t=~[%ash %cnzz %foo]
28+ ~zod/try=> (foot +<+:(ream '|% ++ $ foo --'))
29+ [%ash p=[%cnzz p=~[%foo]]]
30+ ~zod/try=> (foot +<+:(ream '|% +- $ foo --'))
31+ [%elm p=[%cnzz p=~[%foo]]]
docs/system/hoon/library/src/4o/mold/limb.mdnew file+18
@@ -0,0 +1,18 @@
1+### `++limb`
2+
3+ ++ limb $|(term $%([%& p=axis] [%| p=@ud q=term])) ::
4+
5+XX move to `++ut`
6+
7+Reference into subject by name/axis
8+
9+See also: section 2fC-2fD
10+
11+ ~zod/try=> (ream '^^$')
12+ [%cnzz p=~[[%.n p=2 q=%$]]]
13+ ~zod/try=> (limb &2:(ream '^^$'))
14+ [%.n p=2 q=%$]
15+ ~zod/try=> (limb &2:(ream '^^^$'))
16+ [%.n p=3 q=%$]
17+
18+
docs/system/hoon/library/src/4o/mold/line.mdnew file+28
@@ -0,0 +1,28 @@
1+### `++line`
2+
3+XX move to `++ut`
4+
5+Source
6+------
7+
8+ ++ line ,[p=[%leaf p=odor q=@] q=tile] :: %kelp case
9+
10+
11+Examples
12+--------
13+
14+ ~zod/try=> (ream '$%([1 a] [%2 b])')
15+ [ %bccm
16+ p
17+ [ %kelp
18+ p
19+ [ i=[p=[%leaf p=~.ud q=1] q=[%herb p=[%cnzz p=~[%a]]]]
20+ t=~[[p=[%leaf p=~.ud q=2] q=[%herb p=[%cnzz p=~[%b]]]]]
21+ ]
22+ ]
23+ ]
24+ ~zod/try=> &3:(ream '$%([1 a] [%2 b])')
25+ p=[p=[%leaf p=%ud q=1] q=[%herb p=[%cnzz p=~[%a]]]]
26+ ~zod/try=> (line &3:(ream '$%([1 a] [%2 b])'))
27+ [p=[%leaf p=~.ud q=1] q=[%herb p=[%cnzz p=~[%a]]]]
28+
docs/system/hoon/library/src/4o/mold/metl.mdnew file+9
@@ -0,0 +1,9 @@
1+### `++metl`
2+
3+ ++ metl ?(%gold %iron %zinc %lead) :: core variance
4+
5+XX move to `++ut`
6+
7+See also: [`++coil`]()
8+
9+
docs/system/hoon/library/src/4o/mold/nock.mdnew file+29
@@ -0,0 +1,29 @@
1+### `++nock`
2+
3+Virtual machine. See [Nock doc]().
4+
5+
6+Source
7+------
8+
9+ ++ nock $& [p=nock q=nock] :: autocons
10+ [%3 p=nock] :: cell test
11+ [%4 p=nock] :: increment
12+ [%5 p=nock q=nock] :: equality test
13+ [%6 p=nock q=nock r=nock] :: if, then, else
14+ [%7 p=nock q=nock] :: serial compose
15+ [%8 p=nock q=nock] :: push onto subject
16+ [%9 p=@ q=nock] :: select arm and fire
17+ [%10 p=?(@ [p=@ q=nock]) q=nock] :: hint
18+ [%11 p=nock] :: grab data from sky
19+ == ::
20+
21+Examples
22+--------
23+
24+ ~zod/try=> !=([+(.) 20 -<])
25+ [[4 0 1] [1 20] 0 4]
26+ ~zod/try=> (nock !=([+(.) 20]))
27+ [p=[%4 p=[%0 p=1]] q=[%1 p=20]]
28+
29+
docs/system/hoon/library/src/4o/mold/noun.mdnew file+10
@@ -0,0 +1,10 @@
1+### `++noun`
2+
3+ ++ noun ,* :: any noun
4+
5+Used nowhere XX
6+
7+ ~zod/try=> `noun`~[1 2 3]
8+ [1 2 3 0]
9+
10+
docs/system/hoon/library/src/4o/mold/null.mdnew file+11
@@ -0,0 +1,11 @@
1+### `++null`
2+
3+ ++ null ,~ :: null, nil, etc
4+
5+Used nowhere XX
6+
7+ ~zod/try=> :type; *null
8+ ~
9+ %~
10+
11+
docs/system/hoon/library/src/4o/mold/port.mdnew file+23
@@ -0,0 +1,23 @@
1+### `++port`
2+
3+XX move to `++ut`
4+
5+Type and location of core-shaped thing? XX Compiler Internals
6+
7+Source
8+------
9+
10+ ++ port $: p=axis ::
11+ $= q ::
12+ $% [%& p=type] ::
13+ [%| p=axis q=(list ,[p=type q=foot])] ::
14+ == ::
15+ == ::
16+
17+Examples
18+--------
19+
20+ ~zod/try=> *port
21+ [p=0 q=[%.y p=%void]]
22+
23+
docs/system/hoon/library/src/4o/mold/span.mdnew file+30
@@ -0,0 +1,30 @@
1+### `++span`
2+
3+ASCII atom
4+
5+A restricted text atom for canonical atom syntaxes. The prefix is `~.`.
6+There are no escape sequences except `~~`, which means `~`, and `~-`,
7+which means `_`. `-` and `.` encode themselves. No other characters
8+besides numbers and lowercase letters are permitted.
9+
10+Source
11+------
12+
13+ ++ span ,@ta :: text-atom (ASCII)
14+Examples
15+--------
16+ ~zod/try=> *span
17+ ~.
18+
19+ ~zod/try=> `@t`~.foo
20+ 'foo'
21+ ~zod/try=> `@t`~.foo.bar
22+ 'foo.bar'
23+ ~zod/try=> `@t`~.foo~~bar
24+ 'foo~bar'
25+ ~zod/try=> `@t`~.foo~-bar
26+ 'foo_bar'
27+ ~zod/try=> `@t`~.foo-bar
28+ 'foo-bar'
29+
30+
docs/system/hoon/library/src/4o/mold/tiki.mdnew file+34
@@ -0,0 +1,34 @@
1+### `++tiki`
2+
3+XX move to `++ut`
4+
5+Source
6+------
7+
8+ ++ tiki :: test case
9+
10+Examples
11+--------
12+
13+A `++wing` or `++twig`.
14+
15+ ~zod/try=> (ream '=+ a=4 ?-(a @ ~)')
16+ [ %tsls
17+ p=[%ktts p=p=%a q=[%dtzy p=%ud q=4]]
18+ q
19+ [ %wthz
20+ p=[%.y p=~ q=~[%a]]
21+ q=~[[p=[%axil p=[%atom p=~.]] q=[%bczp p=%null]]]
22+ ]
23+ ]
24+ ~zod/try=> (ream '=+ a=4 ?-(4 @ ~)')
25+ [ %tsls
26+ p=[%ktts p=p=%a q=[%dtzy p=%ud q=4]]
27+ q
28+ [ %wthz
29+ p=[%.n p=~ q=[%dtzy p=%ud q=4]]
30+ q=~[[p=[%axil p=[%atom p=~.]] q=[%bczp p=%null]]]
31+ ]
32+ ]
33+
34+
docs/system/hoon/library/src/4o/mold/toga.mdnew file+40
@@ -0,0 +1,40 @@
1+### `++toga`
2+
3+Tree of faces
4+
5+A [face](), or tree of faces. A `++toga` is applied to anything assigned
6+using [`^=`]().
7+
8+XX move to `++ut` and rune doc (for \^= examples)
9+
10+Source
11+------
12+
13+ ++ toga :: face control
14+ [2 p=toga q=toga] :: cell toga
15+ == ::
16+
17+Examples
18+--------
19+
20+ ~zod/try=> a=1
21+ a=1
22+ ~zod/try=> (ream 'a=1')
23+ [%ktts p=p=%a q=[%dtzy p=%ud q=1]]
24+ ~zod/try=> [a b]=[1 2 3]
25+ [a=1 b=[2 3]]
26+ ~zod/try=> (ream '[a b]=[1 2 3]')
27+ [ %ktts
28+ p=[%2 p=p=%a q=p=%b]
29+ q=[%cltr p=~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]]
30+ ]
31+
32+ ~zod/try=> [a ~]=[1 2 3]
33+ [a=1 2 3]
34+ ~zod/try=> (ream '[a ~]=[1 2 3]')
35+ [ %ktts
36+ p=[%2 p=p=%a q=[%0 ~]]
37+ q=[%cltr p=~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]]
38+ ]
39+
40+
docs/system/hoon/library/src/4o/mold/tone.mdnew file+45
@@ -0,0 +1,45 @@
1+### `++tone`
2+
3+Intermediate Nock computation result
4+
5+Similar to [`++toon`](), but stack trace is not yet rendered.
6+
7+Source
8+------
9+
10+ ++ tone $% [%0 p=*] :: success
11+
12+Examples
13+--------
14+
15+ ~zod/try=> (mink [[20 21] 0 3] ,~)
16+ [%0 p=21]
17+
18+ ~zod/try=> (mink [[0] !=(.^(cy//=main/1))] ,~)
19+ [%1 p=~[[31.075 1.685.027.454 1.852.399.981 49 0]]]
20+ ~zod/try=> (path [31.075 1.685.027.454 1.852.399.981 49 0])
21+ /cy/~zod/main/1
22+
23+ ~zod/try=> (mink [[1 2] !=(~|(%hi +(.)))] ,~)
24+ [%2 p=~[[~.yelp 26.984]]]
25+ ~zod/try=> (mink [[1 2] !=(!:(+(.)))] ,~)
26+ [ %2
27+ p
28+ ~[
29+ [ ~.spot
30+ [ [ 1.685.027.454
31+ 7.959.156
32+ \/159.445.990.350.374.058.574.398.238.344.143.957.205.628.479.572.65\/
33+ 8.112.403.878.526
34+ \/ \/
35+ 0
36+ ]
37+ [1 20]
38+ 1
39+ 24
40+ ]
41+ ]
42+ ]
43+ ]
44+
45+
docs/system/hoon/library/src/4o/mold/tuna.mdnew file+25
@@ -0,0 +1,25 @@
1+### `++tuna`
2+
3+XML template tree
4+
5+An XML template tree.
6+
7+Source
8+------
9+
10+ ++ tuna :: tagflow
11+ [%d p=twig] :: dynamic list
12+ [%e p=twig q=(list tuna)] :: element
13+ [%f p=(list tuna)] :: subflow
14+ == ::
15+
16+Examples
17+--------
18+
19+Leaf %a contains plain-text, %b an empty tag, %c a static list, %d a
20+dynamic list, %e a full node element containing a twig and a list of
21+tuna, and %f is a empty node.
22+
23+See also: [`++sail`]()
24+
25+
docs/system/hoon/library/src/4o/mold/tusk.mdnew file+21
@@ -0,0 +1,21 @@
1+### `++tusk`
2+
3+List of expressions
4+
5+List of [`++twig`]()s. In [`:*`](), for example, your contents is
6+a `++tusk`.
7+
8+Source
9+------
10+
11+ ++ tusk (list twig) ::
12+
13+Examples
14+--------
15+
16+ ~zod/try=> (ream '[1 2 3]')
17+ [%cltr p=~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]]
18+ ~zod/try=> (tusk +:(ream '[1 2 3]'))
19+ ~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]
20+
21+
docs/system/hoon/library/src/4o/mold/twig.mdnew file+9
@@ -0,0 +1,9 @@
1+### `++twig`
2+
3+Expression
4+
5+An expression, or AST.
6+
7+See Twig section of Hoon reference
8+
9+
docs/system/hoon/library/src/4o/mold/tyke.mdnew file+23
@@ -0,0 +1,23 @@
1+### `++tyke`
2+
3+List of 'maybe' twigs
4+
5+List of [`++unit`]() [`++twig`](), or gaps left to be inferred, in [`++path`]()
6+parsing. When you use a path such as `/=main=/pub/src/doc` the path is in fact
7+a `++tyke`, where the `=` are inferred from your current path.
8+
9+
10+Source
11+------
12+
13+ ++ tyke (list (unit twig)) ::
14+
15+Examples
16+--------
17+
18+ ~zod/try=> (scan "/==as=" porc:vast)
19+ [0 ~[~ ~ [~ [%dtzy p=%tas q=29.537]] ~]]
20+ ~zod/try=> `tyke`+:(scan "/==as=" porc:vast)
21+ ~[~ ~ [~ [%dtzy p=%tas q=29.537]] ~]
22+
23+
docs/system/hoon/library/src/4o/mold/typo.mdnew file+18
@@ -0,0 +1,18 @@
1+### `++typo`
2+
3+Pointer for `++type`
4+
5+Pointer for [`++type`](). `++typo` preserves the previous `++type` in your
6+context when upating.
7+
8+Source
9+------
10+
11+ ++ typo type :: old type
12+
13+Examples
14+--------
15+
16+See also: `++seem`, `++vise`, `++type`
17+
18+
docs/system/hoon/library/src/4o/mold/tyre.mdnew file+12
@@ -0,0 +1,12 @@
1+### `++tyre`
2+
3+List, term to twig
4+
5+Associative list of [++term]() [`++twig`](), used in [jet]() hint processing.
6+
7+Source
8+------
9+
10+ ++ tyre (list ,[p=term q=twig]) ::
11+
12+
docs/system/hoon/library/src/4o/mold/vase.mdnew file+19
@@ -0,0 +1,19 @@
1+### `++vase`
2+
3+Typed data. A `++vase` is used wherever typed data is explicitly worked
4+with.
5+
6+
7+Source
8+------
9+
10+ ++ vase ,[p=type q=*] :: type-value pair
11+
12+Examples
13+--------
14+See `%arvo` doc
15+
16+ ~zod/try=> `vase`!>(~)
17+ [p=[%cube p=0 q=[%atom p=%n]] q=0]
18+
19+
docs/system/hoon/library/src/4o/mold/vise.mdnew file+17
@@ -0,0 +1,17 @@
1+### `++vise`
2+
3+Convert during reboot
4+
5+Used to convert from previously-typed data during reboot.
6+
7+Source
8+------
9+
10+ ++ vise ,[p=typo q=*] :: old vase
11+
12+Examples
13+--------
14+
15+See also: [`++typo`](), [`++seer`]()
16+
17+
docs/system/hoon/library/src/4o/mold/wing.mdnew file+15
@@ -0,0 +1,15 @@
1+### `++wing`
2+
3+ ++ wing (list limb) ::
4+
5+Address in subject. A `++wing` is a path to a value in the subject. A
6+term alone is the trivial case of a `++wing`.
7+
8+See also: `++twig`
9+
10+ ~zod/try=> (ream 'a.+.c')
11+ [%cnzz p=~[%a [%.y p=3] %c]]
12+ ~zod/try=> (wing +:(ream 'a.+.c'))
13+ ~[%a [%.y p=3] %c]
14+
15+
docs/system/hoon/library/src/5f/mold/mane.mdnew file+26
@@ -0,0 +1,26 @@
1+### `++mane`
2+
3+XML name
4+
5+An XML name (tag name or attribute name) with an optional namespace. Parsed by
6+[`++name`]() within [`++poxa`](), rendered by [`++name`]() within `++poxo`.
7+
8+Source
9+------
10+
11+ ++ mane $|(@tas [@tas @tas]) :: XML name/space
12+
13+Examples
14+--------
15+
16+See also: [`++sail`]()
17+
18+ ~zod/try=> *mane
19+ %$
20+
21+ ~zod/try=> `mane`n.g:`manx`;div:namespace;
22+ %div
23+ ~zod/try=> `mane`n.g:`manx`;div_namespace;
24+ [%div %namespace]
25+
26+
docs/system/hoon/library/src/5f/mold/manx.mdnew file+17
@@ -0,0 +1,17 @@
1+### `++manx`
2+
3+XML node.
4+
5+Parsed by [`++apex`]() within [`++poxa`](), rendered by [`++poxo`]().
6+
7+Source
8+------
9+
10+ ++ manx ,[g=marx c=marl] :: XML node
11+
12+Examples
13+--------
14+
15+See also: [`++sail`]() doc
16+
17+
docs/system/hoon/library/src/5f/mold/marl.mdnew file+16
@@ -0,0 +1,16 @@
1+### `++marl`
2+
3+List of XML nodes
4+
5+A list of [`++manx`]().
6+
7+Source
8+------
9+
10+ ++ marl (list manx) :: XML node list
11+
12+Examples
13+--------
14+
15+
16+
docs/system/hoon/library/src/5f/mold/mars.mdnew file+15
@@ -0,0 +1,15 @@
1+### `++mars`
2+
3+XML CDATA
4+
5+Implicitly produced by [`++chrd`]() within [`++poxa`]()
6+
7+Source
8+------
9+
10+ ++ mars ,[t=[n=%$ a=[i=[n=%$ v=tape] t=~]] c=~] :: XML cdata
11+
12+Examples
13+--------
14+
15+
docs/system/hoon/library/src/5f/mold/mart.mdnew file+18
@@ -0,0 +1,18 @@
1+### `++mart`
2+
3+List of XML attributes
4+
5+Each `++mart` is a list of pairs of [`++mane`]() and
6+[`++tape`]().
7+
8+Parsed by [`++attr`]() within [`++poxa`](), rendered by `++attr` within [`++poxo`]()
9+
10+Source
11+------
12+
13+ ++ mart (list ,[n=mane v=tape]) :: XML attributes
14+
15+Examples
16+--------
17+
18+
docs/system/hoon/library/src/5f/mold/marx.mdnew file+16
@@ -0,0 +1,16 @@
1+### `++marx`
2+
3+XML tag
4+
5+A `++marx` is a pair of a tag name, `++mane` and a list of attributes,
6+`++mart`. Parsed by [`++head`]() `++poxa`, rendered within `++poxo`.
7+
8+Source
9+------
10+
11+ ++ marx ,[n=mane a=mart] :: XML tag
12+
13+Examples
14+--------
15+
16+
docs/system/hoon/library/src/5f/mold/pass.mdnew file+12
@@ -0,0 +1,12 @@
1+### `++pass`
2+
3+Atom alias
4+
5+Used primarily in crypto.
6+
7+Source
8+------
9+
10+ ++ pass ,@ :: public key
11+
12+
docs/system/hoon/library/src/5f/mold/ring.mdnew file+12
@@ -0,0 +1,12 @@
1+### `++ring`
2+
3+Atom alias
4+
5+Used primarily in crypto.
6+
7+Source
8+------
9+
10+ ++ ring ,@ :: private key
11+
12+
docs/system/hoon/library/src/5f/mold/time.mdnew file+23
@@ -0,0 +1,23 @@
1+### `++time`
2+
3+Absolute date
4+
5+The `@da` odor designates an absolute date atom.
6+
7+Source
8+------
9+
10+ ++ time ,@da :: galactic time
11+
12+Examples
13+--------
14+
15+See also: [`++date`](), [odor reference]()
16+
17+ ~zod/try=> `time`-<-
18+ ~2014.9.25..20.01.47..eeac
19+ ~zod/try=> :: the time is always in your context at -<-
20+ ~zod/try=> `time`~2014.1.1
21+ ~2014.1.1
22+
23+
docs/system/hoon/zuse/core/crua.mdnew file+598
@@ -0,0 +1,598 @@
1+### `++crua`
2+
3+ ++ crua !: :: cryptosuite A (RSA)
4+ ^- acru
5+ =| [mos=@ pon=(unit ,[p=@ q=@ r=[p=@ q=@] s=_*fu])]
6+ => |%
7+
8+XX document
9+
10+### `++mx`
11+
12+ ++ mx (dec (met 0 mos)) :: bit length
13+
14+XX document
15+
16+### `++dap`
17+
18+ ++ dap :: OEAP decode
19+ |= [wid=@ xar=@ dog=@] ^- [p=@ q=@]
20+ =+ pav=(sub wid xar)
21+ =+ qoy=(cut 0 [xar pav] dog)
22+ =+ dez=(mix (end 0 xar dog) (shaw %pad-b xar qoy))
23+ [dez (mix qoy (shaw %pad-a pav dez))]
24+ ::
25+
26+XX document
27+
28+### `++pad`
29+
30+ ++ pad :: OEAP encode
31+ |= [wid=@ rax=[p=@ q=@] meg=@] ^- @
32+ =+ pav=(sub wid p.rax)
33+ ?> (gte pav (met 0 meg))
34+ ^- @
35+ =+ qoy=(mix meg (shaw %pad-a pav q.rax))
36+ =+ dez=(mix q.rax (shaw %pad-b p.rax qoy))
37+ (can 0 [p.rax dez] [pav qoy] ~)
38+ |%
39+
40+XX document
41+
42+### `++pull`
43+
44+ ++ pull |=(a=@ (~(exp fo mos) 3 a))
45+
46+XX document
47+
48+### `++push`
49+
50+ ++ push |=(a=@ (~(exp fo mos) 5 a))
51+
52+XX document
53+
54+### `++pump`
55+
56+ ++ pump
57+ |= a=@ ^- @
58+ ?~ pon !!
59+ (out.s.u.pon (exp.s.u.pon p.r.u.pon (sit.s.u.pon a)))
60+ ::
61+
62+XX document
63+
64+### `++punt`
65+
66+ ++ punt
67+ |= a=@ ^- @
68+ ?~ pon !!
69+ (out.s.u.pon (exp.s.u.pon q.r.u.pon (sit.s.u.pon a)))
70+ |%
71+
72+XX document
73+
74+### `++as`
75+
76+ ++ as
77+ => |%
78+
79+XX document
80+
81+### `++haul`
82+
83+ ++ haul :: revealing haul
84+ |= a=pass
85+ !!
86+ ^?
87+ |% ++ seal
88+ |= [a=pass b=@ c=@]
89+ ^- @
90+ !!
91+
92+XX document
93+
94+### `++seal`
95+
96+
97+ XX document
98+
99+ ###++sign
100+
101+ ```
102+ ++ sign
103+ |= [a=@ b=@] ^- @
104+ !!
105+ ```
106+
107+ XX document
108+
109+ ###++sure
110+
111+ ```
112+ ++ sure
113+ |= [a=@ b=@]
114+ ^- (unit ,@)
115+ !!
116+ ```
117+
118+ XX document
119+
120+ ###++tear
121+
122+ ```
123+ ++ tear
124+ |= [a=pass b=@]
125+ ^- (unit ,[p=@ q=@])
126+ !!
127+ ::
128+ ```
129+
130+ XX document
131+
132+ ###++de
133+
134+ ```
135+ ++ de
136+ |+ [key=@ cep=@] ^- (unit ,@)
137+ !!
138+ ::
139+ ```
140+
141+ XX document
142+
143+ ###++dy
144+
145+ ```
146+ ++ dy
147+ |+ [a=@ b=@] ^- @
148+ !!
149+ ```
150+
151+ XX document
152+
153+ ###++en
154+
155+ ```
156+ ++ en
157+ |+ [key=@ msg=@] ^- @ux
158+ !!
159+ ::
160+ ```
161+
162+ XX document
163+
164+ ###++ex
165+
166+ ```
167+ ++ ex ^?
168+ |% ++ fig ^- @uvH (shaf %bfig puc)
169+ ```
170+
171+ XX document
172+
173+ ###++fig
174+
175+XX document
176+
177+### `++pac`
178+
179+ ++ pac ^- @uvG (end 6 1 (shaf %acod sec))
180+
181+XX document
182+
183+### `++pub`
184+
185+ ++ pub ^- pass (cat 3 'b' puc)
186+
187+XX document
188+
189+### `++sec`
190+
191+ ++ sec ^- ring sed
192+ ::
193+
194+XX document
195+
196+### `++nu`
197+
198+ ++ nu
199+ ^?
200+ |% ++ com
201+ |= a=@
202+ ^+ ^?(..nu)
203+ ..nu(sed ~, puc a)
204+ ::
205+
206+XX document
207+
208+### `++elcm`
209+
210+ ++ elcm
211+ |= [a=@ b=@]
212+ (div (mul a b) d:(egcd a b))
213+ ::
214+
215+XX document
216+
217+### `++eldm`
218+
219+ ++ eldm
220+ |= [a=@ b=@ c=@]
221+ (~(inv fo (elcm (dec b) (dec c))) a)
222+ ::
223+
224+XX document
225+
226+### `++ersa`
227+
228+ ++ ersa
229+ |= [a=@ b=@]
230+ [a b [(eldm 3 a b) (eldm 5 a b)] (fu a b)]
231+ ^?
232+ |% ++ com
233+ |= a=@
234+ ^+ ^?(..nu)
235+ ..nu(mos a, pon ~)
236+ ::
237+
238+XX document
239+
240+### `++com`
241+
242+
243+ XX document
244+
245+ ###++pit
246+
247+ ```
248+ ++ pit
249+ |= [a=@ b=@]
250+ ^+ ^?(..nu)
251+ ..nu(sed b, puc (puck:ed b))
252+ ::
253+ ```
254+
255+ XX document
256+
257+ ###++nol
258+
259+ ```
260+ ++ nol
261+ |= a=@
262+ ^+ ^?(..nu)
263+ ..nu(sed a, puc (puck:ed a))
264+ ```
265+
266+ XX document
267+
268+ ###++bruw
269+
270+ ```
271+ ++ bruw :: create keypair
272+ |= [a=@ b=@] :: width seed
273+ ^- acru
274+ (pit:nu:crua a b)
275+ ::
276+ ```
277+
278+ XX document
279+
280+ ###++haul
281+
282+ ```
283+ ++ haul :: revealing haul
284+ |= a=pass
285+ !!
286+ ^?
287+ |% ++ seal
288+ |= [a=pass b=@ c=@]
289+ ^- @
290+ !!
291+ ```
292+
293+ XX document
294+
295+ ###++weur
296+
297+ ```
298+ ++ weur :: activate secret key
299+ |= a=ring
300+ ^- acru
301+ =+ [mag=(end 3 1 a) bod=(rsh 3 1 a)]
302+ ?> =('A' mag)
303+ (nol:nu:crua bod)
304+ ::
305+ ```
306+
307+ XX document
308+
309+ ###++trua
310+
311+ ```
312+ ++ trua :: test rsa
313+ |= msg=@tas
314+ ^- @
315+ =+ ali=(bruw 1.024 (shax 'ali'))
316+ =+ bob=(bruw 1.024 (shax 'bob'))
317+ =+ tef=(sign:as.ali [0 msg])
318+ =+ lov=(sure:as.ali [0 tef])
319+ ?. &(?=(^ lov) =(msg u.lov))
320+ ~|(%test-fail-sign !!)
321+ =+ key=(shax (shax (shax msg)))
322+ =+ sax=(seal:as.ali pub:ex.bob key msg)
323+ =+ tin=(tear:as.bob pub:ex.ali sax)
324+ ?. &(?=(^ tin) =(key p.u.tin) =(msg q.u.tin))
325+ ~|(%test-fail-seal !!)
326+ msg
327+ ::
328+ ```
329+
330+ XX document
331+
332+ ###++crub
333+
334+ ```
335+ ++ crub :: cryptosuite B (Ed)
336+ ^- acru
337+ =| [puc=pass sed=ring]
338+ => |%
339+ ```
340+
341+ XX document
342+
343+ ###++dap
344+
345+ ```
346+ ++ dap :: OEAP decode
347+ |= [wid=@ xar=@ dog=@] ^- [p=@ q=@]
348+ =+ pav=(sub wid xar)
349+ =+ qoy=(cut 0 [xar pav] dog)
350+ =+ dez=(mix (end 0 xar dog) (shaw %pad-b xar qoy))
351+ [dez (mix qoy (shaw %pad-a pav dez))]
352+ ::
353+ ```
354+
355+ XX document
356+
357+ ###++pad
358+
359+ ```
360+ ++ pad :: OEAP encode
361+ |= [wid=@ rax=[p=@ q=@] meg=@] ^- @
362+ =+ pav=(sub wid p.rax)
363+ ?> (gte pav (met 0 meg))
364+ ^- @
365+ =+ qoy=(mix meg (shaw %pad-a pav q.rax))
366+ =+ dez=(mix q.rax (shaw %pad-b p.rax qoy))
367+ (can 0 [p.rax dez] [pav qoy] ~)
368+ |%
369+ ```
370+
371+ XX document
372+
373+ ###++as
374+
375+ ```
376+ ++ as
377+ => |%
378+ ```
379+
380+ XX document
381+
382+ ###++haul
383+
384+ ```
385+ ++ haul :: revealing haul
386+ |= a=pass
387+ !!
388+ ^?
389+ |% ++ seal
390+ |= [a=pass b=@ c=@]
391+ ^- @
392+ !!
393+ ```
394+
395+ XX document
396+
397+ ###++seal
398+
399+XX document
400+
401+### `++sign`
402+
403+ ++ sign
404+ |= [a=@ b=@] ^- @
405+ !!
406+
407+XX document
408+
409+### `++sure`
410+
411+ ++ sure
412+ |= [a=@ b=@]
413+ ^- (unit ,@)
414+ !!
415+
416+XX document
417+
418+### `++tear`
419+
420+ ++ tear
421+ |= [a=pass b=@]
422+ ^- (unit ,[p=@ q=@])
423+ !!
424+ ::
425+
426+XX document
427+
428+### `++de`
429+
430+ ++ de
431+ |+ [key=@ cep=@] ^- (unit ,@)
432+ !!
433+ ::
434+
435+XX document
436+
437+### `++dy`
438+
439+ ++ dy
440+ |+ [a=@ b=@] ^- @
441+ !!
442+
443+XX document
444+
445+### `++en`
446+
447+ ++ en
448+ |+ [key=@ msg=@] ^- @ux
449+ !!
450+ ::
451+
452+XX document
453+
454+### `++ex`
455+
456+ ++ ex ^?
457+ |% ++ fig ^- @uvH (shaf %bfig puc)
458+
459+XX document
460+
461+### `++fig`
462+
463+
464+ XX document
465+
466+ ###++pac
467+
468+ ```
469+ ++ pac ^- @uvG (end 6 1 (shaf %acod sec))
470+ ```
471+
472+ XX document
473+
474+ ###++pub
475+
476+ ```
477+ ++ pub ^- pass (cat 3 'b' puc)
478+ ```
479+
480+ XX document
481+
482+ ###++sec
483+
484+ ```
485+ ++ sec ^- ring sed
486+ ::
487+ ```
488+
489+ XX document
490+
491+ ###++nu
492+
493+ ```
494+ ++ nu
495+ ^?
496+ |% ++ com
497+ |= a=@
498+ ^+ ^?(..nu)
499+ ..nu(sed ~, puc a)
500+ ::
501+ ```
502+
503+ XX document
504+
505+ ###++com
506+
507+XX document
508+
509+### `++pit`
510+
511+ ++ pit
512+ |= [a=@ b=@]
513+ ^+ ^?(..nu)
514+ ..nu(sed b, puc (puck:ed b))
515+ ::
516+
517+XX document
518+
519+### `++nol`
520+
521+ ++ nol
522+ |= a=@
523+ ^+ ^?(..nu)
524+ ..nu(sed a, puc (puck:ed a))
525+
526+XX document
527+
528+### `++brew`
529+
530+ ++ brew :: create keypair
531+ |= [a=@ b=@] :: width seed
532+ ^- acru
533+ (pit:nu:crub a b)
534+ ::
535+
536+XX document
537+
538+### `++hail`
539+
540+ ++ hail :: activate public key
541+ |= a=pass
542+ ^- acru
543+ =+ [mag=(end 3 1 a) bod=(rsh 3 1 a)]
544+ ?> =('b' mag)
545+ (com:nu:crub bod)
546+ ::
547+
548+XX document
549+
550+### `++wear`
551+
552+ ++ wear :: activate secret key
553+ |= a=ring
554+ ^- acru
555+ =+ [mag=(end 3 1 a) bod=(rsh 3 1 a)]
556+ ?> =('b' mag)
557+ (nol:nu:crub bod)
558+ ::
559+
560+XX document
561+
562+### `++trub`
563+
564+ ++ trub :: test ed
565+ |= msg=@tas
566+ ^- @
567+ =+ ali=(brew 1.024 (shax 'ali'))
568+ =+ bob=(brew 1.024 (shax 'bob'))
569+ =+ tef=(sign:as.ali [0 msg])
570+ =+ lov=(sure:as.ali [0 tef])
571+ ?. &(?=(^ lov) =(msg u.lov))
572+ ~|(%test-fail-sign !!)
573+ =+ key=(shax (shax (shax msg)))
574+ =+ sax=(seal:as.ali pub:ex.bob key msg)
575+ =+ tin=(tear:as.bob pub:ex.ali sax)
576+ ?. &(?=(^ tin) =(key p.u.tin) =(msg q.u.tin))
577+ ~|(%test-fail-seal !!)
578+ msg
579+ ::
580+
581+XX document
582+
583+### `++hmac`
584+
585+ ++ hmac :: HMAC-SHA1
586+ |= [key=@ mes=@]
587+ =+ ip=(fil 3 64 0x36)
588+ =+ op=(fil 3 64 0x5c)
589+ =+ ^= kex
590+ ?: (gth (met 3 key) 64)
591+ (lsh 3 44 (shan (swap 3 key)))
592+ (lsh 3 (sub 64 (met 3 key)) (swap 3 key))
593+ =+ inn=(shan (swap 3 (cat 3 (swap 3 mes) (mix ip kex))))
594+ (shan (swap 3 (cat 3 inn (mix op kex))))
595+ ::
596+
597+XX document
598+
docs/system/hoon/zuse/core/epur.mdnew file+885

This diff is too big to show here.

docs/system/hoon/zuse/core/fu.mdnew file+68

This diff is too big to show here.

docs/system/hoon/zuse/core/jo.mdnew file+948

This diff is too big to show here.

docs/system/hoon/zuse/core/poja.mdnew file+715

This diff is too big to show here.

docs/system/hoon/zuse/core/poxa.mdnew file+440

This diff is too big to show here.

docs/system/hoon/zuse/core/poxo.mdnew file+255

This diff is too big to show here.

docs/system/hoon/zuse/core/yu.mdnew file+212

This diff is too big to show here.

docs/system/hoon/zuse/diff.mdnew file+810

This diff is too big to show here.

docs/system/hoon/zuse/gate/clan.mdnew file+40

This diff is too big to show here.

docs/system/hoon/zuse/gate/dawn.mdnew file+39

This diff is too big to show here.

docs/system/hoon/zuse/gate/daws.mdnew file+37

This diff is too big to show here.

docs/system/hoon/zuse/gate/deal.mdnew file+44

This diff is too big to show here.

docs/system/hoon/zuse/gate/deft.mdnew file+48

This diff is too big to show here.

docs/system/hoon/zuse/gate/dust.mdnew file+42

This diff is too big to show here.

docs/system/hoon/zuse/gate/earl.mdnew file+40

This diff is too big to show here.

docs/system/hoon/zuse/gate/earn.mdnew file+180

This diff is too big to show here.

docs/system/hoon/zuse/gate/fain.mdnew file+56

This diff is too big to show here.

docs/system/hoon/zuse/gate/feel.mdnew file+47

This diff is too big to show here.

docs/system/hoon/zuse/gate/file.mdnew file+44

This diff is too big to show here.

docs/system/hoon/zuse/gate/foal.mdnew file+43

This diff is too big to show here.

docs/system/hoon/zuse/gate/fray.mdnew file+38

This diff is too big to show here.

docs/system/hoon/zuse/gate/fuel.mdnew file+77

This diff is too big to show here.

docs/system/hoon/zuse/gate/furl.mdnew file+50

This diff is too big to show here.

docs/system/hoon/zuse/gate/glam.mdnew file+84

This diff is too big to show here.

docs/system/hoon/zuse/gate/glon.mdnew file+216

This diff is too big to show here.

docs/system/hoon/zuse/gate/gnom.mdnew file+38

This diff is too big to show here.

docs/system/hoon/zuse/gate/jape.mdnew file+38

This diff is too big to show here.

docs/system/hoon/zuse/gate/jesc.mdnew file+41

This diff is too big to show here.

docs/system/hoon/zuse/gate/joba.mdnew file+40

This diff is too big to show here.

docs/system/hoon/zuse/gate/jobe.mdnew file+34

This diff is too big to show here.

docs/system/hoon/zuse/gate/jone.mdnew file+40

This diff is too big to show here.

docs/system/hoon/zuse/gate/lead.mdnew file+48

This diff is too big to show here.

docs/system/hoon/zuse/gate/mang.mdnew file+55

This diff is too big to show here.

docs/system/hoon/zuse/gate/meat.mdnew file+48

This diff is too big to show here.

docs/system/hoon/zuse/gate/moon.mdnew file+40

This diff is too big to show here.

docs/system/hoon/zuse/gate/mung.mdnew file+55

This diff is too big to show here.

docs/system/hoon/zuse/gate/perk.mdnew file+49

This diff is too big to show here.

docs/system/hoon/zuse/gate/pojo.mdnew file+78

This diff is too big to show here.

docs/system/hoon/zuse/gate/saxo.mdnew file+37

This diff is too big to show here.

docs/system/hoon/zuse/gate/scanf.mdnew file+83

This diff is too big to show here.

docs/system/hoon/zuse/gate/sein.mdnew file+56

This diff is too big to show here.

docs/system/hoon/zuse/gate/sifo.mdnew file+46

This diff is too big to show here.

docs/system/hoon/zuse/gate/stud.mdnew file+58

This diff is too big to show here.

docs/system/hoon/zuse/gate/taco.mdnew file+27

This diff is too big to show here.

docs/system/hoon/zuse/gate/tact.mdnew file+34

This diff is too big to show here.

docs/system/hoon/zuse/gate/tame.mdnew file+54

This diff is too big to show here.

docs/system/hoon/zuse/gate/tell.mdnew file+39

This diff is too big to show here.

docs/system/hoon/zuse/gate/tome.mdnew file+46

This diff is too big to show here.

docs/system/hoon/zuse/gate/tope.mdnew file+30

This diff is too big to show here.

docs/system/hoon/zuse/gate/txml.mdnew file+32

This diff is too big to show here.

docs/system/hoon/zuse/gate/unt.mdnew file+35

This diff is too big to show here.

docs/system/hoon/zuse/gate/urld.mdnew file+48

This diff is too big to show here.

docs/system/hoon/zuse/gate/urle.mdnew file+51

This diff is too big to show here.

docs/system/hoon/zuse/mold/udal.mdnew file+10

This diff is too big to show here.

docs/system/hoon/zuse/mold/udon.mdnew file+15

This diff is too big to show here.

docs/system/hoon/zuse/mold/umph.mdnew file+13

This diff is too big to show here.

docs/system/hoon/zuse/mold/unce.mdnew file+8

This diff is too big to show here.

docs/system/hoon/zuse/mold/upas.mdnew file+12

This diff is too big to show here.

docs/system/hoon/zuse/mold/urge.mdnew file+7

This diff is too big to show here.

docs/system/hoon/zuse/rsa.mdnew file+399

This diff is too big to show here.