shrub/sur/sole.hoon

116 lines
7.4 KiB
Plaintext
Raw Normal View History

2015-11-17 06:29:27 +03:00
::
2015-06-05 03:27:01 +03:00
:::: /hoon/sole/sur
2015-02-09 00:22:33 +03:00
!:
|%
2015-03-28 13:57:02 +03:00
++ sole-action :: sole to app
2015-02-24 21:57:47 +03:00
$% :: [%abo ~] :: reset interaction
2015-03-28 13:57:02 +03:00
[%det sole-change] :: command line edit
2015-02-09 00:22:33 +03:00
[%ret ~] :: submit and clear
2015-10-07 21:58:17 +03:00
[%clr ~] :: exit context
2015-02-09 00:22:33 +03:00
== ::
2015-03-28 13:57:02 +03:00
++ sole-buffer (list ,@c) :: command state
++ sole-change :: network change
$: ler=sole-clock :: destination clock
2015-02-09 00:22:33 +03:00
haw=@uvH :: source hash
2015-03-28 13:57:02 +03:00
ted=sole-edit :: state change
2015-02-09 00:22:33 +03:00
== ::
2015-03-28 13:57:02 +03:00
++ sole-clock ,[own=@ud his=@ud] :: vector clock
++ sole-edit :: shared state change
2015-02-09 00:22:33 +03:00
$% [%del p=@ud] :: delete one at
[%ins p=@ud q=@c] :: insert at
2015-03-28 13:57:02 +03:00
[%mor p=(list sole-edit)] :: combination
2015-02-09 00:22:33 +03:00
[%nop ~] :: no-op
2015-03-28 13:57:02 +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
2015-02-09 00:22:33 +03:00
$% [%bel ~] :: beep
[%blk p=@ud q=@c] :: blink/match char at
[%clr ~] :: clear screen
2015-03-28 13:57:02 +03:00
[%det sole-change] :: edit command
2015-03-19 21:53:05 +03:00
[%err p=@ud] :: error point
2015-03-28 13:57:02 +03:00
[%mor p=(list sole-effect)] :: multiple effects
2015-02-22 01:37:35 +03:00
[%nex ~] :: save, clear command
2015-03-28 13:57:02 +03:00
[%pro sole-prompt] :: set prompt
2015-02-24 21:57:47 +03:00
[%sag p=path q=*] :: save to jamfile
[%sav p=path q=@] :: save to file
2015-02-09 00:22:33 +03:00
[%tan p=(list tank)] :: classic tank
:: [%taq p=tanq] :: modern tank
[%txt p=tape] :: text line
2015-11-17 06:29:27 +03:00
[%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-02-09 00:22:33 +03:00
$: pos=@ud :: cursor position
2015-03-28 13:57:02 +03:00
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-02-22 01:37:35 +03:00
$: vis=? :: command visible
tag=term :: history mode
2015-03-19 22:58:54 +03:00
cad=tape :: caption
2015-02-09 09:25:00 +03:00
== ::
2015-03-28 13:57:02 +03:00
++ sole-share :: symmetric state
$: 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
|* out=$+(* *) :: output structure
$+(sole-input (sole-result out)) :: output function
:: ::
++ sole-input tape :: prompt input
++ sole-result :: conditional result
|* out=$+(* *) :: output structure
$|(@ud (sole-product out)) :: error position
:: ::
++ sole-product :: success result
|* out=$+(* *) ::
%+ pair (list tank) ::
%+ each (unit out) :: ~ is abort
(pair sole-prompt (sole-dialog out)) :: ask and continue
:: ::
++ sole-request :: scraper result
|* out=$+(* *) :: output structure
%+ pair (list tank) ::
%+ each (unit out) :: ~ is abort
2015-09-12 01:46:16 +03:00
(pair hiss $+(httr (sole-request out))) :: fetch and continue
2015-09-12 00:15:25 +03:00
:: ::
++ sole-gen :: XX virtual type
2015-09-12 03:24:51 +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
|* _[lit=,* opt=,*] ::
,[[now=@da eny=@uvI bek=beak] [lit opt]] ::
:: ::
:: ::
++ sole-so :: construct result
|* pro=* ::
[p=*(list tank) q=[%& p=[~ u=pro]]] ::
:: ::
++ sole-yo :: add output tank
|* [tan=tank res=(sole-result)] ::
?@ res res ::
[p=[i=tan t=p.res] q=q.res] ::
:: ::
++ sole-lo :: construct prompt
|* [pom=sole-prompt mor=(sole-dialog)] ::
[p=*(list tank) q=[%| p=pom q=mor]] ::
:: ::
++ sole-at :: fetch url
|* [pul=_purl fun=$+(httr *)] ::
2015-09-12 01:46:16 +03:00
[p=*(list tank) q=[%| p=[pul %get ~ ~] q=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
|* [sef=_rule fun=$+(* *)] ::
|= txt=sole-input ::
=+ vex=(sef [0 0] txt) ::
?: |(!=((lent txt) q.p.vex) ?=(~ q.vex)) ::
q.p.vex ::
(fun p.u.q.vex) ::
2015-02-09 00:22:33 +03:00
--