Last active
April 29, 2021 03:07
-
-
Save belisarius222/a0c5510f9bb95f7c194b716102f1a4f0 to your computer and use it in GitHub Desktop.
Ford prototype (Fiesta-style) with !<
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|% | |
:: $plan: ford build, at the current beak | |
:: | |
+$ plan | |
$% [%'/.' data=vase] | |
[%'//' =spur] :: produces !>(*(unit [mark contents])) | |
[%'/*' =hoon] | |
[%'/=' face=@tas value=plan] | |
[%'/:' head=plan tail=plan] | |
[%'/>' with=plan rest=plan] | |
[%'/+' var=plan rest=plan] | |
[%'/%' func=plan arg=plan] | |
[%'/$' meta=plan] | |
[%'/^' mold=plan value=plan] | |
== | |
++ result (each vase tang) | |
-- | |
:: | |
=/ subject=vase !>(..zuse) | |
|_ =beak | |
:: | |
++ make | |
|= =plan | |
^- result | |
:: | |
?- -.plan | |
%'/.' (make-data data.plan) | |
%'//' (make-read spur.plan) | |
%'/*' (make-eval [plan hoon]:plan) | |
%'/=' (make-face [face value]:plan) | |
%'/:' (make-cons [head tail]:plan) | |
%'/>' (make-with [with rest]:plan) | |
%'/+' (make-push [var rest]:plan) | |
%'/%' (make-call [func arg]:plan) | |
%'/$' (make-meta meta.plan) | |
%'/^' (make-cast [mold value]:plan) | |
== | |
:: | |
++ make-data |=(data=vase [%0 data]) | |
:: | |
++ make-scry | |
|= =spur | |
^- result | |
:: | |
=/ res (scry %cx [beak spur]) | |
?. ?=([~ ~ *] res) | |
|/[leaf+"ford: // failed {(spud spur)}"]~ | |
=+ [mark vase]=[p q]:u.u.res | |
&/(slop !>(mark) vase) | |
:: | |
++ make-eval | |
|= =hoon | |
^- result | |
:: | |
=/ res (mule |.((slap subject hoon))) | |
?- -.res | |
%& &/p.res | |
%| |/[leaf+"ford: /% failed" p.res] | |
-- | |
:: | |
++ make-face | |
|= [face=@tas value=plan] | |
^- result | |
:: | |
=/ lav (make value.plan) | |
?: ?=(%| -.lav) | |
lav | |
&/[[%face face p.p.lav] q.p.lav] | |
:: | |
++ make-cons | |
|= [head=plan tail=plan] | |
^- result | |
:: | |
=/ lef (make head) | |
?: ?=(%| -.lef) | |
lef | |
=/ rig (make tail) | |
?- -.rig | |
%| rig | |
%& &/(slop p.lef p.rig) | |
== | |
:: | |
++ make-with | |
|= [with=plan rest=plan] | |
^- result | |
:: | |
=/ sut (make with) | |
?: ?=(%| sut) | |
sut | |
=. subject p.sut | |
(make rest) | |
:: | |
++ make-push | |
|= [var=plan rest=plan] | |
^- result | |
:: | |
=/ rav (make var) | |
?: ?=(%| rav) | |
rav | |
=. subject (slop p.rav subject) | |
(make rest) | |
:: | |
++ make-call | |
|= [func=plan arg=plan] | |
^- result | |
:: | |
=/ cel (make %'/:' func arg) | |
?: ?=(%| -.cel) | |
cel | |
=/ hed=vase (slot 2 p.cel) | |
=/ tal=vase (slot 3 p.cel) | |
=/ ran (mule |.((slam hed tal))) | |
?- -.ran | |
%& &/p.ran | |
%| |/[leaf+"ford: /% failed" p.ran] | |
== | |
:: | |
++ make-meta | |
|= meta=plan | |
^- result | |
:: | |
=/ ran (make [%'/^' [%'/.' !>(plan)] meta]) | |
?: ?=(%| -.ran) | |
ran | |
=/ lum (mule |.(!<(plan p.ran))) | |
?: ?=(%| -.lum) | |
|/[leaf+"ford: /$ invalid meta" p.lum] | |
(make u.lum) | |
:: | |
++ make-cast | |
|= [mold=plan value=plan] | |
^- result | |
:: | |
%- make | |
:+ '/*' | |
[%'/:' mold value] | |
!,(*hoon ^-(+2 +3)) | |
-- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment