Merge branch 'master' into klay

Conflicts:
	urb/urbit.pill
This commit is contained in:
Jared Hance 2014-07-29 13:25:18 -04:00
commit ef94352267
23 changed files with 1513 additions and 928 deletions

View File

@ -435,7 +435,7 @@
vix=(bex +((cut 0 [25 2] mag))) :: width of sender
tay=(cut 0 [27 5] mag) :: message type
==
?> =(5 vez)
?> =(6 vez)
?> =(chk (end 0 20 (mug bod)))
:+ [(end 3 wix bod) (cut 3 [wix vix] bod)]
(kins tay)
@ -455,7 +455,7 @@
=+ tay=(ksin q.kec)
%+ mix
%+ can 0
:~ [3 5]
:~ [3 6]
[20 (mug bod)]
[2 yax]
[2 qax]
@ -1043,7 +1043,7 @@
++ gnaw :: gnaw:am
|= [kay=cape ryn=lane pac=rock] :: process packet
^- [p=(list boon) q=fort]
?. =(5 (end 0 3 pac)) [~ fox]
?. =(6 (end 0 3 pac)) [~ fox]
=+ kec=(bite pac)
?: (goop p.p.kec) [~ fox]
?. (~(has by urb.ton.fox) q.p.kec)
@ -1775,6 +1775,10 @@
?~ gys ~
=+ zet=zest:(ho:(~(um am [now fox]) our) his)
[~ ?:(=(%show i.tyl) >zet< zet)]
?: ?=([%pals ~] tyl)
?. =(our his)
~
[~ pals:(~(um am [now fox]) our)]
?. ?=([%life ~] tyl)
=+ muc=$(tyl [%life ~])
(perm our his ?~(muc 0 (,@ud u.muc)) tyl)

View File

@ -56,7 +56,7 @@
++ silk :: see %ford
$& [p=silk q=silk] ::
$% [%boil p=mark q=beam r=path] ::
[%cast p=mark q=beak r=silk] ::
[%cast p=mark q=silk] ::
[%done p=(set beam) q=cage] ::
== ::
++ sign :: in result $<-
@ -413,6 +413,8 @@
?< ?=(~ t.mab)
=+ nap=(slav %ud i.t.mab)
=+ sem=(need (~(get by can.sub.siq:beat:u.ouy) nap))
?: &(=(0 nap) =(~ s.sem))
(hear:woy ~ %& %json !>((joba %reload %b %&)))
=+ ^= cay ^- cage
?. ?=(%json p.+.sih)
[p.+.sih (slot 3 (spec (slot 3 [typ +.sih])))]
@ -1135,6 +1137,38 @@
heart.beat()
'''
::
++ duty
;script:'''
if (auto)
{
var tries = 0;
var cnt = 0;
var next = "/gie/"+user+"/"+port+"/"+cnt;
call = function() {
xhr = new XMLHttpRequest();
xhr.open('GET', next, true);
xhr.addEventListener('load', function() {
if ( this.status >= 500 ) {
return delay();
}
cnt++;
if ( this.status >= 400 ) {
document.alert("neighbor, please.");
}
document.location.reload();
});
xhr.addEventListener('error', delay);
xhr.addEventListener('abort', delay);
xhr.send();
}
delay = function() {
setTimeout(call,1000*tries);
tries++;
}
call();
}
'''
::
++ fape :: dispatch %ape
|= [fur=(unit term) you=@p paw=path]
^- (unit seam)
@ -1624,265 +1658,13 @@
(yoku num +.som.pip)
::
%con
:_ +>.$
=+ cal==+(cal=(~(get by cow) p.som.pip) ?^(cal u.cal *clue))
=+ ^= obj
%- jobe
:~ sent/(jone ino.cal)
recv/(jone ono.cal)
ownr/[%s (rsh 3 1 (scot %p our))]
==
=+ sez=:/("seq={(pojo obj)}")
=+ jqu="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"
=+ ^= sac
;script
;
; var hist = []
; var hind = 0
; $(
; function() {
; $input = $('#input .line')
; $prompt = $('#input .prompt')
; $output = $('#output')
; $input.focus()
;
; path = document.location.pathname
; if(path.slice(-1) == "/")
; path = path.slice(0,-1)
; seq.prom = path.split("/").pop()
;
; $('body').click(function() {
; $input.focus()
; })
;
; send = function(com) {
; if(com.line !== undefined &&
; com.line.indexOf('error') != -1) {
; com = {error:true}
; }
; console.log('sending')
; console.log(com)
; $.ajax('/'+seq.ownr+'/toc/'+seq.prom+'/'+seq.sent, {
; type: 'PUT',
; contentType: 'text/json',
; data: JSON.stringify(com),
; success: function(data,status,xhr) {
; seq.sent++
; },
; error: function(data,status,xhr) {
; if(data.responseJSON.lines !== undefined)
; addLines(data.responseJSON.lines)
; seq.sent++
; }
; })
; }
;
; recv = function() {
; $.ajax('/'+seq.ownr+'/goc/'+seq.prom+'/'+seq.recv, {
; type:'GET',
; success: function(data,status,xhr) {
; console.log(data);
; seq.recv = data[0];
; seq.send = data[1];
; msg = data[2];
; if(msg.text !== undefined) {
; addLines(msg.text)
; $('body').scrollTop($('.line').position().top)
; }
; if(msg.helo !== undefined)
; changePrompt(msg.helo)
; recv()
; },
; error: function(data,status,xhr) {
; console.log('error')
; seq.recv++
; }
; })
; }
;
; recv()
;
; send({hail:true})
;
; addLines = function(lines) {
; $output.append(lines.join("<br />")+"<br />")
; }
;
; changePrompt = function(helo) {
; $prompt.text(helo.prod[1]);
; }
;
; ctrl = false
;
; $input.on('keydown', function(e) {
; console.log('keydown')
; console.log(e.keyCode)
; if(e.keyCode == 17) {
; ctrl = true
; return;
; }
; if(e.keyCode == 88 && ctrl == true) {
; console.log('ling')
; send({ling:true})
; return;
; }
;
; if(e.keyCode == 69 && ctrl == true) {
; console.log('^e')
; $input[0].selectionStart =
; $input[0].selectionEnd =
; $input.val().length;
; return
; }
; if(e.keyCode == 65 && ctrl == true) {
; console.log('^a')
; $input[0].selectionStart = $input[0].selectionEnd = 0
; return
; }
;
;
; if(e.keyCode == 40) {
; if(hist.length > 1) {
; hind++
; if(hind > hist.length-1) {
; hind = hist.length-1
; }
; }
; }
; if(e.keyCode == 38) {
; if(hist.length > 1) {
; hind--
; if(hind < 0) {
; hind = 0
; }
; }
; }
; if(e.keyCode == 38 ||
; e.keyCode == 40) {
; console.log('set from hist')
; $input.val(hist[hind])
; setTimeout(function() {
; console.log(hist[hind].length)
; $input[0].setSelectionRange
; (hist[hind].length,hist[hind].length)
; }, 0)
; return;
; }
;
; if(e.keyCode == 13) {
; val = $input.val()
; send({line:val})
; $output.append($('.prompt').text()+" "+val+"<br>")
; hind = hist.length-1
; if(hind<0)
; hind = 0
; hist[hind] = val
; hist.push('')
; hind = hist.length-1
; $input.val('')
; $('body').scrollTop($('.line').position().top)
; return;
; }
; if(hind == hist.length-1)
; hist[hind] = $input.val()
; });
;
; $input.on('keyup', function(e) {
; if(e.keyCode == 17) {
; ctrl = false
; }
; });
; }
; )
==
=+ ^= ham
;html
;head
;title: urbit {<our>}/{<p.som.pip>}
;script(type "text/javascript", src jqu);
;style
; body {
; margin: 60px 120px;
; font: normal 12px "Menlo" monospace;
; background-color: #000;
; color: #fff;
; }
;
; #output {
; line-height: 18px;
; white-space: pre;
; }
;
; #input .prompt {
; display: inline-block;
; margin-right: 12px;
; }
;
; #input .line {
; outline: none;
; width: 80%;
; border: 0;
; background-color: transparent;
; color: #fff;
; font: normal 12px "Menlo" monospace;
; }
==
==
;body
;div#output;
;div#input
;div.prompt;
;input.line(type "text");
==
;+ [-.sac `marl`[sez +.sac]]
==
==
[~ pip(pez [%fin %ham ham])]
!!
::
%cog
=+ cal==+(cal=(~(get by cow) p.som.pip) ?^(cal u.cal *clue))
?. (lth q.som.pip ono.cal)
:- [~ pip(pez %way)]
%= +>.$ cow
%+ ~(put by cow)
p.som.pip
=+ val=(~(get by voy.cal) q.som.pip)
cal(voy (~(put by voy.cal) q.som.pip ?~(val [num ~] [num u.val])))
==
:_ +>.$
=+ ^= jon ^- json
:~ %a
(jone ono.cal)
(jone ino.cal)
(snag (sub ono.cal q.som.pip) out.cal)
==
[~ pip(pez [%fin %mid /text/json (tact (pojo jon))])]
!!
::
%cop
=+ cal==+(cal=(~(get by cow) p.som.pip) ?^(cal u.cal *clue))
?. =(q.som.pip ino.cal)
=. cow (~(put by cow) p.som.pip cal)
:_ +>.$
[~ pip(pez [%err 500 [%leaf "cop: {<q.som.pip>}, {<ino.cal>}."]~])]
=+ ^= fuv ^- (unit note)
?. ?=(%o -.r.som.pip) ~
=+ lin=(~(get by p.r.som.pip) %line)
?^ lin ?.(?=(%s -.u.lin) ~ [~ %b %line p.u.lin])
=+ syc=(~(get by p.r.som.pip) %hail)
?^ syc [~ %b %hail ~]
=+ lig=(~(get by p.r.som.pip) %ling)
?^ lig [~ %b %ling ~]
~
:_ %_ +>.$
cow (~(put by cow) p.som.pip cal(ino +(ino.cal)))
mow
?~ fuv mow
:_ mow
:- hen
:+ %pass [%cons (scot %p our) ses (scot %ud p.som.pip) ~]
u.fuv
==
[~ `pimp`pip(pez `pest`[%fin %raw 200 ~ ~])]
!!
::
%det
:- [~ pip(pez %way)]
@ -1891,8 +1673,7 @@
%fun
:- [~ pip(pez %way)]
=+ bem=`beam`(need (tome q.som.pip))
=+ bek=`beak`[p.bem q.bem r.bem]
=+ kas=`silk`[%cast %mime bek `silk`[%boil p.som.pip bem ~]]
=+ kas=`silk`[%cast %mime `silk`[%boil p.som.pip bem ~]]
+>.$(..ya (honk our num ses kas))
::
%lon
@ -2021,7 +1802,7 @@
|= [num=@ud app=term you=ship pax=path]
^+ +>
?< (~(has by sok) num)
abet:(~(self yo num you [-(tim.bet +)]:[*sink now]) app pax)
abet:(~(self yo num you *sink) app pax)
::
++ yokh :: heartbeat
|= [num=@ud you=ship nap=@ud cnt=@ud jon=json]
@ -2141,6 +1922,7 @@
++ self :: request main
|= [app=term pax=path]
^+ +>
=. tim.bet.siq now
=. can.sub.siq (~(put by can.sub.siq) 0 [[our app] pax hen `nap])
=. num.sub.siq +(num.sub.siq)
(pass `0 [%g %show [our app] you pax])
@ -2183,7 +1965,7 @@
=+ pip=u.pup
=+ ^= sip
?. =(%apg -.som.pip) sip.pip
[duti sip.pip]
[duti duty sip.pip]
?~ huq +>.$(..yo (bust 404 num))
%= +>.$
q.rey
@ -2202,12 +1984,11 @@
som ^- seam
:+ %sil
?:(-.u.huq 200 203)
=+ bek=`beak`[our %main [%da now]]
=+ don=`silk`[%done ~ `cage`p.u.huq]
^- silk
:^ %cast %mime bek
:+ %cast %mime
?~ fur.pip don
`silk`[%cast u.fur.pip bek don]
`silk`[%cast u.fur.pip don]
==
==
::

View File

@ -1,4 +1,4 @@
!:::::
::::::
:: :: %ford, new execution control
!? 164
::::
@ -6,6 +6,7 @@
=> =~
:: structures
|%
::
++ bead ,[p=(set beam) q=cage] :: computed result
++ gift :: out result <-$
$% [%made p=(each bead (list tank))] :: computed result
@ -18,31 +19,31 @@
== ::
++ hood :: assembly plan
$: zus=@ud :: zuse kelvin
pro=(list hoof) :: protocols
str=(list hoof) :: structures
lib=(list hoof) :: libraries
:: res=(map term (pair beam horn)) :: resources
fan=(list horn) :: resources
src=(list hoop) :: program
== ::
++ hoof (pair term (unit (pair case ship))) :: resource reference
++ hoop :: source in hood
$% [%code p=twig] :: direct twig
[%cone p=?] :: & hood, | code
[%coop p=(map term (pair ,? hoop))] :: complex core
[%here p=beam q=hoop] :: reset location
[%look p=path] :: adjust path
$% [%& p=twig] :: direct twig
[%| p=beam] :: resource location
== ::
++ horn :: resource tree
$% [%von p=term q=horn] :: apply face
[%was p=twig q=horn] :: operate backward
[%day p=horn] :: list by time
[%fan p=(list horn)] :: tuple
[%for p=path q=horn] :: path adjust
[%hub p=horn] :: list by number
[%nap p=horn] :: map by name
[%saw p=horn q=twig] :: operate forward
[%see p=beam q=horn] :: reset location
[%sic p=tile] :: cast type
[%toy p=mark] :: endpoint
$% [%and p=twig] :: // twig by hand
[%but p=twig] :: /$ argument
[%day p=horn] :: /| @dr map by @dr
[%dub p=term q=horn] :: /= apply face
[%fan p=(list horn)] :: /: list
[%for p=path q=horn] :: /, descend
[%hub p=horn] :: /@ map by @ud
[%man p=(map term horn)] :: /* map by hand
[%nap p=horn] :: /% map by @tas
[%now p=horn] :: /& map by @da
[%saw p=twig q=horn] :: /_ operate on
[%see p=beam q=horn] :: /. relative to
[%sic p=tile q=horn] :: /^ cast
[%toy p=mark] :: /mark/ static
== ::
++ kiss :: in request ->$
$% [%exec p=@p q=(unit silk)] :: make / kill
@ -65,27 +66,16 @@
$& [p=silk q=silk] :: cons
$% [%bake p=mark q=beam r=path] :: local synthesis
[%boil p=mark q=beam r=path] :: general synthesis
[%brew p=mark q=beam r=path] :: specific synthesis
[%call p=silk q=silk] :: slam
[%cast p=mark q=beak r=silk] :: translate
[%cast p=mark q=silk] :: translate
[%done p=(set beam) q=cage] :: literal
[%dude p=tank q=silk] :: error wrap
[%dune p=(set beam) q=(unit cage)] :: unit literal
[%mute p=silk q=(list (pair wing silk))] :: mutant
[%plan p=beam q=spur r=hood] :: structured assembly
[%reef ~] :: kernel reef
[%ride p=silk q=sill] :: obsolete old plan
[%vale p=mark q=sack r=*] :: validate [our his]
== ::
++ sill :: code construction
$& [p=sill q=sill] :: compose
$% [%dire p=@] :: direct text
[%dirt p=twig] :: direct twig
[%dish p=toga q=sill] :: tislus
[%disk p=(list sill)] :: pipe
[%drag p=beam q=path] :: beam to %hoon
[%drug p=silk] :: indirect twig
[%dust p=silk] :: literal value
[%ride p=twig q=silk] :: silk thru twig
[%vale p=mark q=ship r=*] :: validate [our his]
== ::
-- ::
|% :: structures
@ -122,8 +112,8 @@
dep=(set beam) :: dependencies
== ::
++ calx :: concrete cache line
$% [%hood p=calm q=cage r=hood] :: compile to hood
[%slap p=calm q=[p=vase q=twig] r=vase] :: slap
$% [%hood p=calm q=(pair beam cage) r=hood] :: compile
[%slap p=calm q=[p=vase q=twig] r=vase] :: compute
[%twig p=calm q=cage r=twig] :: compile to twig
== ::
++ task :: problem in progress
@ -170,6 +160,9 @@
bay(jav ~)
==
::
++ faun |=([a=cafe b=vase] (fine a `cage`noun/b)) :: vase to cage
++ feel |=([a=cafe b=cage] (fine a q.b)) :: cage to vase
++ fest |*([a=cafe b=*] (fine a [~ u=b])) :: bolt to unit
++ fine |* [a=cafe b=*] :: bolt from data
[p=`cafe`a q=[%0 p=*(set beam) q=b]] ::
++ flaw |=([a=cafe b=(list tank)] [p=a q=[%2 p=b]]) :: bolt from error
@ -184,6 +177,17 @@
^+ one
(~(gas by one) (~(tap by two) ~)) :: XX ugh
::
++ lark :: filter arch names
|= [wox=$+(span (unit ,@)) arc=arch]
^- (map ,@ span)
%- ~(gas by *(map ,@ span))
=| rac=(list (pair ,@ span))
|- ^+ rac
?~ r.arc rac
=. rac $(r.arc l.r.arc, rac $(r.arc r.r.arc))
=+ gib=(wox p.n.r.arc)
?~(gib rac [[u.gib p.n.r.arc] rac])
::
++ za :: per event
=| $: $: $: our=ship :: computation owner
tea=wire :: event place
@ -279,10 +283,7 @@
:- p=(came p.nuf `calx`[sem `calm`[now p.q.nuf] q.q.hoc q.q.nuf])
q=q.nuf
==
:- p=p.hoc
^= q
:+ %0 p.q.hoc
((calf sem) u.cux)
[p=p.hoc q=[%0 p=p.q.hoc q=((calf sem) u.cux)]]
==
::
++ coax :: bolt across
@ -334,7 +335,8 @@
?- -.ton
%2 [%2 p=p.ton]
%0 [%0 p=*(set beam) q=(fun p.ton)]
%1 =- ?- faw
%1 ~& [%coup-need ((list path) p.ton)]
=- ?- faw
& [%1 p=(turn p.faw |=(a=beam [a *(list tank)]))]
| [%2 p=p.faw]
==
@ -352,6 +354,16 @@
==
==
::
++ cowl :: each to bolt
|= cof=cafe
|* [tod=(each ,* (list tank)) fun=$+(* *)]
%+ (coup cof)
?- -.tod
%& [%0 p=p.tod]
%| [%2 p=p.tod]
==
fun
::
++ dash :: process cache
|= cof=cafe
^+ +>
@ -378,13 +390,16 @@
|= gef=gift
%_(+> mow :_(mow [hen %give gef]))
::
++ fade :: compile %hood
|= [cof=cafe bem=beam rem=heel]
++ fade :: compile to hood
|= [cof=cafe bem=beam]
^- (bolt hood)
=+ rul=(fair bem rem)
%+ (clef %hood) (make cof [%bake %hoon bem rem])
^- (burg cage hood)
%+ cool |.(leaf/"ford: fade {<[(tope bem)]>}")
%+ cope (make cof [%bake %hoon bem ~])
|= [cof=cafe cay=cage]
%+ (clef %hood) (fine cof bem cay)
^- (burg (pair beam cage) hood)
|= [cof=cafe bem=beam cay=cage]
=+ rul=(fair bem)
?. ?=(@ q.q.cay)
(flaw cof ~)
=+ vex=((full rul) [[1 1] (trip q.q.cay)])
@ -392,24 +407,31 @@
(flaw cof [%leaf "syntax error: {<p.p.vex>} {<q.p.vex>}"] ~)
(fine cof p.u.q.vex)
::
++ fane :: compile %hoon
|= [cof=cafe kas=silk]
^- (bolt twig)
=+ pax=(home kas)
%+ (clef %twig) (make cof kas)
^- (burg cage twig)
|= [cof=cafe cay=cage]
?. ?=(@ q.q.cay)
(flaw cof ~)
=+ rul=(ifix [gay gay] tall:(vang | pax))
=+ vex=((full rul) [[1 1] (trip q.q.cay)])
?~ q.vex
(flaw cof [%leaf "syntax error: {<p.p.vex>} {<q.p.vex>}"] ~)
(fine cof p.u.q.vex)
++ fame :: naked structure
|= [cof=cafe for=mark bek=beak]
^- (bolt vase)
=+ pax=/gate/[for]/str
=+ ^= bem ^- beam
:_ pax
?: =(p.bek our) bek
=+ oak=[our %main %da now]
?. =(~ (ska %cy (tope [oak pax]))) oak
bek
%+ cope (fade cof bem)
|= [cof=cafe hyd=hood]
%+ cope (ably:(meow bem ~) cof for hyd)
|= [cof=cafe gen=twig]
(maim cof pit gen)
::
++ fang :: protocol door
|= [cof=cafe for=mark bek=beak]
^- (bolt vase)
=+ bem=`beam`[bek /core/[for]/pro]
(cope (fade cof bem) abut:(meow bem ~))
::
++ fair :: hood parsing rule
|= [bem=beam rem=heel]
=+ vez=(vang | (tope bem(s (weld rem s.bem))))
|= bem=beam
=+ vez=(vang | (tope bem))
=< hood
|%
++ case
@ -419,9 +441,10 @@
?. ?=([%$ ?(%da %ud %tas) *] a) ~
[~ u=(^case a)]
::
++ hath (cook plex:vez (stag %clsg poor:vez)) :: hood path
++ have (sear tome hath) :: hood beam
++ hood
%+ ifix [gay gay]
%+ cook |=(a=^hood a)
;~ plug
;~ pose
(ifix [;~(plug fas wut gap) gap] dem)
@ -432,10 +455,13 @@
(ifix [;~(plug fas hep gap) gap] (most ;~(plug com gaw) hoof))
(easy ~)
==
::
;~ pose
(ifix [;~(plug fas lus gap) gap] (most ;~(plug com gaw) hoof))
(easy ~)
==
::
(star horn)
(star hoop)
==
::
@ -451,37 +477,105 @@
==
::
++ hoop
%+ knee *^hoop |. ~+
%+ cook |=(a=^hoop a)
(stag %code tall:vez)
;~ pose
(stag %| ;~(pfix fas have))
(stag %& tall:vez)
==
::
++ horn
=< apex
=| tol=?
|%
++ apex
%+ knee *^horn |. ~+
;~ pfix fas
;~ pose
(stag %toy ;~(sfix sym fas))
(stag %and ;~(pfix and:sign and:read))
(stag %but ;~(pfix but:sign and:read))
(stag %day ;~(pfix day:sign day:read))
(stag %dub ;~(pfix dub:sign dub:read))
(stag %fan ;~(pfix fan:sign fan:read))
(stag %for ;~(pfix for:sign for:read))
(stag %hub ;~(pfix hub:sign day:read))
(stag %man ;~(pfix man:sign man:read))
(stag %nap ;~(pfix nap:sign day:read))
(stag %now ;~(pfix now:sign day:read))
(stag %see ;~(pfix see:sign see:read))
(stag %sic ;~(pfix sic:sign sic:read))
==
==
::
++ rail
|* [wid=_rule tal=_rule]
?. tol wid
;~(pose wid tal)
::
++ read
|% ++ and
%+ rail
(ifix [sel ser] (stag %cltr (most ace wide:vez)))
;~(pfix gap tall:vez)
::
++ day
%+ rail
apex(tol |)
;~(pfix gap apex)
::
++ dub
%+ rail
;~(plug sym ;~(pfix tis apex(tol |)))
;~(pfix gap ;~(plug sym ;~(pfix gap apex)))
::
++ fan
%+ rail fail
;~(sfix (star ;~(pfix gap apex)) ;~(plug gap duz))
::
++ for
%+ rail
;~(plug (ifix [sel ser] hath) apex(tol |))
;~(pfix gap ;~(plug hath ;~(pfix gap apex)))
::
++ man
%+ rail fail
%- sear
:_ ;~(sfix (star ;~(pfix gap apex)) ;~(plug gap duz))
|= fan=(list ^horn)
=| naf=(list (pair term ^horn))
|- ^- (unit (map term ^horn))
?~ fan (some (~(gas by *(map term ^horn)) naf))
?. ?=(%dub -.i.fan) ~
$(fan t.fan, naf [[p.i.fan q.i.fan] naf])
::
++ see
%+ rail
;~(plug (ifix [sel ser] have) apex(tol |))
;~(pfix gap ;~(plug have ;~(pfix gap apex)))
::
++ sic
%+ rail
;~(plug (ifix [sel ser] toil:vez) apex(tol |))
;~(pfix gap ;~(plug howl:vez ;~(pfix gap apex)))
--
::
++ sign
|% ++ and ;~(pose fas (jest %and))
++ but ;~(pose buc (jest %but))
++ day ;~(pose bar (jest %day))
++ dub ;~(pose tis (jest %dub))
++ fan ;~(pose col (jest %fan))
++ for ;~(pose com (jest %for))
++ hub ;~(pose pat (jest %hub))
++ man ;~(pose tar (jest %man))
++ nap ;~(pose cen (jest %nap))
++ now ;~(pose pam (jest %now))
++ saw ;~(pose cab (jest %saw))
++ see ;~(pose dot (jest %see))
++ sic ;~(pose ket (jest %sic))
--
--
--
::
++ gush :: sill to twig
|= [cof=cafe sil=sill]
^- (bolt twig)
?+ -.sil !!
%dire (fane cof [%done ~ [%atom [%atom %$] p.sil]])
%dirt (fine cof p.sil)
%drag (fane cof [%boil %hoon p.sil q.sil])
%drug %+ cope (make cof p.sil)
|= [cof=cafe cay=cage]
(fine cof (twig q.q.cay))
==
::
++ home :: source silk to path
|= kas=silk
^- path
?+ -.kas ~[(end 3 1 (scot %p (mug kas)))]
%bake (tope q.kas(s (welp r.kas s.q.kas)))
%boil (tope q.kas(s (welp r.kas s.q.kas)))
%cast $(kas r.kas)
%dude $(kas q.kas)
%ride ?+ -.q.kas $(kas [%reef ~])
%drag (tope p.q.kas)
%drug $(kas p.q.kas)
==
==
::
++ kale :: mutate
|= [cof=cafe kas=silk muy=(list (pair wing silk))]
^- (bolt cage)
@ -496,84 +590,82 @@
|= [cof=cafe yom=(list (pair wing vase))]
%+ cope (make cof kas)
|= [cof=cafe cay=cage]
=+ ^= vow
%+ slop q.cay
|- ^- vase
?~ yom [[%atom %n] ~]
(slop q.i.yom $(yom t.yom))
%+ cope
%^ maim cof vow
^- twig
:+ %cncb [%& 2]~
=+ axe=3
|- ^- (list (pair wing twig))
?~ yom ~
:- [p.i.yom [%$ (peg axe 2)]]
$(yom t.yom, axe (peg axe 3))
%+ cope (keel cof q.cay yom)
|= [cof=cafe vax=vase]
(fine cof p.cay vax)
::
++ krab :: load to vase
|= [cof=cafe for=mark how=mark bem=beam rem=heel]
++ keel :: apply mutations
|= [cof=cafe suh=vase yom=(list (pair wing vase))]
^- (bolt vase)
%+ cope (fane cof %bake how bem rem)
|= [cof=cafe gen=twig]
(maim cof pit gen)
%^ maim cof
%+ slop suh
|- ^- vase
?~ yom [[%atom %n] ~]
(slop q.i.yom $(yom t.yom))
^- twig
:+ %cncb [%& 2]~
=+ axe=3
|- ^- (list (pair wing twig))
?~ yom ~
:- [p.i.yom [%$ (peg axe 2)]]
$(yom t.yom, axe (peg axe 3))
::
++ lace :: load and check
|= [cof=cafe for=mark bem=beam rem=heel]
|= [cof=cafe for=mark bem=beam arg=heel]
^- (bolt (unit vase))
=+ bek=`beak`[p.bem q.bem r.bem]
%+ cope (lend cof bem)
|= [cof=cafe arc=arch]
?^ q.arc
(cope (liar cof bem) (lake for bek))
(cope (cope (liar cof bem) (lake for bek)) fest)
?: (~(has by r.arc) %hoon)
%+ cope (fade cof bem rem)
%+ cope (fade cof bem)
|= [cof=cafe hyd=hood]
%+ cope (abut:(meow bem rem) cof hyd)
(lake for bek)
(cope (cope (abut:(meow bem arg) cof hyd) (lake for bek)) fest)
(fine cof ~)
::
++ lake :: check/coerce
|= [for=mark bek=beak]
|= [cof=cafe sam=vase]
^- (bolt (unit vase))
^- (bolt vase)
%+ cool |.(leaf/"ford: check {<[for bek `@p`(mug q.sam)]>}")
?: ?=(?(%gate %core %hoon %hook %hood) for)
(fine cof ~ sam)
%+ cope (make cof %boil %gate [[p.bek %main r.bek] /ref/[for]/sys] ~)
|= [cof=cafe cay=cage]
%+ cope (lane cof p.q.cay [%cnzy %$])
|= [cof=cafe ref=type]
?: (~(nest ut ref) | p.sam)
(fine cof ~ sam)
%+ cope (maul cof q.cay sam)
:: ~& [%lake-easy for bek]
(fine cof sam)
%+ cope (fang cof for bek)
|= [cof=cafe tux=vase]
=+ bob=(slot 6 tux)
?: (~(nest ut p.bob) | p.sam)
(fine cof sam)
?. (slab %grab p.tux)
(flaw cof [%leaf "ford: no grab: {<[for bek]>}"]~)
=+ gab=(slap tux [%cnzy %grab])
?. (slab %noun p.tux)
(flaw cof [%leaf "ford: no noun: {<[for bek]>}"]~)
%+ cope (maul cof (slap gab [%cnzy %noun]) [%noun q.sam])
|= [cof=cafe pro=vase]
(fine cof ~ pro)
?: =(+<.q.pro q.sam)
(flaw cof [%leaf "ford: invalid content: {<[for bek]>}"]~)
(fine cof (slot 6 pro))
::
++ lave :: validate
|= [cof=cafe for=mark sax=sack som=*]
=+ lok=`case`[%da now]
=+ ^= own ^- ship
=+ von=(ska %cy (tope [[p.sax %main lok] /core/ref/[for]/sys]))
?~(von q.sax p.sax)
((lake for [own %main lok]) cof [%noun som])
::
++ lair :: metaload
|= [for=mark bem=beam]
|= [cof=cafe vax=vase]
|= [cof=cafe for=mark his=ship som=*]
^- (bolt vase)
?. (~(nest ut -:!>(*silk)) | p.vax)
(flaw cof (smyt (tope bem)) ~)
%+ cope (make cof ((hard silk) q.vax))
|= [cof=cafe cay=cage]
(link cof for p.cay [p.bem q.bem r.bem] q.cay)
((lake for [his %main [%da now]]) cof [%noun som])
::
++ lane :: type infer
|= [cof=cafe typ=type gen=twig]
%+ (coup cof) (mule |.((~(play ut typ) gen)))
%+ (cowl cof) (mule |.((~(play ut typ) gen)))
|=(ref=type ref)
::
++ lash :: atomic sequence
|= wox=$+(span (unit ,@))
|= [cof=cafe bem=beam]
^- (bolt (map ,@ span))
%+ cope (lend cof bem)
|= [cof=cafe arc=arch]
(fine cof (lark wox arc))
::
++ lend :: load arch
|= [cof=cafe bem=beam]
^- (bolt arch)
@ -594,36 +686,41 @@
++ lily :: translation targets
|= [cof=cafe for=mark bek=beak]
^- (bolt (list ,@tas))
%+ cope
%+ cope (lend cof [p.bek %main r.bek] `path`~[%tan for %sys])
|= [cof=cafe arc=arch]
(fine cof (turn (~(tap by r.arc) ~) |=([a=@tas b=~] a)))
|= [cof=cafe all=(list ,@tas)]
(fine cof ?.(=(%hoon for) all [%hoot all]))
%+ cope (fang cof for bek)
|= [cof=cafe vax=vase]
%+ fine cof
%+ weld
^- (list ,@tas)
?. (slab %garb p.vax) ~
=+ gav=((soft (list ,@tas)) q:(slap vax [%cnzy %garb]))
?~(gav ~ u.gav)
?. (slab %grow p.vax) ~
=+ gow=(slap vax [%cnzy %grow])
(sloe p.gow)
::
++ lima :: load at depth
|= [cof=cafe for=mark bem=beam rem=heel]
|= [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]) rem)
(lace cof for bem(s [for s.bem]) arg)
=+ haz=(turn (~(tap by r.arc) ~) |=([a=@tas b=~] a))
?~ haz (fine cof ~)
%+ cope (lion cof for -.bem haz)
|= [cof=cafe wuy=(unit (list ,@tas))]
?~ wuy (fine cof ~)
?> ?=(^ u.wuy)
%+ cope (make cof %bake i.u.wuy bem rem)
%+ cope (make cof %bake i.u.wuy bem arg)
|= [cof=cafe hoc=cage]
%+ cope (lope cof i.u.wuy t.u.wuy [p.bem q.bem r.bem] q.hoc)
%+ cope (lope cof i.u.wuy t.u.wuy -.bem q.hoc)
|= [cof=cafe vax=vase]
(fine cof ~ vax)
::
++ lime :: load beam
|= [cof=cafe for=mark bem=beam rem=heel]
=+ [mob=bem mer=(flop rem)]
|= [cof=cafe for=mark bem=beam arg=heel]
=+ [mob=bem mer=(flop arg)]
|- ^- (bolt vase)
%+ cope (lima cof for mob (flop mer))
|= [cof=cafe vux=(unit vase)]
@ -637,14 +734,23 @@
^- (bolt vase)
?: =(too for) (fine cof vax)
?: |(=(%noun for) =(%$ for))
%+ cope ((lake too bek) cof vax)
|= [cof=cafe vux=(unit vase)]
?~ vux (flaw cof [%leaf "ford: link {<too>}"]~)
(fine cof u.vux)
%+ cope
(make cof %boil %gate [[p.bek %main r.bek] /[too]/tan/[for]/sys] ~)
|= [cof=cafe cay=cage]
(maul cof q.cay vax)
((lake too bek) cof vax)
%+ cope (fang cof for bek)
|= [cof=cafe pro=vase]
?: &((slab %grow p.pro) (slab too p:(slap pro [%cnzy %grow])))
%+ cope (keel cof pro [[%& 6]~ vax]~)
|= [cof=cafe pox=vase]
(maim cof pox [%tsgr [%cnzy %grow] [%cnzy too]])
%+ cope (fang cof too bek)
|= [cof=cafe pro=vase]
=+ ^= zat ^- (unit vase)
?. (slab %grab p.pro) ~
=+ gab=(slap pro [%cnzy %grab])
?. (slab for p.gab) ~
`(slap gab [%cnzy for])
?~ zat
(flaw cof [%leaf "ford: no link: {<[for too]>}"]~)
(maul cof u.zat vax)
::
++ lion :: translation search
|= [cof=cafe too=@tas bek=beak fro=(list ,@tas)]
@ -687,13 +793,6 @@
|= [cof=cafe yed=vase]
^$(cof cof, for i.yaw, yaw t.yaw, vax yed)
::
++ maid :: make with path tag
|= [cof=cafe kas=silk]
^- (bolt (pair path cage))
%+ cope (make cof kas)
|= [cof=cafe cay=cage]
(fine cof (home kas) cay)
::
++ maim :: slap
|= [cof=cafe vax=vase gen=twig]
^- (bolt vase)
@ -737,13 +836,6 @@
%+ cope (lime cof p.kas q.kas r.kas)
|= [cof=cafe vax=vase]
(fine cof `cage`[p.kas vax])
::
%brew
~& %ford-brew
%+ cool |.(leaf/"ford: brew {<p.kas>} {<(tope q.kas)>} {<r.kas>}")
%+ cope (krab cof p.kas %hoon q.kas r.kas)
|= [cof=cafe vax=vase]
(fine cof `cage`[p.kas vax])
::
%call
%+ cool |.(leaf/"ford: call {<`@p`(mug kas)>}")
@ -762,10 +854,10 @@
==
::
%cast
%+ cool |.(leaf/"ford: cast {<p.kas>} {<(tope q.kas ~)>}")
%+ cope $(kas r.kas)
%+ cool |.(leaf/"ford: cast {<p.kas>}")
%+ cope $(kas q.kas)
|= [cof=cafe cay=cage]
%+ cope (link cof p.kas p.cay q.kas q.cay)
%+ cope (link cof p.kas p.cay [our %main %da now] q.cay)
|= [cof=cafe vax=vase]
(fine cof [p.kas vax])
::
@ -784,21 +876,17 @@
%reef (fine cof %noun pit)
%ride
%+ cool |.(leaf/"ford: ride {<`@p`(mug kas)>}")
%+ cope $(kas p.kas)
%+ cope $(kas q.kas)
|= [cof=cafe cay=cage]
%+ cope (gush cof q.kas)
|= [cof=cafe gen=twig]
%+ cope (maim cof q.cay gen)
%+ cope (maim cof q.cay p.kas)
|= [cof=cafe vax=vase]
(fine cof %noun vax)
::
%vale
%+ cool |.(leaf/"ford: vale {<p.kas>} {<q.kas>} {<`@p`(mug r.kas)>}")
%+ cope (lave cof p.kas q.kas r.kas)
|= [cof=cafe vux=(unit vase)]
?~ vux
(flaw cof [%leaf "invalid marks: {<[p.kas q.kas]>}"]~)
(fine cof `cage`[p.kas u.vux])
|= [cof=cafe vax=vase]
(fine cof `cage`[p.kas vax])
==
::
++ maul :: slam
@ -813,27 +901,49 @@
==
::
++ meow :: assemble
|= [how=beam rem=heel]
=| $: rop=(map term (pair hoof twig)) :: protocols known
|= [how=beam arg=heel]
=| $: rop=(map term (pair hoof twig)) :: structures known
bil=(map term (pair hoof twig)) :: libraries known
lot=(list term) :: library stack
zeg=(set term) :: library guard
boy=(list twig) :: body stack
==
|%
++ abut :: generate
|= [cof=cafe hyd=hood]
%+ cope (apex cof hyd)
|= [cof=cafe sel=_..abut]
(maim cof pit able:sel)
::
++ able :: assemble preamble
^- twig
:+ %tsgr
?:(=(~ rop) [%$ 1] [%brcn (~(run by rop) |=([* a=twig] [%ash a]))])
:+ %tsgr
[%tssg (turn (flop lot) |=(a=term q:(need (~(get by bil) a))))]
[%tssg (flop boy)]
[%tssg (turn (flop lot) |=(a=term q:(need (~(get by bil) a))))]
::
++ ably :: naked structure
|= [cof=cafe for=mark hyd=hood]
^- (bolt twig)
%+ cope (apex cof hyd)
|= [cof=cafe sel=_..ably]
=. ..ably sel
%+ fine cof
^- twig
:+ %tsgl [%cnzy for]
:- %brcn
^- (map term foot)
%+ ~(put by `(map term foot)`(~(run by rop) |=([* a=twig] [%ash a])))
for
[%ash [%tssg (flop boy)]]
::
++ abut :: generate
|= [cof=cafe hyd=hood]
^- (bolt vase)
%+ cope (apex cof hyd)
|= [cof=cafe sel=_..abut]
=. ..abut sel
%+ cope (maim cof pit able)
|= [cof=cafe bax=vase]
%+ cope (chap cof bax [%fan fan.hyd])
|= [cof=cafe gox=vase]
%+ cope (maim cof (slop gox bax) [%tssg (flop boy)])
|= [cof=cafe fin=vase]
(fine cof fin)
:: ~> %slog.[0 ~(duck ut p.q.cay)]
::
++ apex :: build to body
|= [cof=cafe hyd=hood]
@ -843,8 +953,8 @@
=. ..apex sel
%+ cope (neck cof lib.hyd)
|= [cof=cafe sel=_..apex]
=. ..apex sel
%+ cope (head cof pro.hyd)
=. ..apex sel(boy boy)
%+ cope (head cof str.hyd)
|= [cof=cafe sel=_..apex]
(fine cof sel)
::
@ -856,17 +966,111 @@
|= [cof=cafe sel=_..body]
^$(cof cof, src t.src, ..body sel)
::
++ head :: consume protocols
++ chai :: atomic map
|= [cof=cafe bax=vase doe=term hon=horn]
^- (bolt vase)
%+ cope ((lash (slat doe)) cof how)
|= [cof=cafe yep=(map ,@ span)]
%+ cope
|- ^- (bolt (map ,@ vase))
?~ yep (fine cof ~)
%+ cope $(yep l.yep)
|= [cof=cafe lef=(map ,@ vase)]
%+ cope `(bolt (map ,@ vase))`^$(cof cof, yep r.yep)
|= [cof=cafe rig=(map ,@ vase)]
%+ cope (chap(s.how [q.n.yep s.how]) cof bax hon)
|= [cof=cafe nod=vase]
(fine cof [[p.n.yep nod] lef rig])
|= [cof=cafe doy=(map ,@ vase)]
%+ fine cof
|- ^- vase
?~ doy [[%cube 0 [%atom %n]] 0]
%+ slop
(slop [[%atom doe] p.n.doy] q.n.doy)
(slop $(doy l.doy) $(doy r.doy))
::
++ chap :: produce resources
|= [cof=cafe bax=vase hon=horn]
^- (bolt vase)
?- -.hon
%and (maim cof bax p.hon)
%but
%+ cope (maim cof bax p.hon)
|= [cof=cafe gat=vase]
(maul cof gat !>(arg))
::
%day (chai cof bax %dr p.hon)
%dub
%+ cope $(hon q.hon)
|= [cof=cafe vax=vase]
(fine cof [[%face p.hon p.vax] q.vax])
::
%fan
%+ cope
|- ^- (bolt (list vase))
?~ p.hon (fine cof ~)
%+ cope ^$(hon i.p.hon)
|= [cof=cafe vax=vase]
%+ cope ^$(cof cof, p.hon t.p.hon)
|= [cof=cafe tev=(list vase)]
(fine cof [vax tev])
|= [cof=cafe tev=(list vase)]
%+ fine cof
|- ^- vase
?~ tev [[%cube 0 [%atom %n]] 0]
(slop i.tev $(tev t.tev))
::
%for $(hon q.hon, s.how (weld (flop p.hon) s.how))
%hub (chai cof bax %ud p.hon)
%man
|- ^- (bolt vase)
?~ p.hon (fine cof [[%cube 0 [%atom %n]] 0])
%+ cope $(p.hon l.p.hon)
|= [cof=cafe lef=vase]
%+ cope ^$(cof cof, p.hon r.p.hon)
|= [cof=cafe rig=vase]
%+ cope ^^^$(cof cof, hon q.n.p.hon)
|= [cof=cafe vax=vase]
%+ fine cof
%+ slop
(slop [[%atom %tas] p.n.p.hon] vax)
(slop lef rig)
::
%now (chai cof bax %da p.hon)
%nap (chai cof bax %tas p.hon)
::
%see $(hon q.hon, how p.hon)
%saw
%+ cope $(hon q.hon)
|= [cof=cafe sam=vase]
%+ cope (maim cof bax p.hon)
|= [cof=cafe gat=vase]
(maul cof gat sam)
::
%sic
%+ cope $(hon q.hon)
|= [cof=cafe vax=vase]
%+ cope (maim cof bax [%bctr p.hon])
|= [cof=cafe tug=vase]
?. (~(nest ut p.tug) | p.vax)
(flaw cof [%leaf "type error: {<p.hon>} {<q.hon>}"]~)
(fine cof vax)
::
%toy (cope (make cof %bake p.hon how ~) feel)
==
::
++ head :: consume structures
|= [cof=cafe bir=(list hoof)]
|- ^- (bolt ,_..head)
?~ bir (fine cof ..head)
?~ bir
(fine cof ..head)
=+ byf=(~(get by rop) p.i.bir)
?^ byf
?. =(`hoof`i.bir `hoof`p.u.byf)
(flaw cof [%leaf "protocol mismatch: {<~[p.u.byf i.bir]>}"]~)
(flaw cof [%leaf "structure mismatch: {<~[p.u.byf i.bir]>}"]~)
$(bir t.bir)
=+ bem=(hone %gate %pro i.bir)
%+ cope (fade cof bem ~)
=+ bem=(hone %gate %str i.bir)
%+ cope (fade cof bem)
|= [cof=cafe hyd=hood]
%+ cope (apex(boy ~) cof hyd)
|= [cof=cafe sel=_..head]
@ -898,7 +1102,7 @@
(flaw cof [%leaf "library mismatch: {<~[p.u.byf i.bir]>}"]~)
$(bir t.bir)
=+ bem=(hone %core %lib i.bir)
%+ cope (fade cof bem ~)
%+ cope (fade cof bem)
|= [cof=cafe hyd=hood]
%+ cope (apex(zeg goz, boy ~) cof hyd)
|= [cof=cafe sel=_..neck]
@ -913,9 +1117,38 @@
++ wilt :: process body entry
|= [cof=cafe hop=hoop]
^- (bolt _..wilt)
?+ -.hop !!
%code (fine cof ..wilt(boy [p.hop boy]))
:: %hood (cope (fade cof p.hop ~) apex)
?- -.hop
%& (fine cof ..wilt(boy [p.hop boy]))
%|
%+ cope (lend cof p.hop)
|= [cof=cafe arc=arch]
?: (~(has by r.arc) %hoon)
%+ cope (fade cof p.hop)
|= [cof=cafe hyd=hood]
%+ cope (apex(boy ~) cof hyd)
|= [cof=cafe sel=_..wilt]
(fine cof sel(boy [[%tssg boy.sel] boy]))
=+ [all=(lark (slat %tas) arc) sel=..wilt]
%+ cope
|- ^- (bolt (pair (map term foot) _..wilt))
?~ all (fine cof ~ ..wilt)
%+ cope $(all l.all)
|= [cof=cafe lef=(map term foot) sel=_..wilt]
%+ cope ^$(all r.all, cof cof, sel sel)
|= [cof=cafe rig=(map term foot) sel=_..wilt]
%+ cope
%= ^^^^$
cof cof
..wilt sel(boy ~)
s.p.hop [p.n.all s.p.hop]
==
|= [cof=cafe sel=_..wilt]
%+ fine cof
[`(map term foot)`[[p.n.all [%ash [%tssg boy.sel]]] lef rig] sel]
|= [cof=cafe mav=(map term foot) sel=_..wilt]
?~ mav
(flaw cof [%leaf "source missing: {<(tope p.hop)>}"]~)
(fine cof sel(boy [[%brcn mav] boy]))
==
--
::

View File

@ -110,8 +110,8 @@
[%call p=silk q=silk] ::
[%done p=(set beam) q=cage] ::
[%mute p=silk q=(list (pair wing silk))] ::
[%ride p=silk q=sill] ::
[%vale p=mark q=sack r=*] ::
[%ride p=twig q=silk] ::
[%vale p=mark q=ship r=*] ::
== ::
++ sill :: see %ford
$% [%dirt p=twig] ::
@ -122,7 +122,8 @@
$% [%went p=ship q=cape] ::
== == ::
$: %g :: by %gall
$% [%dumb ~] ::
$% [%crud p=@tas q=(list tank)] ::
[%dumb ~] ::
[%mean p=(unit ,[p=term q=(list tank)])] ::
[%nice ~] ::
[%rush p=mark q=*] ::
@ -220,6 +221,8 @@
++ take :: accept response
|= [pax=path hen=duct hin=(hypo sign)] ::
^- [p=(list move) q=_..^$]
?: ?=(%crud +<.q.hin)
~& [%gall-crud-error pax hen q.hin] [~ ..^$]
?: ?=([%r *] pax)
(gave hen t.pax q.hin)
?: ?=([%x *] pax)
@ -365,6 +368,7 @@
::
%g
?- -.+.sih
%crud !!
%dumb !!
%mean (rod %e p.+.sih)
%nice (rod %k ~)
@ -379,6 +383,7 @@
:+ %pass [%r pax]
^- note
?- -.+.sih
%crud !!
%dumb !!
%mean !!
%nice !!
@ -398,9 +403,9 @@
:_ ..^$ :_ ~
^- move :- neh
?- -.ron
%d [%pass /x/d `note`[%f %exec p.saq ~ %vale p.ron saq q.ron]]
%d [%pass /x/d `note`[%f %exec p.saq ~ %vale p.ron q.saq q.ron]]
%e [%give %mean p.ron]
%f [%pass /x/f `note`[%f %exec p.saq ~ %vale p.ron saq q.ron]]
%f [%pass /x/f `note`[%f %exec p.saq ~ %vale p.ron q.saq q.ron]]
%k [%give %nice ~]
==
::
@ -419,7 +424,7 @@
==
^- note
?- -.rok
%m [%f %exec p.saq ~ %vale p.rok saq q.rok]
%m [%f %exec p.saq ~ %vale p.rok q.saq q.rok]
%s [%g %show [p.saq app] q.saq p.rok]
%u [%g %nuke [p.saq app] q.saq]
==
@ -649,7 +654,7 @@
++ harm :: arm as silk
|= [arm=term kas=silk]
^- silk
[%ride kas [%dirt [%cnzy arm]]]
[%ride [%cnzy arm] kas]
::
++ home :: load application
^- silk
@ -879,8 +884,7 @@
++ warm :: vase has arm
|= cog=@tas
^- ?
?~ huv.sat |
!=(~ q:(~(fino ut p.u.huv.sat) 0 %free cog))
?~(huv.sat | (slab cog p.u.huv.sat))
::
++ work :: eat queue
|- ^+ +
@ -929,10 +933,15 @@
(give(qic.sat ~) %crud p.kon q.kon)
::
%nuke
?. (warm %pull)
+>.$(qic.sat ~)
?> ?=(^ huv.sat)
(yawl [%pull ~] u.huv.sat [[%atom %ud] ost])
?: (warm %pull)
?> ?=(^ huv.sat)
(yawl [%pull ~] u.huv.sat [[%atom %ud] ost])
=+ pax=+:(fall (~(get by sup.sat) ost) *[ship path])
%= +>.$
qic.sat ~
sup.sat (~(del by sup.sat) ost)
pus.sat (~(del ju pus.sat) pax ost)
==
::
%mess
=+ ^= cog ^- term

View File

@ -28,6 +28,7 @@
++ axis ,@ :: tree address
++ also ,[p=term q=wing r=type] :: alias
++ base ?([%atom p=odor] %noun %cell %bean %null) :: axils, @ * ^ ? ~
++ bean ,? :: 0=&=yes, 1=|=no
++ beer $|(@ [~ p=twig]) :: simple embed
++ beet $| @ :: advanced embed
$% [%a p=twig] ::
@ -1750,6 +1751,7 @@
|= fud=* ^- (unit han)
=+ gol=(han fud)
?.(=(gol fud) ~ [~ gol])
:::::::::::::::::::::::::::::::::::::::::::::::::::::: ::
:::: chapter 2d, containers ::::
:: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
@ -3623,6 +3625,7 @@
--
++ scot |=(mol=dime ~(rent co %$ mol))
++ scow |=(mol=dime ~(rend co %$ mol))
++ slat |=(mod=@tas |=(txt=@ta (slaw mod txt)))
++ slav |=([mod=@tas txt=@ta] (need (slaw mod txt)))
++ slaw
|= [mod=@tas txt=@ta]
@ -5394,7 +5397,7 @@
++ rads :: random continuation
|= b=@
=+ r=(rad b)
[+>.$(a (shas %og-s r)) r]
[r +>.$(a (shas %og-s r))]
++ raw :: random bits
~/ %raw
|= b=@ ^- @
@ -5411,7 +5414,7 @@
++ raws :: random bits continuation
|= b=@
=+ r=(raw b)
[+>.$(a (shas %og-s r)) r]
[r +>.$(a (shas %og-s r))]
--
++ shaz :: sha-512
|= ruz=@ ^- @
@ -6129,6 +6132,18 @@
~
`[(~(peek ut p.vax) %free axe) .*(q.vax [0 axe])]
::
++ slab
|= [cog=@tas typ=type]
!=(~ q:(~(fino ut typ) 0 %free cog))
::
++ sloe
|= typ=type
^- (list term)
?+ typ ~
[%hold *] $(typ ~(repo ut typ))
[%core *]
(turn (~(tap by q.r.q.typ) ~) |=([a=term *] a))
==
++ slot
|= [axe=@ vax=vase] ^- vase
[(~(peek ut p.vax) %free axe) .*(q.vax [0 axe])]
@ -8902,19 +8917,24 @@
;~ pose
;~ less (jest '"""')
%+ ifix [doq doq]
%- star ;~ pose
%- star
;~ pose
;~(pfix bas ;~(pose bas doq kel bix:ab))
;~(less doq bas kel prn)
(stag ~ sump)
== ==
==
==
::
%- inde %+ ifix
[(jest '"""\0a') (jest '\0a"""')]
%- star ;~ pose
%- star
;~ pose
;~(pfix bas ;~(pose bas kel bix:ab))
;~(less bas kel prn)
;~(less (jest '\0a"""') (just `@`10))
(stag ~ sump)
== ==
==
==
++ sump (ifix [kel ker] (stag %cltr (most ace wide)))
++ noil
|= tol=?

View File

@ -887,24 +887,25 @@
=+ spa=;~(pose comt whit)
%+ knee *manx |. ~+
%+ ifix [(star spa) (star spa)]
;~ pose
%+ sear
|=([a=marx b=marl c=mane] ?.(=(c n.a) ~ (some [a b])))
;~ pose
%+ sear |=([a=marx b=marl c=mane] ?.(=(c n.a) ~ (some [a b])))
;~(plug head (more (star comt) ;~(pose apex chrd)) tail)
empt
==
empt
==
::
++ attr :: attribute
%+ knee *mart |. ~+
%- star
;~ pfix (plus whit)
;~ plug name
;~ pfix tis
;~ pose
(ifix [doq doq] (star ;~(less doq escp)))
(ifix [soq soq] (star ;~(less soq escp)))
== ==
== ==
;~ plug name
;~ pfix tis
;~ pose
(ifix [doq doq] (star ;~(less doq escp)))
(ifix [soq soq] (star ;~(less soq escp)))
==
==
==
==
::
++ chrd :: character data
%+ knee *manx |. ~+
@ -915,16 +916,17 @@
(star ;~(less (jest '-->') ;~(pose whit prn)))
::
++ escp
;~ pose
;~(less gal gar pam prn)
(cold '>' (jest '&gt;'))
(cold '<' (jest '&lt;'))
(cold '&' (jest '&amp;'))
(cold '"' (jest '&quot;'))
(cold '\'' (jest '&apos;'))
==
;~ pose
;~(less gal gar pam prn)
(cold '>' (jest '&gt;'))
(cold '<' (jest '&lt;'))
(cold '&' (jest '&amp;'))
(cold '"' (jest '&quot;'))
(cold '\'' (jest '&apos;'))
==
++ empt :: self-closing tag
(ifix [gal (jest '/>')] ;~(plug ;~(plug name attr) (cold ~ (star whit))))
%+ ifix [gal ;~(plug (stun [0 1] ace) (jest '/>'))]
;~(plug ;~(plug name attr) (cold ~ (star whit)))
::
++ head :: opening tag
%+ knee *marx |. ~+
@ -2067,63 +2069,64 @@
::
++ glam
|= zar=@p ^- tape
%+ snag zar
^- (list tape)
:~ "Tianming" "Pepin the Short" "Haile Selassie" "Alfred the Great"
"Tamerlane" "Pericles" "Talleyrand" "Yongle" "Seleucus"
"Uther Pendragon" "Louis XVI" "Ahmad Shāh Durrānī" "Constantine"
"Wilhelm I" "Akbar" "Louis XIV" "Nobunaga" "Alexander VI"
"Philippe II" "Julius II" "David" "Niall Noígíallach" "Kublai Khan"
"Öz Beg Khan" "Ozymandias" "Ögedei Khan" "Jiang Jieshi" "Darius"
"Shivaji" "Qianlong" "Bolesław I Chrobry" "Tigranes" "Han Wudi"
"Charles X" "Naresuan" "Frederick II" "Simeon" "Kangxi"
"Suleiman the Magnificent" "Pedro II" "Genghis Khan" "Laozi"
"Porfirio Díaz" "Pakal" "Wu Zetian" "Garibaldi" "Matthias Corvinus"
"Leopold II" "Leonidas" "Sitting Bull" "Nebuchadnezzar II"
"Rhodes" "Henry VIII" "Attila" "Catherine II" "Chulalongkorn"
"Uthmān" "Augustus" "Faustin" "Chongde" "Justinian"
"Afonso de Albuquerque" "Antoninus Pius" "Cromwell" "Innocent X"
"Fidel" "Frederick the Great" "Canute" "Vytautas" "Amina"
"Hammurabi" "Suharto" "Victoria" "Hiawatha" "Paul V" "Shaka"
"Lê Thánh Tông" "Ivan Asen II" "Tiridates" "Nefertiti" "Gwangmu"
"Ferdinand & Isabella" "Askia" "Xuande" "Boris Godunov" "Gilgamesh"
"Maximillian I" "Mao" "Charlemagne" "Narai" "Hanno" "Charles I & V"
"Alexander II" "Mansa Musa" "Zoe Porphyrogenita" "Metternich"
"Robert the Bruce" "Pachacutec" "Jefferson" "Solomon" "Nicholas I"
"Barbarossa" "FDR" "Pius X" "Gwanggaeto" "Abbas I" "Julius Caesar"
"Lee Kuan Yew" "Ranavalona I" "Go-Daigo" "Zenobia" "Henry V"
"Bảo Đại" "Casimir III" "Cyrus" "Charles the Wise" "Sandrokottos"
"Agamemnon" "Clement VII" "Suppiluliuma" "Deng Xiaoping"
"Victor Emmanuel" "Ajatasatru" "Jan Sobieski" "Huangdi" "Xuantong"
"Narmer" "Cosimo de' Medici" "Möngke Khan" "Stephen Dušan" "Henri IV"
"Mehmed Fatih" "Conn Cétchathach" "Francisco Franco" "Leo X"
"Kammu" "Krishnadevaraya" "Elizabeth I" "Norton I" "Washington"
"Meiji" "Umar" "TR" "Peter the Great" "Agustin I" "Ashoka"
"William the Conqueror" "Kongolo Mwamba" "Song Taizu"
"Ivan the Terrible" "Yao" "Vercingetorix" "Geronimo" "Rurik"
"Urban VIII" "Alexios Komnenos" "Maria I" "Tamar" "Bismarck"
"Arthur" "Jimmu" "Gustavus Adolphus" "Suiko" "Basil I" "Montezuma"
"Santa Anna" "Xerxes" "Beyazıt Yıldırım" "Samudragupta" "James I"
"George III" "Kamehameha" "Francesco Sforza" "Trajan"
"Rajendra Chola" "Hideyoshi" "Cleopatra" "Alexander"
"Ashurbanipal" "Paul III" "Vespasian" "Tecumseh" "Narasimhavarman"
"Suryavarman II" "Bokassa I" "Charles Canning" "Theodosius"
"Francis II" "Zhou Wen" "William Jardine" "Ahmad al-Mansur"
"Lajos Nagy" "Theodora" "Mussolini" "Samuil" "Osman Gazi"
"Kim Il-sung" "Maria Theresa" "Lenin" "Tokugawa" "Marcus Aurelius"
"Nzinga Mbande" "Edward III" "Joseph II" "Pulakesi II" "Priam"
"Qin Shi Huang" "Shah Jahan" "Sejong" "Sui Wendi" "Otto I"
"Napoleon III" "Prester John" "Dido" "Joao I" "Gregory I"
"Gajah Mada" "Abd-ar Rahmān III" "Taizong" "Franz Josef I"
"Nicholas II" "Gandhi" "Chandragupta II" "Peter III"
"Oba Ewuare" "Louis IX" "Napoleon" "Selim Yavuz" "Shun"
"Hayam Wuruk" "Jagiełło" "Nicaule" "Sargon" "Saladin" "Charles II"
"Brian Boru" "Da Yu" "Antiochus III" "Charles I"
"Jan Pieterszoon Coen" "Hongwu" "Mithridates" "Hadrian" "Ptolemy"
"Benito Juarez" "Sun Yat-sen" "Raja Raja Chola" "Bolivar" "Pius VII"
"Shapur II" "Taksin" "Ram Khamhaeng" "Hatshepsut" "Alī" "Matilda"
"Ataturk"
==
"Mysterious Carrier"
:: %+ snag zar
:: ^- (list tape)
:: :~ "Tianming" "Pepin the Short" "Haile Selassie" "Alfred the Great"
:: "Tamerlane" "Pericles" "Talleyrand" "Yongle" "Seleucus"
:: "Uther Pendragon" "Louis XVI" "Ahmad Shāh Durrānī" "Constantine"
:: "Wilhelm I" "Akbar" "Louis XIV" "Nobunaga" "Alexander VI"
:: "Philippe II" "Julius II" "David" "Niall Noígíallach" "Kublai Khan"
:: "Öz Beg Khan" "Ozymandias" "Ögedei Khan" "Jiang Jieshi" "Darius"
:: "Shivaji" "Qianlong" "Bolesław I Chrobry" "Tigranes" "Han Wudi"
:: "Charles X" "Naresuan" "Frederick II" "Simeon" "Kangxi"
:: "Suleiman the Magnificent" "Pedro II" "Genghis Khan" "Laozi"
:: "Porfirio Díaz" "Pakal" "Wu Zetian" "Garibaldi" "Matthias Corvinus"
:: "Leopold II" "Leonidas" "Sitting Bull" "Nebuchadnezzar II"
:: "Rhodes" "Henry VIII" "Attila" "Catherine II" "Chulalongkorn"
:: "Uthmān" "Augustus" "Faustin" "Chongde" "Justinian"
:: "Afonso de Albuquerque" "Antoninus Pius" "Cromwell" "Innocent X"
:: "Fidel" "Frederick the Great" "Canute" "Vytautas" "Amina"
:: "Hammurabi" "Suharto" "Victoria" "Hiawatha" "Paul V" "Shaka"
:: "Lê Thánh Tông" "Ivan Asen II" "Tiridates" "Nefertiti" "Gwangmu"
:: "Ferdinand & Isabella" "Askia" "Xuande" "Boris Godunov" "Gilgamesh"
:: "Maximillian I" "Mao" "Charlemagne" "Narai" "Hanno" "Charles I & V"
:: "Alexander II" "Mansa Musa" "Zoe Porphyrogenita" "Metternich"
:: "Robert the Bruce" "Pachacutec" "Jefferson" "Solomon" "Nicholas I"
:: "Barbarossa" "FDR" "Pius X" "Gwanggaeto" "Abbas I" "Julius Caesar"
:: "Lee Kuan Yew" "Ranavalona I" "Go-Daigo" "Zenobia" "Henry V"
:: "Bảo Đại" "Casimir III" "Cyrus" "Charles the Wise" "Sandrokottos"
:: "Agamemnon" "Clement VII" "Suppiluliuma" "Deng Xiaoping"
:: "Victor Emmanuel" "Ajatasatru" "Jan Sobieski" "Huangdi" "Xuantong"
:: "Narmer" "Cosimo de' Medici" "Möngke Khan" "Stephen Dušan" "Henri IV"
:: "Mehmed Fatih" "Conn Cétchathach" "Francisco Franco" "Leo X"
:: "Kammu" "Krishnadevaraya" "Elizabeth I" "Norton I" "Washington"
:: "Meiji" "Umar" "TR" "Peter the Great" "Agustin I" "Ashoka"
:: "William the Conqueror" "Kongolo Mwamba" "Song Taizu"
:: "Ivan the Terrible" "Yao" "Vercingetorix" "Geronimo" "Rurik"
:: "Urban VIII" "Alexios Komnenos" "Maria I" "Tamar" "Bismarck"
:: "Arthur" "Jimmu" "Gustavus Adolphus" "Suiko" "Basil I" "Montezuma"
:: "Santa Anna" "Xerxes" "Beyazıt Yıldırım" "Samudragupta" "James I"
:: "George III" "Kamehameha" "Francesco Sforza" "Trajan"
:: "Rajendra Chola" "Hideyoshi" "Cleopatra" "Alexander"
:: "Ashurbanipal" "Paul III" "Vespasian" "Tecumseh" "Narasimhavarman"
:: "Suryavarman II" "Bokassa I" "Charles Canning" "Theodosius"
:: "Francis II" "Zhou Wen" "William Jardine" "Ahmad al-Mansur"
:: "Lajos Nagy" "Theodora" "Mussolini" "Samuil" "Osman Gazi"
:: "Kim Il-sung" "Maria Theresa" "Lenin" "Tokugawa" "Marcus Aurelius"
:: "Nzinga Mbande" "Edward III" "Joseph II" "Pulakesi II" "Priam"
:: "Qin Shi Huang" "Shah Jahan" "Sejong" "Sui Wendi" "Otto I"
:: "Napoleon III" "Prester John" "Dido" "Joao I" "Gregory I"
:: "Gajah Mada" "Abd-ar Rahmān III" "Taizong" "Franz Josef I"
:: "Nicholas II" "Gandhi" "Chandragupta II" "Peter III"
:: "Oba Ewuare" "Louis IX" "Napoleon" "Selim Yavuz" "Shun"
:: "Hayam Wuruk" "Jagiełło" "Nicaule" "Sargon" "Saladin" "Charles II"
:: "Brian Boru" "Da Yu" "Antiochus III" "Charles I"
:: "Jan Pieterszoon Coen" "Hongwu" "Mithridates" "Hadrian" "Ptolemy"
:: "Benito Juarez" "Sun Yat-sen" "Raja Raja Chola" "Bolivar" "Pius VII"
:: "Shapur II" "Taksin" "Ram Khamhaeng" "Hatshepsut" "Alī" "Matilda"
:: "Ataturk"
:: ==
::
++ glon
|= lag=lang
@ -2210,7 +2213,7 @@
?: ?=(| -.mud) mud
(mule |.((slam p.mud sam)))
::
++ numb :: ship display name? XX
++ numb :: ship display name?
|= [him=@p now=@da] ^- @t
=+ yow=(scot %p him)
=+ woy=((hard ,@t) .^(%a yow %name (scot %da now) ~))
@ -2282,8 +2285,9 @@
|% ++ seal |=([a=pass b=@ c=@] _@) :: encrypt to a
++ sign |=([a=@ b=@] _@) :: certify as us
++ sure |=([a=@ b=@] *(unit ,@)) :: authenticate from us
++ tear |=([a=pass b=@] *(unit ,[p=@ q=@])) :: accept from a
--
++ tear |= [a=pass b=@] :: accept from a
*(unit ,[p=@ q=@]) ::
-- ::
++ de |+([a=@ b=@] *(unit ,@)) :: symmetric de, soft
++ dy |+([a=@ b=@] _@) :: symmetric de, hard
++ en |+([a=@ b=@] _@) :: symmetric en
@ -2365,8 +2369,8 @@
[| p=(list ,@tas)] :: alter
== ::
++ chum ,@uvI :: hashed passcode
++ claw $: :: startup chain
joy=(unit coal) :: local context
++ claw :: startup chain
$: joy=(unit coal) :: local context
ran=(unit coal) :: arguments
pux=(unit path) :: execution path
jiv=(unit coal) :: app configuration

View File

@ -1,5 +1,5 @@
!:
::::::::: Foobug: a simple application.
::::::::: Appbug: a simple application.
::
|_ [hid=hide vat=[%0 p=@ud]]
++ poke
@ -14,7 +14,8 @@
^- manx
;html
;head
;title: Foobug!
;title: Appbug!
;script: appl = '{(trip app.hid)}'
==
;body
;p: Dude, a better answer is {<p.vat>}.
@ -25,9 +26,9 @@
; function bump() {
; xhr = new XMLHttpRequest();
; xhr.onload = function() { mess++; }
; xhr.open("PUT", "/tim/"+user+"/"+appl+"/"+port+"/"+mess);
; xhr.open("PUT", "/tim/" + [user, port, mess].join("/"));
; xhr.setRequestHeader("content-type", "text/json");
; xhr.send(JSON.stringify({oryx: oryx, xyro: {}}));
; xhr.send(JSON.stringify({oryx: oryx, xyro: {appl: appl}}));
; }
==
==

View File

@ -4,7 +4,7 @@
=> .(-< `who=@p`-<)
=> .(+ =>(+ ^/===/lib/pony))
|= [est=time *]
|= arg=$|(~ [p=@p ~])
|= arg=$|(~ [p=@p q=$|(~ [p=@p ~])])
=- ^- bowl
?^ arg (fud p.arg)
%+ pomp ""
@ -65,8 +65,10 @@
%+ pomp ""
%+ pomp " -- Bunting, _Chomei at Toyama_"
%+ pogo (pond ^:@/===doc%/warning/txt)
%+ (polo %text "Your ticket: ~" ~ ~)
fed:ag
=- ?: ?=([@ @ ~] arg)
(- ~ p.q.arg)
%+ (polo %text "Your ticket: ~" ~ ~)
fed:ag -
|= [* tic=@p]
%+ pogo (pond ^:@/===doc%/entropy/txt)
%+ (polo %pass "Entropy: " ~ ~)

View File

@ -26,8 +26,11 @@
=+ lum=`(unit (unit mizu))`(~(auld ze est owr ran) gem who des sab est)
?~ lum
^- gift
:+ %la %leaf
"{(trip des)} failed to apply, please rerun with a merge option"
:^ %la %rose [": " "" ""]
:~
leaf/"{(trip des)} failed to apply, please rerun with a merge option"
(skol -:!>(_germ))
==
?~ u.lum
`gift`[%la %leaf "{(trip des)} is up to date"]
`gift`[%og des u.u.lum]

View File

@ -158,8 +158,11 @@ window.urb = {
$this = this
this.req(method,url,params,false,function(err,data) {
console.log(data)
if(cb) {
cb.call(this,err,{status: data.status, data: data.data.data})
} else if (data.data.reload) {
document.location.reload()
} else {
fn = data.data.appl+","+data.data.path.replace(/[^\x00-\x7F]/g, "")
+","+data.data.ship
@ -180,3 +183,5 @@ window.urb = {
})
}
}
auto = false

421
main/pro/down/core.hoon Normal file
View File

@ -0,0 +1,421 @@
::
:::: /hoon/core/down/pro
::
/? 314
!:
:::: describe
::
=>
|%
++ down
$& [p=down q=down]
$% [%$ p=tape]
[%code p=tape]
[%inco p=tape]
[%head p=@ud q=down]
[%link p=tape q=tape r=(unit tape)]
[%lord p=(list down)]
[%lund p=(list down)]
[%parg p=down]
[%quot p=down]
[%rong p=down]
[%emph p=down]
[%hrul ~]
[%html p=tape]
==
--
::
:::: compute
::
|_ don=down
++ grab :: convert from
|%
++ md :: convert from %md
|= src=@t
=< (mark (trip src))
|%
++ cott
;~ pose
(shim 0 8)
(shim 11 37)
(shim 39 59)
(just `@`61)
(shim 63 95)
(shim 97 255)
==
++ copt
;~ pose
(shim 0 9)
(shim 11 37)
(shim 39 39)
(shim 43 59)
(just `@`61)
(shim 63 90)
(shim 94 94)
(shim 97 255)
==
++ urlc ;~(pose (shim 0 9) (shim 11 31) (shim 33 39) (shim 42 255))
++ uctt ;~(pose (shim 0 9) (shim 11 91) (shim 94 255))
++ uctc ;~(pose (shim 0 9) (shim 11 33) (shim 35 39) (shim 42 255))
++ htmc ;~(pose (shim 0 9) (shim 11 255))
++ escp (mask "\\`*_\{}[]()#+-.!")
++ escd ;~(pfix bas escp)
++ whit (mask (tape 9 32 ~))
++ dent ;~(pose (jest ' ') (just `@`9))
++ blan (cold ~ ;~(plug (star whit) (just `@`10)))
++ mcat (bend |=([a=tape b=tape] (some (weld a b))))
++ wcat |*(a=_rule (cook |=([a=tape b=tape] (weld a b)) a))
++ codt
%+ knee *tape |. ~+
;~ pose
(wcat ;~(plug (plus cott) codt))
(cook |=(a=tape (weld "&lt;" a)) ;~(pfix gal ;~(pose codt (easy ~))))
(cook |=(a=tape (weld "&gt;" a)) ;~(pfix gar ;~(pose codt (easy ~))))
(cook |=(a=tape (weld "&amp;" a)) ;~(pfix pam ;~(pose codt (easy ~))))
(plus cott)
==
++ inlt
%+ knee *tape |. ~+
;~ pose
;~(mcat (plus copt) inlt)
;~(mcat (plus escd) inlt)
;~ mcat
%- wcat
;~ plug
;~(plug gal (cook trip inle))
;~(sfix (wcat ;~(plug (star copt) (easy ">"))) gar)
==
inlt
==
;~ mcat
%- wcat
;~ plug
;~(plug gal fas (cook trip inle))
;~(sfix (wcat ;~(plug (star copt) (easy ">"))) gar)
==
inlt
==
;~ mcat
(wcat ;~(plug ;~(plug pam hax ;~(sfix (plus nud) sem)) (easy ";")))
inlt
==
;~ mcat
(wcat ;~(plug ;~(plug pam ;~(sfix (plus alf) sem)) (easy ";")))
inlt
==
(cook |=(a=tape (weld "&lt;" a)) ;~(pfix gal ;~(pose inlt (easy ~))))
(cook |=(a=tape (weld "&gt;" a)) ;~(pfix gar ;~(pose inlt (easy ~))))
(cook |=(a=tape (weld "&amp;" a)) ;~(pfix pam ;~(pose inlt (easy ~))))
==
++ kite
|= bud=(list ,@t)
|= tub=nail
|- ^- (like ,@t)
?@ bud
(fail tub)
=+ foo=((jest i.bud) tub)
?~ q.foo
$(bud t.bud)
foo
++ bloc
%+ knee *@t |. ~+
%- kite
:~ '<address>' '<article>' '<aside>' '<audio>' '<blockquote>'
'<canvas>' '<dd>' '<div>' '<dl>' '<fieldset>' '<figcaption>'
'<figure>' '<footer>' '<form>' '<h1>' '<h2>' '<h3>' '<h4>'
'<h5>' '<h6>' '<header>' '<hgroup>' '<hr>' '<noscript>'
'<ol>' '<output>' '<p>' '<pre>' '<section>' '<table>'
'<tfoot>' '<ul>' '<video>' '<style>'
==
++ inle
%+ knee *@t |. ~+
%- kite
:~ 'b' 'big' 'i' 'small' 'tt' 'abbr' 'acronym'
'cite' 'code' 'dfn' 'em' 'kbd' 'strong' 'samp'
'var' 'a' 'bdo' 'br' 'img' 'map' 'object' 'q'
'script' 'span' 'sub' 'sup' 'button' 'input'
'label' 'select' 'textarea' 'link'
==
++ htmb
%+ knee *tape |. ~+
%+ cook |=(a=(list tape) (reel a |=([p=tape q=tape] (weld p q))))
(plus (cook |=(a=tape (weld a "\0a")) ;~(sfix (plus htmc) (just '\0a'))))
++ blok
%+ knee *tape |. ~+
%+ cook |=(a=[tape tape] (weld a))
;~(plug (cook trip bloc) ;~(plug (just '\0a') htmb))
++ intt
%+ knee *down |. ~+
;~ pose
(ifix [(jest '**') (jest '**')] (stag %rong intt))
(ifix [(jest '__') (jest '__')] (stag %rong intt))
(ifix [tar tar] (stag %emph intt))
(ifix [cab cab] (stag %emph intt))
(ifix [tec tec] (stag %inco codt))
(stag %$ inlt)
link
(stag %$ ;~(plug tar (easy ~)))
(stag %$ ;~(plug cab (easy ~)))
(stag %$ ;~(plug pel (easy ~)))
(stag %$ ;~(plug per (easy ~)))
(stag %$ ;~(plug sel (easy ~)))
(stag %$ ;~(plug ser (easy ~)))
==
++ inli
|= tub=nail
^- (like down)
?~ q.tub
(fail tub)
?: |(=(i.q.tub 10) =(i.q.tub '>'))
(fail tub)
=+ ^= foo
;~ pose
dent
;~(plug (mask "+*-") (plus whit))
;~(plug dim:ag dot (plus whit))
==
=+ bar=(foo tub)
?~ q.bar
%-
%+ cook |=(a=(list down) (reel a |=([p=down q=down] [p q])))
;~(sfix (plus intt) (just `@`10))
tub
(fail tub)
++ parg
|= [a=@ b=@]
%+ knee *down |. ~+
;~ plug
inli
%+ cook |=(a=(list down) (reel a |=([p=down q=down] [p q])))
(plus ;~(plug (easy [%$ "\0a"]) (colk a b inli)))
==
++ link
%+ knee *down |. ~+
%+ stag %link
;~ plug
(ifix [sel ser] (plus ;~(pose uctt escd)))
;~(pfix pel (star ;~(pose urlc escd)))
;~ pose
%+ cook |=(a=tape (some a))
(ifix [ace per] (ifix [doq doq] (plus ;~(pose uctc escd))))
(cold ~ per)
==
==
++ barg
|= a=@
%+ knee _@ud |. ~+
;~ pfix (stun [a a] (jest '> '))
;~ pose
(cold 1 ;~(plug (plus tis) (star whit) (just `@`10)))
(cold 2 ;~(plug (plus hep) (star whit) (just `@`10)))
==
==
++ neck
%+ knee [_@ud *down] |. ~+
;~ pose
;~(pfix (jest '######') (stag 6 ;~(pfix (star whit) inli)))
;~(pfix (jest '#####') (stag 5 ;~(pfix (star whit) inli)))
;~(pfix (jest '####') (stag 4 ;~(pfix (star whit) inli)))
;~(pfix (jest '###') (stag 3 ;~(pfix (star whit) inli)))
;~(pfix (jest '##') (stag 2 ;~(pfix (star whit) inli)))
;~(pfix (jest '#') (stag 1 ;~(pfix (star whit) inli)))
==
++ mark
|= p=tape
(scan p park)
++ hrul
%+ knee *down |. ~+
%+ sear
|=(a=(list tape) ?:((gte (lent (zing a)) 3) (some [%hrul ~]) ~))
;~ sfix
(more (star whit) ;~(pose (plus cab) (plus tar) (plus hep)))
(just `@`10)
==
++ colk
|* [a=@ b=@ fel=_rule]
;~(pfix (stun [a a] (jest '> ')) (stun [b b] dent) fel)
++ code
|= [a=@ b=@]
%+ knee *tape |. ~+
%+ cook welp
;~ plug
(ifix [dent (just '\0a')] codt)
%+ cook |=(a=(list tape) (reel a |=([p=tape q=tape] (weld p q))))
%- star
;~(plug (easy '\0a') (colk a b (ifix [dent (just '\0a')] codt)))
==
++ lelm
|= [a=@ b=@]
%+ knee *down |. ~+
;~ pose
inli
hrul
;~(pfix (just `@`10) (lmel a b))
==
++ lmel
|= [a=@ b=@]
%+ knee *down |. ~+
;~ pose
;~((bend) (stag %lund (plus (lulm a b))) (lmel a b))
;~((bend) (stag %lord (plus (lolm a b))) (lmel a b))
;~((bend) (stag %code (colk a b (code a b))) (lmel a b))
;~((bend) (stag %head (colk a b neck)) (lmel a b))
;~((bend) (stag %parg (colk a b (parg a b))) (lmel a b))
(colk a b inli)
(colk a b hrul)
;~(pfix (plus (colk a b blan)) (lmel a b))
==
++ lulm
|= [a=@ b=@]
%+ knee *down |. ~+
(colk a b ;~(pfix (mask "+*-") (plus whit) (lelm a +(b))))
++ lolm
|= [a=@ b=@]
%+ knee *down |. ~+
(colk a b ;~(pfix dim:ag dot (plus whit) (lelm a +(b))))
++ bark
|= a=@
%+ knee *down |. ~+
;~ pose
(stag %html blok)
(stag %lund (plus (lulm a 0)))
(stag %lord (plus (lolm a 0)))
(stag %code (colk a 0 (code a 0)))
(stag %head (colk a 0 neck))
%+ cook |=([a=down b=@ud] [%head b a])
(colk a 0 ;~(plug inli (barg a)))
(colk a 0 hrul)
(stag %parg (colk a 0 (parg a 0)))
(colk a 0 inli)
(cold [%$ ""] (colk a 0 (plus blan)))
==
++ dark
|= a=@
%+ knee *down |. ~+
|= tub=nail
^- (like down)
=+ vex=((cook lent (star (jest '> '))) tub)
?~ q.vex
vex
?: (lth p.u.q.vex a)
(fail tub)
?: (gth p.u.q.vex a)
(;~((bend) (stag %quot (dark +(a))) (dark a)) tub)
(;~((bend) (bark a) (dark a)) tub)
++ park
%+ knee *down |. ~+
%+ cook |=(a=(list down) (reel a |=([p=down q=down] [p q])))
;~(sfix (plus (dark 0)) (star blan))
++ appd
|= [p=@ q=@]
^- @
(cat 3 p q)
++ wtag
|= [a=@ b=@]
^- @
:(appd '<' a '>' b '</' a '>')
++ sett
|= [a=@ b=tape]
^- @
:(appd a '="' (rap 3 b) '"')
++ hark
|= a=down
^- @
?- a
[%$ *] (rap 3 p.a)
[%code *] (wtag 'pre' (wtag 'code' (rap 3 p.a)))
[%inco *] (wtag 'code' (rap 3 p.a))
[%head *] (wtag (cat 3 'h' (add '0' p.a)) (hark q.a))
[%link *]
?~ r.a
:(appd '<a ' (sett 'href' q.a) '>' (rap 3 p.a) '</a>')
;: appd
'<a '
(sett 'href' q.a)
' '
(sett 'title' u.r.a)
'>'
(rap 3 p.a)
'</a>'
==
::
[%lord *]
(wtag 'ol' (reel (turn p.a |=(a=down (wtag 'li' (hark a)))) appd))
::
[%lund *]
(wtag 'ul' (reel (turn p.a |=(a=down (wtag 'li' (hark a)))) appd))
::
[%parg *] (wtag 'p' (hark p.a))
[%quot *] (wtag 'blockquote' (hark p.a))
[%rong *] (wtag 'strong' (hark p.a))
[%emph *] (wtag 'em' (hark p.a))
[%hrul *] '<hr>'
[%html *] (rap 3 p.a)
^ (cat 3 (hark p.a) (hark q.a))
==
--
::
++ noun :: convert from %noun
|= src=*
^+ +>+
+>+(don (down src))
--
::
++ grow :: convert into
|%
++ html :: convert into %html
=< :(appd '<html><body>' (hark don) '</body></html>')
|%
++ appd
|= [p=@ q=@]
^- @
(cat 3 p q)
::
++ hark
|= a=down
^- @
?- a
[%$ *] (rap 3 p.a)
[%code *] (wtag 'pre' (wtag 'code' (rap 3 p.a)))
[%inco *] (wtag 'code' (rap 3 p.a))
[%head *] (wtag (cat 3 'h' (add '0' p.a)) (hark q.a))
[%link *]
?~ r.a
:(appd '<a ' (sett 'href' q.a) '>' (rap 3 p.a) '</a>')
;: appd
'<a '
(sett 'href' q.a)
' '
(sett 'title' u.r.a)
'>'
(rap 3 p.a)
'</a>'
==
::
[%lord *]
(wtag 'ol' (reel (turn p.a |=(a=down (wtag 'li' (hark a)))) appd))
::
[%lund *]
(wtag 'ul' (reel (turn p.a |=(a=down (wtag 'li' (hark a)))) appd))
::
[%parg *] (wtag 'p' (hark p.a))
[%quot *] (wtag 'blockquote' (hark p.a))
[%rong *] (wtag 'strong' (hark p.a))
[%emph *] (wtag 'em' (hark p.a))
[%hrul *] '<hr>'
[%html *] (rap 3 p.a)
^ (cat 3 (hark p.a) (hark q.a))
==
::
++ wtag
|= [a=@ b=@]
^- @
:(appd '<' a '>' b '</' a '>')
::
++ sett
|= [a=@ b=tape]
^- @
:(appd a '="' (rap 3 b) '"')
--
--
--

16
main/pro/html/core.hoon Normal file
View File

@ -0,0 +1,16 @@
::
:::: /hoon/core/html/pro
::
/? 314
::
:::: compute
::
|_ htm=@t
::
++ grow :: convert to
|%
++ mime :: convert to %mime
[/text/html (met 3 htm) htm]
--
--

17
main/pro/hymn/core.hoon Normal file
View File

@ -0,0 +1,17 @@
::
:::: /hoon/core/hymn/pro
::
/? 314
::
:::: compute
::
|_ man=manx
::
++ grow :: convert to
|%
++ mime :: convert to %mime
=+ htm=(crip (xmlt | man ~))
[/text/html (taco htm)]
--
--

17
main/pro/json/core.hoon Normal file
View File

@ -0,0 +1,17 @@
::
:::: /hoon/core/hymn/pro
::
/? 314
::
:::: compute
::
|_ jon=json
::
++ grow :: convert to
|%
++ mime :: convert to %mime
=+ htm=(crip (pojo jon))
[/text/html (taco htm)]
--
--

7
main/pro/md/core.hoon Normal file
View File

@ -0,0 +1,7 @@
::
:::: /hoon/core/md/pro
::
/? 314
|_ mud=@t
++ garb [%down ~]
--

15
main/pro/zong/core.hoon Normal file
View File

@ -0,0 +1,15 @@
::
:::: /hoon/core/zong/pro
::
/? 314
/- zong
|_ zog=zong
::
++ grab :: convert from
|%
++ noun :: convert from %noun
|= src=*
^+ +>+
+>+(zog (zong src))
--
--

15
main/str/down/gate.hoon Normal file
View File

@ -0,0 +1,15 @@
$& [p=down q=down]
$% [%$ p=tape]
[%code p=tape]
[%inco p=tape]
[%head p=@ud q=down]
[%link p=tape q=tape r=(unit tape)]
[%lord p=(list down)]
[%lund p=(list down)]
[%parg p=down]
[%quot p=down]
[%rong p=down]
[%emph p=down]
[%hrul ~]
[%html p=tape]
==

11
main/str/zong/gate.hoon Normal file
View File

@ -0,0 +1,11 @@
=< zong
|%
++ mess :: message
$% [%do p=@t] :: act
[%exp p=@t q=tank] :: code
[%say p=@t] :: speak
==
++ zong
$% [%mess p=@da q=ship r=mess]
==
--

View File

@ -1 +1 @@
,[p=ship q=guid]
,[p=ship q=@uwK]

View File

@ -1,4 +1,4 @@
!:
::
::::::::: /sys/down/ref/gate
::
=< down
@ -20,4 +20,3 @@
[%html p=tape]
==
--

View File

@ -1,3 +1,4 @@
!:
|= htm=@
[/text/html (met 3 htm) htm]

View File

@ -2,343 +2,3 @@
::::::::: /sys/md/tan/down/gate
::
=>
|%
++ down
$& [p=down q=down]
$% [%$ p=tape]
[%code p=tape]
[%inco p=tape]
[%head p=@ud q=down]
[%link p=tape q=tape r=(unit tape)]
[%lord p=(list down)]
[%lund p=(list down)]
[%parg p=down]
[%quot p=down]
[%rong p=down]
[%emph p=down]
[%hrul ~]
[%html p=tape]
==
--
=< |=(txt=@ (mark (trip txt)))
|%
++ cott
;~ pose
(shim 0 8)
(shim 11 37)
(shim 39 59)
(just `@`61)
(shim 63 95)
(shim 97 255)
==
++ copt
;~ pose
(shim 0 9)
(shim 11 37)
(shim 39 39)
(shim 43 59)
(just `@`61)
(shim 63 90)
(shim 94 94)
(shim 97 255)
==
++ urlc ;~(pose (shim 0 9) (shim 11 31) (shim 33 39) (shim 42 255))
++ uctt ;~(pose (shim 0 9) (shim 11 91) (shim 94 255))
++ uctc ;~(pose (shim 0 9) (shim 11 33) (shim 35 39) (shim 42 255))
++ htmc ;~(pose (shim 0 9) (shim 11 255))
++ escp (mask "\\`*_\{}[]()#+-.!")
++ escd ;~(pfix bas escp)
++ whit (mask (tape 9 32 ~))
++ dent ;~(pose (jest ' ') (just `@`9))
++ blan (cold ~ ;~(plug (star whit) (just `@`10)))
++ mcat (bend |=([a=tape b=tape] (some (weld a b))))
++ wcat |*(a=_rule (cook |=([a=tape b=tape] (weld a b)) a))
++ codt
%+ knee *tape |. ~+
;~ pose
(wcat ;~(plug (plus cott) codt))
(cook |=(a=tape (weld "&lt;" a)) ;~(pfix gal ;~(pose codt (easy ~))))
(cook |=(a=tape (weld "&gt;" a)) ;~(pfix gar ;~(pose codt (easy ~))))
(cook |=(a=tape (weld "&amp;" a)) ;~(pfix pam ;~(pose codt (easy ~))))
(plus cott)
==
++ inlt
%+ knee *tape |. ~+
;~ pose
;~(mcat (plus copt) inlt)
;~(mcat (plus escd) inlt)
;~ mcat
%- wcat
;~ plug
;~(plug gal (cook trip inle))
;~(sfix (wcat ;~(plug (star copt) (easy ">"))) gar)
==
inlt
==
;~ mcat
%- wcat
;~ plug
;~(plug gal fas (cook trip inle))
;~(sfix (wcat ;~(plug (star copt) (easy ">"))) gar)
==
inlt
==
;~ mcat
(wcat ;~(plug ;~(plug pam hax ;~(sfix (plus nud) sem)) (easy ";")))
inlt
==
;~ mcat
(wcat ;~(plug ;~(plug pam ;~(sfix (plus alf) sem)) (easy ";")))
inlt
==
(cook |=(a=tape (weld "&lt;" a)) ;~(pfix gal ;~(pose inlt (easy ~))))
(cook |=(a=tape (weld "&gt;" a)) ;~(pfix gar ;~(pose inlt (easy ~))))
(cook |=(a=tape (weld "&amp;" a)) ;~(pfix pam ;~(pose inlt (easy ~))))
==
++ kite
|= bud=(list ,@t)
|= tub=nail
|- ^- (like ,@t)
?@ bud
(fail tub)
=+ foo=((jest i.bud) tub)
?~ q.foo
$(bud t.bud)
foo
++ bloc
%+ knee *@t |. ~+
%- kite
:~ '<address>' '<article>' '<aside>' '<audio>' '<blockquote>'
'<canvas>' '<dd>' '<div>' '<dl>' '<fieldset>' '<figcaption>'
'<figure>' '<footer>' '<form>' '<h1>' '<h2>' '<h3>' '<h4>'
'<h5>' '<h6>' '<header>' '<hgroup>' '<hr>' '<noscript>'
'<ol>' '<output>' '<p>' '<pre>' '<section>' '<table>'
'<tfoot>' '<ul>' '<video>' '<style>'
==
++ inle
%+ knee *@t |. ~+
%- kite
:~ 'b' 'big' 'i' 'small' 'tt' 'abbr' 'acronym'
'cite' 'code' 'dfn' 'em' 'kbd' 'strong' 'samp'
'var' 'a' 'bdo' 'br' 'img' 'map' 'object' 'q'
'script' 'span' 'sub' 'sup' 'button' 'input'
'label' 'select' 'textarea' 'link'
==
++ htmb
%+ knee *tape |. ~+
%+ cook |=(a=(list tape) (reel a |=([p=tape q=tape] (weld p q))))
(plus (cook |=(a=tape (weld a "\0a")) ;~(sfix (plus htmc) (just '\0a'))))
++ blok
%+ knee *tape |. ~+
%+ cook |=(a=[tape tape] (weld a))
;~(plug (cook trip bloc) ;~(plug (just '\0a') htmb))
++ intt
%+ knee *down |. ~+
;~ pose
(ifix [(jest '**') (jest '**')] (stag %rong intt))
(ifix [(jest '__') (jest '__')] (stag %rong intt))
(ifix [tar tar] (stag %emph intt))
(ifix [cab cab] (stag %emph intt))
(ifix [tec tec] (stag %inco codt))
(stag %$ inlt)
link
(stag %$ ;~(plug tar (easy ~)))
(stag %$ ;~(plug cab (easy ~)))
(stag %$ ;~(plug pel (easy ~)))
(stag %$ ;~(plug per (easy ~)))
(stag %$ ;~(plug sel (easy ~)))
(stag %$ ;~(plug ser (easy ~)))
==
++ inli
|= tub=nail
^- (like down)
?~ q.tub
(fail tub)
?: |(=(i.q.tub 10) =(i.q.tub '>'))
(fail tub)
=+ ^= foo
;~ pose
dent
;~(plug (mask "+*-") (plus whit))
;~(plug dim:ag dot (plus whit))
==
=+ bar=(foo tub)
?~ q.bar
%-
%+ cook |=(a=(list down) (reel a |=([p=down q=down] [p q])))
;~(sfix (plus intt) (just `@`10))
tub
(fail tub)
++ parg
|= [a=@ b=@]
%+ knee *down |. ~+
;~ plug
inli
%+ cook |=(a=(list down) (reel a |=([p=down q=down] [p q])))
(plus ;~(plug (easy [%$ "\0a"]) (colk a b inli)))
==
++ link
%+ knee *down |. ~+
%+ stag %link
;~ plug
(ifix [sel ser] (plus ;~(pose uctt escd)))
;~(pfix pel (star ;~(pose urlc escd)))
;~ pose
%+ cook |=(a=tape (some a))
(ifix [ace per] (ifix [doq doq] (plus ;~(pose uctc escd))))
(cold ~ per)
==
==
++ barg
|= a=@
%+ knee _@ud |. ~+
;~ pfix (stun [a a] (jest '> '))
;~ pose
(cold 1 ;~(plug (plus tis) (star whit) (just `@`10)))
(cold 2 ;~(plug (plus hep) (star whit) (just `@`10)))
==
==
++ neck
%+ knee [_@ud *down] |. ~+
;~ pose
;~(pfix (jest '######') (stag 6 ;~(pfix (star whit) inli)))
;~(pfix (jest '#####') (stag 5 ;~(pfix (star whit) inli)))
;~(pfix (jest '####') (stag 4 ;~(pfix (star whit) inli)))
;~(pfix (jest '###') (stag 3 ;~(pfix (star whit) inli)))
;~(pfix (jest '##') (stag 2 ;~(pfix (star whit) inli)))
;~(pfix (jest '#') (stag 1 ;~(pfix (star whit) inli)))
==
++ mark
|= p=tape
(scan p park)
++ hrul
%+ knee *down |. ~+
%+ sear
|=(a=(list tape) ?:((gte (lent (zing a)) 3) (some [%hrul ~]) ~))
;~ sfix
(more (star whit) ;~(pose (plus cab) (plus tar) (plus hep)))
(just `@`10)
==
++ colk
|* [a=@ b=@ fel=_rule]
;~(pfix (stun [a a] (jest '> ')) (stun [b b] dent) fel)
++ code
|= [a=@ b=@]
%+ knee *tape |. ~+
%+ cook welp
;~ plug
(ifix [dent (just '\0a')] codt)
%+ cook |=(a=(list tape) (reel a |=([p=tape q=tape] (weld p q))))
%- star
;~(plug (easy '\0a') (colk a b (ifix [dent (just '\0a')] codt)))
==
++ lelm
|= [a=@ b=@]
%+ knee *down |. ~+
;~ pose
inli
hrul
;~(pfix (just `@`10) (lmel a b))
==
++ lmel
|= [a=@ b=@]
%+ knee *down |. ~+
;~ pose
;~((bend) (stag %lund (plus (lulm a b))) (lmel a b))
;~((bend) (stag %lord (plus (lolm a b))) (lmel a b))
;~((bend) (stag %code (colk a b (code a b))) (lmel a b))
;~((bend) (stag %head (colk a b neck)) (lmel a b))
;~((bend) (stag %parg (colk a b (parg a b))) (lmel a b))
(colk a b inli)
(colk a b hrul)
;~(pfix (plus (colk a b blan)) (lmel a b))
==
++ lulm
|= [a=@ b=@]
%+ knee *down |. ~+
(colk a b ;~(pfix (mask "+*-") (plus whit) (lelm a +(b))))
++ lolm
|= [a=@ b=@]
%+ knee *down |. ~+
(colk a b ;~(pfix dim:ag dot (plus whit) (lelm a +(b))))
++ bark
|= a=@
%+ knee *down |. ~+
;~ pose
(stag %html blok)
(stag %lund (plus (lulm a 0)))
(stag %lord (plus (lolm a 0)))
(stag %code (colk a 0 (code a 0)))
(stag %head (colk a 0 neck))
%+ cook |=([a=down b=@ud] [%head b a])
(colk a 0 ;~(plug inli (barg a)))
(colk a 0 hrul)
(stag %parg (colk a 0 (parg a 0)))
(colk a 0 inli)
(cold [%$ ""] (colk a 0 (plus blan)))
==
++ dark
|= a=@
%+ knee *down |. ~+
|= tub=nail
^- (like down)
=+ vex=((cook lent (star (jest '> '))) tub)
?~ q.vex
vex
?: (lth p.u.q.vex a)
(fail tub)
?: (gth p.u.q.vex a)
(;~((bend) (stag %quot (dark +(a))) (dark a)) tub)
(;~((bend) (bark a) (dark a)) tub)
++ park
%+ knee *down |. ~+
%+ cook |=(a=(list down) (reel a |=([p=down q=down] [p q])))
;~(sfix (plus (dark 0)) (star blan))
++ appd
|= [p=@ q=@]
^- @
(cat 3 p q)
++ wtag
|= [a=@ b=@]
^- @
:(appd '<' a '>' b '</' a '>')
++ sett
|= [a=@ b=tape]
^- @
:(appd a '="' (rap 3 b) '"')
++ hark
|= a=down
^- @
?- a
[%$ *] (rap 3 p.a)
[%code *] (wtag 'pre' (wtag 'code' (rap 3 p.a)))
[%inco *] (wtag 'code' (rap 3 p.a))
[%head *] (wtag (cat 3 'h' (add '0' p.a)) (hark q.a))
[%link *]
?~ r.a
:(appd '<a ' (sett 'href' q.a) '>' (rap 3 p.a) '</a>')
;: appd
'<a '
(sett 'href' q.a)
' '
(sett 'title' u.r.a)
'>'
(rap 3 p.a)
'</a>'
==
::
[%lord *]
(wtag 'ol' (reel (turn p.a |=(a=down (wtag 'li' (hark a)))) appd))
::
[%lund *]
(wtag 'ul' (reel (turn p.a |=(a=down (wtag 'li' (hark a)))) appd))
::
[%parg *] (wtag 'p' (hark p.a))
[%quot *] (wtag 'blockquote' (hark p.a))
[%rong *] (wtag 'strong' (hark p.a))
[%emph *] (wtag 'em' (hark p.a))
[%hrul *] '<hr>'
[%html *] (rap 3 p.a)
^ (cat 3 (hark p.a) (hark q.a))
==
--

344
try/bin/markdown.hoon Normal file
View File

@ -0,0 +1,344 @@
!:
:: /=main=/bin/app/hoon
::
=> %= .
+
=> +
|%
:::: markdown parser
::
++ down (list bloc) :: markdown model
++ bloc :: block elements
$% [%head p=@ud q=(list span) r=(unit tape)]
[%para p=(list span)]
[%lise p=down]
[%list p=? q=down]
[%quot p=down]
[%horz ~]
[%code p=wall]
[%html p=manx]
==
::
++ span :: span elements
$% [%text p=tape]
[%emph p=term q=(list span)]
[%stri p=(list span)]
[%brek ~]
[%link p=(list span) q=tape r=(unit tape)]
[%cods p=tape]
==
::
++ apex :: markdown parser
|= tub=nail
^- (like down)
=+ sep=(sepa tub)
?~ q.sep [p.sep ~]
[p.sep (some [(turn p.u.q.sep |=(a=tape (scan a blos))) [p.sep ~]])]
::
++ base (stag %para ;~(plug (stag %text (plus ;~(pose prn eol))) (easy ~)))
++ blos :: block element
(knee *bloc |.(~+(;~(pose head quot lasd horz code codf html para base))))
::
++ brek (stag %brek (cold ~ ;~(plug fas fas))) :: line break
++ chrd ;~(pose escp prn (cold ' ' eol)) :: span character data
++ code :: code block
%+ stag %code
%- full
%- plus
;~ pfix (stun [4 4] ace)
;~(pose (cook welp ;~(plug (plus prn) (cold "\0a" eol))) (full (plus prn)))
==
::
++ codf :: fenced code block
%+ stag %code
%- full
%+ ifix [;~(plug tec tec tec eol) ;~(plug tec tec tec)]
%- plus
;~ pose
(cook welp ;~(plug (plus prn) (cold "\0a" eol)))
(full (plus ;~(less ;~(plug tec tec tec) prn)))
==
::
++ cods :: code span
%+ stag %cods
=+ chx=;~(pose (cold ' ' eol) prn)
;~ pose
%+ ifix [(jest '```') (jest '```')] (plus ;~(less (jest '```') chx))
%+ ifix [(jest '``') (jest '``')] (plus ;~(less (jest '``') chx))
%+ ifix [tec tec] (plus ;~(less tec chx))
==
::
++ dont ;~(pose tar tec cab ;~(plug sig sig) ;~(plug fas fas) sel)
++ spas :: all span elements
|* res=_rule
(plus ;~(pose emph stri link brek cods (text res)))
::
++ eol (just `@`10) :: newline
++ emph :: emphasis
%+ knee *span |. ~+
%+ stag %emph
=+ inn=(plus ;~(pose cods stri link (text fail)))
;~ pose
(ifix [(jest '***') (jest '***')] (stag %both inn))
(ifix [(jest '**_') (jest '_**')] (stag %both inn))
(ifix [(jest '*__') (jest '__*')] (stag %both inn))
(ifix [(jest '_**') (jest '**_')] (stag %both inn))
(ifix [(jest '__*') (jest '*__')] (stag %both inn))
(ifix [(jest '___') (jest '___')] (stag %both inn))
(ifix [(jest '**') (jest '**')] (stag %bold inn))
(ifix [(jest '__') (jest '__')] (stag %bold inn))
(ifix [tar tar] (stag %ital inn))
(ifix [cab cab] (stag %ital inn))
==
::
++ escp :: escapable chars
;~ pose
(cold '`' (jest '\\`'))
(cold '*' (jest '\\*'))
(cold '#' (jest '\\#'))
(cold '-' (jest '\\-'))
(cold '.' (jest '\\.'))
(cold '{' (jest '\\{'))
(cold '}' (jest '\\}'))
(cold '[' (jest '\\['))
(cold ']' (jest '\\]'))
(cold '\\' (jest '\\\\'))
==
::
++ head :: header
%+ stag %head
=+ ^= hed
;~ pose
;~ plug
;~(pfix wits (spas hax))
(cook some (ifix [;~(plug (star hax) sel hax) ser] (plus alp)))
==
(ifix [wits (star hax)] ;~(plug (spas hax) (easy ~)))
==
=+ ^= sed
;~ pose
;~ plug
(spas ;~(pose eol sel))
(cook some (ifix [;~(plug sel hax) ser] (plus alp)))
==
;~(plug (spas eol) (easy ~))
==
%- full
;~ pose
;~ pfix (jest '######') (stag 6 hed) ==
;~ pfix (jest '#####') (stag 5 hed) ==
;~ pfix (jest '####') (stag 4 hed) ==
;~ pfix (jest '###') (stag 3 hed) ==
;~ pfix (jest '##') (stag 2 hed) ==
;~ pfix (jest '#') (stag 1 hed) ==
(stag 1 (ifix [wits ;~(plug eol (plus tis))] sed))
(stag 2 (ifix [wits ;~(plug eol (plus hep))] sed))
==
::
++ horz :: horizontal rule
%+ stag %horz
%+ cold ~
%- full
;~ pose
;~(plug (stun [0 3] ace) hep wits hep wits hep (star ;~(pose hep wite)))
;~(plug (stun [0 3] ace) tar wits tar wits tar (star ;~(pose tar wite)))
;~(plug (stun [0 3] ace) cab wits cab wits cab (star ;~(pose cab wite)))
==
::
++ html (stag %html apex:xmlp) :: html bloc
++ lasd :: top level list
%+ stag %list
%- full
;~ pose
(stag & (lisd ;~(plug (star nud) dot)))
(stag | (lisd hep))
(stag | (lisd tar))
(stag | (lisd lus))
==
::
++ lisd :: list funk
|* bus=_rule
|= tub=nail
^- (like down)
=+ chx=;~(plug (plus prn) (cold "\0a" eol))
=- ?~ q.pre
pre
:- p.pre
(some (turn `wall`p.u.q.pre |=(a=tape [%lise (scan a apex)])) [p.pre ~])
^= pre %. tub
%+ most ;~(pose ;~(plug wits eol) (easy ~))
%+ cook |=(a=wall `tape`(zing a)) ::XX core dumps w/o cast
;~ plug
%+ cook zing
;~ pose
(full ;~(pfix bus ace ;~(plug (plus prn) (easy ~))))
;~(pfix bus ace ;~(plug (plus prn) (cold "\0a" eol) (easy ~)))
==
%- star
;~ pose
;~(plug ;~(sfix eol ace ace) (cook welp chx))
;~(pfix ace ace (cook welp chx))
(full ;~(pfix ace ace (plus prn)))
==
==
::
++ link :: link element
%+ knee *span |. ~+
%+ stag %link
;~ plug
(ifix [sel ser] (plus ;~(pose emph stri cods (text ser))))
;~ pose
%+ ifix [pel per]
;~ plug
;~(sfix (cook zing (most eol (plus ;~(less ace prn)))) ace)
(cook some (ifix [doq doq] (plus ;~(less doq ;~(pose prn eol)))))
==
%+ ifix [pel per]
;~(plug (cook zing (most eol (plus ;~(less per prn)))) (easy ~))
==
==
::
++ para (stag %para (full (spas fail))) :: paragraph
++ quot :: blockquotes
%+ stag %quot
%- full
|= tub=nail
^- (like down)
=- ?~ q.pre
[p.pre ~]
(apex [[1 1] (welp p.u.q.pre q.q.u.q.pre)])
^= pre %. tub
%+ cook |=(a=wall `tape`(zing a))
%- plus
;~ pfix ;~(pose ;~(plug gar ace) gar)
;~(pose (cook welp ;~(plug (star prn) (cold "\0a" eol))) (full (star prn)))
==
::
++ sepa :: separate blocs
%+ knee *wall |. ~+
=+ lin=;~(plug eol wits eol)
%+ ifix [(star whit) (star whit)]
%+ more ;~(plug eol wits (more wits eol))
;~ pose
(sepl (cold "-" hep))
(sepl (cold "*" tar))
(sepl (cold "+" lus))
(sepl (cook welp ;~(plug (star nud) (cold "." dot))))
(plus ;~(less lin ;~(pose prn ;~(simu ;~(plug eol prn) eol))))
==
::
++ sepl :: separate list
|* bus=_rule
%+ cook zing
%+ most ;~(pose ;~(plug wits eol) (easy ~))
%+ cook |=(a=wall `tape`(zing a))
;~ plug
%+ cook |=(a=wall `tape`(zing a))
;~ pose
;~(plug bus (cold " " ace) (plus prn) (cold "\0a" eol) (easy ~))
(full ;~(plug bus (cold " " ace) (plus prn) (easy ~)))
==
%- star
;~ pose
;~ pfix wits
;~(plug eol ace ace (cook welp ;~(plug (plus prn) (cold "\0a" eol))))
==
;~(plug ace ace (cook welp ;~(plug (plus prn) (cold "\0a" eol))))
(full ;~(plug ace ace (plus prn)))
==
==
::
++ stri :: strikethrough text
%+ stag %stri
(ifix [(jest '~~') (jest '~~')] (plus ;~(pose emph cods link (text fail))))
::
++ text |*(res=_rule (stag %text (plus ;~(less ;~(pose res dont) chrd))))
++ whit (mask ~[`@`0x20 `@`0x9 `@`0xa]) :: whitespace w/nl
++ wite (mask ~[`@`0x20 `@`0x9]) :: whitespace
++ wits (star wite)
::
:::::: down to manx
++ dank
|%
++ apex
|= don=down
^- marl
(turn don |=(bol=bloc (blok bol)))
++ blok
|= bol=bloc
^- manx
?- bol
[%head *]
:_ (turn q.bol sank)
[(cat 3 'h' (scot %ud p.bol)) ?~(r.bol ~ [[%id u.r.bol] ~])]
[%para *] [[%p ~] (turn p.bol sank)]
[%horz *] [[%hr ~] ~]
[%code *] [[%pre ~] ~[[[%$ [[%$ (zing p.bol)] ~]] ~]]]
[%quot *] [[%blockquote ~] (apex p.bol)]
[%lise *] [[%li ~] (apex p.bol)]
[%list *] ?: =(& p.bol) [[%ol ~] (apex q.bol)]
[[%ul ~] (apex q.bol)]
[%html *] p.bol
==
++ sank
|= san=span
^- manx
?- san
[%text *] [[%$ [[%$ p.san] ~]] ~]
[%brek *] [[%br ~] ~]
[%stri *] [[%del ~] (turn p.san ..$)]
[%cods *] [[%code ~] ~[[[%$ [[%$ p.san] ~]] ~]]]
[%emph *]
?: =(%ital p.san) [[%em ~] (turn q.san ..$)]
?: =(%bold p.san) [[%strong ~] (turn q.san ..$)]
[[%em ~] ~[[[%strong ~] (turn q.san ..$)]]]
[%link *]
?~ r.san [[%a ~[[%href q.san]]] (turn p.san ..$)]
[[%a ~[[%href q.san] [%title u.r.san]]] (turn p.san ..$)]
==
--
::
++ samp
"""
An h1 header
============
Paragraphs are separated by a blank line.
2nd paragraph. *Italic*, **bold**, ***both*** and `monospace`.
Hard line//break
Links: [link](foo.com "title")
Strikethrough text: ~~foo~~
> Block quotes are
> written like so.
>
> They can span multiple paragraphs,
> if you like.
Itemized lists
look like:
* this one
* that one
* the other one
---
"""
--
==
|= *
|= ~
^- bowl
:_ ~ :_ ~
:- %$
!>
(xmll | (apex:dank (scan samp apex)) ~)