on master help sign in
Adding derived files.
commit243bdcb0c8b70a769a439e3e185f78243e6ad3d3 authorC. Guy Yarvin <cgyarvin@gmail.com> dateFri 11 Mar 2016, 17:19 (11 years ago) parente891037
398 files changed+20101−2
docs/system/hoon/library/1a.md+507 docs/system/hoon/library/1b.md+143 docs/system/hoon/library/1c.md+273 docs/system/hoon/library/2a.md+442 docs/system/hoon/library/2b.md+862 docs/system/hoon/library/2c.md+667 docs/system/hoon/library/2d.md+221 docs/system/hoon/library/2e.md+163 docs/system/hoon/library/2f.md+268 docs/system/hoon/library/2g.md+1 docs/system/hoon/library/2h.md+592 docs/system/hoon/library/2i.md+572 docs/system/hoon/library/2j.md+369 docs/system/hoon/library/2k.md+334 docs/system/hoon/library/2l.md+1 docs/system/hoon/library/2m.md+1 docs/system/hoon/library/2n.md+190 docs/system/hoon/library/2o.md+144 docs/system/hoon/library/2p.md+224 docs/system/hoon/library/2q.md+276 docs/system/hoon/library/3a.md+940 docs/system/hoon/library/3b.md+1 docs/system/hoon/library/3c.md+588 docs/system/hoon/library/3d.md+424 docs/system/hoon/library/3e.md+715 docs/system/hoon/library/3f.md+624 docs/system/hoon/library/3g.md+319 docs/system/hoon/library/4a.md+203 docs/system/hoon/library/4b.md+977 docs/system/hoon/library/4c.md+368 docs/system/hoon/library/4d.md+93 docs/system/hoon/library/4e.md+454 docs/system/hoon/library/4f.md+1159 docs/system/hoon/library/4g.md+167 docs/system/hoon/library/4h.md+874 docs/system/hoon/library/4i.md+1 docs/system/hoon/library/4j.md+1650 docs/system/hoon/library/4k.md+1337 docs/system/hoon/library/4l.md+479 docs/system/hoon/library/4m.md+410 docs/system/hoon/library/4n.md+471 docs/system/hoon/library/4o.md+723 docs/system/hoon/library/5a.md+1 docs/system/hoon/library/5b.md+1 docs/system/hoon/library/5c.md+1 docs/system/hoon/library/5d.md+1 docs/system/hoon/library/5e.md+1 docs/system/hoon/library/5f.md+174 docs/system/hoon/library/5g.md docs/system/hoon/library/hr.txt−1 docs/system/hoon/library/src/1a/gate/add.md+1−1 docs/system/hoon/library/src/1a/gate/dec.md+2 docs/system/hoon/library/src/1a/gate/div.md+2 docs/system/hoon/library/src/1a/gate/gte.md+2 docs/system/hoon/library/src/1a/gate/gth.md+2 docs/system/hoon/library/src/1a/gate/lte.md+2 docs/system/hoon/library/src/1a/gate/lth.md+2 docs/system/hoon/library/src/1a/gate/max.md+2 docs/system/hoon/library/src/1a/gate/min.md+2 docs/system/hoon/library/src/1a/gate/mod.md+2 docs/system/hoon/library/src/1a/gate/mul.md+2 docs/system/hoon/library/src/1a/gate/sub.md+2 docs/system/hoon/library/src/1b/gate/cap.md+2 docs/system/hoon/library/src/1b/gate/mas.md+2 docs/system/hoon/library/src/1b/gate/peg.md+2 docs/system/hoon/library/src/1c/mold/bloq.md+2 docs/system/hoon/library/src/1c/mold/each.md+2 docs/system/hoon/library/src/1c/mold/gate.md+2 docs/system/hoon/library/src/1c/mold/list.md+2 docs/system/hoon/library/src/1c/mold/lone.md+2 docs/system/hoon/library/src/1c/mold/pair.md+2 docs/system/hoon/library/src/1c/mold/pole.md+2 docs/system/hoon/library/src/1c/mold/qual.md+2 docs/system/hoon/library/src/1c/mold/trap.md+2 docs/system/hoon/library/src/1c/mold/tree.md+2 docs/system/hoon/library/src/1c/mold/trel.md+2 docs/system/hoon/library/src/1c/mold/unit.md+2 docs/system/hoon/library/src/2a/gate/biff.md+2 docs/system/hoon/library/src/2a/gate/bind.md+2 docs/system/hoon/library/src/2a/gate/bond.md+2 docs/system/hoon/library/src/2a/gate/both.md+2 docs/system/hoon/library/src/2a/gate/clap.md+2 docs/system/hoon/library/src/2a/gate/drop.md+2 docs/system/hoon/library/src/2a/gate/fall.md+2 docs/system/hoon/library/src/2a/gate/lift.md+2 docs/system/hoon/library/src/2a/gate/mate.md+2 docs/system/hoon/library/src/2a/gate/need.md+2 docs/system/hoon/library/src/2a/gate/some.md+2 docs/system/hoon/library/src/2b/gate/flop.md+2 docs/system/hoon/library/src/2b/gate/homo.md+2 docs/system/hoon/library/src/2b/gate/lent.md+2 docs/system/hoon/library/src/2b/gate/levy.md+2 docs/system/hoon/library/src/2b/gate/lien.md+2 docs/system/hoon/library/src/2b/gate/limo.md+2 docs/system/hoon/library/src/2b/gate/murn.md+2 docs/system/hoon/library/src/2b/gate/reap.md+2 docs/system/hoon/library/src/2b/gate/reel.md+2 docs/system/hoon/library/src/2b/gate/roll.md+2 docs/system/hoon/library/src/2b/gate/scag.md+2 docs/system/hoon/library/src/2b/gate/skid.md+2 docs/system/hoon/library/src/2b/gate/skim.md+2 docs/system/hoon/library/src/2b/gate/skip.md+2 docs/system/hoon/library/src/2b/gate/slag.md+2 docs/system/hoon/library/src/2b/gate/snag.md+2 docs/system/hoon/library/src/2b/gate/sort.md+2 docs/system/hoon/library/src/2b/gate/swag.md+2 docs/system/hoon/library/src/2b/gate/turn.md+2 docs/system/hoon/library/src/2b/gate/weld.md+2 docs/system/hoon/library/src/2b/gate/welp.md+2 docs/system/hoon/library/src/2b/gate/zing.md+2 docs/system/hoon/library/src/2c/gate/bex.md+2 docs/system/hoon/library/src/2c/gate/can.md+2 docs/system/hoon/library/src/2c/gate/cat.md+2 docs/system/hoon/library/src/2c/gate/cut.md+2 docs/system/hoon/library/src/2c/gate/end.md+2 docs/system/hoon/library/src/2c/gate/fil.md+2 docs/system/hoon/library/src/2c/gate/lsh.md+2 docs/system/hoon/library/src/2c/gate/met.md+2 docs/system/hoon/library/src/2c/gate/rap.md+2 docs/system/hoon/library/src/2c/gate/rep.md+2 docs/system/hoon/library/src/2c/gate/rip.md+2 docs/system/hoon/library/src/2c/gate/rsh.md+2 docs/system/hoon/library/src/2c/gate/swp.md+2 docs/system/hoon/library/src/2c/gate/xeb.md+2 docs/system/hoon/library/src/2d/gate/con.md+2 docs/system/hoon/library/src/2d/gate/dis.md+2 docs/system/hoon/library/src/2d/gate/mix.md+2 docs/system/hoon/library/src/2d/gate/not.md+2 docs/system/hoon/library/src/2e/gate/fnv.md+2 docs/system/hoon/library/src/2e/gate/mug.md+2 docs/system/hoon/library/src/2e/gate/mum.md+2 docs/system/hoon/library/src/2f/gate/aor.md+2 docs/system/hoon/library/src/2f/gate/dor.md+2 docs/system/hoon/library/src/2f/gate/gor.md+2 docs/system/hoon/library/src/2f/gate/hor.md+2 docs/system/hoon/library/src/2f/gate/vor.md+2 docs/system/hoon/library/src/2h/core/in.md+2 docs/system/hoon/library/src/2i/core/by.md+2 docs/system/hoon/library/src/2j/core/ja.md+2 docs/system/hoon/library/src/2j/core/ju.md+2 docs/system/hoon/library/src/2k/core/to.md+2 docs/system/hoon/library/src/2n/gate/cork.md+2 docs/system/hoon/library/src/2n/gate/corl.md+2 docs/system/hoon/library/src/2n/gate/curr.md+2 docs/system/hoon/library/src/2n/gate/cury.md+2 docs/system/hoon/library/src/2n/gate/hard.md+2 docs/system/hoon/library/src/2n/gate/soft.md+2 docs/system/hoon/library/src/2o/mold/jar.md+2 docs/system/hoon/library/src/2o/mold/jug.md+2 docs/system/hoon/library/src/2o/mold/map.md+2 docs/system/hoon/library/src/2o/mold/qeu.md+2 docs/system/hoon/library/src/2o/mold/set.md+2 docs/system/hoon/library/src/2p/gate/cue.md+2 docs/system/hoon/library/src/2p/gate/jam.md+2 docs/system/hoon/library/src/2p/gate/mat.md+2 docs/system/hoon/library/src/2p/gate/rub.md+2 docs/system/hoon/library/src/2q/mold/char.md+2 docs/system/hoon/library/src/2q/mold/cord.md+2 docs/system/hoon/library/src/2q/mold/date.md+2 docs/system/hoon/library/src/2q/mold/tang.md+2 docs/system/hoon/library/src/2q/mold/tank.md+2 docs/system/hoon/library/src/2q/mold/tape.md+2 docs/system/hoon/library/src/2q/mold/tarp.md+2 docs/system/hoon/library/src/2q/mold/term.md+2 docs/system/hoon/library/src/2q/mold/wain.md+2 docs/system/hoon/library/src/2q/mold/wall.md+2 docs/system/hoon/library/src/3a/core/fe.md+2 docs/system/hoon/library/src/3a/core/si.md+2 docs/system/hoon/library/src/3a/gate/egcd.md+2 docs/system/hoon/library/src/3c/core/yo.md+2 docs/system/hoon/library/src/3c/gate/yall.md+2 docs/system/hoon/library/src/3c/gate/yawn.md+2 docs/system/hoon/library/src/3c/gate/year.md+2 docs/system/hoon/library/src/3c/gate/yell.md+2 docs/system/hoon/library/src/3c/gate/yelp.md+2 docs/system/hoon/library/src/3c/gate/yore.md+2 docs/system/hoon/library/src/3c/gate/yule.md+2 docs/system/hoon/library/src/3d/core/og.md+2 docs/system/hoon/library/src/3d/gate/shad.md+2 docs/system/hoon/library/src/3d/gate/shaf.md+2 docs/system/hoon/library/src/3d/gate/shak.md+2 docs/system/hoon/library/src/3d/gate/shal.md+2 docs/system/hoon/library/src/3d/gate/sham.md+2 docs/system/hoon/library/src/3d/gate/shan.md+2 docs/system/hoon/library/src/3d/gate/shas.md+2 docs/system/hoon/library/src/3d/gate/shaw.md+2 docs/system/hoon/library/src/3d/gate/shax.md+2 docs/system/hoon/library/src/3d/gate/shaz.md+2 docs/system/hoon/library/src/3e/core/aesc.md+2 docs/system/hoon/library/src/3f/core/ob.md+2 docs/system/hoon/library/src/3f/core/un.md+2 docs/system/hoon/library/src/3g/mold/coin.md+2 docs/system/hoon/library/src/3g/mold/dime.md+2 docs/system/hoon/library/src/3g/mold/edge.md+2 docs/system/hoon/library/src/3g/mold/hair.md+2 docs/system/hoon/library/src/3g/mold/like.md+2 docs/system/hoon/library/src/3g/mold/nail.md+2 docs/system/hoon/library/src/3g/mold/path.md+2 docs/system/hoon/library/src/3g/mold/pint.md+2 docs/system/hoon/library/src/3g/mold/rule.md+2 docs/system/hoon/library/src/3g/mold/spot.md+2 docs/system/hoon/library/src/3g/mold/toon.md+2 docs/system/hoon/library/src/3g/mold/wonk.md+2 docs/system/hoon/library/src/4a/core/po.md+2 docs/system/hoon/library/src/4b/core/at.md+2 docs/system/hoon/library/src/4b/gate/cass.md+2 docs/system/hoon/library/src/4b/gate/crip.md+2 docs/system/hoon/library/src/4b/gate/cuss.md+2 docs/system/hoon/library/src/4b/gate/mesc.md+2 docs/system/hoon/library/src/4b/gate/runt.md+2 docs/system/hoon/library/src/4b/gate/sand.md+2 docs/system/hoon/library/src/4b/gate/sane.md+2 docs/system/hoon/library/src/4b/gate/teff.md+2 docs/system/hoon/library/src/4b/gate/trim.md+2 docs/system/hoon/library/src/4b/gate/trip.md+2 docs/system/hoon/library/src/4b/gate/tuba.md+2 docs/system/hoon/library/src/4b/gate/tufa.md+2 docs/system/hoon/library/src/4b/gate/tuft.md+2 docs/system/hoon/library/src/4b/gate/turf.md+2 docs/system/hoon/library/src/4b/gate/wack.md+2 docs/system/hoon/library/src/4b/gate/wick.md+2 docs/system/hoon/library/src/4b/gate/woad.md+2 docs/system/hoon/library/src/4b/gate/wood.md+2 docs/system/hoon/library/src/4c/core/re.md+2 docs/system/hoon/library/src/4c/gate/show.md+2 docs/system/hoon/library/src/4d/gate/last.md+2 docs/system/hoon/library/src/4d/gate/lust.md+2 docs/system/hoon/library/src/4e/gate/bend.md+2 docs/system/hoon/library/src/4e/gate/comp.md+2 docs/system/hoon/library/src/4e/gate/fail.md+2 docs/system/hoon/library/src/4e/gate/glue.md+2 docs/system/hoon/library/src/4e/gate/less.md+2 docs/system/hoon/library/src/4e/gate/pfix.md+2 docs/system/hoon/library/src/4e/gate/plug.md+2 docs/system/hoon/library/src/4e/gate/pose.md+2 docs/system/hoon/library/src/4e/gate/sfix.md+2 docs/system/hoon/library/src/4e/gate/simu.md+2 docs/system/hoon/library/src/4f/gate/bass.md+2 docs/system/hoon/library/src/4f/gate/boss.md+2 docs/system/hoon/library/src/4f/gate/cold.md+2 docs/system/hoon/library/src/4f/gate/cook.md+2 docs/system/hoon/library/src/4f/gate/easy.md+2 docs/system/hoon/library/src/4f/gate/full.md+2 docs/system/hoon/library/src/4f/gate/funk.md+2 docs/system/hoon/library/src/4f/gate/here.md+2 docs/system/hoon/library/src/4f/gate/ifix.md+2 docs/system/hoon/library/src/4f/gate/jest.md+2 docs/system/hoon/library/src/4f/gate/just.md+2 docs/system/hoon/library/src/4f/gate/knee.md+2 docs/system/hoon/library/src/4f/gate/mask.md+2 docs/system/hoon/library/src/4f/gate/more.md+2 docs/system/hoon/library/src/4f/gate/most.md+2 docs/system/hoon/library/src/4f/gate/next.md+2 docs/system/hoon/library/src/4f/gate/plus.md+2 docs/system/hoon/library/src/4f/gate/sear.md+2 docs/system/hoon/library/src/4f/gate/shim.md+2 docs/system/hoon/library/src/4f/gate/slug.md+2 docs/system/hoon/library/src/4f/gate/stag.md+2 docs/system/hoon/library/src/4f/gate/star.md+2 docs/system/hoon/library/src/4f/gate/stet.md+2 docs/system/hoon/library/src/4f/gate/stew.md+2 docs/system/hoon/library/src/4f/gate/stir.md+2 docs/system/hoon/library/src/4f/gate/stun.md+2 docs/system/hoon/library/src/4g/gate/rash.md+2 docs/system/hoon/library/src/4g/gate/rush.md+2 docs/system/hoon/library/src/4g/gate/rust.md+2 docs/system/hoon/library/src/4g/gate/scan.md+2 docs/system/hoon/library/src/4h/gate/ace.md+2 docs/system/hoon/library/src/4h/gate/bar.md+2 docs/system/hoon/library/src/4h/gate/bas.md+2 docs/system/hoon/library/src/4h/gate/buc.md+2 docs/system/hoon/library/src/4h/gate/cab.md+2 docs/system/hoon/library/src/4h/gate/cen.md+2 docs/system/hoon/library/src/4h/gate/col.md+2 docs/system/hoon/library/src/4h/gate/com.md+2 docs/system/hoon/library/src/4h/gate/doq.md+2 docs/system/hoon/library/src/4h/gate/dot.md+2 docs/system/hoon/library/src/4h/gate/fas.md+2 docs/system/hoon/library/src/4h/gate/gal.md+2 docs/system/hoon/library/src/4h/gate/gar.md+2 docs/system/hoon/library/src/4h/gate/hax.md+2 docs/system/hoon/library/src/4h/gate/hep.md+2 docs/system/hoon/library/src/4h/gate/kel.md+2 docs/system/hoon/library/src/4h/gate/ker.md+2 docs/system/hoon/library/src/4h/gate/ket.md+2 docs/system/hoon/library/src/4h/gate/lus.md+2 docs/system/hoon/library/src/4h/gate/pam.md+2 docs/system/hoon/library/src/4h/gate/pat.md+2 docs/system/hoon/library/src/4h/gate/pel.md+2 docs/system/hoon/library/src/4h/gate/per.md+2 docs/system/hoon/library/src/4h/gate/sel.md+2 docs/system/hoon/library/src/4h/gate/sem.md+2 docs/system/hoon/library/src/4h/gate/ser.md+2 docs/system/hoon/library/src/4h/gate/sig.md+2 docs/system/hoon/library/src/4h/gate/soq.md+2 docs/system/hoon/library/src/4h/gate/tar.md+2 docs/system/hoon/library/src/4h/gate/tec.md+2 docs/system/hoon/library/src/4h/gate/tis.md+2 docs/system/hoon/library/src/4h/gate/wut.md+2 docs/system/hoon/library/src/4h/gate/zap.md+2 docs/system/hoon/library/src/4j/core/ab.md+2 docs/system/hoon/library/src/4j/core/mu.md+2 docs/system/hoon/library/src/4j/core/ne.md+2 docs/system/hoon/library/src/4k/core/co.md+2 docs/system/hoon/library/src/4k/gate/alf.md+2 docs/system/hoon/library/src/4k/gate/aln.md+2 docs/system/hoon/library/src/4k/gate/alp.md+2 docs/system/hoon/library/src/4k/gate/bet.md+2 docs/system/hoon/library/src/4k/gate/bin.md+2 docs/system/hoon/library/src/4k/gate/but.md+2 docs/system/hoon/library/src/4k/gate/cit.md+2 docs/system/hoon/library/src/4k/gate/dem.md+2 docs/system/hoon/library/src/4k/gate/dit.md+2 docs/system/hoon/library/src/4k/gate/dog.md+2 docs/system/hoon/library/src/4k/gate/doh.md+2 docs/system/hoon/library/src/4k/gate/dun.md+2 docs/system/hoon/library/src/4k/gate/duz.md+2 docs/system/hoon/library/src/4k/gate/gah.md+2 docs/system/hoon/library/src/4k/gate/gap.md+2 docs/system/hoon/library/src/4k/gate/gaq.md+2 docs/system/hoon/library/src/4k/gate/gaw.md+2 docs/system/hoon/library/src/4k/gate/gay.md+2 docs/system/hoon/library/src/4k/gate/gon.md+2 docs/system/hoon/library/src/4k/gate/gul.md+2 docs/system/hoon/library/src/4k/gate/hex.md+2 docs/system/hoon/library/src/4k/gate/hig.md+2 docs/system/hoon/library/src/4k/gate/hit.md+2 docs/system/hoon/library/src/4k/gate/iny.md+2 docs/system/hoon/library/src/4k/gate/low.md+2 docs/system/hoon/library/src/4k/gate/mes.md+2 docs/system/hoon/library/src/4k/gate/nix.md+2 docs/system/hoon/library/src/4k/gate/nud.md+2 docs/system/hoon/library/src/4k/gate/prn.md+2 docs/system/hoon/library/src/4k/gate/qat.md+2 docs/system/hoon/library/src/4k/gate/qit.md+2 docs/system/hoon/library/src/4k/gate/qut.md+2 docs/system/hoon/library/src/4k/gate/soz.md+2 docs/system/hoon/library/src/4k/gate/sym.md+2 docs/system/hoon/library/src/4k/gate/ven.md+2 docs/system/hoon/library/src/4k/gate/vit.md+2 docs/system/hoon/library/src/4k/gate/vul.md+2 docs/system/hoon/library/src/4l/core/so.md+2 docs/system/hoon/library/src/4m/gate/scot.md+2 docs/system/hoon/library/src/4m/gate/scow.md+2 docs/system/hoon/library/src/4m/gate/slat.md+2 docs/system/hoon/library/src/4m/gate/slav.md+2 docs/system/hoon/library/src/4m/gate/slaw.md+2 docs/system/hoon/library/src/4m/gate/slay.md+2 docs/system/hoon/library/src/4m/gate/smyt.md+2 docs/system/hoon/library/src/4m/gate/spat.md+2 docs/system/hoon/library/src/4m/gate/spud.md+2 docs/system/hoon/library/src/4m/gate/stab.md+2 docs/system/hoon/library/src/4n/gate/mack.md+2 docs/system/hoon/library/src/4n/gate/mink.md+2 docs/system/hoon/library/src/4n/gate/mock.md+2 docs/system/hoon/library/src/4n/gate/mong.md+2 docs/system/hoon/library/src/4n/gate/mook.md+2 docs/system/hoon/library/src/4n/gate/mule.md+2 docs/system/hoon/library/src/4n/gate/mute.md+2 docs/system/hoon/library/src/4o/mold/abel.md+2 docs/system/hoon/library/src/4o/mold/aura.md+2 docs/system/hoon/library/src/4o/mold/axis.md+2 docs/system/hoon/library/src/4o/mold/base.md+2 docs/system/hoon/library/src/4o/mold/bean.md+2 docs/system/hoon/library/src/4o/mold/beer.md+2 docs/system/hoon/library/src/4o/mold/beet.md+2 docs/system/hoon/library/src/4o/mold/chum.md+2 docs/system/hoon/library/src/4o/mold/coil.md+2 docs/system/hoon/library/src/4o/mold/foot.md+2 docs/system/hoon/library/src/4o/mold/limb.md+2 docs/system/hoon/library/src/4o/mold/line.md+2 docs/system/hoon/library/src/4o/mold/metl.md+2 docs/system/hoon/library/src/4o/mold/nock.md+2 docs/system/hoon/library/src/4o/mold/noun.md+2 docs/system/hoon/library/src/4o/mold/null.md+2 docs/system/hoon/library/src/4o/mold/port.md+2 docs/system/hoon/library/src/4o/mold/span.md+2 docs/system/hoon/library/src/4o/mold/tiki.md+2 docs/system/hoon/library/src/4o/mold/toga.md+2 docs/system/hoon/library/src/4o/mold/tone.md+2 docs/system/hoon/library/src/4o/mold/tuna.md+2 docs/system/hoon/library/src/4o/mold/tusk.md+2 docs/system/hoon/library/src/4o/mold/twig.md+2 docs/system/hoon/library/src/4o/mold/tyke.md+2 docs/system/hoon/library/src/4o/mold/typo.md+2 docs/system/hoon/library/src/4o/mold/tyre.md+2 docs/system/hoon/library/src/4o/mold/vase.md+2 docs/system/hoon/library/src/4o/mold/vise.md+2 docs/system/hoon/library/src/4o/mold/wing.md+2 docs/system/hoon/library/src/5f/mold/mane.md+2 docs/system/hoon/library/src/5f/mold/manx.md+2 docs/system/hoon/library/src/5f/mold/marl.md+2 docs/system/hoon/library/src/5f/mold/mars.md+2 docs/system/hoon/library/src/5f/mold/mart.md+2 docs/system/hoon/library/src/5f/mold/marx.md+2 docs/system/hoon/library/src/5f/mold/pass.md+2 docs/system/hoon/library/src/5f/mold/ring.md+2 docs/system/hoon/library/src/5f/mold/time.md+2
docs/system/hoon/library/1a.mdnew file+507
@@ -0,0 +1,507 @@
1+## 1a: basic arithmetic
2+### `++add`
3+
4+Add
5+
6+Produces the sum of `a` and `b`.
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+ ++ add :: add
24+ ~/ %add
25+ |= [a=@ b=@]
26+ ^- @
27+ ?: =(0 a) b
28+ $(a (dec a), b +(b))
29+
30+Examples
31+--------
32+
33+ ~zod/try=> (add 2 2)
34+ 4
35+ ~zod/try=> (add 1 1.000.000)
36+ 1.000.001
37+ ~zod/try=> (add 1.333 (mul 2 2))
38+ 1.337
39+
40+***
41+### `++dec`
42+
43+Decrement
44+
45+Decrements `a` by `1`.
46+
47+Accepts
48+-------
49+
50+`a` is an [atom]().
51+
52+Produces
53+--------
54+
55+An atom.
56+
57+Source
58+------
59+
60+ ++ dec :: decrement
61+ ~/ %dec
62+ |= a=@
63+ ~| %decrement-underflow
64+ ?< =(0 a)
65+ =+ b=0
66+ |- ^- @
67+ ?: =(a +(b)) b
68+ $(b +(b))
69+ ::
70+
71+Examples
72+--------
73+
74+ ~zod/try=> (dec 7)
75+ 6
76+ ~zod/try=> (dec 0)
77+ ! decrement-underflow
78+ ! exit
79+
80+
81+
82+***
83+### `++div`
84+
85+Divide
86+
87+Computes `a` divided by `b`.
88+
89+Accepts
90+-------
91+
92+`a` is an [atom]().
93+
94+`b` is an [atom]().
95+
96+Produces
97+--------
98+
99+An atom.
100+
101+Source
102+------
103+
104+ ++ div :: divide
105+ ~/ %div
106+ |= [a=@ b=@]
107+ ^- @
108+ ~| 'div'
109+ ?< =(0 b)
110+ =+ c=0
111+ |-
112+ ?: (lth a b) c
113+ $(a (sub a b), c +(c))
114+ ::
115+
116+Examples
117+--------
118+
119+ ~zod/try=> (div 4 2)
120+ 2
121+ ~zod/try=> (div 17 8)
122+ 2
123+ ~zod/try=> (div 20 30)
124+ 0
125+
126+
127+***
128+### `++gte`
129+
130+Greater-than/equal
131+
132+Tests whether `a` is greater than a number `b`.
133+
134+Accepts
135+-------
136+
137+`a` is an [atom]().
138+
139+`b` is an atom.
140+
141+Produces
142+--------
143+
144+A boolean.
145+
146+Source
147+------
148+
149+ ++ gte :: greater-equal
150+ ~/ %gte
151+ |= [a=@ b=@]
152+ ^- ?
153+ !(lth a b)
154+ ::
155+
156+Examples
157+--------
158+
159+ ~zod/try=> (gte 100 10)
160+ %.y
161+ ~zod/try=> (gte 4 4)
162+ %.y
163+ ~zod/try=> (gte 3 4)
164+ %.n
165+
166+
167+
168+***
169+### `++gth`
170+
171+Greater-than
172+
173+Tests whether `a` is greater than `b`.
174+
175+Accepts
176+-------
177+
178+`a` is an [atom]().
179+
180+`b` is an atom.
181+
182+Produces
183+--------
184+
185+A boolean.
186+
187+Source
188+------
189+
190+ ++ gth :: greater-than
191+ ~/ %gth
192+ |= [a=@ b=@]
193+ ^- ?
194+ !(lte a b)
195+ ::
196+
197+Examples
198+--------
199+
200+ ~zod/try=> (gth 'd' 'c')
201+ %.y
202+ ~zod/try=> (gth ~h1 ~m61)
203+ %.n
204+
205+
206+
207+***
208+### `++lte`
209+
210+Less-than/equal
211+
212+Tests whether `a` is less than or equal to `b`.
213+
214+Accepts
215+-------
216+
217+`a` is an [atom]().
218+
219+`b` is an atom.
220+
221+Produces
222+--------
223+
224+A boolean.
225+
226+Source
227+------
228+
229+ ++ lte :: less-equal
230+ ~/ %lte
231+ |= [a=@ b=@]
232+ |(=(a b) (lth a b))
233+ ::
234+
235+Examples
236+--------
237+
238+ ~zod/try=> (lte 4 5)
239+ %.y
240+ ~zod/try=> (lte 5 4)
241+ %.n
242+ ~zod/try=> (lte 5 5)
243+ %.y
244+ ~zod/try=> (lte 0 0)
245+ %.y
246+
247+
248+
249+***
250+### `++lth`
251+
252+Less-than
253+
254+Tests whether `a` is less than `b`.
255+
256+Accepts
257+-------
258+
259+`a` is an [atom]().
260+
261+`b` is an atom.
262+
263+Produces
264+--------
265+
266+A boolean.
267+
268+Source
269+------
270+
271+ ++ lth :: less-than
272+ ~/ %lth
273+ |= [a=@ b=@]
274+ ^- ?
275+ ?& !=(a b)
276+ |-
277+ ?| =(0 a)
278+ ?& !=(0 b)
279+ $(a (dec a), b (dec b))
280+ == == ==
281+ ::
282+
283+Examples
284+--------
285+
286+ ~zod/try=> (lth 4 5)
287+ %.y
288+ ~zod/try=> (lth 5 4)
289+ %.n
290+ ~zod/try=> (lth 5 5)
291+ %.n
292+ ~zod/try=> (lth 5 0)
293+ %.n
294+
295+
296+***
297+### `++max`
298+
299+Maximum
300+
301+Computes the greater of `a` and `b`.
302+
303+Accepts
304+-------
305+
306+`a` is an [atom]().
307+
308+`b` is an atom.
309+
310+Produces
311+--------
312+
313+An atom.
314+
315+Source
316+------
317+
318+ ++ max :: maximum
319+ ~/ %max
320+ |= [a=@ b=@]
321+ ^- @
322+ ?: (gth a b) a
323+ b
324+ ::
325+
326+Examples
327+--------
328+
329+ ~zod/try=> (max 10 100)
330+ 100
331+ ~zod/try=> (max 10.443 9)
332+ 10.443
333+ ~zod/try=> (max 0 1)
334+ 1
335+
336+
337+
338+***
339+### `++min`
340+
341+Minimum
342+
343+Computes the lesser of `a` and `b`.
344+
345+Accepts
346+-------
347+
348+`a` is an [atom]().
349+
350+`b` is an atom.
351+
352+Produces
353+--------
354+
355+An atom.
356+
357+Source
358+------
359+
360+ ++ min :: minimum
361+ ~/ %min
362+ |= [a=@ b=@]
363+ ^- @
364+ ?: (lth a b) a
365+ b
366+ ::
367+
368+Examples
369+--------
370+
371+ ~zod/try=> (min 10 100)
372+ 10
373+ ~zod/try=> (min 10.443 9)
374+ 9
375+ ~zod/try=> (min 0 1)
376+ 0
377+
378+
379+
380+***
381+### `++mod`
382+
383+Modulus
384+
385+Computes the remainder of dividing `a` by `b`.
386+
387+Accepts
388+-------
389+
390+`a` is an [atom]().
391+
392+`b` is an atom.
393+
394+Produces
395+--------
396+
397+An atom.
398+
399+Source
400+------
401+
402+ ++ mod :: remainder
403+ ~/ %mod
404+ |= [a=@ b=@]
405+ ^- @
406+ ?< =(0 b)
407+ (sub a (mul b (div a b)))
408+ ::
409+
410+Examples
411+--------
412+
413+ ~zod/try=> (mod 5 2)
414+ 1
415+ ~zod/try=> (mod 5 5)
416+ 0
417+
418+
419+
420+***
421+### `++mul`
422+
423+Multiply
424+
425+Multiplies `a` by `b`.
426+
427+Accepts
428+-------
429+
430+`a` is an [atom]().
431+
432+`b` is an atom.
433+
434+Produces
435+--------
436+
437+An atom.
438+
439+Source
440+------
441+
442+ ++ mul :: multiply
443+ ~/ %mul
444+ |= [a=@ b=@]
445+ ^- @
446+ =+ c=0
447+ |-
448+ ?: =(0 a) c
449+ $(a (dec a), c (add b c))
450+ ::
451+
452+Examples
453+--------
454+
455+ ~zod/try=> (mul 3 4)
456+ 12
457+ ~zod/try=> (mul 0 1)
458+ 0
459+
460+
461+
462+***
463+### `++sub`
464+
465+Subtract
466+
467+Subtracts `b` from `a`.
468+
469+Accepts
470+-------
471+
472+`a` is an [atom]().
473+
474+`b` is an [atom]().
475+
476+Produces
477+--------
478+
479+An atom.
480+
481+Source
482+------
483+
484+ ++ sub :: subtract
485+ ~/ %sub
486+ |= [a=@ b=@]
487+ ~| %subtract-underflow
488+ ^- @
489+ ?: =(0 b) a
490+ $(a (dec a), b (dec b))
491+
492+Examples
493+--------
494+
495+ ~zod/try=> (sub 10 5)
496+ 5
497+ ~zod/try=> (sub 243 44)
498+ 199
499+ ~zod/try=> (sub 5 0)
500+ 5
501+ ~zod/try=> (sub 0 5)
502+ ! subtract-underflow
503+ ! exit
504+
505+
506+
507+***
docs/system/hoon/library/1b.mdnew file+143
@@ -0,0 +1,143 @@
1+## 1b: tree addressing
2+### `++cap`
3+
4+Tree head
5+
6+Tests whether an `a` is in the head or tail of a [noun](). Produces the
7+[cube]() `%2` if it is within the head, or the cube `%3` if it is
8+within the tail.
9+
10+Accepts
11+-------
12+
13+`a` is an atom.
14+
15+Produces
16+--------
17+
18+A [cube]().
19+
20+Source
21+------
22+
23+ ++ cap :: tree head
24+ ~/ %cap
25+ |= a=@
26+ ^- ?(%2 %3)
27+ ?- a
28+ %2 %2
29+ %3 %3
30+ ?(%0 %1) !!
31+ * $(a (div a 2))
32+ ==
33+ ::
34+
35+Examples
36+--------
37+
38+ ~zod/try=> (cap 4)
39+ %2
40+ ~zod/try=> (cap 6)
41+ %3
42+ ~zod/try=> (cap (add 10 9))
43+ %2
44+
45+
46+
47+***
48+### `++mas`
49+
50+Axis within head/tail?
51+
52+Computes the axis of `a` within either the head or tail of a noun (depends whether `a` lies within the the head or tail).
53+
54+Accepts
55+-------
56+
57+`a` is an [atom]().
58+
59+Produces
60+--------
61+
62+An atom.
63+
64+Source
65+------
66+
67+ ++ mas :: tree body
68+ ~/ %mas
69+ |= a=@
70+ ^- @
71+ ?- a
72+ 1 !!
73+ 2 1
74+ 3 1
75+ * (add (mod a 2) (mul $(a (div a 2)) 2))
76+ ==
77+ ::
78+
79+Examples
80+--------
81+
82+ ~zod/try=> (mas 3)
83+ 1
84+ ~zod/try=> (mas 4)
85+ 2
86+ ~zod/try=> (mas 5)
87+ 3
88+ ~zod/try=> (mas 6)
89+ 2
90+ ~zod/try=> (mas 0)
91+ ! exit
92+ ~zod/try=> (mas 1)
93+ ! exit
94+
95+
96+
97+***
98+### `++peg`
99+
100+Axis within axis
101+
102+Computes the axis of `b` within axis `a`.
103+
104+Accepts
105+-------
106+
107+`a` is an [atom]().
108+
109+`b` is an atom.
110+
111+Produces
112+--------
113+
114+An atom.
115+
116+Source
117+------
118+
119+ ++ peg :: tree connect
120+ ~/ %peg
121+ |= [a=@ b=@]
122+ ^- @
123+ ?- b
124+ 1 a
125+ 2 (mul a 2)
126+ 3 +((mul a 2))
127+ * (add (mod b 2) (mul $(b (div b 2)) 2))
128+ ==
129+ ::
130+
131+Examples
132+--------
133+
134+ ~zod/try=> (peg 4 1)
135+ 4
136+ ~zod/try=> (peg 4 2)
137+ 8
138+ ~zod/try=> (peg 8 45)
139+ 269
140+
141+
142+
143+***
docs/system/hoon/library/1c.mdnew file+273
@@ -0,0 +1,273 @@
1+## 1c: molds and mold builders
2+### `++bloq`
3+
4+Blocksize
5+
6+Atom representing a blocksize, by convention expressed as a power of 2.
7+
8+
9+Source
10+------
11+
12+ ++ bloq ,@ :: blockclass
13+
14+Examples
15+--------
16+
17+ ~zod/try=> :: ++met measures how many bloqs long an atom is
18+ ~zod/try=> (met 3 256)
19+ 2
20+ ~zod/try=> :: 256 is 2 bloqs of 2^3
21+
22+
23+***
24+### `++each`
25+
26+Mold of fork between two
27+
28+[mold]() generator: produces a dicriminated [fork]() between two types.
29+
30+Source
31+------
32+
33+ ++ each |*([a=$+(* *) b=$+(* *)] $%([& p=a] [| p=b])) :: either a or b
34+
35+Examples
36+--------
37+
38+ ~zod/try=> :type; *(each cord time)
39+ [%.y p='']
40+ {[%.y p=@t] [%.n p=@da]}
41+
42+
43+
44+***
45+### `++gate`
46+
47+Function
48+
49+A core with one arm, `$`--the empty name--which transforms a sample noun into a product
50+noun. If used [dryly]() as a type, the [subject]() must have a sample type of [`*`]().
51+
52+
53+Source
54+------
55+
56+ ++ gate $+(* *) :: general gate
57+
58+Examples
59+--------
60+
61+See also: [`++lift`](), [`++cork`]()
62+
63+ ~zod/try=> *gate
64+ <1|mws [* <101.jzo 1.ypj %164>]>
65+ ~zod/try=> `gate`|=(* 0)
66+ <1|mws [* <101.jzo 1.ypj %164>]>
67+
68+ ~zod/try=> (|=(a=* [a 'b']) 'c')
69+ [99 'b']
70+ ~zod/try=> (`gate`|=(a=* [a 'b']) 'c')
71+ [99 98]
72+
73+
74+
75+***
76+### `++list`
77+
78+List
79+
80+[mold]() generator. `++list` generates a mold of a null-termanated list of a
81+homogenous type.
82+
83+
84+Source
85+------
86+
87+ ++ list |* a=_,* :: null-term list
88+
89+Examples
90+--------
91+
92+See also: [`++turn`](), [`++snag`]()
93+
94+ ~zod/try=> *(list)
95+ ~
96+ ~zod/try=> `(list ,@)`"abc"
97+ ~[97 98 99]
98+ ~zod/try=> (snag 0 "abc")
99+ ~~a
100+
101+
102+
103+***
104+### `++lone`
105+
106+Tile generator. `++lone` puts face of `p` on something.
107+
108+XX unused
109+
110+Source
111+------
112+
113+ ++ lone |*(a=$+(* *) ,p=a) :: just one thing
114+
115+
116+
117+***
118+### `++pair`
119+
120+Mold of pair of types
121+
122+[mold]() generator. Produces a tuple of two of the types passed in.
123+
124+
125+Source
126+------
127+
128+ ++ pair |*([a=$+(* *) b=$+(* *)] ,[p=a q=b]) :: just a pair
129+
130+
131+Examples
132+--------
133+
134+ ~zod/try=> *(pair bean cord)
135+ [p=%.y q='']
136+
137+
138+
139+***
140+### `++pole`
141+
142+Faceless list
143+
144+A [`++list`]() without the [face]()s `i` and `t`.
145+
146+Source
147+------
148+
149+ ++ pole |* a=_,* :: nameless list
150+
151+Examples
152+--------
153+
154+ ~zod/try=> `(pole char)`"asdf"
155+ [~~a [~~s [~~d [~~f ~]]]]
156+
157+
158+
159+***
160+### `++qual`
161+
162+Mold of 4 type tuple
163+
164+A `++qual` is a tuple of four of the types passed in.
165+
166+Source
167+------
168+
169+ ++ qual |* [a=$+(* *) b=$+(* *) c=$+(* *) d=$+(* *)] :: just a quadruple
170+
171+Examples
172+--------
173+
174+ ~zod/try=> *(qual date time tape cord)
175+ [p=[[a=%.y y=0] m=0 t=[d=0 h=0 m=0 s=0 f=~]] q=~292277024401-.1.1 r="" s='']
176+
177+
178+
179+***
180+### `++trap`
181+
182+Core with one arm `$`
183+
184+A trap is a core with one arm `++$`. Used when XX
185+
186+Source
187+------
188+
189+ ++ trap ,_|.(_*) :: makes perfect sense
190+
191+Examples
192+--------
193+
194+See also: `|.`
195+
196+ ~zod/try=> *trap
197+ <1.mws 101.jzo 1.ypj %164>
198+ ~zod/try=> (*trap)
199+ 0
200+ ~zod/try=> (|.(42))
201+ 42
202+
203+
204+
205+***
206+### `++tree`
207+
208+Tree mold generator
209+
210+A `++tree` can be empty, or contain a node of a type and
211+left/right sub `++tree` of the same type. Pretty-printed with `{}`.
212+
213+Source
214+------
215+
216+ ++ tree |* a=_,* :: binary tree
217+
218+Examples
219+--------
220+
221+ ~zod/try=> `(tree ,[@ tape])`[[1 "hi"] [[2 "bye"] ~ ~] ~]
222+ {[2 "bye"] [1 "hi"]}
223+
224+
225+
226+***
227+### `++trel`
228+
229+Mold of three types
230+
231+[`++mold`]() of the tuple of the three types passed in.
232+
233+Source
234+------
235+
236+ ++ trel |* [a=$+(* *) b=$+(* *) c=$+(* *)] :: just a triple
237+
238+Examples
239+--------
240+
241+ ~zod/try=> *(trel ,@ud ,@t ,@s)
242+ [p=0 q='' r=--0]
243+
244+
245+
246+***
247+### `++unit`
248+
249+Maybe
250+
251+[mold]() generator. A `++unit` is either `~` or `[~ u=a]` where `a` is the
252+type that was passed in.
253+
254+
255+Source
256+------
257+
258+ ++ unit |* a=_,* :: maybe
259+
260+Examples
261+--------
262+
263+See also: [`++bind`]()
264+
265+ ~zod/try=> :type; *(unit time)
266+ ~
267+ u(@da)
268+ ~zod/try=> `(unit time)`[~ -<-]
269+ [~ ~2014.9.24..19.25.10..7dd5]
270+
271+
272+
273+***
docs/system/hoon/library/2a.mdnew file+442
@@ -0,0 +1,442 @@
1+## 2a: unit logic
2+### `++biff`
3+
4+Unit as argument
5+
6+Applies a function `b` that produces a unit to the unwrapped value of [++unit]()
7+`a` (`u.a`). If `a` is empty, `~` is produced.
8+
9+Accepts
10+-------
11+
12+`a` is a unit.
13+
14+`b` is a function that accepts a noun and produces a unit.
15+
16+Produces
17+--------
18+
19+A unit.
20+
21+Source
22+------
23+
24+ ++ biff :: apply
25+ |* [a=(unit) b=$+(* (unit))]
26+ ?~ a ~
27+ (b u.a)
28+
29+Examples
30+--------
31+
32+ ~zod/try=> (biff (some 5) |=(a=@ (some (add a 2))))
33+ [~ u=7]
34+ ~zod/try=> (biff ~ |=(a=@ (some (add a 2))))
35+ ~
36+
37+
38+
39+***
40+### `++bind`
41+
42+Non-unit function to unit, producing unit
43+
44+Applies a function `b` to the value (`u.a`) of a [++unit]() `a`, producing
45+a unit. Used when you want a function that does not accept or produce a
46+unit to both accept and produce a unit.
47+
48+Accepts
49+-------
50+
51+`a` is a unit.
52+
53+`b` is a function.
54+
55+Produces
56+--------
57+
58+A unit.
59+
60+Source
61+------
62+
63+ ++ bind :: argue
64+ |* [a=(unit) b=gate]
65+ ?~ a ~
66+ [~ u=(b u.a)]
67+
68+Examples
69+--------
70+
71+ ~zod/try=> (bind ((unit ,@) [~ 97]) ,@t)
72+ [~ `a`]
73+ ~zod/try=> =a |=(a=@ (add a 1))
74+ ~zod/try=> (bind ((unit ,@) [~ 2]) a)
75+ [~ 3]
76+
77+
78+
79+***
80+### `++bond`
81+
82+Replace null
83+
84+Replaces an empty [++unit]() `b` with the product of a called [trap]()
85+`a`. If the unit is not empty, then the original unit is produced.
86+
87+Accepts
88+-------
89+
90+`a` is a trap.
91+
92+`b` is a unit.
93+
94+Produces
95+--------
96+
97+Either the product of `a` or the value inside of unit `b`.
98+
99+Source
100+------
101+
102+ ++ bond :: replace
103+ |* a=trap
104+ |* b=(unit)
105+ ?~ b $:a
106+ u.b
107+
108+Examples
109+--------
110+
111+ ~zod/try=> (bex 10)
112+ 1.024
113+ ~zod/try=> ((bond |.((bex 10))) ~)
114+ 1.024
115+ ~zod/try=> ((bond |.((bex 10))) (slaw %ud '123'))
116+ 123
117+
118+
119+
120+***
121+### `++both`
122+
123+Group unit values into pair
124+
125+Produces `~` if either `a` or `b` are empty. Otherwise, produces a
126+[++unit]() whose value is a cell of the values of two input units `a` and
127+`b`.
128+
129+Accepts
130+-------
131+
132+`a` is a unit.
133+
134+`b` is a unit.
135+
136+Produces
137+--------
138+
139+A unit of the two initial values.
140+
141+Source
142+------
143+
144+ ++ both :: all the above
145+ |* [a=(unit) b=(unit)]
146+ ?~ a ~
147+ ?~ b ~
148+ [~ u=[u.a u.b]]
149+
150+Examples
151+--------
152+
153+ ~zod/try=> (both (some 1) (some %b))
154+ [~ u=[1 %b]]
155+ ~zod/try=> (both ~ (some %b))
156+ ~
157+
158+
159+***
160+### `++clap`
161+
162+Apply function to two units
163+
164+Applies a binary function `c`--which does not usually accept or produce a [`++unit`]()--
165+to the values of two units, `a` and `b`, producing a unit.
166+
167+Accepts
168+-------
169+
170+`a` is a unit.
171+
172+`b` is a unit.
173+
174+`c` is a function that performs a binary operation.
175+
176+Produces
177+--------
178+
179+A unit.
180+
181+Source
182+------
183+
184+ ++ clap :: combine
185+ |* [a=(unit) b=(unit) c=_|=(^ +<-)]
186+ ?~ a b
187+ ?~ b a
188+ [~ u=(c u.a u.b)]
189+
190+Examples
191+--------
192+
193+ ~zod/try=> =u ((unit ,@t) [~ 'a'])
194+ ~zod/try=> =v ((unit ,@t) [~ 'b'])
195+ ~zod/try=> (clap u v |=([a=@t b=@t] (welp (trip a) (trip b))))
196+ [~ u="ab"]
197+ ~zod/try=> =a ((unit ,@u) [~ 1])
198+ ~zod/try=> =b ((unit ,@u) [~ 2])
199+ ~zod/try=> =c |=([a=@ b=@] (add a b))
200+ ~zod/try=> (clap a b c)
201+ [~ 3]
202+
203+
204+
205+***
206+### `++drop`
207+
208+Unit to list
209+
210+Makes a [++list]() of the unwrapped value (`u.a`) of a [`++unit`]() `a`.
211+
212+Accepts
213+-------
214+
215+`a` is a unit.
216+
217+Produces
218+--------
219+
220+A list.
221+
222+Source
223+------
224+
225+ ++ drop :: enlist
226+ |* a=(unit)
227+ ?~ a ~
228+ [i=u.a t=~]
229+
230+Examples
231+--------
232+
233+ ~zod/try=> =a ((unit ,@) [~ 97])
234+ ~zod/try=> (drop a)
235+ [i=97 t=~]
236+ ~zod/try=> =a ((unit ,@) [~])
237+ ~zod/try=> (drop a)
238+ ~
239+
240+
241+
242+***
243+### `++fall`
244+
245+Give unit a default value
246+
247+Produces a default value `b` for a [`++unit`]() `a` in cases where `a` is null.
248+
249+Accepts
250+-------
251+
252+`a` is a unit.
253+
254+`b` is a [noun]() that's used as the default value.
255+
256+Produces
257+--------
258+
259+Either a noun `b` or the unwrapped value of unit `a`.
260+
261+Source
262+------
263+
264+ ++ fall :: default
265+ |* [a=(unit) b=*]
266+ ?~(a b u.a)
267+
268+Examples
269+--------
270+
271+ ~zod/try=> (fall ~ `a`)
272+ `a`
273+ ~zod/try=> (fall [~ u=0] `a`)
274+ 0
275+
276+
277+
278+***
279+### `++lift`
280+
281+Curried bind
282+
283+Accepts a [`++gate`]() `a` and produces a function that accepts [`++unit`]()
284+`b` to which it applies `a`. Used when you want a function that does not accept
285+or produce a unit to both accept and produce a unit.
286+
287+Accepts
288+-------
289+
290+`a` is a gate.
291+
292+`b` is a unit.
293+
294+Produces
295+--------
296+
297+A unit.
298+
299+Source
300+------
301+
302+ ++ lift :: lift gate (fmap)
303+ |* a=gate :: flipped
304+ |* b=(unit) :: curried
305+ (bind b a) :: bind
306+
307+Examples
308+--------
309+
310+ ~zod/try=> ((lift dec) `(unit ,@)`~)
311+ ~
312+ ~zod/try=> ((lift dec) `(unit ,@)`[~ 20])
313+ [~ 19]
314+
315+
316+
317+***
318+### `++mate`
319+
320+Choose
321+
322+Accepts two units `a` and `b` whose values are expected to be
323+equivalent. If either is empty, then the value of the other is produced.
324+If neither are empty, it asserts that both values are the same and
325+produces that value. If the assertion fails, `++mate` crashes with
326+`'mate'` in the stack trace.
327+
328+Accepts
329+-------
330+
331+`a` is a unit.
332+
333+`b` is a unit.
334+
335+Produces
336+--------
337+
338+A unit or crash.
339+
340+Source
341+------
342+
343+++ mate :: choose
344+ |* [a=(unit) b=(unit)]
345+ ?~ b a
346+ ?~ a b
347+ ?.(=(u.a u.b) ~|('mate' !!) a)
348+
349+Examples
350+--------
351+
352+ ~zod/try=> =a ((unit ,@) [~ 97])
353+ ~zod/try=> =b ((unit ,@) [~ 97])
354+ ~zod/try=> (mate a b)
355+ [~ 97]
356+ ~zod/try=> =a ((unit ,@) [~ 97])
357+ ~zod/try=> =b ((unit ,@) [~])
358+ ~zod/try=> (mate a b)
359+ [~ 97]
360+ ~zod/try=> =a ((unit ,@) [~ 97])
361+ ~zod/try=> =b ((unit ,@) [~ 98])
362+ ~zod/try=> (mate a b)
363+ ! 'mate'
364+ ! exit
365+
366+
367+
368+***
369+### `++need`
370+
371+Unwrap unit
372+
373+Retrieve the value from a [`++unit`]() and crash if the unit is null.
374+
375+Accepts
376+-------
377+
378+`a` is a unit.
379+
380+Produces
381+--------
382+
383+Either the unwrapped value of `a` (`u.a`), or crash.
384+
385+Source
386+------
387+
388+ ++ need :: demand
389+ |* a=(unit)
390+ ?~ a !!
391+ u.a
392+
393+Examples
394+--------
395+
396+ ~zod/try=> =a ((unit ,[@t @t]) [~ ['a' 'b']])
397+ ~zod/try=> (need a)
398+ ['a' 'b']
399+ ~zod/try=> =a ((unit ,@ud) [~ 17])
400+ ~zod/try=> (need a)
401+ 17
402+ ~zod/try=> =a ((unit ,@) [~])
403+ ~zod/try=> (need a)
404+ ! exit
405+
406+
407+
408+***
409+### `++some`
410+
411+Wrap value in a unit
412+
413+Takes any atom `a` and produces a [`++unit`]() with the value set to `a`.
414+
415+Accepts
416+-------
417+
418+`a` is a [noun]().
419+
420+Produces
421+--------
422+
423+A unit.
424+
425+Source
426+------
427+
428+ ++ some :: lift (pure)
429+ |* a=*
430+ [~ u=a]
431+
432+Examples
433+--------
434+
435+ ~zod/try=> (some [`a` `b`])
436+ [~ u=[`a` `b`]]
437+ ~zod/try=> (some &)
438+ [~ u=%.y]
439+
440+
441+
442+***
docs/system/hoon/library/2b.mdnew file+862
@@ -0,0 +1,862 @@
1+## 2b: list logic
2+Reverse
3+
4+### `++flop`
5+
6+Produces the list `a` in reverse order.
7+
8+Accepts
9+-------
10+
11+`a` is a list.
12+
13+Produces
14+--------
15+
16+A list.
17+
18+Source
19+------
20+
21+ ++ flop :: reverse
22+ ~/ %flop
23+ |* a=(list)
24+ => .(a (homo a))
25+ ^+ a
26+ =+ b=`_a`~
27+ |-
28+ ?~ a b
29+ $(a t.a, b [i.a b])
30+
31+
32+Examples
33+--------
34+
35+ ~zod/try=> =a (limo [1 2 3 ~])
36+ ~zod/try=> (flop a)
37+ ~[3 2 1]
38+
39+
40+
41+***
42+### `++homo`
43+
44+Homogenize
45+
46+Produces a [`++list`]() whose type is a fork of all the contained types in the
47+list `a`. Used when you want to make all the types of the elements of a list the same.
48+
49+Accepts
50+-------
51+
52+`a` is a list.
53+
54+Produces
55+--------
56+
57+a list.
58+
59+Source
60+------
61+
62+ ++ homo :: homogenize
63+ |* a=(list)
64+ ^+ =< $
65+ |% +- $ ?:(_? ~ [i=(snag 0 a) t=$])
66+ --
67+ a
68+
69+Examples
70+--------
71+
72+ ~zod/try=> lyst
73+ [i=1 t=[i=97 t=[i=2 t=[i=98 t=[i=[~ u=10] t=~]]]]]
74+ ~zod/try=> (homo lyst)
75+ ~[1 97 2 98 [~ u=10]]
76+ ~zod/try=> =a (limo [1 2 3 ~])
77+ ~zod/try=> a
78+ [i=1 t=[i=2 t=[i=3 t=~]]]
79+ ~zod/try=> (homo a)
80+ ~[1 2 3]
81+
82+
83+
84+***
85+### `++lent`
86+
87+List length
88+
89+Produces the length of any [`++list`]() `a` as an atom.
90+
91+Accepts
92+-------
93+
94+`a` is a list.
95+
96+Produces
97+--------
98+
99+an atom.
100+
101+Source
102+------
103+
104+ ++ lent :: length
105+ ~/ %lent
106+ |= a=(list)
107+ ^- @
108+ =+ b=0
109+ |-
110+ ?~ a b
111+ $(a t.a, b +(b))
112+
113+Examples
114+--------
115+
116+ ~zod/try=> (lent (limo [1 2 3 4 ~]))
117+ 4
118+ ~zod/try=> (lent (limo [1 'a' 2 'b' (some 10) ~]))
119+ 5
120+
121+
122+
123+***
124+### `++levy`
125+
126+Logical "and" on list
127+
128+Computes the Boolean logical "and" on the results of [gate]() `b` applied to each individual element in [`++list`]() `a`.
129+
130+Accepts
131+-------
132+
133+`a` is a list.
134+
135+`b` is a gate.
136+
137+Produces
138+--------
139+
140+Source
141+------
142+
143+ ++ levy
144+ ~/ %levy :: all of
145+ |* [a=(list) b=_|=(p=* .?(p))]
146+ |- ^- ?
147+ ?~ a &
148+ ?. (b i.a) |
149+ $(a t.a)
150+
151+Examples
152+--------
153+
154+ ~zod/try=> =a |=(a=@ (lte a 1))
155+ ~zod/try=> (levy (limo [0 1 2 1 ~]) a)
156+ %.n
157+ ~zod/try=> =a |=(a=@ (lte a 3))
158+ ~zod/try=> (levy (limo [0 1 2 1 ~]) a)
159+ %.y
160+
161+
162+
163+***
164+### `++lien`
165+
166+Logical "or" on list
167+
168+ ++ lien :: some of
169+ ~/ %lien
170+ |* [a=(list) b=$+(* ?)]
171+ |- ^- ?
172+ ?~ a |
173+ ?: (b i.a) &
174+ $(a t.a)
175+
176+Computes the Boolean logical "or" on the results of applying [gate]() `b` to every element of [`++list`]() `a`.
177+
178+`a` is a list.
179+
180+`b` is a gate.
181+
182+ ~zod/try=> =a |=(a=@ (gte a 1))
183+ ~zod/try=> (lien (limo [0 1 2 1 ~]) a)
184+ %.y
185+ ~zod/try=> =a |=(a=@ (gte a 3))
186+ ~zod/try=> (lien (limo [0 1 2 1 ~]) a)
187+ %.n
188+
189+
190+
191+***
192+### `++limo`
193+
194+List Constructor
195+
196+Turns a null-terminated tuple into a [`++list`]().
197+
198+Accepts
199+-------
200+
201+`a` is a null-terminated tuple.
202+
203+Produces
204+--------
205+
206+A list
207+
208+Source
209+------
210+
211+ ++ limo :: listify
212+ |* a=*
213+ ^+ =< $
214+ |% +- $ ?~(a ~ ?:(_? i=-.a t=$ $(a +.a)))
215+ --
216+ a
217+
218+Examples
219+--------
220+
221+ ~zod/try=> (limo [1 2 3 ~])
222+ [i=1 t=[i=2 t=[i=3 t=~]]]
223+
224+
225+
226+***
227+### `++murn`
228+
229+Maybe transform
230+
231+Passes each member of [`++list`]() `a` to [gate]() `b`, which must produce a
232+[`++unit`](). Produces a new list with all the results that do not produce
233+`~`.
234+
235+Accepts
236+-------
237+
238+`a` is a [list]().
239+
240+`b` is a [gate]() that produces a [unit]().
241+
242+Produces
243+--------
244+
245+A unit.
246+
247+Source
248+------
249+
250+ ++ murn :: maybe transform
251+ |* [a=(list) b=$+(* (unit))]
252+ |-
253+ ?~ a ~
254+ =+ c=(b i.a)
255+ ?~ c
256+ $(a t.a)
257+ [i=u.c t=$(a t.a)]
258+
259+Examples
260+--------
261+
262+ ~zod/try=> =a |=(a=@ ?.((gte a 2) ~ (some (add a 10))))
263+ ~zod/try=> (murn (limo [0 1 2 3 ~]) a)
264+ [i=12 t=[i=13 t=~]]
265+
266+
267+
268+***
269+### `++reap`
270+
271+Replicate
272+
273+Replicate: produces a [`++list`]() containing `a` copies of `b`.
274+
275+Accepts
276+-------
277+
278+`b` is a [noun]()
279+
280+Produces
281+--------
282+
283+A list.
284+
285+Source
286+------
287+
288+ ++ reap :: replicate
289+ |* [a=@ b=*]
290+ |- ^- (list ,_b)
291+ ?~ a ~
292+ [b $(a (dec a))]
293+
294+Examples
295+--------
296+
297+ ~zod/try=> (reap 20 %a)
298+ ~[%a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a]
299+ ~zod/try=> (reap 5 ~s1)
300+ ~[~s1 ~s1 ~s1 ~s1 ~s1]
301+ ~zod/try=> `@dr`(roll (reap 5 ~s1) add)
302+ ~s5
303+
304+
305+
306+***
307+### `++reel`
308+
309+Right fold
310+
311+Right fold: moves right to left across a [`++list`]() `a`, recursively slamming
312+a binary [gate]() `b` with an element from `a` and an accumulator, producing
313+the final value of the accumulator.
314+
315+Accepts
316+-------
317+
318+`b` is a binary gate.
319+
320+Produces
321+--------
322+
323+The accumulator, which is a [noun]().
324+
325+Source
326+------
327+
328+ ++ reel :: right fold
329+ ~/ %reel
330+ |* [a=(list) b=_|=([* *] +<+)]
331+ |- ^+ +<+.b
332+ ?~ a
333+ +<+.b
334+ (b i.a $(a t.a))
335+
336+Examples
337+--------
338+
339+ ~zod/try=> =sum =|([p=@ q=@] |.((add p q)))
340+ ~zod/try=> (reel (limo [1 2 3 4 5 ~]) sum)
341+ 15
342+ ~zod/try=> =a =|([p=@ q=@] |.((sub p q)))
343+ ~zod/try=> (reel (limo [6 3 1 ~]) a)
344+ 4
345+ ~zod/try=> (reel (limo [3 6 1 ~]) a)
346+ ! subtract-underflow
347+ ! exit
348+
349+
350+
351+***
352+### `++roll`
353+
354+Left fold
355+
356+Left fold: moves left to right across a list `a`, recursively slamming a
357+binary [gate]() `b` with an element from the [`++list`]() and an accumulator,
358+producing the final value of the accumulator.
359+
360+Accepts
361+-------
362+
363+`b` is a binary [gate]().
364+
365+Produces
366+--------
367+
368+The accumulator, which is a [noun]().
369+
370+Source
371+------
372+
373+ ++ roll :: left fold
374+ ~/ %roll
375+ |* [a=(list) b=_|=([* *] +<+)]
376+ |- ^+ +<+.b
377+ ?~ a
378+ +<+.b
379+ $(a t.a, b b(+<+ (b i.a +<+.b)))
380+
381+Examples
382+--------
383+
384+ ~zod/try=> =sum =|([p=@ q=@] |.((add p q)))
385+ ~zod/try=> (roll (limo [1 2 3 4 5 ~]) sum)
386+ q=15
387+ ~zod/try=> =a =|([p=@ q=@] |.((sub p q)))
388+ ~zod/try=> (roll (limo [6 3 1 ~]) a)
389+ ! subtract-underflow
390+ ! exit
391+ ~zod/try=> (roll (limo [1 3 6 ~]) a)
392+ q=4
393+
394+
395+
396+***
397+### `++scag`
398+
399+Prefix
400+
401+Accepts an atom `a` and [list]() `b`, producing the first `a` elements of
402+the front of the list.
403+
404+Accepts
405+-------
406+
407+`b` is a list.
408+
409+Produces
410+--------
411+
412+A list of the same type as `b`.
413+
414+Source
415+------
416+
417+ ++ scag :: prefix
418+ ~/ %scag
419+ |* [a=@ b=(list)]
420+ |- ^+ b
421+ ?: |(?=(~ b) =(0 a)) ~
422+ [i.b $(b t.b, a (dec a))]
423+
424+Examples
425+--------
426+
427+ ~zod/try=> (scag 2 (limo [0 1 2 3 ~]))
428+ [i=0 t=[i=1 t=~]]
429+ ~zod/try=> (scag 10 (limo [1 2 3 4 ~]))
430+ [i=1 t=[i=2 t=[i=3 t=[i=4 t=~]]]]
431+
432+
433+
434+***
435+### `++skid`
436+
437+Separate
438+
439+Separates a [`++list`]() `a` into two lists - Those elements of `a` who produce
440+true when slammed to [gate]() `b` and those who produce `%.n`.
441+
442+Accepts
443+-------
444+
445+`b` is a gate that accepts one argument and produces a loobean.
446+
447+Produces
448+--------
449+
450+A cell of two lists.
451+
452+Source
453+------
454+
455+ ++ skid :: separate
456+ |* [a=(list) b=$+(* ?)]
457+ |- ^+ [p=a q=a]
458+ ?~ a [~ ~]
459+ =+ c=$(a t.a)
460+ ?:((b i.a) [[i.a p.c] q.c] [p.c [i.a q.c]])
461+
462+
463+Examples
464+--------
465+
466+ ~zod/try=> =a |=(a=@ (gth a 1))
467+ ~zod/try=> (skid (limo [0 1 2 3 ~]) a)
468+ [p=[i=2 t=[i=3 t=~]] q=[i=0 t=[i=1 t=~]]]
469+
470+
471+
472+***
473+### `++skim`
474+
475+Suffix
476+
477+Cycles through the members of a list `a`, passing them to a gate `b` and
478+producing a list of all of the members that produce `%.y`. Inverse of
479+`++skip`.
480+
481+Accepts
482+-------
483+
484+`b` is a [gate]() that accepts one argument and produces a loobean.
485+
486+Produces
487+--------
488+
489+Source
490+------
491+
492+++ skim :: only
493+ ~/ %skim
494+ |* [a=(list) b=_|=(p=* .?(p))]
495+ |-
496+ ^+ a`
497+ ?~ a ~
498+ ?:((b i.a) [i.a $(a t.a)] $(a t.a))
499+
500+Examples
501+--------
502+
503+ ~zod/try=> =a |=(a=@ (gth a 1))
504+ ~zod/try=> (skim (limo [0 1 2 3 ~]) a)
505+ [i=2 t=[i=3 t=~]]
506+
507+
508+
509+***
510+### `++skip`
511+
512+Except
513+
514+Cycles through the members of [`++list`]() `a`, passing them to a [gate]() `b`.
515+Produces a list of all of the members that produce `%.n`. Inverse of
516+`++skim`.
517+
518+Accepts
519+-------
520+
521+`b` is a [gate]() that accepts one argument and produces a loobean.
522+
523+Produces
524+--------
525+
526+A list of the same type as `a`.
527+
528+Source
529+------
530+
531+ ++ skip :: except
532+ ~/ %skip
533+ |* [a=(list) b=_|=(p=* .?(p))]
534+ |-
535+ ^+ a
536+ ?~ a ~
537+ ?:((b i.a) $(a t.a) [i.a $(a t.a)])
538+
539+Examples
540+--------
541+
542+ ~zod/try=> =a |=(a=@ (gth a 1))
543+ ~zod/try=> (skip (limo [0 1 2 3 ~]) a)
544+ [i=0 t=[i=1 t=~]]
545+
546+
547+
548+***
549+### `++slag`
550+
551+Suffix
552+
553+Accepts an atom `a` and list `b`, producing the remaining elements from
554+`b` starting at `a`.
555+
556+Accepts
557+-------
558+
559+`b` is a [list]().
560+
561+Produces
562+--------
563+
564+A list of the same type as `b`.
565+
566+Source
567+------
568+
569+ ++ slag :: suffix
570+ ~/ %slag
571+ |* [a=@ b=(list)]
572+ |- ^+ b
573+ ?: =(0 a) b
574+ ?~ b ~
575+ $(b t.b, a (dec a))
576+
577+Examples
578+--------
579+
580+ ~zod/try=> (slag 2 (limo [1 2 3 4 ~]))
581+ [i=3 t=[i=4 t=~]]
582+ ~zod/try=> (slag 1 (limo [1 2 3 4 ~]))
583+ [i=2 t=[i=3 t=[i=4 t=~]]]
584+
585+
586+
587+***
588+### `++snag`
589+
590+Index
591+
592+Accepts an atom `a` and a [`++list`]() `b`, producing the element at the index
593+of `a`and failing if the list is null. Lists are 0-indexed.
594+
595+Accepts
596+-------
597+
598+`b` is a [list]().
599+
600+Produces
601+--------
602+
603+Produces an element of `b`, or crashes if no element exists at that index.
604+
605+Source
606+------
607+
608+ ++ snag :: index
609+ ~/ %snag
610+ |* [a=@ b=(list)]
611+ |-
612+ ?~ b
613+ ~|('snag-fail' !!)
614+ ?: =(0 a) i.b
615+ $(b t.b, a (dec a))
616+
617+Examples
618+--------
619+
620+ ~zod/try=> (snag 2 "asdf")
621+ ~~d
622+ ~zod/try=> (snag 0 `(list ,@ud)`~[1 2 3 4])
623+ 1
624+
625+
626+
627+***
628+### `++sort`
629+
630+Quicksort
631+
632+Quicksort: accepts a [`++list`]() `a` and a [gate]() `b` which accepts two nouns and
633+produces a loobean. `++sort` then produces a list of the elements of `a`,
634+sorted according to `b`.
635+
636+Accepts
637+-------
638+
639+`b` is a gate that ccepts two nouns and produces a boolean.
640+
641+Produces
642+--------
643+
644+A list
645+
646+Source
647+------
648+
649+ ++ sort :: quicksort
650+ ~/ %sort
651+ |* [a=(list) b=$+([* *] ?)]
652+ => .(a ^.(homo a))
653+ |- ^+ a
654+ ?~ a ~
655+ %+ weld
656+ $(a (skim t.a |=(c=_i.a (b c i.a))))
657+ ^+ t.a
658+ [i.a $(a (skim t.a |=(c=_i.a !(b c i.a))))]
659+
660+Examples
661+--------
662+
663+ ~zod/try=> =a =|([p=@ q=@] |.((gth p q)))
664+ ~zod/try=> (sort (limo [0 1 2 3 ~]) a)
665+ ~[3 2 1 0]
666+
667+
668+
669+***
670+### `++swag`
671+
672+Infix
673+
674+Similar to `substr` in Javascript: extracts a string infix, beginning at
675+inclusive index `a`, producing `b` number of characters.
676+
677+Accepts
678+-------
679+
680+`c` is a [list]().
681+
682+Produces
683+--------
684+
685+A list of the same type as `c`.
686+
687+Source
688+------
689+
690+ ++ swag :: infix
691+ |* [[a=@ b=@] c=(list)]
692+ (scag b (slag a c))
693+
694+Examples
695+--------
696+
697+ ~zod/try=> (swag [2 5] "roly poly")
698+ "ly po"
699+ ~zod/try=> (swag [2 2] (limo [1 2 3 4 ~]))
700+ [i=3 t=[i=4 t=~]]
701+
702+
703+
704+***
705+### `++turn`
706+
707+Gate to list
708+
709+Accepts a [`++list`]() `a` and a [gate]() `b`. Produces a list with the gate applied
710+to each element of the original list.
711+
712+Accepts
713+-------
714+
715+`b` is a gate.
716+
717+Produces
718+--------
719+
720+A list.
721+
722+Source
723+------
724+
725+ ++ turn :: transform
726+ ~/ %turn
727+ |* [a=(list) b=_,*]
728+ |-
729+ ?~ a ~
730+ [i=(b i.a) t=$(a t.a)]
731+
732+Examples
733+--------
734+
735+ ~zod/try=> (turn (limo [104 111 111 110 ~]) ,@t)
736+ <|h o o n|>
737+ ~zod/try=> =a |=(a=@ (add a 4))
738+ ~zod/try=> (turn (limo [1 2 3 4 ~]) a)
739+ ~[5 6 7 8]
740+
741+
742+
743+***
744+### `++weld`
745+
746+Concatenate
747+
748+Concatenate two [`++list`]()s `a` and `b`.
749+
750+Accepts
751+-------
752+
753+`a` and `b` are [list]()s.
754+
755+Source
756+------
757+
758+ ++ weld :: concatenate
759+ ~/ %weld
760+ |* [a=(list) b=(list)]
761+ => .(a ^.(homo a), b ^.(homo b))
762+ |- ^+ b
763+ ?~ a b
764+ [i.a $(a t.a)]
765+
766+Examples
767+--------
768+
769+ ~zod/try=> (weld "urb" "it")
770+ ~[~~u ~~r ~~b ~~i ~~t]
771+ ~zod/try=> (weld (limo [1 2 ~]) (limo [3 4 ~]))
772+ ~[1 2 3 4]
773+
774+
775+
776+***
777+### `++welp`
778+
779+Perfect weld
780+
781+Concatenate two [`++list`]()s `a` and `b` without losing their type information
782+to homogenization.
783+
784+Accepts
785+-------
786+
787+`a` is a list.
788+
789+`b` is a list.
790+
791+Produces
792+--------
793+
794+A list.
795+
796+Source
797+------
798+
799+ ++ welp :: perfect weld
800+ =| [* *]
801+ |%
802+ +- $
803+ ?~ +<-
804+ +<-(. +<+)
805+ +<-(+ $(+<- +<->))
806+ --
807+
808+Examples
809+--------
810+
811+ ~zod/try=> (welp "foo" "bar")
812+ "foobar"
813+ ~zod/arvo=/hoon/hoon> (welp ~[60 61 62] ~[%a %b %c])
814+ [60 61 62 %a %b %c ~]
815+ ~zod/arvo=/hoon/hoon> :type; (welp ~[60 61 62] ~[%a %b %c])
816+ [60 61 62 %a %b %c ~]
817+ [@ud @ud @ud %a %b %c %~]
818+ ~zod/arvo=/hoon/hoon> (welp [sa/1 so/2 ~] si/3)
819+ [[%sa 1] [%so 2] %si 3]
820+
821+
822+
823+***
824+### `++zing`
825+
826+Cons
827+
828+Turns a [`++list`]() of lists into a single list by promoting the elements of
829+each sublist into the higher.
830+
831+Accepts
832+-------
833+
834+A list of lists.
835+
836+Produces
837+--------
838+
839+A list.
840+
841+Source
842+------
843+
844+ ++ zing :: promote
845+ =| *
846+ |%
847+ +- $
848+ ?~ +<
849+ +<
850+ (welp +<- $(+< +<+))
851+ --
852+
853+Examples
854+--------
855+
856+ ~zod/try=> (zing (limo [(limo ['a' 'b' 'c' ~]) (limo ['e' 'f' 'g' ~]) (limo ['h' 'i' 'j' ~]) ~]))
857+ ~['a' 'b' 'c' 'e' 'f' 'g' 'h' 'i' 'j']
858+ ~zod/try=> (zing (limo [(limo [1 'a' 2 'b' ~]) (limo [3 'c' 4 'd' ~]) ~]))
859+ ~[1 97 2 98 3 99 4 100]
860+
861+
862+***
docs/system/hoon/library/2c.mdnew file+667
@@ -0,0 +1,667 @@
1+## 2c: bit arithmetic
2+### `++bex`
3+
4+Binary exponent
5+
6+Computes the result of `2^a`, producing an [atom]().
7+
8+Accepts
9+-------
10+
11+`a` is an atom.
12+
13+Produces
14+--------
15+
16+An atom.
17+
18+Source
19+------
20+
21+ ++ bex :: binary exponent
22+ ~/ %bex
23+ |= a=@
24+ ^- @
25+ ?: =(0 a) 1
26+ (mul 2 $(a (dec a)))
27+
28+Examples
29+--------
30+
31+ ~zod/try=> (bex 4)
32+ 16
33+ ~zod/try=> (bex (add 19 1))
34+ 1.048.576
35+ ~zod/try=> (bex 0)
36+ 1
37+
38+
39+
40+***
41+
42+### `++can`
43+
44+Assemble
45+
46+Produces an [atom]() from a list `b` of length-value pairs `p` and `q`,
47+where `p` is the length in bloqs of size `a`, and `q` is an atomic
48+value.
49+
50+Accepts
51+-------
52+
53+`a` is a block size (see [`++bloq`]()).
54+
55+`b` is a [`++list`]() of length value pairs, `p` and `q`.
56+
57+Produces
58+--------
59+
60+An atom.
61+
62+Source
63+------
64+
65+ ++ can :: assemble
66+ ~/ %can
67+ |= [a=bloq b=(list ,[p=@ q=@])]
68+ ^- @
69+ ?~ b 0
70+ (mix (end a p.i.b q.i.b) (lsh a p.i.b $(b t.b)))
71+
72+Examples
73+--------
74+
75+ ~zod/try=> `@ub`(can 3 ~[[1 1]])
76+ 0b1
77+ ~zod/try=> `@ub`(can 0 ~[[1 255]])
78+ 0b1
79+ ~zod/try=> `@ux`(can 3 [3 0xc1] [1 0xa] ~)
80+ 0xa00.00c1
81+ ~zod/try=> `@ux`(can 3 [3 0xc1] [1 0xa] [1 0x23] ~)
82+ 0x23.0a00.00c1
83+ ~zod/try=> `@ux`(can 4 [3 0xc1] [1 0xa] [1 0x23] ~)
84+ 0x23.000a.0000.0000.00c1
85+ ~zod/try=> `@ux`(can 3 ~[[1 'a'] [2 'bc']])
86+ 0x63.6261
87+
88+
89+***
90+### `++cat`
91+
92+Concatenate
93+
94+Concatenates two [atom]()s, `b` and `c`, according to bloq size `a`, producing an
95+atom.
96+
97+Accepts
98+-------
99+
100+`a` is a block size (see [`++bloq`]()).
101+
102+`b` is an atom.
103+
104+`c` is an atom.
105+
106+Produces
107+--------
108+
109+An atom.
110+
111+Source
112+------
113+
114+ ++ cat :: concatenate
115+ ~/ %cat
116+ |= [a=bloq b=@ c=@]
117+ (add (lsh a (met a b) c) b)
118+
119+Examples
120+--------
121+
122+ ~zod/try=> `@ub`(cat 3 1 0)
123+ 0b1
124+ ~zod/try=> `@ub`(cat 0 1 1)
125+ 0b11
126+ ~zod/try=> `@ub`(cat 0 2 1)
127+ 0b110
128+ ~zod/try=> `@ub`(cat 2 1 1)
129+ 0b1.0001
130+ ~zod/try=> `@ub`256
131+ 0b1.0000.0000
132+ ~zod/try=> `@ub`255
133+ 0b1111.1111
134+ ~zod/try=> `@ub`(cat 3 256 255)
135+ 0b1111.1111.0000.0001.0000.0000
136+ ~zod/try=> `@ub`(cat 2 256 255)
137+ 0b1111.1111.0001.0000.0000
138+ ~zod/try=> (cat 3 256 255)
139+ 16.711.936
140+
141+
142+
143+***
144+### `++cut`
145+
146+Slice
147+
148+Slices `c` blocks of size `a` that are `b` blocks from the end of `d`.
149+
150+Accepts
151+-------
152+
153+`a` is a block size (see [++bloq]()).
154+
155+`b` is an [atom]().
156+
157+`c` is an atom.
158+
159+Produces
160+--------
161+
162+An atom.
163+
164+Source
165+------
166+
167+ ++ cut :: slice
168+ ~/ %cut
169+ |= [a=bloq [b=@ c=@] d=@]
170+ (end a c (rsh a b d))
171+
172+Examples
173+--------
174+
175+ ~zod/try=> (cut 0 [1 1] 2)
176+ 1
177+ ~zod/try=> (cut 0 [2 1] 4)
178+ 1
179+ ~zod/try=> `@t`(cut 3 [0 3] 'abcdefgh')
180+ 'abc'
181+ ~zod/try=> `@t`(cut 3 [1 3] 'abcdefgh')
182+ 'bcd'
183+ ~zod/try=> `@ub`(cut 0 [0 3] 0b1111.0000.1101)
184+ 0b101
185+ ~zod/try=> `@ub`(cut 0 [0 6] 0b1111.0000.1101)
186+ 0b1101
187+ ~zod/try=> `@ub`(cut 0 [4 6] 0b1111.0000.1101)
188+ 0b11.0000
189+ ~zod/try=> `@ub`(cut 0 [3 6] 0b1111.0000.1101)
190+ 0b10.0001
191+
192+
193+
194+***
195+### `++end`
196+
197+Tail
198+
199+Produces an [atom]() by taking the last `b` blocks of size `a` from `c`.
200+
201+Accepts
202+-------
203+
204+`a` is a block size (see [`++bloq`]()).
205+
206+`b` is an atom.
207+
208+`c` is an [atom]().
209+
210+Produces
211+--------
212+
213+An atom.
214+
215+
216+Source
217+------
218+
219+ ++ end :: tail
220+ ~/ %end
221+ |= [a=bloq b=@ c=@]
222+ (mod c (bex (mul (bex a) b)))
223+
224+Examples
225+--------
226+
227+ ~zod/try=> `@ub`12
228+ 0b1100
229+ ~zod/try=> `@ub`(end 0 3 12)
230+ 0b100
231+ ~zod/try=> (end 0 3 12)
232+ 4
233+ ~zod/try=> `@ub`(end 1 3 12)
234+ 0b1100
235+ ~zod/try=> (end 1 3 12)
236+ 12
237+ ~zod/try=> `@ux`'abc'
238+ 0x63.6261
239+ ~zod/try=> `@ux`(end 3 2 'abc')
240+ 0x6261
241+ ~zod/try=> `@t`(end 3 2 'abc')
242+ 'ab'
243+
244+
245+
246+***
247+### `++fil`
248+
249+Fill bloqstream
250+
251+Produces an [atom]() by repeating `c` for `b` blocks of size `a`.
252+
253+Accepts
254+-------
255+
256+`a` is a block size (see [`++bloq`]()).
257+
258+`b` is an atom.
259+
260+`c` is an [atom]().
261+
262+Produces
263+--------
264+
265+An atom.
266+
267+Source
268+------
269+
270+ ++ fil :: fill bloqstream
271+ |= [a=bloq b=@ c=@]
272+ =+ n=0
273+ =+ d=c
274+ |- ^- @
275+ ?: =(n b)
276+ (rsh a 1 d)
277+ $(d (add c (lsh a 1 d)), n +(n))
278+
279+Examples
280+--------
281+
282+ ~zod/try=> `@t`(fil 3 5 %a)
283+ 'aaaaa'
284+ ~zod/try=> `@t`(fil 5 10 %ceeb)
285+ 'ceebceebceebceebceebceebceebceebceebceeb'
286+ ~zod/try=> `@t`(fil 4 10 %eced)
287+ 'ʇʇʇʇʇʇʇʇʇʇed'
288+ ~zod/try=> `@tas`(fil 4 10 %bf)
289+ %bfbfbfbfbfbfbfbfbfbf
290+
291+
292+
293+***
294+### `++lsh`
295+
296+Left-shift
297+
298+Produces an [atom]() by left-shifting `c` by `b` blocks of size `a`.
299+
300+Accepts
301+-------
302+
303+`a` is a block size (see [`++bloq`]()).
304+
305+`b` is an atom.
306+
307+`c` is an atom.
308+
309+Produces
310+--------
311+
312+An atom.
313+
314+Source
315+------
316+
317+ ++ lsh :: left-shift
318+ ~/ %lsh
319+ |= [a=bloq b=@ c=@]
320+ (mul (bex (mul (bex a) b)) c)
321+
322+Examples
323+--------
324+
325+ ~zod/try=> `@ub`1
326+ 0b1
327+ ~zod/try=> `@ub`(lsh 0 1 1)
328+ 0b10
329+ ~zod/try=> (lsh 0 1 1)
330+ 2
331+ ~zod/try=> `@ub`255
332+ 0b1111.1111
333+ ~zod/try=> `@ub`(lsh 3 1 255)
334+ 0b1111.1111.0000.0000
335+ ~zod/try=> (lsh 3 1 255)
336+ 65.280
337+
338+
339+
340+***
341+### `++met`
342+
343+Measure
344+
345+Computes the number of blocks of size `a` in `b`, producing an [atom]().
346+
347+`a` is a block size (see [`++bloq`]()).
348+
349+`b` is an atom.
350+
351+Source
352+------
353+
354+ ++ met :: measure
355+ ~/ %met
356+ |= [a=bloq b=@]
357+ ^- @
358+ =+ c=0
359+ |-
360+ ?: =(0 b) c
361+ $(b (rsh a 1 b), c +(c))
362+
363+Examples
364+--------
365+
366+ ~zod/try=> (met 0 1)
367+ 1
368+ ~zod/try=> (met 0 2)
369+ 2
370+ ~zod/try=> (met 3 255)
371+ 1
372+ ~zod/try=> (met 3 256)
373+ 2
374+ ~zod/try=> (met 3 'abcde')
375+ 5
376+
377+
378+
379+***
380+### `++rap`
381+
382+Assemble non-zero
383+
384+Concatenates a list of [atom]()s `b` using blocksize `a`, producing an atom.
385+
386+Accepts
387+-------
388+
389+`a` is a block size (see [`++bloq`]()).
390+
391+`b` is a [`++list`]() of [atom]()s.
392+
393+Produces
394+--------
395+
396+An atom.
397+
398+Source
399+------
400+
401+ ++ rap :: assemble nonzero
402+ ~/ %rap
403+ |= [a=bloq b=(list ,@)]
404+ ^- @
405+ ?~ b 0
406+ (cat a i.b $(b t.b))
407+
408+Examples
409+--------
410+
411+ ~zod/try=> `@ub`(rap 2 (limo [1 2 3 4 ~]))
412+ 0b100.0011.0010.0001
413+ ~zod/try=> `@ub`(rap 1 (limo [1 2 3 4 ~]))
414+ 0b1.0011.1001
415+ ~zod/try=> (rap 0 (limo [0 0 0 ~]))
416+ 0
417+ ~zod/try=> (rap 0 (limo [1 0 1 ~]))
418+ 3
419+
420+
421+
422+***
423+### `++rep`
424+
425+Assemble single
426+
427+Produces an [atom]() by assembling a list of atoms `b` using block size `a`.
428+
429+Accepts
430+-------
431+
432+`a` is a block size (see [`++bloq`]()).
433+
434+`b` is a list of atoms.
435+
436+Produces
437+--------
438+
439+An atom.
440+
441+Source
442+------
443+
444+ ++ rep :: assemble single
445+ ~/ %rep
446+ |= [a=bloq b=(list ,@)]
447+ ^- @
448+ =+ c=0
449+ |-
450+ ?~ b 0
451+ (con (lsh a c (end a 1 i.b)) $(c +(c), b t.b))
452+
453+Examples
454+--------
455+
456+ ~zod/try=> `@ub`(rep 2 (limo [1 2 3 4 ~]))
457+ 0b100.0011.0010.0001
458+ ~zod/try=> (rep 0 (limo [0 0 1 ~]))
459+ 4
460+ ~zod/try=> (rep 0 (limo [0 0 0 1 ~]))
461+ 8
462+ ~zod/try=> (rep 0 (limo [0 1 0 0 ~]))
463+ 2
464+ ~zod/try=> (rep 0 (limo [0 1 0 1 ~]))
465+ 10
466+ ~zod/try=> (rep 0 (limo [0 1 0 1 0 1 ~]))
467+ 42
468+ ~zod/try=> `@ub`42
469+ 0b10.1010
470+
471+
472+
473+***
474+### `++rip`
475+
476+Disassemble
477+
478+Produces a list of [atom]()s from the bits of `b` using block size `a`.
479+
480+Accepts
481+-------
482+
483+`a` is a block size (see [`++bloq`]()).
484+
485+`b` is an atom.
486+
487+Produces
488+--------
489+
490+A list of atoms.
491+
492+Source
493+------
494+
495+ ++ rip :: disassemble
496+ ~/ %rip
497+ |= [a=bloq b=@]
498+ ^- (list ,@)
499+ ?: =(0 b) ~
500+ [(end a 1 b) $(b (rsh a 1 b))]
501+
502+Examples
503+--------
504+
505+ ~zod/try=> `@ub`155
506+ 0b1001.1011
507+ ~zod/try=> (rip 0 155)
508+ ~[1 1 0 1 1 0 0 1]
509+ ~zod/try=> (rip 2 155)
510+ ~[11 9]
511+ ~zod/try=> (rip 1 155)
512+ ~[3 2 1 2]
513+ ~zod/try=> `@ub`256
514+ 0b1.0000.0000
515+ ~zod/try=> (rip 0 256)
516+ ~[0 0 0 0 0 0 0 0 1]
517+ ~zod/try=> (rip 2 256)
518+ ~[0 0 1]
519+ ~zod/try=> (rip 3 256)
520+ ~[0 1]
521+
522+
523+
524+***
525+### `++rsh`
526+
527+Right-shift
528+
529+Right-shifts `c` by `b` blocks of size `a`, producing an [atom]().
530+
531+Accepts
532+-------
533+
534+`a` is a block size (see [`++bloq`]()).
535+
536+`b` is an atom.
537+
538+`c` is an atom.
539+
540+Produces
541+--------
542+
543+An atom.
544+
545+Source
546+------
547+
548+ ++ rsh :: right-shift
549+ ~/ %rsh
550+ |= [a=bloq b=@ c=@]
551+ (div c (bex (mul (bex a) b)))
552+
553+Examples
554+--------
555+
556+ ~zod/try=> `@ub`145
557+ 0b1001.0001
558+ ~zod/try=> `@ub`(rsh 1 1 145)
559+ 0b10.0100
560+ ~zod/try=> (rsh 1 1 145)
561+ 36
562+ ~zod/try=> `@ub`(rsh 2 1 145)
563+ 0b1001
564+ ~zod/try=> (rsh 2 1 145)
565+ 9
566+ ~zod/try=> `@ub`10
567+ 0b1010
568+ ~zod/try=> `@ub`(rsh 0 1 10)
569+ 0b101
570+ ~zod/try=> (rsh 0 1 10)
571+ 5
572+ ~zod/try=> `@ux`'abc'
573+ 0x63.6261
574+ ~zod/try=> `@t`(rsh 3 1 'abc')
575+ 'bc'
576+ ~zod/try=> `@ux`(rsh 3 1 'abc')
577+ 0x6362
578+
579+
580+
581+***
582+### `++swp`
583+
584+Reverse block order
585+
586+Switches little endian to big and vice versa: produces an [atom]() by
587+reversing the block order of `b` using block size `a`.
588+
589+
590+Accepts
591+-------
592+
593+`a` is a block size (see [`++bloq`]()).
594+
595+`b` is an atom.
596+
597+Produces
598+--------
599+
600+An atom
601+
602+Source
603+------
604+
605+ ++ swap |=([a=bloq b=@] (rep a (flop (rip a b)))) :: reverse bloq order
606+
607+Examples
608+--------
609+
610+ ~zod/try=> `@ub`24
611+ 0b1.1000
612+ ~zod/try=> (swap 0 24)
613+ 3
614+ ~zod/try=> `@ub`3
615+ 0b11
616+ ~zod/try=> (swap 0 0)
617+ 0
618+ ~zod/try=> (swap 0 128)
619+ 1
620+
621+
622+
623+***
624+### `++xeb`
625+
626+Binary logarithm
627+
628+Computes the base-2 logarithm of `a`, producing an [atom]().
629+
630+Accepts
631+-------
632+
633+`a` is an atom.
634+
635+Produces
636+--------
637+
638+An atom.
639+
640+Source
641+------
642+
643+ ++ xeb :: binary logarithm
644+ :: ~/ %xeb
645+ |= a=@
646+ ^- @
647+ (met 0 a)
648+
649+Examples
650+--------
651+
652+ ~zod/try=> (xeb 31)
653+ 5
654+ ~zod/try=> (xeb 32)
655+ 6
656+ ~zod/try=> (xeb 49)
657+ 6
658+ ~zod/try=> (xeb 0)
659+ 0
660+ ~zod/try=> (xeb 1)
661+ 1
662+ ~zod/try=> (xeb 2)
663+ 2
664+
665+
666+
667+***
docs/system/hoon/library/2d.mdnew file+221
@@ -0,0 +1,221 @@
1+## 2d: bit logic
2+### `++con`
3+
4+Binary OR
5+
6+Computes the bit-wise logical OR of two [atom]()s, `a` and `b`, producing an
7+atom.
8+
9+Accepts
10+-------
11+
12+`a` is an atom
13+
14+`b` is an atom
15+
16+Produces
17+--------
18+
19+An atom.
20+
21+Source
22+------
23+
24+ ++ con :: binary or
25+ ~/ %con
26+ |= [a=@ b=@]
27+ =+ [c=0 d=0]
28+ |- ^- @
29+ ?: ?&(=(0 a) =(0 b)) d
30+ %= $
31+ a (rsh 0 1 a)
32+ b (rsh 0 1 b)
33+ c +(c)
34+ d %+ add d
35+ %^ lsh 0 c
36+ ?& =(0 (end 0 1 a))
37+ =(0 (end 0 1 b))
38+ ==
39+ ==
40+
41+Examples
42+--------
43+
44+ ~zod/try=> (con 0b0 0b1)
45+ 1
46+ ~zod/try=> (con 0 1)
47+ 1
48+ ~zod/try=> (con 0 0)
49+ 0
50+ ~zod/try=> `@ub`(con 0b1111.0000 0b1.0011)
51+ 0b1111.0011
52+ ~zod/try=> (con 4 4)
53+ 4
54+ ~zod/try=> (con 10.000 234)
55+ 10.234
56+
57+
58+
59+***
60+### `++dis`
61+
62+Binary AND
63+
64+Computes the bit-wise logical AND of two [atom]()s `a` and `b`, producing an
65+atom.
66+
67+Accepts
68+-------
69+
70+`a` is an atom.
71+
72+`b` is an atom.
73+
74+Produces
75+--------
76+
77+An atom.
78+
79+Source
80+------
81+
82+ ++ dis :: binary and
83+ ~/ %dis
84+ |= [a=@ b=@]
85+ =| [c=@ d=@]
86+ |- ^- @
87+ ?: ?|(=(0 a) =(0 b)) d
88+ %= $
89+ a (rsh 0 1 a)
90+ b (rsh 0 1 b)
91+ c +(c)
92+ d %+ add d
93+ %^ lsh 0 c
94+ ?| =(0 (end 0 1 a))
95+ =(0 (end 0 1 b))
96+ ==
97+ ==
98+
99+Examples
100+--------
101+
102+ ~zod/try=> `@ub`9
103+ 0b1001
104+ ~zod/try=> `@ub`5
105+ 0b101
106+ ~zod/try=> `@ub`(dis 9 5)
107+ 0b1
108+ ~zod/try=> (dis 9 5)
109+ 1
110+ ~zod/try=> `@ub`534
111+ 0b10.0001.0110
112+ ~zod/try=> `@ub`987
113+ 0b11.1101.1011
114+ ~zod/try=> `@ub`(dis 534 987)
115+ 0b10.0001.0010
116+ ~zod/try=> (dis 534 987)
117+ 530
118+
119+
120+
121+***
122+### `++mix`
123+
124+Binary XOR
125+
126+Produces the bit-wise logical XOR of `a` and `b`, producing an [atom]().
127+
128+Accepts
129+-------
130+
131+`a` is an atom
132+
133+`b` is an atom
134+
135+Produces
136+--------
137+
138+An atom.
139+
140+Source
141+------
142+
143+ ++ mix :: binary xor
144+ ~/ %mix
145+ |= [a=@ b=@]
146+ ^- @
147+ =+ [c=0 d=0]
148+ |-
149+ ?: ?&(=(0 a) =(0 b)) d
150+ %= $
151+ a (rsh 0 1 a)
152+ b (rsh 0 1 b)
153+ c +(c)
154+ d (add d (lsh 0 c =((end 0 1 a) (end 0 1 b))))
155+ ==
156+
157+Examples
158+--------
159+
160+ ~zod/try=> `@ub`2
161+ 0b10
162+ ~zod/try=> `@ub`3
163+ 0b11
164+ ~zod/try=> `@ub`(mix 2 3)
165+ 0b1
166+ ~zod/try=> (mix 2 3)
167+ 1
168+ ~zod/try=> `@ub`(mix 2 2)
169+ 0b0
170+ ~zod/try=> (mix 2 2)
171+ 0
172+
173+
174+
175+***
176+### `++not`
177+
178+Binary NOT
179+
180+Computes the bit-wise logical NOT of the bottom `b` blocks of size `a`
181+of `c`.
182+
183+Accepts
184+-------
185+
186+`a` is a block size (see [`++bloq`]()).
187+
188+`b` is an [atom]().
189+
190+`c` is an atom.
191+
192+Produces
193+--------
194+
195+An atom.
196+
197+Source
198+------
199+
200+ ++ not |= [a=bloq b=@ c=@] :: binary not (sized)
201+ (mix c (dec (bex (mul b (bex a)))))
202+
203+Examples
204+--------
205+
206+ ~zod/try=> `@ub`24
207+ 0b1.1000
208+ ~zod/try=> (not 0 5 24)
209+ 7
210+ ~zod/try=> `@ub`7
211+ 0b111
212+ ~zod/try=> (not 2 5 24)
213+ 1.048.551
214+ ~zod/try=> (not 2 5 1.048.551)
215+ 24
216+ ~zod/try=> (not 1 1 (not 1 1 10))
217+ 10
218+
219+
220+
221+***
docs/system/hoon/library/2e.mdnew file+163
@@ -0,0 +1,163 @@
1+## 2e: insecure hashing
2+### `++fnv`
3+
4+Hashes an atom with the 32-bit FNV non-cryptographic hash algorithm.
5+Multiplies `a` by the prime number 16,777,619 and then takes the block
6+of size 5 off the product's end, producing an [atom]().
7+
8+Accepts
9+-------
10+
11+`a` is an atom.
12+
13+Produces
14+--------
15+
16+An atom.
17+
18+
19+Source
20+------
21+
22+ ++ fnv |=(a=@ (end 5 1 (mul 16.777.619 a))) :: FNV scrambler
23+
24+Examples
25+--------
26+
27+ ~zod/try=> (fnv 10.000)
28+ 272.465.456
29+ ~zod/try=> (fnv 10.001)
30+ 289.243.075
31+ ~zod/try=> (fnv 1)
32+ 16.777.619
33+
34+
35+
36+***
37+### `++mug`
38+
39+Hashes `a` with the 31-bit nonzero FNV-1a non-cryptographic hash
40+algorithm, producing an [atom]().
41+
42+Accepts
43+-------
44+
45+A is a [noun]().
46+
47+Produces
48+--------
49+
50+An atom.
51+
52+Source
53+------
54+
55+ ++ mug :: 31bit nonzero FNV1a
56+ ~/ %mug
57+ |= a=*
58+ ?^ a
59+ =+ b=[p=$(a -.a) q=$(a +.a)]
60+ |- ^- @
61+ =+ c=(fnv (mix p.b (fnv q.b)))
62+ =+ d=(mix (rsh 0 31 c) (end 0 31 c))
63+ ?. =(0 c) c
64+ $(q.b +(q.b))
65+ =+ b=2.166.136.261
66+ |- ^- @
67+ =+ c=b
68+ =+ [d=0 e=(met 3 a)]
69+ |- ^- @
70+ ?: =(d e)
71+ =+ f=(mix (rsh 0 31 c) (end 0 31 c))
72+ ?. =(0 f) f
73+ ^$(b +(b))
74+ $(c (fnv (mix c (cut 3 [d 1] a))), d +(d))
75+
76+Examples
77+--------
78+
79+ ~zod/try=> (mug 10.000)
80+ 178.152.889
81+ ~zod/try=> (mug 10.001)
82+ 714.838.017
83+ ~zod/try=> (mug 1)
84+ 67.918.732
85+ ~zod/try=> (mug (some 10))
86+ 1.872.403.737
87+ ~zod/try=> (mug (limo [1 2 3 4 5 ~]))
88+ 1.067.931.605
89+
90+
91+
92+***
93+### `++mum`
94+
95+XX document
96+
97+Accepts
98+-------
99+
100+Produces
101+--------
102+
103+Source
104+------
105+
106+ ++ mum :: mug with murmur3
107+ ~/ %mum
108+ |= a=*
109+ |^ (trim ?@(a a (mix $(a -.a) (mix 0x7fff.ffff $(a +.a)))))
110+ ++ spec :: standard murmur3
111+ |= [syd=@ key=@]
112+ ?> (lte (met 5 syd) 1)
113+ =+ ^= row
114+ |= [a=@ b=@]
115+ (con (end 5 1 (lsh 0 a b)) (rsh 0 (sub 32 a) b))
116+ =+ mow=|=([a=@ b=@] (end 5 1 (mul a b)))
117+ =+ len=(met 5 key)
118+ =- =. goc (mix goc len)
119+ =. goc (mix goc (rsh 4 1 goc))
120+ =. goc (mow goc 0x85eb.ca6b)
121+ =. goc (mix goc (rsh 0 13 goc))
122+ =. goc (mow goc 0xc2b2.ae35)
123+ (mix goc (rsh 4 1 goc))
124+ ^= goc
125+ =+ [inx=0 goc=syd]
126+ |- ^- @
127+ ?: =(inx len) goc
128+ =+ kop=(cut 5 [inx 1] key)
129+ =. kop (mow kop 0xcc9e.2d51)
130+ =. kop (row 15 kop)
131+ =. kop (mow kop 0x1b87.3593)
132+ =. goc (mix kop goc)
133+ =. goc (row 13 goc)
134+ =. goc (end 5 1 (add 0xe654.6b64 (mul 5 goc)))
135+ $(inx +(inx))
136+ ::
137+ ++ trim :: 31-bit nonzero
138+ |= key=@
139+ =+ syd=0xcafe.babe
140+ |- ^- @
141+ =+ haz=(spec syd key)
142+ =+ ham=(mix (rsh 0 31 haz) (end 0 31 haz))
143+ ?.(=(0 ham) ham $(syd +(syd)))
144+ --
145+ ::
146+
147+Examples
148+--------
149+
150+ ~zod/try=> (mum 10.000)
151+ 1.232.632.901
152+ ~zod/try=> (mum 10.001)
153+ 658.093.079
154+ ~zod/try=> (mum 1)
155+ 818.387.364
156+ ~zod/try=> (mum (some 10))
157+ 1.177.215.703
158+ ~zod/try=> (mum ~[1 2 3 4 5])
159+ 1.517.902.092
160+
161+
162+
163+***
docs/system/hoon/library/2f.mdnew file+268
@@ -0,0 +1,268 @@
1+## 2f: noun ordering
2+### `++aor`
3+
4+Alphabetic order
5+
6+Computes whether `a` and `b` are in alphabetical order, producing a
7+boolean.
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+ ++ aor :: alphabetic-order
26+ ~/ %aor
27+ |= [a=* b=*]
28+ ^- ?
29+ ?: =(a b) &
30+ ?. ?=(@ a)
31+ ?: ?=(@ b) |
32+ ?: =(-.a -.b)
33+ $(a +.a, b +.b)
34+ $(a -.a, b -.b)
35+ ?. ?=(@ b) &
36+ |-
37+ =+ [c=(end 3 1 a) d=(end 3 1 b)]
38+ ?: =(c d)
39+ $(a (rsh 3 1 a), b (rsh 3 1 b))
40+ (lth c d)
41+
42+Examples
43+--------
44+
45+ ~zod/try=> (aor 'a' 'b')
46+ %.y
47+ ~zod/try=> (aor 'b' 'a')
48+ %.n
49+ ~zod/try=> (aor "foo" "bar")
50+ %.n
51+ ~zod/try=> (aor "bar" "foo")
52+ %.y
53+ ~zod/try=> (aor "abcdefz" "abcdefa")
54+ %.n
55+ ~zod/try=> (aor "abcdefa" "abcdefz")
56+ %.y
57+ ~zod/try=> (aor 10.000 17.000)
58+ %.y
59+ ~zod/try=> (aor 10 9)
60+ %.n
61+
62+
63+
64+***
65+### `++dor`
66+
67+Numeric order
68+
69+Computes whether `a` and `b` are in ascending numeric order, producing a
70+boolean.
71+
72+Accepts
73+-------
74+
75+`a` is a [noun]().
76+
77+`b` is a noun.
78+
79+Produces
80+--------
81+
82+A boolean atom.
83+
84+Source
85+------
86+
87+ ++ dor :: d-order
88+ ~/ %dor
89+ |= [a=* b=*]
90+ ^- ?
91+ ?: =(a b) &
92+ ?. ?=(@ a)
93+ ?: ?=(@ b) |
94+ ?: =(-.a -.b)
95+ $(a +.a, b +.b)
96+ $(a -.a, b -.b)
97+ ?. ?=(@ b) &
98+ (lth a b)
99+
100+Examples
101+--------
102+
103+ ~zod/try=> (dor 1 2)
104+ %.y
105+ ~zod/try=> (dor 2 1)
106+ %.n
107+ ~zod/try=> (dor ~[1 2 3] ~[1 2 4])
108+ %.y
109+ ~zod/try=> (dor ~[1 2 4] ~[1 2 3])
110+ %.n
111+ ~zod/try=> (dor (limo ~[99 100 10.000]) ~[99 101 10.000])
112+ %.y
113+ ~zod/try=> (dor ~[99 101 10.999] (limo ~[99 100 10.000]))
114+ %.n
115+
116+
117+
118+***
119+### `++gor`
120+
121+Hash order
122+
123+XX revisit
124+
125+Accepts
126+-------
127+
128+`a` is a [noun]().
129+
130+`b` is a noun.
131+
132+Produces
133+--------
134+
135+A boolean [atom]().
136+
137+Source
138+------
139+
140+ ++ gor :: g-order
141+ ~/ %gor
142+ |= [a=* b=*]
143+ ^- ?
144+ =+ [c=(mug a) d=(mug b)]
145+ ?: =(c d)
146+ (dor a b)
147+ (lth c d)
148+
149+Examples
150+--------
151+
152+ ~zod/try=> (gor 'd' 'c')
153+ %.y
154+ ~zod/try=> 'd'
155+ 'd'
156+ ~zod/try=> 'c'
157+ ~zod/try=> `@ud`'d'
158+ 100
159+ ~zod/try=> `@ud`'c'
160+ 99
161+ ~zod/try=> (mug 'd')
162+ 1.628.185.714
163+ ~zod/try=> (mug 'c')
164+ 1.712.073.811
165+ ~zod/try=> (gor 'd' 'c')
166+ %.y
167+ ~zod/try=> (gor 'c' 'd')
168+ %.n
169+ ~zod/try=> (gor "foo" "bar")
170+ %.n
171+ ~zod/try=> (gor (some 10) (limo [1 2 3 ~]))
172+ %.n
173+
174+
175+
176+***
177+### `++hor`
178+
179+Hash order
180+
181+XX revisit
182+
183+Recursive hash comparator gate.
184+
185+Accepts
186+-------
187+
188+`a` is a [noun]().
189+
190+`b` is a noun.
191+
192+Produces
193+--------
194+
195+A boolean [atom]().
196+
197+
198+Source
199+------
200+
201+ ++ hor :: h-order
202+ ~/ %hor
203+ |= [a=* b=*]
204+ ^- ?
205+ ?: ?=(@ a)
206+ ?. ?=(@ b) &
207+ (gor a b)
208+ ?: ?=(@ b) |
209+ ?: =(-.a -.b)
210+ (gor +.a +.b)
211+ (gor -.a -.b)
212+
213+Examples
214+--------
215+
216+ ~zod/try=> (hor . 1)
217+ %.n
218+ ~zod/try=> (hor 1 2)
219+ %.y
220+ ~zod/try=> (hor "abc" "cba")
221+ %.y
222+ ~zod/try=> (hor 'c' 'd')
223+ %.n
224+
225+
226+
227+***
228+### `++vor`
229+
230+Double hash comparator gate.
231+
232+XX revisit
233+
234+Accepts
235+-------
236+
237+`a` is a [noun]()
238+
239+`b` is a noun
240+
241+Produces
242+-------
243+
244+Source
245+------
246+
247+ ++ vor :: v-order
248+ ~/ %vor
249+ |= [a=* b=*]
250+ ^- ?
251+ =+ [c=(mug (mug a)) d=(mug (mug b))]
252+ ?: =(c d)
253+ (dor a b)
254+ (lth c d)
255+
256+Examples
257+--------
258+
259+ ~zod/try=> (vor 'f' 'g')
260+ %.y
261+ ~zod/try=> (vor 'a' 'z')
262+ %.n
263+ ~zod/try=> (vor 43.326 41.106)
264+ %.n
265+
266+
267+
268+***
docs/system/hoon/library/2g.mdnew file+1
@@ -0,0 +1 @@
1+## 2g: unsigned powers
docs/system/hoon/library/2h.mdnew file+592
@@ -0,0 +1,592 @@
1+## 2h: set logic
2+
3+### `++in`
4+
5+Set operations
6+
7+Core whose [arm]()s contain a variety of functions that operate on [`++set`]()s. Its [sample]() accepts the input [`++set`]() to be manipulated.
8+
9+Accepts
10+-------
11+
12+A `++set`.
13+
14+Source
15+------
16+
17+ ++ in :: set engine
18+ ~/ %in
19+ |/ a=(set)
20+
21+Examples
22+--------
23+
24+ ~zod/try=> ~(. in (sa "asd"))
25+ <13.evb [nlr(^$1{@tD $1}) <414.fvk 101.jzo 1.ypj %164>]>
26+
27+### `+-all:in`
28+
29+Logical AND
30+
31+Computes the logical AND on every element in `a` slammed with `b`,
32+producing a boolean.
33+
34+Accepts
35+-------
36+
37+`a` is a [`++set`]().
38+
39+`b` is a [wet]() [gate]() that accepts a [noun]() and produces a boolean.
40+
41+Produces
42+--------
43+
44+A boolean.
45+
46+Source
47+------
48+
49+ +- all :: logical AND
50+ ~/ %all
51+ |* b=$+(* ?)
52+ |- ^- ?
53+ ?~ a
54+ &
55+ ?&((b n.a) $(a l.a) $(a r.a))
56+ ::
57+
58+Examples
59+--------
60+
61+ ~zod/try=> =b (sa `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
62+ ~zod/try=> (~(all in b) |=(a=* ?@(+.a & |)))
63+ %.n
64+ ~zod/try=> =b (sa `(list ,@t)`['john' 'bonita' 'daniel' 'madeleine' ~])
65+ ~zod/try=> (~(all in b) |=(a=@t (gte a 100)))
66+ %.y
67+
68+------------------------------------------------------------------------
69+
70+### `+-any:in`
71+
72+Logical OR
73+
74+Computes the logical OR on every element of `a` slammed with `b`.
75+
76+Accepts
77+-------
78+
79+`a` is a [`++set`]().
80+
81+`b` is a [gate]() that accepts a noun and produces a boolean.
82+
83+Produces
84+--------
85+
86+A boolean.
87+
88+Source
89+------
90+
91+ +- any :: logical OR
92+ ~/ %any
93+ |* b=$+(* ?)
94+ |- ^- ?
95+ ?~ a
96+ |
97+ ?|((b n.a) $(a l.a) $(a r.a))
98+ ::
99+
100+Examples
101+--------
102+
103+ ~zod/try=> =b (sa `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
104+ ~zod/try=> (~(any in b) |=(a=* ?@(+.a & |)))
105+ %.y
106+ ~zod/try=> =b (sa `(list ,@t)`['john' 'bonita' 'daniel' 'madeleine' ~])
107+ ~zod/try=> (~(any in b) |=(a=@t (lte a 100)))
108+ %.n
109+
110+------------------------------------------------------------------------
111+
112+### `+-del:in`
113+
114+Remove noun
115+
116+Removes `b` from the [`++set`]() `a`.
117+
118+Accepts
119+-------
120+
121+`a` is a set.
122+
123+`b` is a [noun]().
124+
125+Produces
126+--------
127+
128+A set.
129+
130+Source
131+------
132+
133+ +- del :: b without any a
134+ ~/ %del
135+ |* b=*
136+ |- ^+ a
137+ ?~ a
138+ ~
139+ ?. =(b n.a)
140+ ?: (hor b n.a)
141+ [n.a $(a l.a) r.a]
142+ [n.a l.a $(a r.a)]
143+ |- ^- ?(~ _a)
144+ ?~ l.a r.a
145+ ?~ r.a l.a
146+ ?: (vor n.l.a n.r.a)
147+ [n.l.a l.l.a $(l.a r.l.a)]
148+ [n.r.a $(r.a l.r.a) r.r.a]
149+ ::
150+
151+
152+Examples
153+--------
154+
155+ ~zod/try=> =b (sa `(list ,@t)`['a' 'b' 'c' ~])
156+ ~zod/try=> (~(del in b) 'a')
157+ {'c' 'b'}
158+ ~zod/try=> =b (sa `(list ,@t)`['john' 'bonita' 'daniel' 'madeleine' ~])
159+ ~zod/try=> (~(del in b) 'john')
160+ {'bonita' 'madeleine' 'daniel'}
161+ ~zod/try=> (~(del in b) 'susan')
162+ {'bonita' 'madeleine' 'daniel' 'john'}
163+
164+------------------------------------------------------------------------
165+
166+### `+-dig:in`
167+
168+Axis a in b
169+
170+Produce the axis of `b` within `a`.
171+
172+Accepts
173+-------
174+
175+`a` is a [`++set`]().
176+
177+`b` is a [noun]().
178+
179+Produces
180+--------
181+
182+The [`++unit`]() of an atom.
183+
184+Source
185+------
186+
187+ +- dig :: axis of a in b
188+ |= b=*
189+ =+ c=1
190+ |- ^- (unit ,@)
191+ ?~ a ~
192+ ?: =(b n.a) [~ u=(peg c 2)]
193+ ?: (gor b n.a)
194+ $(a l.a, c (peg c 6))
195+ $(a r.a, c (peg c 7))
196+ ::
197+
198+
199+Examples
200+--------
201+
202+ ~zod/try=> =a (sa `(list ,@)`[1 2 3 4 5 6 7 ~])
203+ ~zod/try=> a
204+ {5 4 7 6 1 3 2}
205+ ~zod/try=> -.a
206+ n=6
207+ ~zod/try=> (~(dig in a) 7)
208+ [~ 12]
209+ ~zod/try=> (~(dig in a) 2)
210+ [~ 14]
211+ ~zod/try=> (~(dig in a) 6)
212+ [~ 2]
213+
214+------------------------------------------------------------------------
215+
216+### `+-gas:in`
217+
218+Concatenate
219+
220+Insert the elements of a [`++list`]() `b` into a [`++set`]() `a`.
221+
222+Accepts
223+-------
224+
225+`a` is a set.
226+
227+`b` is a list.
228+
229+Produces
230+--------
231+
232+A `++set`.
233+
234+Source
235+------
236+
237+ +- gas :: concatenate
238+ ~/ %gas
239+ |= b=(list ,_?>(?=(^ a) n.a))
240+ |- ^+ a
241+ ?~ b
242+ a
243+ $(b t.b, a (put(+< a) i.b))
244+ ::
245+
246+
247+Examples
248+--------
249+
250+ ~zod/try=> b
251+ {'bonita' 'madeleine' 'rudolf' 'john'}
252+ ~zod/try=> (~(gas in b) `(list ,@t)`['14' 'things' 'number' '1.337' ~])
253+ {'1.337' '14' 'number' 'things' 'bonita' 'madeleine' 'rudolf' 'john'}
254+ ~zod/try=> (~(gas in s) `(list ,@t)`['1' '2' '3' ~])
255+ {'1' '3' '2' 'e' 'd' 'a' 'c' 'b'}
256+
257+------------------------------------------------------------------------
258+
259+### `+-has:in`
260+
261+b in a?
262+
263+Checks if `b` is an element of `a`, producing a boolean.
264+
265+Accepts
266+-------
267+
268+`a` is a [`++set`]().
269+
270+`b` is a [noun]().
271+
272+Produces
273+--------
274+
275+A boolean.
276+
277+Source
278+------
279+
280+ +- has :: b exists in a check
281+ ~/ %has
282+ |* b=*
283+ |- ^- ?
284+ ?~ a
285+ |
286+ ?: =(b n.a)
287+ &
288+ ?: (hor b n.a)
289+ $(a l.a)
290+ $(a r.a)
291+ ::
292+
293+
294+Examples
295+--------
296+
297+ ~zod/try=> =a (~(gas in `(set ,@t)`~) `(list ,@t)`[`a` `b` `c` ~])
298+ ~zod/try=> (~(has in a) `a`)
299+ %.y
300+ ~zod/try=> (~(has in a) 'z')
301+ %.n
302+
303+------------------------------------------------------------------------
304+
305+### `+-int:in`
306+
307+Intersection
308+
309+Produces a set of the intersection between two [`++set`]()s of the same type,
310+`a` and `b`.
311+
312+Accepts
313+-------
314+
315+`a` is a set.
316+
317+`b` is a set.
318+
319+Produces
320+--------
321+
322+A [`++set`]().
323+
324+Source
325+------
326+
327+ +- int :: intersection
328+ ~/ %int
329+ |* b=_a
330+ |- ^+ a
331+ ?~ b
332+ ~
333+ ?~ a
334+ ~
335+ ?. (vor n.a n.b)
336+ $(a b, b a)
337+ ?: =(n.b n.a)
338+ [n.a $(a l.a, b l.b) $(a r.a, b r.b)]
339+ ?: (hor n.b n.a)
340+ %- uni(+< $(a l.a, b [n.b l.b ~])) $(b r.b)
341+ %- uni(+< $(a r.a, b [n.b ~ r.b])) $(b l.b)
342+
343+
344+Examples
345+--------
346+
347+ ~zod/try=> (~(int in (sa "ac")) (sa "ha"))
348+ {~~a}
349+ ~zod/try=> (~(int in (sa "acmo")) ~)
350+ {}
351+ ~zod/try=> (~(int in (sa "acmo")) (sa "ham"))
352+ {~~a ~~m}
353+ ~zod/try=> (~(int in (sa "acmo")) (sa "lep"))
354+ {}
355+
356+------------------------------------------------------------------------
357+
358+### `+-put:in`
359+
360+Put b in a
361+
362+Add an element `b` to the [`++set`]() `a`.
363+
364+Accepts
365+-------
366+
367+`a` is a set.
368+
369+`b` is a [noun]().
370+
371+Produces
372+--------
373+
374+A [`++set`]().
375+
376+Source
377+------
378+
379+ +- put :: puts b in a
380+ ~/ %put
381+ |* b=*
382+ |- ^+ a
383+ ?~ a
384+ [b ~ ~]
385+ ?: =(b n.a)
386+ a
387+ ?: (hor b n.a)
388+ =+ c=$(a l.a)
389+ ?> ?=(^ c)
390+ ?: (vor n.a n.c)
391+ [n.a c r.a]
392+ [n.c l.c [n.a r.c r.a]]
393+ =+ c=$(a r.a)
394+ ?> ?=(^ c)
395+ ?: (vor n.a n.c)
396+ [n.a l.a c]
397+ [n.c [n.a l.a l.c] r.c]
398+ ::
399+
400+
401+Examples
402+--------
403+
404+ ~zod/try=> =a (~(gas in `(set ,@t)`~) `(list ,@t)`[`a` `b` `c` ~])
405+ ~zod/try=> =b (~(put in a) `d`)
406+ ~zod/try=> b
407+ {`d` `a` `c` `b`}
408+ ~zod/try=> -.l.+.b
409+ n=`d`
410+
411+------------------------------------------------------------------------
412+
413+### `+-rep:in`
414+
415+Accumulate
416+
417+Accumulate the elements of `a` using a [gate]() `c` and an accumulator `b`.
418+
419+Accepts
420+--------
421+
422+`a` is a [`++set`]().
423+
424+`b` is a [noun]().
425+
426+`c` is a gate.
427+
428+Produces
429+--------
430+
431+A noun.
432+
433+Source
434+------
435+
436+ +- rep :: replace by tile
437+ |* [b=* c=_,*]
438+ |-
439+ ?~ a b
440+ $(a r.a, b $(a l.a, b (c n.a b)))
441+ ::
442+
443+
444+Examples
445+--------
446+
447+ ~zod/try=> =a (~(gas in *(set ,@)) [1 2 3 ~])
448+ ~zod/try=> a
449+ {1 3 2}
450+ ~zod/try=> (~(rep in a) 0 |=([a=@ b=@] (add a b)))
451+ 6
452+
453+------------------------------------------------------------------------
454+
455+### `+-tap:in`
456+
457+Set to list
458+
459+Flattens the [`++set`]() `a` into a [`++list`]().
460+
461+Accepts
462+-------
463+
464+`a` is an set.
465+
466+Produces
467+--------
468+
469+A list.
470+
471+Source
472+------
473+
474+ +- tap :: list tiles a set
475+ ~/ %tap
476+ |= b=(list ,_?>(?=(^ a) n.a))
477+ ^+ b
478+ ?~ a
479+ b
480+ $(a r.a, b [n.a $(a l.a)])
481+ ::
482+
483+
484+Examples
485+--------
486+
487+ ~zod/try=> =s (sa `(list ,@t)`['a' 'b' 'c' 'd' 'e' ~])
488+ ~zod/try=> s
489+ {'e' 'd' 'a' 'c' 'b'}
490+ ~zod/try=> (~(tap in s) `(list ,@t)`['1' '2' '3' ~])
491+ ~['b' 'c' 'a' 'd' 'e' '1' '2' '3']
492+ ~zod/try=> b
493+ {'bonita' 'madeleine' 'daniel' 'john'}
494+ ~zod/try=> (~(tap in b) `(list ,@t)`['david' 'people' ~])
495+ ~['john' 'daniel' 'madeleine' 'bonita' 'david' 'people']
496+
497+------------------------------------------------------------------------
498+
499+### `+-uni:in`
500+
501+Union
502+
503+Produces a set of the union between two [`++set`]()s of the same type, `a` and
504+`b`.
505+
506+Accepts
507+-------
508+
509+`a` is a set.
510+
511+`b` is a set.
512+
513+Produces
514+--------
515+
516+A set.
517+
518+Source
519+------
520+
521+ +- uni :: union
522+ ~/ %uni
523+ |* b=_a
524+ |- ^+ a
525+ ?~ b
526+ a
527+ ?~ a
528+ b
529+ ?: (vor n.a n.b)
530+ ?: =(n.b n.a)
531+ [n.b $(a l.a, b l.b) $(a r.a, b r.b)]
532+ ?: (hor n.b n.a)
533+ $(a [n.a $(a l.a, b [n.b l.b ~]) r.a], b r.b)
534+ $(a [n.a l.a $(a r.a, b [n.b ~ r.b])], b l.b)
535+ ?: =(n.a n.b)
536+ [n.b $(b l.b, a l.a) $(b r.b, a r.a)]
537+ ?: (hor n.a n.b)
538+ $(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
539+ $(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
540+
541+
542+Examples
543+--------
544+
545+ ~zod/try=> (~(uni in (sa "ac")) (sa "ha"))
546+ {~~a ~~c ~~h}
547+ ~zod/try=> (~(uni in (sa "acmo")) ~)
548+ {~~a ~~c ~~m ~~o}
549+ ~zod/try=> (~(uni in (sa "acmo")) (sa "ham"))
550+ {~~a ~~c ~~m ~~o ~~h}
551+ ~zod/try=> (~(uni in (sa "acmo")) (sa "lep"))
552+ {~~e ~~a ~~c ~~m ~~l ~~o ~~p}
553+
554+------------------------------------------------------------------------
555+
556+### `+-wyt:in`
557+
558+Set size
559+
560+Produce the number of elements in [`++set`]() `a` as an atom.
561+
562+Accepts
563+-------
564+
565+`a` is an set.
566+
567+Produces
568+--------
569+
570+An atom.
571+
572+Source
573+------
574+
575+ +- wyt :: size of set
576+ |- ^- @
577+ ?~(a 0 +((add $(a l.a) $(a r.a))))
578+
579+
580+Examples
581+--------
582+
583+ ~zod/try=> =a (~(put in (~(put in (sa)) 'a')) 'b')
584+ ~zod/try=> ~(wyt in a)
585+ 2
586+ ~zod/try=> b
587+ {'bonita' 'madeleine' 'daniel' 'john'}
588+ ~zod/try=> ~(wyt in b)
589+ 4
590+
591+
592+***
docs/system/hoon/library/2i.mdnew file+572
@@ -0,0 +1,572 @@
1+## 2i: map logic
2+### `++by`
3+
4+Map operations
5+
6+ ++ by :: map engine
7+ ~/ %by
8+ |/ a=(map)
9+
10+Container arm for map operation arms. A map is a set of key, value
11+pairs. The contained arms inherit it's [sample]() [map](), `a`.
12+
13+`a` is a [map]().
14+
15+ ~zod/try=> ~(. by (mo (limo [%a 1] [%b 2] ~)))
16+ <19.irb [nlr([p={%a %b} q=@ud]) <414.rvm 101.jzo 1.ypj %164>]>
17+
18+------------------------------------------------------------------------
19+
20+### `+-all:by`
21+
22+Logical AND
23+
24+ +- all :: logical AND
25+ ~/ %all
26+ |* b=$+(* ?)
27+ |- ^- ?
28+ ?~ a
29+ &
30+ ?&((b q.n.a) $(a l.a) $(a r.a))
31+
32+Computes the logical AND on the results of slamming every element in map
33+`a` with gate `b`. Produces a loobean.
34+
35+`a` is a [map]().
36+
37+`b` is a [wet gate]().
38+
39+ ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
40+ ~zod/try=> (~(all by b) |=(a=* ?@(a & |)))
41+ %.n
42+ ~zod/try=> =a (mo `(list ,[@t @u])`[['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~])
43+ ~zod/try=> (~(all by a) |=(a=@ (lte a 6)))
44+ %.y
45+ ~zod/try=> (~(all by a) |=(a=@ (lte a 4)))
46+ %.n
47+
48+------------------------------------------------------------------------
49+
50+### `+-any:by`
51+
52+Logical OR
53+
54+ +- any :: logical OR
55+ ~/ %any
56+ |* b=$+(* ?)
57+ |- ^- ?
58+ ?~ a
59+ |
60+ ?|((b q.n.a) $(a l.a) $(a r.a))
61+
62+Computes the logical OR on the results of slamming every element with
63+gate `b`. Produces a loobean.
64+
65+`a` is a [map]().
66+
67+`b` is a [wet gate]().
68+
69+ ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
70+ ~zod/try=> (~(all by b) |=(a=* ?@(a & |)))
71+ %.y
72+ ~zod/try=> =a (mo `(list ,[@t @u])`[['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~])
73+ ~zod/try=> (~(any by a) |=(a=@ (lte a 4)))
74+ %.y
75+
76+------------------------------------------------------------------------
77+
78+### `+-del:by`
79+
80+Delete
81+
82+ +- del :: delete at key b
83+ ~/ %del
84+ |* b=*
85+ |- ^+ a
86+ ?~ a
87+ ~
88+ ?. =(b p.n.a)
89+ ?: (gor b p.n.a)
90+ [n.a $(a l.a) r.a]
91+ [n.a l.a $(a r.a)]
92+ |- ^- ?(~ _a)
93+ ?~ l.a r.a
94+ ?~ r.a l.a
95+ ?: (vor p.n.l.a p.n.r.a)
96+ [n.l.a l.l.a $(l.a r.l.a)]
97+ [n.r.a $(r.a l.r.a) r.r.a]
98+
99+Produces map `a` with the element located at key `b` removed.
100+
101+`a` is a [map]().
102+
103+`b` is a key as a [noun]().
104+
105+ ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
106+ ~zod/try=> (~(del by b) `a`)
107+ {[p=`b` q=[2 3]]}
108+
109+------------------------------------------------------------------------
110+
111+### `+-dig:by`
112+
113+Axis of key
114+
115+ +- dig :: axis of key
116+ |= b=*
117+ =+ c=1
118+ |- ^- (unit ,@)
119+ ?~ a ~
120+ ?: =(b p.n.a) [~ u=(peg c 2)]
121+ ?: (gor b p.n.a)
122+ $(a l.a, c (peg c 6))
123+ $(a r.a, c (peg c 7))
124+
125+Produce the axis of key `b` within map `a`.
126+
127+`a` is a [map]().
128+
129+`b` is a key as a [noun]().
130+
131+ ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
132+ ~zod/try=> (~(dig by b) `b`)
133+ [~ 2]
134+
135+------------------------------------------------------------------------
136+
137+### `+-gas:by`
138+
139+Concatenate
140+
141+ +- gas :: concatenate
142+ ~/ %gas
143+ |* b=(list ,[p=* q=*])
144+ => .(b `(list ,_?>(?=(^ a) n.a))`b)
145+ |- ^+ a
146+ ?~ b
147+ a
148+ $(b t.b, a (put(+< a) p.i.b q.i.b))
149+
150+Insert a list of key-value pairs `b` into map `a`.
151+
152+`a` is a [map]().
153+
154+`b` is a [list]() of [cells]() of key-value nouns `p` and `q`.
155+
156+ ~zod/try=> =a (mo `(list ,[@t *])`[[`a` 1] [`b` 2] ~])
157+ ~zod/try=> =b `(list ,[@t *])`[[`c` 3] [`d` 4] ~]
158+ ~zod/try=> (~(gas by a) b)
159+ {[p=`d` q=4] [p=`a` q=1] [p=`c` q=3] [p=`b` q=2]}
160+
161+------------------------------------------------------------------------
162+
163+### `+-get:by`
164+
165+Grab unit value
166+
167+ +- get :: unit value by key
168+ ~/ %get
169+ |* b=*
170+ |- ^- ?(~ [~ u=_?>(?=(^ a) q.n.a)])
171+ ?~ a
172+ ~
173+ ?: =(b p.n.a)
174+ [~ u=q.n.a]
175+ ?: (gor b p.n.a)
176+ $(a l.a)
177+ $(a r.a)
178+
179+Produce the unit value of the value located at key `b` within map `a`.
180+
181+`a` is a [map]()
182+
183+`b` is a [key]() as a [noun]()
184+
185+ ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
186+ ~zod/try=> (~(get by b) `b`)
187+ [~ [2 3]]
188+
189+------------------------------------------------------------------------
190+
191+### `+-got:by`
192+
193+Assert
194+
195+ +- got
196+ |* b=*
197+ %- need
198+ %- get(+< a) b
199+
200+Produce the value located at key `b` within map `a`. Crash if key `b`
201+does not exist.
202+
203+`a` is a [map]().
204+
205+`b` is a [key]().
206+
207+ ~zod/try=> =m (mo `(list ,[@t *])`[['a' 1] ['b' 2] ~])
208+ ~zod/try=> m
209+ {[p='a' q=1] [p='b' q=2]}
210+ ~zod/try=> (~(get by m) 'a')
211+ [~ 1]
212+ ~zod/try=> (~(got by m) 'a')
213+ 1
214+ ~zod/try=> (~(got by m) 'c')
215+ ! exit
216+
217+------------------------------------------------------------------------
218+
219+### `+-has:by`
220+
221+Key existence check
222+
223+ +- has :: key existence check
224+ ~/ %has
225+ |* b=*
226+ !=(~ (get(+< a) b))
227+
228+Checks whether map `a` contains an element with key `b`, producing a
229+loobean.
230+
231+`a` is a [map]().
232+
233+`b` is a key as a [noun]().
234+
235+ ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
236+ ~zod/try=> (~(has by b) `b`)
237+ %.y
238+ ~zod/try=> (~(has by b) `c`)
239+ %.n
240+
241+------------------------------------------------------------------------
242+
243+### `+-int:by`
244+
245+Intersection
246+
247+ +- int :: intersection
248+ ~/ %int
249+ |* b=_a
250+ |- ^+ a
251+ ?~ b
252+ ~
253+ ?~ a
254+ ~
255+ ?: (vor p.n.a p.n.b)
256+ ?: =(p.n.b p.n.a)
257+ [n.b $(a l.a, b l.b) $(a r.a, b r.b)]
258+ ?: (hor p.n.b p.n.a)
259+ %- uni(+< $(a l.a, b [n.b l.b ~])) $(b r.b)
260+ %- uni(+< $(a r.a, b [n.b ~ r.b])) $(b l.b)
261+ ?: =(p.n.a p.n.b)
262+ [n.b $(b l.b, a l.a) $(b r.b, a r.a)]
263+ ?: (hor p.n.a p.n.b)
264+ %- uni(+< $(b l.b, a [n.a l.a ~])) $(a r.a)
265+ %- uni(+< $(b r.b, a [n.a ~ r.a])) $(a l.a)
266+
267+Produces a map of the (key) intersection between two maps of the same
268+type, `a` and `b`. If both maps have an identical key that point to
269+different values, the element from map `b` is used.
270+
271+`a` is a [map]().
272+
273+`b` is a [map]().
274+
275+ ~zod/try=> =n (mo `(list ,[@t *])`[['a' 1] ['c' 3] ~])
276+ ~zod/try=> n
277+ {[p='a' q=1] [p='c' q=3]}
278+ ~zod/try=> m
279+ {[p='a' q=1] [p='b' q=2]}
280+ ~zod/try=> (~(int by m) n)
281+ {[p='a' q=1]}
282+ ~ravpel-holber/try=> =p (mo `(list ,[@t *])`[['a' 2] ['b' 2] ~])
283+ ~zod/try=> p
284+ {[p='a' q=2] [p='b' q=2]}
285+ ~zod/try=> (~(int by p) n)
286+ {[p='a' q=2]}
287+ ~zod/try=> =q (mo `(list ,[@t *])`[['a' 2] ['c' 2] ~])
288+ ~zod/try=> q
289+ {[p='a' q=2] [p='b' q=2]}
290+ ~zod/try=> (~(int by p) q)
291+ {[p='a' q=2] [p='b' q=2]}
292+ ~zod/try=> =o (mo `(list ,[@t *])`[['c' 3] ['d' 4] ~])
293+ ~zod/try=> (~(int by m) o)
294+ {}
295+
296+
297+------------------------------------------------------------------------
298+
299+### `+-mar:by`
300+
301+Assert and Add
302+
303+ +- mar :: add with validation
304+ |* [b=_?>(?=(^ a) p.n.a) c=(unit ,_?>(?=(^ a) q.n.a))]
305+ ?~ c
306+ (del b)
307+ (put b u.c)
308+
309+Produces map `a` with the addition of a key-value pair, where the value
310+is a nonempty unit.
311+
312+Accept a noun and a unit of a noun of the type of the map's keys and
313+values, respectively. Validate that the value is not null and put the
314+pair in the map. If the value is null, delete the key.
315+
316+XX This arm is broken, asana task 15186618346453
317+
318+ ~zod/try=> m
319+ {[p='a' q=1] [p='b' q=2]}
320+ ~zod/try=> (~(mar by m) 'c' (some 3))
321+ ! -find-limb.n
322+ ! find-none
323+ ! exit
324+ ~zod/try=> (~(mar by m) 'c' ~)
325+ ! -find-limb.n
326+ ! find-none
327+ ! exit
328+ ~zod/try=> (~(mar by m) 'b' ~)
329+ ! -find-limb.n
330+ ! find-none
331+ ! exit
332+
333+------------------------------------------------------------------------
334+
335+### `+-put:by`
336+
337+Add key-value pair
338+
339+ +- put :: adds key-value pair
340+ ~/ %put
341+ |* [b=* c=*]
342+ |- ^+ a
343+ ?~ a
344+ [[b c] ~ ~]
345+ ?: =(b p.n.a)
346+ ?: =(c q.n.a)
347+ a
348+ [[b c] l.a r.a]
349+ ?: (gor b p.n.a)
350+ =+ d=$(a l.a)
351+ ?> ?=(^ d)
352+ ?: (vor p.n.a p.n.d)
353+ [n.a d r.a]
354+ [n.d l.d [n.a r.d r.a]]
355+ =+ d=$(a r.a)
356+ ?> ?=(^ d)
357+ ?: (vor p.n.a p.n.d)
358+ [n.a l.a d]
359+ [n.d [n.a l.a l.d] r.d]
360+
361+Produces `a` with the addition of the key-value pair of `b` and `c`.
362+
363+`a` is a [map]().
364+
365+`b` is a key of the same type as the keys in `a`.
366+
367+`c` is a value of the same type of the values in `a`.
368+
369+ ~zod/try=> m
370+ {[p='a' q=1] [p='b' q=2]}
371+ ~zod/try=> (~(put by m) 'c' 3)
372+ {[p='a' q=1] [p='c' q=3] [p='b' q=2]}
373+ ~zod/try=> (~(put by m) "zod" 26)
374+ ! type-fail
375+ ! exit
376+ ~zod/try=> (~(put by m) 'a' 2)
377+ {[p='a' q=2] [p='b' q=2]}
378+
379+------------------------------------------------------------------------
380+
381+### `+-rep:by`
382+
383+ +- rep :: replace by product
384+ |* [b=* c=_,*]
385+ |-
386+ ?~ a b
387+ $(a r.a, b $(a l.a, b (c q.n.a b)))
388+
389+Accumulate using gate from values in map
390+
391+XX interface changing.
392+
393+------------------------------------------------------------------------
394+
395+### `+-rib:by`
396+
397+ +- rib :: transform + product
398+ |* [b=* c=_,*]
399+ |- ^+ [b a]
400+ ?~ a [b ~]
401+ =+ d=(c n.a b)
402+ =. n.a +.d
403+ =+ e=$(a l.a, b -.d)
404+ =+ f=$(a r.a, b -.e)
405+ [-.f [n.a +.e +.f]]
406+
407+Replace values with accumulator
408+
409+XX interface changing, possibly disappearing
410+
411+------------------------------------------------------------------------
412+
413+### `+-run:by`
414+
415+Transform values
416+
417+ +- run :: turns to tuples
418+ |* b=_,*
419+ |-
420+ ?~ a a
421+ a(n (b q.n.a), l $(a l.a), r $(a r.a))
422+
423+Iterates over every value in set `a` using gate `b`. Produces a map.
424+
425+`a` is a [map]().
426+
427+`b` is a [wet gate]().
428+
429+ ~zod/try=> m
430+ {[p='a' q=1] [p='b' q=2]}
431+ ~zod/try=> ^+(m (~(run by m) dec))
432+ {[p='a' q=0] [p='b' q=1]}
433+ ~zod/try=> `(map ,@tas ,@t)`(~(run by m) (cury scot %ux))
434+ {[p=%a q='0x1'] [p=%b q='0x2']}
435+
436+------------------------------------------------------------------------
437+
438+### `+-tap:by`
439+
440+Listify pairs
441+
442+ +- tap :: listify pairs
443+ ~/ %tap
444+ |= b=(list ,_?>(?=(^ a) n.a))
445+ ^+ b
446+ ?~ a
447+ b
448+ $(a r.a, b [n.a $(a l.a)])
449+
450+Produces the list of all elements in map `a` that is prepended to list
451+`b`, which is empty by default.
452+
453+`a` is a [map]().
454+
455+`b` is a [list]().
456+
457+ {[p='a' q=1] [p='b' q=2]}
458+ ~zod/try=> `*`m
459+ [[98 2] [[97 1] 0 0] 0]
460+ ~zod/try=> (~(tap by m))
461+ ~[[p='b' q=2] [p='a' q=1]]
462+ ~zod/try=> `*`(~(tap by m))
463+ [[98 2] [97 1] 0]
464+
465+------------------------------------------------------------------------
466+
467+### `+-uni:by`
468+
469+Union
470+
471+ +- uni :: union, merge
472+ ~/ %uni
473+ |* b=_a
474+ |- ^+ a
475+ ?~ b
476+ a
477+ ?~ a
478+ b
479+ ?: (vor p.n.a p.n.b)
480+ ?: =(p.n.b p.n.a)
481+ [n.b $(a l.a, b l.b) $(a r.a, b r.b)]
482+ ?: (hor p.n.b p.n.a)
483+ $(a [n.a $(a l.a, b [n.b l.b ~]) r.a], b r.b)
484+ $(a [n.a l.a $(a r.a, b [n.b ~ r.b])], b l.b)
485+ ?: =(p.n.a p.n.b)
486+ [n.b $(b l.b, a l.a) $(b r.b, a r.a)]
487+ ?: (hor p.n.a p.n.b)
488+ $(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
489+ $(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
490+
491+Produces a map of the union between the keys of `a` and `b`. If `b`
492+shares a key with `a`, the tuple from `a` is preserved.
493+
494+`a` is a [map]().
495+
496+`b` is a [map]().
497+
498+ ~zod/try=> m
499+ {[p='a' q=1] [p='b' q=2]}
500+ ~zod/try=> o
501+ {[p='d' q=4] [p='c' q=3]}
502+ ~zod/try=> (~(uni by m) o)
503+ {[p='d' q=4] [p='a' q=1] [p='c' q=3] [p='b' q=2]}
504+ ~zod/try=> (~(uni by m) ~)
505+ {[p='a' q=1] [p='b' q=2]}
506+ ~zod/try=> n
507+ {[p='a' q=1] [p='c' q=9]}
508+ ~zod/try=> (~(uni by o) n)
509+ {[p='d' q=4] [p='a' q=1] [p='c' q=3]}
510+ ~zod/try=> =n (mo `(list ,[@t *])`[['a' 1] ['c' 9] ~])
511+ ~zod/try=> n
512+ {[p='a' q=1] [p='c' q=9]}
513+ ~zod/try=> (~(uni by o) n)
514+ {[p='d' q=4] [p='a' q=1] [p='c' q=9]}
515+
516+------------------------------------------------------------------------
517+
518+### `+-urn:by`
519+
520+Turn (with key)
521+
522+ +- urn :: turn
523+ |* b=$+([* *] *)
524+ |-
525+ ?~ a ~
526+ [n=[p=p.n.a q=(b p.n.a q.n.a)] l=$(a l.a) r=$(a r.a)]
527+
528+Iterates over every value in map `a` using gate `b`, which accepts both
529+the key and the value of each element as its sample.
530+
531+`a` is a [map]().
532+
533+`b` is a [wet gate]() that accepts two nouns (a key and a value) and
534+produces a noun (the new value).
535+
536+ ~zod/try=> m
537+ {[p='a' q=1] [p='b' q=2]}
538+ ~zod/try=> (~(urn by m) |=(a=[p=* q=*] q.a))
539+ {[p='a' q=1] [p='b' q=2]}
540+ ~zod/try=> (~(urn by m) |=(a=[p=* q=*] 7))
541+ {[p='a' q=7] [p='b' q=7]}
542+ ~zod/try=> (~(urn by m) |=(a=[p=* q=*] p.a))
543+ {[p='a' q=97] [p='b' q=98]}
544+
545+------------------------------------------------------------------------
546+
547+### `+-wyt:by`
548+
549+Depth
550+
551+ +- wyt :: depth of map
552+ |- ^- @
553+ ?~(a 0 +((add $(a l.a) $(a r.a))))
554+
555+Produce the depth of the tree map `a`.
556+
557+`a` is a [map]().
558+
559+ ~zod/try=> m
560+ {[p='a' q=1] [p='b' q=2]}
561+ ~zod/try=> o
562+ {[p='d' q=4] [p='c' q=3]}
563+ ~zod/try=> ~(wyt by m)
564+ 2
565+ ~zod/try=> ~(wyt by o)
566+ 2
567+ ~zod/try=> ~(wyt by (~(uni by m) o))
568+ 4
569+
570+
571+
572+***
docs/system/hoon/library/2j.mdnew file+369
@@ -0,0 +1,369 @@
1+## 2j: jar and jug logic
2+### `++ja`
3+
4+Jar engine
5+
6+ ++ ja :: jar engine
7+ |/ a=(jar)
8+
9+A container arm for `++jar` operation arms. A `++jar` is a `++map` of
10+`++list`s. The contained arms inherit the [sample]() jar.
11+
12+`a` is a [jar]().
13+
14+ ~zod/try=> ~(. ja (mo (limo a/"ho" b/"he" ~)))
15+ <2.dgz [nlr([p={%a %b} q=""]) <414.fvk 101.jzo 1.ypj %164>]>
16+
17+------------------------------------------------------------------------
18+
19+### `+-get:ja`
20+
21+Grab value by key
22+
23+ +- get :: grab value by key
24+ |* b=*
25+ =+ c=(~(get by a) b)
26+ ?~(c ~ u.c)
27+
28+Produces a list retrieved from jar `a` using the key `b`.
29+
30+`a` is a [`++jar`](/doc/hoon/library/1#++jar).
31+
32+`b` is a key of the same type as the keys in `a`.
33+
34+ ~zod/try=> =l (mo `(list ,[@t (list ,@)])`[['a' `(list ,@)`[1 2 3 ~]] ['b' `(list ,@)`[4 5 6 ~]] ~])
35+ ~zod/try=> l
36+ {[p='a' q=~[1 2 3]] [p='b' q=~[4 5 6]]}
37+ ~zod/try=> (~(get ja l) 'a')
38+ ~[1 2 3]
39+ ~zod/try=> (~(get ja l) 'b')
40+ ~[4 5 6]
41+ ~zod/try=> (~(get ja l) 'c')
42+ ~
43+
44+------------------------------------------------------------------------
45+
46+### `+-add:ja`
47+
48+Prepend to list
49+
50+ +- add :: adds key-list pair
51+ |* [b=* c=*]
52+ =+ d=(get(+< a) b)
53+ (~(put by a) b [c d])
54+
55+Produces jar `a` with value `c` prepended to the list located at key
56+`b`.
57+
58+`a` is a [jar]().
59+
60+`b` is a key of the same type as the keys in `a`.
61+
62+`c` is a value of the same type as the values in `a`.
63+
64+ ~zod/try=> =l (mo `(list ,[@t (list ,@)])`[['a' `(list ,@)`[1 2 3 ~]] ['b' `(list ,@)`[4 5 6 ~]] ~])
65+ ~zod/try=> l
66+ {[p='a' q=~[1 2 3]] [p='b' q=~[4 5 6]]}
67+ ~zod/try=> (~(add ja l) 'b' 7)
68+ {[p='a' q=~[1 2 3]] [p='b' q=~[7 4 5 6]]}
69+ ~zod/try=> (~(add ja l) 'a' 100)
70+ {[p='a' q=~[100 1 2 3]] [p='b' q=~[4 5 6]]}
71+ ~zod/try=> (~(add ja l) 'c' 7)
72+ {[p='a' q=~[1 2 3]] [p='c' q=~[7]] [p='b' q=~[4 5 6]]}
73+ ~zod/try=> (~(add ja l) 'c' `(list ,@)`[7 8 9 ~])
74+ ! type-fail
75+ ! exit
76+
77+------------------------------------------------------------------------
78+
79+### `++ju`
80+
81+Jug operations
82+
83+ ++ ju :: jug engine
84+ |/ a=(jug)
85+
86+Container arm for jug operation arms. A `++jug` is a `++map` of
87+`++sets`. The contained arms inherit its [sample]() jug, `a`.
88+
89+`a` is a [jug]().
90+
91+ ~zod/try=> ~(. ju (mo (limo a/(sa "ho") b/(sa "he") ~)))
92+ <2.dgz [nlr([p={%a %b} q={nlr(^$1{@tD $1}) nlr(^$3{@tD $3})}]) <414.fvk 101.jzo 1.ypj %164>]>
93+
94+### `+-del:ju`
95+
96+Remove
97+
98+ +- del :: delete at key b
99+ |* [b=* c=*]
100+ ^+ a
101+ =+ d=(get(+< a) b)
102+ =+ e=(~(del in d) c)
103+ ?~ e
104+ (~(del by a) b)
105+ (~(put by a) b e)
106+
107+Produces jug `a` with value `c` removed from set located at key `b`.
108+
109+`a` is a [jug]().
110+
111+`b` is a key of the same type as the keys in `a`.
112+
113+`c` is the value of the same type of the keys in `a` that is to be
114+removed.
115+
116+ ~zod/try=> s
117+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
118+ ~zod/try=> (~(del ju s) 'a' 1)
119+ {[p='a' q={3 2}] [p='b' q={5 4 6}]}
120+ ~zod/try=> (~(del ju s) 'c' 7)
121+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
122+
123+------------------------------------------------------------------------
124+
125+### `+-get:ju`
126+
127+Retrieve set
128+
129+ +- get :: gets set by key
130+ |* b=*
131+ =+ c=(~(get by a) b)
132+ ?~(c ~ u.c)
133+
134+Produces a set retrieved from jar `a` using key `b`.
135+
136+`a` is a [jar]().
137+
138+`b` is a key of the same type as the keys in `a`.
139+
140+ ~zod/try=> s
141+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
142+ ~zod/try=> (~(get ju s) 'a')
143+ {1 3 2}
144+ ~zod/try=> (~(get ju s) 'b')
145+ {5 4 6}
146+ ~zod/try=> (~(get ju s) 'c')
147+ ~
148+
149+------------------------------------------------------------------------
150+
151+### `+-has:ju`
152+
153+Check contents
154+
155+ +- has :: existence check
156+ |* [b=* c=*]
157+ ^- ?
158+ (~(has in (get(+< a) b)) c)
159+
160+Computes whether a value `c` exists within the set located at key `b`
161+with jar `a`. Produces a loobean.
162+
163+`a` is a [set]().
164+
165+`b` is a key as a [noun]().
166+
167+`c` is a value as a [noun]().
168+
169+ ~zod/try=> s
170+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
171+ ~zod/try=> (~(has ju s) 'a' 3)
172+ %.y
173+ ~zod/try=> (~(has ju s) 'b' 6)
174+ %.y
175+ ~zod/try=> (~(has ju s) 'a' 7)
176+ %.n
177+ ~zod/try=> (~(has jus s) 'c' 7)
178+ ! -find-limb.jus
179+ ! find-none
180+ ! exit
181+ ~zod/try=> (~(has ju s) 'c' 7)
182+ %.n
183+
184+------------------------------------------------------------------------
185+
186+### `+-put:ju`
187+
188+Add key-set pair
189+
190+ +- put :: adds key-element pair
191+ |* [b=* c=*]
192+ ^+ a
193+ =+ d=(get(+< a) b)
194+ (~(put by a) b (~(put in d) c))
195+
196+Produces jar `a` with `c` added to the set value located at key `b`.
197+
198+`a` is a [set]().
199+
200+`b` is a key as a [noun]().
201+
202+`c` is a [value]().
203+
204+ ~zod/try=> s
205+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
206+ ~zod/try=> (~(put ju s) 'a' 7)
207+ {[p='a' q={7 1 3 2}] [p='b' q={5 4 6}]}
208+ ~zod/try=> (~(put ju s) 'a' 1)
209+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
210+ ~zod/try=> (~(put ju s) 'c' 7)
211+ {[p='a' q={1 3 2}] [p='c' q={7}] [p='b' q={5 4 6}]}
212+
213+------------------------------------------------------------------------
214+
215+### `++by`
216+
217+Map operations
218+
219+ ++ by :: map engine
220+ ~/ %by
221+ |/ a=(map)
222+
223+Container arm for map operation arms. A map is a set of key, value
224+pairs. The contained arms inherit it's [sample]() [map](), `a`.
225+
226+`a` is a [map]().
227+
228+ ~zod/try=> ~(. by (mo (limo [%a 1] [%b 2] ~)))
229+ <19.irb [nlr([p={%a %b} q=@ud]) <414.rvm 101.jzo 1.ypj %164>]>
230+
231+
232+***
233+### `++ju`
234+
235+Jug operations
236+
237+ ++ ju :: jug engine
238+ |/ a=(jug)
239+
240+Container arm for jug operation arms. A `++jug` is a `++map` of
241+`++sets`. The contained arms inherit its [sample]() jug, `a`.
242+
243+`a` is a [jug]().
244+
245+ ~zod/try=> ~(. ju (mo (limo a/(sa "ho") b/(sa "he") ~)))
246+ <2.dgz [nlr([p={%a %b} q={nlr(^$1{@tD $1}) nlr(^$3{@tD $3})}]) <414.fvk 101.jzo 1.ypj %164>]>
247+
248+### `+-del:ju`
249+
250+Remove
251+
252+ +- del :: delete at key b
253+ |* [b=* c=*]
254+ ^+ a
255+ =+ d=(get(+< a) b)
256+ =+ e=(~(del in d) c)
257+ ?~ e
258+ (~(del by a) b)
259+ (~(put by a) b e)
260+
261+Produces jug `a` with value `c` removed from set located at key `b`.
262+
263+`a` is a [jug]().
264+
265+`b` is a key of the same type as the keys in `a`.
266+
267+`c` is the value of the same type of the keys in `a` that is to be
268+removed.
269+
270+ ~zod/try=> s
271+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
272+ ~zod/try=> (~(del ju s) 'a' 1)
273+ {[p='a' q={3 2}] [p='b' q={5 4 6}]}
274+ ~zod/try=> (~(del ju s) 'c' 7)
275+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
276+
277+------------------------------------------------------------------------
278+
279+### `+-get:ju`
280+
281+Retrieve set
282+
283+ +- get :: gets set by key
284+ |* b=*
285+ =+ c=(~(get by a) b)
286+ ?~(c ~ u.c)
287+
288+Produces a set retrieved from jar `a` using key `b`.
289+
290+`a` is a [jar]().
291+
292+`b` is a key of the same type as the keys in `a`.
293+
294+ ~zod/try=> s
295+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
296+ ~zod/try=> (~(get ju s) 'a')
297+ {1 3 2}
298+ ~zod/try=> (~(get ju s) 'b')
299+ {5 4 6}
300+ ~zod/try=> (~(get ju s) 'c')
301+ ~
302+
303+------------------------------------------------------------------------
304+
305+### `+-has:ju`
306+
307+Check contents
308+
309+ +- has :: existence check
310+ |* [b=* c=*]
311+ ^- ?
312+ (~(has in (get(+< a) b)) c)
313+
314+Computes whether a value `c` exists within the set located at key `b`
315+with jar `a`. Produces a loobean.
316+
317+`a` is a [set]().
318+
319+`b` is a key as a [noun]().
320+
321+`c` is a value as a [noun]().
322+
323+ ~zod/try=> s
324+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
325+ ~zod/try=> (~(has ju s) 'a' 3)
326+ %.y
327+ ~zod/try=> (~(has ju s) 'b' 6)
328+ %.y
329+ ~zod/try=> (~(has ju s) 'a' 7)
330+ %.n
331+ ~zod/try=> (~(has jus s) 'c' 7)
332+ ! -find-limb.jus
333+ ! find-none
334+ ! exit
335+ ~zod/try=> (~(has ju s) 'c' 7)
336+ %.n
337+
338+------------------------------------------------------------------------
339+
340+### `+-put:ju`
341+
342+Add key-set pair
343+
344+ +- put :: adds key-element pair
345+ |* [b=* c=*]
346+ ^+ a
347+ =+ d=(get(+< a) b)
348+ (~(put by a) b (~(put in d) c))
349+
350+Produces jar `a` with `c` added to the set value located at key `b`.
351+
352+`a` is a [set]().
353+
354+`b` is a key as a [noun]().
355+
356+`c` is a [value]().
357+
358+ ~zod/try=> s
359+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
360+ ~zod/try=> (~(put ju s) 'a' 7)
361+ {[p='a' q={7 1 3 2}] [p='b' q={5 4 6}]}
362+ ~zod/try=> (~(put ju s) 'a' 1)
363+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
364+ ~zod/try=> (~(put ju s) 'c' 7)
365+ {[p='a' q={1 3 2}] [p='c' q={7}] [p='b' q={5 4 6}]}
366+
367+
368+
369+***
docs/system/hoon/library/2k.mdnew file+334
@@ -0,0 +1,334 @@
1+## 2k: queue logic
2+### `++to`
3+
4+Queue operations
5+
6+Container arm for queue operation arms. The contained arms inherit its
7+[sample]() `++qeu` `a`.
8+
9+Accepts
10+-------
11+
12+`a` is a queue, [++qeu]().
13+
14+Source
15+------
16+
17+ ++ to :: queue engine
18+ |/ a=(qeu)
19+
20+### `+-bal:to`
21+
22+Balance
23+
24+Vertically rebalances queue `a`.
25+
26+Accepts
27+-------
28+
29+`a` is a [queue]().
30+
31+Produces
32+--------
33+
34+A [queue]().
35+
36+Source
37+------
38+
39+ +- bal
40+ |- ^+ a
41+ ?~ a ~
42+ ?. |(?=(~ l.a) (vor n.a n.l.a))
43+ $(a [n.l.a l.l.a $(a [n.a r.l.a r.a])])
44+ ?. |(?=(~ r.a) (vor n.a n.r.a))
45+ $(a [n.r.a $(a [n.a l.a l.r.a]) r.r.a])
46+ a
47+ ::
48+
49+Examples
50+--------
51+
52+ ~zod/try=> `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~]
53+ {"a" "b" "c" "d" "e" "f" "g"}
54+ ~zod/try=> `*`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~]
55+ [[97 0] 0 [98 0] 0 [99 0] 0 [100 0] 0 [101 0] 0 [102 0] 0 [103 0] 0 0]
56+ ~zod/try=> ~(bal to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~])
57+ {"a" "b" "c" "d" "e" "f" "g"}
58+ ~zod/try=> `*`~(bal to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~])
59+ [[100 0] [[99 0] [[98 0] [[97 0] 0 0] 0] 0] [101 0] 0 [102 0] 0 [103 0] 0 0]
60+
61+------------------------------------------------------------------------
62+
63+### `+-dep:to`
64+
65+Maximum Depth
66+
67+Produces the maximum depth of leaves (r.a and l.a) in queue `a`.
68+
69+Accepts
70+-------
71+
72+`a` is a [queue]().
73+
74+Produces
75+--------
76+
77+An atom.
78+
79+Source
80+------
81+
82+ +- dep :: max depth of queue
83+ |- ^- @
84+ ?~ a 0
85+ +((max $(a l.a) $(a r.a)))
86+ ::
87+
88+Examples
89+--------
90+
91+ ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 5 6 7 ~])
92+ ~zod/try=> ~(dep to a)
93+ 4
94+ ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 ~])
95+ ~zod/try=> ~(dep to a)
96+ 3
97+ ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 ~])
98+ ~zod/try=> ~(dep to a)
99+ 2
100+ ~zod/try=> ~(dep to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~])
101+ 7
102+ ~zod/try=> ~(dep to ~(bal to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~]))
103+ 4
104+
105+------------------------------------------------------------------------
106+
107+### `+-gas`
108+
109+Push list
110+
111+Push all elements of [`++list`]() `b` into the [`++queue`]().
112+
113+Accepts
114+-------
115+
116+`a` is a queue.
117+
118+`b` is a list.
119+
120+Produces
121+--------
122+
123+A queue.
124+
125+Source
126+------
127+
128+ +- gas :: insert list to queue
129+ |= b=(list ,_?>(?=(^ a) n.a))
130+ |- ^+ a
131+ ?~(b a $(b t.b, a (put(+< a) i.b)))
132+ ::
133+
134+Examples
135+--------
136+
137+ ~zod/try=> (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 ~])
138+ {3 2 1}
139+ ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 ~])
140+ ~zod/try=> =b `(list ,@)`[4 5 6 ~]
141+ ~zod/try=> (~(gas to a) b)
142+ {6 5 4 3 2 1}
143+
144+------------------------------------------------------------------------
145+
146+### `+-get:to`
147+
148+Pop
149+
150+Produces the head and tail [`++queue`]() of `a`.
151+
152+Accepts
153+-------
154+
155+`a` is a queue.
156+
157+Produces
158+--------
159+
160+The last element in `a` along with the rest of queue `a`.
161+
162+Source
163+------
164+
165+ +- get :: head-tail pair
166+ |- ^+ [p=?>(?=(^ a) n.a) q=a]
167+ ?~ a
168+ !!
169+ ?~ r.a
170+ [n.a l.a]
171+ =+ b=$(a r.a)
172+ :- p.b
173+ ?: |(?=(~ q.b) (vor n.a n.q.b))
174+ [n.a l.a q.b]
175+ [n.q.b [n.a l.a l.q.b] r.q.b]
176+ ::
177+
178+Examples
179+--------
180+
181+ ~zod/try=> =s (~(gas to *(qeu ,@)) `(list ,@)`~[1 2 3])
182+ ~zod/try=> ~(get to s)
183+ [p=1 q={3 2}]
184+ ~zod/try=> ~(get to ~)
185+ ! exit
186+
187+------------------------------------------------------------------------
188+
189+### `+-nap:to`
190+
191+Remove last element
192+
193+Removes the head of [`++queue`]() `a`, producing the resulting queue.
194+
195+Accepts
196+-------
197+
198+`a` is a [queue]().
199+
200+Produces
201+--------
202+
203+A queue.
204+
205+Source
206+------
207+
208+ +- nap :: removes head
209+ ?> ?=(^ a)
210+ ?: =(~ l.a) r.a
211+ =+ b=get(+< l.a)
212+ bal(+< ^+(a [p.b q.b r.a]))
213+ ::
214+
215+Examples
216+--------
217+
218+ ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 5 6 ~])
219+ ~zod/try=> -.a
220+ n=6
221+ ~zod/try=> =b ~(nap to a)
222+ ~zod/try=> -.b
223+ n=2
224+ ~zod/try=> b
225+ {5 4 3 2 1}
226+ ~zod/try=> a
227+ {6 5 4 3 2 1}
228+
229+------------------------------------------------------------------------
230+
231+### `+-put:to`
232+
233+Insert
234+
235+Accept any [noun]() `b` and adds to [`++queue`]() `a` as the head, producing the
236+resulting queue.
237+
238+Accepts
239+-------
240+
241+`a` is a [queue]().
242+
243+`b` is any noun.
244+
245+Produces
246+--------
247+
248+A queue.
249+
250+Source
251+------
252+
253+ +- put :: insert new tail
254+ |* b=*
255+ |- ^+ a
256+ ?~ a
257+ [b ~ ~]
258+ bal(+< a(l $(a l.a)))
259+ ::
260+
261+Examples
262+--------
263+
264+ ~zod/try=> (~(gas to `(qeu ,@)`~) `(list ,@)`[3 1 2 4 5 6 ~])
265+ ~zod/try=> (~(put to a) 7)
266+ {7 6 5 4 2 1 3}
267+
268+------------------------------------------------------------------------
269+
270+### `+-tap:to`
271+
272+Queue to list
273+
274+Produces [`++queue`]() `a` as a [`++list`]() from front to back.
275+
276+Accepts
277+-------
278+
279+`a` is a [queue]().
280+
281+Source
282+------
283+
284+ +- tap :: queue to list
285+ |= b=(list ,_?>(?=(^ a) n.a))
286+ ^+ b
287+ ?~ a
288+ b
289+ $(a r.a, b [n.a $(a l.a)])
290+ ::
291+
292+Examples
293+--------
294+
295+ ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[3 1 2 4 5 6 ~])
296+ ~zod/try=> `*`a
297+ [6 0 2 [4 [5 0 0] 0] 1 0 3 0 0]
298+ ~zod/try=> (~(tap to a) `(list ,@)`[99 100 101 ~])
299+ ~[3 1 2 4 5 6 99 100 101]
300+
301+------------------------------------------------------------------------
302+
303+### `+-top:to`
304+
305+Produces the head of [`++queue`]() `a` as a [`++unit`]() (an empty queue has no head).
306+
307+Accepts
308+-------
309+
310+`a` is a [queue]().
311+
312+Produces
313+--------
314+
315+A unit.
316+
317+Source
318+------
319+
320+ +- top :: produces head
321+ |- ^- (unit ,_?>(?=(^ a) n.a))
322+ ?~ a ~
323+ ?~(r.a [~ n.a] $(a r.a))
324+
325+Examples
326+--------
327+
328+ ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 5 6 ~])
329+ ~zod/try=> ~(top to a)
330+ [~ 1]
331+
332+
333+
334+***
docs/system/hoon/library/2l.mdnew file+1
@@ -0,0 +1 @@
1+## 2l: container from container
docs/system/hoon/library/2m.mdnew file+1
@@ -0,0 +1 @@
1+## 2m: container from noun
docs/system/hoon/library/2n.mdnew file+190
@@ -0,0 +1,190 @@
1+## 2n: functional hacks
2+### `++cork`
3+
4+Build `f` such that `(f x) .= (b (a x))`.
5+
6+`a` is a noun.
7+
8+`b` is a gate.
9+
10+Source
11+------
12+
13+ ++ cork |*([a=_,* b=gate] (corl b a)) :: compose forward
14+
15+Examples
16+--------
17+
18+ ~zod/try=> (:(cork dec dec dec) 20)
19+ 17
20+ ~zod/try=> =mal (mo (limo a/15 b/23 ~))
21+ ~zod/try=> ((cork ~(got by mal) dec) %a)
22+ 14
23+ ~zod/try=> ((cork ~(got by mal) dec) %b)
24+ 22
25+
26+
27+
28+***
29+### `++corl`
30+
31+Gate compose
32+
33+XX Revisit
34+
35+`a` is a gate.
36+
37+`b` is a noun.
38+
39+Source
40+------
41+
42+ ++ corl :: compose backwards
43+ |* [a=gate b=_,*]
44+ |= c=_+<.b
45+ (a (b c))
46+
47+Examples
48+--------
49+
50+ ~zod/try=> ((corl (lift bex) (slat %ud)) '2')
51+ [~ 4]
52+
53+
54+
55+***
56+### `++curr`
57+
58+Right curry
59+
60+Right curry a gate, binding the tail of its sample
61+
62+Accepts
63+-------
64+
65+`a` is a [gate]().
66+
67+`c` is a [noun]().
68+
69+Produces
70+--------
71+
72+
73+Source
74+------
75+
76+ ++ curr
77+ |* [a=_|=(^ _*) c=*]
78+ |* b=_+<+.a
79+ (a b c)
80+
81+Examples
82+--------
83+
84+ ~zod/try=> =tep (curr scan sym)
85+ ~zod/try=> `@t`(tep "asd")
86+ 'asd'
87+ ~zod/try=> `@t`(tep "lek-om")
88+ 'lek-om'
89+
90+
91+
92+***
93+### `++cury`
94+
95+Curry a gate, binding the head of its sample
96+
97+Accepts
98+-------
99+
100+`a` is a [gate]().
101+
102+`b` is a [noun]().
103+
104+Produces
105+--------
106+
107+A [gate]().
108+
109+Source
110+------
111+
112+ ++ cury
113+ |* [a=_|=(^ _*) b=*]
114+ |* c=_+<+.a
115+ (a b c)
116+
117+Examples
118+--------
119+
120+ ~zod/try=> =mol (cury add 2)
121+ ~zod/try=> (mol 4)
122+ 6
123+ ~zod/try=> (mol 7)
124+ 9
125+
126+
127+
128+***
129+### `++hard`
130+
131+Demands that a specific type be produced, crashing the program is it is
132+not.
133+
134+Source
135+------
136+
137+ ++ hard
138+ |* han=$+(* *)
139+ |= fud=* ^- han
140+ ~| %hard
141+ =+ gol=(han fud)
142+ ?>(=(gol fud) gol)
143+
144+Examples
145+--------
146+
147+ ~zod/try=> ((hard (list)) (limo [1 2 3 ~]))
148+ ~[1 2 3]
149+ ~zod/try=> ((hard ,@) (add 2 2))
150+ 4
151+ ~zod/try=> ((hard ,@t) (crip "Tape to cord, bro!"))
152+ 'Tape to cord, bro'
153+ ~zod/try=> ((hard tape) (crip "...Tape to cord, bro?..."))
154+ ! hard
155+ ! exit
156+
157+
158+
159+***
160+### `++soft`
161+
162+Politely requests a specific type to be produced, producing null if it
163+is not.
164+
165+Source
166+------
167+
168+ ++ soft
169+ |* han=$+(* *)
170+ |= fud=* ^- (unit han)
171+ =+ gol=(han fud)
172+ ?.(=(gol fud) ~ [~ gol])
173+
174+Examples
175+--------
176+
177+ ~zod/try=> ((soft ,%4) (add 2 2))
178+ [~ %4]
179+ ~zod/try=> ((soft ,@) (add 2 2))
180+ [~ 4]
181+ ~zod/try=> ((soft ,%5) (add 2 2))
182+ ~
183+ ~zod/try=> ((soft ,@t) (crip "Tape to cord, Woohoo!"))
184+ [~ 'Tape to cord, Woohoo!']
185+ ~zod/try=> ((soft ,@t) (trip 'Cmon man... Tape to cord? Please?!'))
186+ ~
187+
188+
189+
190+***
docs/system/hoon/library/2o.mdnew file+144
@@ -0,0 +1,144 @@
1+## 2o: normalizing containers
2+### `++jar`
3+
4+
5+Tile generator. A [`++jar`]() is a [`++map`]() of [`++list`]().
6+
7+Source
8+------
9+
10+ ++ jar |*([a=_,* b=_,*] (map a (list b))) :: map of lists
11+
12+Examples
13+--------
14+
15+See also: [`++ja`](), [`++by`](), [`++map`](), [`++list`]()
16+
17+ ~zod/try=> =a (limo [1 2 ~])
18+ ~zod/try=> a
19+ [i=1 t=[i=2 t=~]]
20+ ~zod/try=> =b (limo [3 4 ~])
21+ ~zod/try=> b
22+ [i=3 t=[i=4 t=~]]
23+ ~zod/try=> =c (mo (limo [[%a a] [%b b] ~]))
24+ ~zod/try=> c
25+ {[p=%a q=[i=1 t=[i=2 t=~]]] [p=%b q=[i=3 t=[i=4 t=~]]]}
26+ ~zod/try=> (~(get ja c) %a)
27+ [i=1 t=[i=2 t=~]]
28+ ~zod/try=> (~(get ja c) %c)
29+ ~
30+
31+
32+
33+***
34+### `++jug`
35+
36+[mold]() generator. A `++jug` is a [`++map`]() of [`++set`]()s.
37+
38+Source
39+------
40+
41+ ++ jug |*([a=_,* b=_,*] (map a (set b))) :: map of sets
42+
43+Examples
44+--------
45+
46+See also: `++ju`, `++by`, `++map`, `++set`
47+
48+ ~zod/try=> =a (sa (limo [1 2 ~]))
49+ ~zod/try=> a
50+ {1 2}
51+ ~zod/try=> =b (sa (limo [3 4 ~]))
52+ ~zod/try=> b
53+ {4 3}
54+ ~zod/try=> =c (mo (limo [[%a a] [%b b] ~]))
55+ ~zod/try=> c
56+ {[p=%a q={1 2}] [p=%b q={4 3}]}
57+ ~zod/try=> (~(get ju c) %b)
58+ {4 3}
59+ ~zod/try=> (~(put ju c) [%b 5])
60+ {[p=%a q={1 2}] [p=%b q={5 4 3}]}
61+
62+
63+***
64+### `++map`
65+
66+Map
67+
68+[mold]() generator. A `++map` is a [treap](http://en.wikipedia.org/wiki/Treap) of
69+key, value pairs.
70+
71+
72+Source
73+------
74+
75+ ++ map |* [a=_,* b=_,*] :: associative tree
76+
77+Examples
78+--------
79+
80+See also: [`++by`]()
81+
82+ ~zod/try=> :type; *(map ,@t ,@u)
83+ {}
84+ nlr([p=@t q=@u])
85+ ~zod/try=> `(map ,@ta ,@ud)`(mo (limo a/1 b/2 ~))
86+ {[p=~.a q=1] [p=~.b q=2]}
87+
88+
89+
90+***
91+### `++qeu`
92+
93+Queue
94+
95+[mold]() generator. An ordered [treap](http://en.wikipedia.org/wiki/Treap) of
96+items.
97+
98+Source
99+------
100+
101+ ++ qeu |* a=_,* :: queue
102+ $|(~ [n=a l=(qeu a) r=(qeu a)]) ::
103+
104+See also: [`++to`]()
105+
106+Examples
107+--------
108+
109+ ~zod/try=> (qeu time)
110+ <1.qyo [* <1.sxx [a=<1.ebd [* <101.jzo 1.ypj %164>]> <101.jzo 1.ypj %164>]>]>
111+ ~zod/try=> (~(gas to *(qeu time)) [~2014.1.1 ~2014.1.2 ~])
112+ {~2014.1.2 ~2014.1.1}
113+
114+
115+
116+***
117+### `++set`
118+
119+Set
120+
121+[mold]() generator. A `++set` is a
122+[treap](http://en.wikipedia.org/wiki/Treap) with unique values.
123+
124+Source
125+------
126+
127+ ++ set |* a=_,* :: set
128+ $|(~ [n=a l=(set a) r=(set a)]) ::
129+
130+Examples
131+--------
132+
133+See also: [`++in`]()
134+
135+ ~zod/try=> (sa "abc")
136+ {~~a ~~c ~~b}
137+ ~zod/try=> (~(put in (sa "abc")) %d)
138+ {~~d ~~a ~~c ~~b}
139+ ~zod/try=> (~(put in (sa "abc")) %a)
140+ {~~a ~~c ~~b}
141+
142+
143+
144+***
docs/system/hoon/library/2p.mdnew file+224
@@ -0,0 +1,224 @@
1+## 2p: serialization
2+### `++cue`
3+
4+Unpack atom to noun
5+
6+Produces a noun unpacked from atom `a`. The inverse of jam.
7+
8+Accepts
9+-------
10+
11+`a` is an [atom]().
12+
13+Produces
14+--------
15+
16+A [`++noun`]().
17+
18+Source
19+------
20+
21+ ++ cue :: unpack atom to noun
22+ ~/ %cue
23+ |= a=@
24+ ^- *
25+ =+ b=0
26+ =+ m=`(map ,@ ,*)`~
27+ =< q
28+ |- ^- [p=@ q=* r=_m]
29+ ?: =(0 (cut 0 [b 1] a))
30+ =+ c=(rub +(b) a)
31+ [+(p.c) q.c (~(put by m) b q.c)]
32+ =+ c=(add 2 b)
33+ ?: =(0 (cut 0 [+(b) 1] a))
34+ =+ u=$(b c)
35+ =+ v=$(b (add p.u c), m r.u)
36+ =+ w=[q.u q.v]
37+ [(add 2 (add p.u p.v)) w (~(put by r.v) b w)]
38+ =+ d=(rub c a)
39+ [(add 2 p.d) (need (~(get by m) q.d)) m]
40+ ::
41+
42+
43+Examples
44+--------
45+
46+ ~zod/try=> (cue 12)
47+ 1
48+ ~zod/try=> (cue 817)
49+ [1 1]
50+ ~zod/try=> (cue 4.657)
51+ [1 2]
52+ ~zod/try=> (cue 39.689)
53+ [0 19]
54+
55+
56+***
57+### `++jam`
58+
59+Unpack noun to atom
60+
61+Produces an atom unpacked from noun `a`. The inverse of cue.
62+
63+Accepts
64+-------
65+
66+`a` is a [noun]().
67+
68+Produces
69+--------
70+
71+An atom.
72+
73+Source
74+------
75+
76+ ++ jam :: pack
77+ ~/ %jam
78+ |= a=*
79+ ^- @
80+ =+ b=0
81+ =+ m=`(map ,* ,@)`~
82+ =< q
83+ |- ^- [p=@ q=@ r=_m]
84+ =+ c=(~(get by m) a)
85+ ?~ c
86+ => .(m (~(put by m) a b))
87+ ?: ?=(@ a)
88+ =+ d=(mat a)
89+ [(add 1 p.d) (lsh 0 1 q.d) m]
90+ => .(b (add 2 b))
91+ =+ d=$(a -.a)
92+ =+ e=$(a +.a, b (add b p.d), m r.d)
93+ [(add 2 (add p.d p.e)) (mix 1 (lsh 0 2 (cat 0 q.d q.e))) r.e]
94+ ?: ?&(?=(@ a) (lte (met 0 a) (met 0 u.c)))
95+ =+ d=(mat a)
96+ [(add 1 p.d) (lsh 0 1 q.d) m]
97+ =+ d=(mat u.c)
98+ [(add 2 p.d) (mix 3 (lsh 0 2 q.d)) m]
99+ ::
100+
101+
102+Examples
103+--------
104+
105+ ~zod/try=> (jam 1)
106+ 12
107+ ~zod/try=> (jam [1 1])
108+ 817
109+ ~zod/try=> (jam [1 2])
110+ 4.657
111+ ~zod/try=> (jam [~ u=19])
112+ 39.689
113+
114+
115+
116+***
117+### `++mat`
118+
119+Length-encode
120+
121+Produces a cell whose tail `q` is atom `a` with a bit representation of
122+its length prepended to it (as the least significant bits). The head `p`
123+is the length of `q` in bits.
124+
125+Accepts
126+-------
127+
128+`a` is an atom.
129+
130+Produces
131+--------
132+
133+A cell of two atoms, `p` and `q`.
134+
135+Source
136+------
137+
138+ ++ mat :: length-encode
139+ ~/ %mat
140+ |= a=@
141+ ^- [p=@ q=@]
142+ ?: =(0 a)
143+ [1 1]
144+ =+ b=(met 0 a)
145+ =+ c=(met 0 b)
146+ :- (add (add c c) b)
147+ (cat 0 (bex c) (mix (end 0 (dec c) b) (lsh 0 (dec c) a)))
148+
149+
150+Examples
151+--------
152+
153+ ~zod/try=> (mat 0xaaa)
154+ [p=20 q=699.024]
155+ ~zod/try=> (met 0 q:(mat 0xaaa))
156+ 20
157+ ~zod/try=> `@ub`q:(mat 0xaaa)
158+ 0b1010.1010.1010.1001.0000
159+ ~zod/try=> =a =-(~&(- -) `@ub`0xaaa)
160+ 0b1010.1010.1010
161+ ~zod/try=> =b =-(~&(- -) `@ub`(xeb a))
162+ 0b1100
163+ ~zod/try=> =b =-(~&(- -) `@ub`(met 0 a))
164+ 0b1100
165+ ~zod/try=> =c =-(~&(- -) (xeb b))
166+ 4
167+ ~zod/try=> [`@ub`a `@ub`(end 0 (dec c) b) `@ub`(bex c)]
168+ [0b1010.1010.1010 0b100 0b1.0000]
169+
170+
171+
172+***
173+### `++rub`
174+
175+Length-decode
176+
177+The inverse of `++mat`. Accepts a cell of index `a` and a bitstring `b`
178+and produces the cell whose tail `q` is the decoded atom at index `a`
179+and whose head is the length of the encoded atom `q`, by which the
180+offset `a` is advanced. Only used internally as a helper cue.
181+
182+Accepts
183+-------
184+
185+`a` is an atom.
186+
187+`b` is a bitstring as an atom.
188+
189+Produces
190+--------
191+
192+A cell of two atoms, `p` and `q`.
193+
194+Source
195+------
196+
197+ ++ rub :: length-decode
198+ ~/ %rub
199+ |= [a=@ b=@]
200+ ^- [p=@ q=@]
201+ =+ ^= c
202+ =+ [c=0 m=(met 0 b)]
203+ |- ?< (gth c m)
204+ ?. =(0 (cut 0 [(add a c) 1] b))
205+ c
206+ $(c +(c))
207+ ?: =(0 c)
208+ [1 0]
209+ =+ d=(add a +(c))
210+ =+ e=(add (bex (dec c)) (cut 0 [d (dec c)] b))
211+ [(add (add c c) e) (cut 0 [(add d (dec c)) e] b)]
212+
213+
214+Examples
215+--------
216+
217+ ~zod/try=> `@ub`(jam 0xaaa)
218+ 0b1.0101.0101.0101.0010.0000
219+ ~zod/try=> (rub 1 0b1.0101.0101.0101.0010.0000)
220+ [p=20 q=2.730]
221+ ~zod/try=> `@ux`q:(rub 1 0b1.0101.0101.0101.0010.0000)
222+ 0xaaa
223+
224+***
docs/system/hoon/library/2q.mdnew file+276
@@ -0,0 +1,276 @@
1+## 2q: molds and mold builders
2+### `++char`
3+
4+Char
5+
6+A single character. [odor]() [`@tD`]() designates a single unicode byte. All
7+parsers consume [`++tape`]()s, which are lists of `++char`.
8+
9+
10+Source
11+------
12+
13+ ++ char ,@tD :: UTF-8 byte
14+
15+Examples
16+--------
17+
18+ ~zod/try=> *char
19+ ''
20+ ~zod/try> (char 97)
21+ 'a'
22+
23+
24+
25+***
26+### `++cord`
27+
28+UTF-8 text
29+
30+One of Hoon's two string types (the other being [`++tape`]()). A cord is an
31+atom of UTF-8 text. [`++trip`]() and [`++crip`]() convert between cord and
32+`++tape`.
33+
34+Source
35+------
36+
37+ ++ cord ,@t :: text atom (UTF-8)
38+
39+Examples
40+--------
41+
42+Odor [`@t`]() designates a Unicode atom, little-endian: the first character
43+in the text is the low byte.
44+
45+ ~zod/try=> `@ux`'foobar'
46+ 0x7261.626f.6f66
47+
48+ ~zod/try=> `@`'urbit'
49+ 499.984.265.845
50+ ~zod/try=> (cord 499.984.265.845)
51+ 'urbit'
52+
53+
54+
55+***
56+### `++date`
57+
58+Point in time
59+
60+A boolean designating AD or BC, a year atom, a month
61+atom, and a [`++tarp`](), which is a day atom and a time.
62+
63+Source
64+------
65+
66+ ++ date ,[[a=? y=@ud] m=@ud t=tarp] :: parsed date
67+
68+Examples
69+--------
70+
71+See also: [`++year`](), [`++yore`]() [`++stud`](), [`++dust`]()
72+
73+ ~zod/try=> `date`(yore ~2014.6.6..21.09.15..0a16)
74+ [[a=%.y y=2.014] m=6 t=[d=6 h=21 m=9 s=15 f=~[0xa16]]]
75+
76+
77+***
78+### `++tang`
79+
80+ ++ tang (list tank) :: general error
81+
82+Unused XX
83+
84+
85+
86+***
87+### `++tank`
88+
89+Pretty-printing structure.
90+
91+A `++tank` is one of three cases: a `%leaf`
92+is simply a string; a `%palm` is XX need more information; and a `%rose` is a
93+list of `++tank` delimted by the strings in `p`.
94+
95+
96+Source
97+------
98+
99+ ++ tank $% [%leaf p=tape] :: printing formats
100+ $: %palm :: backstep list
101+ p=[p=tape q=tape r=tape s=tape] ::
102+ q=(list tank) ::
103+ == ::
104+ $: %rose :: flat list
105+ p=[p=tape q=tape r=tape] :: mid open close
106+ q=(list tank) ::
107+ == ::
108+ ==
109+
110+Examples
111+--------
112+
113+ ~zod/try=> >(bex 20) (bex 19)<
114+ [%rose p=[p=" " q="[" r="]"] q=~[[%leaf p="1.048.576"] [%leaf p="524.288"]]]
115+ ~zod/try=> (wash [0 80] >(bex 20) (bex 19)<) :: at 80 cols
116+ <<"[1.048.576 524.288]">>
117+ ~zod/try=> (wash [0 15] >(bex 20) (bex 19)<) :: at 15 cols (two lines)
118+ <<"[ 1.048.576" " 524.288" "]">>
119+
120+ ~zod/try=> [(bex 150) (bex 151)] :: at 80 cols
121+ [ 1.427.247.692.705.959.881.058.285.969.449.495.136.382.746.624
122+ 2.854.495.385.411.919.762.116.571.938.898.990.272.765.493.248
123+ ]
124+
125+
126+
127+***
128+
129+### `++tape`
130+
131+List of chars
132+
133+One of Hoon's two string types, the other being [`++cord`](). A tape is a
134+list of chars.
135+
136+Source
137+------
138+
139+ ++ tape (list char) :: like a string
140+
141+Examples
142+--------
143+
144+ ~zod/try=> `(list ,char)`"foobar"
145+ "foobar"
146+ ~zod/try=> `(list ,@)`"foobar"
147+ ~[102 111 111 98 97 114]
148+
149+
150+***
151+### `++tarp`
152+
153+Day through second
154+
155+The remaining part of a [`++date`](): day, hour, minute, second and a list
156+of [`@ux`]() for precision.
157+
158+Source
159+------
160+
161+ @ud h=@ud m=@ud s=@ud f=(list ,@ux)] :: parsed time
162+
163+Examples
164+--------
165+
166+See also: [`++date`](), [`++yell`[]()/`++yule`]()
167+
168+ ~zod/try=> -<-
169+ ~2014.9.20..00.43.33..b52a
170+ ~zod/try=> :: the time is always in your context at -<-
171+ ~zod/try=> (yell -<-)
172+ [d=106.751.991.820.278 h=0 m=43 s=39 f=~[0x54d1]]
173+
174+ ~zod/try=> (yell ~d20)
175+ [d=20 h=0 m=0 s=0 f=~]
176+
177+
178+
179+***
180+### `++term`
181+
182+Hoon constants
183+
184+A restricted text atom for Hoon constants. The only characters permitted are
185+lowercase ASCII, `-`, and `0-9`, the latter two of which can neither be the first or last
186+character. The syntax for [`@tas`]() is the text itself, always preceded by `%`.
187+This means a term is always [cubical](). The empty `@tas` has a special syntax,
188+`$`.
189+
190+
191+Source
192+------
193+
194+ ++ term ,@tas :: Hoon ASCII subset
195+
196+Examples
197+--------
198+
199+ ~zod/try=> *term
200+ %$
201+
202+ ~zod/try=> %dead-fish9
203+ %dead-fish9
204+ ~zod/try=> -:!>(%dead-fish9)
205+ [%cube p=271.101.667.197.767.630.546.276 q=[%atom p=%tas]]
206+
207+
208+
209+***
210+### `++wain`
211+
212+ ++ wain (list cord) :: text lines (no \n)
213+
214+A list of lines. A `++wain` is used instead of a single [`++cord`]() with
215+`\n`.
216+
217+See also: [`++lore`](), [`++role`]()
218+
219+ ~zod/try=> `wain`/som/del/rok
220+ <|som del rok|>
221+ ~zod/try=> `wain`(lore ^:@t/=main=/bin/tree/hoon)
222+ <|
223+ !:
224+ :: /===/bin/tree/hoon
225+ |= ^
226+ |= [pax=path fla=$|(~ [%full ~])]
227+ =- ~[te/-]~
228+ =+ len=(lent pax)
229+ =+ rend=?~(fla |=(a=path +:(spud (slag len a))) spud)
230+ |- ^- wain
231+ =+ ark=;;(arch .^(cy/pax))
232+ =- ?~ q.ark -
233+ [(crip (rend pax)) -]
234+ %- zing
235+ %- turn :_ |=(a=@t ^$(pax (weld pax `path`/[a])))
236+ %- sort :_ aor
237+ %- turn :_ |=([a=@t ~] a)
238+ (~(tap by r.ark))
239+ |>
240+
241+
242+
243+***
244+### `++wall`
245+
246+List of lines
247+
248+
249+A `++wall` is used instead of a single [`++tape`]() with
250+`\n`.
251+
252+Source
253+------
254+
255+ ++ wall (list tape) :: text lines (no \n)
256+
257+Examples
258+--------
259+
260+See also: [`++wash`]()
261+
262+ ~zod/try=> `wall`(wash [0 20] leaf/<(bex 256)>)
263+ <<
264+ "\/115.792.089.237.\/"
265+ " 316.195.423.570."
266+ " 985.008.687.907."
267+ " 853.269.984.665."
268+ " 640.564.039.457."
269+ " 584.007.913.129."
270+ " 639.936"
271+ "\/ \/"
272+ >>
273+
274+
275+
276+***
docs/system/hoon/library/3a.mdnew file+940
@@ -0,0 +1,940 @@
1+## 3a: signed and modular ints
2+### `++egcd`
3+
4+GCD
5+
6+ ++ egcd :: schneier's egcd
7+ |= [a=@ b=@]
8+ =+ si
9+ =+ [c=(sun a) d=(sun b)]
10+ =+ [u=[c=(sun 1) d=--0] v=[c=--0 d=(sun 1)]]
11+ |- ^- [d=@ u=@ v=@]
12+ ?: =(--0 c)
13+ [(abs d) d.u d.v]
14+ :: ?> ?& =(c (sum (pro (sun a) c.u) (pro (sun b) c.v)))
15+ :: =(d (sum (pro (sun a) d.u) (pro (sun b) d.v)))
16+ :: ==
17+ =+ q=(fra d c)
18+ %= $
19+ c (dif d (pro q c))
20+ d c
21+ u [(dif d.u (pro q c.u)) c.u]
22+ v [(dif d.v (pro q c.v)) c.v]
23+ ==
24+ ::
25+
26+Greatest common denominator
27+
28+ ~zod/try=> (egcd 20 15)
29+ [d=5 u=2 v=1]
30+ ~zod/try=> (egcd 24 16)
31+ [d=8 u=2 v=1]
32+ ~zod/try=> (egcd 7 5)
33+ [d=1 u=3 v=6]
34+ ~zod/try=> (egcd (shaf ~ %ham) (shaf ~ %sam))
35+ [ d=1
36+ u=59.983.396.314.566.203.239.184.568.129.921.874.787
37+ v=38.716.650.351.034.402.960.165.718.823.532.275.722
38+ ]
39+
40+
41+
42+***
43+### `++fe` :: modulo bloq
44+
45+Modulo bloq
46+
47+Core containing XX
48+
49+Accepts
50+-------
51+
52+`a` is a [`++bloq`]().
53+
54+Source
55+------
56+
57+ |_ a=bloq
58+
59+### `++dif`
60+
61+Produces the difference between two [atom]()s in the modular basis
62+representation.
63+
64+Accepts
65+-------
66+
67+`a` is a [`++bloq`]().
68+
69+`b` is an atom.
70+
71+`c` is an atom.
72+
73+Produces
74+--------
75+
76+A [`@s`]()
77+
78+Source
79+------
80+
81+ ++ dif |=([b=@ c=@] (sit (sub (add out (sit b)) (sit c))))
82+
83+Examples
84+--------
85+
86+ ~zod/try=> (~(dif fe 3) 63 64)
87+ 255
88+ ~zod/try=> (~(dif fe 3) 5 10)
89+ 251
90+ ~zod/try=> (~(dif fe 3) 0 1)
91+ 255
92+ ~zod/try=> (~(dif fe 0) 9 10)
93+ 1
94+ ~zod/try=> (~(dif fe 0) 9 11)
95+ 0
96+ ~zod/try=> (~(dif fe 0) 9 12)
97+ 1
98+ ~zod/try=> (~(dif fe 2) 9 12)
99+ 13
100+ ~zod/try=> (~(dif fe 2) 63 64)
101+ 15
102+
103+------------------------------------------------------------------------
104+
105+### `++inv`
106+
107+Invert mod field
108+
109+Inverts the order of the modular field.
110+
111+Accepts
112+-------
113+
114+`b` is a [`++bloq`]().
115+
116+Produces
117+--------
118+
119+An atom.
120+
121+
122+Source
123+------
124+
125+ ++ inv |=(b=@ (sub (dec out) (sit b)))
126+
127+Examples
128+--------
129+
130+ ~zod/try=> (~(inv fe 3) 255)
131+ 0
132+ ~zod/try=> (~(inv fe 3) 256)
133+ 255
134+ ~zod/try=> (~(inv fe 3) 0)
135+ 255
136+ ~zod/try=> (~(inv fe 3) 1)
137+ 254
138+ ~zod/try=> (~(inv fe 3) 2)
139+ 253
140+ ~zod/try=> (~(inv fe 3) 55)
141+ 200
142+
143+------------------------------------------------------------------------
144+
145+### `++net`
146+
147+Reverse bytes
148+
149+Revereses bytes within block.
150+
151+Accepts
152+-------
153+
154+`b` is a [`++bloq`]().
155+
156+Produces
157+--------
158+
159+An atom.=
160+
161+Source
162+------
163+
164+ ++ net |= b=@ ^- @
165+ => .(b (sit b))
166+ ?: (lte a 3)
167+ b
168+ =+ c=(dec a)
169+ %+ con
170+ (lsh c 1 $(a c, b (cut c [0 1] b)))
171+ $(a c, b (cut c [1 1] b))
172+
173+Examples
174+--------
175+
176+ ~zod/try=> (~(net fe 3) 64)
177+ 64
178+ ~zod/try=> (~(net fe 3) 128)
179+ 128
180+ ~zod/try=> (~(net fe 3) 255)
181+ 255
182+ ~zod/try=> (~(net fe 3) 256)
183+ 0
184+ ~zod/try=> (~(net fe 3) 257)
185+ 1
186+ ~zod/try=> (~(net fe 3) 500)
187+ 244
188+ ~zod/try=> (~(net fe 3) 511)
189+ 255
190+ ~zod/try=> (~(net fe 3) 512)
191+ 0
192+ ~zod/try=> (~(net fe 3) 513)
193+ 1
194+ ~zod/try=> (~(net fe 3) 0)
195+ 0
196+ ~zod/try=> (~(net fe 3) 1)
197+ 1
198+ ~zod/try=> (~(net fe 0) 1)
199+ 1
200+ ~zod/try=> (~(net fe 0) 2)
201+ 0
202+ ~zod/try=> (~(net fe 0) 3)
203+ 1
204+ ~zod/try=> (~(net fe 6) 1)
205+ 72.057.594.037.927.936
206+ ~zod/try=> (~(net fe 6) 2)
207+ 144.115.188.075.855.872
208+ ~zod/try=> (~(net fe 6) 3)
209+ 216.172.782.113.783.808
210+ ~zod/try=> (~(net fe 6) 4)
211+ 288.230.376.151.711.744
212+ ~zod/try=> (~(net fe 6) 5)
213+ 360.287.970.189.639.680
214+ ~zod/try=> (~(net fe 6) 6)
215+ 432.345.564.227.567.616
216+ ~zod/try=> (~(net fe 6) 7)
217+ 504.403.158.265.495.552
218+ ~zod/try=> (~(net fe 6) 512)
219+ 562.949.953.421.312
220+ ~zod/try=> (~(net fe 6) 513)
221+ 72.620.543.991.349.248
222+
223+------------------------------------------------------------------------
224+
225+### `++out`
226+
227+Max integer value
228+
229+The maximum integer value that the current block can store.
230+
231+Accepts
232+-------
233+
234+A [`++bloq`]().
235+
236+Produces
237+--------
238+
239+An [atom]().
240+
241+Source
242+------
243+
244+ ++ out (bex (bex a))
245+
246+Examples
247+--------
248+
249+ ~zod/try=> ~(out fe 0)
250+ 2
251+ ~zod/try=> ~(out fe 1)
252+ 4
253+ ~zod/try=> ~(out fe 2)
254+ 16
255+ ~zod/try=> ~(out fe 3)
256+ 256
257+ ~zod/try=> ~(out fe 4)
258+ 65.536
259+ ~zod/try=> ~(out fe 10)
260+ \/179.769.313.486.231.590.772.930.519.078.902.473.361.797.697.894.230.657.\/
261+ 273.430.081.157.732.675.805.500.963.132.708.477.322.407.536.021.120.113.
262+ 879.871.393.357.658.789.768.814.416.622.492.847.430.639.474.124.377.767.
263+ 893.424.865.485.276.302.219.601.246.094.119.453.082.952.085.005.768.838.
264+ 150.682.342.462.881.473.913.110.540.827.237.163.350.510.684.586.298.239.
265+ 947.245.938.479.716.304.835.356.329.624.224.137.216
266+ \/ \/
267+
268+------------------------------------------------------------------------
269+
270+### `++rol`
271+
272+Roll left
273+
274+Roll `d` to the left by `c` `b`-sized blocks.
275+
276+Accepts
277+-------
278+
279+`a` is a [`++bloq`]().
280+
281+`b` is a `++bloq`.
282+
283+`c` is an atom.
284+
285+`d` is an atom.
286+
287+Produces
288+--------
289+
290+An atom.
291+
292+Source
293+------
294+
295+ ++ rol |= [b=bloq c=@ d=@] ^- @ :: roll left
296+ =+ e=(sit d)
297+ =+ f=(bex (sub a b))
298+ =+ g=(mod c f)
299+ (sit (con (lsh b g e) (rsh b (sub f g) e)))
300+
301+Examples
302+--------
303+
304+ ~zod/try=> `@ux`(~(rol fe 6) 4 3 0xabac.dedf.1213)
305+ 0x1213.0000.abac.dedf
306+ ~zod/try=> `@ux`(~(rol fe 6) 4 2 0xabac.dedf.1213)
307+ 0xdedf.1213.0000.abac
308+ ~zod/try=> `@t`(~(rol fe 5) 3 1 'dfgh')
309+ 'hdfg'
310+ ~zod/try=> `@t`(~(rol fe 5) 3 2 'dfgh')
311+ 'ghdf'
312+ ~zod/try=> `@t`(~(rol fe 5) 3 0 'dfgh')
313+ 'dfgh'
314+
315+------------------------------------------------------------------------
316+
317+### `++ror`
318+
319+Roll right
320+
321+Roll `d` to the right by `c` `b`-sized blocks.
322+
323+Accepts
324+-------
325+
326+`a` is a [`++bloq`]().
327+
328+`b` is a `++bloq`.
329+
330+`c` is an [atom]().
331+
332+`d` is an atom.
333+
334+Produces
335+--------
336+
337+An atom.
338+
339+Source
340+------
341+
342+ ++ ror |= [b=bloq c=@ d=@] ^- @ :: roll right
343+ =+ e=(sit d)
344+ =+ f=(bex (sub a b))
345+ =+ g=(mod c f)
346+ (sit (con (rsh b g e) (lsh b (sub f g) e)))
347+
348+Examples
349+--------
350+
351+ ~zod/try=> `@ux`(~(ror fe 6) 4 1 0xabac.dedf.1213)
352+ 0x1213.0000.abac.dedf
353+ ~zod/try=> `@ux`(~(ror fe 6) 3 5 0xabac.dedf.1213)
354+ 0xacde.df12.1300.00ab
355+ ~zod/try=> `@ux`(~(ror fe 6) 3 3 0xabac.dedf.1213)
356+ 0xdf12.1300.00ab.acde
357+ ~zod/try=> `@t`(~(rol fe 5) 3 0 'hijk')
358+ 'hijk'
359+ ~zod/try=> `@t`(~(rol fe 5) 3 1 'hijk')
360+ 'khij'
361+ ~zod/try=> `@t`(~(rol fe 5) 3 2 'hijk')
362+ 'jkhi'
363+
364+------------------------------------------------------------------------
365+
366+### `++sum`
367+
368+Sum
369+
370+Sum two numbers in this modular field.
371+
372+Accepts
373+-------
374+
375+`a` is a [`++bloq`]().
376+
377+`b` is an [atom]().
378+
379+`c` is an atom.
380+
381+Produces
382+--------
383+
384+An atom.
385+
386+Source
387+------
388+
389+ ++ sum |=([b=@ c=@] (sit (add b c))) :: wrapping add
390+
391+Examples
392+--------
393+
394+ ~zod/try=> (~(sum fe 3) 10 250)
395+ 4
396+ ~zod/try=> (~(sum fe 0) 0 1)
397+ 1
398+ ~zod/try=> (~(sum fe 0) 0 2)
399+ 0
400+ ~zod/try=> (~(sum fe 2) 14 2)
401+ 0
402+ ~zod/try=> (~(sum fe 2) 14 3)
403+ 1
404+ ~zod/try=> (~(sum fe 4) 10.000 256)
405+ 10.256
406+ ~zod/try=> (~(sum fe 4) 10.000 100.000)
407+ 44.464
408+
409+### `++sit`
410+
411+Atom in mod block representation
412+
413+Produce an [atom]() in the current modular block representation.
414+
415+Accepts
416+-------
417+
418+`a` is a [`++bloq`]().
419+
420+`b` is an atom.
421+
422+Produces
423+--------
424+
425+An atom.
426+
427+Source
428+------
429+
430+ ++ sit |=(b=@ (end a 1 b)) :: enforce modulo
431+
432+Examples
433+--------
434+
435+ ~zod/try=> (~(sit fe 3) 255)
436+ 255
437+ ~zod/try=> (~(sit fe 3) 256)
438+ 0
439+ ~zod/try=> (~(sit fe 3) 257)
440+ 1
441+ ~zod/try=> (~(sit fe 2) 257)
442+ 1
443+ ~zod/try=> (~(sit fe 2) 10.000)
444+ 0
445+ ~zod/try=> (~(sit fe 2) 100)
446+ 4
447+ ~zod/try=> (~(sit fe 2) 19)
448+ 3
449+ ~zod/try=> (~(sit fe 2) 17)
450+ 1
451+ ~zod/try=> (~(sit fe 0) 17)
452+ 1
453+ ~zod/try=> (~(sit fe 0) 0)
454+ 0
455+ ~zod/try=> (~(sit fe 0) 1)
456+ 1
457+
458+
459+
460+***
461+### `++si`
462+
463+ ++ si !: :: signed integer
464+ |%
465+
466+Container core for the signed integer functions.
467+
468+------------------------------------------------------------------------
469+
470+### `++abs`
471+
472+Absolute value
473+
474+Produces the absolute value of a signed integer.
475+
476+Accepts
477+-------
478+
479+`a` is a signed integer, [`@s`]().
480+
481+Produces
482+--------
483+
484+An [atom]().
485+
486+Source
487+------
488+
489+ ++ abs |=(a=@s (add (end 0 1 a) (rsh 0 1 a))) :: absolute value
490+
491+Examples
492+--------
493+
494+ ~zod/try=> (abs:si -2)
495+ 2
496+ ~zod/try=> (abs:si -10.000)
497+ 10.000
498+ ~zod/try=> (abs:si --2)
499+ 2
500+
501+------------------------------------------------------------------------
502+
503+### `++dif`
504+
505+Difference
506+
507+Produces the difference between two signed integers `b` and `c`.
508+
509+Accepts
510+-------
511+
512+`a` is a signed integer, [`@s`]().
513+
514+`b` is a signed integer, `@s`.
515+
516+Produces
517+--------
518+
519+A [`@s`]().
520+
521+
522+Source
523+------
524+
525+ ++ dif |= [a=@s b=@s] :: subtraction
526+ (sum a (new !(syn b) (abs b)))
527+
528+Examples
529+--------
530+
531+ ~zod/try=> (dif:si --10 -7)
532+ --17
533+ ~zod/try=> (dif:si --10 --7)
534+ --3
535+ ~zod/try=> (dif:si `@s`0 --7)
536+ -7
537+ ~zod/try=> (dif:si `@s`0 `@s`7)
538+ --4
539+
540+------------------------------------------------------------------------
541+
542+### `++dul`
543+
544+Modulus
545+
546+Produces the modulus of two signed integers.
547+
548+Accepts
549+-------
550+
551+`a` is a signed integer, `@s`.
552+
553+`b` is an [atom]().
554+
555+Produces
556+--------
557+
558+An atom.
559+
560+Source
561+------
562+
563+ ++ dul |= [a=@s b=@] :: modulus
564+ =+(c=(old a) ?:(-.c (mod +.c b) (sub b +.c)))
565+
566+Examples
567+--------
568+
569+ ~zod/try=> (dul:si --9 3)
570+ 0
571+ ~zod/try=> (dul:si --9 4)
572+ 1
573+ ~zod/try=> (dul:si --9 5)
574+ 4
575+ ~zod/try=> (dul:si --9 6)
576+ 3
577+ ~zod/try=> (dul:si --90 --10)
578+ 10
579+
580+------------------------------------------------------------------------
581+
582+### `++fra`
583+
584+Divide
585+
586+Produces the quotient of two signed integers.
587+
588+Accepts
589+-------
590+
591+`a` is a signed integer, [`@s`].
592+
593+`b` is a signed integer, `@s`.
594+
595+Produces
596+--------
597+
598+An [atom]().
599+
600+Source
601+------
602+
603+ ++ fra |= [a=@s b=@s] :: divide
604+ (new =(0 (mix (syn a) (syn b))) (div (abs a) (abs b)))
605+
606+Examples
607+--------
608+
609+ ~zod/try=> (fra:si --10 -2)
610+ -5
611+ ~zod/try=> (fra:si -20 -5)
612+ --4
613+
614+------------------------------------------------------------------------
615+
616+### `++new`
617+
618+Signed integer
619+
620+Produces a signed integer from a loobean sign value `a` and an [atom]() `b`.
621+
622+Accepts
623+-------
624+
625+`a` is a loobean.
626+
627+`b` is an atom.
628+
629+Produces
630+--------
631+
632+A [`@s`]()
633+
634+Source
635+------
636+
637+ ++ new |= [a=? b=@] :: [sign value] to @s
638+ `@s`?:(a (mul 2 b) ?:(=(0 b) 0 +((mul 2 (dec b)))))
639+
640+Examples
641+--------
642+
643+ ~zod/try=> (new:si [& 10])
644+ --10
645+ ~zod/try=> (new:si [| 10])
646+ -10
647+ ~zod/try=> (new:si [%.y 7])
648+ --7
649+
650+------------------------------------------------------------------------
651+
652+### `++old`
653+
654+[sign value]
655+
656+Produces the cell `[sign value]` representations of a signed integer.
657+
658+Accepts
659+-------
660+
661+`a` is a [`@s`]().
662+
663+Produces
664+--------
665+
666+A cell of a boolean and an [atom]().
667+
668+Source
669+------
670+
671+ ++ old |=(a=@s [(syn a) (abs a)]) :: [sign value]
672+
673+Examples
674+--------
675+
676+ ~zod/try=> (old:si 7)
677+ ! type-fail
678+ ! exit
679+ ~zod/try=> (old:si -7)
680+ [%.n 7]
681+ ~zod/try=> (old:si --7)
682+ [%.y 7]
683+ ~zod/try=> (old:si `@s`7)
684+ [%.n 4]
685+ ~zod/try=> (old:si -0)
686+ [%.y 0]
687+
688+------------------------------------------------------------------------
689+
690+### `++pro`
691+
692+Multiply
693+
694+Produces the product of two signed integers.
695+
696+Accepts
697+-------
698+
699+`a` is a [`@s`]().
700+
701+`b` is a `@s`.
702+
703+Produces
704+--------
705+
706+A `@s`.
707+
708+Source
709+------
710+
711+ ++ pro |= [a=@s b=@s] :: multiplication
712+ (new =(0 (mix (syn a) (syn b))) (mul (abs a) (abs b)))
713+
714+Examples
715+--------
716+
717+ ~zod/try=> (pro:si -4 --2)
718+ -8
719+ ~zod/try=> (pro:si -4 -2)
720+ --8
721+ ~zod/try=> (pro:si --10.000.000 -10)
722+ -100.000.000
723+ ~zod/try=> (pro:si -1.337 --0)
724+ --0
725+
726+------------------------------------------------------------------------
727+
728+### `++rem`
729+
730+Remainder
731+
732+Produces the remainder from a division of two signed integers.
733+
734+Accepts
735+-------
736+
737+`a` is a [`@s`]().
738+
739+`b` is a `@s`.
740+
741+Produces
742+--------
743+
744+A `@sd`.
745+
746+Source
747+------
748+
749+ ++ rem |=([a=@s b=@s] (dif a (pro b (fra a b)))) :: remainder
750+
751+Examples
752+--------
753+
754+ ~zod/try=> (rem:si -10 -4)
755+ -2
756+ ~zod/try=> (rem:si --10 --4)
757+ --2
758+ ~zod/try=> (rem:si --10 -4)
759+ --2
760+ ~zod/try=> (rem:si --7 --3)
761+ --1
762+ ~zod/try=> (rem:si --0 --10.000)
763+ --0
764+
765+------------------------------------------------------------------------
766+
767+### `++sum`
768+
769+Add
770+
771+Sum two signed integers.
772+
773+Accepts
774+-------
775+
776+`b` is a [`@s`]().
777+
778+`c` is a signed integer `@s`.
779+
780+Produces
781+--------
782+
783+A `@s`.
784+
785+Source
786+------
787+
788+ ++ sum |= [a=@s b=@s] :: addition
789+ ~| %si-sum
790+ =+ [c=(old a) d=(old b)]
791+ ?: -.c
792+ ?: -.d
793+ (new & (add +.c +.d))
794+ ?: (gte +.c +.d)
795+ (new & (sub +.c +.d))
796+ (new | (sub +.d +.c))
797+ ?: -.d
798+ ?: (gte +.c +.d)
799+ (new | (sub +.c +.d))
800+ (new & (sub +.d +.c))
801+ (new | (add +.c +.d))
802+
803+Examples
804+--------
805+
806+ ~zod/try=> (sum:si --10 --10)
807+ --20
808+ ~zod/try=> (sum:si --10 -0)
809+ --10
810+ ~zod/try=> (sum:si -10 -7)
811+ -17
812+ ~zod/try=> (sum:si -10 --7)
813+ -3
814+
815+------------------------------------------------------------------------
816+
817+### `++sun`
818+
819+Signed from unsigned
820+
821+Produces a signed integer from an unsigned integer.
822+
823+Note that the result must be manually cast to some [`@s`]() odor to be
824+inferred as an unsigned integer in the type system.
825+
826+Accepts
827+-------
828+
829+`a` is a [`@u`]().
830+
831+Produces
832+--------
833+
834+A [`@s`]().
835+
836+Source
837+------
838+
839+ ++ sun |=(a=@u (mul 2 a)) :: @u to @s
840+
841+Examples
842+--------
843+
844+ ~zod/try=> `@s`10
845+ --5
846+ ~zod/try=> (sun:si 10)
847+ 20
848+ ~zod/try=> `@s`(sun:si 10)
849+ --10
850+ ~zod/try=> `@sd`(sun:si 10)
851+ --10
852+ ~zod/try=> `@sd`(sun:si 12.345)
853+ --12.345
854+
855+------------------------------------------------------------------------
856+
857+### `++syn`
858+
859+Sign
860+
861+Produce the sign of a signed integer, where `&` is posiitve, and `|` is negative.
862+
863+Accepts
864+-------
865+
866+`a` is a [`@s`]().
867+
868+Produces
869+--------
870+
871+A boolean.
872+
873+Source
874+------
875+
876+ ++ syn |=(a=@s =(0 (end 0 1 a))) :: sign test
877+
878+Examples
879+--------
880+
881+ ~zod/try=> (syn:si -2)
882+ %.n
883+ ~zod/try=> (syn:si --2)
884+ %.y
885+ ~zod/try=> (syn:si -0)
886+ %.y
887+
888+------------------------------------------------------------------------
889+
890+### `++cmp`
891+
892+Compare
893+
894+Compare two signed integers.
895+
896+Accepts
897+-------
898+
899+`b` is a [`@s`]().
900+
901+`c` is a `@s`.
902+
903+Produces
904+--------
905+
906+A `@s`.
907+
908+Source
909+------
910+
911+ ++ cmp |= [a=@s b=@s] :: compare
912+ ^- @s
913+ ?: =(a b)
914+ --0
915+ ?: (syn a)
916+ ?: (syn b)
917+ ?: (gth a b)
918+ --1
919+ -1
920+ --1
921+ ?: (syn b)
922+ -1
923+ ?: (gth a b)
924+ -1
925+ --1
926+
927+Examples
928+--------
929+
930+ ~zod/try=> (cmp:si --10 --10)
931+ --0
932+ ~zod/try=> (cmp:si --10 -0)
933+ --1
934+ ~zod/try=> (cmp:si -10 -7)
935+ -1
936+ ~zod/try=> (cmp:si -10 --7)
937+ -1
938+
939+
940+***
docs/system/hoon/library/3b.mdnew file+1
@@ -0,0 +1 @@
1+## 3b: floating point
docs/system/hoon/library/3c.mdnew file+588
@@ -0,0 +1,588 @@
1+## 3c: urbit time
2+### `++yall`
3+
4+Time since beginning of time
5+
6+Produce the date tuple of `[y=@ud m=@ud d=@ud]` of the year, month, and
7+day from a number of days from the beginning of time.
8+
9+Accepts
10+-------
11+
12+`day` is a [`@ud`]()
13+
14+Produces
15+--------
16+
17+
18+Source
19+------
20+
21+ ++ yall :: day # to day of year
22+ |= day=@ud
23+ ^- [y=@ud m=@ud d=@ud]
24+ =+ [era=0 cet=0 lep=_?]
25+ => .(era (div day era:yo), day (mod day era:yo))
26+ => ^+ .
27+ ?: (lth day +(cet:yo))
28+ .(lep &, cet 0)
29+ => .(lep |, cet 1, day (sub day +(cet:yo)))
30+ .(cet (add cet (div day cet:yo)), day (mod day cet:yo))
31+ =+ yer=(add (mul 400 era) (mul 100 cet))
32+ |- ^- [y=@ud m=@ud d=@ud]
33+ =+ dis=?:(lep 366 365)
34+ ?. (lth day dis)
35+ =+ ner=+(yer)
36+ $(yer ner, day (sub day dis), lep =(0 (end 0 2 ner)))
37+ |- ^- [y=@ud m=@ud d=@ud]
38+ =+ [mot=0 cah=?:(lep moy:yo moh:yo)]
39+ |- ^- [y=@ud m=@ud d=@ud]
40+ =+ zis=(snag mot cah)
41+ ?: (lth day zis)
42+ [yer +(mot) +(day)]
43+ $(mot +(mot), day (sub day zis))
44+
45+Examples
46+--------
47+
48+ ~zod/try=> (yall 198)
49+ [y=0 m=7 d=17]
50+ ~zod/try=> (yall 90.398)
51+ [y=247 m=7 d=3]
52+ ~zod/try=> (yall 0)
53+ [y=0 m=1 d=1]
54+
55+
56+
57+***
58+### `++yawn`
59+
60+Days since beginning of time
61+
62+Inverse of `yall`, computes number of days A.D. from y/m/d date as the
63+tuple `[yer=@ud mot=@ud day=@ud]`.
64+
65+Accepts
66+-------
67+
68+`yer` is an unsigned decimal, `@ud`.
69+
70+`mon` is an unsigned decimal, `@ud`.
71+
72+`day` is an unsigned decimal, `@ud`.
73+
74+Produces
75+--------
76+
77+A [`@ud`]().
78+
79+Source
80+------
81+
82+ ++ yawn :: days since Jesus
83+ |= [yer=@ud mot=@ud day=@ud]
84+ ^- @ud
85+ => .(mot (dec mot), day (dec day))
86+ => ^+ .
87+ %= .
88+ day
89+ =+ cah=?:((yelp yer) moy:yo moh:yo)
90+ |- ^- @ud
91+ ?: =(0 mot)
92+ day
93+ $(mot (dec mot), cah (slag 1 cah), day (add day (snag 0 cah)))
94+ ==
95+ |- ^- @ud
96+ ?. =(0 (mod yer 4))
97+ =+ ney=(dec yer)
98+ $(yer ney, day (add day ?:((yelp ney) 366 365)))
99+ ?. =(0 (mod yer 100))
100+ =+ nef=(sub yer 4)
101+ $(yer nef, day (add day ?:((yelp nef) 1.461 1.460)))
102+ ?. =(0 (mod yer 400))
103+ =+ nec=(sub yer 100)
104+ $(yer nec, day (add day ?:((yelp nec) 36.525 36.524)))
105+ (add day (mul (div yer 400) (add 1 (mul 4 36.524))))
106+
107+Examples
108+--------
109+
110+ ~zod/try=> (yawn 2.014 8 4)
111+ 735.814
112+ ~zod/try=> (yawn 1.776 7 4)
113+ 648.856
114+ ~zod/try=> (yawn 1.990 10 11)
115+ 727.116
116+
117+
118+
119+***
120+### `++year`
121+
122+Accept a parsed date of form `[[a=? y=@ud] m=@ud t=tarp]` and produce
123+its `@d`representation.
124+
125+Accepts
126+-------
127+
128+`det` is a [`++date`]()
129+
130+Produces
131+--------
132+
133+A [`@d`]().
134+
135+Source
136+------
137+
138+ ++ year :: date to @d
139+ |= det=date
140+ ^- @d
141+ =+ ^= yer
142+ ?: a.det
143+ (add 292.277.024.400 y.det)
144+ (sub 292.277.024.400 (dec y.det))
145+ =+ day=(yawn yer m.det d.t.det)
146+ (yule day h.t.det m.t.det s.t.det f.t.det)
147+
148+Examples
149+--------
150+
151+ ~zod/try=> (year [[a=%.y y=2.014] m=8 t=[d=4 h=20 m=4 s=57 f=~[0xd940]]])
152+ 0x8000000d227df4e9d940000000000000
153+
154+
155+
156+***
157+### `++yell`
158+
159+Produce a parsed daily time format from an atomic date.
160+
161+`now` is a `@d`.
162+
163+Source
164+------
165+
166+ ++ yell :: tarp from @d
167+ |= now=@d
168+ ^- tarp
169+ =+ sec=(rsh 6 1 now)
170+ =+ ^= fan
171+ =+ [muc=4 raw=(end 6 1 now)]
172+ |- ^- (list ,@ux)
173+ ?: |(=(0 raw) =(0 muc))
174+ ~
175+ => .(muc (dec muc))
176+ [(cut 4 [muc 1] raw) $(raw (end 4 muc raw))]
177+ =+ day=(div sec day:yo)
178+ => .(sec (mod sec day:yo))
179+ =+ hor=(div sec hor:yo)
180+ => .(sec (mod sec hor:yo))
181+ =+ mit=(div sec mit:yo)
182+ => .(sec (mod sec mit:yo))
183+ [day hor mit sec fan]
184+
185+Examples
186+--------
187+
188+ ~zod/try=> (yell ~2014.3.20..05.42.53..7456)
189+ [d=106.751.991.820.094 h=5 m=42 s=53 f=~[0x7456]]
190+ ~zod/try=> (yell ~2014.6.9..19.09.40..8b66)
191+ [d=106.751.991.820.175 h=19 m=9 s=40 f=~[0x8b66]]
192+ ~zod/try=> (yell ~1776.7.4)
193+ [d=106.751.991.733.273 h=0 m=0 s=0 f=~]
194+
195+
196+***
197+### `++yelp`
198+
199+Leap-week?
200+
201+Determines whether a year contains an ISO 8601 leap week. Produces a
202+loobean.
203+
204+Accepts
205+-------
206+
207+`yer` is an unsigned decimal, `@ud`.
208+
209+Produces
210+--------
211+
212+A boolean.
213+
214+Source
215+------
216+
217+ ++ yelp :: leap year
218+ |= yer=@ud ^- ?
219+ &(=(0 (mod yer 4)) |(!=(0 (mod yer 100)) =(0 (mod yer 400))))
220+
221+Examples
222+--------
223+
224+ ~zod/try=> (yelp 2.014)
225+ %.n
226+ ~zod/try=> (yelp 2.008)
227+ %.y
228+ ~zod/try=> (yelp 0)
229+ %.y
230+ ~zod/try=> (yelp 14.011)
231+ %.n
232+
233+
234+
235+***
236+### `++yore`
237+
238+Produces a `++date` from a `@d`
239+
240+Accepts
241+-------
242+
243+`now` is a `@d`.
244+
245+Produces
246+--------
247+
248+A [`++date`]().
249+
250+Source
251+------
252+
253+ ++ yore :: @d to date
254+ |= now=@d
255+ ^- date
256+ =+ rip=(yell now)
257+ =+ ger=(yall d.rip)
258+ :- ?: (gth y.ger 292.277.024.400)
259+ [a=& y=(sub y.ger 292.277.024.400)]
260+ [a=| y=+((sub 292.277.024.400 y.ger))]
261+ [m.ger d.ger h.rip m.rip s.rip f.rip]
262+
263+Examples
264+--------
265+
266+ ~zod/try=> (yore -<-)
267+ [[a=%.y y=2.014] m=8 t=[d=4 h=20 m=17 s=1 f=~[0x700d]]]
268+ ~zod/try=> (yore -<-)
269+ [[a=%.y y=2.014] m=8 t=[d=4 h=20 m=28 s=53 f=~[0x7b82]]]
270+
271+
272+
273+***
274+### `++yule`
275+
276+Daily time to time atom
277+
278+Accept a [`++tarp`](/doc/hoon/library/1#++tarp), a parsed daily time, and produces a time atom,
279+`@d`.
280+
281+Accepts
282+-------
283+
284+`rip` is a [`++tarp`](/doc/hoon/library/1#++tarp).
285+
286+Produces
287+--------
288+
289+A [`@d`]().
290+
291+Source
292+------
293+
294+ ++ yule :: time atom
295+ |= rip=tarp
296+ ^- @d
297+ =+ ^= sec ;: add
298+ (mul d.rip day:yo)
299+ (mul h.rip hor:yo)
300+ (mul m.rip mit:yo)
301+ s.rip
302+ ==
303+ =+ ^= fac =+ muc=4
304+ |- ^- @
305+ ?~ f.rip
306+ 0
307+ => .(muc (dec muc))
308+ (add (lsh 4 muc i.f.rip) $(f.rip t.f.rip))
309+ (con (lsh 6 1 sec) fac)
310+
311+Examples
312+--------
313+
314+ ~zod/try=> =murica (yell ~1776.7.4)
315+ ~zod/try=> murica
316+ [d=106.751.991.733.273 h=0 m=0 s=0 f=~]
317+ ~zod/try=> (yule murica)
318+ 0x8000000b62aaf5800000000000000000
319+ ~zod/try=> `@da`(yule murica)
320+ ~1776.7.4
321+ ~zod/try=> `@da`(yule (yell ~2014.3.20..05.42.53..7456))
322+ ~2014.3.20..05.42.53..7456
323+ ~zod/try=> `tarp`[31 12 30 0 ~]
324+ [d=31 h=12 m=30 s=0 f=~]
325+ ~zod/try=> `@dr`(yule `tarp`[31 12 30 0 ~])
326+ ~d31.h12.m30
327+
328+
329+
330+***
331+### `++yo`
332+
333+ ++ yo :: time constants core
334+
335+Useful constants for interacting with earth time.
336+
337+### `++cet`
338+
339+Days in a century. Derived by multiplying the number of days in a year
340+(365) by the number of years in a century (100), then adding the number
341+days from leap years in a century (24).
342+
343+Produces
344+--------
345+
346+An [atom]().
347+
348+Source
349+------
350+
351+ |% ++ cet 36.524 :: (add 24 (mul 100 365))
352+
353+Examples
354+--------
355+
356+ ~zod/try=> cet:yo
357+ 36.524
358+ ~zod/try=> (add 365 cet:yo)
359+ 36.889
360+ ~zod/try=> (sub (add 24 (mul 100 365)) cet:yo)
361+ 0
362+
363+------------------------------------------------------------------------
364+
365+### `++day`
366+
367+Number of seconds in a day.
368+
369+Produces
370+--------
371+
372+An [atom]().
373+
374+Source
375+------
376+
377+ ++ day 86.400 :: (mul 24 hor)
378+
379+Examples
380+--------
381+
382+ ~zod/try=> day:yo
383+ 86.400
384+ ~zod/try=> (add 60 day:yo)
385+ 86.460
386+
387+------------------------------------------------------------------------
388+
389+### `++era`
390+
391+XX Revisit
392+
393+Produces
394+--------
395+
396+An [atom]().
397+
398+Source
399+------
400+
401+ ++ era 146.097 :: (add 1 (mul 4 cet))
402+
403+Examples
404+--------
405+
406+
407+------------------------------------------------------------------------
408+
409+### `++hor`
410+
411+Seconds in hour
412+
413+The number of seconds in an hour. Derived by multiplying the number of
414+seconds in a minute by the minutes in an hour.
415+
416+Produces
417+--------
418+
419+An [atom]().
420+
421+Source
422+------
423+
424+ ++ hor 3.600 :: (mul 60 mit)
425+
426+Examples
427+--------
428+
429+ ~zod/try=> hor:yo
430+ 3.600
431+ ~zod/try=> (div hor:yo 60)
432+ 60
433+
434+------------------------------------------------------------------------
435+
436+### `++jes`
437+
438+XX Revisit
439+
440+Produces
441+--------
442+
443+An atom.
444+
445+Source
446+------
447+
448+ ++ jes 106.751.991.084.417 :: (mul 730.692.561 era)
449+
450+Examples
451+--------
452+
453+ ~zod/try=> jes:yo
454+ 106.751.991.084.417
455+
456+------------------------------------------------------------------------
457+
458+### `++mit`
459+
460+Seconds in minute
461+
462+The number of seconds in a minute.
463+
464+Produces
465+--------
466+
467+An [atom]().
468+
469+Source
470+------
471+
472+ ++ mit 60
473+
474+Examples
475+--------
476+
477+ ~zod/try=> mit:yo
478+ 60
479+
480+------------------------------------------------------------------------
481+
482+### `++moh`
483+
484+Days in month
485+
486+The days in each month of the Gregorian common year. A list of unsigned
487+decimal atoms (Either 28, 30, or 31) denoting the number of days in the
488+month at the year at that index.
489+
490+Produces
491+--------
492+
493+A [`++list`]() of [`@ud`]()
494+
495+Source
496+------
497+
498+ ++ moh `(list ,@ud)`[31 28 31 30 31 30 31 31 30 31 30 31 ~]
499+
500+Examples
501+--------
502+
503+ ~zod/try=> moh:yo
504+ ~[31 28 31 30 31 30 31 31 30 31 30 31]
505+ ~zod/try=> (snag 4 moh:yo)
506+ 31
507+
508+------------------------------------------------------------------------
509+
510+### `++moy`
511+
512+Moh with leapyear
513+
514+The days in each month of the Gregorian leap-year. A list of unsigned
515+decimal atoms (Either 29,30, or 31) denoting the number of days in the
516+month at the leap-year at that index.
517+
518+Examples
519+--------
520+
521+A [`++list`]() of [`@ud`]()
522+
523+Source
524+------
525+
526+ ++ moy `(list ,@ud)`[31 29 31 30 31 30 31 31 30 31 30 31 ~]
527+
528+Examples
529+--------
530+
531+ ~zod/try=> moy:yo
532+ ~[31 29 31 30 31 30 31 31 30 31 30 31]
533+ ~zod/try=> (snag 1 moy:yo)
534+ 29
535+
536+------------------------------------------------------------------------
537+
538+### `++qad`
539+
540+Seconds in 4 years
541+
542+The number of seconds in four years. Derived by adding one second to the
543+number of seconds in four years.
544+
545+Produces
546+--------
547+
548+An [atom]().
549+
550+Source
551+------
552+
553+ ++ qad 126.144.001 :: (add 1 (mul 4 yer))
554+
555+Examples
556+--------
557+
558+ ~zod/try=> qad:yo
559+ 126.144.001
560+
561+------------------------------------------------------------------------
562+
563+### `++yer`
564+
565+Seconds in year
566+
567+The number of seconds in a year. Derived by multiplying the number of
568+seconds in a day by 365.
569+
570+Produces
571+--------
572+
573+An [atom]().
574+
575+Source
576+------
577+
578+ ++ yer 31.536.000 :: (mul 365 day)
579+
580+Examples
581+--------
582+
583+ ~zod/try=> yer:yo
584+ 31.536.000
585+
586+
587+
588+***
docs/system/hoon/library/3d.mdnew file+424
@@ -0,0 +1,424 @@
1+## 3d: SHA hash family
2+### `++shad`
3+
4+ ++ shad |=(ruz=@ (shax (shax ruz))) :: double sha-256
5+
6+XX document
7+
8+
9+
10+***
11+### `++shaf`
12+
13+ ++ shaf :: half sha-256
14+ |= [sal=@ ruz=@]
15+ =+ haz=(shas sal ruz)
16+ (mix (end 7 1 haz) (rsh 7 1 haz))
17+ ::
18+
19+XX document
20+
21+
22+
23+***
24+### `++shak`
25+
26+ ++ shak :: XX shd be PBKDF
27+ |= [who=@p wud=@]
28+ (shas (mix %shak who) wud)
29+ ::
30+
31+XX document
32+
33+
34+
35+***
36+### `++shal`
37+
38+ ++ shal :: sha-512 with length
39+ ~/ %shal
40+ |= [len=@ ruz=@] ^- @
41+ => .(ruz (cut 3 [0 len] ruz))
42+ =+ [few==>(fe .(a 6)) wac=|=([a=@ b=@] (cut 6 [a 1] b))]
43+ =+ [sum=sum.few ror=ror.few net=net.few inv=inv.few]
44+ =+ ral=(lsh 0 3 len)
45+ =+ ^= ful
46+ %+ can 0
47+ :~ [ral ruz]
48+ [8 128]
49+ [(mod (sub 1.920 (mod (add 8 ral) 1.024)) 1.024) 0]
50+ [128 (~(net fe 7) ral)]
51+ ==
52+ =+ lex=(met 10 ful)
53+ =+ ^= kbx 0x6c44.198c.4a47.5817.5fcb.6fab.3ad6.faec.
54+ 597f.299c.fc65.7e2a.4cc5.d4be.cb3e.42b6.
55+ 431d.67c4.9c10.0d4c.3c9e.be0a.15c9.bebc.
56+ 32ca.ab7b.40c7.2493.28db.77f5.2304.7d84.
57+ 1b71.0b35.131c.471b.113f.9804.bef9.0dae.
58+ 0a63.7dc5.a2c8.98a6.06f0.67aa.7217.6fba.
59+ f57d.4f7f.ee6e.d178.eada.7dd6.cde0.eb1e.
60+ d186.b8c7.21c0.c207.ca27.3ece.ea26.619c.
61+ c671.78f2.e372.532b.bef9.a3f7.b2c6.7915.
62+ a450.6ceb.de82.bde9.90be.fffa.2363.1e28.
63+ 8cc7.0208.1a64.39ec.84c8.7814.a1f0.ab72.
64+ 78a5.636f.4317.2f60.748f.82ee.5def.b2fc.
65+ 682e.6ff3.d6b2.b8a3.5b9c.ca4f.7763.e373.
66+ 4ed8.aa4a.e341.8acb.391c.0cb3.c5c9.5a63.
67+ 34b0.bcb5.e19b.48a8.2748.774c.df8e.eb99.
68+ 1e37.6c08.5141.ab53.19a4.c116.b8d2.d0c8.
69+ 106a.a070.32bb.d1b8.f40e.3585.5771.202a.
70+ d699.0624.5565.a910.d192.e819.d6ef.5218.
71+ c76c.51a3.0654.be30.c24b.8b70.d0f8.9791.
72+ a81a.664b.bc42.3001.a2bf.e8a1.4cf1.0364.
73+ 9272.2c85.1482.353b.81c2.c92e.47ed.aee6.
74+ 766a.0abb.3c77.b2a8.650a.7354.8baf.63de.
75+ 5338.0d13.9d95.b3df.4d2c.6dfc.5ac4.2aed.
76+ 2e1b.2138.5c26.c926.27b7.0a85.46d2.2ffc.
77+ 1429.2967.0a0e.6e70.06ca.6351.e003.826f.
78+ d5a7.9147.930a.a725.c6e0.0bf3.3da8.8fc2.
79+ bf59.7fc7.beef.0ee4.b003.27c8.98fb.213f.
80+ a831.c66d.2db4.3210.983e.5152.ee66.dfab.
81+ 76f9.88da.8311.53b5.5cb0.a9dc.bd41.fbd4.
82+ 4a74.84aa.6ea6.e483.2de9.2c6f.592b.0275.
83+ 240c.a1cc.77ac.9c65.0fc1.9dc6.8b8c.d5b5.
84+ efbe.4786.384f.25e3.e49b.69c1.9ef1.4ad2.
85+ c19b.f174.cf69.2694.9bdc.06a7.25c7.1235.
86+ 80de.b1fe.3b16.96b1.72be.5d74.f27b.896f.
87+ 550c.7dc3.d5ff.b4e2.2431.85be.4ee4.b28c.
88+ 1283.5b01.4570.6fbe.d807.aa98.a303.0242.
89+ ab1c.5ed5.da6d.8118.923f.82a4.af19.4f9b.
90+ 59f1.11f1.b605.d019.3956.c25b.f348.b538.
91+ e9b5.dba5.8189.dbbc.b5c0.fbcf.ec4d.3b2f.
92+ 7137.4491.23ef.65cd.428a.2f98.d728.ae22
93+ =+ ^= hax 0x5be0.cd19.137e.2179.1f83.d9ab.fb41.bd6b.
94+ 9b05.688c.2b3e.6c1f.510e.527f.ade6.82d1.
95+ a54f.f53a.5f1d.36f1.3c6e.f372.fe94.f82b.
96+ bb67.ae85.84ca.a73b.6a09.e667.f3bc.c908
97+ =+ i=0
98+ |- ^- @
99+ ?: =(i lex)
100+ (rep 6 (turn (rip 6 hax) net))
101+ =+ ^= wox
102+ =+ dux=(cut 10 [i 1] ful)
103+ =+ wox=(rep 6 (turn (rip 6 dux) net))
104+ =+ j=16
105+ |- ^- @
106+ ?: =(80 j)
107+ wox
108+ =+ :* l=(wac (sub j 15) wox)
109+ m=(wac (sub j 2) wox)
110+ n=(wac (sub j 16) wox)
111+ o=(wac (sub j 7) wox)
112+ ==
113+ =+ x=:(mix (ror 0 1 l) (ror 0 8 l) (rsh 0 7 l))
114+ =+ y=:(mix (ror 0 19 m) (ror 0 61 m) (rsh 0 6 m))
115+ =+ z=:(sum n x o y)
116+ $(wox (con (lsh 6 j z) wox), j +(j))
117+ =+ j=0
118+ =+ :* a=(wac 0 hax)
119+ b=(wac 1 hax)
120+ c=(wac 2 hax)
121+ d=(wac 3 hax)
122+ e=(wac 4 hax)
123+ f=(wac 5 hax)
124+ g=(wac 6 hax)
125+ h=(wac 7 hax)
126+ ==
127+ |- ^- @
128+ ?: =(80 j)
129+ %= ^$
130+ i +(i)
131+ hax %+ rep 6
132+ :~ (sum a (wac 0 hax))
133+ (sum b (wac 1 hax))
134+ (sum c (wac 2 hax))
135+ (sum d (wac 3 hax))
136+ (sum e (wac 4 hax))
137+ (sum f (wac 5 hax))
138+ (sum g (wac 6 hax))
139+ (sum h (wac 7 hax))
140+ ==
141+ ==
142+ =+ l=:(mix (ror 0 28 a) (ror 0 34 a) (ror 0 39 a)) :: S0
143+ =+ m=:(mix (dis a b) (dis a c) (dis b c)) :: maj
144+ =+ n=(sum l m) :: t2
145+ =+ o=:(mix (ror 0 14 e) (ror 0 18 e) (ror 0 41 e)) :: S1
146+ =+ p=(mix (dis e f) (dis (inv e) g)) :: ch
147+ =+ q=:(sum h o p (wac j kbx) (wac j wox)) :: t1
148+ $(j +(j), a (sum q n), b a, c b, d c, e (sum d q), f e, g f, h g)
149+ ::
150+
151+XX document
152+
153+
154+
155+***
156+### `++sham`
157+
158+ ++ sham :: noun hash
159+ |= yux=* ^- @uvH ^- @
160+ ?@ yux
161+ (shaf %mash yux)
162+ (shaf %sham (jam yux))
163+ ::
164+
165+XX document
166+
167+
168+
169+***
170+### `++shan`
171+
172+ ++ shan :: sha-1 (deprecated)
173+ |= ruz=@
174+ =+ [few==>(fe .(a 5)) wac=|=([a=@ b=@] (cut 5 [a 1] b))]
175+ =+ [sum=sum.few ror=ror.few rol=rol.few net=net.few inv=inv.few]
176+ =+ ral=(lsh 0 3 (met 3 ruz))
177+ =+ ^= ful
178+ %+ can 0
179+ :~ [ral ruz]
180+ [8 128]
181+ [(mod (sub 960 (mod (add 8 ral) 512)) 512) 0]
182+ [64 (~(net fe 6) ral)]
183+ ==
184+ =+ lex=(met 9 ful)
185+ =+ kbx=0xca62.c1d6.8f1b.bcdc.6ed9.eba1.5a82.7999
186+ =+ hax=0xc3d2.e1f0.1032.5476.98ba.dcfe.efcd.ab89.6745.2301
187+ =+ i=0
188+ |-
189+ ?: =(i lex)
190+ (rep 5 (flop (rip 5 hax)))
191+ =+ ^= wox
192+ =+ dux=(cut 9 [i 1] ful)
193+ =+ wox=(rep 5 (turn (rip 5 dux) net))
194+ =+ j=16
195+ |- ^- @
196+ ?: =(80 j)
197+ wox
198+ =+ :* l=(wac (sub j 3) wox)
199+ m=(wac (sub j 8) wox)
200+ n=(wac (sub j 14) wox)
201+ o=(wac (sub j 16) wox)
202+ ==
203+ =+ z=(rol 0 1 :(mix l m n o))
204+ $(wox (con (lsh 5 j z) wox), j +(j))
205+ =+ j=0
206+ =+ :* a=(wac 0 hax)
207+ b=(wac 1 hax)
208+ c=(wac 2 hax)
209+ d=(wac 3 hax)
210+ e=(wac 4 hax)
211+ ==
212+ |- ^- @
213+ ?: =(80 j)
214+ %= ^$
215+ i +(i)
216+ hax %+ rep 5
217+ :~
218+ (sum a (wac 0 hax))
219+ (sum b (wac 1 hax))
220+ (sum c (wac 2 hax))
221+ (sum d (wac 3 hax))
222+ (sum e (wac 4 hax))
223+ ==
224+ ==
225+ =+ fx=(con (dis b c) (dis (not 5 1 b) d))
226+ =+ fy=:(mix b c d)
227+ =+ fz=:(con (dis b c) (dis b d) (dis c d))
228+ =+ ^= tem
229+ ?: &((gte j 0) (lte j 19))
230+ :(sum (rol 0 5 a) fx e (wac 0 kbx) (wac j wox))
231+ ?: &((gte j 20) (lte j 39))
232+ :(sum (rol 0 5 a) fy e (wac 1 kbx) (wac j wox))
233+ ?: &((gte j 40) (lte j 59))
234+ :(sum (rol 0 5 a) fz e (wac 2 kbx) (wac j wox))
235+ :(sum (rol 0 5 a) fy e (wac 3 kbx) (wac j wox))
236+ $(j +(j), a tem, b a, c (rol 0 30 b), d c, e d)
237+
238+XX document
239+
240+
241+
242+***
243+### `++shas`
244+
245+ ++ shas :: salted hash
246+ |= [sal=@ ruz=@]
247+ (shax (mix sal (shax ruz)))
248+ ::
249+
250+XX document
251+
252+
253+
254+***
255+### `++shaw`
256+
257+ ++ shaw :: hash to nbits
258+ |= [sal=@ len=@ ruz=@]
259+ (~(raw og (shas sal (mix len ruz))) len)
260+ ::
261+
262+
263+
264+***
265+### `++shax`
266+
267+ ++ shax :: sha-256
268+ ~/ %shax
269+ |= ruz=@ ^- @
270+ ~| %sha
271+ =+ [few==>(fe .(a 5)) wac=|=([a=@ b=@] (cut 5 [a 1] b))]
272+ =+ [sum=sum.few ror=ror.few net=net.few inv=inv.few]
273+ =+ ral=(lsh 0 3 (met 3 ruz))
274+ =+ ^= ful
275+ %+ can 0
276+ :~ [ral ruz]
277+ [8 128]
278+ [(mod (sub 960 (mod (add 8 ral) 512)) 512) 0]
279+ [64 (~(net fe 6) ral)]
280+ ==
281+ =+ lex=(met 9 ful)
282+ =+ ^= kbx 0xc671.78f2.bef9.a3f7.a450.6ceb.90be.fffa.
283+ 8cc7.0208.84c8.7814.78a5.636f.748f.82ee.
284+ 682e.6ff3.5b9c.ca4f.4ed8.aa4a.391c.0cb3.
285+ 34b0.bcb5.2748.774c.1e37.6c08.19a4.c116.
286+ 106a.a070.f40e.3585.d699.0624.d192.e819.
287+ c76c.51a3.c24b.8b70.a81a.664b.a2bf.e8a1.
288+ 9272.2c85.81c2.c92e.766a.0abb.650a.7354.
289+ 5338.0d13.4d2c.6dfc.2e1b.2138.27b7.0a85.
290+ 1429.2967.06ca.6351.d5a7.9147.c6e0.0bf3.
291+ bf59.7fc7.b003.27c8.a831.c66d.983e.5152.
292+ 76f9.88da.5cb0.a9dc.4a74.84aa.2de9.2c6f.
293+ 240c.a1cc.0fc1.9dc6.efbe.4786.e49b.69c1.
294+ c19b.f174.9bdc.06a7.80de.b1fe.72be.5d74.
295+ 550c.7dc3.2431.85be.1283.5b01.d807.aa98.
296+ ab1c.5ed5.923f.82a4.59f1.11f1.3956.c25b.
297+ e9b5.dba5.b5c0.fbcf.7137.4491.428a.2f98
298+ =+ ^= hax 0x5be0.cd19.1f83.d9ab.9b05.688c.510e.527f.
299+ a54f.f53a.3c6e.f372.bb67.ae85.6a09.e667
300+ =+ i=0
301+ |- ^- @
302+ ?: =(i lex)
303+ (rep 5 (turn (rip 5 hax) net))
304+ =+ ^= wox
305+ =+ dux=(cut 9 [i 1] ful)
306+ =+ wox=(rep 5 (turn (rip 5 dux) net))
307+ =+ j=16
308+ |- ^- @
309+ ?: =(64 j)
310+ wox
311+ =+ :* l=(wac (sub j 15) wox)
312+ m=(wac (sub j 2) wox)
313+ n=(wac (sub j 16) wox)
314+ o=(wac (sub j 7) wox)
315+ ==
316+ =+ x=:(mix (ror 0 7 l) (ror 0 18 l) (rsh 0 3 l))
317+ =+ y=:(mix (ror 0 17 m) (ror 0 19 m) (rsh 0 10 m))
318+ =+ z=:(sum n x o y)
319+ $(wox (con (lsh 5 j z) wox), j +(j))
320+ =+ j=0
321+ =+ :* a=(wac 0 hax)
322+ b=(wac 1 hax)
323+ c=(wac 2 hax)
324+ d=(wac 3 hax)
325+ e=(wac 4 hax)
326+ f=(wac 5 hax)
327+ g=(wac 6 hax)
328+ h=(wac 7 hax)
329+ ==
330+ |- ^- @
331+ ?: =(64 j)
332+ %= ^$
333+ i +(i)
334+ hax %+ rep 5
335+ :~ (sum a (wac 0 hax))
336+ (sum b (wac 1 hax))
337+ (sum c (wac 2 hax))
338+ (sum d (wac 3 hax))
339+ (sum e (wac 4 hax))
340+ (sum f (wac 5 hax))
341+ (sum g (wac 6 hax))
342+ (sum h (wac 7 hax))
343+ ==
344+ ==
345+ =+ l=:(mix (ror 0 2 a) (ror 0 13 a) (ror 0 22 a)) :: s0
346+ =+ m=:(mix (dis a b) (dis a c) (dis b c)) :: maj
347+ =+ n=(sum l m) :: t2
348+ =+ o=:(mix (ror 0 6 e) (ror 0 11 e) (ror 0 25 e)) :: s1
349+ =+ p=(mix (dis e f) (dis (inv e) g)) :: ch
350+ =+ q=:(sum h o p (wac j kbx) (wac j wox)) :: t1
351+ $(j +(j), a (sum q n), b a, c b, d c, e (sum d q), f e, g f, h g)
352+ ::
353+
354+XX document
355+
356+
357+
358+***
359+### `++shaz`
360+
361+ ++ shaz :: sha-512
362+ |= ruz=@ ^- @
363+ (shal [(met 3 ruz) ruz])
364+
365+
366+
367+***
368+
369+### `++og`
370+
371+ ++ og :: shax-powered rng
372+ ~/ %og
373+ |_ a=@
374+
375+XX document
376+
377+### `++rad`
378+
379+ ++ rad :: random in range
380+ |= b=@ ^- @
381+ =+ c=(raw (met 0 b))
382+ ?:((lth c b) c $(a +(a)))
383+ ::
384+
385+XX document
386+
387+### `++rads`
388+
389+ ++ rads :: random continuation
390+ |= b=@
391+ =+ r=(rad b)
392+ [r +>.$(a (shas %og-s r))]
393+
394+XX document
395+
396+### `++raw`
397+
398+ ++ raw :: random bits
399+ ~/ %raw
400+ |= b=@ ^- @
401+ %+ can
402+ 0
403+ =+ c=(shas %og-a (mix b a))
404+ |- ^- (list ,[@ @])
405+ ?: =(0 b)
406+ ~
407+ =+ d=(shas %og-b (mix b (mix a c)))
408+ ?: (lth b 256)
409+ [[b (end 0 b d)] ~]
410+ [[256 d] $(c d, b (sub b 256))]
411+
412+XX document
413+
414+### `++raws`
415+
416+ ++ raws :: random bits continuation
417+ |= b=@
418+ =+ r=(raw b)
419+ [r +>.$(a (shas %og-s r))]
420+ --
421+
422+
423+
424+***
docs/system/hoon/library/3e.mdnew file+715
@@ -0,0 +1,715 @@
1+## 3e: AES encryption
2+### `++aesc`
3+
4+ ++ aesc :: AES-256
5+ ~% %aesc + ~
6+ |%
7+
8+XX document
9+
10+### `++en`
11+
12+ ++ en :: ECB enc
13+ ~/ %en
14+ |= [a=@I b=@H] ^- @uxH
15+ =+ ahem
16+ (be & (ex a) b)
17+
18+XX document
19+
20+### `++de`
21+
22+ ++ de :: ECB dec
23+ ~/ %de
24+ |= [a=@I b=@H] ^- @uxH
25+ =+ ahem
26+ (be | (ix (ex a)) b)
27+ --
28+
29+XX document
30+
31+### `++ahem`
32+
33+ ++ ahem :: AES helpers
34+ :: XX should be in aesc, isn't for performance reasons
35+ =>
36+ =+ =+ [gr=(ga 8 0x11b 3) few==>(fe .(a 5))]
37+ =+ [pro=pro.gr dif=dif.gr pow=pow.gr ror=ror.few]
38+ [pro=pro dif=dif pow=pow ror=ror nnk=8 nnb=4 nnr=14]
39+ => |%
40+
41+XX document
42+
43+### `++cipa`
44+
45+ ++ cipa :: AES params
46+ $_ ^? |%
47+
48+XX document
49+
50+### `++co`
51+
52+ ++ co [0xe 0xb 0xd 0x9]
53+
54+XX document
55+
56+### `++ix`
57+
58+ ++ ix :: key expand, inv
59+ |= a=@ ^- @
60+ =+ [i=1 j=_@ b=_@ c=co:pin]
61+ |-
62+ ?: =(nnr i)
63+ a
64+ => .(b (cut 7 [i 1] a))
65+ => .(b (rep 5 (mcol (pode 5 4 b) c)))
66+ => .(j (sub nnr i))
67+ %= $
68+ i +(i)
69+ a
70+ %+ can 7
71+ :~ [i (cut 7 [0 i] a)]
72+ [1 b]
73+ [j (cut 7 [+(i) j] a)]
74+ ==
75+ ==
76+ --
77+ ::
78+
79+XX document
80+
81+### `++ro`
82+
83+ ++ ro [0 3 2 1]
84+
85+XX document
86+
87+### `++su`
88+
89+ ++ su 0x7d0c.2155.6314.69e1.26d6.77ba.7e04.2b17.
90+ 6199.5383.3cbb.ebc8.b0f5.2aae.4d3b.e0a0.
91+ ef9c.c993.9f7a.e52d.0d4a.b519.a97f.5160.
92+ 5fec.8027.5910.12b1.31c7.0788.33a8.dd1f.
93+ f45a.cd78.fec0.db9a.2079.d2c6.4b3e.56fc.
94+ 1bbe.18aa.0e62.b76f.89c5.291d.711a.f147.
95+ 6edf.751c.e837.f9e2.8535.ade7.2274.ac96.
96+ 73e6.b4f0.cecf.f297.eadc.674f.4111.913a.
97+ 6b8a.1301.03bd.afc1.020f.3fca.8f1e.2cd0.
98+ 0645.b3b8.0558.e4f7.0ad3.bc8c.00ab.d890.
99+ 849d.8da7.5746.155e.dab9.edfd.5048.706c.
100+ 92b6.655d.cc5c.a4d4.1698.6886.64f6.f872.
101+ 25d1.8b6d.49a2.5b76.b224.d928.66a1.2e08.
102+ 4ec3.fa42.0b95.4cee.3d23.c2a6.3294.7b54.
103+ cbe9.dec4.4443.8e34.87ff.2f9b.8239.e37c.
104+ fbd7.f381.9ea3.40bf.38a5.3630.d56a.0952
105+ --
106+ ::
107+
108+XX document
109+
110+### `++pen`
111+
112+ ++ pen :: encrypt
113+ ^- cipa
114+ |%
115+
116+XX document
117+
118+### `++co`
119+
120+ ++ co [0xe 0xb 0xd 0x9]
121+
122+XX document
123+
124+### `++ix`
125+
126+ ++ ix :: key expand, inv
127+ |= a=@ ^- @
128+ =+ [i=1 j=_@ b=_@ c=co:pin]
129+ |-
130+ ?: =(nnr i)
131+ a
132+ => .(b (cut 7 [i 1] a))
133+ => .(b (rep 5 (mcol (pode 5 4 b) c)))
134+ => .(j (sub nnr i))
135+ %= $
136+ i +(i)
137+ a
138+ %+ can 7
139+ :~ [i (cut 7 [0 i] a)]
140+ [1 b]
141+ [j (cut 7 [+(i) j] a)]
142+ ==
143+ ==
144+ --
145+ ::
146+
147+XX document
148+
149+### `++ro`
150+
151+ ++ ro [0 3 2 1]
152+
153+XX document
154+
155+### `++su`
156+
157+ ++ su 0x7d0c.2155.6314.69e1.26d6.77ba.7e04.2b17.
158+ 6199.5383.3cbb.ebc8.b0f5.2aae.4d3b.e0a0.
159+ ef9c.c993.9f7a.e52d.0d4a.b519.a97f.5160.
160+ 5fec.8027.5910.12b1.31c7.0788.33a8.dd1f.
161+ f45a.cd78.fec0.db9a.2079.d2c6.4b3e.56fc.
162+ 1bbe.18aa.0e62.b76f.89c5.291d.711a.f147.
163+ 6edf.751c.e837.f9e2.8535.ade7.2274.ac96.
164+ 73e6.b4f0.cecf.f297.eadc.674f.4111.913a.
165+ 6b8a.1301.03bd.afc1.020f.3fca.8f1e.2cd0.
166+ 0645.b3b8.0558.e4f7.0ad3.bc8c.00ab.d890.
167+ 849d.8da7.5746.155e.dab9.edfd.5048.706c.
168+ 92b6.655d.cc5c.a4d4.1698.6886.64f6.f872.
169+ 25d1.8b6d.49a2.5b76.b224.d928.66a1.2e08.
170+ 4ec3.fa42.0b95.4cee.3d23.c2a6.3294.7b54.
171+ cbe9.dec4.4443.8e34.87ff.2f9b.8239.e37c.
172+ fbd7.f381.9ea3.40bf.38a5.3630.d56a.0952
173+ --
174+ ::
175+
176+XX document
177+
178+### `++pin`
179+
180+ ++ pin :: decrypt
181+ ^- cipa
182+ |%
183+
184+XX document
185+
186+### `++co`
187+
188+ ++ co [0xe 0xb 0xd 0x9]
189+
190+XX document
191+
192+### `++ix`
193+
194+ ++ ix :: key expand, inv
195+ |= a=@ ^- @
196+ =+ [i=1 j=_@ b=_@ c=co:pin]
197+ |-
198+ ?: =(nnr i)
199+ a
200+ => .(b (cut 7 [i 1] a))
201+ => .(b (rep 5 (mcol (pode 5 4 b) c)))
202+ => .(j (sub nnr i))
203+ %= $
204+ i +(i)
205+ a
206+ %+ can 7
207+ :~ [i (cut 7 [0 i] a)]
208+ [1 b]
209+ [j (cut 7 [+(i) j] a)]
210+ ==
211+ ==
212+ --
213+ ::
214+
215+XX document
216+
217+### `++ro`
218+
219+ ++ ro [0 3 2 1]
220+
221+XX document
222+
223+### `++su`
224+
225+ ++ su 0x7d0c.2155.6314.69e1.26d6.77ba.7e04.2b17.
226+ 6199.5383.3cbb.ebc8.b0f5.2aae.4d3b.e0a0.
227+ ef9c.c993.9f7a.e52d.0d4a.b519.a97f.5160.
228+ 5fec.8027.5910.12b1.31c7.0788.33a8.dd1f.
229+ f45a.cd78.fec0.db9a.2079.d2c6.4b3e.56fc.
230+ 1bbe.18aa.0e62.b76f.89c5.291d.711a.f147.
231+ 6edf.751c.e837.f9e2.8535.ade7.2274.ac96.
232+ 73e6.b4f0.cecf.f297.eadc.674f.4111.913a.
233+ 6b8a.1301.03bd.afc1.020f.3fca.8f1e.2cd0.
234+ 0645.b3b8.0558.e4f7.0ad3.bc8c.00ab.d890.
235+ 849d.8da7.5746.155e.dab9.edfd.5048.706c.
236+ 92b6.655d.cc5c.a4d4.1698.6886.64f6.f872.
237+ 25d1.8b6d.49a2.5b76.b224.d928.66a1.2e08.
238+ 4ec3.fa42.0b95.4cee.3d23.c2a6.3294.7b54.
239+ cbe9.dec4.4443.8e34.87ff.2f9b.8239.e37c.
240+ fbd7.f381.9ea3.40bf.38a5.3630.d56a.0952
241+ --
242+ ::
243+
244+XX document
245+
246+### `++mcol`
247+
248+ ++ mcol
249+ |= [a=(list ,@) b=[p=@ q=@ r=@ s=@]] ^- (list ,@)
250+ =+ c=[p=_@ q=_@ r=_@ s=_@]
251+ |- ^- (list ,@)
252+ ?~ a ~
253+ => .(p.c (cut 3 [0 1] i.a))
254+ => .(q.c (cut 3 [1 1] i.a))
255+ => .(r.c (cut 3 [2 1] i.a))
256+ => .(s.c (cut 3 [3 1] i.a))
257+ :_ $(a t.a)
258+ %+ rep 3
259+ %+ turn
260+ %- limo
261+ :~ [[p.c p.b] [q.c q.b] [r.c r.b] [s.c s.b]]
262+ [[p.c s.b] [q.c p.b] [r.c q.b] [s.c r.b]]
263+ [[p.c r.b] [q.c s.b] [r.c p.b] [s.c q.b]]
264+ [[p.c q.b] [q.c r.b] [r.c s.b] [s.c p.b]]
265+ ==
266+ |= [a=[@ @] b=[@ @] c=[@ @] d=[@ @]]
267+ :(dif (pro a) (pro b) (pro c) (pro d))
268+ ::
269+
270+XX document
271+
272+### `++pode`
273+
274+ ++ pode :: explode to block
275+ |= [a=bloq b=@ c=@] ^- (list ,@)
276+ =+ d=(rip a c)
277+ =+ m=(met a c)
278+ |-
279+ ?: =(m b)
280+ d
281+ $(m +(m), d (weld d (limo [0 ~])))
282+
283+XX document
284+
285+### `++sube`
286+
287+ ++ sube :: s-box word
288+ |= [a=@ b=@] ^- @
289+ (rep 3 (turn (pode 3 4 a) |=(c=@ (cut 3 [c 1] b))))
290+ --
291+ |%
292+
293+XX document
294+
295+### `++be`
296+
297+ ++ be :: block cipher
298+ |= [a=? b=@ c=@H] ^- @uxH
299+ ~| %be-aesc
300+ => %= .
301+ +
302+ => +
303+ |%
304+
305+XX document
306+
307+### `++ankh`
308+
309+ ++ ankh
310+ |= [a=cipa b=@ c=@]
311+ (pode 5 nnb (cut 5 [(mul (ix.a b) nnb) nnb] c))
312+
313+XX document
314+
315+### `++sark`
316+
317+ ++ sark
318+ |= [c=(list ,@) d=(list ,@)] ^- (list ,@)
319+ ?~ c ~
320+ ?~ d !!
321+ [(mix i.c i.d) $(c t.c, d t.d)]
322+
323+XX document
324+
325+### `++srow`
326+
327+ ++ srow
328+ |= [a=cipa b=(list ,@)] ^- (list ,@)
329+ =+ [c=0 d=~ e=ro.a]
330+ |-
331+ ?: =(c nnb)
332+ d
333+ :_ $(c +(c))
334+ %+ rep 3
335+ %+ turn
336+ (limo [0 p.e] [1 q.e] [2 r.e] [3 s.e] ~)
337+ |= [f=@ g=@]
338+ (cut 3 [f 1] (snag (mod (add g c) nnb) b))
339+
340+XX document
341+
342+### `++subs`
343+
344+ ++ subs
345+ |= [a=cipa b=(list ,@)] ^- (list ,@)
346+ ?~ b ~
347+ [(sube i.b su.a) $(b t.b)]
348+ --
349+ ==
350+ =+ [d=?:(a pen pin) e=(pode 5 nnb c) f=1]
351+ => .(e (sark e (ankh d 0 b)))
352+ |-
353+ ?. =(nnr f)
354+ => .(e (subs d e))
355+ => .(e (srow d e))
356+ => .(e (mcol e co.d))
357+ => .(e (sark e (ankh d f b)))
358+ $(f +(f))
359+ => .(e (subs d e))
360+ => .(e (srow d e))
361+ => .(e (sark e (ankh d nnr b)))
362+ (rep 5 e)
363+
364+XX document
365+
366+### `++ex`
367+
368+ ++ ex :: key expand
369+ |= a=@I ^- @
370+ =+ [b=a c=0 d=su:pen i=nnk]
371+ |-
372+ ?: =(i (mul nnb +(nnr)))
373+ b
374+ => .(c (cut 5 [(dec i) 1] b))
375+ => ?: =(0 (mod i nnk))
376+ => .(c (ror 3 1 c))
377+ => .(c (sube c d))
378+ .(c (mix c (pow (dec (div i nnk)) 2)))
379+ ?: &((gth nnk 6) =(4 (mod i nnk)))
380+ .(c (sube c d))
381+ .
382+ => .(c (mix c (cut 5 [(sub i nnk) 1] b)))
383+ => .(b (can 5 [i b] [1 c] ~))
384+ $(i +(i))
385+
386+XX document
387+
388+### `++ix`
389+
390+ ++ ix :: key expand, inv
391+ |= a=@ ^- @
392+ =+ [i=1 j=_@ b=_@ c=co:pin]
393+ |-
394+ ?: =(nnr i)
395+ a
396+ => .(b (cut 7 [i 1] a))
397+ => .(b (rep 5 (mcol (pode 5 4 b) c)))
398+ => .(j (sub nnr i))
399+ %= $
400+ i +(i)
401+ a
402+ %+ can 7
403+ :~ [i (cut 7 [0 i] a)]
404+ [1 b]
405+ [j (cut 7 [+(i) j] a)]
406+ ==
407+ ==
408+ --
409+ ::
410+
411+XX document
412+
413+### `++curt`
414+
415+ ++ curt :: curve25519
416+ |= [a=@ b=@]
417+ => %= .
418+ +
419+ => +
420+ =+ =+ [p=486.662 q=(sub (bex 255) 19)]
421+ =+ fq=~(. fo q)
422+ [p=p q=q fq=fq]
423+ |%
424+
425+XX document
426+
427+### `++cla`
428+
429+ ++ cla
430+ |= raw=@
431+ =+ low=(dis 248 (cut 3 [0 1] raw))
432+ =+ hih=(con 64 (dis 127 (cut 3 [31 1] raw)))
433+ =+ mid=(cut 3 [1 30] raw)
434+ (can 3 [[1 low] [30 mid] [1 hih] ~])
435+
436+XX document
437+
438+### `++sqr`
439+
440+ ++ sqr |=(a=@ (mul a a))
441+
442+XX document
443+
444+### `++inv`
445+
446+ ++ inv |=(a=@ (~(exp fo q) (sub q 2) a))
447+
448+XX document
449+
450+### `++cad`
451+
452+ ++ cad
453+ |= [n=[x=@ z=@] m=[x=@ z=@] d=[x=@ z=@]]
454+ =+ ^= xx
455+ ;: mul 4 z.d
456+ %- sqr %- abs:si
457+ %+ dif:si
458+ (sun:si (mul x.m x.n))
459+ (sun:si (mul z.m z.n))
460+ ==
461+ =+ ^= zz
462+ ;: mul 4 x.d
463+ %- sqr %- abs:si
464+ %+ dif:si
465+ (sun:si (mul x.m z.n))
466+ (sun:si (mul z.m x.n))
467+ ==
468+ [(sit.fq xx) (sit.fq zz)]
469+
470+XX document
471+
472+### `++cub`
473+
474+ ++ cub
475+ |= [x=@ z=@]
476+ =+ ^= xx
477+ %+ mul
478+ %- sqr %- abs:si
479+ (dif:si (sun:si x) (sun:si z))
480+ (sqr (add x z))
481+ =+ ^= zz
482+ ;: mul 4 x z
483+ :(add (sqr x) :(mul p x z) (sqr z))
484+ ==
485+ [(sit.fq xx) (sit.fq zz)]
486+ --
487+ ==
488+ =+ one=[b 1]
489+ =+ i=253
490+ =+ r=one
491+ =+ s=(cub one)
492+ |-
493+ ?: =(i 0)
494+ =+ x=(cub r)
495+ (sit.fq (mul -.x (inv +.x)))
496+ =+ m=(rsh 0 i a)
497+ ?: =(0 (mod m 2))
498+ $(i (dec i), s (cad r s one), r (cub r))
499+ $(i (dec i), r (cad r s one), s (cub s))
500+ ::
501+
502+XX document
503+
504+### `++ed`
505+
506+ ++ ed :: ed25519
507+ =>
508+ =+ =+ [b=256 q=(sub (bex 255) 19)]
509+ =+ fq=~(. fo q)
510+ =+ ^= l
511+ %+ add
512+ (bex 252)
513+ 27.742.317.777.372.353.535.851.937.790.883.648.493
514+ =+ d=(dif.fq 0 (fra.fq 121.665 121.666))
515+ =+ ii=(exp.fq (div (dec q) 4) 2)
516+ [b=b q=q fq=fq l=l d=d ii=ii]
517+ ~% %coed +> ~
518+ |%
519+
520+### `++norm`
521+
522+ ++ norm |=(x=@ ?:(=(0 (mod x 2)) x (sub q x)))
523+ ::
524+
525+XX document
526+
527+### `++xrec`
528+
529+ ++ xrec :: recover x-coord
530+ |= y=@ ^- @
531+ =+ ^= xx
532+ %+ mul (dif.fq (mul y y) 1)
533+ (inv.fq +(:(mul d y y)))
534+ =+ x=(exp.fq (div (add 3 q) 8) xx)
535+ ?: !=(0 (dif.fq (mul x x) (sit.fq xx)))
536+ (norm (pro.fq x ii))
537+ (norm x)
538+ ::
539+
540+XX document
541+
542+### `++ward`
543+
544+ ++ ward :: edwards multiply
545+ |= [pp=[@ @] qq=[@ @]] ^- [@ @]
546+ =+ dp=:(pro.fq d -.pp -.qq +.pp +.qq)
547+ =+ ^= xt
548+ %+ pro.fq
549+ %+ sum.fq
550+ (pro.fq -.pp +.qq)
551+ (pro.fq -.qq +.pp)
552+ (inv.fq (sum.fq 1 dp))
553+ =+ ^= yt
554+ %+ pro.fq
555+ %+ sum.fq
556+ (pro.fq +.pp +.qq)
557+ (pro.fq -.pp -.qq)
558+ (inv.fq (dif.fq 1 dp))
559+ [xt yt]
560+ ::
561+
562+XX document
563+
564+### `++scam`
565+
566+ ++ scam :: scalar multiply
567+ |= [pp=[@ @] e=@] ^- [@ @]
568+ ?: =(0 e)
569+ [0 1]
570+ =+ qq=$(e (div e 2))
571+ => .(qq (ward qq qq))
572+ ?: =(1 (dis 1 e))
573+ (ward qq pp)
574+ qq
575+ ::
576+
577+XX document
578+
579+### `++etch`
580+
581+ ++ etch :: encode point
582+ |= pp=[@ @] ^- @
583+ (can 0 ~[[(sub b 1) +.pp] [1 (dis 1 -.pp)]])
584+ ::
585+
586+XX document
587+
588+### `++curv`
589+
590+ ++ curv :: point on curve?
591+ |= [x=@ y=@] ^- ?
592+ .= 0
593+ %+ dif.fq
594+ %+ sum.fq
595+ (pro.fq (sub q (sit.fq x)) x)
596+ (pro.fq y y)
597+ (sum.fq 1 :(pro.fq d x x y y))
598+ ::
599+
600+XX document
601+
602+### `++deco`
603+
604+ ++ deco :: decode point
605+ |= s=@ ^- (unit ,[@ @])
606+ =+ y=(cut 0 [0 (dec b)] s)
607+ =+ si=(cut 0 [(dec b) 1] s)
608+ =+ x=(xrec y)
609+ => .(x ?:(!=(si (dis 1 x)) (sub q x) x))
610+ =+ pp=[x y]
611+ ?. (curv pp)
612+ ~
613+ [~ pp]
614+ ::
615+
616+XX document
617+
618+### `++bb`
619+
620+ ++ bb
621+ =+ bby=(pro.fq 4 (inv.fq 5))
622+ [(xrec bby) bby]
623+ ::
624+ --
625+ ~% %ed + ~
626+ |%
627+
628+XX document
629+
630+### `++puck`
631+
632+ ++ puck :: public key
633+ ~/ %puck
634+ |= sk=@I ^- @
635+ ?: (gth (met 3 sk) 32) !!
636+ =+ h=(shal (rsh 0 3 b) sk)
637+ =+ ^= a
638+ %+ add
639+ (bex (sub b 2))
640+ (lsh 0 3 (cut 0 [3 (sub b 5)] h))
641+ =+ aa=(scam bb a)
642+ (etch aa)
643+
644+XX document
645+
646+### `++suck`
647+
648+ ++ suck :: keypair from seed
649+ |= se=@I ^- @uJ
650+ =+ pu=(puck se)
651+ (can 0 ~[[b se] [b pu]])
652+ ::
653+
654+XX document
655+
656+### `++sign`
657+
658+ ++ sign :: certify
659+ ~/ %sign
660+ |= [m=@ se=@] ^- @
661+ =+ sk=(suck se)
662+ =+ pk=(cut 0 [b b] sk)
663+ =+ h=(shal (rsh 0 3 b) sk)
664+ =+ ^= a
665+ %+ add
666+ (bex (sub b 2))
667+ (lsh 0 3 (cut 0 [3 (sub b 5)] h))
668+ =+ ^= r
669+ =+ hm=(cut 0 [b b] h)
670+ =+ ^= i
671+ %+ can 0
672+ :~ [b hm]
673+ [(met 0 m) m]
674+ ==
675+ (shaz i)
676+ =+ rr=(scam bb r)
677+ =+ ^= ss
678+ =+ er=(etch rr)
679+ =+ ^= ha
680+ %+ can 0
681+ :~ [b er]
682+ [b pk]
683+ [(met 0 m) m]
684+ ==
685+ (~(sit fo l) (add r (mul (shaz ha) a)))
686+ (can 0 ~[[b (etch rr)] [b ss]])
687+ ::
688+
689+XX document
690+
691+### `++veri`
692+
693+ ++ veri :: validate
694+ ~/ %veri
695+ |= [s=@ m=@ pk=@] ^- ?
696+ ?: (gth (div b 4) (met 3 s)) |
697+ ?: (gth (div b 8) (met 3 pk)) |
698+ =+ cb=(rsh 0 3 b)
699+ =+ rr=(deco (cut 0 [0 b] s))
700+ ?~ rr |
701+ =+ aa=(deco pk)
702+ ?~ aa |
703+ =+ ss=(cut 0 [b b] s)
704+ =+ ha=(can 3 ~[[cb (etch u.rr)] [cb pk] [(met 3 m) m]])
705+ =+ h=(shaz ha)
706+ =((scam bb ss) (ward u.rr (scam u.aa h)))
707+ ::
708+ --
709+ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
710+
711+XX document
712+
713+
714+
715+***
docs/system/hoon/library/3f.mdnew file+624
@@ -0,0 +1,624 @@
1+## 3f: scrambling
2+### `++ob`
3+
4+Reversible scrambling core, v2
5+
6+ ++ ob
7+ |%
8+
9+A core for performing reversible scrambling operations for the `@p` phonetic base.
10+
11+------------------------------------------------------------------------
12+
13+### `++feen`
14+
15+Conceal structure, v2
16+
17+Randomly permutes atoms that fit into 17 to 32 bits into one another. If the
18+atom fits into 33 to 64 bits, does the same permutation on the low 32 bits
19+only. Otherwise, passes the atom through unchanged.
20+
21+Accepts
22+-------
23+
24+An atom.
25+
26+Produces
27+--------
28+
29+An atom.
30+
31+Source
32+------
33+
34+ ++ feen :: conceal structure v2
35+ |= pyn=@ ^- @
36+ ?: &((gte pyn 0x1.0000) (lte pyn 0xffff.ffff))
37+ (add 0x1.0000 (fice (sub pyn 0x1.0000)))
38+ ?: &((gte pyn 0x1.0000.0000) (lte pyn 0xffff.ffff.ffff.ffff))
39+ =+ lo=(dis pyn 0xffff.ffff)
40+ =+ hi=(dis pyn 0xffff.ffff.0000.0000)
41+ %+ con hi
42+ (add 0x1.0000 (fice (sub lo 0x1.0000)))
43+ pyn
44+
45+Examples
46+--------
47+
48+
49+------------------------------------------------------------------------
50+
51+### `++fend`
52+
53+XX
54+
55+Randomly permutes atoms that fit into 17 to 32 bits into one another, and
56+randomly permutes the low 32 bits of atoms that fit into 33 to 64 bits;
57+otherwise, passes the atom through unchanged. The permutation is the inverse of
58+the one applied by [`++feen`]().
59+
60+Accepts
61+-------
62+
63+An atom.
64+
65+Produces
66+--------
67+
68+An atom.
69+
70+Source
71+------
72+
73+ ++ fend :: restore structure v2
74+ |= cry=@ ^- @
75+ ?: &((gte cry 0x1.0000) (lte cry 0xffff.ffff))
76+ (add 0x1.0000 (teil (sub cry 0x1.0000)))
77+ ?: &((gte cry 0x1.0000.0000) (lte cry 0xffff.ffff.ffff.ffff))
78+ =+ lo=(dis cry 0xffff.ffff)
79+ =+ hi=(dis cry 0xffff.ffff.0000.0000)
80+ %+ con hi
81+ (add 0x1.0000 (teil (sub lo 0x1.0000)))
82+ cry
83+
84+Examples
85+--------
86+
87+------------------------------------------------------------------------
88+
89+### `++fice`
90+
91+XX
92+
93+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.
94+
95+Accepts
96+-------
97+
98+An atom.
99+
100+Produces
101+--------
102+
103+An atom.
104+
105+Source
106+------
107+
108+ ++ fice :: adapted from
109+ |= nor=@ :: black and rogaway
110+ ^- @ :: "ciphers with
111+ =+ ^= sel :: arbitrary finite
112+ %+ rynd 2 :: domains", 2002
113+ %+ rynd 1
114+ %+ rynd 0
115+ [(mod nor 65.535) (div nor 65.535)]
116+ (add (mul 65.535 -.sel) +.sel)
117+
118+Examples
119+--------
120+
121+------------------------------------------------------------------------
122+
123+### `++teil`
124+
125+XX
126+
127+Applies the reverse of the Feistel-like cipher applied by [`++fice`](). Unlike
128+a conventional Feistel cipher that is its own inverse if keys are used in
129+reverse order, this Feistel-like cipher uses two moduli that must be swapped
130+when applying the reverse transformation.
131+
132+Accepts
133+-------
134+
135+An atom.
136+
137+Produces
138+--------
139+
140+An atom.
141+
142+Source
143+------
144+
145+ ++ teil :: reverse ++fice
146+ |= vip=@
147+ ^- @
148+ =+ ^= sel
149+ %+ rund 0
150+ %+ rund 1
151+ %+ rund 2
152+ [(mod vip 65.535) (div vip 65.535)]
153+ (add (mul 65.535 -.sel) +.sel)
154+
155+Examples
156+--------
157+
158+------------------------------------------------------------------------
159+
160+### `++rynd`
161+
162+XX
163+
164+A single round of the Feistel-like cipher [`++fice`](). AES ([`++aesc`]()) is
165+used as the round function.
166+
167+Accepts
168+-------
169+
170+A cell of three atoms, `n`, `l`, and `r`.
171+
172+Produces
173+--------
174+
175+A cell of two atoms.
176+
177+Source
178+------
179+
180+ ++ rynd :: feistel round
181+ |= [n=@ l=@ r=@]
182+ ^- [@ @]
183+ :- r
184+ ?~ (mod n 2)
185+ (~(sum fo 65.535) l (en:aesc (snag n raku) r))
186+ (~(sum fo 65.536) l (en:aesc (snag n raku) r))
187+
188+Examples
189+--------
190+
191+------------------------------------------------------------------------
192+
193+### `++rund`
194+
195+XX
196+
197+A single round of the Feistel-like reverse cipher [`++teil`]().
198+
199+Accepts
200+-------
201+
202+A cell of three atoms, `n`, `l`, and `r`.
203+
204+Produces
205+--------
206+
207+A cell of two atoms.
208+
209+Source
210+------
211+
212+ ++ rund :: reverse round
213+ |= [n=@ l=@ r=@]
214+ ^- [@ @]
215+ :- r
216+ ?~ (mod n 2)
217+ (~(dif fo 65.535) l (en:aesc (snag n raku) r))
218+ (~(dif fo 65.536) l (en:aesc (snag n raku) r))
219+
220+Examples
221+--------
222+
223+------------------------------------------------------------------------
224+
225+### `++raku`
226+
227+XX
228+
229+
230+Accepts
231+-------
232+
233+A list of atoms of [odor]() [`@ux`]() (hexadecimal).
234+
235+Produces
236+--------
237+
238+Arbitrary keys for use with [`++aesc`]().
239+
240+Source
241+------
242+
243+ ++ raku
244+ ^- (list ,@ux)
245+ :~ 0x15f6.25e3.083a.eb3e.7a55.d4db.fb99.32a3.
246+ 43af.2750.219e.8a24.e5f8.fac3.6c36.f968
247+ 0xf2ff.24fe.54d0.1abd.4b2a.d8aa.4402.8e88.
248+ e82f.19ec.948d.b1bb.ed2e.f791.83a3.8133
249+ 0xa3d8.6a7b.400e.9e91.187d.91a7.6942.f34a.
250+ 6f5f.ab8e.88b9.c089.b2dc.95a6.aed5.e3a4
251+ ==
252+
253+Examples
254+--------
255+
256+
257+
258+***
259+### `++un`
260+
261+Reversible scrambling core
262+
263+ ++ un :: =(x (wred (wren x)))
264+ |%
265+
266+A core that contains arms that perform reversible scrambling operations.
267+Used in the `@p` phonetic base.
268+
269+------------------------------------------------------------------------
270+
271+### `++wren`
272+
273+Conceal structure
274+
275+Scrambles a bytestring `pyn` by adding the current position to each
276+byte, looking it up in an s-box, and then performing the XOR operation
277+on the result, pushing it forward. Produces an atom.
278+
279+Accepts
280+-------
281+
282+`pyn` is an [atom]().
283+
284+
285+Produces
286+--------
287+
288+Source
289+------
290+
291+ ++ wren :: conceal structure
292+ |= pyn=@ ^- @
293+ =+ len=(met 3 pyn)
294+ ?: =(0 len)
295+ 0
296+ => .(len (dec len))
297+ =+ mig=(zaft (xafo len (cut 3 [len 1] pyn)))
298+ %+ can 3
299+ %- flop ^- (list ,[@ @])
300+ :- [1 mig]
301+ |- ^- (list ,[@ @])
302+ ?: =(0 len)
303+ ~
304+ => .(len (dec len))
305+ =+ mog=(zyft :(mix mig (end 3 1 len) (cut 3 [len 1] pyn)))
306+ [[1 mog] $(mig mog)]
307+ ::
308+
309+Examples
310+--------
311+
312+ ~zod/try=> `@ux`(wren:un 'testing')
313+ 0x30.bf6a.b9fe.7d8f
314+ ~zod/try=> `@ux`'testing'
315+ 0x67.6e69.7473.6574
316+ ~zod/try=> `@da`(wred:un (wren:un ~2001.2.5))
317+ ~2001.2.5
318+
319+------------------------------------------------------------------------
320+
321+### `++wred`
322+
323+Restore structure
324+
325+Unscrambles a bytestring `cry` by subtracting the current position from
326+each byte, looking it up in an s-box, and performing the XOR operation
327+on the result, pushing it forward. Produces an atom.
328+
329+Accepts
330+-------
331+
332+`cry` is an [atom]().
333+
334+Produces
335+--------
336+
337+Source
338+------
339+
340+ ++ wred :: restore structure
341+ |= cry=@ ^- @
342+ =+ len=(met 3 cry)
343+ ?: =(0 len)
344+ 0
345+ => .(len (dec len))
346+ =+ mig=(cut 3 [len 1] cry)
347+ %+ can 3
348+ %- flop ^- (list ,[@ @])
349+ :- [1 (xaro len (zart mig))]
350+ |- ^- (list ,[@ @])
351+ ?: =(0 len)
352+ ~
353+ => .(len (dec len))
354+ =+ mog=(cut 3 [len 1] cry)
355+ [[1 :(mix mig (end 3 1 len) (zyrt mog))] $(mig mog)]
356+ ::
357+
358+Examples
359+--------
360+
361+ ~zod/try=> (wred:un 0x30.bf6a.b9fe.7d8f)
362+ 29.113.321.805.538.676
363+ ~zod/try=> `@t`(wred:un 0x30.bf6a.b9fe.7d8f)
364+ 'testing'
365+ ~zod/try=> (wred:un (wren:un 200.038.426))
366+ 200.038.426
367+
368+------------------------------------------------------------------------
369+
370+### `++xafo`
371+
372+Add modulo 255
373+
374+Produces the sum of two atoms modulo 255, encoded as a nonzero byte.
375+
376+Accepts
377+-------
378+
379+A cell of two atoms, `a` and `b`.
380+
381+Source
382+------
383+
384+ ++ xafo |=([a=@ b=@] +((mod (add (dec b) a) 255)))
385+
386+Examples
387+--------
388+
389+ ~zod/try=> (xafo:un 5 6)
390+ 11
391+ ~zod/try=> (xafo:un 256 20)
392+ 21
393+
394+------------------------------------------------------------------------
395+
396+### `++xaro`
397+
398+Subtract modulo 255
399+
400+Produces the difference between two atoms modulo 255, encoded as a
401+nonzero byte.
402+
403+Accepts
404+-------
405+
406+A cell of two atoms, `a` and `b`.
407+
408+Produces
409+--------
410+
411+An atom.
412+
413+Source
414+------
415+
416+ ++ xaro |=([a=@ b=@] +((mod (add (dec b) (sub 255 (mod a 255))) 255)))
417+
418+Examples
419+--------
420+
421+ ~zod/try=> (xaro:un 17 57)
422+ 40
423+ ~zod/try=> (xaro:un 265 12)
424+ 2
425+
426+------------------------------------------------------------------------
427+
428+### `++zaft`
429+
430+Look up in 255 sub box
431+
432+The inverse of [`++zart`](). Looks up a nonzero byte`a\` in a substiution
433+box with 255 values, producing a unique nonzero byte.
434+
435+Accepts
436+-------
437+
438+`a` is an atom of one byte in length.
439+
440+
441+Produces
442+--------
443+
444+An atom.
445+
446+Source
447+------
448+
449+ ++ zaft :: forward 255-sbox
450+ |= a=@D
451+ =+ ^= b
452+ 0xcc.75bc.86c8.2fb1.9a42.f0b3.79a0.92ca.21f6.1e41.cde5.fcc0.
453+ 7e85.51ae.1005.c72d.1246.07e8.7c64.a914.8d69.d9f4.59c2.8038.
454+ 1f4a.dca2.6fdf.66f9.f561.a12e.5a16.f7b0.a39f.364e.cb70.7318.
455+ 1de1.ad31.63d1.abd4.db68.6a33.134d.a760.edee.5434.493a.e323.
456+ 930d.8f3d.3562.bb81.0b24.43cf.bea5.a6eb.52b4.0229.06b2.6704.
457+ 78c9.45ec.d75e.58af.c577.b7b9.c40e.017d.90c3.87f8.96fa.1153.
458+ 0372.7f30.1c32.ac83.ff17.c6e4.d36d.6b55.e2ce.8c71.8a5b.b6f3.
459+ 9d4b.eab5.8b3c.e7f2.a8fe.9574.5de0.bf20.3f15.9784.9939.5f9c.
460+ e609.564f.d8a4.b825.9819.94aa.2c08.8e4c.9b22.477a.2840.3ed6.
461+ 3750.6ef1.44dd.89ef.6576.d00a.fbda.9ed2.3b6c.7b0c.bde9.2ade.
462+ 5c88.c182.481a.1b0f.2bfd.d591.2726.57ba
463+ (cut 3 [(dec a) 1] b)
464+ ::
465+
466+Examples
467+--------
468+
469+ ~zod/try=> (zaft:un 0x12)
470+ 42
471+ ~zod/try=> (zaft:un 0xff)
472+ 204
473+ ~zod/try=> (zaft:un 0x0)
474+ ! decrement-underflow
475+ ! exit
476+
477+------------------------------------------------------------------------
478+
479+### `++zart`
480+
481+Reverse look up in 255 sub box
482+
483+The inverse of [`++zaft`](). Looks up the index of a nonzero byte `a` in
484+the substitution box with 255 values, producing a unique nonzero byte.
485+
486+Accepts
487+-------
488+
489+`a` is an atom of one byte in length.
490+
491+Produces
492+--------
493+
494+An atom.
495+
496+Source
497+------
498+
499+ ++ zart :: reverse 255-sbox
500+ |= a=@D
501+ =+ ^= b
502+ 0x68.4f07.ea1c.73c9.75c2.efc8.d559.5125.f621.a7a8.8591.5613.
503+ dd52.40eb.65a2.60b7.4bcb.1123.ceb0.1bd6.3c84.2906.b164.19b3.
504+ 1e95.5fec.ffbc.f187.fbe2.6680.7c77.d30e.e94a.9414.fd9a.017d.
505+ 3a7e.5a55.8ff5.8bf9.c181.e5b6.6ab2.35da.50aa.9293.3bc0.cdc6.
506+ f3bf.1a58.4130.f844.3846.744e.36a0.f205.789e.32d8.5e54.5c22.
507+ 0f76.fce7.4569.0d99.d26e.e879.dc16.2df4.887f.1ffe.4dba.6f5d.
508+ bbcc.2663.1762.aed7.af8a.ca20.dbb4.9bc7.a942.834c.105b.c4d4.
509+ 8202.3e61.a671.90e6.273d.bdab.3157.cfa4.0c2e.df86.2496.f7ed.
510+ 2b48.2a9d.5318.a343.d128.be9c.a5ad.6bb5.6dfa.c5e1.3408.128d.
511+ 2c04.0339.97a1.2ff0.49d0.eeb8.6c0a.0b37.b967.c347.d9ac.e072.
512+ e409.7b9f.1598.1d3f.33de.8ce3.8970.8e7a
513+ (cut 3 [(dec a) 1] b)
514+ ::
515+
516+Examples
517+--------
518+
519+ ~zod/try=> `@ux`(zart:un 204)
520+ 0xff
521+ ~zod/try=> `@ux`(zart:un 42)
522+ 0x12
523+
524+------------------------------------------------------------------------
525+
526+### `++zyft`
527+
528+Lookup byte in 256 sub box
529+
530+The inverse of [`++zyrt`](). Looks up a byte `a` in a substituion box
531+with 256 values, producing a byte.
532+
533+Accepts
534+-------
535+
536+`a` is an [atom]() of one byte in length.
537+
538+Produces
539+--------
540+
541+An atom.
542+
543+Source
544+------
545+
546+ ++ zyft :: forward 256-sbox
547+ |= a=@D
548+ =+ ^= b
549+ 0xbb49.b71f.b881.b402.17e4.6b86.69b5.1647.115f.dddb.7ca5.
550+ 8371.4bd5.19a9.b092.605d.0d9b.e030.a0cc.78ba.5706.4d2d.
551+ 986a.768c.f8e8.c4c7.2f1c.effe.3cae.01c0.253e.65d3.3872.
552+ ce0e.7a74.8ac6.daac.7e5c.6479.44ec.4143.3d20.4af0.ee6c.
553+ c828.deca.0377.249f.ffcd.7b4f.eb7d.66f2.8951.042e.595a.
554+ 8e13.f9c3.a79a.f788.6199.9391.7fab.6200.4ce5.0758.e2f1.
555+ 7594.c945.d218.4248.afa1.e61a.54fb.1482.bea4.96a2.3473.
556+ 63c2.e7cb.155b.120a.4ed7.bfd8.b31b.4008.f329.fca3.5380.
557+ 9556.0cb2.8722.2bea.e96e.3ac5.d1bc.10e3.2c52.a62a.b1d6.
558+ 35aa.d05e.f6a8.0f3b.31ed.559d.09ad.f585.6d21.fd1d.8d67.
559+ 370b.26f4.70c1.b923.4684.6fbd.cf8b.5036.0539.9cdc.d93f.
560+ 9068.1edf.8f33.b632.d427.97fa.9ee1
561+ (cut 3 [a 1] b)
562+ ::
563+
564+Examples
565+--------
566+
567+ ~zod/try=> (zyft:un 0x12)
568+ 57
569+ ~zod/try=> (zyft:un 0x0)
570+ 225
571+ ~zod/try=> (zyft:un 0xff)
572+ 187
573+
574+------------------------------------------------------------------------
575+
576+### `++zyrt`
577+
578+Reverse lookup byte in 256 sub box
579+
580+The inverse of [`++zyft`](/doc/hoon/library/2en#++zyft). Looks up a byte `a` in a substituion box
581+with 256 values, producing a byte.
582+
583+Accepts
584+-------
585+
586+`a` is an [atom]() of one byte in length.
587+
588+Produces
589+--------
590+
591+An atom.
592+
593+Source
594+------
595+
596+ ++ zyrt :: reverse 256-sbox
597+ |= a=@D
598+ =+ ^= b
599+ 0x9fc8.2753.6e02.8fcf.8b35.2b20.5598.7caa.c9a9.30b0.9b48.
600+ 47ce.6371.80f6.407d.00dd.0aa5.ed10.ecb7.0f5a.5c3a.e605.
601+ c077.4337.17bd.9eda.62a4.79a7.ccb8.44cd.8e64.1ec4.5b6b.
602+ 1842.ffd8.1dfb.fd07.f2f9.594c.3be3.73c6.2cb6.8438.e434.
603+ 8d3d.ea6a.5268.72db.a001.2e11.de8c.88d3.0369.4f7a.87e2.
604+ 860d.0991.25d0.16b9.978a.4bf4.2a1a.e96c.fa50.85b5.9aeb.
605+ 9dbb.b2d9.a2d1.7bba.66be.e81f.1946.29a8.f5d2.f30c.2499.
606+ c1b3.6583.89e1.ee36.e0b4.6092.937e.d74e.2f6f.513e.9615.
607+ 9c5d.d581.e7ab.fe74.f01b.78b1.ae75.af57.0ec2.adc7.3245.
608+ 12bf.2314.3967.0806.31dc.cb94.d43f.493c.54a6.0421.c3a1.
609+ 1c4a.28ac.fc0b.26ca.5870.e576.f7f1.616d.905f.ef41.33bc.
610+ df4d.225e.2d56.7fd6.1395.a3f8.c582
611+ (cut 3 [a 1] b)
612+
613+Examples
614+--------
615+
616+ ~zod/try=> `@ux`(zyrt:un 57)
617+ 0x12
618+ ~zod/try=> `@ux`(zyrt:un 225)
619+ 0x0
620+ ~zod/try=> `@ux`(zyrt:un 187)
621+ 0xff
622+
623+
624+***
docs/system/hoon/library/3g.mdnew file+319
@@ -0,0 +1,319 @@
1+## 3g: molds and mold builders
2+### `++coin`
3+
4+Noun literal syntax cases
5+
6+Noun literal syntax cases: atoms, jammed nouns, and nestable tuples.
7+Parsed and printed using [`++so`]() and [`++co`]() cores.
8+
9+Source
10+------
11+
12+ ++ coin $% [%$ p=dime] ::
13+ [%blob p=*] ::
14+ [%many p=(list coin)] ::
15+ == ::
16+
17+Examples
18+--------
19+
20+ ~zod/try=> `coin`(need (slay '~s1'))
21+ [%$ p=[p=~.dr q=18.446.744.073.709.551.616]]
22+ ~zod/try=> `coin`(need (slay '0x2b59'))
23+ [%$ p=[p=~.ux q=11.097]]
24+
25+ ~zod/try=> ~(rend co [%many ~[[%$ %ud 1] [%$ %tas 'a'] [%$ %s -2]]])
26+ "._1_a_-2__"
27+ ~zod/try=> ._1_a_-2__
28+ [1 %a -2]
29+
30+ ~zod/try=> `@uv`(jam [3 4])
31+ 0v2cd1
32+ ~zod/try=> (slay '~02cd1')
33+ [~ [%blob p=[3 4]]]
34+ ~zod/try=> ~02cd1
35+ [3 4]
36+
37+
38+
39+***
40+### `++dime`
41+
42+Odor-atom pair
43+
44+Used in [`++coin`](). Convenience methods [`++scot`]() and [`++scow`]() (in
45+Section 2eL) print dimes as [`++cord`]() and [`++tape`](), respectively.
46+[`++slat`](), [`++slav`](), and [`++slaw`]() are used to parse atoms of
47+specific [odor]()s.
48+
49+Source
50+------
51+
52+ ++ dime ,[p=@ta q=@] ::
53+
54+Examples
55+--------
56+
57+ ~zod/try=> +>:(slay '0x123')
58+ p=[p=~.ux q=291]
59+
60+
61+
62+***
63+### `++edge`
64+
65+Parsing location metadata
66+
67+Optional result `p` and parsing continuation `q`.
68+
69+Source
70+------
71+
72+ ++ edge ,[p=hair q=(unit ,[p=* q=nail])] :: parsing output
73+
74+Examples
75+--------
76+
77+See also: Section 2eD, [`++rule`]()
78+
79+ ~zod/try=> *edge
80+ [p=[p=0 q=0] q=~]
81+ ~zod/try=> (tall:vast [1 1] "a b")
82+ [p=[p=1 q=2] q=[~ [p=[%cnzz p=~[%a]] q=[p=[p=1 q=2] q=" b"]]]]
83+
84+
85+
86+***
87+### `++hair`
88+
89+Parsing line and column
90+
91+A pair of two [`@ud`]() used in parsing indicating line and column number.
92+
93+Source
94+------
95+
96+ ++ hair ,[p=@ud q=@ud] :: parsing trace
97+
98+Examples
99+--------
100+
101+ ~zod/try=> *hair
102+ [p=0 q=0]
103+
104+ ~zod/try=> `hair`[1 1] :: parsing starts at [1 1] as a convention.
105+ [p=1 q=1]
106+ ~zod/try=> ((plus ace) [1 1] " --")
107+ [p=[p=1 q=4] q=[~ u=[p=[~~. " "] q=[p=[p=1 q=4] q="--"]]]]
108+ ~zod/try=> `hair`p:((plus ace) [1 1] " --")
109+ [p=1 q=4]
110+
111+
112+
113+***
114+### `++like`
115+
116+Mold generator for an edge
117+
118+`++like` generates an `++edge` with a parsed result set to a specific type.
119+
120+Source
121+------
122+
123+ ++ like |* a=_,* :: generic edge
124+ ?@ +.b ~ ::
125+ :- ~ ::
126+ u=[p=(a +>-.b) q=[p=(hair -.b) q=(tape +.b)]] ::
127+
128+Examples
129+--------
130+ ~zod/try=> *(like char)
131+ [p=[p=0 q=0] q=~]
132+
133+ ~zod/try=> (ace [1 1] " a")
134+ [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q="a"]]]]
135+ ~zod/try=> `(like char)`(ace [1 1] " a")
136+ [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q="a"]]]]
137+ ~zod/try=> `(like ,@)`(ace [1 1] " a")
138+ [p=[p=1 q=2] q=[~ [p=32 q=[p=[p=1 q=2] q="a"]]]]
139+
140+
141+
142+***
143+### `++nail`
144+
145+Location, remainder of parsed text
146+
147+Indicates parsing position `p`, and remaining text to be parsed `q`.
148+
149+Source
150+------
151+
152+ ++ nail ,[p=hair q=tape] :: parsing input
153+
154+Examples
155+--------
156+
157+ ~zod/try=> +<:;~(plug cab cab)
158+ c=tub=[p=[p=0 q=0] q=""]
159+ ~zod/try=> :: tub is a ++nail
160+
161+
162+
163+***
164+### `++path`
165+
166+Filesystem path
167+
168+A `++path` is a list of [`++span`]()s aka [`@ta`](). Used in
169+`%clay` and `%eyre` extensively.
170+
171+Source
172+------
173+
174+ ++ path (list span) :: filesys location
175+
176+Examples
177+--------
178+
179+ ~zod/try=> `path`"abc"
180+ /a/b/c
181+
182+
183+
184+***
185+### `++pint`
186+
187+Parsing range
188+
189+Mostly used for stacktraces. A `++pint` is a pair of
190+[`++hair`](), indicating from `p` to `q`.
191+
192+Source
193+------
194+
195+ ++ pint ,[p=[p=@ q=@] q=[p=@ q=@]] :: line/column range
196+
197+Examples
198+--------
199+
200+ ~zod/try=> !:(!!)
201+ ! /~zod/try/~2014.9.20..01.22.04..52e3/:<[1 4].[1 6]>
202+ ~zod/try=> :: !! always produces a crash
203+ ~zod/try=> `pint`[[1 4] [1 6]]
204+ [p=[p=1 q=4] q=[p=1 q=6]]
205+
206+
207+
208+***
209+### `++rule`
210+
211+Parsing rule
212+
213+`++rule` is an empty parsing rule, but it is used to check
214+that parsing rules match this with `_`.
215+
216+
217+Source
218+------
219+
220+ ++ rule |=(tub=nail `edge`[p.tub ~ ~ tub]) :: parsing rule
221+
222+Examples
223+--------
224+
225+ ~zod/try=> *rule
226+ [p=[p=0 q=0] q=[~ [p=0 q=[p=[p=0 q=0] q=""]]]]
227+
228+ ~zod/try=> ^+(rule [|=(a=nail [p.a ~])]:|6)
229+ <1.dww [tub=[p=[p=@ud q=@ud] q=""] <101.jzo 1.ypj %164>]>
230+ ~zod/try=> (^+(rule [|=(a=nail [p.a ~ u=['a' a]])]:|6) [1 1] "hi")
231+ [p=[p=1 q=1] q=[~ [p=97 q=[p=[p=1 q=1] q="hi"]]]]
232+ ~zod/try=> ([|=(a=nail [p.a ~ u=['a' a]])]:|6 [1 1] "hi")
233+ [[p=1 q=1] ~ u=['a' p=[p=1 q=1] q="hi"]]
234+
235+
236+
237+***
238+### `++spot`
239+
240+Stack trace line
241+
242+A [`++spot`]() is what we print after crashing.
243+
244+Source
245+------
246+
247+ ++ spot ,[p=path q=pint] :: range in file
248+
249+Examples
250+--------
251+
252+ ~zod/try=> :into /=main=/bin/fail/hoon '!: !!'
253+ + /~zod/main/359/bin/fail/hoon
254+ ~zod/try=> :fail
255+ ! /~zod/main/~2014.9.22..18.40.56..ef04/bin/fail/:<[1 5].[1 7]>
256+ ! exit
257+
258+
259+
260+***
261+### `++toon`
262+
263+Nock computation result
264+
265+Either success (`%0`), a block with list of requests blocked on (`%1`), or
266+failure with stack trace (`%2`).
267+
268+Source
269+------
270+
271+ ++ toon $% [%0 p=*] :: success
272+
273+Examples
274+--------
275+ ~zod/try=> (mock [[20 21] 0 3] ,~)
276+ [%0 p=21]
277+
278+ ~zod/try=> (mock [[0] !=(.^(cy//=main/1))] ,~)
279+ [%1 p=~[[31.075 1.685.027.454 1.852.399.981 49 0]]]
280+ ~zod/try=> (path [31.075 1.685.027.454 1.852.399.981 49 0])
281+ /cy/~zod/main/1
282+
283+ ~zod/try=> (mock [[1 2] !=(!:(+(.)))] ,~)
284+ [%2 p=~[[%leaf p="/~zod/try/~2014.9.23..18.34.32..d3c5/:<[1 20].[1 24]>"]]]
285+
286+
287+
288+***
289+### `++wonk`
290+
291+XX Not a model?
292+
293+Pull result out of a `++edge`, or crash if there's no result.
294+
295+Source
296+------
297+
298+ ++ wonk |*(veq=edge ?~(q.veq !! p.u.q.veq)) ::
299+
300+Examples
301+--------
302+
303+See also: [`++edge`]()
304+
305+ ~zod/try=> (wide:vast [1 1] "(add 2 2)")
306+ [ p=[p=1 q=10]
307+ q
308+ [ ~
309+ [ p=[%cnhp p=[%cnzz p=~[%add]] q=~[[%dtzy p=%ud q=2] [%dtzy p=%ud q=2]]]
310+ q=[p=[p=1 q=10] q=""]
311+ ]
312+ ]
313+ ]
314+ ~zod/try=> (wonk (wide:vast [1 1] "(add 2 2)"))
315+ [%cnhp p=[%cnzz p=~[%add]] q=~[[%dtzy p=%ud q=2] [%dtzy p=%ud q=2]]]
316+
317+
318+
319+***
docs/system/hoon/library/4a.mdnew file+203
@@ -0,0 +1,203 @@
1+## 4a: exotic bases
2+### `++po`
3+
4+++ po
5+ ~/ %po
6+ =+ :- ^= sis :: prefix syllables
7+ 'dozmarbinwansamlitsighidfidlissogdirwacsabwissib\
8+ /rigsoldopmodfoglidhopdardorlorhodfolrintogsilmir\
9+ /holpaslacrovlivdalsatlibtabhanticpidtorbolfosdot\
10+ /losdilforpilramtirwintadbicdifrocwidbisdasmidlop\
11+ /rilnardapmolsanlocnovsitnidtipsicropwitnatpanmin\
12+ /ritpodmottamtolsavposnapnopsomfinfonbanporworsip\
13+ /ronnorbotwicsocwatdolmagpicdavbidbaltimtasmallig\
14+ /sivtagpadsaldivdactansidfabtarmonranniswolmispal\
15+ /lasdismaprabtobrollatlonnodnavfignomnibpagsopral\
16+ /bilhaddocridmocpacravripfaltodtiltinhapmicfanpat\
17+ /taclabmogsimsonpinlomrictapfirhasbosbatpochactid\
18+ /havsaplindibhosdabbitbarracparloddosbortochilmac\
19+ /tomdigfilfasmithobharmighinradmashalraglagfadtop\
20+ /mophabnilnosmilfopfamdatnoldinhatnacrisfotribhoc\
21+ /nimlarfitwalrapsarnalmoslandondanladdovrivbacpol\
22+ /laptalpitnambonrostonfodponsovnocsorlavmatmipfap'
23+ ^= dex :: suffix syllables
24+ 'zodnecbudwessevpersutletfulpensytdurwepserwylsun\
25+ /rypsyxdyrnuphebpeglupdepdysputlughecryttyvsydnex\
26+ /lunmeplutseppesdelsulpedtemledtulmetwenbynhexfeb\
27+ /pyldulhetmevruttylwydtepbesdexsefwycburderneppur\
28+ /rysrebdennutsubpetrulsynregtydsupsemwynrecmegnet\
29+ /secmulnymtevwebsummutnyxrextebfushepbenmuswyxsym\
30+ /selrucdecwexsyrwetdylmynmesdetbetbeltuxtugmyrpel\
31+ /syptermebsetdutdegtexsurfeltudnuxruxrenwytnubmed\
32+ /lytdusnebrumtynseglyxpunresredfunrevrefmectedrus\
33+ /bexlebduxrynnumpyxrygryxfeptyrtustyclegnemfermer\
34+ /tenlusnussyltecmexpubrymtucfyllepdebbermughuttun\
35+ /bylsudpemdevlurdefbusbeprunmelpexdytbyttyplevmyl\
36+ /wedducfurfexnulluclennerlexrupnedlecrydlydfenwel\
37+ /nydhusrelrudneshesfetdesretdunlernyrsebhulryllud\
38+ /remlysfynwerrycsugnysnyllyndyndemluxfedsedbecmun\
39+ /lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes'
40+ |%
41+
42+Provides the phonetic syllables and name generators for the Urbit naming
43+system. The two faces, `sis` and `dex` are available to the arms
44+contained in this section.
45+
46+
47+------------------------------------------------------------------------
48+
49+### `++ind`
50+
51+Parse prefix
52+
53+Produces the byte of the right-hand syllable `a`.
54+
55+Accepts
56+-------
57+
58+`a` is an [atom]().
59+
60+Produces
61+--------
62+
63+A [`++unit`]() of an atom.
64+
65+Source
66+------
67+
68+ ++ ind ~/ %ind :: parse prefix
69+ |= a=@
70+ =+ b=0
71+ |- ^- (unit ,@)
72+ ?:(=(256 b) ~ ?:(=(a (tod b)) [~ b] $(b +(b))))
73+
74+Examples
75+--------
76+
77+ ~zod/try=> (ind:po 'zod')
78+ [~ 0]
79+ ~zod/try=> (ind:po 'zam')
80+ ~
81+ ~zod/try=> (ind:po 'del')
82+ [~ 37]
83+
84+------------------------------------------------------------------------
85+
86+### `++ins`
87+
88+Parse suffix
89+
90+Produces the byte of the left-hand phonetic syllable `b`.
91+
92+Accepts
93+-------
94+
95+`a` is an [atom]().
96+
97+Produces
98+--------
99+A [`++unit`]() of an atom.
100+
101+Source
102+------
103+
104+ ++ ins ~/ %ins :: parse suffix
105+ |= a=@
106+ =+ b=0
107+ |- ^- (unit ,@)
108+ ?:(=(256 b) ~ ?:(=(a (tos b)) [~ b] $(b +(b))))
109+
110+Examples
111+--------
112+
113+ ~zod/try=> (ins:po 'mar')
114+ [~ 1]
115+ ~zod/try=> (ins:po 'son')
116+ [~ 164]
117+ ~zod/try=> (ins:po 'pit')
118+ [~ 242]
119+ ~zod/try=> (ins:po 'pok')
120+ ~
121+
122+------------------------------------------------------------------------
123+
124+### `++tod`
125+
126+Fetch prefix
127+
128+Produces the phonetic prefix syllable from index `a` within `dex` as an
129+[atom]().
130+
131+Accepts
132+-------
133+
134+`a` is an atom
135+
136+Produces
137+--------
138+
139+An atom.
140+
141+
142+Source
143+------
144+
145+ ++ tod ~/ %tod :: fetch prefix
146+ |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] dex)))
147+
148+Examples
149+--------
150+
151+ ~zod/try=> `@t`(tod:po 1)
152+ 'nec'
153+ ~zod/try=> `@t`(tod:po 98)
154+ 'dec'
155+ ~zod/try=> `@t`(tod:po 0)
156+ 'zod'
157+ ~zod/try=> `@t`(tod:po 150)
158+ 'ryg'
159+ ~zod/try=> `@t`(tod:po 255)
160+ 'fes'
161+ ~zod/try=> `@t`(tod:po 256)
162+ ! exit
163+
164+------------------------------------------------------------------------
165+
166+### `++tos`
167+
168+Fetch suffix
169+
170+Produces the phonetic prefix syllable from index `a` within `sis` as an
171+[atom]().
172+
173+Accepts
174+-------
175+
176+`a` is an atom.
177+
178+Produces
179+--------
180+
181+An atom.
182+
183+Source
184+------
185+
186+ ++ tos ~/ %tos :: fetch suffix
187+ |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] sis)))
188+
189+Examples
190+--------
191+
192+ ~zod/try=> `@t`(tos:po 0)
193+ 'doz'
194+ ~zod/try=> `@t`(tos:po 120)
195+ 'fab'
196+ ~zod/try=> `@t`(tos:po 43)
197+ 'pid'
198+ ~zod/try=> `@t`(tos:po 253)
199+ 'mat'
200+
201+------------------------------------------------------------------------
202+
203+***
docs/system/hoon/library/4b.mdnew file+977
@@ -0,0 +1,977 @@
1+## 4b: text processing
2+
3+### `++cass`
4+
5+To lowercase
6+
7+Produce the case insensitive (all lowercase) [`++cord`]() of a [`++tape`]().
8+
9+Accepts
10+-------
11+
12+`vib` is a `++tape`.
13+
14+Produces
15+--------
16+
17+A `++cord`.
18+
19+Source
20+------
21+
22+ ++ cass :: lowercase
23+ |= vib=tape
24+ %+ rap 3
25+ (turn vib |=(a=@ ?.(&((gte a 'A') (lte a 'Z')) a (add 32 a))))
26+ ::
27+
28+Examples
29+--------
30+
31+ ~zod/try=> (cass "john doe")
32+ 7.309.170.810.699.673.450
33+ ~zod/try=> `cord`(cass "john doe")
34+ 'john doe'
35+ ~zod/try=> (cass "abc, 123, !@#")
36+ 2.792.832.775.110.938.439.066.079.945.313
37+ ~zod/try=> `cord`(cass "abc, 123, !@#")
38+ 'abc, 123, !@#'
39+
40+
41+***
42+### `++crip`
43+
44+Tape to cord
45+
46+Produce a [`++cord`]() from a [`++tape`]().
47+
48+Accepts
49+-------
50+
51+`a` is a `++tape`.
52+
53+Produces
54+--------
55+
56+A `++cord`.
57+
58+Source
59+------
60+
61+ ++ crip |=(a=tape `@t`(rap 3 a)) :: tape to cord
62+
63+Examples
64+--------
65+
66+ ~zod/try=> (crip "john doe")
67+ 'john doe'
68+ ~zod/try=> (crip "abc 123 !@#")
69+ 'abc 123 !@#'
70+ ~zod/try=> `@ud`(crip "abc")
71+ 6.513.249
72+
73+
74+***
75+### `++cuss`
76+
77+To uppercase
78+
79+Turn all occurances of lowercase letters in any [`++tape`]() into uppercase
80+letters, as a [`++cord`]().
81+
82+Accepts
83+-------
84+
85+`vib` is a `++tape`.
86+
87+Produces
88+--------
89+
90+A `++cord`.
91+
92+Source
93+------
94+
95+ ++ cuss :: uppercase
96+ |= vib=tape
97+ ^- @t
98+ %+ rap 3
99+ (turn vib |=(a=@ ?.(&((gte a 'a') (lte a 'z')) a (sub a 32))))
100+ ::
101+
102+Examples
103+--------
104+
105+ ~zod/try=> (cuss "john doe")
106+ 'JOHN DOE'
107+ ~zod/try=> (cuss "abc ABC 123 !@#")
108+ 'ABC ABC 123 !@#'
109+ ~zod/try=> `@ud`(cuss "abc")
110+ 4.407.873
111+ ~zod/try=> (cuss "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsQqRrVvWwXxYyZz")
112+ 'AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSQQRRVVWWXXYYZZ'
113+
114+
115+***
116+### `++mesc`
117+
118+Escape special chars
119+
120+Escape special characters, used in [`++show`](/doc/hoon/library/2ez#++show)
121+
122+Accepts
123+-------
124+
125+`vib` is a [`++tape`]().
126+
127+Produces
128+--------
129+
130+A `++tape`.
131+
132+Source
133+------
134+
135+ ++ mesc :: ctrl code escape
136+ |= vib=tape
137+ ^- tape
138+ ?~ vib
139+ ~
140+ ?: =('\\' i.vib)
141+ ['\\' '\\' $(vib t.vib)]
142+ ?: ?|((gth i.vib 126) (lth i.vib 32) =(39 i.vib))
143+ ['\\' (welp ~(rux at i.vib) '/' $(vib t.vib))]
144+ [i.vib $(vib t.vib)]
145+ ::
146+
147+Examples
148+--------
149+
150+ /~zod/try=> (mesc "ham lus")
151+ "ham lus"
152+ /~zod/try=> (mesc "bas\\hur")
153+ "bas\\\\hur"
154+ /~zod/try=> (mesc "as'saß")
155+ "as\0x27/sa\0xc3/\0x9f/"
156+
157+
158+
159+***
160+### `++runt`
161+
162+Prepend `n` times
163+
164+Add `a` repetitions of character `b` to the head of [`++tape`]() `c`.
165+
166+Accepts
167+-------
168+
169+`a` and `b` are atoms.
170+
171+`c` is a `++tape`.
172+
173+Produces
174+--------
175+
176+A `++tape`.
177+
178+Source
179+------
180+
181+ ++ runt :: prepend repeatedly
182+ |= [[a=@ b=@] c=tape]
183+ ^- tape
184+ ?: =(0 a)
185+ c
186+ [b $(a (dec a))]
187+ ::
188+
189+Examples
190+--------
191+
192+ /~zod/try=> (runt [2 '/'] "ham")
193+ "//ham"
194+ /~zod/try=> (runt [10 'a'] "")
195+ "aaaaaaaaaa"
196+
197+
198+
199+***
200+### `++sand`
201+
202+Soft-cast by odor
203+
204+Soft-cast validity by [odor]().
205+
206+Accepts
207+-------
208+
209+`a` is a [`++span`]() (`@ta`).
210+
211+`b` is an atom.
212+
213+Produces
214+--------
215+
216+A `(unit ,@)`.
217+
218+Source
219+------
220+
221+ ++ sand :: atom sanity
222+ |= a=@ta
223+ |= b=@ ^- (unit ,@)
224+ ?.(((sane a) b) ~ [~ b])
225+ ::
226+
227+Examples
228+--------
229+
230+ /~zod/try=> `(unit ,@ta)`((sand %ta) 'sym-som')
231+ [~ ~.sym-som]
232+ /~zod/try=> `(unit ,@ta)`((sand %ta) 'err!')
233+ ~
234+
235+
236+
237+***
238+### `++sane`
239+
240+Check odor validity
241+
242+Check validity by [odor](). Produces a [gate]().
243+
244+Accepts
245+-------
246+
247+`a` is a [`++span`]() (`@ta`).
248+
249+`b` is an [atom]().
250+
251+Produces
252+--------
253+
254+A boolean.
255+
256+Source
257+------
258+
259+ ++ sane :: atom sanity
260+ |= a=@ta
261+ |= b=@ ^- ?
262+ ?. =(%t (end 3 1 a))
263+ ~|(%sane-stub !!)
264+ =+ [inx=0 len=(met 3 b)]
265+ ?: =(%tas a)
266+ |- ^- ?
267+ ?: =(inx len) &
268+ =+ cur=(cut 3 [inx 1] b)
269+ ?& ?| &((gte cur 'a') (lte cur 'z'))
270+ &(=('-' cur) !=(0 inx) !=(len inx))
271+ &(&((gte cur '0') (lte cur '9')) !=(0 inx))
272+ ==
273+ $(inx +(inx))
274+ ==
275+ ?: =(%ta a)
276+ |- ^- ?
277+ ?: =(inx len) &
278+ =+ cur=(cut 3 [inx 1] b)
279+ ?& ?| &((gte cur 'a') (lte cur 'z'))
280+ &((gte cur '0') (lte cur '9'))
281+ |(=('-' cur) =('~' cur) =('_' cur) =('.' cur))
282+ ==
283+ $(inx +(inx))
284+ ==
285+ |- ^- ?
286+ ?: =(0 b) &
287+ =+ cur=(end 3 1 b)
288+ ?: &((lth cur 32) !=(10 cur)) |
289+ =+ len=(teff cur)
290+ ?& |(=(1 len) =+(i=1 |-(|(=(i len) &((gte (cut 3 [i 1] b) 128) $(i +(i)))))))
291+ $(b (rsh 3 len b))
292+ ==
293+ ::
294+
295+Examples
296+--------
297+
298+ /~zod/try=> ((sane %tas) %mol)
299+ %.y
300+ /~zod/try=> ((sane %tas) 'lam')
301+ %.y
302+ /~zod/try=> ((sane %tas) 'more ace')
303+ %.n
304+
305+
306+
307+***
308+### `++teff`
309+
310+UTF8 Length
311+
312+Produces the number of utf8 bytes.
313+
314+Accepts
315+-------
316+
317+`a` is a [`@t`]().
318+
319+Produces
320+--------
321+
322+An atom.
323+
324+Source
325+------
326+
327+ ++ teff :: length utf8
328+ |= a=@t ^- @
329+ =+ b=(end 3 1 a)
330+ ?: =(0 b)
331+ ?>(=(0 a) 0)
332+ ?> |((gte b 32) =(10 b))
333+ ?:((lte b 127) 1 ?:((lte b 223) 2 ?:((lte b 239) 3 4)))
334+ ::
335+
336+Examples
337+--------
338+
339+ /~zod/try=> (teff 'a')
340+ 1
341+ /~zod/try=> (teff 'ß')
342+ 2
343+
344+
345+
346+***
347+### `++trim`
348+
349+Tape split
350+
351+Split first `a` characters off [`++tape`]() `b`.
352+
353+Accepts
354+-------
355+
356+`a` is an atom.
357+
358+`b` is a `++tape`.
359+
360+Produces
361+--------
362+
363+A cell of `++tape`s, `p` and `q`.
364+
365+Source
366+------
367+
368+ ++ trim :: tape split
369+ |= [a=@ b=tape]
370+ ^- [p=tape q=tape]
371+ ?~ b
372+ [~ ~]
373+ ?: =(0 a)
374+ [~ b]
375+ =+ c=$(a (dec a), b t.b)
376+ [[i.b p.c] q.c]
377+ ::
378+
379+Examples
380+--------
381+
382+ /~zod/try=> (trim 5 "lasok termun")
383+ [p="lasok" q=" termun"]
384+ /~zod/try=> (trim 5 "zam")
385+ [p="zam" q=""]
386+
387+
388+
389+***
390+### `++trip`
391+
392+Cord to tape
393+
394+Produce a [`++tape`]() from [`++cord`]().
395+
396+Accepts
397+-------
398+
399+`a` is an atom.
400+
401+Produces
402+--------
403+
404+A `++tape`.
405+
406+Source
407+------
408+
409+ ++ trip :: cord to tape
410+ ~/ %trip
411+ |= a=@ ^- tape
412+ ?: =(0 (met 3 a))
413+ ~
414+ [^-(@ta (end 3 1 a)) $(a (rsh 3 1 a))]
415+ ::
416+
417+Examples
418+--------
419+
420+ /~zod/try=> (trip 'john doe')
421+ "john doe"
422+ /~zod/try=> (trip 'abc 123 !@#')
423+ "abc 123 !@#"
424+ /~zod/try=> (trip 'abc')
425+ "abc"
426+
427+
428+
429+***
430+### `++tuba`
431+
432+UTF8 to UTF32 tape
433+
434+Convert [`++tape`]() to a [`++list`]() of codepoints ([`@c`]()).
435+
436+Accepts
437+-------
438+
439+`a` is a `++tape`.
440+
441+Produces
442+--------
443+
444+A `++list` of codepoints [`@c`]().
445+
446+Source
447+------
448+
449+ ++ tuba :: utf8 to utf32 tape
450+ |= a=tape
451+ ^- (list ,@c)
452+ (rip 5 (turf (rap 3 a))) :: XX horrible
453+ ::
454+
455+Examples
456+--------
457+
458+ /~zod/try=> (tuba "я тут")
459+ ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.]
460+ /~zod/try=> (tuba "chars")
461+ ~[~-c ~-h ~-a ~-r ~-s]
462+
463+
464+
465+***
466+### `++tufa`
467+
468+UTF32 to UTF8 tape
469+
470+Wrap a [`++list`]() of utf32 codepoints into a utf8 [`++tape`]().
471+
472+Accepts
473+-------
474+
475+`a` is a `++list` of [`@c`]().
476+
477+Produces
478+--------
479+
480+A `++tape`.
481+
482+Source
483+------
484+
485+ ++ tufa :: utf32 to utf8 tape
486+ |= a=(list ,@c)
487+ ^- tape
488+ ?~ a ""
489+ (weld (rip 3 (tuft i.a)) $(a t.a))
490+ ::
491+
492+Examples
493+--------
494+
495+ /~zod/try=> (tufa ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.])
496+ "я тут"
497+ /~zod/try=> (tufa ((list ,@c) ~[%a %b 0xb1 %c]))
498+ "ab±c"
499+
500+
501+
502+***
503+### `++tuft`
504+
505+UTF32 to UTF8 text
506+
507+Convert utf32 glyph to
508+[LSB](http://en.wikipedia.org/wiki/Least_significant_bit) utf8 [`++cord`]().
509+
510+Accepts
511+-------
512+
513+`a` is a codepoint ([`@c`]()).
514+
515+Produces
516+--------
517+
518+A `++cord`.
519+
520+Source
521+------
522+
523+ ++ tuft :: utf32 to utf8 text
524+ |= a=@c
525+ ^- @t
526+ %+ rap 3
527+ |- ^- (list ,@)
528+ ?: =(0 a)
529+ ~
530+ =+ b=(end 5 1 a)
531+ =+ c=$(a (rsh 5 1 a))
532+ ?: (lth b 0x7f)
533+ [b c]
534+ ?: (lth b 0x7ff)
535+ :* (mix 0b1100.0000 (cut 0 [6 5] b))
536+ (mix 0b1000.0000 (end 0 6 b))
537+ c
538+ ==
539+ ?: (lth b 0xffff)
540+ :* (mix 0b1110.0000 (cut 0 [12 4] b))
541+ (mix 0b1000.0000 (cut 0 [6 6] b))
542+ (mix 0b1000.0000 (end 0 6 b))
543+ c
544+ ==
545+ :* (mix 0b1111.0000 (cut 0 [18 3] b))
546+ (mix 0b1000.0000 (cut 0 [12 6] b))
547+ (mix 0b1000.0000 (cut 0 [6 6] b))
548+ (mix 0b1000.0000 (end 0 6 b))
549+ c
550+ ==
551+ ::
552+
553+Examples
554+--------
555+
556+ /~zod/try=> (tuft `@c`%a)
557+ 'a'
558+ /~zod/try=> (tuft `@c`0xb6)
559+ '¶'
560+
561+
562+
563+***
564+### `++turf`
565+
566+UTF8 to UTF32 cord
567+
568+Convert utf8 ([`++cord`]()) to utf32 codepoints.
569+
570+Accepts
571+-------
572+
573+`a` is a [`@t`]().
574+
575+Produces
576+--------
577+
578+A [`@c`](), UTF-32 codepoint.
579+
580+Source
581+------
582+
583+ ++ turf :: utf8 to utf32
584+ |= a=@t
585+ ^- @c
586+ %+ rap 5
587+ |- ^- (list ,@c)
588+ =+ b=(teff a)
589+ ?: =(0 b) ~
590+ :- %+ can 0
591+ %+ turn
592+ ^- (list ,[p=@ q=@])
593+ ?+ b !!
594+ 1 [[0 7] ~]
595+ 2 [[8 6] [0 5] ~]
596+ 3 [[16 6] [8 6] [0 4] ~]
597+ 4 [[24 6] [16 6] [8 6] [0 3] ~]
598+ ==
599+ |=([p=@ q=@] [q (cut 0 [p q] a)])
600+ $(a (rsh 3 b a))
601+ ::
602+
603+Examples
604+--------
605+
606+ /~zod/try=> (turf 'my ßam')
607+ ~-my.~df.am
608+ /~zod/try=> 'я тут'
609+ 'я тут'
610+ /~zod/try=> (turf 'я тут')
611+ ~-~44f..~442.~443.~442.
612+ /~zod/try=> `@ux`'я тут'
613+ 0x82.d183.d182.d120.8fd1
614+ /~zod/try=> `@ux`(turf 'я тут')
615+ 0x442.0000.0443.0000.0442.0000.0020.0000.044f
616+
617+
618+
619+***
620+### `++wack`
621+
622+Coin format encode
623+
624+Escape [`++span`]() `~` as `~~` and `_` as `~-`. Used for printing.
625+
626+Accepts
627+-------
628+
629+`a` is a `++span` (`@ta`).
630+
631+Produces
632+--------
633+
634+A [`++span`]() (`@ta`).
635+
636+Source
637+------
638+
639+ ++ wack :: coin format
640+ |= a=@ta
641+ ^- @ta
642+ =+ b=(rip 3 a)
643+ %+ rap 3
644+ |- ^- tape
645+ ?~ b
646+ ~
647+ ?: =('~' i.b) ['~' '~' $(b t.b)]
648+ ?: =('_' i.b) ['~' '-' $(b t.b)]
649+ [i.b $(b t.b)]
650+ ::
651+
652+Examples
653+--------
654+
655+ /~zod/try=> (wack '~20_sam~')
656+ ~.~~20~-sam~~
657+ /~zod/try=> `@t`(wack '~20_sam~')
658+ '~~20~-sam~~'
659+ ~zod/try=> ~(rend co %many ~[`ud/5 `ta/'~20_sam'])
660+ "._5_~~.~~20~-sam__"
661+ ~zod/try=> ._5_~~.~~20~-sam__
662+ [5 ~.~20_sam]
663+
664+
665+
666+***
667+### `++wick`
668+
669+Coin format decode
670+
671+Unescape [`++span`]() `~~` as `~` and `~-` as `_`.
672+
673+Accepts
674+-------
675+
676+`a` is a an [atom]().
677+
678+Produces
679+--------
680+
681+A [`++span`]() `@ta`.
682+
683+Source
684+------
685+
686+ ++ wick :: coin format
687+ |= a=@
688+ ^- @ta
689+ =+ b=(rip 3 a)
690+ %+ rap 3
691+ |- ^- tape
692+ ?~ b
693+ ~
694+ ?: =('~' i.b)
695+ ?~ t.b !!
696+ [?:(=('~' i.t.b) '~' ?>(=('-' i.t.b) '_')) $(b t.t.b)]
697+ [i.b $(b t.b)]
698+ ::
699+
700+Examples
701+--------
702+
703+ /~zod/try=> `@t`(wick '~-ams~~lop')
704+ '_ams~lop'
705+ /~zod/try=> `@t`(wick (wack '~20_sam~'))
706+ '~20_sam~'
707+
708+
709+
710+***
711+### `++woad`
712+
713+Unescape cord
714+
715+Unescape [`++cord`]() codepoints.
716+
717+Accepts
718+-------
719+
720+`a` is a [`@ta`]().
721+
722+Produces
723+--------
724+
725+A [`++cord`]().
726+
727+Source
728+------
729+
730+ ++ woad :: cord format
731+ |= a=@ta
732+ ^- @t
733+ %+ rap 3
734+ |- ^- (list ,@)
735+ ?: =(0 a)
736+ ~
737+ =+ b=(end 3 1 a)
738+ =+ c=(rsh 3 1 a)
739+ ?: =('.' b)
740+ [' ' $(a c)]
741+ ?. =('~' b)
742+ [b $(a c)]
743+ => .(b (end 3 1 c), c (rsh 3 1 c))
744+ ?+ b =- (weld (rip 3 (tuft p.d)) $(a q.d))
745+ ^= d
746+ =+ d=0
747+ |- ^- [p=@ q=@]
748+ ?: =('.' b)
749+ [d c]
750+ ?< =(0 c)
751+ %= $
752+ b (end 3 1 c)
753+ c (rsh 3 1 c)
754+ d %+ add (mul 16 d)
755+ %+ sub b
756+ ?: &((gte b '0') (lte b '9')) 48
757+ ?>(&((gte b 'a') (lte b 'z')) 87)
758+ ==
759+ %'.' ['.' $(a c)]
760+ %'~' ['~' $(a c)]
761+ ==
762+ ::
763+
764+Examples
765+--------
766+
767+ /~zod/try=> (woad ~.~b6.20.as)
768+ '¶20 as'
769+
770+
771+
772+***
773+### `++wood`
774+
775+Escape cord
776+
777+Escape [`++cord`]() codepoints.
778+
779+Accepts
780+-------
781+
782+`a` is a [`++span`]() (`@ta`).
783+
784+Produces
785+--------
786+
787+A [`++span`]() (`@ta`).
788+
789+Source
790+------
791+
792+ ++ wood :: cord format
793+ |= a=@t
794+ ^- @ta
795+ %+ rap 3
796+ |- ^- (list ,@)
797+ ?: =(0 a)
798+ ~
799+ =+ b=(teff a)
800+ =+ c=(turf (end 3 b a))
801+ =+ d=$(a (rsh 3 b a))
802+ ?: ?| &((gte c 'a') (lte c 'z'))
803+ &((gte c '0') (lte c '9'))
804+ =('-' c)
805+ ==
806+ [c d]
807+ ?+ c
808+ :- '~'
809+ =+ e=(met 2 c)
810+ |- ^- tape
811+ ?: =(0 c)
812+ ['.' d]
813+ =. e (dec e)
814+ =+ f=(rsh 2 e c)
815+ [(add ?:((lte f 9) 48 87) f) $(c (end 2 e c))]
816+ ::
817+ %' ' ['.' d]
818+ %'.' ['~' '.' d]
819+ %'~' ['~' '~' d]
820+ ==
821+
822+Examples
823+--------
824+
825+ /~zod/try=> (wood 'my ßam')
826+ ~.my.~df.am
827+
828+
829+***
830+### `++at`
831+
832+ ++ at
833+ |_ a=@
834+
835+XX document
836+
837+### `++r`
838+
839+ ++ r
840+ ?: ?& (gte (met 3 a) 2)
841+ |-
842+ ?: =(0 a)
843+ &
844+ =+ vis=(end 3 1 a)
845+ ?& ?|(=('-' vis) ?&((gte vis 'a') (lte vis 'z')))
846+ $(a (rsh 3 1 a))
847+ ==
848+ ==
849+ rtam
850+ ?: (lte (met 3 a) 2)
851+ rud
852+ rux
853+ ::
854+
855+XX document
856+
857+### `++rf`
858+
859+ ++ rf `tape`[?-(a & '&', | '|', * !!) ~]
860+
861+XX document
862+
863+### `++rn`
864+
865+ ++ rn `tape`[?>(=(0 a) '~') ~]
866+
867+XX document
868+
869+### `++rt`
870+
871+ ++ rt `tape`['\'' (weld (mesc (trip a)) `tape`['\'' ~])]
872+
873+XX document
874+
875+### `++rta`
876+
877+ ++ rta rt
878+
879+XX document
880+
881+### `++rtam`
882+
883+ ++ rtam `tape`['%' (trip a)]
884+
885+XX document
886+
887+### `++rub`
888+
889+ ++ rub `tape`['0' 'b' (rum 2 ~ |=(b=@ (add '0' b)))]
890+
891+XX document
892+
893+### `++rud`
894+
895+ ++ rud (rum 10 ~ |=(b=@ (add '0' b)))
896+
897+XX document
898+
899+### `++rum`
900+
901+ ++ rum
902+ |= [b=@ c=tape d=$+(@ @)]
903+ ^- tape
904+ ?: =(0 a)
905+ [(d 0) c]
906+ =+ e=0
907+ |- ^- tape
908+ ?: =(0 a)
909+ c
910+ =+ f=&(!=(0 e) =(0 (mod e ?:(=(10 b) 3 4))))
911+ %= $
912+ a (div a b)
913+ c [(d (mod a b)) ?:(f [?:(=(10 b) ',' '-') c] c)]
914+ e +(e)
915+ ==
916+ ::
917+
918+XX document
919+
920+### `++rup`
921+
922+ ++ rup
923+ =+ b=(met 3 a)
924+ ^- tape
925+ :- '-'
926+ |- ^- tape
927+ ?: (gth (met 5 a) 1)
928+ %+ weld
929+ $(a (rsh 5 1 a), b (sub b 4))
930+ `tape`['-' '-' $(a (end 5 1 a), b 4)]
931+ ?: =(0 b)
932+ ['~' ~]
933+ ?: (lte b 1)
934+ (trip (tos:po a))
935+ |- ^- tape
936+ ?: =(2 b)
937+ =+ c=(rsh 3 1 a)
938+ =+ d=(end 3 1 a)
939+ (weld (trip (tod:po c)) (trip (tos:po (mix c d))))
940+ =+ c=(rsh 3 2 a)
941+ =+ d=(end 3 2 a)
942+ (weld ^$(a c, b (met 3 c)) `tape`['-' $(a (mix c d), b 2)])
943+ ::
944+
945+XX document
946+
947+### `++ruv`
948+
949+ ++ ruv
950+ ^- tape
951+ :+ '0'
952+ 'v'
953+ %^ rum
954+ 64
955+ ~
956+ |= b=@
957+ ?: =(63 b)
958+ '+'
959+ ?: =(62 b)
960+ '-'
961+ ?:((lth b 26) (add 65 b) ?:((lth b 52) (add 71 b) (sub b 4)))
962+ ::
963+
964+XX document
965+
966+### `++rux`
967+
968+ ++ rux `tape`['0' 'x' (rum 16 ~ |=(b=@ (add b ?:((lth b 10) 48 87))))]
969+ --
970+ :::::::::::::::::::::::::::::::::::::::::::::::::::::: ::
971+
972+XX document
973+
974+------------------------------------------------------------------------
975+
976+
977+***
docs/system/hoon/library/4c.mdnew file+368
@@ -0,0 +1,368 @@
1+## 4c: tank printer
2+### `++show`
3+
4+ ++ show :: XX deprecated, use type
5+ |= vem=*
6+ |^ ^- tank
7+ ?: ?=(@ vem)
8+ [%leaf (mesc (trip vem))]
9+ ?- vem
10+ [s=~ c=*]
11+ [%leaf '\'' (weld (mesc (tape +.vem)) `tape`['\'' ~])]
12+ ::
13+ [s=%a c=@] [%leaf (mesc (trip c.vem))]
14+ [s=%b c=*] (shop c.vem |=(a=@ ~(rub at a)))
15+ [s=[%c p=@] c=*]
16+ :+ %palm
17+ [['.' ~] ['-' ~] ~ ~]
18+ [[%leaf (mesc (trip p.s.vem))] $(vem c.vem) ~]
19+ ::
20+ [s=%d c=*] (shop c.vem |=(a=@ ~(rud at a)))
21+ [s=%k c=*] (tank c.vem)
22+ [s=%h c=*]
23+ ?: =(0 c.vem) :: XX remove after 220
24+ [%leaf '#' ~]
25+ :+ %rose
26+ [['/' ~] ['/' ~] ~]
27+ =+ yol=((list ,@ta) c.vem)
28+ (turn yol |=(a=@ta [%leaf (trip a)]))
29+ ::
30+ [s=%o c=*]
31+ %= $
32+ vem
33+ :- [%m '%h:<[%d %d].[%d %d]>']
34+ [-.c.vem +<-.c.vem +<+.c.vem +>-.c.vem +>+.c.vem ~]
35+ ==
36+ ::
37+ [s=%p c=*] (shop c.vem |=(a=@ ~(rup at a)))
38+ [s=%q c=*] (shop c.vem |=(a=@ ~(r at a)))
39+ [s=%r c=*] $(vem [[%r ' ' '{' '}'] c.vem])
40+ [s=%t c=*] (shop c.vem |=(a=@ ~(rt at a)))
41+ [s=%v c=*] (shop c.vem |=(a=@ ~(ruv at a)))
42+ [s=%x c=*] (shop c.vem |=(a=@ ~(rux at a)))
43+ [s=[%m p=@] c=*] (shep p.s.vem c.vem)
44+ [s=[%r p=@] c=*]
45+ $(vem [[%r ' ' (cut 3 [0 1] p.s.vem) (cut 3 [1 1] p.s.vem)] c.vem])
46+ ::
47+ [s=[%r p=@ q=@ r=@] c=*]
48+ :+ %rose
49+ :* p=(mesc (trip p.s.vem))
50+ q=(mesc (trip q.s.vem))
51+ r=(mesc (trip r.s.vem))
52+ ==
53+ |- ^- (list tank)
54+ ?@ c.vem
55+ ~
56+ [^$(vem -.c.vem) $(c.vem +.c.vem)]
57+ ::
58+ [s=%z c=*] $(vem [[%r %$ %$ %$] c.vem])
59+ * !!
60+ ==
61+
62+XX document
63+
64+### `++shep`
65+
66+ ++ shep
67+ |= [fom=@ gar=*]
68+ ^- tank
69+ =+ l=(met 3 fom)
70+ =+ i=0
71+ :- %leaf
72+ |- ^- tape
73+ ?: (gte i l)
74+ ~
75+ =+ c=(cut 3 [i 1] fom)
76+ ?. =(37 c)
77+ (weld (mesc [c ~]) $(i +(i)))
78+ =+ d=(cut 3 [+(i) 1] fom)
79+ ?. .?(gar)
80+ ['\\' '#' $(i (add 2 i))]
81+ (weld ~(ram re (show d -.gar)) $(i (add 2 i), gar +.gar))
82+ ::
83+
84+XX document
85+
86+### `++shop`
87+
88+ ++ shop
89+ |= [aug=* vel=$+(a=@ tape)]
90+ ^- tank
91+ ?: ?=(@ aug)
92+ [%leaf (vel aug)]
93+ :+ %rose
94+ [[' ' ~] ['[' ~] [']' ~]]
95+ => .(aug `*`aug)
96+ |- ^- (list tank)
97+ ?: ?=(@ aug)
98+ [^$ ~]
99+ [^$(aug -.aug) $(aug +.aug)]
100+ --
101+
102+XX document
103+
104+
105+
106+***
107+### `++re`
108+
109+Pretty-printing engine
110+
111+Pretty-printing engine that accepts a [`++tank`](/doc/hoon/library/1#++tank) [sample]() and contains arms that perform computation on it.
112+
113+Accepts
114+-------
115+
116+`tac` is a `++tank`.
117+
118+Produces
119+--------
120+
121+ ++ re
122+ |_ tac=tank
123+
124+Examples
125+--------
126+
127+ /~zod/try=> ~(. re leaf/"ham")
128+ <2.ghl [[%leaf ""] <414.gly 100.xkc 1.ypj %164>]>
129+
130+### `++ram`
131+
132+Flatten to tape
133+
134+Flatten [`++tank`]() out into a [`++tape`]().
135+
136+Accepts
137+-------
138+
139+`tac` is a `++tank`, taken from [sample]() of `++re` [core]().
140+
141+Produces
142+--------
143+
144+A `++tape`.
145+
146+Source
147+------
148+
149+ ++ ram
150+ ^- tape
151+ ?- -.tac
152+ %leaf p.tac
153+ %palm ram(tac [%rose [p.p.tac (weld q.p.tac r.p.tac) s.p.tac] q.tac])
154+ %rose
155+ %+ weld
156+ q.p.tac
157+ |- ^- tape
158+ ?~ q.tac
159+ r.p.tac
160+ =+ voz=$(q.tac t.q.tac)
161+ (weld ram(tac i.q.tac) ?~(t.q.tac voz (weld p.p.tac voz)))
162+ ==
163+ ::
164+
165+Examples
166+--------
167+
168+ /~zod/try=> ~(ram re leaf/"foo")
169+ "foo"
170+ /~zod/try=> ~(ram re rose/["." "(" ")"]^~[leaf/"bar" leaf/"baz" leaf/"bam"])
171+ "(bar.baz.bam)"
172+
173+### `++win`
174+
175+Render at indent
176+
177+Render at indent level `tab` and width `edg`.
178+
179+Accepts
180+-------
181+
182+`tac` is a `++tank`, taken from [sample]() of `++re` [core]().
183+
184+`tab` and `edg` are atoms.
185+
186+Produces
187+--------
188+
189+A [`++wall`]() ([`++list`]() of [`++tapes`]()).
190+
191+Source
192+------
193+
194+ ++ win
195+ |= [tab=@ edg=@]
196+ =+ lug=`wall`~
197+ |^ |- ^- wall
198+ ?- -.tac
199+ %leaf (rig p.tac)
200+ %palm
201+ ?: fit
202+ (rig ram)
203+ ?~ q.tac
204+ (rig q.p.tac)
205+ ?~ t.q.tac
206+ (rig(tab (add 2 tab), lug $(tac i.q.tac)) q.p.tac)
207+ => .(q.tac `(list tank)`q.tac)
208+ =+ lyn=(mul 2 (lent q.tac))
209+ =+ ^= qyr
210+ |- ^- wall
211+ ?~ q.tac
212+ lug
213+ %= ^$
214+ tac i.q.tac
215+ tab (add tab (sub lyn 2))
216+ lug $(q.tac t.q.tac, lyn (sub lyn 2))
217+ ==
218+ (wig(lug qyr) q.p.tac)
219+ ::
220+ %rose
221+ ?: fit
222+ (rig ram)
223+ =+ ^= gyl
224+ |- ^- wall
225+ ?~ q.tac
226+ ?:(=(%$ r.p.tac) lug (rig r.p.tac))
227+ ^$(tac i.q.tac, lug $(q.tac t.q.tac), tab din)
228+ ?: =(%$ q.p.tac)
229+ gyl
230+ (wig(lug gyl) q.p.tac)
231+ ==
232+ ::
233+
234+Examples
235+--------
236+
237+ /~zod/try=> (~(win re leaf/"samoltekon-lapdok") 0 20)
238+ <<"samoltekon-lapdok">>
239+ /~zod/try=> (~(win re leaf/"samoltekon-lapdok") 0 10)
240+ <<"\/samolt\/" " ekon-l" " apdok" "\/ \/">>
241+ /~zod/try=> (~(win re rose/["--" "[" "]"]^~[leaf/"1423" leaf/"2316"]) 0 20)
242+ <<"[1423--2316]">>
243+ /~zod/try=> (~(win re rose/["--" "[" "]"]^~[leaf/"1423" leaf/"2316"]) 0 10)
244+ <<"[ 1423" " 2316" "]">>
245+
246+### `++din`
247+
248+XX document
249+
250+Accepts
251+-------
252+
253+Produces
254+--------
255+
256+Source
257+------
258+
259+ ++ din (mod (add 2 tab) (mul 2 (div edg 3)))
260+
261+
262+----------------------------------------------------------------------
263+
264+### `++fit`
265+
266+Fit on one line test
267+
268+Determine whether `tac` fits on one line. Internal to `++win`
269+
270+Accepts
271+-------
272+
273+Produces
274+--------
275+
276+Source
277+------
278+
279+++ fit (lte (lent ram) (sub edg tab))
280+
281+
282+Examples
283+--------
284+
285+
286+
287+
288+----------------------------------------------------------------------
289+
290+### `++rig`
291+
292+Wrap in `\/`
293+
294+Wrap [`++tape`]() in `\/` if it doesn't fit at current indentation. Internal to
295+[`++win`]()
296+
297+Accepts
298+-------
299+
300+`tac` is a `++tank`, taken from [sample]() of `++re` [core]().
301+
302+`hom` is a `++tape`.
303+
304+Produces
305+--------
306+
307+A [`++wall`]() (list of `++tape`s).
308+
309+Source
310+------
311+
312+ ++ rig
313+ |= hom=tape
314+ ^- wall
315+ ?: (lte (lent hom) (sub edg tab))
316+ [(runt [tab ' '] hom) lug]
317+ => .(tab (add tab 2), edg (sub edg 2))
318+ =+ mut=(trim (sub edg tab) hom)
319+ :- (runt [(sub tab 2) ' '] ['\\' '/' (weld p.mut `_hom`['\\' '/' ~])])
320+ => .(hom q.mut)
321+ |-
322+ ?~ hom
323+ :- %+ runt
324+ [(sub tab 2) ' ']
325+ ['\\' '/' (runt [(sub edg tab) ' '] ['\\' '/' ~])]
326+ lug
327+ => .(mut (trim (sub edg tab) hom))
328+ [(runt [tab ' '] p.mut) $(hom q.mut)]
329+ ::
330+
331+Examples
332+--------
333+
334+### `++wig`
335+
336+`++win` render tape
337+
338+Render [`++tape`](). Internal to [`++win`]().
339+
340+Accepts
341+-------
342+
343+`tac` is a `++tank`, taken from [sample]() of `++re` [core]().
344+
345+`hom` is a `++tape`.
346+
347+Produces
348+--------
349+
350+ ++ wig
351+ |= hom=tape
352+ ^- wall
353+ ?~ lug
354+ (rig hom)
355+ =+ lin=(lent hom)
356+ =+ wug=:(add 1 tab lin)
357+ ?. =+ mir=i.lug
358+ |- ?~ mir
359+ |
360+ ?|(=(0 wug) ?&(=(' ' i.mir) $(mir t.mir, wug (dec wug))))
361+ (rig hom) :: ^ XX regular form?
362+ [(runt [tab ' '] (weld hom `tape`[' ' (slag wug i.lug)])) t.lug]
363+ --
364+ --
365+
366+
367+
368+***
docs/system/hoon/library/4d.mdnew file+93
@@ -0,0 +1,93 @@
1+## 4d: parsing (tracing)
2+### `++last`
3+
4+Farther trace
5+
6+Compares two line-column pairs, called [`++hair`]()s, `zyc` and `naz`, producing whichever
7+is further along.
8+
9+Accepts
10+-------
11+
12+`naz` is a [hair]().
13+
14+`zyc` is a [hair]().
15+
16+Produces
17+--------
18+
19+a `++hair`.
20+
21+Source
22+------
23+
24+ ++ last |= [zyc=hair naz=hair] :: farther trace
25+ ^- hair
26+ ?: =(p.zyc p.naz)
27+ ?:((gth q.zyc q.naz) zyc naz)
28+ ?:((gth p.zyc p.naz) zyc naz)
29+ ::
30+
31+
32+Examples
33+--------
34+
35+ ~zod/try=> (last [1 1] [1 2])
36+ [p=1 q=2]
37+ ~zod/try=> (last [2 1] [1 2])
38+ [p=2 q=1]
39+ ~zod/try=> (last [0 0] [99 0])
40+ [p=99 q=0]
41+ ~zod/try=> (last [7 7] [7 7])
42+ [p=7 q=7]
43+
44+
45+***
46+
47+### `++lust`
48+
49+Detect newline
50+
51+Advances the [`++hair`]() `naz` by a row if the [`++char`]() `weq` is a newline, or by a
52+column if `weq` is any other character.
53+
54+Accepts
55+-------
56+
57+`weq` is a char.
58+
59+`naz` is a hair.
60+
61+Produces
62+--------
63+
64+A hair.
65+
66+Source
67+------
68+
69+ ++ lust |= [weq=char naz=hair] :: detect newline
70+ ^- hair
71+ ?:(=(10 weq) [+(p.naz) 1] [p.naz +(q.naz)])
72+
73+
74+Examples
75+--------
76+
77+ ~zod/try=> (lust `a` [1 1])
78+ [p=1 q=2]
79+ ~zod/try=> (lust `@t`10 [1 1])
80+ [p=2 q=1]
81+ ~zod/try=> (lust '9' [10 10])
82+ [p=10 q=11]
83+ /~zod/try=> (roll "maze" [.(+<+ [1 1])]:lust)
84+ [1 5]
85+ /~zod/try=> %- roll :_ [.(+<+ [1 1])]:lust
86+ """
87+ Sam
88+ lokes
89+ """
90+ [2 6]
91+
92+
93+***
docs/system/hoon/library/4e.mdnew file+454
@@ -0,0 +1,454 @@
1+## 4e: parsing (combinators)
2+### `++bend`
3+
4+Conditional composer
5+
6+Parsing composer: connects the [`++edge`]() `vex` with the subsequent [`++rule`]() `sab`
7+as an optional suffix, using [gate]() `raq` to compose or reject its
8+result. If there is no suffix, or if the suffix fails to be composed
9+with the current result, the current result is produced. Used to map a
10+group of rules to a specified output.
11+
12+Accepts
13+-------
14+
15+`raq` is a [gate]().
16+
17+`sab` is a [rule]().
18+
19+`vex` is an [edge]().
20+
21+Produces
22+--------
23+
24+A [`++rule`]().
25+
26+Source
27+------
28+
29+ ++ bend :: conditional comp
30+ ~/ %bend
31+ |* raq=_|*([a=* b=*] [~ u=[a b]])
32+ ~/ %fun
33+ |* [vex=edge sab=_rule]
34+ ?~ q.vex
35+ vex
36+ =+ yit=(sab q.u.q.vex)
37+ =+ yur=(last p.vex p.yit)
38+ ?~ q.yit
39+ [p=yur q=q.vex]
40+ =+ vux=(raq p.u.q.vex p.u.q.yit)
41+ ?~ vux
42+ [p=yur q=q.vex]
43+ [p=yur q=[~ u=[p=u.vux q=q.u.q.yit]]]
44+ ::
45+
46+Examples
47+--------
48+
49+ ~zod/try=> (;~((bend |=([a=char b=char] ?.(=(a b) ~ (some +(a))))) prn prn) [1 1] "qs")
50+ [p=[p=1 q=3] q=[~ u=[p=~~q q=[p=[p=1 q=2] q="s"]]]]
51+ ~zod/try=> (;~((bend |=([a=char b=char] ?.(=(a b) ~ (some +(a))))) prn prn) [1 1] "qqq")
52+ [p=[p=1 q=3] q=[~ u=[p=~~r q=[p=[p=1 q=3] q="q"]]]]
53+ ~zod/try=> (scan "aa" ;~((bend |=([a=char b=char] ?.(=(a b) ~ (some +(a))))) prn prn))
54+ ~~b
55+ ~zod/try=> (scan "ba" ;~((bend |=([a=char b=char] ?.(=(a b) ~ (some +(a))))) prn prn))
56+ ! {1 3}
57+ ! exit
58+ ~zod/try=> `(unit ,@tas)`(scan "" ;~((bend) (easy ~) sym))
59+ ~
60+ ~zod/try=> `(unit ,@tas)`(scan "sep" ;~((bend) (easy ~) sym))
61+ [~ %sep]
62+
63+
64+
65+***
66+### `++comp`
67+
68+Arbitrary compose
69+
70+Parsing composer: connects the [`++edge`]() `vex` with a following [`++rule`]() `sab`,
71+combining the contents of `vex` with the result of `sab` using a binary
72+[gate]() `raq`. Used to fold over the results of several `++rules`.
73+
74+Accepts
75+-------
76+
77+`raq` is a gate that accepts a cell of two [nouns](), `a` and `b`, and
78+produces a cell of two nouns.
79+
80+`sab` is a rule.
81+
82+`vex` is an edge.
83+
84+Produces
85+--------
86+
87+A [`++rule`]().
88+
89+Source
90+------
91+
92+ ++ comp
93+ ~/ %comp
94+ |* raq=_|*([a=* b=*] [a b]) :: arbitrary compose
95+ ~/ %fun
96+ |* [vex=edge sab=_rule]
97+ ?~ q.vex
98+ vex
99+ =+ yit=(sab q.u.q.vex)
100+ =+ yur=(last p.vex p.yit)
101+ ?~ q.yit
102+ [p=yur q=q.yit]
103+ [p=yur q=[~ u=[p=(raq p.u.q.vex p.u.q.yit) q=q.u.q.yit]]]
104+ ::
105+
106+Examples
107+--------
108+
109+ ~zod/try=> (scan "123" ;~((comp |=([a=@u b=@u] (add a b))) dit dit dit))
110+ 6
111+ ~zod/try=> (scan "12" ;~((comp |=([a=@u b=@u] (add a b))) dit dit dit))
112+ ! {1 3}
113+ ! exit
114+
115+***
116+### `++fail`
117+
118+Never parse
119+
120+Produces an [`++edge`]() at the same text position ([`++hair`]()) with a failing
121+result (`q=~`).
122+
123+Accepts
124+-------
125+
126+`tub` is a [`++nail`]().
127+
128+Produces
129+--------
130+
131+An `++edge`.
132+
133+Source
134+------
135+
136+ ++ fail |=(tub=nail [p=p.tub q=~]) :: never parse
137+
138+Examples
139+--------
140+
141+ ~zod/try=> (fail [[1 1] "abc"])
142+ [p=[p=1 q=1] q=~]
143+ ~zod/try=> (fail [[p=1.337 q=70] "Parse me, please?"])
144+ [p=[p=1.337 q=70] q=~]
145+
146+
147+
148+***
149+### `++glue`
150+
151+Skip delimiter
152+
153+Parsing composer: connects an [`++edge`]() `vex` with a following [`++rule`]() `sab` by
154+parsing the `++rule` `bus` (the delimiting symbol) and throwing out the
155+result.
156+
157+Accepts
158+-------
159+
160+`bus` is a `++rule`.
161+
162+`sab` is a `++rule`.
163+
164+`vex` is an `++edge`.
165+
166+Produces
167+--------
168+
169+
170+
171+Source
172+------
173+
174+ ++ glue :: add rule
175+ ~/ %glue
176+ |* bus=_rule
177+ ~/ %fun
178+ |* [vex=edge sab=_rule]
179+ (plug vex ;~(pfix bus sab))
180+ ::
181+
182+Examples
183+--------
184+
185+ ~zod/try=> (scan "200|mal|bon" ;~((glue bar) dem sym sym))
186+ [q=200 7.102.829 7.237.474]
187+ ~zod/try=> `[@u @tas @tas]`(scan "200|mal|bon" ;~((glue bar) dem sym sym))
188+ [200 %mal %bon]
189+ ~zod/try=> (scan "200|;|bon" ;~((glue bar) dem sem sym))
190+ [q=200 ~~~3b. 7.237.474]
191+ ~zod/try=> (scan "200.;.bon" ;~((glue dot) dem sem sym))
192+ [q=200 ~~~3b. 7.237.474]
193+
194+
195+
196+***
197+### `++less`
198+
199+Parse unless
200+
201+Parsing composer: if an [`++edge`]() `vex` reflects a success, fail. Otherwise,
202+connect `vex` with the following [`++rule`]().
203+
204+Accepts
205+-------
206+
207+`sab` is a `++rule`.
208+
209+`vex` is an `++edge`.
210+
211+Produces
212+--------
213+
214+
215+
216+Source
217+------
218+
219+ ++ less :: no first and second
220+ |* [vex=edge sab=_rule]
221+ ?~ q.vex
222+ =+ roq=(sab)
223+ [p=(last p.vex p.roq) q=q.roq]
224+ vex(q ~)
225+ ::
226+
227+Examples
228+--------
229+
230+ ~zod/try=> (scan "sas-/lo" (star ;~(less lus bar prn)))
231+ "sas-/lo"
232+ ~zod/try=> (scan "sas-/l+o" (star ;~(less lus bar prn)))
233+ ! {1 8}
234+ ! exit
235+ ~zod/try=> (scan "sas|-/lo" (star ;~(less lus bar prn)))
236+ ! {1 5}
237+ ! exit
238+
239+
240+
241+***
242+### `++pfix`
243+
244+Discard first rule
245+
246+Parsing composer: connects an [`++edge`]() `vex` with two subsequent [`++rule`]()s,
247+ignoring the result of the first and producing the result of the second.
248+
249+Accepts
250+-------
251+
252+`vex` is an [edge]().
253+
254+Produces
255+--------
256+
257+
258+
259+Source
260+------
261+
262+ ++ pfix :: discard first rule
263+ ~/ %pfix
264+ (comp |*([a=* b=*] b))
265+ ::
266+
267+Examples
268+--------
269+
270+ ~zod/try=> `@t`(scan "%him" ;~(pfix cen sym))
271+ 'him'
272+ ~zod/try=> (scan "+++10" ;~(pfix (star lus) dem))
273+ q=10
274+
275+
276+
277+***
278+### `++plug`
279+
280+Parse to tuple
281+
282+Parsing composer: connects an [`++edge`]() `vex` with a following [`++rule`]() `sab`, producing
283+a cell of both the results. See also: the monad applicator [;\~]() for a
284+more detailed explanation.
285+
286+Accepts
287+-------
288+
289+`sab` is a `++rule`.
290+
291+`vex` is an `++edge`.
292+
293+Produces
294+--------
295+
296+
297+
298+Source
299+------
300+
301+ ++ plug :: first then second
302+ ~/ %plug
303+ |* [vex=edge sab=_rule]
304+ ?~ q.vex
305+ vex
306+ =+ yit=(sab q.u.q.vex)
307+ =+ yur=(last p.vex p.yit)
308+ ?~ q.yit
309+ [p=yur q=q.yit]
310+ [p=yur q=[~ u=[p=[p.u.q.vex p.u.q.yit] q=q.u.q.yit]]]
311+ ::
312+
313+Examples
314+--------
315+
316+ ~zod/try=> (scan "1..20" ;~(plug dem dot dot dem))
317+ [q=1 ~~~. ~~~. q=20]
318+ ~zod/try=> (scan "moke/~2014.1.1" ;~(plug sym fas nuck:so))
319+ [1.701.539.693 ~~~2f. [% p=[p=~.da q=170.141.184.500.766.106.671.844.917.172.921.958.400]]]
320+ ~zod/try=> ;;(,[@tas @t ~ %da @da] (scan "moke/~2014.1.1" ;~(plug sym fas nuck:so)))
321+ [%moke '/' ~ %da ~2014.1.1]
322+
323+
324+
325+***
326+### `++pose`
327+
328+Parse options
329+
330+Parsing composer: if `vex` reflects a failure, connect it with the
331+following rule `sab`. See also: the monad applicator [;\~]()
332+
333+Accepts
334+-------
335+
336+`sab` is a [`++rule`]().
337+
338+`vex` is an [`++edge`]().
339+
340+Produces
341+--------
342+
343+
344+
345+Source
346+------
347+
348+ ++ pose :: first or second
349+ ~/ %pose
350+ |* [vex=edge sab=_rule]
351+ ?~ q.vex
352+ =+ roq=(sab)
353+ [p=(last p.vex p.roq) q=q.roq]
354+ vex
355+
356+Examples
357+--------
358+
359+ ~zod/try=> `@t`(scan "+" ;~(pose lus tar cen))
360+ '+'
361+ ~zod/try=> `@t`(scan "*" ;~(pose lus tar cen))
362+ '*'
363+ ~zod/try=> `@t`(scan "%" ;~(pose lus tar cen))
364+ '%'
365+ ~zod/try=> `@t`(scan "-" ;~(pose lus tar cen))
366+ ! {1 1}
367+ ! exit
368+
369+
370+
371+***
372+### `++sfix`
373+
374+Discard second rule
375+
376+Parsing composer: connects [`++edge`]()s `vex` with two subsequent [`++rule`]()s returning the
377+result of the first and discarding the result of the second.
378+
379+Accepts
380+-------
381+
382+`a` is the result of parsing the first `++rule`.
383+
384+`b` is the result of of parsing the second `++rule`.
385+
386+Produces
387+--------
388+
389+
390+
391+Source
392+------
393+
394+ ++ sfix :: discard second rule
395+ ~/ %sfix
396+ (comp |*([a=* b=*] a))
397+
398+Examples
399+--------
400+
401+ ~zod/try=> `@t`(scan "him%" ;~(sfix sym cen))
402+ 'him'
403+ ~zod/try=> (scan "10+++" ;~(sfix dem (star lus)))
404+ q=10
405+
406+
407+
408+***
409+### `++simu`
410+
411+First and second
412+
413+Parsing composer: if an [`++edge`]() `vex` reflects a failure, fail. Otherwise,
414+connect `vex` with the following [`++rule`]().
415+
416+Accepts
417+-------
418+
419+`sab` is a `++rule`.
420+
421+`vex` is an `++edge`.
422+
423+Produces
424+--------
425+
426+
427+
428+Source
429+------
430+
431+ ++ simu :: first and second
432+ |* [vex=edge sab=_rule]
433+ ?~ q.vex
434+ vex
435+ =+ roq=(sab)
436+ roq
437+ ::
438+
439+Examples
440+--------
441+
442+ ~zod/try=> (scan "~zod" scat:vast)
443+ [%dtzy p=%p q=0]
444+ ~zod/try=> (scan "%zod" scat:vast)
445+ [%dtzz p=%tas q=6.582.138]
446+ ~zod/try=> (scan "%zod" ;~(simu cen scat:vast))
447+ [%dtzz p=%tas q=6.582.138]
448+ ~zod/try=> (scan "~zod" ;~(simu cen scat:vast))
449+ ! {1 1}
450+ ! exit
451+
452+
453+
454+***
docs/system/hoon/library/4f.mdnew file+1159
@@ -0,0 +1,1159 @@
1+## 4f: parsing (rule builders)
2+### `++bass`
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+ ++ bass
23+ |* [wuc=@ tyd=_rule]
24+ %+ cook
25+ |= waq=(list ,@)
26+ %+ roll
27+ waq
28+ =|([p=@ q=@] |.((add p (mul wuc q))))
29+ tyd
30+
31+Examples
32+--------
33+
34+ ~zod/try=> (scan "123" (bass 10 (star dit)))
35+ q=123
36+ ~zod/try=> (scan "123" (bass 8 (star dit)))
37+ q=83
38+ ~zod/try=> `@ub`(scan "123" (bass 8 (star dit)))
39+ 0b101.0011
40+
41+
42+
43+***
44+
45+### `++boss`
46+
47+Parser modifier: [LSB](http://en.wikipedia.org/wiki/Least_significant_bit)
48+ordered [`++list`]() as atom of a [`++base`]().
49+
50+Accepts
51+-------
52+
53+`wuc` is an atom.
54+
55+`tyd` is a [`++rule`]().
56+
57+Produces
58+--------
59+
60+A [`++rule`]().
61+
62+Source
63+------
64+
65+ ++ boss
66+ |* [wuc=@ tyd=_rule]
67+ %+ cook
68+ |= waq=(list ,@)
69+ %+ reel
70+ waq
71+ =|([p=@ q=@] |.((add p (mul wuc q))))
72+ tyd
73+
74+Examples
75+--------
76+
77+ ~zod/try=> (scan "123" (boss 10 (star dit)))
78+ q=321
79+ ~zod/try=> `@t`(scan "bam" (boss 256 (star alp)))
80+ 'bam'
81+ ~zod/try=> `@ux`(scan "bam" (boss 256 (star alp)))
82+ 0x6d.6162
83+
84+
85+***
86+### `++cold`
87+
88+Replace with constant
89+
90+Parser modifier. Accepts a [`++rule`]() `sef` and produces a parser that
91+produces a constant `cus`, assuming `sef` is successful.
92+
93+Accepts
94+-------
95+
96+`cus` is a constant [noun]().
97+
98+`sef` is a `++rule`.
99+
100+Produces
101+--------
102+
103+An [`++edge`]().
104+
105+Source
106+------
107+
108+ ++ cold :: replace w/ constant
109+ ~/ %cold
110+ |* [cus=* sef=_rule]
111+ ~/ %fun
112+ |= tub=nail
113+ =+ vex=(sef tub)
114+ ?~ q.vex
115+ vex
116+ [p=p.vex q=[~ u=[p=cus q=q.u.q.vex]]]
117+ ::
118+
119+Examples
120+--------
121+
122+ ~zod/try=> ((cold %foo (just 'a')) [[1 1] "abc"])
123+ [p=[p=1 q=2] q=[~ u=[p=%foo q=[p=[p=1 q=2] q="bc"]]]]
124+ ~zod/try=> ((cold %foo (just 'a')) [[1 1] "bc"])
125+ [p=[p=1 q=1] q=~]
126+
127+
128+
129+***
130+### `++cook`
131+
132+Apply gate
133+
134+Parser modifier. Produces a parser that takes a (successful) result of a
135+[`++rule`]() `sef` and slams it through `poq`.
136+
137+Accepts
138+-------
139+
140+`poq` is a [gate]().
141+
142+`sef` is a [`++rule`]().
143+
144+Produces
145+--------
146+
147+An [`++rule`]().
148+
149+Source
150+------
151+
152+ ++ cook :: apply gate
153+ ~/ %cook
154+ |* [poq=_,* sef=_rule]
155+ ~/ %fun
156+ |= tub=nail
157+ =+ vex=(sef tub)
158+ ?~ q.vex
159+ vex
160+ [p=p.vex q=[~ u=[p=(poq p.u.q.vex) q=q.u.q.vex]]]
161+ ::
162+
163+Examples
164+--------
165+
166+ ~zod/try=> ((cook ,@ud (just 'a')) [[1 1] "abc"])
167+ [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]]
168+ ~zod/try=> ((cook ,@tas (just 'a')) [[1 1] "abc"])
169+ [p=[p=1 q=2] q=[~ u=[p=%a q=[p=[p=1 q=2] q="bc"]]]]
170+ ~zod/try=> ((cook |=(a=@ +(a)) (just 'a')) [[1 1] "abc"])
171+ [p=[p=1 q=2] q=[~ u=[p=98 q=[p=[p=1 q=2] q="bc"]]]]
172+ ~zod/try=> ((cook |=(a=@ `@t`+(a)) (just 'a')) [[1 1] "abc"])
173+ [p=[p=1 q=2] q=[~ u=[p='b' q=[p=[p=1 q=2] q="bc"]]]]
174+
175+
176+
177+***
178+### `++easy`
179+
180+Always parse
181+
182+Parser generator. Produces a parser that succeeds with given [noun]() `huf`
183+without consuming any text.
184+
185+Accepts
186+-------
187+
188+`huf` is a noun.
189+
190+Produces
191+--------
192+
193+A [`++rule`]().
194+
195+Source
196+------
197+
198+ ++ easy :: always parse
199+ ~/ %easy
200+ |* huf=*
201+ ~/ %fun
202+ |= tub=nail
203+ ^- (like ,_huf)
204+ [p=p.tub q=[~ u=[p=huf q=tub]]]
205+ ::
206+
207+Examples
208+--------
209+
210+ ~zod/try=> ((easy %foo) [[1 1] "abc"])
211+ [p=[p=1 q=1] q=[~ [p=%foo q=[p=[p=1 q=1] q="abc"]]]]
212+ ~zod/try=> ((easy %foo) [[1 1] "bc"])
213+ [p=[p=1 q=1] q=[~ [p=%foo q=[p=[p=1 q=1] q="bc"]]]]
214+ ~zod/try=> ((easy 'a') [[1 1] "bc"])
215+ [p=[p=1 q=1] q=[~ [p='a' q=[p=[p=1 q=1] q="bc"]]]]
216+
217+
218+
219+***
220+### `++full`
221+
222+Parse to end
223+
224+Parser modifier. Accepts a [`++rule`]() `sef`, and produces a parser that succeeds only
225+when the of `tub` is fully consumed using `sef`.
226+
227+Accepts
228+-------
229+
230+`sef` is a [`++rule`]().
231+
232+Produces
233+--------
234+
235+A `++rule`.
236+
237+Source
238+------
239+
240+ ++ full :: parse to end
241+ |* sef=_rule
242+ |= tub=nail
243+ =+ vex=(sef tub)
244+ ?~(q.vex vex ?:(=(~ q.q.u.q.vex) vex [p=p.vex q=~]))
245+ ::
246+
247+Examples
248+--------
249+
250+ ~zod/try=> ((full (just 'a')) [[1 1] "ab"])
251+ [p=[p=1 q=2] q=~]
252+ ~zod/try=> ((full (jest 'ab')) [[1 1] "ab"])
253+ [p=[p=1 q=3] q=[~ u=[p='ab' q=[p=[p=1 q=3] q=""]]]]
254+ ~zod/try=> ((full ;~(plug (just 'a') (just 'b'))) [[1 1] "ab"])
255+ [p=[p=1 q=3] q=[~ u=[p=[~~a ~~b] q=[p=[p=1 q=3] q=""]]]]
256+
257+
258+
259+***
260+### `++funk`
261+
262+Add to tape
263+
264+Parser modifier: prepend text to [`++tape`]() before applying parser.
265+
266+Accepts
267+-------
268+
269+`pre` is a `++tape`
270+
271+`sef` is a [`++rule`]()
272+
273+Produces
274+--------
275+
276+A `++rule`.
277+
278+Source
279+------
280+
281+ ++ funk :: add to tape first
282+ |* [pre=tape sef=_rule]
283+ |= tub=nail
284+ (sef p.tub (weld pre q.tub))
285+ ::
286+
287+Examples
288+--------
289+
290+ ~zod/try=> ((funk "abc prefix-" (jest 'abc')) [[1 1] "to be parsed"])
291+ [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=" prefix-to be parsed"]]]]
292+ ~zod/try=> ((funk "parse" (just 'a')) [[1 4] " me"])
293+ [p=[p=1 q=4] q=~]
294+
295+
296+
297+***
298+### `++here`
299+
300+Place-based apply
301+
302+Parser modifier. Similar to [`++cook`]() in that it produces a parser that takes a
303+(successful) result of `sef` and slams it through `hez`. `hez` accepts a
304+[`++pint`]() `a` and a [noun]() `b`, which is what the parser parsed.
305+
306+Accepts
307+-------
308+
309+`hez` is a [gate]().
310+
311+`sef` is a [`++rule`]()
312+
313+Produces
314+--------
315+
316+A `++rule`.
317+
318+Source
319+------
320+
321+ ++ here :: place-based apply
322+ ~/ %here
323+ |* [hez=_|=([a=pint b=*] [a b]) sef=_rule]
324+ ~/ %fun
325+ |= tub=nail
326+ =+ vex=(sef tub)
327+ ?~ q.vex
328+ vex
329+ [p=p.vex q=[~ u=[p=(hez [p.tub p.q.u.q.vex] p.u.q.vex) q=q.u.q.vex]]]
330+ ::
331+
332+Examples
333+--------
334+
335+ ~zod/try=> (scan "abc" (star alf))
336+ "abc"
337+ ~zod/try=> (scan "abc" (here |*(^ +<) (star alf)))
338+ [[[p=1 q=1] p=1 q=4] "abc"]
339+ ~zod/try=> (scan "abc" (star (here |*(^ +<) alf)))
340+ ~[[[[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]]
341+
342+
343+
344+***
345+### `++ifix`
346+
347+Infix
348+
349+Parser modifier: surround with pair of [`++rule`]()s, the output of which is
350+discarded.
351+
352+Accepts
353+-------
354+
355+`fel` is a pair of `++rule`s.
356+
357+`hof` is a `++rule`.
358+
359+Produces
360+--------
361+
362+A `++rule`.
363+
364+Source
365+------
366+
367+ ++ ifix
368+ |* [fel=[p=_rule q=_rule] hof=_rule]
369+ ;~(pfix p.fel ;~(sfix hof q.fel))
370+
371+Examples
372+--------
373+
374+ ~zod/try=> (scan "-40-" (ifix [hep hep] dem))
375+ q=40
376+ ~zod/try=> (scan "4my4" (ifix [dit dit] (star alf)))
377+ "my"
378+
379+
380+
381+***
382+### `++jest`
383+
384+Match a cord
385+
386+Match and consume a cord.
387+
388+Accepts
389+-------
390+
391+`daf` is a [`@t`]().
392+
393+Produces
394+--------
395+
396+An [`++edge`]().
397+
398+Source
399+------
400+
401+ ++ jest :: match a cord
402+ |= daf=@t
403+ |= tub=nail
404+ =+ fad=daf
405+ |- ^- (like ,@t)
406+ ?: =(0 daf)
407+ [p=p.tub q=[~ u=[p=fad q=tub]]]
408+ ?: |(?=(~ q.tub) !=((end 3 1 daf) i.q.tub))
409+ (fail tub)
410+ $(p.tub (lust i.q.tub p.tub), q.tub t.q.tub, daf (rsh 3 1 daf))
411+ ::
412+
413+Examples
414+--------
415+
416+ ~zod/try=> ((jest 'abc') [[1 1] "abc"])
417+ [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=""]]]]
418+ ~zod/try=> (scan "abc" (jest 'abc'))
419+ 'abc'
420+ ~zod/try=> (scan "abc" (jest 'acb'))
421+ ! {1 2}
422+ ! 'syntax-error'
423+ ! exit
424+ ~zod/try=> ((jest 'john doe') [[1 1] "john smith"])
425+ [p=[p=1 q=6] q=~]
426+ ~zod/try=> ((jest 'john doe') [[1 1] "john doe"])
427+ [p=[p=1 q=9] q=[~ [p='john doe' q=[p=[p=1 q=9] q=""]]]]
428+
429+
430+
431+***
432+### `++just`
433+
434+Match a char
435+
436+Match and consume a single character.
437+
438+Accepts
439+-------
440+
441+`daf` is a [`++char`]()
442+
443+Produces
444+--------
445+
446+A [`++rule`]().
447+
448+Source
449+------
450+
451+ ++ just :: XX redundant, jest
452+ ~/ %just :: match a char
453+ |= daf=char
454+ ~/ %fun
455+ |= tub=nail
456+ ^- (like char)
457+ ?~ q.tub
458+ (fail tub)
459+ ?. =(daf i.q.tub)
460+ (fail tub)
461+ (next tub)
462+ ::
463+
464+
465+Examples
466+--------
467+
468+ ~zod/try=> ((just 'a') [[1 1] "abc"])
469+ [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
470+ ~zod/try=> (scan "abc" (just 'a'))
471+ ! {1 2}
472+ ! 'syntax-error'
473+ ! exit
474+ ~zod/try=> (scan "a" (just 'a'))
475+ ~~a
476+ ~zod/try=> (scan "%" (just '%'))
477+ ~~~25.
478+
479+
480+
481+***
482+### `++knee`
483+
484+Recursive parsers
485+
486+Used for recursive parsers, which would otherwise be infinite when
487+compiled.
488+
489+Accepts
490+-------
491+
492+`gar` is a noun.
493+
494+`sef` is a [gate]() that accepts a [`++rule`]()
495+
496+Produces
497+--------
498+
499+A [`++rule`]().
500+
501+Source
502+------
503+
504+ ++ knee :: callbacks
505+ |* [gar=* sef=_|.(rule)]
506+ |= tub=nail
507+ ^- (like ,_gar)
508+ ((sef) tub)
509+ ::
510+
511+Examples
512+--------
513+
514+ ~zod/try=> |-(;~(plug prn ;~(pose $ (easy ~))))
515+ ! rest-loop
516+ ! exit
517+ ~zod/try=> |-(;~(plug prn ;~(pose (knee *tape |.(^$)) (easy ~))))
518+ < 1.obo
519+ [ c=c=tub=[p=[p=@ud q=@ud] q=""]
520+ b
521+ < 1.bes
522+ [ c=tub=[p=[p=@ud q=@ud] q=""]
523+ b=<1.tnv [tub=[p=[p=@ud q=@ud] q=""] <1.ktu [daf=@tD <414.fvk 101.jzo 1.ypj %164>]>]>
524+ a=<1.fvg [tub=[p=[p=@ud q=@ud] q=""] <1.khu [[les=@ mos=@] <414.fvk 101.jzo 1.ypj %164>]>]>
525+ v=<414.fvk 101.jzo 1.ypj %164>
526+ ]
527+ >
528+ a
529+ ... 450 lines omitted ...
530+ ]
531+ >
532+ ~zod/try=> (scan "abcd" |-(;~(plug prn ;~(pose (knee *tape |.(^$)) (easy ~)))))
533+ [~~a "bcd"]
534+
535+
536+
537+***
538+### `++mask`
539+
540+Match char
541+
542+Parser generator. Matches the next character if it is in a list of
543+characters.
544+
545+Accepts
546+-------
547+
548+`bud` is a list of [`++char`]()
549+
550+Produces
551+--------
552+
553+A [`++rule`]().
554+
555+Source
556+------
557+
558+ ++ mask :: match char in set
559+ ~/ %mask
560+ |= bud=(list char)
561+ ~/ %fun
562+ |= tub=nail
563+ ^- (like char)
564+ ?~ q.tub
565+ (fail tub)
566+ ?. (lien bud |=(a=char =(i.q.tub a)))
567+ (fail tub)
568+ (next tub)
569+ ::
570+
571+Examples
572+--------
573+
574+ ~zod/try=> (scan "a" (mask "cba"))
575+ ~~a
576+ ~zod/try=> ((mask "abc") [[1 1] "abc"])
577+ [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
578+ ~zod/try=> ((mask "abc") [[1 1] "bbc"])
579+ [p=[p=1 q=2] q=[~ [p=~~b q=[p=[p=1 q=2] q="bc"]]]]
580+ ~zod/try=> ((mask "abc") [[1 1] "dbc"])
581+ [p=[p=1 q=1] q=~]
582+
583+
584+
585+***
586+### `++more`
587+
588+Parse list with delimiter
589+
590+Parser modifier: Parse a list of matches using a delimiter [`++rule`]().
591+
592+Accepts
593+-------
594+
595+`bus` is a `++rule`.
596+
597+`fel` is a `++rule`.
598+
599+Produces
600+--------
601+
602+A `++rule`.
603+
604+Source
605+------
606+
607+ ++ more
608+ |* [bus=_rule fel=_rule]
609+ ;~(pose (most bus fel) (easy ~))
610+
611+Examples
612+--------
613+
614+ ~zod/try=> (scan "" (more ace dem))
615+ ~
616+ ~zod/try=> (scan "40 20" (more ace dem))
617+ [q=40 ~[q=20]]
618+ ~zod/try=> (scan "40 20 60 1 5" (more ace dem))
619+ [q=40 ~[q=20 q=60 q=1 q=5]]
620+
621+
622+
623+***
624+### `++most`
625+
626+Parse list of at least one match
627+
628+Parser modifier: parse a [`++list`]() of at least one match using a delimiter [`++rule`]().
629+
630+Accepts
631+-------
632+
633+`bus` is a `++rule`.
634+
635+`fel` is a `++rule`.
636+
637+Produces
638+--------
639+
640+A `++rule`.
641+
642+Source
643+------
644+
645+ ++ most
646+ |* [bus=_rule fel=_rule]
647+ ;~(plug fel (star ;~(pfix bus fel)))
648+
649+Examples
650+--------
651+
652+ ~zod/try=> (scan "40 20" (most ace dem))
653+ [q=40 ~[q=20]]
654+ ~zod/try=> (scan "40 20 60 1 5" (most ace dem))
655+ [q=40 ~[q=20 q=60 q=1 q=5]]
656+ ~zod/try=> (scan "" (most ace dem))
657+ ! {1 1}
658+ ! exit
659+
660+
661+
662+***
663+### `++next`
664+
665+Consume char
666+
667+Consume any character, producing it as a result.
668+
669+Accepts
670+-------
671+
672+`tub` is a [`++nail`]()
673+
674+Produces
675+--------
676+
677+An [`++edge`]().
678+
679+Source
680+------
681+
682+ ++ next :: consume a char
683+ |= tub=nail
684+ ^- (like char)
685+ ?~ q.tub
686+ (fail tub)
687+ =+ zac=(lust i.q.tub p.tub)
688+ [zac [~ i.q.tub [zac t.q.tub]]]
689+ ::
690+
691+Examples
692+--------
693+
694+ ~zod/try=> (next [[1 1] "ebc"])
695+ [p=[p=1 q=2] q=[~ [p=~~e q=[p=[p=1 q=2] q="bc"]]]]
696+ ~zod/try=> (next [[1 1] "john jumps jones"])
697+ [p=[p=1 q=2] q=[~ [p=~~j q=[p=[p=1 q=2] q="ohn jumps jones"]]]]
698+
699+
700+
701+***
702+
703+### `++plus`
704+
705+List of at least one match.
706+
707+Parser modifier: parse [`++list`]() of at least one match.
708+
709+Accepts
710+-------
711+
712+`fel` is a [`++rule`]().
713+
714+Produces
715+--------
716+
717+A `++rule`.
718+
719+Source
720+------
721+
722+ ++ plus |*(fel=_rule ;~(plug fel (star fel)))
723+
724+Examples
725+--------
726+
727+ ~zod/try=> (scan ">>>>" (cook lent (plus gar)))
728+ 4
729+ ~zod/try=> (scan "- - " (plus ;~(pose ace hep)))
730+ [~~- " - "]
731+ ~zod/try=> `tape`(scan "- - " (plus ;~(pose ace hep)))
732+ "- - "
733+ ~zod/try=> `(pole ,@t)`(scan "- - " (plus ;~(pose ace hep)))
734+ ['-' [' ' [' ' ['-' [' ' ~]]]]]
735+
736+
737+
738+***
739+### `++sear`
740+
741+Conditional `++cook`
742+
743+Conditional [`++cook`](). Slams the result through a gate that produces
744+a unit; if that unit is empty, fail.
745+
746+Accepts
747+-------
748+
749+`tub` is a [`++nail`](/doc/hoon/library/1#++nail)
750+
751+Produces
752+--------
753+
754+A [`++rule`]().
755+
756+Source
757+------
758+
759+ ++ sear :: conditional cook
760+ |* [pyq=_|=(* *(unit)) sef=_rule]
761+ |= tub=nail
762+ =+ vex=(sef tub)
763+ ?~ q.vex
764+ vex
765+ =+ gey=(pyq p.u.q.vex)
766+ ?~ gey
767+ [p=p.vex q=~]
768+ [p=p.vex q=[~ u=[p=u.gey q=q.u.q.vex]]]
769+ ::
770+
771+Examples
772+--------
773+
774+ ~zod/try=> ((sear |=(a=* ?@(a (some a) ~)) (just `a`)) [[1 1] "abc"])
775+ [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]]
776+ ~zod/try=> ((sear |=(* ~) (just 'a')) [[1 1] "abc"])
777+ [p=[p=1 q=2] q=~]
778+
779+
780+
781+***
782+### `++shim`
783+
784+Char in range
785+
786+Match characters ([`++char`]()) within a range.
787+
788+Accepts
789+-------
790+
791+`les` is an atom.
792+
793+`mos` is an atom.
794+
795+Produces
796+--------
797+
798+A [`++rule`]().
799+
800+Source
801+------
802+
803+ ++ shim :: match char in range
804+ ~/ %shim
805+ |= [les=@ mos=@]
806+ ~/ %fun
807+ |= tub=nail
808+ ^- (like char)
809+ ?~ q.tub
810+ (fail tub)
811+ ?. ?&((gte i.q.tub les) (lte i.q.tub mos))
812+ (fail tub)
813+ (next tub)
814+ ::
815+
816+Examples
817+--------
818+
819+ ~zod/try=> ((shim 'a' 'z') [[1 1] "abc"])
820+ [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
821+ ~zod/try=> ((shim 'a' 'Z') [[1 1] "abc"])
822+ [p=[p=1 q=1] q=~]
823+ ~zod/try=> ((shim 'a' 'Z') [[1 1] "Abc"])
824+ [p=[p=1 q=2] q=[~ [p=~~~41. q=[p=[p=1 q=2] q="bc"]]]]
825+
826+
827+
828+***
829+### `++slug`
830+
831+Use gate to parse delimited list
832+
833+Parser modifier: By composing with a [gate](), parse a delimited [`++list`]() of
834+matches.
835+
836+Accepts
837+-------
838+
839+`bus` is a [`++rule`]().
840+
841+`fel` is a `++rule`.
842+
843+Produces
844+--------
845+
846+A `++rule`.
847+
848+Source
849+------
850+
851+ ++ slug
852+ |* raq=_|*([a=* b=*] [a b])
853+ |* [bus=_rule fel=_rule]
854+ ;~((comp raq) fel (stir +<+.raq raq ;~(pfix bus fel)))
855+
856+Examples
857+--------
858+
859+ ~zod/try=> (scan "20+5+110" ((slug add) lus dem))
860+ 135
861+ ~zod/try=> `@t`(scan "a b c" ((slug |=(a=[@ @t] (cat 3 a))) ace alp))
862+ 'abc'
863+
864+
865+
866+***
867+### `++stag`
868+
869+Add label
870+
871+Add a label to an edge parsed by a rule.
872+
873+Accepts
874+-------
875+
876+`gob` is a noun.
877+
878+`sef` is a rule.
879+
880+Produces
881+--------
882+
883+A [`++rule`]().
884+
885+Source
886+------
887+
888+ ++ stag :: add a label
889+ ~/ %stag
890+ |* [gob=* sef=_rule]
891+ ~/ %fun
892+ |= tub=nail
893+ =+ vex=(sef tub)
894+ ?~ q.vex
895+ vex
896+ [p=p.vex q=[~ u=[p=[gob p.u.q.vex] q=q.u.q.vex]]]
897+ ::
898+
899+Examples
900+--------
901+
902+ ~zod/try=> ((stag %foo (just 'a')) [[1 1] "abc"])
903+ [p=[p=1 q=2] q=[~ u=[p=[%foo ~~a] q=[p=[p=1 q=2] q="bc"]]]]
904+ ~zod/try=> ((stag "xyz" (jest 'abc')) [[1 1] "abc"])
905+ [p=[p=1 q=4] q=[~ u=[p=["xyz" 'abc'] q=[p=[p=1 q=4] q=""]]]]
906+ ~zod/try=> ((stag 10.000 (shim 0 100)) [[1 1] "abc"])
907+ [p=[p=1 q=2] q=[~ u=[p=[10.000 ~~a] q=[p=[p=1 q=2] q="bc"]]]]
908+
909+
910+
911+***
912+### `++star`
913+
914+List of matches
915+
916+Parser modifier: parse [`++list`]() of matches.
917+
918+Accepts
919+-------
920+
921+`fel` is a [`++rule`]().
922+
923+Produces
924+--------
925+
926+ ++ star :: 0 or more times
927+ |* fel=_rule
928+ (stir `(list ,_(wonk *fel))`~ |*([a=* b=*] [a b]) fel)
929+
930+Examples
931+--------
932+
933+ ~zod/try=> (scan "aaaaa" (just 'a'))
934+ ! {1 2}
935+ ! 'syntax-error'
936+ ! exit
937+ ~zod/try=> (scan "aaaaa" (star (just 'a')))
938+ "aaaaa"
939+ ~zod/try=> (scan "abcdef" (star (just 'a')))
940+ ! {1 2}
941+ ! 'syntax-error'
942+ ! exit
943+ ~zod/try=> (scan "abcabc" (star (jest 'abc')))
944+ <|abc abc|>
945+ ~zod/try=> (scan "john smith" (star (shim 0 200)))
946+ "john smith"
947+
948+
949+
950+***
951+### `++stet`
952+
953+Add faces
954+
955+Add faces `[p q]` to range-parser pairs in a list.
956+
957+Accepts
958+-------
959+
960+`leh` is a list of range-parsers.
961+
962+Produces
963+--------
964+
965+
966+
967+Source
968+------
969+
970+ ++ stet
971+ |* leh=(list ,[?(@ [@ @]) _rule])
972+ |-
973+ ?~ leh
974+ ~
975+ [i=[p=-.i.leh q=+.i.leh] t=$(leh t.leh)]
976+ ::
977+
978+Examples
979+--------
980+
981+ ~zod/try=> (stet (limo [[5 (just 'a')] [1 (jest 'abc')] [[1 1] (shim 0 200)]
982+ [[1 10] (cold %foo (just 'a'))]~]))
983+ ~[
984+ [p=5 q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
985+ [p=1 q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
986+ [p=[1 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
987+ [p=[1 10] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
988+ ]
989+ ~zod/try=> [[[1 1] (just 'a')] [[2 1] (shim 0 200)] ~]
990+ [ [[1 1] <1.tnv [tub=[p=[p=@ud q=@ud] q=""] <1.ktu [daf=@tD <414.fvk 101.jzo 1.ypj %164>]>]>]
991+ [[2 1] <1.fvg [tub=[p=[p=@ud q=@ud] q=""] <1.khu [[les=@ mos=@] <414.fvk 101.jzo 1.ypj %164>]>]>]
992+ ~
993+ ]
994+ ~zod/try=> (stet (limo [[[1 1] (just 'a')] [[2 1] (shim 0 200)] ~]))
995+ ~[
996+ [p=[1 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
997+ [p=[2 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
998+ ]
999+
1000+
1001+
1002+***
1003+### `++stew`
1004+
1005+Switch by first
1006+
1007+ ++ stew :: switch by first char
1008+ ~/ %stew
1009+ |* leh=(list ,[p=?(@ [@ @]) q=_rule]) :: char/range keys
1010+ =+ ^= wor :: range complete lth
1011+ |= [ort=?(@ [@ @]) wan=?(@ [@ @])]
1012+ ?@ ort
1013+ ?@(wan (lth ort wan) (lth ort -.wan))
1014+ ?@(wan (lth +.ort wan) (lth +.ort -.wan))
1015+ =+ ^= hel :: build parser map
1016+ =+ hel=`(tree $_(?>(?=(^ leh) i.leh)))`~
1017+ |- ^+ hel
1018+ ?~ leh
1019+ ~
1020+ =+ yal=$(leh t.leh)
1021+ |- ^+ hel
1022+ ?~ yal
1023+ [i.leh ~ ~]
1024+ ?: (wor p.i.leh p.n.yal)
1025+ =+ nuc=$(yal l.yal)
1026+ ?> ?=(^ nuc)
1027+ ?: (vor p.n.yal p.n.nuc)
1028+ [n.yal nuc r.yal]
1029+ [n.nuc l.nuc [n.yal r.nuc r.yal]]
1030+ =+ nuc=$(yal r.yal)
1031+ ?> ?=(^ nuc)
1032+ ?: (vor p.n.yal p.n.nuc)
1033+ [n.yal l.yal nuc]
1034+ [n.nuc [n.yal l.yal l.nuc] r.nuc]
1035+ ~% %fun ..^$ ~
1036+ |= tub=nail
1037+ ?~ q.tub
1038+ (fail tub)
1039+ |-
1040+ ?~ hel
1041+ (fail tub)
1042+ ?: ?@ p.n.hel
1043+ =(p.n.hel i.q.tub)
1044+ ?&((gte i.q.tub -.p.n.hel) (lte i.q.tub +.p.n.hel))
1045+ :: (q.n.hel [(lust i.q.tub p.tub) t.q.tub])
1046+ (q.n.hel tub)
1047+ ?: (wor i.q.tub p.n.hel)
1048+ $(hel l.hel)
1049+ $(hel r.hel)
1050+ ::
1051+
1052+Parser generator. From an associative [`++list`]() of characters or character
1053+ranges to [`++rule`]()s, construct a [`++map`](), and parse [`++tape`]()s only
1054+with `++rules` associated with a range that the `++tape`'s first character falls in.
1055+
1056+
1057+
1058+***
1059+### `++stir`
1060+
1061+Parse repeatedly
1062+
1063+Parse with [`++rule`]() as many times as possible, and fold over results with a
1064+binary gate.
1065+
1066+Accepts
1067+-------
1068+
1069+`rud` is a noun.
1070+
1071+`raq` is a gate that takes two nouns and produces a cell.
1072+
1073+`fel` is a rule.
1074+
1075+Produces
1076+--------
1077+
1078+A rule.
1079+
1080+Source
1081+------
1082+
1083+++ stir :: parse repeatedly
1084+ ~/ %stir
1085+ |* [rud=* raq=_|*([a=* b=*] [a b]) fel=_rule]
1086+ ~/ %fun
1087+ |= tub=nail
1088+ ^- (like ,_rud)
1089+ =+ vex=(fel tub)
1090+ ?~ q.vex
1091+ [p.vex [~ rud tub]]
1092+ =+ wag=$(tub q.u.q.vex)
1093+ ?> ?=(^ q.wag)
1094+ [(last p.vex p.wag) [~ (raq p.u.q.vex p.u.q.wag) q.u.q.wag]]
1095+ ::
1096+
1097+Examples
1098+--------
1099+
1100+ ~zod/try=> (scan "abc" (stir *@ add prn))
1101+ 294
1102+ ~zod/try=> (roll "abc" add)
1103+ b=294
1104+
1105+
1106+
1107+***
1108+### `++stun`
1109+
1110+Parse several times
1111+
1112+Parse bounded number of times.
1113+
1114+Accepts
1115+-------
1116+
1117+`[les=@ mos=@]` is a cell of atoms indicating the bounds.
1118+
1119+`fel` is a [`++rule`]().
1120+
1121+Produces
1122+--------
1123+
1124+A [`++rule`]().
1125+
1126+Source
1127+------
1128+
1129+ ++ stun :: parse several times
1130+ |* [[les=@ mos=@] fel=_rule]
1131+ |= tub=nail
1132+ ^- (like (list ,_(wonk (fel))))
1133+ ?: =(0 mos)
1134+ [p.tub [~ ~ tub]]
1135+ =+ vex=(fel tub)
1136+ ?~ q.vex
1137+ ?: =(0 les)
1138+ [p.vex [~ ~ tub]]
1139+ vex
1140+ =+ ^= wag %= $
1141+ les ?:(=(0 les) 0 (dec les))
1142+ mos ?:(=(0 mos) 0 (dec mos))
1143+ tub q.u.q.vex
1144+ ==
1145+ ?~ q.wag
1146+ wag
1147+ [p.wag [~ [p.u.q.vex p.u.q.wag] q.u.q.wag]]
1148+
1149+Examples
1150+--------
1151+
1152+ ~zod/try=> ((stun [5 10] prn) [1 1] "aquickbrownfoxran")
1153+ [p=[p=1 q=11] q=[~ [p="aquickbrow" q=[p=[p=1 q=11] q="nfoxran"]]]]
1154+ ~zod/try=> ((stun [5 10] prn) [1 1] "aquickbro")
1155+ [p=[p=1 q=10] q=[~ [p="aquickbro" q=[p=[p=1 q=10] q=""]]]]
1156+ ~zod/try=> ((stun [5 10] prn) [1 1] "aqui")
1157+ [p=[p=1 q=5] q=~]
1158+
1159+***
docs/system/hoon/library/4g.mdnew file+167
@@ -0,0 +1,167 @@
1+## 4g: parsing (outside caller)
2+### `++rash`
3+
4+Parse or crash
5+
6+Parse a cord with a given [`++rule`]() and crash if the [`++cord`]() isn't entirely
7+parsed.
8+
9+Accepts
10+-------
11+
12+`naf` is an atom.
13+
14+`sab` is a `++rule`.
15+
16+Produces
17+--------
18+
19+The value of the parse result, or crash.
20+
21+Source
22+------
23+
24+ ++ rash |*([naf=@ sab=_rule] (scan (trip naf) sab)) ::
25+
26+Examples
27+--------
28+
29+ ~zod/try=> (rash 'I was the world in which I walked, and what I saw' (star (shim 0 200)))
30+ "I was the world in which I walked, and what I saw"
31+ ~zod/try=> (rash 'abc' (just 'a'))
32+ ! {1 2}
33+ ! 'syntax-error'
34+ ! exit
35+ ~zod/try=> (rash 'abc' (jest 'abc'))
36+ 'abc'
37+ `~zod/try=> (rash 'abc' (jest 'ab'))
38+ ! {1 3}
39+ ! 'syntax-error'
40+ ! exit
41+
42+
43+
44+***
45+### `++rush`
46+
47+Parse or null
48+
49+Parse a given with a given rule and produce null if the cord isn't
50+entirely parsed.
51+
52+Accepts
53+-------
54+
55+`naf` is an [atom]().
56+
57+`sab` is a [rule]().
58+
59+Produces
60+--------
61+
62+The value of the parse result, or null.
63+
64+Source
65+------
66+
67+ ++ rush |*([naf=@ sab=_rule] (rust (trip naf) sab))
68+
69+Examples
70+--------
71+
72+ ~zod/try=> (rush 'I was the world in which I walked, and what I saw' (star (shim 0 200)))
73+ [~ "I was the world in which I walked, and what I saw"]
74+ ~zod/try=> (rush 'abc' (just 'a'))
75+ ~
76+ ~zod/try=> (rush 'abc' (jest 'abc'))
77+ [~ 'abc']
78+ ~zod/try=> (rush 'abc' (jest 'ac'))
79+ ~
80+ ~zod/try=> (rush 'abc' (jest 'ab'))
81+ ~
82+
83+
84+
85+***
86+### `++rust`
87+
88+Parse tape or null
89+
90+Parse a [`++tape`]() with a given [`++rule`]() and produce null if the `++tape` isn't
91+entirely parsed.
92+
93+Accepts
94+-------
95+
96+`los` is a `++tape`.
97+
98+`sab` is a `++rule`.
99+
100+Produces
101+--------
102+
103+A `(unit ,@t)`
104+
105+Source
106+------
107+
108+ ++ rust |* [los=tape sab=_rule]
109+ =+ vex=((full sab) [[1 1] los])
110+ ?~(q.vex ~ [~ u=p.u.q.vex])
111+
112+Examples
113+--------
114+
115+ ~zod/try=> (rust "I was the world in which I walked, and what I saw" (star (shim 0 200)))
116+ [~ "I was the world in which I walked, and what I saw"]
117+ ~zod/try=> (rust "Or heard or felt came not but from myself;" (star (shim 0 200)))
118+ [~ "Or heard or felt came not but from myself;"]
119+ ~zod/try=> (rust "And there I found myself more truly and more strange." (jest 'And there I'))
120+ ~
121+
122+
123+
124+***
125+### `++scan`
126+
127+Parse tape or crash
128+
129+Parse a [`++tape`]() with a given [`++rule`]() and crash if the `++tape` isn't entirely
130+parsed.
131+
132+Accepts
133+-------
134+
135+`los` is a [tape]().
136+
137+`sab` is a [rule]().
138+
139+Produces
140+--------
141+
142+Either a `++tape` or a crash.
143+
144+Source
145+------
146+
147+ ++ scan |* [los=tape sab=_rule]
148+ =+ vex=((full sab) [[1 1] los])
149+ ?~ q.vex
150+ ~_ (show [%m '{%d %d}'] p.p.vex q.p.vex ~)
151+ ~|('syntax-error' !!)
152+ p.u.q.vex
153+
154+Examples
155+--------
156+
157+ ~zod/try=> (scan "I was the world in which I walked, and what I saw" (star (shim 0 200)))
158+ "I was the world in which I walked, and what I saw"
159+ ~zod/try=> (scan "Or heard or felt came not but from myself;" (star (shim 0 200)))
160+ "Or heard or felt came not but from myself;"
161+ ~zod/try=> (scan "And there I found myself more truly and more strange." (jest 'And there I'))
162+ ! {1 12}
163+ ! 'syntax-error'
164+ ! exit
165+
166+
167+***
docs/system/hoon/library/4h.mdnew file+874
@@ -0,0 +1,874 @@
1+## 4h: parsing (ascii glyphs)
2+### `++ace`
3+
4+Parse space
5+
6+Parses ASCII character 32, space.
7+
8+Source
9+------
10+
11+ ++ ace (just ' ')
12+
13+Examples
14+--------
15+
16+ ~zod/try=> (scan " " ace)
17+ ~~.
18+ ~zod/try=> `cord`(scan " " ace)
19+ ' '
20+ ~zod/try=> (ace [[1 1] " "])
21+ [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q=""]]]]
22+ ~zod/try=> (ace [[1 1] " abc "])
23+ [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q="abc "]]]]
24+
25+
26+
27+***
28+### `++bar`
29+
30+Parse vertical bar
31+
32+Parses ASCII character 124, the vertical bar.
33+
34+Source
35+------
36+
37+ ++ bar (just '|')
38+
39+Examples
40+--------
41+
42+ ~zod/try=> (scan "|" bar)
43+ ~~~7c.
44+ ~zod/try=> `cord`(scan "|" bar)
45+ '|'
46+ ~zod/try=> (bar [[1 1] "|"])
47+ [p=[p=1 q=2] q=[~ [p=~~~7c. q=[p=[p=1 q=2] q=""]]]]
48+ ~zod/try=> (bar [[1 1] "|="])
49+ [p=[p=1 q=2] q=[~ [p=~~~7c. q=[p=[p=1 q=2] q="="]]]]
50+
51+
52+
53+***
54+### `++bas`
55+
56+Parse backslash
57+
58+Parses ASCII character 92, the backslash. Note the extra `\` in the calling of
59+`bas` with [`++just`](/doc/hoon/library/2ec#++just) is to escape the escape
60+character, `\`.
61+
62+Source
63+------
64+
65+ ++ bas (just '\\')
66+
67+Examples
68+--------
69+
70+ ~zod/try=> (scan "\\" bas)
71+ ~~~5c.
72+ ~zod/try=> `cord`(scan "\\" bas)
73+ '\'
74+ ~zod/try=> (bas [[1 1] "\"])
75+ ~ <syntax error at [1 18]>
76+ ~zod/try=> (bas [[1 1] "\\"])
77+ [p=[p=1 q=2] q=[~ [p=~~~5c. q=[p=[p=1 q=2] q=""]]]]
78+ ~zod/try=> (bas [[1 1] "\""])
79+ [p=[p=1 q=1] q=~]
80+
81+
82+
83+***
84+### `++buc`
85+
86+Parse dollar sign
87+
88+Parses ASCII character 36, the dollar sign.
89+
90+Source
91+------
92+
93+ ++ buc (just '$')
94+
95+Examples
96+--------
97+
98+ ~zod/try=> (scan "$" buc)
99+ ~~~24.
100+ ~zod/try=> `cord`(scan "$" buc)
101+ '$'
102+ ~zod/try=> (buc [[1 1] "$"])
103+ [p=[p=1 q=2] q=[~ [p=~~~24. q=[p=[p=1 q=2] q=""]]]]
104+ ~zod/try=> (buc [[1 1] "$%"])
105+ [p=[p=1 q=2] q=[~ [p=~~~24. q=[p=[p=1 q=2] q="%"]]]]
106+
107+
108+
109+***
110+### `++cab`
111+
112+Parse underscore
113+
114+Parses ASCII character 95, the underscore.
115+
116+Source
117+------
118+
119+ ++ cab (just '_')
120+
121+Examples
122+--------
123+
124+ ~zod/try=> (scan "_" cab)
125+ ~~~5f.
126+ ~zod/try=> `cord`(scan "_" cab)
127+ '_'
128+ ~zod/try=> (cab [[1 1] "_"])
129+ [p=[p=1 q=2] q=[~ [p=~~~5f. q=[p=[p=1 q=2] q=""]]]]
130+ ~zod/try=> (cab [[1 1] "|_"])
131+ [p=[p=1 q=1] q=~]
132+
133+
134+
135+***
136+### `++cen`
137+
138+Parses percent sign
139+
140+Parses ASCII character 37, the percent sign.
141+
142+Source
143+------
144+
145+ ++ cen (just '%')
146+
147+Examples
148+--------
149+
150+ ~zod/try=> (scan "%" cen)
151+ ~~~25.
152+ ~zod/try=> `cord`(scan "%" cen)
153+ '%'
154+ ~zod/try=> (cen [[1 1] "%"])
155+ [p=[p=1 q=2] q=[~ [p=~~~25. q=[p=[p=1 q=2] q=""]]]]
156+ ~zod/try=> (cen [[1 1] "%^"])
157+ [p=[p=1 q=2] q=[~ [p=~~~25. q=[p=[p=1 q=2] q="^"]]]]
158+
159+
160+
161+***
162+### `++col`
163+
164+Parse colon
165+
166+Parses ASCII character 58, the colon
167+
168+Source
169+------
170+
171+ ++ col (just ':')
172+
173+Examples
174+--------
175+
176+ ~zod/try=> (scan ":" col)
177+ ~~~3a.
178+ ~zod/try=> `cord`(scan ":" col)
179+ ':'
180+ ~zod/try=> (col [[1 1] ":"])
181+ [p=[p=1 q=2] q=[~ [p=~~~3a. q=[p=[p=1 q=2] q=""]]]]
182+ ~zod/try=> (col [[1 1] ":-"])
183+ [p=[p=1 q=2] q=[~ [p=~~~3a. q=[p=[p=1 q=2] q="-"]]]]
184+
185+
186+
187+***
188+### `++com`
189+
190+Parse comma
191+
192+Parses ASCII character 44, the comma.
193+
194+Source
195+------
196+
197+ ++ com (just ',')
198+
199+Examples
200+--------
201+
202+ ~zod/try=> (scan "," com)
203+ ~~~2c.
204+ ~zod/try=> `cord`(scan "," com)
205+ ','
206+ ~zod/try=> (com [[1 1] ","])
207+ [p=[p=1 q=2] q=[~ [p=~~~2c. q=[p=[p=1 q=2] q=""]]]]
208+ ~zod/try=> (com [[1 1] "not com"])
209+ [p=[p=1 q=1] q=~]
210+
211+
212+
213+***
214+### `++doq`
215+
216+Parse double quote
217+
218+Parses ASCII character 34, the double quote.
219+
220+Source
221+------
222+
223+ ++ doq (just '"')
224+
225+Examples
226+--------
227+
228+ ~zod/try=> (scan "\"" doq)
229+ ~~~22.
230+ ~zod/try=> `cord`(scan "\"" doq)
231+ '"'
232+ ~zod/try=> (doq [[1 1] "\""])
233+ [p=[p=1 q=2] q=[~ [p=~~~22. q=[p=[p=1 q=2] q=""]]]]
234+ ~zod/try=> (doq [[1 1] "not successfully parsed"])
235+ [p=[p=1 q=1] q=~]
236+ ~zod/try=> (scan "see?" doq)
237+ ! {1 1}
238+ ! 'syntax-error'
239+ ! exit
240+
241+
242+
243+***
244+### `++dot`
245+
246+Parse period
247+
248+Parses ASCII character 46, the period.
249+
250+Source
251+------
252+
253+ ++ dot (just '.')
254+
255+Examples
256+--------
257+
258+ ~zod/try=> (scan "." dot)
259+ ~~~.
260+ ~zod/try=> `cord`(scan "." dot)
261+ '.'
262+ ~zod/try=> (dot [[1 1] "."])
263+ [p=[p=1 q=2] q=[~ [p=~~~. q=[p=[p=1 q=2] q=""]]]]
264+ ~zod/try=> (dot [[1 1] ".^"])
265+ [p=[p=1 q=2] q=[~ [p=~~~. q=[p=[p=1 q=2] q="^"]]]]
266+
267+
268+
269+***
270+### `++fas`
271+
272+Parse forward slash
273+
274+Parses ASCII character 47, the forward slash.
275+
276+Source
277+------
278+
279+ ++ fas (just '/')
280+
281+Examples
282+--------
283+
284+ ~zod/try=> (scan "/" fas)
285+ ~~~2f.
286+ ~zod/try=> `cord`(scan "/" fas)
287+ '/'
288+ ~zod/try=> (fas [[1 1] "/"])
289+ [p=[p=1 q=2] q=[~ [p=~~~2f. q=[p=[p=1 q=2] q=""]]]]
290+ ~zod/try=> (fas [[1 1] "|/"])
291+ [p=[p=1 q=1] q=~]
292+
293+
294+
295+***
296+### `++gal`
297+
298+Parse less-than sign
299+
300+Parses ASCII character 60, the less-than sign.
301+
302+Source
303+------
304+
305+ ++ gal (just '<')
306+
307+Examples
308+--------
309+
310+ ~zod/try=> (scan "<" gal)
311+ ~~~3c.
312+ ~zod/try=> `cord`(scan "<" gal)
313+ '<'
314+ ~zod/try=> (gal [[1 1] "<"])
315+ [p=[p=1 q=2] q=[~ [p=~~~3c. q=[p=[p=1 q=2] q=""]]]]
316+ ~zod/try=> (gal [[1 1] "<+"])
317+ [p=[p=1 q=2] q=[~ [p=~~~3c. q=[p=[p=1 q=2] q="+"]]]]
318+ ~zod/try=> (gal [[1 1] "+<"])
319+ [p=[p=1 q=1] q=~]
320+
321+
322+
323+***
324+### `++gar`
325+
326+Parse greater-than sign
327+
328+Parses ASCII character 62, the greater-than sign.
329+
330+Source
331+------
332+
333+ ++ gar (just '>')
334+
335+Examples
336+--------
337+
338+ ~zod/try=> (scan ">" gar)
339+ ~~~3e.
340+ ~zod/try=> `cord`(scan ">" gar)
341+ '>'
342+ ~zod/try=> (gar [[1 1] ">"])
343+ [p=[p=1 q=2] q=[~ [p=~~~3e. q=[p=[p=1 q=2] q=""]]]]
344+ ~zod/try=> (gar [[1 1] "=>"])
345+ [p=[p=1 q=1] q=~]
346+
347+
348+
349+***
350+### `++hax`
351+
352+Parse number sign
353+
354+Parses ASCII character 35, the number sign.
355+
356+Source
357+------
358+
359+ ++ hax (just '#')
360+
361+Examples
362+--------
363+
364+ ~zod/try=> (scan "#" hax)
365+ ~~~23.
366+ ~zod/try=> `cord`(scan "#" hax)
367+ '#'
368+ ~zod/try=> (hax [[1 1] "#"])
369+ [p=[p=1 q=2] q=[~ [p=~~~23. q=[p=[p=1 q=2] q=""]]]]
370+ ~zod/try=> (hax [[1 1] "#!"])
371+ [p=[p=1 q=2] q=[~ [p=~~~23. q=[p=[p=1 q=2] q="!"]]]]
372+
373+
374+
375+***
376+### `++hep`
377+
378+Parse hyphen
379+
380+Parses ASCII character 45, the hyphen.
381+
382+Source
383+------
384+
385+ ++ hep (just '-')
386+
387+Examples
388+--------
389+
390+ ~zod/try=> (scan "-" hep)
391+ ~~-
392+ ~zod/try=> `cord`(scan "-" hep)
393+ '-'
394+ ~zod/try=> (hep [[1 1] "-"])
395+ [p=[p=1 q=2] q=[~ [p=~~- q=[p=[p=1 q=2] q=""]]]]
396+ ~zod/try=> (hep [[1 1] ":-"])
397+ [p=[p=1 q=1] q=~]
398+
399+
400+
401+***
402+### `++kel`
403+
404+Parse left curley bracket
405+
406+Parses ASCII character 123, the left curly bracket. Note that `{`
407+(`kel`) and `}` (`ker`) open and close a Hoon expression for Hoon string
408+interpolation. To parse either of them, they must be escaped.
409+
410+Source
411+------
412+
413+ ++ kel (just '{')
414+
415+Examples
416+--------
417+
418+ ~zod/try=> (scan "\{" kel)
419+ ~~~7b.
420+ ~zod/try=> `cord`(scan "\{" kel)
421+ '{'
422+ ~zod/try=> (kel [[1 1] "\{"])
423+ [p=[p=1 q=2] q=[~ [p=~~~7b. q=[p=[p=1 q=2] q=""]]]]
424+ ~zod/try=> (kel [[1 1] " \{"])
425+ [p=[p=1 q=1] q=~]
426+
427+
428+
429+***
430+### `++ker`
431+
432+Parse right curley bracket
433+
434+Parses ASCII character 125, the right curly bracket. Note that `{`
435+(`kel`) and `}` (`ker`) open and close a Hoon expression for Hoon string
436+interpolation. To parse either of them, they must be escaped.
437+
438+Source
439+------
440+
441+ ++ ker (just '}')
442+
443+Examples
444+--------
445+
446+ ~zod/try=> (scan "}" ker)
447+ ~~~7d.
448+ ~zod/try=> `cord`(scan "}" ker)
449+ '}'
450+ ~zod/try=> (ker [[1 1] "}"])
451+ [p=[p=1 q=2] q=[~ [p=~~~7d. q=[p=[p=1 q=2] q=""]]]]
452+ ~zod/try=> (ker [[1 1] "\{}"])
453+ [p=[p=1 q=1] q=~]
454+
455+
456+
457+***
458+### `++ket`
459+
460+Parse caret
461+
462+Parses ASCII character 94, the caret.
463+
464+Source
465+------
466+
467+ ++ ket (just '^')
468+
469+Examples
470+--------
471+
472+ ~zod/try=> (scan "^" ket)
473+ ~~~5e.
474+ ~zod/try=> `cord`(scan "^" ket)
475+ '^'
476+ ~zod/try=> (ket [[1 1] "^"])
477+ [p=[p=1 q=2] q=[~ [p=~~~5e. q=[p=[p=1 q=2] q=""]]]]
478+ ~zod/try=> (ket [[1 1] ".^"])
479+ [p=[p=1 q=1] q=~]
480+
481+
482+***
483+### `++lus`
484+
485+Parse plus sign
486+
487+Parses ASCII character 43, the plus sign.
488+
489+Source
490+------
491+
492+ ++ lus (just '+')
493+
494+Examples
495+--------
496+
497+ ~zod/try=> (scan "+" lus)
498+ ~~~2b.
499+ ~zod/try=> `cord`(scan "+" lus)
500+ '+'
501+ ~zod/try=> (lus [[1 1] "+"])
502+ [p=[p=1 q=2] q=[~ [p=~~~2b. q=[p=[p=1 q=2] q=""]]]]
503+ ~zod/try=> (lus [[1 1] ".+"])
504+ [p=[p=1 q=1] q=~]
505+
506+
507+
508+***
509+### `++pam`
510+
511+Parse ampersand
512+
513+Parses ASCII character 38, the ampersand.
514+
515+Source
516+------
517+
518+ ++ pam (just '&')
519+
520+Examples
521+--------
522+
523+ ~zod/try=> (scan "&" pam)
524+ ~~~26.
525+ ~zod/try=> `cord`(scan "&" pam)
526+ '&'
527+ ~zod/try=> (pam [[1 1] "&"])
528+ [p=[p=1 q=2] q=[~ [p=~~~26. q=[p=[p=1 q=2] q=""]]]]
529+ ~zod/try=> (pam [[1 1] "?&"])
530+ [p=[p=1 q=1] q=~]
531+
532+
533+
534+***
535+### `++pat`
536+
537+Parse "at" sign
538+
539+Parses ASCII character 64, the "at" sign.
540+
541+Source
542+------
543+
544+ ++ pat (just '@')
545+
546+Examples
547+--------
548+
549+ ~zod/try=> (scan "@" pat)
550+ ~~~4.
551+ ~zod/try=> `cord`(scan "@" pat)
552+ '@'
553+ ~zod/try=> (pat [[1 1] "@"])
554+ [p=[p=1 q=2] q=[~ [p=~~~4. q=[p=[p=1 q=2] q=""]]]]
555+ ~zod/try=> (pat [[1 1] "?@"])
556+ [p=[p=1 q=1] q=~]
557+
558+
559+
560+***
561+### `++pel`
562+
563+Parse left parenthesis
564+
565+Parses ASCII character 40, the left parenthesis.
566+
567+Source
568+------
569+
570+ ++ pel (just '(')
571+
572+Examples
573+--------
574+
575+ ~zod/try=> (scan "(" pel)
576+ ~~~28.
577+ ~zod/try=> `cord`(scan "(" pel)
578+ '('
579+ ~zod/try=> (pel [[1 1] "("])
580+ [p=[p=1 q=2] q=[~ [p=~~~28. q=[p=[p=1 q=2] q=""]]]]
581+ ~zod/try=> (pel [[1 1] ";("])
582+ [p=[p=1 q=1] q=~]
583+
584+
585+
586+***
587+### `++per`
588+
589+Parse right parenthesis
590+
591+Parses ASCII character 41, the right parenthesis.
592+
593+Source
594+------
595+
596+ ++ per (just ')')
597+
598+Examples
599+--------
600+
601+ ~zod/try=> (scan ")" per)
602+ ~~~29.
603+ ~zod/try=> `cord`(scan ")" per)
604+ ')'
605+ ~zod/try=> (per [[1 1] ")"])
606+ [p=[p=1 q=2] q=[~ [p=~~~29. q=[p=[p=1 q=2] q=""]]]]
607+ ~zod/try=> (per [[1 1] " )"])
608+ [p=[p=1 q=1] q=~]
609+
610+
611+
612+***
613+### `++sel`
614+
615+Parse left square bracket
616+
617+Parses ASCII character 91, the left square bracket.
618+
619+Source
620+------
621+
622+ ++ sel (just '[')
623+
624+Examples
625+--------
626+
627+ ~zod/try=> (scan "[" sel)
628+ ~~~5b.
629+ ~zod/try=> `cord`(scan "[" sel)
630+ '['
631+ ~zod/try=> (sel [[1 1] "["])
632+ [p=[p=1 q=2] q=[~ [p=~~~5b. q=[p=[p=1 q=2] q=""]]]]
633+ ~zod/try=> (sel [[1 1] "-["])
634+ [p=[p=1 q=1] q=~]
635+
636+
637+
638+***
639+### `++sem`
640+
641+Parse semicolon
642+
643+Parses ASCII character 59, the semicolon.
644+
645+Source
646+------
647+
648+ ++ sem (just ';')
649+
650+Examples
651+--------
652+
653+ ~zod/try=> (scan ";" sem)
654+ ~~~3b.
655+ ~zod/try=> `cord`(scan ";" sem)
656+ ';'
657+ ~zod/try=> (sem [[1 1] ";"])
658+ [p=[p=1 q=2] q=[~ [p=~~~3b. q=[p=[p=1 q=2] q=""]]]]
659+ ~zod/try=> (sem [[1 1] " ;"])
660+ [p=[p=1 q=1] q=~]
661+
662+
663+
664+***
665+### `++ser`
666+
667+Parse right square bracket
668+
669+Parses ASCII character 93, the right square bracket.
670+
671+Source
672+------
673+
674+ ++ ser (just ']')
675+
676+Examples
677+--------
678+
679+ ~zod/try=> (scan "]" ser)
680+ ~~~5d.
681+ ~zod/try=> `cord`(scan "]" ser)
682+ ']'
683+ ~zod/try=> (ser [[1 1] "]"])
684+ [p=[p=1 q=2] q=[~ [p=~~~5d. q=[p=[p=1 q=2] q=""]]]]
685+ ~zod/try=> (ser [[1 1] "[ ]"])
686+ [p=[p=1 q=1] q=~]
687+
688+
689+
690+***
691+### `++sig`
692+
693+Parse tilde
694+
695+Parses ASCII character 126, the tilde.
696+
697+Source
698+------
699+
700+ ++ sig (just '~')
701+
702+Examples
703+--------
704+
705+ ~zod/try=> (scan "~" sig)
706+ ~~~~
707+ ~zod/try=> `cord`(scan "~" sig)
708+ '~'
709+ ~zod/try=> (sig [[1 1] "~"])
710+ [p=[p=1 q=2] q=[~ [p=~~~~ q=[p=[p=1 q=2] q=""]]]]
711+ ~zod/try=> (sig [[1 1] "?~"])
712+ [p=[p=1 q=1] q=~]
713+
714+
715+
716+***
717+### `++soq`
718+
719+Parse single quote
720+
721+Parses ASCII character 39, soq. Note the extra '' is to escape the first
722+`soq` because soq delimits a [`++cord`]().
723+
724+Source
725+------
726+
727+ ++ soq (just '\'')
728+
729+Examples
730+--------
731+
732+ ~zod/try=> (scan "'" soq)
733+ ~~~27.
734+ ~zod/try=> `cord`(scan "'" soq)
735+ '''
736+ ~zod/try=> (soq [[1 1] "'"])
737+ [p=[p=1 q=2] q=[~ [p=~~~27. q=[p=[p=1 q=2] q=""]]]]
738+ ~zod/try=> (soq [[1 1] ">'"])
739+ [p=[p=1 q=1] q=~]
740+
741+
742+
743+***
744+### `++tar`
745+
746+Parse asterisk
747+
748+Parses ASCII character 42, the asterisk.
749+
750+Source
751+------
752+
753+ ++ tar (just '*')
754+
755+Examples
756+--------
757+
758+ ~zod/try=> (scan "*" tar)
759+ ~~~2a.
760+ ~zod/try=> `cord`(scan "*" tar)
761+ '*'
762+ ~zod/try=> (tar [[1 1] "*"])
763+ [p=[p=1 q=2] q=[~ [p=~~~2a. q=[p=[p=1 q=2] q=""]]]]
764+ ~zod/try=> (tar [[1 1] ".*"])
765+ [p=[p=1 q=1] q=~]
766+
767+
768+
769+***
770+### `++tec`
771+
772+Parse backtick
773+
774+Parses ASCII character 96, the backtick (also known as the "grave
775+accent").
776+
777+Source
778+------
779+
780+ ++ tec (just '`') :: backTiCk
781+
782+Examples
783+--------
784+
785+ ~zod/try=> (scan "`" tec)
786+ ~~~6.
787+ ~zod/try=> `cord`(scan "`" tec)
788+ '`'
789+ ~zod/try=> (tec [[1 1] "`"])
790+ [p=[p=1 q=2] q=[~ [p=~~~6. q=[p=[p=1 q=2] q=""]]]]
791+ ~zod/try=> (tec [[1 1] " `"])
792+ [p=[p=1 q=1] q=~]
793+
794+
795+
796+***
797+### `++tis`
798+
799+Parse equals sign
800+
801+Parses ASCII character 61, the equals sign.
802+
803+Source
804+------
805+
806+ ++ tis (just '=')
807+
808+Examples
809+--------
810+
811+ ~zod/try=> (scan "=" tis)
812+ ~~~3d.
813+ ~zod/try=> `cord`(scan "=" tis)
814+ '='
815+ ~zod/try=> (tis [[1 1] "="])
816+ [p=[p=1 q=2] q=[~ [p=~~~3d. q=[p=[p=1 q=2] q=""]]]]
817+ ~zod/try=> (tis [[1 1] "|="])
818+ [p=[p=1 q=1] q=~]
819+
820+
821+
822+***
823+### `++wut`
824+
825+Parses question mark
826+
827+Parses ASCII character 63, the question mark.
828+
829+Source
830+------
831+
832+ ++ wut (just '?')
833+
834+Examples
835+--------
836+
837+ ~zod/try=> (scan "?" wut)
838+ ~~~3f.
839+ ~zod/try=> `cord`(scan "?" wut)
840+ '?'
841+ ~zod/try=> (wut [[1 1] "?"])
842+ [p=[p=1 q=2] q=[~ [p=~~~3f. q=[p=[p=1 q=2] q=""]]]]
843+ ~zod/try=> (wut [[1 1] ".?"])
844+ [p=[p=1 q=1] q=~]
845+
846+
847+
848+***
849+### `++zap`
850+
851+Exclamation point
852+
853+Parses ASCII character 33, the exclamation point zap.
854+
855+Source
856+------
857+
858+ ++ zap (just '!')
859+
860+Examples
861+--------
862+
863+ ~zod/try=> (scan "!" zap)
864+ ~~~21.
865+ ~zod/try=> `cord`(scan "!" zap)
866+ '!'
867+ ~zod/try=> (zap [[1 1] "!"])
868+ [p=[p=1 q=2] q=[~ [p=~~~21. q=[p=[p=1 q=2] q=""]]]]
869+ ~zod/try=> (zap [[1 1] "?!"])
870+ [p=[p=1 q=1] q=~]
871+
872+
873+
874+***
docs/system/hoon/library/4i.mdnew file+1
@@ -0,0 +1 @@
1+## 4i: parsing (useful idioms)
docs/system/hoon/library/4j.mdnew file+1650
@@ -0,0 +1,1650 @@
1+## 4j: parsing (bases and base digits)
2+### `++ab`
3+
4+Primitive parser engine
5+
6+A core containing numeric parser primitives.
7+
8+Source
9+------
10+
11+ ++ ab
12+ |%
13+
14+Examples
15+--------
16+
17+ ~zod/try=> ab
18+ <36.ecc 414.gly 100.xkc 1.ypj %164>
19+
20+------------------------------------------------------------------------
21+
22+### `++bix`
23+
24+Parse hex pair
25+
26+Parsing [`++rule`](). Parses a pair of base-16 digits. Used in escapes.
27+
28+Accepts
29+-------
30+
31+XX
32+
33+Produces
34+--------
35+
36+A an atom. XX
37+
38+Source
39+------
40+
41+ ++ bix (bass 16 (stun [2 2] six))
42+
43+Examples
44+--------
45+
46+ ~zod/try=> (scan "07" bix:ab)
47+ q=7
48+ ~zod/try=> (scan "51" bix:ab)
49+ q=81
50+ ~zod/try=> (scan "a3" bix:ab)
51+ q=163
52+
53+------------------------------------------------------------------------
54+
55+### `++hif`
56+
57+Parse phonetic pair
58+
59+Parsing [`++rule`](). Parses an atom of [odor]() [`@pE`](), a phrase of two bytes
60+encoded phonetically.
61+
62+Accepts
63+-------
64+
65+XX
66+
67+Produces
68+--------
69+
70+An atom.
71+
72+Source
73+------
74+
75+ ++ hif (boss 256 ;~(plug tip tiq (easy ~)))
76+
77+Examples
78+--------
79+
80+ ~zod/try=> (scan "doznec" hif:ab)
81+ q=256
82+ ~zod/try=> (scan "pittyp" hif:ab)
83+ q=48.626
84+
85+------------------------------------------------------------------------
86+
87+### `++huf`
88+
89+Parse two phonetic pairs
90+
91+Parsing [`++rule`](). Parses and unscrambles an atom of odor [@pF](), a phrase
92+of two two-byte pairs that are encoded (and scrambled) phonetically.
93+
94+Accepts
95+-------
96+
97+XX
98+
99+Produces
100+--------
101+
102+An atom. XX
103+
104+Source
105+------
106+
107+ ++ huf %+ cook
108+ |=([a=@ b=@] (wred:un ~(zug mu ~(zag mu [a b]))))
109+ ;~(plug hif ;~(pfix hep hif))
110+
111+Examples
112+--------
113+
114+ ~zod/try=> (scan "pittyp-pittyp" huf:ab)
115+ 328.203.557
116+ ~zod/try=> (scan "tasfyn-partyv" huf:ab)
117+ 65.792
118+ ~zod/try=> `@ux`(scan "tasfyn-partyv" huf:ab)
119+ 0x1.0100
120+
121+------------------------------------------------------------------------
122+
123+### `++hyf`
124+
125+Parse 8 phonetic bytes
126+
127+Parsing [`++rule`](). Parses an atom of odor [@pG](), a phrase of eight of
128+phonetic bytes.
129+
130+Accepts
131+-------
132+
133+An atom of odor [`@pG`]()
134+
135+Produces
136+--------
137+
138+An atom. XX
139+
140+Source
141+------
142+
143+ ++ hyf (bass 0x1.0000.0000 ;~(plug huf ;~(pfix hep huf) (easy ~)))
144+
145+Examples
146+--------
147+
148+ ~zod/try=> (scan "sondel-forsut-tillyn-nillyt" hyf:ab)
149+ q=365.637.097.828.335.095
150+ ~zod/try=> `@u`~sondel-forsut-tillyn-nillyt
151+ 365.637.097.828.335.095
152+
153+------------------------------------------------------------------------
154+
155+### `++pev`
156+
157+Parse \<= 5 base-32
158+
159+Parsing [`++rule`](). Parses up to five base-32 digits without a leading zero.
160+
161+Accepts
162+-------
163+
164+Up to five [@uv]() (base 64) digits.
165+
166+Produces
167+--------
168+
169+An atom.
170+
171+Source
172+------
173+
174+ ++ pev (bass 32 ;~(plug sev (stun [0 4] siv)))
175+
176+Examples
177+--------
178+
179+ ~zod/try=> (scan "a" pev:ab)
180+ q=10
181+ ~zod/try=> (scan "290j" pev:ab)
182+ q=74.771
183+ ~zod/try=> (scan "123456" pev:ab)
184+ ! {1 6}
185+ ! exit
186+ ~zod/try=> (scan "090j" pev:ab)
187+ ~ <syntax error at [1 11]>
188+
189+------------------------------------------------------------------------
190+
191+### `++pew`
192+
193+Parse \<= 5 base-64
194+
195+Parsing [`++rule`](). Parses up to five base-64 digits without a leading zero.
196+
197+Accepts
198+-------
199+
200+Up to five [@uw]() (base 64) digits.
201+
202+Produces
203+--------
204+
205+
206+
207+Source
208+------
209+
210+ ++ pew (bass 64 ;~(plug sew (stun [0 4] siw)))
211+
212+Examples
213+--------
214+
215+ ~zod/try=> (scan "Q" pew:ab)
216+ q=52
217+ ~zod/try=> (scan "aQ~9" pew:ab)
218+ q=2.838.473
219+ ~zod/try=> `@`0waQ~9
220+ 2.838.473
221+ ~zod/try=> (scan "123456" pew:ab)
222+ ! {1 6}
223+ ! exit
224+ ~zod/try=> (scan "012345" pew:ab)
225+ ! {1 1}
226+ ! exit
227+
228+------------------------------------------------------------------------
229+
230+### `++piv`
231+
232+Parse 5 base-32
233+
234+Parsing [`++rule`](). Parses exactly five base-32 digits.
235+
236+Accepts
237+-------
238+
239+Produces
240+--------
241+
242+Source
243+------
244+
245+ ++ piv (bass 32 (stun [5 5] siv))
246+
247+Examples
248+--------
249+
250+ ~zod/try=> (scan "10b3l" piv:ab)
251+ q=1.059.957
252+ ~zod/try=> (scan "1" piv:ab)
253+ ! {1 2}
254+ ! exit
255+
256+------------------------------------------------------------------------
257+
258+### `++piw`
259+
260+Parse 5 base-64
261+
262+Parsing [`++rule`](). Parses exactly five base-64 digits.
263+
264+Accepts
265+-------
266+
267+Produces
268+--------
269+
270+My name henry let's see how fast I can type.
271+
272+Source
273+------
274+
275+ ++ piw (bass 64 (stun [5 5] siw))
276+
277+Examples
278+--------
279+
280+ ~zod/try=> (scan "2C-pZ" piw:ab)
281+ q=43.771.517
282+ ~zod/try=> (scan "2" piv:ab)
283+ ! {1 2}
284+ ! exit
285+
286+------------------------------------------------------------------------
287+
288+### `++qeb`
289+
290+Parse \<= 4 binary
291+
292+Parsing [`++rule`](). Parses a binary number of up to 4 digits in length without
293+a leading zero.
294+
295+Accepts
296+-------
297+
298+Produces
299+--------
300+
301+Source
302+------
303+
304+ ++ qeb (bass 2 ;~(plug seb (stun [0 3] sib)))
305+
306+Examples
307+--------
308+
309+ ~zod/try=> (scan "1" qeb:ab)
310+ q=1
311+ ~zod/try=> (scan "101" qeb:ab)
312+ q=5
313+ ~zod/try=> (scan "1111" qeb:ab)
314+ q=15
315+ ~zod/try=> (scan "11111" qeb:ab)
316+ ! {1 5}
317+ ! exit
318+ ~zod/try=> (scan "01" qeb:ab)
319+ ! {1 1}
320+ ! exit
321+
322+------------------------------------------------------------------------
323+
324+### `++qex`
325+
326+Parse \<= 4 hex
327+
328+Parsing [`++rule`](). Parses a hexadecimal number of up to 4 digits in length
329+without a leading zero.
330+
331+Accepts
332+-------
333+
334+Produces
335+--------
336+
337+Source
338+------
339+
340+ ++ qex (bass 16 ;~(plug sex (stun [0 3] hit)))
341+
342+Examples
343+--------
344+
345+ ~zod/try=> (scan "ca" qex:ab)
346+ q=202
347+ ~zod/try=> (scan "18ac" qex:ab)
348+ q=6.316
349+ ~zod/try=> (scan "18acc" qex:ab)
350+ ! {1 5}
351+ ! exit
352+ ~zod/try=> (scan "08ac" qex:ab)
353+ ! {1 1}
354+ ! exit
355+
356+------------------------------------------------------------------------
357+
358+### `++qib`
359+
360+Parse 4 binary
361+
362+Parsing [`++rule`](). Parses exactly four binary digits.
363+
364+Accepts
365+-------
366+
367+Produces
368+--------
369+
370+Source
371+------
372+
373+ ++ qib (bass 2 (stun [4 4] sib))
374+
375+Examples
376+--------
377+
378+ ~zod/try=> (scan "0001" qib:ab)
379+ q=1
380+ ~zod/try=> (scan "0100" qib:ab)
381+ q=4
382+ ~zod/try=> (scan "110" qib:ab)
383+ ! {1 4}
384+ ! exit
385+
386+------------------------------------------------------------------------
387+
388+### `++qix`
389+
390+Parse 4 hex
391+
392+Parsing [`++rule`](). Parses exactly four hexadecimal digits.
393+
394+Accepts
395+-------
396+
397+Produces
398+--------
399+
400+Source
401+------
402+
403+ ++ qix (bass 16 (stun [4 4] six))
404+
405+Examples
406+--------
407+
408+ ~zod/try=> (scan "0100" qix:ab)
409+ q=256
410+ ~zod/try=> (scan "10ff" qix:ab)
411+ q=4.351
412+ ~zod/try=> (scan "0" qix:ab)
413+ ! {1 2}
414+ ! exit
415+
416+------------------------------------------------------------------------
417+
418+### `++seb`
419+
420+Parse 1
421+
422+Parsing [`++rule`](). Parses the number 1.
423+
424+Accepts
425+-------
426+
427+Produces
428+--------
429+
430+Source
431+------
432+
433+ ++ seb (cold 1 (just '1'))
434+
435+Examples
436+--------
437+
438+ ~zod/try=> (scan "1" seb:ab)
439+ 1
440+ ~zod/try=> (scan "0" seb:ab)
441+ ! ~zod/try/~2014.10.23..22.34.21..bfdd/:<[1 1].[1 18]>
442+ ! {1 1}
443+ ~zod/try=> (scan "2" seb:ab)
444+ ! ~zod/try/~2014.10.23..22.34.29..d399/:<[1 1].[1 18]>
445+ ! {1 1}
446+
447+------------------------------------------------------------------------
448+
449+### `++sed`
450+
451+Parse decimal
452+
453+Parsing [`++rule`](). Parses a nonzero decimal digit.
454+
455+Accepts
456+-------
457+
458+Produces
459+--------
460+
461+Source
462+------
463+
464+ ++ sed (cook |=(a=@ (sub a '0')) (shim '1' '9'))
465+
466+Examples
467+--------
468+
469+ ~zod/try=> (scan "5" sed:ab)
470+ 5
471+ ~zod/try=> (scan "0" sed:ab)
472+ ! {1 1}
473+ ! exit
474+
475+------------------------------------------------------------------------
476+
477+### `++sev`
478+
479+Parse base-32
480+
481+Parsing [`++rule`](). Parses a nonzero base-32 digit
482+
483+Accepts
484+-------
485+
486+Produces
487+--------
488+
489+Source
490+------
491+
492+ ++ sev ;~(pose sed sov)
493+
494+Examples
495+--------
496+
497+ ~zod/try=> (scan "c" sev:ab)
498+ 12
499+ ~zod/socialnet=> (scan "0" sev:ab)
500+ ! {1 1}
501+ ! exit
502+
503+------------------------------------------------------------------------
504+
505+### `++sew`
506+
507+Parse base-64
508+
509+Parsing [`++rule`](). Parses a nonzero base-64 digit
510+
511+Accepts
512+-------
513+
514+Produces
515+--------
516+
517+Source
518+------
519+
520+ ++ sew ;~(pose sed sow)
521+
522+Examples
523+--------
524+
525+ ~zod/try=> (scan "M" sew:ab)
526+ 48
527+ ~zod/try=> (scan "0" sew:ab)
528+ ! {1 1}
529+ ! exit
530+
531+------------------------------------------------------------------------
532+
533+### `++sex`
534+
535+Parse hex
536+
537+Parsing [`++rule`](). Parses a nonzero hexadecimal digit.
538+
539+Accepts
540+-------
541+
542+Produces
543+--------
544+
545+Source
546+------
547+
548+ ++ sex ;~(pose sed sox)
549+
550+Examples
551+--------
552+
553+ ~zod/try=> (scan "e" sex:ab)
554+ 14
555+ ~zod/try=> (scan "0" sex:ab)
556+ ! {1 1}
557+ ! exit
558+
559+------------------------------------------------------------------------
560+
561+### `++sib`
562+
563+Parse binary
564+
565+Parsing [`++rule`](). Parses a binary digit.
566+
567+Accepts
568+-------
569+
570+Produces
571+--------
572+
573+Source
574+------
575+
576+ ++ sib (cook |=(a=@ (sub a '0')) (shim '0' '1'))
577+
578+Examples
579+--------
580+
581+ ~zod/try=> (scan "1" sib:ab)
582+ 1
583+ ~zod/socialnet=> (scan "0" sib:ab)
584+ 0
585+
586+------------------------------------------------------------------------
587+
588+### `++sid`
589+
590+Parse decimal
591+
592+Parsing [`++rule`](). Parses a decimal digit.
593+
594+Accepts
595+-------
596+
597+Produces
598+--------
599+
600+Source
601+------
602+
603+ ++ sid (cook |=(a=@ (sub a '0')) (shim '0' '9'))
604+
605+Examples
606+--------
607+
608+ ~zod/try=> (scan "5" sid:ab)
609+ 5
610+
611+------------------------------------------------------------------------
612+
613+### `++siv`
614+
615+Parse base-32
616+
617+Parsing [`++rule`](). Parses a base-32 digit.
618+
619+Accepts
620+-------
621+
622+Produces
623+--------
624+
625+Source
626+------
627+
628+ ++ siv ;~(pose sid sov)
629+
630+Examples
631+--------
632+
633+ ~zod/try=> (scan "c" siv:ab)
634+ 12
635+
636+------------------------------------------------------------------------
637+
638+### `++siw`
639+
640+Parse base-64
641+
642+Parsing [`++rule`](). Parses a base-64 digit.
643+
644+Accepts
645+-------
646+
647+Produces
648+--------
649+
650+Source
651+------
652+
653+ ++ siw ;~(pose sid sow)
654+
655+Examples
656+--------
657+
658+ ~zod/try=> (scan "M" siw:ab)
659+ 48
660+
661+------------------------------------------------------------------------
662+
663+### `++six`
664+
665+Parse hex
666+
667+Parsing [`++rule`](). Parses a hexadecimal digit.
668+
669+Accepts
670+-------
671+
672+Produces
673+--------
674+
675+Source
676+------
677+
678+ ++ six ;~(pose sid sox)
679+
680+Examples
681+--------
682+
683+ ~zod/try=> (scan "e" six:ab)
684+ 14
685+
686+------------------------------------------------------------------------
687+
688+### `++sov`
689+
690+Parse base-32
691+
692+Parsing [`++rule`](). Parses a base-32 letter.
693+
694+Accepts
695+-------
696+
697+Produces
698+--------
699+
700+Source
701+------
702+
703+ ++ sov (cook |=(a=@ (sub a 87)) (shim 'a' 'v'))
704+
705+Examples
706+--------
707+
708+ ~zod/try=> (scan "c" sov:ab)
709+ 12
710+
711+------------------------------------------------------------------------
712+
713+### `++sow`
714+
715+Parse base-64
716+
717+Parsing [`++rule`](). Parses a base-64 letter/symbol.
718+
719+Accepts
720+-------
721+
722+Produces
723+--------
724+
725+Source
726+------
727+
728+ ++ sow ;~ pose
729+ (cook |=(a=@ (sub a 87)) (shim 'a' 'z'))
730+ (cook |=(a=@ (sub a 29)) (shim 'A' 'Z'))
731+ (cold 62 (just '-'))
732+ (cold 63 (just '~'))
733+ ==
734+
735+Examples
736+--------
737+
738+ ~zod/try=> (scan "M" sow:ab)
739+ 48
740+
741+------------------------------------------------------------------------
742+
743+### `++sox`
744+
745+Parse hex letter
746+
747+Parsing [`++rule`](). Parses a hexadecimal letter.
748+
749+Accepts
750+-------
751+
752+Produces
753+--------
754+
755+Source
756+------
757+
758+ ++ sox (cook |=(a=@ (sub a 87)) (shim 'a' 'f'))
759+
760+Examples
761+--------
762+
763+ ~zod/try=> (scan "e" sox:ab)
764+ 14
765+
766+------------------------------------------------------------------------
767+
768+### `++ted`
769+
770+Parse \<= 3 decimal
771+
772+Parsing [`++rule`](). Parses a decimal number of up to 3 digits without a
773+leading zero.
774+
775+Accepts
776+-------
777+
778+Produces
779+--------
780+
781+Source
782+------
783+
784+ ++ ted (bass 10 ;~(plug sed (stun [0 2] sid)))
785+
786+Examples
787+--------
788+
789+ ~zod/try=> (scan "21" ted:ab)
790+ q=21
791+ ~zod/try=> (scan "214" ted:ab)
792+ q=214
793+ ~zod/try=> (scan "2140" ted:ab)
794+ {1 4}
795+ ~zod/try=> (scan "0" ted:ab)
796+ ! {1 1}
797+ ! exit
798+
799+------------------------------------------------------------------------
800+
801+### `++tip`
802+
803+Leading phonetic byte
804+
805+Parsing [`++rule`](). Parses the leading phonetic byte, which represents a
806+syllable.
807+
808+Accepts
809+-------
810+
811+Produces
812+--------
813+
814+Source
815+------
816+
817+ ++ tip (sear |=(a=@ (ins:po a)) til)
818+
819+Examples
820+--------
821+
822+ ~zod/try=> (scan "doz" tip:ab)
823+ 0
824+ ~zod/try=> (scan "pit" tip:ab)
825+ 242
826+
827+------------------------------------------------------------------------
828+
829+### `++tiq`
830+
831+Trailing phonetic syllable
832+
833+Parsing [`++rule`](). Parses the trailing phonetic byte, which represents a
834+syllable.
835+
836+Accepts
837+-------
838+
839+Produces
840+--------
841+
842+Source
843+------
844+
845+ ++ tiq (sear |=(a=@ (ind:po a)) til)
846+
847+Examples
848+--------
849+
850+ ~zod/try=> (scan "zod" tiq:ab)
851+ 0
852+ ~zod/try=> (scan "nec" tiq:ab)
853+ 1
854+
855+------------------------------------------------------------------------
856+
857+### `++tid`
858+
859+Parse 3 decimal digits
860+
861+Parsing [`++rule`](). Parses exactly three decimal digits.
862+
863+Accepts
864+-------
865+
866+Produces
867+--------
868+
869+Source
870+------
871+
872+ ++ tid (bass 10 (stun [3 3] sid))
873+
874+Examples
875+--------
876+
877+ ~zod/try=> (scan "013" tid:ab)
878+ q=13
879+ ~zod/try=> (scan "01" tid:ab)
880+ ! {1 3}
881+ ! exit
882+
883+------------------------------------------------------------------------
884+
885+### `++til`
886+
887+Parse 3 lowercase
888+
889+Parsing [`++rule`](). Parses exactly three lowercase letters.
890+
891+Accepts
892+-------
893+
894+Produces
895+--------
896+
897+Source
898+------
899+
900+ ++ til (boss 256 (stun [3 3] low))
901+
902+Examples
903+--------
904+
905+ ~zod/try=> (scan "mer" til:ab)
906+ q=7.497.069
907+ ~zod/try=> `@t`(scan "mer" til:ab)
908+ 'mer'
909+ ~zod/try=> (scan "me" til:ab)
910+ ! {1 3}
911+ ! exit
912+
913+------------------------------------------------------------------------
914+
915+### `++urs`
916+
917+Parse span characters
918+
919+Parsing rule. Parses characters from an atom of the span odor [`@ta`]().
920+
921+Accepts
922+-------
923+
924+Produces
925+--------
926+
927+Source
928+------
929+
930+ ++ urs %+ cook
931+ |=(a=tape (rap 3 ^-((list ,@) a)))
932+ (star ;~(pose nud low hep dot sig cab))
933+
934+Examples
935+--------
936+
937+ ~zod/try=> `@ta`(scan "asa-lom_tak" urs:ab)
938+ ~.asa-lom_tak
939+ ~zod/try=> `@t`(scan "asa-lom_tak" urs:ab)
940+ 'asa-lom_tak'
941+
942+------------------------------------------------------------------------
943+
944+### `++urt`
945+
946+Parse non-`_` span
947+
948+Parsing rule. Parses all characters of the span odor [`@ta`]() except
949+for cab, `_`.
950+
951+Accepts
952+-------
953+
954+Produces
955+--------
956+
957+Source
958+------
959+
960+ ++ urt %+ cook
961+ |=(a=tape (rap 3 ^-((list ,@) a)))
962+ (star ;~(pose nud low hep dot sig))
963+
964+Examples
965+--------
966+
967+ ~zod/try=> `@t`(scan "asa-lom.t0k" urt:ab)
968+ 'asa-lom.t0k'
969+
970+------------------------------------------------------------------------
971+
972+### `++voy`
973+
974+Parse bas, soq, or bix
975+
976+Parsing rule. Parses an escaped backslash, single quote, or hex pair
977+byte.
978+
979+Accepts
980+-------
981+
982+Produces
983+--------
984+
985+Source
986+------
987+
988+ ++ voy ;~(pfix bas ;~(pose bas soq bix))
989+
990+Examples
991+--------
992+
993+ ~zod/try=> (scan "\\0a" voy:ab)
994+ q=10
995+ ~zod/try=> (scan "\\'" voy:ab)
996+ q=39
997+
998+------------------------------------------------------------------------
999+
1000+### `++ag`
1001+
1002+Top-level atom parser engine
1003+
1004+A core containing top-level atom parsers.
1005+
1006+Accepts
1007+-------
1008+
1009+Produces
1010+--------
1011+
1012+Source
1013+------
1014+
1015+ ++ ag
1016+ |%
1017+
1018+Examples
1019+--------
1020+
1021+ ~zod/try=> ag
1022+ <14.vpu 414.mof 100.xkc 1.ypj %164>
1023+
1024+------------------------------------------------------------------------
1025+
1026+### `++ape`
1027+
1028+Parse 0 or rule
1029+
1030+Parser modifier. Parses 0 or the sample rule `fel`.
1031+
1032+Accepts
1033+-------
1034+
1035+Produces
1036+--------
1037+
1038+`fel` is a [`rule`]().
1039+
1040+Source
1041+------
1042+
1043+ ++ ape |*(fel=_rule ;~(pose (cold 0 (just '0')) fel))
1044+
1045+Examples
1046+--------
1047+
1048+ ~zod/try=> (scan "202" (star (ape:ag (cold 2 (just '2')))))
1049+ ~[2 0 2]
1050+
1051+------------------------------------------------------------------------
1052+
1053+### `++bay`
1054+
1055+Parses binary number
1056+
1057+Parsing rule. Parses a binary number without a leading zero.
1058+
1059+Accepts
1060+-------
1061+
1062+Produces
1063+--------
1064+
1065+Source
1066+------
1067+
1068+ ++ bay (ape (bass 16 ;~(plug qeb:ab (star ;~(pfix dog qib:ab)))))
1069+
1070+Examples
1071+--------
1072+
1073+ ~zod/try=> (scan "10.0110" bay:ag)
1074+ q=38
1075+
1076+------------------------------------------------------------------------
1077+
1078+### `++bip`
1079+
1080+Parse IPv6
1081+
1082+Parsing rule. Parses a [`@is`](), an IPv6 address.
1083+
1084+Accepts
1085+-------
1086+
1087+Produces
1088+--------
1089+
1090+Source
1091+------
1092+
1093+ ++ bip =+ tod=(ape qex:ab)
1094+ (bass 0x1.0000 ;~(plug tod (stun [7 7] ;~(pfix dog tod))))
1095+
1096+Examples
1097+--------
1098+
1099+ ~zod/try=> (scan "0.0.ea.3e6c.0.0.0.0" bip:ag)
1100+ q=283.183.420.760.121.105.516.068.864
1101+ ~zod/try=> `@is`(scan "0.0.ea.3e6c.0.0.0.0" bip:ag)
1102+ .0.0.ea.3e6c.0.0.0.0
1103+
1104+------------------------------------------------------------------------
1105+
1106+### `++dem`
1107+
1108+Parse decimal with dots
1109+
1110+Parsing rule. Parses a decimal number that includes dot separators.
1111+
1112+Accepts
1113+-------
1114+
1115+Produces
1116+--------
1117+
1118+Source
1119+------
1120+
1121+ ++ dem (ape (bass 1.000 ;~(plug ted:ab (star ;~(pfix dog tid:ab)))))
1122+
1123+Examples
1124+--------
1125+
1126+ ~zod/try=> (scan "52" dem:ag)
1127+ q=52
1128+ ~zod/try=> (scan "13.507" dem:ag)
1129+ q=13.507
1130+
1131+------------------------------------------------------------------------
1132+
1133+### `++dim`
1134+
1135+Parse decimal number
1136+
1137+Parsing rule. Parses a decimal number without a leading zero.
1138+
1139+Accepts
1140+-------
1141+
1142+Produces
1143+--------
1144+
1145+Source
1146+------
1147+
1148+ ++ dim (ape (bass 10 ;~(plug sed:ab (star sid:ab))))
1149+
1150+Examples
1151+--------
1152+
1153+ ~zod/try=> (scan "52" dim:ag)
1154+ q=52
1155+ ~zod/try=> (scan "013507" dim:ag)
1156+ ! {1 2}
1157+ ! exit
1158+
1159+------------------------------------------------------------------------
1160+
1161+### `++dum`
1162+
1163+Parse decimal with leading `0`
1164+
1165+Parsing rule. Parses a decmial number with leading zeroes.
1166+
1167+Accepts
1168+-------
1169+
1170+Produces
1171+--------
1172+
1173+Source
1174+------
1175+
1176+ ++ dum (bass 10 (plus sid:ab))
1177+
1178+Examples
1179+--------
1180+
1181+ ~zod/try=> (scan "52" dum:ag)
1182+ q=52
1183+ ~zod/try=> (scan "0000052" dum:ag)
1184+ q=52
1185+ ~zod/try=> (scan "13507" dim:ag)
1186+ q=13.507
1187+
1188+------------------------------------------------------------------------
1189+
1190+### `++fed`
1191+
1192+Parse phonetic base
1193+
1194+Parsing rule. Parses an atom of odor [`@p`](), the phonetic base.
1195+
1196+Accepts
1197+-------
1198+
1199+Produces
1200+--------
1201+
1202+Source
1203+------
1204+
1205+ ++ fed ;~ pose
1206+ (bass 0x1.0000.0000.0000.0000 (most doh hyf:ab))
1207+ huf:ab
1208+ hif:ab
1209+ tiq:ab
1210+ ==
1211+
1212+Examples
1213+--------
1214+
1215+ ~zod/try=> (scan "zod" fed:ag)
1216+ 0
1217+ ~zod/try=> (scan "nec" fed:ag)
1218+ 1
1219+ ~zod/try=> (scan "sondel" fed:ag)
1220+ 9.636
1221+ ~zod/try=> ~tillyn-nillyt
1222+ ~tillyn-nillyt
1223+ ~zod/try=> (scan "tillyn-nillyt" fed:ag)
1224+ 3.569.565.175
1225+ ~zod/try=> (scan "tillyn-nillyt-tasfyn-partyv" fed:ag)
1226+ 15.331.165.687.565.582.592
1227+ ~zod/try=> (scan "tillyn-nillyt-tasfyn-partyv--novweb-talrud-talmud-sonfyr" fed:ag)
1228+ 282.810.089.790.159.633.869.501.053.313.363.681.181
1229+
1230+------------------------------------------------------------------------
1231+
1232+### `++hex`
1233+
1234+Parse hex
1235+
1236+Parsing rule. Parses a hexadecimal number
1237+
1238+Accepts
1239+-------
1240+
1241+Produces
1242+--------
1243+
1244+Source
1245+------
1246+
1247+ ++ hex (ape (bass 0x1.0000 ;~(plug qex:ab (star ;~(pfix dog qix:ab)))))
1248+
1249+Examples
1250+--------
1251+
1252+ ~zod/try=> (scan "4" hex:ag)
1253+ q=4
1254+ ~zod/try=> (scan "1a" hex:ag)
1255+ q=26
1256+ ~zod/try=> (scan "3.ac8d" hex:ag)
1257+ q=240.781
1258+ ~zod/try=> `@ux`(scan "3.ac8d" hex:ag)
1259+ 0x3.ac8d
1260+
1261+------------------------------------------------------------------------
1262+
1263+### `++lip`
1264+
1265+Parse IPv4 address
1266+
1267+Parsing rule. Parses an IPv4 address.
1268+
1269+Accepts
1270+-------
1271+
1272+Produces
1273+--------
1274+
1275+Source
1276+------
1277+
1278+ ++ lip =+ tod=(ape ted:ab)
1279+ (bass 256 ;~(plug tod (stun [3 3] ;~(pfix dog tod))))
1280+
1281+Examples
1282+--------
1283+
1284+ ~zod/try=> (scan "127.0.0.1" lip:ag)
1285+ q=2.130.706.433
1286+ ~zod/try=> `@if`(scan "127.0.0.1" lip:ag)
1287+ .127.0.0.1
1288+ ~zod/try=> `@if`(scan "8.8.8.8" lip:ag)
1289+ .8.8.8.8
1290+
1291+------------------------------------------------------------------------
1292+
1293+### `++viz`
1294+
1295+Parse Base-32 with dots
1296+
1297+Parsing rule. Parses a Base-32 number with dot separators.
1298+
1299+Accepts
1300+-------
1301+
1302+Produces
1303+--------
1304+
1305+Source
1306+------
1307+
1308+ ++ viz (ape (bass 0x200.0000 ;~(plug pev:ab (star ;~(pfix dog piv:ab)))))
1309+
1310+Examples
1311+--------
1312+
1313+ ~zod/try=> (scan "e2.ol4pm" viz:ag)
1314+ q=15.125.353.270
1315+
1316+------------------------------------------------------------------------
1317+
1318+### `++vum`
1319+
1320+Parse base-32 string
1321+
1322+Parsing rule. Parses a raw base-32 string.
1323+
1324+Accepts
1325+-------
1326+
1327+Produces
1328+--------
1329+
1330+Source
1331+------
1332+
1333+ ++ vum (bass 32 (plus siv:ab))
1334+
1335+Examples
1336+--------
1337+
1338+ ~zod/try=> (scan "e2ol4pm" vum:ag)
1339+ q=15.125.353.270
1340+
1341+------------------------------------------------------------------------
1342+
1343+### `++wiz`
1344+
1345+Parse base-64
1346+
1347+Parsing rule. Parses a base-64 number.
1348+
1349+Accepts
1350+-------
1351+
1352+Produces
1353+--------
1354+
1355+Source
1356+------
1357+
1358+ ++ wiz (ape (bass 0x4000.0000 ;~(plug pew:ab (star ;~(pfix dog piw:ab)))))
1359+ --
1360+ ::
1361+
1362+Examples
1363+--------
1364+
1365+ ~zod/try=> (scan "e2O.l4Xpm" wiz:ag)
1366+ q=61.764.130.813.526
1367+
1368+***
1369+### `++mu`
1370+
1371+Core used to scramble 16-bit atoms
1372+
1373+A [door]() that contains arms that are used to scramble two atoms, `top`
1374+and `bot`. Used especially in the phonetic base to disguise the
1375+relationship between a destroyer and its cruiser.
1376+
1377+Accepts
1378+-------
1379+
1380+Produces
1381+--------
1382+
1383+`bot` is an [atom]().
1384+
1385+`top` is an [atom]().
1386+
1387+Source
1388+------
1389+
1390+ ++ mu
1391+ |_ [top=@ bot=@]
1392+
1393+Examples
1394+--------
1395+
1396+ ~zod/try=> ~(. mu 0x20e5 0x5901)
1397+ <3.sjm [[@ux @ux] <414.hhh 100.xkc 1.ypj %164>]>
1398+
1399+------------------------------------------------------------------------
1400+
1401+### `++zag`
1402+
1403+Add bottom into top
1404+
1405+Produces the cell of `top` and `bot` with `top` scrambled to the result
1406+of adding `bot` to `top` modulo 16. Used to scramble the name of a
1407+destroyer.
1408+
1409+Accepts
1410+-------
1411+
1412+Produces
1413+--------
1414+
1415+`bot` is an [atom]().
1416+
1417+`top` is an [atom]().
1418+
1419+Source
1420+------
1421+
1422+ ++ zag [p=(end 4 1 (add top bot)) q=bot]
1423+
1424+Examples
1425+--------
1426+
1427+ ~zod/try=> `[@ux @ux]`~(zag mu 0x20e0 0x201)
1428+ [0x22e1 0x201]
1429+
1430+------------------------------------------------------------------------
1431+
1432+### `++zig`
1433+
1434+Subtract bottom from top
1435+
1436+The inverse of [`++zag`](). Produces the cell of `top` and `bot` with
1437+`top` unscrambled. The unscrambled `top` is the sum of the sample `top`
1438+and the 16-bit complement of `bot`. Used to unscramble the name of the
1439+destroyer.
1440+
1441+Accepts
1442+-------
1443+
1444+Produces
1445+--------
1446+
1447+`bot` is an [atom]().
1448+
1449+`top` is an [atom]().
1450+
1451+Source
1452+------
1453+
1454+ ++ zig [p=(end 4 1 (add top (sub 0x1.0000 bot))) q=bot]
1455+
1456+Examples
1457+--------
1458+
1459+ ~zod/try=> `[@ux @ux]`~(zig mu 0x2f46 0x1042)
1460+ [0x1f04 0x1042]
1461+
1462+------------------------------------------------------------------------
1463+
1464+### `++zug`
1465+
1466+Concatenate into atom
1467+
1468+Produces the concatenation of `top` and `bot`. Used to assemble a
1469+destroyer name.
1470+
1471+Accepts
1472+-------
1473+
1474+Produces
1475+--------
1476+
1477+`bot` is an [atom]().
1478+
1479+`top` is an [atom]().
1480+
1481+Source
1482+------
1483+
1484+ ++ zug (mix (lsh 4 1 top) bot)
1485+
1486+Examples
1487+--------
1488+
1489+ ~zod/try=> `@ux`~(zug mu 0x10e1 0xfa)
1490+ 0x10e1.00fa
1491+
1492+
1493+
1494+***
1495+### `++ne`
1496+
1497+Digit rendering engine
1498+
1499+A [door]() containing arms that render digits at bases 10, 16, 32, and
1500+64.
1501+
1502+Accepts
1503+-------
1504+
1505+Produces
1506+--------
1507+
1508+`tig` is an [`atom`]().
1509+
1510+Source
1511+------
1512+
1513+ ++ ne
1514+ |_ tig=@
1515+
1516+Examples
1517+--------
1518+
1519+ ~zod/try=> ~(. ne 20)
1520+ <4.gut [@ud <414.hhh 100.xkc 1.ypj %164>]>
1521+
1522+------------------------------------------------------------------------
1523+
1524+### `++d`
1525+
1526+Render decimal
1527+
1528+Renders a decimal digit as an atom of an ACII byte value.
1529+
1530+Accepts
1531+-------
1532+
1533+Produces
1534+--------
1535+
1536+`tig` is an [`atom`]().
1537+
1538+Source
1539+------
1540+
1541+ ++ d (add tig '0')
1542+
1543+Examples
1544+--------
1545+
1546+ ~zod/try=> `@t`~(d ne 7)
1547+ '7'
1548+
1549+------------------------------------------------------------------------
1550+
1551+### `++x`
1552+
1553+Render hex
1554+
1555+Renders a hexadecimal digit as an atom of an ASCII byte value.
1556+
1557+Accepts
1558+-------
1559+
1560+Produces
1561+--------
1562+
1563+`tig` is an [`atom`]().
1564+
1565+Source
1566+------
1567+
1568+ ++ x ?:((gte tig 10) (add tig 87) d)
1569+
1570+Examples
1571+--------
1572+
1573+ ~zod/try=> `@t`~(x ne 7)
1574+ '7'
1575+ ~zod/try=> `@t`~(x ne 14)
1576+ 'e'
1577+
1578+------------------------------------------------------------------------
1579+
1580+### `++v`
1581+
1582+Render base-32
1583+
1584+Renders a base-32 digit as an atom of an ASCII byte value.
1585+
1586+Accepts
1587+-------
1588+
1589+Produces
1590+--------
1591+
1592+Source
1593+------
1594+
1595+ ++ v ?:((gte tig 10) (add tig 87) d)
1596+
1597+Examples
1598+--------
1599+
1600+ ~zod/try=> `@t`~(v ne 7)
1601+ '7'
1602+ ~zod/try=> `@t`~(v ne 14)
1603+ 'e'
1604+ ~zod/try=> `@t`~(v ne 25)
1605+ 'p'
1606+
1607+------------------------------------------------------------------------
1608+
1609+### `++w`
1610+
1611+Render base-64
1612+
1613+Renders a base-64 digit as an atom of an ASCII byte value.
1614+
1615+Accepts
1616+-------
1617+
1618+Produces
1619+--------
1620+
1621+`tig` is an [`atom`]().
1622+
1623+Source
1624+------
1625+
1626+ ++ w ?:(=(tig 63) '~' ?:(=(tig 62) '-' ?:((gte tig 36) (add tig 29) x)))
1627+ --
1628+ ::
1629+
1630+Examples
1631+--------
1632+
1633+ ~zod/try=> `@t`~(w ne 7)
1634+ '7'
1635+ ~zod/try=> `@t`~(w ne 14)
1636+ 'e'
1637+ ~zod/try=> `@t`~(w ne 25)
1638+ 'p'
1639+ ~zod/try=> `@t`~(w ne 52)
1640+ 'Q'
1641+ ~zod/try=> `@t`~(w ne 61)
1642+ 'Z'
1643+ ~zod/try=> `@t`~(w ne 63)
1644+ '~'
1645+ ~zod/try=> `@t`~(w ne 62)
1646+ '-'
1647+
1648+
1649+
1650+***
docs/system/hoon/library/4k.mdnew file+1337
@@ -0,0 +1,1337 @@
1+## 4k: atom printing
2+### `++alf`
3+
4+Alphabetic characters
5+
6+Parse alphabetic characters, both upper and lowercase.
7+
8+Source
9+------
10+
11+ ++ alf ;~(pose low hig) :: alphabetic
12+
13+Examples
14+--------
15+
16+ ~zod/try=> (scan "a" alf)
17+ ~~a
18+ ~zod/try=> (scan "A" alf)
19+ ~~~41.
20+ ~zod/try=> (scan "AaBbCc" (star alf))
21+ "AaBbCc"
22+
23+
24+
25+***
26+### `++aln`
27+
28+Alphanumeric characters
29+
30+Parse alphanumeric characters - both alphabetic characters and numbers.
31+
32+Source
33+------
34+
35+ ++ aln ;~(pose low hig nud) :: alphanumeric
36+
37+Examples
38+--------
39+
40+ ~zod/try=> (scan "0" aln)
41+ ~~0
42+ ~zod/try=> (scan "alf42" (star aln))
43+ "alf42"
44+ ~zod/try=> (scan "0123456789abcdef" (star aln))
45+ "0123456789abcdef"
46+
47+
48+
49+***
50+### `++alp`
51+
52+Alphanumeric and `-`
53+
54+Parse alphanumeric strings and hep, "-".
55+
56+Source
57+------
58+
59+ ++ alp ;~(pose low hig nud hep) :: alphanumeric and -
60+
61+Examples
62+--------
63+
64+ ~zod/try=> (scan "7" alp)
65+ ~~7
66+ ~zod/try=> (scan "s" alp)
67+ ~~s
68+ ~zod/try=> (scan "123abc-" (star alp))
69+ "123abc-"
70+
71+
72+
73+***
74+
75+### `++bet`
76+
77+Axis syntax `-`, `+`
78+
79+Parse the hep and lus axis syntax.
80+
81+Source
82+------
83+
84+ ++ bet ;~(pose (cold 2 hep) (cold 3 lus)) :: axis syntax - +
85+
86+Examples
87+--------
88+
89+ ~zod/try=> (scan "-" bet)
90+ 2
91+ ~zod/try=> (scan "+" bet)
92+ 3
93+
94+
95+
96+***
97+### `++bin`
98+
99+Binary to atom
100+
101+Parse a tape of binary (0s and 1s) and produce its atomic representation.
102+
103+Source
104+------
105+
106+ ++ bin (bass 2 (most gon but)) :: binary to atom
107+
108+Examples
109+--------
110+
111+ ~zod/try=> (scan "0000" bin)
112+ 0
113+ ~zod/try=> (scan "0001" bin)
114+ 1
115+ ~zod/try=> (scan "0010" bin)
116+ 2
117+ ~zod/try=> (scan "100000001111" bin)
118+ 2.063
119+
120+
121+
122+***
123+### `++but`
124+
125+Binary digit
126+
127+Parse a single binary digit.
128+
129+Source
130+------
131+
132+ ++ but (cook |=(a=@ (sub a '0')) (shim '0' '1')) :: binary digit
133+
134+Examples
135+--------
136+
137+ ~zod/try=> (scan "0" but)
138+ 0
139+ ~zod/try=> (scan "1" but)
140+ 1
141+ ~zod/try=> (scan "01" but)
142+ ! {1 2}
143+ ! 'syntax-error'
144+ ! exit
145+ ~zod/try=> (scan "01" (star but))
146+ ~[0 1]
147+
148+
149+
150+***
151+### `++cit`
152+
153+Octal digit
154+
155+Parse a single octal digit.
156+
157+Source
158+------
159+
160+ ++ cit (cook |=(a=@ (sub a '0')) (shim '0' '7')) :: octal digit
161+
162+Examples
163+--------
164+
165+ ~zod/try=> (scan "1" cit)
166+ 1
167+ ~zod/try=> (scan "7" cit)
168+ 7
169+ ~zod/try=> (scan "8" cit)
170+ ! {1 1}
171+ ! 'syntax-error'
172+ ! exit
173+ ~zod/try=> (scan "60" (star cit))
174+ ~[6 0]
175+
176+
177+
178+***
179+### `++dem`
180+
181+Decimal to atom
182+
183+Parse a decimal number to an atom.
184+
185+Source
186+------
187+
188+ ++ dem (bass 10 (most gon dit)) :: decimal to atom
189+
190+Examples
191+--------
192+
193+ ~zod/try=> (scan "7" dem)
194+ 7
195+ ~zod/try=> (scan "42" dem)
196+ 42
197+ ~zod/try=> (scan "150000000" dem)
198+ 150.000.000
199+ ~zod/try=> (scan "12456" dem)
200+ 12.456
201+
202+
203+
204+***
205+### `++dit`
206+
207+Decimal digit
208+
209+Parse a single decimal digit.
210+
211+Source
212+------
213+
214+ ++ dit (cook |=(a=@ (sub a '0')) (shim '0' '9')) :: decimal digit
215+
216+Examples
217+--------
218+
219+ ~zod/try=> (scan "7" dit)
220+ 7
221+ ~zod/try=> (scan "42" (star dit))
222+ ~[4 2]
223+ ~zod/try=> (scan "26000" (star dit))
224+ ~[2 6 0 0 0]
225+
226+
227+
228+***
229+### `++dog`
230+
231+`.` optional gap
232+
233+Dot followed by an optional gap, used with numbers.
234+
235+Source
236+------
237+
238+ ++ dog ;~(plug dot gay) ::
239+
240+Examples
241+--------
242+
243+ /~zod/try=> 1.234.
244+ 703
245+ 1.234.703
246+ ~zod/try=> (scan "a. " ;~(pfix alf dog))
247+ [~~~. ~]
248+
249+
250+
251+***
252+### `++doh`
253+
254+`@p` separator
255+
256+Phonetic base phrase separator
257+
258+Source
259+------
260+
261+ ++ doh ;~(plug ;~(plug hep hep) gay) ::
262+
263+Examples
264+--------
265+
266+ /~zod/try=> ~nopfel-botduc-nilnev-dolfyn--haspub-natlun-lodmur-holtyd
267+ ~nopfel-botduc-nilnev-dolfyn--haspub-natlun-lodmur-holtyd
268+ /~zod/try=> ~nopfel-botduc-nilnev-dolfyn--
269+ haspub-natlun-lodmur-holtyd
270+ ~nopfel-botduc-nilnev-dolfyn--haspub-natlun-lodmur-holtyd
271+ ~zod/try=> (scan "--" doh)
272+ [[~~- ~~-] ~]
273+ ~zod/try=> (scan "-- " doh)
274+ [[~~- ~~-] ~]
275+
276+
277+
278+***
279+### `++dun`
280+
281+`--` to `~`
282+
283+Parse phep, `--`, to null, `~`.
284+
285+Source
286+------
287+
288+ ++ dun (cold ~ ;~(plug hep hep)) :: -- (phep) to ~
289+
290+Examples
291+--------
292+
293+ ~zod/try=> (scan "--" dun)
294+ ~
295+ ~zod/try=> (dun [[1 1] "--"])
296+ [p=[p=1 q=3] q=[~ u=[p=~ q=[p=[p=1 q=3] q=""]]]]
297+
298+
299+
300+***
301+
302+### `++duz`
303+
304+`==` to `~`
305+
306+Parse stet, `==`, to null `~`.
307+
308+Source
309+------
310+
311+ ++ duz (cold ~ ;~(plug tis tis)) :: == (stet) to ~
312+
313+Examples
314+--------
315+
316+ ~zod/try=> (scan "==" duz)
317+ ~
318+ ~zod/try=> (duz [[1 1] "== |=..."])
319+ [p=[p=1 q=3] q=[~ u=[p=~ q=[p=[p=1 q=3] q=" |=..."]]]]
320+
321+
322+
323+***
324+
325+### `++gah`
326+
327+Newline or ' '
328+
329+Whitespace component, either newline or space.
330+
331+Source
332+------
333+
334+ ++ gah (mask [`@`10 ' ' ~]) :: newline or ace
335+
336+Examples
337+--------
338+
339+ /~zod/try=> ^- * :: show spaces
340+ """
341+ -
342+ -
343+ -
344+ """
345+ [32 32 32 45 10 32 45 10 32 32 45 0]
346+ /~zod/try=> ^- *
347+ """
348+
349+ """
350+ [32 32 32 10 32 10 32 32 0]
351+ /~zod/try=> ^- (list ,@)
352+ %- scan :_ (star gah)
353+ """
354+
355+ """
356+ ~[32 32 32 10 32 10 32 32]
357+
358+
359+
360+***
361+### `++gap`
362+
363+Plural whitespace
364+
365+Separates tall runes
366+
367+Source
368+------
369+
370+ ++ gap (cold ~ ;~(plug gaq (star ;~(pose vul gah)))) :: plural whitespace
371+
372+
373+
374+***
375+### `++gaq`
376+
377+End of line
378+
379+Two spaces, a newline, or comment.
380+
381+Source
382+------
383+
384+ ++ gaq ;~ pose :: end of line
385+ (just `@`10)
386+ ;~(plug gah ;~(pose gah vul))
387+ vul
388+ ==
389+
390+
391+
392+
393+***
394+### `++gaw`
395+
396+Classic whitespace
397+
398+Terran whitespace.
399+
400+Source
401+------
402+
403+ ++ gaw (cold ~ (star ;~(pose vul gah))) :: classic white
404+
405+
406+
407+***
408+### `++gay`
409+
410+Optional gap
411+
412+Optional gap.
413+
414+Source
415+------
416+
417+ ++ gay ;~(pose gap (easy ~)) ::
418+
419+
420+
421+***
422+### `++gon`
423+
424+Long numbers
425+
426+Parse long numbers - Numbers which wrap around the shell with the line
427+
428+Source
429+------
430+
431+break ++ gon ;~(pose ;~(plug bas gay fas) (easy ~)) :: long numbers \ /
432+
433+Examples
434+--------
435+characters bas and fas.
436+
437+ ~zod/try=> (scan "\\/" gon)
438+ [~~~5c. ~ ~~~2f.]
439+ ~zod/try=> (gon [[1 1] "\\/"])
440+ [p=[p=1 q=3] q=[~ u=[p=[~~~5c. ~ ~~~2f.] q=[p=[p=1 q=3] q=""]]]]
441+
442+
443+
444+***
445+### `++gul`
446+
447+Axis syntax `<` or `>`
448+
449+Parse the axis gal and gar axis syntax.
450+
451+Source
452+------
453+
454+ ++ gul ;~(pose (cold 2 gal) (cold 3 gar)) :: axis syntax < >
455+
456+Examples
457+--------
458+
459+ ~zod/try=> (scan "<" gul)
460+ 2
461+ ~zod/try=> (scan ">" gul)
462+ 3
463+
464+
465+
466+***
467+### `++hex`
468+
469+Hex to atom
470+
471+Parse any hexadecimal number to an atom.
472+
473+Source
474+------
475+
476+ ++ hex (bass 16 (most gon hit)) :: hex to atom
477+
478+Examples
479+--------
480+
481+ ~zod/try=> (scan "a" hex)
482+ 10
483+ ~zod/try=> (scan "A" hex)
484+ 10
485+ ~zod/try=> (scan "2A" hex)
486+ 42
487+ ~zod/try=> (scan "1ee7" hex)
488+ 7.911
489+ ~zod/try=> (scan "1EE7" hex)
490+ 7.911
491+ ~zod/try=> (scan "1EE7F7" hex)
492+ 2.025.463
493+ ~zod/try=> `@ux`(scan "1EE7F7" hex)
494+ 0x1e.e7f7
495+
496+
497+***
498+### `++hig`
499+
500+Uppercase
501+
502+Parse a single uppercase letter.
503+
504+Source
505+------
506+
507+ ++ hig (shim 'A' 'Z') :: uppercase
508+
509+Examples
510+--------
511+
512+ ~zod/try=> (scan "G" hig)
513+ ~~~47.
514+ ~zod/try=> `cord`(scan "G" hig)
515+ 'G'
516+ ~zod/try=> (scan "ABCDEFGHIJKLMNOPQRSTUVWXYZ" (star hig))
517+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
518+ ~zod/try=> (hig [[1 1] "G"])
519+ [p=[p=1 q=2] q=[~ [p=~~~47. q=[p=[p=1 q=2] q=""]]]]
520+
521+
522+
523+***
524+### `++hit`
525+
526+Hex digits
527+
528+Parse a single hexadecimal digit.
529+
530+Source
531+------
532+
533+ ++ hit ;~ pose :: hex digits
534+ dit
535+ (cook |=(a=char (sub a 87)) (shim 'a' 'f'))
536+ (cook |=(a=char (sub a 55)) (shim 'A' 'F'))
537+ ==
538+
539+Examples
540+--------
541+
542+ ~zod/try=> (scan "a" hit)
543+ 10
544+ ~zod/try=> (scan "A" hit)
545+ 10
546+ ~zod/try=> (hit [[1 1] "a"])
547+ [p=[p=1 q=2] q=[~ [p=10 q=[p=[p=1 q=2] q=""]]]]
548+ ~zod/try=> (scan "2A" (star hit))
549+ ~[2 10]
550+
551+
552+***
553+### `++iny`
554+
555+Indentation block
556+
557+Apply [`++rule`]() to indented block starting at current column number, omitting
558+the leading whitespace.
559+
560+Accepts
561+-------
562+
563+`sef` is a [`++rule`]()
564+
565+Produces
566+--------
567+
568+A `++rule`.
569+
570+Source
571+------
572+
573+ ++ iny |* sef=_rule :: indentation block
574+ |= nail ^+ (sef)
575+ =+ [har tap]=[p q]:+<
576+ =+ lev=(fil 3 (dec q.har) ' ')
577+ =+ eol=(just `@t`10)
578+ =+ =- roq=((star ;~(pose prn ;~(sfix eol (jest lev)) -)) har tap)
579+ ;~(simu ;~(plug eol eol) eol)
580+ ?~ q.roq roq
581+ =+ vex=(sef har(q 1) p.u.q.roq)
582+ =+ fur=p.vex(q (add (dec q.har) q.p.vex))
583+ ?~ q.vex vex(p fur)
584+ =- vex(p fur, u.q -)
585+ :+ &3.vex
586+ &4.vex(q.p (add (dec q.har) q.p.&4.vex))
587+ =+ res=|4.vex
588+ |- ?~ res |4.roq
589+ ?. =(10 -.res) [-.res $(res +.res)]
590+ (welp [`@t`10 (trip lev)] $(res +.res))
591+ ::
592+
593+Examples
594+--------
595+
596+ ~zod/try=> (scan "abc" (iny (star ;~(pose prn (just `@`10)))))
597+ "abc"
598+ ~zod/try=> (scan "abc" (star ;~(pose prn (just `@`10))))
599+ "abc"
600+ ~zod/try=> (scan " abc\0ade" ;~(pfix ace ace (star ;~(pose prn (just `@`10)))))
601+ "abc
602+ de"
603+ ~zod/try=> (scan " abc\0ade" ;~(pfix ace ace (iny (star ;~(pose prn (just `@`10))))))
604+ ! {1 6}
605+ ! exit
606+ ~zod/try=> (scan " abc\0a de" ;~(pfix ace ace (iny (star ;~(pose prn (just `@`10))))))
607+ "abc
608+ de"
609+
610+
611+
612+***
613+### `++low`
614+
615+Lowercase
616+
617+Parse a single lowercase letter.
618+
619+Source
620+------
621+
622+ ++ low (shim 'a' 'z') :: lowercase
623+
624+Examples
625+--------
626+
627+ ~zod/try=> (scan "g" low)
628+ ~~g
629+ ~zod/try=> `cord`(scan "g" low)
630+ 'g'
631+ ~zod/try=> (scan "abcdefghijklmnopqrstuvwxyz" (star low))
632+ "abcdefghijklmnopqrstuvwxyz"
633+ ~zod/try=> (low [[1 1] "g"])
634+ [p=[p=1 q=2] q=[~ [p=~~g q=[p=[p=1 q=2] q=""]]]]
635+
636+
637+
638+***
639+### `++mes`
640+
641+Hexbyte
642+
643+Parse a hexbyte.
644+
645+Source
646+------
647+
648+ ++ mes %+ cook :: hexbyte
649+ |=([a=@ b=@] (add (mul 16 a) b))
650+ ;~(plug hit hit)
651+
652+Examples
653+--------
654+
655+ ~zod/try=> (scan "2A" mes)
656+ 42
657+ ~zod/try=> (mes [[1 1] "2A"])
658+ [p=[p=1 q=3] q=[~ u=[p=42 q=[p=[p=1 q=3] q=""]]]]
659+ ~zod/try=> (scan "42" mes)
660+ 66
661+
662+
663+
664+***
665+### `++nix`
666+
667+Letters and `-`
668+
669+Parse Letters and `-`.
670+
671+Source
672+------
673+
674+ ++ nix (boss 256 (star ;~(pose aln cab))) ::
675+
676+Examples
677+--------
678+
679+ ~zod/try=> (scan "as_me" nix)
680+ q=435.626.668.897
681+ ~zod/try=> `@t`(scan "as_me" nix)
682+ 'as_me'
683+
684+
685+
686+***
687+
688+### `++nud`
689+
690+Numeric
691+
692+Parse a numeric character - A number.
693+
694+Source
695+------
696+
697+ ++ nud (shim '0' '9') :: numeric
698+
699+Examples
700+--------
701+
702+ ~zod/try=> (scan "0" nud)
703+ ~~0
704+ ~zod/try=> (scan "7" nud)
705+ ~~7
706+ ~zod/try=> (nud [[1 1] "1"])
707+ [p=[p=1 q=2] q=[~ [p=~~1 q=[p=[p=1 q=2] q=""]]]]
708+ ~zod/try=> (scan "0123456789" (star nud))
709+ "0123456789"
710+
711+
712+***
713+### `++prn`
714+
715+Printable character
716+
717+Parse any printable character.
718+
719+Source
720+------
721+
722+ ++ prn ;~(less (just `@`127) (shim 32 256))
723+
724+Examples
725+--------
726+
727+ ~zod/try=> (scan "h" prn)
728+ ~~h
729+ ~zod/try=> (scan "!" prn)
730+ ~~~21.
731+ ~zod/try=> (scan "\01" prn)
732+ ! {1 1}
733+ ! exit
734+
735+
736+
737+***
738+### `++qit`
739+
740+Chars in cord
741+
742+Parse an individual character to its cord atom representation.
743+
744+Source
745+------
746+
747+ ++ qit ;~ pose :: chars in a cord
748+ ;~(less bas soq prn)
749+ ;~(pfix bas ;~(pose bas soq mes)) :: escape chars
750+ ==
751+
752+Examples
753+--------
754+
755+ ~zod/try=> (scan "%" qit)
756+ 37
757+ ~zod/try=> `@t`(scan "%" qit)
758+ '%'
759+ ~zod/try=> (scan "0" qit)
760+ 48
761+ ~zod/try=> (scan "E" qit)
762+ 69
763+ ~zod/try=> (scan "a" qit)
764+ 97
765+ ~zod/try=> (scan "\\0a" qit)
766+ 10
767+ ~zod/try=> `@ux`(scan "\\0a" qit)
768+ 0xa
769+ ~zod/try=> (scan "cord" (star qit))
770+ ~[99 111 114 100]
771+
772+
773+
774+***
775+### `++qit`
776+
777+Chars in cord
778+
779+Parse an individual character to its cord atom representation.
780+
781+Source
782+------
783+
784+ ++ qit ;~ pose :: chars in a cord
785+ ;~(less bas soq prn)
786+ ;~(pfix bas ;~(pose bas soq mes)) :: escape chars
787+ ==
788+
789+Examples
790+--------
791+
792+ ~zod/try=> (scan "%" qit)
793+ 37
794+ ~zod/try=> `@t`(scan "%" qit)
795+ '%'
796+ ~zod/try=> (scan "0" qit)
797+ 48
798+ ~zod/try=> (scan "E" qit)
799+ 69
800+ ~zod/try=> (scan "a" qit)
801+ 97
802+ ~zod/try=> (scan "\\0a" qit)
803+ 10
804+ ~zod/try=> `@ux`(scan "\\0a" qit)
805+ 0xa
806+ ~zod/try=> (scan "cord" (star qit))
807+ ~[99 111 114 100]
808+
809+
810+
811+
812+***
813+### `++qut`
814+
815+Cord
816+
817+Parse single-soq cord with `\{gap}/` anywhere in the middle, or triple-single
818+quote (aka triple-soq) cord, between which must be in an indented block.
819+
820+Source
821+------
822+
823+ ++ qut ;~ pose :: cord
824+ ;~ less soqs
825+ (ifix [soq soq] (boss 256 (more gon qit)))
826+ ==
827+ %- inde %+ ifix
828+ :- ;~ plug soqs
829+ ;~(pose ;~(plug (plus ace) vul) (just '\0a'))
830+ ==
831+ ;~(plug (just '\0a') soqs)
832+ (boss 256 (star qat))
833+ ==
834+ ::
835+
836+Examples
837+--------
838+
839+ ~zod/try=> (scan "'cord'" qut)
840+ q=1.685.221.219
841+ ~zod/try=> 'cord'
842+ 'cord'
843+ ~zod/try=> `@ud`'cord'
844+ 1.685.221.219
845+ /~zod/try=> '''
846+ Heredoc isn't prohibited from containing quotes
847+ '''
848+ 'Heredoc isn't prohibited from containing quotes'
849+
850+
851+
852+***
853+### `++soz`
854+
855+Delimiting `'''`
856+
857+Parse a triple-single quote, used for multiline strings.
858+
859+Source
860+------
861+
862+ ++ soz ;~(plug soq soq soq) :: delimiting '''
863+
864+Examples
865+--------
866+
867+ ~zod/try=> (scan "'''" soz)
868+ [~~~27. ~~~27. ~~~27.]
869+ ~zod/try=> (rash '"""' soz)
870+ ! {1 1}
871+ ! exit
872+
873+
874+
875+***
876+### `++sym`
877+
878+Term
879+
880+A term: a letter(lowercase), followed by letters, numbers, or `-`.
881+
882+Source
883+------
884+
885+ ++ sym
886+ %+ cook
887+ |=(a=tape (rap 3 ^-((list ,@) a)))
888+ ;~(plug low (star ;~(pose nud low hep)))
889+ ::
890+
891+Examples
892+--------
893+
894+ ~zod/try=> (scan "sam-2" sym)
895+ 215.510.507.891
896+ ~zod/try=> `@t`(scan "sam-2" sym)
897+ 'sam-2'
898+ ~zod/try=> (scan "sym" sym)
899+ 7.174.515
900+
901+
902+
903+***
904+### `++ven`
905+
906+`+>-` axis syntax
907+
908+Axis syntax parser
909+
910+Source
911+------
912+
913+ ++ ven ;~ (comp |=([a=@ b=@] (peg a b))) :: +>- axis syntax
914+ bet
915+ =+ hom=`?`|
916+ |= tub=nail
917+ ^- (like axis)
918+ =+ vex=?:(hom (bet tub) (gul tub))
919+ ?~ q.vex
920+ [p.tub [~ 1 tub]]
921+ =+ wag=$(p.tub p.vex, hom !hom, tub q.u.q.vex)
922+ ?> ?=(^ q.wag)
923+ [p.wag [~ (peg p.u.q.vex p.u.q.wag) q.u.q.wag]]
924+ ==
925+
926+Examples
927+--------
928+
929+ ~zod/arvo=/hoon/hoon> (scan "->+" ven)
930+ 11
931+ ~zod/arvo=/hoon/hoon> `@ub`(scan "->+" ven)
932+ 0b1011
933+ ~zod/arvo=/hoon/hoon> (peg (scan "->" ven) (scan "+" ven))
934+ 11
935+ ~zod/arvo=/hoon/hoon> ->+:[[1 2 [3 4]] 5]
936+ [3 4]
937+
938+
939+
940+***
941+### `++vit`
942+
943+Base64 digit
944+
945+Parse a standard base64 digit.
946+
947+Source
948+------
949+
950+ ++ vit :: base64 digit
951+ ;~ pose
952+ (cook |=(a=@ (sub a 65)) (shim 'A' 'Z'))
953+ (cook |=(a=@ (sub a 71)) (shim 'a' 'z'))
954+ (cook |=(a=@ (add a 4)) (shim '0' '9'))
955+ (cold 62 (just '-'))
956+ (cold 63 (just '+'))
957+ ==
958+
959+Examples
960+--------
961+
962+ ~zod/arvo=/hoon/hoon> (scan "C" vit)
963+ 2
964+ ~zod/arvo=/hoon/hoon> (scan "c" vit)
965+ 28
966+ ~zod/arvo=/hoon/hoon> (scan "2" vit)
967+ 54
968+ ~zod/arvo=/hoon/hoon> (scan "-" vit)
969+ 62
970+
971+
972+***
973+### `++vul`
974+
975+Comments to null
976+
977+Source
978+------
979+
980+ ++ vul %- cold :- ~ :: comments
981+ ;~ plug col col
982+ (star prn)
983+ (just `@`10)
984+ ==
985+
986+Parse comments and produce a null. Note that a comment must be ended
987+with a newline character.
988+
989+Examples
990+--------
991+
992+ ~zod/try=> (scan "::this is a comment \0a" vul)
993+ ~
994+ ~zod/try=> (scan "::this is a comment " vul)
995+ ! {1 21}
996+ ! exit
997+
998+
999+
1000+***
1001+### `++co`
1002+
1003+Literal rendering engine
1004+
1005+A [door]() that contains arms that operate on the sample coin `lot`.
1006+
1007+Accepts
1008+-------
1009+
1010+Produces
1011+--------
1012+
1013+`lot` is a [`++coin`]().
1014+
1015+Source
1016+------
1017+
1018+ ++ co
1019+ =< |_ lot=coin
1020+
1021+Examples
1022+--------
1023+
1024+ ~zod/try=> ~(. co many/~[`ta/'mo' `ud/5])
1025+ < 3.dhd
1026+ [ [ %many
1027+ [%~ %ta @t]
1028+ [%~ %ud @ud]
1029+ %~
1030+ ]
1031+ <10.utz 3.zid [rex="" <414.hmb 100.xkc 1.ypj %164>]>
1032+ ]
1033+ >
1034+
1035+------------------------------------------------------------------------
1036+
1037+### `++rear`
1038+
1039+Prepend & render as tape
1040+
1041+Renders a coin `lot` as a [tape]() prepended to the sample tape `rom`.
1042+
1043+Accepts
1044+-------
1045+
1046+Produces
1047+--------
1048+
1049+`rom` is a [`pe`]()
1050+
1051+`lot` is a [`++coin`]().
1052+
1053+Source
1054+------
1055+
1056+ ++ rear |=(rom=tape =>(.(rex rom) rend))
1057+
1058+Examples
1059+--------
1060+
1061+ ~zod/try=> (~(rear co %$ %ux 200) "--ha")
1062+ "0xc8--ha"
1063+
1064+------------------------------------------------------------------------
1065+
1066+### `++rent`
1067+
1068+Render as span
1069+
1070+Renders a coin `lot` as a span.
1071+
1072+Accepts
1073+-------
1074+
1075+Produces
1076+--------
1077+
1078+`lot` is a [`++coin`]().
1079+
1080+Source
1081+------
1082+
1083+ ++ rent `@ta`(rap 3 rend)
1084+
1085+Examples
1086+--------
1087+
1088+ ~zod/try=> ~(rent co %$ %ux 200)
1089+ ~.0xc8
1090+ ~zod/try=> `@t`~(rent co %$ %ux 200)
1091+ '0xc8'
1092+
1093+------------------------------------------------------------------------
1094+
1095+### `++rend`
1096+
1097+Render as tape
1098+
1099+Renders a coin `lot` as a tape.
1100+
1101+Accepts
1102+-------
1103+
1104+Produces
1105+--------
1106+
1107+`lot` is a [`++coin`]().
1108+
1109+Source
1110+------
1111+
1112+ ++ rend
1113+ ^- tape
1114+ ?: ?=(%blob -.lot)
1115+ ['~' '0' ((v-co 1) (jam p.lot))]
1116+ ?: ?=(%many -.lot)
1117+ :- '.'
1118+ |- ^- tape
1119+ ?~ p.lot
1120+ ['_' '_' rex]
1121+ ['_' (weld (trip (wack rent(lot i.p.lot))) $(p.lot t.p.lot))]
1122+ =+ [yed=(end 3 1 p.p.lot) hay=(cut 3 [1 1] p.p.lot)]
1123+ |- ^- tape
1124+ ?+ yed (z-co q.p.lot)
1125+ %c ['~' '-' (weld (rip 3 (wood (tuft q.p.lot))) rex)]
1126+ %d
1127+ ?+ hay (z-co q.p.lot)
1128+ %a
1129+ =+ yod=(yore q.p.lot)
1130+ => ^+(. .(rex ?~(f.t.yod rex ['.' (s-co f.t.yod)])))
1131+ => ^+ .
1132+ %= .
1133+ rex
1134+ ?: &(=(~ f.t.yod) =(0 h.t.yod) =(0 m.t.yod) =(0 s.t.yod))
1135+ rex
1136+ => .(rex ['.' (y-co s.t.yod)])
1137+ => .(rex ['.' (y-co m.t.yod)])
1138+ ['.' '.' (y-co h.t.yod)]
1139+ ==
1140+ => .(rex ['.' (a-co d.t.yod)])
1141+ => .(rex ['.' (a-co m.yod)])
1142+ => .(rex ?:(a.yod rex ['-' rex]))
1143+ ['~' (a-co y.yod)]
1144+ ::
1145+ %r
1146+ =+ yug=(yell q.p.lot)
1147+ => ^+(. .(rex ?~(f.yug rex ['.' (s-co f.yug)])))
1148+ :- '~'
1149+ ?: &(=(0 d.yug) =(0 m.yug) =(0 h.yug) =(0 s.yug))
1150+ ['.' 's' '0' rex]
1151+ => ^+(. ?:(=(0 s.yug) . .(rex ['.' 's' (a-co s.yug)])))
1152+ => ^+(. ?:(=(0 m.yug) . .(rex ['.' 'm' (a-co m.yug)])))
1153+ => ^+(. ?:(=(0 h.yug) . .(rex ['.' 'h' (a-co h.yug)])))
1154+ => ^+(. ?:(=(0 d.yug) . .(rex ['.' 'd' (a-co d.yug)])))
1155+ +.rex
1156+ ==
1157+ ::
1158+ %f
1159+ ?: =(& q.p.lot)
1160+ ['.' 'y' rex]
1161+ ?:(=(| q.p.lot) ['.' 'n' rex] (z-co q.p.lot))
1162+ ::
1163+ %n ['~' rex]
1164+ %i
1165+ ?+ hay (z-co q.p.lot)
1166+ %f ((ro-co [3 10 4] |=(a=@ ~(d ne a))) q.p.lot)
1167+ %s ((ro-co [4 16 8] |=(a=@ ~(x ne a))) q.p.lot)
1168+ ==
1169+ ::
1170+ %p
1171+ =+ dyx=(met 3 q.p.lot)
1172+ :- '~'
1173+ ?: (lte dyx 1)
1174+ (weld (trip (tod:po q.p.lot)) rex)
1175+ ?: =(2 dyx)
1176+ ;: weld
1177+ (trip (tos:po (end 3 1 q.p.lot)))
1178+ (trip (tod:po (rsh 3 1 q.p.lot)))
1179+ rex
1180+ ==
1181+ =+ [dyz=(met 5 q.p.lot) fin=|]
1182+ |- ^- tape
1183+ ?: =(0 dyz)
1184+ rex
1185+ %= $
1186+ fin &
1187+ dyz (dec dyz)
1188+ q.p.lot (rsh 5 1 q.p.lot)
1189+ rex
1190+ =+ syb=(wren:un (end 5 1 q.p.lot))
1191+ =+ cog=~(zig mu [(rsh 4 1 syb) (end 4 1 syb)])
1192+ ;: weld
1193+ (trip (tos:po (end 3 1 p.cog)))
1194+ (trip (tod:po (rsh 3 1 p.cog)))
1195+ `tape`['-' ~]
1196+ (trip (tos:po (end 3 1 q.cog)))
1197+ (trip (tod:po (rsh 3 1 q.cog)))
1198+ `tape`?:(fin ['-' ?:(=(1 (end 0 1 dyz)) ~ ['-' ~])] ~)
1199+ rex
1200+ ==
1201+ ==
1202+ ::
1203+ %r
1204+ ?+ hay (z-co q.p.lot)
1205+ %d
1206+ =+ r=(rlyd q.p.lot)
1207+ ?~ e.r
1208+ ['.' '~' (r-co r)]
1209+ ['.' '~' u.e.r]
1210+ %h ['.' '~' '~' (r-co (rlyh q.p.lot))]
1211+ %q ['.' '~' '~' '~' (r-co (rlyq q.p.lot))]
1212+ %s ['.' (r-co (rlys q.p.lot))]
1213+ ==
1214+ ::
1215+ %u
1216+ =- (weld p.gam ?:(=(0 q.p.lot) `tape`['0' ~] q.gam))
1217+ ^= gam ^- [p=tape q=tape]
1218+ ?+ hay [~ ((ox-co [10 3] |=(a=@ ~(d ne a))) q.p.lot)]
1219+ %b [['0' 'b' ~] ((ox-co [2 4] |=(a=@ ~(d ne a))) q.p.lot)]
1220+ %i [['0' 'i' ~] ((d-co 1) q.p.lot)]
1221+ %x [['0' 'x' ~] ((ox-co [16 4] |=(a=@ ~(x ne a))) q.p.lot)]
1222+ %v [['0' 'v' ~] ((ox-co [32 5] |=(a=@ ~(x ne a))) q.p.lot)]
1223+ %w [['0' 'w' ~] ((ox-co [64 5] |=(a=@ ~(w ne a))) q.p.lot)]
1224+ ==
1225+ ::
1226+ %s
1227+ %+ weld
1228+ ?:((syn:si q.p.lot) "--" "-")
1229+ $(yed 'u', q.p.lot (abs:si q.p.lot))
1230+ ::
1231+ %t
1232+ ?: =('a' hay)
1233+ ?: =('s' (cut 3 [2 1] p.p.lot))
1234+
1235+ (weld (rip 3 q.p.lot) rex)
1236+ ['~' '.' (weld (rip 3 q.p.lot) rex)]
1237+ ['~' '~' (weld (rip 3 (wood q.p.lot)) rex)]
1238+ ==
1239+ --
1240+ =+ rex=*tape
1241+ =< |%
1242+ ++ a-co |=(dat=@ ((d-co 1) dat))
1243+ ++ d-co |=(min=@ (em-co [10 min] |=([? b=@ c=tape] [~(d ne b) c])))
1244+ ++ r-co
1245+ |= [syn=? nub=@ der=@ ign=(unit tape) ne=?]
1246+ => .(rex ['.' (t-co ((d-co 1) der) ne)])
1247+ => .(rex ((d-co 1) nub))
1248+ ?:(syn rex ['-' rex])
1249+ ++ t-co |= [a=tape n=?] ^- tape
1250+ ?: n a
1251+ ?~ a ~|(%empty-frac !!) t.a
1252+ ::
1253+ ++ s-co
1254+ |= esc=(list ,@) ^- tape
1255+ ~| [%so-co esc]
1256+ ?~ esc
1257+ rex
1258+ :- '.'
1259+ =>(.(rex $(esc t.esc)) ((x-co 4) i.esc))
1260+
1261+ ::
1262+ ++ v-co |=(min=@ (em-co [32 min] |=([? b=@ c=tape] [~(v ne b) c])))
1263+ ++ w-co |=(min=@ (em-co [64 min] |=([? b=@ c=tape] [~(w ne b) c])))
1264+ ++ x-co |=(min=@ (em-co [16 min] |=([? b=@ c=tape] [~(x ne b) c])))
1265+ ++ y-co |=(dat=@ ((d-co 2) dat))
1266+ ++ z-co |=(dat=@ `tape`['0' 'x' ((x-co 1) dat)])
1267+ --
1268+ ~% %co +> ~
1269+ |%
1270+ ++ em-co
1271+ ~/ %emco
1272+ |= [[bas=@ min=@] [par=$+([? @ tape] tape)]]
1273+ |= hol=@
1274+ ^- tape
1275+ ?: &(=(0 hol) =(0 min))
1276+ rex
1277+ =+ [rad=(mod hol bas) dar=(div hol bas)]
1278+ %= $
1279+ min ?:(=(0 min) 0 (dec min))
1280+ hol dar
1281+ rex (par =(0 dar) rad rex)
1282+ ==
1283+ ::
1284+ ++ ox-co
1285+ ~/ %oxco
1286+ |= [[bas=@ gop=@] dug=$+(@ @)]
1287+ %+ em-co
1288+ [|-(?:(=(0 gop) 1 (mul bas $(gop (dec gop))))) 0]
1289+ |= [top=? seg=@ res=tape]
1290+ %+ weld
1291+ ?:(top ~ `tape`['.' ~])
1292+ %. seg
1293+ %+ em-co(rex res)
1294+ [bas ?:(top 0 gop)]
1295+ |=([? b=@ c=tape] [(dug b) c])
1296+ ::
1297+ ++ ro-co
1298+ ~/ %roco
1299+ |= [[buz=@ bas=@ dop=@] dug=$+(@ @)]
1300+ |= hol=@
1301+ ^- tape
1302+ ?: =(0 dop)
1303+ rex
1304+ => .(rex $(dop (dec dop)))
1305+ :- '.'
1306+ %- (em-co [bas 1] |=([? b=@ c=tape] [(dug b) c]))
1307+ [(cut buz [(dec dop) 1] hol)]
1308+ --
1309+ ::
1310+
1311+Examples
1312+--------
1313+
1314+ ~zod/try=> ~(rend co ~ %ux 200)
1315+ "0xc8"
1316+ ~zod/try=> ~(rend co %many ~[[%$ ux/200] [%$ p/40]])
1317+ "._0xc8_~~tem__"
1318+ ~zod/try=> ~(rend co ~ %p 32.819)
1319+ "~pillyt"
1320+ ~zod/try=> ~(rend co ~ %ux 18)
1321+ "0x12"
1322+ ~zod/try=> ~(rend co [~ p=[p=%if q=0x7f00.0001]])
1323+ ".127.0.0.1"
1324+ ~zod/try=> `@ux`.127.0.0.1
1325+ 2.130.706.433
1326+ ~zod/try=> ~(rend co %many ~[[~ %ud 20] [~ %uw 133] [~ %tas 'sam']])
1327+ "._20_0w25_sam__"
1328+ ~zod/try=> ~(rend co %blob [1 1])
1329+ "~0ph"
1330+ ~zod/try=> ~0ph
1331+ [1 1]
1332+ ~zod/try=> `@uv`(jam [1 1])
1333+ 0vph
1334+
1335+
1336+
1337+***
docs/system/hoon/library/4l.mdnew file+479
@@ -0,0 +1,479 @@
1+## 4l: atom parsing
2+### `++so`
3+
4+Coin parser engine
5+
6+Core containing arms that parse [`++coin`]s.
7+
8+Accepts
9+-------
10+
11+Produces
12+--------
13+
14+Source
15+------
16+
17+ ++ so
18+ |%
19+
20+Examples
21+--------
22+
23+ ~zod/try=> so
24+ <10.mkn 414.hhh 100.xkc 1.ypj %164>
25+
26+------------------------------------------------------------------------
27+
28+### `++bisk`
29+
30+Parse odor-atom pair
31+
32+Parsing rule. Parses an unsigned integer of any permitted base,
33+producing a [`++dime`]().
34+
35+Accepts
36+-------
37+
38+Produces
39+--------
40+
41+Source
42+------
43+
44+ ++ bisk
45+ ;~ pose
46+ ;~ pfix (just '0')
47+ ;~ pose
48+ (stag %ub ;~(pfix (just 'b') bay:ag))
49+ (stag %ui ;~(pfix (just 'i') dim:ag))
50+ (stag %ux ;~(pfix (just 'x') hex:ag))
51+ (stag %uv ;~(pfix (just 'v') viz:ag))
52+ (stag %uw ;~(pfix (just 'w') wiz:ag))
53+ ==
54+ ==
55+ (stag %ud dem:ag)
56+ ==
57+
58+Examples
59+--------
60+
61+ ~zod/try=> (scan "25" bisk:so)
62+ [%ud q=25]
63+ ~zod/try=> (scan "0x12.6401" bisk:so)
64+ [%ux q=1.205.249]
65+
66+------------------------------------------------------------------------
67+
68+### `++crub`
69+
70+Parse `@da`, `@dr`, `@p`, `@t`
71+
72+Parsing rule. Parses any atom of any of the following odors after a
73+leading sig, `~` into a [`++dime`](): [`@da`](), [`@dr`](), [`@p`](),
74+and [`@t`](), producing a [`++dime`]().
75+
76+Accepts
77+-------
78+
79+Produces
80+--------
81+
82+Source
83+------
84+
85+ ++ crub
86+ ;~ pose
87+ %+ cook
88+ |=(det=date `dime`[%da (year det)])
89+ ;~ plug
90+ %+ cook
91+ |=([a=@ b=?] [b a])
92+ ;~(plug dim:ag ;~(pose (cold | hep) (easy &)))
93+ ;~(pfix dot dim:ag) :: month
94+ ;~(pfix dot dim:ag) :: day
95+ ;~ pose
96+ ;~ pfix
97+ ;~(plug dot dot)
98+ ;~ plug
99+ dum:ag
100+ ;~(pfix dot dum:ag)
101+ ;~(pfix dot dum:ag)
102+ ;~(pose ;~(pfix ;~(plug dot dot) (most dot qix:ab)) (easy ~))
103+ ==
104+ ==
105+ (easy [0 0 0 ~])
106+ ==
107+ ==
108+ ::
109+ %+ cook
110+ |= [a=(list ,[p=?(%d %h %m %s) q=@]) b=(list ,@)]
111+ =+ rop=`tarp`[0 0 0 0 b]
112+ |- ^- dime
113+ ?~ a
114+ [%dr (yule rop)]
115+ ?- p.i.a
116+ %d $(a t.a, d.rop (add q.i.a d.rop))
117+ %h $(a t.a, h.rop (add q.i.a h.rop))
118+ %m $(a t.a, m.rop (add q.i.a m.rop))
119+ %s $(a t.a, s.rop (add q.i.a s.rop))
120+ ==
121+ ;~ plug
122+ %+ most
123+ dot
124+ ;~ pose
125+ ;~(pfix (just 'd') (stag %d dim:ag))
126+ ;~(pfix (just 'h') (stag %h dim:ag))
127+ ;~(pfix (just 'm') (stag %m dim:ag))
128+ ;~(pfix (just 's') (stag %s dim:ag))
129+ ==
130+ ;~(pose ;~(pfix ;~(plug dot dot) (most dot qix:ab)) (easy ~))
131+ ==
132+ ::
133+ (stag %p fed:ag)
134+ ;~(pfix dot (stag %ta urs:ab))
135+ ;~(pfix sig (stag %t (cook woad urs:ab)))
136+ ;~(pfix hep (stag %c (cook turf (cook woad urs:ab))))
137+ ==
138+
139+Examples
140+--------
141+
142+ ~zod/try=> (scan "1926.5.12" crub:so)
143+ [p=~.da q=170.141.184.449.747.016.871.285.095.307.149.312.000]
144+ ~zod/try=> (,[%da @da] (scan "1926.5.12" crub:so))
145+ [%da ~1926.5.12]
146+ ~zod/try=> (scan "s10" crub:so)
147+ [p=~.dr q=184.467.440.737.095.516.160]
148+ ~zod/try=> (,[%dr @dr] (scan "s10" crub:so))
149+ [%dr ~s10]
150+ ~zod/try=> (scan "doznec" crub:so)
151+ [%p 256]
152+ ~zod/try=> (scan ".mas" crub:so)
153+ [%ta 7.561.581]
154+
155+------------------------------------------------------------------------
156+
157+### `++nuck`
158+
159+Top-level coin parser
160+
161+Parsing rule. Switches on the first character and applies the
162+corresponding [`++coin`]() parser.
163+
164+Accepts
165+-------
166+
167+Produces
168+--------
169+
170+Source
171+------
172+
173+ ++ nuck
174+ %+ knee *coin |. ~+
175+ %- stew
176+ ^. stet ^. limo
177+ :~ :- ['a' 'z'] (cook |=(a=@ta [~ %tas a]) sym)
178+ :- ['0' '9'] (stag ~ bisk)
179+ :- '-' (stag ~ tash)
180+ :- '.' ;~(pfix dot perd)
181+ :- '~' ;~(pfix sig ;~(pose twid (easy [~ %n 0])))
182+ ==
183+
184+Examples
185+--------
186+
187+ ~zod/try=> (scan "~pillyt" nuck:so)
188+ [% p=[p=~.p q=32.819]]
189+ ~zod/try=> (scan "0x12" nuck:so)
190+ [% p=[p=~.ux q=18]]
191+ ~zod/try=> (scan ".127.0.0.1" nuck:so)
192+ [% p=[p=~.if q=2.130.706.433]]
193+ ~zod/try=> `@ud`.127.0.0.1
194+ 2.130.706.433
195+ ~zod/try=> (scan "._20_0w25_sam__" nuck:so)
196+ [ %many
197+ p
198+ ~[[% p=[p=~.ud q=20]] [% p=[p=~.uw q=133]] [% p=[p=~.tas q=7.168.371]]]
199+ ]
200+ ~zod/try=> `@`%sam
201+ 7.168.371
202+ ~zod/try=> (scan "~0ph" nuck:so)
203+ [%blob p=[1 1]]
204+ ~zod/try=> ~0ph
205+ [1 1]
206+ ~zod/try=> `@uv`(jam [1 1])
207+ 0vph
208+
209+------------------------------------------------------------------------
210+
211+### `++nusk`
212+
213+Parse coin literal with escapes
214+
215+Parsing rule. Parses a coin literal with escapes. (See also: xx tuple
216+formatting).
217+
218+Accepts
219+-------
220+
221+Produces
222+--------
223+
224+Source
225+------
226+
227+ ++ nusk
228+ (sear |=(a=@ta (rush (wick a) nuck)) urt:ab)
229+
230+Examples
231+--------
232+
233+ ~zod/try=> ~.asd_a
234+ ~.asd_a
235+ ~zod/try=> ._1_~~.asd~-a__
236+ [1 ~.asd_a]
237+ ~zod/try=> (scan "~~.asd~-a" nusk:so)
238+ [% p=[p=~.ta q=418.212.246.369]]
239+ ~zod/try=> (,[~ %ta @ta] (scan "~~.asd~-a" nusk:so))
240+ [~ %ta ~.asd_a]
241+
242+------------------------------------------------------------------------
243+
244+### `++perd`
245+
246+Parsing rule.
247+
248+Parsing rule. Parses a dime or tuple without their respective standard
249+prefixes.
250+
251+Accepts
252+-------
253+
254+Produces
255+--------
256+
257+Source
258+------
259+
260+ ++ perd
261+ ;~ pose
262+ (stag ~ zust)
263+ (stag %many (ifix [cab ;~(plug cab cab)] (more cab nusk)))
264+ ==
265+
266+Examples
267+--------
268+
269+ ~zod/try=> (scan "y" perd:so)
270+ [~ [%f %.y]]
271+ ~zod/try=> (scan "n" perd:so)
272+ [~ [%f %.n]]
273+ ~zod/try=> |
274+ %.n
275+ ~zod/try=> (scan "_20_x__" perd:so)
276+ [%many [[% p=[p=~.ud q=20]] ~[[% p=[p=~.tas q=120]]]]]
277+
278+------------------------------------------------------------------------
279+
280+### `++royl`
281+
282+Parse dime float
283+
284+Parsing rule. Parses a number into a [`++dime`]() float.
285+
286+Accepts
287+-------
288+
289+Produces
290+--------
291+
292+Source
293+------
294+
295+ ++ royl
296+ =+ ^= zer
297+ (cook lent (star (just '0')))
298+ =+ ^= voy
299+ %+ cook royl-cell
300+ ;~ plug
301+ ;~(pose (cold | hep) (easy &))
302+ ;~(plug dim:ag ;~(pose ;~(pfix dot ;~(plug zer dim:ag)) (easy [0 0])))
303+ ;~ pose
304+ ;~ pfix
305+ (just 'e')
306+ (cook some ;~(plug ;~(pose (cold | hep) (easy &)) dim:ag))
307+ ==
308+ (easy ~)
309+ ==
310+ ==
311+ ;~ pose
312+ (stag %rh (cook rylh ;~(pfix ;~(plug sig sig) voy)))
313+ (stag %rq (cook rylq ;~(pfix ;~(plug sig sig sig) voy)))
314+ (stag %rd (cook ryld ;~(pfix sig voy)))
315+ (stag %rs (cook ryls voy)
316+ ==
317+
318+Examples
319+--------
320+
321+ ~zod/try=> (scan "~3.14" royl:so)
322+ [%rd .~3.13999999999999]
323+ ~zod/try=> .~3.14
324+ .~3.13999999999999
325+
326+------------------------------------------------------------------------
327+
328+### `++royl-cell`
329+
330+XX still not fully functional
331+
332+Intermediate parsed float convereter
333+
334+------------------------------------------------------------------------
335+
336+### `++tash`
337+
338+Parse signed dime
339+
340+Accepts
341+-------
342+
343+Accepts
344+-------
345+
346+Produces
347+--------
348+
349+Produces
350+--------
351+
352+Parsing rule. Parses a signed number into a [`++dime`]().
353+
354+Source
355+------
356+
357+ ++ royl-cell
358+ |= [a=? b=[c=@ d=@ e=@] f=(unit ,[h=? i=@])]
359+ ^- [? @ @ @ (unit ,@s)]
360+ ?~ f
361+ [a c.b d.b e.b ~]
362+ ?: h.u.f
363+ [a c.b d.b e.b [~ (mul i.u.f 2)]]
364+ [a c.b d.b e.b [~ (dec (mul i.u.f 2))]]
365+
366+Examples
367+--------
368+
369+Source
370+------
371+
372+ ++ tash
373+ =+ ^= neg
374+ |= [syn=? mol=dime] ^- dime
375+ ?> =('u' (end 3 1 p.mol))
376+ [(cat 3 's' (rsh 3 1 p.mol)) (new:si syn q.mol)]
377+ ;~ pfix hep
378+ ;~ pose
379+ (cook |=(a=dime (neg | a)) bisk)
380+ ;~(pfix hep (cook |=(a=dime (neg & a)) bisk))
381+ ==
382+ ==
383+
384+Examples
385+--------
386+
387+ ~zod/try=> (scan "-20" tash:so)
388+ [p=~.sd q=39]
389+ ~zod/try=> (,[%sd @sd] (scan "-20" tash:so))
390+ [%sd -20]
391+ ~zod/try=> (,[%sd @sd] (scan "--20" tash:so))
392+ [%sd --20]
393+ ~zod/try=> (,[%sx @sx] (scan "--0x2e" tash:so))
394+ [%sx --0x2e]
395+
396+------------------------------------------------------------------------
397+
398+### `++twid`
399+
400+Parse coins without `~` prefix
401+
402+Parsing rule. Parses coins after a leading sig, `~`.
403+
404+Accepts
405+-------
406+
407+Produces
408+--------
409+
410+Source
411+------
412+
413+ ++ twid
414+ ;~ pose
415+ (cook |=(a=@ [%blob (cue a)]) ;~(pfix (just '0') vum:ag))
416+ (stag ~ crub)
417+ ==
418+ ::
419+
420+Examples
421+--------
422+
423+ ~zod/try=> (scan "zod" twid:so)
424+ [~ [%p 0]]
425+ ~zod/try=> (scan ".sam" twid:so)
426+ [~ [%ta 7.168.371]]
427+ ~zod/try=> `@ud`~.sam
428+ 7.168.371
429+ ~zod/try=> `@t`~.sam
430+ 'sam'
431+ ~zod/try=> (scan "0ph" twid:so)
432+ [%blob [1 1]]
433+
434+------------------------------------------------------------------------
435+
436+### `++zust`
437+
438+Parse prefixed dimes from `@if`, `@f`, `@rd`
439+
440+Parsing rule. Parses an atom of either [`@if`]() (IP address), [`@f`]()
441+(loobean), or [`rf`]()(floating point) into a [`++dime`]().
442+
443+Accepts
444+-------
445+
446+Produces
447+--------
448+
449+Source
450+------
451+
452+ ++ zust
453+ ;~ pose
454+ (stag %is bip:ag)
455+ (stag %if lip:ag)
456+ (stag %f ;~(pose (cold & (just 'y')) (cold | (just 'n'))))
457+ royl
458+ ==
459+ --
460+
461+Examples
462+--------
463+
464+ ~zod/try=> (scan "127.0.0.1" zust:so)
465+ [%if q=2.130.706.433]
466+ ~zod/try=> (scan "af.0.0.0.0.e7a5.30d2.7" zust:so)
467+ [%is q=908.651.950.243.594.834.993.091.554.288.205.831]
468+ ~zod/try=> (,[%is @is] (scan "af.0.0.0.0.e7a5.30d2.7" zust:so))
469+ [%is .af.0.0.0.0.e7a5.30d2.7]
470+ ~zod/try=> (,[%is @ux] (scan "af.0.0.0.0.e7a5.30d2.7" zust:so))
471+ [%is 0xaf.0000.0000.0000.0000.e7a5.30d2.0007]
472+ ~zod/try=> (scan "y" zust:so)
473+ [%f %.y]
474+ ~zod/try=> (scan "12.09" zust:so)
475+ [%rd .~12.00999999999999]
476+
477+
478+
479+***
docs/system/hoon/library/4m.mdnew file+410
@@ -0,0 +1,410 @@
1+## 4m: formatting functions
2+### `++scot`
3+
4+Render dime as cord
5+
6+Renders a dime `mol` as a cord.
7+
8+Accepts
9+-------
10+
11+Produces
12+--------
13+
14+`mol` is a [`++dime`]().
15+
16+Source
17+------
18+
19+ ++ scot |=(mol=dime ~(rent co %$ mol))
20+
21+Examples
22+--------
23+
24+ ~zod/try=> (scot %p ~pillyt)
25+ ~.~pillyt
26+ ~zod/try=> `@t`(scot %p ~pillyt)
27+ '~pillyt'
28+ ~zod/try=> (scot %ux 0x12)
29+ ~.0x12
30+ ~zod/try=> `@t`(scot %ux 0x12)
31+ '0x12'
32+ ~zod/try=> (scot %if .127.0.0.1)
33+ ~..127.0.0.1
34+ ~zod/try=> `@t`(scot %if .127.0.0.1)
35+ '.127.0.0.1'
36+ ~zod/try=> (scot %ta ~.asd_a)
37+ ~.~.asd_a
38+ ~zod/try=> `@t`(scot %ta ~.asd_a)
39+ '~.asd_a'
40+
41+
42+
43+***
44+### `++scow`
45+
46+Render dime as tape
47+
48+Renders `mol` as a tape.
49+
50+Accepts
51+-------
52+
53+Produces
54+--------
55+
56+`mol` is a [`++dime`]().
57+
58+Source
59+------
60+
61+ ++ scow |=(mol=dime ~(rend co %$ mol))
62+
63+Examples
64+--------
65+
66+ ~zod/try=> (scow %p ~pillyt)
67+ "~pillyt"
68+ ~zod/try=> (scow %ux 0x12)
69+ "0x12"
70+ ~zod/try=> (scow %if .127.0.0.1)
71+ ".127.0.0.1"
72+ ~zod/try=> (scow %ta ~.asd_a)
73+ "~.asd_a"
74+
75+
76+
77+***
78+### `++slat`
79+
80+Curried slaw
81+
82+Produces a [`gate`]() that parses a [`term`]() `txt` to an atom of the
83+odor specified by `mod`.
84+
85+Accepts
86+-------
87+
88+Produces
89+--------
90+
91+`mod` is a term, an atom of odor [`@tas`]().
92+
93+`txt` is a span, an atom of odor [`@ta`]().
94+
95+Source
96+------
97+
98+ ++ slat |=(mod=@tas |=(txt=@ta (slaw mod txt)))
99+
100+Examples
101+--------
102+
103+ ~zod/try=> `(unit ,@p)`((slat %p) '~pillyt')
104+ [~ ~pillyt]
105+ ~zod/try=> `(unit ,@ux)`((slat %ux) '0x12')
106+ [~ 0x12]
107+ ~zod/try=> `(unit ,@if)`((slat %if) '.127.0.0.1')
108+ [~ .127.0.0.1]
109+ ~zod/try=> `(unit ,@ta)`((slat %ta) '~.asd_a')
110+ [~ ~.asd_a
111+
112+
113+
114+***
115+### `++slav`
116+
117+Demand: parse span with input odor
118+
119+Parses a span `txt` to an atom of the odor specificed by `mod`. Crashes
120+if it failes to parse.
121+
122+Accepts
123+-------
124+
125+Produces
126+--------
127+
128+`mod` is a term, an atom of odor [`@tas`]().
129+
130+`txt` is a span, an atom of odor [`@ta`]().
131+
132+Source
133+------
134+
135+ ++ slav |=([mod=@tas txt=@ta] (need (slaw mod txt)))
136+
137+Examples
138+--------
139+
140+ ~zod/try=> `@p`(slav %p '~pillyt')
141+ ~pillyt
142+ ~zod/try=> `@p`(slav %p '~pillam')
143+ ! exit
144+ ~zod/try=> `@ux`(slav %ux '0x12')
145+ 0x12
146+ ~zod/try=> `@ux`(slav %ux '0b10')
147+ ! exit
148+ ~zod/try=> `@if`(slav %if '.127.0.0.1')
149+ .127.0.0.1
150+ ~zod/try=> `@if`(slav %if '.fe80.0.0.202')
151+ ! exit
152+ ~zod/try=> `@ta`(slav %ta '~.asd_a')
153+ ~.asd_a
154+ ~zod/try=> `@ta`(slav %ta '~~asd-a')
155+ ! exit
156+
157+
158+
159+***
160+### `++slaw`
161+
162+Parse span to input odor
163+
164+Parses a span `txt` to an atom of the odor specified by `mod`.
165+
166+Accepts
167+-------
168+
169+Produces
170+--------
171+
172+`mod` is a term, an atom of odor [`@tas`]().
173+
174+`txt` is a span, an atom of odor [`@ta`]().
175+
176+Source
177+------
178+
179+ ++ slaw
180+ |= [mod=@tas txt=@ta]
181+ ^- (unit ,@)
182+ =+ con=(slay txt)
183+ ?.(&(?=([~ %$ @ @] con) =(p.p.u.con mod)) ~ [~ q.p.u.con])
184+ ::
185+
186+Examples
187+--------
188+
189+ ~zod/try=> `(unit ,@p)`(slaw %p '~pillyt')
190+ [~ ~pillyt]
191+ ~zod/try=> `(unit ,@p)`(slaw %p '~pillam')
192+ ~
193+ ~zod/try=> `(unit ,@ux)`(slaw %ux '0x12')
194+ [~ 0x12]
195+ ~zod/try=> `(unit ,@ux)`(slaw %ux '0b10')
196+ ~
197+ ~zod/try=> `(unit ,@if)`(slaw %if '.127.0.0.1')
198+ [~ .127.0.0.1]
199+ ~zod/try=> `(unit ,@if)`(slaw %if '.fe80.0.0.202')
200+ ~
201+ ~zod/try=> `(unit ,@ta)`(slaw %ta '~.asd_a')
202+ [~ ~.asd_a]
203+ ~zod/try=> `(unit ,@ta)`(slaw %ta '~~asd-a')
204+ ~
205+
206+
207+
208+***
209+### `++slay`
210+
211+Parse span to coin
212+
213+Parses a span `txt` to the unit of a [`++coin`]().
214+
215+Accepts
216+-------
217+
218+Produces
219+--------
220+
221+`txt` is a [`@ta`]().
222+
223+Source
224+------
225+
226+ ++ slay
227+ |= txt=@ta ^- (unit coin)
228+ =+ vex=((full nuck:so) [[1 1] (trip txt)])
229+ ?~ q.vex
230+ ~
231+ [~ p.u.q.vex]
232+ ::
233+
234+Examples
235+--------
236+
237+ ~zod/try=> (slay '~pillyt')
238+ [~ [% p=[p=~.p q=32.819]]]
239+ ~zod/try=> (slay '0x12')
240+ [~ [% p=[p=~.ux q=18]]]
241+ ~zod/try=> (slay '.127.0.0.1')
242+ [~ [% p=[p=~.if q=2.130.706.433]]]
243+ ~zod/try=> `@ud`.127.0.0.1
244+ 2.130.706.433
245+ ~zod/try=> (slay '._20_0w25_sam__')
246+ [ ~
247+ [ %many
248+ p=~[[% p=[p=~.ud q=20]] [% p=[p=~.uw q=133]] [% p=[p=~.tas q=7.168.371]]]
249+ ]
250+ ]
251+ ~zod/try=> `@`%sam
252+ 7.168.371
253+ ~zod/try=> (slay '~0ph')
254+ [~ [%blob p=[1 1]]]
255+ ~zod/try=> 0ph
256+ ~ <syntax error at [1 2]>
257+ ~zod/try=> ~0ph
258+ [1 1]
259+ ~zod/try=> `@uv`(jam [1 1])
260+ 0vph
261+
262+
263+
264+***
265+### `++smyt`
266+
267+Render path as tank
268+
269+Renders the path `bon` as a [`tank`](), which is used for
270+pretty-printing.
271+
272+Accepts
273+-------
274+
275+Produces
276+--------
277+
278+`bon` is a [`++path`]().
279+
280+Source
281+------
282+
283+ ++ smyt
284+ |= bon=path ^- tank
285+ :+ %rose [['/' ~] ['/' ~] ['/' ~]]
286+ |- ^- (list tank)
287+ (turn bon |=(a=@ [%leaf (rip 3 a)]))
288+
289+Examples
290+--------
291+
292+ ~zod/try=> (smyt %)
293+ [ %rose
294+ p=[p="/" q="/" r="/"]
295+ q
296+ ~[ [%leaf p="~zod"]
297+ [%leaf p="try"]
298+ [%leaf p="~2014.10.28..18.36.58..a280"]
299+ ]
300+ ]
301+ ~zod/try=> (smyt /as/les/top)
302+ [ %rose
303+ p=[p="/" q="/" r="/"]
304+ q=~[[%leaf p="as"] [%leaf p="les"] [%leaf p="top"]]
305+ ]
306+
307+
308+
309+***
310+### `++spat`
311+
312+Render path as cord
313+
314+Renders a path `pax` as cord.
315+
316+Accepts
317+-------
318+
319+Produces
320+--------
321+
322+`pax` is a [`path`]().
323+
324+Source
325+------
326+
327+ ++ spat |=(pax=path (crip (spud pax))) :: path to cord
328+
329+Examples
330+--------
331+
332+ ~zod/try=> (spat %)
333+ '~zod/try/~2014.10.28..18.40.20..4287'
334+ ~zod/try=> (spat %/bin)
335+ '~zod/try/~2014.10.28..18.41.12..3bcd/bin'
336+ ~zod/try=> (spat /as/les/top)
337+ '/as/les/top'
338+
339+
340+
341+***
342+### `++spud`
343+
344+Render path as tape
345+
346+Renders a path `pax` as [tape]().
347+
348+Accepts
349+-------
350+
351+Produces
352+--------
353+
354+`pax` is a [`path`]().
355+
356+Source
357+------
358+
359+ ++ spud |=(pax=path ~(ram re (smyt pax))) :: path to tape
360+
361+Examples
362+--------
363+
364+ ~zod/try=> (spud %)
365+ "~zod/try/~2014.10.28..18.40.46..e951"
366+ ~zod/try=> (spud %/bin)
367+ "~zod/try/~2014.10.28..18.41.05..16f2/bin"
368+ ~zod/try=> (spud /as/les/top)
369+ "/as/les/top"
370+
371+
372+
373+***
374+### `++stab`
375+
376+Parse span to path
377+
378+Parsing rule. Parses a span `zep` to a static [`++path`](/doc/hoon/library/1#++path).
379+
380+Accepts
381+-------
382+
383+Produces
384+--------
385+
386+Source
387+------
388+
389+ ++ stab :: parse span to path
390+ |= zep=@ta ^- path
391+ (rash zep ;~(pfix fas ;~(sfix (more fas urs:ab) fas)))
392+
393+Examples
394+--------
395+
396+ ~zod/try=> (stab '/as/lek/tor')
397+ /as/lek/tor
398+ ~zod/try=> `(pole ,@ta)`(stab '/as/lek/tor')
399+ [~.as [~.lek [~.tor ~]]]
400+ ~zod/try=> (stab '~zod/arvo/~2014.10.28..18.48.41..335f/zuse')
401+ ~zod/arvo/~2014.10.28..18.48.41..335f/zuse
402+ ~zod/try=> `(pole ,@ta)`(stab '~zod/arvo/~2014.10.28..18.48.41..335f/zuse')
403+ [~.~zod [~.arvo [~.~2014.10.28..18.48.41..335f [~.zuse ~]]]]
404+ ~zod/try=> (stab '/a/~pillyt/pals/1')
405+ /a/~pillyt/pals/1
406+ ~zod/try=> `(pole ,@ta)`(stab '/a/~pillyt/pals/1')
407+ [~.a [~.~pillyt [~.pals [~.1 ~]]]]
408+
409+
410+***
docs/system/hoon/library/4n.mdnew file+471
@@ -0,0 +1,471 @@
1+## 4n: virtualization
2+### `++mack`
3+
4+Nock subject to unit
5+
6+Accepts a nock subject-formula cell and wraps it into a [`++unit`]().
7+`fol` is pure nock, meaning that nock `11` operations result in a block,
8+producing a `~`.
9+
10+Accepts
11+-------
12+
13+`sub` is a subject [noun]().
14+
15+`fol` is a formula noun, which is generally a `++nock`.
16+
17+Produces
18+--------
19+
20+The `++unit` of a noun.
21+
22+Source
23+------
24+
25+ ++ mack
26+ |= [sub=* fol=*]
27+ ^- (unit)
28+ =+ ton=(mink [sub fol] |=(* ~))
29+ ?.(?=([0 *] ton) ~ [~ p.ton])
30+ ::
31+
32+Examples
33+--------
34+
35+ ~zod/try=> (mack [[1 2 3] [0 1]])
36+ [~ [1 2 3]]
37+ ~zod/try=> (mack [41 4 0 1])
38+ [~ 42]
39+ ~zod/try=> (mack [4 0 4])
40+ ~
41+ ~zod/try=> (mack [[[0 2] [1 3]] 4 4 4 4 0 5])
42+ [~ 6]
43+ ~zod/try=> ;;((unit ,@tas) (mack [[1 %yes %no] 6 [0 2] [0 6] 0 7]))
44+ [~ %no]
45+
46+
47+
48+***
49+### `++mink`
50+
51+Mock interpreter
52+
53+Bottom-level [mock]() (virtual nock) interpreter. Produces a
54+[`++tone`](), a nock computation result. If nock 11 is invoked, `sky`
55+computes on the subject and produces a [`++unit`]() result. An empty
56+result becomes a `%1` `++tone`, indicating a block.
57+
58+Accepts
59+-------
60+
61+`sub` is the subject as a [noun]().
62+
63+`fol` is the formula as a noun.
64+
65+`sky` is an [`%iron`]() gate invoked with [nock operator 11]().
66+
67+Produces
68+--------
69+
70+A `++tone`.
71+
72+Source
73+------
74+
75+ ++ mink
76+ ~/ %mink
77+ |= [[sub=* fol=*] sky=$+(* (unit))]
78+ =+ tax=*(list ,[@ta *])
79+ |- ^- tone
80+ ?@ fol
81+ [%2 tax]
82+ ?: ?=(^ -.fol)
83+ =+ hed=$(fol -.fol)
84+ ?: ?=(%2 -.hed)
85+ hed
86+ =+ tal=$(fol +.fol)
87+ ?- -.tal
88+ %0 ?-(-.hed %0 [%0 p.hed p.tal], %1 hed)
89+ %1 ?-(-.hed %0 tal, %1 [%1 (weld p.hed p.tal)])
90+ %2 tal
91+ ==
92+ ?+ fol
93+ [%2 tax]
94+ ::
95+ [0 b=@]
96+ ?: =(0 b.fol) [%2 tax]
97+ ?: =(1 b.fol) [%0 sub]
98+ ?: ?=(@ sub) [%2 tax]
99+ =+ [now=(cap b.fol) lat=(mas b.fol)]
100+ $(b.fol lat, sub ?:(=(2 now) -.sub +.sub))
101+ ::
102+ [1 b=*]
103+ [%0 b.fol]
104+ ::
105+ [2 b=[^ *]]
106+ =+ ben=$(fol b.fol)
107+ ?. ?=(%0 -.ben) ben
108+ ?>(?=(^ p.ben) $(sub -.p.ben, fol +.p.ben))
109+ ::?>(?=(^ p.ben) $([sub fol] p.ben)
110+ ::
111+ [3 b=*]
112+ =+ ben=$(fol b.fol)
113+ ?. ?=(%0 -.ben) ben
114+ [%0 .?(p.ben)]
115+ ::
116+ [4 b=*]
117+ =+ ben=$(fol b.fol)
118+ ?. ?=(%0 -.ben) ben
119+ ?. ?=(@ p.ben) [%2 tax]
120+ [%0 .+(p.ben)]
121+ ::
122+ [5 b=*]
123+ =+ ben=$(fol b.fol)
124+ ?. ?=(%0 -.ben) ben
125+ ?. ?=(^ p.ben) [%2 tax]
126+ [%0 =(-.p.ben +.p.ben)]
127+ ::
128+ [6 b=* c=* d=*]
129+ $(fol =>(fol [2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b]))
130+ ::
131+ [7 b=* c=*] $(fol =>(fol [2 b 1 c]))
132+ [8 b=* c=*] $(fol =>(fol [7 [[0 1] b] c]))
133+ [9 b=* c=*] $(fol =>(fol [7 c 0 b]))
134+ [10 @ c=*] $(fol c.fol)
135+ [10 [b=* c=*] d=*]
136+ =+ ben=$(fol c.fol)
137+ ?. ?=(%0 -.ben) ben
138+ ?: ?=(?(%hunk %lose %mean %spot) b.fol)
139+ $(fol d.fol, tax [[b.fol p.ben] tax])
140+ $(fol d.fol)
141+ ::
142+ [11 b=*]
143+ =+ ben=$(fol b.fol)
144+ ?. ?=(%0 -.ben) ben
145+ =+ val=(sky p.ben)
146+ ?~(val [%1 p.ben ~] [%0 u.val])
147+ ::
148+ ==
149+ ::
150+
151+Examples
152+--------
153+
154+ ~zod/try=> (mink [20 [4 0 1]] ,~)
155+ [%0 p=21]
156+ ~zod/try=> (mink [[90 5 3] [0 3]] ,~)
157+ [%0 p=[5 3]]
158+ ~zod/try=> (mink 20^[4 0 1] ,~)
159+ [%0 p=21]
160+ ~zod/try=> (mink [90 5 3]^[0 3] ,~)
161+ [%0 p=[5 3]]
162+ ~zod/try=> (mink [0]^[11 1 20] ,~)
163+ [%1 p=~[20]]
164+ ~zod/try=> (mink [0]^[11 1 20] |=(a=* `[40 a]))
165+ [%0 p=[40 20]]
166+ ~zod/try=> (mink [5]^[0 2] ,~)
167+ [%2 p=~]
168+ ~zod/try=> (mink [5]^[10 yelp/[0 1] 0 0] ,~)
169+ [%2 p=~[[~.yelp 5]]]
170+
171+
172+***
173+### `++mock`
174+
175+Compute formula on subject with hint
176+
177+Produces a [`++toon`](), which is either a sucessful, blocked, or
178+crashed result. If nock 11 is invoked, `sky` computes on the subject and
179+produces a [`++unit`]() result. An empty result becomes a `%1` `++tune`,
180+indicating a block.
181+
182+Accepts
183+-------
184+
185+`sub` is the subject as a [noun]().
186+
187+`fol` is the formula as a noun.
188+
189+`sky` is an [%iron]() gate invoked with [nock operator 11]().
190+
191+Produces
192+--------
193+
194+The `++unit` of a noun.
195+
196+Source
197+------
198+
199+ ++ mock
200+ |= [[sub=* fol=*] sky=$+(* (unit))]
201+ (mook (mink [sub fol] sky))
202+ ::
203+
204+Examples
205+--------
206+
207+ ~zod/try=> (mock [5 4 0 1] ,~)
208+ [%0 p=6]
209+ ~zod/try=> (mock [~ 11 1 0] |=(* `999))
210+ [%0 p=999]
211+ ~zod/try=> (mock [~ 0 1.337] ,~)
212+ [%2 p=~]
213+ ~zod/try=> (mock [~ 11 1 1.337] ,~)
214+ [%1 p=~[1.337]]
215+ ~zod/try=> (mock [[[4 4 4 4 0 3] 10] 11 9 2 0 1] |=(* `[+<]))
216+ [%0 p=14]
217+ ~zod/try=> (mock [[[4 4 4 4 0 3] 10] 11 9 2 0 1] |=(* `[<+<>]))
218+ [%0 p=[49 52 0]]
219+ ~zod/try=> ;;(tape +:(mock [[[4 4 4 4 0 3] 10] 11 9 2 0 1] |=(* `[<+<>])))
220+ "14"
221+
222+
223+
224+***
225+### `++mong`
226+
227+Slam gate with sample
228+
229+Produces a [`++toon`]() computation result from slamming `gat` with
230+`sam`, using `sky` to compute or block on nock 11 when applicable.
231+
232+Accepts
233+-------
234+
235+`gat` is a [noun]() that is generally a [`gate`]().
236+
237+`sam` is a [`sample`]() noun.
238+
239+`sky` is an [%iron]() gate invoked with [nock operator 11]().
240+
241+Produces
242+--------
243+
244+A `++toon`.
245+
246+Source
247+------
248+
249+ ++ mong
250+ |= [[gat=* sam=*] sky=$+(* (unit))]
251+ ^- toon
252+ ?. &(?=(^ gat) ?=(^ +.gat))
253+ [%2 ~]
254+ (mock [[-.gat [sam +>.gat]] -.gat] sky)
255+ ::
256+
257+Examples
258+--------
259+
260+ ~zod/try=> (mong [|=(@ 20) ~] ,~)
261+ [%0 p=20]
262+ ~zod/try=> (mong [|=(@ !!) ~] ,~)
263+ [%2 p=~]
264+ ~zod/try=> (mong [|=(a=@ (add 20 a)) ~] ,~)
265+ [%0 p=20]
266+ ~zod/try=> (mong [|=(a=[@ @] (add 20 -.a)) ~] ,~)
267+ [%2 p=~]
268+ ~zod/try=> (mong [|=(a=[@ @] (add 20 -.a)) [4 6]] ,~)
269+ [%0 p=24]
270+ ~zod/try=> (mong [|=(a=@ .^(a)) ~] ,~)
271+ [%1 p=~[0]]
272+ ~zod/try=> (mong [|=(a=@ .^(a)) ~] ,[~ %42])
273+ [%0 p=42]
274+ ~zod/try=> (mong [|=(a=@ .^(a)) ~] |=(a=* [~ a 6]))
275+ [%0 p=[0 6]]
276+ ~zod/try=> (mong [|=(a=@ .^(a)) 8] |=(a=* [~ a 6]))
277+ [%0 p=[8 6]]
278+
279+
280+
281+***
282+### `++mook`
283+
284+Intelligently render crash annotation
285+
286+Converts a `%2` `++tone` nock stack trace to a list of [`++tank`]().
287+Each may be a tank, cord, [`++spot`](), or trapped tank.
288+
289+Accepts
290+-------
291+
292+`ton` is a [`++tone`]().
293+
294+Produces
295+--------
296+
297+A [`++toon`]().
298+
299+Source
300+------
301+
302+ ++ mook
303+ |= ton=tone
304+ ^- toon
305+ ?. ?=([2 *] ton) ton
306+ :- %2
307+ =+ yel=(lent p.ton)
308+ =. p.ton
309+ ?. (gth yel 256) p.ton
310+ %+ weld
311+ (scag 128 p.ton)
312+ ^- (list ,[@ta *])
313+ :_ (slag (sub yel 128) p.ton)
314+ :- %lose
315+ %+ rap 3
316+ ;: weld
317+ "[skipped "
318+ ~(rend co %$ %ud (sub yel 256))
319+ " frames]"
320+ ==
321+ |- ^- (list tank)
322+ ?~ p.ton ~
323+ =+ rex=$(p.ton t.p.ton)
324+ ?+ -.i.p.ton rex
325+ %hunk [(tank +.i.p.ton) rex]
326+ %lose [[%leaf (rip 3 (,@ +.i.p.ton))] rex]
327+ %mean :_ rex
328+ ?@ +.i.p.ton [%leaf (rip 3 (,@ +.i.p.ton))]
329+ =+ mac=(mack +.i.p.ton +<.i.p.ton)
330+ ?~(mac [%leaf "####"] (tank u.mac))
331+ %spot :_ rex
332+ =+ sot=(spot +.i.p.ton)
333+ :- %leaf
334+ ;: weld
335+ ~(ram re (smyt p.sot))
336+ ":<["
337+ ~(rend co ~ %ud p.p.q.sot)
338+ " "
339+ ~(rend co ~ %ud q.p.q.sot)
340+ "].["
341+ ~(rend co ~ %ud p.q.q.sot)
342+ " "
343+ ~(rend co ~ %ud q.q.q.sot)
344+ "]>"
345+ ==
346+ ==
347+ ::
348+
349+Examples
350+--------
351+
352+ ~zod/try=> (mook [%0 5 4 5 1])
353+ [%0 p=[5 4 5 1]]
354+ ~zod/try=> (mook [%2 ~[[%hunk %rose ["<" "," ">"] ~[[%leaf "err"]]]]])
355+ [%2 p=~[[%rose p=[p="<" q="," r=">"] q=[i=[%leaf p="err"] t=~]]]]
356+ ~zod/try=> (mook [%2 ~[[%malformed %elem] [%lose 'do print']]])
357+ [%2 p=~[[%leaf p="do print"]]]
358+ ~zod/try=> (mook [%2 ~[[%mean |.(>(add 5 6)<)]]])
359+ [%2 p=~[[%leaf p="11"]]]
360+ ~zod/try=> (mook [%2 ~[[%spot /b/repl [1 1]^[1 2]] [%mean |.(!!)]]])
361+ [%2 p=~[[%leaf p="/b/repl/:<[1 1].[1 2]>"] [%leaf p="####"]]]
362+
363+
364+
365+***
366+### `++mule`
367+
368+Typed virtual
369+
370+Kicks a [`++trap`](), producing its results or any errors that occur along
371+the way. Used to lazily compute stack traces.
372+
373+Accepts
374+-------
375+
376+`taq` is a [`++trap`](), generally producing a list of [`++tank`]()s.
377+
378+Produces
379+--------
380+
381+XX
382+
383+Source
384+------
385+
386+ ++ mule :: typed virtual
387+ ~/ %mule
388+ |* taq=_|.(_*)
389+ =+ mud=(mute taq)
390+ ?- -.mud
391+ & [%& p=$:taq]
392+ | [%| p=p.mud]
393+ ==
394+ ::
395+
396+Examples
397+--------
398+
399+ ~zod/try=> (mule |.(leaf/"hello"))
400+ [%.y p=[%leaf "hello"]]
401+ ~zod/try=> (mule |.(!!))
402+ [%.n p=~]
403+ ~zod/try=> (mule |.(.^(a//=pals/1)))
404+ [ %.n
405+ p
406+ ~[
407+ [ %rose
408+ p=[p="/" q="/" r="/"]
409+ q
410+ [ i=[%leaf p="a"]
411+ t=[i=[%leaf p="~zod"] t=[i=[%leaf p="pals"] t=[i=[%leaf p="1"] t=~]]]
412+ ]
413+ ]
414+ ]
415+ ]
416+
417+
418+
419+***
420+### `++mute`
421+
422+Untyped virtual
423+
424+Kicks a `++trap`, producing its result as a noun or the tanks of any
425+error that occurs. Similar to [`++mule`](), but preserves no type
426+information.
427+
428+Accepts
429+-------
430+
431+`taq` is a [`++trap`](/doc/hoon/library/1#++trap).
432+
433+Produces
434+--------
435+
436+Either a noun or a [`++list`]() of [`++tank`]().
437+
438+Source
439+------
440+
441+ ++ mute :: untyped virtual
442+ |= taq=_^?(|.(_*))
443+ ^- (each ,* (list tank))
444+ =+ ton=(mock [taq 9 2 0 1] |=(* ~))
445+ ?- -.ton
446+ %0 [%& p.ton]
447+ %1 [%| (turn p.ton |=(a=* (smyt (path a))))]
448+ %2 [%| p.ton]
449+ ==
450+
451+Examples
452+--------
453+
454+ ~zod/try=> (mute |.(leaf/"hello"))
455+ [%.y p=[1.717.658.988 104 101 108 108 111 0]]
456+ ~zod/try=> (mute |.(!!))
457+ [%.n p=~]
458+ ~zod/try=> (mute |.(.^(a//=pals/1)))
459+ [ %.n
460+ p
461+ ~[
462+ [ %rose
463+ p=[p="/" q="/" r="/"]
464+ q=[i=[%leaf p="a"] t=[i=[%leaf p="~zod"] t=[i=[%leaf p="pals"] t=[i=[%leaf p="1"] t=~]]]]
465+ ]
466+ ]
467+ ]
468+
469+
470+
471+***
docs/system/hoon/library/4o.mdnew file+723
@@ -0,0 +1,723 @@
1+## 4o: molds and mold builders
2+### `++abel`
3+
4+Biblical names in hoon are primarily aliases for the compiler.
5+
6+Source
7+------
8+
9+ ++ abel typo :: original sin: type
10+
11+Examples
12+--------
13+
14+ ~zod/try=> *abel
15+ %void
16+
17+
18+
19+***
20+### `++aura`
21+
22+'type' of atom
23+
24+By convention, a short name for a category of atom. `++aura` is
25+circularly defined, with [`@ta`]() being the `++aura` of the ASCII subset
26+commonly used in urbit.
27+
28+Source
29+------
30+
31+ ++ aura ,@ta :: atom format
32+
33+Examples
34+--------
35+
36+See also: [`++base`](), [aura reference]()
37+
38+ ~zod/try=> `aura`%ux
39+ ~.ux
40+
41+
42+
43+***
44+
45+### `++axis`
46+
47+Nock axis
48+
49+A Nock axis inside a [noun](). After the leading 1, in binary, a `1` signfies
50+right and `0` left.
51+
52+Source
53+------
54+
55+ ++ axis ,@ :: tree address
56+
57+Examples
58+--------
59+
60+ ~zod/try=> *axis
61+ 0
62+
63+ ~zod/try=> :: 0 is not actually a valid axis
64+ ~zod/try=> [[4 5] 6 7]
65+ [[4 5] 6 7]
66+ ~zod/try=> `axis`0b110
67+ 6
68+
69+
70+***
71+
72+### `++base`
73+
74+Base type
75+
76+A base type that [noun]()s are built from. A `++base` is either a noun, cell, boolean or
77+null labelled with an [odor]().
78+
79+Source
80+------
81+
82+ ++ base ?([%atom p=odor] %noun %cell %bean %null) :: axils, @ * ^ ? ~
83+
84+Examples
85+--------
86+
87+ ~zod/try=> *base
88+ %null
89+
90+ ~zod/try=> (ream '=|(^ !!)')
91+ [%tsbr p=[%axil p=%cell] q=[%zpzp ~]]
92+ ~zod/try=> :: p.p is a ++base
93+ ~zod/try=> (ream '=|(@t !!)')
94+ [%tsbr p=[%axil p=[%atom p=~.t]] q=[%zpzp ~]]
95+ ~zod/try=> (ream '=|(? !!)')
96+ [%tsbr p=[%axil p=%bean] q=[%zpzp ~]]
97+
98+
99+***
100+### `++bean`
101+
102+Boolean
103+
104+`0`, `&`, or `%.y` are true, and `1`, `|`, and `%.n` are false.
105+
106+Source
107+------
108+
109+ ++ bean ,? :: 0=&=yes, 1=|=no
110+
111+Examples
112+--------
113+
114+ ~zod/try=> *bean
115+ %.y
116+
117+ ~zod/try=> `bean`&
118+ %.y
119+ ~zod/try=> `bean`|
120+ %.n
121+
122+
123+
124+***
125+### `++beer`
126+
127+Tape builder
128+
129+Used to build [tape]()s internally.
130+
131+Source
132+------
133+
134+ ++ beer $|(@ [~ p=twig]) :: simple embed
135+
136+Examples
137+--------
138+
139+ ~zod/try=> `beer`'as'
140+ 29.537
141+ ~zod/try=> `beer`[~ (ream 'lan')]
142+ [~ p=[%cnzz p=~[%lan]]]
143+
144+
145+***
146+### `++beet`
147+
148+XML interpolation cases
149+
150+Used internally.
151+
152+Source
153+------
154+
155+ ++ beet $| @ :: advanced embed
156+ $% [%a p=twig] :: take tape
157+ [%b p=twig] :: take manx
158+ [%c p=twig] :: take marl
159+ [%d p=twig] :: take $+(marl marl)
160+ [%e p=twig q=(list tuna)] :: element literal
161+ == ::
162+
163+
164+
165+***
166+### `++chum`
167+
168+Jet hint information
169+
170+Jet hint information that must be present in the body of a `~/` or `~%`
171+rune. A `++chum` can optionally contain a kelvin version, jet vendor,
172+and "{major}.{minor}" version number.
173+
174+Source
175+------
176+
177+ ++ chum $? lef=term :: jet name
178+ [std=term kel=@] :: kelvin version
179+ [ven=term pro=term kel=@] :: vendor and product
180+ [ven=term pro=term ver=@ kel=@] :: all of the above
181+ == ::
182+
183+Examples
184+--------
185+
186+XX there's a ++chum in zuse that's politely causing this not to work
187+
188+ ~zod/try=> `chum`'hi'
189+ lef=%hi
190+
191+ ~zod/try=> (ream '~/(%lob.314 !!)')
192+ [%sgfs p=[std=%lob kel=314] q=[%zpzp ~]]
193+
194+
195+
196+***
197+### `++coil`
198+
199+Tuple of core information
200+
201+Variance `p`, subject type `q`, and `q`: optional compiled nock, and arms. Used as an
202+intermediate step within Section 2fB. Converted by `++core` to %core type.
203+
204+Source
205+------
206+
207+ ++ coil $: p=?(%gold %iron %lead %zinc) :: core type
208+ q=type ::
209+ r=[p=?(~ ^) q=(map term foot)] ::
210+ == ::
211+
212+
213+
214+***
215+### `++foot`
216+
217+Cases of arms by variance model.
218+
219+`%ash` arms are [`dry`]() and [geometric]().
220+
221+Source
222+------
223+
224+ ++ foot $% [%ash p=twig] :: dry arm, geometric
225+ [%elm p=twig] :: wet arm, generic
226+ [%oak ~] :: XX not used
227+ [%yew p=(map term foot)] :: XX not used
228+ == ::
229+
230+Examples
231+--------
232+
233+See also: [`++ap`](), [`++ut`]()
234+
235+ ~zod/try=> *foot
236+ [%yew p={}]
237+
238+ ~zod/try=> (ream '|% ++ $ foo --')
239+ [%brcn p={[p=%$ q=[%ash p=[%cnzz p=~[%foo]]]]}]
240+ ~zod/try=> +<+:(ream '|% ++ $ foo --')
241+ t=~[%ash %cnzz %foo]
242+ ~zod/try=> (foot +<+:(ream '|% ++ $ foo --'))
243+ [%ash p=[%cnzz p=~[%foo]]]
244+ ~zod/try=> (foot +<+:(ream '|% +- $ foo --'))
245+ [%elm p=[%cnzz p=~[%foo]]]
246+
247+***
248+### `++limb`
249+
250+ ++ limb $|(term $%([%& p=axis] [%| p=@ud q=term])) ::
251+
252+XX move to `++ut`
253+
254+Reference into subject by name/axis
255+
256+See also: section 2fC-2fD
257+
258+ ~zod/try=> (ream '^^$')
259+ [%cnzz p=~[[%.n p=2 q=%$]]]
260+ ~zod/try=> (limb &2:(ream '^^$'))
261+ [%.n p=2 q=%$]
262+ ~zod/try=> (limb &2:(ream '^^^$'))
263+ [%.n p=3 q=%$]
264+
265+
266+
267+***
268+### `++line`
269+
270+XX move to `++ut`
271+
272+Source
273+------
274+
275+ ++ line ,[p=[%leaf p=odor q=@] q=tile] :: %kelp case
276+
277+
278+Examples
279+--------
280+
281+ ~zod/try=> (ream '$%([1 a] [%2 b])')
282+ [ %bccm
283+ p
284+ [ %kelp
285+ p
286+ [ i=[p=[%leaf p=~.ud q=1] q=[%herb p=[%cnzz p=~[%a]]]]
287+ t=~[[p=[%leaf p=~.ud q=2] q=[%herb p=[%cnzz p=~[%b]]]]]
288+ ]
289+ ]
290+ ]
291+ ~zod/try=> &3:(ream '$%([1 a] [%2 b])')
292+ p=[p=[%leaf p=%ud q=1] q=[%herb p=[%cnzz p=~[%a]]]]
293+ ~zod/try=> (line &3:(ream '$%([1 a] [%2 b])'))
294+ [p=[%leaf p=~.ud q=1] q=[%herb p=[%cnzz p=~[%a]]]]
295+
296+
297+***
298+### `++metl`
299+
300+ ++ metl ?(%gold %iron %zinc %lead) :: core variance
301+
302+XX move to `++ut`
303+
304+See also: [`++coil`]()
305+
306+
307+
308+***
309+### `++nock`
310+
311+Virtual machine. See [Nock doc]().
312+
313+
314+Source
315+------
316+
317+ ++ nock $& [p=nock q=nock] :: autocons
318+ [%3 p=nock] :: cell test
319+ [%4 p=nock] :: increment
320+ [%5 p=nock q=nock] :: equality test
321+ [%6 p=nock q=nock r=nock] :: if, then, else
322+ [%7 p=nock q=nock] :: serial compose
323+ [%8 p=nock q=nock] :: push onto subject
324+ [%9 p=@ q=nock] :: select arm and fire
325+ [%10 p=?(@ [p=@ q=nock]) q=nock] :: hint
326+ [%11 p=nock] :: grab data from sky
327+ == ::
328+
329+Examples
330+--------
331+
332+ ~zod/try=> !=([+(.) 20 -<])
333+ [[4 0 1] [1 20] 0 4]
334+ ~zod/try=> (nock !=([+(.) 20]))
335+ [p=[%4 p=[%0 p=1]] q=[%1 p=20]]
336+
337+
338+
339+***
340+### `++noun`
341+
342+ ++ noun ,* :: any noun
343+
344+Used nowhere XX
345+
346+ ~zod/try=> `noun`~[1 2 3]
347+ [1 2 3 0]
348+
349+
350+
351+***
352+### `++null`
353+
354+ ++ null ,~ :: null, nil, etc
355+
356+Used nowhere XX
357+
358+ ~zod/try=> :type; *null
359+ ~
360+ %~
361+
362+
363+
364+***
365+### `++port`
366+
367+XX move to `++ut`
368+
369+Type and location of core-shaped thing? XX Compiler Internals
370+
371+Source
372+------
373+
374+ ++ port $: p=axis ::
375+ $= q ::
376+ $% [%& p=type] ::
377+ [%| p=axis q=(list ,[p=type q=foot])] ::
378+ == ::
379+ == ::
380+
381+Examples
382+--------
383+
384+ ~zod/try=> *port
385+ [p=0 q=[%.y p=%void]]
386+
387+
388+
389+***
390+### `++span`
391+
392+ASCII atom
393+
394+A restricted text atom for canonical atom syntaxes. The prefix is `~.`.
395+There are no escape sequences except `~~`, which means `~`, and `~-`,
396+which means `_`. `-` and `.` encode themselves. No other characters
397+besides numbers and lowercase letters are permitted.
398+
399+Source
400+------
401+
402+ ++ span ,@ta :: text-atom (ASCII)
403+Examples
404+--------
405+ ~zod/try=> *span
406+ ~.
407+
408+ ~zod/try=> `@t`~.foo
409+ 'foo'
410+ ~zod/try=> `@t`~.foo.bar
411+ 'foo.bar'
412+ ~zod/try=> `@t`~.foo~~bar
413+ 'foo~bar'
414+ ~zod/try=> `@t`~.foo~-bar
415+ 'foo_bar'
416+ ~zod/try=> `@t`~.foo-bar
417+ 'foo-bar'
418+
419+
420+
421+***
422+### `++tiki`
423+
424+XX move to `++ut`
425+
426+Source
427+------
428+
429+ ++ tiki :: test case
430+
431+Examples
432+--------
433+
434+A `++wing` or `++twig`.
435+
436+ ~zod/try=> (ream '=+ a=4 ?-(a @ ~)')
437+ [ %tsls
438+ p=[%ktts p=p=%a q=[%dtzy p=%ud q=4]]
439+ q
440+ [ %wthz
441+ p=[%.y p=~ q=~[%a]]
442+ q=~[[p=[%axil p=[%atom p=~.]] q=[%bczp p=%null]]]
443+ ]
444+ ]
445+ ~zod/try=> (ream '=+ a=4 ?-(4 @ ~)')
446+ [ %tsls
447+ p=[%ktts p=p=%a q=[%dtzy p=%ud q=4]]
448+ q
449+ [ %wthz
450+ p=[%.n p=~ q=[%dtzy p=%ud q=4]]
451+ q=~[[p=[%axil p=[%atom p=~.]] q=[%bczp p=%null]]]
452+ ]
453+ ]
454+
455+
456+
457+***
458+### `++toga`
459+
460+Tree of faces
461+
462+A [face](), or tree of faces. A `++toga` is applied to anything assigned
463+using [`^=`]().
464+
465+XX move to `++ut` and rune doc (for \^= examples)
466+
467+Source
468+------
469+
470+ ++ toga :: face control
471+ [2 p=toga q=toga] :: cell toga
472+ == ::
473+
474+Examples
475+--------
476+
477+ ~zod/try=> a=1
478+ a=1
479+ ~zod/try=> (ream 'a=1')
480+ [%ktts p=p=%a q=[%dtzy p=%ud q=1]]
481+ ~zod/try=> [a b]=[1 2 3]
482+ [a=1 b=[2 3]]
483+ ~zod/try=> (ream '[a b]=[1 2 3]')
484+ [ %ktts
485+ p=[%2 p=p=%a q=p=%b]
486+ q=[%cltr p=~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]]
487+ ]
488+
489+ ~zod/try=> [a ~]=[1 2 3]
490+ [a=1 2 3]
491+ ~zod/try=> (ream '[a ~]=[1 2 3]')
492+ [ %ktts
493+ p=[%2 p=p=%a q=[%0 ~]]
494+ q=[%cltr p=~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]]
495+ ]
496+
497+
498+
499+***
500+### `++tone`
501+
502+Intermediate Nock computation result
503+
504+Similar to [`++toon`](), but stack trace is not yet rendered.
505+
506+Source
507+------
508+
509+ ++ tone $% [%0 p=*] :: success
510+
511+Examples
512+--------
513+
514+ ~zod/try=> (mink [[20 21] 0 3] ,~)
515+ [%0 p=21]
516+
517+ ~zod/try=> (mink [[0] !=(.^(cy//=main/1))] ,~)
518+ [%1 p=~[[31.075 1.685.027.454 1.852.399.981 49 0]]]
519+ ~zod/try=> (path [31.075 1.685.027.454 1.852.399.981 49 0])
520+ /cy/~zod/main/1
521+
522+ ~zod/try=> (mink [[1 2] !=(~|(%hi +(.)))] ,~)
523+ [%2 p=~[[~.yelp 26.984]]]
524+ ~zod/try=> (mink [[1 2] !=(!:(+(.)))] ,~)
525+ [ %2
526+ p
527+ ~[
528+ [ ~.spot
529+ [ [ 1.685.027.454
530+ 7.959.156
531+ \/159.445.990.350.374.058.574.398.238.344.143.957.205.628.479.572.65\/
532+ 8.112.403.878.526
533+ \/ \/
534+ 0
535+ ]
536+ [1 20]
537+ 1
538+ 24
539+ ]
540+ ]
541+ ]
542+ ]
543+
544+
545+
546+***
547+### `++tuna`
548+
549+XML template tree
550+
551+An XML template tree.
552+
553+Source
554+------
555+
556+ ++ tuna :: tagflow
557+ [%d p=twig] :: dynamic list
558+ [%e p=twig q=(list tuna)] :: element
559+ [%f p=(list tuna)] :: subflow
560+ == ::
561+
562+Examples
563+--------
564+
565+Leaf %a contains plain-text, %b an empty tag, %c a static list, %d a
566+dynamic list, %e a full node element containing a twig and a list of
567+tuna, and %f is a empty node.
568+
569+See also: [`++sail`]()
570+
571+
572+
573+***
574+### `++tusk`
575+
576+List of expressions
577+
578+List of [`++twig`]()s. In [`:*`](), for example, your contents is
579+a `++tusk`.
580+
581+Source
582+------
583+
584+ ++ tusk (list twig) ::
585+
586+Examples
587+--------
588+
589+ ~zod/try=> (ream '[1 2 3]')
590+ [%cltr p=~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]]
591+ ~zod/try=> (tusk +:(ream '[1 2 3]'))
592+ ~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]
593+
594+
595+
596+***
597+### `++twig`
598+
599+Expression
600+
601+An expression, or AST.
602+
603+See Twig section of Hoon reference
604+
605+
606+
607+***
608+### `++tyke`
609+
610+List of 'maybe' twigs
611+
612+List of [`++unit`]() [`++twig`](), or gaps left to be inferred, in [`++path`]()
613+parsing. When you use a path such as `/=main=/pub/src/doc` the path is in fact
614+a `++tyke`, where the `=` are inferred from your current path.
615+
616+
617+Source
618+------
619+
620+ ++ tyke (list (unit twig)) ::
621+
622+Examples
623+--------
624+
625+ ~zod/try=> (scan "/==as=" porc:vast)
626+ [0 ~[~ ~ [~ [%dtzy p=%tas q=29.537]] ~]]
627+ ~zod/try=> `tyke`+:(scan "/==as=" porc:vast)
628+ ~[~ ~ [~ [%dtzy p=%tas q=29.537]] ~]
629+
630+
631+
632+***
633+### `++typo`
634+
635+Pointer for `++type`
636+
637+Pointer for [`++type`](). `++typo` preserves the previous `++type` in your
638+context when upating.
639+
640+Source
641+------
642+
643+ ++ typo type :: old type
644+
645+Examples
646+--------
647+
648+See also: `++seem`, `++vise`, `++type`
649+
650+
651+
652+***
653+### `++tyre`
654+
655+List, term to twig
656+
657+Associative list of [++term]() [`++twig`](), used in [jet]() hint processing.
658+
659+Source
660+------
661+
662+ ++ tyre (list ,[p=term q=twig]) ::
663+
664+
665+
666+***
667+### `++vase`
668+
669+Typed data. A `++vase` is used wherever typed data is explicitly worked
670+with.
671+
672+
673+Source
674+------
675+
676+ ++ vase ,[p=type q=*] :: type-value pair
677+
678+Examples
679+--------
680+See `%arvo` doc
681+
682+ ~zod/try=> `vase`!>(~)
683+ [p=[%cube p=0 q=[%atom p=%n]] q=0]
684+
685+
686+
687+***
688+### `++vise`
689+
690+Convert during reboot
691+
692+Used to convert from previously-typed data during reboot.
693+
694+Source
695+------
696+
697+ ++ vise ,[p=typo q=*] :: old vase
698+
699+Examples
700+--------
701+
702+See also: [`++typo`](), [`++seer`]()
703+
704+
705+
706+***
707+### `++wing`
708+
709+ ++ wing (list limb) ::
710+
711+Address in subject. A `++wing` is a path to a value in the subject. A
712+term alone is the trivial case of a `++wing`.
713+
714+See also: `++twig`
715+
716+ ~zod/try=> (ream 'a.+.c')
717+ [%cnzz p=~[%a [%.y p=3] %c]]
718+ ~zod/try=> (wing +:(ream 'a.+.c'))
719+ ~[%a [%.y p=3] %c]
720+
721+
722+
723+***
docs/system/hoon/library/5a.mdnew file+1
@@ -0,0 +1 @@
1+## 5a: compiler utilities
docs/system/hoon/library/5b.mdnew file+1
@@ -0,0 +1 @@
1+## 5b: macro expansion
docs/system/hoon/library/5c.mdnew file+1
@@ -0,0 +1 @@
1+## 5c: compiler backend and prettyprinter
docs/system/hoon/library/5d.mdnew file+1
@@ -0,0 +1 @@
1+## 5d: parser
docs/system/hoon/library/5e.mdnew file+1
@@ -0,0 +1 @@
1+## 5e: caching compiler
docs/system/hoon/library/5f.mdnew file+174
@@ -0,0 +1,174 @@
1+## 5f: molds and mold builders
2+### `++mane`
3+
4+XML name
5+
6+An XML name (tag name or attribute name) with an optional namespace. Parsed by
7+[`++name`]() within [`++poxa`](), rendered by [`++name`]() within `++poxo`.
8+
9+Source
10+------
11+
12+ ++ mane $|(@tas [@tas @tas]) :: XML name/space
13+
14+Examples
15+--------
16+
17+See also: [`++sail`]()
18+
19+ ~zod/try=> *mane
20+ %$
21+
22+ ~zod/try=> `mane`n.g:`manx`;div:namespace;
23+ %div
24+ ~zod/try=> `mane`n.g:`manx`;div_namespace;
25+ [%div %namespace]
26+
27+
28+
29+***
30+### `++manx`
31+
32+XML node.
33+
34+Parsed by [`++apex`]() within [`++poxa`](), rendered by [`++poxo`]().
35+
36+Source
37+------
38+
39+ ++ manx ,[g=marx c=marl] :: XML node
40+
41+Examples
42+--------
43+
44+See also: [`++sail`]() doc
45+
46+
47+
48+***
49+### `++marl`
50+
51+List of XML nodes
52+
53+A list of [`++manx`]().
54+
55+Source
56+------
57+
58+ ++ marl (list manx) :: XML node list
59+
60+Examples
61+--------
62+
63+
64+
65+
66+***
67+### `++mars`
68+
69+XML CDATA
70+
71+Implicitly produced by [`++chrd`]() within [`++poxa`]()
72+
73+Source
74+------
75+
76+ ++ mars ,[t=[n=%$ a=[i=[n=%$ v=tape] t=~]] c=~] :: XML cdata
77+
78+Examples
79+--------
80+
81+
82+
83+***
84+### `++mart`
85+
86+List of XML attributes
87+
88+Each `++mart` is a list of pairs of [`++mane`]() and
89+[`++tape`]().
90+
91+Parsed by [`++attr`]() within [`++poxa`](), rendered by `++attr` within [`++poxo`]()
92+
93+Source
94+------
95+
96+ ++ mart (list ,[n=mane v=tape]) :: XML attributes
97+
98+Examples
99+--------
100+
101+
102+
103+***
104+### `++marx`
105+
106+XML tag
107+
108+A `++marx` is a pair of a tag name, `++mane` and a list of attributes,
109+`++mart`. Parsed by [`++head`]() `++poxa`, rendered within `++poxo`.
110+
111+Source
112+------
113+
114+ ++ marx ,[n=mane a=mart] :: XML tag
115+
116+Examples
117+--------
118+
119+
120+
121+***
122+### `++pass`
123+
124+Atom alias
125+
126+Used primarily in crypto.
127+
128+Source
129+------
130+
131+ ++ pass ,@ :: public key
132+
133+
134+
135+***
136+### `++ring`
137+
138+Atom alias
139+
140+Used primarily in crypto.
141+
142+Source
143+------
144+
145+ ++ ring ,@ :: private key
146+
147+
148+
149+***
150+### `++time`
151+
152+Absolute date
153+
154+The `@da` odor designates an absolute date atom.
155+
156+Source
157+------
158+
159+ ++ time ,@da :: galactic time
160+
161+Examples
162+--------
163+
164+See also: [`++date`](), [odor reference]()
165+
166+ ~zod/try=> `time`-<-
167+ ~2014.9.25..20.01.47..eeac
168+ ~zod/try=> :: the time is always in your context at -<-
169+ ~zod/try=> `time`~2014.1.1
170+ ~2014.1.1
171+
172+
173+
174+***
docs/system/hoon/library/5g.mdnew file

No changes to the content.

docs/system/hoon/library/hr.txtdeleted−1
@@ -1 +0,0 @@
1−-----
docs/system/hoon/library/src/1a/gate/add.md+1−1
@@ -36,4 +36,4 @@ Examples
3636 ~zod/try=> (add 1.333 (mul 2 2))
3737 1.337
3838
39−
39+***
docs/system/hoon/library/src/1a/gate/dec.md+2
@@ -38,3 +38,5 @@ Examples
3838 ! exit
3939
4040
41+
42+***
docs/system/hoon/library/src/1a/gate/div.md+2
@@ -41,3 +41,5 @@ Examples
4141 ~zod/try=> (div 20 30)
4242 0
4343
44+
45+***
docs/system/hoon/library/src/1a/gate/gte.md+2
@@ -37,3 +37,5 @@ Examples
3737 %.n
3838
3939
40+
41+***
docs/system/hoon/library/src/1a/gate/gth.md+2
@@ -35,3 +35,5 @@ Examples
3535 %.n
3636
3737
38+
39+***
docs/system/hoon/library/src/1a/gate/lte.md+2
@@ -38,3 +38,5 @@ Examples
3838 %.y
3939
4040
41+
42+***
docs/system/hoon/library/src/1a/gate/lth.md+2
@@ -43,3 +43,5 @@ Examples
4343 ~zod/try=> (lth 5 0)
4444 %.n
4545
46+
47+***
docs/system/hoon/library/src/1a/gate/max.md+2
@@ -38,3 +38,5 @@ Examples
3838 1
3939
4040
41+
42+***
docs/system/hoon/library/src/1a/gate/min.md+2
@@ -38,3 +38,5 @@ Examples
3838 0
3939
4040
41+
42+***
docs/system/hoon/library/src/1a/gate/mod.md+2
@@ -36,3 +36,5 @@ Examples
3636 0
3737
3838
39+
40+***
docs/system/hoon/library/src/1a/gate/mul.md+2
@@ -38,3 +38,5 @@ Examples
3838 0
3939
4040
41+
42+***
docs/system/hoon/library/src/1a/gate/sub.md+2
@@ -41,3 +41,5 @@ Examples
4141 ! exit
4242
4343
44+
45+***
docs/system/hoon/library/src/1b/gate/cap.md+2
@@ -42,3 +42,5 @@ Examples
4242 %2
4343
4444
45+
46+***
docs/system/hoon/library/src/1b/gate/mas.md+2
@@ -46,3 +46,5 @@ Examples
4646 ! exit
4747
4848
49+
50+***
docs/system/hoon/library/src/1b/gate/peg.md+2
@@ -42,3 +42,5 @@ Examples
4242 269
4343
4444
45+
46+***
docs/system/hoon/library/src/1c/mold/bloq.md+2
@@ -18,3 +18,5 @@ Examples
1818 2
1919 ~zod/try=> :: 256 is 2 bloqs of 2^3
2020
21+
22+***
docs/system/hoon/library/src/1c/mold/each.md+2
@@ -17,3 +17,5 @@ Examples
1717 {[%.y p=@t] [%.n p=@da]}
1818
1919
20+
21+***
docs/system/hoon/library/src/1c/mold/gate.md+2
@@ -27,3 +27,5 @@ See also: [`++lift`](), [`++cork`]()
2727 [99 98]
2828
2929
30+
31+***
docs/system/hoon/library/src/1c/mold/list.md+2
@@ -24,3 +24,5 @@ See also: [`++turn`](), [`++snag`]()
2424 ~~a
2525
2626
27+
28+***
docs/system/hoon/library/src/1c/mold/lone.md+2
@@ -10,3 +10,5 @@ Source
1010 ++ lone |*(a=$+(* *) ,p=a) :: just one thing
1111
1212
13+
14+***
docs/system/hoon/library/src/1c/mold/pair.md+2
@@ -18,3 +18,5 @@ Examples
1818 [p=%.y q='']
1919
2020
21+
22+***
docs/system/hoon/library/src/1c/mold/pole.md+2
@@ -16,3 +16,5 @@ Examples
1616 [~~a [~~s [~~d [~~f ~]]]]
1717
1818
19+
20+***
docs/system/hoon/library/src/1c/mold/qual.md+2
@@ -16,3 +16,5 @@ Examples
1616 [p=[[a=%.y y=0] m=0 t=[d=0 h=0 m=0 s=0 f=~]] q=~292277024401-.1.1 r="" s='']
1717
1818
19+
20+***
docs/system/hoon/library/src/1c/mold/trap.md+2
@@ -22,3 +22,5 @@ See also: `|.`
2222 42
2323
2424
25+
26+***
docs/system/hoon/library/src/1c/mold/tree.md+2
@@ -17,3 +17,5 @@ Examples
1717 {[2 "bye"] [1 "hi"]}
1818
1919
20+
21+***
docs/system/hoon/library/src/1c/mold/trel.md+2
@@ -16,3 +16,5 @@ Examples
1616 [p=0 q='' r=--0]
1717
1818
19+
20+***
docs/system/hoon/library/src/1c/mold/unit.md+2
@@ -23,3 +23,5 @@ See also: [`++bind`]()
2323 [~ ~2014.9.24..19.25.10..7dd5]
2424
2525
26+
27+***
docs/system/hoon/library/src/2a/gate/biff.md+2
@@ -34,3 +34,5 @@ Examples
3434 ~
3535
3636
37+
38+***
docs/system/hoon/library/src/2a/gate/bind.md+2
@@ -36,3 +36,5 @@ Examples
3636 [~ 3]
3737
3838
39+
40+***
docs/system/hoon/library/src/2a/gate/bond.md+2
@@ -37,3 +37,5 @@ Examples
3737 123
3838
3939
40+
41+***
docs/system/hoon/library/src/2a/gate/both.md+2
@@ -35,3 +35,5 @@ Examples
3535 ~zod/try=> (both ~ (some %b))
3636 ~
3737
38+
39+***
docs/system/hoon/library/src/2a/gate/clap.md+2
@@ -42,3 +42,5 @@ Examples
4242 [~ 3]
4343
4444
45+
46+***
docs/system/hoon/library/src/2a/gate/drop.md+2
@@ -33,3 +33,5 @@ Examples
3333 ~
3434
3535
36+
37+***
docs/system/hoon/library/src/2a/gate/fall.md+2
@@ -32,3 +32,5 @@ Examples
3232 0
3333
3434
35+
36+***
docs/system/hoon/library/src/2a/gate/lift.md+2
@@ -35,3 +35,5 @@ Examples
3535 [~ 19]
3636
3737
38+
39+***
docs/system/hoon/library/src/2a/gate/mate.md+2
@@ -47,3 +47,5 @@ Examples
4747 ! exit
4848
4949
50+
51+***
docs/system/hoon/library/src/2a/gate/need.md+2
@@ -36,3 +36,5 @@ Examples
3636 ! exit
3737
3838
39+
40+***
docs/system/hoon/library/src/2a/gate/some.md+2
@@ -30,3 +30,5 @@ Examples
3030 [~ u=%.y]
3131
3232
33+
34+***
docs/system/hoon/library/src/2b/gate/flop.md+2
@@ -36,3 +36,5 @@ Examples
3636 ~[3 2 1]
3737
3838
39+
40+***
docs/system/hoon/library/src/2b/gate/homo.md+2
@@ -39,3 +39,5 @@ Examples
3939 ~[1 2 3]
4040
4141
42+
43+***
docs/system/hoon/library/src/2b/gate/lent.md+2
@@ -35,3 +35,5 @@ Examples
3535 5
3636
3737
38+
39+***
docs/system/hoon/library/src/2b/gate/levy.md+2
@@ -36,3 +36,5 @@ Examples
3636 %.y
3737
3838
39+
40+***
docs/system/hoon/library/src/2b/gate/lien.md+2
@@ -24,3 +24,5 @@ Computes the Boolean logical "or" on the results of applying [gate]() `b` to eve
2424 %.n
2525
2626
27+
28+***
docs/system/hoon/library/src/2b/gate/limo.md+2
@@ -31,3 +31,5 @@ Examples
3131 [i=1 t=[i=2 t=[i=3 t=~]]]
3232
3333
34+
35+***
docs/system/hoon/library/src/2b/gate/murn.md+2
@@ -38,3 +38,5 @@ Examples
3838 [i=12 t=[i=13 t=~]]
3939
4040
41+
42+***
docs/system/hoon/library/src/2b/gate/reap.md+2
@@ -34,3 +34,5 @@ Examples
3434 ~s5
3535
3636
37+
38+***
docs/system/hoon/library/src/2b/gate/reel.md+2
@@ -41,3 +41,5 @@ Examples
4141 ! exit
4242
4343
44+
45+***
docs/system/hoon/library/src/2b/gate/roll.md+2
@@ -41,3 +41,5 @@ Examples
4141 q=4
4242
4343
44+
45+***
docs/system/hoon/library/src/2b/gate/scag.md+2
@@ -34,3 +34,5 @@ Examples
3434 [i=1 t=[i=2 t=[i=3 t=[i=4 t=~]]]]
3535
3636
37+
38+***
docs/system/hoon/library/src/2b/gate/skid.md+2
@@ -34,3 +34,5 @@ Examples
3434 [p=[i=2 t=[i=3 t=~]] q=[i=0 t=[i=1 t=~]]]
3535
3636
37+
38+***
docs/system/hoon/library/src/2b/gate/skim.md+2
@@ -33,3 +33,5 @@ Examples
3333 [i=2 t=[i=3 t=~]]
3434
3535
36+
37+***
docs/system/hoon/library/src/2b/gate/skip.md+2
@@ -35,3 +35,5 @@ Examples
3535 [i=0 t=[i=1 t=~]]
3636
3737
38+
39+***
docs/system/hoon/library/src/2b/gate/slag.md+2
@@ -35,3 +35,5 @@ Examples
3535 [i=2 t=[i=3 t=[i=4 t=~]]]
3636
3737
38+
39+***
docs/system/hoon/library/src/2b/gate/snag.md+2
@@ -36,3 +36,5 @@ Examples
3636 1
3737
3838
39+
40+***
docs/system/hoon/library/src/2b/gate/sort.md+2
@@ -38,3 +38,5 @@ Examples
3838 ~[3 2 1 0]
3939
4040
41+
42+***
docs/system/hoon/library/src/2b/gate/swag.md+2
@@ -31,3 +31,5 @@ Examples
3131 [i=3 t=[i=4 t=~]]
3232
3333
34+
35+***
docs/system/hoon/library/src/2b/gate/turn.md+2
@@ -35,3 +35,5 @@ Examples
3535 ~[5 6 7 8]
3636
3737
38+
39+***
docs/system/hoon/library/src/2b/gate/weld.md+2
@@ -29,3 +29,5 @@ Examples
2929 ~[1 2 3 4]
3030
3131
32+
33+***
docs/system/hoon/library/src/2b/gate/welp.md+2
@@ -43,3 +43,5 @@ Examples
4343 [[%sa 1] [%so 2] %si 3]
4444
4545
46+
47+***
docs/system/hoon/library/src/2b/gate/zing.md+2
@@ -35,3 +35,5 @@ Examples
3535 ~zod/try=> (zing (limo [(limo [1 'a' 2 'b' ~]) (limo [3 'c' 4 'd' ~]) ~]))
3636 ~[1 97 2 98 3 99 4 100]
3737
38+
39+***
docs/system/hoon/library/src/2c/gate/bex.md+2
@@ -35,3 +35,5 @@ Examples
3535 1
3636
3737
38+
39+***
docs/system/hoon/library/src/2c/gate/can.md+2
@@ -45,3 +45,5 @@ Examples
4545 ~zod/try=> `@ux`(can 3 ~[[1 'a'] [2 'bc']])
4646 0x63.6261
4747
48+
49+***
docs/system/hoon/library/src/2c/gate/cat.md+2
@@ -50,3 +50,5 @@ Examples
5050 16.711.936
5151
5252
53+
54+***
docs/system/hoon/library/src/2c/gate/cut.md+2
@@ -47,3 +47,5 @@ Examples
4747 0b10.0001
4848
4949
50+
51+***
docs/system/hoon/library/src/2c/gate/end.md+2
@@ -48,3 +48,5 @@ Examples
4848 'ab'
4949
5050
51+
52+***
docs/system/hoon/library/src/2c/gate/fil.md+2
@@ -43,3 +43,5 @@ Examples
4343 %bfbfbfbfbfbfbfbfbfbf
4444
4545
46+
47+***
docs/system/hoon/library/src/2c/gate/lsh.md+2
@@ -43,3 +43,5 @@ Examples
4343 65.280
4444
4545
46+
47+***
docs/system/hoon/library/src/2c/gate/met.md+2
@@ -35,3 +35,5 @@ Examples
3535 5
3636
3737
38+
39+***
docs/system/hoon/library/src/2c/gate/rap.md+2
@@ -39,3 +39,5 @@ Examples
3939 3
4040
4141
42+
43+***
docs/system/hoon/library/src/2c/gate/rep.md+2
@@ -47,3 +47,5 @@ Examples
4747 0b10.1010
4848
4949
50+
51+***
docs/system/hoon/library/src/2c/gate/rip.md+2
@@ -47,3 +47,5 @@ Examples
4747 ~[0 1]
4848
4949
50+
51+***
docs/system/hoon/library/src/2c/gate/rsh.md+2
@@ -53,3 +53,5 @@ Examples
5353 0x6362
5454
5555
56+
57+***
docs/system/hoon/library/src/2c/gate/swp.md+2
@@ -38,3 +38,5 @@ Examples
3838 1
3939
4040
41+
42+***
docs/system/hoon/library/src/2c/gate/xeb.md+2
@@ -40,3 +40,5 @@ Examples
4040 2
4141
4242
43+
44+***
docs/system/hoon/library/src/2d/gate/con.md+2
@@ -54,3 +54,5 @@ Examples
5454 10.234
5555
5656
57+
58+***
docs/system/hoon/library/src/2d/gate/dis.md+2
@@ -58,3 +58,5 @@ Examples
5858 530
5959
6060
61+
62+***
docs/system/hoon/library/src/2d/gate/mix.md+2
@@ -50,3 +50,5 @@ Examples
5050 0
5151
5252
53+
54+***
docs/system/hoon/library/src/2d/gate/not.md+2
@@ -42,3 +42,5 @@ Examples
4242 10
4343
4444
45+
46+***
docs/system/hoon/library/src/2e/gate/fnv.md+2
@@ -31,3 +31,5 @@ Examples
3131 16.777.619
3232
3333
34+
35+***
docs/system/hoon/library/src/2e/gate/mug.md+2
@@ -52,3 +52,5 @@ Examples
5252 1.067.931.605
5353
5454
55+
56+***
docs/system/hoon/library/src/2e/gate/mum.md+2
@@ -67,3 +67,5 @@ Examples
6767 1.517.902.092
6868
6969
70+
71+***
docs/system/hoon/library/src/2f/gate/aor.md+2
@@ -59,3 +59,5 @@ Examples
5959 %.n
6060
6161
62+
63+***
docs/system/hoon/library/src/2f/gate/dor.md+2
@@ -50,3 +50,5 @@ Examples
5050 %.n
5151
5252
53+
54+***
docs/system/hoon/library/src/2f/gate/gor.md+2
@@ -54,3 +54,5 @@ Examples
5454 %.n
5555
5656
57+
58+***
docs/system/hoon/library/src/2f/gate/hor.md+2
@@ -47,3 +47,5 @@ Examples
4747 %.n
4848
4949
50+
51+***
docs/system/hoon/library/src/2f/gate/vor.md+2
@@ -37,3 +37,5 @@ Examples
3737 %.n
3838
3939
40+
41+***
docs/system/hoon/library/src/2h/core/in.md+2
@@ -587,3 +587,5 @@ Examples
587587 ~zod/try=> ~(wyt in b)
588588 4
589589
590+
591+***
docs/system/hoon/library/src/2i/core/by.md+2
@@ -567,3 +567,5 @@ Produce the depth of the tree map `a`.
567567 4
568568
569569
570+
571+***
docs/system/hoon/library/src/2j/core/ja.md+2
@@ -227,3 +227,5 @@ pairs. The contained arms inherit it's [sample]() [map](), `a`.
227227 ~zod/try=> ~(. by (mo (limo [%a 1] [%b 2] ~)))
228228 <19.irb [nlr([p={%a %b} q=@ud]) <414.rvm 101.jzo 1.ypj %164>]>
229229
230+
231+***
docs/system/hoon/library/src/2j/core/ju.md+2
@@ -133,3 +133,5 @@ Produces jar `a` with `c` added to the set value located at key `b`.
133133 {[p='a' q={1 3 2}] [p='c' q={7}] [p='b' q={5 4 6}]}
134134
135135
136+
137+***
docs/system/hoon/library/src/2k/core/to.md+2
@@ -329,3 +329,5 @@ Examples
329329 [~ 1]
330330
331331
332+
333+***
docs/system/hoon/library/src/2n/gate/cork.md+2
@@ -23,3 +23,5 @@ Examples
2323 22
2424
2525
26+
27+***
docs/system/hoon/library/src/2n/gate/corl.md+2
@@ -23,3 +23,5 @@ Examples
2323 [~ 4]
2424
2525
26+
27+***
docs/system/hoon/library/src/2n/gate/curr.md+2
@@ -33,3 +33,5 @@ Examples
3333 'lek-om'
3434
3535
36+
37+***
docs/system/hoon/library/src/2n/gate/cury.md+2
@@ -32,3 +32,5 @@ Examples
3232 9
3333
3434
35+
36+***
docs/system/hoon/library/src/2n/gate/hard.md+2
@@ -27,3 +27,5 @@ Examples
2727 ! exit
2828
2929
30+
31+***
docs/system/hoon/library/src/2n/gate/soft.md+2
@@ -27,3 +27,5 @@ Examples
2727 ~
2828
2929
30+
31+***
docs/system/hoon/library/src/2o/mold/jar.md+2
@@ -28,3 +28,5 @@ See also: [`++ja`](), [`++by`](), [`++map`](), [`++list`]()
2828 ~
2929
3030
31+
32+***
docs/system/hoon/library/src/2o/mold/jug.md+2
@@ -26,3 +26,5 @@ See also: `++ju`, `++by`, `++map`, `++set`
2626 ~zod/try=> (~(put ju c) [%b 5])
2727 {[p=%a q={1 2}] [p=%b q={5 4 3}]}
2828
29+
30+***
docs/system/hoon/library/src/2o/mold/map.md+2
@@ -23,3 +23,5 @@ See also: [`++by`]()
2323 {[p=~.a q=1] [p=~.b q=2]}
2424
2525
26+
27+***
docs/system/hoon/library/src/2o/mold/qeu.md+2
@@ -22,3 +22,5 @@ Examples
2222 {~2014.1.2 ~2014.1.1}
2323
2424
25+
26+***
docs/system/hoon/library/src/2o/mold/set.md+2
@@ -24,3 +24,5 @@ See also: [`++in`]()
2424 {~~a ~~c ~~b}
2525
2626
27+
28+***
docs/system/hoon/library/src/2p/gate/cue.md+2
@@ -51,3 +51,5 @@ Examples
5151 ~zod/try=> (cue 39.689)
5252 [0 19]
5353
54+
55+***
docs/system/hoon/library/src/2p/gate/jam.md+2
@@ -56,3 +56,5 @@ Examples
5656 39.689
5757
5858
59+
60+***
docs/system/hoon/library/src/2p/gate/mat.md+2
@@ -52,3 +52,5 @@ Examples
5252 [0b1010.1010.1010 0b100 0b1.0000]
5353
5454
55+
56+***
docs/system/hoon/library/src/2p/gate/rub.md+2
@@ -48,3 +48,5 @@ Examples
4848 [p=20 q=2.730]
4949 ~zod/try=> `@ux`q:(rub 1 0b1.0101.0101.0101.0010.0000)
5050 0xaaa
51+
52+***
docs/system/hoon/library/src/2q/mold/char.md+2
@@ -20,3 +20,5 @@ Examples
2020 'a'
2121
2222
23+
24+***
docs/system/hoon/library/src/2q/mold/cord.md+2
@@ -26,3 +26,5 @@ in the text is the low byte.
2626 'urbit'
2727
2828
29+
30+***
docs/system/hoon/library/src/2q/mold/date.md+2
@@ -18,3 +18,5 @@ See also: [`++year`](), [`++yore`]() [`++stud`](), [`++dust`]()
1818 ~zod/try=> `date`(yore ~2014.6.6..21.09.15..0a16)
1919 [[a=%.y y=2.014] m=6 t=[d=6 h=21 m=9 s=15 f=~[0xa16]]]
2020
21+
22+***
docs/system/hoon/library/src/2q/mold/tang.md+2
@@ -5,3 +5,5 @@
55Unused XX
66
77
8+
9+***
docs/system/hoon/library/src/2q/mold/tank.md+2
@@ -37,3 +37,5 @@ Examples
3737 ]
3838
3939
40+
41+***
docs/system/hoon/library/src/2q/mold/tape.md+2
@@ -19,3 +19,5 @@ Examples
1919 ~zod/try=> `(list ,@)`"foobar"
2020 ~[102 111 111 98 97 114]
2121
22+
23+***
docs/system/hoon/library/src/2q/mold/tarp.md+2
@@ -25,3 +25,5 @@ See also: [`++date`](), [`++yell`[]()/`++yule`]()
2525 [d=20 h=0 m=0 s=0 f=~]
2626
2727
28+
29+***
docs/system/hoon/library/src/2q/mold/term.md+2
@@ -26,3 +26,5 @@ Examples
2626 [%cube p=271.101.667.197.767.630.546.276 q=[%atom p=%tas]]
2727
2828
29+
30+***
docs/system/hoon/library/src/2q/mold/wain.md+2
@@ -30,3 +30,5 @@ See also: [`++lore`](), [`++role`]()
3030 |>
3131
3232
33+
34+***
docs/system/hoon/library/src/2q/mold/wall.md+2
@@ -29,3 +29,5 @@ See also: [`++wash`]()
2929 >>
3030
3131
32+
33+***
docs/system/hoon/library/src/3a/core/fe.md+2
@@ -414,3 +414,5 @@ Examples
414414 1
415415
416416
417+
418+***
docs/system/hoon/library/src/3a/core/si.md+2
@@ -476,3 +476,5 @@ Examples
476476 ~zod/try=> (cmp:si -10 --7)
477477 -1
478478
479+
480+***
docs/system/hoon/library/src/3a/gate/egcd.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3c/core/yo.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3c/gate/yall.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3c/gate/yawn.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3c/gate/year.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3c/gate/yell.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3c/gate/yelp.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3c/gate/yore.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3c/gate/yule.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3d/core/og.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3d/gate/shad.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3d/gate/shaf.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3d/gate/shak.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3d/gate/shal.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3d/gate/sham.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3d/gate/shan.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3d/gate/shas.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3d/gate/shaw.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3d/gate/shax.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3d/gate/shaz.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3e/core/aesc.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3f/core/ob.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3f/core/un.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3g/mold/coin.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3g/mold/dime.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3g/mold/edge.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3g/mold/hair.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3g/mold/like.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3g/mold/nail.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3g/mold/path.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3g/mold/pint.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3g/mold/rule.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3g/mold/spot.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3g/mold/toon.md+2

This diff is too big to show here.

docs/system/hoon/library/src/3g/mold/wonk.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4a/core/po.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4b/core/at.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4b/gate/cass.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4b/gate/crip.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4b/gate/cuss.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4b/gate/mesc.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4b/gate/runt.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4b/gate/sand.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4b/gate/sane.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4b/gate/teff.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4b/gate/trim.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4b/gate/trip.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4b/gate/tuba.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4b/gate/tufa.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4b/gate/tuft.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4b/gate/turf.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4b/gate/wack.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4b/gate/wick.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4b/gate/woad.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4b/gate/wood.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4c/core/re.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4c/gate/show.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4d/gate/last.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4d/gate/lust.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4e/gate/bend.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4e/gate/comp.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4e/gate/fail.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4e/gate/glue.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4e/gate/less.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4e/gate/pfix.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4e/gate/plug.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4e/gate/pose.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4e/gate/sfix.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4e/gate/simu.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/bass.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/boss.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/cold.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/cook.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/easy.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/full.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/funk.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/here.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/ifix.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/jest.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/just.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/knee.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/mask.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/more.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/most.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/next.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/plus.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/sear.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/shim.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/slug.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/stag.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/star.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/stet.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/stew.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/stir.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4f/gate/stun.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4g/gate/rash.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4g/gate/rush.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4g/gate/rust.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4g/gate/scan.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/ace.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/bar.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/bas.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/buc.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/cab.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/cen.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/col.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/com.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/doq.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/dot.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/fas.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/gal.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/gar.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/hax.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/hep.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/kel.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/ker.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/ket.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/lus.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/pam.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/pat.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/pel.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/per.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/sel.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/sem.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/ser.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/sig.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/soq.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/tar.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/tec.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/tis.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/wut.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4h/gate/zap.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4j/core/ab.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4j/core/mu.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4j/core/ne.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/core/co.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/alf.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/aln.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/alp.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/bet.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/bin.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/but.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/cit.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/dem.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/dit.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/dog.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/doh.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/dun.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/duz.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/gah.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/gap.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/gaq.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/gaw.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/gay.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/gon.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/gul.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/hex.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/hig.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/hit.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/iny.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/low.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/mes.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/nix.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/nud.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/prn.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/qat.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/qit.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/qut.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/soz.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/sym.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/ven.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/vit.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4k/gate/vul.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4l/core/so.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4m/gate/scot.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4m/gate/scow.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4m/gate/slat.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4m/gate/slav.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4m/gate/slaw.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4m/gate/slay.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4m/gate/smyt.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4m/gate/spat.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4m/gate/spud.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4m/gate/stab.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4n/gate/mack.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4n/gate/mink.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4n/gate/mock.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4n/gate/mong.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4n/gate/mook.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4n/gate/mule.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4n/gate/mute.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/abel.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/aura.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/axis.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/base.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/bean.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/beer.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/beet.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/chum.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/coil.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/foot.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/limb.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/line.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/metl.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/nock.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/noun.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/null.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/port.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/span.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/tiki.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/toga.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/tone.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/tuna.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/tusk.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/twig.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/tyke.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/typo.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/tyre.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/vase.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/vise.md+2

This diff is too big to show here.

docs/system/hoon/library/src/4o/mold/wing.md+2

This diff is too big to show here.

docs/system/hoon/library/src/5f/mold/mane.md+2

This diff is too big to show here.

docs/system/hoon/library/src/5f/mold/manx.md+2

This diff is too big to show here.

docs/system/hoon/library/src/5f/mold/marl.md+2

This diff is too big to show here.

docs/system/hoon/library/src/5f/mold/mars.md+2

This diff is too big to show here.

docs/system/hoon/library/src/5f/mold/mart.md+2

This diff is too big to show here.

docs/system/hoon/library/src/5f/mold/marx.md+2

This diff is too big to show here.

docs/system/hoon/library/src/5f/mold/pass.md+2

This diff is too big to show here.

docs/system/hoon/library/src/5f/mold/ring.md+2

This diff is too big to show here.

docs/system/hoon/library/src/5f/mold/time.md+2

This diff is too big to show here.