diff --git a/arvo/ames.hoon b/arvo/ames.hoon index 91f9b0699..38905bfd4 100644 --- a/arvo/ames.hoon +++ b/arvo/ames.hoon @@ -1,5 +1,5 @@ -:: ames (4a), networking -!: +!: :: ames (4a), networking +:: |= pit=vase => =~ :: structures @@ -1433,7 +1433,7 @@ =+ bou=bust:puz =. bin ?. &(bou !oub) bin - :_(bin [%wine [our her] " not responding still trying"]) + :_(bin [%wine [our her] " not responding still crying"]) =. diz ?:((boom:puz now) (pode:diz now) diz) (busk xong:diz yem) :: diff --git a/arvo/batz.hoon b/arvo/batz.hoon index 753b52e27..b8ddeccec 100644 --- a/arvo/batz.hoon +++ b/arvo/batz.hoon @@ -1,6 +1,6 @@ +!: :: batz (4b), shell :: -:: |= pit=vase => =~ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::: diff --git a/arvo/clay.hoon b/arvo/clay.hoon index 351bc481d..3630a9112 100644 --- a/arvo/clay.hoon +++ b/arvo/clay.hoon @@ -1,3 +1,4 @@ +!: :: clay (4c), revision control !: |= pit=vase @@ -83,7 +84,7 @@ == :: ++ room :: fs per ship $: hun=duct :: terminal duct - hez=(unit duct) :: sync duch + hez=(unit duct) :: sync duct dos=(map desk dojo) :: native desk == :: ++ rove (each mood moot) :: stored request @@ -140,10 +141,10 @@ :: ~& [%aver-mun nao [%from syd lim q.mun]] ?~(nao ~ [~ (~(read-at-aeon ze lim dom ran) u.nao mun)]) :: - ++ balk :: read and send - |= [hen=duct oan=@ud mun=mood] + ++ balk :: read and send + |= [hen=duct yon=@ud mun=mood] ^+ +> - =+ vid=(~(read-at-aeon ze lim dom ran) oan mun) + =+ vid=(~(read-at-aeon ze lim dom ran) yon mun) ?~ vid (blub hen) (blab hen mun u.vid) :: ++ bait diff --git a/arvo/eyre.hoon b/arvo/eyre.hoon index 146dd90d4..488092ee1 100644 --- a/arvo/eyre.hoon +++ b/arvo/eyre.hoon @@ -1,4 +1,3 @@ -:: :: :: %eyre, http servant !? 164 :::: @@ -806,69 +805,11 @@ == :: ^= fac - 0w89.wgGV4.jAl90.00003.sV4OG.IJjfa.1vYpi.gRxB9.3m6kA.dopig. - RxB93.m6kAd.opigR.xB93m.6kAdo.pigRx.B93m6.kAdop.igRxB.93m6k. - Adopi.gRxBf.vGSfy.m8hQj.T-DiD.7kqvH.vEpA3.3vH-C.in~Tq.l8U0n. - 1FVhj.w9E1A.NIF6w.4j9v~.VZ0~B.9flkB.IY90B.-ieSV.Ky8Q~.4~07s. - JcXFC.DtI-1.GGz-1.V-olV.g3wsv.ZCQM1.BJbVj.Vwiv0.uo7Gh.4qsxA. - 92ZYU.tJ5uH.yiIzV.FwvJR.UUq6z.cpKIG.Hck9v.qGDm1.PY2rM.itxLB. - fn0Bo.5DO8x.oO7KE.kYh-P.NiKp1.HT88j.Mu3ZK.ciKsU.TnlkV.0Zo77. - 12ciy.nY3dM.7nDnY.GVgGh.ZllpO.SFHFb.p1Ae0.uUpXV.eqFvS.pkBRl. - jv0MP.ilRHP.1HwtK.GFptt.2KdpP.RsYqI.wRHEG.j~LZQ.I06qJ.fP0Pp. - 77qjo.s0PU0.rGGg6.lgNvc.~CZE~.bSp9j.EGHF~.UqYB6.l4Y~Z.P~GGE. - LwrJs.ZvYV-.U4Wh4.04dws.6HeuZ.2ZF7A.y4MN5.3vsCj.QHzjW.4lflk. - WU6X0.AmMws.vbMfB.3e1s~.aeE7W.0hQPH.ODvMf.cvgzb.Y15Ah.01384. - YwVPT.KzILB.PlaqN.pNlvw.fdQ79.~mPpo.YaHqw.fnWGB.QYM4F.w3E0b. - 0o~n-.faydD.zlllI.0nU3D.w5rlI.4nrSG.VkhPM.NTkpa.eoXzw.9AEYN. - auZGt.99gxL.8RlsI.aXMXX.tFVhX.V4kj8.yczjh.faRI3.JTg1H.-0uZM. - JA6rR.z0~pO.uXiSg.rvU27.A58MU.TBijQ.23F1J.CCIYE.IO8w-.cMlMA. - hvKh4.zY16M.gjRlk.v--9h.TNNRR.HhIGo.8kZXk.Wb74j.faHlk.6V-Vw. - jMan8.yb37R.Q2h42.Or3Nw.Pp39w.jZ--3.-jwZH.U~3Za.Uu0u6.bNAOP. - U2jux.Jqo2R.O8x1~.ecZvL.30ug~.qpoFw.vwtqD.Vb6EI.cZQyO.EN-xl. - nlsLC.dT099.apOh5.SEeDz.07-GE.xFzZk.KcmCl.SJWF5.v3u1x.Uq1Cj. - tV~hG.YuGGb.SgpdR.xHaBh.S3eEv.q0mSg.RZh8s.wxhnk.EcNvW.GccZQ. - yO0Jb.n18hs.BLFx2.iigqf.AhsKS.LWqby.TUEmv.gmmhR.6DW3w.uLR0Y. - QQBC8.YoQ63.g8m8i.iq3B-.SxwLn.jLbh3.l7cq3.eVQmV.5O2df.SXBkv. - Y3LLb.denQq.GvR0R.P3Gh4.2iiq2.h-srW.o0ZZ-.HIrdj.npm5n.pnv07. - vyT77.43WGP.Bciiq.zt1cI.7A4xB.zK9xm.-tV6x.ZdA6P.pheXQ.aSz4X. - Zj2bS.C1UPx.~c1dS.xwF3b.6jZ-M.WI2eQ.e69Qw.DGFly.tTze-.GGbZU. - qJ-m-.fD8yI.Adktz.oqTsF.F7ltA.6no6T.~fWJU.0gRsp.-P88x.a9I9b. - Adkvz.ory8J.Ouhfu.H8c-U.2HLgE.Wi4xH.3AEGK.VjkS-.Z5hMx.UN5o~. - Y~EWp.7LGox.IQxpt.cgONH.CEyKJ.jjTdM.GJ9HL.RloJZ.xuRtL.JZ7jg. - ZZj6w.2AOoM.CENdS.xxegZ.RzTdh.i-1hZ.N1HPF.EqHU0.XzN6K.mBedG. - uvBiL.HqpmY.Bl9z2.qzqA8.WzKqz.h~S1J.K2QHQ.Dy-CM.7RO0l.QksW3. - mpFnx.fy-Pa.p7xhW.SboOd.fOBon.mCgSX.Z38Qe.dMHUC.79wje.wziG5. - 6Xtn7.ksEHO.xkBrO.e7yFe.vNaYx.FgDsI.BS9y8.AELs-.C9-DB.FAZI-. - wKt2N.8qQhA.Apxm7.O5yIB.X51l9.Kduxm.SRA5N.UYi6I.MrySX.RZXrT. - 8UcY2.zUAfu.SOcUK.vZrDL.vBAHb.eOo~N.7J3sR.eJhSo.4~YE1.5k0h5. - 51RqS.b0jyR.RfhON.4Dt07.idahL.5isLK.eeBv3.znQxC.9LXkE.xKghP. - Ia-R0.AgmB5.pGGIA.slCGu.CtR5q.NrzHh.1bscz.8CsWC.KH4it.LLrWm. - UlRdr.lUGji.W76xr.kVAmO.6oAYS.7nXX~.kfeM2.TSS2m.JOCAb.sFFWg. - 4xH3C.MDKh4.FZso1.tXwUJ.Taq5K.8yS24.xHr4M.Kvu~E.HTpka.-Zg3f. - KEXFS.qCKwh.l1KRN.c9H8A.HFcSw.rePCF.Iy93m.njkMZ.IEyiq.lFq3y. - gRFzg.uL9tz.zP8du.Y1ZWP.PtQ6G.gzIt5.K8hNz.UAdpM.Q43L6.IMHx5. - N8qPh.EfX8G.UC~68.S93ms.d18Vh.adkOx.GLkTI.khFcL.ZWG5G.Adoeh. - hx~As.hci6I.Uq2pG.ykqHO.yUAdq.gQ7FD.4sOjn.IwGGw.UAdqo.Q4jVN. - eJP8c.xQlm~.8nJ1y.gRF3g.oSPAM.fuqE0.M~23y.gRHyo.gngjF.ceM3n. - V~uQy.93m-9.xa-3N.T80~v.GzR-g.HqBGA.mi4xH.3AMOL.mCjT5.Blqab. - 60ruw.HDV~k.Tj~fX.Swx8u.ZFOoi.m1GUF.Gs4-q.0kfxh.H8yjt.OCXGL. - PYGTY.23LgI.Wl4x6.8bI3e.MXeVb.h6rL9.DXWyt.8wJ8W.HalWR.itqp3. - pkrSC.8bQSM.HLV2J.G7sCj.QtGEi.AkSwI.A4P0J.gJ85j.MuMUY.nkT45. - -rkqv.BFBFU.KGd98.qRs~A.iblOv.mVKWx.Z19cs.AxHc6.UIKJc.NIHW8. - EnOEy.fygRG.29bbR.FBDVL.Ter6T.SBKat.MFBPE.AfuO9.kBHV~.QstE-. - VaYNV.qpfhL.sFHj0.eFphG.U6Hw6.EsVox.7kpks.N6bRk.GMLY~.HWBVj. - Snx6X.0GY2b.GhzmW.udfRF.jTgLC.uPWGL.fIwM6.16Ah4.NFZjz.Ftln7. - KQ-k-.0SO8H.xrqcw.MXZG9.6BZsJ.zULJU.NPDy3.aewMa.3auiA.Ysei3. - YQJGB.PlCAQ.S5YPU.uGEtI.wQrw1.cy8Sd.bFYuX.GGWZS.DSq1Y.O8ELq. - cR6kA.dopig.RxB93.m6kAd.opigR.xB93m.6kAdo.pigRx.B93m6.kAdop. - igRxB.93m6k.Adopi.gRxB9.3m6kA.doSsI.1Tves.7Fb5l.hneus.VDLsZ. - ~P3DD.D~CpI.BALPA.rxSTT.fuXa4.gP3Yv.sPKOY.KSMKP.balqk.xjbEH. - idkbq.Elo0N.dHjkM.vEBiq.BC-Rb.IKMiB.JiaoS.x3mLy.Jr6P5.ToiS2. - gAz4y.qNHiI.k7WIl.9EJGb.iJ2Tp.NQ5H5.VpSni.By-OX.TfvYs.plRic. - rpPJD.7xkgk.h9BMw.001EY.XFJDs.CYKpn.1xoTd.HrCAK.tTtT0.6lOon. - tQpCZ.jt5x5.t1A00.01UCO.x20ts.d003n.3g00s.RB8s0.A0002.8p0xY. - 20w82.5h9gD.c4000.0l9ny.s0000.0o8p0.0006g.0001i.h4x93.g0000. - Eq2wR.7jB29 + 0w89wg.GV4jA.l9000.00dPb.YzBT6.giO00.o100d.wZcqc.a9tg-.VTG0b. + AUIvE.HBM3g.cK4SE.0aagi.l090p.I1P5g.Y-80r.y1YS9.1xE~Y.qgpFY. + vKN1V.905y0.2UwvL.43TUw.uL406.0-31h.xwoJF.Ul454.ilk00.00Yps. + BNumh.xpl9B.pS5Ji.i1BoC.ZAgg1.BsC5T.t6pLk.Thohn.gp000.0ov~P. + 7M000.0o840.00010.0001i.h4x93.g0000.Eq2wR.7jB29 == :: ++ huff :: request by ship diff --git a/arvo/ford.hoon b/arvo/ford.hoon index 06146ae12..a75ba3b04 100644 --- a/arvo/ford.hoon +++ b/arvo/ford.hoon @@ -1,4 +1,4 @@ -:::::: +!::::: :: :: %ford, new execution control !? 164 :::: @@ -804,7 +804,8 @@ |= [cof=cafe vax=vase gen=twig] =+ puz=(mule |.((~(mint ut p.vax) [%noun gen]))) ?- -.puz - | (flaw cof p.puz) + | ~& [%maim-fail p.puz] + (flaw cof p.puz) & %+ (coup cof) (mock [q.vax q.p.puz] (mole ska)) |= val=* `vase`[p.p.puz val] diff --git a/arvo/gall.hoon b/arvo/gall.hoon index d234971f7..67a7831a1 100644 --- a/arvo/gall.hoon +++ b/arvo/gall.hoon @@ -592,7 +592,7 @@ ^- lens ?~ huv.sat *lens =+ gat=(slap u.huv.sat [%cnzy %peek]) - =+ cor=(slam gat !>(pax)) + =+ cor=(slam gat !>([our pax])) =+ ^= dek |* fun=$+(vase *) |= nam=@tas diff --git a/arvo/hoon.hoon b/arvo/hoon.hoon index 19591e425..0835b79bb 100644 --- a/arvo/hoon.hoon +++ b/arvo/hoon.hoon @@ -31,11 +31,11 @@ ++ bean ,? :: 0=&=yes, 1=|=no ++ beer $|(@ [~ p=twig]) :: simple embed ++ beet $| @ :: advanced embed - $% [%a p=twig] :: - [%b p=twig] :: - [%c p=twig] :: - [%d p=twig] :: - [%e p=twig q=(list tuna)] :: + $% [%a p=twig] :: take tape + [%b p=twig] :: take manx + [%c p=twig] :: take marl + [%d p=twig] :: take $+(marl marl) + [%e p=twig q=(list tuna)] :: element literal == :: ++ bloq ,@ :: blockclass ++ calf ,[p=(map ,@ud wine) q=wine] :: @@ -49,8 +49,8 @@ [std=term kel=@] :: kelvin version [ven=term pro=term kel=@] :: vendor and product [ven=term pro=term ver=@ kel=@] :: all of the above - == :: -++ clue ,[p=axis q=chum r=tyre] :: battery definition + == +++ clue ,[p=chum q=nock r=(list (pair term nock))] :: battery definition ++ coil $: p=?(%gold %iron %lead %zinc) :: core type q=type :: r=[p=?(~ ^) q=(map term foot)] :: @@ -154,8 +154,8 @@ p=[p=tape q=tape r=tape s=tape] :: q=(list tank) :: == :: - $: %rose :: - p=[p=tape q=tape r=tape] :: + $: %rose :: delimeted list + p=[p=tape q=tape r=tape] :: mid open close q=(list tank) :: == :: == @@ -341,19 +341,19 @@ [%10 p=?(@ [p=@ q=nock]) q=nock] :: hint [%11 p=nock] :: grab data from sky == :: -++ tone $% [%0 p=*] :: - [%1 p=(list)] :: - [%2 p=(list ,[@ta *])] :: +++ tone $% [%0 p=*] :: success + [%1 p=(list)] :: blocks + [%2 p=(list ,[@ta *])] :: error ~_s == :: -++ toon $% [%0 p=*] :: - [%1 p=(list)] :: - [%2 p=(list tank)] :: +++ toon $% [%0 p=*] :: success + [%1 p=(list)] :: blocks + [%2 p=(list tank)] :: stack trace == :: ++ tune $% [%0 p=vase] :: [%1 p=(list)] :: [%2 p=(list ,[@ta *])] :: == :: -++ twin ,[p=term q=wing r=axis s=type] :: +++ twin ,[p=term q=wing r=axis s=type] :: alias info ++ type $| ?(%noun %void) :: set all or set none $% [%atom p=term] :: number and format [%bull p=twin q=type] :: wing synonym @@ -418,7 +418,7 @@ ++ wonk |*(veq=edge ?~(q.veq !! p.u.q.veq)) :: :: :: :: :: -++ map |* [a=_,* b=_,*] :: associative array +++ map |* [a=_,* b=_,*] :: associative tree $|(~ [n=[p=a q=b] l=(map a b) r=(map a b)]) :: ++ qeu |* a=_,* :: queue $|(~ [n=a l=(qeu a) r=(qeu a)]) :: @@ -812,13 +812,6 @@ +<-(+ $(+<- +<->)) -- :: -++ wild :: concatenate - |* [a=(list) b=(list)] - => .(a ^.(homo a), b ^.(homo b)) - |- - ?~ a b - [i=i.a $(a t.a)] -:: ++ zing :: promote =| * |% @@ -1141,23 +1134,25 @@ /remlysfynwerrycsugnysnyllyndyndemluxfedsedbecmun\ /lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes' |% - ++ ind ~/ %ind + ++ ind ~/ %ind :: parse prefix |= a=@tas =+ b=0 |- ^- (unit ,@) ?:(=(256 b) ~ ?:(=(a (tod b)) [~ b] $(b +(b)))) - ++ ins ~/ %ins + ++ ins ~/ %ins :: parse suffix |= a=@tas =+ b=0 |- ^- (unit ,@) ?:(=(256 b) ~ ?:(=(a (tos b)) [~ b] $(b +(b)))) - ++ tod ~/(%tod |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] dex)))) - ++ tos ~/(%tos |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] sis)))) + ++ tod ~/ %tod :: fetch prefix + |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] dex))) + ++ tos ~/ %tos :: fetch suffix + |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] sis))) -- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: section 2cF, signed and modular ints :: :: -++ si :: signed integer +++ si !: :: signed integer |% ++ abs |=(a=@s (add (end 0 1 a) (rsh 0 1 a))) :: absolute value ++ dif |= [a=@s b=@s] :: subtraction @@ -1206,9 +1201,9 @@ -- ++ fe :: modulo bloq |_ a=bloq - ++ dif |=([b=@ c=@] (sit (sub (add out (sit b)) (sit c)))) - ++ inv |=(b=@ (sub (dec out) (sit b))) - ++ net |= b=@ ^- @ + ++ dif |=([b=@ c=@] (sit (sub (add out (sit b)) (sit c)))) :: difference + ++ inv |=(b=@ (sub (dec out) (sit b))) :: inverse + ++ net |= b=@ ^- @ :: flip byte endianness => .(b (sit b)) ?: (lte a 3) b @@ -1216,19 +1211,19 @@ %+ con (lsh c 1 $(a c, b (cut c [0 1] b))) $(a c, b (cut c [1 1] b)) - ++ out (bex (bex a)) - ++ rol |= [b=bloq c=@ d=@] ^- @ + ++ out (bex (bex a)) :: mod value + ++ rol |= [b=bloq c=@ d=@] ^- @ :: roll left =+ e=(sit d) =+ f=(bex (sub a b)) =+ g=(mod c f) (sit (con (lsh b g e) (rsh b (sub f g) e))) - ++ ror |= [b=bloq c=@ d=@] ^- @ + ++ ror |= [b=bloq c=@ d=@] ^- @ :: roll right =+ e=(sit d) =+ f=(bex (sub a b)) =+ g=(mod c f) (sit (con (rsh b g e) (lsh b (sub f g) e))) - ++ sum |=([b=@ c=@] (sit (add b c))) - ++ sit |=(b=@ (end a 1 b)) + ++ sum |=([b=@ c=@] (sit (add b c))) :: wrapping add + ++ sit |=(b=@ (end a 1 b)) :: enforce modulo -- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: section 2cG, floating point :: @@ -1770,31 +1765,32 @@ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: section 2cI, almost macros :: :: -++ cury +++ cury :: curry left |* [a=_|=(^ **) b=*] |* c=_+<+.a (a b c) :: -++ curr +++ curr :: curry right |* [a=_|=(^ **) c=*] |* b=_+<+.a (a b c) :: -++ cork |*([a=_,* b=gate] (corl b a)) +++ cork |*([a=_,* b=gate] (corl b a)) :: compose forward :: -++ corl +++ corl :: compose backwards |* [a=gate b=_,*] - |= c=_+<.b + =< +:|.((a (b))) :: type check + |* c=_+<.b (a (b c)) :: -++ hard +++ hard :: force coerce to type |* han=$+(* *) |= fud=* ^- han ~| %hard =+ gol=(han fud) ?>(=(gol fud) gol) :: -++ soft +++ soft :: maybe coerce to type |* han=$+(* *) |= fud=* ^- (unit han) =+ gol=(han fud) @@ -2484,9 +2480,7 @@ [zac [~ i.q.tub [zac t.q.tub]]] :: ++ sear :: conditional cook - ~/ %sear |* [pyq=_|=(* *(unit)) sef=_rule] - ~/ %fun |= tub=nail =+ vex=(sef tub) ?~ q.vex @@ -2583,9 +2577,7 @@ [(last p.vex p.wag) [~ (raq p.u.q.vex p.u.q.wag) q.u.q.wag]] :: ++ stun :: parse several times - ~/ %stun |* [[les=@ mos=@] fel=_rule] - ~/ %fun |= tub=nail ^- (like (list ,_(wonk (fel)))) ?: =(0 mos) @@ -2816,16 +2808,17 @@ ;~(less bas soq prn) ;~(pfix bas ;~(pose bas soq mes)) :: escape chars == -++ qut ;~ pose :: cord +++ qut ;~ simu soq :: cord + ;~ pose ;~ less soqs (ifix [soq soq] (boss 256 (more gon qit))) == + =+ hed=;~(pose ;~(plug (plus ace) vul) (just '\0a')) %- inde %+ ifix - :- ;~ plug soqs - ;~(pose ;~(plug (plus ace) vul) (just '\0a')) - == + :- ;~(plug soqs hed) ;~(plug (just '\0a') soqs) (boss 256 (star qat)) + == == :: ++ soqs ;~(plug soq soq soq) :: delimiting ''' @@ -3431,7 +3424,6 @@ rex :- '.' =>(.(rex $(esc t.esc)) ((x-co 4) i.esc)) - :: ++ v-co |=(min=@ (em-co [32 min] |=([? b=@ c=tape] [~(v ne b) c]))) ++ w-co |=(min=@ (em-co [64 min] |=([? b=@ c=tape] [~(w ne b) c]))) @@ -3439,10 +3431,8 @@ ++ y-co |=(dat=@ ((d-co 2) dat)) ++ z-co |=(dat=@ `tape`['0' 'x' ((x-co 1) dat)]) -- - ~% %co +> ~ |% ++ em-co - ~/ %emco |= [[bas=@ min=@] [par=$+([? @ tape] tape)]] |= hol=@ ^- tape @@ -3456,7 +3446,6 @@ == :: ++ ox-co - ~/ %oxco |= [[bas=@ gop=@] dug=$+(@ @)] %+ em-co [|-(?:(=(0 gop) 1 (mul bas $(gop (dec gop))))) 0] @@ -3469,7 +3458,6 @@ |=([? b=@ c=tape] [(dug b) c]) :: ++ ro-co - ~/ %roco |= [[buz=@ bas=@ dop=@] dug=$+(@ @)] |= hol=@ ^- tape @@ -4656,7 +4644,7 @@ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: section 2eW, lite number theory :: :: -++ egcd :: schneier's egcd +++ egcd !: :: schneier's egcd |= [a=@ b=@] =+ si =+ [c=(sun a) d=(sun b)] @@ -5265,7 +5253,7 @@ |= [who=@p wud=@] (shas (mix %shak who) wud) :: -++ sham :: noun hash +++ sham :: 128bit noun hash |= yux=* ^- @uvH ^- @ ?@ yux (shaf %mash yux) @@ -8397,6 +8385,7 @@ ++ hasp ;~ pose (ifix [sel ser] wide) (stag %cnhp (ifix [pel per] (most ace wide))) + (stag %dtzy (stag %t qut)) %+ cook |=(a=coin [%dtzy ?:(?=([~ %tas *] a) %tas %ta) ~(rent co a)]) nuck:so @@ -8772,7 +8761,7 @@ (stag %dtzz (stag %tas (cold %$ buc))) (stag %dtzz (stag %f (cold & pam))) (stag %dtzz (stag %f (cold | bar))) - (stag %dtzz (stag %ta qut)) + (stag %dtzz (stag %t qut)) (cook (jock &) nuck:so) (cook |=(a=(list) [%clsg (posh ~ ~ (lent a) ~)]) (star cen)) :: (easy [%clsg (poof wer)]) @@ -9396,7 +9385,7 @@ (stag %leaf (stag %tas (cold %$ buc))) (stag %leaf (stag %f (cold & pam))) (stag %leaf (stag %f (cold | bar))) - (stag %leaf (stag %ta qut)) + (stag %leaf (stag %t qut)) %+ cook |= lot=coin ^- tile ?- -.lot @@ -9476,6 +9465,86 @@ |= txt=@ta ^- twig (rash txt wide:vast) +:::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::: :::::: profiling support; move me :::::: +:::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: +++ doss + $: sap=@ud :: sample count + hit=(map term ,@ud) :: hit points + cut=(map span hump) :: cut points + == +:: +++ hump + $: sap=@ud :: sample count + inn=(map span ,@ud) :: calls into + out=(map span ,@ud) :: calls out of + == +:: +++ pi-heck + |= [nam=@tas day=doss] + ^- doss + =+ lam=(~(get by hit.day) nam) + day(hit (~(put by hit.day) nam ?~(lam 1 +(u.lam)))) +:: +++ pi-noon :: sample trace + |= [pax=path day=doss] + =| lax=(unit span) + |- ^- doss + ?~ pax day(sap +(sap.day)) + %= $ + pax t.pax + lax `i.pax + cut.day + %+ ~(put by cut.day) i.pax + ^- hump + =+ nax=`(unit span)`?~(t.pax ~ `i.t.pax) + =+ hup=`hump`=+(hup=(~(get by cut.day) i.pax) ?^(hup u.hup [0 ~ ~])) + :+ +(sap.hup) + ?~ lax inn.hup + =+ hag=(~(get by inn.hup) u.lax) + (~(put by inn.hup) u.lax ?~(hag 1 +(u.hag))) + ?~ nax out.hup + =+ hag=(~(get by out.hup) u.nax) + (~(put by out.hup) u.nax ?~(hag 1 +(u.hag))) + == +:: +++ pi-tell :: produce dump + |= day=doss + ^- (list tape) + ;: welp + [(welp "events: " (scow %ud sap.day)) ~] + :: + %+ turn + (~(tap by hit.day) ~) + |= [nam=term num=@ud] + :(welp (trip nam) ": " (scow %ud num)) + ["" ~] + :: + %- zing + ^- (list (list tape)) + %+ turn + (~(tap by cut.day) ~) + |= [nam=term hup=hump] + ;: welp + [(welp "sector: " (trip nam)) ~] + [(welp "weight: " (scow %ud (div (mul 1.000 sap.hup) sap.day))) ~] + ["inn:" ~] + :: + %+ turn + (~(tap by inn.hup) ~) + |= [nam=term num=@ud] + ^- tape + :(welp " " (trip nam) ": " (scow %ud num)) + :: + ["out:" ~] + :: + %+ turn + (~(tap by out.hup) ~) + |= [nam=term num=@ud] + ^- tape + :(welp " " (trip nam) ": " (scow %ud num)) + == + == -- :::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::: :::::: volume 3, Arvo models and skeleton :::::: @@ -9522,7 +9591,7 @@ a :: == :: ++ kirk (unit (set monk)) :: audience -++ khan ,[p=@tas q=path] :: foreign identity +++ khan ,[p=@tas q=@ta] :: foreign identity ++ lens :: observation core $_ ^? :: |% ++ u *(unit (unit ,~)) :: existence @@ -9723,6 +9792,7 @@ bed=beam == ^- (unit (unit cage)) + :: ~& [%arvo-scry ren bed] =+ ^= old :* fur ren @@ -9903,6 +9973,7 @@ :::::: :::::: Postface :::::: :::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: !: +~& %post-start =+ pit=`vase`!>(.) :: =+ bud=pit :: becomes tang =+ vil=(viol p.bud) :: cached reflexives diff --git a/arvo/jael.hoon b/arvo/jael.hoon new file mode 100644 index 000000000..74c1d4c3d --- /dev/null +++ b/arvo/jael.hoon @@ -0,0 +1,86 @@ +:: %jael, secret storage +:: +:::: /hoon/jael + :: +!? 164 +:::: +:: %jael is logically homogeneous, but please follow these conventions: +:: +:: /cap :: foreign app keys +:: /service :: service name, eg %face +:: /appid :: your ship's app-id +:: /@uvH :: by hash +:: /@ud :: by number +:: /@tas :: by name +:: +:: /key :: foreign user secrets +:: /service :: service name, eg %face +:: /userid :: user identity +:: +:: /urb :: urbit secrets +:: /tok/hash + +|= pit=vase +=> =~ +:: structures +|% +++ axle :: %jael state + $: %0 :: + ent=@uwH :: entropy + all=(map ship ,[p=@ q=safe]) :: entropy, secrets + == :: +++ mast $: ent=@ + +++ mort ,[p=@da q=duct r=@] :: a mortal secret +++ gift :: out result <-$ + $% [%done p=path q=@] :: key expired + == :: +++ kiss :: in request ->$ + $% [%kill p= + [%drop p=@p q=path r=@] :: discard key + [%junk p=@] :: add entropy + [%show p=@p q=path] :: read subtree + [%tell p=@ q=path r=@da s=@] :: save key + == :: +++ safe ,[p=(unit ,@) q=(map ,@ta safe)] :: secret tree +++ move ,[p=duct q=[%give p=gift]] :: local move +-- :: +. == +=| axle +=* lex - +|= [now=@da eny=@ ski=sled] :: activate +^? :: opaque core +|% :: +++ call :: request + |= [hen=duct hic=(hypo (hobo kiss))] + ^- [p=(list move) q=_..^$] + => .(q.hic ?.(?=(%soft -.q.hic) q.hic ((hard kiss) p.q.hic))) + !! +:: +++ doze + |= [now=@da hen=duct] + ^- (unit ,@da) + ~ +:: +++ load :: highly forgiving + |= old=* + =+ lox=((soft axle) old) + ^+ ..^$ + ?~ lox + ~& %jael-reset + ..^$ + ..^$(+>- u.lox) +:: +++ scry + |= [fur=(unit (set monk)) ren=@tas who=ship syd=desk lot=coin tyl=path] + ^- (unit (unit (pair mark ,*))) + :: actually scry + ~ +:: +++ stay :: save w/o cache + `axle`+>-.$(pol (~(run by pol) |=(a=baby [tad.a dym.a ~]))) +:: +++ take :: response + |= [tea=wire hen=duct hin=(hypo noun)] + !! +-- diff --git a/arvo/kahn.hoon b/arvo/kahn.hoon new file mode 100644 index 000000000..b6b2cfae3 --- /dev/null +++ b/arvo/kahn.hoon @@ -0,0 +1,99 @@ +:: %kahn, social state +:: +:::: /hoon/kahn + :: +!? 164 +:::: +|= pit=vase +=> =~ +:: structures +|% +++ axle :: %kahn state + $: %0 :: + big=(unit ship) :: main ship, freeze + soc=(map monk node) :: state once big + == :: +++ cert (each will ,*) :: urbit or other +++ gift :: out result <-$ + $: [%then p=node] :: propagate change + == :: +++ node :: social identity + $: tin=(map monk link) :: inbound links + oud=(map monk link) :: outbound links + cet=cert :: certificate + == :: +++ kiss :: social update + $: [%that p=monk q=(map monk link)] :: set links + [%this p=monk q=cert] :: set certificate + == :: +++ link (pair rank ,@da) :: trust/expiration +++ rank :: privilege ring + $? %0 :: owner / admin + %1 :: guardian / employer + %2 :: partner / employee + %3 :: friend / customer + %4 :: neighbor/ contact + %5 :: zombie + == :: +-- :: +. == +=| axle +=* lex - +|= [now=@da eny=@ ski=sled] :: activate +^? :: opaque core +|% :: +++ call :: request + |= [hen=duct hic=(hypo (hobo kiss))] + ^- [p=(list move) q=_..^$] + => .(q.hic ?.(?=(%soft -.q.hic) q.hic ((hard kiss) p.q.hic))) + !! +:: +++ doze + |= [now=@da hen=duct] + ^- (unit ,@da) + ~ +:: +++ load :: highly forgiving + |= old=* + =+ lox=((soft axle) old) + ^+ ..^$ + ?~ lox + ~& %lunt-reset + ..^$ + ..^$(+>- u.lox) +:: +++ scry + |= [fur=(unit (set monk)) ren=@tas who=ship syd=desk lot=coin tyl=path] + ^- (unit (unit (pair mark ,*))) + ?. =(big [~ who]) ~ + =+ ^= yub ^- [(unit monk) + ?: =(%urb syd) + ?. ?=([* ~] tyl) ~ + =+ goy=(slaw %p + + ?+ ?=([%$ %da @] + ?+ lot ~ + [%$ %ud @] + %+ bind + (perm who u.hun q.p.lot [syd t.tyl]) + |=(a=* [%noun a]) + :: + ?. =(now q.p.lot) ~ + %+ bind + (temp who u.hun [syd t.tyl]) + |=(a=* [%noun a]) + == + ?. ?=([%da + =+ mok ^- (unit monk) + ?: =(%urb face) + ( + +:: +++ stay :: save w/o cache + `axle`+>-.$ +:: +++ take :: response + |= [tea=wire hen=duct hin=(hypo noun)] + !! +-- + diff --git a/arvo/lunt.hoon b/arvo/lunt.hoon new file mode 100644 index 000000000..3caf840ec --- /dev/null +++ b/arvo/lunt.hoon @@ -0,0 +1,103 @@ +:: %lunt, fleet job control +:: +:::: /hoon/lunt + :: +!? 164 +:::: +|= pit=vase +=> =~ +:: structures +|% +++ axle :: %lunt state + $: %0 :: + all=(map ship axil) :: state by owner + == :: +++ born ,[p=brat q=(unit ship)] :: task identity +++ brat ,@ud :: task number +++ bulb :: + $: p=@p :: ship identity + q=home :: server data + == :: +++ home :: storage access + $: pad=@uvH :: passcode + huc=husk :: log server + sog=hulk :: storage server + == :: +++ hulk :: checkpoint service + $% [%astr p=@ud q=@ud] :: S3 + == :: +++ husk :: log server + $: pro=@tas :: protocol + cap=@uvH :: access code + srv=(list (pair ,@ud clip)) :: server cluster + == :: +++ gift :: result + $: [%die p=brat] :: kill + [%int p=brat] :: interrupt + [%run p=brat q=@p r=home] :: load + [%say p=brat q=(list ovum)] :: send events + [%new p=brat q=@p r=home s=(list ovum)] :: create + == :: +++ kiss :: request + $: [%com p=@p] :: toggle compute svr + [%end p=brat] :: local end + [%fan p=@ud] :: set local fanout + [%kil ~] :: terminate ship + [%int ~] :: interrupt ship + [%new p=@p q=(set ,@p) q=home r=@uvI] :: create ship + [%run p=@p q=home] :: run existing ship + [%say p=(list ovum)] :: remote events + [%sto p=husk] :: toggle logger + == :: +++ axil :: + $: bus=(unit ,@p) :: master + loc=@ud :: local resources + hen=(unit duct) :: effect duct + ent=@ :: entropy + seq=@ :: brat sequence + why=(map duct born) :: hosted ships + how=(map born duct) :: reverse why + hut=(map born home) :: storage control + sto=(set husk) :: storage resources + com=(set ship) :: compute resources + == :: +-- :: +. == +=| axle +=* lex - +|= [now=@da eny=@ ski=sled] :: activate +^? :: opaque core +|% :: +++ call :: request + |= [hen=duct hic=(hypo (hobo kiss))] + ^- [p=(list move) q=_..^$] + => .(q.hic ?.(?=(%soft -.q.hic) q.hic ((hard kiss) p.q.hic))) + !! +:: +++ doze + |= [now=@da hen=duct] + ^- (unit ,@da) + ~ +:: +++ load :: highly forgiving + |= old=* + =+ lox=((soft axle) old) + ^+ ..^$ + ?~ lox + ~& %lunt-reset + ..^$ + ..^$(+>- u.lox) +:: +++ scry + |= [fur=(unit (set monk)) ren=@tas who=ship syd=desk lot=coin tyl=path] + ^- (unit (unit (pair mark ,*))) + ~ +:: +++ stay :: save w/o cache + `axle`+>-.$ +:: +++ take :: response + |= [tea=wire hen=duct hin=(hypo noun)] + !! +-- + diff --git a/arvo/musk.hoon b/arvo/musk.hoon new file mode 100644 index 000000000..03dfda150 --- /dev/null +++ b/arvo/musk.hoon @@ -0,0 +1,94 @@ +:: %musk, realm management +:: +:::: /hoon/musk + :: +!? 164 +:::: +|= pit=vase +=> =~ +:: structures +|% +++ axle :: %musk state + $: %0 :: + all=(map ship axil) :: state by owner + == :: +++ axil :: + $: kid=(map ship girl) :: daughters + deq=(map narc ship) :: reverse address + siq=(map ship (list clan)) :: ship to clans + kes=(map clan (list ship)) :: clan to ships + == :: +++ clan ,@tas :: group identity +++ narc :: contact address + $: [%$ p=ship] :: urbit + [%m p=@t q=@t] :: email p@q + [%f p=@t] :: facebook + [%g p=@t] :: google + [%p p=@t] :: phone message + [%t p=@t] :: twitter + == :: +++ pony :: daughter status + $% [%cold ~] :: virginal + [%dead ~] :: written off + [%fake ~] :: virtual + [%free ~] :: downloaded + [%here ~] :: hosted + [%left p=(unit ship)] :: run away to + == :: +++ rank :: relative privilege + $? %0 :: enemy + %1 :: neighbor + %2 :: guest/customer + %3 :: friend/employee + %4 :: officer/family + %5 :: self/admin + == :: +++ girl :: + $: hop=pony :: status + tag=(unit ,@tas) :: petname + tip=rank :: rank + fig=(set narc) :: identities + loc=(unit ,[p=@da q=@ud r=clip]) :: last position + sym=(set ,[p=@ q=@uvH]) :: symmetric keys? + wyl=will :: crypto will + == :: +-- :: +. == +=| axle +=* lex - +|= [now=@da eny=@ ski=sled] :: activate +^? :: opaque core +|% :: +++ call :: request + |= [hen=duct hic=(hypo (hobo kiss))] + ^- [p=(list move) q=_..^$] + => .(q.hic ?.(?=(%soft -.q.hic) q.hic ((hard kiss) p.q.hic))) + !! +:: +++ doze + |= [now=@da hen=duct] + ^- (unit ,@da) + ~ +:: +++ load :: highly forgiving + |= old=* + =+ lox=((soft axle) old) + ^+ ..^$ + ?~ lox + ~& %lunt-reset + ..^$ + ..^$(+>- u.lox) +:: +++ scry + |= [fur=(unit (set monk)) ren=@tas who=ship syd=desk lot=coin tyl=path] + ^- (unit (unit (pair mark ,*))) + ~ +:: +++ stay :: save w/o cache + `axle`+>-.$ +:: +++ take :: response + |= [tea=wire hen=duct hin=(hypo noun)] + !! +-- + diff --git a/arvo/test.hoon b/arvo/test.hoon deleted file mode 100644 index ab7bd592d..000000000 --- a/arvo/test.hoon +++ /dev/null @@ -1,24 +0,0 @@ -?> ?=([@ @] .) -%. . -|= [x=@ y=@] -=- (add:all x y) -^= all -=> %164 -~% %k164 ~ ~ -|% -++ add - ~/ %add - |= [a=@ b=@] - ^- @ - ?: =(0 a) b - $(a (dec a), b +(b)) -:: -++ dec - ~/ %dec - |= a=@ - ?< =(0 a) - =+ b=0 - |- ^- @ - ?: =(a +(b)) b - $(b +(b)) --- diff --git a/arvo/zuse.hoon b/arvo/zuse.hoon index d159e3c10..d1cee07db 100644 --- a/arvo/zuse.hoon +++ b/arvo/zuse.hoon @@ -41,7 +41,7 @@ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: section 3bB, cryptosuites :: :: -++ crua :: cryptosuite A (RSA) +++ crua !: :: cryptosuite A (RSA) ^- acru =| [mos=@ pon=(unit ,[p=@ q=@ r=[p=@ q=@] s=_*fu])] => |% @@ -1009,9 +1009,10 @@ %indirect p.p == :: -++ ze +++ ze !: |_ [lim=@da dome rang] ++ aeon-to-tako ~(got by hit) + ++ aeon-to-yaki (cork aeon-to-tako tako-to-yaki) ++ make-yaki :: make yaki |= [p=(list tako) q=(map path lobe) t=@da] ^- yaki @@ -1082,17 +1083,16 @@ ((diff (blob-to-umph (lobe-to-blob u.leb))) zeq zoq) :: ++ lobes-at-path :: lobes-at-path:ze - |= [oan=aeon pax=path] :: data at path + |= [yon=aeon pax=path] :: data at path ^- (map path lobe) - ?: =(0 oan) ~ + ?: =(0 yon) ~ %- mo %+ skim %. ~ %~ tap by =< q - %- tako-to-yaki - %- aeon-to-tako - oan + %- aeon-to-yaki + yon |= [p=path q=lobe] ?| ?=(~ pax) ?& !?=(~ p) @@ -1110,8 +1110,7 @@ ?: =(0 let) [~ 0] :: avoid underflow ?: %+ gte p.lok =< t - %- tako-to-yaki - %- aeon-to-tako + %- aeon-to-yaki let [~ let] $(let (dec let)) @@ -1221,11 +1220,11 @@ == :: ++ rewind :: rewind:ze - |= oan=aeon :: rewind to aeon + |= yon=aeon :: rewind to aeon ^+ +> - ?: =(let oan) +> - ?: (gth oan let) !! :: don't have version - +>(ank (checkout-ankh q:(tako-to-yaki (aeon-to-tako oan))), let oan) + ?: =(let yon) +> + ?: (gth yon let) !! :: don't have version + +>(ank (checkout-ankh q:(aeon-to-yaki yon)), let yon) :: :::: ++ update-lat :: update-lat:ze @@ -1245,16 +1244,15 @@ ?: =(let 0) :: initial commit ~ :: has nothing =< q - %- tako-to-yaki - %- aeon-to-tako + %- aeon-to-yaki let - %- |= bar=(map path blob) :: find unchanged - =+ sar=(sa (turn lar |=([p=path *] p))) :: changed paths - %+ roll (~(tap by hat) ~) + =- =+ sar=(sa (turn lar |=([p=path *] p))) :: changed paths + %+ roll (~(tap by hat) ~) :: find unchanged |= [[pat=path gar=lobe] bat=_bar] ?: (~(has in sar) pat) :: has update bat - (~(put by bat) pat (lobe-to-blob gar)) :: use original + (~(put by bat) pat (lobe-to-blob gar)) :: use original + ^= bar ^- (map path blob) %+ roll lar |= [[pat=path mys=miso] bar=(map path blob)] ^+ bar @@ -1757,34 +1755,29 @@ ?^(r.mun ~ [~ let]) ?: ?=(%w p.mun) =+ ^= yak - %- tako-to-yaki - %- aeon-to-tako + %- aeon-to-yaki let ?^(r.mun ~ [~ [t.yak (forge-nori yak)]]) ::?> ?=(^ hit) ?^(r.mun ~ [~ i.hit]) :: what do?? need [@da nori] (query(ank ank:(descend-path:(zu ank) r.mun)) p.mun) :: ++ read-at-aeon :: read-at-aeon:ze - |= [oan=aeon mun=mood] :: seek and read + |= [yon=aeon mun=mood] :: seek and read ^- (unit) ?: &(?=(%w p.mun) !?=(%ud -.q.mun)) :: NB only for speed - ?^(r.mun ~ [~ oan]) - (read:(rewind oan) mun) + ?^(r.mun ~ [~ yon]) + (read:(rewind yon) mun) :: ++ equiv :: test paths |= [p=(map path lobe) q=(map path lobe)] ^- ? - %- |= qat=? - ?. qat %.n - %+ roll (~(tap by q) ~) - |= [[pat=path lob=lobe] eq=?] - ^- ? - ?. eq %.n + =- ?. qat %.n + %+ levy (~(tap by q) ~) + |= [pat=path lob=lobe] (~(has by p) pat) - %+ roll (~(tap by p) ~) - |= [[pat=path lob=lobe] eq=?] - ^- ? - ?. eq %.n + ^= qat + %+ levy (~(tap by p) ~) + |= [pat=path lob=lobe] =+ zat=(~(get by q) pat) ?~ zat %.n =((lobe-to-noun u.zat) (lobe-to-noun lob)) @@ -1793,16 +1786,14 @@ |= [wen=@da lem=nori] :: edit ^+ +> ?- -.lem - & =+ ^= yet + & =^ yak lat :: merge objects %+ forge-yaki wen ?: =(let 0) :: initial import [~ q.lem] - [(some r:(tako-to-yaki (aeon-to-tako let))) q.lem] - =+ yak=-.yet - =. lat +.yet :: merge objects + [(some r:(aeon-to-yaki let)) q.lem] ?. ?| =(0 let) !=((lent p.yak) 1) - !(equiv q.yak q:(tako-to-yaki (aeon-to-tako let))) + !(equiv q.yak q:(aeon-to-yaki let)) == +>.$ :: silently ignore =: let +(let) @@ -1814,7 +1805,7 @@ == -- :: -++ zu :: filesystem +++ zu !: :: filesystem |= ank=ankh :: filesystem state =| myz=(list ,[p=path q=miso]) :: changes in reverse =| ram=path :: reverse path into @@ -2024,23 +2015,19 @@ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: section 3bG, URL handling :: :: -++ deft :: import url path +++ deft :: parse url extension |= rax=(list ,@t) |- ^- pork ?~ rax [~ ~] - ?~ t.rax - =+ den=(trip i.rax) - =+ ^= vex - %- %- full - ;~(plug sym ;~(pose (stag ~ ;~(pfix dot sym)) (easy ~))) - [[1 1] (trip i.rax)] - ?~ q.vex - [~ [i.rax ~]] - [+.p.u.q.vex [-.p.u.q.vex ~]] - =+ pok=$(rax t.rax) - :- p.pok - [i.rax q.pok] + ?^ t.rax + [p.pok [i.rax q.pok]]:[pok=$(rax t.rax) .] + =+ ^- raf=(unit ,[p=term q=(unit term)]) + %+ rush i.rax + ;~(plug sym ;~((bend) (easy ~) ;~(pfix dot sym))) + ?~ raf + [~ [i.rax ~]] + [q.u.raf [p.u.raf ~]] :: ++ fain :: path restructure |= [hom=path raw=path] @@ -2052,16 +2039,6 @@ ?> &(?=(^ mer) =(i.mer i.moh)) $(mer t.mer, moh t.moh) :: -++ fest :: web synthesizer - |= [hom=path raw=path] - |* yax=$+(epic *) - (yax (fuel (fain hom raw))) -:: -++ folk :: silk construction - |= [hom=path raw=path] - |* yox=$+((pair beam path) *) - (yox (fain hom raw)) -:: ++ fuel :: parse fcgi |= [bem=beam but=path] ^- epic @@ -2097,27 +2074,6 @@ nyp == :: -++ gist :: convenient html - |= [hom=path raw=path] - |= yax=$+(epic marl) - %- (fest hom raw) - |= piq=epic - ^- manx - =+ ^= sip :: skip blanks - |= mal=marl - ?~(mal ~ ?.(|(=(:/(~) i.mal) =(:/([10 ~]) i.mal)) mal $(mal t.mal))) - =+ zay=`marl`(yax piq) - =. zay (sip zay) - =+ ^= twa - |- ^- [p=marl q=marl] - ?~ zay [~ ~] - ?: ?=([[[%head *] *] *] zay) - [c.i.zay ?:(?=([[[%body *] *] ~] t.zay) c.i.t.zay t.zay)] - ?: ?=([[[%title *] *] *] zay) - [[i.zay ~] t.zay] - [~ zay] - [/html [/head (sip p.twa)] [/body (sip q.twa)] ~] -:: ++ sifo :: 64-bit encode |= tig=@ ^- tape @@ -2126,13 +2082,12 @@ =+ ^= cha 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' =+ ^= sif - %- flop |- ^- tape ?~ pad ~ =+ d=(end 0 6 pad) - [(cut 3 [0 d] cha) $(pad (rsh 0 6 pad))] - (weld (scag (sub (lent sif) poc) sif) (trip (fil 3 poc '='))) + [(cut 3 [d 1] cha) $(pad (rsh 0 6 pad))] + (weld (flop (slag poc sif)) (trip (fil 3 poc '='))) :: ++ urle :: URL encode |= tep=tape @@ -2166,64 +2121,63 @@ =+ nex=$(tep t.tep) ?~(nex ~ [~ i.tep u.nex]) :: -++ earl :: local purl to tape +++ earl :: localize purl |= [who=@p pul=purl] ^- purl pul(q.q [(rsh 3 1 (scot %p who)) q.q.pul]) :: ++ earn :: purl to tape - |= pul=purl - ^- tape - =< apex - |% - ++ apex - ^- tape - :(weld head "/" body tail) + |^ |= pul=purl + ^- tape + :(weld (head p.pul) "/" (body q.pul) (tail r.pul)) :: ++ body - |- ^- tape - ?~ q.q.pul - ?~(p.q.pul ~ ['.' (trip u.p.q.pul)]) - =+ seg=(trip i.q.q.pul) - ?:(=(~ t.q.q.pul) seg (weld seg `tape`['/' $(q.q.pul t.q.q.pul)])) + |= pok=pork ^- tape + ?~ q.pok ~ + |- + =+ seg=(trip i.q.pok) + ?~ t.q.pok + ?~(p.pok seg (welp seg '.' (trip u.p.pok))) + (welp seg '/' $(q.pok t.q.pok)) :: ++ head + |= har=hart ^- tape ;: weld - ?:(&(p.p.pul !=([& /localhost] r.p.pul)) "https://" "http://") + ?:(&(p.har !=([& /localhost] r.har)) "https://" "http://") :: - ?- -.r.p.pul - | (trip (rsh 3 1 (scot %if p.r.p.pul))) - & =+ rit=(flop p.r.p.pul) + ?- -.r.har + | (trip (rsh 3 1 (scot %if p.r.har))) + & =+ rit=(flop p.r.har) |- ^- tape ?~(rit ~ (weld (trip i.rit) ?~(t.rit "" `tape`['.' $(rit t.rit)]))) == :: - ?~(q.p.pul ~ `tape`[':' (trip (rsh 3 2 (scot %ui u.q.p.pul)))]) + ?~(q.har ~ `tape`[':' (trip (rsh 3 2 (scot %ui u.q.har)))]) == :: ++ tail + |= kay=quay ^- tape - ?: =(~ r.pul) ~ + ?: =(~ kay) ~ :- '?' |- ^- tape - ?~ r.pul ~ + ?~ kay ~ ;: weld - (trip p.i.r.pul) + (urle (trip p.i.kay)) "=" - (trip q.i.r.pul) - ?~(t.r.pul ~ `tape`['&' $(r.pul t.r.pul)]) + (urle (trip q.i.kay)) + ?~(t.kay ~ `tape`['&' $(kay t.kay)]) == -- :: ++ epur :: url/header parser - =< |=(a=cord (rush a apex)) + =< |=(a=cord (rush a auri)) |% ++ apat :: 2396 abs_path %+ cook deft (ifix [fas ;~(pose fas (easy ~))] (more fas smeg)) - ++ apex auri - ++ auri + ++ auri :: 2396 URL %+ cook |= a=purl ?.(=([& /localhost] r.p.a) a a(p.p &)) @@ -2250,13 +2204,7 @@ ++ fque (cook crip (plus pquo)) :: normal query field ++ fquu (cook crip (star pquo)) :: optional field ++ pcar ;~(pose pure pesc psub col pat) :: 2396 path char - ++ pcok ;~ pose :: cookie char - (just `@`0x21) - (shim 0x23 0x2b) - (shim 0x2d 0x3a) - (shim 0x3c 0x5b) - (shim 0x5d 0x7e) - == + ++ pcok ;~(less bas sem com doq prn) :: cookie char ++ pesc ;~(pfix cen mes) :: 2396 escaped ++ pold (cold ' ' (just '+')) :: old space code ++ pque ;~(pose pcar fas wut) :: 3986 query char @@ -2282,7 +2230,7 @@ %+ cook |*(a=[* *] [+.a -.a]) ;~ plug thos - ;~(pose (stag ~ ;~(pfix col dim:ag)) (easy ~)) + ;~((bend) (easy ~) ;~(pfix col dim:ag)) == ++ thos :: 2396 host, no local ;~ plug diff --git a/main/bin/liquid.hoon b/main/bin/liquid.hoon new file mode 100644 index 000000000..4bdf81d15 --- /dev/null +++ b/main/bin/liquid.hoon @@ -0,0 +1,20 @@ +!: +:: /=main=/bin/liquid/hoon +:: +=> .(- `[who=@p how=path]`-) +|= [est=time eny=@uw] +|= arg=* +=+ ^= lok ^- case + ?: =(~ arg) [%da est] + ?> =(~ +.arg) + ((hard case) -.arg) +=+ cav=(scot (dime lok)) +=+ top=`path`[(scot %p who) %arvo cav ~] +=+ pax=`path`(weld top `path`[%hoon ~]) +~& %liquid-start +=+ gen=(reck pax) +~& %liquid-parsed +=+ ken=q:(~(mint ut %noun) %noun gen) +~& %liquid-compiled +:_ ~ :_ ~ +[%xx %sage [%dummy %pill ~] [ken 0]] diff --git a/main/bin/solid.hoon b/main/bin/solid.hoon index 3e6bb8614..a52f8128f 100644 --- a/main/bin/solid.hoon +++ b/main/bin/solid.hoon @@ -17,7 +17,9 @@ =+ ken=q:(~(mint ut %noun) %noun gen) ~& %solid-compiled =+ ^= all + ~& [%solid-ken `@ux`(mug ken)] =+ all=.*(0 ken) + ~& %solid-loaded =+ ^= vay ^- (list ,[p=@tas q=@tas]) :~ [%$ %zuse] [%f %ford] diff --git a/main/mar/hook/door.hook b/main/mar/hook/door.hook index 9382e80cb..af29a81de 100644 --- a/main/mar/hook/door.hook +++ b/main/mar/hook/door.hook @@ -6,8 +6,9 @@ :: ++ grow :: convert to |% - ++ mime [/text/html (taco own)] :: convert to %mime - ++ hymn ;div:(pre:"{(trip own)}") :: convert to %html + ++ mime [/text/hoon (taco own)] :: convert to %mime + ++ psal ;div:(pre:"{(trip own)}") :: convert to %html + ++ hymn ;html:(head:title:"Source" "+{psal}") -- ++ grab |% :: convert from ++ noun ,@t :: clam from %noun diff --git a/main/pub/src/doc/ref/vol/1.md b/main/pub/src/doc/ref/vol/1.md index 90556060e..3465e5502 100644 --- a/main/pub/src/doc/ref/vol/1.md +++ b/main/pub/src/doc/ref/vol/1.md @@ -5,612 +5,1064 @@ XX Introduction/overview of structures goes here. --- -###abel +###++abel - ++ abel typo :: original sin: type +``` +++ abel typo :: original sin: type +``` -Aliases ++typo. [#typo] -Used for changing ++type, which contains twigs and consequently all rune structures +Biblical names in hoon are primarily aliases for the compiler. + +See also: `++typo` + + ~zod/try=> *abel + %void --- -###axis +###++axis - ++ axis ,@ :: tree address +``` +++ axis ,@ :: tree address +``` -A Nock axis, an address inside a Nock noun. -Clammed atom [#axil]. +A Nock axis inside a noun. After the leading 1, in binary, a 1 signfies right +and 0 left. + +See also: `++clue`, `++limb`, `++slot`, `++peg`, and Section 2fC + + ~zod/try=> *axis + 0 + + ~zod/try=> :: 0 is not actually a valid axis + ~zod/try=> [[4 5] 6 7] + [[4 5] 6 7] + ~zod/try=> `axis`0b110 + 6 --- -###also +###++also + +``` +++ also ,[p=term q=wing r=type] :: alias +``` - ++ also ,[p=term q=wing r=type] :: alias XX unused? --- -###base +###++base - ++ base ?([%atom p=odor] %noun %cell %bean %null) :: axils, @ * ^ ? ~ +``` +++ base ?([%atom p=odor] %noun %cell %bean %null) :: axils, @ * ^ ? ~ +``` -The cases of an %axil tile [#tile]. -See %axil in ++tile. +A base type that nouns are built from. Either a noun, a cell, loobean or null +labelled with an odor. + +See also: `++tile`, `++twig` + + ~zod/try=> *base + %null + + ~zod/try=> (ream '=|(^ !!)') + [%tsbr p=[%axil p=%cell] q=[%zpzp ~]] + ~zod/try=> :: p.p is a ++base + ~zod/try=> (ream '=|(@t !!)') + [%tsbr p=[%axil p=[%atom p=~.t]] q=[%zpzp ~]] + ~zod/try=> (ream '=|(? !!)') + [%tsbr p=[%axil p=%bean] q=[%zpzp ~]] --- -###beer +###++bean - ++ beer $|(@ [~ p=twig]) :: simple embed +``` +++ bean ,? :: 0=&=yes, 1=|=no +``` -A literal cord, or a twig producing a tape. -Used in ++phax and ++scat to build tapes, section 2fD +The Urbit version of a boolean, which we call a loobean. 0 or & is "yes", 1 or +| is "no". + + ~zod/try=> *bean + %.y + + ~zod/try=> `bean`& + %.y + ~zod/try=> `bean`| + %.n --- -###beet +###++beer - ++ beet $| @ :: advanced embed - $% [%a p=twig] :: - [%b p=twig] :: - [%c p=twig] :: - [%d p=twig] :: - [%e p=twig q=(list tuna)] :: - == :: +``` +++ beer $|(@ [~ p=twig]) :: simple embed +``` -A literal cord, or a twig producing xml of some form. -Used in ++sail xml interpolation, section 2fD +Used to build tapes internally. + +See also: `++phax`, `++scat`, section 2fD + + ~zod/try=> `beer`'as' + 29.537 + ~zod/try=> `beer`[~ (ream 'lan')] + [~ p=[%cnzz p=~[%lan]]] + --- -###bloq +###++beet - ++ bloq ,@ :: blockclass +``` +++ beet $| @ :: advanced embed + $% [%a p=twig] :: take tape + [%b p=twig] :: take manx + [%c p=twig] :: take marl + [%d p=twig] :: take $+(marl marl) + [%e p=twig q=(list tuna)] :: element literal + == :: +``` -An atom representing a blocksize, by convention expressed as a power of 2. -Used throughout section 2cA: bit surgery. +Cases for XML interpolation. Used internally. -Clammed atom [#axil]. +See also: `++sail`, section 2fD -++met measures how many bloqs long an atom is. It takes a bloq -and an atom. In the below example, the 256 is 2 bloqs of 2^3 long. That -is, it takes two bytes to represent the atom 256 +--- - ~zod/try=> (met 3 256) +###++bloq + +``` +++ bloq ,@ :: blockclass +``` + + +Atom representing a blocksize, by convention expressed as a power of 2. + +See also: section 2cA + + ~zod/try=> :: ++met measures how many bloqs long an atom is + ~zod/try=> (met 3 256) 2 + ~zod/try=> :: 256 is 2 bloqs of 2^3 --- -###calf +###++calf - ++ calf ,[p=(map ,@ud wine) q=wine] :: +``` +++ calf ,[p=(map ,@ud wine) q=wine] :: +``` -Type encoding cyclical backreferences -Produced by ++dole, consumed by ++doge and ++dish, section 2fC +Encodes cyclical backreferences in types. Used in pretty printing. -See [#wine] +See also: `++wine`, `++dole`, `++doge`, `++dish`, section 2fC + + ~zod/try=> `calf`[~ %atom %ta] + [p={} q=[%atom p=%ta]] + + ~zod/try=> `calf`~(dole ut p:!>(*^)) + [p={} q=[%plot p=~[%noun %noun]]] + + ~zod/try=> `calf`~(dole ut p:!>($:|-(?(~ [* $])))) + [ p={[p=1 q=[%pick p=~[[%pear p=%n q=0] [%plot p=~[%noun [%stop p=1]]]]]]} + q=[%stop p=1] + ] --- -###char +###++char - ++ char ,@tD :: UTF-8 byte +``` +++ char ,@tD :: UTF-8 byte +``` -A single character. -Used in ++tape string type, its parsing in chapter 2f: -++lust, ++just, ++mask, ++next, and ++hit +A single character. Odor `@tD` designates a single Unicode byte. All parsers +consume `++tape` (a list of `++char`). -Atom with odor [#type]. A @tD is a single Unicode byte. +See also: `++tape`, `++lust`, `++just`, `++mask`, chapter 2f -++tape [#tape], which is a string type, is a list of chars. + ~zod/try=> *char + ~~ + + ~zod/try=> (char 97) + ~~a --- -###chub +###++chub - ++ chub :: registered battery - $: p=(pair chum tyre) :: definition - q=* :: battery - r=(unit (pair axis chub)) :: parent - == +``` +++ chub :: registered battery + $: p=(pair chum tyre) :: definition + q=* :: battery + r=(unit (pair axis chub)) :: parent + == :: +``` -Used (implicitly?) by compiler to attach jets, section 2fB. -Also used in :haus to make chat messages fly faster(???) + +Used by the compiler (implicitly by `%sgcn`) to attach jets. + +See also: Section 2fB. --- -###chum +###++chum - ++ chum $? lef=term :: jet name - [std=term kel=@] :: kelvin version - [ven=term pro=term kel=@] :: vendor and product - [ven=term pro=term ver=@ kel=@] :: all of the above - == :: +``` +++ chum $? lef=term :: jet name + [std=term kel=@] :: kelvin version + [ven=term pro=term kel=@] :: vendor and product + [ven=term pro=term ver=@ kel=@] :: all of the above + == :: +``` -The jet hint information that must be present in the body of a ~/ -or ~% rune. -Appears in ++twig and ++clue +Jet hint information that must be present in the body of a ~/ or ~% rune. +A `++chum` can optionally contain a kelvin version, jet vendor, and +major.minor version number. -A %fern of the following cases: +XX there's a ++chum in zuse that's politely causing this not to work -- the jet's name -- the jet's name and the kelvin number -- the jet's vendor, name and kelvin number -- the jet's vendor, name, legacy major.minor version and kelvin number +See also: `++twig`, `++clue` + + ~zod/try=> `chum`'hi' + lef=%hi + + ~zod/try=> (ream '~/(%lob.314 !!)') + [%sgfs p=[std=%lob kel=314] q=[%zpzp ~]] + --- -###claw +###++clue - ++ claw - XX unused? +``` +++ clue ,[p=axis q=chum r=tyre] :: battery definition +``` + + +Used by compiler to attach jets. + +XX implementation does not currenlty match docs + +See also: section 2fB --- -###clue +###++coil - ++ clue ,[p=axis q=chum r=tyre] :: battery definition +``` +++ coil $: p=?(%gold %iron %lead %zinc) :: core type + q=type :: + r=[p=?(~ ^) q=(map term foot)] :: + == :: +``` -Used by compiler to attach jets, section 2fB XX implementation does not currenlty match docs + +Core information tuple: variance, subject type, optional compiled nock, and +arms. Used as an intermediate step within Section 2fB. Converted by `++core` to +%core type. + +See also: `++core`, Section 2fB --- -###coat +###++coin - ++ coat ,[p=path q=vase] :: +``` +++ coin $% [%$ p=dime] :: + [%blob p=*] :: + [%many p=(list coin)] :: + == :: +``` -Used nowhere, shadowed in 4aG XX ---- +Noun literal syntax cases: atoms, jammed nouns, and nestable tuples. Parsed and +printed using `++so` and `++co` cores in Section 2eL respectively. -###coil +See also: `++so`, `++co`, Section 2eL, `++dime` - ++ coil $: p=?(%gold %iron %lead %zinc) :: - q=type :: - r=[p=?(~ ^) q=(map term foot)] :: - == :: + ~zod/try=> `coin`(need (slay '~s1')) + [%$ p=[p=~.dr q=18.446.744.073.709.551.616]] + ~zod/try=> `coin`(need (slay '0x2b59')) + [%$ p=[p=~.ux q=11.097]] + + ~zod/try=> ~(rend co [%many ~[[%$ %ud 1] [%$ %tas 'a'] [%$ %s -2]]]) + "._1_a_-2__" + ~zod/try=> ._1_a_-2__ + [1 %a -2] -Core. XX - -Variance, type, and arms XX - -Generated somehwere in ++vast XX -Converted by ++core to %core twig - ---- - -###coin - - ++ coin $% [%$ p=dime] :: - [%blob p=*] :: - [%many p=(list coin)] :: - == :: - -Literal syntax primitive XX - -Used to parse and print e.g. `0x2b59` or `~s1`, ++so and ++co -in section 2eL respectively + ~zod/try=> `@uv`(jam [3 4]) + 0v2cd1 + ~zod/try=> (slay '~02cd1') + [~ [%blob p=[3 4]]] + ~zod/try=> ~02cd1 + [3 4] --- -###cord +###++cord - ++ cord ,@t :: text atom (UTF-8) +``` +++ cord ,@t :: text atom (UTF-8) +``` -One of Hoon's two string types (the other being ++tape). A cord is an -atom of UTF-8 text. -Used everywhere XX -Notably, ++trip and ++crip convert between cord and ++tape +One of Hoon's two string types (the other being `++tape`). A cord is an +atom of UTF-8 text. `++trip` and `++crip` convert between cord and `++tape` -Atom with odor. @t is a Unicode atom. The order of bytes in a @t are -little-endian, i.e. the first character in the text is the low byte of -the atom. +Odor `@t` designates a Unicode atom, little-endian: the first character in the +text is the low byte. + +See also: `++trip`, `++crip`, Section 2eJ ~zod/try=> `@ux`'foobar' 0x7261.626f.6f66 ---- - -###date - - ++ date ,[[a=? y=@ud] m=@ud t=tarp] :: parsed date - -A point in time. - -Converted to/from @d using ++year/++yore in section 2cH, -Parsed/printed as UTC by ++stud/++dust in section 3bc - -A loobean designating AD or BC, a year atom, a month atom, and a ++tarp, which -is a day atom and a time. - -++yell produces a ++date from a @da (a date atom) - - ~zod/try=> (yell ~2014.6.6..21.09.15..0a16) - [d=106.751.991.820.172 h=21 m=9 s=15 f=~[0xa16]] + ~zod/try=> `@`'urbit' + 499.984.265.845 + ~zod/try=> (cord 499.984.265.845) + 'urbit' --- -###dime +###++date - ++ dime ,[p=@ta q=@] :: +``` +++ date ,[[a=? y=@ud] m=@ud t=tarp] :: parsed date +``` -Odor-atom pair, used in ++so/++co, section 2eL + +A point in time. A loobean designating AD or BC, a year atom, a month atom, +and a `++tarp`, which is a day atom and a time. + +See also: `++year`, `++yore`, Section 2cH, `++stud`, `++dust`, Section 3bc + + ~zod/try=> `date`(yore ~2014.6.6..21.09.15..0a16) + [[a=%.y y=2.014] m=6 t=[d=6 h=21 m=9 s=15 f=~[0xa16]]] --- -### dram +###++dime - ++ dram $% [| p=(map ,@tas dram)] :: simple unix dir - [& p=@ud q=@] :: +``` +++ dime ,[p=@ta q=@] :: +``` -The structure of a unix filesystem tree. -One of two cases: +Odor-atom pair, used in `++coin`. -- `|` a directory - a map of names to deeper tree structures. -- `&` a file - a numbered atom of data. +Convenience methods `++scot` and `++scow` (in Section 2eL) print dimes as +cords/tapes, `++slat`, `++slav`, and `++slaw` are used to parse atoms of +specific odor. -Cards %dire and %pour in zuse require a ++dram argument to target. +See also: `++so`, `++co`, Section 2eL, `++coin` + + ~zod/try=> +>:(slay '0x123') + p=[p=~.ux q=291] --- -###each +###++dram - ++ each |*([a=$+(* *) b=$+(* *)] $%([& p=a] [| p=b])) :: +``` +++ dram $% [| p=(map ,@tas dram)] :: simple unix dir + [& p=@ud q=@] :: + == :: +``` -Dicriminated fork between two types XX -Used everywhere XX +The structure of a unix filesystem tree. A `++dram` is one of two cases: `|` a directory - a map of names to deeper tree structures, `&` a file - a numbered atom of data. + +XX Unused --- -###edge +###++each + +``` +++ each |*([a=$+(* *) b=$+(* *)] $%([& p=a] [| p=b])) :: either a or b +``` + + +Tile generator: produces a dicriminated fork between two types. + + ~zod/try=> :type; *(each cord time) + [%.y p=''] + {[%.y p=@t] [%.n p=@da]} + +--- + +###++edge + +``` +++ edge ,[p=hair q=(unit ,[p=* q=nail])] :: parsing output +``` - ++ edge ,[p=hair q=(unit ,[p=* q=nail])] :: parsing output -Half-parsed tape with location metadata XX +Parsing location metadata: optional result and parsing continuation. -Used in all section 2eD: combinators, and implicitly everywhere a ++rule is used. +See also: Section 2eD, `++rule` + + ~zod/try=> *edge + [p=[p=0 q=0] q=~] + ~zod/try=> (tall:vast [1 1] "a b") + [p=[p=1 q=2] q=[~ [p=[%cnzz p=~[%a]] q=[p=[p=1 q=2] q=" b"]]]] --- -###foot +###++foot - ++ foot $% [%ash p=twig] :: dry arm, geometric - [%elm p=twig] :: wet arm, generic - [%oak ~] :: XX not used - [%yew p=(map term foot)] :: XX not used - == :: +``` +++ foot $% [%ash p=twig] :: dry arm, geometric + [%elm p=twig] :: wet arm, generic + [%oak ~] :: XX not used + [%yew p=(map term foot)] :: XX not used + == :: +``` -Arm with wetness XX -Used in ++ap to compile cores and ++ut to type-check them, sections 2fB and 2fC +Cases of arms by variance model. + +See also: `++ap`, `++ut`, Section 2fB, Section 2fC + + ~zod/try=> *foot + [%yew p={}] + + ~zod/try=> (ream '|% ++ $ foo --') + [%brcn p={[p=%$ q=[%ash p=[%cnzz p=~[%foo]]]]}] + ~zod/try=> +<+:(ream '|% ++ $ foo --') + t=~[%ash %cnzz %foo] + ~zod/try=> (foot +<+:(ream '|% ++ $ foo --')) + [%ash p=[%cnzz p=~[%foo]]] + ~zod/try=> (foot +<+:(ream '|% +- $ foo --')) + [%elm p=[%cnzz p=~[%foo]]] --- -###gate +###++gate - ++ gate $+(* *) :: general gate +``` +++ gate $+(* *) :: general gate +``` -Used everywhere XX + +An core with one arm, `$`, which transforms a sample noun into a product noun. If used dryly as a type, subject must have a sample type of `*`. + +See also: `++lift`, `++cork`, Core Language Doc + + ~zod/try=> *gate + <1|mws [* <101.jzo 1.ypj %164>]> + ~zod/try=> `gate`|=(* 0) + <1|mws [* <101.jzo 1.ypj %164>]> + + ~zod/try=> (|=(a=* [a 'b']) 'c') + [99 'b'] + ~zod/try=> (`gate`|=(a=* [a 'b']) 'c') + [99 98] --- -### gear +###++hair - ++ gear |* a=_,* :: XX list generator - $_ :: - =| b=* :: - |? :: - ?@ b :: - ~ :: - [i=(a -.b) t=^?(..$(b +.b))] :: +``` +++ hair ,[p=@ud q=@ud] :: parsing trace +``` -Unused. - 1 ---- -###hair +A pair of two `@ud` used in parsing indicating line and column number. - ++ hair ,[p=@ud q=@ud] :: parsing trace +See also: `++last`, Section 2eB -Line and column number. + ~zod/try=> *hair + [p=0 q=0] -Used to track position in parsing, ++last in section 2eB + ~zod/try=> `hair`[1 1] :: parsing starts at [1 1] as a convention. + [p=1 q=1] + ~zod/try=> ((plus ace) [1 1] " --") + [p=[p=1 q=4] q=[~ u=[p=[~~. " "] q=[p=[p=1 q=4] q="--"]]]] + ~zod/try=> `hair`p:((plus ace) [1 1] " --") + [p=1 q=4] --- -###hapt +###++like - ++ hapt (list ,@ta) :: XX not used +``` +++ like |* a=_,* :: generic edge + |= b=_`*`[(hair) ~] :: + :- p=(hair -.b) :: + ^= q :: + ?@ +.b ~ :: + :- ~ :: + u=[p=(a +>-.b) q=[p=(hair -.b) q=(tape +.b)]] :: +``` ---- - -###like - - ++ like |* a=_,* :: generic edge - |= b=_`*`[(hair) ~] :: - :- p=(hair -.b) :: - ^= q :: - ?@ +.b ~ :: - :- ~ :: - u=[p=(a +>-.b) q=[p=(hair -.b) q=(tape +.b)]] :: -Type to "parser to that type" type XX +Tile generator for an `++edge`. `++like` generates an `++edge` with a parsed result set to a specific type. -Used for funky vulcan stuff: primitives ++easy, ++just/++jest, ++knee, ++mask, -++shim, ++stir, ++stun in section 2eC +See also: `++easy`, `++just`/`++jest`, `++knee`, `++mask`, `++shim`, `++stir`, `++stun`, Section 2eC + + ~zod/try=> *(like char) + [p=[p=0 q=0] q=~] + + ~zod/try=> (ace [1 1] " a") + [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q="a"]]]] + ~zod/try=> `(like char)`(ace [1 1] " a") + [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q="a"]]]] + ~zod/try=> `(like ,@)`(ace [1 1] " a") + [p=[p=1 q=2] q=[~ [p=32 q=[p=[p=1 q=2] q="a"]]]] + --- -###limb +###++limb + +``` +++ limb $|(term $%([%& p=axis] [%| p=@ud q=term])) :: +``` + +XX move to `++ut` ++ limb $|(term $%([%& p=axis] [%| p=@ud q=term])) :: Reference into subject by name/axis -Used in compilation and grammar, section 2fC-2fD +See also: section 2fC-2fD + + ~zod/try=> (ream '^^$') + [%cnzz p=~[[%.n p=2 q=%$]]] + ~zod/try=> (limb &2:(ream '^^$')) + [%.n p=2 q=%$] + ~zod/try=> (limb &2:(ream '^^^$')) + [%.n p=3 q=%$] --- -###line +###++line + +``` +++ line ,[p=[%leaf p=odor q=@] q=tile] :: %kelp case +``` + +XX move to `++ut` ++ line ,[p=[%leaf p=odor q=@] q=tile] :: %kelp case Dicriminated union unionee XX Used in compilation and grammar, section 2fC-2fD + + ~zod/try=> (ream '$%([1 a] [%2 b])') + [ %bccm + p + [ %kelp + p + [ i=[p=[%leaf p=~.ud q=1] q=[%herb p=[%cnzz p=~[%a]]]] + t=~[[p=[%leaf p=~.ud q=2] q=[%herb p=[%cnzz p=~[%b]]]]] + ] + ] + ] + ~zod/try=> &3:(ream '$%([1 a] [%2 b])') + p=[p=[%leaf p=%ud q=1] q=[%herb p=[%cnzz p=~[%a]]]] + ~zod/try=> (line &3:(ream '$%([1 a] [%2 b])')) + [p=[%leaf p=~.ud q=1] q=[%herb p=[%cnzz p=~[%a]]]] --- -###list +###++list - ++ list |* a=_,* :: null-term list - $|(~ [i=a t=(list a)]) :: +``` +++ list |* a=_,* :: null-term list + $|(~ [i=a t=(list a)]) :: +``` -Used everywhere XX -Frequently through the helper gates in section 2bB + +Tile generator. `++list` generates a tile of a null-termanated list of homogenous type. + +See also: `++turn`, `++snag`, section 2bB. + + ~zod/try=> *(list) + ~ + ~zod/try=> `(list ,@)`"abc" + ~[97 98 99] + ~zod/try=> (snag 0 "abc") + ~~a --- -###lone +###++lone + +``` +++ lone |*(a=$+(* *) ,p=a) :: just one thing +``` + +XX unused ++ lone |*(a=$+(* *) ,p=a) :: just one thing -Used nowhere XX +Tile generator. `++lone` puts face of `p` on something. --- -###mane +###++mane - ++ mane $|(@tas [@tas @tas]) :: XML name/space +``` +++ mane $|(@tas [@tas @tas]) :: XML name/space +``` -Parsed by ++name:poxa, rendered by ++node:poxo, section 3bD + +An XML name (tag name or attribute name) with an optional namespace. Parsed by `++name`:xmlp, rendered by `++xmln`. + +See also: `++sail` doc, Section 3bD + + ~zod/try=> *mane + %$ + + ~zod/try=> `mane`n.g:`manx`;div:namespace; + %div + ~zod/try=> `mane`n.g:`manx`;div_namespace; + [%div %namespace] --- -###manx +###++manx - ++ manx ,[g=marx c=marl] :: XML node +``` +++ manx ,[g=marx c=marl] :: XML node +``` -Top level xml node. -Parsed by ++apex:poxa, rendered by ++apex:poxo, section 3bD +XML node. + +Parsed by `++apex`:xmlp, rendered by `++xmlt`, section 3bD + +See also: `++sail` doc, Section 3bD --- -###marl +###++marl - ++ marl (list manx) :: XML node list +``` +++ marl (list manx) :: XML node list +``` -Parsed within ++apex:poxa, rendered by ++many:poxo, section 3bD + +List of XML nodes. + +Parsed within `++apex`:xmlp, rendered by `++xmll`, section 3bD + +See also: `++sail` doc --- -###mars +###++mars - ++ mars ,[t=[n=%$ a=[i=[n=%$ v=tape] t=~]] c=~] :: XML cdata +``` +++ mars ,[t=[n=%$ a=[i=[n=%$ v=tape] t=~]] c=~] :: XML cdata +``` -,_:/(tape), used nowhere XX should be in ++chrd:poxa and ++chrd:poxo -Is a valid ++manx +XML CDATA. Implicitly produced by `++chrd`:xmlp + +See also: `++sail` doc --- -###mart +###++mart - ++ mart (list ,[n=mane v=tape]) :: XML attributes +``` +++ mart (list ,[n=mane v=tape]) :: XML attributes +``` -Parsed by ++attr:poxa, rendered by ++attr:poxo, section 3bD + +List of XML attributes. Each `++mart` is a list of pairs of `++mane` and `++tape`. + +Parsed by `++attr`:xmlp, rendered by `++xmla`, section 3bD + +See also: `++sail` doc --- -###marx +###++marx - ++ marx ,[n=mane a=mart] :: XML tag +``` +++ marx ,[n=mane a=mart] :: XML tag +``` -Parsed by ++head:poxa, rendered within ++apex:poxo, section 3bD + +XML tag. A `++marx` is a pair of a tag name, `++mane` and a list of attributes, `++mart`. + +Parsed by `++head`:xmlp, rendered within `++xmlt`, section 3bD + +See also: `++sail` doc --- -###metl +###++metl + +``` +++ metl ?(%gold %iron %zinc %lead) :: core variance +``` + +XX move to ++ut ++ metl ?(%gold %iron %zinc %lead) :: core variance -Used implicitly in ++coil +See also: `++coil` --- -###noun +###++noun + +``` +++ noun ,* :: any noun +``` + + +Used nowhere XX + + ~zod/try=> `noun`~[1 2 3] + [1 2 3 0] + +--- + +###++null + +``` +++ null ,~ :: null, nil, etc +``` + + +Used nowhere XX + + ~zod/try=> :type; *null + ~ + %~ + +--- + +###++odor + +``` +++ odor ,@ta :: atom format +``` + + +By convetion, a short name for a category of atom. `++odor` is circularly defined, `@ta` being the `++odor` of the ASCII subset commonly used in urbit. + +See also: `++base`, odor reference + + ~zod/try=> `odor`%ux + ~.ux + +--- + +###++tarp + +``` +++ tarp ,[d=@ud h=@ud m=@ud s=@ud f=(list ,@ux)] :: parsed time +``` + + +The remaining part of a `++date`: day, hour, minute, second and a list of `@ux` for precision. + +See also: `++date`, `++yell`/`++yule`, Section 2cH + + ~zod/try=> -<- + ~2014.9.20..00.43.33..b52a + ~zod/try=> :: the time is always in your context at -<- + ~zod/try=> (yell -<-) + [d=106.751.991.820.278 h=0 m=43 s=39 f=~[0x54d1]] + + ~zod/try=> (yell ~d20) + [d=20 h=0 m=0 s=0 f=~] + +--- + +###++time + +``` +++ time ,@da :: galactic time +``` + + +The `@da` odor designates an absolute date atom. + +See also: `++date`, odor reference + + ~zod/try=> `time`-<- + ~2014.9.25..20.01.47..eeac + ~zod/try=> :: the time is always in your context at -<- + ~zod/try=> `time`~2014.1.1 + ~2014.1.1 + +--- + +###++tree + +``` +++ tree |* a=_,* :: binary tree + $|(~ [n=a l=(tree a) r=(tree a)]) :: +``` + + +Tile generator. A `++tree` can be empty, or contain a node of a type and left/right +sub `++tree`s of the same type. Pretty-printed with `{}`. + + ~zod/try=> `(tree ,[@ tape])`[[1 "hi"] [[2 "bye"] ~ ~] ~] + {[2 "bye"] [1 "hi"]} + + +--- + +###++nail + +``` +++ nail ,[p=hair q=tape] :: parsing input +``` + + +Location in parsed text, and remainder of it. Indicates parsing position and remaining text to be parsed. + +See also: `++roll` + + ~zod/try=> +<:;~(plug cab cab) + c=tub=[p=[p=0 q=0] q=""] + ~zod/try=> :: tub is a ++nail + +--- + +###++numb + +``` +++ numb ,@ :: just a number +``` - ++ noun ,* :: any noun Used nowhere XX --- -###null +###++pair - ++ null ,~ :: null, nil, etc +``` +++ pair |*([a=$+(* *) b=$+(* *)] ,[p=a q=b]) :: just a pair +``` -Used nowhere XX + +Tile generator. Produces a tuple of two nouns of the types passed in. + + ~zod/try=> *(pair bean cord) + [p=%.y q=''] --- -###odor +###++pass - ++ odor ,@ta :: atom format +``` +++ pass ,@ :: public key +``` -Used in ++base + +Atom alias. Used primarily in crypto. + +See also: `++acru`, `++crua`, `++crub` --- -###tarp +###++path - ++ tarp ,[d=@ud h=@ud m=@ud s=@ud f=(list ,@ux)] :: parsed time +``` +++ path (list span) :: filesys location +``` -Used in ++date, converted from and to @d by ++yell/++yule in section 2cH + +A filesystem path. A `++path` is a list of `++span`, `@ta`. Used in `%clay` and `%eyre` extensively. + + ~zod/try=> `path`"abc" + /a/b/c --- -###time +###++pint - ++ time ,@da :: galactic time +``` +++ pint ,[p=[p=@ q=@] q=[p=@ q=@]] :: line/column range +``` + + +A parsing range, mostly used for stacktraces. A `++pint` is a pair of hairs indicating from - to. + + ~zod/try=> !:(!!) + ! /~zod/try/~2014.9.20..01.22.04..52e3/:<[1 4].[1 6]> + ~zod/try=> :: !! always produces a crash + ~zod/try=> `pint`[[1 4] [1 6]] + [p=[p=1 q=4] q=[p=1 q=6]] --- -###tree +###++pole - ++ tree |* a=_,* :: binary tree - $|(~ [n=a l=(tree a) r=(tree a)]) :: ---- +``` +++ pole |* a=_,* :: nameless list + $|(~ [a (pole a)]) :: +``` -###nail - - ++ nail ,[p=hair q=tape] :: parsing input + +Sometimes list faces aren't available + + ~zod/try=> `(pole char)`"asdf" + [~~a [~~s [~~d [~~f ~]]]] --- -###numb +###++port - ++ numb ,@ :: just a number +``` +++ port $: p=axis :: + $= q :: + $% [%& p=type] :: + [%| p=axis q=(list ,[p=type q=foot])] :: + == :: + == :: +``` + + +Type and location of core-shaped thing? XX Compiler Internals + + ~zod/try=> *port + [p=0 q=[%.y p=%void]] --- -###pair - ++ pair |*([a=$+(* *) b=$+(* *)] ,[p=a q=b]) :: just a pair + +###++post + +``` +++ post $: p=axis :: + $= q :: + $% [0 p=type] :: + [1 p=axis q=(list ,[p=type q=foot])] :: + [2 p=twin q=type] :: + == :: + == :: +``` + + +Type and location of possibly core-shaped thing? XX Compiler Internals + + ~zod/try=> *post + [p=0 q=[%0 p=%void]] --- -###pass +###++prop - ++ pass ,@ :: public key +``` +++ prop $: p=axis :: + $= q :: + [p=?(~ axis) q=(list ,[p=type q=foot])] :: + == :: +``` + + +Verified core-shaped thing? XX Compiler Internals + + ~zod/try=> *prop + [p=0 q=[p=~ q=~]] --- -###path +###++qual - ++ path (list span) :: filesys location +``` +++ qual |* [a=$+(* *) b=$+(* *) c=$+(* *) d=$+(* *)] :: just a quadruple + ,[p=a q=b r=c s=d] :: + :: XX move to zuse +``` + + +Tile constructor: tuple of 4 + + ~zod/try=> *(qual date time tape cord) + [p=[[a=%.y y=0] m=0 t=[d=0 h=0 m=0 s=0 f=~]] q=~292277024401-.1.1 r="" s=''] --- -###pint +###++rege - ++ pint ,[p=[p=@ q=@] q=[p=@ q=@]] :: line/column range +``` +++ rege $| ?(%dote %ende %sart %empt %boun %bout) :: parsed regex + $% [%lite p=char] :: literal + [%pair p=rege q=rege] :: ordering + [%capt p=rege q=@u] :: capture group + [%brac p=@] :: p is 256 bitmask + [%eith p=rege q=rege] :: either + [%mant p=rege] :: greedy 0 or more + [%plls p=rege] :: greedy 1 or more + [%betw p=rege q=@u r=@u] :: between q and r + [%bint p=rege q=@u] :: min q + [%bant p=rege q=@u] :: exactly q + [%manl p=rege] :: lazy 0 or more + [%plll p=rege] :: lazy 1 or more + [%betl p=rege q=@u r=@u] :: between q and r lazy + [%binl p=rege q=@u] :: min q lazy + == :: +``` + + +Regex, names need restructuring XX --- -###pole +###++ring - ++ pole |* a=_,* :: nameless list - $|(~ [a (pole a)]) :: ---- +``` +++ ring ,@ :: private key +``` + + +Atom alias, used in `++acru` cryptosuite type, and its implementations +`crua` and `crub`. -###port - ++ port $: p=axis :: - $= q :: - $% [%& p=type] :: - [%| p=axis q=(list ,[p=type q=foot])] :: - == :: - == :: --- -###post +###++rule - ++ post $: p=axis :: - $= q :: - $% [0 p=type] :: - [1 p=axis q=(list ,[p=type q=foot])] :: - [2 p=twin q=type] :: - == :: - == :: ---- +``` +++ rule |=(tub=nail `edge`[p.tub ~ ~ tub]) :: parsing rule +``` -###prop + +Parser typeclass. - ++ prop $: p=axis :: - $= q :: - [p=?(~ axis) q=(list ,[p=type q=foot])] :: - == :: ---- - -###qual - - ++ qual |* [a=$+(* *) b=$+(* *) c=$+(* *) d=$+(* *)] :: just a quadruple - ,[p=a q=b r=c s=d] :: ---- - -###rege - - ++ rege $| ?(%dote %ende %sart %empt %boun %bout) :: parsed regex - $% [%lite p=char] :: literal - [%pair p=rege q=rege] :: ordering - [%capt p=rege q=@u] :: capture group - [%brac p=@] :: p is 256 bitmask - [%eith p=rege q=rege] :: either - [%mant p=rege] :: greedy 0 or more - [%plls p=rege] :: greedy 1 or more - [%betw p=rege q=@u r=@u] :: between q and r - [%bint p=rege q=@u] :: min q - [%bant p=rege q=@u] :: exactly q - [%manl p=rege] :: lazy 0 or more - [%plll p=rege] :: lazy 1 or more - [%betl p=rege q=@u r=@u] :: between q and r lazy - [%binl p=rege q=@u] :: min q lazy - == + ~zod/try=> ^+(rule [|=(a=nail [p.a ~])]:|6) :: wet gate needs same context + <1.dww [tub=[p=[p=@ud q=@ud] q=""] <101.jzo 1.ypj %164>]> --- -###ring +###++span - ++ ring ,@ :: private key +``` +++ span ,@ta :: text-atom (ASCII) +``` ---- - -###rule - - ++ rule |=(tub=nail `edge`[p.tub ~ ~ tub]) :: parsing rule - ---- - -###span - - ++ span ,@ta :: text-atom (ASCII) A restricted text atom for canonical atom syntaxes. The prefix is `~.`. There are no escape sequences except `~~`, which means `~`, and `~-`, @@ -630,31 +1082,76 @@ besides numbers and lowercase letters are permitted. --- -###spot +###++spot + +``` +++ spot ,[p=path q=pint] :: range in file +``` + + +Stack trace line. + + ~zod/try=> :into /=main=/bin/fail/hoon '!: !!' + + /~zod/main/359/bin/fail/hoon + ~zod/try=> :fail + ! /~zod/main/~2014.9.22..18.40.56..ef04/bin/fail/:<[1 5].[1 7]> + ! exit - ++ spot ,[p=path q=pint] :: range in file --- -###tang +###++tang - ++ tang (list tank) :: general error +``` +++ tang (list tank) :: general error +``` + + +Unused XX --- -###tank +###++tank + +``` +++ tank $% [%leaf p=tape] :: printing formats + $: %palm :: + p=[p=tape q=tape r=tape s=tape] :: + q=(list tank) :: + == :: + $: %rose :: delimeted list + p=[p=tape q=tape r=tape] :: mid open close + q=(list tank) :: + == :: + == +``` + + +Pretty-printing structure: leaf nodes, XX, and surrounded-and-delimited tanks + + ~zod/try=> >(bex 20) (bex 19)< + [%rose p=[p=" " q="[" r="]"] q=~[[%leaf p="1.048.576"] [%leaf p="524.288"]]] + ~zod/try=> (wash [0 80] >(bex 20) (bex 19)<) + <<"[1.048.576 524.288]">> + ~zod/try=> (wash [0 15] >(bex 20) (bex 19)<) + <<"[ 1.048.576" " 524.288" "]">> + + ~zod/try=> [(bex 150) (bex 151)] + [ 1.427.247.692.705.959.881.058.285.969.449.495.136.382.746.624 + 2.854.495.385.411.919.762.116.571.938.898.990.272.765.493.248 + ] + - ++ tank $% [%leaf p=tape] :: printing formats - [%palm p=[p=tape q=tape r=tape s=tape] q=(list tank)] - [%rose p=[p=tape q=tape r=tape] q=(list tank)] - == :: --- -###tape +###++tape - ++ tape (list char) :: like a string +``` +++ tape (list char) :: like a string +``` -One of Hoon's two string types (the other being ++cord). A tape is a + +One of Hoon's two string types (the other being `++cord`). A tape is a list of chars. ~zod/try=> `(list ,char)`"foobar" @@ -664,14 +1161,18 @@ list of chars. --- -###term +###++term + +``` +++ term ,@tas :: Hoon ASCII subset +``` A restricted text atom for Hoon constants. The only characters permitted are lowercase ASCII, - except as the first or last character, and 0-9 except as the first character. -The syntax for @tas is the text itself, always preceded by %. This -means a term is always cubical. You can cast it to @tas if you like, +The syntax for `@tas` is the text itself, always preceded by `%`. This +means a term is always cubical. You can cast it to `@tas` if you like, but we just about always want the cube: ~zod/try=> %dead-fish9 @@ -679,12 +1180,12 @@ but we just about always want the cube: ~zod/try=> -:!>(%dead-fish9) [%cube p=271.101.667.197.767.630.546.276 q=[%atom p=%tas]] -The empty @tas has a special syntax, $: +The empty `@tas` has a special syntax, `$`: ~zod/try=> %$ %$ -A term without % is not a constant, but a name: +A term without `%` is not a constant, but a name: ~zod/try=> dead-fish9 ! -find-limb.dead-fish9 @@ -693,195 +1194,137 @@ A term without % is not a constant, but a name: --- -###tiki +###++tiki + +``` +++ tiki :: test case + $% [& p=(unit term) q=wing] :: simple wing + [| p=(unit term) q=twig] :: named wing + == :: +``` + + +A `wing` or `twig` + + ~zod/try=> (ream '=+ a=4 ?-(a @ ~)') + [ %tsls + p=[%ktts p=p=%a q=[%dtzy p=%ud q=4]] + q + [ %wthz + p=[%.y p=~ q=~[%a]] + q=~[[p=[%axil p=[%atom p=~.]] q=[%bczp p=%null]]] + ] + ] + ~zod/try=> (ream '=+ a=4 ?-(4 @ ~)') + [ %tsls + p=[%ktts p=p=%a q=[%dtzy p=%ud q=4]] + q + [ %wthz + p=[%.n p=~ q=[%dtzy p=%ud q=4]] + q=~[[p=[%axil p=[%atom p=~.]] q=[%bczp p=%null]]] + ] + ] - ++ tiki --- -###tile +###++tile - ++ tile +``` +++ tile $& [p=tile q=tile] :: ordered pair + $% [%axil p=base] :: base type + [%bark p=term q=tile] :: name + [%bush p=tile q=tile] :: pair/tag + [%fern p=[i=tile t=(list tile)]] :: plain selection + [%herb p=twig] :: gate + [%kelp p=[i=line t=(list line)]] :: tag selection + [%leaf p=term q=@] :: constant atom + [%reed p=tile q=tile] :: atom/cell + [%weed p=twig] :: example + == :: +``` -A tile is a convenient way of making a well-typed noun. It can be -reduced in four ways - cryptically called bunt, clam, -fish, and whip. each tile corresponds to a well-defined -type, called its icon. A tile is converted statically into a twig, -which in turn may (depending on the conversion) produce the icon, test -for it, etc. And always, the icon is some function of the tile and its -subject. -There are nine cases within ++tile: - - [p=tile q=tile] - -Tiles autocons, just like twigs - a cell of tiles is a tile of a -cell. - -`(,[@ @] [4 5])` is `[4 5]`, which is the same as [(,@ 4) (,@ 5)], -producing [4 5]. Clearly, (,[@ @] [4 5]) should not be the same as -[(,@ [4 5]) (,@ [4 5])] - which would produce merely [0 0].) - -The irregular wide syntax for tile autocons is the same as the -syntax for twig autocons - eg, [@ @], a cell of atoms. But there is -also a regular tall/wide tuple syntax, with $: (buccol, %bccl). -Thus instead of [@ @] we could write: - - $: @ - @ - == - - [%axil p=base] - -An %axil is a simple built-in mechanism for a few basic icons: an -atom of any odor (@odor, or just @ for the odorless base atom); a -noun (*); a cell of nouns (^); a loobean ?; and null ~. - - [%bark p=term q=tile] - -Wrap a name round a tile. a=* parses as [%bark %a %noun]. - -This is another case where the tile syntax matches the twig syntax, -but only in the irregular form. The twig equivalent of %bark is of -course ^= (kettis, %ktts). But the tile is $= (buctis): - - $= a - * - -Obviously a silly syntactic arrangement. But you can need it if q -is really big. - - [%bush p=tile q=tile] - -A %bush is a tile in which there are two kinds of nouns: cells -whose head is a cell (tile p) and cells whose head is an atom (tile -q). Its default value is the value of q. - -We don't have to look very far to find a %bush - ++tile is one, as -is ++twig and ++nock. The rune is $& (bucpam). See ++tile above - p -is [p=tile q=tile], q is the $%. There is no irregular form. - -What's the use of a %bush? Often in a variety of data structures we -have something like autocons, in which forming a cell of two -instances has an obvious default semantics. - -Sure, we could attach these semantics to an atom, and just use a -%kelp. In twigs, tiles, or nock formulas, we could have an explicit -cons stem of some sort. But it would be a bulky as compared to -autocons. - - [%fern p=[i=tile t=(list tile)]] - -A %fern is a non-empty list of cases; its icon is naturally a -%fork. The programmer is responsible for ensuring that the cases -are actually orthogonal (unlike with the structured forks, %bush, -%kelp and %reed). A good general practice is to use %ferns only -with %leafs. - -For example, a fern that could be %foo or %bar has the irregular -form ?(%foo %bar), or the regular form - - $? %foo - %bar - == - -The default value is the first - in this case, %foo. - - [%kelp p=[i=line t=(list line)]] - -A kelp is the workhorse of tiles - it provides the most common data -structure in any language, the discriminated union. - -In Hoon, the head (which must be a leaf) is called the stem. The -tail (which can be anything) is the bulb. Cases of a kelp are known -inevitably as fronds. - -(Yes. We're aware that "kelp" is not properly a singular noun. In -Hoon - it is properly a singular noun. And that's that. And oddly, -it's not that hard to run out of four-letter plants.) - -$%, buccen, is a tile rune that produces a %kelp. $% takes a list -of lines, which are labelled cases, closed by ==. - - $% p - q - == - [%leaf p=term q=@] - -A %leaf is an atomic constant of value q and odor p. Obviously its -icon is a %cube. - -The syntax for a leaf is the same as the twig syntax, except that % -is never required to generate a cube. For instance, as a twig, 7 -has a type of [%atom %ud]; %7 has a type of [%cube 7 [%atom %ud]]. -But the icon of the leaf 7 is, again, [%cube 7 [%atom %ud]]. - - [%reed p=tile q=tile] - -A %reed is a tile whose icon contains two kinds of nouns: atoms of -tile p and cells of tile q. - -There is no irregular form of %reed. The regular form is: - - $| ~ [@ @] == - -or in wide mode $|(~ [@ @]) - - [%herb p=twig] - -You can write your own tile which is just a gate, accepting a -sample of * and normalizing it as you choose. If you use a twig as -a tile, it's treated as an herb. - -For example, when we define a gate like ++base, as defined above -(remember that when we use a tile as a twig, we get the clam, ie, -the normalizing gate) base is just an arm which produces a gate. -Nothing has any idea that this gate is built from a tile of its -own. - -So when we parse [p=base q=base] as a tile, the parser builds the -noun: - -[[%bark %p %herb %cnzy %base] [%bark %q %herb %cnzy %base]] In -other words, base in p=base is actually a twig, but this twig -happens to produce a normalizing gate generated by clamming a tile. -In time this will come to seem totally straightforward, but don't -be surprised if it confuses you now. - -The important thing to remember about %herb is that the actual twig -we provide will be applied when we whip or clam. Hence, arbitrary -normalization and/or verification procedures may be part of the -herbaceous custom tile. +See the Tile section of the Hoon Reference. --- -###toga +###++toga - ++ toga :: face control - $| p=term :: two togas - $% [0 ~] :: no toga - [1 p=term q=toga] :: deep toga - [2 p=toga q=toga] :: cell toga - == :: +``` +++ toga :: face control + $| p=term :: two togas + $% [0 ~] :: no toga + [1 p=term q=toga] :: deep toga + [2 p=toga q=toga] :: cell toga + == :: +``` + + +A face, or tree of faces + + ~zod/try=> [a b]=[1 2 3] + [a=1 b=[2 3]] + ~zod/try=> (ream '[a b]=[1 2 3]') + [ %ktts + p=[%2 p=p=%a q=p=%b] + q=[%cltr p=~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]] + ] + + ~zod/try=> [a ~]=[1 2 3] + [a=1 2 3] + ~zod/try=> (ream '[a ~]=[1 2 3]') + [ %ktts + p=[%2 p=p=%a q=[%0 ~]] + q=[%cltr p=~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]] + ] --- -###trap +###++trap - ++ trap ,_|.(_*) :: makes perfect sense +``` +++ trap ,_|.(_*) :: makes perfect sense +``` + + +A trap is a core with one arm `++$` + + ~zod/try=> *trap + <1.mws 101.jzo 1.ypj %164> + ~zod/try=> (*trap) + 0 --- -###trel +###++trel - ++ trel |* [a=$+(* *) b=$+(* *) c=$+(* *)] :: just a triple - ,[p=a q=b r=c] :: +``` +++ trel |* [a=$+(* *) b=$+(* *) c=$+(* *)] :: just a triple + ,[p=a q=b r=c] :: +``` + +Tile constructor: three items. + + ~zod/try=> *(trel ,@ud ,@t ,@s) + [p=0 q='' r=--0] + --- -###tuna +###++tuna + +``` +++ tuna :: tagflow + $% [%a p=twig] :: plain text + [%b p=twig] :: single tag + [%c p=twig] :: simple list + [%d p=twig] :: dynamic list + [%e p=twig q=(list tuna)] :: element + [%f p=(list tuna)] :: subflow + == :: +``` -++ tuna An XML template tree. @@ -891,2556 +1334,676 @@ tuna, and %f is a empty node. --- -###twig +###++twig -++ twig TODO: delete Form, normalize indentation +See Twig section of Hoon reference -A twig is an abstract syntax tree or AST, which we produce when we -parse a Hoon expression, file, etc. A twig is a noun that's converted -into a Nock formula, with the assistance of a type which describes the -subject of the formula: +--- - [subject-type twig] => formula +###++tine -But actually this isn't quite right, because Hoon does something called -"type inference." When we have a type that describes the subject for -the formula we're trying to generate, as we generate that formula we -want to also generate a type for the product of that formula on that -subject. So our compiler computes: +``` +++ tine (list ,[p=tile q=twig]) :: +``` - [subject-type twig] => [product-type formula] -As long as subject-type is a correct description of some subject, you -can take any twig and compile it against subject-type, producing a -formula such that *(subject formula) is a product correctly described -by product-type. +Switch statement cases -Actually, this works well enough that in Hoon there is no direct syntax -for defining or declaring a type. There is only a syntax for -constructing twigs. Types are always produced by inference. + ~zod/try=> (ream '?-(!! @ |, ^ &)') + [ %wthz + p=[%.n p=~ q=[%zpzp ~]] + q + ~[ + [p=[%axil p=[%atom p=~.]] q=[%dtzy p=%f q=1]] + [p=[%axil p=%cell] q=[%dtzy p=%f q=0]] + ] + ] + ~zod/try=> (tine |2:(ream '?-(!! @ |, ^ &)')) + ~[ + [p=[%axil p=[%atom p=~.]] q=[%dtzy p=%f q=1]] + [p=[%axil p=%cell] q=[%dtzy p=%f q=0]] + ] -There are 112 cases of ++twig +--- - [p=twig q=twig] +###++tusk -A twig can be a pair of twigs. +``` +++ tusk (list twig) :: +``` - [%$ p=axis] + +Variable-arity expression list. -Refers to a nock axis. + ~zod/try=> (ream '[1 2 3]') + [%cltr p=~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]] + ~zod/try=> (tusk +:(ream '[1 2 3]')) + ~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]] - [%bccb p=tile] +--- -$_ ("buccab") is a synthetic hoon that produces the bunt (default -value) for p. +###++tyre - Tall - $_ p +``` +++ tyre (list ,[p=term q=twig]) :: +``` - Wide - $_(p) + +Assciative list of term to twig, used in jet hint processing. - Irregular - _p - - Reduction - See ++open - [%bccm p=tile] -$, ("buccom") is a synthetic rune that produces a normalizing gate -(clam) for p. +--- - Talln - $, p +###++tyke - Wide - none +``` +++ tyke (list (unit twig)) :: +``` - Irregular - ,p - Reduction - ~(clam al p) - - See ++clam in ++al. +List of twigs or gaps left to be inferred, in path parsing. - [%bcpt p=wing q=tile] + ~zod/try=> (scan "/==as=" porc:vast) + [0 ~[~ ~ [~ [%dtzy p=%tas q=29.537]] ~]] + ~zod/try=> `tyke`+:(scan "/==as=" porc:vast) + ~[~ ~ [~ [%dtzy p=%tas q=29.537]] ~] -$@ ("bucpat") is a (just barely) natural hoon that whips wing p -into tile q. +--- - Tall - $@ p - q +###++tram - Wide - $@(p q) +``` +++ tram (list ,[p=wing q=twig]) :: +``` - Irregular - p@q + +List of changes by location in context - Reduction - none, natural + ~zod/try=> (ream '$(a 1, b 2)') + [ %cnts + p=~[%$] + q=~[[p=~[%a] q=[%dtzy p=%ud q=1]] [p=~[%b] q=[%dtzy p=%ud q=2]]] + ] + ~zod/try=> (tram +:(ream '$(a 1, b 2)')) + ~[[p=~ q=[% p=0]] [p=~[%a] q=[%dtzy p=%ud q=1]] [p=~[%b] q=[%dtzy p=%ud q=2]]] - [%bctr p=tile] -$* ("buctar") is a synthetic rune that produces the bunt (default -value) for p as a compile-time constant. +--- - Tall - $* p +###++nock - Wide - $*(p) +``` +++ nock $& [p=nock q=nock] :: autocons + $% [%0 p=@] :: axis select + [%1 p=*] :: constant + [%2 p=nock q=nock] :: compose + [%3 p=nock] :: cell test + [%4 p=nock] :: increment + [%5 p=nock q=nock] :: equality test + [%6 p=nock q=nock r=nock] :: if, then, else + [%7 p=nock q=nock] :: serial compose + [%8 p=nock q=nock] :: push onto subject + [%9 p=@ q=nock] :: select arm and fire + [%10 p=?(@ [p=@ q=nock]) q=nock] :: hint + [%11 p=nock] :: grab data from sky + == :: +``` - Reduction - ^~ ~(bunt al p) - - See ++bunt in al. - [%bczp p=base] +See [**Nock**] doc -$! ("buczap") is a synthetic internal rune that produces the bunt -(default value) for [%axil p]. + ~zod/try=> !=([+(.) 20 -<]) + [[4 0 1] [1 20] 0 4] + ~zod/try=> (nock !=([+(.) 20])) + [p=[%4 p=[%0 p=1]] q=[%1 p=20]] - Reduction - See ++open +--- - [%brcb p=tile q=(map term foot)] +###++tone -|_ ("barcab") is a synthetic rune that produces a %gold tray with -sample p, arms q. q is an associative array of names and -expressions, each pair of which is called an arm. After any number -of dry (%ash, ++) and/or wet (%elm, +-) arms, the array is -terminated with -- +``` +++ tone $% [%0 p=*] :: success + [%1 p=(list)] :: blocks + [%2 p=(list ,[@ta *])] :: error ~_s +:: :::::: virtual nock +``` - Tall - |_ p - ++ p.n.q - q.n.q - -- - Wide - none - - Irregular - none +Intermediate computation result: like `toon`, but stack trace +has not been rendered - Reduction - See ++open + ~zod/try=> (mink [[20 21] 0 3] ,~) + [%0 p=21] + + ~zod/try=> (mink [[0] !=(.^(cy//=main/1))] ,~) + [%1 p=~[[31.075 1.685.027.454 1.852.399.981 49 0]]] + ~zod/try=> (path [31.075 1.685.027.454 1.852.399.981 49 0]) + /cy/~zod/main/1 + + ~zod/try=> (mink [[1 2] !=(~|(%hi +(.)))] ,~) + [%2 p=~[[~.yelp 26.984]]] + ~zod/try=> (mink [[1 2] !=(!:(+(.)))] ,~) + [ %2 + p + ~[ + [ ~.spot + [ [ 1.685.027.454 + 7.959.156 + \/159.445.990.350.374.058.574.398.238.344.143.957.205.628.479.572.65\/ + 8.112.403.878.526 + \/ \/ + 0 + ] + [1 20] + 1 + 24 + ] + ] + ] + ] - [%brcn p=(map term foot)] -|% ("barcen") is a natural rune that produces a %gold core from an -associative array of names and expressions, each pair of which is -called an arm. After any number of dry (%ash, ++) and/or wet (%elm, -+-) arms, the array is terminated with -- +--- - Tall - |% - ++ p.n.q - q.n.q - +- p.n.l.q - q.n.l.q - -- +###++toon - Wide - none +``` +++ toon $% [%0 p=*] :: success + [%1 p=(list)] :: blocks + [%2 p=(list tank)] :: stack trace + == :: +``` + + +Nock computation result: success, block with list of requests blocked on, +or failure with stack trace. + + ~zod/try=> (mock [[20 21] 0 3] ,~) + [%0 p=21] + + ~zod/try=> (mock [[0] !=(.^(cy//=main/1))] ,~) + [%1 p=~[[31.075 1.685.027.454 1.852.399.981 49 0]]] + ~zod/try=> (path [31.075 1.685.027.454 1.852.399.981 49 0]) + /cy/~zod/main/1 + + ~zod/try=> (mock [[1 2] !=(!:(+(.)))] ,~) + [%2 p=~[[%leaf p="/~zod/try/~2014.9.23..18.34.32..d3c5/:<[1 20].[1 24]>"]]] + +--- + +###++tune + +``` +++ tune $% [%0 p=vase] :: + [%1 p=(list)] :: + [%2 p=(list ,[@ta *])] :: + == :: +``` - Irregular - none - Reduction - none, natural +XX Unused - [%brdt p=twig] +Probably typed `tone`? -|. ("bardot") is a synthetic rune that produces a dry %gold trap -from twig p. +--- - Tall - |. p +###++twin - Wide - |.(p) +``` +++ twin ,[p=term q=wing r=axis s=type] :: alias info +``` - Irregular - none - Reduction - See ++open +Used in `%bull` `++type` + + ~zod/try=> (~(busk ut %cell %noun [%atom %ud]) %fal [%& 3]~) + [ %bull + p=[p=%fal q=~[[%.y p=3]] r=3 s=[%atom p=%ud]] + q=[%cell p=%noun q=[%atom p=%ud]] + ] + ~zod/try=> &2:(~(busk ut %cell %noun [%atom %ud]) %fal [%& 3]~) + p=[p=%fal q=~[[%.y p=3]] r=3 s=[%atom p=%ud]] + ~zod/try=> (twin &2:(~(busk ut %cell %noun [%atom %ud]) %fal [%& 3]~)) + [p=%fal q=~[[%.y p=3]] r=3 s=[%atom p=%ud]] - [%brfs p=tile q=(map term foot)] +--- -|/ ("barfas") is a synthetic rune that produces a vulcanized %gold -tray with arms q, sample p. +###++type + +See Type section of Hoon reference - Tall - |/ p - +- p.n.q - q.n.q - -- +--- + +###++typo - Wide - none +``` +++ typo type :: old type +``` - Irregular - none + +Pointer for `++type`. `++typo` preserves the previous `++type` in +your context when upating. - Reduction - See ++open +See also: `++seem`, `++vise`, `++type` - [%brkt p=twig q=(map term foot)] +--- -|^ ("barket") is a synthetic rune that produces a %gold book with -arms q, with p as %$, and kicks it. +###++udal - Tall - |^ p - ++ p.n.q - q.n.q - -- - - Wide - none +``` +++ udal :: atomic change (%b) + $: p=@ud :: blockwidth + q=(list ,[p=@ud q=(unit ,[p=@ q=@])]) :: indels + == :: +``` - Irregular - none - Reduction - See ++open +XX Unused - [%brhp p=twig] +--- -|- ("barhep") is a synthetic rune that produces a dry %gold trap -from twig p, and kicks it. +###++udon - Tall - |- - p +``` +++ udon :: abstract delta + $: p=umph :: preprocessor + $= q :: patch + $% [%a p=* q=*] :: trivial replace + [%b p=udal] :: atomic indel + [%c p=(urge)] :: list indel + [%d p=upas q=upas] :: tree edit + == :: + == :: +``` - Wide - |-(p) - Irregular - none +See `%clay` doc - Reduction - See ++open +--- - [%brls p=tile q=twig] +###++umph -|+ ("barlus") is a synthetic rune that produces a dry %iron gate -with arm q, sample p. +``` +++ umph :: change filter + $| $? %a :: no filter + %b :: jamfile + %c :: LF text + == :: + $% [%d p=@ud] :: blocklist + == :: +``` - Tall - |+ p - q - - Wide - |+(p q) - - Irregular - none - - Reduction - See ++open - - [%brpt p=tile q=tile r=twig] - - XX not used - - [%brtr p=tile q=twig] - -|* ("bartar") is a synthetic rune that produces a vulcanized wet -gate with arm q, sample p. - - Tall - |* p - q - - Wide - |*(p q) - - Irregular - none - - Reduction - See ++open - - [%brts p=tile q=twig] - -|= ("bartis") is a synthetic hoon that produces a dry %gold gate -with arm q, sample p. - - Tall - |= p - q - - Wide - |=(p q) - - Irregular - none - - Reduction - See ++open - - [%brwt p=twig] - -|? ("barwut") is a synthetic rune that produces a dry %lead trap. - - Tall - |? p - - Wide - |?(p) - - Irregular - none - - Reduction - See ++open - - [%clcb p=twig q=twig] - -:_ ("colcab") is a synthetic rune that produces the cell [q p]. - - Tall - :_ p - q - - Wide - :_(p q) - - Irregular - none - - Reduction - See ++open - - [%clcn p=tusk] - -:% ("colcen") is a synthetic rune that produces a cell [[p ~] ~] -from a list of twigs p, terminated by a == - - Tall - :% i.p - i.t.p - i.t.t.p - == - - Wide - :%(i.p i.t.p i.t.t.p) - - Irregular - %[i.p i.t.p i.t.t.p] - - Reduction - See ++open - - [%clfs p=twig] - -:/ ("colfas") is a synthetic rune that, given a twig p, produces -[%$ [%$ p ~] ~], i.e., [0 [0 p 0] 0]. Used in practice only in -string interpolation. - - Tall - :/ p - - Wide - :/(p) - - Irregular - none - - Reduction - See ++open - - [%clkt p=twig q=twig r=twig s=twig] - -:^ ("colket") is a synthetic rune that produces a cell [p q r s] -from twigs p, q, r, and s. - - Tall - :^ p - q - r - s - - Wide - :^(p q r s) - - Irregular - none - - Reduction - See ++open - - [%clhp p=twig q=twig] - -:- ("colhep") is a synthetic rune that produces the cell [p q] from -twigs p and q. - - Tall - :- p - q - - Wide - :-(p q) - - Irregular - [p q] - - Reduction - See ++open - - [%clls p=twig q=twig r=twig] - -:+ ("collus") is a synthetic rune that produces a cell [p q r] from -twigs p, q, and r. - - Tall - :+ p - q - r - - Wide - :+(p q r) - - Irregular - none - - Reduction - See ++open - - [%clsg p=tusk] - -:~ ("colsig") is a synthetic rune that produces a null-terminated -tuple of a list of twigs p. - - Tall - :~ i.p - i.t.p - i.t.t.p - == - - Wide - :~(i.p i.t.p i.t.t.p) - - Irregular - ~[i.p i.t.p i.t.t.p] - - Reduction - See ++open - - [%cltr p=tusk] - -:* ("coltar") is a synthetic hoon that produces a tuple from p, a -list of twigs. - - Tall - :* i.p - i.t.p - i.t.t.p - == - - Wide - :*(i.p i.t.p i.t.t.p) - - Irregular - [i.p i.t.p i.t.t.p] - - Reduction - See ++open - - [%clzz p=tusk] - -"colzaz" is a synthetic internal rune that promotes its tusk p -within a %clsg or %cltr tusk. - - Not used at present. - - [%cncb p=wing q=tram] - -%_ ("cencab") is a synthetic rune that evaluates the wing p with -the changes specified in tram q, then casts the product back to p. - - Tall - %_ p - p.i.q q.i.q - p.i.t.q q.i.t.q - == - - Wide - %_(p p.i.q q.i.q, p.i.t.q q.i.t.q) - - Irregular - none - - Reduction - See ++open - - [%cncl p=twig q=twig] - -%: ("cencol") is a synthetic rune that pulls %$ from the twig p -with the with its sample set to q. - - Tall - %: p - q - - Wide - %:(p q) - - Irregular - none - - Reduction - See ++open - - [%cndt p=twig q=twig] - -%. ("cendot") is a synthetic rune that slams the gate q with -[%cltr p]. The dual of %cnhp. - - Tall - %. p - q - - Wide - %.(p q) - - Irregular - none - - Reduction - %- q - p - - See ++open - - [%cnhp p=twig q=tusk] - -%- ("cenhep") is a synthetic rune that slams the gate p with -[%cltr q]. - - Tall - %- p - q - - Wide - %-(p q) - - Irregular - (p q) - - Reduction - See ++open - - [%cntr p=wing q=twig r=tram] - -%* is a synthetic rune that pulls the wing p from tray q with changes r. - - Tall - %* p q - p.i.r q.i.r - p.i.t.r q.i.t.r - == - - Wide - %*(p q p.i.r q.i.r, p.i.t.r q.i.t.r) - - Irregular - none - - Reduction - See ++open - - [%cnkt p=twig q=twig r=twig s=twig] - -%^ ("cenket") is a synthetic rune that slams gate p with [%cntr q r s]. - - Tall - %^ p - q - r - s - - Wide - %^(p q r s) - - Irregular - none - - Reduction - See ++open - - [%cnls p=twig q=twig r=twig] - -%+ ("cenlus") is a synthetic rune that slams gate p with [%cntr q r]. - - Tall - %+ p - r - s - - Wide - %+(p q r) - - Irregular - none - - Reduction - See ++open - - [%cnsg p=wing q=twig r=twig] - -%~ ("censig") is a synthetic rune that pulls p from the tray q with its -sample set to r. - - Tall - %~ p - q - r - - Wide - %~(p q r) - - Irregular - ~(p q r) - - Reduction - See ++open - - [%cnts p=wing q=tram] - -%= ("centis") is a natural rune that evaluates p with the changes -specified in q. - - Tall - %= p - p.i.q q.i.q - p.i.t.q q.i.t.q - == - - Wide - %=(p p.i.q q.i.q, p.i.t.q q.i.t.q) - - Irregular - p(p.i.q q.i.q, p.i.t.q q.i.t.q) - - Reduction - See ++open - - [%cnzy p=term] - -"cenzey" is a synthetic internal rune that pulls limb p from the subject. - - Tall/Wide/Irregular - none, internal - - Reduction - See ++open - - [%cnzz p=wing] - -"cenzaz" is a synthetic internal rune that pulls wing p from the subject. - - Form - none, internal - - Reduction - See ++open - - [%dtkt p=twig] - -.^ ("dotket") is a natural rune that generates Nock operator 11, which in -virtual userspace Nock (++mock) loads a file from the global namespace. - - Tall - .^ p - - Wide - .^(p) - - Irregular - ^:type/path - - ^/path - - Reduction - none, natural - - [%dtls p=twig] - -.+ ("dotlus") is a natural rune that generates Nock operator 4, which -increments an atomic operand. - - Tall - .+ p - - Wide - .+(p) - - Irregular - +(p) - - Reduction - none, natural - - [%dtzy p=term q=@] - -"dotzey" is a natural internal rune that produces a non-cubed atomic -constant of odor p and value q. - - Tall/Wide/Irregular - none, internal - - Reduction - none, natural - - [%dtzz p=term q=*] - -"dotzaz" is a natural internal rune that produces a cubed noun constant of -value q and odor p, if q is an atom. - - Tall/Wide/Irregular - none, internal - - Reduction - none, natural - - [%dttr p=twig q=twig] - -.* ("dottar") is a natural rune that calculates the Nock of subject p, -formula q. - - Tall - .* p - q - - Wide - .*(p q) - - Irregular - none - - Reduction - none, natural - - [%dtts p=twig q=twig] - -.= ("dottis") is a natural rune that applies Nock 5 (equals) to determine -if the products of p and q are equivalent. - - Tall - .= p - q - - Wide - .=(p q) - - Irregular - =(p q) - - Reduction - none, natural - - [%dtwt p=twig] - -.? ("dotwut") is a natural hoon that applies Nock 3 to a noun: if the -noun is a cell, it returns the loobean & (true); if the noun is an atom, -it returns the loobean | (false). - - Tall - .? p - - Wide - .?(p) - - Irregular - none - - Reduction - none, natural - - [%hxgl p=tusk] - -#< ("haxgal") is a synthetic rune that slams the assumed gate noah on -[%zpgr %cntr p]. See the Biblical names. - - Tall/Wide - none - - Irregular - >i.p i.t.p i.t.t.p< - - Reduction - See ++open - - [%hxgr p=tusk] - -#> ("haxgar") is a synthetic rune that slams the assumed gate cain on -[%zpgr %cntr p]. See the Biblical names. - - Tall/Wide - none - - Irregular - - - Reduction - See ++open - - [%ktbr p=twig] - -^| ("ketbar") is a natural rune that converts a %gold core into an %iron -core. See geometric polymorphism. - - Tall - ^| p - - Wide - ^|(p) - - Irregular - none - - Reduction - none, natural - - [%ktdt p=twig q=twig] - -^. ("ketdot") is a synthetic rune that casts q to the type of (p q). - - Tall - ^. p - q - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%ktls p=twig q=twig] - -^+ ("ketlus") is a natural rune that casts the product of q to the -type of p, verifying that it contains the type of q. - - Tall - +^ p - q - - Wide - ^+(p q) - - Irregular - none - - Reduction - none, natural - - [%kthp p=tile q=twig] - -^- ("kethep") is a synthetic rune that casts q to ~(bunt al p), -i.e., the icon of p. - - Tall - ^- p - q - - Wide - ^-(p q) - - Irregular - `p`q - - Reduction - See ++open - - [%ktpm p=twig] - -^& ("ketpam") is a natural rune that converts a %gold core to %zinc core. -See geometric polymorphism. - - Tall - ^& p - - Wide - ^&(p) - - Irregular - none - - Reduction - none, natural - - [%ktsg p=twig] - -^~ ("ketsig") is a natural rune that tries to execute p statically at -compile time; if this fails, p remains dynamic. - - Tall - ^~ p - - Wide - ^~(a) - - Irregular - none - - Reduction - none, natural - - [%ktts p=toga q=twig] - -^= ("kettis") is a natural rune that wraps q in the toga p. The -toga is a powerful naming device that can assign an entire name -tree to a properly typed result. For instance, if foo produces -an unlabeled tuple [x y z], [a b=[c d]]=foo produces -[a=x b=[c=y d=z]]. - - Tall - ^= p - q - - Wide - ^=(p q) - - Irregular - none - - Reduction - none, natural - - [%ktwt p=twig] - -^? ("ketwut") is a natural hoon that converts a %gold core into a -%lead core. See geometric polymorphism. - - Tall - ^? p - - Wide - ^?(p) - - Irregular - none - - Reduction - none, natural - - [%sgbr p=twig q=twig] - -~| ("sigbar") is a synthetic rune that presents the product of p -in the stack trace if q crashes. Only performed as needed. -Generates %cain - see the Biblical names. - - Tall - ~| p - q - - Wide - ~|(p q) - - Irregular - none - - Reduction - See ++open, ++feck - - [%sgcb p=twig q=twig] - -~_ ("sigcab") is a synthetic rune that inserts p, a trap producing a tank, -into the trace of q. - - Tall - ~_ p - q - - Wide - ~_(p q) - - Irregular - none - - Reduction - See ++open - - [%sgcn p=chum q=twig r=tyre s=twig] - -~% ("sigcen") is a synthetic rune that identifies a core for specific -optimization. See jet propulsion. - - Tall - ~% p - q - == - p.i.r q.i.r - p.i.t.r q.i.t.r - == - s - - ~% p - q - ~ - s - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%sgfs p=chum q=twig] - -~/ ("sigfas") is a synthetic rune that identifies an arm for specific -optimization. See jet propulsion. - - Tall - ~/ p - q - - Wide - ~/(p q) - - Irregular - none - - Reduction - See ++open - - [%sggl p=$|(term [p=term q=twig]) q=twig] - -~< ("siggal") is a synthetic rune that applies arbitrary hint p to -the product of q. Does not wake the hint engine until the -computation is finished. - - Tall - ~< p - q - - Wide - ~<(p q) - - Irregular - none - - Reduction - See ++open - - [%sggr p=$|(term [p=term q=twig]) q=twig] - -~> ("siggar") is a natural rune that applies arbitrary hint p to q. - - Tall - ~> p - q - - Wide - ~>(p q) - - Irregular - none - - Reduction - See ++open - - [%sgbc p=term q=twig] -~$ ("sigbuc") is a synthetic rune that labels computation q as p -for profiling (not currently enabled). +See `%clay` doc - Tall - ~$ p - q - - Wide - ~$(p q) - - Irregular - none - - Reduction - See ++open - - [%sgls p=@ q=twig] - -XX Solve ~+ ("siglus") is a synthetic rune that memoizes computation q - Tall +--- - Wide +###++unce - Irregular +``` +++ unce |* a=_,* :: change part + $% [%& p=@ud] :: skip[copy] + [%| p=(list a) q=(list a)] :: p -> q[chunk] + == :: +``` - Reduction - See ++open - [%sgpm p=@ud q=twig r=twig] +See `%clay` doc -~& ("sigpam") is a synthetic rune that prints q on the console -before computing r. p is the log priority 0-3, defaulting to 0. +--- - Tall - 0, debug - ~& q - r +###++unit - 1, notice - ~& > q - r +``` +++ unit |* a=_,* :: maybe + $|(~ [~ u=a]) :: +``` - 2, warning - ~& >> q - r - 3, alarm - ~& >>> q - r +Tile constructor: option. - Wide - ~&(>>> q r) + ~zod/try=> :type; *(unit time) + ~ + u(@da) + ~zod/try=> `(unit time)`[~ -<-] + [~ ~2014.9.24..19.25.10..7dd5] - Irregular - none +--- - Reduction - See ++open +###++upas - [%sgts p=twig q=twig] +``` +++ upas :: tree change (%d) + $& [p=upas q=upas] :: cell + $% [%0 p=axis] :: copy old + [%1 p=*] :: insert new + [%2 p=axis q=udon] :: mutate! + == :: +``` -~= ("sigtis") is a synthetic rune that hints to the interpreter -that q may produce a noun equal to the already existing p, -avoiding duplication. - Tall - ~= p - q +See `%clay` doc - Wide - ~=(p q) - - Irregular - none +--- - Reduction - See ++open +###++urge - [%sgwt p=@ud q=twig r=twig s=twig] +``` +++ urge |*(a=_,* (list (unce a))) :: list change +``` -~? ("sigwut") is a synthetic rune that prints r to the console -before computing s, iff q produces yes. p is the log priority, -0-3, 0 by default + +See `%clay` doc - Tall - 0, debug - ~? q - r - s +--- - 1, notice - ~? > q - r - s +###++vase - 2, warning - ~? >> q - r - s +``` +++ vase ,[p=type q=*] :: type-value pair +``` - 3, alarm - ~? >>> q - r - s - - Wide - ~?(>>> q r s) + +Used by compiler, and wherever typed date is worked with explicitly - Irregular - none + ~zod/try=> `vase`!>(~) + [p=[%cube p=0 q=[%atom p=%n]] q=0] - Reduction - See ++open +--- - [%sgzp p=twig q=twig] +###++vise -~! ("sigzap") is a natural rune for debugging uses only, -semantically equivalent to its own twig q. Should compilation -fail within q, ~! will show the type of p on the stacktrace. +``` +++ vise ,[p=typo q=*] :: old vase +``` - Tall - ~! p - q + +Used to convert from previously-typed data during reboot. - Wide - ~!(p q) +See `++typo`, `++seer` - Irregular - none +--- - Reduction - none, natural +###++wall - [%smcl p=twig q=tusk] +``` +++ wall (list tape) :: text lines (no \n) +``` -;: ("semcol") is a synthetic gate that applies p, a binary gate, -to the n-ary tuple q. + +Used where lists are convenient - Tall - ;: p - i.q - i.t.q - i.t.t.q - == + ~zod/try=> `wall`(wash [0 20] leaf/<(bex 256)>) + << + "\/115.792.089.237.\/" + " 316.195.423.570." + " 985.008.687.907." + " 853.269.984.665." + " 640.564.039.457." + " 584.007.913.129." + " 639.936" + "\/ \/" + >> - Wide - ;:(p i.q i.t.q i.t.t.q) - Irregular - :(p i.q i.t.q i.t.t.q) +--- - Reduction - See ++open +###++wain - [%smdt p=twig q=tusk] -XX determine function - - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%smdq p=(list beer)] -XX determine if internal/external - -;" ("semdoq") is a synthetic rune used to make strings, -interpolated or not. - - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%smsg p=twig q=tusk] - -XX to do - - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%smsm p=twig q=twig] - -;; ("semsem") is a synthetic rune that types q as a fixpoint of p. -Semantically identical to ((hard p) q). - - Tall - ;; p - q - - Wide - ;;(p q) - - Irregular - none - - Reduction - See ++open - - [%tsbr p=tile q=twig] - -=| ("tisbar") is a synthetic rune that pushes ~(bunt al p) on the -subject and sends it to q. - - Tall - =| p - q - - Wide - =|(p q) - - Irregular - none - - Reduction - =+(_p q) - See ++open, ++bunt in ++al - - [%tscl p=tram q=twig] - -=: ("tiscol") is a synthetic rune that produces q with the subject -by p. Uses %cncb, and so cannot change the subject type. - - Tall - =: p.i.p q.i.p - p.i.t.p q.i.t.p - p.i.t.t.p q.i.t.t.p - == - q - - Wide - none - - Irregular - noen - - Reduction - See ++open - - [%tscn p=twig q=twig] -XX to do - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%tsdt p=wing q=twig r=twig] - -=. ("tisdot") is a synthetic rune that produces r with p in the -subject set to q. Uses %cncb, and so cannot change the subject - p. - - Tall - =. p +``` +++ wain (list cord) :: text lines (no \n) +``` + + +Line list, instead of control characrters + + ~zod/try=> `wain`/som/del/rok + <|som del rok|> + ~zod/try=> `wain`(lore ^:@t/=main=/bin/tree/hoon) + <| + !: + :: /===/bin/tree/hoon + |= ^ + |= [pax=path fla=$|(~ [%full ~])] + =- ~[te/-]~ + =+ len=(lent pax) + =+ rend=?~(fla |=(a=path +:(spud (slag len a))) spud) + |- ^- wain + =+ ark=;;(arch .^(cy/pax)) + =- ?~ q.ark - + [(crip (rend pax)) -] + %- zing + %- turn :_ |=(a=@t ^$(pax (weld pax `path`/[a]))) + %- sort :_ aor + %- turn :_ |=([a=@t ~] a) + (~(tap by r.ark)) + |> + +--- + +###++wing + +``` +++ wing (list limb) :: +``` + + +Adress in subject + + ~zod/try=> `wain`/som/del/rok + <|som del rok|> + ~zod/try=> `wain`(lore (,@ .^(cx//=main=/bin/tree/hoon))) + <| + !: + :: /===/bin/tree/hoon + |= ^ + |= [pax=path fla=$|(~ [%full ~])] + =- ~[te/-]~ + =+ len=(lent pax) + =+ rend=?~(fla |=(a=path +:(spud (slag len a))) spud) + |- ^- wain + =+ ark=;;(arch .^(cy/pax)) + =- ?~ q.ark - + [(crip (rend pax)) -] + %- zing + %- turn :_ |=(a=@t ^$(pax (weld pax `path`/[a]))) + %- sort :_ aor + %- turn :_ |=([a=@t ~] a) + (~(tap by r.ark)) + |> + +--- + +###++wine + +``` +++ wine $| ?(%noun %path %tank %void %wall %wool %yarn) + $% [%atom p=term] :: + [%core p=(list ,@ta) q=wine] :: + [%face p=term q=wine] :: + [%list p=term q=wine] :: + [%pear p=term q=@] :: + [%pick p=(list wine)] :: + [%plot p=(list wine)] :: + [%stop p=@ud] :: + [%tree p=term q=wine] :: + [%unit p=term q=wine] :: + == :: +``` + + +Printable type. + + + ~zod/try=> ~(dole ut p:!>(*@tas)) + [p={} q=[%atom p=%tas]] + ~zod/try=> `wine`q:~(dole ut p:!>(*@tas)) + [%atom p=%tas] + + ~zod/try=> ~(dole ut p:!>(*path)) + [ p + { [ p=1 q - r - - =. p q - r - - Wide - =.(p q r) - - Irregular - none - - Reduction - See ++open - - [%tsfs p=twig q=twig] - XX not used - - [%tsgl p=twig q=twig] - -=< ("tisgal") is a synthetic rune that uses the product of q as -the subject of p. - - Tall - =< p - q - - Wide - =<(p q) - - Irregular - - Reduction - See ++open - - [%tshp p=twig q=twig] - -=- ("tishep") is a synthetic rune that pushes q on the subject -and sends it to p. Dual of =+ ("tislup") - - - Tall - =- p - q - - Wide - =- - - Irregular - none - - Reduction - See ++open - - [%tsgr p=twig q=twig] - -=> ("tisgar") is a natural rune that uses the product of p as the -subject of q. - - Tall - => p - q - - Wide - =>(p q) - - Irregular - none - - Reduction - none, natural - - [%tskt p=twig q=twig r=twig s=twig] - -=^ ("tisket") is a synthetic rune that handles a product which is -a cell of the new result, and a mutation to the subject. - - Tall - Kingside - =^ p - q - r - s - - Queenside - =^ p q - r - s - - Wide - =^(p q r s) - - Irregular - none - - Reduction - See ++open - - [%tsls p=twig q=twig] - -=+ ("tislus") is a synthetic rune that pushes p on the subject -and sends it to q. Semantically equavlent to Nock 8.Dual of =- ("tishep") - - Tall - =+ p - q - - Wide - =+(p q) - - Irregular - none - - Reduction - See ++open - - [%tspm p=tile q=twig] - - XX not used - - [%tspt p=tile q=twig] - - XX not used - - [%tstr p=term q=wing r=twig] - -=* ("tistar") is a natural rune that creates a %bull, or alias, -type. - - Tall - =* p q - r - - Wide - =*(p q r) - - Irregular - none - - Reduction - none, natural - - [%tssg p=tusk] - -=~ ("tissig") is a synthetic rune that composes a list of twigs. - - Tall - Kingside - =~ i.p - i.t.p - i.t.t.p - == - - Queenside - =~ i.p - i.t.p - i.t.t.p - == - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%wtbr p=tusk] - -?| ("wutbar") is a synthetic rune that computes the "or" of the -loobeans in p. - - Tall - ?| i.p - i.t.p - i.t.t.p - == - - Wide - ?|(i.p i.t.p i.t.t.p) - - Irregular - |(i.p i.t.p i.t.t.p) - - Reduction - See ++open - - [%wthp p=wing q=tine] - -?- ("wuthep") is a synthetic rune that selects a case in q for -the actual type of p. - - Tall - Kingside - ?- p - p.i.q q.i.q - p.i.t.q q.i.t.q - p.i.t.t.q q.i.t.t.q - == - - Queenside - ?- p - p.i.q - q.i.q - p.i.t.q - q.i.t.q - p.i.t.t.q - q.i.t.t.q - == - - Wide - ?-(p p.i.q q.i.q, p.i.t.q q.i.t.q, p.i.t.t.q q.i.t.t.q) - - Irregular - none - - Reduction - See ++open - - [%wthz p=tiki q=tine] - -"wuthaz" is a synthetic internal rune that selects a case in q -for the actual type of p. - - Tall/Wide/Irregular - none, internal - - Reduction - See ++open - - [%wtcl p=twig q=twig r=twig] - -?: ("wutcol") is a natural rune that produces q if p is yes (&, 0), -or r if p is no (|, 1). - - Tall - ?: p - q - r - - Wide - ?:(p q r) - - Irregular - none - - Reduction - none, natural - - [%wtdt p=twig q=twig r=twig] - -?. ("wutdot") is a synthetic rune that prduces r if p is yes -(&, 0), of q if p is no (|, 1). - - Tall - ?. p + [ %pick + p + ~[ + [%pear p=%n q=0] + [%plot p=~[[%face p=%i q=[%atom p=%ta]] [%face p=%t q=[%stop p=1]]]] + ] + ] + ] + } + q=%path + ] + ~zod/try=> `wine`q:~(dole ut p:!>(*path)) + %path + + ~zod/try=> ~(dole ut p:!>(*(map time cord))) + [ p + { [ p=1 q - r + [ %pick + p + ~[ + [%pear p=%n q=0] + [ %plot + p + ~[ + [ %face + p=%n + q + [ %plot + p=~[[%face p=%p q=[%atom p=%da]] [%face p=%q q=[%atom p=%t]]] + ] + ] + [%face p=%l q=[%stop p=1]] + [%face p=%r q=[%stop p=1]] + ] + ] + ] + ] + ] + } + q + [ %tree + p=%nlr + q=[%plot p=~[[%face p=%p q=[%atom p=%da]] [%face p=%q q=[%atom p=%t]]]] + ] + ] + ~zod/try=> `wine`q:~(dole ut p:!>(*(map time cord))) + [ %tree + p=%nlr + q=[%plot p=~[[%face p=%p q=[%atom p=%da]] [%face p=%q q=[%atom p=%t]]]] + ] + +--- + +###++wonk + +``` +++ wonk |*(veq=edge ?~(q.veq !! p.u.q.veq)) :: +:: :: +:: :: +``` + + +Forcibly pull result out of edge + +XX Not a model? + + ~zod/try=> (wide:vast [1 1] "(add 2 2)") + [ p=[p=1 q=10] + q + [ ~ + [ p=[%cnhp p=[%cnzz p=~[%add]] q=~[[%dtzy p=%ud q=2] [%dtzy p=%ud q=2]]] + q=[p=[p=1 q=10] q=""] + ] + ] + ] + ~zod/try=> (wonk (wide:vast [1 1] "(add 2 2)")) + [%cnhp p=[%cnzz p=~[%add]] q=~[[%dtzy p=%ud q=2] [%dtzy p=%ud q=2]]] + +--- + +###++map + +``` +++ map |* [a=_,* b=_,*] :: associative array + $|(~ [n=[p=a q=b] l=(map a b) r=(map a b)]) :: +``` + + +Tile constructor: treap of pairs + +Used with `++by` engine. + + ~zod/try=> :type; *(map ,@t ,@u) + {} + nlr([p=@t q=@u]) + ~zod/try=> `(map ,@ta ,@ud)`(mo (limo a/1 b/2 ~)) + {[p=~.a q=1] [p=~.b q=2]} + +--- + +###++qeu + +``` +++ qeu |* a=_,* :: queue + $|(~ [n=a l=(qeu a) r=(qeu a)]) :: +``` - Wide - ?:(p q r) - - Irregular - none - - Reduction - none, natural - - [%wtkt p=wing q=twig r=twig] - -?^ ("wutkey") is a synthetic rune that evaluates r if p is -equivalent to the bunt for its tile, otherwise q is evaluted. - - Tall - ?^ p - q - r - - Wide - ?^(p q r) - - Irregular - none - - Reduction - See ++open - - [%wtkz p=tiki q=twig r=twig] - -"wutkaz" is a synthetic, internal rune that evaluates r if p is -equivalent to the bunt for its tile, otherwise q is evaluated. -See tikis. - - Tall - ?^ p - q - r - - Wide - ?^(p q r) - - Irregular - none - - Reduction - See ++open - - [%wtgl p=twig q=twig] - -?< ("wutgal") is a synthetic hoon that produces q, asserting that -p is no (|, 1). - - Tall - ?< p - q - - Wide - ?<(p q) - - Irregular - none - - Reduction - See ++open - - [%wtgr p=twig q=twig] - -?> ("wutgar") is a synthetic hoon that produces q, asserting that -p is yes (&, 0). - - Tall - ?> p - q - - Wide - ?>(p q) - - Irregular - none - - Reduction - See ++open - - [%wtls p=wing q=twig r=tine] - -?+ ("wutlus") is a synthetic rune that selects a case in q for -the actual type of p. - - Tall - Kingside - ?+ p - q - p.i.r q.i.r - p.i.t.r q.i.t.r - p.i.t.t.r q.i.t.t.r - == - - Queenside - ?+ p - q - p.i.r - q.i.r - p.i.t.r - q.i.t.r - p.i.t.t.r - q.i.t.t.r - == - - Wide - ?+(p p.i.r q.i.r, p.i.t.r q.i.t.r, p.i.t.t.r q.i.t.t.r) - - Irregular - none - - Reduction - See ++open - - [%wtlz p=tiki q=twig r=tine] - -"wutlaz" is a synthetic, internal rune that selects a case in q for -the actual type of p. - - Tall/Wide/Irregular - none, internal - - Reduction - See ++open - - [%wtpm p=tusk] - -?& ("wutpam") is a synthetic hoon that computes the "and" of the -loobeans in p. - - Tall - ?& i.p - i.t.p - i.t.t.p - == - - Wide - ?&(i.p i.t.p i.t.t.p) - - Irregular - none - - Reduction - See ++open - - [%wtpt p=wing q=twig r=twig] - -?@ ("wutpat") is a synthetic hoon that produces q if p is an -atom, r otherwise. - - Tall - Kingside - ?@ p - q - r - - Queenside - ?@ p - q - r - - Wide - ?@(p q r) - - Irregular - none - - Reduction - See ++open - - [%wtpz p=tiki q=twig r=twig] - -"wutpaz" is a synthetic hoon that produces q if p is an atom, r -otherwise. - - Tall - ?@ p - q - r - - Wide - ?@(p q r) - - Irregular - none - - Reduction - See ++open - - [%wtsg p=wing q=twig r=twig] - -?~ ("wutsig") is a synthetic rune that produces q if p is ~, r -otherwise. - - Tall - ?~ p - q - r - - Wide - ?~(p q r) - - Irregular - none - - Reduction - See ++open - - [%wtsz p=tiki q=twig r=twig] - -"wutsaz" is a synthetic internal rune that produces q if p is ~, -r otherwise. - - Tall/Wide/Irregular - none, internal - - Reduction - See ++open - - [%wtts p=tile q=wing] - -?= ("wuttis") is a natural rune that produces true if the leg at -wing q is in tile p. - - Tall - ?= p - q - - Wide - ?=(p q) - - Irregular - none - - Reduction - none, natural - - [%wtzp p=twig] - -?! ("wutzap") is a synthetic rune that produces the logical "not" -of p. - - Tall - ?! p - - Wide - ?!(p) - - Irregular - !p - - Reduction - See ++open - - [%zpcb p=spot q=twig] -XX tall/wide form -!_ ("zapcab") is a natural rune that puts debugging information -in the stack trace. - - Tall - Wide +Tile consturctor: treap of type, ordered - Irregular - none - - Reduction - none, natural - - [%zpcm p=twig q=twig] - -!, ("zapcom") is a natural rune that inserts twig q as a -constant, typed with the type of twig p. - - Tall - !, p - q - - Wide - !,(p q) - - Irregular - none - - Reduction - none, natural - - [%zpcn ~] -XX determine function -!% ("zapcen") - - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%zpfs p=twig] -XX tall/wide -!/ ("zapfas") is a natural rune that should never be compiled. -When compiled with error checking turned on, it reports its -subject as an error. - - Tall - - Wide - - Irregular - - Reduction - See ++open - - [%zpgr p=twig] - -!> ("zapgar") is a synthetic rune that produces a vase (a -[type noun] cell) with the value p. - - Tall - !> p - - Wide - !>(p) - - Irregular - none - - Reduction - See ++open - - [%zpsm p=twig q=twig] - -!; ("zapsem") is a natural rune that produces the product of twig -q as a [type noun] pair, with twig p defining the type of the type. - - Tall - !; p - q - - Wide - !;(p q) - - Irregular - none - - Reduction - none, natural - - [%zpts p=twig] - -!= ("zaptis") is a natural rune that produces the formula of twig -p as a noun. - - Tall - != p - - Wide - !=(p) - - Irregular - none - - Reduction - none, natural - - [%zpwt p=$|(p=@ [p=@ q=@]) q=twig] - -!? ("zapwut") is a synthetic rune that enforces a Hoon version -restriction. - - Tall - !? p - q - - Wide - none - - Irregular - none - - Reduction - See ++open - - [%zpzp ~] - -!! ("zapzap") is a natural rune that always causes a crash when -executed. - - Tall - none - - Wide - !! - - Irregular - none - - Reduction - none, natural +Used with `++to` engine. --- -###tine +###++set + +``` +++ set |* a=_,* :: set + $|(~ [n=a l=(set a) r=(set a)]) :: +``` + + +Tile consturctor: treap of type, unique + +Used with `++in` engine. + + ~zod/try=> (sa "abc") + {~~a ~~c ~~b} + ~zod/try=> (~(put in (sa "abc")) %d) + {~~d ~~a ~~c ~~b} + ~zod/try=> (~(put in (sa "abc")) %a) + {~~a ~~c ~~b} - ++ tine (list ,[p=tile q=twig]) :: --- -###tusk +###++jar - ++ tusk (list twig) :: +``` +++ jar |*([a=_,* b=_,*] (map a (list b))) :: map of lists +``` ---- - -###tyre - - ++ tyre (list ,[p=term q=twig]) :: - ---- - -###tyke - - ++ tyke (list (unit twig)) :: - ---- - -###tram - - ++ tram (list ,[p=wing q=twig]) :: - ---- - -###tone - - ++ tone $% [%0 p=*] :: - [%1 p=(list)] :: - [%2 p=(list ,[@ta *])] :: - == :: - ---- - -###nock - - ++ nock $& [p=nock q=nock] :: autocons - $% [%0 p=@] :: axis select - [%1 p=*] :: constant - [%2 p=nock q=nock] :: compose - [%3 p=nock] :: cell test - [%4 p=nock] :: increment - [%5 p=nock q=nock] :: equality test - [%6 p=nock q=nock r=nock] :: if, then, else - [%7 p=nock q=nock] :: serial compose - [%8 p=nock q=nock] :: push onto subject - [%9 p=@ q=nock] :: select arm and fire - [%10 p=?(@ [p=@ q=nock]) q=nock] :: hint - [%11 p=nock] :: grab data from sky - == :: - ---- - -###toon - - ++ toon $% [%0 p=*] :: - [%1 p=(list)] :: - [%2 p=(list tank)] :: - == :: - ---- - -###tune - - ++ tune $% [%0 p=vase] :: - [%1 p=(list)] :: - [%2 p=(list ,[@ta *])] :: - == :: - ---- - -###twin - - ++ twin ,[p=term q=wing r=axis s=type] :: - ---- - -###type - -A type is a noun that: - -One, it defines a set of nouns. Any finite noun is either in this set, or -not in it. - -Two, it ascribes semantics to all nouns in this set. For example, a Hoon -type exports a semantic namespace. - -A lot of other languages use dynamic types, in which the type of a -value is carried along with the data as you use it. Even languages like -Lisp, which are nominally typeless, look rather typed from the Hoon -perspective. For example, a Lisp atom knows dynamically whether it's a -symbol or an integer. A Hoon atom is just a Nock atom, which is just a -number. So without a static type, Hoon doesn't even know how to print -an atom properly. -There are 9 cases of ++type: +Tile constructor. - ?(%noun %void) - -Either %noun or %void. %noun is the set of all nouns. %void is the -set of no nouns. - - ~zod/try=> :type; * - 0 - * - - ~zod/try=> -:!>(*) - %noun - - ~zod/try=> :type; `*`%noun - 1.853.189.998 - * - - ~zod/try=> -:!>(`*`%noun) - %noun - -We can't show any examples producing %void - by definition, none of -them would terminate. Because that's what %void means. All other -cases in ++type are subsets of %noun. - - [%atom p=term] - -An atom is a natural number, with a term (known as an -odor) that specificies an atomic subtype. - -An odor is an ASCII span. This span is a taxonomy which -grows more specific to the right. For instance, @t -for UTF-8 text, @ta for URL-safe ASCII text, @tas for -a Hoon symbol; or @u for an unsigned integer, @ux for -an unsigned integer formatted as hexadecimal. - -Hoon knows about the following odors, with defined meanings: - - @c UTF-32 codepoint - @d date - @da absolute date - @dr relative date (ie, timespan) - @f yes or no (inverse boolean) - @n nil - @p phonemic base - @r IEEE floating-point - @rd double precision (64 bits) - @rh half precision (16 bits) - @rq quad precision (128 bits) - @rs single precision (32 bits) - @s signed integer, sign bit low - @sb signed binary - @sd signed decimal - @sv signed base32 - @sw signed base64 - @sx signed hexadecimal - @t UTF-8 text (cord) - @ta ASCII text (span) - @tas ASCII symbol (term) - @u unsigned integer - @ub unsigned binary - @ud unsigned decimal - @uv unsigned base32 - @uw unsigned base64 - @ux unsigned hexadecimal - -Atoms change freely either up or down the taxonomy, -but not across. You can treat a @tas as -a @t, as in a strong type system; but you can also -treat a @t as a @tas, or an @ as anything. However, -passing a @t to a function that expects an @ux is a -type error. - -Each of these forms has a URL-safe syntax. Each -parses as an atomic constant in Hoon, and each is -printed by the Hoon prettyprinter. - - ~zod/try=> :type; 0x42 - 0x42 - @ux - - ~zod/try=> `@ud`0x42 - 66 - - ~zod/try=> :type; 'foo' - 'foo' - @ta - - ~zod/try=> `@ud`'foo' - 7.303.014 - - ~zod/try=> :type; ~2013.12.6 - ~2013.12.6 - @da - - ~zod/try=> `@ud`~2013.12.6 - 170.141.184.500.724.667.905.957.736.036.171.776.000 - - ~zod/try=> `@ud`.127.0.0.1 - 2.130.706.433 - - ~zod/try=> :type; .127.0.0.1 - .127.0.0.1 - @if - - ~zod/try=> :type; ~m45 - ~m45 - @dr - - ~zod/try=> `@ud`~m45 - 49.806.208.999.015.789.363.200 - - ~zod/try=> :type; `@da`(add ~2013.12.6 ~m45) - ~2013.12.6..00.45.00 - @da - -The variety of units and formats which an atom can -represent is essentially infinite. The set of -syntaxes which Hoon can parse and print is -fundamentally limited. - -For instance, Hoon has no syntax which means "number -of miles." But within your program, nothing stops you -from using the odor system to distinguish a number of -miles from, for instance, a number of kilometers: - - ~zod/try=> `@udm`25.717 - 25.717 - ~zod/try=> `@udk`25.717 - 25.717 - -The printer has no idea what a @udm is, but it knows -what a @ud is and can print accordingly. Then, if you -have a function which expects a @udm and you try to -pass it a @udk, it will fail. - -Besides these prefixes, which indicate the rendering -and/or meaning of atoms, the odor system has another -orthogonal mechanism to restrict the size of atoms. -Like the prefix, this mechanism is weak - it is not -enforced and trivially evaded. - -An odor span contains two parts, both optional: a -lowercase prefix and an uppercase suffix. The suffix, -if present, is a single character A-Z c which -indicates an atom of size less than or equal to n -bits, where n is 1 << (c - 'A'). Thus, @tD is one -UTF-8 byte (whatever that means); @tN is a kilobyte -or less of UTF-8. - -When enforcing conversions, @t has no size -information and can be used as @tD; and @tD, of -course, can be used as @t. But using @tN as @tD is an -error. There is no way to generate the smell of size -from a constant without a cast. And of course -arithmetic results have no odor at all. - -A full table for convenience: - - A 1 bit - B 2 bits - C 4 bits - D 1 byte - E 2 bytes - F 4 bytes - G 8 bytes - H 16 bytes - I 32 bytes - J 64 bytes - K 128 bytes - L 256 bytes - M 512 bytes - N 1K - O 2K - P 4K - Q 8K - R 16K - S 32K - T 64K - U 128K - V 256K - W 512K - X 1MB - Y 2MB - Z 4MB - -You of course can build an atom larger than 4MB, but -the type system cannot express a size odor above 4MB. - - - [%bull p=twin q=type] - - [%cell p=type q=type] - -A pair of types. Set: all cells of p and q. - - ~zod/try=> :type; [3 4] - [3 4] - [@ud @ud] - - ~zod/try=> -:!>([3 4]) - - ~zod/try=> :type; [3 4] - [3 4] - [@ud @ud] - - ~zod/try=> -:!>([3 4]) - [%cell p=[%atom p=%ud] q=[%atom p=%ud]] - - [%core p=type q=coil] - - [%cube p=* q=type] - -When we enter an ordinary constant, like 42, its type [%atom %ud] -is the set of all atoms (with odor @ud, but any atom can have that -or any odor). Its type is certainly not the set consisting -exclusively of the value 42. - -But here's how we produce this "cubical" constant: - - ~zod/try=> :type; %42 - %42 - %42 - - ~zod/try=> -:!>(%42) - [%cube p=42 q=[%atom p=%ud]] - -In general, a %cube type contains p, a single noun, and q, a base -type which provides semantics. - -Syntactically, any atomic constant can be preceded by % to generate -a cube. The exception is @tas, which always needs % and is always -cubical. - - [%face p=term q=type] - -A type is not just a set of nouns - it's also a meaning which makes -sense of any noun in that set. The typed noun exports a namespace - -give it a name, and it gives you another noun. - - ~zod/try=> foo=42 - foo=42 - ~zod/try=> :type; foo=42 - foo=42 - foo=@ud - ~zod/try=> -:!>(foo=42) - [%face p=%foo q=[%atom p=%ud]] - -With %face, we've simply wrapped a label around another type. Note -that this doesn't impair our ability to compute with the value. -Computationally, foo=42 is just 42: - - ~zod/try=> (add 17 foo=42) - 59 - - [%fork p=type q=type] - -A union type. [%fork p q] means "it could be a p, or maybe a q." - -Any branching computation in which different branches produce -different types will generate a fork. For example: - - ~zod/try=> :type; ?:(& %foo [13 10]) - %foo - { %foo [@ud @ud] } - - ~zod/try=> -:!>(?:(& %foo [13 10])) - [ %fork - p=[%cube p=7.303.014 q=[%atom p=%tas]] - q=[%cell p=[%atom p=%ud] q=[%atom p=%ud]] - ] - -Here we start to understand why the type renderer is useful, as -{ %foo [@ud @ud] } (which is not in any way Hoon syntax) is a -little easier to read than the actual type noun. - -(Readers of a mathematical bent may ask: since Hoon has a union -type, where is the intersection type? There is none. Hoon is not -one of these languages whose goal is to be as mathematically -powerful as possible. Since a programming language is a UI for -programmers, and programmers are not mathematicians, Hoon is -designed to be as powerful as it has to be - and no more.) - - [%hold p=(list ,[p=type q=twig])] +Used with `++ja` and `++by` engines. --- -###typo +###++jug -Deprecated type name maintained for compatability. +``` +++ jug |*([a=_,* b=_,*] (map a (set b))) :: map of sets +``` - ++ typo type :: old type - ---- - -###udal - - ++ udal :: atomic change (%b) - $: p=@ud :: blockwidth - q=(list ,[p=@ud q=(unit ,[p=@ q=@])]) :: indels - == :: - ---- - -###udon - - ++ udon :: abstract delta - $: p=umph :: preprocessor - $= q :: patch - $% [%a p=* q=*] :: trivial replace - [%b p=udal] :: atomic indel - [%c p=(urge)] :: list indel - [%d p=upas q=upas] :: tree edit - == :: - == :: - ---- - -###umph - - ++ umph :: change filter - $| $? %a :: no filter - %b :: jamfile - %c :: LF text - == :: - $% [%d p=@ud] :: blocklist - == :: - ---- - -###unce - - ++ unce |* a=_,* :: change part - $% [%& p=@ud] :: skip[copy] - [%| p=(list a) q=(list a)] :: p -> q[chunk] - == :: - ---- - -###unit - - ++ unit |* a=_,* :: maybe - $|(~ [~ u=a]) :: - ---- - -###upas - - ++ upas :: tree change (%d) - $& [p=upas q=upas] :: cell - $% [%0 p=axis] :: copy old - [%1 p=*] :: insert new - [%2 p=axis q=udon] :: mutate! - == :: - ---- - -###urge - - ++ urge |*(a=_,* (list (unce a))) :: list change - ---- - -###vase - - ++ vase ,[p=type q=*] :: type-value pair - ---- - -###vise - - ++ vise ,[p=typo q=*] :: old vase - ---- - -###wall - - ++ wall (list tape) :: text lines (no \n) - ---- - -###wain - - ++ wain (list cord) :: text lines (no \n) - ---- - -###wing - - ++ wing (list limb) :: - ---- - -###wine - - ++ wine $| ?(%noun %path %tank %void %wall %wool %yarn) - $% [%atom p=term] :: - [%core p=(list ,@ta) q=wine] :: - [%face p=term q=wine] :: - [%list p=term q=wine] :: - [%pear p=term q=@] :: - [%pick p=(list wine)] :: - [%plot p=(list wine)] :: - [%stop p=@ud] :: - [%tree p=term q=wine] :: - [%unit p=term q=wine] :: - == :: - ---- - -###wonk - - ++ wonk |*(veq=edge ?~(q.veq !! p.u.q.veq)) :: - ---- - -###map - - ++ map |* [a=_,* b=_,*] :: associative array - $|(~ [n=[p=a q=b] l=(map a b) r=(map a b)]) :: - ---- - -###qeu - - ++ qeu |* a=_,* :: queue - $|(~ [n=a l=(qeu a) r=(qeu a)]) :: - ---- - -###set - - ++ set |* a=_,* :: set - $|(~ [n=a l=(set a) r=(set a)]) :: - ---- - -###jar - - ++ jar |*([a=_,* b=_,*] (map a (list b))) :: map of lists - ---- - -###jug - - ++ jug |*([a=_,* b=_,*] (map a (set b))) :: map of sets + +Tile constructor. + +Used with `++ja` and `++by` engines. --- diff --git a/main/pub/src/doc/ref/vol/4c.md b/main/pub/src/doc/ref/vol/4c.md index 1e780b5d0..7f1acedeb 100644 --- a/main/pub/src/doc/ref/vol/4c.md +++ b/main/pub/src/doc/ref/vol/4c.md @@ -685,8 +685,8 @@ each in detail. These two kisses are nearly identical. At a high level, they apply changes to the filesystem. Whenever we add, remove, or edit a file, one of these cards is sent. The `p` is the ship whose filesystem we're trying to change, the `q` is -the desk we're changing, and the `r` is the request change. For the format of -the requested change, see the documentation for `++nori` above. +the desk we're changing, and the `r` is the requested change. For the format +of the requested change, see the documentation for `++nori` above. When a file is changed in the unix filesystem, vere will send a `%into` kiss. This tells clay that the duct over which the kiss was sent is the duct that @@ -1024,11 +1024,11 @@ which reads the requested data at the given revision. ``` ++ read-at-aeon :: read-at-aeon:ze - |= [oan=aeon mun=mood] :: seek and read + |= [yon=aeon mun=mood] :: seek and read ^- (unit) ?: &(?=(%w p.mun) !?=(%ud -.q.mun)) :: NB only for speed - ?^(r.mun ~ [~ oan]) - (read:(rewind oan) mun) + ?^(r.mun ~ [~ yon]) + (read:(rewind yon) mun) ``` If we're requesting the revision number with a case other than by number, then @@ -1038,11 +1038,11 @@ to get the requested information. ``` ++ rewind :: rewind:ze - |= oan=aeon :: rewind to aeon + |= yon=aeon :: rewind to aeon ^+ +> - ?: =(let oan) +> - ?: (gth oan let) !! :: don't have version - +>(ank (checkout-ankh q:(tako-to-yaki (aeon-to-tako oan))), let oan) + ?: =(let yon) +> + ?: (gth yon let) !! :: don't have version + +>(ank (checkout-ankh q:(tako-to-yaki (aeon-to-tako yon))), let yon) ``` If we're already at the requested version, we do nothing. If we're requesting @@ -1490,9 +1490,9 @@ We call `++lobes-at-path:ze` to get the data at the particular path. ``` ++ lobes-at-path :: lobes-at-path:ze - |= [oan=aeon pax=path] :: data at path + |= [yon=aeon pax=path] :: data at path ^- (map path lobe) - ?: =(0 oan) ~ + ?: =(0 yon) ~ %- mo %+ skim %. ~ @@ -1500,7 +1500,7 @@ We call `++lobes-at-path:ze` to get the data at the particular path. =< q %- tako-to-yaki %- aeon-to-tako - oan + yon |= [p=path q=lobe] ?| ?=(~ pax) ?& !?=(~ p) @@ -2001,9 +2001,9 @@ subscription case. ``` ++ balk :: read and send - |= [hen=duct oan=@ud mun=mood] + |= [hen=duct yon=@ud mun=mood] ^+ +> - =+ vid=(~(read-at-aeon ze lim dom ran) oan mun) + =+ vid=(~(read-at-aeon ze lim dom ran) yon mun) ?~ vid (blub hen) (blab hen mun u.vid) ``` @@ -2035,3 +2035,397 @@ producing it if it has; else, we call `++blub` since no more data can be produced over this subscription. This concludes our discussion of foreign requests. + +Lifecycle of a Local Write +-------------------------- + +There are two kisses that cause a local write: `%info` and `%into`. These are +exactly identical except that `%into` resets the the sync duct in clay, so it +ought only to be called from unix. Within arvo, we call `%info`. + +Both are handled in `++call`. + +``` + ?(%info %into) + ?: =(%$ q.q.hic) + ?. ?=(%into -.q.hic) [~ ..^$] + =+ yar=(need (~(get by fat.ruf) p.q.hic)) + [~ ..^$(fat.ruf (~(put by fat.ruf) p.q.hic yar(hez [~ hen])))] + =^ mos ruf + =+ une=(un p.q.hic now ruf) + =+ ^= zat + (exec:(di:wake:une q.q.hic) hen now r.q.hic) + =+ zot=abet.zat + :- -.zot + =. une (pish:une q.q.hic +.zot ran.zat) + abet:une(hez.yar ?.(=(%into -.q.hic) hez.yar.une [~ hen])) + [mos ..^$] +``` + +Recall that in the kiss (`q.hic`) the `p` is the ship whose filesystem we're +trying to change, the `q` is the desk we're changing, and the `r` is the +requested change. + +If `q`, the desk name, is empty, then we don't make any actual changes to the +filesystem. In the case of `%info`, we do nothing at all. For the `%into` +kiss, we simply set the sync duct to the duct we received this kiss on. This +allows us to set the sync duct without making a change to our filesystem. + +Otherwise, we construct the core for a local ship with `++un` and for the local +desk with `++di`, as described above. We then apply the change with +`++exec:de`, which contains the meat of the write functionality. Afterward, we +call `++abet:de` to resolve our changes to the desk and `++pish:un` and +`++abet:un` to resolve our changes to the ship, as described above. Again, if +this is a `%info` kiss, then we don't change the sync duct; else, we set it to +the calling duct. + +The interesting call here was, of course, `++exec:de`. + +``` + ++ exec :: change and update + |= [hen=duct wen=@da lem=nori] + ^+ +> + (echo:wake:(edit wen lem) hen wen lem) +``` + +First, we call `++edit` to apply our changes, then we call `++wake` to push out +any new updates to our subscribers. Finally, we call `++echo` to announce our +changes to both unix and the terminal. + +We have described `++wake` above, so we'll discuss `++edit` and `++echo` here. +Since `++echo` is significantly simpler, we'll start with it. + +``` + ++ echo :: announce changes + |= [hen=duct wen=@da lem=nori] + ^+ +> + %= +> + vag ?~(hez vag :_(vag [u.hez [%ergo who syd let.dom]])) + yel + =+ pre=`path`~[(scot %p for) syd (scot %ud let.dom)] + ?- -.lem + | :_ yel + [hen %note '=' %leaf :(weld (trip p.lem) " " (spud pre))] + & |- ^+ yel + ?~ q.q.lem yel + :_ $(q.q.lem t.q.q.lem) + :- hen + :+ %note + ?-(-.q.i.q.q.lem %del '-', %ins '+', %mut ':') + [%leaf (spud (weld pre p.i.q.q.lem))] + == + == +``` + +If we have a sync duct, then we push out a `%ergo` gift along it so that unix +knows there has been a change to the filesystem and can update the copy on the +unix filesystem. + +Additionally, we push out a `%note` gift to the terminal duct to display the +new changes to the user. This is responsible for the printed lines we see when +a file is added, removed, or modified. + +It remains to discuss `++edit:de`. + +``` + ++ edit :: apply changes + |= [wen=@da lem=nori] + ^+ +> + =+ axe=(~(edit ze lim dom ran) wen lem) + =+ `[l=@da d=dome r=rang]`+<.axe + +>.$(dom d, ran r) +``` + +We very simply call `++edit:ze` and apply the resultant dome and rang back into +ourself. As we should expect, the actual handling of the changes themselves +is delegated to `++ze` in `arvo/zuse.hoon`. + +``` + ++ edit :: edit:ze + |= [wen=@da lem=nori] :: edit + ^+ +> + ?- -.lem + & =^ yak lat :: merge objects + %+ forge-yaki wen + ?: =(let 0) :: initial import + [~ q.lem] + [(some r:(aeon-to-yaki let)) q.lem] + ?. ?| =(0 let) + !=((lent p.yak) 1) + !(equiv q.yak q:(aeon-to-yaki let)) + == + +>.$ :: silently ignore + =: let +(let) + hit (~(put by hit) +(let) r.yak) + hut (~(put by hut) r.yak yak) + == + +>.$(ank (checkout-ankh q.yak)) + | +>.$(lab ?<((~(has by lab) p.lem) (~(put by lab) p.lem let))) + == +``` + +Two kinds of changes may be made to a filesystem: we can modify the contents +or we can label a revision. + +Labeling a revision (the `|` case) is much simpler. We first assert that the +label doesn't already exist. Then, we put in `lab` in our dome the label +associated with the current revision number. + +In the `&` case, we're actually modifying the contents of the filesystem. +First, we create the commit in `++forge-yaki` by applying the given changes to +our current revision. This also updates `lat` in our rang with the new data +objects. + +Unless either this is the initial import, the generated yaki doesn't have +exactly one parent, or the data in the generated yaki is the same as that in +our current revision, we silently ignore the request. Note that this only +allows changes that don't affect the contents of the filesystem if this is a +merge. + +If one of the conditions does hold, then we apply the generated commit. We +increment `let`, the revision number of our head; associate the new revision +number with the hash of the new commit; and put the new commit in `hut`. +Finally, we update our current ankh by checking out the new commit. + +We discussed `++checkout-ankh` above, so it remains only to discuss +`++forge-yaki` and `++equiv`. We begin with the simpler, `++equiv:ze`. + +``` + ++ equiv :: test paths + |= [p=(map path lobe) q=(map path lobe)] + ^- ? + =- ?. qat %.n + %+ levy (~(tap by q) ~) + |= [pat=path lob=lobe] + (~(has by p) pat) + ^= qat + %+ levy (~(tap by p) ~) + |= [pat=path lob=lobe] + =+ zat=(~(get by q) pat) + ?~ zat %.n + =((lobe-to-noun u.zat) (lobe-to-noun lob)) +``` + +We're checking to see if the data in both filesystem trees is identical. We +start by going through `p` and checking to see if (1) the path exists in `q` +and (2) the data is the same as in `q`. + +This shows that `q` is a superset of `p`. To show that `p` and `q` are +equivalent, we have to make sure there is nothing in `q` that is not also in +`p`. Once we've done that, we know `p` and `q` are equivalent. + +``` + ++ forge-yaki :: forge-yaki:ze + |= [wen=@da par=(unit tako) lem=soba] :: forge yaki + =+ ^= per + ?~ par ~ + ~[u.par] + =+ gar=(update-lat (apply-changes q.lem) lat) + :- %^ make-yaki per +.gar wen :: from existing diff + -.gar :: fix lat +``` + +Here, we first make `per`, our list of parents. If we have a parent, we put it +in the list, else the list is empty. Simple. + +We then apply the changes and update `lat`, our object store. Finally, we make +a yaki out of the generated change information and produce both it and the new +object store. + +In increasing order of complexity, the new arms here are `++make-yaki`, +`++update-lat`, and `++apply-changes`. + +``` + ++ make-yaki :: make yaki + |= [p=(list tako) q=(map path lobe) t=@da] + ^- yaki + =+ ^= has + %^ cat 7 (sham [%yaki (roll p add) q t]) + (sham [%tako (roll p add) q t]) + [p q has t] +``` + +We're given almost everything we need to make a yaki, so we just need to +generate the hash of the new yaki. We take a noun hash of a noun that depends +on the hashes of the parents, the data at this commit, and the date of the +commit. Note that this means two identical changes made on the same parents at +different times will have different hashes. + +``` + ++ update-lat :: update-lat:ze + |= [lag=(map path blob) sta=(map lobe blob)] :: fix lat + ^- [(map lobe blob) (map path lobe)] + %+ roll (~(tap by lag) ~) + |= [[pat=path bar=blob] [lut=_sta gar=(map path lobe)]] + ?~ (~(has by lut) p.bar) + [lut (~(put by gar) pat p.bar)] + :- (~(put by lut) p.bar bar) + (~(put by gar) pat p.bar) +``` + +We're given a map of paths directly to their contents, but we wish to have both +a map from paths to hashes of their contents and a map from hashes to the +content itself. We're given an initial map of the second kind, but when +applying the changes, we may add new content which is not yet stored here. + +We roll over the given map from paths to data and, if the data is already in +our store, then we simply add a reference to the hash in the map from paths to +hashes. Otherwise, we also have to add the entry in the map from hashes to +data. + +``` + ++ apply-changes :: apply-changes:ze + |= lar=(list ,[p=path q=miso]) :: store changes + ^- (map path blob) + =+ ^= hat :: current state + ?: =(let 0) :: initial commit + ~ :: has nothing + =< q + %- aeon-to-yaki + let + =- =+ sar=(sa (turn lar |=([p=path *] p))) :: changed paths + %+ roll (~(tap by hat) ~) :: find unchanged + |= [[pat=path gar=lobe] bat=_bar] + ?: (~(has in sar) pat) :: has update + bat + (~(put by bat) pat (lobe-to-blob gar)) :: use original + ^= bar ^- (map path blob) + %+ roll lar + |= [[pat=path mys=miso] bar=(map path blob)] + ^+ bar + ?- -.mys + %ins :: insert if not exist + ?: (~(has by bar) pat) !! :: + ?: (~(has by hat) pat) !! :: + (~(put by bar) pat (make-direct p.mys %c)) :: TODO content type? + %del :: delete if exists + ?. |((~(has by hat) pat) (~(has by bar) pat)) !! + (~(del by bar) pat) + %mut :: mutate, must exist + =+ ber=(~(get by bar) pat) + ?~ ber + =+ har=(~(get by hat) pat) + ?~ har !! + %+ ~(put by bar) pat + (make-delta u.har p.mys) + %+ ~(put by bar) pat + (make-delta p.u.ber p.mys) + == +``` + +We let `hat` be the state of our head. We let `bar` be the new state of +the files we touch in our changes, and then we add in the unchanged files. + +To compute `bar`, we go through each change, handling each one individually. +If the change is an insert, then we first assert that the file doesn't already +exist and that we haven't already added it in this changeset. Note that this +means it is impossible to delete a file and then insert it again in the same +changeset. If this is indeed a new file, then put the path into `bar`, +associated with its data blob, as calculated by `++make-direct`. + +``` + ++ make-direct :: make blob + |= [p=* q=umph] + ^- blob + [%direct (mug p) p q] +``` + +We're given everything we need to create a `%direct` blob except the hash, +which we calculate as the simple mug of the file contents. + +In the case of a delete, we first assert that the file exists in either the +current head or our new changes. Note that it is possible to insert a file and +then delete it in the same changeset. If the file does exist, then we remove +it from `bar`. + +Finally, in the case of a mutation, we try to get the current state of the file +from our new changes in `bar`. If it's not there, then we assert that the file +exists in our current head (it must, after all, if we're changing it), and we +make a `%delta` blob out of the difference between the old contents and the new +contents. If the file is in `bar`, then make the `%delta` blob as a change +from from the contents already in `bar` to the new contents. This means it is +possible to have multiple mutations to a file in the same changeset. + +After we've computed the contents of modified files, we must add all the +unmodified files. We might naively suppose that `(~(uni by hat) bar)` would do +this, but this would add back all the deleted files. To get around this, we +let `sar` be the changed files, and then we simply roll over the files at our +current head, adding everything that isn't in `sar`. + +This concludes our discussion of a local write. + +Lifecycle of a Local Merge +-------------------------- + +Merges are pretty simple from the perspective of clay. A `%merg` kiss is sent +with already-generated merge state, and we simply apply the new state. The +question of how the merge is generated is much more complicated, but it is also +out of the scope of this section. If you're interested, take a look at +`++construct-merge:ze`. + +We've seen most of the arms involved, so we'll go through most of it pretty +quickly. In `++call` we handle the `%merg` kiss. + +``` + %merg :: direct state up + =^ mos ruf + =+ une=(un p.q.hic now ruf) + =+ ^= zat + (exem:(di:wake:une q.q.hic) hen now r.q.hic) + =+ zot=abet.zat + :- -.zot + =. une (pish:une q.q.hic +.zot ran.zat) + abet:une(hez.yar ?.(=(%into -.q.hic) hez.yar.une [~ hen])) + [mos ..^$] +``` + +As we've seen several times before, we set up a core for the local ship with +`++un`. We set up a core for the local desk with `++di` and updating our +subscribers with `++wake`. We call `++exem` to execute the merge. `++abet:de`, +`++pish:un` and `++abet:un` resolve all our changes. + +The only new arm here is `++exem:de`. + +``` + ++ exem :: execute merge + |= [hen=duct wen=@da mer=mizu] :: aka direct change + ?. (gte p.mer let.dom) !! :: no + =. +>.$ %= +>.$ + hut.ran (~(uni by hut.r.mer) hut.ran) + lat.ran (~(uni by lat.r.mer) lat.ran) + let.dom p.mer + hit.dom (~(uni by q.mer) hit.dom) + == + =+ ^= hed :: head commit + =< q + %- ~(got by hut.ran) + %- ~(got by hit.dom) + let.dom + =. ank.dom :: real checkout + (~(checkout-ankh ze lim dom ran) hed) + (echa:wake hen wen mer) :: notify or w/e +``` + +We first do a quick sanity check that the head of the merge data is greater +than the head of the old data. Merges must add at least one revision. + +We merge the new data in the obvious way. We do map merges for `hut` and `lat` +in rang to get all the new data and commits, we do a map merge in`hit` in our +dome to get all the new revision numbers, and we update our head to the most +recent revision. + +Then, we checkout the commit at our head and announce the results to unix. +`++echa` is the only new arm here. + +``` + ++ echa :: announce raw + |= [hen=duct wen=@da mer=mizu] + ^+ +> + %= +> + vag ?~(hez vag :_(vag [u.hez [%ergo who syd let.dom]])) + == +``` + +If we have a sync duct, we tell unix that a new revision is available. + +This concludes our discussion of a local merge. diff --git a/try/bin/profile.hoon b/try/bin/profile.hoon new file mode 100644 index 000000000..d10644c96 --- /dev/null +++ b/try/bin/profile.hoon @@ -0,0 +1,84 @@ +|% +++ doss + $: sap=,@ud :: sample count + hit=(map term ,@ud) :: hit points + cut=(map span hump) :: cut points + == +:: +++ hump + $: sap=,@ud :: sample count + inn=(map span ,@ud) :: calls into + out=(map span ,@ud) :: calls out of + == +:: +++ pi + |_ day=doss + ++ heck :: report event + |= [nam=@tas day=doss] + ^- day + =+ lam=(~(get by hit.day) nam) + day(hit (~(put by hit.day) ?~(lam 1 +(u.lam)))) + :: + ++ noon :: sample trace + |= pax=path + =| lax=(unit span) + |- ^- day + ?~ pax day(sap +(sap.day)) + %= $ + pax t.pax + lax `i.pax + cut.day + %+ ~(put by cut.day) i.pax + ^- hump + =+ nax=`(unit span)`?~(t.pax ~ `i.t.pax) + =+ hup=`hump`=+(hup=(~(get by cut) i.pax) ?^(hup u.hup [0 ~ ~])) + :+ +(sap.hup) + ?~ lax inn.hup + =+(hag=(~(get by inn.hup) u.lax) ?~(hag 1 +(u.hag))) + ?~ nax out.hup + =+(hag=(~(get by out.hup) u.nax) ?~(hag 1 +(u.hag))) + == + :: + ++ tell :: produce dump + ^- (list tape) + ;: welp + ^- (list tape) + [(welp "events: " (scow %ud sap.day)) ~] + :: + ^- (list tape) + %+ turn + (~(tap by hit.day) ~) + |= [nam=term num=@ud] + :(welp (trip nam) ": " (scow %ud num)) + ["" ~] + :: + ^- (list tape) + %- welp + %+ turn + (~(tap by cut.day) ~) + |= [nam=term hup=hump] + ^- (list tape) + ;: welp + [(welp "sector: " (trip nam)) ~] + :: + [(welp "weight: " (div (mul 1.000 sap.hup) sap.day)) ~] + :: + ["inn:" ~] + :: + %+ turn + (~(tap by inn.hup) ~) + |= [nam=term num=@ud] + ^- tape + :(welp " " (trip nam) ": " (scow %ud num)) + :: + ["out:" ~] + :: + %+ turn + (~(tap by out.hup) ~) + |= [nam=term num=@ud] + ^- tape + :(welp " " (trip nam) ": " (scow %ud num)) + == + == + -- +-- diff --git a/try/syn/web/template/htmn.hoon b/try/syn/web/template/htmn.hoon index 2c15abdcb..70368cc17 100644 --- a/try/syn/web/template/htmn.hoon +++ b/try/syn/web/template/htmn.hoon @@ -1,6 +1,34 @@ !: :: Some uses of template syntax :: +=> |% :: no longer in %zuse + ++ fest :: web synthesizer + |= [hom=path raw=path] + |* yax=$+(epic *) + (yax (fuel (fain hom raw))) + :: + ++ gist :: convenient html + |= [hom=path raw=path] + |= yax=$+(epic marl) + %- (fest hom raw) + |= piq=epic + ^- manx + =+ ^= sip :: skip blanks + |= mal=marl + ?~(mal ~ ?.(|(=(:/(~) i.mal) =(:/([10 ~]) i.mal)) mal $(mal t.mal))) + =+ zay=`marl`(yax piq) + =. zay (sip zay) + =+ ^= twa + |- ^- [p=marl q=marl] + ?~ zay [~ ~] + ?: ?=([[[%head *] *] *] zay) + [c.i.zay ?:(?=([[[%body *] *] ~] t.zay) c.i.t.zay t.zay)] + ?: ?=([[[%title *] *] *] zay) + [[i.zay ~] t.zay] + [~ zay] + [/html [/head (sip p.twa)] [/body (sip q.twa)] ~] + :: + -- %- gist |= epic ^- marl