shrub/sur/sole.hoon

124 lines
7.6 KiB
Plaintext
Raw Normal View History

2015-12-10 07:05:58 +03:00
::
2016-02-11 03:41:28 +03:00
:::: /hoon/sole/sur
2016-11-17 04:42:58 +03:00
::
2017-12-18 03:32:45 +03:00
=> |%
2015-03-28 13:57:02 +03:00
++ sole-action :: sole to app
2015-12-14 10:58:14 +03:00
$% :: {$abo ~} :: reset interaction
2015-12-09 04:54:26 +03:00
{$det sole-change} :: command line edit
2018-03-19 07:18:20 +03:00
{$ret ~} :: submit and clear
{$clr ~} :: exit context
2015-02-09 00:22:33 +03:00
== ::
2015-12-09 04:54:26 +03:00
++ sole-buffer (list @c) :: command state
2015-03-28 13:57:02 +03:00
++ sole-change :: network change
2015-12-20 23:50:45 +03:00
$: ler/sole-clock :: destination clock
haw/@uvH :: source hash
ted/sole-edit :: state change
2015-02-09 00:22:33 +03:00
== ::
2015-12-20 23:50:45 +03:00
++ sole-clock {own/@ud his/@ud} :: vector clock
2015-03-28 13:57:02 +03:00
++ sole-edit :: shared state change
2015-12-20 23:50:45 +03:00
$% {$del p/@ud} :: delete one at
{$ins p/@ud q/@c} :: insert at
{$mor p/(list sole-edit)} :: combination
2018-03-19 07:18:20 +03:00
{$nop ~} :: no-op
2015-12-20 23:50:45 +03:00
{$set p/sole-buffer} :: discontinuity
2015-02-09 00:22:33 +03:00
== ::
2015-03-28 13:57:02 +03:00
++ sole-effect :: app to sole
2018-03-19 07:18:20 +03:00
$% {$bel ~} :: beep
2015-12-21 00:16:39 +03:00
{$blk p/@ud q/@c} :: blink+match char at
2018-03-19 07:18:20 +03:00
{$clr ~} :: clear screen
2015-12-09 04:54:26 +03:00
{$det sole-change} :: edit command
2015-12-20 23:50:45 +03:00
{$err p/@ud} :: error point
2018-04-23 05:41:24 +03:00
{$klr p/styx} :: styled text line
2015-12-20 23:50:45 +03:00
{$mor p/(list sole-effect)} :: multiple effects
2018-03-19 07:18:20 +03:00
{$nex ~} :: save clear command
2015-12-09 04:54:26 +03:00
{$pro sole-prompt} :: set prompt
2015-12-20 23:50:45 +03:00
{$sag p/path q/*} :: save to jamfile
{$sav p/path q/@} :: save to file
{$tan p/(list tank)} :: classic tank
:: {$taq p/tanq} :: modern tank
{$txt p/tape} :: text line
{$url p/@t} :: activate url
2015-02-09 00:22:33 +03:00
== ::
2015-03-28 13:57:02 +03:00
++ sole-command :: command state
2015-12-20 23:50:45 +03:00
$: pos/@ud :: cursor position
say/sole-share :: cursor
2015-02-09 09:25:00 +03:00
== ::
2015-03-28 13:57:02 +03:00
++ sole-prompt :: prompt definition
2015-12-20 23:50:45 +03:00
$: vis/? :: command visible
tag/term :: history mode
2018-04-23 05:41:24 +03:00
cad/styx :: caption
2015-02-09 09:25:00 +03:00
== ::
2015-03-28 13:57:02 +03:00
++ sole-share :: symmetric state
2015-12-20 23:50:45 +03:00
$: ven/sole-clock :: our vector clock
leg/(list sole-edit) :: unmerged edits
buf/sole-buffer :: sole state
2015-02-09 00:22:33 +03:00
== ::
2015-09-12 00:15:25 +03:00
:: ::
:: ::
++ sole-dialog :: standard dialog
2016-02-04 10:12:23 +03:00
|* out/$-(* *) :: output structure
$-(sole-input (sole-result out)) :: output function
2015-09-12 00:15:25 +03:00
:: ::
++ sole-input tape :: prompt input
++ sole-result :: conditional result
2016-02-04 10:12:23 +03:00
|* out/$-(* *) :: output structure
2015-12-14 10:58:14 +03:00
$@(@ud (sole-product out)) :: error position
2015-09-12 00:15:25 +03:00
:: ::
++ sole-product :: success result
2016-02-04 10:12:23 +03:00
|* out/$-(* *) ::
2015-09-12 00:15:25 +03:00
%+ pair (list tank) ::
%+ each (unit out) :: ~ is abort
(pair sole-prompt (sole-dialog out)) :: ask and continue
:: ::
++ sole-request :: scraper result
2016-02-04 10:12:23 +03:00
|* out/$-(* *) :: output structure
2015-09-12 00:15:25 +03:00
%+ pair (list tank) ::
%+ each (unit out) :: ~ is abort
2016-11-07 03:45:29 +03:00
%^ trel :: fetch and continue
(unit knot)
hiss:eyre
2018-02-15 23:23:12 +03:00
$-(httr:eyre $;(..$))
2017-12-18 03:32:45 +03:00
--
|%
2015-09-12 00:15:25 +03:00
:: ::
++ sole-gen :: XX virtual type
2016-02-04 10:12:23 +03:00
$% {$say $-((sole-args) (cask))} :: direct noun
{$ask $-((sole-args) (sole-product (cask)))} :: dialog
{$get $-((sole-args) (sole-request (cask)))} :: scraper
2015-09-12 00:15:25 +03:00
== ::
++ sole-args :: generator arguments
|* _[* *] ::
{{now/@da eny/@uvJ bek/beak} {,+<- ,+<+}} ::
2015-09-12 00:15:25 +03:00
:: ::
:: ::
++ sole-so :: construct result
2015-12-20 23:50:45 +03:00
|* pro/* ::
2015-09-12 00:15:25 +03:00
[p=*(list tank) q=[%& p=[~ u=pro]]] ::
:: ::
++ sole-yo :: add output tank
2015-12-20 23:50:45 +03:00
|* {tan/tank res/(sole-result)} ::
2015-09-12 00:15:25 +03:00
?@ res res ::
[p=[i=tan t=p.res] q=q.res] ::
:: ::
++ sole-lo :: construct prompt
2015-12-20 23:50:45 +03:00
|* {pom/sole-prompt mor/(sole-dialog)} ::
2015-09-12 00:15:25 +03:00
[p=*(list tank) q=[%| p=pom q=mor]] ::
:: ::
++ sole-at :: fetch url
2016-11-07 03:45:29 +03:00
=| usr/knot ::
|* {pul/_purl:eyre fun/$-(httr:eyre *)} ::
:- p=*(list tank) ::
q=[%| p=`usr q=[pul %get ~ ~] r=fun] ::
2015-09-12 00:15:25 +03:00
:: ::
++ sole-no :: empty result
2015-11-20 01:30:30 +03:00
[p=*(list tank) q=[%& ~]] ::
2015-09-12 00:15:25 +03:00
:: ::
++ sole-go :: parse by rule
2016-02-04 10:12:23 +03:00
|* {sef/rule fun/$-(* *)} ::
2015-12-20 23:50:45 +03:00
|= txt/sole-input ::
2015-09-12 00:15:25 +03:00
=+ vex=(sef [0 0] txt) ::
2018-03-19 07:18:20 +03:00
?: |(!=((lent txt) q.p.vex) ?=(~ q.vex)) ::
2015-09-12 00:15:25 +03:00
q.p.vex ::
(fun p.u.q.vex) ::
2015-02-09 00:22:33 +03:00
--