From e1c7a311e96b13d69dd2a4ad2539b606f04b5f21 Mon Sep 17 00:00:00 2001 From: "C. Guy Yarvin" Date: Sat, 18 Mar 2017 20:47:37 -0700 Subject: [PATCH 01/14] Implement doccords in hoon. This adds syntax to the language to embed documentation. You can either the new ^: rune, or the irregular ''':doccord.''': syntax. This patch adds the language feature, but does not use it. --- gen/metal.hoon | 64 ++++++++++++++++++++++++++++++++++++++++++++ sys/hoon.hoon | 72 +++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 133 insertions(+), 3 deletions(-) diff --git a/gen/metal.hoon b/gen/metal.hoon index 31c19da52..3eaa733e7 100644 --- a/gen/metal.hoon +++ b/gen/metal.hoon @@ -215,7 +215,70 @@ :: 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 /sur /ren /web /sys ~) == + :: :: + ++ 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} @@ -226,6 +289,7 @@ :: :: main-events: full events with advancing times :: +=. now ~2017.3.1 =+ ^= main-events |- ^- (list (pair @da ovum)) ?~ main-moves ~ diff --git a/sys/hoon.hoon b/sys/hoon.hoon index 924a7e384..9e43c88f8 100644 --- a/sys/hoon.hoon +++ b/sys/hoon.hoon @@ -4560,7 +4560,6 @@ (boss 256 (star qat)) == == -:: ++ soz ;~(plug soq soq soq) :: delimiting ''' ++ sym :: symbol %+ cook @@ -5465,6 +5464,7 @@ {$burn p/twig} :: ^~ {$name p/toga q/twig} :: ^= {$lead p/twig} :: ^? + {$help p/wain q/twig} :: ^: :: :::::: hints {$show p/twig q/twig} :: ~| sell on trace {$lurk p/twig q/twig} :: ~_ tank on trace @@ -5547,6 +5547,7 @@ {$core p/span q/coil} :: object {$face p/$@(term tune) q/span} :: namespace (new) {$fork p/(set span)} :: union + {$help p/wain q/span} :: documentation {$hold p/span q/twig} :: lazy evaluation == :: ++ tone $% {$0 p/*} :: success @@ -5612,6 +5613,14 @@ ^- span ?:(=(%void pac) %void [%core pac con]) :: +++ help + ~/ %help + |= {p/wain q/span} + ^- span + ?: =(%void q) + %void + [%help p q] +:: ++ face :: make %face span ~/ %face |= {giz/$@(term tune) der/span} @@ -6525,6 +6534,7 @@ ?: =(.?(u.mor) .?(u.dis)) ?:((gor u.mor u.dis) mor dis) ?@(u.mor mor dis) + {$help *} $(sut repo) {$hold *} ?: (~(has in gil) sut) ~ $(sut repo, gil (~(put in gil) sut)) @@ -6591,6 +6601,7 @@ {$core *} ?:(?=(?({$atom *} {$cell *}) ref) sut sint) {$face *} (face p.sut dext(sut q.sut)) {$fork *} (fork (turn (~(tap in p.sut)) |=(span dext(sut +<)))) + {$help *} (help 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) @@ -7006,6 +7017,9 @@ ?. sam.pec lose ?: con.pec $(sut p.sut, axe (peg axe 3)) $(sut (peek(sut p.sut) way 2), axe (peg axe 6)) + :: + {$help *} + $(sut repo) :: {$face *} ?: ?=($~ q.heg) here(sut q.sut) @@ -7137,6 +7151,7 @@ {$fork *} =+ yed=(~(tap in p.sut)) |- ^- nock ?~(yed [%1 1] (flor ^$(sut i.yed) $(yed t.yed))) + {$help *} $(sut q.sut) {$hold *} ?: (~(has in vot) sut) [%0 0] @@ -7174,6 +7189,7 @@ {$core *} $(sut repo) {$face *} (face p.sut $(sut q.sut)) {$fork *} (fork (turn (~(tap in p.sut)) |=(span ^$(sut +<)))) + {$help *} (help p.sut $(sut q.sut)) {$hold *} ?: (~(has in bix) [sut ref]) ~>(%mean.[%leaf "fuse-loop"] !!) @@ -7276,6 +7292,11 @@ {$name *} =+(vat=$(gen q.gen) [(conk(sut p.vat) p.gen) q.vat]) {$tune *} [(face p.gen sut) [%0 %1]] {$lead *} =+(vat=$(gen p.gen) [(wrap(sut p.vat) %lead) q.vat]) + :: + {$help *} + =+ hum=$(gen q.gen) + [(help p.gen p.hum) q.hum] + :: {$peep *} ~_(duck(sut (play p.gen)) $(gen q.gen)) {$hint *} =+ hum=$(gen q.gen) @@ -7387,6 +7408,7 @@ {$core *} $(sut p.sut) {$face *} $(sut q.sut) {$fork *} (lien (~(tap in p.sut)) |=(span ^$(sut +<))) + {$help *} $(sut q.sut) {$hold *} |((~(has in gil) sut) $(gil (~(put in gil) sut), sut repo)) $noun | $void & @@ -7438,6 +7460,9 @@ :: {$lead *} =+(vat=$(gen p.gen) [(wrap(sut p.vat) %lead) (wrap(sut q.vat) %lead)]) + :: + {$help *} + =+(vat=$(gen q.gen) [(help p.gen p.vat) (help p.gen q.vat)]) :: {$burn *} $(gen p.gen) {$peep *} ~_(duck(sut (play p.gen)) $(gen q.gen)) @@ -7625,6 +7650,7 @@ {$face *} dext(sut q.sut) {$fork *} ?. ?=(?({$atom *} $noun {$cell *} {$core *}) ref) sint (lien (~(tap in p.sut)) |=(span dext(tel |, sut +<))) + {$help *} dext(sut q.sut) {$hold *} ?: (~(has in seg) sut) | ?: (~(has in gil) [sut ref]) & %= dext @@ -7644,6 +7670,7 @@ {$core *} dext(ref repo(sut ref)) {$face *} dext(ref q.ref) {$fork *} (levy (~(tap in p.ref)) |=(span sint(ref +<))) + {$help *} dext(ref q.ref) {$hold *} ?: (~(has in reg) ref) & ?: (~(has in gil) [sut ref]) & %= dext @@ -7729,6 +7756,7 @@ {$burn *} $(gen p.gen) {$name *} (conk(sut $(gen q.gen)) p.gen) {$lead *} (wrap(sut $(gen p.gen)) %lead) + {$help *} (help p.gen $(gen q.gen)) {$peep *} ~_(duck(sut ^$(gen p.gen)) $(gen q.gen)) {$hint *} $(gen q.gen) {$per *} $(gen q.gen, sut $(gen p.gen)) @@ -7761,6 +7789,7 @@ ?- sut {$core *} [%cell %noun p.sut] {$face *} q.sut + {$help *} q.sut {$hold *} (rest [[p.sut q.sut] ~]) $noun (fork [%atom %$ ~] [%cell %noun %noun] ~) * ~>(%mean.[%leaf "repo-fltt"] !!) @@ -7811,6 +7840,7 @@ (core $(sut p.sut, u.i.vit lat) q.sut) {$face *} (face p.sut $(sut q.sut)) {$fork *} (fork (turn (~(tap in p.sut)) |=(span ^$(sut +<)))) + {$help *} (help p.sut $(sut q.sut)) {$hold *} ?: (~(has in vil) sut) %void $(sut repo, vil (~(put in vil) sut)) @@ -7851,6 +7881,7 @@ {$core *} ?>(|(=(%gold p.q.sut) =(%lead yoz)) sut(p.q yoz)) {$face *} (face p.sut $(sut q.sut)) {$fork *} (fork (turn (~(tap in p.sut)) |=(span ^$(sut +<)))) + {$help *} (help p.sut $(sut q.sut)) {$hold *} $(sut repo) == -- @@ -8257,6 +8288,9 @@ [1 (add 'a' (mod (div gum 26) 26))] [1 (add 'a' (mod (div gum 676) 26))] == + :: + {$help *} + $(sut q.sut) :: {$face *} =+ yad=$(sut q.sut) @@ -8392,6 +8426,19 @@ ++ vast !. =+ [bug=`?`| was=*(set path) wer=*path] |% + ++ dqut :: irregular docstring + =+ dsoz=;~(plug soq soq soq col) + =+ nl=(just '\0a') + =+ end=;~(pose dsoz ;~(plug nl dsoz)) + :: separator between lines: not nl''':, but just a newline. + =* mid ;~(less end nl) + :: printable characters which aren't an newline or an unquoted ''': + =* dqat ;~(less ;~(pose nl dsoz) ;~(pose ;~(pfix bas soq) prn)) + %- iny %+ ifix + :- ;~(pose ;~(plug dsoz nl) dsoz) + end + (more mid (boss 256 (star dqat))) + :: ++ gash %+ cook |= a/(list tyke) ^- tyke ?~(a ~ (weld i.a $(a t.a))) @@ -8816,7 +8863,10 @@ (stag %sand (stag %f (cold & pam))) == :- '\'' - (stag %sand (stag %t qut)) + ;~ pose + (stag %help ;~(plug dqut ;~(pfix gap tall))) + (stag %sand (stag %t qut)) + == :- '(' (stag %call (ifix [pel per] (most ace wide))) :- '{' @@ -9153,6 +9203,7 @@ ['~' (rune sig %burn expa)] ['=' (rune tis %name expg)] ['?' (rune wut %lead expa)] + [':' (rune col %help expx)] == == :- '~' @@ -9524,6 +9575,21 @@ |= {a/pint b/twig} ?:(bug [%dbug [wer a] b] b) zor + ++ wqut :: cord as wain for ^: + =+ end=;~(plug (just '\0a') soz) + =* mid ;~(less end (just '\0a')) + ;~ simu soq + ;~ pose + ;~ less soz + (cook |=(a/@ [a ~]) (ifix [soq soq] (boss 256 (more gon qit)))) + == + =+ hed=;~(pose ;~(plug (plus ace) vul) (just '\0a')) + %- iny %+ ifix + :- ;~(plug soz hed) + end + (more mid (boss 256 (star prn))) + == + == -- :: ++ vest @@ -9658,7 +9724,7 @@ ++ arch {fil/(unit @uvI) dir/(map @ta $~)} :: fundamental node ++ ares (unit {p/term q/(list tank)}) :: possible error ++ arvo (wind {p/term q/mill} mill) :: arvo card -++ beam {{p/ship q/desk r/case} s/path} :: global name +++ beam {{p/ship q/desk r/case} s/spur} :: global name ++ beak {p/ship q/desk r/case} :: path prefix ++ bone @ud :: opaque duct ++ case :: version From 4c381b638707a04206310bf70f05459ff0f1fed2 Mon Sep 17 00:00:00 2001 From: "C. Guy Yarvin" Date: Tue, 21 Mar 2017 17:56:51 -0700 Subject: [PATCH 02/14] coherent-cords-d, chapters, initial commit. --- app/dojo.hoon | 5 +- gen/ivory.hoon | 42 +++++++++++++++ gen/metal.hoon | 10 ++-- sys/arvo.hoon | 2 +- sys/hoon.hoon | 126 ++++++++++++++++++++++++--------------------- sys/vane/ford.hoon | 18 ++++--- 6 files changed, 129 insertions(+), 74 deletions(-) create mode 100644 gen/ivory.hoon diff --git a/app/dojo.hoon b/app/dojo.hoon index 282f23e3b..45dbd0424 100644 --- a/app/dojo.hoon +++ b/app/dojo.hoon @@ -543,7 +543,7 @@ |- ^- $? $% {$atom @tas (unit @)} {$cell _$ _$} {$cube * _$} - {$face $@(term tune) _$} + {$face {wain $@(term tune)} _$} {$fork (set _$)} {$hold _$ twig} == @@ -554,6 +554,7 @@ {?($cube $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/span ^$(a b))))) + {$help *} !! {$core ^} `wain`/core {$hold *} a(p $(a p.a)) == @@ -658,7 +659,7 @@ %+ sloop %- ~(rep by var) |= {{a/term @ b/vase} c/vase} ^- vase - (sloop b(p face+[a p.b]) c) + (sloop b(p face+[[~ a] p.b]) c) !>([our=our now=now eny=eny]:hid) :: ++ dy-made-dial :: dialog product diff --git a/gen/ivory.hoon b/gen/ivory.hoon new file mode 100644 index 000000000..525ba70e2 --- /dev/null +++ b/gen/ivory.hoon @@ -0,0 +1,42 @@ +:: +:::: /hoon/metal/gen + :: +/? 310 +:: +:::: + !: +:- %say +|= $: {now/@da * bec/beak} + * + == +:- %noun +:: +:: 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 +:: +~& %ivory-parsing +=+ compiler-twig=(ream compiler-source) +~& %ivory-parsed +:: +:: arvo-source: hoon source file producing arvo kernel, `sys/arvo` +:: +=+ arvo-source=.^(@t %cx (welp sys /arvo/hoon)) +:: +:: whole-twig: arvo within compiler +:: +=+ whole-twig=`twig`[%per compiler-twig [%per [%$ 7] (ream arvo-source)]] +:: +:: compile the whole schmeer +:: +~& %ivory-compiling +=+ whole-formula=q:(~(mint ut %noun) %noun whole-twig) +~& %ivory-compiled +:: +whole-formula diff --git a/gen/metal.hoon b/gen/metal.hoon index 3eaa733e7..ab43f8e56 100644 --- a/gen/metal.hoon +++ b/gen/metal.hoon @@ -120,11 +120,13 @@ =+ ^= compiler-tool .*(compiler-gate(+< [%noun compiler-source]) -.compiler-gate) :: - :: check that the new compiler formula equals the old formula. - :: this is not proof against thompson attacks but it doesn't hurt. + :: 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-formula +:compiler-tool) + =. 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, @@ -231,7 +233,7 @@ :: /web %eyre web content :: /sys system files :: - (user /app /gen /lib /mar /sur /ren /web /sys ~) + (user /app /gen /lib /mar /ren /sec /sur /sys /web ~) == :: :: ++ user :: userspace loading diff --git a/sys/arvo.hoon b/sys/arvo.hoon index 59298f5d6..06fdd057d 100644 --- a/sys/arvo.hoon +++ b/sys/arvo.hoon @@ -625,7 +625,7 @@ =+ gen=(rain pax.fav txt.fav) =+ vax=(slap pit gen) =+ orb=`@p`?~(urb 0xffff.ffff.ffff.ffff.ffff.ffff.ffff.ffff u.urb) - +>.^$(bod `[[%cell [%face %our [%atom %p ~]] p.vax] [orb q.vax]]) + +>.^$(bod `[[%cell [%face [~ %our] [%atom %p ~]] p.vax] [orb q.vax]]) %_ +>.^$ q.niz |- ^+ q.niz diff --git a/sys/hoon.hoon b/sys/hoon.hoon index 9e43c88f8..dea233b18 100644 --- a/sys/hoon.hoon +++ b/sys/hoon.hoon @@ -3,13 +3,13 @@ :: :: ~> %slog.[0 leaf+"hoon-assembly"] =< ride -=> %149 => +=> %146 => :: :: :::: 0: version stub :: :: :: -~% %k.149 ~ ~ :: +~% %k.146 ~ ~ :: |% -++ foo %bar +++ a146 %146 ++ hoon + -- => :: :: @@ -21,10 +21,10 @@ :: ~% %one + ~ |% +++ a146 %146 :: :: :::: 1a: unsigned arithmetic :: :: -++ foo %bar ++ add :: unsigned addition ~/ %add |= {a/@ b/@} @@ -208,7 +208,7 @@ :: ~% %two + ~ |% -++ foo %bar +++ a146 %146 :: :: :::: 2a: unit logic :: :: :: @@ -1725,7 +1725,7 @@ :: :: ~% %tri + ~ |% -++ foo %bar +++ a146 %146 :: :::: 3a: signed and modular ints :: :: :: @@ -3440,7 +3440,7 @@ %show show == |% -++ foo %bar +++ a146 %146 :: :::: 4a: exotic bases :: @@ -5340,7 +5340,7 @@ == :: ++ coil $: p/?($gold $iron $lead $zinc) :: core span q/span :: - r/{p/?($~ ^) q/(map term foot)} :: + r/{p/?($~ ^) q/(map term {p/wain q/foot})}:: == :: ++ foot $% {$ash p/twig} :: dry arm, geometric {$elm p/twig} :: wet arm, generic @@ -5422,11 +5422,11 @@ {$pick p/(list twig)} :: $? untagged fork {$coat p/term q/twig} :: $= name :: :::::: cores - {$door p/twig q/(map term foot)} :: |_ + {$door p/twig q/(map term (pair wain foot))} :: |_ {$gasp p/twig q/twig} :: |: - {$core p/(map term foot)} :: |% + {$core p/(map term (pair wain foot))} :: |% {$trap p/twig} :: |. - {$cork p/twig q/(map term foot)} :: |^ + {$cork p/twig q/(map term (pair wain foot))} :: |^ {$loop p/twig} :: |- {$port p/twig q/twig} :: |~ {$gill p/twig q/twig} :: |* @@ -5545,7 +5545,7 @@ $% {$atom p/term q/(unit @)} :: atom / constant {$cell p/span q/span} :: ordered pair {$core p/span q/coil} :: object - {$face p/$@(term tune) q/span} :: namespace (new) + {$face p/{p/wain q/$@(term tune)} q/span} :: namespace (new) {$fork p/(set span)} :: union {$help p/wain q/span} :: documentation {$hold p/span q/twig} :: lazy evaluation @@ -5596,7 +5596,7 @@ %ut ut == |% -++ foo %bar +++ a146 %146 :: :::: 5a: compiler utilities :: @@ -5623,7 +5623,7 @@ :: ++ face :: make %face span ~/ %face - |= {giz/$@(term tune) der/span} + |= {giz/{wain $@(term tune)} der/span} ^- span ?: =(%void der) %void @@ -5790,32 +5790,32 @@ :: ++ look ~/ %look - |= {cog/term dab/(map term foot)} + |= {cog/term dab/(map term (pair wain foot))} =+ axe=1 |- ^- (unit {p/axis q/foot}) ?- dab $~ ~ :: {* $~ $~} - ?:(=(cog p.n.dab) [~ axe q.n.dab] ~) + ?:(=(cog p.n.dab) [~ axe q.q.n.dab] ~) :: {* $~ *} ?: =(cog p.n.dab) - [~ (peg axe 2) q.n.dab] + [~ (peg axe 2) q.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] + [~ (peg axe 2) q.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] + [~ (peg axe 2) q.q.n.dab] ?: (gor cog p.n.dab) $(axe (peg axe 6), dab l.dab) $(axe (peg axe 7), dab r.dab) @@ -6214,13 +6214,16 @@ :: {$door *} [%pin [%bunt p.gen] [%core q.gen]] {$gasp *} [%pin [%burn p.gen] [%trap q.gen]] - {$trap *} [%core (~(put by *(map term foot)) %$ [%ash p.gen])] - {$cork *} [%per [%core (~(put by q.gen) %$ [%ash p.gen])] [%limb %$]] + {$trap *} :- %core + (~(put by *(map term (pair wain foot))) %$ ~ [%ash p.gen]) + {$cork *} [%per [%core (~(put by q.gen) %$ ~ [%ash p.gen])] [%limb %$]] {$loop *} [%rap [%limb %$] [%trap p.gen]] {$port *} [%iron [%gate p.gen q.gen]] {$gill *} :+ %pin [%bunt p.gen] - [%core (~(put by *(map term foot)) %$ [%elm q.gen])] - {$gate *} [%door p.gen (~(put by *(map term foot)) %$ [%ash q.gen])] + :- %core + (~(put by *(map term (pair wain foot))) %$ ~ [%elm q.gen]) + {$gate *} :+ %door p.gen + (~(put by *(map term (pair wain foot))) %$ ~ [%ash q.gen]) {$tray *} [%lead %trap p.gen] :: {$conq *} [p.gen q.gen r.gen s.gen] @@ -6546,21 +6549,21 @@ ~/ %busk |= gen/twig ^- span - [%face [~ [gen ~]] sut] + [%face [~ ~ [gen ~]] sut] :: ++ buss ~/ %buss |= {cog/term gen/twig} ^- span - [%face [[[cog ~ gen] ~ ~] ~] sut] + [%face [~ [[cog ~ gen] ~ ~] ~] sut] :: ++ conk |= got/toga ^- span - ?@ got [%face got sut] + ?@ got [%face [~ got] sut] ?- -.got $0 sut - $1 [%face p.got $(got q.got)] + $1 [%face [~ p.got] $(got q.got)] $2 ?> |(!vet (nest(sut [%cell %noun %noun]) & sut)) :+ %cell $(got p.got, sut (peek %both 2)) @@ -7023,13 +7026,14 @@ :: {$face *} ?: ?=($~ q.heg) here(sut q.sut) - ?@ p.sut - ?:(=(u.q.heg p.sut) here(sut q.sut) lose) + =* zot q.p.sut + ?@ zot + ?:(=(u.q.heg zot) here(sut q.sut) lose) =< main |% ++ main ^- pony - =+ tyr=(~(get by p.p.sut) u.q.heg) + =+ tyr=(~(get by p.zot) u.q.heg) ?~ tyr next ?~ u.tyr @@ -7043,13 +7047,13 @@ == ++ next |- ^- pony - ?~ q.p.sut + ?~ q.zot ^$(sut q.sut, lon [~ lon]) - =+ tiv=(mint(sut q.sut) %noun i.q.p.sut) + =+ tiv=(mint(sut q.sut) %noun i.q.zot) =+ fid=^$(sut p.tiv, lon ~, axe 1, gil ~) ?~ fid ~ ?: ?=({$| $& *} fid) - $(q.p.sut t.q.p.sut, p.heg p.p.fid) + $(q.zot t.q.zot, p.heg p.p.fid) =+ vat=(fine `port`?-(-.fid $& fid, $| [%| p.p.fid])) [%| %| p.vat (comb (comb [%0 axe] q.tiv) q.vat)] -- @@ -7073,6 +7077,8 @@ ~/ %find |= {way/vial hyp/wing} ^- port + ~_ (dunk %find-bug) + ~| hype+hyp ~_ (show [%c %find] %l hyp) =- ?@ - !! ?- -< @@ -7205,14 +7211,14 @@ (chip & gen) :: ++ harp - |= dab/(map term foot) + |= dab/(map term (pair wain foot)) ^- ?($~ ^) ?: ?=($~ dab) ~ =+ ^= vad - ?- -.q.n.dab - $ash q:(mint %noun p.q.n.dab) - $elm q:(mint(vet |) %noun p.q.n.dab) + ?- -.q.q.n.dab + $ash q:(mint %noun p.q.q.n.dab) + $elm q:(mint(vet |) %noun p.q.q.n.dab) == ?- dab {* $~ $~} vad @@ -7290,7 +7296,7 @@ ?:(?=($0 -.moc) [%1 p.moc] q.nef) :: {$name *} =+(vat=$(gen q.gen) [(conk(sut p.vat) p.gen) q.vat]) - {$tune *} [(face p.gen sut) [%0 %1]] + {$tune *} [(face [~ p.gen] sut) [%0 %1]] {$lead *} =+(vat=$(gen p.gen) [(wrap(sut p.vat) %lead) q.vat]) :: {$help *} @@ -7390,7 +7396,7 @@ typ :: ++ grow - |= {mel/vair ruf/twig dab/(map term foot)} + |= {mel/vair ruf/twig dab/(map term (pair wain foot))} ^- {p/span q/nock} =+ dan=^$(gen ruf, gol %noun) =+ toc=(core p.dan [%gold p.dan [~ dab]]) @@ -7456,7 +7462,7 @@ =+(vat=$(gen q.gen) [(conk(sut p.vat) p.gen) (conk(sut q.vat) p.gen)]) :: {$tune *} - [(face p.gen sut) (face p.gen dox)] + [(face [~ p.gen] sut) (face [~ p.gen] dox)] :: {$lead *} =+(vat=$(gen p.gen) [(wrap(sut p.vat) %lead) (wrap(sut q.vat) %lead)]) @@ -7551,7 +7557,7 @@ typ :: ++ grow - |= {mel/vair ruf/twig dab/(map term foot)} + |= {mel/vair ruf/twig dab/(map term (pair wain foot))} ~_ leaf+"mull-grow" ^- {p/span q/span} =+ dan=^$(gen ruf, gol %noun) @@ -7562,13 +7568,13 @@ (core q.dan [mel q.dan [[%0 0] dab]]) :: ++ bake - |= dab/(map term foot) + |= dab/(map term (pair wain foot)) ^- * ?: ?=($~ dab) ~ =+ ^= vad - ?- -.q.n.dab - $ash ^$(gol %noun, gen p.q.n.dab) + ?- -.q.q.n.dab + $ash ^$(gol %noun, gen p.q.q.n.dab) $elm ~ == ?- dab @@ -7600,19 +7606,21 @@ dext(sut (peek vay 2), ref (peek(sut ref) vay 2)) :: ++ deep - |= {dab/(map term foot) hem/(map term foot)} + |= $: dab/(map term (pair wain foot)) + hem/(map term (pair wain foot)) + == ^- ? ?: ?=($~ dab) =(hem ~) ?: ?=($~ hem) | ?& =(p.n.dab p.n.hem) $(dab l.dab, hem l.hem) $(dab r.dab, hem r.hem) - ?- -.q.n.dab - $elm =(q.n.dab q.n.hem) - $ash ?& ?=($ash -.q.n.hem) + ?- -.q.q.n.dab + $elm =(q.q.n.dab q.q.n.hem) + $ash ?& ?=($ash -.q.q.n.hem) %= dext - sut (play p.q.n.dab) - ref (play(sut ref) p.q.n.hem) + sut (play p.q.q.n.dab) + ref (play(sut ref) p.q.q.n.hem) == == == == :: ++ dext @@ -7745,7 +7753,7 @@ ?: =(%n p.gen) ?>(=(0 q.gen) [%atom p.gen ~ q.gen]) ?:(=(%f p.gen) ?>((lte q.gen 1) bool) [%atom p.gen ~]) [%cell $(q.gen -.q.gen) $(q.gen +.q.gen)] - {$tune *} (face p.gen sut) + {$tune *} (face [~ p.gen] sut) {$nock *} %noun {$same *} bool {$deep *} bool @@ -8294,7 +8302,7 @@ :: {$face *} =+ yad=$(sut q.sut) - ?^(p.sut yad [p.yad [%face p.sut q.yad]]) + ?^(q.p.sut yad [p.yad [%face q.p.sut q.yad]]) :: {$fork *} =+ yed=(~(tap in p.sut)) @@ -8800,10 +8808,10 @@ :+ %lace `twig`[p.i.lut [%conp $(lut t.lut)]] :+ %new [%base %cell] :- %core - ^- (map term foot) + ^- (map term (pair wain foot)) :_ [~ ~] =+ sug=[[%& 12] ~] - :+ %$ %elm + :^ %$ ~ %elm :^ %ifno sug [%make sug [[[[%& 1] ~] [%$ 13]] ~]] [%make sug [[[[%& 3] ~] [%make [%$ ~] [[sug [%$ 25]] ~]]] ~]] @@ -9289,11 +9297,11 @@ == |% ++ boog :: core arms - %+ knee [p=*term q=*foot] |. ~+ + %+ knee [p=*term q=*(pair wain foot)] |. ~+ ;~ pfix lus ;~ pose %+ cook - |=({a/$ash b/term c/twig} [b a c]) + |=({a/$ash b/term c/twig} [b *wain a c]) ;~ gunk (cold %ash (just '+')) ;~(pose (cold %$ buc) sym) @@ -9301,7 +9309,7 @@ == :: %+ cook - |=({a/$elm b/term c/twig} [b a c]) + |=({a/$elm b/term c/twig} [b *wain a c]) ;~ gunk (cold %elm (just '-')) ;~(pose (cold %$ buc) sym) @@ -9313,8 +9321,8 @@ ++ wisp :: core tail %- ulva %+ sear - |= a/(list (pair term foot)) - =| b/(map term foot) + |= a/(list (pair term (pair wain foot))) + =| b/(map term (pair wain foot)) |- ^- (unit _b) ?~ a `b ?: (~(has by b) p.i.a) diff --git a/sys/vane/ford.hoon b/sys/vane/ford.hoon index 926f9cca8..7923717cd 100644 --- a/sys/vane/ford.hoon +++ b/sys/vane/ford.hoon @@ -1448,8 +1448,8 @@ ++ able :: assemble preamble ^- twig :+ %per - ?:(=(~ rop) [%$ 1] [%core (~(run by rop) |=({^ a/twig} [%ash a]))]) - ?:(=(~ bil) [%$ 1] [%core (~(run by bil) |=({^ a/twig} [%ash a]))]) + ?:(=(~ rop) [%$ 1] [%core (~(run by rop) |=({^ a/twig} [~ %ash a]))]) + ?:(=(~ bil) [%$ 1] [%core (~(run by bil) |=({^ a/twig} [~ %ash a]))]) :: ++ abut :: generate |= {cof/cafe hyd/hood} @@ -1559,7 +1559,7 @@ %+ cope $(hon q.hon) %- flux |= {mar/mark vax/vase} - [mar [%face p.hon p.vax] q.vax] + [mar [%face [~ p.hon] p.vax] q.vax] :: $fan %+ cope @@ -1741,12 +1741,12 @@ (flux |=(sel/_..wilt sel(boy [[%tow boy.sel] boy]))) =+ [all=(lark (slat %tas) arc) sel=..wilt] %+ cope - |- ^- (bolt (pair (map term foot) _..wilt)) + |- ^- (bolt (pair (map term (pair wain foot)) _..wilt)) ?~ all (fine cof ~ ..wilt) %+ cope $(all l.all) - |= {cof/cafe lef/(map term foot) sel/_..wilt} + |= {cof/cafe lef/(map term (pair wain foot)) sel/_..wilt} %+ cope ^$(all r.all, cof cof, sel sel) - |= {cof/cafe rig/(map term foot) sel/_..wilt} + |= {cof/cafe rig/(map term (pair wain foot)) sel/_..wilt} %+ cope %= ^^^^$ cof cof @@ -1755,8 +1755,10 @@ == |= {cof/cafe sel/_..wilt} %+ fine cof - [`(map term foot)`[[p.n.all [%ash [%tow boy.sel]]] lef rig] sel] - |= {cof/cafe mav/(map term foot) sel/_..wilt} + :_ sel + ^- (map term (pair wain foot)) + [[p.n.all [~ %ash [%tow boy.sel]]] lef rig] + |= {cof/cafe mav/(map term (pair wain foot)) sel/_..wilt} ?~ mav (flaw cof [%leaf "source missing: {<(en-beam p.hop)>}"]~) (fine cof sel(boy [[%core mav] boy])) From cc7b768f6a48ea0d0e42b2a6d0ab0ced7c8edc5d Mon Sep 17 00:00:00 2001 From: "C. Guy Yarvin" Date: Sat, 25 Mar 2017 21:25:04 -0700 Subject: [PATCH 03/14] Terminating coherent-cords-e. --- app/dojo.hoon | 2 +- gen/walk.hoon | 326 ++++++++++++++++++++++++ sys/hoon.hoon | 612 ++++++++++++++++++++++++++++++--------------- sys/vane/ford.hoon | 14 +- 4 files changed, 745 insertions(+), 209 deletions(-) create mode 100644 gen/walk.hoon diff --git a/app/dojo.hoon b/app/dojo.hoon index 45dbd0424..ba35bf598 100644 --- a/app/dojo.hoon +++ b/app/dojo.hoon @@ -1010,7 +1010,7 @@ :+ %as `mark`(cat 3 api.sink.com '-poke') :- 1 :+ %do - :+ %gill [%base %noun] + :^ %gill ~ [%base %noun] :^ %cont [%rock %tas %post] [%rock %$ endpoint.sink.com] [%make ~[[%.y 6]] ~] diff --git a/gen/walk.hoon b/gen/walk.hoon new file mode 100644 index 000000000..0b5195569 --- /dev/null +++ b/gen/walk.hoon @@ -0,0 +1,326 @@ +:: "Hello world" sample generator +:: +:::: /hoon/hello/gen + :: +/? 310 +:: +:::: + :: +:- %say +|= * +=< [%noun %walk] +|% +:: +++ ap :: twig engine + |_ gen/twig + ++ dock :: apply document + |= doc/cord + |^ ^- (unit twig) + =/ rah ^- (each (pair term cord) cord) + (rash doc very) + ?-(-.rah $& (rave p.rah), $| (graf p.rah)) + :: + ++ graf :: apply general doc + =* life (unit cord) + |= doc/cord + ^- (unit twig) + =- ?^ q.dep `[%help [doc ~] gen] + `p.dep + ^= dep + =/ foo/@tas %foobar + ^- (pair twig life) + %+ (walk life) + `doc + |= {gen/twig vit/life aid/$-({? twig life} {twig life})} + ^- (unit (pair twig life)) + ?~ vit `[gen ~] + |^ ?+ -.gen + outside-image + ^ outside-image + $dbug ~ + $help `[[%help [doc p.gen] q.gen] ~] + $claw outside-model + $shoe outside-model + $bank outside-model + $lamb outside-model + $bush outside-model + $pick outside-model + $coat outside-model + $halo `[[%halo [doc p.gen] q.gen] ~] + == + ++ outside-model + `[[%halo [doc ~] gen] ~] + ++ outside-image + `[[%help [doc ~] gen] ~] + -- + :: + ++ rave :: apply variable doc + =* life (unit (pair term cord)) + |= {cog/term doc/cord} + ^- (unit twig) + =- ?^ q.dep ~ + `p.dep + ^= dep + ^- (pair twig life) + %+ (walk life) + `[cog doc] + |= {gen/twig vit/life aid/$-({? twig life} {twig life})} + ^- (unit (pair twig life)) + ?~ vit `[gen ~] + ~ + :: + ++ very :: variable reparse + %+ pick + ;~(plug sym (cook crip ;~(pfix ;~(plug col ace) (star prn)))) + (cook crip (star prn)) + -- + :: + ++ walk :: forward traverse + |* life/mold + |= $: vit/life + $= mac + $- $: twig + life + $-({? twig life} {twig life}) + == + (unit (pair twig life)) + == + ^- {twig life} + =/ use & + =< apex + |% + ++ apex + |- ^- {twig life} + =- [~=(gen -<) ~=(vit +>)] + =* aid |= {use/? gen/twig vit/life} + ^$(use use, gen gen, vit vit) + =/ gun ?:(use (mac gen vit aid) ~) + ?^ gun u.gun + ?: ?=(^ -.gen) + %.(gen dubs) + ?- -.gen + $$ (lead -.gen %.(+.gen noop)) + $base (lead -.gen %.(+.gen noop)) + $bunt (lead -.gen %.(+.gen expr)) + $bust (lead -.gen %.(+.gen noop)) + $dbug (lead -.gen %.(+.gen nexp)) + $hand (lead -.gen %.(+.gen noop)) + $knit (lead -.gen %.(+.gen (moto bark))) + $leaf (lead -.gen %.(+.gen noop)) + $limb (lead -.gen %.(+.gen noop)) + $lost (lead -.gen %.(+.gen expr)) + $rock (lead -.gen %.(+.gen noop)) + $sand (lead -.gen %.(+.gen noop)) + $tell (lead -.gen %.(+.gen moar)) + $tune (lead -.gen %.(+.gen tung)) + $wing (lead -.gen %.(+.gen noop)) + $yell (lead -.gen %.(+.gen moar)) + $claw (lead -.gen %.(+.gen dubs)) + $shoe (lead -.gen %.(+.gen expr)) + $bank (lead -.gen %.(+.gen moar)) + $book (lead -.gen %.(+.gen moar)) + $lamb (lead -.gen %.(+.gen dubs)) + $bush (lead -.gen %.(+.gen dubs)) + $pick (lead -.gen %.(+.gen moar)) + $coat (lead -.gen %.(+.gen nexp)) + $door (lead -.gen %.(+.gen (twin expr arms))) + $gasp (lead -.gen %.(+.gen dubs)) + $core (lead -.gen %.(+.gen arms)) + $trap (lead -.gen %.(+.gen expr)) + $cork (lead -.gen %.(+.gen (twin expr arms))) + $loop (lead -.gen %.(+.gen expr)) + $port (lead -.gen %.(+.gen dubs)) + $gill (lead -.gen %.(+.gen dubs)) + $gate (lead -.gen %.(+.gen dubs)) + $tray (lead -.gen %.(+.gen expr)) + $scon (lead -.gen %.(+.gen dubs)) + $conq (lead -.gen %.(+.gen (quad expr expr expr expr))) + $cons (lead -.gen %.(+.gen dubs)) + $cont (lead -.gen %.(+.gen trey)) + $conl (lead -.gen %.(+.gen moar)) + $conp (lead -.gen %.(+.gen moar)) + $keep (lead -.gen %.(+.gen (twin noop moan))) + $lace (lead -.gen %.(+.gen dubs)) + $call (lead -.gen %.(+.gen (twin expr moar))) + $bake (lead -.gen %.(+.gen (trio noop expr moan))) + $calq (lead -.gen %.(+.gen (quad expr expr expr expr))) + $calt (lead -.gen %.(+.gen trey)) + $open (lead -.gen %.(+.gen (trio noop expr moar))) + $make (lead -.gen %.(+.gen (twin noop moan))) + $wish (lead -.gen %.(+.gen dubs)) + $bump (lead -.gen %.(+.gen expr)) + $nock (lead -.gen %.(+.gen dubs)) + $same (lead -.gen %.(+.gen dubs)) + $deep (lead -.gen %.(+.gen expr)) + $iron (lead -.gen %.(+.gen expr)) + $ward (lead -.gen %.(+.gen dubs)) + $like (lead -.gen %.(+.gen dubs)) + $cast (lead -.gen %.(+.gen dubs)) + $zinc (lead -.gen %.(+.gen expr)) + $burn (lead -.gen %.(+.gen expr)) + $name (lead -.gen %.(+.gen nexp)) + $lead (lead -.gen %.(+.gen expr)) + $halo (lead -.gen %.(+.gen nexp)) + $help (lead -.gen %.(+.gen nexp)) + $show (lead -.gen %.(+.gen dubs)) + $lurk (lead -.gen %.(+.gen dubs)) + $crap (lead -.gen %.(+.gen (raid expr))) + $fast (lead -.gen %.(+.gen (quad noop expr moan expr))) + $funk (lead -.gen %.(+.gen nexp)) + $thin (lead -.gen %.(+.gen (twin toad expr))) + $hint (lead -.gen %.(+.gen (twin toad expr))) + $poll (lead -.gen %.(+.gen nexp)) + $memo (lead -.gen %.(+.gen nexp)) + $dump (lead -.gen %.(+.gen trip)) + $ddup (lead -.gen %.(+.gen dubs)) + $warn (lead -.gen %.(+.gen (quad noop expr expr expr))) + $peep (lead -.gen %.(+.gen dubs)) + $wad (lead -.gen %.(+.gen (twin expr moar))) + $nub (lead -.gen %.(+.gen expr)) + $dip (lead -.gen %.(+.gen (twin expr moar))) + $fry (lead -.gen %.(+.gen dubs)) + $new (lead -.gen %.(+.gen dubs)) + $fix (lead -.gen %.(+.gen (twin moan expr))) + $var (lead -.gen %.(+.gen (trio toad expr expr))) + $rev (lead -.gen %.(+.gen (trio toad expr expr))) + $set (lead -.gen %.(+.gen trip)) + $huh (lead -.gen %.(+.gen (quad noop expr expr expr))) + $rap (lead -.gen %.(+.gen dubs)) + $nip (lead -.gen %.(+.gen dubs)) + $per (lead -.gen %.(+.gen dubs)) + $sip (lead -.gen %.(+.gen (quad toad noop expr expr))) + $pin (lead -.gen %.(+.gen dubs)) + $tow (lead -.gen %.(+.gen moar)) + $aka (lead -.gen %.(+.gen trip)) + $use (lead -.gen %.(+.gen dubs)) + $or (lead -.gen %.(+.gen moar)) + $case (lead -.gen %.(+.gen (twin noop (moto dubs)))) + $if (lead -.gen %.(+.gen trey)) + $lest (lead -.gen %.(+.gen trey)) + $ifcl (lead -.gen %.(+.gen trip)) + $deny (lead -.gen %.(+.gen dubs)) + $sure (lead -.gen %.(+.gen dubs)) + $deft (lead -.gen %.(+.gen (trio noop expr (moto dubs)))) + $and (lead -.gen %.(+.gen moar)) + $ifat (lead -.gen %.(+.gen trip)) + $ifno (lead -.gen %.(+.gen trip)) + $fits (lead -.gen %.(+.gen (twin expr noop))) + $not (lead -.gen %.(+.gen expr)) + $twig (lead -.gen %.(+.gen dubs)) + $wrap (lead -.gen %.(+.gen expr)) + $spit (lead -.gen %.(+.gen dubs)) + $code (lead -.gen %.(+.gen expr)) + $need (lead -.gen %.(+.gen nexp)) + $fail (lead -.gen %.(+.gen noop)) + == + ++ arms + (raid (twin noop (raid (twin noop heel)))) + :: + ++ bark + |= wof/woof + ?-(wof @ [wof vit], ^ (lead ~ (expr p.wof))) + :: + ++ dubs + (twin expr expr) + :: + ++ expr + |= p/twig + ^$(gen p) + :: + ++ heel + |= bud/foot + ?- -.bud + $ash =^(nex vit ^$(gen p.bud) [[%ash nex] vit]) + $elm =^(nex vit ^$(gen p.bud) [[%elm nex] vit]) + == + :: + ++ lead + |* {sem/@tas out/{* life}} + [[sem -.out] +.out] + :: + ++ moan + (moto nexp) + :: + ++ moar + (moto expr) + :: + ++ moto + |* etc/$-(* {* life}) + |* bud/* + ^+ [bud vit] + ?: =(~ bud) [bud vit] + =^ heb vit (etc -.bud) + =^ mor vit $(bud +.bud) + [[heb mor] vit] + :: + ++ nexp + (twin noop expr) + :: + ++ noop + |* bud/* + [bud vit] + :: + ++ quad + |* $: one/$-(* {* life}) + two/$-(* {* life}) + tri/$-(* {* life}) + qua/$-(* {* life}) + == + |* bud/* + =^ yal vit (one -.bud) + =^ ves vit (two +<.bud) + =^ jot vit (tri +>-.bud) + =^ wip vit (qua +>+.bud) + [[yal ves jot wip] vit] + :: + ++ raid + |* etc/$-(* {* life}) + |* bud/* + ^+ [bud vit] + ?: =(~ bud) [bud vit] + =^ lef vit $(bud +<.bud) + =^ ryt vit $(bud +>.bud) + =^ top vit (etc ->.bud) + [[[-<.bud top] lef ryt] vit] + :: + ++ trey + (trio expr expr expr) + :: + ++ trio + |* $: one/$-(* {* life}) + two/$-(* {* life}) + tri/$-(* {* life}) + == + |* bud/* + =^ yal vit (one -.bud) + =^ ves vit (two +<.bud) + =^ jot vit (tri +>.bud) + [[yal ves jot] vit] + :: + ++ trip + (trio noop expr expr) + :: + ++ toad + |= bud/$@(term {p/term q/twig}) + ?@ bud [bud vit] + (lead p.bud (expr q.bud)) + :: + ++ tung + |= bud/{p/wain q/$@(term tune)} + ?@ q.bud [bud vit] + (lead p.bud %.(q.bud (twin (raid twee) (moto expr)))) + :: + ++ twee + |= bud/(unit twig) + ?~ bud [~ vit] + (lead ~ (expr u.bud)) + :: + ++ twin + |* {one/$-(* {* life}) two/$-(* {* life})} + |* bud/* + =^ yal vit (one -.bud) + =^ ves vit (two +.bud) + [[yal ves] vit] + -- + -- +-- diff --git a/sys/hoon.hoon b/sys/hoon.hoon index dea233b18..8d64161c1 100644 --- a/sys/hoon.hoon +++ b/sys/hoon.hoon @@ -3,13 +3,13 @@ :: :: ~> %slog.[0 leaf+"hoon-assembly"] =< ride -=> %146 => +=> %145 => :: :: :::: 0: version stub :: :: :: -~% %k.146 ~ ~ :: +~% %k.145 ~ ~ :: |% -++ a146 %146 +++ a145 %145 ++ hoon + -- => :: :: @@ -21,7 +21,7 @@ :: ~% %one + ~ |% -++ a146 %146 +++ a145 %145 :: :: :::: 1a: unsigned arithmetic :: :: @@ -208,7 +208,7 @@ :: ~% %two + ~ |% -++ a146 %146 +++ a145 %145 :: :: :::: 2a: unit logic :: :: :: @@ -1725,7 +1725,7 @@ :: :: ~% %tri + ~ |% -++ a146 %146 +++ a145 %145 :: :::: 3a: signed and modular ints :: :: :: @@ -3440,7 +3440,7 @@ %show show == |% -++ a146 %146 +++ a145 %145 :: :::: 4a: exotic bases :: @@ -5339,8 +5339,8 @@ {ven/term pro/term ver/@ kel/@} :: all of the above == :: ++ coil $: p/?($gold $iron $lead $zinc) :: core span - q/span :: - r/{p/?($~ ^) q/(map term {p/wain q/foot})}:: + q/span :: built with + r/{p/?($~ ^) q/(map @ tomb)} :: arms == :: ++ foot $% {$ash p/twig} :: dry arm, geometric {$elm p/twig} :: wet arm, generic @@ -5351,7 +5351,6 @@ == :: ++ line {p/{$leaf p/aura q/@} q/tile} :: %book case ++ metl ?($gold $iron $zinc $lead) :: core variance -++ moss twig :: twig producing mold ++ noun * :: any noun ++ null $~ :: null, nil, etc ++ onyx (list (pair span foot)) :: arm activation @@ -5362,28 +5361,31 @@ ++ palo (pair vein opal) :: wing trace, match ++ pock (pair axis nock) :: changes ++ port (each palo (pair span nock)) :: successful match +++ root twig :: produce model ++ tiki :: test case $% {$& p/(unit term) q/wing} :: simple wing {$| p/(unit term) q/twig} :: named wing == :: ++ tile $^ {p/tile q/tile} :: ordered pair $% {$axil p/base} :: base span - {$bark p/term q/tile} :: name + {$bark p/toga q/tile} :: name {$bush p/tile q/tile} :: pair+tag {$deet p/spot q/tile} :: set debug {$fern p/{i/tile t/(list tile)}} :: plain selection {$herb p/twig} :: gate {$kelp p/{i/line t/(list line)}} :: tag selection {$leaf p/term q/@} :: constant atom + {$plow p/wain q/tile} :: apply help {$reed p/tile q/tile} :: atom+cell {$weed p/twig} :: example == :: ++ toga :: face control $@ p/term :: two togas $% {$0 $~} :: no toga - {$1 p/$@(term tune) q/toga} :: deep toga + {$1 p/(pair wain term) q/toga} :: deep toga {$2 p/toga q/toga} :: cell toga == :: +++ tomb (pair wain (map term (pair wain foot))) :: core chapter ++ tuna :: tagflow $% {$a p/twig} :: plain text {$b p/twig} :: single tag @@ -5398,10 +5400,12 @@ {$$ p/axis} :: simple leg :: :: {$base p/base} :: base - {$bunt p/twig} :: mold default value + {$bunt p/root} :: mold default value {$bust p/base} :: bunt base {$dbug p/spot q/twig} :: debug info in trace {$hand p/span q/nock} :: premade result + {$help p/wain q/twig} :: annotate image + {$halo p/wain q/root} :: annotate model {$knit p/(list woof)} :: assemble string {$leaf p/(pair term @)} :: symbol {$limb p/term} :: pulls limb p @@ -5409,29 +5413,30 @@ {$rock p/term q/*} :: fixed constant {$sand p/term q/*} :: unfixed constant {$tell p/(list twig)} :: render as tape - {$tune p/$@(term tune)} :: minimal face + {$tune p/(pair wain $@(term tune))} :: minimal face {$wing p/wing} :: pulls p {$yell p/(list twig)} :: render as tank :: :::::: molds - {$claw p/twig q/twig} :: $@ depth fork + {$claw p/root q/root} :: $@ depth fork {$shoe p/twig} :: $_ example - {$bank p/(list twig)} :: $: tuple - {$book p/(list twig)} :: $% tagged fork - {$lamb p/twig q/twig} :: $- function - {$bush p/twig q/twig} :: $^ pairhead fork + {$bank p/(list root)} :: $: tuple + {$book p/(list root)} :: $% tagged fork + {$lamb p/root q/root} :: $- function + {$bush p/root q/root} :: $^ pairhead fork {$pick p/(list twig)} :: $? untagged fork - {$coat p/term q/twig} :: $= name + {$coat p/toga q/root} :: $= name :: :::::: cores - {$door p/twig q/(map term (pair wain foot))} :: |_ - {$gasp p/twig q/twig} :: |: - {$core p/(map term (pair wain foot))} :: |% - {$trap p/twig} :: |. - {$cork p/twig q/(map term (pair wain foot))} :: |^ - {$loop p/twig} :: |- - {$port p/twig q/twig} :: |~ - {$gill p/twig q/twig} :: |* - {$gate p/twig q/twig} :: |= - {$tray p/twig} :: |? + {$door p/wain q/root r/(map @ tomb)} :: |_ + {$gasp p/wain q/root r/twig} :: |: + {$corp p/wain q/(map @ tomb)} :: |% + {$core p/(map @ tomb)} :: |% + {$trap p/wain q/twig} :: |. + {$cork p/wain q/twig r/(map @ tomb)} :: |^ + {$loop p/wain q/twig} :: |- + {$port p/wain q/twig r/twig} :: |~ + {$gill p/wain q/root r/twig} :: |* + {$gate p/wain q/root r/twig} :: |= + {$tray p/wain q/twig} :: |? :: :::::: tuples {$scon p/twig q/twig} :: :_ [q p] {$conq p/twig q/twig r/twig s/twig} :: :^ [p q r s] @@ -5440,7 +5445,6 @@ {$conl p/(list twig)} :: :~ [p ~] {$conp p/(list twig)} :: :* p as a tuple :: :::::: invocations - {$bunt p/twig} :: %$ {$keep p/wing q/(list (pair wing twig))} :: %_ {$lace p/twig q/twig} :: %. {$call p/twig q/(list twig)} :: %- @@ -5450,7 +5454,7 @@ {$open p/wing q/twig r/(list twig)} :: %~ {$make p/wing q/(list (pair wing twig))} :: %= :: :::::: nock - {$wish p/twig q/twig} :: .^ nock 11 + {$wish p/root q/twig} :: .^ nock 11 {$bump p/twig} :: .+ nock 4 {$nock p/twig q/twig} :: .* nock 2 {$same p/twig q/twig} :: .= nock 5 @@ -5459,12 +5463,11 @@ {$iron p/twig} :: ^| {$ward p/twig q/twig} :: ^. {$like p/twig q/twig} :: ^+ - {$cast p/twig q/twig} :: ^- + {$cast p/root q/twig} :: ^- {$zinc p/twig} :: ^& {$burn p/twig} :: ^~ {$name p/toga q/twig} :: ^= {$lead p/twig} :: ^? - {$help p/wain q/twig} :: ^: :: :::::: hints {$show p/twig q/twig} :: ~| sell on trace {$lurk p/twig q/twig} :: ~_ tank on trace @@ -5484,16 +5487,16 @@ {$dip p/twig q/(list twig)} :: ;~ kleisli arrow {$fry p/twig q/twig} :: ;; normalize :: :::::: compositions - {$new p/twig q/twig} :: =| push bunt + {$new p/root q/twig} :: =| push bunt {$fix p/(list (pair wing twig)) q/twig} :: =: q with p changes - {$var p/taro q/twig r/twig} :: =/ typed variable - {$rev p/taro q/twig r/twig} :: =; =/(q p r) + {$var p/toro q/twig r/twig} :: =/ typed variable + {$rev p/toro q/twig r/twig} :: =; =/(q p r) {$set p/wing q/twig r/twig} :: =. r with p as q {$huh p/wing q/twig r/twig s/twig} :: =? conditional =. {$rap p/twig q/twig} :: =< =>(q p) {$nip p/twig q/twig} :: =- =+(q p) {$per p/twig q/twig} :: => q w/subject p - {$sip p/taro q/wing r/twig s/twig} :: =^ state machine + {$sip p/toro q/wing r/twig s/twig} :: =^ state machine {$pin p/twig q/twig} :: =+ q w/[p subject] {$tow p/(list twig)} :: =~ twig stack {$aka p/term q/twig r/twig} :: =* r w/alias p/q @@ -5511,7 +5514,7 @@ {$ifat p/wing q/twig r/twig} :: ?@ if p is atom {$ifno p/wing q/twig r/twig} :: ?~ if p is null :: - {$fits p/twig q/wing} :: ?= if q matches p + {$fits p/root q/wing} :: ?= if q matches p {$not p/twig} :: ?! loobean not :: :::::: special {$twig p/twig q/twig} :: !, @@ -5521,7 +5524,7 @@ {$need p/$@(p/@ {p/@ q/@}) q/twig} :: !? {$fail $~} :: !! == :: -++ taro $@(term (pair term twig)) :: +++ toro (pair toga (unit root)) :: ++ tyre (list {p/term q/twig}) :: ++ tyke (list (unit twig)) :: :: :::::: virtual nock @@ -5555,15 +5558,9 @@ {$2 p/(list {@ta *})} :: error ~_s == :: ++ tune :: complex - $: p/(map term (unit twig)) :: definitions + $: p/(map term (pair wain (unit twig))) :: aliases q/(list twig) :: bridges == :: -++ tusk :: general face control - $@ term :: simple label - $: p/(map term wing) :: aliases - q/(set term) :: blocks - r/(list (pair term twig)) :: bridges - == :: ++ typo span :: old span ++ vase {p/span q/*} :: span-value pair ++ vise {p/typo q/*} :: old vase @@ -5596,7 +5593,7 @@ %ut ut == |% -++ a146 %146 +++ a145 %145 :: :::: 5a: compiler utilities :: @@ -5792,35 +5789,68 @@ ~/ %look |= {cog/term dab/(map term (pair wain foot))} =+ axe=1 - |- ^- (unit {p/axis q/foot}) + |- ^- (unit {p/axis q/(pair wain foot)}) ?- dab $~ ~ :: {* $~ $~} - ?:(=(cog p.n.dab) [~ axe q.q.n.dab] ~) + ?:(=(cog p.n.dab) [~ axe q.n.dab] ~) :: {* $~ *} ?: =(cog p.n.dab) - [~ (peg axe 2) q.q.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.q.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.q.n.dab] + [~ (peg axe 2) q.n.dab] ?: (gor cog p.n.dab) $(axe (peg axe 6), dab l.dab) $(axe (peg axe 7), dab r.dab) == :: +++ loot + ~/ %loot + |= {cog/term dom/(map @ tomb)} + =+ axe=1 + |- ^- (unit {p/axis q/(pair wain foot)}) + ?- dom + $~ ~ + :: + {* $~ $~} + %+ bind (look cog q.q.n.dom) + |=((pair axis (pair wain foot)) [(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] + =+ pey=$(axe (peg axe 6), dom l.dom) + ?^ pey pey + $(axe (peg axe 7), dom r.dom) + == +:: :::: 5b: macro expansion :: ++ ah :: tiki engine @@ -5865,18 +5895,30 @@ %bunt bunt %whip whip == - =+ [nag=`*`& gom=`axis`1] + =+ :* nag=`*`& + gom=`axis`1 + wan=*wain + == |_ sec/tile :::: + ++ hail + |= gen/twig + ^- twig + ?~(wan gen [%help wan gen]) + :: ++ home |=(gen/twig ^-(twig ?:(=(1 gom) gen [%per [%$ gom] gen]))) :::: ++ bunt |- ^- twig ?- sec {^ *} - [$(sec p.sec) $(sec q.sec)] + %- hail + =. wan ~ + (hail [$(sec p.sec) $(sec q.sec)]) :: {$axil *} + %- hail + =. wan ~ ?- p.sec {$atom *} [%sand p.p.sec 0] $noun [%nock [%rock %$ 0] [[%rock %$ 0] [%rock %$ 1]]] @@ -5890,50 +5932,52 @@ [%name p.sec $(sec q.sec)] :: {$bush *} + %- hail + =. wan ~ [%if [%bust %bean] $(sec p.sec) $(sec q.sec)] :: {$deet *} [%dbug p.sec $(sec q.sec)] :: {$fern *} + %- hail + =. wan ~ |- ^- twig ?~ t.p.sec ^$(sec i.p.sec) [%if [%bust %bean] ^$(sec i.p.sec) $(p.sec t.p.sec)] :: {$herb *} + %- hail + =. wan ~ =+ cys=~(boil ap p.sec) ?: ?=($herb -.cys) (home [%rap [%limb %$] p.sec]) $(sec cys) :: {$kelp *} + %- hail + =. wan ~ |- ^- twig ?~ t.p.sec ^$(sec i.p.sec) [%if [%bust %bean] ^$(sec i.p.sec) $(p.sec t.p.sec)] :: {$leaf *} - [%rock p.sec q.sec] + (hail [%rock p.sec q.sec]) + :: + {$plow *} + $(sec q.sec, wan (weld p.sec wan)) :: {$reed *} + %- hail + =. wan ~ [%if [%bust %bean] $(sec p.sec) $(sec q.sec)] :: {$weed *} - (home p.sec) + (hail (home p.sec)) == - ++ clam ^-(twig [%gate [%base %noun] (whip(gom 7) 6)]) - ++ cloq - |- ^- {p/toga q/tile} - =. sec ?.(?=($herb -.sec) sec ~(boil ap p.sec)) - ?: ?=($deet -.sec) $(sec q.sec) - ?: ?=(^ -.sec) - =+ [one=$(sec p.sec) two=$(sec q.sec)] - [[%2 p.one p.two] [q.one q.two]] - ?. ?=($bark -.sec) [[%0 ~] sec] - =+ got=$(sec q.sec) - :_ q.got - ?:(?=({$0 $~} p.got) p.sec [%1 p.sec p.got]) + ++ clam ^-(twig [%gate ~ [%base %noun] (whip(gom 7) 6)]) :: ++ whip |= axe/axis @@ -5949,11 +5993,15 @@ ^- twig ?- sec {^ *} + %- hail + =. wan ~ %- tun |= gon/* => .(nag gon) ^- twig :- ^$(sec -.sec, nag -.nag, axe (peg axe 2)) ^$(sec +.sec, nag +.nag, axe (peg axe 3)) :: {$axil *} + %- hail + =. wan ~ ?- p.sec {$atom *} =+ buv=bunt @@ -5989,6 +6037,8 @@ [%name p.sec $(sec q.sec)] :: {$bush *} + %- hail + =. wan ~ %- tun |= gon/* => .(nag gon) ^- twig ?@ -.nag ?: =(& -.nag) @@ -6000,6 +6050,8 @@ [%dbug p.sec $(sec q.sec)] :: {$fern *} + %- hail + =. wan ~ |- ^- twig ?~ t.p.sec ^$(sec i.p.sec) @@ -6012,12 +6064,16 @@ $(i.p.sec i.t.p.sec, t.p.sec t.t.p.sec) :: {$herb *} + %- hail + =. wan ~ =+ cys=~(boil ap p.sec) ?: ?=($herb -.cys) [%call (home p.sec) [%$ axe] ~] $(sec cys) :: {$kelp *} + %- hail + =. wan ~ %- tun |= gon/* => .(nag gon) |- ^- twig ?~ t.p.sec @@ -6030,9 +6086,14 @@ $(i.p.sec i.t.p.sec, t.p.sec t.t.p.sec) :: {$leaf *} - [%rock p.sec q.sec] + (hail [%rock p.sec q.sec]) + :: + {$plow *} + $(sec q.sec, wan (weld p.sec wan)) :: {$reed *} + %- hail + =. wan ~ ?- nag $& [%ifat [[%& axe] ~] $(sec p.sec, nag |) $(sec q.sec, nag [& &])] $| $(sec p.sec) @@ -6041,7 +6102,7 @@ == :: {$weed *} - (home p.sec) + (hail (home p.sec)) == -- :: @@ -6054,6 +6115,46 @@ %rake rake == |_ gen/twig + ++ dock :: apply document + |= doc/cord + |^ ^- (unit twig) + =/ rah ^- (each (pair term cord) cord) + (rash doc very) + ?-(-.rah $& (rave p.rah), $| (graf p.rah)) + :: + ++ graf :: apply general doc + |= doc/cord + ^- (unit twig) + =- ?^ q.dep `[%help [doc ~] gen] + `p.dep + ^= dep + ^- (pair twig (unit cord)) + %+ (walk (unit cord)) + `doc + |= {gen/twig vit/(unit cord)} + ^- (unit (pair twig (unit cord))) + :: XX stub + ~ + :: + ++ rave :: apply variable doc + |= {cog/term doc/cord} + ^- (unit twig) + =- ?^ q.dep ~ + `p.dep + ^= dep + ^- (pair twig (unit (pair term cord))) + %+ (walk (unit (pair term cord))) + `[cog doc] + |= {gen/twig vit/(unit (pair term cord))} + ^- (unit (pair twig (unit (pair term cord)))) + :: XX stub + ~ + :: + ++ very :: variable cord rule + %+ pick + ;~(plug sym (cook crip ;~(pfix ;~(plug col ace) (star prn)))) + (cook crip (star prn)) + -- ++ etch ~_ leaf+"etch" |- ^- term @@ -6148,7 +6249,8 @@ == :: {$bush *} [%bush boil(gen p.gen) boil(gen q.gen)] - {$lamb *} [%weed [%port p.gen [%bunt [%per [%$ 7] q.gen]]]] + {$lamb *} [%weed [%port ~ p.gen [%bunt [%per [%$ 7] q.gen]]]] + {$halo *} [%plow p.gen boil(gen q.gen)] {$coat *} [%bark p.gen boil(gen q.gen)] {$pick *} =+ (turn p.gen |=(a/twig boil(gen a))) ?~(- [%axil %void] [%fern -]) @@ -6165,9 +6267,9 @@ :: {$knit *} :: :+ %per [%name %v %$ 1] :: => v=. - :- %loop :: |- + :+ %loop ~ :: |- :+ %like :: ^+ - :- %loop :: |- + :+ %loop ~ :: |- :^ %if :: ?: [%bust %bean] :: ? [%bust %null] :: ~ @@ -6188,7 +6290,7 @@ [%per [%limb %v] p.i.p.gen] :: =>(v {p.i.p.gen}) [%name %b res] :: b={res} ^- twig :: - :- %loop :: |- + :+ %loop ~ :: |- :^ %ifat :: ?@ [%a ~] :: a [%limb %b] :: b @@ -6211,20 +6313,29 @@ {$bush *} ~(clam al boil) {$pick *} ~(clam al boil) {$coat *} ~(clam al boil) + {$halo *} ~(clam al boil) :: - {$door *} [%pin [%bunt p.gen] [%core q.gen]] - {$gasp *} [%pin [%burn p.gen] [%trap q.gen]] + {$door *} [%pin [%bunt q.gen] [%core r.gen]] + {$gasp *} [%pin [%burn q.gen] [%trap p.gen r.gen]] {$trap *} :- %core - (~(put by *(map term (pair wain foot))) %$ ~ [%ash p.gen]) - {$cork *} [%per [%core (~(put by q.gen) %$ ~ [%ash p.gen])] [%limb %$]] - {$loop *} [%rap [%limb %$] [%trap p.gen]] - {$port *} [%iron [%gate p.gen q.gen]] - {$gill *} :+ %pin [%bunt p.gen] - :- %core - (~(put by *(map term (pair wain foot))) %$ ~ [%elm q.gen]) - {$gate *} :+ %door p.gen + =- [[0 ~ -] ~ ~] (~(put by *(map term (pair wain foot))) %$ ~ [%ash q.gen]) - {$tray *} [%lead %trap p.gen] + {$cork *} :+ %per + :- %core + =+ one=(~(got by r.gen) 0) + %+ ~(put by r.gen) 0 + one(q (~(put by q.one) %$ [~ [%ash q.gen]])) + [%limb %$] + {$loop *} [%rap [%limb %$] [%trap p.gen q.gen]] + {$port *} [%iron [%gate p.gen q.gen r.gen]] + {$gill *} :+ %pin [%bunt q.gen] + :- %core + =- [[0 ~ -] ~ ~] + (~(put by *(map term (pair wain foot))) %$ ~ [%elm r.gen]) + {$gate *} :^ %door p.gen q.gen + =- [[0 ~ -] ~ ~] + (~(put by *(map term (pair wain foot))) %$ ~ [%ash r.gen]) + {$tray *} [%lead %trap p.gen q.gen] :: {$conq *} [p.gen q.gen r.gen s.gen] {$cont *} [p.gen q.gen r.gen] @@ -6280,10 +6391,10 @@ :- %mean =+ fek=~(feck ap p.gen) ?^ fek [%rock %tas u.fek] - [%trap [%call [%limb %cain] [%wrap [%per [%$ 3] p.gen]] ~]] + [%trap ~ [%call [%limb %cain] [%wrap [%per [%$ 3] p.gen]] ~]] q.gen :: - {$lurk *} [%hint [%mean [%trap p.gen]] q.gen] + {$lurk *} [%hint [%mean [%trap ~ p.gen]] q.gen] {$fast *} :+ %thin :- %fast @@ -6348,7 +6459,7 @@ :+ %rap :: [%wing [%| 0 ~] [%& 6] ~] :: [%limb %b] :: - :- %trap :: |. + :+ %trap ~ :: |. :^ %calt :: %+ [%per [%limb %v] p.gen] :: =>(v {p.gen}) [%call [%limb %b] [%limb %c] ~] :: (b c) @@ -6376,9 +6487,9 @@ [%per [%keep [[%& 1] ~] p.gen] q.gen] :: {$var *} - ?@ p.gen - [%pin [%name p.gen q.gen] r.gen] - [%pin [%cast [%coat p.gen] q.gen] r.gen] + ?~ q.p.gen + [%pin [%name p.p.gen q.gen] r.gen] + [%pin [%cast [%coat p.p.gen u.q.p.gen] q.gen] r.gen] :: {$rev *} [%var p.gen r.gen q.gen] {$set *} @@ -6390,16 +6501,16 @@ =+ wuy=(weld q.gen `wing`[%v ~]) :: :+ %per [%name %v %$ 1] :: => v=. :+ %pin [%name %a %per [%limb %v] r.gen] :: =+ a==>(v \r.gen) - :^ %set wuy [%rap [%$ 3] [%limb %a]] :: =. \wuy +.a - :+ %per :- ?@ p.gen :: - :+ %name p.gen :: => :- ^= \p.gen - [%rap [%$ 2] [%limb %a]] :: -.a + :^ %set wuy [%rap [%$ 3] [%limb %a]] + :+ %per :- ?~ q.p.gen + :+ %name p.p.gen + [%rap [%$ 2] [%limb %a]] :+ %cast - :+ %coat -.p.gen - [%per [%limb %v] +.p.gen] :: => :- ^- \p.gen - [%rap [%$ 2] [%limb %a]] :: -.a - [%limb %v] :: v - s.gen :: s.gen + :+ %coat p.p.gen + [%per [%limb %v] u.q.p.gen] + [%rap [%$ 2] [%limb %a]] + [%limb %v] + s.gen :: {$rap *} [%per q.gen p.gen] {$pin *} [%per [p.gen [%$ 1]] q.gen] @@ -6467,6 +6578,14 @@ ?. ?=({@ $~} wig) ~>(%mean.[%leaf "rusk-twig"] !!) i.wig + :: + ++ walk :: forward traverse + |* life/mold + |= $: vit/life + mac/$-({twig life} (unit (pair twig life))) + == + ^- {twig life} + !! -- :: :::: 5c: compiler backend and prettyprinter @@ -6555,7 +6674,7 @@ ~/ %buss |= {cog/term gen/twig} ^- span - [%face [~ [[cog ~ gen] ~ ~] ~] sut] + [%face [~ [[cog ~ ~ gen] ~ ~] ~] sut] :: ++ conk |= got/toga @@ -6563,7 +6682,7 @@ ?@ got [%face [~ got] sut] ?- -.got $0 sut - $1 [%face [~ p.got] $(got q.got)] + $1 [%face p.got $(got q.got)] $2 ?> |(!vet (nest(sut [%cell %noun %noun]) & sut)) :+ %cell $(got p.got, sut (peek %both 2)) @@ -6937,38 +7056,41 @@ ++ pony :: raw match $@ $~ :: void %+ each :: natural/abnormal - palo :: arm or leg + (pair wain palo) :: arm or leg %+ each :: abnormal @ud :: unmatched - (pair span nock) :: synthetic + (pair wain (pair span nock)) :: synthetic -- ^- pony ?~ hyp - [%& ~ %& sut] + [%& ~ ~ %& sut] =+ mor=$(hyp t.hyp) ?- -.mor $| ?- -.p.mor $& mor $| - =+ fex=(mint(sut p.p.p.mor) %noun [%wing i.hyp ~]) - [%| %| p.fex (comb q.p.p.mor q.fex)] + =+ fex=(mint(sut p.q.p.p.mor) %noun [%wing i.hyp ~]) + [%| %| p.p.p.mor p.fex (comb q.q.p.p.mor q.fex)] == :: $& - =. sut (felt q.p.mor) + =. sut (felt q.q.p.mor) => :_ + :* axe=`axis`1 - lon=p.p.mor + lon=p.q.p.mor heg=?^(i.hyp i.hyp [%| p=0 q=(some i.hyp)]) == ?: ?=($& -.heg) - [%& [`p.heg lon] %& (peek way p.heg)] + [%& ~ [`p.heg lon] %& (peek way p.heg)] =| gil/(set span) =< $ |% ++ here ?: =(0 p.heg) - [%& [~ `axe lon] %& sut] + [%& ~ [~ `axe lon] %& sut] [%| %& (dec p.heg)] + ++ join |= {a/wain b/wain} + ?: =(a b) a + :(weld a `wain`['||' b]) ++ lose [%| %& p.heg] ++ stop ?~(q.heg here lose) ++ twin |= {hax/pony yor/pony} @@ -6981,18 +7103,23 @@ ?> ?& ?=($| -.yor) ?=($| -.p.hax) ?=($| -.p.yor) - =(q.p.p.hax q.p.p.yor) + =(q.q.p.p.hax q.q.p.p.yor) == - [%| %| (fork p.p.p.hax p.p.p.yor ~) q.p.p.hax] + :^ %| + %| + (join p.p.p.hax p.p.p.yor) + [(fork p.q.p.p.hax p.q.p.p.yor ~) q.q.p.p.hax] ?> ?=($& -.yor) - ?> =(p.p.hax p.p.yor) - :+ %& p.p.hax - ?: &(?=($& -.q.p.hax) ?=($& -.q.p.yor)) - [%& (fork p.q.p.hax p.q.p.yor ~)] - ?> &(?=($| -.q.p.hax) ?=($| -.q.p.yor)) ?> =(p.q.p.hax p.q.p.yor) - =+ wal=(~(uni in q.q.p.hax) q.q.p.yor) - [%| p.q.p.hax wal] + :^ %& + (join p.p.hax p.p.yor) + p.q.p.hax + ?: &(?=($& -.q.q.p.hax) ?=($& -.q.q.p.yor)) + [%& (fork p.q.q.p.hax p.q.q.p.yor ~)] + ?> &(?=($| -.q.q.p.hax) ?=($| -.q.q.p.yor)) + ?> =(p.q.q.p.hax p.q.q.p.yor) + =+ wal=(~(uni in q.q.q.p.hax) q.q.q.p.yor) + [%| p.q.q.p.hax wal] ++ $ ^- pony ?- sut @@ -7010,12 +7137,14 @@ {$core *} ?~ q.heg here =^ zem p.heg - =+ zem=(look u.q.heg q.r.q.sut) + =+ zem=(loot u.q.heg q.r.q.sut) ?~ zem [~ p.heg] ?:(=(0 p.heg) [zem 0] [~ (dec p.heg)]) ?^ zem - :+ %& [`axe lon] - [%| (peg 2 p.u.zem) [[sut(p.q %gold) q.u.zem] ~ ~]] + :^ %& + p.q.u.zem + [`axe lon] + [%| (peg 2 p.u.zem) [[sut(p.q %gold) q.q.u.zem] ~ ~]] =+ pec=(peel way p.q.sut) ?. sam.pec lose ?: con.pec $(sut p.sut, axe (peg axe 3)) @@ -7036,14 +7165,14 @@ =+ tyr=(~(get by p.zot) u.q.heg) ?~ tyr next - ?~ u.tyr + ?~ q.u.tyr $(sut q.sut, lon [~ lon], p.heg +(p.heg)) ?. =(0 p.heg) next(p.heg (dec p.heg)) - =+ tor=(fund way u.u.tyr) + =+ tor=(fund way u.q.u.tyr) ?- -.tor - $& [%& (weld p.p.tor `vein`[~ `axe lon]) q.p.tor] - $| [%| %| p.p.tor (comb [%0 axe] q.p.tor)] + $& [%& ~ (weld p.p.tor `vein`[~ `axe lon]) q.p.tor] + $| [%| %| p.u.tyr p.p.tor (comb [%0 axe] q.p.tor)] == ++ next |- ^- pony @@ -7054,8 +7183,12 @@ ?~ fid ~ ?: ?=({$| $& *} fid) $(q.zot t.q.zot, p.heg p.p.fid) - =+ vat=(fine `port`?-(-.fid $& fid, $| [%| p.p.fid])) - [%| %| p.vat (comb (comb [%0 axe] q.tiv) q.vat)] + =+ ^- {wan/wain vat/(pair span nock)} + ?- -.fid + $& [p.p.fid (fine %& q.p.fid)] + $| [p.p.p.fid (fine %| q.p.p.fid)] + == + [%| %| wan p.vat (comb (comb [%0 axe] q.tiv) q.vat)] -- :: {$fork *} @@ -7077,14 +7210,12 @@ ~/ %find |= {way/vial hyp/wing} ^- port - ~_ (dunk %find-bug) - ~| hype+hyp ~_ (show [%c %find] %l hyp) =- ?@ - !! ?- -< - $& [%& p.-] + $& [%& q.p.-] $| ?- -.p.- - $| [%| p.p.-] + $| [%| q.p.p.-] $& !! == == (fond way hyp) @@ -7221,10 +7352,23 @@ $elm q:(mint(vet |) %noun p.q.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)] + == + :: + ++ hope + |= dom/(map @ tomb) + ^- ?($~ ^) + ?: ?=($~ dom) + ~ + =+ dov=(harp q.q.n.dom) + ?- dom + {* $~ $~} dov + {* $~ *} [dov $(dom r.dom)] + {* * $~} [dov $(dom l.dom)] + {* * *} [dov $(dom l.dom) $(dom r.dom)] == :: ++ lose @@ -7262,6 +7406,7 @@ [(nice (cell p.hed p.tal)) (cons q.hed q.tal)] :: {$core *} (grow %gold [%$ 1] p.gen) + {$corp *} (grow %gold [%$ 1] q.gen) :: {$make *} (~(mint et p.gen q.gen) gol) {$wish *} @@ -7296,7 +7441,7 @@ ?:(?=($0 -.moc) [%1 p.moc] q.nef) :: {$name *} =+(vat=$(gen q.gen) [(conk(sut p.vat) p.gen) q.vat]) - {$tune *} [(face [~ p.gen] sut) [%0 %1]] + {$tune *} [(face p.gen sut) [%0 %1]] {$lead *} =+(vat=$(gen p.gen) [(wrap(sut p.vat) %lead) q.vat]) :: {$help *} @@ -7396,12 +7541,12 @@ typ :: ++ grow - |= {mel/vair ruf/twig dab/(map term (pair wain foot))} + |= {mel/vair ruf/twig dom/(map @ tomb)} ^- {p/span q/nock} =+ dan=^$(gen ruf, gol %noun) - =+ toc=(core p.dan [%gold p.dan [~ dab]]) - =+ dez=(harp(sut toc) dab) - :- (nice (core p.dan mel p.dan [dez dab])) + =+ toc=(core p.dan [%gold p.dan [~ dom]]) + =+ dez=(hope(sut toc) dom) + :- (nice (core p.dan mel p.dan [dez dom])) (cons [%1 dez] q.dan) -- :: @@ -7434,6 +7579,7 @@ [(nice (cell p.hed p.tal)) (cell q.hed q.tal)] :: {$core *} (grow %gold [%$ 1] p.gen) + {$corp *} (grow %gold [%$ 1] q.gen) {$make *} (~(mull et p.gen q.gen) gol dox) {$wish *} =+($(gen q.gen, gol %noun) $(gen [%bunt p.gen])) {$bump *} =+($(gen p.gen, gol [%atom %$ ~]) (beth [%atom %$ ~])) @@ -7462,7 +7608,7 @@ =+(vat=$(gen q.gen) [(conk(sut p.vat) p.gen) (conk(sut q.vat) p.gen)]) :: {$tune *} - [(face [~ p.gen] sut) (face [~ p.gen] dox)] + [(face p.gen sut) (face p.gen dox)] :: {$lead *} =+(vat=$(gen p.gen) [(wrap(sut p.vat) %lead) (wrap(sut q.vat) %lead)]) @@ -7557,31 +7703,44 @@ typ :: ++ grow - |= {mel/vair ruf/twig dab/(map term (pair wain foot))} + |= {mel/vair ruf/twig dom/(map @ tomb)} ~_ leaf+"mull-grow" ^- {p/span q/span} =+ dan=^$(gen ruf, gol %noun) - =+ ^= toc :- p=(core p.dan [%gold p.dan [~ dab]]) - q=(core q.dan [%gold q.dan [~ dab]]) - =+ (bake(sut p.toc, dox q.toc) dab) - :- (nice (core p.dan mel p.dan [[%0 0] dab])) - (core q.dan [mel q.dan [[%0 0] dab]]) + =+ ^= toc :- p=(core p.dan [%gold p.dan [~ dom]]) + q=(core q.dan [%gold q.dan [~ dom]]) + =+ (balk(sut p.toc, dox q.toc) dom) + :- (nice (core p.dan mel p.dan [[%0 0] dom])) + (core q.dan [mel q.dan [[%0 0] dom]]) :: ++ bake |= dab/(map term (pair wain foot)) ^- * ?: ?=($~ dab) ~ - =+ ^= vad + =+ ^= dov ?- -.q.q.n.dab $ash ^$(gol %noun, gen p.q.q.n.dab) $elm ~ == ?- dab - {* $~ $~} vad - {* $~ *} [vad $(dab r.dab)] - {* * $~} [vad $(dab l.dab)] - {* * *} [vad $(dab l.dab) $(dab r.dab)] + {* $~ $~} dov + {* $~ *} [dov $(dab r.dab)] + {* * $~} [dov $(dab l.dab)] + {* * *} [dov $(dab l.dab) $(dab r.dab)] + == + :: + ++ balk + |= dom/(map @ tomb) + ^- * + ?: ?=($~ dom) + ~ + =+ dov=(bake q.q.n.dom) + ?- dom + {* $~ $~} dov + {* $~ *} [dov $(dom r.dom)] + {* * $~} [dov $(dom l.dom)] + {* * *} [dov $(dom l.dom) $(dom r.dom)] == -- :: @@ -7606,22 +7765,30 @@ dext(sut (peek vay 2), ref (peek(sut ref) vay 2)) :: ++ deep - |= $: dab/(map term (pair wain foot)) - hem/(map term (pair wain foot)) + |= $: dom/(map @ tomb) + vim/(map @ tomb) == ^- ? - ?: ?=($~ dab) =(hem ~) - ?: ?=($~ hem) | - ?& =(p.n.dab p.n.hem) - $(dab l.dab, hem l.hem) - $(dab r.dab, hem r.hem) - ?- -.q.q.n.dab - $elm =(q.q.n.dab q.q.n.hem) - $ash ?& ?=($ash -.q.q.n.hem) - %= dext - sut (play p.q.q.n.dab) - ref (play(sut ref) p.q.q.n.hem) - == == == == + ?: ?=($~ dom) =(vim ~) + ?: ?=($~ vim) | + ?& =(p.n.dom p.n.vim) + $(dom l.dom, vim l.vim) + $(dom r.dom, vim r.vim) + :: + =+ [dab hem]=[q.q.n.dom q.q.n.vim] + |- ^- ? + ?: ?=($~ dab) =(hem ~) + ?: ?=($~ hem) | + ?& =(p.n.dab p.n.hem) + $(dab l.dab, hem l.hem) + $(dab r.dab, hem r.hem) + ?- -.q.q.n.dab + $elm =(q.q.n.dab q.q.n.hem) + $ash ?& ?=($ash -.q.q.n.hem) + %= dext + sut (play p.q.q.n.dab) + ref (play(sut ref) p.q.q.n.hem) + == == == == == :: ++ dext ^- ? @@ -7742,6 +7909,7 @@ ?- gen {^ *} (cell $(gen p.gen) $(gen q.gen)) {$core *} (core sut %gold sut [[%0 0] p.gen]) + {$corp *} (core sut %gold sut [[%0 0] q.gen]) {$make *} ~(play et p.gen q.gen) {$wish *} $(gen [%bunt p.gen]) {$bump *} [%atom %$ ~] @@ -7753,7 +7921,7 @@ ?: =(%n p.gen) ?>(=(0 q.gen) [%atom p.gen ~ q.gen]) ?:(=(%f p.gen) ?>((lte q.gen 1) bool) [%atom p.gen ~]) [%cell $(q.gen -.q.gen) $(q.gen +.q.gen)] - {$tune *} (face [~ p.gen] sut) + {$tune *} (face p.gen sut) {$nock *} %noun {$same *} bool {$deep *} bool @@ -8388,8 +8556,14 @@ |= {cog/@tas typ/span} ^- ? ?+ typ | - {$hold *} $(typ ~(repo ut typ)) - {$core *} (~(has by q.r.q.typ) cog) + {$hold *} $(typ ~(repo ut typ)) + {$core *} + |- ^- ? + ?~ q.r.q.typ | + ?| (~(has by q.q.n.q.r.q.typ) cog) + $(q.r.q.typ l.q.r.q.typ) + $(q.r.q.typ r.q.r.q.typ) + == == :: ++ sloe :: get arms in core @@ -8431,8 +8605,8 @@ |= {bug/? wer/path} %*(. vast bug bug, wer wer) :: -++ vast !. - =+ [bug=`?`| was=*(set path) wer=*path] +++ vast + =+ [bug=`?`| wer=*path] |% ++ dqut :: irregular docstring =+ dsoz=;~(plug soq soq soq col) @@ -8473,6 +8647,8 @@ ++ mota %+ cook |=({a/tape b/tape} (rap 3 (weld a b))) ;~(plug (star low) (star hig)) + ++ epic :: to end of line + (cook crip (ifix [;~(plug ace ace) (just `@`10)] (star prn))) :: ++ plex |= gen/twig ^- (unit path) @@ -8808,6 +8984,8 @@ :+ %lace `twig`[p.i.lut [%conp $(lut t.lut)]] :+ %new [%base %cell] :- %core + ^- (map @ tomb) + =- [[0 ~ -] ~ ~] ^- (map term (pair wain foot)) :_ [~ ~] =+ sug=[[%& 12] ~] @@ -8871,10 +9049,7 @@ (stag %sand (stag %f (cold & pam))) == :- '\'' - ;~ pose - (stag %help ;~(plug dqut ;~(pfix gap tall))) - (stag %sand (stag %t qut)) - == + (stag %sand (stag %t qut)) :- '(' (stag %call (ifix [pel per] (most ace wide))) :- '{' @@ -9025,17 +9200,16 @@ ;~ pfix bar %- stew ^. stet ^. limo - :~ ['_' (rune cab %door expr)] + :~ ['_' (runo cab %door ~ expr)] ['%' (rune cen %core expe)] - [':' (rune col %gasp expb)] - ['.' (rune dot %trap expa)] - ['/' (rune fas %door expr)] - ['-' (rune hep %loop expa)] - ['^' (rune ket %cork expx)] - ['~' (rune sig %port expb)] - ['*' (rune tar %gill expb)] - ['=' (rune tis %gate expb)] - ['?' (rune wut %tray expa)] + [':' (runo col %gasp ~ expb)] + ['.' (runo dot %trap ~ expa)] + ['-' (runo hep %loop ~ expa)] + ['^' (runo ket %cork ~ expx)] + ['~' (runo sig %port ~ expb)] + ['*' (runo tar %gill ~ expb)] + ['=' (runo tis %gate ~ expb)] + ['?' (runo wut %tray ~ expa)] == == :- '$' @@ -9079,17 +9253,16 @@ ['*' (rune tar %conp exps)] == :: - (word %door expr) + (worn %door ~ expr) (word %core expe) - (word %gasp expb) - (word %trap expa) - (word %door expr) - (word %loop expa) - (word %cork expx) - (word %port expb) - (word %gill expb) - (word %gate expb) - (word %tray expa) + (worn %gasp ~ expb) + (worn %trap ~ expa) + (worn %loop ~ expa) + (worn %cork ~ expx) + (worn %port ~ expb) + (worn %gill ~ expb) + (worn %gate ~ expb) + (worn %tray ~ expa) :: (word %bunt expa) (word %claw expb) @@ -9211,7 +9384,6 @@ ['~' (rune sig %burn expa)] ['=' (rune tis %name expg)] ['?' (rune wut %lead expa)] - [':' (rune col %help expx)] == == :- '~' @@ -9323,8 +9495,8 @@ %+ sear |= a/(list (pair term (pair wain foot))) =| b/(map term (pair wain foot)) - |- ^- (unit _b) - ?~ a `b + |- ^- (unit (map @ tomb)) + ?~ a `[[0 ~ b] ~ ~] ?: (~(has by b) p.i.a) ~&(duplicate-arm+p.i.a ~) $(a t.a, b (~(put by b) p.i.a q.i.a)) @@ -9339,10 +9511,18 @@ |* {dif/rule tuq/* har/_expa} ;~(pfix dif (stag tuq (toad har))) :: + ++ runo :: rune plus + |* {dif/rule hil/* tuq/* har/_expa} + ;~(pfix dif (stag hil (stag tuq (toad har)))) + :: ++ word :: build keyword |* {key/cord har/_expa} ;~(pfix (jest key) (stag key (toad har))) :: + ++ worn :: padded keyword + |* {key/cord tuq/* har/_expa} + ;~(pfix (jest key) (stag key (stag tuq (toad har)))) + :: ++ moar :: :moar hack %+ cook |= {a/(list) b/(list (pair wing twig))} @@ -9570,11 +9750,33 @@ == == :: - ++ wise %+ cook - |=({a/term b/(unit twig)} ?~(b a [a u.b])) - ;~(plug sym (punt ;~(pfix fas wide))) + ++ wise ;~(plug sym (punt ;~(pfix fas wide))) + ++ wack + %+ cook + |= {a/wain b/twig c/(unit cord)} + ^- twig + =. a ?~(c a [u.c a]) + ?~ a b + [%help a b] + ;~ plug + (star (ifix [;~(plug col gar) (punt gap)] epic)) + ;~(pose (norm &) long lute ape:(sail &)) + :: + :: XX performance: this makes the parser about 50% slower. + :: because we double-parse most of the spaces in the file. + :: just so we can do a postfix doc-comment. + :: + :: the correct solution to this problem is to unify the + :: parsing of docs with the parsing of comments/spaces. + :: but at this point we're pretty much in parser rewrite. + :: + :: it should go without saying that ++vast needs a rewrite. + :: it dates to 2011. + :: + (punt ;~(pfix ;~(plug (star ace) col gal) epic)) + == ++ tall %+ knee *twig :: full tall form - |.(~+((wart ;~(pose (norm &) long lute ape:(sail &))))) + |.(~+((wart wack))) ++ wide %+ knee *twig :: full wide form |.(~+((wart ;~(pose (norm |) long ape:(sail |))))) ++ wart diff --git a/sys/vane/ford.hoon b/sys/vane/ford.hoon index 7923717cd..1c120c0d5 100644 --- a/sys/vane/ford.hoon +++ b/sys/vane/ford.hoon @@ -1448,8 +1448,16 @@ ++ able :: assemble preamble ^- twig :+ %per - ?:(=(~ rop) [%$ 1] [%core (~(run by rop) |=({^ a/twig} [~ %ash a]))]) - ?:(=(~ bil) [%$ 1] [%core (~(run by bil) |=({^ a/twig} [~ %ash a]))]) + ?: =(~ rop) + [%$ 1] + :- %core + =- [[0 ~ -] ~ ~] + (~(run by rop) |=({^ a/twig} [~ %ash a])) + ?: =(~ bil) + [%$ 1] + :- %core + =- [[0 ~ -] ~ ~] + (~(run by bil) |=({^ a/twig} [~ %ash a])) :: ++ abut :: generate |= {cof/cafe hyd/hood} @@ -1761,7 +1769,7 @@ |= {cof/cafe mav/(map term (pair wain foot)) sel/_..wilt} ?~ mav (flaw cof [%leaf "source missing: {<(en-beam p.hop)>}"]~) - (fine cof sel(boy [[%core mav] boy])) + (fine cof sel(boy [[%core [[0 ~ mav] ~ ~]] boy])) == -- :: From ae8df45f125e5d984a6dedf30bfb01233de089a6 Mon Sep 17 00:00:00 2001 From: "C. Guy Yarvin" Date: Fri, 31 Mar 2017 13:42:51 -0700 Subject: [PATCH 04/14] Fully booting with new chapter structures. --- app/ask.hoon | 4 +- app/dojo.hoon | 8 +- app/gmail.hoon | 2 +- app/hood.hoon | 2 +- app/talk.hoon | 18 +- gen/bug.hoon | 29 +-- gen/walk.hoon | 72 ++++-- lib/drum.hoon | 2 +- lib/womb.hoon | 6 +- sur/twitter.hoon | 3 +- sys/hoon.hoon | 588 ++++++++++++++++++++++++++++----------------- sys/vane/ford.hoon | 20 +- sys/zuse.hoon | 13 +- 13 files changed, 464 insertions(+), 303 deletions(-) diff --git a/app/ask.hoon b/app/ask.hoon index 8da13af72..633b959a8 100644 --- a/app/ask.hoon +++ b/app/ask.hoon @@ -29,7 +29,7 @@ :: ++ peer-sole |= path - ^- (quip {bone card} +>) + ^- (quip {bone card} _+>) ~| [%not-in-whitelist src.bow] ?> |((~(has in admins) src.bow) =(our.bow src.bow)) :_ +>.$(sos (~(put by sos) ost.bow *sole-share)) @@ -69,7 +69,7 @@ :: ++ poke-ask-mail |= ask/@t - ^- (quip {bone card} +>) + ^- (quip {bone card} _+>) ~| have-mail+ask ?< (~(has by adr) ask) =. adr (~(put by adr) ask now.bow %new) :: XX electroplating diff --git a/app/dojo.hoon b/app/dojo.hoon index ba35bf598..c8dfa5861 100644 --- a/app/dojo.hoon +++ b/app/dojo.hoon @@ -543,7 +543,7 @@ |- ^- $? $% {$atom @tas (unit @)} {$cell _$ _$} {$cube * _$} - {$face {wain $@(term tune)} _$} + {$face {what $@(term tune)} _$} {$fork (set _$)} {$hold _$ twig} == @@ -1010,7 +1010,7 @@ :+ %as `mark`(cat 3 api.sink.com '-poke') :- 1 :+ %do - :^ %gill ~ [%base %noun] + :^ %gill [~ ~] [%base %noun] :^ %cont [%rock %tas %post] [%rock %$ endpoint.sink.com] [%make ~[[%.y 6]] ~] @@ -1120,7 +1120,7 @@ =- [wrap=- +] |* he-arm/_he-span |= _+<.he-arm - ^- (quip move ..he) + ^- (quip move _..he) he-abet:(he-arm +<) :: ++ peer-sole @@ -1154,7 +1154,7 @@ ++ unto (wrap he-unto):arm ++ pull |= {pax/path} - ^- (quip move +>) + ^- (quip move _+>) =^ moz +> ~(he-abut he ~ (~(got by hoc) ost.hid)) [moz +>.$(hoc (~(del by hoc) ost.hid))] -- diff --git a/app/gmail.hoon b/app/gmail.hoon index c74bd924f..e41bb0200 100644 --- a/app/gmail.hoon +++ b/app/gmail.hoon @@ -81,7 +81,7 @@ == :: ++ poke-email - |= {adr/@ta tyl/tape mez/wall} ^- (quip move +>) + |= {adr/@ta tyl/tape mez/wall} ^- (quip move _+>) ?> =(our.hid src.hid) %- poke-gmail-req :* %post diff --git a/app/hood.hoon b/app/hood.hoon index ba7005723..8ff4a8043 100644 --- a/app/hood.hoon +++ b/app/hood.hoon @@ -65,7 +65,7 @@ :::: :: :: :: :: :: ++ prep - |= old/(unit hood-old) ^- (quip _!! +>) :: + |= old/(unit hood-old) ^- (quip _!! _+>) :: :- ~ ?~ old +> +>(lac (~(run by lac.u.old) hood-port)) diff --git a/app/talk.hoon b/app/talk.hoon index c0b801e98..34c3de7ae 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -2268,7 +2268,7 @@ :: ++ diff-talk-report :: |= {way/wire rad/report} - ^- (quip move +>) + ^- (quip move _+>) =^ mos +>.$ %+ etch-friend way |= {man/knot cuz/station} ra-abet:(ra-diff-talk-report:ra man cuz rad) @@ -2305,7 +2305,7 @@ :: ++ reap-friend :: |= {way/wire saw/(unit tang)} - ^- (quip move +>) + ^- (quip move _+>) ?~ saw [~ +>] %+ etch-friend [%friend way] |= {man/knot cuz/station} =. u.saw [>%reap-friend-fail man cuz< u.saw] @@ -2325,7 +2325,7 @@ [moz +>.$(shells (~(del by shells) ost.hid))] :: ++ log-all-to-file - ^- (quip move .) + ^- (quip move _.) ?: & [~ .] :: XXX!!!! :_ %_ . log %- ~(urn by log) @@ -2349,16 +2349,16 @@ [ost.hid %info /jamfile our.hid (foal paf [%talk-telegrams !>(-)])] :: ++ poke-talk-comment - |= {pax/path sup/path txt/@t} ^- (quip move +>) + |= {pax/path sup/path txt/@t} ^- (quip move _+>) ra-abet:(ra-comment:ra pax sup txt) :: ++ poke-talk-fora-post - |= {pax/path sup/path hed/@t txt/@t} ^- (quip move +>) + |= {pax/path sup/path hed/@t txt/@t} ^- (quip move _+>) ra-abet:(ra-fora-post:ra pax sup hed txt) :: ++ poke-talk-save |= man/knot - ^- (quip move +>) + ^- (quip move _+>) =+ paf=/(scot %p our.hid)/home/(scot %da now.hid)/talk/[man]/talk-telegrams =+ grams:(~(got by stories) man) [[ost.hid %info /jamfile our.hid (foal paf [%talk-telegrams !>(-)])]~ +>.$] @@ -2376,19 +2376,19 @@ ++ poke-talk-log |= man/knot ~& %poke-log - ^- (quip move +>) + ^- (quip move _+>) :- [(log-to-file man) ~] +>.$(log (~(put by log) man count:(~(got by stories) man))) :: ++ poke-talk-unlog |= man/knot - ^- (quip move +>) + ^- (quip move _+>) :- ~ +>.$(log (~(del by log) man)) :: ++ prep |= old/(unit house-any) - ^- (quip move ..prep) + ^- (quip move _..prep) ?~ old ra-abet:ra-init:ra |- diff --git a/gen/bug.hoon b/gen/bug.hoon index fd3c06920..efd4b3c1f 100644 --- a/gen/bug.hoon +++ b/gen/bug.hoon @@ -1,29 +1,8 @@ :: -:::: /hoon/hello/gen - :: -/? 310 -:: :::: :: :- %say -|= {^ {{txt/@tas $~} $~}} -~& %foobar -=+ bar=32 -=> |% - ++ funq - ^? - |% - ++ add |=({a/@ b/@} (sub a b)) - ++ mook txt - -- - -- -=, funq -~& %one -=+ foo=mook -~& [%foo (^add 2 2)] -=< $ -|% -++ $ - :- %noun - (crip (weld "hello, " (trip mook))) --- +|= $: {now/@da * bec/beak} + * + == +!! diff --git a/gen/walk.hoon b/gen/walk.hoon index 0b5195569..70ade92ee 100644 --- a/gen/walk.hoon +++ b/gen/walk.hoon @@ -1,18 +1,42 @@ -:: "Hello world" sample generator -:: -:::: /hoon/hello/gen - :: -/? 310 :: :::: :: :- %say -|= * -=< [%noun %walk] +|= $: {now/@da * bec/beak} + * + == +=< ~& %walk-testing + :- %noun + =+ sys=`path`/(scot %p p.bec)/[q.bec]/(scot %da now)/sys + =+ compiler-source=.^(@t %cx (welp sys /hoon/hoon)) + ~& %test-parsing + =+ compiler-twig=(ream compiler-source) + ~& %test-walking + ~(test ap compiler-twig) +=< |% + ++ come :: parsed docline + $% {$blank $~} + {$var p/term q/ + ++ post :: print state + + -- |% :: ++ ap :: twig engine |_ gen/twig + :: + ++ test :: test ++walk + ^- ? + =- ~| [gen+gen neg+neg ~] + ?> =(gen neg) + & + ^= neg + ^- twig + =< - + %+ (walk $~) + ~ + |= {gen/twig vit/$~ aid/$-({? twig $~} {twig $~})} + ~ ++ dock :: apply document |= doc/cord |^ ^- (unit twig) @@ -91,7 +115,6 @@ |% ++ apex |- ^- {twig life} - =- [~=(gen -<) ~=(vit +>)] =* aid |= {use/? gen/twig vit/life} ^$(use use, gen gen, vit vit) =/ gun ?:(use (mac gen vit aid) ~) @@ -123,16 +146,18 @@ $bush (lead -.gen %.(+.gen dubs)) $pick (lead -.gen %.(+.gen moar)) $coat (lead -.gen %.(+.gen nexp)) - $door (lead -.gen %.(+.gen (twin expr arms))) - $gasp (lead -.gen %.(+.gen dubs)) - $core (lead -.gen %.(+.gen arms)) - $trap (lead -.gen %.(+.gen expr)) - $cork (lead -.gen %.(+.gen (twin expr arms))) - $loop (lead -.gen %.(+.gen expr)) - $port (lead -.gen %.(+.gen dubs)) - $gill (lead -.gen %.(+.gen dubs)) - $gate (lead -.gen %.(+.gen dubs)) - $tray (lead -.gen %.(+.gen expr)) + $grow (lead -.gen %.(+.gen expr)) + $door (lead -.gen %.(+.gen (trio noop expr arms))) + $door (lead -.gen %.(+.gen (trio noop expr arms))) + $gasp (lead -.gen %.(+.gen (twin noop dubs))) + $corp (lead -.gen %.(+.gen (twin noop arms))) + $trap (lead -.gen %.(+.gen (twin noop expr))) + $cork (lead -.gen %.(+.gen (trio noop expr arms))) + $loop (lead -.gen %.(+.gen (twin noop expr))) + $port (lead -.gen %.(+.gen (twin noop dubs))) + $gill (lead -.gen %.(+.gen (twin noop dubs))) + $gate (lead -.gen %.(+.gen (twin noop dubs))) + $tray (lead -.gen %.(+.gen (twin noop expr))) $scon (lead -.gen %.(+.gen dubs)) $conq (lead -.gen %.(+.gen (quad expr expr expr expr))) $cons (lead -.gen %.(+.gen dubs)) @@ -181,14 +206,14 @@ $fry (lead -.gen %.(+.gen dubs)) $new (lead -.gen %.(+.gen dubs)) $fix (lead -.gen %.(+.gen (twin moan expr))) - $var (lead -.gen %.(+.gen (trio toad expr expr))) - $rev (lead -.gen %.(+.gen (trio toad expr expr))) + $var (lead -.gen %.(+.gen (trio tora expr expr))) + $rev (lead -.gen %.(+.gen (trio tora expr expr))) $set (lead -.gen %.(+.gen trip)) $huh (lead -.gen %.(+.gen (quad noop expr expr expr))) $rap (lead -.gen %.(+.gen dubs)) $nip (lead -.gen %.(+.gen dubs)) $per (lead -.gen %.(+.gen dubs)) - $sip (lead -.gen %.(+.gen (quad toad noop expr expr))) + $sip (lead -.gen %.(+.gen (quad tora noop expr expr))) $pin (lead -.gen %.(+.gen dubs)) $tow (lead -.gen %.(+.gen moar)) $aka (lead -.gen %.(+.gen trip)) @@ -305,10 +330,13 @@ ?@ bud [bud vit] (lead p.bud (expr q.bud)) :: + ++ tora + (twin noop twee) + :: ++ tung |= bud/{p/wain q/$@(term tune)} ?@ q.bud [bud vit] - (lead p.bud %.(q.bud (twin (raid twee) (moto expr)))) + (lead p.bud %.(q.bud (twin (raid (twin noop twee)) (moto expr)))) :: ++ twee |= bud/(unit twig) diff --git a/lib/drum.hoon b/lib/drum.hoon index 9a449748e..b1698da27 100644 --- a/lib/drum.hoon +++ b/lib/drum.hoon @@ -220,7 +220,7 @@ :::: :: :: :: :: :: ++ se-abet :: resolve - ^- (quip move *drum-part) + ^- (quip move drum-part) =* pith +>+>+<+ ?. se-ably =. . se-adit diff --git a/lib/womb.hoon b/lib/womb.hoon index 65e6bcb5f..ddea0dd06 100644 --- a/lib/womb.hoon +++ b/lib/womb.hoon @@ -161,7 +161,7 @@ :: ++ murn-by |* {a/(map) b/$-(* (unit))} - ^- ?~(a !! (map _p.n.a _(need (b q.n.a)))) + ^+ ?~(a !! *(map _p.n.a _(need (b q.n.a)))) %- malt %+ murn (~(tap by a)) ?~ a $~ @@ -180,11 +180,11 @@ |= {bowl:gall part} :: main womb work |_ moz/(list move) ++ abet :: resolve - ^- (quip move *part) + ^- (quip move part) [(flop moz) +>+<+] :: ++ teba :: install resolved - |= a/(quip move *part) ^+ +> + |= a/(quip move part) ^+ +> +>(moz (flop -.a), +>+<+ +.a) :: ++ emit |=(card %_(+> moz [[ost +<] moz])) :: return card diff --git a/sur/twitter.hoon b/sur/twitter.hoon index 5fe19cc3e..c209cfd5c 100644 --- a/sur/twitter.hoon +++ b/sur/twitter.hoon @@ -74,7 +74,8 @@ (a b) :: ++ doc-data-dry :: staticly typed for endpoint lookup - ^- (list {typ/_{term (list param)} met/?($get $post) pax/path}):param + =, param + ^- (list {typ/_{term (list param)} met/?($get $post) pax/path}) doc-data :: ++ doc-data :: scraped from api docs, used to create types and requests diff --git a/sys/hoon.hoon b/sys/hoon.hoon index 8d64161c1..203e484a2 100644 --- a/sys/hoon.hoon +++ b/sys/hoon.hoon @@ -1,15 +1,15 @@ -:: :: +!: :: :::: /sys/hoon :: :: :: ~> %slog.[0 leaf+"hoon-assembly"] =< ride -=> %145 => +=> %144 => :: :: :::: 0: version stub :: :: :: -~% %k.145 ~ ~ :: +~% %k.144 ~ ~ :: |% -++ a145 %145 +++ a144 %144 ++ hoon + -- => :: :: @@ -21,7 +21,7 @@ :: ~% %one + ~ |% -++ a145 %145 +++ a144 %144 :: :: :::: 1a: unsigned arithmetic :: :: @@ -178,8 +178,7 @@ ++ pole |*(a/mold $@($~ {a (pole a)})) :: faceless list ++ qual |* {a/mold b/mold c/mold d/mold} :: 4-tuple {p/a q/b r/c s/d} :: -++ quid |*({a/mold b/*} {a _b}) :: mixed for sip -++ quip |*({a/mold b/*} {(list a) _b}) :: list-mixed for sip +++ quip |*({a/mold b/mold} {(list a) b}) :: list-with for sip ++ trap |*(a/mold _|?(*a)) :: producer ++ tree |*(a/mold $@($~ {n/a l/(tree a) r/(tree a)})) :: binary tree ++ trel |*({a/mold b/mold c/mold} {p/a q/b r/c}) :: 3-tuple @@ -208,7 +207,7 @@ :: ~% %two + ~ |% -++ a145 %145 +++ a144 %144 :: :: :::: 2a: unit logic :: :: :: @@ -462,7 +461,7 @@ :: ++ sort !. :: quicksort ~/ %sort - |* {a/(list) b/$-([* *] ?)} + |* {a/(list) b/$-({* *} ?)} => .(a ^.(homo a)) |- ^+ a ?~ a ~ @@ -1725,7 +1724,7 @@ :: :: ~% %tri + ~ |% -++ a145 %145 +++ a144 %144 :: :::: 3a: signed and modular ints :: :: :: @@ -3440,7 +3439,7 @@ %show show == |% -++ a145 %145 +++ a144 %144 :: :::: 4a: exotic bases :: @@ -5333,6 +5332,7 @@ {$d p/twig} :: take $-(marl marl) {$e p/twig q/(list tuna)} :: element literal == :: +++ chap (pair (list term) what) :: labeled help ++ chum $? lef/term :: jet name {std/term kel/@} :: kelvin version {ven/term pro/term kel/@} :: vendor and product @@ -5340,7 +5340,8 @@ == :: ++ coil $: p/?($gold $iron $lead $zinc) :: core span q/span :: built with - r/{p/?($~ ^) q/(map @ tomb)} :: arms + r/chap :: docs + s/{p/?($~ ^) q/(map @ tomb)} :: arms == :: ++ foot $% {$ash p/twig} :: dry arm, geometric {$elm p/twig} :: wet arm, generic @@ -5372,20 +5373,20 @@ {$bush p/tile q/tile} :: pair+tag {$deet p/spot q/tile} :: set debug {$fern p/{i/tile t/(list tile)}} :: plain selection - {$herb p/twig} :: gate + {$herb p/twig} :: assembly {$kelp p/{i/line t/(list line)}} :: tag selection {$leaf p/term q/@} :: constant atom - {$plow p/wain q/tile} :: apply help + {$plow p/what q/tile} :: apply help {$reed p/tile q/tile} :: atom+cell {$weed p/twig} :: example == :: ++ toga :: face control $@ p/term :: two togas $% {$0 $~} :: no toga - {$1 p/(pair wain term) q/toga} :: deep toga + {$1 p/(pair what term) q/toga} :: deep toga {$2 p/toga q/toga} :: cell toga == :: -++ tomb (pair wain (map term (pair wain foot))) :: core chapter +++ tomb (pair chap (map term (pair what foot))) :: core chapter ++ tuna :: tagflow $% {$a p/twig} :: plain text {$b p/twig} :: single tag @@ -5404,8 +5405,8 @@ {$bust p/base} :: bunt base {$dbug p/spot q/twig} :: debug info in trace {$hand p/span q/nock} :: premade result - {$help p/wain q/twig} :: annotate image - {$halo p/wain q/root} :: annotate model + {$help p/what q/twig} :: annotate image + {$halo p/what q/root} :: annotate model {$knit p/(list woof)} :: assemble string {$leaf p/(pair term @)} :: symbol {$limb p/term} :: pulls limb p @@ -5413,7 +5414,7 @@ {$rock p/term q/*} :: fixed constant {$sand p/term q/*} :: unfixed constant {$tell p/(list twig)} :: render as tape - {$tune p/(pair wain $@(term tune))} :: minimal face + {$tune p/(pair what $@(term tune))} :: minimal face {$wing p/wing} :: pulls p {$yell p/(list twig)} :: render as tank :: :::::: molds @@ -5423,20 +5424,20 @@ {$book p/(list root)} :: $% tagged fork {$lamb p/root q/root} :: $- function {$bush p/root q/root} :: $^ pairhead fork - {$pick p/(list twig)} :: $? untagged fork + {$pick p/(list root)} :: $? untagged fork {$coat p/toga q/root} :: $= name + {$grow p/twig} :: $; assembly :: :::::: cores - {$door p/wain q/root r/(map @ tomb)} :: |_ - {$gasp p/wain q/root r/twig} :: |: - {$corp p/wain q/(map @ tomb)} :: |% - {$core p/(map @ tomb)} :: |% - {$trap p/wain q/twig} :: |. - {$cork p/wain q/twig r/(map @ tomb)} :: |^ - {$loop p/wain q/twig} :: |- - {$port p/wain q/twig r/twig} :: |~ - {$gill p/wain q/root r/twig} :: |* - {$gate p/wain q/root r/twig} :: |= - {$tray p/wain q/twig} :: |? + {$door p/chap q/root r/(map @ tomb)} :: |_ + {$gasp p/chap q/twig r/twig} :: |: + {$corp p/chap q/(map @ tomb)} :: |% + {$trap p/chap q/twig} :: |. + {$cork p/chap q/twig r/(map @ tomb)} :: |^ + {$loop p/chap q/twig} :: |- + {$port p/chap q/twig r/twig} :: |~ + {$gill p/chap q/root r/twig} :: |* + {$gate p/chap q/root r/twig} :: |= + {$tray p/chap q/twig} :: |? :: :::::: tuples {$scon p/twig q/twig} :: :_ [q p] {$conq p/twig q/twig r/twig s/twig} :: :^ [p q r s] @@ -5503,13 +5504,13 @@ {$use p/twig q/twig} :: =, overload p in q :: :::::: conditionals {$or p/(list twig)} :: ?| loobean or - {$case p/wing q/(list (pair twig twig))} :: ?- pick case in q + {$case p/wing q/(list (pair root twig))} :: ?- pick case in q {$if p/twig q/twig r/twig} :: ?: if/then/else {$lest p/twig q/twig r/twig} :: ?. ?:(p r q) {$ifcl p/wing q/twig r/twig} :: ?^ if p is a cell {$deny p/twig q/twig} :: ?< ?:(p !! q) {$sure p/twig q/twig} :: ?> ?:(p q !!) - {$deft p/wing q/twig r/(list (pair twig twig))} :: ?+ ?- w/default + {$deft p/wing q/twig r/(list (pair root twig))} :: ?+ ?- w/default {$and p/(list twig)} :: ?& loobean and {$ifat p/wing q/twig r/twig} :: ?@ if p is atom {$ifno p/wing q/twig r/twig} :: ?~ if p is null @@ -5548,9 +5549,9 @@ $% {$atom p/term q/(unit @)} :: atom / constant {$cell p/span q/span} :: ordered pair {$core p/span q/coil} :: object - {$face p/{p/wain q/$@(term tune)} q/span} :: namespace (new) + {$face p/{p/what q/$@(term tune)} q/span} :: namespace (new) {$fork p/(set span)} :: union - {$help p/wain q/span} :: documentation + {$help p/what q/span} :: documentation {$hold p/span q/twig} :: lazy evaluation == :: ++ tone $% {$0 p/*} :: success @@ -5558,7 +5559,7 @@ {$2 p/(list {@ta *})} :: error ~_s == :: ++ tune :: complex - $: p/(map term (pair wain (unit twig))) :: aliases + $: p/(map term (pair what (unit twig))) :: aliases q/(list twig) :: bridges == :: ++ typo span :: old span @@ -5567,6 +5568,7 @@ ++ vial ?($read $rite $both $free) :: co/contra/in/bi ++ vair ?($gold $iron $lead $zinc) :: in/contra/bi/co ++ vein (list (unit axis)) :: search trace +++ what (unit (pair cord (list wain))) :: help slogan/sections ++ wing (list limb) :: search path ++ worm :: compiler cache $: nes/(set ^) :: ++nest @@ -5593,7 +5595,7 @@ %ut ut == |% -++ a145 %145 +++ a144 %144 :: :::: 5a: compiler utilities :: @@ -5612,7 +5614,7 @@ :: ++ help ~/ %help - |= {p/wain q/span} + |= {p/what q/span} ^- span ?: =(%void q) %void @@ -5620,7 +5622,7 @@ :: ++ face :: make %face span ~/ %face - |= {giz/{wain $@(term tune)} der/span} + |= {giz/{what $@(term tune)} der/span} ^- span ?: =(%void der) %void @@ -5787,9 +5789,9 @@ :: ++ look ~/ %look - |= {cog/term dab/(map term (pair wain foot))} + |= {cog/term dab/(map term (pair what foot))} =+ axe=1 - |- ^- (unit {p/axis q/(pair wain foot)}) + |- ^- (unit {p/axis q/(pair what foot)}) ?- dab $~ ~ :: @@ -5822,13 +5824,13 @@ ~/ %loot |= {cog/term dom/(map @ tomb)} =+ axe=1 - |- ^- (unit {p/axis q/(pair wain foot)}) + |- ^- (unit {p/axis q/(pair what foot)}) ?- dom $~ ~ :: {* $~ $~} %+ bind (look cog q.q.n.dom) - |=((pair axis (pair wain foot)) [(peg axe p) q]) + |=((pair axis (pair what foot)) [(peg axe p) q]) :: {* $~ *} =+ yep=(look cog q.q.n.dom) @@ -5876,13 +5878,13 @@ $| [[%& 2] ~] == :: - ++ wthp |= opt/(list (pair twig twig)) + ++ wthp |= opt/(list (pair root twig)) %+ gray %case - [puce (turn opt |=({a/twig b/twig} [a (blue b)]))] + [puce (turn opt |=({a/root b/twig} [a (blue b)]))] ++ wtkt |=({sic/twig non/twig} (gray [%ifcl puce (blue sic) (blue non)])) - ++ wtls |= {gen/twig opt/(list (pair twig twig))} + ++ wtls |= {gen/twig opt/(list (pair root twig))} %+ gray %deft - [puce (blue gen) (turn opt |=({a/twig b/twig} [a (blue b)]))] + [puce (blue gen) (turn opt |=({a/root b/twig} [a (blue b)]))] ++ wtpt |=({sic/twig non/twig} (gray [%ifat puce (blue sic) (blue non)])) ++ wtsg |=({sic/twig non/twig} (gray [%ifno puce (blue sic) (blue non)])) ++ wtts |=(gen/twig (gray [%fits (blue gen) puce])) @@ -5897,14 +5899,14 @@ == =+ :* nag=`*`& gom=`axis`1 - wan=*wain + wat=*what == |_ sec/tile :::: ++ hail |= gen/twig ^- twig - ?~(wan gen [%help wan gen]) + ?~(wat gen [%help wat gen]) :: ++ home |=(gen/twig ^-(twig ?:(=(1 gom) gen [%per [%$ gom] gen]))) :::: @@ -5913,12 +5915,12 @@ ?- sec {^ *} %- hail - =. wan ~ + =. wat ~ (hail [$(sec p.sec) $(sec q.sec)]) :: {$axil *} %- hail - =. wan ~ + =. wat ~ ?- p.sec {$atom *} [%sand p.p.sec 0] $noun [%nock [%rock %$ 0] [[%rock %$ 0] [%rock %$ 1]]] @@ -5933,7 +5935,7 @@ :: {$bush *} %- hail - =. wan ~ + =. wat ~ [%if [%bust %bean] $(sec p.sec) $(sec q.sec)] :: {$deet *} @@ -5941,7 +5943,7 @@ :: {$fern *} %- hail - =. wan ~ + =. wat ~ |- ^- twig ?~ t.p.sec ^$(sec i.p.sec) @@ -5949,7 +5951,7 @@ :: {$herb *} %- hail - =. wan ~ + =. wat ~ =+ cys=~(boil ap p.sec) ?: ?=($herb -.cys) (home [%rap [%limb %$] p.sec]) @@ -5957,7 +5959,7 @@ :: {$kelp *} %- hail - =. wan ~ + =. wat ~ |- ^- twig ?~ t.p.sec ^$(sec i.p.sec) @@ -5967,17 +5969,17 @@ (hail [%rock p.sec q.sec]) :: {$plow *} - $(sec q.sec, wan (weld p.sec wan)) + $(sec q.sec, wat p.sec) :: {$reed *} %- hail - =. wan ~ + =. wat ~ [%if [%bust %bean] $(sec p.sec) $(sec q.sec)] :: {$weed *} (hail (home p.sec)) == - ++ clam ^-(twig [%gate ~ [%base %noun] (whip(gom 7) 6)]) + ++ clam ^-(twig [%gate [~ ~] [%base %noun] (whip(gom 7) 6)]) :: ++ whip |= axe/axis @@ -5994,14 +5996,14 @@ ?- sec {^ *} %- hail - =. wan ~ + =. wat ~ %- tun |= gon/* => .(nag gon) ^- twig :- ^$(sec -.sec, nag -.nag, axe (peg axe 2)) ^$(sec +.sec, nag +.nag, axe (peg axe 3)) :: {$axil *} %- hail - =. wan ~ + =. wat ~ ?- p.sec {$atom *} =+ buv=bunt @@ -6038,7 +6040,7 @@ :: {$bush *} %- hail - =. wan ~ + =. wat ~ %- tun |= gon/* => .(nag gon) ^- twig ?@ -.nag ?: =(& -.nag) @@ -6051,7 +6053,7 @@ :: {$fern *} %- hail - =. wan ~ + =. wat ~ |- ^- twig ?~ t.p.sec ^$(sec i.p.sec) @@ -6065,7 +6067,7 @@ :: {$herb *} %- hail - =. wan ~ + =. wat ~ =+ cys=~(boil ap p.sec) ?: ?=($herb -.cys) [%call (home p.sec) [%$ axe] ~] @@ -6073,7 +6075,7 @@ :: {$kelp *} %- hail - =. wan ~ + =. wat ~ %- tun |= gon/* => .(nag gon) |- ^- twig ?~ t.p.sec @@ -6089,11 +6091,11 @@ (hail [%rock p.sec q.sec]) :: {$plow *} - $(sec q.sec, wan (weld p.sec wan)) + $(sec q.sec, wat p.sec) :: {$reed *} %- hail - =. wan ~ + =. wat ~ ?- nag $& [%ifat [[%& axe] ~] $(sec p.sec, nag |) $(sec q.sec, nag [& &])] $| $(sec p.sec) @@ -6125,7 +6127,7 @@ ++ graf :: apply general doc |= doc/cord ^- (unit twig) - =- ?^ q.dep `[%help [doc ~] gen] + =- ?^ q.dep `[%help ~ gen] `p.dep ^= dep ^- (pair twig (unit cord)) @@ -6249,11 +6251,12 @@ == :: {$bush *} [%bush boil(gen p.gen) boil(gen q.gen)] - {$lamb *} [%weed [%port ~ p.gen [%bunt [%per [%$ 7] q.gen]]]] + {$lamb *} [%weed [%port [~ ~] p.gen [%bunt [%per [%$ 7] q.gen]]]] {$halo *} [%plow p.gen boil(gen q.gen)] {$coat *} [%bark p.gen boil(gen q.gen)] {$pick *} =+ (turn p.gen |=(a/twig boil(gen a))) ?~(- [%axil %void] [%fern -]) + {$grow *} [%herb p.gen] == :: ++ open @@ -6266,11 +6269,11 @@ {$dbug *} q.gen :: {$knit *} :: - :+ %per [%name %v %$ 1] :: => v=. - :+ %loop ~ :: |- + :+ %per [%name %v %$ 1] :: => v=. + :+ %loop [~ ~] :: |- :+ %like :: ^+ - :+ %loop ~ :: |- - :^ %if :: ?: + :+ %loop [~ ~] :: |- + :^ %if :: ?: [%bust %bean] :: ? [%bust %null] :: ~ :- [%name %i [%sand 'tD' *@]] :: :- i=~~ @@ -6282,22 +6285,22 @@ ^- twig :: ?@ i.p.gen :: [[%sand 'tD' i.p.gen] res] :: [~~{i.p.gen} {res}] - :+ %pin :: + :+ %pin :: :- :+ %name :: ^= %a :: a :+ %like :: ^+ [%limb %$] :: $ - [%per [%limb %v] p.i.p.gen] :: =>(v {p.i.p.gen}) + [%per [%limb %v] p.i.p.gen] :: =>(v {p.i.p.gen}) [%name %b res] :: b={res} ^- twig :: - :+ %loop ~ :: |- + :+ %loop [~ ~] :: |- :^ %ifat :: ?@ [%a ~] :: a [%limb %b] :: b - :- [%rap [%$ 2] [%limb %a]] :: :- -.a + :- [%rap [%$ 2] [%limb %a]] :: :- -.a :+ %make :: %= [%$ ~] :: $ - [[[%a ~] [%rap [%$ 3] [%limb %a]]] ~] :: a +.a + [[[%a ~] [%rap [%$ 3] [%limb %a]]] ~] :: a +.a :: {$leaf *} ~(clam al boil) {$limb *} [%make [p.gen ~] ~] @@ -6314,14 +6317,15 @@ {$pick *} ~(clam al boil) {$coat *} ~(clam al boil) {$halo *} ~(clam al boil) + {$grow *} p.gen :: - {$door *} [%pin [%bunt q.gen] [%core r.gen]] + {$door *} [%pin [%bunt q.gen] [%corp p.gen r.gen]] {$gasp *} [%pin [%burn q.gen] [%trap p.gen r.gen]] - {$trap *} :- %core - =- [[0 ~ -] ~ ~] - (~(put by *(map term (pair wain foot))) %$ ~ [%ash q.gen]) + {$trap *} :+ %corp p.gen + =- [[0 [~ ~] -] ~ ~] + (~(put by *(map term (pair what foot))) %$ ~ [%ash q.gen]) {$cork *} :+ %per - :- %core + :+ %corp p.gen =+ one=(~(got by r.gen) 0) %+ ~(put by r.gen) 0 one(q (~(put by q.one) %$ [~ [%ash q.gen]])) @@ -6329,12 +6333,12 @@ {$loop *} [%rap [%limb %$] [%trap p.gen q.gen]] {$port *} [%iron [%gate p.gen q.gen r.gen]] {$gill *} :+ %pin [%bunt q.gen] - :- %core - =- [[0 ~ -] ~ ~] - (~(put by *(map term (pair wain foot))) %$ ~ [%elm r.gen]) + :+ %corp p.gen + =- [[0 [~ ~] -] ~ ~] + (~(put by *(map term (pair what foot))) %$ ~ [%elm r.gen]) {$gate *} :^ %door p.gen q.gen - =- [[0 ~ -] ~ ~] - (~(put by *(map term (pair wain foot))) %$ ~ [%ash r.gen]) + =- [[0 [~ ~] -] ~ ~] + (~(put by *(map term (pair what foot))) %$ ~ [%ash r.gen]) {$tray *} [%lead %trap p.gen q.gen] :: {$conq *} [p.gen q.gen r.gen s.gen] @@ -6391,10 +6395,10 @@ :- %mean =+ fek=~(feck ap p.gen) ?^ fek [%rock %tas u.fek] - [%trap ~ [%call [%limb %cain] [%wrap [%per [%$ 3] p.gen]] ~]] + [%trap [~ ~] [%call [%limb %cain] [%wrap [%per [%$ 3] p.gen]] ~]] q.gen :: - {$lurk *} [%hint [%mean [%trap ~ p.gen]] q.gen] + {$lurk *} [%hint [%mean [%trap [~ ~] p.gen]] q.gen] {$fast *} :+ %thin :- %fast @@ -6447,21 +6451,21 @@ ?- q.gen $~ ~_(leaf+"open-smsg" !!) ^ - :+ %per [%name %v %$ 1] :: => v=. + :+ %per [%name %v %$ 1] :: => v=. |- ^- twig :: ?: ?=($~ t.q.gen) :: - [%per [%limb %v] i.q.gen] :: =>(v {i.q.gen}) - :+ %pin [%name %a $(q.gen t.q.gen)] :: =+ ^= a - :+ %pin :: {$(q.gen t.q.gen)} - [%name %b [%per [%limb %v] i.q.gen]] :: =+ ^= b - :+ %pin :: =>(v {i.q.gen}) + [%per [%limb %v] i.q.gen] :: =>(v {i.q.gen}) + :+ %pin [%name %a $(q.gen t.q.gen)] :: =+ ^= a + :+ %pin :: {$(q.gen t.q.gen)} + [%name %b [%per [%limb %v] i.q.gen]] :: =+ ^= b + :+ %pin :: =>(v {i.q.gen}) :+ %name %c :: =+ c=,.+6.b - :+ %rap :: + :+ %rap :: [%wing [%| 0 ~] [%& 6] ~] :: [%limb %b] :: - :+ %trap ~ :: |. + :+ %trap [~ ~] :: |. :^ %calt :: %+ - [%per [%limb %v] p.gen] :: =>(v {p.gen}) + [%per [%limb %v] p.gen] :: =>(v {p.gen}) [%call [%limb %b] [%limb %c] ~] :: (b c) :+ %make [%a ~] :: a(,.+6 c) [[[[%| 0 ~] [%& 6] ~] [%limb %c]] ~] :: @@ -6645,7 +6649,7 @@ {$atom *} q.sut {$cell *} %+ biff $(sut p.sut) |=(* (biff ^$(sut q.sut) |=(* `[+>+< +<]))) - {$core *} (biff $(sut p.sut) |=(* `[p.r.q.sut +<])) + {$core *} (biff $(sut p.sut) |=(* `[p.s.q.sut +<])) {$face *} $(sut repo) {$fork *} =+ yed=(~(tap in p.sut)) |- ^- (unit) @@ -7056,10 +7060,10 @@ ++ pony :: raw match $@ $~ :: void %+ each :: natural/abnormal - (pair wain palo) :: arm or leg + (pair what palo) :: arm or leg %+ each :: abnormal @ud :: unmatched - (pair wain (pair span nock)) :: synthetic + (pair what (pair span nock)) :: synthetic -- ^- pony ?~ hyp @@ -7088,9 +7092,7 @@ |% ++ here ?: =(0 p.heg) [%& ~ [~ `axe lon] %& sut] [%| %& (dec p.heg)] - ++ join |= {a/wain b/wain} - ?: =(a b) a - :(weld a `wain`['||' b]) + ++ join |=({a/what b/what} ?~(a b a)) ++ lose [%| %& p.heg] ++ stop ?~(q.heg here lose) ++ twin |= {hax/pony yor/pony} @@ -7137,7 +7139,7 @@ {$core *} ?~ q.heg here =^ zem p.heg - =+ zem=(loot u.q.heg q.r.q.sut) + =+ zem=(loot u.q.heg q.s.q.sut) ?~ zem [~ p.heg] ?:(=(0 p.heg) [zem 0] [~ (dec p.heg)]) ?^ zem @@ -7183,12 +7185,12 @@ ?~ fid ~ ?: ?=({$| $& *} fid) $(q.zot t.q.zot, p.heg p.p.fid) - =+ ^- {wan/wain vat/(pair span nock)} + =+ ^- {wat/what vat/(pair span nock)} ?- -.fid $& [p.p.fid (fine %& q.p.fid)] $| [p.p.p.fid (fine %| q.p.p.fid)] == - [%| %| wan p.vat (comb (comb [%0 axe] q.tiv) q.vat)] + [%| %| wat p.vat (comb (comb [%0 axe] q.tiv) q.vat)] -- :: {$fork *} @@ -7342,7 +7344,7 @@ (chip & gen) :: ++ harp - |= dab/(map term (pair wain foot)) + |= dab/(map term (pair what foot)) ^- ?($~ ^) ?: ?=($~ dab) ~ @@ -7405,8 +7407,7 @@ =+ tal=$(gen q.gen, gol %noun) [(nice (cell p.hed p.tal)) (cons q.hed q.tal)] :: - {$core *} (grow %gold [%$ 1] p.gen) - {$corp *} (grow %gold [%$ 1] q.gen) + {$corp *} (grow %gold [%$ 1] p.gen q.gen) :: {$make *} (~(mint et p.gen q.gen) gol) {$wish *} @@ -7541,12 +7542,12 @@ typ :: ++ grow - |= {mel/vair ruf/twig dom/(map @ tomb)} + |= {mel/vair ruf/twig wad/chap dom/(map @ tomb)} ^- {p/span q/nock} =+ dan=^$(gen ruf, gol %noun) - =+ toc=(core p.dan [%gold p.dan [~ dom]]) + =+ toc=(core p.dan [%gold p.dan wad [~ dom]]) =+ dez=(hope(sut toc) dom) - :- (nice (core p.dan mel p.dan [dez dom])) + :- (nice (core p.dan mel p.dan wad [dez dom])) (cons [%1 dez] q.dan) -- :: @@ -7578,8 +7579,7 @@ =+ tal=$(gen q.gen, gol %noun) [(nice (cell p.hed p.tal)) (cell q.hed q.tal)] :: - {$core *} (grow %gold [%$ 1] p.gen) - {$corp *} (grow %gold [%$ 1] q.gen) + {$corp *} (grow %gold [%$ 1] p.gen q.gen) {$make *} (~(mull et p.gen q.gen) gol dox) {$wish *} =+($(gen q.gen, gol %noun) $(gen [%bunt p.gen])) {$bump *} =+($(gen p.gen, gol [%atom %$ ~]) (beth [%atom %$ ~])) @@ -7703,18 +7703,18 @@ typ :: ++ grow - |= {mel/vair ruf/twig dom/(map @ tomb)} + |= {mel/vair ruf/twig wad/chap dom/(map @ tomb)} ~_ leaf+"mull-grow" ^- {p/span q/span} =+ dan=^$(gen ruf, gol %noun) - =+ ^= toc :- p=(core p.dan [%gold p.dan [~ dom]]) - q=(core q.dan [%gold q.dan [~ dom]]) + =+ ^= toc :- p=(core p.dan [%gold p.dan wad [~ dom]]) + q=(core q.dan [%gold q.dan wad [~ dom]]) =+ (balk(sut p.toc, dox q.toc) dom) - :- (nice (core p.dan mel p.dan [[%0 0] dom])) - (core q.dan [mel q.dan [[%0 0] dom]]) + :- (nice (core p.dan mel p.dan wad [[%0 0] dom])) + (core q.dan [mel q.dan wad [[%0 0] dom]]) :: ++ bake - |= dab/(map term (pair wain foot)) + |= dab/(map term (pair what foot)) ^- * ?: ?=($~ dab) ~ @@ -7815,7 +7815,7 @@ dext(sut q.q.ref, ref p.ref) (deem(sut q.q.sut, ref q.q.ref) p.q.sut p.q.ref) ?| (~(has in gil) [sut ref]) - %. [q.r.q.sut q.r.q.ref] + %. [q.s.q.sut q.s.q.ref] %= deep gil (~(put in gil) [sut ref]) sut sut(p q.q.sut, p.q %gold) @@ -7908,8 +7908,7 @@ ^- span ?- gen {^ *} (cell $(gen p.gen) $(gen q.gen)) - {$core *} (core sut %gold sut [[%0 0] p.gen]) - {$corp *} (core sut %gold sut [[%0 0] q.gen]) + {$corp *} (core sut %gold sut p.gen [[%0 0] q.gen]) {$make *} ~(play et p.gen q.gen) {$wish *} $(gen [%bunt p.gen]) {$bump *} [%atom %$ ~] @@ -8447,18 +8446,18 @@ %~ rent co :+ %$ %ud |- ^- @ - ?- q.r.q.sut + ?- q.s.q.sut $~ 0 {* $~ $~} 1 - {* $~ *} +($(q.r.q.sut r.q.r.q.sut)) - {* * $~} +($(q.r.q.sut l.q.r.q.sut)) + {* $~ *} +($(q.s.q.sut r.q.s.q.sut)) + {* * $~} +($(q.s.q.sut l.q.s.q.sut)) {* * *} .+ %+ add - $(q.r.q.sut l.q.r.q.sut) - $(q.r.q.sut r.q.r.q.sut) + $(q.s.q.sut l.q.s.q.sut) + $(q.s.q.sut r.q.s.q.sut) == == %^ cat 3 ?-(p.q.sut $gold '.', $iron '|', $lead '?', $zinc '&') - =+ gum=(mug q.r.q.sut) + =+ gum=(mug q.s.q.sut) %+ can 3 :~ [1 (add 'a' (mod gum 26))] [1 (add 'a' (mod (div gum 26) 26))] @@ -8559,10 +8558,10 @@ {$hold *} $(typ ~(repo ut typ)) {$core *} |- ^- ? - ?~ q.r.q.typ | - ?| (~(has by q.q.n.q.r.q.typ) cog) - $(q.r.q.typ l.q.r.q.typ) - $(q.r.q.typ r.q.r.q.typ) + ?~ q.s.q.typ | + ?| (~(has by q.q.n.q.s.q.typ) cog) + $(q.s.q.typ l.q.s.q.typ) + $(q.s.q.typ r.q.s.q.typ) == == :: @@ -8572,7 +8571,7 @@ ?+ typ ~ {$hold *} $(typ ~(repo ut typ)) {$core *} - (turn (~(tap by q.r.q.typ) ~) |=({a/term *} a)) + (turn (~(tap by q.s.q.typ) ~) |=({a/term *} a)) == :: ++ slop :: cons two vases @@ -8608,18 +8607,6 @@ ++ vast =+ [bug=`?`| wer=*path] |% - ++ dqut :: irregular docstring - =+ dsoz=;~(plug soq soq soq col) - =+ nl=(just '\0a') - =+ end=;~(pose dsoz ;~(plug nl dsoz)) - :: separator between lines: not nl''':, but just a newline. - =* mid ;~(less end nl) - :: printable characters which aren't an newline or an unquoted ''': - =* dqat ;~(less ;~(pose nl dsoz) ;~(pose ;~(pfix bas soq) prn)) - %- iny %+ ifix - :- ;~(pose ;~(plug dsoz nl) dsoz) - end - (more mid (boss 256 (star dqat))) :: ++ gash %+ cook |= a/(list tyke) ^- tyke @@ -8983,10 +8970,10 @@ $c :_ ~ :+ %lace `twig`[p.i.lut [%conp $(lut t.lut)]] :+ %new [%base %cell] - :- %core + :+ %corp [~ ~] ^- (map @ tomb) - =- [[0 ~ -] ~ ~] - ^- (map term (pair wain foot)) + =- [[0 [~ ~] -] ~ ~] + ^- (map term (pair what foot)) :_ [~ ~] =+ sug=[[%& 12] ~] :^ %$ ~ %elm @@ -8998,6 +8985,77 @@ $f $(lut (weld p.i.lut t.lut)) == -- + ++ scab + %+ cook + |= a/(list wing) ^- twig + :- %grow + |- ^- twig + ?~(a !! ?~(t.a [%wing i.a] [%rap [%wing i.a] $(a t.a)])) + (most col rope) + :: + ++ scad !: + %+ knee *root |. ~+ + %- stew + ^. stet ^. limo + :~ + :- '_' + ;~(pfix cab (stag %shoe wide)) + :- '$' + ;~ pose + ;~ pfix buc + ;~ pose + (stag %leaf (stag %tas (cold %$ buc))) + (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 %grow rump) + == + :- '%' + ;~ pose + ;~ pfix cen + ;~ pose + (stag %leaf (stag %tas (cold %$ buc))) + (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 %grow + %+ stag %call + %+ ifix [pel per] + ;~(plug wide ;~(pose ;~(pfix ace (most ace wyde)) (easy ~))) + :- '{' + (stag %bank (ifix [kel ker] (most ace wyde))) + :- '[' + (stag %bank (ifix [sel ser] (most ace wyde))) + :- '*' + (cold [%base %noun] tar) + :- '@' + ;~(pfix pat (stag %base (stag %atom mota))) + :- '?' + ;~ pose + (stag %pick ;~(pfix wut (ifix [pel per] (most ace wyde)))) + (cold [%base %bean] wut) + == + :- '^' + ;~ pose + scab + (cold [%base %cell] ket) + == + :- '.' + scab + :- ['a' 'z'] + ;~ pose + (stag %coat ;~(plug sym ;~(pfix ;~(pose fas tis) wyde))) + scab + == + == :: ++ scat !: %+ knee *twig |. ~+ @@ -9193,23 +9251,52 @@ == ++ sump (ifix [kel ker] (stag %conp (most ace wide))) ++ norm :: rune regular form - |= tol/? - =< %- stew + |= {rut/? tol/?} + =< ?: rut + %- stew + ^. stet ^. limo + :~ :- '$' + ;~ pfix buc + %- stew + ^. stet ^. limo + :~ ['@' (rune pat %claw exqb)] + ['_' (rune cab %shoe expa)] + [':' (rune col %bank exqs)] + ['%' (rune cen %book exqs)] + ['^' (rune ket %bush exqb)] + ['-' (rune hep %lamb exqb)] + ['=' (rune tis %coat exqg)] + ['?' (rune wut %pick exqs)] + [';' (rune sem %grow expa)] + == + == + :- '%' + ;~ pfix cen + %- stew + ^. stet ^. limo + :~ ['^' (rune ket %calq exqy)] + ['+' (rune lus %calt exqx)] + ['-' (rune hep %call exqk)] + [':' (rune col %call exqz)] + == + == + == + %- stew ^. stet ^. limo :~ :- '|' ;~ pfix bar %- stew ^. stet ^. limo - :~ ['_' (runo cab %door ~ expr)] - ['%' (rune cen %core expe)] - [':' (runo col %gasp ~ expb)] - ['.' (runo dot %trap ~ expa)] - ['-' (runo hep %loop ~ expa)] - ['^' (runo ket %cork ~ expx)] - ['~' (runo sig %port ~ expb)] - ['*' (runo tar %gill ~ expb)] - ['=' (runo tis %gate ~ expb)] - ['?' (runo wut %tray ~ expa)] + :~ ['_' (runo cab %door [~ ~] exqr)] + ['%' (runo cen %corp [~ ~] expe)] + [':' (runo col %gasp [~ ~] expb)] + ['.' (runo dot %trap [~ ~] expa)] + ['-' (runo hep %loop [~ ~] expa)] + ['^' (runo ket %cork [~ ~] expx)] + ['~' (runo sig %port [~ ~] expb)] + ['*' (runo tar %gill [~ ~] exqc)] + ['=' (runo tis %gate [~ ~] exqc)] + ['?' (runo wut %tray [~ ~] expa)] == == :- '$' @@ -9224,6 +9311,7 @@ ['-' (rune hep %lamb expb)] ['=' (rune tis %coat expg)] ['?' (rune wut %pick exps)] + [';' (rune sem %grow expa)] == == :- '%' @@ -9235,6 +9323,7 @@ ['^' (rune ket %calq expd)] ['+' (rune lus %calt expc)] ['-' (rune hep %call expk)] + [':' (rune col %call expi)] ['~' (rune sig %open expu)] ['*' (rune tar %bake expm)] ['=' (rune tis %make exph)] @@ -9253,16 +9342,16 @@ ['*' (rune tar %conp exps)] == :: - (worn %door ~ expr) - (word %core expe) - (worn %gasp ~ expb) - (worn %trap ~ expa) - (worn %loop ~ expa) - (worn %cork ~ expx) - (worn %port ~ expb) - (worn %gill ~ expb) - (worn %gate ~ expb) - (worn %tray ~ expa) + (worn %door [~ ~] expr) + (worn %corp [~ ~] expe) + (worn %gasp [~ ~] expb) + (worn %trap [~ ~] expa) + (worn %loop [~ ~] expa) + (worn %cork [~ ~] expx) + (worn %port [~ ~] expb) + (worn %gill [~ ~] expb) + (worn %gate [~ ~] expb) + (worn %tray [~ ~] expa) :: (word %bunt expa) (word %claw expb) @@ -9273,6 +9362,7 @@ (word %lamb expb) (word %coat expg) (word %pick exps) + (word %grow expa) :: (word %keep exph) (word %lace expb) @@ -9294,8 +9384,7 @@ (word %nock expb) (word %same expb) (word %deep expa) - (word %wish expn) - (word %wish expn) + (word %wish exqn) :: (word %iron expa) (word %ward expb) @@ -9369,7 +9458,7 @@ ['*' (rune tar %nock expb)] ['=' (rune tis %same expb)] ['?' (rune wut %deep expa)] - ['^' (rune ket %wish expn)] + ['^' (rune ket %wish exqn)] == == :- '^' @@ -9378,7 +9467,7 @@ ^. stet ^. limo :~ ['|' (rune bar %iron expa)] ['.' (rune dot %ward expb)] - ['-' (rune hep %cast expb)] + ['-' (rune hep %cast exqc)] ['+' (rune lus %like expb)] ['&' (rune pam %zinc expa)] ['~' (rune sig %burn expa)] @@ -9418,7 +9507,7 @@ ;~ pfix tis %- stew ^. stet ^. limo - :~ ['|' (rune bar %new expb)] + :~ ['|' (rune bar %new exqc)] ['.' (rune dot %set expq)] ['?' (rune wut %huh expw)] ['^' (rune ket %sip expt)] @@ -9469,11 +9558,11 @@ == |% ++ boog :: core arms - %+ knee [p=*term q=*(pair wain foot)] |. ~+ + %+ knee [p=*term q=*(pair what foot)] |. ~+ ;~ pfix lus ;~ pose %+ cook - |=({a/$ash b/term c/twig} [b *wain a c]) + |=({a/$ash b/term c/twig} [b *what a c]) ;~ gunk (cold %ash (just '+')) ;~(pose (cold %$ buc) sym) @@ -9481,27 +9570,61 @@ == :: %+ cook - |=({a/$elm b/term c/twig} [b *wain a c]) + |=({a/$elm b/term c/twig} [b *what a c]) ;~ gunk (cold %elm (just '-')) ;~(pose (cold %$ buc) sym) loaf == + :: + %+ cook + |=({a/$ash b/term c/root} [b *what a c]) + ;~ gunk + (cold %ash (just '=')) + sym + loan + == == == :: - ++ wisp :: core tail - %- ulva - %+ sear - |= a/(list (pair term (pair wain foot))) - =| b/(map term (pair wain foot)) - |- ^- (unit (map @ tomb)) - ?~ a `[[0 ~ b] ~ ~] - ?: (~(has by b) p.i.a) - ~&(duplicate-arm+p.i.a ~) - $(a t.a, b (~(put by b) p.i.a q.i.a)) + ++ whap :: chapter (most muck boog) :: + ++ wisp :: core tail + ?. tol fail + %+ sear + |= a/(list (list (pair term (pair what foot)))) + =| {b/(map @ tomb) c/@} + |- ^- (unit (map @ tomb)) + ?~ a `b + =/ d + =| e/(map term (pair what foot)) + |- ^- (unit (map term (pair what foot))) + ?~ i.a `e + ?: ?| (~(has by e) p.i.i.a) + |- ^- ? + ?: =(0 c) | + =. c (dec c) + |((~(has by q:(~(got by b) c)) p.i.i.a) $) + == + :: XX we don't have a good way to annotate + :: postparse construction "syntax" errors + :: + ~&(duplicate-arm+p.i.i.a ~) + $(i.a t.i.a, e (~(put by e) p.i.i.a q.i.i.a)) + ?~ d ~ + $(a t.a, b (~(put by b) c [*chap u.d]), c +(c)) + ;~ pose + dun + ;~ sfix + ;~ pose + (most muck ;~(pfix ;~(plug lus bar gap) whap)) + ;~(plug whap (easy ~)) + == + ;~(plug gap dun) + == + == + :: ++ toad :: untrap parser exp |* har/_expa =+ dur=(ifix [pel per] $:har(tol |)) @@ -9537,7 +9660,9 @@ ++ ulva |* zor/rule :: closing -- and tall ?.(tol fail ;~(sfix zor ;~(plug gap dun))) ++ hank (most muck loaf) :: gapped twigs - ++ loaf ?:(tol tall wide) :: hoon, current width + ++ hunk (most muck loan) :: gapped roots + ++ loaf ?:(tol tall wide) :: tall/wide twig + ++ loan ?:(tol till wyde) :: tall/wide root ++ mash ?:(tol gap ;~(plug com ace)) :: list separator ++ muck ?:(tol gap ace) :: general separator ++ teak %+ knee *tiki |. ~+ :: wing or twig @@ -9572,9 +9697,10 @@ (stag %| (stag ~ tall)) == ++ rack (most mash ;~(gunk loaf loaf)) :: list [twig twig] + ++ ruck (most mash ;~(gunk loan loaf)) :: list [root twig] ++ rick (most mash ;~(gunk rope loaf)) :: list [wing twig] :: - :: rune contents + :: twig contents :: ++ expa |.(loaf) :: one twig ++ expb |.(;~(gunk loaf loaf)) :: two twigs @@ -9589,7 +9715,6 @@ ++ expk |.(;~(gunk loaf ;~(plug loaf (easy ~)))) :: list of two twigs ++ expl |.(;~(gunk sym loaf loaf)) :: term, two twigs ++ expm |.((butt ;~(gunk rope loaf rick))) :: several [tile twig]s - ++ expn |.(;~(gunk loaf (stag %conp (butt hank)))):: autoconsed twigs ++ expo |.(;~(gunk wise loaf loaf)) :: =; ++ expp |.(;~(gunk (butt rick) loaf)) :: [wing twig]s, twig ++ expq |.(;~(gunk rope loaf loaf)) :: wing and two twigs @@ -9606,28 +9731,40 @@ wisp :: == :: ++ expz |.(loaf(bug &)) :: twig with tracing + :: root contents :: + ++ exqb |.(;~(gunk loan loan)) :: two roots + ++ exqc |.(;~(gunk loan loaf)) :: root then twig + ++ exqs |.((butt hunk)) :: closed gapped roots + ++ exqg |.(;~(gunk sym loan)) :: term and root + ++ exqk |.(;~(gunk loaf ;~(plug loan (easy ~)))) :: twig with one root + ++ exqr |.(;~(gunk loan wisp)) :: root and core tail + ++ exqn |.(;~(gunk loan (stag %conp (butt hank)))):: autoconsed twigs + ++ exqw |.(;~(gunk loaf loan)) :: twig and root + ++ exqx |.(;~(gunk loaf loan loan)) :: twig, two roots + ++ exqy |.(;~(gunk loaf loan loan loan)) :: twig, three roots + ++ exqz |.(;~(gunk loaf (butt hunk))) :: twig, n roots :: :: tiki expansion for %wt runes :: - ++ tkhp |. %+ cook |= {a/tiki b/(list (pair twig twig))} + ++ tkhp |. %+ cook |= {a/tiki b/(list (pair root twig))} (~(wthp ah a) b) - (butt ;~(gunk teak rack)) + (butt ;~(gunk teak ruck)) ++ tkkt |. %+ cook |= {a/tiki b/twig c/twig} (~(wtkt ah a) b c) ;~(gunk teak loaf loaf) - ++ tkls |. %+ cook |= {a/tiki b/twig c/(list (pair twig twig))} + ++ tkls |. %+ cook |= {a/tiki b/twig c/(list (pair root twig))} (~(wtls ah a) b c) - (butt ;~(gunk teak loaf rack)) + (butt ;~(gunk teak loaf ruck)) ++ tkpt |. %+ cook |= {a/tiki b/twig c/twig} (~(wtpt ah a) b c) ;~(gunk teak loaf loaf) ++ tksg |. %+ cook |= {a/tiki b/twig c/twig} (~(wtsg ah a) b c) ;~(gunk teak loaf loaf) - ++ tkts |. %+ cook |= {a/twig b/tiki} + ++ tkts |. %+ cook |= {a/root b/tiki} (~(wtts ah b) a) - ;~(gunk loaf teak) + ;~(gunk loan teak) :: :: hint syntax :: @@ -9678,7 +9815,7 @@ -- :: ++ lang :: lung sample - $: ros/twig :: XX translation + $: ros/twig $= vil $% {$tis p/twig} {$col p/twig} @@ -9750,17 +9887,41 @@ == == :: - ++ wise ;~(plug sym (punt ;~(pfix fas wide))) + ++ wise ;~(plug sym (punt ;~(pfix ;~(pose fas tis) wyde))) ++ wack %+ cook |= {a/wain b/twig c/(unit cord)} ^- twig =. a ?~(c a [u.c a]) ?~ a b - [%help a b] + [%help ~ b] ;~ plug (star (ifix [;~(plug col gar) (punt gap)] epic)) - ;~(pose (norm &) long lute ape:(sail &)) + ;~(pose (norm | &) long lute ape:(sail &)) + :: + :: XX performance: this makes the parser about 50% slower. + :: because we double-parse most of the spaces in the file. + :: just so we can do a postfix doc-comment. + :: + :: the correct solution to this problem is to unify the + :: parsing of docs with the parsing of comments/spaces. + :: but at this point we're pretty much in parser rewrite. + :: + :: it should go without saying that ++vast needs a rewrite. + :: it dates to 2011. + :: + (punt ;~(pfix ;~(plug (star ace) col gal) epic)) + == + ++ wock + %+ cook + |= {a/wain b/twig c/(unit cord)} + ^- twig + =. a ?~(c a [u.c a]) + ?~ a b + [%help ~ b] + ;~ plug + (star (ifix [;~(plug col gar) (punt gap)] epic)) + ;~(pose (norm & &) scad) :: :: XX performance: this makes the parser about 50% slower. :: because we double-parse most of the spaces in the file. @@ -9777,29 +9938,18 @@ == ++ tall %+ knee *twig :: full tall form |.(~+((wart wack))) + ++ till %+ knee *root :: full tall form + |.(~+((wart wock))) ++ wide %+ knee *twig :: full wide form - |.(~+((wart ;~(pose (norm |) long ape:(sail |))))) + |.(~+((wart ;~(pose (norm | |) long ape:(sail |))))) + ++ wyde %+ knee *root :: full wide form + |.(~+((wart ;~(pose (norm & |) scad)))) ++ wart |* zor/rule %+ here |= {a/pint b/twig} ?:(bug [%dbug [wer a] b] b) zor - ++ wqut :: cord as wain for ^: - =+ end=;~(plug (just '\0a') soz) - =* mid ;~(less end (just '\0a')) - ;~ simu soq - ;~ pose - ;~ less soz - (cook |=(a/@ [a ~]) (ifix [soq soq] (boss 256 (more gon qit)))) - == - =+ hed=;~(pose ;~(plug (plus ace) vul) (just '\0a')) - %- iny %+ ifix - :- ;~(plug soz hed) - end - (more mid (boss 256 (star prn))) - == - == -- :: ++ vest diff --git a/sys/vane/ford.hoon b/sys/vane/ford.hoon index 1c120c0d5..e0b823d3f 100644 --- a/sys/vane/ford.hoon +++ b/sys/vane/ford.hoon @@ -1450,13 +1450,13 @@ :+ %per ?: =(~ rop) [%$ 1] - :- %core - =- [[0 ~ -] ~ ~] + :+ %corp [~ ~] + =- [[0 [~ ~] -] ~ ~] (~(run by rop) |=({^ a/twig} [~ %ash a])) ?: =(~ bil) [%$ 1] - :- %core - =- [[0 ~ -] ~ ~] + :+ %corp [~ ~] + =- [[0 [~ ~] -] ~ ~] (~(run by bil) |=({^ a/twig} [~ %ash a])) :: ++ abut :: generate @@ -1749,12 +1749,12 @@ (flux |=(sel/_..wilt sel(boy [[%tow boy.sel] boy]))) =+ [all=(lark (slat %tas) arc) sel=..wilt] %+ cope - |- ^- (bolt (pair (map term (pair wain foot)) _..wilt)) + |- ^- (bolt (pair (map term (pair what foot)) _..wilt)) ?~ all (fine cof ~ ..wilt) %+ cope $(all l.all) - |= {cof/cafe lef/(map term (pair wain foot)) sel/_..wilt} + |= {cof/cafe lef/(map term (pair what foot)) sel/_..wilt} %+ cope ^$(all r.all, cof cof, sel sel) - |= {cof/cafe rig/(map term (pair wain foot)) sel/_..wilt} + |= {cof/cafe rig/(map term (pair what foot)) sel/_..wilt} %+ cope %= ^^^^$ cof cof @@ -1764,12 +1764,12 @@ |= {cof/cafe sel/_..wilt} %+ fine cof :_ sel - ^- (map term (pair wain foot)) + ^- (map term (pair what foot)) [[p.n.all [~ %ash [%tow boy.sel]]] lef rig] - |= {cof/cafe mav/(map term (pair wain foot)) sel/_..wilt} + |= {cof/cafe mav/(map term (pair what foot)) sel/_..wilt} ?~ mav (flaw cof [%leaf "source missing: {<(en-beam p.hop)>}"]~) - (fine cof sel(boy [[%core [[0 ~ mav] ~ ~]] boy])) + (fine cof sel(boy [[%corp [~ ~] [[0 [~ ~] mav] ~ ~]] boy])) == -- :: diff --git a/sys/zuse.hoon b/sys/zuse.hoon index 83cdff0d7..c17098820 100644 --- a/sys/zuse.hoon +++ b/sys/zuse.hoon @@ -644,6 +644,7 @@ ++ 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 @@ -4086,7 +4087,7 @@ :: MOVEME :: :: ++fuel:html ++ fuel :: parse urbit fcgi - |= {bem/beam ced/noun:cred quy/|-($@($~ {p/@t q/@t t/$}))} + |= {bem/beam ced/noun:cred quy/quer} ^- epic =+ qix=|-(`quay`?~(quy quy [[p q]:quy $(quy t.quy)])) [(malt qix) ((hard cred) ced) bem /] @@ -4118,8 +4119,9 @@ :: (raid /ack/~sarnel+.y p=%tas q=%p r=%f ~) :: =- |* {a/path b/{@tas (pole @tas)}} - ?~ +.b `(odo -.b)`(slav -.b -.a) - [`(odo -.b)`(slav -.b -.a) (..$ +.a +.b)] + =* fog (odo -.b) + ?~ +.b `fog`(slav -.b -.a) + [`fog`(slav -.b -.a) (..$ +.a +.b)] ^= odo |* a/@tas |= b/* @@ -4136,10 +4138,11 @@ |= a/path ?~ a ~ =+ hed=(slaw -.b i.a) + =* fog (odo:raid -.b) ?~ +.b - ^- (unit (odo:raid -.b)) + ^- (unit fog) ?^(+.a ~ hed) - ^- (unit {(odo:raid -.b) _(need *(..^$ +.b))}) + ^- (unit {fog _(need *(..^$ +.b))}) (both hed ((..^$ +.b) +.a)) -- ::wired :: :: From 159e9a2234613b44d03a1373be49f600573c9775 Mon Sep 17 00:00:00 2001 From: "C. Guy Yarvin" Date: Tue, 4 Apr 2017 17:33:20 -0700 Subject: [PATCH 05/14] Complete decoration system. --- gen/deco.hoon | 179 ++++++++++++ gen/walk.hoon | 484 ++++++++++---------------------- sys/hoon.hoon | 759 ++++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 942 insertions(+), 480 deletions(-) create mode 100644 gen/deco.hoon diff --git a/gen/deco.hoon b/gen/deco.hoon new file mode 100644 index 000000000..757553475 --- /dev/null +++ b/gen/deco.hoon @@ -0,0 +1,179 @@ +:: +:: this is a sample file designed to set conventions for +:: high-quality conventional hoon. +:: +:: all lines must be under 80 characters. no blank lines. +:: any line longer than 60 characters is probably too long. +:: uppercase or non-ascii letters are strongly discouraged. +:: +:: informal comments (lines with {::}) should be used only for +:: meta-discussion *about* the code. +:: +:: whenever possible, use formal decorations. {:>} decorates +:: the next expression; {:<} decorates the previous one. +:: +:: there are two places to put decorations: in line with the +:: code, and on the right margin. +:: +:: in comments and decorations, use *phrase* for emphasis +:: and {braces} to surround code literals. (documentation will +:: eventually be automatically generated from formal comments.) +:: %literal, ++literal, ~ship need no braces. for a valid +:: hoon expression, `exp. +:: +:: there are three conventions for naming: *ultralapidary*, +:: *lapidary*, and *natural*. this file is mostly natural. +:: +:: when in doubt, use the *natural* naming convention. for +:: both arms and faces, natural naming means long, legible, +:: english-language phrases, in hyphen-separated {kebab-case}. +:: +:: lapidary conventions should be used only for small, simple, +:: self-contained systems. lapidary mode means three-letter +:: faces ("variable names") and four-letter arms ("methods"). +:: +:: ultralapidary conventions use single-letter names starting +:: with {a}. use this convention only for one-liners, etc. +:: +:: the file below is a medium-sized generator, built around +:: a typical two-core structure. the cores are labeled {%arch} +:: (structures) and {%work} (productions). this is canonical. +:: +:: this code is written to display the variety of formatting +:: options the parser allows. a specific convention should pick +:: one of these styles and stick to it. +:: +:: a forward decoration block {:>} is either a *document block* or +:: a *definition block*. + +:: a document block has two parts, each of which is optional: +:: the *title* and the *body*, +:: +:: the title is a ++term preceded by {:> || %}. only cores +:: and core chapters (preceded by {+|}) can use titles. titles +:: are optionally surrounded by blank or semi-blank decorations, +:: {:>} or {:> ||}. +:: +:: the body is either short or long. a short body is a *single line* +:: preceded by {:> } - ie, not indented. a long body starts with +:: a *single line* indented by two extra spaces, {:> }, then a +:: blank line, then a series of paragraphs. +:: +:: a definition block is a list of name definitions. the twig below +:: the block is traversed for bindings on these names. +:: +:: a name definition can be short or long. a short definition is +:: a *single line* of the form {:> name: value}. +:: +:: a long definition is a short definition, followed by a blank +:: decoration {:>}, followed by a series of paragraphs each +:: indented by an extra two spaces. +:: +:: a paragraph is a series of lines, not indented for text, +:: indented by four extra spaces, {:> }, for code. +:: +:: a backward decoration {:<} is only one line, always parsed +:: as a short body. +:: +:- %say +|= * +=< [%noun (say-hello %world)] +=> :> || + :> || %arch + :> || + :> structures for our imaginary hello, world generator. + :> + :> nothing forces us to put structures in a separate core. + :> but compile-time evaluation doesn't work in the current + :> core; we often want to statically evaluate structures. + :> + :> there are three kinds of structures: models (normalizing + :> functions), patterns (functions that build models), and + :> constants (static data). + :> + :> most code will not need its own patterns. but put them + :> in a separate chapter (separated by {+|}). + |% + :> || + :> || %model + :> || + :> models (molds) are functions that normalize nouns. + :> + :> arms producing molds are introduced with {+=}. for molds, + :> we decorate the mold rather than the arm. the compiler + :> will copy the mold decoration onto the arm. + +| + += spot {p/@ q/@} :< a coordinate + += tops :> also a coordinate + {p/@ q/@} + += goof :> a simple tuple + $: foo/@ :< something mysterious + bar/@ :< go here for drink + moo/(binary-tree juice) :< cows do this + == + += juice :> fruity beverage + $% {$plum p/@} :< fresh prune + {$pear p/@ q/@} :< good for cider + {$acai p/@} :< aztec superfood + == + :> || %pattern + :> patterns are functions that build models. + :> + :> other languages might call these "type constructors" + :> or "higher-kinded types". + +| + ++ binary-tree :< tree pattern + |* a/$-(* *) + $@($~ {n/a l/(binary-tree a) r/(binary-tree a)}) + :> || + :> || %constant + :> || + :> if you have constants, put them in their own chapter. + +| + ++ answer :< answer to everything + 42 + -- +:> || %work +:> engines for our imaginary hello, world app. +:> +:> note that ++say-goodbye is the correct notation, even though +:> it's a {+-} arm. +|% +:> :> ++say-hello +++ say-hello :< say hi to someone + :> friendly welcome message + :> + |= :> txt: friend to say hi to + :> + txt/term + ^- tape + "hello, {(rip 3 txt)}" +:> ++say-goodbye: say a really proper goodbye +:> +:> some paragraphs about the goodbye algorithm, possibly +:> including code indented by four extra spaces: +:> +:> ?: =(%hello %world) +:> %hello +:> %world +:> :: ++say-goodbye ++- say-goodbye :: + :> describe product of function + :> + |= :> txt: departing friend + :> num: number of friends + $: txt/term + num/@ + == + ^- tape + :> foo: four + :> bar: forty-two + =/ foo (add 2 2) + =/ bar (add (mul num foo) 2) + =/ moo (mul num bar) :< for all the cows + "goodbye and {(scot %ud moo)}, {(rip 3 txt)}" +:> :> ++say-minimum +++ say-minimum :> minimal decoration + |= txt/term + "nothing to say to {(rip 3 txt)}" +-- diff --git a/gen/walk.hoon b/gen/walk.hoon index 70ade92ee..90f90b21e 100644 --- a/gen/walk.hoon +++ b/gen/walk.hoon @@ -1,354 +1,160 @@ -:: +!: :::: :: :- %say |= $: {now/@da * bec/beak} * == -=< ~& %walk-testing - :- %noun - =+ sys=`path`/(scot %p p.bec)/[q.bec]/(scot %da now)/sys - =+ compiler-source=.^(@t %cx (welp sys /hoon/hoon)) - ~& %test-parsing - =+ compiler-twig=(ream compiler-source) - ~& %test-walking - ~(test ap compiler-twig) -=< |% - ++ come :: parsed docline - $% {$blank $~} - {$var p/term q/ - ++ post :: print state - - -- +=< :- %noun + %hello |% :: -++ ap :: twig engine +++ ap |_ gen/twig - :: - ++ test :: test ++walk - ^- ? - =- ~| [gen+gen neg+neg ~] - ?> =(gen neg) - & - ^= neg - ^- twig - =< - - %+ (walk $~) - ~ - |= {gen/twig vit/$~ aid/$-({? twig $~} {twig $~})} - ~ - ++ dock :: apply document - |= doc/cord - |^ ^- (unit twig) - =/ rah ^- (each (pair term cord) cord) - (rash doc very) - ?-(-.rah $& (rave p.rah), $| (graf p.rah)) + ++ gi + =| whit + =* wit - + |% + ++ gray + ^- ? + | + :: on reflection, perhaps just obsessive linting + :: + :: ?| ?=(^ lab) + :: ?=(^ boy) + :: |- ^- ? + :: ?~ def | + :: |($(def l.def) $(def r.def) !(~(has in use) p.n.def)) + :: == :: - ++ graf :: apply general doc - =* life (unit cord) - |= doc/cord - ^- (unit twig) - =- ?^ q.dep `[%help [doc ~] gen] - `p.dep - ^= dep - =/ foo/@tas %foobar - ^- (pair twig life) - %+ (walk life) - `doc - |= {gen/twig vit/life aid/$-({? twig life} {twig life})} - ^- (unit (pair twig life)) - ?~ vit `[gen ~] - |^ ?+ -.gen - outside-image - ^ outside-image - $dbug ~ - $help `[[%help [doc p.gen] q.gen] ~] - $claw outside-model - $shoe outside-model - $bank outside-model - $lamb outside-model - $bush outside-model - $pick outside-model - $coat outside-model - $halo `[[%halo [doc p.gen] q.gen] ~] + ++ grad + |= $: gen/twig + wit/whit + aid/$-({? twig whit} {twig whit}) == - ++ outside-model - `[[%halo [doc ~] gen] ~] - ++ outside-image - `[[%help [doc ~] gen] ~] - -- - :: - ++ rave :: apply variable doc - =* life (unit (pair term cord)) - |= {cog/term doc/cord} - ^- (unit twig) - =- ?^ q.dep ~ - `p.dep - ^= dep - ^- (pair twig life) - %+ (walk life) - `[cog doc] - |= {gen/twig vit/life aid/$-({? twig life} {twig life})} - ^- (unit (pair twig life)) - ?~ vit `[gen ~] - ~ - :: - ++ very :: variable reparse - %+ pick - ;~(plug sym (cook crip ;~(pfix ;~(plug col ace) (star prn)))) - (cook crip (star prn)) - -- - :: - ++ walk :: forward traverse - |* life/mold - |= $: vit/life - $= mac - $- $: twig - life - $-({? twig life} {twig life}) - == - (unit (pair twig life)) + ^- (unit (pair twig whit)) + =: ^gen gen + ^wit wit == - ^- {twig life} - =/ use & - =< apex - |% - ++ apex - |- ^- {twig life} - =* aid |= {use/? gen/twig vit/life} - ^$(use use, gen gen, vit vit) - =/ gun ?:(use (mac gen vit aid) ~) - ?^ gun u.gun - ?: ?=(^ -.gen) - %.(gen dubs) - ?- -.gen - $$ (lead -.gen %.(+.gen noop)) - $base (lead -.gen %.(+.gen noop)) - $bunt (lead -.gen %.(+.gen expr)) - $bust (lead -.gen %.(+.gen noop)) - $dbug (lead -.gen %.(+.gen nexp)) - $hand (lead -.gen %.(+.gen noop)) - $knit (lead -.gen %.(+.gen (moto bark))) - $leaf (lead -.gen %.(+.gen noop)) - $limb (lead -.gen %.(+.gen noop)) - $lost (lead -.gen %.(+.gen expr)) - $rock (lead -.gen %.(+.gen noop)) - $sand (lead -.gen %.(+.gen noop)) - $tell (lead -.gen %.(+.gen moar)) - $tune (lead -.gen %.(+.gen tung)) - $wing (lead -.gen %.(+.gen noop)) - $yell (lead -.gen %.(+.gen moar)) - $claw (lead -.gen %.(+.gen dubs)) - $shoe (lead -.gen %.(+.gen expr)) - $bank (lead -.gen %.(+.gen moar)) - $book (lead -.gen %.(+.gen moar)) - $lamb (lead -.gen %.(+.gen dubs)) - $bush (lead -.gen %.(+.gen dubs)) - $pick (lead -.gen %.(+.gen moar)) - $coat (lead -.gen %.(+.gen nexp)) - $grow (lead -.gen %.(+.gen expr)) - $door (lead -.gen %.(+.gen (trio noop expr arms))) - $door (lead -.gen %.(+.gen (trio noop expr arms))) - $gasp (lead -.gen %.(+.gen (twin noop dubs))) - $corp (lead -.gen %.(+.gen (twin noop arms))) - $trap (lead -.gen %.(+.gen (twin noop expr))) - $cork (lead -.gen %.(+.gen (trio noop expr arms))) - $loop (lead -.gen %.(+.gen (twin noop expr))) - $port (lead -.gen %.(+.gen (twin noop dubs))) - $gill (lead -.gen %.(+.gen (twin noop dubs))) - $gate (lead -.gen %.(+.gen (twin noop dubs))) - $tray (lead -.gen %.(+.gen (twin noop expr))) - $scon (lead -.gen %.(+.gen dubs)) - $conq (lead -.gen %.(+.gen (quad expr expr expr expr))) - $cons (lead -.gen %.(+.gen dubs)) - $cont (lead -.gen %.(+.gen trey)) - $conl (lead -.gen %.(+.gen moar)) - $conp (lead -.gen %.(+.gen moar)) - $keep (lead -.gen %.(+.gen (twin noop moan))) - $lace (lead -.gen %.(+.gen dubs)) - $call (lead -.gen %.(+.gen (twin expr moar))) - $bake (lead -.gen %.(+.gen (trio noop expr moan))) - $calq (lead -.gen %.(+.gen (quad expr expr expr expr))) - $calt (lead -.gen %.(+.gen trey)) - $open (lead -.gen %.(+.gen (trio noop expr moar))) - $make (lead -.gen %.(+.gen (twin noop moan))) - $wish (lead -.gen %.(+.gen dubs)) - $bump (lead -.gen %.(+.gen expr)) - $nock (lead -.gen %.(+.gen dubs)) - $same (lead -.gen %.(+.gen dubs)) - $deep (lead -.gen %.(+.gen expr)) - $iron (lead -.gen %.(+.gen expr)) - $ward (lead -.gen %.(+.gen dubs)) - $like (lead -.gen %.(+.gen dubs)) - $cast (lead -.gen %.(+.gen dubs)) - $zinc (lead -.gen %.(+.gen expr)) - $burn (lead -.gen %.(+.gen expr)) - $name (lead -.gen %.(+.gen nexp)) - $lead (lead -.gen %.(+.gen expr)) - $halo (lead -.gen %.(+.gen nexp)) - $help (lead -.gen %.(+.gen nexp)) - $show (lead -.gen %.(+.gen dubs)) - $lurk (lead -.gen %.(+.gen dubs)) - $crap (lead -.gen %.(+.gen (raid expr))) - $fast (lead -.gen %.(+.gen (quad noop expr moan expr))) - $funk (lead -.gen %.(+.gen nexp)) - $thin (lead -.gen %.(+.gen (twin toad expr))) - $hint (lead -.gen %.(+.gen (twin toad expr))) - $poll (lead -.gen %.(+.gen nexp)) - $memo (lead -.gen %.(+.gen nexp)) - $dump (lead -.gen %.(+.gen trip)) - $ddup (lead -.gen %.(+.gen dubs)) - $warn (lead -.gen %.(+.gen (quad noop expr expr expr))) - $peep (lead -.gen %.(+.gen dubs)) - $wad (lead -.gen %.(+.gen (twin expr moar))) - $nub (lead -.gen %.(+.gen expr)) - $dip (lead -.gen %.(+.gen (twin expr moar))) - $fry (lead -.gen %.(+.gen dubs)) - $new (lead -.gen %.(+.gen dubs)) - $fix (lead -.gen %.(+.gen (twin moan expr))) - $var (lead -.gen %.(+.gen (trio tora expr expr))) - $rev (lead -.gen %.(+.gen (trio tora expr expr))) - $set (lead -.gen %.(+.gen trip)) - $huh (lead -.gen %.(+.gen (quad noop expr expr expr))) - $rap (lead -.gen %.(+.gen dubs)) - $nip (lead -.gen %.(+.gen dubs)) - $per (lead -.gen %.(+.gen dubs)) - $sip (lead -.gen %.(+.gen (quad tora noop expr expr))) - $pin (lead -.gen %.(+.gen dubs)) - $tow (lead -.gen %.(+.gen moar)) - $aka (lead -.gen %.(+.gen trip)) - $use (lead -.gen %.(+.gen dubs)) - $or (lead -.gen %.(+.gen moar)) - $case (lead -.gen %.(+.gen (twin noop (moto dubs)))) - $if (lead -.gen %.(+.gen trey)) - $lest (lead -.gen %.(+.gen trey)) - $ifcl (lead -.gen %.(+.gen trip)) - $deny (lead -.gen %.(+.gen dubs)) - $sure (lead -.gen %.(+.gen dubs)) - $deft (lead -.gen %.(+.gen (trio noop expr (moto dubs)))) - $and (lead -.gen %.(+.gen moar)) - $ifat (lead -.gen %.(+.gen trip)) - $ifno (lead -.gen %.(+.gen trip)) - $fits (lead -.gen %.(+.gen (twin expr noop))) - $not (lead -.gen %.(+.gen expr)) - $twig (lead -.gen %.(+.gen dubs)) - $wrap (lead -.gen %.(+.gen expr)) - $spit (lead -.gen %.(+.gen dubs)) - $code (lead -.gen %.(+.gen expr)) - $need (lead -.gen %.(+.gen nexp)) - $fail (lead -.gen %.(+.gen noop)) - == - ++ arms - (raid (twin noop (raid (twin noop heel)))) - :: - ++ bark - |= wof/woof - ?-(wof @ [wof vit], ^ (lead ~ (expr p.wof))) - :: - ++ dubs - (twin expr expr) - :: - ++ expr - |= p/twig - ^$(gen p) - :: - ++ heel - |= bud/foot - ?- -.bud - $ash =^(nex vit ^$(gen p.bud) [[%ash nex] vit]) - $elm =^(nex vit ^$(gen p.bud) [[%elm nex] vit]) - == - :: - ++ lead - |* {sem/@tas out/{* life}} - [[sem -.out] +.out] - :: - ++ moan - (moto nexp) - :: - ++ moar - (moto expr) - :: - ++ moto - |* etc/$-(* {* life}) - |* bud/* - ^+ [bud vit] - ?: =(~ bud) [bud vit] - =^ heb vit (etc -.bud) - =^ mor vit $(bud +.bud) - [[heb mor] vit] - :: - ++ nexp - (twin noop expr) - :: - ++ noop - |* bud/* - [bud vit] - :: - ++ quad - |* $: one/$-(* {* life}) - two/$-(* {* life}) - tri/$-(* {* life}) - qua/$-(* {* life}) - == - |* bud/* - =^ yal vit (one -.bud) - =^ ves vit (two +<.bud) - =^ jot vit (tri +>-.bud) - =^ wip vit (qua +>+.bud) - [[yal ves jot wip] vit] - :: - ++ raid - |* etc/$-(* {* life}) - |* bud/* - ^+ [bud vit] - ?: =(~ bud) [bud vit] - =^ lef vit $(bud +<.bud) - =^ ryt vit $(bud +>.bud) - =^ top vit (etc ->.bud) - [[[-<.bud top] lef ryt] vit] - :: - ++ trey - (trio expr expr expr) - :: - ++ trio - |* $: one/$-(* {* life}) - two/$-(* {* life}) - tri/$-(* {* life}) - == - |* bud/* - =^ yal vit (one -.bud) - =^ ves vit (two +<.bud) - =^ jot vit (tri +>.bud) - [[yal ves jot] vit] - :: - ++ trip - (trio noop expr expr) - :: - ++ toad - |= bud/$@(term {p/term q/twig}) - ?@ bud [bud vit] - (lead p.bud (expr q.bud)) - :: - ++ tora - (twin noop twee) - :: - ++ tung - |= bud/{p/wain q/$@(term tune)} - ?@ q.bud [bud vit] - (lead p.bud %.(q.bud (twin (raid (twin noop twee)) (moto expr)))) - :: - ++ twee - |= bud/(unit twig) - ?~ bud [~ vit] - (lead ~ (expr u.bud)) - :: - ++ twin - |* {one/$-(* {* life}) two/$-(* {* life})} - |* bud/* - =^ yal vit (one -.bud) - =^ ves vit (two +.bud) - [[yal ves] vit] + ?: =([~ ~ ~ ~] wit) `[gen wit] + =< apex + |% + ++ apex + ^- (unit (pair twig whit)) + =^ one wit prim + =^ two wit senc(gen one) + ?: =(gen two) + ~ + `(aid & two wit) + :: + :: resolve body and label issues + :: + ++ prim + ^- (pair twig whit) + ?: ?=(^ -.gen) flam + ?+ -.gen flam + $halo flam + $base runk + $leaf runk + $claw runk + $shoe runk + $bank runk + $book runk + $lamb runk + $bush runk + $pick runk + $coat flam + $grow runk + $door ((doof -.gen +>.gen) p.gen) + $gasp ((doof -.gen +>.gen) p.gen) + $corp ((doof -.gen +>.gen) p.gen) + $trap ((doof -.gen +>.gen) p.gen) + $cork ((doof -.gen +>.gen) p.gen) + $loop ((doof -.gen +>.gen) p.gen) + $port ((doof -.gen +>.gen) p.gen) + $gill ((doof -.gen +>.gen) p.gen) + $gate ((doof -.gen +>.gen) p.gen) + $tray ((doof -.gen +>.gen) p.gen) + == + :: + :: resolve variable issues + :: + ++ senc + ^- (pair twig whit) + ?: ?=(^ -.gen) flam + ?+ -.gen flam + $name ((helk -.gen +>.gen) p.gen) + $coat ((helk -.gen +>.gen) p.gen) + $var ((hulp -.gen +>.gen) p.gen) + $rev ((hulp -.gen +>.gen) p.gen) + $sip ((hulp -.gen +>.gen) p.gen) + $aka ((humm -.gen +>.gen) p.gen) + == + :: + ++ flam [gen wit] + ++ grif + |= {cog/term wat/what} + ^- {what whit} + ?: =(~ def) + ?~ boy [wat wit] + [boy wit(boy ~)] + =+ yeb=(~(get by def) cog) + ?~ yeb [wat wit] + [`u.yeb wit(use (~(put in use) cog))] + :: + ++ doof + |* {pif/@tas suf/*} + |= pac/chap + ^- (pair twig whit) + :_ wit(lab ~, boy ~) + =- [pif - suf] + ^- chap + :- ?~(lab p.pac [u.lab ~]) + ?~(boy q.pac boy) + :: + ++ helk + |* {pif/@tas suf/*} + |= got/toga + ^- (pair twig whit) + =^ gef wit (tong got) + [[pif gef suf] wit] + :: + ++ hulp + |* {pif/@tas suf/*} + |= hot/toro + ^- (pair twig whit) + =^ tog wit (tong p.hot) + [[pif [tog q.hot] suf] wit] + :: + ++ humm + |* {pif/@tas suf/*} + |= {cog/term wat/what) + ^- (pair twig whit) + =^ taw wit (grif cog wat) + [[pif [cog taw] suf] wit] + :: + ++ runk + ^- (pair twig whit) + ?~ boy flam + [[%halo boy gen] wit(boy ~)] + :: + ++ tong + |= got/toga + ^- {toga whit} + ?@ got + =^ wat wit (grif got ~) + ?~ wat [got wit] + [[%1 [wat got] [%0 ~]] wit] + ?- -.got + $0 [got wit] + $1 =^ wat wit (grif q.p.got p.p.got) + =^ sub wit $(got q.got) + [[%1 [wat q.p.got] sub] wit] + $2 =^ one wit $(got p.got) + =^ two wit $(got q.got) + [[%2 one two] wit] + == + -- -- -- -- diff --git a/sys/hoon.hoon b/sys/hoon.hoon index 203e484a2..954b80867 100644 --- a/sys/hoon.hoon +++ b/sys/hoon.hoon @@ -1,4 +1,4 @@ -!: :: +:: :: :::: /sys/hoon :: :: :: ~> %slog.[0 leaf+"hoon-assembly"] @@ -9,7 +9,6 @@ :: :: ~% %k.144 ~ ~ :: |% -++ a144 %144 ++ hoon + -- => :: :: @@ -21,7 +20,6 @@ :: ~% %one + ~ |% -++ a144 %144 :: :: :::: 1a: unsigned arithmetic :: :: @@ -207,7 +205,6 @@ :: ~% %two + ~ |% -++ a144 %144 :: :: :::: 2a: unit logic :: :: :: @@ -1724,7 +1721,6 @@ :: :: ~% %tri + ~ |% -++ a144 %144 :: :::: 3a: signed and modular ints :: :: :: @@ -3439,7 +3435,6 @@ %show show == |% -++ a144 %144 :: :::: 4a: exotic bases :: @@ -4538,7 +4533,8 @@ ;~(plug hit hit) ++ nix (boss 256 (star ;~(pose aln cab))) :: ++ nud (shim '0' '9') :: numeric -++ prn ;~(less (just `@`127) (shim 32 256)) +++ prn ;~(less (just `@`127) (shim 32 256)) :: non-control +++ prz ;~(less (just `@`127) (shim 33 256)) :: non-trivial ++ qat ;~ pose :: chars in blockcord prn ;~(less ;~(plug (just `@`10) soz) (just `@`10)) @@ -5359,6 +5355,7 @@ $% {$& p/span} :: leg {$| p/axis q/(set {p/span q/foot})} :: arm == :: +++ pica (pair ? cord) :: & prose, | code ++ palo (pair vein opal) :: wing trace, match ++ pock (pair axis nock) :: changes ++ port (each palo (pair span nock)) :: successful match @@ -5404,6 +5401,7 @@ {$bunt p/root} :: mold default value {$bust p/base} :: bunt base {$dbug p/spot q/twig} :: debug info in trace + {$eror p/tape} :: assembly error {$hand p/span q/nock} :: premade result {$help p/what q/twig} :: annotate image {$halo p/what q/root} :: annotate model @@ -5500,7 +5498,7 @@ {$sip p/toro q/wing r/twig s/twig} :: =^ state machine {$pin p/twig q/twig} :: =+ q w/[p subject] {$tow p/(list twig)} :: =~ twig stack - {$aka p/term q/twig r/twig} :: =* r w/alias p/q + {$aka p/(pair what term) q/twig r/twig} :: =* r w/alias p/q {$use p/twig q/twig} :: =, overload p in q :: :::::: conditionals {$or p/(list twig)} :: ?| loobean or @@ -5568,7 +5566,14 @@ ++ vial ?($read $rite $both $free) :: co/contra/in/bi ++ vair ?($gold $iron $lead $zinc) :: in/contra/bi/co ++ vein (list (unit axis)) :: search trace -++ what (unit (pair cord (list wain))) :: help slogan/sections +++ 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 + == :: +++ what (unit (pair cord (list sect))) :: help slogan/sections ++ wing (list limb) :: search path ++ worm :: compiler cache $: nes/(set ^) :: ++nest @@ -5595,7 +5600,6 @@ %ut ut == |% -++ a144 %144 :: :::: 5a: compiler utilities :: @@ -5867,7 +5871,7 @@ |= gen/twig ^- twig ?- -.tik - $& ?~(p.tik gen [%aka u.p.tik [%wing q.tik] gen]) + $& ?~(p.tik gen [%aka [~ u.p.tik] [%wing q.tik] gen]) $| [%pin ?~(p.tik q.tik [%name u.p.tik q.tik]) gen] == :: @@ -5969,6 +5973,7 @@ (hail [%rock p.sec q.sec]) :: {$plow *} + ?> =(*what wat) $(sec q.sec, wat p.sec) :: {$reed *} @@ -5979,7 +5984,9 @@ {$weed *} (hail (home p.sec)) == - ++ clam ^-(twig [%gate [~ ~] [%base %noun] (whip(gom 7) 6)]) + ++ clam + ^- twig + [%gate [~ ~] [%base %noun] (whip(gom 7) 6)] :: ++ whip |= axe/axis @@ -6117,46 +6124,6 @@ %rake rake == |_ gen/twig - ++ dock :: apply document - |= doc/cord - |^ ^- (unit twig) - =/ rah ^- (each (pair term cord) cord) - (rash doc very) - ?-(-.rah $& (rave p.rah), $| (graf p.rah)) - :: - ++ graf :: apply general doc - |= doc/cord - ^- (unit twig) - =- ?^ q.dep `[%help ~ gen] - `p.dep - ^= dep - ^- (pair twig (unit cord)) - %+ (walk (unit cord)) - `doc - |= {gen/twig vit/(unit cord)} - ^- (unit (pair twig (unit cord))) - :: XX stub - ~ - :: - ++ rave :: apply variable doc - |= {cog/term doc/cord} - ^- (unit twig) - =- ?^ q.dep ~ - `p.dep - ^= dep - ^- (pair twig (unit (pair term cord))) - %+ (walk (unit (pair term cord))) - `[cog doc] - |= {gen/twig vit/(unit (pair term cord))} - ^- (unit (pair twig (unit (pair term cord)))) - :: XX stub - ~ - :: - ++ very :: variable cord rule - %+ pick - ;~(plug sym (cook crip ;~(pfix ;~(plug col ace) (star prn)))) - (cook crip (star prn)) - -- ++ etch ~_ leaf+"etch" |- ^- term @@ -6173,6 +6140,159 @@ * ~ == :: + ++ gi + =| whit + =* wit - + |% + ++ gray + ^- ? + | + :: on reflection, perhaps just obsessive linting + :: + :: ?| ?=(^ lab) + :: ?=(^ boy) + :: |- ^- ? + :: ?~ def | + :: |($(def l.def) $(def r.def) !(~(has in use) p.n.def)) + :: == + :: + ++ grad + |= $: gen/twig + wit/whit + aid/$-({? twig whit} {twig whit}) + == + ^- (unit (pair twig whit)) + =: ^gen gen + ^wit wit + == + ?: =([~ ~ ~ ~] wit) `[gen wit] + =< apex + |% + ++ apex + ^- (unit (pair twig whit)) + =^ one wit prim + =^ two wit senc(gen one) + ?: =(gen two) + ~ + `(aid & two wit) + :: + :: resolve body and label issues + :: + ++ prim + ^- (pair twig whit) + ?: ?=(^ -.gen) flam + ?+ -.gen flam + $halo flam + $base runk + $leaf runk + $claw runk + $shoe runk + $bank runk + $book runk + $lamb runk + $bush runk + $pick runk + $coat flam + $grow runk + $door ((doof -.gen +>.gen) p.gen) + $gasp ((doof -.gen +>.gen) p.gen) + $corp ((doof -.gen +>.gen) p.gen) + $trap ((doof -.gen +>.gen) p.gen) + $cork ((doof -.gen +>.gen) p.gen) + $loop ((doof -.gen +>.gen) p.gen) + $port ((doof -.gen +>.gen) p.gen) + $gill ((doof -.gen +>.gen) p.gen) + $gate ((doof -.gen +>.gen) p.gen) + $tray ((doof -.gen +>.gen) p.gen) + == + :: + :: resolve variable issues + :: + ++ senc + ^- (pair twig whit) + ?: ?=(^ -.gen) flam + ?+ -.gen flam + $name ((helk -.gen +>.gen) p.gen) + $coat ((helk -.gen +>.gen) p.gen) + $var ((hulp -.gen +>.gen) p.gen) + $rev ((hulp -.gen +>.gen) p.gen) + $sip ((hulp -.gen +>.gen) p.gen) + $aka ((humm -.gen +>.gen) p.gen) + == + :: + ++ flam [gen wit] + ++ grif + |= {cog/term wat/what} + ^- {what whit} + ?: =(~ def) + ?~ boy [wat wit] + [boy wit(boy ~)] + =+ yeb=(~(get by def) cog) + ?~ yeb [wat wit] + [`u.yeb wit(use (~(put in use) cog))] + :: + ++ doof + |* {pif/@tas suf/*} + |= pac/chap + ^- (pair twig whit) + :_ wit(lab ~, boy ~) + =- [pif - suf] + ^- chap + :- ?~(lab p.pac [u.lab ~]) + ?~(boy q.pac boy) + :: + ++ helk + |* {pif/@tas suf/*} + |= got/toga + ^- (pair twig whit) + =^ gef wit (tong got) + [[pif gef suf] wit] + :: + ++ hulp + |* {pif/@tas suf/*} + |= hot/toro + ^- (pair twig whit) + =^ tog wit (tong p.hot) + [[pif [tog q.hot] suf] wit] + :: + ++ humm + |* {pif/@tas suf/*} + |= {wat/what cog/term} + ^- (pair twig whit) + =^ taw wit (grif cog wat) + [[pif [taw cog] suf] wit] + :: + ++ runk + ^- (pair twig whit) + ?~ boy flam + [[%halo boy gen] wit(boy ~)] + :: + ++ tong + |= got/toga + ^- {toga whit} + ?@ got + =^ wat wit (grif got ~) + ?~ wat [got wit] + [[%1 [wat got] [%0 ~]] wit] + ?- -.got + $0 [got wit] + $1 =^ wat wit (grif q.p.got p.p.got) + =^ sub wit $(got q.got) + [[%1 [wat q.p.got] sub] wit] + $2 =^ one wit $(got p.got) + =^ two wit $(got q.got) + [[%2 one two] wit] + == + -- + :: + ++ graf + :: ^- (unit twig) + :: =^ nex wit ((walk whit) wit grad) + :: ?:(gray ~ `nex) + =^ nex wit ((walk whit) wit grad) + nex + -- + :: :: not used at present; see comment at $csng in ++open :::: ::++ hail @@ -6211,6 +6331,8 @@ ++ bile =+ sec=boil |- ^- (each line tile) + ?: ?=({$plow *} sec) + $(sec q.sec) ?: ?=({$deet *} sec) $(sec q.sec) ?: ?=({{$deet *} *} sec) @@ -6267,6 +6389,7 @@ {$base *} ~(clam al boil) {$bust *} ~(bunt al %axil p.gen) {$dbug *} q.gen + {$eror *} ~|(p.gen !!) :: {$knit *} :: :+ %per [%name %v %$ 1] :: => v=. @@ -6586,10 +6709,254 @@ ++ walk :: forward traverse |* life/mold |= $: vit/life - mac/$-({twig life} (unit (pair twig life))) + $= mac + $- $: twig + life + $-({? twig life} {twig life}) + == + (unit (pair twig life)) == ^- {twig life} - !! + =/ use & + =< apex + |% + ++ apex + |- ^- {twig life} + =* aid |= {use/? gen/twig vit/life} + ^$(use use, gen gen, vit vit) + =/ gun ?:(use (mac gen vit aid) ~) + ?^ gun u.gun + ?: ?=(^ -.gen) + %.(gen dubs) + ?- -.gen + $$ (lead -.gen %.(+.gen noop)) + $base (lead -.gen %.(+.gen noop)) + $bunt (lead -.gen %.(+.gen expr)) + $bust (lead -.gen %.(+.gen noop)) + $dbug (lead -.gen %.(+.gen nexp)) + $hand (lead -.gen %.(+.gen noop)) + $knit (lead -.gen %.(+.gen (moto bark))) + $leaf (lead -.gen %.(+.gen noop)) + $limb (lead -.gen %.(+.gen noop)) + $lost (lead -.gen %.(+.gen expr)) + $rock (lead -.gen %.(+.gen noop)) + $sand (lead -.gen %.(+.gen noop)) + $tell (lead -.gen %.(+.gen moar)) + $tune (lead -.gen %.(+.gen tung)) + $wing (lead -.gen %.(+.gen noop)) + $yell (lead -.gen %.(+.gen moar)) + $claw (lead -.gen %.(+.gen dubs)) + $shoe (lead -.gen %.(+.gen expr)) + $bank (lead -.gen %.(+.gen moar)) + $book (lead -.gen %.(+.gen moar)) + $lamb (lead -.gen %.(+.gen dubs)) + $bush (lead -.gen %.(+.gen dubs)) + $pick (lead -.gen %.(+.gen moar)) + $coat (lead -.gen %.(+.gen nexp)) + $grow (lead -.gen %.(+.gen expr)) + $door (lead -.gen %.(+.gen (trio noop expr arms))) + $door (lead -.gen %.(+.gen (trio noop expr arms))) + $gasp (lead -.gen %.(+.gen (twin noop dubs))) + $corp (lead -.gen %.(+.gen (twin noop arms))) + $trap (lead -.gen %.(+.gen (twin noop expr))) + $cork (lead -.gen %.(+.gen (trio noop expr arms))) + $loop (lead -.gen %.(+.gen (twin noop expr))) + $port (lead -.gen %.(+.gen (twin noop dubs))) + $gill (lead -.gen %.(+.gen (twin noop dubs))) + $gate (lead -.gen %.(+.gen (twin noop dubs))) + $tray (lead -.gen %.(+.gen (twin noop expr))) + $scon (lead -.gen %.(+.gen dubs)) + $conq (lead -.gen %.(+.gen (quad expr expr expr expr))) + $cons (lead -.gen %.(+.gen dubs)) + $cont (lead -.gen %.(+.gen trey)) + $conl (lead -.gen %.(+.gen moar)) + $conp (lead -.gen %.(+.gen moar)) + $keep (lead -.gen %.(+.gen (twin noop moan))) + $lace (lead -.gen %.(+.gen dubs)) + $call (lead -.gen %.(+.gen (twin expr moar))) + $bake (lead -.gen %.(+.gen (trio noop expr moan))) + $calq (lead -.gen %.(+.gen (quad expr expr expr expr))) + $calt (lead -.gen %.(+.gen trey)) + $open (lead -.gen %.(+.gen (trio noop expr moar))) + $make (lead -.gen %.(+.gen (twin noop moan))) + $wish (lead -.gen %.(+.gen dubs)) + $bump (lead -.gen %.(+.gen expr)) + $nock (lead -.gen %.(+.gen dubs)) + $same (lead -.gen %.(+.gen dubs)) + $deep (lead -.gen %.(+.gen expr)) + $iron (lead -.gen %.(+.gen expr)) + $ward (lead -.gen %.(+.gen dubs)) + $like (lead -.gen %.(+.gen dubs)) + $cast (lead -.gen %.(+.gen dubs)) + $zinc (lead -.gen %.(+.gen expr)) + $burn (lead -.gen %.(+.gen expr)) + $name (lead -.gen %.(+.gen nexp)) + $lead (lead -.gen %.(+.gen expr)) + $halo (lead -.gen %.(+.gen nexp)) + $help (lead -.gen %.(+.gen nexp)) + $show (lead -.gen %.(+.gen dubs)) + $lurk (lead -.gen %.(+.gen dubs)) + $crap (lead -.gen %.(+.gen (raid expr))) + $fast (lead -.gen %.(+.gen (quad noop expr moan expr))) + $funk (lead -.gen %.(+.gen nexp)) + $thin (lead -.gen %.(+.gen (twin toad expr))) + $hint (lead -.gen %.(+.gen (twin toad expr))) + $poll (lead -.gen %.(+.gen nexp)) + $memo (lead -.gen %.(+.gen nexp)) + $dump (lead -.gen %.(+.gen trip)) + $ddup (lead -.gen %.(+.gen dubs)) + $warn (lead -.gen %.(+.gen (quad noop expr expr expr))) + $peep (lead -.gen %.(+.gen dubs)) + $wad (lead -.gen %.(+.gen (twin expr moar))) + $nub (lead -.gen %.(+.gen expr)) + $dip (lead -.gen %.(+.gen (twin expr moar))) + $fry (lead -.gen %.(+.gen dubs)) + $new (lead -.gen %.(+.gen dubs)) + $fix (lead -.gen %.(+.gen (twin moan expr))) + $var (lead -.gen %.(+.gen (trio tora expr expr))) + $rev (lead -.gen %.(+.gen (trio tora expr expr))) + $set (lead -.gen %.(+.gen trip)) + $huh (lead -.gen %.(+.gen (quad noop expr expr expr))) + $rap (lead -.gen %.(+.gen dubs)) + $nip (lead -.gen %.(+.gen dubs)) + $per (lead -.gen %.(+.gen dubs)) + $sip (lead -.gen %.(+.gen (quad tora noop expr expr))) + $pin (lead -.gen %.(+.gen dubs)) + $tow (lead -.gen %.(+.gen moar)) + $aka (lead -.gen %.(+.gen trip)) + $use (lead -.gen %.(+.gen dubs)) + $or (lead -.gen %.(+.gen moar)) + $case (lead -.gen %.(+.gen (twin noop (moto dubs)))) + $if (lead -.gen %.(+.gen trey)) + $lest (lead -.gen %.(+.gen trey)) + $ifcl (lead -.gen %.(+.gen trip)) + $deny (lead -.gen %.(+.gen dubs)) + $sure (lead -.gen %.(+.gen dubs)) + $deft (lead -.gen %.(+.gen (trio noop expr (moto dubs)))) + $and (lead -.gen %.(+.gen moar)) + $ifat (lead -.gen %.(+.gen trip)) + $ifno (lead -.gen %.(+.gen trip)) + $fits (lead -.gen %.(+.gen (twin expr noop))) + $not (lead -.gen %.(+.gen expr)) + $twig (lead -.gen %.(+.gen dubs)) + $wrap (lead -.gen %.(+.gen expr)) + $spit (lead -.gen %.(+.gen dubs)) + $code (lead -.gen %.(+.gen expr)) + $need (lead -.gen %.(+.gen nexp)) + $fail (lead -.gen %.(+.gen noop)) + == + ++ arms + (raid (twin noop (raid (twin noop heel)))) + :: + ++ bark + |= wof/woof + ?-(wof @ [wof vit], ^ (lead ~ (expr p.wof))) + :: + ++ dubs + (twin expr expr) + :: + ++ expr + |= p/twig + ^$(gen p) + :: + ++ heel + |= bud/foot + ?- -.bud + $ash =^(nex vit ^$(gen p.bud) [[%ash nex] vit]) + $elm =^(nex vit ^$(gen p.bud) [[%elm nex] vit]) + == + :: + ++ lead + |* {sem/@tas out/{* life}} + [[sem -.out] +.out] + :: + ++ moan + (moto nexp) + :: + ++ moar + (moto expr) + :: + ++ moto + |* etc/$-(* {* life}) + |* bud/* + ^+ [bud vit] + ?: =(~ bud) [bud vit] + =^ heb vit (etc -.bud) + =^ mor vit $(bud +.bud) + [[heb mor] vit] + :: + ++ nexp + (twin noop expr) + :: + ++ noop + |* bud/* + [bud vit] + :: + ++ quad + |* $: one/$-(* {* life}) + two/$-(* {* life}) + tri/$-(* {* life}) + qua/$-(* {* life}) + == + |* bud/* + =^ yal vit (one -.bud) + =^ ves vit (two +<.bud) + =^ jot vit (tri +>-.bud) + =^ wip vit (qua +>+.bud) + [[yal ves jot wip] vit] + :: + ++ raid + |* etc/$-(* {* life}) + |* bud/* + ^+ [bud vit] + ?: =(~ bud) [bud vit] + =^ lef vit $(bud +<.bud) + =^ ryt vit $(bud +>.bud) + =^ top vit (etc ->.bud) + [[[-<.bud top] lef ryt] vit] + :: + ++ trey + (trio expr expr expr) + :: + ++ trio + |* $: one/$-(* {* life}) + two/$-(* {* life}) + tri/$-(* {* life}) + == + |* bud/* + =^ yal vit (one -.bud) + =^ ves vit (two +<.bud) + =^ jot vit (tri +>.bud) + [[yal ves jot] vit] + :: + ++ trip + (trio noop expr expr) + :: + ++ toad + |= bud/$@(term {p/term q/twig}) + ?@ bud [bud vit] + (lead p.bud (expr q.bud)) + :: + ++ tora + (twin noop twee) + :: + ++ tung + |= bud/{p/what q/$@(term tune)} + ?@ q.bud [bud vit] + (lead p.bud %.(q.bud (twin (raid (twin noop twee)) (moto expr)))) + :: + ++ twee + |= bud/(unit twig) + ?~ bud [~ vit] + (lead ~ (expr u.bud)) + :: + ++ twin + |* {one/$-(* {* life}) two/$-(* {* life})} + |* bud/* + =^ yal vit (one -.bud) + =^ ves vit (two +.bud) + [[yal ves] vit] + -- -- :: :::: 5c: compiler backend and prettyprinter @@ -6676,9 +7043,9 @@ :: ++ buss ~/ %buss - |= {cog/term gen/twig} + |= {{wat/what cog/term} gen/twig} ^- span - [%face [~ [[cog ~ ~ gen] ~ ~] ~] sut] + [%face [wat [[cog ~ ~ gen] ~ ~] ~] sut] :: ++ conk |= got/toga @@ -8634,8 +9001,134 @@ ++ mota %+ cook |=({a/tape b/tape} (rap 3 (weld a b))) ;~(plug (star low) (star hig)) - ++ epic :: to end of line - (cook crip (ifix [;~(plug ace ace) (just `@`10)] (star prn))) + ++ glom + |= {wit/whit taw/whit} + ^- whit + :* ?~(lab.wit lab.taw lab.wit) + ?~(boy.wit boy.taw boy.wit) + (~(uni by def.wit) def.taw) + (~(uni in use.wit) use.taw) + == + ++ docs + |% + :: above core + :: + ++ apex + %+ cook beer + ;~ plug + =/ ron (punt (into noel)) + (punt (ifix [ron ron] (into (step head)))) + ;~(pfix (punt (into null)) (punt body)) + (star fill) + == + :: backward line + :: + ++ apse + ;~ pose + %+ cook + |= a/(each (pair term cord) cord) + ^- whit + ?- -.a + $& [~ ~ [[p.p.a [q.p.a ~]] ~ ~] ~] + $| [~ `[p.a ~] ~ ~] + == + (exit (step (pick fine line))) + (easy *whit) + == + :: + :: + ++ beer + |= $: a/(unit term) + b/(unit (pair cord (list sect))) + c/(list (pair (pair term cord) (list sect))) + == + ^- whit + =/ d + |- ^- (map term (pair cord (list sect))) + ?~ c ~ + =/ e $(c t.c) + (~(put by e) p.p.i.c [q.p.i.c q.i.c]) + [a b d ~] + :: + :: + ++ body + ;~ sfix + ;~ pose + ;~ plug + (into ;~(pfix (punt ;~(plug (star ace) col gar)) (step line))) + (easy ~) + == + ;~ plug + (into (dubs line)) + (rant text) + == + == + (punt (into null)) + == + :: + :: null: blank line + :: line: prose line + :: code: code line + :: text: text line + :: fine: definition line + :: + ++ line (cook crip ;~(plug prz (star prn))) + ++ head ;~(pfix ;~(plug bar bar ace ace cen) sym) + ++ text (pick line code) + ++ code (cook crip (dubs (star prn))) + ++ null (star ace) + ++ noel ;~(pose (step ;~(sfix ;~(plug bar bar) (star ace))) null) + ++ fine ;~(plug sym (cook crip ;~(pfix ;~(plug col ace) (star prn)))) + :: + :: lean: line delimited + :: + ++ lean + |* gyf/rule + |* bod/rule + ;~(pfix ;~(plug col gyf) bod) + :: + :: step: indent + :: + ++ step + |* fel/rule + ;~(pfix ;~(plug ace ace) fel) + :: + :: dubs: double-indent + :: + ++ dubs + |* fel/rule + ;~(pfix ;~(plug ace ace ace ace) fel) + :: + :: into: :> to end of line, consuming following space. + :: + ++ into + |* bod/rule + ;~(sfix ((lean gar) bod) ;~(plug (just `@`10) (punt gap))) + :: + :: exit: :< to end of line, not consuming following space. + :: + ++ exit + |* bod/rule + ;~(pfix (star ace) ((lean gal) bod)) + :: + :: fill: full definition + :: + ++ fill + ;~ sfix + ;~(plug (into (step fine)) (rant (step text))) + (punt (into null)) + == + :: + :: rant: series of sections. + :: + ++ rant + |* sec/rule + %- star + ;~ pfix + (into null) + (plus (into (step sec))) + == + -- :: ++ plex |= gen/twig ^- (unit path) @@ -9559,30 +10052,40 @@ |% ++ boog :: core arms %+ knee [p=*term q=*(pair what foot)] |. ~+ - ;~ pfix lus - ;~ pose - %+ cook - |=({a/$ash b/term c/twig} [b *what a c]) - ;~ gunk - (cold %ash (just '+')) - ;~(pose (cold %$ buc) sym) - loaf - == - :: - %+ cook - |=({a/$elm b/term c/twig} [b *what a c]) - ;~ gunk - (cold %elm (just '-')) - ;~(pose (cold %$ buc) sym) - loaf - == - :: - %+ cook - |=({a/$ash b/term c/root} [b *what a c]) - ;~ gunk - (cold %ash (just '=')) - sym - loan + %+ cook + |= {a/whit b/term c/whit d/foot} + =+ e=(glom a c) + [b boy.e d] + ;~ plug + apex:docs + ;~ pfix lus + ;~ pose + %+ cook + |=({a/$ash b/term c/whit d/twig} [b c a d]) + ;~ plug + (cold %ash (just '+')) + ;~(pfix gap ;~(pose (cold %$ buc) sym)) + apse:docs + ;~(pfix gap loaf) + == + :: + %+ cook + |=({a/$elm b/term c/whit d/twig} [b c a d]) + ;~ plug + (cold %elm (just '-')) + ;~(pfix gap ;~(pose (cold %$ buc) sym)) + apse:docs + ;~(pfix gap loaf) + == + :: + %+ cook + |=({a/$ash b/term c/whit d/root} [b c a d]) + ;~ plug + (cold %ash (just '=')) + ;~(pfix gap sym) + apse:docs + ;~(pfix gap loan) + == == == == @@ -9593,33 +10096,33 @@ ++ wisp :: core tail ?. tol fail %+ sear - |= a/(list (list (pair term (pair what foot)))) + |= a/(list (pair whit (list (pair term (pair what foot))))) =| {b/(map @ tomb) c/@} |- ^- (unit (map @ tomb)) ?~ a `b =/ d =| e/(map term (pair what foot)) |- ^- (unit (map term (pair what foot))) - ?~ i.a `e - ?: ?| (~(has by e) p.i.i.a) + ?~ q.i.a `e + ?: ?| (~(has by e) p.i.q.i.a) |- ^- ? ?: =(0 c) | =. c (dec c) - |((~(has by q:(~(got by b) c)) p.i.i.a) $) + |((~(has by q:(~(got by b) c)) p.i.q.i.a) $) == - :: XX we don't have a good way to annotate - :: postparse construction "syntax" errors + :: XX hokey, refactor this to produce %eror :: - ~&(duplicate-arm+p.i.i.a ~) - $(i.a t.i.a, e (~(put by e) p.i.i.a q.i.i.a)) + ~&(duplicate-arm+p.i.q.i.a ~) + $(q.i.a t.q.i.a, e (~(put by e) p.i.q.i.a q.i.q.i.a)) ?~ d ~ - $(a t.a, b (~(put by b) c [*chap u.d]), c +(c)) + =* hap `chap`[?~(lab.p.i.a ~ [u.lab.p.i.a ~]) boy.p.i.a] + $(a t.a, b (~(put by b) c [hap u.d]), c +(c)) ;~ pose dun ;~ sfix ;~ pose - (most muck ;~(pfix ;~(plug lus bar gap) whap)) - ;~(plug whap (easy ~)) + (most muck ;~(plug apex:docs ;~(pfix ;~(plug lus bar gap) whap))) + ;~(plug ;~(plug (easy *whit) whap) (easy ~)) == ;~(plug gap dun) == @@ -9711,9 +10214,8 @@ ++ expg |.(;~(gunk sym loaf)) :: term and twig ++ exph |.((butt ;~(gunk rope rick))) :: wing, [tile twig]s ++ expi |.((butt ;~(gunk loaf hank))) :: one or more twigs - ++ expj |.(;~(gunk sym rope loaf)) :: term, wing, and twig ++ expk |.(;~(gunk loaf ;~(plug loaf (easy ~)))) :: list of two twigs - ++ expl |.(;~(gunk sym loaf loaf)) :: term, two twigs + ++ expl |.(;~(gunk ;~(plug (easy ~) sym) loaf loaf)) :: term, two twigs ++ expm |.((butt ;~(gunk rope loaf rick))) :: several [tile twig]s ++ expo |.(;~(gunk wise loaf loaf)) :: =; ++ expp |.(;~(gunk (butt rick) loaf)) :: [wing twig]s, twig @@ -9888,58 +10390,33 @@ == :: ++ wise ;~(plug sym (punt ;~(pfix ;~(pose fas tis) wyde))) - ++ wack + ++ wrap + |* fel/rule %+ cook - |= {a/wain b/twig c/(unit cord)} + |= {a/whit b/twig c/whit} ^- twig - =. a ?~(c a [u.c a]) - ?~ a b - [%help ~ b] + ~(graf ~(gi ap b) (glom a c)) + :: + :: XX performance: this makes the parser about 50% slower. + :: because we double-parse most of the spaces in the file. + :: just so we can do a postfix doc-comment. + :: + :: the correct solution to this problem is to unify the + :: parsing of docs with the parsing of comments/spaces. + :: but at this point we're pretty much in parser rewrite. + :: + :: it should go without saying that ++vast needs a rewrite. + :: it dates to 2011. + :: ;~ plug - (star (ifix [;~(plug col gar) (punt gap)] epic)) - ;~(pose (norm | &) long lute ape:(sail &)) - :: - :: XX performance: this makes the parser about 50% slower. - :: because we double-parse most of the spaces in the file. - :: just so we can do a postfix doc-comment. - :: - :: the correct solution to this problem is to unify the - :: parsing of docs with the parsing of comments/spaces. - :: but at this point we're pretty much in parser rewrite. - :: - :: it should go without saying that ++vast needs a rewrite. - :: it dates to 2011. - :: - (punt ;~(pfix ;~(plug (star ace) col gal) epic)) - == - ++ wock - %+ cook - |= {a/wain b/twig c/(unit cord)} - ^- twig - =. a ?~(c a [u.c a]) - ?~ a b - [%help ~ b] - ;~ plug - (star (ifix [;~(plug col gar) (punt gap)] epic)) - ;~(pose (norm & &) scad) - :: - :: XX performance: this makes the parser about 50% slower. - :: because we double-parse most of the spaces in the file. - :: just so we can do a postfix doc-comment. - :: - :: the correct solution to this problem is to unify the - :: parsing of docs with the parsing of comments/spaces. - :: but at this point we're pretty much in parser rewrite. - :: - :: it should go without saying that ++vast needs a rewrite. - :: it dates to 2011. - :: - (punt ;~(pfix ;~(plug (star ace) col gal) epic)) + apex:docs + fel + apse:docs == ++ tall %+ knee *twig :: full tall form - |.(~+((wart wack))) + |.(~+((wart (wrap ;~(pose (norm | &) long lute ape:(sail &)))))) ++ till %+ knee *root :: full tall form - |.(~+((wart wock))) + |.(~+((wart (wrap ;~(pose (norm & &) scad))))) ++ wide %+ knee *twig :: full wide form |.(~+((wart ;~(pose (norm | |) long ape:(sail |))))) ++ wyde %+ knee *root :: full wide form From 68f6de549a6ccdd286c3b593bca309de03d013c7 Mon Sep 17 00:00:00 2001 From: "C. Guy Yarvin" Date: Sat, 15 Apr 2017 16:34:43 -0700 Subject: [PATCH 06/14] Update |^ duplicate detection. This is the final change in the coherent-cords section. This commit is matched to VM be0ed9dbda81328070a6ace9fd87acf3ad7bce05, the final commit on cgyarvin/coherent-cords-final. It boots with a pill whose md5 is 45111f732e40e3d25c761268883eb412. --- sys/hoon.hoon | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/hoon.hoon b/sys/hoon.hoon index 954b80867..bb1aae039 100644 --- a/sys/hoon.hoon +++ b/sys/hoon.hoon @@ -10228,8 +10228,12 @@ ++ expw |.(;~(gunk rope loaf loaf loaf)) :: wing and three twigs ++ expx |. ;~ gunk loaf :: twig and core tail %+ sear :: - |= a/(map term foot) :: - ?:((~(has by a) %$) ~ [~ u=a]) :: (with no $ arm) + |= a/(map @ tomb) :: + ^- (unit (map @ tomb)) :: + =* fir (~(got by a) 0) :: + ?: (~(has by q.fir) %$) :: %$ in first chapter + ~ :: + [~ u=a] :: wisp :: == :: ++ expz |.(loaf(bug &)) :: twig with tracing From d5f32f972ab4646de577dbea56618223cfb1655a Mon Sep 17 00:00:00 2001 From: Elliot Glaysher Date: Sun, 7 May 2017 15:45:26 -0700 Subject: [PATCH 07/14] Change title specifier from `||` to `#`. --- gen/deco.hoon | 56 ++++++++++++++++++++++++++------------------------- sys/hoon.hoon | 4 ++-- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/gen/deco.hoon b/gen/deco.hoon index 757553475..a263bc20c 100644 --- a/gen/deco.hoon +++ b/gen/deco.hoon @@ -5,26 +5,26 @@ :: all lines must be under 80 characters. no blank lines. :: any line longer than 60 characters is probably too long. :: uppercase or non-ascii letters are strongly discouraged. -:: +:: :: informal comments (lines with {::}) should be used only for -:: meta-discussion *about* the code. +:: meta-discussion *about* the code. :: :: whenever possible, use formal decorations. {:>} decorates :: the next expression; {:<} decorates the previous one. :: -:: there are two places to put decorations: in line with the +:: there are two places to put decorations: in line with the :: code, and on the right margin. :: :: in comments and decorations, use *phrase* for emphasis -:: and {braces} to surround code literals. (documentation will +:: and {braces} to surround code literals. (documentation will :: eventually be automatically generated from formal comments.) -:: %literal, ++literal, ~ship need no braces. for a valid +:: %literal, ++literal, ~ship need no braces. for a valid :: hoon expression, `exp. :: :: there are three conventions for naming: *ultralapidary*, :: *lapidary*, and *natural*. this file is mostly natural. :: -:: when in doubt, use the *natural* naming convention. for +:: when in doubt, use the *natural* naming convention. for :: both arms and faces, natural naming means long, legible, :: english-language phrases, in hyphen-separated {kebab-case}. :: @@ -34,7 +34,7 @@ :: :: ultralapidary conventions use single-letter names starting :: with {a}. use this convention only for one-liners, etc. -:: +:: :: the file below is a medium-sized generator, built around :: a typical two-core structure. the cores are labeled {%arch} :: (structures) and {%work} (productions). this is canonical. @@ -46,15 +46,15 @@ :: a forward decoration block {:>} is either a *document block* or :: a *definition block*. -:: a document block has two parts, each of which is optional: -:: the *title* and the *body*, +:: a document block has two parts, each of which is optional: +:: the *title* and the *body*, :: -:: the title is a ++term preceded by {:> || %}. only cores +:: the title is a ++term preceded by {:> # %}. only cores :: and core chapters (preceded by {+|}) can use titles. titles -:: are optionally surrounded by blank or semi-blank decorations, -:: {:>} or {:> ||}. +:: are optionally surrounded by blank or semi-blank decorations, +:: {:>} or {:> #}. :: -:: the body is either short or long. a short body is a *single line* +:: the body is either short or long. a short body is a *single line* :: preceded by {:> } - ie, not indented. a long body starts with :: a *single line* indented by two extra spaces, {:> }, then a :: blank line, then a series of paragraphs. @@ -78,9 +78,9 @@ :- %say |= * =< [%noun (say-hello %world)] -=> :> || - :> || %arch - :> || +=> :> # + :> # %arch + :> # :> structures for our imaginary hello, world generator. :> :> nothing forces us to put structures in a separate core. @@ -94,11 +94,9 @@ :> most code will not need its own patterns. but put them :> in a separate chapter (separated by {+|}). |% - :> || - :> || %model - :> || + :> # %model :> models (molds) are functions that normalize nouns. - :> + :> :> arms producing molds are introduced with {+=}. for molds, :> we decorate the mold rather than the arm. the compiler :> will copy the mold decoration onto the arm. @@ -116,7 +114,10 @@ {$pear p/@ q/@} :< good for cider {$acai p/@} :< aztec superfood == - :> || %pattern + :> # + :> # %pattern + :> # + :> :> patterns are functions that build models. :> :> other languages might call these "type constructors" @@ -125,16 +126,17 @@ ++ binary-tree :< tree pattern |* a/$-(* *) $@($~ {n/a l/(binary-tree a) r/(binary-tree a)}) - :> || - :> || %constant - :> || + :> # + :> # %constant + :> # :> if you have constants, put them in their own chapter. +| ++ answer :< answer to everything 42 -- -:> || %work -:> engines for our imaginary hello, world app. +:> # %work +:> +:> engines for our imaginary hello, world app. :> :> note that ++say-goodbye is the correct notation, even though :> it's a {+-} arm. @@ -152,7 +154,7 @@ :> :> some paragraphs about the goodbye algorithm, possibly :> including code indented by four extra spaces: -:> +:> :> ?: =(%hello %world) :> %hello :> %world diff --git a/sys/hoon.hoon b/sys/hoon.hoon index bb1aae039..03e01a520 100644 --- a/sys/hoon.hoon +++ b/sys/hoon.hoon @@ -9073,11 +9073,11 @@ :: fine: definition line :: ++ line (cook crip ;~(plug prz (star prn))) - ++ head ;~(pfix ;~(plug bar bar ace ace cen) sym) + ++ head ;~(pfix ;~(plug hax ace ace cen) sym) ++ text (pick line code) ++ code (cook crip (dubs (star prn))) ++ null (star ace) - ++ noel ;~(pose (step ;~(sfix ;~(plug bar bar) (star ace))) null) + ++ noel ;~(pose (step ;~(sfix hax (star ace))) null) ++ fine ;~(plug sym (cook crip ;~(pfix ;~(plug col ace) (star prn)))) :: :: lean: line delimited From de2ed36fbed75ee5facd6bbd2771d6402d9f745e Mon Sep 17 00:00:00 2001 From: Elliot Glaysher Date: Sun, 21 May 2017 15:43:23 -0700 Subject: [PATCH 08/14] Unified `#` syntax for documentation. --- app/dojo.hoon | 553 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 550 insertions(+), 3 deletions(-) diff --git a/app/dojo.hoon b/app/dojo.hoon index c8dfa5861..7c5e310bb 100644 --- a/app/dojo.hoon +++ b/app/dojo.hoon @@ -42,6 +42,7 @@ {$poke p/goal} :: poke app {$show p/?($0 $1 $2 $3)} :: print val+span+twig {$verb p/term} :: store variable + {$help p/(list term)} :: look up help == :: ++ dojo-source :: construction node $: p/@ud :: assembly index @@ -170,6 +171,18 @@ (dp-variable (cold %lib lus) ;~(pfix gap dp-hooves)) == == + :: + ;~ pfix hax + ;~ pose + ;~ pfix ace + %+ cook + |= a/(list term) + [[%help a] 0 %ex [%make p=~[[%.y p=1]] q=~]] + (most col sym) + == + (easy [[%help ~] 0 %ex [%make p=~[[%.y p=1]] q=~]]) + == + == :: ;~((glue ace) dp-sink dp-source) (stag [%show %0] dp-source) @@ -461,10 +474,10 @@ $eny ~|(%entropy-is-eternal !!) $now ~|(%time-is-immutable !!) $our ~|(%self-is-immutable !!) - $lib + $lib .(lib ((dy-cast (list hoof:ford) !>(*(list hoof:ford))) q.cay)) :: - $sur + $sur .(sur ((dy-cast (list hoof:ford) !>(*(list hoof:ford))) q.cay)) :: $dir =+ ^= pax ^- path @@ -478,7 +491,14 @@ rose+[" " `~]^~[leaf+"=%" (smyt (en-beam he-beak s.dir))] == :: - $poke + $help + :: =* type +.p.mad + :: ?~ type + :: (dy-show-help-overview p.q.cay) + (dy-inspect +.p.mad p.q.cay) +:: (dy-show-help-for-topic type p.q.cay) + :: + $poke %- he-card(poy ~) :* %deal /poke @@ -537,6 +557,526 @@ t=(turn `wain`?~(r.hit ~ (to-wain:format q.u.r.hit)) trip) == :: + ++ dy-inspect + |= {topic/(list term) sut/span} + %+ dy-rash %tan + |^ ^- tang + =+ to-display=(find-item-in-span (flop topic) sut) + ?~ to-display + [%leaf "Could not find help"]~ + (flop (print-item u.to-display)) + :> # %models + +| + :: + :> an overview of all named things in the span. + :> + :> each item in the overview list is either a documentation for a sublist + :> or an association between a term and documentation for it. + ++ overview (list overview-item) + :: + :> in instance in the ++overview list. + ++ overview-item + $% :> a header {doc} which will indent its {children}. + {$header doc/what children/overview} + :> an item in a list with {name} and {docs}. + {$item name/tape doc/what} + == + :: + :> the part of a {span} being inspected. + ++ item + $% :> overview of span + {$view items/overview} + :> inspecting a full core. + $: $core + name/tape + docs/what + r/span + con/coil + children/(unit item) + == + :> inspecting a single arm on a core. + $: $arm + name/tape + docs/what + r/span + con/coil + == + :> inspecting a single chapter on a core. + $: $chapter + name/tape + docs/what + con/coil + chapter-id/@ + == + :> inspecting a face and what's behind it. + $: $face + name/tape + docs/what + children/(unit item) + == + == + :> # + :> # %searching + :> # + :> functions which find what to print + +| + :> returns the item to print while searching through {topic}. + :> + :> this gate is called recursively to find the path {topic} in the span + :> {sut}. once it finds the correct part of the span, it switches to + :> ++build-inspectable-recursively to describe that part of the span. + ++ find-item-in-span + |= {topics/(list term) sut/span} + ^- (unit item) + ?~ topics + :: we have no more search path. return the rest as an overview + (build-inspectable-recursively sut) + ?- sut + {$atom *} ~ + :: + {$cell *} + =+ lhs=$(sut p.sut) + ?~ lhs + $(sut q.sut) + lhs + :: + {$core *} + =+ core-docs=r.q.sut + ?~ p.core-docs + :: todo: this core has no toplevel documentation. it might have + :: an arm though. check that next. + $(sut p.sut) + ?~ (find `(list term)`[i.topics ~] p.core-docs) + :: the current topic isn't the toplevel core topic. + =+ arm-docs=(find-arm-in-coil i.topics q.sut) + ?~ arm-docs + :: the current topic is neither the name of the core or an arm + :: on the core. + $(sut p.sut) + `[%arm (trip i.topics) u.arm-docs p.sut q.sut] + ?~ t.topics + :: we matched the core name and have no further search terms. + =* compiled-against (build-inspectable-recursively p.sut) + `[%core (trip i.topics) q.core-docs p.sut q.sut compiled-against] + :: search the core for chapters. + =/ tombs/(list (pair @ tomb)) (~(tap by q.s.q.sut)) + |- + ^- (unit item) + ?~ tombs + ~ + ?~ (find `(list term)`[i.t.topics ~] p.p.q.i.tombs) + :: this isn't the topic. + $(tombs t.tombs) + `[%chapter (trip i.t.topics) q.p.q.i.tombs q.sut p.i.tombs] + :: + {$face *} + ?. ?=(term q.p.sut) + :: todo: is there something we could do if we have a tune? + ~ + ?. =(i.topics q.p.sut) + :: this face has a name, but it's not the name we're looking for. + ~ + ?~ t.topics + `[%face (trip q.p.sut) p.p.sut (build-inspectable-recursively q.sut)] + (find-item-in-span t.topics q.sut) + :: + {$fork *} + =/ spans/(list span) (~(tap in p.sut)) + |- + ?~ spans + ~ + =+ res=(find-item-in-span topics i.spans) + ?~ res + $(spans t.spans) + res + :: + {$help *} + :: while we found a raw help, it's associated on the wrong side of a + :: set of topics. Walk through it instead of showing it. + (find-item-in-span t.topics q.sut) + :: + {$hold *} $(sut (~(play ut p.sut) q.sut)) + $noun ~ + $void ~ + == + :: + :> changes a {span} into an {item}. + ++ build-inspectable-recursively + |= sut/span + ^- (unit item) + ?- sut + :: + {$atom *} ~ + :: + {$cell *} + %+ join-items + (build-inspectable-recursively p.sut) + (build-inspectable-recursively q.sut) + :: + {$core *} + =/ name/term + ?~ p.r.q.sut + '' + i.p.r.q.sut + =* compiled-against (build-inspectable-recursively p.sut) + `[%core (trip name) q.r.q.sut p.sut q.sut compiled-against] + :: + {$face *} + ?. ?=(term q.p.sut) + :: todo: can we do anything here if this face doesn't have a term? + ~ + =* compiled-against (build-inspectable-recursively q.sut) + `[%face (trip q.p.sut) p.p.sut compiled-against] + :: + {$fork *} + =/ spans (~(tap in p.sut)) + =/ items (turn spans build-inspectable-recursively) + (roll items join-items) + :: + {$help *} + =* rest-span (build-inspectable-recursively q.sut) + `[%view [%header p.sut (item-as-overview rest-span)]~] + :: + {$hold *} $(sut (~(play ut p.sut) q.sut)) + $noun ~ + $void ~ + == + :: + :> combines two {(unit item)} together + ++ join-items + |= {lhs/(unit item) rhs/(unit item)} + ^- (unit item) + ?~ lhs rhs + ?~ rhs lhs + `[%view (weld (item-as-overview lhs) (item-as-overview rhs))] + :: + :> changes an item into an overview. + ++ item-as-overview + |= uit/(unit item) + ^- overview + ?~ uit ~ + =+ itm=u.uit + ?- itm + :: + {$view *} + items.itm + :: + {$core *} + ?~ name.itm + (item-as-overview children.itm) + :- [%item name.itm docs.itm] + (item-as-overview children.itm) + :: + {$arm *} + [%item name.itm docs.itm]~ + :: + {$chapter *} + [%item name.itm docs.itm]~ + :: + {$face *} + ?~ name.itm + ~ + [%item name.itm docs.itm]~ + == + :: + :> translate the internals of a core's {tomb} into an {overview}. + ++ arms-as-overview + |= a/(map term (pair what foot)) + ^- overview + %+ turn (~(tap by a)) + |= (pair term (pair what foot)) + [%item (weld "++" (trip p)) p.q] + :: + :> if {arm-name} is an arm in {c}, returns its documentation. + ++ find-arm-in-coil + |= {arm-name/term con/coil} + ^- (unit what) + =/ tombs (~(tap by q.s.con)) + |- + ?~ tombs + ~ + =+ item=(~(get by q.q.i.tombs) arm-name) + ?~ item + $(tombs t.tombs) + [~ p.u.item] + :: + :> returns an overview for a core's arms and chapters. + :> + :> returns an overview for arms which are part of unnamed chapters, + :> and an overview of the named chapters. + ++ arm-and-chapter-overviews + |= {con/coil core-name/tape} + ^- {overview overview} + =| arm-docs/overview :< documented arms + =| chapter-docs/overview :< documented chapters + =/ tombs (~(tap by q.s.con)) + |- + ?~ tombs + [(sort-overview arm-docs) (sort-overview chapter-docs)] + =* current q.i.tombs + ?~ p.p.current + :: this chapter has no name. add all the foot documentation + :: to arm-docs. + =. arm-docs (weld arm-docs (arms-as-overview q.current)) + $(tombs t.tombs) + :: this chapter has a name. add it to the list of chapters + =. chapter-docs + %+ weld chapter-docs + ^- overview + [%item :(weld (trip i.p.p.current) ":" core-name) q.p.current]~ + $(tombs t.tombs) + :: + :> returns an overview of the arms in a specific chapter. + ++ arms-in-chapter + |= {con/coil chapter-id/@} + ^- overview + =/ chapter-tomb (~(got by q.s.con) chapter-id) + (sort-overview (arms-as-overview q.chapter-tomb)) + :: + :> sort the items. + ++ sort-overview + |= ovr/overview + ^- overview + %+ sort ovr + |= {lhs/overview-item rhs/overview-item} + (aor (get-overview-name lhs) (get-overview-name rhs)) + :: + ++ get-overview-name + |= ovr/overview-item + ?- ovr + {$header *} "" + {$item *} name.ovr + == + :: + :> # + :> # %printing + :> # + :> functions which display output of various types. + +| + ++ print-item + |= itm/item + ^- tang + ?- itm + {$view *} (print-overview items.itm) + {$core *} (print-core +.itm) + {$arm *} (print-arm +.itm) + {$chapter *} (print-chapter +.itm) + {$face *} (print-face +.itm) + == + :: + :> renders the documentation for a full core. + ++ print-core + |= {core-name/tape docs/what spn/span con/coil uit/(unit item)} + ^- tang + =+ [arms chapters]=(arm-and-chapter-overviews con core-name) + ;: weld + (print-header (turn p.r.con trip) q.r.con) + :: + :: todo: figure out how to display the default arm, which should + :: be rendered separately. + :: + ?~ arms + ~ + (print-overview [%header `['arms:' ~] arms]~) + :: + ?~ chapters + ~ + (print-overview [%header `['chapters:' ~] chapters]~) + :: + =+ compiled=(item-as-overview uit) + ?~ compiled + ~ + (print-overview [%header `['compiled against:' ~] compiled]~) + == + :: + :> renders the documentation for a single arm in a core. + ++ print-arm + |= {arm-name/tape doc/what r/span con/coil} + :: todo: use the coil to figure out what this arm is. + ?~ doc + `tang`[%leaf "{arm-name}: (Undocumented)"]~ + %+ weld + `tang`[%leaf "{arm-name}: {(trip p.u.doc)}"]~ + (print-sections q.u.doc) + :: + :> renders the documentation for a chapter in a core. + ++ print-chapter + |= {name/tape docs/what con/coil chapter-id/@} + ;: weld + `tang`[%leaf name]~ + :: + ?~ docs + ~ + (print-sections q.u.docs) + :: + =+ arms=(arms-in-chapter con chapter-id) + ?~ arms + ~ + (print-overview [%header `['arms:' ~] arms]~) + == + :: + :> renders the documentation for a face. + ++ print-face + |= {name/tape docs/what children/(unit item)} + %+ weld + (print-header [name ~] docs) + ?~ children + ~ + (print-item u.children) + :: + :> returns a set of lines from a {chap} + ++ print-header + :: todo: it's weird that (list tape) is the type used for names. + |= {p/(list tape) docs/what} + ^- tang + ?~ p + ?~ docs + [%leaf "(Undocumented)"]~ + %+ weld + `tang`[%leaf "{(trip p.u.docs)}"]~ + (print-sections q.u.docs) + ?~ docs + [%leaf "{i.p}"]~ + %+ weld + `tang`[%leaf "{i.p}: {(trip p.u.docs)}"]~ + (print-sections q.u.docs) + :: + :> renders an overview as {tang} + ++ print-overview + |= ovr/overview + ^- tang + |^ (print-level ovr 0) + ++ print-level + :> indentation: multiply by 2 to get number of spaces. + |= {ovr/overview indentation/@u} + ^- tang + :> max-key-length: length of the longest {item} term. + =/ max-key-length (calculate-max-key-length ovr) + :> output: what we return + =| output/tang + |- + ?~ ovr + output + ?- i.ovr + :: + {$header *} + %= $ + output ;: weld + output + ?~ doc.i.ovr + ~ + `tang`[[%leaf ""] [%leaf "{(trip p.u.doc.i.ovr)}"] ~] + ?~ doc.i.ovr + ~ + (print-sections q.u.doc.i.ovr) + (print-level children.i.ovr (add 1 indentation)) + == + ovr t.ovr + == + :: + {$item *} + =* rendered (render-item indentation max-key-length +.i.ovr) + %= $ + output (weld output rendered) + ovr t.ovr + == + == + :: + :> + ++ calculate-max-key-length + |= ovr/overview + ^- @u + %- dy-longest-tape + (turn ovr get-overview-name) + :: + :> renders a single item line with the given indentation level. + ++ render-item + |= {indentation/@u max-key-length/@u name/tape docs/what} + ^- tang + =+ spaces=(mul indentation 2) + =+ line=(weld (dy-build-space spaces) name) + =+ line-len=(lent line) + =+ name-len=(lent name) + =+ diff=(sub max-key-length name-len) + =? line (gth diff 0) + (weld line (dy-build-space diff)) + =/ slogan/tape + ?~ docs + ~ + (trip p.u.docs) + =? line !=(0 (lent slogan)) + ;: weld + line + " : " + (dy-truncate (sub 80 :(add 1 spaces line-len)) slogan) + == + [%leaf line]~ + -- + :: + :> renders a list of sections as {tang} + :> + :> prints the longform documentation. + ++ print-sections + |= sections/(list sect) + ^- tang + =| output/tang + |- + ?~ sections + output + =. output ;: weld + output + `tang`[%leaf ""]~ + (print-section i.sections) + == + $(sections t.sections) + :: + :> renders an individual {sect} to a {tang} + ++ print-section + |= section/sect + ^- tang + %+ turn section + |= pica + ^- tank + ?: p + [%leaf (trip q)] + [%leaf " {(trip q)}"] + -- + :: + :> truncates `t` down to `i` characters, adding an ellipsis. + ++ dy-truncate + :: todo: when ~palfun's string library is landed, switch to his + :: implementation. + |= {i/@u t/tape} + ^- tape + =+ t-len=(lent t) + ?: (lth t-len i) + t + :(weld (scag (sub i 4) t) "...") + :: + :> creates a tape of i spaces, used for padding. + ++ dy-build-space + :: todo: when ~palfun's string library is landed, switch to his + :: implementation. + |= i/@u + ^- tape + =| t/tape + |- + ?: =(0 i) + t + $(t (weld " " t), i (sub i 1)) + :: + :> returns the length of the longest tape in c. + ++ dy-longest-tape + |= c/(list tape) + =| ret/@ud + |- + ?~ c + ret + =+ l=(lent i.c) + ?: (gth l ret) + $(ret l, c t.c) + $(c t.c) + :: ++ dy-show-span-noun |= a/span ^- tank =- >[-]< @@ -653,6 +1193,13 @@ ?~(b !>([~ ~]) (dy-vase p.u.b)) :: ++ dy-twig-head :: dynamic state + :: todo: how do i separate the toplevel 'dojo state' comment? + :> dojo state + :> + :> our: the name of this urbit + :> now: the current time + :> eny: a piece of random entropy + :> ^- cage :- %noun =+ sloop=|=({a/vase b/vase} ?:(=(*vase a) b ?:(=(*vase b) a (slop a b)))) From 45cb25f0ddc2fb7b40d6a87dc154b07f89f6100b Mon Sep 17 00:00:00 2001 From: Elliot Glaysher Date: Wed, 24 May 2017 21:32:50 -0700 Subject: [PATCH 09/14] Now with minimal arm documentation. --- app/dojo.hoon | 75 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 47 insertions(+), 28 deletions(-) diff --git a/app/dojo.hoon b/app/dojo.hoon index 7c5e310bb..39b8f47be 100644 --- a/app/dojo.hoon +++ b/app/dojo.hoon @@ -598,8 +598,8 @@ $: $arm name/tape docs/what + f/foot r/span - con/coil == :> inspecting a single chapter on a core. $: $chapter @@ -648,12 +648,12 @@ $(sut p.sut) ?~ (find `(list term)`[i.topics ~] p.core-docs) :: the current topic isn't the toplevel core topic. - =+ arm-docs=(find-arm-in-coil i.topics q.sut) - ?~ arm-docs + =+ arm=(find-arm-in-coil i.topics q.sut) + ?~ arm :: the current topic is neither the name of the core or an arm :: on the core. $(sut p.sut) - `[%arm (trip i.topics) u.arm-docs p.sut q.sut] + `[%arm (trip i.topics) p.u.arm q.u.arm p.sut] ?~ t.topics :: we matched the core name and have no further search terms. =* compiled-against (build-inspectable-recursively p.sut) @@ -790,7 +790,7 @@ :> if {arm-name} is an arm in {c}, returns its documentation. ++ find-arm-in-coil |= {arm-name/term con/coil} - ^- (unit what) + ^- (unit (pair what foot)) =/ tombs (~(tap by q.s.con)) |- ?~ tombs @@ -798,7 +798,7 @@ =+ item=(~(get by q.q.i.tombs) arm-name) ?~ item $(tombs t.tombs) - [~ p.u.item] + [~ u.item] :: :> returns an overview for a core's arms and chapters. :> @@ -891,23 +891,42 @@ :: :> renders the documentation for a single arm in a core. ++ print-arm - |= {arm-name/tape doc/what r/span con/coil} - :: todo: use the coil to figure out what this arm is. - ?~ doc - `tang`[%leaf "{arm-name}: (Undocumented)"]~ + |= {arm-name/tape doc/what f/foot sut/span} + :: ok, so i misunderstood how this works. in case of something like a + :: constant: + :: + :: ++ forty-two + :: :> the answer + :: 42 + :: + :: the %help never shows up in the span. + :: + :: todo: need to get the sample here. also hoist this to the general + :: core printing machinery, too. + =/ foot-span (~(play ut sut) p.f) + :: ~& [%foot-span foot-span] + =/ product/what + ?+ foot-span ~ + {$help *} p.foot-span + {$core *} q.r.q.foot-span + == %+ weld - `tang`[%leaf "{arm-name}: {(trip p.u.doc)}"]~ - (print-sections q.u.doc) + (print-header [arm-name ~] doc) + ?~ product + ~ + %+ weld + `tang`[[%leaf ""] [%leaf "product:"] ~] + (print-header ~ product) :: :> renders the documentation for a chapter in a core. ++ print-chapter - |= {name/tape docs/what con/coil chapter-id/@} + |= {name/tape doc/what con/coil chapter-id/@} ;: weld - `tang`[%leaf name]~ + (print-header [name ~] doc) :: - ?~ docs + ?~ doc ~ - (print-sections q.u.docs) + (print-sections q.u.doc) :: =+ arms=(arms-in-chapter con chapter-id) ?~ arms @@ -917,9 +936,9 @@ :: :> renders the documentation for a face. ++ print-face - |= {name/tape docs/what children/(unit item)} + |= {name/tape doc/what children/(unit item)} %+ weld - (print-header [name ~] docs) + (print-header [name ~] doc) ?~ children ~ (print-item u.children) @@ -927,19 +946,19 @@ :> returns a set of lines from a {chap} ++ print-header :: todo: it's weird that (list tape) is the type used for names. - |= {p/(list tape) docs/what} + |= {p/(list tape) doc/what} ^- tang ?~ p - ?~ docs + ?~ doc [%leaf "(Undocumented)"]~ %+ weld - `tang`[%leaf "{(trip p.u.docs)}"]~ - (print-sections q.u.docs) - ?~ docs + `tang`[%leaf "{(trip p.u.doc)}"]~ + (print-sections q.u.doc) + ?~ doc [%leaf "{i.p}"]~ %+ weld - `tang`[%leaf "{i.p}: {(trip p.u.docs)}"]~ - (print-sections q.u.docs) + `tang`[%leaf "{i.p}: {(trip p.u.doc)}"]~ + (print-sections q.u.doc) :: :> renders an overview as {tang} ++ print-overview @@ -991,7 +1010,7 @@ :: :> renders a single item line with the given indentation level. ++ render-item - |= {indentation/@u max-key-length/@u name/tape docs/what} + |= {indentation/@u max-key-length/@u name/tape doc/what} ^- tang =+ spaces=(mul indentation 2) =+ line=(weld (dy-build-space spaces) name) @@ -1001,9 +1020,9 @@ =? line (gth diff 0) (weld line (dy-build-space diff)) =/ slogan/tape - ?~ docs + ?~ doc ~ - (trip p.u.docs) + (trip p.u.doc) =? line !=(0 (lent slogan)) ;: weld line From 02917e68a562736a1047cb83474fb3018f03d0ad Mon Sep 17 00:00:00 2001 From: Elliot Glaysher Date: Mon, 29 May 2017 10:17:36 -0700 Subject: [PATCH 10/14] Fix sloe so that it is chapter aware. --- sys/hoon.hoon | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/hoon.hoon b/sys/hoon.hoon index 03e01a520..0a330a43d 100644 --- a/sys/hoon.hoon +++ b/sys/hoon.hoon @@ -8938,7 +8938,11 @@ ?+ typ ~ {$hold *} $(typ ~(repo ut typ)) {$core *} - (turn (~(tap by q.s.q.typ) ~) |=({a/term *} a)) + %- zing + %+ turn (~(tap by q.s.q.typ) ~) + |= {* b/tomb} + %+ turn (~(tap by q.b) ~) + |=({a/term *} a) == :: ++ slop :: cons two vases From ef2b87251cdd5a1a047327a5fa6f337118abdbee Mon Sep 17 00:00:00 2001 From: Elliot Glaysher Date: Sat, 3 Jun 2017 09:42:30 -0700 Subject: [PATCH 11/14] ++chap should have an (unit term) instead of a (list term). --- app/dojo.hoon | 33 ++++++++++++++++----------------- sys/hoon.hoon | 13 +++++++------ 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/app/dojo.hoon b/app/dojo.hoon index 39b8f47be..ca7c106bc 100644 --- a/app/dojo.hoon +++ b/app/dojo.hoon @@ -646,7 +646,7 @@ :: todo: this core has no toplevel documentation. it might have :: an arm though. check that next. $(sut p.sut) - ?~ (find `(list term)`[i.topics ~] p.core-docs) + ?: !=(i.topics u.p.core-docs) :: the current topic isn't the toplevel core topic. =+ arm=(find-arm-in-coil i.topics q.sut) ?~ arm @@ -664,7 +664,10 @@ ^- (unit item) ?~ tombs ~ - ?~ (find `(list term)`[i.t.topics ~] p.p.q.i.tombs) + ?~ p.p.q.i.tombs + :: this has no chapter name. + $(tombs t.tombs) + ?: !=(i.t.topics u.p.p.q.i.tombs) :: this isn't the topic. $(tombs t.tombs) `[%chapter (trip i.t.topics) q.p.q.i.tombs q.sut p.i.tombs] @@ -714,10 +717,7 @@ (build-inspectable-recursively q.sut) :: {$core *} - =/ name/term - ?~ p.r.q.sut - '' - i.p.r.q.sut + =/ name/term (fall p.r.q.sut '') =* compiled-against (build-inspectable-recursively p.sut) `[%core (trip name) q.r.q.sut p.sut q.sut compiled-against] :: @@ -823,7 +823,7 @@ =. chapter-docs %+ weld chapter-docs ^- overview - [%item :(weld (trip i.p.p.current) ":" core-name) q.p.current]~ + [%item :(weld (trip u.p.p.current) ":" core-name) q.p.current]~ $(tombs t.tombs) :: :> returns an overview of the arms in a specific chapter. @@ -870,7 +870,7 @@ ^- tang =+ [arms chapters]=(arm-and-chapter-overviews con core-name) ;: weld - (print-header (turn p.r.con trip) q.r.con) + (print-header (trip (fall p.r.con '')) q.r.con) :: :: todo: figure out how to display the default arm, which should :: be rendered separately. @@ -911,18 +911,18 @@ {$core *} q.r.q.foot-span == %+ weld - (print-header [arm-name ~] doc) + (print-header arm-name doc) ?~ product ~ %+ weld `tang`[[%leaf ""] [%leaf "product:"] ~] - (print-header ~ product) + (print-header "" product) :: :> renders the documentation for a chapter in a core. ++ print-chapter |= {name/tape doc/what con/coil chapter-id/@} ;: weld - (print-header [name ~] doc) + (print-header name doc) :: ?~ doc ~ @@ -938,26 +938,25 @@ ++ print-face |= {name/tape doc/what children/(unit item)} %+ weld - (print-header [name ~] doc) + (print-header name doc) ?~ children ~ (print-item u.children) :: :> returns a set of lines from a {chap} ++ print-header - :: todo: it's weird that (list tape) is the type used for names. - |= {p/(list tape) doc/what} + |= {name/tape doc/what} ^- tang - ?~ p + ?~ name ?~ doc [%leaf "(Undocumented)"]~ %+ weld `tang`[%leaf "{(trip p.u.doc)}"]~ (print-sections q.u.doc) ?~ doc - [%leaf "{i.p}"]~ + [%leaf name]~ %+ weld - `tang`[%leaf "{i.p}: {(trip p.u.doc)}"]~ + `tang`[%leaf "{name}: {(trip p.u.doc)}"]~ (print-sections q.u.doc) :: :> renders an overview as {tang} diff --git a/sys/hoon.hoon b/sys/hoon.hoon index 0a330a43d..9f07a1ffc 100644 --- a/sys/hoon.hoon +++ b/sys/hoon.hoon @@ -5328,7 +5328,7 @@ {$d p/twig} :: take $-(marl marl) {$e p/twig q/(list tuna)} :: element literal == :: -++ chap (pair (list term) what) :: labeled help +++ chap (pair (unit term) what) :: labeled help ++ chum $? lef/term :: jet name {std/term kel/@} :: kelvin version {ven/term pro/term kel/@} :: vendor and product @@ -6238,7 +6238,7 @@ :_ wit(lab ~, boy ~) =- [pif - suf] ^- chap - :- ?~(lab p.pac [u.lab ~]) + :- ?~(lab p.pac [~ u.lab]) ?~(boy q.pac boy) :: ++ helk @@ -8940,9 +8940,10 @@ {$core *} %- zing %+ turn (~(tap by q.s.q.typ) ~) - |= {* b/tomb} - %+ turn (~(tap by q.b) ~) - |=({a/term *} a) + |= {* b/tomb} + %+ turn (~(tap by q.b) ~) + |= {a/term *} + a == :: ++ slop :: cons two vases @@ -10119,7 +10120,7 @@ ~&(duplicate-arm+p.i.q.i.a ~) $(q.i.a t.q.i.a, e (~(put by e) p.i.q.i.a q.i.q.i.a)) ?~ d ~ - =* hap `chap`[?~(lab.p.i.a ~ [u.lab.p.i.a ~]) boy.p.i.a] + =* hap `chap`[?~(lab.p.i.a ~ [~ u.lab.p.i.a]) boy.p.i.a] $(a t.a, b (~(put by b) c [hap u.d]), c +(c)) ;~ pose dun From ea59c322039197ff15b0f7535fa5117ba913222e Mon Sep 17 00:00:00 2001 From: Elliot Glaysher Date: Sun, 11 Jun 2017 21:38:09 -0700 Subject: [PATCH 12/14] Further work on dealing with the documentation in different places. Pausing as right now, it looks like the following doc string isn't in the twig tree after parsing: |% ++ constant :> life, the universe, and everything 42 -- --- app/dojo.hoon | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/app/dojo.hoon b/app/dojo.hoon index ca7c106bc..b70ba47a7 100644 --- a/app/dojo.hoon +++ b/app/dojo.hoon @@ -653,6 +653,7 @@ :: the current topic is neither the name of the core or an arm :: on the core. $(sut p.sut) + ~& [%a arm] `[%arm (trip i.topics) p.u.arm q.u.arm p.sut] ?~ t.topics :: we matched the core name and have no further search terms. @@ -848,6 +849,14 @@ {$item *} name.ovr == :: + ++ what-from-span + |= sut/span + ?+ sut ~ + {$core *} q.r.q.sut + {$help *} p.sut + {$hold *} $(sut (~(play ut p.sut) q.sut)) + == + :: :> # :> # %printing :> # @@ -891,7 +900,7 @@ :: :> renders the documentation for a single arm in a core. ++ print-arm - |= {arm-name/tape doc/what f/foot sut/span} + |= {arm-name/tape arm-doc/what f/foot sut/span} :: ok, so i misunderstood how this works. in case of something like a :: constant: :: @@ -903,20 +912,36 @@ :: :: todo: need to get the sample here. also hoist this to the general :: core printing machinery, too. + ~& [%p-f p.f] =/ foot-span (~(play ut sut) p.f) - :: ~& [%foot-span foot-span] - =/ product/what - ?+ foot-span ~ - {$help *} p.foot-span - {$core *} q.r.q.foot-span - == + ~& [%dy-foot-span (dy-show-span-noun foot-span)] + ~& [%foot-span foot-span] + =/ raw-product/what (what-from-span foot-span) + =/ product-product/what + ?. ?=({$core *} foot-span) + ~ + =* inner-span (~(play ut foot-span) [%limb %$]) + (what-from-span inner-span) + =/ main-doc/what + ?~ arm-doc + raw-product + arm-doc + =/ product-doc/what + ?~ arm-doc + ~ + raw-product + ~& [%arm-doc arm-doc] + ~& [%raw-product raw-product] + ~& [%product-product product-product] + ~& [%main-doc main-doc] + ~& [%product-doc product-doc] %+ weld - (print-header arm-name doc) - ?~ product + (print-header arm-name main-doc) + ?~ product-doc ~ %+ weld `tang`[[%leaf ""] [%leaf "product:"] ~] - (print-header "" product) + (print-header "" product-doc) :: :> renders the documentation for a chapter in a core. ++ print-chapter From 6da39dacda2cb1a4a16d855553dd4afe9debfc1a Mon Sep 17 00:00:00 2001 From: Elliot Glaysher Date: Tue, 13 Jun 2017 21:52:52 -0700 Subject: [PATCH 13/14] Deal with documentation location and cleanup. We can now display all of the following: |% :> documentation goes here ++ arm-one |= a/@ :> real product documentation [...] ++ arm-two :> documentation goes here |= a/@ :> real product documentation [...] :> this gets used ++ arm-three :> this does not get used, but stays with the inner core when copied |= a/@ :> real product documentation [...] -- Non-core arms still don't get product help extracted. --- app/dojo.hoon | 89 +++++++++++++++++++++++++-------------------------- 1 file changed, 43 insertions(+), 46 deletions(-) diff --git a/app/dojo.hoon b/app/dojo.hoon index b70ba47a7..6dda27161 100644 --- a/app/dojo.hoon +++ b/app/dojo.hoon @@ -492,11 +492,7 @@ == :: $help - :: =* type +.p.mad - :: ?~ type - :: (dy-show-help-overview p.q.cay) (dy-inspect +.p.mad p.q.cay) -:: (dy-show-help-for-topic type p.q.cay) :: $poke %- he-card(poy ~) @@ -590,7 +586,7 @@ $: $core name/tape docs/what - r/span + sut/span con/coil children/(unit item) == @@ -599,12 +595,13 @@ name/tape docs/what f/foot - r/span + sut/span == :> inspecting a single chapter on a core. $: $chapter name/tape docs/what + sut/span con/coil chapter-id/@ == @@ -671,7 +668,7 @@ ?: !=(i.t.topics u.p.p.q.i.tombs) :: this isn't the topic. $(tombs t.tombs) - `[%chapter (trip i.t.topics) q.p.q.i.tombs q.sut p.i.tombs] + `[%chapter (trip i.t.topics) q.p.q.i.tombs p.sut q.sut p.i.tombs] :: {$face *} ?. ?=(term q.p.sut) @@ -718,7 +715,7 @@ (build-inspectable-recursively q.sut) :: {$core *} - =/ name/term (fall p.r.q.sut '') + =* name (fall p.r.q.sut '') =* compiled-against (build-inspectable-recursively p.sut) `[%core (trip name) q.r.q.sut p.sut q.sut compiled-against] :: @@ -730,8 +727,8 @@ `[%face (trip q.p.sut) p.p.sut compiled-against] :: {$fork *} - =/ spans (~(tap in p.sut)) - =/ items (turn spans build-inspectable-recursively) + =* spans (~(tap in p.sut)) + =* items (turn spans build-inspectable-recursively) (roll items join-items) :: {$help *} @@ -782,11 +779,12 @@ :: :> translate the internals of a core's {tomb} into an {overview}. ++ arms-as-overview - |= a/(map term (pair what foot)) + |= {a/(map term (pair what foot)) sut/span} ^- overview %+ turn (~(tap by a)) |= (pair term (pair what foot)) - [%item (weld "++" (trip p)) p.q] + =* doc (select-arm-docs p.q q.q sut) + [%item (weld "++" (trip p)) -.doc] :: :> if {arm-name} is an arm in {c}, returns its documentation. ++ find-arm-in-coil @@ -806,7 +804,7 @@ :> returns an overview for arms which are part of unnamed chapters, :> and an overview of the named chapters. ++ arm-and-chapter-overviews - |= {con/coil core-name/tape} + |= {sut/span con/coil core-name/tape} ^- {overview overview} =| arm-docs/overview :< documented arms =| chapter-docs/overview :< documented chapters @@ -818,7 +816,7 @@ ?~ p.p.current :: this chapter has no name. add all the foot documentation :: to arm-docs. - =. arm-docs (weld arm-docs (arms-as-overview q.current)) + =. arm-docs (weld arm-docs (arms-as-overview q.current sut)) $(tombs t.tombs) :: this chapter has a name. add it to the list of chapters =. chapter-docs @@ -829,10 +827,10 @@ :: :> returns an overview of the arms in a specific chapter. ++ arms-in-chapter - |= {con/coil chapter-id/@} + |= {sut/span con/coil chapter-id/@} ^- overview - =/ chapter-tomb (~(got by q.s.con) chapter-id) - (sort-overview (arms-as-overview q.chapter-tomb)) + =* chapter-tomb (~(got by q.s.con) chapter-id) + (sort-overview (arms-as-overview q.chapter-tomb sut)) :: :> sort the items. ++ sort-overview @@ -875,9 +873,9 @@ :: :> renders the documentation for a full core. ++ print-core - |= {core-name/tape docs/what spn/span con/coil uit/(unit item)} + |= {core-name/tape docs/what sut/span con/coil uit/(unit item)} ^- tang - =+ [arms chapters]=(arm-and-chapter-overviews con core-name) + =+ [arms chapters]=(arm-and-chapter-overviews sut con core-name) ;: weld (print-header (trip (fall p.r.con '')) q.r.con) :: @@ -898,6 +896,27 @@ (print-overview [%header `['compiled against:' ~] compiled]~) == :: + ++ select-arm-docs + |= {arm-doc/what f/foot sut/span} + ^- {what what} + :: ~& [%p-f p.f] + =+ foot-span=(~(play ut sut) p.f) + :: ~& [%dy-foot-span (dy-show-span-noun foot-span)] + :: ~& [%foot-span foot-span] + =+ raw-product=(what-from-span foot-span) + =/ product-product/what + ?. ?=({$core *} foot-span) + ~ + =* inner-span (~(play ut foot-span) [%limb %$]) + (what-from-span inner-span) + :- + ?~ arm-doc + raw-product + arm-doc + ?~ arm-doc + product-product + raw-product + :: :> renders the documentation for a single arm in a core. ++ print-arm |= {arm-name/tape arm-doc/what f/foot sut/span} @@ -912,29 +931,7 @@ :: :: todo: need to get the sample here. also hoist this to the general :: core printing machinery, too. - ~& [%p-f p.f] - =/ foot-span (~(play ut sut) p.f) - ~& [%dy-foot-span (dy-show-span-noun foot-span)] - ~& [%foot-span foot-span] - =/ raw-product/what (what-from-span foot-span) - =/ product-product/what - ?. ?=({$core *} foot-span) - ~ - =* inner-span (~(play ut foot-span) [%limb %$]) - (what-from-span inner-span) - =/ main-doc/what - ?~ arm-doc - raw-product - arm-doc - =/ product-doc/what - ?~ arm-doc - ~ - raw-product - ~& [%arm-doc arm-doc] - ~& [%raw-product raw-product] - ~& [%product-product product-product] - ~& [%main-doc main-doc] - ~& [%product-doc product-doc] + =+ [main-doc product-doc]=(select-arm-docs arm-doc f sut) %+ weld (print-header arm-name main-doc) ?~ product-doc @@ -945,7 +942,7 @@ :: :> renders the documentation for a chapter in a core. ++ print-chapter - |= {name/tape doc/what con/coil chapter-id/@} + |= {name/tape doc/what sut/span con/coil chapter-id/@} ;: weld (print-header name doc) :: @@ -953,7 +950,7 @@ ~ (print-sections q.u.doc) :: - =+ arms=(arms-in-chapter con chapter-id) + =+ arms=(arms-in-chapter sut con chapter-id) ?~ arms ~ (print-overview [%header `['arms:' ~] arms]~) @@ -1038,8 +1035,8 @@ ^- tang =+ spaces=(mul indentation 2) =+ line=(weld (dy-build-space spaces) name) - =+ line-len=(lent line) - =+ name-len=(lent name) + =* line-len (lent line) + =* name-len (lent name) =+ diff=(sub max-key-length name-len) =? line (gth diff 0) (weld line (dy-build-space diff)) From 079163c73c0a5741d3e962bd193bf81a70dbbd49 Mon Sep 17 00:00:00 2001 From: Elliot Glaysher Date: Thu, 15 Jun 2017 22:43:22 -0700 Subject: [PATCH 14/14] Documents the dojo patch so far and removes debugging printfs. I figured out why some halos on products are missing: |% ++ broken :> this halo gets ignored. 42 :: ++ working :> this halo gets put into the span properly. ^- @ 42 -- --- app/dojo.hoon | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/app/dojo.hoon b/app/dojo.hoon index 6dda27161..3c38e1d78 100644 --- a/app/dojo.hoon +++ b/app/dojo.hoon @@ -650,7 +650,6 @@ :: the current topic is neither the name of the core or an arm :: on the core. $(sut p.sut) - ~& [%a arm] `[%arm (trip i.topics) p.u.arm q.u.arm p.sut] ?~ t.topics :: we matched the core name and have no further search terms. @@ -896,13 +895,16 @@ (print-overview [%header `['compiled against:' ~] compiled]~) == :: + :> figures out which {what}s to use. + :> + :> there are three places with a relevant {what}: the {arm-doc} on the + :> arm, the {what} in the computed span of the foot, and the {what} on + :> the product of the default arm when the computed span is a core. ++ select-arm-docs |= {arm-doc/what f/foot sut/span} + :> the computed arm documentation and the product documentation. ^- {what what} - :: ~& [%p-f p.f] =+ foot-span=(~(play ut sut) p.f) - :: ~& [%dy-foot-span (dy-show-span-noun foot-span)] - :: ~& [%foot-span foot-span] =+ raw-product=(what-from-span foot-span) =/ product-product/what ?. ?=({$core *} foot-span) @@ -920,15 +922,6 @@ :> renders the documentation for a single arm in a core. ++ print-arm |= {arm-name/tape arm-doc/what f/foot sut/span} - :: ok, so i misunderstood how this works. in case of something like a - :: constant: - :: - :: ++ forty-two - :: :> the answer - :: 42 - :: - :: the %help never shows up in the span. - :: :: todo: need to get the sample here. also hoist this to the general :: core printing machinery, too. =+ [main-doc product-doc]=(select-arm-docs arm-doc f sut)