shrub/app/dojo.hoon

1748 lines
58 KiB
Plaintext
Raw Normal View History

:: :: ::
2016-02-11 03:41:28 +03:00
:::: /hoon/dojo/app :: ::::
2015-05-07 05:31:54 +03:00
:: :: ::
/? 309 :: arvo kelvin
2016-02-27 04:13:00 +03:00
/- sole, lens :: console structures
2015-05-07 05:31:54 +03:00
/+ sole :: console library
2017-12-16 07:13:50 +03:00
=, sole
2016-12-02 02:59:17 +03:00
=, space:userlib
=, format
2015-05-07 05:31:54 +03:00
:: :: ::
:::: :: ::::
2016-11-17 04:42:58 +03:00
:: :: ::
2015-05-07 05:31:54 +03:00
=> |% :: external structures
++ house :: all state
$: $5
2015-12-20 23:50:45 +03:00
egg/@u :: command count
hoc/(map bone session) :: conversations
2015-05-07 05:31:54 +03:00
== ::
++ session :: per conversation
2015-12-20 23:50:45 +03:00
$: say/sole-share :: command-line state
dir/beam :: active path
poy/(unit dojo-project) :: working
$: :: sur: structure imports
::
sur=(list cable:ford)
:: lib: library imports
::
lib=(list cable:ford)
==
2015-12-20 23:50:45 +03:00
var/(map term cage) :: variable state
old/(set term) :: used TLVs
buf/tape :: multiline buffer
2015-05-07 05:31:54 +03:00
== ::
2017-12-16 07:13:50 +03:00
++ monkey :: per conversation
$: say/sole-share :: command-line state
dir/beam :: active path
poy/(unit dojo-project) :: working
var/(map term cage) :: variable state
old/(set term) :: used TLVs
buf/tape :: multiline buffer
== ::
2015-05-07 05:31:54 +03:00
++ dojo-command ::
2015-12-14 10:58:14 +03:00
$^ (pair dojo-sink dojo-source) :: route value
2015-12-20 23:50:45 +03:00
{$brev p/term} :: unbind variable
2015-12-09 04:54:26 +03:00
::
2015-09-29 22:15:33 +03:00
++ dojo-sink ::
2015-12-20 23:50:45 +03:00
$% {$flat p/path} :: atom to unix
{$pill p/path} :: noun to unix pill
:: {$tree p/path} :: noun to unix tree
{$file p/beam} :: save to clay
2016-11-08 04:40:00 +03:00
$: $http :: http outbound
p/?($post $put)
q/(unit knot)
r/purl:eyre
2016-11-08 04:40:00 +03:00
==
2015-12-20 23:50:45 +03:00
{$poke p/goal} :: poke app
2017-11-17 00:50:03 +03:00
{$show p/?($0 $1 $2 $3)} :: print val+type+hoon
2015-12-20 23:50:45 +03:00
{$verb p/term} :: store variable
2017-05-22 01:43:23 +03:00
{$help p/(list term)} :: look up help
2015-05-07 05:31:54 +03:00
== ::
++ dojo-source :: construction node
2015-12-20 23:50:45 +03:00
$: p/@ud :: assembly index
q/dojo-build :: general build
2015-05-07 05:31:54 +03:00
== ::
2016-03-03 03:38:59 +03:00
++ dojo-build :: one arvo step
2018-02-12 08:17:42 +03:00
$~ [%ex *hoon]
$% {$ur p/(unit knot) q/purl:eyre} :: http GET request
2015-12-20 23:50:45 +03:00
{$ge p/dojo-model} :: generator
{$dv p/path} :: core from source
2017-11-17 00:50:03 +03:00
{$ex p/hoon} :: hoon expression
2017-10-25 23:12:14 +03:00
{$sa p/mark} :: example mark value
2015-12-20 23:50:45 +03:00
{$as p/mark q/dojo-source} :: simple transmute
2017-11-17 00:50:03 +03:00
{$do p/hoon q/dojo-source} :: gate apply
2015-12-20 23:50:45 +03:00
{$tu p/(list dojo-source)} :: tuple
2015-05-07 05:31:54 +03:00
== ::
++ dojo-model :: data construction
2015-12-20 23:50:45 +03:00
$: p/dojo-server :: core source
q/dojo-config :: configuration
2015-05-07 05:31:54 +03:00
== ::
++ dojo-server :: numbered device
2015-12-20 23:50:45 +03:00
$: p/@ud :: assembly index
q/path :: gate path
2015-05-07 05:31:54 +03:00
== ::
++ dojo-config :: configuration
2015-12-20 23:50:45 +03:00
$: p/(list dojo-source) :: by order
q/(map term (unit dojo-source)) :: by keyword
2015-05-07 05:31:54 +03:00
== ::
++ dojo-project :: construction state
2015-12-20 23:50:45 +03:00
$: 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
2015-05-07 05:31:54 +03:00
== ::
2015-12-20 23:50:45 +03:00
++ bead {p/(set beam) q/cage} :: computed result
++ goal {p/ship q/term} :: flat application
2015-05-07 05:31:54 +03:00
++ clap :: action, user
2015-12-20 23:50:45 +03:00
$% {$peer p/path} :: subscribe
{$poke p/(cask)} :: apply
2018-03-19 07:18:20 +03:00
{$pull ~} :: unsubscribe
2015-05-07 05:31:54 +03:00
== ::
++ club :: action, system
2015-12-20 23:50:45 +03:00
$% {$peer p/path} :: subscribe
{$poke p/cage} :: apply
2018-03-19 07:18:20 +03:00
{$pull ~} :: unsubscribe
2015-05-07 05:31:54 +03:00
== ::
++ card :: general card
2015-12-14 10:58:14 +03:00
$% {$diff $sole-effect sole-effect} ::
2015-12-09 04:54:26 +03:00
{$send wire {ship term} clap} ::
2016-11-08 04:40:00 +03:00
$: $hiss
wire
(unit knot)
mark
{$hiss hiss:eyre}
2016-11-08 04:40:00 +03:00
==
[%build wire @p ? schematic:ford]
[%kill wire @p]
2015-12-09 04:54:26 +03:00
{$deal wire sock term club} ::
{$info wire @p toro:clay} ::
2015-05-07 05:31:54 +03:00
== ::
++ move (pair bone card) :: user-level move
++ sign ::
$% :: %made: build result; response to %build +task
::
$: %made
:: date: formal date of the build
::
date=@da
:: result: result of the build; either complete build, or error
::
$= result
$% :: %complete: contains the result of the completed build
::
[%complete build-result=build-result:ford]
:: %incomplete: couldn't finish build; contains error message
::
[%incomplete =tang]
== ==
{$unto p/cuft:gall} ::
2015-05-07 05:31:54 +03:00
== ::
-- ::
2016-11-17 04:42:58 +03:00
:: ::
2015-05-07 05:31:54 +03:00
:::: ::
:: ::
=, gall
2017-12-16 07:13:50 +03:00
=+ foo=*monkey
2018-05-29 08:21:44 +03:00
|_ $: hid/bowl :: system state
2015-05-07 05:31:54 +03:00
house :: program state
== ::
++ he :: per session
2016-01-31 06:37:03 +03:00
|_ {moz/(list move) session} ::
2015-05-07 05:31:54 +03:00
++ dp :: dojo parser
|%
2015-09-11 02:01:43 +03:00
++ dp-default-app %hood
2015-09-29 22:15:33 +03:00
++ dp-message :: %poke
2015-12-20 23:50:45 +03:00
|= {gol/goal mod/dojo-model} ^- dojo-command
2015-09-29 22:15:33 +03:00
[[%poke gol] [0 [%ge mod(q.p [q.gol q.p.mod])]]]
2015-09-11 02:01:43 +03:00
::
2017-09-29 18:33:42 +03:00
++ dp-command-line ;~(sfix dp-command (star ace) (just '\0a'))
2015-09-29 22:15:33 +03:00
++ dp-variable :: %verb or %brev
2015-12-20 23:50:45 +03:00
|* {sym/rule src/rule}
%+ cook
|= {a/term b/(unit dojo-source)}
^- dojo-command
?~(b [%brev a] [[%verb a] u.b])
;~(plug sym (punt src))
2015-09-29 22:15:33 +03:00
::
2015-05-07 05:31:54 +03:00
++ dp-command :: ++dojo-command
2015-10-07 21:58:17 +03:00
:: =< ;~(less |-(;~(pose (jest '|*') ;~(pfix next (knee ** |.(^$))))) .)
2015-05-07 05:31:54 +03:00
%+ knee *dojo-command |. ~+
2015-09-29 22:15:33 +03:00
;~ pose
;~ pfix bar
%+ cook dp-message
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-29 22:15:33 +03:00
;~ pfix col
2015-05-07 05:31:54 +03:00
%+ cook
2015-12-20 23:50:45 +03:00
|= {a/goal b/$^(dojo-model dojo-source)}
2015-09-29 22:15:33 +03:00
?@ -.b [[%poke a] b]
(dp-message 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-11-12 23:43:41 +03:00
;~ pfix tis
;~ pose
2015-12-01 14:31:29 +03:00
(dp-variable (jest %dir) ;~(pfix ace :(stag 0 %ex dp-rood)))
(dp-variable sym ;~(pfix ace dp-source))
==
2015-11-12 23:43:41 +03:00
==
::
2018-03-14 07:36:10 +03:00
;~ pfix net
2015-09-16 02:27:19 +03:00
;~ pose
(dp-variable (cold %sur hep) ;~(pfix gap parse-cables))
(dp-variable (cold %lib lus) ;~(pfix gap parse-cables))
2015-09-16 02:27:19 +03:00
==
==
2017-05-22 01:43:23 +03:00
::
;~ pfix hax
;~ pose
;~ pfix ace
%+ cook
|= a/(list term)
2017-09-19 03:19:22 +03:00
[[%help a] 0 %ex [%cnts p=~[[%.y p=1]] q=~]]
2017-05-22 01:43:23 +03:00
(most col sym)
==
2017-09-19 03:19:22 +03:00
(easy [[%help ~] 0 %ex [%cnts p=~[[%.y p=1]] q=~]])
2017-05-22 01:43:23 +03:00
==
==
2015-05-07 05:31:54 +03:00
::
2015-09-29 22:15:33 +03:00
;~((glue ace) dp-sink dp-source)
(stag [%show %0] dp-source)
==
++ dp-sink
;~ pose
;~(plug (cold %file tar) dp-beam)
2018-03-19 06:38:01 +03:00
;~(plug (cold %flat vat) (most net sym))
2018-03-14 07:36:10 +03:00
;~(plug (cold %pill dot) (most net sym))
;~(plug (cold %http lus) (stag %post dp-iden-url))
;~(plug (cold %http hep) (stag %put dp-iden-url))
2015-12-14 10:58:14 +03:00
(stag %show (cook $?($1 $2 $3) (cook lent (stun [1 3] wut))))
2015-05-07 05:31:54 +03:00
==
2015-09-16 02:27:19 +03:00
::
++ parse-cables
%+ cook
|= cables=(list cable:ford)
:+ 0 %ex
^- hoon
::
:- %clsg
%+ turn cables
|= cable=cable:ford
^- hoon
::
:+ %clhp
?~ face.cable
[%rock %n ~]
[%clhp [%rock %n ~] [%sand %tas u.face.cable]]
[%sand %tas file-path.cable]
(most ;~(plug com gaw) parse-cable)
:: +cable: parses a +^cable, a reference to something on the filesystem
::
:: This parses:
::
:: `library` -> wraps `library` around the library `library`
:: `face=library` -> wraps `face` around the library `library`
:: `*library` -> exposes `library` directly to the subject
::
:: NOTE: This is a verbatim duplicate of Ford's cable parsing
::
++ parse-cable
%+ cook |=(a=cable:ford a)
;~ pose
(stag ~ ;~(pfix tar sym))
(cook |=([face=term tis=@ file=term] [`face file]) ;~(plug sym tis sym))
(cook |=(a=term [`a a]) sym)
2015-09-16 02:27:19 +03:00
==
::
2017-11-17 00:50:03 +03:00
++ dp-hoon-punt :: hoon of unit
2015-12-21 08:05:19 +03:00
|*(a/rule ;~(pose (stag [%bust %null] a) (easy [%bust %null])))
2015-09-16 02:27:19 +03:00
::
2017-11-17 00:50:03 +03:00
++ dp-case-hoon
|= a/coin ^- (unit hoon)
2018-03-19 07:18:20 +03:00
?. ?=({~ case} a) ~
2015-09-16 02:27:19 +03:00
%+ some
2015-12-30 00:52:51 +03:00
[%rock %tas p.p.a]
2015-12-29 22:52:22 +03:00
[%sand p.a]
2015-09-16 02:27:19 +03:00
::
2015-05-07 05:31:54 +03:00
++ dp-source (stag 0 dp-build) :: ++dojo-source
++ dp-build :: ++dojo-build
%+ knee *dojo-build |. ~+
;~ pose
2016-03-03 03:38:59 +03:00
;~(plug (cold %ur lus) dp-iden-url)
2015-09-12 03:07:50 +03:00
;~(plug (cold %ge lus) dp-model)
2018-03-14 07:36:10 +03:00
;~(plug (cold %as pad) sym ;~(pfix ace dp-source))
2017-11-17 00:50:03 +03:00
;~(plug (cold %do cab) dp-hoon ;~(pfix ace dp-source))
2015-09-10 01:57:25 +03:00
dp-value
2015-05-07 05:31:54 +03:00
==
::
2015-05-26 23:56:21 +03:00
++ dp-goal :: ++goal
2015-12-20 23:50:45 +03:00
%+ cook |=(a/goal a)
2015-05-07 05:31:54 +03:00
;~ pose
;~ plug
2015-09-11 02:01:43 +03:00
;~(pfix sig fed:ag)
2018-03-14 07:36:10 +03:00
;~(pose ;~(pfix net 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
%+ cook
|= a/path
:: hack: fixup paths that come out of the hoon parser
::
:: We currently invoke the hoon parser to read relative paths from
:: the command line, and this parser will produce leading ~ path
:: components with paths that start with a `/`.
::
:: This entire path is nuts and we shouldn't be representing paths
:: as arbitrary hoons.
::
=? a &(?=(^ a) =('' i.a))
t.a
=+((de-beam a) ?^(- u [he-beak (flop a)]))
2015-09-29 22:15:33 +03:00
=+ vez=(vang | dp-path)
2017-09-18 21:50:10 +03:00
(sear plex:vez (stag %clsg poor:vez))
2015-09-04 02:17:34 +03:00
::
2016-03-03 03:38:59 +03:00
++ dp-iden-url
2016-11-08 04:40:00 +03:00
%+ cook
|=({a/(unit knot) b/purl:eyre} [`(fall a *knot) b])
auru:de-purl:html
2016-03-03 03:38:59 +03:00
::
2015-09-12 00:15:25 +03:00
++ dp-model ;~(plug dp-server dp-config) :: ++dojo-model
2016-12-02 02:59:17 +03:00
++ dp-path (en-beam he-beam) :: ++path
2018-03-14 07:36:10 +03:00
++ dp-server (stag 0 (most net sym)) :: ++dojo-server
2017-11-17 00:50:03 +03:00
++ dp-hoon tall:(vang | dp-path) :: ++hoon
++ dp-rood :: 'dir' hoon
2016-12-02 02:59:17 +03:00
=> (vang | (en-beam dir))
;~ pose
rood
::
2017-09-18 21:50:10 +03:00
=- ;~(pfix cen (stag %clsg -)) :: XX refactor ++scat
2015-12-20 23:50:45 +03:00
%+ sear |=({a/@ud b/tyke} (posh ~ ~ a b))
;~ pose
porc
2015-12-20 23:50:45 +03:00
(cook |=(a/(list) [(lent a) ~]) (star cen))
==
==
2015-05-07 05:31:54 +03:00
++ dp-value :: ++dojo-source
;~ pose
2018-03-14 07:36:10 +03:00
(stag %sa ;~(pfix tar pad sym))
2017-11-17 00:50:03 +03:00
(stag %ex dp-hoon)
2018-03-14 07:36:10 +03:00
(stag %tu (ifix [lac rac] (most ace dp-source)))
2015-05-07 05:31:54 +03:00
==
::
++ 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
2015-10-02 23:55:34 +03:00
++ dy-amok +>(poy ~) :: terminate
2015-05-07 05:31:54 +03:00
++ dy-ford :: send work to ford
|= [way=wire schematic=schematic:ford]
2015-05-07 05:31:54 +03:00
^+ +>+>
2015-12-09 04:54:26 +03:00
?> ?=($~ pux)
:: pin all builds to :now.hid so they don't get cached forever
::
(he-card(poy `+>+<(pux `way)) %build way our.hid live=%.n schematic)
2015-05-07 05:31:54 +03:00
::
2015-09-09 02:58:48 +03:00
++ dy-eyre :: send work to eyre
|= {way/wire usr/(unit knot) req/hiss:eyre}
2015-09-09 02:58:48 +03:00
^+ +>+>
2018-03-19 07:18:20 +03:00
?> ?=(~ pux)
(he-card(poy `+>+<(pux `way)) %hiss way usr %httr %hiss req)
2015-09-09 02:58:48 +03:00
::
2015-05-07 05:31:54 +03:00
++ dy-stop :: stop work
^+ +>
2015-10-07 21:58:17 +03:00
=. poy ~
2015-05-07 05:31:54 +03:00
?~ pux +>
2015-10-02 23:55:34 +03:00
%. [%txt "! cancel {<u.pux>}"]
he-diff:(he-card [%kill u.pux our.hid])
2015-05-07 05:31:54 +03:00
::
++ dy-slam :: call by ford
2015-12-20 23:50:45 +03:00
|= {way/wire gat/vase sam/vase}
2015-05-07 05:31:54 +03:00
^+ +>+>
(dy-ford way `schematic:ford`[%call [%$ %noun gat] [%$ %noun sam]])
2015-05-07 05:31:54 +03:00
::
++ dy-errd :: reject change, abet
|= {rev/(unit sole-edit) err/@u}
^+ +>+>
(he-errd(poy `+>+<) rev err)
::
2015-05-07 05:31:54 +03:00
++ dy-diff :: send effects, abet
2015-12-20 23:50:45 +03:00
|= fec/sole-effect
2015-05-07 05:31:54 +03:00
^+ +>+>
(he-diff(poy `+>+<) fec)
::
++ dy-rash :: send effects, amok
2015-12-20 23:50:45 +03:00
|= fec/sole-effect
2015-05-07 05:31:54 +03:00
^+ +>+>
(he-diff(poy ~) fec)
::
++ dy-init-command :: ++dojo-command
2015-12-20 23:50:45 +03:00
|= mad/dojo-command
2015-05-07 05:31:54 +03:00
^+ [mad +>]
2015-09-29 22:15:33 +03:00
?@ -.mad [mad +>.$]
=. q.mad
2015-12-10 12:17:19 +03:00
?+(-.p.mad q.mad $http [0 %as %mime q.mad])
2015-09-29 22:15:33 +03:00
=^ src +>.$ (dy-init-source q.mad)
[mad(q src) +>.$]
2015-05-07 05:31:54 +03:00
::
++ dy-init-source :: ++dojo-source
2015-12-20 23:50:45 +03:00
|= src/dojo-source
2015-05-07 05:31:54 +03:00
^+ [src +>]
=^ bul +> (dy-init-build q.src)
=: p.src num
q.src bul
==
[src +>.$(num +(num), job (~(put by job) -.src +.src))]
2015-05-07 05:31:54 +03:00
::
2015-09-29 22:15:33 +03:00
++ dy-init-source-unit :: (unit dojo-source)
2015-12-20 23:50:45 +03:00
|= urc/(unit dojo-source)
2015-09-29 22:15:33 +03:00
^+ [urc +>]
?~ urc [~ +>]
=^ src +> (dy-init-source u.urc)
[`src +>.$]
::
2015-05-07 05:31:54 +03:00
++ dy-init-build :: ++dojo-build
2015-12-20 23:50:45 +03:00
|= bul/dojo-build
2015-05-07 05:31:54 +03:00
^+ [bul +>]
?- -.bul
2015-12-09 04:54:26 +03:00
$ex [bul +>.$]
$dv [bul +>.$]
2017-10-25 23:12:14 +03:00
$sa [bul +>.$]
2015-12-09 04:54:26 +03:00
$as =^(mor +>.$ (dy-init-source q.bul) [bul(q mor) +>.$])
$do =^(mor +>.$ (dy-init-source q.bul) [bul(q mor) +>.$])
$ge =^(mod +>.$ (dy-init-model p.bul) [[%ge mod] +>.$])
$ur [bul +>.$]
$tu =^ dof +>.$
2015-05-07 05:31:54 +03:00
|- ^+ [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
2015-12-20 23:50:45 +03:00
|= mol/dojo-model
2015-05-07 05:31:54 +03:00
^+ [mol +>]
=^ one +>.$ (dy-init-server p.mol)
=^ two +>.$ (dy-init-config q.mol)
[[one two] +>.$]
::
++ dy-init-server :: ++dojo-server
2015-12-20 23:50:45 +03:00
|= srv/dojo-server
2015-05-07 05:31:54 +03:00
=. 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
2015-12-20 23:50:45 +03:00
|= cig/dojo-config
2015-05-07 05:31:54 +03:00
^+ [cig +>]
=^ ord +>.$ (dy-init-ordered p.cig)
=^ key +>.$ (dy-init-named q.cig)
[[ord key] +>.$]
::
++ dy-init-ordered :: (list dojo-source)
2015-12-20 23:50:45 +03:00
|= ord/(list dojo-source)
2015-05-07 05:31:54 +03:00
^+ [ord +>]
?~ ord [~ +>.$]
=^ fir +>.$ (dy-init-source i.ord)
=^ mor +>.$ $(ord t.ord)
[[fir mor] +>.$]
::
++ dy-init-named :: (map @tas dojo-src)
2015-12-20 23:50:45 +03:00
|= key/(map term (unit dojo-source))
2015-05-07 05:31:54 +03:00
^+ [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
2015-12-20 23:50:45 +03:00
|= cag/cage
2015-05-07 05:31:54 +03:00
^+ +>+>
?> ?=(^ cud)
(dy-step(cud ~, rez (~(put by rez) p.u.cud cag)) +(p.u.cud))
::
++ dy-meal :: vase to cage
2015-12-20 23:50:45 +03:00
|= vax/vase
2015-05-07 05:31:54 +03:00
?. &(?=(@ -.q.vax) ((sane %tas) -.q.vax))
~& %dy-meal-cage
(dy-rash %bel ~)
(dy-hand -.q.vax (slot 3 vax))
::
++ dy-made-edit :: sole edit
2015-12-20 23:50:45 +03:00
|= cag/cage
2015-05-07 05:31:54 +03:00
^+ +>+>
?> ?=(^ per)
?: ?| ?=(^ q.q.cag)
=((lent buf.say) q.q.cag)
2015-12-09 04:54:26 +03:00
!&(?=($del -.u.per) =(+(p.u.per) (lent buf.say)))
2015-05-07 05:31:54 +03:00
==
dy-abet(per ~)
(dy-errd(per ~) per q.q.cag)
2015-05-07 05:31:54 +03:00
::
++ dy-done :: dialog submit
2015-12-20 23:50:45 +03:00
|= txt/tape
2018-03-19 07:18:20 +03:00
?: |(?=(^ per) ?=(^ pux) ?=(~ 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
2015-12-20 23:50:45 +03:00
|* {typ/_* bun/vase}
|= a/vase ^- typ
~| [p.bun p.a]
2015-09-09 00:05:40 +03:00
?> (~(nest ut p.bun) & p.a)
;;(typ q.a)
::
2015-05-07 05:31:54 +03:00
++ dy-over :: finish construction
^+ +>
2018-03-18 04:06:15 +03:00
:: XX needs filter
::
:: ?: ?=({$show $3} -.mad)
:: (dy-rash %tan (dy-show-source q.mad) ~) :: XX separate command
2015-12-09 04:54:26 +03:00
?: ?=($brev -.mad)
2015-09-29 22:15:33 +03:00
=. var (~(del by var) p.mad)
=< dy-amok
?+ p.mad .
2015-12-14 10:58:14 +03:00
$?($eny $now $our) !!
2015-12-09 04:54:26 +03:00
$lib .(lib ~)
2016-03-22 08:03:13 +03:00
$sur .(sur ~)
2015-12-21 00:16:39 +03:00
$dir .(dir [[our.hid %home ud+0] /])
2015-09-29 22:15:33 +03:00
==
=+ cay=(~(got by rez) p.q.mad)
?- -.p.mad
2015-12-09 04:54:26 +03:00
$verb
2015-09-29 22:15:33 +03:00
=. var (~(put by var) p.p.mad cay)
2015-12-21 00:16:39 +03:00
~| bad-set+[p.p.mad p.q.cay]
2015-09-29 22:15:33 +03:00
=< dy-amok
?+ p.p.mad .
2016-11-08 04:40:00 +03:00
$eny ~|(%entropy-is-eternal !!)
$now ~|(%time-is-immutable !!)
$our ~|(%self-is-immutable !!)
2017-05-22 01:43:23 +03:00
$lib
%_ .
lib
((dy-cast (list cable:ford) !>(*(list cable:ford))) q.cay)
==
2016-11-08 04:40:00 +03:00
::
2017-05-22 01:43:23 +03:00
$sur
%_ .
sur
((dy-cast (list cable:ford) !>(*(list cable:ford))) q.cay)
==
2016-11-08 04:40:00 +03:00
::
$dir =+ ^= pax ^- path
=+ pax=((dy-cast path !>(*path)) q.cay)
2018-03-19 07:18:20 +03:00
?: ?=(~ pax) ~[(scot %p our.hid) %home '0']
?: ?=({@ ~} pax) ~[i.pax %home '0']
?: ?=({@ @ ~} pax) ~[i.pax i.t.pax '0']
2016-11-08 04:40:00 +03:00
pax
2016-12-02 02:59:17 +03:00
=. dir (need (de-beam pax))
2016-11-08 04:40:00 +03:00
=- +>(..dy (he-diff %tan - ~))
2016-12-02 02:59:17 +03:00
rose+[" " `~]^~[leaf+"=%" (smyt (en-beam he-beak s.dir))]
2015-09-29 22:15:33 +03:00
==
::
2017-05-22 01:43:23 +03:00
$help
(dy-inspect +.p.mad p.q.cay)
::
$poke
2015-05-07 05:31:54 +03:00
%- he-card(poy ~)
:* %deal
/poke
2015-09-29 22:15:33 +03:00
[our.hid p.p.p.mad]
q.p.p.mad
2015-05-07 05:31:54 +03:00
%poke
2015-09-29 22:15:33 +03:00
cay
2015-05-07 05:31:54 +03:00
==
2015-09-04 02:17:34 +03:00
::
2015-12-09 04:54:26 +03:00
$file
2015-09-04 02:17:34 +03:00
%- he-card(poy ~) :*
%info
/file
our.hid
2016-12-02 02:59:17 +03:00
(foal (en-beam p.p.mad) cay)
2015-09-04 02:17:34 +03:00
==
2015-05-07 05:31:54 +03:00
::
2015-12-09 04:54:26 +03:00
$flat
2015-09-29 22:15:33 +03:00
?^ q.q.cay
2015-05-07 05:31:54 +03:00
(dy-rash %tan [%leaf "not an atom"]~)
2015-09-29 22:15:33 +03:00
(dy-rash %sav p.p.mad q.q.cay)
2015-05-07 05:31:54 +03:00
::
2015-12-09 04:54:26 +03:00
$pill
2015-09-29 22:15:33 +03:00
(dy-rash %sag p.p.mad q.q.cay)
2015-09-11 02:01:43 +03:00
::
2015-12-09 04:54:26 +03:00
$http
?> ?=($mime p.cay)
=+ mim=;;(mime q.q.cay)
=+ maf=(~(add ja *math:eyre) %content-type (en-mite:mimes:html p.mim))
2016-03-03 03:38:59 +03:00
(dy-eyre /show q.p.mad [r.p.mad p.p.mad maf ~ q.mim])
2015-05-07 05:31:54 +03:00
::
2015-12-09 04:54:26 +03:00
$show
2015-09-29 22:15:33 +03:00
%+ dy-print cay
2015-12-08 02:07:27 +03:00
=+ mar=|.(?:(=(%noun p.cay) ~ [%rose [~ " " ~] >p.cay< ~]~))
2015-09-29 22:15:33 +03:00
?- p.p.mad
2015-12-09 04:54:26 +03:00
$0 ~
$1 [[%rose [~ " " ~] (skol p.q.cay) ~] (mar)]
2017-11-16 23:44:27 +03:00
$2 [[%rose [~ " " ~] (dy-show-type-noun p.q.cay) ~] (mar)]
2018-03-18 04:06:15 +03:00
$3 ~
2015-09-29 22:15:33 +03:00
==
2015-09-11 02:01:43 +03:00
==
::
2015-12-20 23:50:45 +03:00
++ dy-show |=(cay/cage (dy-print cay ~))
2015-09-29 22:15:33 +03:00
++ dy-print
2015-12-20 23:50:45 +03:00
|= {cay/cage tan/tang}
2015-09-11 02:01:43 +03:00
%+ dy-rash %tan
2015-09-29 22:15:33 +03:00
%- welp :_ tan
2015-09-11 02:01:43 +03:00
?+ p.cay [(sell q.cay)]~
2015-12-09 04:54:26 +03:00
$tang ;;(tang q.q.cay)
$httr
=+ hit=;;(httr:eyre q.q.cay)
=- (flop (turn `wall`- |=(a/tape leaf+(dash:us a '' ~))))
2015-09-11 02:01:43 +03:00
:- "HTTP {<p.hit>}"
%+ weld
2015-12-20 23:50:45 +03:00
(turn q.hit |=({a/@t b/@t} "{(trip a)}: {(trip b)}"))
2016-03-03 03:38:59 +03:00
:- i=""
t=(turn `wain`?~(r.hit ~ (to-wain:format q.u.r.hit)) trip)
2015-05-07 05:31:54 +03:00
==
::
2017-05-22 01:43:23 +03:00
++ dy-inspect
2017-11-16 23:44:27 +03:00
|= {topic/(list term) sut/type}
2017-05-22 01:43:23 +03:00
%+ dy-rash %tan
|^ ^- tang
2017-11-16 23:44:27 +03:00
=+ to-display=(find-item-in-type (flop topic) sut)
2017-05-22 01:43:23 +03:00
?~ to-display
[%leaf "Could not find help"]~
(flop (print-item u.to-display))
2018-05-25 01:39:56 +03:00
:: # %models
2018-05-29 09:42:16 +03:00
+| %models
2017-05-22 01:43:23 +03:00
::
2018-05-25 01:39:56 +03:00
:: an overview of all named things in the type.
2017-05-22 01:43:23 +03:00
::
2018-05-25 01:39:56 +03:00
:: each item in the overview list is either a documentation for a sublist
:: or an association between a term and documentation for it.
2017-05-22 01:43:23 +03:00
++ overview (list overview-item)
::
2018-05-25 01:39:56 +03:00
:: in instance in the ++overview list.
2017-05-22 01:43:23 +03:00
++ overview-item
2018-05-25 01:39:56 +03:00
$% :: a header {doc} which will indent its {children}.
2017-05-22 01:43:23 +03:00
{$header doc/what children/overview}
2018-05-25 01:39:56 +03:00
:: an item in a list with {name} and {docs}.
2017-05-22 01:43:23 +03:00
{$item name/tape doc/what}
==
::
2018-05-25 01:39:56 +03:00
:: the part of a {type} being inspected.
2017-05-22 01:43:23 +03:00
++ item
2018-02-25 06:37:00 +03:00
$~ [%view ~]
2018-05-25 01:39:56 +03:00
$% :: overview of type
2017-05-22 01:43:23 +03:00
{$view items/overview}
2018-05-25 01:39:56 +03:00
:: inspecting a full core.
2017-05-22 01:43:23 +03:00
$: $core
name/tape
docs/what
2017-11-16 23:44:27 +03:00
sut/type
2017-05-22 01:43:23 +03:00
con/coil
children/(unit item)
==
2018-05-25 01:39:56 +03:00
:: inspecting a single arm on a core.
2017-05-22 01:43:23 +03:00
$: $arm
name/tape
docs/what
2017-05-25 07:32:50 +03:00
f/foot
2017-11-16 23:44:27 +03:00
sut/type
2017-05-22 01:43:23 +03:00
==
2018-05-25 01:39:56 +03:00
:: inspecting a single chapter on a core.
2017-05-22 01:43:23 +03:00
$: $chapter
name/tape
docs/what
2017-11-16 23:44:27 +03:00
sut/type
2017-05-22 01:43:23 +03:00
con/coil
chapter-id/@
==
2018-05-25 01:39:56 +03:00
:: inspecting a face and what's behind it.
2017-05-22 01:43:23 +03:00
$: $face
name/tape
docs/what
children/(unit item)
==
==
2018-05-25 01:39:56 +03:00
:: #
:: # %searching
:: #
:: functions which find what to print
2018-05-29 09:42:16 +03:00
+| %searching
2018-05-25 01:39:56 +03:00
:: returns the item to print while searching through {topic}.
::
:: this gate is called recursively to find the path {topic} in the type
:: {sut}. once it finds the correct part of the type, it switches to
:: ++build-inspectable-recursively to describe that part of the type.
2017-11-16 23:44:27 +03:00
++ find-item-in-type
|= {topics/(list term) sut/type}
2017-05-22 01:43:23 +03:00
^- (unit item)
2018-05-17 00:51:20 +03:00
~
:: ?~ topics
:: :: we have no more search path. return the rest as an overview
:: (build-inspectable-recursively sut)
:: ?- sut
:: {$atom *} ~
:: ::
:: {$cell *}
:: =+ lhs=$(sut p.sut)
:: ?~ lhs
:: $(sut q.sut)
:: lhs
:: ::
:: {$core *}
:: =+ core-docs=r.q.sut
:: ?~ p.core-docs
:: :: todo: this core has no toplevel documentation. it might have
:: :: an arm though. check that next.
:: $(sut p.sut)
:: ?: !=(i.topics u.p.core-docs)
:: :: the current topic isn't the toplevel core topic.
:: =+ arm=(find-arm-in-coil i.topics q.sut)
:: ?~ arm
:: :: the current topic is neither the name of the core or an arm
:: :: on the core.
:: $(sut p.sut)
:: `[%arm (trip i.topics) p.u.arm q.u.arm p.sut]
:: ?~ t.topics
:: :: we matched the core name and have no further search terms.
:: =* compiled-against (build-inspectable-recursively p.sut)
:: `[%core (trip i.topics) q.core-docs p.sut q.sut compiled-against]
:: :: search the core for chapters.
:: =/ tombs/(list (pair @ tomb)) ~(tap by q.s.q.sut)
:: |-
:: ^- (unit item)
:: ?~ tombs
:: ~
:: ?~ p.p.q.i.tombs
:: :: this has no chapter name.
:: $(tombs t.tombs)
:: ?: !=(i.t.topics u.p.p.q.i.tombs)
:: :: this isn't the topic.
:: $(tombs t.tombs)
:: `[%chapter (trip i.t.topics) q.p.q.i.tombs sut q.sut p.i.tombs]
:: ::
:: {$face *}
:: ?. ?=(term q.p.sut)
:: :: todo: is there something we could do if we have a tune?
:: ~
:: ?. =(i.topics q.p.sut)
:: :: this face has a name, but it's not the name we're looking for.
:: ~
:: ?~ t.topics
:: `[%face (trip q.p.sut) p.p.sut (build-inspectable-recursively q.sut)]
:: (find-item-in-type t.topics q.sut)
:: ::
:: {$fork *}
:: =/ types/(list type) ~(tap in p.sut)
:: |-
:: ?~ types
:: ~
:: =+ res=(find-item-in-type topics i.types)
:: ?~ res
:: $(types t.types)
:: res
:: ::
:: :: {$help *}
:: :: while we found a raw help, it's associated on the wrong side of a
:: :: set of topics. Walk through it instead of showing it.
:: :: (find-item-in-type t.topics q.sut)
:: ::
:: {$hint *}
:: $(sut q.sut)
:: ::
:: {$hold *} $(sut (~(play ut p.sut) q.sut))
:: $noun ~
:: $void ~
:: ==
2017-05-22 01:43:23 +03:00
::
2018-05-25 01:39:56 +03:00
:: changes a {type} into an {item}.
2017-05-22 01:43:23 +03:00
++ build-inspectable-recursively
2017-11-16 23:44:27 +03:00
|= sut/type
2017-05-22 01:43:23 +03:00
^- (unit item)
2018-05-17 00:51:20 +03:00
~
:: ?- sut
:: ::
:: {$atom *} ~
:: ::
:: {$cell *}
:: %+ join-items
:: (build-inspectable-recursively p.sut)
:: (build-inspectable-recursively q.sut)
:: ::
:: {$core *}
:: =* name (fall p.r.q.sut '')
:: =* compiled-against (build-inspectable-recursively p.sut)
:: `[%core (trip name) q.r.q.sut p.sut q.sut compiled-against]
:: ::
:: {$face *}
:: ?. ?=(term q.p.sut)
:: :: todo: can we do anything here if this face doesn't have a term?
:: ~
:: =* compiled-against (build-inspectable-recursively q.sut)
:: `[%face (trip q.p.sut) p.p.sut compiled-against]
:: ::
:: {$fork *}
:: =* types ~(tap in p.sut)
:: =* items (turn types build-inspectable-recursively)
:: (roll items join-items)
:: ::
:: :: {$help *}
:: :: =* rest-type (build-inspectable-recursively q.sut)
:: :: ?> ?=($docs -.p.sut)
:: :: `[%view [%header `+.p.sut (item-as-overview rest-type)]~]
:: ::
:: {$hint *} $(sut q.sut)
:: {$hold *} $(sut (~(play ut p.sut) q.sut))
:: $noun ~
:: $void ~
:: ==
2017-05-22 01:43:23 +03:00
::
2018-05-25 01:39:56 +03:00
:: combines two {(unit item)} together
2017-05-22 01:43:23 +03:00
++ join-items
|= {lhs/(unit item) rhs/(unit item)}
^- (unit item)
?~ lhs rhs
?~ rhs lhs
`[%view (weld (item-as-overview lhs) (item-as-overview rhs))]
::
2018-05-25 01:39:56 +03:00
:: changes an item into an overview.
2017-05-22 01:43:23 +03:00
++ item-as-overview
|= uit/(unit item)
^- overview
?~ uit ~
=+ itm=u.uit
?- itm
::
{$view *}
items.itm
::
{$core *}
?~ name.itm
(item-as-overview children.itm)
:- [%item name.itm docs.itm]
(item-as-overview children.itm)
::
{$arm *}
[%item name.itm docs.itm]~
::
{$chapter *}
[%item name.itm docs.itm]~
::
{$face *}
?~ name.itm
~
[%item name.itm docs.itm]~
==
::
2018-05-25 01:39:56 +03:00
:: translate the internals of a core's {tomb} into an {overview}.
2017-05-22 01:43:23 +03:00
++ arms-as-overview
2017-11-16 23:44:27 +03:00
|= {a/(map term (pair what foot)) sut/type}
2017-05-22 01:43:23 +03:00
^- overview
%+ turn ~(tap by a)
2017-05-22 01:43:23 +03:00
|= (pair term (pair what foot))
=* doc (select-arm-docs p.q q.q sut)
[%item (weld "++" (trip p)) -.doc]
2017-05-22 01:43:23 +03:00
::
2018-05-25 01:39:56 +03:00
:: if {arm-name} is an arm in {c}, returns its documentation.
2017-05-22 01:43:23 +03:00
++ find-arm-in-coil
|= {arm-name/term con/coil}
2017-05-25 07:32:50 +03:00
^- (unit (pair what foot))
2018-05-17 00:51:20 +03:00
~
:: =/ tombs ~(tap by q.s.con)
:: |-
:: ?~ tombs
:: ~
:: =+ item=(~(get by q.q.i.tombs) arm-name)
:: ?~ item
:: $(tombs t.tombs)
:: [~ u.item]
2017-05-22 01:43:23 +03:00
::
2018-05-25 01:39:56 +03:00
:: returns an overview for a core's arms and chapters.
2017-05-22 01:43:23 +03:00
::
2018-05-25 01:39:56 +03:00
:: returns an overview for arms which are part of unnamed chapters,
:: and an overview of the named chapters.
2017-05-22 01:43:23 +03:00
++ arm-and-chapter-overviews
2017-11-16 23:44:27 +03:00
|= {sut/type con/coil core-name/tape}
2017-05-22 01:43:23 +03:00
^- {overview overview}
2018-05-17 00:51:20 +03:00
[*overview *overview]
2018-05-25 01:39:56 +03:00
:: =| arm-docs/overview :: documented arms
:: =| chapter-docs/overview :: documented chapters
2018-05-17 00:51:20 +03:00
:: =/ tombs ~(tap by q.s.con)
:: |-
:: ?~ tombs
:: [(sort-overview arm-docs) (sort-overview chapter-docs)]
:: =* current q.i.tombs
:: ?~ p.p.current
:: :: this chapter has no name. add all the foot documentation
:: :: to arm-docs.
:: =. arm-docs (weld arm-docs (arms-as-overview q.current sut))
:: $(tombs t.tombs)
:: :: this chapter has a name. add it to the list of chapters
:: =. chapter-docs
:: %+ weld chapter-docs
:: ^- overview
:: [%item :(weld (trip u.p.p.current) ":" core-name) q.p.current]~
:: $(tombs t.tombs)
:: ::
2018-05-25 01:39:56 +03:00
:: :: returns an overview of the arms in a spedific chapter.
2017-05-22 01:43:23 +03:00
++ arms-in-chapter
2017-11-16 23:44:27 +03:00
|= {sut/type con/coil chapter-id/@}
2017-05-22 01:43:23 +03:00
^- overview
2018-05-17 00:51:20 +03:00
*overview
:: =* chapter-tomb (~(got by q.s.con) chapter-id)
:: (sort-overview (arms-as-overview q.chapter-tomb sut))
2017-05-22 01:43:23 +03:00
::
2018-05-25 01:39:56 +03:00
:: sort the items.
2017-05-22 01:43:23 +03:00
++ sort-overview
2017-12-16 07:13:50 +03:00
|: ovr=$:overview
2017-05-22 01:43:23 +03:00
^- overview
%+ sort ovr
2017-12-16 07:13:50 +03:00
|: $:{lhs/overview-item rhs/overview-item}
2017-05-22 01:43:23 +03:00
(aor (get-overview-name lhs) (get-overview-name rhs))
::
++ get-overview-name
2017-12-16 07:13:50 +03:00
|: ovr=$:overview-item
2017-05-22 01:43:23 +03:00
?- ovr
{$header *} ""
{$item *} name.ovr
==
::
2017-11-16 23:44:27 +03:00
++ what-from-type
|= sut/type
?+ sut ~
{$core *} q.r.q.sut
2018-03-29 21:21:04 +03:00
:: {$help *} ?>(?=($docs -.p.sut) `+.p.sut)
2018-04-25 09:07:21 +03:00
{$hint *} $(sut q.sut)
{$hold *} $(sut (~(play ut p.sut) q.sut))
==
::
2018-05-25 01:39:56 +03:00
:: #
:: # %printing
:: #
:: functions which display output of various types.
2018-05-29 09:42:16 +03:00
+| %printing
2017-05-22 01:43:23 +03:00
++ print-item
2017-12-16 07:13:50 +03:00
|: itm=$:item
2017-05-22 01:43:23 +03:00
^- tang
?- itm
{$view *} (print-overview items.itm)
{$core *} (print-core +.itm)
{$arm *} (print-arm +.itm)
{$chapter *} (print-chapter +.itm)
{$face *} (print-face +.itm)
==
::
2018-05-25 01:39:56 +03:00
:: renders the documentation for a full core.
2017-05-22 01:43:23 +03:00
++ print-core
2017-12-16 07:13:50 +03:00
|: $:{core-name/tape docs/what sut/type con/coil uit/(unit item)}
2017-05-22 01:43:23 +03:00
^- tang
2018-05-17 00:51:20 +03:00
*tang
:: =+ [arms chapters]=(arm-and-chapter-overviews sut con core-name)
:: ;: weld
:: (print-header (trip (fall p.r.con '')) q.r.con)
:: ::
:: :: todo: figure out how to display the default arm, which should
:: :: be rendered separately.
:: ::
:: ?~ arms
:: ~
:: (print-overview [%header `['arms:' ~] arms]~)
:: ::
:: ?~ chapters
:: ~
:: (print-overview [%header `['chapters:' ~] chapters]~)
:: ::
:: =+ compiled=(item-as-overview uit)
:: ?~ compiled
:: ~
:: (print-overview [%header `['compiled against:' ~] compiled]~)
:: ==
2017-05-22 01:43:23 +03:00
::
2018-05-25 01:39:56 +03:00
:: figures out which {what}s to use.
2017-05-22 01:43:23 +03:00
::
2018-05-25 01:39:56 +03:00
:: there are three places with a relevant {what}: the {arm-doc} on the
:: arm, the {what} in the computed type of the foot, and the {what} on
:: the product of the default arm when the computed type is a core.
++ select-arm-docs
2017-11-16 23:44:27 +03:00
|= {arm-doc/what f/foot sut/type}
2018-05-25 01:39:56 +03:00
:: the computed arm documentation and the product documentation.
^- {what what}
2018-05-17 00:51:20 +03:00
[*what *what]
:: =+ foot-type=(~(play ut sut) p.f)
:: =/ raw-product/what (what-from-type foot-type)
:: =/ product-product/what
:: ?. ?=({$core *} foot-type)
:: ~
:: =* inner-type (~(play ut foot-type) [%limb %$])
:: (what-from-type inner-type)
:: :-
:: ?~ arm-doc
:: ?~ raw-product
:: product-product
:: raw-product
:: arm-doc
:: ?~ arm-doc
:: product-product
:: raw-product
::
2018-05-25 01:39:56 +03:00
:: renders the documentation for a single arm in a core.
2017-05-22 01:43:23 +03:00
++ print-arm
2017-11-16 23:44:27 +03:00
|= {arm-name/tape arm-doc/what f/foot sut/type}
2017-05-25 07:32:50 +03:00
:: todo: need to get the sample here. also hoist this to the general
:: core printing machinery, too.
=+ [main-doc product-doc]=(select-arm-docs arm-doc f sut)
2017-05-22 01:43:23 +03:00
%+ weld
(print-header arm-name main-doc)
?~ product-doc
2017-05-25 07:32:50 +03:00
~
%+ weld
`tang`[[%leaf ""] [%leaf "product:"] ~]
(print-header "" product-doc)
2017-05-22 01:43:23 +03:00
::
2018-05-25 01:39:56 +03:00
:: renders the documentation for a chapter in a core.
2017-05-22 01:43:23 +03:00
++ print-chapter
2017-11-16 23:44:27 +03:00
|= {name/tape doc/what sut/type con/coil chapter-id/@}
2017-05-22 01:43:23 +03:00
;: weld
(print-header name doc)
2017-05-22 01:43:23 +03:00
::
2017-05-25 07:32:50 +03:00
?~ doc
2017-05-22 01:43:23 +03:00
~
2017-05-25 07:32:50 +03:00
(print-sections q.u.doc)
2017-05-22 01:43:23 +03:00
::
=+ arms=(arms-in-chapter sut con chapter-id)
2017-05-22 01:43:23 +03:00
?~ arms
~
(print-overview [%header `['arms:' ~] arms]~)
==
::
2018-05-25 01:39:56 +03:00
:: renders the documentation for a face.
2017-05-22 01:43:23 +03:00
++ print-face
2017-05-25 07:32:50 +03:00
|= {name/tape doc/what children/(unit item)}
2017-05-22 01:43:23 +03:00
%+ weld
(print-header name doc)
2017-05-22 01:43:23 +03:00
?~ children
~
(print-item u.children)
::
2018-05-25 01:39:56 +03:00
:: returns a set of lines from a {chap}
2017-05-22 01:43:23 +03:00
++ print-header
|= {name/tape doc/what}
2017-05-22 01:43:23 +03:00
^- tang
?~ name
2017-05-25 07:32:50 +03:00
?~ doc
2017-05-22 01:43:23 +03:00
[%leaf "(Undocumented)"]~
%+ weld
2017-05-25 07:32:50 +03:00
`tang`[%leaf "{(trip p.u.doc)}"]~
(print-sections q.u.doc)
?~ doc
[%leaf name]~
2017-05-22 01:43:23 +03:00
%+ weld
`tang`[%leaf "{name}: {(trip p.u.doc)}"]~
2017-05-25 07:32:50 +03:00
(print-sections q.u.doc)
2017-05-22 01:43:23 +03:00
::
2018-05-25 01:39:56 +03:00
:: renders an overview as {tang}
2017-05-22 01:43:23 +03:00
++ print-overview
2017-12-16 07:13:50 +03:00
|: ovr=$:overview
2017-05-22 01:43:23 +03:00
^- tang
|^ (print-level ovr 0)
++ print-level
2018-05-25 01:39:56 +03:00
:: indentation: multiply by 2 to get number of spaces.
2017-12-16 07:13:50 +03:00
|: $:{ovr/overview indentation/@u}
2017-05-22 01:43:23 +03:00
^- tang
2018-05-25 01:39:56 +03:00
:: max-key-length: length of the longest {item} term.
2017-05-22 01:43:23 +03:00
=/ max-key-length (calculate-max-key-length ovr)
2018-05-25 01:39:56 +03:00
:: output: what we return
2017-05-22 01:43:23 +03:00
=| output/tang
|-
?~ ovr
output
?- i.ovr
::
{$header *}
%= $
output ;: weld
output
?~ doc.i.ovr
~
`tang`[[%leaf ""] [%leaf "{(trip p.u.doc.i.ovr)}"] ~]
?~ doc.i.ovr
~
(print-sections q.u.doc.i.ovr)
(print-level children.i.ovr (add 1 indentation))
==
ovr t.ovr
==
::
{$item *}
=* rendered (render-item indentation max-key-length +.i.ovr)
%= $
output (weld output rendered)
ovr t.ovr
==
==
::
2018-05-25 01:39:56 +03:00
::
2017-05-22 01:43:23 +03:00
++ calculate-max-key-length
2017-12-16 07:13:50 +03:00
|: ovr=$:overview
2017-05-22 01:43:23 +03:00
^- @u
%- dy-longest-tape
(turn ovr get-overview-name)
::
2018-05-25 01:39:56 +03:00
:: renders a single item line with the given indentation level.
2017-05-22 01:43:23 +03:00
++ render-item
2017-05-25 07:32:50 +03:00
|= {indentation/@u max-key-length/@u name/tape doc/what}
2017-05-22 01:43:23 +03:00
^- tang
=+ spaces=(mul indentation 2)
=+ line=(weld (dy-build-space spaces) name)
=* line-len (lent line)
=* name-len (lent name)
2017-05-22 01:43:23 +03:00
=+ diff=(sub max-key-length name-len)
=? line (gth diff 0)
(weld line (dy-build-space diff))
=/ slogan/tape
2017-05-25 07:32:50 +03:00
?~ doc
2017-05-22 01:43:23 +03:00
~
2017-05-25 07:32:50 +03:00
(trip p.u.doc)
2017-05-22 01:43:23 +03:00
=? line !=(0 (lent slogan))
;: weld
line
" : "
(dy-truncate (sub 80 :(add 1 spaces line-len)) slogan)
==
[%leaf line]~
--
::
2018-05-25 01:39:56 +03:00
:: renders a list of sections as {tang}
::
:: prints the longform documentation.
2017-05-22 01:43:23 +03:00
++ print-sections
|= sections/(list sect)
^- tang
=| output/tang
|-
?~ sections
output
=. output ;: weld
output
`tang`[%leaf ""]~
(print-section i.sections)
==
$(sections t.sections)
::
2018-05-25 01:39:56 +03:00
:: renders an individual {sect} to a {tang}
2017-05-22 01:43:23 +03:00
++ print-section
|= section/sect
^- tang
%+ turn section
|= pica
^- tank
?: p
[%leaf (trip q)]
[%leaf " {(trip q)}"]
--
::
2018-05-25 01:39:56 +03:00
:: truncates `t` down to `i` characters, adding an ellipsis.
2017-05-22 01:43:23 +03:00
++ dy-truncate
:: todo: when ~palfun's string library is landed, switch to his
:: implementation.
|= {i/@u t/tape}
^- tape
=+ t-len=(lent t)
?: (lth t-len i)
t
:(weld (scag (sub i 4) t) "...")
::
2018-05-25 01:39:56 +03:00
:: creates a tape of i spaces, used for padding.
2017-05-22 01:43:23 +03:00
++ dy-build-space
:: todo: when ~palfun's string library is landed, switch to his
:: implementation.
|= i/@u
^- tape
=| t/tape
|-
?: =(0 i)
t
$(t (weld " " t), i (sub i 1))
::
2018-05-25 01:39:56 +03:00
:: returns the length of the longest tape in c.
2017-05-22 01:43:23 +03:00
++ dy-longest-tape
|= c/(list tape)
=| ret/@ud
|-
?~ c
ret
=+ l=(lent i.c)
?: (gth l ret)
$(ret l, c t.c)
$(c t.c)
::
2017-11-16 23:44:27 +03:00
++ dy-show-type-noun
|= a/type ^- tank
2018-05-17 00:51:20 +03:00
*tank
:: =- >[-]<
:: |- ^- $? $% {$atom @tas (unit @)}
:: {$cell _$ _$}
:: {$cube * _$}
:: {$face {what $@(term tune)} _$}
:: {$fork (set _$)}
:: {$hold _$ hoon}
:: ==
:: wain :: "<|core|>"
:: $?($noun $void)
:: ==
:: ?+ a a
:: :: {?($cube $face) ^} a(q $(a q.a))
:: {$cell ^} a(p $(a p.a), q $(a q.a))
:: {$fork *} a(p (silt (turn ~(tap in p.a) |=(b/type ^$(a b)))))
:: {$hint *} !!
:: {$core ^} `wain`/core
:: {$hold *} a(p $(a p.a))
:: ==
2015-09-29 22:15:33 +03:00
::
2018-03-18 04:06:15 +03:00
:: XX needs filter
2015-09-29 22:15:33 +03:00
::
2018-03-18 04:06:15 +03:00
:: ++ dy-shown
:: $? hoon
:: $^ {dy-shown dy-shown}
:: $% {$ur (unit knot) purl:eyre}
:: {$sa mark}
:: {$as mark dy-shown}
:: {$do hoon dy-shown}
:: {$ge path (list dy-shown) (map term (unit dy-shown))}
:: {$dv path}
:: ==
:: ==
:: ::
:: ++ dy-show-source
:: |= a/dojo-source ^- tank
:: =- >[-]<
:: =+ `{@ bil/dojo-build}`a
:: |- ^- dy-shown
:: ?- -.bil
:: $?($ur $dv $sa) bil
:: $ex ?. ?=({$cltr *} p.bil) p.bil
:: |- ^- hoon
:: ?~ p.p.bil !!
:: ?~ t.p.p.bil i.p.p.bil
:: [i.p.p.bil $(p.p.bil t.p.p.bil)]
:: $tu ?~ p.bil !!
:: |-
:: ?~ t.p.bil ^$(bil q.i.p.bil)
:: [^$(bil q.i.p.bil) $(p.bil t.p.bil)]
:: $as bil(q $(bil q.q.bil))
:: $do bil(q $(bil q.q.bil))
:: $ge :+ %ge q.p.p.bil
:: [(turn p.q.p.bil ..$) (~(run by q.q.p.bil) (lift ..$))]
:: ==
2015-09-29 22:15:33 +03:00
::
2015-05-07 05:31:54 +03:00
++ dy-edit :: handle edit
2015-12-20 23:50:45 +03:00
|= cal/sole-change
2015-05-07 05:31:54 +03:00
^+ +>+>
=^ dat say (~(transceive ^sole say) cal)
2018-03-19 07:18:20 +03:00
?: |(?=(^ per) ?=(^ pux) ?=(~ pro))
2015-05-07 05:31:54 +03:00
~& %dy-edit-busy
=^ 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)))
::
2017-11-16 23:44:27 +03:00
++ dy-type :: sole action
2015-12-20 23:50:45 +03:00
|= act/sole-action
2015-05-07 05:31:54 +03:00
?- -.act
2015-12-10 12:17:19 +03:00
$det (dy-edit +.act)
$ret (dy-done (tufa buf.say))
$clr dy-stop
2015-05-07 05:31:54 +03:00
==
::
2015-12-20 23:50:45 +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 [%$ %noun vax]) :: vase to silk
++ dy-silk-sources :: arglist to silk
|= src/(list dojo-source)
^- schematic:ford
::
:+ %$ %noun
2015-09-12 00:15:25 +03:00
|-
?~ 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
2015-12-20 23:50:45 +03:00
|= {cay/cage cig/dojo-config}
^- [wire schematic:ford]
?. (~(nest ut [%cell [%atom %$ ~] %noun]) | p.q.cay)
::
:: naked gate
::
?. &(?=({* ~} p.cig) ?=(~ q.cig))
~|(%one-argument !!)
:- /noun
:+ %call [%$ %noun q.cay]
[%$ %noun (dy-vase p.i.p.cig)]
::
:: normal generator
::
2015-09-12 00:15:25 +03:00
:- ?+ -.q.q.cay ~|(%bad-gen ~_((sell (slot 2 q.cay)) !!))
2015-12-09 10:12:11 +03:00
$say /gent
$ask /dial
$get /scar
2015-09-12 00:15:25 +03:00
==
=+ gat=(slot 3 q.cay)
:+ %call [%$ %noun gat]
:+ [%$ %noun !>([now=now.hid eny=eny.hid bec=he-beak])]
2015-09-12 00:15:25 +03:00
(dy-silk-sources p.cig)
:+ %mute [%$ %noun (fall (slew 27 gat) !>(~))]
^- (list [wing schematic:ford])
%+ turn ~(tap by q.cig)
2015-12-20 23:50:45 +03:00
|= {a/term b/(unit dojo-source)}
^- [wing schematic:ford]
2015-09-12 00:15:25 +03:00
:- [a ~]
:+ %$ %noun
2015-09-12 00:15:25 +03:00
?~(b !>([~ ~]) (dy-vase p.u.b))
2015-05-07 05:31:54 +03:00
::
2017-11-17 00:50:03 +03:00
++ dy-hoon-head :: dynamic state
2017-05-22 01:43:23 +03:00
:: todo: how do i separate the toplevel 'dojo state' comment?
2018-05-25 01:39:56 +03:00
:: dojo state
::
:: our: the name of this urbit
:: now: the current time
:: eny: a piece of random entropy
::
2015-09-04 04:29:34 +03:00
^- cage
:- %noun
2015-12-20 23:50:45 +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)
2015-12-20 23:50:45 +03:00
|= {{a/term @ b/vase} c/vase} ^- vase
2018-05-17 00:51:20 +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
2015-12-20 23:50:45 +03:00
|= cag/cage
2015-05-07 05:31:54 +03:00
^+ +>+>
?. ?=(^ q.q.cag)
(dy-errd ~ q.q.cag)
2015-05-07 05:31:54 +03:00
=+ tan=((list tank) +2.q.q.cag)
=. +>+>.$ (he-diff %tan tan)
2018-03-29 21:03:14 +03:00
=+ vax=(sped (slot 3 q.cag))
2015-05-07 05:31:54 +03:00
?+ -.q.vax !!
2018-03-19 06:54:47 +03:00
%&
2015-05-07 05:31:54 +03:00
?~ +.q.vax
~& %dy-made-dial-abort
(dy-rash %bel ~)
(dy-meal (slot 7 vax))
::
2018-03-19 06:54:47 +03:00
%|
2015-05-07 05:31:54 +03:00
=< he-pone
2015-12-21 08:05:19 +03:00
%- dy-diff(pro `(slap (slot 7 vax) [%limb %q]))
2015-05-07 05:31:54 +03:00
=+ pom=(sole-prompt +<.q.vax)
[%pro pom(cad [':' ' ' cad.pom])]
==
::
2015-09-12 01:46:16 +03:00
++ dy-made-scar :: scraper product
2015-12-20 23:50:45 +03:00
|= cag/cage
2015-09-12 01:46:16 +03:00
^+ +>+>
?. ?=(^ q.q.cag)
(dy-errd ~ q.q.cag)
2015-09-12 01:46:16 +03:00
=+ tan=((list tank) +2.q.q.cag)
=. +>+>.$ (he-diff %tan tan)
2018-03-29 21:03:14 +03:00
=+ vax=(sped (slot 3 q.cag))
2015-09-12 01:46:16 +03:00
~_ (sell q.cag)
?+ -.q.vax !!
2018-03-19 06:54:47 +03:00
%&
2015-09-12 01:46:16 +03:00
?~ +.q.vax
~& %dy-made-scar-abort
(dy-rash %bel ~)
(dy-meal (slot 7 vax))
::
2018-03-19 06:54:47 +03:00
%|
2018-03-29 21:03:14 +03:00
=> .(vax (slap vax !,(*hoon ?>(?=(%| -) .)))) :: XX working sped #72
2018-03-19 06:54:47 +03:00
=+ typ={%| (unit knot) hiss:eyre *}
2018-06-15 20:37:57 +03:00
=+ [* usr hiz *]=((dy-cast typ !>($:typ)) vax)
=. ..dy (he-diff %tan leaf+"< {(en-purl:html p.hiz)}" ~)
(dy-eyre(pro `(slap (slot 15 vax) limb+%r)) /scar usr hiz)
2015-09-12 01:46:16 +03:00
==
::
++ dy-sigh-scar :: scraper result
2015-12-20 23:50:45 +03:00
|= dat/cage
2015-09-12 01:46:16 +03:00
?~ pro
~& %dy-no-scraper
(dy-show dat)
(dy-slam(pux ~) /scar u.pro q.dat)
::
2015-05-07 05:31:54 +03:00
++ dy-made-gent :: generator product
2015-12-20 23:50:45 +03:00
|= cag/cage
2015-05-07 05:31:54 +03:00
(dy-meal q.cag)
::
++ dy-made-noun :: generator product
|= cag/cage
(dy-hand %noun q.cag)
::
2015-05-07 05:31:54 +03:00
++ dy-make :: build step
^+ +>
?> ?=(^ cud)
2015-09-10 01:57:25 +03:00
=+ bil=q.u.cud :: XX =*
2015-12-09 04:54:26 +03:00
?: ?=($ur -.bil)
2016-03-03 03:38:59 +03:00
(dy-eyre /hand p.bil [q.bil %get ~ ~])
2015-05-07 05:31:54 +03:00
%- dy-ford
^- [path schematic:ford]
2015-09-12 00:15:25 +03:00
?- -.bil
2015-12-09 10:12:11 +03:00
$ge (dy-silk-config (dy-cage p.p.p.bil) q.p.bil)
$dv [/hand [%core [he-disc (weld /hoon (flop p.bil))]]]
2015-12-09 10:12:11 +03:00
$ex [/hand (dy-mare p.bil)]
$sa [/hand [%bunt he-disc p.bil]]
$as [/hand [%cast he-disc p.bil [%$ (dy-cage p.q.bil)]]]
2017-09-19 23:08:18 +03:00
$do [/hand [%call (dy-mare p.bil) [%$ (dy-cage p.q.bil)]]]
2015-12-09 10:12:11 +03:00
$tu :- /hand
:+ %$ %noun
2015-05-07 05:31:54 +03:00
|- ^- 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
==
::
2017-11-17 00:50:03 +03:00
++ dy-hoon-mark :: XX architect
2015-09-09 00:05:40 +03:00
=+ ^= ope
2017-11-17 00:50:03 +03:00
|= gen/hoon ^- hoon
2018-05-27 23:01:04 +03:00
?: ?=(?($sgld $sgbn) -.gen)
2015-09-09 00:05:40 +03:00
$(gen q.gen)
=+ ~(open ap gen)
?.(=(gen -) $(gen -) gen)
2017-11-17 00:50:03 +03:00
|= gen/hoon ^- (unit mark)
2015-09-09 00:05:40 +03:00
=. gen (ope gen)
2018-03-19 07:18:20 +03:00
?: ?=({$cnts {@ ~} ~} gen)
2015-09-10 01:57:25 +03:00
(bind (~(get by var) i.p.gen) head)
2018-03-13 04:20:48 +03:00
~
2015-09-09 00:05:40 +03:00
::
2015-06-02 21:36:56 +03:00
++ dy-mare :: build expression
2017-11-17 00:50:03 +03:00
|= gen/hoon
^- schematic:ford
2017-11-17 00:50:03 +03:00
=+ too=(dy-hoon-mark gen)
=- ?~(too - [%cast he-disc u.too -])
2015-09-04 04:29:34 +03:00
:+ %ride gen
2017-11-17 00:50:03 +03:00
:- [%$ dy-hoon-head]
:^ %plan he-rail `coin`blob+**
`scaffold:ford`[he-rail zuse sur lib ~ ~]
2015-06-02 21:36:56 +03:00
::
2015-05-07 05:31:54 +03:00
++ dy-step :: advance project
2015-12-20 23:50:45 +03:00
|= nex/@ud
2015-05-07 05:31:54 +03:00
^+ +>+>
2018-03-19 07:18:20 +03:00
?> ?=(~ cud)
2015-12-10 12:17:19 +03:00
?: ?=({$show $3} -.mad)
he-easter:dy-over
2015-05-07 05:31:54 +03:00
?: =(nex num)
he-easter:dy-over
2015-05-07 05:31:54 +03:00
dy-make(cud `[nex (~(got by job) nex)])
--
::
++ he-dope :: sole user of ++dp
2015-12-20 23:50:45 +03:00
|= txt/tape ::
2015-12-21 00:16:39 +03:00
^- (each (unit (each dojo-command tape)) hair) :: prefix+result
2015-09-04 01:10:18 +03:00
=+ len=+((lent txt)) :: line length
=. txt (weld buf `tape`(weld txt "\0a")) ::
2015-09-04 01:10:18 +03:00
=+ vex=((full dp-command-line):dp [1 1] txt) ::
?: =(q.p.vex len) :: matched to line end
2015-09-04 01:10:18 +03:00
[%& ~] ::
2015-12-20 23:50:45 +03:00
?: =(p.p.vex +((lent (skim txt |=(a/@ =(10 a)))))) :: parsed all lines
2015-12-29 01:01:44 +03:00
[%& ~ ?~(q.vex [%| txt] [%& p.u.q.vex])] :: new buffer+complete
2015-09-04 01:10:18 +03:00
[%| p.p.vex (dec q.p.vex)] :: syntax error
2015-12-29 01:01:44 +03:00
::
2015-05-07 05:31:54 +03:00
++ he-duke :: ++he-dope variant
2015-12-20 23:50:45 +03:00
|= txt/tape
2015-12-09 10:12:11 +03:00
^- (each (unit (each dojo-command tape)) @ud)
2015-05-07 05:31:54 +03:00
=+ foy=(he-dope txt)
?- -.foy
2018-03-19 06:54:47 +03:00
%| [%| q.p.foy]
%& [%& p.foy]
2015-05-07 05:31:54 +03:00
==
::
++ he-easter :: hint messages
^+ .
=. egg +(egg)
2015-12-21 00:16:39 +03:00
=- ?~(msg ..he-diff (he-diff %tan leaf+u.msg ~))
2015-12-20 23:50:45 +03:00
^- msg/(unit tape)
?+ (clan:title our.hid) ~
2015-12-10 12:17:19 +03:00
$pawn ?+ egg ~
$5 `":: To request a planet, run |ask 'your@email.co'"
== ==
::
2015-05-07 05:31:54 +03:00
++ he-abet :: resolve
[(flop moz) %_(+> hoc (~(put by hoc) ost.hid +<+))]
::
++ he-abut :: discard
=> he-stop
[(flop moz) %_(+> hoc (~(del by hoc) ost.hid))]
2015-05-07 05:31:54 +03:00
::
++ he-disc [p q]:he-beam
++ he-beak [p q r]:he-beam
++ he-rail [[p q] s]:he-beam
2015-09-10 03:52:55 +03:00
++ he-beam :: logical beam
^- beam
2015-12-21 00:16:39 +03:00
?. =(ud+0 r.dir) dir
2015-09-10 03:52:55 +03:00
dir(r [%da now.hid])
2015-05-07 05:31:54 +03:00
::
++ he-card :: emit gift
2015-12-20 23:50:45 +03:00
|= cad/card
2015-05-07 05:31:54 +03:00
^+ +>
%_(+> moz [[ost.hid cad] moz])
2015-05-07 05:31:54 +03:00
::
++ he-send
2015-12-20 23:50:45 +03:00
|= {way/wire him/ship dap/term cop/clap}
2015-05-07 05:31:54 +03:00
^+ +>
(he-card %send way [him dap] cop)
::
++ he-diff :: emit update
2015-12-20 23:50:45 +03:00
|= 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-12-20 23:50:45 +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-errd :: reject update
|= {rev/(unit sole-edit) err/@u} ^+ +>
=+ red=(fall rev [%nop ~]) :: required for error location sync
=^ lic say (~(transmit ^sole say) red)
(he-diff %mor [%det lic] [%err err] ~)
::
2015-05-07 05:31:54 +03:00
++ he-pone :: clear prompt
^+ .
=^ cal say (~(transmit ^sole say) [%set ~])
2015-05-07 05:31:54 +03:00
(he-diff %mor [%det cal] ~)
::
++ he-prow :: where we are
^- tape
?: &(=(our.hid p.dir) =(%home q.dir) =([%ud 0] r.dir) =(~ s.dir)) ~
%+ weld
?: &(=(our.hid p.dir) =([%ud 0] r.dir))
(weld "/" (trip q.dir))
;: weld
"/" ?:(=(our.hid p.dir) "=" (scow %p p.dir))
"/" ?:(=(%home q.dir) "=" (trip q.dir))
"/" ?:(=([%ud 0] r.dir) "=" (scow r.dir))
==
2015-12-07 22:24:35 +03:00
?:(=(~ s.dir) "" (spud (flop s.dir)))
::
2015-05-07 05:31:54 +03:00
++ he-prom :: send prompt
%- he-diff
:- %pro
[& %$ (weld he-prow ?~(buf "> " "< "))]
2015-05-07 05:31:54 +03:00
::
++ he-made :: result from ford
|= $: way=wire
date=@da
$= result
$% [%complete build-result=build-result:ford]
[%incomplete =tang]
== ==
2015-05-07 05:31:54 +03:00
^+ +>
?> ?=(^ poy)
=< he-pine
?- -.result
%incomplete
(he-diff(poy ~) %tan tang.result)
::
%complete
?- -.build-result.result
::
%success
::
%. (result-to-cage:ford build-result.result)
=+ dye=~(. dy u.poy(pux ~))
?+ way !!
{$hand ~} dy-hand:dye
{$dial ~} dy-made-dial:dye
{$gent ~} dy-made-gent:dye
{$noun ~} dy-made-noun:dye
{$scar ~} dy-made-scar:dye
{$edit ~} dy-made-edit:dye
==
::
%error
(he-diff(poy ~) %tan message.build-result.result)
== ==
2015-05-07 05:31:54 +03:00
::
2015-09-11 02:01:43 +03:00
++ he-sigh :: result from eyre
|= {way/wire hit/httr:eyre}
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 !!
2018-03-19 07:18:20 +03:00
{$hand ~} dy-hand:dye
{$show ~} dy-show:dye
{$scar ~} dy-sigh-scar:dye
2015-09-11 02:01:43 +03:00
==
2015-09-09 02:58:48 +03:00
::
2015-05-07 05:31:54 +03:00
++ he-unto :: result from behn
|= {way/wire cit/cuft:gall}
2015-05-07 05:31:54 +03:00
^+ +>
2015-12-09 04:54:26 +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
2015-12-20 23:50:45 +03:00
|= buf/(list @c)
2015-05-07 05:31:54 +03:00
=(%& -:(he-dope (tufa buf)))
::
++ he-stir :: apply change
2015-12-20 23:50:45 +03:00
|= cal/sole-change
2015-05-07 05:31:54 +03:00
^+ +>
:: ~& [%his-clock ler.cal]
:: ~& [%our-clock ven.say]
=^ dat say (~(transceive ^sole say) cal)
2015-12-09 04:54:26 +03:00
?. ?& ?=($del -.dat)
2015-05-07 05:31:54 +03:00
=(+(p.dat) (lent buf.say))
==
+>.$
=+ foy=(he-dope (tufa buf.say))
2018-03-19 06:54:47 +03:00
?: ?=(%& -.foy) +>.$
2015-05-07 05:31:54 +03:00
:: ~& [%bad-change dat ted.cal]
:: ~& [%our-leg leg.say]
(he-errd `dat q.p.foy)
2015-05-07 05:31:54 +03:00
::
++ he-plan :: execute command
2015-12-20 23:50:45 +03:00
|= mad/dojo-command
2015-05-07 05:31:54 +03:00
^+ +>
2018-03-19 07:18:20 +03:00
?> ?=(~ 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
2015-12-20 23:50:45 +03:00
|= txt/tape
2015-05-07 05:31:54 +03:00
^+ +>
?~ 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
2018-03-19 06:54:47 +03:00
%| (he-errd ~ p.doy)
%&
2015-09-04 01:10:18 +03:00
?~ p.doy
(he-errd ~ (lent txt))
2015-09-04 04:40:30 +03:00
=+ old=(weld ?~(buf "> " " ") (tufa buf.say))
=^ cal say (~(transmit ^sole say) [%set ~])
2015-12-21 00:16:39 +03:00
=. +>.$ (he-diff %mor txt+old nex+~ det+cal ~)
2015-09-04 01:10:18 +03:00
?- -.u.p.doy
2018-03-19 06:54:47 +03:00
%& (he-plan(buf ~) p.u.p.doy)
%| he-prom(buf p.u.p.doy)
2015-05-07 05:31:54 +03:00
==
==
::
2017-11-16 23:44:27 +03:00
++ he-type :: apply input
2015-12-20 23:50:45 +03:00
|= act/sole-action
2015-05-07 05:31:54 +03:00
^+ +>
?^ poy
2017-11-16 23:44:27 +03:00
he-pine:(~(dy-type dy u.poy) act)
2015-05-07 05:31:54 +03:00
?- -.act
2015-12-09 10:12:11 +03:00
$det (he-stir +.act)
$ret (he-done (tufa buf.say))
$clr he-pine(buf "")
2015-05-07 05:31:54 +03:00
==
::
++ he-lame :: handle error
2015-12-20 23:50:45 +03:00
|= {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
2018-03-18 04:06:15 +03:00
|= old/(unit house)
^+ [~ ..prep]
2015-09-04 01:10:18 +03:00
?~ old `..prep
2018-03-18 04:06:15 +03:00
`..prep(+<+ u.old)
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))
2015-09-09 03:10:42 +03:00
++ arm-session
2015-12-20 23:50:45 +03:00
|= {moz/(list move) ses/session}
=> ~(. he moz ses)
2015-09-09 03:10:42 +03:00
=- [wrap=- +]
2017-12-16 07:13:50 +03:00
=+ he-arm=he-type
2018-05-27 22:15:15 +03:00
|@ ++ $
2017-12-16 07:13:50 +03:00
|: +<.he-arm
^- (quip move _..he)
he-abet:(he-arm +<)
--
2015-09-09 03:10:42 +03:00
::
++ peer-sole
~? !=(our.hid src.hid) [%dojo-peer-stranger ost.hid src.hid]
?> (team:title our.hid src.hid)
=^ moz .
?. (~(has by hoc) ost.hid) [~ .]
~& [%dojo-peer-replaced ost.hid]
~(he-abut he ~ (~(got by hoc) ost.hid))
2015-12-21 00:16:39 +03:00
=+ ses=%*(. *session -.dir [our.hid %home ud+0])
(wrap he-peer):(arm-session moz ses)
2015-05-07 05:31:54 +03:00
::
++ poke-sole-action
2015-12-21 00:16:39 +03:00
|= act/sole-action ~| poke+act %. act
2017-11-16 23:44:27 +03:00
(wrap he-type):arm
2016-02-24 04:15:36 +03:00
::
++ poke-json
|= jon/json
^- {(list move) _+>.$}
~& jon=jon
[~ +>.$]
::
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-12-20 23:50:45 +03:00
++ sigh-tang |=({a/wire b/tang} ~|(`term`(cat 3 'sigh-' -.a) (mean b)))
2015-09-09 03:10:42 +03:00
++ lame (wrap he-lame):arm
++ unto (wrap he-unto):arm
2015-05-07 05:31:54 +03:00
++ pull
2015-12-20 23:50:45 +03:00
|= {pax/path}
^- (quip move _+>)
=^ moz +> ~(he-abut he ~ (~(got by hoc) ost.hid))
2015-05-28 09:51:32 +03:00
[moz +>.$(hoc (~(del by hoc) ost.hid))]
2015-05-07 05:31:54 +03:00
--