mirror of
https://github.com/wicrum-wicrun/sss.git
synced 2024-09-11 18:37:26 +03:00
everything works but needs cleanup
This commit is contained in:
parent
10336f54d8
commit
a8b5ff047c
@ -24,20 +24,20 @@
|
||||
::
|
||||
=/ in-log (mk-subs log ,[%foo %bar ~])
|
||||
=/ in-sum (mk-subs sum ,[%baz ~])
|
||||
=/ out-log (mk-pubs log)
|
||||
=/ out-log (mk-pubs log ,[%foo %bar ~])
|
||||
::
|
||||
|_ =bowl:gall
|
||||
+* this .
|
||||
da-in-log ~(. (da log ,[%foo %bar ~]) in-log bowl)
|
||||
da-in-sum ~(. (da sum ,[%baz ~]) in-sum bowl)
|
||||
du-out-log ~(. (du log) out-log bowl)
|
||||
du-out-log ~(. (du log ,[%foo %bar ~]) out-log bowl)
|
||||
::
|
||||
++ on-init `this
|
||||
++ on-save !>([in-log in-sum out-log])
|
||||
++ on-load
|
||||
|= =vase
|
||||
=/ old !<([=_in-log =_in-sum =_out-log] vase)
|
||||
`this(in-log in-log.old, in-sum in-sum.old, out-log out-log.old)
|
||||
++ on-load _`this
|
||||
:: |= =vase
|
||||
:: =/ old !<([=_in-log =_in-sum =_out-log] vase)
|
||||
:: `this(in-log in-log.old, in-sum in-sum.old, out-log out-log.old)
|
||||
::
|
||||
++ on-poke
|
||||
|= [=mark =vase]
|
||||
@ -47,7 +47,7 @@
|
||||
?+ mark !!
|
||||
%noun `this
|
||||
%add
|
||||
`this(out-log (~(give (du log) out-log bowl) /foo/bar !<(cord vase)))
|
||||
`this(out-log (give:du-out-log [%foo %bar ~] !<(cord vase)))
|
||||
::
|
||||
%surf
|
||||
:_ this
|
||||
@ -55,14 +55,14 @@
|
||||
::
|
||||
%sss-request
|
||||
:_ this
|
||||
=/ req !<(request:poke vase)
|
||||
?+ ?-(-.req %scry path.req, %pine path.req) !!
|
||||
=/ req ;;(of:du-out-log !<(* vase))
|
||||
?- path.req
|
||||
[%foo %bar ~]
|
||||
~[(~(request (du log) out-log bowl) req)]
|
||||
~[(request:du-out-log req)]
|
||||
==
|
||||
::
|
||||
%sss-response
|
||||
?- res=!<($%(to:da-in-log to:da-in-sum) vase)
|
||||
?- res=;;($%(to:da-in-log to:da-in-sum) !<(* vase))
|
||||
[[%foo %bar ~] *]
|
||||
=^ cards in-log (response:da-in-log res)
|
||||
[cards this]
|
||||
@ -73,14 +73,15 @@
|
||||
==
|
||||
::
|
||||
%sss-on-rock
|
||||
?- res=!<($%(from:da-in-log from:da-in-sum) vase)
|
||||
?- res=;;($%(from:da-in-log from:da-in-sum) !<(* vase))
|
||||
[[%foo %bar ~] *]
|
||||
~& "last message from {<from.res>} on {<src.bowl>} is {<(rear rock.res)>}"
|
||||
~& "last message from {<from.res>} on {<src.res>} is {<,.-.rock.res>}"
|
||||
?< =(-.rock.res 'crash')
|
||||
`this
|
||||
::
|
||||
[[%baz ~] *]
|
||||
?. =(rock.res 42) `this
|
||||
~& "sum from {<from.res>} on {<src.bowl>} is 42"
|
||||
~& "sum from {<from.res>} on {<src.res>} is 42" ::NOTE src.res not src.bowl!
|
||||
`this
|
||||
==
|
||||
==
|
||||
@ -88,31 +89,27 @@
|
||||
++ on-agent
|
||||
|= [=wire =sign:agent:gall]
|
||||
^- (quip card:agent:gall _this)
|
||||
?+ wire `this
|
||||
?- wire :: `this
|
||||
[~ %sss %on-rock @ @ @ %foo %bar ~]
|
||||
`this(in-log (chit:da-in-log wire sign))
|
||||
`this(in-log (chit:da-in-log |3:wire sign))
|
||||
::
|
||||
[~ %sss %on-rock @ @ @ %baz ~]
|
||||
`this(in-sum (chit:da-in-sum wire sign))
|
||||
`this(in-sum (chit:da-in-sum |3:wire sign))
|
||||
::
|
||||
[~ %sss %response *]
|
||||
*
|
||||
?> ?=(%poke-ack -.sign)
|
||||
?~ p.sign `this
|
||||
((slog u.p.sign) `this)
|
||||
==
|
||||
++ on-arvo
|
||||
|= [=wire sign=sign-arvo]
|
||||
^- (quip card:agent:gall _this)
|
||||
:_ this
|
||||
?+ wire ~
|
||||
[~ %sss %behn @ @ %foo %bar ~] (behn:da-in-log |3:wire)
|
||||
[~ %sss %behn @ @ %baz ~] (behn:da-in-sum |3:wire)
|
||||
==
|
||||
::
|
||||
:: ++ on-rock
|
||||
:: |= [dud=dude:gall rok=rock:in wav=(unit wave:in)]
|
||||
:: ?- -.rok
|
||||
:: [%foo %bar ~]
|
||||
:: ~& > "ship {<src.bowl>}, agent {<dud>}, path {<`path`-.rok>}:"
|
||||
:: ~? > ?=(^ wav) "received wave {<+.u.wav>}"
|
||||
:: ~& > "rock is now {<+.rok>}"
|
||||
:: ~& > "sub-map is: {<sub>}"
|
||||
:: ?: ?=([~ * %crash] wav) ~& >>> 'crash!' !!
|
||||
:: `this
|
||||
:: ==
|
||||
++ on-arvo _`this
|
||||
++ on-peek _~
|
||||
++ on-watch _`this
|
||||
++ on-leave _`this
|
||||
|
@ -5,29 +5,30 @@
|
||||
|* [=(lake) paths=mold]
|
||||
*(map [ship dude paths] (flow lake))
|
||||
::
|
||||
++ endo
|
||||
|* =(lake)
|
||||
(map path (tide lake))
|
||||
::
|
||||
++ mk-pubs
|
||||
|* =(lake)
|
||||
*(endo lake)
|
||||
|* [=(lake) paths=mold]
|
||||
*(map paths (tide lake))
|
||||
::
|
||||
++ da
|
||||
|* [=(lake) paths=mold]
|
||||
|_ [exo=_(mk-subs lake paths) =bowl:gall]
|
||||
+* wav ((on aeon wave:lake) lte)
|
||||
+$ from [path=paths from=dude =rock:lake wave=(unit wave:lake)]
|
||||
+$ from [path=paths src=ship from=dude =rock:lake wave=(unit wave:lake)]
|
||||
+$ to (response:poke lake paths)
|
||||
++ pine
|
||||
|= [=what =ship =dude path=paths]
|
||||
^- card:agent:gall
|
||||
:* %pass /
|
||||
%agent [ship dude]
|
||||
%poke %sss-request !> ^- request:poke
|
||||
[%pine dap.bowl what path]
|
||||
%poke %sss-request !> ^- (request:poke paths)
|
||||
[path dap.bowl %pine what]
|
||||
==
|
||||
++ surf |= sub=[ship dude paths] (pine %wave sub)
|
||||
++ timer
|
||||
|= [ship=@ dude=@ path=paths]
|
||||
^- card:agent:gall
|
||||
[%pass (zoom behn/ship^dude^path) %arvo %b %wait (add ~s10 now.bowl)]
|
||||
::
|
||||
++ read
|
||||
^- (map [ship dude paths] [? rock:lake])
|
||||
%- ~(run by exo)
|
||||
@ -53,34 +54,31 @@
|
||||
?. |((lth aeon.rok.flow aeon.res) =(aeon.res 0)) ~
|
||||
:~ :* %pass /
|
||||
%agent [src.bowl from.res]
|
||||
%poke %sss-request !> ^- request:poke
|
||||
[%scry dap.bowl %rock path.res aeon.res]
|
||||
%poke %sss-request !> ^- (request:poke paths)
|
||||
[path.res dap.bowl %scry %rock aeon.res]
|
||||
== ==
|
||||
::
|
||||
%wave
|
||||
=/ cards=(list card:agent:gall)
|
||||
:_ ~
|
||||
:* %pass (zoom pine/(scot %p src.bowl)^from.res^path.res)
|
||||
%arvo %b %wait (add ~s10 now.bowl)
|
||||
==
|
||||
~[(timer (scot %p src.bowl) from.res path.res)]
|
||||
=? cards (gth aeon.res +(aeon.flow)) [(pine %rock current) cards]
|
||||
=? cards (gth aeon.res aeon.flow)
|
||||
=? cards (gth aeon.res aeon.rok.flow)
|
||||
%+ weld cards
|
||||
%+ turn (gulf +(aeon.flow) aeon.res)
|
||||
%+ turn (gulf +(aeon.rok.flow) aeon.res)
|
||||
|= =aeon
|
||||
^- card:agent:gall
|
||||
:* %pass /
|
||||
%agent [src.bowl from.res]
|
||||
%poke %sss-request !> ^- request:poke
|
||||
[%scry dap.bowl %wave path.res aeon]
|
||||
%poke %sss-request !> ^- (request:poke paths)
|
||||
[path.res dap.bowl %scry %wave aeon]
|
||||
==
|
||||
cards
|
||||
==
|
||||
::
|
||||
++ scry-response
|
||||
|= [path=paths from=dude =aeon $%([what=%rock =rock:lake] [what=%wave =wave:lake])]
|
||||
|= [path=paths =dude =aeon $%([what=%rock =rock:lake] [what=%wave =wave:lake])]
|
||||
^- (quip card:agent:gall _exo)
|
||||
=* current [src.bowl from path]
|
||||
=* current [src.bowl dude path]
|
||||
=/ =(flow lake) (~(gut by exo) current *(flow lake))
|
||||
?. (lth aeon.rok.flow aeon)
|
||||
%. `exo
|
||||
@ -107,15 +105,15 @@
|
||||
=. rok.flow [+(aeon.rok.flow) | (wash:lake rock.rok.flow u.wave)]
|
||||
(swim wave)
|
||||
:_ (~(put by exo) current flow)
|
||||
:~ :* %pass //sss/something
|
||||
:~ :* %pass (zoom on-rock/(scot %ud aeon.rok.flow)^(scot %p src.bowl)^dude^path)
|
||||
%agent [our dap]:bowl
|
||||
%poke %sss-on-rock !> ^- ^from
|
||||
[path from rock.rok.flow ^wave]
|
||||
%poke %sss-on-rock !> ^- from
|
||||
[path src.bowl dude rock.rok.flow ^wave]
|
||||
== ==
|
||||
--
|
||||
::
|
||||
++ chit
|
||||
|= [[~ %sss %on-rock aeon=@ ship=@ dude=@ =paths] =sign:agent:gall]
|
||||
|= [[aeon=@ ship=@ dude=@ path=paths] =sign:agent:gall]
|
||||
^+ exo
|
||||
?> ?=(%poke-ack -.sign)
|
||||
?~ p.sign exo
|
||||
@ -123,15 +121,21 @@
|
||||
|= =(flow lake)
|
||||
?. =(aeon.rok.flow (slav %ud aeon)) flow
|
||||
flow(fail.rok &)
|
||||
::
|
||||
++ behn
|
||||
|= [ship=term =dude path=paths]
|
||||
^- (list card:agent:gall)
|
||||
~[(pine %wave (slav %p ship) dude path)]
|
||||
--
|
||||
++ du
|
||||
|* =(lake)
|
||||
|_ [pub=(endo lake) =bowl:gall]
|
||||
|* [=(lake) paths=mold]
|
||||
|_ [pub=_(mk-pubs lake paths) =bowl:gall]
|
||||
+* rok ((on aeon rock:lake) gte)
|
||||
wav ((on aeon wave:lake) lte)
|
||||
::
|
||||
+$ of (request:poke paths)
|
||||
++ give
|
||||
|= [=path =wave:lake]
|
||||
|= [path=paths =wave:lake]
|
||||
^+ pub
|
||||
%+ ~(put by pub) path
|
||||
=/ =(tide lake) (~(gut by pub) path *(tide lake))
|
||||
@ -152,7 +156,7 @@
|
||||
tide(wav (lot:wav wav.tide (bind (ram:rok rok.tide) head) ~))
|
||||
::
|
||||
++ read
|
||||
^- (map path rock:lake)
|
||||
^- (map paths rock:lake)
|
||||
%- ~(run by pub)
|
||||
|= =(tide lake)
|
||||
=< rock
|
||||
@ -163,7 +167,7 @@
|
||||
[aeon (wash:lake rock.snap wave)]
|
||||
::
|
||||
++ wipe
|
||||
|= =path
|
||||
|= path=paths
|
||||
^+ pub
|
||||
%+ ~(put by pub) path
|
||||
=/ =(tide lake) (~(gut by pub) path *(tide lake))
|
||||
@ -178,21 +182,23 @@
|
||||
tide(rok (put:rok +<-:put:rok next))
|
||||
::
|
||||
++ request
|
||||
|= req=request:poke
|
||||
|= req=(request:poke paths)
|
||||
^- card:agent:gall
|
||||
~& > received-request/req
|
||||
=- ~& >> cards/- -
|
||||
=/ =(tide lake)
|
||||
(~(gut by pub) ?-(-.req %scry path.req, * path.req) *(tide lake))
|
||||
?- -.req
|
||||
?- type.req
|
||||
%scry
|
||||
:* %pass (zoom response/scry/(scot %p src.bowl)^from.req^(scot %ud aeon.req)^path.req)
|
||||
%agent [src.bowl from.req]
|
||||
%poke %sss-response !> ^- (response:poke)
|
||||
%poke %sss-response !> ^- (response:poke lake paths)
|
||||
:* path.req dap.bowl aeon.req
|
||||
?- what.req
|
||||
%rock rock/(got:rok rok.tide aeon.req)
|
||||
%wave wave/(got:wav wav.tide aeon.req)
|
||||
?- what.req
|
||||
%wave wave/(got:wav wav.tide aeon.req)
|
||||
%rock
|
||||
?: =(aeon.req 0) rock/*rock:lake
|
||||
rock/(got:rok rok.tide aeon.req)
|
||||
== == ==
|
||||
::
|
||||
%pine
|
||||
@ -203,7 +209,7 @@
|
||||
==
|
||||
:* %pass (zoom response/pine/(scot %p src.bowl)^from.req^path.req)
|
||||
%agent [src.bowl from.req]
|
||||
%poke %sss-response !> ^- (response:poke)
|
||||
%poke %sss-response !> ^- (response:poke lake paths)
|
||||
[path.req dap.bowl aeon what.req]
|
||||
==
|
||||
==
|
||||
|
@ -1,12 +1,12 @@
|
||||
/- *sss
|
||||
|_ =request:poke
|
||||
|_ =(request:poke)
|
||||
++ grow
|
||||
|%
|
||||
++ noun request
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
++ noun request:poke
|
||||
++ noun (request:poke)
|
||||
--
|
||||
++ grad %noun
|
||||
--
|
||||
|
@ -13,9 +13,12 @@
|
||||
++ poke
|
||||
|%
|
||||
++ request
|
||||
$% [%pine from=dude =what =path]
|
||||
[%scry from=dude =what =path aeon=@ud]
|
||||
==
|
||||
|* paths=mold
|
||||
$: path=paths
|
||||
from=dude
|
||||
$% [type=%pine =what]
|
||||
[type=%scry =what aeon=@ud]
|
||||
== ==
|
||||
++ response
|
||||
|* [=(lake) paths=mold]
|
||||
$: path=paths
|
||||
|
Loading…
Reference in New Issue
Block a user