From 4caa90c68fc4aeffa926570bfce301a04bdc1f10 Mon Sep 17 00:00:00 2001 From: Christian Carter Date: Sat, 28 Sep 2013 13:21:18 -0700 Subject: [PATCH] Cleaning up old code --- arvo/ames.hoon | 1658 ++++++++ arvo/batz.hoon | 1198 ++++++ arvo/clay.hoon | 631 +++ arvo/dill.hoon | 349 ++ arvo/eyre.hoon | 166 + arvo/hoon.hoon | 7549 +++++++++++++++++++++++++++++++++++ arvo/zuse.hoon | 1831 +++++++++ main/bin/begin.hoon | 195 + main/bin/cat.hoon | 16 + main/bin/cd.hoon | 27 + main/bin/diff.hoon | 15 + main/bin/echo.hoon | 6 + main/bin/env.hoon | 23 + main/bin/hello.hoon | 9 + main/bin/hi.hoon | 21 + main/bin/hupdate.hoon | 10 + main/bin/label.hoon | 9 + main/bin/ls.hoon | 13 + main/bin/none.hoon | 7 + main/bin/nusolid.hoon | 41 + main/bin/pope.hoon | 19 + main/bin/ram.hoon | 41 + main/bin/rat.hoon | 12 + main/bin/reboot.hoon | 25 + main/bin/reload.hoon | 9 + main/bin/reset.hoon | 35 + main/bin/set.hoon | 22 + main/bin/solid.hoon | 41 + main/bin/sys.hoon | 6 + main/bin/ticket.hoon | 27 + main/bin/update.hoon | 12 + main/bin/with.hoon | 18 + main/bin/ye.hoon | 23 + main/doc/begin/banner.txt | 24 + main/doc/begin/entropy.txt | 4 + main/doc/begin/govt.txt | 2 + main/doc/begin/identity.txt | 14 + main/doc/begin/language.txt | 6 + main/doc/begin/location.txt | 5 + main/doc/begin/name.txt | 5 + main/doc/begin/person.txt | 19 + main/doc/begin/ship.txt | 2 + main/doc/begin/ticket.txt | 2 + main/doc/begin/warning.txt | 5 + main/lib/hume.hoon | 162 + main/lib/pony.hoon | 121 + spec/nock/5.txt | 42 + try/bin/fib.hoon | 9 + try/bin/game.hoon | 41 + try/bin/goodbye.hoon | 4 + try/bin/infinite.hoon | 6 + try/bin/memory.hoon | 7 + try/bin/overflow.hoon | 7 + try/bin/reverse.hoon | 26 + try/bin/sleep.hoon | 10 + try/bin/tiff.hoon | 31 + try/bin/zero.hoon | 10 + try/lib/diff.hoon | 5 + try/web/game/fun.hoon | 20 + try/web/hello/bar.html | 1 + try/web/hello/moo.holw | 5 + try/web/hello/posty.holw | 12 + try/web/hello/query.holw | 9 + 63 files changed, 14680 insertions(+) create mode 100644 arvo/ames.hoon create mode 100644 arvo/batz.hoon create mode 100644 arvo/clay.hoon create mode 100644 arvo/dill.hoon create mode 100644 arvo/eyre.hoon create mode 100644 arvo/hoon.hoon create mode 100644 arvo/zuse.hoon create mode 100644 main/bin/begin.hoon create mode 100644 main/bin/cat.hoon create mode 100644 main/bin/cd.hoon create mode 100644 main/bin/diff.hoon create mode 100644 main/bin/echo.hoon create mode 100644 main/bin/env.hoon create mode 100644 main/bin/hello.hoon create mode 100644 main/bin/hi.hoon create mode 100644 main/bin/hupdate.hoon create mode 100644 main/bin/label.hoon create mode 100644 main/bin/ls.hoon create mode 100644 main/bin/none.hoon create mode 100644 main/bin/nusolid.hoon create mode 100644 main/bin/pope.hoon create mode 100644 main/bin/ram.hoon create mode 100644 main/bin/rat.hoon create mode 100644 main/bin/reboot.hoon create mode 100644 main/bin/reload.hoon create mode 100644 main/bin/reset.hoon create mode 100644 main/bin/set.hoon create mode 100644 main/bin/solid.hoon create mode 100644 main/bin/sys.hoon create mode 100644 main/bin/ticket.hoon create mode 100644 main/bin/update.hoon create mode 100644 main/bin/with.hoon create mode 100644 main/bin/ye.hoon create mode 100644 main/doc/begin/banner.txt create mode 100644 main/doc/begin/entropy.txt create mode 100644 main/doc/begin/govt.txt create mode 100644 main/doc/begin/identity.txt create mode 100644 main/doc/begin/language.txt create mode 100644 main/doc/begin/location.txt create mode 100644 main/doc/begin/name.txt create mode 100644 main/doc/begin/person.txt create mode 100644 main/doc/begin/ship.txt create mode 100644 main/doc/begin/ticket.txt create mode 100644 main/doc/begin/warning.txt create mode 100644 main/lib/hume.hoon create mode 100644 main/lib/pony.hoon create mode 100644 spec/nock/5.txt create mode 100644 try/bin/fib.hoon create mode 100644 try/bin/game.hoon create mode 100644 try/bin/goodbye.hoon create mode 100644 try/bin/infinite.hoon create mode 100644 try/bin/memory.hoon create mode 100644 try/bin/overflow.hoon create mode 100644 try/bin/reverse.hoon create mode 100644 try/bin/sleep.hoon create mode 100644 try/bin/tiff.hoon create mode 100644 try/bin/zero.hoon create mode 100644 try/lib/diff.hoon create mode 100644 try/web/game/fun.hoon create mode 100644 try/web/hello/bar.html create mode 100644 try/web/hello/moo.holw create mode 100644 try/web/hello/posty.holw create mode 100644 try/web/hello/query.holw diff --git a/arvo/ames.hoon b/arvo/ames.hoon new file mode 100644 index 0000000000..5d4524f02c --- /dev/null +++ b/arvo/ames.hoon @@ -0,0 +1,1658 @@ +:: +:: ames (4a), networking +:: + |= pit=vase + ^- vane + => =~ + :::::::::::::::::::::::::::::::::::::::::::::::::::::::: + :: section 4aA, identity logic :: + :: + |% + :: + ++ grip :: extend will + |= [wet=will law=will] + ^- will + ?~ wet law + ?: =(wet law) law + ?^ t.wet + ?>((meld i.wet i.t.wet) [i.wet $(wet t.wet)]) + ?~ law + ?>((pier i.wet) [i.wet ~]) + ?~ q.p.q.i.wet + ?>((meld i.wet i.law) [i.wet law]) + =+ rul=(sein r.p.q.i.wet) + |- ^- will + ?: ?& =(rul r.p.q.i.law) + =(p.p.q.i.law u.q.p.q.i.wet) + == + ?>((meld i.wet i.law) [i.wet law]) + ?>(?=(^ t.law) $(law t.law)) + :: + ++ meld :: verify connect + |= [new=deed old=deed] + ^- & + ?> (melt new old) + ?> =((shaf %meld (sham q.new)) (need (sure:pu:(hail r.q.old) *code p.new))) + %& + :: + ++ melt :: proper connect + |= [new=deed old=deed] + ^- ? + =+ rac=(clan r.p.q.new) + ?& ?~ q.p.q.new + ?& =(r.p.q.old r.p.q.new) + &(!=(%earl rac) =(p.p.q.old (dec p.p.q.new))) + == + ?& &(!=(%pawn rac) !=(%czar rac)) + |(=(0 p.p.q.new) =(%earl rac)) + =(r.p.q.old (sein r.p.q.new)) + =(p.p.q.old u.q.p.q.new) + == + == + :: + ++ pare :: shorten against + |= [fou=will law=will] + :: ~& [%pare-fou fou] + :: ~& [%pare-law law] + ^- will + =+ [ouf=(flop fou) wal=(flop law)] + %- flop + |- ^- will + ?~ ouf wal + ?~ wal ?>(=(~ ouf) ~) + ?. =(i.wal i.ouf) ouf + $(wal t.wal, ouf t.ouf) + :: + ++ pier :: initial deed + |= wed=deed + ^- & + ?> =+ rac=(clan r.p.q.wed) + =+ loy=(hail r.q.wed) + ?> =(0 p.p.q.wed) + ?> =(fig:ex:loy ?+(rac !! %czar (zeno r.p.q.wed), %pawn r.p.q.wed)) + ?> =((shaf %self (sham q.wed)) (need (sure:pu:loy *code p.wed))) + %& + %& + :: + ++ real :: validate + |= [mac=mace law=will] + ?> ?& |- ^- ? + ?~ mac & + ?> ?& ?=(^ law) + (lth p.p.q.i.law 9) :: 9-lives rule + =(p.p.q.i.law p.i.mac) + =(r.q.i.law pub:ex:(wear q.i.mac)) + == + $(mac t.mac, law t.law) + == + %& + :: + ++ rice :: mace at life + |= [mar=life mac=mace] + ^- (unit mace) + ?~ mac ~ + ?: =(mar p.i.mac) [~ mac] + ?: (gth mar p.i.mac) ~ + $(mac t.mac) + :: + ++ rick :: will at life + |= [mar=life lag=ship law=will] + ^- (unit will) + ?~ law ~ + ?: =(mar p.p.q.i.law) [~ law] + ?: (gth mar p.p.q.i.law) ~ + ?: |(?=(~ q.p.q.i.law) !=(lag r.p.q.i.law)) ~ + $(law t.law) + :: + ++ zeno :: imperial keyprint + |= zar=@pD + ^- @uvH ^- @ + %+ snag zar + :~ 0wN.Kdp5k.p5ncD.4Wsih.bFQFu :: 0, ~zod, Curtis Yarvin (sator) + 0w0 :: 1, ~nec + 0w0 :: 2, ~bud + 0w0 :: 3, ~wes + 0w0 :: 4, ~sev + 0w0 :: 5, ~per + 0w0 :: 6, ~sut + 0w0 :: 7, ~let + 0w0 :: 8, ~ful + 0w0 :: 9, ~pen + 0w0 :: 10, ~syt + 0w0 :: 11, ~dur + 0w0 :: 12, ~wep + 0w0 :: 13, ~ser + 0w0 :: 14, ~wyl + 0w3F.QdvV-.toAsR.hvUNk.fHjW6 :: 15, ~sun + 0w0 :: 16, ~ryp + 0w0 :: 17, ~syx + 0w0 :: 18, ~dyr + 0w0 :: 19, ~nup + 0w0 :: 20, ~heb + 0w0 :: 21, ~peg + 0w0 :: 22, ~lup + 0w0 :: 23, ~dep + 0wO.9KmGJ.OngO1.DHMsK.GcY1S :: 24, ~dys, S. Datskovskiy (fortuna) + 0w0 :: 25, ~put + 0w0 :: 26, ~lug + 0w0 :: 27, ~hec + 0w0 :: 28, ~ryt + 0w0 :: 29, ~tyv + 0w0 :: 30, ~syd + 0w0 :: 31, ~nex + 0w0 :: 32, ~lun + 0w0 :: 33, ~mep + 0w0 :: 34, ~lut + 0w0 :: 35, ~sep + 0w0 :: 36, ~pes + 0w0 :: 37, ~del + 0w1w.KF-J1.5I63F.khFyv.h0n4J :: 38, ~sul, John Burnham (donum) + 0w0 :: 39, ~ped + 0w0 :: 40, ~tem + 0w0 :: 41, ~led + 0w0 :: 42, ~tul + 0w0 :: 43, ~met + 0w0 :: 44, ~wen + 0w0 :: 45, ~byn + 0w0 :: 46, ~hex + 0w0 :: 47, ~feb + 0w0 :: 48, ~pyl + 0w0 :: 49, ~dul + 0w0 :: 50, ~het + 0w0 :: 51, ~mev + 0w0 :: 52, ~rut + 0w0 :: 53, ~tyl + 0w0 :: 54, ~wyd + 0w0 :: 55, ~tep + 0w0 :: 56, ~bes + 0w0 :: 57, ~dex + 0w0 :: 58, ~sef + 0w0 :: 59, ~wyc + 0w0 :: 60, ~bur + 0w0 :: 61, ~der + 0w0 :: 62, ~nep + 0w0 :: 63, ~pur + 0w0 :: 64, ~rys + 0w0 :: 65, ~reb + 0w0 :: 66, ~den + 0w0 :: 67, ~nut + 0w0 :: 68, ~sub + 0w0 :: 69, ~pet + 0w0 :: 70, ~rul + 0w0 :: 71, ~syn + 0w0 :: 72, ~reg + 0w0 :: 73, ~tyd + 0w0 :: 74, ~sup + 0w0 :: 75, ~sem + 0w0 :: 76, ~wyn + 0w0 :: 77, ~rec + 0w0 :: 78, ~meg + 0w0 :: 79, ~net + 0w0 :: 80, ~sec + 0w0 :: 81, ~mul + 0w0 :: 82, ~nym + 0w0 :: 83, ~tev + 0w0 :: 84, ~web + 0w0 :: 85, ~sum + 0w0 :: 86, ~mut + 0w0 :: 87, ~nyx + 0w0 :: 88, ~rex + 0w0 :: 89, ~teb + 0w0 :: 90, ~fus + 0w0 :: 91, ~hep + 0w0 :: 92, ~ben + 0w0 :: 93, ~mus + 0w0 :: 94, ~wyx + 0w0 :: 95, ~sym + 0w0 :: 96, ~sel + 0w0 :: 97, ~ruc + 0w0 :: 98, ~dec + 0w0 :: 99, ~wex + 0w0 :: 100, ~syr + 0w0 :: 101, ~wet + 0w0 :: 102, ~dyl + 0w0 :: 103, ~myn + 0w0 :: 104, ~mes + 0w0 :: 105, ~det + 0w0 :: 106, ~bet + 0w0 :: 107, ~bel + 0w0 :: 108, ~tux + 0w0 :: 109, ~tug + 0w0 :: 110, ~myr + 0w0 :: 111, ~pel + 0w0 :: 112, ~syp + 0w0 :: 113, ~ter + 0w0 :: 114, ~meb + 0w0 :: 115, ~set + 0w0 :: 116, ~dut + 0w0 :: 117, ~deg + 0w0 :: 118, ~tex + 0w0 :: 119, ~sur + 0w0 :: 120, ~fel + 0w0 :: 121, ~tud + 0w0 :: 122, ~nux + 0w0 :: 123, ~rux + 0w0 :: 124, ~ren + 0w0 :: 125, ~wyt + 0w0 :: 126, ~nub + 0w0 :: 127, ~med + 0w0 :: 128, ~lyt + 0w0 :: 129, ~dus + 0w0 :: 130, ~neb + 0w0 :: 131, ~rum + 0w0 :: 132, ~tyn + 0w0 :: 133, ~seg + 0w0 :: 134, ~lyx + 0w0 :: 135, ~pun + 0w0 :: 136, ~res + 0w0 :: 137, ~red + 0w35.X2UDc.z3dhi.ZYu9P.EhfXU :: 138, ~fun, Aaron Beckerman (fortuna) + 0w0 :: 139, ~rev + 0w3m.Cqumo.ZC7-e.794A4.Bqhh8 :: 140, ~ref, Matt Brubeck (fortuna) + 0w0 :: 141, ~mec + 0w0 :: 142, ~ted + 0w2d.GLlYg.-MwtO.ZCPBE.OqGB9 :: 143, ~rus, Stephen Burnham (donum) + 0w0 :: 144, ~bex + 0w0 :: 145, ~leb + 0w0 :: 146, ~dux + 0w0 :: 147, ~ryn + 0w0 :: 148, ~num + 0w0 :: 149, ~pyx + 0w0 :: 150, ~ryg + 0w0 :: 151, ~ryx + 0w0 :: 152, ~fep + 0w0 :: 153, ~tyr + 0w0 :: 154, ~tus + 0w0 :: 155, ~tyc + 0w0 :: 156, ~leg + 0w0 :: 157, ~nem + 0w0 :: 158, ~fer + 0w0 :: 159, ~mer + 0w0 :: 160, ~ten + 0w0 :: 161, ~lus + 0w0 :: 162, ~nus + 0w0 :: 163, ~syl + 0w0 :: 164, ~tec + 0w0 :: 165, ~mex + 0w0 :: 166, ~pub + 0w0 :: 167, ~rym + 0w0 :: 168, ~tuc + 0w0 :: 169, ~fyl + 0w0 :: 170, ~lep + 0w0 :: 171, ~deb + 0w0 :: 172, ~ber + 0w0 :: 173, ~mug + 0w0 :: 174, ~hut + 0w0 :: 175, ~tun + 0w0 :: 176, ~byl + 0w0 :: 177, ~sud + 0w0 :: 178, ~pem + 0w0 :: 179, ~dev + 0w0 :: 180, ~lur + 0w0 :: 181, ~def + 0w0 :: 182, ~bus + 0w0 :: 183, ~bep + 0w0 :: 184, ~run + 0w0 :: 185, ~mel + 0w0 :: 186, ~pex + 0w0 :: 187, ~dyt + 0w0 :: 188, ~byt + 0w0 :: 189, ~typ + 0w0 :: 190, ~lev + 0w0 :: 191, ~myl + 0w0 :: 192, ~wed + 0w0 :: 193, ~duc + 0w0 :: 194, ~fur + 0w0 :: 195, ~fex + 0w0 :: 196, ~nul + 0w0 :: 197, ~luc + 0w0 :: 198, ~len + 0w0 :: 199, ~ner + 0w0 :: 200, ~lex + 0w0 :: 201, ~rup + 0w0 :: 202, ~ned + 0w0 :: 203, ~lec + 0w0 :: 204, ~ryd + 0w1U.n361n.FC3jj.9cX26.V1Wif :: 205, ~lyd, Adam Bliss (fortuna) + 0w0 :: 206, ~fen + 0w0 :: 207, ~wel + 0w0 :: 208, ~nyd + 0w0 :: 209, ~hus + 0w0 :: 210, ~rel + 0w0 :: 211, ~rud + 0w0 :: 212, ~nes + 0w0 :: 213, ~hes + 0w0 :: 214, ~fet + 0w0 :: 215, ~des + 0w0 :: 216, ~ret + 0w0 :: 217, ~dun + 0w0 :: 218, ~ler + 0w0 :: 219, ~nyr + 0w0 :: 220, ~seb + 0w0 :: 221, ~hul + 0w0 :: 222, ~ryl + 0w0 :: 223, ~lud + 0w0 :: 224, ~rem + 0w0 :: 225, ~lys + 0w3C.YXlEl.pFbYV.9pYWI.d7cla :: 226, ~fyn, Stephen Burnham (donum) + 0w0 :: 227, ~wer + 0w0 :: 228, ~ryc + 0w0 :: 229, ~sug + 0w0 :: 230, ~nys + 0w0 :: 231, ~nyl + 0w0 :: 232, ~lyn + 0w0 :: 233, ~dyn + 0w0 :: 234, ~dem + 0w0 :: 235, ~lux + 0w0 :: 236, ~fed + 0w0 :: 237, ~sed + 0w0 :: 238, ~bec + 0w0 :: 239, ~mun + 0w0 :: 240, ~lyr + 0w0 :: 241, ~tes + 0w0 :: 242, ~mud + 0w0 :: 243, ~nyt + 0w0 :: 244, ~byr + 0w0 :: 245, ~sen + 0w0 :: 246, ~weg + 0w0 :: 247, ~fyr + 0w0 :: 248, ~mur + 0w0 :: 249, ~tel + 0w0 :: 250, ~rep + 0w0 :: 251, ~teg + 0w0 :: 252, ~pec + 0w0 :: 253, ~nel + 0w0 :: 254, ~nev + 0wY.a0HAU.7Lbkf.6V514.OsJBv :: 255, ~fes, John Burnham (donum) + == + -- + :::::::::::::::::::::::::::::::::::::::::::::::::::::::: + :: section 4aB, packet format :: + :: + |% + ++ bite :: packet to cake + |= pac=rock ^- cake + =+ [mag=(end 5 1 pac) bod=(rsh 5 1 pac)] + =+ :* vez=(end 0 3 mag) :: protocol version + chk=(cut 0 [3 20] mag) :: checksum + wix=(bex +((cut 0 [23 2] mag))) :: width of receiver + vix=(bex +((cut 0 [25 2] mag))) :: width of sender + tay=(cut 0 [27 5] mag) :: message type + == + ?> =(0 vez) + ?> =(chk (end 0 20 (mug bod))) + :+ [(end 3 wix bod) (cut 3 [wix vix] bod)] + (kins tay) + (rsh 3 (add wix vix) bod) + :: + ++ kins |=(tay=@ `skin`(snag tay [%none %open %fast %full ~])) + ++ ksin |=(sin=skin `@`?-(sin %none 0, %open 1, %fast 2, %full 3)) + ++ spit :: cake to packet + |= kec=cake ^- @ + =+ wim=(met 3 p.p.kec) + =+ dum=(met 3 q.p.kec) + =+ yax=?:((lte wim 2) 0 ?:((lte wim 4) 1 ?:((lte wim 8) 2 3))) + =+ qax=?:((lte dum 2) 0 ?:((lte dum 4) 1 ?:((lte dum 8) 2 3))) + =+ wix=(bex +(yax)) + =+ vix=(bex +(qax)) + =+ bod=:(mix p.p.kec (lsh 3 wix q.p.kec) (lsh 3 (add wix vix) r.kec)) + =+ tay=(ksin q.kec) + %+ mix + %+ can 0 + :~ [3 0] + [20 (mug bod)] + [2 yax] + [2 qax] + [5 tay] + == + (lsh 5 1 bod) + -- + :::::::::::::::::::::::::::::::::::::::::::::::::::::::: + :: section 4aC, PKI engine :: + :: + |% + ++ go :: go + |_ ton=town :: ames state + ++ as :: as:go + |_ [our=ship saf=safe] :: per server + ++ born :: born:as:go + |= [now=@da her=@p tic=@pG ges=gens pub=pass] :: register user + ^- [(unit will) _+>] + ?. =(our (sein her)) [~ +>.$] + =+ nes=sen + ?. =(tic (end 6 1 (shaf %tick (mix her (shax sec:ex:q.nes))))) + [~ +>.$] + =+ rad=(~(get by hoc.saf) her) + ?^ rad + ?> ?=(^ lew.wod.u.rad) + ?. =(pub r.q.i.lew.wod.u.rad) [~ +>.$] + [[~ lew.wod.u.rad] +>.$] + =+ syp=[[0 [~ p.nes] her now] ges pub] + =+ ded=[(sign:se:q.nes *code (shaf %meld (sham syp))) syp] + =+ wil=[ded law.saf] + ?> =(wil (grip wil ~)) + :- [~ wil] + +>.$(hoc.saf (~(put by hoc.saf) her [[~31337.1.1 ~ wil] ~ *cask])) + :: + ++ lax :: lax:as:go + |_ [her=ship dur=door] :: per client + ++ cluy :: cluy:lax:as:go + ^- [p=life q=gens r=acro] :: client crypto + ?~ lew.wod.dur !! + :+ p.p.q.i.lew.wod.dur + q.q.i.lew.wod.dur + (hail r.q.i.lew.wod.dur) + :: + ++ clon + ^- life + ?~(lew.wod.dur 0 p.p.q.i.lew.wod.dur) + :: + ++ deng + |= law=will + %_(+> lew.wod.dur (grip law lew.wod.dur)) + :: + ++ griz :: griz:lax:as:go + |= now=@da :: generate key for + ^- [p=code q=_+>] + =+ key=(shas %enty (mix now any.ton)) + :- key + %= +>.$ + any.ton (shax (mix now any.ton)) + heg.caq.dur (~(put by heg.caq.dur) (shaf %hand key) key) + == + :: + ++ pode :: pode:lax:as:go + ^+ . :: timeout route + ?: (lth her 256) . + .(lun.wod.dur ~) + :: + ++ kuch :: kuch:lax:as:go + |= had=hand :: hear key tag + ^- (unit ,[code _+>]) + =+ wey=(~(get by heg.caq.dur) had) + ?^ wey + =+ key=u.wey + :+ ~ key + %= ..kuch + yed.caq.dur [~ had u.wey] + heg.caq.dur (~(del by heg.caq.dur) had) + qim.caq.dur (~(put by qim.caq.dur) had key) + == + =+ dyv=(~(get by qim.caq.dur) had) + ?~ dyv ~ + [~ u.dyv ..kuch] + :: + ++ trox :: trox:lax:as:go + |= [now=@da] :: expire by date + ^+ +> + +> :: XX + :: + ++ wasc :: wasc:lax:as:go + |= key=code :: hear foreign code + ^+ +> + =+ had=(shaf %hand key) + %_ ..wasc + yed.caq.dur [~ had key] + qim.caq.dur (~(put by qim.caq.dur) had key) + == + :: + ++ wast :: wast:lax:as:go + |= ryn=lane :: set route + ^+ +> + %= +> + lun.wod.dur + ?: ?=([%ix *] ryn) + ?: ?| ?=(~ lun.wod.dur) + ?& ?=([%ix *] u.lun.wod.dur) + !=(q.ryn q.u.lun.wod.dur) + !=(r.ryn r.u.lun.wod.dur) + == + == + [~ ryn] + lun.wod.dur + [~ ryn] + == + :: + ++ wist :: wist:lax:as:go + |= $: now=@da :: route via + waz=(list ,@p) + ryn=(unit lane) + pac=rock + == + ^- (list boon) + ?: =(our her) [[%ouzo *lane pac] ~] + ?~ waz ~ + =+ dyr=?:(=(her i.waz) dur (gur i.waz)) + ?. ?& !=(our i.waz) + ?=(^ lun.wod.dyr) + == + $(waz t.waz) + :_ ?: ?=(%ix -.u.lun.wod.dyr) + $(waz t.waz) + ~ + :+ %ouzo u.lun.wod.dyr + ?: &(=(i.waz her) =(~ ryn)) pac + =+ mal=(jam `meal`[%fore her ryn pac]) + %- spit + ^- cake + :* [our i.waz] + ?~ yed.caq.dyr [%none mal] + :- %fast + %^ cat 7 + p.u.yed.caq.dyr + (en:crya q.u.yed.caq.dyr mal) + == + :: + ++ xeno :: xeno:lax:as:go + ^- (list ship) :: foreign canon + (saxo her) + :: + ++ xong :: xong:lax:as:go + ^- (list ship) :: route unto + =+ [fro=xen too=xeno] + =+ ^= oot ^- (list ship) + =| oot=(list ship) + |- ^+ oot + ?~ too ~ + ?: (lien fro |=(a=ship =(a i.too))) ~ + [i.too $(too t.too)] + :: ~& [%xong-to [our her] (weld oot ?>(?=(^ fro) t.fro))] + (weld oot ?>(?=(^ fro) t.fro)) + :: + ++ zuul :: zuul:lax:as:go + |= [now=@da ham=meal] :: encode message + ^- [p=(list rock) q=_+>] + =< weft + |% + ++ wasp :: null security + ^-([p=skin q=@] [%none (jam ham)]) + :: + ++ weft :: fragment message + ^- [p=(list rock) q=_+>.$] + =^ gim ..weft wisp + :_ +>.$ + ^- (list rock) + =+ wit=(met 13 q.gim) + ?< =(0 wit) + ?: =(1 wit) + =+ yup=(spit [our her] p.gim q.gim) + [yup ~] + =+ ruv=(rip 13 q.gim) + =+ gom=(shaf %thug q.gim) + =+ inx=0 + |- ^- (list rock) + ?~ ruv ~ + =+ ^= vie + %+ spit + [our her] + wasp(ham [%carp (ksin p.gim) inx wit gom i.ruv]) + :- vie + $(ruv t.ruv, inx +(inx)) + :: + ++ wisp :: generate message + ^- [[p=skin q=@] q=_..wisp] + ?: =(%carp -.ham) + [wasp ..wisp] + ?: !=(~ yed.caq.dur) + :_ ..wisp + :- %fast + %^ cat 7 + p.u.yed.caq.dur + (en:r:cluy q.u.yed.caq.dur (jam ham)) + ?: &(=(~ lew.wod.dur) =(%back -.ham)) + [wasp ..wisp] + =^ tuy +>.$ + ?:(=(~ lew.wod.dur) [*code +>.$] (griz now)) + :_ ..wisp + =+ yig=sen + =+ ^= gom + %^ jam + `life`p.yig + :: `will`(pare wyl.dur law.saf) :: XX not set + law.saf :: XX send whole will + `@`(sign:se:q.yig tuy (jam ham)) + ?: =(~ lew.wod.dur) + [%open gom] + :- %full + =+ cay=cluy + (jam p.cay (seal:pu:r.cay tuy gom)) + -- :: --zuul:lax:as:go + -- :: --lax:as:go + :: + ++ gur :: default door + |= her=ship + ^- door + =+ def=?.((lth her 256) ~ [~ %if 0 (mix her .0.0.1.0)]) + [[~2100.1.1 def ~] ~ *cask] + :: + ++ myx :: door by ship + |= her=ship + ^+ lax + =+ fod=(~(get by hoc.saf) her) + ~(. lax [her ?~(fod (gur her) u.fod)]) + :: + ++ nux :: install door + |= new=_lax + ^+ +> + +>(hoc.saf (~(put by hoc.saf) her.new dur.new)) + :: + ++ sen :: current crypto + ^- [p=life q=acro] + ?~(val.saf !! [p.i.val.saf r.i.val.saf]) + :: + ++ sev :: crypto by life + |= mar=life + ^- [p=? q=acro] + ?~ val.saf !! + ?: =(mar p.i.val.saf) + [& r.i.val.saf] + ?> (lth mar p.i.val.saf) + :- | + |- ^- acro + ?: =(mar p.i.t.val.saf) + r.i.t.val.saf + $(t.val.saf t.t.val.saf) + :: + ++ sex :: export secrets + |- ^- mace + ?~ val.saf ~ + :- [p.i.val.saf sec:ex:r.i.val.saf] + $(val.saf t.val.saf) + :: + ++ xen :: canon + |- ^- (list ship) + (saxo our) + :: + ++ yew :: best will for + |= her=ship + ^- will + =+ gel=(~(get by hoc.saf) her) + ?^ gel + lew.wod.u.gel + ?:((lth her 256) ~ $(her (sein her))) + -- :: --as:go + :: + ++ ha :: adopt new license + |= [our=ship mac=mace wil=will] + ^- town + ?> !=(~ mac) + ?> ?=(^ wil) + :: ?> =(our r.p.q.i.wil) + ?> =(wil (grip wil ~)) + ?> (real mac wil) + %_ ton + urb + %+ ~(put by urb.ton) + our + :* %- flop + |- ^- (list ship) + ?:((lth our 256) ~ =+(seg=(sein our) [seg $(our seg)])) + :: + (turn mac |=([p=life q=ring] [p q (wear q)])) + wil + ~ + ~ + == + == + :: + ++ su :: install safe + |= new=_as + ^- town + ton(urb (~(put by urb.ton) our.new saf.new)) + :: + ++ ti :: expire by time + |= [now=@da] + ^- town + !! + :: + ++ us :: produce safe + |= our=ship + ^- (unit ,_as) + =+ goh=(~(get by urb.ton) our) + ?~ goh ~ + [~ ~(. as [our u.goh])] + -- :: --go + -- + :::::::::::::::::::::::::::::::::::::::::::::::::::::::: + :: section 4aF, packet pump :: + |% + ++ pu :: packet pump + |_ shed + ++ abet +< + ++ ahoy :: ahoy:pu + ^+ . :: initialize + %_ . + rtt ~s1 + rto ~s4 + rtn ~ + rue ~ + nus 0 + nif 0 + nep 0 + caw 2 + cag 64 + diq ~ + pyz ~ + puq ~ + == + :: + ++ bick :: bick:pu + |= [now=@da fap=flap] :: ack by hash + ^- [[p=(unit soup) q=(list rock)] _+>] + =+ sun=(~(get by diq) fap) + ?~ sun + :: ~& [%bick-none `@p`(mug fap)] :: not a real error + [[~ ~] +>.$] + :: ~& [%bick-good `@p`(mug fap) u.sun] + =. diq (~(del by diq) fap) + =^ gub +>.$ (bock now u.sun) + =^ yop +>.$ (harv now) + [[gub yop] +>.$] + :: + ++ bilk :: bilk:pu + |= now=@da :: inbound packet + ^+ +> + =+ trt=(mul 2 rtt) + %= +>.$ + rue [~ now] + rto trt + rtn ?~(puq ~ [~ (add now trt)]) + == + :: + ++ bust :: bust:pu + ^- ? :: not responding + &(?=(^ rtn) (gte rto ~s16)) + :: + ++ bike :: bike:pu + ^+ . :: check stats + ?> .= nif + |- ^- @ + ?~ puq 0 + :(add !liv.q.n.puq $(puq l.puq) $(puq r.puq)) + . + :: + ++ beet :: beet:pu + ^+ . :: advance unacked + =- +(nep ?~(foh nus u.foh)) + ^= foh + |- ^- (unit ,@ud) + ?~ puq ~ + ?: (lte p.n.puq nep) $(puq l.puq) + =+ rig=$(puq r.puq) + ?^(rig rig [~ p.n.puq]) + :: + ++ bine :: bine:pu + |= [now=@da num=@ud] :: apply ack + ^- [(unit soup) _+>] + ?~ puq !! + ?. =(num p.n.puq) + ?: (gth num p.n.puq) + =+ lef=$(puq l.puq) + [-.lef +.lef(puq [n.puq puq.lef r.puq])] + =+ rig=$(puq r.puq) + [-.rig +.rig(puq [n.puq l.puq puq.rig])] + =: rtt ?. &(liv.q.n.puq =(1 nux.q.n.puq)) rtt + =+ gap=(sub now lys.q.n.puq) + :: ~& [%bock-trip num (div gap (div ~s1 1.000))] + (div (add (mul 2 rtt) gap) 3) + nif (sub nif !liv.q.n.puq) + == + =+ lez=(dec (need (~(get by pyz) gom.q.n.puq))) + =^ gub pyz + ?: =(0 lez) + [[~ gom.q.n.puq] (~(del by pyz) gom.q.n.puq)] + [~ (~(put by pyz) gom.q.n.puq lez)] + :- gub + +>.$(puq ~(nap to puq)) + :: + ++ bock :: bock:pu + |= [now=@da num=@ud] :: ack by sequence + ^- [(unit soup) _+>] + =^ gym +> (bine now num) + :- gym + ?: (gth num nep) + =+ cam=(max 2 (div caw 2)) + :: ~& [%bock-hole num nep cam] + beet:(wept(nep num, cag cam, caw cam) nep num) + =. caw ?: (lth caw cag) +(caw) + (add caw !=(0 (mod (mug now) caw))) + ?: =(num nep) + :: ~& [%bock-fine num nif caw cag] + beet + :: ~& [%bock-fill num nif caw cag] + +>.$ + :: + ++ harv :: harv:pu + |= now=@da :: harvest queue + ^- [(list rock) _+>] + ?: =(~ puq) [~ +>(rtn ~)] + ?. (gth caw nif) [~ +>] + =+ wid=(sub caw nif) + =| rub=(list rock) + =< abet =< apse + |% + ++ abet + ?~ rub [~ +>.$] + [(flop rub) +>.$(rtn [~ (add rto now)])] + :: + ++ apse + ^+ . + ?~ puq . + ?: =(0 wid) . + => rigt =< left + ?: =(0 wid) . + ?. =(| liv.q.n.puq) . + :: ~& [%harv nux.q.n.puq p.n.puq] + %_ . + wid (dec wid) + rub [pac.q.n.puq rub] + nif +(nif) + liv.q.n.puq & + nux.q.n.puq +(nux.q.n.puq) + lys.q.n.puq now + == + :: + ++ left ^+(. =+(lef=apse(puq l.puq) lef(puq [n.puq puq.lef r.puq]))) + ++ rigt ^+(. =+(rig=apse(puq r.puq) rig(puq [n.puq l.puq puq.rig]))) + -- + :: + ++ wack :: wack:pu + |= now=@da :: wakeup (timeout) + ^- [(list rock) _+>] + ?. &(!=(~ rtn) (gte now u.rtn)) [~ +>] + :: ~& [%slow (div rto (div ~s1 1.000))] + =. +> (wept 0 nus) + ?> =(0 nif) + =+ oub=(gte rto ~s16) + =: caw 2 + rto ;: min + (mul 2 rto) + ~m2 + (mul ~s16 ?~(rue 1 +((div (sub now u.rue) ~d1)))) + == + == + (harv now) + :: + ++ wept :: wept:pu + |= [fip=@ud lap=@ud] :: fip thru lap-1 + =< abet =< apse + |% + ++ abet +>.$ + ++ apse + ^+ . + ?~ puq . + ?: (lth p.n.puq fip) ?~(l.puq . left) + ?: (gte p.n.puq lap) ?~(r.puq . rigt) + => rigt =< left + ?.(liv.q.n.puq . .(nif (dec nif), liv.q.n.puq |)) + :: + ++ left ^+(. =+(lef=apse(puq l.puq) lef(puq [n.puq puq.lef r.puq]))) + ++ rigt ^+(. =+(rig=apse(puq r.puq) rig(puq [n.puq l.puq puq.rig]))) + -- + :: + ++ whap :: whap:pu + |= [now=@da gom=soup wyv=(list rock)] :: send a message + ^- [(list rock) _+>] + =. pyz (~(put by pyz) gom (lent wyv)) + =. +> + |- ^+ +>.^$ + ?~ wyv +>.^$ + %= $ + wyv t.wyv + nus +(nus) + diq (~(put by diq) (shaf %flap i.wyv) nus) + puq (~(put to puq) [nus `soul`[gom 0 | ~2000.1.1 i.wyv]]) + == + (harv now) + -- + -- + :::::::::::::::::::::::::::::::::::::::::::::::::::::::: + :: section 4aG, protocol engine :: + :: + |% + ++ am :: am + |_ [now=@da fox=fort] :: protocol engine + ++ boot :: boot:am + ^- fort :: restore from noun + %= fox + urb.ton + %- ~(gas by *(map ship safe)) + %+ turn + (~(tap by urb.ton.fox) ~) + |= [p=ship q=safe] ^- [p=ship q=safe] + :- p + %= q + val + (turn val.q |=([p=life q=ring r=acro] [p q (wear q)])) + == + == + ++ come :: come:am + |= [ges=(unit ,@t) wid=@ bur=@] :: instantiate pawn + ^- [p=[p=ship q=@uvG] q=fort] + =+ loy=(brew wid bur) + =+ rig=sec:ex:loy + =+ our=`@p`fig:ex:loy + =+ syp=[[0 ~ our now] [%en %pawn ges] pub:ex:loy] + :- [our pac:ex:loy] + %_ fox + ton + %^ ~(ha go ton.fox) + our + `mace`[[0 rig] ~] + `will`[[(sign:se:loy @ (shaf %self (sham syp))) syp] ~] + == + :: + ++ czar :: czar:am + |= [our=ship ger=@uw] :: instantiate emperor + ^- [p=(list boon) q=fort] + =+ loy=(brew 2.048 ger) + ?> =(fig:ex:loy (zeno our)) + =+ mac=`mace`[[0 sec:ex:loy] ~] + =+ syp=`step`[`bray`[0 ~ our now] [%en %czar ~] pub:ex:loy] + =+ ded=`deed`[(sign:se:loy @ (shaf %self (sham syp))) syp] + =+ buq=`buck`[mac [ded ~]] + =: ton.fox (~(ha go ton.fox) our buq) + zac.fox (~(put by zac.fox) our *oven) + == + [[[%beer our pac:ex:loy] ~] fox] + :: + ++ gnaw :: gnaw:am + |= [kay=cape ryn=lane pac=rock] :: process packet + ^- [p=(list boon) q=fort] + =+ kec=(bite pac) + ?. (~(has by urb.ton.fox) q.p.kec) + [~ fox] + =< zork + =< zank + :: ~& [%hear p.p.kec ryn `@p`(mug (shaf %flap pac))] + %- ~(chew la:(ho:(um q.p.kec) p.p.kec) kay ryn %none (shaf %flap pac)) + [q.kec r.kec] + :: + ++ hall :: hall:am + ^- (list sock) :: all sockets + =| sox=(list sock) :: XX hideous + |- ^+ sox + ?~ zac.fox sox + =. sox $(zac.fox l.zac.fox) + =. sox $(zac.fox r.zac.fox) + |- ^+ sox + ?~ wab.q.n.zac.fox sox + =. sox $(wab.q.n.zac.fox l.wab.q.n.zac.fox) + =. sox $(wab.q.n.zac.fox r.wab.q.n.zac.fox) + [[p.n.zac.fox p.n.wab.q.n.zac.fox] sox] + :: + ++ have :: have:am + |= [our=ship buq=buck] :: acquire license + ^- [p=(list boon) q=fort] + =: ton.fox (~(ha go ton.fox) our buq) + zac.fox (~(put by zac.fox) our *oven) + == + [[[%beer our pac:ex:q:sen:(need (~(us go ton.fox) our))] ~] fox] + :: + ++ kick :: kick:am + |= hen=duct :: refresh net + =+ aks=(turn (~(tap by urb.ton.fox) ~) |=([p=ship q=safe] p)) + |- ^- [p=(list boon) q=fort] + ?~ aks [~ fox] + =^ buz fox zork:(kick:(um i.aks) hen) + =^ biz fox $(aks t.aks) + [(weld p.buz p.biz) fox] + :: + ++ wake :: wake:am + ^- [p=(list boon) q=fort] :: harvest packets + =+ sox=hall + =| bin=(list boon) + |- ^- [p=(list boon) q=fort] + ?~ sox [bin fox] + =^ bun fox zork:zank:thaw:(ho:(um p.i.sox) q.i.sox) + $(sox t.sox, bin (weld p.bun bin)) + :: + ++ wash :: wash:am + |= [soq=sock sup=soap ham=meal] :: dispatch and send + ^- [p=(list boon) q=fort] + zork:zank:(wind:(ho:(um p.soq) q.soq) [q.sup r.sup] ham) + :: + ++ went :: went:am + |= [soq=sock hen=duct cap=cape sup=soap] :: internal react + ^- [p=(list boon) q=fort] + zork:(kick:(um p.soq) hen) + :: + ++ wert :: wert:am + |= [soq=sock hen=duct inx=@ud rot=riot] :: serve a file + ^- [p=(list boon) q=fort] + =+ ruv=(need (~(get by rop.fox) [inx soq])) + (wise soq [/a hen] %ru [inx rot]) + :: + ++ wise :: wise:am + |= [soq=sock hen=duct cha=@ta val=*] :: send a statement + ^- [p=(list boon) q=fort] + zork:zank:(wool:(ho:(um p.soq) q.soq) hen cha val) + :: + ++ um :: per server + |= our=ship + =+ gus=(need (~(us go ton.fox) our)) + =+ ^= weg ^- oven + =+ weg=(~(get by zac.fox) our) + ?^(weg u.weg *oven) + =| bin=(list boon) + |% + ++ ho :: ho:um:am + |= her=ship :: per friend + =+ diz=(myx:gus her) + =+ bah=(~(get by wab.weg) her) + =+ puz=?~(bah ahoy:pu %*(. pu +< sop.u.bah)) + => .(bah `bath`?~(bah [abet:puz ~ ~] u.bah)) + |% + ++ busk :: busk:ho:um:am + |= [waz=(list ship) pax=(list rock)] :: send packets + %_ +> + bin + |- ^+ bin + ?~ pax bin + $(pax t.pax, bin (weld (flop (wist:diz now waz ~ i.pax)) bin)) + == + :: + ++ done :: done:ho:um:am + |= [cha=@ta num=@ud] :: complete outgoing + ^- [(unit duct) _+>] + =+ rol=(need (~(get by ryl.bah) cha)) + =+ rix=(~(get by san.rol) num) + ?~ rix [~ +>.$] + :- rix + %_ +>.$ + ryl.bah + (~(put by ryl.bah) cha rol(san (~(del by san.rol) num))) + == + :: + ++ la :: la:ho:um:am + |_ [kay=cape ryn=lane aut=skin dam=flap] :: per packet + :: + ++ chew :: chew:la:ho:um:am + |= [sin=skin msg=@] :: receive + ^+ +> + =< apse + |% + ++ apse + ^+ +>.$ + =+ oub=bust:puz + =+ neg==(~ yed.caq.dur.diz) + =. +>.$ east + =+ eng==(~ yed.caq.dur.diz) + =. puz (bilk:puz now) + =+ bou=bust:puz + =. bin + ?. &(oub !bou) bin + :_(bin [%wine [our her] " is ok"]) + =. bin + ?. &(neg !eng) bin + :_(bin [%wine [our her] " is your neighbor"]) + +>.$ + :: + ++ east + ^+ +>.$ + ?- sin + %none + :: ~& %chew-none + (chow ((hard meal) (cue msg))) + :: + %fast + :: ~& %chew-fast + =+ [mag=`hand`(end 7 1 msg) bod=(rsh 7 1 msg)] + =+ dey=(kuch:diz mag) + ?~ dey +>.$ :: ignore unknown key + =. +>.$ enuf + =^ key diz u.dey + (chow(aut sin) ((hard meal) (cue (dy:q:sen:gus key bod)))) + :: + %full + :: ~& %chew-full + =+ mex=((hard ,[p=life q=@]) (cue msg)) + =+ gey=(sev:gus p.mex) + =+ mes=(need (tear:se:q.gey q.mex)) + =. diz (wasc:diz p.mes) + =. +>.$ enuf + (west(msg q.mes) p.mes) + :: + %open + :: ~& %chew-open + (west *code) + == + ++ west + |= key=code + =+ ^= mex + %. (cue msg) + (hard ,[p=life q=will r=@]) + =. diz (deng:diz q.mex) + =+ wug=cluy:diz + ?> =(p.mex p.wug) + %- chow(aut sin) + ((hard meal) (cue (need (sure:pu:r.wug key r.mex)))) + -- + :: + ++ chow :: chow:la:ho:um:am + |= fud=meal :: interpret meal + ^+ +> + =. diz ?:(=(%none aut) diz (wast:diz ryn)) + (dine fud) + :: + ++ cock :: cock:la:ho:um:am + ^+ . :: acknowledgment + :: ~& [%back kay dam] + =^ pax diz (zuul:diz now [%back kay dam ~s0]) + +(+> (busk(diz (wast:diz ryn)) xong:diz pax)) + :: + ++ coot :: coot:la:ho:um:am + |= [cha=@ta rum=race] :: update input race + ^+ +> + =+ cun=(~(get by mis.rum) did.rum) + ?~ cun + +>.$(raz.bah (~(put by raz.bah) cha rum)) + =. +>.$ cock(kay p.u.cun, dam q.u.cun) + =. +>.$ ?. =(%good p.u.cun) +>.$ + (emit [%milk [our her] cha did.rum r.u.cun]) + %= $ + mis.rum (~(del by mis.rum) did.rum) + did.rum +(did.rum) + == + :: + ++ dear :: dear:la:ho:um:am + |= [cha=@ta num=@ud dut=(unit)] :: interpret message + ^+ +> + =+ ^= rum ^- race + =+ rum=(~(get by raz.bah) cha) + ?~(rum *race u.rum) + ?. (gte num did.rum) + cock :: always ack a dup + (coot cha rum(mis (~(put by mis.rum) num [kay dam dut]))) + :: + ++ dine :: dine:la:ho:um:am + |= fud=meal :: interpret meal + ^+ +> + ?- -.fud + %back + :: ~& [%back aut her ryn `@p`(mug dam)] + =. +> ?.(=(%full aut) +> cock) :: finish key exch + +>(..la (tuck p.fud q.fud r.fud)) + :: + %bond + :: ~& [%bond q.fud r.fud] + ?> =(p:sen:gus p.fud) + (dear q.fud r.fud ?-(kay ?(%dead %lost) ~, %good [~ s.fud])) + :: + %carp + =+ zol=(~(get by olz.weg) s.fud) + ?^ zol cock(kay u.zol) + =^ neb nys.weg + =+ neb=(~(get by nys.weg) s.fud) + ?^ neb [u.neb nys.weg] + =+ neb=`bait`[(kins p.fud) 0 r.fud ~] + [neb (~(put by nys.weg) s.fud neb)] + ?> (lth q.fud p.r.neb) + ?> =((kins p.fud) p.neb) + ?> =(r.fud p.r.neb) + =+ doy=`(unit ,@)`(~(get by q.r.neb) q.fud) + ?^ doy cock + => ^+ . %= . + q.r.neb (~(put by q.r.neb) q.fud t.fud) + q.neb +(q.neb) + == + :: ~& [%carp q.fud s.fud q.neb p.r.neb] + ?: =(q.neb p.r.neb) + =: nys.weg (~(del by nys.weg) s.fud) + olz.weg (~(put by olz.weg) s.fud kay) + == + (golf p.neb r.neb) + =. +>.$ cock + +>.$(nys.weg (~(put by nys.weg) s.fud neb)) + :: + %fore + =+ ^= lyn ^- lane + ?~ q.fud ryn + ?. ?=(%if -.u.q.fud) u.q.fud + [%ix now +.u.q.fud] + :: u.q.fud + ?: =(our p.fud) + (emit %mead lyn r.fud) + =+ zid=(myx:gus p.fud) + (emir (wist:zid now xong:zid [~ lyn] r.fud)) + == + :: + ++ emir :: emir:la:ho:um:am + |= ben=(list boon) :: emit boons + ^+ +> + ?~(ben +> $(ben t.ben, bin [i.ben bin])) + :: + ++ emit :: emit:la:ho:um:am + |= bun=boon :: emit a boon + +>(bin [bun bin]) + :: + ++ enuf :: enuf:la:ho:um:am + %_(. puz (bilk:puz now)) :: heard fast on + :: + ++ golf :: golf:la:ho:um:am + |= [sin=skin duv=dove] :: assemble fragments + ^+ +> + %+ chew sin + =+ [nix=0 rax=*(list ,@)] + |- ^- @ + ?: =(p.duv nix) + (can 13 (turn (flop rax) |=(a=@ [1 a]))) + $(nix +(nix), rax [(need (~(get by q.duv) nix)) rax]) + :: + ++ wait :: wait:la:ho:um:am + |= [sin=skin msg=@] :: receive indirect + ^+ +> + =+ pay=((hard ,[p=@ud q=@uvH r=@]) (cue msg)) + =. nys.weg (~(put by nys.weg) q.pay [sin 0 p.pay ~]) + (dine [%carp (ksin sin) 0 p.pay q.pay r.pay]) + -- :: --la:ho:um:am + :: + ++ pong :: pong:ho:um:am + |= hen=duct :: test connection + ^+ [? +>] + ?. |(?=(~ rue.puz) (lth u.rue.puz hop.fox) bust:puz) + :: ~& [%pong-no her] + [| +>.$] + :: ~& [%pong-yes now her] + [& (wool [/a hen] %pi ~)] + :: + ++ thaw :: thaw:ho:um:am + ^+ . :: wakeup bomb + =+ oub=bust:puz + =^ yem puz (wack:puz now) + =+ bou=bust:puz + =. bin + ?. &(bou !oub) bin + :_(bin [%wine [our her] " not responding still trying"]) + (busk xong:diz yem) + :: + ++ tuck :: tuck:ho:um:am + |= [kay=cape fap=flap cot=@dr] :: ack by hash + ^+ +> + =^ yoh puz (bick:puz now fap) + =. +>.$ + ?~ p.yoh +>.$ + =^ hud +>.$ (done p.u.p.yoh q.u.p.yoh) + ?~ hud +>.$ + %= +>.$ + bin + :_ bin + `boon`[%coke [our her] kay [[p:sen:gus clon:diz] u.p.yoh] u.hud] + == + (busk xong:diz q.yoh) + :: + ++ wind :: wind:ho:um:am + |= [gom=soup ham=meal] + :: ~& [%wind her gom] + ^+ +> + =^ wyv diz (zuul:diz now ham) + =^ feh puz (whap:puz now gom wyv) + (busk xong:diz feh) + :: + ++ wool :: wool:ho:um:am + |= [hen=duct cha=@ta val=*] :: send a statement + ^+ +> + =+ ^= rol ^- rill + =+ rol=(~(get by ryl.bah) cha) + ?~(rol *rill u.rol) + =+ sex=sed.rol + :: ~& [%tx [our her] cha sex] + =. ryl.bah + %+ ~(put by ryl.bah) cha + rol(sed +(sed.rol), san (~(put by san.rol) sex hen)) + =+ cov=[p=p:sen:gus q=clon:diz] + (wind [cha sex] [%bond q.cov cha sex val]) + :: + ++ zank :: zank:ho:um:am + %= +>.$ :: resolve + gus (nux:gus diz) + wab.weg (~(put by wab.weg) her bah(sop abet:puz)) + == + -- :: --ho:um:am + :: + ++ kick :: kick:um:am + |= hen=duct :: test connection + =+ hoy=hoy.saf.gus + |- ^+ +>.^$ + ?~ hoy + +>.^$ + =^ fyx +>.^$ (pong i.hoy hen) + ?: fyx +>.^$ + $(hoy t.hoy) + :: + ++ pals :: pals:um:am + ^- (list ,@p) :: active neighbors + %+ turn + :: (skim (~(tap by wab.weg) ~) |=([a=ship b=bath] gay.b)) + (~(tap by wab.weg) ~) :: everyone for now + |=([a=ship b=bath] a) + :: + ++ pong :: pong:um:am + |= [her=ship hen=duct] :: test neighbor + ^+ [? +>] + =+ xup=(pong:(ho her) hen) + ?. -.xup [| +>.$] + [& zank:+.xup] + :: + ++ zork :: zork:um:am + ^- [p=(list boon) q=fort] :: resolve + :- (flop bin) + %_ fox + ton (~(su go ton.fox) gus) + zac (~(put by zac.fox) our.gus weg) + == + -- :: --um:am + -- :: --am + -- + . == + :::::::::::::::::::::::::::::::::::::::::::::::::::::::: + :: section 4aH, protocol vane :: + :: + =| $: fox=fort :: kernel state + == :: + |= [now=@da eny=@ sky=||(* (unit))] :: current invocation + ^? :: opaque core + =< + |% :: vane interface + ++ beat + |= [wru=(unit writ) tea=wire hen=duct fav=curd] + => .(fav ((hard card) fav)) + ^- [p=(list move) q=vane] + =^ duy ..knap + (knap wru tea hen fav) + [duy ..^$] + :: + ++ come + |= old=vase + ^- vane + ~|(%load-nest-ames !!) + :: + ++ doze + |= [now=@da hen=duct] + =| doz=(unit ,@da) + |- ^+ doz + ?~ zac.fox doz + =. doz $(zac.fox l.zac.fox) + =. doz $(zac.fox r.zac.fox) + =+ yem=q.n.zac.fox + |- ^+ doz + ?~ wab.yem doz + =. doz $(wab.yem l.wab.yem) + =. doz $(wab.yem r.wab.yem) + =+ bah=q.n.wab.yem + (hunt doz rtn.sop.bah) + :: + ++ flee stay + ++ load + |= new=vase + ^- vane + ?. (~(nest ut -:!>(fox)) & p.new) + (come new) + ..^$(fox ~(boot am [now (fort q.new)])) + :: + ++ raze + ^- vane + ..$(fox *fort) + :: + ++ scry + |= [our=ship ren=@tas his=ship syd=disc lot=coin tyl=path] + ^- (unit) + ?. =(0 ren) ~ + ?+ lot ~ + [%$ %ud @] + (perm our his q.p.lot [syd tyl]) + :: + [%$ %da @] + ?. =(now q.p.lot) ~ + (temp our his [syd tyl]) + == + :: + ++ stay `vase`!>(fox) + -- + |% + ++ claw |=(our=ship ^-(duct hen:(need (~(get by zac.fox) our)))) + ++ clop + |= [wru=(unit writ) now=@da hen=duct bon=boon] + ^- [(list move) fort] + ?- -.bon + %beer + :_ fox(zac (~(put by zac.fox) p.bon `oven`[hen ~ ~ ~])) + :* [[~ %gold p.bon] [/c hen] [%init p.bon]] + [[~ %gold p.bon] hen [%init p.bon]] + [[~ %gold p.bon] [/a hen] [%kick now]] + =+ bos=(sein p.bon) + =. bos ?.(=(bos p.bon) bos ~zod) + ?: =(~zod p.bon) ~ + :~ [[~ %iron p.bon] [/c hen] [%pull bos %main ~[%main]]] + [[~ %iron p.bon] [/c hen] [%pull bos %spec ~[%spec]]] + [[~ %iron p.bon] [/c hen] [%pull bos %try ~[%try]]] + [[~ %iron p.bon] [/c hen] [%pull bos %arvo ~[%arvo]]] + == + == + :: + %coke + :: ~& [%tz p.bon q.bon q.r.bon r.r.bon] + :_ fox + :~ [[~ %iron p.p.bon] s.bon [%went q.p.bon q.bon r.bon]] + == + :: + %mead :_(fox [[wru hen [%hear p.bon q.bon]] ~]) + %milk + :: ~& [%rx p.bon q.bon r.bon !=(~ s.bon)] + ?+ q.bon + :_ fox + :~ :+ [~ %iron p.p.bon] + (claw p.p.bon) + [%wart q.p.bon q.bon r.bon s.bon] + == + :: + %hi :: %hi + %= $ + bon + :+ %wine p.bon + ^- tape + ?~ s.bon + " is not feeling well" + ?: =(0 u.s.bon) + =+ hum=(end 0 3 (mug r.bon)) + ?+ hum !! + 0 " was thinking about something else" + 1 " prefers not to comment" + 2 " has no words for what just happened" + 3 " is still in the building" + 4 " remains quietly present" + 5 " isn't into drama" + 6 " likes to let others speak" + 7 " sincerely wants to know more" + == + =+ str=(need ((sand %t) ((hard ,@) u.s.bon))) + [':' ' ' (trip str)] + == + :: + %ye :: %ye + :: ~& [%ye bon] + ?~ s.bon [~ fox] + ?> =(p.p.bon (sein q.p.bon)) + =+ ^= paz ^- (list ,@p) + %+ skim pals:(~(um am [now fox]) p.p.bon) + |=(a=@p =(p.p.bon (sein a))) + :_ fox + %+ turn paz + |= him=ship + :+ [~ %iron p.p.bon] + [/a /a hen] + [%want him %yu [q.p.bon u.s.bon]] + :: + %yu :: %yu + :: ~& [%yu bon] + ?. =(q.p.bon (sein p.p.bon)) [~ fox] + ?~ s.bon [~ fox] + =+ dof=((hard ,[p=@p q=@t]) u.s.bon) + $(bon [%milk [p.p.bon p.dof] %hi r.bon [~ q.dof]]) + :: + %pi :: %pi + $(bon [%wine p.bon " sent a ping"]) :: ping + :: + %ta :: %ta + ?~ s.bon [~ fox] :: register + =+ gox=((hard ,[p=@p q=@pG r=gens s=pass]) u.s.bon) + =+ gus=(need (~(us go ton.fox) p.p.bon)) + =^ wyl gus (born:gus now gox) + =. ton.fox (~(su go ton.fox) gus) + :_ fox + :~ :+ [~ %iron p.p.bon] + [/a /a hen] + [%want q.p.bon %to `(unit will)`wyl] + == + :: + %re :: %re + ?~ s.bon [~ fox] :: file request + =+ gox=((hard ,[p=@ud q=riff]) u.s.bon) + =+ gut=(~(get by rop.fox) [p.gox p.bon]) + =. rop.fox + ?^ gut + ?>(?=(~ q.q.gox) (~(del by rop.fox) [p.gox p.bon])) + ?>(?=(^ q.q.gox) (~(put by rop.fox) [p.gox p.bon] q.gox)) + :_ fox + :~ :+ [~ %iron p.p.bon] + [/c [%a (scot %p q.p.bon) (scot %ud p.gox) ~] hen] + [%warp p.p.bon q.gox] + == + :: + %ru :: %ru + :_ fox + :~ :+ [~ %iron p.p.bon] :: file response + [/c (claw p.p.bon)] + [%wart q.p.bon q.bon r.bon s.bon] + == + :: + %su :: %su + ?~ s.bon [~ fox] + =+ gox=((hard ,@t) u.s.bon) :: suicide + !! + == + :: + %ouzo + :: ~& [%send now p.bon `@p`(mug (shaf %flap q.bon))] + :_ fox + [[wru hen [%send p.bon q.bon]] ~] + :: + %wine + :_ fox + =+ nym=(temp p.p.bon q.p.bon /name) + =+ fom=~(rend co %$ %p q.p.bon) + :~ :+ wru [/d hen] + :+ %flog %text + ;: weld + "; " + ?: |(?=(~ nym) =(%$ u.nym)) fom + :(weld fom " " (trip ((hard ,@) u.nym))) + q.bon + == + == + == + :: + ++ knap + |= [wru=(unit writ) tea=wire hen=duct fav=card] + ^- [(list move) _+>] + ?: ?=([%crud *] fav) + [[[wru [/d hen] [%flog fav]] ~] +>] + =+ ^= fuy ^- [p=(list boon) q=fort] + ?+ -.fav + [~ fox] + :: + %cash + (~(have am [now fox]) p.fav q.fav) + :: + %hear + (~(gnaw am [now fox]) %good p.fav q.fav) + :: + %hole + (~(gnaw am [now fox]) %dead p.fav q.fav) + :: + %junk + [~ fox(any.ton (shax (mix any.ton.fox p.fav)))] + :: + %kick + (~(kick am [now fox(hop p.fav)]) hen) + :: + %make + =+ vun=(~(come am [now fox]) p.fav (bex q.fav) r.fav) + [[[%beer p.vun] ~] q.vun] + :: + %sith + (~(czar am [now fox]) p.fav q.fav) + :: + %want + ?> ?=(^ wru) + (~(wise am [now fox]) [q.u.wru p.fav] hen q.fav r.fav) + :: + %went + (~(went am [now fox]) [q.u.wru p.fav] hen q.fav r.fav) + :: + %wake + ~(wake am [now fox]) + :: + %writ + ?> ?=(^ wru) + ?> ?=([@ @ ~] tea) + =+ fyg=(slay i.tea) + =+ haw=(slay i.t.tea) + ?> &(?=([~ %$ %p @] fyg) ?=([~ %$ %ud @] haw)) + (~(wert am [now fox]) [q.u.wru q.p.u.fyg] hen q.p.u.haw p.fav) + == + => %_(. fox q.fuy) + =| out=(list move) + |- ^- [p=(list move) q=_+>.^$] + ?~ p.fuy + [(flop out) +>.^$] + =^ toe fox (clop wru now hen i.p.fuy) + $(p.fuy t.p.fuy, out (weld (flop toe) out)) + :: + ++ perm + |= [our=ship his=ship mar=@ud tyl=path] + ^- (unit) + ?~ tyl ~ + ?: ?=([%name ~] tyl) + =+ wul=$(tyl [%will ~]) + ?~(wul ~ [~ (gnow his q.q.q:((hard deed) -.u.wul))]) + =+ gys=(~(us go ton.fox) our) + ?~ gys ~ + ?. =(our his) + ?: ?=([%will ~] tyl) + =+ fod=(~(get by hoc.saf.u.gys) his) + ?~ fod ~ + (rick mar his lew.wod.u.fod) + ~ + ?: ?=([%buck ~] tyl) + =+ muc=(rice mar sex:u.gys) + =+ luw=(rick mar our law.saf.u.gys) + ?. &(?=(^ muc) ?=(^ luw)) ~ + [~ `buck`[u.muc u.luw]] + ?: ?=([%tick @ ~] tyl) + =+ hur=(slaw %p i.t.tyl) + ?~ hur ~ + ?. =(our (sein u.hur)) ~ + [~ (end 6 1 (shaf %tick (mix u.hur (shax sec:ex:q:sen:u.gys))))] + ?: ?=([%will ~] tyl) + (rick mar our law.saf.u.gys) + ~ + :: + ++ temp + |= [our=ship his=ship tyl=path] + :: ~& [%temp our his tyl] + ^- (unit) + ?. ?=([%life ~] tyl) + =+ muc=$(tyl [%life ~]) + ?~ muc ~ + (perm our his (,@ud u.muc) tyl) + =+ gys=(~(us go ton.fox) our) + ?~ gys ~ + ?. =(our his) + =+ fod=(~(get by hoc.saf.u.gys) his) + ?~ fod ~ + ?~ lew.wod.u.fod ~ + [~ `@ud`p.p.q.i.lew.wod.u.fod] + ?~ val.saf.u.gys ~ + [~ `@ud`p.i.val.saf.u.gys] + -- diff --git a/arvo/batz.hoon b/arvo/batz.hoon new file mode 100644 index 0000000000..52889fab50 --- /dev/null +++ b/arvo/batz.hoon @@ -0,0 +1,1198 @@ +:: +:: batz (4b), shell +:: +|= pit=vase +^- vane +=> =~ +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 4bA, shell models :: +:: +|% +++ bard :: new session + |= who=ship ^- brad + %* . *brad + hox (scot %p who) + cwd %try + fog [0 ~] + p.hit 1 + p.sur 1 + p.god 1 + == +++ brad :: session/dynamic + $: fog=(list ,@ud) :: task consoles + fen=(map ,@tas ,@ud) :: named tasks + hox=@ta :: identity text + cws=path :: working spur + cwd=@tas :: working desk + loq=(unit case) :: working version + pyr=pyre :: compose cache + war=(map ,@tas coal) :: variables + sac=(list skit) :: library stack + sev=(map ,@tas (set ,[p=@ud q=@ud r=wire])) :: message servers + tem=(map ,[p=@ud q=@ud r=wire] ,@da) :: timeouts + hit=[p=@ud q=(list ,@t)] :: command history + sur=[p=@ud q=(qeu vase)] :: result history + god=[p=@ud q=(map ,@ud task)] :: task state + == :: +:: :: +++ bran :: static "state" + $: nub=vase :: + ^= vax :: chestnut vases + $: sot=vase :: 'slot' + == :: + ^= gen :: + $: yom=gene :: '*(set ,@tas)' + zim=gene :: '*(map ,@tas ,*)' + == :: + ^= typ :: chestnut types + $: gee=type :: '*gene' + liz=type :: '*(list ,@t)' + pah=type :: '*path' + noq=type :: '*note' + tak=type :: '*tart' + vas=type :: '*vase' + == :: + == :: +:: +++ bred :: make defaults + =+ nib=pit + =+ pal=~(play ut p.nib) + ~+ + %* . *bran + nub nib + sot.vax (slap nib (vice 'slot')) + yom.gen (vice '*(set ,@tas)') + zim.gen (vice '*(map ,@tas ,*)') + gee.typ (pal (vice '*gene')) + liz.typ (pal (vice '*(list ,@t)')) + pah.typ (pal (vice '*path')) + noq.typ (pal (vice '*note')) + tak.typ (pal (vice '*tart')) + vas.typ (pal (vice '*vase')) + == +++ brat ,[[who=ship bran] brad] :: don't ask why +++ brim (list ,[p=ship q=brad]) :: session +-- :: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 4bB, session engine :: +:: +|% +++ be :: repl/shell + |= brat :: core state + |= [now=@da eny=@ sky=_|+(* *(unit))] + =+ wen=(scot %da now) + =+ wer=`path`[hox cwd wen cws] + =+ rew=(flop wer) + =+ vez=(vang | wer) + |% + ++ fear :: fear:be + |= tea=wire :: validate wire + ^- ? :: XX hack + =+ fat=(feat tea) + =+ dog=(~(get by q.god) p.fat) + ?~ dog | + =+ gib=(~(get by q.wip.u.dog) q.fat) + ?~ gib | + ?. ?=([%ma *] r.fat) | + (~(has by q.u.gib) t.r.fat) + :: + ++ feat :: feat:be + |= tea=wire :: decode wire + ^- [p=@ud q=@ud r=wire] + ?> ?=([@ @ *] tea) + =+ [ped=(slay i.tea) wad=(slay i.t.tea)] + ?> &(?=([~ %$ %ud @] ped) ?=([~ %$ %ud @] wad)) + [q.p.u.ped q.p.u.wad t.t.tea] + :: + ++ fest :: fest:be + |= [gyp=@ud hen=duct] :: find a task + (fi gyp hen (need (~(get by q.god) gyp))) + :: + ++ fist :: fist:be + |= hen=duct :: new task + =+ [gyp=p.god gyr=*task] + =: p.god +(p.god) + q.god (~(put by q.god) p.god *task) + == + (fi gyp hen gyr) + :: + ++ lake :: lake:be + |= [hen=duct gyp=@ud ted=@ud lap=wire] :: deliver wakeup + ^- [p=(list move) q=brat] + abet:lash:abet:(glob:(past:(fest gyp hen) ted) lap [%wake ~]) + :: + ++ lead :: lead:be + |= [tea=wire hen=duct] :: route note + ^- [p=wire q=_ra:*fi] + =+ fat=(feat tea) + [r.fat (past:(fest p.fat hen) q.fat)] + :: + ++ lean :: lean:be + |= [tea=wire hen=duct fav=card] :: deliver card + ^+ *fi + =+ lay=(lead tea hen) + ?> ?=([%ma *] p.lay) + abet:(glob:q.lay t.p.lay fav) + :: + ++ leap :: leap:be + |= [tea=wire hen=duct fav=card] :: handle event + ^- [p=(list move) q=brat] + ?: ?=([%crud *] fav) + [[[[~ %iron who] [/d hen] [%flog fav]] ~] +<.^^$] + ?+ -.fav + [[[[~ %iron who] hen fav] ~] +<.^^$] + %hail [[[[~ %iron who] hen [%helo prot]] ~] +<.^^$] + %line =+ gyp=?>(?=(^ fog) i.fog) + ?: &(=(0 gyp) =(%$ p.fav)) $(fav [%hail ~]) + =< abet + ?: =(0 gyp) + lash:(gill:(fist hen) p.fav) + lash:(como:(fest gyp hen) p.fav) + %kill =+ gyp=?>(?=(^ fog) i.fog) + ?: =(0 gyp) [~ +<.^^$] + abet:kill:(fest gyp hen) + %ling ?> ?=(^ fog) + => .(fog (weld t.fog `(list ,@ud)`[i.fog ~])) + [[[[~ %iron who] hen [%helo prot]] ~] +<.^^$] + %noop [~ +<.^^$] + %thee abet:lash:(lean tea hen fav) + %went ?.((fear tea) [~ +<.^^$] abet:lash:(lean tea hen fav)) + %writ abet:lash:(loam tea hen +.fav) + %wart (lion hen +.fav) + == + :: + ++ loam :: loam:be + |= [tea=wire hen=duct rot=riot] :: handle response + ^+ *fi + =+(a=(lead tea hen) abet:(gall:q.a p.a rot)) + :: + ++ lion :: lion:be + |= [hen=duct him=@p cha=@ta num=@ud val=(unit ,*)] :: handle message + ^- [(list move) brat] + =+ yes=(~(get by sev) cha) + ?~ yes [~ +<.^^$] + =+ sey=(~(tap by u.yes) *(list ,[p=@ud q=@ud r=wire])) + |- ^- [(list move) brat] + ?~ sey [~ +<.^^^$] + =^ von +<.^^^$ + =< abet + =< lash + =< abet + =< abet + %- pong:(ox:(past:(fest p.i.sey hen) q.i.sey) r.i.sey) + [%wart him cha num val] + =^ vun +<.^^^$ $(sey t.sey) + [(weld von vun) +<.^^^$] + :: + ++ prot :: prot:be + ^- [p=path q=prod] :: get prompt + ?> ?=(^ fog) + ?. =(0 i.fog) + perd:(fest i.fog ~) + :- / + :+ %text + ;: weld + (trip (rap 3 [hox '/' cwd ~])) + ?~(loq "=" (scow u.loq)) + ?~(cws "" (spud cws)) "> " + == + ~ + :: + ++ fi :: fi:be + |= [gyp=@ud hen=duct gyr=task] :: process task + =| duv=(list ,[p=duct q=card]) + |% + ++ abet :: abet:fi:be + ^- [(list move) brat] :: resolve + =+ ^= fod ^+ [p=fog q=q.god] + ?~ q.wip.gyr + :- (skip fog |=(a=@ud =(a gyp))) + (~(del by q.god) gyp) + :- ?:((lien fog |=(a=@ud =(a gyp))) fog [gyp fog]) + q=(~(put by q.god) gyp gyr) + =+ sam==(fog p.fod) + =: fog p.fod + q.god q.fod + == + :_ +<.^^$ + %+ turn + (flop `_duv`?:(sam duv [[~ [%helo prot]] duv])) + |=([p=duct q=card] [[~ %iron who] (weld p hen) q]) + :: + ++ bitt |=(lap=path [(scot %ud gyp) lap]) :: bitt:fi:be + ++ como :: como:fi:be + |= lin=@t :: command + ^+ +> + =+ ryg=~(top to paq.gyr) + ?~ ryg + +>.$ + abet:abet:(pong:(ox:(past p.u.ryg) q.u.ryg) [%line lin]) + :: + ++ gill :: gill:fi:be + |= lin=@t :: input line + ^+ +> + =+ zif=((full lark:lo) [1 1] (trip lin)) + ?~ q.zif + =+ duf=[p=~(rend co ~ %ud p.p.zif) q=~(rend co ~ %ud q.p.zif)] + (warn "") + ?~ p.u.q.zif + +>.$ + (lime u.p.u.q.zif) + :: :: hoop:fi:be + ++ hoop :: delete prompt + |= [lap=wire ted=@ud] :: XX ugly + ^+ +> + %= +> + paq.gyr + %- ~(gas to *(qeu gyro)) + %+ skip + (~(tap to paq.gyr) *(list gyro)) + |=(a=gyro &(=(ted p.a) =(lap q.a))) + == + :: + ++ hoot :: hoot:fi:be + |= [lap=wire ted=@ud pod=prod] :: install prompt + ^+ +> + %_(+> paq.gyr (~(put to paq.gyr) [ted lap pod])) + :: + ++ kill + ^+ . + =+ pew=(sort (turn (~(tap by q.wip.gyr) ~) |=([p=@ud *] p)) lth) + |- ^+ ..kill + ?~ pew ..kill + $(pew t.pew, ..kill abet:goon:(past i.pew)) + :: + ++ lash :: lash:fi:be + ^. . :: execute task + =+ pew=(sort (turn (~(tap by q.wip.gyr) ~) |=([p=@ud *] p)) lth) + |- ^+ ..lash + ?~ pew ..lash + $(pew t.pew, ..lash abet:grip:(past i.pew)) + :: + ++ lime :: lime:fi:be + |= kal=lark :: start task + ^+ +> + (limp q.kal) + :: + ++ limp :: limp:fi:be + |= kaw=(list lath) :: start pipeline + ^+ +> + ?~ kaw +> + $(kaw t.kaw, +>.$ (pant i.kaw ?:(=(~ t.kaw) ~ [~ +(p.wip.gyr)]))) + :: + ++ pant :: pant:fi:be + |= [lat=lath nex=(unit ,@ud)] :: start thread + %= +> + p.wip.gyr +(p.wip.gyr) + q.wip.gyr + (~(put by q.wip.gyr) p.wip.gyr [nex ~ [~ ~ ~ %n ~ *claw lat]]) + == + :: + ++ past :: past:fi:be + |= ted=@ud :: select thread + ^+ ra + =+ bek=(need (~(get by q.wip.gyr) ted)) + ~(. ra ted p.bek q.bek r.bek) + :: + ++ perd :: perd:fi:be + ^- [p=path q=prod] :: produce prompt + =+ top=~(top to paq.gyr) + ?~(top [/ %none "[waiting...]" ~] [q.u.top r.u.top]) + :: + ++ warn :: warn:fi:be + |= txt=tape :: send warning + ^+ +> + +>(duv :_(duv [~ [%warn txt]])) + :: + ++ ra :: ra:fi:be + |_ $: ted=@ud :: thread id + nex=(unit ,@ud) :: next in pipeline + loz=(map wire goal) :: waiting for + orb=boor :: image + == + :: + ++ abet :: resolve + ^+ ..ra + ?: &(?=(%r -.s.orb) |(=(~ p.s.orb) =(~ loz))) + => (gird ~) + => guff + =. ..ra ?~(nex ..ra abet:(glob:(past u.nex) ~ [%pipe ~])) + ..ra(q.wip.gyr (~(del by q.wip.gyr) ted)) + ..ra(q.wip.gyr (~(put by q.wip.gyr) ted nex loz orb)) + :: + ++ bist |=(lap=path (bitt (scot %ud ted) lap)) :: form path + ++ bust :: slice coal + |= [axe=axis vux=coal] + ^- coal + =< q + %+ slam sot.vax + (slop [[%atom %$] axe] [vas.typ vux]) + :: + ++ fret :: process coal + |= poc=coal + ^- beef + :- ((hard (list gilt)) +:(bust 2 poc)) + =+ doy=(bust 3 poc) + ?~ +.doy [~ %r ~] + :- ((hard (list slip)) +>-.doy) + [%r ~ (bust 7 doy)] + :: + ++ gall :: deliver result + |= [lap=wire rot=riot] + ^+ +> + ?. ?=([%au * *] lap) + ?> ?=([%ma *] lap) + (glob t.lap [%writ rot]) + =+ dup=(slay i.t.lap) + ?> ?=([~ %$ %ud @] dup) + =+ kit=(need (~(get by p.orb) q.p.u.dup)) + ?~ rot + %_(+>.$ ..ra (warn (spud (meat kit))), s.orb [%r ~]) + =+ tyk=`kite`[p.p.u.rot q.p.u.rot r.kit r.p.u.rot q.u.rot] + ?> =(kit tyk) + +>.$(p.orb (~(del by p.orb) q.p.u.dup)) + :: + ++ gasp :: logical path + ^- path + [hox cwd ?~(loq wen (scot u.loq)) cws] + :: + ++ gird :: change slips + |= ask=(list slip) + ^+ +> + =+ zal=(~(tap by loz) ~) + =+ zim=(~(gas by *(map path goal)) ask) :: XX clumsy + =. +>.$ + |- ^+ +>.^$ + ?~ zal +>.^$ + %= $ + zal t.zal + +>.^$ ?:((~(has by zim) p.i.zal) +>.^$ abet:pang:(ox p.i.zal)) + == + |- ^+ +>.^$ + ?~ ask +>.^$ + $(ask t.ask, +>.^$ abet:(pane:(ox p.i.ask) q.i.ask)) + :: + ++ glee :: assemble stack + =+ [kas=sac boy=nub] + |- ^- [(unit coal) _+>] + ?~ kas [[~ boy] +>.$] + =^ vid +>.$ $(kas t.kas) + ?~ vid [~ +>.$] + =^ lez +>.$ (grok | (gnat i.kas) u.vid) + ?~ lez + [~ ?.(&(?=(^ duv) =(%crud -.q.i.duv)) +>.$ good:+>.$(sac t.kas))] + [[~ q.u.lez] +>.$] + :: + ++ glib :: pending note + |= [lap=wire nob=nose] + ^+ +> + %_(+> r.orb (~(put to r.orb) [lap nob])) + :: + ++ glob :: extern + |= [lap=wire fav=card] + ^+ +> + %_(+> q.orb (~(put to q.orb) [lap fav])) + :: + ++ glum :: blocked thread + |= [gez=(list path) hog=boar] + =| [inx=@ud err=(list path) bez=(map ,@ud kite)] + |- ^+ +>.^$ + ?~ gez + ?: =(~ err) + +>.^$(orb [bez ~ ~ hog]) + |- ^+ +>.^^$ + ?~ err +>.^^$(orb [~ ~ ~ %r ~]) + $(err t.err, ..ra (warn (spud i.err))) + =+ myt=(tame i.gez) + ?~ myt + $(gez t.gez, err [i.gez err]) + %= $ + gez t.gez + inx +(inx) + bez (~(put by bez) inx u.myt) + +>.^$ (gulp (bist %au (scot %ud inx) ~) u.myt) + == + :: + ++ gnat :: skit to path + |= sik=skit + (weld q.sik `path`[?~(p.sik wen u.p.sik) %lib r.sik]) + :: + ++ gaur :: print skit + |= sik=skit + ^+ +> + %+ gram ~ + :+ %note '^' + :- %leaf + ;: weld + (spud q.sik) + ?~(p.sik "=" (spud u.p.sik ~)) + "/lib" + (spud r.sik) + "/hoon" + == + :: + ++ good :: print skits + =+ kas=sac + |- ^+ +> + ?~(kas +> (gaur:$(kas t.kas) i.kas)) + :: + ++ goon :: kill + ^+ . + .(s.orb [%r ~]) + :: + ++ grab :: chase simple path + |= lam=lamb ^- gene + ?- -.lam + & =+ tes=(sky [%cx hox %main wen %bin p.lam %hoon ~]) + (grad [hox ?^(tes %main cwd) wen %bin p.lam ~]) + | p.lam + == + :: + ++ grad :: path to gene + |= pax=path ^- gene + [%clsg (turn pax |=(a=@ta [%dtpt %ta a]))] + :: + ++ gram :: add action + |= [hom=duct fav=card] + %_(+> duv [[hom fav] duv]) + :: + ++ gran :: add actions + |= vid=(list ,[p=duct q=card]) + ^+ +> + ?~(vid +> $(vid t.vid, +> (gram i.vid))) + :: + ++ gray :: process result + |= ton=toon + ^- [(unit) _+>] + ?- -.ton + %0 [[~ p.ton] +>] + %1 [~ (glum ((list path) p.ton) s.orb)] + %2 [~ (gram(orb [~ ~ ~ %r ~]) ~ [%crud %exit p.ton])] + == + :: + ++ grid :: process result + |= [ton=toon fun=||(* _+>)] + ^+ +> + ?- -.ton + %0 (fun p.ton) + %1 (glum ((list path) p.ton) s.orb) + %2 (gram(orb [~ ~ ~ %r ~]) ~ [%crud %exit p.ton]) + == + :: + ++ grin :: process result + |= [ton=toon hog=boar] + ^+ +> + ?- -.ton + %0 (haul (fret p.ton)) + %1 (glum ((list path) p.ton) hog) + %2 (gram(orb [~ ~ ~ %r ~]) ~ [%crud %exit p.ton]) + == + :: + ++ grip :: step to completion + |- ^+ + + =+(a=grit ?:(=(+.$ a) +.$ $(+.$ a))) + :: + ++ grit :: work step + |- ^+ + + ?. =(~ p.orb) + + =+ hog=s.orb + ?- -.hog + %n :: new + =+ gen=?:(?=(0 -.r.hog) s.r.hog p.r.hog) + ?~ joy.q.hog + =^ juy +.$ (grow ~ gasp) + ?~ juy +.$ + $(s.orb hog(joy.q [~ (need (mang [food:zu war u.juy] sky))])) + ?~ ran.q.hog + =^ noh +.$ glee + ?~ noh +.$ + =+ ^= wam + :- :+ %cell + :+ %cell + [%cell [%atom %da] [%atom %ta]] + [%cell [%atom %p] [%atom %uw]] + -.u.noh + [[[now wen] [who eny]] +.u.noh] + =^ nur +.$ (gray (mong [slap wam gen] sky)) + ?~ nur +.$ + $(s.orb hog(ran.q nur)) + ?: ?=(1 -.r.hog) + =. +.$ (gybe ~ -.u.ran.q.hog +.u.ran.q.hog ~) + $(s.orb [%r ~]) + ?: ?=(2 -.r.hog) + $(s.orb [%t u.ran.q.hog]) + ?~ pux.q.hog + =^ wim +.$ + (gray (mong [slap u.joy.q.hog (grab q.r.hog)] sky)) + ?~ wim +.$ + $(s.orb hog(pux.q [~ ((hard path) +.u.wim)])) + =+ ^= mop |- ^- (list ,@tas) + ?~ r.r.hog ~ + =+ mor=$(r.r.hog t.r.r.hog) + ?.(?=(| -.i.r.r.hog) mor (weld p.i.r.r.hog mor)) + ?~ jiv.q.hog + =^ woh +.$ (grow mop u.pux.q.hog) + ?~ woh +.$ + $(s.orb hog(jiv.q woh)) + ?~ kyq.q.hog + =^ mux +.$ + (gray (mong [fuel:zu r.r.hog u.jiv.q.hog] sky)) + ?~ mux +.$ + $(s.orb hog(kyq.q mux)) + ?~ gam.q.hog + =^ lez +.$ (grok | u.pux.q.hog u.kyq.q.hog) + ?~ lez +.$ + $(s.orb hog(gam.q [~ q.u.lez])) + %- grin :_ hog + %- mong :_ sky + [fapp:zu u.gam.q.hog u.ran.q.hog] + :: + %r :: running + ?~ p.hog +.$ + ?: =(~ r.orb) + ?: =(~ q.orb) +.$ + =^ pud q.orb ~(get to q.orb) + abet:(pong:(ox p.p.pud) q.p.pud) + =^ pud r.orb ~(get to r.orb) + (grin (mong [fane:zu [p.p.pud q.p.pud u.p.hog]] sky) hog) + :: + %t :: transform + ?: =(~ q.orb) +.$ + =^ neb q.orb ~(get to q.orb) + =+ pun=q.p.neb + ?> ?=(%pipe -.pun) + ?~ p.pun + =. +.$ (gybe ~) + $(s.orb [%r ~]) + %+ grid (mong [slit -.p.hog p.u.p.pun] sky) + |= noy=typo + =| zil=(list) + |- ^+ +.^^$ + ?~ q.u.p.pun + (gybe ~ noy (flop zil)) + %+ grid (mong [slam [p.hog [p.u.p.pun i.q.u.p.pun]]] sky) + |= zom=* + ^$(q.u.p.pun t.q.u.p.pun, zil [+.zom zil]) + == + :: + ++ grok :: extend config + |= [sot=? pax=path boy=coal] + ^- [(unit ,[p=? q=coal]) _+>] + =+ wiz=(~(get by p.pyr) wer pax boy) + ?^ wiz [[~ & u.wiz] +>.$] + =^ gar +>.$ (gray (mong [fuss:zu sot pax] sky)) + ?~ gar [~ +>.$] + => .(gar ((hard (unit ,[p=@uvI q=*])) u.gar)) + ?~ gar [[~ | boy] +>.$] + =+ wex=(~(get by q.pyr) wer p.u.gar boy) + ?^ wex [[~ & u.wex] +>.$] + =+ xow=(~(get by r.pyr) q.u.gar boy) + ?^ xow [[~ & u.xow] +>.$] + =^ yeq +>.$ (gray (mong [slap boy q.u.gar] sky)) + ?~ yeq [~ +>.$] + :- [~ & u.yeq] + %= +>.$ + p.pyr (~(put by p.pyr) [wer pax boy] u.yeq) + q.pyr (~(put by q.pyr) [wer p.u.gar boy] u.yeq) + r.pyr (~(put by r.pyr) [q.u.gar boy] u.yeq) + == + :: + ++ grim + |= [paw=(list path) boy=coal] + ^- [(unit ,[p=(list path) q=coal]) _+>] + ?~ paw [[~ ~ boy] +>.$] + =^ wuh +>.$ (grok & i.paw boy) + ?~ wuh [~ +>.$] + =^ hyq +>.$ $(paw t.paw, boy q.u.wuh) + ?~ hyq [~ +>.$] + ?. p.u.wuh [hyq +>.$] + [[~ [i.paw p.u.hyq] q.u.hyq] +>.$] + :: + ++ grow + |= [mod=(list ,@tas) pax=path] + ^- [(unit coal) _+>] + =+ ^= paw ^- (list path) + =+ :* mog=`path`~[hox %main wen] + rim=(scag 2 pax) + == + :* (weld (scag 3 pax) `path`[%con ~]) + (weld mog `path`[%nat rim]) + (turn mod |=(a=@tas (weld mod `path`[%alt a rim]))) + == + =+ sho=(scag 4 pax) + =+ boy=(grub pax) + |- ^- [(unit coal) _+>.^$] + =^ hyq +>.^$ (grim paw boy) + ?~ hyq [~ +>.^$] + ?~ sho [[~ q.u.hyq] +>.^$] + %= $ + sho t.sho + boy q.u.hyq + paw (turn paw |=(a=path (weld a [i.sho ~]))) + == + :: + ++ grub :: initial compose + |= pax=path ^- coal + :- [%cell [%cell [%atom %p] pah.typ] -.nub] + [[who pax] +.nub] + :: + ++ guff :: kill all depends + ^+ . + =+ yop=(~(tap by p.orb) *(list ,[p=@ud q=kite])) + |- ^+ ..guff + ?~ yop ..guff + %= $ + yop t.yop + ..guff (gulf (bist %au (scot %ud p.i.yop) ~) q.i.yop) + == + :: + ++ gull :: request control + |= [tea=wire him=ship ryf=riff] + (gram ~[/c [%b tea]] [%warp him ryf]) + :: + ++ gulf :: stop request + |= [tea=wire kit=kite] + (gull tea r.kit [s.kit ~]) + :: + ++ gulp :: start request + |= [tea=wire kit=kite] + %^ gull tea + r.kit + ^- riff + [s.kit ~ %& p.kit q.kit t.kit] + :: + ++ gump :: message server + |= [ton=? cha=@tas gyp=@ud ted=@ud lap=wire] + ^+ +> + =+ ^= yes ^- (set ,[p=@ud q=@ud r=wire]) + =+ yes=(~(get by sev) cha) + ?~(yes ~ u.yes) + %_ +>.$ + sev + %+ ~(put by sev) cha + ?: ton + (~(put in yes) gyp ted lap) + (~(del in yes) gyp ted lap) + == + :: + ++ gush + |= [wak=@da gyp=@ud ted=@ud lap=wire] + ^+ +> + +>.$(tem (~(put by tem) [gyp ted lap] wak)) + :: + ++ gust + |= [gyp=@ud ted=@ud lap=wire] + +>.$(tem (~(del by tem) [gyp ted lap])) + :: + ++ gybe :: pipe forward + |= pun=(unit ,[p=typo q=(list)]) + ^+ +> + ?~ nex + ?~ pun +> + (gran (turn q.u.pun |=(a=* [~ (gyve p.u.pun a)]))) + +>.$(..ra abet:(glob:(past u.nex) ~ [%pipe pun])) + :: + ++ gyve :: print vase + |= [toy=typo val=*] ^- card + =+ caf=((hard calf) (need (mang [felt:zu toy] sky))) + ?: =([~ [%atom %t]] caf) + [%tell ((hard ,@t) val) ~] + ?: =([~ %wall] caf) + [%tell ((hard (list ,@t)) val)] + [%talk (dish:ut caf val)] + :: + ++ haft :: process gift + |= guf=gilt + ^+ +> + ?- -.guf + %$ (gybe ~ +<.guf +>.guf ~) + %mu (gybe ~ +<.guf ((hard (list)) +>.guf)) + :: + %va + =+ tey=((hard ,[p=@tas q=(unit)]) +.guf) + %= +>.$ + war ?~(q.tey (~(del by war) p.tey) (~(put by war) p.tey u.q.tey)) + == + :: + * + =+ gud=((hard gift) guf) + |- ^+ +>.^$ + ?- -.gud + %$ !! + %cc ?~ p.gud +>.^$(loq p.gud) + ~& [%cc p.gud] + =+ hyz=(sky %cy gasp(loq p.gud)) + ?~ hyz ~|(%case-none !!) + +>.^$(loq p.gud) + %ck +>.^$(cwd p.gud) + %cs +>.^$(cws p.gud) + %de (gram ~ %note '#' q.gud) + %ex =. +>.^$ guff + +>.^$(s.orb [%n p.gud *claw q.gud]) + %ha (gram ~ %crud %soft [p.gud ~]) + %ho (gram ~ %crud %soft p.gud) + %la (gram ~ %talk p.gud) + %lo (gran (turn p.gud |=(a=tank [~ %talk a]))) + %mu !! + %mx |- ^+ +>.^^$ + ?~ p.gud +>.^^$ + $(p.gud t.p.gud, +>.^^$ ^$(gud i.p.gud)) + %ok (gram [/c ~] %info who p.gud q.gud) + %sc good:+>.^$(sac ?~(p.gud ?~(sac ~ +.sac) [u.p.gud sac])) + %sp !! + %te (gram ~ %tell p.gud) + %th (gram [/e ~] %that p.gud q.gud) + %va !! + %xx (gram ~ p.gud) + %xy (gram [p.gud /b ~] q.gud) + == + == + :: + ++ hale :: process gifts + |= guz=(list gilt) + ^+ +> + ?~(guz +> $(guz t.guz, +> (haft i.guz))) + :: + ++ haul :: process success + |= bof=beef + ^+ +> + =. s.orb r.bof + =. +> (hale p.bof) + (gird q.bof) + :: + ++ loss :: stop goal + |= [lap=wire gal=goal] + ^+ +> + ?- -.gal + %$ +> + %do +> + %eg (gulf (bist %ma lap) p.gal) + %es :: ~& %es-loss + (gull (bist %ma lap) p.gal q.gal ~) + %ht (gram [/e [%b (bist [%ma lap])] ~] [%band who ~]) + %oy (gump | p.gal gyp ted lap) + %up +>(..ra (hoop lap ted)) + %wa (gust gyp ted lap) + %yo +> + == + :: + ++ moor :: start goal + |= [lap=wire gal=goal] + ^+ +> + ?- -.gal + %$ +> + %do !! + %eg (gulp (bist %ma lap) p.gal) + %es :: ~& %es-moor + (gull (bist %ma lap) p.gal q.gal [~ r.gal]) + %ht (gram [/e [%b (bist [%ma lap])] ~] [%band who p.gal]) + %oy (gump & p.gal [gyp ted lap]) + %up +>(..ra (hoot lap ted p.gal)) + %wa (gush p.gal gyp ted lap) + %yo (gram [/a [%b (bist [%ma lap])] ~] [%want +.gal]) + == + :: + ++ ox :: per delivery + |= lap=wire :: per request + =+ gul=(~(get by loz) lap) + =+ lug=gul + |% + ++ abet :: resolve + ^+ +>.$ + ?~ lug + ?~ gul +>.$ + (loss(loz (~(del by loz) lap)) lap u.gul) + ?~ gul + (moor(loz (~(put by loz) lap u.lug)) lap u.lug) + ?: =(u.lug u.gul) +>.$ + =. +>.$ (loss(loz (~(del by loz) lap)) lap u.gul) + (moor(loz (~(put by loz) lap u.lug)) lap u.lug) + :: + ++ pane |=(gal=goal %_(. lug [~ gal])) :: set goal + ++ pang %_(. lug ~) :: delete goal + ++ pong :: accept card + |= fav=card + ^+ +> + ?> ?=(^ lug) + ?- -.u.lug + ~ + ?> ?=(%pipe -.fav) + +>.$(+>.$ (glib lap [%$ p.fav])) + :: + %do !! + :: + %eg + ?> ?=(%writ -.fav) + +>.$(lug ~, +>.$ (glib lap [%eg +.fav])) + :: + %es + ?> ?=(%writ -.fav) + =+ ^= goh ^- (unit goal) + ?~ p.fav `(unit goal)`~ + ?- -.r.u.lug + %& ~ + %| + ^- (unit goal) + :- ~ + ?> ?=(%ud -.q.p.u.p.fav) + %= u.lug + p.p.r + ?> ?| !=(%ud -.p.p.r.u.lug) + =(p.p.p.r.u.lug p.q.p.u.p.fav) + == + [%ud +(p.q.p.u.p.fav)] + == + == + =. loz ?~(goh (~(del by loz) lap) (~(put by loz) lap u.goh)) + %= +>.$ + lug goh + gul goh + +>.$ (glib lap [%eg +.fav]) + == + :: + %ht + ?> ?=(%thee -.fav) + +>.$(+>.$ (glib lap [%ht +.fav])) + :: + %up + ?> ?=(%line -.fav) + +>.$(+>.$ (glib lap [%up +.fav])) + :: + %oy + ?> ?=(%wart -.fav) + +>.$(+>.$ (glib lap [%oy +.fav])) + :: + %wa + ?> ?=(%wake -.fav) + +>.$(+>.$ (glib lap [%wa ~])) + :: + %yo + ?> ?=(%went -.fav) + +>.$(lug ~, +>.$ (glib lap [%yo +.fav])) + == + -- + -- + -- + :: + ++ lo :: command parsers + |% + ++ coax :: parse flags + |= coo=tape ^- gene + :+ %cnts [[~ 1] ~] + |- ^- gent + ?~ coo ~ + :_ $(coo t.coo) + ?: &((gte i.coo 'a') (lte i.coo 'z')) + [[%cnbc i.coo] [%dtpt %f &]] + ?> &((gte i.coo 'A') (lte i.coo 'Z')) + [[%cnbc (sub i.coo 32)] [%dtpt %f |]] + :: + ++ cone :: parse conf + %+ cook + |= a=(list (list ^cone)) + ?~ a ~ + ?~(i.a $(a t.a) [i.i.a $(i.a t.i.a)]) + %- star + ;~ pose + ;~(plug (ifix [kel ker] (stag %| (most ace sym))) (easy ~)) + :: + ;~ plug + (ifix [sel ser] (stag %& (stag %cltr (most ace wide:vez)))) + (easy ~) + == + :: + %+ ifix [gal gar] + ;~ pose + ;~ plug + (stag %& (cook coax (plus ;~(pose low hig)))) + ;~ pose + ;~ pfix ;~(plug sem ace) + ;~ plug + %+ cook |=(a=^cone a) + (stag %& (stag %cnts (stag [[~ 1] ~] loon:vez))) + (easy ~) + == + == + (easy ~) + == + == + :: + ;~ plug + (stag %& (stag %cnts (stag [[~ 1] ~] loon:vez))) + (easy ~) + == + == + == + :: + ++ lark :: parse lark + %+ cook |=(a=(unit ^lark) a) + ;~ pose + (cold ~ ;~(plug col col (star (shim 32 126)))) + %+ ifix [(star ace) (star ace)] + %+ stag ~ + %+ stag ~ + ;~ pose + lute + :: + ;~ pfix tis + ;~ pose + %+ cook + |= [a=@tas b=(list gene)] + ^- (list lath) + :~ [%1 [%cltr b]] + [%0 %0 [%& %set] ~ [[%clsg [%dtpt %tas a] ~]]] + == + ;~(plug sym (star ;~(pfix ace wide:vez))) + :: + %+ cook + |= a=@tas + :~ [%0 %0 [%& %none] ~ [%bcts %null]] + [%0 %0 [%& %set] ~ [%clsg [%dtpt %tas a] ~]] + == + ;~(pfix tis sym) + == + == + == + gay + == + :: + ++ lamb + %+ cook |=(a=^lamb a) + ;~ pose + (stag %& sym) + (stag %| (stag %clsg poor:vez)) + == + :: + ++ loth + %+ cook |=(a=lath a) + ;~ pfix col + %+ stag %0 + ;~ plug + ;~(pose ;~(pfix zap ;~(pose (cold %2 zap) (easy %1))) (easy %0)) + lamb + cone + (stag %clsg (star ;~(pfix ace wide:vez))) + == + == + :: + ++ lute + %+ cook + |= a=(list lath) ^+ a + =+ b=(flop a) + ?.(&(?=(^ b) ?=(2 -.i.b)) b [[%1 p.i.b] t.b]) + ;~ plug + ;~(pose loth (stag %2 wide:vez)) + %- star + ;~ pose + ;~(pfix ;~(plug sem ace) (stag %2 wide:vez)) + ;~(pfix ace loth) + == + == + -- + :: + ++ zu :: user level + |% + ++ fane :: deliver note + |= [pux=path nog=nose tas=vase] + ^- vase + %+ slam tas + ;: slop + [[%atom %da] now] + [pah.typ pux] + [noq.typ nog] + == + :: + ++ fapp :: launch app + |= [gum=vase arg=vase] + ^- vase + %+ slam + %+ slam gum + %+ slop + [[%atom %da] now] + [[%atom %$] (shax :(mix eny now (shax p.god)))] + arg + :: + ++ felt :: type to calf + |= typ=type ^- calf + ~(dole ut typ) + :: + ++ food :: standard subject + |= [war=(map ,@ta vase) vax=vase] + ^- vase + ;: slop + ;: slop + %+ slop + [[%atom %da] now] + [[%atom %ta] ~(rent co [~ %da now])] + :: + %+ slop + [[%atom %p] who] + [[%atom %ta] hox] + :: + [liz.typ q.hit] + == + :: + =+ voy=(~(tap to q.sur) ~) + |- ^- vase + ?~(voy [[%atom %n] ~] (slop i.voy $(voy t.voy))) + :: + ?~ war + vax + %- slop + :_ vax + |- ^- vase + ?+ war !! :: XX some inference weirdness here? + [* ~ ~] [[%face p.n.war p.q.n.war] q.q.n.war] + [* ~ ^] (slop $(r.war ~) $(war r.war)) + [* ^ ~] (slop $(l.war ~) $(war l.war)) + [* ^ ^] :(slop $(r.war ~, l.war ~) $(war l.war) $(war r.war)) + == + == + :: + ++ fuel + |= [zul=(list cone) vax=vase] + =+ [hed=(slot 2 vax) tal=(slot 3 vax)] + |- ^- vase + ?~ zul (slop hed tal) + ?- -.i.zul + & $(tal (slap tal p.i.zul)) + | $(zul t.zul) + == + :: + ++ fuss :: gene and hash + |= [sot=? pax=path] + ^- (unit ,[p=@uvI q=gene]) + =+ haw=(weld pax /hoon) + =+ arc=((hard arch) .^(%cy haw)) + ?: &(sot ?=(~ q.arc)) ~ + =+ mot=((hard ,@) .^(%cx haw)) + :+ ~ ?~(q.arc (sham mot) u.q.arc) + (scan (trip mot) (ifix [gay gay] tall:vez(wer pax))) + -- + -- +-- +. == +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 4bC, shell vane :: +:: +=| $: dez=(map duct brim) :: state by ship + == :: +|= [now=@da eny=@ sky=||(* (unit))] :: current invocation +^? :: opaque core +|% :: poke/peek pattern +++ beat :: process move + |= [wru=(unit writ) tea=wire hen=duct fav=curd] + => .(fav ((hard card) fav)) + ^- [p=(list move) q=vane] + ?: ?=([%crud *] fav) + [[[wru [/d hen] [%flog fav]] ~] ..^$] + ?: ?=(%wake -.fav) + =+ ^= fiy + =| fiy=(list ,[p=duct q=[p=@ud q=@ud r=wire]]) + |- ^+ fiy + ?~ dez fiy + =. fiy $(dez l.dez) + =. fiy $(dez r.dez) + |- ^+ fiy + ?~ q.n.dez fiy + %= $ + q.n.dez t.q.n.dez + fiy + |- ^+ fiy + ?~ tem.q.i.q.n.dez fiy + =. fiy $(tem.q.i.q.n.dez l.tem.q.i.q.n.dez) + =. fiy $(tem.q.i.q.n.dez r.tem.q.i.q.n.dez) + ?. (lte q.n.tem.q.i.q.n.dez now) fiy + [[p.n.dez p.n.tem.q.i.q.n.dez] fiy] + == + =| wam=(list move) + |- ^- [p=(list move) q=vane] + ?~ fiy [wam ..^^$] + =+ dos=(need (~(get by dez) p.i.fiy)) + =+ beg=`brat`[[p.i.dos bred] q.i.dos] + =+ yub=(lake:((be beg) now eny sky) p.i.fiy q.i.fiy) + %= $ + fiy t.fiy + wam (weld p.yub wam) + dez.^^$ (~(put by dez.^^$) p.i.fiy [[p.i.dos +.q.yub] t.dos]) + == + =+ dus=(~(get by dez) hen) + ?~ dus + ?+ -.fav + ~& [%beat-none -.fav tea hen] + ~|([%beat-none -.fav] !!) + :: + %init + ?~ wru !! + :- [[wru hen fav] ~] + ..^$(dez (~(put by dez) hen [[q.u.wru (bard q.u.wru)] ~])) + :: + ?(%loin %make %sith) + [[[wru [/a [%b tea] hen] fav] ~] ..^$] + == + ?> ?=(^ u.dus) + ?+ -.fav + ?~ wru + =+ ade=(adit hen) + =+ hem=`helm`?-(ade %lead [%lead p.i.u.dus], %iron %iron, %gold %gold) + [[[[~ hem p.i.u.dus] [[%b tea] hen] fav] ~] ..^$] + =+ beg=`brat`[[p.i.u.dus bred] q.i.u.dus] + =+ yub=(leap:((be beg) now eny sky) tea hen fav) + :- p.yub + ..^$(dez (~(put by dez) hen [[p.i.u.dus +.q.yub] t.u.dus])) + :: + %init + ?~ wru !! + :- :~ [wru hen fav] + [wru [[%b tea] hen] [%hail ~]] + == + ..^$(dez (~(put by dez) hen [[q.u.wru (bard q.u.wru)] u.dus])) + :: + %limn + $(fav [%hail ~], dez (~(put by dez) hen (weld t.u.dus [i.u.dus ~]))) + == +:: +++ come + |= old=vase + ^- vane + ~|(%load-nest-bede !!) +:: +++ doze + |= [now=@da hen=duct] + ^- (unit ,@da) + =| doz=(unit ,@da) + |- ^+ doz + ?~ dez doz + =. doz $(dez l.dez) + =. doz $(dez r.dez) + |- ^+ doz + ?~ q.n.dez doz + %= $ + q.n.dez t.q.n.dez + doz + |- ^+ doz + ?~ tem.q.i.q.n.dez doz + =. doz $(tem.q.i.q.n.dez l.tem.q.i.q.n.dez) + =. doz $(tem.q.i.q.n.dez r.tem.q.i.q.n.dez) + (hunt doz ~ q.n.tem.q.i.q.n.dez) + == +:: +++ flee stay +++ load + |= new=vase + ^- vane + ?. (~(nest ut -:!>(dez)) & p.new) + (come new) + ..^$(dez ((map duct brim) q.new)) +:: +++ raze + ^- vane + ..$(dez ~) +:: +++ scry + |= [our=ship ren=@tas his=ship syd=disc lot=coin tyl=path] + ^- (unit) + ~ +:: +++ stay `vase`!>(dez) +-- diff --git a/arvo/clay.hoon b/arvo/clay.hoon new file mode 100644 index 0000000000..da73f1b174 --- /dev/null +++ b/arvo/clay.hoon @@ -0,0 +1,631 @@ +:: +:: clay (4c), revision control +:: +|= pit=vase +^- vane +=> + :::::::::::::::::::::::::::::::::::::::::::::::::::::::: + :: section 4cA, filesystem logic :: + :: + |% + :: + ++ un :: per ship + |= [who=@p now=@da ruf=raft] + =+ ^= yar ^- room + =+ yar=(~(get by fat.ruf) who) + ?~(yar *room u.yar) + =| yel=(list ,[p=duct q=card]) + =| wot=(list ,[p=duct q=tape]) + =| byn=(list ,[p=duct q=riot]) + =| vag=(list ,[p=duct q=card]) + =| say=(list ,[p=duct q=ship r=[p=@ud q=riff]]) + |% + ++ abet + ^- [(list move) raft] + :_ ruf(fat (~(put by fat.ruf) who yar)) + ;: weld + %+ turn (flop yel) + |=([a=duct b=card] [[~ %gold who] hun.yar b]) + :: + %+ turn (flop wot) + |=([a=duct b=tape] [[~ %gold who] a [%wort b]]) + :: + %+ turn (flop byn) + |=([a=duct b=riot] [[~ %gold who] a [%writ b]]) + :: + %+ turn (flop vag) + |=([a=duct b=card] [[~ %gold who] a b]) + :: + %+ turn (flop say) + |=([a=duct b=ship c=*] [[~ %gold who] [/a a] [%want b %re c]]) + == + :: + ++ doze + =+ saz=(turn (~(tap by dos.yar) ~) |=([a=@tas b=*] a)) + =| nex=(unit ,@da) + |- ^+ nex + ?~ saz nex + $(saz t.saz, nex (hunt nex doze:(di i.saz))) + :: + ++ fray + |= [hen=duct pal=(list disc) sab=saba] + ^+ +> + ?~ pal +> + $(pal t.pal, +> zoot:wake:(exec:(di i.pal) hen now [%| sab])) + :: + ++ wake + ^+ . + =+ saz=(turn (~(tap by dos.yar) ~) |=([a=@tas b=*] a)) + |- ^+ ..wake + ?~ saz ..wake + $(saz t.saz, ..wake zoot:wake:(di i.saz)) + :: + ++ de :: per desk + |_ [for=@p syd=@ta lim=@da qyx=cult dom=dome] + ++ aeon :: act count through + |= lok=case + ^- (unit ,@ud) + ?- -.lok + %da + ?: (gth p.lok lim) ~ + |- ^- (unit ,@ud) + ?~ hit.dom [~ let.dom] + ?: (gte p.lok p.i.hit.dom) [~ let.dom] + $(hit.dom t.hit.dom, let.dom (dec let.dom)) + :: + %tas (~(get by lab.dom) p.lok) + %ud ?:((gth p.lok let.dom) ~ [~ p.lok]) + == + :: + ++ ache :: arch report + ^- arch + :+ p.ank.dom + ?~(q.ank.dom ~ [~ p.u.q.ank.dom]) + |- ^- (map ,@ta ,~) + ?~ r.ank.dom ~ + [[p.n.r.ank.dom ~] $(r.ank.dom l.r.ank.dom) $(r.ank.dom r.r.ank.dom)] + :: + ++ amor :: endpoint query + |= ren=?(%x %y %z) + ^- (unit ,*) + ?- ren + %x ?~(q.ank.dom ~ [~ q.u.q.ank.dom]) + %y [~ ache] + %z [~ ank.dom] + == + :: + ++ ante :: rewind by change + |= lem=maki + ^+ +> + ?- -.lem + & + %_ +> + ank.dom ?. ?=(& -.p.lem) ank.dom + ank:(dusk:(zu ank.dom) p.p.lem) + lab.dom ?. ?=(| -.p.lem) lab.dom + (~(del by lab.dom) p.p.lem) + == + :: + | + |- ^+ +>.^$ + ?~ s.p.lem +>.^$ + $(s.p.lem t.s.p.lem, +>.^$ ^$(lem i.s.p.lem)) + == + :: + ++ argo :: rewind to aeon + |= oan=@ud + ^+ +> + ?: =(let.dom oan) +> + ?> ?=(^ hit.dom) + ?> ?=(& -.q.i.hit.dom) + => .(+> (ante q.i.hit.dom)) + $(let.dom (dec let.dom), hit.dom t.hit.dom) + :: + ++ auto :: read at point + |= mun=mood + ^- (unit) + ?: ?=(%v p.mun) + [~ dom] + ?: &(?=(%w p.mun) !?=(%ud -.q.mun)) + ?^(r.mun ~ [~ let.dom]) + ?: ?=(%w p.mun) + ?> ?=(^ hit.dom) ?^(r.mun ~ [~ i.hit.dom]) + (amor(ank.dom ank:(deny:(zu ank.dom) r.mun)) p.mun) + :: + ++ aver :: domestic read + |= mun=mood + ^- (unit (unit ,*)) + =+ nao=(aeon q.mun) + ?~(nao ~ [~ (avid u.nao mun)]) + :: + ++ avid :: seek and read + |= [oan=@ud mun=mood] + ^- (unit) + ?: &(?=(%w p.mun) !?=(%ud -.q.mun)) :: NB optimization + ?^(r.mun ~ [~ oan]) + (auto:(argo oan) mun) + :: + ++ balk :: read and send + |= [hen=duct oan=@ud mun=mood] + ^+ +> + =+ vid=(avid oan mun) + ?~ vid (blob hen) (blab hen mun u.vid) + :: + ++ blab :: ship result + |= [hen=duct mun=mood dat=*] + ^+ +> + +>(byn [[hen ~ [p.mun q.mun syd] r.mun dat] byn]) + :: + ++ bleb :: ship sequence + |= [hen=duct ins=@ud hip=(list frog)] + ^+ +> + ?~ hip +> + %= $ + hip t.hip + ins +(ins) + +> (blab hen [%w [%ud ins] ~] i.hip) + == + :: + ++ blob :: ship stop + |= hen=duct + %_(+> byn [[hen ~] byn]) + :: + ++ doze :: sleep until + =+ xiq=(~(tap by qyx) ~) + =| nex=(unit ,@da) + |- ^+ nex + ?~ xiq nex + =+ ^= zis ^+ nex + ?- -.q.i.xiq + & ?.(?=(%da -.q.p.q.i.xiq) ~ [~ p.q.p.q.i.xiq]) + :: + | + =+ mot=`moat`p.q.i.xiq + %+ hunt + ?.(&(?=(%da -.p.mot) (lth now p.p.mot)) ~ [~ p.p.mot]) + ?.(&(?=(%da -.q.mot) (lth now p.q.mot)) ~ [~ p.q.mot]) + == + $(xiq t.xiq, nex (hunt nex zis)) + :: + ++ ease :: unsubscribe + |= hen=duct + ^+ +> + +>(qyx (~(del by qyx) hen)) + :: + ++ eave :: subscribe + |= [hen=duct rav=rave] + ^+ +> + ?- -.rav + & + =+ ver=(aver p.rav) + ?~ ver + +>.$(qyx (~(put by qyx) hen rav)) + ?~ u.ver + (blob hen) + (blab hen p.rav u.u.ver) + :: + | + =+ nab=(aeon p.p.rav) + ?~ nab + ?> =(~ (aeon q.p.rav)) + +>.$(qyx (~(put by qyx) hen rav)) + =+ huy=(aeon q.p.rav) + ?: &(?=(^ huy) |((lth u.huy u.nab) &(=(0 u.huy) =(0 u.nab)))) + (blob hen) + =+ top=?~(huy let.dom u.huy) + =+ seb=(slag (sub let.dom top) hit.dom) + =+ wid=(sub top u.nab) + =+ fud=(flop (scag wid seb)) + =. +>.$ (bleb hen u.nab fud) + ?^ huy + (blob hen) + =+ ^= ptr ^- case + ?: =(0 u.nab) [%da @da] + =+(old=(slag wid seb) ?>(?=(^ old) `case`[%da p.i.old])) + +>.$(qyx (~(put by qyx) hen `rave`[%| ptr q.p.rav])) + == + :: + ++ edit :: apply changes + |= [hen=duct wen=@da lem=maki] + ^+ +> + ?- -.lem + & + %= +>.$ + ank.dom ?. ?=(& -.p.lem) ank.dom + ank:(durn:(zu ank.dom) p.p.lem) + let.dom +(let.dom) + hit.dom :_(hit.dom [wen lem]) + lab.dom ?. ?=(| -.p.lem) lab.dom + ?< (~(has by lab.dom) p.p.lem) + (~(put by lab.dom) p.p.lem let.dom) + vag + ?~(hez.yar vag :_(vag [u.hez.yar [%ergo who syd +(let.dom)]])) + :: + yel + =+ pre=`path`~[(scot %p for) syd (scot %ud +(let.dom))] + ?- -.p.lem + | :_ yel + [hen %note '=' %leaf :(weld (trip p.p.lem) " " (spud pre))] + & |- ^+ yel + ?~ q.p.p.lem yel + :_ $(q.p.p.lem t.q.p.p.lem) + :- hen + :+ %note + ?-(-.q.i.q.p.p.lem %del '-', %ins '+', %mut ':') + [%leaf (spud (weld pre p.i.q.p.p.lem))] + == + == + :: + | + |- ^+ +>.^$ + ?~ s.p.lem +>.^$ + $(s.p.lem t.s.p.lem, +>.^$ ^$(lem i.s.p.lem)) + == + :: + ++ exec :: change and update + |= [hen=duct wen=@da lem=maki] + ^+ +> + wake:(edit hen wen lem) + :: + ++ wake :: update subscribers + ^+ . + =+ xiq=(~(tap by qyx) ~) + =| xaq=(list ,[p=duct q=rave]) + |- ^+ ..wake + ?~ xiq ..wake(qyx (~(gas by *cult) xaq)) + ?- -.q.i.xiq + & + =+ nao=(aeon q.p.q.i.xiq) + ?~ nao $(xiq t.xiq, xaq [i.xiq xaq]) + $(xiq t.xiq, ..wake (balk p.i.xiq u.nao p.q.i.xiq)) + :: + | + =+ mot=`moat`p.q.i.xiq + =+ nab=(aeon p.mot) + ?: |(?=(~ nab) =(let.dom u.nab)) + $(xiq t.xiq, xaq [i.xiq xaq]) + ?> (gte let.dom u.nab) + ?> ?=(^ hit.dom) + =+ huy=(aeon q.mot) + ?~ huy + =+ ptr=[%da p.i.hit.dom] + =+ fud=(flop (scag (sub let.dom u.nab) `(list frog)`hit.dom)) + %= $ + xiq t.xiq + xaq [[p.i.xiq [%| ptr q.mot]] xaq] + ..wake (bleb p.i.xiq let.dom fud) + == + =+ yad=(slag (sub let.dom u.huy) `(list frog)`hit.dom) + =+ fud=(flop (scag (sub u.huy u.nab) yad)) + %= $ + xiq t.xiq + ..wake (blob:(bleb p.i.xiq +(u.nab) fud)) + == + == + :: + ++ zoot + %_(..de dos.yar (~(put by dos.yar) syd qyx dom)) + -- + :: + ++ di + |= syd=@ta + =+ ^= saq ^- desk + =+ saq=(~(get by dos.yar) syd) + ?~(saq [~ [~ [@uvH ~ ~] 0 ~ ~]] u.saq) + ~(. de who syd now p.saq q.saq) + :: + ++ fa + |= him=ship + =+ ^= raz + =+ raz=(~(get by rid.yar) him) + ?~(raz [p=*rind q=*rink] u.raz) + |% + ++ mete :: foreign request + |= [hen=duct ryf=riff] + ^+ +> + =+ nux=(~(get by fod.p.raz) hen) + ?^ nux + ?> ?=(~ q.ryf) + %= +>.$ + say [[[[%c (scot %ud u.nux) ~] hen] him [u.nux ryf]] say] + fod.p.raz (~(del by fod.p.raz) hen) + bim.p.raz (~(del by bim.p.raz) u.nux) + == + ?~ q.ryf +>.$ + =+ inx=nix.p.raz + %= +>.$ + say [[[[%c (scot %ud inx) ~] hen] him [inx ryf]] say] + nix.p.raz +(nix.p.raz) + bim.p.raz (~(put by bim.p.raz) inx [hen ryf]) + fod.p.raz (~(put by fod.p.raz) hen inx) + == + :: + ++ mote :: send/cancel request + |= [hen=duct ryf=riff] + ^+ +> + (mete hen ryf) + :: =+ rym=(~(get by mir.q.raz) p.ryf) + :: ?~ rym (mete hen ryf) + :: =+ wex=~(. de [who p.ryf lim.u.rym qyx.u.rym dom.u.rym]) + :: =+ wak=?~(q.ryf (ease:wex hen) (eave:wex hen u.q.ryf)) + :: =: byn byn.wak + :: qyx.u.rym qyx.wak + :: dom.u.rym dom.wak + :: == + :: +>.$(mir.q.raz (~(put by mir.q.raz) p.ryf u.rym)) + :: + ++ poll :: pull result + |= [hen=duct syd=disc rot=riot] + ^+ +> + =+ rum=(need (~(get by mir.q.raz) syd)) + =+ kas=(need ask.rum) + =< abet + =< able + |% + ++ abet + ^+ +>.$ + +>.$(mir.q.raz (~(put by mir.q.raz) syd rum)) + :: + ++ able + ^+ . + ?~ rot + %- pith(ask.rum ~, lim.rum kas) + ~(. de [him syd kas qyx.rum dom.rum]) + ?> ?=(%w p.p.u.rot) + ?> =(syd r.p.u.rot) + ?> =(~ q.u.rot) + ?> ?=(%ud -.q.p.u.rot) + ?> =(let.dom.rum p.q.p.u.rot) + =+ rog=((hard frog) r.u.rot) + =+ sab=`saba`[him syd [p.q.p.u.rot +(p.q.p.u.rot)] [q.rog ~]] + =. ..fa (fray hen pal.rum sab) + (pith (~(exec de [him syd lim.rum qyx.rum dom.rum]) hen rog)) + :: + ++ pith + |= wex=_de + ^+ +> + =+ wak=wake:wex + %_ +>.$ + byn byn.wak + yel yel.wak + qyx.rum qyx.wak + dom.rum dom.wak + == + -- + :: + ++ puke :: pull failed + |= [hen=duct syd=disc msg=tape] + ^+ +> + %_ +> + mir.q.raz (~(del by mir.q.raz) syd) + yel [[hen [%note '?' %leaf msg]] yel] + == + :: + ++ pull :: pull changeset + |= [hen=duct syd=disc pal=(list disc)] + ^+ +> + =+ ^= rum ^- rede + =+ rum=(~(get by mir.q.raz) syd) + ?^ rum u.rum [~2000.1.1 ~ pal ~ [~ [@uvH ~ ~] 0 ~ ~]] + ?> ?=(~ ask.rum) + => .(ask.rum [~ now]) + =. +>.$ + %+ mete + [[%c %pull (scot %p him) syd ~] hen] + [syd ~ %| [%da lim.rum] [%da now]] + +>.$(mir.q.raz (~(put by mir.q.raz) syd rum)) + :: + ++ tome :: accept response + |= [inx=@ud rot=riot] + ^+ +> + :: ~& [%tome inx ?~(rot ~ [p.u.rot q.u.rot])] + =+ mub=(~(get by bim.p.raz) inx) + ?~ mub +>.$ + =+ die=?~(rot & &(?=(^ q.q.u.mub) ?=(& -.u.q.q.u.mub))) + %= +>.$ + byn [[p.u.mub rot] byn] + bim.p.raz ?.(die bim.p.raz (~(del by bim.p.raz) inx)) + fod.p.raz ?.(die fod.p.raz (~(del by fod.p.raz) p.u.mub)) + hac.q.raz ?~ rot + hac.q.raz + %+ ~(put by hac.q.raz) + [p.p.u.rot q.p.u.rot r.p.u.rot q.u.rot] + r.u.rot + == + :: + ++ tref :: request rejected + |= [hen=duct tea=wire] + ^+ +> + ~& [%tref tea] + ?. ?=([@ *] tea) +> + =+ xoc=(slay i.tea) + ?: ?=([~ %$ %p @] xoc) + ?> ?=([@ ~] t.tea) + (puke hen i.t.tea "system failure") + ?. ?=([~ %$ %ud @] xoc) +>.$ + =+ mub=(~(get by bim.p.raz) q.p.u.xoc) + ?~ mub +>.$ + %= +>.$ + byn [[p.u.mub ~] byn] + fod.p.raz (~(del by fod.p.raz) q.p.u.xoc) + == + :: + ++ vera :: search + |= [syd=@tas ren=care lok=case way=path] + ^- (unit) + =+ haz=(~(get by hac.q.raz) ren lok syd way) + ?^ haz haz + =+ rym=(~(get by mir.q.raz) syd) + ?~ rym ~ + =+ vyr=(~(aver de [him syd lim.u.rym qyx.u.rym dom.u.rym]) ren lok way) + ?~(vyr ~ u.vyr) + :: + ++ zoom + %_(+>.$ rid.yar (~(put by rid.yar) him raz)) + -- + -- + -- + :::::::::::::::::::::::::::::::::::::::::::::::::::::::: + :: section 4cA, filesystem vane :: + :: :: + =| :: instrument state + $: ruf=raft :: revision tree + == :: + |= [now=@da eny=@ sky=||(* (unit))] :: activate + ^? :: opaque core + |% :: + ++ beat :: update + |= [wru=(unit writ) tea=wire hen=duct fav=curd] + => .(fav ((hard card) fav)) + ^- [p=(list move) q=vane] + ?+ -.fav [[[wru hen fav] ~] ..^$] + %crud + [[[wru [/d hen] %flog fav] ~] ..^$] + :: + %deem + =. wru + ?^ wru wru + ?. =(%gold (adit hen)) ~ + [~ %gold p.fav] + $(fav q.fav) + :: + %init + :: [[%tell %0 %leaf "clay: home for {~(rend co ~ %p q.u.wru)}"] ~] + [~ ..^$(fat.ruf (~(put by fat.ruf) q.u.wru [hen ~ ~ ~ ~]))] + :: + ?(%into %info) + =. wru + ?^ wru wru + ?. =(%gold (adit hen)) ~ + [~ %gold p.fav] + ?> =(q.u.wru p.fav) + ?: =(%$ q.fav) + ?. ?=(%into -.fav) [~ ..^$] + =+ yar=(need (~(get by fat.ruf) p.fav)) + [~ ..^$(fat.ruf (~(put by fat.ruf) p.fav yar(hez [~ hen])))] + =^ mos ruf + =+ ^= zot + zoot:(exec:(di:wake:(un q.u.wru now ruf) q.fav) hen now [%& r.fav]) + abet:zot(hez.yar ?.(=(%into -.fav) hez.yar.zot [~ hen])) + [mos ..^$] + :: + %pull + ?> ?=(^ wru) + ?> !=(q.u.wru q.fav) + =^ mos ruf + abet:zoom:(pull:(fa:(un q.u.wru now ruf) p.fav) hen q.fav r.fav) + [mos ..^$] + :: + %warp + ?> ?=(^ wru) + =^ mos ruf + =< abet + =+ une=(un q.u.wru now ruf) + :: ~& [%warp q.u.wru p.fav] + ?. =(q.u.wru p.fav) + zoom:(mote:(fa:une p.fav) hen q.fav) + =+ wex=(di:une p.q.fav) + ?~ q.q.fav + zoot:(ease:wex hen) + zoot:(eave:wex hen u.q.q.fav) + [mos ..^$] + :: + %wart + ?> ?=(%ru q.fav) + ?~ s.fav [~ ..^$] + =^ mos ruf + =< abet + =< zoom + (tome:(fa:(un q.u.wru now ruf) p.fav) ((hard ,[@ud riot]) u.s.fav)) + [mos ..^$] + :: + %went + ?: =(%good q.fav) [~ ..^$] + ?> ?=([@ *] tea) + =+ une=(un q.u.wru now ruf) + =^ mos ruf + ?+ i.tea ~&([%went-wrong tea] !!) + %pull + abet:zoom:(tref:(fa:une p.fav) hen t.tea) + == + [mos ..^$] + :: + %wake + =+ dal=(turn (~(tap by fat.ruf) ~) |=([a=@p b=room] a)) + =| mos=(list move) + |- ^- [p=(list move) q=vane] + ?~ dal [mos ..^^$(las.ruf now)] + =^ som ruf abet:wake:(un i.dal now ruf) + $(dal t.dal, mos (weld som mos)) + :: + %wort + ?> ?=([@ *] tea) + =+ une=(un q.u.wru now ruf) + =^ mos ruf + ?+ i.tea !! + %pull + ?> ?=([@ @ ~] t.tea) + =+ xoc=(slay i.t.tea) + ?> ?=([~ %$ %p @] xoc) + =< abet + =< zoom + (puke:(fa:(un q.u.wru now ruf) q.p.u.xoc) hen i.t.t.tea p.fav) + == + [mos ..^$] + :: + %writ + ?> ?=([@ *] tea) + =+ une=(un q.u.wru now ruf) + =^ mos ruf + ?+ i.tea ~&([%writ-bad tea] !!) + %pull + ?> ?=([@ @ ~] t.tea) + =+ xoc=(slay i.t.tea) + ?> ?=([~ %$ %p @] xoc) + =< abet + =< zoom + (poll:(fa:(un q.u.wru now ruf) q.p.u.xoc) hen i.t.t.tea p.fav) + == + [mos ..^$] + == + :: + ++ come + |= old=vase + ^- vane + ~|(%load-nest-clay !!) + :: + ++ doze + |= [now=@da hen=duct] + =| nex=(unit ,@da) + =+ dal=(turn (~(tap by fat.ruf) ~) |=([a=@p b=room] a)) + |- ^+ nex + ?~ dal nex + $(dal t.dal, nex (hunt nex doze:(un i.dal now ruf))) + :: + ++ flee stay + :: + ++ load + |= new=vase + ^- vane + ?. (~(nest ut -:!>(ruf)) & p.new) + (come new) + ..^$(ruf (raft q.new)) + :: + ++ raze + ^- vane + ..$(ruf *raft) + :: + ++ scry :: inspect + |= [our=ship ron=@tas his=ship syd=disc lot=coin tyl=path] + ^- (unit) + =+ luk=?.(?=(%$ -.lot) ~ ((soft case) p.lot)) + =+ run=((soft care) ron) + ?~ luk ~ + ?~ run ~ + ?. =(our his) + (vera:(fa:(un our now ruf) his) syd u.run u.luk tyl) + =+ vyr=(aver:(di:(un our now ruf) syd) u.run u.luk tyl) + ?~(vyr ~ u.vyr) + :: + ++ stay `vase`!>(ruf) + -- diff --git a/arvo/dill.hoon b/arvo/dill.hoon new file mode 100644 index 0000000000..dbaa761e58 --- /dev/null +++ b/arvo/dill.hoon @@ -0,0 +1,349 @@ +:: +:: dill (4d), terminal handling +:: +|= pit=vase +^- vane :: kernel instrument +=| $: dug=(map duct yard) + == :: +|= [now=@da eny=@ sky=||(* (unit))] :: current invocation +^? :: opaque core +|% :: poke/peek pattern +++ beat :: process move + |= [wru=(unit writ) tea=wire hen=duct fav=curd] + => .(fav ((hard card) fav)) + ^- [p=(list move) q=vane] + ?: ?=(%flog -.fav) + :_ ..^$ + %+ turn (~(tap by dug) *(list ,[p=duct q=yard])) + |=([a=duct b=yard] [wru [/d a] p.fav]) + =+ ^= yar ^- yard + =+ yar=(~(get by dug) hen) + ?^ yar u.yar + [& [80 ~ *blot] ~] + =| mos=(list move) + =+ wip=| + =< yerk:leap + |% + ++ beep (curb [[%bel ~] ~]) :: send beep + ++ curb :: send blits + |= wab=(list blit) + ^+ +> + ?~ wab +> + +>(mos [[~ hen [%blit (flop wab)]] mos]) + :: + ++ edit :: change the bed + |= bed=bead + ^+ +> + =. q.q.yar [~ bed] + %- curb + :~ [%hop (add pol.bed bus.bed)] + :- %lin + %+ weld pot.bed + ?- buy.bed + %none but.bed + %text but.bed + %pass `(list ,@)`(runt [(lent but.bed) '*'] ~) + == + == + :: + ++ fume :: print tank, prefix + |= [pef=@tD tac=tank] + ^+ +> + =+ wol=(~(win re tac) 2 p.q.yar) + %- furl + %+ turn wol + |= a=tape ^- tape + ?> ?=([@ @ *] a) + [pef ' ' t.t.a] + :: + ++ furl :: print wall + |= wol=(list tape) + ^+ +> + =. +> + %- curb + %- flop + |- ^- (list blit) + ?~ wol ~ + [[%lin (tuba i.wol)] [%mor ~] $(wol t.wol)] + ?~ q.q.yar +> + (edit(q.q.yar ~) u.q.q.yar) + :: + ++ gore :: move in history + |= hup=@ud + ^+ +> + =+ ^= but ^- (list ,@c) + =+ byt=(~(get by hym.u.q.q.yar) hup) + ?^ byt u.byt + (tuba (rip 3 (snag hup q.hyt.u.q.q.yar))) + =+ bul=(lent but) + %- edit + %= u.q.q.yar + hiz hup + hym %+ ~(put by hym.u.q.q.yar) + hiz.u.q.q.yar + but.u.q.q.yar + bus bul + bul (lent but) + but but + == + :: + ++ kill :: add to kill ring + |= txt=(list ,@c) + ^+ +> + => ?. =(16 p.r.q.yar) . + .(p.r.q.yar 15, r.r.q.yar (scag 15 r.r.q.yar)) + %= +> + p.r.q.yar +(p.r.q.yar) + q.r.q.yar 0 + r.r.q.yar [txt r.r.q.yar] + == + :: + ++ leap :: terminal event + |- ^+ + + ?+ -.fav + +(mos :_(mos [wru hen fav])) + %noop + + :: + %belt :: terminal input + ?~ q.q.yar + beep + ?- -.p.fav + %aro :: arrow + ?- p.p.fav + %d :: down + ?: =(0 hiz.u.q.q.yar) + beep + (gore (dec hiz.u.q.q.yar)) + :: + %l :: left + ?: =(0 bus.u.q.q.yar) + beep + (edit u.q.q.yar(bus (dec bus.u.q.q.yar))) + :: + %r :: right + ?: =(bul.u.q.q.yar bus.u.q.q.yar) + beep + (edit u.q.q.yar(bus +(bus.u.q.q.yar))) + :: + %u + =+ hup=+(hiz.u.q.q.yar) + ?: =(hup p.hyt.u.q.q.yar) + beep + (gore hup) + == + :: + %bac :: backspace + ^+ +.$ + ?: =(0 bus.u.q.q.yar) + (curb `(list blit)`[[%bel ~] ~]) + %- edit + %= u.q.q.yar + bus (dec bus.u.q.q.yar) + bul (dec bul.u.q.q.yar) + but + %+ weld + (scag (dec bus.u.q.q.yar) but.u.q.q.yar) + (slag bus.u.q.q.yar but.u.q.q.yar) + == + :: + %ctl :: control + ?+ p.p.fav + beep + %a (edit u.q.q.yar(bus 0)) + %b $(fav [%belt %aro %l]) + %c +.$(mos :_(mos [wru [/b /d hen] [%kill ~]])) + %d ?: ?& =(0 bul.u.q.q.yar) + =(0 bus.u.q.q.yar) + == + $(fav [%logo ~]) + $(fav [%belt %del ~]) + %e (edit u.q.q.yar(bus bul.u.q.q.yar)) + %f $(fav [%belt %aro %r]) + %k ?: =(bul.u.q.q.yar bus.u.q.q.yar) + beep + => .(+.$ (kill (slag bus.u.q.q.yar but.u.q.q.yar))) + %- edit + %= u.q.q.yar + bul bus.u.q.q.yar + but (scag bus.u.q.q.yar but.u.q.q.yar) + == + %l +.$(mos :_(mos [~ hen %blit [[%clr ~] ~]])) + %n $(fav [%belt %aro %d]) + %p $(fav [%belt %aro %u]) + %u ?: =(0 bus.u.q.q.yar) + beep + => .(+.$ (kill (scag bus.u.q.q.yar but.u.q.q.yar))) + %- edit + %= u.q.q.yar + bus 0 + bul (sub bul.u.q.q.yar bus.u.q.q.yar) + but (slag bus.u.q.q.yar but.u.q.q.yar) + == + %w +.$(mos :_(mos [wru [/b /d hen] [%limn ~]])) + %x +.$(mos :_(mos [wru [/b /d hen] [%ling ~]])) + %y ?: =(0 p.r.q.yar) + beep + $(fav [%belt %txt (snag q.r.q.yar r.r.q.yar)]) + == + :: + %del :: delete + ?: =(bul.u.q.q.yar bus.u.q.q.yar) + beep + %- edit + %= u.q.q.yar + bul (dec bul.u.q.q.yar) + but + %+ weld + (scag bus.u.q.q.yar but.u.q.q.yar) + (slag +(bus.u.q.q.yar) but.u.q.q.yar) + == + :: + %met :: meta + ?+ p.p.fav + beep + %y + ?: =(0 p.r.q.yar) + beep + =+ dol=(snag q.r.q.yar r.r.q.yar) + =+ leo=(lent dol) + ?. (gte bus.u.q.q.yar leo) + beep + =+ pey=(sub bus.u.q.q.yar leo) + ?. =(dol (swag [pey leo] but.u.q.q.yar)) + beep + =. q.r.q.yar ?:(=(p.r.q.yar +(q.r.q.yar)) 0 +(q.r.q.yar)) + =+ ney=(snag q.r.q.yar r.r.q.yar) + =+ lye=(lent ney) + %- edit + %= u.q.q.yar + bus (sub (add bus.u.q.q.yar lye) leo) + bul (sub (add bul.u.q.q.yar lye) leo) + but %+ weld + (scag pey but.u.q.q.yar) + %+ weld + `(list ,@c)`ney :: XX weird fuse-loop + (slag bus.u.q.q.yar but.u.q.q.yar) + == + == + :: + %ret :: return + =+ jab=(rap 3 (tufa but.u.q.q.yar)) + %= +.$ + q.q.yar ~ + r.yar + ?: |(=(%$ jab) =(%pass buy.u.q.q.yar)) + r.yar + %+ ~(put by r.yar) + hux.u.q.q.yar + [p.hyt.u.q.q.yar [jab +.q.hyt.u.q.q.yar]] + :: + mos + :* [~ [/b /d hen] [%hail ~]] + [~ hen [%bbye ~]] + [wru [/b /d hen] [%line jab]] + [~ hen [%blit [[%mor ~] ~]]] + mos + == + == + :: + %txt :: text keys + =+ let=(lent p.p.fav) + %- edit + %= u.q.q.yar + bus (add let bus.u.q.q.yar) + bul (add let bul.u.q.q.yar) + but + ;: weld + (scag bus.u.q.q.yar but.u.q.q.yar) + p.p.fav + (slag bus.u.q.q.yar but.u.q.q.yar) + == + == + == + :: + %blew +.$(p.q.yar p.p.fav) :: window size + %boot + %= +.$ + mos + :_(mos [wru [[%b ~] [%d tea] hen] p.fav]) + == + :: + %crud :: error trace + =. q.fav [[%leaf (trip p.fav)] q.fav] + |- ^+ +.^$ + ?~ q.fav +.^$ + (fume:$(q.fav t.q.fav) '!' i.q.fav) + :: + %helo :: trigger prompt + %- edit + =| bed=bead + =+ ^= hyt ^- hist + =+ hyt=(~(get by r.yar) p.fav) + ?~(hyt *hist u.hyt) + =+ zon=(tuba r.q.fav) + =+ zow=(lent zon) + %= bed + bul zow + bus zow + but zon + buy p.q.fav + hux p.fav + hiz 0 + hyt [+(p.hyt) [%$ q.hyt]] + pot q.q.fav + pol (lent q.q.fav) + == + :: + ?(%hail %make %loin %sith) + +.$(mos :_(mos [wru [/b /d hen] fav])) + :: + %note ?.(p.yar +.$ (fume p.fav q.fav)) :: debug message + %save :: write a file + %= +.$ + mos :_(mos [wru hen `card`[%blit [%sav p.fav q.fav] ~]]) + == + :: + %tell (furl (turn p.fav |=(a=@t (trip a)))) :: wall of text + %text $(fav [%talk %leaf p.fav]) :: simple message + %talk (furl (~(win re p.fav) 0 p.q.yar)) :: program output + %warn (fume '~' [%leaf p.fav]) :: system message + %wipe +.$(wip &) :: delete old + == + :: + ++ yerk :: complete core + ^- [p=(list move) q=_..^$] + :- (flop mos) + ..^$(dug ?.(wip (~(put by dug) hen yar) (~(del by dug) hen))) + -- +:: +++ come + |= old=vase + ^- vane + ~|(%load-nest-dill !!) +:: +++ doze + |= [now=@da hen=duct] + ^- (unit ,@da) + ~ +:: +++ flee stay +++ load + |= new=vase + ^- vane + ?. (~(nest ut -:!>(dug)) & p.new) + (come new) + %_ ..^$ + dug ((map duct yard) q.new) + == +:: +++ raze + ^- vane + ..$(dug ~) +:: +++ scry + |= [our=ship ren=@tas his=ship syd=disc lot=coin tyl=path] + ^- (unit) + ~ +:: +++ stay `vase`!>(dug) +-- diff --git a/arvo/eyre.hoon b/arvo/eyre.hoon new file mode 100644 index 0000000000..7d1f89669f --- /dev/null +++ b/arvo/eyre.hoon @@ -0,0 +1,166 @@ +:: +:: eyre (4e), http servant +:: +|= pit=vase +^- vane :: kernel instrument +=> =~ +|% +++ bolo :: eyre state + $: wig=(map duct (list rout)) :: server routes + ged=duct :: client interface + giv=[p=@ud q=(map ,@ud duct)] :: incoming requests + ask=[p=@ud q=(map ,@ud ,[p=duct q=hiss])] :: outgoing requests + kes=(map duct ,@ud) :: outgoing requests + == +:: +++ ecco :: eat headers + |= hed=(list ,[p=@t q=@t]) + =+ mah=*math + |- ^- math + ?~ hed mah + =+ cus=(cass (rip 3 p.i.hed)) + =+ zeb=(~(get by mah) cus) + $(hed t.hed, mah (~(put by mah) cus ?~(zeb [q.i.hed ~] [q.i.hed u.zeb]))) +:: +++ hone :: host match + |= [fro=host too=host] ^- ? + ?- -.fro + | =(too fro) + & + ?& ?=(& -.too) + |- ^- ? + ?~ p.too & + ?~ p.fro | + ?: !=(i.p.too i.p.fro) | + $(p.too t.p.too, p.fro t.p.fro) + == + == +:: +++ loot :: match route + |= [uri=purl rut=rout] + ^- (unit scud) + ?. |- ^- ? + ?~ p.rut | + =(i.p.rut `host`r.p.uri) + ~ + =+ tac=*path + |- ^- (unit scud) + ?~ q.rut + :- ~ + :- :(weld (flop q.q.uri) tac s.rut) + `scar`[p.uri (flop tac) p.q.uri s.rut] + ?: |(?=(~ q.q.uri) !=(i.q.rut i.q.q.uri)) + ~ + $(q.rut t.q.rut, q.q.uri t.q.q.uri, tac [i.q.rut tac]) +-- +. == +=| bolo +|= [now=@da eny=@ sky=||(* (unit))] :: activate +^? :: opaque core +|% :: +++ beat :: process move + |= [wru=(unit writ) tea=wire hen=duct fav=curd] + => .(fav ((hard card) fav)) + ^- [p=(list move) q=vane] + ?+ -.fav + [[[wru hen fav] ~] ..^$] + :: + %band :: set/clear route + [~ ..^$(wig ?~(q.fav (~(del by wig) hen) (~(put by wig) hen q.fav)))] + :: + %born + [~ ..^$(ged hen)] :: XX retry all gets, abort all puts + :: + %crud + [[[wru [/d hen] %flog fav] ~] ..^$] + :: + %that :: response by us + =+ neh=(need (~(get by q.giv) p.fav)) + :_ ..^$(q.giv (~(del by q.giv) p.fav)) + :_ ~ + :+ ~ neh + :- %thou + ^- httr + ?- -.q.fav + %mid [200 ~[content-type/(moon p.q.fav)] [~ q.q.fav]] + %ham [200 ~[content-type/'text/html'] [~ (tact (xmlt p.q.fav ~))]] + %raw p.q.fav + == + :: + %them :: outgoing request + ?~ p.fav + =+ sud=(need (~(get by kes) hen)) + :- [[~ ged [%thus sud ~]] ~] + ..^$(q.ask (~(del by q.ask) sud), kes (~(del by kes) hen)) + :- [[~ ged [%thus p.ask p.fav]] ~] + %= ..^$ + p.ask +(p.ask) + q.ask (~(put by q.ask) p.ask hen u.p.fav) + kes (~(put by kes) hen p.ask) + == + :: + %they :: response to us + =+ kas=(need (~(get by q.ask) p.fav)) + :- [[~ p.kas [%thou q.fav]] ~] + ..^$(q.ask (~(del by q.ask) p.kas)) + :: + %this :: request to us + =+ ryp=`quri`(rash q.r.fav zest:epur) + =+ mah=(ecco r.r.fav) + =+ ^= pul ^- purl + ?- -.ryp + & ?>(=(p.fav p.p.p.ryp) p.ryp) + | =+ hot=(~(get by mah) %host) + ?> ?=([~ @ ~] hot) + [[p.fav (rash i.u.hot thor:epur)] p.ryp q.ryp] + == + =+ het=`hate`[pul (shaf %this q.fav) [p.r.fav mah s.r.fav]] + =+ gew=`(list ,[p=duct q=(list rout)])`(~(tap by wig) ~) + =+ ^= faw + |- ^- (list ,[p=duct q=scud]) + ?~ gew ~ + =+ mor=$(gew t.gew) + =+ ^= woy + |- ^- (list scud) + ?~ q.i.gew ~ + =+ mor=$(q.i.gew t.q.i.gew) + =+ lut=(loot pul i.q.i.gew) + ?~(lut mor [u.lut mor]) + ?~ woy mor + :: ?^ t.woy [[[~ hen [%thou 500 ~ ~]] ~] ..^^$] + [[p.i.gew i.woy] mor] + ?~ faw [[[~ hen [%thou 404 ~ ~]] ~] ..^$] + :: ?^ t.faw [[[~ hen [%thou 500 ~ ~]] ~] ..^$] + :- [[~ p.i.faw `card`[%thee p.giv [q.i.faw r.pul] *cred r.het]] ~] + ..^$(p.giv +(p.giv), q.giv (~(put by q.giv) p.giv hen)) + == +:: +++ come + |= old=vase + ^- vane + ~|(%load-nest-eyre !!) +:: +++ doze + |= [now=@da hen=duct] + ^- (unit ,@da) + ~ +:: +++ flee stay +++ load + |= new=vase + ^- vane + ?. (~(nest ut -:!>(`bolo`+>-.^$)) & p.new) + (come new) + ..^$(+>- (bolo q.new)) +:: +++ raze + ^- vane + ..$(+>- *bolo) +:: +++ scry + |= [our=ship ren=@tas who=ship syd=disc lot=coin tyl=path] + ^- (unit) + ~ +:: +++ stay `vase`!>(`bolo`+>-.$) +-- diff --git a/arvo/hoon.hoon b/arvo/hoon.hoon new file mode 100644 index 0000000000..c459ab676a --- /dev/null +++ b/arvo/hoon.hoon @@ -0,0 +1,7549 @@ +:: +:: Hoon/Arvo stage 191 (reflexive). +:: This file is in the public domain. +:: +:: A noun is an atom or a cell. An atom is any natural number +:: (ie, unsigned integer). A cell is an ordered pair of nouns. +:: +:: Noun A is this file, hoon.hoon, encoded as an atom, LSB first. +:: Noun B is the accompanying bytestream file, hoon.pill, encoded +:: as an atom LSB first, then unpacked with the ++cue function. +:: +:: A is marked above with a stage number (X=191) and a constraint, +:: either "reflexive" (normally) or "transitional" (for language +:: changes). Stage numbers count down to 0, ie, frozen. +:: +:: Consider this Turing-complete non-lambda automaton, "Nock": +:: +:: nock(a) *a +:: [a b c] [a [b c]] +:: +:: ?[a b] 0 +:: ?a 1 +:: +[a b] +[a b] +:: +a 1 + a +:: =[a a] 0 +:: =[a b] 1 +:: =a =a +:: +:: /[1 a] a +:: /[2 a b] a +:: /[3 a b] b +:: /[(a + a) b] /[2 /[a b]] +:: /[(a + a + 1) b] /[3 /[a b]] +:: /a /a +:: +:: *[a [b c] d] [*[a b c] *[a d]] +:: +:: *[a 0 b] /[b a] +:: *[a 1 b] b +:: *[a 2 b c] *[*[a b] *[a c]] +:: *[a 3 b] ?*[a b] +:: *[a 4 b] +*[a b] +:: *[a 5 b] =*[a b] +:: +:: *[a 6 b c d] *[a 2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b] +:: *[a 7 b c] *[a 2 b 1 c] +:: *[a 8 b c] *[a 7 [[7 [0 1] b] 0 1] c] +:: *[a 9 b c] *[a 7 c 2 [0 1] 0 b] +:: *[a 10 [b c] d] *[a 8 c 7 [0 3] d] +:: *[a 10 b c] *[a c] +:: +:: *a *a +:: +:: In a reflexive stage X, we assert, *[A_X B_X] yields B_X. +:: Ie, hoon.hoon is a self-compiling compiler against Nock. +:: +:: In any stage X, reflexive or transitional, where Y=X+1, +:: *[A_X B_Y] defines B_X. Ie, the current stage of Hoon +:: is written in the previous stage of Hoon. +:: +:: Hoon is a pure, strict, higher-order-typed functional +:: language in no particular family. It does not use +:: the lambda calculus or formal logic. Hoon's mapping +:: to Nock is like that of C to assembler - not always +:: trivial, always as trivial as possible. +:: +:: Nock is the complete interpreter and semantically isolated. +:: This small definition is designed to be permanently frozen. +:: All errors yield bottom, ie, do not terminate. A naive Nock +:: implementation is obviously not efficient. Don't be naive. +:: Operators 6-10 are just macros and add no formal power. +:: +:: (NB: the Nock definition above is just pseudocode, not Hoon. +:: To see a (mildly enhanced) Nock in Hoon, see ++mink. But +:: Hoon is defined in Nock; stating Nock in Hoon cannot tighten +:: the precision of Nock.) +:: +:: One fun exercise: decrement an atom in Nock, not using 7-10. +:: More fun is to also eschew 6. +:: +:: What is Hoon good for? Now, nothing. Ideally, whatever. +:: But mostly, functional system software. To be at least +:: marginally useful out of the box, the Hoon kernel includes +:: a simple deterministic operating system, Arvo. +:: +:: Arvo in stage 191 is in an entirely experimental state and +:: should not be entrusted with any meaningful data. It does +:: self-host, but only with much help from legacy tools. In +:: short, do not use it. +:: +:: Arvo is not an OS in the sense that it drives bare metal. +:: It's an OS in the sense that it runs programs and maintains +:: general persistent state. Arvo is exclusively a server +:: platform and provides no UI besides a command line and an +:: HTTP server. Like everything in Hoon and Nock, Arvo is +:: isolated and cannot call back into Unix, though a Unix +:: process generates its events and applies its results. +:: +:: Arvo's main feature is a peer-to-peer protocol, ++ames, +:: defined as a function which maps a stream of UDP packets +:: into a secure, monotonic global namespace. A persistent +:: virtual computer can be standardized as a pure function of +:: the form "from the packets I've heard, what do I know?" +:: +:: (On an ideal network, this function is (a) identical on +:: every host and (b) referentially transparent (ie, once a +:: name is bound to a value, it is bound permanently). But +:: we cannot prevent hosts from signing miscomputations +:: and/or conflicts; bad actors must be managed socially.) +:: +:: This "lambda architecture" is often used as a specialized +:: database, but can be a general-purpose computer if it can +:: extend and upgrade itself from its own packets. Abstractly, +:: the kernel is just the first packet, meaning the semantic +:: standard is just Nock itself - a small "attack surface" for +:: both security and portability. Nock, like IPv4 or XML, is +:: small enough that it should never need upgrading, meaning +:: the formal semantics of the computer are permanently fixed. +:: Any conceivable change would be a compatible extension. +:: +:: ++ames is a "content-centric" protocol - packet semantics +:: independent of source address. It therefore needs its own +:: global PKI and identity model. The fingerprints of the +:: initial root keys are actually embedded in this file +:: below. No secrets live forever, though, and the kernel +:: author retains no dominion whatsoever over Arvo users. +:: All keys and algorithms can be updated without disruption. +:: [NB: the roots are now in urb/les/arvo/ames.hoon.] +:: +:: Arvo does not process packets only, but also local events +:: (++card) from the host OS. Modules handling these events +:: includes a shell %bede, a versioned filesystem %clay, +:: a console %dill and a web server %eyre. Each is crude +:: if not risible and meant only as a proof of concept, but +:: can be upgraded without losing state. Finally, there is +:: a small standard library at the Arvo level, %zuse. +:: +:: Hoon is roughly 7500 lines of Hoon; Arvo is roughly 5000. +:: Their image in Nock, urbit.pill, is roughly 500K (which +:: includes the full kernel AST) if built without tracing. +:: There are no external semantic dependencies, but some +:: ingenuity is needed to execute the system efficiently. +:: The attached interpreter, vere, is deficient in many ways +:: and cannot be relied on for any practical purpose. +:: +:: This kernel, while unreadable due to its spiky alien +:: syntax, is also mostly undocumented. Yo, we're sorry. +:: +:::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::: :::::: Preface :::::: +:::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: +?> ?=(@ .) :: atom subject +%. . :: fun with subject +|= cud=@ :: call it cud +=- ?: =(0 cud) :: if cud is 0 + all :: then return engine + (make:all cud) :: else simple compile +^= all :: assemble engine + =~ :: volume stack +%191 :: version constant +:::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::: :::::: volume 0, version stub :::::: +:::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: +~% %k.191 ~ ~ :: +|% :: +++ stub 191 :: version stub +-- :: +:::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::: :::::: volume 1, Hoon models :::::: +:::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: +~% %mood + + + ~ +|% :: +++ axis ,@ :: tree address +++ beer $|(@ [~ p=gene]) :: +++ bloq ,@ :: blockclass +++ bozo ?([%atom p=odor] %noun %cell %bean %null) :: +++ calf ,[p=(map ,@ud wine) q=wine] :: +++ char ,@tD :: +++ chop $? lef=term :: + [std=term kel=@] :: + [ven=term pro=term kel=@] :: + [ven=term pro=term ver=@ kel=@] :: + == :: +++ claw $% [%ash p=gene] :: + [%elm p=gene] :: + [%oak ~] :: + [%yew p=(map term claw)] :: + == :: +++ coat ,[p=path q=vase] :: +++ coil $: p=?(%gold %iron %lead %zinc) :: + q=type :: + r=[p=?(~ ^) q=(map term foot)] :: + == :: +++ coin $% [%$ p=dime] :: + [%blob p=*] :: + [%many p=(list coin)] :: + == :: +++ cord ,@t :: +++ date ,[[a=? y=@ud] m=@ud t=tarp] :: parsed date +++ dime ,[p=@ta q=@] :: +++ dram $% [| p=(map ,@tas dram)] :: + [& p=@ud q=@] :: + == :: +++ edge ,[p=hair q=(unit ,[p=* q=nail])] :: +++ foot $% [%ash p=gene] :: + [%elm p=gene] :: + [%oak ~] :: + [%yew p=(map term foot)] :: + == :: +++ gear |* a=_,* :: list generator + $_ :: + =+ b=* :: + |? :: + ?@ b :: + ~ :: + [i=(a -.b) t=^?(..$(b +.b))] :: +++ gene $& [p=gene q=gene] :: + $% :: + [%$ p=axis] :: + :: :: + [%bcbr p=gene q=gene] :: + [%bccb p=gene] :: + [%bccl p=gens] :: + [%bccn p=gene q=gens] :: + [%bccm p=gene] :: + [%bckt p=gene] :: + [%bcpm p=gene q=gene] :: + [%bctr p=gene] :: + [%bcts p=bozo] :: + [%bcwt p=gene q=gens] :: + :: :: + [%brbr p=gene q=gene] :: + [%brcb p=gene q=(map term foot)] :: + [%brcl p=gene q=(map term foot)] :: + [%brcn p=(map term foot)] :: + [%brdt p=gene] :: + [%brkt p=gene q=(map term foot)] :: + [%brhp p=gene] :: + [%brls p=gene q=gene] :: + [%brtr p=gene q=gene] :: + [%brts p=gene q=gene] :: + [%brwt p=gene] :: + :: :: + [%clcb p=gene q=gene] :: + [%clcn p=gens] :: + [%clfs p=gene] :: + [%clkt p=gene q=gene r=gene s=gene] :: + [%clhp p=gene q=gene] :: + [%clls p=gene q=gene r=gene] :: + [%clsg p=gens] :: + [%cltr p=gens] :: + [%clzp p=gens] :: + :: :: + [%cnbc p=term] :: + [%cncb p=wing q=gent] :: + [%cncl p=gene q=gene] :: + [%cndt p=gene q=gene] :: + [%cnhp p=gene q=gens] :: + [%cnhx p=wing] :: + [%cntr p=wing q=gene r=gent] :: + [%cnkt p=gene q=gene r=gene s=gene] :: + [%cnls p=gene q=gene r=gene] :: + [%cnsg p=wing q=gene r=gene] :: + [%cnts p=wing q=gent] :: + :: :: + [%dtkt p=gene] :: + [%dtls p=gene] :: + [%dtpt p=term q=@] :: + [%dtsg p=term q=*] :: + [%dttr p=gene q=gene] :: + [%dtts p=gene q=gene] :: + [%dtwt p=gene] :: + :: :: + [%hxgl p=gens] :: + [%hxgr p=gens] :: + :: :: + [%ktbr p=gene] :: + [%ktls p=gene q=gene] :: + [%ktdt p=gene q=gene] :: + [%kthp p=gene q=gene] :: + [%ktpm p=gene] :: + [%ktsg p=gene] :: + [%ktts p=term q=gene] :: + [%ktwt p=gene] :: + :: :: + [%sgbr p=gene q=gene] :: + [%sgcl p=[p=@ q=@] q=gene] :: + [%sgcn p=chop q=gene r=genu s=gene] :: + [%sgfs p=chop q=gene] :: + [%sggl p=$|(term [p=term q=gene]) q=gene] :: + [%sggr p=$|(term [p=term q=gene]) q=gene] :: + [%sgbc p=term q=gene] :: + [%sghx p=term q=gene] :: + [%sgkt p=gene q=gene] :: + [%sgls p=@ q=gene] :: + [%sgpm p=@ud q=gene r=gene] :: + [%sgts p=gene q=gene] :: + [%sgzp p=gene q=gene] :: + :: :: + [%smcb p=gene q=gene] :: + [%smcl p=gene q=gens] :: + [%smcm p=gene q=gens] :: + [%smcn p=gens] :: + [%smdt p=gene q=gens] :: + [%smdq p=(list beer)] :: + [%smgl p=gene q=gene r=gene] :: + [%smgr p=gene q=gene r=gene] :: + [%smkt p=gene q=gene] :: + [%smhp p=gene q=gene] :: + [%smhx p=(list beer)] :: + [%smls p=gene q=gene] :: + [%smpm p=gene q=gens] :: + [%smsg p=gene q=gens] :: + [%smsm p=gene q=gene] :: + [%smtr p=gene q=gene] :: + [%smts p=gene q=gene] :: + [%smwt p=gene q=gene] :: + :: :: + [%tsbr p=gene q=gene] :: + [%tscl p=gent q=gene] :: + [%tsdt p=gene q=gene r=gene] :: + [%tsgl p=gene q=gene] :: + [%tsgr p=gene q=gene] :: + [%tskt p=gene q=gene r=gene s=gene] :: + [%tsls p=gene q=gene] :: + [%tshp p=gene q=gene] :: + [%tssg p=gens] :: + :: :: + [%wtbr p=gens] :: + [%wthp p=gene q=gent] :: + [%wtcl p=gene q=gene r=gene] :: + [%wtcn p=gene q=gene] :: + [%wtdt p=gene q=gene r=gene] :: + [%wtkt p=gene q=gene r=gene] :: + [%wtgl p=gene q=gene] :: + [%wtgr p=gene q=gene] :: + [%wtls p=gene q=gene r=gent] :: + [%wtpm p=gens] :: + [%wtpt p=gene q=gene r=gene] :: + [%wtsg p=gene q=gene r=gene] :: + [%wtts p=gene q=gene] :: + [%wtzp p=gene] :: + :: :: + [%zpcb p=spot q=gene] :: + [%zpcm p=gene q=gene] :: + [%zpcn ~] :: + [%zpfs p=gene] :: + [%zpgr p=gene] :: + [%zpsm p=gene q=gene] :: + [%zpts p=gene] :: + [%zpzp ~] :: + == :: +++ gens (list gene) :: +++ gent (list ,[p=gene q=gene]) :: +++ genu (list ,[p=term q=gene]) :: +++ goon (list (unit gene)) :: similar path +++ hair ,[p=@ud q=@ud] :: +++ hapt (list ,@ta) :: +++ like |* a=_,* :: generic edge + |= b=_`*`[(hair) ~] :: + :- p=(hair -.b) :: + ^= q :: + ?@ +.b ~ :: + :- ~ :: + u=[p=(a +>-.b) q=[p=(hair -.b) q=(tape +.b)]] :: +++ limb $|(term $%([& p=axis] [| p=@ud q=term])) :: +++ line ,[p=[%leaf p=odor q=@] q=tile] :: +++ list |* a=_,* :: + $|(~ [i=a t=(list a)]) :: +++ odor ,@ta :: +++ tarp ,[d=@ud h=@ud m=@ud s=@ud f=(list ,@ux)] :: parsed time +++ time ,@da :: galactic time +++ tree |* a=_,* :: binary tree + $|(~ [n=a l=(tree a) r=(tree a)]) :: +++ nail ,[p=hair q=tape] :: +++ pass ,@ :: +++ path (list span) :: +++ pint ,[p=[p=@ q=@] q=[p=@ q=@]] :: +++ port $: p=axis :: + ^= q :: + $% [& p=type] :: + [| p=axis q=(list ,[p=type q=foot])] :: + == :: + == :: +++ prop $: p=axis :: + ^= q :: + [p=?(~ axis) q=(list ,[p=type q=foot])] :: + == :: +++ reef ,[p=[p=? q=@ud] q=@ud] :: +++ ring ,@ :: +++ rule |=(tub=nail `edge`[p.tub ~ ~ tub]) :: +++ shoe $% [%hunk p=tank] :: + [%lose p=term] :: + [%mean p=*] :: + [%spot p=spot] :: + == :: +++ span ,@ta :: +++ spot ,[p=path q=pint] :: +++ tank $% [%leaf p=tape] :: + :- %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 (list char) :: +++ term ,@ta :: +++ tile $& [p=tile q=tile] :: ordered pair + $% [%base p=bozo] :: base type + [%bark p=term q=tile] :: name + [%bush p=tile q=tile] :: atom/cell + [%fern p=[i=tile t=(list tile)]] :: plain selection + [%herb p=gene] :: function + [%kelp p=[i=line t=(list line)]] :: tag selection + [%leaf p=term q=@] :: constant atom + [%reed p=tile q=tile] :: pair/tag + [%weed p=gene] :: example + == :: +++ tone $% [0 p=*] :: + [1 p=(list)] :: + [2 p=(list ,[@ta *])] :: + == :: +++ tool $& [p=tool q=tool] :: + $% [0 p=@] :: + [1 p=*] :: + [2 p=tool q=tool] :: + [3 p=tool] :: + [4 p=tool] :: + [5 p=tool q=tool] :: + [6 p=tool q=tool r=tool] :: + [7 p=tool q=tool] :: + [8 p=tool q=tool] :: + [9 p=@ q=tool] :: + [10 p=?(@ [p=@ q=tool]) q=tool] :: + [11 p=tool] :: + == :: +++ toon $% [0 p=*] :: + [1 p=(list)] :: + [2 p=(list tank)] :: + == :: +++ tope type :: old type (if any) +++ tune $% [0 p=vase] :: + [1 p=(list)] :: + [2 p=(list ,[@ta *])] :: + == :: +++ type $| ?(%noun %void) :: + $% [%atom p=term] :: + [%cell p=type q=type] :: + [%core p=type q=coil] :: + [%cube p=* q=type] :: + [%face p=term q=type] :: + [%fork p=type q=type] :: + [%hold p=(list ,[p=type q=gene])] :: + == :: +++ udal :: atomic change (%b) + $: p=@ud :: blockwidth + q=(list ,[p=@ud q=(unit ,[p=@ q=@])]) :: indels + == :: +++ udon :: abstract delta + $: p=umph :: preprocessor + ^= q :: patch + $% [%a p=ulna] :: trivial replace + [%b p=udal] :: atomic indel + [%c p=(urge)] :: list indel + [%d p=upas q=upas] :: tree edit + == :: + == :: +++ ulna ,[p=* q=*] :: from to +++ umph :: change filter + $| $? %a :: no filter + %b :: jamfile + %c :: LF text + == :: + $% [%d p=@ud] :: blocklist + == :: +++ unit |* a=_,* :: maybe + $|(~ [~ u=a]) :: +++ 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 |* a=_,* :: list change + %- list :: + ,$%([& p=@ud] [| p=(list a) q=(list a)]) :: +++ vase ,[p=type q=*] :: type-value pair +++ vise ,[p=tope q=*] :: old vase +++ wall (list tape) :: text lines +++ wing (list limb) :: +++ 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 |*(veq=edge ?@(q.veq !! p.u.q.veq)) :: +:: :: +++ map |* [a=_,* b=_,*] :: associative array + $|(~ [n=[p=a q=b] l=(map a b) r=(map a b)]) :: +++ qeu |* a=_,* :: + $|(~ [n=a l=(qeu a) r=(qeu a)]) :: +++ set |* a=_,* :: + $|(~ [n=a l=(set a) r=(set a)]) :: +-- :: +:::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::: :::::: volume 2, Hoon libraries and compiler :::::: +:::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: +~% %hoon + + + == + %ap ap + %ut ut + %seed seed + %show show + == +|% + ::::::::::::::::::::::::::::::::::::::::::::::::::::: :: +:::: chapter 2a, basic unsigned math :::: +:: :::::::::::::::::::::::::::::::::::::::::::::::::::::: +++ add :: add + ~/ %add + |= [a=@ b=@] + ^- @ + ?: =(0 a) + b + $(a (dec a), b +(b)) +:: +++ cap :: tree head + ~/ %cap + |= a=@ + ^- ?(2 3) + ?- a + 2 %2 + 3 %3 + ?(0 1) !! + * $(a (div a 2)) + == +:: +++ dec :: decrement + ~/ %dec + |= a=@ + ~| %decrement-underflow + ^- @ + ?< =(0 a) + =+ b=@ + |- + ?: =(a +(b)) + b + $(b +(b)) +:: +++ div :: divide + ~/ %div + |= [a=@ b=@] + ^- @ + ~| 'div' + ?< =(0 b) + =+ c=@ + |- + ?: (lth a b) + c + $(a (sub a b), c +(c)) +:: +++ gte :: greater-equal + ~/ %gte + |= [a=@ b=@] + ^- ? + !(lth a b) +:: +++ gth :: greater-than + ~/ %gth + |= [a=@ b=@] + ^- ? + !(lte a b) +:: +++ lte :: less-equal + ~/ %lte + |= [a=@ b=@] + |(=(a b) (lth a b)) +:: +++ lth :: less-than + ~/ %lth + |= [a=@ b=@] + ^- ? + &(!=(a b) |-(|(=(0 a) &(!=(0 b) $(a (dec a), b (dec b)))))) +:: +++ mas :: tree body + ~/ %mas + |= a=@ + ^- @ + ?- a + 1 !! + 2 1 + 3 1 + * (add (mod a 2) (mul $(a (div a 2)) 2)) + == +:: +++ max :: maximum + ~/ %max + |= [a=@ b=@] + ^- @ + ?: (gth a b) + a + b +:: +++ min :: minimum + ~/ %min + |= [a=@ b=@] + ^- @ + ?: (lth a b) + a + b +:: +++ mod :: remainder + ~/ %mod + |= [a=@ b=@] + ^- @ + ?< =(0 b) + (sub a (mul b (div a b))) +:: +++ mul :: multiply + ~/ %mul + |= [a=@ b=@] + ^- @ + =+ c=@ + |- + ?: =(0 a) + c + $(a (dec a), c (add b c)) +:: +++ peg :: tree connect + ~/ %peg + |= [a=@ b=@] + ^- @ + ?- b + 1 a + 2 (mul a 2) + 3 +((mul a 2)) + * (add (mod b 2) (mul $(b (div b 2)) 2)) + == +:: +++ sub :: subtract + ~/ %sub + |= [a=@ b=@] + ~| %subtract-underflow + ^- @ + ?: =(0 b) + a + $(a (dec a), b (dec b)) + :::::::::::::::::::::::::::::::::::::::::::::::::::::: :: +:::: chapter 2b, basic containers :::: +:: :::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: Section 2bA, units :: +:: +++ bind :: argue + |* [a=(unit) b=_,*] + ?~ a + ~ + [~ u=(b u.a)] +:: +++ clap :: combine + |* [a=(unit) b=(unit) c=_|=(^ +<-)] + ?~ a + b + ?~ b + a + [~ u=(c u.a u.b)] +:: +++ drop :: enlist + |* a=(unit) + ?~ a + ~ + [i=u.a t=~] +:: +++ fall :: default + |* [a=(unit) b=*] + ?~(a b u.a) +:: +++ mate :: choose + |* [a=(unit) b=(unit)] + ?~ b + a + ?~ a + b + ?.(=(u.a u.b) ~|('mate' !!) a) +:: +++ need :: demand + |* a=(unit) + ?@ a + !! + u.a +:: +++ some :: lift + |* a=* + [~ u=a] +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: Section 2bB, lists :: +:: +++ flop :: reverse + ~/ %flop + |* a=(list) + => .(a (homo a)) + ^+ a + =+ b=`_a`~ + |- + ?@ a + b + $(a t.a, b [i.a b]) +:: +++ homo :: homogenize + |* a=(list) + ^- $_ =< $ + |% + +- $ + ?: ? + ~ + [i=(snag 0 a) t=$] + -- + a +:: +++ lent :: length + ~/ %lent + |= a=(list) + ^- @ + =+ b=@ + |- + ?@(a b $(a t.a, b +(b))) +:: +++ levy + ~/ %levy :: all of + |* [a=(list) b=_|=(p=* .?(p))] + |- ^- ? + ?@ a + & + ?: (b i.a) + $(a t.a) + | +:: +++ lien :: some of + ~/ %lien + |* [a=(list) b=_|=(p=* .?(p))] + |- ^- ? + ?@ a + | + ?: (b i.a) + & + $(a t.a) +:: +++ reel :: right fold + ~/ %reel + |* [a=(list) b=_=+([p=* q=*] |.(q))] + |- ^+ q.b + ?@ a + q.b + (b i.a $(a t.a)) +:: +++ roll :: left fold + ~/ %roll + |* [a=(list) b=_=+([p=* q=*] |.(q))] + |- + ^+ q.b + ?@ a + q.b + $(a t.a, b b(q (b i.a q.b))) +:: +++ skid :: separate + |* [a=(list) b=||(* ?)] + |- ^+ [p=a q=a] + ?~ a [~ ~] + =+ c=$(a t.a) + ?:((b i.a) [[i.a p.c] q.c] [p.c [i.a q.c]]) +:: +++ skim :: only + ~/ %skim + |* [a=(list) b=_|=(p=* .?(p))] + |- + ^+ a + ?@ a + ~ + ?:((b i.a) [i.a $(a t.a)] $(a t.a)) +:: +++ skip :: except + ~/ %skip + |* [a=(list) b=_|=(p=* .?(p))] + |- + ^+ a + ?@ a + ~ + ?:((b i.a) $(a t.a) [i.a $(a t.a)]) +:: +++ scag :: prefix + |* [a=@ b=(list)] + ^+ b + ?: |(?=(~ b) =(0 a)) + ~ + [i.b $(b t.b, a (dec a))] +:: +++ slag :: suffix + |* [a=@ b=(list)] + ^+ b + ?: =(0 a) + b + ?@ b + ~ + $(b t.b, a (dec a)) +:: +++ snag :: index + ~/ %snag + |* [a=@ b=(list)] + ?@ b + ~|('snag-fail' !!) + ?: =(0 a) + i.b + $(b t.b, a (dec a)) +:: +++ sort :: quicksort + ~/ %sort + |* [a=(list) b=_|=([p=* q=*] =(p q))] + => .(a (homo a)) + |- ^+ a + ?~ a ~ + %+ weld + $(a (skim t.a |=(c=_i.a (b c i.a)))) + [i.a $(a (skim t.a |=(c=_i.a !(b c i.a))))] +:: +++ swag :: infix + |* [[a=@ b=@] c=(list)] + (scag b (slag a c)) +:: +++ turn :: transform + ~/ %turn + |* [a=(list) b=_,*] + |- + ?@ a + ~ + [i=(b i.a) t=$(a t.a)] +:: +++ weld :: concatenate + ~/ %weld + |* [a=(list) b=(list)] + => .(a (homo a), b (homo b)) + |- + ^+ b + ?@ a + b + [i.a $(a t.a)] +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2bC, gears :: +:: +++ from :: range + |= [a=@ b=@] + ^- (gear ,@) + =+ c=0 + |? + ?: =(c b) + ~ + [i=a t=^?(..$(a +(a), c +(c)))] +:: +++ long :: + |* a=(gear) + =+ b=0 + |- ^- @ + =+ c=(a) + ?~ c + b + $(b +(b), a t.c) +:: +++ lone |*(a=* |?([i=a t=none])) :: +++ mill + |* [a=_,* b=(gear)] + |? + =+ c=(b) + ?~ c + ~ + [i=(a i.c) t=^?(..$(b t.c))] +:: +++ none |?(~) :: +++ over :: + |= [a=@ b=@] + ^- (gear ,@) + |? + ?: =(a b) + [i=a t=none] + [i=a t=^?(..$(a +(a)))] +:: +++ pull :: + |* a=(gear) + |= b=_^+(|-(=+(b=(a) ?~(b ~ [i=i.b t=$(a t.b)]))) ~) + ^+ b + =+ c=(a) + ?~ c + b + $(b [i.c b], a t.c) +:: +++ push :: + |* a=(gear) + |= b=_^+(|-(=+(b=(a) ?~(b ~ [i=i.b t=$(a t.b)]))) ~) + ^+ b + =+ c=((pull a) ~) + ((pull (spin c)) b) +:: +++ spin :: + |* a=(list) + => .(a `_(homo a)`a) + |? + ?~ a + ~ + [i=i.a t=^?(..$(a t.a))] + :::::::::::::::::::::::::::::::::::::::::::::::::::::: :: +:::: chapter 2c, simple noun surgery :::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2cA, bit surgery :: +:: +++ bex :: binary exponent + ~/ %bex + |= a=@ + ^- @ + ?: =(0 a) + 1 + (mul 2 $(a (dec a))) +:: +++ can :: assemble + ~/ %can + |= [a=bloq b=(list ,[p=@ q=@])] + ^- @ + ?@ b + 0 + (mix (end a p.i.b q.i.b) (lsh a p.i.b $(b t.b))) +:: +++ cat :: concatenate + ~/ %cat + |= [a=bloq b=@ c=@] + (add (lsh a (met a b) c) b) +:: +++ cut :: slice + ~/ %cut + |= [a=bloq [b=@ c=@] d=@] + (end a c (rsh a b d)) +:: +++ end :: tail + ~/ %end + |= [a=bloq b=@ c=@] + (mod c (bex (mul (bex a) b))) +:: +++ lsh :: left-shift + ~/ %lsh + |= [a=bloq b=@ c=@] + (mul (bex (mul (bex a) b)) c) +:: +++ met :: measure + ~/ %met + |= [a=bloq b=@] + ^- @ + =+ c=0 + |- + ?: =(0 b) + c + $(b (rsh a 1 b), c +(c)) +:: +++ rap :: assemble nonzero + ~/ %rap + |= [a=bloq b=(list ,@)] + ^- @ + ?@ b + 0 + (cat a i.b $(b t.b)) +:: +++ rep :: assemble single + ~/ %rep + |= [a=bloq b=(list ,@)] + ^- @ + =+ c=0 + |- + ?@ b + 0 + (con (lsh a c (end a 1 i.b)) $(c +(c), b t.b)) +:: +++ rip :: disassemble + ~/ %rip + |= [a=bloq b=@] + ^- (list ,@) + ?: =(0 b) + ~ + [(end a 1 b) $(b (rsh a 1 b))] +:: +++ rsh :: right-shift + ~/ %rsh + |= [a=bloq b=@ c=@] + (div c (bex (mul (bex a) b))) +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2cB, bit logic :: +:: +++ con :: binary or + ~/ %con + |= [a=@ b=@] + =+ [c=0 d=0] + |- ^- @ + ?: ?&(=(0 a) =(0 b)) + d + %= $ + a (rsh 0 1 a) + b (rsh 0 1 b) + c +(c) + d (add d (lsh 0 c ?&(=(0 (end 0 1 a)) =(0 (end 0 1 b))))) + == +:: +++ dis :: binary and + ~/ %dis + |= [a=@ b=@] + =+ [c=@ d=@] + |- ^- @ + ?: ?|(=(0 a) =(0 b)) + d + %= $ + a (rsh 0 1 a) + b (rsh 0 1 b) + c +(c) + d (add d (lsh 0 c ?|(=(0 (end 0 1 a)) =(0 (end 0 1 b))))) + == +:: +++ mix :: binary xor + ~/ %mix + |= [a=@ b=@] + ^- @ + =+ [c=0 d=0] + |- + ?: ?&(=(0 a) =(0 b)) + d + %= $ + a (rsh 0 1 a) + b (rsh 0 1 b) + c +(c) + d (add d (lsh 0 c =((end 0 1 a) (end 0 1 b)))) + == +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2cC, noun orders :: +:: +++ aor :: a-order + ~/ %aor + |= [a=* b=*] + ^- ? + ?: =(a b) + & + ?. ?=(@ a) + ?. ?=(@ b) + ?: =(-.a -.b) + $(a +.a, b +.b) + $(a -.a, b -.b) + | + ?. ?=(@ b) + & + |- + =+ [c=(end 3 1 a) d=(end 3 1 b)] + ?: =(c d) + $(a (rsh 3 1 a), b (rsh 3 1 b)) + (lth c d) +:: +++ dor :: d-order + ~/ %dor + |= [a=* b=*] + ^- ? + ?: =(a b) + & + ?. ?=(@ a) + ?. ?=(@ b) + ?: =(-.a -.b) + $(a +.a, b +.b) + $(a -.a, b -.a) + | + ?. ?=(@ b) + & + (lth a b) +:: +++ gor :: g-order + ~/ %gor + |= [a=* b=*] + ^- ? + =+ [c=(mug a) d=(mug b)] + ?: =(c d) + (dor a b) + (lth c d) +:: +++ hor :: h-order + ~/ %hor + |= [a=* b=*] + ^- ? + ?: ?=(@ a) + ?: ?=(@ b) + (gor a b) + & + ?: ?=(@ b) + | + ?: =(-.a -.b) + (gor +.a +.b) + (gor -.a -.b) +:: +++ vor :: v-order + ~/ %vor + |= [a=* b=*] + ^- ? + =+ [c=(mug (mug a)) d=(mug (mug b))] + ?: =(c d) + (dor a b) + (lth c d) +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2cD, insecure hashing :: +:: +++ fnv |=(a=@ (end 5 1 (mul 16.777.619 a))) :: FNV scrambler +++ mug :: 31bit nonzero FNV1a + ~/ %mug + |= a=* + ?^ a + =+ b=[p=$(a -.a) q=$(a +.a)] + |- ^- @ + =+ c=(fnv (mix p.b (fnv q.b))) + =+ d=(mix (rsh 0 31 c) (end 0 31 c)) + ?. =(0 c) c + $(q.b +(q.b)) + =+ b=2.166.136.261 + |- ^- @ + =+ c=b + =+ [d=0 e=(met 3 a)] + |- ^- @ + ?: =(d e) + =+ f=(mix (rsh 0 31 c) (end 0 31 c)) + ?. =(0 f) f + ^$(b +(b)) + $(c (fnv (mix c (cut 3 [d 1] a))), d +(d)) +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2cE, phonetic base :: +:: +++ po + ~/ %po + =+ :- ^= sis + 'dozmarbinwansamlitsighidfidlissogdirwacsabwissib\ + /rigsoldopmodfoglidhopdardorlorhodfolrintogsilmir\ + /holpaslacrovlivdalsatlibtabhanticpidtorbolfosdot\ + /losdilforpilramtirwintadbicdifrocwidbisdasmidlop\ + /rilnardapmolsanlocnovsitnidtipsicropwitnatpanmin\ + /ritpodmottamtolsavposnapnopsomfinfonbanporworsip\ + /ronnorbotwicsocwatdolmagpicdavbidbaltimtasmallig\ + /sivtagpadsaldivdactansidfabtarmonranniswolmispal\ + /lasdismaprabtobrollatlonnodnavfignomnibpagsopral\ + /bilhaddocridmocpacravripfaltodtiltinhapmicfanpat\ + /taclabmogsimsonpinlomrictapfirhasbosbatpochactid\ + /havsaplindibhosdabbitbarracparloddosbortochilmac\ + /tomdigfilfasmithobharmighinradmashalraglagfadtop\ + /mophabnilnosmilfopfamdatnoldinhatnacrisfotribhoc\ + /nimlarfitwalrapsarnalmoslandondanladdovrivbacpol\ + /laptalpitnambonrostonfodponsovnocsorlavmatmipfap' + ^= dex + 'zodnecbudwessevpersutletfulpensytdurwepserwylsun\ + /rypsyxdyrnuphebpeglupdepdysputlughecryttyvsydnex\ + /lunmeplutseppesdelsulpedtemledtulmetwenbynhexfeb\ + /pyldulhetmevruttylwydtepbesdexsefwycburderneppur\ + /rysrebdennutsubpetrulsynregtydsupsemwynrecmegnet\ + /secmulnymtevwebsummutnyxrextebfushepbenmuswyxsym\ + /selrucdecwexsyrwetdylmynmesdetbetbeltuxtugmyrpel\ + /syptermebsetdutdegtexsurfeltudnuxruxrenwytnubmed\ + /lytdusnebrumtynseglyxpunresredfunrevrefmectedrus\ + /bexlebduxrynnumpyxrygryxfeptyrtustyclegnemfermer\ + /tenlusnussyltecmexpubrymtucfyllepdebbermughuttun\ + /bylsudpemdevlurdefbusbeprunmelpexdytbyttyplevmyl\ + /wedducfurfexnulluclennerlexrupnedlecrydlydfenwel\ + /nydhusrelrudneshesfetdesretdunlernyrsebhulryllud\ + /remlysfynwerrycsugnysnyllyndyndemluxfedsedbecmun\ + /lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes' + |% + ++ ind ~/ %ind + |= a=@ + =+ b=0 + |- ^- (unit ,@) + ?:(=(256 b) ~ ?:(=(a (tod b)) [~ b] $(b +(b)))) + ++ ins ~/ %ins + |= a=@ + =+ 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)))) + -- +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2cF, signed and modular ints :: +:: +++ si :: signed integer + |% + ++ abs |=(a=@s (add (end 0 1 a) (rsh 0 1 a))) + ++ dif |=([a=@s b=@s] (sum a (new !(syn b) (abs b)))) + ++ dul |=([a=@s b=@s] =+(c=(old a) ?:(-.c (mod +.c b) (sub b +.c)))) + ++ fra |= [a=@s b=@s] + (new =(0 (mix (syn a) (syn b))) (div (abs a) (abs b))) + ++ new |=([a=? b=@] `@s`?:(a (mul 2 b) ?:(=(0 b) 0 +((mul 2 (dec b)))))) + ++ old |=(a=@s [(syn a) (abs a)]) + ++ pro |= [a=@s b=@s] + (new =(0 (mix (syn a) (syn b))) (mul (abs a) (abs b))) + ++ rem |=([a=@s b=@s] (dif a (pro b (fra a b)))) + ++ sum |= [a=@s b=@s] + ~| %si-sum + =+ [c=(old a) d=(old b)] + ?: -.c + ?: -.d + (new & (add +.c +.d)) + ?: (gte +.c +.d) + (new & (sub +.c +.d)) + (new | (sub +.d +.c)) + ?: -.d + ?: (gte +.c +.d) + (new | (sub +.c +.d)) + (new & (sub +.d +.c)) + (new | (add +.c +.d)) + ++ sun |=(a=@u (mul 2 a)) + ++ syn |=(a=@s =(0 (end 0 1 a))) + -- +++ 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=@ ^- @ + => .(b (sit b)) + ?: (lte a 3) + b + =+ c=(dec a) + %+ 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=@ c=@] ^- @ + =+ d=(sit c) + =+ e=(bex a) + =+ f=(mod b e) + =+ g=(sub e f) + (con (lsh 0 f (end 0 g d)) (rsh 0 g d)) + ++ ror |= [b=@ c=@] ^- @ + =+ d=(sit c) + =+ e=(bex a) + =+ f=(mod b e) + =+ g=(sub e f) + (con (rsh 0 f d) (lsh 0 g (end 0 f d))) + ++ sum |=([b=@ c=@] (sit (add b c))) + ++ sit |=(b=@ (end a 1 b)) + -- +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2cG, floating point :: +:: +++ rlyd |=(red=@rd ~|(%real-nyet ^-([s=? h=@ f=@] !!))) +++ rlyh |=(reh=@rh ~|(%real-nyet ^-([s=? h=@ f=@] !!))) +++ rlyq |=(req=@rq ~|(%real-nyet ^-([s=? h=@ f=@] !!))) +++ rlys |=(res=@rs ~|(%real-nyet ^-([s=? h=@ f=@] !!))) +++ ryld |=([syn=? hol=@ fac=@] ~|(%real-nyet ^-(@rd !!))) +++ rylh |=([syn=? hol=@ fac=@] ~|(%real-nyet ^-(@rh !!))) +++ rylq |=([syn=? hol=@ fac=@] ~|(%real-nyet ^-(@rq !!))) +++ ryls |=([syn=? hol=@ fac=@] ~|(%real-nyet ^-(@rs !!))) +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2cH, urbit time :: +:: +++ year + |= det=date + ^- @d + =+ ^= yer + ?: a.det + (add 292.277.024.400 y.det) + (sub 292.277.024.400 (dec y.det)) + =+ day=(yawn yer m.det d.t.det) + (yule day h.t.det m.t.det s.t.det f.t.det) +:: +++ yore + |= now=@d + ^- date + =+ rip=(yell now) + =+ ger=(yall d.rip) + :- ?: (gth y.ger 292.277.024.400) + [a=& y=(sub y.ger 292.277.024.400)] + [a=| y=+((sub 292.277.024.400 y.ger))] + [m.ger d.ger h.rip m.rip s.rip f.rip] +:: +++ yell + |= now=@d + ^- tarp + =+ sec=(rsh 6 1 now) + =+ ^= fan + =+ [muc=4 raw=(end 6 1 now)] + |- ^- (list ,@ux) + ?: |(=(0 raw) =(0 muc)) + ~ + => .(muc (dec muc)) + [(cut 4 [muc 1] raw) $(raw (end 4 muc raw))] + =+ day=(div sec day:yo) + => .(sec (mod sec day:yo)) + =+ hor=(div sec hor:yo) + => .(sec (mod sec hor:yo)) + =+ mit=(div sec mit:yo) + => .(sec (mod sec mit:yo)) + [day hor mit sec fan] +:: +++ yule + |= rip=tarp + ^- @d + =+ ^= sec ;: add + (mul d.rip day:yo) + (mul h.rip hor:yo) + (mul m.rip mit:yo) + s.rip + == + =+ ^= fac =+ muc=4 + |- ^- @ + ?~ f.rip + 0 + => .(muc (dec muc)) + (add (lsh 4 muc i.f.rip) $(f.rip t.f.rip)) + (con (lsh 6 1 sec) fac) +:: +++ yall + |= day=@ud + ^- [y=@ud m=@ud d=@ud] + =+ [era=0 cet=0 lep=?] + => .(era (div day era:yo), day (mod day era:yo)) + => ^+ . + ?: (lth day +(cet:yo)) + .(lep &, cet 0) + => .(lep |, cet 1, day (sub day +(cet:yo))) + .(cet (add cet (div day cet:yo)), day (mod day cet:yo)) + =+ yer=(add (mul 400 era) (mul 100 cet)) + |- ^- [y=@ud m=@ud d=@ud] + =+ dis=?:(lep 366 365) + ?. (lth day dis) + =+ ner=+(yer) + $(yer ner, day (sub day dis), lep =(0 (end 0 2 ner))) + |- ^- [y=@ud m=@ud d=@ud] + =+ [mot=0 cah=?:(lep moy:yo moh:yo)] + |- ^- [y=@ud m=@ud d=@ud] + =+ zis=(snag mot cah) + ?: (lth day zis) + [yer +(mot) +(day)] + $(mot +(mot), day (sub day zis)) +:: +++ yawn + |= [yer=@ud mot=@ud day=@ud] + ^- @ud + => .(mot (dec mot), day (dec day)) + => ^+ . + %= . + day + =+ cah=?:((yelp yer) moy:yo moh:yo) + |- ^- @ud + ?: =(0 mot) + day + $(mot (dec mot), cah (slag 1 cah), day (add day (snag 0 cah))) + == + |- ^- @ud + ?. =(0 (mod yer 4)) + =+ ney=(dec yer) + $(yer ney, day (add day ?:((yelp ney) 366 365))) + ?. =(0 (mod yer 100)) + $(yer (sub yer 4), day (add day 1.461)) + ?. =(0 (mod yer 400)) + $(yer (sub yer 100), day (add day 36.524)) + (add day (mul (div yer 400) (add 1 (mul 4 36.524)))) +:: +++ yelp + |= yer=@ud ^- ? + &(=(0 (mod yer 4)) |(!=(0 (mod yer 100)) =(0 (mod yer 400)))) +:: +++ yo + |% ++ cet 36.524 :: (add 24 (mul 100 365)) + ++ day 86.400 :: (mul 24 hor) + ++ era 146.097 :: (add 1 (mul 4 cet)) + ++ hor 3.600 :: (mul 60 mit) + ++ jes 106.751.991.084.417 :: (mul 730.692.561 era) + ++ mit 60 + ++ moh `(list ,@ud)`[31 28 31 30 31 30 31 31 30 31 30 31 ~] + ++ moy `(list ,@ud)`[31 29 31 30 31 30 31 31 30 31 30 31 ~] + ++ qad 126.144.001 :: (add 1 (mul 4 yer)) + ++ yer 31.536.000 :: (mul 365 day) + -- +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2cI, almost macros :: +:: +++ hard + |* han=_|+(* *) + |= fud=* ^- han + ~| %hard + =+ gol=(han fud) + ?>(=(gol fud) gol) +:: +++ soft + |* han=_|+(* *) + |= fud=* ^- (unit han) + =+ gol=(han fud) + ?.(=(gol fud) ~ [~ gol]) + :::::::::::::::::::::::::::::::::::::::::::::::::::::: :: +:::: chapter 2d, containers :::: +:: :::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2dA, sets :: +:: +++ apt :: set invariant + |= a=(tree) + ?@ a + & + ?& ?@(l.a & ?&((vor n.a n.l.a) (hor n.l.a n.a))) + ?@(r.a & ?&((vor n.a n.r.a) (hor n.a n.r.a))) + == +:: +++ in :: set engine + ~/ %in + |_ a=(set) + +- all + ~/ %all + |* b=_|=(* ?) + |- ^- ? + ?@ a + & + ?&((b n.a) $(a l.a) $(a r.a)) + :: + +- any + ~/ %any + |* b=_|=(* ?) + |- ^- ? + ?@ a + | + ?|((b n.a) $(a l.a) $(a r.a)) + :: + +- del + ~/ %del + |* b=* + |- ^+ a + ?~ a + ~ + ?. =(b n.a) + ?: (hor b n.a) + [n.a $(a l.a) r.a] + [n.a l.a $(a r.a)] + |- ^- ?(~ _a) + ?~ l.a r.a + ?~ r.a l.a + ?: (vor n.l.a n.r.a) + [n.l.a l.l.a $(l.a r.l.a)] + [n.r.a $(r.a l.r.a) r.r.a] + :: + ++ dig + |= b=* + =+ c=1 + |- ^- (unit ,@) + ?~ a ~ + ?: =(b n.a) [~ u=(peg c 2)] + ?: (gor b n.a) + $(a l.a, c (peg c 6)) + $(a r.a, c (peg c 7)) + :: + +- gas + ~/ %gas + |= b=(list _?>(?=(^ a) n.a)) + |- ^+ a + ?@ b + a + $(b t.b, a (put i.b)) + :: + +- has + ~/ %has + |* b=* + |- ^- ? + ?@ a + | + ?: =(b n.a) + & + ?: (hor b n.a) + $(a l.a) + $(a r.a) + :: + +- put + ~/ %put + |* b=* + |- ^+ a + ?@ a + [b ~ ~] + ?: =(b n.a) + a + ?: (hor b n.a) + =+ c=$(a l.a) + ?> ?=(^ c) + ?: (vor n.a n.c) + [n.a c r.a] + [n.c l.c [n.a r.c r.a]] + =+ c=$(a r.a) + ?> ?=(^ c) + ?: (vor n.a n.c) + [n.a l.a c] + [n.c [n.a l.a l.c] r.c] + :: + +- rep + |* [b=* c=_,*] + |- + ?~ a b + $(a r.a, b $(a l.a, b (c n.a b))) + :: + +- tap + ~/ %tap + |= b=(list _?>(?=(^ a) n.a)) + ^+ b + ?@ a + b + $(a r.a, b [n.a $(a l.a)]) + :: + +- wyt + .+ + |- ^- @ + ?~(a 0 +((add $(a l.a) $(a r.a)))) + -- +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2dB, maps :: +:: +++ ept :: map invariant + |= a=(tree ,[p=* q=*]) + ?@ a + & + ?& ?@(l.a & ?&((vor p.n.a p.n.l.a) (hor p.n.l.a p.n.a))) + ?@(r.a & ?&((vor p.n.a p.n.r.a) (hor p.n.a p.n.r.a))) + == +:: +++ by :: map engine + ~/ %by + |_ a=(map) + +- all + ~/ %all + |* b=_|=(* ?) + |- ^- ? + ?@ a + & + ?&((b q.n.a) $(a l.a) $(a r.a)) + :: + +- any + ~/ %any + |* b=_|=(* ?) + |- ^- ? + ?@ a + | + ?|((b q.n.a) $(a l.a) $(a r.a)) + :: + +- del + ~/ %del + |* b=* + |- ^+ a + ?~ a + ~ + ?. =(b p.n.a) + ?: (gor b p.n.a) + [n.a $(a l.a) r.a] + [n.a l.a $(a r.a)] + |- ^- ?(~ _a) + ?~ l.a r.a + ?~ r.a l.a + ?: (vor p.n.l.a p.n.r.a) + [n.l.a l.l.a $(l.a r.l.a)] + [n.r.a $(r.a l.r.a) r.r.a] + :: + ++ dig + |= b=* + =+ c=1 + |- ^- (unit ,@) + ?~ a ~ + ?: =(b p.n.a) [~ u=(peg c 2)] + ?: (gor b p.n.a) + $(a l.a, c (peg c 6)) + $(a r.a, c (peg c 7)) + :: + +- gas + ~/ %gas + |* b=(list ,[p=* q=*]) + => .(b `(list _?>(?=(^ a) n.a))`b) + |- ^+ a + ?@ b + a + $(b t.b, a (put p.i.b q.i.b)) + :: + +- get + ~/ %get + |* b=* + |- ^- ?(~ [~ u=_?>(?=(^ a) q.n.a)]) + ?@ a + ~ + ?: =(b p.n.a) + [~ u=q.n.a] + ?: (gor b p.n.a) + $(a l.a) + $(a r.a) + :: + +- has + ~/ %has + |* b=* + !=(~ (get b)) + :: + +- mar + |* [b=_?>(?=(^ a) p.n.a) c=(unit _?>(?=(^ a) q.n.a))] + ?~ c + (del b) + (put b u.c) + :: + +- put + ~/ %put + |* [b=* c=*] + |- ^+ a + ?@ a + [[b c] ~ ~] + ?: =(b p.n.a) + ?: =(c q.n.a) + a + [[b c] l.a r.a] + ?: (gor b p.n.a) + =+ d=$(a l.a) + ?> ?=(^ d) + ?: (vor p.n.a p.n.d) + [n.a d r.a] + [n.d l.d [n.a r.d r.a]] + =+ d=$(a r.a) + ?> ?=(^ d) + ?: (vor p.n.a p.n.d) + [n.a l.a d] + [n.d [n.a l.a l.d] r.d] + :: + +- rep + |* [b=* c=_,*] + |- + ?~ a b + $(a r.a, b $(a l.a, b (c n.a b))) + :: + +- rib + |* [b=* c=_,*] + |- ^+ [b a] + ?~ a [b ~] + =+ d=(c n.a b) + =. n.a +.d + =+ e=$(a l.a, b -.d) + =+ f=$(a r.a, b -.e) + [-.f [n.a +.e +.f]] + :: + +- run + |* b=_,* + |- + ?~ a a + [[p.n.a (b q.n.a)] $(a l.a) $(a r.a)] + :: + +- tap + ~/ %tap + |= b=(list _?>(?=(^ a) n.a)) + ^+ b + ?@ a + b + $(a r.a, b [n.a $(a l.a)]) + :: + +- wyt + .+ + |- ^- @ + ?~(a 0 +((add $(a l.a) $(a r.a)))) + -- +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2dC, queues :: +:: +++ to :: queue engine + |_ a=(qeu) + +- bal + |- ^+ a + ?. |(?=(~ l.a) (vor n.a n.l.a)) + $(a [n.l.a l.l.a $(a [n.a r.l.a r.a])]) + ?. |(?=(~ r.a) (vor n.a n.r.a)) + $(a [n.r.a $(a [n.a l.a l.r.a]) r.r.a]) + a + :: + +- dep + |- ^- @ + ?~ a 0 + +((max $(a l.a) $(a r.a))) + :: + +- gas + |= b=(list _?>(?=(^ a) n.a)) + |- ^+ a + ?~(b a $(b t.b, a (put i.b))) + :: + +- get + |- ^+ [p=?>(?=(^ a) n.a) q=a] + ?~ a + !! + ?~ r.a + [n.a l.a] + =+ b=$(a r.a) + :- p.b + ?: |(?=(~ q.b) (vor n.a n.q.b)) + [n.a l.a q.b] + [n.q.b [n.a l.a l.q.b] r.q.b] + :: + +- nap + ?> ?=(^ a) + ?: =(~ l.a) r.a + =+ b=get(a l.a) + bal(a ^+(a [p.b q.b r.a])) + :: + +- put + |* b=* + |- ^+ a + ?~ a + [b ~ ~] + bal(l.a $(a l.a)) + :: + +- tap + |= b=(list _?>(?=(^ a) n.a)) + ^+ b + ?~ a + b + $(a r.a, b [n.a $(a l.a)]) + :: + +- top + |- ^- (unit _?>(?=(^ a) n.a)) + ?~ a ~ + ?~(r.a [~ n.a] $(a r.a)) + -- +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2dD, casual containers :: +:: +++ mo :: make a map + |* a=(list) + => .(a `_(homo a)`a) + => .(a `(list ,[p=_-<.a q=_->.a])`a) + =+ b=*(map _?>(?=(^ a) p.i.a) _?>(?=(^ a) q.i.a)) + (~(gas by b) a) +:: +++ sa :: make a set + |* a=(list) + => .(a `_(homo a)`a) + =+ b=*(set _?>(?=(^ a) i.a)) + (~(gas in b) a) + :::::::::::::::::::::::::::::::::::::::::::::::::::::: :: +:::: chapter 2e, miscellaneous libs :::: +:: :::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2eA, packing :: +:: +++ cue :: unpack + ~/ %cue + |= a=@ + ^- * + =+ b=0 + =+ m=`(map ,@ ,*)`~ + =< q + |- ^- [p=@ q=* r=_m] + ?: =(0 (cut 0 [b 1] a)) + =+ c=(rub +(b) a) + [+(p.c) q.c (~(put by m) b q.c)] + =+ c=(add 2 b) + ?: =(0 (cut 0 [+(b) 1] a)) + =+ u=$(b c) + =+ v=$(b (add p.u c), m r.u) + =+ w=[q.u q.v] + [(add 2 (add p.u p.v)) w (~(put by r.v) b w)] + =+ d=(rub c a) + [(add 2 p.d) (need (~(get by m) q.d)) m] +:: +++ jam :: pack + ~/ %jam + |= a=* + ^- @ + =+ b=0 + =+ m=`(map ,* ,@)`~ + =< q + |- ^- [p=@ q=@ r=_m] + =+ c=(~(get by m) a) + ?@ c + => .(m (~(put by m) a b)) + ?: ?=(@ a) + =+ d=(mat a) + [(add 1 p.d) (lsh 0 1 q.d) m] + => .(b (add 2 b)) + =+ d=$(a -.a) + =+ e=$(a +.a, b (add b p.d), m r.d) + [(add 2 (add p.d p.e)) (mix 1 (lsh 0 2 (cat 0 q.d q.e))) r.e] + ?: ?&(?=(@ a) (lte (met 0 a) (met 0 u.c))) + =+ d=(mat a) + [(add 1 p.d) (lsh 0 1 q.d) m] + =+ d=(mat u.c) + [(add 2 p.d) (mix 3 (lsh 0 2 q.d)) m] +:: +++ mat :: length-encode + ~/ %mat + |= a=@ + ^- [p=@ q=@] + ?: =(0 a) + [1 1] + =+ b=(met 0 a) + =+ c=(met 0 b) + :- (add (add c c) b) + (cat 0 (bex c) (mix (end 0 (dec c) b) (lsh 0 (dec c) a))) +:: +++ rub :: length-decode + ~/ %rub + |= [a=@ b=@] + ^- [p=@ q=@] + =+ c==+(c=0 |-(?.(=(0 (cut 0 [(add a c) 1] b)) c $(c +(c))))) + ?: =(0 c) + [1 0] + =+ d=(add a +(c)) + =+ e=(add (bex (dec c)) (cut 0 [d (dec c)] b)) + [(add (add c c) e) (cut 0 [(add d (dec c)) e] b)] +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2eB, parsing (tracing) :: +:: +++ last |= [zyc=hair naz=hair] + ^- hair + ?: =(p.zyc p.naz) + ?:((gth q.zyc q.naz) zyc naz) + ?:((gth p.zyc p.naz) zyc naz) +:: +++ lust |= [weq=char naz=hair] + ^- hair + ?:(=(10 weq) [+(p.naz) 1] [p.naz +(q.naz)]) +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2eC, parsing (custom rules) :: +:: +++ cold + ~/ %cold + |* [cus=* sef=_rule] + ~/ %fun + |= tub=nail + =+ vex=(sef tub) + ?@ q.vex + vex + [p=p.vex q=[~ u=[p=cus q=q.u.q.vex]]] +:: +++ cook + ~/ %cook + |* [poq=_,* sef=_rule] + ~/ %fun + |= tub=nail + =+ vex=(sef tub) + ?@ q.vex + vex + [p=p.vex q=[~ u=[p=(poq p.u.q.vex) q=q.u.q.vex]]] +:: +++ easy + ~/ %easy + |* huf=* + ~/ %fun + |= tub=nail + ^- (like _huf) + [p=p.tub q=[~ u=[p=huf q=tub]]] +:: +++ fail |=(tub=nail [p=p.tub q=~]) +++ full + |* sef=_rule + |= tub=nail + =+ vex=(sef tub) + ?@(q.vex vex ?:(=(~ q.q.u.q.vex) vex [p=p.vex q=~])) +:: +++ funk + |* [pre=tape sef=_rule] + |= tub=nail + (sef p.tub (weld pre q.tub)) +:: +++ here + ~/ %here + |* [hez=_|=([a=pint b=*] [a b]) sef=_rule] + ~/ %fun + |= tub=nail + =+ vex=(sef tub) + ?@ q.vex + vex + [p=p.vex q=[~ u=[p=(hez [p.tub p.q.u.q.vex] p.u.q.vex) q=q.u.q.vex]]] +:: +++ jest + |= daf=@t + |= tub=nail + =+ fad=daf + |- ^- (like ,@t) + ?: =(0 daf) + [p=p.tub q=[~ u=[p=fad q=tub]]] + ?: |(?=(~ q.tub) !=((end 3 1 daf) i.q.tub)) + (fail tub) + $(p.tub (lust i.q.tub p.tub), q.tub t.q.tub, daf (rsh 3 1 daf)) +:: +++ just :: XX redundant, jest + ~/ %just + |= daf=char + ~/ %fun + |= tub=nail + ^- (like char) + ?@ q.tub + (fail tub) + ?. =(daf i.q.tub) + (fail tub) + (next tub) +:: +++ knee + |* [gar=* sef=_|.(rule)] + |= tub=nail + ^- (like _gar) + ((sef) tub) +:: +++ mask + ~/ %mask + |= bud=(list char) + ~/ %fun + |= tub=nail + ^- (like char) + ?@ q.tub + (fail tub) + ?. (lien bud |=(a=char =(i.q.tub a))) + (fail tub) + (next tub) +:: +++ next + |= tub=nail + ^- (like char) + ?@ q.tub + (fail tub) + =+ zac=(lust i.q.tub p.tub) + [zac [~ i.q.tub [zac t.q.tub]]] +:: +++ sear + ~/ %sear + |* [pyq=_|=(* *(unit)) sef=_rule] + ~/ %fun + |= tub=nail + =+ vex=(sef tub) + ?@ q.vex + vex + =+ gey=(pyq p.u.q.vex) + ?@ gey + [p=p.vex q=~] + [p=p.vex q=[~ u=[p=u.gey q=q.u.q.vex]]] +:: +++ shim + ~/ %shim + |= zep=[p=@ q=@] + ~/ %fun + |= tub=nail + ^- (like char) + ?@ q.tub + (fail tub) + ?. ?&((gte i.q.tub p.zep) (lte i.q.tub q.zep)) + (fail tub) + (next tub) +:: +++ stag + ~/ %stag + |* [gob=* sef=_rule] + ~/ %fun + |= tub=nail + =+ vex=(sef tub) + ?@ q.vex + vex + [p=p.vex q=[~ u=[p=[gob p.u.q.vex] q=q.u.q.vex]]] +:: +++ stew + ~/ %stew + |* leh=(list ,[p=?(@ [@ @]) q=_rule]) + => .(leh `_(homo leh)`leh) + =+ ^= wor + |= [ort=?(@ [@ @]) wan=?(@ [@ @])] + ?@ ort + ?@(wan (lth ort wan) (lth ort -.wan)) + ?@(wan (lth +.ort wan) (lth +.ort -.wan)) + =+ ^= hel + =+ hel=`(tree $_(?>(?=(^ leh) i.leh)))`~ + |- ^+ hel + ?~ leh + ~ + =+ yal=$(leh t.leh) + |- ^+ hel + ?~ yal + [i.leh ~ ~] + ?: (wor p.i.leh p.n.yal) + =+ nuc=$(yal l.yal) + ?> ?=(^ nuc) + ?: (vor p.n.yal p.n.nuc) + [n.yal nuc r.yal] + [n.nuc l.nuc [n.yal r.nuc r.yal]] + =+ nuc=$(yal r.yal) + ?> ?=(^ nuc) + ?: (vor p.n.yal p.n.nuc) + [n.yal l.yal nuc] + [n.nuc [n.yal l.yal l.nuc] r.nuc] + ~% %fun ..^$ ~ + |= tub=nail + ?@ q.tub + (fail tub) + |- + ?@ hel + (fail tub) + ?: ?@ p.n.hel + =(p.n.hel i.q.tub) + ?&((gte i.q.tub -.p.n.hel) (lte i.q.tub +.p.n.hel)) + :: (q.n.hel [(lust i.q.tub p.tub) t.q.tub]) + (q.n.hel tub) + ?: (wor i.q.tub p.n.hel) + $(hel l.hel) + $(hel r.hel) +:: +++ stir + ~/ %stir + |* [rud=* raq=_|*([a=* b=*] [a b]) fel=_rule] + ~/ %fun + |= tub=nail + ^- (like _rud) + =+ vex=(fel tub) + ?@ q.vex + [p.vex [~ rud tub]] + =+ wag=$(tub q.u.q.vex) + ?> ?=(^ q.wag) + [(last p.vex p.wag) [~ (raq p.u.q.vex p.u.q.wag) q.u.q.wag]] +:: +++ stun + ~/ %stun + |* [[les=@ mos=@] fel=_rule] + ~/ %fun + |= tub=nail + ^- (like (list _(wonk (fel)))) + ?: =(0 mos) + [p.tub [~ ~ tub]] + =+ vex=(fel tub) + ?@ q.vex + ?: =(0 les) + [p.vex [~ ~ tub]] + vex + =+ ^= wag %= $ + les ?:(=(0 les) 0 (dec les)) + mos ?:(=(0 mos) 0 (dec mos)) + tub q.u.q.vex + == + ?@ q.wag + wag + [p.wag [~ [p.u.q.vex p.u.q.wag] q.u.q.wag]] +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2eD, parsing (combinators) :: +:: +++ bend + ~/ %bend + |* raq=_|*([a=* b=*] [~ u=[a b]]) + ~/ %fun + |* [vex=edge sab=_rule] + ?@ q.vex + vex + =+ yit=(sab q.u.q.vex) + =+ yur=(last p.vex p.yit) + ?@ q.yit + [p=yur q=q.vex] + =+ vux=(raq p.u.q.vex p.u.q.yit) + ?~ vux + [p=yur q=q.vex] + [p=yur q=[~ u=[p=u.vux q=q.u.q.yit]]] +:: +++ comp + ~/ %comp + |* raq=_|*([a=* b=*] [a b]) + ~/ %fun + |* [vex=edge sab=_rule] + ?@ q.vex + vex + =+ yit=(sab q.u.q.vex) + =+ yur=(last p.vex p.yit) + ?@ q.yit + [p=yur q=q.yit] + [p=yur q=[~ u=[p=(raq p.u.q.vex p.u.q.yit) q=q.u.q.yit]]] +:: +++ glue + ~/ %glue + |* bus=_rule + ~/ %fun + |* [vex=edge sab=_rule] + (plug vex ;~(pfix bus sab)) +:: +++ pfix + ~/ %pfix + |* [vex=edge sab=_rule] + ?@ q.vex + vex + =+ yit=(sab q.u.q.vex) + [p=(last p.yit p.vex) q=q.yit] +:: +++ plug + ~/ %plug + |* [vex=edge sab=_rule] + ?@ q.vex + vex + =+ yit=(sab q.u.q.vex) + =+ yur=(last p.vex p.yit) + ?@ q.yit + [p=yur q=q.yit] + [p=yur q=[~ u=[p=[p.u.q.vex p.u.q.yit] q=q.u.q.yit]]] +:: +++ pose + ~/ %pose + |* [vex=edge sab=_rule] + ?@ q.vex + =+ roq=(sab) + [p=(last p.vex p.roq) q=q.roq] + vex +:: +++ sfix + ~/ %sfix + |* [vex=edge sab=_rule] + ?@ q.vex + vex + =+ yit=(sab q.u.q.vex) + [p=(last p.vex p.yit) q=?@(q.yit ~ [~ u=[p=p.u.q.vex q=q.u.q.yit]])] +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2eE, parsing (composers) :: +:: +++ bass + |* [wuc=@ tyd=_rule] + %+ cook + |= waq=(list ,@) + %+ roll + waq + =+([p=@ q=@] |.((add p (mul wuc q)))) + tyd +:: +++ boss + |* [wuc=@ tyd=_rule] + %+ cook + |= waq=(list ,@) + %+ reel + waq + =+([p=@ q=@] |.((add p (mul wuc q)))) + tyd +:: +++ ifix + |* [fel=[p=_rule q=_rule] hof=_rule] + ;~(pfix p.fel ;~(sfix hof q.fel)) +:: +++ more + |* [bus=_rule fel=_rule] + ;~(pose (most bus fel) (easy ~)) +:: +++ most + |* [bus=_rule fel=_rule] + ;~(plug fel (star ;~(pfix bus fel))) +:: +++ plus |*(fel=_rule ;~(plug fel (star fel))) +++ slug + |* [rud=* raq=_|*([a=* b=*] [a b])] + |* [bus=_rule fel=_rule] + ;~((comp raq) fel (stir rud raq ;~(pfix bus fel))) +:: +++ star + |* fel=_rule + (stir `(list _(wonk *fel))`~ |*([a=* b=*] [a b]) fel) +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2eF, parsing (ascii) :: +:: +++ ace (just ' ') +++ bar (just '|') +++ bas (just '\\') +++ buc (just '$') +++ cab (just '_') +++ cen (just '%') +++ col (just ':') +++ com (just ',') +++ doq (just '"') +++ dot (just '.') +++ fas (just '/') +++ gal (just '<') +++ gar (just '>') +++ hax (just '#') +++ kel (just '{') +++ ker (just '}') +++ ket (just '^') +++ lus (just '+') +++ hep (just '-') +++ pel (just '(') +++ pam (just '&') +++ per (just ')') +++ pat (just '@') +++ sel (just '[') +++ sem (just ';') +++ ser (just ']') +++ sig (just '~') +++ soq (just '\'') +++ tar (just '*') +++ tec (just '`') +++ tis (just '=') +++ wut (just '?') +++ zap (just '!') +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2eG, parsing (whitespace) :: +:: +++ dog ;~(plug dot gay) +++ doh ;~(plug ;~(plug hep hep) gay) +++ dun (cold ~ ;~(plug hep hep)) +++ duq (cold ~ ;~(plug tis hep)) +++ duz (cold ~ ;~(plug tis tis)) +++ gap (cold ~ (plus ;~(pose vul (mask [^-(@ 10) ' ' ~])))) +++ gay ;~(pose gap (easy ~)) +++ vul (cold ~ ;~(plug col col (star (shim 32 126)) (just ^-(@ 10)))) +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2eH, parsing (idioms) :: +:: +++ alf ;~(pose low hig) +++ aln ;~(pose low hig nud) +++ alp ;~(pose low hig nud hep) +++ bet ;~(pose (cold 2 hep) (cold 3 lus)) +++ bin (bass 2 (most gon but)) +++ but (cook |=(a=@ (sub a '0')) (shim '0' '1')) +++ dem (bass 10 (most gon dit)) +++ dit (cook |=(a=@ (sub a '0')) (shim '0' '9')) +++ gul ;~(pose (cold 2 gal) (cold 3 gar)) +++ gon ;~(pose ;~(plug bas gay fas) (easy ~)) +++ hex (bass 16 (most gon hit)) +++ hig (shim 'A' 'Z') +++ hit ;~ pose + dit + (cook |=(a=char (sub a 87)) (shim 'a' 'f')) + (cook |=(a=char (sub a 55)) (shim 'A' 'F')) + == +++ low (shim 'a' 'z') +++ mes (cook |=([a=@ b=@] (add (mul 16 a) b)) ;~(plug hit hit)) +++ nix (boss 256 (star ;~(pose aln cab))) +++ nud (shim '0' '9') +++ poy ;~(pfix bas ;~(pose bas soq mes)) +++ qit ;~(pose (shim 32 38) (shim 40 91) (shim 93 126) (shim 128 255) poy) +++ qut (ifix [soq soq] (boss 256 (more gon qit))) +++ sym + %+ cook + |=(a=tape (rap 3 ^-((list ,@) a))) + ;~(plug low (star ;~(pose nud low hep))) +:: +++ ven ;~ (comp |=([a=@ b=@] (peg a b))) + bet + =+ hom=`?`| + |= tub=nail + ^- (like axis) + =+ vex=?:(hom (bet tub) (gul tub)) + ?@ q.vex + [p.tub [~ 1 tub]] + =+ wag=$(p.tub p.vex, hom !hom, tub q.u.q.vex) + ?> ?=(^ q.wag) + [p.wag [~ (peg p.u.q.vex p.u.q.wag) q.u.q.wag]] + == +++ vit + ;~ pose + (cook |=(a=@ (sub a 65)) (shim 'A' 'Z')) + (cook |=(a=@ (sub a 71)) (shim 'a' 'z')) + (cook |=(a=@ (add a 4)) (shim '0' '9')) + (cold 62 (just '-')) + (cold 63 (just '+')) + == +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2eI, parsing (external) :: +:: +++ rash |*([naf=@ sab=_rule] (scan (trip naf) sab)) +++ rush |* [naf=@ sab=_rule] + =+ vex=((full sab) [[1 1] (trip naf)]) + ?~(q.vex ~ [~ u=p.u.q.vex]) +++ scan |* [los=tape sab=_rule] + =+ vex=((full sab) [[1 1] los]) + ?@ q.vex + ~! (show [%m '{%d %d}'] p.p.vex q.p.vex ~) + ~|('scan-stop' !!) + p.u.q.vex +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2eJ, formatting (basic text) :: +:: +++ cass :: case-insensitive + |= vib=tape + %+ rap 3 + (turn vib |=(a=@ ?.(&((gte a 'A') (lte a 'Z')) a (add 32 a)))) +:: +++ crip |=(a=tape `@t`(rap 3 a)) +++ mesc + |= vib=tape + ^- tape + ?@ vib + ~ + ?: =('\\' i.vib) + ['\\' '\\' $(vib t.vib)] + ?: ?|((gth i.vib 126) (lth i.vib 32) =(39 i.vib)) + ['\\' (weld ~(rux at i.vib) (runt [1 47] $(vib t.vib)))] + [i.vib $(vib t.vib)] +:: +++ runt + |= [[a=@ b=@] c=tape] + ^- tape + ?: =(0 a) + c + [b $(a (dec a))] +:: +++ sand :: atom sanity + |= a=@ta + |= b=@ ^- (unit ,@) + ?.(((sane a) b) ~ [~ b]) +:: +++ sane :: atom sanity + |= a=@ta + |= b=@ ^- ? + ?. =(%t (end 3 1 a)) + ~|(%sane-stub !!) + =+ [inx=0 len=(met 3 b)] + ?: =(%tas a) + |- ^- ? + ?: =(inx len) & + =+ cur=(cut 3 [inx 1] b) + ?& ?| &((gte cur 'a') (lte cur 'z')) + &(=('-' cur) !=(0 inx) !=(len inx)) + == + $(inx +(inx)) + == + ?: =(%ta a) + |- ^- ? + ?: =(inx len) & + =+ cur=(cut 3 [inx 1] b) + ?& ?| &((gte cur 'a') (lte cur 'z')) + &((gte cur 'A') (lte cur 'Z')) + |(=('-' cur) =('~' cur) =('_' cur) =('.' cur)) + == + $(inx +(inx)) + == + |- ^- ? + ?: =(0 b) & + =+ cur=(end 3 1 b) + ?: &((lth cur 32) !=(10 cur)) | + =+ len=(teff cur) + ?& |(=(1 len) =+(i=1 |-(|(=(i len) &((gte (cut 3 [i 1] b) 128) $(i +(i))))))) + $(b (rsh 3 len b)) + == +:: +++ trim + |= [a=@ b=tape] + ^- [p=tape q=tape] + ?@ b + [~ ~] + ?: =(0 a) + [~ b] + =+ c=$(a (dec a), b t.b) + [[i.b p.c] q.c] +:: +++ trip + ~/ %trip + |= a=@ ^- tape + ?: =(0 (met 3 a)) + ~ + [^-(@ta (end 3 1 a)) $(a (rsh 3 1 a))] +:: +++ teff :: length utf8 + |= a=@t ^- @ + =+ b=(end 3 1 a) + ?: =(0 b) + ?>(=(0 a) 0) + ?> |((gte b 32) =(10 b)) + ?:((lte b 127) 1 ?:((lte b 223) 2 ?:((lte b 239) 3 4))) +:: +++ turf :: utf8 to utf32 + |= a=@t + ^- @c + %+ rap 5 + |- ^- (list ,@c) + =+ b=(teff a) + ?: =(0 b) ~ + :- %+ can 0 + %+ turn + ^- (list ,[p=@ q=@]) + ?+ b !! + 1 [[0 7] ~] + 2 [[8 6] [0 5] ~] + 3 [[16 6] [8 6] [0 4] ~] + 4 [[24 6] [16 6] [8 6] [0 3] ~] + == + |=([p=@ q=@] [q (cut 0 [p q] a)]) + $(a (rsh 3 b a)) +:: +++ tuba :: utf8 to utf32 tape + |= a=tape + ^- (list ,@c) + (rip 5 (turf (rap 3 a))) :: XX horrible +:: +++ tufa :: utf32 to utf8 tape + |= a=(list ,@c) + ^- tape + ?~ a "" + (weld (rip 3 (tuft i.a)) $(a t.a)) +:: +++ tuft :: utf32 to utf8 text + |= a=@c + ^- @t + %+ rap 3 + |- ^- (list ,@) + ?: =(0 a) + ~ + =+ b=(end 5 1 a) + =+ c=$(a (rsh 5 1 a)) + ?: (lth b 0x7f) + [b c] + ?: (lth b 0x7ff) + :* (mix 0b1100.0000 (cut 0 [6 5] b)) + (mix 0b1000.0000 (end 0 6 b)) + c + == + ?: (lth b 0xffff) + :* (mix 0b1110.0000 (cut 0 [12 4] b)) + (mix 0b1000.0000 (cut 0 [6 6] b)) + (mix 0b1000.0000 (end 0 6 b)) + c + == + :* (mix 0b1111.0000 (cut 0 [18 3] b)) + (mix 0b1000.0000 (cut 0 [12 6] b)) + (mix 0b1000.0000 (cut 0 [6 6] b)) + (mix 0b1000.0000 (end 0 6 b)) + c + == +:: +++ wack + |= a=@ta + ^- @ta + =+ b=(rip 3 a) + %+ rap 3 + |- ^- tape + ?~ b + ~ + ?: =('~' i.b) ['~' '~' $(b t.b)] + ?: =('_' i.b) ['~' '-' $(b t.b)] + [i.b $(b t.b)] +:: +++ wick + |= a=@ + ^- @ta + =+ b=(rip 3 a) + %+ rap 3 + |- ^- tape + ?~ b + ~ + ?: =('~' i.b) + ?~ t.b !! + [?:(=('~' i.t.b) '~' ?>(=('-' i.t.b) '_')) $(b t.t.b)] + [i.b $(b t.b)] +:: +++ woad + |= a=@ta + ^- @t + %+ rap 3 + |- ^- (list ,@) + ?: =(0 a) + ~ + =+ b=(end 3 1 a) + =+ c=(rsh 3 1 a) + ?: =('.' b) + [' ' $(a c)] + ?. =('~' b) + [b $(a c)] + => .(b (end 3 1 c), c (rsh 3 1 c)) + ?+ b =- (weld (rip 3 (tuft p.d)) $(a q.d)) + ^= d + =+ d=0 + |- ^- [p=@ q=@] + ?< =(0 c) + =+ [e=(end 3 1 c) f=(rsh 3 1 c)] + ?: =('.' e) + [d f] + %= $ + c f + d %+ add + (mul 16 d) + %+ sub + e + ?: &((gte e '0') (lte e '9')) + 48 + ?>(&((gte e 'a') (lte e 'z')) 87) + == + '.' ['.' $(a c)] + '~' ['~' $(a c)] + == +:: +++ wood + |= a=@t + ^- @ta + %+ rap 3 + |- ^- (list ,@) + ?: =(0 a) + ~ + =+ b=(teff a) + =+ c=(turf (end 3 b a)) + =+ d=$(a (rsh 3 b a)) + ?: ?| &((gte c 'a') (lte c 'z')) + &((gte c 'A') (lte c 'Z')) + &((gte c '0') (lte c '9')) + =('-' c) + == + [c d] + ?+ c :- '~' + |- ^- tape + ?: =(0 c) + ['.' d] + =+ e=(dec (met 2 c)) + =+ f=(rsh 2 e c) + [(add ?:((lte f 9) 48 87) f) $(c (end 2 e a))] + ' ' ['.' d] + '.' ['~' '.' d] + '~' ['~' '~' d] + == +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2eK, formatting (layout) :: +:: +++ re + |_ tac=tank + ++ ram + ^- tape + ?- -.tac + %leaf p.tac + %palm ram(tac [%rose [p.p.tac (weld q.p.tac r.p.tac) s.p.tac] q.tac]) + %rose + %+ weld + q.p.tac + |- ^- tape + ?@ q.tac + r.p.tac + =+ voz=$(q.tac t.q.tac) + (weld ram(tac i.q.tac) ?@(t.q.tac voz (weld p.p.tac voz))) + == + :: + ++ win + |= [tab=@ edg=@] + =+ lug=`wall`~ + |^ |- ^- wall + ?- -.tac + %leaf (rig p.tac) + %palm + ?: fit + (rig ram) + ?@ q.tac + (rig q.p.tac) + ?@ t.q.tac + (rig(tab (add 2 tab), lug $(tac i.q.tac)) q.p.tac) + => .(q.tac `(list tank)`q.tac) + =+ lyn=(mul 2 (lent q.tac)) + =+ ^= qyr + |- ^- wall + ?@ q.tac + lug + %= ^$ + tac i.q.tac + tab (add tab (sub lyn 2)) + lug $(q.tac t.q.tac, lyn (sub lyn 2)) + == + (wig(lug qyr) q.p.tac) + :: + %rose + ?: fit + (rig ram) + =+ ^= gyl + |- ^- wall + ?@ q.tac + ?:(=(%$ r.p.tac) lug (rig r.p.tac)) + ^$(tac i.q.tac, lug $(q.tac t.q.tac), tab din) + ?: =(%$ q.p.tac) + gyl + (wig(lug gyl) q.p.tac) + == + :: + ++ din (mod (add 2 tab) (mul 2 (div edg 3))) + ++ fit (lte (lent ram) (sub edg tab)) + ++ rig + |= hom=tape + ^- wall + ?: (lte (lent hom) (sub edg tab)) + [(runt [tab ' '] hom) lug] + => .(tab (add tab 2), edg (sub edg 2)) + =+ mut=(trim (sub edg tab) hom) + :- (runt [(sub tab 2) ' '] ['\\' '/' (weld p.mut `_hom`['\\' '/' ~])]) + => .(hom q.mut) + |- + ?@ hom + :- %+ runt + [(sub tab 2) ' '] + ['\\' '/' (runt [(sub edg tab) ' '] ['\\' '/' ~])] + lug + => .(mut (trim (sub edg tab) hom)) + [(runt [tab ' '] p.mut) $(hom q.mut)] + :: + ++ wig + |= hom=tape + ^- wall + ?@ lug + (rig hom) + =+ lin=(lent hom) + =+ wug=:(add 1 tab lin) + ?. =+ mir=i.lug + |- ?@ mir + | + ?|(=(0 wug) ?&(=(' ' i.mir) $(mir t.mir, wug (dec wug)))) + (rig hom) + [(runt [tab ' '] (weld hom `tape`[' ' (slag wug i.lug)])) t.lug] + -- + -- +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2eL, formatting (path) :: +:: +++ ab + |% + ++ bix (bass 16 (stun [2 2] six)) + ++ hif (boss 256 ;~(plug tip tiq (easy ~))) + ++ huf %+ cook + |=([a=@ b=@] (wred:un ~(zug mu ~(zag mu [a b])))) + ;~(plug hif ;~(pfix hep hif)) + ++ hyf (bass 0x1.0000.0000 ;~(plug huf ;~(pfix hep huf) (easy ~))) + ++ pev (bass 32 ;~(plug sev (stun [0 4] siv))) + ++ pew (bass 64 ;~(plug sew (stun [0 4] siw))) + ++ piv (bass 32 (stun [5 5] siv)) + ++ piw (bass 64 (stun [5 5] siw)) + ++ qeb (bass 2 ;~(plug seb (stun [0 3] sib))) + ++ qex (bass 16 ;~(plug sex (stun [0 3] hit))) + ++ qib (bass 2 (stun [4 4] sib)) + ++ qix (bass 16 (stun [4 4] six)) + ++ seb (cold 1 (just '1')) + ++ sed (cook |=(a=@ (sub a '0')) (shim '1' '9')) + ++ sev ;~(pose sed sov) + ++ sew ;~(pose sed sow) + ++ sex ;~(pose sed sox) + ++ sib (cook |=(a=@ (sub a '0')) (shim '0' '1')) + ++ siq ;~ pose + (shim 'a' 'z') + (shim 'A' 'Z') + (shim '0' '9') + hep + (cold 32 dot) + ;~(pfix sig ;~(pose sig dot bix)) + == + ++ sid (cook |=(a=@ (sub a '0')) (shim '0' '9')) + ++ siv ;~(pose sid sov) + ++ siw ;~(pose sid sow) + ++ six ;~(pose sid sox) + ++ sov (cook |=(a=@ (sub a 87)) (shim 'a' 'v')) + ++ sow ;~ pose + (cook |=(a=@ (sub a 87)) (shim 'a' 'z')) + (cook |=(a=@ (sub a 29)) (shim 'A' 'Z')) + (cold 62 (just '-')) + (cold 63 (just '~')) + == + ++ sox (cook |=(a=@ (sub a 87)) (shim 'a' 'f')) + ++ ted (bass 10 ;~(plug sed (stun [0 2] sid))) + ++ tip (sear |=(a=@ (ins:po a)) til) + ++ tiq (sear |=(a=@ (ind:po a)) til) + ++ tid (bass 10 (stun [3 3] sid)) + ++ til (boss 256 (stun [3 3] low)) + ++ urs %+ cook + |=(a=tape (rap 3 ^-((list ,@) a))) + (star ;~(pose nud low hig hep dot sig cab)) + ++ voy ;~(pfix bas ;~(pose bas soq bix)) + ++ vym (bass 256 ;~(plug low (star ;~(pose low nud)))) + ++ vyn (bass 256 ;~(plug hep vym (easy ~))) + -- +++ ag + |% + ++ ape |*(fel=_rule ;~(pose (cold 0 (just '0')) fel)) + ++ bay (ape (bass 16 ;~(plug qeb:ab (star ;~(pfix dog qib:ab))))) + ++ bip (bass 0x1.0000 (stun [8 8] (ape qex:ab))) + ++ dem (ape (bass 1.000 ;~(plug ted:ab (star ;~(pfix dog tid:ab))))) + ++ dim (ape (bass 10 ;~(plug sed:ab (star sid:ab)))) + ++ dum (bass 10 (plus sid:ab)) + ++ fed ;~ pose + (bass 0x1.0000.0000.0000.0000 (most doh hyf:ab)) + huf:ab + hif:ab + tiq:ab + == + ++ hex (ape (bass 0x1.0000 ;~(plug qex:ab (star ;~(pfix dog qix:ab))))) + ++ lip =+ tod=(ape ted:ab) + (bass 256 ;~(plug tod (stun [3 3] ;~(pfix dog tod)))) + ++ qut %+ ifix [soq soq] + %+ boss 256 + %- star ;~ pose + ;~(pfix bas ;~(pose bas soq bix:ab)) + ;~(pose (shim 32 38) (shim 40 91) (shim 93 126)) + == + ++ sym (cook |=(a=(list ,@) (rap 3 a)) ;~(plug vym:ab (star vyn:ab))) + ++ tyq (cook |=(a=(list ,@) (rap 3 a)) (plus siq:ab)) + ++ viz (ape (bass 0x200.0000 ;~(plug pev:ab (star ;~(pfix dog piv:ab))))) + ++ wiz (ape (bass 0x4000.0000 ;~(plug pew:ab (star ;~(pfix dog piw:ab))))) + -- +:: +++ co + =< |_ lot=coin + ++ rear |=(rom=tape =>(.(rex rom) rend)) + ++ rent `@ta`(rap 3 rend) + ++ rend + ^- tape + ?: ?=(%blob -.lot) + ['~' '0' ((w-co 1) (jam p.lot))] + ?: ?=(%many -.lot) + :- '.' + |- ^- tape + ?~ p.lot + ['_' '_' rex] + ['_' rend(lot i.p.lot, rex $(p.lot t.p.lot))] + =+ [yed=(end 3 1 p.p.lot) hay=(cut 3 [1 1] p.p.lot)] + |- ^- tape + ?+ yed (z-co q.p.lot) + %c ['~' '-' (weld (rip 3 (wood (tuft q.p.lot))) rex)] + %d + ?+ hay (z-co q.p.lot) + %a + =+ yod=(yore q.p.lot) + => ^+(. .(rex ?~(f.t.yod rex ['.' (s-co f.t.yod)]))) + => ^+ . + %= . + rex + ?: &(=(~ f.t.yod) =(0 h.t.yod) =(0 m.t.yod) =(0 s.t.yod)) + rex + => .(rex ['.' (y-co s.t.yod)]) + => .(rex ['.' (y-co m.t.yod)]) + ['.' '.' (y-co h.t.yod)] + == + => .(rex ['.' (a-co d.t.yod)]) + => .(rex ['.' (a-co m.yod)]) + => .(rex ?:(a.yod rex ['-' rex])) + ['~' (a-co y.yod)] + :: + %r + =+ yug=(yell q.p.lot) + => ^+(. .(rex ?~(f.yug rex ['.' (s-co f.yug)]))) + :- '~' + ?: &(=(0 d.yug) =(0 m.yug) =(0 h.yug) =(0 s.yug)) + ['.' 's' '0' rex] + => ^+(. ?:(=(0 s.yug) . .(rex ['.' 's' (a-co s.yug)]))) + => ^+(. ?:(=(0 m.yug) . .(rex ['.' 'm' (a-co m.yug)]))) + => ^+(. ?:(=(0 h.yug) . .(rex ['.' 'h' (a-co h.yug)]))) + => ^+(. ?:(=(0 d.yug) . .(rex ['.' 'd' (a-co d.yug)]))) + +.rex + == + :: + %f + ?: =(& q.p.lot) + ['.' 'y' rex] + ?:(=(| q.p.lot) ['.' 'n' rex] (z-co q.p.lot)) + :: + %n ['~' rex] + %i + ?+ hay (z-co q.p.lot) + %f ((ro-co [3 10 4] |=(a=@ ~(d ne a))) q.p.lot) + %s ((ro-co [4 16 8] |=(a=@ ~(x ne a))) q.p.lot) + == + :: + %p + =+ dyx=(met 3 q.p.lot) + :- '~' + ?: (lte dyx 1) + (weld (trip (tod:po q.p.lot)) rex) + ?: =(2 dyx) + ;: weld + (trip (tos:po (end 3 1 q.p.lot))) + (trip (tod:po (rsh 3 1 q.p.lot))) + rex + == + =+ [dyz=(met 5 q.p.lot) fin=|] + |- ^- tape + ?: =(0 dyz) + rex + %= $ + fin & + dyz (dec dyz) + q.p.lot (rsh 5 1 q.p.lot) + rex + =+ syb=(wren:un (end 5 1 q.p.lot)) + =+ cog=~(zig mu [(rsh 4 1 syb) (end 4 1 syb)]) + ;: weld + (trip (tos:po (end 3 1 p.cog))) + (trip (tod:po (rsh 3 1 p.cog))) + `tape`['-' ~] + (trip (tos:po (end 3 1 q.cog))) + (trip (tod:po (rsh 3 1 q.cog))) + `tape`?:(fin ['-' ?:(=(1 (end 0 1 dyz)) ~ ['-' ~])] ~) + rex + == + == + :: + %r + ?+ hay (z-co q.p.lot) + %d ['.' '~' (r-co (rlyd q.p.lot))] + %h ['.' '~' '~' (r-co (rlyh q.p.lot))] + %q ['.' '~' '~' '~' (r-co (rlyq q.p.lot))] + %s ['.' (r-co (rlys q.p.lot))] + == + :: + %u + =- (weld p.gam ?:(=(0 q.p.lot) `tape`['0' ~] q.gam)) + ^= gam ^- [p=tape q=tape] + ?+ hay [~ ((ox-co [10 3] |=(a=@ ~(d ne a))) q.p.lot)] + %b [['0' 'b' ~] ((ox-co [2 4] |=(a=@ ~(d ne a))) q.p.lot)] + %x [['0' 'x' ~] ((ox-co [16 4] |=(a=@ ~(x ne a))) q.p.lot)] + %v [['0' 'v' ~] ((ox-co [32 5] |=(a=@ ~(x ne a))) q.p.lot)] + %w [['0' 'w' ~] ((ox-co [64 5] |=(a=@ ~(w ne a))) q.p.lot)] + == + :: + %s + %+ weld + ?:((syn:si q.p.lot) "--" "-") + $(yed 'u', q.p.lot (abs:si q.p.lot)) + :: + %t + ?: =('a' hay) + ?: =('s' (cut 3 [2 1] p.p.lot)) + (weld (rip 3 q.p.lot) rex) + ['~' '.' (weld (rip 3 (wack q.p.lot)) rex)] + ['~' '~' (weld (rip 3 (wood q.p.lot)) rex)] + == + -- + =+ rex=*tape + =< |% + ++ a-co |=(dat=@ ((d-co 1) dat)) + ++ d-co |=(min=@ (em-co [10 min] |=([? b=@ c=tape] [~(d ne b) c]))) + ++ r-co + |= [syn=? nub=@ der=@] + => .(rex ['.' ((d-co 1) der)]) + => .(rex ((d-co 1) nub)) + ?:(syn rex ['-' rex]) + :: + ++ s-co + |= esc=(list ,@) ^- tape + ~| [%so-co esc] + ?~ esc + rex + :- '.' + =>(.(rex $(esc t.esc)) ((x-co 4) i.esc)) + :: + ++ w-co |=(min=@ (em-co [64 min] |=([? b=@ c=tape] [~(w ne b) c]))) + ++ x-co |=(min=@ (em-co [16 min] |=([? b=@ c=tape] [~(x ne b) c]))) + ++ y-co |=(dat=@ ((d-co 2) dat)) + ++ z-co |=(dat=@ `tape`['0' 'x' ((x-co 1) dat)]) + -- + |% + ++ em-co + |= [[bas=@ min=@] [par=_|+([? @ tape] *tape)]] + |= hol=@ + ^- tape + ?: &(=(0 hol) =(0 min)) + rex + =+ [rad=(mod hol bas) dar=(div hol bas)] + %= $ + min ?:(=(0 min) 0 (dec min)) + hol dar + rex (par =(0 dar) rad rex) + == + :: + ++ ox-co + |= [[bas=@ gop=@] dug=_|+(@ @)] + %+ em-co + [|-(?:(=(0 gop) 1 (mul bas $(gop (dec gop))))) 0] + |= [top=? seg=@ res=tape] + %+ weld + ?:(top ~ `tape`['.' ~]) + %. seg + %+ em-co(rex res) + [bas ?:(top 0 gop)] + |=([? b=@ c=tape] [(dug b) c]) + :: + ++ ro-co + |= [[buz=@ bas=@ dop=@] dug=_|+(@ @)] + |= hol=@ + ^- tape + ?: =(0 dop) + rex + => .(rex $(dop (dec dop))) + :- '.' + %- (em-co [bas 1] |=([? b=@ c=tape] [(dug b) c])) + [(cut buz [(dec dop) 1] hol)] + -- +:: +++ ne + |_ tig=@ + ++ d (add tig '0') + ++ x ?:((gte tig 10) (add tig 87) d) + ++ w ?:(=(tig 63) '~' ?:(=(tig 62) '-' ?:((gte tig 36) (add tig 29) x))) + -- +:: +++ mu + |_ [top=@ bot=@] + ++ zag [p=(end 4 1 (add top bot)) q=bot] + ++ zig [p=(end 4 1 (add top (sub 0x1.0000 bot))) q=bot] + ++ zug (mix (lsh 4 1 top) bot) + -- +:: +++ so + |% + ++ bisk + ;~ pose + ;~ pfix (just '0') + ;~ pose + (stag %ub ;~(pfix (just 'b') bay:ag)) + (stag %ux ;~(pfix (just 'x') hex:ag)) + (stag %uv ;~(pfix (just 'v') viz:ag)) + (stag %uw ;~(pfix (just 'w') wiz:ag)) + == + == + (stag %ud dem:ag) + == + ++ crub + ;~ pose + %+ cook + |=(det=date `dime`[%da (year det)]) + ;~ plug + %+ cook + |=([a=@ b=?] [b a]) + ;~(plug dim:ag ;~(pose (cold | hep) (easy &))) + ;~(pfix dot dim:ag) :: month + ;~(pfix dot dim:ag) :: day + ;~ pose + ;~ pfix + ;~(plug dot dot) + ;~ plug + dum:ag + ;~(pfix dot dum:ag) + ;~(pfix dot dum:ag) + ;~(pose ;~(pfix ;~(plug dot dot) (most dot qix:ab)) (easy ~)) + == + == + (easy [0 0 0 ~]) + == + == + :: + %+ cook + |= [a=(list ,[p=?(%d %h %m %s) q=@]) b=(list ,@)] + =+ rop=`tarp`[0 0 0 0 b] + |- ^- dime + ?~ a + [%dr (yule rop)] + ?- p.i.a + %d $(a t.a, d.rop (add q.i.a d.rop)) + %h $(a t.a, h.rop (add q.i.a h.rop)) + %m $(a t.a, m.rop (add q.i.a m.rop)) + %s $(a t.a, s.rop (add q.i.a s.rop)) + == + ;~ plug + %+ most + dot + ;~ pose + ;~(pfix (just 'd') (stag %d dim:ag)) + ;~(pfix (just 'h') (stag %h dim:ag)) + ;~(pfix (just 'm') (stag %m dim:ag)) + ;~(pfix (just 's') (stag %s dim:ag)) + == + ;~(pose ;~(pfix ;~(plug dot dot) (most dot qix:ab)) (easy ~)) + == + :: + (stag %p fed:ag) + ;~(pfix dot (stag %ta (cook wick urs:ab))) + ;~(pfix sig (stag %t (cook woad urs:ab))) + ;~(pfix hep (stag %c (cook turf (cook woad urs:ab)))) + == + ++ nuck + %+ knee *coin |. ~+ + %- stew :~ + :- ['a' 'z'] (cook |=(a=@ta [~ %tas a]) sym) + :- ['0' '9'] (stag ~ bisk) + :- '-' (stag ~ tash) + :- '.' ;~(pfix dot perd) + :- '~' ;~(pfix sig ;~(pose twid (easy [~ %n 0]))) + == + ++ perd + ;~ pose + (stag ~ zust) + (stag %many (ifix [cab ;~(plug cab cab)] (more cab nuck))) + == + ++ royl + =+ ^= vox + ;~ plug + ;~(pose (cold | hep) (easy &)) + ;~(plug dim:ag ;~(pose ;~(pfix dot dim:ag) (easy 0))) + == + ;~ pose + (stag %rh (cook rylh ;~(pfix ;~(plug sig sig) vox))) + (stag %rq (cook rylq ;~(pfix ;~(plug sig sig sig) vox))) + (stag %rd (cook ryld ;~(pfix sig vox))) + (stag %rs (cook ryls vox)) + == + ++ tash + =+ ^= neg + |= [syn=? mol=dime] ^- dime + ?> =('u' (end 3 1 p.mol)) + [(cat 3 's' (rsh 3 1 p.mol)) (new:si syn q.mol)] + ;~ pfix hep + ;~ pose + (cook |=(a=dime (neg | a)) bisk) + ;~(pfix hep (cook |=(a=dime (neg & a)) bisk)) + == + == + ++ twid + ;~ pose + (cook |=(a=@ [%blob (cue a)]) ;~(pfix (just '0') wiz:ag)) + (stag ~ crub) + == + :: + ++ zust + ;~ pose + (stag %is bip:ag) + (stag %if lip:ag) + (stag %f ;~(pose (cold & (just 'y')) (cold | (just 'n')))) + royl + == + -- +++ scot |=(mol=dime ~(rent co %$ mol)) +++ scow |=(mol=dime ~(rend co %$ mol)) +++ slaw + |= [mod=@tas txt=@ta] + ^- (unit ,@) + =+ con=(slay txt) + ?.(&(?=([~ %$ @ @] con) =(p.p.u.con mod)) ~ [~ q.p.u.con]) +:: +++ slay + |= txt=@ta ^- (unit coin) + =+ vex=((full nuck:so) [[1 1] (trip txt)]) + ?@ q.vex + ~ + [~ p.u.q.vex] +:: +++ smyt + |= bon=path ^- tank + :+ %rose [['/' ~] ['/' ~] ['/' ~]] + |- ^- (list tank) + (turn bon |=(a=@ [%leaf (rip 3 a)])) +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2eM, pseudo-cryptography :: +:: +++ un :: =(x (wred (wren x))) + |% + ++ wren :: conceal structure + |= pyn=@ ^- @ + =+ len=(met 3 pyn) + ?: =(0 len) + 0 + => .(len (dec len)) + =+ mig=(zaft (xafo len (cut 3 [len 1] pyn))) + %+ can 3 + %- flop ^- (list ,[@ @]) + :- [1 mig] + |- ^- (list ,[@ @]) + ?: =(0 len) + ~ + => .(len (dec len)) + =+ mog=(zyft :(mix mig (end 3 1 len) (cut 3 [len 1] pyn))) + [[1 mog] $(mig mog)] + :: + ++ wred :: restore structure + |= cry=@ ^- @ + =+ len=(met 3 cry) + ?: =(0 len) + 0 + => .(len (dec len)) + =+ mig=(cut 3 [len 1] cry) + %+ can 3 + %- flop ^- (list ,[@ @]) + :- [1 (xaro len (zart mig))] + |- ^- (list ,[@ @]) + ?: =(0 len) + ~ + => .(len (dec len)) + =+ mog=(cut 3 [len 1] cry) + [[1 :(mix mig (end 3 1 len) (zyrt mog))] $(mig mog)] + :: + ++ xafo |=([a=@ b=@] +((mod (add (dec b) a) 255))) + ++ xaro |=([a=@ b=@] +((mod (add (dec b) (sub 255 (mod a 255))) 255))) + :: + ++ zaft :: forward 255-sbox + |= a=@ + =+ ^= b + 0xcc.75bc.86c8.2fb1.9a42.f0b3.79a0.92ca.21f6.1e41.cde5.fcc0. + 7e85.51ae.1005.c72d.1246.07e8.7c64.a914.8d69.d9f4.59c2.8038. + 1f4a.dca2.6fdf.66f9.f561.a12e.5a16.f7b0.a39f.364e.cb70.7318. + 1de1.ad31.63d1.abd4.db68.6a33.134d.a760.edee.5434.493a.e323. + 930d.8f3d.3562.bb81.0b24.43cf.bea5.a6eb.52b4.0229.06b2.6704. + 78c9.45ec.d75e.58af.c577.b7b9.c40e.017d.90c3.87f8.96fa.1153. + 0372.7f30.1c32.ac83.ff17.c6e4.d36d.6b55.e2ce.8c71.8a5b.b6f3. + 9d4b.eab5.8b3c.e7f2.a8fe.9574.5de0.bf20.3f15.9784.9939.5f9c. + e609.564f.d8a4.b825.9819.94aa.2c08.8e4c.9b22.477a.2840.3ed6. + 3750.6ef1.44dd.89ef.6576.d00a.fbda.9ed2.3b6c.7b0c.bde9.2ade. + 5c88.c182.481a.1b0f.2bfd.d591.2726.57ba + (cut 3 [(dec a) 1] b) + :: + ++ zart :: reverse 255-sbox + |= a=@ + =+ ^= b + 0x68.4f07.ea1c.73c9.75c2.efc8.d559.5125.f621.a7a8.8591.5613. + dd52.40eb.65a2.60b7.4bcb.1123.ceb0.1bd6.3c84.2906.b164.19b3. + 1e95.5fec.ffbc.f187.fbe2.6680.7c77.d30e.e94a.9414.fd9a.017d. + 3a7e.5a55.8ff5.8bf9.c181.e5b6.6ab2.35da.50aa.9293.3bc0.cdc6. + f3bf.1a58.4130.f844.3846.744e.36a0.f205.789e.32d8.5e54.5c22. + 0f76.fce7.4569.0d99.d26e.e879.dc16.2df4.887f.1ffe.4dba.6f5d. + bbcc.2663.1762.aed7.af8a.ca20.dbb4.9bc7.a942.834c.105b.c4d4. + 8202.3e61.a671.90e6.273d.bdab.3157.cfa4.0c2e.df86.2496.f7ed. + 2b48.2a9d.5318.a343.d128.be9c.a5ad.6bb5.6dfa.c5e1.3408.128d. + 2c04.0339.97a1.2ff0.49d0.eeb8.6c0a.0b37.b967.c347.d9ac.e072. + e409.7b9f.1598.1d3f.33de.8ce3.8970.8e7a + (cut 3 [(dec a) 1] b) + :: + ++ zyft :: forward 256-sbox + |= a=@ + =+ ^= b + 0xbb49.b71f.b881.b402.17e4.6b86.69b5.1647.115f.dddb.7ca5. + 8371.4bd5.19a9.b092.605d.0d9b.e030.a0cc.78ba.5706.4d2d. + 986a.768c.f8e8.c4c7.2f1c.effe.3cae.01c0.253e.65d3.3872. + ce0e.7a74.8ac6.daac.7e5c.6479.44ec.4143.3d20.4af0.ee6c. + c828.deca.0377.249f.ffcd.7b4f.eb7d.66f2.8951.042e.595a. + 8e13.f9c3.a79a.f788.6199.9391.7fab.6200.4ce5.0758.e2f1. + 7594.c945.d218.4248.afa1.e61a.54fb.1482.bea4.96a2.3473. + 63c2.e7cb.155b.120a.4ed7.bfd8.b31b.4008.f329.fca3.5380. + 9556.0cb2.8722.2bea.e96e.3ac5.d1bc.10e3.2c52.a62a.b1d6. + 35aa.d05e.f6a8.0f3b.31ed.559d.09ad.f585.6d21.fd1d.8d67. + 370b.26f4.70c1.b923.4684.6fbd.cf8b.5036.0539.9cdc.d93f. + 9068.1edf.8f33.b632.d427.97fa.9ee1 + (cut 3 [a 1] b) + :: + ++ zyrt :: reverse 256-sbox + |= a=@ + =+ ^= b + 0x9fc8.2753.6e02.8fcf.8b35.2b20.5598.7caa.c9a9.30b0.9b48. + 47ce.6371.80f6.407d.00dd.0aa5.ed10.ecb7.0f5a.5c3a.e605. + c077.4337.17bd.9eda.62a4.79a7.ccb8.44cd.8e64.1ec4.5b6b. + 1842.ffd8.1dfb.fd07.f2f9.594c.3be3.73c6.2cb6.8438.e434. + 8d3d.ea6a.5268.72db.a001.2e11.de8c.88d3.0369.4f7a.87e2. + 860d.0991.25d0.16b9.978a.4bf4.2a1a.e96c.fa50.85b5.9aeb. + 9dbb.b2d9.a2d1.7bba.66be.e81f.1946.29a8.f5d2.f30c.2499. + c1b3.6583.89e1.ee36.e0b4.6092.937e.d74e.2f6f.513e.9615. + 9c5d.d581.e7ab.fe74.f01b.78b1.ae75.af57.0ec2.adc7.3245. + 12bf.2314.3967.0806.31dc.cb94.d43f.493c.54a6.0421.c3a1. + 1c4a.28ac.fc0b.26ca.5870.e576.f7f1.616d.905f.ef41.33bc. + df4d.225e.2d56.7fd6.1395.a3f8.c582 + (cut 3 [a 1] b) + -- +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2eN, virtualization :: +:: +++ mack + |= [sub=* fol=*] + ^- (unit) + =+ ton=(mink [sub fol] |=(* ~)) + ?.(?=([0 *] ton) ~ [~ p.ton]) +:: +++ mink + ~/ %mink + |= [[sub=* fol=*] sky=_|+(* *(unit))] + =+ tax=*(list ,[@ta *]) + |- ^- tone + ?@ fol + [%2 tax] + ?: ?=(^ -.fol) + =+ hed=$(fol -.fol) + ?: ?=(2 -.hed) + hed + =+ tal=$(fol +.fol) + ?- -.tal + 0 ?-(-.hed 0 [%0 p.hed p.tal], 1 hed) + 1 ?-(-.hed 0 tal, 1 [%1 (weld p.hed p.tal)]) + 2 tal + == + ?- fol + :: + [0 b=@] + ?: =(0 b.fol) [%2 tax] + ?: =(1 b.fol) [%0 sub] + ?: ?=(@ sub) [%2 tax] + =+ [now=(cap b.fol) lat=(mas b.fol)] + $(b.fol lat, sub ?:(=(2 now) -.sub +.sub)) + :: + [1 b=*] + [%0 b.fol] + :: + [2 b=^ c=*] + =+ ben=$(fol [b.fol c.fol]) + ?. ?=(0 -.ben) ben + ?>(?=(^ p.ben) $(sub -.p.ben, fol +.p.ben)) + :: + [3 b=*] + =+ ben=$(fol b.fol) + ?. ?=(0 -.ben) ben + [%0 .?(p.ben)] + :: + [4 b=*] + =+ ben=$(fol b.fol) + ?. ?=(0 -.ben) ben + ?. ?=(@ p.ben) [%2 tax] + [%0 .+(p.ben)] + :: + [5 b=*] + =+ ben=$(fol b.fol) + ?. ?=(0 -.ben) ben + ?. ?=(^ p.ben) [%2 tax] + [%0 =(-.p.ben +.p.ben)] + :: + [6 b=* c=* d=*] + $(fol =>(fol [2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b])) + :: + [7 b=* c=*] $(fol =>(fol [2 b 1 c])) + [8 b=* c=*] $(fol =>(fol [7 [[0 1] b] c])) + [9 b=* c=*] $(fol =>(fol [7 c 0 b])) + [10 @ c=*] $(fol c.fol) + [10 [* c=*] d=*] + =+ ben=$(fol c.fol) + ?. ?=(0 -.ben) ben + ?: ?=(?(%hunk %lose %mean %spot) +<-.fol) + $(fol d.fol, tax [[+<-.fol p.ben] tax]) + $(fol d.fol) + :: + [11 b=*] + =+ ben=$(fol b.fol) + ?. ?=(0 -.ben) ben + =+ val=(sky p.ben) + ?@(val [%1 p.ben ~] [%0 +.val]) + :: + * + [%2 tax] + == +:: +++ mock + |= [[sub=* fol=*] sky=_|+(* *(unit))] + (mook (mink [sub fol] sky)) +:: +++ mook + |= ton=tone + ^- toon + ?. ?=([2 *] ton) ton + :- %2 + =+ yel=(lent p.ton) + =. p.ton + ?. (gth yel 256) p.ton + %+ weld + (scag 128 p.ton) + ^- (list ,[@ta *]) + :_ (slag (sub yel 128) p.ton) + :- %lose + %+ rap 3 + ;: weld + "[skipped " + ~(rend co %$ %ud (sub yel 256)) + " frames]" + == + |- ^- (list tank) + ?~ p.ton ~ + =+ rex=$(p.ton t.p.ton) + ?+ -.i.p.ton rex + %hunk [(tank +.i.p.ton) rex] + %lose [[%leaf (rip 3 (,@ +.i.p.ton))] rex] + %mean :_ rex + =+ mac=(mack +.i.p.ton +<.i.p.ton) + ?~(mac [%leaf "####"] (tank u.mac)) + %spot :_ rex + =+ sot=(spot +.i.p.ton) + :- %leaf + ;: weld + ~(ram re (smyt p.sot)) + ":<[" + ~(rend co ~ %ud p.p.q.sot) + " " + ~(rend co ~ %ud q.p.q.sot) + "].[" + ~(rend co ~ %ud p.q.q.sot) + " " + ~(rend co ~ %ud q.q.q.sot) + "]>" + == + == +:: +++ mang + |= [[gat=* sam=*] sky=_|+(* *(unit))] + ^- (unit) + =+ ton=(mong [[gat sam] sky]) + ?.(?=([0 *] ton) ~ [~ p.ton]) +:: +++ mong + |= [[gat=* sam=*] sky=_|+(* *(unit))] + ^- toon + ?. &(?=(^ gat) ?=(^ +.gat)) + [%2 ~] + (mock [[-.gat [sam +>.gat]] -.gat] sky) +:: +++ mung + |= [[gat=* sam=*] sky=_|+(* *(unit))] + ^- tone + ?. &(?=(^ gat) ?=(^ +.gat)) + [%2 ~] + (mink [[-.gat [sam +>.gat]] -.gat] sky) +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2eO, diff (move me) :: +:: +:: +++ berk :: invert diff patch + |* bur=(urge) + ^+ bur + ?~ bur ~ + :_ $(bur t.bur) + ?- -.i.bur + & i.bur + | [%| q.i.bur p.i.bur] + == +:: +++ diff :: generate patch + |= pum=umph + |= [old=* new=*] ^- udon + :- pum + ?+ pum ~|(%unsupported !!) + %a [%a old new] + %c =+ [hel=(lore ((hard ,@) old)) hev=(lore ((hard ,@) new))] + [%c (lusk hel hev (loss hel hev))] + == +:: +++ loss :: longest subsequence + ~/ %loss + |* [hel=(list) hev=(list)] + ^+ hev + =+ ^= sev + =+ [inx=0 sev=*(map ,@t (list ,@ud))] + |- ^+ sev + ?~ hev sev + =+ guy=(~(get by sev) i.hev) + $(hev t.hev, inx +(inx), sev (~(put by sev) i.hev [inx ?~(guy ~ u.guy)])) + =| gox=[p=@ud q=(map ,@ud ,[p=@ud q=_hev])] + =< abet + =< main + |% + ++ abet :: subsequence + ^+ hev + ?: =(0 p.gox) ~ + (flop q:(need (~(get by q.gox) (dec p.gox)))) + :: + ++ hink :: extend fits top + |= [inx=@ud goy=@ud] ^- ? + |(=(p.gox inx) (lth goy p:(need (~(get by q.gox) inx)))) + :: + ++ lonk :: extend fits bottom + |= [inx=@ud goy=@ud] ^- ? + |(=(0 inx) (gth goy p:(need (~(get by q.gox) (dec inx))))) + :: + ++ lune :: extend + |= [inx=@ud goy=@ud] + ^+ +> + %_ +>.$ + gox + :- ?:(=(inx p.gox) +(p.gox) p.gox) + %+ ~(put by q.gox) inx + [goy (snag goy hev) ?:(=(0 inx) ~ q:(need (~(get by q.gox) (dec inx))))] + == + :: + ++ merg :: merge all matches + |= gay=(list ,@ud) + ^+ +> + =+ ^= zes + =+ [inx=0 zes=*(list ,[p=@ud q=@ud])] + |- ^+ zes + ?: |(?=(~ gay) (gth inx p.gox)) zes + ?. (lonk inx i.gay) $(gay t.gay) + ?. (hink inx i.gay) $(inx +(inx)) + $(inx +(inx), gay t.gay, zes [[inx i.gay] zes]) + |- ^+ +>.^$ + ?~(zes +>.^$ $(zes t.zes, +>.^$ (lune i.zes))) + :: + ++ main + =+ hol=hel + |- ^+ +> + ?~ hol +> + =+ guy=(~(get by sev) i.hol) + $(hol t.hol, +> (merg (flop `(list ,@ud)`?~(guy ~ u.guy)))) + -- +:: +++ locz :: trivial algorithm + |= [hel=tape hev=tape] + ^- tape + =+ [leh=(lent hel) veh=(lent hev)] + =- (flop q.yun) + ^= yun + |- ^- [p=@ud q=tape] + ~+ + ?: |(=(0 leh) =(0 veh)) [0 ~] + =+ [dis=(snag (dec leh) hel) dat=(snag (dec veh) hev)] + ?: =(dis dat) + =+ say=$(leh (dec leh), veh (dec veh)) + [+(p.say) [dis q.say]] + =+ [lef=$(leh (dec leh)) rig=$(veh (dec veh))] + ?:((gth p.lef p.rig) lef rig) +:: +++ lore :: atom to line list + ~/ %lore + |= lub=@ + =| tez=(list ,@t) + |- ^+ tez + ?: =(0 lub) (flop tez) + =+ ^= meg + =+ meg=0 + |- ^- @ud + =+ gam=(cut 3 [meg 1] lub) + ?:(|(=(10 gam) =(0 gam)) meg $(meg +(meg))) + $(lub (rsh 3 +(meg) lub), tez [(end 3 meg lub) tez]) +:: +++ role :: line list to atom + |= tez=(list ,@t) + (rap 3 (turn tez |=(a=@t (cat 3 a 10)))) +:: +++ lump :: apply patch + |= [don=udon src=*] + ^- * + ?+ p.don ~|(%unsupported !!) + %a + ?+ -.q.don ~|(%unsupported !!) + %a q.p.q.don + %c (lurk ((hard (list)) src) p.q.don) + == + :: + %c + =+ dst=(lore ((hard ,@) src)) + %- role + ?+ -.q.don ~|(%unsupported !!) + %a ((hard (list ,@t)) q.p.q.don) + %c (lurk dst p.q.don) + == + == +:: +++ limp :: invert patch + |= don=udon ^- udon + :- p.don + ?+ -.q.don ~|(%unsupported !!) + %a [%a q.p.q.don p.p.q.don] + %c [%c (berk p.q.don)] + %d [%d q.q.don p.q.don] + == +:: +++ hump :: general prepatch + |= [pum=umph src=*] ^- * + ?+ pum ~|(%unsupported !!) + %a src + %c (lore ((hard ,@) src)) + == +:: +++ husk :: unprepatch + |= [pum=umph dst=*] ^- * + ?+ pum ~|(%unsupported !!) + %a dst + %c (role ((hard (list ,@)) dst)) + == +:: +++ lurk :: apply list patch + |* [hel=(list) rug=(urge)] + ^+ hel + =+ war=`_hel`~ + |- ^+ hel + ?~ rug (flop war) + ?- -.i.rug + & + %= $ + rug t.rug + hel (slag p.i.rug hel) + war (weld (flop (scag p.i.rug hel)) war) + == + :: + | + %= $ + rug t.rug + hel =+ gur=(flop p.i.rug) + |- ^+ hel + ?~ gur hel + ?>(&(?=(^ hel) =(i.gur i.hel)) $(hel t.hel, gur t.gur)) + war (weld q.i.rug war) + == + == +:: +++ lusk :: lcs to list patch + |* [hel=(list) hev=(list) lcs=(list)] + =+ ^= rag + ^- $% [& p=@ud] + [| p=_lcs q=_lcs] + == + [%& 0] + => .(rag [p=rag q=*(list _rag)]) + =< abet =< main + |% + ++ abet =.(q.rag ?:(=([& 0] p.rag) q.rag [p.rag q.rag]) (flop q.rag)) + ++ done + |= new=_p.rag + ^+ rag + ?- -.p.rag + | ?- -.new + | [[%| (weld p.new p.p.rag) (weld q.new q.p.rag)] q.rag] + & [new [p.rag q.rag]] + == + & ?- -.new + | [new ?:(=(0 p.p.rag) q.rag [p.rag q.rag])] + & [[%& (add p.p.rag p.new)] q.rag] + == + == + :: + ++ main + |- ^+ + + ?~ hel + ?~ hev + ?>(?=(~ lcs) +) + $(hev t.hev, rag (done %| ~ [i.hev ~])) + ?~ hev + $(hel t.hel, rag (done %| [i.hel ~] ~)) + ?~ lcs + +(rag (done %| (flop hel) (flop hev))) + ?: =(i.hel i.lcs) + ?: =(i.hev i.lcs) + $(lcs t.lcs, hel t.hel, hev t.hev, rag (done %& 1)) + $(hev t.hev, rag (done %| ~ [i.hev ~])) + ?: =(i.hev i.lcs) + $(hel t.hel, rag (done %| [i.hel ~] ~)) + $(hel t.hel, hev t.hev, rag (done %| [i.hel ~] [i.hev ~])) + -- +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2eY, SHA-256 (move me) :: +:: +++ shad |=(ruz=@ (shax (shax ruz))) :: double sha-256 +++ shaf :: half sha-256 + |= [sal=@ ruz=@] + =+ haz=(shas sal ruz) + (mix (end 7 1 haz) (rsh 7 1 haz)) +:: +++ shak :: XX shd be PBKDF + |= [who=@p wud=@] + (shas (mix %shak who) wud) +:: +++ sham :: noun hash + |= yux=* ^- @uvH ^- @ + ?@ yux + (shaf %mash yux) + (shaf %sham (jam yux)) +:: +++ shas :: salted hash + |= [sal=@ ruz=@] + (shax (mix sal (shax ruz))) +:: +++ shax :: sha-256 + ~/ %shax + |= ruz=@ ^- @ + ~| %sha + =+ [few==>(fe .(a 5)) wac=|=([a=@ b=@] (cut 5 [a 1] b))] + =+ [sum=sum.few ror=ror.few net=net.few inv=inv.few] + =+ ral=(lsh 0 3 (met 3 ruz)) + =+ ^= ful + %+ can 0 + :~ [ral ruz] + [8 128] + [(mod (sub 960 (mod (add 8 ral) 512)) 512) 0] + [64 (~(net fe 6) ral)] + == + =+ lex=(met 9 ful) + =+ ^= kbx 0xc671.78f2.bef9.a3f7.a450.6ceb.90be.fffa. + 8cc7.0208.84c8.7814.78a5.636f.748f.82ee. + 682e.6ff3.5b9c.ca4f.4ed8.aa4a.391c.0cb3. + 34b0.bcb5.2748.774c.1e37.6c08.19a4.c116. + 106a.a070.f40e.3585.d699.0624.d192.e819. + c76c.51a3.c24b.8b70.a81a.664b.a2bf.e8a1. + 9272.2c85.81c2.c92e.766a.0abb.650a.7354. + 5338.0d13.4d2c.6dfc.2e1b.2138.27b7.0a85. + 1429.2967.06ca.6351.d5a7.9147.c6e0.0bf3. + bf59.7fc7.b003.27c8.a831.c66d.983e.5152. + 76f9.88da.5cb0.a9dc.4a74.84aa.2de9.2c6f. + 240c.a1cc.0fc1.9dc6.efbe.4786.e49b.69c1. + c19b.f174.9bdc.06a7.80de.b1fe.72be.5d74. + 550c.7dc3.2431.85be.1283.5b01.d807.aa98. + ab1c.5ed5.923f.82a4.59f1.11f1.3956.c25b. + e9b5.dba5.b5c0.fbcf.7137.4491.428a.2f98 + =+ ^= hax 0x5be0.cd19.1f83.d9ab.9b05.688c.510e.527f. + a54f.f53a.3c6e.f372.bb67.ae85.6a09.e667 + =+ i=0 + |- ^- @ + ?: =(i lex) + (rep 5 (turn (rip 5 hax) net)) + =+ ^= wox + =+ dux=(cut 9 [i 1] ful) + =+ wox=(rep 5 (turn (rip 5 dux) net)) + =+ j=16 + |- ^- @ + ?: =(64 j) + wox + =+ :* l=(wac (sub j 15) wox) + m=(wac (sub j 2) wox) + n=(wac (sub j 16) wox) + o=(wac (sub j 7) wox) + == + =+ x=:(mix (ror 7 l) (ror 18 l) (rsh 0 3 l)) + =+ y=:(mix (ror 17 m) (ror 19 m) (rsh 0 10 m)) + =+ z=:(sum n x o y) + $(wox (con (lsh 5 j z) wox), j +(j)) + =+ j=0 + =+ :* a=(wac 0 hax) + b=(wac 1 hax) + c=(wac 2 hax) + d=(wac 3 hax) + e=(wac 4 hax) + f=(wac 5 hax) + g=(wac 6 hax) + h=(wac 7 hax) + == + |- ^- @ + ?: =(64 j) + %= ^$ + i +(i) + hax %+ rep 5 + :~ (sum a (wac 0 hax)) + (sum b (wac 1 hax)) + (sum c (wac 2 hax)) + (sum d (wac 3 hax)) + (sum e (wac 4 hax)) + (sum f (wac 5 hax)) + (sum g (wac 6 hax)) + (sum h (wac 7 hax)) + == + == + =+ l=:(mix (ror 2 a) (ror 13 a) (ror 22 a)) :: s0 + =+ m=:(mix (dis a b) (dis a c) (dis b c)) :: maj + =+ n=(sum l m) :: t2 + =+ o=:(mix (ror 6 e) (ror 11 e) (ror 25 e)) :: s1 + =+ p=(mix (dis e f) (dis (inv e) g)) :: ch + =+ q=:(sum h o p (wac j kbx) (wac j wox)) :: t1 + $(j +(j), a (sum q n), b a, c b, d c, e (sum d q), f e, g f, h g) +:: +++ shaw :: hash to nbits + |= [sal=@ len=@ ruz=@] + (~(raw og (shas sal (mix len ruz))) len) +:: +++ og :: shax-powered rng + ~/ %og + |_ a=@ + ++ rad :: random in range + |= b=@ ^- @ + =+ c=(raw (met 0 b)) + ?:((lth c b) c $(a +(a))) + :: + ++ raw :: random bits + ~/ %raw + |= b=@ ^- @ + %+ can + 0 + =+ c=(shas %og-a (mix b a)) + |- ^- (list ,[@ @]) + ?: =(0 b) + ~ + =+ d=(shas %og-b (mix b (mix a c))) + ?: (lth b 256) + [[b (end 0 b d)] ~] + [[256 d] $(c d, b (sub b 256))] + -- +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2eZ, OLD rendering (kill me) :: +:: +++ show :: XX deprecated, use type + |= vem=* + |^ ^- tank + ?: ?=(@ vem) + [%leaf (mesc (trip vem))] + ?- vem + [s=~ c=*] + [%leaf '\'' (weld (mesc (tape +.vem)) `tape`['\'' ~])] + :: + [s=%a c=@] [%leaf (mesc (trip c.vem))] + [s=%b c=*] (shop c.vem |=(a=@ ~(rub at a))) + [s=[%c p=@] c=*] + :+ %palm + [['.' ~] ['-' ~] ~ ~] + [[%leaf (mesc (trip p.s.vem))] $(vem c.vem) ~] + :: + [s=%d c=*] (shop c.vem |=(a=@ ~(rud at a))) + [s=%k c=*] (tank c.vem) + [s=%h c=*] + ?: =(0 c.vem) :: XX remove after 220 + [%leaf '#' ~] + :+ %rose + [['/' ~] ['/' ~] ~] + =+ yol=`(list ,@ta)`[(,@ta -.c.vem) (flop ((list ,@ta) +.c.vem))] + (turn yol |=(a=@ta [%leaf (trip a)])) + :: + [s=%o c=*] + %= $ + vem + :- [%m '%h:<[%d %d].[%d %d]>'] + [-.c.vem +<-.c.vem +<+.c.vem +>-.c.vem +>+.c.vem ~] + == + :: + [s=%p c=*] (shop c.vem |=(a=@ ~(rup at a))) + [s=%q c=*] (shop c.vem |=(a=@ ~(r at a))) + [s=%r c=*] $(vem [[%r ' ' '{' '}'] c.vem]) + [s=%t c=*] (shop c.vem |=(a=@ ~(rt at a))) + [s=%v c=*] (shop c.vem |=(a=@ ~(ruv at a))) + [s=%x c=*] (shop c.vem |=(a=@ ~(rux at a))) + [s=[%m p=@] c=*] (shep p.s.vem c.vem) + [s=[%r p=@] c=*] + $(vem [[%r ' ' (cut 3 [0 1] p.s.vem) (cut 3 [1 1] p.s.vem)] c.vem]) + :: + [s=[%r p=@ q=@ r=@] c=*] + :+ %rose + :* p=(mesc (trip p.s.vem)) + q=(mesc (trip q.s.vem)) + r=(mesc (trip r.s.vem)) + == + |- ^- (list tank) + ?@ c.vem + ~ + [^$(vem -.c.vem) $(c.vem +.c.vem)] + :: + [s=%z c=*] $(vem [[%r %$ %$ %$] c.vem]) + * !! + == + ++ shep + |= [fom=@ gar=*] + ^- tank + =+ l=(met 3 fom) + =+ i=0 + :- %leaf + |- ^- tape + ?: (gte i l) + ~ + =+ c=(cut 3 [i 1] fom) + ?. =(37 c) + (weld (mesc [c ~]) $(i +(i))) + =+ d=(cut 3 [+(i) 1] fom) + ?. .?(gar) + ['\\' '#' $(i (add 2 i))] + (weld ~(ram re (show d -.gar)) $(i (add 2 i), gar +.gar)) + :: + ++ shop + |= [aug=* vel=_|+(a=@ *tape)] + ^- tank + ?: ?=(@ aug) + [%leaf (vel aug)] + :+ %rose + [[' ' ~] ['[' ~] [']' ~]] + => .(aug `*`aug) + |- ^- (list tank) + ?: ?=(@ aug) + [^$ ~] + [^$(aug -.aug) $(aug +.aug)] + -- +++ at + |_ a=@ + ++ r + ?: ?& (gte (met 3 a) 2) + |- + ?: =(0 a) + & + =+ vis=(end 3 1 a) + ?& ?|(=('-' vis) ?&((gte vis 'a') (lte vis 'z'))) + $(a (rsh 3 1 a)) + == + == + rtam + ?: (lte (met 3 a) 2) + rud + rux + :: + ++ rf `tape`[?-(a & '&', | '|', * !!) ~] + ++ rn `tape`[?>(=(0 a) '~') ~] + ++ rt `tape`['\'' (weld (mesc (trip a)) `tape`['\'' ~])] + ++ rta rt + ++ rtam `tape`['%' (trip a)] + ++ rub `tape`['0' 'b' (rum 2 ~ |=(b=@ (add '0' b)))] + ++ rud (rum 10 ~ |=(b=@ (add '0' b))) + ++ rum + |= [b=@ c=tape d=_|+(@ @)] + ^- tape + ?: =(0 a) + [(d 0) c] + =+ e=0 + |- ^- tape + ?: =(0 a) + c + =+ f=&(!=(0 e) =(0 (mod e ?:(=(10 b) 3 4)))) + %= $ + a (div a b) + c [(d (mod a b)) ?:(f [?:(=(10 b) ',' '-') c] c)] + e +(e) + == + :: + ++ rup + =+ b=(met 3 a) + ^- tape + :- '-' + |- ^- tape + ?: (gth (met 5 a) 1) + %+ weld + $(a (rsh 5 1 a), b (sub b 4)) + `tape`['-' '-' $(a (end 5 1 a), b 4)] + ?: =(0 b) + ['~' ~] + ?: (lte b 1) + (trip (tos:po a)) + |- ^- tape + ?: =(2 b) + =+ c=(rsh 3 1 a) + =+ d=(end 3 1 a) + (weld (trip (tod:po c)) (trip (tos:po (mix c d)))) + =+ c=(rsh 3 2 a) + =+ d=(end 3 2 a) + (weld ^$(a c, b (met 3 c)) `tape`['-' $(a (mix c d), b 2)]) + :: + ++ ruv + ^- tape + :+ '0' + 'v' + %^ rum + 64 + ~ + |= b=@ + ?: =(63 b) + '+' + ?: =(62 b) + '-' + ?:((lth b 26) (add 65 b) ?:((lth b 52) (add 71 b) (sub b 4))) + :: + ++ rux `tape`['0' 'x' (rum 16 ~ |=(b=@ (add b ?:((lth b 10) 48 87))))] + -- + :::::::::::::::::::::::::::::::::::::::::::::::::::::: :: +:::: chapter 2f, Hoon proper :::: +:: :::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2fA, miscellaneous funs :: +:: :: +++ cell + ~/ %cell + |= [hed=type tal=type] + ^- type + ?:(=(%void hed) %void ?:(=(%void tal) %void [%cell hed tal])) +:: +++ core + ~/ %core + |= [pac=type con=coil] + ^- type + ?:(=(%void pac) %void [%core pac con]) +:: +++ cube + ~/ %cube + |= [dil=* goq=type] + ^- type + ?: =(%void goq) + %void + [%cube dil goq] +:: +++ face + ~/ %face + |= [cog=term der=type] + ^- type + ?: =(%void der) + %void + [%face cog der] +:: +++ bean ^-(type [%fork [%cube 0 %atom %f] [%cube 1 %atom %f]]) +++ flay + ~/ %flay + |= pok=port + ^- [p=axis q=type] + :- p.pok + ?- -.q.pok + & p.q.pok + | (roll q.q.pok =+([p=[p=*type q=*foot] q=`type`%void] |.((fork p.p q)))) + == +:: +++ foil + ~/ %foil + |= pok=port + ^- prop + ?- -.q.pok + & [p.pok [~ [[p.q.pok [%elm ~ 1]] ~]]] + | [p.pok [p.q.pok q.q.pok]] + == +:: +++ fork + ~/ %fork + |= [hoz=type bur=type] + ^- type + ?: =(hoz bur) + hoz + ?: =(%void hoz) + bur + ?: =(%void bur) + hoz + [%fork hoz bur] +:: +++ cove + |= nug=tool + ?- nug + [0 *] p.nug + [10 *] $(nug q.nug) + * ~|([%cove nug] !!) + == +++ comb + ~/ %comb + |= [mal=tool buz=tool] + ^- tool + ?: ?&(?=([0 *] mal) !=(0 p.mal)) + ?: ?&(?=([0 *] buz) !=(0 p.buz)) + [%0 (peg p.mal p.buz)] + ?: ?=([2 [0 *] [0 *]] buz) + [%2 [%0 (peg p.mal p.p.buz)] [%0 (peg p.mal p.q.buz)]] + [%7 mal buz] + ?: ?=([^ [0 1]] mal) + [%8 p.mal buz] + ?: =([0 1] buz) + mal + [%7 mal buz] +:: +++ cond + ~/ %cond + |= [pex=tool yom=tool woq=tool] + ^- tool + ?- pex + [1 0] yom + [1 1] woq + * [%6 pex yom woq] + == +:: +++ cons + ~/ %cons + |= [vur=tool sed=tool] + ^- tool + ?: ?=([[0 *] [0 *]] +<) + ?: ?&(=(+(p.vur) p.sed) =((div p.vur 2) (div p.sed 2))) + [%0 (div p.vur 2)] + [vur sed] + ?: ?=([[1 *] [1 *]] +<) + [%1 p.vur p.sed] + [vur sed] +:: +++ fitz + ~/ %fitz + |= [yaz=term wix=term] + =+ ^= fiz + |= mot=@ta ^- [p=@ q=@ta] + =+ len=(met 3 mot) + ?: =(0 len) + [0 %$] + =+ tyl=(rsh 3 (dec len) mot) + ?: &((gte tyl 'A') (lte tyl 'Z')) + [(sub tyl 64) (end 3 (dec len) mot)] + [0 mot] + =+ [yoz=(fiz yaz) wux=(fiz wix)] + ?& ?| =(0 p.yoz) + =(0 p.wux) + &(!=(0 p.wux) (lte p.wux p.yoz)) + == + |- ?| =(%$ p.yoz) + =(%$ p.wux) + ?& =((end 3 1 p.yoz) (end 3 1 p.wux)) + $(p.yoz (rsh 3 1 p.yoz), p.wux (rsh 3 1 p.wux)) + == + == + == +:: +++ flan + ~/ %flan + |= [bos=tool nif=tool] + ^- tool + ?- bos + [1 1] bos + [1 0] nif + * + ?- nif + [1 1] nif + [1 0] bos + * [%6 bos nif [%1 1]] + == + == +:: +++ flip + ~/ %flip + |= [dyr=tool] + [%6 dyr [%1 1] [%1 0]] +:: +++ flor + ~/ %flor + |= [bos=tool nif=tool] + ^- tool + ?- bos + [1 1] nif + [1 0] bos + * + ?- nif + [1 1] bos + [1 0] nif + * [%6 bos [%1 0] nif] + == + == +:: +++ hike + ~/ %hike + |= [axe=axis pac=(list ,[p=axis q=tool])] + ^- tool + ?~ pac + [%0 axe] + =+ zet=(skim pac.$ |=([p=axis q=tool] [=(1 p)])) + ?~ zet + =+ tum=(skim pac.$ |=([p=axis q=tool] ?&(!=(1 p) =(2 (cap p))))) + =+ gam=(skim pac.$ |=([p=axis q=tool] ?&(!=(1 p) =(3 (cap p))))) + %+ cons + %= $ + axe (peg axe 2) + pac (turn tum |=([p=axis q=tool] [(mas p) q])) + == + %= $ + axe (peg axe 3) + pac (turn gam |=([p=axis q=tool] [(mas p) q])) + == + ?>(?=([* ~] zet) q.i.zet) +:: +++ hoax + |= a=@ta + ?> =(%ho (end 3 2 a)) + %+ add + (mod (add 13 (sub (cut 3 [3 1] a) 'a')) 26) + %+ mul 26 + =+ b=(cut 3 [2 1] a) + ?+(b !! %o 0, %i 1, %u 2, %e 3, %a 4, %y 5, %w 6, %l 7) +:: +++ hoof + |= a=@ ^- @ta + (rap 3 'h' 'o' (snag (div a 26) "oiueaywl") (add 'a' (mod (add a 13) 26)) ~) +:: +++ jock + |= rad=? + |= lot=coin ^- gene + ?- -.lot + ~ ?:(rad [%dtsg p.lot] [%dtpt p.lot]) + :: + %blob + ?: rad + [%dtsg %$ p.lot] + ?@(p.lot [%dtpt %$ p.lot] [$(p.lot -.p.lot) $(p.lot +.p.lot)]) + :: + %many + |-(^-(gene ?~(p.lot [%bcts %null] [^$(lot i.p.lot) $(p.lot t.p.lot)]))) + == +:: +++ look + ~/ %look + |= [cog=term dab=(map term foot)] + =+ axe=1 + |- + ^- (unit ,[p=axis q=foot]) + ?- dab + ~ ~ + [* ~ ~] + ?:(=(cog p.n.dab) [~ axe q.n.dab] ~) + :: + [* ~ *] + ?: =(cog p.n.dab) + [~ (peg axe 2) q.n.dab] + ?: (gor cog p.n.dab) + ~ + $(axe (peg axe 3), dab r.dab) + :: + [* * ~] + ?: =(cog p.n.dab) + [~ (peg axe 2) q.n.dab] + ?: (gor cog p.n.dab) + $(axe (peg axe 3), dab l.dab) + ~ + :: + [* * *] + ?: =(cog p.n.dab) + [~ (peg axe 2) q.n.dab] + ?: (gor cog p.n.dab) + $(axe (peg axe 6), dab l.dab) + $(axe (peg axe 7), dab r.dab) + == +:: +++ make + |= txt=@ + q:(~(mint ut %noun) %noun (ream txt)) +:: +++ rain + |= [bon=path txt=@] + =+ vaz=vast + (scan (trip txt) (full (ifix [gay gay] tall:vaz(wer bon)))) +:: +++ ream + |= txt=@ + ^- gene + (rash txt vest) +:: +++ reck + |= bon=path + (rain bon ((hard ,@t) .^(%cx (weld bon `path`[%hoon ~])))) +:: +++ seed + ^- vase + ~+ + !;(*type ..seed) +:: +++ sell + |= vax=vase ^- tank + ~| %sell + (dish:ut ~(dole ut p.vax) q.vax) +:: +++ pave + |= vax=vase ^- tape + ~(ram re (sell vax)) +:: +++ loot + |= vax=vase ^- @ta + (rap 3 (pave vax)) +:: +++ slam + |= [gat=vase sam=vase] ^- vase + =+ :- ^= typ ^- type + [%cell p.gat p.sam] + ^= gen ^- gene + [%cncl [~ 2] [~ 3]] + =+ gun=(~(mint ut typ) %noun gen) + [p.gun .*([q.gat q.sam] q.gun)] +:: +++ slim + |= old=vise ^- vase + old +:: +++ slit + |= [gat=type sam=type] + (~(play ut [%cell gat sam]) [%cncl [~ 2] [~ 3]]) +:: +++ slap + |= [vax=vase gen=gene] ^- vase + =+ gun=(~(mint ut p.vax) %noun gen) + [p.gun .*(q.vax q.gun)] +:: +++ slop + |= [hed=vase tal=vase] + ^- vase + [[%cell p.hed p.tal] [q.hed q.tal]] +:: +++ skol + |= typ=type ^- tank + ~(duck ut typ) +:: +++ spat |=(pax=path (rap 3 (spud pax))) +++ spud |=(pax=path ~(ram re (dish:ut [~ %path] pax))) +++ slot + |= [axe=@ vax=vase] ^- vase + (slap vax [~ axe]) +:: +++ slum + |= [vax=vase wad=(map term vase)] ^- vase + ?- wad + ~ vax + [* ~ ~] [[%cell p.vax [%face p.n.wad p.q.n.wad]] [q.vax q.q.n.wad]] + [* ~ *] $(wad [n.wad ~ ~], vax $(wad r.wad)) + [* * ~] $(wad [n.wad ~ ~], vax $(wad l.wad)) + [* * *] $(wad [n.wad ~ r.wad], vax $(wad l.wad)) + == +:: +++ stab + |= zep=@ta ^- path + (need (rush zep ;~(pfix fas ;~(sfix (more fas urs:ab) fas)))) +:: +++ wash + |= [[tab=@ edg=@] tac=tank] ^- wall + (~(win re tac) tab edg) +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2fB, macro expansion :: +:: +++ al + =+ [nag=`*`& gom=`axis`1] + |_ sec=tile + :::: + ++ blah ^~ [%dtsg %$ 0] + ++ home |=(gen=gene ^-(gene ?:(=(1 gom) gen [%tsgr [~ gom] gen]))) + :::: + ++ bunt + |- ^- gene + ?- sec + [^ *] + [$(sec p.sec) $(sec q.sec)] + :: + [%base *] + ?- p.sec + [%atom *] [%dtpt p.p.sec 0] + %noun [%dttr [%dtsg %$ 0] [[%dtsg %$ 0] [%dtsg %$ 1]]] + %cell =+(nec=$(sec [%base %noun]) [nec nec]) + %bean [%dtts [%dtsg %$ 0] [%dtsg %$ 0]] + %null [%dtsg %n %$] + == + :: + [%bark *] + [%ktts p.sec $(sec q.sec)] + :: + [%bush *] + [%wtcl [%bcts %bean] $(sec p.sec) $(sec q.sec)] + :: + [%fern *] + |- ^- gene + ?@ t.p.sec + ^$(sec i.p.sec) + [%wtcl [%bcts %bean] ^$(sec i.p.sec) $(p.sec t.p.sec)] + :: + [%herb *] + (home [%tsgl [%cnbc %$] p.sec]) + :: + [%kelp *] + |- ^- gene + ?@ t.p.sec + ^$(sec i.p.sec) + [%wtcl [%bcts %bean] ^$(sec i.p.sec) $(p.sec t.p.sec)] + :: + [%leaf *] + [%dtsg p.sec q.sec] + :: + [%reed *] + [%wtcl [%bcts %bean] $(sec p.sec) $(sec q.sec)] + :: + [%weed *] + (home p.sec) + == + ++ clam ^-(gene [%brts [%bcts %noun] %sgls 0 (whip(gom 7) 6)]) + ++ whip + |= axe=axis + =+ ^= tun + |= noy=_|+(* *gene) + ^- gene + ?@ nag + =+ luz=[%cnts [[~ 1] ~] [[~ axe] bunt(sec [%base %cell])] ~] + ?: =(& nag) + [%tsgr [%wtpt [~ axe] luz [~ 1]] (noy [& &])] + [%tsgr luz (noy [& &])] + (noy nag) + ^- gene + ?- sec + [^ *] + %- tun |= gon=* => .(nag gon) ^- gene + :- ^$(sec -.sec, nag -.nag, axe (peg axe 2)) + ^$(sec +.sec, nag +.nag, axe (peg axe 3)) + :: + [%base *] + ?- p.sec + [%atom *] + =+ buv=bunt + |- ^- gene + ?@ nag + ?:(=(& nag) [%wtpt [~ axe] $(nag |) buv] [%ktls buv [~ axe]]) + buv + :: + %noun + [%kthp [%bcts %noun] [~ axe]] + :: + %cell + =+ buv=bunt + |- ^- gene + ?@ nag + ?:(=(& nag) [%wtpt [~ axe] buv $(nag [& &])] buv) + [%ktls buv [~ axe]] + :: + %bean + :^ %wtcl + [%dtts [%dtsg %$ |] [~ axe]] + [%dtsg %f |] + [%dtsg %f &] + :: + %null + bunt + == + :: + [%bark *] + [%ktts p.sec $(sec q.sec)] + :: + [%bush *] + ?- nag + & [%wtpt [~ axe] $(sec p.sec, nag |) $(sec q.sec, nag [& &])] + | $(sec p.sec) + ^ $(sec q.sec) + * !! + == + :: + [%fern *] + |- ^- gene + ?@ t.p.sec + ^$(sec i.p.sec) + :+ %tsls + ^$(sec i.p.sec) + => .(axe (peg 3 axe), gom (peg 3 gom)) + :^ %wtcl + [%dtts [~ axe] [~ 2]] + [~ 2] + $(i.p.sec i.t.p.sec, t.p.sec t.t.p.sec) + :: + [%herb *] + [%cnhp (home p.sec) [~ axe] ~] + :: + [%kelp *] + %- tun |= gon=* => .(nag gon) + |- ^- gene + ?@ t.p.sec + :- [%dtsg +.p.i.p.sec] + ^^$(axe (peg axe 3), sec q.i.p.sec, nag &) + :^ %wtcl + [%dtts [~ (peg axe 2)] [%dtsg +.p.i.p.sec]] + :- [%dtsg +.p.i.p.sec] + ^^$(axe (peg axe 3), sec q.i.p.sec, nag &) + $(i.p.sec i.t.p.sec, t.p.sec t.t.p.sec) + :: + [%leaf *] + [%dtsg p.sec q.sec] + :: + [%reed *] + %- tun |= gon=* => .(nag gon) ^- gene + ?@ -.nag + ?: =(& -.nag) + [%wtpt [~ (peg axe 2)] ^$(sec q.sec) ^$(sec p.sec)] + ^$(sec q.sec) + ^$(sec p.sec) + :: + [%weed *] + =+ hom=(home p.sec) + ~| [%weed-made hom] + hom + :: (home p.sec) + == + -- +:: +++ ap + ~% %ap + +> + == + %etch etch + %hack hack + %open open + %rake rake + == + |_ gen=gene + ++ bore + ~| %bore + |- ^- tile + ?- gen + [^ *] [$(gen p.gen) $(gen q.gen)] + [%clls *] $(gen open) + [%clfs *] $(gen open) + [%clcn *] $(gen open) + [%clcb *] $(gen open) + [%clhp *] $(gen open) + [%clkt *] $(gen open) + [%cltr *] $(gen open) + [%clsg *] $(gen open) + [%dtpt *] [%leaf +.gen] + [%dtsg *] [%leaf ?>(?=(@ q.gen) +.gen)] + [%bcbr *] [%bush $(gen p.gen) $(gen q.gen)] + [%bccb *] [%weed p.gen] + [%bccm *] [%weed gen] + [%bccn *] [%kelp burl(gen p.gen) (turn q.gen |=(a=gene burl(gen a)))] + [%bcpm *] [%reed $(gen p.gen) $(gen q.gen)] + [%bcts *] [%base +.gen] + [%bcwt *] [%fern $(gen p.gen) (turn q.gen |=(a=gene ^$(gen a)))] + [%ktts *] [%bark p.gen $(gen q.gen)] + [%zpcb *] $(gen q.gen) + * [%herb gen] + == + ++ burl + ^- line + =+ haq=hack + ?> ?=([& *] haq) + =+ [oft=bore(gen p.haq) eft=bore(gen q.haq)] + ~| %burl-head + ?> ?=([%leaf *] oft) + [oft eft] + :: + ++ etch + ~| %etch + |- ^- term + ?: ?=([%ktts *] gen) + p.gen + =+ voq=~(open ap gen) + ?<(=(gen voq) $(gen voq)) + :: + ++ hack + |- ^- $%([& p=gene q=gene] [| p=gene]) + ?- gen + [^ *] [%& p.gen q.gen] + [%tsgr *] + ?. ?=([~ *] p.gen) + [%| gen] + =+ pyr=$(gen q.gen) + ?- -.pyr + | [%| [%tsgr p.gen p.pyr]] + & [%& [%tsgr p.gen p.pyr] [%tsgr p.gen q.pyr]] + == + :: + [%zpcb *] + =+ pyr=$(gen q.gen) + ?- -.pyr + | [%| [%zpcb p.gen p.pyr]] + & [%& [%zpcb p.gen p.pyr] [%zpcb p.gen q.pyr]] + == + :: + * + =+ voq=~(open ap gen) + ?: =(gen voq) + [%| gen] + $(gen voq) + == + :: + ++ jone + ^- (list gene) + ?: ?=([%clzp *] gen) + p.gen + ?: ?=([%zpcb * [%clzp *]] gen) + p.q.gen + [gen ~] + :: + ++ open + ^- gene + ?- gen + [~ *] [%cnts [gen ~] ~] + [%bcbr *] ~(clam al bore) + [%bccb *] ~(clam al bore) + [%bccl *] [%bccm [%cltr p.gen]] + [%bccn *] ~(clam al bore) + [%bccm *] ~(clam al bore(gen p.gen)) + [%bckt *] ~(clam al bore(gen p.gen)) + [%bcpm *] ~(clam al bore) + [%bctr *] [%ktsg ~(bunt al bore(gen p.gen))] + [%bcts *] ~(bunt al bore) + [%bcwt *] ~(clam al bore) + [%brbr *] [%bccb [%brls p.gen ~(bunt al bore(gen q.gen))]] + [%brcb *] [%tsls [[%bctr p.gen] [%brcn q.gen]]] + [%brdt *] [%brcn (~(put by *(map term foot)) %$ [%ash p.gen])] + [%brkt *] [%tsgr [%brcn (~(put by q.gen) %$ [%ash p.gen])] [%cnbc %$]] + [%brls *] [%ktbr [%brts p.gen q.gen]] + [%brhp *] [%tsgr [%brdt p.gen] [%cnbc %$]] + [%brtr *] [%brcb p.gen (~(put by *(map term foot)) %$ [%elm q.gen])] + [%brts *] [%brcb p.gen (~(put by *(map term foot)) %$ [%ash q.gen])] + [%brwt *] [%ktwt %brdt p.gen] + [%clkt *] [p.gen q.gen r.gen s.gen] + [%clfs *] =+(zoy=[%dtsg %ta %$] [%clsg [zoy [%clsg [zoy p.gen] ~]] ~]) + [%clls *] [p.gen q.gen r.gen] + [%clcb *] [q.gen p.gen] + [%clcn *] [[%clsg p.gen] [%bcts %null]] + [%clhp *] [p.gen q.gen] + [%clsg *] + |- ^- gene + ?~ p.gen + [%dtsg %n ~] + =+ mow=jone(gen i.p.gen) + ?: =(mow [i.p.gen ~]) + [i.p.gen $(p.gen t.p.gen)] + $(p.gen (weld mow t.p.gen)) + :: + [%cltr *] + |- ^- gene + ?~ p.gen + [%zpzp ~] + =+ mow=jone(gen i.p.gen) + ?: =(mow [i.p.gen ~]) + ?~ t.p.gen + i.p.gen + [i.p.gen $(p.gen t.p.gen)] + $(p.gen (weld mow t.p.gen)) + :: + [%clzp *] open(gen [%clsg p.gen]) + [%cnbc *] [%cnts [p.gen ~] ~] + [%cncb *] [%ktls [%cnhx p.gen] %cnts p.gen q.gen] + [%cncl *] [%cnsg [%$ ~] p.gen q.gen] + [%cndt *] [%cnhp q.gen [p.gen ~]] + [%cnkt *] [%cnhp p.gen q.gen r.gen s.gen ~] + [%cnls *] [%cnhp p.gen q.gen r.gen ~] + [%cnhp *] + ?@(q.gen [%tsgr p.gen [%cnbc %$]] [%cncl p.gen [%cltr q.gen]]) + :: + [%cnhx *] [%cnts p.gen ~] + [%cnsg *] [%cntr p.gen q.gen [[[~ 6] r.gen] ~]] + [%cntr *] + :+ %tsls + q.gen + :+ %cnts + (weld p.gen `wing`[[~ 2] ~]) + (turn r.gen |=([p=gene q=gene] [p [%ktdt [~ 10] [%tsgr [~ 3] q]]])) + :: + [%hxgl *] [%cnhp [%cnbc %pave] [%zpgr [%cltr p.gen]] ~] + [%hxgr *] [%cnhp [%cnbc %sell] [%zpgr [%cltr p.gen]] ~] + :: + [%kthp *] [%ktls ~(bunt al bore(gen p.gen)) q.gen] + [%sgbr *] [%sggr [%lose p.gen] q.gen] + [%sgcn *] + :+ %sggl + :- %fast + :- %clls + :+ [%dtsg %$ p.gen] + [%zpts q.gen] + :- %clsg + =+ nob=`(list gene)`~ + |- ^- (list gene) + ?@ r.gen + nob + [[[%dtsg %$ p.i.r.gen] [%zpts q.i.r.gen]] $(r.gen t.r.gen)] + s.gen + :: + [%sgcl *] [%sggr [%bank %dtsg %$ p.gen] q.gen] + [%sgfs *] [%sgcn p.gen [~ 7] ~ q.gen] + [%sggl *] [%tsgl [%sggr p.gen [~ 1]] q.gen] + [%sgbc *] [%sggr [%live [%dtsg %$ p.gen]] q.gen] + [%sghx *] [%sggr [%ping [%dtsg %$ p.gen]] q.gen] + [%sgkt *] + [%sggr [%mean [%brdt [%cnhp [%cnbc %sell] [%zpgr p.gen] ~]]] q.gen] + :: + [%sgls *] [%sggr [%memo %dtsg %$ p.gen] q.gen] + [%sgpm *] + :+ %sggr + [%slog [%dtpt %$ p.gen] [%cnhp [%cnbc %sell] [%zpgr q.gen] ~]] + r.gen + :: + [%sgts *] [%sggr [%germ p.gen] q.gen] + [%sgzp *] [%sggr [%mean [%brdt p.gen]] q.gen] + [%smcl *] + ?- q.gen + ~ [%zpzp ~] + [* ~] i.q.gen + ^ + :+ %tsls + p.gen + =+ yex=`(list gene)`q.gen + |- ^- gene + ?- yex + [* ~] [%tsgr [~ 3] i.yex] + [* ^] [%cnhp [~ 2] [%tsgr [~ 3] i.yex] $(yex t.yex) ~] + ~ !! + == + == + :: + [%smcb *] :: ;_ + :+ %tsgr [%ktts %v ~ 1] :: => v=. + :+ %tsls [%ktts %a [%tsgr [%cnbc %v] p.gen]] :: =+ a==>(v {p.gen}) + :^ %wtsg [%cnbc %a] :: ?~ a + [%zpzp ~] :: !! + :+ %tsgr :: => + [[%cnbc %v] [%tsgl [~ 3] [%cnbc %a]]] :: [v +.a] + q.gen :: + :: + [%smcm *] :: ;, + =+ nem=etch(gen p.gen) :: + |- ^- gene :: + ?~ q.gen :: + [%tsgl [%cnbc nem] p.gen] :: =< [{nem} {p.gen}] + :+ %tsls [%ktts %a i.q.gen] :: =+ a={i.q.gen} + :^ %wtkt [%cnbc %a] :: ?^ a + [%tsgl [%cnbc nem] [%cnbc %a]] :: =< [{nem} a] + $(q.gen t.q.gen) :: + :: + [%smcn *] :: ;% + |- ^- gene :: + ?~ p.gen :: + [%bcts %null] :: ~ + :+ %tsls [%ktts %a i.p.gen] :: =+ a={i.p.gen} + :^ %wtkt [%cnbc %a] :: ?^ a + [%cnbc %a] :: a + $(p.gen t.p.gen) :: + :: + [%smdq *] :: ;" + :+ %tsgr [%ktts %v ~ 1] :: => v=. + :- %brhp :: |- + :+ %ktls :: ^+ + :- %brhp :: |- + :^ %wtcl :: ?: + [%bcts %bean] :: ? + [%bcts %null] :: ~ + :- [%ktts %i [%dtpt 'tD' @]] :: :- i=~~ + [%ktts %t [%cnbc %$]] :: t=$ + |- ^- gene :: + ?~ p.gen :: + [%bcts %null] :: ~ + =+ res=$(p.gen t.p.gen) :: + ^- gene :: + ?@ i.p.gen :: + [[%dtpt 'tD' i.p.gen] res] :: [~~{i.p.gen} {res}] + :+ %tsls :: + :- :+ %ktts :: ^= + %a :: a + :+ %ktls :: ^+ + [%cnbc %$] :: $ + [%tsgr [%cnbc %v] p.i.p.gen] :: =>(v {p.i.p.gen}) + [%ktts %b res] :: b={res} + ^- gene :: + :- %brhp :: |- + :^ %wtpt :: ?@ + [%cnbc %a] :: a + [%cnbc %b] :: b + :- [%tsgl [~ 2] [%cnbc %a]] :: :- -.a + :+ %cnts :: %= + [%$ ~] :: $ + [[[%cnbc %a] [%tsgl [~ 3] [%cnbc %a]]] ~] :: a +.a + :: + [%smdt *] :: ;. + :+ %tsgr [%ktts %v ~ 1] :: => v=. + :+ %tsls [%ktts %a [%tsgr [%cnbc %v] p.gen]] :: =+ a==>(v {p.gen}) + |- ^- gene :: + ?~ q.gen :: + [%cnbc %a] :: a + :^ %wtsg [%cnbc %a] :: ?~ a + [%bcts %null] :: ~ + :+ %tsgr :: => + :+ %cnts [[~ 1] ~] :: %= . + :~ :- [%cnbc %a] :: a + :+ %tsgr :: => + [[%cnbc %v] [%tsgl [~ 3] [%cnbc %a]]] :: [v +.a] + i.q.gen :: + == :: == + $(q.gen t.q.gen) :: + :: + [%smhx *] :: ;# + =+ cah=*(list ,@) :: + =+ ^= cda :: + |= a=(list ,@) :: + :- :- [%dtpt %ta %$] :: + :- :- [%dtpt %ta %$] :: + [%smdq a] :: + [%bcts %null] :: + [%bcts %null] :: + |- ^- gene :: + ?~ p.gen :: + ?~ cah :: + [%bcts %null] :: + [(cda (flop cah)) [%bcts %null]] :: + ?@ i.p.gen :: + $(p.gen t.p.gen, cah [i.p.gen cah]) :: + ?~ cah :: + [p.i.p.gen $(p.gen t.p.gen)] :: + :+ (cda (flop cah)) :: + p.i.p.gen :: + $(p.gen t.p.gen, cah ~) :: + :: + [%smpm *] :: ;& + ?~ q.gen :: + [%bcts %null] :: + ?: =(~ t.q.gen) :: + i.q.gen :: + :+ %tsgr [%ktts %v ~ 1] :: => v=. + :+ %tsls [%ktts %a [%tsgr [%cnbc %v] i.q.gen]] :: =+ a==>(v {iqgen}) + :+ %tsgr [%ktts %w ~ 1] :: => w=. + |- ^- gene :: + ?~ t.q.gen :: + [%cnbc %a] :: a + :+ %tsls :+ %ktts %b :: =+ ^= b + [%tsgr [%cnhx %v %w ~] i.t.q.gen] :: => v.w + :+ %tsgr :: {i.t.q.gen} + :+ %cnts [%w ~] :: => + :~ :- [%cnbc %a] :: %= w + :^ %wtsg [%cnbc %a] :: a + [%cnbc %b] :: ?~ a b + :^ %wtsg [%cnbc %b] :: ?~ b + [%cnbc %a] :: a + :+ %tsgr :: => + :- [%cnbc %v] :: :- v + :- [%tsgl [~ 3] [%cnbc %a]] :: :- +.a + [%tsgl [~ 3] [%cnbc %b]] :: +.b + i.t.q.gen :: {i.t.t.q.gen} + == :: == + $(t.q.gen t.t.q.gen) :: + :: + [%smgl *] :: ;< + =+ nem=etch(gen p.gen) :: + :+ %tsgr [%ktts %v ~ 1] :: => v=. + :+ %tsls [%ktts %a %tsgr [%cnbc %v] r.gen] :: =+ a==>(v {r.gen}) + :+ %tsls [%tsgr [%cnbc %v] p.gen] :: =+ =>(v {p.gen}) + :- %brhp :+ %ktls [%cnbc nem] :: |- ^- {nem} + :+ %tsls :: =+ ^= b + [%ktts %b %tsgl [%cnbc %$] [%cnbc %a]] :: $:a + :^ %wtsg [%cnbc %b] :: ?~ b + [%cnbc nem] :: {nem} + :+ %tsgr :: => :- :- v + :- :- [%cnbc %v] :: ^= {nem} + :+ %ktts nem :: $(a +.b) + :+ %cnts [%$ ~] :: -.b + :~ [[%cnbc %a] [%tsgl [~ 3] [%cnbc %b]]] :: + == :: + [%tsgl [~ 2] [%cnbc %b]] :: + q.gen :: + :: + [%smgr *] :: ;> + =+ nem=etch(gen p.gen) :: + :+ %tsgr [%ktts %v ~ 1] :: => v=. + :+ %tsls [%ktts %a %tsgr [%cnbc %v] r.gen] :: =+ a==>(v {r.gen}) + :+ %tsls [%tsgr [%cnbc %v] p.gen] :: =+ =>(v {p.gen}) + :- %brhp :+ %ktls [%cnbc nem] :: |- ^- {nem} + :+ %tsls :: =+ ^= b + [%ktts %b %tsgl [%cnbc %$] [%cnbc %a]] :: $:a + :^ %wtsg [%cnbc %b] :: ?~ b + [%cnbc nem] :: {nem} + :+ %cnts [%$ ~] :: %= $ + :~ [[%cnbc %a] [%tsgl [~ 3] [%cnbc %b]]] :: a +.b + :- [%cnbc nem] :: {nem} + :+ %tsgr :: => :- + :- [[%cnbc %v] [%ktts nem [%cnbc nem]]] :: [v {nem}] + [%tsgl [~ 2] [%cnbc %b]] :: -.b + q.gen :: \q.gen + == :: == + :: + [%smhp *] [%smls [%wtzp p.gen] q.gen] :: + [%smkt *] :: ;^ + :+ %tsgr [%ktts %v ~ 1] :: => v=. + :+ %tsls [%ktts %a [%tsgr [%cnbc %v] p.gen]] :: =+ a==>(v {p.gen}) + :^ %wtsg [%cnbc %a] :: ?~ a + [%bcts %null] :: ~ + :+ %ktdt [%cnbc %a] :: ^. a + :- [%bcts %null] :: :- ~ + :+ %tsgr :: => + [[%cnbc %v] [%tsgl [~ 3] [%cnbc %a]]] :: [v +.a] + q.gen :: \q.gen + :: + [%smls *] :: ;+ + :+ %tsgr [%ktts %v ~ 1] :: => v=. + :+ %tsls [%ktts %a %tsgr [%cnbc %v] q.gen] :: =+ a==>(v {q.gen}) + :- %brwt :: |? + :+ %tsls :: =+ ^= b + [%ktts %b %tsgl [%cnbc %$] [%cnbc %a]] :: $:a + :+ %ktls [%cnbc %b] :: ^+ b + :^ %wtsg [%cnbc %b] :: ?~ b + [%bcts %null] :: ~ + :^ %wtcl :: ?: + :+ %tsgr :: => + [[%cnbc %v] [%tsgl [~ 2] [%cnbc %b]]] :: [v -.b] + p.gen :: \p.gen + :+ %ktdt [%cnbc %b] :: ^. b + :- [%tsgl [~ 2] [%cnbc %b]] :: :- -.b + :+ %cnts [[~ 1] %$ ~] :: %= ..$ + :~ [[%cnbc %a] [%tsgl [~ 3] [%cnbc %b]]] :: a +.b + == :: == + :+ %cnts [%$ ~] :: %= $ + :~ [[%cnbc %a] [%tsgl [~ 3] [%cnbc %b]]] :: a +.b + == :: == + :: + [%smsg *] :: ;~ + |- ^- gene + ?- q.gen + ~ ~|(%open-smsg !!) + ^ + :+ %tsgr [%ktts %v ~ 1] :: => v=. + |- ^- gene :: + ?: ?=(~ t.q.gen) :: + [%tsgr [%cnbc %v] i.q.gen] :: =>(v {i.q.gen}) + :+ %tsls [%ktts %a $(q.gen t.q.gen)] :: =+ ^= a + :+ %tsls :: {$(q.gen t.q.gen)} + [%ktts %b [%tsgr [%cnbc %v] i.q.gen]] :: =+ ^= b + :+ %tsls :: =>(v {i.q.gen}) + [%ktts %c [%tsgl [~ 6] [%cnbc %b]]] :: =+ c=+6.b + :- %brdt :: |. + :^ %cnls :: %+ + [%tsgr [%cnbc %v] p.gen] :: =>(v {p.gen}) + [%cnhp [%cnbc %b] [%cnbc %c] ~] :: (b c) + [%cnts [%a ~] [[[~ 6] [%cnbc %c]] ~]] :: a(+6 c) + == + :: + [%smsm *] :: ;; + :+ %tsgr [%ktts %v ~ 1] :: => v=. + :+ %tsls [%ktts %a [%tsgr [%cnbc %v] p.gen]] :: =+ a==>(v {p.gen}) + :+ %tsls [%ktts %b [%tsgr [%cnbc %v] q.gen]] :: =+ b==>(v {q.gen}) + :+ %tsls :: =+ c=(a b) + [%ktts %c [%cnhp [%cnbc %a] [%cnbc %b] ~]] :: + [%wtgr [%dtts [%cnbc %c] [%cnbc %b]] [%cnbc %c]] :: ?>(=(c b) c) + :: + [%smtr *] :: ;* + :+ %tsgr [%ktts %v ~ 1] :: => v=. + :+ %tsls [%ktts %a %tsgr [%cnbc %v] q.gen] :: =+ a==>(v \q.gen) + :- %brhp :+ %kthp [%bcts %bean] :: |- ^- ? + :+ %tsls :: =+ ^= b + [%ktts %b %tsgl [%cnbc %$] [%cnbc %a]] :: $:a + :^ %wtsg [%cnbc %b] :: ?~ b + [%dtpt %f &] :: & + :~ %wtpm :: ?& + :+ %tsgr :: => + [[%cnbc %v] [%tsgl [~ 2] [%cnbc %b]]] :: [v -.b] + p.gen :: \p.gen + :+ %cnts [%$ ~] :: %= $ + :~ [[%cnbc %a] [%tsgl [~ 3] [%cnbc %b]]] :: a +.b + == :: == + == :: == + :: :: + [%smts *] :: ;= + :+ %tsgr [%ktts %v ~ 1] :: => v=. + :+ %tsls [%ktts %a %tsgr [%cnbc %v] q.gen] :: =+ a==>(v {q.gen}) + :- %brwt :: |? + :+ %tsls :: =+ ^= b + [%ktts %b %tsgl [%cnbc %$] [%cnbc %a]] :: $:a + :^ %wtsg [%cnbc %b] :: ?~ b + [%bcts %null] :: ~ + :+ %ktdt [%cnbc %b] :: ^. b + :- :+ %tsgr :: => :- v + [[%cnbc %v] [%tsgl [~ 2] [%cnbc %b]]] :: -.b + p.gen :: \p.gen + :+ %cnts [[~ 1] %$ ~] :: %= ..$ + :~ [[%cnbc %a] [%tsgl [~ 3] [%cnbc %b]]] :: a +.b + == :: == + :: :: + [%smwt *] :: ;? + :+ %tsgr [%ktts %v ~ 1] :: => v=. + :+ %tsls [%ktts %a %tsgr [%cnbc %v] q.gen] :: =+ a==>(v \q.gen) + :- %brhp :+ %kthp [%bcts %bean] :: |- ^- ? + :+ %tsls :: =+ ^= b + [%ktts %b %tsgl [%cnbc %$] [%cnbc %a]] :: $:a + :^ %wtsg [%cnbc %b] :: ?~ b + [%dtpt %f |] :: | + :~ %wtbr :: ?| + :+ %tsgr :: => + [[%cnbc %v] [%tsgl [~ 2] [%cnbc %b]]] :: [v -.b] + p.gen :: \p.gen + :+ %cnts [%$ ~] :: %= $ + :~ [[%cnbc %a] [%tsgl [~ 3] [%cnbc %b]]] :: a +.b + == :: == + == :: == + :: + [%tsbr *] + [%tsls ~(bunt al bore(gen p.gen)) q.gen] + :: + [%tscl *] + [%tsgr [%cncb [[~ 1] ~] p.gen] q.gen] + :: + [%tsdt *] + [%tsgr [%cncb [[~ 1] ~] [[p.gen q.gen] ~]] r.gen] + :: + [%tskt *] :: =^ + =+ cog=rusk(gen p.gen) :: + =+ wuy=`gene`[%cnhx (weld rake(gen q.gen) `wing`[%v ~])] :: + :+ %tsgr [%ktts %v ~ 1] :: => v=. + :+ %tsls [%ktts %a %tsgr [%cnbc %v] r.gen] :: =+ a==>(v \r.gen) + :^ %tsdt wuy [%tsgl [~ 3] [%cnbc %a]] :: =. \wuy +.a + :+ %tsgr :- :+ %ktts cog :: => :- ^= \cog + [%tsgl [~ 2] [%cnbc %a]] :: -.a + [%cnbc %v] :: v + s.gen :: s.gen + :: + [%tsgl *] [%tsgr q.gen p.gen] + [%tsls *] [%tsgr [p.gen [~ 1]] q.gen] + [%tshp *] [%tsls q.gen p.gen] + [%tssg *] + |- ^- gene + ?~ p.gen [%zpzp ~] + ?~ t.p.gen i.p.gen + [%tsgr i.p.gen $(p.gen t.p.gen)] + [%wtbr *] + |- + ?@(p.gen [%dtsg %f 1] [%wtcl i.p.gen [%dtsg %f 0] $(p.gen t.p.gen)]) + :: + [%wtdt *] [%wtcl p.gen r.gen q.gen] + [%wtgl *] [%wtcl p.gen [%zpzp ~] q.gen] + [%wtgr *] [%wtcl p.gen q.gen [%zpzp ~]] + [%wtkt *] [%wtcl [%wtcn [%dtpt %$ 0] p.gen] r.gen q.gen] + [%wtts *] [%wtcn ~(bunt al bore(gen p.gen)) q.gen] + [%wthp *] + |- + ?@ q.gen + [%zpfs p.gen] + :^ %wtcl + [%wtts p.i.q.gen p.gen] + q.i.q.gen + $(q.gen t.q.gen) + :: + [%wtls *] [%wthp p.gen (weld r.gen `_r.gen`[[[%bcts %noun] q.gen] ~])] + [%wtpm *] + |- + ?@(p.gen [%dtsg %f 0] [%wtcl i.p.gen $(p.gen t.p.gen) [%dtsg %f 1]]) + :: + [%wtpt *] [%wtcl [%wtcn [%dtpt %$ 0] p.gen] q.gen r.gen] + [%wtsg *] [%wtcl [%wtts [%bcts %null] p.gen] q.gen r.gen] + [%wtzp *] [%wtcl p.gen [%dtsg %f 1] [%dtsg %f 0]] + [%zpcb *] q.gen + [%zpgr *] [%zpsm [%bctr [%cnbc %type]] p.gen] + * gen + == + :: + ++ rake + ^- wing + ?- gen + [~ *] [gen ~] + [%cnbc *] [p.gen ~] + [%cnhx *] p.gen + [%cnts * ~] p.gen + [%zpcb *] rake(gen q.gen) + * ~|(%rake-gene !!) + == + ++ rusk + ^- term + =+ wig=rake + ?. ?=([@ ~] wig) + ~|(%rusk-gene !!) + i.wig + -- +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2fC, compilation proper :: +:: +++ ut + ~% %ut + +>+ + == + %fan fan + %rib rib + %vet vet + %fab fab + %burn burn + %cull cull + %crop crop + %dunk dunk + %find find + %fink fink + %fire fire + %firm firm + %fish fish + %fuse fuse + %gain gain + %heal heal + %lose lose + %mint mint + %moot moot + %mull mull + %nest nest + %play play + %park park + %peek peek + %repo repo + %rest rest + %seek seek + %snap snap + %swab swab + %tack tack + %tock tock + %wrap wrap + == + =+ :* fan=*(set ,[type gene]) + rib=*(set ,[type type gene]) + vet=`?`& + fab=`?`& + == + =+ sut=`type`%noun + |% + ++ burn + =+ gil=*(set type) + |- ^- * + ?- sut + [%atom *] 0 + [%cell *] [$(sut p.sut) $(sut q.sut)] + [%core *] [p.r.q.sut $(sut p.sut)] + [%cube *] p.sut + [%face *] $(sut repo) + [%fork *] $(sut p.sut) + [%hold *] ?: (~(has in gil) sut) + ~! (dunk %type) + ~|(%burn-loop !!) + $(sut repo, gil (~(put in gil) sut)) + %noun 0 + %void ~|(%burn-void !!) + == + :: + ++ crop + ~/ %crop + |= ref=type + =+ bix=*(set ,[type type]) + =< dext + |% + ++ dext + ^- type + ~| %crop-dext + :: ~! (dunk 'dext: sut') + :: ~! (dunk(sut ref) 'dext: ref') + ?: |(=(sut ref) =(%noun ref)) + %void + ?: =(%void ref) + sut + ?- sut + [%atom *] + ?- ref + [%atom *] %void + [%cell *] sut + * sint + == + :: + [%cell *] + ?- ref + [%atom *] sut + [%cell *] ?: (nest(sut p.ref) | p.sut) + (cell p.sut dext(sut q.sut, ref q.ref)) + sut + * sint + == + :: + [%core *] + ?: ?=(?([%atom *] [%cell *]) ref) + sut + sint + :: + [%cube *] + ?: &(?=([%cube *] ref) =(p.sut p.ref)) + %void + ?: ?=(?([%atom *] [%cell *]) ref) + =+ foz=dext(sut q.sut) + ?: (firm(sut foz) p.sut) + (cube p.sut foz) + %void + sint + :: + [%face *] (face p.sut dext(sut q.sut)) + [%fork *] (fork dext(sut p.sut) dext(sut q.sut)) + [%hold *] + ?: (~(has in bix) [sut ref]) + ~|(%crop-loop !!) + (reco |=(a=type dext(sut a, bix (~(put in bix) [sut ref])))) + :: + %noun (reco |=(a=type dext(sut a))) + %void %void + == + :: + ++ sint + ^- type + ?- ref + [%core *] sut + [%cube *] sut + [%face *] dext(ref repo(sut ref)) + [%fork *] dext(sut dext(ref p.ref), ref q.ref) + [%hold *] dext(ref repo(sut ref)) + * !! + == + -- + :: + ++ cull + ~/ %cull + |= [pol=? axe=axis ref=type] + ^- type + ?: =(1 axe) + ?:(pol (fuse ref) (crop ref)) + =+ [now=(cap axe) lat=(mas axe)] + =+ vil=*(set type) + |- ^- type + ?- sut + [%atom *] %void + [%cell *] + ?: =(2 now) + (cell ^$(axe lat, sut p.sut) q.sut) + (cell p.sut ^$(axe lat, sut q.sut)) + :: + [%core *] ?.(=(3 now) sut (core ^$(axe lat, sut p.sut) q.sut)) + [%cube *] (reco |=(p=type ^$(sut p))) + [%face *] (reco |=(p=type (face p.sut ^$(sut p)))) + [%fork *] + ?: (~(has in vil) sut) + %void + => .(vil (~(put in vil) sut)) + (fork $(sut p.sut) $(sut q.sut)) + :: + [%hold *] (reco |=(p=type ^$(sut p))) + %noun (reco |=(p=type ^$(sut p))) + %void %void + == + :: + ++ dank |=(pax=path ^-(tank (dish [~ %path] pax))) + ++ dart |=(pax=path ^-(tape ~(ram re (dank pax)))) + ++ deal |=(lum=* (dish dole lum)) + ++ dial + |= ham=calf + =+ gid=*(set ,@ud) + |- ^- tank + ?- q.ham + %noun [%leaf '*' ~] + %path [%leaf '/' ~] + %tank [%leaf '*' 't' ~] + %void [%leaf '#' ~] + %wool [%leaf '*' '"' '"' ~] + %wall [%leaf '*' '\'' '\'' ~] + %yarn [%leaf '"' '"' ~] + [%atom *] [%leaf '@' (trip p.q.ham)] + [%core *] + :+ %rose + [[' ' ~] ['<' ~] ['>' ~]] + |- ^- (list tank) + ?~ p.q.ham + [^$(q.ham q.q.ham) ~] + [[%leaf (rip 3 i.p.q.ham)] $(p.q.ham t.p.q.ham)] + :: + [%face *] + [%palm [['=' ~] ~ ~ ~] [%leaf (trip p.q.ham)] $(q.ham q.q.ham) ~] + :: + [%list *] + [%rose [[' ' ~] (weld (trip p.q.ham) '(' ~) [')' ~]] $(q.ham q.q.ham) ~] + :: + [%pick *] + :+ %rose + [[' ' ~] ['{' ~] ['}' ~]] + |- ^- (list tank) + ?~(p.q.ham ~ [^$(q.ham i.p.q.ham) $(p.q.ham t.p.q.ham)]) + :: + [%plot *] + :+ %rose + [[' ' ~] ['[' ~] [']' ~]] + |- ^- (list tank) + ?~(p.q.ham ~ [^$(q.ham i.p.q.ham) $(p.q.ham t.p.q.ham)]) + :: + [%pear *] + [%leaf '%' ~(rend co [~ p.q.ham q.q.ham])] + :: + [%stop *] + ?: (~(has in gid) p.q.ham) + [%leaf '$' ~(rend co [~ %ud p.q.ham])] + :+ %palm + [['.' ~] ['^' '$' ~(rend co [~ %ud p.q.ham])] ~ ~] + [$(gid (~(put in gid) p.q.ham), q.ham (need (~(get by p.ham) p.q.ham))) ~] + :: + [%tree *] + [%rose [[' ' ~] (weld (trip p.q.ham) '(' ~) [')' ~]] $(q.ham q.q.ham) ~] + :: + [%unit *] + [%rose [[' ' ~] (weld (trip p.q.ham) '(' ~) [')' ~]] $(q.ham q.q.ham) ~] + == + :: + ++ dish + |= [ham=calf lum=*] ^- tank + ~| [%dish-h ?@(q.ham q.ham -.q.ham)] + :: ~| [%lump lum] + %- need + |- ^- (unit tank) + ?- q.ham + %noun + %= $ + q.ham + ?: ?=(@ lum) + [%atom %$] + :- %plot + |- ^- (list wine) + [%noun ?:(?=(@ +.lum) [[%atom %$] ~] $(lum +.lum))] + == + :: + %path + :- ~ + :+ %rose + [['/' ~] ['/' ~] ~] + |- ^- (list tank) + ?@ lum + ?>(?=(~ lum) ~) + ?> ?=(@ -.lum) + [[%leaf (rip 3 -.lum)] $(lum +.lum)] + :: + %tank + =+ cis=(tank lum) + ?.(=(lum cis) ~ [~ cis]) + :: + %wall + :- ~ + :+ %rose + [[' ' ~] ['<' '|' ~] ['|' '>' ~]] + |- ^- (list tank) + ?@ lum + ?>(?=(~ lum) ~) + [[%leaf (trip ((hard ,@) -.lum))] $(lum +.lum)] + :: + %wool + :- ~ + :+ %rose + [[' ' ~] ['<' '<' ~] ['>' '>' ~]] + |- ^- (list tank) + ?@ lum + ?>(?=(~ lum) ~) + [(need ^$(q.ham %yarn, lum -.lum)) $(lum +.lum)] + :: + %yarn + [~ %leaf '"' (weld (tape lum) `tape`['"' ~])] + :: + %void + ~ + :: + [%atom *] + ?. ?=(@ lum) + ~ + :+ ~ + %leaf + ?: =(%$ p.q.ham) ~(rend co [~ %ud lum]) + ?: &(=(%ta p.q.ham) !=(0 lum)) ['\'' (weld (rip 3 lum) ['\'' ~])] + ?: =(%tas p.q.ham) ['%' (rip 3 lum)] + ~(rend co [~ p.q.ham lum]) + :: + [%core *] + :: XX needs rethinking for core metal + :: ?. ?=(^ lum) ~ + :: => .(lum `*`lum) + :: =- ?~(tok ~ [~ %rose [[' ' ~] ['<' ~] ['>' ~]] u.tok]) + :: ^= tok + :: |- ^- (unit (list tank)) + :: ?~ p.q.ham + :: =+ den=^$(q.ham q.q.ham) + :: ?~(den ~ [~ u.den ~]) + :: =+ mur=$(p.q.ham t.p.q.ham, lum +.lum) + :: ?~(mur ~ [~ [[%leaf (rip 3 i.p.q.ham)] u.mur]]) + [~ (dial ham)] + :: + [%face *] + =+ wal=$(q.ham q.q.ham) + ?~ wal + ~ + [~ %palm [['=' ~] ~ ~ ~] [%leaf (trip p.q.ham)] u.wal ~] + :: + [%list *] + ?: =(~ lum) + [~ %leaf '~' ~] + =- ?~ tok + ~ + [~ %rose [[' ' ~] ['~' '[' ~] [']' ~]] u.tok] + ^= tok + |- ^- (unit (list tank)) + ?: ?=(@ lum) + ?.(=(~ lum) ~ [~ ~]) + =+ [for=^$(q.ham q.q.ham, lum -.lum) aft=$(lum +.lum)] + ?. &(?=(^ for) ?=(^ aft)) + ~ + [~ u.for u.aft] + :: + [%pick *] + |- ^- (unit tank) + ?~ p.q.ham + ~ + =+ wal=^$(q.ham i.p.q.ham) + ?~ wal + $(p.q.ham t.p.q.ham) + wal + :: + [%plot *] + =- ?~ tok + ~ + [~ %rose [[' ' ~] ['[' ~] [']' ~]] u.tok] + ^= tok + |- ^- (unit (list tank)) + ?~ p.q.ham + ~ + ?: ?=([* ~] p.q.ham) + =+ wal=^$(q.ham i.p.q.ham) + ?~(wal ~ [~ [u.wal ~]]) + ?@ lum + ~ + =+ gim=^$(q.ham i.p.q.ham, lum -.lum) + ?~ gim + ~ + =+ myd=$(p.q.ham t.p.q.ham, lum +.lum) + ?~ myd + ~ + [~ u.gim u.myd] + :: + [%pear *] + ?. =(lum q.q.ham) + ~ + =+ fox=~(rend co [~ p.q.ham q.q.ham]) + [~ %leaf ?:(=(['~' ~] fox) fox ['%' fox])] + :: + [%stop *] + =+ kep=(~(get by p.ham) p.q.ham) + ?~ kep + ~|([%stop-loss p.q.ham] !!) + $(q.ham u.kep) + :: + [%tree *] + =- ?~ tok + ~ + [~ %rose [[' ' ~] ['{' ~] ['}' ~]] u.tok] + ^= tok + =+ tuk=*(list tank) + |- ^- (unit (list tank)) + ?: =(~ lum) + [~ tuk] + ?. ?=([n=* l=* r=*] lum) + ~ + =+ rol=$(lum r.lum) + ?~ rol + ~ + =+ tim=^$(q.ham q.q.ham, lum n.lum) + ?~ tim + ~ + $(lum l.lum, tuk [u.tim u.rol]) + :: + [%unit *] + ?@ lum + ?.(=(~ lum) ~ [~ %leaf '~' ~]) + ?. =(~ -.lum) + ~ + =+ wal=$(q.ham q.q.ham, lum +.lum) + ?~ wal + ~ + [~ %rose [[' ' ~] ['[' ~] [']' ~]] [%leaf '~' ~] u.wal ~] + == + :: + ++ doge + |= ham=calf + =- ?+ woz woz + [%list * [%atom 'ta']] %path + [%list * [%atom 't']] %wall + [%list * [%atom 'tD']] %yarn + [%list * %yarn] %wool + == + ^= woz + ^- wine + ?. ?=([%stop *] q.ham) + ?: ?& ?= [%pick [%pear %n 0] [%plot [%pear %n 0] [%face *] ~] ~] + q.ham + =(1 (met 3 p.i.t.p.i.t.p.q.ham)) + == + [%unit =<([p q] i.t.p.i.t.p.q.ham)] + q.ham + =+ may=(~(get by p.ham) p.q.ham) + ?~ may + q.ham + ?. ?& ?=([%pick *] u.may) + ?=(^ p.u.may) + =([%pear %n 0] i.p.u.may) + == + q.ham + ?: ?& ?=([[%plot [%face *] [%face * %stop *] ~] ~] t.p.u.may) + =(p.q.ham p.q.i.t.p.i.t.p.u.may) + =(1 (met 3 p.i.p.i.t.p.u.may)) + =(1 (met 3 p.i.t.p.i.t.p.u.may)) + == + :+ %list + (cat 3 p.i.p.i.t.p.u.may p.i.t.p.i.t.p.u.may) + q.i.p.i.t.p.u.may + ?: ?& ?= :- :^ %plot + [%face *] + [%face * %stop *] + [[%face * %stop *] ~] + ~ + t.p.u.may + =(p.q.ham p.q.i.t.p.i.t.p.u.may) + =(p.q.ham p.q.i.t.t.p.i.t.p.u.may) + =(1 (met 3 p.i.p.i.t.p.u.may)) + =(1 (met 3 p.i.t.p.i.t.p.u.may)) + =(1 (met 3 p.i.t.t.p.i.t.p.u.may)) + == + :+ %tree + %^ cat + 3 + p.i.p.i.t.p.u.may + (cat 3 p.i.t.p.i.t.p.u.may p.i.t.t.p.i.t.p.u.may) + q.i.p.i.t.p.u.may + q.ham + :: + ++ dole + ^- calf + =+ gil=*(set type) + =+ dex=[p=*(map type ,@) q=*(map ,@ wine)] + =< [q.p q] + |- ^- [p=[p=(map type ,@) q=(map ,@ wine)] q=wine] + =- [p.tez (doge q.p.tez q.tez)] + ^= tez + ^- [p=[p=(map type ,@) q=(map ,@ wine)] q=wine] + ?- sut + %noun [dex sut] + %void [dex sut] + [%atom *] [dex sut] + [%cell *] + =+ hin=$(sut p.sut) + =+ yon=$(dex p.hin, sut q.sut) + :- p.yon + :- %plot + ?:(?=([%plot *] q.yon) [q.hin p.q.yon] [q.hin q.yon ~]) + :: + [%core *] + =+ yad=$(sut p.sut) + :- p.yad + =+ ^= doy ^- [p=(list ,@ta) q=wine] + ?: ?=([%core *] q.yad) + [p.q.yad q.q.yad] + [~ q.yad] + :- %core + :_ q.doy + :_ p.doy + %^ cat 3 + %~ rent co + :+ ~ %ud + |- ^- @ + ?- q.r.q.sut + ~ 0 + [* ~ ~] 1 + [* ~ *] +($(q.r.q.sut r.q.r.q.sut)) + [* * ~] +($(q.r.q.sut l.q.r.q.sut)) + [* * *] .+ %+ add + $(q.r.q.sut l.q.r.q.sut) + $(q.r.q.sut r.q.r.q.sut) + == + %^ cat 3 + ?-(p.q.sut %gold '.', %iron '|', %lead '?', %zinc '&') + =+ gum=(mug q.r.q.sut) + %+ can 3 + :~ [1 (add 'a' (mod gum 26))] + [1 (add 'a' (mod (div gum 26) 26))] + [1 (add 'a' (mod (div gum 676) 26))] + == + :: + [%cube *] + ?. ?=(@ p.sut) + $(sut repo) + =+ pum=$(sut q.sut) + ?> ?=([%atom *] q.pum) + [p.pum [%pear p.q.pum p.sut]] + :: + [%face *] + =+ yad=$(sut q.sut) + [p.yad [%face p.sut q.yad]] + :: + [%fork *] + =+ hin=$(sut p.sut) + =+ yon=$(dex p.hin, sut q.sut) + :- p.yon + ?: =(%void q.hin) + q.yon + ?: |(=(%void q.yon) =(q.hin q.yon)) + q.hin + :- %pick + ?. ?=([%pick *] q.yon) + [q.hin q.yon ~] + ?> ?=(^ p.q.yon) + ?:(=(q.hin i.p.q.yon) p.q.yon [q.hin p.q.yon]) + :: + [%hold *] + =+ hey=(~(get by p.dex) sut) + ?^ hey + [dex [%stop u.hey]] + ?: (~(has in gil) sut) + =+ dyr=~(wyt by p.dex) + [[(~(put by p.dex) sut dyr) q.dex] [%stop dyr]] + =+ rom=$(gil (~(put in gil) sut), sut repo) + =+ rey=(~(get by p.p.rom) sut) + ?~ rey + rom + [[p.p.rom (~(put by q.p.rom) u.rey q.rom)] [%stop u.rey]] + == + :: + ++ duck ^-(tank (dial dole)) + ++ dunk + |= paz=term ^- tank + :+ %palm + [['.' ~] ['-' ~] ~ ~] + [[%leaf (mesc (trip paz))] duck ~] + :: + ++ find + ~/ %find + |= [dep=@ud way=?(%read %rite) cog=term] + =+ gil=*(set type) + |- ^- [p=@ud q=(unit port)] + ?+ sut [dep ~] + [%cell *] + =+ taf=$(sut p.sut) + ?~ q.taf + =+ bov=$(dep p.taf, sut q.sut) + ?~ q.bov + bov + [p.bov ~ (peg 3 p.u.q.bov) q.u.q.bov] + [p.taf ~ (peg 2 p.u.q.taf) q.u.q.taf] + :: + [%core *] + =+ zem=(look cog q.r.q.sut) + => ^+(. ?:(|(=(~ zem) =(0 dep)) . .(dep (dec dep), zem ~))) + ?^ zem + [dep ~ 1 [%| (peg 2 p.u.zem) [[sut(p.q %gold) q.u.zem] ~]]] + =+ taf=$(sut p.sut) + ?~ q.taf + taf + ?. (park way p.u.q.taf) + ~|(%find-park !!) + [p.taf ~ (peg 3 p.u.q.taf) q.u.q.taf] + :: + [%cube *] + $(sut repo) + :: + [%face *] + ?: =(cog p.sut) + ?. ?=(0 dep) + [(dec dep) ~] + [0 ~ 1 %& q.sut] + [dep ~] + :: + [%fork *] + ~| %fork + ?: (~(has in gil) q.sut) + $(sut p.sut) + ?: (~(has in gil) p.sut) + $(sut q.sut) + =+ [hax=$(sut p.sut) yor=$(sut q.sut)] + ~| %find-fork + ?: =(hax yor) + hax + ?~ q.hax + ?~ q.yor + ?>(=(hax yor) hax) + ?> =(0 p.hax) + ?>((nest(sut %void) | (peek(sut p.sut) way p.u.q.yor)) yor) + ?~ q.yor + ?> =(0 p.yor) + ?>((nest(sut %void) | (peek(sut q.sut) way p.u.q.hax)) hax) + ?> =(p.u.q.hax p.u.q.yor) + :- 0 + ?- -.q.u.q.hax + & + ?- -.q.u.q.yor + & [~ p.u.q.hax %& (fork p.q.u.q.hax p.q.u.q.yor)] + | !! + == + :: + | + ?- -.q.u.q.yor + & !! + | + ?> =(p.q.u.q.yor p.q.u.q.hax) + [~ p.u.q.hax %| p.q.u.q.hax (weld q.q.u.q.hax q.q.u.q.yor)] + == + == + :: + [%hold *] + ?: (~(has in gil) sut) + [dep ~] + $(gil (~(put in gil) sut), sut repo) + == + :: + ++ fink + ~/ %fink + |= [dep=@ud way=?(%read %rite) cog=term] + ^- port + :: ~! (dunk 'type') + ~! (show [%c 'find-limb'] ?:(=(%$ cog) '$' [%a cog])) + =+ hoq=(find dep way cog) + ?~ q.hoq + ~|(%find-none !!) + u.q.hoq + :: + ++ fire + ~/ %fire + |= hag=(list ,[p=type q=foot]) + ^- type + ?: ?=([[* [%elm ~ 1]] ~] hag) + p.i.hag + :- %hold + %+ turn + hag.$ + |= [p=type q=foot] + ?. ?=([%core *] p) + ~|(%fire-core !!) + =+ dox=[%core q.q.p q.p] + ?: ?=(%ash -.q) + ~| %fire-ash + :: ~! (dunk(sut [%cell q.q.p p.p]) %fire-dry) + ?> ?|(!vet (nest(sut q.q.p) & p.p)) + [dox p.q] + ~| [%fire-odd -.q] + ?> ?=(%elm -.q) + ~| %fire-elm + :: ~! (dunk(sut [%cell q.q.p p.p]) %fire-wet) + ?> ?| !vet + (~(has in rib) [sut dox p.q]) + (mull(sut p, rib (~(put in rib) [sut dox p.q])) %noun dox p.q) + == + [p p.q] + :: + ++ firm + ~/ %firm + |= dib=* + =+ bix=*(set ,[type *]) + |- ^- ? + ?- sut + [%atom *] !.?(dib) + [%cell *] &(.?(dib) $(sut p.sut, dib -.dib) $(sut q.sut, dib +.dib)) + [%core *] + ?& .?(dib) + $(sut p.sut, dib -.dib) + =(+.dib ?:(=(~ p.r.q.sut) ~|(%firm-core !!) p.r.q.sut)) + == + :: + [%cube *] =(dib p.sut) + [%face *] $(sut q.sut) + [%fork *] |($(sut p.sut) $(sut q.sut)) + [%hold *] + ?| (~(has in bix) [sut dib]) + $(bix (~(put in bix) [sut dib]), sut repo) + == + :: + %noun & + %void | + == + :: + ++ fish + ~/ %fish + |= axe=axis + =+ vot=*(set type) + |- + ^- tool + ?- sut + [%atom *] (flip [%3 %0 axe]) + %void [%1 1] + %noun [%1 0] + :: + [%cell *] + %+ flan + [%3 %0 axe] + (flan $(sut p.sut, axe (peg axe 2)) $(sut q.sut, axe (peg axe 3))) + :: + [%core *] [%0 0] + [%cube *] [%5 [%1 p.sut] [%0 axe]] + [%face *] $(sut q.sut) + [%fork *] (flor $(sut p.sut) $(sut q.sut)) + [%hold *] + ?: (~(has in vot) sut) + [%0 0] + => %=(. vot (~(put in vot) sut)) + $(sut repo) + == + :: + ++ fuse + ~/ %fuse + |= ref=type + =+ bix=*(set ,[type type]) + |- ^- type + ?: ?|(=(sut ref) =(%noun ref)) + sut + ?- sut + [%atom *] + ?- ref + [%atom *] ?:((fitz p.ref p.sut) sut ref) + [%cell *] %void + * $(sut ref, ref sut) + == + :: + [%cell *] + ?- ref + [%cell *] (cell $(sut p.sut, ref p.ref) $(sut q.sut, ref q.ref)) + * $(sut ref, ref sut) + == + :: + [%core *] $(sut repo) + [%cube *] + =+ foz=$(sut q.sut) + ?: (firm(sut foz) p.sut) + (cube p.sut foz) + %void + :: + [%face *] (face p.sut $(sut q.sut)) + [%fork *] (fork $(sut p.sut) $(sut q.sut)) + [%hold *] + ?: (~(has in bix) [sut ref]) + ~|(%fuse-loop !!) + (reco |=(a=type ^$(sut a, bix (~(put in bix) [sut ref])))) + :: + %noun ref + %void %void + == + :: + ++ gain + ~/ %gain + |= gen=gene ^- type + (chip & gen) + :: + ++ hang + ~/ %hang + |= [dab=(map term foot) rud=(map term foot)] + ^- (map term foot) + =+ goy=(~(tap by rud) ~) + =+ waf=dab + |- ^+ dab + ?@ goy + waf + ~| [%hang-on p.i.goy] + =+ yeq=(~(get by dab) p.i.goy) + ?< ?=(~ yeq) + ?- -.u.yeq + %ash + ?> ?=([%ash *] q.i.goy) + $(goy t.goy, waf (~(put by waf) p.i.goy q.i.goy)) + :: + %elm + ~|([%hang-elm p.i.goy] !!) + :: + %oak + ?> ?=([%yew *] q.i.goy) + $(goy t.goy, waf (~(put by waf) p.i.goy q.i.goy)) + :: + %yew + ?> ?=([%yew *] q.i.goy) + %= $ + goy t.goy + waf + %+ ~(put by waf) + p.i.goy + [%yew ^$(dab p.u.yeq, rud p.q.i.goy)] + == + == + :: + ++ hail + |= [dab=(map term foot) waf=(map term foot)] + =+ axe=1 + =+ dif=*(list ,[p=axis q=tool]) + |- ^+ dif + ?~ dab + ?>(?=(~ waf) dif) + =+ ^= goh + ?- dab + [* ~ ~] [p=axe q=dif] + [* ~ *] + [p=(peg axe 2) q=$(dab r.dab, waf r.waf, axe (peg axe 3))] + :: + [* * ~] + [p=(peg axe 2) q=$(dab l.dab, waf l.waf, axe (peg axe 3))] + :: + [* * *] + :- p=(peg axe 2) + ^= q + %= $ + dif $(dab l.dab, waf l.waf, axe (peg axe 6)) + dab r.dab + waf r.waf + axe (peg axe 7) + == + == + ?> =(p.n.dab p.n.waf) + ?: =(q.n.dab q.n.waf) + q.goh + :- :- p.goh + :- %1 + ?+ -.q.n.waf !! + %ash q:(mint %noun p.q.n.waf) + %yew (harp p.q.n.waf) + == + q.goh + :: + ++ harp + |= dab=(map term foot) + ^- ?(~ ^) + ?: ?=(~ dab) + ~ + =+ ^= vad + ?+ -.q.n.dab !! + %ash q:(mint %noun p.q.n.dab) + %elm q:(mint(vet |) %noun p.q.n.dab) + == + ?- dab + [* ~ ~] vad + [* ~ *] [vad $(dab r.dab)] + [* * ~] [vad $(dab l.dab)] + [* * *] [vad $(dab l.dab) $(dab r.dab)] + == + :: + ++ heir + ~/ %heir + |= rud=(map term foot) ^- type + ?. ?=([%core *] sut) + $(sut repo) + ?. |(!vet =(%gold p.q.sut)) + ~|(%heir-metl !!) + sut(q.r.q (hang q.r.q.sut rud), q.q p.sut) :: XX handle elm + :: + ++ lose + ~/ %lose + |= gen=gene ^- type + (chip | gen) + :: + ++ chip + ~/ %chip + |= [way=? gen=gene] ^- type + ?: ?=([%wtcn *] gen) + (cull way p:(seek %read ~(rake ap q.gen)) (play p.gen)) + ?: ?&(way ?=([%wtpm *] gen)) + |-(?@(p.gen sut $(p.gen t.p.gen, sut ^$(gen i.p.gen)))) + ?: ?&(!way ?=([%wtbr *] gen)) + |-(?@(p.gen sut $(p.gen t.p.gen, sut ^$(gen i.p.gen)))) + =+ neg=~(open ap gen) + ?:(=(neg gen) sut $(gen neg)) + :: + ++ heal + ~/ %heal + |= [qog=(unit term) axe=axis ref=type] + ^- type + ?: =(1 axe) + ?@ qog + ref + |- ^- type + ?- sut + [%core *] ref + [%face *] ?.(=(u.qog p.sut) ~|('heal-name' !!) (face p.sut ref)) + [%fork *] (fork $(sut p.sut) $(sut q.sut)) + [%hold *] $(sut repo) + * ~|([%name u.qog] ~|('heal-name' !!)) + == + =+ [now=(cap axe) lat=(mas axe)] + =+ gil=*(set type) + |- ^- type + ?- sut + [%atom *] %void + [%cell *] + ?: =(2 now) + (cell ^$(sut p.sut, axe lat) q.sut) + (cell p.sut ^$(sut q.sut, axe lat)) + :: + [%core *] + ?. =(3 now) + ~|(%heal-core !!) + (core ^$(sut p.sut, axe lat) q.sut) + :: + [%fork *] (fork $(sut p.sut) $(sut q.sut)) + [%hold *] + ?:((~(has in gil) sut) %void $(gil (~(put in gil) sut), sut repo)) + :: + * $(sut repo) + == + :: + ++ mint + ~/ %mint + |= [gol=type gen=gene] + ^- [p=type q=tool] + |^ ^- [p=type q=tool] + ?: ?&(=(%void sut) !?=([%zpcb *] gen)) + ?. |(!vet ?=([%zpfs *] gen) ?=([%zpzp *] gen)) + ~|(%mint-vain !!) + [%void %0 0] + ?- gen + :: + [^ *] + =+ hed=$(gen p.gen, gol %noun) + =+ tal=$(gen q.gen, gol %noun) + [(nice (cell p.hed p.tal)) (cons q.hed q.tal)] + :: + [%brcn *] (grow %gold [~ 1] p.gen) + [%brcl *] + ~| %brcl + =+ heq=$(gen p.gen) + =+ cow=|-(?:(?=([%core *] p.heq) p.heq $(p.heq repo(sut p.heq)))) + ?. |(!vet =(%gold p.q.cow)) + ~|(%heir-metl !!) + =+ vir=(hang q.r.q.cow q.gen) + =+ nep=cow(q.r.q vir, q.q p.cow) + =+ bop=cow(p q.q.cow) + ?> |(!vet (nest(sut (wrap(sut bop) %zinc)) & (wrap(sut nep) %zinc))) + :- (nice nep) + :+ %8 + q.heq + :- (hike 4 (hail(sut nep) q.r.q.cow vir)) + [%0 5] + :: + [%cnts *] + =+ lar=(foil (seek %read p.gen)) + =+ mew=(swab q.gen) + =- [(nice p.yom) ?:(=(0 p.q.lar) q.yom [%9 p.q.lar q.yom])] + ^= yom + =+ hej=*(list ,[p=axis q=tool]) + |- ^- [p=type q=tool] + ?@ mew + [(fire q.q.lar) (hike p.lar hej)] + =+ zil=^$(gen q.i.mew, gol %noun) + =+ wip=(tock p.i.mew p.zil q.q.lar) + $(mew t.mew, q.q.lar q.wip, hej [[p.wip q.zil] hej]) + :: + [%dtkt *] [(nice %noun) [%11 q:$(gen p.gen, gol %noun)]] + [%dtls *] [(nice [%atom %$]) [%4 q:$(gen p.gen, gol [%atom %$])]] + [%dtpt *] [(nice (play gen)) [%1 q.gen]] + [%dtsg *] [(nice (play gen)) [%1 q.gen]] + [%dttr *] + [(nice %noun) [%2 q:$(gen p.gen, gol %noun) q:$(gen q.gen, gol %noun)]] + :: + [%dtts *] + [(nice bean) [%5 q:$(gen p.gen, gol %noun) q:$(gen q.gen, gol %noun)]] + :: + [%dtwt *] [(nice bean) [%3 q:$(gen p.gen, gol %noun)]] + [%ktbr *] =+(vat=$(gen p.gen) [(wrap(sut p.vat) %iron) q.vat]) + [%ktdt *] $(gen (snap(sut (play p.gen)) q.gen)) + [%ktls *] + =+(hif=(nice (play p.gen)) [hif q:$(gen q.gen, gol hif)]) + :: + [%ktpm *] =+(vat=$(gen p.gen) [(wrap(sut p.vat) %zinc) q.vat]) + [%ktsg *] + =+ nef=$(gen p.gen) + =+ moc=(mink [burn q.nef] |=(* ~)) + [p.nef ?:(?=(0 -.moc) [%1 p.moc] q.nef)] + :: + [%ktts *] =+(vat=$(gen q.gen) [(face p.gen p.vat) q.vat]) + [%ktwt *] =+(vat=$(gen p.gen) [(wrap(sut p.vat) %lead) q.vat]) + :: + [%sggr *] + =+ hum=$(gen q.gen) + :- p.hum + :+ %10 + ?- p.gen + @ p.gen + ^ [p.p.gen q:$(gen q.p.gen, gol %noun)] + == + q.hum + :: + [%tsgr *] + =+ fid=$(gen p.gen, gol %noun) + =+ dov=$(sut p.fid, gen q.gen) + [p.dov (comb q.fid q.dov)] + :: + [%wtcl *] + =+ nor=$(gen p.gen, gol bean) + =+ fex=(gain p.gen) + =+ wux=(lose p.gen) + =+ ^= duy + ?: =(%void fex) + ?:(=(%void wux) [%0 0] [%1 1]) + ?:(=(%void wux) [%1 0] q.nor) + =+ hiq=$(sut fex, gen q.gen) + =+ ran=$(sut wux, gen r.gen) + [(fork p.hiq p.ran) (cond duy q.hiq q.ran)] + :: + [%wtcn *] + [(nice bean) (fish(sut (play p.gen)) (cove q:$(gen q.gen, gol %noun)))] + :: + [%zpcb *] + ~! (show %o p.gen) + =+ hum=$(gen q.gen) + [p.hum [%10 [%spot %1 p.gen] q.hum]] + :: + [%zpcm *] [(nice (play p.gen)) [%1 q.gen]] + [%zpcn ~] =+(pet=seed [(nice p.pet) [%1 q.pet]]) + [%zpfs *] + ?: vet + ~! (dunk(sut (play p.gen)) 'lost') + ~|(%mint-lost !!) + [%void [%0 0]] + :: + [%zpsm *] + =+ vos=$(gol %noun, gen q.gen) :: XX validate! + [(nice (cell (play p.gen) p.vos)) (cons [%1 p.vos] q.vos)] + :: + [%zpts *] [(nice %noun) [%1 q:$(vet |, gen p.gen)]] + [%zpzp ~] [%void [%0 0]] + * + =+ doz=~(open ap gen) + ?: =(doz gen) + ~! (show [%c 'gene'] [%q gen]) + ~|(%mint-open !!) + $(gen doz) + == + :: + ++ nice + |= typ=type + ~| %mint-nice + ?> ?|(!vet (nest(sut gol) & typ)) + typ + :: + ++ grow + |= [mel=?(%gold %iron %lead %zinc) ruf=gene dab=(map term foot)] + ^- [p=type q=tool] + =+ dan=^$(gen ruf, gol %noun) + =+ toc=(core p.dan [%gold p.dan [~ dab]]) + =+ dez=(harp(sut toc) dab) + :- (nice (core p.dan mel p.dan [dez dab])) + (cons [%1 dez] q.dan) + -- + :: + ++ moot + =+ gil=*(set type) + |- ^- ? + ?- sut + [%atom *] | + [%cell *] |($(sut p.sut) $(sut q.sut)) + [%core *] $(sut p.sut) + [%cube *] | + [%face *] $(sut q.sut) + [%fork *] &($(sut p.sut) $(sut q.sut)) + [%hold *] |((~(has in gil) sut) $(gil (~(put in gil) sut), sut repo)) + %noun | + %void & + == + :: + ++ mull + ~/ %mull + |= [gol=type dox=type gen=gene] + ^- ? + ?. vet + & + =< & + |^ ^- [p=type q=type] + ?: =(%void sut) + ~|(%mull-none !!) + ?- gen + :: + [^ *] + =+ hed=$(gen p.gen, gol %noun) + =+ tal=$(gen q.gen, gol %noun) + [(nice (cell p.hed p.tal)) (cell q.hed q.tal)] + :: + [%brcn *] (grow %gold [~ 1] p.gen) + [%brcl *] + =+ gaf=$(gen p.gen, gol %noun) + =+ toc=[p=(heir(sut p.gaf) q.gen) q=(heir(sut q.gaf) q.gen)] + ?> (nest(sut (wrap(sut p.gaf) %zinc)) & (wrap(sut p.toc) %zinc)) + =+ (bake(sut p.toc, dox q.toc) q.gen) + [(nice p.toc) q.toc] + :: + [%cnts *] + =+ lar=(foil (seek %read p.gen)) + =+ vug=(foil (seek(sut dox) %read p.gen)) + ?. &(=(p.lar p.vug) =(p.q.lar p.q.vug)) + ~|(%mull-bonk-e !!) + =+ mew=(swab q.gen) + =- [(nice (fire p.yom)) (fire(vet |) q.yom)] + ^= yom + |- ^- [p=(list ,[p=type q=foot]) q=(list ,[p=type q=foot])] + ?@ mew + [q.q.lar q.q.vug] + =+ zil=^$(gen q.i.mew, gol %noun) + =+ cuf=(tock p.i.mew p.zil q.q.lar) + =+ dof=(tock p.i.mew q.zil q.q.vug) + ?. .=(p.cuf p.dof) + ~|(%mull-bonk-f !!) + $(mew t.mew, q.q.lar q.cuf, q.q.vug q.dof) + :: + [%dtkt *] =+($(gen p.gen, gol %noun) (both %noun)) + [%dtls *] =+($(gen p.gen, gol [%atom %$]) (both [%atom %$])) + [%dtpt *] (both (play gen)) + [%dtsg *] (both (play gen)) + [%dttr *] + =+([$(gen p.gen, gol %noun) $(gen q.gen, gol %noun)] (both %noun)) + :: + [%dtts *] + =+([$(gen p.gen, gol %noun) $(gen q.gen, gol %noun)] (both bean)) + :: + [%dtwt *] =+($(gen p.gen, gol %noun) (both bean)) :: XX =| + [%ktbr *] + =+(vat=$(gen p.gen) [(wrap(sut p.vat) %iron) (wrap(sut q.vat) %iron)]) + :: + [%ktdt *] + =+ wiv=[p=(play p.gen) q=(play(sut dox) p.gen)] + =+ hef=[p=(snap(sut p.wiv) q.gen) q=(snap(sut q.wiv) q.gen)] + ?: =(p.hef q.hef) + $(gen p.hef) + =+ zyn=$(gen p.hef) + [p.zyn (play(sut dox) q.hef)] + :: + [%ktls *] + =+ hif=[p=(nice (play p.gen)) q=(play(sut dox) p.gen)] + =+($(gen q.gen, gol p.hif) hif) + :: + [%ktpm *] + =+(vat=$(gen p.gen) [(wrap(sut p.vat) %zinc) (wrap(sut q.vat) %zinc)]) + :: + [%ktts *] + =+(vat=$(gen q.gen) [(face p.gen p.vat) (face p.gen q.vat)]) + :: + [%ktwt *] + =+(vat=$(gen p.gen) [(wrap(sut p.vat) %lead) (wrap(sut q.vat) %lead)]) + :: + [%ktsg *] $(gen p.gen) + [%sggr *] $(gen q.gen) + [%tsgr *] + =+ lem=$(gen p.gen, gol %noun) + $(gen q.gen, sut p.lem, dox q.lem) + :: + [%wtcl *] + =+ nor=$(gen p.gen, gol bean) + =+ ^= hiq ^- [p=type q=type] + =+ fex=[p=(gain p.gen) q=(gain(sut dox) p.gen)] + ?: =(%void p.fex) + [%void ?:(=(%void q.fex) %void ~|(%wtcl-z (play(sut q.fex) q.gen)))] + ?: =(%void q.fex) + ~|(%mull-bonk-b !!) + $(sut p.fex, dox q.fex, gen q.gen) + =+ ^= ran ^- [p=type q=type] + =+ wux=[p=(lose p.gen) q=(lose(sut dox) p.gen)] + ?: =(%void p.wux) + [%void ?:(=(%void q.wux) %void ~|(%wtcl-a (play(sut q.wux) r.gen)))] + ?: =(%void q.wux) + ~|(%mull-bonk-c !!) + $(sut p.wux, dox q.wux, gen r.gen) + [(nice (fork p.hiq p.ran)) (fork q.hiq q.ran)] + :: + [%wtcn *] + =+ waz=[p=(play p.gen) q=(play(sut dox) p.gen)] + =+ ^= syx :- p=(cove q:(mint %noun q.gen)) + q=(cove q:(mint(sut dox) %noun q.gen)) + =+ pov=[p=(fish(sut p.waz) p.syx) q=(fish(sut q.waz) q.syx)] + ?. &(=(p.syx q.syx) =(p.pov q.pov)) + ~|(%mull-bonk-a !!) + (both bean) + :: + [%zpcb *] ~!((show %o p.gen) $(gen q.gen)) + [%zpcm *] [(nice (play p.gen)) (play(sut dox) p.gen)] + [%zpcn ~] =+(pet=seed [(nice p.pet) p.pet]) + [%zpfs *] + ?: vet + :: ~! (dunk(sut (play p.gen)) 'also') + ~|(%mull-skip !!) + (both %void) + :: + [%zpts *] (both %noun) + [%zpsm *] + =+ vos=$(gol %noun, gen q.gen) :: XX validate! + [(nice (cell (play p.gen) p.vos)) (cell (play(sut dox) p.gen) q.vos)] + :: + [%zpzp ~] (both %void) + * + =+ doz=~(open ap gen) + ?: =(doz gen) + ~! (show [%c 'gene'] [%q gen]) + ~|(%mull-open !!) + $(gen doz) + == + :: + ++ both + |= typ=type + [(nice typ) typ] + :: + ++ nice + |= typ=type + :: ~! (dunk(sut gol) 'need') + :: ~! (dunk(sut typ) 'have') + ~| %mull-nice + ?> ?|(!vet (nest(sut gol) & typ)) + typ + :: + ++ grow + |= [mel=?(%gold %iron %lead %zinc) ruf=gene dab=(map term foot)] + ~| %mull-grow + ^- [p=type q=type] + =+ dan=^$(gen ruf, gol %noun) + =+ ^= toc :- p=(core p.dan [%gold p.dan [~ dab]]) + q=(core q.dan [%gold q.dan [~ dab]]) + =+ (bake(sut p.toc, dox q.toc) dab) + :- (nice (core p.dan mel p.dan [[%0 0] dab])) + (core q.dan [mel q.dan [[%0 0] dab]]) + :: + ++ bake + |= dab=(map term foot) + ^- * + ?: ?=(~ dab) + ~ + =+ ^= vad + ?+ -.q.n.dab !! + %ash ^$(gol %noun, gen p.q.n.dab) + %elm ~ + == + ?- dab + [* ~ ~] vad + [* ~ *] [vad $(dab r.dab)] + [* * ~] [vad $(dab l.dab)] + [* * *] [vad $(dab l.dab) $(dab r.dab)] + == + -- + :: + ++ meet |=(ref=type &((nest | ref) (nest(sut ref) | sut))) + ++ nest + ~/ %nest + |= [tel=? ref=type] + ^- ? + =+ gil=*(set ,[p=type q=type]) + =< dext + |% + ++ cong + ^- ? + ?> ?&(?=([%core *] sut) ?=([%core *] ref)) + ?: =(q.sut q.ref) + dext(sut p.sut, ref p.ref) + ?. ?& dext(sut q.q.sut, ref p.sut) + dext(sut p.sut, ref q.q.sut) + dext(sut q.q.ref, ref p.ref) + == + | + ?& + ?|(=(p.q.sut p.q.ref) =(%gold p.q.ref)) + :: + ?| (~(has in gil) [sut ref]) + %+ %= cram + gil (~(put in gil) [sut ref]) + sut sut(p q.q.sut) + ref ref(p q.q.ref) + == + q.r.q.sut + q.r.q.ref + == + :: + ?- p.q.sut + %gold + =+ pac=[s=q.q.sut r=q.q.ref] + ?& dext(sut s.pac, ref r.pac) + dext(sut r.pac, ref s.pac) + == + :: + %iron + =+ sam=[s=(peek(sut q.q.sut) %rite 2) r=(peek(sut q.q.ref) %rite 2)] + dext(sut r.sam, ref s.sam) + :: + %lead & + %zinc + =+ pal=[s=(peek(sut q.q.sut) %read 2) r=(peek(sut q.q.ref) %read 2)] + dext(sut s.pal, ref r.pal) + == + == + :: + ++ cram + |= [dab=(map term foot) hem=(map term foot)] + ^- ? + ?- dab + ~ =(hem ~) + ^ + ?& ?=(^ hem) + =(p.n.dab p.n.hem) + $(dab l.dab, hem l.hem) + $(dab r.dab, hem r.hem) + ?- -.q.n.dab + %ash + ?& ?=(%ash -.q.n.hem) + dext(sut (play p.q.n.dab), ref (play(sut ref) p.q.n.hem)) + == + %elm =(q.n.dab q.n.hem) + %oak ?=(?(%oak %yew) -.q.n.hem) + %yew + ?& ?=(%yew -.q.n.hem) + $(dab p.q.n.dab, hem p.q.n.hem) + == + == + == + == + :: + ++ dext + ^- ? + =- ?: tyn + & + ?: tel + :: ~! (dunk %need) + :: ~! (dunk(sut ref) %have) + ~|(%type-fail !!) + | + ^= tyn + ?: =(sut ref) + & + ?- sut + %void sint + %noun & + :: + [%atom *] + ?. ?=([%atom *] ref) + sint + (fitz p.sut p.ref) + :: + [%cell *] + ?. ?=([%cell *] ref) + sint + ?& + dext(sut p.sut, ref p.ref) + dext(sut q.sut, ref q.ref) + == + :: + [%core *] + ?. ?=([%core *] ref) + sint + cong + :: + [%cube *] + ?: ?=([%cube *] ref) + =(p.sut p.ref) + sint + :: + [%face *] dext(sut q.sut) + [%fork *] + ?. ?=(?([%atom *] %noun [%cell *] [%cube *] [%core *]) ref) + sint + ?|(dext(tel |, sut p.sut) dext(tel |, sut q.sut)) + :: + [%hold *] + ?| + (~(has in gil) [sut ref]) + dext(gil (~(put in gil) [sut ref]), sut repo) + == + == + :: + ++ sint + ^- ? + ?- ref + [%atom *] | + [%cell *] | + [%fork *] ?&(dext(ref p.ref) dext(ref q.ref)) + [%hold *] + ?| + (~(has in gil) [sut ref]) + dext(gil (~(put in gil) [sut ref]), ref repo(sut ref)) + == + :: + %noun | + %void & + * dext(ref repo(sut ref)) + == + -- + :: + ++ park + ~/ %park + |= [way=?(%read %rite) axe=axis] + ^- ? + ?> ?=([%core *] sut) + ?| + !vet + ?- way + %read + ?- p.q.sut + %gold & + %iron | + %lead | + %zinc =(2 (cap axe)) + == + :: + %rite + ?- p.q.sut + %gold & + %iron =(2 (cap axe)) + %lead | + %zinc | + == + == + == + :: + ++ peek + ~/ %peek + |= [way=?(%read %rite) axe=axis] + ^- type + ?: =(1 axe) + sut + =+ [now=(cap axe) lat=(mas axe)] + =+ gil=*(set type) + |- ^- type + ?- sut + [%atom *] %void + [%cell *] ?:(=(2 now) ^$(sut p.sut, axe lat) ^$(sut q.sut, axe lat)) + [%core *] + ?: =(3 now) + ?. (park way lat) + :: ~! (dunk 'type') + ~! (show [%c 'axis'] [%d axe]) + ~|(%peek-park !!) + ^$(sut p.sut, axe lat) + %noun + :: + [%fork *] (fork $(sut p.sut) $(sut q.sut)) + [%hold *] + ?: (~(has in gil) sut) + %void + $(gil (~(put in gil) sut), sut repo) + :: + %void %void + %noun %noun + * $(sut repo) + == + :: + ++ play + ~/ %play + => .(vet |) + |= gen=gene + ?- gen + [^ *] (cell $(gen p.gen) $(gen q.gen)) + [%brcl *] (heir(sut $(gen p.gen)) q.gen) + [%brcn *] (core sut %gold sut [[%0 0] p.gen]) + [%cnts *] =+ lar=(foil (seek %read p.gen)) + =+ mew=(swab q.gen) + =+ rag=q.q.lar + %- fire + |- ^- (list ,[p=type q=foot]) + ?@ mew + rag + $(mew t.mew, rag q:(tock p.i.mew ^$(gen q.i.mew) rag)) + [%dtkt *] %noun + [%dtls *] [%atom %$] + [%dtpt *] ?:(=(%f p.gen) ?>((lte q.gen 1) bean) [%atom p.gen]) + [%dtsg *] [%cube q.gen ?:(.?(q.gen) %noun [%atom p.gen])] + [%dttr *] %noun + [%dtts *] bean + [%dtwt *] bean + [%ktbr *] (wrap(sut $(gen p.gen)) %iron) + [%ktdt *] $(gen (snap(sut $(gen p.gen)) q.gen)) + [%ktls *] $(gen p.gen) + [%ktpm *] (wrap(sut $(gen p.gen)) %zinc) + [%ktsg *] $(gen p.gen) + [%ktts *] (face p.gen $(gen q.gen)) + [%ktwt *] (wrap(sut $(gen p.gen)) %lead) + [%sggr *] $(gen q.gen) + [%tsgr *] $(gen q.gen, sut $(gen p.gen)) + [%wtcl *] =+ [fex=(gain p.gen) wux=(lose p.gen)] + %+ fork + ?:(=(%void fex) %void $(sut fex, gen q.gen)) + ?:(=(%void wux) %void $(sut wux, gen r.gen)) + [%wtcn *] bean + [%zpcb *] ~!((show %o p.gen) $(gen q.gen)) + [%zpcm *] (play p.gen) + [%zpcn ~] p:seed + [%zpfs *] %void + [%zpsm *] (cell $(gen p.gen) $(gen q.gen)) + [%zpts *] %noun + [%zpzp ~] %void + * =+ doz=~(open ap gen) + ?: =(doz gen) + ~! (show [%c 'gene'] [%q gen]) + ~|(%play-open !!) + $(gen doz) + == + :: + ++ reco + |* fuy=_|=(p=type p) + =+ por=repo + =+ yot=(fuy por) + ?: =(yot por) + ?:(=(%void por) por sut) + yot + :: + ++ repo + ^- type + ?- sut + [%core *] [%cell %noun p.sut] + [%cube *] q.sut + [%face *] q.sut + [%hold *] (rest p.sut) + %noun [%fork [%atom %$] [%cell %noun %noun]] + * ~|(%repo-fltt !!) + == + :: + ++ rest + ~/ %rest + |= leg=(list ,[p=type q=gene]) + ^- type + ?: (lien leg |=([p=type q=gene] (~(has in fan) [p q]))) + ~|(%rest-loop !!) + => .(fan (~(gas in fan) leg)) + %+ roll + %- %~ tap + in + %- ~(gas in *(set type)) + (turn leg |=([p=type q=gene] (play(sut p) q))) + ~ + =+([p=*type q=`type`%void] |.((fork p q))) + :: + ++ silk + |= [syx=term tor=port] + ^- (unit port) + ~| %silk + ?- -.q.tor + & ~ + | + =+ ^= hey ^- (list ,[p=axis q=foot]) + |- ?~ q.q.tor + ~ + =+ yon=$(q.q.tor t.q.q.tor) + ?. ?=([%yew *] q.i.q.q.tor) + yon + [(need (look syx p.q.i.q.q.tor)) yon] + ?: =(~ hey) + ~ + ?> =((lent hey) (lent q.q.tor)) + =+ ^= yaw + =+ yaw=p.i.hey + |-(?~(t.hey yaw ?>(=(p.i.t.hey yaw) $(t.hey t.t.hey)))) + :- ~ + :- p.tor + :+ %| + (peg p.q.tor yaw) + |- ^- (list ,[p=type q=foot]) + ?~ q.q.tor + ~ + ?< ?=(~ hey) + [[p.i.q.q.tor q.i.hey] $(q.q.tor t.q.q.tor, hey t.hey)] + == + :: + ++ seek + ~/ %seek + |= [way=?(%read %rite) hyp=wing] + ^- port + ?@ hyp + [1 %& sut] + => .(i.hyp ?^(i.hyp i.hyp [%| p=0 q=i.hyp])) + =+ zar=$(hyp t.hyp) + =+ sic=?.(?=([| *] i.hyp) ~ (silk q.i.hyp zar)) + ?. ?=(~ sic) + u.sic + =+ ^= syp + ?- -.q.zar + & p.q.zar + | (fire (turn q.q.zar |=([p=type q=foot] [p [%ash ~ 1]]))) + == + ?- i.hyp + [& *] + [(peg p.zar p.i.hyp) %& (peek(sut syp) way p.i.hyp)] + :: + [| *] + => .(sut syp) + =+ hud=(fink p.i.hyp way q.i.hyp) + [(peg p.zar p.hud) q.hud] + == + :: + ++ snap + ~/ %snap + |= gen=gene + ^- gene + ?- sut + [%cell *] =+ haq=~(hack ap gen) + ?- -.haq + | p.haq + & :- $(sut p.sut, gen p.haq) + $(sut q.sut, gen q.haq) + == + [%cube *] $(sut repo) + [%face *] [%ktts p.sut $(sut q.sut)] + [%fork *] =+ haq=~(hack ap gen) + ?- -.haq + | p.haq + & :- $(sut (peek %read 2), gen p.haq) + $(sut (peek %read 3), gen q.haq) + == + [%hold *] $(sut repo) + * gen + == + :: + ++ swab + ~/ %swab + |= har=(list ,[p=gene q=gene]) + ^- (list ,[p=wing q=gene]) + %+ turn + har + |=([a=gene b=gene] [(flop ~(rake ap a)) b]) + :: + ++ tack + ~/ %tack + |= [peh=wing mur=type] + =+ axe=1 + |- ^- [p=axis q=type] + ?@ peh + [axe mur] + => .(i.peh ?^(i.peh i.peh [%| p=0 q=i.peh])) + ?- i.peh + [& *] + =+ vas=(peek %rite p.i.peh) + =+ gav=$(peh t.peh, sut vas, axe (peg axe p.i.peh)) + [p.gav (heal ~ p.i.peh q.gav)] + :: + [| *] + =+ wuf=(flay (fink p.i.peh %rite q.i.peh)) + =+ gav=$(peh t.peh, sut q.wuf, axe (peg axe p.wuf)) + [p.gav (heal [~ q.i.peh] p.wuf q.gav)] + == + :: + ++ tock + ~/ %tock + |= [peh=wing mur=type men=(list ,[p=type q=foot])] + ^- [p=axis q=(list ,[p=type q=foot])] + =- [(need p.wib) q.wib] + ^= wib + |- ^- [p=(unit axis) q=(list ,[p=type q=foot])] + ?@ men + [*(unit axis) ~] + =+ geq=(tack(sut p.i.men) peh mur) + =+ mox=$(men t.men) + [(mate p.mox `_p.mox`[~ p.geq]) [[q.geq q.i.men] q.mox]] + :: + ++ wrap + ~/ %wrap + |= yoz=?(%lead %iron %zinc) + ^- type + ?- sut + [%core *] ?.(=(%gold p.q.sut) ~|(%wrap-metl !!) sut(p.q yoz)) + [%fork *] (fork $(sut p.sut) $(sut q.sut)) + [%hold *] $(sut repo) + * ~|(%wrap-type !!) + == + -- +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 2fD, grammar :: +:: +++ vang + |= [bug=? wer=path] + %*(. vast bug bug, wer wer) +:: +++ vast + =+ [bug=`?`| was=*(set path) wer=*path] + |% + ++ gash %+ cook + |= a=(list goon) ^- goon + ?~(a ~ (weld i.a $(a t.a))) + (more fas gasp) + ++ gasp ;~ pose + %+ cook + |=([a=goon b=goon c=goon] :(weld a b c)) + ;~ plug + (cook |=(a=(list) (turn a |=(b=* ~))) (star tis)) + (cook |=(a=gene [[~ a] ~]) hasp) + (cook |=(a=(list) (turn a |=(b=* ~))) (star tis)) + == + (cook |=(a=(list) (turn a |=(b=* ~))) (plus tis)) + == + ++ glam ~+((glue ace)) + ++ hasp ;~ pose + (ifix [sel ser] wide) + (stag %cnhp (ifix [pel per] (most ace wide))) + %+ cook + |=(a=coin [%dtpt ?:(?=([~ %tas *] a) %tas %ta) ~(rent co a)]) + nuck:so + == + ++ mota %+ cook + |=([a=tape b=tape] (rap 3 (weld a b))) + ;~(plug (star low) (star hig)) + :: + ++ plex + |= gen=gene ~| [%plex gen] ^- path + ?: ?=([%zpcb *] gen) + $(gen q.gen) + ?> ?=([%clsg *] gen) + (turn p.gen |=(a=gene ?>(?=(%dtpt -.a) q.a))) + :: + ++ pray + |= gen=gene ~| %pray ^- gene + =+ rev=(plex gen) + ?: (~(has in was) rev) + ~|(%pray-loop !!) + =+ txt=(,@ta .^(%cx (weld rev `path`[%hoon ~]))) + %+ rash txt + (ifix [gay gay] tall(was (~(put in was) rev), wer rev)) + :: + ++ prey + |= gun=(list gene) ^- gene + ?~ gun [~ 1] + ?~ t.gun (pray i.gun) + [%tsgr (pray i.gun) $(gun t.gun)] + :: + ++ phax + |= ruw=(list (list beer)) + =+ [yun=*(list gene) cah=*(list ,@)] + =+ wod=|=([a=tape b=(list gene)] ^+(b ?~(a b [[%clfs %smdq (flop a)] b]))) + |- ^+ yun + ?~ ruw + (flop (wod cah yun)) + ?~ i.ruw $(ruw t.ruw) + ?@ i.i.ruw + $(i.ruw t.i.ruw, cah [i.i.ruw cah]) + $(i.ruw t.i.ruw, cah ~, yun [p.i.i.ruw (wod cah yun)]) + :: + ++ posh + |= [pre=(unit goon) pof=(unit ,[p=@ud q=goon])] + ^- (list gene) + ~| %posh-fail + =+ wom=(poof wer) + =+ ^= yez + ?~ pre wom + =+ moz=(poon wom u.pre) + ?~(pof moz (weld moz (slag (lent u.pre) wom))) + ?~ pof yez + =+ zey=(flop yez) + =+ [moz=(scag p.u.pof zey) gul=(slag p.u.pof zey)] + (weld (flop gul) (poon (flop moz) q.u.pof)) + :: + ++ poof |=(pax=path ^-(gens (turn pax |=(a=@ta [%dtpt %ta a])))) + ++ poon + |= [pag=gens goo=goon] + ^- gens + ?~ goo ~ + :- ?^(i.goo u.i.goo ?>(?=(^ pag) i.pag)) + $(goo t.goo, pag ?~(pag ~ t.pag)) + :: + ++ poor + %+ cook posh + ;~ plug + (stag ~ gash) + ;~(pose (stag ~ ;~(pfix cen porc)) (easy ~)) + == + :: + ++ porc + ;~ plug + (cook |=(a=(list) (lent a)) (star cen)) + ;~(pfix fas gash) + == + :: + ++ rood + ;~ pfix fas + (stag %clsg poor) + == + ++ scat + %+ knee *gene |. ~+ + %- stew :~ + :- '!' + ;~ pose + (stag %wtzp ;~(pfix zap wide)) + (stag %zpzp (cold ~ ;~(plug zap zap))) + (stag %zpcn (cold ~ ;~(plug zap cen))) + == + :- '$' + (cook |=(a=wing [%cnts a ~]) rope) + :- '%' + ;~ pfix cen + ;~ pose + (cook |=([a=@ud b=goon] [%clsg (posh ~ ~ a b)]) porc) + (stag %dtsg (stag %ta (cold %$ buc))) + (stag %dtsg (stag %f (cold & pam))) + (stag %dtsg (stag %f (cold | bar))) + (stag %dtsg (stag %ta qut)) + (stag %clcn (ifix [sel ser] (most ace wide))) + (cook (jock &) nuck:so) + (cook |=(a=(list) [%clsg (posh ~ ~ (lent a) ~)]) (star cen)) + :: (easy [%clsg (poof wer)]) + == + == + :- '&' + ;~ pose + (cook |=(a=wing [%cnts a ~]) rope) + (stag %wtpm ;~(pfix pam (ifix [pel per] (most ace wide)))) + :: (stag %bccb (stag %ktpm ;~(pfix pam wide))) + (stag %dtpt (stag %f (cold & pam))) + == + :- '\'' + (stag %dtpt (stag %ta qut)) + :- '(' + (stag %cnhp (ifix [pel per] (most ace wide))) + :- '*' + ;~ pose + (stag %bctr ;~(pfix tar wide)) + (stag %bcts (cold %noun tar)) + == + :- '+' + ;~ pose + (stag %dtls ;~(pfix lus (ifix [pel per] wide))) + :: + %+ cook + |= a=(list (list beer)) + :- %clfs + [%smdq |-(?~(a ~ (weld i.a $(a t.a))))] + (most dog ;~(pfix lus soil)) + :: + (cook |=(a=wing [%cnts a ~]) rope) + == + :- '-' + ;~ pose + (stag %dtpt tash:so) + :: + %+ cook + |= a=(list (list beer)) + [%clzp (phax a)] + :: [%smhx |-(?~(a ~ (weld i.a $(a t.a))))] + (most dog ;~(pfix hep soil)) + :: + (cook |=(a=wing [%cnts a ~]) rope) + == + :- '.' + ;~ pose + (stag %dtpt ;~(pfix dot zust:so)) + (cook |=(a=wing [%cnts a ~]) rope) + == + :- ['0' '9'] + (stag %dtpt bisk:so) + :- ':' + (stag %smcl ;~(pfix col (ifix [pel per] (most ace wide)))) + :- '=' + (stag %dtts ;~(pfix tis (ifix [pel per] ;~(glam wide wide)))) + :- '?' + ;~ pose + (stag %bcwt ;~(pfix wut (ifix [pel per] (most ace wide)))) + (stag %bcts (cold %bean wut)) + == + :- '@' + ;~(pfix pat (stag %bcts (stag %atom mota))) + :- '[' + %+ stag + %cltr + ;~ pfix sel + %+ cook + |= [a=(list gene) b=?(~ [~ ~])] + ?~(b a (weld a `_a`[[%bcts %null] ~])) + ;~ plug + ;~ pose + (ifix [ace gap] (most gap tall)) + (most ace wide) + == + ;~ pose + (cold [~ ~] ;~(plug (just ']') (just '~'))) + (cold ~ (just ']')) + == + == + == + :- ',' + (stag %bccm ;~(pfix com wide)) + :- '^' + ;~ pose + ;~ pfix ket + ;~ pose + ;~ pfix col + %+ cook + |= [a=gene b=gene] :: XX shd be static + =+ rev=(plex b) + :+ %smsm ~(clam al ~(bore ap a)) + [%dtkt %dtsg %$ %cx rev] + ;~(plug wide rood) + == + (cook prey (most ket rood)) + == + == + (stag %cnhx rope) + (stag %bcts (cold %cell ket)) + == + :- '_' + (stag %bccb ;~(pfix cab wide)) + :- '`' + ;~ pfix tec + ;~ pose + %+ cook + |=([a=@ta b=gene] [%ktls [%dtpt a 0] [%ktls [%dtpt %$ 0] b]]) + ;~(pfix pat ;~(plug mota ;~(pfix tec wide))) + (stag %kthp ;~(plug wide ;~(pfix tec wide))) + == + == + :- '"' + %+ cook + |= a=(list (list beer)) + [%smdq |-(?~(a ~ (weld i.a $(a t.a))))] + (most dog soil) + :- ['a' 'z'] + %+ sear + |= [a=wing b=(unit gene)] ^- (unit gene) + ?~(b [~ %cnhx a] ?.(?=([@ ~] a) ~ [~ [%dtsg %tas i.a] u.b])) + ;~(plug rope ;~(pose (stag ~ ;~(pfix fas wide)) (easy ~))) + :- '|' + ;~ pose + (cook |=(a=wing [%cnts a ~]) rope) + (stag %wtbr ;~(pfix bar (ifix [pel per] (most ace wide)))) + (stag %dtpt (stag %f (cold | bar))) + == + :- '~' + ;~ pose + %+ cook + |= a=(list (list beer)) + :_ [%bcts %null] + :- %clfs + [%smdq |-(?~(a ~ (weld i.a $(a t.a))))] + (most dog ;~(pfix sig soil)) + :: + ;~ pfix sig + ;~ pose + (stag %clsg (ifix [sel ser] (most ace wide))) + :: + %+ stag %cnsg + %+ ifix + [pel per] + ;~(glam rope wide (stag %cltr (most ace wide))) + :: + (cook (jock |) twid:so) + (easy [%bcts %null]) + == + == + == + :- '/' + rood + :- '<' + (ifix [gal gar] (stag %hxgl (most ace wide))) + :- '>' + (ifix [gar gal] (stag %hxgr (most ace wide))) + == + ++ soil + %+ ifix + [doq doq] + %- star + ;~ pose + ;~(pfix bas ;~(pose bas doq kel bix:ab)) + ;~ pose + (shim 32 33) + (shim 35 91) + (shim 93 122) + (shim 124 126) + (shim 128 255) + == + (stag ~ (ifix [kel ker] (stag %cltr (most ace wide)))) + == + ++ norm + |= tol=? + =< %- stew + :~ :- '|' + ;~ pfix bar + %- stew :~ + ['|' (rune bar %brbr expb)] + ['_' (rune cab %brcb expr)] + ['%' (rune cen %brcn expe)] + [':' (rune col %brcl expr)] + ['.' (rune dot %brdt expa)] + ['-' (rune hep %brhp expa)] + ['^' (rune ket %brkt expr)] + ['+' (rune lus %brls expb)] + ['*' (rune tar %brtr expb)] + ['=' (rune tis %brts expb)] + ['?' (rune wut %brwt expa)] + == + == + :- '%' + ;~ pfix cen + %- stew :~ + ['_' (rune cab %cncb expj)] + [':' (rune col %cncl expb)] + ['.' (rune dot %cndt expb)] + ['^' (rune ket %cnkt expf)] + ['+' (rune lus %cnls expc)] + ['-' (rune hep %cnhp expk)] + ['~' (rune sig %cnsg expq)] + ['*' (rune tar %cntr expp)] + ['=' (rune tis %cnts expj)] + == + == + :- '$' + ;~ pfix buc + %- stew :~ + ['|' (rune bar %bcbr expb)] + ['_' (rune cab %bccb expa)] + [':' (rune col %bccl exps)] + ['%' (rune cen %bccn exps)] + [',' (rune com %bccm expa)] + ['&' (rune pam %bcpm expb)] + ['?' (rune wut %bcwt exps)] + == + == + :- ':' + ;~ pfix col + %- stew :~ + ['_' (rune cab %clcb expb)] + ['~' (rune cen %clcn exps)] + ['/' (rune fas %clfs expa)] + ['^' (rune ket %clkt expf)] + ['+' (rune lus %clls expc)] + ['-' (rune hep %clhp expb)] + ['~' (rune sig %clsg exps)] + ['*' (rune tar %cltr exps)] + == + == + :- '.' + ;~ pfix dot + %- stew :~ + ['+' (rune lus %dtls expa)] + ['*' (rune tar %dttr expb)] + ['=' (rune tis %dtts expb)] + ['?' (rune wut %dtwt expa)] + ['^' (rune ket %dtkt expn)] + == + == + :- '#' + ;~ pfix hax + %- stew :~ + ['<' (rune gal %hxgl exps)] + ['>' (rune gar %hxgr exps)] + == + == + :- '^' + ;~ pfix ket + %- stew :~ + ['|' (rune bar %ktbr expa)] + ['.' (rune dot %ktdt expb)] + ['-' (rune hep %kthp expb)] + ['+' (rune lus %ktls expb)] + ['&' (rune pam %ktpm expa)] + ['~' (rune sig %ktsg expa)] + ['=' (rune tis %ktts expg)] + ['?' (rune wut %ktwt expa)] + == + == + :- '~' + ;~ pfix sig + %- stew :~ + ['|' (rune bar %sgbr expb)] + ['$' (rune buc %sgbc expg)] + ['%' (rune cen %sgcn hind)] + [':' (rune col %sgcl hina)] + ['/' (rune fas %sgfs hine)] + ['<' (rune gal %sggl hinb)] + ['>' (rune gar %sggr hinb)] + ['#' (rune hax %sghx expg)] + ['^' (rune ket %sgkt expb)] + ['+' (rune lus %sgls hinc)] + ['&' (rune pam %sgpm hinf)] + ['=' (rune tis %sgts expb)] + ['!' (rune zap %sgzp expb)] + == + == + :- ';' + ;~ pfix sem + %- stew :~ + ['_' (rune cab %smcb expb)] + [',' (rune com %smcm expi)] + ['%' (rune cen %smcn exps)] + [':' (rune col %smcl expi)] + ['.' (rune dot %smdt expi)] + ['<' (rune gal %smgl expc)] + ['>' (rune gar %smgr expc)] + ['-' (rune hep %smhp expb)] + ['+' (rune lus %smls expb)] + ['&' (rune pam %smpm expi)] + ['~' (rune sig %smsg expi)] + [';' (rune sem %smsm expb)] + ['*' (rune tar %smtr expb)] + ['=' (rune tis %smts expb)] + ['?' (rune wut %smwt expb)] + == + == + :- '=' + ;~ pfix tis + %- stew :~ + ['|' (rune bar %tsbr expb)] + ['.' (rune dot %tsdt expc)] + ['^' (rune ket %tskt expd)] + [':' (rune col %tscl expl)] + ['<' (rune gal %tsgl expb)] + ['>' (rune gar %tsgr expb)] + ['-' (rune hep %tshp expb)] + ['+' (rune lus %tsls expb)] + ['~' (rune sig %tssg expi)] + == + == + :- '?' + ;~ pfix wut + %- stew :~ + ['|' (rune bar %wtbr exps)] + [':' (rune col %wtcl expc)] + ['.' (rune dot %wtdt expc)] + ['<' (rune gal %wtgl expb)] + ['>' (rune gar %wtgr expb)] + ['-' (rune hep %wthp exph)] + ['^' (rune ket %wtkt expc)] + ['=' (rune tis %wtts expb)] + ['+' (rune lus %wtls expm)] + ['&' (rune pam %wtpm exps)] + ['@' (rune pat %wtpt expc)] + ['~' (rune sig %wtsg expc)] + ['!' (rune zap %wtzp expa)] + == + == + :- '!' + ;~ pfix zap + %- stew :~ + [':' ;~(pfix col (toad expz))] + [',' (rune com %zpcm expb)] + [';' (rune sem %zpsm expb)] + ['^' ;~(pfix ket (cook prey (toad exps)))] + ['>' (rune gar %zpgr expa)] + ['=' (rune tis %zpts expa)] + == + == + == + |% + :: + ++ boog + %+ knee [p=*term q=*foot] |. ~+ + ;~ pfix lus + ;~ pose + %+ cook + |=([a=%ash b=term c=gene] [b a c]) + ;~ gunk + (cold %ash (just '+')) + ;~(pose (cold %$ buc) sym) + loaf + == + :: + %+ cook + |=([a=%elm b=term c=gene] [b a c]) + ;~ gunk + (cold %elm (just '-')) + ;~(pose (cold %$ buc) sym) + loaf + == + :: + %+ cook + |=([a=%oak b=term] [b a ~]) + ;~ gunk + (cold %oak (just '|')) + ;~(pose (cold %$ buc) sym) + == + == + == + :: + ++ wisp + %- ulva + %+ cook + |=(a=(list ,[p=term q=foot]) (~(gas by *(map term foot)) a)) + (most muck boog) + :: + ++ toad + |* har=_expa + =+ dur=(ifix [pel per] $:har(tol |)) + ?:(tol ;~(pose ;~(pfix gap $:har(tol &)) dur) dur) + :: + ++ rune + |* [dif=_rule tuq=* har=_expa] + ;~(pfix dif (stag tuq (toad har))) + :: + ++ glop ~+((glue mash)) + ++ gunk ~+((glue muck)) + ++ butt |*(zor=_rule ?:(tol ;~(sfix zor ;~(plug gap duz)) zor)) + ++ ulva |*(zor=_rule ?.(tol fail ;~(sfix zor ;~(plug gap dun)))) + ++ neck ;~(pose duz ;~(pfix ;~(plug duq gap) wisp)) + ++ hank (most muck loaf) + ++ loaf ?:(tol tall wide) + ++ mash ?:(tol gap ;~(plug com ace)) + ++ muck ?:(tol gap ace) + ++ rack (most mash ;~(gunk loaf loaf)) + ++ expa |.(loaf) + ++ expb |.(;~(gunk loaf loaf)) + ++ expc |.(;~(gunk loaf loaf loaf)) + ++ expd |.(;~(gunk loaf loaf loaf loaf)) + ++ exps |.((butt hank)) + ++ expl |.(;~(gunk (butt rack) loaf)) + ++ expe |.(wisp) + ++ expf |.(;~(gunk loaf loaf loaf loaf)) + ++ expg |.(;~(gunk sym loaf)) + ++ exph |.((butt ;~(gunk loaf rack))) + ++ expi |.((butt ;~(gunk loaf hank))) + ++ expj |.((butt ;~(gunk rope rack))) + ++ expk |.(;~(gunk loaf ;~(plug loaf (easy ~)))) + ++ expm |.((butt ;~(gunk loaf loaf rack))) + ++ expn |.((stag %cltr (butt hank))) + ++ expp |.((butt ;~(gunk rope loaf rack))) + ++ expq |.(;~(gunk rope loaf loaf)) + ++ expr |.(;~(gunk loaf wisp)) + ++ expz |.(loaf(bug &)) + ++ hina |.(;~(gunk (ifix [sel ser] ;~(gunk dem dem)) loaf)) + ++ hinb |.(;~(gunk bont loaf)) + ++ hinc |.(;~(pose ;~(gunk bony loaf) ;~(plug (easy ~) loaf))) + ++ hind |.(;~(gunk bonk loaf bonz loaf)) + ++ hine |.(;~(gunk bonk loaf)) + ++ hinf |. + ;~ pose + ;~(gunk (cook lent (stun [1 3] gar)) loaf loaf) + (stag 0 ;~(gunk loaf loaf)) + == + ++ bonk + ;~ pfix cen + ;~ pose + ;~(plug sym ;~(pfix col ;~(plug sym ;~(pfix dot ;~(pfix dot dem))))) + ;~(plug sym ;~(pfix col ;~(plug sym ;~(pfix dot dem)))) + ;~(plug sym ;~(pfix dot dem)) + sym + == + == + ++ bont ;~((bend) sym ;~(pfix dot ;~(pose wide ;~(pfix muck loaf)))) + ++ bony (cook |=(a=(list) (lent a)) (plus tis)) + ++ bonz + ;~ pose + (cold ~ sig) + %+ ifix + ?:(tol [p=;~(plug duz gap) q=;~(plug gap duz)] [p=pel q=per]) + (more mash ;~(gunk ;~(pfix cen sym) loaf)) + == + -- + :: + ++ lung + ~+ + %- bend + |= :- ros=gene + ^= vil + $% [%tis p=gene] + [%col p=gene] + [%ket p=gene] + [%pel p=(list ,[p=gene q=gene])] + == + ^- (unit gene) + ?- -.vil + %tis + ?- ros + [%cnbc @] [~ %ktts p.ros p.vil] + [%cnhx [@ ~]] [~ %ktts i.p.ros p.vil] + [%cnts [@ ~] ~] [~ %ktts i.p.ros p.vil] + [%zpcb *] $(ros q.ros) + * ~ + == + %col [~ %tsgl ros p.vil] + %pel [~ %cnts ~(rake ap ros) p.vil] + %ket [~ ros p.vil] + == + :: + ++ long + %+ knee *gene |. ~+ + ;~ lung + scat + ;~ pose + ;~(plug (cold %tis tis) wide) + ;~(plug (cold %col col) wide) + ;~(plug (cold %ket ket) wide) + ;~ plug + (easy %pel) + (ifix [pel per] loon) + == + == + == + :: + ++ loon (most ;~(plug com ace) ;~(glam wide wide)) + ++ rope + %+ knee + *wing + |. ~+ + %+ (slug `wing`~ |=([a=wing b=wing] (weld a b))) + dot + ;~ pose + %+ cook + |=([a=(list) b=term] [?~(a b [%| (lent a) b]) ~]) + ;~(plug (star ket) ;~(pose sym (cold %$ buc))) + :: + %+ cook + |=(a=limb [a ~]) + %+ cook + |=(a=axis [%& a]) + ;~ pose + ;~(pfix lus dim:ag) + ;~(pfix pam (cook |=(a=@ ?:(=(0 a) 0 (mul 2 +($(a (dec a)))))) dim:ag)) + ;~(pfix bar (cook |=(a=@ ?:(=(0 a) 1 +((mul 2 $(a (dec a)))))) dim:ag)) + ven + (cold 1 dot) + == + == + :: + ++ tall (knee *gene |.(~+((wart ;~(pose (norm &) long))))) + ++ wide (knee *gene |.(~+((wart ;~(pose (norm |) long))))) + ++ wart + |* zor=_rule + %+ here + |= [a=pint b=gene] + ?:(bug [%zpcb [wer a] b] b) + zor + -- +:: +++ vest + ~/ %vest + |= tub=nail + ~| %vest + ^- (like gene) + %. tub + %- full + (ifix [gay gay] tall:vast) +:: +++ vice + |= txt=@ta + ^- gene + (rash txt wide:vast) +-- +:::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::: :::::: volume 3, Arvo models and skeleton :::::: +:::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: +|% +++ curd ,[p=@tas q=*] :: typeless card +++ duct (list wire) :: causal history +++ helm :: privilege + $| ?(%gold %iron) :: root, user + $% [%lead p=ship] :: foreign + == :: +++ hilt ?(0 1 2) :: lead iron gold +++ move ,[p=(unit writ) q=duct r=curd] :: typeless move +++ ovum ,[p=wire q=curd] :: typeless ovum +++ pane (list ,[p=@tas q=vase]) :: kernel modules +++ pone (list ,[p=@tas q=vise]) :: kernel modules, old +++ ship ,@p :: network identity +++ vane $_ :: kernel actor + |+ [now=@da eny=@ sky=||(* (unit))] :: activate + ^? |% :: + ++ beat :: update + |= $: wru=(unit writ) :: calling identity + pax=wire :: pretext + hen=duct :: channel + fav=curd :: event + == :: + :- p=*(list move) :: actions + q=*vane :: consequence + ++ come :: load state, old + |= old=vise :: + *vane :: + ++ doze :: next wakeup + |= [now=@da hen=duct] :: channel + *(unit ,@da) :: alarm if any + ++ flee *vase :: save state, old + ++ load :: load state, new + |= new=vase :: + *vane :: + ++ raze *vane :: erase all state + ++ scry :: inspect + |= $: our=ship :: observer + ren=@tas :: submode + his=ship :: target + syd=@tas :: project + lot=coin :: version + tyl=path :: location + == :: + *(unit) :: record + ++ stay *vase :: save state, new + -- :: +++ vile :: reflexive constants + $: bet=type :: beat + nim=type :: scry + vin=type :: vane + hoz=type :: doze + viz=type :: vane + == +++ wire path :: event pretext +++ writ ,[p=helm q=ship] :: authority +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 3bE, Arvo core :: +:: +:: +:: ++ able :: simplify privilege +:: |= hem=helm ^- hilt +:: ?-(hem %gold 2, %iron 1, [%lead *] 0) +:: +++ adit :: duct privilege + |= hen=duct + ^- ?(%gold %iron %lead) + ?~ hen + %lead + ?~ t.hen + ?: ?=([%gold *] i.hen) %gold + ?: ?=([%iron *] i.hen) %iron + %lead + $(hen t.hen) +:: +++ vent :: vane core + |= [vil=vile bud=vase ves=vase] + |% + ++ ruck :: update vase + |= [pax=path txt=@ta] + ^+ +> + =+ arg=`vase`[vin.vil ~2000.1.1 0 =>(~ |+(* ~))] + =+ rig=(slam ves arg) + =+ rev=(slam (slap bud (rain pax txt)) `vase`[viz.vil bud]) + =+ syg=(slam rev arg) + =+ ole=(slap rig [%cnbc %stay]) + +>.$(ves (slam (slap syg [%cnbc %load]) ole)) + :: + ++ wink :: deploy + |= [now=@da eny=@ sky=||(* (unit))] + =+ arg=`vase`[vin.vil +<] + =+ rig=(slam ves arg) + |% + ++ beat + |= $: wru=(unit writ) + pax=wire + hen=duct + fav=curd + == + ^- [p=(list move) q=+>.^$] + =+ pro=(slam (slap rig [%cnbc %beat]) [bet.vil +<]) + :- ((hard (list move)) q:(slap pro [%cnbc %p])) + =+ sev=(slap pro [%cnbc %q]) + %= +>.^$ + ves + ?: &(=(-.q.ves -.q.sev) =(+>.q.ves +>.q.sev)) + ves + sev(+<.q [@da @ =>(~ |+(* ~))]) :: cure memory leak + == + :: + ++ doze + |= [now=@da hen=duct] + ^- (unit ,@da) + ((hard (unit ,@da)) q:(slam (slap rig [%cnbc %doze]) [hoz.vil +<])) + :: + ++ scry + |= $: our=ship + ren=@tas + his=ship + syd=@tas + lot=coin + tyl=path + == + =+ pro=(slam (slap rig [%cnbc %scry]) [nim.vil +<]) + ((hard (unit)) q.pro) + -- + -- +:: +++ vial :: vane tools + |= but=type + ^- vile + =+ pal=|=(a=@t ^-(type (~(play ut but) (vice a)))) + :* bet=(pal '[*(unit writ) *wire *duct *curd]') + nim=(pal '[*ship @tas *ship @tas *coin *path]') + vin=(pal '[@da @ |+(* *(unit))]') + hoz=(pal '[@da *duct]') + viz=(pal '*vase') + == +:: +++ vint :: create vane + |= [vil=vile bud=vase pax=path txt=@ta] :: + (vent vil bud (slam (slap bud (rain pax txt)) [viz.vil bud])) +:: +++ is :: operate in time + |= [eny=@ vil=vile bud=vase fan=(list ,[p=@tas q=vase])] + |_ now=@da + ++ beck + |= wru=(unit writ) + |+ hap=* + ^- (unit) + => .(hap ((hard path) hap)) + ?. ?=([@ @ @ *] hap) ~ + =+ :* hyr=(slay i.hap) + fal=(slay i.t.hap) + dyc=(slay i.t.t.hap) + ved=(slay i.t.t.t.hap) + :: ved=(slay i.t.hap) + :: fal=(slay i.t.t.hap) + :: dyc=(slay i.t.t.t.hap) + tyl=t.t.t.t.hap + == + ?. ?=([~ %$ %tas @] hyr) ~ + ?. ?=([~ %$ %p @] fal) ~ + ?. ?=([~ %$ %tas @] dyc) ~ + ?. ?=(^ ved) ~ + =+ his=`@p`q.p.u.fal + => .(wru ?^(wru wru [~ u=[p=[%lead his] q=his]])) :: XX dubious + =+ dis=(end 3 1 q.p.u.hyr) + =+ rem=(rsh 3 1 q.p.u.hyr) + |- ^- (unit) + ?~ fan ~ + ?. =(dis p.i.fan) $(fan t.fan) + %- scry:(wink:(vent vil bud q.i.fan) now (shax now) ..^$) + [q.u.wru rem his q.p.u.dyc u.ved tyl] + :: + ++ dink :: vase by char + |= din=@tas ^- vase + ?~(fan !! ?:(=(din p.i.fan) q.i.fan $(fan t.fan))) + :: + ++ dint :: input to vane + |= hap=path ^- @tas + ?+ hap !! + [@ %ames *] %a + [@ %batz *] %b + [@ %clay *] %c + [@ %sync *] %c + [@ %term *] %d + [@ %http *] %e + == + :: + ++ doos :: sleep until + |= hap=path ^- (unit ,@da) + (doze:(wink:(vent vil bud (dink (dint hap))) now 0 (beck ~)) now [hap ~]) + :: + ++ hurl :: start loop no id + |= ovo=ovum + ^- [p=(list ovum) q=(list ,[p=@tas q=vase])] + (kick [[~ [[(dint p.ovo) ~] p.ovo ~] q.ovo] ~]) + :: + ++ hymn :: start loop with id + |= [who=ship ovo=ovum] + ^- [p=(list ovum) q=(list ,[p=@tas q=vase])] + (kick [[[~ %iron who] [[(dint p.ovo) ~] p.ovo ~] q.ovo] ~]) + :: + ++ kick :: complete loop + |= mor=(list move) + =| ova=(list ovum) + |- ^- [p=(list ovum) q=(list ,[p=@tas q=vase])] + ?~ mor + [(flop ova) fan] + :: ~& [%kick-move q.i.mor -.r.i.mor] + ?> ?=(^ q.i.mor) + ?~ t.q.i.mor + $(mor t.mor, ova [[i.q.i.mor r.i.mor] ova]) + ?> ?=(^ i.q.i.mor) + =- $(mor (weld p.nyx t.mor), fan q.nyx) + ^= nyx + =+ naf=fan + |- ^- [p=(list move) q=_fan] + ?~ naf [~ ~] + ?. =(i.i.q.i.mor p.i.naf) + =+ tuh=$(naf t.naf) + [p.tuh [i.naf q.tuh]] + =+ ven=(vent vil bud q.i.naf) + =+ win=(wink:ven now (shax now) (beck p.i.mor)) + =+ ^= yub + %- beat:win + [p.i.mor t.i.q.i.mor t.q.i.mor r.i.mor] + [p.yub [[p.i.naf ves:q.yub] t.naf]] + -- +-- +:::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::: :::::: Postface :::::: +:::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: +=+ pit=`vase`!>(.) +=+ bud=pit :: standard library +=+ vil=(vial p.bud) :: +=| eny=@ :: entropy +=| fan=(list ,[p=@tas q=vase]) +=< |% + ++ come |= [@ (list ovum) vise pone] :: 11 + ^- [(list ovum) _+>] + ~& %hoon-come + =^ rey +>+ (^come +<) + [rey +>.$] + ++ keep |=(* (^keep ((hard ,[@da path]) +<))) :: 4 + ++ load |= [@ (list ovum) vase pane] :: 86 + ^- [(list ovum) _+>] + ~& %hoon-load + =^ rey +>+ (^load +<) + [rey +>.$] + ++ peek |=(* (^peek ((hard ,[@p @da path]) +<))) :: 87 + ++ poke |= * :: 42 + ^- [(list ovum) *] + => .(+< ((hard ,[now=@da ovo=ovum]) +<)) + ?: ?=(%veer -.q.ovo) + [~ +>.$(+ (veer +.q.ovo))] + =^ ova +>+ (^poke now ovo) + |- ^- [(list ovum) *] + ?~ ova + [~ +>.^$] + ?: ?=(%veer -.q.i.ova) + $(ova t.ova, +>+.^$ (veer +.q.i.ova)) + ?: ?=(%volt -.q.i.ova) + (volt t.ova +.q.i.ova) + =+(avo=$(ova t.ova) [[i.ova -.avo] +.avo]) + + ++ wish |=(* (^wish ((hard ,@ta) +<))) :: 20 + -- +|% +++ come :: load incompatible + |= [yen=@ ova=(list ovum) dub=vise nyf=pone] + ^+ [ova +>] + (load yen ova (slim dub) (turn nyf |=([a=@tas b=vise] [a (slim b)]))) +:: +++ keep :: wakeup delay + |= [now=@da hap=path] + => .(+< ((hard ,[now=@da hap=path]) +<)) + (~(doos (is eny vil bud fan) now) hap) +:: +++ load :: load compatible + |= [yen=@ ova=(list ovum) dub=vase nyf=pane] + ^+ [ova +>] + =: eny yen + bud dub + fan nyf + == + |- ^+ [ova +>.^$] + ?~ ova + [~ +>.^$] + ?: ?=(%veer -.q.i.ova) + $(ova t.ova, +>.^$ (veer +.q.i.ova)) + =+(avo=$(ova t.ova) [[i.ova -.avo] +.avo]) +:: +++ peek :: external inspect + |= [our=@p now=@da hap=path] + ^- (unit) + ?~ hap ~ + ((~(beck (is eny vil bud fan) now) ~) hap) +:: +++ poke :: external apply + |= [now=@da ovo=ovum] + ^- [(list ovum) _+>] + =^ zef fan + (~(hurl (is eny vil bud fan) now) ovo) + [zef +>.$] +:: +++ veer :: install vane/tang + |= * + => .(+< ((hard ,[lal=@ta pax=path txt=@t]) +<)) + ?: =(%$ lal) + ~& [%tang pax `@p`(mug txt)] + =+ gen=(rain pax txt) + =+ vax=(slap pit gen) + +>.$(bud vax) + %_ +> + fan + |- ^+ fan + ?~ fan + ~& [%vane `@tas`lal pax `@p`(mug txt)] + [[lal ves:(vint vil bud pax txt)] fan] + ?. =(lal p.i.fan) + [i.fan $(fan t.fan)] + ~& [%vane `@tas`lal pax `@p`(mug txt)] + [[p.i.fan ves:(ruck:(vent vil bud q.i.fan) pax txt)] t.fan] + == +:: +++ volt + |= [ova=(list ovum) ken=*] + ^- [p=(list ovum) q=*] + =+ gat=.*(ken .*(ken [0 86])) + =+ sam=[eny ova bud fan] + =+ raw=.*([-.gat [sam +>.gat]] -.gat) + [((list ovum) -.raw) +.raw] +:: +++ wish :: external compute + |= txt=@ + q:(slap bud (ream txt)) +-- +. == diff --git a/arvo/zuse.hoon b/arvo/zuse.hoon new file mode 100644 index 0000000000..cb8d6e02cf --- /dev/null +++ b/arvo/zuse.hoon @@ -0,0 +1,1831 @@ +:: +:: zuse (3), standard library (tang) +:: +|% + :::::::::::::::::::::::::::::::::::::::::::::::::::::: :: +:::: chapter 3b, Arvo libraries :::: +:: :::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 3bA, lite number theory :: +:: +++ egcd :: schneier's egcd + |= [a=@ b=@] + =+ si + =+ [c=(sun a) d=(sun b)] + =+ [u=[c=(sun 1) d=--0] v=[c=--0 d=(sun 1)]] + |- ^- [d=@ u=@ v=@] + ?: =(--0 c) + [(abs d) d.u d.v] + :: ?> ?& =(c (sum (pro (sun a) c.u) (pro (sun b) c.v))) + :: =(d (sum (pro (sun a) d.u) (pro (sun b) d.v))) + :: == + =+ q=(fra d c) + %= $ + c (dif d (pro q c)) + d c + u [(dif d.u (pro q c.u)) c.u] + v [(dif d.v (pro q c.v)) c.v] + == +:: +++ pram :: rabin-miller + |= a=@ ^- ? + ?: ?| =(0 (end 0 1 a)) + =(1 a) + =+ b=1 + |- ^- ? + ?: =(512 b) + | + ?|(=+(c=+((mul 2 b)) &(!=(a c) =(a (mul c (div a c))))) $(b +(b))) + == + | + =+ ^= b + =+ [s=(dec a) t=0] + |- ^- [s=@ t=@] + ?: =(0 (end 0 1 s)) + $(s (rsh 0 1 s), t +(t)) + [s t] + ?> =((mul s.b (bex t.b)) (dec a)) + =+ c=0 + |- ^- ? + ?: =(c 64) + & + =+ d=(~(raw og (add c a)) (met 0 a)) + =+ e=(~(exp fo a) s.b d) + ?& ?| =(1 e) + =+ f=0 + |- ^- ? + ?: =(e (dec a)) + & + ?: =(f (dec t.b)) + | + $(e (~(pro fo a) e e), f +(f)) + == + $(c +(c)) + == +:: +++ ramp :: make r-m prime + |= [a=@ b=(list ,@) c=@] ^- @ux :: [bits snags seed] + => .(c (shas %ramp c)) + =+ d=@ + |- + ?: =((mul 100 a) d) + ~|(%ar-ramp !!) + =+ e=(~(raw og c) a) + ?: &(|-(?~(b & &(!=(1 (mod e i.b)) $(b +.b)))) (pram e)) + e + $(c +(c), d (shax d)) +:: +++ fo :: modulo prime + |_ a=@ + ++ dif + |= [b=@ c=@] + (sit (sub (add a b) c)) + :: + ++ exp + |= [b=@ c=@] + ?: =(0 b) + 1 + =+ d=$(b (rsh 0 1 b)) + =+ e=(pro d d) + ?:(=(0 (end 0 1 b)) e (pro c e)) + :: + ++ fra + |= [b=@ c=@] + (pro b (inv c)) + :: + ++ inv + |= b=@ + =+ c=(dul:si u:(egcd b a) a) + c + :: + ++ pro + |= [b=@ c=@] + (sit (mul b c)) + :: + ++ sit + |= b=@ + (mod b a) + :: + ++ sum + |= [b=@ c=@] + (sit (add b c)) + -- +:: +++ fu :: modulo (mul p q) + |= a=[p=@ q=@] + =+ b=?:(=([0 0] a) 0 (~(inv fo p.a) (~(sit fo p.a) q.a))) + |% + ++ dif + |= [c=[@ @] d=[@ @]] + [(~(dif fo p.a) -.c -.d) (~(dif fo q.a) +.c +.d)] + :: + ++ exp + |= [c=@ d=[@ @]] + :- (~(exp fo p.a) (mod c (dec p.a)) -.d) + (~(exp fo q.a) (mod c (dec q.a)) +.d) + :: + ++ out :: garner's formula + |= c=[@ @] + %+ add + +.c + (mul q.a (~(pro fo p.a) b (~(dif fo p.a) -.c (~(sit fo p.a) +.c)))) + :: + ++ pro + |= [c=[@ @] d=[@ @]] + [(~(pro fo p.a) -.c -.d) (~(pro fo q.a) +.c +.d)] + :: + ++ sum + |= [c=[@ @] d=[@ @]] + [(~(sum fo p.a) -.c -.d) (~(sum fo q.a) +.c +.d)] + :: + ++ sit + |= c=@ + [(mod c p.a) (mod c q.a)] + -- +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 3bB, cryptosuites :: +:: +++ crya :: cryptosuite A (RSA) + ^- acro + =+ [mos=@ pon=*(unit ,[p=@ q=@ r=[p=@ q=@] s=_*fu])] + => |% + ++ dap :: OEAP decode + |= [wid=@ xar=@ dog=@] ^- [p=@ q=@] + =+ pav=(sub wid xar) + =+ qoy=(cut 0 [xar pav] dog) + =+ dez=(mix (end 0 xar dog) (shaw %pad-b xar qoy)) + [dez (mix qoy (shaw %pad-a pav dez))] + :: + ++ pad :: OEAP encode + |= [wid=@ rax=[p=@ q=@] meg=@] ^- @ + =+ pav=(sub wid p.rax) + ?> (gte pav (met 0 meg)) + ^- @ + =+ qoy=(mix meg (shaw %pad-a pav q.rax)) + =+ dez=(mix q.rax (shaw %pad-b p.rax qoy)) + (can 0 [p.rax dez] [pav qoy] ~) + :: + ++ pull |=(a=@ (~(exp fo mos) 3 a)) + ++ push |=(a=@ (~(exp fo mos) 5 a)) + ++ pump + |= a=@ ^- @ + ?~ pon !! + (out.s.u.pon (exp.s.u.pon p.r.u.pon (sit.s.u.pon a))) + :: + ++ punt + |= a=@ ^- @ + ?~ pon !! + (out.s.u.pon (exp.s.u.pon q.r.u.pon (sit.s.u.pon a))) + -- + |% + ++ de + |+ [key=@ cep=@] ^- (unit ,@) + =+ toh=(met 8 cep) + ?: (lth toh 2) + ~ + =+ adj=(dec toh) + =+ [hax=(end 8 1 cep) bod=(rsh 8 1 cep)] + =+ msg=(mix (~(raw og (mix hax key)) (mul 256 adj)) bod) + ?. =(hax (shax (mix key (shax (mix adj msg))))) + ~ + [~ msg] + :: + ++ dy |+([a=@ b=@] (need (de a b))) + ++ en + |+ [key=@ msg=@] ^- @ux + =+ len=(met 8 msg) + =+ adj=?:(=(0 len) 1 len) + =+ hax=(shax (mix key (shax (mix adj msg)))) + (rap 8 hax (mix msg (~(raw og (mix hax key)) (mul 256 adj))) ~) + :: + ++ es |+(a=@ (shas %anex a)) + ++ ex ^? + |% ++ fig ^- @uvH (shaf %afig mos) + ++ pac ^- @uvG (end 6 1 (shaf %acod sec)) + ++ pub ^- pass (cat 3 'a' mos) + ++ sec ^- ring ?~(pon !! (cat 3 'A' (jam p.u.pon q.u.pon))) + -- + :: + ++ mx (dec (met 0 mos)) + ++ nu + => |% + ++ elcm + |= [a=@ b=@] + (div (mul a b) d:(egcd a b)) + :: + ++ eldm + |= [a=@ b=@ c=@] + (~(inv fo (elcm (dec b) (dec c))) a) + :: + ++ ersa + |= [a=@ b=@] + [a b [(eldm 3 a b) (eldm 5 a b)] (fu a b)] + -- + ^? + |% ++ com + |= a=@ + ^+ ^?(..nu) + ..nu(mos a, pon ~) + :: + ++ pit + |= [a=@ b=@] + =+ c=(rsh 0 1 a) + =+ [d=(ramp c [3 5 ~] b) e=(ramp c [3 5 ~] +(b))] + ^+ ^?(..nu) + ..nu(mos (mul d e), pon [~ (ersa d e)]) + :: + ++ nol + |= a=@ + ^+ ^?(..nu) + =+ b=((hard ,[p=@ q=@]) (cue a)) + ..nu(mos (mul p.b q.b), pon [~ (ersa p.b q.b)]) + -- + ++ pu ^? + |% ++ seal + |= [a=@ b=@] + ^- @ + =+ det=(lte (add 256 (met 0 b)) mx) + =+ lip=?:(det b 0) + =- (add ?:(p.mav 0 1) (lsh 0 1 q.mav)) + ^= mav ^- [p=? q=@] + :- det + =+ dog=(pad mx [256 a] lip) + =+ hog=(push dog) + =+ ben=(en a b) + ?:(det hog (jam hog ben)) + :: + ++ sure + |= [a=@ b=@] + ^- (unit ,@) + =+ [det==(0 (end 0 1 b)) bod=(rsh 0 1 b)] + =+ gox=?:(det [p=bod q=0] ((hard ,[p=@ q=@]) (cue bod))) + =+ dog=(pull p.gox) + =+ pig=(dap mx 128 dog) + =+ log=?:(det q.pig q.gox) + ?.(=(p.pig (shaf (mix %agis a) log)) ~ [~ log]) + -- + ++ se ^? + |% ++ sign + |= [a=@ b=@] ^- @ + =- (add ?:(p.mav 0 1) (lsh 0 1 q.mav)) + ^= mav ^- [p=? q=@] + =+ det=(lte (add 128 (met 0 b)) mx) + :- det + =+ hec=(shaf (mix %agis a) b) + =+ dog=(pad mx [128 hec] ?:(det b 0)) + =+ hog=(pump dog) + ?:(det hog (jam hog b)) + :: + ++ tear + |= a=@ + ^- (unit ,[p=@ q=@]) + =+ [det==(0 (end 0 1 a)) bod=(rsh 0 1 a)] + =+ gox=?:(det [p=bod q=0] ((hard ,[p=@ q=@]) (cue bod))) + =+ dog=(punt p.gox) + =+ pig=(dap mx 256 dog) + ?: det + [~ p.pig q.pig] + =+ cow=(de p.pig q.gox) + ?~(cow ~ [~ p.pig u.cow]) + -- + -- +++ brew :: create keypair + |= [a=@ b=@] :: width seed + ^- acro + (pit:nu:crya a b) +:: +++ hail :: activate public key + |= a=pass + ^- acro + =+ [mag=(end 3 1 a) bod=(rsh 3 1 a)] + ?> =('a' mag) + (com:nu:crya bod) +:: +++ wear :: activate secret key + |= a=ring + ^- acro + =+ [mag=(end 3 1 a) bod=(rsh 3 1 a)] + ?> =('A' mag) + (nol:nu:crya bod) +:: +++ trsa :: test rsa + |= msg=@tas + ^- @ + =+ rsa=(brew 1.024 (shax msg)) + =+ key=(shax (shax (shax msg))) + =+ sax=(seal:pu:rsa key msg) + =+ tin=(tear:se:rsa sax) + ?. &(?=(^ tin) =(key p.u.tin) =(msg q.u.tin)) + ~|(%test-fail-seal !!) + =+ tef=(sign:se:rsa [0 msg]) + =+ lov=(sure:pu:rsa [0 tef]) + ?. &(?=(^ lov) =(msg u.lov)) + ~|(%test-fail-sign !!) + msg +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 3bC, JSON and XML :: +:: +++ moon :: mime type to text + |= myn=mime + %+ rap + 3 + |- ^- tape + ?~ myn ~ + ?~ t.myn (trip i.myn) + (weld (trip i.myn) ['/' $(myn t.myn)]) +:: +++ pojo :: print json + |= val=jval + ^- tape + ?~ val "null" + ?- -.val + %a + ;: weld + "[" + =| rez=tape + |- ^+ rez + ?~ p.val rez + $(p.val t.p.val, rez :(weld rez ^$(val i.p.val) ?~(t.p.val ~ ","))) + "]" + == + :: + %b ?:(p.val "true" "false") + %n (trip p.val) + %s :(weld "\"" (trip p.val) "\"") + %o + ;: weld + "\{" + =+ viz=(~(tap by p.val) ~) + =| rez=tape + |- ^+ rez + ?~ viz rez + %= $ + viz t.viz + rez + :(weld rez "\"" (trip p.i.viz) "\":" ^$(val q.i.viz) ?~(t.viz ~ ",")) + == + "}" + == + == +:: +++ tact :: tape to octstream + |= tep=tape ^- octs + =+ buf=(rap 3 tep) + [(met 3 buf) buf] +:: +++ txml :: string to xml + |= tep=tape ^- manx + [[%$ [%$ tep] ~] ~] +:: +++ xmla :: attributes to tape + |= [tat=mart rez=tape] + ^- tape + ?~ tat rez + =+ ryq=$(tat t.tat) + :(weld (xmln n.i.tat) "=\"" (xmle v.i.tat '"' ?~(t.tat ryq [' ' ryq]))) +:: +++ xmle :: escape for xml + |= [tex=tape rez=tape] + =+ xet=`tape`(flop tex) + |- ^- tape + ?~ xet rez + %= $ + xet t.xet + rez ?- i.xet + 34 ['&' 'q' 'u' 'o' 't' ';' rez] + 38 ['&' 'a' 'm' 'p' ';' rez] + 39 ['&' 'a' 'p' 'o' 's' ';' rez] + 60 ['&' 'l' 't' ';' rez] + 62 ['&' 'g' 't' ';' rez] + * [i.xet rez] + == + == +:: +++ xmln :: name to tape + |= man=mane ^- tape + ?@ man (trip man) + (weld (trip -.man) [':' (trip +.man)]) +:: +++ xmll :: nodes to tape + |= [lix=(list manx) rez=tape] + =+ xil=(flop lix) + |- ^- tape + ?~ xil rez + $(xil t.xil, rez (xmlt i.xil rez)) +:: +++ xmlt :: node to tape + |= [mex=manx rez=tape] + ^- tape + ?: ?=([%$ [[%$ *] ~]] t.mex) + (xmle v.i.a.t.mex rez) + =+ man=`mane`?@(t.mex t.mex -.t.mex) + =+ tam=(xmln man) + =+ end=:(weld "" rez) + =+ bod=['>' (xmll c.mex :(weld "" rez))] + =+ att=`mart`?@(t.mex ~ a.t.mex) + :- '<' + %+ weld tam + ?~(att bod [' ' (xmla att bod)]) +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 3bD, tree sync :: +:: +++ cure :: invert miso + |= mis=miso + ?- -.mis + %del [%ins p.mis] + %ins [%del p.mis] + %mut [%mut (limp p.mis)] + == +:: +++ curl :: invert soba + |= doz=soba + :- [q.p.doz p.p.doz] + (turn (flop q.doz) |=([a=path b=miso] [a (cure b)])) +:: +++ cosh :: locally rehash + |= ank=ankh + ank(p dash:(zu ank)) +:: +++ cost :: new external patch + |= [bus=ankh ank=ankh] + ^- soba + [[p.ank p.bus] (flop myz:(dist:(zu ank) %c bus))] +:: +++ ze !: + |_ dome + ++ aeon :: aeon:ze + |= lok=case :: change count thru + ^- (unit ,@ud) + ?- -.lok + %da + |- ^- (unit ,@ud) + ?~ hit [~ let] + ?: (gte p.lok p.i.hit) [~ let] + $(hit t.hit, let (dec let)) + :: + %tas (~(get by lab) p.lok) + %ud ?:((gth p.lok let) ~ [~ p.lok]) + == + :: + ++ ache :: ache:ze + ^- arch :: arch report + :+ p.ank + ?~(q.ank ~ [~ p.u.q.ank]) + |- ^- (map ,@ta ,~) + ?~ r.ank ~ + [[p.n.r.ank ~] $(r.ank l.r.ank) $(r.ank r.r.ank)] + :: + ++ acid :: acid:ze + |= oan=@ud :: invert to + ^- (list maki) + =+ mar=(scag (sub let oan) hit) + (adze (turn mar |=([a=@da b=maki] b))) + :: + ++ adze :: adze:ze + |= may=(list maki) :: reverse maki + %- flop + |- ^- (list maki) + ?~ may ~ + =+ yam=$(may t.may) + ?- -.i.may + & ?-(-.p.i.may | yam, & [[%& %& (curl p.p.i.may)] yam]) + | [i.may(s.p $(may s.p.i.may)) yam] + == + :: + ++ aint :: aint:ze + |= may=(list maki) :: strip maki + ^- (list maki) + ?~ may ~ + =+ yam=$(may t.may) + ?- -.i.may + & ?-(-.p.i.may | [i.may yam], & yam) + | [i.may(s.p $(may s.p.i.may)) yam] + == + :: + ++ amor :: amor:ze + |= ren=?(%v %x %y %z) :: endpoint query + ^- (unit ,*) + ?- ren + %v [~ `dome`+<.amor] + %x ?~(q.ank ~ [~ q.u.q.ank]) + %y [~ ache] + %z [~ ank] :: should bee + == + :: + ++ ante :: ante:ze + |= lem=maki :: rewind by change + ^+ +> + ?- -.lem + & + %_ +> + ank ?. ?=(& -.p.lem) ank + ank:(dusk:(zu ank) p.p.lem) + lab ?. ?=(| -.p.lem) lab + (~(del by lab) p.p.lem) + == + :: + | + |- ^+ +>.^$ + ?~ s.p.lem +>.^$ + $(s.p.lem t.s.p.lem, +>.^$ ^$(lem i.s.p.lem)) + == + :: + ++ argo :: argo:ze + |= oan=@ud :: rewind to aeon + ^+ +> + ?: =(let oan) +> + ?> ?=(^ hit) + ?> ?=(& -.q.i.hit) + => .(+> (ante q.i.hit)) + $(let (dec let), hit t.hit) + :: + ++ auld :: auld:ze + |= [wen=@da gem=germ sab=saba] :: adjust edits + ^- (unit saba) :::::: + =+ ^= viq ^- [p=@ud q=@ud] :: + =+ viq=(~(get by ang) [p.sab q.sab]) :: + ?~(viq [0 0] u.viq) :: + ?: =(let p.viq) [~ sab] :: perfect fit + =+ paj=(axel:(argo p.viq) wen [%| sab]) :: + ?: =(ank.paj ank) :: + [~ sab(s (aint s.sab))] :: same outcome + ?- gem :: + %fine ~ :: nothing perfect + %mate ~|(%mate-stub !!) :: not supported + %that [~ sab(s (weld (acid p.viq) s.sab))] :: discard internal + %this :: discard external + [~ sab(s (aint s.sab))] :: + == :: + :: + ++ auto :: auto:ze + |= mun=mood :: read at point + ^- (unit) + ?: &(?=(%w p.mun) !?=(%ud -.q.mun)) + ?^(r.mun ~ [~ let]) + ?: ?=(%w p.mun) + ?> ?=(^ hit) ?^(r.mun ~ [~ i.hit]) + (amor(ank ank:(deny:(zu ank) r.mun)) p.mun) + :: + ++ aver :: aver:ze + |= mun=mood :: direct read + ^- (unit (unit ,*)) + =+ nao=(aeon q.mun) + ?~(nao ~ [~ (avid u.nao mun)]) + :: + ++ avid :: avid:ze + |= [oan=@ud mun=mood] :: seek and read + ^- (unit) + ?: &(?=(%w p.mun) !?=(%ud -.q.mun)) :: NB only for speed + ?^(r.mun ~ [~ oan]) + (auto:(argo oan) mun) + :: + ++ axel :: axel:ze + |= [wen=@da lem=maki] :: edit + ^+ +> + =: let +(let) + hit :_(hit [wen lem]) + == + ?- -.lem + & + %= +>.$ + ank ?. ?=(& -.p.lem) ank + ank:(durn:(zu ank) p.p.lem) + lab ?. ?=(| -.p.lem) lab + ?< (~(has by lab) p.p.lem) + (~(put by lab) p.p.lem let) + == + :: + | + =+ sab=p.lem + =+ ^= vip ^- @ud + =+ vip=(~(get by ang) [p.sab q.sab]) + ?~(vip 0 p.u.vip) + ?> =(vip p.r.sab) + =. ang (~(put by ang) [p.sab q.sab] [q.r.sab let]) + |- ^+ +>.^$ + ?~ s.sab +>.^$ + $(s.sab t.s.sab, +>.^$ ^$(lem i.s.sab)) + == + -- +:: +++ zu !: :: filesystem + |= ank=ankh :: filesystem state + =| myz=(list ,[p=path q=miso]) :: changes in reverse + =| ram=path :: reverse path into + |% + ++ dash :: local rehash + ^- cash + %+ mix ?~(q.ank 0 p.u.q.ank) + =+ axe=1 + |- ^- cash + ?~ r.ank @ + ;: mix + (shaf %dash (mix axe (shaf %dush (mix p.n.r.ank p.q.n.r.ank)))) + $(r.ank l.r.ank, axe (peg axe 2)) + $(r.ank r.r.ank, axe (peg axe 3)) + == + :: + ++ dosh %_(. p.ank dash) :: rehash and save + ++ dose :: ascend + |= [lol=@ta kan=ankh] + ^+ +> + ?> &(?=(^ ram) =(lol i.ram)) + %= +> + ram t.ram + ank + ?: =([0 ~ ~] ank) + ?. (~(has by r.kan) lol) kan + kan(r (~(del by r.kan) lol)) + kan(r (~(put by r.kan) lol ank)) + == + :: + ++ deaf :: add change + |= mis=miso + ^+ +> + +>(myz [[(flop ram) mis] myz]) + :: + ++ dent :: descend + |= lol=@ta + ^+ +> + =+ you=(~(get by r.ank) lol) + +>.$(ram [lol ram], ank ?~(you [*cash ~ ~] u.you)) + :: + ++ deny :: descend recursively + |= way=path + ^+ +> + ?~(way +> $(way t.way, +> (dent i.way))) + :: + ++ dest :: write over + |= [pum=umph val=(unit ,[p=cash q=*])] + ^+ +> + ?~ q.ank + ?~ val +> + (deaf %ins q.u.val) + ?~ val + (deaf %del q.u.q.ank) + ?: =(q.u.val q.u.q.ank) +> + (deaf %mut ((diff pum) q.u.q.ank q.u.val)) + :: + ++ dist :: modify tree + |= [pum=umph bus=ankh] + ^+ +> + =. +> (dest pum q.bus) + =+ [yeg=(~(tap by r.ank) ~) gey=(~(tap by r.bus) ~)] + =. +>.$ + |- ^+ +>.^$ + ?~ yeg +>.^$ + ?: (~(has by r.bus) p.i.yeg) $(yeg t.yeg) + $(yeg t.yeg, myz myz:dirk(ank q.i.yeg, ram [p.i.yeg ram])) + |- ^+ +>.^$ + ?~ gey +>.^$ + $(gey t.gey, myz myz:^$(bus q.i.gey, +> (dent p.i.gey))) + :: + ++ dirk :: rm -r + |- ^+ + + =. + ?~(q.ank + (deaf %del q.u.q.ank)) + =+ dyr=(~(tap by r.ank) ~) + |- ^+ +.^$ + ?~ dyr +.^$ + =. +.^$ dirk:(dent p.i.dyr) + $(dyr t.dyr) + :: + ++ drum :: apply effect + |= [pax=path mis=miso] + ^+ +> + ?^ pax + dosh:(dose:$(pax t.pax, +> (dent i.pax)) i.pax ank) + ?- -.mis + %del + ?> &(?=(^ q.ank) =(q.u.q.ank p.mis)) + +>.$(p.ank (mix p.u.q.ank p.ank), q.ank ~) + :: + %ins + ?> ?=(~ q.ank) + =+ sam=(sham p.mis) + +>.$(p.ank (mix sam p.ank), q.ank [~ sam p.mis]) + :: + %mut + ?> ?=(^ q.ank) + =+ nex=(lump p.mis q.u.q.ank) + =+ sam=(sham nex) + +>.$(p.ank :(mix sam p.u.q.ank p.ank), q.ank [~ sam nex]) + == + :: + ++ dune :: apply + |- ^+ + + ?~ myz + + => .(+ (drum p.i.myz q.i.myz)) + $(myz t.myz) + :: + ++ dupe :: apply + | + :: + ++ durn :: apply forward + |= nyp=soba + ^+ +> + => ?: =(p.ank p.p.nyp) . + ~& [%durn-in-wrong p.ank p.p.nyp] + . + :: ?> =(p.ank p.p.nyp) + =. +> dune(myz q.nyp) + => ?: =(p.ank q.p.nyp) . + ~& [%durn-out-wrong p.ank q.p.nyp] + . + +> + :: + ++ dusk :: apply reverse + |= nyp=soba + (durn (curl nyp)) +-- +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 3bE, names etc :: +:: +++ clan :: ship to rank + |= who=ship ^- rank + =+ wid=(met 3 who) + ?: (lte wid 1) %czar + ?: =(2 wid) %king + ?: (lte wid 4) %duke + ?: (lte wid 8) %earl + ?> (lte wid 16) %pawn +:: +++ deft :: import url path + |= 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 + [~ [~(rent co %$ %t i.rax) ~]] + [+.p.u.q.vex [-.p.u.q.vex ~]] + =+ pok=$(rax t.rax) + :- p.pok + :_ q.pok + ?:(((sane %tas) i.rax) i.rax ~(rent co %$ %t i.rax)) +:: +++ epur :: url/header parser + |% + ++ apat (cook deft ;~(pfix fas (more fas smeg))) :: 2396 abs_path + ++ auri + ;~ plug + ;~ plug + %+ sear + |= a=@t + ^- (unit ,?) + ?+(a ~ %http [~ %|], %https [~ %&]) + ;~(sfix scem ;~(plug col fas fas)) + thor + == + ;~(plug apat yque) + == + ++ bite :: cookies (ours) + (most sem ;~(plug nuck:so ;~(pfix sem nuck:so))) + ++ dlab :: 2396 domainlabel + %+ sear + |= a=@ta + ?.(=('-' (rsh 3 a (dec (met 3 a)))) [~ u=a] ~) + %+ cook cass + ;~(plug aln (star alp)) + :: + ++ fque (cook crip (plus pquo)) :: normal query field + ++ pcar ;~(pose pure pesc psub col pat) :: 2396 path char + ++ pesc ;~(pfix cen mes) :: 2396 escaped + ++ pold (cold ' ' (just '+')) :: old space code + ++ pque ;~(pose pcar fas wut) :: 3986 query char + ++ pquo ;~(pose pure pesc pold) :: normal query char + ++ pure ;~(pose aln hep dot cab sig) :: 2396 unreserved + ++ psub ;~ pose :: 3986 sub-delims + zap buc pam soq pel per + tar lus com sem tis + == + ++ scem :: 2396 scheme + %+ cook cass + ;~(plug alf (star ;~(pose aln lus hep dot))) + :: + ++ smeg (cook crip (plus pcar)) :: 2396 segment + ++ thor :: 2396 host/port + %+ cook |*(a=[* *] [+.a -.a]) + ;~ plug + thos + ;~(pose (stag ~ ;~(pfix col dim:ag)) (easy ~)) + == + ++ thos :: 2396 host, no local + ;~ plug + ;~ pose + %+ stag %& + %+ sear :: LL parser weak here + |= a=(list ,@t) + =+ b=(flop a) + ?> ?=(^ b) + =+ c=(end 3 1 i.b) + ?.(&((gte c 'a') (lte c 'z')) ~ [~ u=b]) + (most dot dlab) + :: + %+ stag %| + =+ tod=(ape:ag ted:ab) + %+ bass 256 + ;~(plug tod (stun [3 3] ;~(pfix dot tod))) + == + == + ++ yque :: query ending + ;~ pose + ;~(pfix wut yquy) + (easy ~) + == + ++ yquy :: query + %+ cook + |= a=(list ,[p=@t q=@t]) + (~(gas by *(map ,@t ,@t)) a) + ;~ pose :: proper query + %+ more + ;~(pose pam sem) + ;~(plug fque ;~(pfix tis fque)) + :: + %+ cook :: funky query + |=(a=tape [[%$ (crip a)] ~]) + (star pque) + == + ++ zest :: 2616 request-uri + ;~ pose + (stag %& (cook |=(a=purl a) auri)) + (stag %| ;~(plug apat yque)) + == + -- +:: +++ glam + |= zar=@p ^- tape + %+ snag zar + :~ "Tianming" "Pepin the Short" "Haile Selassie" "Alfred the Great" + "Tamerlane" "Pericles" "Talleyrand" "Yongle" "Seleucus" + "Uther Pendragon" "Louis XVI" "Ahmad Shāh Durrānī" "Constantine" + "Wilhelm I" "Akbar" "Louis XIV" "Nobunaga" "Alexander VI" + "Philippe II" "Julius II" "David" "Niall Noígíallach" "Kublai Khan" + "Öz Beg Khan" "Ozymandias" "Ögedei Khan" "Jiang Jieshi" "Darius" + "Shivaji" "Qianlong" "Bolesław I Chrobry" "Tigranes" "Han Wudi" + "Charles X" "Naresuan" "Frederick II" "Simeon" "Kangxi" + "Suleiman the Magnificent" "Pedro II" "Genghis Khan" "Đinh Bộ Lĩnh" + "Porfirio Díaz" "Pakal" "Wu Zetian" "Garibaldi" "Pius IX" + "Leopold II" "Leonidas" "Sitting Bull" "Nebuchadnezzar II" + "Rhodes" "Henry VIII" "Attila" "Catherine II" "Chulalongkorn" + "Uthmān" "Augustus" "Faustin" "Chongde" "Justinian" + "Afonso de Albuquerque" "Antoninus Pius" "Cromwell" "Innocent X" + "Fidel" "Frederick the Great" "Canute" "Vytautas" "Amina" + "Hammurabi" "Suharto" "Victoria" "Hiawatha" "Paul V" "Shaka" + "Lê Thánh Tông" "Ivan Asen II" "Tiridates" "Nefertiti" "Gwangmu" + "Ferdinand & Isabella" "Askia" "Xuande" "Boris Godunov" "Gilgamesh" + "Maximillian I" "Mao" "Charlemagne" "Narai" "Hanno" "Charles I & V" + "Alexander II" "Mansa Musa" "Zoe Porphyrogenita" "Metternich" + "Robert the Bruce" "Pachacutec" "Jefferson" "Solomon" "Nicholas I" + "Barbarossa" "FDR" "Pius X" "Gwanggaeto" "Abbas I" "Julius Caesar" + "Lee Kuan Yew" "Ranavalona I" "Go-Daigo" "Zenobia" "Henry V" + "Bảo Đại" "Casimir III" "Cyrus" "Charles the Wise" "Sandrokottos" + "Agamemnon" "Clement VII" "Suppiluliuma" "Deng Xiaoping" + "Victor Emmanuel" "Ajatasatru" "Jan Sobieski" "Huangdi" "Xuantong" + "Narmer" "Cosimo de' Medici" "Möngke Khan" "Stephen Dušan" "Henri IV" + "Mehmed Fatih" "Conn Cétchathach" "Francisco Franco" "Leo X" + "Kammu" "Krishnadevaraya" "Elizabeth I" "Norton I" "Washington" + "Meiji" "Umar" "TR" "Peter the Great" "Agustin I" "Ashoka" + "William the Conqueror" "Kongolo Mwamba" "Song Taizu" + "Ivan the Terrible" "Yao" "Vercingetorix" "Geronimo" "Lincoln" + "Urban VIII" "Alexios Komnenos" "Maria I" "Tamar" "Bismarck" + "Arthur" "Jimmu" "Gustavus Adolphus" "Suiko" "Basil I" "Montezuma" + "Santa Anna" "Xerxes" "Beyazıt Yıldırım" "Samudragupta" "James I" + "George III" "Kamehameha" "Francesco Sforza" "Trajan" + "Rajendra Chola" "Hideyoshi" "Cleopatra" "Alexander" + "Ashurbanipal" "Paul III" "Vespasian" "Tecumseh" "Narasimhavarman" + "Suryavarman II" "Bokassa I" "Charles Canning" "Theodosius" + "Francis II" "Zhou Wen" "William Jardine" "Ahmad al-Mansur" + "Lajos Nagy" "Theodora" "Mussolini" "Samuil" "Osman Gazi" + "Kim Il-sung" "Maria Theresa" "Lenin" "Tokugawa" "Marcus Aurelius" + "Nzinga Mbande" "Edward III" "Joseph II" "Pulakesi II" "Priam" + "Qin Shi Huang" "Shah Jahan" "Sejong" "Sui Wendi" "Otto I" + "Napoleon III" "Prester John" "Dido" "Joao I" "Gregory I" + "Gajah Mada" "Abd-ar Rahmān III" "Taizong" "Franz Josef I" + "Nicholas II" "Gandhi" "Chandragupta II" "Peter III" + "Oba Ewuare" "Louis IX" "Napoleon" "Selim Yavuz" "Shun" + "Hayam Wuruk" "Jagiełło" "Nicaule" "Sargon" "Saladin" "Charles II" + "Brian Boru" "Da Yu" "Antiochus III" "Charles I" + "Jan Pieterszoon Coen" "Hongwu" "Mithridates" "Hadrian" "Ptolemy" + "Benito Juarez" "Sun Yat-sen" "Raja Raja Chola" "Bolivar" "Pius VII" + "Shapur II" "Taksin" "Ram Khamhaeng" "Hatshepsut" "Alī" "Matilda" + "Ataturk" + == +:: +++ glon + |= lag=lang + ^- (unit tape) + ?+ lag ~ + %aa [~ "Afar"] + %ab [~ "Abkhazian"] + %ae [~ "Avestan"] + %af [~ "Afrikaans"] + %ak [~ "Akan"] + %am [~ "Amharic"] + %an [~ "Aragonese"] + %ar [~ "Arabic"] + %as [~ "Assamese"] + %av [~ "Avaric"] + %ay [~ "Aymara"] + %az [~ "Azerbaijani"] + %ba [~ "Bashkir"] + %be [~ "Belarusian"] + %bg [~ "Bulgarian"] + %bh [~ "Bihari"] + %bi [~ "Bislama"] + %bm [~ "Bambara"] + %bn [~ "Bengali"] + %bo [~ "Tibetan"] + %br [~ "Breton"] + %bs [~ "Bosnian"] + %ca [~ "Catalan"] + %ce [~ "Chechen"] + %ch [~ "Chamorro"] + %co [~ "Corsican"] + %cr [~ "Cree"] + %cs [~ "Czech"] + %cu [~ "Slavonic"] + %cv [~ "Chuvash"] + %cy [~ "Welsh"] + %da [~ "Danish"] + %de [~ "German"] + %dv [~ "Maldivian"] + %dz [~ "Dzongkha"] + %ee [~ "Ewe"] + %el [~ "Greek"] + %en [~ "English"] + %eo [~ "Esperanto"] + %es [~ "Spanish"] + %et [~ "Estonian"] + %eu [~ "Basque"] + %fa [~ "Persian"] + %ff [~ "Fulah"] + %fi [~ "Finnish"] + %fj [~ "Fijian"] + %fo [~ "Faroese"] + %fr [~ "French"] + %fy [~ "Frisian"] + %ga [~ "Irish Gaelic"] + %gd [~ "Scottish Gaelic"] + %gl [~ "Galician"] + %gn [~ "Guarani"] + %gu [~ "Gujarati"] + %gv [~ "Manx"] + %ha [~ "Hausa"] + %he [~ "Hebrew"] + %hi [~ "Hindi"] + %ho [~ "Hiri Motu"] + %hr [~ "Croatian"] + %ht [~ "Haitian Creole"] + %hu [~ "Hungarian"] + %hy [~ "Armenian"] + %hz [~ "Herero"] + %ia [~ "Interlingua"] + %id [~ "Indonesian"] + %ie [~ "Occidental"] + %ig [~ "Igbo"] + %ii [~ "Nuosu"] + %ik [~ "Inupiaq"] + %io [~ "Ido"] + %is [~ "Icelandic"] + %it [~ "Italian"] + %iu [~ "Inuktitut"] + %ja [~ "Japanese"] + %jv [~ "Javanese"] + %ka [~ "Georgian"] + %kg [~ "Kongo"] + %ki [~ "Kikuyu"] + %kj [~ "Kwanyama"] + %kk [~ "Kazakh"] + %kl [~ "Kalaallisut"] + %km [~ "Central Khmer"] + %kn [~ "Kannada"] + %ko [~ "Korean"] + %kr [~ "Kanuri"] + %ks [~ "Kashmiri"] + %ku [~ "Kurdish"] + %kv [~ "Komi"] + %kw [~ "Cornish"] + %ky [~ "Kyrgyz"] + %la [~ "Latin"] + %lb [~ "Luxembourgish"] + %lg [~ "Ganda"] + %li [~ "Limburgish"] + %ln [~ "Lingala"] + %lo [~ "Lao"] + %lt [~ "Lithuanian"] + %lu [~ "Luba-Katanga"] + %lv [~ "Latvian"] + %mg [~ "Malagasy"] + %mh [~ "Marshallese"] + %mi [~ "Maori"] + %mk [~ "Macedonian"] + %ml [~ "Malayalam"] + %mn [~ "Mongolian"] + %mr [~ "Marathi"] + %ms [~ "Malay"] + %mt [~ "Maltese"] + %my [~ "Burmese"] + %na [~ "Nauru"] + %nb [~ "Norwegian Bokmål"] + %nd [~ "North Ndebele"] + %ne [~ "Nepali"] + %ng [~ "Ndonga"] + %nl [~ "Dutch"] + %nn [~ "Norwegian Nynorsk"] + %no [~ "Norwegian"] + %nr [~ "South Ndebele"] + %nv [~ "Navajo"] + %ny [~ "Chichewa"] + %oc [~ "Occitan"] + %oj [~ "Ojibwa"] + %om [~ "Oromo"] + %or [~ "Oriya"] + %os [~ "Ossetian"] + %pa [~ "Punjabi"] + %pi [~ "Pali"] + %pl [~ "Polish"] + %ps [~ "Pashto"] + %pt [~ "Portuguese"] + %qu [~ "Quechua"] + %rm [~ "Romansh"] + %rn [~ "Rundi"] + %ro [~ "Romanian"] + %ru [~ "Russian"] + %rw [~ "Kinyarwanda"] + %sa [~ "Sanskrit"] + %sc [~ "Sardinian"] + %sd [~ "Sindhi"] + %se [~ "Northern Sami"] + %sg [~ "Sango"] + %si [~ "Sinhala"] + %sk [~ "Slovak"] + %sl [~ "Slovenian"] + %sm [~ "Samoan"] + %sn [~ "Shona"] + %so [~ "Somali"] + %sq [~ "Albanian"] + %sr [~ "Serbian"] + %ss [~ "Swati"] + %st [~ "Sotho"] + %su [~ "Sundanese"] + %sv [~ "Swedish"] + %sw [~ "Swahili"] + %ta [~ "Tamil"] + %te [~ "Telugu"] + %tg [~ "Tajik"] + %th [~ "Thai"] + %ti [~ "Tigrinya"] + %tk [~ "Turkmen"] + %tl [~ "Tagalog"] + %tn [~ "Tswana"] + %to [~ "Tonga"] + %tr [~ "Turkish"] + %ts [~ "Tsonga"] + %tt [~ "Tatar"] + %tw [~ "Twi"] + %ty [~ "Tahitian"] + %ug [~ "Uighur"] + %uk [~ "Ukrainian"] + %ur [~ "Urdu"] + %uz [~ "Uzbek"] + %ve [~ "Venda"] + %vi [~ "Vietnamese"] + %vo [~ "Volapük"] + %wa [~ "Walloon"] + %wo [~ "Wolof"] + %xh [~ "Xhosa"] + %yi [~ "Yiddish"] + %yo [~ "Yoruba"] + %za [~ "Zhuang"] + %zh [~ "Chinese"] + %zu [~ "Zulu"] + == +:: +++ gnow + |= [who=@p gos=gcos] ^- @t + ?- -.gos + %czar (rap 3 '|' (rap 3 (glam who)) '|' ~) + %king (rap 3 '_' p.gos '_' ~) + %earl (rap 3 ':' p.gos ':' ~) + %pawn ?~(p.gos %$ (rap 3 '.' u.p.gos '.' ~)) + %duke + ?: ?=(%anon -.p.gos) %$ + %+ rap 3 + ^- (list ,@) + ?- -.p.gos + %band ~[')' p.p.p.gos '('] + %crew ~['<' p.p.p.gos '>'] + %dept ~['{' p.p.p.gos '}'] + %fair ~['=' p.p.p.gos '='] + %holy ~['+' p.p.p.gos '+'] + %home ~[']' p.p.p.gos '['] + %punk ~['"' p.p.gos '"'] + ?(%lord %lady) + =+ ^= nad + =+ nam=`name`s.p.p.gos + %+ rap 3 + :~ p.nam + ?~(q.nam 0 (cat 3 ' ' u.q.nam)) + ?~(r.nam 0 (rap 3 ' (' u.r.nam ')' ~)) + ' ' + s.nam + == + ?:(=(%lord -.p.gos) ~['[' nad ']'] ~['(' nad ')']) + == + == +:: +++ hunt + |= [one=(unit ,@da) two=(unit ,@da)] + ^- (unit ,@da) + ?~ one two + ?~ two one + ?:((lth u.one u.two) one two) +:: +++ meat + |= kit=kite + ^- path + [(cat 3 'c' p.kit) (scot %p r.kit) s.kit (scot (dime q.kit)) t.kit] +:: +++ saxo :: autocanon + |= who=ship + ^- (list ship) + ?: (lth who 256) [who ~] + [who $(who (sein who))] +:: +++ sein :: autodean + |= who=ship ^- ship + =+ mir=(clan who) + ?- mir + %czar who + %king (end 3 1 who) + %duke (end 4 1 who) + %earl (end 5 1 who) + %pawn `@p`0 + == +:: +++ tame + |= hap=path + ^- (unit kite) + ?. ?=([@ @ @ *] hap) ~ + =+ :* hyr=(slay i.hap) + fal=(slay i.t.hap) + dyc=(slay i.t.t.hap) + ved=(slay i.t.t.t.hap) + :: ved=(slay i.t.hap) + :: fal=(slay i.t.t.hap) + :: dyc=(slay i.t.t.t.hap) + tyl=t.t.t.t.hap + == + ?. ?=([~ %$ %tas @] hyr) ~ + ?. ?=([~ %$ %p @] fal) ~ + ?. ?=([~ %$ %tas @] dyc) ~ + ?. ?=(^ ved) ~ + =+ his=`@p`q.p.u.fal + =+ [dis=(end 3 1 q.p.u.hyr) rem=(rsh 3 1 q.p.u.hyr)] + ?. ?&(?=(%c dis) ?=(?(%w %x %y %z) rem)) ~ + [~ rem (case p.u.ved) q.p.u.fal q.p.u.dyc tyl] +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: section 3bF, Arvo models :: +:: +++ acro :: asym cryptosuite + $_ ^? |% :: opaque object + ++ de |+([a=@ b=@] *(unit ,@)) :: symmetric de, soft + ++ dy |+([a=@ b=@] @) :: symmetric de, hard + ++ en |+([a=@ b=@] @) :: symmetric en + ++ es |+(a=@ @) :: step key to next + ++ ex ^? :: export + |% ++ fig @uvH :: fingerprint + ++ pac @uvG :: default passcode + ++ pub *pass :: public key + ++ sec *ring :: private key + -- :: + ++ mx @ :: max direct bytes + ++ nu ^? :: reconstructors + |% ++ pit |=([a=@ b=@] ^?(..nu)) :: from [width seed] + ++ nol |=(a=@ ^?(..nu)) :: from naked ring + ++ com |=(a=@ ^?(..nu)) :: from naked pass + -- :: + ++ pu ^? :: public-key acts + |% ++ seal |=([a=@ b=@] @) :: encrypt + ++ sure |=([a=@ b=@] *(unit ,@)) :: authenticate + -- :: + ++ se ^? :: secret-key acts + |% ++ sign |=([a=@ b=@] @) :: certify + ++ tear |=(a=@ *(unit ,[p=@ q=@])) :: accept + -- :: + -- :: +++ agon (map ,[p=ship q=disc] ,[p=@ud q=@ud]) :: mergepoints +++ ankh :: fs node (new) + $: p=cash :: recursive hash + q=(unit ,[p=cash q=*]) :: file + r=(map ,@ta ankh) :: folders + == :: +++ apex ,[p=@uvI q=(map ,@ta ,@uvI) r=(map ,@ta ,~)] :: node report (old) +++ arch ,[p=@uvI q=(unit ,@uvI) r=(map ,@ta ,~)] :: node report (new) +++ ball ,@uw :: statement payload +++ bait ,[p=skin q=@ud r=dove] :: fmt nrecvd spec +++ bath :: convo per client + $: sop=shed :: not stalled + raz=(map ,@ta race) :: statements inbound + ryl=(map ,@ta rill) :: statements outbound + == :: +++ bead :: terminal control + $: $: bul=@ud :: buffer length + bus=@ud :: cursor in buffer + but=(list ,@c) :: buffer text + buy=prom :: input style + == :: + $: hiz=@ud :: history depth + hux=path :: history path + hym=(map ,@ud (list ,@c)) :: history overlay + hyt=hist :: history object + == :: + $: pol=@ud :: length of prompt + pot=tape :: prompt text + == :: + == :: +++ beak ,[p=(unit ,@ud) q=(map wire goal) r=boor] :: next/want/thread +++ bear ,[p=(map path goal) q=boar] :: thread with slips +++ beef :: raw product + $: p=(list gilt) :: actions + q=(list slip) :: requests + r=boar :: state + == :: +++ bell path :: label +++ bird :: packet in travel + $: gom=soap :: message identity + mup=@ud :: pktno in msg + nux=@ud :: xmission count + lys=@da :: last sent + pac=rock :: packet data + == :: +++ belt :: raw console input + $% [%aro p=?(%d %l %r %u)] :: arrow key + [%bac ~] :: true backspace + [%ctl p=@ud] :: control-key + [%del ~] :: true delete + [%met p=@ud] :: meta-key + [%ret ~] :: return + [%txt p=(list ,@c)] :: utf32 text + == :: +++ blew ,[p=@ud q=@ud] :: columns rows +++ blit :: raw console output + $% [%bel ~] :: make a noise + [%clr ~] :: clear the screen + [%hop p=@ud] :: set cursor position + [%lin p=(list ,@c)] :: set current line + [%mor ~] :: newline + [%sav p=path q=@] :: save to file + == :: +++ blot :: kill ring + $: p=@ud :: length + q=@ud :: depth + r=(list (list ,@c)) :: kills + == :: +++ blur ,[p=@ud q=(unit bead) r=blot] :: columns, prompt +++ boar :: execution instance + $% [%n p=(unit coal) q=claw r=lath] :: new/ready + [%r p=(unit worm)] :: running/done + [%t p=coal] :: simple filter + == :: +++ boor :: new thread + $: p=(map ,@ud kite) :: dependencies + q=(qeu ,[p=wire q=card]) :: incoming cards + r=(qeu ,[p=wire q=nose]) :: pending notes + s=boar :: execution + == :: +++ boat ,[(list slip) tart] :: user stage +++ boon :: fort output + $% [%beer p=ship q=@uvG] :: gained ownership + [%coke p=sock q=cape r=soap s=duct] :: message result + [%mead p=lane q=rock] :: accept packet + [%milk p=sock q=@tas r=@ud s=(unit ,*)] :: accept message + [%ouzo p=lane q=rock] :: transmit packet + [%wine p=sock q=tape] :: notify user + == :: +++ bowl ,[p=(list gift) q=(unit boat)] :: app product +++ brad :: shell state + $: who=ship :: identity + fog=(list ,@ud) :: virtual consoles + hox=@ta :: identity text + cwd=@tas :: working disc + cws=path :: working spur + way=(map ,@tas vase) :: variables + hit=[p=@ud q=(list ,@t)] :: command history + sur=[p=@ud q=(qeu vase)] :: result history + god=[p=@ud q=(map ,@ud task)] :: tasks + == :: +++ bray ,[p=life q=(unit life) r=ship s=@da] :: our parent us now +++ brow ,[p=@da q=@tas] :: browser version +++ buck ,[p=mace q=will] :: all security data +++ cake ,[p=sock q=skin r=@] :: top level packet +++ cape :: end-to-end result + $? %good :: delivered + %dead :: rejected + %lost :: interrupted + == :: +++ card :: event + $% [%bbye ~] :: reset prompt + [%band p=ship q=(list rout)] :: internal http bind + [%bind p=(unit ship) q=host] :: external http open + [%belt p=belt] :: terminal input + [%blew p=blew] :: terminal config + [%blit p=(list blit)] :: terminal output + [%boot p=card] :: christen terminal + [%born ~] :: new unix process + [%cash p=@p q=buck] :: civil license + [%crud p=@tas q=(list tank)] :: error with trace + [%deem p=ship q=card] :: external identity + [%dire p=@tas q=dram] :: apply directory + [%dump p=(list ,@t)] :: raw text lines + [%ergo p=@p q=@tas r=@ud] :: version update + [%file p=@tas q=@] :: apply atomic file + [%fail p=tape] :: report failure + [%hail ~] :: refresh + [%hear p=lane q=@] :: receive packet + [%hemp p=path] :: cancel request + [%helo p=path q=prod] :: trigger prompt + [%hole p=lane q=@] :: packet failed + [%hoop p=(unit)] :: namespace response + [%hope p=path] :: namespace request + [%info p=@p q=@tas r=nori] :: internal edit + [%init p=@p] :: report install + [%into p=@p q=@tas r=nori] :: external edit + [%flog p=card] :: log to terminal + [%junk p=@] :: entropy + [%kick p=@da] :: wake up + [%kill p=~] :: kill a task + [%lane p=lane] :: set public route + [%line p=@t] :: source line + [%limn ~] :: rotate ship + [%ling ~] :: rotate interface + [%load p=@tas q=path] :: request atomic file + [%loin p=@p q=chum] :: name hashed-pass + [%logo ~] :: logout + [%loot p=@tas q=path] :: request directory + [%make p=(unit ,@t) q=@ud r=@] :: wild license + [%mine p=@ud q=@t] :: query matched line + [%noop ~] :: no operation + [%note p=@tD q=tank] :: debug message + [%nuke p=~] :: kill all processes + [%pace p=@ud] :: compute background + [%pipe p=(unit ,[p=typo q=(list)])] :: pipeline data + [%pour p=path q=dram] :: write directory + [%pull p=ship q=disc r=(list disc)] :: pull remote desk + [%pump ~] :: produce packets + [%quid p=ship q=path r=(unit ,*)] :: delivery + [%rein p=? q=path] :: push/replace kernel + [%rend ~] :: pop kernel + [%rest ~] :: reset to factory + [%save p=path q=@] :: write atomic file + [%send p=lane q=@] :: transmit packet + [%sith p=@p q=@uw] :: imperial generator + [%sync ~] :: reset soft state + [%talk p=tank] :: show on console + [%tell p=(list ,@t)] :: dump lines + [%text p=tape] :: talk leaf + [%that p=@ud q=love] :: cooked htresp + [%thee p=@ud q=scab r=cred s=moth] :: cooked htreq + [%them p=(unit hiss)] :: internal client req + [%they p=@ud q=httr] :: response to %them + [%this p=? q=@ud r=httq] :: secure/session/req + [%thou p=httr] :: raw http response + [%thug p=@p q=@p] :: sign in client + [%thus p=@ud q=(unit hiss)] :: http request + [%tory p=(list ,@t)] :: history dump + [%veer p=@ta q=path r=@t] :: install vane + [%volt p=*] :: upgrade kernel + [%wait p=@da q=path] :: timer wait + [%wake ~] :: timer activate + [%want p=ship q=@ta r=*] :: send message + [%warp p=ship q=riff] :: request + [%wart p=ship q=@ta r=@ud s=(unit ,*)] :: incoming response + [%warn p=tape] :: system message + [%went p=ship q=cape r=soap] :: outgoing reaction + [%wipe ~] :: clean to sequence + [%word p=chum] :: set password + [%wort p=tape] :: semantic failure + [%writ p=riot] :: response + == :: +++ cart ,[p=cash q=cash] :: hash change +++ care ?(%v %w %x %y %z) :: clay submode +++ case :: modeshipdeskcasespur + $% [%da p=@da] :: date + [%tas p=@tas] :: label + [%ud p=@ud] :: number + == :: +++ cash ,@uvH :: ankh hash +++ cask :: symmetric record + $: yed=(unit ,[p=hand q=code]) :: outbound + heg=(map hand code) :: proposed + qim=(map hand code) :: inbound + == :: +++ coal ,* :: untyped vase +++ code ,@uvI :: symmetric key +++ cone :: reconfiguration + $% [& p=gene] :: transform + [| p=(list ,@tas)] :: alter + == :: +++ corp ,[p=@t q=govt] :: name issuer +++ chum ,@uvI :: hashed passcode +++ claw $: :: startup chain + joy=(unit coal) :: local context + ran=(unit coal) :: arguments + pux=(unit path) :: execution path + jiv=(unit coal) :: app configuration + kyq=(unit coal) :: app customization + gam=(unit coal) :: app image + == :: +++ cred ,[p=? q=logo q=oryx r=(unit ship)] :: client credentials +++ cult (map duct rave) :: subscriptions +++ deed ,[p=@ q=step] :: signature, stage +++ dock :: link record + $: for=ship :: host + dys=@tas :: linked to desk + kol=case :: last update case + num=@ud :: update count + cuz=(list ,[p=@ud q=dole]) :: cumulative update + == :: +++ dole ,[p=(unit moar) q=(list maki)] :: flow trace +++ dome :: project state + $: ang=agon :: pedigree + ank=ankh :: new state + let=@ :: (lent hit) + hit=(list frog) :: changes in reverse + lab=(map ,@tas ,@ud) :: labels + == :: +++ desk ,[p=cult q=dome] :: project state +++ disc ,@ta :: modeshipdeskcasespur +++ door :: foreign contact + $: wod=road :: connection to + wyl=will :: inferred mirror + caq=cask :: symmetric key state + == :: +++ dove ,[p=@ud q=(map ,@ud ,@)] :: count hash 13-blocks +++ flap ,@uvH :: network packet id +++ flow :: packet connection + $: rtt=@dr :: decaying avg rtt + wid=@ud :: logical wdow msgs + == :: +++ fort :: formal state + $: hop=@da :: network boot date + ton=town :: security + zac=(map ship oven) :: flows by server + rop=(map ,[p=@ud q=sock] riff) :: remote requests + == :: +++ frog ,[p=@da q=maki] :: project change +++ gift :: one-way effect + $% [%$ p=vase] :: trivial output + [%cc p=(unit case)] :: change case + [%ck p=@tas] :: change desk + [%cs p=path] :: change spur + [%de p=@ud q=tank] :: debug/level + [%ex p=(unit vase) q=lath] :: exec/patch + [%ha p=tank] :: single error + [%ho p=(list tank)] :: multiple error + [%la p=tank] :: single statement + [%lo p=(list tank)] :: multiple statement + [%mu p=type q=(list)] :: batch emit + [%mx p=(list gift)] :: batch gift + [%ok p=disc q=nori] :: save changes + [%sc p=(unit skit)] :: stack library + [%sp p=(list lark)] :: spawn task(s) + [%te p=(list ,@t)] :: dump lines + [%th p=@ud q=love] :: http response + [%va p=@tas q=(unit vase)] :: set/clear variable + [%xx p=card] :: return card + [%xy p=path q=card] :: push card + == :: +++ gilt ,[@tas *] :: presumed gift +++ gens ,[p=lang q=gcos] :: general identity +++ germ ?(%fine %that %this %mate) :: merge style +++ gcos :: id description + $% [%czar ~] :: 8-bit ship + [%duke p=what] :: 32-bit ship + [%earl p=@t] :: 64-bit ship + [%king p=@t] :: 16-bit ship + [%pawn p=(unit ,@t)] :: 128-bit ship + == :: +++ goad :: common note + $% [%eg p=riot] :: simple result + [%ht p=@ud q=scab r=cred s=moth] :: http request + [%it p=~] :: interrupt event + [%ly p=newt q=tape] :: lifecycle event + [%up p=@t] :: prompt response + [%oy p=ship q=@ta r=@ud s=(unit ,*)] :: incoming request + [%yo p=ship q=cape r=soap] :: request response + [%wa ~] :: alarm + == :: +++ goal :: app request + $% [%$ p=type] :: open for input + [%do p=vase q=vase] :: call gate sample + [%eg p=kite] :: single request + [%es p=ship q=disc r=rave] :: subscription + [%ht p=(list rout)] :: http server + [%oy p=@ta] :: listen on channel + [%up p=prod] :: user prompt + [%wa p=@da] :: alarm + [%yo p=ship q=@ta r=*] :: network message + == :: +++ govt path :: country/postcode +++ gram ,@uw :: physical datagram +++ gyro ,[p=@ud q=wire r=prod] :: live prompt +++ hand ,@uvH :: hash of code +++ hate ,[p=purl q=@p r=moth] :: cooked request +++ hiss ,[p=hart q=httq] :: outbound request +++ hist ,[p=@ud q=(list ,@t)] :: depth texts +++ hook path :: request origin +++ hart ,[p=? q=(unit ,@ud) r=host] :: http sec/port/host +++ hort ,[p=(unit ,@ud) q=host] :: http port/host +++ host $%([& p=(list ,@t)] [| p=@if]) :: http host +++ httq :: raw http request + $: p=?(%get %post) :: method + q=@t :: unparsed url + r=(list ,[p=@t q=@t]) :: headers + s=(unit octs) :: body + == :: +++ httr ,[p=@ud q=mess r=(unit octs)] :: raw http response +++ kite ,[p=care q=case r=ship s=disc t=spur] :: parsed global name +++ json :: json top level + $% [%a p=(list jval)] :: array + [%o p=(map ,@t jval)] :: object + == :: +++ jval :: json value + $| ~ :: null + $? json :: + $% [%b p=?] :: boolean + [%n p=@ta] :: number + [%s p=@ta] :: string + == :: + == :: +++ lamb :: short path + $% [& p=@tas] :: auto + [| p=gene] :: manual + == :: +++ lane :: packet route + $% [%if p=@ud q=@if] :: IP4/public UDP/addr + [%is p=@ud q=(unit lane) r=@is] :: IPv6 w/alternates + [%ix p=@da q=@ud r=@if] :: IPv4 provisional + == :: +++ lang ,@ta :: IETF lang as code +++ lark ,[p=(unit ,@tas) q=lawn] :: parsed command +++ lass ?(%0 %1 %2) :: power increment +++ lath $% :: pipeline stage + [%0 p=lass q=lamb r=(list cone) s=gene] :: command + [%1 p=gene] :: generator + [%2 p=gene] :: filter + == :: +++ lawn (list lath) :: +++ lens ?(%z %y %x %w) :: repository view +++ lice ,[p=ship q=buck] :: full license +++ life ,@ud :: regime number +++ lint (list rock) :: fragment array +++ link ,[p=code q=sock] :: connection +++ logo ,@uvI :: session identity +++ love $% :: http response + [%ham p=manx] :: html node + [%mid p=mime q=octs] :: mime-typed data + [%raw p=httr] :: raw http response + == :: +++ mace (list ,[p=life q=ring]) :: private secrets +++ maki :: general change + $% [& p=nori] :: direct change + [| p=saba] :: metachange + == :: +++ mane $|(@tas [@tas @tas]) :: XML name/space +++ manx ,[t=marx c=marl] :: XML node +++ marl (list manx) :: XML node list +++ mars ,[t=[n=%$ a=[i=[n=%$ v=tape] t=~]] c=~] :: XML cdata +++ mart (list ,[n=mane v=tape]) :: XML attributes +++ marv ?(%da %tas %ud) :: release form +++ marx $|(@tas [n=mane a=mart]) :: XML tag +++ math (map ,@t (list ,@t)) :: semiparsed headers +++ meal :: payload + $% [%back p=cape q=flap r=@dr] :: acknowledgment + [%bond p=life q=@ta r=@ud s=*] :: message + [%carp p=@ q=@ud r=@ud s=flap t=@] :: skin/inx/cnt/hash + [%fore p=ship q=(unit lane) r=@] :: forwarded packet + == :: +++ mess (list ,[p=@t q=@t]) :: raw http headers +++ meta :: path metadata + $% [& q=@uvI] :: hash + [| q=(list ,@ta)] :: dir + == :: +++ meth ?(%get %post) :: http method +++ mime (list ,@ta) :: mime type +++ miso :: ankh delta + $% [%del p=*] :: delete + [%ins p=*] :: insert + [%mut p=udon] :: mutate + == :: +++ moar ,[p=@ud q=@ud] :: normal change range +++ moat ,[p=case q=case] :: change range +++ mood ,[p=care q=case r=path] :: request in desk +++ moth ,[p=meth q=math r=(unit octs)] :: http operation +++ name ,[p=@t q=(unit ,@t) r=(unit ,@t) s=@t] :: first mid/nick last +++ newt ?(%boot %kick %mess %slay %wake) :: lifecycle events +++ nose :: response, kernel + $? [%$ p=(unit ,[p=typo q=(list)])] :: standard input + goad :: + == :: +++ note :: response, user + $? [%$ p=(unit ,[p=type q=(list)])] :: standard input + [%do p=vase] :: execution result + goad :: + == :: +++ nori :: repository action + $% [& p=soba] :: delta + [| p=@tas] :: label + == :: +++ octs ,[p=@ud q=@] :: octet-stream +++ oryx ,@uvH :: CSRF secret +++ oven :: flow by server + $: hen=duct :: admin channel + nys=(map flap bait) :: packets incoming + olz=(map flap cape) :: packets completed + wab=(map ship bath) :: relationship + == :: +++ pact path :: routed path +++ pail ?(%none %warm %cold) :: connection status +++ plan :: conversation state + $: ^= sat :: statistics + $: nex=@da :: next wakeup + wid=@ud :: max outstanding + == :: + == :: +++ plea ,[p=@ud q=[p=? q=@t]] :: live prompt +++ pork ,[p=(unit ,@ta) q=path] :: fully parsed url +++ prod ,[p=prom q=tape r=tape] :: prompt +++ prom ?(%text %pass %none) :: format type +++ purl ,[p=hart q=pork r=quay] :: parsed url +++ putt :: outgoing message + $: ski=snow :: sequence acked/sent + wyv=(list rock) :: packet list XX gear + == :: +++ pyre :: cascade stash + $: p=(map ,[p=path q=path r=coal] coal) :: by path + q=(map ,[p=path q=@uvI r=coal] coal) :: by source hash + r=(map ,[p=* q=coal] coal) :: by (soft) gene + == :: +++ quay (map ,@t ,@t) :: parsed url query +++ quri :: request-uri + $% [& p=purl] :: absolute + [| p=pork q=quay] :: relative + == :: +++ race :: inbound stream + $: did=@ud :: filled sequence + bum=(map ,@ud ,%dead) :: + mis=(map ,@ud ,[p=cape q=flap r=(unit)]) :: misordered + == :: +++ raft :: filesystem + $: las=@da :: last wakeup + fat=(map ,@p room) :: per host + == :: +++ rank ?(%czar %king %duke %earl %pawn) :: ship width class +++ rant :: namespace binding + $: p=[p=care q=case r=@tas] :: clade release book + q=path :: spur + r=* :: data + == :: +++ rave :: general request + $% [& p=mood] :: single request + [| p=moat] :: change range + == :: +++ rede :: mirror + $: lim=@da :: updated to + ask=(unit ,@da) :: requested to + pal=(list disc) :: propagated to + qyx=cult :: subscriptions + dom=dome :: state + == :: +++ riff ,[p=disc q=(unit rave)] :: request/desist +++ rill :: outbound stream + $: sed=@ud :: sent + san=(map ,@ud duct) :: outstanding + == :: +++ rind :: request manager + $: nix=@ud :: request index + bim=(map ,@ud ,[p=duct q=riff]) :: outstanding + fod=(map duct ,@ud) :: current requests + == :: +++ rink :: foreign state + $: hac=(map rump ,*) :: cache + mir=(map disc rede) :: mirrors by desk + == :: +++ riot (unit rant) :: response/complete +++ road :: secured oneway route + $: exp=@da :: expiration date + lun=(unit lane) :: route to friend + lew=will :: will of frien + == :: +++ room :: fs per ship (new) + $: hun=duct :: terminal duct + hez=(unit duct) :: sync duct + dos=(map ,@tas ,[p=cult q=dome]) :: native projects + den=(map ,@tas dock) :: links + rid=(map ship ,[p=rind q=rink]) :: neighbors + == :: +++ rock ,@uvO :: packet +++ rout ,[p=(list host) q=path r=oryx s=path] :: http route (new) +++ rump ,[p=care q=case r=@tas s=path] :: relative path +++ saba ,[p=ship q=@tas r=moar s=(list maki)] :: patch/merge +++ safe :: domestic host + $: hoy=(list ship) :: hierarchy + val=wand :: private keys + law=will :: server will + seh=(map hand ,[p=ship q=@da]) :: key cache + hoc=(map ship door) :: neighborhood + == :: +++ salt ,@uv :: entropy +++ scab :: logical request + $: p=scud :: routed url + q=quay :: query + == :: +++ scad ,[p=@p q=@da r=@uw s=cred] :: fab context, outer +++ scar :: logical url + $: p=hart :: scheme/host + q=path :: trunk + r=(unit ,@ta) :: extension + s=path :: detour + == :: +++ scud ,[p=pact q=scar] :: processed dispatch +++ seam ,[p=@ta q=pact r=scar] :: service route +++ sect ?(%black %blue %red %orange %white) :: banner +++ shed :: packet flow + $: $: rtt=@dr :: smoothed rtt + rto=@dr :: retransmit timeout + rtn=(unit ,@da) :: next timeout + rue=(unit ,@da) :: last heard from + == :: + $: nus=@ud :: number sent + nif=@ud :: number live + nep=@ud :: next expected + caw=@ud :: logical window + cag=@ud :: congest thresh + == :: + $: diq=(map flap ,@ud) :: packets sent + pyz=(map soup ,@ud) :: message/unacked + puq=(qeu ,[p=@ud q=soul]) :: packet queue + == :: + == :: +++ skit ,[p=(unit ,@ta) q=(list ,@ta) r=(list ,@ta)] :: tracking path +++ sink :: incoming per server + $: nes=(map flap ,[p=@da q=bait]) :: fragment actions + == :: +++ skin ?(%none %open %fast %full) :: encoding stem +++ slip ,[p=bell q=goal] :: traceable request +++ sled ,[p=* q=*] :: [data code] +++ snow ,[p=@ud q=@ud r=(set ,@ud)] :: window exceptions +++ soap ,[p=[p=life q=life] q=@tas r=@ud] :: statement id +++ soup ,[p=@tas q=@ud] :: new statement id +++ soul :: packet in travel + $: gom=soup :: message identity + nux=@ud :: xmission count + liv=? :: deemed live + lys=@da :: last sent + pac=rock :: packet data + == :: +++ soba ,[p=cart q=(list ,[p=path q=miso])] :: delta +++ sock ,[p=ship q=ship] :: from to +++ spur path :: modeshipdeskcasespur +++ step ,[p=bray q=gens r=pass] :: identity stage +++ tart _|+([@da path note] *bowl) :: process core +++ task :: + $: paq=(qeu gyro) :: prompt queue + wip=[p=@ud q=(map ,@ud beak)] :: processes + == :: +++ taxi ,[p=lane q=rock] :: routed packet +++ tick ,@ud :: process id +++ town :: all security state + $: lit=@ud :: imperial modulus + any=@ :: entropy + urb=(map ship safe) :: all keys and routes + == :: +++ tube path :: message channel +++ typo ,* :: presumed type +++ wand (list ,[p=life q=ring r=acro]) :: mace in action +++ what :: logical identity + $% [%anon ~] :: anonymous + [%band p=corp] :: creative )( + [%crew p=corp] :: business <> + [%dept p=corp] :: government <<>> + [%fair p=corp] :: nonprofit >< + [%holy p=corp] :: religious || + [%home p=corp] :: family -()- + [%lady p=whom] :: female person () + [%lord p=whom] :: male person [] + [%punk p=@t] :: opaque handle "" + == :: +++ whom ,[p=@ud q=govt r=sect s=name] :: year/govt/id +++ will (list deed) :: certificate +++ worm ,* :: vase of tart +++ yard :: terminal state + $: p=? :: verbose + q=blur :: display state + r=(map path hist) :: history + == :: +-- diff --git a/main/bin/begin.hoon b/main/bin/begin.hoon new file mode 100644 index 0000000000..67f047df31 --- /dev/null +++ b/main/bin/begin.hoon @@ -0,0 +1,195 @@ +!: +:: /=main=/bin/begin/hoon +:: +=> .(-< `who=@p`-<) +=> .(+ =>(+ ^/===/lib/pony)) +|= [est=time *] +|= arg=$|(~ [p=@p ~]) +=- ^- bowl + ?^ arg (fud p.arg) + %+ pomp "" + %+ (polo ~ %text "Do you have a ship and a ticket? " "yes" ~) + ;~(pose (jest %yes) (just %no)) + |= [* ans=@t] + ?. =(%yes ans) + :_ ~ + :~ [%la %leaf "Please ask curtis.yarvin@gmail.com for one."] + == + %+ (polo ~ %text "Your ship: ~" ~ ~) + fed:ag + |= [* mig=@p] + ^- bowl + (fud mig) +^= fud +|= mig=@p +=+ bos=(sein mig) +?> !=(bos mig) +=< main +|% +++ looc ;~(pose alp (shim 128 255)) +++ loon + %+ cook + |= all=(list ,@t) + |- ^- @t + ?~ all %$ + ?~ t.all i.all + (cat 3 i.all (cat 3 ' ' $(all t.all))) + (most ace (cook |=(a=(list ,@) (rap 3 a)) (plus looc))) +:: +++ main + ^- bowl + =+ ran=(clan mig) + =+ ^= cow + |- ^- @ud + ?- ran + %czar 256 + %king (mul 255 $(ran %czar)) + %duke (mul 65.535 $(ran %king)) + %earl (mul (dec (bex 32)) $(ran %duke)) + %pawn (sub (bex 128) $(ran %earl)) + == + =+ ^= ves ^- tape + ?- ran + %czar "carriers" + %king "cruisers" + %duke "destroyers" + %earl "yachts" + %pawn "submarines" + == + =+ gup=(scow %p mig) + %+ pomp "" + %+ pomp "Launching {gup}, one of {} Urbit {ves}..." + %+ pomp "" + %+ pomp " If I did not build for myself" + %+ pomp " for whom should I build?" + %+ pomp "" + %+ pomp " -- Bunting, _Chomei at Toyama_" + %+ pond ^:@/===doc%/warning/txt + %+ (polo ~ %text "Your ticket: ~" ~ ~) + fed:ag + |= [* tic=@p] + %+ pond ^:@/===doc%/entropy/txt + %+ (polo ~ %pass "Entropy: " ~ ~) + (boss 256 (more gon qit)) + |= [* tey=@] + =. tey (shax tey) + %+ pomp "Entropy check: {<`@p`(mug tey)>}" + %+ pond ^:@/===doc%/language/txt + %+ (polo ~ %text "Language: " "en" ~) + %+ sear + |= [a=@ b=@] + ^- (unit ,@ta) + =+ c=(cat 3 a b) + =+(d=(glon c) ?~(d ~ [~ c])) + ;~(plug low low) + |= [* lag=lang] + %+ pomp "" + %+ pomp "Okay, we'll be speaking {(need (glon lag))}." + ^- bowl + ?. ?=(%duke ran) + %+ (polo ~ %text "Name: " ~ ~) + (boss 256 (more gon qit)) + |= [now=@da nam=@] + (moss now tic tey lag (gcos [ran nam])) + %+ pond ^:@/===doc%/identity/txt + %+ (polo ~ %text "Form: %" "lady" ~) + ;~ pose + (jest %anon) + (jest %band) + (jest %crew) + (jest %dept) + (jest %fair) + (jest %holy) + (jest %home) + (jest %lady) + (jest %lord) + (jest %punk) + == + |= [now=@da fom=@t] + ?+ fom !! + %anon (moss now tic tey lag [%duke %anon ~]) + %punk + %+ (polo ~ %text "Handle: " ~ ~) + (boss 256 (plus alp)) + |= [now=@da puc=@t] + (moss now tic tey lag [%duke %punk puc]) + :: + ?(%band %crew %dept %fair %home %holy) + %- moon + |= [* gov=govt] + %+ (polo ~ %text "Name: " ~ ~) + loon + |= [now=@da nam=@t] + (moss now tic tey lag [%duke (what fom `corp`[nam gov])]) + :: + ?(%lord %lady) + %+ pond ^:@/===doc%/person/txt + %+ (polo ~ %text "Year you were born: " "19" ~) + dim:ag + |= [* yar=@] + %- moon + |= [* gov=govt] + %+ pond ^:@/===doc%/name/txt + %+ (polo ~ %text "First name: " ~ ~) + loon + |= [* fis=@t] + %+ (polo ~ %text "Middle name (or blank): " ~ ~) + ;~(pose (stag ~ loon) (easy ~)) + |= [* mid=(unit ,@t)] + %+ (polo ~ %text "Nickname/handle (or blank): " ~ ~) + ;~(pose (stag ~ loon) (easy ~)) + |= [* nik=(unit ,@t)] + %+ (polo ~ %text "Last name: " ~ ~) + loon + |= [* las=@t] + %+ pond ^:@/===doc%/banner/txt + %+ (polo ~ %text "Banner: %" "blue" ~) + ;~ pose + (jest %white) + (jest %blue) + (jest %red) + (jest %black) + (jest %orange) + == + |= [now=@da ban=@t] + => .(ban (?(%white %blue %red %black %orange) ban)) + =+ nam=`name`[fis mid nik las] + (moss now tic tey lag `gcos`[%duke %lord `whom`[yar gov ban nam]]) + == +:: +++ moon + |* woo=||([@da govt] bowl) + %+ pond ^:@/===doc%/location/txt + %+ (polo ~ %text "Location: " "us/94114" ~) + ;~ pose + ;~ plug + (cook |=([a=@ b=@] (cat 3 a b)) ;~(plug low low)) + ;~ pose + ;~(pfix fas (plus ;~(pose hig hep nud))) + (easy ~) + == + == + (easy ~) + == + woo +:: +++ moss + |= [now=@da tic=@p tey=@ ges=gens] + ^- bowl + =+ bur=(shax :(mix (jam ges) tey)) + %+ (posh (add ~s1 now)) ~[la/leaf/"generating 2048-bit RSA key..."] + |= now=@da + =+ loy=(brew 2.048 bur) + %- (post bos [%ta %to] [mig tic ges pub:ex:loy]) + |= [now=@da rup=(unit ,*)] + :_ ~ + ?~ rup ~[la/leaf/"request rejected"] + =+ mac=`mace`[[0 sec:ex:loy] ~] + =+ wil=((hard (unit will)) u.rup) + ?~ wil + :~ [%la %leaf "request rejected - invalid ticket"] + == + :~ [%la %leaf "request approved"] + [%xy /a `card`[%cash mig mac u.wil]] + == +-- diff --git a/main/bin/cat.hoon b/main/bin/cat.hoon new file mode 100644 index 0000000000..fcc96461e3 --- /dev/null +++ b/main/bin/cat.hoon @@ -0,0 +1,16 @@ +!: +:: /=main=/toy/cat/hoon +:: +|= * +|= ape=(list path) +:_ ~ +:_ ~ +^- gift +:+ %mu [%atom %t] +=- |- ^- (list ,@t) + ?~(foz ~ (weld i.foz $(foz t.foz))) +^= foz +=| foz=(list (list ,@t)) +|- ^+ foz +?~ ape ~ +[(lore ((hard ,@) .^(%cx i.ape))) $(ape t.ape)] diff --git a/main/bin/cd.hoon b/main/bin/cd.hoon new file mode 100644 index 0000000000..90cf9e2c81 --- /dev/null +++ b/main/bin/cd.hoon @@ -0,0 +1,27 @@ +!: +:: /=main=/bin/cd/hoon +:: +=> .(-< `who=@p`-<) +|= [est=time *] +|= arg=$|(~ [p=path ~]) +:_ ~ +^- (list gift) +?~ arg + :~ [%cc ~] + [%cs ~] + == +?. ?=(^ p.arg) ~ +?. =(i.p.arg (scot %p who)) ~|(%bad-ship !!) +?. ?=(^ t.p.arg) ~ +=+ gav=(slay i.t.p.arg) +?. ?=([~ %$ %tas *] gav) ~|(%bad-desk !!) +:- [%ck q.p.u.gav] +?. ?=(^ t.t.p.arg) ~ +=+ gov=(slay i.t.t.p.arg) +:- :- %cc + ?+ gov ~|(%bad-case !!) + [~ %$ %da *] ?:(=(est q.p.u.gov) ~ [~ %da q.p.u.gov]) + [~ %$ %ud *] [~ %ud q.p.u.gov] + [~ %$ %tas *] [~ %tas q.p.u.gov] + == +[[%cs t.t.t.p.arg] ~] diff --git a/main/bin/diff.hoon b/main/bin/diff.hoon new file mode 100644 index 0000000000..c9a4a8910e --- /dev/null +++ b/main/bin/diff.hoon @@ -0,0 +1,15 @@ +!: +:: /=main=/toy/cat/hoon +:: +|= * +|= [del=path dev=path ~] +:_ ~ +:_ ~ +^- gift +=+ [hel=(lore ((hard ,@) .^(%cx del))) hev=(lore ((hard ,@) .^(%cx dev)))] +=+ dis=(loss hel hev) +=+ puc=(lusk hel hev dis) +=+ rev=(lurk hel puc) +=+ ver=(lurk hev (berk puc)) +?> &(=(rev hev) =(ver hel)) +[%la >puc<] diff --git a/main/bin/echo.hoon b/main/bin/echo.hoon new file mode 100644 index 0000000000..ce58dfe02a --- /dev/null +++ b/main/bin/echo.hoon @@ -0,0 +1,6 @@ +!: +:: /=main=/toy/echo/hoon +:: +|= * +|= tan=(list tank) +[(turn tan |=(a=tank [%la a])) ~] diff --git a/main/bin/env.hoon b/main/bin/env.hoon new file mode 100644 index 0000000000..da2ab3c4bd --- /dev/null +++ b/main/bin/env.hoon @@ -0,0 +1,23 @@ +!: +:: /=main=/bin/env/hoon +:: +=> .(- [who=`@p`-< how=`path`->]) +|= [est=time eny=@uw] +|= arg=(list) +^- bowl +:_ ~ +=+ ^= voy ^- (list tape) + :~ "who: {}" + "how: {}" + "est: {}" + "eny: {}" + == +:: +=+ ^= gar + =+ nix=1 + |- ^- (list tape) + ?~ arg ~ + :_ $(arg t.arg, nix +(nix)) + "arg: {(pave !>(nix))}: {(pave !>(i.arg))}" +:: +(turn (weld voy gar) |=(a=tape [%la %leaf a])) diff --git a/main/bin/hello.hoon b/main/bin/hello.hoon new file mode 100644 index 0000000000..338e547e0a --- /dev/null +++ b/main/bin/hello.hoon @@ -0,0 +1,9 @@ +:: +:: /=main=/bin/hello/hoon +:: +|= * +|= [planet=@ta ~] +^- bowl +:_ ~ :_ ~ +:- %$ +!>("hello, {(trip planet)}.") diff --git a/main/bin/hi.hoon b/main/bin/hi.hoon new file mode 100644 index 0000000000..7458c9b477 --- /dev/null +++ b/main/bin/hi.hoon @@ -0,0 +1,21 @@ +!: +:: /=main=/toy/hi/hoon +:: +|= * +|= [bud=@p ebb=$|(~ [tex=tape ~])] +^- bowl +:- ~ +:- ~ +:- ^- (list slip) + :~ [/foo/bar [%yo bud %hi ?~(ebb '' (rap 3 tex.ebb))]] + == +|= [now=@da pax=path nut=note] +?> =(/foo/bar pax) +?> ?=(%yo -.nut) +:- ?: =(%good q.nut) + ~ + :_ ~ + :- %ha + :- %leaf + "hi: {}.{} spurned {}/{}/{}" +~ diff --git a/main/bin/hupdate.hoon b/main/bin/hupdate.hoon new file mode 100644 index 0000000000..45c9a8e07f --- /dev/null +++ b/main/bin/hupdate.hoon @@ -0,0 +1,10 @@ +!: +:: /=main=/bin/hupdate/hoon +:: +=> .(-< `who=@p`-<) +|= * +|= ~ +:_ ~ +=+ bos=(sein who) +:~ [%xy /c [%pull bos %arvo ~[%arvo]]] +== diff --git a/main/bin/label.hoon b/main/bin/label.hoon new file mode 100644 index 0000000000..202f05ce15 --- /dev/null +++ b/main/bin/label.hoon @@ -0,0 +1,9 @@ +!: +:: /=main=/bin/label/hoon +:: +|= * +|= [syd=@tas lab=@tas ~] +^- bowl +:_ ~ +:~ [%ok syd %| lab] +== diff --git a/main/bin/ls.hoon b/main/bin/ls.hoon new file mode 100644 index 0000000000..503066a5a9 --- /dev/null +++ b/main/bin/ls.hoon @@ -0,0 +1,13 @@ +!: +:: /=main=/bin/ls/hoon +:: +|= * +|= [pax=path ~] +:_ ~ +^- (list gift) +=+ lon=((hard arch) .^(%cy pax)) +?: =(~ r.lon) ~ +:_ ~ +:- %la +:+ %rose [" " "" ""] +(turn (~(tap by r.lon) ~) |=([a=@ta b=*] [%leaf (trip a)])) diff --git a/main/bin/none.hoon b/main/bin/none.hoon new file mode 100644 index 0000000000..8c600c9d91 --- /dev/null +++ b/main/bin/none.hoon @@ -0,0 +1,7 @@ +!: +:: /=main=/bin/none/hoon +:: +|= * +|= * +^- bowl +[~ ~] diff --git a/main/bin/nusolid.hoon b/main/bin/nusolid.hoon new file mode 100644 index 0000000000..423f56321d --- /dev/null +++ b/main/bin/nusolid.hoon @@ -0,0 +1,41 @@ +!: +:: /=main=/bin/solid/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 ~]) +~& %solid-start +=+ gen=(reck pax) +~& %solid-parsed +=+ ken=q:(~(mint ut %noun) %noun gen) +~& %solid-compiled +=+ ^= all + =+ all=.*(0 ken) + =+ ^= vay ^- (list ,[p=@tas q=@tas]) + :~ [%$ %zuse] + [%a %ames] + [%b %behn] + [%c %clay] + [%d %dill] + [%e %eyre] + == + |- ^+ all + ?~ vay all + =+ pax=(weld top `path`[q.i.vay ~]) + =+ txt=((hard ,@) .^(%cx (weld pax `path`[%hoon ~]))) + =+ sam=[est `ovum`[[%gold ~] [%veer p.i.vay pax txt]]] + ~& [%solid-veer i.vay] + =+ gat=.*(all .*(all [0 42])) + =+ nex=+:.*([-.gat [sam +>.gat]] -.gat) + $(vay t.vay, all nex) +:_ ~ :_ ~ +=+ pac=(jam [ken all]) +~& %solid-finished +[%xx %save [%urbit %pill ~] pac] diff --git a/main/bin/pope.hoon b/main/bin/pope.hoon new file mode 100644 index 0000000000..f5e137dcd6 --- /dev/null +++ b/main/bin/pope.hoon @@ -0,0 +1,19 @@ +!: +:: /=main=/bin/pope/hoon +:: +=> .(+ =>(+ ^/===/lib/pony)) +|= [est=time *] +|= [who=@p ~] +^- bowl +%+ (polo ~ %pass "passphrase: " ~) + (boss 256 (more gon qit)) +|= [now=@da fra=@] +%+ (posh (add ~s1 now)) + ~[la/leaf/"generating carrier {(scow %p who)} (#{(scow %ud who)})"] +|= now=@da +:_ ~ +=+ bur=(shax (add who (shax fra))) +=+ arc=(brew 2.048 bur) +:~ [%la %leaf "generator: {(scow %uw bur)}"] + [%la %leaf "fingerprint: {(scow %uw fig:ex:arc)}"] +== diff --git a/main/bin/ram.hoon b/main/bin/ram.hoon new file mode 100644 index 0000000000..98b42c3d9a --- /dev/null +++ b/main/bin/ram.hoon @@ -0,0 +1,41 @@ +!: +:: /=main=/bin/ram/hoon +:: +=> .(- `[who=@p how=path]`-) +|= * +|= ape=(list path) +=+ ^= maw ^- (list slip) + :~ [~ %$ %noun] + == +:- ~ :- ~ +:- maw +|= [now=@da pax=path nut=note] +^- bowl +?+ -.nut [~ ~ maw ..$] + %$ + ?~ p.nut [~ ~] + =| giv=(list gift) + |- ^- bowl + ?: |(?=(~ ape) ?=(~ q.u.p.nut)) + [giv ~ maw ..^$] + =+ pax=i.ape + ?> ?=([@ @ @ *] pax) + ?> &(=(i.pax (scot %p who)) =(i.t.t.pax (scot %da now))) + %= $ + ape t.ape + giv + :_ giv + ^- gift + :+ %ok i.t.pax + ^- nori + :- %& + ^- soba + :_ ~ + :- t.t.t.pax + ^- miso + =+ fil=(file pax) + ?~ fil + [%ins i.q.u.p.nut] + [%mut %a %a u.fil i.q.u.p.nut] + == +== diff --git a/main/bin/rat.hoon b/main/bin/rat.hoon new file mode 100644 index 0000000000..70df0a4964 --- /dev/null +++ b/main/bin/rat.hoon @@ -0,0 +1,12 @@ +!: +:: /=main=/bin/rat/hoon +:: +|= * +|= ape=(list path) +:_ ~ +:_ ~ +^- gift +:+ %mu %noun +|- ^- (list) +?~ ape ~ +[.^(%cx i.ape) $(ape t.ape)] diff --git a/main/bin/reboot.hoon b/main/bin/reboot.hoon new file mode 100644 index 0000000000..af9605d1ee --- /dev/null +++ b/main/bin/reboot.hoon @@ -0,0 +1,25 @@ +!: +:: /=main=/fun/reboot/hoon +:: +=> .(- `[who=@p how=path]`-) +|= [est=time eny=@uw] +|= arg=* +=+ ^= lok ^- case + ?: =(~ arg) [%da est] + ?> =(~ +.arg) + ((hard case) -.arg) +=+ pre=`path`[(scot %p who) %arvo ~(rent co %$ (dime lok)) ~] +=+ ^= vay ^- (list ,[p=@tas q=@tas]) + :~ [%$ %zuse] + [%a %ames] + [%b %batz] + [%c %clay] + [%d %dill] + [%e %eyre] + == +:_ ~ +%+ turn vay +|= [saw=@tas nam=@tas] +=+ pax=(weld pre `path`[nam ~]) +=+ txt=.^(%cx (weld pax `path`[%hoon ~])) +[%xx [%veer saw pax txt]] diff --git a/main/bin/reload.hoon b/main/bin/reload.hoon new file mode 100644 index 0000000000..0071467509 --- /dev/null +++ b/main/bin/reload.hoon @@ -0,0 +1,9 @@ +!: +:: /=main=/toy/veer/hoon +:: +=> .(- `[who=@p how=path]`-) +|= [est=time *] +|= [nam=@tas ~] +=+ tip=(end 3 1 nam) +=+ pax=[(scot %p who) %arvo (scot %da est) nam %hoon ~] +[[[%xx [%veer ?:(=('z' tip) %$ tip) pax (,@ .^(%cx pax))]] ~] ~] diff --git a/main/bin/reset.hoon b/main/bin/reset.hoon new file mode 100644 index 0000000000..7e34e94f86 --- /dev/null +++ b/main/bin/reset.hoon @@ -0,0 +1,35 @@ +!: +:: /=main=/fun/reset/hoon +:: +=> .(-< `who=@p`-<) +|= [est=time *] +|= 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 ~]) +~& %reset-start +=+ gen=(reck pax) +~& %reset-parsed +=+ ken=q:(~(mint ut %noun) %noun gen) +=+ all=.*(0 ken) +~& %reset-compiled +:_ ~ +:- [%xx %volt all] +^- (list gift) +=+ ^= vay ^- (list ,[p=@tas q=@tas]) + :~ [%$ %zuse] + [%a %ames] + [%b %batz] + [%c %clay] + [%d %dill] + [%e %eyre] + == +%+ turn vay +|= [a=@tas b=@tas] +=+ pax=(weld top `path`[b ~]) +=+ txt=((hard ,@) .^(%cx (weld pax `path`[%hoon ~]))) +`gift`[%xx %veer a pax txt] diff --git a/main/bin/set.hoon b/main/bin/set.hoon new file mode 100644 index 0000000000..3b01b7c4e2 --- /dev/null +++ b/main/bin/set.hoon @@ -0,0 +1,22 @@ +!: +:: /=main=/bin/set/hoon +:: +|= * +|= [nam=@tas ~] +=+ ^= rod ^- (list slip) + :~ [~ %$ %noun] + == +:- ~ :- ~ +:- rod +|= [now=@da pax=path nut=note] +^- bowl +?> ?=(%$ -.nut) +?~ p.nut + :_ ~ + :~ [%va nam ~] + == +?~ q.u.p.nut + [~ ~ rod ..$] +:_ ~ +:~ [%va nam ~ p.u.p.nut -.q.u.p.nut] +== diff --git a/main/bin/solid.hoon b/main/bin/solid.hoon new file mode 100644 index 0000000000..d516354ae4 --- /dev/null +++ b/main/bin/solid.hoon @@ -0,0 +1,41 @@ +!: +:: /=main=/bin/solid/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 ~]) +~& %solid-start +=+ gen=(reck pax) +~& %solid-parsed +=+ ken=q:(~(mint ut %noun) %noun gen) +~& %solid-compiled +=+ ^= all + =+ all=.*(0 ken) + =+ ^= vay ^- (list ,[p=@tas q=@tas]) + :~ [%$ %zuse] + [%a %ames] + [%b %batz] + [%c %clay] + [%d %dill] + [%e %eyre] + == + |- ^+ all + ?~ vay all + =+ pax=(weld top `path`[q.i.vay ~]) + =+ txt=((hard ,@) .^(%cx (weld pax `path`[%hoon ~]))) + =+ sam=[est `ovum`[[%gold ~] [%veer p.i.vay pax txt]]] + ~& [%solid-veer i.vay] + =+ gat=.*(all .*(all [0 42])) + =+ nex=+:.*([-.gat [sam +>.gat]] -.gat) + $(vay t.vay, all nex) +:_ ~ :_ ~ +=+ pac=(jam [ken all]) +~& %solid-finished +[%xx %save [%urbit %pill ~] pac] diff --git a/main/bin/sys.hoon b/main/bin/sys.hoon new file mode 100644 index 0000000000..0fe15935d0 --- /dev/null +++ b/main/bin/sys.hoon @@ -0,0 +1,6 @@ +!: +:: /=main=/toy/sys/hoon +:: +|= * +|= [pax=path fav=card ~] +[[[%xy pax fav] ~] ~] diff --git a/main/bin/ticket.hoon b/main/bin/ticket.hoon new file mode 100644 index 0000000000..acccba37a7 --- /dev/null +++ b/main/bin/ticket.hoon @@ -0,0 +1,27 @@ +!: +:: /=main=/bin/ticket/hoon +:: +=> .(-< `who=@p`-<) +|= [est=time *] +|= arg=* +^- bowl +:_ ~ +=+ ^= fir ^- [p=@p q=@ud] + ?: ?=([@ ~] arg) + [-.arg 1] + ?: ?=([@ @ ~] arg) + [-.arg +<.arg] + ~|(%ticket-arg !!) +?> &(=(who (sein p.fir)) =(who (sein (add p.fir (dec q.fir))))) +=+ ^= sep ^- @ + =+ mir=(clan p.fir) + ?+ mir ~|(%ticket-clan !!) + %king (bex 8) + %duke (bex 16) + %earl (bex 32) + == +|- ^- (list gift) +?: =(0 q.fir) ~ +=+ tic=(,@p .^(%a (scot %p who) %tick (scot %da est) (scot %p p.fir) ~)) +:- [%la %leaf "{}: {}"] +$(p.fir (add sep p.fir), q.fir (dec q.fir)) diff --git a/main/bin/update.hoon b/main/bin/update.hoon new file mode 100644 index 0000000000..f7b218cb53 --- /dev/null +++ b/main/bin/update.hoon @@ -0,0 +1,12 @@ +!: +:: /=main=/bin/update/hoon +:: +=> .(-< `who=@p`-<) +|= * +|= ~ +:_ ~ +=+ bos=(sein who) +:~ [%xy /c [%pull bos %main ~[%main]]] + [%xy /c [%pull bos %spec ~[%spec]]] + [%xy /c [%pull bos %arvo ~[%arvo]]] +== diff --git a/main/bin/with.hoon b/main/bin/with.hoon new file mode 100644 index 0000000000..5dc49d0e78 --- /dev/null +++ b/main/bin/with.hoon @@ -0,0 +1,18 @@ +!: +:: /=main=/bin/with/hoon +:: +|= [est=@da *] +|= arg=(list path) +^- bowl +:_ ~ +^- (list gift) +=< abet +|% +++ abet ?:(=(~ arg) [[%sc ~] ~] (turn arg |=(a=path `gift`[%sc ~ (with a)]))) +++ with + |= pax=path ^- skit + ?> ?=([@ @ @ *] pax) + :+ ?:(=((scot %da est) i.t.t.pax) ~ [~ i.t.t.pax]) + [i.pax i.t.pax ~] + t.t.t.pax +-- diff --git a/main/bin/ye.hoon b/main/bin/ye.hoon new file mode 100644 index 0000000000..4a894568a9 --- /dev/null +++ b/main/bin/ye.hoon @@ -0,0 +1,23 @@ +!: +:: /=main=/toy/ye/hoon +:: +=> .(-< `who=@p`-<) +|= * +|= [ebb=$|(~ [tex=tape ~])] +=+ bud=(sein who) +^- bowl +:- ~ +:- ~ +:- ^- (list slip) + :~ [/foo/bar [%yo bud %ye ?~(ebb '' (rap 3 tex.ebb))]] + == +|= [now=@da pax=path nut=note] +?> =(/foo/bar pax) +?> ?=(%yo -.nut) +:- ?: =(%good q.nut) + ~ + :_ ~ + :- %ha + :- %leaf + "hi: {}.{} spurned {}/{}/{}" +~ diff --git a/main/doc/begin/banner.txt b/main/doc/begin/banner.txt new file mode 100644 index 0000000000..666d925f18 --- /dev/null +++ b/main/doc/begin/banner.txt @@ -0,0 +1,24 @@ + +One basic human instinct is the urge to form political tribes. +In a network that fights this need, these tribes form anyway and +they form badly. Urbit designs them into the infrastructure. +Inspired by the Qing Dynasty, you'll align yourself with one of +five colored "banners" - %red, %blue, %orange, %black or %white. + +Political discourse across tribal boundaries is almost always an +antisocial act - less communication, than symbolic violence. In +Urbit, messages marked political stay within your own banner; +your friends in other banners simply won't see them. Between +banners, politics doesn't erode apolitical relationships; inside +each banner, political discourse is harmonious and productive. + +Pick a banner by the adjective you feel best describes you: + +%red far left: radical, anarchist +%blue center-left: moderate, liberal +%orange center-right: conservative, libertarian +%black far right: traditionalist, reactionary + +Or if digital agitation isn't your cup of tea, choose %white, and +your Urbit experience will remain politics-free. + diff --git a/main/doc/begin/entropy.txt b/main/doc/begin/entropy.txt new file mode 100644 index 0000000000..e9858e4a10 --- /dev/null +++ b/main/doc/begin/entropy.txt @@ -0,0 +1,4 @@ + +Enter a passphrase or other unusual text. You (or your enemies) +can regenerate your ship from this entropy. + diff --git a/main/doc/begin/govt.txt b/main/doc/begin/govt.txt new file mode 100644 index 0000000000..5ce7b898f2 --- /dev/null +++ b/main/doc/begin/govt.txt @@ -0,0 +1,2 @@ + +Enter diff --git a/main/doc/begin/identity.txt b/main/doc/begin/identity.txt new file mode 100644 index 0000000000..0ca6ca9cde --- /dev/null +++ b/main/doc/begin/identity.txt @@ -0,0 +1,14 @@ + +Please select one of the pre-chosen forms: + + %lady female-identified individual + %lord male-identified individual + %punk opaque handle + %anon totally anonymous + %home family + %crew corporation + %band creative collective + %fair nonprofit + %dept government agency + %holy religious institution + diff --git a/main/doc/begin/language.txt b/main/doc/begin/language.txt new file mode 100644 index 0000000000..40f524118a --- /dev/null +++ b/main/doc/begin/language.txt @@ -0,0 +1,6 @@ + +What language would your ship rather speak? Enter it as a +two-letter (ISO 639-1) code, like "en" for English. Whatever +language you pick, it'll all be English now, but in future +we'll be more sensitive to your needs. + diff --git a/main/doc/begin/location.txt b/main/doc/begin/location.txt new file mode 100644 index 0000000000..ad46d836cf --- /dev/null +++ b/main/doc/begin/location.txt @@ -0,0 +1,5 @@ + +Where are you? This is totally optional, but we'd like to +know your vague general location. You can enter nothing at +all, just a country code, or country and postal code. + diff --git a/main/doc/begin/name.txt b/main/doc/begin/name.txt new file mode 100644 index 0000000000..64f087bcca --- /dev/null +++ b/main/doc/begin/name.txt @@ -0,0 +1,5 @@ + +Please tell us your name - and please make it a real name. +Pseudonyms are totally cool, but please use %punk. Middle +name and nickname are optional. Ünicode is encouraged. + diff --git a/main/doc/begin/person.txt b/main/doc/begin/person.txt new file mode 100644 index 0000000000..92a8214427 --- /dev/null +++ b/main/doc/begin/person.txt @@ -0,0 +1,19 @@ + +You've selected a personal identity. For a %lord or a %lady, +please use your real name only. If you'd prefer a fictitious +handle, you can hit ^C and start over as a %punk. Or you can +use %anon and go by your ship name alone. + +As a real person, we're going to ask you for a little bit of +personal information - not enough to compromise your privacy, +just enough to make everyone on Urbit feel like a neighbor. + +What we're going to ask you for is information that's (a) +public (would be obvious, or at least easy to guess, for +someone who met you in person); (b) durable (doesn't change +often); and (c) relevant (helps you connect with friends). + +For example, we'll ask for the year (not day) you were born, +because your age is easy to guess in person, doesn't change, +and has a big effect on how people perceive you. + diff --git a/main/doc/begin/ship.txt b/main/doc/begin/ship.txt new file mode 100644 index 0000000000..139597f9cb --- /dev/null +++ b/main/doc/begin/ship.txt @@ -0,0 +1,2 @@ + + diff --git a/main/doc/begin/ticket.txt b/main/doc/begin/ticket.txt new file mode 100644 index 0000000000..b0a6e824f5 --- /dev/null +++ b/main/doc/begin/ticket.txt @@ -0,0 +1,2 @@ + +You should already have a ticket (invitation code). diff --git a/main/doc/begin/warning.txt b/main/doc/begin/warning.txt new file mode 100644 index 0000000000..b00218b697 --- /dev/null +++ b/main/doc/begin/warning.txt @@ -0,0 +1,5 @@ + +Let's configure your identity. Warning - it's nontrivial to +change this data once you've sent it to the server. If you enter +something wrong, hit ^C to cancel, then run the program again. + diff --git a/main/lib/hume.hoon b/main/lib/hume.hoon new file mode 100644 index 0000000000..450eb01f90 --- /dev/null +++ b/main/lib/hume.hoon @@ -0,0 +1,162 @@ +!: +:: application standard library +:: +=> + |% :: models + ++ cron ?(%day %hour %minute %none %second) :: wake frequency + ++ lamp :: simple web app + $_ ^? |% :: opaque object + ++ give :: serve + |= [now=@da fig=weev] :: time, request + :- p=*(list gift) :: act + q=*(unit ,[p=(list slip) q=lamp]) :: request/continue + :: :: + ++ miss :: redirect? + |= [pac=pact ced=cred] :: test and apply + ^- (unit purl) :: + ~ :: + -- :: + ++ lump ,[p=path q=mime r=octs] :: submitted data + ++ user ?(%born %came %died %left) :: user event + ++ wick vase :: vase of lamp + ++ weev :: web event + $% [%cron p=cron] :: wakeup + [%form p=pact q=quay] :: posted form + [%note p=path q=note] :: extrinsic note + [%post p=pact q=mime q=octs] :: non-form post + [%putt p=pact q=(list lump)] :: put + [%user p=user] :: user event + == :: + -- :: +|% :: functions +++ lunt :: web framework + |= :* who=ship :: owner + :: msg=tape :: prompt + ped=cron :: wake frequency + rut=(list rout) :: routes to + ras=wick :: server state + == + ^- bowl + =+ ^= hup ^- (list slip) + :~ [/ [%ht rut]] + :: [/ [%up %none msg]] + == + :- *(list gift) + :- ~ + :- hup + |= [now=@da pax=path nut=note] + ^- bowl + =+ [saw=*(list gift) ask=*(list slip)] + =< zing:wist + |% + ++ send :: dispatch event + |= bax=weev + ^+ +> + =+ sam=!>([now bax]) + =+ gat=(slap ras [%cnbc %give]) + =+ pro=(slam gat sam) + =+ [wax=(slot 2 pro) hin=(slot 3 pro)] + =. saw (weld ((hard (list gift)) q.wax) saw) + ?: =(~ q.hin) + +>.$ + =+ [vis=(slot 6 hin) lym=(slot 7 hin)] + =+ ^= gin ^- (list slip) + %+ turn ((hard (list slip)) q.vis) + |=(a=slip [[%lunt p.a] q.a]) + %= +>.$ + ask (weld ((hard (list slip)) q.vis) ask) + q.ras q.lym + == + :: + ++ pass :: try redirect + |= [pac=pact ced=cred] + ^- (unit purl) + =+ sam=!>([pac ced]) + =+ gat=(slap ras [%cnbc %miss]) + =+ pro=(slam gat sam) + ?: =(~ q.pro) ~ + =+ vur=(slot 3 pro) + [~ ((hard purl) q.vur)] + :: + ++ post :: handle post + |= [rid=@ud zab=scab ced=cred mot=moth] + ^+ +> + ?> ?=(^ r.mot) + =+ cot=(need (~(get by q.mot) %content-type)) + =+ ^= guz ^- (unit quay) + ?. =(cot ~['application/x-www-form-urlencoded']) ~ + =+ vex=((full yquy:epur) [1 1] (trip q.u.r.mot)) + ?~ q.vex ~ + [~ p.u.q.vex] + %- send + ?~ guz + [%post p.p.zab /application/octet-stream u.r.mot] :: XX parse cot + [%form p.p.zab u.guz] + :: + ++ went :: handle get + |= [rid=@ud zab=scab ced=cred mot=moth] + ^+ +> + =+ sek=(roil [who now (shax (mix (sham zab) now)) ced] zab ras) + =+ ^= rep + :+ %th rid + ?~ sek + [%raw [404 ~ [~ (tact "http error 404 at {}")]]] + u.sek + +>.$(saw [rep saw]) + :: + ++ wist :: handle note + ^+ . + ?. ?=(%ht -.nut) + ?> ?=([%lunt *] pax) + (send [%note t.pax nut]) + => ?:(=(%post p.s.nut) (post +.nut) .) + ?> ?=(%ht -.nut) + (went +.nut) + :: + ++ zing :: resolve + ^- bowl + [saw [~ (weld ask hup) ..$]] + -- +:: +++ roil + |= [mad=scad zab=scab ras=wick] + ^- (unit love) + =+ cag=`path`(flop p.p.zab) + ?> ?=(^ cag) + =+ syd=i.cag + =+ lok=~(rent co ~ %da q.mad) + =+ hox=~(rent co ~ %p p.mad) + =+ tem=`path`[hox syd lok %web t.cag] + =< veen + |% + ++ drem + |= axt=@ta + ^- (unit love) + =+ arc=((hard arch) .^(%cy tem)) + ?: (~(has by r.arc) axt) + =+ dat=((hard ,@) .^(%cx (weld tem `path`[axt ~]))) + :- ~ + :+ %mid + ?+ axt [%application %octet-stream ~] + %html [%text %html ~] + %txt [%text %plain ~] + %css [%text %css ~] + %js [%text %javascript ~] + == + [(met 3 dat) dat] + ?. (~(has by r.arc) %hoon) ~ + :- ~ + =+ vez=(vang & [hox syd lok t.cag]) + =+ dat=((hard ,@) .^(%cx (weld tem `path`[%hoon ~]))) + =+ gen=(scan (trip dat) (full (ifix [gay gay] tall:vez))) + =+ pro=(slam (slam (slap ras gen) !>(mad)) !>(zab)) + ((hard love) q.pro) + :: + ++ dunt + ^- (unit love) + (drem %html) + :: + ++ veen + ?~(r.q.p.zab dunt (drem u.r.q.p.zab)) + -- +-- diff --git a/main/lib/pony.hoon b/main/lib/pony.hoon new file mode 100644 index 0000000000..acf3f71f44 --- /dev/null +++ b/main/lib/pony.hoon @@ -0,0 +1,121 @@ +!: +:: /=main=/lib/pony/hoon +:: +|% +++ polo :: prompt + |= [gim=(list gift) pim=prom pro=tape def=tape use=tape] + |* [rul=_rule woo=||([@da *] bowl)] + ^- bowl + :- gim :- ~ + :- :~ [[%polo ~] [%up pim pro def]] + == + |= [now=@da pax=path nut=note] + ^- bowl + ?> &(=([%polo ~] pax) ?=(%up -.nut)) + =+ rey=(rush p.nut rul) + ?~ rey + :- [[%la %leaf ?~(use "invalid response" use)] ~] + :- ~ + [[[[%polo ~] [%up pim pro def]] ~] ..$] + (woo now u.rey) +:: +++ pomo |=([gud=gift bol=bowl] [[gud p.bol] q.bol]) +++ pomp |=([tix=tape bol=bowl] (pomo la/leaf/tix bol)) +++ pond :: show text block + |= [lub=@ bol=bowl] + ^- bowl + :_(q.bol (weld (turn (lore lub) |=(a=@t la/leaf/(trip a))) p.bol)) +:: +++ posh :: pause until + |= end=@da + |= [gim=(list gift) wop=||(@da bowl)] + ^- bowl + :- gim :- ~ + :- ^- (list slip) + :~ [~ %wa end] + == + |= [now=@da pax=path nut=note] + (wop now) +:: +++ post :: request/response + |= [him=@p [cho=@ta chu=@ta] msg=*] + |= woo=||([@da (unit ,*)] bowl) + ^- bowl + =+ leg="waiting for {(scow %p him)}" + :- ~ :- ~ + :- ^- (list slip) + :~ [/request [%yo him cho msg]] + [/response [%oy chu]] + [/prompt [%up %none leg ~]] + == + |= [now=@da pax=path nut=note] + ^- bowl + ?+ -.nut !! + %oy (woo now s.nut) + %yo + ?. =(%good q.nut) (woo now ~) + :- ~ :- ~ + :_ ..$ + ^- (list slip) + :~ [/response [%oy chu]] + [/prompt [%up %none leg ~]] + == + == +:: +++ pour + |= $: est=@da + dyz=(list ,[p=@tas q=[p=ship q=disc r=moat]]) + wop=||([@da (map ,@tas ,[p=(unit ,@ud) q=(list frog)])] bowl) + == + ^- bowl + ?~ dyz (wop est ~) + =+ :* zyd=(~(gas by *(map ,@tas ,[p=ship q=disc r=moat])) dyz) + fyx=*(map ,@tas ,[p=(unit ,@ud) q=(list frog)]) + == + =< apex + |% + ++ apex + ^- bowl + ?~ zyd done + :- ~ :- ~ + :- bite + |= [now=@da how=path wat=note] + ?> ?=([%eg *] wat) + ?> ?=([%pull @ ~] how) + apex:(bice(est now) i.t.how p.wat) + :: + ++ bice + |= [cyt=@tas rot=riot] + ^+ +> + ?~ rot + ~& [%bice-done cyt] + +>(zyd (~(del by zyd) cyt)) + ?> ?=(%ud -.q.p.u.rot) + =+ geb=(need (~(get by zyd) cyt)) + =+ saq=(need (~(get by fyx) cyt)) + %= +>.$ + zyd + %+ ~(put by zyd) cyt + ?> =(+(p.p.r.geb) p.q.p.u.rot) + geb(p.r q.p.u.rot) + :: + fyx + %+ ~(put by fyx) cyt + :- ?~(p.saq [~ p.q.p.u.rot] p.saq) + [((hard frog) r.u.rot) q.saq] + == + :: + ++ bite + ^- (list slip) + =+ who=?>(?=(^ zyd) p.n.zyd) + :- `slip`[/prod [%up %none "waiting for at ..." ~]] + =+ fuh=(~(tap by zyd) ~) + %+ turn fuh + |= [a=@tas b=[p=ship q=disc r=moat]] + `slip`[[%pl a ~] %es p.b q.b [%| r.b]] + :: + ++ done + ^- bowl + (wop est fyx) + -- +-- diff --git a/spec/nock/5.txt b/spec/nock/5.txt new file mode 100644 index 0000000000..0fb6235646 --- /dev/null +++ b/spec/nock/5.txt @@ -0,0 +1,42 @@ +1 Structures + + A noun is an atom or a cell. An atom is any natural number. + A cell is an ordered pair of nouns. + +2 Reductions + + nock(a) *a + [a b c] [a [b c]] + + ?[a b] 0 + ?a 1 + +[a b] +[a b] + +a 1 + a + =[a a] 0 + =[a b] 1 + =a =a + + /[1 a] a + /[2 a b] a + /[3 a b] b + /[(a + a) b] /[2 /[a b]] + /[(a + a + 1) b] /[3 /[a b]] + /a /a + + *[a [b c] d] [*[a b c] *[a d]] + + *[a 0 b] /[b a] + *[a 1 b] b + *[a 2 b c] *[*[a b] *[a c]] + *[a 3 b] ?*[a b] + *[a 4 b] +*[a b] + *[a 5 b] =*[a b] + + *[a 6 b c d] *[a 2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b] + *[a 7 b c] *[a 2 b 1 c] + *[a 8 b c] *[a 7 [[7 [0 1] b] 0 1] c] + *[a 9 b c] *[a 7 c 2 [0 1] 0 b] + *[a 10 [b c] d] *[a 8 c 7 [0 3] d] + *[a 10 b c] *[a c] + + *a *a diff --git a/try/bin/fib.hoon b/try/bin/fib.hoon new file mode 100644 index 0000000000..e10454a97f --- /dev/null +++ b/try/bin/fib.hoon @@ -0,0 +1,9 @@ +!: +:: /=try=/bin/fib/hoon +:: +|= * +|= [num=@ud ~] +:_ ~ :_ ~ +:- %$ +!> %. num + |=(x=@ ?:((lth x 2) 1 (add $(x (dec x)) $(x (sub x 2))))) diff --git a/try/bin/game.hoon b/try/bin/game.hoon new file mode 100644 index 0000000000..3a4528a582 --- /dev/null +++ b/try/bin/game.hoon @@ -0,0 +1,41 @@ +!: +:: /=try=/bin/game/hoon +:: +=> .(- `[who=@p how=path]`-) +=> .(+ =>(+ ^/=main=/hume)) +|= [est=time eny=@uw] +|= [neighbor=tape ~] +^- bowl +=+ messages=*(list ,@t) +%- lunt +:* who + %none + :- :~ :* :~ [%& /localhost] + [%| .127.0.0.1] + == + /game + (shas %game eny) + /try + == + == + ^- vase + !> |% + ++ give + |= [now=@da fig=weev] + ^- [p=(list gift) q=(unit ,[p=(list slip) q=_+>.$])] + ?+ -.fig + [~[la/leaf/"give other {}"] ~] + :: + %form + =+ msg=(~(get by q.fig) %msg) + ?~ msg + [~[la/leaf/"give odd form {}"] ~] + [~ [~ ~ +>.$(messages [u.msg messages])]] + == + :: + ++ miss + |= [pac=pact ced=cred] + ^- (unit purl) + ~ + -- +== diff --git a/try/bin/goodbye.hoon b/try/bin/goodbye.hoon new file mode 100644 index 0000000000..d9120a7e6a --- /dev/null +++ b/try/bin/goodbye.hoon @@ -0,0 +1,4 @@ +|= * +|= [planet=tape ~] +:_ ~ :_ ~ +[%$ !>("hasta la vista, {planet}.")] diff --git a/try/bin/infinite.hoon b/try/bin/infinite.hoon new file mode 100644 index 0000000000..43db9c8c22 --- /dev/null +++ b/try/bin/infinite.hoon @@ -0,0 +1,6 @@ +|= * +|= * +=+ a=1 +|- ^- bowl +?: =(0 a) [~ ~] +$(a +(a)) diff --git a/try/bin/memory.hoon b/try/bin/memory.hoon new file mode 100644 index 0000000000..7390a88c2f --- /dev/null +++ b/try/bin/memory.hoon @@ -0,0 +1,7 @@ +|= * +|= * +=+ a=1 +=| b=(list) +|- ^- bowl +?: =(0 a) [~ ~] +$(a +(a), b [(bex (bex 13)) b]) diff --git a/try/bin/overflow.hoon b/try/bin/overflow.hoon new file mode 100644 index 0000000000..e150af1bdf --- /dev/null +++ b/try/bin/overflow.hoon @@ -0,0 +1,7 @@ +!: +|= * +|= * +=+ a=1 +|- ^- bowl +?: =(0 a) [~ ~] +$(a +(a)) diff --git a/try/bin/reverse.hoon b/try/bin/reverse.hoon new file mode 100644 index 0000000000..560f16f86c --- /dev/null +++ b/try/bin/reverse.hoon @@ -0,0 +1,26 @@ +!: +:: /=try=/bin/reverse/hoon +:: +|= * +|= ~ +:- ~ :- ~ +:- ^- (list slip) + :~ [~ %$ %atom %t] + == +|= [now=@da pax=path nut=note] +^- bowl +?+ -.nut !! + %$ + ?~ p.nut + [~ ~] + =+ liz=((hard (list ,@t)) q.u.p.nut) + :- ^- (list gift) + :~ :+ %mu [%atom %t] + (turn liz |=(a=@t (rap 3 (flop (trip a))))) + == + :- ~ + :- ^- (list slip) + :~ [~ %$ %atom %t] + == + ..$ +== diff --git a/try/bin/sleep.hoon b/try/bin/sleep.hoon new file mode 100644 index 0000000000..29823728a1 --- /dev/null +++ b/try/bin/sleep.hoon @@ -0,0 +1,10 @@ +!: +=> .(+ =>(+ ^/=main=/pony)) +|= [est=@da *] +|= [sle=@dr ~] +^- bowl +%+ (posh (add est sle)) ~[la/leaf/"sleeping for {(scow %dr sle)}..."] +|= now=@da +:_ ~ +:~ [%la %leaf "slept."] +== diff --git a/try/bin/tiff.hoon b/try/bin/tiff.hoon new file mode 100644 index 0000000000..f73eda99d2 --- /dev/null +++ b/try/bin/tiff.hoon @@ -0,0 +1,31 @@ +!: +:: /=try=/toy/diff/hoon +:: +|= [who=seat est=time eny=@uw was=path] +|= ~ +:_ ~ +=< main +|% +++ main + ^- (list gift) + =+ pod=test + |- ^- (list gift) + ?~ pod ~ + =+ dis=(loss p.i.pod q.i.pod) + ?> =((lurk p.i.pod (lusk p.i.pod q.i.pod dis)) q.i.pod) + :- [%la %leaf "{p.i.pod} to {q.i.pod}: loss {dis}"] + $(pod t.pod) +:: +++ fake + =+ ram=(shax eny) + =+ inx=0 + |- ^- tape + ?: =(inx 128) ~ + [[(add 'a' (end 0 2 ram))] $(inx +(inx), ram (rsh 0 2 ram))] +:: +++ test + =+ inx=0 + |- ^- (list ,[p=tape q=tape]) + ?: =(inx 32) ~ + [[fake(eny (add 1 eny)) fake(eny (add 2 eny))] $(inx +(inx), eny (add 3 eny))] +-- diff --git a/try/bin/zero.hoon b/try/bin/zero.hoon new file mode 100644 index 0000000000..bd590fc06b --- /dev/null +++ b/try/bin/zero.hoon @@ -0,0 +1,10 @@ +!: +|= * +|= ~ +^- bowl +:_ ~ +=+ inx=0 +|- ^- (list gift) +?: =(inx 256) ~ +:_ $(inx +(inx)) +[%la %leaf "0 :: {(scow %ud inx)}, {(scow %p inx)}"] diff --git a/try/lib/diff.hoon b/try/lib/diff.hoon new file mode 100644 index 0000000000..455829bfcc --- /dev/null +++ b/try/lib/diff.hoon @@ -0,0 +1,5 @@ +!: +:: /=try=/nub/diff/hoon +:: +|% +-- diff --git a/try/web/game/fun.hoon b/try/web/game/fun.hoon new file mode 100644 index 0000000000..b1c15264ef --- /dev/null +++ b/try/web/game/fun.hoon @@ -0,0 +1,20 @@ +!: +|= mad=[who=@p now=@da eny=@uw ced=cred] +|= zab=[sud=scud quy=quay] +^- love +:- %ham +:~ %html + :~ %body + +"urbit: {neighbor} ready at {}." + :: + :- %ul + |- ^- marl + ?~ messages ~ + :_ $(messages t.messages) + ~[%li +"someone said: {(trip i.messages)}"] + :: + :~ ~[%form action/"fun" method/"post"] + -"message: {%[%input type/"text" name/"msg"]}" + == + == +== diff --git a/try/web/hello/bar.html b/try/web/hello/bar.html new file mode 100644 index 0000000000..e29f43f3a7 --- /dev/null +++ b/try/web/hello/bar.html @@ -0,0 +1 @@ +urbit: born to serve diff --git a/try/web/hello/moo.holw b/try/web/hello/moo.holw new file mode 100644 index 0000000000..ad85bcead1 --- /dev/null +++ b/try/web/hello/moo.holw @@ -0,0 +1,5 @@ +|= mad=[who=@p now=@da eny=@uw ced=cred] +|= zab=[sec=oryx quy=quay sud=scud] +^- love +:- %ham +html/~[body/~"urbit: {neighbor} prepared to serve at {}"] diff --git a/try/web/hello/posty.holw b/try/web/hello/posty.holw new file mode 100644 index 0000000000..5fd99f0b48 --- /dev/null +++ b/try/web/hello/posty.holw @@ -0,0 +1,12 @@ +|= mad=[who=@p now=@da eny=@uw ced=cred] +|= zab=[sec=oryx quy=quay sud=scud] +^- love +:- %ham +:~ %html + :~ %body + +"urbit: {neighbor} ready at {}." + :~ ~[%form action/"query.html" method/"get"] + -"message: {%[%input type/"text" name/"msg"]}" + == + == +== diff --git a/try/web/hello/query.holw b/try/web/hello/query.holw new file mode 100644 index 0000000000..8dd45369f2 --- /dev/null +++ b/try/web/hello/query.holw @@ -0,0 +1,9 @@ +|= mad=[who=@p now=@da eny=@uw ced=cred] +|= zab=[sec=oryx quy=quay sud=scud] +^- love +~& [%query quy.zab] +:- %ham +:~ %html + :- %body + ~"urbit: {neighbor} got query {}." +==