1
0
mirror of https://github.com/ilyakooo0/urbit.git synced 2024-12-21 13:51:50 +03:00
urbit/main/app/dojo/core.hook

708 lines
27 KiB
Plaintext
Raw Normal View History

2015-02-22 01:42:36 +03:00
:: :: ::
2015-03-07 23:39:54 +03:00
:::: /hook/core/dojo/app :: ::::
:: :: ::
/? 314 :: arvo kelvin
2015-03-28 13:57:02 +03:00
/- *sole :: console structures
/+ sole :: console library
2015-02-22 01:42:36 +03:00
:: :: ::
2015-03-07 23:39:54 +03:00
:::: :: ::::
!: :: ::
2015-02-22 01:42:36 +03:00
=> |% :: external structures
++ house :: all state
$: hoc=(map bone session) :: conversations
== ::
++ session :: per conversation
2015-03-28 13:57:02 +03:00
$: say=sole-share :: command-line state
2015-03-08 23:19:39 +03:00
syd=desk :: active desk
luc=(unit case) :: special case
2015-02-22 01:42:36 +03:00
poy=(unit dojo-project) :: working
var=(map term cage) :: variable state
old=(set term) :: used TLVs
== ::
++ dojo-command ::
2015-03-12 19:35:06 +03:00
$% [%flat p=path q=dojo-source] :: noun to unix atom
[%pill p=path q=dojo-source] :: noun to unix pill
2015-03-23 01:46:42 +03:00
:: [%tree p=path q=dojo-source] :: noun to unix tree
2015-03-12 19:35:06 +03:00
[%poke p=goal q=dojo-source] :: make and poke
2015-03-06 12:11:01 +03:00
[%show p=dojo-source] :: print
2015-03-12 19:35:06 +03:00
[%verb p=term q=dojo-source] :: store variable
2015-02-22 01:42:36 +03:00
== ::
2015-03-06 12:11:01 +03:00
++ dojo-source :: construction node
$: p=@ud :: assembly index
q=dojo-build :: general build
2015-02-22 01:42:36 +03:00
== ::
2015-03-06 12:11:01 +03:00
++ dojo-build :: one ford step
2015-03-23 01:46:42 +03:00
$% [%ex p=twig] :: hoon expression
2015-03-12 19:35:06 +03:00
[%di p=dojo-model] :: dialog
[%dv p=path] :: gate from source
2015-03-23 01:46:42 +03:00
[%fi p=dojo-filter q=dojo-source] :: filter
2015-03-06 12:11:01 +03:00
[%sc p=dojo-model] :: script
2015-03-12 19:35:06 +03:00
[%tu p=(list dojo-source)] :: tuple
2015-03-06 12:11:01 +03:00
[%va p=term] :: dojo variable
== ::
++ dojo-filter :: pipeline filter
2015-03-23 01:46:42 +03:00
$% [%a p=twig] :: function gate
2015-03-06 12:11:01 +03:00
[%b p=mark] :: simple transmute
2015-03-23 01:46:42 +03:00
[%c p=dojo-model] :: formal filter
2015-03-06 12:11:01 +03:00
== ::
++ dojo-model :: data construction
$: p=dojo-server :: core source
q=dojo-config :: configuration
== ::
++ dojo-server :: numbered device
$: p=@ud :: assembly index
2015-03-08 23:19:39 +03:00
q=path :: gate path
2015-02-22 01:42:36 +03:00
== ::
++ dojo-config :: configuration
2015-03-06 12:11:01 +03:00
$: p=(list dojo-source) :: by order
2015-03-07 23:39:54 +03:00
q=(map term (unit dojo-source)) :: by keyword
2015-02-22 01:42:36 +03:00
== ::
++ dojo-project :: construction state
$: mad=dojo-command :: operation
num=@ud :: number of tasks
2015-03-12 19:35:06 +03:00
cud=(unit dojo-source) :: now solving
pux=(unit path) :: ford working
2015-03-06 00:22:39 +03:00
pro=(unit vase) :: prompting loop
2015-03-28 13:57:02 +03:00
per=(unit sole-edit) :: pending reverse
2015-03-12 19:35:06 +03:00
job=(map ,@ud dojo-build) :: problems
2015-02-22 01:42:36 +03:00
rez=(map ,@ud cage) :: results
== ::
++ bead ,[p=(set beam) q=cage] :: computed result
2015-03-06 12:11:01 +03:00
++ goal ,[p=ship q=term] :: flat application
2015-02-22 01:42:36 +03:00
++ gift :: out result <-$
$% [%mean p=ares] :: error
[%nice ~] :: acknowledge
2015-03-28 13:57:02 +03:00
[%rush %sole-effect sole-effect] ::
2015-02-22 01:42:36 +03:00
== ::
++ hapt ,[p=ship q=path] ::
++ move ,[p=bone q=(mold note gift)] ::
++ hood :: assembly plan
$: zus=@ud :: zuse kelvin
sur=(list hoot) :: structures
lib=(list hoof) :: libraries
fan=(list horn) :: resources
src=(list hoop) :: program
== ::
++ hoof (pair term (unit (pair case ship))) :: resource reference
++ hoot (pair bean hoof) :: structure gate/core
++ hoop :: source in hood
$% [%& p=twig] :: direct twig
[%| p=beam] :: resource location
== ::
++ horn :: resource tree
$% [%ape p=twig] :: /~ twig by hand
[%arg p=twig] :: /$ argument
[%day p=horn] :: /| list by @dr
[%dub p=term q=horn] :: /= apply face
[%fan p=(list horn)] :: /. list
[%for p=path q=horn] :: /, descend
2015-03-06 01:58:04 +03:00
[%hel p=@ud q=horn] :: /% propagate heel
2015-02-22 01:42:36 +03:00
[%hub p=horn] :: /@ list by @ud
[%man p=(map span horn)] :: /* hetero map
[%nap p=horn] :: /_ homo map
[%now p=horn] :: /& list by @da
[%saw p=twig q=horn] :: /; operate on
[%see p=beam q=horn] :: /: relative to
[%sic p=tile q=horn] :: /^ cast
[%toy p=mark] :: /mark/ static
== ::
2015-03-06 01:58:04 +03:00
++ silk :: construction layer
2015-02-22 01:42:36 +03:00
$& [p=silk q=silk] :: cons
$% [%bake p=mark q=beam r=path] :: local synthesis
[%boil p=mark q=beam r=path] :: general synthesis
[%call p=silk q=silk] :: slam
[%cast p=mark q=silk] :: translate
[%done p=(set beam) q=cage] :: literal
[%dude p=tank q=silk] :: error wrap
[%dune p=(set beam) q=(unit cage)] :: unit literal
[%mute p=silk q=(list (pair wing silk))] :: mutant
[%plan p=beam q=spur r=hood] :: structured assembly
[%reef ~] :: kernel reef
[%ride p=twig q=silk] :: silk thru twig
[%vale p=mark q=ship r=*] :: validate [our his]
== ::
++ note-ford :: note to ford
$% [%exec p=@p q=(unit silk)] :: make / kill
== ::
++ note-gall :: note to %gall
$% [%mess p=[p=ship q=path] q=ship r=cage] ::
== ::
++ sign-gall :: sign from %gall
$% [%mean p=ares] ::
[%nice ~] ::
== ::
++ sign-ford :: sign from ford
$% [%made p=@uvH q=(each cage tang)] :: computed result
2015-02-22 01:42:36 +03:00
== ::
++ note :: out request $->
$% [%f note-ford] ::
[%g note-gall] ::
== ::
++ sign :: in result $<-
$% [%f sign-ford] ::
[%g sign-gall] ::
== ::
-- ::
:: ::
:::: ::
:: ::
|_ $: hid=hide :: system state
house :: program state
== ::
++ he :: per session
|_ [[ost=bone moz=(list move)] session] ::
2015-03-06 12:11:01 +03:00
++ dp :: dojo parser
|%
++ dp-command :: ++dojo-command
%+ knee *dojo-command |. ~+
;~ pose
%+ stag %poke
2015-03-12 19:35:06 +03:00
;~ pfix bar
%+ cook
|= [a=goal b=(each dojo-source (pair path dojo-config))]
^- (pair goal dojo-source)
?- -.b
%& [a p.b]
%| [a [0 %di [0 [%gun q.a p.p.b]] q.p.b]]
==
;~ plug
dp-goal
;~ pose
(stag %& ;~(pfix ace dp-source))
(stag %| ;~(plug (plus ;~(pfix fas sym)) dp-config))
==
==
2015-03-06 12:11:01 +03:00
==
::
2015-03-12 19:35:06 +03:00
%+ stag %verb
2015-03-06 12:11:01 +03:00
;~ pfix tis
;~(plug sym ;~(pfix ace dp-source))
==
2015-03-12 19:35:06 +03:00
::
%+ stag %flat
;~ pfix pat
;~(plug (most fas sym) ;~(pfix ace dp-source))
==
::
%+ stag %pill
;~ pfix lus
;~(plug (most fas sym) ;~(pfix ace dp-source))
==
2015-03-06 12:11:01 +03:00
::
(stag %show dp-source)
==
++ dp-source (stag 0 dp-build) :: ++dojo-source
++ dp-build :: ++dojo-build
%+ knee *dojo-build |. ~+
;~ pose
2015-03-27 22:43:27 +03:00
;~(pfix wut (stag %di dp-model-gun))
2015-03-12 19:35:06 +03:00
;~(pfix pam (stag %sc dp-model-sic))
2015-03-06 12:11:01 +03:00
;~(pfix buc (stag %va sym))
(stag %ex dp-twig)
2015-03-27 22:43:27 +03:00
(ifix [sel ser] (stag %tu (most ace dp-source)))
2015-03-06 12:11:01 +03:00
==
::
++ dp-goal :: ++goal
%+ cook |=(a=goal a)
;~ pose
;~ plug
;~(pfix sig fed:ag)
;~(pfix fas sym)
==
(cook |=(a=term `goal`[our.hid a]) sym)
==
2015-03-08 23:19:39 +03:00
++ dp-model-gun ;~(plug dp-server-gun dp-config) :: ++dojo-model
++ dp-model-sic ;~(plug dp-server-sic dp-config) :: ++dojo-model
++ dp-server-gun (stag 0 (stag %gun dp-device)) :: ++dojo-server
++ dp-server-sic (stag 0 (stag %sic dp-device)) :: ++dojo-server
2015-03-27 22:43:27 +03:00
++ dp-twig wide:(vang & ~) :: ++twig
2015-03-08 23:19:39 +03:00
++ dp-device (most fas sym) :: ++dojo-device
2015-03-06 12:11:01 +03:00
++ dp-value :: ++dojo-source
%+ cook |=(a=dojo-source a)
%+ stag 0
;~ pose
2015-03-12 19:35:06 +03:00
(ifix [kel ker] (stag %tu (most ace dp-source)))
2015-03-06 12:11:01 +03:00
(stag %va ;~(pfix buc sym))
(stag %ex dp-twig)
==
::
++ dp-config :: ++dojo-config
%+ cook |=(a=dojo-config a)
;~ plug
2015-03-12 19:35:06 +03:00
(star ;~(pfix ace dp-value))
2015-03-06 12:11:01 +03:00
%+ cook
2015-03-07 23:39:54 +03:00
~(gas by *(map term (unit dojo-source)))
%+ more
;~(plug com ace)
2015-03-06 12:11:01 +03:00
;~ plug
;~(pfix tis sym)
;~ pose
;~(pfix ace (stag ~ dp-value))
(easy ~)
==
==
==
--
::
2015-02-22 01:42:36 +03:00
++ dy :: project work
|_ dojo-project ::
++ dy-abet +>(poy `+<) :: resolve
++ dy-amok +>(poy ~) :: terminate
2015-03-12 19:35:06 +03:00
++ dy-ford :: send work to ford
2015-03-06 00:22:39 +03:00
|= [pax=path kas=silk]
^+ +>+>
2015-03-12 19:35:06 +03:00
?> ?=(~ pux)
(he-pass(poy `+>+<(pux `pax)) pax %f %exec our.hid `kas)
::
++ dy-stop :: stop work
^+ +>
?~ pux +>
(he-pass(poy ~) u.pux %f %exec our.hid ~)
2015-03-06 00:22:39 +03:00
::
2015-03-06 12:11:01 +03:00
++ dy-slam :: call by ford
2015-03-06 00:22:39 +03:00
|= [pax=path gat=vase sam=vase]
^+ +>+>
(dy-ford pax %call [%done ~ %noun gat] [%done ~ %noun sam])
::
++ dy-rush :: send effects, abet
2015-03-28 13:57:02 +03:00
|= fec=sole-effect
2015-03-06 00:22:39 +03:00
^+ +>+>
(he-rush(poy `+>+<) fec)
::
++ dy-rash :: send effects, amok
2015-03-28 13:57:02 +03:00
|= fec=sole-effect
2015-03-06 00:22:39 +03:00
^+ +>+>
(he-rush(poy ~) fec)
::
2015-03-06 12:11:01 +03:00
++ dy-init-command :: ++dojo-command
|= mad=dojo-command
^+ [mad +>]
?- -.mad
2015-03-12 19:35:06 +03:00
%flat =^(src +>.$ (dy-init-source q.mad) [[%flat p.mad src] +>.$])
%pill =^(src +>.$ (dy-init-source q.mad) [[%pill p.mad src] +>.$])
2015-03-06 12:11:01 +03:00
%poke =^(src +>.$ (dy-init-source q.mad) [[%poke p.mad src] +>.$])
2015-03-12 19:35:06 +03:00
%show =^(src +>.$ (dy-init-source p.mad) [[%show src] +>.$])
%verb =^(src +>.$ (dy-init-source q.mad) [[%verb p.mad src] +>.$])
2015-03-06 12:11:01 +03:00
==
::
2015-03-07 23:39:54 +03:00
++ dy-init-source-unit :: (unit dojo-source)
|= urc=(unit dojo-source)
^+ [urc +>]
?~ urc [~ +>]
=^ src +> (dy-init-source u.urc)
[`src +>.$]
::
2015-03-06 12:11:01 +03:00
++ dy-init-source :: ++dojo-source
|= src=dojo-source
^+ [src +>]
=^ bul +> (dy-init-build q.src)
=: p.src num
q.src bul
==
2015-03-12 19:35:06 +03:00
[src +>.$(num +(num), job (~(put by job) num q.src))]
2015-03-06 12:11:01 +03:00
::
++ dy-init-build :: ++dojo-build
|= bul=dojo-build
^+ [bul +>]
?- -.bul
%ex [bul +>.$]
2015-03-12 19:35:06 +03:00
%di =^(mod +>.$ (dy-init-model p.bul) [[%di mod] +>.$])
%dv [bul +>.$]
2015-03-06 12:11:01 +03:00
%fi !!
%sc !!
2015-03-12 19:35:06 +03:00
%tu =^ dof +>.$
|- ^+ [p.bul +>.^$]
?~ p.bul [~ +>.^$]
=^ dis +>.^$ (dy-init-source i.p.bul)
=^ mor +>.^$ $(p.bul t.p.bul)
[[dis mor] +>.^$]
[[%tu dof] +>.$]
2015-03-06 12:11:01 +03:00
%va [bul +>.$]
==
::
++ dy-init-model :: ++dojo-model
|= mol=dojo-model
^+ [mol +>]
=^ one +>.$ (dy-init-server p.mol)
=^ two +>.$ (dy-init-config q.mol)
[[one two] +>.$]
::
++ dy-init-server :: ++dojo-server
|= srv=dojo-server
=. p.srv num
2015-03-12 19:35:06 +03:00
[srv +>.$(num +(num), job (~(put by job) num [%dv q.srv]))]
2015-03-06 12:11:01 +03:00
::
++ dy-init-config :: prepare config
|= cig=dojo-config
^+ [cig +>]
=^ ord +>.$ (dy-init-ordered p.cig)
=^ key +>.$ (dy-init-named q.cig)
[[ord key] +>.$]
::
++ dy-init-ordered :: (list dojo-source)
2015-02-22 01:42:36 +03:00
|= ord=(list dojo-source)
^+ [ord +>]
?~ ord [~ +>.$]
=^ fir +>.$ (dy-init-source i.ord)
=^ mor +>.$ $(ord t.ord)
[[fir mor] +>.$]
::
2015-03-06 12:11:01 +03:00
++ dy-init-named :: (map @tas dojo-src)
2015-03-07 23:39:54 +03:00
|= key=(map term (unit dojo-source))
2015-02-22 01:42:36 +03:00
^+ [key +>.$]
?~ key [~ +>.$]
2015-03-07 23:39:54 +03:00
=^ top +>.$ (dy-init-source-unit q.n.key)
2015-02-22 01:42:36 +03:00
=^ lef +>.$ $(key l.key)
=^ rit +>.$ $(key r.key)
[[[p.n.key top] lef rit] +>.$]
::
2015-03-06 12:11:01 +03:00
++ dy-init :: full initialize
^+ .
=^(dam . (dy-init-command mad) +(mad dam))
2015-02-22 01:42:36 +03:00
::
2015-03-06 00:22:39 +03:00
++ dy-hand :: complete step
2015-02-22 01:42:36 +03:00
|= cag=cage
^+ +>+>
2015-03-12 19:35:06 +03:00
?> ?=(^ cud)
(dy-step(cud ~, rez (~(put by rez) p.u.cud cag)) +(p.u.cud))
2015-02-22 01:42:36 +03:00
::
2015-03-08 23:19:39 +03:00
++ dy-meal :: vase to cage
|= vax=vase
2015-03-12 19:35:06 +03:00
?. &(?=(@ -.q.vax) ((sane %tas) -.q.vax))
2015-03-08 23:19:39 +03:00
~& %dy-meal-cage
(dy-rash %bel ~)
(dy-hand -.q.vax (slot 3 vax))
::
2015-03-28 13:57:02 +03:00
++ dy-made-edit :: sole edit
2015-03-06 00:22:39 +03:00
|= cag=cage
^+ +>+>
?> ?=(^ per)
2015-03-20 02:56:46 +03:00
?: ?| ?=(^ q.q.cag)
=((lent buf.say) q.q.cag)
!&(?=(%del -.u.per) =(+(p.u.per) (lent buf.say)))
==
2015-03-06 00:22:39 +03:00
dy-abet(per ~)
=^ lic say (~(transmit cs say) u.per)
2015-03-20 02:56:46 +03:00
(dy-rush(per ~) %mor [%det lic] [%err q.q.cag] ~)
2015-03-06 00:22:39 +03:00
::
2015-03-12 19:35:06 +03:00
++ dy-done :: dialog submit
2015-03-06 00:22:39 +03:00
|= txt=tape
?> ?=(^ pro)
2015-03-12 19:35:06 +03:00
(dy-slam /dial u.pro !>(txt))
2015-03-06 00:22:39 +03:00
::
++ dy-over :: finish construction
2015-02-22 01:42:36 +03:00
^+ +>
?- -.mad
%poke
2015-03-06 12:11:01 +03:00
%- he-pass(poy ~)
:* /poke
%g
%mess
[p.p.mad [q.p.mad ~]]
our.hid
(~(got by rez) p.q.mad)
==
2015-02-22 01:42:36 +03:00
::
2015-03-12 19:35:06 +03:00
%flat
=+ out=q.q:(~(got by rez) p.q.mad)
?^ out
(dy-rash %tan [%leaf "not an atom"]~)
(dy-rash %sav p.mad out)
::
%pill
(dy-rash %sag p.mad q.q:(~(got by rez) p.q.mad))
::
%verb
2015-03-06 12:11:01 +03:00
dy-amok(var (~(put by var) p.mad (~(got by rez) p.q.mad)))
::
%show
(dy-rash %tan (sell q:(~(got by rez) p.p.mad)) ~)
2015-02-22 01:42:36 +03:00
==
::
2015-03-06 00:22:39 +03:00
++ dy-edit :: handle edit
2015-03-28 13:57:02 +03:00
|= cal=sole-change
2015-03-06 00:22:39 +03:00
^+ +>+>
=^ dat say (~(transceive cs say) cal)
2015-03-12 19:35:06 +03:00
?: |(?=(^ per) ?=(^ pux) ?=(~ pro))
2015-03-06 00:22:39 +03:00
~& %dy-edit-busy
=^ lic say (~(transmit cs say) dat)
(dy-rush %mor [%det lic] [%bel ~] ~)
2015-03-12 19:35:06 +03:00
(dy-slam(per `dat) /edit u.pro !>((tufa buf.say)))
2015-03-06 00:22:39 +03:00
::
2015-03-28 13:57:02 +03:00
++ dy-type :: sole action
|= act=sole-action
2015-03-06 00:22:39 +03:00
?- -.act
%det (dy-edit +.act)
%ret (dy-done (tufa buf.say))
==
::
2015-03-07 23:39:54 +03:00
++ dy-cage |=(num=@ud (~(got by rez) num)) :: known cage
++ dy-vase |=(num=@ud q:(dy-cage num)) :: known vase
++ dy-silk-vase |=(vax=vase [%done ~ %noun vax]) :: vase to silk
2015-03-12 19:35:06 +03:00
++ dy-silk-config :: configure
2015-03-07 23:39:54 +03:00
|= [cag=cage cig=dojo-config]
^- silk
:+ %ride [%cnzy %$]
:+ %mute [%done ~ cag]
^- (list (pair wing silk))
:* :- [[~ 12] ~]
(dy-silk-vase !>([now=lat.hid eny=eny.hid bec=he-beak]))
2015-03-07 23:39:54 +03:00
::
2015-03-12 19:35:06 +03:00
:- [[~ 26] ~]
2015-03-07 23:39:54 +03:00
%- dy-silk-vase
|- ^- vase
?~ p.cig !>(~)
(slop (dy-vase p.i.p.cig) $(p.cig t.p.cig))
::
%+ turn (~(tap by q.cig))
|= [a=term b=(unit dojo-source)]
^- (pair wing silk)
2015-03-12 19:35:06 +03:00
:- [a [~ 27] ~]
2015-03-07 23:39:54 +03:00
%- dy-silk-vase
?~(b !>([~ ~]) (dy-vase p.u.b))
==
::
2015-03-12 19:35:06 +03:00
++ dy-silk-init-dial :: init and config
|= [cag=cage cig=dojo-config]
2015-03-06 12:11:01 +03:00
^- silk
2015-03-12 19:35:06 +03:00
(dy-silk-config cag cig)
2015-03-06 12:11:01 +03:00
::
++ dy-silk-device :: device to silk
2015-03-08 23:19:39 +03:00
|= pax=path
2015-03-06 12:11:01 +03:00
^- silk
2015-03-12 19:35:06 +03:00
[%boil %gate [he-beak (flop pax)] ~]
2015-03-06 12:11:01 +03:00
::
2015-03-12 19:35:06 +03:00
++ dy-made-dial :: dialog product
|= cag=cage
^+ +>+>
2015-03-20 01:19:19 +03:00
?. ?=(^ q.q.cag)
2015-03-20 02:56:46 +03:00
(dy-rush %err q.q.cag)
2015-03-20 01:19:19 +03:00
=+ tan=((list tank) +2.q.q.cag)
2015-03-12 19:35:06 +03:00
=. +>+>.$ (he-rush %tan tan)
2015-03-20 01:19:19 +03:00
=+ vax=(spec (slot 3 q.cag))
2015-03-12 19:35:06 +03:00
?+ -.q.vax !!
%&
?~ +.q.vax
~& %dy-made-dial-abort
(dy-rash %bel ~)
(dy-meal (slot 7 vax))
::
%|
=< he-pone
%- dy-rush(pro `(slap (slot 7 vax) [%cnzy %q]))
2015-03-28 13:57:02 +03:00
[%pro (sole-prompt +<.q.vax)]
2015-03-12 19:35:06 +03:00
==
::
++ dy-make :: build step
2015-02-22 01:42:36 +03:00
^+ +>
2015-03-12 19:35:06 +03:00
?> ?=(^ cud)
%- dy-ford
^- (pair path silk)
?+ -.q.u.cud !!
%di [/dial (dy-silk-init-dial (dy-cage p.p.p.q.u.cud) q.p.q.u.cud)]
%dv [/hand (dy-silk-device p.q.u.cud)]
%ex [/hand [%ride p.q.u.cud [%reef ~]]]
%tu :- /hand
:+ %done ~
:- %noun
|- ^- vase
?~ p.q.u.cud !!
=+ hed=(dy-vase p.i.p.q.u.cud)
?~ t.p.q.u.cud hed
(slop hed $(p.q.u.cud t.p.q.u.cud))
2015-02-22 01:42:36 +03:00
==
2015-03-12 19:35:06 +03:00
::
++ dy-step :: advance project
|= nex=@ud
^+ +>+>
?> ?=(~ cud)
?: =(nex num)
dy-over
dy-make(cud `[nex (~(got by job) nex)])
2015-02-22 01:42:36 +03:00
--
::
2015-03-06 12:11:01 +03:00
++ he-dope :: sole user of ++dp
|= txt=tape ::
^- (each (unit dojo-command) hair) :: prefix/result
2015-03-27 22:43:27 +03:00
=+ vex=(dp-command:dp [1 1] txt) ::
?. =(+((lent txt)) q.p.vex) :: fully parsed
[%| p.p.vex (dec q.p.vex)] :: syntax error
2015-03-06 12:11:01 +03:00
[%& ?~(q.vex ~ `p.u.q.vex)] :: prefix/complete
::
++ he-duke :: ++he-dope variant
|= txt=tape
^- (each dojo-command ,@ud)
=+ foy=(he-dope txt)
?- -.foy
%| [%| q.p.foy]
%& ?~(p.foy [%| (lent txt)] [%& u.p.foy])
==
::
2015-02-22 01:42:36 +03:00
++ he-abet :: resolve
2015-03-06 00:22:39 +03:00
[(flop moz) %_(+> hoc (~(put by hoc) ost +<+))]
::
2015-03-08 23:19:39 +03:00
++ he-beak :: logical beam
^- beak
[our.hid syd ?^(luc u.luc [%da lat.hid])]
::
2015-02-22 01:42:36 +03:00
++ he-give :: emit gift
|= git=gift
^+ +>
%_(+> moz [[ost %give git] moz])
::
++ he-pass
|= [pax=path noy=note]
%_(+> moz [[ost %pass pax noy] moz])
::
++ he-rush :: emit update
2015-03-28 13:57:02 +03:00
|= fec=sole-effect
2015-02-22 01:42:36 +03:00
^+ +>
2015-03-28 13:57:02 +03:00
(he-give %rush %sole-effect fec)
2015-02-22 01:42:36 +03:00
::
2015-03-23 07:37:01 +03:00
++ he-stop :: abort work
^+ .
?~(poy . ~(dy-stop dy u.poy))
::
2015-02-22 01:42:36 +03:00
++ he-peer :: subscribe to
he-prom
::
2015-03-12 19:35:06 +03:00
++ he-pine :: restore prompt
^+ .
?^ poy .
he-prom:he-pone
::
++ he-pone :: clear prompt
^+ .
=^ cal say (~(transmit cs say) [%set ~])
(he-rush %mor [%det cal] ~)
::
2015-02-22 01:42:36 +03:00
++ he-prom :: send prompt
%- he-rush
:- %pro
2015-03-25 21:03:40 +03:00
[& %$ "> "]
2015-02-22 01:42:36 +03:00
::
2015-03-12 19:35:06 +03:00
++ he-made :: result from ford
|= [pax=path dep=@uvH rey=(each cage tang)]
2015-02-22 01:42:36 +03:00
^+ +>
?> ?=(^ poy)
2015-03-12 19:35:06 +03:00
=< he-pine
2015-02-22 01:42:36 +03:00
?- -.rey
%& %. p.rey
2015-03-12 19:35:06 +03:00
=+ dye=~(. dy u.poy(pux ~))
?+ pax !!
[%hand ~] dy-hand:dye
[%dial ~] dy-made-dial:dye
[%edit ~] dy-made-edit:dye
2015-02-22 01:42:36 +03:00
==
2015-03-12 19:35:06 +03:00
%| ~& [%he-made-fail pax]
2015-03-07 23:39:54 +03:00
(he-rush(poy ~) %tan p.rey)
2015-02-22 01:42:36 +03:00
==
::
2015-03-06 12:11:01 +03:00
++ he-like :: accept line
2015-02-22 01:42:36 +03:00
|= buf=(list ,@c)
2015-03-06 12:11:01 +03:00
=(%& -:(he-dope (tufa buf)))
2015-02-22 01:42:36 +03:00
::
++ he-stir :: apply change
2015-03-28 13:57:02 +03:00
|= cal=sole-change
2015-02-22 01:42:36 +03:00
^+ +>
2015-03-23 23:56:00 +03:00
:: ~& [%his-clock ler.cal]
:: ~& [%our-clock ven.say]
=^ dat say (~(transceive cs say) cal)
?. ?& ?=(%del -.dat)
2015-03-24 06:50:01 +03:00
=(+(p.dat) (lent buf.say))
==
2015-02-22 01:42:36 +03:00
+>.$
2015-03-19 21:53:05 +03:00
=+ foy=(he-dope (tufa buf.say))
?: ?=(%& -.foy) +>.$
2015-03-23 23:56:00 +03:00
:: ~& [%bad-change dat ted.cal]
=^ lic say (~(transmit cs say) dat)
2015-03-23 23:56:00 +03:00
:: ~& [%our-leg leg.say]
2015-03-19 21:53:05 +03:00
(he-rush %mor [%det lic] [%err q.p.foy] ~)
2015-02-22 01:42:36 +03:00
::
++ he-plan :: execute command
|= mad=dojo-command
^+ +>
?> ?=(~ poy)
2015-03-12 19:35:06 +03:00
he-pine:(dy-step:~(dy-init dy mad [0 ~ ~ ~ ~ ~ ~]) 0)
2015-02-22 01:42:36 +03:00
::
++ he-done :: parse command
|= txt=tape
^+ +>
?~ txt
%- he-rush
:~ %mor
[%txt "> "]
[%nex ~]
==
2015-03-06 12:11:01 +03:00
=+ doy=(he-duke txt)
?- -.doy
2015-03-19 21:53:05 +03:00
%| (he-rush [%err p.doy])
2015-03-06 12:11:01 +03:00
%&
=+ old=(weld "> " (tufa buf.say))
=^ cal say (~(transmit cs say) [%set ~])
%. p.doy
=< he-plan
%- he-rush
:~ %mor
[%txt old]
[%nex ~]
[%det cal]
==
==
2015-02-22 01:42:36 +03:00
::
2015-03-12 19:35:06 +03:00
++ he-type :: apply input
2015-03-28 13:57:02 +03:00
|= act=sole-action
2015-02-22 01:42:36 +03:00
^+ +>
2015-03-06 00:22:39 +03:00
?^ poy
2015-03-12 19:35:06 +03:00
he-pine:(~(dy-type dy u.poy) act)
2015-02-22 01:42:36 +03:00
?- -.act
%det (he-stir +.act)
%ret (he-done (tufa buf.say))
==
--
::
++ peer
|= [ost=bone her=ship pax=path]
^- [(list move) _+>]
2015-03-23 15:30:00 +03:00
~? !=(her our.hid) [%dojo-peer ost her pax]
2015-02-22 01:42:36 +03:00
?< (~(has by hoc) ost)
2015-03-28 13:57:02 +03:00
?> =(/sole pax)
2015-03-23 15:30:00 +03:00
:: ?> =(her our.hid)
2015-03-08 23:19:39 +03:00
=< he-abet
%~ he-peer he
:- [ost ~]
^- session
2015-03-28 13:57:02 +03:00
:* *sole-share :: say=sole-share
2015-03-08 23:19:39 +03:00
%main :: syd=desk
~ :: luc=(unit case)
~ :: poy=(unit dojo-project)
~ :: var=(map term cage)
~ :: old=(set term)
==
2015-02-22 01:42:36 +03:00
::
2015-03-28 13:57:02 +03:00
++ poke-sole-action
|= [ost=bone her=ship act=sole-action]
2015-02-22 01:42:36 +03:00
^- [(list move) _+>]
2015-03-23 15:30:00 +03:00
:: ~? !=(her our.hid) [%dojo-poke ost her]
2015-03-12 19:35:06 +03:00
he-abet:(~(he-type he [ost [ost %give %nice ~]~] (~(got by hoc) ost)) act)
2015-02-22 01:42:36 +03:00
::
++ pour
2015-03-07 23:39:54 +03:00
|= [ost=bone pax=path sih=sign]
2015-02-22 01:42:36 +03:00
^- [(list move) _+>]
2015-03-07 23:39:54 +03:00
:: ~& [%dojo-pour pax]
2015-02-22 01:42:36 +03:00
?- -.sih
%f
2015-03-12 19:35:06 +03:00
he-abet:(~(he-made he [[ost ~] (~(got by hoc) ost)]) pax +>.sih)
2015-02-22 01:42:36 +03:00
::
2015-03-12 19:35:06 +03:00
%g
[~ +>.$]
2015-02-22 01:42:36 +03:00
==
2015-03-23 07:37:01 +03:00
::
++ pull
|= ost=bone
^- [(list move) _+>]
=^ moz +>
he-abet:~(he-stop he [[ost ~] (~(got by hoc) ost)])
[moz +>.$(hoc (~(del by hoc) ost))]
2015-02-22 01:42:36 +03:00
--