2015-01-12 04:13:34 +03:00
|
|
|
:: App construction utilities
|
|
|
|
::
|
|
|
|
:::: /hook/core/sh-utils/lib
|
|
|
|
::
|
2015-01-11 04:33:01 +03:00
|
|
|
|%
|
|
|
|
++ append
|
|
|
|
|* a=*
|
|
|
|
|* b=*
|
|
|
|
[b a]
|
2015-01-12 04:13:34 +03:00
|
|
|
--
|
2015-01-11 04:33:01 +03:00
|
|
|
::
|
2015-01-12 04:13:34 +03:00
|
|
|
::::
|
|
|
|
::
|
|
|
|
|%
|
|
|
|
++ args-done |*(ref=_,[(list) ^] (add-exit (add-nice ref))) :: accept args
|
2015-01-11 11:00:36 +03:00
|
|
|
::
|
2015-01-12 04:13:34 +03:00
|
|
|
++ add-exit :: add "kill self" kiss
|
2015-01-11 11:00:36 +03:00
|
|
|
|* ref=_,[(list) ^]
|
|
|
|
%+ add-resp [%pass / %g %cide %$]
|
|
|
|
ref
|
|
|
|
::
|
2015-01-12 04:13:34 +03:00
|
|
|
++ add-nice :: return "succcess" response
|
2015-01-11 11:00:36 +03:00
|
|
|
|* ref=_,[(list) ^]
|
|
|
|
%+ add-resp [%give %nice ~]
|
|
|
|
ref
|
|
|
|
::
|
2015-01-12 04:13:34 +03:00
|
|
|
++ args-into-gate :: poke--args from gate: output and exit
|
2015-01-11 04:33:01 +03:00
|
|
|
|* [con=[* [hide *] *] gat=_,[@ *]]
|
2015-01-11 11:00:36 +03:00
|
|
|
%- args-done
|
|
|
|
%^ gate-outs con
|
|
|
|
|=(a=_+<.gat [%rush (gat a)])
|
|
|
|
,_`con
|
|
|
|
::
|
2015-01-12 04:13:34 +03:00
|
|
|
++ args-into-gift :: compute gifts with gate and exit
|
2015-01-11 11:00:36 +03:00
|
|
|
|* [con=[* [hide *] *] gat=_,(pole ,[@ *])]
|
|
|
|
%- args-done
|
|
|
|
|* [ost=bone * arg=_+<.gat]
|
2015-01-11 04:33:01 +03:00
|
|
|
:_ con
|
2015-01-11 11:00:36 +03:00
|
|
|
%. (gat arg)
|
|
|
|
|* a=(pole ,[@ *])
|
|
|
|
?~ a ~
|
|
|
|
a(- [ost %give -.a], + $(a +.a))
|
|
|
|
::
|
2015-01-12 04:13:34 +03:00
|
|
|
++ add-output :: send gift to /out
|
2015-01-11 11:00:36 +03:00
|
|
|
|* [con=[* [hide *] *] ote=[@ *] ref=_,[(list) ^]]
|
|
|
|
=> .(+<-.con `hid=hide`+<-.con)
|
|
|
|
=+ sus=(~(tap in `(set bone)`(~(get ju pus.hid.con) /out)))
|
|
|
|
=+ mof=(turn sus (append [%give ote]))
|
|
|
|
|= _+<.ref
|
|
|
|
=+ neu=(ref +<)
|
|
|
|
neu(- (welp mof -.neu))
|
|
|
|
::
|
2015-01-12 04:13:34 +03:00
|
|
|
++ add-resp :: add response move to requesting bone
|
2015-01-11 11:00:36 +03:00
|
|
|
|* [mof=[@ @ *] ref=_,[(list) ^]]
|
|
|
|
|* [ost=bone _?@(+<.ref ~ +<+.ref)]
|
|
|
|
=+ neu=(ref +<)
|
|
|
|
neu(- [[ost mof] -.neu])
|
|
|
|
::
|
2015-01-12 04:13:34 +03:00
|
|
|
++ gate-give :: respond with computed gift
|
|
|
|
|* [gat=_,[@ *] ref=_,[(list) ^]]
|
2015-01-11 11:00:36 +03:00
|
|
|
(gate-move |*(_+<.gat [%give (gat +<)]) ref)
|
|
|
|
::
|
2015-01-12 04:13:34 +03:00
|
|
|
++ gate-bang :: respond with computed note
|
2015-01-11 04:33:01 +03:00
|
|
|
|* [gat=_,[@ @ *] ref=_,[(list) ^]]
|
2015-01-11 11:00:36 +03:00
|
|
|
(gate-move |*(_+<.gat [%pass /bang (gat +<)]) ref)
|
|
|
|
::
|
2015-01-12 04:13:34 +03:00
|
|
|
++ gate-move :: respond with computed move
|
|
|
|
|* [gat=_,(mold) ref=_,[(list) ^]]
|
2015-01-11 11:00:36 +03:00
|
|
|
|* [ost=bone * arg=_+<.gat]
|
|
|
|
((add-resp (gat arg) ref) +<)
|
|
|
|
::
|
2015-01-12 04:13:34 +03:00
|
|
|
++ gate-outs :: send computed gift to /out
|
2015-01-11 11:00:36 +03:00
|
|
|
|* [con=[* [hide *] *] gat=_,[@ *] ref=_,[(list) ^]]
|
|
|
|
|* [ost=bone * arg=_+<.gat]
|
|
|
|
((add-output con (gat arg) ref) +<)
|
|
|
|
::
|
2015-01-12 04:13:34 +03:00
|
|
|
++ verify :: type-check with context and move
|
2015-01-11 11:00:36 +03:00
|
|
|
|* [con=^ mof=[@ *]]
|
|
|
|
|* ref=_,[(list ,_mof) _con]
|
|
|
|
|* _+<.ref
|
|
|
|
^- [(list ,_mof) _con]
|
|
|
|
(ref +<)
|
2015-01-11 04:33:01 +03:00
|
|
|
--
|