:: :: :: :::: /hoon/dojo/app :: :::: :: :: :: /? 314 :: arvo kelvin /- sole :: console structures /+ sole :: console library [. sole] :: :: :: :::: :: :::: !: :: :: => |% :: external structures ++ house :: all state $: %3 hoc=(map bone session) :: conversations == :: ++ session :: per conversation $: say=sole-share :: command-line state dir=beam :: active path poy=(unit dojo-project) :: working [lib=(list hoof) arc=(list hoof)] :: lib/sur var=(map term cage) :: variable state old=(set term) :: used TLVs buf=tape :: multiline buffer == :: ++ dojo-command :: $& (pair dojo-sink dojo-source) :: route value [%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 p=?(%post %put) q=purl] :: http outbound [%poke p=goal] :: poke app [%show p=?(0 1 2 3)] :: print val/type/twig [%verb p=term] :: store variable == :: ++ dojo-source :: construction node $: p=@ud :: assembly index q=dojo-build :: general build == :: ++ dojo-build :: one ford step $% [%ur p=purl] :: http GET request [%ge p=dojo-model] :: generator [%dv p=path] :: core from source [%ex p=twig] :: hoon expression [%as p=mark q=dojo-source] :: simple transmute [%do p=twig 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-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-project :: construction state $: mad=dojo-command :: operation num=@ud :: number of tasks cud=(unit dojo-source) :: now solving pux=(unit path) :: ford 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 ++ clap :: action, user $% [%peer p=path] :: subscribe [%poke p=(cask)] :: apply [%pull ~] :: unsubscribe == :: ++ club :: action, system $% [%peer p=path] :: subscribe [%poke p=cage] :: apply [%pull ~] :: unsubscribe == :: ++ card :: general card $% [%diff %sole-effect sole-effect] :: [%send wire [ship term] clap] :: [%hiss wire mark [%hiss hiss]] :: [%exec wire @p (unit ,[beak silk])] :: [%deal wire sock term club] :: [%info wire @p toro] :: == :: ++ move (pair bone card) :: user-level move ++ sign :: $% [%made p=@uvH q=gage] :: [%unto p=cuft] :: == :: -- :: !: :: :::: :: :: :: |_ $: hid=bowl :: system state house :: program state == :: ++ he :: per session |_ [moz=(list move) session] :: ++ dp :: dojo parser |% ++ dp-default-app %hood ++ dp-message :: %poke |= [gol=goal mod=dojo-model] ^- dojo-command [[%poke gol] [0 [%ge mod(q.p [q.gol q.p.mod])]]] :: ++ dp-command-line ;~(sfix dp-command (just '\0a')) ++ dp-variable :: %verb or %brev |* [sym=_rule src=_rule] %- cook :_ ;~(plug sym (punt src)) |= [a=term b=(unit dojo-source)] ^- dojo-command ?~(b [%brev a] [[%verb a] u.b]) :: ++ dp-command :: ++dojo-command %+ knee *dojo-command |. ~+ ;~ pose ;~ pfix bar %+ cook dp-message (stag [our.hid dp-default-app] dp-model) == :: ;~ pfix col %+ cook |= [a=goal b=$&(dojo-model dojo-source)] ?@ -.b [[%poke a] b] (dp-message a b) ;~ plug dp-goal ;~ pose ;~(pfix bar dp-model) ;~(pfix ace dp-source) == == == :: ;~(pfix tis (dp-variable sym ;~(pfix ace dp-source))) ;~ pfix fas ;~ pose (dp-variable (cold %arc hep) ;~(pfix gap dp-hooves)) (dp-variable (cold %lib lus) ;~(pfix gap dp-hooves)) :(stag [%verb %dir] 0 %ex %clsg dp-poor) == == :: ;~((glue ace) dp-sink dp-source) (stag [%show %0] dp-source) == ++ dp-sink ;~ pose ;~(plug (cold %file tar) dp-beam) ;~(plug (cold %flat pat) (most fas sym)) ;~(plug (cold %pill dot) (most fas sym)) ;~(plug (cold %http lus) (easy %post) auri:epur) ;~(plug (cold %http hep) (easy %put) auri:epur) (stag %show (cook ?(1 2 3) (cook lent (stun [1 3] wut)))) == ++ dp-hooves :: hoof list :(stag 0 %ex %clsg (cook |=(a=tusk a) (most ;~(plug com gaw) dp-hoof))) :: ++ dp-hoof :: ++ford-hoof twig %+ cook |*(a=* ~!(+.a `twig`a)) ;~ plug :(stag %dtzy %tas sym) %- dp-twig-punt ;~ (glue fas) ;~(pfix fas (sear dp-case-twig nuck:so)) (stag %dtzy ;~(plug (cold %p sig) fed:ag)) == == :: ++ dp-twig-punt :: twig of unit |*(a=_rule ;~(pose (stag [%bczp %null] a) (easy [%bczp %null]))) :: ++ dp-case-twig |= a=coin ^- (unit twig) ?. ?=([~ case] a) ~ %+ some [%dtzz %tas p.p.a] [%dtzy p.a] :: ++ dp-source (stag 0 dp-build) :: ++dojo-source ++ dp-build :: ++dojo-build %+ knee *dojo-build |. ~+ ;~ pose ;~(plug (cold %ur lus) auri:epur) ;~(plug (cold %ge lus) dp-model) ;~(plug (cold %as pam) sym ;~(pfix ace dp-source)) ;~(plug (cold %do cab) dp-twig ;~(pfix ace dp-source)) dp-value == :: ++ dp-goal :: ++goal %+ cook |=(a=goal a) ;~ pose ;~ plug ;~(pfix sig fed:ag) ;~(pose ;~(pfix fas sym) (easy dp-default-app)) == %+ stag our.hid ;~(pose sym (easy dp-default-app)) == ++ dp-beam :: ++beam %+ cook |=(a=path =+((tome a) ?^(- u [he-beak (flop a)]))) =+ vez=(vang | dp-path) (sear plex:vez (stag %clsg poor:vez)) :: ++ dp-model ;~(plug dp-server dp-config) :: ++dojo-model ++ dp-path (tope he-beam) :: ++path ++ dp-server (stag 0 (most fas sym)) :: ++dojo-server ++ dp-twig tall:(vang | dp-path) :: ++twig ++ dp-poor poor:(vang | (tope dir)) :: (list ++twig) ++ dp-value :: ++dojo-source ;~ pose (stag %tu (ifix [sel ser] (most ace dp-source))) (stag %ex dp-twig) == :: ++ dp-config :: ++dojo-config ;~ plug (star ;~(pfix ace (stag 0 dp-value))) %+ cook ~(gas by *(map term (unit dojo-source))) %- star ;~ plug ;~(pfix com ace tis sym) (punt ;~(pfix ace (stag 0 dp-value))) == == -- :: ++ dy :: project work |_ dojo-project :: ++ dy-abet +>(poy `+<) :: resolve ++ dy-amok +>(poy ~) :: terminate ++ dy-ford :: send work to ford |= [way=wire kas=silk] ^+ +>+> ?> ?=(~ pux) (he-card(poy `+>+<(pux `way)) %exec way our.hid `[he-beak kas]) :: ++ dy-eyre :: send work to eyre |= [way=wire req=hiss] ^+ +>+> ?> ?=(~ pux) (he-card(poy `+>+<(pux `way)) %hiss way %httr %hiss req) :: ++ dy-stop :: stop work ^+ +> ?~ pux +> (he-card(poy ~) %exec u.pux our.hid ~) :: ++ dy-slam :: call by ford |= [way=wire gat=vase sam=vase] ^+ +>+> (dy-ford way %call [%$ %noun gat] [%$ %noun sam]) :: ++ dy-diff :: send effects, abet |= fec=sole-effect ^+ +>+> (he-diff(poy `+>+<) fec) :: ++ dy-rash :: send effects, amok |= fec=sole-effect ^+ +>+> (he-diff(poy ~) fec) :: ++ dy-init-command :: ++dojo-command |= mad=dojo-command ^+ [mad +>] ?@ -.mad [mad +>.$] =. 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 +>] =^ bul +> (dy-init-build q.src) =: p.src num q.src bul == [src +>.$(num +(num), job (~(put by job) src))] :: ++ dy-init-source-unit :: (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 +>] ?- -.bul %ex [bul +>.$] %dv [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] +>.$]) %ur [bul +>.$] %tu =^ dof +>.$ |- ^+ [p.bul +>.^$] ?~ p.bul [~ +>.^$] =^ dis +>.^$ (dy-init-source i.p.bul) =^ mor +>.^$ $(p.bul t.p.bul) [[dis mor] +>.^$] [[%tu dof] +>.$] == :: ++ dy-init-model :: ++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 =. p.srv num [srv +>.$(num +(num), job (~(put by job) num [%dv [%gen q.srv]]))] :: ++ dy-init-config :: prepare 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 +>] ?~ ord [~ +>.$] =^ fir +>.$ (dy-init-source i.ord) =^ mor +>.$ $(ord t.ord) [[fir mor] +>.$] :: ++ dy-init-named :: (map @tas dojo-src) |= key=(map term (unit dojo-source)) ^+ [key +>.$] ?~ key [~ +>.$] =^ top +>.$ (dy-init-source-unit q.n.key) =^ lef +>.$ $(key l.key) =^ rit +>.$ $(key r.key) [[[p.n.key top] lef rit] +>.$] :: ++ dy-init :: full initialize ^+ . =^(dam . (dy-init-command mad) +(mad dam)) :: ++ dy-hand :: complete step |= cag=cage ^+ +>+> ?> ?=(^ cud) (dy-step(cud ~, rez (~(put by rez) p.u.cud cag)) +(p.u.cud)) :: ++ dy-meal :: vase to cage |= 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 ^+ +>+> ?> ?=(^ per) ?: ?| ?=(^ q.q.cag) =((lent buf.say) q.q.cag) !&(?=(%del -.u.per) =(+(p.u.per) (lent buf.say))) == dy-abet(per ~) =^ lic say (~(transmit sole say) u.per) (dy-diff(per ~) %mor [%det lic] [%err q.q.cag] ~) :: ++ dy-done :: dialog submit |= txt=tape ?: |(?=(^ per) ?=(^ pux) ?=(~ pro)) ~& %dy-no-prompt (dy-diff %bel ~) (dy-slam /dial u.pro !>(txt)) :: ++ dy-cast |* [typ=_,* bun=vase] |= a=vase ^- typ ?> (~(nest ut p.bun) & p.a) ;;(typ q.a) :: ++ dy-over :: finish construction ^+ +> ?: ?=([%show 3] -.mad) (dy-rash %tan (dy-show-source q.mad) ~) :: XX separate command ?: ?=(%brev -.mad) =. var (~(del by var) p.mad) =< dy-amok ?+ p.mad . ?(%eny %now %our) !! %lib .(lib ~) %arc .(arc ~) %dir .(dir [[our.hid %home ud/0] /]) == =+ cay=(~(got by rez) p.q.mad) ?- -.p.mad %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 .(lib ((dy-cast (list hoof) !>(*(list hoof))) q.cay)) %arc .(arc ((dy-cast (list hoof) !>(*(list hoof))) q.cay)) %dir =. dir (need (tome ((dy-cast path !>(*path)) q.cay))) =- +(..dy (he-diff %tan - ~)) rose/[" " `~]^~[leaf/"=%" (smyt (tope he-beak s.dir))] == :: %poke %- he-card(poy ~) :* %deal /poke [our.hid p.p.p.mad] q.p.p.mad %poke cay == :: %file %- he-card(poy ~) :* %info /file our.hid (foal (tope p.p.mad) cay) == :: %flat ?^ q.q.cay (dy-rash %tan [%leaf "not an atom"]~) (dy-rash %sav p.p.mad q.q.cay) :: %pill (dy-rash %sag p.p.mad q.q.cay) :: %http ?> ?=(%mime p.cay) =+ mim=;;(mime q.q.cay) =+ maf=(~(add ja *math) content-type/(moon p.mim)) (dy-eyre /show [q.p.mad p.p.mad maf ~ q.mim]) :: %show %+ dy-print cay ?- p.p.mad 0 ~ 1 [%rose [~ " " ~] (skol p.q.cay) ~]~ :: [%rose [~ " " ~] >p.cay< ~] 2 [%rose [~ " " ~] (dy-show-type-noun p.q.cay) ~]~ == == :: ++ dy-show |=(cay=cage (dy-print cay ~)) ++ dy-print |= [cay=cage tan=tang] %+ dy-rash %tan %- welp :_ tan ?+ p.cay [(sell q.cay)]~ %tang ;;(tang q.q.cay) %httr =+ hit=;;(httr q.q.cay) =- (flop (turn `wall`- |=(a=tape leaf/(dash:ut a '')))) :- "HTTP {