mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-11 04:48:00 +03:00
Basic generative loading...
This commit is contained in:
parent
0529456f74
commit
d7a59f0cbf
@ -28,6 +28,7 @@
|
||||
rey=[p=@ud q=(map ,@ud pimp)] :: live requests
|
||||
== ::
|
||||
++ dude ,[p=@tas q=@] :: client identity
|
||||
++ loco ,[p=? q=(unit ,@tas) r=path] :: logical construct
|
||||
++ pest :: request in progress
|
||||
$| $? %new :: virgin
|
||||
== ::
|
||||
@ -98,22 +99,6 @@
|
||||
?> ?=(@ q.vax)
|
||||
[~ %mid /text/html (met 3 q.vax) q.vax]
|
||||
==
|
||||
::
|
||||
++ loup :: weak synthesis
|
||||
|= [ext=@tas toe=tube]
|
||||
~& [%loup ext toe]
|
||||
=+ pre=`path`[p.toe q.toe r.toe ~]
|
||||
=| suf=path
|
||||
|- ^- (unit gank)
|
||||
=+ pax=:(weld pre s.toe `path`~[ext])
|
||||
=+ arc=((hard arch) .^(%cy pax))
|
||||
?^ q.arc
|
||||
=+ fil=.^(%cx (weld pax `path`~[ext]))
|
||||
[~ %& ^-(vase [?@(fil [%atom %$] %noun) fil])]
|
||||
?: (~(has by r.arc) %hoon)
|
||||
(mush pax !>([ext pre s.toe `path`(flop suf)]))
|
||||
?~ s.toe ~
|
||||
$(s.toe t.s.toe, suf [i.s.toe suf])
|
||||
--
|
||||
|% :: functions
|
||||
++ ye :: per event
|
||||
@ -187,7 +172,6 @@
|
||||
?> ?=([~ @ ~] hot)
|
||||
[[sec (rash i.u.hot thor:epur)] p.ryp q.ryp]
|
||||
==
|
||||
~& [%this purl pul]
|
||||
(hell pul [p.heq mah s.heq])
|
||||
==
|
||||
::
|
||||
@ -212,7 +196,8 @@
|
||||
^+ +>
|
||||
=^ wiq q.q.pul
|
||||
?~ q.q.pul [~ ~]
|
||||
=+ gow=(rush (cat 3 '~' i.q.q.pul) fed:ag)
|
||||
=+ nam=(cat 3 '~' i.q.q.pul)
|
||||
=+ gow=(rush i.q.q.pul fed:ag)
|
||||
^- [(unit ship) (list ,@t)]
|
||||
?~(gow [~ q.q.pul] [gow t.q.q.pul])
|
||||
(huff ?^(wiq wiq (doss r.p.pul)) ?=(^ wiq) pul moh)
|
||||
@ -254,6 +239,83 @@
|
||||
==
|
||||
abet:work:(~(into ya [u.oar p.saw] sef q.saw) pul moh)
|
||||
::
|
||||
++ lend :: load directory node
|
||||
|= pax=path
|
||||
((hard arch) (need (sky %cy pax)))
|
||||
::
|
||||
++ lick :: load file
|
||||
|= pax=path
|
||||
(need (sky %cx path))
|
||||
::
|
||||
++ loot :: load extension tree
|
||||
|= pax=path
|
||||
=| [tex=path all=(list path)]
|
||||
|- ^- (list path)
|
||||
=+ arc=(lend pax)
|
||||
=+ ryx=(~(tap by r.arc) ~)
|
||||
=- ?~(q.arc orx [tex orx])
|
||||
^= orx
|
||||
|- ^- (list path)
|
||||
?~ ryx all
|
||||
%= ^$
|
||||
pax (weld pax `path`[p.i.ryx ~])
|
||||
tex [p.i.ryx tex]
|
||||
all $(ryx t.ryx)
|
||||
==
|
||||
::
|
||||
++ loud :: locations by file
|
||||
|= [ext=@tas pre=path mid=path]
|
||||
^- (list ,[p=path q=path r=loco])
|
||||
=| suf=path
|
||||
|- ^- (list ,[p=path q=path r=loco])
|
||||
=+ pax=(weld pre (flop mid))
|
||||
=+ lot=(loot pax)
|
||||
=- ?^ tol tol
|
||||
?~ mid ~
|
||||
$(mid t.mid, suf [i.mid suf])
|
||||
^= tol
|
||||
|- ^- (list ,[p=path q=path r=loco])
|
||||
?~ lot ~
|
||||
=+ mor=$(lot t.lot)
|
||||
?~ i.lot mor
|
||||
=+ axp=(weld pax `path`(flop i.lot))
|
||||
?: ?=([%hoon @ ~] i.lot)
|
||||
:_(mor [mid suf | ?:(=(ext i.t.i.lot) ~ [~ i.t.i.lot]) axp])
|
||||
?: ?=([@ ~] i.lot)
|
||||
:_(mor [mid suf & ?:(=(ext i.i.lot) ~ [~ i.i.lot]) axp])
|
||||
mor
|
||||
::
|
||||
++ loup :: weak synthesis
|
||||
|= [ext=@tas toe=tube]
|
||||
^- (unit gank)
|
||||
=+ pre=`path`[p.toe q.toe r.toe ~]
|
||||
=+ syn=(weld pre `path`[%syn ~])
|
||||
=+ luc=(loud ext syn (flop s.toe))
|
||||
=+ ^= waz
|
||||
|- ^- $: p=(list ,[p=path q=path r=path])
|
||||
q=(list ,[p=path q=path r=path])
|
||||
r=(list ,[p=path q=path r=[p=@tas q=path]])
|
||||
s=(list ,[p=path q=path r=[p=@tas q=path]])
|
||||
==
|
||||
?~ luc [~ ~ ~ ~]
|
||||
=+ mor=$(luc t.luc)
|
||||
?- -.r.i.luc
|
||||
& ?~ q.r.i.luc
|
||||
[[[p.i.luc q.i.luc r.r.i.luc] p.mor] q.mor r.mor s.mor]
|
||||
[p.mor q.mor [[p.i.luc q.i.luc u.q.r.i.luc r.r.i.luc] r.mor] s.mor]
|
||||
| ?~ q.r.i.luc
|
||||
[p.mor [[p.i.luc q.i.luc r.r.i.luc] q.mor] r.mor s.mor]
|
||||
[p.mor q.mor r.mor [[p.i.luc q.i.luc u.q.r.i.luc r.r.i.luc] s.mor]]
|
||||
==
|
||||
?^ p.waz :: direct load
|
||||
=+ fil=(need (sky %cx r.i.p.waz))
|
||||
[~ %& ^-(vase [?@(fil [%atom %$] %noun) fil])]
|
||||
?^ q.waz :: indirect load
|
||||
=+ src=(need (sky %cx r.i.q.waz))
|
||||
=+ sam=!>([ext pre p.i.q.waz q.i.q.waz])
|
||||
[~ `gank`(musk r.i.q.waz src sam)]
|
||||
~
|
||||
::
|
||||
++ muff :: return card
|
||||
|= fav=card
|
||||
+>(mow :_(mow [wru hen fav]))
|
||||
@ -317,7 +379,6 @@
|
||||
++ holy :: structured request
|
||||
|= [pul=purl moh=moth]
|
||||
^- (unit seam)
|
||||
~& [%holy purl]
|
||||
?~ q.q.pul ~
|
||||
=* nep i.q.q.pul
|
||||
=* paw t.q.q.pul
|
||||
|
@ -409,7 +409,7 @@
|
||||
:: section 3bC, JSON and XML ::
|
||||
::
|
||||
++ moon :: mime type to text
|
||||
|= myn=mime
|
||||
|= myn=mite
|
||||
%+ rap
|
||||
3
|
||||
|- ^- tape
|
||||
@ -1519,26 +1519,30 @@
|
||||
^- path
|
||||
[(cat 3 'c' p.kit) (scot %p r.kit) s.kit (scot (dime q.kit)) t.kit]
|
||||
::
|
||||
++ muse :: general apply
|
||||
|= [gen=twig sam=vase]
|
||||
^- gank
|
||||
(must !>(+>) gen sam)
|
||||
::
|
||||
++ mush :: galactic apply
|
||||
|= [pax=path sam=vase]
|
||||
^- (unit gank)
|
||||
=+ suc=(file (weld pax `path`~[%hoon]))
|
||||
?~ suc ~
|
||||
:- ~
|
||||
?^ u.suc [%| ~[leaf/"mush: {<pax>} is not text"]]
|
||||
[~ (musk pax u.suc sam)]
|
||||
::
|
||||
++ musk :: compiling apply
|
||||
|= [pax=path src=* sam=vase]
|
||||
^- gank
|
||||
?^ src [%| ~[leaf/"musk: {<pax>} is not a source file"]]
|
||||
=+ ^= mud
|
||||
%- mule |.
|
||||
((full vest) [1 1] (trip u.suc))
|
||||
((full vest) [1 1] (trip src))
|
||||
?: ?=(| -.mud) mud
|
||||
?~ q.p.mud
|
||||
[%| ~[[leaf/"syntax error: {<pax>}:{<q.p.p.mud>}"]]]
|
||||
[%| ~[[leaf/"musk: syntax: {<pax>}:{<q.p.p.mud>}"]]]
|
||||
(muse `twig`p.u.q.p.mud sam)
|
||||
::
|
||||
++ muse :: general apply
|
||||
|= [gen=twig sam=vase]
|
||||
^- gank
|
||||
(must !>(+>) gen sam)
|
||||
::
|
||||
++ must :: virtual apply
|
||||
|= [nub=vase gen=twig sam=vase]
|
||||
^- gank
|
||||
@ -2012,7 +2016,7 @@
|
||||
++ logo ,@t :: session identity
|
||||
++ love $% :: http response
|
||||
[%ham p=manx] :: html node
|
||||
[%mid p=mime q=octs] :: mime-typed data
|
||||
[%mid p=mite q=octs] :: mime-typed data
|
||||
[%raw p=httr] :: raw http response
|
||||
[%wan p=wain] :: text lines
|
||||
[%zap p=@ud q=(list tank)] :: status/error
|
||||
@ -2049,7 +2053,7 @@
|
||||
%put :: PUT
|
||||
%trac :: TRACE
|
||||
==
|
||||
++ mime (list ,@ta) :: mime type
|
||||
++ mite (list ,@ta) :: mime type
|
||||
++ miso :: ankh delta
|
||||
$% [%del p=*] :: delete
|
||||
[%ins p=*] :: insert
|
||||
|
2
try/syn/fun/goodbye/html.hoon
Normal file
2
try/syn/fun/goodbye/html.hoon
Normal file
@ -0,0 +1,2 @@
|
||||
|= *
|
||||
'<html><body>Goodbye, world (from Hoon)!</body></html> '
|
5
try/syn/fun/hello.html
Normal file
5
try/syn/fun/hello.html
Normal file
@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
Hello, world (simply).
|
||||
</body>
|
||||
</html>
|
2
try/syn/fun/hello/html.hoon
Normal file
2
try/syn/fun/hello/html.hoon
Normal file
@ -0,0 +1,2 @@
|
||||
|= *
|
||||
'<html><body>Hello, world (from Hoon)!</body></html>'
|
@ -1 +0,0 @@
|
||||
<html><body>urbit: born to serve</body></html>
|
@ -1,5 +0,0 @@
|
||||
|= mad=[who=@p now=@da eny=@uw ced=cred]
|
||||
|= zab=[sec=oryx quy=quay sud=scud]
|
||||
^- love
|
||||
:- %ham
|
||||
html/~[body/~"urbit: {neighbor} prepared to serve at {<now.mad>}"]
|
@ -1,12 +0,0 @@
|
||||
|= mad=[who=@p now=@da eny=@uw ced=cred]
|
||||
|= zab=[sec=oryx quy=quay sud=scud]
|
||||
^- love
|
||||
:- %ham
|
||||
:~ %html
|
||||
:~ %body
|
||||
+"urbit: {neighbor} ready at {<now.mad>}."
|
||||
:~ ~[%form action/"query.html" method/"get"]
|
||||
-"message: {%[%input type/"text" name/"msg"]}"
|
||||
==
|
||||
==
|
||||
==
|
@ -1,9 +0,0 @@
|
||||
|= mad=[who=@p now=@da eny=@uw ced=cred]
|
||||
|= zab=[sec=oryx quy=quay sud=scud]
|
||||
^- love
|
||||
~& [%query quy.zab]
|
||||
:- %ham
|
||||
:~ %html
|
||||
:- %body
|
||||
~"urbit: {neighbor} got query {<quy.zab>}."
|
||||
==
|
Loading…
Reference in New Issue
Block a user