Merge branch 'demo' of https://github.com/urbit/urbit into demo

This commit is contained in:
C. Guy Yarvin 2015-06-03 14:12:53 -07:00
commit 7d4bc90020
14 changed files with 194 additions and 83 deletions

View File

@ -6,13 +6,8 @@
/- *talk, *bit-api
/+ talk, sole, http, mean
!:
:::: sivtyv-barnel
:: be sure to have oauth2-code markk
|%
++ axle
@ -86,7 +81,7 @@ $: cred=(unit ,[app-secret=@t client-id=@t])
:- %- publish
:~ [%lin & 'secret and client id saved successfully']
[%lin & 'please click on the url below to continue authentication']
[%url prl]
[%url prl ~]
==
~
::

View File

@ -1717,7 +1717,7 @@
=. ton.fox (~(su go ton.fox) gus)
:_ fox
:~ :- hen
[%pass ~ %a %want p.bon [%r %ta t.t.q.q.bon] `(unit will)`wyl]
[%pass /ta/beginning %a %want p.bon [%r %ta t.t.q.q.bon] `(unit will)`wyl]
==
%re :: %re
:_ fox

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

@ -53,6 +53,7 @@
++ whir $| ~ :: wire subset
$% [%at p=hole q=whir] :: authenticated
[%ay p=span:ship q=span:,@uvH ~] :: remote duct
[%ha p=path:beak] :: GET request
[%he p=whir] :: HEAD request
[%hi p=mark ~] :: outbound HTTP
[%si ~] :: response done
@ -605,10 +606,10 @@
:: kes (~(del by kes) hen)
:: ==
:: ~& eyre-them/(earn p.u.p.kyz)
%+ pass-note hi//[p.kyz]
=+ wir=hi//[p.kyz]
?: ?=(%hiss p.q.kyz)
[%e %meta :(slop !>(%them) !>(~) q.q.kyz)]
(ford-req root-beak [%cast %hiss %done ~ q.kyz])
(pass-note wir [%e %meta :(slop !>(%them) !>(~) q.q.kyz)])
(back wir %hiss q.kyz)
::
%they :: inbound response
=+ kas=(need (~(get by q.ask) p.kyz))
@ -673,8 +674,8 @@
?+ -.tee !!
%ay (ames-gram (slav %p p.tee) got/~ (slav %uv q.tee) |2.sih)
%hi =+ cay=[%httr !>(`httr`p.sih)]
?: ?=(%httr p.tee) (give-sigh ~ cay)
(pass-note si/~ (ford-req root-beak [%cast p.tee %done `cay]))
?: ?=(%httr p.tee) (give-sigh %& cay)
(back si/~ p.tee cay)
==
::
%unto :: XX horrible
@ -686,8 +687,8 @@
%diff
?> ?=([%of @ ^] tee)
?. ?=(%json p.p.cuf)
::~> %slog.`rose/[" " "[" "]"]^~[>%backing< >p.p.cuf< (sell q.p.cuf)]
(back tee 0v0 %json p.cuf)
::~> %slog.`%*(. >[%backing p.p.cuf %q-p-cuf]< &3.+> (sell q.p.cuf))
(back tee %json p.cuf)
(get-rush:(ire-ix p.tee) q.tee ((hard json) q.q.p.cuf))
::
%quit (axom tee [%mean ~])
@ -716,7 +717,7 @@
=. our (need hov) :: XX
|- ^+ ..axon
?- tee
[?(%on %ay) *] ~|(e/ford/lost/-.tee !!)
$|(~ [?(%on %ay) *]) ~|(e/ford/lost/tee !!)
[%si ~] (give-sigh q.sih)
[%hi ^]
?: ?=(%| -.q.sih)
@ -759,13 +760,15 @@
=^ jon ..ya ~(stat-json ya p.tee cyz)
$(tee q.tee, q.q.p.q.sih (add-json jon q.q.cay))
::
~
[%ha *]
:: ~& e/ford/hen
?. ?=(%& -.q.sih)
(fail 404 p.sih p.q.sih)
=* cay p.q.sih
?. ?=(%mime p.cay)
=- (back tee p.sih %mime cay(q.q -))
=+ bek=-:(need (tome p.tee))
=- (pass-note tee (ford-req bek [%flag p.sih -]))
=- `silk`[%cast %mime %done ~ cay(q.q -)]
?+ p.cay q.q.cay :: inject dependency long-poll
%urb =| urb=[[%html ~] [[%head ~] marl] [[%body ~] manx marl] ~]
.*(.(urb q.q.cay) !=((add-poll p.sih urb)))
@ -802,9 +805,8 @@
|=([him=ship gam=gram] (pass-note ~ %a %want [our him] [%e -.gam] +.gam))
::
++ back :: %ford bounce
|= [tea=whir dep=@uvH mar=mark cay=cage]
=+ sil=`silk`[%cast mar %flag dep %done ~ cay]
(pass-note tea (ford-req root-beak sil))
|= [tea=whir mar=mark cay=cage]
(pass-note tea (ford-req root-beak [%cast mar %done ~ cay]))
::
++ ford-kill (pass-note ~ %f [%exec our *beak ~]) :: XX unused
++ ford-req |=([bek=beak kas=silk] [%f [%exec our bek `kas]])
@ -812,7 +814,7 @@
++ fail
|= [sas=@ud dep=@uvH mez=tang]
^+ +>
:: (back ~ dep %tang !>(mez)) :: tang->urb chain may be source of failure
:: (back ha/~ dep %tang !>(mez)) ::tang->urb chain may be source of failure
(give-html sas ~ (add-poll dep (render-tang mez)))
::
++ give-html
@ -870,6 +872,7 @@
++ abet ..handle
++ done .
++ teba |*(a=$+(* ..handle) |*(b=* %_(done ..handle (a b))))
++ back (teba ^back)
++ give-html (teba ^give-html)
++ give-thou (teba ^give-thou)
++ give-json (teba ^give-json)
@ -1098,7 +1101,8 @@
?(%beam %spur)
=+ ext=(fall p.pok %urb)
=+ bem=?-(-.hem %beam p.hem, %spur [root-beak p.hem])
=+ wir=?+(mef !! %get ~, %head [%he ~])
=+ wir=`whir`[%ha (tope -.bem ~)]
=. wir ?+(mef !! %get wir, %head [%he wir])
~| bad-beam/q.bem
?< =([~ 0] (sky %cw (tope bem(+ ~, r [%da now]))))
=- ?.(aut [%& %| -] [%| (pass-note -)]) :: XX properly
@ -1124,8 +1128,8 @@
=^ orx ..ya ?:(is-anon new-view:for-client [(need grab-oryx) ..ya])
=+ [vew=(ire-ix (oryx-to-ixor orx)) cay=[%json !>(`json`s.hem)]]
?: ?=(%json q.hem) ((teba new-mess.vew) p.hem r.hem cay)
%+ pass-note [%to (oryx-to-ixor orx) (scot %p p.p.hem) q.p.hem r.hem]
(ford-req root-beak [%cast q.hem %done ~ cay])
%+ back to/[(oryx-to-ixor orx) (scot %p p.p.hem) q.p.hem r.hem]
[q.hem cay]
::
%poll
?: ?=([~ %js] p.pok) :: XX treat non-json cases?

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");

View File

@ -89,7 +89,7 @@
~| stub/-.a
?+ -.a !!
%lin (jobe say/[%b p.a] txt/[%s q.a] ~)
%url (jobe url/[%s (crip (earn p.a))] ~)
%url (jobe url/[%s (crip (earf p.a))] ~)
%exp (jobe code/[%s p.a] ~)
%app (jobe txt/[%s p.a] ~)
:: %inv (jobe ship/(jope p.a) party/[%s q.a] ~)