shrub/pkg/arvo/sur/neo.hoon

2279 lines
50 KiB
Plaintext
Raw Normal View History

2024-06-19 01:23:29 +03:00
/+ dprint
/+ easy-print=language-server-easy-print
2024-01-28 06:20:35 +03:00
:: $neo: New Shrub
::
:: Urbit is a namespace, from a path -> data
:: /~hastuc-dibtux/chats/unit-731 :: this a chat
:: /~hastuc-dibtux/chats/unit-731/msg/~2024.1.27..10.30 :: this is a
:: message inside the chat
::
:: neo is a recipe for defining the kinds of data that live at these
:: paths. For instance, you would maybe like to define a chat
:: datatype, that could be bound into your namespace, so that your
:: friends could send you memes.
::
::
::
::
::
2024-04-19 01:49:31 +03:00
=>
|%
2024-05-15 20:43:07 +03:00
::
:: $care: Perspective on a path
::
+$ care
2024-05-17 20:01:40 +03:00
$~ %x
2024-05-15 20:43:07 +03:00
$? %x :: single node
%y :: single node and immediate children
%z :: single node and all descendants
2024-05-15 22:55:15 +03:00
:: without pails or vials
%a :: single node (%x)
%b :: node and immediate children (%y)
%c :: node and all descendants
2024-05-15 20:43:07 +03:00
==
2024-05-17 23:19:24 +03:00
+$ hunt [=care =pith] ::
2024-05-15 20:43:07 +03:00
:: $over: range of time for case bookkeeping
::
::
+$ over
$: why=(pair @ud @ud)
2024-05-20 19:27:31 +03:00
why-mut=(pair @ud @ud)
2024-05-15 20:43:07 +03:00
zed=(pair @ud @ud)
2024-05-20 19:27:31 +03:00
zed-mut=(pair @ud @ud)
=rift
2024-05-15 20:43:07 +03:00
==
::
:: $ever: Total shrub version
::
:: .exe is incremented only when the shrub itself changes i.e. it
:: versions the %x care
:: .why is incremented when the shrub or any of its children changes
:: i.e. it versions the %y care
:: .zed is incremened when the shrub of any of its descendants change
::
2024-05-20 19:27:31 +03:00
:: $lock: Data and shape numbers
::
:: .p is the data version
:: .q is the shape version
+$ lock (pair @ud @ud)
::
2024-05-15 20:43:07 +03:00
+$ ever
2024-05-20 19:27:31 +03:00
$: exe=lock
why=lock
zed=lock
2024-05-17 23:19:24 +03:00
::
2024-05-20 19:27:31 +03:00
shrub-life=@ud :: 3
ship-life=@ud :: 6
ship-rift=@ud :: 9
2024-05-17 23:19:24 +03:00
::
2024-05-20 19:27:31 +03:00
=time
2024-05-15 20:43:07 +03:00
==
:: $once: Partial version
::
2024-05-15 22:55:15 +03:00
:: Identify shrub by either %x, %y or %z, as per $ever
2024-05-15 20:43:07 +03:00
::
2024-05-15 22:55:15 +03:00
+$ once
2024-05-28 07:43:53 +03:00
[?(%x %y %z) p=case]
2024-05-15 20:43:07 +03:00
+$ pulp ?(%noun %json)
:: $hash: Hash
+$ hash @uvH
:: $seal: Signature
::
+$ seal @uvH
:: $myth: Binding, possibly tombstoned
::
+$ myth
$: pail=(unit pail)
=aeon
==
2024-05-27 19:23:16 +03:00
::
+$ vial (pair stud *)
2024-05-15 20:43:07 +03:00
+$ book (pair tale pail)
+$ poem (pair tale (unit pail))
::
+$ aeon (pair ever oath)
+$ tale (pair case oath)
+$ oath (pair hash seal)
2024-05-28 01:57:58 +03:00
+$ yuga (axal aeon)
2024-05-15 20:43:07 +03:00
::
+$ saga (pair aeon pail)
+$ pail (pair stud vase)
::
2024-05-21 23:52:14 +03:00
+$ epic $+(epic (axal saga))
2024-05-27 19:23:16 +03:00
+$ feat (pair aeon vial)
+$ gest $+(gest (axal feat))
2024-05-29 22:43:34 +03:00
++ road (pole iota)
2024-05-08 01:53:00 +03:00
:: $stud: name for build system outputs
::
:: Build system outputs cannot live at arbitrary points in the
:: namespace, to allow for the build system to bootstrap itself.
::
2024-04-19 01:49:31 +03:00
+$ stud
$@ @tas :: auth=urbit
$: mark=@tas ::
[=ship =desk]
2024-05-15 20:43:07 +03:00
==
2024-05-29 22:43:34 +03:00
++ stud-to-pith
|= s=stud
^- pith
?@ s ~[s]
#/[p/ship.s]/[desk.s]/[mark.s]
::
++ pith-to-stud
|= p=road
^- stud
?: ?=([s=@ ~] p)
s.p
?> ?=([[%p ship=@] desk=@ mark=@ ~] p)
[mark ship desk]:p
2024-05-15 20:43:07 +03:00
++ axal
|$ [item]
[fil=(unit item) kid=(map iota $)]
++ axil
|$ [item]
[fil=(unit item) kid=(map pith item)]
++ of
=| fat=(axal)
|@
++ view
=| res=(map pith _?>(?=(^ fil.fat) u.fil.fat))
|= [=care pax=pith]
=. fat (dip pax)
=? res ?=(^ fil.fat)
(~(put by res) ~ u.fil.fat)
2024-05-15 22:55:15 +03:00
?+ care !!
2024-05-15 20:43:07 +03:00
%x res
%y =.(fat snip (~(uni by res) tar))
%z (~(uni by res) tar)
==
::
++ anc-jab
|* [pax=pith fun=$-(* *)]
^+ fat
?~ pax
fat
=? fil.fat ?=(^ fil.fat)
`(fun u.fil.fat)
fat(kid (~(put by kid.fat) i.pax $(fat (~(got by kid.fat) i.pax), pax t.pax)))
::
++ anc
=| res=(list pith)
=| cur=pith
|= pax=pith
^- (set pith)
?~ pax
(~(gas in *(set pith)) res)
=? res ?=(^ fil.fat)
[cur res]
$(fat (~(got by kid.fat) i.pax), pax t.pax, cur (snoc cur i.pax))
++ parent
=| res=(unit pith)
=| cur=pith
|= pax=pith
|- ^+ res
?~ pax
res
=? res ?=(^ fil.fat)
`cur
=/ nex (~(get by kid.fat) i.pax)
?~ nex
res
$(fat u.nex, pax t.pax, cur (snoc cur i.pax))
++ snip
|- ^+ fat
=* loop $
%_ fat
kid
%- ~(run by kid.fat)
|= f=_fat
?^ fil.f
[`u.fil.f ~]
loop(fat f)
==
::
++ kid
|= pax=pith
^- (map pith _?>(?=(^ fil.fat) u.fil.fat))
=. fat (dip pax)
=. fat snip
=. fil.fat ~
tar
::
++ kids
|= pax=pith
^- (axil _?>(?=(^ fil.fat) u.fil.fat))
:- (get pax)
(kid pax)
::
++ del
|= pax=pith
^+ fat
?~ pax [~ kid.fat]
=/ kid (~(get by kid.fat) i.pax)
?~ kid fat
fat(kid (~(put by kid.fat) i.pax $(fat u.kid, pax t.pax)))
::
:: Descend to the axal at this path
::
++ dip
|= pax=pith
^+ fat
?~ pax fat
=/ kid (~(get by kid.fat) i.pax)
?~ kid [~ ~]
$(fat u.kid, pax t.pax)
::
++ gas
|* lit=(list (pair pith _?>(?=(^ fil.fat) u.fil.fat)))
^+ fat
?~ lit fat
$(fat (put p.i.lit q.i.lit), lit t.lit)
++ got
|= pax=pith
~| missing-room/pax
(need (get pax))
++ gut
|* [pax=pith dat=*]
=> .(dat `_?>(?=(^ fil.fat) u.fil.fat)`dat, pax `pith`pax)
^+ dat
(fall (get pax) dat)
::
++ get
|= pax=pith
fil:(dip pax)
:: Fetch file at longest existing prefix of the path
::
++ fit
|= pax=pith
^+ [pax fil.fat]
?~ pax [~ fil.fat]
=/ kid (~(get by kid.fat) i.pax)
?~ kid [pax fil.fat]
=/ low $(fat u.kid, pax t.pax)
?~ +.low
[pax fil.fat]
low
::
++ has
|= pax=pith
!=(~ (get pax))
:: Delete subtree
::
++ lop
|= pax=pith
^+ fat
?~ pax fat
|-
?~ t.pax fat(kid (~(del by kid.fat) i.pax))
=/ kid (~(get by kid.fat) i.pax)
?~ kid fat
fat(kid (~(put by kid.fat) i.pax $(fat u.kid, pax t.pax)))
::
++ put
|* [pax=pith dat=*]
=> .(dat `_?>(?=(^ fil.fat) u.fil.fat)`dat, pax `pith`pax)
|- ^+ fat
?~ pax fat(fil `dat)
=/ kid (~(gut by kid.fat) i.pax ^+(fat [~ ~]))
fat(kid (~(put by kid.fat) i.pax $(fat kid, pax t.pax)))
::
++ tap
=| pax=pith
=| out=(list (pair pith _?>(?=(^ fil.fat) u.fil.fat)))
|- ^+ out
=? out ?=(^ fil.fat) :_(out [pax u.fil.fat])
=/ kid ~(tap by kid.fat)
|- ^+ out
?~ kid out
%= $
kid t.kid
out ^$(pax (weld pax /[p.i.kid]), fat q.i.kid)
==
:: Serialize to map
::
++ tar
(~(gas by *(map pith _?>(?=(^ fil.fat) u.fil.fat))) tap)
--
:: $span:
+$ span (pair @ud seal)
:: $case: Canonical (%x) version
+$ case @ud
2024-05-17 21:28:27 +03:00
:: $soil: aeons, indexed by x
++ soil
=< a
^~
2024-05-15 20:43:07 +03:00
|%
2024-05-17 21:28:27 +03:00
++ on ((^on case poem) lte)
+$ a ((mop case poem) lte)
2024-05-15 20:43:07 +03:00
--
2024-05-24 19:45:07 +03:00
+$ mode ?(%add %dif %del)
+$ loot [case=@ud =mode]
+$ dust [=pith loot]
2024-05-28 07:43:53 +03:00
+$ grit (list dust)
2024-05-15 20:43:07 +03:00
:: $dirt: Layer 1 of the namespace
++ dirt
|%
+$ card (pair pith note)
+$ note
2024-05-28 01:57:58 +03:00
$% [%grow =pail case=(unit case) =oath]
2024-05-15 20:43:07 +03:00
[%cull ~]
==
+$ loam (axal soil)
2024-05-21 23:52:14 +03:00
+$ gift dust
2024-05-15 20:43:07 +03:00
--
--
|%
++ land
=< land
|%
+$ land ((mop case over) lte)
++ on ((^on case over) lte)
--
2024-05-20 19:27:31 +03:00
+$ turf [=land =plot]
++ plan
=< plan
|%
+$ plan ((mop @ud ,(set pith)) lte)
++ on ((^on @ud ,(set pith)) lte)
--
2024-05-17 23:19:24 +03:00
+$ plot
2024-05-20 21:13:00 +03:00
$: by-kids-mut=plan
by-desc-mut=plan
by-kids=tend
by-desc=tend
2024-05-17 23:19:24 +03:00
==
2024-05-20 21:13:00 +03:00
++ tend
=< tend
|%
+$ tend ((mop @ud ,(map pith =case)) lte)
++ on ((^on @ud ,(map pith =case)) lte)
--
2024-05-28 01:57:58 +03:00
++ farm
=< farm
|%
+$ farm (axal turf)
+$ card (pair pith note)
+$ note
$% [%grow p=saga]
==
--
2024-04-19 01:49:31 +03:00
--
2024-01-19 02:07:28 +03:00
|%
2024-05-17 23:19:24 +03:00
+$ sync (trel pith hunt ?(%start %stop))
2024-05-22 21:25:45 +03:00
:: $curb: Constraint
+$ curb
2024-04-19 01:49:31 +03:00
$~ [%pro %$]
2024-05-22 21:25:45 +03:00
$% [%or p=(list curb)] :: product type
[%only p=stud] :: exclusivel
[%rol p=stud q=curb]
[%not p=curb q=curb] :: q not p
2024-04-19 01:49:31 +03:00
[%pro p=stud] :: base case
2024-05-22 21:25:45 +03:00
[%any ~]
2024-04-19 01:49:31 +03:00
==
2024-05-28 18:40:33 +03:00
2024-04-19 01:49:31 +03:00
++ compile-curb
=| fac=_| :: did we just apply a face
|= [cur=curb get=$-(stud type)]
=* loop $
^- type
2024-05-22 21:25:45 +03:00
?+ -.cur !!
2024-04-19 01:49:31 +03:00
%or
:- %fork
%- ~(gas in *(set type))
%+ turn p.cur
2024-05-22 21:25:45 +03:00
|= c=curb
2024-04-19 01:49:31 +03:00
^- type
2024-05-22 21:25:45 +03:00
!!
:: :+ %cell
:: [%atom %tas `tag]
:: loop(cur c, fac |)
2024-04-19 01:49:31 +03:00
::
%rol
[%face (get-stud-name p.cur) $(cur q.cur, fac &)]
::
%pro
=- (get p.cur)
?: fac -
[%face (get-stud-name p.cur)]
==
:: +sell: pretty-print a vase to a tank using +deal.
::
2024-05-22 19:36:53 +03:00
++ a-sell
2024-04-19 01:49:31 +03:00
~/ %sell
|= vax=vase
^- tank
~| %sell
(~(deal us p.vax) q.vax)
::
++ us :: prettyprinter
=> |%
+$ cape [p=(map @ud wine) q=wine] ::
+$ wine ::
$@ $? %noun ::
%path ::
%type ::
%void ::
%wall ::
%wool ::
%yarn ::
== ::
$% [%mato p=term] ::
[%core p=(list @ta) q=wine] ::
[%face p=term q=wine] ::
[%list p=term q=wine] ::
[%pear p=term q=@] ::
[%bcwt p=(list wine)] ::
[%plot p=(list wine)] ::
[%stop p=@ud] ::
[%tree p=term q=wine] ::
[%unit p=term q=wine] ::
[%name p=^stud q=wine] ::
== ::
--
|_ sut=type
++ dash
|= [mil=tape lim=char lam=tape]
^- tape
=/ esc (~(gas in *(set @tD)) lam)
:- lim
|- ^- tape
?~ mil [lim ~]
?: ?| =(lim i.mil)
=('\\' i.mil)
(~(has in esc) i.mil)
==
['\\' i.mil $(mil t.mil)]
?: (lte ' ' i.mil)
[i.mil $(mil t.mil)]
['\\' ~(x ne (rsh 2 i.mil)) ~(x ne (end 2 i.mil)) $(mil t.mil)]
::
++ deal |=(lum=* (dish dole lum))
++ dial
|= ham=cape
=+ gid=*(set @ud)
=< `tank`-:$
|%
++ many
|= haz=(list wine)
^- [(list tank) (set @ud)]
?~ haz [~ gid]
=^ mor gid $(haz t.haz)
=^ dis gid ^$(q.ham i.haz)
[[dis mor] gid]
::
++ $
^- [tank (set @ud)]
?- q.ham
%noun :_(gid [%leaf '*' ~])
%path :_(gid [%leaf '/' ~])
%type :_(gid [%leaf '#' 't' ~])
%void :_(gid [%leaf '#' '!' ~])
%wool :_(gid [%leaf '*' '"' '"' ~])
%wall :_(gid [%leaf '*' '\'' '\'' ~])
%yarn :_(gid [%leaf '"' '"' ~])
[%mato *] :_(gid [%leaf '@' (trip p.q.ham)])
[%core *]
=^ cox gid $(q.ham q.q.ham)
:_ gid
:+ %rose
[[' ' ~] ['<' ~] ['>' ~]]
|- ^- (list tank)
?~ p.q.ham [cox ~]
[[%leaf (rip 3 i.p.q.ham)] $(p.q.ham t.p.q.ham)]
::
[%face *]
=^ cox gid $(q.ham q.q.ham)
:_(gid [%palm [['=' ~] ~ ~ ~] [%leaf (trip p.q.ham)] cox ~])
::
[%list *]
=^ cox gid $(q.ham q.q.ham)
:_(gid [%rose [" " (weld (trip p.q.ham) "(") ")"] cox ~])
::
[%bcwt *]
=^ coz gid (many p.q.ham)
:_(gid [%rose [[' ' ~] ['?' '(' ~] [')' ~]] coz])
::
[%plot *]
=^ coz gid (many p.q.ham)
:_(gid [%rose [[' ' ~] ['[' ~] [']' ~]] coz])
::
[%pear *]
:_(gid [%leaf '%' ~(rend co [%$ p.q.ham q.q.ham])])
::
[%stop *]
=+ num=~(rend co [%$ %ud p.q.ham])
?: (~(has in gid) p.q.ham)
:_(gid [%leaf '#' num])
=^ cox gid
%= $
gid (~(put in gid) p.q.ham)
q.ham (~(got by p.ham) p.q.ham)
==
:_(gid [%palm [['.' ~] ~ ~ ~] [%leaf ['^' '#' num]] cox ~])
::
[%tree *]
=^ cox gid $(q.ham q.q.ham)
:_(gid [%rose [" " (weld (trip p.q.ham) "(") ")"] cox ~])
::
[%unit *]
=^ cox gid $(q.ham q.q.ham)
:_(gid [%rose [" " (weld (trip p.q.ham) "(") ")"] cox ~])
::
[%name *]
:_ gid
?@ p.q.ham (cat 3 '#' mark.p.q.ham)
(rap 3 '#' auth.p.q.ham '+' (spat type.p.q.ham) ~)
==
--
::
++ dish !:
|= [ham=cape lum=*] ^- tank
~| [%dish-h ?@(q.ham q.ham -.q.ham)]
~| [%lump lum]
~| [%ham ham]
%- need
=| gil=(set [@ud *])
|- ^- (unit tank)
?- q.ham
%noun
%= $
q.ham
?: ?=(@ lum)
[%mato %$]
:- %plot
|- ^- (list wine)
[%noun ?:(?=(@ +.lum) [[%mato %$] ~] $(lum +.lum))]
==
::
%path
:- ~
:+ %rose
[['/' ~] ['/' ~] ~]
|- ^- (list tank)
?~ lum ~
?@ lum !!
?> ?=(@ -.lum)
[[%leaf (rip 3 -.lum)] $(lum +.lum)]
::
%type
=+ tyr=|.((dial dole))
=+ vol=tyr(sut lum)
=+ cis=;;(tank .*(vol [%9 2 %0 1]))
:^ ~ %palm
[~ ~ ~ ~]
[[%leaf '#' 't' '/' ~] cis ~]
::
%wall
:- ~
:+ %rose
[[' ' ~] ['<' '|' ~] ['|' '>' ~]]
|- ^- (list tank)
?~ lum ~
?@ lum !!
[[%leaf (trip ;;(@ -.lum))] $(lum +.lum)]
::
%wool
:- ~
:+ %rose
[[' ' ~] ['<' '<' ~] ['>' '>' ~]]
|- ^- (list tank)
?~ lum ~
?@ lum !!
[(need ^$(q.ham %yarn, lum -.lum)) $(lum +.lum)]
::
%yarn
[~ %leaf (dash (tape lum) '"' "\{")]
::
%void
~
::
[%mato *]
?. ?=(@ lum)
~
:+ ~
%leaf
?+ (rash p.q.ham ;~(sfix (cook crip (star low)) (star hig)))
~(rend co [%$ p.q.ham lum])
%$ ~(rend co [%$ %ud lum])
%t (dash (rip 3 lum) '\'' ~)
%tas ['%' ?.(=(0 lum) (rip 3 lum) ['$' ~])]
==
::
[%core *]
:: XX needs rethinking for core metal
:: ?. ?=(^ lum) ~
:: => .(lum `*`lum)
:: =- ?~(tok ~ [~ %rose [[' ' ~] ['<' ~] ['>' ~]] u.tok])
:: ^= tok
:: |- ^- (unit (list tank))
:: ?~ p.q.ham
:: =+ den=^$(q.ham q.q.ham)
:: ?~(den ~ [~ u.den ~])
:: =+ mur=$(p.q.ham t.p.q.ham, lum +.lum)
:: ?~(mur ~ [~ [[%leaf (rip 3 i.p.q.ham)] u.mur]])
[~ (dial ham)]
::
[%face *]
=+ wal=$(q.ham q.q.ham)
?~ wal
~
[~ %palm [['=' ~] ~ ~ ~] [%leaf (trip p.q.ham)] u.wal ~]
::
[%list *]
?: =(~ lum)
[~ %leaf '~' ~]
=- ?~ tok
~
[~ %rose [[' ' ~] ['~' '[' ~] [']' ~]] u.tok]
^= tok
|- ^- (unit (list tank))
?: ?=(@ lum)
?.(=(~ lum) ~ [~ ~])
=+ [for=^$(q.ham q.q.ham, lum -.lum) aft=$(lum +.lum)]
?. &(?=(^ for) ?=(^ aft))
~
[~ u.for u.aft]
::
[%bcwt *]
|- ^- (unit tank)
?~ p.q.ham
~
=+ wal=^$(q.ham i.p.q.ham)
?~ wal
$(p.q.ham t.p.q.ham)
wal
::
[%plot *]
=- ?~ tok
~
[~ %rose [[' ' ~] ['[' ~] [']' ~]] u.tok]
^= tok
|- ^- (unit (list tank))
?~ p.q.ham
~
?: ?=([* ~] p.q.ham)
=+ wal=^$(q.ham i.p.q.ham)
?~(wal ~ [~ [u.wal ~]])
?@ lum
~
=+ gim=^$(q.ham i.p.q.ham, lum -.lum)
?~ gim
~
=+ myd=$(p.q.ham t.p.q.ham, lum +.lum)
?~ myd
~
[~ u.gim u.myd]
::
[%pear *]
?. =(lum q.q.ham)
~
=. p.q.ham
(rash p.q.ham ;~(sfix (cook crip (star low)) (star hig)))
=+ fox=$(q.ham [%mato p.q.ham])
?> ?=([~ %leaf ^] fox)
?: ?=(?(%n %tas) p.q.ham)
fox
[~ %leaf '%' p.u.fox]
::
[%stop *]
?: (~(has in gil) [p.q.ham lum]) ~
=+ kep=(~(get by p.ham) p.q.ham)
?~ kep
~|([%stop-loss p.q.ham] !!)
$(gil (~(put in gil) [p.q.ham lum]), q.ham u.kep)
::
[%tree *]
=- ?~ tok
~
[~ %rose [[' ' ~] ['{' ~] ['}' ~]] u.tok]
^= tok
=+ tuk=*(list tank)
|- ^- (unit (list tank))
?: =(~ lum)
[~ tuk]
?. ?=([n=* l=* r=*] lum)
~
=+ rol=$(lum r.lum)
?~ rol
~
=+ tim=^$(q.ham q.q.ham, lum n.lum)
?~ tim
~
$(lum l.lum, tuk [u.tim u.rol])
::
[%unit *]
?@ lum
?.(=(~ lum) ~ [~ %leaf '~' ~])
?. =(~ -.lum)
~
=+ wal=$(q.ham q.q.ham, lum +.lum)
?~ wal
~
[~ %rose [[' ' ~] ['[' ~] [']' ~]] [%leaf '~' ~] u.wal ~]
::
[%name *]
$(q.ham q.q.ham)
==
::
++ doge
|= ham=cape
=- ?+ woz woz
[%list * [%mato %'ta']] %path
[%list * [%mato %'t']] %wall
[%list * [%mato %'tD']] %yarn
[%list * %yarn] %wool
==
^= woz
^- wine
?. ?=([%stop *] q.ham)
?: ?& ?= [%bcwt [%pear %n %0] [%plot [%pear %n %0] [%face *] ~] ~]
q.ham
=(1 (met 3 p.i.t.p.i.t.p.q.ham))
==
[%unit =<([p q] i.t.p.i.t.p.q.ham)]
q.ham
=+ may=(~(get by p.ham) p.q.ham)
?~ may
q.ham
=+ nul=[%pear %n 0]
?. ?& ?=([%bcwt *] u.may)
?=([* * ~] p.u.may)
|(=(nul i.p.u.may) =(nul i.t.p.u.may))
==
q.ham
=+ din=?:(=(nul i.p.u.may) i.t.p.u.may i.p.u.may)
?: ?& ?=([%plot [%face *] [%face * %stop *] ~] din)
=(p.q.ham p.q.i.t.p.din)
=(1 (met 3 p.i.p.din))
=(1 (met 3 p.i.t.p.din))
==
:+ %list
(cat 3 p.i.p.din p.i.t.p.din)
q.i.p.din
?: ?& ?= $: %plot
[%face *]
[%face * %stop *]
[[%face * %stop *] ~]
==
din
=(p.q.ham p.q.i.t.p.din)
=(p.q.ham p.q.i.t.t.p.din)
=(1 (met 3 p.i.p.din))
=(1 (met 3 p.i.t.p.din))
=(1 (met 3 p.i.t.t.p.din))
==
:+ %tree
%^ cat
3
p.i.p.din
(cat 3 p.i.t.p.din p.i.t.t.p.din)
q.i.p.din
q.ham
::
++ dole
^- cape
=+ gil=*(set type)
=+ dex=[p=*(map type @) q=*(map @ wine)]
=< [q.p q]
|- ^- [p=[p=(map type @) q=(map @ wine)] q=wine]
=- [p.tez (doge q.p.tez q.tez)]
^= tez
^- [p=[p=(map type @) q=(map @ wine)] q=wine]
?- sut
%noun [dex sut]
%void [dex sut]
[%atom *] [dex ?~(q.sut [%mato p.sut] [%pear p.sut u.q.sut])]
[%cell *]
=+ hin=$(sut p.sut)
=+ yon=$(dex p.hin, sut q.sut)
:- p.yon
:- %plot
?:(?=([%plot *] q.yon) [q.hin p.q.yon] [q.hin q.yon ~])
::
[%core *]
=+ yad=$(sut p.sut)
:- p.yad
=+ ^= doy ^- [p=(list @ta) q=wine]
?: ?=([%core *] q.yad)
[p.q.yad q.q.yad]
[~ q.yad]
:- %core
:_ q.doy
:_ p.doy
%^ cat 3
%~ rent co
:+ %$ %ud
%- ~(rep by (~(run by q.r.q.sut) |=(tome ~(wyt by q.+<))))
|=([[@ a=@u] b=@u] (add a b))
%^ cat 3
?-(r.p.q.sut %gold '.', %iron '|', %lead '?', %zinc '&')
=+ gum=(mug q.r.q.sut)
%+ can 3
:~ [1 (add 'a' (mod gum 26))]
[1 (add 'a' (mod (div gum 26) 26))]
[1 (add 'a' (mod (div gum 676) 26))]
==
::
[%hint *]
=+ yad=$(sut q.sut)
?. ?=(%know -.q.p.sut) yad
[p.yad [%name p.q.p.sut q.yad]]
::
[%face *]
=+ yad=$(sut q.sut)
?^(p.sut yad [p.yad [%face p.sut q.yad]])
::
[%fork *]
=+ yed=(sort ~(tap in p.sut) aor)
=- [p [%bcwt q]]
|- ^- [p=[p=(map type @) q=(map @ wine)] q=(list wine)]
?~ yed
[dex ~]
=+ mor=$(yed t.yed)
=+ dis=^$(dex p.mor, sut i.yed)
[p.dis q.dis q.mor]
::
[%hold *]
=+ hey=(~(get by p.dex) sut)
?^ hey
[dex [%stop u.hey]]
?: (~(has in gil) sut)
=+ dyr=+(~(wyt by p.dex))
[[(~(put by p.dex) sut dyr) q.dex] [%stop dyr]]
=+ rom=$(gil (~(put in gil) sut), sut ~(repo ut sut))
=+ rey=(~(get by p.p.rom) sut)
?~ rey
rom
[[p.p.rom (~(put by q.p.rom) u.rey q.rom)] [%stop u.rey]]
==
::
++ duck (dial dole)
--
2024-04-19 21:30:36 +03:00
::
2024-06-17 20:46:26 +03:00
+$ deed
$@ ?
$: time=(unit @dr)
req=?
==
::
2024-05-08 01:53:00 +03:00
:: $gift: notification that a children changed
2024-04-19 01:49:31 +03:00
::
2024-05-24 19:45:07 +03:00
+$ gift (axal loot)
2024-05-08 01:53:00 +03:00
::
:: $hunt: perspective and shrub
2024-04-10 17:39:46 +03:00
::
2024-05-08 01:53:00 +03:00
+$ tour hunt
2024-04-10 17:39:46 +03:00
:: $block: call-stack state for blocking semantics
2024-05-08 01:53:00 +03:00
::
:: .get is the list of blocking requests
:: .err is the possible error state
:: If .err is not ~, then .get is functionally ~
2024-04-10 17:39:46 +03:00
::
2024-05-28 15:18:18 +03:00
+$ block [get=(set hunt) err=(unit quit)]
2024-05-08 01:53:00 +03:00
::
2024-04-10 17:39:46 +03:00
:: $halt: Currently blocked flows and indices
::
+$ halt
2024-05-28 07:43:53 +03:00
$: by-hunt=(map hunt flow) :: flow blocked by hunt
by-flow=(jug flow hunt) :: hunts blocked by flow
2024-05-08 01:53:00 +03:00
clog=(map flow (qeu move)) :: enqueued moves to send on unblock
==
2024-05-28 15:18:18 +03:00
+$ quit
$% [%gone =term] :: injected a bad dependency
[%goof =tang] :: crash
==
2024-06-04 01:57:39 +03:00
++ print-quit
|= q=quit
^- tang
?- -.q
%goof tang.q
%gone ~[leaf/"No dependency at {<term>}"]
==
2024-05-28 15:18:18 +03:00
+$ ack (pair flow (unit quit))
2024-05-08 01:53:00 +03:00
::
2024-04-10 17:39:46 +03:00
:: $flow: Call direction
::
:: .p is the source
:: .q is the destination
::
+$ flow (pair pith pith)
2024-05-08 01:53:00 +03:00
::
2024-04-10 17:39:46 +03:00
:: $disk: Reference to a suite of code
::
:: If sig case, then refers to the %std disk
2024-03-26 21:09:37 +03:00
+$ disk
$@(~ [=ship =term])
2024-04-10 17:39:46 +03:00
:: $tack: Type of code being distributed
::
:: %con: CONverter of protocols
:: %imp: IMPlemenation of shrub
:: %pro: PROtocol (type)
::
2024-03-26 21:09:37 +03:00
+$ tack
2024-05-28 18:40:33 +03:00
?(%con %imp %pro %lib %rol %fil)
2024-04-10 17:39:46 +03:00
:: $post: Name of code being distributed
::
2024-03-26 21:09:37 +03:00
+$ post (pair tack stud)
2024-05-24 19:45:07 +03:00
:: $prop: Code unit inside desk
+$ prop (pair tack mark)
2024-04-10 17:39:46 +03:00
::
:: +get-stud-name: Get name for $stud
::
2024-03-26 21:09:37 +03:00
++ get-stud-name
|= =stud
?@ stud stud
mark.stud
2024-04-10 17:39:46 +03:00
:: +drive: Path multiplexer core
::
2024-03-29 20:18:36 +03:00
++ drive
|%
2024-04-10 17:39:46 +03:00
:: +en:drive: Multiplex several paths into one
::
:: See also: (+de:drive)
2024-03-29 20:18:36 +03:00
++ en
=| res=pith
|= ps=(list pith)
?~ ps
res
$(res (welp res [%ud (lent i.ps)] i.ps), ps t.ps)
2024-04-10 17:39:46 +03:00
:: +de:drive: Demultiplex one path into several
::
:: See also: (+en:drive)
2024-03-29 20:18:36 +03:00
++ de
=| res=(list pith)
|= pax=(pole iota)
^+ res
?: =(~ pax)
(flop res)
=^ nex=pith pax
?> ?=([[%ud len=@] rest=*] pax)
`[pith (pole iota)]`[(scag [len rest]:pax) (slag [len rest]:pax)]
$(res [nex res])
--
2024-05-28 18:40:33 +03:00
++ curt
=| res=(set post)
|= =curb
^+ res
=* loop-curb $
?- -.curb
?(%pro %only)
(~(put in res) pro/p.curb)
::
%or
=/ curs p.curb
|-
?~ curs
res
=/ new loop-curb(curb i.curs)
=. res (~(uni in res) new)
$(curs t.curs)
::
%rol
=. res (~(put in res) rol/p.curb)
$(curb q.curb)
::
%not
$(curb q.curb)
::
%any res
==
2024-04-10 17:39:46 +03:00
:: +ford: Container for build system bootstrapping
2024-03-20 22:39:46 +03:00
++ ford
|%
2024-05-24 17:09:36 +03:00
+$ kind ?(%pre %src %out)
++ desk
|%
++ kids *^kids
--
2024-05-22 21:25:45 +03:00
++ dock
^- ^dock
2024-05-22 23:10:36 +03:00
[pro/%vase ~ ~]
2024-04-11 22:06:26 +03:00
++ is-stud
|= s=stud
?^ s |
=(%ford (end [3 4] s))
2024-05-22 21:25:45 +03:00
++ out
^- curb
[%or pro/%vase pro/%tang ~]
2024-04-10 17:39:46 +03:00
:: +riff:ford: Constant build system node
::
:: Required for bootstrapping. This is used to put the reef and
:: other ford combinators into the build system to bootstrap
:: everything else. To update a riff, simply %make over the top
::
2024-04-02 20:09:34 +03:00
++ riff
2024-05-21 19:33:55 +03:00
^- kook
2024-04-02 20:09:34 +03:00
|%
2024-05-22 21:25:45 +03:00
++ state out:ford
2024-04-02 20:09:34 +03:00
++ poke *(set stud)
++ kids ~
++ deps ~
++ form
^- ^form
2024-05-22 21:25:45 +03:00
|_ [=bowl =aeon =stud state-vase=vase]
2024-04-02 20:09:34 +03:00
+* sta !<([cache=(unit vase) ~] state-vase)
++ poke
2024-05-22 21:25:45 +03:00
|= pal=pail
^- (quip card pail)
2024-04-02 20:09:34 +03:00
!!
::
++ init
2024-05-22 21:25:45 +03:00
|= pal=(unit pail)
^- (quip card pail)
=/ old (need pal)
?> ?=(%vase p.old)
`old
2024-04-02 20:09:34 +03:00
--
--
2024-04-10 17:39:46 +03:00
:: +dep:ford: $fief for a ford dependency
::
:: Handy shortcut to specifiy a dependency in the build system
2024-05-22 23:10:36 +03:00
++ dep `fief`[& [pro/%vase (sy %ford-in ~)] ~]
2024-04-10 17:39:46 +03:00
:: +get-output: pull build resuit of dependency
::
2024-03-22 09:52:35 +03:00
++ get-output
|= [=bowl =term]
^- (unit vase)
2024-05-22 21:25:45 +03:00
=/ [=pith =lore] (~(got by deps.bowl) term)
?~ fil.lore
~
`q.pail.u.fil.lore
2024-04-11 15:41:56 +03:00
::
2024-03-20 22:39:46 +03:00
++ run
|= txt=@t
2024-03-28 20:53:56 +03:00
(scan (trip txt) (rein *name))
2024-04-12 18:58:02 +03:00
+$ loc
[=disk =pith]
2024-04-10 17:39:46 +03:00
:: $lib:ford: Specification of library import
::
2024-03-20 22:39:46 +03:00
+$ lib
2024-05-28 09:21:10 +03:00
[face=term =stud]
2024-04-10 17:39:46 +03:00
:: $pro:ford: Specification of protocol import
::
2024-03-20 22:39:46 +03:00
+$ pro
[face=term =stud]
2024-05-28 18:40:33 +03:00
+$ fil
[face=term =stud]
2024-05-29 22:43:34 +03:00
+$ far
[face=term =stud]
+$ fal
[face=term =stud]
2024-03-26 21:09:37 +03:00
+$ vale
[face=term =stud]
2024-04-10 17:39:46 +03:00
:: $file:ford: Code with imports
::
:: XX: rename to pile
::
2024-03-20 22:39:46 +03:00
+$ file
$: pro=(list pro)
2024-03-26 21:09:37 +03:00
:: grab=(list
2024-03-20 22:39:46 +03:00
lib=(list lib)
2024-05-28 18:40:33 +03:00
fil=(list fil)
2024-05-29 22:43:34 +03:00
far=(list far)
fal=(list fal)
2024-03-20 22:39:46 +03:00
=hoon
==
2024-04-10 17:39:46 +03:00
:: +rein:ford: Parse code with imports
2024-03-20 22:39:46 +03:00
++ rein
2024-03-28 20:53:56 +03:00
|= =name
2024-03-20 22:39:46 +03:00
=< apex
|%
2024-04-12 18:58:02 +03:00
++ dis
;~ pose
(cold ~ cab)
;~((glue bar) ;~(pfix sig fed:ag) sym)
==
:: +lib-loc: Parse library location
::
++ lib-loc
;~(plug dis stip)
:: +old-nam: Parse file path (deprecated: XX revisit)
::
:: Examples:
:: Absolute ~hastuc-dibtux/src/foo/bar/test
:: Relative %^/bar
++ old-nam
2024-05-24 19:45:07 +03:00
:: ^- $-(nail (like name))
2024-03-28 20:53:56 +03:00
;~ pose
%+ sear
|= [kets=(list) pit=pith]
^- (unit ^name)
%- mole
|. ^- ^name
=. pit (scag (sub (lent pit) (lent kets)) pit)
2024-04-12 18:58:02 +03:00
=- ~&(parsed-name/- -)
2024-03-28 20:53:56 +03:00
name(pith (welp pith.name pit))
;~(pfix cen ;~(plug (star ket) stip)) :: relative
;~(plug ;~(pfix fas sig fed:ag) stip) :: absolute
==
2024-04-10 17:39:46 +03:00
:: +std:rein:ford: Parse import directive
::
:: Either name:~ship/desk
:: or name (from %std disk)
::
2024-03-20 22:39:46 +03:00
++ std
;~ pose
;~(plug sym ;~(pfix col sig fed:ag) ;~(pfix fas sym))
sym
==
2024-04-10 17:39:46 +03:00
:: +pro:rein:ford: Parse protocol import directive
::
:: /@ foo=bar :: imports %bar protocol from %std disk with name foo
:: /@ bar :: imports %bar protocol from %std disk with name bar
::
2024-05-28 09:21:10 +03:00
2024-03-20 22:39:46 +03:00
++ pro
:: ^- $-(nail (like ^pro))
%+ rune pat
;~ pose
2024-03-27 19:41:23 +03:00
;~(plug sym ;~(pfix tis std))
2024-03-20 22:39:46 +03:00
%+ cook
|= =stud
?@ stud [stud stud]
[mark.stud stud]
std
==
++ lib
2024-05-28 09:21:10 +03:00
:: ^- $-(nail (like ^pro))
2024-04-12 18:58:02 +03:00
%+ rune hep
;~ pose
2024-05-28 09:21:10 +03:00
;~(plug sym ;~(pfix tis std))
2024-04-12 18:58:02 +03:00
%+ cook
2024-05-28 09:21:10 +03:00
|= =stud
?@ stud [stud stud]
[mark.stud stud]
std
2024-04-12 18:58:02 +03:00
==
2024-05-28 18:40:33 +03:00
::
++ fil
:: ^- $-(nail (like ^pro))
%+ rune tar
;~ pose
;~(plug sym ;~(pfix tis std))
%+ cook
|= =stud
?@ stud [stud stud]
[mark.stud stud]
std
==
2024-05-29 22:43:34 +03:00
::
++ far
:: ^- $-(nail (like ^pro))
%+ rune gar
;~ pose
;~(plug sym ;~(pfix tis std))
%+ cook
|= =stud
?@ stud [stud stud]
[mark.stud stud]
std
==
++ fal
:: ^- $-(nail (like ^pro))
%+ rune gal
;~ pose
;~(plug sym ;~(pfix tis std))
%+ cook
|= =stud
?@ stud [stud stud]
[mark.stud stud]
std
==
2024-04-12 18:58:02 +03:00
:: +old-lib: Parse arbitrary library import directive
::
:: Unused, todo revive with more recursive build system
::
:: /- face=~hastuc-dibtux/foo/bar <- imports ~hastuc-dibtux
:: /- %^/bar <- imports bar/hoon up one level with face bar
::
++ old-lib
2024-03-20 22:39:46 +03:00
:: ^- $-(nail (like ^lib))
2024-03-28 20:53:56 +03:00
%+ rune hep
2024-03-20 22:39:46 +03:00
;~ pose
2024-04-12 18:58:02 +03:00
;~(plug sym ;~(pfix tis old-nam))
2024-03-28 20:53:56 +03:00
%+ cook
|= n=^name
=/ last (rear pith.n)
2024-04-12 18:58:02 +03:00
:_ n
?@ last last
(scot last)
old-nam
2024-03-20 22:39:46 +03:00
==
++ rune
|* [car=rule rul=rule]
(ifix [;~(plug fas car gap) gay] rul)
++ libs
:: ^- $-(nail (like (list ^lib)))
(star lib)
++ pros
:: ^- $-(nail (like (list ^pro)))
(star pro)
2024-05-28 18:40:33 +03:00
++ fils (star fil)
2024-05-29 22:43:34 +03:00
++ fals (star fal)
++ fars (star far)
2024-03-20 22:39:46 +03:00
++ hone
:: ^- $-(nail (like hoon))
2024-03-28 20:53:56 +03:00
=+ vaz=(vang & (en-path:^name name))
2024-03-20 22:39:46 +03:00
(ifix [gay gay] tall:vaz)
++ apex
:: ^- rule
;~ plug
pros
libs
2024-05-28 18:40:33 +03:00
fils
2024-05-29 22:43:34 +03:00
fars
fals
2024-03-20 22:39:46 +03:00
hone
==
--
2024-04-10 17:42:50 +03:00
:: +with-face:ford: Decorate vase with face
2024-04-10 17:39:46 +03:00
::
2024-03-20 22:39:46 +03:00
++ with-face
|= [fac=@tas =vase]
vase(p [%face fac p.vase])
2024-04-10 17:42:50 +03:00
:: +with-faces:ford: Decorate vases with faces, slopped onto reef
2024-04-10 17:39:46 +03:00
::
2024-03-26 21:09:37 +03:00
++ with-faces
|= [reef=vase faces=(list (pair term vase))]
?~ faces
reef
2024-03-27 19:41:23 +03:00
$(reef (slop (with-face i.faces) reef), faces t.faces)
2024-03-20 22:39:46 +03:00
--
2024-05-28 12:46:53 +03:00
++ gall
|%
+$ req
$% [%peek p=@dr]
[%keep ~]
[%reap ~]
[%peer ~]
==
+$ peek [src=(set pith) refresh=@dr]
+$ sign sign:agent:^gall
+$ res (pair pith sign)
--
2024-04-10 17:42:50 +03:00
:: +behn: Timer vane
2024-03-20 20:05:02 +03:00
++ behn
|%
2024-04-10 17:42:50 +03:00
:: $req: Timer request
::
:: %wait: Set timer
:: %rest: Cancel timer
::
2024-03-20 20:05:02 +03:00
+$ req $>(?(%rest %wait) task:^behn)
2024-04-10 17:42:50 +03:00
:: $behnres: Timer response
::
:: %wake: Timer went off
::
2024-03-20 20:05:02 +03:00
+$ res $>(%wake gift:^behn)
--
2024-05-28 13:41:03 +03:00
++ eyre
|%
+$ req [%connect =binding:^eyre =pith]
+$ res [%bound ~]
+$ sign (pair @ta gift)
+$ gift
$% [%head =response-header:http]
[%data dat=(unit octs)]
[%done ~]
==
+$ task
(pair @ta inbound-request:^eyre)
--
2024-04-10 17:42:50 +03:00
:: +clay: Filesystem overlay
::
2024-03-29 20:18:36 +03:00
++ clay
|%
:: $peer:clay: Request for file(s) subscription
::
2024-04-18 23:32:36 +03:00
+$ peer [=desk =path as=(unit mark)]
2024-04-10 17:42:50 +03:00
::
:: $req:clay: Filesystem request
::
:: %peer: Setup file subscription at .pith
:: %pull: Cancel file subscripiton at .pith
::
2024-03-29 20:18:36 +03:00
+$ req
$% [%peer =pith =peer]
[%pull =pith]
==
2024-04-10 17:42:50 +03:00
:: $res:clay: Filesystem response
+$ res [=pith case=@ud files=(axol cage)]
2024-03-29 20:18:36 +03:00
--
2024-04-10 17:42:50 +03:00
::
2024-04-22 21:37:31 +03:00
++ iris
|%
2024-05-28 09:21:10 +03:00
+$ req [hand=pith dat=request:http]
+$ res [hand=pith dat=client-response:^iris]
2024-04-22 21:37:31 +03:00
--
2024-03-20 17:49:42 +03:00
:: * A `$bolt` is a `[=stud =once]`
::
2024-04-10 17:42:50 +03:00
:: $peer: Subscription
:: $tone: parent change tracking
2024-04-10 17:42:50 +03:00
::
2024-05-23 19:34:52 +03:00
+$ yell (pair care howl)
+$ tone
2024-05-23 19:34:52 +03:00
$% [%sell ~]
2024-04-03 00:35:10 +03:00
[%rely =term =pith]
2024-05-28 07:43:53 +03:00
[%halt ~]
==
2024-06-12 20:22:24 +03:00
+$ dead term
2024-05-23 19:34:52 +03:00
+$ howl tone
:: $wail: change result
2024-05-28 07:43:53 +03:00
+$ wail (trel hunt howl mode)
2024-05-23 19:34:52 +03:00
2024-05-08 01:53:00 +03:00
:: $song
2024-04-03 21:36:49 +03:00
:: $sound: internal change tracking listeners
2024-04-10 17:42:50 +03:00
::
2024-05-28 07:43:53 +03:00
+$ roar (pair pith tone)
2024-05-23 19:34:52 +03:00
+$ meow
(jug pith (pair care tone))
2024-04-10 17:42:50 +03:00
::
2024-04-03 21:36:49 +03:00
:: $noise: external change tracking listeners
+$ noise
2024-05-08 01:53:00 +03:00
(jug hunt rely)
2024-05-23 19:34:52 +03:00
+$ riot (axal rave)
2024-04-03 21:36:49 +03:00
+$ rave
2024-05-28 07:43:53 +03:00
$: exe=(set howl)
why=(set howl)
zed=(set howl)
2024-05-23 19:34:52 +03:00
==
2024-04-03 21:36:49 +03:00
::
:: $ring: node change tracking
::
+$ ring
$% [%dep p=term =care q=name]
2024-03-20 17:49:42 +03:00
[%sync ~]
==
::
+$ out
2024-05-08 01:53:00 +03:00
$% [%sync p=hunt]
[%stop p=hunt]
2024-03-20 17:49:42 +03:00
==
2024-05-17 20:01:40 +03:00
:: $town: foreign
+$ town (axal mall)
+$ deli
$: last=ever
2024-05-28 01:57:58 +03:00
desc=_|
=yuga :: if nonempty, paths still loading
=epic
2024-05-17 20:01:40 +03:00
==
+$ mall
2024-05-28 01:57:58 +03:00
$: mart=(set hunt) :: subscribers
2024-05-17 20:01:40 +03:00
del=(unit deli) :: if responsible, subscription info
2024-05-28 01:57:58 +03:00
shop=(unit aeon) :: if behind, latest case
2024-05-17 20:01:40 +03:00
~
==
2024-05-28 07:43:53 +03:00
:: $city: synchronsation, indexed by publisher
2024-05-17 20:01:40 +03:00
+$ city (axal ward)
+$ ward
2024-05-28 07:43:53 +03:00
$: exe=(set path)
why=(set path)
zed=(set path)
2024-05-17 20:01:40 +03:00
==
2024-03-13 22:38:08 +03:00
++ pave
|= p=path
^- pith
%+ turn p
|= i=@ta
2024-05-28 01:57:58 +03:00
?^ res=(rush i spot:stip)
u.res
?: =('.y' i)
f/&
?: =('.n' i)
f/|
[%ta i]
2024-03-13 22:38:08 +03:00
::
2024-03-20 17:49:42 +03:00
++ stip :: typed path parser
2024-03-13 22:38:08 +03:00
=< swot
|%
++ swot |=(n=nail `(like pith)`(;~(pfix fas (more fas spot)) n))
::
++ spot
%+ sear
|= a=*
^- (unit iota)
?+ a ~
@ ?:(((sane %tas) a) [~ `@tas`a] ~)
[@ @] ((soft iota) a)
==
%- stew
^. stet ^. limo
:~ :- 'a'^'z' sym
:- '$' (cold [%tas %$] buc)
:- '0'^'9' bisk:so
:- '-' tash:so
:- '.' zust:so
2024-03-27 19:41:23 +03:00
:- '~' ;~(pfix sig ;~(pose (stag %da (cook year when:so)) crub:so (easy [%n ~])))
2024-03-13 22:38:08 +03:00
:- '\'' (stag %t qut)
==
--
2024-03-22 09:52:35 +03:00
::
2024-05-08 01:53:00 +03:00
::
2024-02-23 19:23:42 +03:00
::
2024-02-19 23:56:04 +03:00
++ pith
|^ $+(pith ^pith)
++ en-tape
|= pit=$
(spud (pout pit))
2024-05-23 19:34:52 +03:00
++ dif
|= [a=$ b=$]
|- ^+ a
?~ a b
?~ b a
2024-06-04 01:57:39 +03:00
?. =(i.a i.b)
a
2024-05-23 19:34:52 +03:00
$(a t.a, b t.b)
2024-04-03 21:36:49 +03:00
++ sub
|= [from=$ del=$]
~| pith-sub/[from del]
!.
|- ^+ from
?~ del from
?> ?=(^ from)
?> =(i.del i.from)
$(del t.del, from t.from)
2024-04-10 17:42:50 +03:00
::
2024-03-26 21:09:37 +03:00
++ en-cord
|= pit=$
(spat (pout pit))
2024-04-10 17:42:50 +03:00
::
2024-03-11 20:44:33 +03:00
++ prefix
=| res=$
|= [long=$ curt=$]
^- (unit _res)
?~ curt `(flop res)
?~ long ~
?. =(i.long i.curt)
~
$(long t.long, curt t.curt, res [i.long res])
2024-04-10 17:42:50 +03:00
::
2024-03-11 20:44:33 +03:00
++ suffix
|= [long=$ curt=$]
^- _curt
?~ curt
long
?~ long
~
$(curt t.curt, long t.long)
2024-05-24 19:45:07 +03:00
++ sort
|= [a=$ b=$]
(lte (lent a) (lent b))
2024-02-19 23:56:04 +03:00
--
++ name
2024-03-18 20:18:31 +03:00
=< name
|%
+$ name [=ship =pith]
++ rule
:: ^- _|~(nail *(like name))
;~(plug ;~(pfix fas sig fed:ag) stip)
2024-05-28 01:57:58 +03:00
++ en-spar
|= nam=name
^- spar:ames
[ship.nam (pout pith.nam)]
::
2024-02-19 23:56:04 +03:00
++ en-pith
2024-03-18 20:18:31 +03:00
|= nam=name
2024-02-19 23:56:04 +03:00
^- pith
[p/ship.nam pith.nam]
++ en-tape
2024-03-18 20:18:31 +03:00
|= nam=name
2024-02-19 23:56:04 +03:00
(spud (pout (en-pith nam)))
++ en-path
2024-03-18 20:18:31 +03:00
|= nam=name
2024-02-19 23:56:04 +03:00
(pout (en-pith nam))
2024-03-13 22:38:08 +03:00
++ de-pith |=(pith ~|(de-pith/+< (need (de-pith-soft +<))))
2024-02-19 23:56:04 +03:00
++ de-pith-soft
|= =pith
2024-03-18 20:18:31 +03:00
^- (unit name)
2024-02-19 23:56:04 +03:00
?. ?=([[%p @] *] pith)
~
`[+.i.pith t.pith]
--
2024-05-22 19:36:53 +03:00
++ axol axal:..zuse
++ axol-of of:..zuse
2024-03-20 17:49:42 +03:00
++ axal
|$ [item]
[fil=(unit item) kid=(map iota $)]
++ axil
|$ [item]
[fil=(unit item) kid=(map pith item)]
2024-03-12 22:17:20 +03:00
++ of
2024-03-20 17:49:42 +03:00
=| fat=(axal)
|@
2024-05-21 23:52:14 +03:00
++ rot
(need fil.fat)
++ view
=| res=(map pith _?>(?=(^ fil.fat) u.fil.fat))
|= [=care pax=pith]
=. fat (dip pax)
=? res ?=(^ fil.fat)
(~(put by res) ~ u.fil.fat)
?- care
%x res
%y =.(fat snip (~(uni by res) tar))
%z (~(uni by res) tar)
==
::
++ anc-jab
|* [pax=pith fun=$-(* *)]
^+ fat
?~ pax
fat
=? fil.fat ?=(^ fil.fat)
`(fun u.fil.fat)
fat(kid (~(put by kid.fat) i.pax $(fat (~(got by kid.fat) i.pax), pax t.pax)))
::
++ anc
=| res=(list pith)
=| cur=pith
|= pax=pith
^- (set pith)
?~ pax
(~(gas in *(set pith)) res)
=? res ?=(^ fil.fat)
[cur res]
$(fat (~(got by kid.fat) i.pax), pax t.pax, cur (snoc cur i.pax))
++ parent
=| res=(unit pith)
=| cur=pith
|= pax=pith
|- ^+ res
?~ pax
res
=? res ?=(^ fil.fat)
`cur
=/ nex (~(get by kid.fat) i.pax)
?~ nex
res
$(fat u.nex, pax t.pax, cur (snoc cur i.pax))
++ snip
|- ^+ fat
=* loop $
%_ fat
kid
%- ~(run by kid.fat)
|= f=_fat
?^ fil.f
[`u.fil.f ~]
loop(fat f)
==
::
++ kid
|= pax=pith
^- (map pith _?>(?=(^ fil.fat) u.fil.fat))
=. fat (dip pax)
=. fat snip
2024-03-27 19:41:23 +03:00
=. fil.fat ~
tar
::
++ kids
|= pax=pith
^- (axil _?>(?=(^ fil.fat) u.fil.fat))
:- (get pax)
(kid pax)
::
2024-03-12 22:17:20 +03:00
++ del
|= pax=pith
^+ fat
?~ pax [~ kid.fat]
=/ kid (~(get by kid.fat) i.pax)
?~ kid fat
fat(kid (~(put by kid.fat) i.pax $(fat u.kid, pax t.pax)))
2024-03-20 17:49:42 +03:00
::
2024-03-12 22:17:20 +03:00
:: Descend to the axal at this path
::
++ dip
|= pax=pith
^+ fat
?~ pax fat
=/ kid (~(get by kid.fat) i.pax)
?~ kid [~ ~]
$(fat u.kid, pax t.pax)
::
++ gas
2024-03-20 17:49:42 +03:00
|* lit=(list (pair pith _?>(?=(^ fil.fat) u.fil.fat)))
2024-03-12 22:17:20 +03:00
^+ fat
?~ lit fat
$(fat (put p.i.lit q.i.lit), lit t.lit)
++ got
|= pax=pith
~| missing-room/pax
(need (get pax))
2024-03-20 17:49:42 +03:00
++ gut
|* [pax=pith dat=*]
=> .(dat `_?>(?=(^ fil.fat) u.fil.fat)`dat, pax `pith`pax)
^+ dat
(fall (get pax) dat)
2024-03-12 22:17:20 +03:00
::
++ get
|= pax=pith
fil:(dip pax)
:: Fetch file at longest existing prefix of the path
::
++ fit
|= pax=pith
^+ [pax fil.fat]
?~ pax [~ fil.fat]
=/ kid (~(get by kid.fat) i.pax)
?~ kid [pax fil.fat]
=/ low $(fat u.kid, pax t.pax)
?~ +.low
[pax fil.fat]
low
::
++ has
2024-03-13 22:38:08 +03:00
|= pax=pith
2024-03-12 22:17:20 +03:00
!=(~ (get pax))
:: Delete subtree
::
++ lop
2024-03-13 22:38:08 +03:00
|= pax=pith
2024-03-12 22:17:20 +03:00
^+ fat
?~ pax fat
|-
?~ t.pax fat(kid (~(del by kid.fat) i.pax))
=/ kid (~(get by kid.fat) i.pax)
?~ kid fat
fat(kid (~(put by kid.fat) i.pax $(fat u.kid, pax t.pax)))
2024-05-15 20:43:07 +03:00
++ rep
|* [pax=pith fit=_fat]
|- ^+ fat
?~ pax fit
=/ kid (~(gut by kid.fat) i.pax ^+(fat [~ ~]))
fat(kid (~(put by kid.fat) i.pax $(fat kid, pax t.pax)))
::
++ jab
|* [pax=pith fun=$-(_?>(?=(^ fil.fat) u.fil.fat) _?>(?=(^ fil.fat) u.fil.fat))]
^+ fat
=/ kid (got pax)
(put pax (fun kid))
2024-03-12 22:17:20 +03:00
::
++ put
2024-03-20 17:49:42 +03:00
|* [pax=pith dat=*]
2024-05-20 21:13:00 +03:00
^+ fat
2024-03-20 17:49:42 +03:00
=> .(dat `_?>(?=(^ fil.fat) u.fil.fat)`dat, pax `pith`pax)
2024-03-12 22:17:20 +03:00
|- ^+ fat
?~ pax fat(fil `dat)
=/ kid (~(gut by kid.fat) i.pax ^+(fat [~ ~]))
fat(kid (~(put by kid.fat) i.pax $(fat kid, pax t.pax)))
::
2024-05-21 23:52:14 +03:00
++ rut
=| here=pith
|* fun=$-([pith _?>(?=(^ fil.fat) u.fil.fat)] _?>(?=(^ fil.fat) u.fil.fat))
^+ fat
%= fat
fil ?~(fil.fat ~ `(fun here u.fil.fat))
kid (~(rut by kid.fat) |=([iot=iota f=_fat] ^$(here (snoc here iot), fat f)))
==
::
2024-03-12 22:17:20 +03:00
++ tap
=| pax=pith
=| out=(list (pair pith _?>(?=(^ fil.fat) u.fil.fat)))
|- ^+ out
=? out ?=(^ fil.fat) :_(out [pax u.fil.fat])
=/ kid ~(tap by kid.fat)
|- ^+ out
?~ kid out
%= $
kid t.kid
out ^$(pax (weld pax /[p.i.kid]), fat q.i.kid)
==
:: Serialize to map
::
++ tar
2024-03-20 17:49:42 +03:00
(~(gas by *(map pith _?>(?=(^ fil.fat) u.fil.fat))) tap)
2024-03-12 22:17:20 +03:00
--
+$ pate [[%p p=ship] q=pith]
2024-05-28 09:21:10 +03:00
+$ dita (each iota aura)
2024-05-08 01:53:00 +03:00
+$ zeta (each iota aura)
2024-04-19 21:30:36 +03:00
:: $pish: Pattern match over a path
::
:: Ending with & indicates that the path match continues with
:: Ending with | indicates that the path match stops
::
+$ pish
2024-06-19 01:23:29 +03:00
$+ pish
2024-04-19 21:30:36 +03:00
$@(? [i=dita t=pish])
2024-05-08 01:53:00 +03:00
+$ rail
2024-06-19 01:23:29 +03:00
$+ rail
2024-05-08 01:53:00 +03:00
$@(? [i=zeta t=rail])
+$ conf (map term pith)
2024-05-08 01:53:00 +03:00
+$ crew (map term pith)
:: $deck: ???
::
:: apse, cove, dais,
2024-03-20 20:05:02 +03:00
+$ card (pair pith note)
2024-02-19 23:56:04 +03:00
+$ request
[src=pith dest=pith val=*]
2024-03-22 09:52:35 +03:00
+$ nack
$% [%get p=(set pith)]
[%sec p=(set pith)]
[%err p=tang]
2024-02-23 19:23:42 +03:00
==
+$ update diff
2024-02-19 23:56:04 +03:00
+$ watch (list update)
::
+$ err
$% [%here =pith]
[%goof err=*]
[%fail err=*]
==
+$ response-status
$% [%done ~]
err
==
2024-03-18 20:18:31 +03:00
+$ page (pair stud *)
:: +$ cage (pair stud vase)
2024-02-19 23:56:04 +03:00
::
2024-03-28 20:53:56 +03:00
+$ made
2024-05-22 21:25:45 +03:00
[=stud init=(unit pail) =conf]
2024-01-19 02:07:28 +03:00
+$ note
2024-03-28 20:53:56 +03:00
$% [%make made] :: todo: configuration values, init cannot be ^ if installing over
2024-03-22 09:52:35 +03:00
[%poke =pail]
2024-03-28 20:53:56 +03:00
[%tomb cas=(unit case)] :: tom
2024-05-21 23:52:14 +03:00
[%cull ~]
2024-03-27 19:41:23 +03:00
[%link from=pith src=stud] :: XX deprecate
2024-01-19 02:07:28 +03:00
==
2024-03-27 19:41:23 +03:00
+$ raw-poke
(pair flow vial)
2024-01-19 02:07:28 +03:00
+$ yard
$+ yard
$~ ~
2024-01-19 20:56:14 +03:00
(map iota hall)
2024-03-22 09:52:35 +03:00
+$ rely
2024-05-28 07:43:53 +03:00
[=term =leaf]
2024-05-08 01:53:00 +03:00
::
2024-05-28 01:57:58 +03:00
+$ peer
$: run-nonce=@uvJ
~
==
+$ mate (map ship peer)
+$ meet (pair ship peer)
2024-04-03 00:35:10 +03:00
::
+$ dish (pair pith mode)
2024-05-08 01:53:00 +03:00
+$ yarn (pair aeon mode)
2024-05-22 21:25:45 +03:00
:: $leaf: diff over namespace
+$ leaf
2024-05-28 07:43:53 +03:00
(axal mode)
2024-04-03 00:35:10 +03:00
::
2024-05-22 21:25:45 +03:00
+$ lore (axal idea)
+$ idea
2024-05-28 12:46:53 +03:00
$: =saga :: original binding
thru=(unit stud) :: any role
=pail :: transformed binding
2024-05-22 21:25:45 +03:00
==
2024-05-23 19:34:52 +03:00
+$ dive
$: con=(map [grab=stud role=stud grow=stud] stud)
by-grab=(jug stud [role=stud stud]) :: indexed by from type
by-grow=(jug stud [role=stud stud]) :: indexed by to type
==
2024-05-22 21:25:45 +03:00
::
2024-05-24 17:09:36 +03:00
++ unix
=< unix
|%
+$ unix
$: =clay
2024-05-28 09:21:10 +03:00
=iris
=behn
2024-05-28 12:46:53 +03:00
=gall
2024-05-28 13:41:03 +03:00
=eyre
2024-05-24 17:09:36 +03:00
==
+$ behn (jug @da pith)
2024-05-24 17:09:36 +03:00
+$ clay
(map [src=pith hand=pith] [case=@ud =desk =path as=(unit mark)])
2024-05-28 09:21:10 +03:00
+$ iris
(set [src=pith hand=pith])
2024-05-28 13:41:03 +03:00
+$ eyre
$: by-id=(map @ta pith)
by-pith=(map pith @ta)
bind=(map binding:^^eyre pith)
==
2024-05-28 12:46:53 +03:00
++ gall
=< gall
|%
+$ gall
$: peer=(jug pith pith)
peek=(map pith peek:^^gall)
==
--
2024-05-24 17:09:36 +03:00
--
::
2024-03-22 09:52:35 +03:00
+$ stem
2024-05-20 19:27:31 +03:00
$~ [*ever %x %stud *vase]
%+ pair ever
$% [%x =pail]
[%y =pail kids=(map pith [=ever =mode =pail])]
[%z =pail kids=(map pith [=ever =mode =pail])]
==
+$ twig
2024-05-20 19:27:31 +03:00
$~ [*ever %x %stud ~]
2024-03-22 09:52:35 +03:00
%+ pair ever
$% [%x =vial]
[%y =vial kids=(map pith [=ever =mode =vial])]
[%z =vial kids=(map pith [=ever =mode =vial])]
2024-03-22 09:52:35 +03:00
==
++ wand
|^
2024-05-20 19:27:31 +03:00
$~ [%x *ever [%$ ~] ~]
$: =care
=ever
=vial
kids=(map pith [=ever =vial])
==
++ make
|= [=care at=pith ax=(axal room)]
^- ^$
=/ rot (need fil.ax)
2024-04-22 21:37:31 +03:00
:+ care (get-ever:room rot)
:- (to-vial:room rot)
%- ~(gas by *(map pith [ever vial]))
=- %+ turn ~(tap by -)
|=([k=pith v=[ever vial]] [(welp at k) v])
2024-05-15 22:55:15 +03:00
?+ care !!
%x ~
%y
=. ax ~(snip of ax)
2024-04-22 21:37:31 +03:00
(~(run by ~(tar of ax)) |=(r=room [(get-ever:room r) (to-vial:room r)]))
::
%z
2024-04-22 21:37:31 +03:00
(~(run by ~(tar of ax)) |=(r=room [(get-ever:room r) (to-vial:room r)]))
==
--
2024-05-08 01:53:00 +03:00
::
:: $cane: (deprecated)
2024-03-22 09:52:35 +03:00
+$ cane
2024-05-20 19:27:31 +03:00
$~ [%x *ever [%$ *vase] ~]
2024-03-22 09:52:35 +03:00
$: =care
=ever
=pail
kids=(map pith [=ever =pail])
2024-03-22 09:52:35 +03:00
==
::
2024-03-26 21:09:37 +03:00
++ make-cane
|= [=care at=pith ax=(axal room)]
^- cane
=/ rot (need fil.ax)
2024-04-22 21:37:31 +03:00
?> ?=(%icon -.seat.rot)
=/ =icon icon.seat.rot
:+ care ever.icon
:- [state.rot state.icon]
2024-03-26 21:09:37 +03:00
%- ~(gas by *(map pith [ever pail]))
=- %+ turn ~(tap by -)
|=([k=pith v=[ever pail]] [(welp at k) v])
2024-05-15 22:55:15 +03:00
?+ care !!
2024-03-26 21:09:37 +03:00
%x ~
%y
=. ax ~(snip of ax)
2024-04-03 21:36:49 +03:00
=. fil.ax ~
2024-04-22 21:37:31 +03:00
(~(run by ~(tar of ax)) |=(r=room [(get-ever:room r) (to-pail:room r)]))
2024-03-26 21:09:37 +03:00
::
%z
2024-04-03 21:36:49 +03:00
=. fil.ax ~
2024-04-22 21:37:31 +03:00
(~(run by ~(tar of ax)) |=(r=room [(get-ever:room r) (to-pail:room r)]))
2024-03-26 21:09:37 +03:00
==
2024-03-29 20:18:36 +03:00
++ dejs
=, dejs:format
|%
++ pail
2024-04-03 01:36:27 +03:00
|= fun=$-([@ json] vase)
2024-03-29 20:18:36 +03:00
|= jon=json
^- ^pail
?> ?=(^ jon)
?> ?=(%o -.jon)
=/ std (~(got by p.jon) %stud)
=/ dat (~(got by p.jon) %data)
?> ?=(%s -.std)
[`@tas`p.std (fun [p.std dat])]
--
2024-03-26 21:09:37 +03:00
::
2024-03-22 09:52:35 +03:00
:: !!stud refers to imp/ different from $vial
+$ diff [=pith =ever dat=(unit vial)]
:: +$ mace [=pith =ever =diff]
2024-03-12 22:17:20 +03:00
::
2024-03-20 22:39:46 +03:00
++ sign
|^
$% [%poke status=response-status]
[%conf conf]
==
2024-03-20 22:39:46 +03:00
+$ conf
2024-03-22 09:52:35 +03:00
$% [%val ~]
[%pith ~ q=pith]
2024-03-20 22:39:46 +03:00
==
--
2024-03-22 09:52:35 +03:00
:: $ewer: deprecated
2024-03-18 20:18:31 +03:00
+$ ewer (pair stud vase)
+$ move (pair pith card)
2024-05-22 19:36:53 +03:00
::
2024-01-19 02:07:28 +03:00
+$ icon
2024-03-22 09:52:35 +03:00
$: =ever
state=vase
history=(list *)
migration=(list *)
==
2024-02-19 23:56:04 +03:00
:: subscription metadata
2024-02-23 19:23:42 +03:00
+$ brig
2024-04-02 20:09:34 +03:00
$+ brig (axal cane)
2024-03-20 17:49:42 +03:00
2024-02-23 19:23:42 +03:00
+$ fleet
$+ fleet
$~ ~
(map ship brig)
2024-03-12 22:17:20 +03:00
+$ hall hall:room
2024-04-22 21:37:31 +03:00
+$ seat
$% [%icon =icon]
[%soil =soil]
==
2024-02-19 23:56:04 +03:00
:: $room: state of a shrub
::
:: TODO: refactor for networking?
2024-03-12 22:17:20 +03:00
++ room
=< room
|%
+$ hall
$% [%exit pith]
[%room room]
==
+$ room
$+ room
2024-04-02 20:09:34 +03:00
$: code=stud
state=stud
2024-03-12 22:17:20 +03:00
=conf
2024-04-22 21:37:31 +03:00
=seat
2024-03-12 22:17:20 +03:00
==
2024-04-22 21:37:31 +03:00
++ get-ever
|= rom=room
2024-04-22 21:37:31 +03:00
^- ever
?> ?=(%icon -.seat.rom)
ever.icon.seat.rom
::
++ to-pail
|= rom=room
^- pail
2024-04-22 21:37:31 +03:00
?> ?=(%icon -.seat.rom)
[state.rom state.icon.seat.rom]
++ to-vial
|= rom=room
[p q.q]:(to-pail rom)
::
2024-03-12 22:17:20 +03:00
++ de-hall-soft
|= hal=hall
^- (unit room)
?. ?=(%room -.hal)
~
`+.hal
++ de-hall
|= hal=hall
2024-03-21 01:47:15 +03:00
(need (de-hall-soft hal))
2024-03-12 22:17:20 +03:00
--
+$ bowl
2024-03-27 19:41:23 +03:00
$: src=name :: [=ship =pith]
our=@p :: our
2024-03-20 17:49:42 +03:00
were=pith :: XX: rename to here
2024-03-27 19:41:23 +03:00
here=pith ::
now=@da
2024-05-28 15:18:18 +03:00
eny=@uvJ
2024-05-22 21:25:45 +03:00
deps=(map term (pair pith lore))
kids=lore
==
2024-05-22 19:36:53 +03:00
++ dbug
|%
++ bowl
|= =^bowl
^- tank
=/ bol bowl(kids ~, deps ~)
>bol<
++ epic
|= =^epic
^- tank
>~(key by ~(tar of epic))<
++ deps
|= deps=(map term (pair pith ^epic))
=- (sell !>(-))
(turn ~(tap by deps) |=([=term =pith e=^epic] [term pith]))
--
2024-04-11 15:41:56 +03:00
++ quay
=< quay
|%
2024-05-23 19:34:52 +03:00
+$ quay (pair lash (unit port))
2024-04-11 15:41:56 +03:00
++ get-care
|= q=quay
^- care
?~ q.q
%x
p.u.q.q
--
2024-06-17 20:46:26 +03:00
+$ fief [=deed =quay]
2024-05-22 21:25:45 +03:00
::
2024-05-23 19:34:52 +03:00
:: $port: Children API
::
2024-05-22 21:25:45 +03:00
::
+$ lash
[state=curb poke=(set stud)]
+$ dock
[state=curb poke=(set stud) =kids]
:: +$ slip
:: [state=stud diffs=(set stud) =kids] ::
2024-05-08 01:53:00 +03:00
+$ deps band
:: $band: Dependencies
::
2024-06-19 01:23:29 +03:00
+$ band $+(band (map term fief))
+$ lads $+(lads (map pish lash))
2024-05-28 07:43:53 +03:00
+$ dare ?(%y %z)
+$ port (pair dare lads)
2024-05-24 17:09:36 +03:00
+$ kids (unit port)
2024-06-04 13:01:03 +03:00
+$ tear
$% [%only wan=curb hav=stud]
[%not not=curb hav=stud]
==
2024-05-21 19:33:55 +03:00
:: $dude: virtual namespace binding
2024-04-22 21:37:31 +03:00
::
2024-05-21 19:33:55 +03:00
+$ dude
2024-04-22 21:37:31 +03:00
$_ ^&
|%
:: $state: the state of this value in the urbit namespace
::
:: For instance, a message would be
:: [author=ship time-sent=time message=txt]
::
++ state *stud
2024-05-21 19:33:55 +03:00
++ work
|~ =bowl
*vase
2024-04-22 21:37:31 +03:00
::
:: +kids: Some nodes in the namespace define what children are
:: allowed to be under them. For instance, it should not be allowed
:: to create /~hastuc-dibtux/chats/unit-731/blog-post-1. This is
:: nonsensical because blog posts don't go in chats.
2024-05-24 17:09:36 +03:00
++ kids *^kids
2024-04-22 21:37:31 +03:00
::
:: +deps: Some nodes in the namespace might like to hear about other
:: things that happen in the namespace. For instance, a substack-type
:: software would like to know where the wallet software is located
:: in the name
++ deps *(map term fief)
--
2024-05-20 19:27:31 +03:00
++ o-till !!
::|= plot=*
::^- firm
::|%
::++ state state:plot
::++ poke *(set stud)
::++ kids kids:plot
::++ deps deps:plot
::++ form
:: ^- ^form
:: ~& %accessing-bad-form
:: *^form
::--
2024-05-17 21:28:27 +03:00
+$ o-soil
2024-04-22 22:28:31 +03:00
$: init=(pair ever (map name ever))
2024-05-15 20:43:07 +03:00
dirt=(unit o-dirt)
2024-04-22 21:37:31 +03:00
==
2024-05-15 20:43:07 +03:00
+$ o-dirt
2024-04-22 21:37:31 +03:00
$: =ever
=vase
==
:: $farm: produce reactive value
2024-05-15 20:43:07 +03:00
+$ o-farm
2024-04-22 21:37:31 +03:00
$_ ^|
|= =bowl
*vase
2024-05-21 19:33:55 +03:00
:: $kook: type of the value in the urbit namespace
::
2024-05-21 19:33:55 +03:00
+$ kook
$_ ^&
|%
2024-01-28 06:20:35 +03:00
:: $state: the state of this value in the urbit namespace
::
:: For instance, a message would be
:: ```hoon
:: [author=ship time-sent=time message=txt]
:: ```
::
:: ```
2024-05-22 21:25:45 +03:00
++ state *curb
2024-01-28 06:20:35 +03:00
:: $poke: a poke is a request to change a value in teh urbit
:: namespace.
::
:: For instance a blocked list that is a set of users would be
:: [%add who=user]
:: [%del who=user]
::
::
2024-03-22 09:52:35 +03:00
++ poke *(set stud)
++ form *^form
2024-01-28 06:20:35 +03:00
::
:: +kids: Some nodes in the namespace define what children are
:: allowed to be under them. For instance, it should not be allowed
:: to create /~hastuc-dibtux/chats/unit-731/blog-post-1. This is
:: nonsensical because blog posts don't go in chats.
2024-05-24 17:09:36 +03:00
++ kids *(unit port)
2024-01-28 06:20:35 +03:00
::
:: +deps: Some nodes in the namespace might like to hear about other
:: things that happen in the namespace. For instance, a substack-type
:: software would like to know where the wallet software is located
:: in the name
++ deps *(map term fief)
--
2024-05-21 19:33:55 +03:00
+$ wave
2024-05-21 23:52:14 +03:00
$: code=stud
2024-05-22 21:25:45 +03:00
=dock
2024-05-21 19:33:55 +03:00
=crew
2024-06-12 20:22:24 +03:00
live=?
2024-05-21 19:33:55 +03:00
==
+$ tide (axal wave)
2024-04-11 22:06:26 +03:00
::
2024-01-19 02:07:28 +03:00
+$ form
$_ ^|
2024-05-22 21:25:45 +03:00
|_ [=bowl =saga]
2024-03-22 09:52:35 +03:00
:: +reduce: apply %poke, producing state and IO
2024-01-28 06:20:35 +03:00
::
:: ('liam'' ~) [%add who='ruby'] -> ('liam' 'ruby')
:: ('liam' 'ruby' ~) [%del who='ruby'] -> ('liam')
2024-03-22 09:52:35 +03:00
++ poke
|~ [=stud val=vase]
2024-05-22 21:25:45 +03:00
*(quip card pail)
2024-01-19 02:07:28 +03:00
++ init
2024-05-22 21:25:45 +03:00
|~ old=(unit pail)
*(quip card pail)
2024-01-19 02:07:28 +03:00
--
2024-05-22 21:25:45 +03:00
+$ gang (axal cove)
+$ cove
$: =crew
2024-05-24 17:09:36 +03:00
code=stud
rime=case
2024-05-22 21:25:45 +03:00
==
2024-05-24 17:09:36 +03:00
::
2024-04-11 15:41:56 +03:00
++ peon
|%
++ match
|= [nedl=pish hstk=pith]
^- ?
2024-04-19 21:30:36 +03:00
?@ nedl
|(nedl =(~ hstk))
2024-04-11 15:41:56 +03:00
?~ hstk
|
?: ?=(%& -.i.nedl)
&(=(p.i.nedl i.hstk) $(nedl t.nedl, hstk t.hstk))
?@ i.hstk
=(p.i.nedl %tas)
&(=(-.i.hstk p.i.nedl) $(nedl t.nedl, hstk t.hstk))
++ find
|= [pax=pith pis=(set pish)]
^- (unit pish)
?~ lis=(skim ~(tap in pis) |=(pish (match +< pax)))
~
`i.lis
--
2024-05-24 19:45:07 +03:00
++ press
|_ =post
++ disk ^- ^disk ?@(q.post ~ +.q.post)
++ stud q.post
++ eject
|= =^pith
^- [kind:ford _post _pith]
~| ejecting/pith
=^ dis=^disk pith
?> ?=([%cod *] pith)
(eject:floppy t.pith)
?> ?=([kind:ford tack @ *] pith)
=/ =kind:ford i.pith
=/ =tack i.t.pith
:+ kind [tack ?@(dis i.t.t.pith [i.t.t.pith ship.dis term.dis])]
t.t.t.pith
++ slip
|= [=kind:ford pax=^pith]
=/ [@ p=^post =^pith]
(eject pax)
(~(pith press p) kind)
++ path
|= =kind:ford
(pout (pith kind))
::
++ pith
|= =kind:ford
:- %cod
%+ welp ~(pith floppy disk)
:- kind
:- p.post
=- ~[-]
?@ q.post q.post
mark.q.post
--
++ floppy
|_ =disk
++ eject
|= =^pith
^+ [disk pith]
?: ?=([%std *] pith)
[~ t.pith]
?> ?=([[%p @] @ *] pith)
[[+.i.pith i.t.pith] t.t.pith]
++ pith
^- ^pith
?@ disk
#/std
[p/ship.disk term.disk ~]
--
++ lte-pith
|= [a=pith b=pith]
^- ?
?~ a &
?~ b |
?. =(i.a i.b)
%+ lte-dime
?^(i.a i.a [%tas i.a])
?^(i.b i.b [%tas i.b])
$(a t.a, b t.b)
::
++ lte-dime
|= [a=dime b=dime]
^- ?
?. =(p.a p.b)
(aor -.a -.b)
?+ p.a (lte q.a q.b)
%rd (lte:rd q.a q.b)
%rh (lte:rh q.a q.b)
%rq (lte:rq q.a q.b)
%rs (lte:rs q.a q.b)
%s !=(--1 (cmp:si q.a q.b))
?(%t %ta %tas) (aor q.a q.b)
==
::
2024-06-19 01:23:29 +03:00
++ dprint ^dprint
++ easy-print ^easy-print
++ slow :: get arms in core
|= typ=type
^- (list (list term))
?+ typ ~
[%hold *] $(typ ~(repo ut typ))
[%hint *] $(typ ~(repo ut typ))
[%core *]
%- zing
%+ turn ~(tap by q.r.q.typ)
|= [a=term b=tome]
%+ turn ~(tap by q.b)
|= [c=term *]
~[a c]
==
2024-01-19 02:07:28 +03:00
--