urbit/ape/dojo.hoon

822 lines
30 KiB
Plaintext
Raw Normal View History

2015-09-10 03:52:55 +03:00
:: :: ::
2015-06-05 03:27:01 +03:00
:::: /hoon/dojo/app :: ::::
2015-05-07 05:31:54 +03:00
:: :: ::
/? 314 :: arvo kelvin
/- sole :: console structures
2015-05-07 05:31:54 +03:00
/+ sole :: console library
2015-09-02 01:20:17 +03:00
[. sole]
2015-05-07 05:31:54 +03:00
:: :: ::
:::: :: ::::
!: :: ::
=> |% :: external structures
++ house :: all state
2015-09-12 00:15:25 +03:00
$: %2
2015-09-04 01:10:18 +03:00
hoc=(map bone session) :: conversations
2015-05-07 05:31:54 +03:00
== ::
++ session :: per conversation
$: say=sole-share :: command-line state
2015-09-10 03:52:55 +03:00
dir=beam :: active path
2015-09-04 04:29:34 +03:00
poy=(unit dojo-project) :: working
[lib=(list hoof) arc=(list hoof)] :: lib/sur
2015-05-07 05:31:54 +03:00
var=(map term cage) :: variable state
old=(set term) :: used TLVs
2015-09-04 01:10:18 +03:00
buf=tape :: multiline buffer
2015-05-07 05:31:54 +03:00
== ::
++ dojo-command ::
$% [%flat p=path q=dojo-source] :: noun to unix atom
[%pill p=path q=dojo-source] :: noun to unix pill
:: [%tree p=path q=dojo-source] :: noun to unix tree
2015-09-04 02:17:34 +03:00
[%file p=beam q=dojo-source] :: save to clay
2015-09-11 02:01:43 +03:00
[%http p=?(%post %put) q=purl r=dojo-source] :: http outbound
2015-05-07 05:31:54 +03:00
[%poke p=goal q=dojo-source] :: make and poke
[%show p=dojo-source] :: print
2015-09-10 01:57:25 +03:00
[%verb p=term q=(unit dojo-source)] :: store variable
2015-05-07 05:31:54 +03:00
== ::
++ dojo-source :: construction node
$: p=@ud :: assembly index
q=dojo-build :: general build
== ::
++ dojo-build :: one ford step
2015-09-12 00:15:25 +03:00
$% [%ex p=twig] :: hoon expression
2015-05-07 05:31:54 +03:00
[%dv p=path] :: gate from source
[%fi p=dojo-filter q=dojo-source] :: filter
[%ge p=dojo-model] :: generator
[%tu p=(list dojo-source)] :: tuple
2015-09-09 02:58:48 +03:00
[%ur p=purl] :: http GET request
2015-05-07 05:31:54 +03:00
== ::
++ dojo-filter :: pipeline filter
2015-09-10 01:57:25 +03:00
$| mark :: simple transmute
twig :: function gate
::
2015-05-07 05:31:54 +03:00
++ dojo-model :: data construction
$: p=dojo-server :: core source
q=dojo-config :: configuration
== ::
++ dojo-server :: numbered device
$: p=@ud :: assembly index
q=path :: gate path
== ::
++ dojo-config :: configuration
$: p=(list dojo-source) :: by order
q=(map term (unit dojo-source)) :: by keyword
== ::
++ dojo-project :: construction state
$: mad=dojo-command :: operation
num=@ud :: number of tasks
cud=(unit dojo-source) :: now solving
pux=(unit path) :: ford working
pro=(unit vase) :: prompting loop
per=(unit sole-edit) :: pending reverse
job=(map ,@ud dojo-build) :: problems
rez=(map ,@ud cage) :: results
== ::
++ bead ,[p=(set beam) q=cage] :: computed result
++ goal ,[p=ship q=term] :: flat application
++ clap :: action, user
$% [%peer p=path] :: subscribe
[%poke p=term q=*] :: apply
[%pull ~] :: unsubscribe
== ::
++ club :: action, system
$% [%peer p=path] :: subscribe
[%poke p=cage] :: apply
[%pull ~] :: unsubscribe
== ::
++ card :: general card
$% [%diff %sole-effect sole-effect] ::
[%send wire [ship term] clap] ::
2015-09-11 02:01:43 +03:00
[%hiss wire mark [%hiss hiss]] ::
2015-07-10 21:49:03 +03:00
[%exec wire @p (unit ,[beak silk])] ::
2015-05-07 05:31:54 +03:00
[%deal wire sock term club] ::
2015-09-04 02:17:34 +03:00
[%info wire @p toro] ::
2015-05-07 05:31:54 +03:00
== ::
++ move (pair bone card) :: user-level move
++ sign ::
$% [%made p=@uvH q=gage] ::
2015-05-07 05:31:54 +03:00
[%unto p=cuft] ::
== ::
-- ::
2015-09-09 00:05:40 +03:00
!: ::
2015-05-07 05:31:54 +03:00
:::: ::
:: ::
2015-05-28 06:48:25 +03:00
|_ $: hid=bowl :: system state
2015-05-07 05:31:54 +03:00
house :: program state
== ::
++ he :: per session
|_ [[ost=bone moz=(list move)] session] ::
++ dp :: dojo parser
|%
2015-09-11 02:01:43 +03:00
++ dp-default-app %hood
++ dp-specify
2015-09-12 00:15:25 +03:00
|= [gol=goal mod=dojo-model]
2015-09-11 02:01:43 +03:00
^- (pair goal dojo-source)
2015-09-12 00:15:25 +03:00
[gol [0 [%ge mod(q.p [q.gol q.p.mod])]]]
2015-09-11 02:01:43 +03:00
::
2015-09-04 01:10:18 +03:00
++ dp-command-line ;~(sfix dp-command (just '\0a'))
2015-05-07 05:31:54 +03:00
++ dp-command :: ++dojo-command
%+ knee *dojo-command |. ~+
;~ pose
2015-09-11 02:01:43 +03:00
;~ plug (cold %poke bar)
%+ cook dp-specify
2015-09-12 00:15:25 +03:00
(stag [our.hid dp-default-app] dp-model)
2015-06-01 23:46:22 +03:00
==
::
2015-09-10 01:57:25 +03:00
;~ plug (cold %poke col)
2015-05-07 05:31:54 +03:00
%+ cook
2015-09-12 00:15:25 +03:00
|= [a=goal b=$&(dojo-model dojo-source)]
2015-05-07 05:31:54 +03:00
^- (pair goal dojo-source)
2015-09-12 00:15:25 +03:00
?@ -.b [a b]
(dp-specify a b)
2015-05-07 05:31:54 +03:00
;~ plug
dp-goal
2015-09-11 02:01:43 +03:00
;~ pose
2015-09-12 00:15:25 +03:00
;~(pfix bar dp-model)
;~(pfix ace dp-source)
2015-05-07 05:31:54 +03:00
==
==
==
::
2015-09-11 02:01:43 +03:00
;~(plug (cold %file tar) dp-beam ;~(pfix ace dp-source))
;~(plug (cold %flat pat) (most fas sym) ;~(pfix ace dp-source))
;~(plug (cold %pill dot) (most fas sym) ;~(pfix ace dp-source))
;~(plug (cold %http lus) (easy %post) auri:epur ;~(pfix ace dp-source))
;~(plug (cold %http hep) (easy %put) auri:epur ;~(pfix ace dp-source))
;~(plug (cold %verb tis) sym (punt ;~(pfix ace dp-source)))
=< ;~(plug (cold %verb fas) (cook . dp-poor))
|=(a=(list twig) [%dir ~ [0 %ex %clsg a]])
2015-05-07 05:31:54 +03:00
::
(stag %show dp-source)
==
++ dp-source (stag 0 dp-build) :: ++dojo-source
++ dp-build :: ++dojo-build
%+ knee *dojo-build |. ~+
;~ pose
2015-09-12 00:15:25 +03:00
;~(plug (cold %ge lus) dp-model)
;~(plug (cold %ur lus) auri:epur)
2015-09-10 01:57:25 +03:00
;~(plug (cold %fi cab) ;~((glue ace) dp-filter dp-source))
dp-value
2015-05-07 05:31:54 +03:00
==
::
2015-09-10 01:57:25 +03:00
++ dp-filter ;~(pose ;~(sfix sym cab) dp-twig) :: ++dojo-filter
2015-05-26 23:56:21 +03:00
++ dp-goal :: ++goal
2015-05-07 05:31:54 +03:00
%+ cook |=(a=goal a)
;~ pose
;~ plug
2015-09-11 02:01:43 +03:00
;~(pfix sig fed:ag)
;~(pose ;~(pfix fas sym) (easy dp-default-app))
2015-05-07 05:31:54 +03:00
==
2015-09-11 02:01:43 +03:00
%+ stag our.hid
;~(pose sym (easy dp-default-app))
2015-05-07 05:31:54 +03:00
==
2015-09-04 02:17:34 +03:00
++ dp-beam :: ++beam
%+ sear tome
=+ vez=(vang & dp-path)
(sear plex:vez (stag %clsg poor:vez))
::
2015-09-12 00:15:25 +03:00
++ dp-model ;~(plug dp-server dp-config) :: ++dojo-model
++ dp-path (tope he-beam) :: ++path
++ dp-server (stag 0 (most fas sym)) :: ++dojo-server
++ dp-twig tall:(vang & dp-path) :: ++twig
++ dp-poor poor:(vang & (tope dir)) :: (list ++twig)
2015-05-07 05:31:54 +03:00
++ dp-value :: ++dojo-source
;~ pose
2015-09-10 01:57:25 +03:00
(stag %tu (ifix [kel ker] (most ace dp-source)))
2015-05-07 05:31:54 +03:00
(stag %ex dp-twig)
==
::
++ dp-config :: ++dojo-config
;~ plug
2015-09-10 01:57:25 +03:00
(star ;~(pfix ace (stag 0 dp-value)))
2015-05-07 05:31:54 +03:00
%+ cook
~(gas by *(map term (unit dojo-source)))
2015-09-04 02:17:34 +03:00
%- star
2015-05-07 05:31:54 +03:00
;~ plug
2015-09-04 02:17:34 +03:00
;~(pfix com ace tis sym)
2015-09-10 01:57:25 +03:00
(punt ;~(pfix ace (stag 0 dp-value)))
2015-05-07 05:31:54 +03:00
==
==
--
::
++ dy :: project work
|_ dojo-project ::
++ dy-abet +>(poy `+<) :: resolve
++ dy-amok +>(poy ~) :: terminate
++ dy-ford :: send work to ford
|= [way=wire kas=silk]
^+ +>+>
?> ?=(~ pux)
2015-09-04 04:29:34 +03:00
(he-card(poy `+>+<(pux `way)) %exec way our.hid `[he-beak kas])
2015-05-07 05:31:54 +03:00
::
2015-09-09 02:58:48 +03:00
++ dy-eyre :: send work to eyre
2015-09-11 02:01:43 +03:00
|= [way=wire req=hiss]
2015-09-09 02:58:48 +03:00
^+ +>+>
?> ?=(~ pux)
2015-09-11 02:01:43 +03:00
(he-card(poy `+>+<(pux `way)) %hiss way %httr %hiss req)
2015-09-09 02:58:48 +03:00
::
2015-05-07 05:31:54 +03:00
++ dy-stop :: stop work
^+ +>
?~ pux +>
2015-07-10 21:49:03 +03:00
(he-card(poy ~) %exec u.pux our.hid ~)
2015-05-07 05:31:54 +03:00
::
++ dy-slam :: call by ford
|= [way=wire gat=vase sam=vase]
^+ +>+>
(dy-ford way %call [%$ %noun gat] [%$ %noun sam])
2015-05-07 05:31:54 +03:00
::
++ dy-diff :: send effects, abet
|= fec=sole-effect
^+ +>+>
(he-diff(poy `+>+<) fec)
::
++ dy-rash :: send effects, amok
|= fec=sole-effect
^+ +>+>
(he-diff(poy ~) fec)
::
++ dy-init-command :: ++dojo-command
|= mad=dojo-command
^+ [mad +>]
?- -.mad
2015-09-11 02:01:43 +03:00
%file =^(src +>.$ (dy-init-source q.mad) [mad(q src) +>.$])
%flat =^(src +>.$ (dy-init-source q.mad) [mad(q src) +>.$])
%pill =^(src +>.$ (dy-init-source q.mad) [mad(q src) +>.$])
%poke =^(src +>.$ (dy-init-source q.mad) [mad(q src) +>.$])
%show =^(src +>.$ (dy-init-source p.mad) [mad(p src) +>.$])
%verb =^(src +>.$ (dy-init-source-unit q.mad) [mad(q src) +>.$])
%http
=. r.mad [0 %fi %mime r.mad]
=^ src +>.$ (dy-init-source r.mad)
[mad(r src) +>.$]
2015-05-07 05:31:54 +03:00
==
::
++ dy-init-source-unit :: (unit dojo-source)
|= urc=(unit dojo-source)
^+ [urc +>]
?~ urc [~ +>]
=^ src +> (dy-init-source u.urc)
[`src +>.$]
::
++ dy-init-source :: ++dojo-source
|= src=dojo-source
^+ [src +>]
=^ bul +> (dy-init-build q.src)
=: p.src num
q.src bul
==
2015-09-10 01:57:25 +03:00
[src +>.$(num +(num), job (~(put by job) src))]
2015-05-07 05:31:54 +03:00
::
++ dy-init-build :: ++dojo-build
|= bul=dojo-build
^+ [bul +>]
?- -.bul
%ex [bul +>.$]
%dv [bul +>.$]
2015-09-10 01:57:25 +03:00
%fi =^ mor +>.$ (dy-init-source q.bul)
[bul(q mor) +>.$]
2015-05-07 05:31:54 +03:00
%ge =^(mod +>.$ (dy-init-model p.bul) [[%ge mod] +>.$])
2015-09-09 02:58:48 +03:00
%ur [bul +>.$]
2015-05-07 05:31:54 +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] +>.$]
==
::
++ 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-09-12 00:15:25 +03:00
[srv +>.$(num +(num), job (~(put by job) num [%dv [%gen q.srv]]))]
2015-05-07 05:31:54 +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)
|= ord=(list dojo-source)
^+ [ord +>]
?~ ord [~ +>.$]
=^ fir +>.$ (dy-init-source i.ord)
=^ mor +>.$ $(ord t.ord)
[[fir mor] +>.$]
::
++ dy-init-named :: (map @tas dojo-src)
|= key=(map term (unit dojo-source))
^+ [key +>.$]
?~ key [~ +>.$]
=^ top +>.$ (dy-init-source-unit q.n.key)
=^ lef +>.$ $(key l.key)
=^ rit +>.$ $(key r.key)
[[[p.n.key top] lef rit] +>.$]
::
++ dy-init :: full initialize
^+ .
=^(dam . (dy-init-command mad) +(mad dam))
::
++ dy-hand :: complete step
|= cag=cage
^+ +>+>
?> ?=(^ cud)
(dy-step(cud ~, rez (~(put by rez) p.u.cud cag)) +(p.u.cud))
::
++ dy-meal :: vase to cage
|= vax=vase
?. &(?=(@ -.q.vax) ((sane %tas) -.q.vax))
~& %dy-meal-cage
(dy-rash %bel ~)
(dy-hand -.q.vax (slot 3 vax))
::
++ dy-made-edit :: sole edit
|= cag=cage
^+ +>+>
?> ?=(^ per)
?: ?| ?=(^ q.q.cag)
=((lent buf.say) q.q.cag)
!&(?=(%del -.u.per) =(+(p.u.per) (lent buf.say)))
==
dy-abet(per ~)
2015-09-02 01:20:17 +03:00
=^ lic say (~(transmit sole say) u.per)
2015-05-07 05:31:54 +03:00
(dy-diff(per ~) %mor [%det lic] [%err q.q.cag] ~)
::
++ dy-done :: dialog submit
|= txt=tape
?. ?=(^ pro)
~& %dy-no-prompt
(dy-diff %bel ~)
2015-05-07 05:31:54 +03:00
(dy-slam /dial u.pro !>(txt))
::
2015-09-09 00:05:40 +03:00
++ dy-cast
|* [typ=_,* bun=vase]
|= a=vase ^- typ
?> (~(nest ut p.bun) & p.a)
;;(typ q.a)
::
2015-05-07 05:31:54 +03:00
++ dy-over :: finish construction
^+ +>
?- -.mad
%poke
%- he-card(poy ~)
:* %deal
/poke
[our.hid p.p.mad]
q.p.mad
%poke
(~(got by rez) p.q.mad)
==
2015-09-04 02:17:34 +03:00
::
%file
%- he-card(poy ~) :*
%info
/file
our.hid
(foal (tope p.mad) (~(got by rez) p.q.mad))
==
2015-05-07 05:31:54 +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-09-10 03:52:55 +03:00
?~ q.mad
=. var (~(del by var) p.mad)
=< dy-amok
?+ p.mad .
?(%eny %now %our) !!
%lib .(lib ~)
%arc .(arc ~)
%dir .(dir [[our.hid %home ud/0] /])
==
2015-09-10 01:57:25 +03:00
=+ cay=(~(got by rez) p.u.q.mad)
2015-09-09 00:05:40 +03:00
=. var (~(put by var) p.mad cay)
2015-09-04 04:29:34 +03:00
~| bad-set/[p.mad p.q.cay]
=< dy-amok
2015-09-09 00:05:40 +03:00
?+ p.mad .
2015-09-10 03:52:55 +03:00
%eny ~|(%entropy-is-eternal !!)
2015-09-04 04:29:34 +03:00
%now ~|(%time-is-immutable !!)
2015-09-10 03:52:55 +03:00
%our ~|(%self-is-immutable !!)
2015-09-09 00:05:40 +03:00
%lib .(lib ((dy-cast (list hoof) !>(*(list hoof))) q.cay))
%arc .(arc ((dy-cast (list hoof) !>(*(list hoof))) q.cay))
2015-09-10 03:52:55 +03:00
%dir =. dir (need (tome ((dy-cast path !>(*path)) q.cay)))
=- +(..dy (he-diff %tan - ~))
rose/[" " `~]^~[leaf/"=%" (smyt (tope he-beak s.dir))]
2015-09-04 04:29:34 +03:00
==
2015-09-11 02:01:43 +03:00
::
%http
=+ cay=(~(got by rez) p.r.mad)
?> ?=(%mime p.cay)
=+ mim=;;(mime q.q.cay)
=+ maf=(~(add ja *math) content-type/(moon p.mim))
(dy-eyre /show [q.mad p.mad maf ~ q.mim])
2015-05-07 05:31:54 +03:00
::
%show
2015-09-11 02:01:43 +03:00
(dy-show (~(got by rez) p.p.mad))
==
::
++ dy-show
|= cay=cage
%+ dy-rash %tan
?+ p.cay [(sell q.cay)]~
%tang ;;(tang q.q.cay)
%httr
=+ hit=;;(httr q.q.cay)
=- (flop (turn `wall`- |=(a=tape leaf/(dash:ut a ''))))
:- "HTTP {<p.hit>}"
%+ weld
(turn q.hit |=([a=@t b=@t] "{(trip a)}: {(trip b)}"))
(turn `wain`?~(r.hit ~ (lore q.u.r.hit)) trip)
2015-05-07 05:31:54 +03:00
==
::
++ dy-edit :: handle edit
|= cal=sole-change
^+ +>+>
2015-09-02 01:20:17 +03:00
=^ dat say (~(transceive sole say) cal)
2015-05-07 05:31:54 +03:00
?: |(?=(^ per) ?=(^ pux) ?=(~ pro))
~& %dy-edit-busy
2015-09-02 01:20:17 +03:00
=^ lic say (~(transmit sole say) dat)
2015-05-07 05:31:54 +03:00
(dy-diff %mor [%det lic] [%bel ~] ~)
(dy-slam(per `dat) /edit u.pro !>((tufa buf.say)))
::
++ dy-type :: sole action
|= act=sole-action
?- -.act
%det (dy-edit +.act)
%ret (dy-done (tufa buf.say))
==
::
++ dy-cage |=(num=@ud (~(got by rez) num)) :: known cage
++ dy-vase |=(num=@ud q:(dy-cage num)) :: known vase
2015-09-12 00:15:25 +03:00
++ dy-silk-vase |=(vax=vase [%$ %noun vax]) :: vase to silk
++ dy-silk-sources :: sources to silk
|= src=(list dojo-source) ^- silk
%- dy-silk-vase
|-
?~ src !>(~)
(slop (dy-vase p.i.src) $(src t.src))
2015-05-07 05:31:54 +03:00
::
2015-09-12 00:15:25 +03:00
++ dy-silk-config :: configure
|= [cay=cage cig=dojo-config]
^- [wire silk]
:- ?+ -.q.q.cay ~|(%bad-gen ~_((sell (slot 2 q.cay)) !!))
%cat /gent
%dog /dial
%pig /scar
==
=+ gat=(slot 3 q.cay)
:+ %call (dy-silk-vase gat)
:+ (dy-silk-vase !>([now=now.hid eny=eny.hid bec=he-beak]))
(dy-silk-sources p.cig)
:+ %mute (dy-silk-vase (slot 27 gat))
%+ turn (~(tap by q.cig))
|= [a=term b=(unit dojo-source)]
^- (pair wing silk)
:- [a ~]
%- dy-silk-vase
?~(b !>([~ ~]) (dy-vase p.u.b))
2015-05-07 05:31:54 +03:00
::
2015-05-11 22:09:41 +03:00
++ dy-twig-head :: dynamic state
2015-09-04 04:29:34 +03:00
^- cage
:- %noun
2015-09-10 02:53:06 +03:00
=+ sloop=|=([a=vase b=vase] ?:(=(*vase a) b ?:(=(*vase b) a (slop a b))))
2015-09-10 01:57:25 +03:00
%+ sloop
%- ~(rep by var)
|= [[a=term @ b=vase] c=vase] ^- vase
2015-09-10 02:53:06 +03:00
(sloop b(p face/[a p.b]) c)
2015-09-12 00:15:25 +03:00
!>([our=our now=now eny=eny]:hid)
2015-05-11 22:09:41 +03:00
::
2015-05-07 05:31:54 +03:00
++ dy-made-dial :: dialog product
|= cag=cage
^+ +>+>
?. ?=(^ q.q.cag)
(dy-diff %err q.q.cag)
=+ tan=((list tank) +2.q.q.cag)
=. +>+>.$ (he-diff %tan tan)
=+ vax=(spec (slot 3 q.cag))
?+ -.q.vax !!
%&
?~ +.q.vax
~& %dy-made-dial-abort
(dy-rash %bel ~)
(dy-meal (slot 7 vax))
::
%|
=< he-pone
%- dy-diff(pro `(slap (slot 7 vax) [%cnzy %q]))
=+ pom=(sole-prompt +<.q.vax)
[%pro pom(cad [':' ' ' cad.pom])]
==
::
++ dy-made-gent :: generator product
|= cag=cage
(dy-meal q.cag)
::
++ dy-make :: build step
^+ +>
?> ?=(^ cud)
2015-09-10 01:57:25 +03:00
=+ bil=q.u.cud :: XX =*
?: ?=(%ur -.bil)
2015-09-11 02:01:43 +03:00
(dy-eyre /hand [p.bil %get ~ ~])
2015-05-07 05:31:54 +03:00
%- dy-ford
^- (pair path silk)
2015-09-12 00:15:25 +03:00
?- -.bil
%ge (dy-silk-config (dy-cage p.p.p.bil) q.p.bil)
2015-09-10 01:57:25 +03:00
%dv [/hand [%core he-beak (flop p.bil)]]
%ex [/hand (dy-mare p.bil)]
%fi =+ dat=[%$ (dy-cage p.q.bil)]
[/hand ?@(p.bil [%cast p.bil dat] [%call (dy-mare p.bil) dat])]
2015-05-07 05:31:54 +03:00
%tu :- /hand
:- %$
2015-05-07 05:31:54 +03:00
:- %noun
|- ^- vase
2015-09-10 01:57:25 +03:00
?~ p.bil !!
=+ hed=(dy-vase p.i.p.bil)
?~ t.p.bil hed
(slop hed $(p.bil t.p.bil))
2015-05-07 05:31:54 +03:00
==
::
2015-09-09 00:05:40 +03:00
++ dy-twig-mark :: XX architect
=+ ^= ope
|= gen=twig ^- twig
?: ?=(?(%sggl %sggr) -.gen)
$(gen q.gen)
=+ ~(open ap gen)
?.(=(gen -) $(gen -) gen)
|= gen=twig ^- (unit mark)
=. gen (ope gen)
2015-09-10 01:57:25 +03:00
?: ?=([%cnts [@ ~] ~] gen)
(bind (~(get by var) i.p.gen) head)
2015-09-09 00:05:40 +03:00
?. ?=(%dtkt -.gen) ~
=. p.gen (ope p.gen)
?@ -.p.gen ~
?+ ~(feck ap p.p.gen) ~
[~ %cx]
=+ gin=(ope q.p.gen)
|-
?@ -.gin ~
=. q.gin (ope q.gin)
?^ -.q.gin $(gin q.gin)
=. p.gin (ope p.gin)
?. ?=([[?(%dtzz %dtzy) @ @] [%dtzz %n ~]] gin)
~
(some q.p.gin)
==
::
2015-06-02 21:36:56 +03:00
++ dy-mare :: build expression
|= gen=twig
^- silk
2015-09-09 00:05:40 +03:00
:+ %cast (fall (dy-twig-mark gen) %noun)
2015-09-04 04:29:34 +03:00
:+ %ride gen
:- [%$ dy-twig-head]
2015-09-10 03:52:55 +03:00
[%plan he-beam / zuse arc lib ~ ~]
2015-06-02 21:36:56 +03:00
::
2015-05-07 05:31:54 +03:00
++ dy-step :: advance project
|= nex=@ud
^+ +>+>
?> ?=(~ cud)
?: =(nex num)
dy-over
dy-make(cud `[nex (~(got by job) nex)])
--
::
++ he-dope :: sole user of ++dp
|= txt=tape ::
2015-09-04 01:10:18 +03:00
^- (each (unit (each dojo-command tape)) hair) :: prefix/result
=+ len=+((lent txt)) :: line length
=. txt :(weld buf txt "\0a") ::
=+ vex=((full dp-command-line):dp [1 1] txt) ::
?: =(q.p.vex len) :: matched until line end
[%& ~] ::
?: =(p.p.vex +((lent (skim txt |=(a=@ =(10 a)))))) :: parsed all lines
[%& ~ ?~(q.vex [%| txt] `p.u.q.vex)] :: new buffer/complete
[%| p.p.vex (dec q.p.vex)] :: syntax error
2015-05-07 05:31:54 +03:00
::
++ he-duke :: ++he-dope variant
|= txt=tape
2015-09-04 01:10:18 +03:00
^- (each (unit (each dojo-command tape)) ,@ud)
2015-05-07 05:31:54 +03:00
=+ foy=(he-dope txt)
?- -.foy
%| [%| q.p.foy]
2015-09-04 01:10:18 +03:00
%& [%& p.foy]
2015-05-07 05:31:54 +03:00
==
::
++ he-abet :: resolve
[(flop moz) %_(+> hoc (~(put by hoc) ost +<+))]
::
2015-09-10 03:52:55 +03:00
++ he-beak -:he-beam
++ he-beam :: logical beam
^- beam
?. =(ud/0 r.dir) dir
dir(r [%da now.hid])
2015-05-07 05:31:54 +03:00
::
++ he-card :: emit gift
|= cad=card
^+ +>
%_(+> moz [[ost cad] moz])
::
++ he-send
|= [way=wire him=ship dap=term cop=clap]
^+ +>
(he-card %send way [him dap] cop)
::
++ he-diff :: emit update
|= fec=sole-effect
2015-05-07 05:31:54 +03:00
^+ +>
(he-card %diff %sole-effect fec)
::
++ he-stop :: abort work
^+ .
?~(poy . ~(dy-stop dy u.poy))
::
++ he-peer :: subscribe to
2015-09-10 03:52:55 +03:00
|=(pax=path ?>(=(~ pax) he-prom))
2015-05-07 05:31:54 +03:00
::
++ he-pine :: restore prompt
^+ .
?^ poy .
he-prom:he-pone
::
++ he-pone :: clear prompt
^+ .
2015-09-02 01:20:17 +03:00
=^ cal say (~(transmit sole say) [%set ~])
2015-05-07 05:31:54 +03:00
(he-diff %mor [%det cal] ~)
::
++ he-prom :: send prompt
%- he-diff
:- %pro
2015-09-10 03:52:55 +03:00
[& %$ ?~(buf "> " "< ")]
2015-05-07 05:31:54 +03:00
::
++ he-made :: result from ford
2015-05-26 23:56:21 +03:00
|= [way=wire dep=@uvH reg=gage]
2015-05-07 05:31:54 +03:00
^+ +>
?> ?=(^ poy)
=< he-pine
2015-05-08 22:43:11 +03:00
?- -.reg
2015-05-26 23:56:21 +03:00
%& %. p.reg
2015-05-07 05:31:54 +03:00
=+ dye=~(. dy u.poy(pux ~))
?+ way !!
[%hand ~] dy-hand:dye
[%dial ~] dy-made-dial:dye
[%gent ~] dy-made-gent:dye
[%edit ~] dy-made-edit:dye
==
2015-05-14 02:31:13 +03:00
%| (he-diff(poy ~) %tan p.reg)
2015-05-26 23:56:21 +03:00
%tabl !!
2015-05-07 05:31:54 +03:00
==
::
2015-09-11 02:01:43 +03:00
++ he-sigh :: result from eyre
2015-09-09 23:59:28 +03:00
|= [way=wire hit=httr]
2015-09-09 02:58:48 +03:00
^+ +>
?> ?=(^ poy)
2015-09-11 02:01:43 +03:00
=< he-pine
%. [%httr !>(hit)]
=+ dye=~(. dy u.poy(pux ~))
?+ way !!
[%hand ~] dy-hand:dye
[%show ~] dy-show:dye
==
2015-09-09 02:58:48 +03:00
::
2015-05-07 05:31:54 +03:00
++ he-unto :: result from behn
2015-09-09 23:59:28 +03:00
|= [way=wire cit=cuft]
2015-05-07 05:31:54 +03:00
^+ +>
?. ?=(%coup -.cit)
~& [%strange-unto cit]
+>
2015-05-07 05:31:54 +03:00
?~ p.cit
(he-diff %txt ">=")
(he-diff %tan u.p.cit)
::
++ he-like :: accept line
|= buf=(list ,@c)
=(%& -:(he-dope (tufa buf)))
::
++ he-stir :: apply change
|= cal=sole-change
^+ +>
:: ~& [%his-clock ler.cal]
:: ~& [%our-clock ven.say]
2015-09-02 01:20:17 +03:00
=^ dat say (~(transceive sole say) cal)
2015-05-07 05:31:54 +03:00
?. ?& ?=(%del -.dat)
=(+(p.dat) (lent buf.say))
==
+>.$
=+ foy=(he-dope (tufa buf.say))
?: ?=(%& -.foy) +>.$
:: ~& [%bad-change dat ted.cal]
2015-09-02 01:20:17 +03:00
=^ lic say (~(transmit sole say) dat)
2015-05-07 05:31:54 +03:00
:: ~& [%our-leg leg.say]
(he-diff %mor [%det lic] [%err q.p.foy] ~)
::
++ he-plan :: execute command
|= mad=dojo-command
^+ +>
?> ?=(~ poy)
2015-09-04 01:10:18 +03:00
he-pine:(dy-step:~(dy-init dy %*(. *dojo-project mad mad)) 0)
2015-05-07 05:31:54 +03:00
::
++ he-done :: parse command
|= txt=tape
^+ +>
?~ txt
2015-09-10 03:52:55 +03:00
=< he-prom(buf ~)
2015-05-07 05:31:54 +03:00
%- he-diff
:~ %mor
[%txt "> "]
[%nex ~]
==
=+ doy=(he-duke txt)
?- -.doy
%| (he-diff [%err p.doy])
%&
2015-09-04 01:10:18 +03:00
?~ p.doy
(he-diff [%err (lent txt)])
2015-09-04 04:40:30 +03:00
=+ old=(weld ?~(buf "> " " ") (tufa buf.say))
2015-09-02 01:20:17 +03:00
=^ cal say (~(transmit sole say) [%set ~])
2015-09-04 01:10:18 +03:00
=. +>.$ (he-diff %mor txt/old nex/~ det/cal ~)
?- -.u.p.doy
%& (he-plan(buf ~) p.u.p.doy)
2015-09-10 03:52:55 +03:00
%| he-prom(buf p.u.p.doy)
2015-05-07 05:31:54 +03:00
==
==
::
++ he-type :: apply input
|= act=sole-action
^+ +>
?^ poy
he-pine:(~(dy-type dy u.poy) act)
?- -.act
%det (he-stir +.act)
%ret (he-done (tufa buf.say))
==
::
++ he-lame :: handle error
|= [wut=term why=tang]
^+ +>
%- (slog (flop `tang`[>%dojo-lame wut< why]))
?^ poy
he-pine:~(dy-amok dy u.poy)
he-pine :: XX give mean to original keystroke
2015-05-07 05:31:54 +03:00
--
::
2015-09-04 01:10:18 +03:00
++ prep
2015-09-12 00:15:25 +03:00
=+ session-1==+(*session ,_-(poy *(unit)))
=+ session-0==+(*session-1 ,[_say syd=desk * _|2.-])
2015-09-10 01:57:25 +03:00
:: ,_`..prep
2015-09-12 00:15:25 +03:00
=+ hoze=$%([%0 p=(map bone session-0)] [%1 p=(map bone session-1)])
|= old=(unit ?(house hoze)) ^+ [~ ..prep]
2015-09-04 01:10:18 +03:00
?~ old `..prep
2015-09-12 00:15:25 +03:00
?- -.u.old
%2 `..prep(+<+ u.old)
%1 `..prep(+<+ [%2 (~(run by p.u.old) |=(session-0 +<(poy ~)))])
%0 =< ^$(u.old [%1 (~(run by p.u.old) .)])
|= sos=session-0 ^- session
[-.sos [[our.hid syd.sos ud/0] /] |3.sos]
==
2015-09-04 01:10:18 +03:00
::
2015-09-09 03:10:42 +03:00
:: pattern: ++ foo |=(data he-abet:(~(he-foo he (~(got by hoc) ost)) data))
++ arm (arm-session (~(got by hoc) ost.hid))
++ arm-session
|= ses=session
=> ~(. he [ost.hid ~] ses)
=- [wrap=- +]
|* he-arm=_he-type
|= _+<.he-arm ^- (quip move ..he)
he-abet:(he-arm +<)
::
++ peer-sole
2015-09-10 03:52:55 +03:00
~? !=(src.hid our.hid) [%dojo-peer-stranger ost.hid src.hid]
2015-05-28 09:51:32 +03:00
:: ?> =(src.hid our.hid)
2015-09-10 03:52:55 +03:00
~? (~(has by hoc) ost.hid) [%dojo-peer-replaced ost.hid]
=+ ses=%*(. *session -.dir [our.hid %home ud/0])
(wrap he-peer):(arm-session ses)
2015-05-07 05:31:54 +03:00
::
++ poke-sole-action
2015-09-09 03:10:42 +03:00
|= act=sole-action ~| poke/act %. act
(wrap he-type):arm
2015-05-07 05:31:54 +03:00
::
2015-09-09 03:10:42 +03:00
++ made (wrap he-made):arm
2015-09-09 23:59:28 +03:00
++ sigh-httr (wrap he-sigh):arm
2015-09-09 03:10:42 +03:00
++ sigh-tang |=([a=wire b=tang] ~|(`term`(cat 3 'sigh-' -.a) (mean b)))
++ lame (wrap he-lame):arm
++ unto (wrap he-unto):arm
2015-05-07 05:31:54 +03:00
++ pull
2015-05-28 09:51:32 +03:00
|= [pax=path]
2015-05-07 05:31:54 +03:00
^- (quip move +>)
=^ moz +>
2015-05-28 09:51:32 +03:00
he-abet:~(he-stop he [[ost.hid ~] (~(got by hoc) ost.hid)])
[moz +>.$(hoc (~(del by hoc) ost.hid))]
2015-05-07 05:31:54 +03:00
--