diff --git a/bin/brass.pill b/bin/brass.pill index 8e713c7d5..b6799d99c 100644 --- a/bin/brass.pill +++ b/bin/brass.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:35d8930b9b35364605196d99766ec713154af9105ce7b9fabfaa50e8ca29a5fd -size 4448128 +oid sha256:c55d8f37ad4014bf92f04d0a4a74235f5514de84dad4dca58c40ae2900d06be2 +size 4788607 diff --git a/bin/ivory.pill b/bin/ivory.pill index 29eeabbc5..5c7fabd88 100644 --- a/bin/ivory.pill +++ b/bin/ivory.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e5c82dea80aa7c5593f43fa4294db7974211abceedd907663da73889857642e7 -size 1309381 +oid sha256:85a4e1625d528b5fdc88faeff4fd288a23d6fbf1c11a846fc8f8d5b3cd38370f +size 2118873 diff --git a/bin/solid.pill b/bin/solid.pill index 2a618f1f1..e198f12dc 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4365f9440cbd9253e5ffc37d10bf27d1ef9ce00853034611eb6b9813a12c486b -size 6430657 +oid sha256:d7225be3d29183c74892d556fde2e06a416584e386ece002e81386437ab65770 +size 6897081 diff --git a/nix/pkgs/pill/solid.sh b/nix/pkgs/pill/solid.sh index 1e395f09f..e40566159 100644 --- a/nix/pkgs/pill/solid.sh +++ b/nix/pkgs/pill/solid.sh @@ -26,24 +26,27 @@ done # Update :lens, :dojo and dependencies # FIXME: reduce this list -cp $ARVO/app/lens.hoon ./pier/home/app/ -cp $ARVO/app/dojo.hoon ./pier/home/app/ -cp $ARVO/lib/base64.hoon ./pier/home/lib/ -cp $ARVO/lib/server.hoon ./pier/home/lib/ -cp $ARVO/lib/sole.hoon ./pier/home/lib/ -cp $ARVO/lib/xray.hoon ./pier/home/lib/ +cp $ARVO/app/lens.hoon ./pier/home/app/ +cp $ARVO/app/dojo.hoon ./pier/home/app/ +cp $ARVO/lib/base64.hoon ./pier/home/lib/ +cp $ARVO/lib/plume.hoon ./pier/home/lib/ +cp $ARVO/lib/server.hoon ./pier/home/lib/ +cp $ARVO/lib/sole.hoon ./pier/home/lib/ +cp $ARVO/lib/xray.hoon ./pier/home/lib/ cp $ARVO/lib/pprint.hoon ./pier/home/lib/ mkdir -p ./pier/home/mar/lens/ -cp $ARVO/mar/lens/* ./pier/home/mar/lens/ +cp $ARVO/mar/lens/* ./pier/home/mar/lens/ -cp $ARVO/sur/lens.hoon ./pier/home/sur/ -cp $ARVO/sur/sole.hoon ./pier/home/sur/ +cp $ARVO/sur/lens.hoon ./pier/home/sur/ +cp $ARVO/sur/plum.hoon ./pier/home/sur/ +cp $ARVO/sur/sole.hoon ./pier/home/sur/ +cp $ARVO/sur/xray.hoon ./pier/home/sur/ # Update +solid and its dependencies -cp $ARVO/lib/pill.hoon ./pier/home/lib/ -cp $ARVO/gen/solid.hoon ./pier/home/gen/ +cp $ARVO/lib/pill.hoon ./pier/home/lib/ +cp $ARVO/gen/solid.hoon ./pier/home/gen/ chmod -R u+rw ./pier/home/ diff --git a/pkg/arvo/app/chat-cli.hoon b/pkg/arvo/app/chat-cli.hoon index d5cef8823..830424815 100644 --- a/pkg/arvo/app/chat-cli.hoon +++ b/pkg/arvo/app/chat-cli.hoon @@ -1269,7 +1269,7 @@ ?:(p.timez add sub) =+ dat=(yore when) =/ t - |= a/@ + |= a=@ %+ weld ?:((lth a 10) "0" ~) (scow %ud a) diff --git a/pkg/arvo/app/dojo.hoon b/pkg/arvo/app/dojo.hoon index 5e54034a7..4949b00f8 100644 --- a/pkg/arvo/app/dojo.hoon +++ b/pkg/arvo/app/dojo.hoon @@ -10,17 +10,17 @@ :::: :: :::: :: :: :: => |% :: external structures - ++ id @tasession :: session id - ++ house :: all state - $: $6 - egg/@u :: command count - hoc/(map id session) :: conversations - acl/(set ship) :: remote access whitelist + +$ id @tasession :: session id + +$ house :: all state + $: %6 + egg=@u :: command count + hoc=(map id session) :: conversations + acl=(set ship) :: remote access whitelist == :: - ++ session :: per conversation - $: say/sole-share :: command-line state - dir/beam :: active path - poy/(unit dojo-project) :: working + +$ session :: per conversation + $: say=sole-share :: command-line state + dir=beam :: active path + poy=(unit dojo-project) :: working $: :: sur: structure imports :: sur=(list cable:clay) @@ -28,75 +28,75 @@ :: lib=(list cable:clay) == - var/(map term cage) :: variable state - old/(set term) :: used TLVs - buf/tape :: multiline buffer + var=(map term cage) :: variable state + old=(set term) :: used TLVs + buf=tape :: multiline buffer == :: - ++ monkey :: per conversation - $: say/sole-share :: command-line state - dir/beam :: active path - poy/(unit dojo-project) :: working - var/(map term cage) :: variable state - old/(set term) :: used TLVs - buf/tape :: multiline buffer + +$ monkey :: per conversation + $: say=sole-share :: command-line state + dir=beam :: active path + poy=(unit dojo-project) :: working + var=(map term cage) :: variable state + old=(set term) :: used TLVs + buf=tape :: multiline buffer == :: - ++ dojo-command :: + +$ dojo-command :: $^ (pair dojo-sink dojo-source) :: route value - {$brev p/term} :: unbind variable + [%brev p=term] :: unbind variable :: - ++ dojo-sink :: - $% {$flat p/path} :: atom to unix - {$pill p/path} :: noun to unix pill - :: {$tree p/path} :: noun to unix tree - {$file p/beam} :: save to clay - $: $http :: http outbound - p/?($post $put) - r/@t + +$ dojo-sink :: + $% [%flat p=path] :: atom to unix + [%pill p=path] :: noun to unix pill + :: [%tree p=path] :: noun to unix tree + [%file p=beam] :: save to clay + $: %http :: http outbound + p=?(%post %put) + r=@t == - {$poke p/goal} :: poke app - {$show p/?($0 $1 $2 $3 $4 $5)} :: val/type/hoon/xray - {$verb p/term} :: store variable + [%poke p=goal] :: poke app + [%show p=?(%0 %1 %2 %3 %4 %5)] :: val/type/hoon/xray + [%verb p=term] :: store variable == :: - ++ dojo-source :: construction node - $: p/@ud :: assembly index - q/dojo-build :: general build + +$ dojo-source :: construction node + $: p=@ud :: assembly index + q=dojo-build :: general build == :: - ++ dojo-build :: one arvo step + +$ dojo-build :: one arvo step $~ [%ex *hoon] - $% {$ur p/@t} :: http GET request - {$ge p/dojo-model} :: generator - {$te p/term q/(list dojo-source)} :: thread - {$dv p/path} :: core from source - {$ex p/hoon} :: hoon expression - {$sa p/mark} :: example mark value - {$as p/mark q/dojo-source} :: simple transmute - {$do p/hoon q/dojo-source} :: gate apply - {$tu p/(list dojo-source)} :: tuple + $% [%ur p=@t] :: http GET request + [%ge p=dojo-model] :: generator + [%te p=term q=(list dojo-source)] :: thread + [%dv p=path] :: core from source + [%ex p=hoon] :: hoon expression + [%sa p=mark] :: example mark value + [%as p=mark q=dojo-source] :: simple transmute + [%do p=hoon q=dojo-source] :: gate apply + [%tu p=(list dojo-source)] :: tuple == :: - ++ dojo-model :: data construction - $: p/dojo-server :: core source - q/dojo-config :: configuration + +$ dojo-model :: data construction + $: p=dojo-server :: core source + q=dojo-config :: configuration == :: - ++ dojo-server :: numbered device - $: p/@ud :: assembly index - q/path :: gate path + +$ dojo-server :: numbered device + $: p=@ud :: assembly index + q=path :: gate path == :: - ++ dojo-config :: configuration - $: p/(list dojo-source) :: by order - q/(map term (unit dojo-source)) :: by keyword + +$ dojo-config :: configuration + $: p=(list dojo-source) :: by order + q=(map term (unit dojo-source)) :: by keyword == :: - ++ dojo-project :: construction state - $: mad/dojo-command :: operation - num/@ud :: number of tasks - cud/(unit dojo-source) :: now solving - pux/(unit path) :: working - pro/(unit vase) :: prompting loop - per/(unit sole-edit) :: pending reverse - job/(map @ud dojo-build) :: problems - rez/(map @ud cage) :: results + +$ dojo-project :: construction state + $: mad=dojo-command :: operation + num=@ud :: number of tasks + cud=(unit dojo-source) :: now solving + pux=(unit path) :: working + pro=(unit vase) :: prompting loop + per=(unit sole-edit) :: pending reverse + job=(map @ud dojo-build) :: problems + rez=(map @ud cage) :: results == :: - ++ bead {p/(set beam) q/cage} :: computed result - ++ goal {p/ship q/term} :: flat application + +$ bead [p=(set beam) q=cage] :: computed result + +$ goal [p=ship q=term] :: flat application -- => |% @@ -130,7 +130,7 @@ ++ parse-variable |* [sym=rule src=rule] %+ cook - |= {a/term b/(unit dojo-source)} + |= [a=term b=(unit dojo-source)] ^- dojo-command ?~(b [%brev a] [[%verb a] u.b]) ;~(plug sym (punt src)) @@ -146,7 +146,7 @@ :: ;~ pfix col %+ cook - |= {a/goal b/$^(dojo-model dojo-source)} + |= [a=goal b=$^(dojo-model dojo-source)] ?@ -.b [[%poke a] b] (to-command a b) ;~ plug @@ -183,7 +183,7 @@ ;~(plug (cold %pill dot) (most fas sym)) ;~(plug (cold %http lus) (stag %post parse-url)) ;~(plug (cold %http hep) (stag %put parse-url)) - (stag %show (cook $?($1 $2 $3 $4 $5) (cook lent (stun [1 5] wut)))) + (stag %show (cook $?(%1 %2 %3 %4 %5) (cook lent (stun [1 5] wut)))) == :: ++ parse-cables @@ -224,7 +224,7 @@ == :: ++ parse-goal - %+ cook |=(a/goal a) + %+ cook |=(a=goal a) ;~ pose ;~ plug ;~(pfix sig fed:ag) @@ -248,7 +248,7 @@ :: =? a &(?=(^ a) =('' i.a)) t.a - (fall (de-beam:format a) [`beak`[p q r]:dir (flop a)]) + (fall (de-beam:format a) [`beak`[p q r]:dir a]) =+ vez=hoon-parser (sear plex:vez (stag %clsg poor:vez)) :: @@ -316,7 +316,7 @@ ++ xsell `$-(vase tank)`vase-to-tank:pprint :: ++ he :: per session - |_ {hid/bowl:gall =id moz/(list card:agent:gall) session} + |_ [hid=bowl:gall =id moz=(list card:agent:gall) session] :: ++ he-beam ^- beam @@ -363,31 +363,31 @@ [%pass u.pux %arvo %c %warp ship desk ~] :: ++ dy-errd :: reject change, abet - |= {rev/(unit sole-edit) err/@u} + |= [rev=(unit sole-edit) err=@u] ^+ +>+> (he-errd(poy `+>+<) rev err) :: ++ dy-diff :: send effects, abet - |= fec/sole-effect + |= fec=sole-effect ^+ +>+> (he-diff(poy `+>+<) fec) :: ++ dy-rash :: send effects, amok - |= fec/sole-effect + |= fec=sole-effect ^+ +>+> (he-diff(poy ~) fec) :: ++ dy-init-command :: ++dojo-command - |= mad/dojo-command + |= mad=dojo-command ^+ [mad +>] ?@ -.mad [mad +>.$] =. q.mad - ?+(-.p.mad q.mad $http [0 %as %mime q.mad]) + ?+(-.p.mad q.mad %http [0 %as %mime q.mad]) =^ src +>.$ (dy-init-source q.mad) [mad(q src) +>.$] :: ++ dy-init-source :: ++dojo-source - |= src/dojo-source + |= src=dojo-source ^+ [src +>] =^ bul +> (dy-init-build q.src) =: p.src num @@ -396,48 +396,48 @@ [src +>.$(num +(num), job (~(put by job) -.src +.src))] :: ++ dy-init-source-unit :: (unit dojo-source) - |= urc/(unit dojo-source) + |= urc=(unit dojo-source) ^+ [urc +>] ?~ urc [~ +>] =^ src +> (dy-init-source u.urc) [`src +>.$] :: ++ dy-init-build :: ++dojo-build - |= bul/dojo-build + |= bul=dojo-build ^+ [bul +>] ?- -.bul - $ex [bul +>.$] - $dv [bul +>.$] - $sa [bul +>.$] - $as =^(mor +>.$ (dy-init-source q.bul) [bul(q mor) +>.$]) - $do =^(mor +>.$ (dy-init-source q.bul) [bul(q mor) +>.$]) - $ge =^(mod +>.$ (dy-init-model p.bul) [[%ge mod] +>.$]) - $te =^(mod +>.$ (dy-init-ordered q.bul) [bul(q mod) +>.$]) - $ur [bul +>.$] - $tu =^(dof +>.$ (dy-init-ordered p.bul) [[%tu dof] +>.$]) + %ex [bul +>.$] + %dv [bul +>.$] + %sa [bul +>.$] + %as =^(mor +>.$ (dy-init-source q.bul) [bul(q mor) +>.$]) + %do =^(mor +>.$ (dy-init-source q.bul) [bul(q mor) +>.$]) + %ge =^(mod +>.$ (dy-init-model p.bul) [[%ge mod] +>.$]) + %te =^(mod +>.$ (dy-init-ordered q.bul) [bul(q mod) +>.$]) + %ur [bul +>.$] + %tu =^(dof +>.$ (dy-init-ordered p.bul) [[%tu dof] +>.$]) == :: ++ dy-init-model :: ++dojo-model - |= mol/dojo-model + |= mol=dojo-model ^+ [mol +>] =^ one +>.$ (dy-init-server p.mol) =^ two +>.$ (dy-init-config q.mol) [[one two] +>.$] :: ++ dy-init-server :: ++dojo-server - |= srv/dojo-server + |= srv=dojo-server =. p.srv num [srv +>.$(num +(num), job (~(put by job) num [%dv [%gen q.srv]]))] :: ++ dy-init-config :: prepare config - |= cig/dojo-config + |= cig=dojo-config ^+ [cig +>] =^ ord +>.$ (dy-init-ordered p.cig) =^ key +>.$ (dy-init-named q.cig) [[ord key] +>.$] :: ++ dy-init-ordered :: (list dojo-source) - |= ord/(list dojo-source) + |= ord=(list dojo-source) ^+ [ord +>] ?~ ord [~ +>.$] =^ fir +>.$ (dy-init-source i.ord) @@ -445,7 +445,7 @@ [[fir mor] +>.$] :: ++ dy-init-named :: (map @tas dojo-src) - |= key/(map term (unit dojo-source)) + |= key=(map term (unit dojo-source)) ^+ [key +>.$] ?~ key [~ +>.$] =^ top +>.$ (dy-init-source-unit q.n.key) @@ -458,31 +458,31 @@ =^(dam . (dy-init-command mad) +(mad dam)) :: ++ dy-hand :: complete step - |= cag/cage + |= cag=cage ^+ +>+> ?> ?=(^ cud) (dy-step(cud ~, rez (~(put by rez) p.u.cud cag)) +(p.u.cud)) :: ++ dy-meal :: vase to cage - |= vax/vase + |= vax=vase ?. &(?=(@ -.q.vax) ((sane %tas) -.q.vax)) ~& %dy-meal-cage (dy-rash %bel ~) (dy-hand -.q.vax (slot 3 vax)) :: ++ dy-made-edit :: sole edit - |= cag/cage + |= cag=cage ^+ +>+> ?> ?=(^ per) ?: ?| ?=(^ q.q.cag) =((lent buf.say) q.q.cag) - !&(?=($del -.u.per) =(+(p.u.per) (lent buf.say))) + !&(?=(%del -.u.per) =(+(p.u.per) (lent buf.say))) == dy-abet(per ~) (dy-errd(per ~) per q.q.cag) :: ++ dy-done :: dialog submit - |= txt/tape + |= txt=tape ?: |(?=(^ per) ?=(^ pux) ?=(~ pro)) ~& %dy-no-prompt (dy-diff %bel ~) @@ -493,8 +493,8 @@ (dy-made-dial %noun p.res) :: ++ dy-cast - |* {typ/_* bun/vase} - |= a/vase ^- typ + |* [typ=_* bun=vase] + |= a=vase ^- typ ~| [p.bun p.a] ?> (~(nest ut p.bun) & p.a) ;;(typ q.a) @@ -503,51 +503,51 @@ ^+ +> :: XX needs filter :: - ?: ?=({$show $3} -.mad) + ?: ?=([%show %3] -.mad) (dy-rash %tan (dy-show-source q.mad) ~) - ?: ?=($brev -.mad) + ?: ?=(%brev -.mad) =. var (~(del by var) p.mad) =< dy-amok ?+ p.mad . - $?($eny $now $our) !! - $lib .(lib ~) - $sur .(sur ~) - $dir .(dir [[our.hid %home ud+0] /]) + $?(%eny %now %our) !! + %lib .(lib ~) + %sur .(sur ~) + %dir .(dir [[our.hid %home ud+0] /]) == =+ cay=(~(got by rez) p.q.mad) ?- -.p.mad - $verb + %verb =. var (~(put by var) p.p.mad cay) ~| bad-set+[p.p.mad p.q.cay] =< dy-amok ?+ p.p.mad . - $eny ~|(%entropy-is-eternal !!) - $now ~|(%time-is-immutable !!) - $our ~|(%self-is-immutable !!) - $lib + %eny ~|(%entropy-is-eternal !!) + %now ~|(%time-is-immutable !!) + %our ~|(%self-is-immutable !!) + %lib %_ . lib ((dy-cast (list cable:clay) !>(*(list cable:clay))) q.cay) == :: - $sur + %sur %_ . sur ((dy-cast (list cable:clay) !>(*(list cable:clay))) q.cay) == :: - $dir =+ ^= pax ^- path + %dir =+ ^= pax ^- path =+ pax=((dy-cast path !>(*path)) q.cay) ?: ?=(~ pax) ~[(scot %p our.hid) %home '0'] - ?: ?=({@ ~} pax) ~[i.pax %home '0'] - ?: ?=({@ @ ~} pax) ~[i.pax i.t.pax '0'] + ?: ?=([@ ~] pax) ~[i.pax %home '0'] + ?: ?=([@ @ ~] pax) ~[i.pax i.t.pax '0'] pax =. dir (need (de-beam:format pax)) =- +>(..dy (he-diff %tan - ~)) rose+[" " `~]^~[leaf+"=%" (smyt (en-beam:format he-beak s.dir))] == :: - $poke + %poke %- he-card(poy ~) :* %pass /poke @@ -557,22 +557,22 @@ cay == :: - $file + %file %- he-card(poy ~) :* %pass /file %arvo %c %info (foal:space:userlib (en-beam:format p.p.mad) cay) == :: - $flat + %flat ?^ q.q.cay (dy-rash %tan [%leaf "not an atom"]~) (dy-rash %sav p.p.mad q.q.cay) :: - $pill + %pill (dy-rash %sag p.p.mad q.q.cay) :: - $http - ?> ?=($mime p.cay) + %http + ?> ?=(%mime p.cay) =+ mim=;;(mime q.q.cay) %+ dy-request /show :* ?:(=(%put p.p.mad) %'PUT' %'POST') @@ -581,7 +581,7 @@ `q.mim == :: - $show + %show |^ (prnt cay note) ++ prnt ?: (gte p.p.mad 4) dy-xprint @@ -591,7 +591,7 @@ %0 ~ %1 [[%rose [~ " " ~] (skol p.q.cay) ~] maar] %2 [[%rose [~ " " ~] (dy-show-type-noun p.q.cay) ~] maar] - ::%3 handled above + ::%3 handled above %4 ~ %5 [[%rose [~ " " ~] (xskol p.q.cay) ~] maar] == @@ -600,22 +600,22 @@ -- == :: - ++ dy-show |=(cay/cage (dy-print cay ~)) + ++ dy-show |=(cay=cage (dy-print cay ~)) :: :: Print a value (given as a cage) and a note (given as a tang). :: ++ dy-xprint - |= {cay/cage tan/tang} + |= [cay=cage tan=tang] %+ dy-rash %tan %- welp :_ tan ?+ p.cay [(xsell q.cay)]~ - $tang ;;(tang q.q.cay) - $httr + %tang ;;(tang q.q.cay) + %httr =+ hit=;;(httr:eyre q.q.cay) - =- (flop (turn `wall`- |=(a/tape leaf+(dash:us a '' ~)))) + =- (flop (turn `wall`- |=(a=tape leaf+(dash:us a '' ~)))) :- "HTTP {}" %+ weld - (turn q.hit |=({a/@t b/@t} "{(trip a)}: {(trip b)}")) + (turn q.hit |=([a=@t b=@t] "{(trip a)}: {(trip b)}")) :- i="" t=(turn `wain`?~(r.hit ~ (to-wain:format q.u.r.hit)) trip) == @@ -623,39 +623,39 @@ :: Print a value (given as a cage) and a note (given as a tang). :: ++ dy-print - |= {cay/cage tan/tang} + |= [cay=cage tan=tang] %+ dy-rash %tan %- welp :_ tan ?+ p.cay [(sell q.cay)]~ - $tang ;;(tang q.q.cay) - $httr + %tang ;;(tang q.q.cay) + %httr =+ hit=;;(httr:eyre q.q.cay) - =- (flop (turn `wall`- |=(a/tape leaf+(dash:us a '' ~)))) + =- (flop (turn `wall`- |=(a=tape leaf+(dash:us a '' ~)))) :- "HTTP {}" %+ weld - (turn q.hit |=({a/@t b/@t} "{(trip a)}: {(trip b)}")) + (turn q.hit |=([a=@t b=@t] "{(trip a)}: {(trip b)}")) :- i="" t=(turn `wain`?~(r.hit ~ (to-wain:format q.u.r.hit)) trip) == ++ dy-show-type-noun - |= a/type ^- tank + |= a=type ^- tank =- >[-]< - |- ^- $? $% {$atom @tas (unit @)} - {$cell _$ _$} - {$face $@(term tune) _$} - {$fork (set _$)} - {$hold _$ hoon} + |- ^- $? $% [%atom @tas (unit @)] + [%cell _$ _$] + [%face $@(term tune) _$] + [%fork (set _$)] + [%hold _$ hoon] == wain :: "<|core|>" - $?($noun $void) + $?(%noun %void) == ?+ a a - {$face ^} a(q $(a q.a)) - {$cell ^} a(p $(a p.a), q $(a q.a)) - {$fork *} a(p (silt (turn ~(tap in p.a) |=(b/type ^$(a b))))) - {$hint *} !! - {$core ^} `wain`/core - {$hold *} a(p $(a p.a)) + [%face ^] a(q $(a q.a)) + [%cell ^] a(p $(a p.a), q $(a q.a)) + [%fork *] a(p (silt (turn ~(tap in p.a) |=(b=type ^$(a b))))) + [%hint *] !! + [%core ^] `wain`/core + [%hold *] a(p $(a p.a)) == :: :: XX needs filter @@ -668,42 +668,42 @@ ::$? hoon ;: jank-bucwut hoon - $^ {dy-shown dy-shown} - $% {$ur cord} - {$sa mark} - {$as mark dy-shown} - {$do hoon dy-shown} - {$te term (list dy-shown)} - {$ge path (list dy-shown) (map term (unit dy-shown))} - {$dv path} + $^ [dy-shown dy-shown] + $% [%ur cord] + [%sa mark] + [%as mark dy-shown] + [%do hoon dy-shown] + [%te term (list dy-shown)] + [%ge path (list dy-shown) (map term (unit dy-shown))] + [%dv path] == == :: ++ dy-show-source - |= a/dojo-source ^- tank + |= a=dojo-source ^- tank =- >[-]< - =+ `{@ bil/dojo-build}`a + =+ `[@ bil=dojo-build]`a |- ^- dy-shown ?- -.bil - $?($ur $dv $sa) bil - $ex ?. ?=({$cltr *} p.bil) p.bil + $?(%ur %dv %sa) bil + %ex ?. ?=([%cltr *] p.bil) p.bil |- ^- hoon ?~ p.p.bil !! ?~ t.p.p.bil i.p.p.bil [i.p.p.bil $(p.p.bil t.p.p.bil)] - $tu ?~ p.bil !! + %tu ?~ p.bil !! |- ?~ t.p.bil ^$(bil q.i.p.bil) [^$(bil q.i.p.bil) $(p.bil t.p.bil)] - $as bil(q $(bil q.q.bil)) - $do bil(q $(bil q.q.bil)) - $te bil(q (turn q.bil ..$)) - $ge :+ %ge q.p.p.bil + %as bil(q $(bil q.q.bil)) + %do bil(q $(bil q.q.bil)) + %te bil(q (turn q.bil ..$)) + %ge :+ %ge q.p.p.bil [(turn p.q.p.bil ..$) (~(run by q.q.p.bil) (lift ..$))] == :: ++ dy-edit :: handle edit - |= cal/sole-change + |= cal=sole-change ^+ +>+> =^ dat say (~(transceive sole say) cal) ?: |(?=(^ per) ?=(^ pux) ?=(~ pro)) @@ -718,18 +718,18 @@ (dy-made-edit %noun p.res) :: ++ dy-type :: sole action - |= act/sole-action + |= act=sole-action ?- -.dat.act - $det (dy-edit +.dat.act) - $ret (dy-done (tufa buf.say)) - $clr dy-stop - $tab +>+> + %det (dy-edit +.dat.act) + %ret (dy-done (tufa buf.say)) + %clr dy-stop + %tab +>+> == :: - ++ dy-cage |=(num/@ud (~(got by rez) num)) :: known cage - ++ dy-vase |=(num/@ud q:(dy-cage num)) :: known vase + ++ dy-cage |=(num=@ud (~(got by rez) num)) :: known cage + ++ dy-vase |=(num=@ud q:(dy-cage num)) :: known vase ++ dy-sore - |= src/(list dojo-source) + |= src=(list dojo-source) ^- vase ?~ src !>(~) @@ -742,7 +742,7 @@ ?. (~(nest ut [%cell [%atom %$ ~] %noun]) | p.q.cay) :: naked generator; takes one argument :: - ?. &(?=({* ~} p.cig) ?=(~ q.cig)) + ?. &(?=([* ~] p.cig) ?=(~ q.cig)) ~|(%one-argument !!) =/ res (mule |.((slam q.cay (dy-vase p.i.p.cig)))) ?: ?=(%| -.res) @@ -810,7 +810,7 @@ (slam gat sam) :: ++ dy-made-dial :: dialog product - |= cag/cage + |= cag=cage ^+ +>+> ?. ?=(^ q.q.cag) (dy-errd ~ q.q.cag) @@ -832,11 +832,11 @@ == :: ++ dy-made-gent :: generator product - |= cag/cage + |= cag=cage (dy-meal q.cag) :: ++ dy-made-noun :: generator product - |= cag/cage + |= cag=cage (dy-hand %noun q.cag) :: ++ dy-wool-poke @@ -869,7 +869,7 @@ :: %as =/ cag=cage (dy-cage p.q.bil) - =+ .^(=tube:clay cc+(en-beam:format he-beak /[p.bil]/[p.cag])) + =+ .^(=tube:clay cc+(en-beam:format he-beak /[p.cag]/[p.bil])) (dy-hand p.bil (tube q.cag)) :: %do @@ -896,14 +896,14 @@ :: ++ dy-hoon-var =+ ^= ope - |= gen/hoon ^- hoon - ?: ?=(?($sgld $sgbn) -.gen) + |= gen=hoon ^- hoon + ?: ?=(?(%sggl %sggr) -.gen) $(gen q.gen) =+ ~(open ap gen) ?.(=(gen -) $(gen -) gen) - |= gen/hoon ^- (unit cage) + |= gen=hoon ^- (unit cage) =. gen (ope gen) - ?: ?=({$cnts {@ ~} ~} gen) + ?: ?=([%cnts [@ ~] ~] gen) (~(get by var) i.p.gen) ~ :: +dy-mere: execute hoon and complete construction step @@ -933,7 +933,7 @@ (slap sut hoon) :: ++ dy-step :: advance project - |= nex/@ud + |= nex=@ud ^+ +>+> ?> ?=(~ cud) ?: =(nex num) @@ -944,19 +944,19 @@ -- :: ++ he-dope - |= txt/tape :: + |= txt=tape :: ^- (each (unit (each dojo-command tape)) hair) :: prefix+result =+ len=+((lent txt)) :: line length =. txt (weld buf `tape`(weld txt "\0a")) :: =+ vex=((full parse-command-line:he-parser) [1 1] txt) ?: =(q.p.vex len) :: matched to line end [%& ~] :: - ?: =(p.p.vex +((lent (skim txt |=(a/@ =(10 a)))))) :: parsed all lines + ?: =(p.p.vex +((lent (skim txt |=(a=@ =(10 a)))))) :: parsed all lines [%& ~ ?~(q.vex [%| txt] [%& p.u.q.vex])] :: new buffer+complete [%| p.p.vex (dec q.p.vex)] :: syntax error :: ++ he-duke :: ++he-dope variant - |= txt/tape + |= txt=tape ^- (each (unit (each dojo-command tape)) @ud) =+ foy=(he-dope txt) ?- -.foy @@ -975,7 +975,7 @@ %_(+> moz [card moz]) :: ++ he-diff :: emit update - |= fec/sole-effect + |= fec=sole-effect ^+ +> (he-card %give %fact ~[/sole/[id]] %sole-effect !>(fec)) :: @@ -984,7 +984,7 @@ ?~(poy . ~(dy-stop dy u.poy)) :: ++ he-peer :: subscribe to - |= pax/path + |= pax=path ?>(=(~ pax) he-prom) :: ++ he-pine :: restore prompt @@ -993,7 +993,7 @@ he-prom:he-pone :: ++ he-errd :: reject update - |= {rev/(unit sole-edit) err/@u} ^+ +> + |= [rev=(unit sole-edit) err=@u] ^+ +> =+ red=(fall rev [%nop ~]) :: required for error location sync =^ lic say (~(transmit sole say) red) (he-diff %mor [%det lic] [%err err] ~) @@ -1014,7 +1014,7 @@ "/" ?:(=(%home q.dir) "=" (trip q.dir)) "/" ?:(=([%ud 0] r.dir) "=" (scow r.dir)) == - ?:(=(~ s.dir) "" (spud (flop s.dir))) + ?:(=(~ s.dir) "" (spud s.dir)) :: ++ he-prom :: send prompt %- he-diff @@ -1034,9 +1034,9 @@ == :: ++ he-unto :: result from agent - |= {way/wire cit/sign:agent:gall} + |= [way=wire cit=sign:agent:gall] ^+ +> - ?. ?=($poke-ack -.cit) + ?. ?=(%poke-ack -.cit) ~& [%strange-unto cit] +> ?~ p.cit @@ -1087,16 +1087,16 @@ %. [%httr !>((to-httr:iris response-header.response full-file.response))] =+ dye=~(. dy u.poy(pux ~)) ?+ way !! - {$hand ~} dy-hand:dye - {$show ~} dy-show:dye + [%hand ~] dy-hand:dye + [%show ~] dy-show:dye == :: ++ he-lens - |= com/command:lens + |= com=command:lens ^+ +> =/ source=dojo-source - =| num/@ - =- ?. ?=($send-api -.sink.com) :: XX num is incorrect + =| num=@ + =- ?. ?=(%send-api -.sink.com) :: XX num is incorrect sor :- 0 :+ %as `mark`(cat 3 api.sink.com '-poke') @@ -1112,12 +1112,12 @@ |- ^- dojo-source :- num ?- -.source.com - $data [%ex %sand %t data.source.com] - $dojo + %data [%ex %sand %t data.source.com] + %dojo %+ rash command.source.com (ifix [(punt gap) (punt gap)] parse-build:he-parser) :: - $clay + %clay :- %ex ^- hoon :+ %dtkt @@ -1127,9 +1127,9 @@ %+ rash pax.source.com rood:(vang | /(scot %p our.hid)/home/(scot %da now.hid)) :: - $url [%ur (crip (en-purl:html url.source.com))] - $api !! - $get-api + %url [%ur (crip (en-purl:html url.source.com))] + %api !! + %get-api :- %ex ^- hoon :+ %dtkt @@ -1139,27 +1139,27 @@ [%sand %ta (scot %p our.hid)] [%sand %tas api.source.com] [%sand %ta (scot %da now.hid)] - (turn endpoint.source.com |=(a/@t [%sand %ta a])) + (turn endpoint.source.com |=(a=@t [%sand %ta a])) == :: - $listen-api !! - $export !! - $import !! - $export-all !! - $import-all !! - $as + %listen-api !! + %export !! + %import !! + %export-all !! + %import-all !! + %as :* %as mar.source.com $(num +(num), source.com next.source.com) == :: - $hoon + %hoon :* %do %+ rash code.source.com tall:(vang | /(scot %p our.hid)/home/(scot %da now.hid)) $(num +(num), source.com next.source.com) == :: - $tuple + %tuple :- %tu |- ^- (list dojo-source) ?~ next.source.com @@ -1168,31 +1168,31 @@ :- ^$(source.com i.next.source.com) $(next.source.com t.next.source.com) == - =+ |- ^- sink/dojo-sink + =+ |- ^- sink=dojo-sink ?- -.sink.com - $stdout [%show %0] - $output-file $(sink.com [%command (cat 3 '@' pax.sink.com)]) - $output-pill $(sink.com [%command (cat 3 '.' pax.sink.com)]) - $output-clay [%file (need (de-beam:format pax.sink.com))] - $url [%http %post (crip (en-purl:html url.sink.com))] - $to-api !! - $send-api [%poke our.hid api.sink.com] - $command (rash command.sink.com parse-sink:he-parser) - $app [%poke our.hid app.sink.com] + %stdout [%show %0] + %output-file $(sink.com [%command (cat 3 '@' pax.sink.com)]) + %output-pill $(sink.com [%command (cat 3 '.' pax.sink.com)]) + %output-clay [%file (need (de-beam:format pax.sink.com))] + %url [%http %post (crip (en-purl:html url.sink.com))] + %to-api !! + %send-api [%poke our.hid api.sink.com] + %command (rash command.sink.com parse-sink:he-parser) + %app [%poke our.hid app.sink.com] == (he-plan sink source) :: ++ he-like :: accept line - |= buf/(list @c) + |= buf=(list @c) =(%& -:(he-dope (tufa buf))) :: ++ he-stir :: apply change - |= cal/sole-change + |= cal=sole-change ^+ +> :: ~& [%his-clock ler.cal] :: ~& [%our-clock ven.say] =^ dat say (~(transceive sole say) cal) - ?. ?& ?=($del -.dat) + ?. ?& ?=(%del -.dat) =(+(p.dat) (lent buf.say)) == +>.$ @@ -1203,13 +1203,13 @@ (he-errd `dat q.p.foy) :: ++ he-plan :: execute command - |= mad/dojo-command + |= mad=dojo-command ^+ +> ?> ?=(~ poy) he-pine:(dy-step:~(dy-init dy %*(. *dojo-project mad mad)) 0) :: ++ he-done :: parse command - |= txt/tape + |= txt=tape ^+ +> ?~ txt =< he-prom(buf ~) @@ -1431,19 +1431,19 @@ -- :: ++ he-type :: apply input - |= act/sole-action + |= act=sole-action ^+ +> ?^ poy he-pine:(~(dy-type dy u.poy) act) ?- -.dat.act - $det (he-stir +.dat.act) - $ret (he-done (tufa buf.say)) - $clr he-pine(buf "") - $tab (he-tab +.dat.act) + %det (he-stir +.dat.act) + %ret (he-done (tufa buf.say)) + %clr he-pine(buf "") + %tab (he-tab +.dat.act) == :: ++ he-lame :: handle error - |= {wut/term why/tang} + |= [wut=term why=tang] ^+ +> %- (slog (flop `tang`[>%dojo-lame wut< why])) ?^ poy @@ -1460,10 +1460,10 @@ :: ^- cage :- %noun - =+ sloop=|=({a/vase b/vase} ?:(=(*vase a) b ?:(=(*vase b) a (slop a b)))) + =+ sloop=|=([a=vase b=vase] ?:(=(*vase a) b ?:(=(*vase b) a (slop a b)))) %+ sloop %- ~(rep by var) - |= {{a/term @ b/vase} c/vase} ^- vase + |= [[a=term @ b=vase] c=vase] ^- vase (sloop b(p face+[a p.b]) c) !>([our=our now=now eny=eny]:hid) -- diff --git a/pkg/arvo/app/test.hoon b/pkg/arvo/app/test.hoon index 06f695d25..9c931799e 100644 --- a/pkg/arvo/app/test.hoon +++ b/pkg/arvo/app/test.hoon @@ -67,7 +67,7 @@ |- ^+ [fex this] ?~ daz [fex this] =/ dap-pax=path /app/[i.daz]/hoon - =/ dap-arch .^(arch cy+(en-beam now-beak (flop dap-pax))) + =/ dap-arch .^(arch cy+(en-beam now-beak dap-pax)) ?~ fil.dap-arch $(daz t.daz) =/ sing=card diff --git a/pkg/arvo/app/weather.hoon b/pkg/arvo/app/weather.hoon index 31e0b00d2..d605cb4ab 100644 --- a/pkg/arvo/app/weather.hoon +++ b/pkg/arvo/app/weather.hoon @@ -147,7 +147,7 @@ |= [wir=wire err=(unit tang)] ^- (quip card _state) ?~ err - =/ req/request:http (request-wttr location) + =/ req=request:http (request-wttr location) =/ out *outbound-config:iris :_ state(timer `(add now.bol ~h3)) :~ [%pass /[(scot %da now.bol)] %arvo %i %request req out] diff --git a/pkg/arvo/gen/acme/domain-validation.hoon b/pkg/arvo/gen/acme/domain-validation.hoon index 477317e81..998fa9c7f 100644 --- a/pkg/arvo/gen/acme/domain-validation.hoon +++ b/pkg/arvo/gen/acme/domain-validation.hoon @@ -1,6 +1,6 @@ :: :acme domain validation request handler :: -|= [[now=@da eny=@ bek=beak] $~ $~] +|= [[now=@da eny=@ bek=beak] ~ ~] |= [authorized=? =request:http] ^- simple-payload:http =/ url=(unit (pair pork:eyre quay:eyre)) diff --git a/pkg/arvo/gen/brass.hoon b/pkg/arvo/gen/brass.hoon index 73de67153..bae8f5665 100644 --- a/pkg/arvo/gen/brass.hoon +++ b/pkg/arvo/gen/brass.hoon @@ -8,8 +8,9 @@ :::: !: :- %say -|= $: {now/@da * bec/beak} - {~ try/_| ~} +|= $: [now=@da eny=@uvJ bec=beak] + arg=$@(~ [top=path ~]) + ~ == :: :: we're creating an event series E whose lifecycle can be computed @@ -153,7 +154,9 @@ :: :: sys: root path to boot system, `/~me/[desk]/now/sys` :: -=+ sys=`path`/(scot %p p.bec)/[q.bec]/(scot %da now)/sys +=/ sys=path + ?^ arg top.arg + /(scot %p p.bec)/[q.bec]/(scot %da now)/sys :: :: compiler-source: hoon source file producing compiler, `sys/hoon` :: @@ -186,6 +189,13 @@ == :: a pill is a 3-tuple of event-lists: [boot kernel userspace] :: +=/ bas=path (flop (tail (flop sys))) :+ boot-ova - (module-ova:pill sys) -[(file-ovum:pill (en-beam:format bec /)) ~] + :~ :~ //arvo + %what + [/sys/hoon hoon/compiler-source] + [/sys/arvo hoon/arvo-source] + == + (file-ovum2:pill bas) + == +[(file-ovum:pill bas) ~] diff --git a/pkg/arvo/gen/cat.hoon b/pkg/arvo/gen/cat.hoon index 04051b129..01a407cac 100644 --- a/pkg/arvo/gen/cat.hoon +++ b/pkg/arvo/gen/cat.hoon @@ -8,10 +8,10 @@ :::: :: :- %say -|= {^ {arg/(list path)} vane/?($g $c)} +|= [^ [arg=(list path)] vane=?(%g %c)] =- tang+(flop `tang`(zing -)) %+ turn arg -|= pax/path +|= pax=path ^- tang =+ ark=.^(arch (cat 3 vane %y) pax) ?^ fil.ark @@ -22,7 +22,7 @@ ~ [rose+[" " `~]^~[leaf+"~" (smyt pax)]]~ :: - {{@t ~} ~ ~} + [[@t ~] ~ ~] $(pax (welp pax /[p.n.dir.ark])) :: * diff --git a/pkg/arvo/gen/code.hoon b/pkg/arvo/gen/code.hoon index 973197041..73c044f99 100644 --- a/pkg/arvo/gen/code.hoon +++ b/pkg/arvo/gen/code.hoon @@ -3,7 +3,7 @@ :::: /hoon/code/gen :: :- %say -|= $: {now/@da eny/@uvJ bec/beak} +|= $: [now=@da eny=@uvJ bec=beak] ~ ~ == diff --git a/pkg/arvo/gen/frontpage.hoon b/pkg/arvo/gen/frontpage.hoon index 342a2b370..5e3203f6f 100644 --- a/pkg/arvo/gen/frontpage.hoon +++ b/pkg/arvo/gen/frontpage.hoon @@ -2,7 +2,7 @@ :: :: outer gate is a standard generator :: -|= [[now=@da eny=@ bek=beak] $~ $~] +|= [[now=@da eny=@ bek=beak] ~ ~] :: :: :- %build |= [authorized=? request:http] diff --git a/pkg/arvo/gen/glass.hoon b/pkg/arvo/gen/glass.hoon deleted file mode 100644 index c89427509..000000000 --- a/pkg/arvo/gen/glass.hoon +++ /dev/null @@ -1,132 +0,0 @@ -:: Produce a glass pill -:: -:::: /hoon/glass/gen - :: -/? 310 -:: -:::: - :: -:- %say -|= $: {now/@da eny/@uvJ bec/beak} - * - == -=< [%noun ~] -=> |% - ++ wasp :: arvo effect - $% {$wack p/@uvJ} :: add entropy - {$what p/(list (pair path (pair term noun)))} :: reset reptile - {$whom p/@p} :: id and boot - == - -- -:: -:: deterministic test -:: -=. eny 0v0 -:: -:: build arvo with existing compiler -:: -|^ ^- * - :: - :: neo: root path to boot system, `/~me/[desk]/now/neo` - :: - =+ neo=`path`/(scot %p p.bec)/[q.bec]/(scot %da now)/neo - :: - :: arvo-source: hoon source file producing arvo kernel, `neo/arvo` - :: - =+ arvo-source=.^(@t %cx (welp neo /arvo/hoon)) - :: - :: arvo-twig: parsed arvo source - :: - ~& [%parsing `@p`(mug arvo-source)] - =+ arvo-twig=(ream arvo-source) - ~& %parsed - :: - :: arvo-kernel: a living urbit - :: - ~& [%compiling `@p`(mug arvo-twig)] - =+ arvo-kernel=+:(slap !>(..ream) arvo-twig) - ~& %compiled - :: - :: events: list of events to feed our urbit - :: - ~& %loading - =+ events=main-events - ~& [%loaded `@p`(mug events)] - :: - :: execute events - :: - =+ number=0 - |- ^- * - ?~ events arvo-kernel - ~& number+number - %= $ - events t.events - number +(number) - arvo-kernel .*(arvo-kernel(+< i.events) -.arvo-kernel) - == -:: -++ main-events - =. now ~2017.3.1 - =+ mov=main-moves - |- ^- (list (pair @da ovum)) - ?~ mov ~ - :- [now i.mov] - $(mov t.mov, now (add now (bex 48))) -:: -++ main-moves - ^- (list ovum) - :~ [[%$ ~] [%what boot-files]] - :: [[%$ ~] [%whom ~zod]] - == -++ boot-files - ^- (list (pair path (pair term noun))) - :: - :: userspace: - :: - :: /app %gall applications - :: /gen :dojo generators - :: /lib %ford libraries - :: /mar %ford marks - :: /sur %ford structures - :: /ren %ford renderers - :: /web %eyre web content - :: /sys system files - :: /neo new system files - :: - (user-files /neo ~) -:: -++ user-files :: userspace loading - |= :: sal: all spurs to load from - :: - sal/(list spur) - ^- (list (pair path (pair term noun))) - :: - :: hav: all user files - :: - =| hav/(list (pair path (pair term noun))) - |- ^+ hav - ?~ sal ~ - =. hav $(sal t.sal) - :: - :: tyl: spur - :: - =/ tyl i.sal - |- ^+ hav - :: - :: pax: full path at `tyl` - :: lon: directory at `tyl` - :: - =/ pax (en-beam:format bec tyl) - =/ lon .^(arch %cy pax) - =? hav ?=(^ fil.lon) - :: - :: install only hoon files for now - :: - ?. ?=({$hoon *} tyl) hav - :_(hav [(flop `path`t.tyl) [%hoon .^(@t %cx pax)]]) - :: - =/ all ~(tap by dir.lon) - |- ^+ hav - ?~ all hav - $(all t.all, hav ^$(tyl [p.i.all tyl])) --- diff --git a/pkg/arvo/gen/hello.hoon b/pkg/arvo/gen/hello.hoon index b2a75750e..e5f5a5cd8 100644 --- a/pkg/arvo/gen/hello.hoon +++ b/pkg/arvo/gen/hello.hoon @@ -8,6 +8,6 @@ :::: :: :- %say -|= {^ {{txt/@tas ~} ~}} +|= [^ [[txt=@tas ~] ~]] :- %noun (crip (weld "hello, " (trip txt))) diff --git a/pkg/arvo/gen/help.hoon b/pkg/arvo/gen/help.hoon index 7846ab5ae..2116568b0 100644 --- a/pkg/arvo/gen/help.hoon +++ b/pkg/arvo/gen/help.hoon @@ -8,7 +8,7 @@ :: |% ++ path-heps - |= a/path ^- tape + |= a=path ^- tape ?~ a "" |- ^- tape %+ welp (trip i.a) @@ -16,13 +16,13 @@ ['-' $(a t.a)] :: ++ rend - |= {a/@thoon b/path} ^- tank - =; c/(pair tape tape) + |= [a=@thoon b=path] ^- tank + =; c=(pair tape tape) =/ tab (sub 10 (mod (lent "{p.c} ") 10)) [%palm [" {(reap tab ' ')}" ``~] leaf+p.c leaf+q.c ~] :- ?- b ~ "/" :: XX !! maybe? - {$hood ^} "|{(path-heps t.b)}" + [%hood ^] "|{(path-heps t.b)}" ^ "+{(path-heps b)}" :: XX deal with :graph-store|foo == =/ c (to-wain:format a) @@ -32,17 +32,17 @@ (trip i.c) :: ++ read-at - |= {len/@u pax/path} - |= {nam/@t ark/arch} ^- (unit {@t path}) + |= [len=@u pax=path] + |= [nam=@t ark=arch] ^- (unit [@t path]) ?. (~(has by dir.ark) %hoon) ~ %+ bind (file:space:userlib (welp pax /[nam]/hoon)) - |= a/* ^- {cord path} + |= a=* ^- [cord path] [;;(@t a) (welp (slag len pax) /[nam])] -- :: :- %say -|= {{now/time @ our/ship ^} typ/$@(~ {p/term ~}) ~} -=/ pax/path /(scot %p our)/home/(scot %da now)/gen :: XX hardcoded +|= [[now=time @ our=ship ^] typ=$@(~ [p=term ~]) ~] +=/ pax=path /(scot %p our)/home/(scot %da now)/gen :: XX hardcoded =+ len=(lent pax) =. pax ?~(typ pax (welp pax /[p.typ])) :- %tang %- flop ^- tang @@ -53,12 +53,12 @@ (drop (bind red rend)) |- ^- tang =+ =< arl=~(tap by (~(urn by dir.ark) .)) - |=({a/@t ~} .^(arch cy+(welp pax /[a]))) + |=([a=@t ~] .^(arch cy+(welp pax /[a]))) %+ welp - =/ dir/(list {@ path}) + =/ dir=(list [@ path]) (murn arl (read-at len pax)) `tang`(turn (sort dir aor) rend) %- zing ^- (list tang) %+ turn (sort arl aor) -|= {a/@t b/arch} +|= [a=@t b=arch] ^$(pax (welp pax /[a]), ark b) diff --git a/pkg/arvo/gen/hood/autocommit.hoon b/pkg/arvo/gen/hood/autocommit.hoon index 03da63afb..c01a22997 100644 --- a/pkg/arvo/gen/hood/autocommit.hoon +++ b/pkg/arvo/gen/hood/autocommit.hoon @@ -7,8 +7,8 @@ :::: :: :- %say -|= $: {now/@da eny/@uvJ bec/beak} - {mon/term ~} +|= $: [now=@da eny=@uvJ bec=beak] + [mon=term ~] ~ == :- %kiln-commit diff --git a/pkg/arvo/gen/hood/breload.hoon b/pkg/arvo/gen/hood/breload.hoon index 68a04d791..5b9df1d72 100644 --- a/pkg/arvo/gen/hood/breload.hoon +++ b/pkg/arvo/gen/hood/breload.hoon @@ -7,8 +7,8 @@ :::: :: :- %say -|= $: {now/@da eny/@uvJ bec/beak} - {arg/(list term) ~} +|= $: [now=@da eny=@uvJ bec=beak] + [arg=(list term) ~] == :+ %helm-reload-desk %base arg diff --git a/pkg/arvo/gen/hood/commit.hoon b/pkg/arvo/gen/hood/commit.hoon index 8964e0631..3c1ac5c45 100644 --- a/pkg/arvo/gen/hood/commit.hoon +++ b/pkg/arvo/gen/hood/commit.hoon @@ -7,8 +7,8 @@ :::: :: :- %say -|= $: {now/@da eny/@uvJ bec/beak} - {mon/term ~} +|= $: [now=@da eny=@uvJ bec=beak] + [mon=term ~] auto=_| == :- %kiln-commit diff --git a/pkg/arvo/gen/hood/cp.hoon b/pkg/arvo/gen/hood/cp.hoon index 9185d0d9a..d4a0444a8 100644 --- a/pkg/arvo/gen/hood/cp.hoon +++ b/pkg/arvo/gen/hood/cp.hoon @@ -5,7 +5,7 @@ /? 310 :- %say =, space:userlib -|= {^ {input/path output/path ~} ~} +|= [^ [input=path output=path ~] ~] :- %kiln-info ?. =(-:(flop input) -:(flop output)) ["Can't move to a different mark" ~] diff --git a/pkg/arvo/gen/hood/doze.hoon b/pkg/arvo/gen/hood/doze.hoon new file mode 100644 index 000000000..ceab5ab89 --- /dev/null +++ b/pkg/arvo/gen/hood/doze.hoon @@ -0,0 +1,4 @@ +:- %say +|= [^ [dap=term wake=$@(~ [%wake ~])] ~] +=/ mode ?@(wake %idle %jolt) +[%helm-pass %g %fade dap mode] diff --git a/pkg/arvo/gen/hood/exit.hoon b/pkg/arvo/gen/hood/exit.hoon index 3c40a42e4..20233a4ce 100644 --- a/pkg/arvo/gen/hood/exit.hoon +++ b/pkg/arvo/gen/hood/exit.hoon @@ -9,8 +9,8 @@ :: =, sole :- %say -|= $: {now/@da eny/@ bec/beak} - {~ ~} +|= $: [now=@da eny=@ bec=beak] + [~ ~] == ~& %drum-exit [%drum-exit ~] diff --git a/pkg/arvo/gen/hood/fade.hoon b/pkg/arvo/gen/hood/fade.hoon new file mode 100644 index 000000000..11a7a5821 --- /dev/null +++ b/pkg/arvo/gen/hood/fade.hoon @@ -0,0 +1,17 @@ +:: Drum: destroy app +:: +:::: /hoon/fade/hood/gen + :: +/? 310 +:: +:::: + :: +:- %say +|= $: [now=@da eny=@uvJ bec=beak] + [arg=[@ $@(~ [@ ~])] ~] + == +:- %drum-fade +?> ((sane %tas) -.arg) +?@ +.arg [q.bec -.arg] +?> ((sane %tas) +<.arg) +[-.arg +<.arg] diff --git a/pkg/arvo/gen/hood/hi.hoon b/pkg/arvo/gen/hood/hi.hoon index 09c523776..ce1c26354 100644 --- a/pkg/arvo/gen/hood/hi.hoon +++ b/pkg/arvo/gen/hood/hi.hoon @@ -4,4 +4,4 @@ :: /? 310 :- %say -|=({^ {who/ship mez/$@(~ {a/tape ~})} ~} helm-send-hi+[who ?~(mez ~ `a.mez)]) +|=([^ [who=ship mez=$@(~ [a=tape ~])] ~] helm-send-hi+[who ?~(mez ~ `a.mez)]) diff --git a/pkg/arvo/gen/hood/init-oauth2.hoon b/pkg/arvo/gen/hood/init-oauth2.hoon index 093ffd840..770ebff0f 100644 --- a/pkg/arvo/gen/hood/init-oauth2.hoon +++ b/pkg/arvo/gen/hood/init-oauth2.hoon @@ -10,26 +10,26 @@ :: =, generators :- %ask -|= $: {now/@da eny/@uvJ bec/beak} - {arg/$@(~ {dom/path ~})} +|= $: [now=@da eny=@uvJ bec=beak] + [arg=$@(~ [dom=path ~])] ~ == -^- (sole-result:sole {$write-sec-atom p/host:eyre q/@}) +^- (sole-result:sole [%write-sec-atom p=host:eyre q=@]) =- ?~ arg - (fun.q.q [%& dom.arg]) %+ prompt [%& %oauth-hostname "api hostname: https://"] %+ parse thos:de-purl:html -|= hot/host:eyre +|= hot=host:eyre ?: ?=(%| -.hot) ~|(%ips-unsupported !!) %+ prompt [%& %oauth-client "client id: "] %+ parse (boss 256 (star prn)) -|= cid/@t +|= cid=@t %+ prompt [%& %oauth-secret "client secret: "] %+ parse (boss 256 (star prn)) -|= cis/@t +|= cis=@t %+ produce %write-sec-atom :: XX typed pair [hot (of-wain:format cid cis ~)] diff --git a/pkg/arvo/gen/hood/init-oauth2/google.hoon b/pkg/arvo/gen/hood/init-oauth2/google.hoon index 02343b21d..ca3b4de3a 100644 --- a/pkg/arvo/gen/hood/init-oauth2/google.hoon +++ b/pkg/arvo/gen/hood/init-oauth2/google.hoon @@ -12,11 +12,11 @@ =, html =, format :- %ask -|= $: {now/@da eny/@uvJ bec/beak} - {arg/$@(~ {jon/json ~})} +|= $: [now=@da eny=@uvJ bec=beak] + [arg=$@(~ [jon=json ~])] ~ == -^- (sole-result:sole {$write-sec-atom p/host:eyre q/@}) +^- (sole-result:sole [%write-sec-atom p=host:eyre q=@]) %+ print leaf+"Accepting credentials for https://*.googleapis.com" =+ hot=[%& /com/googleapis] =- ?~ arg - @@ -24,9 +24,9 @@ %+ prompt [%& %oauth-json "json credentials: "] %+ parse apex:de-json -|= jon/json +|= jon=json =+ ~| bad-json+jon - =- `{cid/@t cis/@t}`(need (rep jon)) + =- `[cid=@t cis=@t]`(need (rep jon)) rep=(ot web+(ot 'client_id'^so 'client_secret'^so ~) ~):dejs-soft:format %+ produce %write-sec-atom :: XX typed pair [hot (of-wain:format cid cis ~)] diff --git a/pkg/arvo/gen/hood/label.hoon b/pkg/arvo/gen/hood/label.hoon index 5b8bcd418..6be85cb88 100644 --- a/pkg/arvo/gen/hood/label.hoon +++ b/pkg/arvo/gen/hood/label.hoon @@ -7,8 +7,8 @@ :::: :: :- %say -|= $: {now/@da eny/@uvJ bec/beak} - {arg/{syd/desk lab/@tas ~} ~} +|= $: [now=@da eny=@uvJ bec=beak] + [arg=[syd=desk lab=@tas ~] ~] == :- %kiln-label [syd lab]:arg diff --git a/pkg/arvo/gen/hood/link.hoon b/pkg/arvo/gen/hood/link.hoon index c185600ac..5fe183279 100644 --- a/pkg/arvo/gen/hood/link.hoon +++ b/pkg/arvo/gen/hood/link.hoon @@ -7,8 +7,8 @@ :::: :: :- %say -|= $: {now/@da eny/@uvJ byk/beak} - {arg/$?({dap/term ~} {who/ship dap/term ~}) ~} +|= $: [now=@da eny=@uvJ byk=beak] + [arg=$?([dap=term ~] [who=ship dap=term ~]) ~] == :- %drum-link ?~ +.arg diff --git a/pkg/arvo/gen/hood/mass.hoon b/pkg/arvo/gen/hood/mass.hoon index 98459565b..b086df2de 100644 --- a/pkg/arvo/gen/hood/mass.hoon +++ b/pkg/arvo/gen/hood/mass.hoon @@ -7,7 +7,7 @@ :::: :: :- %say -|= $: {now/@da eny/@uvJ bec/beak} - {arg/~ ~} +|= $: [now=@da eny=@uvJ bec=beak] + [arg=~ ~] == [%helm-mass ~] diff --git a/pkg/arvo/gen/hood/merge.hoon b/pkg/arvo/gen/hood/merge.hoon index 98ae0e057..eb4d1de08 100644 --- a/pkg/arvo/gen/hood/merge.hoon +++ b/pkg/arvo/gen/hood/merge.hoon @@ -7,40 +7,40 @@ =, clay :: |% -++ beaky {knot knot knot ~} -++ sorc ?({bek/beaky ~} {her/@p sud/@tas ~}) ++$ beaky [knot knot knot ~] ++$ sorc ?([bek=beaky ~] [her=@p sud=@tas ~]) -- :: :::: :: :- %say -|= $: {now/@da eny/@uvJ bek/beak} - {arg/{?(~ sorc {syd/$@(desk beaky) sorc})} cas/case gem/?(germ $auto)} +|= $: [now=@da eny=@uvJ bek=beak] + [arg=[?(~ sorc [syd=$@(desk beaky) sorc])] cas=case gem=?(germ %auto)] == =* our p.bek |^ :- %kiln-merge - ^- $@(~ {syd/desk her/ship sud/desk cas/case gem/?(germ $auto)}) + ^- $@(~ [syd=desk her=ship sud=desk cas=case gem=?(germ %auto)]) ?- arg ~ ((slog (turn help-text |=(=@t leaf+(trip t)))) ~) - {@ @ ~} + [@ @ ~] =+(arg [sud ?.(=(our her) her (sein:title p.bek now her)) sud (opt-case da+now) gem]) :: - {^ ~} + [^ ~] =+ (pars bek.arg) [dez ?.(=(our who) who (sein:title p.bek now who)) dez (opt-case caz) gem] :: - {* @ @ ~} + [* @ @ ~] :- (pars-src syd.arg) =+(arg [her sud (opt-case da+now) gem]) :: - {* ^ ~} + [* ^ ~] :- (pars-src syd.arg) =+((pars bek.arg) [who dez (opt-case caz) gem]) == -++ opt-case |=(a/case ?:(=(*case cas) a cas)) :: override -++ pars |=(a/beaky `{{who/ship dez/desk caz/case} *}`(need (de-beam:format a))) +++ opt-case |=(a=case ?:(=(*case cas) a cas)) :: override +++ pars |=(a=beaky `[[who=ship dez=desk caz=case] *]`(need (de-beam:format a))) ++ pars-src - |= syd/$@(desk beaky) + |= syd=$@(desk beaky) ?@ syd syd =+ (pars syd) ~| [%into-foreign who `path`syd] diff --git a/pkg/arvo/gen/hood/moon-breach.hoon b/pkg/arvo/gen/hood/moon-breach.hoon index 64f81a467..0b60e8c8b 100644 --- a/pkg/arvo/gen/hood/moon-breach.hoon +++ b/pkg/arvo/gen/hood/moon-breach.hoon @@ -16,9 +16,9 @@ ^- (unit [=ship =udiff:point:able:jael]) =* our p.bec =/ ran (clan:title our) -?: ?=({?($earl $pawn)} ran) +?: ?=([?(%earl %pawn)] ran) %- %- slog :_ ~ - leaf+"can't manage a moon from a {?:(?=($earl ran) "moon" "comet")}" + leaf+"can't manage a moon from a {?:(?=(%earl ran) "moon" "comet")}" ~ =/ seg=ship (sein:title our now mon) ?. =(our seg) diff --git a/pkg/arvo/gen/hood/moon-cycle-keys.hoon b/pkg/arvo/gen/hood/moon-cycle-keys.hoon index 38ca3d364..74c938d2f 100644 --- a/pkg/arvo/gen/hood/moon-cycle-keys.hoon +++ b/pkg/arvo/gen/hood/moon-cycle-keys.hoon @@ -17,9 +17,9 @@ ^- (unit [=ship =udiff:point:able:jael]) =* our p.bec =/ ran (clan:title our) -?: ?=({?($earl $pawn)} ran) +?: ?=([?(%earl %pawn)] ran) %- %- slog :_ ~ - leaf+"can't manage a moon from a {?:(?=($earl ran) "moon" "comet")}" + leaf+"can't manage a moon from a {?:(?=(%earl ran) "moon" "comet")}" ~ =/ seg=ship (sein:title our now mon) ?. =(our seg) diff --git a/pkg/arvo/gen/hood/moon.hoon b/pkg/arvo/gen/hood/moon.hoon index 98b79033a..9520b8b18 100644 --- a/pkg/arvo/gen/hood/moon.hoon +++ b/pkg/arvo/gen/hood/moon.hoon @@ -16,9 +16,9 @@ ^- (unit [=ship =udiff:point:able:jael]) =* our p.bec =/ ran (clan:title our) -?: ?=({?($earl $pawn)} ran) +?: ?=([?(%earl %pawn)] ran) %- %- slog :_ ~ - leaf+"can't create a moon from a {?:(?=($earl ran) "moon" "comet")}" + leaf+"can't create a moon from a {?:(?=(%earl ran) "moon" "comet")}" ~ =/ mon=ship ?^ arg diff --git a/pkg/arvo/gen/hood/mount.hoon b/pkg/arvo/gen/hood/mount.hoon index 4b014223c..85f029207 100644 --- a/pkg/arvo/gen/hood/mount.hoon +++ b/pkg/arvo/gen/hood/mount.hoon @@ -7,11 +7,11 @@ :::: :: :- %say -|= $: {now/@da eny/@uvJ bec/beak} - {{pax/path pot/$@(~ {v/@tas ~})} ~} +|= $: [now=@da eny=@uvJ bec=beak] + [[pax=path pot=$@(~ [v=@tas ~])] ~] == ?~ pot =+ bem=(need (de-beam:format pax)) - $(pot ~[?^(s.bem i.s.bem q.bem)]) + $(pot ~[?^(s.bem (rear s.bem) q.bem)]) :- %kiln-mount [pax v.pot] diff --git a/pkg/arvo/gen/hood/mv.hoon b/pkg/arvo/gen/hood/mv.hoon index 01339e8b0..2a0f5a671 100644 --- a/pkg/arvo/gen/hood/mv.hoon +++ b/pkg/arvo/gen/hood/mv.hoon @@ -5,7 +5,7 @@ /? 310 =, space:userlib :- %say -|= {^ {input/path output/path ~} ~} +|= [^ [input=path output=path ~] ~] :- %kiln-info ?. =(-:(flop input) -:(flop output)) ["Can't move to a different mark" ~] diff --git a/pkg/arvo/gen/hood/pack.hoon b/pkg/arvo/gen/hood/pack.hoon index a6038b98c..732d872ba 100644 --- a/pkg/arvo/gen/hood/pack.hoon +++ b/pkg/arvo/gen/hood/pack.hoon @@ -7,7 +7,7 @@ :::: :: :- %say -|= $: {now/@da eny/@uvJ bec/beak} - {arg/~ ~} +|= $: [now=@da eny=@uvJ bec=beak] + [arg=~ ~] == [%helm-pack ~] diff --git a/pkg/arvo/gen/hood/pass.hoon b/pkg/arvo/gen/hood/pass.hoon new file mode 100644 index 000000000..84bee18a4 --- /dev/null +++ b/pkg/arvo/gen/hood/pass.hoon @@ -0,0 +1,3 @@ +:- %say +|= [^ [=note-arvo ~] ~] +[%helm-pass note-arvo] diff --git a/pkg/arvo/gen/hood/ping.hoon b/pkg/arvo/gen/hood/ping.hoon index 1064a98a4..2b66e97e4 100644 --- a/pkg/arvo/gen/hood/ping.hoon +++ b/pkg/arvo/gen/hood/ping.hoon @@ -4,8 +4,8 @@ :: /? 310 :- %say -|= $: {now/@da eny/@ bec/beak} - {{exp/@ud ~} ~} +|= $: [now=@da eny=@ bec=beak] + [[exp=@ud ~] ~] == =+ rab=(~(raw og eny) (bex exp)) ~& [%random-bytes (met 3 rab) `@p`(mug rab)] diff --git a/pkg/arvo/gen/hood/private.hoon b/pkg/arvo/gen/hood/private.hoon index bcfe62ff4..8258d1a90 100644 --- a/pkg/arvo/gen/hood/private.hoon +++ b/pkg/arvo/gen/hood/private.hoon @@ -3,8 +3,8 @@ :::: /gen/hood/private/hoon :: :- %say -|= $: {now/@da eny/@uvJ bec/beak} - {arg/{des/desk may/?($~ {pax/path $~})} $~} +|= $: [now=@da eny=@uvJ bec=beak] + [arg=[des=desk may=?(~ [pax=path ~])] ~] == :- %kiln-permission [des ?~(may / pax.may) |]:arg diff --git a/pkg/arvo/gen/hood/public.hoon b/pkg/arvo/gen/hood/public.hoon index eea1bcba7..f513caf08 100644 --- a/pkg/arvo/gen/hood/public.hoon +++ b/pkg/arvo/gen/hood/public.hoon @@ -3,8 +3,8 @@ :::: /gen/hood/public/hoon :: :- %say -|= $: {now/@da eny/@uvJ bec/beak} - {arg/{des/desk may/?($~ {pax/path $~})} $~} +|= $: [now=@da eny=@uvJ bec=beak] + [arg=[des=desk may=?(~ [pax=path ~])] ~] == :- %kiln-permission [des ?~(may / pax.may) &]:arg diff --git a/pkg/arvo/gen/hood/rc.hoon b/pkg/arvo/gen/hood/rc.hoon index 12102e3fe..feaed17ab 100644 --- a/pkg/arvo/gen/hood/rc.hoon +++ b/pkg/arvo/gen/hood/rc.hoon @@ -7,7 +7,7 @@ :::: :: :- %say -|= $: {now/@da eny/@uvJ bec/beak} - {arg/~ ~} +|= $: [now=@da eny=@uvJ bec=beak] + [arg=~ ~] == [%helm-reload ~[%c]] diff --git a/pkg/arvo/gen/hood/reboot.hoon b/pkg/arvo/gen/hood/reboot.hoon index f9afb0a3c..aa48d85cb 100644 --- a/pkg/arvo/gen/hood/reboot.hoon +++ b/pkg/arvo/gen/hood/reboot.hoon @@ -7,7 +7,7 @@ :::: :: :- %say -|= $: {now/@da eny/@uvJ bec/beak} - {arg/~ ~} +|= $: [now=@da eny=@uvJ bec=beak] + [arg=~ ~] == [%helm-reload ~[%z %a %b %c %d %e %g %i %j]] diff --git a/pkg/arvo/gen/hood/reload-desk.hoon b/pkg/arvo/gen/hood/reload-desk.hoon index e6543f5cf..c242a2da1 100644 --- a/pkg/arvo/gen/hood/reload-desk.hoon +++ b/pkg/arvo/gen/hood/reload-desk.hoon @@ -7,8 +7,8 @@ :::: :: :- %say -|= $: {now/@da eny/@uvJ bec/beak} - {arg/{desk (list term)} ~} +|= $: [now=@da eny=@uvJ bec=beak] + [arg=[desk (list term)] ~] == :- %helm-reload-desk arg diff --git a/pkg/arvo/gen/hood/reload.hoon b/pkg/arvo/gen/hood/reload.hoon index 72ecb0a47..d22ea1b52 100644 --- a/pkg/arvo/gen/hood/reload.hoon +++ b/pkg/arvo/gen/hood/reload.hoon @@ -7,8 +7,8 @@ :::: :: :- %say -|= $: {now/@da eny/@uvJ bec/beak} - {arg/(list term) ~} +|= $: [now=@da eny=@uvJ bec=beak] + [arg=(list term) ~] == :- %helm-reload arg diff --git a/pkg/arvo/gen/hood/reset.hoon b/pkg/arvo/gen/hood/reset.hoon index 7989b03b4..0e15ce59f 100644 --- a/pkg/arvo/gen/hood/reset.hoon +++ b/pkg/arvo/gen/hood/reset.hoon @@ -7,7 +7,7 @@ :::: :: :- %say -|= $: {now/@da eny/@uvJ bec/beak} - {arg/~ ~} +|= $: [now=@da eny=@uvJ bec=beak] + [arg=~ ~] == [%helm-reset ~] diff --git a/pkg/arvo/gen/hood/rm.hoon b/pkg/arvo/gen/hood/rm.hoon index 0b4f2a94e..a60a6f2b2 100644 --- a/pkg/arvo/gen/hood/rm.hoon +++ b/pkg/arvo/gen/hood/rm.hoon @@ -4,4 +4,4 @@ :: /? 310 :- %say -|=({^ {input/path ~} ~} kiln-rm+input) +|=([^ [input=path ~] ~] kiln-rm+input) diff --git a/pkg/arvo/gen/hood/schedule.hoon b/pkg/arvo/gen/hood/schedule.hoon index c2c236092..281b7ec64 100644 --- a/pkg/arvo/gen/hood/schedule.hoon +++ b/pkg/arvo/gen/hood/schedule.hoon @@ -4,4 +4,4 @@ :: /? 310 :- %say -|=({^ {where/path tym/@da eve/@t ~} ~} kiln-schedule+[where tym eve]) +|=([^ [where=path tym=@da eve=@t ~] ~] kiln-schedule+[where tym eve]) diff --git a/pkg/arvo/gen/hood/start.hoon b/pkg/arvo/gen/hood/start.hoon index f2e3d9f32..2949d0044 100644 --- a/pkg/arvo/gen/hood/start.hoon +++ b/pkg/arvo/gen/hood/start.hoon @@ -7,8 +7,8 @@ :::: :: :- %say -|= $: {now/@da eny/@uvJ bec/beak} - {arg/{@ $@(~ {@ ~})} ~} +|= $: [now=@da eny=@uvJ bec=beak] + [arg=[@ $@(~ [@ ~])] ~] == :- %drum-start ?> ((sane %tas) -.arg) diff --git a/pkg/arvo/gen/hood/sync.hoon b/pkg/arvo/gen/hood/sync.hoon index b6cf91ab1..702165ae5 100644 --- a/pkg/arvo/gen/hood/sync.hoon +++ b/pkg/arvo/gen/hood/sync.hoon @@ -7,8 +7,8 @@ :::: :: :- %say -|= $: {now/@da eny/@uvJ bec/beak} - {arg/{syd/@tas her/@p sud/@tas ~} ~} +|= $: [now=@da eny=@uvJ bec=beak] + [arg=[syd=@tas her=@p sud=@tas ~] ~] == :- %kiln-sync [syd her sud]:arg diff --git a/pkg/arvo/gen/hood/syncs.hoon b/pkg/arvo/gen/hood/syncs.hoon index 67abee089..6e90e3644 100644 --- a/pkg/arvo/gen/hood/syncs.hoon +++ b/pkg/arvo/gen/hood/syncs.hoon @@ -7,5 +7,5 @@ :::: :: :- %say -|= {{now/@da eny/@uvJ bec/beak} ~ ~} +|= [[now=@da eny=@uvJ bec=beak] ~ ~] [%kiln-syncs ~] diff --git a/pkg/arvo/gen/hood/track.hoon b/pkg/arvo/gen/hood/track.hoon index 235e11f41..49c77771f 100644 --- a/pkg/arvo/gen/hood/track.hoon +++ b/pkg/arvo/gen/hood/track.hoon @@ -7,8 +7,8 @@ :::: :: :- %say -|= $: {now/@da eny/@uvJ bec/beak} - {arg/{syd/@tas her/@p sud/@tas ~} ~} +|= $: [now=@da eny=@uvJ bec=beak] + [arg=[syd=@tas her=@p sud=@tas ~] ~] == :- %kiln-track [syd her sud]:arg diff --git a/pkg/arvo/gen/hood/unlink.hoon b/pkg/arvo/gen/hood/unlink.hoon index f758e145f..d7bc509b0 100644 --- a/pkg/arvo/gen/hood/unlink.hoon +++ b/pkg/arvo/gen/hood/unlink.hoon @@ -7,8 +7,8 @@ :::: :: :- %say -|= $: {now/@da eny/@uvJ byk/beak} - {arg/$?({dap/term ~} {who/ship dap/term ~}) ~} +|= $: [now=@da eny=@uvJ byk=beak] + [arg=$?([dap=term ~] [who=ship dap=term ~]) ~] == :- %drum-unlink ?~ +.arg diff --git a/pkg/arvo/gen/hood/unmount.hoon b/pkg/arvo/gen/hood/unmount.hoon index e91f55755..9219053d7 100644 --- a/pkg/arvo/gen/hood/unmount.hoon +++ b/pkg/arvo/gen/hood/unmount.hoon @@ -7,8 +7,8 @@ :::: :: :- %say -|= $: {now/@da eny/@uvJ bec/beak} - {{mon/$@(term {knot path}) ~} ~} +|= $: [now=@da eny=@uvJ bec=beak] + [[mon=$@(term [knot path]) ~] ~] == :- %kiln-unmount mon diff --git a/pkg/arvo/gen/hood/unsync.hoon b/pkg/arvo/gen/hood/unsync.hoon index a867b9b3b..4ab9e0d84 100644 --- a/pkg/arvo/gen/hood/unsync.hoon +++ b/pkg/arvo/gen/hood/unsync.hoon @@ -7,8 +7,8 @@ :::: :: :- %say -|= $: {now/@da eny/@uvJ bec/beak} - {arg/{syd/@tas her/@p sud/@tas ~} ~} +|= $: [now=@da eny=@uvJ bec=beak] + [arg=[syd=@tas her=@p sud=@tas ~] ~] == :- %kiln-unsync [syd her sud]:arg diff --git a/pkg/arvo/gen/hood/verb.hoon b/pkg/arvo/gen/hood/verb.hoon index 84ff92637..a83597150 100644 --- a/pkg/arvo/gen/hood/verb.hoon +++ b/pkg/arvo/gen/hood/verb.hoon @@ -9,8 +9,8 @@ :: =, sole :- %say -|= $: {now/@da eny/@ bec/beak} - {~ ~} +|= $: [now=@da eny=@ bec=beak] + [~ ~] == ~& %helm-verb [%helm-verb ~] diff --git a/pkg/arvo/gen/ivory.hoon b/pkg/arvo/gen/ivory.hoon index 36299409b..c85587d3f 100644 --- a/pkg/arvo/gen/ivory.hoon +++ b/pkg/arvo/gen/ivory.hoon @@ -7,11 +7,15 @@ :::: !: :- %say -|= [[now=@da * bec=beak] *] +|= $: [now=@da eny=@uvJ bec=beak] + arg=$@(~ [top=path ~]) + ~ + == :- %noun :: sys: root path to boot system, `/~me/[desk]/now/sys` :: =/ sys=path + ?^ arg top.arg /(scot %p p.bec)/[q.bec]/(scot %da now)/sys :: compiler-source: hoon source file producing compiler, `sys/hoon` :: @@ -33,8 +37,8 @@ :: Parsed with a static path for reproducibility. :: =/ whole-hoon=hoon - :+ %tsbn compiler-hoon - :+ %tsld (rain /sys/arvo/hoon arvo-source) + :+ %tsgr compiler-hoon + :+ %tsgl (rain /sys/arvo/hoon arvo-source) [%$ 7] :: compile the whole schmeer :: @@ -48,8 +52,12 @@ :: we include a static path for reproducibility. :: =/ zuse-ovo=ovum - :- /vane/zuse - [%veer %$ /sys/zuse/hoon .^(@ %cx (weld sys /zuse/hoon))] + :~ //arvo + %what + [/sys/hoon hoon/compiler-source] + [/sys/arvo hoon/arvo-source] + [/sys/zuse hoon/.^(@ %cx (weld sys /zuse/hoon))] + == :: installed: Arvo gate (formal instance) with %zuse installed :: :: The :zuse-ovo event occurs at a defaulted date for reproducibility. diff --git a/pkg/arvo/gen/key.hoon b/pkg/arvo/gen/key.hoon index c3f1b6284..6bdcb2f3a 100644 --- a/pkg/arvo/gen/key.hoon +++ b/pkg/arvo/gen/key.hoon @@ -12,7 +12,7 @@ %+ print leaf+"generating keys for {(scow %p who)}, life #{(scow %ud life)}" %+ prompt [%| %pope-pass "passphrase: "] %+ parse (boss 256 (star prn)) -|= fra/@t +|= fra=@t =/ bur (shaz (add who (shaz fra))) =/ cub (pit:nu:crub:crypto 512 bur) :: diff --git a/pkg/arvo/gen/ls.hoon b/pkg/arvo/gen/ls.hoon index c691be6e1..676522bd2 100644 --- a/pkg/arvo/gen/ls.hoon +++ b/pkg/arvo/gen/ls.hoon @@ -9,6 +9,6 @@ :: ~& % :- %say -|= {^ {arg/path ~} vane/?($g $c)} +|= [^ [arg=path ~] vane=?(%g %c)] =+ lon=.^(arch (cat 3 vane %y) arg) tang+[?~(dir.lon leaf+"~" (show-dir vane arg dir.lon))]~ diff --git a/pkg/arvo/gen/metal.hoon b/pkg/arvo/gen/metal.hoon deleted file mode 100644 index e62dd279f..000000000 --- a/pkg/arvo/gen/metal.hoon +++ /dev/null @@ -1,319 +0,0 @@ -:: Produce a metal pill -:: -:::: /hoon/metal/gen - :: -/? 310 -:: -:::: - !: -:- %say -|= $: {now/@da * bec/beak} - {{who/@p ~} try/_| ~} - == -:: -:: we're creating an event series E whose lifecycle can be computed -:: with the urbit lifecycle formula L, `[2 [0 3] [0 2]]`. that is: -:: if E is the list of events processed by a computer in its life, -:: its final state is S, where S is nock(E L). -:: -:: in practice, the first five nouns in E are: two boot formulas, -:: a hoon compiler as a nock formula, the same compiler as source, -:: and the arvo kernel as source. -:: -:: after the first five special events, we enter an iterative -:: sequence of regular events which continues for the rest of the -:: computer's life. during this sequence, each state is a function -:: that, passed the next event, produces the next state. -:: -:: each event is a `[date wire type data]` tuple, where `date` is a -:: 128-bit Urbit date; `wire` is an opaque path which output can -:: match to track causality; `type` is a symbol describing the type -:: of input; and `data` is input data specific to `type`. -:: -:: in real life we don't actually run the lifecycle loop, -:: since real life is updated incrementally and also cares -:: about things like output. we couple to the internal -:: structure of the state machine and work directly with -:: the underlying arvo engine. -:: -:: this arvo core, which is at `+7` (Lisp `cddr`) of the state -:: function (see its public interface in `sys/arvo`), gives us -:: extra features, like output, which are relevant to running -:: a real-life urbit vm, but don't affect the formal definition. -:: -:: so a real-life urbit interpreter is coupled to the shape of -:: the arvo core. it becomes very hard to change this shape. -:: fortunately, it is not a very complex interface. -:: -:- %noun -:: -:: boot-one: lifecycle formula -:: -=+ ^= boot-one - :: - :: event 1 is the lifecycle formula which computes the final - :: state from the full event sequence. - :: - :: the formal urbit state is always just a gate (function) - :: which, passed the next event, produces the next state. - :: - => [boot-formula=* full-sequence=*] - != :: - :: first we use the boot formula (event 1) to set up - :: the pair of state function and main sequence. the boot - :: formula peels off the first n (currently 3) events - :: to set up the lifecycle loop. - :: - =+ [state-gate main-sequence]=.*(full-sequence boot-formula) - :: - :: in this lifecycle loop, we replace the state function - :: with its product, called on the next event, until - :: we run out of events. - :: - |- ?@ main-sequence - state-gate - %= $ - main-sequence +.main-sequence - state-gate .*(state-gate [%9 2 %10 [6 %1 -.main-sequence] %0 1]) - == -:: -:: boot-two: startup formula -:: -=+ ^= boot-two - :: - :: event 2 is the startup formula, which verifies the compiler - :: and starts the main lifecycle. - :: - => :* :: event 3: a formula producing the hoon compiler - :: - compiler-formula=** - :: - :: event 4: hoon compiler source, compiling to event 2 - :: - compiler-source=*@t - :: - :: event 5: arvo kernel source - :: - arvo-source=*@t - :: - :: events 6..n: main sequence with normal semantics - :: - main-sequence=** - == - != :_ main-sequence - :: - :: activate the compiler gate. the product of this formula - :: is smaller than the formula. so you might think we should - :: save the gate itself rather than the formula producing it. - :: but we have to run the formula at runtime, to register jets. - :: - :: as always, we have to use raw nock as we have no type. - :: the gate is in fact ++ride. - :: - ~> %slog.[0 leaf+"1-b"] - =+ ^= compiler-gate - .*(0 compiler-formula) - :: - :: compile the compiler source, producing (pair span nock). - :: the compiler ignores its input so we use a trivial span. - :: - ~> %slog.[0 leaf+"1-c"] - =+ ^= compiler-tool - .*(compiler-gate [%9 2 %10 [6 %1 [%noun compiler-source]] %0 1]) - :: - :: switch to the second-generation compiler. we want to be - :: able to generate matching reflection nouns even if the - :: language changes -- the first-generation formula will - :: generate last-generation spans for `!>`, etc. - :: - ~> %slog.[0 leaf+"1-d"] - =. compiler-gate .*(0 +:compiler-tool) - :: - :: get the span (type) of the kernel core, which is the context - :: of the compiler gate. we just compiled the compiler, - :: so we know the span (type) of the compiler gate. its - :: context is at tree address `+>` (ie, `+7` or Lisp `cddr`). - :: we use the compiler again to infer this trivial program. - :: - ~> %slog.[0 leaf+"1-e"] - =+ ^= kernel-span - -:.*(compiler-gate [%9 2 %10 [6 %1 [-.compiler-tool '+>']] %0 1]) - :: - :: compile the arvo source against the kernel core. - :: - ~> %slog.[0 leaf+"1-f"] - =+ ^= kernel-tool - .*(compiler-gate [%9 2 %10 [6 %1 [kernel-span arvo-source]] %0 1]) - :: - :: create the arvo kernel, whose subject is the kernel core. - :: - ~> %slog.[0 leaf+"1-g"] - .*(+>:compiler-gate +:kernel-tool) -:: -:: sys: root path to boot system, `/~me/[desk]/now/sys` -:: -=+ sys=`path`/(scot %p p.bec)/[q.bec]/(scot %da now)/sys -:: -:: compiler-source: hoon source file producing compiler, `sys/hoon` -:: -=+ compiler-source=.^(@t %cx (welp sys /hoon/hoon)) -:: -:: compiler-twig: compiler as hoon expression -:: -~& %metal-parsing -=+ compiler-twig=(ream compiler-source) -~& %metal-parsed -:: -:: compiler-formula: compiler as nock formula -:: -~& %metal-compiling -=+ compiler-formula=q:(~(mint ut %noun) %noun compiler-twig) -~& %metal-compiled -:: -:: arvo-source: hoon source file producing arvo kernel, `sys/arvo` -:: -=+ arvo-source=.^(@t %cx (welp sys /arvo/hoon)) -:: -:: main-moves: installation actions -:: -=+ ^= main-moves - |^ ^- (list ovum) - :~ :: - :: configure identity - :: - [[%name (scot %p who) ~] [%veal who]] - :: - :: sys/zuse: standard library - :: - (vent %$ /zuse) - :: - :: sys/vane/ames: network - :: - (vent %a /vane/ames) - :: - :: sys/vane/behn: timer - :: - (vent %b /vane/behn) - :: - :: sys/vane/clay: revision control - :: - (vent %c /vane/clay) - :: - :: sys/vane/dill: console - :: - (vent %d /vane/dill) - :: - :: sys/vane/eyre: web - :: - (vent %e /vane/eyre) - :: - :: sys/vane/gall: applications - :: - (vent %g /vane/gall) - :: - :: sys/vane/jael: security - :: - (vent %j /vane/jael) - :: - :: legacy boot event - :: - [[%$ %term '1' ~] [%boot %sith who `@uw`who &]] - :: - :: userspace: - :: - :: /app %gall applications - :: /gen :dojo generators - :: /lib %ford libraries - :: /mar %ford marks - :: /sur %ford structures - :: /ren %ford renderers - :: /web %eyre web content - :: /sys system files - :: - (user /app /gen /lib /mar /ren /sec /sur /sys /web ~) - == - :: :: - ++ user :: userspace loading - |= :: sal: all spurs to load from - :: - sal/(list spur) - ^- ovum - :: - :: hav: all user files - :: - =; hav ~& user-files+(lent hav) - [[%$ %sync ~] [%into %$ & hav]] - =| hav/mode:clay - |- ^+ hav - ?~ sal ~ - =. hav $(sal t.sal) - :: - :: tyl: spur - :: - =/ tyl i.sal - |- ^+ hav - :: - :: pax: full path at `tyl` - :: lon: directory at `tyl` - :: - =/ pax (en-beam:format bec tyl) - =/ lon .^(arch %cy pax) - =? hav ?=(^ fil.lon) - ?. ?=({$hoon *} tyl) - :: - :: install only hoon files for now - :: - hav - :: - :: cot: file as plain-text octet-stream - :: - =; cot [[(flop `path`tyl) `[/text/plain cot]] hav] - ^- octs - ?- tyl - {$hoon *} - =/ dat .^(@t %cx pax) - [(met 3 dat) dat] - == - =/ all ~(tap by dir.lon) - |- ^- mode:clay - ?~ all hav - $(all t.all, hav ^$(tyl [p.i.all tyl])) - :: - ++ vent - |= {abr/term den/path} - =+ pax=(weld sys den) - =+ txt=.^(@ %cx (welp pax /hoon)) - `ovum`[[%vane den] [%veer abr pax txt]] - -- -:: -:: main-events: full events with advancing times -:: -=. now ~2017.3.1 -=+ ^= main-events - |- ^- (list (pair @da ovum)) - ?~ main-moves ~ - :- [now i.main-moves] - $(main-moves t.main-moves, now (add now (bex 48))) -:: -~? try - ~& %metal-testing - =+ ^= yop - ^- @p - %- mug - .* :* boot-one - boot-two - compiler-formula - compiler-source - arvo-source - main-events - == - [2 [0 3] [0 2]] - [%metal-tested yop] -:: -:* boot-one - boot-two - compiler-formula - compiler-source - arvo-source - main-events -== diff --git a/pkg/arvo/gen/solid.hoon b/pkg/arvo/gen/solid.hoon index 7a26757ef..9f0bbbbdb 100644 --- a/pkg/arvo/gen/solid.hoon +++ b/pkg/arvo/gen/solid.hoon @@ -35,7 +35,7 @@ :: compile arvo against hoon, with our current compiler :: =/ whole-hoon=hoon - [%tsbn compiler-hoon [%tsbn [%$ 7] (rain arvo-path arvo-src)]] + [%tsgr compiler-hoon [%tsgr [%$ 7] (rain arvo-path arvo-src)]] ~& %solid-parsed =/ whole-formula q:(~(mint ut %noun) %noun whole-hoon) ~& %solid-arvo @@ -64,7 +64,14 @@ =/ installed =< q %^ spin - (module-ova:pill sys) + ^- (list ovum) + :~ :~ //arvo + %what + [/sys/hoon hoon/compiler-src] + [/sys/arvo hoon/arvo-src] + == + (file-ovum2:pill (flop (tail (flop sys)))) + == .*(0 arvo-formula) |= [ovo=ovum ken=*] [~ (slum ken [now ovo])] diff --git a/pkg/arvo/gen/timers.hoon b/pkg/arvo/gen/timers.hoon index d448fd6ac..b016fd41c 100644 --- a/pkg/arvo/gen/timers.hoon +++ b/pkg/arvo/gen/timers.hoon @@ -5,5 +5,5 @@ [%tang >timers< ~] .^ (list [date=@da =duct]) %bx - (en-beam:format [p.bec %$ r.bec] /timers/debug) + (en-beam:format [p.bec %$ r.bec] /debug/timers) == diff --git a/pkg/arvo/lib/bip32.hoon b/pkg/arvo/lib/bip32.hoon index 90ec0a07b..527cb1558 100644 --- a/pkg/arvo/lib/bip32.hoon +++ b/pkg/arvo/lib/bip32.hoon @@ -16,9 +16,9 @@ :: dep: depth in chain :: ind: index at depth :: pif: parent fingerprint (4 bytes) -|_ [prv=@ pub=pont cad=@ dep=@ud ind=@ud pif=@] +|_ [prv=@ pub=point.ecc cad=@ dep=@ud ind=@ud pif=@] :: -+= keyc [key=@ cai=@] :: prv/pub key + chain code ++$ keyc [key=@ cai=@] :: prv/pub key + chain code :: :: elliptic curve operations and values :: @@ -26,7 +26,7 @@ :: ++ ser-p compress-point.ecc :: -++ n ^n:ecc +++ n n:t.ecc :: :: core initialization :: @@ -46,7 +46,7 @@ +>(pub (decompress-point.ecc key), cad cai) :: ++ from-public-point - |= [pon=pont cai=@] + |= [pon=point.ecc cai=@] +>(pub pon, cad cai) :: ++ from-extended @@ -67,9 +67,9 @@ ?> =(0 x) :: sanity check %. [d i p] =< set-metadata - =+ v=(scag 4 t) - ?: =("xprv" v) (from-private k c) - ?: =("xpub" v) (from-public k c) + =+ v=(swag [1 3] t) + ?: =("prv" v) (from-private k c) + ?: =("pub" v) (from-public k c) !! :: ++ set-metadata @@ -150,7 +150,7 @@ :: rare exception, invalid key, go to the next one ?: (gte left n) $(i +(i)) ::TODO or child key is "point at infinity" %_ +>.$ - pub (jc-add.ecc (point left) pub) + pub (add-points.ecc (point left) pub) cad right dep +(dep) ind i @@ -168,12 +168,24 @@ ++ identity (hash160 public-key) ++ fingerprint (cut 3 [16 4] identity) :: +++ address + |= network=?(%main %regtest %testnet) + ^- @uc + :: removes checksum + :: + %^ rsh 3 4 + %+ en-base58check + [4 (version-bytes network %pub %.n)] + [20 identity] +:: ++ prv-extended - %+ en-b58c-bip32 0x488.ade4 + |= network=?(%main %regtest %testnet) + %+ en-b58c-bip32 (version-bytes network %prv %.y) (build-extended private-key) :: ++ pub-extended - %+ en-b58c-bip32 0x488.b21e + |= network=?(%main %regtest %testnet) + %+ en-b58c-bip32 (version-bytes network %pub %.y) (build-extended public-key) :: ++ build-extended @@ -188,6 +200,7 @@ :: ++ en-b58c-bip32 |= [v=@ k=@] + %- en-base58:mimes:html (en-base58check [4 v] [74 k]) :: :: base58check @@ -196,7 +209,6 @@ :: v: version bytes :: d: data |= [v=byts d=byts] - %- en-base58:mimes:html =+ p=[(add wid.v wid.d) (can 3 ~[d v])] =- (can 3 ~[4^- p]) %^ rsh 3 28 @@ -213,4 +225,19 @@ ++ hash160 |= d=@ (ripemd-160:ripemd:crypto 32 (sha-256:sha d)) +:: +++ version-bytes + |= [network=?(%main %regtest %testnet) type=?(%pub %prv) bip32=?] + ^- @ux + |^ + ?- type + %pub ?:(bip32 xpub-key pay-to-pubkey) + %prv ?:(bip32 xprv-key private-key) + == + :: + ++ pay-to-pubkey ?:(=(network %main) 0x0 0x6f) + ++ private-key ?:(=(network %main) 0x80 0xef) + ++ xpub-key ?:(=(network %main) 0x488.b21e 0x435.87cf) + ++ xprv-key ?:(=(network %main) 0x488.ade4 0x435.8394) + -- -- diff --git a/pkg/arvo/lib/chat-store.hoon b/pkg/arvo/lib/chat-store.hoon index 3b40c6c05..694531ea6 100644 --- a/pkg/arvo/lib/chat-store.hoon +++ b/pkg/arvo/lib/chat-store.hoon @@ -168,8 +168,8 @@ (cu (cury slav %uv) so) :: ++ re :: recursive reparsers - |* {gar/* sef/_|.(fist:dejs-soft:format)} - |= jon/json + |* [gar=* sef=_|.(fist:dejs-soft:format)] + |= jon=json ^- (unit _gar) =- ~! gar ~! (need -) - ((sef) jon) diff --git a/pkg/arvo/lib/contact-json.hoon b/pkg/arvo/lib/contact-json.hoon index c12d62b15..b96040652 100644 --- a/pkg/arvo/lib/contact-json.hoon +++ b/pkg/arvo/lib/contact-json.hoon @@ -2,8 +2,8 @@ /+ base64, group-store, resource |% ++ nu :: parse number as hex - |= jon/json - ?> ?=({$s *} jon) + |= jon=json + ?> ?=([%s *] jon) (rash p.jon hex) :: ++ hook-update-to-json diff --git a/pkg/arvo/lib/cram.hoon b/pkg/arvo/lib/cram.hoon index ebed96864..dbec8f7b4 100644 --- a/pkg/arvo/lib/cram.hoon +++ b/pkg/arvo/lib/cram.hoon @@ -1,50 +1,50 @@ |% ++ static :: freeze .mdh hoon subset - |= gen/hoon ^- {inf/(map term dime) elm/manx} + |= gen=hoon ^- [inf=(map term dime) elm=manx] ?+ -.gen =/ gen ~(open ap gen) ?: =(gen ^gen) ~|([%cram-dynamic -.gen] !!) $(gen gen) :: - $xray [~ (single (shut gen))] + %xray [~ (single (shut gen))] ^ [(malt (frontmatter p.gen)) (single (shut q.gen))] == :: ++ single :: unwrap one-elem marl - |= xml/marl ^- manx - ?: ?=({* ~} xml) i.xml + |= xml=marl ^- manx + ?: ?=([* ~] xml) i.xml ~|(%many-elems !!) :: ++ shut-mart :: xml attrs - |=({n/mane v/(list beer:hoot)} [n (turn v |=(a/beer:hoot ?^(a !! a)))]) + |=([n=mane v=(list beer:hoot)] [n (turn v |=(a=beer:hoot ?^(a !! a)))]) :: ++ shut :: as xml constant - |= gen/hoon ^- marl + |= gen=hoon ^- marl ?+ -.gen ~|([%bad-xml -.gen] !!) - $dbug $(gen q.gen) + %dbug $(gen q.gen) :: - $xray + %xray [[n.g.p.gen (turn a.g.p.gen shut-mart)] $(gen [%mcts c.p.gen])]~ :: - $mcts + %mcts ?~ p.gen ~ =- (weld - $(p.gen t.p.gen)) ?^ -.i.p.gen $(gen [%xray i.p.gen]) ~| [%shut-tuna -.i.p.gen] ?+ -.i.p.gen !! - $manx ?>(?=($xray -.p.i.p.gen) $(gen p.i.p.gen)) - $marl ?>(?=($mcts -.p.i.p.gen) $(gen p.i.p.gen)) + %manx ?>(?=(%xray -.p.i.p.gen) $(gen p.i.p.gen)) + %marl ?>(?=(%mcts -.p.i.p.gen) $(gen p.i.p.gen)) == == :: :: ++ frontmatter :: parse ~[[%foo 1] [%bar ~s2]] - |= gen/hoon ^- (list {term dime}) - ?: ?=({$bust $null} gen) ~ - ?: ?=($dbug -.gen) $(gen q.gen) - ?. ?=($clsg -.gen) ~|([%bad-frontmatter -.gen] !!) + |= gen=hoon ^- (list [term dime]) + ?: ?=([%bust %null] gen) ~ + ?: ?=(%dbug -.gen) $(gen q.gen) + ?. ?=(%clsg -.gen) ~|([%bad-frontmatter -.gen] !!) %+ turn p.gen - |= gen/hoon + |= gen=hoon ?. ?=(^ -.gen) =/ gen ~(open ap gen) ?: =(gen ^gen) ~|([%bad-frontmatter-elem -.gen] !!) @@ -54,8 +54,8 @@ [q.hed (as-dime q.gen)] :: ++ as-dime :: %foo ~.foo 0vbar etc - |= gen/hoon ^- dime - ?: ?=($dbug -.gen) $(gen q.gen) - ?. ?=({?($rock $sand) @ @} gen) ~|([%bad-literal gen] !!) + |= gen=hoon ^- dime + ?: ?=(%dbug -.gen) $(gen q.gen) + ?. ?=([?(%rock %sand) @ @] gen) ~|([%bad-literal gen] !!) +.gen -- diff --git a/pkg/arvo/lib/der.hoon b/pkg/arvo/lib/der.hoon index f20c32d34..9b3876b40 100644 --- a/pkg/arvo/lib/der.hoon +++ b/pkg/arvo/lib/der.hoon @@ -175,7 +175,7 @@ :: advance until :: ++ till - |= tub/nail + |= tub=nail ^- (like (list @D)) ?~ q.tub (fail tub) diff --git a/pkg/arvo/lib/elem-to-react-json.hoon b/pkg/arvo/lib/elem-to-react-json.hoon index da742e1bf..77b4b1ca2 100644 --- a/pkg/arvo/lib/elem-to-react-json.hoon +++ b/pkg/arvo/lib/elem-to-react-json.hoon @@ -9,7 +9,7 @@ ~+ ^- (map term cord) %- molt ^- (list (pair term cord)) :- [%class 'className'] - =- (rash - (more next (cook |=(a/tape [(crip (cass a)) (crip a)]) (star alf)))) + =- (rash - (more next (cook |=(a=tape [(crip (cass a)) (crip a)]) (star alf)))) ''' accept acceptCharset accessKey action allowFullScreen allowTransparency alt async autoComplete autoFocus autoPlay cellPadding cellSpacing charSet checked @@ -27,12 +27,12 @@ :: :: special handling for
foo
++ urb-codemirror :: render code blocks - |= src/manx ^- manx - ?> ?=({{$pre *} _;/(**) ~} src) + |= src=manx ^- manx + ?> ?=([[%pre *] _;/(**) ~] src) ;codemirror(value "{v.i.a.g.i.c.src}"); :: ++ elem-to-react-json :: serialize DOM as json - |= src/manx ^- json + |= src=manx ^- json ?: ?=(_;/(**) src) (tape:enjs v.i.a.g.src) =+ atr=(molt `(list (pair mane tape))`a.g.src) @@ -42,14 +42,14 @@ c+a+(turn c.src ..$) gn+s+(mane-to-cord n.g.src) =< ga+(pairs:enjs (turn a.g.src .)) - |= {a/mane b/tape} ^- {cord json} + |= [a=mane b=tape] ^- [cord json] :_ (tape:enjs b) ?^ a (mane-to-cord a) (~(gut by react-attrs) a a) == :: ++ mane-to-cord :: namespaced xml names - |=(a/mane `cord`?@(a a (rap 3 -.a ':' +.a ~))) + |=(a=mane `cord`?@(a a (rap 3 -.a ':' +.a ~))) -- :: :::: diff --git a/pkg/arvo/lib/frontmatter.hoon b/pkg/arvo/lib/frontmatter.hoon index 8fb7009b6..f74f18d10 100644 --- a/pkg/arvo/lib/frontmatter.hoon +++ b/pkg/arvo/lib/frontmatter.hoon @@ -6,19 +6,19 @@ =, format |% ++ atr-lines - |= atr/(map cord cord) - %+ turn (sort ~(tap by atr) |=({{a/@ @} {b/@ @}} (aor a b))) - |= {k/cord v/cord} + |= atr=(map cord cord) + %+ turn (sort ~(tap by atr) |=([[a=@ @] [b=@ @]] (aor a b))) + |= [k=cord v=cord] (rap 3 k ': ' v ~) :: ++ atr-key ;~(sfix (star ;~(less col prn)) col ace) ++ print - |= {atr/(map cord cord) src/wain} + |= [atr=(map cord cord) src=wain] ?~ atr src ['---' (welp (atr-lines atr) '---' src)] ++ parse - =| atr/(map cord cord) - |= wan/wain ^+ [atr mud=''] + =| atr=(map cord cord) + |= wan=wain ^+ [atr mud=''] ?~ wan [~ ''] ?^ (rush i.wan (star ace)) $(wan t.wan) @@ -30,6 +30,6 @@ $(wan t.wan) =- $(wan t.wan, atr (~(put by atr) (crip key) (crip val))) ~| malformed-attribute+i.t.wan - ^- {key/tape ^ val/tape} + ^- [key=tape ^ val=tape] +>:(atr-key 1^1 (trip i.t.wan)) -- diff --git a/pkg/arvo/lib/generators.hoon b/pkg/arvo/lib/generators.hoon index 082d229ba..e40714b7f 100644 --- a/pkg/arvo/lib/generators.hoon +++ b/pkg/arvo/lib/generators.hoon @@ -2,21 +2,21 @@ =, sole |% ++ produce :: construct result - |* pro/* :: + |* pro=* :: [p=*(list tank) q=[%& p=[~ u=pro]]] :: :: :: ++ print :: add output tank - |* {tan/tank res/(sole-result)} :: + |* [tan=tank res=(sole-result)] :: ?@ res res :: [p=[i=tan t=p.res] q=q.res] :: :: :: ++ prompt :: construct prompt - |* {pom/sole-prompt mor/(sole-dialog)} :: + |* [pom=sole-prompt mor=(sole-dialog)] :: [p=*(list tank) q=[%| p=pom q=mor]] :: :: :: ++ curl :: fetch url - =| usr/knot :: - |* {pul/_purl:eyre fun/$-(httr:eyre *)} :: + =| usr=knot :: + |* [pul=_purl:eyre fun=$-(httr:eyre *)] :: :- p=*(list tank) :: q=[%| p=`usr q=[pul %get ~ ~] r=fun] :: :: :: @@ -24,10 +24,10 @@ [p=*(list tank) q=[%& ~]] :: :: :: ++ parse :: parse by rule - |* {sef/rule fun/$-(* *)} :: - |= txt/sole-input :: + |* [sef=rule fun=$-(* *)] :: + |= txt=sole-input :: =+ vex=(sef [0 0] txt) :: - ?: |(!=((lent txt) q.p.vex) ?=($~ q.vex)) :: + ?: |(!=((lent txt) q.p.vex) ?=(~ q.vex)) :: q.p.vex :: (fun p.u.q.vex) :: -- diff --git a/pkg/arvo/lib/graph-store.hoon b/pkg/arvo/lib/graph-store.hoon index a6055bb10..3b64e9b8c 100644 --- a/pkg/arvo/lib/graph-store.hoon +++ b/pkg/arvo/lib/graph-store.hoon @@ -7,13 +7,13 @@ |% :: NOTE: move these functions to zuse ++ nu :: parse number as hex - |= jon/json - ?> ?=({$s *} jon) + |= jon=json + ?> ?=([%s *] jon) (rash p.jon hex) :: ++ re :: recursive reparsers - |* {gar/* sef/_|.(fist:dejs-soft:format)} - |= jon/json + |* [gar=* sef=_|.(fist:dejs-soft:format)] + |= jon=json ^- (unit _gar) =- ~! gar ~! (need -) - ((sef) jon) @@ -319,7 +319,7 @@ ++ post %- ot :~ [%author (su ;~(pfix sig fed:ag))] - [%index index] + [%index index] [%time-sent di] [%contents (ar content)] [%hash (mu nu)] @@ -375,7 +375,7 @@ ++ uid %- ot :~ [%resource dejs:res] - [%index index] + [%index index] == :: ++ index (su ;~(pfix fas (more fas dem))) diff --git a/pkg/arvo/lib/group-json.hoon b/pkg/arvo/lib/group-json.hoon deleted file mode 100644 index da42dbc18..000000000 --- a/pkg/arvo/lib/group-json.hoon +++ /dev/null @@ -1,18 +0,0 @@ -/- *group-store -|% -++ groups-to-json - |= grp=groups - ^- json - =, enjs:format - %- pairs - %+ turn ~(tap by grp) - |= [pax=^path =group] - ^- [@t json] - :- (spat pax) - (set-to-array group ship:enjs:format) -:: -++ set-to-array - |* {a/(set) b/$-(* json)} - ^- json - [%a (turn ~(tap in a) b)] --- diff --git a/pkg/arvo/lib/group-store.hoon b/pkg/arvo/lib/group-store.hoon index 56e663301..07e28fdc0 100644 --- a/pkg/arvo/lib/group-store.hoon +++ b/pkg/arvo/lib/group-store.hoon @@ -295,7 +295,7 @@ |= [a=(map @t json) b=$-(@t @t)] ^+ a =- (malt -) - |- + |- ^- (list [@t json]) ?~ a ~ :- [(b p.n.a) q.n.a] @@ -304,13 +304,13 @@ $(a r.a) :: ++ of - |* wer/(pole {cord fist}) - |= jon/json - ?> ?=({$o {@ *} $~ $~} jon) + |* wer=(pole [cord fist]) + |= jon=json + ?> ?=([%o [@ *] ~ ~] jon) |- - ?- wer - :: {{key/@t wit/*} t/*} - {{key/@t *} t/*} + ?- wer + :: [[key=@t wit=*] t=*] + [[key=@t *] t=*] => .(wer [[* wit] *]=wer) ?: =(key.wer (enkebab p.n.p.jon)) [key.wer ~|(val+q.n.p.jon (wit.wer q.n.p.jon))] diff --git a/pkg/arvo/lib/hark/graph-hook.hoon b/pkg/arvo/lib/hark/graph-hook.hoon index d379236ff..31361a72a 100644 --- a/pkg/arvo/lib/hark/graph-hook.hoon +++ b/pkg/arvo/lib/hark/graph-hook.hoon @@ -10,7 +10,7 @@ :: ++ index ^- $-(json index:graph-store) - (su ;~(pfix net (more net dem))) + (su ;~(pfix fas (more fas dem))) :: ++ graph-index %- ot diff --git a/pkg/arvo/lib/hood/drum.hoon b/pkg/arvo/lib/hood/drum.hoon index 84ddfa0f7..16b78562d 100644 --- a/pkg/arvo/lib/hood/drum.hoon +++ b/pkg/arvo/lib/hood/drum.hoon @@ -5,49 +5,49 @@ +$ state [%2 pith-2] :: ++ pith-2 :: - $: eel/(set gill:gall) :: connect to - ray/(set well:gall) :: - fur/(map dude:gall (unit server)) :: servers - bin/(map bone source) :: terminals + $: eel=(set gill:gall) :: connect to + ray=(set well:gall) :: + fur=(map dude:gall (unit server)) :: servers + bin=(map bone source) :: terminals == :: :: :: ++ server :: running server - $: syd/desk :: app identity - cas/case :: boot case + $: syd=desk :: app identity + cas=case :: boot case == :: ++ kill :: kill ring - $: pos/@ud :: ring position - num/@ud :: number of entries - max/_60 :: max entries - old/(list (list @c)) :: entries proper + $: pos=@ud :: ring position + num=@ud :: number of entries + max=_60 :: max entries + old=(list (list @c)) :: entries proper == :: ++ source :: input device - $: edg/_80 :: terminal columns - off/@ud :: window offset - kil/kill :: kill buffer - inx/@ud :: ring index - fug/(map gill:gall (unit target)) :: connections - mir/(pair @ud stub) :: mirrored terminal + $: edg=_80 :: terminal columns + off=@ud :: window offset + kil=kill :: kill buffer + inx=@ud :: ring index + fug=(map gill:gall (unit target)) :: connections + mir=(pair @ud stub) :: mirrored terminal == :: ++ history :: past input - $: pos/@ud :: input position - num/@ud :: number of entries - lay/(map @ud (list @c)) :: editing overlay - old/(list (list @c)) :: entries proper + $: pos=@ud :: input position + num=@ud :: number of entries + lay=(map @ud (list @c)) :: editing overlay + old=(list (list @c)) :: entries proper == :: ++ search :: reverse-i-search - $: pos/@ud :: search position - str/(list @c) :: search string + $: pos=@ud :: search position + str=(list @c) :: search string == :: ++ target :: application target $: $= blt :: curr & prev belts %+ pair (unit dill-belt:dill) (unit dill-belt:dill) - ris/(unit search) :: reverse-i-search - hit/history :: all past input - pom/sole-prompt :: static prompt - inp/sole-command :: input state + ris=(unit search) :: reverse-i-search + hit=history :: all past input + pom=sole-prompt :: static prompt + inp=sole-command :: input state == :: -- :: :: :: @@ -144,14 +144,14 @@ +$ any-state ^any-state :: proxy ++ on-init se-abet:this(eel (deft-fish our.hid)) ++ diff-sole-effect-phat :: app event - |= {way/wire fec/sole-effect} + |= [way=wire fec=sole-effect] =< se-abet =< se-view =+ gyl=(de-gill way) ?: (se-aint gyl) +>.$ (se-diff gyl fec) :: ++ peer :: - |= pax/path + |= pax=path ~| [%drum-unauthorized our+our.hid src+src.hid] :: ourself ?> (team:title our.hid src.hid) :: or our own moon =< se-abet =< se-view @@ -169,26 +169,31 @@ [~ sat] :: ++ poke-dill-belt :: terminal event - |= bet/dill-belt:dill + |= bet=dill-belt:dill =< se-abet =< se-view (se-belt bet) :: ++ poke-dill-blit :: terminal output - |= bit/dill-blit:dill + |= bit=dill-blit:dill se-abet:(se-blit-sys bit) :: ++ poke-start :: start app - |= wel/well:gall + |= wel=well:gall =< se-abet =< se-view (se-born & wel) :: +++ poke-fade :: fade app + |= wel=well:gall + =< se-abet =< se-view + (se-fade wel) +:: ++ poke-link :: connect app - |= gyl/gill:gall + |= gyl=gill:gall =< se-abet =< se-view (se-link gyl) :: ++ poke-unlink :: disconnect app - |= gyl/gill:gall + |= gyl=gill:gall =< se-abet =< se-view (se-drop:(se-pull gyl) & gyl) :: @@ -197,7 +202,7 @@ se-abet:(se-blit-sys `dill-blit:dill`[%qit ~]) :: ++ poke-put :: write file - |= {pax/path txt/@} + |= [pax=path txt=@] se-abet:(se-blit-sys [%sav pax txt]) :: :: ++ poke @@ -210,6 +215,7 @@ %drum-put =;(f (f !<(_+<.f vase)) poke-put) %drum-set-boot-apps =;(f (f !<(_+<.f vase)) poke-set-boot-apps) %drum-start =;(f (f !<(_+<.f vase)) poke-start) + %drum-fade =;(f (f !<(_+<.f vase)) poke-fade) %drum-unlink =;(f (f !<(_+<.f vase)) poke-unlink) == :: @@ -256,7 +262,7 @@ ..on-load :: ++ reap-phat :: ack connect - |= {way/wire saw/(unit tang)} + |= [way=wire saw=(unit tang)] =< se-abet =< se-view =+ gyl=(de-gill way) ?~ saw @@ -273,7 +279,7 @@ +>.sign-arvo :: ++ take-coup-phat :: ack poke - |= {way/wire saw/(unit tang)} + |= [way=wire saw=(unit tang)] =< se-abet =< se-view ?~ saw +> =+ gyl=(de-gill way) @@ -283,14 +289,14 @@ >[%drum-coup-fail src.hid gyl]< :: ++ take-onto :: ack start - |= {way/wire saw/(each suss:gall tang)} + |= [way=wire saw=(each suss:gall tang)] =< se-abet =< se-view - ?> ?=({@ @ ~} way) + ?> ?=([@ @ ~] way) ?> (~(has by fur) i.t.way) - =/ wel/well:gall [i.way i.t.way] + =/ wel=well:gall [i.way i.t.way] ?- saw - {%| *} (se-dump p.saw) - {%& *} ?> =(q.wel p.p.saw) + [%| *] (se-dump p.saw) + [%& *] ?> =(q.wel p.p.saw) :: =. +>.$ (se-text "live {}") +>.$(fur (~(put by fur) q.wel `[p.wel %da r.p.saw])) == @@ -311,7 +317,7 @@ == :: ++ quit-phat :: - |= way/wire + |= way=wire =< se-abet =< se-view =+ gyl=(de-gill way) ~& [%drum-quit src.hid gyl] @@ -321,7 +327,7 @@ :: :: :: ++ se-abet :: resolve ^- (quip card:agent:gall state) - =. . se-subze:se-adze:se-adit + =. . se-subze:se-adze:se-subit:se-adit :_ sat(bin (~(put by bin) ost dev)) ^- (list card:agent:gall) ?~ biz (flop moz) @@ -386,6 +392,17 @@ $(priorities t.priorities) -- :: +++ se-subit :: downdate servers + =/ ruf=(list term) ~(tap in ~(key by fur)) + |- ^+ this + ?~ ruf + this + ?: (~(has in ray) [%home i.ruf]) + $(ruf t.ruf) + =/ wire [%drum %fade i.ruf ~] + =. this (se-emit %pass wire %arvo %g %fade i.ruf %slay) + $(ruf t.ruf, fur (~(del by fur) i.ruf)) +:: ++ se-adze :: update connections ^+ . %+ roll @@ -396,7 +413,7 @@ ?: =(b %dojo) %.y (aor a b) =< .(con +>) - |: $:{gil/gill:gall con/_.} ^+ con + |: $:,[gil=gill:gall con=_.] ^+ con =. +>.$ con ?: (~(has by fug) gil) +>.$ @@ -408,7 +425,7 @@ ^+ . %- ~(rep by bin) =< .(con +>) - |: $:{{ost/bone dev/source} con/_.} ^+ con + |: $:,[[ost=bone dev=source] con=_.] ^+ con =+ xeno=se-subze-local:%_(con ost ost, dev dev) xeno(ost ost.con, dev dev.con, bin (~(put by bin) ost dev.xeno)) :: @@ -416,21 +433,21 @@ ^+ . %- ~(rep by fug) =< .(con +>) - |: $:{{gil/gill:gall *} con/_.} ^+ con + |: $:,[[gil=gill:gall *] con=_.] ^+ con =. +>.$ con ?: (~(has in eel) gil) +>.$ (se-nuke gil) :: ++ se-aint :: ignore result - |= gyl/gill:gall + |= gyl=gill:gall ^- ? ?. (~(has by bin) ost) & =+ gyr=(~(get by fug) gyl) |(?=(~ gyr) ?=(~ u.gyr)) :: ++ se-alas :: recalculate index - |= gyl/gill:gall + |= gyl=gill:gall =+ [xin=0 wag=se-amor] |- ^+ +>.^$ ?~ wag +>.^$(inx 0) @@ -440,7 +457,7 @@ ++ se-amor :: live targets ^- (list gill:gall) %+ skim ~(tap in eel) - |=(a/gill:gall ?=({~ ~ *} (~(get by fug) a))) + |=(a=gill:gall ?=([~ ~ *] (~(get by fug) a))) :: ++ se-anon :: rotate index =+ wag=se-amor @@ -456,14 +473,14 @@ `(snag inx `(list gill:gall)`wag) :: ++ se-belt :: handle input - |= bet/dill-belt:dill + |= bet=dill-belt:dill ^+ +> - ?: ?=({?($cru $hey $rez $yow) *} bet) :: target-agnostic + ?: ?=([?(%cru %hey %rez %yow) *] bet) :: target-agnostic ?- bet - {$cru *} (se-dump:(se-text (trip p.bet)) q.bet) - {$hey *} +>(mir [0 ~]) :: refresh - {$rez *} +>(edg (dec p.bet)) :: resize window - {$yow *} ~&([%no-yow -.bet] +>) + [%cru *] (se-dump:(se-text (trip p.bet)) q.bet) + [%hey *] +>(mir [0 ~]) :: refresh + [%rez *] +>(edg (dec p.bet)) :: resize window + [%yow *] ~&([%no-yow -.bet] +>) == =+ gul=se-agon ?: |(?=(~ gul) (se-aint u.gul)) @@ -481,8 +498,17 @@ eel (~(put in eel) [our.hid q.wel]) == :: +++ se-fade :: delete server + |= wel=well:gall + ^+ +> + ?. (~(has in ray) wel) + (se-text "[fade not running {}/{}]") + %= +> + ray (~(del in ray) wel) + == +:: ++ se-drop :: disconnect - |= {pej/? gyl/gill:gall} + |= [pej=? gyl=gill:gall] ^+ +> =+ lag=se-agon ?. (~(has by fug) gyl) +>.$ @@ -497,7 +523,7 @@ +>.$ :: ++ se-tab :: print tab completions - |= tl/(list {=cord =tank}) + |= tl=(list [=cord =tank]) ^+ +> =/ lots (gth (lent tl) 10) =/ long @@ -526,10 +552,10 @@ leaf+tape :: ++ se-dump :: print tanks - |= tac/(list tank) + |= tac=(list tank) ^+ +> - =/ wol/wall - (zing (turn (flop tac) |=(a/tank (~(win re a) [0 edg])))) + =/ wol=wall + (zing (turn (flop tac) |=(a=tank (~(win re a) [0 edg])))) |- ^+ +>.^$ ?~ wol +>.^$ ?. ((sane %t) (crip i.wol)) :: XX upstream validation @@ -538,35 +564,35 @@ $(wol t.wol, +>.^$ (se-blit %out (tuba i.wol))) :: ++ se-join :: confirm connection - |= gyl/gill:gall + |= gyl=gill:gall ^+ +> =. +> (se-text "[linked to {}]") ?> ?=(~ (~(got by fug) gyl)) (se-alas(fug (~(put by fug) gyl `*target)) gyl) :: ++ se-nuke :: teardown connection - |= gyl/gill:gall + |= gyl=gill:gall ^+ +> (se-drop:(se-pull gyl) & gyl) :: ++ se-klin :: disconnect app - |= gyl/gill:gall + |= gyl=gill:gall +>(eel (~(del in eel) gyl)) :: ++ se-link :: connect to app - |= gyl/gill:gall + |= gyl=gill:gall +>(eel (~(put in eel) gyl)) :: ++ se-blit :: give output - |= bil/dill-blit:dill + |= bil=dill-blit:dill +>(biz [bil biz]) :: ++ se-blit-sys :: output to system - |= bil/dill-blit:dill ^+ +> + |= bil=dill-blit:dill ^+ +> (se-emit %give %fact ~[/drum] %dill-blit !>(bil)) :: ++ se-show :: show buffer, raw - |= lin/(pair @ud stub) + |= lin=(pair @ud stub) ^+ +> ?: =(mir lin) +> =. +> ?:(=(p.mir p.lin) +> (se-blit %hop p.lin)) @@ -574,7 +600,7 @@ +>(mir lin) :: ++ se-just :: adjusted buffer - |= {pom/stub lin/(pair @ud (list @c))} + |= [pom=stub lin=(pair @ud (list @c))] ^+ +> =/ pol (lent-char:klr pom) =/ pos (add pol p.lin) @@ -604,7 +630,7 @@ %_(+> moz [+< moz]) :: ++ se-text :: return text - |= txt/tape + |= txt=tape ^+ +> ?. ((sane %t) (crip txt)) :: XX upstream validation ~& bad-text+<`*`txt> @@ -612,82 +638,82 @@ (se-blit %out (tuba txt)) :: ++ se-poke :: send a poke - |= {gyl/gill:gall par/cage} + |= [gyl=gill:gall par=cage] (se-emit %pass (en-gill gyl) %agent gyl %poke par) :: ++ se-peer :: send a peer - |= gyl/gill:gall + |= gyl=gill:gall =/ =path /sole/(cat 3 'drum_' (scot %p our.hid)) %- se-emit(fug (~(put by fug) gyl ~)) [%pass (en-gill gyl) %agent gyl %watch path] :: ++ se-pull :: cancel subscription - |= gyl/gill:gall + |= gyl=gill:gall (se-emit %pass (en-gill gyl) %agent gyl %leave ~) :: ++ se-tame :: switch connection - |= gyl/gill:gall + |= gyl=gill:gall ^+ ta ~(. ta gyl (need (~(got by fug) gyl))) :: ++ se-diff :: receive results - |= {gyl/gill:gall fec/sole-effect} + |= [gyl=gill:gall fec=sole-effect] ^+ +> ta-abet:(ta-fec:(se-tame gyl) fec) :: ++ ta :: per target - |_ {gyl/gill:gall target} :: app and state + |_ [gyl=gill:gall target] :: app and state ++ ta-abet :: resolve ^+ ..ta ..ta(fug (~(put by fug) gyl ``target`+<+)) :: - ++ ta-poke |=(a/cage +>(..ta (se-poke gyl a))) :: poke gyl + ++ ta-poke |=(a=cage +>(..ta (se-poke gyl a))) :: poke gyl :: ++ ta-act :: send action - |= act/sole-action + |= act=sole-action ^+ +> (ta-poke %sole-action !>(act)) :: ++ ta-id (cat 3 'drum_' (scot %p our.hid)) :: per-ship duct id :: ++ ta-aro :: hear arrow - |= key/?($d $l $r $u) + |= key=?(%d %l %r %u) ^+ +> =. ris ~ ?- key - $d ?. =(num.hit pos.hit) + %d ?. =(num.hit pos.hit) (ta-mov +(pos.hit)) ?: =(0 (lent buf.say.inp)) ta-bel (ta-hom:ta-nex %set ~) - $l ?: =(0 pos.inp) ta-bel + %l ?: =(0 pos.inp) ta-bel +>(pos.inp (dec pos.inp)) - $r ?: =((lent buf.say.inp) pos.inp) + %r ?: =((lent buf.say.inp) pos.inp) ta-bel +>(pos.inp +(pos.inp)) - $u ?:(=(0 pos.hit) ta-bel (ta-mov (dec pos.hit))) + %u ?:(=(0 pos.hit) ta-bel (ta-mov (dec pos.hit))) == :: ++ ta-bel :: beep .(..ta (se-blit %bel ~), q.blt ~) :: forget belt :: ++ ta-belt :: handle input - |= bet/dill-belt:dill + |= bet=dill-belt:dill ^+ +> - ?< ?=({?($cru $hey $rez $yow) *} bet) :: target-specific + ?< ?=([?(%cru %hey %rez %yow) *] bet) :: target-specific =. blt [q.blt `bet] :: remember belt ?- bet - {$aro *} (ta-aro p.bet) - {$bac *} ta-bac - {$ctl *} (ta-ctl p.bet) - {$del *} ta-del - {$met *} (ta-met p.bet) - {$ret *} ta-ret - {$txt *} (ta-txt p.bet) + [%aro *] (ta-aro p.bet) + [%bac *] ta-bac + [%ctl *] (ta-ctl p.bet) + [%del *] ta-del + [%met *] (ta-met p.bet) + [%ret *] ta-ret + [%txt *] (ta-txt p.bet) == :: ++ ta-det :: send edit - |= ted/sole-edit + |= ted=sole-edit ^+ +> %^ ta-act ta-id @@ -707,50 +733,50 @@ (ta-hom %del (dec pos.inp)) :: ++ ta-ctl :: hear control - |= key/@ud + |= key=@ud ^+ +> - =. ris ?.(?=(?($g $r) key) ~ ris) + =. ris ?.(?=(?(%g %r) key) ~ ris) ?+ key ta-bel - $a +>(pos.inp 0) - $b (ta-aro %l) - $c ta-bel - $d ?^ buf.say.inp + %a +>(pos.inp 0) + %b (ta-aro %l) + %c ta-bel + %d ?^ buf.say.inp ta-del ?: (~(has in (deft-fish our.hid)) gyl) +>(..ta (se-blit qit+~)) :: quit pier +>(..ta (se-klin gyl)) :: unlink app - $e +>(pos.inp (lent buf.say.inp)) - $f (ta-aro %r) - $g ?~ ris ta-bel + %e +>(pos.inp (lent buf.say.inp)) + %f (ta-aro %r) + %g ?~ ris ta-bel (ta-hom(pos.hit num.hit, ris ~) [%set ~]) - $i ta-tab - $k =+ len=(lent buf.say.inp) + %i ta-tab + %k =+ len=(lent buf.say.inp) ?: =(pos.inp len) ta-bel (ta-kil %r [pos.inp (sub len pos.inp)]) - $l +>(..ta (se-blit %clr ~)) - $n (ta-aro %d) - $p (ta-aro %u) - $r ?~ ris + %l +>(..ta (se-blit %clr ~)) + %n (ta-aro %d) + %p (ta-aro %u) + %r ?~ ris +>(ris `[pos.hit ~]) ?: =(0 pos.u.ris) ta-bel (ta-ser ~) - $t =+ len=(lent buf.say.inp) + %t =+ len=(lent buf.say.inp) ?: |(=(0 pos.inp) (lth len 2)) ta-bel =+ sop=(sub pos.inp ?:(=(len pos.inp) 2 1)) (ta-hom (rep:edit [sop 2] (flop (swag [sop 2] buf.say.inp)))) - $u ?: =(0 pos.inp) + %u ?: =(0 pos.inp) ta-bel (ta-kil %l [0 pos.inp]) - $v ta-bel - $w ?: =(0 pos.inp) + %v ta-bel + %w ?: =(0 pos.inp) ta-bel =+ sop=(ta-pos %l %ace pos.inp) (ta-kil %l [(sub pos.inp sop) sop]) - $x +>(..ta se-anon) - $y ?: =(0 num.kil) + %x +>(..ta se-anon) + %y ?: =(0 num.kil) ta-bel (ta-hom (cat:edit pos.inp ta-yan)) == @@ -762,78 +788,78 @@ (ta-hom %del pos.inp) :: ++ ta-erl :: hear local error - |= pos/@ud + |= pos=@ud ta-bel(pos.inp (min pos (lent buf.say.inp))) :: ++ ta-err :: hear remote error - |= pos/@ud + |= pos=@ud (ta-erl (~(transpose sole say.inp) pos)) :: ++ ta-fec :: apply effect - |= fec/sole-effect + |= fec=sole-effect ^+ +> ?- fec - {$bel *} ta-bel - {$blk *} +> - {$clr *} +>(..ta (se-blit fec)) - {$det *} (ta-got +.fec) - {$err *} (ta-err p.fec) - {$klr *} +>(..ta (se-blit %klr (make:klr p.fec))) - {$mor *} |- ^+ +>.^$ + [%bel *] ta-bel + [%blk *] +> + [%clr *] +>(..ta (se-blit fec)) + [%det *] (ta-got +.fec) + [%err *] (ta-err p.fec) + [%klr *] +>(..ta (se-blit %klr (make:klr p.fec))) + [%mor *] |- ^+ +>.^$ ?~ p.fec +>.^$ $(p.fec t.p.fec, +>.^$ ^$(fec i.p.fec)) - {$nex *} ta-nex - {$pro *} (ta-pro +.fec) - {$tab *} +>(..ta (se-tab p.fec)) - {$tan *} +>(..ta (se-dump p.fec)) - {$sag *} +>(..ta (se-blit fec)) - {$sav *} +>(..ta (se-blit fec)) - {$txt *} +>(..ta (se-text p.fec)) - {$url *} +>(..ta (se-blit fec)) + [%nex *] ta-nex + [%pro *] (ta-pro +.fec) + [%tab *] +>(..ta (se-tab p.fec)) + [%tan *] +>(..ta (se-dump p.fec)) + [%sag *] +>(..ta (se-blit fec)) + [%sav *] +>(..ta (se-blit fec)) + [%txt *] +>(..ta (se-text p.fec)) + [%url *] +>(..ta (se-blit fec)) == :: ++ ta-dog :: change cursor - |= ted/sole-edit + |= ted=sole-edit %_ +> pos.inp =+ len=(lent buf.say.inp) %+ min len |- ^- @ud ?- ted - {$del *} ?:((gth pos.inp p.ted) (dec pos.inp) pos.inp) - {$ins *} ?:((gte pos.inp p.ted) +(pos.inp) pos.inp) - {$mor *} |- ^- @ud + [%del *] ?:((gth pos.inp p.ted) (dec pos.inp) pos.inp) + [%ins *] ?:((gte pos.inp p.ted) +(pos.inp) pos.inp) + [%mor *] |- ^- @ud ?~ p.ted pos.inp $(p.ted t.p.ted, pos.inp ^$(ted i.p.ted)) - {$nop *} pos.inp - {$set *} len + [%nop *] pos.inp + [%set *] len == == :: ++ ta-off :: reset buffer offset - |= ted/sole-edit - =? off (any:edit ted |=(a/sole-edit ?=($set -.a))) 0 + |= ted=sole-edit + =? off (any:edit ted |=(a=sole-edit ?=(%set -.a))) 0 +> :: ++ ta-got :: apply change - |= cal/sole-change + |= cal=sole-change =^ ted say.inp (~(receive sole say.inp) cal) (ta-dog:(ta-off ted.cal) ted) :: ++ ta-hom :: local edit - |= ted/sole-edit + |= ted=sole-edit ^+ +> =. +> (ta-det:(ta-off ted) ted) (ta-dog(say.inp (~(commit sole say.inp) ted)) ted) :: ++ ta-jump :: buffer pos - |= {dir/?($l $r) til/?($ace $edg $wrd) pos/@ud} + |= [dir=?(%l %r) til=?(%ace %edg %wrd) pos=@ud] ^- @ud - %- ?:(?=($l dir) sub add) + %- ?:(?=(%l dir) sub add) [pos (ta-pos dir til pos)] :: ++ ta-kil :: kill selection - |= {dir/?($l $r) sel/{@ @}} + |= [dir=?(%l %r) sel=[@ @]] ^+ +> =+ buf=(swag sel buf.say.inp) %. (cut:edit sel) @@ -841,8 +867,8 @@ kil ?. ?& ?=(^ old.kil) ?=(^ p.blt) - ?| ?=({$ctl ?($k $u $w)} u.p.blt) - ?=({$met ?($d $bac)} u.p.blt) + ?| ?=([%ctl ?(%k %u %w)] u.p.blt) + ?=([%met ?(%d %bac)] u.p.blt) == == %= kil :: prepend num +(num.kil) @@ -853,32 +879,32 @@ pos num.kil old :_ t.old.kil ?- dir - $l (welp buf i.old.kil) - $r (welp i.old.kil buf) + %l (welp buf i.old.kil) + %r (welp i.old.kil buf) == == == :: ++ ta-met :: meta key - |= key/@ud + |= key=@ud ^+ +> =. ris ~ ?+ key ta-bel - $dot ?. &(?=(^ old.hit) ?=(^ i.old.hit)) :: last "arg" from hist + %dot ?. &(?=(^ old.hit) ?=(^ i.old.hit)) :: last "arg" from hist ta-bel =+ old=`(list @c)`i.old.hit =+ sop=(ta-jump(buf.say.inp old) %l %ace (lent old)) (ta-hom (cat:edit pos.inp (slag sop old))) :: - $bac ?: =(0 pos.inp) :: kill left-word + %bac ?: =(0 pos.inp) :: kill left-word ta-bel =+ sop=(ta-pos %l %edg pos.inp) (ta-kil %l [(sub pos.inp sop) sop]) :: - $b ?: =(0 pos.inp) :: jump left-word + %b ?: =(0 pos.inp) :: jump left-word ta-bel +>(pos.inp (ta-jump %l %edg pos.inp)) :: - $c ?: =(pos.inp (lent buf.say.inp)) :: capitalize + %c ?: =(pos.inp (lent buf.say.inp)) :: capitalize ta-bel =+ sop=(ta-jump %r %wrd pos.inp) %- ta-hom(pos.inp (ta-jump %r %edg sop)) @@ -886,20 +912,20 @@ ^- (list @c) ^- (list @) :: XX unicode (cuss `tape``(list @)`(swag [sop 1] buf.say.inp)) :: - $d ?: =(pos.inp (lent buf.say.inp)) :: kill right-word + %d ?: =(pos.inp (lent buf.say.inp)) :: kill right-word ta-bel (ta-kil %r [pos.inp (ta-pos %r %edg pos.inp)]) :: - $f ?: =(pos.inp (lent buf.say.inp)) :: jump right-word + %f ?: =(pos.inp (lent buf.say.inp)) :: jump right-word ta-bel +>(pos.inp (ta-jump %r %edg pos.inp)) :: - $r %- ta-hom(lay.hit (~(put by lay.hit) pos.hit ~)) + %r %- ta-hom(lay.hit (~(put by lay.hit) pos.hit ~)) :- %set :: revert hist edit ?: =(pos.hit num.hit) ~ (snag (sub num.hit +(pos.hit)) old.hit) :: - $t =+ a=(ta-jump %r %edg pos.inp) :: transpose words + %t =+ a=(ta-jump %r %edg pos.inp) :: transpose words =+ b=(ta-jump %l %edg a) =+ c=(ta-jump %l %edg b) ?: =(b c) @@ -912,10 +938,10 @@ (rep:edit prev (swag next buf.say.inp)) == :: - ?($u $l) :: upper/lower case + ?(%u %l) :: upper/lower case ?: =(pos.inp (lent buf.say.inp)) ta-bel - =+ case=?:(?=($u key) cuss cass) + =+ case=?:(?=(%u key) cuss cass) =+ sop=(ta-jump %r %wrd pos.inp) =+ sel=[sop (ta-pos %r %edg sop)] %- ta-hom @@ -923,10 +949,10 @@ ^- (list @c) ^- (list @) :: XX unicode (case `tape``(list @)`(swag sel buf.say.inp)) :: - $y ?. ?& ?=(^ old.kil) :: rotate & yank + %y ?. ?& ?=(^ old.kil) :: rotate & yank ?=(^ p.blt) - ?| ?=({$ctl $y} u.p.blt) - ?=({$met $y} u.p.blt) + ?| ?=([%ctl %y] u.p.blt) + ?=([%met %y] u.p.blt) == == ta-bel =+ las=(lent ta-yan) @@ -935,7 +961,7 @@ == :: ++ ta-mov :: move in history - |= sop/@ud + |= sop=@ud ^+ +> ?: =(sop pos.hit) +> %- %= ta-hom @@ -961,24 +987,24 @@ == :: ++ ta-pos :: buffer pos offset - |= {dir/?($l $r) til/?($ace $edg $wrd) pos/@ud} + |= [dir=?(%l %r) til=?(%ace %edg %wrd) pos=@ud] ^- @ud - %- ?- til $ace ace:offset - $edg edg:offset - $wrd wrd:offset + %- ?- til %ace ace:offset + %edg edg:offset + %wrd wrd:offset == - ?- dir $l (flop (scag pos buf.say.inp)) - $r (slag pos buf.say.inp) + ?- dir %l (flop (scag pos buf.say.inp)) + %r (slag pos buf.say.inp) == :: ++ ta-pro :: set prompt - |= pom/sole-prompt + |= pom=sole-prompt %_ +> pom %_ pom cad ;: welp - ?. ?=($earl (clan:title p.gyl)) + ?. ?=(%earl (clan:title p.gyl)) (cite:title p.gyl) (scow %p p.gyl) :: @@ -996,7 +1022,7 @@ (ta-act ta-id %tab pos.inp) :: ++ ta-ser :: reverse search - |= ext/(list @c) + |= ext=(list @c) ^+ +> ?: |(?=(~ ris) =(0 pos.u.ris)) ta-bel @@ -1013,15 +1039,15 @@ (ta-mov(str.u.ris tot, pos.u.ris u.sup) (dec u.sup)) :: ++ ta-txt :: hear text - |= txt/(list @c) + |= txt=(list @c) ^+ +> ?^ ris (ta-ser txt) (ta-hom (cat:edit pos.inp txt)) :: ++ ta-vew :: computed prompt - ^- {pom/stub lin/(pair @ud (list @c))} - =; vew/(pair (list @c) styx) + ^- [pom=stub lin=(pair @ud (list @c))] + =; vew=(pair (list @c) styx) [(make:klr q.vew) pos.inp p.vew] ?: vis.pom :- buf.say.inp :: default prompt @@ -1040,7 +1066,7 @@ ++ edit :: produce sole-edits |% ++ cat :: mass insert - |= {pos/@ud txt/(list @c)} + |= [pos=@ud txt=(list @c)] ^- sole-edit :- %mor |- ^- (list sole-edit) @@ -1048,7 +1074,7 @@ [[%ins pos i.txt] $(pos +(pos), txt t.txt)] :: ++ cut :: mass delete - |= {pos/@ud num/@ud} + |= [pos=@ud num=@ud] ^- sole-edit :- %mor |- ^- (list sole-edit) @@ -1056,30 +1082,30 @@ [[%del pos] $(num (dec num))] :: ++ rep :: mass replace - |= {{pos/@ud num/@ud} txt/(list @c)} + |= [[pos=@ud num=@ud] txt=(list @c)] ^- sole-edit :~ %mor (cut pos num) (cat pos txt) == ++ any :: matches? - |= {a/sole-edit b/$-(sole-edit ?)} + |= [a=sole-edit b=$-(sole-edit ?)] ^- ? - ?. ?=($mor -.a) (b a) - (lien p.a |=(c/sole-edit ^$(a c))) + ?. ?=(%mor -.a) (b a) + (lien p.a |=(c=sole-edit ^$(a c))) -- ++ offset :: calculate offsets |% ++ alnm :: alpha-numeric - |= a/@ ^- ? + |= a=@ ^- ? ?| &((gte a '0') (lte a '9')) &((gte a 'A') (lte a 'Z')) &((gte a 'a') (lte a 'z')) == :: ++ ace :: next whitespace - |= a/(list @) - =| {b/_| i/@ud} + |= a=(list @) + =| [b=_| i=@ud] |- ^- @ud ?~ a i =/ c !=(32 i.a) @@ -1088,8 +1114,8 @@ $(i +(i), a t.a) :: ++ edg :: next word boundary - |= a/(list @) - =| {b/_| i/@ud} + |= a=(list @) + =| [b=_| i=@ud] |- ^- @ud ?~ a i =/ c (alnm i.a) @@ -1098,8 +1124,8 @@ $(i +(i), a t.a) :: ++ wrd :: next or current word - |= a/(list @) - =| i/@ud + |= a=(list @) + =| i=@ud |- ^- @ud ?: |(?=(~ a) (alnm i.a)) i $(i +(i), a t.a) @@ -1109,22 +1135,22 @@ =, dill |% ++ make :: stub from styx - |= a/styx ^- stub - =| b/stye + |= a=styx ^- stub + =| b=stye %+ reel |- ^- stub %- zing %+ turn a - |= a/$@(@t (pair styl styx)) + |= a=$@(@t (pair styl styx)) ?@ a [b (tuba (trip a))]~ ^$(a q.a, b (styd p.a b)) :: - |= {a/(pair stye (list @c)) b/stub} + |= [a=(pair stye (list @c)) b=stub] ?~ b [a ~] ?. =(p.a p.i.b) [a b] [[p.a (weld q.a q.i.b)] t.b] :: ++ styd :: stye from styl - |= {a/styl b/stye} ^+ b :: with inheritance + |= [a=styl b=stye] ^+ b :: with inheritance :+ ?~ p.a p.b ?~ u.p.a ~ (~(put in p.b) u.p.a) @@ -1132,18 +1158,18 @@ (fall q.q.a q.q.b) :: ++ lent-char - |= a/stub ^- @ + |= a=stub ^- @ (roll (lnts-char a) add) :: ++ lnts-char :: stub pair tail lengths - |= a/stub ^- (list @) + |= a=stub ^- (list @) %+ turn a - |= a/(pair stye (list @c)) + |= a=(pair stye (list @c)) (lent q.a) :: ++ brek :: index + incl-len of - |= {a/@ b/(list @)} :: stub pair w/ idx a - =| {c/@ i/@} + |= [a=@ b=(list @)] :: stub pair w= idx a + =| [c=@ i=@] |- ^- (unit (pair @ @)) ?~ b ~ =. c (add c i.b) @@ -1152,7 +1178,7 @@ $(i +(i), b t.b) :: ++ slag :: slag stub, keep stye - |= {a/@ b/stub} + |= [a=@ b=stub] ^- stub =+ c=(lnts-char b) =+ i=(brek a c) @@ -1165,7 +1191,7 @@ (^slag (sub (snag p.u.i c) (sub q.u.i a)) q.n) :: ++ scag :: scag stub, keep stye - |= {a/@ b/stub} + |= [a=@ b=stub] ^- stub =+ c=(lnts-char b) =+ i=(brek a c) @@ -1179,7 +1205,7 @@ (^scag (sub (snag p.u.i c) (sub q.u.i a)) q.n) :: ++ swag :: swag stub, keep stye - |= {{a/@ b/@} c/stub} + |= [[a=@ b=@] c=stub] (scag b (slag a c)) -- -- diff --git a/pkg/arvo/lib/hood/helm.hoon b/pkg/arvo/lib/hood/helm.hoon index 9c8059523..69627f714 100644 --- a/pkg/arvo/lib/hood/helm.hoon +++ b/pkg/arvo/lib/hood/helm.hoon @@ -108,6 +108,10 @@ |= ~ =< abet (emit %pass /pack %arvo %d %flog %pack ~) :: +++ poke-pass + |= =note-arvo =< abet + (emit %pass /helm/pass %arvo note-arvo) +:: ++ take-wake-automass |= [way=wire error=(unit tang)] ?^ error @@ -122,7 +126,7 @@ == :: ++ poke-send-hi - |= {her/ship mes/(unit tape)} =< abet + |= [her=ship mes=(unit tape)] =< abet %- emit :* %pass /helm/hi/(scot %p her) %agent [her %hood] %poke @@ -131,7 +135,7 @@ :: :: ++ poke-hi - |= mes/@t + |= mes=@t ~| %poke-hi-fail ?: =(%fail mes) ~& %poke-hi-fail @@ -139,33 +143,33 @@ abet:(flog %text "< {}: {(trip mes)}") :: ++ poke-atom - |= ato/@ + |= ato=@ =+ len=(scow %ud (met 3 ato)) =+ gum=(scow %p (mug ato)) =< abet (flog %text "< {}: atom: {len} bytes, mug {gum}") :: ++ coup-hi - |= {pax/path cop/(unit tang)} =< abet - ?> ?=({@t ~} pax) + |= [pax=path cop=(unit tang)] =< abet + ?> ?=([@t ~] pax) (flog %text "hi {(trip i.pax)} {?~(cop "" "un")}successful") :: -++ poke-reload |=(all/(list term) (poke-reload-desk %home all)) +++ poke-reload |=(all=(list term) (poke-reload-desk %home all)) ++ poke-reload-desk :: reload vanes - |: $:{syd/desk all/(list term)} =< abet + |: $:,[syd=desk all=(list term)] =< abet %- emil %+ turn all =+ top=`path`/(scot %p our.bowl)/[syd]/(scot %da now.bowl) - =/ van/(list {term ~}) + =/ van=(list [term ~]) :- zus=[%zuse ~] ~(tap by dir:.^(arch %cy (welp top /sys/vane))) - |= nam/@tas + |= nam=@tas =. nam ?. =(1 (met 3 nam)) nam - =/ zaz/(list {p/knot ~}) - (skim van |=({a/term ~} =(nam (end 3 1 a)))) - ?> ?=({{@ ~} ~} zaz) + =/ zaz=(list [p=knot ~]) + (skim van |=([a=term ~] =(nam (end 3 1 a)))) + ?> ?=([[@ ~] ~] zaz) `term`p.i.zaz =+ tip=(end 3 1 nam) =+ zus==('z' tip) @@ -247,6 +251,7 @@ %helm-meld =;(f (f !<(_+<.f vase)) poke-meld) %helm-moon =;(f (f !<(_+<.f vase)) poke-moon) %helm-pack =;(f (f !<(_+<.f vase)) poke-pack) + %helm-pass =;(f (f !<(_+<.f vase)) poke-pass) %helm-rekey =;(f (f !<(_+<.f vase)) poke-rekey) %helm-reload =;(f (f !<(_+<.f vase)) poke-reload) %helm-reload-desk =;(f (f !<(_+<.f vase)) poke-reload-desk) @@ -276,5 +281,6 @@ ?>(?=(%wake +<.sign-arvo) +>.sign-arvo) [%serv *] %+ take-bound t.wire ?>(?=(%bound +<.sign-arvo) +>.sign-arvo) + [%pass *] abet == -- diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index be04366c7..32cd8a376 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -73,7 +73,7 @@ ?~(+< +> $(+< t.+<, +> (emit i.+<))) :: ++ render - |= {mez/tape sud/desk who/ship syd/desk} + |= [mez=tape sud=desk who=ship syd=desk] :^ %palm [" " ~ ~ ~] leaf+(weld "kiln: " mez) ~[leaf+"from {}" leaf+"on {}" leaf+"to {}"] :: @@ -113,7 +113,7 @@ ``noun+!>(ota) :: ++ poke-commit - |= [mon/kiln-commit auto=?] + |= [mon=kiln-commit auto=?] =< abet =. +>.$ (emit %pass /commit %arvo %c [%dirk mon]) ?. auto @@ -124,7 +124,7 @@ (emit %pass way.commit-timer %arvo %b [%wait nex.commit-timer]) :: ++ poke-autocommit - |= [mon/kiln-commit auto=?] + |= [mon=kiln-commit auto=?] =< abet =. +>.$ (emit %pass /commit %arvo %c [%dirk mon]) ?. auto @@ -147,7 +147,7 @@ abet:(emit %pass /mount %arvo %c [%mont pot u.bem]) :: ++ poke-unmount - |= mon/kiln-unmount + |= mon=kiln-unmount ?^ mon =+ bem=(de-beam mon) ?~ bem @@ -157,7 +157,7 @@ abet:(emit %pass /unmount-point %arvo %c [%ogre mon]) :: ++ poke-track :: - |= hos/kiln-sync + |= hos=kiln-sync ?: (~(has by syn) hos) abet:(spam (render "already tracking" [sud her syd]:hos) ~) abet:abet:start-track:(auto hos) @@ -271,7 +271,7 @@ =. ..abet (render-ket "OTA cancelled (1), retrying" ~) (poke-internal `[ship desk]:u.ota) =. ..abet (render-ket "downloading OTA update" ~) - =? aeon.u.ota ?=($w p.p.u.p.sign-arvo) + =? aeon.u.ota ?=(%w p.p.u.p.sign-arvo) ud:;;(cass:clay q.q.r.u.p.sign-arvo) %: emit %pass (make-wire /download) %arvo %c @@ -337,7 +337,7 @@ -- :: ++ poke-sync :: - |= hos/kiln-sync + |= hos=kiln-sync ?: (~(has by syn) hos) abet:(spam (render "already syncing" [sud her syd]:hos) ~) abet:abet:start-sync:(auto hos) @@ -361,10 +361,10 @@ ?: =(0 ~(wyt by syn)) [%leaf "no other syncs configured"]~ %+ turn ~(tap in ~(key by syn)) - |=(a/kiln-sync (render "sync configured" [sud her syd]:a)) + |=(a=kiln-sync (render "sync configured" [sud her syd]:a)) :: ++ poke-unsync :: - |= hus/kiln-unsync + |= hus=kiln-unsync ?. (~(has by syn) hus) abet:(spam (render "not syncing" [sud her syd]:hus) ~) %* . abet:abet:stop:(auto hus) @@ -381,13 +381,13 @@ abet:(emit %pass /cancel %arvo %c [%drop a]) :: ++ poke-info - |= {mez/tape tor/(unit toro)} + |= [mez=tape tor=(unit toro)] ?~ tor abet:(spam leaf+mez ~) abet:(emit:(spam leaf+mez ~) %pass /kiln %arvo %c [%info u.tor]) :: ++ poke-rm - |= a/path + |= a=path =+ b=.^(arch %cy a) ?~ fil.b =+ ~[leaf+"No such file:" leaf+"{}"] @@ -395,19 +395,19 @@ (poke-info "removed" `(fray a)) :: ++ poke-label - |= {syd/desk lab/@tas} + |= [syd=desk lab=@tas] =+ pax=/(scot %p our)/[syd]/[lab] (poke-info "labeled {(spud pax)}" `[syd %| lab]) :: ++ poke-schedule - |= {where/path tym/@da eve/@t} + |= [where=path tym=@da eve=@t] =. where (welp where /sched) %+ poke-info "scheduled" =+ old=;;((map @da cord) (fall (file where) ~)) `(foal where %sched !>((~(put by old) tym eve))) :: ++ poke-permission - |= {syd/desk pax/path pub/?} + |= [syd=desk pax=path pub=?] =< abet %- emit =/ =rite [%r ~ ?:(pub %black %white) ~] @@ -447,7 +447,7 @@ abet:(emit %pass /kiln %arvo %g %sear ship) :: ++ done - |= {way/wire saw/(unit error:ames)} + |= [way=wire saw=(unit error:ames)] ~? ?=(^ saw) [%kiln-nack u.saw] abet :: @@ -481,24 +481,24 @@ ?>(?=(%mere +<.sign-arvo) +>.sign-arvo) == == -++ take |=(way/wire ?>(?=({@ ~} way) (work i.way))) :: general handler +++ take |=(way=wire ?>(?=([@ ~] way) (work i.way))) :: general handler ++ take-mere :: - |= {way/wire are/(each (set path) (pair term tang))} + |= [way=wire are=(each (set path) (pair term tang))] abet:abet:(mere:(take way) are) :: ++ take-coup-fancy :: - |= {way/wire saw/(unit tang)} + |= [way=wire saw=(unit tang)] abet:abet:(coup-fancy:(take way) saw) :: ++ take-coup-spam :: - |= {way/wire saw/(unit tang)} + |= [way=wire saw=(unit tang)] ~? ?=(^ saw) [%kiln-spam-lame u.saw] abet :: ++ take-mere-sync :: - |= {way/wire mes/(each (set path) (pair term tang))} - ?> ?=({@ @ @ *} way) - =/ hos/kiln-sync + |= [way=wire mes=(each (set path) (pair term tang))] + ?> ?=([@ @ @ *] way) + =/ hos=kiln-sync :* syd=(slav %tas i.way) her=(slav %p i.t.way) sud=(slav %tas i.t.t.way) @@ -508,9 +508,9 @@ abet:abet:(mere:(auto hos) mes) :: ++ take-writ-find-ship :: - |= {way/wire rot/riot} - ?> ?=({@ @ @ *} way) - =/ hos/kiln-sync + |= [way=wire rot=riot] + ?> ?=([@ @ @ *] way) + =/ hos=kiln-sync :* syd=(slav %tas i.way) her=(slav %p i.t.way) sud=(slav %tas i.t.t.way) @@ -520,9 +520,9 @@ abet:abet:(take-find-ship:(auto hos) rot) :: ++ take-writ-sync :: - |= {way/wire rot/riot} - ?> ?=({@ @ @ *} way) - =/ hos/kiln-sync + |= [way=wire rot=riot] + ?> ?=([@ @ @ *] way) + =/ hos=kiln-sync :* syd=(slav %tas i.way) her=(slav %p i.t.way) sud=(slav %tas i.t.t.way) @@ -546,7 +546,7 @@ :: :: ++ spam - |= mes/(list tank) + |= mes=(list tank) ((slog mes) ..spam) :: ++ auto @@ -557,7 +557,7 @@ ..auto(syn (~(put by syn) [syd her sud] let)) :: ++ blab - |= new/(list card:agent:gall) + |= new=(list card:agent:gall) ^+ +> +>.$(moz (welp new moz)) :: @@ -598,7 +598,7 @@ (render "on sync" sud her syd) ~ start-sync - =. let ?. ?=($w p.p.u.rot) let ud:;;(cass:clay q.q.r.u.rot) + =. let ?. ?=(%w p.p.u.rot) let ud:;;(cass:clay q.q.r.u.rot) =/ =wire /kiln/sync/merg/[syd]/(scot %p her)/[sud] :: germ: merge mode for sync merges :: @@ -648,7 +648,7 @@ q.p.mes == :: - $no-ali-disc + %no-ali-disc :~ (render "sync activated" sud her syd) leaf+"note: blank desk {} on {}" == @@ -658,7 +658,7 @@ -- :: ++ work :: state machine - |= syd/desk + |= syd=desk =/ ,per-desk %+ ~(gut by rem) syd =+ *per-desk @@ -668,7 +668,7 @@ ..work(rem (~(put by rem) syd auto gem her sud cas)) :: ++ blab - |= new/(list card:agent:gall) + |= new=(list card:agent:gall) ^+ +> +>.$(moz (welp new moz)) :: @@ -685,7 +685,7 @@ (blab [%pass /kiln/[syd] %arvo %c [%merg syd her sud cas gem]] ~) :: ++ fancy-merge :: send to self - |= {syd/desk her/@p sud/desk gem/?($auto germ)} + |= [syd=desk her=@p sud=desk gem=?(%auto germ)] ^+ +> =/ =cage [%kiln-merge !>([syd her sud cas gem])] %- blab :_ ~ @@ -694,9 +694,9 @@ ++ spam ::|=(tang ((slog +<) ..spam)) |*(* +>(..work (^spam +<))) ++ merge - |= {her/@p sud/@tas cas/case gim/?($auto germ)} + |= [her=@p sud=@tas cas=case gim=?(%auto germ)] ^+ +> - ?. ?=($auto gim) + ?. ?=(%auto gim) perform(auto |, gem gim, her her, cas cas, sud sud) ?: =(0 ud:.^(cass:clay %cw /(scot %p our)/[syd]/(scot %da now))) => $(gim %init) @@ -705,7 +705,7 @@ .(auto &) :: ++ coup-fancy - |= saw/(unit tang) + |= saw=(unit tang) ?~ saw +> =+ :- "failed to set up conflict resolution scratch space" @@ -713,7 +713,7 @@ lose:(spam leaf+-< leaf+-> u.saw) :: ++ mere - |= are/(each (set path) (pair term tang)) + |= are=(each (set path) (pair term tang)) ^+ +> ?: =(%meld gem) ?: ?=(%& -.are) @@ -786,27 +786,27 @@ ?+ gem (spam leaf+"strange auto" >gem< ~) :: - $init + %init =+ :- "auto merge failed on strategy %init" "I'm out of ideas" lose:(spam leaf+-< leaf+-> [>p.p.are< q.p.are]) :: - $fine - ?. ?=($bad-fine-merge p.p.are) + %fine + ?. ?=(%bad-fine-merge p.p.are) =+ "auto merge failed on strategy %fine" lose:(spam leaf+- >p.p.are< q.p.are) => (spam leaf+"%fine merge failed, trying %meet" ~) perform(gem %meet) :: - $meet - ?. ?=($meet-conflict p.p.are) + %meet + ?. ?=(%meet-conflict p.p.are) =+ "auto merge failed on strategy %meet" lose:(spam leaf+- >p.p.are< q.p.are) => (spam leaf+"%meet merge failed, trying %mate" ~) perform(gem %mate) :: - $mate - ?. ?=($mate-conflict p.p.are) + %mate + ?. ?=(%mate-conflict p.p.are) =+ "auto merge failed on strategy %mate" lose:(spam leaf+- >p.p.are< q.p.are) => .(gem %meld) @@ -824,11 +824,11 @@ == :: ++ tape-to-tanks - |= a/tape ^- (list tank) - (scan a (more (just '\0a') (cook |=(a/tape leaf+a) (star prn)))) + |= a=tape ^- (list tank) + (scan a (more (just '\0a') (cook |=(a=tape leaf+a) (star prn)))) :: ++ tanks-if-any - |= {a/tape b/(list path) c/tape} ^- (list tank) + |= [a=tape b=(list path) c=tape] ^- (list tank) ?: =(~ b) ~ (welp (tape-to-tanks "\0a{c}{a}") >b< ~) -- diff --git a/pkg/arvo/lib/invite-json.hoon b/pkg/arvo/lib/invite-json.hoon index 7faac97d0..3d38ca168 100644 --- a/pkg/arvo/lib/invite-json.hoon +++ b/pkg/arvo/lib/invite-json.hoon @@ -1,7 +1,7 @@ /- *invite-store /+ resource |% -++ slan |=(mod/@tas |=(txt/@ta (need (slaw mod txt)))) +++ slan |=(mod=@tas |=(txt=@ta (need (slaw mod txt)))) :: ++ seri ::: serial =, dejs:format diff --git a/pkg/arvo/lib/jose.hoon b/pkg/arvo/lib/jose.hoon index f1e4226ff..bafe4bf6a 100644 --- a/pkg/arvo/lib/jose.hoon +++ b/pkg/arvo/lib/jose.hoon @@ -34,11 +34,11 @@ :: :: ++apex:en-json:html ++ apex =, en-json:html - |= {val/json sor/$-(^ ?) rez/tape} + |= [val=json sor=$-(^ ?) rez=tape] ^- tape ?~ val (weld "null" rez) ?- -.val - $a + %a :- '[' =. rez [']' rez] !. @@ -47,9 +47,9 @@ ?~ t.p.val ^$(val i.p.val) ^$(val i.p.val, rez [',' $(p.val t.p.val)]) :: - $b (weld ?:(p.val "true" "false") rez) - $n (weld (trip p.val) rez) - $s + %b (weld ?:(p.val "true" "false") rez) + %n (weld (trip p.val) rez) + %s :- '"' =. rez ['"' rez] =+ viz=(trip p.val) @@ -57,11 +57,11 @@ |- ^- tape ?~ viz rez =+ hed=(jesc i.viz) - ?: ?=({@ $~} hed) + ?: ?=([@ ~] hed) [i.hed $(viz t.viz)] (weld hed $(viz t.viz)) :: - $o + %o :- '{' =. rez ['}' rez] =/ viz diff --git a/pkg/arvo/lib/language-server/complete.hoon b/pkg/arvo/lib/language-server/complete.hoon index b42b65448..5956dbadb 100644 --- a/pkg/arvo/lib/language-server/complete.hoon +++ b/pkg/arvo/lib/language-server/complete.hoon @@ -9,7 +9,7 @@ :: Like +rose except also produces line number :: ++ lily - |* {los/tape sab/rule} + |* [los=tape sab=rule] =+ vex=(sab [[1 1] los]) ?~ q.vex [%| p=p.vex(q (dec q.p.vex))] @@ -142,9 +142,8 @@ `['' (~(play ut sut) wing+t.p.gen)] :: [^ *] (both p.gen q.gen) - [%ktcn *] loop(gen p.gen) [%brcn *] (grow q.gen) - [%brvt *] (grow q.gen) + [%brpt *] (grow q.gen) [%cnts *] |- ^- (unit [term type]) =* inner-loop $ @@ -165,13 +164,13 @@ [%hand *] ~ [%ktbr *] loop(gen p.gen) [%ktls *] (both p.gen q.gen) - [%ktpd *] loop(gen p.gen) + [%ktpm *] loop(gen p.gen) [%ktsg *] loop(gen p.gen) [%ktwt *] loop(gen p.gen) [%note *] loop(gen q.gen) [%sgzp *] (both p.gen q.gen) - [%sgbn *] loop(gen q.gen) :: should check for hoon in p.gen - [%tsbn *] (change p.gen q.gen) + [%sggr *] loop(gen q.gen) :: should check for hoon in p.gen + [%tsgr *] (change p.gen q.gen) [%tscm *] %+ replace loop(gen p.gen) @@ -185,7 +184,7 @@ [%lost *] loop(gen p.gen) [%zpmc *] (both p.gen q.gen) [%zpts *] loop(gen p.gen) - [%zpvt *] (both q.gen r.gen) + [%zppt *] (both q.gen r.gen) [%zpzp *] ~ * =+ doz=~(open ap gen) diff --git a/pkg/arvo/lib/language-server/easy-print.hoon b/pkg/arvo/lib/language-server/easy-print.hoon index 0c6827dde..cc4ecd156 100644 --- a/pkg/arvo/lib/language-server/easy-print.hoon +++ b/pkg/arvo/lib/language-server/easy-print.hoon @@ -1,32 +1,32 @@ :: Fast type printing that's easy on the eyes or your money back :: => |% - ++ cape {p/(map @ud wine) q/wine} - ++ wine - $@ $? $noun - $path - $type - $void - $wall - $wool - $yarn + +$ cape [p=(map @ud wine) q=wine] + +$ wine + $@ $? %noun + %path + %type + %void + %wall + %wool + %yarn == - $% {$mato p/term} - {$gate p/hoon q/type r/wine} - {$core p/(list @ta) q/wine} - {$face p/term q/wine} - {$list p/term q/wine} - {$pear p/term q/@} - {$bswt p/(list wine)} - {$plot p/(list wine)} - {$stop p/@ud} - {$tree p/term q/wine} - {$unit p/term q/wine} + $% [%mato p=term] + [%gate p=hoon q=type r=wine] + [%core p=(list @ta) q=wine] + [%face p=term q=wine] + [%list p=term q=wine] + [%pear p=term q=@] + [%bcwt p=(list wine)] + [%plot p=(list wine)] + [%stop p=@ud] + [%tree p=term q=wine] + [%unit p=term q=wine] == -- -|_ sut/type +|_ sut=type ++ dash - |= {mil/tape lim/char lam/tape} + |= [mil=tape lim=char lam=tape] ^- tape =/ esc (~(gas in *(set @tD)) lam) :- lim @@ -41,33 +41,33 @@ [i.mil $(mil t.mil)] ['\\' ~(x ne (rsh 2 1 i.mil)) ~(x ne (end 2 1 i.mil)) $(mil t.mil)] :: -++ deal |=(lum/* (dish dole lum)) +++ deal |=(lum=* (dish dole lum)) ++ dial - |= ham/cape + |= ham=cape =+ gid=*(set @ud) =| top-level=? :: don't need circumfix punctuation =< `tank`-:$ |% ++ many - |= haz/(list wine) - ^- {(list tank) (set @ud)} + |= haz=(list wine) + ^- [(list tank) (set @ud)] ?~ haz [~ gid] =^ mor gid $(haz t.haz) =^ dis gid ^$(q.ham i.haz) [[dis mor] gid] :: ++ $ - ^- {tank (set @ud)} + ^- [tank (set @ud)] ?- q.ham - $noun :_(gid [%leaf '*' ~]) - $path :_(gid [%leaf '/' ~]) - $type :_(gid [%leaf '#' 't' ~]) - $void :_(gid [%leaf '#' '!' ~]) - $wool :_(gid [%leaf '*' '"' '"' ~]) - $wall :_(gid [%leaf '*' '\'' '\'' ~]) - $yarn :_(gid [%leaf '"' '"' ~]) - {$mato *} :_(gid [%leaf '@' (trip p.q.ham)]) - {$gate *} + %noun :_(gid [%leaf '*' ~]) + %path :_(gid [%leaf '/' ~]) + %type :_(gid [%leaf '#' 't' ~]) + %void :_(gid [%leaf '#' '!' ~]) + %wool :_(gid [%leaf '*' '"' '"' ~]) + %wall :_(gid [%leaf '*' '\'' '\'' ~]) + %yarn :_(gid [%leaf '"' '"' ~]) + [%mato *] :_(gid [%leaf '@' (trip p.q.ham)]) + [%gate *] =^ sam gid ?. ?=([%plot * * *] r.q.ham) ?: ?=(%plot -.r.q.ham) @@ -92,7 +92,7 @@ == ~ :: - {$core *} + [%core *] =^ sam gid ?. ?=([%plot * * ~] q.q.ham) `gid @@ -114,26 +114,26 @@ [[%leaf (rip 3 i.p.q.ham)] $(p.q.ham t.p.q.ham)] ~ :: - {$face *} + [%face *] =^ cox gid $(q.ham q.q.ham) :_(gid [%palm [['=' ~] ~ ~ ~] [%leaf (trip p.q.ham)] cox ~]) :: - {$list *} + [%list *] =^ cox gid $(q.ham q.q.ham) :_(gid [%rose [" " (weld (trip p.q.ham) "(") ")"] cox ~]) :: - {$bswt *} + [%bcwt *] =^ coz gid (many p.q.ham) :_(gid [%rose [[' ' ~] ['?' '(' ~] [')' ~]] coz]) :: - {$plot *} + [%plot *] =^ coz gid (many p.q.ham) :_(gid [%rose [[' ' ~] ['[' ~] [']' ~]] coz]) :: - {$pear *} + [%pear *] :_(gid [%leaf '$' ~(rend co [%$ p.q.ham q.q.ham])]) :: - {$stop *} + [%stop *] =+ num=~(rend co [%$ %ud p.q.ham]) ?: (~(has in gid) p.q.ham) :_(gid [%leaf '#' num]) @@ -144,26 +144,26 @@ == :_(gid [%palm [['.' ~] ~ ~ ~] [%leaf ['^' '#' num]] cox ~]) :: - {$tree *} + [%tree *] =^ cox gid $(q.ham q.q.ham) :_(gid [%rose [" " (weld (trip p.q.ham) "(") ")"] cox ~]) :: - {$unit *} + [%unit *] =^ cox gid $(q.ham q.q.ham) :_(gid [%rose [" " (weld (trip p.q.ham) "(") ")"] cox ~]) == -- :: ++ dish !: - |= {ham/cape lum/*} ^- tank + |= [ham=cape lum=*] ^- tank ~| [%dish-h ?@(q.ham q.ham -.q.ham)] ~| [%lump lum] ~| [%ham ham] %- need - =| gil/(set {@ud *}) + =| gil=(set [@ud *]) |- ^- (unit tank) ?- q.ham - $noun + %noun %= $ q.ham ?: ?=(@ lum) @@ -173,7 +173,7 @@ [%noun ?:(?=(@ +.lum) [[%mato %$] ~] $(lum +.lum))] == :: - $path + %path :- ~ :+ %rose [['/' ~] ['/' ~] ~] @@ -183,7 +183,7 @@ ?> ?=(@ -.lum) [[%leaf (rip 3 -.lum)] $(lum +.lum)] :: - $type + %type =+ tyr=|.((dial dole)) =+ vol=tyr(sut lum) =+ cis=;;(tank .*(vol [%9 2 %0 1])) @@ -191,7 +191,7 @@ [~ ~ ~ ~] [[%leaf '#' 't' '/' ~] cis ~] :: - $wall + %wall :- ~ :+ %rose [[' ' ~] ['<' '|' ~] ['|' '>' ~]] @@ -200,7 +200,7 @@ ?@ lum !! [[%leaf (trip ;;(@ -.lum))] $(lum +.lum)] :: - $wool + %wool :- ~ :+ %rose [[' ' ~] ['<' '<' ~] ['>' '>' ~]] @@ -209,28 +209,28 @@ ?@ lum !! [(need ^$(q.ham %yarn, lum -.lum)) $(lum +.lum)] :: - $yarn + %yarn [~ %leaf (dash (tape lum) '"' "\{")] :: - $void + %void ~ :: - {$mato *} + [%mato *] ?. ?=(@ lum) ~ :+ ~ %leaf ?+ (rash p.q.ham ;~(sfix (cook crip (star low)) (star hig))) ~(rend co [%$ p.q.ham lum]) - $$ ~(rend co [%$ %ud lum]) - $t (dash (rip 3 lum) '\'' ~) - $tas ['%' ?.(=(0 lum) (rip 3 lum) ['$' ~])] + %$ ~(rend co [%$ %ud lum]) + %t (dash (rip 3 lum) '\'' ~) + %tas ['%' ?.(=(0 lum) (rip 3 lum) ['$' ~])] == :: - {$gate *} + [%gate *] !! :: - {$core *} + [%core *] :: XX needs rethinking for core metal :: ?. ?=(^ lum) ~ :: => .(lum `*`lum) @@ -244,13 +244,13 @@ :: ?~(mur ~ [~ [[%leaf (rip 3 i.p.q.ham)] u.mur]]) [~ (dial ham)] :: - {$face *} + [%face *] =+ wal=$(q.ham q.q.ham) ?~ wal ~ [~ %palm [['=' ~] ~ ~ ~] [%leaf (trip p.q.ham)] u.wal ~] :: - {$list *} + [%list *] ?: =(~ lum) [~ %leaf '~' ~] =- ?~ tok @@ -265,7 +265,7 @@ ~ [~ u.for u.aft] :: - {$bswt *} + [%bcwt *] |- ^- (unit tank) ?~ p.q.ham ~ @@ -274,7 +274,7 @@ $(p.q.ham t.p.q.ham) wal :: - {$plot *} + [%plot *] =- ?~ tok ~ [~ %rose [[' ' ~] ['[' ~] [']' ~]] u.tok] @@ -282,7 +282,7 @@ |- ^- (unit (list tank)) ?~ p.q.ham ~ - ?: ?=({* ~} p.q.ham) + ?: ?=([* ~] p.q.ham) =+ wal=^$(q.ham i.p.q.ham) ?~(wal ~ [~ [u.wal ~]]) ?@ lum @@ -295,25 +295,25 @@ ~ [~ u.gim u.myd] :: - {$pear *} + [%pear *] ?. =(lum q.q.ham) ~ =. p.q.ham (rash p.q.ham ;~(sfix (cook crip (star low)) (star hig))) =+ fox=$(q.ham [%mato p.q.ham]) - ?> ?=({~ $leaf ^} fox) - ?: ?=(?($n $tas) p.q.ham) + ?> ?=([~ %leaf ^] fox) + ?: ?=(?(%n %tas) p.q.ham) fox [~ %leaf '%' p.u.fox] :: - {$stop *} + [%stop *] ?: (~(has in gil) [p.q.ham lum]) ~ =+ kep=(~(get by p.ham) p.q.ham) ?~ kep ~|([%stop-loss p.q.ham] !!) $(gil (~(put in gil) [p.q.ham lum]), q.ham u.kep) :: - {$tree *} + [%tree *] =- ?~ tok ~ [~ %rose [[' ' ~] ['{' ~] ['}' ~]] u.tok] @@ -322,7 +322,7 @@ |- ^- (unit (list tank)) ?: =(~ lum) [~ tuk] - ?. ?=({n/* l/* r/*} lum) + ?. ?=([n=* l=* r=*] lum) ~ =+ rol=$(lum r.lum) ?~ rol @@ -332,7 +332,7 @@ ~ $(lum l.lum, tuk [u.tim u.rol]) :: - {$unit *} + [%unit *] ?@ lum ?.(=(~ lum) ~ [~ %leaf '~' ~]) ?. =(~ -.lum) @@ -344,17 +344,17 @@ == :: ++ doge - |= ham/cape + |= ham=cape =- ?+ woz woz - {$list * {$mato $'ta'}} %path - {$list * {$mato $'t'}} %wall - {$list * {$mato $'tD'}} %yarn - {$list * $yarn} %wool + [%list * [%mato %'ta']] %path + [%list * [%mato %'t']] %wall + [%list * [%mato %'tD']] %yarn + [%list * %yarn] %wool == ^= woz ^- wine - ?. ?=({$stop *} q.ham) - ?: ?& ?= {$bswt {$pear $n $0} {$plot {$pear $n $0} {$face *} ~} ~} + ?. ?=([%stop *] q.ham) + ?: ?& ?= [%bcwt [%pear %n %0] [%plot [%pear %n %0] [%face *] ~] ~] q.ham =(1 (met 3 p.i.t.p.i.t.p.q.ham)) == @@ -364,13 +364,13 @@ ?~ may q.ham =+ nul=[%pear %n 0] - ?. ?& ?=({$bswt *} u.may) - ?=({* * ~} p.u.may) + ?. ?& ?=([%bcwt *] u.may) + ?=([* * ~] p.u.may) |(=(nul i.p.u.may) =(nul i.t.p.u.may)) == q.ham =+ din=?:(=(nul i.p.u.may) i.t.p.u.may i.p.u.may) - ?: ?& ?=({$plot {$face *} {$face * $stop *} ~} din) + ?: ?& ?=([%plot [%face *] [%face * %stop *] ~] din) =(p.q.ham p.q.i.t.p.din) =(1 (met 3 p.i.p.din)) =(1 (met 3 p.i.t.p.din)) @@ -378,10 +378,10 @@ :+ %list (cat 3 p.i.p.din p.i.t.p.din) q.i.p.din - ?: ?& ?= $: $plot - {$face *} - {$face * $stop *} - {{$face * $stop *} ~} + ?: ?& ?= $: %plot + [%face *] + [%face * %stop *] + [[%face * %stop *] ~] == din =(p.q.ham p.q.i.t.p.din) @@ -403,24 +403,24 @@ =+ gil=*(set type) =+ dex=[p=*(map type @) q=*(map @ wine)] =< [q.p q] - |- ^- {p/{p/(map type @) q/(map @ wine)} q/wine} + |- ^- [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} + ^- [p=[p=(map type @) q=(map @ wine)] q=wine] ?: (~(meet ut sut) -:!>(*type)) [dex %type] ?- sut - $noun [dex sut] - $void [dex sut] - {$atom *} [dex ?~(q.sut [%mato p.sut] [%pear p.sut u.q.sut])] - {$cell *} + %noun [dex sut] + %void [dex sut] + [%atom *] [dex ?~(q.sut [%mato p.sut] [%pear p.sut u.q.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 ~]) + ?:(?=([%plot *] q.yon) [q.hin p.q.yon] [q.hin q.yon ~]) :: - {$core *} + [%core *] ?: ?=([[%$ * [[%$ @ *] ~ ~]] ~ ~] q.r.q.sut) =/ dad $(sut p.sut) :- p.dad @@ -428,8 +428,8 @@ [%gate q.n.q.q.n.q.r.q.sut sut(r.p.q %gold) q.dad] =+ yad=$(sut p.sut) :- p.yad - =+ ^= doy ^- {p/(list @ta) q/wine} - ?: ?=({$core *} q.yad) + =+ ^= doy ^- [p=(list @ta) q=wine] + ?: ?=([%core *] q.yad) [p.q.yad q.q.yad] [~ q.yad] :- %core @@ -441,7 +441,7 @@ %- ~(rep by (~(run by q.r.q.sut) |=(tome ~(wyt by q.+<)))) |=([[@ a=@u] b=@u] (add a b)) %^ cat 3 - ?-(r.p.q.sut $gold '.', $iron '|', $lead '?', $zinc '&') + ?-(r.p.q.sut %gold '.', %iron '|', %lead '?', %zinc '&') =+ gum=(mug q.r.q.sut) %+ can 3 :~ [1 (add 'a' (mod gum 26))] @@ -449,24 +449,24 @@ [1 (add 'a' (mod (div gum 676) 26))] == :: - {$hint *} + [%hint *] $(sut q.sut) :: - {$face *} + [%face *] =+ yad=$(sut q.sut) ?^(p.sut yad [p.yad [%face p.sut q.yad]]) :: - {$fork *} + [%fork *] =+ yed=(sort ~(tap in p.sut) aor) - =- [p [%bswt q]] - |- ^- {p/{p/(map type @) q/(map @ wine)} q/(list wine)} + =- [p [%bcwt q]] + |- ^- [p=[p=(map type @) q=(map @ wine)] q=(list wine)] ?~ yed [dex ~] =+ mor=$(yed t.yed) =+ dis=^$(dex p.mor, sut i.yed) [p.dis q.dis q.mor] :: - {$hold *} + [%hold *] =+ hey=(~(get by p.dex) sut) ?^ hey [dex [%stop u.hey]] diff --git a/pkg/arvo/lib/language-server/rune-snippet.hoon b/pkg/arvo/lib/language-server/rune-snippet.hoon index ed1dc1b8a..b25e306be 100644 --- a/pkg/arvo/lib/language-server/rune-snippet.hoon +++ b/pkg/arvo/lib/language-server/rune-snippet.hoon @@ -197,10 +197,6 @@ """ $\{1:iron-core} """ - :- '^%' - """ - $\{1:body} - """ :- '^.' """ $\{1:a} diff --git a/pkg/arvo/lib/metadata-json.hoon b/pkg/arvo/lib/metadata-json.hoon index 7197ab4dc..82a65c8fd 100644 --- a/pkg/arvo/lib/metadata-json.hoon +++ b/pkg/arvo/lib/metadata-json.hoon @@ -48,7 +48,7 @@ :: ++ nu |= jon=json - ?> ?=({$s *} jon) + ?> ?=([%s *] jon) (rash p.jon hex) :: ++ metadata diff --git a/pkg/arvo/lib/old-phon.hoon b/pkg/arvo/lib/old-phon.hoon index fe378856d..2db8670dc 100644 --- a/pkg/arvo/lib/old-phon.hoon +++ b/pkg/arvo/lib/old-phon.hoon @@ -45,19 +45,19 @@ /lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes' |% ++ ins ::~/ %ins :: parse prefix - |= a/@tas + |= a=@tas =+ b=0 |- ^- (unit @) ?:(=(256 b) ~ ?:(=(a (tos b)) [~ b] $(b +(b)))) ++ ind ::~/ %ind :: parse suffix - |= a/@tas + |= a=@tas =+ b=0 |- ^- (unit @) ?:(=(256 b) ~ ?:(=(a (tod b)) [~ b] $(b +(b)))) ++ tos ::~/ %tos :: fetch prefix - |=(a/@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] sis))) + |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] sis))) ++ tod ::~/ %tod :: fetch suffix - |=(a/@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] dex))) + |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] dex))) -- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: section 2eL, formatting (path) :: @@ -66,11 +66,11 @@ |% ++ hif (boss 256 ;~(plug tip tiq (easy ~))) ++ huf %+ cook - |=({a/@ b/@} (wred:un ~(zug mu ~(zag mu [a b])))) + |=([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 ~))) - ++ tip (sear |=(a/@ (ins:po a)) til) - ++ tiq (sear |=(a/@ (ind:po a)) til) + ++ tip (sear |=(a=@ (ins:po a)) til) + ++ tiq (sear |=(a=@ (ind:po a)) til) ++ til (boss 256 (stun [3 3] low)) -- ++ ag @@ -87,7 +87,7 @@ -- :: ++ mu - |_ {top/@ bot/@} + |_ [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) @@ -98,16 +98,16 @@ ++ un :: =(x (wred (wren x))) |% ++ wren :: conceal structure - |= pyn/@ ^- @ + |= pyn=@ ^- @ =+ len=(met 3 pyn) ?: =(0 len) 0 => .(len (dec len)) =+ mig=(zaft (xafo len (cut 3 [len 1] pyn))) %+ can 3 - %- flop ^- (list {@ @}) + %- flop ^- (list [@ @]) :- [1 mig] - |- ^- (list {@ @}) + |- ^- (list [@ @]) ?: =(0 len) ~ => .(len (dec len)) @@ -115,27 +115,27 @@ [[1 mog] $(mig mog)] :: ++ wred :: restore structure - |= cry/@ ^- @ + |= cry=@ ^- @ =+ len=(met 3 cry) ?: =(0 len) 0 => .(len (dec len)) =+ mig=(cut 3 [len 1] cry) %+ can 3 - %- flop ^- (list {@ @}) + %- flop ^- (list [@ @]) :- [1 (xaro len (zart mig))] - |- ^- (list {@ @}) + |- ^- (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))) + ++ 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/@D + |= a=@D =+ ^= 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. @@ -151,7 +151,7 @@ (cut 3 [(dec a) 1] b) :: ++ zart :: reverse 255-sbox - |= a/@D + |= a=@D =+ ^= 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. @@ -167,7 +167,7 @@ (cut 3 [(dec a) 1] b) :: ++ zyft :: forward 256-sbox - |= a/@D + |= a=@D =+ ^= b 0xbb49.b71f.b881.b402.17e4.6b86.69b5.1647.115f.dddb.7ca5. 8371.4bd5.19a9.b092.605d.0d9b.e030.a0cc.78ba.5706.4d2d. @@ -184,7 +184,7 @@ (cut 3 [a 1] b) :: ++ zyrt :: reverse 256-sbox - |= a/@D + |= a=@D =+ ^= b 0x9fc8.2753.6e02.8fcf.8b35.2b20.5598.7caa.c9a9.30b0.9b48. 47ce.6371.80f6.407d.00dd.0aa5.ed10.ecb7.0f5a.5c3a.e605. diff --git a/pkg/arvo/lib/pill.hoon b/pkg/arvo/lib/pill.hoon index 06493edc8..634310db7 100644 --- a/pkg/arvo/lib/pill.hoon +++ b/pkg/arvo/lib/pill.hoon @@ -12,6 +12,7 @@ +$ unix-event %+ pair wire $% [%wack p=@] + [%what p=(list (pair path (cask)))] [%whom p=ship] [%boot ? $%($>(%fake task:able:jael) $>(%dawn task:able:jael))] unix-task @@ -60,14 +61,14 @@ %. directories |= :: sal: all spurs to load from :: - sal/(list spur) + sal=(list spur) ^- unix-event :: :: hav: all user files :: =; hav ~& user-files+(lent hav) - [[%$ %sync ~] [%into %$ & hav]] - =| hav/mode:clay + [/c/sync [%into %$ & hav]] + =| hav=mode:clay |- ^+ hav ?~ sal ~ =. hav $(sal t.sal) @@ -87,7 +88,7 @@ =? hav ?=(^ fil.lon) :: XX this whitelist needs to be reviewed :: - ?. ?= ?($css $hoon $html $js $json $md $png $txt $udon $umd) + ?. ?= ?(%css %hoon %html %js %json %md %png %txt %udon %umd) -.tyl :: :: install only files with whitelisted marks @@ -100,11 +101,11 @@ =; cot [[(flop `path`tyl) `[/text/plain cot]] hav] ^- octs ?- tyl - {$json *} + [%json *] =/ dat .^(json %cx pax) (as-octt:mimes:html (en-json:html dat)) :: - {$txt *} + [%txt *] =/ dat .^(wain %cx pax) (as-octs:mimes:html (of-wain:format dat)) :: @@ -116,4 +117,47 @@ |- ^- mode:clay ?~ all hav $(all t.all, hav ^$(tyl [p.i.all tyl])) +:: +:: +file-ovum2: electric boogaloo +:: +++ file-ovum2 |=(p=path `unix-event`[//arvo what/(user-files p)]) +:: +:: +user-files: all userspace hoon files +:: +++ user-files + |= bas=path + %. directories:file-ovum + |= sal=(list spur) + ^- (list (pair path (cask))) + :: + :: hav: all user files + :: + =| hav=(list (pair path (cask))) + |- ^+ hav + ?~ sal ~ + =. hav $(sal t.sal) + :: + :: tyl: spur + :: + =/ tyl i.sal + |- ^+ hav + :: + :: pax: full path at `tyl` + :: lon: directory at `tyl` + :: + =/ pax (weld bas (flop tyl)) + =/ lon .^(arch %cy pax) + =? hav ?=(^ fil.lon) + :: + :: install only hoon files for now + :: + ?. ?=([%hoon *] tyl) + hav + :_ hav + [(flop `path`t.tyl) hoon/.^(@t %cx pax)] + :: + =/ all ~(tap by dir.lon) + |- ^+ hav + ?~ all hav + $(all t.all, hav ^$(tyl [p.i.all tyl])) -- diff --git a/pkg/arvo/lib/plume.hoon b/pkg/arvo/lib/plume.hoon new file mode 100644 index 000000000..63fba69c0 --- /dev/null +++ b/pkg/arvo/lib/plume.hoon @@ -0,0 +1,420 @@ +/- *plum +:: +:: This library includes `plume`, the actual pretty printing logic, +:: and a handful of utilities for constructing plums. +:: +:: Generally, you'll just use `plume` like this: +:: +:: ~(tall plume plum) :: Pretty print `plum` in tall mode. +:: ~(flat plume plum) :: Pretty print `plum` in wide mode. +:: +:: There is probably no reason to look at the utility routines unless +:: you are writing something to generate `plum`s. +:: +:: This is the pretty-printer. Use the `flat` arm to render a plum +:: into a single line and use the `tall` arm to get a nice multi-line +:: rendering that switches to wide mode if there's enough space. +:: +:: For details about how this works and what exactly it does in various +:: cases, take a look at the docs for `plum`, `plumfmt`, and at the +:: docs on the arms of this door. +:: +^? |% +++ plume + |_ =plum + :: + :: An line, indented by `indent` spaces. + :: + +$ line [indent=@ud text=tape] + :: + :: An sequence of indented lines. + :: + +$ block (list line) + :: + :: +flat: print as a single line + :: + ++ flat + ^- wain + text:linear + :: + :: +tall: print as multiple lines + :: + ++ tall + ^- wain + %+ turn window + |= line + (crip (runt [indent ' '] text)) + :: + :: +adjust: adjust lines to right + :: + ++ adjust + |= [tab=@ud =block] ^- ^block + (turn block |=([@ud tape] [(add tab +<-) +<+])) + :: + :: Prepend `n` spaces to a tape. + :: + ++ prepend-spaces + |= [n=@ t=tape] ^- tape + (runt [n ' '] t) + :: + :: +window: print as list of tabbed lines + :: + ++ window + ^- block + ~+ :: for random access + ?@ plum [0 (trip plum)]~ :: trivial text + ?- -.plum + :: + :: %para: Line-wrappable paragraph. This is a stub; it should + :: wrap text to 40 characters. + :: + %para + [0 +:linear]~ + :: + :: %sbrk: nested subexpression + :: + :: This is an opportunity to switch to wide mode. First, try + :: rendered in wide mode. If that's possible and the result + :: isn't too big, use that. Otherwise recurse into the subplum + :: without switching to wide mode. + :: + %sbrk + =/ sub kid.plum + ?+ sub + window(plum sub) + [%tree *] + =/ wideresult + ?~(wide.fmt.sub ~ [~ u=linear]) + ?: ?&(?=(^ wideresult) (lte length.u.wideresult 40)) + [0 text.u.wideresult]~ + window(plum sub) + == + :: + :: %tree: Try to render a text tree in tall mode. + :: + :: We want to render this in tall mode. First, verify that there + :: the plum has a tall render (if not, fall back to `linear` + :: formatting), then render all the subplums, and then render + :: them in one of three ways: + :: + :: - If the `plumfmt` contains an `indef` and that indef has + :: no prefix, then this is a variable-arity rune with a + :: terminator: Use vertical formatting. + :: + :: - If the `plumfmt` contains an `indef` and that indef DOES have + :: a prefix, then this is something that looks like a core: Use + :: `core-like` formatting. + :: + :: - Otherwise, this is a rune with a fixed number of arguments + :: Render the subplums using backstep indentation. + :: + :: There's also a special case where something has exactly one sub-plum. + :: where something has exactly one sub-block. For example, we + :: want this output: + :: + :: |- + :: foo + :: + %tree + ?~ tall.fmt.plum [0 text:linear]~ + =/ prelude (trip intro.u.tall.fmt.plum) + |^ =/ blocks (turn kids.plum |=(=^plum window(plum plum))) + =/ prelude (trip intro.u.tall.fmt.plum) + ?~ indef.u.tall.fmt.plum + ?: =(1 (lent blocks)) + [[0 prelude] (zing blocks)] + (backstep prelude blocks) + =/ prefix (trip sigil.u.indef.u.tall.fmt.plum) + =/ finale (trip final.u.indef.u.tall.fmt.plum) + ?~ blocks %+ weld + ?~(prelude ~ [0 prelude]~) + ?~(finale ~ [0 finale]~) + ?~ prefix (running prelude blocks finale) + (core-like prelude prefix blocks finale) + -- + == + :: + :: Render a plum in tall-mode using backstep indentation. Here, + :: we are rendering things that look something like this: + :: + :: :+ foo + :: bar + :: baz + :: + ++ backstep + |= [prelude=tape blocks=(list block)] + ^- block + %- zing + =/ nkids (lent blocks) + =/ idx 1 + |- ^- (list block) + ?~ blocks ~ + :_ $(blocks t.blocks, idx +(idx)) + ^- block + =/ indent (mul 2 (sub nkids idx)) + ?. =(1 idx) (adjust indent i.blocks) + (rune-inline-with-block prelude indent i.blocks) + :: + :: To make things look a bit nicer, we want to put the first + :: sub-block on the same line as the rune. We want this: + :: + :: :- foo + :: baz + :: + :: Instead of this: + :: + :: :- + :: foo + :: baz + :: + :: This handles the "foo" case. + :: + ++ rune-inline-with-block + |= [rune=tape indent=@ blk=block] + ^- block + =. indent (max indent (add 2 (lent rune))) + =. blk (adjust indent blk) + ?~ rune blk + ?~ blk [0 rune]~ + :_ t.blk + :- 0 + %+ weld rune + =/ spaces-btwn (sub indent.i.blk (lent rune)) + (prepend-spaces spaces-btwn text.i.blk) + :: + :: Render a tall hoon with running indentation. Here, we are + :: rendering things that look sopmething like: + :: + :: :~ foo + :: bar + :: baz + :: == + :: + :: So, there's basically three cases here: Either the prelude + :: is a rune, the prelude is empty, or prelude is some other + :: random-ass thing. + :: + :: - If there is no prelude, then just combine all of the + :: sub-blocks together unaltered. + :: - If it's a rune (two-characters wide), then combine the + :: rune and the first line into one line (separated by two + :: spaces) and indent the rest of the lines by four spaces. + :: - If the rune is some other random-ass thing (has a length + :: that isn't 0 or 2), then render the prelude alone on the + :: first line and then combine the sub-blocks together, + :: all indented by another two spaces. + :: + :: Regardless, if there's a finale, stick it on the end without + :: any indentation. + :: + ++ running + |= [prelude=tape blocks=(list block) finale=tape] + ^- block + =/ result=block (zing blocks) + =. result + ?+ (lent prelude) + [[0 prelude] (adjust 2 result)] :: unusual prelude + %0 :: empty prelude + result + %2 :: rune prelude + (rune-inline-with-block prelude 4 result) + == + ?~ finale result + (snoc result [0 finale]) + :: + :: This renders sub-blocks where each sub-block needs to be + :: prefixed by some tape. For example: + :: + :: |% + :: ++ foo + :: bar + :: ++ baz + :: qux + :: -- + :: + ++ core-like + |= [prelude=tape prefix=tape blocks=(list block) finale=tape] + ^- block + =/ clear (add 2 (lent prefix)) + =/ result + ^- block + %- zing + ^- (list block) + %+ turn blocks + |= blk=block + ^- block + ^+ +< + =* tab ?~(blk 0 (sub clear (min clear indent.i.blk))) + =. blk (adjust tab blk) + ?~ blk ~ + :_ t.blk + :- 0 + %+ weld prefix + (runt [(sub indent.i.blk (lent prefix)) ' '] text.i.blk) + =. result + ?~ finale result + (snoc result [0 finale]) + ?~ prelude result + [[0 prelude] result] + :: + :: +linear: Render a plum onto a single line, even if it only has a + :: wide form. + :: + ++ linear + ^- [length=@ud text=tape] + ~+ :: ~+ for random access + ?@ plum [(met 3 plum) (trip plum)] :: Just a cord. + ?- -.plum + :: + :: This is already in wide mode, so %sbrk nodes don't matter here. + :: + %sbrk + linear(plum kid.plum) + :: + :: %para: To write a wrappable text paragraph to a single line, + :: we just combine all the lines into one, interspersing single + :: spaces chars. + :: + %para + |- ^- [length=@ud text=tape] + ?~ lines.plum [0 ~] + =/ next $(lines.plum t.lines.plum) + =/ this [length=(met 3 i.lines.plum) text=(trip i.lines.plum)] + :- (add +(length.this) length.next) + (weld text.this `tape`[' ' text.next]) + :: + :: Render a text tree to a single line. + :: + %tree + |^ ^- [length=@ud text=tape] + ?~ wide.fmt.plum (force-wide window) + =/ body (render-body delimit.u.wide.fmt.plum kids.plum) + ?~ enclose.u.wide.fmt.plum body + (wrap-with-enclose u.enclose.u.wide.fmt.plum body) + :: + :: Given a list of subplums and a delimiter, render all the + :: subplums onto a single line, and combine them into a single + :: string by interspersing the delimiter. + :: + ++ render-body + |= [delimit=cord kids=(list ^plum)] + =/ stop (trip delimit) + |- ^- [length=@ud text=tape] + ?~ kids [0 ~] + =/ next $(kids t.kids) + =/ this linear(plum i.kids) + ?~ text.next this + :- :(add length.this (lent stop) length.next) + :(weld text.this stop text.next) + :: + :: Wrap a wide-form-rendered result with the `enclose` cords + :: from its `plumefmt`. + :: + ++ wrap-with-enclose + |= [clamps=(pair cord cord) body=[length=@ text=tape]] + ^- [length=@ud text=tape] + :: + =/ close [(trip -.clamps) (trip +.clamps)] + :- :(add length.body (lent -.close) (lent +.close)) + :(weld -.close text.body +.close) + :: + :: Given the result of rendering a plum in tall form, combine + :: all the lines into one by separating each by two spaces. + :: + ++ force-wide + |= render=(list [@ud text=tape]) + ^- [length=@ud text=tape] + :: + ?~ render [0 ~] + =/ next (force-wide t.render) + :- :(add (lent text.i.render) 2 length.next) + ?~(text.next text.i.render :(weld text.i.render " " text.next)) + -- + == + -- +:: +:: Convenience function to build a `plumfmt` for a rune with a fixed +:: number of parameters. +:: +++ fixed + |= rune=@ta + ^- plumfmt + [wide=`[' ' `[(cat 3 +< '(') ')']] tall=`[+< ~]] +:: +:: Same as `fixed` but only outputs in `tall` mode. +:: +++ tall-fixed + |= rune=cord + ^- (unit [cord (unit [cord cord])]) + `[rune ~] +:: +:: Convenience function to build a the `tall` part of a `plumfmt` for +:: a running-style rune (one that takes a variable number of parameters +:: and has a terminator). +:: +++ tall-running + |= [rune=cord sigil=cord term=cord] + ^- (unit [cord (unit [cord cord])]) + `[rune `[sigil term]] +:: +:: Convenience function for rendering a rune into a plum. This takes +:: a rune, an optional tall-form terminator, optionally a short-form (if +:: you don't supply a short-form, it'll just construct the standard +:: wide-form (e.g. "?~(x x ~)") for you, and a list of sub-plums. +:: +++ rune + |= $: rune=cord + term=(unit cord) + short=(unit [cord cord cord]) + kids=(list plum) + == + ^. plum + |^ :- %sbrk + :+ %tree + :- (rune-wide-form rune short) + ?~ term (tall-fixed rune) + (tall-running rune '' u.term) + kids + :: + :: If you just give this a rune, it'll build the standard wide-form. + :: Otherwise, it'll just use the one that you gave it. + :: + ++ rune-wide-form + |= [rune=cord short=(unit [fst=cord mid=cord lst=cord])] + ^- (unit (pair cord (unit [cord cord]))) + =* fst (cat 3 rune '(') + =* std `[' ' `[fst ')']] + ?~ short std + `[mid.u.short `[fst.u.short lst.u.short]] + -- +:: +:: Just a helper function for constructing a wide-form %tree plum. +:: +++ simple-wide + |= [init=cord sep=cord end=cord kids=(list plum)] + ^- plum + =/ fmt=plumfmt [wide=[~ sep [~ init end]] tall=~] + [%tree fmt kids] +:: +:: Convenience function that builds a plum for a subexpression. The +:: `%sbrk` tells the pretty-printer that this is a valid place to +:: switch from tall mode to wide mode. +:: +++ subtree + |= [p=plumfmt q=(list plum)] + ^- plum + [%sbrk [%tree p q]] +:: +:: Convenience for generating plums that look like s-expressions. Useful +:: for quickly getting decent-looking debug output. +:: +++ sexp + |= [sym=cord kids=(list plum)] + ^- plum + =/ head=cord (cat 3 '(' sym) + =/ headspc=cord (cat 3 head ' ') + =/ symcol=cord (cat 3 sym ':') + =/ fmt=plumfmt [[~ ' ' [~ headspc ')']] [~ symcol [~ '' '']]] + ?~ kids (cat 3 '(' (cat 3 sym ')')) + [%sbrk [%tree fmt kids]] +-- diff --git a/pkg/arvo/lib/pprint.hoon b/pkg/arvo/lib/pprint.hoon index fcb2cf518..310c0f640 100644 --- a/pkg/arvo/lib/pprint.hoon +++ b/pkg/arvo/lib/pprint.hoon @@ -1,4 +1,6 @@ -/+ libxray=xray +/- *plum, *xray +/+ *plume, + libxray=xray :: :: This code pretty-prints a variety of things using the `xray` and :: `plum` libraries: @@ -117,14 +119,18 @@ ++ type-to-tank |= t=type ^- tank - [%plum (type-to-plum t)] + :+ %rose [~ ~ ~] + %+ turn (render-type t) + |=(=cord leaf+(trip cord)) :: :: Pretty-print a vase to a tank. :: ++ vase-to-tank |= v=vase ^- tank - [%plum (vase-to-plum v)] + :+ %rose [~ ~ ~] + %+ turn (render-vase v) + |=(=cord leaf+(trip cord)) :: :: Render an `axis`. :: @@ -151,7 +157,7 @@ limb ?- -.limb %& (axis-to-cord p.limb) - :: {%| p/@ud q/(unit term) ] + :: [%| p=@ud q=(unit term) ] %| (crip (runt [0 p.limb] ?~(q.limb "," (trip u.q.limb)))) == :: @@ -340,7 +346,7 @@ [%brsg *] (rune '|~' ~ ~ (spec p.x) (hn q.x) ~) [%brtr *] (rune '|*' ~ ~ (spec p.x) (hn q.x) ~) [%brts *] (rune '|=' ~ ~ (spec p.x) (hn q.x) ~) - [%brvt *] (chapter '|@' ~ q.x) :: Ignoring p.x + [%brpt *] (chapter '|@' ~ q.x) :: Ignoring p.x [%brwt *] (rune '|?' ~ ~ (hn p.x) ~) [%clcb *] (rune ':_' ~ ~ (hoons ~[p q]:x)) [%clkt *] (rune ':^' ~ ~ (hoons ~[p q r s]:x)) @@ -366,11 +372,10 @@ [%dtts *] (rune '.=' ~ `['=(' spc ')'] (hoons ~[p q]:x)) [%dtwt *] (rune '.?' ~ ~ (hoons ~[p.x])) [%ktbr *] (rune '^|' ~ ~ (hoons ~[p.x])) - [%ktcn *] (rune '^%' ~ ~ (hoons ~[p]:x)) [%ktdt *] (rune '^.' ~ ~ (hoons ~[p q]:x)) [%ktls *] (rune '^+' ~ ~ (hoons ~[p q]:x)) [%kthp *] (rune '^-' ~ ~ ~[(spec p.x) (hn q.x)]) - [%ktpd *] (rune '^&' ~ ~ (hoons ~[p]:x)) + [%ktpm *] (rune '^&' ~ ~ (hoons ~[p]:x)) [%ktsg *] (rune '^~' ~ ~ (hoons ~[p]:x)) [%ktts *] (rune '^=' ~ `['' '=' ''] ~[(skin p.x) (hn q.x)]) [%ktwt *] (rune '^?' ~ ~ (hoons ~[p]:x)) @@ -379,56 +384,58 @@ [%sgbr *] (rune '~|' ~ ~ (hoons ~[p q]:x)) [%sgcb *] (rune '~_' ~ ~ (hoons ~[p q]:x)) [%sgcn *] (rune '~%' ~ ~ (chum p.x) (hn q.x) (tyre r.x) (hn s.x) ~) - [%sgnt *] (rune '~/' ~ ~ (chum p.x) (hn q.x) ~) - [%sgld *] (rune '~<' ~ ~ (hint p.x) (hn q.x) ~) - [%sgbn *] (rune '~>' ~ ~ (hint p.x) (hn q.x) ~) - [%sgbs *] (rune '~$' ~ ~ p.x (hn q.x) ~) + [%sgfs *] (rune '~/' ~ ~ (chum p.x) (hn q.x) ~) + [%sggl *] (rune '~<' ~ ~ (hint p.x) (hn q.x) ~) + [%sggr *] (rune '~>' ~ ~ (hint p.x) (hn q.x) ~) + [%sgbc *] (rune '~$' ~ ~ p.x (hn q.x) ~) [%sgls *] (rune '~+' ~ ~ (hn q.x) ~) :: Ignoring p.x - [%sgpd *] (rune '~&' ~ ~ (hoons ~[q r]:x)) :: Ignoring p.x + [%sgpm *] (rune '~&' ~ ~ (hoons ~[q r]:x)) :: Ignoring p.x [%sgts *] (rune '~=' ~ ~ (hoons ~[p q]:x)) [%sgwt *] (rune '~?' ~ ~ (hoons ~[q r s]:x)) :: Ignoring p.x [%sgzp *] (rune '~!' ~ ~ (hoons ~[p q]:x)) [%mcts *] %ast-node-mcts [%mccl *] (rune ';:' `'==' `[':(' spc ')'] (hoons [p q]:x)) - [%mcnt *] (rune ';/' ~ ~ (hoons ~[p]:x)) + [%mcfs *] (rune ';/' ~ ~ (hoons ~[p]:x)) [%mcgl *] (rune ';<' ~ ~ (spec p.x) (hoons ~[q r s]:x)) [%mcsg *] (rune ';~' `'==' ~ (hoons [p q]:x)) [%mcmc *] (rune ';;' ~ ~ ~[(spec p.x) (hn q.x)]) [%tsbr *] (rune '=|' ~ ~ ~[(spec p.x) (hn q.x)]) [%tscl *] (tiscol-to-plum p.x q.x) - [%tsnt *] (rune '=/' ~ ~ (skin p.x) (hn q.x) (hn r.x) ~) + [%tsfs *] (rune '=/' ~ ~ (skin p.x) (hn q.x) (hn r.x) ~) [%tsmc *] (rune '=;' ~ ~ [(skin p.x) (hoons ~[q r]:x)]) [%tsdt *] (rune '=.' ~ ~ [(wing p.x) (hoons ~[q r]:x)]) [%tswt *] (rune '=?' ~ ~ [(wing p.x) (hoons ~[q r s]:x)]) - [%tsld *] (rune '=>' ~ `['' ':' ''] (hoons ~[p q]:x)) +:: XX %tsld to %tsgl, but should be %tsgr? (to match =>) + [%tsgl *] (rune '=>' ~ `['' ':' ''] (hoons ~[p q]:x)) [%tshp *] (rune '=-' ~ ~ (hoons ~[p q]:x)) - [%tsbn *] (rune '=<' ~ ~ (hoons ~[p q]:x)) +:: XX %tsbn to %tsgr, but should be %tsgl? (to match =<) + [%tsgr *] (rune '=<' ~ ~ (hoons ~[p q]:x)) [%tskt *] (rune '=^' ~ ~ [(skin p.x) (wing q.x) (hoons ~[r s]:x)]) [%tsls *] (rune '=+' ~ ~ (hoons ~[p q]:x)) [%tssg *] (rune '=~' `'==' ~ (hoons p:x)) [%tstr *] ?~ q.p.x (rune '=*' ~ ~ p.p.x (hoons ~[q r]:x)) - (rune '=*' ~ ~ (spec [%bsts p.p.x u.q.p.x]) (hoons ~[q r]:x)) + (rune '=*' ~ ~ (spec [%bcts p.p.x u.q.p.x]) (hoons ~[q r]:x)) [%tscm *] (rune '=,' ~ ~ (hoons ~[p q]:x)) [%wtbr *] (rune '?|' `'--' `['|(' ' ' ')'] (hoons p:x)) [%wthp *] (rune '?-' `'==' ~ (wing p.x) (matches q.x)) [%wtcl *] (rune '?:' ~ ~ (hoons ~[p q r]:x)) [%wtdt *] (rune '?.' ~ ~ (hoons ~[p q r]:x)) [%wtkt *] (rune '?^' ~ ~ [(wing p.x) (hoons ~[q r]:x)]) - [%wtld *] (rune '?<' ~ ~ (hoons ~[p q]:x)) - [%wtbn *] (rune '?>' ~ ~ (hoons ~[p q]:x)) + [%wtgl *] (rune '?<' ~ ~ (hoons ~[p q]:x)) + [%wtgr *] (rune '?>' ~ ~ (hoons ~[p q]:x)) [%wtls *] (rune '?+' `'==' ~ (wing p.x) (hn q.x) (matches r.x)) - [%wtpd *] (rune '?&' `'==' `['&(' ' ' ')'] (hoons p:x)) - [%wtvt *] (rune '?@' ~ ~ (wing p.x) (hoons ~[q r]:x)) + [%wtpm *] (rune '?&' `'==' `['&(' ' ' ')'] (hoons p:x)) + [%wtpt *] (rune '?@' ~ ~ (wing p.x) (hoons ~[q r]:x)) [%wtsg *] (rune '?~' ~ ~ (wing p.x) (hoons ~[q r]:x)) [%wthx *] (rune '?#' ~ ~ (skin p.x) (wing q.x) ~) [%wtts *] (rune '?=' ~ ~ (spec p.x) (wing q.x) ~) [%wtzp *] (rune '?!' ~ `['!' '' ''] (hoons ~[p]:x)) [%zpcm *] (rune '!,' ~ ~ (hoons ~[p q]:x)) - [%zpbn *] (rune '!>' ~ ~ (hoons ~[p]:x)) + [%zpgr *] (rune '!>' ~ ~ (hoons ~[p]:x)) [%zpmc *] (rune '!;' ~ ~ (hoons ~[p q]:x)) [%zpts *] (rune '!=' ~ ~ (hoons ~[p]:x)) - [%zpvt *] (rune '!@' ~ ~ (wingseq p.x) (hoons ~[q r]:x)) + [%zppt *] (rune '!@' ~ ~ (wingseq p.x) (hoons ~[q r]:x)) [%zpwt *] (hn q.x) :: Ignore p.x [%zpzp ~] '!!' == @@ -642,37 +649,37 @@ ?: =(- 3) '%^' ?: =(- 2) '%+' '%-' [(dohoon p.spec) (turn q.spec ..$)] - %bsbs (core-spec-to-plum '$$' p.spec q.spec) - %bsbr (subtree (fixed '$|') $(spec p.spec) (dohoon q.spec) ~) - %bscb (dohoon p.spec) - %bscl :- %sbrk + %bcbc (core-spec-to-plum '$$' p.spec q.spec) + %bcbr (subtree (fixed '$|') $(spec p.spec) (dohoon q.spec) ~) + %bccb (dohoon p.spec) + %bccl :- %sbrk :+ %tree [`[' ' `['[' ']']] `['$:' `['' '==']]] (turn `(list ^spec)`+.spec ..$) - %bscn (subtree (varying '$%' '==') (turn `(list ^spec)`+.spec ..$)) - %bsdt (core-spec-to-plum '$.' p.spec q.spec) - %bsld (subtree (fixed '$<') $(spec p.spec) $(spec q.spec) ~) - %bsbn (subtree (fixed '$>') $(spec p.spec) $(spec q.spec) ~) - %bshp (subtree (fixed '$-') $(spec p.spec) $(spec q.spec) ~) - %bskt (subtree (fixed '$^') $(spec p.spec) $(spec q.spec) ~) - %bsls (subtree (fixed '$+') (stud-to-plum p.spec) $(spec q.spec) ~) - %bsnt (core-spec-to-plum '$/' p.spec q.spec) - %bsmc (subtree (fixed '$;') (dohoon p.spec) ~) - %bspd (subtree (fixed '$&') $(spec p.spec) (dohoon q.spec) ~) - %bssg (subtree (fixed '$~') (dohoon p.spec) $(spec q.spec) ~) - %bstc (core-spec-to-plum '$`' p.spec q.spec) - %bsts :- %sbrk + %bccn (subtree (varying '$%' '==') (turn `(list ^spec)`+.spec ..$)) + %bcdt (core-spec-to-plum '$.' p.spec q.spec) + %bcgl (subtree (fixed '$<') $(spec p.spec) $(spec q.spec) ~) + %bcgr (subtree (fixed '$>') $(spec p.spec) $(spec q.spec) ~) + %bchp (subtree (fixed '$-') $(spec p.spec) $(spec q.spec) ~) + %bckt (subtree (fixed '$^') $(spec p.spec) $(spec q.spec) ~) + %bcls (subtree (fixed '$+') (stud-to-plum p.spec) $(spec q.spec) ~) + %bcfs (core-spec-to-plum '$/' p.spec q.spec) + %bcmc (subtree (fixed '$;') (dohoon p.spec) ~) + %bcpm (subtree (fixed '$&') $(spec p.spec) (dohoon q.spec) ~) + %bcsg (subtree (fixed '$~') (dohoon p.spec) $(spec q.spec) ~) + %bctc (core-spec-to-plum '$`' p.spec q.spec) + %bcts :- %sbrk :+ %tree [`['=' ~] `['$=' ~]] :~ (skin-to-plum p.spec) $(spec q.spec) == - %bsvt (subtree (fixed '$@') $(spec p.spec) $(spec q.spec) ~) - %bswt :- %sbrk + %bcpt (subtree (fixed '$@') $(spec p.spec) $(spec q.spec) ~) + %bcwt :- %sbrk :+ %tree [`[' ' `['?(' ')']] `['$?' `['' '==']]] (turn `(list ^spec)`+.spec ..$) - %bszp (core-spec-to-plum '$.' p.spec q.spec) + %bczp (core-spec-to-plum '$.' p.spec q.spec) == :: ++ varying @@ -850,7 +857,7 @@ |= [=sample=xkey =product=xkey] ^- plum %- spec-to-plum :* - %bshp + %bchp (ximage-to-spec:libxray sample-xkey img) (ximage-to-spec:libxray product-xkey img) == diff --git a/pkg/arvo/lib/pretty-file.hoon b/pkg/arvo/lib/pretty-file.hoon index e35ff1f7c..537533809 100644 --- a/pkg/arvo/lib/pretty-file.hoon +++ b/pkg/arvo/lib/pretty-file.hoon @@ -7,24 +7,24 @@ =< pretty-file |% ++ pretty-noun - |= pri/* ^- tank + |= pri=* ^- tank ?~ pri leaf+"~" ?@ pri leaf+?:(((sane %tas) pri) <`@tas`pri> ) =< rose+[" " ?:(- "~[" "[") "]"]^+ - |- ^- {? (list tank)} + |- ^- [? (list tank)] ?~ +.pri [& ^$(pri -.pri) ~] ?@ +.pri [| ^$(pri -.pri) ^$(pri +.pri) ~] [+< - +>]:[^$(pri -.pri) $(pri +.pri)] :: -++ vale-cord |=(a/cord `?`(levy (trip a) |=(b/@ |((gte b 32) =(10 b))))) +++ vale-cord |=(a=cord `?`(levy (trip a) |=(b=@ |((gte b 32) =(10 b))))) :: -++ wain-to-tang |=(a/wain (turn a |=(b/cord leaf+(trip b)))) +++ wain-to-tang |=(a=wain (turn a |=(b=cord leaf+(trip b)))) ++ pretty-file - |= fyl/* ^- tang + |= fyl=* ^- tang =+ `(unit wain)`?@(fyl `(to-wain:format fyl) ((soft wain) fyl)) ?^ - (wain-to-tang u) [(pretty-noun fyl)]~ diff --git a/pkg/arvo/lib/primitive-rsa.hoon b/pkg/arvo/lib/primitive-rsa.hoon index 98a4e03c8..45ae40ff6 100644 --- a/pkg/arvo/lib/primitive-rsa.hoon +++ b/pkg/arvo/lib/primitive-rsa.hoon @@ -5,7 +5,7 @@ |% :: +key:rsa: rsa public or private key :: -+= key ++$ key $: :: pub: public parameters (n=modulus, e=pub-exponent) :: pub=[n=@ux e=@ux] @@ -39,7 +39,7 @@ =/ e :(con 1 (lsh 0 (dec a) 1) (~(raw og c) a)) :: XX what algorithm is this modular remainder check? :: - ?: ?& (levy b |=(f/@ !=(1 (mod e f)))) + ?: ?& (levy b |=(f=@ !=(1 (mod e f)))) (pram:number e) == e diff --git a/pkg/arvo/lib/ring.hoon b/pkg/arvo/lib/ring.hoon index b51b58418..e1f594941 100644 --- a/pkg/arvo/lib/ring.hoon +++ b/pkg/arvo/lib/ring.hoon @@ -319,7 +319,7 @@ :: +seed-to-private-key-scalar: keyfile form to scalar we can multiply with :: ++ seed-to-private-key-scalar - |= sk/@I ^- @udscalar + |= sk=@I ^- @udscalar ?: (gth (met 3 sk) 32) !! =+ h=(shal (rsh 0 3 b:ed:crypto) sk) %+ add diff --git a/pkg/arvo/lib/show-dir.hoon b/pkg/arvo/lib/show-dir.hoon index 8154df0e8..bc73b9942 100644 --- a/pkg/arvo/lib/show-dir.hoon +++ b/pkg/arvo/lib/show-dir.hoon @@ -3,20 +3,20 @@ :::: /hoon/show-dir/lib :: /? 310 -|= {vane/?($g $c) pax/path des/(map @t ~)} +|= [vane=?(%g %c) pax=path des=(map @t ~)] ^- tank :+ %rose [" " `~] %+ turn (sort ~(tap by des) aor) -|= {kid/@ta ~} +|= [kid=@ta ~] =+ paf=`path`/[kid] =- :+ %rose ["/" ~ ?:(dir "/" ~)] - (turn paf |=(a/knot leaf+(trip a))) -|- ^- {dir/? paf/path} + (turn paf |=(a=knot leaf+(trip a))) +|- ^- [dir=? paf=path] =+ arf=.^(arch (cat 3 vane %y) (weld pax paf)) ?^ fil.arf [| paf] ?~ dir.arf [& paf] :: !! -?. ?=({^ ~ ~} dir.arf) +?. ?=([^ ~ ~] dir.arf) [& paf] $(paf (welp paf /[p.n.dir.arf])) diff --git a/pkg/arvo/lib/sole.hoon b/pkg/arvo/lib/sole.hoon index 91ffe3c3e..66684668a 100644 --- a/pkg/arvo/lib/sole.hoon +++ b/pkg/arvo/lib/sole.hoon @@ -8,17 +8,17 @@ |_ sole-share :: shared-state engine ++ abet +< ++ apply - |= ted/sole-edit + |= ted=sole-edit ^+ +> ?- -.ted - $del +>.$(buf (weld (scag p.ted buf) (slag +(p.ted) buf))) - $ins +>.$(buf (weld (scag p.ted buf) `_buf`[q.ted (slag p.ted buf)])) - $mor |- ^+ +>.^$ + %del +>.$(buf (weld (scag p.ted buf) (slag +(p.ted) buf))) + %ins +>.$(buf (weld (scag p.ted buf) `_buf`[q.ted (slag p.ted buf)])) + %mor |- ^+ +>.^$ ?~ p.ted +>.^$ $(p.ted t.p.ted, +>.^$ ^$(ted i.p.ted)) - $nop +>.$ - $set +>.$(buf p.ted) + %nop +>.$ + %set +>.$(buf p.ted) == :: :::: @@ -31,43 +31,43 @@ :: (apply:(apply b) y) :: ++ transmute :: dex as after sin - |= {sin/sole-edit dex/sole-edit} + |= [sin=sole-edit dex=sole-edit] ~| [%transmute sin dex] ^- sole-edit - ?: ?=($mor -.sin) + ?: ?=(%mor -.sin) |- ^- sole-edit ?~ p.sin dex $(p.sin t.p.sin, dex ^$(sin i.p.sin)) :: - ?: ?=($mor -.dex) + ?: ?=(%mor -.dex) :- %mor |- ^- (list sole-edit) ?~ p.dex ~ [^$(dex i.p.dex) $(p.dex t.p.dex)] :: - ?: |(?=($nop -.sin) ?=($nop -.dex)) dex - ?: ?=($set -.sin) [%nop ~] - ?: ?=($set -.dex) dex + ?: |(?=(%nop -.sin) ?=(%nop -.dex)) dex + ?: ?=(%set -.sin) [%nop ~] + ?: ?=(%set -.dex) dex :: ?- -.sin - $del + %del ?- -.dex - $del ?: =(p.sin p.dex) [%nop ~] + %del ?: =(p.sin p.dex) [%nop ~] ?:((lth p.sin p.dex) dex(p (dec p.dex)) dex) - $ins ?:((lth p.sin p.dex) dex(p (dec p.dex)) dex) + %ins ?:((lth p.sin p.dex) dex(p (dec p.dex)) dex) == :: - $ins + %ins ?- -.dex - $del ?:((lte p.sin p.dex) dex(p +(p.dex)) dex) - $ins ?: =(p.sin p.dex) + %del ?:((lte p.sin p.dex) dex(p +(p.dex)) dex) + %ins ?: =(p.sin p.dex) ?:((lth q.sin q.dex) dex dex(p +(p.dex))) ?:((lte p.sin p.dex) dex(p +(p.dex)) dex) == == :: ++ commit :: local change - |= ted/sole-edit + |= ted=sole-edit ^- sole-share abet:(apply(own.ven +(own.ven), leg [ted leg]) ted) :: @@ -79,25 +79,25 @@ :: =(+> (apply:(apply a) (inverse a))) :: ++ inverse :: relative inverse - |= ted/sole-edit + |= ted=sole-edit ^- sole-edit - =. ted ?.(?=({$mor * ~} ted) ted i.p.ted) + =. ted ?.(?=([%mor * ~] ted) ted i.p.ted) ?- -.ted - $del [%ins p.ted (snag p.ted buf)] - $ins [%del p.ted] - $mor :- %mor + %del [%ins p.ted (snag p.ted buf)] + %ins [%del p.ted] + %mor :- %mor %- flop |- ^- (list sole-edit) ?~ p.ted ~ :- ^$(ted i.p.ted) $(p.ted t.p.ted, +>.^$ (apply i.p.ted)) - $nop [%nop ~] - $set [%set buf] + %nop [%nop ~] + %set [%set buf] == :: ++ receive :: naturalize event |= sole-change - ^- {sole-edit sole-share} + ^- [sole-edit sole-share] ?. &(=(his.ler his.ven) (lte own.ler own.ven)) ~| [%receive-sync his+[his.ler his.ven] own+[own.ler own.ven]] !! @@ -110,8 +110,8 @@ [dat abet:(apply(his.ven +(his.ven)) dat)] :: ++ remit :: conditional accept - |= {cal/sole-change ask/$-((list @c) ?)} - ^- {(unit sole-change) sole-share} + |= [cal=sole-change ask=$-((list @c) ?)] + ^- [(unit sole-change) sole-share] =+ old=buf =^ dat +>+<.$ (receive cal) ?: (ask buf) @@ -120,20 +120,20 @@ [`lic +>+<.$] :: ++ transmit :: outgoing change - |= ted/sole-edit - ^- {sole-change sole-share} + |= ted=sole-edit + ^- [sole-change sole-share] [[[his.ven own.ven] (sham buf) ted] (commit ted)] :: ++ transceive :: receive and invert |= sole-change - ^- {sole-edit sole-share} + ^- [sole-edit sole-share] =+ old=buf =^ dat +>+<.$ (receive +<.$) [(inverse(buf old) dat) +>+<.$] :: ++ transpose :: adjust position - |= pos/@ud + |= pos=@ud =+ dat=(transmute [%mor leg] [%ins pos `@c`0]) - ?> ?=($ins -.dat) + ?> ?=(%ins -.dat) p.dat -- diff --git a/pkg/arvo/lib/soto.hoon b/pkg/arvo/lib/soto.hoon index ef39e79ce..6077c6c4f 100644 --- a/pkg/arvo/lib/soto.hoon +++ b/pkg/arvo/lib/soto.hoon @@ -39,17 +39,17 @@ =, enjs:format ?+ -.sef ~|(unsupported-effect+-.sef !!) - $mor [%a (turn p.sef |=(a/sole-effect ^$(sef a)))] - $err (frond %hop (numb p.sef)) - $txt (frond %txt (tape p.sef)) - $tan (frond %tan (tape (wush 160 p.sef))) - $det (frond %det json:~(grow mar-sole-change +.sef)) + %mor [%a (turn p.sef |=(a=sole-effect ^$(sef a)))] + %err (frond %hop (numb p.sef)) + %txt (frond %txt (tape p.sef)) + %tan (frond %tan (tape (wush 160 p.sef))) + %det (frond %det json:~(grow mar-sole-change +.sef)) :: - $pro + %pro %+ frond %pro (pairs vis+b+vis.sef tag+s+tag.sef cad+(tape (purge cad.sef)) ~) :: - $tab + %tab :- %a %+ turn p.sef |= [=cord =^tank] @@ -59,7 +59,7 @@ info+(tape ~(ram re tank)) == :: - ?($bel $clr $nex) + ?(%bel %clr %nex) (frond %act %s -.sef) == ++ mar-sole-change @@ -72,11 +72,11 @@ =,(cha (pairs ted+(edi ted) ler+a+~[(numb own.ler) (numb his.ler)] ~)) |= det=sole-edit ?- -.det - $nop [%s 'nop'] - $mor [%a (turn p.det ..$)] - $del (frond %del (numb p.det)) - $set (frond %set (tape (tufa p.det))) - $ins (frond %ins (pairs at+(numb p.det) cha+s+(tuft q.det) ~)) + %nop [%s 'nop'] + %mor [%a (turn p.det ..$)] + %del (frond %del (numb p.det)) + %set (frond %set (tape (tufa p.det))) + %ins (frond %ins (pairs at+(numb p.det) cha+s+(tuft q.det) ~)) == -- -- diff --git a/pkg/arvo/lib/strandio.hoon b/pkg/arvo/lib/strandio.hoon index bc17a2835..e1a5b1c09 100644 --- a/pkg/arvo/lib/strandio.hoon +++ b/pkg/arvo/lib/strandio.hoon @@ -424,7 +424,7 @@ =/ m (strand ,vase) ^- form:m ;< =riot:clay bind:m - (warp ship desk ~ %sing %a case (flop spur)) + (warp ship desk ~ %sing %a case spur) ?~ riot (strand-fail %build-file >arg< ~) ?> =(%vase p.r.u.riot) @@ -468,7 +468,7 @@ |= [[=ship =desk =case:clay] =spur] =* arg +< =/ m (strand ,cage) - ;< =riot:clay bind:m (warp ship desk ~ %sing %x case (flop spur)) + ;< =riot:clay bind:m (warp ship desk ~ %sing %x case spur) ?~ riot (strand-fail %read-file >arg< ~) (pure:m r.u.riot) @@ -476,14 +476,14 @@ ++ check-for-file |= [[=ship =desk =case:clay] =spur] =/ m (strand ,?) - ;< =riot:clay bind:m (warp ship desk ~ %sing %x case (flop spur)) + ;< =riot:clay bind:m (warp ship desk ~ %sing %x case spur) (pure:m ?=(^ riot)) :: ++ list-tree |= [[=ship =desk =case:clay] =spur] =* arg +< =/ m (strand ,(list path)) - ;< =riot:clay bind:m (warp ship desk ~ %sing %t case (flop spur)) + ;< =riot:clay bind:m (warp ship desk ~ %sing %t case spur) ?~ riot (strand-fail %list-tree >arg< ~) (pure:m !<((list path) q.r.u.riot)) diff --git a/pkg/arvo/lib/test/runner.hoon b/pkg/arvo/lib/test/runner.hoon index 75d6d2d5f..2f1e708df 100644 --- a/pkg/arvo/lib/test/runner.hoon +++ b/pkg/arvo/lib/test/runner.hoon @@ -31,7 +31,7 @@ `tang`[[%leaf (weld "FAILED " name)] ~] ::TODO indent :: %+ turn p:run - :: |= {i/tape} + :: |= [i=tape] :: ^- tank :: [%leaf (weld " " i)] p.run diff --git a/pkg/arvo/lib/time-to-id.hoon b/pkg/arvo/lib/time-to-id.hoon index 0311b67b2..ce2040650 100644 --- a/pkg/arvo/lib/time-to-id.hoon +++ b/pkg/arvo/lib/time-to-id.hoon @@ -6,5 +6,5 @@ :: :::: ~fyr :: -|= a/time ^- tape +|= a=time ^- tape ['c' (s-co:co f:(yell a))] diff --git a/pkg/arvo/lib/tree.hoon b/pkg/arvo/lib/tree.hoon index 33226b808..2d0d1174f 100644 --- a/pkg/arvo/lib/tree.hoon +++ b/pkg/arvo/lib/tree.hoon @@ -5,9 +5,9 @@ :: |% ++ getall :: search in manx - |= tag/(list mane) - |= ele/manx ^- marl - ?: (lien tag |=(a/mane =(a n.g.ele))) + |= tag=(list mane) + |= ele=manx ^- marl + ?: (lien tag |=(a=mane =(a n.g.ele))) ~[ele] (zing (turn c.ele ..$)) :: @@ -17,16 +17,16 @@ ++ read-schem :: decode gapped noun =< (cook to-noun (cook build-grove apex)) |% - ++ noun $@(term {noun noun}) :: shadow + ++ noun $@(term [noun noun]) :: shadow :: improper list of possible entry points - ++ grove $@(term {gap/@ sealed/noun pending/grove}) + ++ grove $@(term [gap=@ sealed=noun pending=grove]) ++ apex ;~(plug sym (star ;~(plug delim sym))) ++ delim ;~(pose (cold 0 dot) (cook lent (plus cab))) - ++ to-noun |=(a/grove ?@(a a [sealed.a $(a pending.a)])) + ++ to-noun |=(a=grove ?@(a a [sealed.a $(a pending.a)])) ++ build-grove - |= {a/grove b/(list {p/@u q/term})} ^- grove + |= [a=grove b=(list [p=@u q=term])] ^- grove %+ roll b =< .(acc a) - |= {{gap/@u v/term} acc/grove} ^- grove + |= [[gap=@u v=term] acc=grove] ^- grove ?@ acc [gap acc v] ?: (gth gap gap.acc) [gap (to-noun acc) v] acc(pending $(acc pending.acc)) diff --git a/pkg/arvo/lib/urb-split.hoon b/pkg/arvo/lib/urb-split.hoon index 3a3871ad0..139357710 100644 --- a/pkg/arvo/lib/urb-split.hoon +++ b/pkg/arvo/lib/urb-split.hoon @@ -2,9 +2,9 @@ :::: /hoon/urb-split/lib :: /? 310 -|= {dep/@uvH urb/manx} ^- {hed/{@uvh marl} bod/{@uvH marl}} +|= [dep=@uvH urb=manx] ^- [hed=[@uvh marl] bod=[@uvH marl]] ~| [%malformed-urb urb] :: XX types -?> ?=({{$html ~} {{$head ~} *} {{$body ~} *} ~} urb) -=+ `{{$html ~} {{$head ~} hed/marl} {{$body ~} bod/marl} ~}`urb +?> ?=([[%html ~] [[%head ~] *] [[%body ~] *] ~] urb) +=+ `[[%html ~] [[%head ~] hed=marl] [[%body ~] bod=marl] ~]`urb :- [dep hed] :: Assume all dependencies are hard [0v0 bod] diff --git a/pkg/arvo/lib/xray.hoon b/pkg/arvo/lib/xray.hoon index b9d340255..2e6e2f32f 100644 --- a/pkg/arvo/lib/xray.hoon +++ b/pkg/arvo/lib/xray.hoon @@ -1,3 +1,4 @@ +/- *plum, *xray :: :: # Type Analysis :: @@ -355,8 +356,8 @@ =^ params=(list xkey) st |- ^- [(list xkey) xtable] ?~ u.q.note [~ st] - =/ tsld [%tsld [%limb %$] [%wing i.u.q.note]] - =/ part (~(play ut subject-of-note) tsld) + =/ tsgl [%tsgl [%limb %$] [%wing i.u.q.note]] + =/ part (~(play ut subject-of-note) tsgl) =^ this st (main st part) =^ more st $(u.q.note t.u.q.note) [[this more] st] @@ -1318,7 +1319,7 @@ :: =^ i=xkey st ^- [xkey xtable] - %+ (fold {xkey xtable} xkey) + %+ (fold ,[xkey xtable] xkey) [[void st] ~(tap in fork)] |= [[k=xkey tbl=xtable] branch=xkey] ^- [xkey xtable] @@ -1416,8 +1417,8 @@ :: coherent `xrole` (where possible, otherwise a %misjunction). :: :: This often needs to restructure things. For example, if we are - :: combining `{{~ ~} {%a ~}}` and `{{~ ~} {%b ~}}`, we should produce - :: `{{~ ~} ?%({%a ~} {%b ~})}`. + :: combining `[[~ ~] [%a ~]]` and `[[~ ~] [%b ~]]`, we should produce + :: `[[~ ~] ?%([%a ~] [%b ~])]`. :: :: This is a massive switch on the xroles of the two arguments. This :: is *very* easy to get wrong, so I structured things this in a @@ -1774,34 +1775,34 @@ =/ tl `spec`$(i tail.d) =/ both-basic &(=([%base %noun] hd) =([%base %noun] tl)) ?: both-basic [%base %cell] - ?: ?=(%bscl -.tl) [%bscl hd +.tl] - [%bscl hd tl ~] + ?: ?=(%bccl -.tl) [%bccl hd +.tl] + [%bccl hd tl ~] %core =/ payld $(i xray.d) =/ batt ^- (map term spec) %- ~(run by (flatten-battery batt.d)) |= =xkey ^$(i xkey) ?- r.garb.d - %lead [%bszp payld batt] - %gold [%bsdt payld batt] - %zinc [%bstc payld batt] - %iron [%bsnt payld batt] + %lead [%bczp payld batt] + %gold [%bcdt payld batt] + %zinc [%bctc payld batt] + %iron [%bcfs payld batt] == %pntr !! %face =/ =spec $(i xray.d) - ?^(face.d spec [%bsts face.d spec]) + ?^(face.d spec [%bcts face.d spec]) %fork =/ =xrole (need xrole.x) |^ ?+ xrole ~& [%unexpected-fork-xrole xkey.x d xrole choices] - [%bswt choices] + [%bcwt choices] %noun [%base %noun] %void [%base %void] - [%option *] [%bswt choices] - [%union *] [%bscn choices] - [%misjunction *] [%bswt choices] - [%junction *] :+ %bsvt + [%option *] [%bcwt choices] + [%union *] [%bccn choices] + [%misjunction *] [%bcwt choices] + [%junction *] :+ %bcpt ^$(i flat.xrole) ^$(i deep.xrole) - [%conjunction *] :+ %bskt + [%conjunction *] :+ %bckt ^$(i wide.xrole) ^$(i tall.xrole) == @@ -1821,7 +1822,7 @@ ^- spec ?. (need loop.xr) sp =/ nm (synthetic xkey.xr) - [%bsbs [%loop nm] [[nm sp] ~ ~]] + [%bcbc [%loop nm] [[nm sp] ~ ~]] :: :: If we have a `recipe`, we can generate much nicer output. :: @@ -1843,7 +1844,7 @@ ++ synthetic |= number=@ud ^- @tas - =/ alf/(list term) + =/ alf=(list term) ^~ :~ %alf %bet %gim %dal %hej %vav %zay %het %tet %yod %kaf %lam %mem %nun %sam %ayn %pej %sad %qof %res %sin %tav @@ -1864,4 +1865,77 @@ (~(uni by q.q.i.chapters) $(chapters t.chapters)) :: -- +:: +:: Left-fold over a list. +:: +:: This is `roll`, but with explicit type parameters. +:: +++ fold + |* [state=mold elem=mold] + |= [[st=state xs=(list elem)] f=$-([state elem] state)] + ^- state + |- + ?~ xs st + $(xs t.xs, st (f st i.xs)) +:: +:: This is basically a `mapM` over a list using the State monad. +:: +:: Another way to think about this is that it is the same as `turn`, +:: except that a state variable `st` is threaded through the +:: execution. The list is processed from left to right. +:: +:: This is `spin`, but with explicit type parameters. +:: +++ traverse + |* [state=mold in=mold out=mold] + |= [[st=state xs=(list in)] f=$-([state in] [out state])] + ^- [(list out) state] + ?~ xs [~ st] + =^ r st (f st i.xs) + =^ rs st $(xs t.xs, st st) + [[r rs] st] +:: +:: `traverse` over a set. +:: +++ traverse-set + |* [state=mold input=mold out=mold] + |= [[st=state xs=(set input)] f=$-([state input] [out state])] + ^- [(set out) state] + :: + =^ elems st ((traverse state input out) [st ~(tap in xs)] f) + :_ st (~(gas in *(set out)) elems) +:: +:: `traverse` over a map, also passing the key to the folding function. +:: +++ traverse-map + |* [state=mold key=mold in=mold out=mold] + |= [[st=state dict=(map key in)] f=$-([state key in] [out state])] + ^- [(map key out) state] + :: + =^ pairs=(list (pair key out)) st + %+ (traverse state (pair key in) (pair key out)) + [st ~(tap by dict)] + |= [st=state k=key x=in] + ^- [(pair key out) state] + =^ v st (f st k x) + [[k v] st] + :: + :_ st + (~(gas by *(map key out)) pairs) +:: +:: Given a map, return its inverse: For each value, what are the set +:: of associated keys? +:: +++ reverse-map + |* [key=mold val=mold] + |= tbl=(map key val) + =/ init *(map val (set key)) + ^- _init + %+ (fold _init (pair key val)) + [init ~(tap by tbl)] + |= [acc=_init k=key v=val] + ^- _init + =/ mb-keys (~(get by acc) v) + =/ keys=(set key) ?~(mb-keys ~ u.mb-keys) + (~(put by acc) v (~(put in keys) k)) -- diff --git a/pkg/arvo/mar/atom.hoon b/pkg/arvo/mar/atom.hoon index a8927ee68..4f9004622 100644 --- a/pkg/arvo/mar/atom.hoon +++ b/pkg/arvo/mar/atom.hoon @@ -6,7 +6,7 @@ :::: A minimal atom mark :: =, mimes:html -|_ ato/@ +|_ ato=@ ++ grab |% ++ noun @ ++ mime |=([* p=octs] q.p) diff --git a/pkg/arvo/mar/css.hoon b/pkg/arvo/mar/css.hoon index f41e3390d..c4810b211 100644 --- a/pkg/arvo/mar/css.hoon +++ b/pkg/arvo/mar/css.hoon @@ -4,7 +4,7 @@ /? 310 =, eyre =, mimes:html -|_ mud/@t +|_ mud=@t ++ grow :: convert to |% ++ mime [/text/css (as-octs mud)] :: convert to %mime ++ elem ;style :: convert to %hymn diff --git a/pkg/arvo/mar/dill/belt.hoon b/pkg/arvo/mar/dill/belt.hoon index 05a2ddb9d..1677b6ef1 100644 --- a/pkg/arvo/mar/dill/belt.hoon +++ b/pkg/arvo/mar/dill/belt.hoon @@ -18,22 +18,22 @@ |% ++ json =< (cork . kyev) - |= jon/^json ^- ^kyev + |= jon=^json ^- ^kyev !! :: %- need :: %. jon => jo %- ot :: :~ mod+(cu silt (ar (su (perk ~[%ctrl %shift %alt %meta])))) :: :- %key -:: %+ cu |*(a/$%({$str @t} {$act @}) ?+(-.a a $str +.a)) +:: %+ cu |*(a=$%([%str @t] [%act @]) ?+(-.a a %str +.a)) :: =- (of [str+so act+(su (perk -)) ~]) :: :~ %ctrl %shift %alt %meta %entr %esc %caps %uncap :: %pgup %pgdn %home %end %baxp %del %ins :: %up %down %left %right :: == == ++ kyev - |= kev/^kyev ^- dill-belt:dill + |= kev=^kyev ^- dill-belt:dill ~| dill-belt-incomplete+kev - ?: ?=({$act ?($ctrl $shift $alt $meta)} q.kev) + ?: ?=([%act ?(%ctrl %shift %alt %meta)] q.kev) [%txt ~] :: ignore =+ mod=(~(del in p.kev) %shift) ?^ mod @@ -43,21 +43,21 @@ q.kev (con 96 q.kev) :: ctrl key decoding =+ cha=(tuba (trip q.kev)) - ?> ?=({@ ~} cha) :: of a single character + ?> ?=([@ ~] cha) :: of a single character ?+ mod !! :: modified by one buckykey - {$ctrl ~ ~} [%ctl i.cha] - {$alt ~ ~} [%met i.cha] + [%ctrl ~ ~] [%ctl i.cha] + [%alt ~ ~] [%met i.cha] == ?@ q.kev [%txt (tuba (trip q.kev))] ?+ +.q.kev !! - $del [%del ~] - $baxp [%bac ~] - $entr [%ret ~] - $up [%aro %u] - $down [%aro %d] - $left [%aro %l] - $right [%aro %r] + %del [%del ~] + %baxp [%bac ~] + %entr [%ret ~] + %up [%aro %u] + %down [%aro %d] + %left [%aro %l] + %right [%aro %r] == :: %yow, %rez? :: ++ noun dill-belt:dill :: clam from %noun diff --git a/pkg/arvo/mar/dill/blit.hoon b/pkg/arvo/mar/dill/blit.hoon index 2dc0acd7a..77e5cecf4 100644 --- a/pkg/arvo/mar/dill/blit.hoon +++ b/pkg/arvo/mar/dill/blit.hoon @@ -5,7 +5,7 @@ /- sole =, sole =, enjs:format -|_ dib/dill-blit:dill +|_ dib=dill-blit:dill ++ grad %noun :: ++ grab :: convert from @@ -18,10 +18,10 @@ ++ json ^- ^json ?+ -.dib ~|(unsupported-blit+-.dib !!) - $mor [%a (turn p.dib |=(a/dill-blit:dill json(dib a)))] - $hop (frond %hop (numb p.dib)) - ?($pro $out) (frond -.dib (tape (tufa p.dib))) - ?($bel $clr) (frond %act %s -.dib) + %mor [%a (turn p.dib |=(a=dill-blit:dill json(dib a)))] + %hop (frond %hop (numb p.dib)) + ?(%pro %out) (frond -.dib (tape (tufa p.dib))) + ?(%bel %clr) (frond %act %s -.dib) == -- -- diff --git a/pkg/arvo/mar/drum-put.hoon b/pkg/arvo/mar/drum-put.hoon index 956c3f4b1..29b6a10c3 100644 --- a/pkg/arvo/mar/drum-put.hoon +++ b/pkg/arvo/mar/drum-put.hoon @@ -2,7 +2,7 @@ :::: /hoon/do-claim/womb/mar :: /? 310 -|_ {path @} +|_ [path @] :: ++ grad %noun ++ grow @@ -11,6 +11,6 @@ -- ++ grab :: convert from |% - ++ noun {path @} :: clam from %noun + ++ noun [path @] :: clam from %noun -- -- diff --git a/pkg/arvo/mar/elem.hoon b/pkg/arvo/mar/elem.hoon index b8fb3a7fd..c7533ad90 100644 --- a/pkg/arvo/mar/elem.hoon +++ b/pkg/arvo/mar/elem.hoon @@ -4,7 +4,7 @@ /? 310 =, mimes:html =, html -|_ own/manx +|_ own=manx :: ++ grad %mime ++ grow :: convert to diff --git a/pkg/arvo/mar/front.hoon b/pkg/arvo/mar/front.hoon index c0e61be06..c3f2edc5c 100644 --- a/pkg/arvo/mar/front.hoon +++ b/pkg/arvo/mar/front.hoon @@ -5,7 +5,7 @@ :: :::: :: -|_ all/(map knot cord) +|_ all=(map knot cord) :: ++ grad %noun ++ grow :: convert to @@ -14,7 +14,7 @@ ++ json :- %o %- ~(run by all) - |=(a/cord s+a) + |=(a=cord s+a) -- ++ grab |% :: convert from ++ noun (map knot cord) :: clam from %noun diff --git a/pkg/arvo/mar/helm-hi.hoon b/pkg/arvo/mar/helm-hi.hoon index 940c91cfe..85c617f61 100644 --- a/pkg/arvo/mar/helm-hi.hoon +++ b/pkg/arvo/mar/helm-hi.hoon @@ -4,7 +4,7 @@ /? 310 =, mimes:html =, format -|_ txt/cord +|_ txt=cord :: ++ grad %mime ++ grab :: convert from diff --git a/pkg/arvo/mar/hoon.hoon b/pkg/arvo/mar/hoon.hoon index 3b4201aec..b6f590649 100644 --- a/pkg/arvo/mar/hoon.hoon +++ b/pkg/arvo/mar/hoon.hoon @@ -3,7 +3,7 @@ /? 310 :: =, eyre -|_ own/@t +|_ own=@t :: ++ grow :: convert to |% diff --git a/pkg/arvo/mar/htm.hoon b/pkg/arvo/mar/htm.hoon index 98f2ab819..a40a432dd 100644 --- a/pkg/arvo/mar/htm.hoon +++ b/pkg/arvo/mar/htm.hoon @@ -2,7 +2,7 @@ :::: /hoon/htm/mar :: /? 310 -|_ own/manx +|_ own=manx :: ++ grad %noun ++ grow :: convert to diff --git a/pkg/arvo/mar/html.hoon b/pkg/arvo/mar/html.hoon index 8c89e536d..4e161fae1 100644 --- a/pkg/arvo/mar/html.hoon +++ b/pkg/arvo/mar/html.hoon @@ -7,7 +7,7 @@ :: =, html ^| -|_ htm/@t +|_ htm=@t ++ grow :: convert to ^? |% :: @@ -17,7 +17,7 @@ ++ grab ^? |% :: convert from ++ noun @t :: clam from %noun - ++ mime |=([p=mite q=octs] q.q) :: retrieve form $mime + ++ mime |=([p=mite q=octs] q.q) :: retrieve form %mime -- ++ grad %mime -- diff --git a/pkg/arvo/mar/httr.hoon b/pkg/arvo/mar/httr.hoon index f9ae1fb0a..bbac8f990 100644 --- a/pkg/arvo/mar/httr.hoon +++ b/pkg/arvo/mar/httr.hoon @@ -6,7 +6,7 @@ =, eyre =, format =, html -|_ hit/httr +|_ hit=httr ++ grad %noun ++ grow |% ++ wall (turn wain trip) ++ wain (to-wain cord) diff --git a/pkg/arvo/mar/hymn.hoon b/pkg/arvo/mar/hymn.hoon index a56e3a0cf..d8ad09969 100644 --- a/pkg/arvo/mar/hymn.hoon +++ b/pkg/arvo/mar/hymn.hoon @@ -4,7 +4,7 @@ /? 310 =, mimes:html =, html -|_ own/manx +|_ own=manx :: ++ grad %mime ++ grow :: convert to diff --git a/pkg/arvo/mar/jam.hoon b/pkg/arvo/mar/jam.hoon index a8faf6fbb..672941f27 100644 --- a/pkg/arvo/mar/jam.hoon +++ b/pkg/arvo/mar/jam.hoon @@ -4,7 +4,7 @@ /? 310 :: =, mimes:html -|_ mud/@ +|_ mud=@ ++ grow |% ++ mime [/application/octet-stream (as-octs mud)] diff --git a/pkg/arvo/mar/js.hoon b/pkg/arvo/mar/js.hoon index 4b06573c7..e8fbe7701 100644 --- a/pkg/arvo/mar/js.hoon +++ b/pkg/arvo/mar/js.hoon @@ -4,7 +4,7 @@ /? 310 :: =, eyre -|_ mud/@ +|_ mud=@ ++ grow |% ++ mime [/application/javascript (as-octs:mimes:html (@t mud))] diff --git a/pkg/arvo/mar/json.hoon b/pkg/arvo/mar/json.hoon index e79bc7cd8..506b70835 100644 --- a/pkg/arvo/mar/json.hoon +++ b/pkg/arvo/mar/json.hoon @@ -8,7 +8,7 @@ =, eyre =, format =, html -|_ jon/json +|_ jon=json :: ++ grow :: convert to |% diff --git a/pkg/arvo/mar/json/rpc/response.hoon b/pkg/arvo/mar/json/rpc/response.hoon index 9f91469d0..df82433a9 100644 --- a/pkg/arvo/mar/json/rpc/response.hoon +++ b/pkg/arvo/mar/json/rpc/response.hoon @@ -12,10 +12,10 @@ |% ++ noun response :: from noun ++ httr :: from httr - |= hit/httr:eyre + |= hit=httr:eyre ^- response ~| hit - ?: ?=($2 (div p.hit 100)) + ?: ?=(%2 (div p.hit 100)) =, html %- json ?~ r.hit diff --git a/pkg/arvo/mar/lens/command.hoon b/pkg/arvo/mar/lens/command.hoon index 3f29fc833..1e70b360d 100644 --- a/pkg/arvo/mar/lens/command.hoon +++ b/pkg/arvo/mar/lens/command.hoon @@ -1,5 +1,5 @@ /- lens -|_ com/command:lens +|_ com=command:lens ++ grad %noun ++ grow |% @@ -9,7 +9,7 @@ |% ++ noun command:lens ++ json - |= jon/^json + |= jon=^json ^- command:lens ~| jon=jon %- need @@ -22,7 +22,7 @@ |% ++ source ^- $-(^^json (unit source:lens)) - |= jon/^^json + |= jon=^^json =+ tuple=%.(jon (ar source)) ?^ tuple `[%tuple u.tuple] diff --git a/pkg/arvo/mar/map.hoon b/pkg/arvo/mar/map.hoon index 2ef7c206d..e5d61eeef 100644 --- a/pkg/arvo/mar/map.hoon +++ b/pkg/arvo/mar/map.hoon @@ -4,14 +4,14 @@ /? 310 :: =, eyre -|_ mud/@ +|_ mud=@ ++ grow |% ++ mime [/application/octet-stream (as-octs:mimes:html (@t mud))] -- ++ grab |% :: convert from - ++ mime |=({p/mite q/octs} (@t q.q)) + ++ mime |=([p=mite q=octs] (@t q.q)) ++ noun cord :: clam from %noun -- ++ grad %mime diff --git a/pkg/arvo/mar/md.hoon b/pkg/arvo/mar/md.hoon index ab1629ed4..4f790f818 100644 --- a/pkg/arvo/mar/md.hoon +++ b/pkg/arvo/mar/md.hoon @@ -5,7 +5,7 @@ :: =, format =, mimes:html -|_ txt/wain +|_ txt=wain :: ++ grab :: convert from |% diff --git a/pkg/arvo/mar/mime.hoon b/pkg/arvo/mar/mime.hoon index 222047545..87e920250 100644 --- a/pkg/arvo/mar/mime.hoon +++ b/pkg/arvo/mar/mime.hoon @@ -4,7 +4,7 @@ /? 310 :: ^| -|_ own/mime +|_ own=mime ++ grow ^? |% @@ -16,7 +16,7 @@ |% +$ noun mime :: clam from %noun ++ tape - |=(a=^tape [/application/x-urb-unknown (as-octt:mimes:html a)]) + |=(a=_"" [/application/x-urb-unknown (as-octt:mimes:html a)]) -- ++ grad ^? @@ -24,6 +24,6 @@ ++ form %mime ++ diff |=(mime +<) ++ pact |=(mime +<) - ++ join |=({mime mime} `(unit mime)`~) + ++ join |=([mime mime] `(unit mime)`~) -- -- diff --git a/pkg/arvo/mar/noun.hoon b/pkg/arvo/mar/noun.hoon index 906ab5432..fb0767498 100644 --- a/pkg/arvo/mar/noun.hoon +++ b/pkg/arvo/mar/noun.hoon @@ -4,7 +4,7 @@ /? 310 !: :::: A minimal noun mark -|_ non/* +|_ non=* ++ grab |% ++ noun * -- diff --git a/pkg/arvo/mar/path.hoon b/pkg/arvo/mar/path.hoon index d3952babb..2196ba95a 100644 --- a/pkg/arvo/mar/path.hoon +++ b/pkg/arvo/mar/path.hoon @@ -1,4 +1,4 @@ -|_ pax/path +|_ pax=path ++ grad %noun ++ grow |% diff --git a/pkg/arvo/mar/png.hoon b/pkg/arvo/mar/png.hoon index 145b21385..e68e502cd 100644 --- a/pkg/arvo/mar/png.hoon +++ b/pkg/arvo/mar/png.hoon @@ -1,4 +1,4 @@ -|_ dat/@t +|_ dat=@t ++ grow |% ++ mime [/image/png (as-octs:mimes:html dat)] diff --git a/pkg/arvo/mar/purl.hoon b/pkg/arvo/mar/purl.hoon index 148ef1d74..3fb39fa69 100644 --- a/pkg/arvo/mar/purl.hoon +++ b/pkg/arvo/mar/purl.hoon @@ -3,7 +3,7 @@ :: /? 310 =, eyre -|_ url/purl +|_ url=purl ++ grad %noun :: ++ grow diff --git a/pkg/arvo/mar/ships.hoon b/pkg/arvo/mar/ships.hoon index affc890b9..09dd594cc 100644 --- a/pkg/arvo/mar/ships.hoon +++ b/pkg/arvo/mar/ships.hoon @@ -3,7 +3,7 @@ :: /? 310 =, format -|_ all/(list ship) +|_ all=(list ship) ++ grab |% ++ noun (list ship) ++ json (ar (su fed:ag)):dejs diff --git a/pkg/arvo/mar/snip.hoon b/pkg/arvo/mar/snip.hoon index 302cf0b79..205348f49 100644 --- a/pkg/arvo/mar/snip.hoon +++ b/pkg/arvo/mar/snip.hoon @@ -6,11 +6,11 @@ |% ++ words 1 ++ hedtal - =| met/marl - |= a=marl ^- {hed/marl tal/marl} + =| met=marl + |= a=marl ^- [hed=marl tal=marl] ?~ a [~ ~] - ?. ?=($h1 n.g.i.a) - ?: ?=($meta n.g.i.a) + ?. ?=(%h1 n.g.i.a) + ?: ?=(%meta n.g.i.a) $(a t.a, met [i.a met]) =+ had=$(a c.i.a) ?^ -.had had @@ -20,17 +20,17 @@ ++ limit |= [lim=@u mal=marl] =< res - |- ^- {rem/@u res/marl} + |- ^- [rem=@u res=marl] ?~ mal [lim ~] ?~ lim [0 ~] - =/ {lam/@u hed/manx} + =/ [lam=@u hed=manx] ?: ?=(_;/(**) i.mal) [lim ;/(tay)]:(deword lim v.i.a.g.i.mal) [rem ele(c res)]:[ele=i.mal $(mal c.i.mal)] [rem - res]:[hed $(lim lam, mal t.mal)] :: ++ deword - |= [lim=@u tay=tape] ^- {lim/@u tay/tape} + |= [lim=@u tay=tape] ^- [lim=@u tay=tape] ?~ tay [lim tay] ?~ lim [0 ~] =+ wer=(dot 1^1 tay) @@ -42,7 +42,7 @@ :: :: =, mimes:html -|_ {hed/marl tal/marl} +|_ [hed=marl tal=marl] ++ grad %mime :: ++ grow :: convert to @@ -57,6 +57,6 @@ -- -- ++ grab |% :: convert from - ++ noun {marl marl} :: clam from $noun + ++ noun ,[marl marl] :: clam from %noun ++ elem |=(a=manx (hedtal +.a)) -- -- diff --git a/pkg/arvo/mar/sole/action.hoon b/pkg/arvo/mar/sole/action.hoon index 58c87cbe7..149ef5ef1 100644 --- a/pkg/arvo/mar/sole/action.hoon +++ b/pkg/arvo/mar/sole/action.hoon @@ -17,22 +17,22 @@ ++ grab :: convert from |% ++ json - |= jon/^json ^- sole-action + |= jon=^json ^- sole-action %- need %. jon => [dejs-soft:format ..sole-action] |^ (ot id+so dat+(fo %ret (of det+change tab+ni ~)) ~) ++ fo - |* {a/term b/fist} - |=(c/json ?.(=([%s a] c) (b c) (some [a ~]))) + |* [a=term b=fist] + |=(c=json ?.(=([%s a] c) (b c) (some [a ~]))) :: ++ ra - |* {a/{term fist} b/fist} - |= c/json %. c + |* [a=[term fist] b=fist] + |= c=json %. c ?.(=(%a -.c) b (pe -.a (ar +.a))) :: ++ ke :: callbacks - |* {gar/* sef/(trap fist)} - |= jon/json ^- (unit _gar) + |* [gar=* sef=(trap fist)] + |= jon=json ^- (unit _gar) =- ~! gar ~! (need -) - ((sef) jon) :: diff --git a/pkg/arvo/mar/sole/effect.hoon b/pkg/arvo/mar/sole/effect.hoon index edf4f6457..925a278df 100644 --- a/pkg/arvo/mar/sole/effect.hoon +++ b/pkg/arvo/mar/sole/effect.hoon @@ -12,36 +12,36 @@ =, format |% ++ mar-sole-change :: XX dependency - |_ cha/sole-change + |_ cha=sole-change ++ grow |% ++ json ^- ^json =, enjs =; edi =,(cha (pairs ted+(edi ted) ler+a+~[(numb own.ler) (numb his.ler)] ~)) - |= det/sole-edit + |= det=sole-edit ?- -.det - $nop [%s 'nop'] - $mor [%a (turn p.det ..$)] - $del (frond %del (numb p.det)) - $set (frond %set (tape (tufa p.det))) - $ins (frond %ins (pairs at+(numb p.det) cha+s+(tuft q.det) ~)) + %nop [%s 'nop'] + %mor [%a (turn p.det ..$)] + %del (frond %del (numb p.det)) + %set (frond %set (tape (tufa p.det))) + %ins (frond %ins (pairs at+(numb p.det) cha+s+(tuft q.det) ~)) == -- -- ++ wush - |= {wid/@u tan/tang} + |= [wid=@u tan=tang] ^- tape - (of-wall (turn (flop tan) |=(a/tank (of-wall (wash 0^wid a))))) + (of-wall (turn (flop tan) |=(a=tank (of-wall (wash 0^wid a))))) :: ++ purge :: discard ++styx style - |= a/styx ^- tape + |= a=styx ^- tape %- zing %+ turn a - |= a/_?>(?=(^ a) i.a) + |= a=_?>(?=(^ a) i.a) ?@(a (trip a) ^$(a q.a)) -- :: -|_ sef/sole-effect +|_ sef=sole-effect :: ++ grad %noun ++ grab :: convert from @@ -56,17 +56,17 @@ ^- ^json ?+ -.sef ~|(unsupported-effect+-.sef !!) - $mor [%a (turn p.sef |=(a/sole-effect json(sef a)))] - $err (frond %hop (numb p.sef)) - $txt (frond %txt (tape p.sef)) - $tan (frond %tan (tape (wush 160 p.sef))) - $det (frond %det json:~(grow mar-sole-change +.sef)) + %mor [%a (turn p.sef |=(a=sole-effect json(sef a)))] + %err (frond %hop (numb p.sef)) + %txt (frond %txt (tape p.sef)) + %tan (frond %tan (tape (wush 160 p.sef))) + %det (frond %det json:~(grow mar-sole-change +.sef)) :: - $pro + %pro %+ frond %pro (pairs vis+b+vis.sef tag+s+tag.sef cad+(tape (purge cad.sef)) ~) :: - $tab + %tab :- %a %+ turn p.sef |= [=cord =^tank] @@ -76,7 +76,7 @@ info+(tape ~(ram re tank)) == :: - ?($bel $clr $nex) + ?(%bel %clr %nex) (frond %act %s -.sef) == -- diff --git a/pkg/arvo/mar/tang.hoon b/pkg/arvo/mar/tang.hoon index 2e212b13d..279a4b304 100644 --- a/pkg/arvo/mar/tang.hoon +++ b/pkg/arvo/mar/tang.hoon @@ -4,7 +4,7 @@ /? 310 :: =, format -|_ tan/(list tank) +|_ tan=(list tank) ++ grad %noun ++ grow |% diff --git a/pkg/arvo/mar/txt-diff.hoon b/pkg/arvo/mar/txt-diff.hoon index 5471acc16..2c9a500dc 100644 --- a/pkg/arvo/mar/txt-diff.hoon +++ b/pkg/arvo/mar/txt-diff.hoon @@ -2,7 +2,7 @@ :::: /hoon/txt-diff/mar :: /? 310 -|_ txt-diff/(urge:clay cord) +|_ txt-diff=(urge:clay cord) :: ++ grad %noun ++ grow diff --git a/pkg/arvo/mar/txt.hoon b/pkg/arvo/mar/txt.hoon index 4ea82b7e9..1c349b182 100644 --- a/pkg/arvo/mar/txt.hoon +++ b/pkg/arvo/mar/txt.hoon @@ -7,7 +7,7 @@ =, differ =, format =, mimes:html -|_ txt/wain +|_ txt=wain :: ++ grab :: convert from |% @@ -72,7 +72,7 @@ ?. =(i.ali i.bob) ~ %+ bind $(ali t.ali, bob t.bob) - |=(cud/(urge cord) [i.ali cud]) + |=(cud=(urge cord) [i.ali cud]) :: %& ?: =(p.i.bob (lent p.i.ali)) @@ -99,8 +99,8 @@ -- :: ++ mash - |= $: {als/ship ald/desk ali/(urge cord)} - {bos/ship bod/desk bob/(urge cord)} + |= $: [als=ship ald=desk ali=(urge cord)] + [bos=ship bod=desk bob=(urge cord)] == ^- (urge cord) |^ @@ -124,7 +124,7 @@ [i.bob $(ali t.ali, bob t.bob)] ?: (gth p.i.ali (lent p.i.bob)) [i.bob $(p.i.ali (sub p.i.ali (lent p.i.bob)), bob t.bob)] - =/ {fic/(unce cord) ali/(urge cord) bob/(urge cord)} + =/ [fic=(unce cord) ali=(urge cord) bob=(urge cord)] (resolve ali bob) [fic $(ali ali, bob bob)] :: ~ :: here, alice is good for a while, but not for the whole @@ -133,7 +133,7 @@ %| ?- -.i.bob %| - =/ {fic/(unce cord) ali/(urge cord) bob/(urge cord)} + =/ [fic=(unce cord) ali=(urge cord) bob=(urge cord)] (resolve ali bob) [fic $(ali ali, bob bob)] :: @@ -142,16 +142,16 @@ [i.ali $(ali t.ali, bob t.bob)] ?: (gth p.i.bob (lent p.i.ali)) [i.ali $(ali t.ali, p.i.bob (sub p.i.bob (lent p.i.ali)))] - =/ {fic/(unce cord) ali/(urge cord) bob/(urge cord)} + =/ [fic=(unce cord) ali=(urge cord) bob=(urge cord)] (resolve ali bob) [fic $(ali ali, bob bob)] == == :: ++ annotate :: annotate conflict - |= $: ali/(list @t) - bob/(list @t) - bas/(list @t) + |= $: ali=(list @t) + bob=(list @t) + bas=(list @t) == ^- (list @t) %- zing @@ -193,14 +193,14 @@ :: ++ resolve |= [ali=(urge cord) bob=(urge cord)] - ^- {fic/{%| p/(list cord) q/(list cord)} ali/(urge cord) bob/(urge cord)} + ^- [fic=[%| p=(list cord) q=(list cord)] ali=(urge cord) bob=(urge cord)] =- [[%| bac (annotate alc boc bac)] ali bob] - |- ^- $: $: bac/(list cord) - alc/(list cord) - boc/(list cord) + |- ^- $: $: bac=(list cord) + alc=(list cord) + boc=(list cord) == - ali/(urge cord) - bob/(urge cord) + ali=(urge cord) + bob=(urge cord) == ?~ ali [[~ ~ ~] ali bob] ?~ bob [[~ ~ ~] ali bob] diff --git a/pkg/arvo/mar/udon.hoon b/pkg/arvo/mar/udon.hoon index 13afb4076..cfd6014ff 100644 --- a/pkg/arvo/mar/udon.hoon +++ b/pkg/arvo/mar/udon.hoon @@ -3,7 +3,7 @@ :: /+ cram :: -|_ mud/@t +|_ mud=@t ++ grow |% ++ mime [/text/x-unmark (as-octs:mimes:html mud)] diff --git a/pkg/arvo/mar/umd.hoon b/pkg/arvo/mar/umd.hoon index 195ad5489..268622d41 100644 --- a/pkg/arvo/mar/umd.hoon +++ b/pkg/arvo/mar/umd.hoon @@ -3,7 +3,7 @@ :: /+ cram :: -|_ mud/@t +|_ mud=@t ++ grow |% ++ mime [/text/x-unmark (as-octs:mimes:html mud)] diff --git a/pkg/arvo/mar/urb.hoon b/pkg/arvo/mar/urb.hoon index a579ee01f..85686ad6e 100644 --- a/pkg/arvo/mar/urb.hoon +++ b/pkg/arvo/mar/urb.hoon @@ -4,7 +4,7 @@ /? 310 =, mimes:html =, html -|_ own/manx +|_ own=manx :: ++ grad %mime ++ grow :: convert to diff --git a/pkg/arvo/mar/urbit.hoon b/pkg/arvo/mar/urbit.hoon index 9b7bb4e1c..8d2c3c658 100644 --- a/pkg/arvo/mar/urbit.hoon +++ b/pkg/arvo/mar/urbit.hoon @@ -4,7 +4,7 @@ /? 310 :::: A minimal urbit mark :: -|_ her/@p +|_ her=@p ++ grab |% ++ noun @p diff --git a/pkg/arvo/mar/xml.hoon b/pkg/arvo/mar/xml.hoon index b9705e5a1..6d52d8024 100644 --- a/pkg/arvo/mar/xml.hoon +++ b/pkg/arvo/mar/xml.hoon @@ -7,7 +7,7 @@ :: =, mimes:html =, html -|_ xml/@t +|_ xml=@t :: ++ grad %mime ++ grow :: convert to @@ -17,5 +17,5 @@ -- :: ++ grab |% :: convert from ++ noun @t :: clam from %noun - ++ mime |=([p=mite q=octs] q.q) :: retrieve form $mime + ++ mime |=([p=mite q=octs] q.q) :: retrieve form %mime -- -- diff --git a/pkg/arvo/sur/asn1.hoon b/pkg/arvo/sur/asn1.hoon index 980bf0594..348c07ebe 100644 --- a/pkg/arvo/sur/asn1.hoon +++ b/pkg/arvo/sur/asn1.hoon @@ -9,14 +9,14 @@ :: :: Note that *explicit* implies *constructed* (ie, bit 5 is set in DER). :: -+= bespoke ++$ bespoke :: imp: & is implicit, | is explicit :: tag: 5 bits for the custom tag number :: [imp=? tag=@ud] :: +spec:asn1: minimal representations of basic ASN.1 types :: -+= spec ++$ spec $% :: %int: arbitrary-sized, unsigned integers :: :: Unsigned integers, represented as having a positive sign. diff --git a/pkg/arvo/sur/keygen.hoon b/pkg/arvo/sur/keygen.hoon index bae3f5a93..f897eee4a 100644 --- a/pkg/arvo/sur/keygen.hoon +++ b/pkg/arvo/sur/keygen.hoon @@ -1,9 +1,9 @@ |% -+= revision @ud -+= nodetype tape -+= mnemonic tape ++$ revision @ud ++$ nodetype tape ++$ mnemonic tape :: -+= vault ++$ vault $: ownership=node voting=node management=node @@ -12,12 +12,12 @@ network=uode == :: -+= node [type=nodetype seed=mnemonic keys=wallet] -+= uode [revi=revision seed=@ux keys=edkeys] ++$ node [type=nodetype seed=mnemonic keys=wallet] ++$ uode [revi=revision seed=@ux keys=edkeys] :: -+= wallet [keys=[public=@ux private=@ux] addr=@ux chain=@ux] ++$ wallet [keys=[public=@ux private=@ux] addr=@ux chain=@ux] :: -+= edkeys [auth=keypair crypt=keypair] ++$ edkeys [auth=keypair crypt=keypair] :: -+= keypair [public=@ux secret=@ux] ++$ keypair [public=@ux secret=@ux] -- diff --git a/pkg/arvo/sur/kyev.hoon b/pkg/arvo/sur/kyev.hoon index 5b464fc5e..8281963f9 100644 --- a/pkg/arvo/sur/kyev.hoon +++ b/pkg/arvo/sur/kyev.hoon @@ -3,9 +3,9 @@ :::: /hoon/kyev/sur :: /? 310 -=- {p/(set ?($ctrl $shift $alt $meta)) q/$@(cord {$act speck})} -^= speck -$? $ctrl $shift $alt $meta $entr $esc $caps $uncap - $pgup $pgdn $home $end $baxp $del $ins - $up $down $left $right +=; speck + ,[p=(set ?(%ctrl %shift %alt %meta)) q=$@(cord [%act speck])] +$? %ctrl %shift %alt %meta %entr %esc %caps %uncap + %pgup %pgdn %home %end %baxp %del %ins + %up %down %left %right == diff --git a/pkg/arvo/sur/lens.hoon b/pkg/arvo/sur/lens.hoon index 0c75afa8c..e5f4bae4d 100644 --- a/pkg/arvo/sur/lens.hoon +++ b/pkg/arvo/sur/lens.hoon @@ -1,34 +1,34 @@ ^? |% ++ command - $: source/source - sink/sink + $: source=source + sink=sink == ++ source - $% {$data data/@} - {$dojo command/@t} - {$clay pax/@t} - {$url url/purl:eyre} - {$api api/term command/@t} - {$get-api api/term endpoint/(list @t)} - {$as mar/mark next/source} :: can't be at the - {$hoon code/@t next/source} :: end since they - {$tuple next/(list source)} :: don't bunt well - {$listen-api api/term event/term} - {$export app/@t} - {$import app/@t base64-jam/@t} - {$export-all ~} - {$import-all base64-jam/@t} + $% [%data data=@] + [%dojo command=@t] + [%clay pax=@t] + [%url url=purl:eyre] + [%api api=term command=@t] + [%get-api api=term endpoint=(list @t)] + [%as mar=mark next=source] :: can't be at the + [%hoon code=@t next=source] :: end since they + [%tuple next=(list source)] :: don't bunt well + [%listen-api api=term event=term] + [%export app=@t] + [%import app=@t base64-jam=@t] + [%export-all ~] + [%import-all base64-jam=@t] == ++ sink - $% {$stdout ~} - {$output-file pax/@t} - {$output-pill pax/@t} - {$output-clay pax/path} - {$url url/purl:eyre} - {$to-api api/term command/@t} - {$send-api api/term endpoint/(list @t)} - {$command command/@t} - {$app app/term} + $% [%stdout ~] + [%output-file pax=@t] + [%output-pill pax=@t] + [%output-clay pax=path] + [%url url=purl:eyre] + [%to-api api=term command=@t] + [%send-api api=term endpoint=(list @t)] + [%command command=@t] + [%app app=term] == -- diff --git a/pkg/arvo/sur/plum.hoon b/pkg/arvo/sur/plum.hoon new file mode 100644 index 000000000..f4418197a --- /dev/null +++ b/pkg/arvo/sur/plum.hoon @@ -0,0 +1,55 @@ +^? |% +:: ++$ tile :: XX: ?@(knot (pair styl knot)) + :: + cord +:: +:: A `plum` is the intermediate representation for the pretty-printer. It +:: encodes hoon-shaped data with the least amount of structured needed +:: for formating. +:: +:: A `plum` is either a +:: +:: - `cord`: A simple cord +:: - `[%para *]`: A wrappable paragraph. +:: - `[%tree *]`: A formatted plum tree +:: - `[%sbrk *]`: An indication of a nested subexpression. +:: +:: The formatter will use the tall mode unless: +:: +:: - A plum has only a `wide` style. +:: - The plum is in `%sbrk` form and its subplum (`kid`), when +:: formatted in wide mode, can fit on a single line. +:: ++$ plum + $@ cord + $% [%para prefix=tile lines=(list @t)] + [%tree fmt=plumfmt kids=(list plum)] + [%sbrk kid=plum] + == +:: +:: A `plumfmt` is a description of how to render a `plum`. A `plumfmt` +:: must include a `wide`, a `tall`, or both. +:: +:: A `wide` is a description of how to render a plum in a single +:: line. The nested (`kids`) sub-plums will be interleaved with `delimit` +:: strings, and, if `enclose` is set, then the output will be enclosed +:: with `p.u.enclose` and `q.u.enclose`. +:: +:: For example, to build a plumfmt for string literals, we could write: +:: +:: [wide=[~ '' [~ '"' '"']] tall=~] +:: +:: A `tall` is a description of how to render a plum across multiple +:: lines. The output will be prefixed by `intro`, suffixed by +:: `final.u.indef`, and each subplum prefixed by `sigil.u.indef`. +:: +:: For example, to build a plumfmt for cores, we could write: +:: +:: [wide=~ tall=`['' `['++' '--']]] +:: ++$ plumfmt + $: wide=(unit [delimit=tile enclose=(unit (pair tile tile))]) + tall=(unit [intro=tile indef=(unit [sigil=tile final=tile])]) + == +-- diff --git a/pkg/arvo/sur/rw-security.hoon b/pkg/arvo/sur/rw-security.hoon index 477370c00..ad8ad5715 100644 --- a/pkg/arvo/sur/rw-security.hoon +++ b/pkg/arvo/sur/rw-security.hoon @@ -1,8 +1,8 @@ |% +$ rw-security - $? $channel :: black r, black w - $village :: white r, white w - $journal :: black r, white w - $mailbox :: white r, black w + $? %channel :: black r, black w + %village :: white r, white w + %journal :: black r, white w + %mailbox :: white r, black w == -- diff --git a/pkg/arvo/sur/sole.hoon b/pkg/arvo/sur/sole.hoon index 0254e5701..fa21c96ee 100644 --- a/pkg/arvo/sur/sole.hoon +++ b/pkg/arvo/sur/sole.hoon @@ -3,86 +3,84 @@ :: ^? |% -++ sole-action :: sole to app ++$ sole-action :: sole to app $: id=@ta :: duct id $= dat - $% :: {$abo ~} :: reset interaction - {$det sole-change} :: command line edit - {$ret ~} :: submit and clear - {$clr ~} :: exit context - {$tab pos/@ud} :: tab complete + $% :: [%abo ~] :: reset interaction + [%det sole-change] :: command line edit + [%ret ~] :: submit and clear + [%clr ~] :: exit context + [%tab pos=@ud] :: tab complete == :: == -++ sole-buffer (list @c) :: command state -++ sole-change :: network change - $: ler/sole-clock :: destination clock - haw/@uvH :: source hash - ted/sole-edit :: state change ++$ sole-buffer (list @c) :: command state ++$ sole-change :: network change + $: ler=sole-clock :: destination clock + haw=@uvH :: source hash + ted=sole-edit :: state change == :: -++ sole-clock {own/@ud his/@ud} :: vector clock -++ sole-edit :: shared state change - $% {$del p/@ud} :: delete one at - {$ins p/@ud q/@c} :: insert at - {$mor p/(list sole-edit)} :: combination - {$nop ~} :: no-op - {$set p/sole-buffer} :: discontinuity ++$ sole-clock [own=@ud his=@ud] :: vector clock ++$ sole-edit :: shared state change + $% [%del p=@ud] :: delete one at + [%ins p=@ud q=@c] :: insert at + [%mor p=(list sole-edit)] :: combination + [%nop ~] :: no-op + [%set p=sole-buffer] :: discontinuity == :: -++ sole-effect :: app to sole - $% {$bel ~} :: beep - {$blk p/@ud q/@c} :: blink+match char at - {$clr ~} :: clear screen - {$det sole-change} :: edit command - {$err p/@ud} :: error point - {$klr p/styx} :: styled text line - {$mor p/(list sole-effect)} :: multiple effects - {$nex ~} :: save clear command - {$pro sole-prompt} :: set prompt - {$sag p/path q/*} :: save to jamfile - {$sav p/path q/@} :: save to file - {$tab p/(list {=cord =tank})} :: tab-complete list - {$tan p/(list tank)} :: classic tank - :: {$taq p/tanq} :: modern tank - {$txt p/tape} :: text line - {$url p/@t} :: activate url ++$ sole-effect :: app to sole + $% [%bel ~] :: beep + [%blk p=@ud q=@c] :: blink+match char at + [%clr ~] :: clear screen + [%det sole-change] :: edit command + [%err p=@ud] :: error point + [%klr p=styx] :: styled text line + [%mor p=(list sole-effect)] :: multiple effects + [%nex ~] :: save clear command + [%pro sole-prompt] :: set prompt + [%sag p=path q=*] :: save to jamfile + [%sav p=path q=@] :: save to file + [%tab p=(list [=cord =tank])] :: tab-complete list + [%tan p=(list tank)] :: classic tank + :: [%taq p=tanq] :: modern tank + [%txt p=tape] :: text line + [%url p=@t] :: activate url == :: -++ sole-command :: command state - $: pos/@ud :: cursor position - say/sole-share :: cursor ++$ sole-command :: command state + $: pos=@ud :: cursor position + say=sole-share :: cursor == :: -++ sole-prompt :: prompt definition - $: vis/? :: command visible - tag/term :: history mode - cad/styx :: caption ++$ sole-prompt :: prompt definition + $: vis=? :: command visible + tag=term :: history mode + cad=styx :: caption == :: -++ sole-share :: symmetric state - $: ven/sole-clock :: our vector clock - leg/(list sole-edit) :: unmerged edits - buf/sole-buffer :: sole state ++$ sole-share :: symmetric state + $: ven=sole-clock :: our vector clock + leg=(list sole-edit) :: unmerged edits + buf=sole-buffer :: sole state == :: :: :: :: :: ++ sole-dialog :: standard dialog - |* out/$-(* *) :: output structure + |* out=$-(* *) :: output structure $-(sole-input (sole-result out)) :: output function :: :: -++ sole-input tape :: prompt input ++$ sole-input tape :: prompt input ++ sole-result :: conditional result - |* out/$-(* *) :: output structure + |* out=$-(* *) :: output structure $@(@ud (sole-product out)) :: error position :: :: ++ sole-product :: success result - |* out/$-(* *) :: + |* out=$-(* *) :: %+ pair (list tank) :: %+ each (unit out) :: ~ is abort (pair sole-prompt (sole-dialog out)) :: ask and continue :: :: -++ sole-gen :: XX virtual type - $% {$say $-((sole-args) (cask))} :: direct noun - {$ask $-((sole-args) (sole-product (cask)))} :: dialog ++$ sole-gen :: XX virtual type + $% [%say $-((sole-args) (cask))] :: direct noun + [%ask $-((sole-args) (sole-product (cask)))] :: dialog == :: ++ sole-args :: generator arguments |* _[* *] :: - {{now/@da eny/@uvJ bek/beak} {,+<- ,+<+}} :: -:: :: -:: :: + ,[[now=@da eny=@uvJ bek=beak] [,+<- ,+<+]] :: -- diff --git a/pkg/arvo/sur/urb.hoon b/pkg/arvo/sur/urb.hoon index 67d20129f..9107bf306 100644 --- a/pkg/arvo/sur/urb.hoon +++ b/pkg/arvo/sur/urb.hoon @@ -2,4 +2,4 @@ :: :::: /hoon/urb/sur :: -{hed/{dep/@uvH ele/marl} bod/{dep/@uvH ele/marl}} +[hed=[dep=@uvH ele=marl] bod=[dep=@uvH ele=marl]] diff --git a/pkg/arvo/sur/xray.hoon b/pkg/arvo/sur/xray.hoon new file mode 100644 index 000000000..9faaad019 --- /dev/null +++ b/pkg/arvo/sur/xray.hoon @@ -0,0 +1,176 @@ + +:: +:: These are the public types for the `xray` library. Analysing a type +:: yields an `ximage`, and everything else here is just some structure +:: within that. +:: +:: `ximage`s can be printed as specs (hoon syntax for types), and can +:: be used to pretty-print typed data. +:: +^? |% +:: +:: An `xtable` is a graph of types referenced by the top-level type, +:: and the `root` `key` points to the node which corresponds to the +:: type under analysis. +:: ++$ ximage [root=xkey =xtable] +:: +:: A `xkey` is just an identifier for a node in the xray graph. +:: ++$ xkey @ +:: +:: An `xtable` is the xray graph itself. It contains one node for for +:: the type that was analyzed and one node for every type referenced +:: within that type. +:: +:: The `next` field is the the next available xkey (used when inserting +:: new xrays), `xrays` maps keys to graph nodes and `type-map` gives +:: the xkey corresponding to a type. +:: +:: The `type-map` is basically just the reverse of the `xrays` map. It +:: doesn't contain any new information, but is needed for performance +:: reasons. +:: ++$ xtable [next=xkey xrays=(map xkey xray) =type=(map type xkey)] +:: +:: An `xray` is a node in the `ximage` graph. It contains everything +:: we know about a certain `type`. `key` is its identifier in the graph, +:: `type` is the type that it's an xray of, and `xdat` is the basic +:: information we derived about the type. The basic references to other +:: nodes are inside the `xdat` structure, though some of the other +:: fields may contain references as well. +:: +:: - `xshape` is some more information about the xshape of data within +:: a cell. +:: - `xrole` expands on `xshape`, adding further information about the +:: xrole that a node has within a fork. +:: - `pats` is used for printing data: we want to know if this type +:: can be printed as a list, as json, as a tape literal, etc. +:: - `recipes` contains information about how a type was +:: constructed. It's used to get much nicer output when printing types. +:: - `studs` contains "standards names". I actually don't know what this is. +:: - `helps` contains all the documentation about a type. +:: - `loop` indicates whether or not a node references itself. The list +:: type is cyclical, for example. This is used when printing an +:: `ximage`. +:: ++$ xray + $: =xkey + =type + xdat=(unit xdat) + xrole=(unit xrole) + pats=(unit xpat) + studs=(set stud) + recipes=(set recipe) + helps=(set help) + xshape=(unit xshape) + loop=(unit ?) + == +:: +:: - `%void` -- impossible to create. +:: - `%noun` -- could be any noun. +:: - `%atom` -- An atom of some aura, possibly constant +:: - `%cell` -- A cell with a head and a tail. +:: - `%core` -- A core, its garb, its context type, and the types of +:: each of its arms. +:: - `%face` -- A face on another type. +:: - `%fork` -- Could be one or more other types. +:: - `%pntr` -- This is an internal hack, it should never survive +:: analysis; ignore. +:: ++$ xdat + $@ ?(%noun %void) + $% [%atom =aura constant=(unit @)] + [%cell head=xkey tail=xkey] + [%core =garb xray=xkey batt=xbat] + [%face face=$@(term tune) xray=xkey] + [%fork =(set xkey)] + [%pntr xray=xkey] + == +:: +:: The basic xshape of a type: +:: +:: - `%void` -- impossible to create. +:: - `%noun` -- could be any noun. +:: - `%atom` -- always some type of atom; never a cell +:: - `%cell` -- always some type of cell; never an atom. +:: - `%junc` -- is a fork of a cell type and an atom type. +:: ++$ xshape ?(%void %noun %atom %cell %junc) +:: +:: A `xrole` is the of a type, including a more refined understanding +:: of what xrole it plays within a fork. +:: +:: Nodes referenced within a `xrole` often do not actually exist in the +:: original type, since we need to reorganize forks in order to make +:: them more coherent. +:: +:: - `%void` -- impossible to create. +:: - `%noun` -- could be any noun. +:: - `%atom` -- always some type of atom; never a cell +:: - `%constant` -- a cell type whose head is a constant atom. +:: - `%tall` -- a cell type whose head is an atom. +:: - `%wide` -- a cell type whose head is also a cell +:: - `%instance` -- a cell type whose head is a constant atom. +:: - `%option` -- a union of types which are all constant atoms. +:: - `%union` -- a union of types which are all instances (cells whose +:: head is a constant atom). +:: - `%junction` -- a union of an atom type and a cell type. +:: - `%conjunction` -- a union of two cell types, one of them %wide +:: and the other %tall. +:: - `%misjunction` -- any other union type. There's no efficient way +:: to tell which branch to take when analyzing a fork which is a +:: %misjunction, and the type is probably improperly constructed. +:: ++$ xrole + $@ $? %void %noun %atom %tall %wide == + $% [%constant =atom] + [%instance =atom] + [%option =(map atom xkey)] + [%union =(map atom xkey)] + [%junction flat=xkey deep=xkey] + [%conjunction wide=xkey tall=xkey] + [%misjunction one=xkey two=xkey] + == +:: +:: This is just a utility type, it encodes the "battery" structure +:: within a core. +:: +:: It's a map from chapter names to the documentation and arms within +:: that chapter. +:: ++$ xbat (map term (pair what (map term xkey))) +:: +:: A recipe tells us how a type was constructed. +:: +:: - `%direct` is a simple type like `term`, or `xray`. +:: - `%synthetic` is a constructed type, like `(list @)`. +:: ++$ recipe + $% [%direct =term] + [%synthetic =term =(list xkey)] + == +:: +:: A `xpat` is high-level information about the shape of a type. This +:: is used for printing data. +:: +:: This is fairly heuristic. [%a %b %c ~] is recognized as a `path`, +:: `[3 ~[4 5 6]]` is recognized as a list, etc. +:: +:: Most of the xpats have names that make their purpose obvious: +:: for example, the %tape xpat means that data of type type can be +:: printed as if it had the `tape` type. However, `%gear` and `%gate` +:: might not be entirely obvious. +:: +:: - The %gear xpat is any core with a cell subject. +:: - The %gate xpat is a core that looks like a gate. +:: ++$ xpat + $@ ?(%hoon %manx %json %nock %path %plum %skin %spec %tape %tour %type %vase) + $% [%gate sample=xkey product=xkey] + [%gear sample=xkey context=xkey batt=xbat] + [%list item=xkey] + [%tree item=xkey] + [%unit item=xkey] + == +-- diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index 7c28d9e59..7296a354d 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -11,7 +11,7 @@ :: urbit's formal lifecycle function. a practical interpreter :: can ignore it. :: - |= [now=@da ovo=*] + |= [now=@da ovo=ovum] ^- * ~> %slog.[0 leaf+"arvo: formal event"] .(+> +:(poke now ovo)) @@ -22,7 +22,11 @@ |% +| %global :: -:: $arch: fundamental node +++ arvo %arvo-kelvin +:: +:: $arch: node identity +:: $axal: fundamental node, recursive +:: $axil: fundamental node :: $beak: global context :: $beam: global name :: $bone: opaque duct handle @@ -31,13 +35,23 @@ :: +cask: marked data builder :: $desk: local workspace :: $dock: message target +:: $gang: infinite set of peers :: $mark: symbolic content type +:: $mien: orientation +:: +omen: namespace path and data :: $ship: network identity :: $sink: subscription :: -+$ arch [fil=(unit @uvI) dir=(map @ta ~)] -+$ beam [beak s=path] ++$ arch (axil @uvI) +++ axal + |$ [item] + [fil=(unit item) dir=(map @ta $)] :: +++ axil + |$ [item] + [fil=(unit item) dir=(map @ta ~)] +:: +$ beak (trel ship desk case) ++$ beam [beak s=path] +$ bone @ud +$ case $% :: %da: date @@ -52,7 +66,10 @@ ++ cask |$ [a] (pair mark a) +$ desk @tas +$ dock (pair @p term) ++$ gang (unit (set ship)) +$ mark @tas ++$ mein [our=ship now=@da eny=@uvJ] +++ omen |$ [a] (pair path (cask a)) +$ ship @p +$ sink (trel bone ship path) :: @@ -79,7 +96,9 @@ :: $monk: general identity :: $move: cause and action :: $ovum: card with cause -:: $scry-sample: vane +scry argument +:: $roof: namespace +:: $rook: meta-namespace +:: +room: generic namespace :: $vane-sample: vane wrapper-gate aargument :: $sley: namespace function :: $slyd: super advanced @@ -104,10 +123,21 @@ +$ move [=duct =ball] +$ ovum (pair wire curd) :: -+$ scry-sample - [fur=(unit (set monk)) ren=@tas why=shop syd=desk lot=coin tyl=path] ++$ roof (room vase) :: namespace ++$ rook (room meta) :: meta-namespace +++ room :: either namespace + |$ [a] + $~ =>(~ |~(* ~)) + $- $: lyc=gang :: leakset + cyr=term :: perspective + bem=beam :: path + == :: + %- unit :: ~: unknown + %- unit :: ~ ~: invalid + (cask a) +:: +$ vane-sample - [our=ship now=@da eny=@uvJ ski=slyd] + [our=ship now=@da eny=@uvJ rof=rook] :: +$ sley $- [* (unit (set monk)) term beam] @@ -153,27 +183,156 @@ :: +| %implementation :: -:: $pane: kernel modules -:: $pone: kernel modules old +:: $debt: ephemeral state +:: $grub: persistent state, larval stage +:: $germ: worklist source and bar stack +:: $heir: upgradeable state +:: $plan: worklist +:: $soul: persistent state :: $vane: kernel module +:: $vere: runtime version :: $vile: reflexive constants +:: $waif: arvo task, from anywhere +:: $wasp: arvo task, from Outside +:: $wisp: arvo task, larval stage +:: $wynn: kelvin stack :: -+$ pane (list (pair @tas vase)) -+$ pone (list (pair @tas vise)) ++$ debt + $: :: run: list of worklists + :: out: pending output + :: kel: kernel files + :: fil: pending files + :: + run=(list plan) + out=(list ovum) + kel=(list (pair path (cask))) + fil=(list (pair path (cask))) + == ++$ germ [vane=term bars=(list duct)] ++$ grub + $: :: who: identity once we know it + :: eny: entropy once we learn it + :: bod: %zuse once we receive it + :: + who=(unit ship) + eny=(unit @) + lac=? + ver=(unit vere) + fat=(unit (axal (cask))) + bod=(unit (trap vase)) + van=(map term (trap vase)) + == ++$ heir + $% [%grub _arvo =grub] + [_arvo =debt =soul] + == ++$ plan (pair germ (list move)) ++$ soul + $: :: identity, time, entropy + :: fad: configuration + :: zen: Outside knowledge + :: mod: internal modules + :: + mein + $= fad + $: :: lac: not verbose + :: + lac=? + == + $= zen + $: :: ver: runtime version + :: lag: upgrade blocked + :: + ver=vere + lag=_| + == + $= mod + $: :: fat: filesystem + :: zus: %zuse + :: van: vanes + :: + fat=(axal (cask)) + zus=vase + van=(map term vane) + == + == +$ vane [=vase =worm] ++$ vere + $: $: non=@ta + rev=(pair term (trel @ud @ud @ud)) :: XX path? + == + kel=wynn + == +$ vile $: typ=type :: -:!>(*type) duc=type :: -:!>(*duct) wir=type :: -:!>(*wire) dud=type :: -:!>(*(unit goof)) == --- -=> +:: ++$ waif + :: %lyra: upgrade kernel + :: %trim: trim state, spam to all + :: %vega: notify vanes post upgrade + :: %what: update from files + :: %whey: produce $mass :: XX remove, scry + :: %verb: toggle laconicity + :: %veer: upgrade module + :: + $% [%lyra hun=(unit @t) van=@t] + [%trim p=@ud] + [%vega ~] + [%what p=(list (pair path (cask)))] + [%whey ~] + [%verb p=(unit ?)] + [%veer lal=@tas pax=path txt=@t] + == ++$ wasp + :: %crud: reroute $ovum with $goof + :: %wack: iterate entropy + :: %wyrd: check/record runtime kelvin stack + :: + $% [%crud =goof =ovum] + [%wack p=@uvJ] + [%wyrd p=vere] + == ++$ wisp + $% $>(?(%verb %veer %what) waif) + $>(?(%wack %wyrd) wasp) + [%whom p=ship] + == ++$ wynn (list (pair term @ud)) +-- => +:: ~% %hex ..ut ~ |% :::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: section 3bE, Arvo core :: :: +++ en-beam + |=(b=beam =*(s scot `path`[(s %p p.b) q.b (s r.b) s.b])) +:: +++ de-beam + |= p=path + ^- (unit beam) + ?. ?=([@ @ @ *] p) ~ + ?~ who=(slaw %p i.p) ~ + ?~ des=?~(i.t.p (some %$) (slaw %tas i.t.p)) ~ :: XX +sym ;~(pose low (easy %$)) + ?~ ved=(slay i.t.t.p) ~ + ?. ?=([%$ case] u.ved) ~ + `(unit beam)`[~ [`ship`u.who `desk`u.des `case`p.u.ved] t.t.t.p] +:: +++ en-sley + |= =roof + ^- sley + |= [typ=* fur=(unit (set monk)) ron=term bed=beam] + =/ lyc=gang + ?~ fur ~ + :- ~ + %- ~(gas in *(set ship)) + (murn ~(tap in u.fur) |=(m=monk ?-(-.m %| ~, %& `p.m))) + (roof lyc ron bed) +:: ++ sloy :: +sloy: adapter from old style scrys to new style scrys :: @@ -182,13 +341,13 @@ :: !: ~/ %sloy - |= sod/slyd + |= sod=slyd ^- slyt - |= {ref/* raw/*} + |= [ref=* raw=*] =+ pux=((soft path) raw) ?~ pux ~ - ?. ?=({@ @ @ @ *} u.pux) ~ - =+ :* hyr=(slaw %tas i.u.pux) + ?. ?=([@ @ @ @ *] u.pux) ~ + =+ :* hyr=?~(i.u.pux (some %$) (slaw %tas i.u.pux)) fal=(slaw %p i.t.u.pux) dyc=?~(i.t.t.u.pux (some %$) (slaw %tas i.t.t.u.pux)) ved=(slay i.t.t.t.u.pux) @@ -200,7 +359,7 @@ ?. ?=(^ ved) ~ =/ ron=@tas u.hyr =/ bed=beam - [[u.fal u.dyc (case p.u.ved)] (flop tyl)] + [[u.fal u.dyc (case p.u.ved)] tyl] =/ bop=(unit (unit (cask meta))) (sod ref ~ ron bed) ?~ bop ~ @@ -226,12 +385,9 @@ :: ++ sloy-light ~/ %sloy-light - |= sod/slyd + |= sod=slyd |= [ref=* ron=@tas fal=@p dyc=@tas ved=case tyl=path] - :: we do not flop tyl because tyl wouldn't have been flopped by +en-beam - :: - =/ bed=beam - [[fal dyc ved] tyl] + =/ bed=beam [[fal dyc ved] tyl] =/ bop=(unit (unit (cask meta))) (sod ref ~ ron bed) ?~ bop ~ @@ -243,17 +399,119 @@ == ~>(%slog.[0 leaf+"arvo: scry-dark"] ~) [~ ~ +.q.u.u.bop] +:: +wyrd: kelvin negotiation +:: +:: specified but unimplemented: +:: arvo should produce a [wend/wynn] effect +:: to signal downgrade +:: +++ wyrd + |= [run=wynn hav=wynn] + :: wyr: ~: runtime supports all required kelvins + :: ^: runtime support is missing or lagging + :: + =; wyr !. + ?~ wyr + same + ~& wyrd=wyr + ~_ :+ %rose + [" " ~ ~] + :~ =+ p.u.wyr + leaf/"%{(trip p)} %{(scow %ud q)} required;" + ?~ q.u.wyr + leaf/"runtime missing support" + leaf/"runtime only supports %{(scow %ud u.q.u.wyr)}" + == + ~> %mean.'arvo: upgrade blocked' + ~> %mean.'wyrd' + !! + :: + |- ^- (unit (pair (pair term @ud) (unit @ud))) + ?~ hav ~ + :: + :: fel: %&: runtime kelvin for [i.hav] + :: %|: no specified runtime support + :: + =/ fel + |- ^- (each @ud (pair term @ud)) + ?~ run |/i.hav + ?:(=(p.i.hav p.i.run) &/q.i.run $(run t.run)) + :: + ?- -.fel + %| `[p.fel ~] + %& ?.((lte p.fel q.i.hav) `[i.hav `p.fel] $(hav t.hav)) + == +:: +:: |de: axal engine +:: +++ de + =| fat=(axal) + |@ + :: + ++ get + |= pax=path + ^+ fat + ?~ pax fat + =/ kid (~(get by dir.fat) i.pax) + ?~ kid [~ ~] + $(fat u.kid, pax t.pax) + :: + ++ put + |* [pax=path dat=*] + => .(dat `_?>(?=(^ fil.fat) u.fil.fat)`dat) + ^+ fat + ?~ pax fat(fil `dat) + =/ kid (~(get by dir.fat) i.pax) + =/ new (fall kid fat(fil ~, dir ~)) + fat(dir (~(put by dir.fat) i.pax $(fat new, pax t.pax))) + :: + ++ gas + |= lit=(list (pair path _?>(?=(^ fil.fat) u.fil.fat))) + ^+ fat + ?~ lit fat + $(fat (put p.i.lit q.i.lit), lit t.lit) + :: + ++ tap + =| pax=path + =| out=(list (pair path _?>(?=(^ fil.fat) u.fil.fat))) + |- ^+ out + =? out ?=(^ fil.fat) :_(out [pax u.fil.fat]) + =/ dir ~(tap by dir.fat) + |- ^+ out + ?~ dir out + %= $ + dir t.dir + out ^$(pax (weld pax /[p.i.dir]), fat q.i.dir) + == + -- +:: :: |part: arvo structures and engines :: ++ part => |% :: $card: tagged, untyped event :: $ovum: card with cause + :: $hoof: hoon source + :: $news: collated updates + :: $oped: module updates :: :: XX replace top-level structures :: +$ card (cask) +$ ovum [=wire =card] + +$ hoof @t + +$ news + $: :: sys: installs + replacements + :: use: non-system files + :: + sys=(map path (cask)) + use=(map path (cask)) + == + +$ oped + $: zus=(unit hoof) + van=(list (cask hoof)) + == + +$ seed [hun=(unit hoof) arv=hoof] -- :: ~% %part ..part ~ @@ -288,6 +546,93 @@ :: +| %engines :: + :: |adapt + :: + ++ adapt + => |% + :: deep file as source + :: + ++ sole |=(a=(cask) `hoof`?>(?=([%hoon @t] a) q.a)) + -- + |_ fat=(axal (cask)) + :: + :: +group: collate changes + :: + ++ group + |= fal=(list (pair path (cask))) + =| del=news + |- ^+ del + ?~ fal del + :: classify files, ignoring unchanged + :: + =* pax p.i.fal + =* dat q.i.fal + =/ hav (~(get de fat) pax) + =? del |(?=(~ fil.hav) !=(u.fil.hav dat)) + ?: ?=([%sys *] pax) + del(sys (~(put by sys.del) pax dat)) + del(use (~(put by use.del) pax dat)) + $(fal t.fal) + :: +usurp: consider self-replacement + :: + ++ usurp + |= del=news + ^- (unit (pair seed (list (pair path (cask))))) + =/ hun (~(get by sys.del) /sys/hoon) + =/ arv (~(get by sys.del) /sys/arvo) + ?~ hun + ?~ arv ~ + `[`(sole u.arv) [/sys/arvo u.arv] ~] + =/ rav + ~| %usurp-hoon-no-arvo + ((bond |.((need fil:(~(get de fat) /sys/arvo)))) arv) + ~! rav + :+ ~ + [`(sole u.hun) (sole rav)] + [[/sys/arvo rav] [/sys/hoon u.hun] ~] + :: +adorn: augment capabilities + :: + ++ adorn + |= [del=news all=?] + ^- (pair oped _fat) + :: zuse: shared library + :: + =^ zus fat + ?^ hav=(~(get by sys.del) /sys/zuse) + :- `(sole u.hav) + (~(put de fat) /sys/zuse u.hav) + :_ fat + ~| %adorn-no-zuse + ?.(all ~ `(sole (need fil:(~(get de fat) /sys/zuse)))) + :: kernel modules + :: + :: %zuse is the subject of the vanes; force all if we have a new %zuse + :: + =| nav=(map term hoof) + =? nav |(all ?=(^ zus)) + %- ~(gas by nav) + %+ turn + ~(tap by dir:(~(get de fat) /sys/vane)) + |=([name=@ta _fat] [`@tas`name (sole (need fil))]) + :: + =^ new fat + %^ spin + %+ skim ~(tap by sys.del) + |=([p=path *] ?=([%sys %vane @tas ~] p)) + fat + |= [[p=path q=(cask)] taf=_fat] + ^- (pair (cask hoof) _fat) + ?> ?=([%sys %vane @tas ~] p) + =* nam i.t.t.p + ?> ((sane %tas) nam) + [[`@tas`nam (sole q)] (~(put de taf) p q)] + :: + =; van + [[zus van] fat] + %+ sort ~(tap by (~(gas by nav) new)) + |=([[a=@tas *] [b=@tas *]] (aor a b)) + -- :: adapt + :: :: |me: dynamic analysis :: ++ me @@ -422,39 +767,77 @@ :: |va: vane engine :: ++ va - ~/ %va + => |% + :: XX move next to +slap + :: + ++ swat + |= [vax=vase gen=hoon] + ^- (trap vase) + =/ gun (~(mint ut p.vax) %noun gen) + |.([p.gun .*(q.vax q.gun)]) + :: + ++ smit + |= [cap=tape pit=vase pax=path txt=@t] + ^- (trap vase) + ~> %slog.[0 leaf+"{cap}: {(scow p+(mug txt))}"] + %- road |. + ~_ leaf/cap + (swat pit (rain pax txt)) + :: + ++ create + |= [zus=vase lal=term pax=path txt=@t] + ^- vase + (slym $:(smit "vane {}" zus pax txt) zus) + :: + ++ settle + |= van=vase + ^- (pair vase worm) + =/ [rig=vase wor=worm] (~(slym wa *worm) van *vane-sample) + [van +:(~(slap wa wor) rig [%limb %scry])] + :: + :: XX pass identity to preserve behavior? + :: + ++ update + |= [las=vase nex=vase] + ^- vase + =/ sam=vase (slap (slym las *vane-sample) [%limb %stay]) + =/ gat=vase (slap (slym nex *vane-sample) [%limb %load]) + (slam gat sam) + -- + :: + ~% %va ..va ~ |_ [our=ship vil=vile vax=vase sac=worm] :: :: |plow:va: operate in time and space :: ++ plow - |= [now=@da sky=slyd] + |= [now=@da rok=rook] |% :: +peek:plow:va: read from a local namespace :: ++ peek - |= [fur=(unit (set monk)) ren=@t bed=beam] + ^- rook + |= [lyc=gang cyr=term bem=beam] ^- (unit (unit (cask meta))) :: namespace reads receive no entropy :: - =/ sam=vane-sample [our now *@uvJ sky] + =/ sam=vane-sample [our now *@uvJ rok] =^ rig sac ~> %mean.'peek: activation failed' (~(slym wa sac) vax sam) =^ gat sac - ~> %mean.'peek: call failed' + ~> %mean.'peek: pull failed' (~(slap wa sac) rig [%limb %scry]) :: - ;; (unit (unit (cask meta))) - %+ slum q.gat - ^- scry-sample - :* fur - ren - [%& p.bed] - q.bed - `coin`[%$ r.bed] - (flop s.bed) - == + =/ mas=[gang term beam] [lyc cyr bem] + :: + =^ pro sac + ~> %mean.'peek: call failed' + (~(slym wa sac) gat mas) + ?~ q.pro ~ + ?~ +.q.pro [~ ~] + =^ dat sac (~(slot wa sac) 7 pro) + ``[(,mark -.q.dat) (,^ +.q.dat)] :: :: |spin:plow:va: move statefully :: @@ -462,7 +845,7 @@ |= [hen=duct eny=@uvJ dud=(unit goof)] =* duc [duc.vil hen] =* err [dud.vil dud] - =/ sam=vane-sample [our now eny sky] + =/ sam=vane-sample [our now eny rok] =^ rig sac ~> %mean.'spin: activation failed' (~(slym wa sac) vax sam) @@ -528,139 +911,81 @@ :: |le: arvo event-loop engine :: ++ le - => |% - :: $germ: worklist source and bar stack - :: $plan: worklist - :: $debt: in-progress state - :: - +$ germ [vane=term bars=(list duct)] - +$ plan (pair germ (list move)) - +$ debt - $~ [~ ~ *germ ~] - $: :: run: list of worklists - :: out: pending output - :: gem: worklist metadata - :: dud: propagate error - :: - run=(list plan) - out=(list ovum) - gem=germ - dud=(unit goof) - == - -- - :: - ~% %le part ~ - =| debt - =* nub - - :: - |_ $: our=ship - now=@da - eny=@uvJ - lac=? - vil=vile - van=(map term vane) + ~% %le ..le ~ + =| $: :: run: list of worklists + :: out: pending output + :: gem: worklist metadata + :: dud: propagate error + :: but: reboot signal + :: + :: + run=(list plan) + out=(list ovum) + gem=germ + dud=(unit goof) + $= but %- unit + $: gat=$-(heir (trap ^)) + kel=(list (pair path (cask))) + fil=(list (pair path (cask))) + == == + :: + |_ [[pit=vase vil=vile] soul] +* this . - ++ plot run.nub - ++ then |=(paz=(list plan) this(run (weld run paz))) - ++ abed |=(nib=debt this(nub nib)) + sol +<+ + :: :: +abet: finalize loop :: - :: .ovo: optional effect to arvo itself - :: - :: If ovo is ~, the loop is over; produce ova. - :: Else, produce u.ovo and the unfinished .nub internal state. - :: ++ abet - |= ovo=(unit ovum) - ^- $: %+ each (list ovum) - $: fec=ovum - nub=debt - == - van=(list (pair term vane)) - == - :- ?~ ovo - &+(flop out) - |+[u.ovo nub] + ^- (each (pair (list ovum) soul) (trap ^)) + ?~ but + ^- [%& (pair (list ovum) soul)] + &/[(flop out) sol] + |/(gat.u.but [arvo [run out [kel fil]:u.but] sol]) + :: +poke: prepare a worklist-of-one from outside + :: + ++ poke + |= =ovum + ^+ this + ~> %mean.'arvo: poke crashed' + ~? !lac.fad ["" %unix p.card.ovum wire.ovum now] + (poke:pith ovum) + :: + ++ jump + |= =debt + ^+ this + =: run run.debt + out out.debt + == + :: apply remaining update :: - %+ sort ~(tap by van) - |=([[a=@tas *] [b=@tas *]] (aor a b)) + (~(lod what:pith fil.debt) kel.debt) :: +emit: enqueue a worklist with source :: ++ emit |= pan=plan this(run [pan run]) - :: +poke: prepare a worklist-of-one from outside - :: - ++ poke - |= [vane=term =ovum] - ^+ this - ~> %mean.'arvo: poke crashed' - ~? !lac ["" %unix p.card.ovum wire.ovum now] - =/ =maze - =/ =type [%cell [%atom %tas `%soft] %noun] - [%& type [%soft card.ovum]] - =/ =move - ~| [%bad-wire wire.ovum] - ?> ?=([%$ *] wire.ovum) - [duct=~ %pass t.wire.ovum vane maze] - (emit [%$ ~] move ~) - :: +crud: prepare a worklist-of-one with error report from outside - :: - ++ crud - |= [vane=term =goof =ovum] - ^+ this - ~> %mean.'arvo: crud crashed' - ~? !lac ["" %unix %crud p.card.ovum wire.ovum now] - =/ =maze - =/ =type [%cell [%atom %tas `%soft] %noun] - [%& type [%soft card.ovum]] - =/ =move - ~| [%bad-wire wire.ovum] - ?> ?=([%$ *] wire.ovum) - [duct=~ %hurl goof %pass t.wire.ovum vane maze] - (emit [%$ ~] move ~) - :: +spam: prepare a worklist for all targets - :: - ++ spam - |= =ovum - ^+ this - ~> %mean.'arvo: spam crashed' - :: fix up wire on %vega from previous kernel - :: - =? wire.ovum =(ovum [/ %vega ~]) //arvo - =/ ord=(list (pair term *)) - %+ sort - ~(tap by van) - |=([[a=@ *] [b=@ *]] (aor b a)) - |- ^+ this - ?~ ord - this - =. this (poke p.i.ord ovum) - $(ord t.ord) :: +loop: until done :: ++ loop - ^- abet - ?~ run - (abet ~) + ^+ abet + ?: ?| ?=(~ run) + ?=(^ but) + == + abet ?: =(~ q.i.run) :: XX TMI loop(run t.run) =. dud ~ =. gem p.i.run =^ mov=move q.i.run q.i.run - => .(run `(list plan)`run) :: XX TMI - =^ ovo=(unit ovum) this (step mov) - ?~ ovo - loop - (abet `u.ovo) + loop:(step mov) :: +step: advance the loop one step by routing a move :: ++ step |= =move - ^- [(unit ovum) _this] + ^+ this :: - ~? &(!lac ?=(^ dud)) %goof + ~? &(!lac.fad ?=(^ dud)) %goof :: ?- -.ball.move :: @@ -672,7 +997,7 @@ =* vane vane.note.ball.move =* task task.note.ball.move :: - ~? &(!lac !=(%$ vane.gem)) + ~? &(!lac.fad !=(%$ vane.gem)) :- (runt [(lent bars.gem) '|'] "") :^ %pass [vane.gem vane] ?: ?=(?(%deal %deal-gall) +>-.task) @@ -684,7 +1009,7 @@ :: :: cons source onto wire, and wire onto duct :: - `(call [[vane.gem wire] duct] vane task) + (call [[vane.gem wire] duct] vane task) :: :: %slip: lateral move :: @@ -693,11 +1018,11 @@ =* vane vane.note.ball.move =* task task.note.ball.move :: - ~? !lac + ~? !lac.fad :- (runt [(lent bars.gem) '|'] "") [%slip vane.gem (symp +>-.task) duct] :: - `(call duct vane task) + (call duct vane task) :: :: %give: return move :: @@ -709,21 +1034,11 @@ =/ duct t.duct.move =* gift gift.ball.move :: - ?~ duct - :: - :: the caller was Outside - :: - ~| [%xeno wire (symp -.q.p.gift)] - ?> ?=([%$ *] wire) - (xeno wire gift) - :: - :: the caller was a vane - :: - =^ vane=term wire + =^ way=term wire ~| [%give duct.move (symp -.q.p.gift)] ?>(?=(^ wire) wire) :: - ~? &(!lac |(!=(%blit +>-.gift) !=(%d vane.gem))) + ~? &(!lac.fad !=(%$ way) |(!=(%blit +>-.gift) !=(%d vane.gem))) :- (runt [(lent bars.gem) '|'] "") :^ %give vane.gem ?: ?=(%unto +>-.gift) @@ -731,7 +1046,7 @@ (symp +>-.gift) duct.move :: - `(take duct wire vane gift) + (take duct wire way gift) :: :: %hurl: action with error :: @@ -744,18 +1059,26 @@ :: +whey: measure memory usage :: ++ whey - ^- (list mass) + ^- mass + =; sam=(list mass) + :+ %arvo %| + :~ hoon+&+pit + zuse+&+zus.mod + vane+|+sam + == + :: =/ von - %+ turn - (sort ~(tap by van) |=([[a=@tas *] [b=@tas *]] (aor a b))) + %+ turn + (sort ~(tap by van.mod) |=([[a=@tas *] [b=@tas *]] (aor a b))) |=([lal=@tas =vane] (cat 3 %vane- lal)^vane) :: :~ :+ %reports %| %+ turn von =/ bem=beam [[our %home da+now] /whey] |= [lal=@tas =vane] - =/ met (need (need (peek ** ~ (rsh 3 5 lal) bem))) - lal^|+;;((list mass) q.q.met) + =/ met (peek ~ (rsh 3 5 lal) bem) + ?> &(?=(^ met) ?=(^ u.met)) :: XX make optional + lal^|+;;((list mass) q.q.u.u.met) :: :+ %caches %| %+ turn von @@ -768,34 +1091,29 @@ :: +peek: read from the entire namespace :: ++ peek - ^- slyd - |= [typ=* fur=(unit (set monk)) ron=term bed=beam] + ^- rook + |= [lyc=gang cyr=term bem=beam] ^- (unit (unit (cask meta))) :: - :: XX identity is defaulted to ship from beam + ?: ?=(%$ cyr) + (peek:pith lyc %$ bem) :: - => .(fur ?^(fur fur `[[%& p.bed] ~ ~])) :: XX vane and care are concatenated :: - =/ lal (end 3 1 ron) - =/ ren ;;(@t (rsh 3 1 ron)) - ?. (~(has by van) lal) + =/ lal (end 3 1 cyr) + =/ ren ;;(@t (rsh 3 1 cyr)) + ?. (~(has by van.mod) lal) ~ - (peek:(plow lal) fur ren bed) - :: +xeno: stash pending output - :: - ++ xeno - |= [=wire gift=maze] - ^- [(unit ovum) _this] - =/ ovo=ovum [wire ;;(card q.p.gift)] - ?: ?=(?(%lyra %veer %wack %verb %whey) -.card.ovo) - [`ovo this] - [~ this(out [ovo out])] + (peek:(plow lal) lyc ren bem) :: +call: advance to target :: ++ call |= [=duct way=term task=maze] ^+ this + ?: ?=(%$ way) + ~> %mean.'call: bad waif' + (call:pith ;;(waif:pith q.p.task)) + :: %+ push [way duct bars.gem] ~| bar-stack=`(list ^duct)`[duct bars.gem] %. task @@ -805,6 +1123,15 @@ ++ take |= [=duct =wire way=term gift=maze] ^+ this + ?: ?=(%$ way) + :: + :: the caller was Outside + :: + ?> ?=(~ duct) + (xeno:pith wire ;;(card q.p.gift)) + :: + :: the caller was a vane + :: %+ push [way duct bars.gem] :: :: cons source onto .gift to make a $sign @@ -820,7 +1147,7 @@ ^+ this =^ moz sac (~(refine-moves me sac vil) zom) - =. van (~(put by van) vane.gum [vax sac]) + =. van.mod (~(put by van.mod) vane.gum [vax sac]) (emit `plan`[`germ`gum `(list move)`moz]) :: +plow: operate on a vane, in time and space :: @@ -829,8 +1156,191 @@ ~| [%plow-failed way] =/ =vane ~| [%missing-vane way] - (~(got by van) way) + (~(got by van.mod) way) (~(plow va [our vil vane]) now peek) + :: + :: |pith: operate on arvo internals + :: + ++ pith + |% + ++ gest + |= =ovum + ^- $>(%pass ball) + =^ way=term wire.ovum + ~| %gest-wire + ?> ?=(^ wire.ovum) + [(wilt i.wire.ovum) t.wire.ovum] + :: + :: %$: default, routed to arvo-proper as trivial vase + :: @: route to vane XX remove %soft, clam via %zuse + :: + =/ =vase + ?- way + %$ noun/card.ovum + @ [cell/[atom/tas/`%soft %noun] soft/card.ovum] + == + [%pass wire.ovum way &/vase] + :: + :: |what: update engine + :: + :: +kel: (maybe) initiate a kernel update + :: +lod: continue with update after kernel +load + :: +mod: update the modules of the kernel + :: + ++ what + |_ fil=(list (pair path (cask))) + :: + ++ kel + ^+ ..pith + =/ del (~(group adapt fat.mod.sol) fil) + =/ tub (~(usurp adapt fat.mod.sol) del) + ?~ tub + (mod del |) + =/ pos=plan + [$/~ [*duct (gest [//arvo vega/~])] ~] + =/ gat (boot kel.ver.zen [hun arv]:p.u.tub) + %_ ..pith + but `[gat q.u.tub fil] + run (weld run [pos ~]) + == + :: + ++ lod + |= kel=(list (pair path (cask))) + ^+ ..pith + =. fat.mod.sol (~(gas de fat.mod.sol) kel) + %+ mod + (~(group adapt fat.mod.sol) fil) + %+ lien kel + |= [p=path *] + ?=([%sys ?(%arvo %hoon) *] p) + :: + ++ mod + |= [del=news all=?] + ^+ ..pith + =^ job=oped fat.mod.sol (~(adorn adapt fat.mod.sol) del all) + =? zus.mod.sol ?=(^ zus.job) + $:(smit:va "zuse" pit /sys/zuse/hoon u.zus.job) + %- (wyrd kel.ver.zen [zuse/;;(@ud q:(slap zus.mod.sol limb/%zuse)) ~]) + %= ..pith + van.mod + %+ roll van.job + |= [[nam=term txt=hoof] van=_van.mod.sol] + ^+ van + =/ way (wilt nam) + =/ nex (create:va zus.mod.sol way /sys/vane/[nam]/hoon txt) + =/ nav (~(get by van) way) + =? nex ?=(^ nav) (update:va vase.u.nav nex) + (~(put by van) way (settle:va nex)) + == + -- + :: + ++ call + |= =waif + ^+ ..pith + ?^ dud ~>(%mean.'pith: goof' !!) + ?- -.waif + %lyra =; wat $(waif wat) + :+ %what [/sys/arvo hoon/van.waif] + ?~ hun.waif ~ + [[/sys/hoon hoon/u.hun.waif] ~] + :: + :: %trim: clear state + :: + :: clears compiler caches if high-priority + :: XX add separate $wasp if this should happen last + :: + %trim =? van.mod =(0 p.waif) + (~(run by van.mod) |=(=vane vane(worm *worm))) + (emit $/~ (spam /arvo !>(waif))) + :: + %vega (emit $/~ (spam /arvo !>(waif))) :: XX also out + %verb ..pith(lac.fad ?~(p.waif !lac.fad u.p.waif)) + :: + %veer =/ pax + sys/?:(?=(%$ lal.waif) /zuse /vane/[(grow lal.waif)]) + $(waif what/[[pax hoon/txt.waif] ~]) + :: + %what ~(kel what p.waif) + %whey ..pith(out [[//arvo mass/whey] out]) + == + :: + ++ peek + ^- roof + |= [lyc=gang car=term bem=beam] + ^- (unit (unit cage)) + ?. ?| =(our p.bem) + ?=(%$ q.bem) + =([%da now] p.r.bem) + == + ~ + ?+ s.bem ~ + [%whey ~] ``mass/!>(whey) + [%zen %lag ~] ``noun/!>(lag.zen) + [%zen %vere ~] ``noun/!>(ver.zen) + == + :: + ++ poke + |= =ovum + ^+ ..pith + ?~ wire.ovum + ~>(%mean.'pith: bad wire' !!) + :: + ?. ?=(?(%crud %wack %wyrd) -.card.ovum) + (emit $/~ [*duct (gest ovum)] ~) + :: + =/ buz ~> %mean.'pith: bad wasp' + ;;(wasp card.ovum) + ?- -.buz + :: + :: %crud: forward error notification + :: + %crud =? lag.zen ?& ?=(%exit mote.goof.buz) + ?=(^ tang.goof.buz) + ?=(%leaf -.i.tang.goof.buz) :: XX ?@ + ?=(%wyrd (crip p.i.tang.goof.buz)) + == + ~&(%lagging &) + (emit $/~ [*duct hurl/[goof.buz (gest ovum.buz)]] ~) + :: + :: XX review + :: + %wack ..pith(eny (shaz (cat 3 eny p.buz))) + :: + :: %wyrd: check for runtime kelvin compatibility + :: + %wyrd %- %+ wyrd kel.p.buz + ^- (list (pair term @)) + :~ hoon/hoon-version + arvo/arvo + zuse/;;(@ q:(slap zus.mod limb/%zuse)) + == + =? lag.zen !=(rev.ver.zen rev.p.buz) ~&(%unlagging |) + ..pith(ver.zen p.buz) + == + :: + ++ spam + |= [=wire =vase] + ^- (list move) + %+ turn + %+ sort ~(tap by van.mod) + |=([[a=@tas *] [b=@tas *]] (aor a b)) + |=([way=term *] `move`[*duct %pass wire way `maze`&/vase]) + :: + ++ xeno + |= =ovum + ^+ this + :: XX update clients to %pass to arvo, remove + :: + ?: ?=(?(%lyra %veer %verb %whey) -.card.ovum) + %- call + ~> %mean.'xeno: bad waif' + ;;(waif:pith card.ovum) + :: + :: XX uncomment to restore previous routing + :: + :: =. wire.ovum $/wire.ovum + this(out [ovum out]) + -- -- -- :: @@ -838,452 +1348,55 @@ |= a=* ^- @tas ?.(&(?=(@ a) ((sane %tas) a)) %$ a) :: -++ vent :: vane core - |= [who=ship lal=@tas vil=vile bud=vase =vane] - ~% %vent +>+ ~ - |% - ++ ruck :: update vase - |= {pax/path txt/@ta} - ^+ +> - :: XX should use real entropy and the real date - :: - =/ arg=vane-sample - [who ~2000.1.1 *@uvJ =>(~ |~(* ~))] - =+ rig=(slym vase.vane arg) - =+ gen=(rain pax txt) - =+ rev=(slym (slap bud gen) bud) - =+ syg=(slym rev arg) - :: update the vane itself - :: - :: We don't cache the n+slap/+slam types because they're only used once - :: right here; they'll never be used again. - :: - =. vase.vane - ~| %load-lost - (slam (slap syg [%limb %load]) (slap rig [%limb %stay])) - :: prime the new compiler cache - :: - prime - :: reset and prime the worm cache for scrys +++ boot + |= [kel=wynn hun=(unit @t) van=@t] + ^- $-(heir (trap ^)) + ~> %mean.'vega: ruin' + ?~ hun + =/ gat + ~> %slog.[0 leaf/"vega: compiling arvo"] + %- road |. + (slap !>(..ride) (rain /sys/arvo/hoon van)) + =/ lod + (slap (slot 7 gat) [%limb %load]) + |= =heir + |. ;;(^ q:(slam lod !>(heir))) :: - :: If the +slap/+slym in scry isn't cached, we spend the majority of - :: the time in a scry in the compiler. The +scry gate cannot have side - :: effects so we can't modify the cache at access time. So we seed the - :: cache with all the things +scry will need when we install the vane + :: hyp: hoon core type + :: hoc: hoon core + :: cop: compiler gate :: - ++ prime - ^+ ..prime - :: - %_ ..prime - worm.vane - :: reset cache and add in vane activation entry - :: - =^ rig worm.vane - (~(slym wa *worm) vase.vane *vane-sample) - :: cache the access of the %scry arm - :: - +:(~(slap wa worm.vane) rig [%limb %scry]) - == - -- -:: -++ vint :: create vane - |= $: who=ship - lal=@tas - vil=vile - bud=vase - pax=path - txt=@ta - == - =; res ?-(-.res %& p.res, %| (mean leaf+"vint: {}" p.res)) - %- mule |. - =+ gen=(rain pax txt) - ~> %slog.[0 leaf+"vane: parsed {(scow p+(mug gen))}"] - =+ pro=(vent who lal vil bud [(slym (slap bud gen) bud) *worm]) - ~> %slog.[0 leaf+"vane: compiled {(scow p+(mug pro))}"] - prime:pro -:: -++ viol :: vane tools - |= but/type - ^- vile - =+ pal=|=(a/@t ^-(type (~(play ut but) (vice a)))) - :* typ=(pal '$:type') - duc=(pal '$:duct') - wir=(pal '$:wire') - dud=(pal '=<($ (unit goof))') :: XX misparse - == -:: -++ dint :: input routing - |= hap/path ^- @tas - ?+ hap ~|([%bad-dint hap] !!) - {@ $ames *} %a - {@ $boat *} %c - {@ $newt *} %a - {@ $sync *} %c - {@ $term *} %d - {@ $http-client *} %i - {@ $http-server *} %e - {@ $behn *} %b - == -:: -++ is & --- -=< :: Arvo larval stage - :: - :: The true Arvo kernel knows who it is. It should not *maybe* - :: have an identity, nor should it contain multitudes. This outer - :: kernel exists to accumulate identity, entropy, and the - :: standard library. Upon having done so, it upgrades itself into - :: the true Arvo kernel. Subsequent upgrades will fall through - :: the larval stage directly into the actual kernel. - :: - :: For convenience, this larval stage also supports hoon compilation - :: with +wish and vane installation with the %veer event. - :: - =/ pit=vase !>(..is) - =| $: :: who: our identity once we know it - :: eny: entropy once we learn it - :: bod: %zuse once we receive it - :: - who=(unit ship) - eny=(unit @) - bod=(unit vase) - == - :: larval Arvo structural interface - :: - |% - ++ come ^come :: 4 - ++ load ^load :: 10 - ++ peek |=(* ~) :: 46 - :: - ++ poke |= * :: 47 - ^- [(list ovum) *] - => .(+< ;;([now=@da ovo=ovum] +<)) - ^- [(list ovum) *] - =. +>.$ - ?+ -.q.ovo - :: ignore unrecognized - :: - ~& [%larval-ignore p.ovo -.q.ovo] - +>.$ - :: install %zuse or vane - :: - %veer - ^+ +>.$ - :: use the maximum comet if we don't know who we are yet - :: - =/ our - ?^ who - u.who - =/ fip=ship (dec (bex 128)) - ~> %slog.[0 leaf+"arvo: larval identity {(scow %p fip)}"] - fip - =. soul (veer our now q.ovo) - +>.$(bod ?^(bod bod `bud.^poke)) - :: add entropy - :: - %wack - ^+ +>.$ - ?> ?=(@ q.q.ovo) - +>.$(eny `q.q.ovo) - :: become who you were born to be - :: - %whom - ^+ +>.$ - ?> ?=(@ q.q.ovo) - +>.$(who `q.q.ovo) - == - :: upgrade once we've accumulated identity, entropy, and %zuse - :: - ?. &(?=(^ who) ?=(^ eny) ?=(^ bod)) - [~ +>.$] - ~> %slog.[0 leaf+"arvo: metamorphosis"] - ~< %slog.[0 leaf+"arvo: metamorphosed"] - =/ nyf - (turn vanes.^poke |=([label=@tas =vane] [label vase.vane])) - (load u.who now u.eny *pram u.bod nyf) - :: - ++ wish |= txt=* :: 22 - ?> ?=(@ txt) - q:(slap ?~(bod pit u.bod) (ream txt)) - -- -:: -:: persistent arvo state -:: -=/ pit=vase !>(..is) :: -=/ vil=vile (viol p.pit) :: cached reflexives -=| $: lac=_& :: laconic bit - eny=@ :: entropy - our=ship :: identity - bud=vase :: %zuse - vanes=(list [label=@tas =vane]) :: modules - == :: -:: produce an interface that vere understands -:: -=< arvo -:: soul: arvo implementation core -:: -|% -++ soul . -:: arvo: structural interface core -:: -++ arvo - |% - ++ come |= [@ @ @ pram vise pone] :: 4 - (come:soul +<) - :: - ++ load |= [@ @ @ pram vase pane] :: 10 - (load:soul +<) - :: - ++ peek |= * :: 46 - =/ rob (^peek ;;([@da path] +<)) - ?~ rob ~ - ?~ u.rob ~ - [~ u.u.rob] - :: - ++ poke |= * :: 47 - => .(+< ;;([now=@da ovo=ovum] +<)) - (poke:soul now ovo) - :: - ++ wish |=(* (^wish ;;(@ta +<))) :: 22 - -- -:: $pram: upgradeable state -:: +dram: upgrade $pram, compatible -:: -+$ pram - $~ [%~2020.6.28 nub=*debt:le:part] - $% [%~2020.6.28 nub=debt:le:part] - (list ovum) - == -++ dram - |= ram=pram - ^- pram - ?: ?=([%~2020.6.28 *] ram) - ram - ~| ram+ram - =| nub=debt:le:part - =/ =plan:le:part - :- [%$ ~] - %+ turn ;;((list ovum) ram) - |= ovo=ovum - ^- move - [[p.ovo]~ %give %& %noun q.ovo] - [%~2020.6.28 nub(run [plan]~)] -:: $prim: old $pram -:: +drum: upgrade $prim to $pram, incompatible -:: -+$ prim pram -++ drum |=(prim +<) -:: +come: load incompatible -:: -++ come - |= [who=ship now=@da yen=@ rim=prim dub=vise nyf=pone] - ^- [(list ovum) *] - ~| %come - =/ fyn (turn nyf |=([a=@tas b=vise] [a (slim b)])) - =/ rum (drum rim) - (load who now yen rum (slim dub) fyn) -:: +load: load compatible, notifying vanes -:: -++ load - |= [who=ship now=@da yen=@ ram=pram dub=vase nyf=pane] - ^- [(list ovum) *] - ~| %load - =: our who - eny yen - bud dub - vanes (turn nyf |=({a/@tas b/vise} [a [b *worm]])) - == - =. ram (dram ram) - ?> ?=([%~2020.6.28 *] ram) - =/ run plot:(spam:(lead now ~) [//arvo %vega ~]) - (leap now (then:(lead now `nub.ram) run)) -:: +peek: external inspect -:: -++ peek - |= {now/@da hap/path} - ^- (unit (unit)) - ?~ hap [~ ~ hoon-version] - ?: =(hap /whey) - ``mass+(whey now) - ((sloy peek:(lead now ~)) [[151 %noun] hap]) -:: +poke: external apply -:: -++ poke - |= [now=@da ovo=ovum] - =. eny (shaz (cat 3 eny now)) - ~| poke+-.q.ovo - |- ^- [(list ovum) *] - ?+ -.q.ovo - :: Normal events are routed to a single vane - :: - (leap now (poke:(lead now ~) (dint p.ovo) ovo)) - :: Print warning and no-op. - :: - %warn - :_ arvo - ?. ?=(^ +.q.ovo) - ~ - =/ msg=tape - :(weld "(for %" (trip (symp +<.q.ovo)) ") failed") - ~> %slog.[0 leaf+(weld "arvo: replacement event " msg)] - ?: lac - ~ - =/ rep - %- mule |. - ((slog (tang +>.q.ovo)) ~) - ~ - :: Process these events just as if they had come from a vane - :: - ?(%lyra %veer %verb %wack %whey) (feck now ovo *debt:le:part) - :: These external events (currently only %trim) are global - :: notifications, spammed to every vane - :: - %trim - => .(ovo ;;((pair wire [%trim p=@ud]) ovo)) - =^ zef vanes loop:(spam:(lead now ~) ovo) - :: clear compiler caches if high-priority - :: - =? vanes =(0 p.q.ovo) - ~> %slog.[0 leaf+"arvo: trim: clearing caches"] - (turn vanes |=([a=@tas =vane] [a vase.vane *worm])) - ?: ?=(%& -.zef) - [p.zef arvo] - (feck now [fec nub]:p.zef) - :: Error notifications are unwrapped and routed as usual - :: - %crud - ?. ?=(^ q.q.ovo) - ~|([%unknown-crud q.ovo] !!) - :: - %+ leap now - ?@ -.q.q.ovo - :: legacy %crud, directly routed - :: - (poke:(lead now ~) (dint p.ovo) ovo) - :: modern %crud, unwrapped and routed w/ $goof - :: - =/ =goof ;;(goof -.q.q.ovo) - =/ =curd ;;(curd +.q.q.ovo) - (crud:(lead now ~) (dint p.ovo) goof p.ovo curd) - == -:: +lead: initialize +le core -:: -++ lead - |= [now=@da nub=(unit debt:le:part)] - ^+ le:part - ~| lead+.?(nub) - =; el - ?~ nub el - (abed:el u.nub) - ~(. le:part our now eny lac vil (~(gas by *(map term vane)) vanes)) -:: +leap: run vane loop and handle effects -:: -++ leap - |= [now=@da el=_le:part] - ^- [(list ovum) *] - ~| %leap - =^ zef vanes loop:el - ?: ?=(%& -.zef) - [p.zef arvo] - (feck now [fec nub]:p.zef) -:: +whey: report memory usage -:: -++ whey - |= now=@da - ^- mass - :+ %arvo %| - :~ hoon+&+pit - zuse+&+bud - vane+|+whey:(lead now ~) - == -:: +feck: handle an effect from a vane -:: -++ feck - |= [now=@da ovo=ovum nub=debt:le:part] - ^- [(list ovum) *] - ~| feck+-.q.ovo - ?: ?=(%lyra -.q.ovo) - (vega now nub ;;([(unit @) @] +.q.ovo)) - ?+ -.q.ovo ~|(bad-fec+-.q.ovo !!) - :: produce memory usage report - :: - %whey - =. out.nub [[p.ovo mass+(whey now)] out.nub] - (leap now (lead now `nub)) - :: %verb: toggle event verbose event printfs - :: - %verb - =. lac !lac - (leap now (lead now `nub)) - :: %veer: install %zuse or vane - :: - %veer - =. soul (veer our now q.ovo) - (leap now (lead now `nub)) - :: %wack: add entropy - :: - %wack - ?> ?=(@ q.q.ovo) - =. eny (shaz (cat 3 eny q.q.ovo)) - (leap now (lead now `nub)) - == -:: +vega: reboot kernel -:: -++ vega - |= $: :: now: current date - :: nub: vane continuation state - :: hun: hoon.hoon source, or ~ if unchanged - :: arv: arvo.hoon source - :: - now=@da - nub=debt:le:part - hun=(unit @t) - van=@t - == - :: produce a new kernel and an effect list - :: - ^- [(list ovum) *] - :: go metacircular as hint to vere to run in new memory arena - :: - =; res ?-(-.res %& p.res, %| (mean leaf+"vega: ruin" p.res)) - %- mule |. - :: obtain hoon compiler data - :: - :: Arvo is compiled against the hoon.hoon vase with its outer +ride - :: gate stripped off, leaving the main core. - :: - :: hyp: hoon core type - :: hoc: hoon core - :: cop: compiler gate - :: lod: can we use the +load arm? (language-compatible upgrade) - :: - =/ [hyp=* hoc=* cop=* lod=?] - :: if no new hoon.hoon source, use current compiler - :: - ?~ hun - [-:!>(+>:ride) +>:ride ride &] + =/ [hyp=* hoc=* cop=*] :: compile new hoon.hoon source with the current compiler :: =/ raw - ~> %slog.[0 leaf+"vega: compiling hoon"] + ~> %slog.[0 leaf/"vega: compiling hoon"] (road |.((ride %noun u.hun))) :: activate the new compiler gate, producing +ride :: =/ cop .*(0 +.raw) - :: find the hoon version number of the new kernel + :: find the kelvin version number of the new compiler :: =/ nex - (@ .*(cop q:(~(mint ut p.raw) %noun [%limb %hoon-version]))) - ?> |(=(nex hoon-version) =(+(nex) hoon-version)) + ;;(@ .*(cop q:(~(mint ut p.raw) %noun [%limb %hoon-version]))) + :: require single-step upgrade + :: + ?. |(=(nex hoon-version) =(+(nex) hoon-version)) + :: XX revise hint + :: + ~>(%mean.'wyrd: vega:' !!) + :: require runtime compatibility + :: + %- (wyrd kel [hoon/nex ~]) + :: :: if we're upgrading language versions, recompile the compiler :: =^ hot=* cop ?: =(nex hoon-version) [raw cop] - ~> %slog.[0 leaf+"vega: recompiling hoon {}k"] - ~& [%hoon-compile-upgrade nex] - %- road |. - =/ hot (slum cop [%noun hun]) + =/ hot + ~> %slog.[0 leaf+"vega: recompiling hoon %{<`@`nex>}"] + (road |.((slum cop [%noun u.hun]))) [hot .*(0 +.hot)] :: extract the hoon core from the outer gate (+ride) :: @@ -1292,85 +1405,295 @@ :: =/ hyp -:(slum cop [-.hot '+>']) :: - [hyp hoc cop =(nex hoon-version)] + [hyp hoc cop] + :: :: compile arvo :: =/ rav - ~> %slog.[0 leaf+"vega: compiling kernel {(scow %p (mug hyp))}"] - %- road |. - (slum cop [hyp van]) - :: activate arvo, and extract the arvo core from the outer gate + ~> %slog.[0 leaf/"vega: compiling arvo"] + (road |.((slum cop [hyp van]))) + :: activate arvo and extract the arvo core from the outer gate :: - ~> %slog.[0 leaf+"vega: extracting core"] =/ voc .*(hoc [%7 +.rav %0 7]) - :: entry gate: ++load for the normal case, ++come for upgrade :: - =/ gat - =/ arm ?:(lod 'load' 'come') - ~> %slog.[0 leaf+"vega: +{(trip arm)}"] - :: compute the type of the arvo.hoon core + :: extract the upgrade gate +load + :: + :: XX +come is now ignored, remove? + :: XX could be a constant axis now (currently +10) + :: + =/ lod + :: vip: type of the arvo.hoon core + :: fol: formula for the +load gate :: =/ vip -:(slum cop [-.rav '+>']) - :: compute the formula for the upgrade gate - :: - =/ fol +:(slum cop [vip arm]) + =/ fol +:(slum cop [vip 'load']) :: produce the upgrade gate :: .*(voc fol) - :: upgrade gate sample :: - =/ sam - :* our - now - eny - [%~2020.6.28 nub] - bud - (turn vanes |=([label=@tas =vane] [label vase.vane])) - == - :: call into the new kernel - :: - ~> %slog.[0 leaf+"vega: evolving"] - ~< %slog.[0 leaf+"vega: evolution"] - =/ out (slum gat sam) - :: add types to the product - :: - ;;([(list ovum) *] out) -:: +veer: install %zuse or a vane + |= =heir + |. ;;(^ (slum lod heir)) :: -:: Identity is in the sample so the larval stage -:: can use this too. -:: -++ veer - |= [who=ship now=@da fav=curd] - ^+ soul - => .(fav ;;([%veer lal=@tas pax=path txt=@t] fav)) - =; res ?-(-.res %& p.res, %| (mean leaf+"veer: {}" p.res)) - %- mule |. - ?: =(%$ lal.fav) - ~> %slog.[0 leaf+"zuse: {(scow p+(mug txt.fav))}"] - =+ gen=(rain pax.fav txt.fav) - =+ vax=(slap pit gen) - soul(bud vax) - %_ soul - vanes - |- ^+ vanes - ?~ vanes - ~> %slog.[0 leaf+"vane: {} {(scow p+(mug txt.fav))}"] - =/ vin (vint who lal.fav vil bud pax.fav txt.fav) - [[lal.fav vane.vin] vanes] - ?. =(lal.fav label.i.vanes) - [i.vanes $(vanes t.vanes)] - ~> %slog.[0 leaf+"vane: {} {(scow p+(mug txt.fav))}"] - :_ t.vanes - :- label.i.vanes - ~| [%failed-vane-activation lal.fav] - =< vane - %. [pax txt]:fav - ruck:(vent who lal.fav vil bud [vase.vane.i.vanes *worm]) +++ viol :: vane tools + |= but=type + ^- vile + =+ pal=|=(a=@t ^-(type (~(play ut but) (vice a)))) + :* typ=(pal '$:type') + duc=(pal '$:duct') + wir=(pal '$:wire') + dud=(pal '=<($ (unit goof))') :: XX misparse == +:: +++ grow + |= way=term + ?+ way way + %a %ames + %b %behn + %c %clay + %d %dill + %e %eyre + %f %ford + %g %gall + %i %iris + %j %jael + == +:: +++ wilt + |= van=term + ?+ van van + %ames %a + %behn %b + %clay %c + %dill %d + %eyre %e + %ford %f + %gall %g + %iris %i + %jael %j + == +:: +++ is & +-- => +:: +:: cached reflexives +:: +=/ pit=vase !>(..is) +=/ vil=vile (viol p.pit) +:: +:: arvo state, as a discriminable sample +:: +=| [_arvo soul] +=* sol -> +|% +:: +:: +come: load incompatible +:: +++ come |=(* !!) :: +4 +:: +:: +load: load compatible, notifying vanes +:: +++ load :: +10 + |= hir=$<(%grub heir) + ^- ^ + ~| %load + :: store persistent state + :: + =. sol + ?- -.hir + _arvo soul.hir + == + :: clear compiler caches + :: + =. van.mod (~(run by van.mod) |=(=vane vane(worm *worm))) + :: + %- %+ wyrd kel.ver.zen + ^- (list (pair term @)) + :~ hoon/hoon-version + arvo/arvo + zuse/;;(@ q:(slap zus.mod limb/%zuse)) + == + :: restore working state and resume + :: + =/ zef=(each (pair (list ovum) soul) (trap ^)) + loop:(~(jump le:part [pit vil] sol) debt.hir) + ?- -.zef + %& [p.p.zef ..load(sol q.p.zef)] + %| $:p.zef + == +:: +:: +peek: external inspect +:: +++ peek :: +46 + |= $: lyc=gang + $= nom + %+ each path + $% [%once cyr=term syd=desk tyl=spur] + [%beam cyr=term bem=beam] + == + == + ^- (unit (cask)) + =/ hap=(unit [pat=? cyr=term bem=beam]) + ?- nom + [%& *] ?~ p.nom ~ + ?~ bem=(de-beam t.p.nom) ~ + `[| i.p.nom u.bem] + :: + [%| %beam *] `[| cyr bem]:p.nom + :: + [%| %once *] `[& cyr.p.nom [our syd.p.nom da/now] tyl.p.nom] + == + :: + ?~ hap ~ + =/ pro (~(peek le:part [pit vil] sol) lyc [cyr bem]:u.hap) + ?: |(?=(~ pro) ?=(~ u.pro)) ~ + =/ dat=(cask) [p q.q]:u.u.pro + ?. pat.u.hap `dat + `[%omen [cyr.u.hap (en-beam bem.u.hap)] dat] +:: +:: +poke: external apply +:: +++ poke :: +47 + |= [now=@da ovo=ovum] + ^- ^ + =: eny.sol (shaz (cat 3 eny now)) :: XX review + now.sol now + == + :: + ~| poke+-.q.ovo + =/ zef=(each (pair (list ovum) soul) (trap ^)) + loop:(~(poke le:part [pit vil] sol) ovo) + ?- -.zef + %& [p.p.zef ..poke(sol q.p.zef)] + %| $:p.zef + == +:: :: +wish: external compute :: -++ wish - |= txt/@ - q:(slap bud (ream txt)) +++ wish :: +22 + |= txt=@ + q:(slap zus.mod (ream txt)) +-- +:: +:: larval stage +:: +:: The true Arvo kernel knows who it is. It should not *maybe* +:: have an identity, nor should it contain multitudes. This outer +:: kernel exists to accumulate identity, entropy, and the +:: standard library. Upon having done so, it upgrades itself into +:: the true Arvo kernel. Subsequent upgrades will fall through +:: the larval stage directly into the actual kernel. +:: +:: For convenience, this larval stage also supports hoon compilation +:: with +wish and vane installation with the %veer event. +:: +=> |% + ++ mint + |= [vax=vase lal=term pax=path txt=@t] + ^- (trap vase) + =/ cap ?:(?=(%$ lal) "zuse" "vane {}") + (smit:va:part cap vax pax txt) + :: + ++ molt + |= [now=@da grub] + ^- (unit heir) + ?. &(?=(^ who) ?=(^ eny) ?=(^ ver) ?=(^ fat) ?=(^ bod)) + ~ + =/ zus $:u.bod + %- %+ wyrd kel.u.ver + ^- (list (pair term @)) + :~ hoon/hoon-version + arvo/arvo + zuse/;;(@ud q:(slap zus limb/%zuse)) + == + =/ nav %- ~(run by van) + |=(a=(trap vase) (settle:va:part (slym $:a zus))) + :^ ~ arvo *debt + [[u.who now u.eny] [lac] [u.ver |] u.fat zus nav] + -- +:: +:: larval state, as a discriminable sample +:: +=| [%grub _arvo grub] +=* gub ->+ +:: +|% +++ come ^come :: +4 +:: +++ load :: +10 + |= hir=heir + ?: ?=(%grub -.hir) + ~>(%mean.'arvo: larval reboot' !!) :: XX support + (^load hir) +:: +++ peek _~ :: +46 +:: +++ poke :: +47 + |= [now=@da ovo=ovum] + ^- ^ + =/ wip + ~| [p.ovo p.q.ovo] + ~> %mean.'arvo: bad wisp' + ;;(wisp q.ovo) + :: + =. ..poke + |- ^+ ..poke + ?- -.wip + %verb ..poke(lac ?~(p.wip !lac u.p.wip)) + :: + %veer =/ pax + sys/?:(?=(%$ lal.wip) /zuse /vane/[(grow lal.wip)]) + $(q.ovo what/[[pax hoon/txt.wip] ~]) + :: + %wack ..poke(eny `p.wip) + :: + %what =/ taf (fall fat *(axal (cask))) + =/ del (~(group adapt:part taf) p.wip) + =/ tub (~(usurp adapt:part taf) del) + ?: &(?=(^ dir.taf) ?=(^ tub)) + ~>(%mean.'arvo: larval reboot' !!) :: XX support + :: + :: require, and unconditionally adopt, initial kernel source + :: + =? taf =(~ dir.taf) :: XX TMI + ~| %larval-need-kernel + ?> &(?=(^ tub) ?=(^ hun.p.u.tub)) + (~(gas de taf) q.u.tub) + :: + =^ job taf [p q]:(~(adorn adapt:part taf) del |) + =? bod ?=(^ zus.job) + `(mint pit %$ /sys/zuse/hoon u.zus.job) + %= ..poke + fat `taf + van + %+ roll van.job + |= [[(cask hoof:part)] =_van] + ^+ van + ?> ?=(^ bod) + =/ way (wilt p) + (~(put by van) way (mint $:u.bod way /sys/vane/[p]/hoon q)) + == + :: + %whom ..poke(who ~|(%whom-once ?>(?=(~ who) `p.wip))) + :: + %wyrd %- %+ wyrd kel.p.wip + ^- (list (pair term @)) + :* hoon/hoon-version + arvo/arvo + ?~ bod ~ + [zuse/;;(@ud q:(slap $:u.bod limb/%zuse)) ~] + == + ..poke(ver `p.wip) + == + :: + ?~ hir=(molt now gub) + [~ ..poke] + :: + :: upgrade once we've accumulated necessary state + :: + ~> %slog.[0 leaf+"arvo: metamorphosis"] + (load u.hir) +:: +++ wish :: +22 + |= txt=* + q:(slap ?~(bod pit $:u.bod) (ream ;;(@t txt))) -- diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 8d1d39275..6160485f8 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -192,11 +192,11 @@ :: tests whether an `a` is in the head or tail of a noun. produces %2 if it :: is within the head, or %3 if it is within the tail. |= a=@ - ^- ?($2 $3) + ^- ?(%2 %3) ?- a - $2 %2 - $3 %3 - ?($0 $1) !! + %2 %2 + %3 %3 + ?(%0 %1) !! * $(a (div a 2)) == :: @@ -224,37 +224,37 @@ :: a composed axis ^- @ ?- b - $1 a - $2 (mul a 2) - $3 +((mul a 2)) + %1 a + %2 (mul a 2) + %3 +((mul a 2)) * (add (mod b 2) (mul $(b (div b 2)) 2)) == :: :: :::: 2n: functional hacks :: :: :: :: -++ aftr |*(a/$-(* *) |*(b/$-(* *) (pair b a))) :: pair after -++ cork |*({a/$-(* *) b/$-(* *)} (corl b a)) :: compose forward +++ aftr |*(a=$-(* *) |*(b=$-(* *) (pair b a))) :: pair after +++ cork |*([a=$-(* *) b=$-(* *)] (corl b a)) :: compose forward ++ corl :: compose backwards - |* {a/$-(* *) b/$-(* *)} + |* [a=$-(* *) b=$-(* *)] =< +:|.((a (b))) :: type check =+ c=+<.b |@ ++ $ (a (b c)) -- :: ++ cury :: curry left - |* {a/$-(^ *) b/*} + |* [a=$-(^ *) b=*] =+ c=+<+.a |@ ++ $ (a b c) -- :: ++ curr :: curry right - |* {a/$-(^ *) c/*} + |* [a=$-(^ *) c=*] =+ b=+<+.a |@ ++ $ (a b c) -- :: -++ fore |*(a/$-(* *) |*(b/$-(* *) (pair a b))) :: pair before +++ fore |*(a=$-(* *) |*(b=$-(* *) (pair a b))) :: pair before :: ++ head |*(^ ,:+<-) :: get head ++ same |*(* +<) :: identity @@ -269,7 +269,7 @@ :: :: the most basic of data types +| %containers -++ bloq ++$ bloq :: blocksize :: :: a blocksize is the power of 2 size of an atom. ie, 3 is a byte as 2^3 is @@ -287,7 +287,7 @@ [%& p=this] == :: -++ gate ++$ gate :: function :: :: a core with one arm, `$`--the empty name--which transforms a sample noun @@ -318,9 +318,9 @@ :: :: mold generator: produces a mold of a null-terminated list of the :: homogeneous type {a} with at least one element. - [i/item t/(list item)] + [i=item t=(list item)] :: -++ mold ++$ mold :: normalizing gate :: :: a gate that accepts any noun, and validates its shape, producing the @@ -430,51 +430,51 @@ :: fall, flit, lift, mate, need, some :: :: ++ biff :: apply - |* {a/(unit) b/$-(* (unit))} + |* [a=(unit) b=$-(* (unit))] ?~ a ~ (b u.a) :: ++ bind :: argue - |* {a/(unit) b/gate} + |* [a=(unit) b=gate] ?~ a ~ [~ u=(b u.a)] :: ++ bond :: replace - |* a/(trap) - |* b/(unit) + |* a=(trap) + |* b=(unit) ?~ b $:a u.b :: ++ both :: all the above - |* {a/(unit) b/(unit)} + |* [a=(unit) b=(unit)] ?~ a ~ ?~ b ~ [~ u=[u.a u.b]] :: ++ clap :: combine - |* {a/(unit) b/(unit) c/_=>(~ |=(^ +<-))} + |* [a=(unit) b=(unit) c=_=>(~ |=(^ +<-))] ?~ a b ?~ b a [~ u=(c u.a u.b)] :: ++ clef :: compose - |* {a/(unit) b/(unit) c/_=>(~ |=(^ `+<-))} + |* [a=(unit) b=(unit) c=_=>(~ |=(^ `+<-))] ?~ a ~ ?~ b ~ (c u.a u.b) :: ++ drop :: enlist - |* a/(unit) + |* a=(unit) ?~ a ~ [i=u.a t=~] :: ++ fall :: default - |* {a/(unit) b/*} + |* [a=(unit) b=*] ?~(a b u.a) :: ++ flit :: make filter - |* a/$-(* ?) - |* b/* + |* a=$-(* ?) + |* b=* ?.((a b) ~ [~ u=b]) :: ++ hunt :: first of units @@ -488,24 +488,24 @@ ?:((ord u.a u.b) a b) :: ++ lift :: lift mold (fmap) - |* a/mold :: flipped - |* b/(unit) :: curried + |* a=mold :: flipped + |* b=(unit) :: curried (bind b a) :: bind :: ++ mate :: choose - |* {a/(unit) b/(unit)} + |* [a=(unit) b=(unit)] ?~ b a ?~ a b ?.(=(u.a u.b) ~>(%mean.'mate' !!) a) :: ++ need :: demand ~/ %need - |* a/(unit) + |* a=(unit) ?~ a ~>(%mean.'need' !!) u.a :: ++ some :: lift (pure) - |* a/* + |* a=* [~ u=a] :: :::: 2b: list logic :: @@ -515,14 +515,14 @@ :: +snoc: append an element to the end of a list :: ++ snoc - |* [a/(list) b/*] + |* [a=(list) b=*] (weld a ^+(a [b]~)) :: ++ fand :: all indices ~/ %fand - |= {nedl/(list) hstk/(list)} - =| i/@ud - =| fnd/(list @ud) + |= [nedl=(list) hstk=(list)] + =| i=@ud + =| fnd=(list @ud) |- ^+ fnd =+ [n=nedl h=hstk] |- @@ -536,8 +536,8 @@ :: ++ find :: first index ~/ %find - |= {nedl/(list) hstk/(list)} - =| i/@ud + |= [nedl=(list) hstk=(list)] + =| i=@ud |- ^- (unit @ud) =+ [n=nedl h=hstk] |- @@ -551,7 +551,7 @@ :: ++ flop :: reverse ~/ %flop - |* a/(list) + |* a=(list) => .(a (homo a)) ^+ a =+ b=`_a`~ @@ -560,13 +560,13 @@ $(a t.a, b [i.a b]) :: ++ gulf :: range inclusive - |= {a/@ b/@} + |= [a=@ b=@] ?> (lte a b) |- ^- (list @) ?:(=(a +(b)) ~ [a $(a +(a))]) :: ++ homo :: homogenize - |* a/(list) + |* a=(list) ^+ =< $ |@ ++ $ ?:(*? ~ [i=(snag 0 a) t=$]) -- @@ -592,7 +592,7 @@ :: ++ lent :: length ~/ %lent - |= a/(list) + |= a=(list) ^- @ =+ b=0 |- @@ -601,7 +601,7 @@ :: ++ levy ~/ %levy :: all of - |* {a/(list) b/$-(* ?)} + |* [a=(list) b=$-(* ?)] |- ^- ? ?~ a & ?. (b i.a) | @@ -609,14 +609,14 @@ :: ++ lien :: some of ~/ %lien - |* {a/(list) b/$-(* ?)} + |* [a=(list) b=$-(* ?)] |- ^- ? ?~ a | ?: (b i.a) & $(a t.a) :: ++ limo :: listify - |* a/* + |* a=* ^+ =< $ |@ ++ $ ?~(a ~ ?:(*? [i=-.a t=$] $(a +.a))) -- @@ -624,7 +624,7 @@ :: ++ murn :: maybe transform ~/ %murn - |* {a/(list) b/$-(* (unit))} + |* [a=(list) b=$-(* (unit))] => .(a (homo a)) |- ^- (list _?>(?=(^ a) (need (b i.a)))) ?~ a ~ @@ -634,19 +634,27 @@ :: ++ oust :: remove ~/ %oust - |* {{a/@ b/@} c/(list)} + |* [[a=@ b=@] c=(list)] (weld (scag +<-< c) (slag (add +<-< +<->) c)) :: ++ reap :: replicate ~/ %reap - |* {a/@ b/*} + |* [a=@ b=*] |- ^- (list _b) ?~ a ~ [b $(a (dec a))] :: +++ rear :: last item of list + ~/ %rear + |* a=(list) + ^- _?>(?=(^ a) i.a) + ?> ?=(^ a) + ?: =(~ t.a) i.a ::NOTE avoiding tmi + $(a t.a) +:: ++ reel :: right fold ~/ %reel - |* {a/(list) b/_=>(~ |=({* *} +<+))} + |* [a=(list) b=_=>(~ |=([* *] +<+))] |- ^+ ,.+<+.b ?~ a +<+.b @@ -654,7 +662,7 @@ :: ++ roll :: left fold ~/ %roll - |* {a/(list) b/_=>(~ |=({* *} +<+))} + |* [a=(list) b=_=>(~ |=([* *] +<+))] |- ^+ ,.+<+.b ?~ a +<+.b @@ -662,14 +670,14 @@ :: ++ scag :: prefix ~/ %scag - |* {a/@ b/(list)} + |* [a=@ b=(list)] |- ^+ b ?: |(?=(~ b) =(0 a)) ~ [i.b $(b t.b, a (dec a))] :: ++ skid :: separate ~/ %skid - |* {a/(list) b/$-(* ?)} + |* [a=(list) b=$-(* ?)] |- ^+ [p=a q=a] ?~ a [~ ~] =+ c=$(a t.a) @@ -677,7 +685,7 @@ :: ++ skim :: only ~/ %skim - |* {a/(list) b/$-(* ?)} + |* [a=(list) b=$-(* ?)] |- ^+ a ?~ a ~ @@ -685,7 +693,7 @@ :: ++ skip :: except ~/ %skip - |* {a/(list) b/$-(* ?)} + |* [a=(list) b=$-(* ?)] |- ^+ a ?~ a ~ @@ -693,7 +701,7 @@ :: ++ slag :: suffix ~/ %slag - |* {a/@ b/(list)} + |* [a=@ b=(list)] |- ^+ b ?: =(0 a) b ?~ b ~ @@ -701,7 +709,7 @@ :: ++ snag :: index ~/ %snag - |* {a/@ b/(list)} + |* [a=@ b=(list)] |- ^+ ?>(?=(^ b) i.b) ?~ b ~_ leaf+"snag-fail" @@ -709,9 +717,17 @@ ?: =(0 a) i.b $(b t.b, a (dec a)) :: +++ snip :: drop tail off list + ~/ %snip + |* a=(list) + ^+ a + ?~ a ~ + ?: =(~ t.a) ~ + [i.a $(a t.a)] +:: ++ sort !. :: quicksort ~/ %sort - |* {a/(list) b/$-({* *} ?)} + |* [a=(list) b=$-([* *] ?)] => .(a ^.(homo a)) |- ^+ a ?~ a ~ @@ -747,7 +763,7 @@ p:(spin a +<+.b b) :: ++ swag :: slice - |* {{a/@ b/@} c/(list)} + |* [[a=@ b=@] c=(list)] (scag +<-> (slag +<-< c)) :: +turn: transform each value of list :a using the function :b :: @@ -762,7 +778,7 @@ :: ++ weld :: concatenate ~/ %weld - |* {a/(list) b/(list)} + |* [a=(list) b=(list)] => .(a ^.(homo a), b ^.(homo b)) |- ^+ b ?~ a b @@ -782,7 +798,7 @@ :: ++ welp :: faceless weld ~/ %welp - =| {* *} + =| [* *] |@ ++ $ ?~ +<- @@ -805,35 +821,35 @@ :: ++ bex :: binary exponent ~/ %bex - |= a/@ + |= a=@ ^- @ ?: =(0 a) 1 (mul 2 $(a (dec a))) :: ++ can :: assemble ~/ %can - |= {a/bloq b/(list {p/@u q/@})} + |= [a=bloq b=(list [p=@u q=@])] ^- @ ?~ b 0 (add (end a p.i.b q.i.b) (lsh a p.i.b $(b t.b))) :: ++ cat :: concatenate ~/ %cat - |= {a/bloq b/@ c/@} + |= [a=bloq b=@ c=@] (add (lsh a (met a b) c) b) :: ++ cut :: slice ~/ %cut - |= {a/bloq {b/@u c/@u} d/@} + |= [a=bloq [b=@u c=@u] d=@] (end a c (rsh a b d)) :: ++ end :: tail ~/ %end - |= {a/bloq b/@u c/@} + |= [a=bloq b=@u c=@] (mod c (bex (mul (bex a) b))) :: ++ fil :: fill bloqstream - |= {a/bloq b/@u c/@} + |= [a=bloq b=@u c=@] =+ n=0 =+ d=c |- ^- @ @@ -843,12 +859,12 @@ :: ++ lsh :: left-shift ~/ %lsh - |= {a/bloq b/@u c/@} + |= [a=bloq b=@u c=@] (mul (bex (mul (bex a) b)) c) :: ++ met :: measure ~/ %met - |= {a/bloq b/@} + |= [a=bloq b=@] ^- @ =+ c=0 |- @@ -857,7 +873,7 @@ :: ++ rap :: assemble nonzero ~/ %rap - |= {a/bloq b/(list @)} + |= [a=bloq b=(list @)] ^- @ =+ ~ ::REMOVEME jet dashboard bump ?~ b 0 @@ -865,7 +881,7 @@ :: ++ rep :: assemble single ~/ %rep - |= {a/bloq b/(list @)} + |= [a=bloq b=(list @)] ^- @ =+ c=0 |- @@ -898,40 +914,40 @@ :: ++ ripn ~/ %ripn - |= {bits=@ud x=@} + |= [bits=@ud x=@] ^- (list @) ?: =(0 x) ~ [(end 0 bits x) $(x (rsh 0 bits x))] :: ++ rip :: disassemble ~/ %rip - |= {=bloq x=@} + |= [=bloq x=@] ^- (list @) ?: =(0 x) ~ [(end bloq 1 x) $(x (rsh bloq 1 x))] :: ++ rsh :: right-shift ~/ %rsh - |= {a/bloq b/@u c/@} + |= [a=bloq b=@u c=@] (div c (bex (mul (bex a) b))) :: ++ swp :: naive rev bloq order ~/ %swp - |= {a/bloq b/@} + |= [a=bloq b=@] (rep a (flop (rip a b))) :: ++ xeb :: binary logarithm ~/ %xeb - |= a/@ + |= a=@ ^- @ (met 0 a) :: ++ fe :: modulo bloq - |_ a/bloq + |_ a=bloq ++ dif :: difference - |=({b/@ c/@} (sit (sub (add out (sit b)) (sit c)))) - ++ inv |=(b/@ (sub (dec out) (sit b))) :: inverse - ++ net |= b/@ ^- @ :: flip byte endianness + |=([b=@ c=@] (sit (sub (add out (sit b)) (sit c)))) + ++ inv |=(b=@ (sub (dec out) (sit b))) :: inverse + ++ net |= b=@ ^- @ :: flip byte endianness => .(b (sit b)) ?: (lte a 3) b @@ -940,18 +956,18 @@ (lsh c 1 $(a c, b (cut c [0 1] b))) $(a c, b (cut c [1 1] b)) ++ out (bex (bex a)) :: mod value - ++ rol |= {b/bloq c/@ d/@} ^- @ :: roll left + ++ rol |= [b=bloq c=@ d=@] ^- @ :: roll left =+ e=(sit d) =+ f=(bex (sub a b)) =+ g=(mod c f) (sit (con (lsh b g e) (rsh b (sub f g) e))) - ++ ror |= {b/bloq c/@ d/@} ^- @ :: roll right + ++ ror |= [b=bloq c=@ d=@] ^- @ :: roll right =+ e=(sit d) =+ f=(bex (sub a b)) =+ g=(mod c f) (sit (con (rsh b g e) (lsh b (sub f g) e))) - ++ sum |=({b/@ c/@} (sit (add b c))) :: wrapping add - ++ sit |=(b/@ (end a 1 b)) :: enforce modulo + ++ sum |=([b=@ c=@] (sit (add b c))) :: wrapping add + ++ sit |=(b=@ (end a 1 b)) :: enforce modulo -- :: :: :::: 2d: bit logic :: @@ -959,7 +975,7 @@ :: ++ con :: binary or ~/ %con - |= {a/@ b/@} + |= [a=@ b=@] =+ [c=0 d=0] |- ^- @ ?: ?&(=(0 a) =(0 b)) d @@ -976,8 +992,8 @@ :: ++ dis :: binary and ~/ %dis - |= {a/@ b/@} - =| {c/@ d/@} + |= [a=@ b=@] + =| [c=@ d=@] |- ^- @ ?: ?|(=(0 a) =(0 b)) d %= $ @@ -993,7 +1009,7 @@ :: ++ mix :: binary xor ~/ %mix - |= {a/@ b/@} + |= [a=@ b=@] ^- @ =+ [c=0 d=0] |- @@ -1005,7 +1021,7 @@ d (add d (lsh 0 c =((end 0 1 a) (end 0 1 b)))) == :: -++ not |= {a/bloq b/@ c/@} :: binary not (sized) +++ not |= [a=bloq b=@ c=@] :: binary not (sized) (mix c (dec (bex (mul b (bex a))))) :: :: :::: 2e: insecure hashing :: @@ -1014,8 +1030,8 @@ ++ muk :: standard murmur3 ~% %muk ..muk ~ =+ ~(. fe 5) - |= {syd/@ len/@ key/@} - ?> &((lte (met 5 syd) 1) (lte (met 0 len) 31)) + |= [syd=@ len=@ key=@] + =. syd (end 5 1 syd) =/ pad (sub len (met 3 key)) =/ data (weld (rip 3 key) (reap pad 0)) =/ nblocks (div len 4) :: intentionally off-by-one @@ -1038,20 +1054,20 @@ =/ tlen (dis len 3) =. h1 ?+ tlen h1 :: fallthrough switch - $3 =. k1 (mix k1 (lsh 0 16 (snag 2 tail))) + %3 =. k1 (mix k1 (lsh 0 16 (snag 2 tail))) =. k1 (mix k1 (lsh 0 8 (snag 1 tail))) =. k1 (mix k1 (snag 0 tail)) =. k1 (sit (mul k1 c1)) =. k1 (rol 0 15 k1) =. k1 (sit (mul k1 c2)) (mix h1 k1) - $2 =. k1 (mix k1 (lsh 0 8 (snag 1 tail))) + %2 =. k1 (mix k1 (lsh 0 8 (snag 1 tail))) =. k1 (mix k1 (snag 0 tail)) =. k1 (sit (mul k1 c1)) =. k1 (rol 0 15 k1) =. k1 (sit (mul k1 c2)) (mix h1 k1) - $1 =. k1 (mix k1 (snag 0 tail)) + %1 =. k1 (mix k1 (snag 0 tail)) =. k1 (sit (mul k1 c1)) =. k1 (rol 0 15 k1) =. k1 (sit (mul k1 c2)) @@ -1060,7 +1076,7 @@ =. h1 (mix h1 len) |^ (fmix32 h1) ++ fmix32 - |= h/@ + |= h=@ =. h (mix h (rsh 0 16 h)) =. h (sit (mul h 0x85eb.ca6b)) =. h (mix h (rsh 0 13 h)) @@ -1071,15 +1087,20 @@ :: ++ mug :: mug with murmur3 ~/ %mug - |= a/* - |^ (trim ?@(a a (mix $(a -.a) (mix 0x7fff.ffff $(a +.a))))) - ++ trim :: 31-bit nonzero - |= key/@ - =+ syd=0xcafe.babe - |- ^- @ - =+ haz=(muk syd (met 3 key) key) - =+ ham=(mix (rsh 0 31 haz) (end 0 31 haz)) - ?.(=(0 ham) ham $(syd +(syd))) + |= a=* + |^ ?@ a (mum 0xcafe.babe 0x7fff a) + =/ b (cat 5 $(a -.a) $(a +.a)) + (mum 0xdead.beef 0xfffe b) + :: + ++ mum + |= [syd=@uxF fal=@F key=@] + =/ wyd (met 3 key) + =| i=@ud + |- ^- @F + ?: =(8 i) fal + =/ haz=@F (muk syd wyd key) + =/ ham=@F (mix (rsh 0 31 haz) (end 0 31 haz)) + ?.(=(0 ham) ham $(i +(i), syd +(syd))) -- :: :: :::: 2f: noun ordering :: @@ -1092,7 +1113,7 @@ :: ++ aor ~/ %aor - |= {a/* b/*} + |= [a=* b=*] ^- ? ?: =(a b) & ?. ?=(@ a) @@ -1112,7 +1133,7 @@ :: ++ dor ~/ %dor - |= {a/* b/*} + |= [a=* b=*] ^- ? ?: =(a b) & ?. ?=(@ a) @@ -1128,7 +1149,7 @@ :: ++ gor ~/ %gor - |= {a/* b/*} + |= [a=* b=*] ^- ? =+ [c=(mug a) d=(mug b)] ?: =(c d) @@ -1140,7 +1161,7 @@ :: ++ mor ~/ %mor - |= {a/* b/*} + |= [a=* b=*] ^- ? =+ [c=(mug (mug a)) d=(mug (mug b))] ?: =(c d) @@ -1153,7 +1174,7 @@ :: ++ pow :: unsigned exponent ~/ %pow - |= {a/@ b/@} + |= [a=@ b=@] ?: =(b 0) 1 |- ?: =(b 1) a =+ c=$(b (div b 2)) @@ -1162,7 +1183,7 @@ :: ++ sqt :: unsigned sqrt/rem ~/ %sqt - |= a/@ ^- {p/@ q/@} + |= a=@ ^- [p=@ q=@] ?~ a [0 0] =+ [q=(div (dec (xeb a)) 2) r=0] =- [-.b (sub a +.b)] @@ -1182,11 +1203,11 @@ :: ++ in :: set engine ~/ %in - =| a/(tree) :: (set) + =| a=(tree) :: (set) |@ ++ all :: logical AND ~/ %all - |* b/$-(* ?) + |* b=$-(* ?) |- ^- ? ?~ a & @@ -1194,7 +1215,7 @@ :: ++ any :: logical OR ~/ %any - |* b/$-(* ?) + |* b=$-(* ?) |- ^- ? ?~ a | @@ -1203,7 +1224,7 @@ ++ apt :: check correctness =< $ ~/ %apt - =| {l/(unit) r/(unit)} + =| [l=(unit) r=(unit)] |. ^- ? ?~ a & ?& ?~(l & (gor n.a u.l)) @@ -1214,7 +1235,7 @@ :: ++ bif :: splits a by b ~/ %bif - |* b/* + |* b=* ^+ [l=a r=a] =< + |- ^+ a @@ -1232,7 +1253,7 @@ :: ++ del :: b without any a ~/ %del - |* b/* + |* b=* |- ^+ a ?~ a ~ @@ -1240,7 +1261,7 @@ ?: (gor b n.a) a(l $(a l.a)) a(r $(a r.a)) - |- ^- {$?(~ _a)} + |- ^- [$?(~ _a)] ?~ l.a r.a ?~ r.a l.a ?: (mor n.l.a n.r.a) @@ -1259,7 +1280,7 @@ ?> ?=(^ c) =+ d=$(a l.c, b l.b) =+ e=$(a r.c, b r.b) - |- ^- {$?(~ _a)} + |- ^- [$?(~ _a)] ?~ d e ?~ e d ?: (mor n.d n.e) @@ -1268,7 +1289,7 @@ -- :: ++ dig :: axis of a in b - |= b/* + |= b=* =+ c=1 |- ^- (unit @) ?~ a ~ @@ -1279,7 +1300,7 @@ :: ++ gas :: concatenate ~/ %gas - |= b/(list _?>(?=(^ a) n.a)) + |= b=(list _?>(?=(^ a) n.a)) |- ^+ a ?~ b a @@ -1334,7 +1355,7 @@ :: ++ put :: puts b in a, sorted ~/ %put - |* b/* + |* b=* |- ^+ a ?~ a [b ~ ~] @@ -1354,14 +1375,14 @@ :: ++ rep :: reduce to product ~/ %rep - |* b/_=>(~ |=({* *} +<+)) + |* b=_=>(~ |=([* *] +<+)) |- ?~ a +<+.b $(a r.a, +<+.b $(a l.a, +<+.b (b n.a +<+.b))) :: ++ run :: apply gate to values ~/ %run - |* b/gate + |* b=gate =+ c=`(set _?>(?=(^ a) (b n.a)))`~ |- ?~ a c =. c (~(put in c) (b n.a)) @@ -1411,12 +1432,12 @@ :: ++ by :: map engine ~/ %by - =| a/(tree (pair)) :: (map) + =| a=(tree (pair)) :: (map) =* node ?>(?=(^ a) n.a) |@ ++ all :: logical AND ~/ %all - |* b/$-(* ?) + |* b=$-(* ?) |- ^- ? ?~ a & @@ -1424,7 +1445,7 @@ :: ++ any :: logical OR ~/ %any - |* b/$-(* ?) + |* b=$-(* ?) |- ^- ? ?~ a | @@ -1432,7 +1453,7 @@ :: ++ bif :: splits a by b ~/ %bif - |* {b/* c/*} + |* [b=* c=*] ^+ [l=a r=a] =< + |- ^+ a @@ -1452,7 +1473,7 @@ :: ++ del :: delete at key b ~/ %del - |* b/* + |* b=* |- ^+ a ?~ a ~ @@ -1460,7 +1481,7 @@ ?: (gor b p.n.a) a(l $(a l.a)) a(r $(a r.a)) - |- ^- {$?(~ _a)} + |- ^- [$?(~ _a)] ?~ l.a r.a ?~ r.a l.a ?: (mor p.n.l.a p.n.r.a) @@ -1479,7 +1500,7 @@ ?> ?=(^ c) =+ d=$(a l.c, b l.b) =+ e=$(a r.c, b r.b) - |- ^- {$?(~ _a)} + |- ^- [$?(~ _a)] ?~ d e ?~ e d ?: (mor p.n.d p.n.e) @@ -1488,7 +1509,7 @@ -- :: ++ dig :: axis of b key - |= b/* + |= b=* =+ c=1 |- ^- (unit @) ?~ a ~ @@ -1500,7 +1521,7 @@ ++ apt :: check correctness =< $ ~/ %apt - =| {l/(unit) r/(unit)} + =| [l=(unit) r=(unit)] |. ^- ? ?~ a & ?& ?~(l & &((gor p.n.a u.l) !=(p.n.a u.l))) @@ -1513,7 +1534,7 @@ :: ++ gas :: concatenate ~/ %gas - |* b/(list {p/* q/*}) + |* b=(list [p=* q=*]) => .(b `(list _?>(?=(^ a) n.a))`b) |- ^+ a ?~ b @@ -1534,7 +1555,7 @@ $(a r.a) :: ++ got :: need value by key - |* b/* + |* b=* (need (get b)) :: ++ gut :: fall value by key @@ -1543,7 +1564,7 @@ :: ++ has :: key existence check ~/ %has - |* b/* + |* b=* !=(~ (get b)) :: ++ int :: intersection @@ -1585,14 +1606,14 @@ a(r $(a r.a)) :: ++ mar :: add with validation - |* {b/* c/(unit *)} + |* [b=* c=(unit *)] ?~ c (del b) (put b u.c) :: ++ put :: adds key-value pair ~/ %put - |* {b/* c/*} + |* [b=* c=*] |- ^+ a ?~ a [[b c] ~ ~] @@ -1614,13 +1635,13 @@ :: ++ rep :: reduce to product ~/ %rep - |* b/_=>(~ |=({* *} +<+)) + |* b=_=>(~ |=([* *] +<+)) |- ?~ a +<+.b $(a r.a, +<+.b $(a l.a, +<+.b (b n.a +<+.b))) :: ++ rib :: transform + product - |* {b/* c/gate} + |* [b=* c=gate] |- ^+ [b a] ?~ a [b ~] =+ d=(c n.a b) @@ -1631,13 +1652,13 @@ :: ++ run :: apply gate to values ~/ %run - |* b/gate + |* b=gate |- ?~ a a [n=[p=p.n.a q=(b q.n.a)] l=$(a l.a) r=$(a r.a)] :: ++ rut :: apply gate to nodes - |* b/gate + |* b=gate |- ?~ a a [n=[p=p.n.a q=(b p.n.a q.n.a)] l=$(a l.a) r=$(a r.a)] @@ -1676,7 +1697,7 @@ =+ b=a |@ ++ $ - |= meg/$-({_p:node _q:node _q:node} _q:node) + |= meg=$-([_p:node _q:node _q:node] _q:node) |- ^+ a ?~ b a @@ -1698,7 +1719,7 @@ :: ++ urn :: apply gate to nodes ~/ %urn - |* b/$-({* *} *) + |* b=$-([* *] *) |- ?~ a ~ a(n n.a(q (b p.n.a q.n.a)), l $(a l.a), r $(a r.a)) @@ -1728,23 +1749,23 @@ :: :: :: ++ ja :: jar engine - =| a/(tree (pair * (list))) :: (jar) + =| a=(tree (pair * (list))) :: (jar) |@ ++ get :: gets list by key - |* b/* + |* b=* =+ c=(~(get by a) b) ?~(c ~ u.c) :: ++ add :: adds key-list pair - |* {b/* c/*} + |* [b=* c=*] =+ d=(get b) (~(put by a) b [c d]) -- ++ ju :: jug engine - =| a/(tree (pair * (tree))) :: (jug) + =| a=(tree (pair * (tree))) :: (jug) |@ ++ del :: del key-set pair - |* {b/* c/*} + |* [b=* c=*] ^+ a =+ d=(get b) =+ e=(~(del in d) c) @@ -1753,25 +1774,25 @@ (~(put by a) b e) :: ++ gas :: concatenate - |* b/(list {p/* q/*}) - => .(b `(list _?>(?=({{* ^} ^} a) [p=p q=n.q]:n.a))`b) + |* b=(list [p=* q=*]) + => .(b `(list _?>(?=([[* ^] ^] a) [p=p q=n.q]:n.a))`b) |- ^+ a ?~ b a $(b t.b, a (put p.i.b q.i.b)) :: ++ get :: gets set by key - |* b/* + |* b=* =+ c=(~(get by a) b) ?~(c ~ u.c) :: ++ has :: existence check - |* {b/* c/*} + |* [b=* c=*] ^- ? (~(has in (get b)) c) :: ++ put :: add key-set pair - |* {b/* c/*} + |* [b=* c=*] ^+ a =+ d=(get b) (~(put by a) b (~(put in d) c)) @@ -1781,7 +1802,7 @@ :: :: :: ++ to :: queue engine - =| a/(tree) :: (qeu) + =| a=(tree) :: (qeu) |@ ++ apt :: check correctness |- ^- ? @@ -1805,7 +1826,7 @@ +((max $(a l.a) $(a r.a))) :: ++ gas :: insert list to que - |= b/(list _?>(?=(^ a) n.a)) + |= b=(list _?>(?=(^ a) n.a)) |- ^+ a ?~(b a $(b t.b, a (put i.b))) :: @@ -1837,7 +1858,7 @@ bal(n.a p.b, l.a q.b) :: ++ put :: insert new tail - |* b/* + |* b=* |- ^+ a ?~ a [b ~ ~] @@ -1882,15 +1903,15 @@ :: :: :: ++ malt :: map from list - |* a/(list) - (molt `(list {p/_-<.a q/_->.a})`a) + |* a=(list) + (molt `(list [p=_-<.a q=_->.a])`a) :: ++ molt :: map from pair list - |* a/(list (pair)) :: ^- =,(i.-.a (map _p _q)) - (~(gas by `(tree {p/_p.i.-.a q/_q.i.-.a})`~) a) + |* a=(list (pair)) :: ^- =,(i.-.a (map _p _q)) + (~(gas by `(tree [p=_p.i.-.a q=_q.i.-.a])`~) a) :: ++ silt :: set from list - |* a/(list) :: ^- (set _i.-.a) + |* a=(list) :: ^- (set _i.-.a) =+ b=*(tree _?>(?=(^ a) i.a)) (~(gas in b) a) :: :: @@ -1910,24 +1931,24 @@ |% :: :: ++ le :: construct list - |* a/(list) + |* a=(list) ^+ =< $ |@ ++ $ ?:(*? ~ [i=(snag 0 a) t=$]) -- a :: :: ++ my :: construct map - |* a/(list (pair)) + |* a=(list (pair)) => .(a ^+((le a) a)) (~(gas by `(map _p.i.-.a _q.i.-.a)`~) a) :: :: ++ si :: construct set - |* a/(list) + |* a=(list) => .(a ^+((le a) a)) (~(gas in `(set _i.-.a)`~) a) :: :: ++ snag :: index - |* {a/@ b/(list)} + |* [a=@ b=(list)] ?~ b ~_ leaf+"snag-fail" !! @@ -1935,7 +1956,7 @@ $(b t.b, a (dec a)) :: :: ++ weld :: concatenate - |* {a/(list) b/(list)} + |* [a=(list) b=(list)] => .(a ^+((le a) a), b ^+((le b) b)) =+ 42 |- @@ -1952,8 +1973,7 @@ +$ char @t :: UTF8 byte +$ cord @t :: UTF8, LSB first +$ byts [wid=@ud dat=@] :: bytes, MSB first -+$ deco ?($bl $br $un $~) :: text decoration -+$ date {{a/? y/@ud} m/@ud t/tarp} :: parsed date ++$ date [[a=? y=@ud] m=@ud t=tarp] :: parsed date +$ knot @ta :: ASCII text +$ noun * :: any noun +$ path (list knot) :: like unix path @@ -1962,98 +1982,43 @@ $: auth=@tas :: standards authority type=path :: standard label == :: -+$ stub (list (pair stye (list @c))) :: styled unicode -+$ stye (pair (set deco) (pair tint tint)) :: decos/bg/fg -+$ styl :: cascading style - %+ pair (unit deco) :: - (pair (unit tint) (unit tint)) :: -:: :: -+$ styx (list $@(@t (pair styl styx))) :: styled text -+$ tile :: XX: ?@(knot (pair styl knot)) - :: - cord -+$ tint ?($r $g $b $c $m $y $k $w $~) :: text color ++$ tang (list tank) :: bottom-first error :: -:: A `plum` is the intermediate representation for the pretty-printer. It -:: encodes hoon-shaped data with the least amount of structured needed -:: for formating. +:: $tank: formatted print tree :: -:: A `plum` is either a +:: just a cord, or +:: %leaf: just a tape +:: %palm: backstep list +:: flat-mid, open, flat-open, flat-close +:: %rose: flat list +:: flat-mid, open, close :: -:: - `cord`: A simple cord -:: - `[%para *]`: A wrappable paragraph. -:: - `[%tree *]`: A formatted plum tree -:: - `[%sbrk *]`: An indication of a nested subexpression. -:: -:: The formatter will use the tall mode unless: -:: -:: - A plum has only a `wide` style. -:: - The plum is in `%sbrk` form and its subplum (`kid`), when -:: formatted in wide mode, can fit on a single line. -:: -+$ plum ++$ tank + $~ leaf/~ $@ cord - $% [%para prefix=tile lines=(list @t)] - [%tree fmt=plumfmt kids=(list plum)] - [%sbrk kid=plum] + $% [%leaf p=tape] + [%palm p=(qual tape tape tape tape) q=(list tank)] + [%rose p=(trel tape tape tape) q=(list tank)] == :: -:: A `plumfmt` is a description of how to render a `plum`. A `plumfmt` -:: must include a `wide`, a `tall`, or both. -:: -:: A `wide` is a description of how to render a plum in a single -:: line. The nested (`kids`) sub-plums will be interleaved with `delimit` -:: strings, and, if `enclose` is set, then the output will be enclosed -:: with `p.u.enclose` abnd `q.u.enclose`. -:: -:: For example, to build a plumfmt for string literals, we could write: -:: -:: [wide=[~ '' [~ '"' '"']] tall=~] -:: -:: A `tall` is a description of how to render a plum across multiple -:: lines. The output will be prefixed by `intro`, suffixed by -:: `final.u.indef`, and each subplum prefixed by `sigil.u.indef`. -:: -:: For example, to build a plumfmt for cores, we could write: -:: -:: [wide=~ tall=`['' `['++' '--']]] -:: -+$ plumfmt - $: wide=(unit [delimit=tile enclose=(unit (pair tile tile))]) - tall=(unit [intro=tile indef=(unit [sigil=tile final=tile])]) - == -:: -++ tang (list tank) :: bottom-first error -++ tank $~ [%leaf ~] :: - $% {$leaf p/tape} :: printing formats - {$plum p/plum} :: - $: $palm :: backstep list - p/{p/tape q/tape r/tape s/tape} :: - q/(list tank) :: - == :: - $: $rose :: flat list - p/{p/tape q/tape r/tape} :: mid open close - q/(list tank) :: - == :: - == :: -++ tape (list @tD) :: utf8 string as list -++ tour (list @c) :: utf32 clusters -++ tarp {d/@ud h/@ud m/@ud s/@ud f/(list @ux)} :: parsed time -++ term @tas :: ascii symbol -++ wain (list cord) :: text lines -++ wall (list tape) :: text lines ++$ tape (list @tD) :: utf8 string as list ++$ tour (list @c) :: utf32 clusters ++$ tarp [d=@ud h=@ud m=@ud s=@ud f=(list @ux)] :: parsed time ++$ term @tas :: ascii symbol ++$ wain (list cord) :: text lines ++$ wall (list tape) :: text lines :: :::: 2p: serialization :: :: :: :: ++ cue :: unpack ~/ %cue - |= a/@ + |= a=@ ^- * =+ b=0 =+ m=`(map @ *)`~ =< q - |- ^- {p/@ q/* r/(map @ *)} + |- ^- [p=@ q=* r=(map @ *)] ?: =(0 (cut 0 [b 1] a)) =+ c=(rub +(b) a) [+(p.c) q.c (~(put by m) b q.c)] @@ -2068,12 +2033,12 @@ :: ++ jam :: pack ~/ %jam - |= a/* + |= a=* ^- @ =+ b=0 =+ m=`(map * @)`~ =< q - |- ^- {p/@ q/@ r/(map * @)} + |- ^- [p=@ q=@ r=(map * @)] =+ c=(~(get by m) a) ?~ c => .(m (~(put by m) a b)) @@ -2092,8 +2057,8 @@ :: ++ mat :: length-encode ~/ %mat - |= a/@ - ^- {p/@ q/@} + |= a=@ + ^- [p=@ q=@] ?: =(0 a) [1 1] =+ b=(met 0 a) @@ -2103,8 +2068,8 @@ :: ++ rub :: length-decode ~/ %rub - |= {a/@ b/@} - ^- {p/@ q/@} + |= [a=@ b=@] + ^- [p=@ q=@] =+ ^= c =+ [c=0 m=(met 0 b)] |- ?< (gth c m) @@ -2120,23 +2085,23 @@ ++ fn :: float, infinity, or NaN :: s=sign, e=exponent, a=arithmetic form :: (-1)^s * a * 2^e - $% {$f s/? e/@s a/@u} - {$i s/?} - {$n ~} + $% [%f s=? e=@s a=@u] + [%i s=?] + [%n ~] == :: ++ dn :: decimal float, infinity, or NaN :: (-1)^s * a * 10^e - $% {$d s/? e/@s a/@u} - {$i s/?} - {$n ~} + $% [%d s=? e=@s a=@u] + [%i s=?] + [%n ~] == :: ++ rn :: parsed decimal float :: - $% {$d a/? b/{c/@ {d/@ e/@} f/? i/@}} - {$i a/?} - {$n ~} + $% [%d a=? b=[c=@ [d=@ e=@] f=? i=@]] + [%i a=?] + [%n ~] == -- => :: :: @@ -2150,18 +2115,23 @@ :: 3f: scrambling :: :: 3g: molds and mold builders :: :: :: -~% %tri + ~ +~% %tri + + == + %year year + %yore yore + %ob ob + == |% :: :::: 3a: signed and modular ints :: :: :: :: ++ egcd :: schneier's egcd - |= {a/@ b/@} + |= [a=@ b=@] =+ si =+ [c=(sun a) d=(sun b)] =+ [u=[c=(sun 1) d=--0] v=[c=--0 d=(sun 1)]] - |- ^- {d/@ u/@s v/@s} + |- ^- [d=@ u=@s v=@s] ?: =(--0 c) [(abs d) d.u d.v] :: ?> ?& =(c (sum (pro (sun a) c.u) (pro (sun b) c.v))) @@ -2177,13 +2147,13 @@ :: ++ fo :: modulo prime ^| - |_ a/@ + |_ a=@ ++ dif - |= {b/@ c/@} + |= [b=@ c=@] (sit (sub (add a b) (sit c))) :: ++ exp - |= {b/@ c/@} + |= [b=@ c=@] ?: =(0 b) 1 =+ d=$(b (rsh 0 1 b)) @@ -2191,44 +2161,44 @@ ?:(=(0 (end 0 1 b)) e (pro c e)) :: ++ fra - |= {b/@ c/@} + |= [b=@ c=@] (pro b (inv c)) :: ++ inv - |= b/@ + |= b=@ =+ c=(dul:si u:(egcd b a) a) c :: ++ pro - |= {b/@ c/@} + |= [b=@ c=@] (sit (mul b c)) :: ++ sit - |= b/@ + |= b=@ (mod b a) :: ++ sum - |= {b/@ c/@} + |= [b=@ c=@] (sit (add b c)) -- :: ++ si :: signed integer ^? |% - ++ abs |=(a/@s (add (end 0 1 a) (rsh 0 1 a))) :: absolute value - ++ dif |= {a/@s b/@s} :: subtraction + ++ abs |=(a=@s (add (end 0 1 a) (rsh 0 1 a))) :: absolute value + ++ dif |= [a=@s b=@s] :: subtraction (sum a (new !(syn b) (abs b))) - ++ dul |= {a/@s b/@} :: modulus + ++ dul |= [a=@s b=@] :: modulus =+(c=(old a) ?:(-.c (mod +.c b) (sub b +.c))) - ++ fra |= {a/@s b/@s} :: divide + ++ fra |= [a=@s b=@s] :: divide (new =(0 (mix (syn a) (syn b))) (div (abs a) (abs b))) - ++ new |= {a/? b/@} :: [sign value] to @s + ++ new |= [a=? b=@] :: [sign value] to @s `@s`?:(a (mul 2 b) ?:(=(0 b) 0 +((mul 2 (dec b))))) - ++ old |=(a/@s [(syn a) (abs a)]) :: [sign value] - ++ pro |= {a/@s b/@s} :: multiplication + ++ old |=(a=@s [(syn a) (abs a)]) :: [sign value] + ++ pro |= [a=@s b=@s] :: multiplication (new =(0 (mix (syn a) (syn b))) (mul (abs a) (abs b))) - ++ rem |=({a/@s b/@s} (dif a (pro b (fra a b)))) :: remainder - ++ sum |= {a/@s b/@s} :: addition + ++ rem |=([a=@s b=@s] (dif a (pro b (fra a b)))) :: remainder + ++ sum |= [a=@s b=@s] :: addition =+ [c=(old a) d=(old b)] ?: -.c ?: -.d @@ -2241,9 +2211,9 @@ (new | (sub +.c +.d)) (new & (sub +.d +.c)) (new | (add +.c +.d)) - ++ sun |=(a/@u (mul 2 a)) :: @u to @s - ++ syn |=(a/@s =(0 (end 0 1 a))) :: sign test - ++ cmp |= {a/@s b/@s} :: compare + ++ sun |=(a=@u (mul 2 a)) :: @u to @s + ++ syn |=(a=@s =(0 (end 0 1 a))) :: sign test + ++ cmp |= [a=@s b=@s] :: compare ^- @s ?: =(a b) --0 @@ -2265,7 +2235,7 @@ :: :: ++ fl :: arb. precision fp - =/ {{p/@u v/@s w/@u} r/$?($n $u $d $z $a) d/$?($d $f $i)} + =/ [[p=@u v=@s w=@u] r=$?(%n %u %d %z %a) d=$?(%d %f %i)] [[113 -16.494 32.765] %n %d] :: p=precision: number of bits in arithmetic form; must be at least 2 :: v=min exponent: minimum value of e @@ -2275,22 +2245,22 @@ :: infinite exponent range => ~% %cofl +> ~ - :: internal functions; mostly operating on {e/@s a/@u}, in other words + :: internal functions; mostly operating on [e=@s a=@u], in other words :: positive numbers. many of these error out if a=0. |% ++ rou - |= {a/{e/@s a/@u}} ^- fn (rau a &) + |= [a=[e=@s a=@u]] ^- fn (rau a &) :: ++ rau - |= {a/{e/@s a/@u} t/?} ^- fn + |= [a=[e=@s a=@u] t=?] ^- fn ?- r - $z (lug %fl a t) $d (lug %fl a t) - $a (lug %ce a t) $u (lug %ce a t) - $n (lug %ne a t) + %z (lug %fl a t) %d (lug %fl a t) + %a (lug %ce a t) %u (lug %ce a t) + %n (lug %ne a t) == :: ++ add :: add; exact if e - |= {a/{e/@s a/@u} b/{e/@s a/@u} e/?} ^- fn + |= [a=[e=@s a=@u] b=[e=@s a=@u] e=?] ^- fn =+ q=(dif:si e.a e.b) |- ?. (syn:si q) $(b a, a b, q +(q)) :: a has larger exp ?: e @@ -2301,14 +2271,14 @@ =+ ^= x %+ sum:si e.b (sun:si mb) :: highest exp for b ?: =((cmp:si w x) --1) :: don't need to add ?- r - $z (lug %fl a &) $d (lug %fl a &) - $a (lug %lg a &) $u (lug %lg a &) - $n (lug %na a &) + %z (lug %fl a &) %d (lug %fl a &) + %a (lug %lg a &) %u (lug %lg a &) + %n (lug %na a &) == (rou [e.b (^add (lsh 0 (abs:si q) a.a) a.b)]) :: ++ sub :: subtract; exact if e - |= {a/{e/@s a/@u} b/{e/@s a/@u} e/?} ^- fn + |= [a=[e=@s a=@u] b=[e=@s a=@u] e=?] ^- fn =+ q=(dif:si e.a e.b) |- ?. (syn:si q) (fli $(b a, a b, q +(q), r swr)) @@ -2318,9 +2288,9 @@ =+ ^= x %+ sum:si e.b (sun:si +(mb)) ?: &(!e =((cmp:si w x) --1)) ?- r - $z (lug %sm a &) $d (lug %sm a &) - $a (lug %ce a &) $u (lug %ce a &) - $n (lug %nt a &) + %z (lug %sm a &) %d (lug %sm a &) + %a (lug %ce a &) %u (lug %ce a &) + %n (lug %nt a &) == =+ j=(lsh 0 (abs:si q) a.a) |- ?. (gte j a.b) @@ -2330,11 +2300,11 @@ ?: e [%f & e.b i] (rou [e.b i]) :: ++ mul :: multiply - |= {a/{e/@s a/@u} b/{e/@s a/@u}} ^- fn + |= [a=[e=@s a=@u] b=[e=@s a=@u]] ^- fn (rou (sum:si e.a e.b) (^mul a.a a.b)) :: ++ div :: divide - |= {a/{e/@s a/@u} b/{e/@s a/@u}} ^- fn + |= [a=[e=@s a=@u] b=[e=@s a=@u]] ^- fn =+ [ma=(met 0 a.a) mb=(met 0 a.b)] =+ v=(dif:si (sun:si ma) (sun:si +((^add mb prc)))) =. a ?: (syn:si v) a @@ -2343,7 +2313,7 @@ (rau [j p.q] =(q.q 0)) :: ++ sqt :: square root - |= {a/{e/@s a/@u}} ^- fn + |= [a=[e=@s a=@u]] ^- fn =. a =+ [w=(met 0 a.a) x=(^mul +(prc) 2)] =+ ?:((^lth w x) (^sub x w) 0) @@ -2354,7 +2324,7 @@ (rau [z p.y] =(q.y 0)) :: ++ lth :: less-than - |= {a/{e/@s a/@u} b/{e/@s a/@u}} ^- ? + |= [a=[e=@s a=@u] b=[e=@s a=@u]] ^- ? ?: =(e.a e.b) (^lth a.a a.b) =+ c=(cmp:si (ibl a) (ibl b)) ?: =(c -1) & ?: =(c --1) | @@ -2363,7 +2333,7 @@ (^lth (lsh 0 (abs:si (dif:si e.a e.b)) a.a) a.b) :: ++ equ :: equals - |= {a/{e/@s a/@u} b/{e/@s a/@u}} ^- ? + |= [a=[e=@s a=@u] b=[e=@s a=@u]] ^- ? ?. =((ibl a) (ibl b)) | ?: =((cmp:si e.a e.b) -1) =((lsh 0 (abs:si (dif:si e.a e.b)) a.b) a.a) @@ -2371,19 +2341,19 @@ :: :: integer binary logarithm: 2^ibl(a) <= |a| < 2^(ibl(a)+1) ++ ibl - |= {a/{e/@s a/@u}} ^- @s + |= [a=[e=@s a=@u]] ^- @s (sum:si (sun:si (dec (met 0 a.a))) e.a) :: :: change to a representation where a.a is odd :: every fn has a unique representation of this kind ++ uni - |= {a/{e/@s a/@u}} + |= [a=[e=@s a=@u]] |- ?: =((end 0 1 a.a) 1) a $(a.a (rsh 0 1 a.a), e.a (sum:si e.a --1)) :: :: expands to either full precision or to denormalized ++ xpd - |= {a/{e/@s a/@u}} + |= [a=[e=@s a=@u]] =+ ma=(met 0 a.a) ?: (gte ma prc) a =+ ?: =(den %i) (^sub prc ma) @@ -2400,11 +2370,11 @@ :: ++ lug ~/ %lug - |= {t/$?($fl $ce $sm $lg $ne $na $nt) a/{e/@s a/@u} s/?} ^- fn + |= [t=$?(%fl %ce %sm %lg %ne %na %nt) a=[e=@s a=@u] s=?] ^- fn ?< =(a.a 0) =- ?. =(den %f) - :: flush denormals - ?. ?=({$f *} -) - + ?. ?=([%f *] -) - ?: =((met 0 ->+>) prc) - [%f & zer] :: =+ m=(met 0 a.a) @@ -2419,38 +2389,38 @@ ?~ a.a ?< =(den %i) ?- t - $fl [%f & zer] - $sm [%f & zer] - $ce [%f & spd] - $lg [%f & spd] - $ne ?: s [%f & ?:((lte b (bex (dec q))) zer spd)] + %fl [%f & zer] + %sm [%f & zer] + %ce [%f & spd] + %lg [%f & spd] + %ne ?: s [%f & ?:((lte b (bex (dec q))) zer spd)] [%f & ?:((^lth b (bex (dec q))) zer spd)] - $nt ?: s [%f & ?:((lte b (bex (dec q))) zer spd)] + %nt ?: s [%f & ?:((lte b (bex (dec q))) zer spd)] [%f & ?:((^lth b (bex (dec q))) zer spd)] - $na [%f & ?:((^lth b (bex (dec q))) zer spd)] + %na [%f & ?:((^lth b (bex (dec q))) zer spd)] == :: =. a (xpd a) :: =. a ?- t - $fl a - $lg a(a +(a.a)) - $sm ?. &(=(b 0) s) a + %fl a + %lg a(a +(a.a)) + %sm ?. &(=(b 0) s) a ?: &(=(e.a emn) !=(den %i)) a(a (dec a.a)) =+ y=(dec (^mul a.a 2)) ?. (lte (met 0 y) prc) a(a (dec a.a)) [(dif:si e.a --1) y] - $ce ?: &(=(b 0) s) a a(a +(a.a)) - $ne ?~ b a + %ce ?: &(=(b 0) s) a a(a +(a.a)) + %ne ?~ b a =+ y=(bex (dec q)) ?: &(=(b y) s) :: round halfs to even ?~ (dis a.a 1) a a(a +(a.a)) ?: (^lth b y) a a(a +(a.a)) - $na ?~ b a + %na ?~ b a =+ y=(bex (dec q)) ?: (^lth b y) a a(a +(a.a)) - $nt ?~ b a + %nt ?~ b a =+ y=(bex (dec q)) ?: =(b y) ?: s a a(a +(a.a)) ?: (^lth b y) a a(a +(a.a)) @@ -2465,7 +2435,7 @@ :: ++ drg :: dragon4; get ~/ %drg :: printable decimal; - |= {a/{e/@s a/@u}} ^- {@s @u} :: guaranteed accurate + |= [a=[e=@s a=@u]] ^- [@s @u] :: guaranteed accurate ?< =(a.a 0) :: for rounded floats =. a (xpd a) =+ r=(lsh 0 ?:((syn:si e.a) (abs:si e.a) 0) a.a) @@ -2514,7 +2484,7 @@ [k o] :: ++ toj :: round to integer - |= {a/{e/@s a/@u}} ^- fn + |= [a=[e=@s a=@u]] ^- fn ?. =((cmp:si e.a --0) -1) [%f & a] =+ x=(abs:si e.a) =+ y=(rsh 0 x a.a) @@ -2525,22 +2495,22 @@ ?: &(=(z i) =((dis y 1) 0)) [%f & --0 y] ?: (^lth z i) [%f & --0 y] [%f & --0 +(y)] :: - ++ ned :: require ?=({$f *} a) - |= {a/fn} ^- {$f s/? e/@s a/@u} - ?: ?=({$f *} a) a + ++ ned :: require ?=([%f *] a) + |= [a=fn] ^- [%f s=? e=@s a=@u] + ?: ?=([%f *] a) a ~_ leaf+"need-float" !! :: ++ shf :: a * 2^b; no rounding - |= {a/fn b/@s} - ?: |(?=({$n *} a) ?=({$i *} a)) a + |= [a=fn b=@s] + ?: |(?=([%n *] a) ?=([%i *] a)) a a(e (sum:si e.a b)) :: ++ fli :: flip sign - |= {a/fn} ^- fn - ?-(-.a $f a(s !s.a), $i a(s !s.a), $n a) + |= [a=fn] ^- fn + ?-(-.a %f a(s !s.a), %i a(s !s.a), %n a) :: - ++ swr ?+(r r $d %u, $u %d) :: flipped rounding + ++ swr ?+(r r %d %u, %u %d) :: flipped rounding ++ prc ?>((gth p 1) p) :: force >= 2 precision ++ den d :: denorm+flush+inf exp ++ emn v :: minimum exponent @@ -2553,33 +2523,33 @@ -- |% ++ rou :: round - |= {a/fn} ^- fn - ?. ?=({$f *} a) a + |= [a=fn] ^- fn + ?. ?=([%f *] a) a ?~ a.a [%f s.a zer] ?: s.a (^rou +>.a) =.(r swr (fli (^rou +>.a))) :: ++ syn :: get sign - |= {a/fn} ^- ? - ?-(-.a $f s.a, $i s.a, $n &) + |= [a=fn] ^- ? + ?-(-.a %f s.a, %i s.a, %n &) :: ++ abs :: absolute value - |= {a/fn} ^- fn - ?: ?=({$f *} a) [%f & e.a a.a] - ?: ?=({$i *} a) [%i &] [%n ~] + |= [a=fn] ^- fn + ?: ?=([%f *] a) [%f & e.a a.a] + ?: ?=([%i *] a) [%i &] [%n ~] :: ++ add :: add - |= {a/fn b/fn} ^- fn - ?: |(?=({$n *} a) ?=({$n *} b)) [%n ~] - ?: |(?=({$i *} a) ?=({$i *} b)) - ?: &(?=({$i *} a) ?=({$i *} b)) + |= [a=fn b=fn] ^- fn + ?: |(?=([%n *] a) ?=([%n *] b)) [%n ~] + ?: |(?=([%i *] a) ?=([%i *] b)) + ?: &(?=([%i *] a) ?=([%i *] b)) ?: =(a b) a [%n ~] - ?: ?=({$i *} a) a b + ?: ?=([%i *] a) a b ?: |(=(a.a 0) =(a.b 0)) ?. &(=(a.a 0) =(a.b 0)) %- rou ?~(a.a b a) [%f ?:(=(r %d) &(s.a s.b) |(s.a s.b)) zer] - %- |= {a/fn} - ?. ?=({$f *} a) a + %- |= [a=fn] + ?. ?=([%f *] a) a ?. =(a.a 0) a [%f !=(r %d) zer] ?: =(s.a s.b) @@ -2589,17 +2559,17 @@ (^sub +>.b +>.a |) :: ++ ead :: exact add - |= {a/fn b/fn} ^- fn - ?: |(?=({$n *} a) ?=({$n *} b)) [%n ~] - ?: |(?=({$i *} a) ?=({$i *} b)) - ?: &(?=({$i *} a) ?=({$i *} b)) + |= [a=fn b=fn] ^- fn + ?: |(?=([%n *] a) ?=([%n *] b)) [%n ~] + ?: |(?=([%i *] a) ?=([%i *] b)) + ?: &(?=([%i *] a) ?=([%i *] b)) ?: =(a b) a [%n ~] - ?: ?=({$i *} a) a b + ?: ?=([%i *] a) a b ?: |(=(a.a 0) =(a.b 0)) ?. &(=(a.a 0) =(a.b 0)) ?~(a.a b a) [%f ?:(=(r %d) &(s.a s.b) |(s.a s.b)) zer] - %- |= {a/fn} - ?. ?=({$f *} a) a + %- |= [a=fn] + ?. ?=([%f *] a) a ?. =(a.a 0) a [%f !=(r %d) zer] ?: =(s.a s.b) @@ -2609,74 +2579,74 @@ (^sub +>.b +>.a &) :: ++ sub :: subtract - |= {a/fn b/fn} ^- fn (add a (fli b)) + |= [a=fn b=fn] ^- fn (add a (fli b)) :: ++ mul :: multiply - |= {a/fn b/fn} ^- fn - ?: |(?=({$n *} a) ?=({$n *} b)) [%n ~] - ?: ?=({$i *} a) - ?: ?=({$i *} b) + |= [a=fn b=fn] ^- fn + ?: |(?=([%n *] a) ?=([%n *] b)) [%n ~] + ?: ?=([%i *] a) + ?: ?=([%i *] b) [%i =(s.a s.b)] ?: =(a.b 0) [%n ~] [%i =(s.a s.b)] - ?: ?=({$i *} b) + ?: ?=([%i *] b) ?: =(a.a 0) [%n ~] [%i =(s.a s.b)] ?: |(=(a.a 0) =(a.b 0)) [%f =(s.a s.b) zer] ?: =(s.a s.b) (^mul +>.a +>.b) =.(r swr (fli (^mul +>.a +>.b))) :: ++ emu :: exact multiply - |= {a/fn b/fn} ^- fn - ?: |(?=({$n *} a) ?=({$n *} b)) [%n ~] - ?: ?=({$i *} a) - ?: ?=({$i *} b) + |= [a=fn b=fn] ^- fn + ?: |(?=([%n *] a) ?=([%n *] b)) [%n ~] + ?: ?=([%i *] a) + ?: ?=([%i *] b) [%i =(s.a s.b)] ?: =(a.b 0) [%n ~] [%i =(s.a s.b)] - ?: ?=({$i *} b) + ?: ?=([%i *] b) ?: =(a.a 0) [%n ~] [%i =(s.a s.b)] ?: |(=(a.a 0) =(a.b 0)) [%f =(s.a s.b) zer] [%f =(s.a s.b) (sum:si e.a e.b) (^^mul a.a a.b)] :: ++ div :: divide - |= {a/fn b/fn} ^- fn - ?: |(?=({$n *} a) ?=({$n *} b)) [%n ~] - ?: ?=({$i *} a) - ?: ?=({$i *} b) [%n ~] [%i =(s.a s.b)] - ?: ?=({$i *} b) [%f =(s.a s.b) zer] + |= [a=fn b=fn] ^- fn + ?: |(?=([%n *] a) ?=([%n *] b)) [%n ~] + ?: ?=([%i *] a) + ?: ?=([%i *] b) [%n ~] [%i =(s.a s.b)] + ?: ?=([%i *] b) [%f =(s.a s.b) zer] ?: =(a.a 0) ?: =(a.b 0) [%n ~] [%f =(s.a s.b) zer] ?: =(a.b 0) [%i =(s.a s.b)] ?: =(s.a s.b) (^div +>.a +>.b) =.(r swr (fli (^div +>.a +>.b))) :: ++ fma :: fused multiply-add - |= {a/fn b/fn c/fn} ^- fn :: (a * b) + c + |= [a=fn b=fn c=fn] ^- fn :: (a * b) + c (add (emu a b) c) :: ++ sqt :: square root - |= {a/fn} ^- fn - ?: ?=({$n *} a) [%n ~] - ?: ?=({$i *} a) ?:(s.a a [%n ~]) + |= [a=fn] ^- fn + ?: ?=([%n *] a) [%n ~] + ?: ?=([%i *] a) ?:(s.a a [%n ~]) ?~ a.a [%f s.a zer] ?: s.a (^sqt +>.a) [%n ~] :: ++ inv :: inverse - |= {a/fn} ^- fn + |= [a=fn] ^- fn (div [%f & --0 1] a) :: ++ sun :: uns integer to float - |= {a/@u} ^- fn + |= [a=@u] ^- fn (rou [%f & --0 a]) :: ++ san :: sgn integer to float - |= {a/@s} ^- fn + |= [a=@s] ^- fn =+ b=(old:si a) (rou [%f -.b --0 +.b]) :: :: comparisons return ~ in the event of a NaN ++ lth :: less-than - |= {a/fn b/fn} ^- (unit ?) - ?: |(?=({$n *} a) ?=({$n *} b)) ~ :- ~ + |= [a=fn b=fn] ^- (unit ?) + ?: |(?=([%n *] a) ?=([%n *] b)) ~ :- ~ ?: =(a b) | - ?: ?=({$i *} a) !s.a ?: ?=({$i *} b) s.b + ?: ?=([%i *] a) !s.a ?: ?=([%i *] b) s.b ?: |(=(a.a 0) =(a.b 0)) ?: &(=(a.a 0) =(a.b 0)) | ?: =(a.a 0) s.b !s.a @@ -2684,36 +2654,36 @@ ?: s.a (^lth +>.a +>.b) (^lth +>.b +>.a) :: ++ lte :: less-equal - |= {a/fn b/fn} ^- (unit ?) - %+ bind (lth b a) |= a/? !a + |= [a=fn b=fn] ^- (unit ?) + %+ bind (lth b a) |= a=? !a :: ++ equ :: equal - |= {a/fn b/fn} ^- (unit ?) - ?: |(?=({$n *} a) ?=({$n *} b)) ~ :- ~ + |= [a=fn b=fn] ^- (unit ?) + ?: |(?=([%n *] a) ?=([%n *] b)) ~ :- ~ ?: =(a b) & - ?: |(?=({$i *} a) ?=({$i *} b)) | + ?: |(?=([%i *] a) ?=([%i *] b)) | ?: |(=(a.a 0) =(a.b 0)) ?: &(=(a.a 0) =(a.b 0)) & | ?: |(=(e.a e.b) !=(s.a s.b)) | (^equ +>.a +>.b) :: ++ gte :: greater-equal - |= {a/fn b/fn} ^- (unit ?) (lte b a) + |= [a=fn b=fn] ^- (unit ?) (lte b a) :: ++ gth :: greater-than - |= {a/fn b/fn} ^- (unit ?) (lth b a) + |= [a=fn b=fn] ^- (unit ?) (lth b a) :: ++ drg :: float to decimal - |= {a/fn} ^- dn - ?: ?=({$n *} a) [%n ~] - ?: ?=({$i *} a) [%i s.a] + |= [a=fn] ^- dn + ?: ?=([%n *] a) [%n ~] + ?: ?=([%i *] a) [%i s.a] ?~ a.a [%d s.a --0 0] [%d s.a (^drg +>.a)] :: ++ grd :: decimal to float - |= {a/dn} ^- fn - ?: ?=({$n *} a) [%n ~] - ?: ?=({$i *} a) [%i s.a] + |= [a=dn] ^- fn + ?: ?=([%n *] a) [%n ~] + ?: ?=([%i *] a) [%i s.a] => .(r %n) =+ q=(abs:si e.a) ?: (syn:si e.a) @@ -2721,22 +2691,22 @@ (div [%f s.a --0 a.a] [%f & (sun:si q) (pow 5 q)]) :: ++ toi :: round to integer @s - |= {a/fn} ^- (unit @s) + |= [a=fn] ^- (unit @s) =+ b=(toj a) - ?. ?=({$f *} b) ~ :- ~ + ?. ?=([%f *] b) ~ :- ~ =+ c=(^^mul (bex (abs:si e.b)) a.b) (new:si s.b c) :: ++ toj :: round to integer fn - |= {a/fn} ^- fn - ?. ?=({$f *} a) a + |= [a=fn] ^- fn + ?. ?=([%f *] a) a ?~ a.a [%f s.a zer] ?: s.a (^toj +>.a) =.(r swr (fli (^toj +>.a))) -- :: ++ ff :: ieee 754 format fp - |_ {{w/@u p/@u b/@s} r/$?($n $u $d $z $a)} + |_ [[w=@u p=@u b=@s] r=$?(%n %u %d %z %a)] :: this core has no use outside of the functionality :: provided to ++rd, ++rs, ++rq, and ++rh :: @@ -2752,7 +2722,7 @@ %*(. fl p +(p), v me, w (^sub (bex w) 3), d %d, r r) :: ++ sea :: @r to fn - |= {a/@r} ^- fn + |= [a=@r] ^- fn =+ [f=(cut 0 [0 p] a) e=(cut 0 [p w] a)] =+ s=(sig a) ?: =(e 0) @@ -2763,14 +2733,14 @@ =+ r=(^add f (bex p)) [%f s q r] :: - ++ bit |= {a/fn} (bif (rou:pa a)) :: fn to @r w+ rounding + ++ bit |= [a=fn] (bif (rou:pa a)) :: fn to @r w+ rounding :: ++ bif :: fn to @r no rounding - |= {a/fn} ^- @r - ?: ?=({$i *} a) + |= [a=fn] ^- @r + ?: ?=([%i *] a) =+ q=(lsh 0 p (fil 0 w 1)) ?: s.a q (^add q sb) - ?: ?=({$n *} a) (lsh 0 (dec p) (fil 0 +(w) 1)) + ?: ?=([%n *] a) (lsh 0 (dec p) (fil 0 +(w) 1)) ?~ a.a ?: s.a `@r`0 sb =+ ma=(met 0 a.a) ?. =(ma +(p)) @@ -2782,394 +2752,394 @@ ?: s.a r (^add r sb) :: ++ sig :: get sign - |= {a/@r} ^- ? + |= [a=@r] ^- ? =(0 (cut 0 [(^add p w) 1] a)) :: ++ exp :: get exponent - |= {a/@r} ^- @s + |= [a=@r] ^- @s (dif:si (sun:si (cut 0 [p w] a)) b) :: ++ add :: add - |= {a/@r b/@r} + |= [a=@r b=@r] (bif (add:pa (sea a) (sea b))) :: ++ sub :: subtract - |= {a/@r b/@r} + |= [a=@r b=@r] (bif (sub:pa (sea a) (sea b))) :: ++ mul :: multiply - |= {a/@r b/@r} + |= [a=@r b=@r] (bif (mul:pa (sea a) (sea b))) :: ++ div :: divide - |= {a/@r b/@r} + |= [a=@r b=@r] (bif (div:pa (sea a) (sea b))) :: ++ fma :: fused multiply-add - |= {a/@r b/@r c/@r} + |= [a=@r b=@r c=@r] (bif (fma:pa (sea a) (sea b) (sea c))) :: ++ sqt :: square root - |= {a/@r} + |= [a=@r] (bif (sqt:pa (sea a))) :: ++ lth :: less-than - |= {a/@r b/@r} (fall (lth:pa (sea a) (sea b)) |) + |= [a=@r b=@r] (fall (lth:pa (sea a) (sea b)) |) ++ lte :: less-equals - |= {a/@r b/@r} (fall (lte:pa (sea a) (sea b)) |) + |= [a=@r b=@r] (fall (lte:pa (sea a) (sea b)) |) ++ equ :: equals - |= {a/@r b/@r} (fall (equ:pa (sea a) (sea b)) |) + |= [a=@r b=@r] (fall (equ:pa (sea a) (sea b)) |) ++ gte :: greater-equals - |= {a/@r b/@r} (fall (gte:pa (sea a) (sea b)) |) + |= [a=@r b=@r] (fall (gte:pa (sea a) (sea b)) |) ++ gth :: greater-than - |= {a/@r b/@r} (fall (gth:pa (sea a) (sea b)) |) + |= [a=@r b=@r] (fall (gth:pa (sea a) (sea b)) |) ++ sun :: uns integer to @r - |= {a/@u} (bit [%f & --0 a]) + |= [a=@u] (bit [%f & --0 a]) ++ san :: signed integer to @r - |= {a/@s} (bit [%f (syn:si a) --0 (abs:si a)]) + |= [a=@s] (bit [%f (syn:si a) --0 (abs:si a)]) ++ toi :: round to integer - |= {a/@r} (toi:pa (sea a)) + |= [a=@r] (toi:pa (sea a)) ++ drg :: @r to decimal float - |= {a/@r} (drg:pa (sea a)) + |= [a=@r] (drg:pa (sea a)) ++ grd :: decimal float to @r - |= {a/dn} (bif (grd:pa a)) + |= [a=dn] (bif (grd:pa a)) -- :: -++ rlyd |= a/@rd ^- dn (drg:rd a) :: prep @rd for print -++ rlys |= a/@rs ^- dn (drg:rs a) :: prep @rs for print -++ rlyh |= a/@rh ^- dn (drg:rh a) :: prep @rh for print -++ rlyq |= a/@rq ^- dn (drg:rq a) :: prep @rq for print -++ ryld |= a/dn ^- @rd (grd:rd a) :: finish parsing @rd -++ ryls |= a/dn ^- @rs (grd:rs a) :: finish parsing @rs -++ rylh |= a/dn ^- @rh (grd:rh a) :: finish parsing @rh -++ rylq |= a/dn ^- @rq (grd:rq a) :: finish parsing @rq +++ rlyd |= a=@rd ^- dn (drg:rd a) :: prep @rd for print +++ rlys |= a=@rs ^- dn (drg:rs a) :: prep @rs for print +++ rlyh |= a=@rh ^- dn (drg:rh a) :: prep @rh for print +++ rlyq |= a=@rq ^- dn (drg:rq a) :: prep @rq for print +++ ryld |= a=dn ^- @rd (grd:rd a) :: finish parsing @rd +++ ryls |= a=dn ^- @rs (grd:rs a) :: finish parsing @rs +++ rylh |= a=dn ^- @rh (grd:rh a) :: finish parsing @rh +++ rylq |= a=dn ^- @rq (grd:rq a) :: finish parsing @rq :: ++ rd :: double precision fp ^| ~% %rd +> ~ - |_ r/$?($n $u $d $z) + |_ r=$?(%n %u %d %z) :: round to nearest, round up, round down, round to zero :: ++ ma %*(. ff w 11, p 52, b --1.023, r r) :: ++ sea :: @rd to fn - |= {a/@rd} (sea:ma a) + |= [a=@rd] (sea:ma a) :: ++ bit :: fn to @rd - |= {a/fn} ^- @rd (bit:ma a) + |= [a=fn] ^- @rd (bit:ma a) :: ++ add ~/ %add :: add - |= {a/@rd b/@rd} ^- @rd + |= [a=@rd b=@rd] ^- @rd ~_ leaf+"rd-fail" (add:ma a b) :: ++ sub ~/ %sub :: subtract - |= {a/@rd b/@rd} ^- @rd + |= [a=@rd b=@rd] ^- @rd ~_ leaf+"rd-fail" (sub:ma a b) :: ++ mul ~/ %mul :: multiply - |= {a/@rd b/@rd} ^- @rd + |= [a=@rd b=@rd] ^- @rd ~_ leaf+"rd-fail" (mul:ma a b) :: ++ div ~/ %div :: divide - |= {a/@rd b/@rd} ^- @rd + |= [a=@rd b=@rd] ^- @rd ~_ leaf+"rd-fail" (div:ma a b) :: ++ fma ~/ %fma :: fused multiply-add - |= {a/@rd b/@rd c/@rd} ^- @rd + |= [a=@rd b=@rd c=@rd] ^- @rd ~_ leaf+"rd-fail" (fma:ma a b c) :: ++ sqt ~/ %sqt :: square root - |= {a/@rd} ^- @rd ~_ leaf+"rd-fail" + |= [a=@rd] ^- @rd ~_ leaf+"rd-fail" (sqt:ma a) :: ++ lth ~/ %lth :: less-than - |= {a/@rd b/@rd} + |= [a=@rd b=@rd] ~_ leaf+"rd-fail" (lth:ma a b) :: ++ lte ~/ %lte :: less-equals - |= {a/@rd b/@rd} + |= [a=@rd b=@rd] ~_ leaf+"rd-fail" (lte:ma a b) :: ++ equ ~/ %equ :: equals - |= {a/@rd b/@rd} + |= [a=@rd b=@rd] ~_ leaf+"rd-fail" (equ:ma a b) :: ++ gte ~/ %gte :: greater-equals - |= {a/@rd b/@rd} + |= [a=@rd b=@rd] ~_ leaf+"rd-fail" (gte:ma a b) :: ++ gth ~/ %gth :: greater-than - |= {a/@rd b/@rd} + |= [a=@rd b=@rd] ~_ leaf+"rd-fail" (gth:ma a b) :: - ++ sun |= {a/@u} ^- @rd (sun:ma a) :: uns integer to @rd - ++ san |= {a/@s} ^- @rd (san:ma a) :: sgn integer to @rd - ++ sig |= {a/@rd} ^- ? (sig:ma a) :: get sign - ++ exp |= {a/@rd} ^- @s (exp:ma a) :: get exponent - ++ toi |= {a/@rd} ^- (unit @s) (toi:ma a) :: round to integer - ++ drg |= {a/@rd} ^- dn (drg:ma a) :: @rd to decimal float - ++ grd |= {a/dn} ^- @rd (grd:ma a) :: decimal float to @rd + ++ sun |= [a=@u] ^- @rd (sun:ma a) :: uns integer to @rd + ++ san |= [a=@s] ^- @rd (san:ma a) :: sgn integer to @rd + ++ sig |= [a=@rd] ^- ? (sig:ma a) :: get sign + ++ exp |= [a=@rd] ^- @s (exp:ma a) :: get exponent + ++ toi |= [a=@rd] ^- (unit @s) (toi:ma a) :: round to integer + ++ drg |= [a=@rd] ^- dn (drg:ma a) :: @rd to decimal float + ++ grd |= [a=dn] ^- @rd (grd:ma a) :: decimal float to @rd -- :: ++ rs :: single precision fp ~% %rs +> ~ ^| - |_ r/$?($n $u $d $z) + |_ r=$?(%n %u %d %z) :: round to nearest, round up, round down, round to zero :: ++ ma %*(. ff w 8, p 23, b --127, r r) :: ++ sea :: @rs to fn - |= {a/@rs} (sea:ma a) + |= [a=@rs] (sea:ma a) :: ++ bit :: fn to @rs - |= {a/fn} ^- @rs (bit:ma a) + |= [a=fn] ^- @rs (bit:ma a) :: ++ add ~/ %add :: add - |= {a/@rs b/@rs} ^- @rs + |= [a=@rs b=@rs] ^- @rs ~_ leaf+"rs-fail" (add:ma a b) :: ++ sub ~/ %sub :: subtract - |= {a/@rs b/@rs} ^- @rs + |= [a=@rs b=@rs] ^- @rs ~_ leaf+"rs-fail" (sub:ma a b) :: ++ mul ~/ %mul :: multiply - |= {a/@rs b/@rs} ^- @rs + |= [a=@rs b=@rs] ^- @rs ~_ leaf+"rs-fail" (mul:ma a b) :: ++ div ~/ %div :: divide - |= {a/@rs b/@rs} ^- @rs + |= [a=@rs b=@rs] ^- @rs ~_ leaf+"rs-fail" (div:ma a b) :: ++ fma ~/ %fma :: fused multiply-add - |= {a/@rs b/@rs c/@rs} ^- @rs + |= [a=@rs b=@rs c=@rs] ^- @rs ~_ leaf+"rs-fail" (fma:ma a b c) :: ++ sqt ~/ %sqt :: square root - |= {a/@rs} ^- @rs + |= [a=@rs] ^- @rs ~_ leaf+"rs-fail" (sqt:ma a) :: ++ lth ~/ %lth :: less-than - |= {a/@rs b/@rs} + |= [a=@rs b=@rs] ~_ leaf+"rs-fail" (lth:ma a b) :: ++ lte ~/ %lte :: less-equals - |= {a/@rs b/@rs} + |= [a=@rs b=@rs] ~_ leaf+"rs-fail" (lte:ma a b) :: ++ equ ~/ %equ :: equals - |= {a/@rs b/@rs} + |= [a=@rs b=@rs] ~_ leaf+"rs-fail" (equ:ma a b) :: ++ gte ~/ %gte :: greater-equals - |= {a/@rs b/@rs} + |= [a=@rs b=@rs] ~_ leaf+"rs-fail" (gte:ma a b) :: ++ gth ~/ %gth :: greater-than - |= {a/@rs b/@rs} + |= [a=@rs b=@rs] ~_ leaf+"rs-fail" (gth:ma a b) :: - ++ sun |= {a/@u} ^- @rs (sun:ma a) :: uns integer to @rs - ++ san |= {a/@s} ^- @rs (san:ma a) :: sgn integer to @rs - ++ sig |= {a/@rs} ^- ? (sig:ma a) :: get sign - ++ exp |= {a/@rs} ^- @s (exp:ma a) :: get exponent - ++ toi |= {a/@rs} ^- (unit @s) (toi:ma a) :: round to integer - ++ drg |= {a/@rs} ^- dn (drg:ma a) :: @rs to decimal float - ++ grd |= {a/dn} ^- @rs (grd:ma a) :: decimal float to @rs + ++ sun |= [a=@u] ^- @rs (sun:ma a) :: uns integer to @rs + ++ san |= [a=@s] ^- @rs (san:ma a) :: sgn integer to @rs + ++ sig |= [a=@rs] ^- ? (sig:ma a) :: get sign + ++ exp |= [a=@rs] ^- @s (exp:ma a) :: get exponent + ++ toi |= [a=@rs] ^- (unit @s) (toi:ma a) :: round to integer + ++ drg |= [a=@rs] ^- dn (drg:ma a) :: @rs to decimal float + ++ grd |= [a=dn] ^- @rs (grd:ma a) :: decimal float to @rs -- :: ++ rq :: quad precision fp ~% %rq +> ~ ^| - |_ r/$?($n $u $d $z) + |_ r=$?(%n %u %d %z) :: round to nearest, round up, round down, round to zero :: ++ ma %*(. ff w 15, p 112, b --16.383, r r) :: ++ sea :: @rq to fn - |= {a/@rq} (sea:ma a) + |= [a=@rq] (sea:ma a) :: ++ bit :: fn to @rq - |= {a/fn} ^- @rq (bit:ma a) + |= [a=fn] ^- @rq (bit:ma a) :: ++ add ~/ %add :: add - |= {a/@rq b/@rq} ^- @rq + |= [a=@rq b=@rq] ^- @rq ~_ leaf+"rq-fail" (add:ma a b) :: ++ sub ~/ %sub :: subtract - |= {a/@rq b/@rq} ^- @rq + |= [a=@rq b=@rq] ^- @rq ~_ leaf+"rq-fail" (sub:ma a b) :: ++ mul ~/ %mul :: multiply - |= {a/@rq b/@rq} ^- @rq + |= [a=@rq b=@rq] ^- @rq ~_ leaf+"rq-fail" (mul:ma a b) :: ++ div ~/ %div :: divide - |= {a/@rq b/@rq} ^- @rq + |= [a=@rq b=@rq] ^- @rq ~_ leaf+"rq-fail" (div:ma a b) :: ++ fma ~/ %fma :: fused multiply-add - |= {a/@rq b/@rq c/@rq} ^- @rq + |= [a=@rq b=@rq c=@rq] ^- @rq ~_ leaf+"rq-fail" (fma:ma a b c) :: ++ sqt ~/ %sqt :: square root - |= {a/@rq} ^- @rq + |= [a=@rq] ^- @rq ~_ leaf+"rq-fail" (sqt:ma a) :: ++ lth ~/ %lth :: less-than - |= {a/@rq b/@rq} + |= [a=@rq b=@rq] ~_ leaf+"rq-fail" (lth:ma a b) :: ++ lte ~/ %lte :: less-equals - |= {a/@rq b/@rq} + |= [a=@rq b=@rq] ~_ leaf+"rq-fail" (lte:ma a b) :: ++ equ ~/ %equ :: equals - |= {a/@rq b/@rq} + |= [a=@rq b=@rq] ~_ leaf+"rq-fail" (equ:ma a b) :: ++ gte ~/ %gte :: greater-equals - |= {a/@rq b/@rq} + |= [a=@rq b=@rq] ~_ leaf+"rq-fail" (gte:ma a b) :: ++ gth ~/ %gth :: greater-than - |= {a/@rq b/@rq} + |= [a=@rq b=@rq] ~_ leaf+"rq-fail" (gth:ma a b) :: - ++ sun |= {a/@u} ^- @rq (sun:ma a) :: uns integer to @rq - ++ san |= {a/@s} ^- @rq (san:ma a) :: sgn integer to @rq - ++ sig |= {a/@rq} ^- ? (sig:ma a) :: get sign - ++ exp |= {a/@rq} ^- @s (exp:ma a) :: get exponent - ++ toi |= {a/@rq} ^- (unit @s) (toi:ma a) :: round to integer - ++ drg |= {a/@rq} ^- dn (drg:ma a) :: @rq to decimal float - ++ grd |= {a/dn} ^- @rq (grd:ma a) :: decimal float to @rq + ++ sun |= [a=@u] ^- @rq (sun:ma a) :: uns integer to @rq + ++ san |= [a=@s] ^- @rq (san:ma a) :: sgn integer to @rq + ++ sig |= [a=@rq] ^- ? (sig:ma a) :: get sign + ++ exp |= [a=@rq] ^- @s (exp:ma a) :: get exponent + ++ toi |= [a=@rq] ^- (unit @s) (toi:ma a) :: round to integer + ++ drg |= [a=@rq] ^- dn (drg:ma a) :: @rq to decimal float + ++ grd |= [a=dn] ^- @rq (grd:ma a) :: decimal float to @rq -- :: ++ rh :: half precision fp ~% %rh +> ~ ^| - |_ r/$?($n $u $d $z) + |_ r=$?(%n %u %d %z) :: round to nearest, round up, round down, round to zero :: ++ ma %*(. ff w 5, p 10, b --15, r r) :: ++ sea :: @rh to fn - |= {a/@rh} (sea:ma a) + |= [a=@rh] (sea:ma a) :: ++ bit :: fn to @rh - |= {a/fn} ^- @rh (bit:ma a) + |= [a=fn] ^- @rh (bit:ma a) :: ++ add ~/ %add :: add - |= {a/@rh b/@rh} ^- @rh + |= [a=@rh b=@rh] ^- @rh ~_ leaf+"rh-fail" (add:ma a b) :: ++ sub ~/ %sub :: subtract - |= {a/@rh b/@rh} ^- @rh + |= [a=@rh b=@rh] ^- @rh ~_ leaf+"rh-fail" (sub:ma a b) :: ++ mul ~/ %mul :: multiply - |= {a/@rh b/@rh} ^- @rh + |= [a=@rh b=@rh] ^- @rh ~_ leaf+"rh-fail" (mul:ma a b) :: ++ div ~/ %div :: divide - |= {a/@rh b/@rh} ^- @rh + |= [a=@rh b=@rh] ^- @rh ~_ leaf+"rh-fail" (div:ma a b) :: ++ fma ~/ %fma :: fused multiply-add - |= {a/@rh b/@rh c/@rh} ^- @rh + |= [a=@rh b=@rh c=@rh] ^- @rh ~_ leaf+"rh-fail" (fma:ma a b c) :: ++ sqt ~/ %sqt :: square root - |= {a/@rh} ^- @rh + |= [a=@rh] ^- @rh ~_ leaf+"rh-fail" (sqt:ma a) :: ++ lth ~/ %lth :: less-than - |= {a/@rh b/@rh} + |= [a=@rh b=@rh] ~_ leaf+"rh-fail" (lth:ma a b) :: ++ lte ~/ %lte :: less-equals - |= {a/@rh b/@rh} + |= [a=@rh b=@rh] ~_ leaf+"rh-fail" (lte:ma a b) :: ++ equ ~/ %equ :: equals - |= {a/@rh b/@rh} + |= [a=@rh b=@rh] ~_ leaf+"rh-fail" (equ:ma a b) :: ++ gte ~/ %gte :: greater-equals - |= {a/@rh b/@rh} + |= [a=@rh b=@rh] ~_ leaf+"rh-fail" (gte:ma a b) :: ++ gth ~/ %gth :: greater-than - |= {a/@rh b/@rh} + |= [a=@rh b=@rh] ~_ leaf+"rh-fail" (gth:ma a b) :: ++ tos :: @rh to @rs - |= {a/@rh} (bit:rs (sea a)) + |= [a=@rh] (bit:rs (sea a)) :: ++ fos :: @rs to @rh - |= {a/@rs} (bit (sea:rs a)) + |= [a=@rs] (bit (sea:rs a)) :: - ++ sun |= {a/@u} ^- @rh (sun:ma a) :: uns integer to @rh - ++ san |= {a/@s} ^- @rh (san:ma a) :: sgn integer to @rh - ++ sig |= {a/@rh} ^- ? (sig:ma a) :: get sign - ++ exp |= {a/@rh} ^- @s (exp:ma a) :: get exponent - ++ toi |= {a/@rh} ^- (unit @s) (toi:ma a) :: round to integer - ++ drg |= {a/@rh} ^- dn (drg:ma a) :: @rh to decimal float - ++ grd |= {a/dn} ^- @rh (grd:ma a) :: decimal float to @rh + ++ sun |= [a=@u] ^- @rh (sun:ma a) :: uns integer to @rh + ++ san |= [a=@s] ^- @rh (san:ma a) :: sgn integer to @rh + ++ sig |= [a=@rh] ^- ? (sig:ma a) :: get sign + ++ exp |= [a=@rh] ^- @s (exp:ma a) :: get exponent + ++ toi |= [a=@rh] ^- (unit @s) (toi:ma a) :: round to integer + ++ drg |= [a=@rh] ^- dn (drg:ma a) :: @rh to decimal float + ++ grd |= [a=dn] ^- @rh (grd:ma a) :: decimal float to @rh -- :: 3c: urbit time :: :::: :: :: year, yore, yell, yule, yall, yawn, yelp, yo :: :: ++ year :: date to @d - |= det/date + |= det=date ^- @da =+ ^= yer ?: a.det @@ -3179,7 +3149,7 @@ (yule day h.t.det m.t.det s.t.det f.t.det) :: ++ yore :: @d to date - |= now/@da + |= now=@da ^- date =+ rip=(yell now) =+ ger=(yall d.rip) @@ -3189,7 +3159,7 @@ [m.ger d.ger h.rip m.rip s.rip f.rip] :: ++ yell :: tarp from @d - |= now/@d + |= now=@d ^- tarp =+ sec=(rsh 6 1 now) =+ ^= fan @@ -3208,7 +3178,7 @@ [day hor mit sec fan] :: ++ yule :: time atom - |= rip/tarp + |= rip=tarp ^- @d =+ ^= sec ;: add (mul d.rip day:yo) @@ -3225,8 +3195,8 @@ (con (lsh 6 1 sec) fac) :: ++ yall :: day / to day of year - |= day/@ud - ^- {y/@ud m/@ud d/@ud} + |= day=@ud + ^- [y=@ud m=@ud d=@ud] =+ [era=0 cet=0 lep=*?] => .(era (div day era:yo), day (mod day era:yo)) => ^+ . @@ -3235,21 +3205,21 @@ => .(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} + |- ^- [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} + |- ^- [y=@ud m=@ud d=@ud] =+ [mot=0 cah=?:(lep moy:yo moh:yo)] - |- ^- {y/@ud m/@ud d/@ud} + |- ^- [y=@ud m=@ud d=@ud] =+ zis=(snag mot cah) ?: (lth day zis) [yer +(mot) +(day)] $(mot +(mot), day (sub day zis)) :: ++ yawn :: days since Jesus - |= {yer/@ud mot/@ud day/@ud} + |= [yer=@ud mot=@ud day=@ud] ^- @ud => .(mot (dec mot), day (dec day)) => ^+ . @@ -3274,7 +3244,7 @@ (add day (mul (div yer 400) (add 1 (mul 4 36.524)))) :: ++ yelp :: leap year - |= yer/@ud ^- ? + |= yer=@ud ^- ? &(=(0 (mod yer 4)) |(!=(0 (mod yer 100)) =(0 (mod yer 400)))) :: ++ yo :: time constants @@ -3293,33 +3263,33 @@ :::: 3d: SHA hash family :: :: :: :: -++ shad |=(ruz/@ (shax (shax ruz))) :: double sha-256 +++ shad |=(ruz=@ (shax (shax ruz))) :: double sha-256 ++ shaf :: half sha-256 - |= {sal/@ ruz/@} + |= [sal=@ ruz=@] =+ haz=(shas sal ruz) (mix (end 7 1 haz) (rsh 7 1 haz)) :: ++ sham :: 128bit noun hash - |= yux/* ^- @uvH ^- @ + |= yux=* ^- @uvH ^- @ ?@ yux (shaf %mash yux) (shaf %sham (jam yux)) :: ++ shas :: salted hash ~/ %shas - |= {sal/@ ruz/@} + |= [sal=@ ruz=@] (shax (mix sal (shax ruz))) :: ++ shax :: sha-256 ~/ %shax - |= ruz/@ ^- @ + |= ruz=@ ^- @ (shay [(met 3 ruz) ruz]) :: ++ shay :: sha-256 with length ~/ %shay - |= {len/@u ruz/@} ^- @ + |= [len=@u ruz=@] ^- @ => .(ruz (cut 3 [0 len] ruz)) - =+ [few==>(fe .(a 5)) wac=|=({a/@ b/@} (cut 5 [a 1] b))] + =+ [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 len) =+ ^= ful @@ -3402,18 +3372,18 @@ $(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/@} + |= [sal=@ len=@ ruz=@] (~(raw og (shas sal (mix len ruz))) len) :: ++ shaz :: sha-512 - |= ruz/@ ^- @ + |= ruz=@ ^- @ (shal [(met 3 ruz) ruz]) :: ++ shal :: sha-512 with length ~/ %shal - |= {len/@ ruz/@} ^- @ + |= [len=@ ruz=@] ^- @ => .(ruz (cut 3 [0 len] ruz)) - =+ [few==>(fe .(a 6)) wac=|=({a/@ b/@} (cut 6 [a 1] b))] + =+ [few==>(fe .(a 6)) wac=|=([a=@ b=@] (cut 6 [a 1] b))] =+ [sum=sum.few ror=ror.few net=net.few inv=inv.few] =+ ral=(lsh 0 3 len) =+ ^= ful @@ -3522,8 +3492,8 @@ $(j +(j), a (sum q n), b a, c b, d c, e (sum d q), f e, g f, h g) :: ++ shan :: sha-1 (deprecated) - |= ruz/@ - =+ [few==>(fe .(a 5)) wac=|=({a/@ b/@} (cut 5 [a 1] b))] + |= ruz=@ + =+ [few==>(fe .(a 5)) wac=|=([a=@ b=@] (cut 5 [a 1] b))] =+ [sum=sum.few ror=ror.few rol=rol.few net=net.few inv=inv.few] =+ ral=(lsh 0 3 (met 3 ruz)) =+ ^= ful @@ -3589,26 +3559,26 @@ :: ++ og :: shax-powered rng ~/ %og - |_ a/@ + |_ a=@ ++ rad :: random in range - |= b/@ ^- @ + |= b=@ ^- @ ~_ leaf+"rad-zero" ?< =(0 b) =+ c=(raw (met 0 b)) ?:((lth c b) c $(a +(a))) :: ++ rads :: random continuation - |= b/@ + |= b=@ =+ r=(rad b) [r +>.$(a (shas %og-s (mix a r)))] :: ++ raw :: random bits ~/ %raw - |= b/@ ^- @ + |= b=@ ^- @ %+ can 0 =+ c=(shas %og-a (mix b a)) - |- ^- (list {@ @}) + |- ^- (list [@ @]) ?: =(0 b) ~ =+ d=(shas %og-b (mix b (mix a c))) @@ -3617,7 +3587,7 @@ [[256 d] $(c d, b (sub b 256))] :: ++ raws :: random bits - |= b/@ :: continuation + |= b=@ :: continuation =+ r=(raw b) [r +>.$(a (shas %og-s (mix a r)))] -- @@ -3626,7 +3596,7 @@ ~% %sha ..sha ~ => |% ++ flin |=(a=@ (swp 3 a)) :: flip input - ++ flim |=(byts [wid (rev 3 wid dat)]) :: flip input w/ length + ++ flim |=(byts [wid (rev 3 wid dat)]) :: flip input w= length ++ flip |=(w=@u (cury (cury rev 3) w)) :: flip output of size ++ meet |=(a=@ [(met 3 a) a]) :: measure input size -- @@ -3647,7 +3617,7 @@ ~/ %sha1 |= byts ^- @ - =+ [few==>(fe .(a 5)) wac=|=({a/@ b/@} (cut 5 [a 1] b))] + =+ [few==>(fe .(a 5)) wac=|=([a=@ b=@] (cut 5 [a 1] b))] =+ [sum=sum.few ror=ror.few rol=rol.few net=net.few inv=inv.few] =+ ral=(lsh 0 3 wid) =+ ^= ful @@ -3723,16 +3693,16 @@ ++ un :: =(x (wred (wren x))) |% ++ wren :: conceal structure - |= pyn/@ ^- @ + |= pyn=@ ^- @ =+ len=(met 3 pyn) ?: =(0 len) 0 => .(len (dec len)) =+ mig=(zaft (xafo len (cut 3 [len 1] pyn))) %+ can 3 - %- flop ^- (list {@ @}) + %- flop ^- (list [@ @]) :- [1 mig] - |- ^- (list {@ @}) + |- ^- (list [@ @]) ?: =(0 len) ~ => .(len (dec len)) @@ -3740,27 +3710,27 @@ [[1 mog] $(mig mog)] :: ++ wred :: restore structure - |= cry/@ ^- @ + |= cry=@ ^- @ =+ len=(met 3 cry) ?: =(0 len) 0 => .(len (dec len)) =+ mig=(cut 3 [len 1] cry) %+ can 3 - %- flop ^- (list {@ @}) + %- flop ^- (list [@ @]) :- [1 (xaro len (zart mig))] - |- ^- (list {@ @}) + |- ^- (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))) + ++ 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/@D + |= a=@D =+ ^= 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. @@ -3776,7 +3746,7 @@ (cut 3 [(dec a) 1] b) :: ++ zart :: reverse 255-sbox - |= a/@D + |= a=@D =+ ^= 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. @@ -3792,7 +3762,7 @@ (cut 3 [(dec a) 1] b) :: ++ zyft :: forward 256-sbox - |= a/@D + |= a=@D =+ ^= b 0xbb49.b71f.b881.b402.17e4.6b86.69b5.1647.115f.dddb.7ca5. 8371.4bd5.19a9.b092.605d.0d9b.e030.a0cc.78ba.5706.4d2d. @@ -3809,7 +3779,7 @@ (cut 3 [a 1] b) :: ++ zyrt :: reverse 256-sbox - |= a/@D + |= a=@D =+ ^= b 0x9fc8.2753.6e02.8fcf.8b35.2b20.5598.7caa.c9a9.30b0.9b48. 47ce.6371.80f6.407d.00dd.0aa5.ed10.ecb7.0f5a.5c3a.e605. @@ -3827,14 +3797,21 @@ -- :: ++ ob + ~% %ob ..ob + == + %fein fein + %fynd fynd + == |% + :: :: +fein: conceal structure, v3. :: :: +fein conceals planet-sized atoms. The idea is that it should not be :: trivial to tell which planet a star has spawned under. :: ++ fein - |= pyn/@ ^- @ + ~/ %fein + |= pyn=@ ^- @ ?: &((gte pyn 0x1.0000) (lte pyn 0xffff.ffff)) (add 0x1.0000 (feis (sub pyn 0x1.0000))) ?: &((gte pyn 0x1.0000.0000) (lte pyn 0xffff.ffff.ffff.ffff)) @@ -3849,7 +3826,8 @@ :: Restores obfuscated values that have been enciphered with +fein. :: ++ fynd - |= cry/@ ^- @ + ~/ %fynd + |= cry=@ ^- @ ?: &((gte cry 0x1.0000) (lte cry 0xffff.ffff)) (add 0x1.0000 (tail (sub cry 0x1.0000))) ?: &((gte cry 0x1.0000.0000) (lte cry 0xffff.ffff.ffff.ffff)) @@ -3858,7 +3836,6 @@ %+ con hi $(cry lo) cry - :: :: +feis: a four-round generalised Feistel cipher over the domain :: [0, 2^32 - 2^16 - 1]. :: @@ -4020,32 +3997,32 @@ :: :::: 3g: molds and mold builders :: -++ coin $~ [%$ %ud 0] :: print format - $% {$$ p/dime} :: - {$blob p/*} :: - {$many p/(list coin)} :: ++$ coin $~ [%$ %ud 0] :: print format + $% [%$ p=dime] :: + [%blob p=*] :: + [%many p=(list coin)] :: == :: -++ dime {p/@ta q/@} :: -++ edge {p/hair q/(unit {p/* q/nail})} :: parsing output -++ hair {p/@ud q/@ud} :: parsing trace -++ like |* a/$-(* *) :: generic edge ++$ dime [p=@ta q=@] :: ++$ edge [p=hair q=(unit [p=* q=nail])] :: parsing output ++$ hair [p=@ud q=@ud] :: parsing trace +++ like |* a=$-(* *) :: generic edge |: b=`*`[(hair) ~] :: :- p=(hair -.b) :: ^= q :: ?@ +.b ~ :: :- ~ :: u=[p=(a +>-.b) q=[p=(hair -.b) q=(tape +.b)]] :: -++ nail {p/hair q/tape} :: parsing input -++ pint {p/{p/@ q/@} q/{p/@ q/@}} :: line+column range -++ rule _|:($:nail $:edge) :: parsing rule -++ spot {p/path q/pint} :: range in file -++ tone $% {$0 p/*} :: success - {$1 p/(list)} :: blocks - {$2 p/(list {@ta *})} :: error report ++$ nail [p=hair q=tape] :: parsing input ++$ pint [p=[p=@ q=@] q=[p=@ q=@]] :: line+column range ++$ rule _|:($:nail $:edge) :: parsing rule ++$ spot [p=path q=pint] :: range in file ++$ tone $% [%0 product=*] :: success + [%1 block=*] :: single block + [%2 trace=(list [@ta *])] :: error report == :: -++ toon $% {$0 p/*} :: success - {$1 p/(list)} :: blocks - {$2 p/(list tank)} :: stack trace ++$ toon $% [%0 p=*] :: success + [%1 p=*] :: block + [%2 p=(list tank)] :: stack trace == :: ++ wonk =+ veq=$:edge :: product from edge |@ ++ $ ?~(q.veq !! p.u.q.veq) :: @@ -4073,6 +4050,7 @@ ~% %qua + == + %mure mure %mute mute %show show == @@ -4118,40 +4096,40 @@ /lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes' |% ++ ins ~/ %ins :: parse prefix - |= a/@tas + |= a=@tas =+ b=0 |- ^- (unit @) ?:(=(256 b) ~ ?:(=(a (tos b)) [~ b] $(b +(b)))) ++ ind ~/ %ind :: parse suffix - |= a/@tas + |= a=@tas =+ b=0 |- ^- (unit @) ?:(=(256 b) ~ ?:(=(a (tod b)) [~ b] $(b +(b)))) ++ tos ~/ %tos :: fetch prefix - |=(a/@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] sis))) + |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] sis))) ++ tod ~/ %tod :: fetch suffix - |=(a/@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] dex))) + |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] dex))) -- :: ++ fa :: base58check =+ key='123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' - =/ yek/@ux ~+ + =/ yek=@ux ~+ =- yek:(roll (rip 3 key) -) =+ [a=*char b=*@ yek=`@ux`(fil 3 256 0xff)] |. [+(b) (mix yek (lsh 3 `@u`a (~(inv fe 3) b)))] |% - ++ cha |=(a/char `(unit @uF)`=+(b=(cut 3 [`@`a 1] yek) ?:(=(b 0xff) ~ `b))) + ++ cha |=(a=char `(unit @uF)`=+(b=(cut 3 [`@`a 1] yek) ?:(=(b 0xff) ~ `b))) ++ tok - |= a/@ux ^- @ux + |= a=@ux ^- @ux =+ b=(pad a) =- (~(net fe 5) (end 3 4 (shay 32 -))) (shay (add b (met 3 a)) (lsh 3 b (swp 3 a))) :: - ++ pad |=(a/@ =+(b=(met 3 a) ?:((gte b 21) 0 (sub 21 b)))) - ++ enc |=(a/@ux `@ux`(mix (lsh 3 4 a) (tok a))) + ++ pad |=(a=@ =+(b=(met 3 a) ?:((gte b 21) 0 (sub 21 b)))) + ++ enc |=(a=@ux `@ux`(mix (lsh 3 4 a) (tok a))) ++ den - |= a/@ux ^- (unit @ux) + |= a=@ux ^- (unit @ux) =+ b=(rsh 3 4 a) ?. =((tok b) (end 3 4 a)) ~ @@ -4161,7 +4139,7 @@ :::: 4b: text processing :: ++ at :: basic printing - |_ a/@ + |_ a=@ ++ r ?: ?& (gte (met 3 a) 2) |- @@ -4182,10 +4160,10 @@ ++ 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))) + ++ rub `tape`['0' 'b' (rum 2 ~ |=(b=@ (add '0' b)))] + ++ rud (rum 10 ~ |=(b=@ (add '0' b))) ++ rum - |= {b/@ c/tape d/$-(@ @)} + |= [b=@ c=tape d=$-(@ @)] ^- tape ?: =(0 a) [(d 0) c] @@ -4229,29 +4207,29 @@ %^ rum 64 ~ - |= b/@ + |= 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))))] + ++ rux `tape`['0' 'x' (rum 16 ~ |=(b=@ (add b ?:((lth b 10) 48 87))))] -- ++ cass :: lowercase - |= vib/tape + |= vib=tape ^- tape - (turn vib |=(a/@ ?.(&((gte a 'A') (lte a 'Z')) a (add 32 a)))) + (turn vib |=(a=@ ?.(&((gte a 'A') (lte a 'Z')) a (add 32 a)))) :: ++ cuss :: uppercase - |= vib/tape + |= vib=tape ^- tape - (turn vib |=(a/@ ?.(&((gte a 'a') (lte a 'z')) a (sub a 32)))) + (turn vib |=(a=@ ?.(&((gte a 'a') (lte a 'z')) a (sub a 32)))) :: -++ crip |=(a/tape `@t`(rap 3 a)) :: tape to cord +++ crip |=(a=tape `@t`(rap 3 a)) :: tape to cord :: ++ mesc :: ctrl code escape - |= vib/tape + |= vib=tape ^- tape ?~ vib ~ @@ -4262,19 +4240,19 @@ [i.vib $(vib t.vib)] :: ++ runt :: prepend repeatedly - |= {{a/@ b/@} c/tape} + |= [[a=@ b=@] c=tape] ^- tape ?: =(0 a) c [b $(a (dec a))] :: ++ sand :: atom sanity - |= a/@ta + |= a=@ta (flit (sane a)) :: ++ sane :: atom sanity - |= a/@ta - |= b/@ ^- ? + |= a=@ta + |= b=@ ^- ? ?. =(%t (end 3 1 a)) :: XX more and better sanity :: @@ -4310,15 +4288,15 @@ == :: ++ ruth :: biblical sanity - |= {a/@ta b/*} + |= [a=@ta b=*] ^- @ ?^ b !! :: ?. ((sane a) b) !! b :: ++ trim :: tape split - |= {a/@ b/tape} - ^- {p/tape q/tape} + |= [a=@ b=tape] + ^- [p=tape q=tape] ?~ b [~ ~] ?: =(0 a) @@ -4328,13 +4306,13 @@ :: ++ trip :: cord to tape ~/ %trip - |= a/@ ^- tape + |= a=@ ^- tape ?: =(0 (met 3 a)) ~ [^-(@ta (end 3 1 a)) $(a (rsh 3 1 a))] :: ++ teff :: length utf8 - |= a/@t ^- @ + |= a=@t ^- @ =+ b=(end 3 1 a) ?: =(0 b) ?>(=(`@`0 a) 0) @@ -4342,7 +4320,7 @@ ?:((lte b 127) 1 ?:((lte b 223) 2 ?:((lte b 239) 3 4))) :: ++ taft :: utf8 to utf32 - |= a/@t + |= a=@t ^- @c %+ rap 5 |- ^- (list @c) @@ -4351,30 +4329,30 @@ =+ ^= c %+ can 0 %+ turn - ^- (list {p/@ q/@}) + ^- (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] ~] + %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)]) + |=([p=@ q=@] [q (cut 0 [p q] a)]) ?> =((tuft c) (end 3 b a)) [c $(a (rsh 3 b a))] :: ++ tuba :: utf8 to utf32 tape - |= a/tape + |= a=tape ^- (list @c) (rip 5 (taft (rap 3 a))) :: XX horrible :: ++ tufa :: utf32 to utf8 tape - |= a/(list @c) + |= a=(list @c) ^- tape ?~ a "" (weld (rip 3 (tuft i.a)) $(a t.a)) :: ++ tuft :: utf32 to utf8 text - |= a/@c + |= a=@c ^- @t %+ rap 3 |- ^- (list @) @@ -4403,7 +4381,7 @@ == :: ++ wack :: knot escape - |= a/@ta + |= a=@ta ^- @ta =+ b=(rip 3 a) %+ rap 3 @@ -4415,24 +4393,24 @@ [i.b $(b t.b)] :: ++ wick :: knot unescape - |= a/@ + |= a=@ ^- (unit @ta) =+ b=(rip 3 a) =- ?^(b ~ (some (rap 3 (flop c)))) - =| c/tape - |- ^- {b/tape c/tape} + =| c=tape + |- ^- [b=tape c=tape] ?~ b [~ c] ?. =('~' i.b) $(b t.b, c [i.b c]) ?~ t.b [b ~] ?- i.t.b - $'~' $(b t.t.b, c ['~' c]) - $'-' $(b t.t.b, c ['_' c]) + %'~' $(b t.t.b, c ['~' c]) + %'-' $(b t.t.b, c ['_' c]) @ [b ~] == :: ++ woad :: cord unescape - |= a/@ta + |= a=@ta ^- @t %+ rap 3 |- ^- (list @) @@ -4448,7 +4426,7 @@ ?+ b =- (weld (rip 3 (tuft p.d)) $(a q.d)) ^= d =+ d=0 - |- ^- {p/@ q/@} + |- ^- [p=@ q=@] ?: =('.' b) [d c] ?< =(0 c) @@ -4460,12 +4438,12 @@ ?: &((gte b '0') (lte b '9')) 48 ?>(&((gte b 'a') (lte b 'z')) 87) == - $'.' ['.' $(a c)] - $'~' ['~' $(a c)] + %'.' ['.' $(a c)] + %'~' ['~' $(a c)] == :: ++ wood :: cord escape - |= a/@t + |= a=@t ^- @ta %+ rap 3 |- ^- (list @) @@ -4489,605 +4467,189 @@ =+ f=(rsh 2 e c) [(add ?:((lte f 9) 48 87) f) $(c (end 2 e c))] :: - $' ' ['.' d] - $'.' ['~' '.' d] - $'~' ['~' '~' d] + %' ' ['.' d] + %'.' ['~' '.' d] + %'~' ['~' '~' d] == :: :::: 4c: tank printer :: ++ wash :: render tank at width - |= {{tab/@ edg/@} tac/tank} ^- wall + |= [[tab=@ edg=@] tac=tank] ^- wall (~(win re tac) tab edg) :: -:: This library includes `plume`, the actual pretty printing logic, -:: and a handful of utilities for constructing plums. -:: -:: Generally, you'll just use `plume` like this: -:: -:: ~(plume tall plum) :: Pretty print `plum` in tall mode. -:: ~(plume flat plum) :: Pretty print `plum` in wide mode. -:: -:: There is probably no reason to look at the utility routines unless -:: you are writing something to generate `plum`s. -:: -:: This is the pretty-printer. Use the `flat` arm to render a plum -:: into a single line and use the `tall` arm to get a nice multi-line -:: rendering that switches to wide mode if there's enough space. -:: -:: For details about how this works and what exactly it does in various -:: cases, take a look at the docs for `plum`, `plumfmt`, and at the -:: docs on the arms of this door. -:: -++ plume - |_ =plum - :: - :: An line, indented by `indent` spaces. - :: - +$ line [indent=@ud text=tape] - :: - :: An sequence of indented lines. - :: - +$ block (list line) - :: - :: +flat: print as a single line - :: - ++ flat - ^- wain - text:linear - :: - :: +tall: print as multiple lines - :: - ++ tall - ^- wain - %+ turn window - |= line - (crip (runt [indent ' '] text)) - :: - :: +adjust: adjust lines to right - :: - ++ adjust - |= [tab=@ud =block] ^- ^block - (turn block |=([@ud tape] [(add tab +<-) +<+])) - :: - :: Prepend `n` spaces to a tape. - :: - ++ prepend-spaces - |= [n=@ t=tape] ^- tape - (runt [n ' '] t) - :: - :: +window: print as list of tabbed lines - :: - ++ window - ^- block - ~+ :: for random access - ?@ plum [0 (trip plum)]~ :: trivial text - ?- -.plum - :: - :: %para: Line-wrappable paragraph. This is a stub; it should - :: wrap text to 40 characters. - :: - %para - [0 +:linear]~ - :: - :: %sbrk: nested subexpression - :: - :: This is an opportunity to switch to wide mode. First, try - :: rendered in wide mode. If that's possible and the result - :: isn't too big, use that. Otherwise recurse into the subplum - :: without switching to wide mode. - :: - %sbrk - =/ sub kid.plum - ?+ sub - window(plum sub) - [%tree *] - =/ wideresult - ?~(wide.fmt.sub ~ [~ u=linear]) - ?: ?&(?=(^ wideresult) (lte length.u.wideresult 40)) - [0 text.u.wideresult]~ - window(plum sub) - == - :: - :: %tree: Try to render a text tree in tall mode. - :: - :: We want to render this in tall mode. First, verify that there - :: the plum has a tall render (if not, fall back to `linear` - :: formatting), then render all the subplums, and then render - :: them in one of three ways: - :: - :: - If the `plumfmt` contains an `indef` and that indef has - :: no prefix, then this is a variable-arity rune with a - :: terminator: Use vertical formatting. - :: - :: - If the `plumfmt` contains an `indef` and that indef DOES have - :: a prefix, then this is something that looks like a core: Use - :: `core-like` formatting. - :: - :: - Otherwise, this is a rune with a fixed number of arguments - :: Render the subplums using backstep indentation. - :: - :: There's also a special case where something has exactly one sub-plum. - :: where something has exactly one sub-block. For example, we - :: want this output: - :: - :: |- - :: foo - :: - %tree - ?~ tall.fmt.plum [0 text:linear]~ - =/ prelude (trip intro.u.tall.fmt.plum) - |^ =/ blocks (turn kids.plum |=(=^plum window(plum plum))) - =/ prelude (trip intro.u.tall.fmt.plum) - ?~ indef.u.tall.fmt.plum - ?: =(1 (lent blocks)) - [[0 prelude] (zing blocks)] - (backstep prelude blocks) - =/ prefix (trip sigil.u.indef.u.tall.fmt.plum) - =/ finale (trip final.u.indef.u.tall.fmt.plum) - ?~ blocks %+ weld - ?~(prelude ~ [0 prelude]~) - ?~(finale ~ [0 finale]~) - ?~ prefix (running prelude blocks finale) - (core-like prelude prefix blocks finale) - -- - == - :: - :: Render a plum in tall-mode using backstep indentation. Here, - :: we are rendering things that look something like this: - :: - :: :+ foo - :: bar - :: baz - :: - ++ backstep - |= [prelude=tape blocks=(list block)] - ^- block - %- zing - =/ nkids (lent blocks) - =/ idx 1 - |- ^- (list block) - ?~ blocks ~ - :_ $(blocks t.blocks, idx +(idx)) - ^- block - =/ indent (mul 2 (sub nkids idx)) - ?. =(1 idx) (adjust indent i.blocks) - (rune-inline-with-block prelude indent i.blocks) - :: - :: To make things look a bit nicer, we want to put the first - :: sub-block on the same line as the rune. We want this: - :: - :: :- foo - :: baz - :: - :: Instead of this: - :: - :: :- - :: foo - :: baz - :: - :: This handles the "foo" case. - :: - ++ rune-inline-with-block - |= [rune=tape indent=@ blk=block] - ^- block - =. indent (max indent (add 2 (lent rune))) - =. blk (adjust indent blk) - ?~ rune blk - ?~ blk [0 rune]~ - :_ t.blk - :- 0 - %+ weld rune - =/ spaces-btwn (sub indent.i.blk (lent rune)) - (prepend-spaces spaces-btwn text.i.blk) - :: - :: Render a tall hoon with running indentation. Here, we are - :: rendering things that look sopmething like: - :: - :: :~ foo - :: bar - :: baz - :: == - :: - :: So, there's basically three cases here: Either the prelude - :: is a rune, the prelude is empty, or prelude is some other - :: random-ass thing. - :: - :: - If there is no prelude, then just combine all of the - :: sub-blocks together unaltered. - :: - If it's a rune (two-characters wide), then combine the - :: rune and the first line into one line (separated by two - :: spaces) and indent the rest of the lines by four spaces. - :: - If the rune is some other random-ass thing (has a length - :: that isn't 0 or 2), then render the prelude alone on the - :: first line and then combine the sub-blocks together, - :: all indented by another two spaces. - :: - :: Regardless, if there's a finale, stick it on the end without - :: any indentation. - :: - ++ running - |= [prelude=tape blocks=(list block) finale=tape] - ^- block - =/ result=block (zing blocks) - =. result - ?+ (lent prelude) - [[0 prelude] (adjust 2 result)] :: unusual prelude - %0 :: empty prelude - result - %2 :: rune prelude - (rune-inline-with-block prelude 4 result) - == - ?~ finale result - (snoc result [0 finale]) - :: - :: This renders sub-blocks where each sub-block needs to be - :: prefixed by some tape. For example: - :: - :: |% - :: ++ foo - :: bar - :: ++ baz - :: qux - :: -- - :: - ++ core-like - |= [prelude=tape prefix=tape blocks=(list block) finale=tape] - ^- block - =/ clear (add 2 (lent prefix)) - =/ result - ^- block - %- zing - ^- (list block) - %+ turn blocks - |= blk=block - ^- block - ^+ +< - =* tab ?~(blk 0 (sub clear (min clear indent.i.blk))) - =. blk (adjust tab blk) - ?~ blk ~ - :_ t.blk - :- 0 - %+ weld prefix - (runt [(sub indent.i.blk (lent prefix)) ' '] text.i.blk) - =. result - ?~ finale result - (snoc result [0 finale]) - ?~ prelude result - [[0 prelude] result] - :: - :: +linear: Render a plum onto a single line, even if it only has a - :: wide form. - :: - ++ linear - ^- [length=@ud text=tape] - ~+ :: ~+ for random access - ?@ plum [(met 3 plum) (trip plum)] :: Just a cord. - ?- -.plum - :: - :: This is already in wide mode, so %sbrk nodes don't matter here. - :: - %sbrk - linear(plum kid.plum) - :: - :: %para: To write a wrappable text paragraph to a single line, - :: we just combine all the lines into one, interspersing single - :: spaces chars. - :: - %para - |- ^- [length=@ud text=tape] - ?~ lines.plum [0 ~] - =/ next $(lines.plum t.lines.plum) - =/ this [length=(met 3 i.lines.plum) text=(trip i.lines.plum)] - :- (add +(length.this) length.next) - (weld text.this `tape`[' ' text.next]) - :: - :: Render a text tree to a single line. - :: - %tree - |^ ^- [length=@ud text=tape] - ?~ wide.fmt.plum (force-wide window) - =/ body (render-body delimit.u.wide.fmt.plum kids.plum) - ?~ enclose.u.wide.fmt.plum body - (wrap-with-enclose u.enclose.u.wide.fmt.plum body) - :: - :: Given a list of subplums and a delimiter, render all the - :: subplums onto a single line, and combine them into a single - :: string by interspersing the delimiter. - :: - ++ render-body - |= [delimit=cord kids=(list ^plum)] - =/ stop (trip delimit) - |- ^- [length=@ud text=tape] - ?~ kids [0 ~] - =/ next $(kids t.kids) - =/ this linear(plum i.kids) - ?~ text.next this - :- :(add length.this (lent stop) length.next) - :(weld text.this stop text.next) - :: - :: Wrap a wide-form-rendered result with the `enclose` cords - :: from its `plumefmt`. - :: - ++ wrap-with-enclose - |= [clamps=(pair cord cord) body=[length=@ text=tape]] - ^- [length=@ud text=tape] - :: - =/ close [(trip -.clamps) (trip +.clamps)] - :- :(add length.body (lent -.close) (lent +.close)) - :(weld -.close text.body +.close) - :: - :: Given the result of rendering a plum in tall form, combine - :: all the lines into one by separating each by two spaces. - :: - ++ force-wide - |= render=(list [@ud text=tape]) - ^- [length=@ud text=tape] - :: - ?~ render [0 ~] - =/ next (force-wide t.render) - :- :(add (lent text.i.render) 2 length.next) - ?~(text.next text.i.render :(weld text.i.render " " text.next)) - -- - == - -- -:: -:: Convenience function to build a `plumfmt` for a rune with a fixed -:: number of parameters. -:: -++ fixed - |= rune=@ta - ^- plumfmt - [wide=`[' ' `[(cat 3 +< '(') ')']] tall=`[+< ~]] -:: -:: Same as `fixed` but only outputs in `tall` mode. -:: -++ tall-fixed - |= rune=cord - ^- (unit [cord (unit [cord cord])]) - `[rune ~] -:: -:: Convenience function to build a the `tall` part of a `plumfmt` for -:: a running-style rune (one that takes a variable number of parameters -:: and has a terminator). -:: -++ tall-running - |= [rune=cord sigil=cord term=cord] - ^- (unit [cord (unit [cord cord])]) - `[rune `[sigil term]] -:: -:: Convenience function for rendering a rune into a plum. This takes -:: a rune, an optional tall-form terminator, optionally a short-form (if -:: you don't supply a short-form, it'll just construct the standard -:: wide-form (e.g. "?~(x x ~)") for you, and a list of sub-plums. -:: -++ rune - |= $: rune=cord - term=(unit cord) - short=(unit [cord cord cord]) - kids=(list plum) - == - ^. plum - |^ :- %sbrk - :+ %tree - :- (rune-wide-form rune short) - ?~ term (tall-fixed rune) - (tall-running rune '' u.term) - kids - :: - :: If you just give this a rune, it'll build the standard wide-form. - :: Otherwise, it'll just use the one that you gave it. - :: - ++ rune-wide-form - |= [rune=cord short=(unit [fst=cord mid=cord lst=cord])] - ^- (unit (pair cord (unit [cord cord]))) - =* fst (cat 3 rune '(') - =* std `[' ' `[fst ')']] - ?~ short std - `[mid.u.short `[fst.u.short lst.u.short]] - -- -:: -:: Just a helper function for constructing a wide-form %tree plum. -:: -++ simple-wide - |= [init=cord sep=cord end=cord kids=(list plum)] - ^- plum - =/ fmt=plumfmt [wide=[~ sep [~ init end]] tall=~] - [%tree fmt kids] -:: -:: Convenience function that builds a plum for a subexpression. The -:: `%sbrk` tells the pretty-printer that this is a valid place to -:: switch from tall mode to wide mode. -:: -++ subtree - |= [p=plumfmt q=(list plum)] - ^- plum - [%sbrk [%tree p q]] -:: -:: Convenience for generating plums that look like s-expressions. Useful -:: for quickly getting decent-looking debug output. -:: -++ sexp - |= [sym=cord kids=(list plum)] - ^- plum - =/ head=cord (cat 3 '(' sym) - =/ headspc=cord (cat 3 head ' ') - =/ symcol=cord (cat 3 sym ':') - =/ fmt=plumfmt [[~ ' ' [~ headspc ')']] [~ symcol [~ '' '']]] - ?~ kids (cat 3 '(' (cat 3 sym ')')) - [%sbrk [%tree fmt kids]] +:: |re: tank renderer :: ++ re - |_ tac/tank + |_ tac=tank + :: +ram: render a tank to one line (flat) + :: ++ ram ^- tape + ?@ tac + (trip tac) ?- -.tac - $leaf p.tac - $plum ~(flat plume p.tac) - $palm ram(tac [%rose [p.p.tac (weld q.p.tac r.p.tac) s.p.tac] q.tac]) - $rose + %leaf p.tac + :: + :: flat %palm rendered as %rose with welded openers + :: + %palm + =* mid p.p.tac + =* for (weld q.p.tac r.p.tac) + =* end s.p.tac + ram(tac [%rose [mid for end] q.tac]) + :: + :: flat %rose rendered with open/mid/close + :: + %rose + =* mid p.p.tac + =* for q.p.tac + =* end r.p.tac + =* lit q.tac %+ weld - q.p.tac + for |- ^- 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))) + ?~ lit + end + %+ weld + ram(tac i.lit) + =* voz $(lit t.lit) + ?~(t.lit voz (weld mid voz)) == + :: +win: render a tank to multiple lines (tall) :: - ++ ug :: horrible hack - |% - ++ ace :: strip ctrl chars - |= a=tape - ^- tape - ?~ a ~ - ?: |((lth i.a 32) =(127 `@`i.a)) - $(a t.a) - [i.a $(a t.a)] - :: - ++ act :: pretend tapes - |= tac=tank - ^- tank - ?- -.tac - %leaf [%leaf (hew p.tac)] - %plum tac :: XX consider - %palm :+ %palm - [(hew p.p.tac) (hew q.p.tac) (hew r.p.tac) (hew s.p.tac)] - (turn q.tac act) - %rose :+ %rose - [(hew p.p.tac) (hew q.p.tac) (hew r.p.tac)] - (turn q.tac act) - == - :: - ++ fix :: restore tapes - |= wol=wall - %+ turn wol - |=(a=tape (tufa `(list @c)``(list @)`a)) - :: - ++ hew :: pretend tape - |=(a=tape `tape``(list @)`(tuba (ace a))) - -- + :: indented by .tab, soft-wrapped at .edg :: ++ win - |= {tab/@ edg/@} - =. tac (act:ug tac) - %- fix:ug - =+ lug=`wall`~ - |^ |- ^- wall + |= [tab=@ud edg=@ud] + :: output stack + :: + =| lug=wall + |^ ^- wall + ?@ tac + (rig (trip tac)) ?- -.tac - $leaf (rig p.tac) - $plum (turn ~(tall plume p.tac) |=(=cord (trip cord))) - $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) + %leaf (rig p.tac) :: - $rose - ?: fit - (rig ram) + %palm + =/ hom ram + ?: (lte (lent hom) (sub edg tab)) + (rig hom) + :: + =* for q.p.tac + =* lit q.tac + ?~ lit + (rig for) + ?~ t.lit + =: tab (add 2 tab) + lug $(tac i.lit) + == + (rig for) + :: + => .(lit `(list tank)`lit) + =/ lyn (mul 2 (lent lit)) =. lug |- ^- 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) - lug - (wig q.p.tac) + ?~ lit + lug + =/ nyl (sub lyn 2) + %= ^$ + tac i.lit + tab (add tab nyl) + lug $(lit t.lit, lyn nyl) + == + (wig for) + :: + %rose + =/ hom ram + ?: (lte (lent hom) (sub edg tab)) + (rig hom) + :: + =* for q.p.tac + =* end r.p.tac + =* lit q.tac + =. lug + |- ^- wall + ?~ lit + ?~(end lug (rig end)) + %= ^$ + tac i.lit + tab (mod (add 2 tab) (mul 2 (div edg 3))) + lug $(lit t.lit) + == + ?~(for lug (wig for)) == + :: +rig: indent tape and cons with output stack :: - ++ din (mod (add 2 tab) (mul 2 (div edg 3))) - ++ fit (lte (lent ram) (sub edg tab)) ++ rig - |= hom/tape + |= 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)] + [(runt [tab ' '] hom) lug] + :: +wig: indent tape and cons with output stack + :: + :: joined with the top line if whitespace/indentation allow :: ++ wig - |= hom/tape + |= hom=tape ^- wall ?~ lug (rig hom) - =+ lin=(lent hom) - =+ wug=:(add 1 tab lin) + =/ wug :(add 1 tab (lent hom)) ?. =+ mir=i.lug - |- ?~ mir - | - ?|(=(0 wug) ?&(=(' ' i.mir) $(mir t.mir, wug (dec wug)))) + |- ^- ? + ?~ mir | + ?| =(0 wug) + ?&(=(' ' i.mir) $(mir t.mir, wug (dec wug))) + == (rig hom) :: ^ XX regular form? - [(runt [tab ' '] (weld hom `tape`[' ' (slag wug i.lug)])) t.lug] + :_ t.lug + %+ runt [tab ' '] + (weld hom `tape`[' ' (slag wug i.lug)]) -- -- ++ show :: XX deprecated! - |= vem/* + |= vem=* |^ ^- tank ?: ?=(@ vem) [%leaf (mesc (trip vem))] ?- vem - {s/~ c/*} + [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/*} + [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/*} + [s=%d c=*] (shop c.vem |=(a=@ ~(rud at a))) + [s=%k c=*] (tank c.vem) + [s=%h c=*] :+ %rose [['/' ~] ['/' ~] ~] =+ yol=((list @ta) c.vem) - (turn yol |=(a/@ta [%leaf (trip a)])) + (turn yol |=(a=@ta [%leaf (trip a)])) :: - {s/$l c/*} (shol c.vem) - {s/$o c/*} + [s=%l c=*] (shol c.vem) + [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/*} + [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/*} + [s=[%r p=@ q=@ r=@] c=*] :+ %rose :* p=(mesc (trip p.s.vem)) q=(mesc (trip q.s.vem)) @@ -5098,11 +4660,11 @@ ~ [^$(vem -.c.vem) $(c.vem +.c.vem)] :: - {s/$z c/*} $(vem [[%r %$ %$ %$] c.vem]) + [s=%z c=*] $(vem [[%r %$ %$ %$] c.vem]) * !! == ++ shep - |= {fom/@ gar/*} + |= [fom=@ gar=*] ^- tank =+ l=(met 3 fom) =+ i=0 @@ -5119,7 +4681,7 @@ (weld ~(ram re (show d -.gar)) $(i (add 2 i), gar +.gar)) :: ++ shop - |= {aug/* vel/$-(a/@ tape)} + |= [aug=* vel=$-(a=@ tape)] ^- tank ?: ?=(@ aug) [%leaf (vel aug)] @@ -5132,7 +4694,7 @@ [^$(aug -.aug) $(aug +.aug)] :: ++ shol - |= lim/* + |= lim=* :+ %rose [['.' ~] ~ ~] |- ^- (list tank) @@ -5140,26 +4702,26 @@ :_ $(lim +.lim) ?+ -.lim (show '#') ~ (show '$') - c/@ (show c.lim) - {%& $1} (show '.') - {%& c/@} + c=@ (show c.lim) + [%& %1] (show '.') + [%& c=@] [%leaf '+' ~(rud at c.lim)] :: - {%| @ ~} (show ',') - {%| n/@ ~ c/@} + [%| @ ~] (show ',') + [%| n=@ ~ c=@] [%leaf (weld (reap n.lim '^') ?~(c.lim "$" (trip c.lim)))] == -- :: :::: 4d: parsing (tracing) :: -++ last |= {zyc/hair naz/hair} :: farther trace +++ last |= [zyc=hair naz=hair] :: farther trace ^- hair ?: =(p.zyc p.naz) ?:((gth q.zyc q.naz) zyc naz) ?:((gth p.zyc p.naz) zyc naz) :: -++ lust |= {weq/char naz/hair} :: detect newline +++ lust |= [weq=char naz=hair] :: detect newline ^- hair ?:(=(`@`10 weq) [+(p.naz) 1] [p.naz +(q.naz)]) :: @@ -5167,11 +4729,11 @@ :: ++ bend :: conditional comp ~/ %bend - =+ raq=|*({a/* b/*} [~ u=[a b]]) + =+ raq=|*([a=* b=*] [~ u=[a b]]) |@ ++ $ ~/ %fun - |* {vex/edge sab/rule} + |* [vex=edge sab=rule] ?~ q.vex vex =+ yit=(sab q.u.q.vex) @@ -5186,11 +4748,11 @@ :: ++ comp ~/ %comp - =+ raq=|*({a/* b/*} [a b]) :: arbitrary compose + =+ raq=|*([a=* b=*] [a b]) :: arbitrary compose |@ ++ $ ~/ %fun - |* {vex/edge sab/rule} + |* [vex=edge sab=rule] ~! +< ?~ q.vex vex @@ -5201,16 +4763,16 @@ [p=yur q=[~ u=[p=(raq p.u.q.vex p.u.q.yit) q=q.u.q.yit]]] -- :: -++ fail |=(tub/nail [p=p.tub q=~]) :: never parse +++ fail |=(tub=nail [p=p.tub q=~]) :: never parse ++ glue :: add rule ~/ %glue - |* bus/rule + |* bus=rule ~/ %fun - |* {vex/edge sab/rule} + |* [vex=edge sab=rule] (plug vex ;~(pfix bus sab)) :: ++ less :: no first and second - |* {vex/edge sab/rule} + |* [vex=edge sab=rule] ?~ q.vex =+ roq=(sab) [p=(last p.vex p.roq) q=q.roq] @@ -5218,13 +4780,13 @@ :: ++ pfix :: discard first rule ~/ %pfix - |* sam={vex/edge sab/rule} + |* sam=[vex=edge sab=rule] %. sam - (comp |*({a/* b/*} b)) + (comp |*([a=* b=*] b)) :: ++ plug :: first then second ~/ %plug - |* {vex/edge sab/rule} + |* [vex=edge sab=rule] ?~ q.vex vex =+ yit=(sab q.u.q.vex) @@ -5235,14 +4797,14 @@ :: ++ pose :: first or second ~/ %pose - |* {vex/edge sab/rule} + |* [vex=edge sab=rule] ?~ q.vex =+ roq=(sab) [p=(last p.vex p.roq) q=q.roq] vex :: ++ simu :: first and second - |* {vex/edge sab/rule} + |* [vex=edge sab=rule] ?~ q.vex vex =+ roq=(sab) @@ -5250,35 +4812,35 @@ :: ++ sfix :: discard second rule ~/ %sfix - |* sam={vex/edge sab/rule} + |* sam=[vex=edge sab=rule] %. sam - (comp |*({a/* b/*} a)) + (comp |*([a=* b=*] a)) :: :::: 4f: parsing (rule builders) :: ++ bass :: leftmost base - |* {wuc/@ tyd/rule} + |* [wuc=@ tyd=rule] %+ cook - |= waq/(list @) + |= waq=(list @) %+ roll waq - =|({p/@ q/@} |.((add p (mul wuc q)))) + =|([p=@ q=@] |.((add p (mul wuc q)))) tyd :: ++ boss :: rightmost base - |* {wuc/@ tyd/rule} + |* [wuc=@ tyd=rule] %+ cook - |= waq/(list @) + |= waq=(list @) %+ reel waq - =|({p/@ q/@} |.((add p (mul wuc q)))) + =|([p=@ q=@] |.((add p (mul wuc q)))) tyd :: ++ cold :: replace w+ constant ~/ %cold - |* {cus/* sef/rule} + |* [cus=* sef=rule] ~/ %fun - |= tub/nail + |= tub=nail =+ vex=(sef tub) ?~ q.vex vex @@ -5286,9 +4848,9 @@ :: ++ cook :: apply gate ~/ %cook - |* {poq/gate sef/rule} + |* [poq=gate sef=rule] ~/ %fun - |= tub/nail + |= tub=nail =+ vex=(sef tub) ?~ q.vex vex @@ -5296,41 +4858,41 @@ :: ++ easy :: always parse ~/ %easy - |* huf/* + |* huf=* ~/ %fun - |= tub/nail + |= tub=nail ^- (like _huf) [p=p.tub q=[~ u=[p=huf q=tub]]] :: ++ fuss - |= {sic/@t non/@t} + |= [sic=@t non=@t] ;~(pose (cold %& (jest sic)) (cold %| (jest non))) :: ++ full :: has to fully parse - |* sef/rule - |= tub/nail + |* sef=rule + |= tub=nail =+ vex=(sef tub) ?~(q.vex vex ?:(=(~ q.q.u.q.vex) vex [p=p.vex q=~])) :: ++ funk :: add to tape first - |* {pre/tape sef/rule} - |= tub/nail + |* [pre=tape sef=rule] + |= tub=nail (sef p.tub (weld pre q.tub)) :: ++ here :: place-based apply ~/ %here - =+ [hez=|=({a/pint b/*} [a b]) sef=*rule] + =+ [hez=|=([a=pint b=*] [a b]) sef=*rule] |@ ++ $ ~/ %fun - |= tub/nail + |= 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]]] -- :: -++ inde |* sef/rule :: indentation block +++ inde |* sef=rule :: indentation block |= nail ^+ (sef) =+ [har tap]=[p q]:+< =+ lev=(fil 3 (dec q.har) ' ') @@ -5350,15 +4912,15 @@ (welp [`@t`10 (trip lev)] $(res +.res)) :: ++ ifix - |* {fel/{rule rule} hof/rule} + |* [fel=[rule rule] hof=rule] ~! +< ~! +<:-.fel ~! +<:+.fel ;~(pfix -.fel ;~(sfix hof +.fel)) :: ++ jest :: match a cord - |= daf/@t - |= tub/nail + |= daf=@t + |= tub=nail =+ fad=daf |- ^- (like @t) ?: =(`@`0 daf) @@ -5369,9 +4931,9 @@ :: ++ just :: XX redundant, jest ~/ %just :: match a char - |= daf/char + |= daf=char ~/ %fun - |= tub/nail + |= tub=nail ^- (like char) ?~ q.tub (fail tub) @@ -5380,35 +4942,35 @@ (next tub) :: ++ knee :: callbacks - =| {gar/* sef/_|.(*rule)} + =| [gar=* sef=_|.(*rule)] |@ ++ $ - |= tub/nail + |= tub=nail ^- (like _gar) ((sef) tub) -- :: ++ mask :: match char in set ~/ %mask - |= bud/(list char) + |= bud=(list char) ~/ %fun - |= tub/nail + |= tub=nail ^- (like char) ?~ q.tub (fail tub) - ?. (lien bud |=(a/char =(i.q.tub a))) + ?. (lien bud |=(a=char =(i.q.tub a))) (fail tub) (next tub) :: ++ more :: separated, * - |* {bus/rule fel/rule} + |* [bus=rule fel=rule] ;~(pose (most bus fel) (easy ~)) :: ++ most :: separated, + - |* {bus/rule fel/rule} + |* [bus=rule fel=rule] ;~(plug fel (star ;~(pfix bus fel))) :: ++ next :: consume a char - |= tub/nail + |= tub=nail ^- (like char) ?~ q.tub (fail tub) @@ -5416,7 +4978,7 @@ [zac [~ i.q.tub [zac t.q.tub]]] :: ++ perk :: parse cube fork - |* a/(pole @tas) + |* a=(pole @tas) ?~ a fail ;~ pose (cold -.a (jest -.a)) @@ -5424,16 +4986,16 @@ == :: ++ pick :: rule for ++each - |* {a/rule b/rule} + |* [a=rule b=rule] ;~ pose (stag %& a) (stag %| b) == -++ plus |*(fel/rule ;~(plug fel (star fel))) :: -++ punt |*({a/rule} ;~(pose (stag ~ a) (easy ~))) :: +++ plus |*(fel=rule ;~(plug fel (star fel))) :: +++ punt |*([a=rule] ;~(pose (stag ~ a) (easy ~))) :: ++ sear :: conditional cook - |* {pyq/$-(* (unit)) sef/rule} - |= tub/nail + |* [pyq=$-(* (unit)) sef=rule] + |= tub=nail =+ vex=(sef tub) ?~ q.vex vex @@ -5444,9 +5006,9 @@ :: ++ shim :: match char in range ~/ %shim - |= {les/@ mos/@} + |= [les=@ mos=@] ~/ %fun - |= tub/nail + |= tub=nail ^- (like char) ?~ q.tub (fail tub) @@ -5456,16 +5018,16 @@ :: ++ stag :: add a label ~/ %stag - |* {gob/* sef/rule} + |* [gob=* sef=rule] ~/ %fun - |= tub/nail + |= tub=nail =+ vex=(sef tub) ?~ q.vex vex [p=p.vex q=[~ u=[p=[gob p.u.q.vex] q=q.u.q.vex]]] :: ++ stet :: - |* leh/(list {?(@ {@ @}) rule}) + |* leh=(list [?(@ [@ @]) rule]) |- ?~ leh ~ @@ -5473,9 +5035,9 @@ :: ++ stew :: switch by first char ~/ %stew - |* leh/(list {p/?(@ {@ @}) q/rule}) :: char+range keys + |* leh=(list [p=?(@ [@ @]) q=rule]) :: char+range keys =+ ^= wor :: range complete lth - |= {ort/?(@ {@ @}) wan/?(@ {@ @})} + |= [ort=?(@ [@ @]) wan=?(@ [@ @])] ?@ ort ?@(wan (lth ort wan) (lth ort -.wan)) ?@(wan (lth +.ort wan) (lth +.ort -.wan)) @@ -5500,7 +5062,7 @@ [n.yal l.yal nuc] [n.nuc [n.yal l.yal l.nuc] r.nuc] ~% %fun ..^$ ~ - |= tub/nail + |= tub=nail ?~ q.tub (fail tub) |- @@ -5516,13 +5078,13 @@ $(hel r.hel) :: ++ slug :: - |* raq/_=>(~ |*({a/* b/*} [a b])) - |* {bus/rule fel/rule} + |* raq=_=>(~ |*([a=* b=*] [a b])) + |* [bus=rule fel=rule] ;~((comp raq) fel (stir +<+.raq raq ;~(pfix bus fel))) :: ++ star :: 0 or more times - |* fel/rule - (stir `(list _(wonk *fel))`~ |*({a/* b/*} [a b]) fel) + |* fel=rule + (stir `(list _(wonk *fel))`~ |*([a=* b=*] [a b]) fel) :: ++ stir ~/ %stir @@ -5553,8 +5115,8 @@ :: ++ stun :: parse several times ~/ %stun - |* {lig/{@ @} fel/rule} - |= tub/nail + |* [lig=[@ @] fel=rule] + |= tub=nail ^- (like (list _(wonk (fel)))) ?: =(0 +.lig) [p.tub [~ ~ tub]] @@ -5574,19 +5136,19 @@ :: :::: 4g: parsing (outside caller) :: -++ rash |*({naf/@ sab/rule} (scan (trip naf) sab)) -++ rose |* {los/tape sab/rule} +++ rash |*([naf=@ sab=rule] (scan (trip naf) sab)) +++ rose |* [los=tape sab=rule] =+ vex=(sab [[1 1] los]) =+ len=(lent los) ?. =(+(len) q.p.vex) [%| p=(dec q.p.vex)] ?~ q.vex [%& p=~] [%& p=[~ u=p.u.q.vex]] -++ rush |*({naf/@ sab/rule} (rust (trip naf) sab)) -++ rust |* {los/tape sab/rule} +++ rush |*([naf=@ sab=rule] (rust (trip naf) sab)) +++ rust |* [los=tape sab=rule] =+ vex=((full sab) [[1 1] los]) ?~(q.vex ~ [~ u=p.u.q.vex]) -++ scan |* {los/tape sab/rule} +++ scan |* [los=tape sab=rule] =+ vex=((full sab) [[1 1] los]) ?~ q.vex ~_ (show [%m '{%d %d}'] p.p.vex q.p.vex ~) @@ -5629,26 +5191,6 @@ ++ wut (just '?') :: wut, what? ++ zap (just '!') :: zap! bang! crash!! :: -++ ban (just '>') :: XX deprecated, use gar -++ bat (just '\\') :: XX deprecated, use bas -++ bus (just '$') :: XX deprecated, use buc -++ lac (just '[') :: XX deprecated, use sel -++ leb (just '{') :: XX deprecated, use kel -++ led (just '<') :: XX deprecated, use gal -++ lit (just '(') :: XX deprecated, use pal -++ lob (just '{') :: XX deprecated, use kel -++ net (just '/') :: XX deprecated, use fas -++ pad (just '&') :: XX deprecated, use pam -++ rac (just ']') :: XX deprecated, use ser -++ reb (just '}') :: XX deprecated, use ker -++ rit (just ')') :: XX deprecated, use par -++ rob (just '}') :: XX deprecated, use ker -++ say (just '\'') :: XX deprecated, use soq -++ tec (just '`') :: XX deprecated, use tic -++ toc (just '"') :: XX deprecated, use doq -++ vat (just '@') :: XX deprecated, use pat -++ yel (just '"') :: XX deprecated, use doq -:: :::: 4i: parsing (useful idioms) :: ++ alf ;~(pose low hig) :: alphabetic @@ -5656,10 +5198,10 @@ ++ alp ;~(pose low hig nud hep) :: alphanumeric and - ++ bet ;~(pose (cold 2 hep) (cold 3 lus)) :: axis syntax - + ++ bin (bass 2 (most gon but)) :: binary to atom -++ but (cook |=(a/@ (sub a '0')) (shim '0' '1')) :: binary digit -++ cit (cook |=(a/@ (sub a '0')) (shim '0' '7')) :: octal digit +++ but (cook |=(a=@ (sub a '0')) (shim '0' '1')) :: binary digit +++ cit (cook |=(a=@ (sub a '0')) (shim '0' '7')) :: octal digit ++ dem (bass 10 (most gon dit)) :: decimal to atom -++ dit (cook |=(a/@ (sub a '0')) (shim '0' '9')) :: decimal digit +++ dit (cook |=(a=@ (sub a '0')) (shim '0' '9')) :: decimal digit ++ dog ;~(plug dot gay) :: . number separator ++ dof ;~(plug hep gay) :: - @q separator ++ doh ;~(plug ;~(plug hep hep) gay) :: -- phon separator @@ -5680,11 +5222,11 @@ ++ hig (shim 'A' 'Z') :: uppercase ++ hit ;~ pose :: hex digits dit - (cook |=(a/char (sub a 87)) (shim 'a' 'f')) - (cook |=(a/char (sub a 55)) (shim 'A' 'F')) + (cook |=(a=char (sub a 87)) (shim 'a' 'f')) + (cook |=(a=char (sub a 55)) (shim 'A' 'F')) == ++ iny :: indentation block - |* sef/rule + |* sef=rule |= nail ^+ (sef) =+ [har tap]=[p q]:+< =+ lev=(fil 3 (dec q.har) ' ') @@ -5705,7 +5247,7 @@ :: ++ low (shim 'a' 'z') :: lowercase ++ mes %+ cook :: hexbyte - |=({a/@ b/@} (add (mul 16 a) b)) + |=([a=@ b=@] (add (mul 16 a) b)) ;~(plug hit hit) ++ nix (boss 256 (star ;~(pose aln cab))) :: ++ nud (shim '0' '9') :: numeric @@ -5733,18 +5275,18 @@ ++ soz ;~(plug soq soq soq) :: delimiting ''' ++ sym :: symbol %+ cook - |=(a/tape (rap 3 ^-((list @) a))) + |=(a=tape (rap 3 ^-((list @) a))) ;~(plug low (star ;~(pose nud low hep))) :: ++ mixed-case-symbol %+ cook - |=(a/tape (rap 3 ^-((list @) a))) + |=(a=tape (rap 3 ^-((list @) a))) ;~(plug alf (star alp)) :: -++ ven ;~ (comp |=({a/@ b/@} (peg a b))) :: +>- axis syntax +++ ven ;~ (comp |=([a=@ b=@] (peg a b))) :: +>- axis syntax bet =+ hom=`?`| - |= tub/nail + |= tub=nail ^- (like @) =+ vex=?:(hom (bet tub) (gul tub)) ?~ q.vex @@ -5755,9 +5297,9 @@ == ++ vit :: base64 digit ;~ 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')) + (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 '+')) == @@ -5772,9 +5314,9 @@ ++ ab |% ++ bix (bass 16 (stun [2 2] six)) - ++ fem (sear |=(a/@ (cha:fa a)) aln) + ++ fem (sear |=(a=@ (cha:fa a)) aln) ++ haf (bass 256 ;~(plug tep tiq (easy ~))) - ++ hef %+ sear |=(a/@ ?:(=(a 0) ~ (some a))) + ++ hef %+ sear |=(a=@ ?:(=(a 0) ~ (some a))) %+ bass 256 ;~(plug tip tiq (easy ~)) ++ hif (bass 256 ;~(plug tip tiq (easy ~))) @@ -5790,37 +5332,37 @@ ++ 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')) + ++ 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')) - ++ sid (cook |=(a/@ (sub a '0')) (shim '0' '9')) + ++ sib (cook |=(a=@ (sub a '0')) (shim '0' '1')) + ++ 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')) + ++ 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')) + (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')) + ++ sox (cook |=(a=@ (sub a 87)) (shim 'a' 'f')) ++ ted (bass 10 ;~(plug sed (stun [0 2] sid))) - ++ tep (sear |=(a/@ ?:(=(a 'doz') ~ (ins:po a))) til) - ++ tip (sear |=(a/@ (ins:po a)) til) - ++ tiq (sear |=(a/@ (ind:po a)) til) + ++ tep (sear |=(a=@ ?:(=(a 'doz') ~ (ins:po a))) til) + ++ 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))) + |=(a=tape (rap 3 ^-((list @) a))) (star ;~(pose nud low hep dot sig cab)) ++ urt %+ cook - |=(a/tape (rap 3 ^-((list @) a))) + |=(a=tape (rap 3 ^-((list @) a))) (star ;~(pose nud low hep dot sig)) ++ urx %+ cook - |=(a/tape (rap 3 ^-((list @) a))) + |=(a=tape (rap 3 ^-((list @) a))) %- star ;~ pose nud @@ -5835,7 +5377,7 @@ -- ++ ag |% - ++ ape |*(fel/rule ;~(pose (cold 0 (just '0')) fel)) + ++ ape |*(fel=rule ;~(pose (cold 0 (just '0')) fel)) ++ bay (ape (bass 16 ;~(plug qeb:ab (star ;~(pfix dog qib:ab))))) ++ bip =+ tod=(ape qex:ab) (bass 0x1.0000 ;~(plug tod (stun [7 7] ;~(pfix dog tod)))) @@ -5866,7 +5408,7 @@ ++ mot ;~ pose ;~ pfix (just '1') - (cook |=(a/@ (add 10 (sub a '0'))) (shim '0' '2')) + (cook |=(a=@ (add 10 (sub a '0'))) (shim '0' '2')) == sed:ab == @@ -5875,13 +5417,13 @@ ++ wiz (ape (bass 0x4000.0000 ;~(plug pew:ab (star ;~(pfix dog piw:ab))))) -- ++ mu - |_ {top/@ bot/@} + |_ [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) -- ++ ne - |_ tig/@ + |_ tig=@ ++ c (cut 3 [tig 1] key:fa) ++ d (add tig '0') ++ x ?:((gte tig 10) (add tig 87) d) @@ -5893,14 +5435,14 @@ :: ++ co ~% %co ..co ~ - =< |_ lot/coin - ++ rear |=(rom/tape =>(.(rep rom) rend)) + =< |_ lot=coin + ++ rear |=(rom=tape rend(rep rom)) ++ rent `@ta`(rap 3 rend) ++ rend ^- tape - ?: ?=($blob -.lot) + ?: ?=(%blob -.lot) ['~' '0' ((v-co 1) (jam p.lot))] - ?: ?=($many -.lot) + ?: ?=(%many -.lot) :- '.' |- ^- tape ?~ p.lot @@ -5909,117 +5451,111 @@ =+ [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))) rep)] - $d + %c ['~' '-' (weld (rip 3 (wood (tuft q.p.lot))) rep)] + %d ?+ hay (z-co q.p.lot) - $a + %a =+ yod=(yore q.p.lot) - => ^+(. .(rep ?~(f.t.yod rep ['.' (s-co f.t.yod)]))) - => ^+ . - %= . - rep - ?: &(=(~ f.t.yod) =(0 h.t.yod) =(0 m.t.yod) =(0 s.t.yod)) - rep - => .(rep ['.' (y-co s.t.yod)]) - => .(rep ['.' (y-co m.t.yod)]) - ['.' '.' (y-co h.t.yod)] - == - => .(rep ['.' (a-co d.t.yod)]) - => .(rep ['.' (a-co m.yod)]) - => .(rep ?:(a.yod rep ['-' rep])) + =? rep ?=(^ f.t.yod) ['.' (s-co f.t.yod)] + =? rep ?& ?=(^ f.t.yod) + !|(=(0 h.t.yod) =(0 m.t.yod) =(0 s.t.yod)) + == + =. rep ['.' (y-co s.t.yod)] + =. rep ['.' (y-co m.t.yod)] + ['.' '.' (y-co h.t.yod)] + =. rep ['.' (a-co d.t.yod)] + =. rep ['.' (a-co m.yod)] + =? rep !a.yod ['-' rep] ['~' (a-co y.yod)] :: - $r + %r =+ yug=(yell q.p.lot) - => ^+(. .(rep ?~(f.yug rep ['.' (s-co f.yug)]))) + =? rep ?=(^ f.yug) ['.' (s-co f.yug)] :- '~' ?: &(=(0 d.yug) =(0 m.yug) =(0 h.yug) =(0 s.yug)) ['s' '0' rep] - => ^+(. ?:(=(0 s.yug) . .(rep ['.' 's' (a-co s.yug)]))) - => ^+(. ?:(=(0 m.yug) . .(rep ['.' 'm' (a-co m.yug)]))) - => ^+(. ?:(=(0 h.yug) . .(rep ['.' 'h' (a-co h.yug)]))) - => ^+(. ?:(=(0 d.yug) . .(rep ['.' 'd' (a-co d.yug)]))) + =? rep !=(0 s.yug) ['.' 's' (a-co s.yug)] + =? rep !=(0 m.yug) ['.' 'm' (a-co m.yug)] + =? rep !=(0 h.yug) ['.' 'h' (a-co h.yug)] + =? rep !=(0 d.yug) ['.' 'd' (a-co d.yug)] +.rep == :: - $f + %f ?: =(& q.p.lot) ['.' 'y' rep] ?:(=(| q.p.lot) ['.' 'n' rep] (z-co q.p.lot)) :: - $n ['~' rep] - $i + %n ['~' rep] + %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) + %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 + %p =+ sxz=(fein:ob q.p.lot) =+ dyx=(met 3 sxz) :- '~' ?: (lte dyx 1) (weld (trip (tod:po sxz)) rep) =+ dyy=(met 4 sxz) - =+ imp=*@ + =| imp=@ud |- ^- tape ?: =(imp dyy) rep %= $ - sxz (rsh 4 1 sxz) - imp +(imp) - rep - =+ log=(end 4 1 sxz) - ;: weld - (trip (tos:po (rsh 3 1 log))) - (trip (tod:po (end 3 1 log))) - ?:(=((mod imp 4) 0) ?:(=(imp 0) "" "--") "-") - rep - == - == + imp +(imp) + rep =/ log (cut 4 [imp 1] sxz) + ;: weld + (trip (tos:po (rsh 3 1 log))) + (trip (tod:po (end 3 1 log))) + ?:(=((mod imp 4) 0) ?:(=(imp 0) "" "--") "-") + rep + == == :: - $q - =* val q.p.lot + %q :+ '.' '~' - =- =.(rep (weld - rep) rep) - %- tail - %+ roll ?:(=(0 val) ~[0] (rip 3 val)) + =; res=(pair ? tape) + (weld q.res rep) + %+ roll + =* val q.p.lot + ?:(=(0 val) ~[0] (rip 3 val)) |= [q=@ s=? r=tape] :- !s - ;: weld - (trip (?:(s tod:po tos:po) q)) - ?:(&(s !=(r "")) "-" ~) - r - == + %+ weld + (trip (?:(s tod:po tos:po) q)) + ?.(&(s !=(r "")) r ['-' r]) :: - $r + %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))] + %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 - ?: ?=($c hay) + %u + ?: ?=(%c hay) %+ welp ['0' 'c' (reap (pad:fa q.p.lot) '1')] (c-co (enc:fa q.p.lot)) - =- (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)] - $i [['0' 'i' ~] ((d-co 1) 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)] + :: + =; gam=(pair tape tape) + (weld p.gam ?:(=(0 q.p.lot) `tape`['0' ~] q.gam)) + ?+ 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)] + %i [['0' 'i' ~] ((d-co 1) 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 + %s %+ weld ?:((syn:si q.p.lot) "--" "-") $(yed 'u', q.p.lot (abs:si q.p.lot)) :: - $t + %t ?: =('a' hay) ?: =('s' (cut 3 [2 1] p.p.lot)) (weld (rip 3 q.p.lot) rep) @@ -6027,62 +5563,93 @@ ['~' '~' (weld (rip 3 (wood q.p.lot)) rep)] == -- - =+ rep=*tape + =| rep=tape =< |% - ++ a-co |=(dat/@ ((d-co 1) dat)) - ++ c-co (em-co [58 1] |=({? b/@ c/tape} [~(c ne b) c])) - ++ d-co |=(min/@ (em-co [10 min] |=({? b/@ c/tape} [~(d ne b) c]))) + :: rendering idioms, output zero-padded to minimum lengths + :: + :: +a-co: decimal + :: +c-co: base58check + :: +d-co: decimal, takes minimum output digits + :: +r-co: floating point + :: +s-co: list of '.'-prefixed base16, 4 digit minimum + :: +v-co: base32, takes minimum output digits + :: +w-co: base64, takes minimum output digits + :: +x-co: base16, takes minimum output digits + :: +y-co: decimal, 2 digit minimum + :: +z-co: '0x'-prefixed base16 + :: + ++ a-co |=(dat=@ ((d-co 1) dat)) + ++ c-co (em-co [58 1] |=([? b=@ c=tape] [~(c ne b) c])) + ++ d-co |=(min=@ (em-co [10 min] |=([? b=@ c=tape] [~(d ne b) c]))) + :: ++ r-co - |= a/dn - ?: ?=({$i *} a) (weld ?:(s.a "inf" "-inf") rep) - ?: ?=({$n *} a) (weld "nan" rep) - =+ ^= e %+ ed-co [10 1] - |= {a/? b/@ c/tape} - ?: a [~(d ne b) '.' c] - [~(d ne b) c] - =+ ^= f - =>(.(rep ~) (e a.a)) - =. e.a (sum:si e.a (sun:si (dec +.f))) - =+ b=?:((syn:si e.a) "e" "e-") - => .(rep ?~(e.a rep (weld b ((d-co 1) (abs:si e.a))))) - => .(rep (weld -.f rep)) - ?:(s.a rep ['-' rep]) + |= a=dn + ?: ?=([%i *] a) (weld ?:(s.a "inf" "-inf") rep) + ?: ?=([%n *] a) (weld "nan" rep) + =/ f=(pair tape @) + %. a.a + %+ ed-co(rep ~) [10 1] + |=([a=? b=@ c=tape] [~(d ne b) ?.(a c ['.' c])]) + =. e.a (sum:si e.a (sun:si (dec q.f))) + =/ res + %+ weld p.f + ?~ e.a + rep + %+ weld ?:((syn:si e.a) "e" "e-") + ((d-co 1) (abs:si e.a)) + ?:(s.a res ['-' res]) :: ++ s-co - |= esc/(list @) ^- tape - ?~ esc - rep - :- '.' - =>(.(rep $(esc t.esc)) ((x-co 4) i.esc)) + |= esc=(list @) ^- tape + ?~ esc rep + ['.' =>(.(rep $(esc t.esc)) ((x-co 4) i.esc))] :: - ++ v-co |=(min/@ (em-co [32 min] |=({? b/@ c/tape} [~(v ne b) c]))) - ++ w-co |=(min/@ (em-co [64 min] |=({? b/@ c/tape} [~(w ne b) c]))) - ++ 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)]) + ++ v-co |=(min=@ (em-co [32 min] |=([? b=@ c=tape] [~(v ne b) c]))) + ++ w-co |=(min=@ (em-co [64 min] |=([? b=@ c=tape] [~(w ne b) c]))) + ++ 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: format in numeric base + :: + :: in .bas, format .min digits of .hol with .par + :: + :: - .hol is processed least-significant digit first + :: - all available digits in .hol will be processed, but + :: .min digits can exceed the number available in .hol + :: - .par handles all accumulated output on each call, + :: and can edit it, prepend or append digits, &c + :: - until .hol is exhausted, .par's sample is [| digit output], + :: subsequently, it's [& 0 output] + :: ++ em-co - |= {{bas/@ min/@} par/$-({? @ tape} tape)} - |= hol/@ + |= [[bas=@ min=@] par=$-([? @ tape] tape)] + |= hol=@ ^- tape ?: &(=(0 hol) =(0 min)) rep - =+ [rad=(mod hol bas) dar=(div hol bas)] + =/ [dar=@ rad=@] (dvr hol bas) %= $ min ?:(=(0 min) 0 (dec min)) hol dar rep (par =(0 dar) rad rep) == :: + :: +ed-co: format in numeric base, with output length + :: + :: - like +em-co, but .par's sample will be [| digit output] + :: on the first call, regardless of the available digits in .hol + :: - used only for @r* floats + :: ++ ed-co - |= {{bas/@ min/@} par/$-({? @ tape} tape)} - =+ [fir=& cou=0] - |= hol/@ - ^- {tape @} + |= [[bas=@ min=@] par=$-([? @ tape] tape)] + =| [fir=? cou=@ud] + |= hol=@ + ^- [tape @] ?: &(=(0 hol) =(0 min)) [rep cou] - =+ [rad=(mod hol bas) dar=(div hol bas)] + =/ [dar=@ rad=@] (dvr hol bas) %= $ min ?:(=(0 min) 0 (dec min)) hol dar @@ -6091,28 +5658,46 @@ cou +(cou) == :: + :: +ox-co: format '.'-separated digit sequences in numeric base + :: + :: in .bas, format each digit of .hol with .dug, + :: with '.' separators every .gop digits. + :: + :: - .hol is processed least-significant digit first + :: - .dug handles individual digits, output is prepended + :: - every segment but the last is zero-padded to .gop + :: ++ ox-co - |= {{bas/@ gop/@} dug/$-(@ @)} + |= [[bas=@ gop=@] dug=$-(@ @)] %+ em-co - [|-(?:(=(0 gop) 1 (mul bas $(gop (dec gop))))) 0] - |= {top/? seg/@ res/tape} + [(pow bas gop) 0] + |= [top=? seg=@ res=tape] %+ weld ?:(top ~ `tape`['.' ~]) %. seg %+ em-co(rep res) [bas ?:(top 0 gop)] - |=({? b/@ c/tape} [(dug b) c]) + |=([? b=@ c=tape] [(dug b) c]) + :: + :: +ro-co: format '.'-prefixed bloqs in numeric base + :: + :: in .bas, for .buz bloqs 0 to .dop, format at least one + :: digit of .hol, prefixed with '.' + :: + :: - used only for @i* addresses :: ++ ro-co - |= {{buz/@ bas/@ dop/@} dug/$-(@ @)} - |= hol/@ + |= [[buz=@ bas=@ dop=@] dug=$-(@ @)] + |= hol=@ ^- tape ?: =(0 dop) rep - => .(rep $(dop (dec dop))) :- '.' - %- (em-co [bas 1] |=({? b/@ c/tape} [(dug b) c])) - [(cut buz [(dec dop) 1] hol)] + =/ pod (dec dop) + %. (cut buz [pod 1] hol) + %+ em-co(rep $(dop pod)) + [bas 1] + |=([? b=@ c=tape] [(dug b) c]) -- :: :::: 4l: atom parsing @@ -6138,19 +5723,19 @@ ++ crub ~+ ;~ pose - (cook |=(det/date `dime`[%da (year det)]) when) + (cook |=(det=date `dime`[%da (year det)]) when) :: %+ cook - |= {a/(list {p/?($d $h $m $s) q/@}) b/(list @)} + |= [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)) + %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 @@ -6170,11 +5755,11 @@ ;~(pfix hep (stag %c (cook taft urx:ab))) == ++ nuck - ~/ %nuck |= a/nail %. a + ~/ %nuck |= a=nail %. a %+ knee *coin |. ~+ %- stew ^. stet ^. limo - :~ :- ['a' 'z'] (cook |=(a/@ta [%$ %tas a]) sym) + :~ :- ['a' 'z'] (cook |=(a=@ta [%$ %tas a]) sym) :- ['0' '9'] (stag %$ bisk) :- '-' (stag %$ tash) :- '.' ;~(pfix dot perd) @@ -6182,7 +5767,7 @@ == ++ nusk ~+ - :(sear |=(a/@ta (rush a nuck)) wick urt:ab) + :(sear |=(a=@ta (rush a nuck)) wick urt:ab) ++ perd ~+ ;~ pose @@ -6244,7 +5829,7 @@ ++ royl-cell |= rn ^- dn - ?. ?=({$d *} +<) +< + ?. ?=([%d *] +<) +< =+ ^= h (dif:si (new:si f.b i.b) (sun:si d.b)) [%d a h (add (mul c.b (pow 10 d.b)) e.b)] @@ -6252,13 +5837,13 @@ ++ tash ~+ =+ ^= neg - |= {syn/? mol/dime} ^- dime + |= [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)) + (cook |=(a=dime (neg | a)) bisk) + ;~(pfix hep (cook |=(a=dime (neg & a)) bisk)) == == :: @@ -6279,7 +5864,7 @@ ~+ ;~ plug %+ cook - |=({a/@ b/?} [b a]) + |=([a=@ b=?] [b a]) ;~(plug dim:ag ;~(pose (cold | hep) (easy &))) ;~(pfix dot mot:ag) :: month ;~(pfix dot dip:ag) :: day @@ -6312,21 +5897,21 @@ :: ++ scot ~/ %scot - |=(mol/dime ~(rent co %$ mol)) + |=(mol=dime ~(rent co %$ mol)) ++ scow ~/ %scow - |=(mol/dime ~(rend co %$ mol)) -++ slat |=(mod/@tas |=(txt/@ta (slaw mod txt))) -++ slav |=({mod/@tas txt/@ta} (need (slaw mod txt))) + |=(mol=dime ~(rend co %$ mol)) +++ slat |=(mod=@tas |=(txt=@ta (slaw mod txt))) +++ slav |=([mod=@tas txt=@ta] (need (slaw mod txt))) ++ slaw ~/ %slaw - |= {mod/@tas txt/@ta} + |= [mod=@tas txt=@ta] ^- (unit @) ?+ mod :: slow fallback case to the full slay :: =+ con=(slay txt) - ?.(&(?=({~ $$ @ @} con) =(p.p.u.con mod)) ~ [~ q.p.u.con]) + ?.(&(?=([~ %$ @ @] con) =(p.p.u.con mod)) ~ [~ q.p.u.con]) :: %da (rush txt ;~(pfix sig (cook year when:so))) @@ -6351,7 +5936,7 @@ == :: ++ slay - |= txt/@ta ^- (unit coin) + |= txt=@ta ^- (unit coin) =+ ^= vex ?: (gth 0x7fff.ffff txt) :: XX petty cache ~+ ((full nuck:so) [[1 1] (trip txt)]) @@ -6361,208 +5946,306 @@ [~ p.u.q.vex] :: ++ smyt :: pretty print path - |= bon/path ^- tank + |= bon=path ^- tank :+ %rose [['/' ~] ['/' ~] ~] - (turn bon |=(a/@ [%leaf (trip a)])) + (turn bon |=(a=@ [%leaf (trip a)])) :: -++ spat |=(pax/path (crip (spud pax))) :: render path to cord -++ spud |=(pax/path ~(ram re (smyt pax))) :: render path to tape +++ spat |=(pax=path (crip (spud pax))) :: render path to cord +++ spud |=(pax=path ~(ram re (smyt pax))) :: render path to tape ++ stab :: parse cord to path =+ fel=;~(pfix fas (more fas urs:ab)) - |=(zep/@t `path`(rash zep fel)) + |=(zep=@t `path`(rash zep fel)) :: :::: 4n: virtualization :: +:: +mack: untyped, scry-less, unitary virtualization +:: ++ mack - |= {sub/* fol/*} + |= [sub=* fol=*] ^- (unit) - =+ ton=(mink [sub fol] |=({* *} ~)) - ?.(?=({$0 *} ton) ~ [~ p.ton]) + =/ ton (mink [sub fol] |~(^ ~)) + ?.(?=(%0 -.ton) ~ `product.ton) +:: +mink: raw virtual nock :: ++ mink !. ~/ %mink - |= {{sub/* fol/*} gul/$-({* *} (unit (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 + |= $: [subject=* formula=*] + scry=$-(^ (unit (unit))) + == + =| trace=(list [@ta *]) + |^ ^- tone + ?+ formula [%2 trace] + [^ *] + =/ head $(formula -.formula) + ?. ?=(%0 -.head) head + =/ tail $(formula +.formula) + ?. ?=(%0 -.tail) tail + [%0 product.head product.tail] + :: + [%0 axis=@] + =/ part (frag axis.formula subject) + ?~ part [%2 trace] + [%0 u.part] + :: + [%1 constant=*] + [%0 constant.formula] + :: + [%2 subject=* formula=*] + =/ subject $(formula subject.formula) + ?. ?=(%0 -.subject) subject + =/ formula $(formula formula.formula) + ?. ?=(%0 -.formula) formula + %= $ + subject product.subject + formula product.formula + == + :: + [%3 argument=*] + =/ argument $(formula argument.formula) + ?. ?=(%0 -.argument) argument + [%0 .?(product.argument)] + :: + [%4 argument=*] + =/ argument $(formula argument.formula) + ?. ?=(%0 -.argument) argument + ?^ product.argument [%2 trace] + [%0 .+(product.argument)] + :: + [%5 a=* b=*] + =/ a $(formula a.formula) + ?. ?=(%0 -.a) a + =/ b $(formula b.formula) + ?. ?=(%0 -.b) b + [%0 =(product.a product.b)] + :: + [%6 test=* yes=* no=*] + =/ result $(formula test.formula) + ?. ?=(%0 -.result) result + ?+ product.result + [%2 trace] + %& $(formula yes.formula) + %| $(formula no.formula) + == + :: + [%7 subject=* next=*] + =/ subject $(formula subject.formula) + ?. ?=(%0 -.subject) subject + %= $ + subject product.subject + formula next.formula + == + :: + [%8 head=* next=*] + =/ head $(formula head.formula) + ?. ?=(%0 -.head) head + %= $ + subject [product.head subject] + formula next.formula + == + :: + [%9 axis=@ core=*] + =/ core $(formula core.formula) + ?. ?=(%0 -.core) core + =/ arm (frag axis.formula product.core) + ?~ arm [%2 trace] + %= $ + subject product.core + formula u.arm + == + :: + [%10 [axis=@ value=*] target=*] + ?: =(0 axis.formula) [%2 trace] + =/ target $(formula target.formula) + ?. ?=(%0 -.target) target + =/ value $(formula value.formula) + ?. ?=(%0 -.value) value + =/ mutant=(unit *) + (edit axis.formula product.target product.value) + ?~ mutant [%2 trace] + [%0 u.mutant] + :: + [%11 tag=@ next=*] + =/ next $(formula next.formula) + ?. ?=(%0 -.next) next + :- %0 + .* subject + [11 tag.formula 1 product.next] + :: + [%11 [tag=@ clue=*] next=*] + =/ clue $(formula clue.formula) + ?. ?=(%0 -.clue) clue + =/ next + =? trace + ?=(?(%hunk %hand %lose %mean %spot) tag.formula) + [[tag.formula product.clue] trace] + $(formula next.formula) + ?. ?=(%0 -.next) next + :- %0 + .* subject + [11 [tag.formula 1 product.clue] 1 product.next] + :: + [%12 ref=* path=*] + =/ ref $(formula ref.formula) + ?. ?=(%0 -.ref) ref + =/ path $(formula path.formula) + ?. ?=(%0 -.path) path + =/ result (scry product.ref product.path) + ?~ result + [%1 product.path] + ?~ u.result + [%2 [%hunk product.ref product.path] trace] + [%0 u.u.result] + == + :: + ++ frag + |= [axis=@ noun=*] + ^- (unit) + ?: =(0 axis) ~ + |- ^- (unit) + ?: =(1 axis) `noun + ?@ noun ~ + =/ pick (cap axis) + %= $ + axis (mas axis) + noun ?-(pick %2 -.noun, %3 +.noun) == - ?+ fol - [%2 tax] :: - {$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/{^ *}} - =+ ben=$(fol b.fol) - ?. ?=($0 -.ben) ben - ?>(?=(^ p.ben) $(sub -.p.ben, fol +.p.ben)) - ::?>(?=(^ p.ben) $([sub 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/* c/*} - =+ hed=$(fol b.fol) - ?. ?=($0 -.hed) hed - =+ tal=$(fol c.fol) - ?. ?=($0 -.tal) tal - [%0 =(p.hed p.tal)] - :: - {$6 b/* c/* d/*} - =+ ben=$(fol b.fol) - ?. ?=($0 -.ben) ben - ?: =(& p.ben) $(fol c.fol) - ?: =(| p.ben) $(fol d.fol) - [%2 tax] - :: - {$7 b/* c/*} - =+ ben=$(fol b.fol) - ?. ?=($0 -.ben) ben - $(sub p.ben, fol c.fol) - :: - {$8 b/* c/*} - =+ ben=$(fol b.fol) - ?. ?=($0 -.ben) ben - $(sub [p.ben sub], fol c.fol) - :: - {$9 b/* c/*} - =+ ben=$(fol c.fol) - ?. ?=($0 -.ben) ben - =. sub p.ben - =+ lof=$(fol [0 b.fol]) - ?. ?=($0 -.lof) lof - $(fol p.lof) - :: - {$10 {b/@ c/*} d/*} - =+ bog=$(fol d.fol) - ?. ?=({$0 *} bog) bog - =+ lot=$(fol c.fol) - ?. ?=({$0 *} lot) lot - =+ [axe=b.fol big=p.bog lit=p.lot] - ^- tone - :- %0 - |- ^- p/* - ?: =(2 axe) [lit +.big] - ?: =(3 axe) [-.big lit] - =+ mor=(mas axe) - ?: =(2 (cap axe)) - [$(big -.big, axe mor) +.big] - [-.big $(big +.big, axe mor)] - :: - {$11 @ c/*} $(fol c.fol) - {$11 {b/* c/*} d/*} - =+ ben=$(fol c.fol) - ?. ?=($0 -.ben) ben - ?: ?=(?($hunk $hand $lose $mean $spot) b.fol) - $(fol d.fol, tax [[b.fol p.ben] tax]) - $(fol d.fol) - :: - {$12 b/* c/*} - =+ ref=$(fol b.fol) - =+ ben=$(fol c.fol) - ?. ?=($0 -.ref) ref - ?. ?=($0 -.ben) ben - =+ val=(gul p.ref p.ben) - ?~(val [%1 p.ben ~] ?~(u.val [%2 [[%hunk (mush p.ben)] tax]] [%0 u.u.val])) - == + ++ edit + |= [axis=@ target=* value=*] + ^- (unit) + ?: =(1 axis) `value + ?@ target ~ + =/ pick (cap axis) + =/ mutant + %= $ + axis (mas axis) + target ?-(pick %2 -.target, %3 +.target) + == + ?~ mutant ~ + ?- pick + %2 `[u.mutant +.target] + %3 `[-.target u.mutant] + == + -- +:: +mock: virtual nock :: ++ mock - |= {{sub/* fol/*} gul/$-({* *} (unit (unit)))} + |= [[sub=* fol=*] gul=$-(^ (unit (unit)))] (mook (mink [sub fol] gul)) +:: +mook: convert %tone to %toon, rendering stack frames :: ++ mook - |= ton/tone + |= ton=tone ^- toon - ?. ?=({$2 *} ton) ton - :- %2 - :: =. p.ton (moop p.ton) - =+ yel=(lent p.ton) - =. p.ton - ?. (gth yel 1.024) p.ton + ?. ?=([%2 *] ton) + ton + |^ [%2 (turn skip rend)] + :: + ++ skip + ^+ trace.ton + =/ yel (lent trace.ton) + ?. (gth yel 1.024) trace.ton %+ weld - (scag 512 p.ton) - ^- (list {@ta *}) - :_ (slag (sub yel 512) p.ton) + (scag 512 trace.ton) + ^+ trace.ton + :_ (slag (sub yel 512) trace.ton) :- %lose - %+ rap 3 - "[skipped {(scow %ud (sub yel 1.024))} frames]" - |- ^- (list tank) - ?~ p.ton ~ - =+ rep=$(p.ton t.p.ton) - ?+ -.i.p.ton rep - $hunk [(tank +.i.p.ton) rep] - $lose [[%leaf (rip 3 (@ +.i.p.ton))] rep] - $hand [[%leaf (scow %p (mug +.i.p.ton))] rep] - $mean :_ rep - ?@ +.i.p.ton [%leaf (rip 3 (@ +.i.p.ton))] - =+ mac=(mack +.i.p.ton +<.i.p.ton) - ?~(mac [%leaf "####"] (tank u.mac)) - $spot :_ rep - =+ sot=(spot +.i.p.ton) - :+ %rose [":" ~ ~] - :~ (smyt p.sot) - => [ud=|=(a/@u (scow %ud a)) q.sot] - leaf+"<[{(ud p.p)} {(ud q.p)}].[{(ud p.q)} {(ud q.q)}]>" - == == + (crip "[skipped {(scow %ud (sub yel 1.024))} frames]") + :: + :: +rend: raw stack frame to tank + :: + :: $% [%hunk ref=* path] :: failed scry ([~ ~]) + :: [%lose cord] :: skipped frames + :: [%hand *] :: mug any + :: [%mean $@(cord (trap tank))] :: ~_ et al + :: [%spot spot] :: source location + :: == + :: + ++ rend + |= [tag=@ta dat=*] + ^- tank + ?+ tag + :: + leaf+"mook.{(rip 3 tag)}" + :: + %hunk + ?@ dat leaf+"mook.hunk" + =/ sof=(unit path) ((soft path) +.dat) + ?~ sof leaf+"mook.hunk" + (smyt u.sof) + :: + %lose + ?^ dat leaf+"mook.lose" + leaf+(rip 3 dat) + :: + %hand + leaf+(scow %p (mug dat)) + :: + %mean + ?@ dat leaf+(rip 3 dat) + =/ mac (mack dat -.dat) + ?~ mac leaf+"####" + =/ sof ((soft tank) u.mac) + ?~ sof leaf+"mook.mean" + u.sof + :: + %spot + =/ sof=(unit spot) ((soft spot) dat) + ?~ sof leaf+"mook.spot" + :+ %rose [":" ~ ~] + :~ (smyt p.u.sof) + =* l p.q.u.sof + =* r q.q.u.sof + =/ ud |=(a=@u (scow %ud a)) + leaf+"<[{(ud p.l)} {(ud q.l)}].[{(ud p.r)} {(ud q.r)}]>" + == + == + -- +:: +mole: typed unitary virtual :: -++ mush :: sane name to leaf - |= val/* - ^- tank - :+ %rose - [['/' ~] ['/' ~] ~] - (turn ((list @ta) val) |=(a/@ta [%leaf (trip a)])) +++ mole + ~/ %mole + |* tap=(trap) + ^- (unit _$:tap) + =/ mur (mure tap) + ?~(mur ~ `$:tap) +:: +mong: virtual slam :: ++ mong - |= {{gat/* sam/*} gul/$-({* *} (unit (unit)))} + |= [[gat=* sam=*] gul=$-(^ (unit (unit)))] ^- toon - ?. &(?=(^ gat) ?=(^ +.gat)) - [%2 ~] + ?. ?=([* ^] gat) [%2 ~] (mock [gat(+< sam) %9 2 %0 1] gul) +:: +mule: typed virtual :: -++ mule :: typed virtual +++ mule ~/ %mule - =+ taq=|.(**) - |@ ++ $ - =+ mud=(mute taq) - ?- -.mud - %& [%& p=$:taq] - %| [%| p=p.mud] - == - -- + |* tap=(trap) + =/ mud (mute tap) + ?- -.mud + %& [%& p=$:tap] + %| [%| p=p.mud] + == +:: +mure: untyped unitary virtual :: -++ mute :: untyped virtual - |= taq/_=>(~ ^?(|.(**))) +++ mure + |= tap=(trap) + ^- (unit) + =/ ton (mink [tap %9 2 %0 1] |=((pair) ``.*(~ [%12 1+p 1+q]))) + ?.(?=(%0 -.ton) ~ `product.ton) +:: +mute: untyped virtual +:: +++ mute + |= tap=(trap) ^- (each * (list tank)) - =/ ton (mock [taq %9 2 %0 1] |=((pair) ``.*(~ [%12 1+p 1+q]))) + =/ ton (mock [tap %9 2 %0 1] |=((pair) ``.*(~ [%12 1+p 1+q]))) ?- -.ton - $0 [%& p.ton] - $1 [%| (turn p.ton |=(a/* (smyt (path a))))] - $2 [%| p.ton] + %0 [%& p.ton] + :: + %1 =/ sof=(unit path) ((soft path) p.ton) + [%| ?~(sof leaf+"mute.hunk" (smyt u.sof)) ~] + :: + %2 [%| p.ton] == :: +slum: slam a gate on a sample using raw nock, untyped :: @@ -6571,15 +6254,11 @@ |= [gat=* sam=*] ^- * .*(gat [%9 2 %10 [6 %1 sam] %0 1]) +:: +soft: virtual clam :: -++ soft :: maybe remold - |* han/$-(* *) - |= fud/* ^- (unit han) - =+ result=(mule |.((han fud))) - ?- -.result - %| ~ - %& [~ p.result] - == +++ soft + |* han=$-(* *) + |=(fud=* (mole |.((han fud)))) :: :::: 4o: molds and mold builders :: @@ -6588,48 +6267,48 @@ +$ atom @ :: just an atom +$ aura @ta :: atom format +$ base :: base mold - $@ $? $noun :: any noun - $cell :: any cell - $flag :: loobean - $null :: ~ == 0 - $void :: empty set + $@ $? %noun :: any noun + %cell :: any cell + %flag :: loobean + %null :: ~ == 0 + %void :: empty set == :: - {$atom p/aura} :: atom + [%atom p=aura] :: atom :: -+$ woof $@(@ {~ p/hoon}) :: simple embed -+$ chum $? lef/term :: jet name - {std/term kel/@} :: kelvin version - {ven/term pro/term kel/@} :: vendor and product - {ven/term pro/term ver/@ kel/@} :: all of the above ++$ woof $@(@ [~ p=hoon]) :: simple embed ++$ chum $? lef=term :: jet name + [std=term kel=@] :: kelvin version + [ven=term pro=term kel=@] :: vendor and product + [ven=term pro=term ver=@ kel=@] :: all of the above == :: -+$ coil $: p/garb :: name, wet/dry, vary - q/type :: context - r/(pair seminoun (map term tome)) :: chapters ++$ coil $: p=garb :: name, wet=dry, vary + q=type :: context + r=(pair seminoun (map term tome)) :: chapters == :: +$ garb (trel (unit term) poly vair) :: core +$ poly ?(%wet %dry) :: polarity -+$ foot $% {$dry p/hoon} :: dry arm, geometric - {$wet p/hoon} :: wet arm, generic ++$ foot $% [%dry p=hoon] :: dry arm, geometric + [%wet p=hoon] :: wet arm, generic == :: +$ link :: lexical segment - $% [%chat p/term] :: |chapter - [%cone p/aura q/atom] :: %constant - [%frag p/term] :: .leg - [%funk p/term] :: +arm + $% [%chat p=term] :: |chapter + [%cone p=aura q=atom] :: %constant + [%frag p=term] :: .leg + [%funk p=term] :: +arm == :: +$ crib [summary=cord details=(list sect)] :: +$ help [links=(list link) =crib] :: documentation +$ limb $@ term :: wing element - $% {%& p/axis} :: by geometry - {%| p/@ud q/(unit term)} :: by name + $% [%& p=axis] :: by geometry + [%| p=@ud q=(unit term)] :: by name == :: :: XX more and better sanity :: +$ null ~ :: null, nil, etc +$ onyx (list (pair type foot)) :: arm activation +$ opal :: limb match - $% {%& p/type} :: leg - {%| p/axis q/(set {p/type q/foot})} :: arm + $% [%& p=type] :: leg + [%| p=axis q=(set [p=type q=foot])] :: arm == :: +$ pica (pair ? cord) :: & prose, | code +$ palo (pair vein opal) :: wing trace, match @@ -6643,44 +6322,44 @@ +$ port (each palo (pair type nock)) :: successful match +$ spec :: structure definition $~ [%base %null] :: - $% {$base p/base} :: base type - {$dbug p/spot q/spec} :: set debug - {$leaf p/term q/@} :: constant atom - {$like p/wing q/(list wing)} :: reference - {$loop p/term} :: hygienic reference - {$made p/(pair term (list term)) q/spec} :: annotate synthetic - {$make p/hoon q/(list spec)} :: composed spec - {$name p/term q/spec} :: annotate simple - {$over p/wing q/spec} :: relative to subject + $% [%base p=base] :: base type + [%dbug p=spot q=spec] :: set debug + [%leaf p=term q=@] :: constant atom + [%like p=wing q=(list wing)] :: reference + [%loop p=term] :: hygienic reference + [%made p=(pair term (list term)) q=spec] :: annotate synthetic + [%make p=hoon q=(list spec)] :: composed spec + [%name p=term q=spec] :: annotate simple + [%over p=wing q=spec] :: relative to subject :: :: - {$bsbn p/spec q/spec} :: $>, filter: require - {$bsbs p/spec q/(map term spec)} :: $$, recursion - {$bsbr p/spec q/hoon} :: $|, verify - {$bscb p/hoon} :: $_, example - {$bscl p/{i/spec t/(list spec)}} :: $:, tuple - {$bscn p/{i/spec t/(list spec)}} :: $%, head pick - {$bsdt p/spec q/(map term spec)} :: $., read-write core - {$bsld p/spec q/spec} :: $<, filter: exclude - {$bshp p/spec q/spec} :: $-, function core - {$bskt p/spec q/spec} :: $^, cons pick - {$bsls p/stud q/spec} :: $+, standard - {$bsnt p/spec q/(map term spec)} :: $/, write-only core - {$bsmc p/hoon} :: $;, manual - {$bspd p/spec q/hoon} :: $&, repair - {$bssg p/hoon q/spec} :: $~, default - {$bstc p/spec q/(map term spec)} :: $`, read-only core - {$bsts p/skin q/spec} :: $=, name - {$bsvt p/spec q/spec} :: $@, atom pick - {$bswt p/{i/spec t/(list spec)}} :: $?, full pick - {$bszp p/spec q/(map term spec)} :: $!, opaque core + [%bcgr p=spec q=spec] :: $>, filter: require + [%bcbc p=spec q=(map term spec)] :: $$, recursion + [%bcbr p=spec q=hoon] :: $|, verify + [%bccb p=hoon] :: $_, example + [%bccl p=[i=spec t=(list spec)]] :: $:, tuple + [%bccn p=[i=spec t=(list spec)]] :: $%, head pick + [%bcdt p=spec q=(map term spec)] :: $., read-write core + [%bcgl p=spec q=spec] :: $<, filter: exclude + [%bchp p=spec q=spec] :: $-, function core + [%bckt p=spec q=spec] :: $^, cons pick + [%bcls p=stud q=spec] :: $+, standard + [%bcfs p=spec q=(map term spec)] :: $/, write-only core + [%bcmc p=hoon] :: $;, manual + [%bcpm p=spec q=hoon] :: $&, repair + [%bcsg p=hoon q=spec] :: $~, default + [%bctc p=spec q=(map term spec)] :: $`, read-only core + [%bcts p=skin q=spec] :: $=, name + [%bcpt p=spec q=spec] :: $@, atom pick + [%bcwt p=[i=spec t=(list spec)]] :: $?, full pick + [%bczp p=spec q=(map term spec)] :: $!, opaque core == :: +$ tent :: model builder - $% {%| p/wing q/tent r/(list spec)} :: ~(p q r...) - {%& p/(list wing)} :: a.b:c.d + $% [%| p=wing q=tent r=(list spec)] :: ~(p q r...) + [%& p=(list wing)] :: a.b:c.d == :: +$ tiki :: test case - $% {%& p/(unit term) q/wing} :: simple wing - {%| p/(unit term) q/hoon} :: named wing + $% [%& p=(unit term) q=wing] :: simple wing + [%| p=(unit term) q=hoon] :: named wing == :: +$ skin :: texture $@ =term :: name/~[term %none] @@ -6702,251 +6381,250 @@ (pair tope tope) :: cell ++ hoot :: hoon tools |% - +$ beer $@(char {~ p/hoon}) :: simple embed - +$ mane $@(@tas {@tas @tas}) :: XML name+space - +$ manx $~([[%$ ~] ~] {g/marx c/marl}) :: dynamic XML node + +$ beer $@(char [~ p=hoon]) :: simple embed + +$ mane $@(@tas [@tas @tas]) :: XML name+space + +$ manx $~([[%$ ~] ~] [g=marx c=marl]) :: dynamic XML node +$ marl (list tuna) :: dynamic XML nodes - +$ mart (list {n/mane v/(list beer)}) :: dynamic XML attrs - +$ marx $~([%$ ~] {n/mane a/mart}) :: dynamic XML tag + +$ mart (list [n=mane v=(list beer)]) :: dynamic XML attrs + +$ marx $~([%$ ~] [n=mane a=mart]) :: dynamic XML tag +$ mare (each manx marl) :: node or nodes +$ maru (each tuna marl) :: interp or nodes +$ tuna :: maybe interpolation $~ [[%$ ~] ~] $^ manx - $: ?($tape $manx $marl $call) - p/hoon + $: ?(%tape %manx %marl %call) + p=hoon == -- :: +$ hoon :: $~ [%zpzp ~] - $^ {p/hoon q/hoon} :: + $^ [p=hoon q=hoon] :: $% :: - {$$ p/axis} :: simple leg + [%$ p=axis] :: simple leg :: :: - {$base p/base} :: base spec - {$bust p/base} :: bunt base - {$dbug p/spot q/hoon} :: debug info in trace - {$eror p/tape} :: assembly error - {$hand p/type q/nock} :: premade result - {$note p/note q/hoon} :: annotate - {$fits p/hoon q/wing} :: underlying ?= - {$knit p/(list woof)} :: assemble string - {$leaf p/(pair term @)} :: symbol spec - {$limb p/term} :: take limb - {$lost p/hoon} :: not to be taken - {$rock p/term q/*} :: fixed constant - {$sand p/term q/*} :: unfixed constant - {$tell p/(list hoon)} :: render as tape - {$tune p/$@(term tune)} :: minimal face - {$wing p/wing} :: take wing - {$yell p/(list hoon)} :: render as tank - {$xray p/manx:hoot} :: ;foo; templating + [%base p=base] :: base spec + [%bust p=base] :: bunt base + [%dbug p=spot q=hoon] :: debug info in trace + [%eror p=tape] :: assembly error + [%hand p=type q=nock] :: premade result + [%note p=note q=hoon] :: annotate + [%fits p=hoon q=wing] :: underlying ?= + [%knit p=(list woof)] :: assemble string + [%leaf p=(pair term @)] :: symbol spec + [%limb p=term] :: take limb + [%lost p=hoon] :: not to be taken + [%rock p=term q=*] :: fixed constant + [%sand p=term q=*] :: unfixed constant + [%tell p=(list hoon)] :: render as tape + [%tune p=$@(term tune)] :: minimal face + [%wing p=wing] :: take wing + [%yell p=(list hoon)] :: render as tank + [%xray p=manx:hoot] :: ;foo; templating :: :::::: cores - {$brbs sample/(lest term) body/spec} :: |$ - {$brcb p/spec q/alas r/(map term tome)} :: |_ - {$brcl p/hoon q/hoon} :: |: - {$brcn p/(unit term) q/(map term tome)} :: |% - {$brdt p/hoon} :: |. - {$brkt p/hoon q/(map term tome)} :: |^ - {$brhp p/hoon} :: |- - {$brsg p/spec q/hoon} :: |~ - {$brtr p/spec q/hoon} :: |* - {$brts p/spec q/hoon} :: |= - {$brvt p/(unit term) q/(map term tome)} :: |@ - {$brwt p/hoon} :: |? + [%brbc sample=(lest term) body=spec] :: |$ + [%brcb p=spec q=alas r=(map term tome)] :: |_ + [%brcl p=hoon q=hoon] :: |: + [%brcn p=(unit term) q=(map term tome)] :: |% + [%brdt p=hoon] :: |. + [%brkt p=hoon q=(map term tome)] :: |^ + [%brhp p=hoon] :: |- + [%brsg p=spec q=hoon] :: |~ + [%brtr p=spec q=hoon] :: |* + [%brts p=spec q=hoon] :: |= + [%brpt p=(unit term) q=(map term tome)] :: |@ + [%brwt p=hoon] :: |? :: :::::: tuples - {$clcb p/hoon q/hoon} :: :_ [q p] - {$clkt p/hoon q/hoon r/hoon s/hoon} :: :^ [p q r s] - {$clhp p/hoon q/hoon} :: :- [p q] - {$clls p/hoon q/hoon r/hoon} :: :+ [p q r] - {$clsg p/(list hoon)} :: :~ [p ~] - {$cltr p/(list hoon)} :: :* p as a tuple + [%clcb p=hoon q=hoon] :: :_ [q p] + [%clkt p=hoon q=hoon r=hoon s=hoon] :: :^ [p q r s] + [%clhp p=hoon q=hoon] :: :- [p q] + [%clls p=hoon q=hoon r=hoon] :: :+ [p q r] + [%clsg p=(list hoon)] :: :~ [p ~] + [%cltr p=(list hoon)] :: :* p as a tuple :: :::::: invocations - {$cncb p/wing q/(list (pair wing hoon))} :: %_ - {$cndt p/hoon q/hoon} :: %. - {$cnhp p/hoon q/hoon} :: %- - {$cncl p/hoon q/(list hoon)} :: %: - {$cntr p/wing q/hoon r/(list (pair wing hoon))} :: %* - {$cnkt p/hoon q/hoon r/hoon s/hoon} :: %^ - {$cnls p/hoon q/hoon r/hoon} :: %+ - {$cnsg p/wing q/hoon r/(list hoon)} :: %~ - {$cnts p/wing q/(list (pair wing hoon))} :: %= + [%cncb p=wing q=(list (pair wing hoon))] :: %_ + [%cndt p=hoon q=hoon] :: %. + [%cnhp p=hoon q=hoon] :: %- + [%cncl p=hoon q=(list hoon)] :: %: + [%cntr p=wing q=hoon r=(list (pair wing hoon))] :: %* + [%cnkt p=hoon q=hoon r=hoon s=hoon] :: %^ + [%cnls p=hoon q=hoon r=hoon] :: %+ + [%cnsg p=wing q=hoon r=(list hoon)] :: %~ + [%cnts p=wing q=(list (pair wing hoon))] :: %= :: :::::: nock - {$dtkt p/spec q/hoon} :: .^ nock 11 - {$dtls p/hoon} :: .+ nock 4 - {$dttr p/hoon q/hoon} :: .* nock 2 - {$dtts p/hoon q/hoon} :: .= nock 5 - {$dtwt p/hoon} :: .? nock 3 + [%dtkt p=spec q=hoon] :: .^ nock 11 + [%dtls p=hoon] :: .+ nock 4 + [%dttr p=hoon q=hoon] :: .* nock 2 + [%dtts p=hoon q=hoon] :: .= nock 5 + [%dtwt p=hoon] :: .? nock 3 :: :::::: type conversion - {$ktbr p/hoon} :: ^| contravariant - {$ktcn p/hoon} :: ^% enter test mode - {$ktdt p/hoon q/hoon} :: ^. self-cast - {$ktls p/hoon q/hoon} :: ^+ expression cast - {$kthp p/spec q/hoon} :: ^- structure cast - {$ktpd p/hoon} :: ^& covariant - {$ktsg p/hoon} :: ^~ constant - {$ktts p/skin q/hoon} :: ^= label - {$ktwt p/hoon} :: ^? bivariant - {$kttr p/spec} :: ^* example - {$ktcl p/spec} :: ^: filter + [%ktbr p=hoon] :: ^| contravariant + [%ktdt p=hoon q=hoon] :: ^. self-cast + [%ktls p=hoon q=hoon] :: ^+ expression cast + [%kthp p=spec q=hoon] :: ^- structure cast + [%ktpm p=hoon] :: ^& covariant + [%ktsg p=hoon] :: ^~ constant + [%ktts p=skin q=hoon] :: ^= label + [%ktwt p=hoon] :: ^? bivariant + [%kttr p=spec] :: ^* example + [%ktcl p=spec] :: ^: filter :: :::::: hints - {$sgbr p/hoon q/hoon} :: ~| sell on trace - {$sgcb p/hoon q/hoon} :: ~_ tank on trace - {$sgcn p/chum q/hoon r/tyre s/hoon} :: ~% general jet hint - {$sgnt p/chum q/hoon} :: ~/ function j-hint - {$sgld p/$@(term {p/term q/hoon}) q/hoon} :: ~< backward hint - {$sgbn p/$@(term {p/term q/hoon}) q/hoon} :: ~> forward hint - {$sgbs p/term q/hoon} :: ~$ profiler hit - {$sgls p/@ q/hoon} :: ~+ cache/memoize - {$sgpd p/@ud q/hoon r/hoon} :: ~& printf/priority - {$sgts p/hoon q/hoon} :: ~= don't duplicate - {$sgwt p/@ud q/hoon r/hoon s/hoon} :: ~? tested printf - {$sgzp p/hoon q/hoon} :: ~! type on trace + [%sgbr p=hoon q=hoon] :: ~| sell on trace + [%sgcb p=hoon q=hoon] :: ~_ tank on trace + [%sgcn p=chum q=hoon r=tyre s=hoon] :: ~% general jet hint + [%sgfs p=chum q=hoon] :: ~/ function j-hint + [%sggl p=$@(term [p=term q=hoon]) q=hoon] :: ~< backward hint + [%sggr p=$@(term [p=term q=hoon]) q=hoon] :: ~> forward hint + [%sgbc p=term q=hoon] :: ~$ profiler hit + [%sgls p=@ q=hoon] :: ~+ cache=memoize + [%sgpm p=@ud q=hoon r=hoon] :: ~& printf=priority + [%sgts p=hoon q=hoon] :: ~= don't duplicate + [%sgwt p=@ud q=hoon r=hoon s=hoon] :: ~? tested printf + [%sgzp p=hoon q=hoon] :: ~! type on trace :: :::::: miscellaneous - {$mcts p/marl:hoot} :: ;= list templating - {$mccl p/hoon q/(list hoon)} :: ;: binary to nary - {$mcnt p/hoon} :: ;/ [%$ [%$ p ~] ~] - {$mcgl p/spec q/hoon r/hoon s/hoon} :: ;< bind - {$mcsg p/hoon q/(list hoon)} :: ;~ kleisli arrow - {$mcmc p/spec q/hoon} :: ;; normalize + [%mcts p=marl:hoot] :: ;= list templating + [%mccl p=hoon q=(list hoon)] :: ;: binary to nary + [%mcfs p=hoon] :: ;/ [%$ [%$ p ~] ~] + [%mcgl p=spec q=hoon r=hoon s=hoon] :: ;< bind + [%mcsg p=hoon q=(list hoon)] :: ;~ kleisli arrow + [%mcmc p=spec q=hoon] :: ;; normalize :: :::::: compositions - {$tsbr p/spec q/hoon} :: =| push bunt - {$tscl p/(list (pair wing hoon)) q/hoon} :: =: q w/ p changes - {$tsnt p/skin q/hoon r/hoon} :: =/ typed variable - {$tsmc p/skin q/hoon r/hoon} :: =; =/(q p r) - {$tsdt p/wing q/hoon r/hoon} :: =. r with p as q - {$tswt p/wing q/hoon r/hoon s/hoon} :: =? conditional =. - {$tsld p/hoon q/hoon} :: =< =>(q p) - {$tshp p/hoon q/hoon} :: =- =+(q p) - {$tsbn p/hoon q/hoon} :: => q w/subject p - {$tskt p/skin q/wing r/hoon s/hoon} :: =^ state machine - {$tsls p/hoon q/hoon} :: =+ q w/[p subject] - {$tssg p/(list hoon)} :: =~ hoon stack - {$tstr p/(pair term (unit spec)) q/hoon r/hoon} :: =* new style - {$tscm p/hoon q/hoon} :: =, overload p in q + [%tsbr p=spec q=hoon] :: =| push bunt + [%tscl p=(list (pair wing hoon)) q=hoon] :: =: q w= p changes + [%tsfs p=skin q=hoon r=hoon] :: =/ typed variable + [%tsmc p=skin q=hoon r=hoon] :: =; =/(q p r) + [%tsdt p=wing q=hoon r=hoon] :: =. r with p as q + [%tswt p=wing q=hoon r=hoon s=hoon] :: =? conditional =. + [%tsgl p=hoon q=hoon] :: =< =>(q p) + [%tshp p=hoon q=hoon] :: =- =+(q p) + [%tsgr p=hoon q=hoon] :: => q w=subject p + [%tskt p=skin q=wing r=hoon s=hoon] :: =^ state machine + [%tsls p=hoon q=hoon] :: =+ q w=[p subject] + [%tssg p=(list hoon)] :: =~ hoon stack + [%tstr p=(pair term (unit spec)) q=hoon r=hoon] :: =* new style + [%tscm p=hoon q=hoon] :: =, overload p in q :: :::::: conditionals - {$wtbr p/(list hoon)} :: ?| loobean or - {$wthp p/wing q/(list (pair spec hoon))} :: ?- pick case in q - {$wtcl p/hoon q/hoon r/hoon} :: ?: if/then/else - {$wtdt p/hoon q/hoon r/hoon} :: ?. ?:(p r q) - {$wtkt p/wing q/hoon r/hoon} :: ?^ if p is a cell - {$wtld p/hoon q/hoon} :: ?< ?:(p !! q) - {$wtbn p/hoon q/hoon} :: ?> ?:(p q !!) - {$wtls p/wing q/hoon r/(list (pair spec hoon))} :: ?+ ?- w/default - {$wtpd p/(list hoon)} :: ?& loobean and - {$wtvt p/wing q/hoon r/hoon} :: ?@ if p is atom - {$wtsg p/wing q/hoon r/hoon} :: ?~ if p is null - {$wthx p/skin q/wing} :: ?# if q matches p - {$wtts p/spec q/wing} :: ?= if q matches p - {$wtzp p/hoon} :: ?! loobean not + [%wtbr p=(list hoon)] :: ?| loobean or + [%wthp p=wing q=(list (pair spec hoon))] :: ?- pick case in q + [%wtcl p=hoon q=hoon r=hoon] :: ?: if=then=else + [%wtdt p=hoon q=hoon r=hoon] :: ?. ?:(p r q) + [%wtkt p=wing q=hoon r=hoon] :: ?^ if p is a cell + [%wtgl p=hoon q=hoon] :: ?< ?:(p !! q) + [%wtgr p=hoon q=hoon] :: ?> ?:(p q !!) + [%wtls p=wing q=hoon r=(list (pair spec hoon))] :: ?+ ?- w=default + [%wtpm p=(list hoon)] :: ?& loobean and + [%wtpt p=wing q=hoon r=hoon] :: ?@ if p is atom + [%wtsg p=wing q=hoon r=hoon] :: ?~ if p is null + [%wthx p=skin q=wing] :: ?# if q matches p + [%wtts p=spec q=wing] :: ?= if q matches p + [%wtzp p=hoon] :: ?! loobean not :: :::::: special - {$zpcm p/hoon q/hoon} :: !, - {$zpbn p/hoon} :: !> - {$zpld p/spec q/hoon} :: !< - {$zpmc p/hoon q/hoon} :: !; - {$zpts p/hoon} :: != - {$zpvt p/(list wing) q/hoon r/hoon} :: !@ - {$zpwt p/$@(p/@ {p/@ q/@}) q/hoon} :: !? - {$zpzp ~} :: !! + [%zpcm p=hoon q=hoon] :: !, + [%zpgr p=hoon] :: !> + [%zpgl p=spec q=hoon] :: !< + [%zpmc p=hoon q=hoon] :: !; + [%zpts p=hoon] :: != + [%zppt p=(list wing) q=hoon r=hoon] :: !@ + [%zpwt p=$@(p=@ [p=@ q=@]) q=hoon] :: !? + [%zpzp ~] :: !! == :: -+$ tyre (list {p/term q/hoon}) :: ++$ tyre (list [p=term q=hoon]) :: +$ tyke (list (unit hoon)) :: :: :::::: virtual nock -+$ nock $^ {p/nock q/nock} :: autocons - $% {$1 p/*} :: constant - {$2 p/nock q/nock} :: compose - {$3 p/nock} :: cell test - {$4 p/nock} :: increment - {$5 p/nock q/nock} :: equality test - {$6 p/nock q/nock r/nock} :: if, then, else - {$7 p/nock q/nock} :: serial compose - {$8 p/nock q/nock} :: push onto subject - {$9 p/@ q/nock} :: select arm and fire - {$10 p/{p/@ q/nock} q/nock} :: edit - {$11 p/$@(@ {p/@ q/nock}) q/nock} :: hint - {$12 p/nock q/nock} :: grab data from sky - {$0 p/@} :: axis select ++$ nock $^ [p=nock q=nock] :: autocons + $% [%1 p=*] :: constant + [%2 p=nock q=nock] :: compose + [%3 p=nock] :: cell test + [%4 p=nock] :: increment + [%5 p=nock q=nock] :: equality test + [%6 p=nock q=nock r=nock] :: if, then, else + [%7 p=nock q=nock] :: serial compose + [%8 p=nock q=nock] :: push onto subject + [%9 p=@ q=nock] :: select arm and fire + [%10 p=[p=@ q=nock] q=nock] :: edit + [%11 p=$@(@ [p=@ q=nock]) q=nock] :: hint + [%12 p=nock q=nock] :: grab data from sky + [%0 p=@] :: axis select == :: +$ note :: type annotation - $% {$help p/help} :: documentation - {$know p/stud} :: global standard - {$made p/term q/(unit (list wing))} :: structure + $% [%help p=help] :: documentation + [%know p=stud] :: global standard + [%made p=term q=(unit (list wing))] :: structure == :: +$ type $~ %noun :: - $@ $? $noun :: any nouns - $void :: no noun + $@ $? %noun :: any nouns + %void :: no noun == :: - $% {$atom p/term q/(unit @)} :: atom / constant - {$cell p/type q/type} :: ordered pair - {$core p/type q/coil} :: object - {$face p/$@(term tune) q/type} :: namespace - {$fork p/(set type)} :: union - {$hint p/(pair type note) q/type} :: annotation - {$hold p/type q/hoon} :: lazy evaluation + $% [%atom p=term q=(unit @)] :: atom / constant + [%cell p=type q=type] :: ordered pair + [%core p=type q=coil] :: object + [%face p=$@(term tune) q=type] :: namespace + [%fork p=(set type)] :: union + [%hint p=(pair type note) q=type] :: annotation + [%hold p=type q=hoon] :: lazy evaluation == :: +$ tony :: ++tone done right - $% {$0 p/tine q/*} :: success - {$1 p/(set)} :: blocks - {$2 p/(list {@ta *})} :: error ~_s + $% [%0 p=tine q=*] :: success + [%1 p=(set)] :: blocks + [%2 p=(list [@ta *])] :: error ~_s == :: +$ tine :: partial noun $@ ~ :: open - $% {%& p/tine q/tine} :: half-blocked - {%| p/(set)} :: fully blocked + $% [%& p=tine q=tine] :: half-blocked + [%| p=(set)] :: fully blocked == :: +$ tool $@(term tune) :: type decoration +$ tune :: complex $~ [~ ~] :: - $: p/(map term (unit hoon)) :: aliases - q/(list hoon) :: bridges + $: p=(map term (unit hoon)) :: aliases + q=(list hoon) :: bridges == :: +$ typo type :: old type -+$ vase {p/type q/*} :: type-value pair -+$ vise {p/typo q/*} :: old vase -+$ vial ?($read $rite $both $free) :: co/contra/in/bi -+$ vair ?($gold $iron $lead $zinc) :: in/contra/bi/co ++$ vase [p=type q=*] :: type-value pair ++$ vise [p=typo q=*] :: old vase ++$ vial ?(%read %rite %both %free) :: co/contra/in/bi ++$ vair ?(%gold %iron %lead %zinc) :: in/contra/bi/co +$ vein (list (unit axis)) :: search trace +$ sect (list pica) :: paragraph +$ whit :: - $: lab/(unit term) :: label - boy/(unit (pair cord (list sect))) :: body - def/(map term (pair cord (list sect))) :: definitions - use/(set term) :: defs used + $: lab=(unit term) :: label + boy=(unit (pair cord (list sect))) :: body + def=(map term (pair cord (list sect))) :: definitions + use=(set term) :: defs used == :: +$ what (unit (pair cord (list sect))) :: help slogan/section +$ wing (list limb) :: search path +$ worm :: compiler cache - $: nes/(set ^) :: ++nest - pay/(map (pair type hoon) type) :: ++play - mit/(map (pair type hoon) (pair type nock)) :: ++mint + $: nes=(set ^) :: ++nest + pay=(map (pair type hoon) type) :: ++play + mit=(map (pair type hoon) (pair type nock)) :: ++mint == :: :: :: +block: abstract identity of resource awaited :: -++ block ++$ block path :: :: +result: internal interpreter result :: -++ result ++$ result $@(~ seminoun) :: :: +thunk: fragment constructor :: -++ thunk ++$ thunk $-(@ud (unit noun)) :: :: +seminoun: :: -++ seminoun ++$ seminoun :: partial noun; blocked subtrees are ~ :: $~ [[%full ~] ~] - {mask/stencil data/noun} + [mask=stencil data=noun] :: :: +stencil: noun knowledge map :: -++ stencil ++$ stencil $% :: :: %half: noun has partial block substructure :: @@ -6958,42 +6636,42 @@ :: :: %lazy: noun can be generated from virtual subtree :: - [%lazy fragment/axis resolve/thunk] + [%lazy fragment=axis resolve=thunk] == :: -++ output ++$ output :: ~: interpreter stopped :: %- unit $% :: :: %done: output is complete :: - [%done p/noun] + [%done p=noun] :: :: %wait: output is waiting for resources :: - [%wait p/(list block)] + [%wait p=(list block)] == :: profiling -++ doss - $: mon/moan :: sample count - hit/(map term @ud) :: hit points - cut/(map path hump) :: cut points ++$ doss + $: mon=moan :: sample count + hit=(map term @ud) :: hit points + cut=(map path hump) :: cut points == -++ moan :: sample metric - $: fun/@ud :: samples in C - noc/@ud :: samples in nock - glu/@ud :: samples in glue - mal/@ud :: samples in alloc - far/@ud :: samples in frag - coy/@ud :: samples in copy - euq/@ud :: samples in equal ++$ moan :: sample metric + $: fun=@ud :: samples in C + noc=@ud :: samples in nock + glu=@ud :: samples in glue + mal=@ud :: samples in alloc + far=@ud :: samples in frag + coy=@ud :: samples in copy + euq=@ud :: samples in equal == :: :: -++ hump - $: mon/moan :: sample count - out/(map path @ud) :: calls out of - inn/(map path @ud) :: calls into ++$ hump + $: mon=moan :: sample count + out=(map path @ud) :: calls out of + inn=(map path @ud) :: calls into == -- :: :: @@ -7024,7 +6702,7 @@ :: |= $: :: noy: raw result :: - noy/result + noy=result == ^- output :: propagate stop @@ -7048,8 +6726,8 @@ |= $: :: bus: subject, a partial noun :: fol: formula, a complete noun :: - bus/seminoun - fol/noun + bus=seminoun + fol=noun == :: interpreter loop :: @@ -7080,7 +6758,7 @@ ~ :: 0; fragment :: - {$0 b/@} + [%0 b=@] :: if bad axis, stop :: ?: =(0 b.fol) ~ @@ -7090,14 +6768,14 @@ :: :: 1; constant :: - {$1 b/*} + [%1 b=*] :: constant is complete :: [full/~ b.fol] :: :: 2; recursion :: - {$2 b/* c/*} + [%2 b=* c=*] :: require complete formula :: %+ require @@ -7106,7 +6784,7 @@ $(fol c.fol) |= :: ryf: next formula :: - ryf/noun + ryf=noun :: lub: next subject :: =+ lub=^$(fol b.fol) @@ -7119,53 +6797,53 @@ :: :: 3; probe :: - {$3 b/*} + [%3 b=*] %+ require $(fol b.fol) |= :: fig: probe input :: - fig/noun + fig=noun :: yes if cell, no if atom :: [full/~ .?(fig)] :: :: 4; increment :: - {$4 b/*} + [%4 b=*] %+ require $(fol b.fol) |= :: fig: increment input :: - fig/noun + fig=noun :: stop for cells, increment for atoms :: ?^(fig ~ [full/~ +(fig)]) :: :: 5; compare :: - {$5 b/* c/*} + [%5 b=* c=*] %+ require $(fol b.fol) |= :: hed: left input :: - hed/noun + hed=noun %+ require ^$(fol c.fol) |= :: tal: right input :: - tal/noun + tal=noun [full/~ =(hed tal)] :: :: 6; if-then-else :: - {$6 b/* c/* d/*} + [%6 b=* c=* d=*] :: semantic expansion :: %+ require $(fol b.fol) |= :: fig: boolean :: - fig/noun + fig=noun :: apply proper booleans :: ?: =(& fig) ^$(fol c.fol) @@ -7176,7 +6854,7 @@ :: :: 7; composition :: - {$7 b/* c/*} + [%7 b=* c=*] :: one: input :: =+ one=$(fol b.fol) @@ -7189,7 +6867,7 @@ :: :: 8; introduction :: - {$8 b/* c/*} + [%8 b=* c=*] :: one: input :: =+ one=$(fol b.fol) @@ -7202,7 +6880,7 @@ :: :: 9; invocation :: - {$9 b/* c/*} + [%9 b=* c=*] :: semantic expansion :: ?^ b.fol ~ @@ -7236,7 +6914,7 @@ :: :: 10; edit :: - {$10 {b/@ c/*} d/*} + [%10 [b=@ c=*] d=*] :: tar: target of edit :: =+ tar=$(fol d.fol) @@ -7253,14 +6931,14 @@ :: :: 11; static hint :: - {$11 @ c/*} + [%11 @ c=*] :: ignore hint :: $(fol c.fol) :: :: 11; dynamic hint :: - {$11 {b/* c/*} d/*} + [%11 [b=* c=*] d=*] :: noy: dynamic hint :: =+ noy=$(fol c.fol) @@ -7269,7 +6947,7 @@ ?~ noy ~ :: if hint is a fully computed trace :: - ?: &(?=($spot b.fol) ?=([[%full ~] *] noy)) + ?: &(?=(%spot b.fol) ?=([[%full ~] *] noy)) :: compute within trace :: ~_((show %o +.noy) $(fol d.fol)) @@ -7284,8 +6962,8 @@ |= $: :: bus: subject, a partial noun :: fol: formula, a complete noun :: - bus/seminoun - fol/noun + bus=seminoun + fol=noun == ~+ ^- output @@ -7299,11 +6977,11 @@ |= $: :: hed: head of pair :: tal: tail of pair :: - hed/seminoun - tal/seminoun + hed=seminoun + tal=seminoun == ^- seminoun - ?. ?& &(?=($full -.mask.hed) ?=($full -.mask.tal)) + ?. ?& &(?=(%full -.mask.hed) ?=(%full -.mask.tal)) =(=(~ blocks.mask.hed) =(~ blocks.mask.tal)) == :: default merge @@ -7322,11 +7000,11 @@ ++ complete :: complete any laziness :: - |= bus/seminoun + |= bus=seminoun ^- seminoun ?- -.mask.bus - $full bus - $lazy :: fragment 1 is the whole thing + %full bus + %lazy :: fragment 1 is the whole thing :: ?: =(1 fragment.mask.bus) :: blocked; we can't get fragment 1 while compiling it @@ -7344,7 +7022,7 @@ :: else use value :: [[%full ~] u.-] - $half :: recursive descent + %half :: recursive descent :: %+ combine $(bus [left.mask.bus -.data.bus]) @@ -7357,8 +7035,8 @@ |= $: :: axe: tree address of subtree :: bus: partial noun :: - axe/axis - bus/seminoun + axe=axis + bus=seminoun == ^- result :: 1 is the root @@ -7399,9 +7077,9 @@ :: lit: (little) seminoun to insert within big at axe :: big: seminoun to mutate :: - axe/@ - lit/seminoun - big/seminoun + axe=@ + lit=seminoun + big=seminoun == ^- result :: stop on zero axis @@ -7460,8 +7138,8 @@ ++ require :: require complete intermediate step :: - |= $: noy/result - yen/$-(* result) + |= $: noy=result + yen=$-(* result) == ^- result :: propagate stop @@ -7469,11 +7147,11 @@ ?~ noy ~ :: suppress laziness :: - =/ bus/seminoun (complete noy) - ?< ?=($lazy -.mask.bus) + =/ bus=seminoun (complete noy) + ?< ?=(%lazy -.mask.bus) :: if partial block, squash blocks and stop :: - ?: ?=($half -.mask.bus) [full/(squash mask.bus) ~] + ?: ?=(%half -.mask.bus) [full/(squash mask.bus) ~] :: if full block, propagate block :: ?: ?=(^ blocks.mask.bus) [mask.bus ~] @@ -7484,12 +7162,12 @@ ++ squash :: convert stencil to block set :: - |= tyn/stencil + |= tyn=stencil ^- (set block) ?- -.tyn - $lazy $(tyn -:(complete tyn ~)) - $full blocks.tyn - $half (~(uni in $(tyn left.tyn)) $(tyn rite.tyn)) + %lazy $(tyn -:(complete tyn ~)) + %full blocks.tyn + %half (~(uni in $(tyn left.tyn)) $(tyn rite.tyn)) == -- :: @@ -7498,18 +7176,18 @@ ++ bool `type`(fork [%atom %f `0] [%atom %f `1] ~) :: make loobean ++ cell :: make %cell type ~/ %cell - |= {hed/type tal/type} + |= [hed=type tal=type] ^- type ?:(=(%void hed) %void ?:(=(%void tal) %void [%cell hed tal])) :: ++ core :: make %core type ~/ %core - |= {pac/type con/coil} + |= [pac=type con=coil] ^- type ?:(=(%void pac) %void [%core pac con]) :: ++ hint - |= {p/(pair type note) q/type} + |= [p=(pair type note) q=type] ^- type ?: =(%void q) %void ?: =(%noun q) %noun @@ -7517,7 +7195,7 @@ :: ++ face :: make %face type ~/ %face - |= {giz/$@(term tune) der/type} + |= [giz=$@(term tune) der=type] ^- type ?: =(%void der) %void @@ -7525,39 +7203,39 @@ :: ++ fork :: make %fork type ~/ %fork - |= yed/(list type) - =| lez/(set type) + |= yed=(list type) + =| lez=(set type) |- ^- type ?~ yed ?~ lez %void - ?: ?=({* ~ ~} lez) n.lez + ?: ?=([* ~ ~] lez) n.lez [%fork lez] %= $ yed t.yed lez ?: =(%void i.yed) lez - ?: ?=({$fork *} i.yed) (~(uni in lez) p.i.yed) + ?: ?=([%fork *] i.yed) (~(uni in lez) p.i.yed) (~(put in lez) i.yed) == :: ++ cove :: extract [0 *] axis - |= nug/nock + |= nug=nock ?- nug - {$0 *} p.nug - {$11 *} $(nug q.nug) + [%0 *] p.nug + [%11 *] $(nug q.nug) * ~_(leaf+"cove" !!) == ++ comb :: combine two formulas ~/ %comb - |= {mal/nock buz/nock} + |= [mal=nock buz=nock] ^- nock - ?: ?&(?=({$0 *} mal) !=(0 p.mal)) - ?: ?&(?=({$0 *} buz) !=(0 p.buz)) + ?: ?&(?=([%0 *] mal) !=(0 p.mal)) + ?: ?&(?=([%0 *] buz) !=(0 p.buz)) [%0 (peg p.mal p.buz)] - ?: ?=({$2 {$0 *} {$0 *}} 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) + ?: ?=([^ [%0 %1]] mal) [%8 p.mal buz] ?: =([%0 %1] buz) mal @@ -7565,17 +7243,17 @@ :: ++ cond :: ?: compile ~/ %cond - |= {pex/nock yom/nock woq/nock} + |= [pex=nock yom=nock woq=nock] ^- nock ?- pex - {$1 $0} yom - {$1 $1} woq + [%1 %0] yom + [%1 %1] woq * [%6 pex yom woq] == :: ++ cons :: make formula cell ~/ %cons - |= {vur/nock sed/nock} + |= [vur=nock sed=nock] ^- nock :: this optimization can remove crashes which are essential :: @@ -7583,15 +7261,15 @@ :: ?: ?&(=(+(p.vur) p.sed) =((div p.vur 2) (div p.sed 2))) :: [%0 (div p.vur 2)] :: [vur sed] - ?: ?=({{$1 *} {$1 *}} +<) + ?: ?=([[%1 *] [%1 *]] +<) [%1 p.vur p.sed] [vur sed] :: ++ fitz :: odor compatibility ~/ %fitz - |= {yaz/term wix/term} + |= [yaz=term wix=term] =+ ^= fiz - |= mot/@ta ^- {p/@ q/@ta} + |= mot=@ta ^- [p=@ q=@ta] =+ len=(met 3 mot) ?: =(0 len) [0 %$] @@ -7614,42 +7292,42 @@ :: ++ flan :: loobean & ~/ %flan - |= {bos/nock nif/nock} + |= [bos=nock nif=nock] ^- nock ?: =(bos nif) bos ?: =([%0 0] bos) nif ?: =([%0 0] nif) bos ?- bos - {$1 $1} bos - {$1 $0} nif + [%1 %1] bos + [%1 %0] nif * ?- nif - {$1 $1} nif - {$1 $0} bos + [%1 %1] nif + [%1 %0] bos * [%6 bos nif [%1 1]] == == :: ++ flip :: loobean negation ~/ %flip - |= dyr/nock + |= dyr=nock ?: =([%0 0] dyr) dyr [%6 dyr [%1 1] [%1 0]] :: ++ flor :: loobean | ~/ %flor - |= {bos/nock nif/nock} + |= [bos=nock nif=nock] ^- nock ?: =(bos nif) bos ?: =([%0 0] bos) nif ?: =([%0 0] nif) bos ?- bos - {$1 $1} nif - {$1 $0} bos + [%1 %1] nif + [%1 %0] bos * ?- nif - {$1 $1} bos - {$1 $0} nif + [%1 %1] bos + [%1 %0] nif * [%6 bos [%1 0] nif] == == @@ -7718,47 +7396,47 @@ -- :: ++ jock - |= rad/? - |= lot/coin ^- hoon + |= rad=? + |= lot=coin ^- hoon ?- -.lot ~ ?:(rad [%rock p.lot] [%sand p.lot]) :: - $blob + %blob ?: rad [%rock %$ p.lot] ?@(p.lot [%sand %$ p.lot] [$(p.lot -.p.lot) $(p.lot +.p.lot)]) :: - $many - [%cltr (turn p.lot |=(a/coin ^$(lot a)))] + %many + [%cltr (turn p.lot |=(a=coin ^$(lot a)))] == :: ++ look ~/ %look - |= {cog/term dab/(map term hoon)} + |= [cog=term dab=(map term hoon)] =+ axe=1 - |- ^- (unit {p/axis q/hoon}) + |- ^- (unit [p=axis q=hoon]) ?- 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) @@ -7768,29 +7446,29 @@ :: ++ loot ~/ %loot - |= {cog/term dom/(map term tome)} + |= [cog=term dom=(map term tome)] =+ axe=1 - |- ^- (unit {p/axis q/hoon}) + |- ^- (unit [p=axis q=hoon]) ?- dom ~ ~ :: - {* ~ ~} + [* ~ ~] %+ bind (look cog q.q.n.dom) |=((pair axis hoon) [(peg axe p) q]) :: - {* ~ *} + [* ~ *] =+ yep=(look cog q.q.n.dom) ?^ yep [~ (peg (peg axe 2) p.u.yep) q.u.yep] $(axe (peg axe 3), dom r.dom) :: - {* * ~} + [* * ~] =+ yep=(look cog q.q.n.dom) ?^ yep [~ (peg (peg axe 2) p.u.yep) q.u.yep] $(axe (peg axe 3), dom l.dom) :: - {* * *} + [* * *] =+ yep=(look cog q.q.n.dom) ?^ yep [~ (peg (peg axe 2) p.u.yep) q.u.yep] @@ -7802,27 +7480,27 @@ :::: 5b: macro expansion :: ++ ah :: tiki engine - |_ tik/tiki + |_ tik=tiki ++ blue - |= gen/hoon + |= gen=hoon ^- hoon ?. &(?=(%| -.tik) ?=(~ p.tik)) gen - [%tsbn [%$ 3] gen] + [%tsgr [%$ 3] gen] :: ++ teal - |= mod/spec + |= mod=spec ^- spec ?: ?=(%& -.tik) mod [%over [%& 3]~ mod] :: ++ tele - |= syn/skin + |= syn=skin ^- skin ?: ?=(%& -.tik) syn [%over [%& 3]~ syn] :: ++ gray - |= gen/hoon + |= gen=hoon ^- hoon ?- -.tik %& ?~(p.tik gen [%tstr [u.p.tik ~] [%wing q.tik] gen]) @@ -7836,17 +7514,17 @@ %| [[%& 2] ~] == :: - ++ wthp |= opt/(list (pair spec hoon)) + ++ wthp |= opt=(list (pair spec hoon)) %+ gray %wthp - [puce (turn opt |=({a/spec b/hoon} [a (blue b)]))] - ++ wtkt |=({sic/hoon non/hoon} (gray [%wtkt puce (blue sic) (blue non)])) - ++ wtls |= {gen/hoon opt/(list (pair spec hoon))} + [puce (turn opt |=([a=spec b=hoon] [a (blue b)]))] + ++ wtkt |=([sic=hoon non=hoon] (gray [%wtkt puce (blue sic) (blue non)])) + ++ wtls |= [gen=hoon opt=(list (pair spec hoon))] %+ gray %wtls - [puce (blue gen) (turn opt |=({a/spec b/hoon} [a (blue b)]))] - ++ wtvt |=({sic/hoon non/hoon} (gray [%wtvt puce (blue sic) (blue non)])) - ++ wtsg |=({sic/hoon non/hoon} (gray [%wtsg puce (blue sic) (blue non)])) - ++ wthx |=(syn/skin (gray [%wthx (tele syn) puce])) - ++ wtts |=(mod/spec (gray [%wtts (teal mod) puce])) + [puce (blue gen) (turn opt |=([a=spec b=hoon] [a (blue b)]))] + ++ wtpt |=([sic=hoon non=hoon] (gray [%wtpt puce (blue sic) (blue non)])) + ++ wtsg |=([sic=hoon non=hoon] (gray [%wtsg puce (blue sic) (blue non)])) + ++ wthx |=(syn=skin (gray [%wthx (tele syn) puce])) + ++ wtts |=(mod=spec (gray [%wtts (teal mod) puce])) -- :: ++ ax @@ -7863,57 +7541,57 @@ nut=*(unit note) def=*(unit hoon) == - |_ {fab/? mod/spec} + |_ mod=spec :: ++ autoname :: derive name from spec :: |- ^- (unit term) ?- -.mod - $base ?.(?=([%atom *] p.mod) ~ ?:(=(%$ p.p.mod) `%atom `p.p.mod)) - $dbug $(mod q.mod) - $leaf `p.mod - $loop `p.mod - $like ?~(p.mod ~ ?^(i.p.mod ?:(?=(%& -.i.p.mod) ~ q.i.p.mod) `i.p.mod)) - $make ~(name ap p.mod) - $made $(mod q.mod) - $over $(mod q.mod) - $name $(mod q.mod) + %base ?.(?=([%atom *] p.mod) ~ ?:(=(%$ p.p.mod) `%atom `p.p.mod)) + %dbug $(mod q.mod) + %leaf `p.mod + %loop `p.mod + %like ?~(p.mod ~ ?^(i.p.mod ?:(?=(%& -.i.p.mod) ~ q.i.p.mod) `i.p.mod)) + %make ~(name ap p.mod) + %made $(mod q.mod) + %over $(mod q.mod) + %name $(mod q.mod) :: - $bsbs $(mod p.mod) - $bsbr $(mod p.mod) - $bscb ~(name ap p.mod) - $bscl $(mod i.p.mod) - $bscn $(mod i.p.mod) - $bsdt ~ - $bsld $(mod q.mod) - $bsbn $(mod q.mod) - $bshp $(mod p.mod) - $bskt $(mod q.mod) - $bsls $(mod q.mod) - $bsnt ~ - $bsmc ~(name ap p.mod) - $bspd $(mod p.mod) - $bssg $(mod q.mod) - $bstc ~ - $bsts $(mod q.mod) - $bsvt $(mod q.mod) - $bswt $(mod i.p.mod) - $bszp ~ + %bcbc $(mod p.mod) + %bcbr $(mod p.mod) + %bccb ~(name ap p.mod) + %bccl $(mod i.p.mod) + %bccn $(mod i.p.mod) + %bcdt ~ + %bcgl $(mod q.mod) + %bcgr $(mod q.mod) + %bchp $(mod p.mod) + %bckt $(mod q.mod) + %bcls $(mod q.mod) + %bcfs ~ + %bcmc ~(name ap p.mod) + %bcpm $(mod p.mod) + %bcsg $(mod q.mod) + %bctc ~ + %bcts $(mod q.mod) + %bcpt $(mod q.mod) + %bcwt $(mod i.p.mod) + %bczp ~ == ++ hint - |= not/note + |= not=note ^+ +> ?>(?=(~ nut) +>.$(nut `not)) :: ++ function :: construct a function example :: - |= {fun/spec arg/spec} + |= [fun=spec arg=spec] ^- hoon :: minimal context as subject :: - :+ %tsbn + :+ %tsgr :: context is example of both specs :: [example:clear(mod fun) example:clear(mod arg)] @@ -7929,18 +7607,18 @@ ++ interface :: construct a core example :: - |= {variance/vair payload/spec arms/(map term spec)} + |= [variance=vair payload=spec arms=(map term spec)] ^- hoon :: attach proper variance control :: =- ?- variance %gold - %lead [%ktwt -] - %zinc [%ktpd -] + %zinc [%ktpm -] %iron [%ktbr -] == ^- hoon - :+ %tsbn example:clear(mod payload) + :+ %tsgr example:clear(mod payload) :+ %brcn ~ =- [[%$ ~ -] ~ ~] %- ~(gas by *(map term hoon)) @@ -7957,14 +7635,14 @@ ++ home :: express a hoon against the original subject :: - |= gen/hoon + |= gen=hoon ^- hoon =/ ,wing ?: =(1 dom) hay (weld hay `wing`[[%& dom] ~]) ?~ - gen - [%tsbn [%wing -] gen] + [%tsgr [%wing -] gen] :: ++ clear :: clear annotations @@ -7974,56 +7652,56 @@ ++ basal :: example base case :: - |= bas/base + |= bas=base ?- bas :: - {$atom *} + [%atom *] :: we may want sped :: [%sand p.bas ?:(=(%da p.bas) ~2000.1.1 0)] :: - $noun + %noun :: raw nock produces noun type :: =+([%rock %$ 0] [%ktls [%dttr - - [%rock %$ 1]] -]) :: - $cell + %cell :: reduce to pair of nouns :: =+($(bas %noun) [- -]) :: - $flag + %flag :: comparison produces boolean type :: =+([%rock %$ 0] [%ktls [%dtts - -] -]) :: - $null + %null [%rock %n 0] :: - $void + %void [%zpzp ~] == :: ++ unfold - |= [fun/hoon arg/(list spec)] + |= [fun=hoon arg=(list spec)] ^- hoon [%cncl fun (turn arg |=(spec ktcl/+<))] :: ++ unreel - |= [one/wing res/(list wing)] + |= [one=wing res=(list wing)] ^- hoon - ?~(res [%wing one] [%tsld [%wing one] $(one i.res, res t.res)]) + ?~(res [%wing one] [%tsgl [%wing one] $(one i.res, res t.res)]) :: ++ descend :: record an axis to original subject :: - |= axe/axis + |= axe=axis +>(dom (peg axe dom)) :: ++ decorate :: apply documentation to expression :: - |= gen/hoon + |= gen=hoon ^- hoon =- ?~(nut - [%note u.nut -]) ^- hoon @@ -8059,8 +7737,8 @@ ~+ |- ^- hoon ?- mod - {$base *} ?:(=(%void p.mod) [%rock %n 0] (basal p.mod)) - {$bsbs *} :: track hygienic recursion points lexically + [%base *] ?:(=(%void p.mod) [%rock %n 0] (basal p.mod)) + [%bcbc *] :: track hygienic recursion points lexically :: %= $ mod p.mod @@ -8068,49 +7746,49 @@ :: (~(put by ^+(cox (~(uni by cox) q.mod))) %$ p.mod) == - {$dbug *} [%dbug p.mod $(mod q.mod)] - {$leaf *} [%rock p.mod q.mod] - {$loop *} ~|([%loop p.mod] $(mod (~(got by cox) p.mod))) - {$like *} $(mod bsmc/(unreel p.mod q.mod)) - {$made *} $(mod q.mod) - {$make *} $(mod bsmc/(unfold p.mod q.mod)) - {$name *} $(mod q.mod) - {$over *} $(hay p.mod, mod q.mod) + [%dbug *] [%dbug p.mod $(mod q.mod)] + [%leaf *] [%rock p.mod q.mod] + [%loop *] ~|([%loop p.mod] $(mod (~(got by cox) p.mod))) + [%like *] $(mod bcmc/(unreel p.mod q.mod)) + [%made *] $(mod q.mod) + [%make *] $(mod bcmc/(unfold p.mod q.mod)) + [%name *] $(mod q.mod) + [%over *] $(hay p.mod, mod q.mod) :: - {$bsbr *} $(mod p.mod) - {$bscb *} [%rock %n 0] - {$bscl *} |- ^- hoon + [%bcbr *] $(mod p.mod) + [%bccb *] [%rock %n 0] + [%bccl *] |- ^- hoon ?~ t.p.mod ^$(mod i.p.mod) :- ^$(mod i.p.mod) $(i.p.mod i.t.p.mod, t.p.mod t.t.p.mod) - {$bscn *} :: use last entry + [%bccn *] :: use last entry :: |- ^- hoon ?~ t.p.mod ^$(mod i.p.mod) $(i.p.mod i.t.p.mod, t.p.mod t.t.p.mod) - {$bshp *} :: see under %bscb + [%bchp *] :: see under %bccb :: [%rock %n 0] - {$bsld *} $(mod q.mod) - {$bsbn *} $(mod q.mod) - {$bskt *} $(mod q.mod) - {$bsls *} $(mod q.mod) - {$bsmc *} :: borrow sample + [%bcgl *] $(mod q.mod) + [%bcgr *] $(mod q.mod) + [%bckt *] $(mod q.mod) + [%bcls *] $(mod q.mod) + [%bcmc *] :: borrow sample :: - [%tsld [%$ 6] p.mod] - {$bspd *} $(mod p.mod) - {$bssg *} [%kthp q.mod p.mod] - {$bsts *} [%ktts p.mod $(mod q.mod)] - {$bsvt *} $(mod p.mod) - {$bswt *} :: use last entry + [%tsgl [%$ 6] p.mod] + [%bcpm *] $(mod p.mod) + [%bcsg *] [%kthp q.mod p.mod] + [%bcts *] [%ktts p.mod $(mod q.mod)] + [%bcpt *] $(mod p.mod) + [%bcwt *] :: use last entry :: |- ^- hoon ?~ t.p.mod ^$(mod i.p.mod) $(i.p.mod i.t.p.mod, t.p.mod t.t.p.mod) - {$bsdt *} [%rock %n 0] - {$bsnt *} [%rock %n 0] - {$bstc *} [%rock %n 0] - {$bszp *} [%rock %n 0] + [%bcdt *] [%rock %n 0] + [%bcfs *] [%rock %n 0] + [%bctc *] [%rock %n 0] + [%bczp *] [%rock %n 0] == :: ++ example @@ -8125,32 +7803,32 @@ spore ~(relative analyze:(descend 3) 2) :: - {$base *} (decorate (basal p.mod)) - {$dbug *} example(mod q.mod, bug [p.mod bug]) - {$leaf *} (decorate [%rock p.mod q.mod]) - {$like *} example(mod bsmc/(unreel p.mod q.mod)) - {$loop *} [%limb p.mod] - {$made *} example(mod q.mod, nut `made/[p.p.mod `(pieces q.p.mod)]) - {$make *} example(mod bsmc/(unfold p.mod q.mod)) - {$name *} example(mod q.mod, nut `made/[p.mod ~]) - {$over *} example(hay p.mod, mod q.mod) + [%base *] (decorate (basal p.mod)) + [%dbug *] example(mod q.mod, bug [p.mod bug]) + [%leaf *] (decorate [%rock p.mod q.mod]) + [%like *] example(mod bcmc/(unreel p.mod q.mod)) + [%loop *] [%limb p.mod] + [%made *] example(mod q.mod, nut `made/[p.p.mod `(pieces q.p.mod)]) + [%make *] example(mod bcmc/(unfold p.mod q.mod)) + [%name *] example(mod q.mod, nut `made/[p.mod ~]) + [%over *] example(hay p.mod, mod q.mod) :: - {$bscb *} (decorate (home p.mod)) - {$bscl *} %- decorate + [%bccb *] (decorate (home p.mod)) + [%bccl *] %- decorate |- ^- hoon ?~ t.p.mod example:clear(mod i.p.mod) :- example:clear(mod i.p.mod) example:clear(i.p.mod i.t.p.mod, t.p.mod t.t.p.mod) - {$bshp *} (decorate (function:clear p.mod q.mod)) - {$bsmc *} (decorate (home [%tsld [%limb %$] p.mod])) - {$bssg *} [%ktls example(mod q.mod) (home p.mod)] - {$bsls *} (decorate example(mod q.mod)) - {$bsts *} (decorate [%ktts p.mod example:clear(mod q.mod)]) - {$bsdt *} (decorate (home (interface %gold p.mod q.mod))) - {$bsnt *} (decorate (home (interface %iron p.mod q.mod))) - {$bszp *} (decorate (home (interface %lead p.mod q.mod))) - {$bstc *} (decorate (home (interface %zinc p.mod q.mod))) + [%bchp *] (decorate (function:clear p.mod q.mod)) + [%bcmc *] (decorate (home [%tsgl [%limb %$] p.mod])) + [%bcsg *] [%ktls example(mod q.mod) (home p.mod)] + [%bcls *] (decorate example(mod q.mod)) + [%bcts *] (decorate [%ktts p.mod example:clear(mod q.mod)]) + [%bcdt *] (decorate (home (interface %gold p.mod q.mod))) + [%bcfs *] (decorate (home (interface %iron p.mod q.mod))) + [%bczp *] (decorate (home (interface %lead p.mod q.mod))) + [%bctc *] (decorate (home (interface %zinc p.mod q.mod))) == :: ++ factory @@ -8159,18 +7837,18 @@ ^- hoon :: process annotations outside construct, to catch default :: - ?: ?=($dbug -.mod) factory(mod q.mod, bug [p.mod bug]) - ?: ?=($bssg -.mod) factory(mod q.mod, def `[%kthp q.mod p.mod]) + ?: ?=(%dbug -.mod) factory(mod q.mod, bug [p.mod bug]) + ?: ?=(%bcsg -.mod) factory(mod q.mod, def `[%kthp q.mod p.mod]) ^- hoon :: if we recognize an indirection :: - ?: &(=(~ def) ?=(?(%bsmc %like %loop %make) -.mod)) + ?: &(=(~ def) ?=(?(%bcmc %like %loop %make) -.mod)) :: then short-circuit it :: %- decorate %- home ?- -.mod - %bsmc p.mod + %bcmc p.mod %like (unreel p.mod q.mod) %loop [%limb p.mod] %make (unfold p.mod q.mod) @@ -8186,43 +7864,43 @@ :: |_ $: :: axe: axis to fragment :: - axe/axis + axe=axis == ++ basic - |= bas/base + |= bas=base ^- hoon ?- bas - {%atom *} + [%atom *] :+ %ktls example ^- hoon - :^ %zpvt + :^ %zppt [[[%| 0 `%ruth] ~] ~] [%cnls [%limb %ruth] [%sand %ta p.bas] fetch] - [%wtvt fetch-wing fetch [%zpzp ~]] + [%wtpt fetch-wing fetch [%zpzp ~]] :: - $cell + %cell :+ %ktls example =+ fetch-wing :- [%wing [[%& %2] -]] [%wing [[%& %3] -]] :: - $flag + %flag :^ %wtcl [%dtts [%rock %$ &] [%$ axe]] [%rock %f &] - :+ %wtbn + :+ %wtgr [%dtts [%rock %$ |] [%$ axe]] [%rock %f |] :: - $noun + %noun fetch :: - $null - :+ %wtbn + %null + :+ %wtgr [%dtts [%bust %noun] [%$ axe]] [%rock %n ~] ::: - $void + %void [%zpzp ~] == ++ clear @@ -8246,8 +7924,8 @@ |= $: :: one: first option :: rep: other options :: - one/spec - rep/(list spec) + one=spec + rep=(list spec) == ^- hoon :: if no other choices, construct head @@ -8270,8 +7948,8 @@ |= $: :: one: first format :: two: more formats :: - one/spec - rep/(list spec) + one=spec + rep=(list spec) == |- ^- hoon :: if no other choices, construct head @@ -8279,14 +7957,14 @@ ?~ rep relative:clear(mod one) :: fin: loop completion :: - =/ fin/hoon $(one i.rep, rep t.rep) + =/ fin=hoon $(one i.rep, rep t.rep) :: interrogate this instance :: :^ %wtcl :: test if the head matches this wing :: :+ %fits - [%tsld [%$ 2] example:clear(mod one)] + [%tsgl [%$ 2] example:clear(mod one)] fetch-wing(axe (peg axe 2)) :: if so, use this form :: @@ -8304,55 +7982,55 @@ :: :: base :: - {$base *} + [%base *] (decorate (basic:clear p.mod)) :: :: debug :: - {$dbug *} + [%dbug *] relative(mod q.mod, bug [p.mod bug]) :: :: constant :: - {$leaf *} + [%leaf *] %- decorate - :+ %wtbn + :+ %wtgr [%dtts fetch [%rock %$ q.mod]] [%rock p.mod q.mod] :: :: composite :: - {$make *} - relative(mod bsmc/(unfold p.mod q.mod)) + [%make *] + relative(mod bcmc/(unfold p.mod q.mod)) :: :: indirect :: - {$like *} - relative(mod bsmc/(unreel p.mod q.mod)) + [%like *] + relative(mod bcmc/(unreel p.mod q.mod)) :: :: loop :: - {$loop *} + [%loop *] (decorate [%cnhp [%limb p.mod] fetch]) :: :: simple named structure :: - {$name *} + [%name *] relative(mod q.mod, nut `made/[p.mod ~]) :: :: synthetic named structure :: - {$made *} + [%made *] relative(mod q.mod, nut `made/[p.p.mod `(pieces q.p.mod)]) :: :: subjective :: - {$over *} + [%over *] relative(hay p.mod, mod q.mod) :: :: recursive, $$ :: - {$bsbs *} + [%bcbc *] :: :: apply semantically :: @@ -8368,21 +8046,21 @@ :: :: normalize, $& :: - {$bspd *} + [%bcpm *] :: push the raw result :: :+ %tsls relative(mod p.mod) :: push repair function :: :+ %tsls - [%tsbn $/3 q.mod] + [%tsgr $/3 q.mod] :: push repaired product :: :+ %tsls [%cnhp $/2 $/6] :: sanity-check repaired product :: - :+ %wtbn + :+ %wtgr :: either :: :~ %wtbr @@ -8397,7 +8075,7 @@ :: :: verify, $| :: - {$bsbr *} + [%bcbr *] ^- hoon :: push the raw product :: @@ -8405,27 +8083,27 @@ ^- hoon :: assert :: - :+ %wtbn + :+ %wtgr :: run the verifier :: - [%cnhp [%tsbn $/3 q.mod] $/2] + [%cnhp [%tsgr $/3 q.mod] $/2] :: produce verified product :: $/2 :: :: special, $_ :: - {$bscb *} + [%bccb *] (decorate (home p.mod)) :: :: switch, $% :: - {$bscn *} + [%bccn *] (decorate (switch i.p.mod t.p.mod)) :: :: tuple, $: :: - {$bscl *} + [%bccl *] %- decorate |- ^- hoon ?~ t.p.mod @@ -8439,25 +8117,25 @@ :: :: exclude, $< :: - {$bsld *} + [%bcgl *] :+ %tsls relative:clear(mod q.mod) - :+ %wtld + :+ %wtgl [%wtts [%over ~[&/3] p.mod] ~[&/4]] $/2 :: :: require, $> :: - {$bsbn *} + [%bcgr *] :+ %tsls relative:clear(mod q.mod) - :+ %wtbn + :+ %wtgr [%wtts [%over ~[&/3] p.mod] ~[&/4]] $/2 :: :: function :: - {$bshp *} + [%bchp *] %- decorate =/ fun (function:clear p.mod q.mod) ?^ def @@ -8466,7 +8144,7 @@ :: :: bridge, $^ :: - {$bskt *} + [%bckt *] %- decorate :^ %wtcl [%dtwt fetch(axe (peg axe 2))] @@ -8475,38 +8153,38 @@ :: :: synthesis, $; :: - {$bsmc *} + [%bcmc *] (decorate [%cncl (home p.mod) fetch ~]) :: :: default :: - {$bssg *} + [%bcsg *] relative(mod q.mod, def `[%kthp q.mod p.mod]) :: :: choice, $? :: - {$bswt *} + [%bcwt *] (decorate (choice i.p.mod t.p.mod)) :: :: name, $= :: - {$bsts *} + [%bcts *] [%ktts p.mod relative(mod q.mod)] :: :: branch, $@ :: - {$bsvt *} + [%bcpt *] %- decorate :^ %wtcl [%dtwt fetch] relative:clear(mod q.mod) relative:clear(mod p.mod) :: - {$bsls *} relative(mod q.mod) - {$bsdt *} (decorate (home (interface %gold p.mod q.mod))) - {$bsnt *} (decorate (home (interface %iron p.mod q.mod))) - {$bszp *} (decorate (home (interface %lead p.mod q.mod))) - {$bstc *} (decorate (home (interface %zinc p.mod q.mod))) + [%bcls *] relative(mod q.mod) + [%bcdt *] (decorate (home (interface %gold p.mod q.mod))) + [%bcfs *] (decorate (home (interface %iron p.mod q.mod))) + [%bczp *] (decorate (home (interface %lead p.mod q.mod))) + [%bctc *] (decorate (home (interface %zinc p.mod q.mod))) == -- -- @@ -8518,16 +8196,15 @@ %open open %rake rake == - =+ fab=`?`& - |_ gen/hoon + |_ gen=hoon :: ++ grip |= =skin - =| rel/wing + =| rel=wing |- ^- hoon ?- skin @ - [%tsld [%tune skin] gen] + [%tsgl [%tune skin] gen] [%base *] ?: ?=(%noun base.skin) gen @@ -8553,7 +8230,7 @@ [%note [%help help.skin] $(skin skin.skin)] :: [%name *] - [%tsld [%tune term.skin] $(skin skin.skin)] + [%tsgl [%tune term.skin] $(skin skin.skin)] :: [%over *] $(skin skin.skin, rel (weld wing.skin rel)) @@ -8564,7 +8241,7 @@ $(skin skin.skin) :: [%wash *] - :+ %tsld + :+ %tsgl :- %wing |- ^- wing ?: =(0 depth.skin) ~ @@ -8575,29 +8252,29 @@ ++ name |- ^- (unit term) ?+ gen ~ - {$wing *} ?~ p.gen ~ + [%wing *] ?~ p.gen ~ ?^ i.p.gen ?:(?=(%& -.i.p.gen) ~ q.i.p.gen) `i.p.gen - {$limb *} `p.gen - {$dbug *} $(gen ~(open ap gen)) - {$tsld *} $(gen ~(open ap gen)) - {$tsbn *} $(gen q.gen) + [%limb *] `p.gen + [%dbug *] $(gen ~(open ap gen)) + [%tsgl *] $(gen ~(open ap gen)) + [%tsgr *] $(gen q.gen) == :: ++ feck |- ^- (unit term) ?- gen - {$sand $tas @} [~ q.gen] - {$dbug *} $(gen q.gen) + [%sand %tas @] [~ q.gen] + [%dbug *] $(gen q.gen) * ~ == :: - :: not used at present; see comment at $csng in ++open + :: not used at present; see comment at %csng in ++open :::: ::++ hail -:: |= axe/axis -:: =| air/(list (pair wing hoon)) +:: |= axe=axis +:: =| air=(list (pair wing hoon)) :: |- ^+ air :: =+ hav=half :: ?~ hav [[[[%| 0 ~] [%& axe] ~] gen] air] @@ -8606,13 +8283,13 @@ ++ half |- ^- (unit (pair hoon hoon)) ?+ gen ~ - {^ *} `[p.gen q.gen] - {$dbug *} $(gen q.gen) - {$clcb *} `[q.gen p.gen] - {$clhp *} `[p.gen q.gen] - {$clkt *} `[p.gen %clls q.gen r.gen s.gen] - {$clsg *} ?~(p.gen ~ `[i.p.gen %clsg t.p.gen]) - {$cltr *} ?~ p.gen ~ + [^ *] `[p.gen q.gen] + [%dbug *] $(gen q.gen) + [%clcb *] `[q.gen p.gen] + [%clhp *] `[p.gen q.gen] + [%clkt *] `[p.gen %clls q.gen r.gen s.gen] + [%clsg *] ?~(p.gen ~ `[i.p.gen %clsg t.p.gen]) + [%cltr *] ?~ p.gen ~ ?~(t.p.gen $(gen i.p.gen) `[i.p.gen %cltr t.p.gen]) == :::: @@ -8636,7 +8313,7 @@ [%cnts [@ ~] ~] `i.p.gen :: - [%tsbn *] + [%tsgr *] %+ biff reek(gen p.gen) |= =wing (bind ^$(gen q.gen) |=(=skin [%over wing skin])) @@ -8673,16 +8350,16 @@ ++ open ^- hoon ?- gen - {~ *} [%cnts [[%& p.gen] ~] ~] + [~ *] [%cnts [[%& p.gen] ~] ~] :: - {$base *} ~(factory ax fab `spec`gen) - {$bust *} ~(example ax fab %base p.gen) - {$ktcl *} ~(factory ax fab p.gen) - {$dbug *} q.gen - {$eror *} ~>(%slog.[0 leaf/p.gen] !!) + [%base *] ~(factory ax `spec`gen) + [%bust *] ~(example ax %base p.gen) + [%ktcl *] ~(factory ax p.gen) + [%dbug *] q.gen + [%eror *] ~>(%slog.[0 leaf=p.gen] !!) :: - {$knit *} :: - :+ %tsbn [%ktts %v %$ 1] :: => v=. + [%knit *] :: + :+ %tsgr [%ktts %v %$ 1] :: => v=. :- %brhp :: |- :+ %ktls :: ^+ :- %brhp :: |- @@ -8703,33 +8380,33 @@ %a :: a :+ %ktls :: ^+ [%limb %$] :: $ - [%tsbn [%limb %v] p.i.p.gen] :: =>(v {p.i.p.gen}) - [%ktts %b res] :: b={res} + [%tsgr [%limb %v] p.i.p.gen] :: =>(v {p.i.p.gen}) + [%ktts %b res] :: b=[res] ^- hoon :: :- %brhp :: |- - :^ %wtvt :: ?@ + :^ %wtpt :: ?@ [%a ~] :: a [%limb %b] :: b - :- [%tsld [%$ 2] [%limb %a]] :: :- -.a + :- [%tsgl [%$ 2] [%limb %a]] :: :- -.a :+ %cnts :: %= [%$ ~] :: $ - [[[%a ~] [%tsld [%$ 3] [%limb %a]]] ~] :: a +.a + [[[%a ~] [%tsgl [%$ 3] [%limb %a]]] ~] :: a +.a :: - {$leaf *} ~(factory ax fab `spec`gen) - {$limb *} [%cnts [p.gen ~] ~] - {$tell *} [%cncl [%limb %noah] [%zpbn [%cltr p.gen]] ~] - {$wing *} [%cnts p.gen ~] - {$yell *} [%cncl [%limb %cain] [%zpbn [%cltr p.gen]] ~] - {$note *} q.gen + [%leaf *] ~(factory ax `spec`gen) + [%limb *] [%cnts [p.gen ~] ~] + [%tell *] [%cncl [%limb %noah] [%zpgr [%cltr p.gen]] ~] + [%wing *] [%cnts p.gen ~] + [%yell *] [%cncl [%limb %cain] [%zpgr [%cltr p.gen]] ~] + [%note *] q.gen :: - {$brbs *} =- ?~ - !! - [%brtr [%bscl -] [%ktcl body.gen]] + [%brbc *] =- ?~ - !! + [%brtr [%bccl -] [%ktcl body.gen]] %+ turn `(list term)`sample.gen |= =term ^- spec =/ tar [%base %noun] - [%bsts term [%bssg tar [%bshp tar tar]]] - {$brcb *} :+ %tsls [%kttr p.gen] + [%bcts term [%bcsg tar [%bchp tar tar]]] + [%brcb *] :+ %tsls [%kttr p.gen] :+ %brcn ~ %- ~(run by r.gen) |= =tome @@ -8738,11 +8415,11 @@ |= =hoon ?~ q.gen hoon [%tstr [p.i.q.gen ~] q.i.q.gen $(q.gen t.q.gen)] - {$brcl *} [%tsls p.gen [%brdt q.gen]] - {$brdt *} :+ %brcn ~ + [%brcl *] [%tsls p.gen [%brdt q.gen]] + [%brdt *] :+ %brcn ~ =- [[%$ ~ -] ~ ~] (~(put by *(map term hoon)) %$ p.gen) - {$brkt *} :+ %tsld [%limb %$] + [%brkt *] :+ %tsgl [%limb %$] :+ %brcn ~ =+ zil=(~(get by q.gen) %$) ?~ zil @@ -8750,28 +8427,28 @@ [*what [[%$ p.gen] ~ ~]] %+ ~(put by q.gen) %$ [p.u.zil (~(put by q.u.zil) %$ p.gen)] - {$brhp *} [%tsld [%limb %$] [%brdt p.gen]] - {$brsg *} [%ktbr [%brts p.gen q.gen]] - {$brtr *} :+ %tsls [%kttr p.gen] - :+ %brvt ~ + [%brhp *] [%tsgl [%limb %$] [%brdt p.gen]] + [%brsg *] [%ktbr [%brts p.gen q.gen]] + [%brtr *] :+ %tsls [%kttr p.gen] + :+ %brpt ~ =- [[%$ ~ -] ~ ~] (~(put by *(map term hoon)) %$ q.gen) - {$brts *} :+ %brcb p.gen + [%brts *] :+ %brcb p.gen =- [~ [[%$ ~ -] ~ ~]] (~(put by *(map term hoon)) %$ q.gen) - {$brwt *} [%ktwt %brdt p.gen] + [%brwt *] [%ktwt %brdt p.gen] :: - {$clkt *} [p.gen q.gen r.gen s.gen] - {$clls *} [p.gen q.gen r.gen] - {$clcb *} [q.gen p.gen] - {$clhp *} [p.gen q.gen] - {$clsg *} + [%clkt *] [p.gen q.gen r.gen s.gen] + [%clls *] [p.gen q.gen r.gen] + [%clcb *] [q.gen p.gen] + [%clhp *] [p.gen q.gen] + [%clsg *] |- ^- hoon ?~ p.gen [%rock %n ~] [i.p.gen $(p.gen t.p.gen)] :: - {$cltr *} + [%cltr *] |- ^- hoon ?~ p.gen [%zpzp ~] @@ -8779,53 +8456,53 @@ i.p.gen [i.p.gen $(p.gen t.p.gen)] :: - {$kttr *} [%ktsg ~(example ax fab p.gen)] - {$cncb *} [%ktls [%wing p.gen] %cnts p.gen q.gen] - {$cndt *} [%cncl q.gen [p.gen ~]] - {$cnkt *} [%cncl p.gen q.gen r.gen s.gen ~] - {$cnls *} [%cncl p.gen q.gen r.gen ~] - {$cnhp *} [%cncl p.gen q.gen ~] + [%kttr *] [%ktsg ~(example ax p.gen)] + [%cncb *] [%ktls [%wing p.gen] %cnts p.gen q.gen] + [%cndt *] [%cncl q.gen [p.gen ~]] + [%cnkt *] [%cncl p.gen q.gen r.gen s.gen ~] + [%cnls *] [%cncl p.gen q.gen r.gen ~] + [%cnhp *] [%cncl p.gen q.gen ~] :: this probably should work, but doesn't :: - :: {$cncl *} [%cntr [%$ ~] p.gen [[[[%& 6] ~] [%cltr q.gen]] ~]] - {$cncl *} [%cnsg [%$ ~] p.gen q.gen] - {$cnsg *} + :: [%cncl *] [%cntr [%$ ~] p.gen [[[[%& 6] ~] [%cltr q.gen]] ~]] + [%cncl *] [%cnsg [%$ ~] p.gen q.gen] + [%cnsg *] :: this complex matching system is a leftover from the old :: "electroplating" era. %cnsg should be removed and replaced :: with the commented-out %cncl above. but something is broken. :: :^ %cntr p.gen q.gen =+ axe=6 - |- ^- (list {wing hoon}) + |- ^- (list [wing hoon]) ?~ r.gen ~ ?~ t.r.gen [[[[%| 0 ~] [%& axe] ~] i.r.gen] ~] :- [[[%| 0 ~] [%& (peg axe 2)] ~] i.r.gen] $(axe (peg axe 3), r.gen t.r.gen) :: - {$cntr *} + [%cntr *] ?: =(~ r.gen) - [%tsbn q.gen [%wing p.gen]] + [%tsgr q.gen [%wing p.gen]] :+ %tsls q.gen :+ %cnts (weld p.gen `wing`[[%& 2] ~]) - (turn r.gen |=({p/wing q/hoon} [p [%tsbn [%$ 3] q]])) + (turn r.gen |=([p=wing q=hoon] [p [%tsgr [%$ 3] q]])) :: - {$ktdt *} [%ktls [%cncl p.gen q.gen ~] q.gen] - {$kthp *} [%ktls ~(example ax fab p.gen) q.gen] - {$ktts *} (grip(gen q.gen) p.gen) + [%ktdt *] [%ktls [%cncl p.gen q.gen ~] q.gen] + [%kthp *] [%ktls ~(example ax p.gen) q.gen] + [%ktts *] (grip(gen q.gen) p.gen) :: - {$sgbr *} - :+ %sgbn + [%sgbr *] + :+ %sggr :- %mean =+ fek=~(feck ap p.gen) ?^ fek [%rock %tas u.fek] - [%brdt [%cncl [%limb %cain] [%zpbn [%tsbn [%$ 3] p.gen]] ~]] + [%brdt [%cncl [%limb %cain] [%zpgr [%tsgr [%$ 3] p.gen]] ~]] q.gen :: - {$sgcb *} [%sgbn [%mean [%brdt p.gen]] q.gen] - {$sgcn *} - :+ %sgld + [%sgcb *] [%sggr [%mean [%brdt p.gen]] q.gen] + [%sgcn *] + :+ %sggl :- %fast :- %clls :+ [%rock %$ p.gen] @@ -8838,34 +8515,34 @@ [[[%rock %$ p.i.r.gen] [%zpts q.i.r.gen]] $(r.gen t.r.gen)] s.gen :: - {$sgnt *} [%sgcn p.gen [%$ 7] ~ q.gen] - {$sgld *} [%tsld [%sgbn p.gen [%$ 1]] q.gen] - {$sgbs *} [%sgbn [%live [%rock %$ p.gen]] q.gen] - {$sgls *} [%sgbn [%memo %rock %$ p.gen] q.gen] - {$sgpd *} - :+ %sgbn - [%slog [%sand %$ p.gen] [%cncl [%limb %cain] [%zpbn q.gen] ~]] + [%sgfs *] [%sgcn p.gen [%$ 7] ~ q.gen] + [%sggl *] [%tsgl [%sggr p.gen [%$ 1]] q.gen] + [%sgbc *] [%sggr [%live [%rock %$ p.gen]] q.gen] + [%sgls *] [%sggr [%memo %rock %$ p.gen] q.gen] + [%sgpm *] + :+ %sggr + [%slog [%sand %$ p.gen] [%cncl [%limb %cain] [%zpgr q.gen] ~]] r.gen :: - {$sgts *} [%sgbn [%germ p.gen] q.gen] - {$sgwt *} + [%sgts *] [%sggr [%germ p.gen] q.gen] + [%sgwt *] :+ %tsls [%wtdt q.gen [%bust %null] [[%bust %null] r.gen]] :^ %wtsg [%& 2]~ - [%tsbn [%$ 3] s.gen] - [%sgpd p.gen [%$ 5] [%tsbn [%$ 3] s.gen]] + [%tsgr [%$ 3] s.gen] + [%sgpm p.gen [%$ 5] [%tsgr [%$ 3] s.gen]] :: - {$mcts *} + [%mcts *] |- ?~ p.gen [%bust %null] ?- -.i.p.gen ^ [[%xray i.p.gen] $(p.gen t.p.gen)] - $manx [p.i.p.gen $(p.gen t.p.gen)] - $tape [[%mcnt p.i.p.gen] $(p.gen t.p.gen)] - $call [%cncl p.i.p.gen [$(p.gen t.p.gen)]~] - $marl =- [%cndt [p.i.p.gen $(p.gen t.p.gen)] -] + %manx [p.i.p.gen $(p.gen t.p.gen)] + %tape [[%mcfs p.i.p.gen] $(p.gen t.p.gen)] + %call [%cncl p.i.p.gen [$(p.gen t.p.gen)]~] + %marl =- [%cndt [p.i.p.gen $(p.gen t.p.gen)] -] ^- hoon :+ %tsbr [%base %cell] - :+ %brvt ~ + :+ %brpt ~ ^- (map term tome) =- [[%$ ~ -] ~ ~] ^- (map term hoon) @@ -8877,24 +8554,24 @@ [%cnts sug [[[[%& 3] ~] [%cnts [%$ ~] [[sug [%$ 25]] ~]]] ~]] == :: - {$mccl *} + [%mccl *] ?- q.gen ~ [%zpzp ~] - {* ~} i.q.gen + [* ~] i.q.gen ^ :+ %tsls p.gen =+ yex=`(list hoon)`q.gen |- ^- hoon ?- yex - {* ~} [%tsbn [%$ 3] i.yex] - {* ^} [%cncl [%$ 2] [%tsbn [%$ 3] i.yex] $(yex t.yex) ~] + [* ~] [%tsgr [%$ 3] i.yex] + [* ^] [%cncl [%$ 2] [%tsgr [%$ 3] i.yex] $(yex t.yex) ~] ~ !! == == :: - {$mcnt *} =+(zoy=[%rock %ta %$] [%clsg [zoy [%clsg [zoy p.gen] ~]] ~]) - {$mcgl *} + [%mcfs *] =+(zoy=[%rock %ta %$] [%clsg [zoy [%clsg [zoy p.gen] ~]] ~]) + [%mcgl *] :^ %cnls :+ %cnhp q.gen @@ -8904,83 +8581,83 @@ p.gen s.gen :: - {$mcsg *} :: ;~ + [%mcsg *] :: ;~ |- ^- hoon ?- q.gen ~ ~_(leaf+"open-mcsg" !!) ^ - :+ %tsbn [%ktts %v %$ 1] :: => v=. + :+ %tsgr [%ktts %v %$ 1] :: => v=. |- ^- hoon :: ?: ?=(~ t.q.gen) :: - [%tsbn [%limb %v] i.q.gen] :: =>(v {i.q.gen}) + [%tsgr [%limb %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 [%tsbn [%limb %v] i.q.gen]] :: =+ ^= b + [%ktts %b [%tsgr [%limb %v] i.q.gen]] :: =+ ^= b :+ %tsls :: =>(v {i.q.gen}) :+ %ktts %c :: =+ c=,.+6.b - :+ %tsld :: + :+ %tsgl :: [%wing [%| 0 ~] [%& 6] ~] :: [%limb %b] :: :- %brdt :: |. :^ %cnls :: %+ - [%tsbn [%limb %v] p.gen] :: =>(v {p.gen}) + [%tsgr [%limb %v] p.gen] :: =>(v {p.gen}) [%cncl [%limb %b] [%limb %c] ~] :: (b c) :+ %cnts [%a ~] :: a(,.+6 c) [[[[%| 0 ~] [%& 6] ~] [%limb %c]] ~] :: == :: :: - {$mcmc *} :: ;; - [%cnhp ~(factory ax fab p.gen) q.gen] + [%mcmc *] :: ;; + [%cnhp ~(factory ax p.gen) q.gen] :: - {$tsbr *} - [%tsls ~(example ax fab p.gen) q.gen] + [%tsbr *] + [%tsls ~(example ax p.gen) q.gen] :: - {$tstr *} - :+ %tsld + [%tstr *] + :+ %tsgl r.gen [%tune [[p.p.gen ~ ?~(q.p.gen q.gen [%kthp u.q.p.gen q.gen])] ~ ~] ~] :: - {$tscl *} - [%tsbn [%cncb [[%& 1] ~] p.gen] q.gen] + [%tscl *] + [%tsgr [%cncb [[%& 1] ~] p.gen] q.gen] :: - {$tsnt *} + [%tsfs *] [%tsls [%ktts p.gen q.gen] r.gen] :: - {$tsmc *} [%tsnt p.gen r.gen q.gen] - {$tsdt *} - [%tsbn [%cncb [[%& 1] ~] [[p.gen q.gen] ~]] r.gen] - {$tswt *} :: =? + [%tsmc *] [%tsfs p.gen r.gen q.gen] + [%tsdt *] + [%tsgr [%cncb [[%& 1] ~] [[p.gen q.gen] ~]] r.gen] + [%tswt *] :: =? [%tsdt p.gen [%wtcl q.gen r.gen [%wing p.gen]] s.gen] :: - {$tskt *} :: =^ + [%tskt *] :: =^ =+ wuy=(weld q.gen `wing`[%v ~]) :: - :+ %tsbn [%ktts %v %$ 1] :: => v=. - :+ %tsls [%ktts %a %tsbn [%limb %v] r.gen] :: =+ a==>(v \r.gen) - :^ %tsdt wuy [%tsld [%$ 3] [%limb %a]] - :+ %tsbn :- :+ %ktts [%over [%v ~] p.gen] - [%tsld [%$ 2] [%limb %a]] + :+ %tsgr [%ktts %v %$ 1] :: => v=. + :+ %tsls [%ktts %a %tsgr [%limb %v] r.gen] :: =+ a==>(v \r.gen) + :^ %tsdt wuy [%tsgl [%$ 3] [%limb %a]] + :+ %tsgr :- :+ %ktts [%over [%v ~] p.gen] + [%tsgl [%$ 2] [%limb %a]] [%limb %v] s.gen :: - {$tsld *} [%tsbn q.gen p.gen] - {$tsls *} [%tsbn [p.gen [%$ 1]] q.gen] - {$tshp *} [%tsls q.gen p.gen] - {$tssg *} + [%tsgl *] [%tsgr q.gen p.gen] + [%tsls *] [%tsgr [p.gen [%$ 1]] q.gen] + [%tshp *] [%tsls q.gen p.gen] + [%tssg *] |- ^- hoon ?~ p.gen [%$ 1] ?~ t.p.gen i.p.gen - [%tsbn i.p.gen $(p.gen t.p.gen)] + [%tsgr i.p.gen $(p.gen t.p.gen)] :: - {$wtbr *} + [%wtbr *] |- ?~(p.gen [%rock %f 1] [%wtcl i.p.gen [%rock %f 0] $(p.gen t.p.gen)]) :: - {$wtdt *} [%wtcl p.gen r.gen q.gen] - {$wtld *} [%wtcl p.gen [%zpzp ~] q.gen] - {$wtbn *} [%wtcl p.gen q.gen [%zpzp ~]] - {$wtkt *} [%wtcl [%wtts [%base %atom %$] p.gen] r.gen q.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 [%wtts [%base %atom %$] p.gen] r.gen q.gen] :: - {$wthp *} + [%wthp *] |- ?~ q.gen [%lost [%wing p.gen]] @@ -8989,34 +8666,34 @@ q.i.q.gen $(q.gen t.q.gen) :: - {$wtls *} + [%wtls *] [%wthp p.gen (weld r.gen `_r.gen`[[[%base %noun] q.gen] ~])] :: - {$wtpd *} + [%wtpm *] |- ?~(p.gen [%rock %f 0] [%wtcl i.p.gen $(p.gen t.p.gen) [%rock %f 1]]) :: - {$xray *} + [%xray *] |^ :- [(open-mane n.g.p.gen) %clsg (turn a.g.p.gen open-mart)] [%mcts c.p.gen] :: ++ open-mane - |= a/mane:hoot + |= a=mane:hoot ?@(a [%rock %tas a] [[%rock %tas -.a] [%rock %tas +.a]]) :: ++ open-mart - |= {n/mane:hoot v/(list beer:hoot)} + |= [n=mane:hoot v=(list beer:hoot)] [(open-mane n) %knit v] -- :: - {$wtvt *} [%wtcl [%wtts [%base %atom %$] p.gen] q.gen r.gen] - {$wtsg *} [%wtcl [%wtts [%base %null] p.gen] q.gen r.gen] - {$wtts *} [%fits ~(example ax fab p.gen) q.gen] - {$wtzp *} [%wtcl p.gen [%rock %f 1] [%rock %f 0]] - {$zpbn *} - [%cncl [%limb %onan] [%zpmc [%kttr [%bsmc %limb %abel]] p.gen] ~] + [%wtpt *] [%wtcl [%wtts [%base %atom %$] p.gen] q.gen r.gen] + [%wtsg *] [%wtcl [%wtts [%base %null] p.gen] q.gen r.gen] + [%wtts *] [%fits ~(example ax p.gen) q.gen] + [%wtzp *] [%wtcl p.gen [%rock %f 1] [%rock %f 0]] + [%zpgr *] + [%cncl [%limb %onan] [%zpmc [%kttr [%bcmc %limb %abel]] p.gen] ~] :: - {$zpwt *} + [%zpwt *] ?: ?: ?=(@ p.gen) (lte hoon-version p.gen) &((lte hoon-version p.p.gen) (gte hoon-version q.p.gen)) @@ -9030,16 +8707,16 @@ ++ reek ^- (unit wing) ?+ gen ~ - {~ *} `[[%& p.gen] ~] - {$limb *} `[p.gen ~] - {$wing *} `p.gen - {$cnts * ~} `p.gen - {$dbug *} reek(gen q.gen) + [~ *] `[[%& p.gen] ~] + [%limb *] `[p.gen ~] + [%wing *] `p.gen + [%cnts * ~] `p.gen + [%dbug *] reek(gen q.gen) == ++ rusk ^- term =+ wig=rake - ?. ?=({@ ~} wig) + ?. ?=([@ ~] wig) ~>(%mean.'rusk-hoon' !!) i.wig -- @@ -9054,7 +8731,6 @@ %fan fan %rib rib %vet vet - %fab fab %blow blow %burp burp %busk busk @@ -9092,15 +8768,14 @@ %toss toss %wrap wrap == - =+ :* fan=*(set {type hoon}) - rib=*(set {type type hoon}) + =+ :* fan=*(set [type hoon]) + rib=*(set [type type hoon]) vet=`?`& - fab=`?`& == =+ sut=`type`%noun |% ++ clip - |= ref/type + |= ref=type ?> ?|(!vet (nest(sut ref) & sut)) ref :: @@ -9251,7 +8926,7 @@ %name (face term.skin $(skin skin.skin)) %over $(skin skin.skin, sut (~(play ut sut) %wing wing.skin)) %spec =/ yon $(skin skin.skin) - =/ hit (~(play ut sut) ~(example ax fab spec.skin)) + =/ hit (~(play ut sut) ~(example ax spec.skin)) ?> (~(nest ut hit) & yon) hit %wash =- $(ref (~(play ut ref) -)) @@ -9341,24 +9016,12 @@ == -- :: - ++ bleu - |= {gol/type gen/hoon} - ^- {type nock} - =+ pro=(mint gol gen) - =+ jon=(apex:musk bran q.pro) - ?: |(?=(~ jon) ?=($wait -.u.jon)) - ?: &(!fab vet) - ~& %bleu-fail - !! - [p.pro q.pro] - [p.pro %1 p.u.jon] - :: ++ blow - |= {gol/type gen/hoon} - ^- {type nock} + |= [gol=type gen=hoon] + ^- [type nock] =+ pro=(mint gol gen) =+ jon=(apex:musk bran q.pro) - ?: |(?=(~ jon) ?=($wait -.u.jon)) + ?: |(?=(~ jon) ?=(%wait -.u.jon)) [p.pro q.pro] [p.pro %1 p.u.jon] :: @@ -9367,17 +9030,17 @@ =+ gil=*(set type) |- ~+ ^- seminoun:musk ?- sut - $noun [full/[~ ~ ~] ~] - $void [full/[~ ~ ~] ~] - {$atom *} ?~(q.sut [full/[~ ~ ~] ~] [full/~ u.q.sut]) - {$cell *} (combine:musk $(sut p.sut) $(sut q.sut)) - {$core *} %+ combine:musk + %noun [full/[~ ~ ~] ~] + %void [full/[~ ~ ~] ~] + [%atom *] ?~(q.sut [full/[~ ~ ~] ~] [full/~ u.q.sut]) + [%cell *] (combine:musk $(sut p.sut) $(sut q.sut)) + [%core *] %+ combine:musk p.r.q.sut $(sut p.sut) - {$face *} $(sut repo) - {$fork *} [full/[~ ~ ~] ~] - {$hint *} $(sut repo) - {$hold *} ?: (~(has in gil) sut) + [%face *] $(sut repo) + [%fork *] [full/[~ ~ ~] ~] + [%hint *] $(sut repo) + [%hold *] ?: (~(has in gil) sut) [full/[~ ~ ~] ~] $(sut repo, gil (~(put in gil) sut)) == @@ -9407,20 +9070,20 @@ :: ++ busk ~/ %busk - |= gen/hoon + |= gen=hoon ^- type [%face [~ [gen ~]] sut] :: ++ buss ~/ %buss - |= {cog/term gen/hoon} + |= [cog=term gen=hoon] ^- type [%face [[[cog ~ gen] ~ ~] ~] sut] :: ++ crop ~/ %crop - |= ref/type - =+ bix=*(set {type type}) + |= ref=type + =+ bix=*(set [type type]) =< dext |% ++ dext @@ -9433,66 +9096,66 @@ ?: =(%void ref) sut ?- sut - {$atom *} + [%atom *] ?+ ref sint - {$atom *} ?^ q.sut + [%atom *] ?^ q.sut ?^(q.ref ?:(=(q.ref q.sut) %void sut) %void) ?^(q.ref sut %void) - {$cell *} sut + [%cell *] sut == :: - {$cell *} + [%cell *] ?+ ref sint - {$atom *} sut - {$cell *} ?. (nest(sut p.ref) | p.sut) sut + [%atom *] sut + [%cell *] ?. (nest(sut p.ref) | p.sut) sut (cell p.sut dext(sut q.sut, ref q.ref)) == :: - {$core *} ?:(?=(?({$atom *} {$cell *}) ref) sut sint) - {$face *} (face p.sut dext(sut q.sut)) - {$fork *} (fork (turn ~(tap in p.sut) |=(type dext(sut +<)))) - {$hint *} (hint p.sut dext(sut q.sut)) - {$hold *} ?< (~(has in bix) [sut ref]) + [%core *] ?:(?=(?([%atom *] [%cell *]) ref) sut sint) + [%face *] (face p.sut dext(sut q.sut)) + [%fork *] (fork (turn ~(tap in p.sut) |=(type dext(sut +<)))) + [%hint *] (hint p.sut dext(sut q.sut)) + [%hold *] ?< (~(has in bix) [sut ref]) dext(sut repo, bix (~(put in bix) [sut ref])) - $noun dext(sut repo) - $void %void + %noun dext(sut repo) + %void %void == :: ++ sint ^- type ?+ ref !! - {$core *} sut - {$face *} dext(ref repo(sut ref)) - {$fork *} =+ yed=~(tap in p.ref) + [%core *] sut + [%face *] dext(ref repo(sut ref)) + [%fork *] =+ yed=~(tap in p.ref) |- ^- type ?~ yed sut $(yed t.yed, sut dext(ref i.yed)) - {$hint *} dext(ref repo(sut ref)) - {$hold *} dext(ref repo(sut ref)) + [%hint *] dext(ref repo(sut ref)) + [%hold *] dext(ref repo(sut ref)) == -- :: ++ cool - |= {pol/? hyp/wing ref/type} + |= [pol=? hyp=wing ref=type] ^- type =+ fid=(find %both hyp) ?- -.fid %| sut %& =< q %+ take p.p.fid - |=(a/type ?:(pol (fuse(sut a) ref) (crop(sut a) ref))) + |=(a=type ?:(pol (fuse(sut a) ref) (crop(sut a) ref))) == :: ++ duck ^-(tank ~(duck us sut)) ++ dune |.(duck) ++ dunk - |= paz/term ^- tank + |= paz=term ^- tank :+ %palm [['.' ~] ['-' ~] ~ ~] [[%leaf (mesc (trip paz))] duck ~] :: ++ elbo - |= {lop/palo rig/(list (pair wing hoon))} + |= [lop=palo rig=(list (pair wing hoon))] ^- type ?: ?=(%& -.q.lop) |- ^- type @@ -9517,10 +9180,10 @@ == :: ++ ergo - |= {lop/palo rig/(list (pair wing hoon))} + |= [lop=palo rig=(list (pair wing hoon))] ^- (pair type nock) =+ axe=(tend p.lop) - =| hej/(list (pair axis nock)) + =| hej=(list (pair axis nock)) ?: ?=(%& -.q.lop) =- [p.- (hike axe q.-)] |- ^- (pair type (list (pair axis nock))) @@ -9547,7 +9210,7 @@ == :: ++ endo - |= {lop/(pair palo palo) dox/type rig/(list (pair wing hoon))} + |= [lop=(pair palo palo) dox=type rig=(list (pair wing hoon))] ^- (pair type type) ?: ?=(%& -.q.p.lop) ?> ?=(%& -.q.q.lop) @@ -9589,17 +9252,17 @@ |% ++ bath * :: leg match type ++ claw * :: arm match type - ++ form |*({* *} p=+<-) :: attach build state - ++ skin |*(p/* p) :: reveal build state - ++ meat |*(p/* p) :: remove build state + ++ form |*([* *] p=+<-) :: attach build state + ++ skin |*(p=* p) :: reveal build state + ++ meat |*(p=* p) :: remove build state -- ++ make :: for mint |% ++ bath type :: leg match type ++ claw onyx :: arm - ++ form |*({* *} [p=+<- q=+<+]) :: - ++ skin |*({p/* q/*} q) :: unwrap baggage - ++ meat |*({p/* q/*} p) :: unwrap filling + ++ form |*([* *] [p=+<- q=+<+]) :: + ++ skin |*([p=* q=*] q) :: unwrap baggage + ++ meat |*([p=* q=*] p) :: unwrap filling -- -- ++ def @@ -9622,36 +9285,36 @@ |% ++ halp ^|(|:($:hoon $:fleg)) ++ vant - |% ++ trep ^|(|:($:{bath wing bath} $:{axis bath})) - ++ tasp ^|(|:($:{{axis bath} fleg foat} $:foat)) + |% ++ trep ^|(|:($:,[bath wing bath] $:,[axis bath])) + ++ tasp ^|(|:($:,[[axis bath] fleg foat] $:foat)) ++ tyle ^|(|:($:foat $:foat)) -- ++ vunt - |% ++ trep ^|(|:($:{claw wing bath} $:{axis claw})) - ++ tasp ^|(|:($:{{axis claw} fleg fult} $:fult)) + |% ++ trep ^|(|:($:,[claw wing bath] $:,[axis claw])) + ++ tasp ^|(|:($:,[[axis claw] fleg fult] $:fult)) ++ tyle ^|(|:($:fult $:foat)) -- -- :: ++ make => (def make:arc) |% - ++ halp |~ a/hoon + ++ halp |~ a=hoon ^- fleg (mint %noun a) ++ vant - |% ++ trep |: $:{a/type b/wing c/type} - ^- {axis type} + |% ++ trep |: $:,[a=type b=wing c=type] + ^- [axis type] (tack(sut a) b c) - ++ tasp |: $:{a/(pair axis type) b/fleg c/foat} + ++ tasp |: $:,[a=(pair axis type) b=fleg c=foat] ^- foat [q.a [[p.a (skin b)] (skin c)]] ++ tyle |:($:foat +<) -- ++ vunt - |% ++ trep |: $:{a/claw b/wing c/bath} + |% ++ trep |: $:,[a=claw b=wing c=bath] ^- (pair axis claw) (toss b c a) - ++ tasp |: $:{a/(pair axis claw) b/fleg c/fult} + ++ tasp |: $:,[a=(pair axis claw) b=fleg c=fult] ^- fult [q.a [[p.a (skin b)] (skin c)]] ++ tyle |: $:fult @@ -9682,7 +9345,7 @@ =+ rame |@ ++ $ => +< - |: $:{rum/clom rig/(list (pair wing hoon))} + |: $:,[rum=clom rig=(list (pair wing hoon))] ^- foat %- tyle |- ^- ceut @@ -9699,16 +9362,16 @@ => inc |% ++ echo - |: $:{rum/bath rig/(list (pair wing hoon))} + |: $:,[rum=bath rig=(list (pair wing hoon))] (ecbo rum rig) :: ++ ecmo - |: $:{hag/claw rig/(list (pair wing hoon))} + |: $:,[hag=claw rig=(list (pair wing hoon))] (eclo hag rig) -- -- :: ++ etco - |= {lop/palo rig/(list (pair wing hoon))} + |= [lop=palo rig=(list (pair wing hoon))] ^- (pair type nock) =+ cin=(oc (bin:ad make:lib:ad)) =. rig (flop rig) :: XX this unbreaks, void order in devulc @@ -9720,7 +9383,7 @@ (ecmo:cin ~(tap in q.q.lop) rig) :: ++ et - |_ {hyp/wing rig/(list (pair wing hoon))} + |_ [hyp=wing rig=(list (pair wing hoon))] :: ++ play ^- type @@ -9729,7 +9392,7 @@ (elbo p.lug rig) :: ++ mint - |= gol/type + |= gol=type ^- (pair type nock) =+ lug=(find %read hyp) ?: ?=(%| -.lug) ~>(%mean.'hoon' ?>(?=(~ rig) p.lug)) @@ -9737,8 +9400,8 @@ (etco p.lug rig) :: ++ mull - |= {gol/type dox/type} - ^- {type type} + |= [gol=type dox=type] + ^- [type type] =+ lug=[p=(find %read hyp) q=(find(sut dox) %read hyp)] ?: ?=(%| -.p.lug) ?> &(?=(%| -.q.lug) ?=(~ rig)) @@ -9750,26 +9413,26 @@ :: ++ epla ~/ %epla - |= {hyp/wing rig/(list (pair wing hoon))} + |= [hyp=wing rig=(list (pair wing hoon))] ^- type ~(play et hyp rig) :: ++ emin ~/ %emin - |= {gol/type hyp/wing rig/(list (pair wing hoon))} + |= [gol=type hyp=wing rig=(list (pair wing hoon))] ^- (pair type nock) (~(mint et hyp rig) gol) :: ++ emul ~/ %emul - |= {gol/type dox/type hyp/wing rig/(list (pair wing hoon))} + |= [gol=type dox=type hyp=wing rig=(list (pair wing hoon))] ^- (pair type type) (~(mull et hyp rig) gol dox) :: ++ felt !! :: :: ++ feel :: detect existence - |= rot/(list wing) + |= rot=(list wing) ^- ? =. rot (flop rot) |- ^- ? @@ -9791,7 +9454,7 @@ :: ++ fond ~/ %fond - |= {way/vial hyp/wing} + |= [way=vial hyp=wing] => |% ++ pony :: raw match $@ ~ :: void @@ -9828,14 +9491,14 @@ == ?: ?=(%& -.heg) [%& [`p.heg lon] %& (peek way p.heg)] - =| gil/(set type) + =| gil=(set type) =< $ |% ++ here ?: =(0 p.heg) [%& [~ `axe lon] %& sut] [%| %& (dec p.heg)] ++ lose [%| %& p.heg] ++ stop ?~(q.heg here lose) - ++ twin |= {hax/pony yor/pony} + ++ twin |= [hax=pony yor=pony] ^- pony ~_ leaf+"find-fork" ?: =(hax yor) hax @@ -9863,10 +9526,10 @@ ++ $ ^- pony ?- sut - $void ~ - $noun stop - {$atom *} stop - {$cell *} + %void ~ + %noun stop + [%atom *] stop + [%cell *] ?~ q.heg here =+ taf=$(axe (peg axe 2), sut p.sut) ?~ taf ~ @@ -9874,7 +9537,7 @@ taf $(axe (peg axe 3), p.heg p.p.taf, sut q.sut) :: - {$core *} + [%core *] ?~ q.heg here =^ zem p.heg =+ zem=(loot u.q.heg q.r.q.sut) @@ -9894,10 +9557,10 @@ ?: con.pec $(sut p.sut, axe (peg axe 3)) $(sut (peek(sut p.sut) way 2), axe (peg axe 6)) :: - {$hint *} + [%hint *] $(sut repo) :: - {$face *} + [%face *] ?: ?=(~ q.heg) here(sut q.sut) =* zot p.sut ?@ zot @@ -9925,9 +9588,9 @@ =+ tiv=(mint(sut q.sut) %noun i.q.zot) =+ fid=^$(sut p.tiv, lon ~, axe 1, gil ~) ?~ fid ~ - ?: ?=({%| %& *} fid) + ?: ?=([%| %& *] fid) $(q.zot t.q.zot, p.heg p.p.fid) - =/ vat/(pair type nock) + =/ vat=(pair type nock) ?- -.fid %& (fine %& p.fid) %| (fine %| p.p.fid) @@ -9935,14 +9598,14 @@ [%| %| p.vat (comb (comb [%0 axe] q.tiv) q.vat)] -- :: - {$fork *} - =+ wiz=(turn ~(tap in p.sut) |=(a/type ^$(sut a))) + [%fork *] + =+ wiz=(turn ~(tap in p.sut) |=(a=type ^$(sut a))) ?~ wiz ~ |- ^- pony ?~ t.wiz i.wiz (twin i.wiz $(wiz t.wiz)) :: - {$hold *} + [%hold *] ?: (~(has in gil) sut) ~ $(gil (~(put in gil) sut), sut repo) @@ -9952,7 +9615,7 @@ :: ++ find ~/ %find - |= {way/vial hyp/wing} + |= [way=vial hyp=wing] ^- port ~_ (show [%c %find] %l hyp) =- ?@ - !! @@ -9966,7 +9629,7 @@ :: ++ fund ~/ %fund - |= {way/vial gen/hoon} + |= [way=vial gen=hoon] ^- port =+ hup=~(reek ap gen) ?~ hup @@ -9975,7 +9638,7 @@ :: ++ fine ~/ %fine - |= tor/port + |= tor=port ^- (pair type nock) ?- -.tor %| p.tor @@ -9986,28 +9649,27 @@ == == :: ++ fire - |= hag/(list {p/type q/foot}) + |= hag=(list [p=type q=foot]) ^- type - ?: ?=({{* {$wet ~ $1}} ~} hag) + ?: ?=([[* [%wet ~ %1]] ~] hag) p.i.hag %- fork %+ turn hag.$ - |= {p/type q/foot} - ?. ?=({$core *} p) + |= [p=type q=foot] + ?. ?=([%core *] p) ~_ (dunk %fire-type) ~_ leaf+"expected-fork-to-be-core" ~_ (dunk(sut p) %fork-type) ~>(%mean.'fire-core' !!) :- %hold =+ dox=[%core q.q.p q.p(r.p %gold)] - ?: ?=($dry -.q) + ?: ?=(%dry -.q) :: ~_ (dunk(sut [%cell q.q.p p.p]) %fire-dry) ?> ?|(!vet (nest(sut q.q.p) & p.p)) [dox p.q] - ?> ?=($wet -.q) + ?> ?=(%wet -.q) :: ~_ (dunk(sut [%cell q.q.p p.p]) %fire-wet) - :: =. p.p ?:(fab p.p (redo(sut p.p) q.q.p)) =. p.p (redo(sut p.p) q.q.p) ?> ?| !vet (~(has in rib) [sut dox p.q]) @@ -10017,27 +9679,27 @@ :: ++ fish ~/ %fish - |= axe/axis + |= axe=axis =+ vot=*(set type) |- ^- nock ?- sut - $void [%1 1] - $noun [%1 0] - {$atom *} ?~ q.sut + %void [%1 1] + %noun [%1 0] + [%atom *] ?~ q.sut (flip [%3 %0 axe]) [%5 [%1 u.q.sut] [%0 axe]] - {$cell *} + [%cell *] %+ flan [%3 %0 axe] (flan $(sut p.sut, axe (peg axe 2)) $(sut q.sut, axe (peg axe 3))) :: - {$core *} ~>(%mean.'fish-core' !!) - {$face *} $(sut q.sut) - {$fork *} =+ yed=~(tap in p.sut) + [%core *] ~>(%mean.'fish-core' !!) + [%face *] $(sut q.sut) + [%fork *] =+ yed=~(tap in p.sut) |- ^- nock ?~(yed [%1 1] (flor ^$(sut i.yed) $(yed t.yed))) - {$hint *} $(sut q.sut) - {$hold *} + [%hint *] $(sut q.sut) + [%hold *] ?: (~(has in vot) sut) ~>(%mean.'fish-loop' !!) => %=(. vot (~(put in vot) sut)) @@ -10046,15 +9708,15 @@ :: ++ fuse ~/ %fuse - |= ref/type - =+ bix=*(set {type type}) + |= ref=type + =+ bix=*(set [type type]) |- ^- type ?: ?|(=(sut ref) =(%noun ref)) sut ?- sut - {$atom *} + [%atom *] ?- ref - {$atom *} =+ foc=?:((fitz p.ref p.sut) p.sut p.ref) + [%atom *] =+ foc=?:((fitz p.ref p.sut) p.sut p.ref) ?^ q.sut ?^ q.ref ?: =(q.sut q.ref) @@ -10062,71 +9724,68 @@ %void [%atom foc q.sut] [%atom foc q.ref] - {$cell *} %void + [%cell *] %void * $(sut ref, ref sut) == - {$cell *} + [%cell *] ?- ref - {$cell *} (cell $(sut p.sut, ref p.ref) $(sut q.sut, ref q.ref)) + [%cell *] (cell $(sut p.sut, ref p.ref) $(sut q.sut, ref q.ref)) * $(sut ref, ref sut) == :: - {$core *} $(sut repo) - {$face *} (face p.sut $(sut q.sut)) - {$fork *} (fork (turn ~(tap in p.sut) |=(type ^$(sut +<)))) - {$hint *} (hint p.sut $(sut q.sut)) - {$hold *} + [%core *] $(sut repo) + [%face *] (face p.sut $(sut q.sut)) + [%fork *] (fork (turn ~(tap in p.sut) |=(type ^$(sut +<)))) + [%hint *] (hint p.sut $(sut q.sut)) + [%hold *] ?: (~(has in bix) [sut ref]) ~>(%mean.'fuse-loop' !!) $(sut repo, bix (~(put in bix) [sut ref])) :: - $noun ref - $void %void + %noun ref + %void %void == :: ++ gain ~/ %gain - |= gen/hoon ^- type + |= gen=hoon ^- type (chip & gen) :: ++ hemp :: generate formula from foot :: - |= [hud/poly gol/type gen/hoon] + |= [hud=poly gol=type gen=hoon] ^- nock ~+ =+ %hemp-141 ?- hud - $dry q:(mint gol gen) - $wet q:(mint(vet |) gol gen) + %dry q:(mint gol gen) + %wet q:(mint(vet |) gol gen) == :: ++ laze :: produce lazy core generator for static execution :: |= [nym=(unit term) hud=poly dom=(map term tome)] - :: only one layer of fabrication analysis - :: - =. fab & ~+ ^- seminoun =+ %hemp-141 :: tal: map from battery axis to foot :: - =; tal/(map @ud hoon) + =; tal=(map @ud hoon) :: produce lazy battery :: :_ ~ :+ %lazy 1 - |= axe/@ud + |= axe=@ud ^- (unit noun) %+ bind (~(get by tal) axe) - |= gen/hoon + |= gen=hoon %. [hud %noun gen] hemp(sut (core sut [nym hud %gold] sut [[%lazy 1 ..^$] ~] dom)) :: %- ~(gas by *(map @ud hoon)) - =| yeb/(list (pair @ud hoon)) + =| yeb=(list (pair @ud hoon)) =+ axe=1 |^ ?- dom ~ yeb @@ -10150,7 +9809,7 @@ yeb (chapter(axe (peg axe 2)) q.q.n.dom) == == == ++ chapter - |= dab/(map term hoon) + |= dab=(map term hoon) ^+ yeb ?- dab ~ yeb @@ -10177,15 +9836,15 @@ :: ++ lose ~/ %lose - |= gen/hoon ^- type + |= gen=hoon ^- type (chip | gen) :: ++ chip ~/ %chip - |= {how/? gen/hoon} ^- type - ?: ?=({$wtts *} gen) - (cool how q.gen (play ~(example ax fab p.gen))) - ?: ?=({$wthx *} gen) + |= [how=? gen=hoon] ^- type + ?: ?=([%wtts *] gen) + (cool how q.gen (play ~(example ax p.gen))) + ?: ?=([%wthx *] gen) =+ (play %wing q.gen) ~> %slog.[0 [%leaf "chipping"]] ?: how @@ -10194,15 +9853,15 @@ - ~(gain ar - p.gen) ~(lose ar - p.gen) - ?: ?&(how ?=({$wtpd *} gen)) + ?: ?&(how ?=([%wtpm *] gen)) |-(?~(p.gen sut $(p.gen t.p.gen, sut ^$(gen i.p.gen)))) - ?: ?&(!how ?=({$wtbr *} gen)) + ?: ?&(!how ?=([%wtbr *] gen)) |-(?~(p.gen sut $(p.gen t.p.gen, sut ^$(gen i.p.gen)))) =+ neg=~(open ap gen) ?:(=(neg gen) sut $(gen neg)) :: ++ bake - |= [dox/type hud/poly dab/(map term hoon)] + |= [dox=type hud=poly dab=(map term hoon)] ^- * ?: ?=(~ dab) ~ @@ -10210,27 +9869,27 @@ :: this seems wrong but it's actually right :: ?- hud - $dry (mull %noun dox q.n.dab) - $wet ~ + %dry (mull %noun dox q.n.dab) + %wet ~ == ?- dab - {* ~ ~} dov - {* ~ *} [dov $(dab r.dab)] - {* * ~} [dov $(dab l.dab)] - {* * *} [dov $(dab l.dab) $(dab r.dab)] + [* ~ ~] dov + [* ~ *] [dov $(dab r.dab)] + [* * ~] [dov $(dab l.dab)] + [* * *] [dov $(dab l.dab) $(dab r.dab)] == :: ++ balk - |= [dox/type hud/poly dom/(map term tome)] + |= [dox=type hud=poly dom=(map term tome)] ^- * ?: ?=(~ dom) ~ =+ dov=(bake dox hud q.q.n.dom) ?- dom - {* ~ ~} dov - {* ~ *} [dov $(dom r.dom)] - {* * ~} [dov $(dom l.dom)] - {* * *} [dov $(dom l.dom) $(dom r.dom)] + [* ~ ~] dov + [* ~ *] [dov $(dom r.dom)] + [* * ~] [dov $(dom l.dom)] + [* * *] [dov $(dom l.dom) $(dom r.dom)] == :: ++ mile @@ -10246,7 +9905,7 @@ ++ mine :: mint all chapters and feet in a core :: - |= [gol/type mel/vair nym/(unit term) hud/poly dom/(map term tome)] + |= [gol=type mel=vair nym=(unit term) hud=poly dom=(map term tome)] ^- (pair type nock) |^ =/ log (chapters-check (core-check gol)) @@ -10258,8 +9917,8 @@ |- ^- ?(~ ^) ?: ?=(~ dom) ~ - =/ dov/?(~ ^) - =/ dab/(map term hoon) q.q.n.dom + =/ dov=?(~ ^) + =/ dab=(map term hoon) q.q.n.dom =/ dag (arms-check dab (get-arms dog p.n.dom)) |- ^- ?(~ ^) ?: ?=(~ dab) @@ -10267,16 +9926,16 @@ =/ gog (get-arm-type log dag p.n.dab) =+ vad=(hemp hud gog q.n.dab) ?- dab - {* ~ ~} vad - {* ~ *} [vad $(dab r.dab)] - {* * ~} [vad $(dab l.dab)] - {* * *} [vad $(dab l.dab) $(dab r.dab)] + [* ~ ~] vad + [* ~ *] [vad $(dab r.dab)] + [* * ~] [vad $(dab l.dab)] + [* * *] [vad $(dab l.dab) $(dab r.dab)] == ?- dom - {* ~ ~} dov - {* ~ *} [dov $(dom r.dom)] - {* * ~} [dov $(dom l.dom)] - {* * *} [dov $(dom l.dom) $(dom r.dom)] + [* ~ ~] dov + [* ~ *] [dov $(dom r.dom)] + [* * ~] [dov $(dom l.dom)] + [* * *] [dov $(dom l.dom) $(dom r.dom)] == :: :: all the below arms are used for gol checking and should have no @@ -10348,7 +10007,7 @@ |= [dog=(unit (map term tome)) nam=term] ^- (unit (map term hoon)) %+ bind dog - |= a/(map term tome) + |= a=(map term tome) ~_ leaf+"unexpcted-chapter.{(trip nam)}" q:(~(got by a) nam) :: check we have the expected number of arms @@ -10394,60 +10053,59 @@ :: ++ mint ~/ %mint - |= {gol/type gen/hoon} - ^- {p/type q/nock} + |= [gol=type gen=hoon] + ^- [p=type q=nock] ::~& %pure-mint - |^ ^- {p/type q/nock} - ?: ?&(=(%void sut) !?=({$dbug *} gen)) - ?. |(!vet ?=({$lost *} gen) ?=({$zpzp *} gen)) + |^ ^- [p=type q=nock] + ?: ?&(=(%void sut) !?=([%dbug *] gen)) + ?. |(!vet ?=([%lost *] gen) ?=([%zpzp *] gen)) ~>(%mean.'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)] :: - {$ktcn *} $(fab |, gen p.gen) - {$brcn *} (grow %gold p.gen %dry [%$ 1] q.gen) - {$brvt *} (grow %gold p.gen %wet [%$ 1] q.gen) + [%brcn *] (grow %gold p.gen %dry [%$ 1] q.gen) + [%brpt *] (grow %gold p.gen %wet [%$ 1] q.gen) :: - {$cnts *} (~(mint et p.gen q.gen) gol) + [%cnts *] (~(mint et p.gen q.gen) gol) :: - {$dtkt *} + [%dtkt *] =+ nef=$(gen [%kttr p.gen]) [p.nef [%12 [%1 %151 p.nef] q:$(gen q.gen, gol %noun)]] :: - {$dtls *} [(nice [%atom %$ ~]) [%4 q:$(gen p.gen, gol [%atom %$ ~])]] - {$sand *} [(nice (play gen)) [%1 q.gen]] - {$rock *} [(nice (play gen)) [%1 q.gen]] + [%dtls *] [(nice [%atom %$ ~]) [%4 q:$(gen p.gen, gol [%atom %$ ~])]] + [%sand *] [(nice (play gen)) [%1 q.gen]] + [%rock *] [(nice (play gen)) [%1 q.gen]] :: - {$dttr *} + [%dttr *] [(nice %noun) [%2 q:$(gen p.gen, gol %noun) q:$(gen q.gen, gol %noun)]] :: - {$dtts *} + [%dtts *] =+ [one two]=[$(gen p.gen, gol %noun) $(gen q.gen, gol %noun)] [(nice bool) [%5 q:$(gen p.gen, gol %noun) q:$(gen q.gen, gol %noun)]] :: - {$dtwt *} [(nice bool) [%3 q:$(gen p.gen, gol %noun)]] - {$hand *} [p.gen q.gen] - {$ktbr *} =+(vat=$(gen p.gen) [(nice (wrap(sut p.vat) %iron)) q.vat]) + [%dtwt *] [(nice bool) [%3 q:$(gen p.gen, gol %noun)]] + [%hand *] [p.gen q.gen] + [%ktbr *] =+(vat=$(gen p.gen) [(nice (wrap(sut p.vat) %iron)) q.vat]) :: - {$ktls *} + [%ktls *] =+(hif=(nice (play p.gen)) [hif q:$(gen q.gen, gol hif)]) :: - {$ktpd *} =+(vat=$(gen p.gen) [(nice (wrap(sut p.vat) %zinc)) q.vat]) - {$ktsg *} (blow gol p.gen) - {$tune *} [(face p.gen sut) [%0 %1]] - {$ktwt *} =+(vat=$(gen p.gen) [(nice (wrap(sut p.vat) %lead)) q.vat]) + [%ktpm *] =+(vat=$(gen p.gen) [(nice (wrap(sut p.vat) %zinc)) q.vat]) + [%ktsg *] (blow gol p.gen) + [%tune *] [(face p.gen sut) [%0 %1]] + [%ktwt *] =+(vat=$(gen p.gen) [(nice (wrap(sut p.vat) %lead)) q.vat]) :: - {$note *} + [%note *] =+ hum=$(gen q.gen) [(hint [sut p.gen] p.hum) q.hum] :: - {$sgzp *} ~_(duck(sut (play p.gen)) $(gen q.gen)) - {$sgbn *} + [%sgzp *] ~_(duck(sut (play p.gen)) $(gen q.gen)) + [%sggr *] =+ hum=$(gen q.gen) :: ?: &(huz !?=(%|(@ [?(%sgcn %sgls) ^]) p.gen)) :: hum @@ -10459,15 +10117,15 @@ == q.hum :: - {$tsbn *} + [%tsgr *] =+ fid=$(gen p.gen, gol %noun) =+ dov=$(sut p.fid, gen q.gen) [p.dov (comb q.fid q.dov)] :: - {$tscm *} + [%tscm *] $(gen q.gen, sut (busk p.gen)) :: - {$wtcl *} + [%wtcl *] =+ nor=$(gen p.gen, gol bool) =+ fex=(gain p.gen) =+ wux=(lose p.gen) @@ -10479,14 +10137,14 @@ =+ ran=$(sut wux, gen r.gen) [(fork p.hiq p.ran ~) (cond duy q.hiq q.ran)] :: - {$wthx *} + [%wthx *] :- (nice bool) =+ fid=(find %read [[%& 1] q.gen]) ~> %mean.'mint-fragment' ?> &(?=(%& -.fid) ?=(%& -.q.p.fid)) (~(fish ar `type`p.q.p.fid `skin`p.gen) (tend p.p.fid)) :: - {$fits *} + [%fits *] :- (nice bool) =+ ref=(play p.gen) =+ fid=(find %read q.gen) @@ -10500,24 +10158,24 @@ %| [%7 q.p.fid (fish(sut ref) 1)] == :: - {$dbug *} + [%dbug *] ~_ (show %o p.gen) =+ hum=$(gen q.gen) [p.hum [%11 [%spot %1 p.gen] q.hum]] :: - {$zpcm *} [(nice (play p.gen)) [%1 q.gen]] :: XX validate! - {$lost *} + [%zpcm *] [(nice (play p.gen)) [%1 q.gen]] :: XX validate! + [%lost *] ?: vet ~_ (dunk(sut (play p.gen)) 'lost') ~>(%mean.'mint-lost' !!) [%void [%0 0]] :: - {$zpmc *} + [%zpmc *] =+ vos=$(gol %noun, gen q.gen) =+ ref=p:$(gol %noun, gen p.gen) [(nice (cell ref p.vos)) (cons [%1 burp(sut p.vos)] q.vos)] :: - {$zpld *} + [%zpgl *] =/ typ (nice (play [%kttr p.gen])) =/ val =< q @@ -10526,18 +10184,18 @@ gen :^ %wtcl :+ %cncl [%limb %levi] - :~ [%tsbn [%zpbn [%kttr p.gen]] [%$ 2]] - [%tsbn q.gen [%$ 2]] + :~ [%tsgr [%zpgr [%kttr p.gen]] [%$ 2]] + [%tsgr q.gen [%$ 2]] == - [%tsbn q.gen [%$ 3]] + [%tsgr q.gen [%$ 3]] [%zpzp ~] == [typ val] :: - {$zpts *} [(nice %noun) [%1 q:$(vet |, gen p.gen)]] - {$zpvt *} ?:((feel p.gen) $(gen q.gen) $(gen r.gen)) + [%zpts *] [(nice %noun) [%1 q:$(vet |, gen p.gen)]] + [%zppt *] ?:((feel p.gen) $(gen q.gen) $(gen r.gen)) :: - {$zpzp ~} [%void [%0 0]] + [%zpzp ~] [%void [%0 0]] * =+ doz=~(open ap gen) ?: =(doz gen) @@ -10547,14 +10205,14 @@ == :: ++ nice - |= typ/type + |= typ=type ~_ leaf+"mint-nice" ?> ?|(!vet (nest(sut gol) & typ)) typ :: ++ grow - |= {mel/vair nym/(unit term) hud/poly ruf/hoon dom/(map term tome)} - ^- {p/type q/nock} + |= [mel=vair nym=(unit term) hud=poly ruf=hoon dom=(map term tome)] + ^- [p=type q=nock] =+ dan=^$(gen ruf, gol %noun) =+ pul=(mine gol mel nym hud dom) [(nice p.pul) (cons q.pul q.dan)] @@ -10564,82 +10222,81 @@ =+ gil=*(set type) |- ^- ? ?- sut - {$atom *} | - {$cell *} |($(sut p.sut) $(sut q.sut)) - {$core *} $(sut p.sut) - {$face *} $(sut q.sut) - {$fork *} (levy ~(tap in p.sut) |=(type ^$(sut +<))) - {$hint *} $(sut q.sut) - {$hold *} |((~(has in gil) sut) $(gil (~(put in gil) sut), sut repo)) - $noun | - $void & + [%atom *] | + [%cell *] |($(sut p.sut) $(sut q.sut)) + [%core *] $(sut p.sut) + [%face *] $(sut q.sut) + [%fork *] (levy ~(tap in p.sut) |=(type ^$(sut +<))) + [%hint *] $(sut q.sut) + [%hold *] |((~(has in gil) sut) $(gil (~(put in gil) sut), sut repo)) + %noun | + %void & == :: ++ mull ~/ %mull - |= {gol/type dox/type gen/hoon} - |^ ^- {p/type q/type} + |= [gol=type dox=type gen=hoon] + |^ ^- [p=type q=type] ?: =(%void sut) ~>(%mean.'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)] :: - {$ktcn *} $(fab |, gen p.gen) - {$brcn *} (grow %gold p.gen %dry [%$ 1] q.gen) - {$brvt *} (grow %gold p.gen %wet [%$ 1] q.gen) - {$cnts *} (~(mull et p.gen q.gen) gol dox) - {$dtkt *} =+($(gen q.gen, gol %noun) $(gen [%kttr p.gen])) - {$dtls *} =+($(gen p.gen, gol [%atom %$ ~]) (beth [%atom %$ ~])) - {$sand *} (beth (play gen)) - {$rock *} (beth (play gen)) + [%brcn *] (grow %gold p.gen %dry [%$ 1] q.gen) + [%brpt *] (grow %gold p.gen %wet [%$ 1] q.gen) + [%cnts *] (~(mull et p.gen q.gen) gol dox) + [%dtkt *] =+($(gen q.gen, gol %noun) $(gen [%kttr p.gen])) + [%dtls *] =+($(gen p.gen, gol [%atom %$ ~]) (beth [%atom %$ ~])) + [%sand *] (beth (play gen)) + [%rock *] (beth (play gen)) :: - {$dttr *} + [%dttr *] =+([$(gen p.gen, gol %noun) $(gen q.gen, gol %noun)] (beth %noun)) :: - {$dtts *} + [%dtts *] =+([$(gen p.gen, gol %noun) $(gen q.gen, gol %noun)] (beth bool)) :: - {$dtwt *} =+($(gen p.gen, gol %noun) (beth bool)) :: XX =| - {$hand *} [p.gen p.gen] - {$ktbr *} + [%dtwt *] =+($(gen p.gen, gol %noun) (beth bool)) :: XX =| + [%hand *] [p.gen p.gen] + [%ktbr *] =+(vat=$(gen p.gen) [(wrap(sut p.vat) %iron) (wrap(sut q.vat) %iron)]) :: - {$ktls *} + [%ktls *] =+ hif=[p=(nice (play p.gen)) q=(play(sut dox) p.gen)] =+($(gen q.gen, gol p.hif) hif) :: - {$ktpd *} + [%ktpm *] =+(vat=$(gen p.gen) [(wrap(sut p.vat) %zinc) (wrap(sut q.vat) %zinc)]) :: - {$tune *} + [%tune *] [(face p.gen sut) (face p.gen dox)] :: - {$ktwt *} + [%ktwt *] =+(vat=$(gen p.gen) [(wrap(sut p.vat) %lead) (wrap(sut q.vat) %lead)]) :: - {$note *} + [%note *] =+ vat=$(gen q.gen) [(hint [sut p.gen] p.vat) (hint [dox p.gen] q.vat)] :: - {$ktsg *} $(gen p.gen) - {$sgzp *} ~_(duck(sut (play p.gen)) $(gen q.gen)) - {$sgbn *} $(gen q.gen) - {$tsbn *} + [%ktsg *] $(gen p.gen) + [%sgzp *] ~_(duck(sut (play p.gen)) $(gen q.gen)) + [%sggr *] $(gen q.gen) + [%tsgr *] =+ lem=$(gen p.gen, gol %noun) $(gen q.gen, sut p.lem, dox q.lem) :: - {$tscm *} + [%tscm *] =/ boc (busk p.gen) =/ nuf (busk(sut dox) p.gen) $(gen q.gen, sut boc, dox nuf) :: - {$wtcl *} + [%wtcl *] =+ nor=$(gen p.gen, gol bool) - =+ ^= hiq ^- {p/type q/type} + =+ ^= hiq ^- [p=type q=type] =+ fex=[p=(gain p.gen) q=(gain(sut dox) p.gen)] ?: =(%void p.fex) :- %void @@ -10649,7 +10306,7 @@ ?: =(%void q.fex) ~>(%mean.'mull-bonk-b' !!) $(sut p.fex, dox q.fex, gen q.gen) - =+ ^= ran ^- {p/type q/type} + =+ ^= ran ^- [p=type q=type] =+ wux=[p=(lose p.gen) q=(lose(sut dox) p.gen)] ?: =(%void p.wux) :- %void @@ -10661,7 +10318,7 @@ $(sut p.wux, dox q.wux, gen r.gen) [(nice (fork p.hiq p.ran ~)) (fork q.hiq q.ran ~)] :: - {$fits *} + [%fits *] =+ waz=[p=(play p.gen) q=(play(sut dox) p.gen)] =+ ^= syx :- p=(cove q:(mint %noun [%wing q.gen])) q=(cove q:(mint(sut dox) %noun [%wing q.gen])) @@ -10670,7 +10327,7 @@ ~>(%mean.'mull-bonk-a' !!) (beth bool) :: - {$wthx *} + [%wthx *] ~> %mean.'mull-bonk-x' =+ :- =+ (find %read [[%& 1] q.gen]) ?> &(?=(%& -.-) ?=(%& -.q.p.-)) @@ -10682,25 +10339,25 @@ ?> (nest(sut type.old) & type.new) (beth bool) :: - {$dbug *} ~_((show %o p.gen) $(gen q.gen)) - {$zpcm *} [(nice (play p.gen)) (play(sut dox) p.gen)] - {$lost *} + [%dbug *] ~_((show %o p.gen) $(gen q.gen)) + [%zpcm *] [(nice (play p.gen)) (play(sut dox) p.gen)] + [%lost *] ?: vet :: ~_ (dunk(sut (play p.gen)) 'also') ~>(%mean.'mull-skip' !!) (beth %void) :: - {$zpts *} (beth %noun) + [%zpts *] (beth %noun) :: - {$zpmc *} + [%zpmc *] =+ vos=$(gol %noun, gen q.gen) :: XX validate! [(nice (cell (play p.gen) p.vos)) (cell (play(sut dox) p.gen) q.vos)] :: - {$zpld *} + [%zpgl *] :: XX is this right? (beth (play [%kttr p.gen])) :: - {$zpvt *} + [%zppt *] =+ [(feel p.gen) (feel(sut dox) p.gen)] ?. =(-< ->) ~>(%mean.'mull-bonk-f' !!) @@ -10708,7 +10365,7 @@ $(gen q.gen) $(gen r.gen) :: - {$zpzp *} (beth %void) + [%zpzp *] (beth %void) * =+ doz=~(open ap gen) ?: =(doz gen) @@ -10718,11 +10375,11 @@ == :: ++ beth - |= typ/type + |= typ=type [(nice typ) typ] :: ++ nice - |= typ/type + |= typ=type :: ~_ (dunk(sut gol) 'need') :: ~_ (dunk(sut typ) 'have') ~_ leaf+"mull-nice" @@ -10730,25 +10387,25 @@ typ :: ++ grow - |= {mel/vair nym/(unit term) hud/poly ruf/hoon dom/(map term tome)} + |= [mel=vair nym=(unit term) hud=poly ruf=hoon dom=(map term tome)] :: make al ~_ leaf+"mull-grow" - ^- {p/type q/type} + ^- [p=type q=type] =+ dan=^$(gen ruf, gol %noun) =+ yaz=(mile(sut p.dan) q.dan mel nym hud dom) [(nice p.yaz) q.yaz] -- - ++ meet |=(ref/type &((nest | ref) (nest(sut ref) | sut))) + ++ meet |=(ref=type &((nest | ref) (nest(sut ref) | sut))) :: :: ++ miss :: nonintersection |= $: :: ref: symmetric type :: - ref/type + ref=type == :: intersection of sut and ref is empty :: ^- ? - =| gil/(set (set type)) + =| gil=(set (set type)) =< dext |% ++ dext @@ -10757,16 +10414,16 @@ ?: =(ref sut) (nest(sut %void) | sut) ?- sut - $void & - $noun (nest(sut %void) | ref) - {$atom *} sint - {$cell *} sint - {$core *} sint(sut [%cell %noun %noun]) - {$fork *} %+ levy ~(tap in p.sut) + %void & + %noun (nest(sut %void) | ref) + [%atom *] sint + [%cell *] sint + [%core *] sint(sut [%cell %noun %noun]) + [%fork *] %+ levy ~(tap in p.sut) |=(type dext(sut +<)) - {$face *} dext(sut q.sut) - {$hint *} dext(sut q.sut) - {$hold *} =+ (~(gas in *(set type)) `(list type)`[sut ref ~]) + [%face *] dext(sut q.sut) + [%hint *] dext(sut q.sut) + [%hold *] =+ (~(gas in *(set type)) `(list type)`[sut ref ~]) ?: (~(has in gil) -) & %= dext @@ -10775,29 +10432,29 @@ == == ++ sint ?+ ref dext(sut ref, ref sut) - {$atom *} ?. ?=({$atom *} sut) & + [%atom *] ?. ?=([%atom *] sut) & ?& ?=(^ q.ref) ?=(^ q.sut) !=(q.ref q.sut) == - {$cell *} ?. ?=({$cell *} sut) & + [%cell *] ?. ?=([%cell *] sut) & ?| dext(sut p.sut, ref p.ref) dext(sut q.sut, ref q.ref) == == -- - ++ mite |=(ref/type |((nest | ref) (nest(sut ref) & sut))) + ++ mite |=(ref=type |((nest | ref) (nest(sut ref) & sut))) ++ nest ~/ %nest - |= {tel/? ref/type} - =| $: seg/(set type) :: degenerate sut - reg/(set type) :: degenerate ref - gil/(set {p/type q/type}) :: assume nest + |= [tel=? ref=type] + =| $: seg=(set type) :: degenerate sut + reg=(set type) :: degenerate ref + gil=(set [p=type q=type]) :: assume nest == =< dext ~% %nest-in ..$ ~ |% ++ deem - |= {mel/vair ram/vair} + |= [mel=vair ram=vair] ^- ? ?. |(=(mel ram) =(%lead mel) =(%gold ram)) | ?- mel @@ -10808,8 +10465,8 @@ == :: ++ deep - |= $: dom/(map term tome) - vim/(map term tome) + |= $: dom=(map term tome) + vim=(map term tome) == ^- ? ?: ?=(~ dom) =(vim ~) @@ -10843,17 +10500,17 @@ !! ?: =(sut ref) & ?- sut - $void sint - $noun & - {$atom *} ?. ?=({$atom *} ref) sint + %void sint + %noun & + [%atom *] ?. ?=([%atom *] ref) sint ?& (fitz p.sut p.ref) |(?=(~ q.sut) =(q.sut q.ref)) == - {$cell *} ?. ?=({$cell *} ref) sint + [%cell *] ?. ?=([%cell *] ref) sint ?& dext(sut p.sut, ref p.ref, seg ~, reg ~) dext(sut q.sut, ref q.ref, seg ~, reg ~) == - {$core *} ?. ?=({$core *} ref) sint + [%core *] ?. ?=([%core *] ref) sint ?: =(q.sut q.ref) dext(sut p.sut, ref p.ref) ?& =(q.p.q.sut q.p.q.ref) :: same wet/dry meet(sut q.q.sut, ref p.sut) @@ -10868,11 +10525,11 @@ ref ref(p q.q.ref, r.p.q %gold) == == == - {$face *} dext(sut q.sut) - {$fork *} ?. ?=(?({$atom *} $noun {$cell *} {$core *}) ref) sint + [%face *] dext(sut q.sut) + [%fork *] ?. ?=(?([%atom *] %noun [%cell *] [%core *]) ref) sint (lien ~(tap in p.sut) |=(type dext(tel |, sut +<))) - {$hint *} dext(sut q.sut) - {$hold *} ?: (~(has in seg) sut) | + [%hint *] dext(sut q.sut) + [%hold *] ?: (~(has in seg) sut) | ?: (~(has in gil) [sut ref]) & %= dext sut repo @@ -10884,15 +10541,15 @@ ++ sint ^- ? ?- ref - $noun | - $void & - {$atom *} | - {$cell *} | - {$core *} dext(ref repo(sut ref)) - {$face *} dext(ref q.ref) - {$fork *} (levy ~(tap in p.ref) |=(type dext(ref +<))) - {$hint *} dext(ref q.ref) - {$hold *} ?: (~(has in reg) ref) & + %noun | + %void & + [%atom *] | + [%cell *] | + [%core *] dext(ref repo(sut ref)) + [%face *] dext(ref q.ref) + [%fork *] (levy ~(tap in p.ref) |=(type dext(ref +<))) + [%hint *] dext(ref q.ref) + [%hold *] ?: (~(has in reg) ref) & ?: (~(has in gil) [sut ref]) & %= dext ref repo(sut ref) @@ -10903,7 +10560,7 @@ :: ++ peek ~/ %peek - |= {way/?($read $rite $both $free) axe/axis} + |= [way=?(%read %rite %both %free) axe=axis] ^- type ?: =(1 axe) sut @@ -10911,9 +10568,9 @@ =+ gil=*(set type) |- ^- type ?- sut - {$atom *} %void - {$cell *} ?:(=(2 now) ^$(sut p.sut, axe lat) ^$(sut q.sut, axe lat)) - {$core *} + [%atom *] %void + [%cell *] ?:(=(2 now) ^$(sut p.sut, axe lat) ^$(sut q.sut, axe lat)) + [%core *] ?. =(3 now) %noun =+ pec=(peel way r.p.q.sut) =/ tow @@ -10934,79 +10591,78 @@ ?.(con.pec %noun ^$(sut p.sut, axe 3)) == :: - {$fork *} (fork (turn ~(tap in p.sut) |=(type ^$(sut +<)))) - {$hold *} + [%fork *] (fork (turn ~(tap in p.sut) |=(type ^$(sut +<)))) + [%hold *] ?: (~(has in gil) sut) %void $(gil (~(put in gil) sut), sut repo) :: - $void %void - $noun %noun + %void %void + %noun %noun * $(sut repo) == :: ++ peel - |= {way/vial met/?($gold $iron $lead $zinc)} - ^- {sam/? con/?} - ?: ?=($gold met) [& &] + |= [way=vial met=?(%gold %iron %lead %zinc)] + ^- [sam=? con=?] + ?: ?=(%gold met) [& &] ?- way - $both [| |] - $free [& &] - $read [?=($zinc met) |] - $rite [?=($iron met) |] + %both [| |] + %free [& &] + %read [?=(%zinc met) |] + %rite [?=(%iron met) |] == :: ++ play ~/ %play => .(vet |) - |= gen/hoon + |= gen=hoon ^- type ?- gen - {^ *} (cell $(gen p.gen) $(gen q.gen)) - {$ktcn *} $(fab |, gen p.gen) - {$brcn *} (core sut [p.gen %dry %gold] sut *seminoun q.gen) - {$brvt *} (core sut [p.gen %wet %gold] sut *seminoun q.gen) - {$cnts *} ~(play et p.gen q.gen) - {$dtkt *} $(gen [%kttr p.gen]) - {$dtls *} [%atom %$ ~] - {$rock *} |- ^- type + [^ *] (cell $(gen p.gen) $(gen q.gen)) + [%brcn *] (core sut [p.gen %dry %gold] sut *seminoun q.gen) + [%brpt *] (core sut [p.gen %wet %gold] sut *seminoun q.gen) + [%cnts *] ~(play et p.gen q.gen) + [%dtkt *] $(gen [%kttr p.gen]) + [%dtls *] [%atom %$ ~] + [%rock *] |- ^- type ?@ q.gen [%atom p.gen `q.gen] [%cell $(q.gen -.q.gen) $(q.gen +.q.gen)] - {$sand *} ?@ q.gen + [%sand *] ?@ q.gen ?: =(%n p.gen) ?>(=(0 q.gen) [%atom p.gen `q.gen]) ?: =(%f p.gen) ?>((lte q.gen 1) bool) [%atom p.gen ~] $(-.gen %rock) - {$tune *} (face p.gen sut) - {$dttr *} %noun - {$dtts *} bool - {$dtwt *} bool - {$hand *} p.gen - {$ktbr *} (wrap(sut $(gen p.gen)) %iron) - {$ktls *} $(gen p.gen) - {$ktpd *} (wrap(sut $(gen p.gen)) %zinc) - {$ktsg *} $(gen p.gen) - {$ktwt *} (wrap(sut $(gen p.gen)) %lead) - {$note *} (hint [sut p.gen] $(gen q.gen)) - {$sgzp *} ~_(duck(sut ^$(gen p.gen)) $(gen q.gen)) - {$sgbn *} $(gen q.gen) - {$tsbn *} $(gen q.gen, sut $(gen p.gen)) - {$tscm *} $(gen q.gen, sut (busk p.gen)) - {$wtcl *} =+ [fex=(gain p.gen) wux=(lose p.gen)] + [%tune *] (face p.gen sut) + [%dttr *] %noun + [%dtts *] bool + [%dtwt *] bool + [%hand *] p.gen + [%ktbr *] (wrap(sut $(gen p.gen)) %iron) + [%ktls *] $(gen p.gen) + [%ktpm *] (wrap(sut $(gen p.gen)) %zinc) + [%ktsg *] $(gen p.gen) + [%ktwt *] (wrap(sut $(gen p.gen)) %lead) + [%note *] (hint [sut p.gen] $(gen q.gen)) + [%sgzp *] ~_(duck(sut ^$(gen p.gen)) $(gen q.gen)) + [%sggr *] $(gen q.gen) + [%tsgr *] $(gen q.gen, sut $(gen p.gen)) + [%tscm *] $(gen q.gen, sut (busk 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)) == - {$fits *} bool - {$wthx *} bool - {$dbug *} ~_((show %o p.gen) $(gen q.gen)) - {$zpcm *} $(gen p.gen) - {$lost *} %void - {$zpmc *} (cell $(gen p.gen) $(gen q.gen)) - {$zpld *} (play [%kttr p.gen]) - {$zpts *} %noun - {$zpvt *} ?:((feel p.gen) $(gen q.gen) $(gen r.gen)) - {$zpzp *} %void + [%fits *] bool + [%wthx *] bool + [%dbug *] ~_((show %o p.gen) $(gen q.gen)) + [%zpcm *] $(gen p.gen) + [%lost *] %void + [%zpmc *] (cell $(gen p.gen) $(gen q.gen)) + [%zpgl *] (play [%kttr p.gen]) + [%zpts *] %noun + [%zppt *] ?:((feel p.gen) $(gen q.gen) $(gen r.gen)) + [%zpzp *] %void * =+ doz=~(open ap gen) ?: =(doz gen) ~_ (show [%c 'hoon'] [%q gen]) @@ -11018,7 +10674,7 @@ ++ redo :: refurbish faces |= $: :: ref: raw payload :: - ref/type + ref=type == :: :type: subject refurbished to reference namespace :: @@ -11027,9 +10683,9 @@ :: wec: reference tool stack set :: gil: repetition set :: - =| hos/(list tool) - =/ wec/(set (list tool)) [~ ~ ~] - =| gil/(set (pair type type)) + =| hos=(list tool) + =/ wec=(set (list tool)) [~ ~ ~] + =| gil=(set (pair type type)) =< :: errors imply subject/reference mismatch :: ~| %redo-match @@ -11047,7 +10703,7 @@ ?~ wec `~ :: any reference faces must be clear :: - ?. ?=({* ~ ~} wec) + ?. ?=([* ~ ~] wec) ~& [%dear-many wec] ~ :- ~ @@ -11069,8 +10725,8 @@ :: almost always 0. brute force is fine. :: =/ lip - =| lup/(unit @ud) - =| lip/@ud + =| lup=(unit @ud) + =| lip=@ud |- ^- @ud ?: |((gth lip p.len) (gth lip q.len)) (fall lup 0) @@ -11095,22 +10751,22 @@ :: check for trivial cases :: ?: ?| =(sut ref) - ?=(?($noun $void {?($atom $core) *}) ref) + ?=(?(%noun %void [?(%atom %core) *]) ref) == done :: ~_ (dunk 'redo: dext: sut') :: ~_ (dunk(sut ref) 'redo: dext: ref') ?- sut - ?($noun $void {?($atom $core) *}) + ?(%noun %void [?(%atom %core) *]) :: reduce reference and reassemble leaf :: done:(sint &) :: - {$cell *} + [%cell *] :: reduce reference to match subject :: => (sint &) - ?> ?=({$cell *} sut) + ?> ?=([%cell *] sut) :: leaf with possible recursive descent :: %= done @@ -11127,26 +10783,26 @@ dext(sut q.sut, ref (peek(sut ref) %free 3)) == :: - {$face *} + [%face *] :: push face on subject stack, and descend :: dext(hos [p.sut hos], sut q.sut) :: - {$hint *} + [%hint *] :: work through hint :: (hint p.sut dext(sut q.sut)) :: - {$fork *} + [%fork *] :: reconstruct each case in fork :: (fork (turn ~(tap in p.sut) |=(type dext(sut +<)))) :: - {$hold *} + [%hold *] :: reduce to hard :: => (sint |) - ?> ?=({$hold *} sut) + ?> ?=([%hold *] sut) ?: (~(has in fan) [p.sut q.sut]) :: repo loop; redo depends on its own product :: @@ -11185,7 +10841,7 @@ ++ sint :: reduce by reference |= $: :: hod: expand holds :: - hod/? + hod=? == :: ::.: reference with face/fork/hold reduced :: @@ -11195,8 +10851,8 @@ :: ~> %slog.[0 (dunk(sut =>(- ref)) 'sint: pro')] :: - ?+ ref . - {$hint *} $(ref q.ref) - {$face *} + [%hint *] $(ref q.ref) + [%face *] :: extend all stacks in set :: %= $ @@ -11204,7 +10860,7 @@ wec (~(run in wec) |=((list tool) [p.ref +<])) == :: - {$fork *} + [%fork *] :: reconstruct all relevant cases :: =- :: ~> %slog.[0 (dunk 'fork: sut')] @@ -11225,7 +10881,7 @@ =/ dis ^$(ref i.moy) [(~(uni in p.mor) wec.dis) [ref.dis q.mor]] :: - {$hold *} + [%hold *] ?. hod . $(ref repo(sut ref)) == @@ -11234,28 +10890,28 @@ ++ repo ^- type ?- sut - {$core *} [%cell %noun p.sut] - {$face *} q.sut - {$hint *} q.sut - {$hold *} (rest [[p.sut q.sut] ~]) - $noun (fork [%atom %$ ~] [%cell %noun %noun] ~) + [%core *] [%cell %noun p.sut] + [%face *] q.sut + [%hint *] q.sut + [%hold *] (rest [[p.sut q.sut] ~]) + %noun (fork [%atom %$ ~] [%cell %noun %noun] ~) * ~>(%mean.'repo-fltt' !!) == :: ++ rest ~/ %rest - |= leg/(list {p/type q/hoon}) + |= leg=(list [p=type q=hoon]) ^- type - ?: (lien leg |=({p/type q/hoon} (~(has in fan) [p q]))) + ?: (lien leg |=([p=type q=hoon] (~(has in fan) [p q]))) ~>(%mean.'rest-loop' !!) => .(fan (~(gas in fan) leg)) %- fork %~ tap in %- ~(gas in *(set type)) - (turn leg |=({p/type q/hoon} (play(sut p) q))) + (turn leg |=([p=type q=hoon] (play(sut p) q))) :: ++ take - |= {vit/vein duz/$-(type type)} + |= [vit=vein duz=$-(type type)] ^- (pair axis type) :- (tend vit) =. vit (flop vit) @@ -11264,10 +10920,10 @@ ?~ i.vit |- ^- type ?+ sut ^$(vit t.vit) - {$face *} (face p.sut ^$(vit t.vit, sut q.sut)) - {$hint *} (hint p.sut ^$(sut q.sut)) - {$fork *} (fork (turn ~(tap in p.sut) |=(type ^$(sut +<)))) - {$hold *} $(sut repo) + [%face *] (face p.sut ^$(vit t.vit, sut q.sut)) + [%hint *] (hint p.sut ^$(sut q.sut)) + [%fork *] (fork (turn ~(tap in p.sut) |=(type ^$(sut +<)))) + [%hold *] $(sut repo) == =+ vil=*(set type) |- ^- type @@ -11275,42 +10931,42 @@ ^$(vit t.vit) =+ [now lat]=(cap u.i.vit)^(mas u.i.vit) ?- sut - $noun $(sut [%cell %noun %noun]) - $void %void - {$atom *} %void - {$cell *} ?: =(2 now) + %noun $(sut [%cell %noun %noun]) + %void %void + [%atom *] %void + [%cell *] ?: =(2 now) (cell $(sut p.sut, u.i.vit lat) q.sut) (cell p.sut $(sut q.sut, u.i.vit lat)) - {$core *} ?: =(2 now) + [%core *] ?: =(2 now) $(sut repo) (core $(sut p.sut, u.i.vit lat) q.sut) - {$face *} (face p.sut $(sut q.sut)) - {$fork *} (fork (turn ~(tap in p.sut) |=(type ^$(sut +<)))) - {$hint *} (hint p.sut $(sut q.sut)) - {$hold *} ?: (~(has in vil) sut) + [%face *] (face p.sut $(sut q.sut)) + [%fork *] (fork (turn ~(tap in p.sut) |=(type ^$(sut +<)))) + [%hint *] (hint p.sut $(sut q.sut)) + [%hold *] ?: (~(has in vil) sut) %void $(sut repo, vil (~(put in vil) sut)) == :: ++ tack - |= {hyp/wing mur/type} + |= [hyp=wing mur=type] ~_ (show [%c %tack] %l hyp) =+ fid=(find %rite hyp) ?> ?=(%& -.fid) (take p.p.fid |=(type mur)) :: ++ tend - |= vit/vein + |= vit=vein ^- axis ?~(vit 1 (peg $(vit t.vit) ?~(i.vit 1 u.i.vit))) :: ++ toss ~/ %toss - |= {hyp/wing mur/type men/(list {p/type q/foot})} - ^- {p/axis q/(list {p/type q/foot})} + |= [hyp=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})} + |- ^- [p=(unit axis) q=(list [p=type q=foot])] ?~ men [*(unit axis) ~] =+ geq=(tack(sut p.i.men) hyp mur) @@ -11319,45 +10975,45 @@ :: ++ wrap ~/ %wrap - |= yoz/?($lead $iron $zinc) + |= yoz=?(%lead %iron %zinc) ~_ leaf+"wrap" ^- type ?+ sut sut - {$cell *} (cell $(sut p.sut) $(sut q.sut)) - {$core *} ?>(|(=(%gold r.p.q.sut) =(%lead yoz)) sut(r.p.q yoz)) - {$face *} (face p.sut $(sut q.sut)) - {$fork *} (fork (turn ~(tap in p.sut) |=(type ^$(sut +<)))) - {$hint *} (hint p.sut $(sut q.sut)) - {$hold *} $(sut repo) + [%cell *] (cell $(sut p.sut) $(sut q.sut)) + [%core *] ?>(|(=(%gold r.p.q.sut) =(%lead yoz)) sut(r.p.q yoz)) + [%face *] (face p.sut $(sut q.sut)) + [%fork *] (fork (turn ~(tap in p.sut) |=(type ^$(sut +<)))) + [%hint *] (hint p.sut $(sut q.sut)) + [%hold *] $(sut repo) == -- ++ us :: prettyprinter => |% - ++ cape {p/(map @ud wine) q/wine} :: - ++ wine :: - $@ $? $noun :: - $path :: - $type :: - $void :: - $wall :: - $wool :: - $yarn :: + +$ cape [p=(map @ud wine) q=wine] :: + +$ wine :: + $@ $? %noun :: + %path :: + %type :: + %void :: + %wall :: + %wool :: + %yarn :: == :: - $% {$mato p/term} :: - {$core p/(list @ta) q/wine} :: - {$face p/term q/wine} :: - {$list p/term q/wine} :: - {$pear p/term q/@} :: - {$bswt p/(list wine)} :: - {$plot p/(list wine)} :: - {$stop p/@ud} :: - {$tree p/term q/wine} :: - {$unit p/term q/wine} :: + $% [%mato p=term] :: + [%core p=(list @ta) q=wine] :: + [%face p=term q=wine] :: + [%list p=term q=wine] :: + [%pear p=term q=@] :: + [%bcwt p=(list wine)] :: + [%plot p=(list wine)] :: + [%stop p=@ud] :: + [%tree p=term q=wine] :: + [%unit p=term q=wine] :: == :: -- - |_ sut/type + |_ sut=type ++ dash - |= {mil/tape lim/char lam/tape} + |= [mil=tape lim=char lam=tape] ^- tape =/ esc (~(gas in *(set @tD)) lam) :- lim @@ -11372,32 +11028,32 @@ [i.mil $(mil t.mil)] ['\\' ~(x ne (rsh 2 1 i.mil)) ~(x ne (end 2 1 i.mil)) $(mil t.mil)] :: - ++ deal |=(lum/* (dish dole lum)) + ++ deal |=(lum=* (dish dole lum)) ++ dial - |= ham/cape + |= ham=cape =+ gid=*(set @ud) =< `tank`-:$ |% ++ many - |= haz/(list wine) - ^- {(list tank) (set @ud)} + |= haz=(list wine) + ^- [(list tank) (set @ud)] ?~ haz [~ gid] =^ mor gid $(haz t.haz) =^ dis gid ^$(q.ham i.haz) [[dis mor] gid] :: ++ $ - ^- {tank (set @ud)} + ^- [tank (set @ud)] ?- q.ham - $noun :_(gid [%leaf '*' ~]) - $path :_(gid [%leaf '/' ~]) - $type :_(gid [%leaf '#' 't' ~]) - $void :_(gid [%leaf '#' '!' ~]) - $wool :_(gid [%leaf '*' '"' '"' ~]) - $wall :_(gid [%leaf '*' '\'' '\'' ~]) - $yarn :_(gid [%leaf '"' '"' ~]) - {$mato *} :_(gid [%leaf '@' (trip p.q.ham)]) - {$core *} + %noun :_(gid [%leaf '*' ~]) + %path :_(gid [%leaf '/' ~]) + %type :_(gid [%leaf '#' 't' ~]) + %void :_(gid [%leaf '#' '!' ~]) + %wool :_(gid [%leaf '*' '"' '"' ~]) + %wall :_(gid [%leaf '*' '\'' '\'' ~]) + %yarn :_(gid [%leaf '"' '"' ~]) + [%mato *] :_(gid [%leaf '@' (trip p.q.ham)]) + [%core *] =^ cox gid $(q.ham q.q.ham) :_ gid :+ %rose @@ -11406,26 +11062,26 @@ ?~ p.q.ham [cox ~] [[%leaf (rip 3 i.p.q.ham)] $(p.q.ham t.p.q.ham)] :: - {$face *} + [%face *] =^ cox gid $(q.ham q.q.ham) :_(gid [%palm [['=' ~] ~ ~ ~] [%leaf (trip p.q.ham)] cox ~]) :: - {$list *} + [%list *] =^ cox gid $(q.ham q.q.ham) :_(gid [%rose [" " (weld (trip p.q.ham) "(") ")"] cox ~]) :: - {$bswt *} + [%bcwt *] =^ coz gid (many p.q.ham) :_(gid [%rose [[' ' ~] ['?' '(' ~] [')' ~]] coz]) :: - {$plot *} + [%plot *] =^ coz gid (many p.q.ham) :_(gid [%rose [[' ' ~] ['[' ~] [']' ~]] coz]) :: - {$pear *} + [%pear *] :_(gid [%leaf '%' ~(rend co [%$ p.q.ham q.q.ham])]) :: - {$stop *} + [%stop *] =+ num=~(rend co [%$ %ud p.q.ham]) ?: (~(has in gid) p.q.ham) :_(gid [%leaf '#' num]) @@ -11436,26 +11092,26 @@ == :_(gid [%palm [['.' ~] ~ ~ ~] [%leaf ['^' '#' num]] cox ~]) :: - {$tree *} + [%tree *] =^ cox gid $(q.ham q.q.ham) :_(gid [%rose [" " (weld (trip p.q.ham) "(") ")"] cox ~]) :: - {$unit *} + [%unit *] =^ cox gid $(q.ham q.q.ham) :_(gid [%rose [" " (weld (trip p.q.ham) "(") ")"] cox ~]) == -- :: ++ dish !: - |= {ham/cape lum/*} ^- tank + |= [ham=cape lum=*] ^- tank ~| [%dish-h ?@(q.ham q.ham -.q.ham)] ~| [%lump lum] ~| [%ham ham] %- need - =| gil/(set {@ud *}) + =| gil=(set [@ud *]) |- ^- (unit tank) ?- q.ham - $noun + %noun %= $ q.ham ?: ?=(@ lum) @@ -11465,7 +11121,7 @@ [%noun ?:(?=(@ +.lum) [[%mato %$] ~] $(lum +.lum))] == :: - $path + %path :- ~ :+ %rose [['/' ~] ['/' ~] ~] @@ -11475,7 +11131,7 @@ ?> ?=(@ -.lum) [[%leaf (rip 3 -.lum)] $(lum +.lum)] :: - $type + %type =+ tyr=|.((dial dole)) =+ vol=tyr(sut lum) =+ cis=;;(tank .*(vol [%9 2 %0 1])) @@ -11483,7 +11139,7 @@ [~ ~ ~ ~] [[%leaf '#' 't' '/' ~] cis ~] :: - $wall + %wall :- ~ :+ %rose [[' ' ~] ['<' '|' ~] ['|' '>' ~]] @@ -11492,7 +11148,7 @@ ?@ lum !! [[%leaf (trip ;;(@ -.lum))] $(lum +.lum)] :: - $wool + %wool :- ~ :+ %rose [[' ' ~] ['<' '<' ~] ['>' '>' ~]] @@ -11501,25 +11157,25 @@ ?@ lum !! [(need ^$(q.ham %yarn, lum -.lum)) $(lum +.lum)] :: - $yarn + %yarn [~ %leaf (dash (tape lum) '"' "\{")] :: - $void + %void ~ :: - {$mato *} + [%mato *] ?. ?=(@ lum) ~ :+ ~ %leaf ?+ (rash p.q.ham ;~(sfix (cook crip (star low)) (star hig))) ~(rend co [%$ p.q.ham lum]) - $$ ~(rend co [%$ %ud lum]) - $t (dash (rip 3 lum) '\'' ~) - $tas ['%' ?.(=(0 lum) (rip 3 lum) ['$' ~])] + %$ ~(rend co [%$ %ud lum]) + %t (dash (rip 3 lum) '\'' ~) + %tas ['%' ?.(=(0 lum) (rip 3 lum) ['$' ~])] == :: - {$core *} + [%core *] :: XX needs rethinking for core metal :: ?. ?=(^ lum) ~ :: => .(lum `*`lum) @@ -11533,13 +11189,13 @@ :: ?~(mur ~ [~ [[%leaf (rip 3 i.p.q.ham)] u.mur]]) [~ (dial ham)] :: - {$face *} + [%face *] =+ wal=$(q.ham q.q.ham) ?~ wal ~ [~ %palm [['=' ~] ~ ~ ~] [%leaf (trip p.q.ham)] u.wal ~] :: - {$list *} + [%list *] ?: =(~ lum) [~ %leaf '~' ~] =- ?~ tok @@ -11554,7 +11210,7 @@ ~ [~ u.for u.aft] :: - {$bswt *} + [%bcwt *] |- ^- (unit tank) ?~ p.q.ham ~ @@ -11563,7 +11219,7 @@ $(p.q.ham t.p.q.ham) wal :: - {$plot *} + [%plot *] =- ?~ tok ~ [~ %rose [[' ' ~] ['[' ~] [']' ~]] u.tok] @@ -11571,7 +11227,7 @@ |- ^- (unit (list tank)) ?~ p.q.ham ~ - ?: ?=({* ~} p.q.ham) + ?: ?=([* ~] p.q.ham) =+ wal=^$(q.ham i.p.q.ham) ?~(wal ~ [~ [u.wal ~]]) ?@ lum @@ -11584,25 +11240,25 @@ ~ [~ u.gim u.myd] :: - {$pear *} + [%pear *] ?. =(lum q.q.ham) ~ =. p.q.ham (rash p.q.ham ;~(sfix (cook crip (star low)) (star hig))) =+ fox=$(q.ham [%mato p.q.ham]) - ?> ?=({~ $leaf ^} fox) - ?: ?=(?($n $tas) p.q.ham) + ?> ?=([~ %leaf ^] fox) + ?: ?=(?(%n %tas) p.q.ham) fox [~ %leaf '%' p.u.fox] :: - {$stop *} + [%stop *] ?: (~(has in gil) [p.q.ham lum]) ~ =+ kep=(~(get by p.ham) p.q.ham) ?~ kep ~|([%stop-loss p.q.ham] !!) $(gil (~(put in gil) [p.q.ham lum]), q.ham u.kep) :: - {$tree *} + [%tree *] =- ?~ tok ~ [~ %rose [[' ' ~] ['{' ~] ['}' ~]] u.tok] @@ -11611,7 +11267,7 @@ |- ^- (unit (list tank)) ?: =(~ lum) [~ tuk] - ?. ?=({n/* l/* r/*} lum) + ?. ?=([n=* l=* r=*] lum) ~ =+ rol=$(lum r.lum) ?~ rol @@ -11621,7 +11277,7 @@ ~ $(lum l.lum, tuk [u.tim u.rol]) :: - {$unit *} + [%unit *] ?@ lum ?.(=(~ lum) ~ [~ %leaf '~' ~]) ?. =(~ -.lum) @@ -11633,17 +11289,17 @@ == :: ++ doge - |= ham/cape + |= ham=cape =- ?+ woz woz - {$list * {$mato $'ta'}} %path - {$list * {$mato $'t'}} %wall - {$list * {$mato $'tD'}} %yarn - {$list * $yarn} %wool + [%list * [%mato %'ta']] %path + [%list * [%mato %'t']] %wall + [%list * [%mato %'tD']] %yarn + [%list * %yarn] %wool == ^= woz ^- wine - ?. ?=({$stop *} q.ham) - ?: ?& ?= {$bswt {$pear $n $0} {$plot {$pear $n $0} {$face *} ~} ~} + ?. ?=([%stop *] q.ham) + ?: ?& ?= [%bcwt [%pear %n %0] [%plot [%pear %n %0] [%face *] ~] ~] q.ham =(1 (met 3 p.i.t.p.i.t.p.q.ham)) == @@ -11653,13 +11309,13 @@ ?~ may q.ham =+ nul=[%pear %n 0] - ?. ?& ?=({$bswt *} u.may) - ?=({* * ~} p.u.may) + ?. ?& ?=([%bcwt *] u.may) + ?=([* * ~] p.u.may) |(=(nul i.p.u.may) =(nul i.t.p.u.may)) == q.ham =+ din=?:(=(nul i.p.u.may) i.t.p.u.may i.p.u.may) - ?: ?& ?=({$plot {$face *} {$face * $stop *} ~} din) + ?: ?& ?=([%plot [%face *] [%face * %stop *] ~] din) =(p.q.ham p.q.i.t.p.din) =(1 (met 3 p.i.p.din)) =(1 (met 3 p.i.t.p.din)) @@ -11667,10 +11323,10 @@ :+ %list (cat 3 p.i.p.din p.i.t.p.din) q.i.p.din - ?: ?& ?= $: $plot - {$face *} - {$face * $stop *} - {{$face * $stop *} ~} + ?: ?& ?= $: %plot + [%face *] + [%face * %stop *] + [[%face * %stop *] ~] == din =(p.q.ham p.q.i.t.p.din) @@ -11692,28 +11348,28 @@ =+ gil=*(set type) =+ dex=[p=*(map type @) q=*(map @ wine)] =< [q.p q] - |- ^- {p/{p/(map type @) q/(map @ wine)} q/wine} + |- ^- [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} + ^- [p=[p=(map type @) q=(map @ wine)] q=wine] ?: (~(meet ut sut) -:!>(*type)) [dex %type] ?- sut - $noun [dex sut] - $void [dex sut] - {$atom *} [dex ?~(q.sut [%mato p.sut] [%pear p.sut u.q.sut])] - {$cell *} + %noun [dex sut] + %void [dex sut] + [%atom *] [dex ?~(q.sut [%mato p.sut] [%pear p.sut u.q.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 ~]) + ?:(?=([%plot *] q.yon) [q.hin p.q.yon] [q.hin q.yon ~]) :: - {$core *} + [%core *] =+ yad=$(sut p.sut) :- p.yad - =+ ^= doy ^- {p/(list @ta) q/wine} - ?: ?=({$core *} q.yad) + =+ ^= doy ^- [p=(list @ta) q=wine] + ?: ?=([%core *] q.yad) [p.q.yad q.q.yad] [~ q.yad] :- %core @@ -11725,7 +11381,7 @@ %- ~(rep by (~(run by q.r.q.sut) |=(tome ~(wyt by q.+<)))) |=([[@ a=@u] b=@u] (add a b)) %^ cat 3 - ?-(r.p.q.sut $gold '.', $iron '|', $lead '?', $zinc '&') + ?-(r.p.q.sut %gold '.', %iron '|', %lead '?', %zinc '&') =+ gum=(mug q.r.q.sut) %+ can 3 :~ [1 (add 'a' (mod gum 26))] @@ -11733,24 +11389,24 @@ [1 (add 'a' (mod (div gum 676) 26))] == :: - {$hint *} + [%hint *] $(sut q.sut) :: - {$face *} + [%face *] =+ yad=$(sut q.sut) ?^(p.sut yad [p.yad [%face p.sut q.yad]]) :: - {$fork *} + [%fork *] =+ yed=(sort ~(tap in p.sut) aor) - =- [p [%bswt q]] - |- ^- {p/{p/(map type @) q/(map @ wine)} q/(list wine)} + =- [p [%bcwt q]] + |- ^- [p=[p=(map type @) q=(map @ wine)] q=(list wine)] ?~ yed [dex ~] =+ mor=$(yed t.yed) =+ dis=^$(dex p.mor, sut i.yed) [p.dis q.dis q.mor] :: - {$hold *} + [%hold *] =+ hey=(~(get by p.dex) sut) ?^ hey [dex [%stop u.hey]] @@ -11774,286 +11430,30 @@ (~(nest ut a) & b) :: ++ text :: tape pretty-print - |= vax/vase ^- tape + |= vax=vase ^- tape ~(ram re (sell vax)) :: -++ seem |=(toy/typo `type`toy) :: promote typo -++ seer |=(vix/vise `vase`vix) :: promote vise +++ seem |=(toy=typo `type`toy) :: promote typo +++ seer |=(vix=vise `vase`vix) :: promote vise :: :: +sell Pretty-print a vase to a tank using `deal`. :: ++ sell ~/ %sell - |= vax/vase + |= vax=vase ^- tank ~| %sell (~(deal us p.vax) q.vax) :: -:: These are the public types for the `xray` library. Analysing a type -:: yields an `ximage`, and everything else here is just some structure -:: within that. -:: -:: `ximage`s can be printed as specs (hoon syntax for types), and can -:: be used to pretty-print typed data. -:: -:: |% -:: -:: An `xtable` is a graph of types referenced by the top-level type, -:: and the `root` `key` points to the node which corresponds to the -:: type under analysis. -:: -+$ ximage [root=xkey =xtable] -:: -:: A `xkey` is just an identifier for a node in the xray graph. -:: -+$ xkey @ -:: -:: An `xtable` is the xray graph itself. It contains one node for for -:: the type that was analyzed and one node for every type referenced -:: within that type. -:: -:: The `next` field is the the next available xkey (used when inserting -:: new xrays), `xrays` maps keys to graph nodes and `type-map` gives -:: the xkey corresponding to a type. -:: -:: The `type-map` is basically just the reverse of the `xrays` map. It -:: doesn't contain any new information, but is needed for performance -:: reasons. -:: -+$ xtable [next=xkey xrays=(map xkey xray) =type=(map type xkey)] -:: -:: An `xray` is a node in the `ximage` graph. It contains everything -:: we know about a certain `type`. `key` is its identifier in the graph, -:: `type` is the type that it's an xray of, and `xdat` is the basic -:: information we derived about the type. The basic references to other -:: nodes are inside the `xdat` structure, though some of the other -:: fields may contain references as well. -:: -:: - `xshape` is some more information about the xshape of data within -:: a cell. -:: - `xrole` expands on `xshape`, adding further information about the -:: xrole that a node has within a fork. -:: - `pats` is used for printing data: we want to know if this type -:: can be printed as a list, as json, as a tape literal, etc. -:: - `recipes` contains information about how a type was -:: constructed. It's used to get much nicer output when printing types. -:: - `studs` contains "standards names". I actually don't know what this is. -:: - `helps` contains all the documentation about a type. -:: - `loop` indicates whether or not a node references itself. The list -:: type is cyclical, for example. This is used when printing an -:: `ximage`. -:: -+$ xray - $: =xkey - =type - xdat=(unit xdat) - xrole=(unit xrole) - pats=(unit xpat) - studs=(set stud) - recipes=(set recipe) - helps=(set help) - xshape=(unit xshape) - loop=(unit ?) - == -:: -:: - `%void` -- impossible to create. -:: - `%noun` -- could be any noun. -:: - `%atom` -- An atom of some aura, possibly constant -:: - `%cell` -- A cell with a head and a tail. -:: - `%core` -- A core, its garb, its context type, and the types of -:: each of its arms. -:: - `%face` -- A face on another type. -:: - `%fork` -- Could be one or more other types. -:: - `%pntr` -- This is an internal hack, it should never survive -:: analysis; ignore. -:: -+$ xdat - $@ ?(%noun %void) - $% [%atom =aura constant=(unit @)] - [%cell head=xkey tail=xkey] - [%core =garb xray=xkey batt=xbat] - [%face face=$@(term tune) xray=xkey] - [%fork =(set xkey)] - [%pntr xray=xkey] - == -:: -:: The basic xshape of a type: -:: -:: - `%void` -- impossible to create. -:: - `%noun` -- could be any noun. -:: - `%atom` -- always some type of atom; never a cell -:: - `%cell` -- always some type of cell; never an atom. -:: - `%junc` -- is a fork of a cell type and an atom type. -:: -+$ xshape ?(%void %noun %atom %cell %junc) -:: -:: A `xrole` is the of a type, including a more refined understanding -:: of what xrole it plays within a fork. -:: -:: Nodes referenced within a `xrole` often do not actually exist in the -:: original type, since we need to reorganize forks in order to make -:: them more coherent. -:: -:: - `%void` -- impossible to create. -:: - `%noun` -- could be any noun. -:: - `%atom` -- always some type of atom; never a cell -:: - `%constant` -- a cell type whose head is a constant atom. -:: - `%tall` -- a cell type whose head is an atom. -:: - `%wide` -- a cell type whose head is also a cell -:: - `%instance` -- a cell type whose head is a constant atom. -:: - `%option` -- a union of types which are all constant atoms. -:: - `%union` -- a union of types which are all instances (cells whose -:: head is a constant atom). -:: - `%junction` -- a union of an atom type and a cell type. -:: - `%conjunction` -- a union of two cell types, one of them %wide -:: and the other %tall. -:: - `%misjunction` -- any other union type. There's no efficient way -:: to tell which branch to take when analyzing a fork which is a -:: %misjunction, and the type is probably improperly constructed. -:: -+$ xrole - $@ $? %void %noun %atom %tall %wide == - $% [%constant =atom] - [%instance =atom] - [%option =(map atom xkey)] - [%union =(map atom xkey)] - [%junction flat=xkey deep=xkey] - [%conjunction wide=xkey tall=xkey] - [%misjunction one=xkey two=xkey] - == -:: -:: This is just a utility type, it encodes the "battery" structure -:: within a core. -:: -:: It's a map from chapter names to the documentation and arms within -:: that chapter. -:: -+$ xbat (map term (pair what (map term xkey))) -:: -:: A recipe tells us how a type was constructed. -:: -:: - `%direct` is a simple type like `term`, or `xray`. -:: - `%synthetic` is a constructed type, like `(list @)`. -:: -+$ recipe - $% [%direct =term] - [%synthetic =term =(list xkey)] - == -:: -:: A `xpat` is high-level information about the shape of a type. This -:: is used for printing data. -:: -:: This is fairly heuristic. [%a %b %c ~] is recognized as a `path`, -:: `[3 ~[4 5 6]]` is recognized as a list, etc. -:: -:: Most of the xpats have names that make their purpose obvious: -:: for example, the %tape xpat means that data of type type can be -:: printed as if it had the `tape` type. However, `%gear` and `%gate` -:: might not be entirely obvious. -:: -:: - The %gear xpat is any core with a cell subject. -:: - The %gate xpat is a core that looks like a gate. -:: -+$ xpat - $@ ?(%hoon %manx %json %nock %path %plum %skin %spec %tape %tour %type %vase) - $% [%gate sample=xkey product=xkey] - [%gear sample=xkey context=xkey batt=xbat] - [%list item=xkey] - [%tree item=xkey] - [%unit item=xkey] - == -:: -:: Left-fold over a list. -:: -:: This is `roll`, but with explicit type parameters. -:: -++ fold - |* [state=mold elem=mold] - |= [[st=state xs=(list elem)] f=$-([state elem] state)] - ^- state - |- - ?~ xs st - $(xs t.xs, st (f st i.xs)) -:: -:: This is basically a `mapM` over a list using the State monad. -:: -:: Another way to think about this is that it is the same as `turn`, -:: except that a state variable `st` is threaded through the -:: execution. The list is processed from left to right. -:: -:: This is `spin`, but with explicit type parameters. -:: -++ traverse - |* [state=mold in=mold out=mold] - |= [[st=state xs=(list in)] f=$-([state in] [out state])] - ^- [(list out) state] - ?~ xs [~ st] - =^ r st (f st i.xs) - =^ rs st $(xs t.xs, st st) - [[r rs] st] -:: -:: `traverse` over a set. -:: -++ traverse-set - |* [state=mold input=mold out=mold] - |= [[st=state xs=(set input)] f=$-([state input] [out state])] - ^- [(set out) state] - :: - =^ elems st ((traverse state input out) [st ~(tap in xs)] f) - :_ st (~(gas in *(set out)) elems) -:: -:: `traverse` over a map, also passing the key to the folding function. -:: -++ traverse-map - |* [state=mold key=mold in=mold out=mold] - |= [[st=state dict=(map key in)] f=$-([state key in] [out state])] - ^- [(map key out) state] - :: - =^ pairs=(list (pair key out)) st - %+ (traverse state (pair key in) (pair key out)) - [st ~(tap by dict)] - |= [st=state k=key x=in] - ^- [(pair key out) state] - =^ v st (f st k x) - [[k v] st] - :: - :_ st - (~(gas by *(map key out)) pairs) -:: -:: Given a map, return its inverse: For each value, what are the set -:: of associated keys? -:: -++ reverse-map - |* [key=mold val=mold] - |= tbl=(map key val) - =/ init *(map val (set key)) - ^- _init - %+ (fold _init (pair key val)) - [init ~(tap by tbl)] - |= [acc=_init k=key v=val] - ^- _init - =/ mb-keys (~(get by acc) v) - =/ keys=(set key) ?~(mb-keys ~ u.mb-keys) - (~(put by acc) v (~(put in keys) k)) -:: -++ json :: normal json value - $@ ~ :: null - $% {$a p/(list json)} :: array - {$b p/?} :: boolean - {$o p/(map @t json)} :: object - {$n p/@ta} :: number - {$s p/@t} :: string - == :: -:: :: +skol $-(type tank) using `duck`. :: ++ skol - |= typ/type + |= typ=type ^- tank ~(duck ut typ) :: ++ slam :: slam a gate - |= {gat/vase sam/vase} ^- vase + |= [gat=vase sam=vase] ^- vase =+ :- ^= typ ^- type [%cell p.gat p.sam] ^= gen ^- hoon @@ -12074,17 +11474,17 @@ (~(fond ut typ) way ~[cog]) :: ++ slap - |= {vax/vase gen/hoon} ^- vase :: untyped vase .* + |= [vax=vase gen=hoon] ^- vase :: untyped vase .* =+ gun=(~(mint ut p.vax) %noun gen) [p.gun .*(q.vax q.gun)] :: ++ slog :: deify printf - =| pri/@ :: priority level - |= a/tang ^+ same :: .= ~&(%a 1) + =| pri=@ :: priority level + |= a=tang ^+ same :: .= ~&(%a 1) ?~(a same ~>(%slog.[pri i.a] $(a t.a))) :: ((slog ~[>%a<]) 1) :: :: ++ mean :: crash with trace - |= a/tang + |= a=tang ^+ !! ?~ a !! ~_(i.a $(a t.a)) @@ -12099,7 +11499,7 @@ == :: ++ slew :: get axis in vase - |= {axe/@ vax/vase} ^- (unit vase) + |= [axe=@ vax=vase] ^- (unit vase) ?. |- ^- ? ?: =(1 axe) & ?. ?=(^ q.vax) | @@ -12108,21 +11508,21 @@ `[(~(peek ut p.vax) %free axe) .*(q.vax [0 axe])] :: ++ slim :: identical to seer? - |= old/vise ^- vase + |= old=vise ^- vase old :: ++ slit :: type of slam - |= {gat/type sam/type} + |= [gat=type sam=type] ?> (~(nest ut (~(peek ut gat) %free 6)) & sam) (~(play ut [%cell gat sam]) [%cnsg [%$ ~] [%$ 2] [%$ 3] ~]) :: ++ slob :: superficial arm - |= {cog/@tas typ/type} + |= [cog=@tas typ=type] ^- ? ?+ typ | - {$hold *} $(typ ~(repo ut typ)) - {$hint *} $(typ ~(repo ut typ)) - {$core *} + [%hold *] $(typ ~(repo ut typ)) + [%hint *] $(typ ~(repo ut typ)) + [%core *] |- ^- ? ?~ q.r.q.typ | ?| (~(has by q.q.n.q.r.q.typ) cog) @@ -12132,66 +11532,66 @@ == :: ++ sloe :: get arms in core - |= typ/type + |= typ=type ^- (list term) ?+ typ ~ - {$hold *} $(typ ~(repo ut typ)) - {$hint *} $(typ ~(repo ut typ)) - {$core *} + [%hold *] $(typ ~(repo ut typ)) + [%hint *] $(typ ~(repo ut typ)) + [%core *] %- zing %+ turn ~(tap by q.r.q.typ) - |= {* b/tome} + |= [* b=tome] %+ turn ~(tap by q.b) - |= {a/term *} + |= [a=term *] a == :: ++ slop :: cons two vases - |= {hed/vase tal/vase} + |= [hed=vase tal=vase] ^- vase [[%cell p.hed p.tal] [q.hed q.tal]] :: ++ slot :: got axis in vase - |= {axe/@ vax/vase} ^- vase + |= [axe=@ vax=vase] ^- vase [(~(peek ut p.vax) %free axe) .*(q.vax [0 axe])] :: ++ slym :: slam w+o sample-type - |= {gat/vase sam/*} ^- vase + |= [gat=vase sam=*] ^- vase (slap gat(+<.q sam) [%limb %$]) :: ++ sped :: reconstruct type - |= vax/vase + |= vax=vase ^- vase :_ q.vax ?@ q.vax (~(fuse ut p.vax) [%atom %$ ~]) ?@ -.q.vax ^= typ %- ~(play ut p.vax) - [%wtbn [%wtts [%leaf %tas -.q.vax] [%& 2]~] [%$ 1]] + [%wtgr [%wtts [%leaf %tas -.q.vax] [%& 2]~] [%$ 1]] (~(fuse ut p.vax) [%cell %noun %noun]) :: :::: 5d: parser :: ++ vang :: set ++vast params - |= {bug/? wer/path} :: bug: debug mode + |= [bug=? wer=path] :: bug: debug mode %*(. vast bug bug, wer wer) :: wer: where we are :: ++ vast :: main parsing core =+ [bug=`?`| wer=*path] |% ++ gash %+ cook :: parse path - |= a/(list tyke) ^- tyke + |= a=(list tyke) ^- tyke ?~(a ~ (weld i.a $(a t.a))) (more fas limp) ++ gasp ;~ pose :: parse =path= etc. %+ cook - |=({a/tyke b/tyke c/tyke} :(weld a b c)) + |=([a=tyke b=tyke c=tyke] :(weld a b c)) ;~ plug - (cook |=(a/(list) (turn a |=(b/* ~))) (star tis)) - (cook |=(a/hoon [[~ a] ~]) hasp) - (cook |=(a/(list) (turn a |=(b/* ~))) (star tis)) + (cook |=(a=(list) (turn a |=(b=* ~))) (star tis)) + (cook |=(a=hoon [[~ a] ~]) hasp) + (cook |=(a=(list) (turn a |=(b=* ~))) (star tis)) == - (cook |=(a/(list) (turn a |=(b/* ~))) (plus tis)) + (cook |=(a=(list) (turn a |=(b=* ~))) (plus tis)) == ++ glam ~+((glue ace)) ++ hasp ;~ pose :: path element @@ -12200,19 +11600,19 @@ (stag %sand (stag %tas (cold %$ buc))) (stag %sand (stag %t qut)) %+ cook - |=(a/coin [%sand ?:(?=({~ $tas *} a) %tas %ta) ~(rent co a)]) + |=(a=coin [%sand ?:(?=([~ %tas *] a) %tas %ta) ~(rent co a)]) nuck:so == ++ limp %+ cook - |= {a/(list) b/tyke} + |= [a=(list) b=tyke] ?~ a b $(a t.a, b [`[%sand %tas %$] b]) ;~(plug (star fas) gasp) ++ mota %+ cook - |=({a/tape b/tape} (rap 3 (weld a b))) + |=([a=tape b=tape] (rap 3 (weld a b))) ;~(plug (star low) (star hig)) ++ glom - |= {wit/whit taw/whit} + |= [wit=whit taw=whit] ^- whit :* ?~(lab.wit lab.taw lab.wit) ?~(boy.wit boy.taw boy.wit) @@ -12240,10 +11640,10 @@ :: ++ apse ;~ pose - %+ cook |=({a/term b/cord} %*(. *whit def (my [a b ~] ~))) + %+ cook |=([a=term b=cord] %*(. *whit def (my [a b ~] ~))) (exit fine) :: - %+ cook |=(a/cord %*(. *whit boy `[a ~])) + %+ cook |=(a=cord %*(. *whit boy `[a ~])) (exit line) :: (easy *whit) @@ -12251,13 +11651,13 @@ :: :: ++ beer - |= $: lab/(unit term) - boy/(unit (pair cord (list sect))) - def/(list (pair (pair term cord) (list sect))) + |= $: lab=(unit term) + boy=(unit (pair cord (list sect))) + def=(list (pair (pair term cord) (list sect))) == ^- whit =; def [lab boy (malt def) ~] - (turn def |=({{a/term b/cord} c/(list sect)} [a [b c]])) + (turn def |=([[a=term b=cord] c=(list sect)] [a [b c]])) :: :: ++ body @@ -12291,20 +11691,20 @@ :: exit: :: to end of line, not consuming following space. :: ++ step ;~(plug ace ace) - ++ into |*(bod/rule (indo ;~(pfix step bod))) + ++ into |*(bod=rule (indo ;~(pfix step bod))) :: ++ indo - |* bod/rule + |* bod=rule ;~(pfix col gar ;~(sfix bod (just `@`10) (punt gap))) :: ++ exit - |* bod/rule + |* bod=rule ;~(pfix (star ace) col gal step bod) :: :: fill: full definition :: ++ fill - %+ cook |=({{a/term b/cord} c/(list sect) (unit ~)} [a b c]) + %+ cook |=([[a=term b=cord] c=(list sect) (unit ~)] [a b c]) ;~ plug (into fine) (rant ;~(pfix step text)) @@ -12314,7 +11714,7 @@ :: rant: series of sections. :: ++ rant - |* sec/rule + |* sec=rule %- star ;~ pfix (indo null) @@ -12323,20 +11723,20 @@ -- :: ++ plex :: reparse static path - |= gen/hoon ^- (unit path) - ?: ?=({$dbug *} gen) :: unwrap $dbug + |= gen=hoon ^- (unit path) + ?: ?=([%dbug *] gen) :: unwrap %dbug $(gen q.gen) - ?. ?=({$clsg *} gen) ~ :: require :~ hoon + ?. ?=([%clsg *] gen) ~ :: require :~ hoon %+ reel p.gen :: build using elements - |= {a/hoon b/_`(unit path)`[~ u=/]} :: starting from just / + |= [a=hoon b=_`(unit path)`[~ u=/]] :: starting from just / ?~ b ~ - ?. ?=({$sand ?($ta $tas) @} a) ~ :: /foo constants + ?. ?=([%sand ?(%ta %tas) @] a) ~ :: /foo constants `[q.a u.b] :: ++ phax - |= ruw/(list (list woof)) + |= ruw=(list (list woof)) =+ [yun=*(list hoon) cah=*(list @)] - =+ wod=|=({a/tape b/(list hoon)} ^+(b ?~(a b [[%mcnt %knit (flop a)] b]))) + =+ wod=|=([a=tape b=(list hoon)] ^+(b ?~(a b [[%mcfs %knit (flop a)] b]))) |- ^+ yun ?~ ruw (flop (wod cah yun)) @@ -12346,16 +11746,16 @@ $(i.ruw t.i.ruw, cah ~, yun [p.i.i.ruw (wod cah yun)]) :: ++ posh - |= {pre/(unit tyke) pof/(unit {p/@ud q/tyke})} + |= [pre=(unit tyke) pof=(unit [p=@ud q=tyke])] ^- (unit (list hoon)) =- ?^(- - ~&(%posh-fail -)) =+ wom=(poof wer) %+ biff ?~ pre `u=wom %+ bind (poon wom u.pre) - |= moz/(list hoon) + |= moz=(list hoon) ?~(pof moz (weld moz (slag (lent u.pre) wom))) - |= yez/(list hoon) + |= yez=(list hoon) ?~ pof `yez =+ zey=(flop yez) =+ [moz=(scag p.u.pof zey) gul=(slag p.u.pof zey)] @@ -12363,12 +11763,12 @@ ?~(zom ~ `(weld (flop gul) u.zom)) :: ++ poof :: path -> (list hoon) - |=(pax/path ^-((list hoon) (turn pax |=(a/@ta [%sand %ta a])))) + |=(pax=path ^-((list hoon) (turn pax |=(a=@ta [%sand %ta a])))) :: :: tyke is =foo== as ~[~ `foo ~ ~] :: interpolate '=' path components ++ poon :: try to replace '='s - |= {pag/(list hoon) goo/tyke} :: default to pag + |= [pag=(list hoon) goo=tyke] :: default to pag ^- (unit (list hoon)) :: for null goo's ?~ goo `~ :: keep empty goo %+ both :: otherwise head comes @@ -12384,14 +11784,14 @@ :: ++ porc ;~ plug - (cook |=(a/(list) (lent a)) (star cen)) + (cook |=(a=(list) (lent a)) (star cen)) ;~(pfix fas gash) == :: ++ rump %+ sear - |= {a/wing b/(unit hoon)} ^- (unit hoon) - ?~(b [~ %wing a] ?.(?=({@ ~} a) ~ [~ [%rock %tas i.a] u.b])) + |= [a=wing b=(unit hoon)] ^- (unit hoon) + ?~(b [~ %wing a] ?.(?=([@ ~] a) ~ [~ [%rock %tas i.a] u.b])) ;~(plug rope ;~(pose (stag ~ wede) (easy ~))) :: ++ rood @@ -12401,7 +11801,7 @@ :: ++ rupl %+ cook - |= {a/? b/(list hoon) c/?} + |= [a=? b=(list hoon) c=?] ?: a ?: c [%clsg [%clsg b] ~] @@ -12428,12 +11828,12 @@ :: :: ++ sail :: xml template - |= in-tall-form/? =| lin/? + |= in-tall-form=? =| lin=? |% :: ++ apex :: product hoon %+ cook - |= tum/(each manx:hoot marl:hoot) ^- hoon + |= tum=(each manx:hoot marl:hoot) ^- hoon ?- -.tum %& [%xray p.tum] %| [%mcts p.tum] @@ -12444,7 +11844,7 @@ ;~(pfix mic ?:(in-tall-form tall-top wide-top)) :: ++ inline-embed :: brace interpolation - %+ cook |=(a/tuna:hoot a) + %+ cook |=(a=tuna:hoot a) ;~ pose ;~(pfix mic bracketed-elem(in-tall-form |)) ;~(plug tuna-mode sump) @@ -12452,7 +11852,7 @@ == :: ++ script-or-style :: script or style - %+ cook |=(a/marx:hoot a) + %+ cook |=(a=marx:hoot a) ;~ plug ;~(pose (jest %script) (jest %style)) wide-attrs @@ -12482,43 +11882,43 @@ == :: ++ wide-attrs :: wide attributes - %+ cook |=(a/(unit mart:hoot) (fall a ~)) + %+ cook |=(a=(unit mart:hoot) (fall a ~)) %- punt %+ ifix [pal par] %+ more (jest ', ') ;~((glue ace) a-mane hopefully-quote) :: ++ wide-tail :: wide elements - %+ cook |=(a/marl:hoot a) + %+ cook |=(a=marl:hoot a) ;~(pose ;~(pfix col wrapped-elems) (cold ~ mic) (easy ~)) :: ++ wide-elems :: wide elements - %+ cook |=(a/marl:hoot a) + %+ cook |=(a=marl:hoot a) %+ cook join-tops (star ;~(pfix ace wide-inner-top)) :: ++ wide-paren-elems :: wide flow - %+ cook |=(a/marl:hoot a) + %+ cook |=(a=marl:hoot a) %+ cook join-tops (ifix [pal par] (more ace wide-inner-top)) :: ::+| :: ++ drop-top - |= a/(each tuna:hoot marl:hoot) ^- marl:hoot + |= a=(each tuna:hoot marl:hoot) ^- marl:hoot ?- -.a %& [p.a]~ %| p.a == :: ++ join-tops - |= a/(list (each tuna:hoot marl:hoot)) ^- marl:hoot + |= a=(list (each tuna:hoot marl:hoot)) ^- marl:hoot (zing (turn a drop-top)) :: ::+| :: ++ wide-quote :: wide quote - %+ cook |=(a/marl:hoot a) + %+ cook |=(a=marl:hoot a) ;~ pose ;~ less (jest '"""') (ifix [doq doq] (cook collapse-chars quote-innards)) @@ -12530,7 +11930,7 @@ == :: ++ quote-innards :: wide+tall flow - %+ cook |=(a/(list $@(@ tuna:hoot)) a) + %+ cook |=(a=(list $@(@ tuna:hoot)) a) %- star ;~ pose ;~(pfix bas ;~(pose (mask "-+*%;\{") bas doq bix:ab)) @@ -12544,7 +11944,7 @@ ;~(plug tag-head wide-elems) :: ++ wrapped-elems :: wrapped tuna - %+ cook |=(a/marl:hoot a) + %+ cook |=(a=marl:hoot a) ;~ pose wide-paren-elems (cook |=(@t `marl`[;/((trip +<))]~) qut) @@ -12555,7 +11955,7 @@ :: ++ a-mane :: mane as hoon %+ cook - |= {a/@tas b/(unit @tas)} + |= [a=@tas b=(unit @tas)] ?~(b a [a u.b]) ;~ plug mixed-case-symbol @@ -12567,8 +11967,8 @@ == :: ++ en-class - |= a/(list {$class p/term}) - ^- (unit {$class tape}) + |= a=(list [%class p=term]) + ^- (unit [%class tape]) ?~ a ~ %- some :- %class @@ -12579,15 +11979,15 @@ :: ++ tag-head :: tag head %+ cook - |= {a/mane:hoot b/mart:hoot c/mart:hoot} + |= [a=mane:hoot b=mart:hoot c=mart:hoot] ^- marx:hoot [a (weld b c)] ;~ plug a-mane :: %+ cook - |= a/(list (unit {term (list beer:hoot)})) - ^- (list {term (list beer:hoot)}) + |= a=(list (unit [term (list beer:hoot)])) + ^- (list [term (list beer:hoot)]) :: discard nulls (murn a same) ;~ plug @@ -12623,7 +12023,7 @@ :: ++ tall-elem :: tall preface %+ cook - |= {a/{p/mane:hoot q/mart:hoot} b/mart:hoot c/marl:hoot} + |= [a=[p=mane:hoot q=mart:hoot] b=mart:hoot c=marl:hoot] ^- manx:hoot [[p.a (weld q.a b)] c] ;~(plug tag-head tall-attrs tall-tail) @@ -12632,16 +12032,16 @@ :: ::REVIEW is there a better way to do this? ++ hopefully-quote :: prefer "quote" form - %+ cook |=(a/(list beer:hoot) a) - %+ cook |=(a/hoon ?:(?=($knit -.a) p.a [~ a]~)) + %+ cook |=(a=(list beer:hoot) a) + %+ cook |=(a=hoon ?:(?=(%knit -.a) p.a [~ a]~)) wide :: ++ script-style-tail :: unescaped tall tail - %+ cook |=(a/marl:hoot a) + %+ cook |=(a=marl:hoot a) %+ ifix [gap ;~(plug gap duz)] %+ most gap ;~ pfix mic - %+ cook |=(a/tape ;/(a)) + %+ cook |=(a=tape ;/(a)) ;~ pose ;~(pfix ace (star prn)) (easy "\0a") @@ -12650,7 +12050,7 @@ :: ++ tall-tail :: tall tail ?> in-tall-form - %+ cook |=(a/marl:hoot a) + %+ cook |=(a=marl:hoot a) ;~ pose (cold ~ mic) ;~(pfix col wrapped-elems(in-tall-form |)) @@ -12664,9 +12064,9 @@ (most gap ;~(pose top-level (stag %| cram))) :: ++ collapse-chars :: group consec chars - |= reb/(list $@(@ tuna:hoot)) + |= reb=(list $@(@ tuna:hoot)) ^- marl:hoot - =| {sim/(list @) tuz/marl:hoot} + =| [sim=(list @) tuz=marl:hoot] |- ^- marl:hoot ?~ reb =. sim @@ -12684,48 +12084,48 @@ ++ colm @ud :: column ++ tarp marl:hoot :: node or generator ++ mite :: context - $? $down :: outer embed - $lunt :: unordered list - $lime :: list item - $lord :: ordered list - $poem :: verse - $bloc :: blockquote - $head :: heading + $? %down :: outer embed + %lunt :: unordered list + %lime :: list item + %lord :: ordered list + %poem :: verse + %bloc :: blockquote + %head :: heading == :: ++ trig :: line style - $: col/@ud :: start column - sty/trig-style :: style + $: col=@ud :: start column + sty=trig-style :: style == :: ++ trig-style :: type of parsed line - $% $: $end :: terminator - $? $done :: end of input - $stet :: == end of markdown - $dent :: outdent + $% $: %end :: terminator + $? %done :: end of input + %stet :: == end of markdown + %dent :: outdent == == :: - $: $one :: leaf node - $? $rule :: --- horz rule - $fens :: ``` code fence - $expr :: ;sail expression + $: %one :: leaf node + $? %rule :: --- horz rule + %fens :: ``` code fence + %expr :: ;sail expression == == :: - {$new p/trig-new} :: open container - {$old $text} :: anything else + [%new p=trig-new] :: open container + [%old %text] :: anything else == :: ++ trig-new :: start a - $? $lite :: + line item - $lint :: - line item - $head :: # heading - $bloc :: > block-quote - $poem :: [ ]{8} poem + $? %lite :: + line item + %lint :: - line item + %head :: # heading + %bloc :: > block-quote + %poem :: [ ]{8} poem == :: ++ graf :: paragraph element - $% {$bold p/(list graf)} :: *bold* - {$talc p/(list graf)} :: _italics_ - {$quod p/(list graf)} :: "double quote" - {$code p/tape} :: code literal - {$text p/tape} :: text symbol - {$link p/(list graf) q/tape} :: URL - {$mage p/tape q/tape} :: image - {$expr p/tuna:hoot} :: interpolated hoon + $% [%bold p=(list graf)] :: *bold* + [%talc p=(list graf)] :: _italics_ + [%quod p=(list graf)] :: "double quote" + [%code p=tape] :: code literal + [%text p=tape] :: text symbol + [%link p=(list graf) q=tape] :: URL + [%mage p=tape q=tape] :: image + [%expr p=tuna:hoot] :: interpolated hoon == -- =< (non-empty:parse |=(nail `(like tarp)`~($ main +<))) @@ -12747,12 +12147,12 @@ :: [loc txt]: parsing state :: =/ verbose & - =| err/(unit hair) - =| ind/{out/@ud inr/@ud} - =| hac/(list item) - =/ cur/item [%down ~] - =| par/(unit (pair hair wall)) - |_ {loc/hair txt/tape} + =| err=(unit hair) + =| ind=[out=@ud inr=@ud] + =| hac=(list item) + =/ cur=item [%down ~] + =| par=(unit (pair hair wall)) + |_ [loc=hair txt=tape] :: ++ $ :: resolve ^- (like tarp) @@ -12776,22 +12176,22 @@ :: ++ cur-indent ?- p.cur - $down 2 - $head 0 - $lunt 0 - $lime 2 - $lord 0 - $poem 8 - $bloc 2 + %down 2 + %head 0 + %lunt 0 + %lime 2 + %lord 0 + %poem 8 + %bloc 2 == :: ++ back :: column retreat - |= luc/@ud + |= luc=@ud ^+ +> ?: (gte luc inr.ind) +> :: :: nex: next backward step that terminates this context - =/ nex/@ud cur-indent :: REVIEW code and poem blocks are + =/ nex=@ud cur-indent :: REVIEW code and poem blocks are :: handled elsewhere ?: (gth nex (sub inr.ind luc)) :: @@ -12803,15 +12203,15 @@ :: ++ cur-to-tarp :: item to tarp ^- tarp - ?: ?=(?($down $head $expr) p.cur) + ?: ?=(?(%down %head %expr) p.cur) (flop q.cur) =- [[- ~] (flop q.cur)]~ ?- p.cur - $lunt %ul - $lord %ol - $lime %li - $poem %div ::REVIEW actual container element? - $bloc %blockquote + %lunt %ul + %lord %ol + %lime %li + %poem %div ::REVIEW actual container element? + %bloc %blockquote == :: ++ close-item ^+ . :: complete and pop @@ -12822,7 +12222,7 @@ == :: ++ read-line :: capture raw line - =| lin/tape + =| lin=tape |- ^+ [[lin *(unit _err)] +<.^$] :: parsed tape and halt/error :: :: no unterminated lines @@ -12842,21 +12242,21 @@ :: :: trim trailing spaces |- ^- tape - ?: ?=({$' ' *} lin) + ?: ?=([%' ' *] lin) $(lin t.lin) (flop lin) :: - =/ eat-newline/nail [[+(p.loc) 1] t.txt] + =/ eat-newline=nail [[+(p.loc) 1] t.txt] =/ saw look(+<.$ eat-newline) :: - ?: ?=({~ @ $end ?($stet $dent)} saw) :: stop on == or dedent + ?: ?=([~ @ %end ?(%stet %dent)] saw) :: stop on == or dedent [[lin `~] +<.^$] [[lin ~] eat-newline] :: ++ look :: inspect line ^- (unit trig) %+ bind (wonk (look:parse loc txt)) - |= a/trig ^+ a + |= a=trig ^+ a :: :: treat a non-terminator as a terminator :: if it's outdented @@ -12872,7 +12272,7 @@ ?~ par . :: :: if block is verse - ?: ?=($poem p.cur) + ?: ?=(%poem p.cur) :: :: add break between stanzas =. q.cur ?~(q.cur q.cur [[[%br ~] ~] q.cur]) @@ -12886,18 +12286,18 @@ ;/("{+<}\0a") :: :: yex: block recomposed, with newlines - =/ yex/tape + =/ yex=tape %- zing %+ turn (flop q.u.par) - |= a/tape + |= a=tape (runt [(dec inr.ind) ' '] "{a}\0a") :: :: vex: parse of paragraph - =/ vex/(like tarp) + =/ vex=(like tarp) :: :: either a one-line header or a paragraph %. [p.u.par yex] - ?: ?=($head p.cur) + ?: ?=(%head p.cur) (full head:parse) (full para:parse) :: @@ -12907,7 +12307,7 @@ ..$(err `p.vex) :: :: finish tag if it's a header - =< ?:(?=($head p.cur) close-item ..$) + =< ?:(?=(%head p.cur) close-item ..$) :: :: save good result, clear buffer ..$(par ~, q.cur (weld p.u.q.vex q.cur)) @@ -12925,7 +12325,7 @@ ?~ saw :: :: break section - =^ a/{tape fin/(unit _err)} +<.$ read-line + =^ a=[tape fin=(unit _err)] +<.$ read-line ?^ fin.a ..$(err u.fin.a) =>(close-par line) @@ -12934,13 +12334,13 @@ => .(saw u.saw) :: :: if end of input, complete - ?: ?=($end -.sty.saw) + ?: ?=(%end -.sty.saw) ..$(q.loc col.saw) :: =. ind ?~(out.ind [col.saw col.saw] ind) :: init indents :: ?: ?| ?=(~ par) :: if after a paragraph or - ?& ?=(?($down $lime $bloc) p.cur) :: unspaced new container + ?& ?=(?(%down %lime %bloc) p.cur) :: unspaced new container |(!=(%old -.sty.saw) (gth col.saw inr.ind)) == == => .(..$ close-par) @@ -12950,8 +12350,8 @@ :: =^ col-ok sty.saw ?+ (sub col.saw inr.ind) [| sty.saw] :: columns advanced - $0 [& sty.saw] - $8 [& %new %poem] + %0 [& sty.saw] + %8 [& %new %poem] == ?. col-ok ~? verbose [%columns-advanced col.saw inr.ind] @@ -12961,17 +12361,17 @@ :: :: unless adding a matching item, close lists =. ..$ - ?: ?| &(?=($lunt p.cur) !?=($lint +.sty.saw)) - &(?=($lord p.cur) !?=($lite +.sty.saw)) + ?: ?| &(?=(%lunt p.cur) !?=(%lint +.sty.saw)) + &(?=(%lord p.cur) !?=(%lite +.sty.saw)) == close-item ..$ :: =< line(par `[loc ~]) ^+ ..$ :: continue with para ?- -.sty.saw - $one (read-one +.sty.saw) :: parse leaves - $new (open-item p.sty.saw) :: open containers - $old ..$ :: just text + %one (read-one +.sty.saw) :: parse leaves + %new (open-item p.sty.saw) :: open containers + %old ..$ :: just text == :: :: @@ -12982,28 +12382,28 @@ ?- p.cur :: :: can't(/directly) contain text - ?($lord $lunt) ~|(bad-leaf-container+p.cur !!) + ?(%lord %lunt) ~|(bad-leaf-container+p.cur !!) :: :: only one line in a header - $head | + %head | :: :: indented literals need to end with a blank line - $poem (gte col.saw inr.ind) + %poem (gte col.saw inr.ind) :: :: text tarps must continue aligned - ?($down $lunt $lime $lord $bloc) =(col.saw inr.ind) + ?(%down %lunt %lime %lord %bloc) =(col.saw inr.ind) == ~? verbose bad-block-structure+[p.cur inr.ind col.saw] ..$(err `[p.loc col.saw]) :: :: accept line and maybe continue - =^ a/{lin/tape fin/(unit _err)} +<.$ read-line + =^ a=[lin=tape fin=(unit _err)] +<.$ read-line =. par par(q.u [lin.a q.u.par]) ?^ fin.a ..$(err u.fin.a) line ++ parse-block :: execute parser - |= fel/$-(nail (like tarp)) ^+ +> - =/ vex/(like tarp) (fel loc txt) + |= fel=$-(nail (like tarp)) ^+ +> + =/ vex=(like tarp) (fel loc txt) ?~ q.vex ~? verbose [%parse-block txt] +>.$(err `p.vex) @@ -13015,31 +12415,31 @@ == :: ++ read-one :: read %one item - |= sty/?($expr $rule $fens) ^+ +> + |= sty=?(%expr %rule %fens) ^+ +> ?- sty - $expr (parse-block expr:parse) - $rule (parse-block hrul:parse) - $fens (parse-block (fens:parse inr.ind)) + %expr (parse-block expr:parse) + %rule (parse-block hrul:parse) + %fens (parse-block (fens:parse inr.ind)) == :: ++ open-item :: enter list/quote - |= saw/trig-new + |= saw=trig-new =< +>.$:apex |% ++ apex ^+ . :: open container ?- saw - $poem (push %poem) :: verse literal - $head (push %head) :: heading - $bloc (entr %bloc) :: blockquote line - $lint (lent %lunt) :: unordered list - $lite (lent %lord) :: ordered list + %poem (push %poem) :: verse literal + %head (push %head) :: heading + %bloc (entr %bloc) :: blockquote line + %lint (lent %lunt) :: unordered list + %lite (lent %lord) :: ordered list == :: ++ push :: push context |=(mite +>(hac [cur hac], cur [+< ~])) :: ++ entr :: enter container - |= typ/mite + |= typ=mite ^+ +> :: :: indent by 2 @@ -13052,7 +12452,7 @@ (push typ) :: ++ lent :: list entry - |= ord/?($lord $lunt) + |= ord=?(%lord %lunt) ^+ +> => ?:(=(ord p.cur) +>.$ (push ord)) :: push list if new (entr %lime) @@ -13062,10 +12462,10 @@ ++ parse :: individual parsers |% ++ look :: classify line - %+ cook |=(a/(unit trig) a) + %+ cook |=(a=(unit trig) a) ;~ pfix (star ace) %+ here :: report indent - |=({a/pint b/?(~ trig-style)} ?~(b ~ `[q.p.a b])) + |=([a=pint b=?(~ trig-style)] ?~(b ~ `[q.p.a b])) ;~ pose (cold ~ (just `@`10)) :: blank line :: @@ -13094,7 +12494,7 @@ ;~(less tem prn) == ++ cash :: escaped fence - |* tem/rule + |* tem=rule %- echo %- star ;~ pose @@ -13107,14 +12507,14 @@ |* $: :: fex: primary parser :: sab: secondary parser :: - fex/rule - sab/rule + fex=rule + sab=rule == - |= {loc/hair txt/tape} + |= [loc=hair txt=tape] ^+ *sab :: :: vex: fenced span - =/ vex/(like tape) (fex loc txt) + =/ vex=(like tape) (fex loc txt) ?~ q.vex vex :: :: hav: reparse full fenced text @@ -13129,14 +12529,14 @@ :: ::REVIEW surely there is a less hacky "first or after space" solution ++ easy-sol :: parse start of line - |* a/* - |= b/nail + |* a=* + |= b=nail ?: =(1 q.p.b) ((easy a) b) (fail b) :: ++ echo :: hoon literal - |* sab/rule - |= {loc/hair txt/tape} + |* sab=rule + |= [loc=hair txt=tape] ^- (like tape) :: :: vex: result of parsing wide hoon @@ -13153,8 +12553,8 @@ [i.txt $(txt +.txt)] :: ++ non-empty - |* a/rule - |= tub/nail ^+ (a) + |* a=rule + |= tub=nail ^+ (a) =/ vex (a tub) ~! vex ?~ q.vex vex @@ -13165,7 +12565,7 @@ ++ word :: tarp parser %+ knee *(list graf) |. ~+ %+ cook - |= a/$%(graf [%list (list graf)]) + |= a=$%(graf [%list (list graf)]) ^- (list graf) ?:(?=(%list -.a) +.a [a ~]) ;~ pose @@ -13199,11 +12599,11 @@ :: (stag %code (ifix [tic tic] (calf tic))) :: - :: ++arm, +-arm, +$arm, +*arm, ++arm:core, ... + :: ++arm, +$arm, +*arm, ++arm:core, ... :: %+ stag %code ;~ plug - lus ;~(pose lus hep buc tar) + lus ;~(pose lus buc tar) low (star ;~(pose nud low hep col)) == :: @@ -13275,34 +12675,34 @@ =- (cook - werk) :: :: collect raw tarp into xml tags - |= gaf/(list graf) + |= gaf=(list graf) ^- tarp =< main |% ++ main ^- tarp ?~ gaf ~ - ?. ?=($text -.i.gaf) + ?. ?=(%text -.i.gaf) (weld (item i.gaf) $(gaf t.gaf)) :: :: fip: accumulate text blocks - =/ fip/(list tape) [p.i.gaf]~ + =/ fip=(list tape) [p.i.gaf]~ |- ^- tarp ?~ t.gaf [;/((zing (flop fip))) ~] - ?. ?=($text -.i.t.gaf) + ?. ?=(%text -.i.t.gaf) [;/((zing (flop fip))) ^$(gaf t.gaf)] $(gaf t.gaf, fip :_(fip p.i.t.gaf)) :: ++ item - |= nex/graf + |= nex=graf ^- tarp ::CHECK can be tuna:hoot? ?- -.nex - $text !! :: handled separately - $expr [p.nex]~ - $bold [[%b ~] ^$(gaf p.nex)]~ - $talc [[%i ~] ^$(gaf p.nex)]~ - $code [[%code ~] ;/(p.nex) ~]~ - $quod :: + %text !! :: handled separately + %expr [p.nex]~ + %bold [[%b ~] ^$(gaf p.nex)]~ + %talc [[%i ~] ^$(gaf p.nex)]~ + %code [[%code ~] ;/(p.nex) ~]~ + %quod :: :: smart quotes %= ^$ gaf @@ -13310,8 +12710,8 @@ %+ weld p.nex `(list graf)`[%text (tufa ~-~201d. ~)]~ == - $link [[%a [%href q.nex] ~] ^$(gaf p.nex)]~ - $mage [[%img [%src q.nex] ?~(p.nex ~ [%alt p.nex]~)] ~]~ + %link [[%a [%href q.nex] ~] ^$(gaf p.nex)]~ + %mage [[%img [%src q.nex] ?~(p.nex ~ [%alt p.nex]~)] ~]~ == -- :: @@ -13323,15 +12723,15 @@ ;~(plug tic tic tic (just '\0a')) :: ++ fens - |= col/@u ~+ + |= col=@u ~+ =/ ind (stun [(dec col) (dec col)] ace) =/ ind-tics ;~(plug ind tics) - %+ cook |=(txt/tape `tarp`[[%pre ~] ;/(txt) ~]~) + %+ cook |=(txt=tape `tarp`[[%pre ~] ;/(txt) ~]~) :: :: leading outdent is ok since container may :: have already been parsed and consumed %+ ifix [;~(plug (star ace) tics) ind-tics] - %^ stir "" |=({a/tape b/tape} "{a}\0a{b}") + %^ stir "" |=([a=tape b=tape] "{a}\0a{b}") ;~ pose %+ ifix [ind (just '\0a')] ;~(less tics (star prn)) @@ -13341,7 +12741,7 @@ :: ++ para :: paragraph %+ cook - |=(a/tarp ?~(a ~ [[%p ~] a]~)) + |=(a=tarp ?~(a ~ [[%p ~] a]~)) ;~(pfix (punt whit) down) :: ++ expr :: expression @@ -13355,7 +12755,7 @@ :: ++ head :: parse heading %+ cook - |= {haxes/tape kids/tarp} ^- tarp + |= [haxes=tape kids=tarp] ^- tarp =/ tag (crip 'h' <(lent haxes)>) :: e.g. ### -> %h3 =/ id (contents-to-id kids) [[tag [%id id]~] kids]~ @@ -13363,8 +12763,8 @@ ;~(pfix (star ace) ;~((glue whit) (stun [1 6] hax) down)) :: ++ contents-to-id :: # text into elem id - |= a/(list tuna:hoot) ^- tape - =; raw/tape + |= a=(list tuna:hoot) ^- tape + =; raw=tape %+ turn raw |= @tD ^- @tD @@ -13382,10 +12782,10 @@ %+ weld ^- tape ?- i.a - {{$$ {$$ *} ~} ~} :: text node contents - (murn v.i.a.g.i.a |=(a/beer:hoot ?^(a ~ (some a)))) - {^ *} $(a c.i.a) :: concatenate children - {@ *} ~ :: ignore interpolation + [[%$ [%$ *] ~] ~] :: text node contents + (murn v.i.a.g.i.a |=(a=beer:hoot ?^(a ~ (some a)))) + [^ *] $(a c.i.a) :: concatenate children + [@ *] ~ :: ignore interpolation == $(a t.a) -- @@ -13397,22 +12797,11 @@ ^. stet ^. limo :~ :- '_' - ;~(pfix cab (stag %bscb wide)) + ;~(pfix cab (stag %bccb wide)) :- ',' - ;~(pfix com (stag %bsmc wide)) + ;~(pfix com (stag %bcmc wide)) :- '$' - ;~ pose - ;~ pfix buc - ;~ pose - :: XX all three deprecated - :: - (stag %leaf (stag %tas (cold %$ buc))) - (stag %leaf (stag %t qut)) - (stag %leaf (sear |=(a/coin ?:(?=($$ -.a) (some +.a) ~)) nuck:so)) - == - == - (stag %like (most col rope)) - == + (stag %like (most col rope)) :- '%' ;~ pose ;~ pfix cen @@ -13421,7 +12810,7 @@ (stag %leaf (stag %f (cold & pam))) (stag %leaf (stag %f (cold | bar))) (stag %leaf (stag %t qut)) - (stag %leaf (sear |=(a/coin ?:(?=($$ -.a) (some +.a) ~)) nuck:so)) + (stag %leaf (sear |=(a=coin ?:(?=(%$ -.a) (some +.a) ~)) nuck:so)) == == == @@ -13433,12 +12822,8 @@ wide ;~(pose ;~(pfix ace (most ace wyde)) (easy ~)) == - :- '{' - :: XX deprecated - :: - (stag %bscl (ifix [kel ker] (most ace wyde))) :- '[' - (stag %bscl (ifix [sel ser] (most ace wyde))) + (stag %bccl (ifix [sel ser] (most ace wyde))) :- '*' (cold [%base %noun] tar) :- '/' @@ -13447,7 +12832,7 @@ ;~(pfix pat (stag %base (stag %atom mota))) :- '?' ;~ pose - %+ stag %bswt + %+ stag %bcwt ;~(pfix wut (ifix [pal par] (most ace wyde))) :: (cold [%base %flag] wut) @@ -13466,10 +12851,10 @@ %+ sear |= [=(unit term) =spec] %+ bind - ~(autoname ax & spec) + ~(autoname ax spec) |= =term =* name ?~(unit term (cat 3 u.unit (cat 3 '-' term))) - [%bsts name spec] + [%bcts name spec] ;~ pose ;~(plug (stag ~ ;~(sfix sym tis)) wyde) (stag ~ wyde) @@ -13477,7 +12862,7 @@ == :- ['a' 'z'] ;~ pose - (stag %bsts ;~(plug sym ;~(pfix ;~(pose fas tis) wyde))) + (stag %bcts ;~(plug sym ;~(pfix tis wyde))) (stag %like (most col rope)) == == @@ -13498,7 +12883,7 @@ (stag %zpzp (cold ~ ;~(plug zap zap))) == :- '_' - ;~(pfix cab (stag %ktcl (stag %bscb wide))) + ;~(pfix cab (stag %ktcl (stag %bccb wide))) :- '$' ;~ pose ;~ pfix buc @@ -13507,7 +12892,7 @@ :: (stag %leaf (stag %tas (cold %$ buc))) (stag %leaf (stag %t qut)) - (stag %leaf (sear |=(a/coin ?:(?=($$ -.a) (some +.a) ~)) nuck:so)) + (stag %leaf (sear |=(a=coin ?:(?=(%$ -.a) (some +.a) ~)) nuck:so)) == == rump @@ -13515,19 +12900,19 @@ :- '%' ;~ pfix cen ;~ pose - (stag %clsg (sear |~({a/@ud b/tyke} (posh ~ ~ a b)) porc)) + (stag %clsg (sear |~([a=@ud b=tyke] (posh ~ ~ a b)) porc)) (stag %rock (stag %tas (cold %$ buc))) (stag %rock (stag %f (cold & pam))) (stag %rock (stag %f (cold | bar))) (stag %rock (stag %t qut)) (cook (jock &) nuck:so) - (stag %clsg (sear |=(a/(list) (posh ~ ~ (lent a) ~)) (star cen))) + (stag %clsg (sear |=(a=(list) (posh ~ ~ (lent a) ~)) (star cen))) == == :- '&' ;~ pose - (cook |=(a/wing [%cnts a ~]) rope) - (stag %wtpd ;~(pfix pam (ifix [pal par] (most ace wide)))) + (cook |=(a=wing [%cnts a ~]) rope) + (stag %wtpm ;~(pfix pam (ifix [pal par] (most ace wide)))) ;~(plug (stag %rock (stag %f (cold & pam))) wede) (stag %sand (stag %f (cold & pam))) == @@ -13535,8 +12920,6 @@ (stag %sand (stag %t qut)) :- '(' (stag %cncl (ifix [pal par] (most ace wide))) - :- '{' - (stag %ktcl (stag %bscl (ifix [kel ker] (most ace wyde)))) :- '*' ;~ pose (stag %kttr ;~(pfix tar wyde)) @@ -13549,39 +12932,39 @@ (stag %dtls ;~(pfix lus (ifix [pal par] wide))) :: %+ cook - |= a/(list (list woof)) - :- %mcnt + |= a=(list (list woof)) + :- %mcfs [%knit |-(^-((list woof) ?~(a ~ (weld i.a $(a t.a)))))] (most dog ;~(pfix lus soil)) :: - (cook |=(a/wing [%cnts a ~]) rope) + (cook |=(a=wing [%cnts a ~]) rope) == :- '-' ;~ pose (stag %sand tash:so) :: %+ cook - |= a/(list (list woof)) + |= a=(list (list woof)) [%clsg (phax a)] (most dog ;~(pfix hep soil)) :: - (cook |=(a/wing [%cnts a ~]) rope) + (cook |=(a=wing [%cnts a ~]) rope) == :- '.' ;~ pose (cook (jock |) ;~(pfix dot perd:so)) - (cook |=(a/wing [%cnts a ~]) rope) + (cook |=(a=wing [%cnts a ~]) rope) == :- ['0' '9'] %+ cook - |= {a/dime b/(unit hoon)} + |= [a=dime b=(unit hoon)] ?~(b [%sand a] [[%rock a] u.b]) ;~(plug bisk:so (punt wede)) :- ':' ;~ pfix col ;~ pose (stag %mccl (ifix [pal par] (most ace wide))) - ;~(pfix fas (stag %mcnt wide)) + ;~(pfix fas (stag %mcfs wide)) == == :- '=' @@ -13594,7 +12977,7 @@ :: |= =spec ^- (unit hoon) - %+ bind ~(autoname ax & spec) + %+ bind ~(autoname ax spec) |=(=term `hoon`[%ktts term %kttr spec]) wyde == @@ -13602,7 +12985,7 @@ :- '?' ;~ pose %+ stag %ktcl - (stag %bswt ;~(pfix wut (ifix [pal par] (most ace wyde)))) + (stag %bcwt ;~(pfix wut (ifix [pal par] (most ace wyde)))) :: (cold [%base %flag] wut) == @@ -13617,26 +13000,26 @@ ;~ pfix tic ;~ pose %+ cook - |=({a/@ta b/hoon} [%ktls [%sand a 0] [%ktls [%sand %$ 0] b]]) + |=([a=@ta b=hoon] [%ktls [%sand a 0] [%ktls [%sand %$ 0] b]]) ;~(pfix pat ;~(plug mota ;~(pfix tic wide))) ;~ pfix tar (stag %kthp (stag [%base %noun] ;~(pfix tic wide))) == (stag %kthp ;~(plug wyde ;~(pfix tic wide))) (stag %ktls ;~(pfix lus ;~(plug wide ;~(pfix tic wide)))) - (cook |=(a/hoon [[%rock %n ~] a]) wide) + (cook |=(a=hoon [[%rock %n ~] a]) wide) == == :- '"' %+ cook - |= a/(list (list woof)) + |= a=(list (list woof)) [%knit |-(^-((list woof) ?~(a ~ (weld i.a $(a t.a)))))] (most dog soil) :- ['a' 'z'] rump :- '|' ;~ pose - (cook |=(a/wing [%cnts a ~]) rope) + (cook |=(a=wing [%cnts a ~]) rope) (stag %wtbr ;~(pfix bar (ifix [pal par] (most ace wide)))) ;~(plug (stag %rock (stag %f (cold | bar))) wede) (stag %sand (stag %f (cold | bar))) @@ -13691,7 +13074,7 @@ == ++ sump (ifix [kel ker] (stag %cltr (most ace wide))) ++ norm :: rune regular form - |= tol/? + |= tol=? |% ++ structure %- stew @@ -13700,20 +13083,20 @@ ;~ pfix buc %- stew ^. stet ^. limo - :~ [':' (rune col %bscl exqs)] - ['%' (rune cen %bscn exqs)] - ['<' (rune gal %bsld exqb)] - ['>' (rune gar %bsbn exqb)] - ['^' (rune ket %bskt exqb)] - ['~' (rune sig %bssg exqd)] - ['|' (rune bar %bsbr exqc)] - ['&' (rune pam %bspd exqc)] - ['@' (rune pat %bsvt exqb)] - ['_' (rune cab %bscb expa)] - ['-' (rune hep %bshp exqb)] - ['=' (rune tis %bsts exqg)] - ['?' (rune wut %bswt exqs)] - [';' (rune mic %bsmc expa)] + :~ [':' (rune col %bccl exqs)] + ['%' (rune cen %bccn exqs)] + ['<' (rune gal %bcgl exqb)] + ['>' (rune gar %bcgr exqb)] + ['^' (rune ket %bckt exqb)] + ['~' (rune sig %bcsg exqd)] + ['|' (rune bar %bcbr exqc)] + ['&' (rune pam %bcpm exqc)] + ['@' (rune pat %bcpt exqb)] + ['_' (rune cab %bccb expa)] + ['-' (rune hep %bchp exqb)] + ['=' (rune tis %bcts exqg)] + ['?' (rune wut %bcwt exqs)] + [';' (rune mic %bcmc expa)] == == :- '%' @@ -13722,25 +13105,25 @@ ^. stet ^. limo :~ :- '^' %+ cook - |= [%cnkt a/hoon b/spec c/spec d/spec] + |= [%cnkt a=hoon b=spec c=spec d=spec] [%make a b c d ~] (rune ket %cnkt exqy) :: :- '+' %+ cook - |= [%cnls a/hoon b/spec c/spec] + |= [%cnls a=hoon b=spec c=spec] [%make a b c ~] (rune lus %cnls exqx) :: :- '-' %+ cook - |= [%cnhp a/hoon b/spec] + |= [%cnhp a=hoon b=spec] [%make a b ~] (rune hep %cnhp exqd) :: :- ':' %+ cook - |= [%cncl a/hoon b/(list spec)] + |= [%cncl a=hoon b=(list spec)] [%make a b] (rune col %cncl exqz) == @@ -13755,7 +13138,7 @@ ^. stet ^. limo :~ ['_' (rune cab %brcb exqr)] ['%' (runo cen %brcn ~ expe)] - ['@' (runo pat %brvt ~ expe)] + ['@' (runo pat %brpt ~ expe)] [':' (rune col %brcl expb)] ['.' (rune dot %brdt expa)] ['-' (rune hep %brhp expa)] @@ -13764,26 +13147,26 @@ ['*' (rune tar %brtr exqc)] ['=' (rune tis %brts exqc)] ['?' (rune wut %brwt expa)] - ['$' (rune buc %brbs exqe)] + ['$' (rune buc %brbc exqe)] == == :- '$' ;~ pfix buc %- stew ^. stet ^. limo - :~ ['@' (stag %ktcl (rune pat %bsvt exqb))] - ['_' (stag %ktcl (rune cab %bscb expa))] - [':' (stag %ktcl (rune col %bscl exqs))] - ['%' (stag %ktcl (rune cen %bscn exqs))] - ['<' (stag %ktcl (rune gal %bsld exqb))] - ['>' (stag %ktcl (rune gar %bsbn exqb))] - ['|' (stag %ktcl (rune bar %bsbr exqc))] - ['&' (stag %ktcl (rune pam %bspd exqc))] - ['^' (stag %ktcl (rune ket %bskt exqb))] - ['~' (stag %ktcl (rune sig %bssg exqd))] - ['-' (stag %ktcl (rune hep %bshp exqb))] - ['=' (stag %ktcl (rune tis %bsts exqg))] - ['?' (stag %ktcl (rune wut %bswt exqs))] + :~ ['@' (stag %ktcl (rune pat %bcpt exqb))] + ['_' (stag %ktcl (rune cab %bccb expa))] + [':' (stag %ktcl (rune col %bccl exqs))] + ['%' (stag %ktcl (rune cen %bccn exqs))] + ['<' (stag %ktcl (rune gal %bcgl exqb))] + ['>' (stag %ktcl (rune gar %bcgr exqb))] + ['|' (stag %ktcl (rune bar %bcbr exqc))] + ['&' (stag %ktcl (rune pam %bcpm exqc))] + ['^' (stag %ktcl (rune ket %bckt exqb))] + ['~' (stag %ktcl (rune sig %bcsg exqd))] + ['-' (stag %ktcl (rune hep %bchp exqb))] + ['=' (stag %ktcl (rune tis %bcts exqg))] + ['?' (stag %ktcl (rune wut %bcwt exqs))] ['.' (rune dot %kttr exqa)] [',' (rune com %ktcl exqa)] == @@ -13834,11 +13217,10 @@ ['.' (rune dot %ktdt expb)] ['-' (rune hep %kthp exqc)] ['+' (rune lus %ktls expb)] - ['&' (rune pam %ktpd expa)] + ['&' (rune pam %ktpm expa)] ['~' (rune sig %ktsg expa)] ['=' (rune tis %ktts expj)] ['?' (rune wut %ktwt expa)] - ['%' (rune cen %ktcn expa)] ['*' (rune tar %kttr exqa)] [':' (rune col %ktcl exqa)] == @@ -13848,14 +13230,14 @@ %- stew ^. stet ^. limo :~ ['|' (rune bar %sgbr expb)] - ['$' (rune buc %sgbs expf)] + ['$' (rune buc %sgbc expf)] ['_' (rune cab %sgcb expb)] ['%' (rune cen %sgcn hind)] - ['/' (rune fas %sgnt hine)] - ['<' (rune gal %sgld hinb)] - ['>' (rune gar %sgbn hinb)] + ['/' (rune fas %sgfs hine)] + ['<' (rune gal %sggl hinb)] + ['>' (rune gar %sggr hinb)] ['+' (rune lus %sgls hinc)] - ['&' (rune pam %sgpd hinf)] + ['&' (rune pam %sgpm hinf)] ['?' (rune wut %sgwt hing)] ['=' (rune tis %sgts expb)] ['!' (rune zap %sgzp expb)] @@ -13866,7 +13248,7 @@ %- stew ^. stet ^. limo :~ [':' (rune col %mccl expi)] - ['/' (rune fas %mcnt expa)] + ['/' (rune fas %mcfs expa)] ['<' (rune gal %mcgl exp1)] ['~' (rune sig %mcsg expi)] [';' (rune mic %mcmc exqc)] @@ -13881,10 +13263,10 @@ ['?' (rune wut %tswt expw)] ['^' (rune ket %tskt expt)] [':' (rune col %tscl expp)] - ['/' (rune fas %tsnt expo)] + ['/' (rune fas %tsfs expo)] [';' (rune mic %tsmc expo)] - ['<' (rune gal %tsld expb)] - ['>' (rune gar %tsbn expb)] + ['<' (rune gal %tsgl expb)] + ['>' (rune gar %tsgr expb)] ['-' (rune hep %tshp expb)] ['*' (rune tar %tstr expg)] [',' (rune com %tscm expb)] @@ -13899,14 +13281,14 @@ :~ ['|' (rune bar %wtbr exps)] [':' (rune col %wtcl expc)] ['.' (rune dot %wtdt expc)] - ['<' (rune gal %wtld expb)] - ['>' (rune gar %wtbn expb)] + ['<' (rune gal %wtgl expb)] + ['>' (rune gar %wtgr expb)] ['-' ;~(pfix hep (toad txhp))] ['^' ;~(pfix ket (toad tkkt))] ['=' ;~(pfix tis (toad txts))] ['#' ;~(pfix hax (toad txhx))] ['+' ;~(pfix lus (toad txls))] - ['&' (rune pam %wtpd exps)] + ['&' (rune pam %wtpm exps)] ['@' ;~(pfix pat (toad tkvt))] ['~' ;~(pfix sig (toad tksg))] ['!' (rune zap %wtzp expa)] @@ -13920,9 +13302,9 @@ ['.' ;~(pfix dot (toad |.(loaf(bug |))))] [',' (rune com %zpcm expb)] [';' (rune mic %zpmc expb)] - ['>' (rune gar %zpbn expa)] - ['<' (rune gal %zpld exqc)] - ['@' (rune pat %zpvt expy)] + ['>' (rune gar %zpgr expa)] + ['<' (rune gal %zpgl exqc)] + ['@' (rune pat %zppt expy)] ['=' (rune tis %zpts expa)] ['?' (rune wut %zpwt hinh)] == @@ -13932,10 +13314,7 @@ ++ boog !: :: core arms %+ knee [p=*term q=*hoon] |. ~+ ;~ pose - ;~ pfix ;~ pose - (jest '++') - (jest '+-') :: XX deprecated - == + ;~ pfix (jest '++') ;~ plug ;~(pfix gap ;~(pose (cold %$ buc) sym)) ;~(pfix gap loaf) @@ -13943,9 +13322,9 @@ == :: %+ cook - |= {b/term d/spec} + |= [b=term d=spec] [b [%ktcl [%name b d]]] - ;~ pfix ;~(pose (jest '+=') (jest '+$')) + ;~ pfix (jest '+$') ;~ plug ;~(pfix gap sym) ;~(pfix gap loan) @@ -13957,7 +13336,7 @@ ^- [term hoon] :- b :+ %brtr - :- %bscl + :- %bccl =- ?>(?=(^ -) -) :: for each .term in .c, produce $=(term $~(* $-(* *))) :: ie {term}=mold @@ -13966,7 +13345,7 @@ |= =term ^- spec =/ tar [%base %noun] - [%bsts term [%bssg tar [%bshp tar tar]]] + [%bcts term [%bcsg tar [%bchp tar tar]]] [%ktcl [%made [b c] e]] ;~ pfix (jest '+*') ;~ plug @@ -14074,16 +13453,16 @@ ;~(pfix dif (stag hil (stag tuq (toad har)))) -- ++ runq :: wide or tall if tol - |* [wid/rule tal/rule] :: else wide + |* [wid=rule tal=rule] :: else wide ?. tol wid ;~(pose wid tal) :: ++ glop ~+((glue mash)) :: separated by space ++ gunk ~+((glue muck)) :: separated list - ++ butt |* zor/rule :: closing == if tall + ++ butt |* zor=rule :: closing == if tall ?:(tol ;~(sfix zor ;~(plug gap duz)) zor) - ++ ulva |* zor/rule :: closing -- and tall + ++ ulva |* zor=rule :: closing -- and tall ?.(tol fail ;~(sfix zor ;~(plug gap dun))) ++ hank (most muck loaf) :: gapped hoons ++ hunk (most muck loan) :: gapped specs @@ -14095,7 +13474,7 @@ ++ muck ?:(tol gap ace) :: general separator ++ teak %+ knee *tiki |. ~+ :: wing or hoon =+ ^= gub - |= {a/term b/$%({%& p/wing} {%| p/hoon})} + |= [a=term b=$%([%& p=wing] [%| p=hoon])] ^- tiki ?-(-.b %& [%& [~ a] p.b], %| [%| [~ a] p.b]) =+ ^= wyp @@ -14178,25 +13557,25 @@ :: :: tiki expansion for %wt runes :: - ++ txhp |. %+ cook |= {a/tiki b/(list (pair spec hoon))} + ++ txhp |. %+ cook |= [a=tiki b=(list (pair spec hoon))] (~(wthp ah a) b) (butt ;~(gunk teak ruck)) - ++ tkkt |. %+ cook |= {a/tiki b/hoon c/hoon} + ++ tkkt |. %+ cook |= [a=tiki b=hoon c=hoon] (~(wtkt ah a) b c) ;~(gunk teak loaf loaf) - ++ txls |. %+ cook |= {a/tiki b/hoon c/(list (pair spec hoon))} + ++ txls |. %+ cook |= [a=tiki b=hoon c=(list (pair spec hoon))] (~(wtls ah a) b c) (butt ;~(gunk teak loaf ruck)) - ++ tkvt |. %+ cook |= {a/tiki b/hoon c/hoon} - (~(wtvt ah a) b c) + ++ tkvt |. %+ cook |= [a=tiki b=hoon c=hoon] + (~(wtpt ah a) b c) ;~(gunk teak loaf loaf) - ++ tksg |. %+ cook |= {a/tiki b/hoon c/hoon} + ++ tksg |. %+ cook |= [a=tiki b=hoon c=hoon] (~(wtsg ah a) b c) ;~(gunk teak loaf loaf) - ++ txts |. %+ cook |= {a/spec b/tiki} + ++ txts |. %+ cook |= [a=spec b=tiki] (~(wtts ah b) a) ;~(gunk loan teak) - ++ txhx |. %+ cook |= {a/skin b/tiki} + ++ txhx |. %+ cook |= [a=skin b=tiki] (~(wthx ah b) a) ;~(gunk lore teak) :: @@ -14238,7 +13617,7 @@ ;~(pfix cen sym) ;~(pfix dot ;~(pose wide ;~(pfix muck loaf))) == - ++ bony (cook |=(a/(list) (lent a)) (plus tis)) :: base 1 =en count + ++ bony (cook |=(a=(list) (lent a)) (plus tis)) :: base 1 =en count ++ bonz :: term-labelled hoons ;~ pose (cold ~ sig) @@ -14249,12 +13628,12 @@ -- :: ++ lang :: lung sample - $: ros/hoon + $: ros=hoon $= vil - $% {$tis p/hoon} - {$col p/hoon} - {$ket p/hoon} - {$lit p/(list (pair wing hoon))} + $% [%tis p=hoon] + [%col p=hoon] + [%ket p=hoon] + [%lit p=(list (pair wing hoon))] == == :: @@ -14264,10 +13643,10 @@ |: $:lang ^- (unit hoon) ?- -.vil - $col ?:(=([%base %flag] ros) ~ [~ %tsld ros p.vil]) - $lit (bind ~(reek ap ros) |=(hyp/wing [%cnts hyp p.vil])) - $ket [~ ros p.vil] - $tis =+ rud=~(flay ap ros) + %col ?:(=([%base %flag] ros) ~ [~ %tsgl ros p.vil]) + %lit (bind ~(reek ap ros) |=(hyp=wing [%cnts hyp p.vil])) + %ket [~ ros p.vil] + %tis =+ rud=~(flay ap ros) ?~(rud ~ `[%ktts u.rud p.vil]) == :: @@ -14300,20 +13679,20 @@ ++ rope :: wing form %+ knee *wing |. ~+ - %+ (slug |=({a/limb b/wing} [a b])) + %+ (slug |=([a=limb b=wing] [a b])) dot ;~ pose (cold [%| 0 ~] com) %+ cook - |=({a/(list) b/term} ?~(a b [%| (lent a) `b])) + |=([a=(list) b=term] ?~(a b [%| (lent a) `b])) ;~(plug (star ket) ;~(pose sym (cold %$ buc))) :: %+ cook - |=(a/axis [%& a]) + |=(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)) + ;~(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) == @@ -14325,7 +13704,7 @@ %+ sear |= =spec ^- (unit skin) - %+ bind ~(autoname ax & spec) + %+ bind ~(autoname ax spec) |= =term [%name term %spec spec %base %noun] wyde @@ -14364,54 +13743,54 @@ %+ knee *spec |.(~+((wert ;~(pose structure:(norm |) scad)))) ++ wart - |* zor/rule + |* zor=rule %+ here - |= {a/pint b/hoon} + |= [a=pint b=hoon] ?:(bug [%dbug [wer a] b] b) zor ++ wert - |* zor/rule + |* zor=rule %+ here - |= {a/pint b/spec} + |= [a=pint b=spec] ?:(bug [%dbug [wer a] b] b) zor -- :: ++ vest ~/ %vest - |= tub/nail + |= tub=nail ^- (like hoon) %. tub %- full (ifix [gay gay] tall:vast) :: ++ vice - |= txt/@ta + |= txt=@ta ^- hoon (rash txt wide:vast) :: ++ make :: compile cord to nock - |= txt/@ + |= txt=@ q:(~(mint ut %noun) %noun (ream txt)) :: ++ rain :: parse with % path - |= {bon/path txt/@} + |= [bon=path txt=@] ^- hoon =+ vaz=vast ~| bon (scan (trip txt) (full (ifix [gay gay] tall:vaz(wer bon)))) :: ++ ream :: parse cord to hoon - |= txt/@ + |= txt=@ ^- hoon (rash txt vest) :: ++ reck :: parse hoon file - |= bon/path + |= bon=path (rain bon .^(@t %cx (weld bon `path`[%hoon ~]))) :: ++ ride :: end-to-end compiler - |= {typ/type txt/@} + |= [typ=type txt=@] ^- (pair type nock) ~> %slog.[0 leaf/"ride: parsing"] =/ gen (ream txt) @@ -14423,10 +13802,10 @@ :: ++ wa :: cached compile |_ worm - ++ nell |=(ref/type (nest [%cell %noun %noun] ref)) :: nest in cell + ++ nell |=(ref=type (nest [%cell %noun %noun] ref)) :: nest in cell ++ nest :: nest:ut, cached - |= {sut/type ref/type} - ^- {? worm} + |= [sut=type ref=type] + ^- [? worm] ?: (~(has in nes) [sut ref]) [& +>+<] ?. (~(nest ut sut) | ref) ~& %nest-failed @@ -14440,14 +13819,14 @@ [& +>+<(nes (~(put in nes) [sut ref]))] :: ++ call :: call gate - |= {vax/vase nam/term som/(each vase ^)} - ^- {vase worm} + |= [vax=vase nam=term som=(each vase ^)] + ^- [vase worm] =^ duf +>+<.$ (open vax nam som) (slap duf [%limb %$]) :: ++ open :: assemble door - |= {vax/vase nam/term som/(each vase ^)} - ^- {vase worm} + |= [vax=vase nam=term som=(each vase ^)] + ^- [vase worm] =* key [%cncb [[%& 2] ~] [[[%& 6] ~] [%$ 3]] ~] =^ dor +>+<.$ (slap vax [%limb nam]) =^ mes +>+<.$ (slot 6 dor) @@ -14460,7 +13839,7 @@ [[p.dor q.dor(+6 +7.som)] +>+<.$] :: ++ neat :: type compliance - |= {typ/type som/(each vase ^)} + |= [typ=type som=(each vase ^)] ^- worm =^ hip +>+<.$ ?- -.som @@ -14471,10 +13850,10 @@ +>+<.$ :: ++ nets :: typeless nest - |= {sut/* ref/*} - ^- {? worm} + |= [sut=* ref=*] + ^- [? worm] ?: (~(has in nes) [sut ref]) [& +>+<] - =+ gat=|=({a/type b/type} (~(nest ut a) | b)) + =+ gat=|=([a=type b=type] (~(nest ut a) | b)) ?. (? (slum gat [sut ref])) ~& %nets-failed =+ tag=`*`skol @@ -14489,8 +13868,8 @@ :: +play: +play:ut, cached :: ++ play - |= {sut/type gen/hoon} - ^- {type worm} + |= [sut=type gen=hoon] + ^- [type worm] =+ old=(~(get by pay) [sut gen]) ?^ old [u.old +>+<.$] =+ new=(~(play ut sut) gen) @@ -14498,8 +13877,8 @@ :: +mint: +mint:ut to noun, cached :: ++ mint - |= {sut/type gen/hoon} - ^- {(pair type nock) worm} + |= [sut=type gen=hoon] + ^- [(pair type nock) worm] =+ old=(~(get by mit) [sut gen]) ?^ old [u.old +>+<.$] =+ new=(~(mint ut sut) %noun gen) @@ -14515,76 +13894,76 @@ :: +slap: +slap:ut, cached :: ++ slap - |= {vax/vase gen/hoon} - ^- {vase worm} + |= [vax=vase gen=hoon] + ^- [vase worm] =^ gun +>+< (mint p.vax gen) [[p.gun .*(q.vax q.gun)] +>+<.$] :: +slot: +slot:ut, cached :: ++ slot - |= {axe/@ vax/vase} - ^- {vase worm} + |= [axe=@ vax=vase] + ^- [vase worm] =^ gun +>+< (mint p.vax [%$ axe]) [[p.gun .*(q.vax [0 axe])] +>+<.$] :: +slym: +slym:ut, cached :: ++ slym - |= {gat/vase sam/*} + |= [gat=vase sam=*] ^- [vase worm] (slap gat(+<.q sam) [%limb %$]) :: ++ sped :: specialize vase - |= vax/vase - ^- {vase worm} + |= vax=vase + ^- [vase worm] =+ ^= gen ^- hoon ?@ q.vax [%wtts [%base [%atom %$]] [%& 1]~] ?@ -.q.vax [%wtts [%leaf %tas -.q.vax] [%& 2]~] [%wtts [%base %cell] [%& 1]~] - =^ typ +>+<.$ (play p.vax [%wtbn gen [%$ 1]]) + =^ typ +>+<.$ (play p.vax [%wtgr gen [%$ 1]]) [[typ q.vax] +>+<.$] :: ++ spot :: slot then sped - |= {axe/@ vax/vase} - ^- {vase worm} + |= [axe=@ vax=vase] + ^- [vase worm] =^ xav +>+< (slot axe vax) (sped xav) :: ++ stop :: sped then slot - |= {axe/@ vax/vase} - ^- {vase worm} + |= [axe=@ vax=vase] + ^- [vase worm] =^ xav +>+< (sped vax) (slot axe xav) -- :: :::: 5f: molds and mold builders :: -++ mane $@(@tas {@tas @tas}) :: XML name+space -++ manx $~([[%$ ~] ~] {g/marx c/marl}) :: dynamic 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 -++ marx $~([%$ ~] {n/mane a/mart}) :: dynamic XML tag -++ mite (list @ta) :: mime type -++ monk (each ship {p/@tas q/@ta}) :: general identity -++ pass @ :: public key -++ ring @ :: private key -++ ship @p :: network identity -++ shop (each ship (list @ta)) :: urbit/dns identity -++ spur path :: ship desk case spur -++ time @da :: galactic time ++$ mane $@(@tas [@tas @tas]) :: XML name+space ++$ manx $~([[%$ ~] ~] [g=marx c=marl]) :: dynamic 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 ++$ marx $~([%$ ~] [n=mane a=mart]) :: dynamic XML tag ++$ mite (list @ta) :: mime type ++$ monk (each ship [p=@tas q=@ta]) :: general identity ++$ pass @ :: public key ++$ ring @ :: private key ++$ ship @p :: network identity ++$ shop (each ship (list @ta)) :: urbit/dns identity ++$ spur path :: ship desk case spur ++$ time @da :: galactic time :: :::: 5g: profiling support (XX move) :: :: ++ pi-heck - |= {nam/@tas day/doss} + |= [nam=@tas day=doss] ^- doss =+ lam=(~(get by hit.day) nam) day(hit (~(put by hit.day) nam ?~(lam 1 +(u.lam)))) :: ++ pi-noon :: sample trace - |= {mot/term paz/(list path) day/doss} - =| lax/(unit path) + |= [mot=term paz=(list path) day=doss] + =| lax=(unit path) |- ^- doss ?~ paz day(mon (pi-mope mot mon.day)) %= $ @@ -14604,22 +13983,22 @@ (~(put by inn.hup) u.nax ?~(hag 1 +(u.hag))) == ++ pi-mope :: add sample - |= {mot/term mon/moan} + |= [mot=term mon=moan] ?+ mot mon - $fun mon(fun +(fun.mon)) - $noc mon(noc +(noc.mon)) - $glu mon(glu +(glu.mon)) - $mal mon(mal +(mal.mon)) - $far mon(far +(far.mon)) - $coy mon(coy +(coy.mon)) - $euq mon(euq +(euq.mon)) + %fun mon(fun +(fun.mon)) + %noc mon(noc +(noc.mon)) + %glu mon(glu +(glu.mon)) + %mal mon(mal +(mal.mon)) + %far mon(far +(far.mon)) + %coy mon(coy +(coy.mon)) + %euq mon(euq +(euq.mon)) == ++ pi-moth :: count sample - |= mon/moan ^- @ud + |= mon=moan ^- @ud :(add fun.mon noc.mon glu.mon mal.mon far.mon coy.mon euq.mon) :: ++ pi-mumm :: print sample - |= mon/moan ^- tape + |= mon=moan ^- tape =+ tot=(pi-moth mon) ;: welp ^- tape @@ -14652,7 +14031,7 @@ == :: ++ pi-tell :: produce dump - |= day/doss + |= day=doss ^- (list tape) ?: =(day *doss) ~ =+ tot=(pi-moth mon.day) @@ -14661,9 +14040,9 @@ :: %+ turn %+ sort ~(tap by hit.day) - |= {a/{* @} b/{* @}} + |= [a=[* @] b=[* @]] (lth +.a +.b) - |= {nam/term num/@ud} + |= [nam=term num=@ud] :(welp (trip nam) ": " (scow %ud num)) ["" ~] :: @@ -14671,9 +14050,9 @@ ^- (list (list tape)) %+ turn %+ sort ~(tap by cut.day) - |= {one/(pair path hump) two/(pair path hump)} + |= [one=(pair path hump) two=(pair path hump)] (gth (pi-moth mon.q.one) (pi-moth mon.q.two)) - |= {pax/path hup/hump} + |= [pax=path hup=hump] =+ ott=(pi-moth mon.hup) ;: welp [(welp "label: " (spud pax)) ~] @@ -14684,8 +14063,8 @@ :- "into:" %+ turn %+ sort ~(tap by out.hup) - |=({{* a/@ud} {* b/@ud}} (gth a b)) - |= {pax/path num/@ud} + |=([[* a=@ud] [* b=@ud]] (gth a b)) + |= [pax=path num=@ud] ^- tape :(welp " " (spud pax) ": " (scow %ud num)) :: @@ -14693,8 +14072,8 @@ :- "from:" %+ turn %+ sort ~(tap by inn.hup) - |=({{* a/@ud} {* b/@ud}} (gth a b)) - |= {pax/path num/@ud} + |=([[* a=@ud] [* b=@ud]] (gth a b)) + |= [pax=path num=@ud] ^- tape :(welp " " (spud pax) ": " (scow %ud num)) :: diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 0ebe2d09c..790ed55e8 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -364,58 +364,6 @@ $% [%memo =message-num message=*] [%send =message-num =ack-meat] == -:: previous state versions, for +stay/+load migrations -:: -+| %plasmonics -:: -+$ ames-state-2 - $: peers=(map ship ship-state) - =unix=duct - =life - crypto-core=acru:ames - veb=_veb-all-off - == -:: -+$ queued-event-1 - $% [%call =duct type=* wrapped-task=(hobo task-1)] - [%take =wire =duct type=* =sign] - == -:: -+$ task-1 - $% [%wegh ~] - task - == -:: -+$ ames-state-1 - $: peers=(map ship ship-state-1) - =unix=duct - =life - crypto-core=acru:ames - == -+$ ship-state-1 - $% [%alien alien-agenda] - [%known peer-state-1] - == -+$ peer-state-1 - $: $: =symmetric-key - =life - =public-key - sponsor=ship - == - route=(unit [direct=? =lane]) - qos=qos-1 - =ossuary - snd=(map bone message-pump-state) - rcv=(map bone message-sink-state) - nax=(set [=bone =message-num]) - heeds=(set duct) - == -+$ qos-1 - $~ [%unborn ~] - $% [%live last-contact=@da] - [%dead last-contact=@da] - [%unborn ~] - == -- :: external vane interface :: @@ -425,9 +373,10 @@ =< =* adult-gate . =| queued-events=(qeu queued-event) :: - |= [our=ship now=@da eny=@ scry-gate=sley] + |= [our=ship now=@da eny=@ rof=roof] =* larval-gate . =* adult-core (adult-gate +<) + =* scry-gate (en-sley rof) |% :: +call: handle request $task :: @@ -532,7 +481,6 @@ ++ scry scry:adult-core ++ stay [%4 %larva queued-events ames-state.adult-gate] ++ load - |^ |= $= old $% $: %4 $% $: %larva @@ -541,78 +489,25 @@ == [%adult state=_ames-state.adult-gate] == == - :: - $: %3 - $% $: %larva - events=(qeu queued-event-1) - state=_ames-state.adult-gate - == - [%adult state=_ames-state.adult-gate] - == == - :: - $: %2 - $% [%larva events=(qeu queued-event-1) state=ames-state-2] - [%adult state=ames-state-2] - == == - :: - $% [%larva events=(qeu queued-event-1) state=ames-state-1] - [%adult state=ames-state-1] - == == + == ?- old [%4 %adult *] (load:adult-core %4 state.old) - [%3 %adult *] (load:adult-core %3 state.old) - [%2 %adult *] (load:adult-core %2 state.old) - [%adult *] (load:adult-core %1 state.old) :: [%4 %larva *] ~> %slog.1^leaf/"ames: larva: load" =. queued-events events.old =. adult-gate (load:adult-core %4 state.old) larval-gate - :: - [%3 %larva *] - ~> %slog.1^leaf/"ames: larva: load" - =. queued-events (queued-events-1-to-4 events.old) - =. adult-gate (load:adult-core %3 state.old) - larval-gate - :: - [%2 %larva *] - ~> %slog.1^leaf/"ames: larva: load" - =. queued-events (queued-events-1-to-4 events.old) - =. adult-gate (load:adult-core %2 state.old) - larval-gate - :: - [%larva *] - ~> %slog.0^leaf/"ames: larva: load" - =. queued-events (queued-events-1-to-4 events.old) - =. adult-gate (load:adult-core %1 state.old) - larval-gate == - :: - ++ queued-events-1-to-4 - |= events=(qeu queued-event-1) - ^- (qeu queued-event) - %- ~(gas to *(qeu queued-event)) - ^- (list queued-event) - %+ murn ~(tap to events) - |= e=queued-event-1 - ^- (unit queued-event) - ?. ?=(%call -.e) - `e - ?: ?=([%wegh ~] wrapped-task.e) - ~ - ?: ?=([%soft %wegh ~] wrapped-task.e) - ~ - `e - -- -- :: adult ames, after metamorphosis from larva :: =< =| =ames-state -|= [our=ship now=@da eny=@ scry-gate=sley] +|= [our=ship now=@da eny=@ rof=roof] =* ames-gate . =* veb veb.bug.ames-state +=* scry-gate (en-sley rof) |% :: +call: handle request $task :: @@ -683,64 +578,20 @@ :: +load: load in old state after reload :: ++ load - |= $= old-state - $% [%1 ames-state-1] - [%2 ames-state-2] - [%3 ^ames-state] - [%4 ^ames-state] - == - |^ ^+ ames-gate - :: - =? old-state ?=(%1 -.old-state) %2^(state-1-to-2 +.old-state) - =? old-state ?=(%2 -.old-state) %3^(state-2-to-3 +.old-state) - =? old-state ?=(%3 -.old-state) %4^+.old-state - :: - ?> ?=(%4 -.old-state) - ames-gate(ames-state +.old-state) - :: - ++ state-1-to-2 - |= =ames-state-1 - ^- ames-state-2 - :: - =| =ames-state-2 - =. +.ames-state-2 - :* unix-duct.ames-state-1 - life.ames-state-1 - crypto-core.ames-state-1 - veb=veb-all-off - == - =. peers.ames-state-2 - %- ~(gas by *(map ship ship-state)) - %+ turn ~(tap by peers.ames-state-1) - |= [peer=ship =ship-state-1] - ^- [ship ship-state] - ?: ?=(%alien -.ship-state-1) - [peer ship-state-1] - :+ peer %known - %= +.ship-state-1 - qos - ?+ -.qos.ship-state-1 qos.ship-state-1 - %unborn [%unborn now] - == - == - ames-state-2 - :: - ++ state-2-to-3 - |= =ames-state-2 - ^- ^ames-state - :: - :* peers.ames-state-2 - unix-duct.ames-state-2 - life.ames-state-2 - crypto-core.ames-state-2 - bug=[veb=veb.ames-state-2 ships=~] - == - -- + |= old-state=[%4 ^ames-state] + ^+ ames-gate + ames-gate(ames-state +.old-state) :: +scry: dereference namespace :: ++ scry - |= [fur=(unit (set monk)) ren=@tas why=shop syd=desk lot=coin tyl=path] + |= [lyc=gang cyr=term bem=beam] ^- (unit (unit cage)) + =* ren cyr + =* why=shop &/p.bem + =* syd q.bem + =* lot=coin $/r.bem + =* tyl s.bem + :: ::TODO don't special-case whey scry :: ?: &(=(%$ ren) =(tyl /whey)) diff --git a/pkg/arvo/sys/vane/behn.hoon b/pkg/arvo/sys/vane/behn.hoon index 6f1db751c..faa1c3f5a 100644 --- a/pkg/arvo/sys/vane/behn.hoon +++ b/pkg/arvo/sys/vane/behn.hoon @@ -254,7 +254,7 @@ :: =| behn-state =* state - -|= [our=ship now=@da eny=@uvJ ski=sley] +|= [our=ship now=@da eny=@uvJ rof=roof] =* behn-gate . ^? |% @@ -296,88 +296,23 @@ :: +load: migrate an old state to a new behn version :: ++ load - |^ - |= old=state + |= old=behn-state ^+ behn-gate - =? old ?=(^ -.old) - (ket-to-1 old) - =? old ?=(~ -.old) - (load-0-to-1 old) - =? old ?=(%1 -.old) - (load-1-to-2 old) - ?> ?=(%2 -.old) behn-gate(state old) - :: - ++ state - $^ behn-state-ket - $% behn-state-0 - behn-state-1 - behn-state - == - :: - ++ load-1-to-2 - |= old=behn-state-1 - ^- behn-state - =; new-timers old(- %2, timers new-timers) - =/ timers=(list timer) ~(tap in ~(key by timers.old)) - %+ roll timers - |= [t=timer acc=(tree [@da (qeu duct)])] - ^+ acc - =| mock=behn-state - =. timers.mock acc - =/ event-core (per-event *[@p @da duct] mock) - (set-timer:event-core t) - :: - ++ timer-map-1 - %- (ordered-map ,timer ,~) - |= [a=timer b=timer] - (lth date.a date.b) - :: - +$ behn-state-1 - $: %1 - timers=(tree [timer ~]) - unix-duct=duct - next-wake=(unit @da) - drips=drip-manager - == - :: - +$ behn-state-0 - $: ~ - unix-duct=duct - next-wake=(unit @da) - drips=drip-manager - == - :: - +$ behn-state-ket - $: timers=(list timer) - unix-duct=duct - next-wake=(unit @da) - drips=drip-manager - == - :: - ++ ket-to-1 - |= old=behn-state-ket - ^- behn-state-1 - :- %1 - %= old - timers - %+ gas:timer-map-1 *(tree [timer ~]) - (turn timers.old |=(=timer [timer ~])) - == - :: - ++ load-0-to-1 - |= old=behn-state-0 - ^- behn-state-1 - [%1 old] - -- :: +scry: view timer state :: :: TODO: not referentially transparent w.r.t. elapsed timers, :: which might or might not show up in the product :: ++ scry - |= [fur=(unit (set monk)) ren=@tas why=shop syd=desk lot=coin tyl=path] + |= [lyc=gang cyr=term bem=beam] ^- (unit (unit cage)) + =* ren cyr + =* why=shop &/p.bem + =* syd q.bem + =* lot=coin $/r.bem + =* tyl s.bem + :: ::TODO don't special-case whey scry :: ?: &(=(ren %$) =(tyl /whey)) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 290a7c4b8..d22b05588 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -9,7 +9,7 @@ :: worth noting that many of the clay-related structures are defined in zuse. :: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -|= pit/vase +|= pit=vase =, clay => |% +$ aeon @ud :: version number @@ -21,8 +21,8 @@ :: +$ ankh :: expanded node $~ [~ ~] - $: fil/(unit {p/lobe q/cage}) :: file - dir/(map @ta ankh) :: folders + $: fil=(unit [p=lobe q=cage]) :: file + dir=(map @ta ankh) :: folders == :: :: :: Part of ++mery, representing the set of changes between the mergebase and @@ -36,10 +36,10 @@ :: -- `old` is the set of files in the mergebase and not in the new desk. :: +$ cane - $: new/(map path lobe) - cal/(map path lobe) - can/(map path cage) - old/(map path ~) + $: new=(map path lobe) + cal=(map path lobe) + can=(map path cage) + old=(map path ~) == :: :: Type of request. @@ -50,7 +50,7 @@ :: gets file contents, %y gets a directory listing, and %z gets a recursive :: hash of the file contents and children. :: -:: ++ care ?($d $p $t $u $v $w $x $y $z) +:: ++ care ?(%d %p %t %u %v %w %x %y %z) :: :: Keeps track of subscribers. :: @@ -64,11 +64,11 @@ :: Includes subscriber list, dome (desk content), possible commit state (for :: local changes), possible merge state (for incoming merges), and permissions. :: -++ dojo - $: qyx/cult :: subscribers - dom/dome :: desk state - per/regs :: read perms per path - pew/regs :: write perms per path ++$ dojo + $: qyx=cult :: subscribers + dom=dome :: desk state + per=regs :: read perms per path + pew=regs :: write perms per path == :: :: Desk state. @@ -82,14 +82,14 @@ :: having changed; this lets us short-circuit that in some cases. :: Whenever you give an `%ergo`, you must update this. :: -++ dome - $: ank/ankh :: state - let/aeon :: top id - hit/(map aeon tako) :: versions by id - lab/(map @tas aeon) :: labels - mim/(map path mime) :: mime cache - fod/ford-cache :: ford cache - fer/(unit reef-cache) :: reef cache ++$ dome + $: ank=ankh :: state + let=aeon :: top id + hit=(map aeon tako) :: versions by id + lab=(map @tas aeon) :: labels + mim=(map path mime) :: mime cache + fod=ford-cache :: ford cache + fer=(unit reef-cache) :: reef cache == :: :: :: Commit state. @@ -101,17 +101,19 @@ :: -- `dif` is the diffs in `dig` applied to their files. :: -- `mut` is the diffs between `muc` and the original files. :: -++ dork :: diff work - $: del/(list path) :: deletes - ink/(list (pair path cage)) :: hoon inserts - ins/(list (pair path cage)) :: inserts - dif/(list (trel path lobe cage)) :: changes - mut/(list (trel path lobe cage)) :: mutations ++$ dork :: diff work + $: del=(list path) :: deletes + ink=(list (pair path cage)) :: hoon inserts + ins=(list (pair path cage)) :: inserts + dif=(list (trel path lobe cage)) :: changes + mut=(list (trel path lobe cage)) :: mutations == :: :: :: Over-the-wire backfill request :: -+$ fill [=desk =lobe] ++$ fill + $% [%0 =desk =lobe] + == :: :: Ford cache :: @@ -130,7 +132,7 @@ :: :: Hash of a blob, for lookup in the object store (lat.ran) :: -++ lobe @uvI :: blob ref ++$ lobe @uvI :: blob ref :: :: New desk data. :: @@ -138,11 +140,11 @@ :: of all new aeons to hashes of their commits, the most recent aeon, and sets :: of all new commits and data. :: -++ nako :: subscription state - $: gar/(map aeon tako) :: new ids - let/aeon :: next id - lar/(set yaki) :: new commits - bar/(set plop) :: new content ++$ nako :: subscription state + $: gar=(map aeon tako) :: new ids + let=aeon :: next id + lar=(set yaki) :: new commits + bar=(set plop) :: new content == :: :: :: Formal vane state. @@ -157,7 +159,7 @@ :: -- `cez` is a collection of named permission groups. :: -- `pud` is an update that's waiting on a kernel upgrade :: -++ raft :: filesystem ++$ raft :: filesystem $: rom=room :: domestic hoy=(map ship rung) :: foreign ran=rang :: hashes @@ -165,26 +167,25 @@ hez=(unit duct) :: sync duct cez=(map @ta crew) :: permission groups pud=(unit [=desk =yoki]) :: pending update - pun=(list move) :: upgrade moves == :: :: :: Object store. :: :: Maps of commit hashes to commits and content hashes to content. :: -++ rang :: - $: hut/(map tako yaki) :: - lat/(map lobe blob) :: ++$ rang :: + $: hut=(map tako yaki) :: + lat=(map lobe blob) :: == :: :: :: Unvalidated response to a request. :: -:: Like a ++rant, but with a page of data rather than a cage of it. +:: Like a +$rant, but with a page of data rather than a cage of it. :: -++ rand :: unvalidated rant - $: p/{p/care q/case r/@tas} :: clade release book - q/path :: spur - r/page :: data ++$ rand :: unvalidated rant + $: p=[p=care q=case r=@tas] :: clade release book + q=path :: spur + r=page :: data == :: :: :: Generic desk state. @@ -201,13 +202,13 @@ :: -- `dom` is the actual state of the filetree. Since this is used almost :: exclusively in `++ze`, we describe it there. :: -++ rede :: universal project - $: lim/@da :: complete to - ref/(unit rind) :: outgoing requests - qyx/cult :: subscribers - dom/dome :: revision state - per/regs :: read perms per path - pew/regs :: write perms per path ++$ rede :: universal project + $: lim=@da :: complete to + ref=(unit rind) :: outgoing requests + qyx=cult :: subscribers + dom=dome :: revision state + per=regs :: read perms per path + pew=regs :: write perms per path == :: :: :: Foreign request manager. @@ -238,7 +239,7 @@ :: :: Result of a subscription :: -++ sub-result ++$ sub-result $% [%blab =mood data=(each cage lobe)] [%bleb ver=@ud ins=@ud range=(unit (pair aeon aeon))] [%balk cage=(unit (each cage lobe)) =mood] @@ -250,19 +251,19 @@ :: :: `hun` is the duct to dill, and `dos` is a collection of our desks. :: -++ room :: fs per ship - $: hun/duct :: terminal duct - dos/(map desk dojo) :: native desk ++$ room :: fs per ship + $: hun=duct :: terminal duct + dos=(map desk dojo) :: native desk == :: :: :: Stored request. :: -:: Like a ++rave but with caches of current versions for %next and %many. +:: Like a +$rave but with caches of current versions for %next and %many. :: Generally used when we store a request in our state somewhere. :: -++ cach (unit (unit (each cage lobe))) :: cached result ++$ cach (unit (unit (each cage lobe))) :: cached result +$ wove [for=(unit [=ship ver=@ud]) =rove] :: stored source + req -++ rove :: stored request ++$ rove :: stored request $% [%sing =mood] :: single request [%next =mood aeon=(unit aeon) =cach] :: next version of one $: %mult :: next version of any @@ -276,12 +277,12 @@ :: :: Foreign desk data. :: -++ rung ++$ rung $: rus=(map desk rede) :: neighbor desks == :: -++ move {p/duct q/(wind note gift:able)} :: local move -++ note :: out request $-> ++$ move [p=duct q=(wind note gift:able)] :: local move ++$ note :: out request $-> $~ [%b %wait *@da] :: $% $: %a :: to %ames $>(%plea task:able:ames) :: @@ -311,8 +312,8 @@ $: %j :: by %jael $>(%public-keys task:able:jael) :: == == :: -++ riot (unit rant) :: response+complete -++ sign :: in result $<- ++$ riot (unit rant) :: response+complete ++$ sign :: in result $<- $~ [%b %wake ~] :: $% $: %a :: by %ames $> $? %boon :: response @@ -654,7 +655,7 @@ (with-faces old+old sam+sam ~) :+ %sgzp !,(*hoon old=old) :+ %sgzp !,(*hoon sam=sam) - :+ %tsld [%limb b] + :+ %tsgl [%limb b] !, *hoon ~(grow old sam) :: try direct +grab @@ -663,7 +664,7 @@ =/ rab %- mule |. %+ slap new - :+ %tsld [%limb a] + :+ %tsgl [%limb a] [%limb %grab] ?: &(?=(%& -.rab) ?=(^ q.p.rab)) :_(nub |=(sam=vase ~|([%grab a b] (slam p.rab sam)))) @@ -672,7 +673,7 @@ =/ jum %- mule |. %+ slap old - :+ %tsld [%limb b] + :+ %tsgl [%limb b] [%limb %jump] ?: ?=(%& -.jum) (compose-casts a !<(mark p.jum) b) @@ -1023,11 +1024,11 @@ :: Handle `%sing` requests :: ++ aver - |= {for/(unit ship) mun/mood} + |= [for=(unit ship) mun=mood] ^- [(unit (unit (each cage lobe))) ford-cache] =+ ezy=?~(ref ~ (~(get by haw.u.ref) mun)) ?^ ezy - :_(fod.dom.red `(bind u.ezy |=(a/cage [%& a]))) + :_(fod.dom.red `(bind u.ezy |=(a=cage [%& a]))) ?: ?=([%s [%ud *] %late *] mun) :_ fod.dom.red ^- (unit (unit (each cage lobe))) @@ -1043,13 +1044,13 @@ :: Queue a move. :: ++ emit - |= mof/move + |= mof=move %_(+> mow [mof mow]) :: :: Queue a list of moves :: ++ emil - |= mof/(list move) + |= mof=(list move) %_(+> mow (weld (flop mof) mow)) :: :: Produce either null or a result along a subscription. @@ -1057,7 +1058,7 @@ :: Producing null means subscription has been completed or cancelled. :: ++ balk - |= {hen/duct cay/(unit (each cage lobe)) mun/mood} + |= [hen=duct cay=(unit (each cage lobe)) mun=mood] ^+ +> ?~ cay (blub hen) (blab hen mun u.cay) @@ -1065,13 +1066,13 @@ :: Set timer. :: ++ bait - |= {hen/duct tym/@da} + |= [hen=duct tym=@da] (emit hen %pass /tyme/(scot %p her)/[syd] %b %wait tym) :: :: Cancel timer. :: ++ best - |= {hen/duct tym/@da} + |= [hen=duct tym=@da] (emit hen %pass /tyme/(scot %p her)/[syd] %b %rest tym) :: :: Give subscription result. @@ -1123,7 +1124,7 @@ |= [lim=@da lok=case] ^- (unit aeon) ?- -.lok - $da + %da ?: (gth p.lok lim) ~ |- ^- (unit aeon) ?: =(0 let.dom) [~ 0] :: avoid underflow @@ -1136,19 +1137,19 @@ [~ let.dom] $(let.dom (dec let.dom)) :: - $tas (~(get by lab.dom) p.lok) - $ud ?:((gth p.lok let.dom) ~ [~ p.lok]) + %tas (~(get by lab.dom) p.lok) + %ud ?:((gth p.lok let.dom) ~ [~ p.lok]) == :: ++ blas - |= {hen/duct das/(set mood)} + |= [hen=duct das=(set mood)] ^+ +> ?> ?=(^ das) :: translate the case to a date :: =/ cas [%da (case-to-date case.n.das)] =/ res - (~(run in `(set mood)`das) |=(m/mood [care.m path.m])) + (~(run in `(set mood)`das) |=(m=mood [care.m path.m])) =/ gift [%wris cas res] ?: ?=(^ ref) (emit hen %slip %b %drip !>(gift)) @@ -1168,7 +1169,7 @@ :: Tell subscriber that subscription is done. :: ++ blub - |= hen/duct + |= hen=duct ?: ?=(^ ref) (emit hen %slip %b %drip !>([%writ ~])) (emit hen %give %writ ~) @@ -1180,8 +1181,8 @@ :: in `subs`. :: ++ duct-lift - |* send/_|=({duct *} ..duct-lift) - |= {a/(set duct) arg/_+<+.send} ^+ ..duct-lift + |* send=_|=([duct *] ..duct-lift) + |= [a=(set duct) arg=_+<+.send] ^+ ..duct-lift =+ all=~(tap by a) |- ^+ ..duct-lift ?~ all ..duct-lift @@ -1206,7 +1207,7 @@ =/ =desk p.riff =/ =wire /warp-index/(scot %p ship)/(scot %tas desk)/(scot %ud index) =/ =path [%question desk (scot %ud index) ~] - (emit duct %pass wire %a %plea ship %c path [[%1 ~] riff]) + (emit duct %pass wire %a %plea ship %c path `riff-any`[%1 riff]) :: :: Create a request that cannot be filled immediately. :: @@ -1245,22 +1246,22 @@ :: all get filled at once. :: ++ dedupe :: find existing alias - |= wov/wove + |= wov=wove ^- wove - =; won/(unit wove) (fall won wov) + =; won=(unit wove) (fall won wov) =* rov rove.wov ?- -.rov - $sing ~ - $next + %sing ~ + %next =+ aey=(case-to-aeon case.mood.rov) ?~ aey ~ %- ~(rep in ~(key by qyx)) - |= {haw/wove res/(unit wove)} + |= [haw=wove res=(unit wove)] ?^ res res ?. =(for.wov for.haw) ~ =* hav rove.haw =- ?:(- `haw ~) - ?& ?=($next -.hav) + ?& ?=(%next -.hav) =(mood.hav mood.rov(case case.mood.hav)) :: :: only a match if this request is before @@ -1269,16 +1270,16 @@ ?~(hay | (lte u.hay u.aey)) == :: - $mult + %mult =+ aey=(case-to-aeon case.mool.rov) ?~ aey ~ %- ~(rep in ~(key by qyx)) - |= {haw/wove res/(unit wove)} + |= [haw=wove res=(unit wove)] ?^ res res ?. =(for.wov for.haw) ~ =* hav rove.haw =- ?:(- `haw ~) - ?& ?=($mult -.hav) + ?& ?=(%mult -.hav) =(mool.hav mool.rov(case case.mool.hav)) :: :: only a match if this request is before @@ -1292,16 +1293,16 @@ == == :: - $many + %many =+ aey=(case-to-aeon from.moat.rov) ?~ aey ~ %- ~(rep in ~(key by qyx)) - |= {haw/wove res/(unit wove)} + |= [haw=wove res=(unit wove)] ?^ res res ?. =(for.wov for.haw) ~ =* hav rove.haw =- ?:(- `haw ~) - ?& ?=($many -.hav) + ?& ?=(%many -.hav) =(hav rov(from.moat from.moat.hav)) :: :: only a match if this request is before @@ -1757,7 +1758,7 @@ =/ additions=(set path) (~(dif in upsert-set) old-set) ?~ hun ~ - ?: =(0 let.dom) + ?: (lte let.dom 1) ~ |^ ;: weld @@ -1774,7 +1775,7 @@ :: ++ path-to-tank |= =path - =/ pre=^path ~[(scot %p our) syd (scot %ud +(let.dom))] + =/ pre=^path ~[(scot %p our) syd (scot %ud let.dom)] :+ %rose ["/" "/" ~] %+ turn (weld pre path) |= a=cord @@ -2572,16 +2573,16 @@ :: Output is a map of mount points to {length-of-mounted-path set-of-paths}. :: ++ must-ergo - |= [our=ship syd=desk mon=(map term beam) can/(list path)] + |= [our=ship syd=desk mon=(map term beam) can=(list path)] ^- (map term (pair @ud (set path))) %- malt ^- (list (trel term @ud (set path))) %+ murn ~(tap by mon) - |= {nam/term bem/beam} + |= [nam=term bem=beam] ^- (unit (trel term @ud (set path))) =- ?~(- ~ `[nam (lent s.bem) (silt `(list path)`-)]) %+ skim can - |= pax/path - &(=(p.bem our) =(q.bem syd) =((flop s.bem) (scag (lent s.bem) pax))) + |= pax=path + &(=(p.bem our) =(q.bem syd) =(s.bem (scag (lent s.bem) pax))) :: :: Mount a beam to unix :: @@ -2606,17 +2607,17 @@ :: Set permissions for a node. :: ++ perm - |= {pax/path rit/rite} + |= [pax=path rit=rite] ^+ +> - =/ mis/(set @ta) + =/ mis=(set @ta) %+ roll =- ~(tap in -) ?- -.rit - $r who:(fall red.rit *rule) - $w who:(fall wit.rit *rule) - $rw (~(uni in who:(fall red.rit *rule)) who:(fall wit.rit *rule)) + %r who:(fall red.rit *rule) + %w who:(fall wit.rit *rule) + %rw (~(uni in who:(fall red.rit *rule)) who:(fall wit.rit *rule)) == - |= {w/whom s/(set @ta)} + |= [w=whom s=(set @ta)] ?: |(?=(%& -.w) (~(has by cez) p.w)) s (~(put in s) p.w) ?^ mis @@ -2626,7 +2627,7 @@ +>.$ =- (emit hen %give %done `[%perm-fail [%leaf "No such group(s): {-}"]~]) %+ roll ~(tap in `(set @ta)`mis) - |= {g/@ta t/tape} + |= [g=@ta t=tape] ?~ t (trip g) :(weld t ", " (trip g)) :: TODO remove this nasty hack @@ -2636,29 +2637,29 @@ (emit hen %give %done ~) :: ?- -.rit - $r wake(per (put-perm per pax red.rit)) - $w wake(pew (put-perm pew pax wit.rit)) - $rw wake(per (put-perm per pax red.rit), pew (put-perm pew pax wit.rit)) + %r wake(per (put-perm per pax red.rit)) + %w wake(pew (put-perm pew pax wit.rit)) + %rw wake(per (put-perm per pax red.rit), pew (put-perm pew pax wit.rit)) == :: ++ put-perm - |= {pes/regs pax/path new/(unit rule)} + |= [pes=regs pax=path new=(unit rule)] ?~ new (~(del by pes) pax) (~(put by pes) pax u.new) :: :: Remove a group from all rules. :: ++ forget-crew - |= nom/@ta + |= nom=@ta %= +> per (forget-crew-in nom per) pew (forget-crew-in nom pew) == :: ++ forget-crew-in - |= {nom/@ta pes/regs} + |= [nom=@ta pes=regs] %- ~(run by pes) - |= r/rule + |= r=rule r(who (~(del in who.r) |+nom)) :: :: Cancel a request. @@ -2668,10 +2669,10 @@ :: ++ cancel-request :: release request ^+ ..cancel-request - =^ wos/(list wove) qyx - :_ (~(run by qyx) |=(a/(set duct) (~(del in a) hen))) + =^ wos=(list wove) qyx + :_ (~(run by qyx) |=(a=(set duct) (~(del in a) hen))) %- ~(rep by qyx) - |= {{a/wove b/(set duct)} c/(list wove)} + |= [[a=wove b=(set duct)] c=(list wove)] ?.((~(has in b) hen) c [a c]) :: ?~ ref @@ -2730,7 +2731,7 @@ :: %_ wake haw.u.ref - ?. ?=($sing -.rav) haw.u.ref + ?. ?=(%sing -.rav) haw.u.ref (~(put by haw.u.ref) mood.rav ~) == |^ @@ -2747,20 +2748,20 @@ |= =rand ^- (unit cage) ?- p.p.rand - $a ~| %no-big-ford-builds-across-network-for-now !! - $b ~| %i-guess-you-ought-to-build-your-own-marks !! - $c ~| %casts-should-be-compiled-on-your-own-ship !! - $d ~| %totally-temporary-error-please-replace-me !! - $p ~| %requesting-foreign-permissions-is-invalid !! - $r ~| %no-cages-please-they-are-just-way-too-big !! - $s ~| %please-dont-get-your-takos-over-a-network !! - $t ~| %requesting-foreign-directory-is-vaporware !! - $u ~| %prolly-poor-idea-to-get-rang-over-network !! - $v ~| %weird-shouldnt-get-v-request-from-network !! - $z `(validate-z r.rand) - $w `(validate-w r.rand) - $x (validate-x [p.p q.p q r]:rand) - $y `[p.r.rand !>(;;(arch q.r.rand))] + %a ~| %no-big-ford-builds-across-network-for-now !! + %b ~| %i-guess-you-ought-to-build-your-own-marks !! + %c ~| %casts-should-be-compiled-on-your-own-ship !! + %d ~| %totally-temporary-error-please-replace-me !! + %p ~| %requesting-foreign-permissions-is-invalid !! + %r ~| %no-cages-please-they-are-just-way-too-big !! + %s ~| %please-dont-get-your-takos-over-a-network !! + %t ~| %requesting-foreign-directory-is-vaporware !! + %u ~| %prolly-poor-idea-to-get-rang-over-network !! + %v ~| %weird-shouldnt-get-v-request-from-network !! + %z `(validate-z r.rand) + %w `(validate-w r.rand) + %x (validate-x [p.p q.p q r]:rand) + %y `[p.r.rand !>(;;(arch q.r.rand))] == :: :: Make sure the incoming data is a %w response @@ -2770,9 +2771,9 @@ ^- cage :- p.page ?+ p.page ~| %strange-w-over-nextwork !! - $cass !>(;;(cass q.page)) - $null [[%atom %n ~] ~] - $nako !>(~|([%molding [&1 &2 &3]:q.page] ;;(nako q.page))) + %cass !>(;;(cass q.page)) + %null [[%atom %n ~] ~] + %nako !>(~|([%molding [&1 &2 &3]:q.page] ;;(nako q.page))) == :: :: Make sure that incoming data is of the mark it claims to be. @@ -2924,7 +2925,7 @@ $(need.sat t.need.sat) :: Otherwise, fetch the next blob :: - =/ =fill [syd i.need.sat] + =/ =fill [%0 syd i.need.sat] =/ =wire /back-index/(scot %p her)/[syd]/(scot %ud inx) =/ =path [%backfill syd (scot %ud inx) ~] =. ..foreign-update @@ -3019,7 +3020,7 @@ +>.$ :: ++ rave-to-rove - |= rav/rave + |= rav=rave ^- rove ?- -.rav %sing rav @@ -3029,7 +3030,7 @@ == :: ++ rove-to-rave - |= rov/rove + |= rov=rove ^- rave ?- -.rov %sing rov @@ -3259,7 +3260,7 @@ :: :: know about file in cach :: - ++ know |=({(pair care path) c/cach} ?=(^ c)) + ++ know |=([(pair care path) c=cach] ?=(^ c)) :: :: fill in the blanks :: @@ -3375,17 +3376,17 @@ ++ lobe-to-blob ~(got by lat.ran) ++ tako-to-yaki ~(got by hut.ran) ++ lobe-to-mark - |= a/lobe + |= a=lobe => (lobe-to-blob a) ?- - - $delta p.q - $direct p.q + %delta p.q + %direct p.q == :: :: Checks whether two pieces of data (either cages or lobes) are the same. :: ++ equivalent-data - |= {one/(each cage lobe) two/(each cage lobe)} + |= [one=(each cage lobe) two=(each cage lobe)] ^- ? ?: ?=(%& -.one) ?: ?=(%& -.two) @@ -3398,7 +3399,7 @@ :: Gets a map of the data at the given path and all children of it. :: ++ lobes-at-path - |= {for/(unit ship) yon/aeon pax/path} + |= [for=(unit ship) yon=aeon pax=path] ^- (map path lobe) ?: =(0 yon) ~ :: we use %z for the check because it looks at all child paths. @@ -3409,7 +3410,7 @@ =< q %- aeon-to-yaki yon - |= {p/path q/lobe} + |= [p=path q=lobe] ?| ?=(~ pax) ?& !?=(~ p) =(-.pax -.p) @@ -3434,7 +3435,7 @@ :: Traverse parentage and find all ancestor hashes :: ++ reachable-takos :: reachable - |= p/tako + |= p=tako ^- (set tako) ~+ =| s=(set tako) @@ -3477,22 +3478,22 @@ :: already in `b`. :: ++ new-lobes :: object hash set - |= {b/(set lobe) a/(set tako)} :: that aren't in b + |= [b=(set lobe) a=(set tako)] :: that aren't in b ^- (set lobe) %+ roll ~(tap in a) - |= {tak/tako bar/(set lobe)} + |= [tak=tako bar=(set lobe)] ^- (set lobe) =+ yak=(tako-to-yaki tak) %+ roll ~(tap by q.yak) =< .(far bar) - |= {{path lob/lobe} far/(set lobe)} + |= [[path lob=lobe] far=(set lobe)] ^- (set lobe) ?~ (~(has in b) lob) :: don't need far =+ gar=(lobe-to-blob lob) ?- -.gar - $direct (~(put in far) lob) - $delta (~(put in $(lob q.q.gar)) lob) + %direct (~(put in far) lob) + %delta (~(put in $(lob q.q.gar)) lob) == :: :: Probably can get rid of the cache checks because they happen in @@ -3559,64 +3560,64 @@ :: we default to fully private (empty whitelist). :: ++ read-p - |= pax/path + |= pax=path ^- (unit (unit (each cage lobe))) =- [~ ~ %& %noun !>(-)] :- (read-p-in pax per.red) (read-p-in pax pew.red) :: ++ read-p-in - |= {pax/path pes/regs} + |= [pax=path pes=regs] ^- dict - =/ rul/(unit rule) (~(get by pes) pax) + =/ rul=(unit rule) (~(get by pes) pax) ?^ rul :+ pax mod.u.rul %- ~(rep in who.u.rul) - |= {w/whom out/(pair (set ship) (map @ta crew))} - ?: ?=({%& @p} w) + |= [w=whom out=(pair (set ship) (map @ta crew))] + ?: ?=([%& @p] w) [(~(put in p.out) +.w) q.out] - =/ cru/(unit crew) (~(get by cez.ruf) +.w) + =/ cru=(unit crew) (~(get by cez.ruf) +.w) ?~ cru out [p.out (~(put by q.out) +.w u.cru)] ?~ pax [/ %white ~ ~] $(pax (scag (dec (lent pax)) `path`pax)) :: ++ may-read - |= {who/ship car/care yon/aeon pax/path} + |= [who=ship car=care yon=aeon pax=path] ^- ? ?+ car (allowed-by who pax per.red) :: - $p + %p =(who our) :: - ?($y $z) + ?(%y %z) =+ tak=(~(get by hit.dom) yon) ?~ tak | =+ yak=(tako-to-yaki u.tak) =+ len=(lent pax) - =- (levy ~(tap in -) |=(p/path (allowed-by who p per.red))) + =- (levy ~(tap in -) |=(p=path (allowed-by who p per.red))) %+ roll ~(tap in (~(del in ~(key by q.yak)) pax)) - |= {p/path s/(set path)} + |= [p=path s=(set path)] ?. =(pax (scag len p)) s %- ~(put in s) - ?: ?=($z car) p + ?: ?=(%z car) p (scag +(len) p) == :: ++ may-write - |= {w/ship p/path} + |= [w=ship p=path] (allowed-by w p pew.red) :: ++ allowed-by - |= {who/ship pax/path pes/regs} + |= [who=ship pax=path pes=regs] ^- ? - =/ rul/real rul:(read-p-in pax pes) + =/ rul=real rul:(read-p-in pax pes) =/ in-list/? ?| (~(has in p.who.rul) who) :: %- ~(rep by q.who.rul) - |= {{@ta cru/crew} out/_|} + |= [[@ta cru=crew] out=_|] ?: out & (~(has in cru) who) == @@ -3629,12 +3630,12 @@ |= [=yaki pax=path] ^- @uvI =+ len=(lent pax) - =/ descendants/(list (pair path lobe)) + =/ descendants=(list (pair path lobe)) %+ turn %+ skim ~(tap by (~(del by q.yaki) pax)) - |= {paf/path lob/lobe} + |= [paf=path lob=lobe] =(pax (scag len paf)) - |= {paf/path lob/lobe} + |= [paf=path lob=lobe] [(slag len paf) lob] =+ us=(~(get by q.yaki) pax) ?: &(?=(~ descendants) ?=(~ us)) @@ -3642,7 +3643,7 @@ %+ roll ^- (list (pair path lobe)) [[~ ?~(us *lobe u.us)] descendants] - |=({{path lobe} @uvI} (shax (jam +<))) + |=([[path lobe] @uvI] (shax (jam +<))) :: +read-r: %x wrapped in a vase :: ++ read-r @@ -3765,15 +3766,15 @@ :: of the data is legit. We also never send the mime cache over the wire. :: ++ read-v - |= {yon/aeon pax/path} - ^- (unit (unit {$dome (hypo dome:clay)})) + |= [yon=aeon pax=path] + ^- (unit (unit [%dome (hypo dome:clay)])) ?: (lth yon let.dom) :* ~ ~ %dome -:!>(*dome:clay) ^- dome:clay :* ank=`[[%ank-in-old-v-not-implemented *ankh] ~ ~] let=yon - hit=(molt (skim ~(tap by hit.dom) |=({p/@ud *} (lte p yon)))) - lab=(molt (skim ~(tap by lab.dom) |=({* p/@ud} (lte p yon)))) + hit=(molt (skim ~(tap by hit.dom) |=([p=@ud *] (lte p yon)))) + lab=(molt (skim ~(tap by lab.dom) |=([* p=@ud] (lte p yon)))) == == ?: (gth yon let.dom) ~ @@ -3784,7 +3785,7 @@ :: For the %da case, we give just the canonical timestamp of the revision. :: ++ read-w - |= cas/case + |= cas=case ^- (unit (unit (each cage lobe))) =+ aey=(case-to-aeon cas) ?~ aey ~ @@ -3814,7 +3815,7 @@ :- ~ %+ bind fil.ank:(descend-path:(zu ank.dom) pax) - |=(a/{p/lobe q/cage} [%& q.a]) + |=(a=[p=lobe q=cage] [%& q.a]) =+ yak=(tako-to-yaki u.tak) =+ lob=(~(get by q.yak) pax) ?~ lob @@ -3822,17 +3823,17 @@ =+ mar=(lobe-to-mark u.lob) :: should convert any lobe to cage :: - ?. ?=($hoon mar) + ?. ?=(%hoon mar) [~ ~ %| u.lob] :^ ~ ~ %& :+ mar [%atom %t ~] |- ^- @t :: (urge cord) would be faster =+ bol=(lobe-to-blob u.lob) - ?: ?=($direct -.bol) + ?: ?=(%direct -.bol) ;;(@t q.q.bol) - ?> ?=($delta -.bol) + ?> ?=(%delta -.bol) =+ txt=$(u.lob q.q.bol) - ?> ?=($txt-diff p.r.bol) + ?> ?=(%txt-diff p.r.bol) =+ dif=;;((urge cord) q.r.bol) =, format =+ pac=(of-wain (lurk:differ (to-wain (cat 3 txt '\0a')) dif)) @@ -3843,8 +3844,8 @@ :: Gets an arch (directory listing) at a node. :: ++ read-y - |= {yon/aeon pax/path} - ^- (unit (unit {$arch (hypo arch)})) + |= [yon=aeon pax=path] + ^- (unit (unit [%arch (hypo arch)])) ?: =(0 yon) ``[%arch -:!>(*arch) *arch] =+ tak=(~(get by hit.dom) yon) @@ -3862,17 +3863,17 @@ %+ turn ^- (list (pair path lobe)) %+ skim ~(tap by (~(del by q.yak) pax)) - |= {paf/path lob/lobe} + |= [paf=path lob=lobe] =(pax (scag len paf)) - |= {paf/path lob/lobe} + |= [paf=path lob=lobe] =+ pat=(slag len paf) [?>(?=(^ pat) i.pat) ~] :: :: Gets a recursive hash of a node and all its children. :: ++ read-z - |= {yon/aeon pax/path} - ^- (unit (unit {$uvi (hypo @uvI)})) + |= [yon=aeon pax=path] + ^- (unit (unit [%uvi (hypo @uvI)])) ?: =(0 yon) ``uvi+[-:!>(*@uvI) *@uvI] =+ tak=(~(get by hit.dom) yon) @@ -3917,26 +3918,26 @@ %s :_(fod (bind (read-s yon path.mun) (lift |=(a=cage [%& a])))) %t :_(fod (bind (read-t yon path.mun) (lift |=(a=cage [%& a])))) %u :_(fod (read-u yon path.mun)) - %v :_(fod (bind (read-v yon path.mun) (lift |=(a/cage [%& a])))) + %v :_(fod (bind (read-v yon path.mun) (lift |=(a=cage [%& a])))) %w :_(fod (read-w case.mun)) %x :_(fod (read-x yon path.mun)) - %y :_(fod (bind (read-y yon path.mun) (lift |=(a/cage [%& a])))) - %z :_(fod (bind (read-z yon path.mun) (lift |=(a/cage [%& a])))) + %y :_(fod (bind (read-y yon path.mun) (lift |=(a=cage [%& a])))) + %z :_(fod (bind (read-z yon path.mun) (lift |=(a=cage [%& a])))) == :: Traverse an ankh. :: ++ zu :: filesystem - |= ank/ankh :: filesystem state - =| ram/path :: reverse path into + |= ank=ankh :: filesystem state + =| ram=path :: reverse path into |% ++ descend :: descend - |= lol/@ta + |= lol=@ta ^+ +> =+ you=(~(get by dir.ank) lol) +>.$(ram [lol ram], ank ?~(you [~ ~] u.you)) :: ++ descend-path :: descend recursively - |= way/path + |= way=path ^+ +> ?~(way +> $(way t.way, +> (descend i.way))) -- @@ -3957,10 +3958,11 @@ :: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: =| :: instrument state - $: ver=%5 :: vane version + $: ver=%6 :: vane version ruf=raft :: revision tree == :: -|= [our=ship now=@da eny=@uvJ ski=sley] :: current invocation +|= [our=ship now=@da eny=@uvJ rof=roof] :: current invocation +=* ski (en-sley rof) |% :: ++ call :: handle request |= $: hen=duct @@ -3989,7 +3991,7 @@ ?~ cew.req (~(del by cez.ruf) nom.req) (~(put by cez.ruf) nom.req cew.req) :: wake all desks, a request may have been affected. - =| mos/(list move) + =| mos=(list move) =/ des ~(tap in ~(key by dos.rom.ruf)) |- ?~ des [[[hen %give %done ~] mos] ..^^$] @@ -4005,7 +4007,7 @@ :: %crow =/ des ~(tap by dos.rom.ruf) - =| rus/(map desk {r/regs w/regs}) + =| rus=(map desk [r=regs w=regs]) |^ ?~ des [[hen %give %croz rus]~ ..^^$] =+ per=(filter-rules per.q.i.des) @@ -4015,11 +4017,11 @@ $(des t.des) :: ++ filter-rules - |= pes/regs + |= pes=regs ^+ pes =- (~(gas in *regs) -) %+ skim ~(tap by pes) - |= {p/path r/rule} + |= [p=path r=rule] (~(has in who.r) |+nom.req) -- :: @@ -4060,7 +4062,7 @@ =+ bem=(~(get by mon.ruf) des.req) ?: &(?=(~ bem) !=(%$ des.req)) ~|([%bad-mount-point-from-unix des.req] !!) - =/ bem/beam + =/ bem=beam ?^ bem u.bem [[our %home %ud 1] ~] @@ -4069,7 +4071,7 @@ !! :: fire next in queue =^ mos ruf =/ den ((de our now ski hen ruf) our q.bem) - abet:(into:den (flop s.bem) all.req fis.req) + abet:(into:den s.bem all.req fis.req) [mos ..^$] :: %merg :: direct state up @@ -4115,7 +4117,7 @@ == %+ turn (skim ~(tap by mon.ruf) (corl (cury test pot) tail)) - |= {pon/term bem/beam} + |= [pon=term bem=beam] [u.hez.ruf %give %ogre pon] :: %park @@ -4159,7 +4161,7 @@ =^ moves-1 ..^^$ $(desks t.desks) =^ moves-2 ruf abet:wake:((de our now ski hen ruf) [ship desk]:i.desks) [(weld moves-1 moves-2) ..^^$] - [(welp wake-moves pun.ruf) ..^$(pun.ruf ~)] + [wake-moves ..^$] :: ?(%warp %werp) :: capture whether this read is on behalf of another ship @@ -4170,13 +4172,8 @@ [~ req] :: ?: =(our who.req) :: [~ [%warp wer.req rif.req]] - =^ ver rif.req - ?@ -.rif.req - [%0 rif.req] - [-<.rif.req +.rif.req] - ?> ?=(@ -.rif.req) - :- ?:(=(our who.req) ~ `[who.req ver]) - [%warp wer.req rif.req] + :- ?:(=(our who.req) ~ `[who.req -.rif.req]) + [%warp wer.req riff.rif.req] :: ?> ?=(%warp -.req) =* rif rif.req @@ -4197,7 +4194,7 @@ =+ ;;(=fill res) =^ mos ruf =/ den ((de our now ski hen ruf) our desk.fill) - abet:(give-backfill:den +.fill) + abet:(give-backfill:den lobe.fill) [[[hen %give %done ~] mos] ..^$] ?> ?=([%question *] pax) =+ ryf=;;(riff-any res) @@ -4210,335 +4207,18 @@ == :: ++ load - !: - |^ - |= old=any-state - ~! [old=old new=*state-4] - =? old ?=(%2 -.old) (load-2-to-3 old) - =? old ?=(%3 -.old) (load-3-to-4 old) - =? old ?=(%4 -.old) (load-4-to-5 old) - ?> ?=(%5 -.old) - ..^^$(ruf +.old) - :: - ++ load-4-to-5 - |= =state-4 - ^- state-5 - state-4(- %5, pun ~) - :: - ++ load-3-to-4 - |= =state-3 - ^- state-4 - |^ - =- state-3(- %4, hoy hoy.-, rom (room-3-to-4 rom.state-3)) - ^- hoy=(map ship rung) - %- ~(run by hoy.state-3) - |= =rung-3 - ^- rung - %- ~(run by rus.rung-3) - |= =rede-3 - ^- rede - =- rede-3(ref ref.-, qyx (cult-3-to-4 qyx.rede-3)) - ^- ref=(unit rind) - ?~ ref.rede-3 - ~ - =- `u.ref.rede-3(bom bom.-) - ^- bom=(map @ud update-state) - %- ~(run by bom.u.ref.rede-3) - |= [=duct =rave] - ^- update-state - [duct rave ~ ~ ~ |] - :: - ++ room-3-to-4 - |= =room-3 - ^- room - =- room-3(dos dos.-) - ^- dos=(map desk dojo) - %- ~(run by dos.room-3) - |= =dojo-3 - ^- dojo - dojo-3(qyx (cult-3-to-4 qyx.dojo-3)) - :: - ++ cult-3-to-4 - |= =cult-3 - ^- cult - %- malt - %+ turn ~(tap by cult-3) - |= [=wove-3 ducts=(set duct)] - ^- [wove (set duct)] - :_ ducts :_ rove.wove-3 - ?~ for.wove-3 - ~ - `[u.for.wove-3 %0] - -- - :: - ++ load-2-to-3 - |= =state-2 - ^- state-3 - |^ - =- state-2(- %3, rom rom.-, hoy hoy.-, |7 [pud=~ pun.-]) - :+ ^- pun=(list move) - %+ welp - ?~ act.state-2 - ~ - ?. =(%merge -.eval-data.u.act.state-2) - ~ - =/ err - :- %ford-fusion - [leaf+"active merge canceled due to upgrade to ford fusion" ~] - [hen.u.act.state-2 %slip %b %drip !>([%mere %| err])]~ - ^- (list move) - %+ murn ~(tap to cue.state-2) - :: use ^ so we don't have to track definition of +task - :: - |= [=duct task=^] - ^- (unit move) - ?. =(%merg -.task) - ~& "queued clay write canceled due to upgrade to ford fusion:" - ~& [duct [- +<]:task] - ~ - =/ err - :- %ford-fusion - [leaf+"queued merge canceled due to upgrade to ford fusion" ~] - `[duct %slip %b %drip !>([%mere %| err])] - ^- rom=room-3 - :- hun.rom.state-2 - %- ~(urn by dos.rom.state-2) - |= [=desk =dojo-2] - ^- dojo-3 - =- dojo-2(dom -) - ^- dome - =/ fer=(unit reef-cache) - ?~ let.dom.dojo-2 - ~ - =/ =yaki - (~(got by hut.ran.state-2) (~(got by hit.dom.dojo-2) let.dom.dojo-2)) - `(build-reef desk q.yaki) - [ank let hit lab mim fod=*ford-cache fer=fer]:[dom.dojo-2 .] - ^- hoy=(map ship rung-3) - %- ~(run by hoy.state-2) - |= =rung-2 - ^- rung-3 - %- ~(run by rus.rung-2) - |= =rede-2 - ^- rede-3 - =- rede-2(ref ref.-, dom dom.-) - :- ^- dom=dome - [ank let hit lab mim fod=*ford-cache fer=~]:[dom.rede-2 .] - ^- ref=(unit rind-3) - ?~ ref.rede-2 - ~ - :- ~ - ^- rind-3 - =/ rin=rind-3 [nix bom fod haw]:u.ref.rede-2 - =. rin - =/ pur=(list [inx=@ud =rand *]) ~(tap by pur.u.ref.rede-2) - |- ^+ rin - ?~ pur rin - =/ =mood [p.p q.p q]:rand.i.pur - =: haw.rin (~(put by haw.rin) mood ~) - bom.rin (~(del by bom.rin) inx.i.pur) - fod.rin ?~ got=(~(get by bom.rin) inx.i.pur) - fod.rin - (~(del by fod.rin) p.u.got) - == - $(pur t.pur) - =/ pud ~(tap to waiting.pud.u.ref.rede-2) - |- ^+ rin - ?~ pud rin - =: bom.rin (~(del by bom.rin) inx.i.pud) - fod.rin ?~ got=(~(get by bom.rin) inx.i.pud) - fod.rin - (~(del by fod.rin) p.u.got) - == - $(pud t.pud) - :: - ++ build-reef - |= [=desk data=(map path lobe)] - ^- reef-cache - ~> %slog.0^leaf+"clay: building reef on {}" - ?: =(%home desk) - [!>(..ride) !>(..is) !>(..zuse)] - |^ - =/ [home=? hoon=vase] - ?: (same-as-home /sys/hoon/hoon) - &+!>(..ride) - |+build-hoon - :- hoon - =/ [home=? arvo=vase] - ?: &(home (same-as-home /sys/arvo/hoon)) - &+!>(..is) - |+(build-arvo hoon) - :- arvo - ?: &(home (same-as-home /sys/zuse/hoon)) - !>(..zuse) - (build-zuse arvo) - :: - ++ build-hoon - %- road |. - ~> %slog.0^leaf+"clay: building hoon on {}" - =/ gen - ~> %mean.%hoon-parse-fail - %+ rain /sys/hoon/hoon - (lobe-to-cord (~(got by data) /sys/hoon/hoon)) - ~> %mean.%hoon-compile-fail - (slot 7 (slap !>(0) gen)) - :: - ++ build-arvo - |= hoon=vase - %- road |. - ~> %slog.0^leaf+"clay: building arvo on {}" - =/ gen - ~> %mean.%arvo-parse-fail - %+ rain /sys/arvo/hoon - (lobe-to-cord (~(got by data) /sys/arvo/hoon)) - ~> %mean.%arvo-compile-fail - (slap (slap hoon gen) !,(*^hoon ..is)) - :: - ++ build-zuse - |= arvo=vase - %- road |. - ~> %slog.0^leaf+"clay: building zuse on {}" - =/ gen - ~> %mean.%zuse-parse-fail - %+ rain /sys/zuse/hoon - (lobe-to-cord (~(got by data) /sys/zuse/hoon)) - ~> %mean.%zuse-compile-fail - (slap arvo gen) - :: - ++ same-as-home - |= =path - ^- ? - =/ our-lobe=lobe (~(got by data) path) - =/ =dome-2 dom:(~(got by dos.rom.state-2) %home) - =/ =yaki (~(got by hut.ran.state-2) (~(got by hit.dome-2) let.dome-2)) - =(`our-lobe (~(get by q.yaki) path)) - :: - ++ lobe-to-cord - |= =lobe - ^- @t - =- ?:(?=(%& -<) p.- (of-wain:format p.-)) - |- ^- (each @t wain) - =/ =blob (~(got by lat.ran.state-2) lobe) - ?- -.blob - %direct [%& ;;(@t q.q.blob)] - %delta - :- %| - %+ lurk:differ - =- ?:(?=(%| -<) p.- (to-wain:format p.-)) - $(lobe q.q.blob) - ~| diff=r.blob - ;;((urge cord) q.r.blob) - == - -- - -- - :: - +$ any-state $%(state-5 state-4 state-3 state-2) - +$ state-5 [%5 raft] - +$ state-4 - $: %4 - rom=room - hoy=(map ship rung) - ran=rang - mon=(map term beam) - hez=(unit duct) - cez=(map @ta crew) - pud=(unit [=desk =yoki]) - pun=(list *) - == - +$ state-3 - $: %3 - rom=room-3 - hoy=(map ship rung-3) - ran=rang - mon=(map term beam) - hez=(unit duct) - cez=(map @ta crew) - pud=(unit [=desk =yoki]) - pun=(list *) - == - +$ rung-3 rus=(map desk rede-3) - +$ rede-3 - $: lim/@da - ref/(unit rind-3) - qyx/cult-3 - dom/dome - per/regs - pew/regs - == - +$ rind-3 - $: nix/@ud - bom/(map @ud {p/duct q/rave}) - fod/(map duct @ud) - haw/(map mood (unit cage)) - == - +$ room-3 - $: hun/duct - dos/(map desk dojo-3) - == - ++ dojo-3 - $: qyx/cult-3 - dom/dome - per/regs - pew/regs - == - +$ cult-3 (jug wove-3 duct) - +$ wove-3 [for=(unit ship) =rove] - +$ state-2 - $: %2 - rom=room-2 :: domestic - hoy=(map ship rung-2) :: foreign - ran=rang :: hashes - mon=(map term beam) :: mount points - hez=(unit duct) :: sync duct - cez=(map @ta crew) :: permission groups - cue=(qeu [=duct task=^]) :: queued requests - act=active-write-2 :: active write - == :: - +$ room-2 - $: hun/duct :: terminal duct - dos/(map desk dojo-2) :: native desk - == :: - +$ dojo-2 - $: qyx/cult-3 :: subscribers - dom/dome-2 :: desk state - per/regs :: read perms per path - pew/regs :: write perms per path - == - +$ dome-2 - $: ank/ankh :: state - let/aeon :: top id - hit/(map aeon tako) :: versions by id - lab/(map @tas aeon) :: labels - mim/(map path mime) :: mime cache - == :: - +$ rung-2 rus=(map desk rede-2) - +$ rede-2 - $: lim/@da :: complete to - ref/(unit rind-2) :: outgoing requests - qyx/cult-3 :: subscribers - dom/dome-2 :: revision state - per/regs :: read perms per path - pew/regs :: write perms per path - == :: - +$ rind-2 - $: nix/@ud :: request index - bom/(map @ud {p/duct q/rave}) :: outstanding - fod/(map duct @ud) :: current requests - haw/(map mood (unit cage)) :: simple cache - pud/update-qeu-2 :: active updates - pur/request-map-2 :: active requests - == :: - +$ request-map-2 (map inx=@ud [=rand eval-form=*]) - +$ update-qeu-2 - $: waiting=(qeu [inx=@ud rut=(unit rand)]) - eval-data=(unit [inx=@ud rut=(unit rand) eval-form=*]) - == - +$ active-write-2 (unit [hen=duct req=* eval-data=^]) - -- + |= old=[%6 raft] + ..^$(ruf +.old) :: ++ scry :: inspect - |= {fur/(unit (set monk)) ren/@tas why/shop syd/desk lot/coin tyl/path} + |= [lyc=gang cyr=term bem=beam] ^- (unit (unit cage)) + =* ren cyr + =/ why=shop &/p.bem + =* syd q.bem + =/ lot=coin $/r.bem + =* tyl s.bem + :: ?. ?=(%& -.why) ~ =* his p.why ?: &(=(ren %$) =(tyl /whey)) @@ -4552,13 +4232,8 @@ =+ run=((soft care) ren) ?~ run [~ ~] ::TODO if it ever gets filled properly, pass in the full fur. - =/ for/(unit ship) - %- ~(rep in (fall fur ~)) - |= {m/monk s/(unit ship)} - ?^ s s - ?: ?=(%| -.m) ~ - ?: =(p.m his) ~ - `p.m + :: + =/ for=(unit ship) ?~(lyc ~ ?~(u.lyc ~ `n.u.lyc)) =/ den ((de our now ski [/scryduct ~] ruf) his syd) =/ result (mule |.(-:(aver:den for u.run u.luk tyl))) ?: ?=(%| -.result) diff --git a/pkg/arvo/sys/vane/dill.hoon b/pkg/arvo/sys/vane/dill.hoon index 58b2b5004..00feb64f6 100644 --- a/pkg/arvo/sys/vane/dill.hoon +++ b/pkg/arvo/sys/vane/dill.hoon @@ -1,37 +1,37 @@ !: :: dill (4d), terminal handling :: -|= pit/vase +|= pit=vase =, dill => |% :: interface tiles -++ gill (pair ship term) :: general contact ++$ gill (pair ship term) :: general contact -- :: => |% :: console protocol -++ axle :: ++$ axle :: $: %4 ::TODO replace ducts with session ids :: - hey/(unit duct) :: default duct - dug/(map duct axon) :: conversations + hey=(unit duct) :: default duct + dug=(map duct axon) :: conversations eye=(jug duct duct) :: outside listeners - lit/? :: boot in lite mode + lit=? :: boot in lite mode $= veb :: vane verbosities $~ (~(put by *(map @tas log-level)) %hole %soft) :: quiet packet crashes (map @tas log-level) :: == :: -++ axon :: dill per duct - $: ram/term :: console program - tem/(unit (list dill-belt)) :: pending, reverse - wid/_80 :: terminal width - pos/@ud :: cursor position ++$ axon :: dill per duct + $: ram=term :: console program + tem=(unit (list dill-belt)) :: pending, reverse + wid=_80 :: terminal width + pos=@ud :: cursor position see=$%([%lin (list @c)] [%klr stub]) :: current line == :: +$ log-level ?(%hush %soft %loud) :: none, line, full -- => :: |% :: protocol outward -++ mess :: - $% {$dill-belt p/(hypo dill-belt)} :: ++$ mess :: + $% [%dill-belt p=(hypo dill-belt)] :: == :: -++ move {p/duct q/(wind note gift:able)} :: local move -++ note :: out request $-> ++$ move [p=duct q=(wind note gift:able)] :: local move ++$ note :: out request $-> $~ [%d %verb ~] :: $% $: %c :: $> $? %merg :: merge desks @@ -64,7 +64,7 @@ == :: task:able:jael :: == == :: -++ sign :: in result $<- ++$ sign :: in result $<- $~ [%j %init *@p] :: $% $: %b :: $% $>(%writ gift:able:clay) :: XX %slip @@ -93,40 +93,41 @@ == == :: :::::::: :: dill tiles -- -=| all/axle -|= [our=ship now=@da eny=@uvJ ski=sley] :: current invocation +=| all=axle +|= [our=ship now=@da eny=@uvJ rof=roof] :: current invocation +=* ski (en-sley rof) => ~% %dill ..is ~ |% ++ as :: per cause - =| moz/(list move) + =| moz=(list move) |_ [hen=duct axon] ++ abet :: resolve - ^- {(list move) axle} + ^- [(list move) axle] [(flop moz) all(dug (~(put by dug.all) hen +<+))] :: ++ call :: receive input - |= kyz/task:able + |= kyz=task:able ^+ +> ?+ -.kyz ~& [%strange-kiss -.kyz] +> - $flow +> - $harm +> - $hail (send %hey ~) - $belt (send `dill-belt`p.kyz) - $text (from %out (tuba p.kyz)) - $crud :: (send `dill-belt`[%cru p.kyz q.kyz]) + %flow +> + %harm +> + %hail (send %hey ~) + %belt (send `dill-belt`p.kyz) + %text (from %out (tuba p.kyz)) + %crud :: (send `dill-belt`[%cru p.kyz q.kyz]) (crud p.kyz q.kyz) - $blew (send %rez p.p.kyz q.p.kyz) - $heft (dump %whey ~) - $lyra (dump kyz) - $meld (dump kyz) - $pack (dump kyz) - $crop (dump trim+p.kyz) - $veer (dump kyz) - $verb (dump kyz) + %blew (send %rez p.p.kyz q.p.kyz) + %heft (dump %whey ~) + %lyra (dump kyz) + %meld (dump kyz) + %pack (dump kyz) + %crop (dump trim+p.kyz) + %veer (dump kyz) + %verb (dump kyz) == :: ++ crud - |= {err/@tas tac/(list tank)} + |= [err=@tas tac=(list tank)] :: unknown errors default to %loud :: =/ lev=log-level (~(gut by veb.all) err %loud) @@ -146,12 +147,12 @@ $(wall t.wall, +>.^$ (from %out (tuba i.wall))) :: ++ dump :: pass down to hey - |= git/gift:able + |= git=gift:able ?> ?=(^ hey.all) +>(moz [[u.hey.all %give git] moz]) :: ++ done :: return gift - |= git/gift:able + |= git=gift:able =- +>.$(moz (weld - moz)) %+ turn :- hen @@ -167,30 +168,30 @@ +>(moz :_(moz [hen %pass wire note])) :: ++ from :: receive blit - |= bit/dill-blit + |= bit=dill-blit ^+ +> - ?: ?=($mor -.bit) + ?: ?=(%mor -.bit) |- ^+ +>.^$ ?~ p.bit +>.^$ $(p.bit t.p.bit, +>.^$ ^$(bit i.p.bit)) - ?: ?=($out -.bit) + ?: ?=(%out -.bit) %+ done %blit :~ [%lin p.bit] [%mor ~] see [%hop pos] == - ?: ?=($klr -.bit) + ?: ?=(%klr -.bit) %+ done %blit :~ [%klr p.bit] [%mor ~] see [%hop pos] == - ?: ?=($pro -.bit) + ?: ?=(%pro -.bit) =. see [%lin p.bit] (done %blit [see [%hop pos] ~]) - ?: ?=($pom -.bit) + ?: ?=(%pom -.bit) ::NOTE treat "styled prompt" without style as plain prompt, :: to allow rendering by older runtimes ::TODO remove me once v0.10.9+ has high/guaranteed adoption @@ -199,9 +200,9 @@ $(bit [%pro (zing (turn p.bit tail))]) =. see [%klr p.bit] (done %blit [see [%hop pos] ~]) - ?: ?=($hop -.bit) + ?: ?=(%hop -.bit) (done(pos p.bit) %blit [bit ~]) - ?: ?=($qit -.bit) + ?: ?=(%qit -.bit) (dump %logo ~) (done %blit [bit ~]) :: XX move @@ -222,7 +223,7 @@ =/ can (clan:title our) =. tem ~ =. +> (pass / %g %conf ram) - =? +> ?=(?($earl $duke $king) can) + =? +> ?=(?(%earl %duke %king) can) (ota (sein our) %kids) :: make kids desk publicly readable, so syncs work. :: @@ -234,12 +235,12 @@ $(myt t.myt, +>+ (send i.myt)) :: ++ into :: preinitialize - |= gyl/(list gill) - =. tem `(turn gyl |=(a/gill [%yow a])) + |= gyl=(list gill) + =. tem `(turn gyl |=(a=gill [%yow a])) (pass / [%c %warp our %home `[%sing %y [%ud 1] /]]) :: ++ send :: send action - |= bet/dill-belt + |= bet=dill-belt ^+ +> ?^ tem +>(tem `[bet u.tem]) @@ -252,7 +253,7 @@ (deal / [%watch /drum]) :: ++ show :: permit reads on desk - |= des/desk + |= des=desk (pass /show [%c %perm des / r+`[%black ~]]) :: ++ ota @@ -260,7 +261,7 @@ (deal /sync %poke %kiln-ota !>(`syn)) :: ++ take :: receive - |= {tea/wire sih/sign} + |= [tea=wire sih=sign] ^+ +> ?- sih [%j %init *] @@ -268,42 +269,42 @@ :: +>(moz :_(moz [hen %give +.sih])) :: - {$g $onto *} + [%g %onto *] :: ~& [%take-gall-onto +>.sih] ?- -.+>.sih %| (crud %onto p.p.+>.sih) %& (done %blit [%lin (tuba "{}")]~) == :: - {$g $unto *} + [%g %unto *] :: ~& [%take-gall-unto +>.sih] ?- -.+>.sih - $poke-ack ?~(p.p.+>.sih +>.$ (crud %coup u.p.p.+>.sih)) - $kick peer - $watch-ack ?~ p.p.+>.sih + %poke-ack ?~(p.p.+>.sih +>.$ (crud %coup u.p.p.+>.sih)) + %kick peer + %watch-ack ?~ p.p.+>.sih +>.$ (dump:(crud %reap u.p.p.+>.sih) %logo ~) - $fact (from ;;(dill-blit q:`vase`+>+>.sih)) + %fact (from ;;(dill-blit q:`vase`+>+>.sih)) == :: - {$c $note *} + [%c %note *] (from %out (tuba p.sih ' ' ~(ram re q.sih))) :: - {?($b $c) $writ *} + [?(%b %c) %writ *] init :: - {?($b %c) $mere *} + [?(%b %c) %mere *] ?: ?=(%& -.p.sih) mere (mean >%dill-mere-fail< >p.p.p.sih< q.p.p.sih) :: - {$d $blit *} + [%d %blit *] (done +.sih) == -- :: ++ ax :: make ++as - |= hen/duct + |= hen=duct ^- (unit _as) =/ nux (~(get by dug.all) hen) ?~ nux ~ @@ -409,83 +410,20 @@ [moz ..^$] :: ++ load :: import old state - => |% - :: without .dog - :: - ++ axle-1 - $: $1 - hey/(unit duct) - dug/(map duct axon-3) - lit/? - $= hef - $: a/(unit mass) - b/(unit mass) - c/(unit mass) - e/(unit mass) - f/(unit mass) - g/(unit mass) - i/(unit mass) - j/(unit mass) - == - $= veb - $~ (~(put by *(map @tas log-level)) %hole %soft) - (map @tas log-level) - == - :: - ++ axle-2 - $: %2 - hey/(unit duct) - dug/(map duct axon-3) - lit/? - dog/_| - $= hef - $: a/(unit mass) - b/(unit mass) - c/(unit mass) - e/(unit mass) - f/(unit mass) - g/(unit mass) - i/(unit mass) - j/(unit mass) - == - $= veb - $~ (~(put by *(map @tas log-level)) %hole %soft) - (map @tas log-level) - == - :: - +$ axle-3 - $: %3 - hey=(unit duct) - dug=(map duct axon-3) - lit=? - $= veb - $~ (~(put by *(map @tas log-level)) %hole %soft) - (map @tas log-level) - == - +$ axon-3 - $: ram=term - tem=(unit (list dill-belt)) - wid=_80 - pos=@ud - see=(list @c) - == - :: - +$ axle-any - $%(axle-1 axle-2 axle-3 axle) - -- - :: - |= old=axle-any - ?- -.old - %1 $(old [%2 [hey dug lit dog=& hef veb]:old]) - %2 $(old [%3 [hey dug lit veb]:old]) - %3 =- $(old [%4 hey.old - ~ lit.old veb.old]) - (~(run by dug.old) |=(a=axon-3 a(see lin+see.a))) - %4 ..^$(all old) - == + |= old=axle + ..^$(all old) :: ++ scry - |= {fur/(unit (set monk)) ren/@tas why/shop syd/desk lot/coin tyl/path} + |= [lyc=gang cyr=term bem=beam] ^- (unit (unit cage)) + =* ren cyr + =* why=shop &/p.bem + =* syd q.bem + =* lot=coin $/r.bem + =* tyl s.bem + :: + ?. ?=(%& -.why) ~ + =* his p.why ::TODO don't special-case whey scry :: ?: &(=(ren %$) =(tyl /whey)) @@ -519,7 +457,7 @@ ++ stay all :: ++ take :: process move - |= {tea/wire hen/duct dud/(unit goof) hin/(hypo sign)} + |= [tea=wire hen=duct dud=(unit goof) hin=(hypo sign)] ^+ [*(list move) ..^$] ?^ dud ~|(%dill-take-dud (mean tang.u.dud)) diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index 758e7d410..109397c00 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -419,9 +419,9 @@ :: +render-tang-to-marl: renders a tang and adds
tags between each line :: ++ render-tang-to-marl - |= {wid/@u tan/tang} + |= [wid=@u tan=tang] ^- marl - =/ raw=(list tape) (zing (turn tan |=(a/tank (wash 0^wid a)))) + =/ raw=(list tape) (zing (turn tan |=(a=tank (wash 0^wid a)))) :: |- ^- marl ?~ raw ~ @@ -429,7 +429,7 @@ :: +render-tang-to-wall: renders tang as text lines :: ++ render-tang-to-wall - |= {wid/@u tan/tang} + |= [wid=@u tan=tang] ^- wall (zing (turn tan |=(a=tank (wash 0^wid a)))) :: +wall-to-octs: text to binary output @@ -644,7 +644,7 @@ ?- -.action %gen =/ bek=beak [our desk.generator.action da+now] - =/ sup=spur (flop path.generator.action) + =/ sup=spur path.generator.action =/ ski (scry [%141 %noun] ~ %ca bek sup) =/ cag=cage (need (need ski)) ?> =(%vase p.cag) @@ -768,7 +768,7 @@ ++ do-scry |= [care=term =desk =path] ^- (unit (unit cage)) - (scry [%141 %noun] ~ care [our desk da+now] (flop path)) + (scry [%141 %noun] ~ care [our desk da+now] path) :: ++ error-response |= [status=@ud =tape] @@ -1650,7 +1650,7 @@ =* desc=tape "from {(trip have)} to json" =/ tube=(unit tube:clay) =/ tuc=(unit (unit cage)) - (scry [%141 %noun] ~ %cc [our %home da+now] (flop /[have]/json)) + (scry [%141 %noun] ~ %cc [our %home da+now] /[have]/json) ?. ?=([~ ~ *] tuc) ~ `!<(tube:clay q.u.u.tuc) ?~ tube @@ -2110,7 +2110,8 @@ =| ax=axle :: a vane is activated with current date, entropy, and a namespace function :: -|= [our=ship now=@da eny=@uvJ scry-gate=sley] +|= [our=ship now=@da eny=@uvJ rof=roof] +=* scry-gate (en-sley rof) :: allow jets to be registered within this core :: ~% %http-server ..is ~ @@ -2266,7 +2267,7 @@ :: %turf =* domains domains.server-state.ax - =/ mod/(set turf) + =/ mod=(set turf) ?: ?=(%put action.http-rule.task) (~(put in domains) turf.http-rule.task) (~(del in domains) turf.http-rule.task) @@ -2506,121 +2507,23 @@ :: +load: migrate old state to new state (called on vane reload) :: ++ load - => |% - +$ axle-2020-9-30 - [date=%~2020.9.30 server-state=server-state-2020-9-30] - :: - +$ server-state-2020-9-30 - $: bindings=(list [=binding =duct =action]) - =cors-registry - connections=(map duct outstanding-connection) - =authentication-state - channel-state=channel-state-2020-9-30 - domains=(set turf) - =http-config - ports=[insecure=@ud secure=(unit @ud)] - outgoing-duct=duct - == - :: - +$ channel-state-2020-9-30 - $: session=(map @t channel-2020-9-30) - duct-to-key=(map duct @t) - == - :: - +$ channel-2020-9-30 - $: state=(each timer duct) - next-id=@ud - events=(qeu [id=@ud lines=wall]) - subscriptions=(map wire [ship=@p app=term =path duc=duct]) - heartbeat=(unit timer) - == - :: - +$ axle-2020-5-29 - [date=%~2020.5.29 server-state=server-state-2020-5-29] - :: - +$ server-state-2020-5-29 - $: bindings=(list [=binding =duct =action]) - connections=(map duct outstanding-connection) - =authentication-state - channel-state=channel-state-2020-9-30 - domains=(set turf) - =http-config - ports=[insecure=@ud secure=(unit @ud)] - outgoing-duct=duct - == - +$ axle-2019-10-6 - [date=%~2019.10.6 server-state=server-state-2019-10-6] - :: - +$ server-state-2019-10-6 - $: bindings=(list [=binding =duct =action]) - connections=(map duct outstanding-connection) - authentication-state=sessions=(map @uv @da) - channel-state=channel-state-2020-9-30 - domains=(set turf) - =http-config - ports=[insecure=@ud secure=(unit @ud)] - outgoing-duct=duct - == - -- - |= old=$%(axle axle-2019-10-6 axle-2020-5-29 axle-2020-9-30) + |= old=axle ^+ ..^$ - :: - ~! %loading - ?- -.old - %~2020.10.18 ..^$(ax old) - :: - %~2020.9.30 - %_ $ - date.old %~2020.10.18 - :: - ::NOTE soft-breaks the reconnect case, but is generally less disruptive - :: than wiping channels entirely. - session.channel-state.server-state.old - %- ~(run by session.channel-state.server-state.old) - |= channel-2020-9-30 - ^- channel - =/ subscriptions - %- ~(gas by *(map @ud [@p term path duct])) - %+ turn ~(tap by subscriptions) - |= [=wire rest=[@p term path duct]] - [(slav %ud (snag 3 wire)) rest] - :* state next-id now - *(qeu [@ud @ud channel-event]) - *(map @ud @ud) - subscriptions heartbeat - == - == - :: - %~2020.5.29 - %_ $ - date.old %~2020.9.30 - server-state.old [-.server-state.old *cors-registry +.server-state.old] - == - :: - %~2019.10.6 - =^ success bindings.server-state.old - %+ insert-binding - [[~ /~/logout] [/e/load/logout]~ [%logout ~]] - bindings.server-state.old - ~? !success [%e %failed-to-setup-logout-endpoint] - =^ success bindings.server-state.old - %+ insert-binding - [[~ /~/scry] [/e/load/scry]~ [%scry ~]] - bindings.server-state.old - ~? !success [%e %failed-to-setup-scry-endpoint] - %_ $ - date.old %~2020.5.29 - sessions.authentication-state.server-state.old ~ - == - == + ..^$(ax old) :: +stay: produce current state :: ++ stay `axle`ax :: +scry: request a path in the urbit namespace :: ++ scry - |= [fur=(unit (set monk)) ren=@tas why=shop syd=desk lot=coin tyl=path] + |= [lyc=gang cyr=term bem=beam] ^- (unit (unit cage)) + =* ren cyr + =* why=shop &/p.bem + =* syd q.bem + =/ lot=coin $/r.bem + =* tyl s.bem + :: ?. ?=(%& -.why) ~ =* who p.why diff --git a/pkg/arvo/sys/vane/ford.hoon b/pkg/arvo/sys/vane/ford.hoon index 65567bff2..74060a1f7 100644 --- a/pkg/arvo/sys/vane/ford.hoon +++ b/pkg/arvo/sys/vane/ford.hoon @@ -1,6 +1,6 @@ !: |= pit=vase -|= [our=ship now=@da eny=@uvJ ski=sley] +|= [our=ship now=@da eny=@uvJ rof=roof] |% ++ call |=(* ((slog leaf+"ford: gone (+call)" ~) `..^$)) ++ take |=(* ((slog leaf+"ford: gone (+take)" ~) `..^$)) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index efd678317..3b2241951 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -1,4 +1,4 @@ -:: :: %gall, agent execution +!: :: %gall, agent execution !? 163 :: :::: @@ -53,16 +53,17 @@ :: +$ yoke $: control-duct=duct + nonce=@t live=? =stats =watches - =agent + agent=(each agent vase) =beak marks=(map duct mark) == :: $blocked-move: enqueued move to an agent :: -+$ blocked-move [=duct =routes =deal] ++$ blocked-move [=duct =routes move=(each deal sign:agent)] :: $stats: statistics :: :: change: how many moves this agent has processed @@ -86,6 +87,9 @@ :: %s: watch :: %u: leave :: ++$ ames-request-all + $% [%0 ames-request] + == +$ ames-request $% [%m =mark noun=*] [%l =mark =path] @@ -123,10 +127,11 @@ :: +$ egg $: control-duct=duct + nonce=@t live=? =stats =watches - old-state=vase + old-state=(each vase vase) =beak marks=(map duct mark) == @@ -135,9 +140,10 @@ :: =< =* adult-gate . =| =spore - |= [our=ship now=@da eny=@uvJ ski=sley] + |= [our=ship now=@da eny=@uvJ rof=roof] =* pupal-gate . =* adult-core (adult-gate +<) + =* ski (en-sley rof) =< |% ++ call ^call ++ load ^load @@ -166,9 +172,11 @@ ?~ apps mo-core ~> %slog.[0 leaf+"gall: upgrading {}"] =/ ap-core (ap-abut:ap:mo-core i.apps) - =^ tan ap-core (ap-install:ap-core `old-state.egg.i.apps) - ?^ tan - (mean u.tan) + =? ap-core ?=(%& -.old-state.egg.i.apps) + =^ tan ap-core (ap-install:ap-core `p.old-state.egg.i.apps) + ?^ tan + (mean u.tan) + ap-core =? ap-core wipe-eyre-subs.spore =/ ducts=(list ^duct) %+ skim ~(tap in ~(key by inbound.watches.egg.i.apps)) @@ -217,125 +225,21 @@ (molt duct `[duct %pass wire %b %huck sign]) :: ++ load - |^ - |= old=all-state - =. spore (upgrade old) + |= old=^spore + =. spore old ?. =(~ eggs.spore) pupal-gate ~> %slog.[0 leaf+"gall: direct morphogenesis"] %_ adult-gate state [- +>]:spore(eggs *(map term yoke)) == - :: - ++ upgrade - |= =all-state - ^- spore-7 - :: - =? all-state ?=(%0 -.all-state) - (state-0-to-1 all-state) - :: - =? all-state ?=(%1 -.all-state) - (state-1-to-2 all-state) - :: - =? all-state ?=(%2 -.all-state) - (state-2-to-3 all-state) - :: - =? all-state ?=(%3 -.all-state) - (state-3-to-4 all-state) - :: - =? all-state ?=(%4 -.all-state) - (state-4-to-5 all-state) - :: - =? all-state ?=(%5 -.all-state) - (state-5-to-spore-6 all-state) - :: - =? all-state ?=(%6 -.all-state) - (spore-6-to-7 all-state) - :: - ?> ?=(%7 -.all-state) - all-state - :: +all-state: upgrade path - :: - +$ all-state - $% state-0 state-1 state-2 state-3 state-4 state-5 - spore-6 spore-7 - == - :: - ++ spore-6-to-7 |=(s=spore-6 `spore-7`[%7 & +.s]) - :: - ++ state-5-to-spore-6 - |= s=state-5 - ^- spore-6 - %= s - - %6 - outstanding ~ :: TODO: do we need to process these somehow? - running - (~(run by running.s) |=(y=yoke-0 +:y(agent on-save:agent.y))) - == - :: - ++ state-4-to-5 |=(s=state-4 `state-5`s(- %5, outstanding ~)) - ++ state-3-to-4 |=(s=state-3 `state-4`s(- %4, outstanding ~)) - ++ state-2-to-3 |=(s=state-2 `state-3`s(- %3)) - ++ state-1-to-2 |=(s=state-1 `state-2`s(- %2, +< +<.s, +> `+>.s)) - ++ state-0-to-1 |=(s=state-0 `state-1`s(- %1)) - :: - +$ spore-7 ^spore - +$ spore-6 [%6 _+>:*spore-7] - +$ state-5 [%5 agents-2] - +$ state-4 [%4 agents-2] - +$ state-3 [%3 agents-2] - +$ state-2 [%2 agents-2] - +$ state-1 [%1 agents-0] - +$ state-0 [%0 agents-0] - :: - +$ agents-2 - $: system-duct=duct - outstanding=(map [wire duct] (qeu remote-request)) - contacts=(set ship) - running=(map term yoke-0) - blocked=(map term (qeu blocked-move)) - == - :: - +$ agents-0 - $: system-duct=duct - contacts=(set ship) - running=(map term yoke-0) - blocked=(map term (qeu blocked-move)) - == - :: - +$ yoke-0 - $: cache=worm - control-duct=duct - live=? - =stats - =watches - agent=any-agent - =beak - marks=(map duct mark) - == - :: - ++ any-agent - $_ - ^| - |_ bowl - ++ on-init ** - ++ on-save *vase - ++ on-load ** - ++ on-poke ** - ++ on-watch ** - ++ on-leave ** - ++ on-peek ** - ++ on-agent ** - ++ on-arvo ** - ++ on-fail ** - -- - -- -- :: adult gall vane interface, for type compatibility with pupa :: =| state=state-7 -|= [our=ship now=@da eny=@uvJ ski=sley] +|= [our=ship now=@da eny=@uvJ rof=roof] =* gall-payload . +=* ski (en-sley rof) =< ~% %gall-wrap ..mo ~ |% ++ call ^call @@ -419,12 +323,17 @@ =/ =routes [disclosing=~ attributing=our] =/ ap-core (ap-abed:ap dap routes) =. ap-core (ap-reinstall:ap-core agent) - ap-abet:ap-core + =. mo-core ap-abet:ap-core + (mo-clear-queue dap) :: =. yokes.state %+ ~(put by yokes.state) dap - =/ default-yoke *yoke - default-yoke(control-duct hen, beak bek, agent agent) + %* . *yoke + control-duct hen + beak bek + agent &+agent + nonce (scot %uw (end 5 1 (shas %yoke-nonce eny))) + == :: =/ old mo-core =/ wag @@ -461,10 +370,12 @@ [%z /sys/arvo/hoon] [%z /sys/zuse/hoon] [%z /sys/vane/gall/hoon] - %+ turn ~(tap in ~(key by yokes.state)) - |= dap=term - ^- [care:clay path] - [%a /app/[dap]/hoon] + %+ murn ~(tap by yokes.state) + |= [dap=term =yoke] + ^- (unit [care:clay path]) + ?: ?=(%| -.agent.yoke) + ~ + `[%a /app/[dap]/hoon] == (mo-pass wire %c %warp our %home ~ %mult mool) :: +mo-scry-agent-cage: read $agent core from clay @@ -473,7 +384,7 @@ |= [dap=term =case:clay] ^- (each agent tang) =/ bek=beak [our %home case] - =/ sky (ski [%141 %noun] ~ %ca bek /hoon/[dap]/app) + =/ sky (ski [%141 %noun] ~ %ca bek /app/[dap]/hoon) ?~ sky |+[leaf+"gall: {} scry blocked"]~ ?~ u.sky |+[leaf+"gall: {} scry failed"]~ =/ =cage u.u.sky @@ -492,7 +403,8 @@ :: =. mo-core (mo-track-ship ship) ?< ?=(?(%raw-poke %poke-as) -.deal) - =/ =ames-request + =/ =ames-request-all + :- %0 ?- -.deal %poke [%m p.cage.deal q.q.cage.deal] %leave [%u ~] @@ -505,7 +417,7 @@ :: =/ =note-arvo =/ =path /ge/[foreign-agent] - [%a %plea ship %g path ames-request] + [%a %plea ship %g path ames-request-all] :: =. outstanding.state =/ stand @@ -769,7 +681,9 @@ =/ sys-wire [%sys wire] :: TODO: %drip %kick so app crash can't kill the remote %pull :: - =. mo-core (mo-pass sys-wire %a %plea ship %g /ge/[foreign-agent] %u ~) + =/ =ames-request-all [%0 %u ~] + =. mo-core + (mo-pass sys-wire %a %plea ship %g /ge/[foreign-agent] ames-request-all) =. mo-core (mo-give %unto %kick ~) mo-core == @@ -785,26 +699,45 @@ |= [=path =sign-arvo] ^+ mo-core :: - ?. ?=([@ @ *] path) + ?. ?=([@ @ @ *] path) ~& [%mo-handle-use-bad-path path] !! :: + =/ dap=term i.path + =/ yoke (~(get by yokes.state) dap) + ?~ yoke + %- (slog leaf+"gall: {} dead, got {<+<.sign-arvo>}" ~) + mo-core + ?. =(nonce.u.yoke i.t.path) + %- (slog leaf+"gall: got old {<+<.sign-arvo>} for {}" ~) + mo-core ?. ?=([?(%g %b) %unto *] sign-arvo) + ?: ?=(%| -.agent.u.yoke) + %- (slog leaf+"gall: {} dozing, dropping {<+<.sign-arvo>}" ~) + mo-core =/ app - =/ =term i.path - =/ =ship (slav %p i.t.path) + =/ =ship (slav %p i.t.t.path) =/ =routes [disclosing=~ attributing=ship] - (ap-abed:ap term routes) + (ap-abed:ap dap routes) :: - =. app (ap-generic-take:app t.t.path sign-arvo) + =. app (ap-generic-take:app t.t.t.path sign-arvo) ap-abet:app + ?> ?=([%out @ @ *] t.t.path) + =/ =ship (slav %p i.t.t.t.path) + =/ =routes [disclosing=~ attributing=ship] =/ =sign:agent +>.sign-arvo - =/ app - ?> ?=([%out @ @ *] t.t.path) - =/ =term i.path - =/ =ship (slav %p i.t.t.t.path) - =/ =routes [disclosing=~ attributing=ship] - (ap-abed:ap term routes) + ?: ?=(%| -.agent.u.yoke) + =/ blocked=(qeu blocked-move) + =/ waiting (~(get by blocked.state) dap) + =/ deals (fall waiting *(qeu blocked-move)) + =/ deal [hen routes |+sign] + (~(put to deals) deal) + :: + %- (slog leaf+"gall: {} dozing, got {<-.sign>}" ~) + %_ mo-core + blocked.state (~(put by blocked.state) dap blocked) + == + =/ app (ap-abed:ap dap routes) =. app (ap-specific-take:app t.t.path sign) ap-abet:app @@ -822,10 +755,14 @@ ?: =(~ blocked) =. blocked.state (~(del by blocked.state) dap) mo-core - =^ [=duct =routes =deal] blocked ~(get to blocked) - =/ move + =^ [=duct =routes blocker=(each deal sign:agent)] blocked + ~(get to blocked) + =/ =move =/ =sock [attributing.routes our] - =/ card [%slip %g %deal sock dap deal] + =/ card + ?: ?=(%& -.blocker) + [%slip %g %deal sock dap p.blocker] + [%pass /clear-huck %b %huck %g %unto p.blocker] [duct card] $(moves [move moves]) :: +mo-filter-queue: remove all blocked tasks from ship. @@ -851,6 +788,22 @@ =? new-blocked !=(ship attributing.routes.mov) (~(put to new-blocked) mov) $ + :: +mo-fade: put app to sleep + :: + ++ mo-fade + |= [dap=term style=?(%slay %idle %jolt)] + ^+ mo-core + =/ =routes [disclosing=~ attributing=our] + =/ app (ap-abed:ap dap routes) + =. mo-core ap-abet:(ap-fade:app style) + =. mo-core + ?- style + %slay mo-core(yokes.state (~(del by yokes.state) dap)) + %idle mo-core + %jolt (mo-boot dap our %home) + == + =? mo-core !?=(%jolt style) (mo-subscribe-to-agent-builds now) + mo-core :: +mo-beak: assemble a beak for the specified agent. :: ++ mo-beak @@ -903,7 +856,7 @@ =/ =case:clay da+now =/ =mars:clay [p.cage mark]:deal =/ mars-path /[a.mars]/[b.mars] - =/ sky (ski [%141 %noun] ~ %cc [our %home case] (flop mars-path)) + =/ sky (ski [%141 %noun] ~ %cc [our %home case] mars-path) ?- sky ?(~ [~ ~]) =/ ror "gall: poke cast fail :{(trip dap)} {}" @@ -930,22 +883,23 @@ ap-abet:app :: +mo-handle-local: handle locally. :: - :: If the agent is running or blocked, assign it the supplied +deal. - :: Otherwise simply apply the action to the agent. + :: If the agent is not running or blocked, assign it the supplied + :: +deal. Otherwise simply apply the action to the agent. :: ++ mo-handle-local |= [=ship agent=term =deal] ^+ mo-core :: =/ =routes [disclosing=~ attributing=ship] - =/ is-running (~(has by yokes.state) agent) + =/ running (~(get by yokes.state) agent) + =/ is-running ?~(running %| ?=(%& -.agent.u.running)) =/ is-blocked (~(has by blocked.state) agent) :: ?: |(!is-running is-blocked) =/ blocked=(qeu blocked-move) =/ waiting (~(get by blocked.state) agent) =/ deals (fall waiting *(qeu blocked-move)) - =/ deal [hen routes deal] + =/ deal [hen routes &+deal] (~(put to deals) deal) :: %- (slog leaf+"gall: not running {} yet, got {<-.deal>}" ~) @@ -1036,10 +990,13 @@ ++ ap-abut |= [dap=term =egg] ^+ ap-core - =/ res (mo-scry-agent-cage dap da+now) - ?: ?=(%| -.res) - (mean p.res) - =/ =yoke egg(old-state `agent`p.res) + =/ =yoke + ?: ?=(%| -.old-state.egg) + egg + =/ res (mo-scry-agent-cage dap da+now) + ?: ?=(%| -.res) + (mean p.res) + egg(p.old-state `agent`p.res) =/ =routes [disclosing=~ attributing=our] (ap-yoke dap routes yoke) :: +ap-yoke: initialize agent state, starting from a $yoke @@ -1071,6 +1028,38 @@ yokes.state running moves moves == + :: +ap-fade: put affairs in order. + :: + :: For %gone, remove all incoming and outgoing subscriptions. + :: + ++ ap-fade + |= style=?(%slay %idle %jolt) + ^+ ap-core + ?- style + %jolt ap-core + %idle + =. agent.current-agent |+on-save:ap-agent-core + ap-core + :: + %slay + =/ out=(list [[=wire =ship =term] ? =path]) + ~(tap by outbound.watches.current-agent) + =/ inbound-paths=(set path) + %- silt + %+ turn ~(tap by inbound.watches.current-agent) + |= [=duct =ship =path] + path + =/ will=(list card:agent:gall) + %+ welp + ?: =(~ inbound-paths) + ~ + [%give %kick ~(tap in inbound-paths) ~]~ + %+ turn ~(tap by outbound.watches.current-agent) + |= [[=wire =ship =term] ? =path] + [%pass wire %agent [ship term] %leave ~] + =^ maybe-tang ap-core (ap-ingest ~ |.([will *agent])) + ap-core + == :: +ap-from-internal: internal move to move. :: :: We convert from cards to duct-indexed moves when resolving @@ -1114,7 +1103,7 @@ =/ =case:clay da+now =/ bek=beak [our %home case] =/ mars-path /[a.mars]/[b.mars] - =/ sky (ski [%141 %noun] ~ %cc bek (flop mars-path)) + =/ sky (ski [%141 %noun] ~ %cc bek mars-path) ?- sky ?(~ [~ ~]) %- (slog leaf+"watch-as fact conversion find-fail" >sky< ~) @@ -1137,13 +1126,9 @@ =/ =neat q.card =. wire ?: ?=(%agent -.neat) - :: remove `our` in next breach after 2019/12 and reflect in - :: +mo-handle-use (non-unto case) - :: - :- (scot %p our) [%out (scot %p ship.neat) name.neat wire] [(scot %p attributing.agent-routes) wire] - =. wire [%use agent-name wire] + =. wire [%use agent-name nonce.current-agent wire] =/ =note-arvo ?- -.neat %arvo note-arvo.neat @@ -1200,7 +1185,8 @@ :: +ap-agent-core: agent core with current bowl and state :: ++ ap-agent-core - ~(. agent.current-agent ap-construct-bowl) + ?> ?=(%& -.agent.current-agent) + ~(. p.agent.current-agent ap-construct-bowl) :: +ap-ducts-from-paths: get ducts subscribed to paths :: ++ ap-ducts-from-paths @@ -1278,7 +1264,7 @@ =/ tub=(unit tube:clay) ?: =(have want) `(bake same ^vase) =/ tuc=(unit (unit cage)) - (ski [%141 %noun] ~ %cc [our %home da+now] (flop /[have]/[want])) + (ski [%141 %noun] ~ %cc [our %home da+now] /[have]/[want]) ?. ?=([~ ~ *] tuc) ~ `!<(tube:clay q.u.u.tuc) ?~ tub @@ -1334,9 +1320,12 @@ ~/ %ap-reinstall |= =agent ^+ ap-core - =/ old-state=vase ~(on-save agent.current-agent ap-construct-bowl) + =/ old-state=vase + ?: ?=(%& -.agent.current-agent) + on-save:ap-agent-core + p.agent.current-agent =^ error ap-core - (ap-install(agent.current-agent agent) `old-state) + (ap-install(agent.current-agent &+agent) `old-state) ?~ error ap-core (mean >%load-failed< u.error) @@ -1553,7 +1542,7 @@ =/ res (mock [run %9 2 %0 1] (sloy ski)) ?- -.res %0 [%& !<(step:agent [-:!>(*step:agent) p.res])] - %1 [%| (turn p.res |=(a=* (smyt (path a))))] + %1 [%| (smyt ;;(path p.res)) ~] %2 [%| p.res] == :: +ap-mule-peek: same as +ap-mule but for (unit (unit cage)) @@ -1564,7 +1553,7 @@ =/ res (mock [run %9 2 %0 1] (sloy ski)) ?- -.res %0 [%& !<((unit (unit cage)) [-:!>(*(unit (unit cage))) p.res])] - %1 [%| (turn p.res |=(a=* (smyt (path a))))] + %1 [%| (smyt ;;(path p.res)) ~] %2 [%| p.res] == :: +ap-ingest: call agent arm @@ -1603,7 +1592,7 @@ ?: ?=(%| -.result) `ap-core :: - =. agent.current-agent +.p.result + =. agent.current-agent &++.p.result =/ moves (zing (turn -.p.result ap-from-internal)) =. inbound.watches.current-agent (ap-handle-kicks moves) @@ -1702,11 +1691,13 @@ ?> ?=([%ge @ ~] path) =/ agent-name i.t.path :: - =/ =ames-request ;;(ames-request noun) - => (mo-handle-ames-request:mo-core ship agent-name ames-request) + =+ ;;(=ames-request-all noun) + ?> ?=(%0 -.ames-request-all) + => (mo-handle-ames-request:mo-core ship agent-name +.ames-request-all) mo-abet :: %sear mo-abet:(mo-filter-queue:mo-core ship.task) + %fade mo-abet:(mo-fade:mo-core dap.task style.task) %trim [~ gall-payload] %vega [~ gall-payload] == @@ -1717,8 +1708,14 @@ :: ++ scry ~/ %gall-scry - |= [fur=(unit (set monk)) care=term =shop dap=desk =coin =path] + |= [lyc=gang cyr=term bem=beam] ^- (unit (unit cage)) + =* care cyr + =/ =shop &/p.bem + =* dap q.bem + =/ =coin $/r.bem + =* path s.bem + :: ?. ?=(%.y -.shop) ~ =/ =ship p.shop @@ -1761,7 +1758,14 @@ ^- spore =; eggs=(map term egg) [- | +]:state(yokes eggs) %- ~(run by yokes.state) - |=(=yoke `egg`yoke(agent on-save:agent.yoke)) + |= =yoke + ^- egg + %= yoke + agent + ?: ?=(%& -.agent.yoke) + [%& on-save:p.agent.yoke] + [%| p.agent.yoke] + == :: +take: response :: ++ take diff --git a/pkg/arvo/sys/vane/iris.hoon b/pkg/arvo/sys/vane/iris.hoon index 0cc5de7bd..384b20eec 100644 --- a/pkg/arvo/sys/vane/iris.hoon +++ b/pkg/arvo/sys/vane/iris.hoon @@ -297,7 +297,8 @@ =| ax=axle :: a vane is activated with current date, entropy, and a namespace function :: -|= [our=ship now=@da eny=@uvJ scry-gate=sley] +|= [our=ship now=@da eny=@uvJ rof=roof] +=* scry-gate (en-sley rof) :: allow jets to be registered within this core :: ~% %http-client ..is ~ @@ -390,8 +391,14 @@ :: +scry: request a path in the urbit namespace :: ++ scry - |= {fur/(unit (set monk)) ren/@tas why/shop syd/desk lot/coin tyl/path} + |= [lyc=gang cyr=term bem=beam] ^- (unit (unit cage)) + =* ren cyr + =* why=shop &/p.bem + =* syd q.bem + =* lot=coin $/r.bem + =* tyl s.bem + :: ?. ?=(%& -.why) ~ =* his p.why ?: &(=(ren %$) =(tyl /whey)) diff --git a/pkg/arvo/sys/vane/jael.hoon b/pkg/arvo/sys/vane/jael.hoon index 26ec3a233..fa003880a 100644 --- a/pkg/arvo/sys/vane/jael.hoon +++ b/pkg/arvo/sys/vane/jael.hoon @@ -15,7 +15,7 @@ :: - scry namespace :: - task for converting invites to tickets :: -|= pit/vase +|= pit=vase =, pki:jael =, able:jael =, crypto @@ -35,37 +35,11 @@ :: manage subscriptions efficiently. :: => |% -+$ any-state $%(state-0 state-1) -:: -+$ state-0 - $: %0 - pki=state-pki-0 :: - etn=state-eth-node :: eth connection state - == :: +$ state-1 $: %1 pki=state-pki-1 :: etn=state-eth-node :: eth connection state == :: -+$ state-pki-0 :: urbit metadata - $: $= own :: vault (vein) - $: yen=(set duct) :: trackers - sig=(unit oath) :: for a moon - tuf=(list turf) :: domains - boq=@ud :: boot block - nod=purl:eyre :: eth gateway - fak=_| :: fake keys - lyf=life :: version - jaw=(map life ring) :: private keys - == :: - $= zim :: public - $: yen=(jug duct ship) :: trackers - ney=(jug ship duct) :: reverse trackers - nel=(set duct) :: trackers of all - dns=dnses :: on-chain dns state - pos=(map ship point) :: on-chain ship state - == :: - == :: +$ state-pki-1 :: urbit metadata $: $= own :: vault (vein) $: yen=(set duct) :: trackers @@ -86,6 +60,9 @@ pos=(map ship point) :: on-chain ship state == :: == :: ++$ message-all + $% [%0 message] + == +$ message :: message to her jael $% [%nuke whos=(set ship)] :: cancel trackers [%public-keys whos=(set ship)] :: view ethereum events @@ -198,7 +175,7 @@ :: arvo issues: should be merged with the top-level :: vane interface when that gets cleaned up a bit. :: - =| moz/(list move) + =| moz=(list move) =| $: $: :: our: identity :: now: current time :: eny: unique entropy @@ -252,7 +229,7 @@ (^sein:title who) :: :: ++saxo:of ++ saxo :: sponsorship chain - |= who/ship + |= who=ship ^- (list ship) =/ dad (sein who) [who ?:(=(who dad) ~ $(who dad))] @@ -261,18 +238,18 @@ |= $: :: hen: event cause :: tac: event data :: - hen/duct - tac/task + hen=duct + tac=task == ^+ +> ?- -.tac :: :: boot from keys - :: $: $dawn + :: $: %dawn :: =seed :: spon=ship :: czar=(map ship [=rift =life =pass]) - :: turf=(list turf)} + :: turf=(list turf) :: bloq=@ud :: node=purl :: == @@ -433,9 +410,9 @@ (sources:~(feel su hen our now pki etn) [whos source]:tac) :: :: cancel all trackers from duct - :: {$nuke whos=(set ship)} + :: [%nuke whos=(set ship)] :: - $nuke + %nuke =/ ships=(list ship) %~ tap in %- ~(int in whos.tac) @@ -522,32 +499,34 @@ +>.$ :: :: watch private keys - :: {$private-keys $~} + :: [%private-keys ~] :: %private-keys (curd abet:~(private-keys ~(feed su hen our now pki etn) hen)) :: :: authenticated remote request - :: {$west p/ship q/path r/*} + :: [%west p=ship q=path r=*] :: %plea =* her ship.tac - =/ mes ;;(message payload.plea.tac) - ?- -.mes + =+ ;;(=message-all payload.plea.tac) + ?> ?=(%0 -.message-all) + =/ =message +.message-all + ?- -.message :: :: cancel trackers :: [%nuke whos=(set ship)] :: %nuke =. moz [[hen %give %done ~] moz] - $(tac mes) + $(tac message) :: :: view ethereum events :: [%public-keys whos=(set ship)] :: %public-keys =. moz [[hen %give %done ~] moz] - $(tac mes) + $(tac message) == == :: @@ -592,20 +571,20 @@ :: [%g %unto *] ?- +>-.hin - $kick ~|([%jael-unexpected-quit tea hin] !!) - $poke-ack + %kick ~|([%jael-unexpected-quit tea hin] !!) + %poke-ack ?~ p.p.+>.hin +>.$ %- (slog leaf+"jael-bad-coup" u.p.p.+>.hin) +>.$ :: - $watch-ack + %watch-ack ?~ p.p.+>.hin +>.$ %- (slog u.p.p.+>.hin) ~|([%jael-unexpected-reap tea hin] +>.$) :: - $fact + %fact ?> ?=([@ *] tea) =* app i.tea =/ =peer-sign ;;(peer-sign q.q.cage.p.+>.hin) @@ -615,9 +594,9 @@ == :: :: ++curd:of ++ curd :: relative moves - |= $: moz/(list move) - pki/state-pki-1 - etn/state-eth-node + |= $: moz=(list move) + pki=state-pki-1 + etn=state-eth-node == +>(pki pki, etn etn, moz (weld (flop moz) ^moz)) -- @@ -656,7 +635,7 @@ +>.$(moz [move moz]) :: ++ exec :: mass gift - |= {yen/(set duct) cad/card} + |= [yen=(set duct) cad=card] =/ noy ~(tap in yen) |- ^+ this-su ?~ noy this-su @@ -758,7 +737,7 @@ ++ feed |_ :: hen: subscription source :: - hen/duct + hen=duct :: :: Handle subscription to public-keys :: @@ -972,10 +951,9 @@ ..feed :: ?: ?=(%& -.source) - =/ send-message - |= =message - [hen %pass /public-keys %a %plea p.source %j /public-keys message] - (emit (send-message %public-keys whos)) + %- emit + =/ =message-all [%0 %public-keys whos] + [hen %pass /public-keys %a %plea p.source %j /public-keys message-all] (peer p.source whos) -- :: @@ -993,7 +971,7 @@ :: :: lex: all durable %jael state :: -=| lex/state-1 +=| lex=state-1 |= $: :: :: our: identity :: now: current time @@ -1003,7 +981,7 @@ our=ship now=@da eny=@uvJ - ski=sley + rof=roof == ^? |% @@ -1012,9 +990,9 @@ |= $: :: hen: cause of this event :: hic: event data :: - hen/duct + hen=duct dud=(unit goof) - hic/(hypo (hobo task:able)) + hic=(hypo (hobo task:able)) == ^- [(list move) _..^$] ?^ dud @@ -1026,35 +1004,19 @@ [did ..^$] :: :: ++load ++ load :: upgrade - |= $: :: old: previous state - :: - :: old/* - old/any-state - == + |= old=state-1 ^+ ..^$ - =/ new=state-1 - ?- -.old - %0 old(- %1, |7.own.pki [step=0 |7.own.pki.old]) - %1 old - == - ..^$(lex new) + ..^$(lex old) :: :: ++scry ++ scry :: inspect - |= $: :: fur: event security - :: ren: access mode - :: why: owner - :: syd: desk (branch) - :: lot: case (version) - :: tyl: rest of path - :: - fur/(unit (set monk)) - ren/@tas - why/shop - syd/desk - lot/coin - tyl/spur - == + |= [lyc=gang cyr=term bem=beam] ^- (unit (unit cage)) + =* ren cyr + =* why=shop &/p.bem + =* syd q.bem + =* lot=coin $/r.bem + =* tyl s.bem + :: :: XX review for security, stability, cases other than now :: ?. =(lot [%$ %da now]) ~ @@ -1264,10 +1226,10 @@ :: hen: cause :: hin: result :: - tea/wire - hen/duct + tea=wire + hen=duct dud=(unit goof) - hin/(hypo sign) + hin=(hypo sign) == ^- [(list move) _..^$] ?^ dud diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 9662e1c93..26f665daf 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -39,11 +39,10 @@ :: :: miscellaneous systems types ::+| -++ ares (unit {p/term q/(list tank)}) :: possible error :: +capped-queue: a +qeu with a maximum number of entries :: ++ capped-queue - |* item-type=mold + |$ [item-type] $: queue=(qeu item-type) size=@ud max-size=_64 @@ -54,44 +53,38 @@ :: :key-type to :val-type. Detailed docs for this type can be found there. :: ++ clock - |* $: :: key-type: mold of keys - :: - key-type=mold - :: val-type: mold of values - :: - val-type=mold - == - $: lookup=(map key-type [val=val-type fresh=@ud]) - queue=(qeu key-type) - size=@ud - max-size=_2.048 - depth=_1 - == + |$ :: key-type: mold of keys + :: val-type: mold of values + :: + [key-type val-type] + $: lookup=(map key-type [val=val-type fresh=@ud]) + queue=(qeu key-type) + size=@ud + max-size=_2.048 + depth=_1 + == :: -++ coop (unit ares) :: possible error -:: +disc: a desk on a ship; can be used as a beak that varies with time -:: -+$ disc [=ship =desk] -++ life @ud :: ship key revision -++ rift @ud :: ship continuity -++ mime {p/mite q/octs} :: mimetyped data -++ octs {p/@ud q/@} :: octet-stream -++ sock {p/ship q/ship} :: outgoing [our his] -::+| -:: -++ roof (room vase) :: namespace -++ room :: either namespace - |* vase/mold :: vase or maze - $- $: ref/* :: reference type - lyc/(unit (set ship)) :: leakset - car/term :: perspective - bem/beam :: path - == :: - %- unit :: ~: unknown - %- unit :: ~ ~: invalid - (cask vase) :: marked cargo -:: -++ turf (list @t) :: domain, tld first ++$ deco ?(~ %bl %br %un) :: text decoration ++$ json :: normal json value + $@ ~ :: null + $% [%a p=(list json)] :: array + [%b p=?] :: boolean + [%o p=(map @t json)] :: object + [%n p=@ta] :: number + [%s p=@t] :: string + == :: ++$ life @ud :: ship key revision ++$ rift @ud :: ship continuity ++$ mime (pair mite octs) :: mimetyped data ++$ octs (pair @ud @) :: octet-stream ++$ sock (pair ship ship) :: outgoing [our his] ++$ stub (list (pair stye (list @c))) :: styled unicode ++$ stye (pair (set deco) (pair tint tint)) :: decos/bg/fg ++$ styl %+ pair (unit deco) :: cascading style + (pair (unit tint) (unit tint)) :: ++$ styx (list $@(@t (pair styl styx))) :: styled text ++$ tint ?(%r %g %b %c %m %y %k %w %~) :: text color ++$ turf (list @t) :: domain, tld first :: :: :::: ++jstd :: json standards structures :: :::: @@ -128,7 +121,7 @@ ++ address @ux :: event location :: - += event-id [block=@ud log=@ud] + +$ event-id [block=@ud log=@ud] :: ++ events (set event-id) -- @@ -168,7 +161,7 @@ == == :: - += dnses [pri=@t sec=@t ter=@t] + +$ dnses [pri=@t sec=@t ter=@t] :: ++ diff-azimuth $% [%point who=@p dif=diff-point] @@ -478,14 +471,14 @@ ++ acru $_ ^? :: asym cryptosuite |% :: opaque object ++ as ^? :: asym ops - |% ++ seal |~({a/pass b/@} *@) :: encrypt to a - ++ sign |~(a/@ *@) :: certify as us - ++ sure |~(a/@ *(unit @)) :: authenticate from us - ++ tear |~({a/pass b/@} *(unit @)) :: accept from a + |% ++ seal |~([a=pass b=@] *@) :: encrypt to a + ++ sign |~(a=@ *@) :: certify as us + ++ sure |~(a=@ *(unit @)) :: authenticate from us + ++ tear |~([a=pass b=@] *(unit @)) :: accept from a -- ::as :: - ++ de |~({a/@ b/@} *(unit @)) :: symmetric de, soft - ++ dy |~({a/@ b/@} *@) :: symmetric de, hard - ++ en |~({a/@ b/@} *@) :: symmetric en + ++ de |~([a=@ b=@] *(unit @)) :: symmetric de, soft + ++ dy |~([a=@ b=@] *@) :: symmetric de, hard + ++ en |~([a=@ b=@] *@) :: symmetric en ++ ex ^? :: export |% ++ fig *@uvH :: fingerprint ++ pac *@uvG :: default passcode @@ -493,9 +486,9 @@ ++ sec *ring :: private key -- ::ex :: ++ nu ^? :: reconstructors - |% ++ pit |~({a/@ b/@} ^?(..nu)) :: from [width seed] - ++ nol |~(a/ring ^?(..nu)) :: from ring - ++ com |~(a/pass ^?(..nu)) :: from pass + |% ++ pit |~([a=@ b=@] ^?(..nu)) :: from [width seed] + ++ nol |~(a=ring ^?(..nu)) :: from ring + ++ com |~(a=pass ^?(..nu)) :: from pass -- ::nu :: -- ::acru :: :: $address: opaque atomic transport address to or from unix @@ -787,13 +780,13 @@ :: :::: ++ able ^? |% - ++ gift :: out result <-$ + +$ gift :: out result <-$ $% [%doze p=(unit @da)] :: next alarm [%wake error=(unit tang)] :: wakeup or failed [%meta p=vase] [%heck syn=sign-arvo] :: response to %huck == - ++ task :: in request ->$ + +$ task :: in request ->$ $~ [%vega ~] :: $% $>(%born vane-task) :: new unix process $>(%crud vane-task) :: error with trace @@ -817,64 +810,64 @@ :: :::: ++ able ^? |% - ++ gift :: out result <-$ + +$ gift :: out result <-$ $% [%boon payload=*] :: ames response - {$croz rus/(map desk {r/regs w/regs})} :: rules for group - {$cruz cez/(map @ta crew)} :: permission groups - {$dirk p/@tas} :: mark mount dirty - {$ergo p/@tas q/mode} :: version update - {$hill p/(list @tas)} :: mount points + [%croz rus=(map desk [r=regs w=regs])] :: rules for group + [%cruz cez=(map @ta crew)] :: permission groups + [%dirk p=@tas] :: mark mount dirty + [%ergo p=@tas q=mode] :: version update + [%hill p=(list @tas)] :: mount points [%done error=(unit error:ames)] :: ames message (n)ack - {$mere p/(each (set path) (pair term tang))} :: merge result - {$note p/@tD q/tank} :: debug message - {$ogre p/@tas} :: delete mount point - {$rule red/dict wit/dict} :: node r+w permissions - {$writ p/riot} :: response - {$wris p/{$da p/@da} q/(set (pair care path))} :: many changes + [%mere p=(each (set path) (pair term tang))] :: merge result + [%note p=@tD q=tank] :: debug message + [%ogre p=@tas] :: delete mount point + [%rule red=dict wit=dict] :: node r+w permissions + [%writ p=riot] :: response + [%wris p=[%da p=@da] q=(set (pair care path))] :: many changes == :: - ++ task :: in request ->$ + +$ task :: in request ->$ $~ [%vega ~] :: - $% {$boat ~} :: pier rebooted - {$cred nom/@ta cew/crew} :: set permission group - {$crew ~} :: permission groups - {$crow nom/@ta} :: group usage + $% [%boat ~] :: pier rebooted + [%cred nom=@ta cew=crew] :: set permission group + [%crew ~] :: permission groups + [%crow nom=@ta] :: group usage $>(%crud vane-task) :: error with trace - {$drop des/desk} :: cancel pending merge - {$info des/desk dit/nori} :: internal edit + [%drop des=desk] :: cancel pending merge + [%info des=desk dit=nori] :: internal edit $>(%init vane-task) :: report install - {$into des/desk all/? fis/mode} :: external edit - $: $merg :: merge desks - des/desk :: target - her/@p dem/desk cas/case :: source - how/germ :: method + [%into des=desk all=? fis=mode] :: external edit + $: %merg :: merge desks + des=desk :: target + her=@p dem=desk cas=case :: source + how=germ :: method == :: - {$mont pot/term bem/beam} :: mount to unix - {$dirk des/desk} :: mark mount dirty - {$ogre pot/$@(desk beam)} :: delete mount point - {$park des/desk yok/yoki ran/rang} :: synchronous commit - {$perm des/desk pax/path rit/rite} :: change permissions - {$pork ~} :: resume commit + [%mont pot=term bem=beam] :: mount to unix + [%dirk des=desk] :: mark mount dirty + [%ogre pot=$@(desk beam)] :: delete mount point + [%park des=desk yok=yoki ran=rang] :: synchronous commit + [%perm des=desk pax=path rit=rite] :: change permissions + [%pork ~] :: resume commit $>(%trim vane-task) :: trim state $>(%vega vane-task) :: report upgrade - {$warp wer/ship rif/riff} :: internal file req - {$werp who/ship wer/ship rif/riff-any} :: external file req + [%warp wer=ship rif=riff] :: internal file req + [%werp who=ship wer=ship rif=riff-any] :: external file req $>(%plea vane-task) :: ames request == :: -- ::able :: :::: :: (1c2) :: - ++ aeon @ud :: version number - ++ ankh :: fs node (new) + +$ aeon @ud :: version number + +$ ankh :: fs node (new) $~ [~ ~] - $: fil/(unit {p/lobe q/cage}) :: file - dir/(map @ta ankh) :: folders + $: fil=(unit [p=lobe q=cage]) :: file + dir=(map @ta ankh) :: folders == :: - ++ beam {{p/ship q/desk r/case} s/path} :: global name - ++ beak {p/ship q/desk r/case} :: path prefix - ++ blob :: fs blob - $% {$delta p/lobe q/{p/mark q/lobe} r/page} :: delta on q - {$direct p/lobe q/page} :: immediate + +$ beam [[p=ship q=desk r=case] s=path] :: global name + +$ beak [p=ship q=desk r=case] :: path prefix + +$ blob :: fs blob + $% [%delta p=lobe q=[p=mark q=lobe] r=page] :: delta on q + [%direct p=lobe q=page] :: immediate == :: :: +cable: a reference to something on the filesystem :: face: the face to wrap around the imported file @@ -883,23 +876,22 @@ $: face=(unit term) file-path=term == - ++ care ?($a $b $c $d $p $r $s $t $u $v $w $x $y $z) :: clay submode - ++ case :: ship desk case spur - $% {$da p/@da} :: date - {$tas p/@tas} :: label - {$ud p/@ud} :: number + +$ care ?(%a %b %c %d %p %r %s %t %u %v %w %x %y %z) :: clay submode + +$ case :: ship desk case spur + $% [%da p=@da] :: date + [%tas p=@tas] :: label + [%ud p=@ud] :: number == :: - ++ cass {ud/@ud da/@da} :: cases for revision - ++ coop (unit ares) :: e2e ack - ++ crew (set ship) :: permissions group - ++ dict {src/path rul/real} :: effective permission - ++ dome :: project state - $: ank/ankh :: state - let/@ud :: top id - hit/(map @ud tako) :: changes by id - lab/(map @tas @ud) :: labels + +$ cass [ud=@ud da=@da] :: cases for revision + +$ crew (set ship) :: permissions group + +$ dict [src=path rul=real] :: effective permission + +$ dome :: project state + $: ank=ankh :: state + let=@ud :: top id + hit=(map @ud tako) :: changes by id + lab=(map @tas @ud) :: labels == :: - ++ germ :: merge style + +$ germ :: merge style $? %init :: new desk %fine :: fast forward %meet :: orthogonal files @@ -912,90 +904,90 @@ %meet-this :: ours if conflict %meet-that :: hers if conflict == :: - ++ lobe @uvI :: blob ref - ++ maki {p/@ta q/@ta r/@ta s/path} :: - ++ miso :: ankh delta - $% {$del ~} :: delete - {$ins p/cage} :: insert - {$dif p/cage} :: mutate from diff - {$mut p/cage} :: mutate from raw + +$ lobe @uvI :: blob ref + +$ maki [p=@ta q=@ta r=@ta s=path] :: + +$ miso :: ankh delta + $% [%del ~] :: delete + [%ins p=cage] :: insert + [%dif p=cage] :: mutate from diff + [%mut p=cage] :: mutate from raw == :: - ++ misu :: computed delta - $% {$del ~} :: delete - {$ins p/cage} :: insert - {$dif p/lobe q/cage} :: mutate from diff + +$ misu :: computed delta + $% [%del ~] :: delete + [%ins p=cage] :: insert + [%dif p=lobe q=cage] :: mutate from diff == :: - ++ mizu {p/@u q/(map @ud tako) r/rang} :: new state - ++ moar {p/@ud q/@ud} :: normal change range + +$ mizu [p=@u q=(map @ud tako) r=rang] :: new state + +$ moar [p=@ud q=@ud] :: normal change range +$ moat [from=case to=case =path] :: change range - ++ mode (list {path (unit mime)}) :: external files + +$ mode (list [path (unit mime)]) :: external files +$ mood [=care =case =path] :: request in desk +$ mool [=case paths=(set (pair care path))] :: requests in desk - ++ nori :: repository action - $% {%& p/soba} :: delta - {%| p/@tas} :: label + +$ nori :: repository action + $% [%& p=soba] :: delta + [%| p=@tas] :: label == :: - ++ nuri :: repository action - $% {%& p/suba} :: delta - {%| p/@tas} :: label + +$ nuri :: repository action + $% [%& p=suba] :: delta + [%| p=@tas] :: label == :: - ++ open $-(path vase) :: get prelude - ++ page (cask *) :: untyped cage - ++ plop blob :: unvalidated blob - ++ rang :: repository - $: hut/(map tako yaki) :: changes - lat/(map lobe blob) :: data + +$ open $-(path vase) :: get prelude + +$ page (cask *) :: untyped cage + +$ plop blob :: unvalidated blob + +$ rang :: repository + $: hut=(map tako yaki) :: changes + lat=(map lobe blob) :: data == :: - ++ rant :: response to request - $: p/{p/care q/case r/desk} :: clade release book - q/path :: spur - r/cage :: data + +$ rant :: response to request + $: p=[p=care q=case r=desk] :: clade release book + q=path :: spur + r=cage :: data == :: - ++ rave :: general request + +$ rave :: general request $% [%sing =mood] :: single request [%next =mood] :: await next version [%mult =mool] :: next version of any [%many track=? =moat] :: track range == :: - ++ real :: resolved permissions - $: mod/?($black $white) :: - who/(pair (set ship) (map @ta crew)) :: + +$ real :: resolved permissions + $: mod=?(%black %white) :: + who=(pair (set ship) (map @ta crew)) :: == :: - ++ regs (map path rule) :: rules for paths + +$ regs (map path rule) :: rules for paths +$ riff [p=desk q=(unit rave)] :: request+desist +$ riff-any - $^ [[%1 ~] riff] - riff - ++ rite :: new permissions - $% {$r red/(unit rule)} :: for read - {$w wit/(unit rule)} :: for write - {$rw red/(unit rule) wit/(unit rule)} :: for read and write + $% [%1 =riff] + == + +$ rite :: new permissions + $% [%r red=(unit rule)] :: for read + [%w wit=(unit rule)] :: for write + [%rw red=(unit rule) wit=(unit rule)] :: for read and write == :: - ++ riot (unit rant) :: response+complete - ++ rule {mod/?($black $white) who/(set whom)} :: node permission - ++ rump {p/care q/case r/@tas s/path} :: relative path - ++ saba {p/ship q/@tas r/moar s/dome} :: patch+merge - ++ soba (list {p/path q/miso}) :: delta - ++ suba (list {p/path q/misu}) :: delta - ++ tako @ :: yaki ref - ++ toro {p/@ta q/nori} :: general change + +$ riot (unit rant) :: response+complete + +$ rule [mod=?(%black %white) who=(set whom)] :: node permission + +$ rump [p=care q=case r=@tas s=path] :: relative path + +$ saba [p=ship q=@tas r=moar s=dome] :: patch+merge + +$ soba (list [p=path q=miso]) :: delta + +$ suba (list [p=path q=misu]) :: delta + +$ tako @ :: yaki ref + +$ toro [p=@ta q=nori] :: general change ++ unce :: change part - |* a/mold :: - $% {%& p/@ud} :: skip[copy] - {%| p/(list a) q/(list a)} :: p -> q[chunk] + |* a=mold :: + $% [%& p=@ud] :: skip[copy] + [%| p=(list a) q=(list a)] :: p -> q[chunk] == :: - ++ urge |*(a/mold (list (unce a))) :: list change - ++ whom (each ship @ta) :: ship or named crew - ++ yoki (each yuki yaki) :: commit - ++ yuki :: proto-commit - $: p/(list tako) :: parents - q/(map path (each page lobe)) :: namespace + ++ urge |*(a=mold (list (unce a))) :: list change + +$ whom (each ship @ta) :: ship or named crew + +$ yoki (each yuki yaki) :: commit + +$ yuki :: proto-commit + $: p=(list tako) :: parents + q=(map path (each page lobe)) :: namespace == :: - ++ yaki :: commit - $: p/(list tako) :: parents - q/(map path lobe) :: namespace - r/tako :: self-reference - t/@da :: date + +$ yaki :: commit + $: p=(list tako) :: parents + q=(map path lobe) :: namespace + r=tako :: self-reference + t=@da :: date == :: :: :: +page-to-lobe: hash a page to get a lobe. @@ -1005,7 +997,7 @@ :: +make-yaki: make commit out of a list of parents, content, and date. :: ++ make-yaki - |= {p/(list tako) q/(map path lobe) t/@da} + |= [p=(list tako) q=(map path lobe) t=@da] ^- yaki =+ ^= has %^ cat 7 (sham [%yaki (roll p add) q t]) @@ -1099,111 +1091,110 @@ :: :::: ++ able ^? |% - ++ gift :: out result <-$ - $% {$bbye ~} :: reset prompt - {$blit p/(list blit)} :: terminal output - {$burl p/@t} :: activate url - {$init p/@p} :: set owner - {$logo ~} :: logout + +$ gift :: out result <-$ + $% [%bbye ~] :: reset prompt + [%blit p=(list blit)] :: terminal output + [%burl p=@t] :: activate url + [%init p=@p] :: set owner + [%logo ~] :: logout [%lyra hoon=(unit @t) arvo=@t] :: upgrade kernel - {$meld ~} :: unify memory - {$pack ~} :: compact memory - {$trim p/@ud} :: trim kernel state - {$veer p/@ta q/path r/@t} :: install vane - {$verb ~} :: verbose mode + [%meld ~] :: unify memory + [%pack ~] :: compact memory + [%trim p=@ud] :: trim kernel state + [%veer p=@ta q=path r=@t] :: install vane + [%verb ~] :: verbose mode [%whey ~] :: memory report == :: - ++ task :: in request ->$ + +$ task :: in request ->$ $~ [%vega ~] :: - $% {$belt p/belt} :: terminal input - {$blew p/blew} :: terminal config - {$boot lit/? p/*} :: weird %dill boot - {$crop p/@ud} :: trim kernel state + $% [%belt p=belt] :: terminal input + [%blew p=blew] :: terminal config + [%boot lit=? p=*] :: weird %dill boot + [%crop p=@ud] :: trim kernel state $>(%crud vane-task) :: error with trace [%flee session=~] :: unwatch session - {$flog p/flog} :: wrapped error - {$flow p/@tas q/(list gill:gall)} :: terminal config - {$hail ~} :: terminal refresh - {$heft ~} :: memory report - {$hook ~} :: this term hung up - {$harm ~} :: all terms hung up + [%flog p=flog] :: wrapped error + [%flow p=@tas q=(list gill:gall)] :: terminal config + [%hail ~] :: terminal refresh + [%heft ~] :: memory report + [%hook ~] :: this term hung up + [%harm ~] :: all terms hung up $>(%init vane-task) :: after gall ready [%lyra hoon=(unit @t) arvo=@t] :: upgrade kernel - {$meld ~} :: unify memory - {$noop ~} :: no operation - {$pack ~} :: compact memory - {$talk p/tank} :: - {$text p/tape} :: - {$veer p/@ta q/path r/@t} :: install vane + [%meld ~] :: unify memory + [%noop ~] :: no operation + [%pack ~] :: compact memory + [%talk p=tank] :: + [%text p=tape] :: + [%veer p=@ta q=path r=@t] :: install vane [%view session=~] :: watch session blits $>(%trim vane-task) :: trim state $>(%vega vane-task) :: report upgrade - {$verb ~} :: verbose mode + [%verb ~] :: verbose mode [%knob tag=term level=?(%hush %soft %loud)] :: error verbosity == :: -- ::able :: :::: :: (1d2) :: - ++ blew {p/@ud q/@ud} :: columns rows - ++ belt :: old belt - $% {$aro p/?($d $l $r $u)} :: arrow key - {$bac ~} :: true backspace - {$ctl p/@c} :: control-key - {$del ~} :: true delete - {$met p/@c} :: meta-key - {$ret ~} :: return - {$txt p/(list @c)} :: utf32 text + +$ blew [p=@ud q=@ud] :: columns rows + +$ belt :: old belt + $% [%aro p=?(%d %l %r %u)] :: arrow key + [%bac ~] :: true backspace + [%ctl p=@c] :: control-key + [%del ~] :: true delete + [%met p=@c] :: meta-key + [%ret ~] :: return + [%txt p=(list @c)] :: utf32 text == :: - ++ blit :: old blit - $% {$bel ~} :: make a noise - {$clr ~} :: clear the screen - {$hop p/@ud} :: set cursor position + +$ blit :: old blit + $% [%bel ~] :: make a noise + [%clr ~] :: clear the screen + [%hop p=@ud] :: set cursor position [%klr p=stub] :: set styled line - {$lin p/(list @c)} :: set current line - {$mor ~} :: newline - {$sag p/path q/*} :: save to jamfile - {$sav p/path q/@} :: save to file - {$url p/@t} :: activate url + [%lin p=(list @c)] :: set current line + [%mor ~] :: newline + [%sag p=path q=*] :: save to jamfile + [%sav p=path q=@] :: save to file + [%url p=@t] :: activate url == :: - ++ deco ?(~ $bl $br $un) :: text decoration - ++ dill-belt :: new belt - $% {$aro p/?($d $l $r $u)} :: arrow key - {$bac ~} :: true backspace - {$cru p/@tas q/(list tank)} :: echo error - {$ctl p/@} :: control-key - {$del ~} :: true delete - {$hey ~} :: refresh - {$met p/@} :: meta-key - {$ret ~} :: return - {$rez p/@ud q/@ud} :: resize, cols, rows - {$txt p/(list @c)} :: utf32 text - {$yow p/gill:gall} :: connect to app + +$ dill-belt :: new belt + $% [%aro p=?(%d %l %r %u)] :: arrow key + [%bac ~] :: true backspace + [%cru p=@tas q=(list tank)] :: echo error + [%ctl p=@] :: control-key + [%del ~] :: true delete + [%hey ~] :: refresh + [%met p=@] :: meta-key + [%ret ~] :: return + [%rez p=@ud q=@ud] :: resize, cols, rows + [%txt p=(list @c)] :: utf32 text + [%yow p=gill:gall] :: connect to app == :: - ++ dill-blit :: new blit - $% {$bel ~} :: make a noise - {$clr ~} :: clear the screen - {$hop p/@ud} :: set cursor position - {$klr p/stub} :: styled text - {$mor p/(list dill-blit)} :: multiple blits - {$pom p/stub} :: styled prompt - {$pro p/(list @c)} :: show as cursor+line - {$qit ~} :: close console - {$out p/(list @c)} :: send output line - {$sag p/path q/*} :: save to jamfile - {$sav p/path q/@} :: save to file - {$url p/@t} :: activate url + +$ dill-blit :: new blit + $% [%bel ~] :: make a noise + [%clr ~] :: clear the screen + [%hop p=@ud] :: set cursor position + [%klr p=stub] :: styled text + [%mor p=(list dill-blit)] :: multiple blits + [%pom p=stub] :: styled prompt + [%pro p=(list @c)] :: show as cursor+line + [%qit ~] :: close console + [%out p=(list @c)] :: send output line + [%sag p=path q=*] :: save to jamfile + [%sav p=path q=@] :: save to file + [%url p=@t] :: activate url == :: - ++ flog :: sent to %dill - $% {$crop p/@ud} :: trim kernel state - {$crud p/@tas q/(list tank)} :: - {$heft ~} :: + +$ flog :: sent to %dill + $% [%crop p=@ud] :: trim kernel state + [%crud p=@tas q=(list tank)] :: + [%heft ~] :: [%lyra hoon=(unit @t) arvo=@t] :: upgrade kernel - {$meld ~} :: unify memory - {$pack ~} :: compact memory - {$text p/tape} :: - {$veer p/@ta q/path r/@t} :: install vane - {$verb ~} :: verbose mode + [%meld ~] :: unify memory + [%pack ~] :: compact memory + [%text p=tape] :: + [%veer p=@ta q=path r=@t] :: install vane + [%verb ~] :: verbose mode == :: -- ::dill :: :::: @@ -1213,7 +1204,7 @@ |% ++ able |% - ++ gift + +$ gift $% :: set-config: configures the external http server :: :: TODO: We need to actually return a (map (unit @t) http-config) @@ -1231,7 +1222,7 @@ [%bound accepted=? =binding] == :: - ++ task + +$ task $~ [%vega ~] $% :: event failure notification :: @@ -1537,54 +1528,54 @@ =request:http == :: - ++ cred :: credential - $: hut/hart :: client host - aut/(jug @tas @t) :: client identities - orx/oryx :: CSRF secret - acl/(unit @t) :: accept-language - cip/(each @if @is) :: client IP - cum/(map @tas *) :: custom dirt + +$ cred :: credential + $: hut=hart :: client host + aut=(jug @tas @t) :: client identities + orx=oryx :: CSRF secret + acl=(unit @t) :: accept-language + cip=(each @if @is) :: client IP + cum=(map @tas *) :: custom dirt == :: - ++ epic :: FCGI parameters - $: qix/(map @t @t) :: query - ced/cred :: client credentials - bem/beam :: original path + +$ epic :: FCGI parameters + $: qix=(map @t @t) :: query + ced=cred :: client credentials + bem=beam :: original path == :: :: - ++ hart {p/? q/(unit @ud) r/host} :: http sec+port+host - ++ hate {p/purl q/@p r/moth} :: semi-cooked request - ++ hiss {p/purl q/moth} :: outbound request - ++ host (each turf @if) :: http host - ++ hoke %+ each {$localhost ~} :: local host - ?($.0.0.0.0 $.127.0.0.1) :: - ++ httq :: raw http request - $: p/meth :: method - q/@t :: unparsed url - r/(list {p/@t q/@t}) :: headers - s/(unit octs) :: body + +$ hart [p=? q=(unit @ud) r=host] :: http sec+port+host + +$ hate [p=purl q=@p r=moth] :: semi-cooked request + +$ hiss [p=purl q=moth] :: outbound request + +$ host (each turf @if) :: http host + +$ hoke %+ each [%localhost ~] :: local host + ?(%.0.0.0.0 %.127.0.0.1) :: + +$ httq :: raw http request + $: p=meth :: 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 - ++ math (map @t (list @t)) :: semiparsed headers - ++ mess (list {p/@t q/@t}) :: raw http headers - ++ meth :: http methods - $? $conn :: CONNECT - $delt :: DELETE - $get :: GET - $head :: HEAD - $opts :: OPTIONS - $post :: POST - $put :: PUT - $trac :: TRACE + +$ httr [p=@ud q=mess r=(unit octs)] :: raw http response + +$ math (map @t (list @t)) :: semiparsed headers + +$ mess (list [p=@t q=@t]) :: raw http headers + +$ meth :: http methods + $? %conn :: CONNECT + %delt :: DELETE + %get :: GET + %head :: HEAD + %opts :: OPTIONS + %post :: POST + %put :: PUT + %trac :: TRACE == :: - ++ moth {p/meth q/math r/(unit octs)} :: http operation - ++ oryx @t :: CSRF secret - ++ pork {p/(unit @ta) q/(list @t)} :: fully parsed url + +$ moth [p=meth q=math r=(unit octs)] :: http operation + +$ oryx @t :: CSRF secret + +$ pork [p=(unit @ta) q=(list @t)] :: fully parsed url :: +prox: proxy notification :: :: Used on both the proxy (ward) and upstream sides for :: sending/receiving proxied-request notifications. :: - += prox + +$ prox $: :: por: tcp port :: por=@ud @@ -1595,13 +1586,13 @@ :: non=@uvJ == - ++ purf (pair purl (unit @t)) :: url with fragment - ++ purl {p/hart q/pork r/quay} :: parsed url - ++ quay (list {p/@t q/@t}) :: parsed url query - ++ quer |-($@(~ {p/@t q/@t t/$})) :: query tree - ++ quri :: request-uri - $% {%& p/purl} :: absolute - {%| p/pork q/quay} :: relative + +$ purf (pair purl (unit @t)) :: url with fragment + +$ purl [p=hart q=pork r=quay] :: parsed url + +$ quay (list [p=@t q=@t]) :: parsed url query + ++ quer |-($@(~ [p=@t q=@t t=$])) :: query tree + +$ quri :: request-uri + $% [%& p=purl] :: absolute + [%| p=pork q=quay] :: relative == :: :: +reserved: check if an ipv4 address is in a reserved range :: @@ -1701,8 +1692,8 @@ ++ het (bass 16 (stun [1 4] six:ab)) -- :: - ++ rout {p/(list host) q/path r/oryx s/path} :: http route (new) - ++ user knot :: username + +$ rout [p=(list host) q=path r=oryx s=path] :: http route (new) + +$ user knot :: username -- ::eyre :: :::: :::: ++gall :: (1g) extensions @@ -1714,29 +1705,30 @@ :: :::: ++ able ^? |% - ++ gift :: outgoing result + +$ gift :: outgoing result $% [%boon payload=*] :: ames response [%done error=(unit error:ames)] :: ames message (n)ack [%onto p=(each suss tang)] :: about agent [%unto p=sign:agent] :: == :: - ++ task :: incoming request + +$ task :: incoming request $~ [%vega ~] :: $% [%conf dap=term] :: start agent - [$deal p=sock q=term r=deal] :: full transmission + [%deal p=sock q=term r=deal] :: full transmission [%goad force=? agent=(unit dude)] :: rebuild agent(s) [%sear =ship] :: clear pending queues + [%fade dap=term style=?(%slay %idle %jolt)] :: put app to sleep $>(%init vane-task) :: set owner $>(%trim vane-task) :: trim state $>(%vega vane-task) :: report upgrade $>(%plea vane-task) :: network request == :: -- ::able - ++ bitt (map duct (pair ship path)) :: incoming subs - ++ boat :: outgoing subs - %+ map ,[=wire =ship =term] :: - ,[acked=? =path] :: - ++ bowl :: standard app state + +$ bitt (map duct (pair ship path)) :: incoming subs + +$ boat :: outgoing subs + %+ map [=wire =ship =term] :: + [acked=? =path] :: + +$ bowl :: standard app state $: $: our=ship :: host src=ship :: guest dap=term :: agent @@ -1749,16 +1741,16 @@ now=@da :: current time byk=beak :: load source == == :: - ++ dude term :: server identity - ++ gill (pair ship term) :: general contact - ++ scar :: opaque duct + +$ dude term :: server identity + +$ gill (pair ship term) :: general contact + +$ scar :: opaque duct $: p=@ud :: bone sequence q=(map duct bone) :: by duct r=(map bone duct) :: by bone == :: - ++ suss (trel dude @tas @da) :: config report - ++ well (pair desk term) :: - ++ neat + +$ suss (trel dude @tas @da) :: config report + +$ well (pair desk term) :: + +$ neat $% [%arvo =note-arvo] [%agent [=ship name=term] =deal] == @@ -1848,7 +1840,7 @@ |% :: +gift: effects the client can emit :: - ++ gift + +$ gift $% :: %request: outbound http-request to earth :: :: TODO: id is sort of wrong for this interface; the duct should @@ -1863,7 +1855,7 @@ [%http-response =client-response] == :: - ++ task + +$ task $~ [%vega ~] $% :: event failure notification :: @@ -1967,7 +1959,7 @@ [%breach who=ship] == :: :: - ++ gift :: out result <-$ + +$ gift :: out result <-$ $% [%init p=ship] :: report install unix [%done error=(unit error:ames)] :: ames message (n)ack [%boon payload=*] :: ames response @@ -1979,7 +1971,7 @@ :: +$ seed [who=ship lyf=life key=ring sig=(unit oath:pki)] :: - += task :: in request ->$ + +$ task :: in request ->$ $~ [%vega ~] :: $% [%dawn dawn-event] :: boot from keys [%fake =ship] :: fake boot @@ -2170,14 +2162,14 @@ :: bit is set, the new life of this ship may have :: lost information that the old life had. :: - ++ hand @uvH :: 128-bit hash - ++ mind {who/ship lyf/life} :: key identifier - ++ name (pair @ta @t) :: ascii / unicode - ++ oath @ :: signature + +$ hand @uvH :: 128-bit hash + +$ mind [who=ship lyf=life] :: key identifier + +$ name (pair @ta @t) :: ascii / unicode + +$ oath @ :: signature -- :: pki -- :: jael :: -++ gift-arvo :: out result <-$ ++$ gift-arvo :: out result <-$ $~ [%init ~zod] $% gift:able:ames gift:able:behn @@ -2188,7 +2180,7 @@ gift:able:iris gift:able:jael == -++ task-arvo :: in request ->$ ++$ task-arvo :: in request ->$ $% task:able:ames task:able:clay task:able:behn @@ -2198,21 +2190,21 @@ task:able:iris task:able:jael == -++ note-arvo :: out request $-> ++$ note-arvo :: out request $-> $~ [%b %wake ~] - $% {$a task:able:ames} - {$b task:able:behn} - {$c task:able:clay} - {$d task:able:dill} + $% [%a task:able:ames] + [%b task:able:behn] + [%c task:able:clay] + [%d task:able:dill] [%e task:able:eyre] - {$g task:able:gall} + [%g task:able:gall] [%i task:able:iris] - {$j task:able:jael} - {@tas $meta vase} + [%j task:able:jael] + [@tas %meta vase] == -++ sign-arvo :: in result $<- - $% {$a gift:able:ames} - $: $b ++$ sign-arvo :: in result $<- + $% [%a gift:able:ames] + $: %b $% gift:able:behn $>(%wris gift:able:clay) $>(%writ gift:able:clay) @@ -2220,12 +2212,12 @@ $>(%unto gift:able:gall) == == - {$c gift:able:clay} - {$d gift:able:dill} + [%c gift:able:clay] + [%d gift:able:dill] [%e gift:able:eyre] - {$g gift:able:gall} + [%g gift:able:gall] [%i gift:able:iris] - {$j gift:able:jael} + [%j gift:able:jael] == :: $unix-task: input from unix :: @@ -2289,41 +2281,41 @@ |% :: :: ++fu:number ++ fu :: modulo (mul p q) - |= a/{p/@ q/@} + |= a=[p=@ q=@] =+ b=?:(=([0 0] a) 0 (~(inv fo p.a) (~(sit fo p.a) q.a))) |% :: :: ++dif:fu:number ++ dif :: subtract - |= {c/{@ @} d/{@ @}} + |= [c=[@ @] d=[@ @]] [(~(dif fo p.a) -.c -.d) (~(dif fo q.a) +.c +.d)] :: :: ++exp:fu:number ++ exp :: exponent - |= {c/@ d/{@ @}} + |= [c=@ d=[@ @]] :- (~(exp fo p.a) (mod c (dec p.a)) -.d) (~(exp fo q.a) (mod c (dec q.a)) +.d) :: :: ++out:fu:number ++ out :: garner's formula - |= c/{@ @} + |= c=[@ @] %+ add +.c %+ mul q.a %+ ~(pro fo p.a) b (~(dif fo p.a) -.c (~(sit fo p.a) +.c)) :: :: ++pro:fu:number ++ pro :: multiply - |= {c/{@ @} d/{@ @}} + |= [c=[@ @] d=[@ @]] [(~(pro fo p.a) -.c -.d) (~(pro fo q.a) +.c +.d)] :: :: ++sum:fu:number ++ sum :: add - |= {c/{@ @} d/{@ @}} + |= [c=[@ @] d=[@ @]] [(~(sum fo p.a) -.c -.d) (~(sum fo q.a) +.c +.d)] :: :: ++sit:fu:number ++ sit :: represent - |= c/@ + |= c=@ [(mod c p.a) (mod c q.a)] -- ::fu :: :: ++pram:number ++ pram :: rabin-miller - |= a/@ ^- ? + |= a=@ ^- ? ?: ?| =(0 (end 0 1 a)) =(1 a) =+ b=1 @@ -2335,7 +2327,7 @@ | =+ ^= b =+ [s=(dec a) t=0] - |- ^- {s/@ t/@} + |- ^- [s=@ t=@] ?: =(0 (end 0 1 s)) $(s (rsh 0 1 s), t +(t)) [s t] @@ -2359,19 +2351,19 @@ == :: :: ++ramp:number ++ ramp :: make r-m prime - |= {a/@ b/(list @) c/@} ^- @ux :: {bits snags seed} + |= [a=@ b=(list @) c=@] ^- @ux :: [bits snags seed] => .(c (shas %ramp c)) =+ d=*@ |- ?: =((mul 100 a) d) ~|(%ar-ramp !!) =+ e=(~(raw og c) a) - ?: &((levy b |=(f/@ !=(1 (mod e f)))) (pram e)) + ?: &((levy b |=(f=@ !=(1 (mod e f)))) (pram e)) e $(c +(c), d (shax d)) :: :: ++curt:number ++ curt :: curve25519 - |= {a/@ b/@} + |= [a=@ b=@] => %= . + => + @@ -2381,20 +2373,20 @@ |% :: :: ++cla:curt:number ++ cla :: - |= raw/@ + |= raw=@ =+ low=(dis 248 (cut 3 [0 1] raw)) =+ hih=(con 64 (dis 127 (cut 3 [31 1] raw))) =+ mid=(cut 3 [1 30] raw) (can 3 [[1 low] [30 mid] [1 hih] ~]) :: :: ++sqr:curt:number ++ sqr :: - |=(a/@ (mul a a)) + |=(a=@ (mul a a)) :: :: ++inv:curt:number ++ inv :: - |=(a/@ (~(exp fo q) (sub q 2) a)) + |=(a=@ (~(exp fo q) (sub q 2) a)) :: :: ++cad:curt:number ++ cad :: - |= {n/{x/@ z/@} m/{x/@ z/@} d/{x/@ z/@}} + |= [n=[x=@ z=@] m=[x=@ z=@] d=[x=@ z=@]] =+ ^= xx ;: mul 4 z.d %- sqr %- abs:si @@ -2412,7 +2404,7 @@ [(sit.fq xx) (sit.fq zz)] :: :: ++cub:curt:number ++ cub :: - |= {x/@ z/@} + |= [x=@ z=@] =+ ^= xx %+ mul %- sqr %- abs:si @@ -2439,19 +2431,19 @@ $(i (dec i), r (cad r s one), s (cub s)) :: :: ++ga:number ++ ga :: GF (bex p.a) - |= a/{p/@ q/@ r/@} :: dim poly gen + |= a=[p=@ q=@ r=@] :: dim poly gen =+ si=(bex p.a) =+ ma=(dec si) => |% :: :: ++dif:ga:number ++ dif :: add and sub - |= {b/@ c/@} + |= [b=@ c=@] ~| [%dif-ga a] ?> &((lth b si) (lth c si)) (mix b c) :: :: ++dub:ga:number ++ dub :: mul by x - |= b/@ + |= b=@ ~| [%dub-ga a] ?> (lth b si) ?: =(1 (cut 0 [(dec p.a) 1] b)) @@ -2459,7 +2451,7 @@ (lsh 0 1 b) :: :: ++pro:ga:number ++ pro :: slow multiply - |= {b/@ c/@} + |= [b=@ c=@] ?: =(0 b) 0 ?: =(1 (dis 1 b)) @@ -2468,7 +2460,7 @@ :: :: ++toe:ga:number ++ toe :: exp+log tables =+ ^= nu - |= {b/@ c/@} + |= [b=@ c=@] ^- (map @ @) =+ d=*(map @ @) |- @@ -2480,7 +2472,7 @@ == =+ [p=(nu 0 (bex p.a)) q=(nu ma ma)] =+ [b=1 c=0] - |- ^- {p/(map @ @) q/(map @ @)} + |- ^- [p=(map @ @) q=(map @ @)] ?: =(ma c) [(~(put by p) c b) q] %= $ @@ -2491,18 +2483,18 @@ == :: :: ++sit:ga:number ++ sit :: reduce - |= b/@ + |= b=@ (mod b (bex p.a)) -- :: =+ toe |% :: :: ++fra:ga:number ++ fra :: divide - |= {b/@ c/@} + |= [b=@ c=@] (pro b (inv c)) :: :: ++inv:ga:number ++ inv :: invert - |= b/@ + |= b=@ ~| [%inv-ga a] =+ c=(~(get by q) b) ?~ c !! @@ -2510,7 +2502,7 @@ (need d) :: :: ++pow:ga:number ++ pow :: exponent - |= {b/@ c/@} + |= [b=@ c=@] =+ [d=1 e=c f=0] |- ?: =(p.a f) @@ -2520,7 +2512,7 @@ $(e (pro e e), f +(f)) :: :: ++pro:ga:number ++ pro :: multiply - |= {b/@ c/@} + |= [b=@ c=@] ~| [%pro-ga a] =+ d=(~(get by q) b) ?~ d 0 @@ -2545,16 +2537,16 @@ |% :: :: ++ahem:aes:crypto ++ ahem :: kernel state - |= {nnk/@ nnb/@ nnr/@} + |= [nnk=@ nnb=@ nnr=@] => =+ => [gr=(ga 8 0x11b 3) few==>(fe .(a 5))] [pro=pro.gr dif=dif.gr pow=pow.gr ror=ror.few] => |% :: ++ cipa $_ ^? :: AES params |% - ++ co *{p/@ q/@ r/@ s/@} :: column coefficients - ++ ix |~(a/@ *@) :: key index - ++ ro *{p/@ q/@ r/@ s/@} :: row shifts + ++ co *[p=@ q=@ r=@ s=@] :: column coefficients + ++ ix |~(a=@ *@) :: key index + ++ ro *[p=@ q=@ r=@ s=@] :: row shifts ++ su *@ :: s-box -- ::cipa -- :: @@ -2568,7 +2560,7 @@ [0x2 0x3 1 1] :: :: ++ix:pen:ahem:aes: ++ ix :: key index - |~(a/@ a) + |~(a=@ a) :: :: ++ro:pen:ahem:aes: ++ ro :: row shifts [0 1 2 3] @@ -2600,7 +2592,7 @@ [0xe 0xb 0xd 0x9] :: :: ++ix:pin:ahem:aes: ++ ix :: key index - |~(a/@ (sub nnr a)) + |~(a=@ (sub nnr a)) :: :: ++ro:pin:ahem:aes: ++ ro :: row shifts [0 3 2 1] @@ -2625,7 +2617,7 @@ -- :: :: ++mcol:ahem:aes: ++ mcol :: - |= {a/(list @) b/{p/@ q/@ r/@ s/@}} + |= [a=(list @) b=[p=@ q=@ r=@ s=@]] ^- (list @) =+ c=[p=*@ q=*@ r=*@ s=*@] |- ^- (list @) @@ -2643,11 +2635,11 @@ [[p.c r.b] [q.c s.b] [r.c p.b] [s.c q.b]] [[p.c q.b] [q.c r.b] [r.c s.b] [s.c p.b]] == - |= {a/{@ @} b/{@ @} c/{@ @} d/{@ @}} + |= [a=[@ @] b=[@ @] c=[@ @] d=[@ @]] :(dif (pro a) (pro b) (pro c) (pro d)) :: :: ++pode:ahem:aes: ++ pode :: explode to block - |= {a/bloq b/@ c/@} ^- (list @) + |= [a=bloq b=@ c=@] ^- (list @) =+ d=(rip a c) =+ m=(met a c) |- @@ -2656,13 +2648,13 @@ $(m +(m), d (weld d (limo [0 ~]))) :: :: ++sube:ahem:aes: ++ sube :: s-box word - |= {a/@ b/@} ^- @ - (rep 3 (turn (pode 3 4 a) |=(c/@ (cut 3 [c 1] b)))) + |= [a=@ b=@] ^- @ + (rep 3 (turn (pode 3 4 a) |=(c=@ (cut 3 [c 1] b)))) -- :: |% :: :: ++be:ahem:aes:crypto ++ be :: block cipher - |= {a/? b/@ c/@H} ^- @uxH + |= [a=? b=@ c=@H] ^- @uxH ~| %be-aesc => %= . + @@ -2670,18 +2662,18 @@ |% :: :: ++ankh:be:ahem:aes: ++ ankh :: - |= {a/cipa b/@ c/@} + |= [a=cipa b=@ c=@] (pode 5 nnb (cut 5 [(mul (ix.a b) nnb) nnb] c)) :: :: ++sark:be:ahem:aes: ++ sark :: - |= {c/(list @) d/(list @)} + |= [c=(list @) d=(list @)] ^- (list @) ?~ c ~ ?~ d !! [(mix i.c i.d) $(c t.c, d t.d)] :: :: ++srow:be:ahem:aes: ++ srow :: - |= {a/cipa b/(list @)} ^- (list @) + |= [a=cipa b=(list @)] ^- (list @) =+ [c=0 d=~ e=ro.a] |- ?: =(c nnb) @@ -2690,11 +2682,11 @@ %+ rep 3 %+ turn (limo [0 p.e] [1 q.e] [2 r.e] [3 s.e] ~) - |= {f/@ g/@} + |= [f=@ g=@] (cut 3 [f 1] (snag (mod (add g c) nnb) b)) :: :: ++subs:be:ahem:aes: ++ subs :: - |= {a/cipa b/(list @)} ^- (list @) + |= [a=cipa b=(list @)] ^- (list @) ?~ b ~ [(sube i.b su.a) $(b t.b)] -- @@ -2714,7 +2706,7 @@ (rep 5 e) :: :: ++ex:ahem:aes:crypto ++ ex :: key expand - |= a/@I ^- @ + |= a=@I ^- @ =+ [b=a c=0 d=su:pen i=nnk] |- ?: =(i (mul nnb +(nnr))) @@ -2732,7 +2724,7 @@ $(i +(i)) :: :: ++ix:ahem:aes:crypto ++ ix :: key expand, inv - |= a/@ ^- @ + |= a=@ ^- @ =+ [i=1 j=*@ b=*@ c=co:pin] |- ?: =(nnr i) @@ -2753,11 +2745,11 @@ :: :: ++ecba:aes:crypto ++ ecba :: AES-128 ECB ~% %ecba +> ~ - |_ key/@H + |_ key=@H :: :: ++en:ecba:aes:crypto ++ en :: encrypt ~/ %en - |= blk/@H ^- @uxH + |= blk=@H ^- @uxH =+ (ahem 4 4 10) =: key (~(net fe 7) key) @@ -2768,7 +2760,7 @@ :: :: ++de:ecba:aes:crypto ++ de :: decrypt ~/ %de - |= blk/@H ^- @uxH + |= blk=@H ^- @uxH =+ (ahem 4 4 10) =: key (~(net fe 7) key) @@ -2780,11 +2772,11 @@ :: :: ++ecbb:aes:crypto ++ ecbb :: AES-192 ECB ~% %ecbb +> ~ - |_ key/@I + |_ key=@I :: :: ++en:ecbb:aes:crypto ++ en :: encrypt ~/ %en - |= blk/@H ^- @uxH + |= blk=@H ^- @uxH =+ (ahem 6 4 12) =: key (rsh 6 1 (~(net fe 8) key)) @@ -2795,7 +2787,7 @@ :: :: ++de:ecbb:aes:crypto ++ de :: decrypt ~/ %de - |= blk/@H ^- @uxH + |= blk=@H ^- @uxH =+ (ahem 6 4 12) =: key (rsh 6 1 (~(net fe 8) key)) @@ -2807,11 +2799,11 @@ :: :: ++ecbc:aes:crypto ++ ecbc :: AES-256 ECB ~% %ecbc +> ~ - |_ key/@I + |_ key=@I :: :: ++en:ecbc:aes:crypto ++ en :: encrypt ~/ %en - |= blk/@H ^- @uxH + |= blk=@H ^- @uxH =+ (ahem 8 4 14) =: key (~(net fe 8) key) @@ -2822,7 +2814,7 @@ :: :: ++de:ecbc:aes:crypto ++ de :: decrypt ~/ %de - |= blk/@H ^- @uxH + |= blk=@H ^- @uxH =+ (ahem 8 4 14) =: key (~(net fe 8) key) @@ -2834,13 +2826,13 @@ :: :: ++cbca:aes:crypto ++ cbca :: AES-128 CBC ~% %cbca +> ~ - |_ {key/@H prv/@H} + |_ [key=@H prv=@H] :: :: ++en:cbca:aes:crypto ++ en :: encrypt ~/ %en - |= txt/@ ^- @ux + |= txt=@ ^- @ux =+ pts=?:(=(txt 0) `(list @)`~[0] (flop (rip 7 txt))) - =| cts/(list @) + =| cts=(list @) %+ rep 7 :: logically, flop twice here |- ^- (list @) @@ -2855,9 +2847,9 @@ :: :: ++de:cbca:aes:crypto ++ de :: decrypt ~/ %de - |= txt/@ ^- @ux + |= txt=@ ^- @ux =+ cts=?:(=(txt 0) `(list @)`~[0] (flop (rip 7 txt))) - =| pts/(list @) + =| pts=(list @) %+ rep 7 :: logically, flop twice here |- ^- (list @) @@ -2873,13 +2865,13 @@ :: :: ++cbcb:aes:crypto ++ cbcb :: AES-192 CBC ~% %cbcb +> ~ - |_ {key/@I prv/@H} + |_ [key=@I prv=@H] :: :: ++en:cbcb:aes:crypto ++ en :: encrypt ~/ %en - |= txt/@ ^- @ux + |= txt=@ ^- @ux =+ pts=?:(=(txt 0) `(list @)`~[0] (flop (rip 7 txt))) - =| cts/(list @) + =| cts=(list @) %+ rep 7 :: logically, flop twice here |- ^- (list @) @@ -2894,9 +2886,9 @@ :: :: ++de:cbcb:aes:crypto ++ de :: decrypt ~/ %de - |= txt/@ ^- @ux + |= txt=@ ^- @ux =+ cts=?:(=(txt 0) `(list @)`~[0] (flop (rip 7 txt))) - =| pts/(list @) + =| pts=(list @) %+ rep 7 :: logically, flop twice here |- ^- (list @) @@ -2912,13 +2904,13 @@ :: :: ++cbcc:aes:crypto ++ cbcc :: AES-256 CBC ~% %cbcc +> ~ - |_ {key/@I prv/@H} + |_ [key=@I prv=@H] :: :: ++en:cbcc:aes:crypto ++ en :: encrypt ~/ %en - |= txt/@ ^- @ux + |= txt=@ ^- @ux =+ pts=?:(=(txt 0) `(list @)`~[0] (flop (rip 7 txt))) - =| cts/(list @) + =| cts=(list @) %+ rep 7 :: logically, flop twice here |- ^- (list @) @@ -2933,9 +2925,9 @@ :: :: ++de:cbcc:aes:crypto ++ de :: decrypt ~/ %de - |= txt/@ ^- @ux + |= txt=@ ^- @ux =+ cts=?:(=(txt 0) `(list @)`~[0] (flop (rip 7 txt))) - =| pts/(list @) + =| pts=(list @) %+ rep 7 :: logically, flop twice here |- ^- (list @) @@ -2950,7 +2942,7 @@ -- ::cbcc :: :: ++inc:aes:crypto ++ inc :: inc. low bloq - |= {mod/bloq ctr/@H} + |= [mod=bloq ctr=@H] ^- @uxH =+ bqs=(rip mod ctr) ?~ bqs 0x1 @@ -2959,11 +2951,11 @@ :: :: ++ctra:aes:crypto ++ ctra :: AES-128 CTR ~% %ctra +> ~ - |_ {key/@H mod/bloq len/@ ctr/@H} + |_ [key=@H mod=bloq len=@ ctr=@H] :: :: ++en:ctra:aes:crypto ++ en :: encrypt ~/ %en - |= txt/@ + |= txt=@ ^- @ux =/ encrypt ~(en ecba key) =/ blocks (add (div len 16) ?:(=((^mod len 16) 0) 0 1)) @@ -2986,11 +2978,11 @@ :: :: ++ctrb:aes:crypto ++ ctrb :: AES-192 CTR ~% %ctrb +> ~ - |_ {key/@I mod/bloq len/@ ctr/@H} + |_ [key=@I mod=bloq len=@ ctr=@H] :: :: ++en:ctrb:aes:crypto ++ en ~/ %en - |= txt/@ + |= txt=@ ^- @ux =/ encrypt ~(en ecbb key) =/ blocks (add (div len 16) ?:(=((^mod len 16) 0) 0 1)) @@ -3013,11 +3005,11 @@ :: :: ++ctrc:aes:crypto ++ ctrc :: AES-256 CTR ~% %ctrc +> ~ - |_ {key/@I mod/bloq len/@ ctr/@H} + |_ [key=@I mod=bloq len=@ ctr=@H] :: :: ++en:ctrc:aes:crypto ++ en :: encrypt ~/ %en - |= txt/@ + |= txt=@ ^- @ux =/ encrypt ~(en ecbc key) =/ blocks (add (div len 16) ?:(=((^mod len 16) 0) 0 1)) @@ -3041,7 +3033,7 @@ ++ doub :: double 128-bit |= :: string mod finite :: - str/@H + str=@H :: :: field (see spec) :: @@ -3052,7 +3044,7 @@ (mix 0x87 (lsh 0 1 str)) :: :: ++mpad:aes:crypto ++ mpad :: - |= {oct/@ txt/@} + |= [oct=@ txt=@] :: :: pad message to multiple of 128 bits :: by appending 1, then 0s @@ -3065,32 +3057,32 @@ (lsh 3 (sub 15 pad) (mix 0x80 (lsh 3 1 txt))) :: :: ++suba:aes:crypto ++ suba :: AES-128 subkeys - |= key/@H + |= key=@H =+ l=(~(en ecba key) 0) =+ k1=(doub l) =+ k2=(doub k1) - ^- {@ux @ux} + ^- [@ux @ux] [k1 k2] :: :: ++subb:aes:crypto ++ subb :: AES-192 subkeys - |= key/@I + |= key=@I =+ l=(~(en ecbb key) 0) =+ k1=(doub l) =+ k2=(doub k1) - ^- {@ux @ux} + ^- [@ux @ux] [k1 k2] :: :: ++subc:aes:crypto ++ subc :: AES-256 subkeys - |= key/@I + |= key=@I =+ l=(~(en ecbc key) 0) =+ k1=(doub l) =+ k2=(doub k1) - ^- {@ux @ux} + ^- [@ux @ux] [k1 k2] :: :: ++maca:aes:crypto ++ maca :: AES-128 CMAC ~/ %maca - |= {key/@H oct/(unit @) txt/@} + |= [key=@H oct=(unit @) txt=@] ^- @ux =+ [sub=(suba key) len=?~(oct (met 3 txt) u.oct)] =+ ^= pdt @@ -3110,7 +3102,7 @@ :: :: ++macb:aes:crypto ++ macb :: AES-192 CMAC ~/ %macb - |= {key/@I oct/(unit @) txt/@} + |= [key=@I oct=(unit @) txt=@] ^- @ux =+ [sub=(subb key) len=?~(oct (met 3 txt) u.oct)] =+ ^= pdt @@ -3130,7 +3122,7 @@ :: :: ++macc:aes:crypto ++ macc :: AES-256 CMAC ~/ %macc - |= {key/@I oct/(unit @) txt/@} + |= [key=@I oct=(unit @) txt=@] ^- @ux =+ [sub=(subc key) len=?~(oct (met 3 txt) u.oct)] =+ ^= pdt @@ -3201,11 +3193,11 @@ :: :: ++siva:aes:crypto ++ siva :: AES-128 SIV ~% %siva +> ~ - |_ {key/@I vec/(list @)} + |_ [key=@I vec=(list @)] :: :: ++en:siva:aes:crypto ++ en :: encrypt ~/ %en - |= txt/@ + |= txt=@ ^- (trel @uxH @ud @ux) =+ [k1=(rsh 7 1 key) k2=(end 7 1 key)] =+ iv=(s2va k1 (weld vec (limo ~[txt]))) @@ -3218,7 +3210,7 @@ :: :: ++de:siva:aes:crypto ++ de :: decrypt ~/ %de - |= {iv/@H len/@ txt/@} + |= [iv=@H len=@ txt=@] ^- (unit @ux) =+ [k1=(rsh 7 1 key) k2=(end 7 1 key)] =* hib (dis iv 0xffff.ffff.ffff.ffff.7fff.ffff.7fff.ffff) @@ -3231,11 +3223,11 @@ :: :: ++sivb:aes:crypto ++ sivb :: AES-192 SIV ~% %sivb +> ~ - |_ {key/@J vec/(list @)} + |_ [key=@J vec=(list @)] :: :: ++en:sivb:aes:crypto ++ en :: encrypt ~/ %en - |= txt/@ + |= txt=@ ^- (trel @uxH @ud @ux) =+ [k1=(rsh 6 3 key) k2=(end 6 3 key)] =+ iv=(s2vb k1 (weld vec (limo ~[txt]))) @@ -3247,7 +3239,7 @@ :: :: ++de:sivb:aes:crypto ++ de :: decrypt ~/ %de - |= {iv/@H len/@ txt/@} + |= [iv=@H len=@ txt=@] ^- (unit @ux) =+ [k1=(rsh 6 3 key) k2=(end 6 3 key)] =* hib (dis iv 0xffff.ffff.ffff.ffff.7fff.ffff.7fff.ffff) @@ -3260,11 +3252,11 @@ :: :: ++sivc:aes:crypto ++ sivc :: AES-256 SIV ~% %sivc +> ~ - |_ {key/@J vec/(list @)} + |_ [key=@J vec=(list @)] :: :: ++en:sivc:aes:crypto ++ en :: encrypt ~/ %en - |= txt/@ + |= txt=@ ^- (trel @uxH @ud @ux) =+ [k1=(rsh 8 1 key) k2=(end 8 1 key)] =+ iv=(s2vc k1 (weld vec (limo ~[txt]))) @@ -3277,7 +3269,7 @@ :: :: ++de:sivc:aes:crypto ++ de :: decrypt ~/ %de - |= {iv/@H len/@ txt/@} + |= [iv=@H len=@ txt=@] ^- (unit @ux) =+ [k1=(rsh 8 1 key) k2=(end 8 1 key)] =* hib (dis iv 0xffff.ffff.ffff.ffff.7fff.ffff.7fff.ffff) @@ -3306,10 +3298,10 @@ |% :: :: ++norm:ed:crypto ++ norm :: - |=(x/@ ?:(=(0 (mod x 2)) x (sub q x))) + |=(x=@ ?:(=(0 (mod x 2)) x (sub q x))) :: :: ++xrec:ed:crypto ++ xrec :: recover x-coord - |= y/@ ^- @ + |= y=@ ^- @ =+ ^= xx %+ mul (dif.fq (mul y y) 1) (inv.fq +(:(mul d y y))) @@ -3319,7 +3311,7 @@ (norm x) :: :: ++ward:ed:crypto ++ ward :: edwards multiply - |= {pp/{@ @} qq/{@ @}} ^- {@ @} + |= [pp=[@ @] qq=[@ @]] ^- [@ @] =+ dp=:(pro.fq d -.pp -.qq +.pp +.qq) =+ ^= xt %+ pro.fq @@ -3336,7 +3328,7 @@ [xt yt] :: :: ++scam:ed:crypto ++ scam :: scalar multiply - |= {pp/{@ @} e/@} ^- {@ @} + |= [pp=[@ @] e=@] ^- [@ @] ?: =(0 e) [0 1] =+ qq=$(e (div e 2)) @@ -3346,11 +3338,11 @@ qq :: :: ++etch:ed:crypto ++ etch :: encode point - |= pp/{@ @} ^- @ + |= pp=[@ @] ^- @ (can 0 ~[[(sub b 1) +.pp] [1 (dis 1 -.pp)]]) :: :: ++curv:ed:crypto ++ curv :: point on curve? - |= {x/@ y/@} ^- ? + |= [x=@ y=@] ^- ? .= 0 %+ dif.fq %+ sum.fq @@ -3359,7 +3351,7 @@ (sum.fq 1 :(pro.fq d x x y y)) :: :: ++deco:ed:crypto ++ deco :: decode point - |= s/@ ^- (unit {@ @}) + |= s=@ ^- (unit [@ @]) =+ y=(cut 0 [0 (dec b)] s) =+ si=(cut 0 [(dec b) 1] s) =+ x=(xrec y) @@ -3431,7 +3423,7 @@ :: :: ++puck:ed:crypto ++ puck :: public key ~/ %puck - |= sk/@I ^- @ + |= sk=@I ^- @ ?: (gth (met 3 sk) 32) !! =+ h=(shal (rsh 0 3 b) sk) =+ ^= a @@ -3442,13 +3434,13 @@ (etch aa) :: :: ++suck:ed:crypto ++ suck :: keypair from seed - |= se/@I ^- @uJ + |= se=@I ^- @uJ =+ pu=(puck se) (can 0 ~[[b se] [b pu]]) :: :: ++shar:ed:crypto ++ shar :: curve25519 secret ~/ %shar - |= {pub/@ sek/@} + |= [pub=@ sek=@] ^- @ux =+ exp=(shal (rsh 0 3 b) (suck sek)) =. exp (dis exp (can 0 ~[[3 0] [251 (fil 0 251 1)]])) @@ -3459,7 +3451,7 @@ :: :: ++sign:ed:crypto ++ sign :: certify ~/ %sign - |= {m/@ se/@} ^- @ + |= [m=@ se=@] ^- @ =+ sk=(suck se) =+ pk=(cut 0 [b b] sk) =+ h=(shal (rsh 0 3 b) sk) @@ -3489,7 +3481,7 @@ :: :: ++veri:ed:crypto ++ veri :: validate ~/ %veri - |= {s/@ m/@ pk/@} ^- ? + |= [s=@ m=@ pk=@] ^- ? ?: (gth (div b 4) (met 3 s)) | ?: (gth (div b 8) (met 3 pk)) | =+ cb=(rsh 0 3 b) @@ -3510,19 +3502,19 @@ |% :: :: ++sal:scr:crypto ++ sal :: salsa20 hash - |= {x/@ r/@} :: with r rounds + |= [x=@ r=@] :: with r rounds ?> =((mod r 2) 0) :: =+ few==>(fe .(a 5)) =+ ^= rot - |= {a/@ b/@} + |= [a=@ b=@] (mix (end 5 1 (lsh 0 a b)) (rsh 0 (sub 32 a) b)) =+ ^= lea - |= {a/@ b/@} + |= [a=@ b=@] (net:few (sum:few (net:few a) (net:few b))) => |% :: :: ++qr:sal:scr:crypto ++ qr :: quarterround - |= y/{@ @ @ @ ~} + |= y=[@ @ @ @ ~] =+ zb=(mix &2.y (rot 7 (sum:few &1.y &4.y))) =+ zc=(mix &3.y (rot 9 (sum:few zb &1.y))) =+ zd=(mix &4.y (rot 13 (sum:few zc zb))) @@ -3530,7 +3522,7 @@ ~[za zb zc zd] :: :: ++rr:sal:scr:crypto ++ rr :: rowround - |= {y/(list @)} + |= [y=(list @)] =+ za=(qr ~[&1.y &2.y &3.y &4.y]) =+ zb=(qr ~[&6.y &7.y &8.y &5.y]) =+ zc=(qr ~[&11.y &12.y &9.y &10.y]) @@ -3542,7 +3534,7 @@ &2.zd &3.zd &4.zd &1.zd == :: :: ++cr:sal:scr:crypto ++ cr :: columnround - |= {x/(list @)} + |= [x=(list @)] =+ ya=(qr ~[&1.x &5.x &9.x &13.x]) =+ yb=(qr ~[&6.x &10.x &14.x &2.x]) =+ yc=(qr ~[&11.x &15.x &3.x &7.x]) @@ -3554,11 +3546,11 @@ &4.ya &3.yb &2.yc &1.yd == :: :: ++dr:sal:scr:crypto ++ dr :: doubleround - |= {x/(list @)} + |= [x=(list @)] (rr (cr x)) :: :: ++al:sal:scr:crypto ++ al :: add two lists - |= {a/(list @) b/(list @)} + |= [a=(list @) b=(list @)] |- ^- (list @) ?~ a ~ ?~ b ~ [i=(sum:few -.a -.b) t=$(a +.a, b +.b)] @@ -3570,7 +3562,7 @@ (rep 5 (al xw ow)) :: :: ++rpp:scr:crypto ++ rpp :: rip+filler blocks - |= {a/bloq b/@ c/@} + |= [a=bloq b=@ c=@] =+ q=(rip a c) =+ w=(lent q) ?. =(w b) @@ -3579,23 +3571,23 @@ q :: :: ++bls:scr:crypto ++ bls :: split to sublists - |= {a/@ b/(list @)} + |= [a=@ b=(list @)] ?> =((mod (lent b) a) 0) |- ^- (list (list @)) ?~ b ~ [i=(scag a `(list @)`b) t=$(b (slag a `(list @)`b))] :: :: ++slb:scr:crypto ++ slb :: - |= {a/(list (list @))} + |= [a=(list (list @))] |- ^- (list @) ?~ a ~ (weld `(list @)`-.a $(a +.a)) :: :: ++sbm:scr:crypto ++ sbm :: scryptBlockMix - |= {r/@ b/(list @)} + |= [r=@ b=(list @)] ?> =((lent b) (mul 2 r)) =+ [x=(snag (dec (mul 2 r)) b) c=0] - =| {ya/(list @) yb/(list @)} + =| [ya=(list @) yb=(list @)] |- ^- (list @) ?~ b (flop (weld yb ya)) =. x (sal (mix x -.b) 8) @@ -3604,7 +3596,7 @@ $(c +(c), b +.b, yb [i=x t=yb]) :: :: ++srm:scr:crypto ++ srm :: scryptROMix - |= {r/@ b/(list @) n/@} + |= [r=@ b=(list @) n=@] ?> ?& =((lent b) (mul 2 r)) =(n (bex (dec (xeb n)))) (lth n (bex (mul r 16))) @@ -3626,11 +3618,11 @@ $(x (sbm r w), c +(c)) :: :: ++hmc:scr:crypto ++ hmc :: HMAC-SHA-256 - |= {k/@ t/@} + |= [k=@ t=@] (hml k (met 3 k) t (met 3 t)) :: :: ++hml:scr:crypto ++ hml :: w+length - |= {k/@ kl/@ t/@ tl/@} + |= [k=@ kl=@ t=@ tl=@] => .(k (end 3 kl k), t (end 3 tl t)) =+ b=64 =? k (gth kl b) (shay kl k) @@ -3641,12 +3633,12 @@ :: :: ++pbk:scr:crypto ++ pbk :: PBKDF2-HMAC-SHA256 ~/ %pbk - |= {p/@ s/@ c/@ d/@} + |= [p=@ s=@ c=@ d=@] (pbl p (met 3 p) s (met 3 s) c d) :: :: ++pbl:scr:crypto ++ pbl :: w+length ~/ %pbl - |= {p/@ pl/@ s/@ sl/@ c/@ d/@} + |= [p=@ pl=@ s=@ sl=@ c=@ d=@] => .(p (end 3 pl p), s (end 3 sl s)) =+ h=32 :: @@ -3674,13 +3666,13 @@ :: :: ++hsh:scr:crypto ++ hsh :: scrypt ~/ %hsh - |= {p/@ s/@ n/@ r/@ z/@ d/@} + |= [p=@ s=@ n=@ r=@ z=@ d=@] (hsl p (met 3 p) s (met 3 s) n r z d) :: :: ++hsl:scr:crypto ++ hsl :: w+length ~/ %hsl - |= {p/@ pl/@ s/@ sl/@ n/@ r/@ z/@ d/@} - =| v/(list (list @)) + |= [p=@ pl=@ s=@ sl=@ n=@ r=@ z=@ d=@] + =| v=(list (list @)) => .(p (end 3 pl p), s (end 3 sl s)) =+ u=(mul (mul 128 r) z) :: @@ -3696,17 +3688,17 @@ == =+ ^= b =+ (rpp 3 u (pbl p pl s sl 1 u)) %+ turn (bls (mul 128 r) -) - |=(a/(list @) (rpp 9 (mul 2 r) (rep 3 a))) + |=(a=(list @) (rpp 9 (mul 2 r) (rep 3 a))) ?> =((lent b) z) =+ ^= q =+ |- ?~ b (flop v) $(b +.b, v [i=(srm r -.b n) t=v]) %+ turn `(list (list @))`- - |=(a/(list @) (rpp 3 (mul 128 r) (rep 9 a))) + |=(a=(list @) (rpp 3 (mul 128 r) (rep 9 a))) (pbl p pl (rep 3 (slb q)) u 1 d) :: :: ++ypt:scr:crypto ++ ypt :: 256bit {salt pass} - |= {s/@ p/@} + |= [s=@ p=@] ^- @ (hsh p s 16.384 8 1 256) -- ::scr @@ -3715,7 +3707,7 @@ :: :::: ++ crub !: ^- acru - =| {pub/{cry/@ sgn/@} sek/(unit {cry/@ sgn/@})} + =| [pub=[cry=@ sgn=@] sek=(unit [cry=@ sgn=@])] |% :: :: ++as:crub:crypto ++ as :: @@ -3730,12 +3722,12 @@ ++ sure :: |= txt=@ ^- (unit @ux) - =+ ;;({sig/@ msg/@} (cue txt)) + =+ ;;([sig=@ msg=@] (cue txt)) ?. (veri:ed sig msg sgn.pub) ~ (some msg) :: :: ++seal:as:crub: ++ seal :: - |= {bpk/pass msg/@} + |= [bpk=pass msg=@] ^- @ux ?~ sek ~| %pubkey-only !! ?> =('b' (end 3 1 bpk)) @@ -3745,33 +3737,33 @@ (jam (~(en siva:aes shar ~) smsg)) :: :: ++tear:as:crub: ++ tear :: - |= {bpk/pass txt/@} + |= [bpk=pass txt=@] ^- (unit @ux) ?~ sek ~| %pubkey-only !! ?> =('b' (end 3 1 bpk)) =+ pk=(rsh 8 1 (rsh 3 1 bpk)) =+ shar=(shax (shar:ed pk cry.u.sek)) - =+ ;;({iv/@ len/@ cph/@} (cue txt)) + =+ ;;([iv=@ len=@ cph=@] (cue txt)) =+ try=(~(de siva:aes shar ~) iv len cph) ?~ try ~ (sure:as:(com:nu:crub bpk) u.try) -- ::as :: :: ++de:crub:crypto ++ de :: decrypt - |= {key/@J txt/@} + |= [key=@J txt=@] ^- (unit @ux) - =+ ;;({iv/@ len/@ cph/@} (cue txt)) + =+ ;;([iv=@ len=@ cph=@] (cue txt)) %^ ~(de sivc:aes (shaz key) ~) iv len cph :: :: ++dy:crub:crypto ++ dy :: need decrypt - |= {key/@J cph/@} + |= [key=@J cph=@] (need (de key cph)) :: :: ++en:crub:crypto ++ en :: encrypt - |= {key/@J msg/@} + |= [key=@J msg=@] ^- @ux (jam (~(en sivc:aes (shaz key) ~) msg)) :: :: ++ex:crub:crypto @@ -3801,21 +3793,21 @@ |% :: :: ++pit:nu:crub:crypto ++ pit :: create keypair - |= {w/@ seed/@} + |= [w=@ seed=@] =+ wid=(add (div w 8) ?:(=((mod w 8) 0) 0 1)) =+ bits=(shal wid seed) =+ [c=(rsh 8 1 bits) s=(end 8 1 bits)] ..nu(pub [cry=(puck:ed c) sgn=(puck:ed s)], sek `[cry=c sgn=s]) :: :: ++nol:nu:crub:crypto ++ nol :: activate secret - |= a/ring + |= a=ring =+ [mag=(end 3 1 a) bod=(rsh 3 1 a)] ~| %not-crub-seckey ?> =('B' mag) =+ [c=(rsh 8 1 bod) s=(end 8 1 bod)] ..nu(pub [cry=(puck:ed c) sgn=(puck:ed s)], sek `[cry=c sgn=s]) :: :: ++com:nu:crub:crypto ++ com :: activate public - |= a/pass + |= a=pass =+ [mag=(end 3 1 a) bod=(rsh 3 1 a)] ~| %not-crub-pubkey ?> =('b' mag) ..nu(pub [cry=(rsh 8 1 bod) sgn=(end 8 1 bod)], sek ~) @@ -3832,7 +3824,7 @@ |% :: :: ++trub:test:crypto ++ trub :: test crub - |= msg/@t + |= msg=@t :: :: make acru cores :: @@ -4220,185 +4212,296 @@ :: :: :::: ++secp:crypto :: (2b9) secp family :: :::: - ++ secp - ~% %secp ..is ~ + ++ secp !. + :: TODO: as-octs and hmc are outside of jet parent + => :+ ..is + hmc=hmac-sha256l:hmac:crypto + as-octs=as-octs:mimes:html + ~% %secp +< ~ |% - += jaco [x=@ y=@ z=@] :: jacobian point - += pont [x=@ y=@] :: curve point - :: - ++ secp256k1 - %+ secp 32 - :* p=0xffff.ffff.ffff.ffff.ffff.ffff.ffff.ffff. :: modulo - ffff.ffff.ffff.ffff.ffff.fffe.ffff.fc2f - a=0 :: y^2=x^3+ax+b - b=7 - ^= g :: "prime" point - :* x=0x79be.667e.f9dc.bbac.55a0.6295.ce87.0b07. - 029b.fcdb.2dce.28d9.59f2.815b.16f8.1798 - y=0x483a.da77.26a3.c465.5da4.fbfc.0e11.08a8. - fd17.b448.a685.5419.9c47.d08f.fb10.d4b8 - == - n=0xffff.ffff.ffff.ffff.ffff.ffff.ffff.fffe. :: prime order of g - baae.dce6.af48.a03b.bfd2.5e8c.d036.4141 + +$ jacobian [x=@ y=@ z=@] :: jacobian point + +$ point [x=@ y=@] :: curve point + +$ domain + $: p=@ :: prime modulo + a=@ :: y^2=x^3+ax+b + b=@ :: + g=point :: base point + n=@ :: prime order of g == - :: ++ secp - ~/ %secp - |= [w=@ p=@ a=@ b=@ g=pont n=@] :: being passed in from above - =/ p ~(. fo p) - =/ n ~(. fo n) - ~% %helper ..$ ~ - |% + |_ [bytes=@ =domain] + ++ field-p ~(. fo p.domain) + ++ field-n ~(. fo n.domain) ++ compress-point - ~/ %compress-point - |= pont + |= =point ^- @ - (can 3 ~[w^x 1^(add 0x2 (cut 0 [0 1] y))]) - :: - ++ serialize-point - ~/ %serialize-point - |= pont - ^- @ - (can 3 ~[w^y w^x 1^0x4]) - :: - ++ decompress-point - ~/ %decompress-point - |= dat=@ - ^- pont - =+ x=(end 3 w a) - =+ y=:(add (pow x 3) (mul a x) b) - =+ s=(rsh 3 32 dat) - :- x - ?: =(0x2 s) y - ?: =(0x3 s) y - ~| [`@ux`s `@ux`dat] - !! - :: - ++ priv-to-pub :: get pub from priv - ~/ %priv-to-pub - |= prv=@ - ^- pont - (jc-mul g prv) - :: - ++ make-k :: deterministic nonce - ~/ %make-k - =, mimes:html - |= [has=@uvI prv=@] - ^- @ - =* hmc hmac-sha256l:hmac - =/ v (fil 3 w 1) - =/ k 0 - =. k (hmc w^k (as-octs (can 3 [w has] [w prv] [1 0x0] [w v] ~))) - =. v (hmc w^k w^v) - =. k (hmc w^k (as-octs (can 3 [w has] [w prv] [1 0x1] [w v] ~))) - =. v (hmc w^k w^v) - (hmc w^k w^v) - :: - ++ ecdsa-raw-sign :: generate signature - ~/ %ecdsa-raw-sign - |= [has=@uvI prv=@] - ^- [v=@ r=@ s=@] - =/ z has - =/ k (make-k has prv) - =+ [r y]=(jc-mul g k) - =/ s (pro.n `@`(inv.n k) `@`(sum.n z (mul r prv))) - =/ big-s (gte (mul 2 s) ^n) - :* v=(mix (end 0 1 y) ?:(big-s 1 0)) - r=r - s=?.(big-s s (sub ^n s)) + %+ can 3 + :~ [bytes x.point] + [1 (add 2 (cut 0 [0 1] y.point))] == :: - ++ ecdsa-raw-recover :: get pubkey from sig - ~/ %ecdsa-raw-recover - |= [has=@uvI sig=[v=@ r=@ s=@]] - ^- pont - ?> (lte v.sig 7) - =/ x r.sig - =/ ysq (sum.p b (exp.p 3 x)) :: omits A=0 - =/ bet (exp.p (div +(^p) 4) ysq) - =/ y ?:(=(1 (end 0 1 (mix v.sig bet))) bet (dif.p 0 bet)) - ?> =(0 (dif.p ysq (pro.p y y))) - ?< =(0 (sit.n r.sig)) - ?< =(0 (sit.n s.sig)) - =/ gz (mul:jc [x y 1]:g (dif.n 0 has)) - =/ xy (mul:jc [x y 1] s.sig) - =/ qr (add:jc gz xy) - (from:jc (mul:jc qr (inv.n r.sig))) + ++ serialize-point + |= =point + ^- @ + %+ can 3 + :~ [bytes y.point] + [bytes x.point] + [1 4] + == :: - ++ jc-mul :: point x scalar - |= [a=pont n=@] - ^- pont - (from:jc (mul:jc (into:jc a) n)) + ++ decompress-point + |= compressed=@ + ^- point + =/ x=@ (end 3 bytes compressed) + ?> =(3 (mod p.domain 4)) + =/ fop field-p + =+ [fadd fmul fpow]=[sum.fop pro.fop exp.fop] + =/ y=@ %+ fpow (rsh 0 2 +(p.domain)) + %+ fadd b.domain + %+ fadd (fpow 3 x) + (fmul a.domain x) + =/ s=@ (rsh 3 bytes compressed) + ~| [`@ux`s `@ux`compressed] + ?> |(=(2 s) =(3 s)) + :: check parity + :: + =? y !=((sub s 2) (mod y 2)) + (sub p.domain y) + [x y] :: - ++ jc-add :: add points - |= [a=pont b=pont] - ^- pont - (from:jc (add:jc (into:jc a) (into:jc b))) - :: - ++ jc :: jacobian core + ++ jc :: jacobian math |% - ++ add :: addition - |= [a=jaco b=jaco] - ^- jaco + ++ from + |= a=jacobian + ^- point + =/ fop field-p + =+ [fmul fpow finv]=[pro.fop exp.fop inv.fop] + =/ z (finv z.a) + :- (fmul x.a (fpow 2 z)) + (fmul y.a (fpow 3 z)) + :: + ++ into + |= point + ^- jacobian + [x y 1] + :: + ++ double + |= jacobian + ^- jacobian + ?: =(0 y) [0 0 0] + =/ fop field-p + =+ [fadd fsub fmul fpow]=[sum.fop dif.fop pro.fop exp.fop] + =/ s :(fmul 4 x (fpow 2 y)) + =/ m %+ fadd + (fmul 3 (fpow 2 x)) + (fmul a.domain (fpow 4 z)) + =/ nx %+ fsub + (fpow 2 m) + (fmul 2 s) + =/ ny %+ fsub + (fmul m (fsub s nx)) + (fmul 8 (fpow 4 y)) + =/ nz :(fmul 2 y z) + [nx ny nz] + :: + ++ add + |= [a=jacobian b=jacobian] + ^- jacobian ?: =(0 y.a) b ?: =(0 y.b) a - =/ u1 :(pro.p x.a z.b z.b) - =/ u2 :(pro.p x.b z.a z.a) - =/ s1 :(pro.p y.a z.b z.b z.b) - =/ s2 :(pro.p y.b z.a z.a z.a) + =/ fop field-p + =+ [fadd fsub fmul fpow]=[sum.fop dif.fop pro.fop exp.fop] + =/ u1 :(fmul x.a z.b z.b) + =/ u2 :(fmul x.b z.a z.a) + =/ s1 :(fmul y.a z.b z.b z.b) + =/ s2 :(fmul y.b z.a z.a z.a) ?: =(u1 u2) ?. =(s1 s2) [0 0 1] - (dub a) - =/ h (dif.p u2 u1) - =/ r (dif.p s2 s1) - =/ h2 (pro.p h h) - =/ h3 (pro.p h2 h) - =/ u1h2 (pro.p u1 h2) - =/ nx (dif.p (pro.p r r) :(sum.p h3 u1h2 u1h2)) - =/ ny (dif.p (pro.p r (dif.p u1h2 nx)) (pro.p s1 h3)) - =/ nz :(pro.p h z.a z.b) + (double a) + =/ h (fsub u2 u1) + =/ r (fsub s2 s1) + =/ h2 (fmul h h) + =/ h3 (fmul h2 h) + =/ u1h2 (fmul u1 h2) + =/ nx %+ fsub + (fmul r r) + :(fadd h3 u1h2 u1h2) + =/ ny %+ fsub + (fmul r (fsub u1h2 nx)) + (fmul s1 h3) + =/ nz :(fmul h z.a z.b) [nx ny nz] :: - ++ dub :: double - |= a=jaco - ^- jaco - ?: =(0 y.a) - [0 0 0] - =/ ysq (pro.p y.a y.a) - =/ s :(pro.p 4 x.a ysq) - =/ m :(pro.p 3 x.a x.a) :: omits A=0 - =/ nx (dif.p (pro.p m m) (sum.p s s)) - =/ ny (dif.p (pro.p m (dif.p s nx)) :(pro.p 8 ysq ysq)) - =/ nz :(pro.p 2 y.a z.a) - [nx ny nz] - :: - ++ mul :: jaco x scalar - |= [a=jaco n=@] - ^- jaco + ++ mul + |= [a=jacobian scalar=@] + ^- jacobian ?: =(0 y.a) [0 0 1] - ?: =(0 n) + ?: =(0 scalar) [0 0 1] - ?: =(1 n) + ?: =(1 scalar) a - ?: (gte n ^^n) - $(n (mod n ^^n)) - ?: =(0 (mod n 2)) - (dub $(n (div n 2))) - (add a (dub $(n (div n 2)))) - :: - ++ from :: jaco -> point - |= a=jaco - ^- pont - =/ z (inv.p z.a) - [:(pro.p x.a z z) :(pro.p y.a z z z)] - :: - ++ into :: point -> jaco - |= pont - ^- jaco - [x y z=1] + ?: (gte scalar n.domain) + $(scalar (mod scalar n.domain)) + ?: =(0 (mod scalar 2)) + (double $(scalar (rsh 0 1 scalar))) + (add a (double $(scalar (rsh 0 1 scalar)))) -- + ++ add-points + |= [a=point b=point] + ^- point + =/ j jc + (from.j (add.j (into.j a) (into.j b))) + ++ mul-point-scalar + |= [p=point scalar=@] + ^- point + =/ j jc + %- from.j + %+ mul.j + (into.j p) + scalar + :: + ++ valid-hash + |= has=@ + (lte (met 3 has) bytes) + :: + ++ in-order + |= i=@ + ?& (gth i 0) + (lth i n.domain) + == + ++ priv-to-pub + |= private-key=@ + ^- point + ?> (in-order private-key) + (mul-point-scalar g.domain private-key) + :: + ++ make-k + |= [hash=@ private-key=@] + ^- @ + ?> (in-order private-key) + ?> (valid-hash hash) + =/ v (fil 3 bytes 1) + =/ k 0 + =. k %+ hmc [bytes k] + %- as-octs + %+ can 3 + :~ [bytes hash] + [bytes private-key] + [1 0] + [bytes v] + == + =. v (hmc bytes^k bytes^v) + =. k %+ hmc [bytes k] + %- as-octs + %+ can 3 + :~ [bytes hash] + [bytes private-key] + [1 1] + [bytes v] + == + =. v (hmc bytes^k bytes^v) + (hmc bytes^k bytes^v) + :: + ++ ecdsa-raw-sign + |= [hash=@ private-key=@] + ^- [r=@ s=@ y=@] + :: make-k and priv-to pub will validate inputs + =/ k (make-k hash private-key) + =/ rp (priv-to-pub k) + =* r x.rp + ?< =(0 r) + =/ fon field-n + =+ [fadd fmul finv]=[sum.fon pro.fon inv.fon] + =/ s %+ fmul (finv k) + %+ fadd hash + %+ fmul r + private-key + ?< =(0 s) + [r s y.rp] + :: general recovery omitted, but possible + -- + ++ secp256k1 + ~% %secp256k1 + ~ + |% + ++ t :: in the battery for jet matching + ^- domain + :* 0xffff.ffff.ffff.ffff.ffff.ffff.ffff.ffff. + ffff.ffff.ffff.ffff.ffff.fffe.ffff.fc2f + 0 + 7 + :- 0x79be.667e.f9dc.bbac.55a0.6295.ce87.0b07. + 029b.fcdb.2dce.28d9.59f2.815b.16f8.1798 + 0x483a.da77.26a3.c465.5da4.fbfc.0e11.08a8. + fd17.b448.a685.5419.9c47.d08f.fb10.d4b8 + 0xffff.ffff.ffff.ffff.ffff.ffff.ffff.fffe. + baae.dce6.af48.a03b.bfd2.5e8c.d036.4141 + == + :: + ++ curve ~(. secp 32 t) + ++ serialize-point serialize-point:curve + ++ compress-point compress-point:curve + ++ decompress-point decompress-point:curve + ++ add-points add-points:curve + ++ mul-point-scalar mul-point-scalar:curve + ++ make-k + ~/ %make + |= [hash=@uvI private-key=@] + :: checks sizes + (make-k:curve hash private-key) + ++ priv-to-pub + |= private-key=@ + :: checks sizes + (priv-to-pub:curve private-key) + :: + ++ ecdsa-raw-sign + ~/ %sign + |= [hash=@uvI private-key=@] + ^- [v=@ r=@ s=@] + =/ c curve + :: raw-sign checks sizes + =+ (ecdsa-raw-sign.c hash private-key) + =/ rp=point [r y] + =/ s-high (gte (mul 2 s) n.domain.c) + =? s s-high + (sub n.domain.c s) + =? rp s-high + [x.rp (sub p.domain.c y.rp)] + =/ v (end 0 1 y.rp) + =? v (gte x.rp n.domain.c) + (add v 2) + [v x.rp s] + :: + ++ ecdsa-raw-recover + ~/ %reco + |= [hash=@ sig=[v=@ r=@ s=@]] + ^- point + ?> (lte v.sig 3) + =/ c curve + ?> (valid-hash.c hash) + ?> (in-order.c r.sig) + ?> (in-order.c s.sig) + =/ x ?: (gte v.sig 2) + (add r.sig n.domain.c) + r.sig + =/ fop field-p.c + =+ [fadd fmul fpow]=[sum.fop pro.fop exp.fop] + =/ ysq (fadd (fpow 3 x) b.domain.c) + =/ beta (fpow (rsh 0 2 +(p.domain.c)) ysq) + =/ y ?: =((end 0 1 v.sig) (end 0 1 beta)) + beta + (sub p.domain.c beta) + ?> =(0 (dif.fop ysq (fmul y y))) + =/ nz (sub n.domain.c hash) + =/ j jc.c + =/ gz (mul.j (into.j g.domain.c) nz) + =/ xy (mul.j (into.j x y) s.sig) + =/ qr (add.j gz xy) + =/ qj (mul.j qr (inv:field-n.c x)) + =/ pub (from.j qj) + ?< =([0 0] pub) + pub -- -- :: @@ -4593,7 +4696,7 @@ :: :: structures :: - += argon-type ?(%d %i %id %u) + +$ argon-type ?(%d %i %id %u) :: :: shorthands :: @@ -5324,7 +5427,7 @@ |% :: :: ++drop-list:unity ++ drop-list :: collapse unit list - |* lut/(list (unit)) + |* lut=(list (unit)) ?. |- ^- ? ?~(lut & ?~(i.lut | $(lut t.lut))) ~ @@ -5334,8 +5437,8 @@ [i=u:+.i.lut t=$(lut t.lut)] :: :: ++drop-map:unity ++ drop-map :: collapse unit map - |* lum/(map term (unit)) - ?: (~(rep by lum) |=({{@ a/(unit)} b/_|} |(b ?=(~ a)))) + |* lum=(map term (unit)) + ?: (~(rep by lum) |=([[@ a=(unit)] b=_|] |(b ?=(~ a)))) ~ (some (~(run by lum) need)) :: :: ++drop-pole:unity @@ -5392,26 +5495,26 @@ (rap 3 (join '\0a' tez)) :: :: ++of-wall:format ++ of-wall :: line list to tape - |= a/wall ^- tape + |= a=wall ^- tape ?~(a ~ "{i.a}\0a{$(a t.a)}") :: :: ++en-beam:format ++ en-beam :: beam to path - |= bem/beam + |= bem=beam ^- path - [(scot %p p.bem) q.bem (scot r.bem) (flop s.bem)] + [(scot %p p.bem) q.bem (scot r.bem) s.bem] :: :: ++de-beam:format ++ de-beam :: parse path to beam - |= pax/path + |= pax=path ^- (unit beam) - ?. ?=({* * * *} pax) ~ + ?. ?=([* * * *] pax) ~ %+ biff (slaw %p i.pax) - |= who/ship + |= who=ship %+ biff (slaw %tas i.t.pax) - |= dex/desk + |= dex=desk %+ biff (slay i.t.t.pax) - |= cis/coin - ?. ?=({$$ case} cis) ~ - `(unit beam)`[~ [who dex `case`p.cis] (flop t.t.t.pax)] + |= cis=coin + ?. ?=([%$ case] cis) ~ + `(unit beam)`[~ [who dex `case`p.cis] t.t.t.pax] :: ++ json-rn :: json to rn parser %+ knee *rn |. @@ -5450,32 +5553,32 @@ |% :: :: ++frond:enjs:format ++ frond :: object from k-v pair - |= {p/@t q/json} + |= [p=@t q=json] ^- json [%o [[p q] ~ ~]] :: :: ++pairs:enjs:format ++ pairs :: object from k-v list - |= a/(list {p/@t q/json}) + |= a=(list [p=@t q=json]) ^- json [%o (~(gas by *(map @t json)) a)] :: :: ++tape:enjs:format ++ tape :: string from tape - |= a/^tape + |= a=^tape ^- json [%s (crip a)] :: :: ++wall:enjs:format ++ wall :: string from wall - |= a/^wall + |= a=^wall ^- json (tape (of-wall a)) :: :: ++ship:enjs:format ++ ship :: string from ship - |= a/^ship + |= a=^ship ^- json (tape (slag 1 (scow %p a))) :: :: ++numb:enjs:format ++ numb :: number from unsigned - |= a/@u + |= a=@u ^- json :- %n ?: =(0 a) '0' @@ -5485,7 +5588,7 @@ ?:(=(0 a) ~ [(add '0' (mod a 10)) $(a (div a 10))]) :: :: ++time:enjs:format ++ time :: ms timestamp - |= a/^time + |= a=^time =- (numb (div (mul - 1.000) ~s1)) (add (div ~s1 2.000) (sub a ~1970.1.1)) :: :: ++path:enjs:format @@ -5507,9 +5610,9 @@ |% :: :: ++ar:dejs:format ++ ar :: array as list - |* wit/fist - |= jon/json ^- (list _(wit *json)) - ?> ?=({$a *} jon) + |* wit=fist + |= jon=json ^- (list _(wit *json)) + ?> ?=([%a *] jon) (turn p.jon wit) :: :: ++as:dejs:format ++ as :: array as set @@ -5517,72 +5620,72 @@ (cu ~(gas in *(set _$:a)) (ar a)) :: :: ++at:dejs:format ++ at :: array as tuple - |* wil/(pole fist) - |= jon/json - ?> ?=({$a *} jon) + |* wil=(pole fist) + |= jon=json + ?> ?=([%a *] jon) ((at-raw wil) p.jon) :: :: ++at-raw:dejs:format ++ at-raw :: array as tuple - |* wil/(pole fist) - |= jol/(list json) + |* wil=(pole fist) + |= jol=(list json) ?~ jol !! ?- wil :: mint-vain on empty - :: {wit/* t/*} - {* t/*} + :: [wit=* t=*] + [* t=*] => .(wil [wit *]=wil) ?~ t.wil ?^(t.jol !! (wit.wil i.jol)) [(wit.wil i.jol) ((at-raw t.wil) t.jol)] == :: :: ++bo:dejs:format ++ bo :: boolean - |=(jon/json ?>(?=({$b *} jon) p.jon)) + |=(jon=json ?>(?=([%b *] jon) p.jon)) :: :: ++bu:dejs:format ++ bu :: boolean not - |=(jon/json ?>(?=({$b *} jon) !p.jon)) + |=(jon=json ?>(?=([%b *] jon) !p.jon)) :: :: ++ci:dejs:format ++ ci :: maybe transform - |* {poq/gate wit/fist} - |= jon/json + |* [poq=gate wit=fist] + |= jon=json (need (poq (wit jon))) :: :: ++cu:dejs:format ++ cu :: transform - |* {poq/gate wit/fist} - |= jon/json + |* [poq=gate wit=fist] + |= jon=json (poq (wit jon)) :: :: ++di:dejs:format ++ di :: millisecond date %+ cu - |= a/@u ^- @da + |= a=@u ^- @da (add ~1970.1.1 (div (mul ~s1 a) 1.000)) ni :: :: ++mu:dejs:format ++ mu :: true unit - |* wit/fist - |= jon/json + |* wit=fist + |= jon=json ?~(jon ~ (some (wit jon))) :: :: ++ne:dejs:format ++ ne :: number as real - |= jon/json + |= jon=json ^- @rd ?> ?=([%n *] jon) (rash p.jon (cook ryld (cook royl-cell:^so json-rn))) :: :: ++ni:dejs:format ++ ni :: number as integer - |= jon/json - ?> ?=({$n *} jon) + |= jon=json + ?> ?=([%n *] jon) (rash p.jon dem) :: :: ++no:dejs:format ++ no :: number as cord - |=(jon/json ?>(?=({$n *} jon) p.jon)) + |=(jon=json ?>(?=([%n *] jon) p.jon)) :: :: ++of:dejs:format ++ of :: object as frond - |* wer/(pole {cord fist}) - |= jon/json - ?> ?=({$o {@ *} $~ $~} jon) + |* wer=(pole [cord fist]) + |= jon=json + ?> ?=([%o [@ *] ~ ~] jon) |- ?- wer :: mint-vain on empty - :: {{key/@t wit/*} t/*} - {{key/@t *} t/*} + :: [[key=@t wit=*] t=*] + [[key=@t *] t=*] => .(wer [[* wit] *]=wer) ?: =(key.wer p.n.p.jon) [key.wer ~|(key+key.wer (wit.wer q.n.p.jon))] @@ -5591,52 +5694,52 @@ == :: :: ++ot:dejs:format ++ ot :: object as tuple - |* wer/(pole {cord fist}) - |= jon/json - ?> ?=({$o *} jon) + |* wer=(pole [cord fist]) + |= jon=json + ?> ?=([%o *] jon) ((ot-raw wer) p.jon) :: :: ++ot-raw:dejs:format ++ ot-raw :: object as tuple - |* wer/(pole {cord fist}) - |= jom/(map @t json) + |* wer=(pole [cord fist]) + |= jom=(map @t json) ?- wer :: mint-vain on empty - :: {{key/@t wit/*} t/*} - {{key/@t *} t/*} + :: [[key=@t wit=*] t=*] + [[key=@t *] t=*] => .(wer [[* wit] *]=wer) =/ ten ~|(key+key.wer (wit.wer (~(got by jom) key.wer))) ?~(t.wer ten [ten ((ot-raw t.wer) jom)]) == :: ++ ou :: object of units - |* wer/(pole {cord fist}) - |= jon/json - ?> ?=({$o *} jon) + |* wer=(pole [cord fist]) + |= jon=json + ?> ?=([%o *] jon) ((ou-raw wer) p.jon) :: :: ++ou-raw:dejs:format ++ ou-raw :: object of units - |* wer/(pole {cord fist}) - |= jom/(map @t json) + |* wer=(pole [cord fist]) + |= jom=(map @t json) ?- wer :: mint-vain on empty - :: {{key/@t wit/*} t/*} - {{key/@t *} t/*} + :: [[key=@t wit=*] t=*] + [[key=@t *] t=*] => .(wer [[* wit] *]=wer) =/ ten ~|(key+key.wer (wit.wer (~(get by jom) key.wer))) ?~(t.wer ten [ten ((ou-raw t.wer) jom)]) == :: :: ++om:dejs:format ++ om :: object as map - |* wit/fist - |= jon/json - ?> ?=({$o *} jon) + |* wit=fist + |= jon=json + ?> ?=([%o *] jon) (~(run by p.jon) wit) :: :: ++op:dejs:format ++ op :: parse keys of map - |* {fel/rule wit/fist} - |= jon/json ^- (map _(wonk *fel) _*wit) + |* [fel=rule wit=fist] + |= jon=json ^- (map _(wonk *fel) _*wit) =/ jom ((om wit) jon) %- malt %+ turn ~(tap by jom) - |* {a/cord b/*} + |* [a=cord b=*] => .(+< [a b]=+<) [(rash a fel) b] :: :: ++pa:dejs:format @@ -5644,11 +5747,11 @@ (su ;~(pfix fas (more fas urs:ab))) :: :: ++pe:dejs:format ++ pe :: prefix - |* {pre/* wit/fist} + |* [pre=* wit=fist] (cu |*(* [pre +<]) wit) :: :: ++sa:dejs:format ++ sa :: string as tape - |=(jon/json ?>(?=({$s *} jon) (trip p.jon))) + |=(jon=json ?>(?=([%s *] jon) (trip p.jon))) :: :: ++se:dejs:format ++ se :: string as aura |= aur=@tas @@ -5656,35 +5759,35 @@ ?>(?=([%s *] jon) (slav aur p.jon)) :: :: ++so:dejs:format ++ so :: string as cord - |=(jon/json ?>(?=({$s *} jon) p.jon)) + |=(jon=json ?>(?=([%s *] jon) p.jon)) :: :: ++su:dejs:format ++ su :: parse string - |* sab/rule - |= jon/json ^+ (wonk *sab) - ?> ?=({$s *} jon) + |* sab=rule + |= jon=json ^+ (wonk *sab) + ?> ?=([%s *] jon) (rash p.jon sab) :: :: ++uf:dejs:format ++ uf :: unit fall - |* [def/* wit/fist] - |= jon/(unit json) + |* [def=* wit=fist] + |= jon=(unit json) ?~(jon def (wit u.jon)) :: :: ++un:dejs:format ++ un :: unit need - |* wit/fist - |= jon/(unit json) + |* wit=fist + |= jon=(unit json) (wit (need jon)) :: :: ++ul:dejs:format ++ ul :: null - |=(jon/json ?~(jon ~ !!)) + |=(jon=json ?~(jon ~ !!)) :: ++ za :: full unit pole - |* pod/(pole (unit)) + |* pod=(pole (unit)) ?~ pod & ?~ -.pod | (za +.pod) :: ++ zl :: collapse unit list - |* lut/(list (unit)) + |* lut=(list (unit)) ?. |- ^- ? ?~(lut & ?~(i.lut | $(lut t.lut))) ~ @@ -5694,15 +5797,15 @@ [i=u:+.i.lut t=$(lut t.lut)] :: ++ zp :: unit tuple - |* but/(pole (unit)) + |* but=(pole (unit)) ?~ but !! ?~ +.but u:->.but [u:->.but (zp +.but)] :: ++ zm :: collapse unit map - |* lum/(map term (unit)) - ?: (~(rep by lum) |=({{@ a/(unit)} b/_|} |(b ?=(~ a)))) + |* lum=(map term (unit)) + ?: (~(rep by lum) |=([[@ a=(unit)] b=_|] |(b ?=(~ a)))) ~ (some (~(run by lum) need)) -- ::dejs @@ -5719,81 +5822,81 @@ :: |% ++ ar :: array as list - |* wit/fist - |= jon/json - ?. ?=({$a *} jon) ~ + |* wit=fist + |= jon=json + ?. ?=([%a *] jon) ~ %- zl |- ?~ p.jon ~ [i=(wit i.p.jon) t=$(p.jon t.p.jon)] :: ++ at :: array as tuple - |* wil/(pole fist) - |= jon/json - ?. ?=({$a *} jon) ~ + |* wil=(pole fist) + |= jon=json + ?. ?=([%a *] jon) ~ ?. =((lent wil) (lent p.jon)) ~ =+ raw=((at-raw wil) p.jon) ?.((za raw) ~ (some (zp raw))) :: ++ at-raw :: array as tuple - |* wil/(pole fist) - |= jol/(list json) + |* wil=(pole fist) + |= jol=(list json) ?~ wil ~ :- ?~(jol ~ (-.wil i.jol)) ((at-raw +.wil) ?~(jol ~ t.jol)) :: ++ bo :: boolean - |=(jon/json ?.(?=({$b *} jon) ~ [~ u=p.jon])) + |=(jon=json ?.(?=([%b *] jon) ~ [~ u=p.jon])) :: ++ bu :: boolean not - |=(jon/json ?.(?=({$b *} jon) ~ [~ u=!p.jon])) + |=(jon=json ?.(?=([%b *] jon) ~ [~ u=!p.jon])) :: ++ ci :: maybe transform - |* {poq/gate wit/fist} - |= jon/json + |* [poq=gate wit=fist] + |= jon=json (biff (wit jon) poq) :: ++ cu :: transform - |* {poq/gate wit/fist} - |= jon/json + |* [poq=gate wit=fist] + |= jon=json (bind (wit jon) poq) :: ++ da :: UTC date - |= jon/json - ?. ?=({$s *} jon) ~ - (bind (stud:chrono:userlib p.jon) |=(a/date (year a))) + |= jon=json + ?. ?=([%s *] jon) ~ + (bind (stud:chrono:userlib p.jon) |=(a=date (year a))) :: ++ di :: millisecond date %+ cu - |= a/@u ^- @da + |= a=@u ^- @da (add ~1970.1.1 (div (mul ~s1 a) 1.000)) ni :: ++ mu :: true unit - |* wit/fist - |= jon/json + |* wit=fist + |= jon=json ?~(jon (some ~) (bind (wit jon) some)) :: ++ ne :: number as real - |= jon/json + |= jon=json ^- (unit @rd) ?. ?=([%n *] jon) ~ (rush p.jon (cook ryld (cook royl-cell:^so json-rn))) :: ++ ni :: number as integer - |= jon/json - ?. ?=({$n *} jon) ~ + |= jon=json + ?. ?=([%n *] jon) ~ (rush p.jon dem) :: ++ no :: number as cord - |= jon/json - ?. ?=({$n *} jon) ~ + |= jon=json + ?. ?=([%n *] jon) ~ (some p.jon) :: ++ of :: object as frond - |* wer/(pole {cord fist}) - |= jon/json - ?. ?=({$o {@ *} ~ ~} jon) ~ + |* wer=(pole [cord fist]) + |= jon=json + ?. ?=([%o [@ *] ~ ~] jon) ~ |- ?~ wer ~ ?: =(-.-.wer p.n.p.jon) @@ -5801,67 +5904,67 @@ ((of +.wer) jon) :: ++ ot :: object as tuple - |* wer/(pole {cord fist}) - |= jon/json - ?. ?=({$o *} jon) ~ + |* wer=(pole [cord fist]) + |= jon=json + ?. ?=([%o *] jon) ~ =+ raw=((ot-raw wer) p.jon) ?.((za raw) ~ (some (zp raw))) :: ++ ot-raw :: object as tuple - |* wer/(pole {cord fist}) - |= jom/(map @t json) + |* wer=(pole [cord fist]) + |= jom=(map @t json) ?~ wer ~ =+ ten=(~(get by jom) -.-.wer) [?~(ten ~ (+.-.wer u.ten)) ((ot-raw +.wer) jom)] :: ++ om :: object as map - |* wit/fist - |= jon/json - ?. ?=({$o *} jon) ~ + |* wit=fist + |= jon=json + ?. ?=([%o *] jon) ~ (zm (~(run by p.jon) wit)) :: ++ op :: parse keys of map - |* {fel/rule wit/fist} + |* [fel=rule wit=fist] %+ cu - |= a/(list (pair _(wonk *fel) _(need *wit))) + |= a=(list (pair _(wonk *fel) _(need *wit))) (my:nl a) %- ci :_ (om wit) - |= a/(map cord _(need *wit)) + |= a=(map cord _(need *wit)) ^- (unit (list _[(wonk *fel) (need *wit)])) %- zl %+ turn ~(tap by a) - |= {a/cord b/_(need *wit)} + |= [a=cord b=_(need *wit)] =+ nit=(rush a fel) ?~ nit ~ (some [u.nit b]) :: ++ pe :: prefix - |* {pre/* wit/fist} + |* [pre=* wit=fist] (cu |*(* [pre +<]) wit) :: ++ sa :: string as tape - |= jon/json - ?.(?=({$s *} jon) ~ (some (trip p.jon))) + |= jon=json + ?.(?=([%s *] jon) ~ (some (trip p.jon))) :: ++ so :: string as cord - |= jon/json - ?.(?=({$s *} jon) ~ (some p.jon)) + |= jon=json + ?.(?=([%s *] jon) ~ (some p.jon)) :: ++ su :: parse string - |* sab/rule - |= jon/json - ?. ?=({$s *} jon) ~ + |* sab=rule + |= jon=json + ?. ?=([%s *] jon) ~ (rush p.jon sab) :: - ++ ul |=(jon/json ?~(jon (some ~) ~)) :: null + ++ ul |=(jon=json ?~(jon (some ~) ~)) :: null ++ za :: full unit pole - |* pod/(pole (unit)) + |* pod=(pole (unit)) ?~ pod & ?~ -.pod | (za +.pod) :: ++ zl :: collapse unit list - |* lut/(list (unit)) + |* lut=(list (unit)) ?. |- ^- ? ?~(lut & ?~(i.lut | $(lut t.lut))) ~ @@ -5871,15 +5974,15 @@ [i=u:+.i.lut t=$(lut t.lut)] :: ++ zp :: unit tuple - |* but/(pole (unit)) + |* but=(pole (unit)) ?~ but !! ?~ +.but u:->.but [u:->.but (zp +.but)] :: ++ zm :: collapse unit map - |* lum/(map term (unit)) - ?: (~(rep by lum) |=({{@ a/(unit)} b/_|} |(b ?=(~ a)))) + |* lum=(map term (unit)) + ?: (~(rep by lum) |=([[@ a=(unit)] b=_|] |(b ?=(~ a)))) ~ (some (~(run by lum) need)) -- ::dejs-soft @@ -5893,7 +5996,7 @@ |% :: :: ++berk:differ ++ berk :: invert diff patch - |* bur/(urge) + |* bur=(urge) |- ^+ bur ?~ bur ~ :_ $(bur t.bur) @@ -5904,7 +6007,7 @@ :: :: ++loss:differ ++ loss :: longest subsequence ~% %loss ..is ~ - |* {hel/(list) hev/(list)} + |* [hel=(list) hev=(list)] |- ^+ hev =+ ^= sev =+ [inx=0 sev=*(map _i.-.hev (list @ud))] @@ -5916,7 +6019,7 @@ inx +(inx) sev (~(put by sev) i.hev [inx ?~(guy ~ u.guy)]) == - =| gox/{p/@ud q/(map @ud {p/@ud q/_hev})} + =| gox=[p=@ud q=(map @ud [p=@ud q=_hev])] =< abet =< main |% @@ -5927,19 +6030,19 @@ (flop q:(need (~(get by q.gox) (dec p.gox)))) :: :: ++hink:loss:differ ++ hink :: extend fits top - |= {inx/@ud goy/@ud} ^- ? + |= [inx=@ud goy=@ud] ^- ? ?| =(p.gox inx) (lth goy p:(need (~(get by q.gox) inx))) == :: :: ++lonk:loss:differ ++ lonk :: extend fits bottom - |= {inx/@ud goy/@ud} ^- ? + |= [inx=@ud goy=@ud] ^- ? ?| =(0 inx) (gth goy p:(need (~(get by q.gox) (dec inx)))) == :: :: ++luna:loss:differ ++ luna :: extend - |= {inx/@ud goy/@ud} + |= [inx=@ud goy=@ud] ^+ +> %_ +>.$ gox @@ -5951,10 +6054,10 @@ == :: :: ++merg:loss:differ ++ merg :: merge all matches - |= gay/(list @ud) + |= gay=(list @ud) ^+ +> =+ ^= zes - =+ [inx=0 zes=*(list {p/@ud q/@ud})] + =+ [inx=0 zes=*(list [p=@ud q=@ud])] |- ^+ zes ?: |(?=(~ gay) (gth inx p.gox)) zes ?. (lonk inx i.gay) $(gay t.gay) @@ -5972,7 +6075,7 @@ -- :: :: :: ++lurk:differ ++ lurk :: apply list patch - |* {hel/(list) rug/(urge)} + |* [hel=(list) rug=(urge)] ^+ hel =+ war=`_hel`~ |- ^+ hel @@ -5997,9 +6100,9 @@ == :: :: ++lusk:differ ++ lusk :: lcs to list patch - |* {hel/(list) hev/(list) lcs/(list)} + |* [hel=(list) hev=(list) lcs=(list)] =+ ^= rag - ^- {$%({%& p/@ud} {%| p/_lcs q/_lcs})} + ^- [$%([%& p=@ud] [%| p=_lcs q=_lcs])] [%& 0] => .(rag [p=rag q=*(list _rag)]) =< abet =< main @@ -6010,7 +6113,7 @@ (flop q.rag) :: :: ++done:lusk:differ ++ done :: - |= new/_p.rag + |= new=_p.rag ^+ rag ?- -.p.rag %| ?- -.new @@ -6056,15 +6159,15 @@ |% :: :: ++as-octs:mimes:html ++ as-octs :: atom to octstream - |= tam/@ ^- octs + |= tam=@ ^- octs [(met 3 tam) tam] :: :: ++as-octt:mimes:html ++ as-octt :: tape to octstream - |= tep/tape ^- octs + |= tep=tape ^- octs (as-octs (rap 3 tep)) :: :: ++en-mite:mimes:html ++ en-mite :: mime type to text - |= myn/mite + |= myn=mite %- crip |- ^- tape ?~ myn ~ @@ -6094,7 +6197,7 @@ -- :: :: ++en-base64:mimes: ++ en-base64 :: encode base64 - |= tig/@ + |= tig=@ ^- tape =+ poc=(~(dif fo 3) 0 (met 3 tig)) =+ pad=(lsh 3 poc (swp 3 tig)) @@ -6109,14 +6212,14 @@ (weld (flop (slag poc sif)) (reap poc '=')) :: :: ++de-base64:mimes: ++ de-base64 :: decode base64 - =- |=(a/cord (rash a fel)) - =< fel=(cook |~(a/@ `@t`(swp 3 a)) (bass 64 .)) + =- |=(a=cord (rash a fel)) + =< fel=(cook |~(a=@ `@t`(swp 3 a)) (bass 64 .)) =- (cook welp ;~(plug (plus siw) (stun 0^2 (cold %0 tis)))) ^= siw ;~ pose - (cook |=(a/@ (sub a 'A')) (shim 'A' 'Z')) - (cook |=(a/@ (sub a 'G')) (shim 'a' 'z')) - (cook |=(a/@ (add a 4)) (shim '0' '9')) + (cook |=(a=@ (sub a 'A')) (shim 'A' 'Z')) + (cook |=(a=@ (sub a 'G')) (shim 'a' 'z')) + (cook |=(a=@ (add a 4)) (shim '0' '9')) (cold 62 (just '+')) (cold 63 (just '/')) == @@ -6145,14 +6248,14 @@ -- ::mimes :: :: ++en-json:html ++ en-json :: print json - |^ |=(val/json (apex val "")) + |^ |=(val=json (apex val "")) :: :: ++apex:en-json:html ++ apex - |= {val/json rez/tape} + |= [val=json rez=tape] ^- tape ?~ val (weld "null" rez) ?- -.val - $a + %a :- '[' =. rez [']' rez] !. @@ -6161,9 +6264,9 @@ ?~ t.p.val ^$(val i.p.val) ^$(val i.p.val, rez [',' $(p.val t.p.val)]) :: - $b (weld ?:(p.val "true" "false") rez) - $n (weld (trip p.val) rez) - $s + %b (weld ?:(p.val "true" "false") rez) + %n (weld (trip p.val) rez) + %s :- '"' =. rez ['"' rez] =+ viz=(trip p.val) @@ -6171,11 +6274,11 @@ |- ^- tape ?~ viz rez =+ hed=(jesc i.viz) - ?: ?=({@ ~} hed) + ?: ?=([@ ~] hed) [i.hed $(viz t.viz)] (weld hed $(viz t.viz)) :: - $o + %o :- '{' =. rez ['}' rez] =+ viz=~(tap by p.val) @@ -6188,17 +6291,17 @@ == :: :: ++jesc:en-json:html ++ jesc :: escaped - =+ utf=|=(a/@ ['\\' 'u' ((x-co 4):co a)]) - |= a/@ ^- tape + =+ utf=|=(a=@ ['\\' 'u' ((x-co 4):co a)]) + |= a=@ ^- tape ?+ a ?:((gth a 0x1f) [a ~] (utf a)) - $10 "\\n" - $34 "\\\"" - $92 "\\\\" + %10 "\\n" + %34 "\\\"" + %92 "\\\\" == -- ::en-json :: :: ++de-json:html ++ de-json :: parse JSON - =< |=(a/cord `(unit json)`(rush a apex)) + =< |=(a=cord `(unit json)`(rush a apex)) |% :: :: ++abox:de-json:html ++ abox :: array @@ -6212,7 +6315,7 @@ (cold ~ (jest 'null')) (stag %b bool) (stag %s stri) - (cook |=(s/tape [%n p=(rap 3 s)]) numb) + (cook |=(s=tape [%n p=(rap 3 s)]) numb) abox obox == @@ -6252,7 +6355,7 @@ ;~(pose ;~(less doq bas prn) esca) :: :: ++mayb:de-json:html ++ mayb :: optional - |*(bus/rule ;~(pose bus (easy ~))) + |*(bus=rule ;~(pose bus (easy ~))) :: :: ++numb:de-json:html ++ numb :: number ;~ (comp twel) @@ -6276,8 +6379,8 @@ ;~(plug ;~(sfix (wish stri) (wish col)) apex) :: :: ++piec:de-json:html ++ piec :: listify - |* bus/rule - (cook |=(a/@ [a ~]) bus) + |* bus=rule + (cook |=(a=@ [a ~]) bus) :: :: ++stri:de-json:html ++ stri :: string (cook crip (ifix [doq doq] (star jcha))) @@ -6289,20 +6392,20 @@ (star (mask [`@`9 `@`10 `@`13 ' ' ~])) :: :: ++twel:de-json:html ++ twel :: tape weld - |=({a/tape b/tape} (weld a b)) + |=([a=tape b=tape] (weld a b)) :: :: ++wish:de-json:html ++ wish :: with whitespace - |*(sef/rule ;~(pfix spac sef)) + |*(sef=rule ;~(pfix spac sef)) -- ::de-json :: :: ++en-xml:html ++ en-xml :: xml printer - =< |=(a/manx `tape`(apex a ~)) + =< |=(a=manx `tape`(apex a ~)) |_ _[unq=`?`| cot=`?`|] :: :: ++apex:en-xml:html ++ apex :: top level - |= {mex/manx rez/tape} + |= [mex=manx rez=tape] ^- tape - ?: ?=({$$ {{$$ *} ~}} g.mex) + ?: ?=([%$ [[%$ *] ~]] g.mex) (escp v.i.a.g.mex rez) =+ man=`mane`n.g.mex =. unq |(unq =(%script man) =(%style man)) @@ -6311,14 +6414,14 @@ :- '<' %+ welp tam =- ?~(att rez [' ' (attr att rez)]) - ^- rez/tape + ^- rez=tape ?: &(?=(~ c.mex) |(cot ?^(man | (clot man)))) [' ' '/' '>' rez] :- '>' (many c.mex :(weld "" rez)) :: :: ++attr:en-xml:html ++ attr :: attributes to tape - |= {tat/mart rez/tape} + |= [tat=mart rez=tape] ^- tape ?~ tat rez =. rez $(tat t.tat) @@ -6329,7 +6432,7 @@ == :: :: ++escp:en-xml:html ++ escp :: escape for xml - |= {tex/tape rez/tape} + |= [tex=tape rez=tape] ?: unq (weld tex rez) =+ xet=`tape`(flop tex) @@ -6339,23 +6442,23 @@ %= $ xet t.xet rez ?- i.xet - $34 ['&' 'q' 'u' 'o' 't' ';' rez] - $38 ['&' 'a' 'm' 'p' ';' rez] - $39 ['&' '#' '3' '9' ';' rez] - $60 ['&' 'l' 't' ';' rez] - $62 ['&' 'g' 't' ';' rez] + %34 ['&' 'q' 'u' 'o' 't' ';' rez] + %38 ['&' 'a' 'm' 'p' ';' rez] + %39 ['&' '#' '3' '9' ';' rez] + %60 ['&' 'l' 't' ';' rez] + %62 ['&' 'g' 't' ';' rez] * [i.xet rez] == == :: :: ++many:en-xml:html ++ many :: nodelist to tape - |= {lix/(list manx) rez/tape} + |= [lix=(list manx) rez=tape] |- ^- tape ?~ lix rez (apex i.lix $(lix t.lix)) :: :: ++name:en-xml:html ++ name :: name to tape - |= man/mane ^- tape + |= man=mane ^- tape ?@ man (trip man) (weld (trip -.man) `tape`[':' (trip +.man)]) :: :: ++clot:en-xml:html @@ -6368,16 +6471,16 @@ -- ::en-xml :: :: ++de-xml:html ++ de-xml :: xml parser - =< |=(a/cord (rush a apex)) - |_ ent/_`(map term @t)`[[%apos '\''] ~ ~] + =< |=(a=cord (rush a apex)) + |_ ent=_`(map term @t)`[[%apos '\''] ~ ~] :: :: ++apex:de-xml:html ++ apex :: top level =+ spa=;~(pose comt whit) %+ knee *manx |. ~+ - %+ ifix + %+ ifix [;~(plug (punt decl) (star spa)) (star spa)] ;~ pose - %+ sear |=({a/marx b/marl c/mane} ?.(=(c n.a) ~ (some [a b]))) + %+ sear |=([a=marx b=marl c=mane] ?.(=(c n.a) ~ (some [a b]))) ;~(plug head many tail) empt == @@ -6404,14 +6507,14 @@ :: :: ++cdat:de-xml:html ++ cdat :: CDATA section %+ cook - |=(a/tape ^-(mars ;/(a))) + |=(a=tape ^-(mars ;/(a))) %+ ifix [(jest '')] %- star ;~(less (jest ']]>') next) :: :: ++chrd:de-xml:html ++ chrd :: character data - %+ cook |=(a/tape ^-(mars ;/(a))) + %+ cook |=(a=tape ^-(mars ;/(a))) (plus ;~(less doq ;~(pose (just `@`10) escp))) :: :: ++comt:de-xml:html ++ comt :: comments @@ -6437,7 +6540,7 @@ =+ def=^+(ent (my:nl [%gt '>'] [%lt '<'] [%amp '&'] [%quot '"'] ~)) %+ sear ~(get by (~(uni by def) ent)) (cook crip ;~(plug alf (stun 1^31 aln))) - %+ cook |=(a/@c ?:((gth a 0x10.ffff) '�' (tuft a))) + %+ cook |=(a=@c ?:((gth a 0x10.ffff) '�' (tuft a))) =< ;~(pfix hax ;~(pose - +)) :- (bass 10 (stun 1^8 dit)) (bass 16 ;~(pfix (mask "xX") (stun 1^8 hit))) @@ -6470,12 +6573,12 @@ -- ::de-xml :: :: ++en-urlt:html ++ en-urlt :: url encode - |= tep/tape + |= tep=tape ^- tape %- zing %+ turn tep - |= tap/char - =+ xen=|=(tig/@ ?:((gte tig 10) (add tig 55) (add tig '0'))) + |= tap=char + =+ xen=|=(tig=@ ?:((gte tig 10) (add tig 55) (add tig '0'))) ?: ?| &((gte tap 'a') (lte tap 'z')) &((gte tap 'A') (lte tap 'Z')) &((gte tap '0') (lte tap '9')) @@ -6488,11 +6591,11 @@ ['%' (xen (rsh 0 4 tap)) (xen (end 0 4 tap)) ~] :: :: ++de-urlt:html ++ de-urlt :: url decode - |= tep/tape + |= tep=tape ^- (unit tape) ?~ tep [~ ~] ?: =('%' i.tep) - ?. ?=({@ @ *} t.tep) ~ + ?. ?=([@ @ *] t.tep) ~ =+ nag=(mix i.t.tep (lsh 3 1 i.t.t.tep)) =+ val=(rush nag hex:ag) ?~ val ~ @@ -6502,11 +6605,11 @@ ?~(nex ~ [~ i.tep u.nex]) :: :: ++en-purl:html ++ en-purl :: print purl - =< |=(pul/purl `tape`(apex %& pul)) + =< |=(pul=purl `tape`(apex %& pul)) |% :: :: ++apex:en-purl:html ++ apex :: - |= qur/quri ^- tape + |= qur=quri ^- tape ?- -.qur %& (weld (head p.p.qur) `tape`$(qur [%| +.p.qur])) %| ['/' (weld (body p.qur) (tail q.qur))] @@ -6517,7 +6620,7 @@ (weld (apex %& p) ?~(q "" `tape`['#' (trip u.q)])) :: :: ++body:en-purl:html ++ body :: - |= pok/pork ^- tape + |= pok=pork ^- tape ?~ q.pok ~ |- =+ seg=(en-urlt (trip i.q.pok)) @@ -6526,7 +6629,7 @@ (welp seg '/' $(q.pok t.q.pok)) :: :: ++head:en-purl:html ++ head :: - |= har/hart + |= har=hart ^- tape ;: weld ?:(&(p.har !?=(hoke r.har)) "https://" "http://") @@ -6543,7 +6646,7 @@ == :: :: ++tail:en-purl:html ++ tail :: - |= kay/quay + |= kay=quay ^- tape ?: =(~ kay) ~ :- '?' @@ -6557,27 +6660,27 @@ -- :: :: :: ++de-purl:html ++ de-purl :: url+header parser - =< |=(a/cord `(unit purl)`(rush a auri)) + =< |=(a=cord `(unit purl)`(rush a auri)) |% :: :: ++deft:de-purl:html ++ deft :: parse url extension - |= rax/(list @t) + |= rax=(list @t) |- ^- pork ?~ rax [~ ~] ?^ t.rax [p.pok [ire q.pok]]:[pok=$(rax t.rax) ire=i.rax] - =/ raf/(like term) + =/ raf=(like term) %- ;~ sfix %+ sear - |=(a/@ ((sand %ta) (crip (flop (trip a))))) - (cook |=(a/tape (rap 3 ^-((list @) a))) (star aln)) + |=(a=@ ((sand %ta) (crip (flop (trip a))))) + (cook |=(a=tape (rap 3 ^-((list @) a))) (star aln)) dot == [1^1 (flop (trip i.rax))] ?~ q.raf [~ [i.rax ~]] - =+ `{ext/term {@ @} fyl/tape}`u.q.raf + =+ `[ext=term [@ @] fyl=tape]`u.q.raf :- `ext ?:(=(~ fyl) ~ [(crip (flop fyl)) ~]) :: :: ++apat:de-purl:html @@ -6586,7 +6689,7 @@ ;~(pfix fas (more fas smeg)) :: :: ++aurf:de-purl:html ++ aurf :: 2396 with fragment - %+ cook |~(a/purf a) + %+ cook |~(a=purf a) ;~(plug auri (punt ;~(pfix hax (cook crip (star pque))))) :: :: ++auri:de-purl:html ++ auri :: 2396 URL @@ -6597,8 +6700,8 @@ :: :: ++auru:de-purl:html ++ auru :: 2396 with maybe user %+ cook - |= $: a/{p/? q/(unit user) r/{(unit @ud) host}} - b/{pork quay} + |= $: a=[p=? q=(unit user) r=[(unit @ud) host]] + b=[pork quay] == ^- (pair (unit user) purl) [q.a [[p.a r.a] b]] @@ -6618,9 +6721,9 @@ :: :: ++dlab:de-purl:html ++ dlab :: 2396 domainlabel %+ sear - |= a/@ta + |= a=@ta ?.(=('-' (rsh 3 (dec (met 3 a)) a)) [~ u=a] ~) - %+ cook |=(a/tape (crip (cass a))) + %+ cook |=(a=tape (crip (cass a))) ;~(plug aln (star alp)) :: :: ++fque:de-purl:html ++ fque :: normal query field @@ -6663,7 +6766,7 @@ == :: :: ++scem:de-purl:html ++ scem :: 2396 scheme - %+ cook |=(a/tape (crip (cass a))) + %+ cook |=(a=tape (crip (cass a))) ;~(plug alf (star ;~(pose aln lus hep dot))) :: :: ++smeg:de-purl:html ++ smeg :: 2396 segment @@ -6679,7 +6782,7 @@ (cook crip (plus ptok)) :: :: ++thor:de-purl:html ++ thor :: 2396 host+port - %+ cook |*({* *} [+<+ +<-]) + %+ cook |*([* *] [+<+ +<-]) ;~ plug thos ;~((bend) (easy ~) ;~(pfix col dim:ag)) @@ -6690,7 +6793,7 @@ ;~ pose %+ stag %& %+ sear :: LL parser weak here - |= a/(list @t) + |= a=(list @t) =+ b=(flop a) ?> ?=(^ b) =+ c=(end 3 1 i.b) @@ -6721,13 +6824,13 @@ :: funky query :: %+ cook - |=(a/tape [[%$ (crip a)] ~]) + |=(a=tape [[%$ (crip a)] ~]) (star pque) == :: :: ++zest:de-purl:html ++ zest :: 2616 request-uri ;~ pose - (stag %& (cook |=(a/purl a) auri)) + (stag %& (cook |=(a=purl a) auri)) (stag %| ;~(plug apat yque)) == -- ::de-purl @@ -6751,7 +6854,7 @@ :: MOVEME :: :: ++fuel:html ++ fuel :: parse urbit fcgi - |= {bem/beam ced/noun:cred quy/quer} + |= [bem=beam ced=noun:cred quy=quer] ^- epic =+ qix=|-(`quay`?~(quy quy [[p q]:quy $(quy t.quy)])) [(malt qix) ;;(cred ced) bem] @@ -6789,76 +6892,52 @@ :: :::: ++ wired ^? |% - :: - ++ auld :: ++auld:wired - |= sky/roof :: old style namespace - ^- slyt - |= {ref/* raw/*} - =+ pux=((soft path) raw) - ?~ pux ~ - ?. ?=({@ @ @ @ *} u.pux) ~ - =+ :* hyr=(slay i.u.pux) - fal=(slay i.t.u.pux) - dyc=(slay i.t.t.u.pux) - ved=(slay i.t.t.t.u.pux) - tyl=t.t.t.t.u.pux - == - ?. ?=({~ $$ $tas @} hyr) ~ - ?. ?=({~ $$ $p @} fal) ~ - ?. ?=({~ $$ $tas @} dyc) ~ - ?. ?=(^ ved) ~ - =+ ron=q.p.u.hyr - =+ bed=[[q.p.u.fal q.p.u.dyc (case p.u.ved)] (flop tyl)] - =+ bop=(sky ref ~ ron bed) - ?~ bop ~ - ?~ u.bop [~ ~] - [~ ~ +.q.u.u.bop] :: :: ++dray:wired ++ dray :: load tuple in path :: :: .= ~[p=~.ack q=~.~sarnel r=~..y] :: (dray ~[p=%tas q=%p r=%f] %ack ~sarnel &) :: - =- |* {a/{@tas (pole @tas)} b/*} ^- (paf a) + =- |* [a=[@tas (pole @tas)] b=*] ^- (paf a) => .(b `,(tup -.a +.a)`b) ?~ +.a [(scot -.a b) ~] [(scot -.a -.b) `,(paf +.a)`(..$ +.a +.b)] - :- paf=|*(a/(pole) ?~(a $~ {(odo:raid ,-.a(. %ta)) ,(..$ +.a)})) + :- paf=|*(a=(pole) ?~(a ,~ ,[(odo:raid ,-.a(. %ta)) ,(..$ +.a)])) ^= tup - |* {a/@tas b/(pole @tas)} + |* [a=@tas b=(pole @tas)] =+ c=(odo:raid a) - ?~(b c {c (..$ ,-.b ,+.b)}) + ?~(b c ,[c (..$ ,-.b ,+.b)]) :: :: ++raid:wired ++ raid :: demand path odors :: :: .= [p=%ack q=~sarnel r=&] :: (raid /ack/~sarnel+.y p=%tas q=%p r=%f ~) :: - =- |* {a/path b/{@tas (pole @tas)}} + =- |* [a=path b=[@tas (pole @tas)]] =* fog (odo -.b) ?~ +.b `fog`(slav -.b -.a) [`fog`(slav -.b -.a) (..$ +.a +.b)] ^= odo - |* a/@tas - |= b/* + |* a=@tas + |= b=* =- a(, (- b)) :: preserve face ?+ a @ - $c @c $da @da $dr @dr $f @f $if @if $is @is $p @p - $u @u $uc @uc $ub @ub $ui @ui $ux @ux $uv @uv $uw @uw - $s @s $t @t $ta @ta $tas @tas + %c @c %da @da %dr @dr %f @f %if @if %is @is %p @p + %u @u %uc @uc %ub @ub %ui @ui %ux @ux %uv @uv %uw @uw + %s @s %t @t %ta @ta %tas @tas == :: :: :: ++read:wired :: ++ read :: parse odored path -:: =< |*({a/path b/{@tas (pole @tas)}} ((+> b) a)) -:: |* b/{@tas (pole @tas)} -:: |= a/path +:: =< |*([a=path b=[@tas (pole @tas)]] ((+> b) a)) +:: |* b=[@tas (pole @tas)] +:: |= a=path :: ?~ a ~ :: =+ hed=(slaw -.b i.a) :: =* fog (odo:raid -.b) :: ?~ +.b :: ^- (unit fog) :: ?^(+.a ~ hed) -:: ^- (unit {fog _(need *(..^$ +.b))}) +:: ^- (unit [fog _(need *(..^$ +.b))]) :: (both hed ((..^$ +.b) +.a)) -- ::wired :: :: @@ -6896,17 +6975,17 @@ ^- ship =/ mir (clan who) ?- mir - $czar who - $king (end 3 1 who) - $duke (end 4 1 who) - $earl (end 5 1 who) - $pawn (end 4 1 who) + %czar who + %king (end 3 1 who) + %duke (end 4 1 who) + %earl (end 5 1 who) + %pawn (end 4 1 who) == -- |% :: :: ++cite:title ++ cite :: render ship - |= who/@p + |= who=@p ^- tape =+ kind=(clan who) =+ name=(scow %p who) @@ -6934,17 +7013,17 @@ |= [our=ship who=ship] ^- ? ?| =(our who) - &(?=($earl (clan who)) =(our (^sein who))) + &(?=(%earl (clan who)) =(our (^sein who))) == -- ::title :: :: :::: ++milly :: (2k) milliseconds :: :::: ++ milly ^| - |_ now/@da + |_ now=@da :: :: ++around:milly ++ around :: relative msec - |= wen/@da + |= wen=@da ^- @tas ?: =(wen now) %now ?: (gth wen now) @@ -6952,21 +7031,21 @@ (cat 3 '-' $(now wen, wen now)) :: ++ about :: ++about:milly - |= wun/(unit @da) :: unit relative msec + |= wun=(unit @da) :: unit relative msec ^- @tas ?~(wun %no (around u.wun)) :: :: ++mill:milly ++ mill :: msec diff - |= one/@dr + |= one=@dr ^- @tas ?: =(`@`0 one) '0ms' (cat 3 (scot %ud (msec one)) %ms) :: :: ++msec:milly ++ msec :: @dr to @ud ms - |=(a/@dr `@ud`(div a (div ~s1 1.000))) + |=(a=@dr `@ud`(div a (div ~s1 1.000))) :: :: ++mull:milly ++ mull :: unit msec diff - |= une/(unit @dr) + |= une=(unit @dr) ^- @tas ?~(une %no (mill u.une)) -- @@ -7510,7 +7589,7 @@ (mul timestamp ~s1) :: :: ++dawn:chrono: ++ dawn :: Jan 1 weekday - |= yer/@ud + |= yer=@ud =+ yet=(sub yer 1) %- mod :_ 7 ;: add @@ -7521,14 +7600,14 @@ == :: :: ++daws:chrono: ++ daws :: date weekday - |= yed/date + |= yed=date %- mod :_ 7 %+ add (dawn y.yed) (sub (yawn [y.yed m.yed d.t.yed]) (yawn y.yed 1 1)) :: :: ++deal:chrono: ++ deal :: to leap sec time - |= yer/@da + |= yer=@da =+ n=0 =+ yud=(yore yer) |- ^- date @@ -7541,7 +7620,7 @@ $(n +(n)) :: :: ++lead:chrono: ++ lead :: from leap sec time - |= ley/date + |= ley=date =+ ler=(year ley) =+ n=0 |- ^- @da @@ -7557,34 +7636,34 @@ $(n +(n)) :: :: ++dust:chrono: ++ dust :: print UTC format - |= yed/date + |= yed=date ^- tape =+ wey=(daws yed) =/ num (d-co:co 1) :: print as decimal without dots - =/ pik |=({n/@u t/wall} `tape`(scag 3 (snag n t))) + =/ pik |=([n=@u t=wall] `tape`(scag 3 (snag n t))) :: "{(pik wey wik:yu)}, ". "{(num d.t.yed)} {(pik (dec m.yed) mon:yu)} {(num y.yed)} ". "{(num h.t.yed)}:{(num m.t.yed)}:{(num s.t.yed)} +0000" :: :: ++stud:chrono: ++ stud :: parse UTC format - =< |= a/cord :: expose parsers + =< |= a=cord :: expose parsers %+ biff (rush a (more sepa elem)) - |= b/(list _(wonk *elem)) ^- (unit date) + |= b=(list _(wonk *elem)) ^- (unit date) =- ?.((za:dejs:format -) ~ (some (zp:dejs:format -))) ^+ =+ [*date u=unit] - *{(u _[a y]) (u _m) (u _d.t) (u _+.t) ~} + *[(u _[a y]) (u _m) (u _d.t) (u _+.t) ~] :~ - |-(?~(b ~ ?.(?=($y -.i.b) $(b t.b) `+.i.b))) - |-(?~(b ~ ?.(?=($m -.i.b) $(b t.b) `+.i.b))) - |-(?~(b ~ ?.(?=($d -.i.b) $(b t.b) `+.i.b))) - |-(?~(b ~ ?.(?=($t -.i.b) $(b t.b) `+.i.b))) + |-(?~(b ~ ?.(?=(%y -.i.b) $(b t.b) `+.i.b))) + |-(?~(b ~ ?.(?=(%m -.i.b) $(b t.b) `+.i.b))) + |-(?~(b ~ ?.(?=(%d -.i.b) $(b t.b) `+.i.b))) + |-(?~(b ~ ?.(?=(%t -.i.b) $(b t.b) `+.i.b))) == |% :: :: ++snug:stud:chrono: ++ snug :: position in list - |= a/(list tape) - |= b/tape + |= a=(list tape) + |= b=tape =+ [pos=1 len=(lent b)] |- ^- (unit @u) ?~ a ~ @@ -7611,7 +7690,7 @@ (bass 10 (stun 1^2 dit)) :: :: ++t:stud:chrono: ++ t :: hours:minutes:secs - %+ cook |=({h/@u @ m/@u @ s/@u} ~[h m s]) + %+ cook |=([h=@u @ m=@u @ s=@u] ~[h m s]) ;~(plug d col d col d) :: :: XX day of week is currently unchecked, and @@ -7628,7 +7707,7 @@ -- :: :: :: ++unt:chrono:userlib ++ unt :: Urbit to Unix time - |= a/@ + |= a=@ (div (sub a ~1970.1.1) ~s1) :: :: ++yu:chrono:userlib ++ yu :: UTC format constants @@ -7686,32 +7765,32 @@ |% :: :: ++feel:space:userlib ++ feel :: simple file write - |= {pax/path val/cage} + |= [pax=path val=cage] ^- miso =+ dir=.^(arch %cy pax) ?~ fil.dir [%ins val] [%mut val] :: :: ++file:space:userlib ++ file :: simple file load - |= pax/path + |= pax=path ^- (unit) =+ dir=.^(arch %cy pax) ?~(fil.dir ~ [~ .^(* %cx pax)]) :: :: ++foal:space:userlib ++ foal :: high-level write - |= {pax/path val/cage} + |= [pax=path val=cage] ^- toro - ?> ?=({* * * *} pax) + ?> ?=([* * * *] pax) [i.t.pax [%& [[[t.t.t.pax (feel pax val)] ~]]]] :: :: ++fray:space:userlib ++ fray :: high-level delete - |= pax/path + |= pax=path ^- toro - ?> ?=({* * * *} pax) + ?> ?=([* * * *] pax) [i.t.pax [%& [[[t.t.t.pax [%del ~]] ~]]]] :: :: ++furl:space:userlib ++ furl :: unify changes - |= {one/toro two/toro} + |= [one=toro two=toro] ^- toro ~| %furl ?> ?& =(p.one p.two) :: same path @@ -7727,11 +7806,11 @@ :: :: ++lune:unix:userlib ++ lune :: cord by unix line ~% %lune ..is ~ - |= txt/@t + |= txt=@t ?~ txt ^- (list @t) ~ =+ [byt=(rip 3 txt) len=(met 3 txt)] - =| {lin/(list @t) off/@} + =| [lin=(list @t) off=@] ^- (list @t) %- flop |- ^+ lin @@ -7750,24 +7829,24 @@ :: :: ++nule:unix:userlib ++ nule :: lines to unix cord ~% %nule ..is ~ - |= lin/(list @t) + |= lin=(list @t) ^- @t %+ can 3 %+ turn lin - |= t/@t + |= t=@t [+((met 3 t)) (cat 3 t 10)] -- :: :: :::: ++scanf:userlib :: (2uF) exterpolation :: :::: ++ scanf - =< |* {tape (pole _;/(*{$^(rule tape)}))} :: formatted scan + =< |* [tape (pole _;/(*[$^(rule tape)]))] :: formatted scan => .(+< [a b]=+<) (scan a (parsf b)) |% :: :: ++parsf:scanf: ++ parsf :: make parser from: - |* a/(pole _;/(*{$^(rule tape)})) :: ;"chars{rule}chars" + |* a=(pole _;/(*[$^(rule tape)])) :: ;"chars{rule}chars" =- (cook - (boil (norm a))) |* (list) ?~ +< ~ @@ -7782,14 +7861,14 @@ |* (list (each rule tape)) ?~ +< (easy ~) ?: ?=(%| -.i) ;~(pfix (jest (crip p.i)) $(+< t)) - %+ cook |*({* *} [i t]=+<) + %+ cook |*([* *] [i t]=+<) ;~(plug p.i $(+< t)) :: :: .= (norm [;"{n}, {n}"]:n=dim:ag) ~[[& dim] [| ", "] [& dim]]:ag :: :: :: ++norm:scanf:userlib ++ norm :: - |* (pole _;/(*{$^(rule tape)})) + |* (pole _;/(*[$^(rule tape)])) ?~ +< ~ => .(+< [i=+<- t=+<+]) :_ t=$(+< t) @@ -7896,7 +7975,7 @@ :: # constants :: :: contract addresses - ++ contracts mainnet-contracts + ++ contracts ropsten-contracts ++ mainnet-contracts |% :: azimuth: data contract @@ -8519,7 +8598,7 @@ :: if no reference needed, just put the data. ?. =(t hol) (weld nes t) :: calculate byte offset of data we need to reference. - =/ ofs/@ud + =/ ofs=@ud =- (div - 2) :: two hex digits per byte. %+ add led :: count head, and %- lent %- zing :: count all tail data diff --git a/pkg/arvo/ted/aqua/dill.hoon b/pkg/arvo/ted/aqua/dill.hoon index e56120a64..7fc87cb3d 100644 --- a/pkg/arvo/ted/aqua/dill.hoon +++ b/pkg/arvo/ted/aqua/dill.hoon @@ -18,6 +18,7 @@ |= [b=blit:dill line=tape] ?- -.b %lin (tape p.b) + %klr (tape (zing (turn p.b tail))) %mor ~& "{}: {line}" "" %hop line %bel line diff --git a/pkg/arvo/ted/build-cast.hoon b/pkg/arvo/ted/build-cast.hoon index 26ede6ff7..cf0a1c508 100644 --- a/pkg/arvo/ted/build-cast.hoon +++ b/pkg/arvo/ted/build-cast.hoon @@ -8,6 +8,6 @@ =+ !<([pax=path ~] arg) ?~ bem=(de-beam:format pax) (strand-fail:strand %path-not-beam >pax< ~) -=/ =mars:clay [i.t i]:?>(?=([@ @ ~] s.u.bem) s.u.bem) +=/ =mars:clay [i i.t]:?>(?=([@ @ ~] s.u.bem) s.u.bem) ;< =tube:clay bind:m (build-cast:strandio -.u.bem mars) (pure:m !>(tube)) diff --git a/pkg/arvo/ted/build-mark.hoon b/pkg/arvo/ted/build-mark.hoon index bbb1e4ba2..a134c896f 100644 --- a/pkg/arvo/ted/build-mark.hoon +++ b/pkg/arvo/ted/build-mark.hoon @@ -8,6 +8,6 @@ =+ !<([pax=path ~] arg) ?~ bem=(de-beam:format pax) (strand-fail:strand %path-not-beam >pax< ~) -=/ =mark (head s.u.bem) +=/ =mark (rear s.u.bem) ;< =dais:clay bind:m (build-mark:strandio -.u.bem mark) (pure:m !>(dais)) diff --git a/pkg/arvo/ted/diff.hoon b/pkg/arvo/ted/diff.hoon index cd9cdc796..580416a4a 100644 --- a/pkg/arvo/ted/diff.hoon +++ b/pkg/arvo/ted/diff.hoon @@ -23,7 +23,7 @@ ^- form:m =/ beam (need (de-beam:format path)) ;< =riot:clay bind:m - (warp:strandio p.beam q.beam ~ %sing %x r.beam (flop s.beam)) + (warp:strandio p.beam q.beam ~ %sing %x r.beam s.beam) ?~ riot (strand-fail:strandio %file-not-found >path< ~) (pure:m r.u.riot) diff --git a/pkg/arvo/ted/graph/restore.hoon b/pkg/arvo/ted/graph/restore.hoon index 96e570081..5ed59534f 100644 --- a/pkg/arvo/ted/graph/restore.hoon +++ b/pkg/arvo/ted/graph/restore.hoon @@ -1,7 +1,7 @@ /- spider, graph=graph-store, *metadata-store, *group, group-store /+ strandio, resource, graph-view => -|% +|% ++ strand strand:spider ++ poke poke:strandio ++ poke-our poke-our:strandio @@ -11,7 +11,7 @@ |= arg=vase =/ m (strand ,vase) ^- form:m -+= !< +=+ !< [[rid=resource title=@t description=@t group=resource module=@t ~] ~] arg ;< =bowl:spider bind:m get-bowl:strandio diff --git a/pkg/arvo/ted/migrate-channels.hoon b/pkg/arvo/ted/migrate-channels.hoon index d860c69de..4abc4b3f4 100644 --- a/pkg/arvo/ted/migrate-channels.hoon +++ b/pkg/arvo/ted/migrate-channels.hoon @@ -17,7 +17,7 @@ (pure:m !>("no such group: {}")) :: =/ assoc=associations (scry-for associations %metadata-store [%group og-path]) -=/ assoc-list=(list [[group-path resource] metadata]) ~(tap by assoc) +=/ assoc-list=(list [[group-path md-resource] metadata]) ~(tap by assoc) :: |- =* loop $ @@ -25,7 +25,7 @@ ;< ~ bind:m (poke-our:strandio %group-store %group-action !>([%unbundle og-path])) (pure:m !>("done")) -=/ [[g-path=group-path res=resource] meta=metadata] i.assoc-list +=/ [[g-path=group-path res=md-resource] meta=metadata] i.assoc-list ?. =(our.bol creator.meta) loop(assoc-list t.assoc-list) ?> =(g-path og-path) diff --git a/pkg/arvo/ted/test.hoon b/pkg/arvo/ted/test.hoon index d9f428ea7..f327adb92 100644 --- a/pkg/arvo/ted/test.hoon +++ b/pkg/arvo/ted/test.hoon @@ -46,7 +46,8 @@ ^- (list test) :: strip off leading 'tests' from :path :: - =. path ?>(?=([%tests *] path) t.path) + ?. ?=([%tests *] path) ~ + =/ path t.path ::NOTE TMI :: for each test, add the test's name to :path :: %+ turn test-arms @@ -80,20 +81,24 @@ =* loop $ ?~ bez (pure:m fiz) - ;< hav=? bind:m (check-for-file:strandio -.i.bez hoon+s.i.bez) + ;< hav=? bind:m (check-for-file:strandio -.i.bez (snoc s.i.bez %hoon)) ?: hav - loop(bez t.bez, fiz (~(put in fiz) [i.bez(s hoon+s.i.bez) ~])) + loop(bez t.bez, fiz (~(put in fiz) [i.bez(s (snoc s.i.bez %hoon)) ~])) ;< fez=(list path) bind:m (list-tree:strandio i.bez) ?. =(~ fez) - =/ foz (turn fez |=(path [[-.i.bez (flop +<)] ~])) + =/ foz + %+ murn fez + |= p=path + ?. =(%hoon (rear p)) ~ + (some [[-.i.bez p] ~]) loop(bez t.bez, fiz (~(gas in fiz) foz)) ~| bad-test-beam+i.bez - =/ tex=term =-(?>(((sane %tas) -) -) (head s.i.bez)) - =/ xup=path (tail s.i.bez) - ;< hov=? bind:m (check-for-file:strandio i.bez(s hoon+xup)) + =/ tex=term =-(?>(((sane %tas) -) -) (rear s.i.bez)) + =/ xup=path (snip s.i.bez) + ;< hov=? bind:m (check-for-file:strandio i.bez(s (snoc xup %hoon))) ?. hov ~|(no-tests-at-path+i.bez !!) - loop(bez t.bez, fiz (~(put in fiz) [[-.i.bez hoon+xup] `tex])) + loop(bez t.bez, fiz (~(put in fiz) [[-.i.bez (snoc xup %hoon)] `tex])) -- ^- thread:spider |= arg=vase @@ -107,7 +112,7 @@ |- ^- form:m =* gather-tests $ ?^ fiz - ~> %slog.0^leaf+"test: building {(spud (flop s.beam.i.fiz))}" + ~> %slog.0^leaf+"test: building {(spud s.beam.i.fiz)}" ;< cor=vase bind:m (build-file:strandio beam.i.fiz) =/ arms=(list test-arm) (get-test-arms cor) =? arms ?=(^ test.i.fiz) @@ -116,7 +121,7 @@ ?: =(name.i.arms u.test.i.fiz) [i.arms]~ $(arms t.arms) - =. test-arms (~(put by test-arms) (flop (tail s.beam.i.fiz)) arms) + =. test-arms (~(put by test-arms) (snip s.beam.i.fiz) arms) gather-tests(fiz t.fiz) %- pure:m !> ^= ok %+ roll (resolve-test-paths test-arms) diff --git a/pkg/arvo/tests/lib/bip32.hoon b/pkg/arvo/tests/lib/bip32.hoon index 6045d989c..9ffd91245 100644 --- a/pkg/arvo/tests/lib/bip32.hoon +++ b/pkg/arvo/tests/lib/bip32.hoon @@ -7,7 +7,18 @@ =, bip32 :: |% -+$ vector [mk=byts dp=tape id=@ux sk=@ux pk=@ux cc=@ux] ++$ vector + $: mk=byts + pf=@ux + dp=tape + ad=@uc + id=@ux + sk=@ux + pk=@ux + cc=@ux + xpub=tape + xprv=tape + == :: ++ test-vectors ^- tang @@ -20,149 +31,454 @@ (zing (turn vectors check-sk)) %+ category "chaincode" (zing (turn vectors check-cc)) + %+ category "fingerprint" + (zing (turn vectors check-pf)) + %+ category "address-from-xprv" + (zing (check-addr-xprv vectors)) + %+ category "address-from-xpub" + (zing (check-addr-xpub vectors)) + %+ category "extended-private" + (zing (turn vectors check-xprv)) + %+ category "extended-public" + (zing (turn vectors check-xpub)) == :: ++ check-id |= vector + =/ identity=@ux + =< identity + ?: =("m" dp) + (from-seed mk) + (derive-path:(from-seed mk) dp) %+ expect-eq !> id - !> `@ux`identity:(derive-path:(from-seed mk) dp) + !> identity :: ++ check-pk |= vector + =/ public-key=@ux + =< public-key + ?: =("m" dp) + (from-seed mk) + (derive-path:(from-seed mk) dp) %+ expect-eq !> pk - !> `@ux`public-key:(derive-path:(from-seed mk) dp) + !> public-key :: ++ check-sk |= vector + =/ private-key=@ux + =< private-key + ?: =("m" dp) + (from-seed mk) + (derive-path:(from-seed mk) dp) %+ expect-eq !> sk - !> `@ux`private-key:(derive-path:(from-seed mk) dp) + !> private-key :: ++ check-cc |= vector + =/ chain-code=@ux + =< chain-code + ?: =("m" dp) + (from-seed mk) + (derive-path:(from-seed mk) dp) %+ expect-eq !> cc - !> `@ux`chain-code:(derive-path:(from-seed mk) dp) + !> chain-code + :: + ++ check-pf + |= vector + =/ parent-fingerprint=@ux + =< fingerprint + ?: =("m" dp) + (from-seed mk) + (derive-path:(from-seed mk) dp) + %+ expect-eq + !> pf + !> parent-fingerprint + :: + ++ check-addr-xprv + |= vectors=(list vector) + ?> ?=(^ vectors) + =/ base=vector i.vectors + =/ tests=(list vector) t.vectors + |- ^- (list tang) + ?~ tests ~ + =* deriv i.tests + :_ %_ $ + tests t.tests + base ?:(=(dp.deriv "m") deriv base) + == + :: force success before starting second round of vectors + :: + ?: =(dp.deriv "m") *tang + =/ address=@uc + =< (address %main) + (derive-path:(from-extended xprv.base) dp.deriv) + %+ expect-eq + !> ad.deriv + !> address + :: + ++ check-addr-xpub + |= vectors=(list vector) + :: we can only derive non-hardened keys from an xpub key + :: e.g. from m/0'/1/2' to m/0'/1/2'/2/1000000000 + :: + ?> ?=([^ ^ ^ ^ *] vectors) + =/ base=vector i.t.t.t.vectors + =/ tests=(list vector) t.t.t.t.vectors + |- ^- (list tang) + ?~ tests ~ + =* deriv i.tests + :_ :: Second list of vectors has hardened paths. we skip those. + :: + $(tests ?:(=(dp.deriv "m") ~ t.tests), base base) + ?: =(dp.deriv "m") *tang + :: strips the hardened part of the path (at index=9) + :: m/0'/1/2'/2 + :: --------^ + :: + =. dp.deriv ['m' q:(trim 9 dp.deriv)] + =/ address=@uc + =< (address %main) + (derive-path:(from-extended xpub.base) dp.deriv) + %+ expect-eq + !> ad.deriv + !> address + :: + ++ check-xprv + |= vector + =/ extended-xprv=tape + =< (prv-extended %main) + ?: =("m" dp) + (from-seed mk) + (derive-path:(from-seed mk) dp) + %+ expect-eq + !> xprv + !> extended-xprv + :: + ++ check-xpub + |= vector + =/ extended-pub=tape + =< (pub-extended %main) + ?: =("m" dp) + (from-seed mk) + (derive-path:(from-seed mk) dp) + %+ expect-eq + !> xpub + !> extended-pub :: ++ vectors ^- (list vector) - :~ - :* - 16^0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f - "m/0'" - 0x5c1b.d648.ed23.aa5f.d50b.a52b.2457.c11e.9e80.a6a7 - 0xedb2.e14f.9ee7.7d26.dd93.b4ec.ede8.d16e.d408.ce14.9b6c.d80b.0715.a2d9.11a0.afea - 0x3.5a78.4662.a4a2.0a65.bf6a.ab9a.e98a.6c06.8a81.c52e.4b03.2c0f.b540.0c70.6cfc.cc56 - 0x47fd.acbd.0f10.9704.3b78.c63c.20c3.4ef4.ed9a.111d.9800.47ad.1628.2c7a.e623.6141 - == - :: - :* - 16^0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f - "m/0'/1" - 0xbef5.a2f9.a56a.94aa.b124.59f7.2ad9.cf8c.f19c.7bbe - 0x3c6c.b8d0.f6a2.64c9.1ea8.b503.0fad.aa8e.538b.020f.0a38.7421.a12d.e931.9dc9.3368 - 0x3.501e.454b.f007.51f2.4b1b.489a.a925.215d.66af.2234.e389.1c3b.21a5.2bed.b3cd.711c - 0x2a78.5763.1386.ba23.daca.c341.80dd.1983.734e.444f.dbf7.7404.1578.e9b6.adb3.7c19 - == - :: - :* - 16^0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f - "m/0'/1/2'" - 0xee7a.b90c.de56.a8c0.e2bb.086a.c497.48b8.db9d.ce72 - 0xcbce.0d71.9ecf.7431.d88e.6a89.fa14.83e0.2e35.092a.f60c.042b.1df2.ff59.fa42.4dca - 0x3.57bf.e1e3.41d0.1c69.fe56.5430.9956.cbea.5168.22fb.a8a6.0174.3a01.2a78.96ee.8dc2 - 0x446.6b9c.c8e1.61e9.6640.9ca5.2986.c584.f07e.9dc8.1f73.5db6.83c3.ff6e.c7b1.503f - == - :: - :* - 16^0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f - "m/0'/1/2'/2" - 0xd880.d7d8.9384.8509.a62d.8fb7.4e32.148d.ac68.412f - 0xf47.9245.fb19.a38a.1954.c5c7.c0eb.ab2f.9bdf.d96a.1756.3ef2.8a6a.4b1a.2a76.4ef4 - 0x2.e844.5082.a72f.29b7.5ca4.8748.a914.df60.622a.609c.acfc.e8ed.0e35.8045.6074.1d29 - 0xcfb7.1883.f016.76f5.87d0.23cc.53a3.5bc7.f88f.724b.1f8c.2892.ac12.75ac.822a.3edd - == - :: - :* - 16^0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f - "m/0'/1/2'/2/1000000000" - 0xd69a.a102.255f.ed74.3782.78c7.8127.01ea.641f.df32 - 0x471b.76e3.89e5.28d6.de6d.8168.57e0.12c5.4550.51ca.d666.0850.e583.72a6.c3e6.e7c8 - 0x2.2a47.1424.da5e.6574.99d1.ff51.cb43.c474.81a0.3b1e.77f9.51fe.64ce.c9f5.a48f.7011 - 0xc783.e67b.921d.2beb.8f6b.389c.c646.d726.3b41.4570.1dad.d216.1548.a8b0.78e6.5e9e - == - :: - :* - 64^0xfffc.f9f6.f3f0.edea.e7e4.e1de.dbd8.d5d2. + :~ :* 16^0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f + 0x3442.193e + "m" + 0c15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma + 0x3442.193e.1bb7.0916.e914.5521.72cd.4e2d.bc9d.f811 + :: + 0xe8f3.2e72.3dec.f405.1aef.ac8e.2c93.c9c5. + b214.3138.17cd.b01a.1494.b917.c843.6b35 + :: + 0x3.39a3.6013.3015.97da.ef41.fbe5.93a0.2cc5. + 13d0.b555.27ec.2df1.050e.2e8f.f49c.85c2 + :: + 0x873d.ff81.c02f.5256.23fd.1fe5.167e.ac3a. + 55a0.49de.3d31.4bb4.2ee2.27ff.ed37.d508 + :: + %+ weld + "xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2g" + "Z29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8" + :: + %+ weld + "xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiC" + "hkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi" + == + :: + :* 16^0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f + 0x5c1b.d648 + "m/0'" + 0c19Q2WoS5hSS6T8GjhK8KZLMgmWaq4neXrh + 0x5c1b.d648.ed23.aa5f.d50b.a52b.2457.c11e.9e80.a6a7 + :: + 0xedb2.e14f.9ee7.7d26.dd93.b4ec.ede8.d16e. + d408.ce14.9b6c.d80b.0715.a2d9.11a0.afea + :: + 0x3.5a78.4662.a4a2.0a65.bf6a.ab9a.e98a.6c06. + 8a81.c52e.4b03.2c0f.b540.0c70.6cfc.cc56 + :: + 0x47fd.acbd.0f10.9704.3b78.c63c.20c3.4ef4. + ed9a.111d.9800.47ad.1628.2c7a.e623.6141 + :: + %+ weld + "xpub68Gmy5EdvgibQVfPdqkBBCHxA5htiqg55crXYuXoQRKfDBFA1WEjWgP6" + "LHhwBZeNK1VTsfTFUHCdrfp1bgwQ9xv5ski8PX9rL2dZXvgGDnw" + :: + %+ weld + "xprv9uHRZZhk6KAJC1avXpDAp4MDc3sQKNxDiPvvkX8Br5ngLNv1TxvUxt4c" + "V1rGL5hj6KCesnDYUhd7oWgT11eZG7XnxHrnYeSvkzY7d2bhkJ7" + == + :: + :* 16^0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f + 0xbef5.a2f9 + "m/0'/1" + 0c1JQheacLPdM5ySCkrZkV66G2ApAXe1mqLj + 0xbef5.a2f9.a56a.94aa.b124.59f7.2ad9.cf8c.f19c.7bbe + :: + 0x3c6c.b8d0.f6a2.64c9.1ea8.b503.0fad.aa8e. + 538b.020f.0a38.7421.a12d.e931.9dc9.3368 + :: + 0x3.501e.454b.f007.51f2.4b1b.489a.a925.215d. + 66af.2234.e389.1c3b.21a5.2bed.b3cd.711c + :: + 0x2a78.5763.1386.ba23.daca.c341.80dd.1983. + 734e.444f.dbf7.7404.1578.e9b6.adb3.7c19 + :: + %+ weld + "xpub6ASuArnXKPbfEwhqN6e3mwBcDTgzisQN1wXN9BJcM47sSikHjJf3UFHKk" + "NAWbWMiGj7Wf5uMash7SyYq527Hqck2AxYysAA7xmALppuCkwQ" + :: + %+ weld + "xprv9wTYmMFdV23N2TdNG573QoEsfRrWKQgWeibmLntzniatZvR9BmLnvSxqu5" + "3Kw1UmYPxLgboyZQaXwTCg8MSY3H2EU4pWcQDnRnrVA1xe8fs" + == + :: + :* 16^0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f + 0xee7a.b90c + "m/0'/1/2'" + 0c1NjxqbA9aZWnh17q1UW3rB4EPu79wDXj7x + 0xee7a.b90c.de56.a8c0.e2bb.086a.c497.48b8.db9d.ce72 + :: + 0xcbce.0d71.9ecf.7431.d88e.6a89.fa14.83e0. + 2e35.092a.f60c.042b.1df2.ff59.fa42.4dca + :: + 0x3.57bf.e1e3.41d0.1c69.fe56.5430.9956.cbea. + 5168.22fb.a8a6.0174.3a01.2a78.96ee.8dc2 + :: + 0x446.6b9c.c8e1.61e9.6640.9ca5.2986.c584.f07e. + 9dc8.1f73.5db6.83c3.ff6e.c7b1.503f + :: + %+ weld + "xpub6D4BDPcP2GT577Vvch3R8wDkScZWzQzMMUm3PWbmWvVJrZwQY4VUNgqFJPM" + "M3No2dFDFGTsxxpG5uJh7n7epu4trkrX7x7DogT5Uv6fcLW5" + :: + %+ weld + "xprv9z4pot5VBttmtdRTWfWQmoH1taj2axGVzFqSb8C9xaxKymcFzXBDptWmT7F" + "wuEzG3ryjH4ktypQSAewRiNMjANTtpgP4mLTj34bhnZX7UiM" + == + :: + :* 16^0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f + 0xd880.d7d8 + "m/0'/1/2'/2" + 0c1LjmJcdPnDHhNTUgrWyhLGnRDKxQjoxAgt + 0xd880.d7d8.9384.8509.a62d.8fb7.4e32.148d.ac68.412f + :: + 0xf47.9245.fb19.a38a.1954.c5c7.c0eb.ab2f. + 9bdf.d96a.1756.3ef2.8a6a.4b1a.2a76.4ef4 + :: + 0x2.e844.5082.a72f.29b7.5ca4.8748.a914.df60. + 622a.609c.acfc.e8ed.0e35.8045.6074.1d29 + :: + 0xcfb7.1883.f016.76f5.87d0.23cc.53a3.5bc7. + f88f.724b.1f8c.2892.ac12.75ac.822a.3edd + :: + %+ weld + "xpub6FHa3pjLCk84BayeJxFW2SP4XRrFd1JYnxeLeU8EqN3vDfZmbqBqaGJAyiL" + "jTAwm6ZLRQUMv1ZACTj37sR62cfN7fe5JnJ7dh8zL4fiyLHV" + :: + %+ weld + "xprvA2JDeKCSNNZky6uBCviVfJSKyQ1mDYahRjijr5idH2WwLsEd4Hsb2Tyh8Rf" + "QMuPh7f7RtyzTtdrbdqqsunu5Mm3wDvUAKRHSC34sJ7in334" + == + :: + :* 16^0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f + 0xd69a.a102 + "m/0'/1/2'/2/1000000000" + 0c1LZiqrop2HGR4qrH1ULZPyBpU6AUP49Uam + 0xd69a.a102.255f.ed74.3782.78c7.8127.01ea.641f.df32 + :: + 0x471b.76e3.89e5.28d6.de6d.8168.57e0.12c5. + 4550.51ca.d666.0850.e583.72a6.c3e6.e7c8 + :: + 0x2.2a47.1424.da5e.6574.99d1.ff51.cb43.c474. + 81a0.3b1e.77f9.51fe.64ce.c9f5.a48f.7011 + :: + 0xc783.e67b.921d.2beb.8f6b.389c.c646.d726. + 3b41.4570.1dad.d216.1548.a8b0.78e6.5e9e + :: + %+ weld + "xpub6H1LXWLaKsWFhvm6RVpEL9P4KfRZSW7abD2ttkWP3SSQvnyA8FSVqNTEcYF" + "gJS2UaFcxupHiYkro49S8yGasTvXEYBVPamhGW6cFJodrTHy" + :: + %+ weld + "xprvA41z7zogVVwxVSgdKUHDy1SKmdb533PjDz7J6N6mV6uS3ze1ai8FHa8kmHS" + "cGpWmj4WggLyQjgPie1rFSruoUihUZREPSL39UNdE3BBDu76" + == + :: + :* 64^0xfffc.f9f6.f3f0.edea.e7e4.e1de.dbd8.d5d2. + cfcc.c9c6.c3c0.bdba.b7b4.b1ae.aba8.a5a2.9f9c.9996.9390.8d8a. + 8784.817e.7b78.7572.6f6c.6966.6360.5d5a.5754.514e.4b48.4542 + :: + 0xbd16.bee5 + "m" + 0c1JEoxevbLLG8cVqeoGKQiAwoWbNYSUyYjg + 0xbd16.bee5.3961.a47d.6ad8.88e2.9545.434a.89bd.fe95 + :: + 0x4b03.d6fc.3404.55b3.63f5.1020.ad3e.cca4. + f085.0280.cf43.6c70.c727.923f.6db4.6c3e + :: + 0x3.cbca.a9c9.8c87.7a26.977d.0082.5c95.6a23. + 8e8d.ddfb.d322.cce4.f74b.0b5b.d6ac.e4a7 + :: + 0x6049.9f80.1b89.6d83.179a.4374.aeb7.822a. + aeac.eaa0.db1f.85ee.3e90.4c4d.efbd.9689 + :: + %+ weld + "xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8E" + "D9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB" + :: + %+ weld + "xprv9s21ZrQH143K31xYSDQpPDxsXRTUcvj2iNHm5NUtrGiGG5e2DtALGdso3pG" + "z6ssrdK4PFmM8NSpSBHNqPqm55Qn3LqFtT2emdEXVYsCzC2U" + == + :: + :* 64^0xfffc.f9f6.f3f0.edea.e7e4.e1de.dbd8.d5d2. + cfcc.c9c6.c3c0.bdba.b7b4.b1ae.aba8.a5a2.9f9c.9996.9390.8d8a. + 8784.817e.7b78.7572.6f6c.6966.6360.5d5a.5754.514e.4b48.4542 + :: + 0x5a61.ff8e + "m/0" + 0c19EuDJdgfRkwCmRzbzVBHZWQG9QNWhftbZ + 0x5a61.ff8e.b7aa.ca30.10db.97eb.da76.1216.10b7.8096 + :: + 0xabe7.4a98.f6c7.eabe.e042.8f53.798f.0ab8. + aa1b.d378.7399.9041.703c.742f.15ac.7e1e + :: + 0x2.fc9e.5af0.ac8d.9b3c.ecfe.2a88.8e21.17ba. + 3d08.9d85.8588.6c9c.826b.6b22.a98d.12ea + :: + 0xf090.9aff.aa7e.e7ab.e5dd.4e10.0598.d4dc. + 53cd.709d.5a5c.2cac.40e7.412f.232f.7c9c + :: + %+ weld + "xpub69H7F5d8KSRgmmdJg2KhpAK8SR3DjMwAdkxj3ZuxV27CprR9LgpeyGmXUbC" + "6wb7ERfvrnKZjXoUmmDznezpbZb7ap6r1D3tgFxHmwMkQTPH" + :: + %+ weld + "xprv9vHkqa6EV4sPZHYqZznhT2NPtPCjKuDKGY38FBWLvgaDx45zo9WQRUT3dKY" + "njwih2yJD9mkrocEZXo1ex8G81dwSM1fwqWpWkeS3v86pgKt" + == + :: + :* 64^0xfffc.f9f6.f3f0.edea.e7e4.e1de.dbd8.d5d2. cfcc.c9c6.c3c0.bdba.b7b4.b1ae.aba8.a5a2. 9f9c.9996.9390.8d8a.8784.817e.7b78.7572. 6f6c.6966.6360.5d5a.5754.514e.4b48.4542 - "m/0" - 0x5a61.ff8e.b7aa.ca30.10db.97eb.da76.1216.10b7.8096 - 0xabe7.4a98.f6c7.eabe.e042.8f53.798f.0ab8. - aa1b.d378.7399.9041.703c.742f.15ac.7e1e - 0x2.fc9e.5af0.ac8d.9b3c.ecfe.2a88.8e21.17ba. - 3d08.9d85.8588.6c9c.826b.6b22.a98d.12ea - 0xf090.9aff.aa7e.e7ab.e5dd.4e10.0598.d4dc.53cd.709d.5a5c.2cac.40e7.412f.232f.7c9c - == - :: - :* - 64^0xfffc.f9f6.f3f0.edea.e7e4.e1de.dbd8.d5d2. - cfcc.c9c6.c3c0.bdba.b7b4.b1ae.aba8.a5a2. - 9f9c.9996.9390.8d8a.8784.817e.7b78.7572. - 6f6c.6966.6360.5d5a.5754.514e.4b48.4542 - "m/0/2147483647'" - 0xd8ab.4937.36da.02f1.1ed6.82f8.8339.e720.fb03.79d1 - 0x877c.779a.d968.7164.e9c2.f4f0.f4ff.0340. - 8143.9233.0693.ce95.a58f.e18f.d52e.6e93 - 0x3.c01e.7425.647b.defa.82b1.2d9b.ad5e.3e68. - 65be.e050.2694.b94c.a58b.666a.bc0a.5c3b - 0xbe17.a268.474a.6bb9.c61e.1d72.0cf6.215e.2a88.c540.6c4a.ee7b.3854.7f58.5c9a.37d9 - == - :: - :* - 64^0xfffc.f9f6.f3f0.edea.e7e4.e1de.dbd8.d5d2. - cfcc.c9c6.c3c0.bdba.b7b4.b1ae.aba8.a5a2. - 9f9c.9996.9390.8d8a.8784.817e.7b78.7572. - 6f6c.6966.6360.5d5a.5754.514e.4b48.4542 - "m/0/2147483647'/1" - 0x7841.2e3a.2296.a40d.e124.307b.6485.bd19.833e.2e34 - 0x704a.ddf5.44a0.6e5e.e4be.a370.9846.3c23. - 613d.a320.20d6.0450.6da8.c051.8e1d.a4b7 - 0x3.a7d1.d856.deb7.4c50.8e05.031f.9895.dab5. - 4626.251b.3806.e16b.4bd1.2e78.1a7d.f5b9 - 0xf366.f48f.1ea9.f2d1.d3fe.958c.95ca.84ea.18e4.c4dd.b936.6c33.6c92.7eb2.46fb.38cb - == - :: - :* - 64^0xfffc.f9f6.f3f0.edea.e7e4.e1de.dbd8.d5d2. - cfcc.c9c6.c3c0.bdba.b7b4.b1ae.aba8.a5a2. - 9f9c.9996.9390.8d8a.8784.817e.7b78.7572. - 6f6c.6966.6360.5d5a.5754.514e.4b48.4542 - "m/0/2147483647'/1/2147483646'" - 0x31a5.07b8.1559.3dfc.51ff.c724.5ae7.e5ae.e304.246e - 0xf1c7.c871.a54a.804a.fe32.8b4c.83a1.c33b. - 8e5f.f48f.5087.273f.04ef.a83b.247d.6a2d - 0x2.d2b3.6900.396c.9282.fa14.6285.6658.2f20. - 6a5d.d0bc.c8d5.e892.6118.06ca.fb03.01f0 - 0x6378.0703.0d55.d01f.9a0c.b3a7.8395.15d7.96bd.0770.6386.a6ed.df06.cc29.a65a.0e29 - == - :: - :* - 64^0xfffc.f9f6.f3f0.edea.e7e4.e1de.dbd8.d5d2. - cfcc.c9c6.c3c0.bdba.b7b4.b1ae.aba8.a5a2. - 9f9c.9996.9390.8d8a.8784.817e.7b78.7572. - 6f6c.6966.6360.5d5a.5754.514e.4b48.4542 - "m/0/2147483647'/1/2147483646'/2" - 0x2613.2fdb.e7bf.89cb.c64c.f8da.fa3f.9f88.b866.6220 - 0xbb7d.39bd.b83e.cf58.f2fd.82b6.d918.341c. - bef4.2866.1ef0.1ab9.7c28.a484.2125.ac23 - 0x2.4d90.2e1a.2fc7.a875.5ab5.b694.c575.fce7. - 42c4.8d9f.f192.e63d.f519.3e4c.7afe.1f9c - 0x9452.b549.be8c.ea3e.cb7a.84be.c10d.cfd9.4afe.4d12.9ebf.d3b3.cb58.eedf.394e.d271 - == - == + :: + 0xd8ab.4937 + "m/0/2147483647'" + 0c1Lke9bXGhn5VPrBuXgN12uGUphrttUErmk + 0xd8ab.4937.36da.02f1.1ed6.82f8.8339.e720.fb03.79d1 + :: + 0x877c.779a.d968.7164.e9c2.f4f0.f4ff.0340. + 8143.9233.0693.ce95.a58f.e18f.d52e.6e93 + :: + 0x3.c01e.7425.647b.defa.82b1.2d9b.ad5e.3e68. + 65be.e050.2694.b94c.a58b.666a.bc0a.5c3b + :: + 0xbe17.a268.474a.6bb9.c61e.1d72.0cf6.215e. + 2a88.c540.6c4a.ee7b.3854.7f58.5c9a.37d9 + :: + %+ weld + "xpub6ASAVgeehLbnwdqV6UKMHVzgqAG8Gr6riv3Fxxpj8ksbH9ebxaEyBLZ85y" + "SDhKiLDBrQSARLq1uNRts8RuJiHjaDMBU4Zn9h8LZNnBC5y4a" + :: + %+ weld + "xprv9wSp6B7kry3Vj9m1zSnLvN3xH8RdsPP1Mh7fAaR7aRLcQMKTR2vidYEeEg" + "2mUCTAwCd6vnxVrcjfy2kRgVsFawNzmjuHc2YmYRmagcEPdU9" + == + :: + :* 64^0xfffc.f9f6.f3f0.edea.e7e4.e1de.dbd8.d5d2. + cfcc.c9c6.c3c0.bdba.b7b4.b1ae.aba8.a5a2. + 9f9c.9996.9390.8d8a.8784.817e.7b78.7572. + 6f6c.6966.6360.5d5a.5754.514e.4b48.4542 + :: + 0x7841.2e3a + "m/0/2147483647'/1" + 0c1BxrAr2pHpeBheusmd6fHDP2tSLAUa3qsW + 0x7841.2e3a.2296.a40d.e124.307b.6485.bd19.833e.2e34 + :: + 0x704a.ddf5.44a0.6e5e.e4be.a370.9846.3c23. + 613d.a320.20d6.0450.6da8.c051.8e1d.a4b7 + :: + 0x3.a7d1.d856.deb7.4c50.8e05.031f.9895.dab5. + 4626.251b.3806.e16b.4bd1.2e78.1a7d.f5b9 + :: + 0xf366.f48f.1ea9.f2d1.d3fe.958c.95ca.84ea. + 18e4.c4dd.b936.6c33.6c92.7eb2.46fb.38cb + :: + %+ weld + "xpub6DF8uhdarytz3FWdA8TvFSvvAh8dP3283MY7p2V4SeE2wyWmG5mg5EwVvm" + "dMVCQcoNJxGoWaU9DCWh89LojfZ537wTfunKau47EL2dhHKon" + :: + %+ weld + "xprv9zFnWC6h2cLgpmSA46vutJzBcfJ8yaJGg8cX1e5StJh45BBciYTRXSd25U" + "EPVuesF9yog62tGAQtHjXajPPdbRCHuWS6T8XA2ECKADdw4Ef" + == + :: + :* 64^0xfffc.f9f6.f3f0.edea.e7e4.e1de.dbd8.d5d2. + cfcc.c9c6.c3c0.bdba.b7b4.b1ae.aba8.a5a2. + 9f9c.9996.9390.8d8a.8784.817e.7b78.7572. + 6f6c.6966.6360.5d5a.5754.514e.4b48.4542 + :: + 0x31a5.07b8 + "m/0/2147483647'/1/2147483646'" + 0c15XVotxCAV7sRx1PSCkQNsGw3W9jT9A94R + 0x31a5.07b8.1559.3dfc.51ff.c724.5ae7.e5ae.e304.246e + :: + 0xf1c7.c871.a54a.804a.fe32.8b4c.83a1.c33b. + 8e5f.f48f.5087.273f.04ef.a83b.247d.6a2d + :: + 0x2.d2b3.6900.396c.9282.fa14.6285.6658.2f20. + 6a5d.d0bc.c8d5.e892.6118.06ca.fb03.01f0 + :: + 0x6378.0703.0d55.d01f.9a0c.b3a7.8395.15d7. + 96bd.0770.6386.a6ed.df06.cc29.a65a.0e29 + :: + %+ weld + "xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZR" + "krgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL" + :: + %+ weld + "xprvA1RpRA33e1JQ7ifknakTFpgNXPmW2YvmhqLQYMmrj4xJXXWYpDPS3xz7iA" + "xn8L39njGVyuoseXzU6rcxFLJ8HFsTjSyQbLYnMpCqE2VbFWc" + == + :: + :* 64^0xfffc.f9f6.f3f0.edea.e7e4.e1de.dbd8.d5d2. + cfcc.c9c6.c3c0.bdba.b7b4.b1ae.aba8.a5a2. + 9f9c.9996.9390.8d8a.8784.817e.7b78.7572. + 6f6c.6966.6360.5d5a.5754.514e.4b48.4542 + :: + 0x2613.2fdb + "m/0/2147483647'/1/2147483646'/2" + 0c14UKfRV9ZPUp6ZC9PLhqbRtxdihW9em3xt + 0x2613.2fdb.e7bf.89cb.c64c.f8da.fa3f.9f88.b866.6220 + :: + 0xbb7d.39bd.b83e.cf58.f2fd.82b6.d918.341c. + bef4.2866.1ef0.1ab9.7c28.a484.2125.ac23 + :: + 0x2.4d90.2e1a.2fc7.a875.5ab5.b694.c575.fce7. + 42c4.8d9f.f192.e63d.f519.3e4c.7afe.1f9c + :: + 0x9452.b549.be8c.ea3e.cb7a.84be.c10d.cfd9. + 4afe.4d12.9ebf.d3b3.cb58.eedf.394e.d271 + :: + %+ weld + "xpub6FnCn6nSzZAw5Tw7cgR9bi15UV96gLZhjDstkXXxvCLsUXBGXPdSnLFbd" + "pq8p9HmGsApME5hQTZ3emM2rnY5agb9rXpVGyy3bdW6EEgAtqt" + :: + %+ weld + "xprvA2nrNbFZABcdryreWet9Ea4LvTJcGsqrMzxHx98MMrotbir7yrKCEXw7n" + "adnHM8Dq38EGfSh6dqA9QWTyefMLEcBYJUuekgW4BYPJcr9E7j" + == == -- -- diff --git a/pkg/arvo/tests/sys/hoon/hashes.hoon b/pkg/arvo/tests/sys/hoon/hashes.hoon index c9c8d9332..ef9ec855e 100644 --- a/pkg/arvo/tests/sys/hoon/hashes.hoon +++ b/pkg/arvo/tests/sys/hoon/hashes.hoon @@ -33,26 +33,39 @@ !> 0x79ff.04e8 !> (mug 0) :: + %+ expect-eq + !> 0x715c.2a60 + !> (mug 1) + :: %+ expect-eq !> 0x64df.da5c !> (mug (crip (reap 28 'x'))) :: %+ expect-eq - !> 0x389c.a03a + !> 0x192f.5588 !> (mug [0 0]) :: %+ expect-eq - !> 0x389c.a03a + !> 0x6b32.ec46 !> (mug [1 1]) :: %+ expect-eq - !> 0x5258.a6c0 + !> 0x2ef.fe10 + !> (mug [2 2]) + :: + %+ expect-eq + !> 0x3a81.1aec + !> (mug [1 2 3]) + :: + %+ expect-eq + !> 0x7ce.fb7f !> (mug [0 (bex 32)]) :: %+ expect-eq - !> 0x2ad3.9968 + !> 0x2aa0.6bfc !> (mug [(dec (bex 128)) 1]) == +:: :: SHA tests :: For references see FIPS180-4 and related test vectors :: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf diff --git a/pkg/arvo/tests/sys/hoon/mock.hoon b/pkg/arvo/tests/sys/hoon/mock.hoon new file mode 100644 index 000000000..411ffa592 --- /dev/null +++ b/pkg/arvo/tests/sys/hoon/mock.hoon @@ -0,0 +1,32 @@ +/+ *test +|% +:: nock 6 should allow invalid formulas in unevaluated branches +:: +++ test-conditional-skips + ;: weld + %+ expect-eq + !> 43 + !> .*(~ [%6 [%1 1] 0 [%1 43]]) + :: + %- expect-fail + |. .*(~ [%6 [%1 0] 0 [%1 43]]) + :: + %+ expect-eq + !> 42 + !> .*(~ [%6 [%1 0] [%1 42] 0]) + :: + %- expect-fail + |. .*(~ [%6 [%1 1] [%1 42] 0]) + :: + %+ expect-eq + !> 42 + !> .*(~ [%6 [%1 0] [%1 42] %1 43]) + :: + %+ expect-eq + !> 43 + !> .*(~ [%6 [%1 1] [%1 42] %1 43]) + :: + %- expect-fail + |. .*(~ [%6 [%1 2] [%1 42] %1 43]) + == +-- diff --git a/pkg/arvo/tests/sys/vane/ames.hoon b/pkg/arvo/tests/sys/vane/ames.hoon index 83bc5a4b5..26e162d0a 100644 --- a/pkg/arvo/tests/sys/vane/ames.hoon +++ b/pkg/arvo/tests/sys/vane/ames.hoon @@ -7,15 +7,15 @@ =/ nec vane =/ bud vane :: -=. our.nec ~nec -=. now.nec ~1111.1.1 -=. eny.nec 0xdead.beef -=. scry-gate.nec |=(* ``[%noun !>(*(list turf))]) +=. our.nec ~nec +=. now.nec ~1111.1.1 +=. eny.nec 0xdead.beef +=. rof.nec |=(* ``[%noun !>(*(list turf))]) :: -=. our.bud ~bud -=. now.bud ~1111.1.1 -=. eny.bud 0xbeef.dead -=. scry-gate.bud |=(* ``[%noun !>(*(list turf))]) +=. our.bud ~bud +=. now.bud ~1111.1.1 +=. eny.bud 0xbeef.dead +=. rof.bud |=(* ``[%noun !>(*(list turf))]) :: =. crypto-core.ames-state.nec (pit:nu:crub:crypto 512 (shaz 'nec')) =. crypto-core.ames-state.bud (pit:nu:crub:crypto 512 (shaz 'bud')) diff --git a/pkg/arvo/tests/sys/vane/clay.hoon b/pkg/arvo/tests/sys/vane/clay.hoon index 76b0f43de..0487df370 100644 --- a/pkg/arvo/tests/sys/vane/clay.hoon +++ b/pkg/arvo/tests/sys/vane/clay.hoon @@ -175,7 +175,7 @@ ++ clay-call |= $: clay-gate=_clay-gate now=@da - scry=sley + scry=roof call-args=[=duct =type wrapped-task=(hobo task:able:clay)] expected-moves=(list move:clay-gate) == @@ -196,7 +196,7 @@ ++ clay-call-with-comparator |= $: clay-gate=_clay-gate now=@da - scry=sley + scry=roof call-args=[=duct =type wrapped-task=(hobo task:able:clay)] move-comparator=$-((list move:clay-gate) tang) == @@ -214,7 +214,7 @@ ++ clay-take |= $: clay-gate=_clay-gate now=@da - scry=sley + scry=roof take-args=[=wire =duct wrapped-sign=(hypo sign:clay-gate)] expected-moves=(list move:clay-gate) == @@ -235,7 +235,7 @@ ++ clay-take-with-comparator |= $: clay-gate=_clay-gate now=@da - scry=sley + scry=roof take-args=[=wire =duct wrapped-sign=(hypo sign:clay-gate)] move-comparator=$-((list move:clay-gate) tang) == diff --git a/pkg/arvo/tests/sys/vane/eyre.hoon b/pkg/arvo/tests/sys/vane/eyre.hoon index dadaafb99..61dc66b53 100644 --- a/pkg/arvo/tests/sys/vane/eyre.hoon +++ b/pkg/arvo/tests/sys/vane/eyre.hoon @@ -882,7 +882,7 @@ == :: ++ test-channel-open-never-used-expire - =^ results1 eyre-gate (perform-init-start-channel eyre-gate *sley) + =^ results1 eyre-gate (perform-init-start-channel eyre-gate *roof) :: the behn timer wakes us up; we cancel our subscription :: =^ results2 eyre-gate @@ -918,7 +918,7 @@ ++ test-channel-results-before-open :: common initialization :: - =^ results1 eyre-gate (perform-init-start-channel eyre-gate *sley) + =^ results1 eyre-gate (perform-init-start-channel eyre-gate *roof) :: poke gets a success message :: =^ results2 eyre-gate @@ -1062,7 +1062,7 @@ ++ test-channel-second-get-updates-timer :: common initialization :: - =^ results1 eyre-gate (perform-init-start-channel eyre-gate *sley) + =^ results1 eyre-gate (perform-init-start-channel eyre-gate *roof) :: perform another poke to a different app :: :: Since we haven't connected with a GET, the old timer should be canceled @@ -1136,7 +1136,7 @@ ++ test-channel-unsubscribe-stops-events :: common initialization :: - =^ results1 eyre-gate (perform-init-start-channel eyre-gate *sley) + =^ results1 eyre-gate (perform-init-start-channel eyre-gate *roof) :: poke gets a success message :: =^ results2 eyre-gate @@ -1238,7 +1238,7 @@ ++ test-channel-double-subscription-works :: common initialization :: - =^ results1 eyre-gate (perform-init-start-channel eyre-gate *sley) + =^ results1 eyre-gate (perform-init-start-channel eyre-gate *roof) :: poke gets a success message :: =^ results2 eyre-gate @@ -1541,7 +1541,7 @@ ++ test-channel-sends-unacknowledged-events-on-reconnection :: common initialization :: - =^ results1 eyre-gate (perform-init-start-channel eyre-gate *sley) + =^ results1 eyre-gate (perform-init-start-channel eyre-gate *roof) :: poke gets a success message :: =^ results2 eyre-gate @@ -1811,7 +1811,7 @@ :: common initialization :: =^ tested-elsewhere eyre-gate - (perform-init-start-channel eyre-gate *sley) + (perform-init-start-channel eyre-gate *roof) :: =/ now=@da :(add ~1111.1.2 clog-timeout:eyre-gate ~s1) :: subscription gets a success message @@ -2051,7 +2051,7 @@ ++ eyre-call |= $: eyre-gate=_eyre-gate now=@da - scry=sley + scry=roof call-args=[=duct type=* wrapped-task=(hobo task:able:eyre-gate)] expected-moves=(list move:eyre-gate) == @@ -2073,7 +2073,7 @@ ++ eyre-call-with-comparator |= $: eyre-gate=_eyre-gate now=@da - scry=sley + scry=roof call-args=[=duct type=* wrapped-task=(hobo task:able:eyre-gate)] move-comparator=$-((list move:eyre-gate) tang) == @@ -2090,7 +2090,7 @@ ++ eyre-take |= $: eyre-gate=_eyre-gate now=@da - scry=sley + scry=roof take-args=[=wire =duct wrapped-sign=(hypo sign:eyre-gate)] expected-moves=(list move:eyre-gate) == @@ -2110,7 +2110,7 @@ ++ eyre-take-with-comparator |= $: eyre-gate=_eyre-gate now=@da - scry=sley + scry=roof take-args=[=wire =duct wrapped-sign=(hypo sign:eyre-gate)] move-comparator=$-((list move:eyre-gate) tang) == @@ -2202,7 +2202,7 @@ ++ perform-authentication |= $: eyre-gate=_eyre-gate start-now=@da - scry=sley + scry=roof == ^- [tang _eyre-gate] :: the browser then fetches the login page @@ -2276,7 +2276,7 @@ :: ++ perform-init-start-channel |= $: eyre-gate=_eyre-gate - scry=sley + scry=roof == ^- [tang _eyre-gate] :: @@ -2366,10 +2366,10 @@ :_ eyre-gate :(weld results1 results2 results3) :: -++ scry-provides-code ^- sley - |= [* (unit (set monk)) =term =beam] +++ scry-provides-code ^- roof + |= [gang =term =beam] ^- (unit (unit cage)) - ?: &(=(%ca term) =(/hoon/handler/gen s.beam)) + ?: &(=(%ca term) =(/gen/handler/hoon s.beam)) :+ ~ ~ vase+!>(!>(|=(* |=(* [[%404 ~] ~])))) ?: &(=(%cb term) =(/json s.beam)) diff --git a/pkg/arvo/tests/sys/vane/gall.hoon b/pkg/arvo/tests/sys/vane/gall.hoon index c4c71b6b5..ac7708842 100644 --- a/pkg/arvo/tests/sys/vane/gall.hoon +++ b/pkg/arvo/tests/sys/vane/gall.hoon @@ -21,7 +21,7 @@ =/ expected-moves=(list move:gall-gate) ~ :: =/ res - (gall-call gall-gate time *sley call-args expected-moves) + (gall-call gall-gate time *roof call-args expected-moves) :: -.res :: +test-conf: test %conf; TODO: test clay response @@ -48,7 +48,7 @@ =/ expected-moves=(list move:gall-gate) ~[move] :: =/ res - (gall-call gall-gate time *sley call-args expected-moves) + (gall-call gall-gate time *roof call-args expected-moves) :: -.res :: +gall-call: have %gall run a +task and assert it produces expected-moves @@ -56,7 +56,7 @@ ++ gall-call |= $: gall-gate=_gall-gate now=@da - scry=sley + scry=roof call-args=[=duct =type wrapped-task=(hobo task:able:gall)] expected-moves=(list move:gall-gate) == diff --git a/pkg/arvo/tests/sys/vane/iris.hoon b/pkg/arvo/tests/sys/vane/iris.hoon index 6ea991374..ccd4539a2 100644 --- a/pkg/arvo/tests/sys/vane/iris.hoon +++ b/pkg/arvo/tests/sys/vane/iris.hoon @@ -16,7 +16,7 @@ %- http-client-call :* http-client-gate now=~1111.1.1 - scry=*sley + scry=*roof call-args=[duct=~[/initial-born-duct] ~ [%born ~]] expected-moves=~ == @@ -33,7 +33,7 @@ %- http-client-call :* http-client-gate now=(add ~1111.1.1 ~s1) - scry=*sley + scry=*roof ^= call-args :* duct=~[/http-get-request] ~ %request @@ -57,7 +57,7 @@ %- http-client-call :* http-client-gate now=(add ~1111.1.1 ~s2) - scry=*sley + scry=*roof ^= call-args :+ duct=~[/initial-born-duct] ~ ^- task:able:iris @@ -112,7 +112,7 @@ %- http-client-call :* http-client-gate now=~1111.1.1 - scry=*sley + scry=*roof call-args=[duct=~[/initial-born-duct] ~ [%born ~]] expected-moves=~ == @@ -129,7 +129,7 @@ %- http-client-call :* http-client-gate now=(add ~1111.1.1 ~s1) - scry=*sley + scry=*roof ^= call-args :* duct=~[/http-get-request] ~ %request @@ -153,7 +153,7 @@ %- http-client-call :* http-client-gate now=(add ~1111.1.1 ~s2) - scry=*sley + scry=*roof ^= call-args :+ duct=~[/initial-born-duct] ~ ^- task:able:iris @@ -190,7 +190,7 @@ %- http-client-call :* http-client-gate now=(add ~1111.1.1 ~s3) - scry=*sley + scry=*roof ^= call-args :+ duct=~[/initial-born-duct] ~ ^- task:able:iris @@ -223,7 +223,7 @@ %- http-client-call :* http-client-gate now=(add ~1111.1.1 ~s4) - scry=*sley + scry=*roof ^= call-args :+ duct=~[/initial-born-duct] ~ ^- task:able:iris @@ -269,7 +269,7 @@ %- http-client-call :* http-client-gate now=~1111.1.1 - scry=*sley + scry=*roof call-args=[duct=~[/initial-born-duct] ~ [%born ~]] expected-moves=~ == @@ -286,7 +286,7 @@ %- http-client-call :* http-client-gate now=(add ~1111.1.1 ~s1) - scry=*sley + scry=*roof ^= call-args :* duct=~[/http-get-request] ~ %request @@ -310,7 +310,7 @@ %- http-client-call :* http-client-gate now=(add ~1111.1.1 ~s2) - scry=*sley + scry=*roof ^= call-args :+ duct=~[/initial-born-duct] ~ ^- task:able:iris @@ -347,7 +347,7 @@ %- http-client-call :* http-client-gate now=(add ~1111.1.1 ~s3) - scry=*sley + scry=*roof ^= call-args :* duct=~[/http-get-request] ~ %cancel-request @@ -375,7 +375,7 @@ %- http-client-call :* http-client-gate now=~1111.1.1 - scry=*sley + scry=*roof call-args=[duct=~[/initial-born-duct] ~ [%born ~]] expected-moves=~ == @@ -392,7 +392,7 @@ %- http-client-call :* http-client-gate now=(add ~1111.1.1 ~s1) - scry=*sley + scry=*roof ^= call-args :* duct=~[/http-get-request] ~ %request @@ -416,7 +416,7 @@ %- http-client-call :* http-client-gate now=(add ~1111.1.1 ~s2) - scry=*sley + scry=*roof ^= call-args :+ duct=~[/initial-born-duct] ~ ^- task:able:iris @@ -448,7 +448,7 @@ %- http-client-call :* http-client-gate now=~1111.1.1 - scry=*sley + scry=*roof call-args=[duct=~[/initial-born-duct] ~ [%born ~]] expected-moves=~ == @@ -465,7 +465,7 @@ %- http-client-call :* http-client-gate now=(add ~1111.1.1 ~s1) - scry=*sley + scry=*roof ^= call-args :* duct=~[/http-get-request] ~ %request @@ -488,7 +488,7 @@ %- http-client-call :* http-client-gate now=(add ~1111.1.1 ~s2) - scry=*sley + scry=*roof ^= call-args :+ duct=~[/secondary-born-duct] ~ ^- task:able:iris @@ -513,7 +513,7 @@ ++ http-client-call |= $: http-client-gate=_http-client-gate now=@da - scry=sley + scry=roof call-args=[=duct type=* wrapped-task=(hobo task:able:iris)] expected-moves=(list move:http-client-gate) == diff --git a/pkg/arvo/tests/sys/zuse/crypto/secp256k1.hoon b/pkg/arvo/tests/sys/zuse/crypto/secp256k1.hoon new file mode 100644 index 000000000..ee27c2ef8 --- /dev/null +++ b/pkg/arvo/tests/sys/zuse/crypto/secp256k1.hoon @@ -0,0 +1,119 @@ +:: tests for secp256k1 elliptic curve cryptography +:: +/+ *test +=/ ecc secp256k1:secp:crypto +|% +:: from libsecp256k1 src/modules/recovery/tests_impl.h +:: there are more tests there, ports would be welcome +++ test-ecdsa-recovery-end-to-end + =/ util + =/ eny=@ 'ecdsa recovery test "entropy"' + =/ rnd ~(. og eny) + =/ dom t.ecc + |% + ++ random-scalar-order + =* core . + =^ z rnd (rads:rnd (dec n.dom)) + [`@`.+(z) core] + -- + :: generate a random key and message + %+ category "random" + %- zing + =| [i=@ out=(list tang)] + |- ^+ out + ?: =(i 64) out + =^ message util random-scalar-order:util + =^ privkey util random-scalar-order:util + =/ pubkey (priv-to-pub.ecc privkey) + =/ msghash (shax (shax message)) + =/ sig (ecdsa-raw-sign.ecc msghash privkey) + =/ reckey (ecdsa-raw-recover.ecc msghash sig) + %= $ + i .+(i) + out :_ out + %+ expect-eq + !> pubkey + !> reckey + == + :: +++ test-ecdsa-recovery-edge-cases + =< %+ category "edge cases" + (zing ~[t1 t2 t3 t4 t5]) + =/ msg32=@ '...egassem terces yrev a si sihT' + =/ r=@ux 0x67cb.285f.9cd1.94e8. + 40d6.2939.7af5.5696. + 62fd.e446.4999.5963. + 179a.7dd1.7bd2.3532 + =/ s=@ux 0x4b1b.7df3.4ce1.f68e. + 694f.f6f1.1ac7.51dd. + 7dd7.3e38.7ee4.fc86. + 6e1b.e8ec.c7dd.9557 + =/ r %+ turn (gulf 0 3) + |= v=@ + (mule |.((ecdsa-raw-recover.ecc msg32 v r s))) + =/ t1 %+ expect-eq + !> %.n + !> -.&1.r + =/ t3 %+ expect-eq + !> %.n + !> -.&3.r + =/ t4 %+ expect-eq + !> %.n + !> -.&4.r + =/ t2 %+ expect-eq + !> :+ %.y + 0x8687.4a6b.24a7.5462. + 7116.560e.7ae1.5cd6. + 9eb3.3e73.b4d8.c810. + 33b2.7c2f.a9cf.5d1c + 0xe13f.19fa.8dea.0d1a. + e3e8.4c91.146c.3386. + 8f87.730e.31bb.486e. + b370.05d1.40cc.7a55 + !> &2.r + :: (4,4) should recover with all 4 recids + :_ . + ^= t5 + %- expect-eq :_ + !> %+ turn (gulf 0 3) + |= v=@ + (mule |.((ecdsa-raw-recover.ecc msg32 v 4 4))) + !> + :~ :+ %.y + 0x8a3d.70c0.4104.68e4. + 5739.39af.01b9.9ea7. + b206.4910.6d55.acf9. + f558.eba2.8ed5.9a2e + 0x77eb.58dd.36ed.385b. + 3dcf.e7d3.62c8.16f3. + 7d3b.ef3e.4a34.94b8. + 6fcc.8357.5184.9329 + :+ %.y + 0x3e99.0254.a50d.6599. + 26c9.28ef.8b54.181e. + e67e.27ff.bf63.eb69. + 294b.9ab6.d27b.a225 + 0xa898.847e.931e.9b10. + 2c0f.9b0f.9597.07ba. + f9b8.5e93.6425.fc72. + e80c.a868.e535.dfb4 + :+ %.y + 0x7e15.24fa.06ba.fd6e. + b9c0.2f27.9e13.1314. + be93.0570.0fc6.9e80. + d54d.29ab.3606.3f23 + 0x3f86.a967.33e7.723d. + fdde.4e03.382d.8c45. + 3493.fa88.9050.5ba5. + cfc4.0a8b.226b.1b00 + :+ %.y + 0xb337.c9b7.4ca9.9ea9. + 63c6.560d.2558.cdf0. + 9c73.0120.8409.649a. + 8a6d.1fb1.0e1c.b946 + 0x11df.5391.ee11.6de0. + a722.bc0f.be5f.6575. + 3d07.03a9.9925.0581. + f7de.cd5e.f0f4.f809 + == +-- diff --git a/pkg/arvo/tests/sys/zuse/format.hoon b/pkg/arvo/tests/sys/zuse/format.hoon index 3ad678b39..25d1918e9 100644 --- a/pkg/arvo/tests/sys/zuse/format.hoon +++ b/pkg/arvo/tests/sys/zuse/format.hoon @@ -85,7 +85,7 @@ :: path) :: ++ test-beam - =/ b=beam [[p=~zod q=%home r=[%ud p=12]] s=/hoon/zuse/sys] + =/ b=beam [[p=~zod q=%home r=[%ud p=12]] s=/sys/zuse/hoon] =/ p=path /~zod/home/12/sys/zuse/hoon ;: weld :: proper encode diff --git a/pkg/urbit/include/c/motes.h b/pkg/urbit/include/c/motes.h index da22a6b56..10f00710e 100644 --- a/pkg/urbit/include/c/motes.h +++ b/pkg/urbit/include/c/motes.h @@ -798,8 +798,10 @@ # define c3__off c3_s3('o','f','f') # define c3__ogre c3_s4('o','g','r','e') # define c3__old c3_s3('o','l','d') +# define c3__omen c3_s4('o','m','e','n') # define c3__on c3_s2('o','n') # define c3__onan c3_s4('o','n','a','n') +# define c3__once c3_s4('o','n','c','e') # define c3__one c3_s3('o','n','e') # define c3__only c3_s4('o','n','l','y') # define c3__oops c3_s4('o','o','p','s') @@ -1228,6 +1230,7 @@ # define c3__weak c3_s4('w','e','a','k') # define c3__web c3_s3('w','e','b') # define c3__wet c3_s3('w','e','t') +# define c3__wend c3_s4('w','e','n','d') # define c3__werp c3_s4('w','e','r','p') # define c3__west c3_s4('w','e','s','t') # define c3__what c3_s4('w','h','a','t') diff --git a/pkg/urbit/include/jets/k.h b/pkg/urbit/include/jets/k.h index 0f0968ea1..cbde1e3ef 100644 --- a/pkg/urbit/include/jets/k.h +++ b/pkg/urbit/include/jets/k.h @@ -6,7 +6,9 @@ **/ u3_noun u3ka_add(u3_noun a, u3_noun b); u3_noun u3ka_dec(u3_atom a); + u3_noun u3ka_div(u3_noun a, u3_noun b); u3_noun u3ka_sub(u3_noun a, u3_noun b); + u3_noun u3ka_mod(u3_noun a, u3_noun b); u3_noun u3ka_mul(u3_noun a, u3_noun b); u3_noun u3ka_gth(u3_noun a, u3_noun b); u3_noun u3ka_lte(u3_noun a, u3_noun b); @@ -19,6 +21,10 @@ /* u3kc: tier 3 functions */ + u3_noun + u3kc_con(u3_noun a, + u3_noun b); + /* u3kc_mix(): binary xor. */ u3_noun diff --git a/pkg/urbit/include/jets/q.h b/pkg/urbit/include/jets/q.h index 258efb9ee..3f25452ca 100644 --- a/pkg/urbit/include/jets/q.h +++ b/pkg/urbit/include/jets/q.h @@ -70,6 +70,11 @@ u3_noun u3qc_swp(u3_atom, u3_atom); u3_noun u3qc_sqt(u3_atom); + u3_noun u3_po_find_prefix(c3_y one, c3_y two, c3_y three); + u3_noun u3_po_find_suffix(c3_y one, c3_y two, c3_y three); + void u3_po_to_prefix(u3_noun id, c3_y* a, c3_y* b, c3_y* c); + void u3_po_to_suffix(u3_noun id, c3_y* a, c3_y* b, c3_y* c); + /** Tier 4. **/ u3_noun u3qdb_all(u3_noun, u3_noun); @@ -257,8 +262,6 @@ # define u3qfu_van_fan 28 # define u3qfu_van_rib 58 -# define u3qfu_van_vrf 59 -# define u3qfu_van_vet 118 -# define u3qfu_van_fab 119 +# define u3qfu_van_vet 59 void u3qf_test(const c3_c*, u3_noun); diff --git a/pkg/urbit/include/jets/w.h b/pkg/urbit/include/jets/w.h index 75cde3c47..ab953abb0 100644 --- a/pkg/urbit/include/jets/w.h +++ b/pkg/urbit/include/jets/w.h @@ -127,11 +127,16 @@ u3_noun u3we_loss(u3_noun); u3_noun u3we_lune(u3_noun); u3_noun u3we_mink(u3_noun); + u3_noun u3we_mole(u3_noun); u3_noun u3we_mule(u3_noun); u3_noun u3we_repg(u3_noun); u3_noun u3we_rexp(u3_noun); u3_noun u3we_trip(u3_noun); + u3_noun u3we_scow(u3_noun); + u3_noun u3we_scot(u3_noun); + u3_noun u3we_slaw(u3_noun); + u3_noun u3we_pfix(u3_noun); u3_noun u3we_plug(u3_noun); u3_noun u3we_pose(u3_noun); diff --git a/pkg/urbit/include/noun/allocate.h b/pkg/urbit/include/noun/allocate.h index 4fb4859d4..564b69dba 100644 --- a/pkg/urbit/include/noun/allocate.h +++ b/pkg/urbit/include/noun/allocate.h @@ -669,3 +669,8 @@ void* ptr_v, void (*pat_f)(u3_atom, void*), c3_o (*cel_f)(u3_noun, void*)); + + /* u3a_string(): `a` as an on-loom c-string. + */ + c3_c* + u3a_string(u3_atom a); diff --git a/pkg/urbit/include/noun/retrieve.h b/pkg/urbit/include/noun/retrieve.h index d3cfd429c..de4f645ec 100644 --- a/pkg/urbit/include/noun/retrieve.h +++ b/pkg/urbit/include/noun/retrieve.h @@ -34,52 +34,37 @@ c3_o u3r_mean(u3_noun a, ...); + /* u3r_mug_both(): Join two mugs. + */ + c3_l + u3r_mug_both(c3_w lef_w, c3_w rit_w); + /* u3r_mug_bytes(): Compute the mug of `buf`, `len`, LSW first. */ - c3_w + c3_l u3r_mug_bytes(const c3_y *buf_y, c3_w len_w); - /* u3r_mug_chub(): Compute the mug of `num`, LSW first. + /* u3r_mug_c(): Compute the mug of `a`, LSB first. */ - c3_w - u3r_mug_chub(c3_d num_d); - - /* u3r_mug_string(): Compute the mug of `a`, LSB first. - */ - c3_w - u3r_mug_string(const c3_c *a_c); - - /* u3r_mug_words(): 31-bit nonzero MurmurHash3 on raw words. - */ - c3_w - u3r_mug_words(const c3_w* key_w, c3_w len_w); - - /* u3r_mug_both(): Join two mugs. - */ - c3_w - u3r_mug_both(c3_w lef_w, c3_w rit_w); + c3_l + u3r_mug_c(const c3_c *a_c); /* u3r_mug_cell(): Compute the mug of the cell `[hed tel]`. */ - c3_w + c3_l u3r_mug_cell(u3_noun hed, u3_noun tel); - /* u3r_mug_trel(): Compute the mug of `[a b c]`. + /* u3r_mug_chub(): Compute the mug of `num`, LSW first. */ - c3_w - u3r_mug_trel(u3_noun a, - u3_noun b, - u3_noun c); + c3_l + u3r_mug_chub(c3_d num_d); - /* u3r_mug_qual(): Compute the mug of `[a b c d]`. + /* u3r_mug_words(): 31-bit nonzero MurmurHash3 on raw words. */ - c3_w - u3r_mug_qual(u3_noun a, - u3_noun b, - u3_noun c, - u3_noun d); + c3_l + u3r_mug_words(const c3_w* key_w, c3_w len_w); /* u3r_mug(): statefully mug a noun with 31-bit murmur3. */ diff --git a/pkg/urbit/include/vere/vere.h b/pkg/urbit/include/vere/vere.h index bc18f11f1..0df965623 100644 --- a/pkg/urbit/include/vere/vere.h +++ b/pkg/urbit/include/vere/vere.h @@ -382,8 +382,7 @@ */ typedef enum { u3_pico_full = 0, - u3_pico_mine = 1, - u3_pico_last = 2 + u3_pico_once = 1 } u3_pico_type; /* u3_pico: proto-peek @@ -395,12 +394,8 @@ u3_noun gan; // leakset u3_pico_type typ_e; // type-tagged union { // - u3_noun ful; // full: /care/beam - struct { // mine: - c3_m car_m; // care - u3_noun pax; // /desk/case/path - } min_u; // - struct { // last: + u3_noun ful; // (each path [%beam term beam]) + struct { // once: c3_m car_m; // care u3_atom des; // desk u3_noun pax; // /path @@ -413,9 +408,8 @@ typedef struct _u3_peek { void* ptr_v; // context u3_peek_cb fun_f; // callback - u3_noun now; // XX - u3_noun gan; // leakset - u3_noun ful; // /care/beam + u3_pico_type typ_e; // type + u3_noun sam; // +peek sample } u3_peek; /* u3_writ_type: king->serf ipc message types @@ -544,8 +538,9 @@ u3_psat_init = 0, // initialized u3_psat_boot = 1, // bootstrap u3_psat_play = 2, // replaying - u3_psat_work = 3, // working - u3_psat_done = 4 // shutting down + u3_psat_wyrd = 3, // versioning + u3_psat_work = 4, // working + u3_psat_done = 5 // shutting down } u3_psat; /* u3_boot: bootstrap event sequence @@ -1240,16 +1235,6 @@ void* ptr_v, u3_peek_cb fun_f); - /* u3_pier_peek_mine(): read namespace, injecting ship. - */ - void - u3_pier_peek_mine(u3_pier* pir_u, - u3_noun gan, - c3_m car_m, - u3_noun pax, - void* ptr_v, - u3_peek_cb fun_f); - /* u3_pier_peek_last(): read namespace, injecting ship and case. */ void diff --git a/pkg/urbit/jets/a/div.c b/pkg/urbit/jets/a/div.c index ce2df181e..9ac4eeb5f 100644 --- a/pkg/urbit/jets/a/div.c +++ b/pkg/urbit/jets/a/div.c @@ -44,3 +44,13 @@ return u3qa_div(a, b); } } + + +u3_noun +u3ka_div(u3_noun a, + u3_noun b) +{ + u3_noun c = u3qa_div(a, b); + u3z(a); u3z(b); + return c; +} diff --git a/pkg/urbit/jets/a/mod.c b/pkg/urbit/jets/a/mod.c index f80834e1b..af9f6662b 100644 --- a/pkg/urbit/jets/a/mod.c +++ b/pkg/urbit/jets/a/mod.c @@ -10,15 +10,10 @@ u3qa_mod(u3_atom a, u3_atom b) { -#if 0 - if ( b == 3 && a == 2684227708 ) { - printf("dword at 0x27ff84ff8 is %" PRIu64 "\r\n", *(c3_d *)0x27ff84ff8); - *(c3_d *)0x27ff84ff8 = 25; - printf("see, we modified it\r\n"); - } -#endif if ( 0 == b ) { return u3m_bail(c3__exit); + } else if ( _(u3a_is_cat(a)) && _(u3a_is_cat(b)) ) { + return a % b; } else { mpz_t a_mp, b_mp; @@ -46,3 +41,12 @@ return u3qa_mod(a, b); } } + +u3_noun +u3ka_mod(u3_noun a, + u3_noun b) +{ + u3_noun c = u3qa_mod(a, b); + u3z(a); u3z(b); + return c; +} diff --git a/pkg/urbit/jets/c/con.c b/pkg/urbit/jets/c/con.c index 9fa8df142..841d2cc2e 100644 --- a/pkg/urbit/jets/c/con.c +++ b/pkg/urbit/jets/c/con.c @@ -43,3 +43,12 @@ return u3qc_con(a, b); } } + +u3_noun +u3kc_con(u3_noun a, + u3_noun b) +{ + u3_noun c = u3qc_con(a, b); + u3z(a); u3z(b); + return c; +} diff --git a/pkg/urbit/jets/c/muk.c b/pkg/urbit/jets/c/muk.c index 1da1ece64..b20f2b264 100644 --- a/pkg/urbit/jets/c/muk.c +++ b/pkg/urbit/jets/c/muk.c @@ -7,76 +7,70 @@ /* functions */ u3_noun -u3qc_muk(u3_atom seed, +u3qc_muk(u3_atom sed, u3_atom len, u3_atom key) { - c3_w key_w = u3r_met(3, key); - - // XX revisit - // - // the first two conditions are explicitly asserted in +muk; - // the third is implicit in the pad subtraction. - // - // the first assertion is semantically required for murmur32, - // the latter two are particular to our hoon implementation. - // - // +muk (via +mug) is routinely "called" on samples that - // violate these assertions. - // are all three necessary for the rest of +muk to be correct? - // - if ( (u3r_met(5, seed) > 1) || - (u3r_met(0, len) > 31) || - (key_w > len) ) - { - return u3m_bail(c3__exit); + if ( c3n == u3a_is_cat(len) ) { + return u3m_bail(c3__fail); } else { - c3_w seed_w = u3r_word(0, seed); - c3_w len_w = u3r_word(0, len); - c3_o loc_o = c3n; - c3_y* key_y = 0; - c3_w out_w; + c3_w len_w = (c3_w)len; + c3_w key_w = u3r_met(3, key); - // if we're hashing more bytes than we have, allocate and copy - // to ensure trailing null bytes + // NB: this condition is implicit in the pad subtraction // - if ( len_w > key_w ) { - loc_o = c3y; - key_y = u3a_calloc(sizeof(c3_y), len_w); - u3r_bytes(0, len_w, key_y, key); + if ( key_w > len_w ) { + return u3m_bail(c3__exit); } - else if ( len_w > 0 ) { - key_y = ( c3y == u3a_is_cat(key) ) - ? (c3_y*)&key - : (c3_y*)((u3a_atom*)u3a_to_ptr(key))->buf_w; + else { + c3_w sed_w = u3r_word(0, sed); + c3_o loc_o = c3n; + c3_y* key_y = 0; + c3_w out_w; + + // if we're hashing more bytes than we have, allocate and copy + // to ensure trailing null bytes + // + if ( len_w > key_w ) { + loc_o = c3y; + key_y = u3a_calloc(sizeof(c3_y), len_w); + u3r_bytes(0, len_w, key_y, key); + } + else if ( len_w > 0 ) { + // XX assumes little-endian + // + key_y = ( c3y == u3a_is_cat(key) ) + ? (c3_y*)&key + : (c3_y*)((u3a_atom*)u3a_to_ptr(key))->buf_w; + } + + MurmurHash3_x86_32(key_y, len_w, sed_w, &out_w); + + if ( c3y == loc_o ) { + u3a_free(key_y); + } + + return u3i_words(1, &out_w); } - - MurmurHash3_x86_32(key_y, len_w, seed_w, &out_w); - - if ( c3y == loc_o ) { - u3a_free(key_y); - } - - return u3i_words(1, &out_w); } } u3_noun u3wc_muk(u3_noun cor) { - u3_noun seed, len, key; + u3_noun sed, len, key; + u3x_mean(cor, u3x_sam_2, &sed, + u3x_sam_6, &len, + u3x_sam_7, &key, 0); - if ( (c3n == u3r_mean(cor, u3x_sam_2, &seed, - u3x_sam_6, &len, - u3x_sam_7, &key, 0)) || - (c3n == u3ud(seed)) || - (c3n == u3ud(len)) || - (c3n == u3ud(key)) ) + if ( (c3n == u3ud(sed)) + || (c3n == u3ud(len)) + || (c3n == u3ud(key)) ) { return u3m_bail(c3__exit); } else { - return u3qc_muk(seed, len, key); + return u3qc_muk(sed, len, key); } } diff --git a/pkg/urbit/jets/c/po.c b/pkg/urbit/jets/c/po.c index b043d9afd..c907ad48a 100644 --- a/pkg/urbit/jets/c/po.c +++ b/pkg/urbit/jets/c/po.c @@ -3,102 +3,1423 @@ */ #include "all.h" - - // good old linear search - // - static u3_noun - _po_find(u3_noun buf, - u3_noun a) - { - if ( !_(u3a_is_cat(a)) ) { - return u3_nul; - } - else { - c3_w i_w; - c3_w a_w = a; - - for ( i_w = 0; i_w < 256; i_w++ ) { - c3_y byt_y[3]; - c3_w but_w; - - u3r_bytes((i_w * 3), 3, byt_y, buf); - but_w = (byt_y[0] | (byt_y[1] << 8) | (byt_y[2] << 16)); - - if ( but_w == a_w ) { - return u3nc(u3_nul, i_w); - } +u3_noun +u3_po_find_prefix(c3_y one, c3_y two, c3_y three) { + switch (one) { + case 'b': switch (two) { + case 'a': switch (three) { + case 'c': return u3nc(0, 238); + case 'l': return u3nc(0, 107); + case 'n': return u3nc(0, 92); + case 'r': return u3nc(0, 183); + case 't': return u3nc(0, 172); + default: return 0; } - return u3_nul; + case 'i': switch (three) { + case 'c': return u3nc(0, 56); + case 'd': return u3nc(0, 106); + case 'l': return u3nc(0, 144); + case 'n': return u3nc(0, 2); + case 's': return u3nc(0, 60); + case 't': return u3nc(0, 182); + default: return 0; + } + case 'o': switch (three) { + case 'l': return u3nc(0, 45); + case 'n': return u3nc(0, 244); + case 'r': return u3nc(0, 188); + case 's': return u3nc(0, 171); + case 't': return u3nc(0, 98); + default: return 0; + } + default: return 0; } + case 'd': switch (two) { + case 'a': switch (three) { + case 'b': return u3nc(0, 181); + case 'c': return u3nc(0, 117); + case 'l': return u3nc(0, 37); + case 'n': return u3nc(0, 234); + case 'p': return u3nc(0, 66); + case 'r': return u3nc(0, 23); + case 's': return u3nc(0, 61); + case 't': return u3nc(0, 215); + case 'v': return u3nc(0, 105); + default: return 0; + } + case 'i': switch (three) { + case 'b': return u3nc(0, 179); + case 'f': return u3nc(0, 57); + case 'g': return u3nc(0, 193); + case 'l': return u3nc(0, 49); + case 'n': return u3nc(0, 217); + case 'r': return u3nc(0, 11); + case 's': return u3nc(0, 129); + case 'v': return u3nc(0, 116); + default: return 0; + } + case 'o': switch (three) { + case 'c': return u3nc(0, 146); + case 'l': return u3nc(0, 102); + case 'n': return u3nc(0, 233); + case 'p': return u3nc(0, 18); + case 'r': return u3nc(0, 24); + case 's': return u3nc(0, 187); + case 't': return u3nc(0, 47); + case 'v': return u3nc(0, 236); + case 'z': return u3nc(0, 0); + default: return 0; + } + default: return 0; + } + case 'f': switch (two) { + case 'a': switch (three) { + case 'b': return u3nc(0, 120); + case 'd': return u3nc(0, 206); + case 'l': return u3nc(0, 152); + case 'm': return u3nc(0, 214); + case 'n': return u3nc(0, 158); + case 's': return u3nc(0, 195); + default: return 0; + } + case 'i': switch (three) { + case 'd': return u3nc(0, 8); + case 'g': return u3nc(0, 138); + case 'l': return u3nc(0, 194); + case 'n': return u3nc(0, 90); + case 'p': return u3nc(0, 255); + case 'r': return u3nc(0, 169); + case 't': return u3nc(0, 226); + default: return 0; + } + case 'o': switch (three) { + case 'd': return u3nc(0, 247); + case 'g': return u3nc(0, 20); + case 'l': return u3nc(0, 27); + case 'n': return u3nc(0, 91); + case 'p': return u3nc(0, 213); + case 'r': return u3nc(0, 50); + case 's': return u3nc(0, 46); + case 't': return u3nc(0, 221); + default: return 0; + } + default: return 0; + } + case 'h': switch (two) { + case 'a': switch (three) { + case 'b': return u3nc(0, 209); + case 'c': return u3nc(0, 174); + case 'd': return u3nc(0, 145); + case 'l': return u3nc(0, 203); + case 'n': return u3nc(0, 41); + case 'p': return u3nc(0, 156); + case 'r': return u3nc(0, 198); + case 's': return u3nc(0, 170); + case 't': return u3nc(0, 218); + case 'v': return u3nc(0, 176); + default: return 0; + } + case 'i': switch (three) { + case 'd': return u3nc(0, 7); + case 'l': return u3nc(0, 190); + case 'n': return u3nc(0, 200); + default: return 0; + } + case 'o': switch (three) { + case 'b': return u3nc(0, 197); + case 'c': return u3nc(0, 223); + case 'd': return u3nc(0, 26); + case 'l': return u3nc(0, 32); + case 'p': return u3nc(0, 22); + case 's': return u3nc(0, 180); + default: return 0; + } + default: return 0; + } + case 'l': switch (two) { + case 'a': switch (three) { + case 'b': return u3nc(0, 161); + case 'c': return u3nc(0, 34); + case 'd': return u3nc(0, 235); + case 'g': return u3nc(0, 205); + case 'n': return u3nc(0, 232); + case 'p': return u3nc(0, 240); + case 'r': return u3nc(0, 225); + case 's': return u3nc(0, 128); + case 't': return u3nc(0, 134); + case 'v': return u3nc(0, 252); + default: return 0; + } + case 'i': switch (three) { + case 'b': return u3nc(0, 39); + case 'd': return u3nc(0, 21); + case 'g': return u3nc(0, 111); + case 'n': return u3nc(0, 178); + case 's': return u3nc(0, 9); + case 't': return u3nc(0, 5); + case 'v': return u3nc(0, 36); + default: return 0; + } + case 'o': switch (three) { + case 'c': return u3nc(0, 69); + case 'd': return u3nc(0, 186); + case 'm': return u3nc(0, 166); + case 'n': return u3nc(0, 135); + case 'p': return u3nc(0, 63); + case 'r': return u3nc(0, 25); + case 's': return u3nc(0, 48); + default: return 0; + } + default: return 0; + } + case 'm': switch (two) { + case 'a': switch (three) { + case 'c': return u3nc(0, 191); + case 'g': return u3nc(0, 103); + case 'l': return u3nc(0, 110); + case 'p': return u3nc(0, 130); + case 'r': return u3nc(0, 1); + case 's': return u3nc(0, 202); + case 't': return u3nc(0, 253); + default: return 0; + } + case 'i': switch (three) { + case 'c': return u3nc(0, 157); + case 'd': return u3nc(0, 62); + case 'g': return u3nc(0, 199); + case 'l': return u3nc(0, 212); + case 'n': return u3nc(0, 79); + case 'p': return u3nc(0, 254); + case 'r': return u3nc(0, 31); + case 's': return u3nc(0, 126); + case 't': return u3nc(0, 196); + default: return 0; + } + case 'o': switch (three) { + case 'c': return u3nc(0, 148); + case 'd': return u3nc(0, 19); + case 'g': return u3nc(0, 162); + case 'l': return u3nc(0, 67); + case 'n': return u3nc(0, 122); + case 'p': return u3nc(0, 208); + case 'r': return u3nc(0, 93); + case 's': return u3nc(0, 231); + case 't': return u3nc(0, 82); + default: return 0; + } + default: return 0; + } + case 'n': switch (two) { + case 'a': switch (three) { + case 'c': return u3nc(0, 219); + case 'l': return u3nc(0, 230); + case 'm': return u3nc(0, 243); + case 'p': return u3nc(0, 87); + case 'r': return u3nc(0, 65); + case 't': return u3nc(0, 77); + case 'v': return u3nc(0, 137); + default: return 0; + } + case 'i': switch (three) { + case 'b': return u3nc(0, 140); + case 'd': return u3nc(0, 72); + case 'l': return u3nc(0, 210); + case 'm': return u3nc(0, 224); + case 's': return u3nc(0, 124); + default: return 0; + } + case 'o': switch (three) { + case 'c': return u3nc(0, 250); + case 'd': return u3nc(0, 136); + case 'l': return u3nc(0, 216); + case 'm': return u3nc(0, 139); + case 'p': return u3nc(0, 88); + case 'r': return u3nc(0, 97); + case 's': return u3nc(0, 211); + case 'v': return u3nc(0, 70); + default: return 0; + } + default: return 0; + } + case 'p': switch (two) { + case 'a': switch (three) { + case 'c': return u3nc(0, 149); + case 'd': return u3nc(0, 114); + case 'g': return u3nc(0, 141); + case 'l': return u3nc(0, 127); + case 'n': return u3nc(0, 78); + case 'r': return u3nc(0, 185); + case 's': return u3nc(0, 33); + case 't': return u3nc(0, 159); + default: return 0; + } + case 'i': switch (three) { + case 'c': return u3nc(0, 104); + case 'd': return u3nc(0, 43); + case 'l': return u3nc(0, 51); + case 'n': return u3nc(0, 165); + case 't': return u3nc(0, 242); + default: return 0; + } + case 'o': switch (three) { + case 'c': return u3nc(0, 173); + case 'd': return u3nc(0, 81); + case 'l': return u3nc(0, 239); + case 'n': return u3nc(0, 248); + case 's': return u3nc(0, 86); + default: return 0; + } + default: return 0; + } + case 'r': switch (two) { + case 'a': switch (three) { + case 'b': return u3nc(0, 131); + case 'c': return u3nc(0, 184); + case 'd': return u3nc(0, 201); + case 'g': return u3nc(0, 204); + case 'l': return u3nc(0, 143); + case 'm': return u3nc(0, 52); + case 'n': return u3nc(0, 123); + case 'p': return u3nc(0, 228); + case 'v': return u3nc(0, 150); + default: return 0; + } + case 'i': switch (three) { + case 'b': return u3nc(0, 222); + case 'c': return u3nc(0, 167); + case 'd': return u3nc(0, 147); + case 'g': return u3nc(0, 16); + case 'l': return u3nc(0, 64); + case 'n': return u3nc(0, 28); + case 'p': return u3nc(0, 151); + case 's': return u3nc(0, 220); + case 't': return u3nc(0, 80); + case 'v': return u3nc(0, 237); + default: return 0; + } + case 'o': switch (three) { + case 'c': return u3nc(0, 58); + case 'l': return u3nc(0, 133); + case 'n': return u3nc(0, 96); + case 'p': return u3nc(0, 75); + case 's': return u3nc(0, 245); + case 'v': return u3nc(0, 35); + default: return 0; + } + default: return 0; + } + case 's': switch (two) { + case 'a': switch (three) { + case 'b': return u3nc(0, 13); + case 'l': return u3nc(0, 115); + case 'm': return u3nc(0, 4); + case 'n': return u3nc(0, 68); + case 'p': return u3nc(0, 177); + case 'r': return u3nc(0, 229); + case 't': return u3nc(0, 38); + case 'v': return u3nc(0, 85); + default: return 0; + } + case 'i': switch (three) { + case 'b': return u3nc(0, 15); + case 'c': return u3nc(0, 74); + case 'd': return u3nc(0, 119); + case 'g': return u3nc(0, 6); + case 'l': return u3nc(0, 30); + case 'm': return u3nc(0, 163); + case 'p': return u3nc(0, 95); + case 't': return u3nc(0, 71); + case 'v': return u3nc(0, 112); + default: return 0; + } + case 'o': switch (three) { + case 'c': return u3nc(0, 100); + case 'g': return u3nc(0, 10); + case 'l': return u3nc(0, 17); + case 'm': return u3nc(0, 89); + case 'n': return u3nc(0, 164); + case 'p': return u3nc(0, 142); + case 'r': return u3nc(0, 251); + case 'v': return u3nc(0, 249); + default: return 0; + } + default: return 0; + } + case 't': switch (two) { + case 'a': switch (three) { + case 'b': return u3nc(0, 40); + case 'c': return u3nc(0, 160); + case 'd': return u3nc(0, 55); + case 'g': return u3nc(0, 113); + case 'l': return u3nc(0, 241); + case 'm': return u3nc(0, 83); + case 'n': return u3nc(0, 118); + case 'p': return u3nc(0, 168); + case 'r': return u3nc(0, 121); + case 's': return u3nc(0, 109); + default: return 0; + } + case 'i': switch (three) { + case 'c': return u3nc(0, 42); + case 'd': return u3nc(0, 175); + case 'l': return u3nc(0, 154); + case 'm': return u3nc(0, 108); + case 'n': return u3nc(0, 155); + case 'p': return u3nc(0, 73); + case 'r': return u3nc(0, 53); + default: return 0; + } + case 'o': switch (three) { + case 'b': return u3nc(0, 132); + case 'c': return u3nc(0, 189); + case 'd': return u3nc(0, 153); + case 'g': return u3nc(0, 29); + case 'l': return u3nc(0, 84); + case 'm': return u3nc(0, 192); + case 'n': return u3nc(0, 246); + case 'p': return u3nc(0, 207); + case 'r': return u3nc(0, 44); + default: return 0; + } + default: return 0; + } + case 'w': switch (two) { + case 'a': switch (three) { + case 'c': return u3nc(0, 12); + case 'l': return u3nc(0, 227); + case 'n': return u3nc(0, 3); + case 't': return u3nc(0, 101); + default: return 0; + } + case 'i': switch (three) { + case 'c': return u3nc(0, 99); + case 'd': return u3nc(0, 59); + case 'n': return u3nc(0, 54); + case 's': return u3nc(0, 14); + case 't': return u3nc(0, 76); + default: return 0; + } + case 'o': switch (three) { + case 'l': return u3nc(0, 125); + case 'r': return u3nc(0, 94); + default: return 0; + } + default: return 0; + } + default: return 0; + } +} + +void +u3_po_to_prefix(u3_noun id, c3_y* a, c3_y* b, c3_y* c) +{ + switch (id) { + case 0: *a = 'd'; *b = 'o'; *c = 'z'; break; + case 1: *a = 'm'; *b = 'a'; *c = 'r'; break; + case 2: *a = 'b'; *b = 'i'; *c = 'n'; break; + case 3: *a = 'w'; *b = 'a'; *c = 'n'; break; + case 4: *a = 's'; *b = 'a'; *c = 'm'; break; + case 5: *a = 'l'; *b = 'i'; *c = 't'; break; + case 6: *a = 's'; *b = 'i'; *c = 'g'; break; + case 7: *a = 'h'; *b = 'i'; *c = 'd'; break; + case 8: *a = 'f'; *b = 'i'; *c = 'd'; break; + case 9: *a = 'l'; *b = 'i'; *c = 's'; break; + case 10: *a = 's'; *b = 'o'; *c = 'g'; break; + case 11: *a = 'd'; *b = 'i'; *c = 'r'; break; + case 12: *a = 'w'; *b = 'a'; *c = 'c'; break; + case 13: *a = 's'; *b = 'a'; *c = 'b'; break; + case 14: *a = 'w'; *b = 'i'; *c = 's'; break; + case 15: *a = 's'; *b = 'i'; *c = 'b'; break; + case 16: *a = 'r'; *b = 'i'; *c = 'g'; break; + case 17: *a = 's'; *b = 'o'; *c = 'l'; break; + case 18: *a = 'd'; *b = 'o'; *c = 'p'; break; + case 19: *a = 'm'; *b = 'o'; *c = 'd'; break; + case 20: *a = 'f'; *b = 'o'; *c = 'g'; break; + case 21: *a = 'l'; *b = 'i'; *c = 'd'; break; + case 22: *a = 'h'; *b = 'o'; *c = 'p'; break; + case 23: *a = 'd'; *b = 'a'; *c = 'r'; break; + case 24: *a = 'd'; *b = 'o'; *c = 'r'; break; + case 25: *a = 'l'; *b = 'o'; *c = 'r'; break; + case 26: *a = 'h'; *b = 'o'; *c = 'd'; break; + case 27: *a = 'f'; *b = 'o'; *c = 'l'; break; + case 28: *a = 'r'; *b = 'i'; *c = 'n'; break; + case 29: *a = 't'; *b = 'o'; *c = 'g'; break; + case 30: *a = 's'; *b = 'i'; *c = 'l'; break; + case 31: *a = 'm'; *b = 'i'; *c = 'r'; break; + case 32: *a = 'h'; *b = 'o'; *c = 'l'; break; + case 33: *a = 'p'; *b = 'a'; *c = 's'; break; + case 34: *a = 'l'; *b = 'a'; *c = 'c'; break; + case 35: *a = 'r'; *b = 'o'; *c = 'v'; break; + case 36: *a = 'l'; *b = 'i'; *c = 'v'; break; + case 37: *a = 'd'; *b = 'a'; *c = 'l'; break; + case 38: *a = 's'; *b = 'a'; *c = 't'; break; + case 39: *a = 'l'; *b = 'i'; *c = 'b'; break; + case 40: *a = 't'; *b = 'a'; *c = 'b'; break; + case 41: *a = 'h'; *b = 'a'; *c = 'n'; break; + case 42: *a = 't'; *b = 'i'; *c = 'c'; break; + case 43: *a = 'p'; *b = 'i'; *c = 'd'; break; + case 44: *a = 't'; *b = 'o'; *c = 'r'; break; + case 45: *a = 'b'; *b = 'o'; *c = 'l'; break; + case 46: *a = 'f'; *b = 'o'; *c = 's'; break; + case 47: *a = 'd'; *b = 'o'; *c = 't'; break; + case 48: *a = 'l'; *b = 'o'; *c = 's'; break; + case 49: *a = 'd'; *b = 'i'; *c = 'l'; break; + case 50: *a = 'f'; *b = 'o'; *c = 'r'; break; + case 51: *a = 'p'; *b = 'i'; *c = 'l'; break; + case 52: *a = 'r'; *b = 'a'; *c = 'm'; break; + case 53: *a = 't'; *b = 'i'; *c = 'r'; break; + case 54: *a = 'w'; *b = 'i'; *c = 'n'; break; + case 55: *a = 't'; *b = 'a'; *c = 'd'; break; + case 56: *a = 'b'; *b = 'i'; *c = 'c'; break; + case 57: *a = 'd'; *b = 'i'; *c = 'f'; break; + case 58: *a = 'r'; *b = 'o'; *c = 'c'; break; + case 59: *a = 'w'; *b = 'i'; *c = 'd'; break; + case 60: *a = 'b'; *b = 'i'; *c = 's'; break; + case 61: *a = 'd'; *b = 'a'; *c = 's'; break; + case 62: *a = 'm'; *b = 'i'; *c = 'd'; break; + case 63: *a = 'l'; *b = 'o'; *c = 'p'; break; + case 64: *a = 'r'; *b = 'i'; *c = 'l'; break; + case 65: *a = 'n'; *b = 'a'; *c = 'r'; break; + case 66: *a = 'd'; *b = 'a'; *c = 'p'; break; + case 67: *a = 'm'; *b = 'o'; *c = 'l'; break; + case 68: *a = 's'; *b = 'a'; *c = 'n'; break; + case 69: *a = 'l'; *b = 'o'; *c = 'c'; break; + case 70: *a = 'n'; *b = 'o'; *c = 'v'; break; + case 71: *a = 's'; *b = 'i'; *c = 't'; break; + case 72: *a = 'n'; *b = 'i'; *c = 'd'; break; + case 73: *a = 't'; *b = 'i'; *c = 'p'; break; + case 74: *a = 's'; *b = 'i'; *c = 'c'; break; + case 75: *a = 'r'; *b = 'o'; *c = 'p'; break; + case 76: *a = 'w'; *b = 'i'; *c = 't'; break; + case 77: *a = 'n'; *b = 'a'; *c = 't'; break; + case 78: *a = 'p'; *b = 'a'; *c = 'n'; break; + case 79: *a = 'm'; *b = 'i'; *c = 'n'; break; + case 80: *a = 'r'; *b = 'i'; *c = 't'; break; + case 81: *a = 'p'; *b = 'o'; *c = 'd'; break; + case 82: *a = 'm'; *b = 'o'; *c = 't'; break; + case 83: *a = 't'; *b = 'a'; *c = 'm'; break; + case 84: *a = 't'; *b = 'o'; *c = 'l'; break; + case 85: *a = 's'; *b = 'a'; *c = 'v'; break; + case 86: *a = 'p'; *b = 'o'; *c = 's'; break; + case 87: *a = 'n'; *b = 'a'; *c = 'p'; break; + case 88: *a = 'n'; *b = 'o'; *c = 'p'; break; + case 89: *a = 's'; *b = 'o'; *c = 'm'; break; + case 90: *a = 'f'; *b = 'i'; *c = 'n'; break; + case 91: *a = 'f'; *b = 'o'; *c = 'n'; break; + case 92: *a = 'b'; *b = 'a'; *c = 'n'; break; + case 93: *a = 'm'; *b = 'o'; *c = 'r'; break; + case 94: *a = 'w'; *b = 'o'; *c = 'r'; break; + case 95: *a = 's'; *b = 'i'; *c = 'p'; break; + case 96: *a = 'r'; *b = 'o'; *c = 'n'; break; + case 97: *a = 'n'; *b = 'o'; *c = 'r'; break; + case 98: *a = 'b'; *b = 'o'; *c = 't'; break; + case 99: *a = 'w'; *b = 'i'; *c = 'c'; break; + case 100: *a = 's'; *b = 'o'; *c = 'c'; break; + case 101: *a = 'w'; *b = 'a'; *c = 't'; break; + case 102: *a = 'd'; *b = 'o'; *c = 'l'; break; + case 103: *a = 'm'; *b = 'a'; *c = 'g'; break; + case 104: *a = 'p'; *b = 'i'; *c = 'c'; break; + case 105: *a = 'd'; *b = 'a'; *c = 'v'; break; + case 106: *a = 'b'; *b = 'i'; *c = 'd'; break; + case 107: *a = 'b'; *b = 'a'; *c = 'l'; break; + case 108: *a = 't'; *b = 'i'; *c = 'm'; break; + case 109: *a = 't'; *b = 'a'; *c = 's'; break; + case 110: *a = 'm'; *b = 'a'; *c = 'l'; break; + case 111: *a = 'l'; *b = 'i'; *c = 'g'; break; + case 112: *a = 's'; *b = 'i'; *c = 'v'; break; + case 113: *a = 't'; *b = 'a'; *c = 'g'; break; + case 114: *a = 'p'; *b = 'a'; *c = 'd'; break; + case 115: *a = 's'; *b = 'a'; *c = 'l'; break; + case 116: *a = 'd'; *b = 'i'; *c = 'v'; break; + case 117: *a = 'd'; *b = 'a'; *c = 'c'; break; + case 118: *a = 't'; *b = 'a'; *c = 'n'; break; + case 119: *a = 's'; *b = 'i'; *c = 'd'; break; + case 120: *a = 'f'; *b = 'a'; *c = 'b'; break; + case 121: *a = 't'; *b = 'a'; *c = 'r'; break; + case 122: *a = 'm'; *b = 'o'; *c = 'n'; break; + case 123: *a = 'r'; *b = 'a'; *c = 'n'; break; + case 124: *a = 'n'; *b = 'i'; *c = 's'; break; + case 125: *a = 'w'; *b = 'o'; *c = 'l'; break; + case 126: *a = 'm'; *b = 'i'; *c = 's'; break; + case 127: *a = 'p'; *b = 'a'; *c = 'l'; break; + case 128: *a = 'l'; *b = 'a'; *c = 's'; break; + case 129: *a = 'd'; *b = 'i'; *c = 's'; break; + case 130: *a = 'm'; *b = 'a'; *c = 'p'; break; + case 131: *a = 'r'; *b = 'a'; *c = 'b'; break; + case 132: *a = 't'; *b = 'o'; *c = 'b'; break; + case 133: *a = 'r'; *b = 'o'; *c = 'l'; break; + case 134: *a = 'l'; *b = 'a'; *c = 't'; break; + case 135: *a = 'l'; *b = 'o'; *c = 'n'; break; + case 136: *a = 'n'; *b = 'o'; *c = 'd'; break; + case 137: *a = 'n'; *b = 'a'; *c = 'v'; break; + case 138: *a = 'f'; *b = 'i'; *c = 'g'; break; + case 139: *a = 'n'; *b = 'o'; *c = 'm'; break; + case 140: *a = 'n'; *b = 'i'; *c = 'b'; break; + case 141: *a = 'p'; *b = 'a'; *c = 'g'; break; + case 142: *a = 's'; *b = 'o'; *c = 'p'; break; + case 143: *a = 'r'; *b = 'a'; *c = 'l'; break; + case 144: *a = 'b'; *b = 'i'; *c = 'l'; break; + case 145: *a = 'h'; *b = 'a'; *c = 'd'; break; + case 146: *a = 'd'; *b = 'o'; *c = 'c'; break; + case 147: *a = 'r'; *b = 'i'; *c = 'd'; break; + case 148: *a = 'm'; *b = 'o'; *c = 'c'; break; + case 149: *a = 'p'; *b = 'a'; *c = 'c'; break; + case 150: *a = 'r'; *b = 'a'; *c = 'v'; break; + case 151: *a = 'r'; *b = 'i'; *c = 'p'; break; + case 152: *a = 'f'; *b = 'a'; *c = 'l'; break; + case 153: *a = 't'; *b = 'o'; *c = 'd'; break; + case 154: *a = 't'; *b = 'i'; *c = 'l'; break; + case 155: *a = 't'; *b = 'i'; *c = 'n'; break; + case 156: *a = 'h'; *b = 'a'; *c = 'p'; break; + case 157: *a = 'm'; *b = 'i'; *c = 'c'; break; + case 158: *a = 'f'; *b = 'a'; *c = 'n'; break; + case 159: *a = 'p'; *b = 'a'; *c = 't'; break; + case 160: *a = 't'; *b = 'a'; *c = 'c'; break; + case 161: *a = 'l'; *b = 'a'; *c = 'b'; break; + case 162: *a = 'm'; *b = 'o'; *c = 'g'; break; + case 163: *a = 's'; *b = 'i'; *c = 'm'; break; + case 164: *a = 's'; *b = 'o'; *c = 'n'; break; + case 165: *a = 'p'; *b = 'i'; *c = 'n'; break; + case 166: *a = 'l'; *b = 'o'; *c = 'm'; break; + case 167: *a = 'r'; *b = 'i'; *c = 'c'; break; + case 168: *a = 't'; *b = 'a'; *c = 'p'; break; + case 169: *a = 'f'; *b = 'i'; *c = 'r'; break; + case 170: *a = 'h'; *b = 'a'; *c = 's'; break; + case 171: *a = 'b'; *b = 'o'; *c = 's'; break; + case 172: *a = 'b'; *b = 'a'; *c = 't'; break; + case 173: *a = 'p'; *b = 'o'; *c = 'c'; break; + case 174: *a = 'h'; *b = 'a'; *c = 'c'; break; + case 175: *a = 't'; *b = 'i'; *c = 'd'; break; + case 176: *a = 'h'; *b = 'a'; *c = 'v'; break; + case 177: *a = 's'; *b = 'a'; *c = 'p'; break; + case 178: *a = 'l'; *b = 'i'; *c = 'n'; break; + case 179: *a = 'd'; *b = 'i'; *c = 'b'; break; + case 180: *a = 'h'; *b = 'o'; *c = 's'; break; + case 181: *a = 'd'; *b = 'a'; *c = 'b'; break; + case 182: *a = 'b'; *b = 'i'; *c = 't'; break; + case 183: *a = 'b'; *b = 'a'; *c = 'r'; break; + case 184: *a = 'r'; *b = 'a'; *c = 'c'; break; + case 185: *a = 'p'; *b = 'a'; *c = 'r'; break; + case 186: *a = 'l'; *b = 'o'; *c = 'd'; break; + case 187: *a = 'd'; *b = 'o'; *c = 's'; break; + case 188: *a = 'b'; *b = 'o'; *c = 'r'; break; + case 189: *a = 't'; *b = 'o'; *c = 'c'; break; + case 190: *a = 'h'; *b = 'i'; *c = 'l'; break; + case 191: *a = 'm'; *b = 'a'; *c = 'c'; break; + case 192: *a = 't'; *b = 'o'; *c = 'm'; break; + case 193: *a = 'd'; *b = 'i'; *c = 'g'; break; + case 194: *a = 'f'; *b = 'i'; *c = 'l'; break; + case 195: *a = 'f'; *b = 'a'; *c = 's'; break; + case 196: *a = 'm'; *b = 'i'; *c = 't'; break; + case 197: *a = 'h'; *b = 'o'; *c = 'b'; break; + case 198: *a = 'h'; *b = 'a'; *c = 'r'; break; + case 199: *a = 'm'; *b = 'i'; *c = 'g'; break; + case 200: *a = 'h'; *b = 'i'; *c = 'n'; break; + case 201: *a = 'r'; *b = 'a'; *c = 'd'; break; + case 202: *a = 'm'; *b = 'a'; *c = 's'; break; + case 203: *a = 'h'; *b = 'a'; *c = 'l'; break; + case 204: *a = 'r'; *b = 'a'; *c = 'g'; break; + case 205: *a = 'l'; *b = 'a'; *c = 'g'; break; + case 206: *a = 'f'; *b = 'a'; *c = 'd'; break; + case 207: *a = 't'; *b = 'o'; *c = 'p'; break; + case 208: *a = 'm'; *b = 'o'; *c = 'p'; break; + case 209: *a = 'h'; *b = 'a'; *c = 'b'; break; + case 210: *a = 'n'; *b = 'i'; *c = 'l'; break; + case 211: *a = 'n'; *b = 'o'; *c = 's'; break; + case 212: *a = 'm'; *b = 'i'; *c = 'l'; break; + case 213: *a = 'f'; *b = 'o'; *c = 'p'; break; + case 214: *a = 'f'; *b = 'a'; *c = 'm'; break; + case 215: *a = 'd'; *b = 'a'; *c = 't'; break; + case 216: *a = 'n'; *b = 'o'; *c = 'l'; break; + case 217: *a = 'd'; *b = 'i'; *c = 'n'; break; + case 218: *a = 'h'; *b = 'a'; *c = 't'; break; + case 219: *a = 'n'; *b = 'a'; *c = 'c'; break; + case 220: *a = 'r'; *b = 'i'; *c = 's'; break; + case 221: *a = 'f'; *b = 'o'; *c = 't'; break; + case 222: *a = 'r'; *b = 'i'; *c = 'b'; break; + case 223: *a = 'h'; *b = 'o'; *c = 'c'; break; + case 224: *a = 'n'; *b = 'i'; *c = 'm'; break; + case 225: *a = 'l'; *b = 'a'; *c = 'r'; break; + case 226: *a = 'f'; *b = 'i'; *c = 't'; break; + case 227: *a = 'w'; *b = 'a'; *c = 'l'; break; + case 228: *a = 'r'; *b = 'a'; *c = 'p'; break; + case 229: *a = 's'; *b = 'a'; *c = 'r'; break; + case 230: *a = 'n'; *b = 'a'; *c = 'l'; break; + case 231: *a = 'm'; *b = 'o'; *c = 's'; break; + case 232: *a = 'l'; *b = 'a'; *c = 'n'; break; + case 233: *a = 'd'; *b = 'o'; *c = 'n'; break; + case 234: *a = 'd'; *b = 'a'; *c = 'n'; break; + case 235: *a = 'l'; *b = 'a'; *c = 'd'; break; + case 236: *a = 'd'; *b = 'o'; *c = 'v'; break; + case 237: *a = 'r'; *b = 'i'; *c = 'v'; break; + case 238: *a = 'b'; *b = 'a'; *c = 'c'; break; + case 239: *a = 'p'; *b = 'o'; *c = 'l'; break; + case 240: *a = 'l'; *b = 'a'; *c = 'p'; break; + case 241: *a = 't'; *b = 'a'; *c = 'l'; break; + case 242: *a = 'p'; *b = 'i'; *c = 't'; break; + case 243: *a = 'n'; *b = 'a'; *c = 'm'; break; + case 244: *a = 'b'; *b = 'o'; *c = 'n'; break; + case 245: *a = 'r'; *b = 'o'; *c = 's'; break; + case 246: *a = 't'; *b = 'o'; *c = 'n'; break; + case 247: *a = 'f'; *b = 'o'; *c = 'd'; break; + case 248: *a = 'p'; *b = 'o'; *c = 'n'; break; + case 249: *a = 's'; *b = 'o'; *c = 'v'; break; + case 250: *a = 'n'; *b = 'o'; *c = 'c'; break; + case 251: *a = 's'; *b = 'o'; *c = 'r'; break; + case 252: *a = 'l'; *b = 'a'; *c = 'v'; break; + case 253: *a = 'm'; *b = 'a'; *c = 't'; break; + case 254: *a = 'm'; *b = 'i'; *c = 'p'; break; + case 255: *a = 'f'; *b = 'i'; *c = 'p'; break; + default: u3m_bail(c3__exit); + } +} + +u3_noun +u3_po_find_suffix(c3_y one, c3_y two, c3_y three) { + switch (one) { + case 'b': switch (two) { + case 'e': switch (three) { + case 'c': return u3nc(0, 238); + case 'l': return u3nc(0, 107); + case 'n': return u3nc(0, 92); + case 'p': return u3nc(0, 183); + case 'r': return u3nc(0, 172); + case 's': return u3nc(0, 56); + case 't': return u3nc(0, 106); + case 'x': return u3nc(0, 144); + default: return 0; + } + case 'u': switch (three) { + case 'd': return u3nc(0, 2); + case 'r': return u3nc(0, 60); + case 's': return u3nc(0, 182); + default: return 0; + } + case 'y': switch (three) { + case 'l': return u3nc(0, 176); + case 'n': return u3nc(0, 45); + case 'r': return u3nc(0, 244); + case 't': return u3nc(0, 188); + default: return 0; + } + default: return 0; + } + case 'd': switch (two) { + case 'e': switch (three) { + case 'b': return u3nc(0, 171); + case 'c': return u3nc(0, 98); + case 'f': return u3nc(0, 181); + case 'g': return u3nc(0, 117); + case 'l': return u3nc(0, 37); + case 'm': return u3nc(0, 234); + case 'n': return u3nc(0, 66); + case 'p': return u3nc(0, 23); + case 'r': return u3nc(0, 61); + case 's': return u3nc(0, 215); + case 't': return u3nc(0, 105); + case 'v': return u3nc(0, 179); + case 'x': return u3nc(0, 57); + default: return 0; + } + case 'u': switch (three) { + case 'c': return u3nc(0, 193); + case 'l': return u3nc(0, 49); + case 'n': return u3nc(0, 217); + case 'r': return u3nc(0, 11); + case 's': return u3nc(0, 129); + case 't': return u3nc(0, 116); + case 'x': return u3nc(0, 146); + default: return 0; + } + case 'y': switch (three) { + case 'l': return u3nc(0, 102); + case 'n': return u3nc(0, 233); + case 'r': return u3nc(0, 18); + case 's': return u3nc(0, 24); + case 't': return u3nc(0, 187); + default: return 0; + } + default: return 0; + } + case 'f': switch (two) { + case 'e': switch (three) { + case 'b': return u3nc(0, 47); + case 'd': return u3nc(0, 236); + case 'l': return u3nc(0, 120); + case 'n': return u3nc(0, 206); + case 'p': return u3nc(0, 152); + case 'r': return u3nc(0, 158); + case 's': return u3nc(0, 255); + case 't': return u3nc(0, 214); + case 'x': return u3nc(0, 195); + default: return 0; + } + case 'u': switch (three) { + case 'l': return u3nc(0, 8); + case 'n': return u3nc(0, 138); + case 'r': return u3nc(0, 194); + case 's': return u3nc(0, 90); + default: return 0; + } + case 'y': switch (three) { + case 'l': return u3nc(0, 169); + case 'n': return u3nc(0, 226); + case 'r': return u3nc(0, 247); + default: return 0; + } + default: return 0; + } + case 'h': switch (two) { + case 'e': switch (three) { + case 'b': return u3nc(0, 20); + case 'c': return u3nc(0, 27); + case 'p': return u3nc(0, 91); + case 's': return u3nc(0, 213); + case 't': return u3nc(0, 50); + case 'x': return u3nc(0, 46); + default: return 0; + } + case 'u': switch (three) { + case 'l': return u3nc(0, 221); + case 's': return u3nc(0, 209); + case 't': return u3nc(0, 174); + default: return 0; + } + default: return 0; + } + case 'l': switch (two) { + case 'e': switch (three) { + case 'b': return u3nc(0, 145); + case 'c': return u3nc(0, 203); + case 'd': return u3nc(0, 41); + case 'g': return u3nc(0, 156); + case 'n': return u3nc(0, 198); + case 'p': return u3nc(0, 170); + case 'r': return u3nc(0, 218); + case 't': return u3nc(0, 7); + case 'v': return u3nc(0, 190); + case 'x': return u3nc(0, 200); + default: return 0; + } + case 'u': switch (three) { + case 'c': return u3nc(0, 197); + case 'd': return u3nc(0, 223); + case 'g': return u3nc(0, 26); + case 'n': return u3nc(0, 32); + case 'p': return u3nc(0, 22); + case 'r': return u3nc(0, 180); + case 's': return u3nc(0, 161); + case 't': return u3nc(0, 34); + case 'x': return u3nc(0, 235); + default: return 0; + } + case 'y': switch (three) { + case 'd': return u3nc(0, 205); + case 'n': return u3nc(0, 232); + case 'r': return u3nc(0, 240); + case 's': return u3nc(0, 225); + case 't': return u3nc(0, 128); + case 'x': return u3nc(0, 134); + default: return 0; + } + default: return 0; + } + case 'm': switch (two) { + case 'e': switch (three) { + case 'b': return u3nc(0, 114); + case 'c': return u3nc(0, 141); + case 'd': return u3nc(0, 127); + case 'g': return u3nc(0, 78); + case 'l': return u3nc(0, 185); + case 'p': return u3nc(0, 33); + case 'r': return u3nc(0, 159); + case 's': return u3nc(0, 104); + case 't': return u3nc(0, 43); + case 'v': return u3nc(0, 51); + case 'x': return u3nc(0, 165); + default: return 0; + } + case 'u': switch (three) { + case 'd': return u3nc(0, 242); + case 'g': return u3nc(0, 173); + case 'l': return u3nc(0, 81); + case 'n': return u3nc(0, 239); + case 'r': return u3nc(0, 248); + case 's': return u3nc(0, 93); + case 't': return u3nc(0, 86); + default: return 0; + } + case 'y': switch (three) { + case 'l': return u3nc(0, 191); + case 'n': return u3nc(0, 103); + case 'r': return u3nc(0, 110); + default: return 0; + } + default: return 0; + } + case 'n': switch (two) { + case 'e': switch (three) { + case 'b': return u3nc(0, 130); + case 'c': return u3nc(0, 1); + case 'd': return u3nc(0, 202); + case 'l': return u3nc(0, 253); + case 'm': return u3nc(0, 157); + case 'p': return u3nc(0, 62); + case 'r': return u3nc(0, 199); + case 's': return u3nc(0, 212); + case 't': return u3nc(0, 79); + case 'v': return u3nc(0, 254); + case 'x': return u3nc(0, 31); + default: return 0; + } + case 'u': switch (three) { + case 'b': return u3nc(0, 126); + case 'l': return u3nc(0, 196); + case 'm': return u3nc(0, 148); + case 'p': return u3nc(0, 19); + case 's': return u3nc(0, 162); + case 't': return u3nc(0, 67); + case 'x': return u3nc(0, 122); + default: return 0; + } + case 'y': switch (three) { + case 'd': return u3nc(0, 208); + case 'l': return u3nc(0, 231); + case 'm': return u3nc(0, 82); + case 'r': return u3nc(0, 219); + case 's': return u3nc(0, 230); + case 't': return u3nc(0, 243); + case 'x': return u3nc(0, 87); + default: return 0; + } + default: return 0; + } + case 'p': switch (two) { + case 'e': switch (three) { + case 'c': return u3nc(0, 252); + case 'd': return u3nc(0, 39); + case 'g': return u3nc(0, 21); + case 'l': return u3nc(0, 111); + case 'm': return u3nc(0, 178); + case 'n': return u3nc(0, 9); + case 'r': return u3nc(0, 5); + case 's': return u3nc(0, 36); + case 't': return u3nc(0, 69); + case 'x': return u3nc(0, 186); + default: return 0; + } + case 'u': switch (three) { + case 'b': return u3nc(0, 166); + case 'n': return u3nc(0, 135); + case 'r': return u3nc(0, 63); + case 't': return u3nc(0, 25); + default: return 0; + } + case 'y': switch (three) { + case 'l': return u3nc(0, 48); + case 'x': return u3nc(0, 149); + default: return 0; + } + default: return 0; + } + case 'r': switch (two) { + case 'e': switch (three) { + case 'b': return u3nc(0, 65); + case 'c': return u3nc(0, 77); + case 'd': return u3nc(0, 137); + case 'f': return u3nc(0, 140); + case 'g': return u3nc(0, 72); + case 'l': return u3nc(0, 210); + case 'm': return u3nc(0, 224); + case 'n': return u3nc(0, 124); + case 'p': return u3nc(0, 250); + case 's': return u3nc(0, 136); + case 't': return u3nc(0, 216); + case 'v': return u3nc(0, 139); + case 'x': return u3nc(0, 88); + default: return 0; + } + case 'u': switch (three) { + case 'c': return u3nc(0, 97); + case 'd': return u3nc(0, 211); + case 'l': return u3nc(0, 70); + case 'm': return u3nc(0, 131); + case 'n': return u3nc(0, 184); + case 'p': return u3nc(0, 201); + case 's': return u3nc(0, 143); + case 't': return u3nc(0, 52); + case 'x': return u3nc(0, 123); + default: return 0; + } + case 'y': switch (three) { + case 'c': return u3nc(0, 228); + case 'd': return u3nc(0, 204); + case 'g': return u3nc(0, 150); + case 'l': return u3nc(0, 222); + case 'm': return u3nc(0, 167); + case 'n': return u3nc(0, 147); + case 'p': return u3nc(0, 16); + case 's': return u3nc(0, 64); + case 't': return u3nc(0, 28); + case 'x': return u3nc(0, 151); + default: return 0; + } + default: return 0; + } + case 's': switch (two) { + case 'e': switch (three) { + case 'b': return u3nc(0, 220); + case 'c': return u3nc(0, 80); + case 'd': return u3nc(0, 237); + case 'f': return u3nc(0, 58); + case 'g': return u3nc(0, 133); + case 'l': return u3nc(0, 96); + case 'm': return u3nc(0, 75); + case 'n': return u3nc(0, 245); + case 'p': return u3nc(0, 35); + case 'r': return u3nc(0, 13); + case 't': return u3nc(0, 115); + case 'v': return u3nc(0, 4); + default: return 0; + } + case 'u': switch (three) { + case 'b': return u3nc(0, 68); + case 'd': return u3nc(0, 177); + case 'g': return u3nc(0, 229); + case 'l': return u3nc(0, 38); + case 'm': return u3nc(0, 85); + case 'n': return u3nc(0, 15); + case 'p': return u3nc(0, 74); + case 'r': return u3nc(0, 119); + case 't': return u3nc(0, 6); + default: return 0; + } + case 'y': switch (three) { + case 'd': return u3nc(0, 30); + case 'l': return u3nc(0, 163); + case 'm': return u3nc(0, 95); + case 'n': return u3nc(0, 71); + case 'p': return u3nc(0, 112); + case 'r': return u3nc(0, 100); + case 't': return u3nc(0, 10); + case 'x': return u3nc(0, 17); + default: return 0; + } + default: return 0; + } + case 't': switch (two) { + case 'e': switch (three) { + case 'b': return u3nc(0, 89); + case 'c': return u3nc(0, 164); + case 'd': return u3nc(0, 142); + case 'g': return u3nc(0, 251); + case 'l': return u3nc(0, 249); + case 'm': return u3nc(0, 40); + case 'n': return u3nc(0, 160); + case 'p': return u3nc(0, 55); + case 'r': return u3nc(0, 113); + case 's': return u3nc(0, 241); + case 'v': return u3nc(0, 83); + case 'x': return u3nc(0, 118); + default: return 0; + } + case 'u': switch (three) { + case 'c': return u3nc(0, 168); + case 'd': return u3nc(0, 121); + case 'g': return u3nc(0, 109); + case 'l': return u3nc(0, 42); + case 'n': return u3nc(0, 175); + case 's': return u3nc(0, 154); + case 'x': return u3nc(0, 108); + default: return 0; + } + case 'y': switch (three) { + case 'c': return u3nc(0, 155); + case 'd': return u3nc(0, 73); + case 'l': return u3nc(0, 53); + case 'n': return u3nc(0, 132); + case 'p': return u3nc(0, 189); + case 'r': return u3nc(0, 153); + case 'v': return u3nc(0, 29); + default: return 0; + } + default: return 0; + } + case 'w': switch (two) { + case 'e': switch (three) { + case 'b': return u3nc(0, 84); + case 'd': return u3nc(0, 192); + case 'g': return u3nc(0, 246); + case 'l': return u3nc(0, 207); + case 'n': return u3nc(0, 44); + case 'p': return u3nc(0, 12); + case 'r': return u3nc(0, 227); + case 's': return u3nc(0, 3); + case 't': return u3nc(0, 101); + case 'x': return u3nc(0, 99); + default: return 0; + } + case 'y': switch (three) { + case 'c': return u3nc(0, 59); + case 'd': return u3nc(0, 54); + case 'l': return u3nc(0, 14); + case 'n': return u3nc(0, 76); + case 't': return u3nc(0, 125); + case 'x': return u3nc(0, 94); + default: return 0; + } + default: return 0; + } + case 'z': switch (two) { + case 'o': switch (three) { + case 'd': return u3nc(0, 0); + default: return 0; + } + default: return 0; + } + default: return 0; + } +} + +void +u3_po_to_suffix(u3_noun id, c3_y* a, c3_y* b, c3_y* c) +{ + switch (id) { + case 0: *a = 'z'; *b = 'o'; *c = 'd'; break; + case 1: *a = 'n'; *b = 'e'; *c = 'c'; break; + case 2: *a = 'b'; *b = 'u'; *c = 'd'; break; + case 3: *a = 'w'; *b = 'e'; *c = 's'; break; + case 4: *a = 's'; *b = 'e'; *c = 'v'; break; + case 5: *a = 'p'; *b = 'e'; *c = 'r'; break; + case 6: *a = 's'; *b = 'u'; *c = 't'; break; + case 7: *a = 'l'; *b = 'e'; *c = 't'; break; + case 8: *a = 'f'; *b = 'u'; *c = 'l'; break; + case 9: *a = 'p'; *b = 'e'; *c = 'n'; break; + case 10: *a = 's'; *b = 'y'; *c = 't'; break; + case 11: *a = 'd'; *b = 'u'; *c = 'r'; break; + case 12: *a = 'w'; *b = 'e'; *c = 'p'; break; + case 13: *a = 's'; *b = 'e'; *c = 'r'; break; + case 14: *a = 'w'; *b = 'y'; *c = 'l'; break; + case 15: *a = 's'; *b = 'u'; *c = 'n'; break; + case 16: *a = 'r'; *b = 'y'; *c = 'p'; break; + case 17: *a = 's'; *b = 'y'; *c = 'x'; break; + case 18: *a = 'd'; *b = 'y'; *c = 'r'; break; + case 19: *a = 'n'; *b = 'u'; *c = 'p'; break; + case 20: *a = 'h'; *b = 'e'; *c = 'b'; break; + case 21: *a = 'p'; *b = 'e'; *c = 'g'; break; + case 22: *a = 'l'; *b = 'u'; *c = 'p'; break; + case 23: *a = 'd'; *b = 'e'; *c = 'p'; break; + case 24: *a = 'd'; *b = 'y'; *c = 's'; break; + case 25: *a = 'p'; *b = 'u'; *c = 't'; break; + case 26: *a = 'l'; *b = 'u'; *c = 'g'; break; + case 27: *a = 'h'; *b = 'e'; *c = 'c'; break; + case 28: *a = 'r'; *b = 'y'; *c = 't'; break; + case 29: *a = 't'; *b = 'y'; *c = 'v'; break; + case 30: *a = 's'; *b = 'y'; *c = 'd'; break; + case 31: *a = 'n'; *b = 'e'; *c = 'x'; break; + case 32: *a = 'l'; *b = 'u'; *c = 'n'; break; + case 33: *a = 'm'; *b = 'e'; *c = 'p'; break; + case 34: *a = 'l'; *b = 'u'; *c = 't'; break; + case 35: *a = 's'; *b = 'e'; *c = 'p'; break; + case 36: *a = 'p'; *b = 'e'; *c = 's'; break; + case 37: *a = 'd'; *b = 'e'; *c = 'l'; break; + case 38: *a = 's'; *b = 'u'; *c = 'l'; break; + case 39: *a = 'p'; *b = 'e'; *c = 'd'; break; + case 40: *a = 't'; *b = 'e'; *c = 'm'; break; + case 41: *a = 'l'; *b = 'e'; *c = 'd'; break; + case 42: *a = 't'; *b = 'u'; *c = 'l'; break; + case 43: *a = 'm'; *b = 'e'; *c = 't'; break; + case 44: *a = 'w'; *b = 'e'; *c = 'n'; break; + case 45: *a = 'b'; *b = 'y'; *c = 'n'; break; + case 46: *a = 'h'; *b = 'e'; *c = 'x'; break; + case 47: *a = 'f'; *b = 'e'; *c = 'b'; break; + case 48: *a = 'p'; *b = 'y'; *c = 'l'; break; + case 49: *a = 'd'; *b = 'u'; *c = 'l'; break; + case 50: *a = 'h'; *b = 'e'; *c = 't'; break; + case 51: *a = 'm'; *b = 'e'; *c = 'v'; break; + case 52: *a = 'r'; *b = 'u'; *c = 't'; break; + case 53: *a = 't'; *b = 'y'; *c = 'l'; break; + case 54: *a = 'w'; *b = 'y'; *c = 'd'; break; + case 55: *a = 't'; *b = 'e'; *c = 'p'; break; + case 56: *a = 'b'; *b = 'e'; *c = 's'; break; + case 57: *a = 'd'; *b = 'e'; *c = 'x'; break; + case 58: *a = 's'; *b = 'e'; *c = 'f'; break; + case 59: *a = 'w'; *b = 'y'; *c = 'c'; break; + case 60: *a = 'b'; *b = 'u'; *c = 'r'; break; + case 61: *a = 'd'; *b = 'e'; *c = 'r'; break; + case 62: *a = 'n'; *b = 'e'; *c = 'p'; break; + case 63: *a = 'p'; *b = 'u'; *c = 'r'; break; + case 64: *a = 'r'; *b = 'y'; *c = 's'; break; + case 65: *a = 'r'; *b = 'e'; *c = 'b'; break; + case 66: *a = 'd'; *b = 'e'; *c = 'n'; break; + case 67: *a = 'n'; *b = 'u'; *c = 't'; break; + case 68: *a = 's'; *b = 'u'; *c = 'b'; break; + case 69: *a = 'p'; *b = 'e'; *c = 't'; break; + case 70: *a = 'r'; *b = 'u'; *c = 'l'; break; + case 71: *a = 's'; *b = 'y'; *c = 'n'; break; + case 72: *a = 'r'; *b = 'e'; *c = 'g'; break; + case 73: *a = 't'; *b = 'y'; *c = 'd'; break; + case 74: *a = 's'; *b = 'u'; *c = 'p'; break; + case 75: *a = 's'; *b = 'e'; *c = 'm'; break; + case 76: *a = 'w'; *b = 'y'; *c = 'n'; break; + case 77: *a = 'r'; *b = 'e'; *c = 'c'; break; + case 78: *a = 'm'; *b = 'e'; *c = 'g'; break; + case 79: *a = 'n'; *b = 'e'; *c = 't'; break; + case 80: *a = 's'; *b = 'e'; *c = 'c'; break; + case 81: *a = 'm'; *b = 'u'; *c = 'l'; break; + case 82: *a = 'n'; *b = 'y'; *c = 'm'; break; + case 83: *a = 't'; *b = 'e'; *c = 'v'; break; + case 84: *a = 'w'; *b = 'e'; *c = 'b'; break; + case 85: *a = 's'; *b = 'u'; *c = 'm'; break; + case 86: *a = 'm'; *b = 'u'; *c = 't'; break; + case 87: *a = 'n'; *b = 'y'; *c = 'x'; break; + case 88: *a = 'r'; *b = 'e'; *c = 'x'; break; + case 89: *a = 't'; *b = 'e'; *c = 'b'; break; + case 90: *a = 'f'; *b = 'u'; *c = 's'; break; + case 91: *a = 'h'; *b = 'e'; *c = 'p'; break; + case 92: *a = 'b'; *b = 'e'; *c = 'n'; break; + case 93: *a = 'm'; *b = 'u'; *c = 's'; break; + case 94: *a = 'w'; *b = 'y'; *c = 'x'; break; + case 95: *a = 's'; *b = 'y'; *c = 'm'; break; + case 96: *a = 's'; *b = 'e'; *c = 'l'; break; + case 97: *a = 'r'; *b = 'u'; *c = 'c'; break; + case 98: *a = 'd'; *b = 'e'; *c = 'c'; break; + case 99: *a = 'w'; *b = 'e'; *c = 'x'; break; + case 100: *a = 's'; *b = 'y'; *c = 'r'; break; + case 101: *a = 'w'; *b = 'e'; *c = 't'; break; + case 102: *a = 'd'; *b = 'y'; *c = 'l'; break; + case 103: *a = 'm'; *b = 'y'; *c = 'n'; break; + case 104: *a = 'm'; *b = 'e'; *c = 's'; break; + case 105: *a = 'd'; *b = 'e'; *c = 't'; break; + case 106: *a = 'b'; *b = 'e'; *c = 't'; break; + case 107: *a = 'b'; *b = 'e'; *c = 'l'; break; + case 108: *a = 't'; *b = 'u'; *c = 'x'; break; + case 109: *a = 't'; *b = 'u'; *c = 'g'; break; + case 110: *a = 'm'; *b = 'y'; *c = 'r'; break; + case 111: *a = 'p'; *b = 'e'; *c = 'l'; break; + case 112: *a = 's'; *b = 'y'; *c = 'p'; break; + case 113: *a = 't'; *b = 'e'; *c = 'r'; break; + case 114: *a = 'm'; *b = 'e'; *c = 'b'; break; + case 115: *a = 's'; *b = 'e'; *c = 't'; break; + case 116: *a = 'd'; *b = 'u'; *c = 't'; break; + case 117: *a = 'd'; *b = 'e'; *c = 'g'; break; + case 118: *a = 't'; *b = 'e'; *c = 'x'; break; + case 119: *a = 's'; *b = 'u'; *c = 'r'; break; + case 120: *a = 'f'; *b = 'e'; *c = 'l'; break; + case 121: *a = 't'; *b = 'u'; *c = 'd'; break; + case 122: *a = 'n'; *b = 'u'; *c = 'x'; break; + case 123: *a = 'r'; *b = 'u'; *c = 'x'; break; + case 124: *a = 'r'; *b = 'e'; *c = 'n'; break; + case 125: *a = 'w'; *b = 'y'; *c = 't'; break; + case 126: *a = 'n'; *b = 'u'; *c = 'b'; break; + case 127: *a = 'm'; *b = 'e'; *c = 'd'; break; + case 128: *a = 'l'; *b = 'y'; *c = 't'; break; + case 129: *a = 'd'; *b = 'u'; *c = 's'; break; + case 130: *a = 'n'; *b = 'e'; *c = 'b'; break; + case 131: *a = 'r'; *b = 'u'; *c = 'm'; break; + case 132: *a = 't'; *b = 'y'; *c = 'n'; break; + case 133: *a = 's'; *b = 'e'; *c = 'g'; break; + case 134: *a = 'l'; *b = 'y'; *c = 'x'; break; + case 135: *a = 'p'; *b = 'u'; *c = 'n'; break; + case 136: *a = 'r'; *b = 'e'; *c = 's'; break; + case 137: *a = 'r'; *b = 'e'; *c = 'd'; break; + case 138: *a = 'f'; *b = 'u'; *c = 'n'; break; + case 139: *a = 'r'; *b = 'e'; *c = 'v'; break; + case 140: *a = 'r'; *b = 'e'; *c = 'f'; break; + case 141: *a = 'm'; *b = 'e'; *c = 'c'; break; + case 142: *a = 't'; *b = 'e'; *c = 'd'; break; + case 143: *a = 'r'; *b = 'u'; *c = 's'; break; + case 144: *a = 'b'; *b = 'e'; *c = 'x'; break; + case 145: *a = 'l'; *b = 'e'; *c = 'b'; break; + case 146: *a = 'd'; *b = 'u'; *c = 'x'; break; + case 147: *a = 'r'; *b = 'y'; *c = 'n'; break; + case 148: *a = 'n'; *b = 'u'; *c = 'm'; break; + case 149: *a = 'p'; *b = 'y'; *c = 'x'; break; + case 150: *a = 'r'; *b = 'y'; *c = 'g'; break; + case 151: *a = 'r'; *b = 'y'; *c = 'x'; break; + case 152: *a = 'f'; *b = 'e'; *c = 'p'; break; + case 153: *a = 't'; *b = 'y'; *c = 'r'; break; + case 154: *a = 't'; *b = 'u'; *c = 's'; break; + case 155: *a = 't'; *b = 'y'; *c = 'c'; break; + case 156: *a = 'l'; *b = 'e'; *c = 'g'; break; + case 157: *a = 'n'; *b = 'e'; *c = 'm'; break; + case 158: *a = 'f'; *b = 'e'; *c = 'r'; break; + case 159: *a = 'm'; *b = 'e'; *c = 'r'; break; + case 160: *a = 't'; *b = 'e'; *c = 'n'; break; + case 161: *a = 'l'; *b = 'u'; *c = 's'; break; + case 162: *a = 'n'; *b = 'u'; *c = 's'; break; + case 163: *a = 's'; *b = 'y'; *c = 'l'; break; + case 164: *a = 't'; *b = 'e'; *c = 'c'; break; + case 165: *a = 'm'; *b = 'e'; *c = 'x'; break; + case 166: *a = 'p'; *b = 'u'; *c = 'b'; break; + case 167: *a = 'r'; *b = 'y'; *c = 'm'; break; + case 168: *a = 't'; *b = 'u'; *c = 'c'; break; + case 169: *a = 'f'; *b = 'y'; *c = 'l'; break; + case 170: *a = 'l'; *b = 'e'; *c = 'p'; break; + case 171: *a = 'd'; *b = 'e'; *c = 'b'; break; + case 172: *a = 'b'; *b = 'e'; *c = 'r'; break; + case 173: *a = 'm'; *b = 'u'; *c = 'g'; break; + case 174: *a = 'h'; *b = 'u'; *c = 't'; break; + case 175: *a = 't'; *b = 'u'; *c = 'n'; break; + case 176: *a = 'b'; *b = 'y'; *c = 'l'; break; + case 177: *a = 's'; *b = 'u'; *c = 'd'; break; + case 178: *a = 'p'; *b = 'e'; *c = 'm'; break; + case 179: *a = 'd'; *b = 'e'; *c = 'v'; break; + case 180: *a = 'l'; *b = 'u'; *c = 'r'; break; + case 181: *a = 'd'; *b = 'e'; *c = 'f'; break; + case 182: *a = 'b'; *b = 'u'; *c = 's'; break; + case 183: *a = 'b'; *b = 'e'; *c = 'p'; break; + case 184: *a = 'r'; *b = 'u'; *c = 'n'; break; + case 185: *a = 'm'; *b = 'e'; *c = 'l'; break; + case 186: *a = 'p'; *b = 'e'; *c = 'x'; break; + case 187: *a = 'd'; *b = 'y'; *c = 't'; break; + case 188: *a = 'b'; *b = 'y'; *c = 't'; break; + case 189: *a = 't'; *b = 'y'; *c = 'p'; break; + case 190: *a = 'l'; *b = 'e'; *c = 'v'; break; + case 191: *a = 'm'; *b = 'y'; *c = 'l'; break; + case 192: *a = 'w'; *b = 'e'; *c = 'd'; break; + case 193: *a = 'd'; *b = 'u'; *c = 'c'; break; + case 194: *a = 'f'; *b = 'u'; *c = 'r'; break; + case 195: *a = 'f'; *b = 'e'; *c = 'x'; break; + case 196: *a = 'n'; *b = 'u'; *c = 'l'; break; + case 197: *a = 'l'; *b = 'u'; *c = 'c'; break; + case 198: *a = 'l'; *b = 'e'; *c = 'n'; break; + case 199: *a = 'n'; *b = 'e'; *c = 'r'; break; + case 200: *a = 'l'; *b = 'e'; *c = 'x'; break; + case 201: *a = 'r'; *b = 'u'; *c = 'p'; break; + case 202: *a = 'n'; *b = 'e'; *c = 'd'; break; + case 203: *a = 'l'; *b = 'e'; *c = 'c'; break; + case 204: *a = 'r'; *b = 'y'; *c = 'd'; break; + case 205: *a = 'l'; *b = 'y'; *c = 'd'; break; + case 206: *a = 'f'; *b = 'e'; *c = 'n'; break; + case 207: *a = 'w'; *b = 'e'; *c = 'l'; break; + case 208: *a = 'n'; *b = 'y'; *c = 'd'; break; + case 209: *a = 'h'; *b = 'u'; *c = 's'; break; + case 210: *a = 'r'; *b = 'e'; *c = 'l'; break; + case 211: *a = 'r'; *b = 'u'; *c = 'd'; break; + case 212: *a = 'n'; *b = 'e'; *c = 's'; break; + case 213: *a = 'h'; *b = 'e'; *c = 's'; break; + case 214: *a = 'f'; *b = 'e'; *c = 't'; break; + case 215: *a = 'd'; *b = 'e'; *c = 's'; break; + case 216: *a = 'r'; *b = 'e'; *c = 't'; break; + case 217: *a = 'd'; *b = 'u'; *c = 'n'; break; + case 218: *a = 'l'; *b = 'e'; *c = 'r'; break; + case 219: *a = 'n'; *b = 'y'; *c = 'r'; break; + case 220: *a = 's'; *b = 'e'; *c = 'b'; break; + case 221: *a = 'h'; *b = 'u'; *c = 'l'; break; + case 222: *a = 'r'; *b = 'y'; *c = 'l'; break; + case 223: *a = 'l'; *b = 'u'; *c = 'd'; break; + case 224: *a = 'r'; *b = 'e'; *c = 'm'; break; + case 225: *a = 'l'; *b = 'y'; *c = 's'; break; + case 226: *a = 'f'; *b = 'y'; *c = 'n'; break; + case 227: *a = 'w'; *b = 'e'; *c = 'r'; break; + case 228: *a = 'r'; *b = 'y'; *c = 'c'; break; + case 229: *a = 's'; *b = 'u'; *c = 'g'; break; + case 230: *a = 'n'; *b = 'y'; *c = 's'; break; + case 231: *a = 'n'; *b = 'y'; *c = 'l'; break; + case 232: *a = 'l'; *b = 'y'; *c = 'n'; break; + case 233: *a = 'd'; *b = 'y'; *c = 'n'; break; + case 234: *a = 'd'; *b = 'e'; *c = 'm'; break; + case 235: *a = 'l'; *b = 'u'; *c = 'x'; break; + case 236: *a = 'f'; *b = 'e'; *c = 'd'; break; + case 237: *a = 's'; *b = 'e'; *c = 'd'; break; + case 238: *a = 'b'; *b = 'e'; *c = 'c'; break; + case 239: *a = 'm'; *b = 'u'; *c = 'n'; break; + case 240: *a = 'l'; *b = 'y'; *c = 'r'; break; + case 241: *a = 't'; *b = 'e'; *c = 's'; break; + case 242: *a = 'm'; *b = 'u'; *c = 'd'; break; + case 243: *a = 'n'; *b = 'y'; *c = 't'; break; + case 244: *a = 'b'; *b = 'y'; *c = 'r'; break; + case 245: *a = 's'; *b = 'e'; *c = 'n'; break; + case 246: *a = 'w'; *b = 'e'; *c = 'g'; break; + case 247: *a = 'f'; *b = 'y'; *c = 'r'; break; + case 248: *a = 'm'; *b = 'u'; *c = 'r'; break; + case 249: *a = 't'; *b = 'e'; *c = 'l'; break; + case 250: *a = 'r'; *b = 'e'; *c = 'p'; break; + case 251: *a = 't'; *b = 'e'; *c = 'g'; break; + case 252: *a = 'p'; *b = 'e'; *c = 'c'; break; + case 253: *a = 'n'; *b = 'e'; *c = 'l'; break; + case 254: *a = 'n'; *b = 'e'; *c = 'v'; break; + case 255: *a = 'f'; *b = 'e'; *c = 's'; break; + default: u3m_bail(c3__exit); + } +} + +u3_noun +u3qc_po_ins(u3_noun a) +{ + c3_y byt_y[3]; + u3r_bytes(0, 3, byt_y, a); + + return u3_po_find_prefix(byt_y[0], byt_y[1], byt_y[2]); +} + +u3_noun +u3wcp_ins(u3_noun cor) +{ + u3_noun a; + u3x_mean(cor, u3x_sam, &a, 0); + + if ( c3n == u3ud(a) ) { + return u3m_bail(c3__fail); } - u3_noun - u3wcp_ins(u3_noun cor) + return u3qc_po_ins(a); +} + +u3_noun +u3qc_po_ind(u3_noun a) +{ + c3_y byt_y[3]; + u3r_bytes(0, 3, byt_y, a); + + return u3_po_find_suffix(byt_y[0], byt_y[1], byt_y[2]); +} + +u3_noun +u3wcp_ind(u3_noun cor) +{ + u3_noun a; + u3x_mean(cor, u3x_sam, &a, 0); + + if ( c3n == u3ud(a) ) { + return u3m_bail(c3__fail); + } + + return u3qc_po_ind(a); +} + +u3_noun +u3wcp_tos(u3_noun cor) +{ + u3_noun a; + + if ( (c3n == u3r_mean(cor, u3x_sam, &a, 0)) || + (c3n == u3ud(a)) || + (a >= 256) ) { - u3_noun x, a, buf; - - if ( (c3n == u3r_mean(cor, u3x_sam, &a, u3x_con_sam, &x, 0)) || - (c3n == u3du(x)) || - (c3n == u3ud(buf = u3h(x))) || - (c3n == u3ud(a)) ) - { - return u3m_bail(c3__exit); - } else { - return _po_find(buf, a); - } + return u3m_bail(c3__exit); } - u3_noun - u3wcp_ind(u3_noun cor) + else { + c3_y byt_y[3]; + u3_po_to_prefix(a, &byt_y[0], &byt_y[1], &byt_y[2]); + return (byt_y[0] | (byt_y[1] << 8) | (byt_y[2] << 16)); + } +} + +u3_noun +u3wcp_tod(u3_noun cor) +{ + u3_noun a; + + if ( (c3n == u3r_mean(cor, u3x_sam, &a, 0)) || + (c3n == u3ud(a)) || + (a >= 256) ) { - u3_noun x, a, buf; - - if ( (c3n == u3r_mean(cor, u3x_sam, &a, u3x_con_sam, &x, 0)) || - (c3n == u3du(x)) || - (c3n == u3ud(buf = u3t(x))) || - (c3n == u3ud(a)) ) - { - return u3m_bail(c3__exit); - } else { - return _po_find(buf, a); - } - } - - u3_noun - u3wcp_tos(u3_noun cor) - { - u3_noun x, a, buf; - - if ( (c3n == u3r_mean(cor, u3x_sam, &a, u3x_con_sam, &x, 0)) || - (c3n == u3du(x)) || - (c3n == u3ud(buf = u3h(x))) || - (c3n == u3ud(a)) || - (a >= 256) ) - { - return u3m_bail(c3__exit); - } - else { - c3_y byt_y[3]; - - u3r_bytes((a * 3), 3, byt_y, buf); - return (byt_y[0] | (byt_y[1] << 8) | (byt_y[2] << 16)); - } - } - u3_noun - u3wcp_tod(u3_noun cor) - { - u3_noun x, a, buf; - - if ( (c3n == u3r_mean(cor, u3x_sam, &a, u3x_con_sam, &x, 0)) || - (c3n == u3du(x)) || - (c3n == u3ud(buf = u3t(x))) || - (c3n == u3ud(a)) || - (a >= 256) ) - { - return u3m_bail(c3__exit); - } else { - c3_y byt_y[3]; - - u3r_bytes((a * 3), 3, byt_y, buf); - return (byt_y[0] | (byt_y[1] << 8) | (byt_y[2] << 16)); - } + return u3m_bail(c3__exit); + } else { + c3_y byt_y[3]; + u3_po_to_suffix(a, &byt_y[0], &byt_y[1], &byt_y[2]); + return (byt_y[0] | (byt_y[1] << 8) | (byt_y[2] << 16)); } +} diff --git a/pkg/urbit/jets/e/mole.c b/pkg/urbit/jets/e/mole.c new file mode 100644 index 000000000..ee32472ec --- /dev/null +++ b/pkg/urbit/jets/e/mole.c @@ -0,0 +1,16 @@ +/* j/5/mule.c +** +*/ +#include "all.h" + +u3_noun +u3we_mole(u3_noun cor) +{ + u3_noun hok = u3j_cook("u3we_mole-mure", u3k(cor), "mure"); + + // just like +mule and +mute, this takes advantage of the fact that + // +mure's result is identical to that of +mole, and safely produces + // a statically-typed value while only evaluating the trap once. + // + return u3n_slam_on(hok, u3k(u3x_at(u3x_sam, cor))); +} diff --git a/pkg/urbit/jets/e/mule.c b/pkg/urbit/jets/e/mule.c index 3f74b7326..f27b294fa 100644 --- a/pkg/urbit/jets/e/mule.c +++ b/pkg/urbit/jets/e/mule.c @@ -3,21 +3,15 @@ */ #include "all.h" - u3_noun - u3we_mule(u3_noun cor) - { - u3_noun tap; +u3_noun +u3we_mule(u3_noun cor) +{ + u3_noun hok = u3j_cook("u3we_mule-mute", u3k(cor), "mute"); - if ( c3n == u3r_mean(cor, u3x_sam, &tap, 0) ) { - return u3m_bail(c3__exit); - } - else { - u3_noun hok = u3j_cook("u3we_mule-mute", u3k(cor), "mute"); - /* this takes advantage of the fact that mute's result, at the typeless - * C/Nock level, is identical to what a typed mule would produce, - * without running the formula twice. - */ - return u3n_slam_on(hok, u3k(tap)); - } - } + // this takes advantage of the fact that +mute's result is + // identical to that of +mule, and safely produces a statically-typed + // value while only evaluating the trap once. + // + return u3n_slam_on(hok, u3k(u3x_at(u3x_sam, cor))); +} diff --git a/pkg/urbit/jets/e/scow.c b/pkg/urbit/jets/e/scow.c new file mode 100644 index 000000000..2d4150292 --- /dev/null +++ b/pkg/urbit/jets/e/scow.c @@ -0,0 +1,389 @@ +/* j/3/scow.c +** +*/ +#include "all.h" + +#include + +static +c3_y to_digit(c3_y tig) +{ + if (tig >= 10) { + return 87 + tig; + } else { + return '0' + tig; + } +} + +static +c3_y to_w_digit(c3_y tig) +{ + if (tig == 63) { + return '~'; + } else if (tig == 62) { + return '-'; + } else if (tig >= 36) { + return 29 + tig; + } else if (tig >= 10) { + return 87 + tig; + } else { + return '0' + tig; + } +} + +// gives the characters for a four 'digit' small hex atom. +static +void +_x_co_four(c3_w src, c3_y* a, c3_y* b, c3_y* c, c3_y* d) +{ + *d = to_digit(src & 0xF); + src >>= 4; + *c = to_digit(src & 0xF); + src >>= 4; + *b = to_digit(src & 0xF); + src >>= 4; + *a = to_digit(src & 0xF); +} + +// The parser always prints two digits on 0 in y-co. +static +void +_y_co_two(c3_w src, c3_y* a, c3_y* b) +{ + *b = to_digit(src % 10); + *a = to_digit(src / 10); +} + +// +static +u3_noun +_add_year(c3_w year, u3_noun out) +{ + while (year > 0) { + out = u3nc(to_digit(year % 10), out); + year = year / 10; + } + + return out; +} + +static +u3_noun +_print_da(u3_noun cor, u3_atom raw_da) +{ + u3_noun hok = u3j_cook("u3we_scow_print_da", u3k(cor), "yore"); + u3_noun yod = u3n_slam_on(hok, u3k(raw_da)); + + u3_noun out = 0; + + u3_atom age, year, month, day, hour, min, sec, f; + if (c3n == u3r_mean(yod, 4, &age, + 5, &year, + 6, &month, + 14, &day, + 30, &hour, + 62, &min, + 126, &sec, + 127, &f, + 0)) { + return u3m_bail(c3__exit); + } + + if (f != 0) { + u3_noun f_list = u3qb_flop(f); + + for (u3_noun cur = f_list; + _(u3a_is_cell(cur)); + cur = u3t(cur)) { + if (_(u3a_is_cat(u3h(cur)))) { + c3_y a, b, c, d; + _x_co_four(u3h(cur), &a, &b, &c, &d); + out = u3nq('.', a, b, u3nt(c, d, out)); + } else { + // No way to deal with big atoms. fall back. + u3z(yod); + u3z(out); + u3z(f_list); + return u3_none; + } + } + + u3z(f_list); + out = u3nc('.', out); + } + + // if there isn't a hex list and the h/m/s are all 0, skip printing hours. + if (f != 0 || hour != 0 || min != 0 || sec != 0) { + if (!_(u3a_is_cat(hour)) || + !_(u3a_is_cat(min)) || + !_(u3a_is_cat(sec))) { + // Input is weird, fallback to nock. + u3z(yod); + u3z(out); + return u3_none; + } + + c3_y sa, sb, ma, mb, ha, hb; + _y_co_two(sec, &sa, &sb); + out = u3nq('.', sa, sb, out); + + _y_co_two(min, &ma, &mb); + out = u3nq('.', ma, mb, out); + + _y_co_two(hour, &ha, &hb); + out = u3nq('.', ha, hb, out); + + out = u3nc('.', out); + } + + // We always print the Y.M.D. Unlike others, these numbers are unconstrained + // by length, but in practice, the month number and day number can only be up + // to two digits because of +yore. We still need to remove 0 prefixes, + // though. + if (!_(u3a_is_cat(day)) || day > 99 || + !_(u3a_is_cat(month)) || month > 99 || + !_(u3a_is_cat(year))) { + // Input is weird, fallback to nock. + u3z(yod); + u3z(out); + return u3_none; + } + + c3_y da, db; + _y_co_two(day, &da, &db); + out = u3nc(db, out); + if (da != '0') { + out = u3nc(da, out); + } + out = u3nc('.', out); + + c3_y ma, mb; + _y_co_two(month, &ma, &mb); + out = u3nc(mb, out); + if (ma != '0') { + out = u3nc(ma, out); + } + out = u3nc('.', out); + + // suffix the year with a '-' for BC dates + if (age == c3n) { + out = u3nc('-', out); + } + + // The year part is the only place where we have to explicitly loop over the + // input because it can be arbitrarily large or small. + out = _add_year(year, out); + + out = u3nc('~', out); + + u3z(yod); + return out; +} + +static +u3_noun +_print_p(u3_atom cor, u3_atom p) +{ + // Scramble the raw number to the concealed version. + u3_noun ob = u3j_cook("u3we_scow_ob_p", u3k(cor), "ob"); + u3_noun hok = u3j_cook("u3we_scow_fein_p", ob, "fein"); + u3_atom sxz = u3n_slam_on(hok, u3k(p)); + + // Simple galaxy case + if (c3y == u3qa_lth(sxz, 256)) { + c3_y a, b, c; + u3_po_to_suffix(sxz, &a, &b, &c); + u3z(sxz); + return u3nq('~', a, b, u3nc(c, 0)); + } + + u3_atom dyy = u3qc_met(4, sxz); + if (!_(u3a_is_cat(dyy))) { + u3z(sxz); + u3z(dyy); + return u3_none; + } + + u3_noun list = 0; + for (c3_w imp = 0; imp != dyy; ++imp) { + c3_w log = u3qc_end(4, 1, sxz); + c3_w prefix = u3qc_rsh(3, 1, log); + c3_w suffix = u3qc_end(3, 1, log); + + c3_y a, b, c, d, e, f; + u3_po_to_prefix(prefix, &a, &b, &c); + u3_po_to_suffix(suffix, &d, &e, &f); + + if (imp % 4 == 0) { + if (imp != 0) { + list = u3nt('-', '-', list); + } + } else { + list = u3nc('-', list); + } + + list = u3nq(a, b, c, u3nq(d, e, f, list)); + + sxz = u3qc_rsh(4, 1, sxz); + } + + u3z(sxz); + return u3nc('~', list); +} + +static +u3_noun +_print_ud(u3_atom ud) +{ + // number of characters printed "between" periods. + c3_i between = 0; + u3_noun list = 0; + + // increase input refcount to be consumed in u3ka_div(), which will free each + // intermediary state. + u3k(ud); + + do { + if (between == 3) { + list = u3nc('.', list); + between = 0; + } + + list = u3nc(u3ka_add(u3qa_mod(ud, 10), '0'), list); + between++; + ud = u3ka_div(ud, 10); + } while (ud != 0); + + return list; +} + +static +u3_noun +_print_uv(u3_atom uv) +{ + // number of characters printed "between" periods. + c3_i between = 0; + u3_noun list = 0; + + // increase input refcount to be consumed in u3ka_div(), which will free each + // intermediary state. + u3k(uv); + + do { + if (between == 5) { + list = u3nc('.', list); + between = 0; + } + + c3_y tig = u3qa_mod(uv, 32); + list = u3nc(to_digit(tig), list); + between++; + uv = u3ka_div(uv, 32); + } while (uv != 0); + + return u3nt('0', 'v', list); +} + +static +u3_noun +_print_uw(u3_atom uw) +{ + // number of characters printed "between" periods. + c3_i between = 0; + u3_noun list = 0; + + // increase input refcount to be consumed in u3ka_div(), which will free each + // intermediary state. + u3k(uw); + + do { + if (between == 5) { + list = u3nc('.', list); + between = 0; + } + + c3_y tig = u3qa_mod(uw, 64); + list = u3nc(to_w_digit(tig), list); + between++; + uw = u3ka_div(uw, 64); + } while (uw != 0); + + return u3nt('0', 'w', list); +} + +u3_noun +u3we_scow(u3_noun cor) +{ + u3_atom mod; + u3_atom atom; + + if (c3n == u3r_mean(cor, u3x_sam_2, &mod, + u3x_sam_3, &atom, 0)) { + return u3m_bail(c3__exit); + } + + switch (mod) { + case c3__da: + return _print_da(cor, atom); + + case 'p': + return _print_p(cor, atom); + + case c3__ud: + return _print_ud(atom); + + case c3__uv: + return _print_uv(atom); + + case c3__uw: + return _print_uw(atom); + + default: + return u3_none; + } +} + +u3_noun +u3we_scot(u3_noun cor) +{ + u3_atom mod; + u3_atom atom; + + if (c3n == u3r_mean(cor, u3x_sam_2, &mod, + u3x_sam_3, &atom, 0)) { + return u3m_bail(c3__exit); + } + + u3_noun tape; + switch (mod) { + case c3__da: + tape = _print_da(cor, atom); + break; + + case 'p': + tape = _print_p(cor, atom); + break; + + case c3__ud: + tape = _print_ud(atom); + break; + + case c3__uv: + tape = _print_uv(atom); + break; + + case c3__uw: + tape = _print_uw(atom); + break; + + default: + return u3_none; + } + + if (tape == u3_none) { + return tape; + } + u3_noun ret = u3qc_rap(3, tape); + u3z(tape); + return ret; +} diff --git a/pkg/urbit/jets/e/slaw.c b/pkg/urbit/jets/e/slaw.c new file mode 100644 index 000000000..2933afb96 --- /dev/null +++ b/pkg/urbit/jets/e/slaw.c @@ -0,0 +1,510 @@ +/* j/3/slaw.c +** +*/ +#include "all.h" + +#include + +/* functions + */ +u3_noun +_parse_ud(u3_noun txt) { + c3_c* c = u3a_string(txt); + + // First character must represent a digit + c3_c* cur = c; + if (cur[0] > '9' || cur[0] < '0') { + u3a_free(c); + return u3_none; + } + u3_atom total = cur[0] - '0'; + cur++; + + int since_last_period = 0; + while (cur[0] != 0) { + since_last_period++; + if (cur[0] == '.') { + since_last_period = 0; + cur++; + continue; + } + + if (cur[0] > '9' || cur[0] < '0') { + u3a_free(c); + u3z(total); + return u3_none; + } + + total = u3ka_mul(total, 10); + total = u3ka_add(total, cur[0] - '0'); + cur++; + + if (since_last_period > 3) { + u3a_free(c); + u3z(total); + return u3_none; + } + } + + u3a_free(c); + return u3nc(0, total); +} + +static +u3_noun get_syllable(c3_c** cur_ptr, c3_c* one, c3_c* two, c3_c* three) { + if (islower((*cur_ptr)[0]) && islower((*cur_ptr)[1]) && + islower((*cur_ptr)[2])) { + *one = (*cur_ptr)[0]; + *two = (*cur_ptr)[1]; + *three = (*cur_ptr)[2]; + (*cur_ptr) += 3; + return c3y; + } else { + return c3n; + } +} + +static +u3_noun combine(u3_noun p, u3_noun q) +{ + if (_(u3a_is_atom(p))) { + return 0; + } + + if (_(u3a_is_atom(q))) { + return 0; + } + + u3_noun ret = u3nc(0, u3qa_add(u3t(p), u3qa_mul(256, u3t(q)))); + u3z(p); + u3z(q); + + return ret; +} + +#define ENSURE_NOT_END() do { \ + if (*cur == 0) { \ + u3a_free(c); \ + return u3_none; \ + } \ + } while (0) + +#define CONSUME(x) do { \ + if (*cur != x) { \ + u3a_free(c); \ + return u3_none; \ + } \ + cur++; \ + } while (0) + +#define TRY_GET_SYLLABLE(prefix) \ + c3_c prefix##_one, prefix##_two, prefix##_three; \ + if (c3n == get_syllable(&cur, & prefix##_one, & prefix##_two, & prefix##_three)) { \ + u3a_free(c); \ + return u3_none; \ + } + +u3_noun +_parse_p(u3_noun cor, u3_noun txt) { + c3_c* c = u3a_string(txt); + + c3_c* cur = c; + CONSUME('~'); + + // We at least have a sig prefix. We're now going to parse tuples of three + // lowercase letters. Our naming pattern for the pieces we read is [a b c d + // ...] as we read them. + TRY_GET_SYLLABLE(a); + + // There was only one syllable. If it's a valid suffix syllable, then + // it's a galaxy. We don't even have to run this through the scrambler or + // check for validity since its already a (unit @). + if (*cur == 0) { + u3a_free(c); + return u3_po_find_suffix(a_one, a_two, a_three); + } + + TRY_GET_SYLLABLE(b); + + // There were only two syllables. If they are a valid prefix and suffix, then + // it's a star. + if (*cur == 0) { + u3_noun a_part = u3_po_find_prefix(a_one, a_two, a_three); + u3_noun b_part = u3_po_find_suffix(b_one, b_two, b_three); + u3_atom combined = combine(b_part, a_part); + u3a_free(c); + return combined; + } + + // There must now be a - or it is invalid + CONSUME('-'); + + TRY_GET_SYLLABLE(c); + + ENSURE_NOT_END(); + + TRY_GET_SYLLABLE(d); + + if (*cur == 0) { + u3_noun a_part = u3_po_find_prefix(a_one, a_two, a_three); + u3_noun b_part = u3_po_find_suffix(b_one, b_two, b_three); + u3_noun c_part = u3_po_find_prefix(c_one, c_two, c_three); + u3_noun d_part = u3_po_find_suffix(d_one, d_two, d_three); + + u3_noun m = combine(d_part, combine(c_part, combine(b_part, a_part))); + u3a_free(c); + + if (_(u3a_is_atom(m))) { + return 0; + } + + u3_atom raw = u3k(u3t(m)); + u3z(m); + + u3_noun ob = u3j_cook("u3we_slaw_ob_p", u3k(cor), "ob"); + u3_noun hok = u3j_cook("u3we_slaw_fynd_p", ob, "fynd"); + return u3nc(0, u3n_slam_on(hok, raw)); + } + + // There must now be a - or it is invalid. + CONSUME('-'); + + // The next possible case is a "short" moon. (~ab-cd-ef) + TRY_GET_SYLLABLE(e); + + ENSURE_NOT_END(); + + TRY_GET_SYLLABLE(f); + + if (*cur == 0) { + u3_noun a_part = u3_po_find_prefix(a_one, a_two, a_three); + u3_noun b_part = u3_po_find_suffix(b_one, b_two, b_three); + u3_noun c_part = u3_po_find_prefix(c_one, c_two, c_three); + u3_noun d_part = u3_po_find_suffix(d_one, d_two, d_three); + u3_noun e_part = u3_po_find_prefix(e_one, e_two, e_three); + u3_noun f_part = u3_po_find_suffix(f_one, f_two, f_three); + + u3_noun m = combine(f_part, combine(e_part, combine(d_part, + combine(c_part, combine(b_part, a_part))))); + u3a_free(c); + + if (_(u3a_is_atom(m))) { + return 0; + } + + u3_atom raw = u3k(u3t(m)); + u3z(m); + u3_noun ob = u3j_cook("u3we_slaw_ob_p", u3k(cor), "ob"); + u3_noun hok = u3j_cook("u3we_slaw_fynd_p", ob, "fynd"); + return u3nc(0, u3n_slam_on(hok, raw)); + } + + // There must now be a - or it is invalid. + CONSUME('-'); + + // The next possible case is a "long" moon. (~ab-cd-ef-gh) + TRY_GET_SYLLABLE(g); + + ENSURE_NOT_END(); + + TRY_GET_SYLLABLE(h); + + if (*cur == 0) { + u3_noun a_part = u3_po_find_prefix(a_one, a_two, a_three); + u3_noun b_part = u3_po_find_suffix(b_one, b_two, b_three); + u3_noun c_part = u3_po_find_prefix(c_one, c_two, c_three); + u3_noun d_part = u3_po_find_suffix(d_one, d_two, d_three); + u3_noun e_part = u3_po_find_prefix(e_one, e_two, e_three); + u3_noun f_part = u3_po_find_suffix(f_one, f_two, f_three); + u3_noun g_part = u3_po_find_prefix(g_one, g_two, g_three); + u3_noun h_part = u3_po_find_suffix(h_one, h_two, h_three); + + u3_noun m = combine(h_part, combine(g_part, combine(f_part, + combine(e_part, combine(d_part, combine(c_part, + combine(b_part, a_part))))))); + u3a_free(c); + + if (_(u3a_is_atom(m))) { + return 0; + } + + u3_atom raw = u3k(u3t(m)); + u3z(m); + u3_noun ob = u3j_cook("u3we_slaw_ob_p", u3k(cor), "ob"); + u3_noun hok = u3j_cook("u3we_slaw_fynd_p", ob, "fynd"); + return u3nc(0, u3n_slam_on(hok, raw)); + } + + // At this point, the only thing it could be is a long comet, of the form + // ~ab-cd-ef-gh--ij-kl-mn-op + + CONSUME('-'); + CONSUME('-'); + + TRY_GET_SYLLABLE(i); + ENSURE_NOT_END(); + TRY_GET_SYLLABLE(j); + CONSUME('-'); + TRY_GET_SYLLABLE(k); + ENSURE_NOT_END(); + TRY_GET_SYLLABLE(l); + CONSUME('-'); + TRY_GET_SYLLABLE(m); + ENSURE_NOT_END(); + TRY_GET_SYLLABLE(n); + CONSUME('-'); + TRY_GET_SYLLABLE(o); + ENSURE_NOT_END(); + TRY_GET_SYLLABLE(p); + + if (*cur != 0) { + // We've parsed all of a comet shape, and there's still more in the + // string. Bail back to the interpreter. + u3a_free(c); + return u3_none; + } + + // We have a long comet. Time to jam it all together. We rely on combine() + // for the error checking and we don't have to scramble comet names. + u3_noun a_part = u3_po_find_prefix(a_one, a_two, a_three); + u3_noun b_part = u3_po_find_suffix(b_one, b_two, b_three); + u3_noun c_part = u3_po_find_prefix(c_one, c_two, c_three); + u3_noun d_part = u3_po_find_suffix(d_one, d_two, d_three); + u3_noun e_part = u3_po_find_prefix(e_one, e_two, e_three); + u3_noun f_part = u3_po_find_suffix(f_one, f_two, f_three); + u3_noun g_part = u3_po_find_prefix(g_one, g_two, g_three); + u3_noun h_part = u3_po_find_suffix(h_one, h_two, h_three); + u3_noun i_part = u3_po_find_prefix(i_one, i_two, i_three); + u3_noun j_part = u3_po_find_suffix(j_one, j_two, j_three); + u3_noun k_part = u3_po_find_prefix(k_one, k_two, k_three); + u3_noun l_part = u3_po_find_suffix(l_one, l_two, l_three); + u3_noun m_part = u3_po_find_prefix(m_one, m_two, m_three); + u3_noun n_part = u3_po_find_suffix(n_one, n_two, n_three); + u3_noun o_part = u3_po_find_prefix(o_one, o_two, o_three); + u3_noun p_part = u3_po_find_suffix(p_one, p_two, p_three); + + u3a_free(c); + + return combine(p_part, combine(o_part, combine(n_part, combine(m_part, + combine(l_part, combine(k_part, combine(j_part, combine(i_part, + combine(h_part, combine(g_part, combine(f_part, combine(e_part, + combine(d_part, combine(c_part, combine(b_part, a_part))))))))))))))); +} + +#define PARSE_NONZERO_NUMBER(numname) \ + c3_w numname = 0; \ + do { \ + if (cur[0] > '9' || cur[0] < '1') { \ + u3a_free(c); \ + return u3_none; \ + } \ + numname = cur[0] - '0'; \ + cur++; \ + while (isdigit(cur[0])) { \ + numname = u3ka_mul(numname, 10); \ + numname = u3ka_add(numname, cur[0] - '0'); \ + cur++; \ + } \ + } while (0) + +#define PARSE_INCLUDING_ZERO_NUMBER(numname) \ + c3_w numname = 0; \ + do { \ + if (cur[0] > '9' || cur[0] < '0') { \ + u3a_free(c); \ + return u3_none; \ + } \ + numname = cur[0] - '0'; \ + cur++; \ + while (isdigit(cur[0])) { \ + numname = u3ka_mul(numname, 10); \ + numname = u3ka_add(numname, cur[0] - '0'); \ + cur++; \ + } \ + } while (0) + +#define PARSE_HEX_DIGIT(out) \ + do { \ + if (cur[0] >= '0' && cur[0] <= '9') { \ + out = cur[0] - '0'; \ + } else if (cur[0] >= 'a' && cur[0] <= 'f') { \ + out = 10 + cur[0] - 'a'; \ + } else { \ + u3a_free(c); \ + return u3_none; \ + } \ + cur++; \ + } while(0) + + +u3_noun +_parse_da(u3_noun cor, u3_noun txt) { + c3_c* c = u3a_string(txt); + + c3_c* cur = c; + CONSUME('~'); + + // Parse out an arbitrary year number. Starts with a nonzero digit followed + // by a series of any digits. + PARSE_NONZERO_NUMBER(year); + + // Parse the optional negative sign for BC dates. + u3_noun bc = c3y; + if (cur[0] == '-') { + bc = c3n; + cur++; + } + + CONSUME('.'); + + // Parse out a two digit month (mot:ag). Either a single digit 1-9 or 1[012]. + c3_y month; + if (cur[0] == '1') { + if (cur[1] <= '2' && cur[1] >= '0') { + // This is a two number month. + month = 10 + cur[1] - '0'; + cur += 2; + } else { + // This is January. + month = 1; + cur++; + } + } else if (cur[0] <= '9' && cur[0] >= '2') { + month = cur[0] - '0'; + cur++; + } else { + u3a_free(c); + return u3_none; + } + + CONSUME('.'); + + // Parse out a two digit day (dip:ag). This number can be really big, so we + // can track number of days since September 1993. + PARSE_NONZERO_NUMBER(day); + + if (cur[0] == 0) { + u3a_free(c); + u3_noun hok = u3j_cook("u3we_slaw_parse_da", u3k(cor), "year"); + u3_noun res = u3n_slam_on(hok, + u3nt(u3nc(bc, year), month, + u3nc(day, u3nq(0, 0, 0, 0)))); + return u3nc(0, res); + } + + CONSUME('.'); + CONSUME('.'); + + PARSE_INCLUDING_ZERO_NUMBER(hour); + CONSUME('.'); + PARSE_INCLUDING_ZERO_NUMBER(minute); + CONSUME('.'); + PARSE_INCLUDING_ZERO_NUMBER(second); + + if (cur[0] == 0) { + u3a_free(c); + u3_noun hok = u3j_cook("u3we_slaw_parse_da", u3k(cor), "year"); + u3_noun res = u3n_slam_on(hok, + u3nt(u3nc(bc, year), month, + u3nc(day, u3nq(hour, minute, second, 0)))); + return u3nc(0, res); + } + + CONSUME('.'); + CONSUME('.'); + + // Now we have to parse a list of hexidecimal numbers 0-f of length 4 only + // (zero padded otherwise) separated by dots. + u3_noun list = 0; + while (1) { + // Parse 4 hex digits + c3_y one, two, three, four; + PARSE_HEX_DIGIT(one); + PARSE_HEX_DIGIT(two); + PARSE_HEX_DIGIT(three); + PARSE_HEX_DIGIT(four); + + c3_w current = (one << 12) + (two << 8) + (three << 4) + four; + list = u3nc(u3i_words(1, ¤t), list); + + if (cur[0] == 0) { + u3a_free(c); + + u3_noun flopped = u3qb_flop(list); + u3z(list); + + u3_noun hok = u3j_cook("u3we_slaw_parse_da", u3k(cor), "year"); + u3_noun res = u3n_slam_on(hok, + u3nt(u3nc(bc, year), month, + u3nc(day, + u3nq(hour, minute, second, flopped)))); + return u3nc(0, res); + } + + CONSUME('.'); + } +} + +#undef ENSURE_NOT_END +#undef CONSUME +#undef TRY_GET_SYLLABLE +#undef PARSE_NONZERO_NUMBER +#undef PARSE_HEX_DIGIT + +u3_noun +_parse_tas(u3_noun txt) { + // For any symbol which matches, txt will return itself as a + // value. Therefore, this is mostly checking validity. + c3_c* c = u3a_string(txt); + + // First character must represent a lowercase letter + c3_c* cur = c; + if (!islower(cur[0])) { + u3a_free(c); + return 0; + } + cur++; + + while (cur[0] != 0) { + if (!(islower(cur[0]) || isdigit(cur[0]) || cur[0] == '-')) { + u3a_free(c); + return 0; + } + + cur++; + } + + u3a_free(c); + return u3nc(0, u3k(txt)); +} + +u3_noun +u3we_slaw(u3_noun cor) +{ + u3_noun mod; + u3_noun txt; + + if (c3n == u3r_mean(cor, u3x_sam_2, &mod, + u3x_sam_3, &txt, 0)) { + return u3m_bail(c3__exit); + } + + switch (mod) { + case c3__da: + return _parse_da(cor, txt); + + case 'p': + return _parse_p(cor, txt); + + case c3__ud: + return _parse_ud(txt); + + // %ta is used once in link.hoon. don't bother. + + case c3__tas: + return _parse_tas(txt); + + default: + return u3_none; + } +} diff --git a/pkg/urbit/jets/f/ut_mint.c b/pkg/urbit/jets/f/ut_mint.c index 005b3217c..b3446f0e0 100644 --- a/pkg/urbit/jets/f/ut_mint.c +++ b/pkg/urbit/jets/f/ut_mint.c @@ -18,8 +18,8 @@ u3wfu_mint(u3_noun cor) } else { c3_m fun_m = 141 + c3__mint; - u3_noun vrf = u3r_at(u3qfu_van_vrf, van); - u3_noun key = u3z_key_5(fun_m, vrf, sut, gol, gen, bat); + u3_noun vet = u3r_at(u3qfu_van_vet, van); + u3_noun key = u3z_key_5(fun_m, vet, sut, gol, gen, bat); u3_weak pro = u3z_find(key); if ( u3_none != pro ) { diff --git a/pkg/urbit/jets/tree.c b/pkg/urbit/jets/tree.c index 9ef89bbbd..057c4f7a1 100644 --- a/pkg/urbit/jets/tree.c +++ b/pkg/urbit/jets/tree.c @@ -342,49 +342,26 @@ static c3_c* _141_hex_argon_ha[] = { 0 }; - static u3j_harm _141_hex_secp_make_a[] = {{".2", u3we_make, c3y}, {}}; - static c3_c* _141_hex_secp_make_ha[] = { - "171cae298e8f73b6b77c72f957d9d7afd495ed1ca7d78fe9d5f869ea2203bada", - 0 - }; - static u3j_harm _141_hex_secp_sign_a[] = {{".2", u3we_sign, c3y}, {}}; - static c3_c* _141_hex_secp_sign_ha[] = { - "aac58cd537481d41fc4d941a7a0ed247552d64af6c9dce71e0d74c39384e2d60", - 0 - }; - static u3j_harm _141_hex_secp_reco_a[] = {{".2", u3we_reco, c3y}, {}}; - static c3_c* _141_hex_secp_reco_ha[] = { - "390d4cd3a04817b6436035a6fa77fe3008008afa164db732c8f4d5c52954fbee", - 0 - }; -static u3j_core _141_hex_secp_secp_helper_d[] = - { { "make-k", 7, _141_hex_secp_make_a, 0, _141_hex_secp_make_ha }, - { "ecdsa-raw-sign", 7, _141_hex_secp_sign_a, 0, _141_hex_secp_sign_ha }, - { "ecdsa-raw-recover", 7, _141_hex_secp_reco_a, 0, _141_hex_secp_reco_ha }, +static c3_c* _141_hex_secp_secp256k1_make_ha[] = { 0 }; +static u3j_harm _141_hex_secp_secp256k1_make_a[] = {{".2", u3we_make, c3y}, {}}; +static c3_c* _141_hex_secp_secp256k1_sign_ha[] = { 0 }; +static u3j_harm _141_hex_secp_secp256k1_sign_a[] = {{".2", u3we_sign, c3y}, {}}; +static c3_c* _141_hex_secp_secp256k1_reco_ha[] = { 0 }; +static u3j_harm _141_hex_secp_secp256k1_reco_a[] = {{".2", u3we_reco, c3y}, {}}; + +static c3_c* _141_hex_secp_secp256k1_ha[] = { 0 }; +static u3j_core _141_hex_secp_secp256k1_d[] = + { { "make", 7, _141_hex_secp_secp256k1_make_a, 0, _141_hex_secp_secp256k1_make_ha }, + { "sign", 7, _141_hex_secp_secp256k1_sign_a, 0, _141_hex_secp_secp256k1_sign_ha }, + { "reco", 7, _141_hex_secp_secp256k1_reco_a, 0, _141_hex_secp_secp256k1_reco_ha }, {} }; -static c3_c* _141_hex_secp_secp_helper_ha[] = { - "24175b141f1efc2e2de00c39a2b70cf3491f2b82371e0e15f63dfb6d2d86eac5", - 0 -}; - -static u3j_core _141_hex_secp_secp_d[] = - { { "helper", 15, 0, _141_hex_secp_secp_helper_d, _141_hex_secp_secp_helper_ha }, - {} - }; -static c3_c* _141_hex_secp_secp_ha[] = { - "42f57966a293fdadbce8b0cc2108039f1f7fafe0b12f1fec52b2d1937a8347d7", - 0 -}; +static c3_c* _141_hex_secp_ha[] = { 0 }; static u3j_core _141_hex_secp_d[] = - { { "secp", 7, 0, _141_hex_secp_secp_d, _141_hex_secp_secp_ha }, + { { "secp256k1", 3, 0, _141_hex_secp_secp256k1_d, _141_hex_secp_secp256k1_ha }, {} }; -static c3_c* _141_hex_secp_ha[] = { - "e153a8c88f04bfed03dc882f560f912eaf3f5e3911f55dbb054519c2e1b4d778", - 0 -}; static u3j_harm _141_hex_blake2b_a[] = {{".2", u3we_blake, c3y}, {}}; static c3_c* _141_hex_blake2b_ha[] = { @@ -428,7 +405,7 @@ static u3j_core _141_hex_d[] = { "argon", 31, 0, _141_hex_argon_d, _141_hex_argon_ha }, { "blake", 31, 0, _141_hex_blake_d, _141_hex_blake_ha }, { "ripemd", 31, 0, _141_hex_ripe_d, _141_hex_ripe_ha }, - { "secp", 31, 0, _141_hex_secp_d, _141_hex_secp_ha }, + { "secp", 6, 0, _141_hex_secp_d, _141_hex_secp_ha }, { "mimes", 31, 0, _141_hex_mimes_d, _141_hex_mimes_ha }, {} }; @@ -571,8 +548,7 @@ static u3j_hood _141_pen__ut_ho[] = { { "ar", 12282 }, { "fan", 28, c3n }, { "rib", 58, c3n }, - { "vet", 118, c3n }, - { "fab", 119, c3n }, + { "vet", 59, c3n }, { "blow", 6015 }, { "burp", 342 }, @@ -674,6 +650,19 @@ static c3_c* _141_qua_trip_ha[] = { 0 }; +static u3j_harm _141_qua_slaw_a[] = {{".2", u3we_slaw}, {}}; +static c3_c* _141_qua_slaw_ha[] = { + 0 +}; +static u3j_harm _141_qua_scot_a[] = {{".2", u3we_scot}, {}}; +static c3_c* _141_qua_scot_ha[] = { + 0 +}; +static u3j_harm _141_qua_scow_a[] = {{".2", u3we_scow}, {}}; +static c3_c* _141_qua_scow_ha[] = { + 0 +}; + static u3j_harm _141_qua__po_ind_a[] = {{".2", u3wcp_ind}, {}}; static c3_c* _141_qua__po_ind_ha[] = { "95bbe9867dbbd1b9ce12671d64cf7b1dee8d987c6770955a83c73291c4537a61", @@ -913,7 +902,10 @@ static c3_c* _141_qua_sfix_ha[] = { static u3j_harm _141_qua_mink_a[] = {{".2", u3we_mink}, {}}; static c3_c* _141_qua_mink_ha[] = { - "fd66c7ed46e5440ea759e6ace2341e6170aec48c79de27ffff3d179d1b5e491e", + 0 +}; +static u3j_harm _141_qua_mole_a[] = {{".2", u3we_mole}, {}}; +static c3_c* _141_qua_mole_ha[] = { 0 }; static u3j_harm _141_qua_mule_a[] = {{".2", u3we_mule}, {}}; @@ -949,7 +941,12 @@ static u3j_core _141_qua_d[] = { "sfix", 7, _141_qua_sfix_a, 0, _141_qua_sfix_ha }, { "mink", 7, _141_qua_mink_a, 0, _141_qua_mink_ha }, + { "mole", 7, _141_qua_mole_a, 0, _141_qua_mole_ha }, { "mule", 7, _141_qua_mule_a, 0, _141_qua_mule_ha }, + + { "scot", 7, _141_qua_scot_a, 0, _141_qua_scot_ha }, + { "scow", 7, _141_qua_scow_a, 0, _141_qua_scow_ha }, + { "slaw", 7, _141_qua_slaw_a, 0, _141_qua_slaw_ha }, {} }; static c3_c* _141_qua_ha[] = { diff --git a/pkg/urbit/noun/allocate.c b/pkg/urbit/noun/allocate.c index 7beee65a4..4536069a6 100644 --- a/pkg/urbit/noun/allocate.c +++ b/pkg/urbit/noun/allocate.c @@ -1036,6 +1036,7 @@ _me_gain_use(u3_noun dog) u3a_box* box_u = u3a_botox(dog_w); if ( 0x7fffffff == box_u->use_w ) { + u3l_log("fail in _me_gain_use"); u3m_bail(c3__fail); } else { @@ -2682,3 +2683,16 @@ u3a_walk_fore_unsafe(u3_noun a, a = *top; } } + +/* u3a_string(): `a` as an on-loom c-string. +*/ +c3_c* +u3a_string(u3_atom a) +{ + c3_w met_w = u3r_met(3, a); + c3_c* str_c = u3a_malloc(met_w + 1); + + u3r_bytes(0, met_w, (c3_y*)str_c, a); + str_c[met_w] = 0; + return str_c; +} diff --git a/pkg/urbit/noun/imprison.c b/pkg/urbit/noun/imprison.c index 58251cc17..e3603812c 100644 --- a/pkg/urbit/noun/imprison.c +++ b/pkg/urbit/noun/imprison.c @@ -660,6 +660,7 @@ _mutate_cat(u3_noun big, c3_l axe_l, u3_noun som) *tar = _edit_or_mutate_cat(*tar, u3x_mas(axe_l), som); } } + cel_u->mug_w = 0; } } @@ -679,6 +680,7 @@ _mutate(u3_noun big, u3_noun axe, u3_noun som) ? &(cel_u->hed) : &(cel_u->tel); *tar = _edit_or_mutate(*tar, mor, som); + cel_u->mug_w = 0; u3z(mor); } } diff --git a/pkg/urbit/noun/jets.c b/pkg/urbit/noun/jets.c index 4085f06a3..e443e7b3b 100644 --- a/pkg/urbit/noun/jets.c +++ b/pkg/urbit/noun/jets.c @@ -947,11 +947,13 @@ _cj_hook_in(u3_noun cor, u3_noun roc, tem, got, pat, nam, huc; if ( c3n == u3du(cor) ) { + u3l_log("_cj_hook_in failure: c3n == u3du(cor)\r\n"); return u3m_bail(c3__fail); } loc = _cj_spot(cor, NULL); if ( u3_none == loc ) { + u3l_log("_cj_hook_in failure: u3_none == loc\r\n"); return u3m_bail(c3__fail); } @@ -1016,6 +1018,7 @@ _cj_hook_in(u3_noun cor, else { u3_noun sat = u3t(pat); if ( c3y == u3h(sat) ) { + u3l_log("_cj_hook_in failure: c3y == u3h(sat)\r\n"); return u3m_bail(c3__fail); } else { @@ -1155,11 +1158,13 @@ _cj_hank_fill(_cj_hank* han_u, u3_noun tam, u3_noun cor) u3j_site* sit_u = &(han_u->sit_u); if ( c3n == u3du(cor) ) { + u3l_log("fail in _cj_hank_fill (c3n == u3du(cor))"); return u3m_bail(c3__fail); } sit_u->bas = u3_none; if ( u3_none == (col = loc = _cj_spot(cor, NULL)) ) { + u3l_log("fail in _cj_hank_fill (_cj_spot(cor, NULL))"); return u3m_bail(c3__fail); } @@ -1202,6 +1207,7 @@ _cj_hank_fill(_cj_hank* han_u, u3_noun tam, u3_noun cor) else { u3_noun sat = u3t(pat); if ( c3y == u3h(sat) ) { + u3l_log("fail in _cj_hank_fill (c3y == u3h(sat))"); return u3m_bail(c3__fail); } else { diff --git a/pkg/urbit/noun/nock.c b/pkg/urbit/noun/nock.c index 88d3d148d..06aab9b98 100644 --- a/pkg/urbit/noun/nock.c +++ b/pkg/urbit/noun/nock.c @@ -7,41 +7,6 @@ // along with some other debugging info # undef VERBOSE_BYTECODE -/* _n_mush_in(): see _n_mush(). -*/ -static u3_noun -_n_mush_in(u3_noun val) -{ - if ( c3n == u3du(val) ) { - return u3_nul; - } - else { - u3_noun h_val = u3h(val); - u3_noun ite; - - if ( c3n == u3ud(h_val) ) { - ite = u3nc(c3__leaf, u3_nul); - } else { - ite = u3nc(c3__leaf, u3qe_trip(h_val)); - } - return u3nc(ite, _n_mush_in(u3t(val))); - } -} - -/* _n_mush(): tank from failed path request. -*/ -static u3_noun -_n_mush(u3_noun val) -{ - u3_noun pro; - - pro = u3nt(c3__rose, - u3nt(u3nc('/', u3_nul), u3nc('/', u3_nul), u3_nul), - _n_mush_in(val)); - u3z(val); - return pro; -} - #if 0 // Retained for debugging purposes. static u3_noun _n_nock_on(u3_noun bus, u3_noun fol); @@ -386,7 +351,7 @@ _n_nock_on(u3_noun bus, u3_noun fol) u3_noun val; u3t_off(noc_o); - val = u3m_soft_esc(ref, u3k(gof)); + val = u3m_soft_esc(u3k(ref), u3k(gof)); u3t_on(noc_o); if ( !_(u3du(val)) ) { @@ -396,12 +361,13 @@ _n_nock_on(u3_noun bus, u3_noun fol) // // replace with proper error stack push // - u3t_push(u3nc(c3__hunk, _n_mush(gof))); + u3t_push(u3nt(c3__hunk, ref, gof)); return u3m_bail(c3__exit); } else { u3_noun pro; + u3z(ref); u3z(gof); u3z(fol); pro = u3k(u3t(u3t(val))); @@ -509,22 +475,32 @@ _n_nock_on(u3_noun bus, u3_noun fol) #define SLIB 70 #define SLIS 71 #define SAVE 72 +// before formula +#define HILB 73 // atomic, byte +#define HILS 74 // atomic, short +#define HINB 75 // arbitrary, byte +#define HINS 76 // arbitrary, short +// after formula +#define HILK 77 // atomic, keep +#define HILL 78 // atomic, lose +#define HINK 79 // arbitrary, keep +#define HINL 80 // arbitrary, lose // nock 10 -#define MUTH 73 -#define KUTH 74 -#define MUTT 75 -#define KUTT 76 -#define MUSM 77 -#define KUSM 78 -#define MUTB 79 -#define MUTS 80 -#define MITB 81 -#define MITS 82 -#define KUTB 83 -#define KUTS 84 -#define KITB 85 -#define KITS 86 -#define LAST 87 +#define MUTH 81 +#define KUTH 82 +#define MUTT 83 +#define KUTT 84 +#define MUSM 85 +#define KUSM 86 +#define MUTB 87 +#define MUTS 88 +#define MITB 89 +#define MITS 90 +#define KUTB 91 +#define KUTS 92 +#define KITB 93 +#define KITS 94 +#define LAST 95 /* _n_arg(): return the size (in bytes) of an opcode's argument */ @@ -639,6 +615,7 @@ _n_melt(u3_noun ops, c3_w* byc_w, c3_w* cal_w, case SAST: case SALT: case KICS: case TICS: case FISK: case FISL: case SUSH: case SANS: case LISL: case LISK: case SKIS: case SLIS: + case HILS: case HINS: c3_assert(0); //overflows break; @@ -659,6 +636,7 @@ _n_melt(u3_noun ops, c3_w* byc_w, c3_w* cal_w, case BUSH: case FIBK: case FIBL: case SANB: case LIBL: case LIBK: case KITB: case MITB: + case HILB: case HINB: a_w = (*lit_w)++; if ( a_w <= 0xFF ) { siz_y[i_w] = 2; @@ -890,6 +868,7 @@ _n_prog_asm(u3_noun ops, u3n_prog* pog_u, u3_noun sip) case LIBK: case LIBL: case BUSH: case SANB: case KITB: case MITB: + case HILB: case HINB: _n_prog_asm_inx(buf_y, &i_w, lit_s, cod); pog_u->lit_u.non[lit_s++] = u3k(u3t(op)); break; @@ -997,6 +976,8 @@ static char* opcode_names[] = { "balt", "salt", "skib", "skis", "slib", "slis", "save", + "hilb", "hils", "hinb", "hins" + "hilk", "hill", "hink", "hinl" "muth", "kuth", "mutt", "kutt", "musm", "kusm", "mutb", "muts", "mitb", "mits", @@ -1029,21 +1010,64 @@ static c3_w _n_comp(u3_noun*, u3_noun, c3_o, c3_o); static c3_w _n_bint(u3_noun* ops, u3_noun hif, u3_noun nef, c3_o los_o, c3_o tel_o) { + c3_w tot_w = 0; + if ( c3n == u3du(hif) ) { - // no currently recognized static hints - return _n_comp(ops, nef, los_o, tel_o); + // compile whitelisted atomic hints to dispatch protocol; + // compute and drop all others; + // + switch ( hif ) { + default: { + return _n_comp(ops, nef, los_o, tel_o); + } + + // no currently recognized static hints + // + case u3_none: { + u3_noun fen = u3_nul; + c3_w nef_w = _n_comp(&fen, nef, los_o, tel_o); + + // HILB overflows to HILS + // + ++tot_w; _n_emit(ops, u3nc(HILB, u3nc(u3k(hif), u3k(nef)))); + ++tot_w; _n_emit(ops, u3nc(SBIN, nef_w + 1)); + tot_w += nef_w; _n_apen(ops, fen); + ++tot_w; _n_emit(ops, ( c3y == los_o ) ? HILL : HILK); + } break; + } } else { - c3_w tot_w = 0; u3_noun zep, hod; u3x_cell(hif, &zep, &hod); switch ( zep ) { - default: - tot_w += _n_comp(ops, hod, c3n, c3n); - ++tot_w; _n_emit(ops, TOSS); - tot_w += _n_comp(ops, nef, los_o, tel_o); - break; + default: { + // compile whitelisted dynamic hints to dispatch protocol; + // compute and drop all others; + // + switch ( zep ) { + default: { + tot_w += _n_comp(ops, hod, c3n, c3n); + ++tot_w; _n_emit(ops, TOSS); + tot_w += _n_comp(ops, nef, los_o, tel_o); + } break; + + // no currently recognized dynamic hints + // + case u3_none: { + u3_noun fen = u3_nul; + c3_w nef_w = _n_comp(&fen, nef, los_o, tel_o); + + tot_w += _n_comp(ops, hod, c3n, c3n); + // HINB overflows to HINS + // + ++tot_w; _n_emit(ops, u3nc(HINB, u3nc(u3k(zep), u3k(nef)))); + ++tot_w; _n_emit(ops, u3nc(SBIN, nef_w + 1)); + tot_w += nef_w; _n_apen(ops, fen); + ++tot_w; _n_emit(ops, ( c3y == los_o ) ? HINL : HINK); + } break; + } + } break; case c3__hunk: case c3__lose: @@ -1096,7 +1120,70 @@ _n_bint(u3_noun* ops, u3_noun hif, u3_noun nef, c3_o los_o, c3_o tel_o) break; } } - return tot_w; + } + + return tot_w; +} + +static c3_t +_n_formulaic(u3_noun fol) +{ + u3_noun op, ar, a, b, c; + if ( c3n == u3r_cell(fol, &op, &ar) ) { + return 0; + } + if ( c3y == u3du(op) ) { + return _n_formulaic(op) && _n_formulaic(ar); + } + else switch ( op ) { + case 0: + return ( c3y == u3ud(ar) ); + case 1: + return 1; + case 3: + case 4: + return _n_formulaic(ar); + case 2: + case 5: + case 7: + case 8: + case 12: + return (c3y == u3r_cell(ar, &a, &b)) + && _n_formulaic(a) && _n_formulaic(b); + case 6: + return ( c3y == u3r_trel(ar, &a, &b, &c) ) + && _n_formulaic(a) && + (_n_formulaic(b) || _n_formulaic(c)); + case 9: + return (c3y == u3r_cell(ar, &a, &b)) + && (c3y == u3ud(a)) + && _n_formulaic(b); + case 10: + if ( c3n == u3r_cell(ar, &a, &b) ) { + return 0; + } + if ( c3n == u3du(a) ) { + return 0; + } + if ( c3n == u3ud(u3h(a)) ) { + return 0; + } + return _n_formulaic(u3t(a)) && _n_formulaic(b); + case 11: + if ( c3n == u3r_cell(ar, &a, &b) ) { + return 0; + } + if ( !_n_formulaic(b) ) { + return 0; + } + if ( c3y == u3ud(a) ) { + return 1; + } + else { + return ( c3y == u3ud(u3h(a)) ) && _n_formulaic(u3t(a)); + } + default: + return 0; } } @@ -1246,10 +1333,32 @@ _n_comp(u3_noun* ops, u3_noun fol, c3_o los_o, c3_o tel_o) yep = u3_nul, nop = u3_nul; c3_w yep_w, nop_w; + c3_t yep_t, nop_t; u3x_trel(arg, &hed, &mid, &tel); + tot_w += _n_comp(ops, hed, c3n, c3n); - yep_w = _n_comp(&yep, mid, los_o, tel_o); - nop_w = _n_comp(&nop, tel, los_o, tel_o); + yep_t = _n_formulaic(mid); + nop_t = _n_formulaic(tel); + + if ( !yep_t && !nop_t ) { + u3m_bail(c3__exit); + break; + } + + if ( yep_t ) { + yep_w = _n_comp(&yep, mid, los_o, tel_o); + } + else { + yep_w = 1; _n_emit(&yep, BAIL); + } + + if ( nop_t ) { + nop_w = _n_comp(&nop, tel, los_o, tel_o); + } + else { + nop_w = 1; _n_emit(&nop, BAIL); + } + // SBIP and SBIN get sized during assembly ++yep_w; _n_emit(&yep, u3nc(SBIP, nop_w)); ++tot_w; _n_emit(ops, u3nc(SBIN, yep_w)); @@ -1435,6 +1544,19 @@ _n_rewo(c3_y* buf, c3_w* ip_w) return one | (two << 8) | (tre << 16) | (qua << 24); } +/* _n_swap(): swap two items on the top of the stack, return pointer to top + */ +static inline u3_noun* +_n_swap(c3_ys mov, c3_ys off) +{ + u3_noun* top = _n_peek(off); + u3_noun* up = _n_peet(mov, off); + u3_noun tmp = *up; + *up = *top; + *top = tmp; + return top; +} + #ifdef VERBOSE_BYTECODE /* _n_print_byc(): print bytecode. used for debugging. */ @@ -1554,17 +1676,59 @@ u3n_find(u3_noun key, u3_noun fol) return pog_p; } -/* _n_swap(): swap two items on the top of the stack, return pointer to top - */ -static inline u3_noun* -_n_swap(c3_ys mov, c3_ys off) +/* _n_hilt_fore(): literal (atomic) dynamic hint, before formula evaluation. +** lit: hint atom. TRANSFER +** bus: subject. RETAIN +** out: token for _n_hilt_hind(); +** conventionally, [lit] or [lit data]. ~ if unused. +** +** any hints herein must be whitelisted in _n_burn(). +*/ +static c3_o +_n_hilt_fore(u3_atom lit, u3_noun bus, u3_noun* out) // transfer, retain, n/a { - u3_noun* top = _n_peek(off); - u3_noun* up = _n_peet(mov, off); - u3_noun tmp = *up; - *up = *top; - *top = tmp; - return top; + u3z(lit); + *out = u3_nul; + return c3y; +} + +/* _n_hilt_hind(): literal (atomic) dynamic hint, after formula evaluation. +** tok: token from _n_hilt_fore(). TRANSFER +** pro: product of formula evaluation. RETAIN +*/ +static void +_n_hilt_hind(u3_noun tok, u3_noun pro) // transfer, retain +{ + c3_assert( u3_nul == tok ); + u3z(tok); +} + +/* _n_hint_fore(): arbitrary dynamic hint, before formula evaluation +** hin: [hint-atom, formula]. TRANSFER +** bus: subject. RETAIN +** clu: product of the hint-formula. TRANSFER +** also, token for _n_hint_hind(); +** conventionally, [hint-atom] or [hint-atom data]. ~ if unused. +** +** any hints herein must be whitelisted in _n_burn(). +*/ +static c3_o +_n_hint_fore(u3_cell hin, u3_noun bus, u3_noun* clu) +{ + u3z(hin); u3z(*clu); + *clu = u3_nul; + return c3y; +} + +/* _n_hint_hind(): arbitrary dynamic hint, after formula evaluation. +** tok: token from _n_hint_fore(). TRANSFER +** pro: product of formula evaluation. RETAIN +*/ +static void +_n_hint_hind(u3_noun tok, u3_noun pro) +{ + c3_assert( u3_nul == tok ); + u3z(tok); } /* _n_kick(): stop tracing noc and kick a u3j_site. @@ -1630,6 +1794,8 @@ _n_burn(u3n_prog* pog_u, u3_noun bus, c3_ys mov, c3_ys off) &&do_balt, &&do_salt, &&do_skib, &&do_skis, &&do_slib, &&do_slis, &&do_save, + &&do_hilb, &&do_hils, &&do_hinb, &&do_hins, + &&do_hilk, &&do_hill, &&do_hink, &&do_hinl, &&do_muth, &&do_kuth, &&do_mutt, &&do_kutt, &&do_musm, &&do_kusm, &&do_mutb, &&do_muts, &&do_mitb, &&do_mits, @@ -2082,21 +2248,21 @@ _n_burn(u3n_prog* pog_u, u3_noun bus, c3_ys mov, c3_ys off) top = _n_swap(mov, off); // [ref bus] wish_in: u3t_off(noc_o); - x = u3m_soft_esc(*top, u3k(o)); + x = u3m_soft_esc(u3k(*top), u3k(o)); u3t_on(noc_o); if ( c3n == u3du(x) ) { - u3m_bail(u3nt(1, o, 0)); + u3m_bail(u3nc(1, o)); return u3_none; } else if ( c3n == u3du(u3t(x)) ) { - // replace with proper error stack push - u3t_push(u3nc(c3__hunk, _n_mush(o))); + u3t_push(u3nt(c3__hunk, *top, o)); u3m_bail(c3__exit); return u3_none; } else { u3z(o); + u3z(*top); *top = u3k(u3t(u3t(x))); u3z(x); BURN(); @@ -2220,6 +2386,67 @@ _n_burn(u3n_prog* pog_u, u3_noun bus, c3_ys mov, c3_ys off) u3z(o); BURN(); + do_hilb: + x = pog[ip_w++]; + goto hilt_fore_in; + + do_hils: + x = _n_resh(pog, &ip_w); + hilt_fore_in: + x = u3k(pog_u->lit_u.non[x]); + top = _n_peek(off); // bus + x = _n_hilt_fore(x, *top, &o); + _n_push(mov, off, o); + _n_swap(mov, off); // bus + _n_push(mov, off, x); // shortcircuit if c3n + BURN(); + + do_hinb: + x = pog[ip_w++]; + goto hint_fore_in; + + do_hins: + x = _n_resh(pog, &ip_w); + hint_fore_in: // [clu bus] + x = u3k(pog_u->lit_u.non[x]); + o = _n_pep(mov, off); // [bus] + top = _n_peek(off); + x = _n_hint_fore(x, *top, &o); + _n_push(mov, off, o); // [tok bus] + _n_swap(mov, off); // [bus tok] + _n_push(mov, off, x); // [kip bus tok] + BURN(); + + do_hilk: // [pro bus tok] + x = _n_pep(mov, off); // [bus tok] + _n_swap(mov, off); // [tok bus] + o = _n_pep(mov, off); // [bus] + _n_push(mov, off, x); // [pro bus] + _n_hilt_hind(o, x); + BURN(); + + do_hill: // [pro tok] + top = _n_swap(mov, off); // [tok pro] + o = _n_pep(mov, off); // [pro] + top = _n_peek(off); + _n_hilt_hind(o, *top); + BURN(); + + do_hink: // [pro bus tok] + x = _n_pep(mov, off); // [bus tok] + _n_swap(mov, off); // [tok bus] + o = _n_pep(mov, off); // [bus] + _n_push(mov, off, x); // [pro bus] + _n_hint_hind(o, x); + BURN(); + + do_hinl: // [pro tok] + top = _n_swap(mov, off); // [tok pro] + o = _n_pep(mov, off); // [pro] + top = _n_peek(off); + _n_hint_hind(o, *top); + BURN(); + do_kuth: x = _n_pep(mov, off); top = _n_swap(mov, off); diff --git a/pkg/urbit/noun/retrieve.c b/pkg/urbit/noun/retrieve.c index 25b4b747e..a279aa20e 100644 --- a/pkg/urbit/noun/retrieve.c +++ b/pkg/urbit/noun/retrieve.c @@ -1479,32 +1479,93 @@ u3r_tape(u3_noun a) return a_y; } +/* u3r_mug_both(): Join two mugs. +*/ +c3_l +u3r_mug_both(c3_l lef_l, c3_l rit_l) +{ + c3_y len_y = 4 + ((c3_bits_word(rit_l) + 0x7) >> 3); + c3_w syd_w = 0xdeadbeef; + c3_w i_w = 0; + c3_y buf_y[8]; + + buf_y[0] = lef_l & 0xff; + buf_y[1] = (lef_l >> 8) & 0xff; + buf_y[2] = (lef_l >> 16) & 0xff; + buf_y[3] = (lef_l >> 24) & 0xff; + buf_y[4] = rit_l & 0xff; + buf_y[5] = (rit_l >> 8) & 0xff; + buf_y[6] = (rit_l >> 16) & 0xff; + buf_y[7] = (rit_l >> 24) & 0xff; + + while ( i_w < 8 ) { + c3_w haz_w; + c3_l ham_l; + + MurmurHash3_x86_32(buf_y, len_y, syd_w, &haz_w); + ham_l = (haz_w >> 31) ^ (haz_w & 0x7fffffff); + + if ( 0 == ham_l ) { + syd_w++; i_w++; + } + else { + return ham_l; + } + } + + return 0xfffe; +} + /* u3r_mug_bytes(): Compute the mug of `buf`, `len`, LSW first. */ -c3_w +c3_l u3r_mug_bytes(const c3_y *buf_y, c3_w len_w) { c3_w syd_w = 0xcafebabe; - c3_w ham_w = 0; + c3_w i_w = 0; - while ( 1 ) { + while ( i_w < 8 ) { c3_w haz_w; - MurmurHash3_x86_32(buf_y, len_w, syd_w, &haz_w); - ham_w = (haz_w >> 31) ^ (haz_w & 0x7fffffff); + c3_l ham_l; - if ( 0 == ham_w ) { - syd_w++; + MurmurHash3_x86_32(buf_y, len_w, syd_w, &haz_w); + ham_l = (haz_w >> 31) ^ (haz_w & 0x7fffffff); + + if ( 0 == ham_l ) { + syd_w++; i_w++; } else { - return ham_w; + return ham_l; } } + + return 0x7fff; +} + +/* u3r_mug_c(): Compute the mug of `a`, LSB first. +*/ +c3_l +u3r_mug_c(const c3_c* a_c) +{ + return u3r_mug_bytes((c3_y*)a_c, strlen(a_c)); +} + +/* u3r_mug_cell(): Compute the mug of the cell `[hed tel]`. +*/ +c3_l +u3r_mug_cell(u3_noun hed, + u3_noun tel) +{ + c3_w lus_w = u3r_mug(hed); + c3_w biq_w = u3r_mug(tel); + + return u3r_mug_both(lus_w, biq_w); } /* u3r_mug_chub(): Compute the mug of `num`, LSW first. */ -c3_w +c3_l u3r_mug_chub(c3_d num_d) { c3_w buf_w[2]; @@ -1515,17 +1576,9 @@ u3r_mug_chub(c3_d num_d) return u3r_mug_words(buf_w, 2); } -/* u3r_mug_string(): Compute the mug of `a`, LSB first. -*/ -c3_w -u3r_mug_string(const c3_c *a_c) -{ - return u3r_mug_bytes((c3_y*)a_c, strlen(a_c)); -} - /* u3r_mug_words(): 31-bit nonzero MurmurHash3 on raw words. */ -c3_w +c3_l u3r_mug_words(const c3_w* key_w, c3_w len_w) { c3_w byt_w; @@ -1555,27 +1608,6 @@ u3r_mug_words(const c3_w* key_w, c3_w len_w) return u3r_mug_bytes((c3_y*)key_w, byt_w); } -/* u3r_mug_both(): Join two mugs. -*/ -c3_w -u3r_mug_both(c3_w lef_w, c3_w rit_w) -{ - c3_w ham_w = lef_w ^ (0x7fffffff ^ rit_w); - return u3r_mug_words(&ham_w, 1); -} - -/* u3r_mug_cell(): Compute the mug of the cell `[hed tel]`. -*/ -c3_w -u3r_mug_cell(u3_noun hed, - u3_noun tel) -{ - c3_w lus_w = u3r_mug(hed); - c3_w biq_w = u3r_mug(tel); - - return u3r_mug_both(lus_w, biq_w); -} - /* _cr_mug: stack frame for recording cell traversal ** !mug == head-frame */ diff --git a/pkg/urbit/noun/vortex.c b/pkg/urbit/noun/vortex.c index 63cbb2540..168334bdc 100644 --- a/pkg/urbit/noun/vortex.c +++ b/pkg/urbit/noun/vortex.c @@ -191,11 +191,9 @@ _cv_time_bump(u3_reck* rec_u) /* u3v_peek(): query the reck namespace (protected). */ u3_noun -u3v_peek(u3_noun hap) +u3v_peek(u3_noun sam) { u3_noun fun = u3n_nock_on(u3k(u3A->roc), u3k(u3x_at(_CVX_PEEK, u3A->roc))); - u3_noun sam = u3nc(u3k(u3A->now), hap); - return u3n_slam_on(fun, sam); } diff --git a/pkg/urbit/tests/mug_tests.c b/pkg/urbit/tests/mug_tests.c index b279cd6f7..532b8e27a 100644 --- a/pkg/urbit/tests/mug_tests.c +++ b/pkg/urbit/tests/mug_tests.c @@ -16,7 +16,7 @@ _test_mug(void) { c3_i ret_i = 1; - if ( 0x4d441035 != u3r_mug_string("Hello, world!") ) { + if ( 0x4d441035 != u3r_mug_c("Hello, world!") ) { fprintf(stderr, "fail (a)\r\n"); ret_i = 0; } @@ -32,36 +32,67 @@ _test_mug(void) u3z(a); } - if ( 0x79ff04e8 != u3r_mug_bytes(0, 0) ) { - fprintf(stderr, "fail (c)\r\n"); + { + c3_y byt_y[1]; + + if ( 0x79ff04e8 != u3r_mug_bytes(0, 0) ) { + fprintf(stderr, "fail (c) (0)\r\n"); + ret_i = 0; + } + + byt_y[0] = 1; + + if ( 0x715c2a60 != u3r_mug_bytes(byt_y, 1) ) { + fprintf(stderr, "fail (c) (1)\r\n"); + ret_i = 0; + } + + byt_y[0] = 2; + + if ( 0x718b9468 != u3r_mug_bytes(byt_y, 1) ) { + fprintf(stderr, "fail (c) (2)\r\n"); + ret_i = 0; + } + } + + if ( 0x3a811aec != u3r_mug_both(0x715c2a60, u3r_mug_cell(2, 3)) ) { + fprintf(stderr, "fail (d)\r\n"); ret_i = 0; } + + { + if ( 0x192f5588 != u3r_mug_cell(0, 0) ) { + fprintf(stderr, "fail (e) (1)\r\n"); + ret_i = 0; + } + + if ( 0x6b32ec46 != u3r_mug_cell(1, 1) ) { + fprintf(stderr, "fail (e) (2)\r\n"); + ret_i = 0; + } + + if ( 0x2effe10 != u3r_mug_cell(2, 2) ) { + fprintf(stderr, "fail (e) (3)\r\n"); + ret_i = 0; + } + } + { u3_noun a = u3i_string("xxxxxxxxxxxxxxxxxxxxxxxxxxxx"); if ( 0x64dfda5c != u3r_mug(a) ) { - fprintf(stderr, "fail (d)\r\n"); + fprintf(stderr, "fail (f)\r\n"); ret_i = 0; } u3z(a); } - if ( 0x389ca03a != u3r_mug_cell(0, 0) ) { - fprintf(stderr, "fail (e)\r\n"); - ret_i = 0; - } - - if ( 0x389ca03a != u3r_mug_cell(1, 1) ) { - fprintf(stderr, "fail (f)\r\n"); - ret_i = 0; - } - { u3_noun a = u3qc_bex(32); - if ( 0x5258a6c0 != u3r_mug_cell(0, a) ) { + if ( 0x7cefb7f != u3r_mug_cell(0, a) ) { fprintf(stderr, "fail (g)\r\n"); ret_i = 0; } @@ -72,7 +103,7 @@ _test_mug(void) { u3_noun a = u3ka_dec(u3qc_bex(128)); - if ( 0x2ad39968 != u3r_mug_cell(a, 1) ) { + if ( 0x2aa06bfc != u3r_mug_cell(a, 1) ) { fprintf(stderr, "fail (h)\r\n"); ret_i = 0; } diff --git a/pkg/urbit/ur/hashcons.c b/pkg/urbit/ur/hashcons.c index 71f2568f9..8339a5301 100644 --- a/pkg/urbit/ur/hashcons.c +++ b/pkg/urbit/ur/hashcons.c @@ -338,20 +338,23 @@ ur_mug ur_mug_bytes(const uint8_t *byt, uint64_t len) { uint32_t seed = 0xcafebabe; - ur_mug mug; + uint8_t i = 0; - while ( 1 ) { + while ( i < 8 ) { + ur_mug mug; uint32_t raw; MurmurHash3_x86_32(byt, len, seed, &raw); mug = (raw >> 31) ^ ( ur_mask_31(raw) ); if ( 0 == mug ) { - seed++; + seed++; i++; } else { return mug; } } + + return (ur_mug)0x7fff; } ur_mug @@ -387,9 +390,35 @@ ur_mug64(uint64_t x) ur_mug ur_mug_both(ur_mug hed, ur_mug tal) { - // XX not correct per u3r_mug, but necessary to avoid collisions - // - return ur_mug32(hed ^ (0x7fffffff ^ ur_mug32(tal))); + uint32_t seed = 0xdeadbeef; + uint8_t len = 4 + ur_bloq_up3(ur_met0_32(tal)); + uint8_t i = 0; + uint8_t byt[8] = { + ur_mask_8(hed >> 0), + ur_mask_8(hed >> 8), + ur_mask_8(hed >> 16), + ur_mask_8(hed >> 24), + ur_mask_8(tal >> 0), + ur_mask_8(tal >> 8), + ur_mask_8(tal >> 16), + ur_mask_8(tal >> 24) + }; + + while ( i < 8 ) { + ur_mug mug; + uint32_t raw; + MurmurHash3_x86_32(byt, len, seed, &raw); + mug = (raw >> 31) ^ ( ur_mask_31(raw) ); + + if ( 0 == mug ) { + seed++; i++; + } + else { + return mug; + } + } + + return (ur_mug)0xfffe; } ur_mug diff --git a/pkg/urbit/vere/auto.c b/pkg/urbit/vere/auto.c index cca6fae14..759f9a6e4 100644 --- a/pkg/urbit/vere/auto.c +++ b/pkg/urbit/vere/auto.c @@ -237,11 +237,7 @@ u3_auto_next(u3_auto* car_u, u3_noun* ovo) u3_auto_work(egg_u); - // XX cons [tar] route onto wire - // - // *ovo = u3nt(u3nc(u3k(egg_u->tar), u3k(egg_u->wir)), - // u3k(egg_u->cad)); - *ovo = u3nc(u3nc(u3_blip, u3k(egg_u->wir)), + *ovo = u3nc(u3nc(u3k(egg_u->tar), u3k(egg_u->wir)), u3k(egg_u->cad)); return egg_u; @@ -289,7 +285,12 @@ u3_auto_kick(u3_auto* car_u, u3_noun act) while ( u3_nul != act ) { fec = u3h(act); u3x_cell(fec, &pax, &cad); - u3_assent(u3r_p(pax, u3_blip, &wir)); + + // XX temporary backwards compatibility, remove + // + if ( c3n == u3r_p(pax, u3_blip, &wir) ) { + wir = pax; + } while ( c3n == _auto_kick(car_u, u3k(wir), u3k(cad)) ) { if ( car_u->nex_u ) { diff --git a/pkg/urbit/vere/io/hind.c b/pkg/urbit/vere/io/hind.c index 37d090399..b8b1577ee 100644 --- a/pkg/urbit/vere/io/hind.c +++ b/pkg/urbit/vere/io/hind.c @@ -53,6 +53,14 @@ _hind_io_kick(u3_auto* car_u, u3_noun wir, u3_noun cad) ret_o = c3y; u3l_log("<<>>\n"); } break; + + // NB: startup explicitly handled in pier.c + // + // XX review arvo upgrade scenaria + // + case c3__wend: { + ret_o = c3y; + } break; } } diff --git a/pkg/urbit/vere/io/unix.c b/pkg/urbit/vere/io/unix.c index debca0c83..56ed9a4c1 100644 --- a/pkg/urbit/vere/io/unix.c +++ b/pkg/urbit/vere/io/unix.c @@ -1090,7 +1090,7 @@ u3_unix_initial_into_card(c3_c* arv_c) { u3_noun can = _unix_initial_update_dir(arv_c, arv_c); - return u3nc(u3nt(u3_blip, c3__sync, u3_nul), + return u3nc(u3nt(c3__c, c3__sync, u3_nul), u3nq(c3__into, u3_nul, c3y, can)); } diff --git a/pkg/urbit/vere/lord.c b/pkg/urbit/vere/lord.c index f148f1c69..ba24e27fd 100644 --- a/pkg/urbit/vere/lord.c +++ b/pkg/urbit/vere/lord.c @@ -35,7 +35,7 @@ [%meld ~] [%pack ~] == == - [%peek mil=@ now=@da lyc=gang pat=path] + [%peek mil=@ sam=*] :: gang (each path $%([%once @tas @tas path] [beam @tas beam])) [%play eve=@ lit=(list ?((pair @da ovum) *))] [%work mil=@ job=(pair @da ovum)] == @@ -99,9 +99,7 @@ _lord_writ_free(u3_writ* wit_u) } break; case u3_writ_peek: { - u3z(wit_u->pek_u->now); - u3z(wit_u->pek_u->gan); - u3z(wit_u->pek_u->ful); + u3z(wit_u->pek_u->sam); } break; case u3_writ_play: { @@ -371,9 +369,7 @@ _lord_plea_peek_bail(u3_lord* god_u, u3_peek* pek_u, u3_noun dud) pek_u->fun_f(pek_u->ptr_v, u3_nul); - u3z(pek_u->now); - u3z(pek_u->gan); - u3z(pek_u->ful); + u3z(pek_u->sam); c3_free(pek_u); } @@ -382,13 +378,25 @@ _lord_plea_peek_bail(u3_lord* god_u, u3_peek* pek_u, u3_noun dud) static void _lord_plea_peek_done(u3_lord* god_u, u3_peek* pek_u, u3_noun rep) { + // XX review + // + if ( (u3_pico_once == pek_u->typ_e) + && (u3_nul != rep) ) + { + u3_noun dat; + + if ( c3y == u3r_pq(u3t(rep), c3__omen, 0, &dat) ) { + u3k(dat); + u3z(rep); + rep = u3nc(u3_nul, dat); + } + } + // XX cache [dat] (unless last) // pek_u->fun_f(pek_u->ptr_v, rep); - u3z(pek_u->now); - u3z(pek_u->gan); - u3z(pek_u->ful); + u3z(pek_u->sam); c3_free(pek_u); } @@ -754,10 +762,9 @@ _lord_writ_make(u3_lord* god_u, u3_writ* wit_u) } break; case u3_writ_peek: { - msg = u3nc(c3__peek, u3nq(0, // XX support timeouts - u3k(wit_u->pek_u->now), - u3k(wit_u->pek_u->gan), - u3k(wit_u->pek_u->ful))); + // XX support timeouts, + // + msg = u3nc(c3__peek, u3nc(0, u3k(wit_u->pek_u->sam))); } break; case u3_writ_play: { @@ -862,39 +869,28 @@ u3_lord_peek(u3_lord* god_u, u3_pico* pic_u) wit_u->pek_u = c3_calloc(sizeof(*wit_u->pek_u)); wit_u->pek_u->ptr_v = pic_u->ptr_v; wit_u->pek_u->fun_f = pic_u->fun_f; - wit_u->pek_u->now = u3_time_in_tv(&wit_u->tim_u); - wit_u->pek_u->gan = u3k(pic_u->gan); + wit_u->pek_u->typ_e = pic_u->typ_e; // construct the full scry path // - switch ( pic_u->typ_e ) { - default: c3_assert(0); + { + u3_noun sam; + switch ( pic_u->typ_e ) { + default: c3_assert(0); - case u3_pico_full: { - wit_u->pek_u->ful = u3k(pic_u->ful); - } break; + case u3_pico_full: { + sam = u3k(pic_u->ful); + } break; - case u3_pico_mine: { - // XX cache - // - u3_pier* pir_u = god_u->cb_u.ptr_v; // XX do better - u3_noun our = u3dc("scot", 'p', u3i_chubs(2, pir_u->who_d)); - wit_u->pek_u->ful = u3nt(pic_u->min_u.car_m, our, u3k(pic_u->min_u.pax)); - } break; + case u3_pico_once: { + sam = u3nc(c3n, u3nq(c3__once, + pic_u->las_u.car_m, + u3k(pic_u->las_u.des), + u3k(pic_u->las_u.pax))); + } break; + } - case u3_pico_last: { - // XX cache - // - u3_pier* pir_u = god_u->cb_u.ptr_v; // XX do better - u3_noun our = u3dc("scot", 'p', u3i_chubs(2, pir_u->who_d)); - u3_noun cas = u3dc("scot", c3__da, u3k(wit_u->pek_u->now)); - - wit_u->pek_u->ful = u3nc(pic_u->las_u.car_m, - u3nq(our, - u3k(pic_u->las_u.des), - cas, - u3k(pic_u->las_u.pax))); - } break; + wit_u->pek_u->sam = u3nc(u3k(pic_u->gan), sam); } // XX cache check, unless last @@ -1090,6 +1086,7 @@ u3_lord_init(c3_c* pax_c, c3_w wag_w, c3_d key_d[4], u3_lord_cb cb_u) { u3_lord* god_u = c3_calloc(sizeof *god_u); god_u->liv_o = c3n; + god_u->pin_o = c3n; god_u->wag_w = wag_w; god_u->bin_c = u3_Host.wrk_c; // XX strcopy god_u->pax_c = pax_c; // XX strcopy diff --git a/pkg/urbit/vere/pier.c b/pkg/urbit/vere/pier.c index f0bfc2a33..31a5dad76 100644 --- a/pkg/urbit/vere/pier.c +++ b/pkg/urbit/vere/pier.c @@ -285,7 +285,8 @@ _pier_on_lord_work_spin(void* ptr_v, u3_atom pin, c3_o del_o) { u3_pier* pir_u = ptr_v; - c3_assert( (u3_psat_work == pir_u->sat_e) + c3_assert( (u3_psat_wyrd == pir_u->sat_e) + || (u3_psat_work == pir_u->sat_e) || (u3_psat_done == pir_u->sat_e) ); u3_term_start_spinner(pin, del_o); @@ -298,7 +299,8 @@ _pier_on_lord_work_spun(void* ptr_v) { u3_pier* pir_u = ptr_v; - c3_assert( (u3_psat_work == pir_u->sat_e) + c3_assert( (u3_psat_wyrd == pir_u->sat_e) + || (u3_psat_work == pir_u->sat_e) || (u3_psat_done == pir_u->sat_e) ); u3_term_stop_spinner(); @@ -347,7 +349,11 @@ _pier_on_lord_work_bail(void* ptr_v, u3_ovum* egg_u, u3_noun lud) u3_auto_bail(egg_u, lud); - _pier_work(pir_u->wok_u); + // XX groace + // + if ( pir_u->wok_u ) { + _pier_work(pir_u->wok_u); + } } /* _pier_work_time(): set time. @@ -398,13 +404,14 @@ u3_pier_spin(u3_pier* pir_u) { // XX return c3n instead? // - c3_assert( (u3_psat_work == pir_u->sat_e) - || (u3_psat_done == pir_u->sat_e) ); + if ( u3_psat_work == pir_u->sat_e + || u3_psat_done == pir_u->sat_e ) + { + u3_work* wok_u = pir_u->wok_u; - u3_work* wok_u = pir_u->wok_u; - - if ( !uv_is_active((uv_handle_t*)&wok_u->idl_u) ) { - uv_idle_start(&wok_u->idl_u, _pier_work_idle_cb); + if ( !uv_is_active((uv_handle_t*)&wok_u->idl_u) ) { + uv_idle_start(&wok_u->idl_u, _pier_work_idle_cb); + } } } @@ -429,29 +436,6 @@ u3_pier_peek(u3_pier* pir_u, _pier_peek_plan(pir_u, pic_u); } -/* u3_pier_peek_mine(): read namespace, injecting ship. -*/ -void -u3_pier_peek_mine(u3_pier* pir_u, - u3_noun gan, - c3_m car_m, - u3_noun pax, - void* ptr_v, - u3_peek_cb fun_f) -{ - u3_pico* pic_u = u3_pico_init(); - - pic_u->ptr_v = ptr_v; - pic_u->fun_f = fun_f; - pic_u->gan = gan; - // - pic_u->typ_e = u3_pico_mine; - pic_u->min_u.car_m = car_m; - pic_u->min_u.pax = pax; - - _pier_peek_plan(pir_u, pic_u); -} - /* u3_pier_peek_last(): read namespace, injecting ship and case. */ void @@ -469,7 +453,7 @@ u3_pier_peek_last(u3_pier* pir_u, pic_u->fun_f = fun_f; pic_u->gan = gan; // - pic_u->typ_e = u3_pico_last; + pic_u->typ_e = u3_pico_once; pic_u->las_u.car_m = car_m; pic_u->las_u.des = des; pic_u->las_u.pax = pax; @@ -546,8 +530,7 @@ _pier_work_init(u3_pier* pir_u) { u3_work* wok_u; - c3_assert( (u3_psat_init == pir_u->sat_e) - || (u3_psat_play == pir_u->sat_e) ); + c3_assert( u3_psat_wyrd == pir_u->sat_e ); pir_u->sat_e = u3_psat_work; pir_u->wok_u = wok_u = c3_calloc(sizeof(*wok_u)); @@ -633,6 +616,227 @@ _pier_work_init(u3_pier* pir_u) _pier_work(wok_u); } +/* _pier_wyrd_good(): %wyrd version negotation succeeded. +*/ +static void +_pier_wyrd_good(u3_pier* pir_u, u3_ovum* egg_u) +{ + // restore event callbacks + // + { + u3_lord* god_u = pir_u->god_u; + god_u->cb_u.work_done_f = _pier_on_lord_work_done; + god_u->cb_u.work_bail_f = _pier_on_lord_work_bail; + } + + // initialize i/o drivers + // + _pier_work_init(pir_u); + + // free %wyrd driver and ovum + // + { + u3_auto* car_u = egg_u->car_u; + u3_auto_done(egg_u); + c3_free(car_u); + } +} + +/* _pier_wyrd_fail(): %wyrd version negotation failed. +*/ +static void +_pier_wyrd_fail(u3_pier* pir_u, u3_ovum* egg_u, u3_noun lud) +{ + // XX version negotiation failed, print upgrade message + // + u3l_log("pier: version negotation failed\n\n"); + + // XX only print trace with -v ? + // + u3_auto_bail_slog(egg_u, lud); + + // free %wyrd driver and ovum + // + { + u3_auto* car_u = egg_u->car_u; + u3_auto_done(egg_u); + c3_free(car_u); + } + + u3_pier_bail(pir_u); +} + +// XX organizing version constants +// +#define VERE_NAME "vere" +#define VERE_MAJOR 0 +#define VERE_MINOR 10 +#define VERE_PATCH 9 +#define VERE_ZUSE 309 + +/* _pier_wyrd_aver(): check for %wend effect and version downgrade. RETAIN +*/ +static c3_o +_pier_wyrd_aver(u3_noun act) +{ + u3_noun fec, kel, ver; + + // XX review, %wend re: %wyrd optional? + // + while ( u3_nul != act ) { + u3x_cell(act, &fec, &act); + + if ( c3__wend == u3h(fec) ) { + kel = u3t(fec); + + // traverse $wynn, check for downgrades + // + while ( u3_nul != kel ) { + u3x_cell(kel, &ver, &kel); + + // check for %zuse downgrade + // + if ( (c3__zuse == u3h(ver)) + && (VERE_ZUSE != u3t(ver)) ) + { + return c3n; + } + + // XX in the future, send %wend to serf + // to also negotiate downgrade of nock/hoon/&c? + // (we don't want to have to filter effects) + // + } + } + } + + return c3y; +} + +/* _pier_on_lord_wyrd_done(): callback for successful %wyrd event. +*/ +static void +_pier_on_lord_wyrd_done(void* ptr_v, + u3_ovum* egg_u, + u3_fact* tac_u, + u3_gift* gif_u) +{ + u3_pier* pir_u = ptr_v; + + c3_assert( u3_psat_wyrd == pir_u->sat_e ); + + // arvo's side of version negotiation succeeded + // traverse [gif_y] and validate + // + if ( c3n == _pier_wyrd_aver(gif_u->act) ) { + u3_fact_free(tac_u); + u3_gift_free(gif_u); + + // XX messaging, cli argument to bypass + // + u3l_log("pier: version negotiation failed; downgrade\n"); + _pier_wyrd_fail(pir_u, egg_u, u3_nul); + } + else { + // enqueue %wyrd event-log commit + // + u3_disk_plan(pir_u->log_u, tac_u); + + // finalize %wyrd success + // + _pier_wyrd_good(pir_u, egg_u); + + // plan %wyrd effects + // + _pier_gift_plan(pir_u->wok_u, gif_u); + } +} + +/* _pier_on_lord_wyrd_bail(): callback for failed %wyrd event. +*/ +static void +_pier_on_lord_wyrd_bail(void* ptr_v, u3_ovum* egg_u, u3_noun lud) +{ + u3_pier* pir_u = ptr_v; + + c3_assert( u3_psat_wyrd == pir_u->sat_e ); + + // XX add cli argument to bypass negotiation failure + // +#if 1 + // print %wyrd failure and exit + // + // XX check bail mote, retry on %intr, %meme, &c + // + _pier_wyrd_fail(pir_u, egg_u, lud); +#else + // XX temporary hack to fake %wyrd success + // + { + _pier_wyrd_good(pir_u, egg_u); + u3z(lud); + } +#endif +} + +/* _pier_wyrd_init(): construct %wyrd. +*/ +static u3_noun +_pier_wyrd_card(u3_pier* pir_u) +{ + u3_lord* god_u = pir_u->god_u; + + _pier_work_time(pir_u); + u3v_numb(); + + // XX god_u not necessarily available yet, refactor call sites + // + u3_noun ver = u3nq(u3i_string(VERE_NAME), VERE_MAJOR, VERE_MINOR, VERE_PATCH); + u3_noun kel = u3nl(u3nc(c3__zuse, VERE_ZUSE), // XX god_u->zus_w + // u3nc(c3__lull, PIER_LULL), // XX define + u3nc(c3__arvo, u3i_string("arvo-kelvin")), // XX from both king and serf? + u3nc(c3__hoon, 141), // god_u->hon_y + u3nc(c3__nock, 4), // god_u->noc_y + u3_none); + u3_noun wir = u3nc(c3__arvo, u3_nul); + return u3nt(c3__wyrd, u3nc(u3k(u3A->sen), ver), kel); +} + +/* _pier_wyrd_init(): send %wyrd. +*/ +static void +_pier_wyrd_init(u3_pier* pir_u) +{ + u3_noun cad = _pier_wyrd_card(pir_u); + u3_noun wir = u3nc(c3__arvo, u3_nul); + + pir_u->sat_e = u3_psat_wyrd; + + u3l_log("vere: checking version compatiblity\n"); + + { + u3_lord* god_u = pir_u->god_u; + u3_auto* car_u = c3_calloc(sizeof(*car_u)); + u3_ovum* egg_u = u3_ovum_init(0, u3_blip, wir, cad); + u3_noun ovo; + + car_u->pir_u = pir_u; + car_u->nam_m = c3__wyrd; + + u3_auto_plan(car_u, egg_u); + + // instead of subscribing with u3_auto_peer(), + // we swizzle the [god_u] callbacks for full control + // + god_u->cb_u.work_done_f = _pier_on_lord_wyrd_done; + god_u->cb_u.work_bail_f = _pier_on_lord_wyrd_bail; + + c3_assert( u3_auto_next(car_u, &ovo) == egg_u ); + + u3_lord_work(god_u, egg_u, ovo); + } +} + /* _pier_play_plan(): enqueue events for replay. */ static void @@ -811,7 +1015,7 @@ _pier_play(u3_play* pay_u) } else if ( pay_u->eve_d == log_u->dun_d ) { u3_lord_save(pir_u->god_u); - _pier_work_init(pir_u); + _pier_wyrd_init(pir_u); } } else { @@ -1205,7 +1409,7 @@ _pier_on_lord_live(void* ptr_v) _pier_play_init(pir_u, eve_d); } else { - _pier_work_init(pir_u); + _pier_wyrd_init(pir_u); } } } @@ -1458,7 +1662,7 @@ _pier_pill_parse(u3_noun pil) /* _pier_boot_make(): construct boot sequence */ static u3_boot -_pier_boot_make(u3_noun who, u3_noun ven, u3_noun pil) +_pier_boot_make(u3_noun who, u3_noun wyr, u3_noun ven, u3_noun pil) { u3_boot bot_u = _pier_pill_parse(pil); // transfer @@ -1476,6 +1680,9 @@ _pier_boot_make(u3_noun who, u3_noun ven, u3_noun pil) wir = u3nt(u3_blip, c3__arvo, u3_nul); cad = u3nc(c3__whom, who); // transfer bot_u.mod = u3nc(u3nc(wir, cad), bot_u.mod); + + wir = u3nt(u3_blip, c3__arvo, u3_nul); + bot_u.mod = u3nc(u3nc(wir, wyr), bot_u.mod); } // prepend legacy boot event to the userspace sequence @@ -1486,7 +1693,7 @@ _pier_boot_make(u3_noun who, u3_noun ven, u3_noun pil) // c3_assert( c3y == u3a_is_cell(ven) ); - u3_noun wir = u3nq(u3_blip, c3__term, '1', u3_nul); + u3_noun wir = u3nq(c3__d, c3__term, '1', u3_nul); u3_noun cad = u3nt(c3__boot, u3_Host.ops_u.lit, ven); // transfer bot_u.use = u3nc(u3nc(wir, cad), bot_u.use); @@ -1506,7 +1713,7 @@ _pier_boot_plan(u3_pier* pir_u, u3_noun who, u3_noun ven, u3_noun pil) pir_u->fak_o = ( c3__fake == u3h(ven) ) ? c3y : c3n; u3r_chubs(0, 2, pir_u->who_d, who); - bot_u = _pier_boot_make(who, ven, pil); + bot_u = _pier_boot_make(who, _pier_wyrd_card(pir_u), ven, pil); pir_u->lif_w = u3qb_lent(bot_u.bot); } @@ -1588,6 +1795,8 @@ u3_pier_boot(c3_w wag_w, // config flags return 0; } + // XX must be called from on_lord_live + // if ( c3n == _pier_boot_plan(pir_u, who, ven, pil) ) { fprintf(stderr, "pier: boot plan fail\r\n"); // XX dispose diff --git a/pkg/urbit/vere/walk.c b/pkg/urbit/vere/walk.c index 892636a93..1f7095a18 100644 --- a/pkg/urbit/vere/walk.c +++ b/pkg/urbit/vere/walk.c @@ -87,6 +87,7 @@ u3_walk_load(c3_c* pas_c) if ( fln_w != red_w ) { c3_free(pad_y); + u3l_log("u3_walk_load failed"); return u3m_bail(c3__fail); } else { diff --git a/pkg/urbit/vere/ward.c b/pkg/urbit/vere/ward.c index 7ff997deb..f4db6badf 100644 --- a/pkg/urbit/vere/ward.c +++ b/pkg/urbit/vere/ward.c @@ -191,11 +191,7 @@ u3_pico_free(u3_pico* pic_u) u3z(pic_u->ful); } break; - case u3_pico_mine: { - u3z(pic_u->min_u.pax); - } break; - - case u3_pico_last: { + case u3_pico_once: { u3z(pic_u->las_u.des); u3z(pic_u->las_u.pax); } break; diff --git a/pkg/urbit/worker/serf.c b/pkg/urbit/worker/serf.c index 71460db93..7997d33f3 100644 --- a/pkg/urbit/worker/serf.c +++ b/pkg/urbit/worker/serf.c @@ -37,7 +37,7 @@ [%meld ~] [%pack ~] == == - [%peek mil=@ now=@da lyc=gang pat=path] + [%peek mil=@ sam=*] :: gang (each path $%([%once @tas @tas path] [beam @tas beam])) [%play eve=@ lit=(list ?((pair @da ovum) *))] [%work mil=@ job=(pair @da ovum)] == @@ -444,11 +444,13 @@ _serf_sure(u3_serf* sef_u, c3_w pre_w, u3_noun par) static u3_noun _serf_make_crud(u3_noun job, u3_noun dud) { - u3_noun now, ovo, wir, cad, new; + u3_noun now, ovo, new; u3x_cell(job, &now, &ovo); - u3x_cell(ovo, &wir, &cad); - new = u3nt(u3i_vint(u3k(now)), u3k(wir), u3nt(c3__crud, dud, u3k(cad))); + new = u3nt(u3i_vint(u3k(now)), + u3nt(u3_blip, c3__arvo, u3_nul), + u3nt(c3__crud, dud, u3k(ovo))); + u3z(job); return new; } @@ -774,43 +776,17 @@ u3_serf_play(u3_serf* sef_u, c3_d eve_d, u3_noun lit) u3_noun u3_serf_peek(u3_serf* sef_u, c3_w mil_w, u3_noun sam) { - u3_noun wen, pat, pro; - - // stash the previous date and set current - // - // XX incomplete interface, arvo should track the date - // - wen = u3A->now; - - { - u3_noun now, lyc; - u3x_trel(sam, &now, &lyc, &pat); - u3A->now = u3k(now); - } - + u3_noun gon = u3m_soft(mil_w, u3v_peek, sam); + u3_noun pro; { u3_noun tag, dat; - - // XX incomplete interface, should pass [lyc] as well - // - u3_noun gon = u3m_soft(mil_w, u3v_peek, u3k(pat)); u3x_cell(gon, &tag, &dat); // read succeeded, produce result // if ( u3_blip == tag ) { - if ( u3_nul == dat ) { - pro = u3nc(c3__done, u3_nul); - } - else { - // prepend the %noun mark - // - // XX incomplete interface, should recv mark from arvo - // - pro = u3nq(c3__done, u3_nul, c3__noun, u3k(u3t(dat))); - } - + pro = u3nc(c3__done, u3k(dat)); u3z(gon); } // read failed, produce trace @@ -822,14 +798,6 @@ u3_serf_peek(u3_serf* sef_u, c3_w mil_w, u3_noun sam) } } - // restore the previous date - // - // XX incomplete interface, arvo should track the date - // - u3z(u3A->now); - u3A->now = wen; - - u3z(sam); return u3nc(c3__peek, pro); }