neo: inching towards self hosting

This commit is contained in:
Liam Fitzgerald 2024-03-14 14:35:39 -04:00
parent 7b95a245bc
commit ec7e947c1c
8 changed files with 125 additions and 33 deletions

View File

@ -554,6 +554,7 @@
|= [src=pith err=tang]
%- (slog leaf/(en-tape:pith:neo src) err)
=/ nam=name:neo (de-pith:name:neo src)
?: =(1 1) !!
?. =(our.bowl ship.nam)
run
?: =(/ pith.nam) :: special case outside

View File

@ -17,14 +17,15 @@
?~ sut=(get-sut bowl)
~
`u.sut(p [%face (get-face bowl) p.u.sut])
--
^- firm:neo
|%
+$ state [cache=(unit vase) ~]
+$ poke
$% [%dep ~]
==
--
^- firm:neo
|%
+$ poke ^poke
+$ state ^state
++ kids ~
++ deps
=< apex
@ -42,20 +43,20 @@
++ form
^- form:neo
|_ [=bowl:neo case=@ud state-vase=vase *]
+* sta !<(state state-vase)
+* sta !<(^state state-vase)
++ call
|= [old-state=vase act=*]
*(list card)
++ reduce
|= pok=*
^- vase
=+ ;;(=poke pok)
=+ ;;(=^poke pok)
=/ sta sta
=. cache.sta (build bowl)
!>(sta)
++ init
|= vax=(unit vase)
!>(*state)
!>(*^state)
++ born
=- ~[-]
[%neo were.bowl %poke %dep ~]

View File

@ -0,0 +1,78 @@
/- neo
=>
|%
++ card card:neo
++ get-face
|= =bowl:neo
^- @tas
!<(@tas q:(~(got by deps.bowl) %face))
++ get-sut
|= =bowl:neo
^- (unit (pair pith vase))
=/ sut (~(got by deps.bowl) %sut)
=+ !<([cac=(unit vase) *] q.sut)
?~ cac
~
`[p.sut u.cac]
++ build
|= =bowl:neo
^- (unit vase)
?~ sut=(get-sut bowl)
~
=/ pit=vase !>(p=p.u.sut)
=/ cor=vase q.u.sut(p [%face %q p.q.u.sut])
=/ res=vase (slop pit cor)
`res(p [%face (get-face bowl) p.res])
--
^- firm:neo
|%
+$ state [cache=(unit vase) ~]
+$ poke
$% [%dep ~]
==
++ kids ~
++ deps
=< apex
|%
++ apex
%- ~(gas by *deps:neo)
:~ sut/sut
face/face
==
++ sut
[& ,[cache=(unit vase) *] ,*]
++ face
[& ,@tas ,*]
--
++ form
^- form:neo
|_ [=bowl:neo case=@ud state-vase=vase *]
+* sta !<(state state-vase)
++ call
|= [old-state=vase act=*]
*(list card)
++ reduce
|= pok=*
^- vase
=+ ;;(=poke pok)
=/ sta sta
=. cache.sta (build bowl)
!>(sta)
++ init
|= vax=(unit vase)
!>(*state)
++ born
=- ~[-]
[%neo were.bowl %poke %dep ~]
++ echo
|= [=pith val=*]
*(list card:neo)
++ take
|= =sign:neo
^- (list card:neo)
?. ?=([%neo %conf %val @] sign)
!!
=- ~[-]
[%neo were.bowl %poke %dep ~]
--
--

View File

@ -7,11 +7,13 @@
^- (unit vase)
=+ !<([cac=(unit vase) *] q:(~(got by deps.bowl) %src))
cac
+$ state [cache=(unit vase) ~]
+$ poke [%dep ~]
--
^- firm:neo
|%
+$ state [cache=(unit vase) ~]
+$ poke [%dep ~]
+$ poke ^poke
+$ state ^state
++ kids ~
++ deps
=< apex
@ -26,20 +28,20 @@
++ form
^- form:neo
|_ [=bowl:neo case=@ud state-vase=vase *]
+* sta !<(state state-vase)
+* sta !<(^state state-vase)
++ call
|= [old-state=vase act=*]
*(list card)
++ reduce
|= pok=*
^- vase
=+ ;;(=poke pok)
=+ ;;(poke=^poke pok)
=/ sta sta
=. cache.sta (get-src bowl)
!>(sta)
++ init
|= vax=(unit vase)
!>(*state)
!>(*^state)
++ born
=- ~[-]
[%neo were.bowl %poke %dep ~]

View File

@ -15,14 +15,15 @@
?~ b=(get-sut %b bowl)
~
`(slop u.a u.b)
--
^- firm:neo
|%
+$ state [cache=(unit vase) ~]
+$ poke
$% [%dep ~]
==
--
^- firm:neo
|%
+$ state ^state
+$ poke ^poke
++ kids ~
++ deps
=< apex
@ -38,20 +39,20 @@
++ form
^- form:neo
|_ [=bowl:neo case=@ud state-vase=vase *]
+* sta !<(state state-vase)
+* sta !<(^state state-vase)
++ call
|= [old-state=vase act=*]
*(list card)
++ reduce
|= pok=*
^- vase
=+ ;;(=poke pok)
=+ ;;(=^poke pok)
=/ sta sta
=. cache.sta (build bowl)
!>(sta)
++ init
|= vax=(unit vase)
!>(*state)
!>(*^state)
++ born
=- ~[-]
[%neo were.bowl %poke %dep ~]

View File

@ -12,16 +12,24 @@
^- (unit vase)
?~ sut=(get-sut bowl)
~
`(slap u.sut hoon)
--
^- firm:neo
|%
+$ state [cache=(unit vase) =hoon]
+$ poke
~| p:(~(got by deps.bowl) %sut)
=/ res=(each vase tang)
(mule |.((slap u.sut hoon)))
?: ?=(%| -.res)
%- (slog p.res)
^- (unit vase)
!!
`p.res
+$ poke
$% [%dep ~]
[%hoon =hoon]
==
+$ state [cache=(unit vase) =hoon]
--
^- firm:neo
|%
+$ poke ^poke
+$ state ^state
++ kids ~
++ deps
=< apex
@ -36,14 +44,14 @@
++ form
^- form:neo
|_ [=bowl:neo case=@ud state-vase=vase *]
+* sta !<(state state-vase)
+* sta !<(^state state-vase)
++ call
|= [old-state=vase act=*]
*(list card)
++ reduce
|= pok=*
^- vase
=+ ;;(=poke pok)
=+ ;;(poke=^poke pok)
=/ sta sta
=? hoon.sta ?=(%hoon -.poke)
hoon.poke
@ -51,9 +59,9 @@
!>(sta)
++ init
|= vax=(unit vase)
?~ vax !>(*state)
?~ vax !>(*^state)
=+ !<([cac=(unit vase) =hoon] u.vax)
!>(`state`[~ hoon])
!>(`^state`[~ hoon])
++ born
=- ~[-]
[%neo were.bowl %poke %dep ~]

View File

@ -26,6 +26,7 @@
|= old=(unit vase)
?~ old
!>(*state)
~& u.old
u.old
++ born *(list card:neo)
++ echo

View File

@ -494,7 +494,7 @@
+$ fief
[required=? =port]
+$ port :: TODO: how to specify behaviour
[state=mold action=mold]
[state=* diff=*] :: state, diff actually $stud
+$ deps (map term fief)
+$ kids (map pish port)
:: $firm: type of the value in the urbit namespace
@ -510,7 +510,7 @@
:: ```
::
:: ```
++ state *mold
++ state ** :: stud
:: $poke: a poke is a request to change a value in teh urbit
:: namespace.
::
@ -519,7 +519,7 @@
:: [%del who=user]
::
::
++ poke *mold
++ poke ** :: stud
++ form *^form
::
:: +kids: Some nodes in the namespace define what children are