urbit/sur/sole.hoon

116 lines
7.4 KiB
Plaintext
Raw Normal View History

2015-12-09 19:48:57 +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-12-09 04:54:26 +03:00
_% :: {$abo ~} :: reset interaction
{$det sole-change} :: command line edit
{$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-09 04:54:26 +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-09 04:54:26 +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-09 04:54:26 +03:00
_% {$del p+@ud} :: delete one at
{$ins p+@ud q+@c} :: insert at
{$mor p+(list sole-edit)} :: combination
{$nop $~} :: no-op
{$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-12-09 04:54:26 +03:00
_% {$bel $~} :: beep
{$blk p+@ud q+@c} :: blink/match char at
{$clr $~} :: clear screen
{$det sole-change} :: edit command
{$err p+@ud} :: error point
{$mor p+(list sole-effect)} :: multiple effects
{$nex $~} :: save clear command
{$pro sole-prompt} :: set prompt
{$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-09 04:54:26 +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-09 04:54:26 +03:00
$: vis+? :: command visible
tag+term :: history mode
cad+tape :: caption
2015-02-09 09:25:00 +03:00
== ::
2015-03-28 13:57:02 +03:00
++ sole-share :: symmetric state
2015-12-09 04:54:26 +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
2015-12-09 04:54:26 +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
2015-12-09 04:54:26 +03:00
|* out+_+(* *) :: output structure
_|(@ud (sole-product out)) :: error position
2015-09-12 00:15:25 +03:00
:: ::
++ sole-product :: success result
2015-12-09 04:54:26 +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
2015-12-09 04:54:26 +03:00
|* out+_+(* *) :: output structure
2015-09-12 00:15:25 +03:00
%+ 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-12-09 04:54:26 +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
2015-12-09 04:54:26 +03:00
|* __([* *]) ::
{{now+@da eny+@uvI bek+beak} {+<- +<+}} ::
2015-09-12 00:15:25 +03:00
:: ::
:: ::
++ sole-so :: construct result
2015-12-09 04:54:26 +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-09 04:54:26 +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-09 04:54:26 +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
2015-12-09 04:54:26 +03:00
|* {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
2015-12-09 04:54:26 +03:00
|* {sef+rule fun+_+(* *)} ::
|= txt+sole-input ::
2015-09-12 00:15:25 +03:00
=+ 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
--