Merge branch 'test' into demo

This commit is contained in:
Anton Dyudin 2015-06-03 13:23:41 -07:00
commit ca912bc379
10 changed files with 170 additions and 58 deletions

View File

@ -184,6 +184,23 @@
|= gag=gage ^- (list (pair cage cage))
(unwrap-tang (gage-to-tage gag))
::
++ gage-to-success-cages
|= gag=gage
^- (list (pair cage cage))
?. ?=(%tabl -.gag)
(ford-fail ?-(-.gag %| p.gag, %& [>%strange-gage p.p.gag<]~))
%+ murn p.gag
|= [key=gage val=gage] ^- (unit ,[cage cage])
?. ?=(%& -.key)
(ford-fail ?-(-.key %| p.key, %tabl [>%strange-gage<]~))
?- -.val
%tabl (ford-fail >%strange-gage< ~)
%& (some [p.key p.val])
%| =. p.val [(sell q.p.key) p.val]
~> %slog.[0 %*(. >%ford-fail syd %for %why< |2.+> p.val)]
~
==
::
++ gage-to-tage
|= gag=gage
^- (each (list (pair cage cage)) tang)
@ -567,7 +584,7 @@
(apply-edit wen)
+>.$
^- (list (pair path cage))
%+ turn (gage-to-cages res)
%+ turn (gage-to-success-cages res)
|= [pax=cage cay=cage]
?. ?=(%path p.pax)
~|(%clay-take-inserting-strange-path-mark !!)
@ -2749,8 +2766,10 @@
:: ~& >> [pax %ank-kan-sig]
~
:: ~& >> [pax %ank-sig]
=+ =+ (~(tap by dir.u.kan))
:: ~& [%dirukan pax=pax (~(run by dir.u.kan) (cury test ~))]
=+ ?~ dir.u.kan
~
=+ (~(tap by u.dir.u.kan))
:: ~& [%dirukan pax=pax (~(run by u.dir.u.kan) (cury test ~))]
|- ^- (list (pair path miso))
?~ +< ~
?~ q.i $(+< t)
@ -2769,16 +2788,18 @@
-
[[(flop pax) %del q.u.q.u.ank] -]
:: ~& >> [pax %neither-sig]
=+ %+ weld
=+ ?~ dir.u.kan
~
%+ weld
=+ (~(tap by r.u.ank))
|- ^- (list ,[p=path q=miso])
?~ +< ~
=+ (~(get by dir.u.kan) p.i)
=+ (~(get by u.dir.u.kan) p.i)
?: ?=([~ ~] -) $(+< t)
%- weld :_ $(+< t)
:: ~& >> [pax %ankhing p.i ?=(~ -)]
^$(pax [p.i pax], ank `q.i, kan ?~(- ~ `u.u.-))
=+ (~(tap by dir.u.kan))
=+ (~(tap by u.dir.u.kan))
:: ~& > [%sdirukan pax=pax (~(run by dir.u.kan) (cury test ~))]
|- ^- (list ,[p=path q=miso])
?~ +< ~

View File

@ -57,6 +57,7 @@
++ calx :: concrete cache line
$% [%hood p=calm q=(pair beam cage) r=hood] :: compile
[%bake p=calm q=(trel mark beam heel) r=(unit vase)]:: load
[%lilt p=calm q=arch r=(jug mark mark)] :: translation graph
[%slit p=calm q=[p=type q=type] r=type] :: slam type
[%slim p=calm q=[p=type q=twig] r=(pair type nock)]:: mint
[%slap p=calm q=[p=vase q=twig] r=vase] :: compute
@ -81,6 +82,7 @@
?+ sem !!
%hood ?>(?=(%hood -.cax) r.cax)
%bake ?>(?=(%bake -.cax) r.cax)
%lilt ?>(?=(%lilt -.cax) r.cax)
%slap ?>(?=(%slap -.cax) r.cax)
%slam ?>(?=(%slam -.cax) r.cax)
%slim ?>(?=(%slim -.cax) r.cax)
@ -275,6 +277,8 @@
%lime lime
%lima lima
%link link
%lion lion
%lily lily
%lope lope
%make make
%meow meow
@ -435,9 +439,9 @@
%+ cope
|- ^- (bolt (list (pair gage gage)))
?~ p.gag (fine cof ~)
%+ cope (fret ^$(gag q.i.p.gag))
%+ cope (fret ^$(gag q.i.p.gag, cof cof))
|= [cof=cafe val=gage]
%+ cope ^$(p.gag t.p.gag)
%+ cope ^$(p.gag t.p.gag, cof cof)
|= [cof=cafe rex=(list (pair gage gage))]
(fine cof [[p.i.p.gag val] rex])
|= [cof=cafe rex=(list (pair gage gage))]
@ -826,18 +830,24 @@
$(yom t.yom, axe (peg axe 3))
::
++ lace :: load and check
|= [cof=cafe for=mark bem=beam arg=heel]
^- (bolt (unit vase))
|= [cof=cafe for=mark bem=beam]
^- (bolt (unit (burg heel vase)))
%+ cope (lend cof bem)
|= [cof=cafe arc=arch]
?^ q.arc
(cope (cope (liar cof bem) (lake for)) (fest (norm ska bem)))
?: (~(has by r.arc) %hook)
%+ cope (fade cof %hook bem)
|= [cof=cafe hyd=hood]
%+ cope (cope (abut:(meow bem arg) cof hyd) (lake for))
(fest (norm ska bem))
(flue cof)
%+ (fest (norm ska bem)) cof
|=([cof=cafe arg=heel] (cope (liar cof bem) (lake for)))
?. (~(has by r.arc) %hook)
(flue cof)
%+ cope (lend cof bem(s [%hook s.bem]))
|= [cof=cafe arc=arch]
?~ q.arc
(flue cof)
%+ (fest (norm ska bem(s [%hook s.bem]))) cof
|= [cof=cafe arg=heel]
%+ cope (fade cof %hook bem)
|= [cof=cafe hyd=hood]
(cope (abut:(meow bem arg) cof hyd) (lake for))
::
++ lake :: check/coerce
|= for=mark
@ -910,6 +920,7 @@
^- (bolt arch)
=+ von=(save ~ %cy bem)
?~ von [p=cof q=[%1 [%y bem ~] ~ ~]]
:: %+ flag (norm ska bem)
(fine cof ((hard arch) q.q:(need u.von)))
::
++ liar :: load vase
@ -923,40 +934,73 @@
(fine cof q.u.u.von)
::
++ lily :: translation targets
|= [cof=cafe for=mark]
^- (bolt (list ,@tas))
|= [cof=cafe for=mark] ^- (bolt (set ,@tas))
%+ cope (lilt cof)
|= [cof=cafe lil=(jug mark mark)]
(fine cof (~(get ju lil) for))
::
++ lilt
|= cof=cafe ^- (bolt (jug mark mark))
%+ cope (lend cof [bek /mar])
|= [cof=cafe arc=arch]
%+ (clef %lilt) (fine cof arc)
|= [cof=cafe arc=arch]
:: =- =+((cope - |=([cafe lil=(jug mark mark)] ~&(lil=lil (flue cof)))) +<)
=+ all=(~(tap by r.arc))
~! all
|- ^- (bolt (jug mark mark))
?~ all (flue cof)
%+ cope $(cof cof, all t.all)
|= [cof=cafe lil=(jug mark mark)]
=* for p.i.all
=+ raf=(fang cof for)
?: =(%2 -.q.raf) (flue cof)
?: =(%2 -.q.raf) (fine cof lil)
%+ cope raf
|= [cof=cafe vax=vase]
%+ fine cof
%- ~(gas ju lil)
~| weg=(jam 3 p.vax)
%+ weld
^- (list ,@tas)
?. (slob %garb p.vax) ~
=+ gav=((soft (list ,@tas)) q:(slap vax [%cnzy %garb]))
?~(gav ~ u.gav)
^- (list ,[mark mark])
?. (slob %grab p.vax) ~
=+ gab=(slap vax [%cnzy %grab])
:: =+ opt=(skip (sloe p.gap) |=(fro=mark =(fro %noun)))
(turn (sloe p.gab) |=(fro=mark [fro for]))
?. (slob %grow p.vax) ~
=+ gow=(slap vax [%cnzy %grow])
(sort (sloe p.gow) aor)
(turn (sloe p.gow) |=(too=mark [for too]))
::
++ lima :: load at depth
|= [cof=cafe for=mark bem=beam arg=heel]
%+ (clef %bake) [p=cof q=[%0 p=[bem `~] q=[for bem arg]]]
|= [cof=cafe for=mark bem=beam arg=heel]
^- (bolt (unit vase))
%+ cope (lend cof bem)
|= [cof=cafe arc=arch]
^- (bolt (unit vase))
?: (~(has by r.arc) for)
(lace cof for bem(s [for s.bem]) arg)
=+ haz=(turn (~(tap by r.arc) ~) |=([a=@tas b=~] a))
?~ haz (flue cof)
%+ cope (lion cof for haz)
%+ cope
%+ cope (lend cof bem)
|= [cof=cafe arc=arch] ^- (bolt (map mark (burg heel vase)))
?~ r.arc (flue cof)
%+ cope $(r.arc l.r.arc)
|= [cof=cafe lam=(map mark (burg heel vase))]
%+ cope ^$(r.arc r.r.arc, cof cof)
|= [cof=cafe ram=(map mark (burg heel vase))]
=. for p.n.r.arc
%+ cope
?. ((sane %tas) for) (flue cof)
(lace cof for bem(s [for s.bem]))
|= [cof=cafe nod=(unit (burg heel vase))]
%+ fine cof
?^(nod [[for u.nod] lam ram] (~(uni by lam) ram))
|= [cof=cafe mal=(map mark (burg heel vase))]
=+ lit=(~(get by mal) for)
?^ lit
(cope (u.lit cof arg) (fest bem))
=+ opt=(sa (turn (~(tap by mal)) head)) :: XX asymptotics
%+ cope (lion cof for opt)
|= [cof=cafe wuy=(list ,@tas)]
?~ wuy (flue cof)
%+ cope (cope (make cof %bake i.wuy bem arg) furl)
|= [cof=cafe hoc=cage]
%+ cope (lope cof i.wuy t.wuy q.hoc)
%+ cope ((~(got by mal) i.wuy) cof arg)
|= [cof=cafe hoc=vase]
%+ cope (lope cof i.wuy t.wuy hoc)
|= [cof=cafe vax=vase]
((fest bem) cof vax)
::
@ -994,22 +1038,24 @@
`(slap gab [%cnzy for])
?~ zat
(flaw cof [%leaf "ford: no link: {<[for too]>}"]~)
~| [%link-maul for too]
(maul cof u.zat vax)
::
++ lion :: translation search
|= [cof=cafe too=mark fro=(list mark)]
|= [cof=cafe too=mark fro=(set mark)]
:: ~& lion/[too=too fro=(sa fro)]
^- (bolt (list mark))
=| $: war=(map mark (list mark))
pax=(list mark) won=[p=mark q=(qeu mark)]
==
%. [cof fro]
|= [cof=cafe fro=(list mark)] ^- (bolt (list mark))
|= [cof=cafe fro=(set mark)] ^- (bolt (list mark))
?: =(too p.won)
(fine cof (flop pax))
=. fro (skip fro ~(has by war))
=: q.won (~(gas to q.won) fro)
war (~(gas by war) (turn fro |=(mark [+< pax])))
=+ for=(skip (~(tap by fro)) ~(has by war))
=. for (sort for aor) :: XX useful?
=: q.won (~(gas to q.won) for)
war (~(gas by war) (turn for |=(mark [+< pax])))
==
?: =(~ q.won)
(flue cof)
@ -1062,7 +1108,7 @@
==
::
%bake
:: ~& [%bake-start (tope q.kas)]
:: ~& > [p.kas (tope q.kas)]
%+ cool |.(leaf/"ford: bake {<p.kas>} {<(tope q.kas)>}")
%+ cope (lima cof p.kas q.kas r.kas)
|= [cof=cafe vux=(unit vase)]
@ -1110,7 +1156,7 @@
|= [cof=cafe cay=cage]
^- (bolt gage)
%+ cool |.(leaf/"ford: casting {<p.cay>} to {<p.kas>}")
%+ cope (lion cof p.kas p.cay ~)
%+ cope (lion cof p.kas p.cay `~)
|= [cof=cafe wuy=(list ,@tas)]
%+ cope
?~ wuy
@ -1174,11 +1220,11 @@
%+ cope
|- ^- (bolt (list (pair gage gage)))
?~ p.kas (fine cof ~)
%+ cope (make cof p.i.p.kas)
%+ cope (fret (make cof p.i.p.kas))
|= [cof=cafe key=gage]
%+ cope (make cof q.i.p.kas)
%+ cope (fret (make cof q.i.p.kas))
|= [cof=cafe val=gage]
%+ cope ^^$(cof cof, p.kas t.p.kas)
%+ cope ^^$(p.kas t.p.kas, cof cof)
|= [cof=cafe rex=(list (pair gage gage))]
(fine cof [[key val] rex])
|= [cof=cafe rex=(list (pair gage gage))]
@ -1297,7 +1343,7 @@
?~ src (fine cof ..body)
%+ cope (wilt cof i.src)
|= [cof=cafe sel=_..body]
^$(cof cof, src t.src, ..body sel)
^$(src t.src, ..body sel, cof cof)
::
++ chad :: atomic list
|= [cof=cafe bax=vase doe=term hon=horn]
@ -1367,7 +1413,7 @@
%+ cope
|- ^- (bolt (list vase))
?~ p.hon (flue cof)
%+ cope ^$(hon i.p.hon)
%+ cope ^$(cof cof, hon i.p.hon)
|= [cof=cafe vax=vase]
%+ cope ^$(cof cof, p.hon t.p.hon)
|= [cof=cafe tev=(list vase)]

View File

@ -1029,6 +1029,7 @@
%merg `%c
%plug `%c
%them `%e
%wait `%t
%want `%a
%warp `%c
==

View File

@ -2051,6 +2051,14 @@
(~(del by a) b)
(~(put by a) b e)
::
+- gas :: concatenate
|* b=(list ,[p=* q=*])
=> .(b `(list ,_?>(?=([[* ^] ^] a) [p=p q=n.q]:n.a))`b)
|- ^+ a
?~ b
a
$(b t.b, a (put(+< a) p.i.b q.i.b))
::
+- get :: gets set by key
|* b=*
=+ c=(~(get by a) b)

View File

@ -2324,7 +2324,7 @@
::
++ khan ::
$: fil=(unit (unit cage)) :: XX see khan-to-soba
dir=(map ,@ta (unit khan)) ::
dir=(unit (map ,@ta (unit khan))) ::
== ::
++ mick (list ,[path (unit mime)])
++ riff ,[p=desk q=(unit rave)] :: request/desist

View File

@ -0,0 +1,12 @@
::
:::: /hook/gate/reload/hood/cat
::
/? 314
::
::::
!:
|= $: [now=@da eny=@uvI bec=beak]
[arg=(list term) ~]
==
:+ %hood-reload-desk %base
arg

View File

@ -0,0 +1,12 @@
::
:::: /hook/gate/reload/hood/cat
::
/? 314
::
::::
!:
|= $: [now=@da eny=@uvI bec=beak]
[arg=[desk (list term)] ~]
==
:- %hood-reload-desk
arg

View File

@ -0,0 +1,11 @@
::
:::: /hook/gate/reset/hood/cat
::
/? 314
::
::::
!:
|= $: [now=@da eny=@uvI bec=beak]
[arg=~ ~]
==
[%hood-reset ~]

View File

@ -87,7 +87,8 @@
%- emil
%- flop
%+ turn all
=+ ark=(arch .^(%cy /(scot %p our)/[syd]/(scot %da now)/arvo))
=+ top=`path`/(scot %p our)/[syd]/(scot %da now)/arvo
=+ ark=(arch .^(%cy top))
=+ van=(~(tap by r.ark))
|= nam=@tas
=. nam
@ -98,12 +99,9 @@
?> ?=([[@ ~] ~] zaz)
`term`p.i.zaz
=+ tip=(end 3 1 nam)
=+ way=[(scot %p our) %home (scot %da now) %arvo nam %hoon ~]
=+ fil=(,@ .^(%cx way))
:* %flog
/reload
[%veer ?:(=('z' tip) %$ tip) way (,@ .^(%cx way))]
==
=+ way=(welp top /[nam])
=+ fil=(,@ .^(%cx (welp way /hoon)))
[%flog /reload [%veer ?:(=('z' tip) %$ tip) way fil]]
::
++ poke-invite :: send invite; fake
|= [who=@p myl=@t] =< abet

View File

@ -110,7 +110,7 @@ CodeMirror.defineMode("hoon", function() {
}
if(stream.eat('`')){
state.space = false
state.space = true
return 'operator'
}
if(stream.sol() && stream.eatWhile(glyph)){
@ -131,8 +131,10 @@ CodeMirror.defineMode("hoon", function() {
return 'builtin'
return 'operator'
}
if(stream.eat(/[=:.^]/))
if(stream.eat(/[=:.^]/)){
state.space = true
return 'operator'
}
stream.next()
return 'builtin'
}
@ -154,4 +156,5 @@ CodeMirror.defineMode("hoon", function() {
return res
});
CodeMirror.registerHelper("wordChars", "hoon", /[-\\w]/);
CodeMirror.defineMIME("text/x-hoon", "hoon");