shrub/arvo/hoon.hoon

10643 lines
339 KiB
Plaintext
Raw Normal View History

2016-01-05 04:29:30 +03:00
!::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
2013-09-29 00:21:18 +04:00
:::::: :::::: Preface ::::::
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
?> ?=(@ .) :: atom subject
%. . :: fun with subject
2015-12-20 23:50:45 +03:00
|= cud/@ :: call it cud
2013-09-29 00:21:18 +04:00
=- ?: =(0 cud) :: if cud is 0
all :: then return engine
(make:all cud) :: else simple compile
^= all :: assemble engine
=~ :: volume stack
2016-01-05 04:29:30 +03:00
%151 :: version constant
2013-09-29 00:21:18 +04:00
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::: :::::: volume 0, version stub ::::::
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
2016-01-05 04:29:30 +03:00
~% %k.151 ~ ~ ::
2013-09-29 00:21:18 +04:00
|% ::
2016-01-05 04:29:30 +03:00
++ hoon %151 :: version stub
2013-09-29 00:21:18 +04:00
-- ::
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::: :::::: volume 1, Hoon models ::::::
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
~% %mood
+
~
|% ::
2015-12-26 13:07:50 +03:00
++ abel typo :: original sin: span
2015-12-20 23:50:45 +03:00
++ ache |* {a/$+(* *) b/$+(* *)} :: either a or b
$%({$| p/b} {$& p/a}) :: b default
2015-12-04 01:58:42 +03:00
++ axis @ :: tree address
++ bank (list @cF) :: UTF-32 string
++ base :: base mold
$@ $? $noun :: any noun
$cell :: any cell
$bean :: loobean
$void :: no nouns
$null :: ~ == 0
== ::
2016-01-05 04:29:30 +03:00
{$atom p/odor} :: atom
2015-12-04 01:58:42 +03:00
++ bean ? :: 0=&=yes, 1=|=no
2015-12-20 23:50:45 +03:00
++ beer $@(@ {$~ p/twig}) :: simple embed
2015-12-14 10:58:14 +03:00
++ beet $@ @ :: advanced embed
2015-12-20 23:50:45 +03:00
$% {$a p/twig} :: take tape
{$b p/twig} :: take manx
{$c p/twig} :: take marl
{$d p/twig} :: take $+(marl marl)
{$e p/twig q/(list tuna)} :: element literal
2015-12-04 01:58:42 +03:00
== ::
++ bloq @ :: blockclass
++ char @tD :: UTF-8 byte
2014-07-01 05:15:56 +04:00
++ chub :: registered battery
2015-12-20 23:50:45 +03:00
$: p/(pair chum tyre) :: definition
q/* :: battery
r/(unit (pair axis chub)) :: parent
2014-07-01 05:15:56 +04:00
== ::
2015-12-20 23:50:45 +03:00
++ chum $? lef/term :: jet name
{std/term kel/@} :: kelvin version
{ven/term pro/term kel/@} :: vendor and product
{ven/term pro/term ver/@ kel/@} :: all of the above
2015-02-27 09:35:41 +03:00
== ::
2015-12-20 23:50:45 +03:00
++ clue {p/chum q/nock r/(list (pair term nock))} :: battery definition
2015-12-26 13:07:50 +03:00
++ coil $: p/?($gold $iron $lead $zinc) :: core span
q/span ::
2015-12-20 23:50:45 +03:00
r/{p/?($~ ^) q/(map term foot)} ::
2013-09-29 00:21:18 +04:00
== ::
2015-12-20 23:50:45 +03:00
++ coin $% {$$ p/dime} ::
{$blob p/*} ::
{$many p/(list coin)} ::
== ::
2015-12-04 01:58:42 +03:00
++ cord @t :: text atom (UTF-8)
2015-12-20 23:50:45 +03:00
++ date {{a/? y/@ud} m/@ud t/tarp} :: parsed date
++ dime {p/@ta q/@} ::
2015-12-04 01:58:42 +03:00
++ dock (pair @p term) :: message target
2015-12-20 23:50:45 +03:00
++ each |* {a/$+(* *) b/$+(* *)} :: either a or b
$%({$& p/a} {$| p/b}) :: a default
++ edge {p/hair q/(unit {p/* q/nail})} :: parsing output
++ foot $% {$ash p/twig} :: dry arm, geometric
{$elm p/twig} :: wet arm, generic
2013-09-29 00:21:18 +04:00
== ::
2015-12-14 10:58:14 +03:00
++ gate $+(* *) :: general gate
2015-12-20 23:50:45 +03:00
++ hair {p/@ud q/@ud} :: parsing trace
++ knot @ta :: ASCII text
2015-12-20 23:50:45 +03:00
++ like |* a/$+(* *) :: generic edge
|= b/_`*`[(hair) ~] ::
2013-09-29 00:21:18 +04:00
:- p=(hair -.b) ::
^= q ::
?@ +.b ~ ::
:- ~ ::
2014-01-27 22:49:26 +04:00
u=[p=(a +>-.b) q=[p=(hair -.b) q=(tape +.b)]] ::
2015-12-21 02:40:04 +03:00
++ limb $@ term :: wing element
$% {$& p/axis} :: by geometry
{$| p/@ud q/(unit term)} :: by name
2015-11-27 22:37:06 +03:00
== ::
2015-12-20 23:50:45 +03:00
++ line {p/{$leaf p/odor q/@} q/tile} :: %kelp case
++ list |* a/$+(* *) :: null-term list
$@($~ {i/a t/(list a)}) ::
++ lone |*(a/$+(* *) p/a) :: just one thing
2015-12-21 00:16:39 +03:00
++ mane $@(@tas {@tas @tas}) :: XML name+space
2015-12-20 23:50:45 +03:00
++ manx {g/marx c/marl} :: XML node
2014-04-03 05:06:45 +04:00
++ marl (list manx) :: XML node list
2015-12-20 23:50:45 +03:00
++ mars {t/{n/$$ a/{i/{n/$$ v/tape} t/$~}} c/$~} :: XML cdata
++ mart (list {n/mane v/tape}) :: XML attributes
++ marx {n/mane a/mart} :: XML tag
2015-12-04 01:58:42 +03:00
++ metl ?($gold $iron $zinc $lead) :: core variance
++ noun * :: any noun
++ null $~ :: null, nil, etc
++ odor @ta :: atom format
2015-12-20 23:50:45 +03:00
++ tarp {d/@ud h/@ud m/@ud s/@ud f/(list @ux)} :: parsed time
2015-12-04 01:58:42 +03:00
++ time @da :: galactic time
2015-12-20 23:50:45 +03:00
++ tree |* a/$+(* *) :: binary tree
$@($~ {n/a l/(tree a) r/(tree a)}) ::
++ nail {p/hair q/tape} :: parsing input
2015-12-04 01:58:42 +03:00
++ numb @ :: just a number
2015-12-20 23:50:45 +03:00
++ pair |*({a/$+(* *) b/$+(* *)} {p/a q/b}) :: just a pair
++ quid |*({a/$+(* *) b/*} {a _b}) :: for =^
++ quip |*({a/$+(* *) b/*} {(list a) _b}) :: for =^
++ wand |* a/(pole $+(* *)) :: hetero list
|= b/* ::
2015-03-06 12:11:01 +03:00
?~ a ~ ::
?@ b ~ ::
2015-04-07 22:05:21 +03:00
[i=(-.a -.b) t=$(a +.a, b +.b)] ::
2015-12-04 01:58:42 +03:00
++ pass @ :: public key
++ path (list knot) :: filesys location
2015-12-21 00:16:39 +03:00
++ pint {p/{p/@ q/@} q/{p/@ q/@}} :: line+column range
2015-12-20 23:50:45 +03:00
++ pole |* a/$+(* *) :: nameless list
2015-12-14 10:58:14 +03:00
$@($~ {a (pole a)}) ::
++ pony %+ each :: new pull result
%+ pair :: normal
vein :: wing trace
$% {$& p/span} :: leg
{$| p/axis q/(set {p/span q/foot})} :: arm
== ::
2015-12-23 07:12:56 +03:00
%+ each :: abnormal
@ud :: unmatched, skips
2015-12-26 13:07:50 +03:00
(pair span nock) :: functional
2015-12-20 23:50:45 +03:00
++ port $: p/axis ::
2015-12-14 10:58:14 +03:00
$= q ::
2015-12-26 13:07:50 +03:00
$% {$& p/span} ::
{$| p/axis q/(list {p/span q/foot})} ::
2013-09-29 00:21:18 +04:00
== ::
== ::
2015-12-20 23:50:45 +03:00
++ qual |* {a/$+(* *) b/$+(* *) c/$+(* *) d/$+(* *)} :: just a quadruple
{p/a q/b r/c s/d} ::
2015-12-04 01:58:42 +03:00
++ ring @ :: private key
2015-12-23 07:12:56 +03:00
++ rule _|=(nail *edge) :: parsing rule
2015-12-20 23:50:45 +03:00
++ spot {p/path q/pint} :: range in file
2015-06-17 00:01:07 +03:00
++ tang (list tank) :: bottom-first error
2015-12-20 23:50:45 +03:00
++ tank $% {$leaf p/tape} :: printing formats
2015-12-14 10:58:14 +03:00
$: $palm :: backstep list
2015-12-20 23:50:45 +03:00
p/{p/tape q/tape r/tape s/tape} ::
q/(list tank) ::
2014-09-03 04:12:38 +04:00
== ::
2015-12-14 10:58:14 +03:00
$: $rose :: flat list
2015-12-20 23:50:45 +03:00
p/{p/tape q/tape r/tape} :: mid open close
q/(list tank) ::
2014-09-03 04:12:38 +04:00
== ::
2015-02-09 00:22:33 +03:00
== ::
2015-12-04 01:58:42 +03:00
++ tanq :: future tank
2015-12-20 23:50:45 +03:00
$? {$~ p/(list tanq)} :: list of printables
{$~ $~ p/tape} :: simple string
2015-12-04 01:58:42 +03:00
(pair @tas tanq) :: captioned
2015-02-09 00:22:33 +03:00
== ::
2015-12-04 01:58:42 +03:00
++ tape (list char) :: string as list
++ term @tas :: ascii symbol
2014-01-04 06:59:56 +04:00
++ tiki :: test case
2015-12-20 23:50:45 +03:00
$% {$& p/(unit term) q/wing} :: simple wing
{$| p/(unit term) q/twig} :: named wing
2014-01-04 06:59:56 +04:00
== ::
2015-12-20 23:50:45 +03:00
++ tile $^ {p/tile q/tile} :: ordered pair
2015-12-26 13:07:50 +03:00
$% {$axil p/base} :: base span
2015-12-20 23:50:45 +03:00
{$bark p/term q/tile} :: name
2015-12-21 00:16:39 +03:00
{$bush p/tile q/tile} :: pair+tag
2015-12-23 07:57:10 +03:00
{$deet p/spot q/tile} :: set debug
2015-12-20 23:50:45 +03:00
{$fern p/{i/tile t/(list tile)}} :: plain selection
{$herb p/twig} :: gate
{$kelp p/{i/line t/(list line)}} :: tag selection
{$leaf p/term q/@} :: constant atom
2015-12-21 00:16:39 +03:00
{$reed p/tile q/tile} :: atom+cell
2015-12-20 23:50:45 +03:00
{$weed p/twig} :: example
2013-12-15 11:07:57 +04:00
== ::
2014-01-16 10:43:56 +04:00
++ toga :: face control
2015-12-20 23:50:45 +03:00
$@ p/term :: two togas
2015-12-14 10:58:14 +03:00
$% {$0 $~} :: no toga
2015-12-20 23:50:45 +03:00
{$1 p/term q/toga} :: deep toga
{$2 p/toga q/toga} :: cell toga
== ::
2015-12-20 23:50:45 +03:00
++ trap |*(a/_* _|?(*a)) :: makes perfect sense
++ trel |* {a/$+(* *) b/$+(* *) c/$+(* *)} :: just a triple
{p/a q/b r/c} ::
2014-04-03 05:06:45 +04:00
++ tuna :: tagflow
2015-12-20 23:50:45 +03:00
$% {$a p/twig} :: plain text
{$b p/twig} :: single tag
{$c p/twig} :: simple list
{$d p/twig} :: dynamic list
{$e p/twig q/(list tuna)} :: element
{$f p/(list tuna)} :: subflow
2014-04-03 05:06:45 +04:00
== ::
2015-12-21 23:45:47 +03:00
++ twig ::
$^ {p/twig q/twig} ::
$% ::
{$$ p/axis} :: simple leg
:: ::
{$base p/base} :: base
{$bust p/base} :: bunt base
{$dbug p/spot q/twig} :: debug info in trace
{$knit p/(list beer)} :: assemble string
{$leaf p/(pair term @)} :: symbol
{$limb p/term} :: pulls limb p
{$lost p/twig} :: not to be taken
2015-12-30 00:52:51 +03:00
{$rock p/term q/*} :: fixed constant
{$sand p/term q/*} :: unfixed constant
2015-12-21 23:45:47 +03:00
{$tell p/(list twig)} :: render as tape
{$wing p/wing} :: pulls p
{$yell p/(list twig)} :: render as tank
:: :::::: molds
{$bcpt p/twig q/twig} :: atom fork (reed)
{$bccb p/twig} :: example
{$bccl p/(list twig)} :: tuple
{$bccn p/(list twig)} :: tagged fork (kelp)
{$bcls p/twig q/twig} :: function
{$bckt p/twig q/twig} :: pairhead fork (bush)
{$bcwt p/(list twig)} :: untagged fork
{$bcts p/term q/twig} :: name
:: :::::: cores
{$brcb p/twig q/(map term foot)} :: %gold tray, sample p
{$brcl p/twig q/twig} :: %brts by example
{$brcn p/(map term foot)} :: %gold core, natural
{$brdt p/twig} :: dry %gold trap
{$brkt p/twig q/(map term foot)} :: %gold book
{$brhp p/twig} :: kick dry %gold trap
{$brsg p/twig q/twig} :: %iron gate
2015-12-21 23:45:47 +03:00
{$brtr p/twig q/twig} :: wet %gold gate
{$brts p/twig q/twig} :: dry %gold gate
{$brwt p/twig} :: dry %lead trap
:: :::::: tuples
{$clcb p/twig q/twig} :: [q p]
{$clcn p/(list twig)} :: [[p ~] ~]
{$clkt p/twig q/twig r/twig s/twig} :: [p q r s]
{$clhp p/twig q/twig} :: [p q]
{$clls p/twig q/twig r/twig} :: [p q r]
{$clsg p/(list twig)} :: [p ~]
{$cltr p/(list twig)} :: p as a tuple
:: :::::: invocations
{$cnbc p/twig} :: ^~($.p)
{$cncb p/wing q/(list (pair wing twig))} :: %+, then cast to p
{$cndt p/twig q/twig} :: %-(q p)
{$cnhp p/twig q/(list twig)} :: slam p w+ sample q
{$cntr p/wing q/twig r/(list (pair wing twig))} :: pull p.q w+ changes
{$cnkt p/twig q/twig r/twig s/twig} :: slam p w+ :*(q r s)
{$cnls p/twig q/twig r/twig} :: slam p w+ :*(q r)
{$cnsg p/wing q/twig r/(list twig)} :: new cnsg
2015-12-21 23:45:47 +03:00
{$cnts p/wing q/(list (pair wing twig))} :: eval. p w+ q changes
:: :::::: nock
{$dtkt p/twig} :: nock 11 data skyhook
{$dtls p/twig} :: nock 4 increment
{$dttr p/twig q/twig} :: nock p w+ formula q
{$dtts p/twig q/twig} :: nock 5 equality test
{$dtwt p/twig} :: nock 3 cell test
2015-12-26 13:07:50 +03:00
:: :::::: span conversion
2015-12-21 23:45:47 +03:00
{$ktbr p/twig} :: %gold core to %iron
2015-12-26 13:07:50 +03:00
{$ktdt p/twig q/twig} :: cast q to span (p q)
2015-12-21 23:45:47 +03:00
{$ktls p/twig q/twig} :: cast q to p, verify
{$kthp p/twig q/twig} :: cast q to icon of p
{$ktpm p/twig} :: %gold core to %zinc
{$ktsg p/twig} :: p as static constant
{$ktts p/toga q/twig} :: wrap q in toga p
{$ktwt p/twig} :: %gold core to %lead
:: :::::: hints
{$sgbr p/twig q/twig} :: print p if q fails
{$sgcb p/twig q/twig} :: put p in q's trace
{$sgcn p/chum q/twig r/tyre s/twig} :: mark core for jets
{$sgfs p/chum q/twig} :: jet arm in ~% core
{$sggl p/$@(term {p/term q/twig}) q/twig} :: hint p to product q
{$sggr p/$@(term {p/term q/twig}) q/twig} :: hint p to q
{$sgbc p/term q/twig} :: label q, profiling
{$sgls p/@ q/twig} :: cache+memoize
{$sgpm p/@ud q/twig r/twig} :: print q w+priority
{$sgts p/twig q/twig} :: avoid duplication
{$sgwt p/@ud q/twig r/twig s/twig} :: hint iff q is yes
2015-12-26 13:07:50 +03:00
{$sgzp p/twig q/twig} :: span in stacktrace
2015-12-21 23:45:47 +03:00
:: :::::: miscellaneous
{$smcl p/twig q/(list twig)} :: binary to n-ary
{$smfs p/twig} :: [%$ [%$ p ~] ~]
2015-12-21 23:45:47 +03:00
{$smsg p/twig q/(list twig)} :: gonads
{$smsm p/twig q/twig} :: make sure q is a p
:: :::::: compositions
{$tsbr p/twig q/twig} :: push bunt: ++(*p q)
{$tscl p/(list (pair wing twig)) q/twig} :: p changes then q
2016-01-08 03:38:11 +03:00
{$tscn p/twig q/twig r/twig} :: typed variable
2015-12-21 23:45:47 +03:00
{$tsdt p/wing q/twig r/twig} :: r with p set to q
{$tsgl p/twig q/twig} :: +>(q p)
{$tshp p/twig q/twig} :: flip push: ++(q p)
{$tsgr p/twig q/twig} :: use p as .. of q
{$tskt p/twig q/twig r/twig s/twig} :: state machine wing
{$tsls p/twig q/twig} :: push p on .. of q
2015-12-27 09:42:53 +03:00
{$tstr p/term q/wing r/twig} :: make an alias
2015-12-21 23:45:47 +03:00
{$tssg p/(list twig)} :: compose twig list
:: :::::: conditionals
{$wtbr p/(list twig)} :: logical OR
{$wthp p/wing q/(list (pair twig twig))} :: select case in q
{$wtcl p/twig q/twig r/twig} :: if p, then q, else r
{$wtdt p/twig q/twig r/twig} :: unless, ?:(p r q)
{$wtkt p/wing q/twig r/twig} :: if p is a cell
{$wtgl p/twig q/twig} :: assert |, ?:(p !! q)
{$wtgr p/twig q/twig} :: assert &, ?:(p q !!)
{$wtls p/wing q/twig r/(list (pair twig twig))} :: %wthp w/default
{$wtpm p/(list twig)} :: logical AND
{$wtpt p/wing q/twig r/twig} :: if p is an atom
{$wtsg p/wing q/twig r/twig} :: if p is null
{$wtts p/twig q/wing} :: if q is in p
{$wtzp p/twig} :: logical NOT
:: :::::: special
2015-12-26 13:07:50 +03:00
{$zpcm p/twig q/twig} :: q twig with p span
2015-12-21 23:45:47 +03:00
{$zpgr p/twig} :: vase w+ value p
2015-12-26 13:07:50 +03:00
{$zpsm p/twig q/twig} :: [span noun] pair
2015-12-21 23:45:47 +03:00
{$zpts p/twig} :: Nock formula of p
{$zpwt p/$@(p/@ {p/@ q/@}) q/twig} :: restrict hoon vers.
{$zpzp $~} :: always crash
== ::
2015-12-20 23:50:45 +03:00
++ tyre (list {p/term q/twig}) ::
2013-12-15 11:07:57 +04:00
++ tyke (list (unit twig)) ::
2014-04-04 14:00:26 +04:00
:: :::::: virtual nock
2015-12-20 23:50:45 +03:00
++ nock $^ {p/nock q/nock} :: autocons
$% {$0 p/@} :: axis select
{$1 p/*} :: constant
{$2 p/nock q/nock} :: compose
{$3 p/nock} :: cell test
{$4 p/nock} :: increment
{$5 p/nock q/nock} :: equality test
{$6 p/nock q/nock r/nock} :: if, then, else
{$7 p/nock q/nock} :: serial compose
{$8 p/nock q/nock} :: push onto subject
{$9 p/@ q/nock} :: select arm and fire
{$10 p/$@(@ {p/@ q/nock}) q/nock} :: hint
{$11 p/nock} :: grab data from sky
2013-09-29 00:21:18 +04:00
== ::
2015-12-26 12:54:42 +03:00
++ span $@ $? $noun :: any nouns
$void :: no noun
== ::
$% {$atom p/term q/(unit @)} :: atom / constant
2015-12-26 13:07:50 +03:00
{$cell p/span q/span} :: ordered pair
{$core p/span q/coil} :: object
{$face p/tusk q/span} :: namespace
{$fork p/(set span)} :: union
2016-01-11 09:37:59 +03:00
{$frog p/(list span)} :: union
2016-01-11 10:04:34 +03:00
{$hold p/span q/twig} :: lazy evaluation
2015-12-26 12:54:42 +03:00
== ::
2015-12-20 23:50:45 +03:00
++ tone $% {$0 p/*} :: success
{$1 p/(list)} :: blocks
{$2 p/(list {@ta *})} :: error ~_s
2014-10-22 06:04:27 +04:00
== ::
2015-12-20 23:50:45 +03:00
++ toon $% {$0 p/*} :: success
{$1 p/(list)} :: blocks
{$2 p/(list tank)} :: stack trace
2013-09-29 00:21:18 +04:00
== ::
2015-12-20 23:50:45 +03:00
++ tune $% {$0 p/vase} ::
{$1 p/(list)} ::
{$2 p/(list {@ta *})} ::
2013-09-29 00:21:18 +04:00
== ::
2015-12-27 08:43:40 +03:00
++ tusk :: general face control
$@ term :: simple label
$: p/(map term wing) :: aliases
q/(set term) :: blocks
r/(list (pair term twig)) :: bridges
== ::
2015-12-26 13:07:50 +03:00
++ typo span :: old span
2013-09-29 00:21:18 +04:00
++ udal :: atomic change (%b)
2015-12-20 23:50:45 +03:00
$: p/@ud :: blockwidth
2015-12-23 07:12:56 +03:00
q/(list {p/@ud q/(unit {p/@ q/@})}) :: indels
2013-09-29 00:21:18 +04:00
== ::
++ udon :: abstract delta
2015-12-20 23:50:45 +03:00
$: p/umph :: preprocessor
2015-12-14 10:58:14 +03:00
$= q :: patch
2015-12-20 23:50:45 +03:00
$% {$a p/* q/*} :: trivial replace
{$b p/udal} :: atomic indel
{$c p/(urge)} :: list indel
{$d p/upas q/upas} :: tree edit
2013-09-29 00:21:18 +04:00
== ::
== ::
++ umph :: change filter
2015-12-14 10:58:14 +03:00
$@ $? $a :: no filter
2015-12-04 01:58:42 +03:00
$b :: jamfile
$c :: LF text
2013-09-29 00:21:18 +04:00
== ::
2015-12-20 23:50:45 +03:00
$% {$d p/@ud} :: blocklist
2013-09-29 00:21:18 +04:00
== ::
2015-12-20 23:50:45 +03:00
++ unce |* a/$+(* *) :: change part
$% {$& p/@ud} :: skip[copy]
{$| p/(list a) q/(list a)} :: p -> q[chunk]
2015-06-12 20:56:30 +03:00
== ::
2015-12-20 23:50:45 +03:00
++ unit |* a/$+(* *) :: maybe
$@($~ {$~ u/a}) ::
2013-09-29 00:21:18 +04:00
++ upas :: tree change (%d)
2015-12-20 23:50:45 +03:00
$^ {p/upas q/upas} :: cell
$% {$0 p/axis} :: copy old
{$1 p/*} :: insert new
{$2 p/axis q/udon} :: mutate!
2013-09-29 00:21:18 +04:00
== ::
2015-12-20 23:50:45 +03:00
++ urge |*(a/$+(* *) (list (unce a))) :: list change
2015-12-26 13:07:50 +03:00
++ vase {p/span q/*} :: span-value pair
2015-12-20 23:50:45 +03:00
++ vise {p/typo q/*} :: old vase
2014-03-12 23:44:08 +04:00
++ wall (list tape) :: text lines (no \n)
++ wain (list cord) :: text lines (no \n)
2016-01-03 09:20:24 +03:00
++ vial ?($read $rite $both $free) :: co/contra/in/bi
++ vair ?($gold $iron $lead $zinc) :: in/contra/bi/co
2015-12-25 11:26:07 +03:00
++ vein (list (unit axis)) :: search trace
++ wing (list limb) :: search path
2015-12-20 23:50:45 +03:00
++ wonk |*(veq/edge ?~(q.veq !! p.u.q.veq)) ::
2015-01-15 22:10:29 +03:00
++ worm :: compiler cache
2015-12-20 23:50:45 +03:00
$: nes/(set ^) :: ++nest
2015-12-26 13:07:50 +03:00
pay/(map (pair span twig) span) :: ++play
mit/(map (pair span twig) (pair span nock)) :: ++mint
2015-01-15 22:10:29 +03:00
== ::
2014-04-22 02:25:35 +04:00
:: ::
2015-12-20 23:50:45 +03:00
++ map |* {a/$+(* *) b/$+(* *)} :: associative tree
$@($~ {n/{p/a q/b} l/(map a b) r/(map a b)}) ::
++ qeu |* a/$+(* *) :: queue
$@($~ {n/a l/(qeu a) r/(qeu a)}) ::
++ set |* a/$+(* *) :: set
$@($~ {n/a l/(set a) r/(set a)}) ::
++ jar |*({a/$+(* *) b/$+(* *)} (map a (list b))) :: map of lists
++ jug |*({a/$+(* *) b/$+(* *)} (map a (set b))) :: map of sets
2013-09-29 00:21:18 +04:00
-- ::
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::: :::::: volume 2, Hoon libraries and compiler ::::::
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
~% %hoon
+
==
2013-12-27 06:43:25 +04:00
%al al
2013-09-29 00:21:18 +04:00
%ap ap
%ut ut
2014-05-20 21:33:59 +04:00
%mute mute
2013-09-29 00:21:18 +04:00
%show show
==
|%
::::::::::::::::::::::::::::::::::::::::::::::::::::: ::
:::: chapter 2a, basic unsigned math ::::
:: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
++ add :: add
~/ %add
2015-12-20 23:50:45 +03:00
|= {a/@ b/@}
2013-09-29 00:21:18 +04:00
^- @
2014-09-03 04:12:38 +04:00
?: =(0 a) b
2013-09-29 00:21:18 +04:00
$(a (dec a), b +(b))
::
++ cap :: tree head
~/ %cap
2015-12-20 23:50:45 +03:00
|= a/@
2015-12-08 04:23:27 +03:00
^- ?($2 $3)
2013-12-14 01:11:26 +04:00
?- a
2015-12-04 01:58:42 +03:00
$2 %2
$3 %3
?($0 $1) !!
2013-12-14 01:11:26 +04:00
* $(a (div a 2))
2013-09-29 00:21:18 +04:00
==
::
++ dec :: decrement
~/ %dec
2015-12-20 23:50:45 +03:00
|= a/@
2013-09-29 00:21:18 +04:00
~| %decrement-underflow
?< =(0 a)
2013-12-17 08:48:40 +04:00
=+ b=0
2014-01-21 01:50:54 +04:00
|- ^- @
2014-09-03 04:12:38 +04:00
?: =(a +(b)) b
2013-09-29 00:21:18 +04:00
$(b +(b))
::
++ div :: divide
~/ %div
2015-12-04 01:58:42 +03:00
|: [a=`@`1 b=`@`1]
2013-09-29 00:21:18 +04:00
^- @
~| 'div'
?< =(0 b)
2013-12-17 08:48:40 +04:00
=+ c=0
2013-09-29 00:21:18 +04:00
|-
2014-09-03 04:12:38 +04:00
?: (lth a b) c
2013-09-29 00:21:18 +04:00
$(a (sub a b), c +(c))
::
++ gte :: greater-equal
2013-09-29 00:21:18 +04:00
~/ %gte
2015-12-20 23:50:45 +03:00
|= {a/@ b/@}
2013-09-29 00:21:18 +04:00
^- ?
!(lth a b)
::
++ gth :: greater-than
~/ %gth
2015-12-20 23:50:45 +03:00
|= {a/@ b/@}
2013-09-29 00:21:18 +04:00
^- ?
!(lte a b)
::
++ lte :: less-equal
~/ %lte
2015-12-20 23:50:45 +03:00
|= {a/@ b/@}
2013-09-29 00:21:18 +04:00
|(=(a b) (lth a b))
::
++ lth :: less-than
~/ %lth
2015-12-20 23:50:45 +03:00
|= {a/@ b/@}
2013-09-29 00:21:18 +04:00
^- ?
2015-06-12 20:56:30 +03:00
?& !=(a b)
|-
?| =(0 a)
?& !=(0 b)
2014-09-03 04:12:38 +04:00
$(a (dec a), b (dec b))
== == ==
2013-09-29 00:21:18 +04:00
::
++ mas :: tree body
~/ %mas
2015-12-20 23:50:45 +03:00
|= a/@
2013-09-29 00:21:18 +04:00
^- @
?- a
2015-12-04 01:58:42 +03:00
$1 !!
$2 1
$3 1
* (add (mod a 2) (mul $(a (div a 2)) 2))
2013-09-29 00:21:18 +04:00
==
::
++ max :: maximum
~/ %max
2015-12-20 23:50:45 +03:00
|= {a/@ b/@}
2013-09-29 00:21:18 +04:00
^- @
2014-09-03 04:12:38 +04:00
?: (gth a b) a
2013-09-29 00:21:18 +04:00
b
::
++ min :: minimum
~/ %min
2015-12-20 23:50:45 +03:00
|= {a/@ b/@}
2013-09-29 00:21:18 +04:00
^- @
2014-09-03 04:12:38 +04:00
?: (lth a b) a
2013-09-29 00:21:18 +04:00
b
::
++ mod :: remainder
~/ %mod
2015-12-04 01:58:42 +03:00
|: [a=`@`1 b=`@`1]
2013-09-29 00:21:18 +04:00
^- @
?< =(0 b)
(sub a (mul b (div a b)))
::
++ mul :: multiply
~/ %mul
2015-12-04 01:58:42 +03:00
|: [a=`@`1 b=`@`1]
2013-09-29 00:21:18 +04:00
^- @
2013-12-17 08:48:40 +04:00
=+ c=0
2013-09-29 00:21:18 +04:00
|-
2014-09-03 04:12:38 +04:00
?: =(0 a) c
2013-09-29 00:21:18 +04:00
$(a (dec a), c (add b c))
::
++ peg :: tree connect
~/ %peg
2015-12-20 23:50:45 +03:00
|= {a/@ b/@}
2013-09-29 00:21:18 +04:00
^- @
?- b
2015-12-08 05:11:14 +03:00
$1 a
$2 (mul a 2)
$3 +((mul a 2))
2013-09-29 00:21:18 +04:00
* (add (mod b 2) (mul $(b (div b 2)) 2))
==
::
++ sub :: subtract
~/ %sub
2015-12-20 23:50:45 +03:00
|= {a/@ b/@}
2013-09-29 00:21:18 +04:00
~| %subtract-underflow
^- @
2014-09-03 04:12:38 +04:00
?: =(0 b) a
2013-09-29 00:21:18 +04:00
$(a (dec a), b (dec b))
:::::::::::::::::::::::::::::::::::::::::::::::::::::: ::
:::: chapter 2b, basic containers ::::
:: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Section 2bA, units ::
::
2014-05-09 04:34:57 +04:00
++ biff :: apply
2015-12-20 23:50:45 +03:00
|* {a/(unit) b/$+(* (unit))}
2014-09-03 04:12:38 +04:00
?~ a ~
2014-05-09 04:34:57 +04:00
(b u.a)
::
2013-09-29 00:21:18 +04:00
++ bind :: argue
2015-12-20 23:50:45 +03:00
|* {a/(unit) b/gate}
2014-09-03 04:12:38 +04:00
?~ a ~
2013-09-29 00:21:18 +04:00
[~ u=(b u.a)]
::
++ bond :: replace
2015-12-20 23:50:45 +03:00
|* a/(trap)
|* b/(unit)
?~ b $:a
u.b
::
2014-07-09 11:37:47 +04:00
++ both :: all the above
2015-12-20 23:50:45 +03:00
|* {a/(unit) b/(unit)}
2014-07-09 11:37:47 +04:00
?~ a ~
?~ b ~
[~ u=[u.a u.b]]
::
2013-09-29 00:21:18 +04:00
++ clap :: combine
2015-12-20 23:50:45 +03:00
|* {a/(unit) b/(unit) c/_|=(^ +<-)}
2014-09-03 04:12:38 +04:00
?~ a b
?~ b a
2013-09-29 00:21:18 +04:00
[~ u=(c u.a u.b)]
::
++ drop :: enlist
2015-12-20 23:50:45 +03:00
|* a/(unit)
2014-09-03 04:12:38 +04:00
?~ a ~
2013-09-29 00:21:18 +04:00
[i=u.a t=~]
::
++ fall :: default
2015-12-20 23:50:45 +03:00
|* {a/(unit) b/*}
2013-09-29 00:21:18 +04:00
?~(a b u.a)
::
++ flit :: make filter
2015-12-20 23:50:45 +03:00
|* a/$+(* ?)
|* b/*
?.((a b) ~ [~ u=b])
::
2014-07-29 22:16:35 +04:00
++ lift :: lift gate (fmap)
2015-12-20 23:50:45 +03:00
|* a/gate :: flipped
|* b/(unit) :: curried
2014-07-29 22:16:35 +04:00
(bind b a) :: bind
::
2013-09-29 00:21:18 +04:00
++ mate :: choose
2015-12-20 23:50:45 +03:00
|* {a/(unit) b/(unit)}
2014-09-03 04:12:38 +04:00
?~ b a
?~ a b
2013-09-29 00:21:18 +04:00
?.(=(u.a u.b) ~|('mate' !!) a)
::
++ need :: demand
2015-12-20 23:50:45 +03:00
|* a/(unit)
2015-02-27 09:35:41 +03:00
?~ a ~|(%need !!)
2013-09-29 00:21:18 +04:00
u.a
::
2014-07-29 22:16:35 +04:00
++ some :: lift (pure)
2015-12-20 23:50:45 +03:00
|* a/*
2013-09-29 00:21:18 +04:00
[~ u=a]
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Section 2bB, lists ::
::
++ flop :: reverse
~/ %flop
2015-12-20 23:50:45 +03:00
|* a/(list)
2013-09-29 00:21:18 +04:00
=> .(a (homo a))
^+ a
2015-12-15 01:21:10 +03:00
=+ b=`_a`~
2013-09-29 00:21:18 +04:00
|-
2014-09-03 04:12:38 +04:00
?~ a b
2013-09-29 00:21:18 +04:00
$(a t.a, b [i.a b])
::
++ homo :: homogenize
2015-12-20 23:50:45 +03:00
|* a/(list)
2016-01-02 01:47:07 +03:00
^+ =< $
|% +- $ ?:(*? ~ [i=(snag 0 a) t=$])
--
2013-09-29 00:21:18 +04:00
a
::
2013-12-21 06:35:33 +04:00
++ limo :: listify
2015-12-20 23:50:45 +03:00
|* a/*
2016-01-02 01:47:07 +03:00
^+ =< $
|% +- $ ?~(a ~ ?:(*? [i=-.a t=$] $(a +.a)))
2013-12-21 06:35:33 +04:00
--
a
::
2013-09-29 00:21:18 +04:00
++ lent :: length
~/ %lent
2015-12-20 23:50:45 +03:00
|= a/(list)
2013-09-29 00:21:18 +04:00
^- @
2013-12-17 08:48:40 +04:00
=+ b=0
2013-09-29 00:21:18 +04:00
|-
2015-06-12 20:56:30 +03:00
?~ a b
2014-09-03 04:12:38 +04:00
$(a t.a, b +(b))
2013-09-29 00:21:18 +04:00
::
++ levy
~/ %levy :: all of
2015-12-20 23:50:45 +03:00
|* {a/(list) b/$+(* ?)}
2013-09-29 00:21:18 +04:00
|- ^- ?
2014-09-03 04:12:38 +04:00
?~ a &
?. (b i.a) |
$(a t.a)
2013-09-29 00:21:18 +04:00
::
++ lien :: some of
~/ %lien
2015-12-20 23:50:45 +03:00
|* {a/(list) b/$+(* ?)}
2013-09-29 00:21:18 +04:00
|- ^- ?
2013-11-03 05:29:28 +04:00
?~ a |
?: (b i.a) &
2013-09-29 00:21:18 +04:00
$(a t.a)
::
++ murn :: maybe transform
2015-09-14 21:31:02 +03:00
~/ %murn
2015-12-20 23:50:45 +03:00
|* {a/(list) b/$+(* (unit))}
|-
2014-09-03 04:12:38 +04:00
?~ a ~
=+ c=(b i.a)
?~ c
$(a t.a)
[i=u.c t=$(a t.a)]
2014-07-02 19:11:23 +04:00
::
++ reap :: replicate
2015-09-16 23:29:39 +03:00
~/ %reap
2015-12-20 23:50:45 +03:00
|* {a/@ b/*}
2015-12-15 01:21:10 +03:00
|- ^- (list _b)
2014-10-14 04:48:22 +04:00
?~ a ~
[b $(a (dec a))]
::
2013-09-29 00:21:18 +04:00
++ reel :: right fold
~/ %reel
2015-12-20 23:50:45 +03:00
|* {a/(list) b/_|=({* *} +<+)}
|- ^+ +<+.b
2014-06-07 05:09:44 +04:00
?~ a
+<+.b
2013-09-29 00:21:18 +04:00
(b i.a $(a t.a))
::
++ roll :: left fold
~/ %roll
2015-12-20 23:50:45 +03:00
|* {a/(list) b/_|=({* *} +<+)}
|- ^+ +<+.b
2014-06-07 05:09:44 +04:00
?~ a
+<+.b
$(a t.a, b b(+<+ (b i.a +<+.b)))
2013-09-29 00:21:18 +04:00
::
2015-01-13 01:49:05 +03:00
++ skid :: separate
2015-09-19 19:50:39 +03:00
~/ %skid
2015-12-20 23:50:45 +03:00
|* {a/(list) b/$+(* ?)}
2015-01-13 01:49:05 +03:00
|- ^+ [p=a q=a]
?~ a [~ ~]
=+ c=$(a t.a)
?:((b i.a) [[i.a p.c] q.c] [p.c [i.a q.c]])
::
2013-09-29 00:21:18 +04:00
++ skim :: only
~/ %skim
2015-12-20 23:50:45 +03:00
|* {a/(list) b/$+(* ?)}
|-
^+ a
2014-09-03 04:12:38 +04:00
?~ a ~
?:((b i.a) [i.a $(a t.a)] $(a t.a))
2013-09-29 00:21:18 +04:00
::
++ skip :: except
~/ %skip
2015-12-20 23:50:45 +03:00
|* {a/(list) b/$+(* ?)}
|-
^+ a
2014-09-03 04:12:38 +04:00
?~ a ~
?:((b i.a) $(a t.a) [i.a $(a t.a)])
2013-09-29 00:21:18 +04:00
::
++ scag :: prefix
2014-05-27 21:22:21 +04:00
~/ %scag
2015-12-20 23:50:45 +03:00
|* {a/@ b/(list)}
2013-12-20 21:34:13 +04:00
|- ^+ b
2015-12-05 02:59:29 +03:00
?: |(?=($~ b) =(0 a)) ~
2013-09-29 00:21:18 +04:00
[i.b $(b t.b, a (dec a))]
::
2013-09-29 00:21:18 +04:00
++ slag :: suffix
2014-05-27 00:33:17 +04:00
~/ %slag
2015-12-20 23:50:45 +03:00
|* {a/@ b/(list)}
2013-12-20 21:34:13 +04:00
|- ^+ b
2014-09-03 04:12:38 +04:00
?: =(0 a) b
?~ b ~
2013-09-29 00:21:18 +04:00
$(b t.b, a (dec a))
::
++ snag :: index
~/ %snag
2015-12-20 23:50:45 +03:00
|* {a/@ b/(list)}
2013-12-20 21:34:13 +04:00
|-
?~ b
~|('snag-fail' !!)
2014-09-03 04:12:38 +04:00
?: =(0 a) i.b
2013-09-29 00:21:18 +04:00
$(b t.b, a (dec a))
::
++ sort !. :: quicksort
2013-09-29 00:21:18 +04:00
~/ %sort
2015-12-20 23:50:45 +03:00
|* {a/(list) b/$+([* *] ?)}
2014-01-21 01:50:54 +04:00
=> .(a ^.(homo a))
2013-09-29 00:21:18 +04:00
|- ^+ a
?~ a ~
%+ weld
2015-12-20 23:50:45 +03:00
$(a (skim t.a |=(c/_i.a (b c i.a))))
2013-12-24 00:49:15 +04:00
^+ t.a
2015-12-20 23:50:45 +03:00
[i.a $(a (skim t.a |=(c/_i.a !(b c i.a))))]
2013-09-29 00:21:18 +04:00
::
++ swag :: infix
2015-12-20 23:50:45 +03:00
|* {{a/@ b/@} c/(list)}
2013-09-29 00:21:18 +04:00
(scag b (slag a c))
::
++ turn :: transform
~/ %turn
2015-12-20 23:50:45 +03:00
|* {a/(list) b/$+(* *)}
2013-09-29 00:21:18 +04:00
|-
2014-09-03 04:12:38 +04:00
?~ a ~
2013-09-29 00:21:18 +04:00
[i=(b i.a) t=$(a t.a)]
::
++ weld :: concatenate
~/ %weld
2015-12-20 23:50:45 +03:00
|* {a/(list) b/(list)}
2014-01-21 01:50:54 +04:00
=> .(a ^.(homo a), b ^.(homo b))
|- ^+ b
?~ a b
2013-09-29 00:21:18 +04:00
[i.a $(a t.a)]
2014-01-21 01:50:54 +04:00
::
2014-04-03 05:06:45 +04:00
++ welp :: perfect weld
2015-12-04 01:58:42 +03:00
=| {* *}
2014-04-03 05:06:45 +04:00
|%
+- $
?~ +<-
+<-(. +<+)
+<-(+ $(+<- +<->))
--
::
2014-03-08 04:31:36 +04:00
++ zing :: promote
=| *
|%
+- $
?~ +<
+<
(welp +<- $(+< +<+))
--
2013-09-29 00:21:18 +04:00
:::::::::::::::::::::::::::::::::::::::::::::::::::::: ::
:::: chapter 2c, simple noun surgery ::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2cA, bit surgery ::
::
++ bex :: binary exponent
~/ %bex
2015-12-20 23:50:45 +03:00
|= a/@
2013-09-29 00:21:18 +04:00
^- @
2014-09-03 04:12:38 +04:00
?: =(0 a) 1
2013-09-29 00:21:18 +04:00
(mul 2 $(a (dec a)))
::
2014-05-02 09:41:33 +04:00
++ xeb :: binary logarithm
2015-08-27 13:31:10 +03:00
~/ %xeb
2015-12-20 23:50:45 +03:00
|= a/@
2014-05-02 09:41:33 +04:00
^- @
(met 0 a)
::
2013-09-29 00:21:18 +04:00
++ can :: assemble
~/ %can
2015-12-20 23:50:45 +03:00
|= {a/bloq b/(list {p/@u q/@})}
2013-09-29 00:21:18 +04:00
^- @
2014-09-03 04:12:38 +04:00
?~ b 0
2013-09-29 00:21:18 +04:00
(mix (end a p.i.b q.i.b) (lsh a p.i.b $(b t.b)))
::
++ cat :: concatenate
~/ %cat
2015-12-20 23:50:45 +03:00
|= {a/bloq b/@ c/@}
2013-09-29 00:21:18 +04:00
(add (lsh a (met a b) c) b)
::
++ cut :: slice
~/ %cut
2015-12-20 23:50:45 +03:00
|= {a/bloq {b/@u c/@u} d/@}
2013-09-29 00:21:18 +04:00
(end a c (rsh a b d))
::
++ end :: tail
~/ %end
2015-12-20 23:50:45 +03:00
|= {a/bloq b/@u c/@}
2013-09-29 00:21:18 +04:00
(mod c (bex (mul (bex a) b)))
::
2014-05-02 08:16:40 +04:00
++ fil :: fill bloqstream
2015-12-20 23:50:45 +03:00
|= {a/bloq b/@u c/@}
2014-05-02 08:16:40 +04:00
=+ n=0
=+ d=c
|- ^- @
?: =(n b)
(rsh a 1 d)
$(d (add c (lsh a 1 d)), n +(n))
2014-05-02 10:42:44 +04:00
::
2013-09-29 00:21:18 +04:00
++ lsh :: left-shift
~/ %lsh
2015-12-20 23:50:45 +03:00
|= {a/bloq b/@u c/@}
2013-09-29 00:21:18 +04:00
(mul (bex (mul (bex a) b)) c)
::
++ met :: measure
~/ %met
2015-12-20 23:50:45 +03:00
|= {a/bloq b/@}
2013-09-29 00:21:18 +04:00
^- @
=+ c=0
|-
2014-09-03 04:12:38 +04:00
?: =(0 b) c
2013-09-29 00:21:18 +04:00
$(b (rsh a 1 b), c +(c))
::
++ rap :: assemble nonzero
~/ %rap
2015-12-20 23:50:45 +03:00
|= {a/bloq b/(list @)}
2013-09-29 00:21:18 +04:00
^- @
2014-09-03 04:12:38 +04:00
?~ b 0
2013-09-29 00:21:18 +04:00
(cat a i.b $(b t.b))
::
++ rep :: assemble single
~/ %rep
2015-12-20 23:50:45 +03:00
|= {a/bloq b/(list @)}
2013-09-29 00:21:18 +04:00
^- @
=+ c=0
|-
2014-09-03 04:12:38 +04:00
?~ b 0
2013-09-29 00:21:18 +04:00
(con (lsh a c (end a 1 i.b)) $(c +(c), b t.b))
::
++ rip :: disassemble
~/ %rip
2015-12-20 23:50:45 +03:00
|= {a/bloq b/@}
2015-12-04 18:16:34 +03:00
^- (list @)
2014-09-03 04:12:38 +04:00
?: =(0 b) ~
2013-09-29 00:21:18 +04:00
[(end a 1 b) $(b (rsh a 1 b))]
::
++ rsh :: right-shift
~/ %rsh
2015-12-20 23:50:45 +03:00
|= {a/bloq b/@u c/@}
2013-09-29 00:21:18 +04:00
(div c (bex (mul (bex a) b)))
2014-05-02 08:17:49 +04:00
::
2015-12-20 23:50:45 +03:00
++ swap |=({a/bloq b/@} (rep a (flop (rip a b)))) :: reverse bloq order
2014-05-02 08:16:40 +04:00
::
2013-09-29 00:21:18 +04:00
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2cB, bit logic ::
::
++ con :: binary or
~/ %con
2015-12-20 23:50:45 +03:00
|= {a/@ b/@}
2013-09-29 00:21:18 +04:00
=+ [c=0 d=0]
|- ^- @
2014-09-03 04:12:38 +04:00
?: ?&(=(0 a) =(0 b)) d
2013-09-29 00:21:18 +04:00
%= $
a (rsh 0 1 a)
b (rsh 0 1 b)
c +(c)
2015-06-12 20:56:30 +03:00
d %+ add d
%^ lsh 0 c
?& =(0 (end 0 1 a))
2014-09-03 04:12:38 +04:00
=(0 (end 0 1 b))
==
2013-09-29 00:21:18 +04:00
==
::
++ dis :: binary and
~/ %dis
2015-12-20 23:50:45 +03:00
|= {a/@ b/@}
=| {c/@ d/@}
2013-09-29 00:21:18 +04:00
|- ^- @
2014-09-03 04:12:38 +04:00
?: ?|(=(0 a) =(0 b)) d
2013-09-29 00:21:18 +04:00
%= $
a (rsh 0 1 a)
b (rsh 0 1 b)
c +(c)
2015-06-12 20:56:30 +03:00
d %+ add d
%^ lsh 0 c
?| =(0 (end 0 1 a))
2014-09-03 04:12:38 +04:00
=(0 (end 0 1 b))
==
2013-09-29 00:21:18 +04:00
==
::
++ mix :: binary xor
~/ %mix
2015-12-20 23:50:45 +03:00
|= {a/@ b/@}
2013-09-29 00:21:18 +04:00
^- @
=+ [c=0 d=0]
|-
2014-09-03 04:12:38 +04:00
?: ?&(=(0 a) =(0 b)) d
2013-09-29 00:21:18 +04:00
%= $
a (rsh 0 1 a)
b (rsh 0 1 b)
c +(c)
d (add d (lsh 0 c =((end 0 1 a) (end 0 1 b))))
==
::
2015-12-20 23:50:45 +03:00
++ not |= {a/bloq b/@ c/@} :: binary not (sized)
(mix c (dec (bex (mul b (bex a)))))
::
2013-09-29 00:21:18 +04:00
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2cC, noun orders ::
::
++ aor :: a-order
~/ %aor
2015-12-20 23:50:45 +03:00
|= {a/* b/*}
2013-09-29 00:21:18 +04:00
^- ?
2014-09-03 04:12:38 +04:00
?: =(a b) &
2013-09-29 00:21:18 +04:00
?. ?=(@ a)
2014-09-03 04:12:38 +04:00
?: ?=(@ b) |
?: =(-.a -.b)
$(a +.a, b +.b)
$(a -.a, b -.b)
?. ?=(@ b) &
2013-09-29 00:21:18 +04:00
|-
=+ [c=(end 3 1 a) d=(end 3 1 b)]
?: =(c d)
$(a (rsh 3 1 a), b (rsh 3 1 b))
2013-09-29 00:21:18 +04:00
(lth c d)
::
2013-09-29 00:21:18 +04:00
++ dor :: d-order
~/ %dor
2015-12-20 23:50:45 +03:00
|= {a/* b/*}
2013-09-29 00:21:18 +04:00
^- ?
2014-09-03 04:12:38 +04:00
?: =(a b) &
2013-09-29 00:21:18 +04:00
?. ?=(@ a)
2014-09-03 04:12:38 +04:00
?: ?=(@ b) |
?: =(-.a -.b)
$(a +.a, b +.b)
$(a -.a, b -.b)
?. ?=(@ b) &
2013-09-29 00:21:18 +04:00
(lth a b)
::
++ gor :: g-order
~/ %gor
2015-12-20 23:50:45 +03:00
|= {a/* b/*}
2013-09-29 00:21:18 +04:00
^- ?
=+ [c=(mug a) d=(mug b)]
?: =(c d)
(dor a b)
(lth c d)
::
++ hor :: h-order
~/ %hor
2015-12-20 23:50:45 +03:00
|= {a/* b/*}
2013-09-29 00:21:18 +04:00
^- ?
?: ?=(@ a)
2014-09-03 04:12:38 +04:00
?. ?=(@ b) &
(gor a b)
?: ?=(@ b) |
2013-09-29 00:21:18 +04:00
?: =(-.a -.b)
(gor +.a +.b)
(gor -.a -.b)
::
2015-11-29 01:44:29 +03:00
++ lor :: l-order
~/ %lor
2015-12-20 23:50:45 +03:00
|= {a/* b/*}
2015-11-29 01:44:29 +03:00
^- ?
?: =(a b) &
?@ a
?^ b &
(lth a b)
?: =(-.a -.b)
$(a +.a, b +.b)
$(a -.a, b -.b)
::
2013-09-29 00:21:18 +04:00
++ vor :: v-order
~/ %vor
2015-12-20 23:50:45 +03:00
|= {a/* b/*}
2013-09-29 00:21:18 +04:00
^- ?
=+ [c=(mug (mug a)) d=(mug (mug b))]
?: =(c d)
(dor a b)
(lth c d)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2cD, insecure hashing ::
::
2015-12-20 23:50:45 +03:00
++ fnv |=(a/@ (end 5 1 (mul 16.777.619 a))) :: FNV scrambler
2014-09-03 00:13:12 +04:00
::
++ mum :: mug with murmur3
~/ %mum
2015-12-20 23:50:45 +03:00
|= a/*
2014-09-03 00:13:12 +04:00
|^ (trim ?@(a a (mix $(a -.a) (mix 0x7fff.ffff $(a +.a)))))
++ spec :: standard murmur3
2015-12-20 23:50:45 +03:00
|= {syd/@ key/@}
2014-09-03 00:13:12 +04:00
?> (lte (met 5 syd) 1)
=+ ^= row
2015-12-20 23:50:45 +03:00
|= {a/@ b/@}
2014-09-03 00:13:12 +04:00
(con (end 5 1 (lsh 0 a b)) (rsh 0 (sub 32 a) b))
2015-12-20 23:50:45 +03:00
=+ mow=|=({a/@ b/@} (end 5 1 (mul a b)))
2014-09-03 00:13:12 +04:00
=+ len=(met 5 key)
=- =. goc (mix goc len)
=. goc (mix goc (rsh 4 1 goc))
=. goc (mow goc 0x85eb.ca6b)
=. goc (mix goc (rsh 0 13 goc))
=. goc (mow goc 0xc2b2.ae35)
(mix goc (rsh 4 1 goc))
^= goc
=+ [inx=0 goc=syd]
|- ^- @
?: =(inx len) goc
=+ kop=(cut 5 [inx 1] key)
=. kop (mow kop 0xcc9e.2d51)
2015-06-12 20:56:30 +03:00
=. kop (row 15 kop)
2014-09-03 00:13:12 +04:00
=. kop (mow kop 0x1b87.3593)
=. goc (mix kop goc)
=. goc (row 13 goc)
=. goc (end 5 1 (add 0xe654.6b64 (mul 5 goc)))
$(inx +(inx))
::
++ trim :: 31-bit nonzero
2015-12-20 23:50:45 +03:00
|= key/@
2014-09-03 00:13:12 +04:00
=+ syd=0xcafe.babe
|- ^- @
=+ haz=(spec syd key)
=+ ham=(mix (rsh 0 31 haz) (end 0 31 haz))
?.(=(0 ham) ham $(syd +(syd)))
--
2014-08-26 23:11:59 +04:00
::
2013-09-29 00:21:18 +04:00
++ mug :: 31bit nonzero FNV1a
~/ %mug
2015-12-20 23:50:45 +03:00
|= a/*
2013-09-29 00:21:18 +04:00
?^ a
=+ b=[p=$(a -.a) q=$(a +.a)]
|- ^- @
=+ c=(fnv (mix p.b (fnv q.b)))
=+ d=(mix (rsh 0 31 c) (end 0 31 c))
?. =(0 c) c
$(q.b +(q.b))
=+ b=2.166.136.261
|- ^- @
=+ c=b
=+ [d=0 e=(met 3 a)]
|- ^- @
?: =(d e)
=+ f=(mix (rsh 0 31 c) (end 0 31 c))
?. =(0 f) f
^$(b +(b))
$(c (fnv (mix c (cut 3 [d 1] a))), d +(d))
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2cE, phonetic base ::
::
++ po
~/ %po
2014-09-03 04:12:38 +04:00
=+ :- ^= sis :: prefix syllables
'dozmarbinwansamlitsighidfidlissogdirwacsabwissib\
/rigsoldopmodfoglidhopdardorlorhodfolrintogsilmir\
/holpaslacrovlivdalsatlibtabhanticpidtorbolfosdot\
/losdilforpilramtirwintadbicdifrocwidbisdasmidlop\
/rilnardapmolsanlocnovsitnidtipsicropwitnatpanmin\
/ritpodmottamtolsavposnapnopsomfinfonbanporworsip\
/ronnorbotwicsocwatdolmagpicdavbidbaltimtasmallig\
/sivtagpadsaldivdactansidfabtarmonranniswolmispal\
/lasdismaprabtobrollatlonnodnavfignomnibpagsopral\
/bilhaddocridmocpacravripfaltodtiltinhapmicfanpat\
/taclabmogsimsonpinlomrictapfirhasbosbatpochactid\
/havsaplindibhosdabbitbarracparloddosbortochilmac\
/tomdigfilfasmithobharmighinradmashalraglagfadtop\
/mophabnilnosmilfopfamdatnoldinhatnacrisfotribhoc\
/nimlarfitwalrapsarnalmoslandondanladdovrivbacpol\
/laptalpitnambonrostonfodponsovnocsorlavmatmipfap'
^= dex :: suffix syllables
2013-09-29 00:21:18 +04:00
'zodnecbudwessevpersutletfulpensytdurwepserwylsun\
/rypsyxdyrnuphebpeglupdepdysputlughecryttyvsydnex\
/lunmeplutseppesdelsulpedtemledtulmetwenbynhexfeb\
/pyldulhetmevruttylwydtepbesdexsefwycburderneppur\
/rysrebdennutsubpetrulsynregtydsupsemwynrecmegnet\
/secmulnymtevwebsummutnyxrextebfushepbenmuswyxsym\
/selrucdecwexsyrwetdylmynmesdetbetbeltuxtugmyrpel\
/syptermebsetdutdegtexsurfeltudnuxruxrenwytnubmed\
/lytdusnebrumtynseglyxpunresredfunrevrefmectedrus\
/bexlebduxrynnumpyxrygryxfeptyrtustyclegnemfermer\
/tenlusnussyltecmexpubrymtucfyllepdebbermughuttun\
/bylsudpemdevlurdefbusbeprunmelpexdytbyttyplevmyl\
/wedducfurfexnulluclennerlexrupnedlecrydlydfenwel\
/nydhusrelrudneshesfetdesretdunlernyrsebhulryllud\
/remlysfynwerrycsugnysnyllyndyndemluxfedsedbecmun\
/lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes'
|%
2015-06-18 00:54:02 +03:00
++ ins ~/ %ins :: parse prefix
2015-12-20 23:50:45 +03:00
|= a/@tas
2013-09-29 00:21:18 +04:00
=+ b=0
2015-12-04 18:16:34 +03:00
|- ^- (unit @)
2015-06-18 00:54:02 +03:00
?:(=(256 b) ~ ?:(=(a (tos b)) [~ b] $(b +(b))))
++ ind ~/ %ind :: parse suffix
2015-12-20 23:50:45 +03:00
|= a/@tas
2013-09-29 00:21:18 +04:00
=+ b=0
2015-12-04 18:16:34 +03:00
|- ^- (unit @)
2015-06-18 00:54:02 +03:00
?:(=(256 b) ~ ?:(=(a (tod b)) [~ b] $(b +(b))))
++ tos ~/ %tos :: fetch prefix
2015-12-20 23:50:45 +03:00
|=(a/@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] sis)))
2015-06-18 00:54:02 +03:00
++ tod ~/ %tod :: fetch suffix
2015-12-20 23:50:45 +03:00
|=(a/@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] dex)))
2013-09-29 00:21:18 +04:00
--
2015-02-25 05:08:20 +03:00
::
++ fa :: base58check
=+ key='123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
2015-12-20 23:50:45 +03:00
=+ ^- yek/@ux ~+
2015-02-25 05:08:20 +03:00
=- yek:(roll (trip key) -)
2015-12-04 01:58:42 +03:00
|: [a=*char b=*@ yek=`@ux`(fil 3 256 0xff)]
2015-02-25 05:08:20 +03:00
[+(b) (mix yek (lsh 3 `@u`a (~(inv fe 3) b)))]
|%
2015-12-20 23:50:45 +03:00
++ cha |=(a/char `(unit @uF)`=+(b=(cut 3 [`@`a 1] yek) ?:(=(b 0xff) ~ `b)))
2015-02-25 05:08:20 +03:00
++ tok
2015-12-20 23:50:45 +03:00
|= a/@ux ^- @ux
2015-02-25 05:08:20 +03:00
=+ b=(pad a)
=- (~(net fe 5) (end 3 4 (shay 32 -)))
(shay (add b (met 3 a)) (lsh 3 b (swap 3 a)))
::
2015-12-20 23:50:45 +03:00
++ pad |=(a/@ =+(b=(met 3 a) ?:((gte b 21) 0 (sub 21 b))))
++ enc |=(a/@ux `@ux`(mix (lsh 3 4 a) (tok a)))
2015-06-12 20:56:30 +03:00
++ den
2015-12-20 23:50:45 +03:00
|= a/@ux ^- (unit @ux)
2015-02-25 05:08:20 +03:00
=+ b=(rsh 3 4 a)
?. =((tok b) (end 3 4 a))
~
`b
--
2013-09-29 00:21:18 +04:00
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2cF, signed and modular ints ::
::
2015-10-27 01:26:49 +03:00
++ si !: :: signed integer
2013-09-29 00:21:18 +04:00
|%
2015-12-20 23:50:45 +03:00
++ abs |=(a/@s (add (end 0 1 a) (rsh 0 1 a))) :: absolute value
++ dif |= {a/@s b/@s} :: subtraction
2014-04-04 14:00:26 +04:00
(sum a (new !(syn b) (abs b)))
2015-12-20 23:50:45 +03:00
++ dul |= {a/@s b/@} :: modulus
2014-04-04 14:00:26 +04:00
=+(c=(old a) ?:(-.c (mod +.c b) (sub b +.c)))
2015-12-20 23:50:45 +03:00
++ fra |= {a/@s b/@s} :: divide
2013-09-29 00:21:18 +04:00
(new =(0 (mix (syn a) (syn b))) (div (abs a) (abs b)))
2015-12-20 23:50:45 +03:00
++ new |= {a/? b/@} :: [sign value] to @s
2014-04-04 14:00:26 +04:00
`@s`?:(a (mul 2 b) ?:(=(0 b) 0 +((mul 2 (dec b)))))
2015-12-20 23:50:45 +03:00
++ old |=(a/@s [(syn a) (abs a)]) :: [sign value]
++ pro |= {a/@s b/@s} :: multiplication
2013-09-29 00:21:18 +04:00
(new =(0 (mix (syn a) (syn b))) (mul (abs a) (abs b)))
2015-12-20 23:50:45 +03:00
++ rem |=({a/@s b/@s} (dif a (pro b (fra a b)))) :: remainder
++ sum |= {a/@s b/@s} :: addition
2013-09-29 00:21:18 +04:00
~| %si-sum
=+ [c=(old a) d=(old b)]
?: -.c
?: -.d
(new & (add +.c +.d))
?: (gte +.c +.d)
(new & (sub +.c +.d))
(new | (sub +.d +.c))
?: -.d
?: (gte +.c +.d)
(new | (sub +.c +.d))
(new & (sub +.d +.c))
(new | (add +.c +.d))
2015-12-20 23:50:45 +03:00
++ sun |=(a/@u (mul 2 a)) :: @u to @s
++ syn |=(a/@s =(0 (end 0 1 a))) :: sign test
++ cmp |= {a/@s b/@s} :: compare
^- @s
?: =(a b)
--0
?: (syn a)
?: (syn b)
?: (gth a b)
--1
-1
--1
?: (syn b)
-1
?: (gth a b)
-1
--1
2013-09-29 00:21:18 +04:00
--
++ fe :: modulo bloq
2015-12-20 23:50:45 +03:00
|_ a/bloq
++ dif |=({b/@ c/@} (sit (sub (add out (sit b)) (sit c)))) :: difference
++ inv |=(b/@ (sub (dec out) (sit b))) :: inverse
++ net |= b/@ ^- @ :: flip byte endianness
2013-09-29 00:21:18 +04:00
=> .(b (sit b))
?: (lte a 3)
b
=+ c=(dec a)
2013-09-29 00:21:18 +04:00
%+ con
(lsh c 1 $(a c, b (cut c [0 1] b)))
$(a c, b (cut c [1 1] b))
2014-10-04 05:22:37 +04:00
++ out (bex (bex a)) :: mod value
2015-12-20 23:50:45 +03:00
++ rol |= {b/bloq c/@ d/@} ^- @ :: roll left
2014-01-25 02:08:37 +04:00
=+ e=(sit d)
=+ f=(bex (sub a b))
=+ g=(mod c f)
(sit (con (lsh b g e) (rsh b (sub f g) e)))
2015-12-20 23:50:45 +03:00
++ ror |= {b/bloq c/@ d/@} ^- @ :: roll right
2014-01-25 02:08:37 +04:00
=+ e=(sit d)
=+ f=(bex (sub a b))
=+ g=(mod c f)
(sit (con (rsh b g e) (lsh b (sub f g) e)))
2015-12-20 23:50:45 +03:00
++ sum |=({b/@ c/@} (sit (add b c))) :: wrapping add
++ sit |=(b/@ (end a 1 b)) :: enforce modulo
2013-09-29 00:21:18 +04:00
--
2015-05-29 11:36:23 +03:00
::
++ stat :: positive counter
2015-12-20 23:50:45 +03:00
|* a/$+(* *)
2015-12-04 01:58:42 +03:00
|= (trel ? a (map a @ud))
2015-05-29 11:36:23 +03:00
^+ r
=+ (~(get by r) q)
2015-06-12 20:56:30 +03:00
?: p
2015-05-29 11:36:23 +03:00
(~(put by r) q ?~(- 1 +(u.-)))
2015-06-12 20:56:30 +03:00
?> ?=(^ -)
2015-05-29 11:36:23 +03:00
?:(=(0 u.-) (~(del by r) q) (~(put by r) q (dec u.-)))
2013-09-29 00:21:18 +04:00
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2cG, floating point ::
::
2015-07-12 20:26:23 +03:00
++ fn :: float, infinity, or NaN
:: s=sign, e=exponent, a=arithmetic form
:: (-1)^s * a * 2^e
2015-12-20 23:50:45 +03:00
$% {$f s/? e/@s a/@u}
{$i s/?}
2015-12-04 01:58:42 +03:00
{$n $~}
2015-07-12 20:26:23 +03:00
==
::
++ dn :: decimal float, infinity, or NaN
:: (-1)^s * a * 10^e
2015-12-20 23:50:45 +03:00
$% {$d s/? e/@s a/@u}
{$i s/?}
2015-12-04 01:58:42 +03:00
{$n $~}
2015-07-12 20:26:23 +03:00
==
::
2015-12-04 02:53:57 +03:00
++ rn :: parsed decimal float
::
2015-12-20 23:50:45 +03:00
$% {$d a/? b/{c/@ {d/@ e/@} f/? i/@}}
{$i a/?}
2015-12-04 02:53:57 +03:00
{$n $~}
==
::
++ fl :: arb. precision fp
2015-12-20 23:50:45 +03:00
=+ ^- {{p/@u v/@s w/@u} r/$?($n $u $d $z $a) d/$?($d $f $i)}
2015-07-12 20:26:23 +03:00
[[113 -16.494 32.765] %n %d]
:: p=precision: number of bits in arithmetic form; must be at least 2
:: v=min exponent: minimum value of e
:: w=width: max - min value of e, 0 is fixed point
:: r=rounding mode: nearest (ties to even), up, down, to zero, away from zero
:: d=behavior: return denormals, flush denormals to zero,
:: infinite exponent range
2015-07-30 01:10:30 +03:00
=>
2015-07-31 05:01:20 +03:00
~% %cofl +> ~
2015-12-20 23:50:45 +03:00
:: internal functions; mostly operating on {e/@s a/@u}, in other words
2015-08-06 21:21:47 +03:00
:: positive numbers. many of these have undefined behavior if a=0.
|%
2015-07-12 20:26:23 +03:00
++ rou
2015-12-20 23:50:45 +03:00
|= {a/{e/@s a/@u}} ^- fn (rau a &)
2015-07-12 20:26:23 +03:00
::
++ rau
2015-12-20 23:50:45 +03:00
|= {a/{e/@s a/@u} t/?} ^- fn
2015-07-12 20:26:23 +03:00
?- r
2015-12-08 04:23:27 +03:00
$z (lug %fl a t) $d (lug %fl a t)
$a (lug %ce a t) $u (lug %ce a t)
$n (lug %ne a t)
2015-07-12 20:26:23 +03:00
==
::
2015-08-06 21:21:47 +03:00
++ add :: add; exact if e
2015-12-20 23:50:45 +03:00
|= {a/{e/@s a/@u} b/{e/@s a/@u} e/?} ^- fn
2015-07-12 20:26:23 +03:00
=+ q=(dif:si e.a e.b)
|- ?. (syn:si q) $(b a, a b, q +(q)) :: a has larger exp
2015-07-12 20:26:23 +03:00
?: e
2015-07-30 01:10:30 +03:00
[%f & e.b (^add (lsh 0 (abs:si q) a.a) a.b)]
2015-07-12 20:26:23 +03:00
=+ [ma=(met 0 a.a) mb=(met 0 a.b)]
=+ ^= w %+ dif:si e.a %- sun:si :: expanded exp of a
2015-07-30 01:10:30 +03:00
?: (gth prc ma) (^sub prc ma) 0
=+ ^= x %+ sum:si e.b (sun:si mb) :: highest exp for b
?: =((cmp:si w x) --1) :: don't need to add
2015-07-12 20:26:23 +03:00
?- r
2015-12-04 01:58:42 +03:00
$z (lug %fl a &) $d (lug %fl a &)
$a (lug %lg a &) $u (lug %lg a &)
$n (lug %na a &)
2015-07-12 20:26:23 +03:00
==
2015-07-30 01:10:30 +03:00
(rou [e.b (^add (lsh 0 (abs:si q) a.a) a.b)])
2015-07-12 20:26:23 +03:00
::
2015-08-06 21:21:47 +03:00
++ sub :: subtract; exact if e
2015-12-20 23:50:45 +03:00
|= {a/{e/@s a/@u} b/{e/@s a/@u} e/?} ^- fn
2015-07-12 20:26:23 +03:00
=+ q=(dif:si e.a e.b)
|- ?. (syn:si q)
(fli $(b a, a b, q +(q), r swr))
=+ [ma=(met 0 a.a) mb=(met 0 a.b)]
=+ ^= w %+ dif:si e.a %- sun:si
2015-07-30 01:10:30 +03:00
?: (gth prc ma) (^sub prc ma) 0
2015-07-12 20:26:23 +03:00
=+ ^= x %+ sum:si e.b (sun:si mb)
?: &(!e =((cmp:si w x) --1))
?- r
2015-12-04 01:58:42 +03:00
$z (lug %sm a &) $d (lug %sm a &)
$a (lug %ce a &) $u (lug %ce a &)
$n (lug %nt a &)
2015-07-12 20:26:23 +03:00
==
=+ j=(lsh 0 (abs:si q) a.a)
2015-07-30 01:10:30 +03:00
|- ?. (gte j a.b)
2015-07-12 20:26:23 +03:00
(fli $(a.b j, j a.b, r swr))
2015-07-30 01:10:30 +03:00
=+ i=(^sub j a.b)
2015-07-12 20:26:23 +03:00
?~ i [%f & zer]
?: e [%f & e.b i] (rou [e.b i])
::
2015-08-06 21:21:47 +03:00
++ mul :: multiply
2015-12-20 23:50:45 +03:00
|= {a/{e/@s a/@u} b/{e/@s a/@u}} ^- fn
2015-07-30 01:10:30 +03:00
(rou (sum:si e.a e.b) (^mul a.a a.b))
2015-07-12 20:26:23 +03:00
::
2015-08-06 21:21:47 +03:00
++ div :: divide
2015-12-20 23:50:45 +03:00
|= {a/{e/@s a/@u} b/{e/@s a/@u}} ^- fn
2015-07-12 20:26:23 +03:00
=+ [ma=(met 0 a.a) mb=(met 0 a.b)]
2015-07-30 01:10:30 +03:00
=+ v=(dif:si (sun:si ma) (sun:si +((^add mb prc))))
2015-07-12 20:26:23 +03:00
=. a ?: (syn:si v) a
a(e (sum:si v e.a), a (lsh 0 (abs:si v) a.a))
2015-07-29 23:43:55 +03:00
=+ [j=(dif:si e.a e.b) q=(dvr a.a a.b)]
(rau [j p.q] =(q.q 0))
2015-07-12 20:26:23 +03:00
::
2015-08-06 21:21:47 +03:00
++ sqt :: square root
2015-12-20 23:50:45 +03:00
|= {a/{e/@s a/@u}} ^- fn
2015-07-12 20:26:23 +03:00
=. a
2015-07-30 01:10:30 +03:00
=+ [w=(met 0 a.a) x=(^mul +(prc) 2)]
=+ ?:((^lth w x) (^sub x w) 0)
2015-07-12 20:26:23 +03:00
=+ ?: =((dis - 1) (dis (abs:si e.a) 1)) -
2015-08-03 19:59:40 +03:00
(^add - 1)
2015-07-12 20:26:23 +03:00
a(e (dif:si e.a (sun:si -)), a (lsh 0 - a.a))
2015-08-06 21:21:47 +03:00
=+ [y=(^sqt a.a) z=(fra:si e.a --2)]
2015-07-29 23:43:55 +03:00
(rau [z p.y] =(q.y 0))
2015-07-12 20:26:23 +03:00
::
2015-08-06 21:21:47 +03:00
++ lth :: less-than
2015-12-20 23:50:45 +03:00
|= {a/{e/@s a/@u} b/{e/@s a/@u}} ^- ?
2015-07-30 01:10:30 +03:00
?: =(e.a e.b) (^lth a.a a.b)
2015-07-12 20:26:23 +03:00
=+ c=(cmp:si (ibl a) (ibl b))
?: =(c -1) & ?: =(c --1) |
?: =((cmp:si e.a e.b) -1)
2015-07-30 01:10:30 +03:00
(^lth (rsh 0 (abs:si (dif:si e.a e.b)) a.a) a.b)
(^lth (lsh 0 (abs:si (dif:si e.a e.b)) a.a) a.b)
2015-07-12 20:26:23 +03:00
::
2015-08-06 21:21:47 +03:00
++ lte :: less-equals
2015-12-20 23:50:45 +03:00
|= {a/{e/@s a/@u} b/{e/@s a/@u}} ^- ?
2015-07-30 01:10:30 +03:00
?: =(e.a e.b) (^lte a.a a.b)
2015-07-12 20:26:23 +03:00
=+ c=(cmp:si (ibl a) (ibl b))
?: =(c -1) & ?: =(c --1) |
?: =((cmp:si e.a e.b) -1)
2015-07-30 01:10:30 +03:00
(^lte a.a (lsh 0 (abs:si (dif:si e.a e.b)) a.b))
(^lte (lsh 0 (abs:si (dif:si e.a e.b)) a.a) a.b)
2015-07-12 20:26:23 +03:00
::
2015-08-06 21:21:47 +03:00
++ equ :: equals
2015-12-20 23:50:45 +03:00
|= {a/{e/@s a/@u} b/{e/@s a/@u}} ^- ?
2015-07-12 20:26:23 +03:00
?. =((ibl a) (ibl b)) |
?: =((cmp:si e.a e.b) -1)
=((lsh 0 (abs:si (dif:si e.a e.b)) a.b) a.a)
=((lsh 0 (abs:si (dif:si e.a e.b)) a.a) a.b)
::
:: integer binary logarithm: 2^ibl(a) <= |a| < 2^(ibl(a)+1)
++ ibl
2015-12-20 23:50:45 +03:00
|= {a/{e/@s a/@u}} ^- @s
2015-07-12 20:26:23 +03:00
(sum:si (sun:si (dec (met 0 a.a))) e.a)
::
2015-08-06 21:21:47 +03:00
:: change to a representation where a.a is odd
:: every fn has a unique representation of this kind
2015-07-12 20:26:23 +03:00
++ uni
2015-12-20 23:50:45 +03:00
|= {a/{e/@s a/@u}}
2015-07-12 20:26:23 +03:00
|- ?: =((end 0 1 a.a) 1) a
$(a.a (rsh 0 1 a.a), e.a (sum:si e.a --1))
::
2015-08-06 21:21:47 +03:00
:: expands to either full precision or to denormalized
2015-07-12 20:26:23 +03:00
++ xpd
2015-12-20 23:50:45 +03:00
|= {a/{e/@s a/@u}}
2015-08-02 00:04:25 +03:00
=+ ma=(met 0 a.a)
2015-08-08 02:27:25 +03:00
?: (gte ma prc) a
2015-08-02 00:04:25 +03:00
=+ ?: =(den %i) (^sub prc ma)
2015-07-12 20:26:23 +03:00
=+ ^= q
=+ w=(dif:si e.a emn)
?: (syn:si w) (abs:si w) 0
2015-08-02 00:04:25 +03:00
(min q (^sub prc ma))
2015-07-12 20:26:23 +03:00
a(e (dif:si e.a (sun:si -)), a (lsh 0 - a.a))
::
2015-08-06 21:21:47 +03:00
:: central rounding mechanism
:: can perform: floor, ceiling, smaller, larger,
:: nearest (round ties to: even, away from 0, toward 0)
:: s is sticky bit: represents a value less than ulp(a) = 2^(e.a)
2015-08-04 06:00:09 +03:00
++ lug
~/ %lug
2015-12-20 23:50:45 +03:00
|= {t/$?($fl $ce $sm $lg $ne $na $nt) a/{e/@s a/@u} s/?} ^- fn
2015-08-06 21:21:47 +03:00
?< =(a.a 0)
2015-08-03 19:59:40 +03:00
=-
?. =(den %f) - :: flush denormals
2015-12-04 01:58:42 +03:00
?. ?=({$f *} -) -
2015-07-12 20:26:23 +03:00
?: =((met 0 ->+>) prc) - [%f & zer]
::
=+ m=(met 0 a.a)
?> |(s (gth m prc)) :: require precision
2015-07-12 20:26:23 +03:00
=+ ^= q
=+ ^= f :: reduce precision
2015-07-30 01:10:30 +03:00
?: (gth m prc) (^sub m prc) 0
2015-07-12 20:26:23 +03:00
=+ ^= g %- abs:si :: enforce min. exp
?: =(den %i) --0
?: =((cmp:si e.a emn) -1) (dif:si emn e.a) --0
(max f g)
=^ b a :- (end 0 q a.a)
a(e (sum:si e.a (sun:si q)), a (rsh 0 q a.a))
::
?~ a.a
?< =(den %i)
?- t
2015-12-04 01:58:42 +03:00
$fl [%f & zer]
$sm [%f & zer]
$ce [%f & spd]
$lg [%f & spd]
$ne ?: s [%f & ?:((^lte b (bex (dec q))) zer spd)]
2015-07-30 01:10:30 +03:00
[%f & ?:((^lth b (bex (dec q))) zer spd)]
2015-12-04 01:58:42 +03:00
$nt ?: s [%f & ?:((^lte b (bex (dec q))) zer spd)]
2015-07-30 01:10:30 +03:00
[%f & ?:((^lth b (bex (dec q))) zer spd)]
2015-12-04 01:58:42 +03:00
$na [%f & ?:((^lth b (bex (dec q))) zer spd)]
2015-07-12 20:26:23 +03:00
==
::
2015-08-06 21:21:47 +03:00
=. a (xpd a)
2015-07-12 20:26:23 +03:00
::
2015-08-02 00:04:25 +03:00
=. a
2015-07-12 20:26:23 +03:00
?- t
2015-12-04 01:58:42 +03:00
$fl a
$lg a(a +(a.a))
$sm ?. &(=(b 0) s) a
2015-07-12 20:26:23 +03:00
?: &(=(e.a emn) !=(den %i)) a(a (dec a.a))
2015-07-30 01:10:30 +03:00
=+ y=(dec (^mul a.a 2))
?. (^lte (met 0 y) prc) a(a (dec a.a))
2015-07-12 20:26:23 +03:00
[(dif:si e.a --1) y]
2015-12-04 01:58:42 +03:00
$ce ?: &(=(b 0) s) a a(a +(a.a))
$ne ?~ b a
2015-07-12 20:26:23 +03:00
=+ y=(bex (dec q))
?: &(=(b y) s) :: round halfs to even
2015-07-12 20:26:23 +03:00
?~ (dis a.a 1) a a(a +(a.a))
2015-07-30 01:10:30 +03:00
?: (^lth b y) a a(a +(a.a))
2015-12-04 01:58:42 +03:00
$na ?~ b a
2015-07-12 20:26:23 +03:00
=+ y=(bex (dec q))
2015-07-30 01:10:30 +03:00
?: (^lth b y) a a(a +(a.a))
2015-12-04 01:58:42 +03:00
$nt ?~ b a
2015-07-12 20:26:23 +03:00
=+ y=(bex (dec q))
?: =(b y) ?: s a a(a +(a.a))
2015-07-30 01:10:30 +03:00
?: (^lth b y) a a(a +(a.a))
2015-07-12 20:26:23 +03:00
==
2015-08-02 00:04:25 +03:00
::
2015-08-03 19:59:40 +03:00
=. a ?. =((met 0 a.a) +(prc)) a
a(a (rsh 0 1 a.a), e (sum:si e.a --1))
2015-07-12 20:26:23 +03:00
?~ a.a [%f & zer]
::
?: =(den %i) [%f & a]
?: =((cmp:si emx e.a) -1) [%i &] [%f & a] :: enforce max. exp
::
++ drg :: dragon4;
~/ %drg :: convert to decimal
2015-12-20 23:50:45 +03:00
|= {a/{e/@s a/@u}} ^- {@s @u}
2015-08-06 21:21:47 +03:00
?< =(a.a 0)
=. a (xpd a)
2015-07-12 20:26:23 +03:00
=+ r=(lsh 0 ?:((syn:si e.a) (abs:si e.a) 0) a.a)
=+ s=(lsh 0 ?.((syn:si e.a) (abs:si e.a) 0) 1)
=+ m=(lsh 0 ?:((syn:si e.a) (abs:si e.a) 0) 1)
2015-07-30 01:10:30 +03:00
=+ [k=--0 q=(^div (^add s 9) 10)]
|- ?: (^lth r q)
2015-07-12 20:26:23 +03:00
%= $
k (dif:si k --1)
2015-07-30 01:10:30 +03:00
r (^mul r 10)
m (^mul m 10)
2015-07-12 20:26:23 +03:00
==
2015-07-30 01:10:30 +03:00
|- ?: (gte (^add (^mul r 2) m) (^mul s 2))
$(s (^mul s 10), k (sum:si k --1))
2015-07-12 20:26:23 +03:00
=+ [u=0 o=0]
2015-07-29 23:43:55 +03:00
|-
2015-07-30 01:10:30 +03:00
=+ v=(dvr (^mul r 10) s)
2015-07-29 23:43:55 +03:00
=> %= .
2015-07-12 20:26:23 +03:00
k (dif:si k --1)
2015-07-29 23:43:55 +03:00
u p.v
r q.v
2015-07-30 01:10:30 +03:00
m (^mul m 10)
2015-07-12 20:26:23 +03:00
==
2015-07-30 01:10:30 +03:00
=+ l=(^lth (^mul r 2) m)
2015-07-12 20:26:23 +03:00
=+ ^= h
2015-07-30 01:10:30 +03:00
?| (^lth (^mul s 2) m)
(gth (^mul r 2) (^sub (^mul s 2) m))
2015-07-12 20:26:23 +03:00
==
?: &(!l !h)
2015-07-30 01:10:30 +03:00
$(o (^add (^mul o 10) u))
2015-07-31 05:01:20 +03:00
=+ q=&(h |(!l (gte (^mul r 2) s)))
2015-07-30 01:10:30 +03:00
=. o (^add (^mul o 10) ?:(q +(u) u))
2015-07-12 20:26:23 +03:00
[k o]
::
2015-08-06 21:21:47 +03:00
++ toj :: round to integer
2015-12-20 23:50:45 +03:00
|= {a/{e/@s a/@u}} ^- fn
2015-08-03 20:33:57 +03:00
?. =((cmp:si e.a --0) -1) [%f & a]
=+ x=(abs:si e.a)
=+ y=(rsh 0 x a.a)
?: |(=(r %d) =(r %z)) [%f & --0 y]
=+ z=(end 0 x a.a)
?: |(=(r %u) =(r %a)) [%f & --0 ?~(z y +(y))]
=+ i=(bex (dec x))
?: &(=(z i) =((dis y 1) 0)) [%f & --0 y]
?: (^lth z i) [%f & --0 y] [%f & --0 +(y)]
::
2015-12-05 02:59:29 +03:00
++ ned :: require ?=({$f *} a)
2015-12-20 23:50:45 +03:00
|= {a/fn} ^- {$f s/? e/@s a/@u}
2015-12-04 01:58:42 +03:00
?: ?=({$f *} a) a
2015-07-12 20:26:23 +03:00
~| %need-float !!
::
2015-08-06 21:21:47 +03:00
++ shf :: a * 2^b; no rounding
2015-12-20 23:50:45 +03:00
|= {a/fn b/@s}
2015-12-04 01:58:42 +03:00
?: |(?=({$n *} a) ?=({$i *} a)) a
2015-07-12 20:26:23 +03:00
a(e (sum:si e.a b))
::
2015-08-06 21:21:47 +03:00
++ fli :: flip sign
2015-12-20 23:50:45 +03:00
|= {a/fn} ^- fn
2015-12-08 04:23:27 +03:00
?-(-.a $f a(s !s.a), $i a(s !s.a), $n a)
2015-07-30 01:10:30 +03:00
::
2015-12-04 01:58:42 +03:00
++ swr ?+(r r $d %u, $u %d) :: flipped rounding
++ prc ?>((gth p 1) p) :: force >= 2 precision
2015-12-21 00:16:39 +03:00
++ den d :: denorm+flush+inf exp
2015-08-06 21:21:47 +03:00
++ emn v :: minimum exponent
++ emx (sum:si emn (sun:si w)) :: maximum exponent
++ spd [e=emn a=1] :: smallest denormal
++ spn [e=emn a=(bex (dec prc))] :: smallest normal
2015-07-29 06:56:02 +03:00
++ lfn [e=emx a=(fil 0 prc 1)] :: largest
++ lfe (sum:si emx (sun:si prc)) :: 2^lfe is > than all
2015-07-29 06:56:02 +03:00
++ zer [e=--0 a=0]
--
|%
2015-08-06 21:21:47 +03:00
++ rou :: round
2015-12-20 23:50:45 +03:00
|= {a/fn} ^- fn
2015-12-04 01:58:42 +03:00
?. ?=({$f *} a) a
2015-07-30 01:10:30 +03:00
?~ a.a [%f s.a zer]
?: s.a (^rou +>.a)
=.(r swr (fli (^rou +>.a)))
2014-06-19 22:53:16 +04:00
::
2015-08-06 21:21:47 +03:00
++ syn :: get sign
2015-12-20 23:50:45 +03:00
|= {a/fn} ^- ?
2015-12-04 01:58:42 +03:00
?-(-.a $f s.a, $i s.a, $n &)
2015-07-30 01:10:30 +03:00
::
2015-08-06 21:21:47 +03:00
++ abs :: absolute value
2015-12-20 23:50:45 +03:00
|= {a/fn} ^- fn
2015-12-04 01:58:42 +03:00
?: ?=({$f *} a) [%f & e.a a.a]
?: ?=({$i *} a) [%i &] [%n ~]
2015-07-30 01:10:30 +03:00
::
2015-08-06 21:21:47 +03:00
++ add :: add
2015-12-20 23:50:45 +03:00
|= {a/fn b/fn} ^- fn
2015-12-04 01:58:42 +03:00
?: |(?=({$n *} a) ?=({$n *} b)) [%n ~]
?: |(?=({$i *} a) ?=({$i *} b))
?: &(?=({$i *} a) ?=({$i *} b))
2015-07-30 01:10:30 +03:00
?: =(a b) a [%n ~]
2015-12-04 01:58:42 +03:00
?: ?=({$i *} a) a b
2015-07-30 01:10:30 +03:00
?: |(=(a.a 0) =(a.b 0))
?. &(=(a.a 0) =(a.b 0)) %- rou ?~(a.a b a)
[%f ?:(=(r %d) &(s.a s.b) |(s.a s.b)) zer]
2015-12-20 23:50:45 +03:00
%- |= {a/fn}
2015-12-04 01:58:42 +03:00
?. ?=({$f *} a) a
2015-07-30 01:10:30 +03:00
?. =(a.a 0) a
[%f !=(r %d) zer]
?: =(s.a s.b)
?: s.a (^add +>.a +>.b |)
=.(r swr (fli (^add +>.a +>.b |)))
?: s.a (^sub +>.a +>.b |)
(^sub +>.b +>.a |)
::
++ ead :: exact add
2015-12-20 23:50:45 +03:00
|= {a/fn b/fn} ^- fn
2015-12-04 01:58:42 +03:00
?: |(?=({$n *} a) ?=({$n *} b)) [%n ~]
?: |(?=({$i *} a) ?=({$i *} b))
?: &(?=({$i *} a) ?=({$i *} b))
2015-07-30 01:10:30 +03:00
?: =(a b) a [%n ~]
2015-12-04 01:58:42 +03:00
?: ?=({$i *} a) a b
2015-07-30 01:10:30 +03:00
?: |(=(a.a 0) =(a.b 0))
?. &(=(a.a 0) =(a.b 0)) ?~(a.a b a)
[%f ?:(=(r %d) &(s.a s.b) |(s.a s.b)) zer]
2015-12-20 23:50:45 +03:00
%- |= {a/fn}
2015-12-04 01:58:42 +03:00
?. ?=({$f *} a) a
2015-08-06 21:21:47 +03:00
?. =(a.a 0) a
[%f !=(r %d) zer]
2015-07-30 01:10:30 +03:00
?: =(s.a s.b)
?: s.a (^add +>.a +>.b &)
(fli (^add +>.a +>.b &))
?: s.a (^sub +>.a +>.b &)
(^sub +>.b +>.a &)
::
2015-08-06 21:21:47 +03:00
++ sub :: subtract
2015-12-20 23:50:45 +03:00
|= {a/fn b/fn} ^- fn (add a (fli b))
2015-07-30 01:10:30 +03:00
::
2015-08-06 21:21:47 +03:00
++ mul :: multiply
2015-12-20 23:50:45 +03:00
|= {a/fn b/fn} ^- fn
2015-12-04 01:58:42 +03:00
?: |(?=({$n *} a) ?=({$n *} b)) [%n ~]
?: ?=({$i *} a)
?: ?=({$i *} b)
[%i =(s.a s.b)]
2015-07-30 01:10:30 +03:00
?: =(a.b 0) [%n ~] [%i =(s.a s.b)]
2015-12-04 01:58:42 +03:00
?: ?=({$i *} b)
2015-07-30 01:10:30 +03:00
?: =(a.a 0) [%n ~] [%i =(s.a s.b)]
?: |(=(a.a 0) =(a.b 0)) [%f =(s.a s.b) zer]
?: =(s.a s.b) (^mul +>.a +>.b)
=.(r swr (fli (^mul +>.a +>.b)))
::
++ emu :: exact multiply
2015-12-20 23:50:45 +03:00
|= {a/fn b/fn} ^- fn
2015-12-04 01:58:42 +03:00
?: |(?=({$n *} a) ?=({$n *} b)) [%n ~]
?: ?=({$i *} a)
?: ?=({$i *} b)
[%i =(s.a s.b)]
2015-07-30 01:10:30 +03:00
?: =(a.b 0) [%n ~] [%i =(s.a s.b)]
2015-12-04 01:58:42 +03:00
?: ?=({$i *} b)
2015-07-30 01:10:30 +03:00
?: =(a.a 0) [%n ~] [%i =(s.a s.b)]
?: |(=(a.a 0) =(a.b 0)) [%f =(s.a s.b) zer]
[%f =(s.a s.b) (sum:si e.a e.b) (^^mul a.a a.b)]
::
2015-08-06 21:21:47 +03:00
++ div :: divide
2015-12-20 23:50:45 +03:00
|= {a/fn b/fn} ^- fn
2015-12-04 01:58:42 +03:00
?: |(?=({$n *} a) ?=({$n *} b)) [%n ~]
?: ?=({$i *} a)
?: ?=({$i *} b) [%n ~] [%i =(s.a s.b)]
?: ?=({$i *} b) [%f =(s.a s.b) zer]
2015-07-30 01:10:30 +03:00
?: =(a.a 0) ?: =(a.b 0) [%n ~] [%f =(s.a s.b) zer]
?: =(a.b 0) [%i =(s.a s.b)]
?: =(s.a s.b) (^div +>.a +>.b)
=.(r swr (fli (^div +>.a +>.b)))
::
2015-08-06 21:21:47 +03:00
++ fma :: fused multiply-add
2015-12-20 23:50:45 +03:00
|= {a/fn b/fn c/fn} ^- fn :: (a * b) + c
2015-07-30 01:10:30 +03:00
(add (emu a b) c)
::
++ sqt :: square root
2015-12-20 23:50:45 +03:00
|= {a/fn} ^- fn
2015-12-04 01:58:42 +03:00
?: ?=({$n *} a) [%n ~]
?: ?=({$i *} a) ?:(s.a a [%n ~])
2015-07-30 01:10:30 +03:00
?~ a.a [%f s.a zer]
?: s.a (^sqt +>.a) [%n ~]
::
2015-08-06 21:21:47 +03:00
++ inv :: inverse
2015-12-20 23:50:45 +03:00
|= {a/fn} ^- fn
2015-07-30 01:10:30 +03:00
(div [%f & --0 1] a)
::
++ sun :: uns integer to float
2015-12-20 23:50:45 +03:00
|= {a/@u} ^- fn
2015-07-30 01:10:30 +03:00
(rou [%f & --0 a])
::
++ san :: sgn integer to float
2015-12-20 23:50:45 +03:00
|= {a/@s} ^- fn
2015-07-30 01:10:30 +03:00
=+ b=(old:si a)
(rou [%f -.b --0 +.b])
::
2015-08-06 21:21:47 +03:00
:: comparisons return ~ in the event of a NaN
++ lth :: less-than
2015-12-20 23:50:45 +03:00
|= {a/fn b/fn} ^- (unit ?)
2015-12-04 01:58:42 +03:00
?: |(?=({$n *} a) ?=({$n *} b)) ~ :- ~
2015-07-30 01:10:30 +03:00
?: =(a b) |
2015-12-04 01:58:42 +03:00
?: ?=({$i *} a) !s.a ?: ?=({$i *} b) s.b
2015-07-30 01:10:30 +03:00
?: |(=(a.a 0) =(a.b 0))
?: &(=(a.a 0) =(a.b 0)) |
?: =(a.a 0) s.b !s.a
?: !=(s.a s.b) s.b
?: s.a (^lth +>.a +>.b) (^lth +>.b +>.a)
::
2015-08-06 21:21:47 +03:00
++ lte :: less-equal
2015-12-20 23:50:45 +03:00
|= {a/fn b/fn} ^- (unit ?)
2015-12-04 01:58:42 +03:00
?: |(?=({$n *} a) ?=({$n *} b)) ~ :- ~
2015-07-30 01:10:30 +03:00
?: =(a b) &
2015-12-04 01:58:42 +03:00
?: ?=({$i *} a) !s.a ?: ?=({$i *} b) s.b
2015-07-30 01:10:30 +03:00
?: |(=(a.a 0) =(a.b 0))
?: &(=(a.a 0) =(a.b 0)) &
?: =(a.a 0) s.b !s.a
?: !=(s.a s.b) s.b
?: s.a (^lte +>.a +>.b) (^lte +>.b +>.a)
::
2015-08-06 21:21:47 +03:00
++ equ :: equal
2015-12-20 23:50:45 +03:00
|= {a/fn b/fn} ^- (unit ?)
2015-12-04 01:58:42 +03:00
?: |(?=({$n *} a) ?=({$n *} b)) ~ :- ~
2015-07-30 01:10:30 +03:00
?: =(a b) &
2015-12-04 01:58:42 +03:00
?: |(?=({$i *} a) ?=({$i *} b)) |
2015-07-30 01:10:30 +03:00
?: |(=(a.a 0) =(a.b 0))
?: &(=(a.a 0) =(a.b 0)) & |
?: |(=(e.a e.b) !=(s.a s.b)) |
(^equ +>.a +>.b)
::
2015-08-06 21:21:47 +03:00
++ gte :: greater-equal
2015-12-20 23:50:45 +03:00
|= {a/fn b/fn} ^- (unit ?) (lte b a)
2015-07-30 01:10:30 +03:00
::
2015-08-06 21:21:47 +03:00
++ gth :: greater-than
2015-12-20 23:50:45 +03:00
|= {a/fn b/fn} ^- (unit ?) (lth b a)
2015-07-30 01:10:30 +03:00
::
2015-08-02 00:04:25 +03:00
++ drg :: float to decimal
2015-12-20 23:50:45 +03:00
|= {a/fn} ^- dn
2015-12-04 01:58:42 +03:00
?: ?=({$n *} a) [%n ~]
?: ?=({$i *} a) [%i s.a]
2015-07-30 01:10:30 +03:00
?~ a.a [%d s.a --0 0]
[%d s.a (^drg +>.a)]
::
++ grd :: decimal to float
2015-12-20 23:50:45 +03:00
|= {a/dn} ^- fn
2015-12-04 01:58:42 +03:00
?: ?=({$n *} a) [%n ~]
?: ?=({$i *} a) [%i s.a]
2015-08-04 06:00:09 +03:00
=> .(r %n)
2015-07-30 01:10:30 +03:00
=+ q=(abs:si e.a)
?: (syn:si e.a)
(mul [%f s.a --0 a.a] [%f & e.a (pow 5 q)])
(div [%f s.a --0 a.a] [%f & (sun:si q) (pow 5 q)])
2015-08-03 20:33:57 +03:00
::
2015-08-06 21:21:47 +03:00
++ toi :: round to integer @s
2015-12-20 23:50:45 +03:00
|= {a/fn} ^- (unit @s)
2015-08-06 21:21:47 +03:00
=+ b=(toj a)
2015-12-04 01:58:42 +03:00
?. ?=({$f *} b) ~ :- ~
2015-08-06 21:21:47 +03:00
=+ c=(^^mul (bex (abs:si e.b)) a.b)
(new:si s.b c)
::
++ toj :: round to integer fn
2015-12-20 23:50:45 +03:00
|= {a/fn} ^- fn
2015-12-04 01:58:42 +03:00
?. ?=({$f *} a) a
2015-08-03 20:33:57 +03:00
?~ a.a [%f s.a zer]
2015-08-06 21:21:47 +03:00
?: s.a (^toj +>.a)
=.(r swr (fli (^toj +>.a)))
--
2014-07-19 04:51:22 +04:00
::
++ ff :: ieee 754 format fp
2015-12-20 23:50:45 +03:00
|_ {{w/@u p/@u b/@s} r/$?($n $u $d $z $a)}
2015-08-06 21:21:47 +03:00
:: this core has no use outside of the functionality
:: provided to ++rd, ++rs, ++rq, and ++rh
::
:: w=width: bits in exponent field
:: p=precision: bits in fraction field
:: w=bias: added to exponent when storing
:: r=rounding mode: same as in ++fl
2015-07-12 20:26:23 +03:00
::
2015-08-06 21:21:47 +03:00
++ sb (bex (^add w p)) :: sign bit
++ me (dif:si (dif:si --1 b) (sun:si p)) :: minimum exponent
2015-07-12 20:26:23 +03:00
::
++ pa
2015-08-01 06:30:13 +03:00
%*(. fl p +(p), v me, w (^sub (bex w) 3), d %d, r r)
2015-07-12 20:26:23 +03:00
::
2015-08-06 21:21:47 +03:00
++ sea :: @r to fn
2015-12-20 23:50:45 +03:00
|= {a/@r} ^- fn
2015-08-06 21:21:47 +03:00
=+ [f=(cut 0 [0 p] a) e=(cut 0 [p w] a)]
=+ s=(sig a)
2015-07-12 20:26:23 +03:00
?: =(e 0)
2015-08-01 06:30:13 +03:00
?: =(f 0) [%f s --0 0] [%f s me f]
2015-07-12 20:26:23 +03:00
?: =(e (fil 0 w 1))
?: =(f 0) [%i s] [%n ~]
2015-08-01 06:30:13 +03:00
=+ q=:(sum:si (sun:si e) me -1)
2015-07-12 20:26:23 +03:00
=+ r=(^add f (bex p))
[%f s q r]
::
2015-12-21 00:16:39 +03:00
++ bit |= {a/fn} (bif (rou:pa a)) :: fn to @r w+ rounding
2015-07-12 20:26:23 +03:00
::
++ bif :: fn to @r no rounding
2015-12-20 23:50:45 +03:00
|= {a/fn} ^- @r
2015-12-04 01:58:42 +03:00
?: ?=({$i *} a)
2015-07-12 20:26:23 +03:00
=+ q=(lsh 0 p (fil 0 w 1))
?: s.a q (^add q sb)
2015-12-04 01:58:42 +03:00
?: ?=({$n *} a) (lsh 0 (dec p) (fil 0 +(w) 1))
2015-07-12 20:26:23 +03:00
?~ a.a ?: s.a `@r`0 sb
=+ ma=(met 0 a.a)
?. =(ma +(p))
2015-08-01 06:30:13 +03:00
?> =(e.a me)
2015-07-12 20:26:23 +03:00
?> (^lth ma +(p))
?: s.a `@r`a.a (^add a.a sb)
2015-08-01 06:30:13 +03:00
=+ q=(sum:si (dif:si e.a me) --1)
2015-07-12 20:26:23 +03:00
=+ r=(^add (lsh 0 p (abs:si q)) (end 0 p a.a))
?: s.a r (^add r sb)
::
2015-08-06 21:21:47 +03:00
++ sig :: get sign
2015-12-20 23:50:45 +03:00
|= {a/@r} ^- ?
2015-07-12 20:26:23 +03:00
=(0 (cut 0 [(^add p w) 1] a))
::
2015-08-06 21:21:47 +03:00
++ exp :: get exponent
2015-12-20 23:50:45 +03:00
|= {a/@r} ^- @s
2015-07-12 20:26:23 +03:00
(dif:si (sun:si (cut 0 [p w] a)) b)
::
2015-08-06 21:21:47 +03:00
++ add :: add
2015-12-20 23:50:45 +03:00
|= {a/@r b/@r}
2015-08-06 21:21:47 +03:00
(bif (add:pa (sea a) (sea b)))
2015-08-05 05:52:07 +03:00
::
2015-08-06 21:21:47 +03:00
++ sub :: subtract
2015-12-20 23:50:45 +03:00
|= {a/@r b/@r}
2015-08-06 21:21:47 +03:00
(bif (sub:pa (sea a) (sea b)))
::
++ mul :: multiply
2015-12-20 23:50:45 +03:00
|= {a/@r b/@r}
2015-08-06 21:21:47 +03:00
(bif (mul:pa (sea a) (sea b)))
::
++ div :: divide
2015-12-20 23:50:45 +03:00
|= {a/@r b/@r}
2015-08-06 21:21:47 +03:00
(bif (div:pa (sea a) (sea b)))
::
++ fma :: fused multiply-add
2015-12-20 23:50:45 +03:00
|= {a/@r b/@r c/@r}
2015-08-06 21:21:47 +03:00
(bif (fma:pa (sea a) (sea b) (sea c)))
::
++ sqt :: square root
2015-12-20 23:50:45 +03:00
|= {a/@r}
2015-08-06 21:21:47 +03:00
(bif (sqt:pa (sea a)))
::
++ lth :: less-than
2015-12-20 23:50:45 +03:00
|= {a/@r b/@r} (fall (lth:pa (sea a) (sea b)) |)
2015-08-06 21:21:47 +03:00
++ lte :: less-equals
2015-12-20 23:50:45 +03:00
|= {a/@r b/@r} (fall (lte:pa (sea a) (sea b)) |)
2015-08-06 21:21:47 +03:00
++ equ :: equals
2015-12-20 23:50:45 +03:00
|= {a/@r b/@r} (fall (equ:pa (sea a) (sea b)) |)
2015-08-06 21:21:47 +03:00
++ gte :: greater-equals
2015-12-20 23:50:45 +03:00
|= {a/@r b/@r} (fall (gte:pa (sea a) (sea b)) |)
2015-08-06 21:21:47 +03:00
++ gth :: greater-than
2015-12-20 23:50:45 +03:00
|= {a/@r b/@r} (fall (gth:pa (sea a) (sea b)) |)
++ sun :: uns integer to @r
2015-12-20 23:50:45 +03:00
|= {a/@u} (bit [%f & --0 a])
2015-08-06 21:21:47 +03:00
++ san :: signed integer to @r
2015-12-20 23:50:45 +03:00
|= {a/@s} (bit [%f (syn:si a) --0 (abs:si a)])
2015-08-06 21:21:47 +03:00
++ toi :: round to integer
2015-12-20 23:50:45 +03:00
|= {a/@r} (toi:pa (sea a))
2015-08-06 21:21:47 +03:00
++ drg :: @r to decimal float
2015-12-20 23:50:45 +03:00
|= {a/@r} (drg:pa (sea a))
2015-08-06 21:21:47 +03:00
++ grd :: decimal float to @r
2015-12-20 23:50:45 +03:00
|= {a/dn} (bif (grd:pa a))
2015-07-12 20:26:23 +03:00
--
::
2015-12-20 23:50:45 +03:00
++ rlyd |= a/@rd ^- dn (drg:rd a) :: prep @rd for print
++ rlys |= a/@rs ^- dn (drg:rs a) :: prep @rs for print
++ rlyh |= a/@rh ^- dn (drg:rh a) :: prep @rh for print
++ rlyq |= a/@rq ^- dn (drg:rq a) :: prep @rq for print
++ ryld |= a/dn ^- @rd (grd:rd a) :: finish parsing @rd
++ ryls |= a/dn ^- @rs (grd:rs a) :: finish parsing @rs
++ rylh |= a/dn ^- @rh (grd:rh a) :: finish parsing @rh
++ rylq |= a/dn ^- @rq (grd:rq a) :: finish parsing @rq
2015-07-12 20:26:23 +03:00
::
++ rd :: double precision fp
2015-08-04 06:00:09 +03:00
~% %rd +> ~
2015-12-20 23:50:45 +03:00
|_ r/$?($n $u $d $z)
2015-08-06 21:21:47 +03:00
:: round to nearest, round up, round down, round to zero
::
2015-07-12 20:37:45 +03:00
++ ma
2015-08-04 06:00:09 +03:00
%*(. ff w 11, p 52, b --1.023, r r)
2015-08-06 21:21:47 +03:00
::
++ sea :: @rd to fn
2015-12-20 23:50:45 +03:00
|= {a/@rd} (sea:ma a)
2015-08-06 21:21:47 +03:00
::
++ bit :: fn to @rd
2015-12-20 23:50:45 +03:00
|= {a/fn} ^- @rd (bit:ma a)
2015-08-06 21:21:47 +03:00
::
++ add ~/ %add :: add
2015-12-20 23:50:45 +03:00
|= {a/@rd b/@rd} ^- @rd ~| %rd-fail
2015-08-06 21:21:47 +03:00
(add:ma a b)
::
++ sub ~/ %sub :: subtract
2015-12-20 23:50:45 +03:00
|= {a/@rd b/@rd} ^- @rd ~| %rd-fail
2015-08-06 21:21:47 +03:00
(sub:ma a b)
::
++ mul ~/ %mul :: multiply
2015-12-20 23:50:45 +03:00
|= {a/@rd b/@rd} ^- @rd ~| %rd-fail
2015-08-06 21:21:47 +03:00
(mul:ma a b)
::
++ div ~/ %div :: divide
2015-12-20 23:50:45 +03:00
|= {a/@rd b/@rd} ^- @rd ~| %rd-fail
2015-08-06 21:21:47 +03:00
(div:ma a b)
::
++ fma ~/ %fma :: fused multiply-add
2015-12-20 23:50:45 +03:00
|= {a/@rd b/@rd c/@rd} ^- @rd ~| %rd-fail
2015-08-06 21:21:47 +03:00
(fma:ma a b c)
::
++ sqt ~/ %sqt :: square root
2015-12-20 23:50:45 +03:00
|= {a/@rd} ^- @rd ~| %rd-fail
2015-08-06 21:21:47 +03:00
(sqt:ma a)
::
++ lth ~/ %lth :: less-than
2015-12-20 23:50:45 +03:00
|= {a/@rd b/@rd} ~| %rd-fail (lth:ma a b)
2015-08-06 21:21:47 +03:00
++ lte ~/ %lte :: less-equals
2015-12-20 23:50:45 +03:00
|= {a/@rd b/@rd} ~| %rd-fail (lte:ma a b)
2015-08-06 21:21:47 +03:00
++ equ ~/ %equ :: equals
2015-12-20 23:50:45 +03:00
|= {a/@rd b/@rd} ~| %rd-fail (equ:ma a b)
2015-08-06 21:21:47 +03:00
++ gte ~/ %gte :: greater-equals
2015-12-20 23:50:45 +03:00
|= {a/@rd b/@rd} ~| %rd-fail (gte:ma a b)
2015-08-06 21:21:47 +03:00
++ gth ~/ %gth :: greater-than
2015-12-20 23:50:45 +03:00
|= {a/@rd b/@rd} ~| %rd-fail (gth:ma a b)
::
++ sun |= {a/@u} ^- @rd (sun:ma a) :: uns integer to @rd
++ san |= {a/@s} ^- @rd (san:ma a) :: sgn integer to @rd
++ sig |= {a/@rd} ^- ? (sig:ma a) :: get sign
++ exp |= {a/@rd} ^- @s (exp:ma a) :: get exponent
++ toi |= {a/@rd} ^- (unit @s) (toi:ma a) :: round to integer
++ drg |= {a/@rd} ^- dn (drg:ma a) :: @rd to decimal float
++ grd |= {a/dn} ^- @rd (grd:ma a) :: decimal float to @rd
2015-07-12 20:26:23 +03:00
--
::
++ rs :: single precision fp
2015-08-04 06:00:09 +03:00
~% %rs +> ~
2015-12-20 23:50:45 +03:00
|_ r/$?($n $u $d $z)
2015-08-06 21:21:47 +03:00
:: round to nearest, round up, round down, round to zero
::
2015-07-12 20:37:45 +03:00
++ ma
%*(. ff w 8, p 23, b --127, r r)
2015-08-06 21:21:47 +03:00
::
++ sea :: @rs to fn
2015-12-20 23:50:45 +03:00
|= {a/@rs} (sea:ma a)
2015-08-06 21:21:47 +03:00
::
++ bit :: fn to @rs
2015-12-20 23:50:45 +03:00
|= {a/fn} ^- @rs (bit:ma a)
2015-08-06 21:21:47 +03:00
::
++ add ~/ %add :: add
2015-12-20 23:50:45 +03:00
|= {a/@rs b/@rs} ^- @rs ~| %rs-fail
2015-08-06 21:21:47 +03:00
(add:ma a b)
::
++ sub ~/ %sub :: subtract
2015-12-20 23:50:45 +03:00
|= {a/@rs b/@rs} ^- @rs ~| %rs-fail
2015-08-06 21:21:47 +03:00
(sub:ma a b)
::
++ mul ~/ %mul :: multiply
2015-12-20 23:50:45 +03:00
|= {a/@rs b/@rs} ^- @rs ~| %rs-fail
2015-08-06 21:21:47 +03:00
(mul:ma a b)
::
++ div ~/ %div :: divide
2015-12-20 23:50:45 +03:00
|= {a/@rs b/@rs} ^- @rs ~| %rs-fail
2015-08-06 21:21:47 +03:00
(div:ma a b)
::
++ fma ~/ %fma :: fused multiply-add
2015-12-20 23:50:45 +03:00
|= {a/@rs b/@rs c/@rs} ^- @rs ~| %rs-fail
2015-08-06 21:21:47 +03:00
(fma:ma a b c)
::
++ sqt ~/ %sqt :: square root
2015-12-20 23:50:45 +03:00
|= {a/@rs} ^- @rs ~| %rs-fail
2015-08-06 21:21:47 +03:00
(sqt:ma a)
::
++ lth ~/ %lth :: less-than
2015-12-20 23:50:45 +03:00
|= {a/@rs b/@rs} ~| %rs-fail (lth:ma a b)
2015-08-06 21:21:47 +03:00
++ lte ~/ %lte :: less-equals
2015-12-20 23:50:45 +03:00
|= {a/@rs b/@rs} ~| %rs-fail (lte:ma a b)
2015-08-06 21:21:47 +03:00
++ equ ~/ %equ :: equals
2015-12-20 23:50:45 +03:00
|= {a/@rs b/@rs} ~| %rs-fail (equ:ma a b)
2015-08-06 21:21:47 +03:00
++ gte ~/ %gte :: greater-equals
2015-12-20 23:50:45 +03:00
|= {a/@rs b/@rs} ~| %rs-fail (gte:ma a b)
2015-08-06 21:21:47 +03:00
++ gth ~/ %gth :: greater-than
2015-12-20 23:50:45 +03:00
|= {a/@rs b/@rs} ~| %rs-fail (gth:ma a b)
::
++ sun |= {a/@u} ^- @rs (sun:ma a) :: uns integer to @rs
++ san |= {a/@s} ^- @rs (san:ma a) :: sgn integer to @rs
++ sig |= {a/@rs} ^- ? (sig:ma a) :: get sign
++ exp |= {a/@rs} ^- @s (exp:ma a) :: get exponent
++ toi |= {a/@rs} ^- (unit @s) (toi:ma a) :: round to integer
++ drg |= {a/@rs} ^- dn (drg:ma a) :: @rs to decimal float
++ grd |= {a/dn} ^- @rs (grd:ma a) :: decimal float to @rs
2015-07-12 20:26:23 +03:00
--
::
++ rq :: quad precision fp
2015-08-04 06:00:09 +03:00
~% %rq +> ~
2015-12-20 23:50:45 +03:00
|_ r/$?($n $u $d $z)
2015-08-06 21:21:47 +03:00
:: round to nearest, round up, round down, round to zero
::
2015-07-12 20:37:45 +03:00
++ ma
%*(. ff w 15, p 112, b --16.383, r r)
2015-08-06 21:21:47 +03:00
::
++ sea :: @rq to fn
2015-12-20 23:50:45 +03:00
|= {a/@rq} (sea:ma a)
2015-08-06 21:21:47 +03:00
::
++ bit :: fn to @rq
2015-12-20 23:50:45 +03:00
|= {a/fn} ^- @rq (bit:ma a)
2015-08-06 21:21:47 +03:00
::
++ add ~/ %add :: add
2015-12-20 23:50:45 +03:00
|= {a/@rq b/@rq} ^- @rq ~| %rq-fail
2015-08-06 21:21:47 +03:00
(add:ma a b)
::
++ sub ~/ %sub :: subtract
2015-12-20 23:50:45 +03:00
|= {a/@rq b/@rq} ^- @rq ~| %rq-fail
2015-08-06 21:21:47 +03:00
(sub:ma a b)
::
++ mul ~/ %mul :: multiply
2015-12-20 23:50:45 +03:00
|= {a/@rq b/@rq} ^- @rq ~| %rq-fail
2015-08-06 21:21:47 +03:00
(mul:ma a b)
::
++ div ~/ %div :: divide
2015-12-20 23:50:45 +03:00
|= {a/@rq b/@rq} ^- @rq ~| %rq-fail
2015-08-06 21:21:47 +03:00
(div:ma a b)
::
++ fma ~/ %fma :: fused multiply-add
2015-12-20 23:50:45 +03:00
|= {a/@rq b/@rq c/@rq} ^- @rq ~| %rq-fail
2015-08-06 21:21:47 +03:00
(fma:ma a b c)
::
++ sqt ~/ %sqt :: square root
2015-12-20 23:50:45 +03:00
|= {a/@rq} ^- @rq ~| %rq-fail
2015-08-06 21:21:47 +03:00
(sqt:ma a)
::
++ lth ~/ %lth :: less-than
2015-12-20 23:50:45 +03:00
|= {a/@rq b/@rq} ~| %rq-fail (lth:ma a b)
2015-08-06 21:21:47 +03:00
++ lte ~/ %lte :: less-equals
2015-12-20 23:50:45 +03:00
|= {a/@rq b/@rq} ~| %rq-fail (lte:ma a b)
2015-08-06 21:21:47 +03:00
++ equ ~/ %equ :: equals
2015-12-20 23:50:45 +03:00
|= {a/@rq b/@rq} ~| %rq-fail (equ:ma a b)
2015-08-06 21:21:47 +03:00
++ gte ~/ %gte :: greater-equals
2015-12-20 23:50:45 +03:00
|= {a/@rq b/@rq} ~| %rq-fail (gte:ma a b)
2015-08-06 21:21:47 +03:00
++ gth ~/ %gth :: greater-than
2015-12-20 23:50:45 +03:00
|= {a/@rq b/@rq} ~| %rq-fail (gth:ma a b)
::
++ sun |= {a/@u} ^- @rq (sun:ma a) :: uns integer to @rq
++ san |= {a/@s} ^- @rq (san:ma a) :: sgn integer to @rq
++ sig |= {a/@rq} ^- ? (sig:ma a) :: get sign
++ exp |= {a/@rq} ^- @s (exp:ma a) :: get exponent
++ toi |= {a/@rq} ^- (unit @s) (toi:ma a) :: round to integer
++ drg |= {a/@rq} ^- dn (drg:ma a) :: @rq to decimal float
++ grd |= {a/dn} ^- @rq (grd:ma a) :: decimal float to @rq
2015-07-29 06:56:02 +03:00
--
::
++ rh :: half precision fp
2015-12-20 23:50:45 +03:00
|_ r/$?($n $u $d $z)
2015-08-06 21:21:47 +03:00
:: round to nearest, round up, round down, round to zero
::
2015-07-29 06:56:02 +03:00
++ ma
2015-08-04 06:00:09 +03:00
%*(. ff w 5, p 10, b --15, r r)
2015-08-06 21:21:47 +03:00
::
++ sea :: @rh to fn
2015-12-20 23:50:45 +03:00
|= {a/@rh} (sea:ma a)
2015-08-06 21:21:47 +03:00
::
++ bit :: fn to @rh
2015-12-20 23:50:45 +03:00
|= {a/fn} ^- @rh (bit:ma a)
2015-08-06 21:21:47 +03:00
::
++ tos :: @rh to @rs
2015-12-20 23:50:45 +03:00
|= {a/@rh} (bit:rs (sea a))
2015-08-06 21:21:47 +03:00
::
++ fos :: @rs to @rh
2015-12-20 23:50:45 +03:00
|= {a/@rs} (bit (sea:rs a))
2015-07-29 06:56:02 +03:00
::
2015-08-06 21:21:47 +03:00
++ lth ~/ %lth :: less-than
2015-12-20 23:50:45 +03:00
|= {a/@rh b/@rh} ~| %rh-fail (lth:ma a b)
2015-08-06 21:21:47 +03:00
++ lte ~/ %lte :: less-equals
2015-12-20 23:50:45 +03:00
|= {a/@rh b/@rh} ~| %rh-fail (lte:ma a b)
2015-08-06 21:21:47 +03:00
++ equ ~/ %equ :: equals
2015-12-20 23:50:45 +03:00
|= {a/@rh b/@rh} ~| %rh-fail (equ:ma a b)
2015-08-06 21:21:47 +03:00
++ gte ~/ %gte :: greater-equals
2015-12-20 23:50:45 +03:00
|= {a/@rh b/@rh} ~| %rh-fail (gte:ma a b)
2015-08-06 21:21:47 +03:00
++ gth ~/ %gth :: greater-than
2015-12-20 23:50:45 +03:00
|= {a/@rh b/@rh} ~| %rh-fail (gth:ma a b)
::
++ sun |= {a/@u} ^- @rh (sun:ma a) :: uns integer to @rh
++ san |= {a/@s} ^- @rh (san:ma a) :: sgn integer to @rh
++ sig |= {a/@rh} ^- ? (sig:ma a) :: get sign
++ exp |= {a/@rh} ^- @s (exp:ma a) :: get exponent
++ toi |= {a/@rh} ^- (unit @s) (toi:ma a) :: round to integer
++ drg |= {a/@rh} ^- dn (drg:ma a) :: @rh to decimal float
++ grd |= {a/dn} ^- @rh (grd:ma a) :: decimal float to @rh
--
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2013-09-29 00:21:18 +04:00
:: section 2cH, urbit time ::
::
2014-04-04 14:00:26 +04:00
++ year :: date to @d
2015-12-20 23:50:45 +03:00
|= det/date
2014-10-29 04:31:16 +03:00
^- @da
2013-09-29 00:21:18 +04:00
=+ ^= yer
?: a.det
(add 292.277.024.400 y.det)
(sub 292.277.024.400 (dec y.det))
=+ day=(yawn yer m.det d.t.det)
(yule day h.t.det m.t.det s.t.det f.t.det)
::
2014-04-04 14:00:26 +04:00
++ yore :: @d to date
2015-12-20 23:50:45 +03:00
|= now/@da
2013-09-29 00:21:18 +04:00
^- date
=+ rip=(yell now)
=+ ger=(yall d.rip)
:- ?: (gth y.ger 292.277.024.400)
[a=& y=(sub y.ger 292.277.024.400)]
[a=| y=+((sub 292.277.024.400 y.ger))]
[m.ger d.ger h.rip m.rip s.rip f.rip]
::
2014-04-04 14:00:26 +04:00
++ yell :: tarp from @d
2015-12-20 23:50:45 +03:00
|= now/@d
2013-09-29 00:21:18 +04:00
^- tarp
=+ sec=(rsh 6 1 now)
=+ ^= fan
=+ [muc=4 raw=(end 6 1 now)]
2015-12-04 01:58:42 +03:00
|- ^- (list @ux)
2013-09-29 00:21:18 +04:00
?: |(=(0 raw) =(0 muc))
~
=> .(muc (dec muc))
[(cut 4 [muc 1] raw) $(raw (end 4 muc raw))]
=+ day=(div sec day:yo)
=> .(sec (mod sec day:yo))
=+ hor=(div sec hor:yo)
=> .(sec (mod sec hor:yo))
=+ mit=(div sec mit:yo)
=> .(sec (mod sec mit:yo))
[day hor mit sec fan]
::
2014-04-04 14:00:26 +04:00
++ yule :: time atom
2015-12-20 23:50:45 +03:00
|= rip/tarp
2013-09-29 00:21:18 +04:00
^- @d
=+ ^= sec ;: add
2013-09-29 00:21:18 +04:00
(mul d.rip day:yo)
(mul h.rip hor:yo)
(mul m.rip mit:yo)
s.rip
==
=+ ^= fac =+ muc=4
|- ^- @
?~ f.rip
0
=> .(muc (dec muc))
(add (lsh 4 muc i.f.rip) $(f.rip t.f.rip))
(con (lsh 6 1 sec) fac)
::
2015-12-21 00:48:02 +03:00
++ yall :: day / to day of year
2015-12-20 23:50:45 +03:00
|= day/@ud
^- {y/@ud m/@ud d/@ud}
=+ [era=0 cet=0 lep=*?]
2013-09-29 00:21:18 +04:00
=> .(era (div day era:yo), day (mod day era:yo))
=> ^+ .
?: (lth day +(cet:yo))
.(lep &, cet 0)
=> .(lep |, cet 1, day (sub day +(cet:yo)))
.(cet (add cet (div day cet:yo)), day (mod day cet:yo))
=+ yer=(add (mul 400 era) (mul 100 cet))
2015-12-20 23:50:45 +03:00
|- ^- {y/@ud m/@ud d/@ud}
2013-09-29 00:21:18 +04:00
=+ dis=?:(lep 366 365)
?. (lth day dis)
=+ ner=+(yer)
$(yer ner, day (sub day dis), lep =(0 (end 0 2 ner)))
2015-12-20 23:50:45 +03:00
|- ^- {y/@ud m/@ud d/@ud}
2013-09-29 00:21:18 +04:00
=+ [mot=0 cah=?:(lep moy:yo moh:yo)]
2015-12-20 23:50:45 +03:00
|- ^- {y/@ud m/@ud d/@ud}
2013-09-29 00:21:18 +04:00
=+ zis=(snag mot cah)
?: (lth day zis)
[yer +(mot) +(day)]
$(mot +(mot), day (sub day zis))
::
2014-04-04 14:00:26 +04:00
++ yawn :: days since Jesus
2015-12-20 23:50:45 +03:00
|= {yer/@ud mot/@ud day/@ud}
2013-09-29 00:21:18 +04:00
^- @ud
=> .(mot (dec mot), day (dec day))
=> ^+ .
%= .
day
=+ cah=?:((yelp yer) moy:yo moh:yo)
|- ^- @ud
?: =(0 mot)
day
2013-09-29 00:21:18 +04:00
$(mot (dec mot), cah (slag 1 cah), day (add day (snag 0 cah)))
==
|- ^- @ud
?. =(0 (mod yer 4))
=+ ney=(dec yer)
$(yer ney, day (add day ?:((yelp ney) 366 365)))
?. =(0 (mod yer 100))
=+ nef=(sub yer 4)
$(yer nef, day (add day ?:((yelp nef) 1.461 1.460)))
2013-09-29 00:21:18 +04:00
?. =(0 (mod yer 400))
=+ nec=(sub yer 100)
$(yer nec, day (add day ?:((yelp nec) 36.525 36.524)))
2013-09-29 00:21:18 +04:00
(add day (mul (div yer 400) (add 1 (mul 4 36.524))))
::
2014-04-04 14:00:26 +04:00
++ yelp :: leap year
2015-12-20 23:50:45 +03:00
|= yer/@ud ^- ?
2013-09-29 00:21:18 +04:00
&(=(0 (mod yer 4)) |(!=(0 (mod yer 100)) =(0 (mod yer 400))))
::
++ yo :: time constants
2013-09-29 00:21:18 +04:00
|% ++ cet 36.524 :: (add 24 (mul 100 365))
++ day 86.400 :: (mul 24 hor)
++ era 146.097 :: (add 1 (mul 4 cet))
++ hor 3.600 :: (mul 60 mit)
++ jes 106.751.991.084.417 :: (mul 730.692.561 era)
++ mit 60
2015-12-04 01:58:42 +03:00
++ moh `(list @ud)`[31 28 31 30 31 30 31 31 30 31 30 31 ~]
++ moy `(list @ud)`[31 29 31 30 31 30 31 31 30 31 30 31 ~]
2013-09-29 00:21:18 +04:00
++ qad 126.144.001 :: (add 1 (mul 4 yer))
++ yer 31.536.000 :: (mul 365 day)
--
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2cI, almost macros ::
::
2015-03-31 01:12:18 +03:00
++ same |*(* +<) :: identity
++ head |*(^ +<-) :: get head
++ tail |*(^ +<+) :: get head
2015-04-14 03:29:54 +03:00
++ test |=(^ =(+<- +<+)) :: equality
2015-12-22 03:38:31 +03:00
++ cork |*({a/_|=(* **) b/gate} (corl b a)) :: compose forward
2015-03-31 01:12:18 +03:00
++ corl :: compose backwards
2015-12-20 23:50:45 +03:00
|* {a/gate b/_|=(* **)}
2015-12-26 13:07:50 +03:00
=< +:|.((a (b))) :: span check
2015-12-20 23:50:45 +03:00
|* c/_+<.b
2015-03-31 01:12:18 +03:00
(a (b c))
::
2014-10-04 05:22:37 +04:00
++ cury :: curry left
2015-12-20 23:50:45 +03:00
|* {a/_|=(^ **) b/*}
|* c/_+<+.a
2014-08-08 21:36:32 +04:00
(a b c)
::
2014-10-04 05:22:37 +04:00
++ curr :: curry right
2015-12-20 23:50:45 +03:00
|* {a/_|=(^ **) c/*}
|* b/_+<+.a
2014-08-13 03:16:30 +04:00
(a b c)
::
++ gulf :: range list
2015-12-20 23:50:45 +03:00
|=({a/@ b/@} `(list @)`?:(=(a +(b)) ~ [a $(a +(a))]))
::
2015-12-26 13:07:50 +03:00
++ hard :: force coerce to span
2015-12-20 23:50:45 +03:00
|* han/$+(* *)
|= fud/* ^- han
2013-09-29 00:21:18 +04:00
~| %hard
=+ gol=(han fud)
?>(=(gol fud) gol)
::
2015-12-26 13:07:50 +03:00
++ soft :: maybe coerce to span
2015-12-20 23:50:45 +03:00
|* han/$+(* *)
|= fud/* ^- (unit han)
2013-09-29 00:21:18 +04:00
=+ gol=(han fud)
?.(=(gol fud) ~ [~ gol])
::
++ slog :: deify printf
2015-12-20 23:50:45 +03:00
=| pri/@ :: priority level
|= a/tang ^+ same :: .= ~&(%a 1)
2015-07-28 01:39:36 +03:00
?~(a same ~>(%slog.[pri i.a] $(a t.a))) :: ((slog ~[>%a<]) 1)
::
2015-12-20 23:50:45 +03:00
++ mean |=(a/tang (fear (flop a) |.(!!))) :: deify stack trace
++ fear :: insert user mean
2015-12-20 23:50:45 +03:00
|* {a/tang _|?(**)}
^+ (+<+)
=> .(a `tang`a)
?~ a (+<+)
2015-07-06 22:00:01 +03:00
~_(i.a $(a t.a))
2015-07-29 23:43:55 +03:00
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2cJ, extra math ::
::
2015-12-21 00:16:39 +03:00
++ sqt :: sqrt w+remainder
2015-07-29 23:43:55 +03:00
~/ %sqt
2015-12-20 23:50:45 +03:00
|= a/@ ^- {p/@ q/@}
2015-07-29 23:43:55 +03:00
?~ a [0 0]
=+ [q=(div (dec (xeb a)) 2) r=0]
=- [-.b (sub a +.b)]
^= b |-
=+ s=(add r (bex q))
=+ t=(mul s s)
?: =(q 0)
?: (lte t a) [s t] [r (mul r r)]
?: (lte t a) $(r s, q (dec q)) $(q (dec q))
::
++ dvr
~/ %dvr
2015-12-20 23:50:45 +03:00
|= {a/@ b/@} ^- {p/@ q/@}
2015-07-29 23:43:55 +03:00
?< =(0 b)
[(div a b) (mod a b)]
::
++ pow
~/ %pow
2015-12-20 23:50:45 +03:00
|= {a/@ b/@}
2015-07-29 23:43:55 +03:00
?: =(b 0) 1
|- ?: =(b 1) a
=+ c=$(b (div b 2))
=+ d=(mul c c)
?~ (dis b 1) d (mul d a)
2013-09-29 00:21:18 +04:00
:::::::::::::::::::::::::::::::::::::::::::::::::::::: ::
:::: chapter 2d, containers ::::
:: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2dA, sets ::
::
++ apt :: set invariant
2015-12-20 23:50:45 +03:00
|= a/(tree)
2014-06-07 05:09:44 +04:00
?~ a
&
2015-06-24 23:50:35 +03:00
?& ?~(l.a & ?&((vor n.a n.l.a) (hor n.l.a n.a) $(a l.a)))
?~(r.a & ?&((vor n.a n.r.a) (hor n.a n.r.a) $(a r.a)))
2013-09-29 00:21:18 +04:00
==
::
++ in :: set engine
~/ %in
2016-01-05 04:29:30 +03:00
|_ a/(set)
+- all :: logical AND
2013-09-29 00:21:18 +04:00
~/ %all
2015-12-20 23:50:45 +03:00
|* b/$+(* ?)
2013-09-29 00:21:18 +04:00
|- ^- ?
2014-06-07 05:09:44 +04:00
?~ a
2013-09-29 00:21:18 +04:00
&
?&((b n.a) $(a l.a) $(a r.a))
::
+- any :: logical OR
2013-09-29 00:21:18 +04:00
~/ %any
2015-12-20 23:50:45 +03:00
|* b/$+(* ?)
2013-09-29 00:21:18 +04:00
|- ^- ?
2014-06-07 05:09:44 +04:00
?~ a
2013-09-29 00:21:18 +04:00
|
?|((b n.a) $(a l.a) $(a r.a))
::
2015-07-02 08:21:38 +03:00
+- bif :: splits a by b
~/ %bif
2015-12-20 23:50:45 +03:00
|* b/*
2015-07-02 08:21:38 +03:00
^+ [l=a r=a]
=< [+< +>]
|- ^+ a
?~ a
[b ~ ~]
?: =(b n.a)
a
?: (hor b n.a)
=+ c=$(a l.a)
?> ?=(^ c)
[n.c l.c [n.a r.c r.a]]
=+ c=$(a r.a)
?> ?=(^ c)
[n.c [n.a l.a l.c] r.c]
::
+- del :: b without any a
2013-09-29 00:21:18 +04:00
~/ %del
2015-12-20 23:50:45 +03:00
|* b/*
2013-09-29 00:21:18 +04:00
|- ^+ a
?~ a
~
?. =(b n.a)
?: (hor b n.a)
[n.a $(a l.a) r.a]
2013-09-29 00:21:18 +04:00
[n.a l.a $(a r.a)]
2015-12-15 01:21:10 +03:00
|- ^- {$?($~ _a)}
2013-09-29 00:21:18 +04:00
?~ l.a r.a
?~ r.a l.a
?: (vor n.l.a n.r.a)
[n.l.a l.l.a $(l.a r.l.a)]
[n.r.a $(r.a l.r.a) r.r.a]
::
2015-06-25 02:21:06 +03:00
+- dif :: difference
~/ %dif
2015-12-20 23:50:45 +03:00
|* b/_a
2015-06-25 02:21:06 +03:00
|- ^+ a
?~ b
a
=+ c=(bif n.b)
2015-06-25 02:21:06 +03:00
?> ?=(^ c)
=+ d=$(a l.c, b l.b)
=+ e=$(a r.c, b r.b)
2015-12-15 01:21:10 +03:00
|- ^- {$?($~ _a)}
2015-06-25 02:21:06 +03:00
?~ d e
?~ e d
?: (vor n.d n.e)
[n.d l.d $(d r.d)]
[n.e $(e l.e) r.e]
::
+- dig :: axis of a in b
2015-12-20 23:50:45 +03:00
|= b/*
2013-09-29 00:21:18 +04:00
=+ c=1
2015-12-04 01:58:42 +03:00
|- ^- (unit @)
2013-09-29 00:21:18 +04:00
?~ a ~
?: =(b n.a) [~ u=(peg c 2)]
2015-04-20 23:42:18 +03:00
?: (hor b n.a)
2013-09-29 00:21:18 +04:00
$(a l.a, c (peg c 6))
$(a r.a, c (peg c 7))
::
+- gas :: concatenate
2013-09-29 00:21:18 +04:00
~/ %gas
2015-12-20 23:50:45 +03:00
|= b/(list _?>(?=(^ a) n.a))
2013-09-29 00:21:18 +04:00
|- ^+ a
2014-06-07 05:09:44 +04:00
?~ b
2013-09-29 00:21:18 +04:00
a
$(b t.b, a (put i.b))
2013-09-29 00:21:18 +04:00
::
+- has :: b exists in a check
2013-09-29 00:21:18 +04:00
~/ %has
2015-12-20 23:50:45 +03:00
|* b/*
2013-09-29 00:21:18 +04:00
|- ^- ?
2014-06-07 05:09:44 +04:00
?~ a
2013-09-29 00:21:18 +04:00
|
?: =(b n.a)
&
?: (hor b n.a)
$(a l.a)
$(a r.a)
2014-06-11 07:02:20 +04:00
::
+- int :: intersection
~/ %int
2015-12-20 23:50:45 +03:00
|* b/_a
2014-06-11 21:12:10 +04:00
|- ^+ a
?~ b
~
2014-06-11 21:12:10 +04:00
?~ a
~
2014-06-11 21:12:10 +04:00
?. (vor n.a n.b)
$(a b, b a)
?: =(n.b n.a)
[n.a $(a l.a, b l.b) $(a r.a, b r.b)]
?: (hor n.b n.a)
%- uni(a $(a l.a, b [n.b l.b ~])) $(b r.b)
%- uni(a $(a r.a, b [n.b ~ r.b])) $(b l.b)
2014-06-11 21:12:10 +04:00
::
+- put :: puts b in a, sorted
2013-09-29 00:21:18 +04:00
~/ %put
2015-12-20 23:50:45 +03:00
|* b/*
2013-09-29 00:21:18 +04:00
|- ^+ a
2014-06-07 05:09:44 +04:00
?~ a
2013-09-29 00:21:18 +04:00
[b ~ ~]
?: =(b n.a)
a
?: (hor b n.a)
=+ c=$(a l.a)
?> ?=(^ c)
?: (vor n.a n.c)
[n.a c r.a]
[n.c l.c [n.a r.c r.a]]
=+ c=$(a r.a)
?> ?=(^ c)
?: (vor n.a n.c)
[n.a l.a c]
[n.c [n.a l.a l.c] r.c]
::
2015-01-09 02:56:48 +03:00
+- rep :: replace by product
2015-12-20 23:50:45 +03:00
|* b/_|=({* *} +<+)
2013-09-29 00:21:18 +04:00
|-
2015-01-09 02:56:48 +03:00
?~ a +<+.b
$(a r.a, +<+.b $(a l.a, +<+.b (b n.a +<+.b)))
2013-09-29 00:21:18 +04:00
::
2016-01-11 09:37:59 +03:00
+- run :: apply gate to values
|* {b/$+(* *) c/*}
|-
?~ a c
$(a r.a, c [(b n.a) $(a l.a)])
::
+- tap :: convert to list
2013-09-29 00:21:18 +04:00
~/ %tap
2015-12-20 23:50:45 +03:00
|= b/(list _?>(?=(^ a) n.a))
2013-09-29 00:21:18 +04:00
^+ b
2014-06-07 05:09:44 +04:00
?~ a
2013-09-29 00:21:18 +04:00
b
$(a r.a, b [n.a $(a l.a)])
::
+- uni :: union
~/ %uni
2015-12-20 23:50:45 +03:00
|* b/_a
2015-01-24 08:16:12 +03:00
?: =(a b) a
|- ^+ a
?~ b
a
?~ a
b
?: (vor n.a n.b)
?: =(n.b n.a)
[n.b $(a l.a, b l.b) $(a r.a, b r.b)]
?: (hor n.b n.a)
$(a [n.a $(a l.a, b [n.b l.b ~]) r.a], b r.b)
$(a [n.a l.a $(a r.a, b [n.b ~ r.b])], b l.b)
?: =(n.a n.b)
[n.b $(b l.b, a l.a) $(b r.b, a r.a)]
?: (hor n.a n.b)
$(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
$(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
::
2014-07-16 22:54:53 +04:00
+- wyt :: size of set
2013-09-29 00:21:18 +04:00
|- ^- @
?~(a 0 +((add $(a l.a) $(a r.a))))
--
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2dB, maps ::
::
++ ept :: map invariant
2015-12-20 23:50:45 +03:00
|= a/(tree {p/* q/*})
2014-06-07 05:09:44 +04:00
?~ a
&
2015-06-24 23:50:35 +03:00
?& ?~(l.a & ?&((vor p.n.a p.n.l.a) (gor p.n.l.a p.n.a) $(a l.a)))
?~(r.a & ?&((vor p.n.a p.n.r.a) (gor p.n.a p.n.r.a) $(a l.a)))
2013-09-29 00:21:18 +04:00
==
::
2014-04-22 02:25:35 +04:00
++ ja :: jar engine
2016-01-05 04:29:30 +03:00
|_ a/(jar)
+- get :: gets list by key
2015-12-20 23:50:45 +03:00
|* b/*
2014-04-22 02:25:35 +04:00
=+ c=(~(get by a) b)
?~(c ~ u.c)
::
+- add :: adds key-list pair
2015-12-20 23:50:45 +03:00
|* {b/* c/*}
=+ d=(get b)
2014-07-03 22:07:21 +04:00
(~(put by a) b [c d])
2014-04-22 02:25:35 +04:00
--
::
++ ju :: jug engine
2016-01-05 04:29:30 +03:00
|_ a/(jug)
+- del :: del key-set pair
2015-12-20 23:50:45 +03:00
|* {b/* c/*}
^+ a
=+ d=(get b)
=+ e=(~(del in d) c)
?~ e
(~(del by a) b)
(~(put by a) b e)
::
2015-06-03 03:40:34 +03:00
+- gas :: concatenate
2015-12-20 23:50:45 +03:00
|* b/(list {p/* q/*})
2015-12-15 01:21:10 +03:00
=> .(b `(list _?>(?=({{* ^} ^} a) [p=p q=n.q]:n.a))`b)
2015-06-03 03:40:34 +03:00
|- ^+ a
?~ b
a
$(b t.b, a (put p.i.b q.i.b))
2015-06-03 03:40:34 +03:00
::
+- get :: gets set by key
2015-12-20 23:50:45 +03:00
|* b/*
2014-04-22 02:25:35 +04:00
=+ c=(~(get by a) b)
?~(c ~ u.c)
::
+- has :: existence check
2015-12-20 23:50:45 +03:00
|* {b/* c/*}
2014-04-23 21:02:36 +04:00
^- ?
(~(has in (get b)) c)
2014-04-23 21:02:36 +04:00
::
2014-06-10 00:09:14 +04:00
+- put :: add key-set pair
2015-12-20 23:50:45 +03:00
|* {b/* c/*}
2014-04-23 21:02:36 +04:00
^+ a
=+ d=(get b)
2014-04-23 21:02:36 +04:00
(~(put by a) b (~(put in d) c))
2014-04-22 02:25:35 +04:00
--
::
2013-09-29 00:21:18 +04:00
++ by :: map engine
~/ %by
2016-01-05 04:29:30 +03:00
|_ a/(map)
+- all :: logical AND
2013-09-29 00:21:18 +04:00
~/ %all
2015-12-20 23:50:45 +03:00
|* b/$+(* ?)
2013-09-29 00:21:18 +04:00
|- ^- ?
2014-06-07 05:09:44 +04:00
?~ a
2013-09-29 00:21:18 +04:00
&
?&((b q.n.a) $(a l.a) $(a r.a))
::
+- any :: logical OR
2013-09-29 00:21:18 +04:00
~/ %any
2015-12-20 23:50:45 +03:00
|* b/$+(* ?)
2013-09-29 00:21:18 +04:00
|- ^- ?
2014-06-07 05:09:44 +04:00
?~ a
2013-09-29 00:21:18 +04:00
|
?|((b q.n.a) $(a l.a) $(a r.a))
::
2015-07-02 08:21:38 +03:00
+- bif :: splits a by b
~/ %bif
2015-12-20 23:50:45 +03:00
|* {b/* c/*}
2015-07-02 08:21:38 +03:00
^+ [l=a r=a]
=< [+< +>]
|- ^+ a
?~ a
[[b c] ~ ~]
?: =(b p.n.a)
?: =(c q.n.a)
a
[[b c] l.a r.a]
?: (gor b p.n.a)
=+ d=$(a l.a)
?> ?=(^ d)
[n.d l.d [n.a r.d r.a]]
=+ d=$(a r.a)
?> ?=(^ d)
[n.d [n.a l.a l.d] r.d]
::
+- del :: delete at key b
2013-09-29 00:21:18 +04:00
~/ %del
2015-12-20 23:50:45 +03:00
|* b/*
2013-09-29 00:21:18 +04:00
|- ^+ a
?~ a
~
?. =(b p.n.a)
?: (gor b p.n.a)
[n.a $(a l.a) r.a]
2013-09-29 00:21:18 +04:00
[n.a l.a $(a r.a)]
2015-12-15 01:21:10 +03:00
|- ^- {$?($~ _a)}
2013-09-29 00:21:18 +04:00
?~ l.a r.a
?~ r.a l.a
?: (vor p.n.l.a p.n.r.a)
[n.l.a l.l.a $(l.a r.l.a)]
[n.r.a $(r.a l.r.a) r.r.a]
::
2015-06-25 02:21:06 +03:00
+- dif :: difference
~/ %dif
2015-12-20 23:50:45 +03:00
|* b/_a
2015-06-25 02:21:06 +03:00
|- ^+ a
?~ b
a
=+ c=(bif n.b)
2015-06-25 02:21:06 +03:00
?> ?=(^ c)
=+ d=$(a l.c, b l.b)
=+ e=$(a r.c, b r.b)
2015-12-15 01:21:10 +03:00
|- ^- {$?($~ _a)}
2015-06-25 02:21:06 +03:00
?~ d e
?~ e d
?: (vor p.n.d p.n.e)
[n.d l.d $(d r.d)]
[n.e $(e l.e) r.e]
::
+- dig :: axis of b key
2015-12-20 23:50:45 +03:00
|= b/*
2013-09-29 00:21:18 +04:00
=+ c=1
2015-12-04 18:16:34 +03:00
|- ^- (unit @)
2013-09-29 00:21:18 +04:00
?~ a ~
?: =(b p.n.a) [~ u=(peg c 2)]
?: (gor b p.n.a)
$(a l.a, c (peg c 6))
$(a r.a, c (peg c 7))
::
+- gas :: concatenate
2013-09-29 00:21:18 +04:00
~/ %gas
2015-12-20 23:50:45 +03:00
|* b/(list {p/* q/*})
2015-12-15 01:21:10 +03:00
=> .(b `(list _?>(?=(^ a) n.a))`b)
2013-09-29 00:21:18 +04:00
|- ^+ a
2014-06-07 05:09:44 +04:00
?~ b
2013-09-29 00:21:18 +04:00
a
$(b t.b, a (put p.i.b q.i.b))
2013-09-29 00:21:18 +04:00
::
+- get :: grab value by key
2013-09-29 00:21:18 +04:00
~/ %get
2015-12-20 23:50:45 +03:00
|= b/*
^- {$@($~ {$~ u/_?>(?=(^ a) q.n.a)})}
2014-06-07 05:09:44 +04:00
?~ a
2013-09-29 00:21:18 +04:00
~
?: =(b p.n.a)
[~ u=q.n.a]
?: (gor b p.n.a)
$(a l.a)
$(a r.a)
::
2014-07-22 18:10:01 +04:00
+- got
2015-12-20 23:50:45 +03:00
|* b/*
(need (get b))
2014-07-22 18:10:01 +04:00
::
+- has :: key existence check
2013-09-29 00:21:18 +04:00
~/ %has
2015-12-20 23:50:45 +03:00
|* b/*
!=(~ (get b))
2013-09-29 00:21:18 +04:00
::
+- int :: intersection
~/ %int
2015-12-20 23:50:45 +03:00
|* b/_a
|- ^+ a
?~ b
~
?~ a
~
?: (vor p.n.a p.n.b)
?: =(p.n.b p.n.a)
[n.b $(a l.a, b l.b) $(a r.a, b r.b)]
2015-02-27 09:35:41 +03:00
?: (gor p.n.b p.n.a)
%- uni(a $(a l.a, b [n.b l.b ~])) $(b r.b)
%- uni(a $(a r.a, b [n.b ~ r.b])) $(b l.b)
?: =(p.n.a p.n.b)
[n.b $(b l.b, a l.a) $(b r.b, a r.a)]
2015-02-27 09:35:41 +03:00
?: (gor p.n.a p.n.b)
%- uni(a $(b l.b, a [n.a l.a ~])) $(a r.a)
%- uni(a $(b r.b, a [n.a ~ r.a])) $(a l.a)
::
+- mar :: add with validation
2015-12-20 23:50:45 +03:00
|* {b/_?>(?=(^ a) p.n.a) c/(unit _?>(?=(^ a) q.n.a))}
2013-09-29 00:21:18 +04:00
?~ c
(del b)
(put b u.c)
::
+- put :: adds key-value pair
2013-09-29 00:21:18 +04:00
~/ %put
2015-12-20 23:50:45 +03:00
|* {b/* c/*}
2013-09-29 00:21:18 +04:00
|- ^+ a
2014-06-07 05:09:44 +04:00
?~ a
2013-09-29 00:21:18 +04:00
[[b c] ~ ~]
?: =(b p.n.a)
?: =(c q.n.a)
a
[[b c] l.a r.a]
?: (gor b p.n.a)
=+ d=$(a l.a)
2015-06-24 23:50:35 +03:00
?> ?=(^ d)
?: (vor p.n.a p.n.d)
[n.a d r.a]
[n.d l.d [n.a r.d r.a]]
=+ d=$(a r.a)
?> ?=(^ d)
?: (vor p.n.a p.n.d)
[n.a l.a d]
[n.d [n.a l.a l.d] r.d]
::
+- rep :: replace by product
2015-12-20 23:50:45 +03:00
|* b/_|=({* *} +<+)
2013-09-29 00:21:18 +04:00
|-
2015-01-09 02:56:48 +03:00
?~ a +<+.b
$(a r.a, +<+.b $(a l.a, +<+.b (b n.a +<+.b)))
2013-09-29 00:21:18 +04:00
::
+- rib :: transform + product
2015-12-20 23:50:45 +03:00
|* {b/* c/$+(* *)}
2013-09-29 00:21:18 +04:00
|- ^+ [b a]
?~ a [b ~]
=+ d=(c n.a b)
=. n.a +.d
=+ e=$(a l.a, b -.d)
=+ f=$(a r.a, b -.e)
[-.f [n.a +.e +.f]]
::
+- run :: apply gate to values
2015-12-20 23:50:45 +03:00
|* b/$+(* *)
|-
2013-09-29 00:21:18 +04:00
?~ a a
[n=[p=p.n.a q=(b q.n.a)] l=$(a l.a) r=$(a r.a)]
2013-09-29 00:21:18 +04:00
::
+- tap :: listify pairs
2013-09-29 00:21:18 +04:00
~/ %tap
2015-12-20 23:50:45 +03:00
|= b/(list _?>(?=(^ a) n.a))
2013-09-29 00:21:18 +04:00
^+ b
2014-06-07 05:09:44 +04:00
?~ a
2013-09-29 00:21:18 +04:00
b
$(a r.a, b [n.a $(a l.a)])
::
+- uni :: union, merge
2014-04-16 00:07:11 +04:00
~/ %uni
2015-12-20 23:50:45 +03:00
|* b/_a
|- ^+ a
?~ b
a
?~ a
b
?: (vor p.n.a p.n.b)
?: =(p.n.b p.n.a)
[n.b $(a l.a, b l.b) $(a r.a, b r.b)]
2015-02-27 09:35:41 +03:00
?: (gor p.n.b p.n.a)
$(a [n.a $(a l.a, b [n.b l.b ~]) r.a], b r.b)
$(a [n.a l.a $(a r.a, b [n.b ~ r.b])], b l.b)
?: =(p.n.a p.n.b)
[n.b $(b l.b, a l.a) $(b r.b, a r.a)]
2015-02-27 09:35:41 +03:00
?: (gor p.n.a p.n.b)
$(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
$(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
2014-04-16 00:07:11 +04:00
::
+- urn :: apply gate to nodes
2015-12-20 23:50:45 +03:00
|* b/$+({* *} *)
2014-06-19 07:27:36 +04:00
|-
?~ a ~
[n=[p=p.n.a q=(b p.n.a q.n.a)] l=$(a l.a) r=$(a r.a)]
2014-04-16 00:07:11 +04:00
::
+- wyt :: depth of map
2013-09-29 00:21:18 +04:00
|- ^- @
?~(a 0 +((add $(a l.a) $(a r.a))))
--
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2dC, queues ::
::
++ to :: queue engine
2016-01-05 04:29:30 +03:00
|_ a/(qeu)
2013-09-29 00:21:18 +04:00
+- bal
|- ^+ a
2013-12-24 00:49:15 +04:00
?~ a ~
2015-12-08 05:04:19 +03:00
?. |(?=($~ l.a) (vor n.a n.l.a))
2013-09-29 00:21:18 +04:00
$(a [n.l.a l.l.a $(a [n.a r.l.a r.a])])
2015-12-08 05:04:19 +03:00
?. |(?=($~ r.a) (vor n.a n.r.a))
2013-09-29 00:21:18 +04:00
$(a [n.r.a $(a [n.a l.a l.r.a]) r.r.a])
a
::
+- dep :: max depth of queue
2013-09-29 00:21:18 +04:00
|- ^- @
?~ a 0
+((max $(a l.a) $(a r.a)))
::
+- gas :: insert list to que
2015-12-20 23:50:45 +03:00
|= b/(list _?>(?=(^ a) n.a))
2013-09-29 00:21:18 +04:00
|- ^+ a
?~(b a $(b t.b, a (put i.b)))
2013-09-29 00:21:18 +04:00
::
+- get :: head-tail pair
2015-12-15 01:21:10 +03:00
|- ^+ ?>(?=(^ a) [p=n.a q=*(qeu _n.a)])
2013-09-29 00:21:18 +04:00
?~ a
!!
?~ r.a
[n.a l.a]
=+ b=$(a r.a)
:- p.b
2015-12-04 01:58:42 +03:00
?: |(?=($~ q.b) (vor n.a n.q.b))
2013-09-29 00:21:18 +04:00
[n.a l.a q.b]
[n.q.b [n.a l.a l.q.b] r.q.b]
::
+- nap :: removes head
2013-09-29 00:21:18 +04:00
?> ?=(^ a)
?: =(~ l.a) r.a
=+ b=get(a l.a)
bal(a ^+(a [p.b q.b r.a]))
2013-09-29 00:21:18 +04:00
::
+- put :: insert new tail
2015-12-20 23:50:45 +03:00
|* b/*
2013-09-29 00:21:18 +04:00
|- ^+ a
?~ a
[b ~ ~]
bal(a a(l $(a l.a)))
2013-09-29 00:21:18 +04:00
::
+- tap :: adds list to end
2015-12-20 23:50:45 +03:00
|= b/(list _?>(?=(^ a) n.a))
2014-12-04 02:21:55 +03:00
=+ z=0 :: XX breaks jet match
2013-09-29 00:21:18 +04:00
^+ b
?~ a
b
$(a r.a, b [n.a $(a l.a)])
::
+- top :: produces head
2015-12-15 01:21:10 +03:00
|- ^- (unit _?>(?=(^ a) n.a))
2013-09-29 00:21:18 +04:00
?~ a ~
?~(r.a [~ n.a] $(a r.a))
--
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2dD, casual containers ::
::
2016-01-02 03:19:06 +03:00
++ ly :: list from raw noun
|* a/*
2016-01-02 01:47:07 +03:00
^+((homo (limo a)) a)
2016-01-01 04:01:19 +03:00
::
2016-01-02 03:19:06 +03:00
++ my :: map from raw noun
|* a/*
2016-01-02 01:47:07 +03:00
(malt ^+((homo (limo a)) a))
::
++ malt :: map from raw list
|* a/(list)
2016-01-02 01:47:07 +03:00
(molt `(list {p/_-<.a q/_->.a})`a)
::
++ molt :: map from pair list
|* a/(list (pair))
2016-01-02 01:47:07 +03:00
(~(gas by `(map _p.i.-.a _q.i.-.a)`~) a)
2016-01-01 04:01:19 +03:00
::
2016-01-02 03:19:06 +03:00
++ sy :: set from raw noun
|* a/*
(silt ^+((homo (limo a)) a))
::
++ silt :: make a set
2015-12-20 23:50:45 +03:00
|* a/(list)
2015-12-15 01:21:10 +03:00
=+ b=*(set _?>(?=(^ a) i.a))
2013-09-29 00:21:18 +04:00
(~(gas in b) a)
:::::::::::::::::::::::::::::::::::::::::::::::::::::: ::
:::: chapter 2e, miscellaneous libs ::::
:: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2eA, packing ::
::
++ cue :: unpack
~/ %cue
2015-12-20 23:50:45 +03:00
|= a/@
2013-09-29 00:21:18 +04:00
^- *
=+ b=0
2015-12-04 01:58:42 +03:00
=+ m=`(map @ *)`~
2013-09-29 00:21:18 +04:00
=< q
2015-12-20 23:50:45 +03:00
|- ^- {p/@ q/* r/(map @ *)}
2013-09-29 00:21:18 +04:00
?: =(0 (cut 0 [b 1] a))
=+ c=(rub +(b) a)
[+(p.c) q.c (~(put by m) b q.c)]
=+ c=(add 2 b)
?: =(0 (cut 0 [+(b) 1] a))
=+ u=$(b c)
=+ v=$(b (add p.u c), m r.u)
=+ w=[q.u q.v]
[(add 2 (add p.u p.v)) w (~(put by r.v) b w)]
=+ d=(rub c a)
[(add 2 p.d) (need (~(get by m) q.d)) m]
::
++ jam :: pack
~/ %jam
2015-12-20 23:50:45 +03:00
|= a/*
2013-09-29 00:21:18 +04:00
^- @
=+ b=0
2015-12-04 01:58:42 +03:00
=+ m=`(map * @)`~
2013-09-29 00:21:18 +04:00
=< q
2015-12-20 23:50:45 +03:00
|- ^- {p/@ q/@ r/(map * @)}
2013-09-29 00:21:18 +04:00
=+ c=(~(get by m) a)
2014-06-07 05:09:44 +04:00
?~ c
2013-09-29 00:21:18 +04:00
=> .(m (~(put by m) a b))
?: ?=(@ a)
=+ d=(mat a)
[(add 1 p.d) (lsh 0 1 q.d) m]
=> .(b (add 2 b))
=+ d=$(a -.a)
=+ e=$(a +.a, b (add b p.d), m r.d)
[(add 2 (add p.d p.e)) (mix 1 (lsh 0 2 (cat 0 q.d q.e))) r.e]
?: ?&(?=(@ a) (lte (met 0 a) (met 0 u.c)))
=+ d=(mat a)
[(add 1 p.d) (lsh 0 1 q.d) m]
=+ d=(mat u.c)
[(add 2 p.d) (mix 3 (lsh 0 2 q.d)) m]
::
++ mat :: length-encode
~/ %mat
2015-12-20 23:50:45 +03:00
|= a/@
^- {p/@ q/@}
2013-09-29 00:21:18 +04:00
?: =(0 a)
[1 1]
=+ b=(met 0 a)
=+ c=(met 0 b)
:- (add (add c c) b)
(cat 0 (bex c) (mix (end 0 (dec c) b) (lsh 0 (dec c) a)))
::
++ rub :: length-decode
~/ %rub
2015-12-20 23:50:45 +03:00
|= {a/@ b/@}
^- {p/@ q/@}
=+ ^= c
=+ [c=0 m=(met 0 b)]
|- ?< (gth c m)
?. =(0 (cut 0 [(add a c) 1] b))
c
$(c +(c))
2013-09-29 00:21:18 +04:00
?: =(0 c)
[1 0]
=+ d=(add a +(c))
=+ e=(add (bex (dec c)) (cut 0 [d (dec c)] b))
[(add (add c c) e) (cut 0 [(add d (dec c)) e] b)]
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2eB, parsing (tracing) ::
::
2015-12-20 23:50:45 +03:00
++ last |= {zyc/hair naz/hair} :: farther trace
2013-09-29 00:21:18 +04:00
^- hair
?: =(p.zyc p.naz)
?:((gth q.zyc q.naz) zyc naz)
?:((gth p.zyc p.naz) zyc naz)
::
2015-12-20 23:50:45 +03:00
++ lust |= {weq/char naz/hair} :: detect newline
2013-09-29 00:21:18 +04:00
^- hair
?:(=(10 weq) [+(p.naz) 1] [p.naz +(q.naz)])
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2eC, parsing (custom rules) ::
::
2015-12-21 00:16:39 +03:00
++ cold :: replace w+ constant
2013-09-29 00:21:18 +04:00
~/ %cold
2015-12-20 23:50:45 +03:00
|* {cus/* sef/rule}
2013-09-29 00:21:18 +04:00
~/ %fun
2015-12-20 23:50:45 +03:00
|= tub/nail
2013-09-29 00:21:18 +04:00
=+ vex=(sef tub)
2014-06-07 05:09:44 +04:00
?~ q.vex
2013-09-29 00:21:18 +04:00
vex
[p=p.vex q=[~ u=[p=cus q=q.u.q.vex]]]
::
2014-06-01 05:41:27 +04:00
++ cook :: apply gate
2013-09-29 00:21:18 +04:00
~/ %cook
2015-12-20 23:50:45 +03:00
|* {poq/$+(* *) sef/rule}
2013-09-29 00:21:18 +04:00
~/ %fun
2015-12-20 23:50:45 +03:00
|= tub/nail
2013-09-29 00:21:18 +04:00
=+ vex=(sef tub)
2014-06-07 05:09:44 +04:00
?~ q.vex
2013-09-29 00:21:18 +04:00
vex
[p=p.vex q=[~ u=[p=(poq p.u.q.vex) q=q.u.q.vex]]]
::
2014-06-01 05:41:27 +04:00
++ easy :: always parse
2013-09-29 00:21:18 +04:00
~/ %easy
2015-12-20 23:50:45 +03:00
|* huf/*
2013-09-29 00:21:18 +04:00
~/ %fun
2015-12-20 23:50:45 +03:00
|= tub/nail
2015-12-15 01:21:10 +03:00
^- (like _huf)
2013-09-29 00:21:18 +04:00
[p=p.tub q=[~ u=[p=huf q=tub]]]
::
2015-12-20 23:50:45 +03:00
++ fail |=(tub/nail [p=p.tub q=~]) :: never parse
2014-06-01 05:41:27 +04:00
++ full :: has to fully parse
2015-12-20 23:50:45 +03:00
|* sef/rule
|= tub/nail
2013-09-29 00:21:18 +04:00
=+ vex=(sef tub)
2014-06-07 05:09:44 +04:00
?~(q.vex vex ?:(=(~ q.q.u.q.vex) vex [p=p.vex q=~]))
2013-09-29 00:21:18 +04:00
::
2014-06-01 05:41:27 +04:00
++ funk :: add to tape first
2015-12-20 23:50:45 +03:00
|* {pre/tape sef/rule}
|= tub/nail
2013-09-29 00:21:18 +04:00
(sef p.tub (weld pre q.tub))
::
2014-06-01 05:41:27 +04:00
++ here :: place-based apply
2013-09-29 00:21:18 +04:00
~/ %here
2015-12-20 23:50:45 +03:00
|* {hez/_|=({a/pint b/*} [a b]) sef/rule}
2013-09-29 00:21:18 +04:00
~/ %fun
2015-12-20 23:50:45 +03:00
|= tub/nail
2013-09-29 00:21:18 +04:00
=+ vex=(sef tub)
2014-06-07 05:09:44 +04:00
?~ q.vex
2013-09-29 00:21:18 +04:00
vex
[p=p.vex q=[~ u=[p=(hez [p.tub p.q.u.q.vex] p.u.q.vex) q=q.u.q.vex]]]
::
++ inde |* sef/rule :: indentation block
2014-06-18 14:01:17 +04:00
|= nail ^+ (sef)
=+ [har tap]=[p q]:+<
=+ lev=(fil 3 (dec q.har) ' ')
=+ eol=(just `@t`10)
=+ =- roq=((star ;~(pose prn ;~(sfix eol (jest lev)) -)) har tap)
;~(simu ;~(plug eol eol) eol)
2014-06-18 14:01:17 +04:00
?~ q.roq roq
=+ vex=(sef har(q 1) p.u.q.roq)
=+ fur=p.vex(q (add (dec q.har) q.p.vex))
?~ q.vex vex(p fur)
=- vex(p fur, u.q -)
:+ &3.vex
&4.vex(q.p (add (dec q.har) q.p.&4.vex))
2014-06-18 14:01:17 +04:00
=+ res=|4.vex
|- ?~ res |4.roq
?. =(10 -.res) [-.res $(res +.res)]
(welp [`@t`10 (trip lev)] $(res +.res))
2014-06-18 14:01:17 +04:00
::
2014-06-01 05:41:27 +04:00
++ jest :: match a cord
2015-12-20 23:50:45 +03:00
|= daf/@t
|= tub/nail
2013-09-29 00:21:18 +04:00
=+ fad=daf
2015-12-04 01:58:42 +03:00
|- ^- (like @t)
2013-09-29 00:21:18 +04:00
?: =(0 daf)
[p=p.tub q=[~ u=[p=fad q=tub]]]
2015-12-08 05:04:19 +03:00
?: |(?=($~ q.tub) !=((end 3 1 daf) i.q.tub))
2013-09-29 00:21:18 +04:00
(fail tub)
$(p.tub (lust i.q.tub p.tub), q.tub t.q.tub, daf (rsh 3 1 daf))
::
++ just :: XX redundant, jest
2014-06-01 05:41:27 +04:00
~/ %just :: match a char
2015-12-20 23:50:45 +03:00
|= daf/char
2013-09-29 00:21:18 +04:00
~/ %fun
2015-12-20 23:50:45 +03:00
|= tub/nail
2013-09-29 00:21:18 +04:00
^- (like char)
2014-06-07 05:09:44 +04:00
?~ q.tub
(fail tub)
2013-09-29 00:21:18 +04:00
?. =(daf i.q.tub)
(fail tub)
(next tub)
::
2014-06-01 05:41:27 +04:00
++ knee :: callbacks
2015-12-20 23:50:45 +03:00
|* {gar/* sef/_|.(*rule)}
|= tub/nail
2015-12-15 01:21:10 +03:00
^- (like _gar)
2013-09-29 00:21:18 +04:00
((sef) tub)
::
2014-06-01 05:41:27 +04:00
++ mask :: match char in set
2013-09-29 00:21:18 +04:00
~/ %mask
2015-12-20 23:50:45 +03:00
|= bud/(list char)
2013-09-29 00:21:18 +04:00
~/ %fun
2015-12-20 23:50:45 +03:00
|= tub/nail
2013-09-29 00:21:18 +04:00
^- (like char)
2014-06-07 05:09:44 +04:00
?~ q.tub
(fail tub)
2015-12-20 23:50:45 +03:00
?. (lien bud |=(a/char =(i.q.tub a)))
2013-09-29 00:21:18 +04:00
(fail tub)
(next tub)
::
2014-06-01 05:41:27 +04:00
++ next :: consume a char
2015-12-20 23:50:45 +03:00
|= tub/nail
2013-09-29 00:21:18 +04:00
^- (like char)
2014-06-07 05:09:44 +04:00
?~ q.tub
(fail tub)
=+ zac=(lust i.q.tub p.tub)
2013-09-29 00:21:18 +04:00
[zac [~ i.q.tub [zac t.q.tub]]]
::
2014-06-07 05:09:44 +04:00
++ sear :: conditional cook
2015-12-20 23:50:45 +03:00
|* {pyq/$+(* (unit)) sef/rule}
|= tub/nail
2013-09-29 00:21:18 +04:00
=+ vex=(sef tub)
2014-06-07 05:09:44 +04:00
?~ q.vex
2013-09-29 00:21:18 +04:00
vex
=+ gey=(pyq p.u.q.vex)
2014-06-07 05:09:44 +04:00
?~ gey
2013-09-29 00:21:18 +04:00
[p=p.vex q=~]
[p=p.vex q=[~ u=[p=u.gey q=q.u.q.vex]]]
::
2014-06-01 05:41:27 +04:00
++ shim :: match char in range
2013-09-29 00:21:18 +04:00
~/ %shim
2015-12-20 23:50:45 +03:00
|= {les/@ mos/@}
2013-09-29 00:21:18 +04:00
~/ %fun
2015-12-20 23:50:45 +03:00
|= tub/nail
2013-09-29 00:21:18 +04:00
^- (like char)
2014-06-07 05:09:44 +04:00
?~ q.tub
(fail tub)
?. ?&((gte i.q.tub les) (lte i.q.tub mos))
2013-09-29 00:21:18 +04:00
(fail tub)
(next tub)
::
2014-06-01 05:41:27 +04:00
++ stag :: add a label
2013-09-29 00:21:18 +04:00
~/ %stag
2015-12-20 23:50:45 +03:00
|* {gob/* sef/rule}
2013-09-29 00:21:18 +04:00
~/ %fun
2015-12-20 23:50:45 +03:00
|= tub/nail
2013-09-29 00:21:18 +04:00
=+ vex=(sef tub)
2014-06-07 05:09:44 +04:00
?~ q.vex
2013-09-29 00:21:18 +04:00
vex
[p=p.vex q=[~ u=[p=[gob p.u.q.vex] q=q.u.q.vex]]]
::
++ stet
2015-12-20 23:50:45 +03:00
|* leh/(list {?(@ {@ @}) rule})
|-
?~ leh
~
[i=[p=-.i.leh q=+.i.leh] t=$(leh t.leh)]
::
2014-08-24 06:20:02 +04:00
++ stew :: switch by first char
2013-09-29 00:21:18 +04:00
~/ %stew
2015-12-21 00:16:39 +03:00
|* leh/(list {p/?(@ {@ @}) q/rule}) :: char+range keys
2014-08-24 06:20:02 +04:00
=+ ^= wor :: range complete lth
2015-12-20 23:50:45 +03:00
|= {ort/?(@ {@ @}) wan/?(@ {@ @})}
2013-09-29 00:21:18 +04:00
?@ ort
?@(wan (lth ort wan) (lth ort -.wan))
?@(wan (lth +.ort wan) (lth +.ort -.wan))
2014-08-24 06:20:02 +04:00
=+ ^= hel :: build parser map
2015-12-15 01:21:10 +03:00
=+ hel=`(tree _?>(?=(^ leh) i.leh))`~
2013-09-29 00:21:18 +04:00
|- ^+ hel
?~ leh
~
=+ yal=$(leh t.leh)
|- ^+ hel
?~ yal
[i.leh ~ ~]
?: (wor p.i.leh p.n.yal)
=+ nuc=$(yal l.yal)
?> ?=(^ nuc)
?: (vor p.n.yal p.n.nuc)
[n.yal nuc r.yal]
[n.nuc l.nuc [n.yal r.nuc r.yal]]
=+ nuc=$(yal r.yal)
?> ?=(^ nuc)
?: (vor p.n.yal p.n.nuc)
[n.yal l.yal nuc]
[n.nuc [n.yal l.yal l.nuc] r.nuc]
~% %fun ..^$ ~
2015-12-20 23:50:45 +03:00
|= tub/nail
2014-06-07 05:09:44 +04:00
?~ q.tub
2013-09-29 00:21:18 +04:00
(fail tub)
|-
2014-06-07 05:09:44 +04:00
?~ hel
2013-09-29 00:21:18 +04:00
(fail tub)
?: ?@ p.n.hel
=(p.n.hel i.q.tub)
?&((gte i.q.tub -.p.n.hel) (lte i.q.tub +.p.n.hel))
:: (q.n.hel [(lust i.q.tub p.tub) t.q.tub])
(q.n.hel tub)
?: (wor i.q.tub p.n.hel)
$(hel l.hel)
$(hel r.hel)
::
++ stir
~/ %stir
2015-12-20 23:50:45 +03:00
|* {rud/* raq/_|*({a/* b/*} [a b]) fel/rule}
2013-09-29 00:21:18 +04:00
~/ %fun
2015-12-20 23:50:45 +03:00
|= tub/nail
2015-12-15 01:21:10 +03:00
^- (like _rud)
=+ vex=(fel tub)
2014-06-07 05:09:44 +04:00
?~ q.vex
[p.vex [~ rud tub]]
2013-09-29 00:21:18 +04:00
=+ wag=$(tub q.u.q.vex)
?> ?=(^ q.wag)
[(last p.vex p.wag) [~ (raq p.u.q.vex p.u.q.wag) q.u.q.wag]]
::
2014-06-01 05:41:27 +04:00
++ stun :: parse several times
|* {lig/{@ @} fel/rule}
2015-12-20 23:50:45 +03:00
|= tub/nail
2015-12-15 01:21:10 +03:00
^- (like (list _(wonk (fel))))
?: =(0 +.lig)
2013-09-29 00:21:18 +04:00
[p.tub [~ ~ tub]]
=+ vex=(fel tub)
2014-06-07 05:09:44 +04:00
?~ q.vex
?: =(0 -.lig)
2013-09-29 00:21:18 +04:00
[p.vex [~ ~ tub]]
vex
=+ ^= wag %= $
-.lig ?:(=(0 -.lig) 0 (dec -.lig))
+.lig ?:(=(0 +.lig) 0 (dec +.lig))
2013-09-29 00:21:18 +04:00
tub q.u.q.vex
==
2014-06-07 05:09:44 +04:00
?~ q.wag
2013-09-29 00:21:18 +04:00
wag
[p.wag [~ [p.u.q.vex p.u.q.wag] q.u.q.wag]]
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2eD, parsing (combinators) ::
::
++ bend :: conditional comp
2013-09-29 00:21:18 +04:00
~/ %bend
2015-12-20 23:50:45 +03:00
|* raq/_|*({a/* b/*} [~ u=[a b]])
2013-09-29 00:21:18 +04:00
~/ %fun
2015-12-20 23:50:45 +03:00
|* {vex/edge sab/rule}
2014-06-07 05:09:44 +04:00
?~ q.vex
vex
2013-09-29 00:21:18 +04:00
=+ yit=(sab q.u.q.vex)
=+ yur=(last p.vex p.yit)
2014-06-07 05:09:44 +04:00
?~ q.yit
2013-09-29 00:21:18 +04:00
[p=yur q=q.vex]
=+ vux=(raq p.u.q.vex p.u.q.yit)
?~ vux
[p=yur q=q.vex]
[p=yur q=[~ u=[p=u.vux q=q.u.q.yit]]]
::
++ comp
~/ %comp
2015-12-20 23:50:45 +03:00
|* raq/_|*({a/* b/*} [a b]) :: arbitrary compose
2013-09-29 00:21:18 +04:00
~/ %fun
2015-12-20 23:50:45 +03:00
|* {vex/edge sab/rule}
~! +<
2014-06-07 05:09:44 +04:00
?~ q.vex
2013-09-29 00:21:18 +04:00
vex
=+ yit=(sab q.u.q.vex)
=+ yur=(last p.vex p.yit)
2014-06-07 05:09:44 +04:00
?~ q.yit
2013-09-29 00:21:18 +04:00
[p=yur q=q.yit]
[p=yur q=[~ u=[p=(raq p.u.q.vex p.u.q.yit) q=q.u.q.yit]]]
::
2014-06-01 05:41:27 +04:00
++ glue :: add rule
2013-09-29 00:21:18 +04:00
~/ %glue
2015-12-20 23:50:45 +03:00
|* bus/rule
2013-09-29 00:21:18 +04:00
~/ %fun
2015-12-20 23:50:45 +03:00
|* {vex/edge sab/rule}
2013-09-29 00:21:18 +04:00
(plug vex ;~(pfix bus sab))
::
++ less :: no first and second
2015-12-20 23:50:45 +03:00
|* {vex/edge sab/rule}
?~ q.vex
=+ roq=(sab)
[p=(last p.vex p.roq) q=q.roq]
(fail +<.sab)
::
2014-06-01 05:41:27 +04:00
++ pfix :: discard first rule
2013-09-29 00:21:18 +04:00
~/ %pfix
2015-12-20 23:50:45 +03:00
(comp |*({a/* b/*} b))
2013-09-29 00:21:18 +04:00
::
2014-06-01 05:41:27 +04:00
++ plug :: first then second
2013-09-29 00:21:18 +04:00
~/ %plug
2015-12-20 23:50:45 +03:00
|* {vex/edge sab/rule}
2014-06-07 05:09:44 +04:00
?~ q.vex
2013-09-29 00:21:18 +04:00
vex
=+ yit=(sab q.u.q.vex)
=+ yur=(last p.vex p.yit)
2014-06-07 05:09:44 +04:00
?~ q.yit
2013-09-29 00:21:18 +04:00
[p=yur q=q.yit]
[p=yur q=[~ u=[p=[p.u.q.vex p.u.q.yit] q=q.u.q.yit]]]
::
2014-06-01 05:41:27 +04:00
++ pose :: first or second
2013-09-29 00:21:18 +04:00
~/ %pose
2015-12-20 23:50:45 +03:00
|* {vex/edge sab/rule}
2014-06-07 05:09:44 +04:00
?~ q.vex
2013-09-29 00:21:18 +04:00
=+ roq=(sab)
[p=(last p.vex p.roq) q=q.roq]
vex
2015-12-04 01:58:42 +03:00
::
++ simu :: first and second
2015-12-20 23:50:45 +03:00
|* {vex/edge sab/rule}
?~ q.vex
vex
=+ roq=(sab)
roq
2013-09-29 00:21:18 +04:00
::
2014-06-01 05:41:27 +04:00
++ sfix :: discard second rule
2013-09-29 00:21:18 +04:00
~/ %sfix
2015-12-20 23:50:45 +03:00
(comp |*({a/* b/*} a))
2013-09-29 00:21:18 +04:00
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2eE, parsing (composers) ::
::
++ bass
2015-12-20 23:50:45 +03:00
|* {wuc/@ tyd/rule}
2013-09-29 00:21:18 +04:00
%+ cook
2015-12-20 23:50:45 +03:00
|= waq/(list @)
2013-09-29 00:21:18 +04:00
%+ roll
waq
2015-12-20 23:50:45 +03:00
=|({p/@ q/@} |.((add p (mul wuc q))))
2013-09-29 00:21:18 +04:00
tyd
::
++ boss
2015-12-20 23:50:45 +03:00
|* {wuc/@ tyd/rule}
2013-09-29 00:21:18 +04:00
%+ cook
2015-12-20 23:50:45 +03:00
|= waq/(list @)
2013-09-29 00:21:18 +04:00
%+ reel
waq
2015-12-20 23:50:45 +03:00
=|({p/@ q/@} |.((add p (mul wuc q))))
2013-09-29 00:21:18 +04:00
tyd
::
2015-05-09 04:08:18 +03:00
++ flag
2015-12-20 23:50:45 +03:00
|= {sic/@t non/@t}
2015-05-09 04:08:18 +03:00
;~(pose (cold %& (jest sic)) (cold %| (jest non)))
::
++ ifix
|* {fel/{rule rule} hof/rule}
~! +<
~! +<:-.fel
~! +<:+.fel
;~(pfix -.fel ;~(sfix hof +.fel))
2013-09-29 00:21:18 +04:00
::
++ more
2015-12-20 23:50:45 +03:00
|* {bus/rule fel/rule}
2013-09-29 00:21:18 +04:00
;~(pose (most bus fel) (easy ~))
::
++ most
2015-12-20 23:50:45 +03:00
|* {bus/rule fel/rule}
2013-09-29 00:21:18 +04:00
;~(plug fel (star ;~(pfix bus fel)))
::
2015-05-09 04:08:18 +03:00
++ pick
2015-12-20 23:50:45 +03:00
|* {a/rule b/rule}
2015-05-09 04:08:18 +03:00
;~ pose
(stag %& a)
(stag %| b)
==
::
2015-12-20 23:50:45 +03:00
++ plus |*(fel/rule ;~(plug fel (star fel)))
++ punt |*({a/rule} ;~(pose (stag ~ a) (easy ~)))
++ slug
2015-12-20 23:50:45 +03:00
|* raq/_|*({a/* b/*} [a b])
|* {bus/rule fel/rule}
2015-01-09 02:56:48 +03:00
;~((comp raq) fel (stir +<+.raq raq ;~(pfix bus fel)))
2013-09-29 00:21:18 +04:00
::
2014-06-01 05:41:27 +04:00
++ star :: 0 or more times
2015-12-20 23:50:45 +03:00
|* fel/rule
(stir `(list _(wonk *fel))`~ |*({a/* b/*} [a b]) fel)
2013-09-29 00:21:18 +04:00
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2eF, parsing (ascii) ::
::
2014-11-18 13:49:03 +03:00
++ ace (just ' ')
2014-10-28 01:12:02 +03:00
++ bar (just '|')
++ bas (just '\\')
++ buc (just '$')
++ cab (just '_')
++ cen (just '%')
++ col (just ':')
++ com (just ',')
++ doq (just '"')
++ dot (just '.')
++ fas (just '/')
++ gal (just '<')
++ gar (just '>')
++ hax (just '#')
++ kel (just '{')
++ ker (just '}')
++ ket (just '^')
++ lus (just '+')
++ hep (just '-')
++ pel (just '(')
++ pam (just '&')
++ per (just ')')
++ pat (just '@')
++ sel (just '[')
++ sem (just ';')
++ ser (just ']')
++ sig (just '~')
++ soq (just '\'')
++ tar (just '*')
++ tec (just '`')
++ tis (just '=')
++ wut (just '?')
++ zap (just '!')
2013-09-29 00:21:18 +04:00
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2eG, parsing (whitespace) ::
::
2014-10-21 02:18:01 +04:00
++ dog ;~(plug dot gay) :: . number separator
++ doh ;~(plug ;~(plug hep hep) gay) :: -- phon separator
2014-06-01 05:41:27 +04:00
++ dun (cold ~ ;~(plug hep hep)) :: -- (phep) to ~
++ duz (cold ~ ;~(plug tis tis)) :: == (stet) to ~
++ gah (mask [`@`10 ' ' ~]) :: newline or ace
2014-10-20 23:47:08 +04:00
++ gap (cold ~ ;~(plug gaq (star ;~(pose vul gah)))) :: plural space
2014-06-07 05:09:44 +04:00
++ gaq ;~ pose :: end of line
(just `@`10)
;~(plug gah ;~(pose gah vul))
2014-06-01 05:41:27 +04:00
vul
==
++ gaw (cold ~ (star ;~(pose vul gah))) :: classic white
2014-06-07 05:09:44 +04:00
++ gay ;~(pose gap (easy ~)) ::
++ vul %+ cold ~ :: comments
2014-05-16 01:29:11 +04:00
;~ plug col col
(star prn)
2014-05-16 01:29:11 +04:00
(just `@`10)
==
2013-09-29 00:21:18 +04:00
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2eH, parsing (idioms) ::
::
2014-06-01 05:41:27 +04:00
++ alf ;~(pose low hig) :: alphabetic
++ aln ;~(pose low hig nud) :: alphanumeric
++ alp ;~(pose low hig nud hep) :: alphanumeric and -
++ bet ;~(pose (cold 2 hep) (cold 3 lus)) :: axis syntax - +
2014-06-07 05:09:44 +04:00
++ bin (bass 2 (most gon but)) :: binary to atom
2015-12-20 23:50:45 +03:00
++ but (cook |=(a/@ (sub a '0')) (shim '0' '1')) :: binary digit
++ cit (cook |=(a/@ (sub a '0')) (shim '0' '7')) :: octal digit
2014-06-07 05:09:44 +04:00
++ dem (bass 10 (most gon dit)) :: decimal to atom
2015-12-20 23:50:45 +03:00
++ dit (cook |=(a/@ (sub a '0')) (shim '0' '9')) :: decimal digit
2014-06-01 05:41:27 +04:00
++ gul ;~(pose (cold 2 gal) (cold 3 gar)) :: axis syntax < >
++ gon ;~(pose ;~(plug bas gay fas) (easy ~)) :: long numbers \ /
++ hex (bass 16 (most gon hit)) :: hex to atom
++ hig (shim 'A' 'Z') :: uppercase
++ hit ;~ pose :: hex digits
dit
2015-12-20 23:50:45 +03:00
(cook |=(a/char (sub a 87)) (shim 'a' 'f'))
(cook |=(a/char (sub a 55)) (shim 'A' 'F'))
2013-09-29 00:21:18 +04:00
==
2014-06-01 05:41:27 +04:00
++ low (shim 'a' 'z') :: lowercase
++ mes %+ cook :: hexbyte
2015-12-20 23:50:45 +03:00
|=({a/@ b/@} (add (mul 16 a) b))
2014-06-01 05:41:27 +04:00
;~(plug hit hit)
2014-06-07 05:09:44 +04:00
++ nix (boss 256 (star ;~(pose aln cab))) ::
2014-06-01 05:41:27 +04:00
++ nud (shim '0' '9') :: numeric
++ prn ;~(less (just `@`127) (shim 32 256))
++ qat ;~ pose :: chars in blockcord
prn
;~(less ;~(plug (just `@`10) soqs) (just `@`10))
==
2014-06-01 05:41:27 +04:00
++ qit ;~ pose :: chars in a cord
2014-06-18 14:01:17 +04:00
;~(less bas soq prn)
;~(pfix bas ;~(pose bas soq mes)) :: escape chars
2014-06-01 05:41:27 +04:00
==
++ qut ;~ simu soq :: cord
;~ pose
2014-06-18 14:01:17 +04:00
;~ less soqs
(ifix [soq soq] (boss 256 (more gon qit)))
==
=+ hed=;~(pose ;~(plug (plus ace) vul) (just '\0a'))
2014-06-18 14:01:17 +04:00
%- inde %+ ifix
:- ;~(plug soqs hed)
;~(plug (just '\0a') soqs)
2014-06-18 14:01:17 +04:00
(boss 256 (star qat))
==
2014-06-01 05:41:27 +04:00
==
2014-06-18 14:01:17 +04:00
::
2014-10-21 02:18:01 +04:00
++ soqs ;~(plug soq soq soq) :: delimiting '''
++ sym :: symbol
2013-09-29 00:21:18 +04:00
%+ cook
2015-12-20 23:50:45 +03:00
|=(a/tape (rap 3 ^-((list @) a)))
2013-09-29 00:21:18 +04:00
;~(plug low (star ;~(pose nud low hep)))
::
2015-12-20 23:50:45 +03:00
++ ven ;~ (comp |=({a/@ b/@} (peg a b))) :: +>- axis syntax
2013-09-29 00:21:18 +04:00
bet
=+ hom=`?`|
2015-12-20 23:50:45 +03:00
|= tub/nail
2013-09-29 00:21:18 +04:00
^- (like axis)
=+ vex=?:(hom (bet tub) (gul tub))
2014-06-07 05:09:44 +04:00
?~ q.vex
[p.tub [~ 1 tub]]
2013-09-29 00:21:18 +04:00
=+ wag=$(p.tub p.vex, hom !hom, tub q.u.q.vex)
?> ?=(^ q.wag)
[p.wag [~ (peg p.u.q.vex p.u.q.wag) q.u.q.wag]]
==
2014-06-01 05:41:27 +04:00
++ vit :: base64 digit
;~ pose
2015-12-20 23:50:45 +03:00
(cook |=(a/@ (sub a 65)) (shim 'A' 'Z'))
(cook |=(a/@ (sub a 71)) (shim 'a' 'z'))
(cook |=(a/@ (add a 4)) (shim '0' '9'))
2013-09-29 00:21:18 +04:00
(cold 62 (just '-'))
(cold 63 (just '+'))
==
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2eI, parsing (external) ::
::
2015-12-20 23:50:45 +03:00
++ rash |*({naf/@ sab/rule} (scan (trip naf) sab)) ::
++ rose |* {los/tape sab/rule}
2015-03-27 22:43:27 +03:00
=+ vex=(sab [[1 1] los])
2015-03-23 01:46:42 +03:00
=+ len=(lent los)
2015-03-27 22:43:27 +03:00
?. =(+(len) q.p.vex) [%| p=(dec q.p.vex)]
2015-02-25 19:57:43 +03:00
?~ q.vex
2015-03-27 22:43:27 +03:00
[%& p=~]
[%& p=[~ u=p.u.q.vex]]
2015-12-20 23:50:45 +03:00
++ rush |*({naf/@ sab/rule} (rust (trip naf) sab))
++ rust |* {los/tape sab/rule}
2014-04-21 21:22:16 +04:00
=+ vex=((full sab) [[1 1] los])
2013-09-29 00:21:18 +04:00
?~(q.vex ~ [~ u=p.u.q.vex])
2015-12-20 23:50:45 +03:00
++ scan |* {los/tape sab/rule}
2013-09-29 00:21:18 +04:00
=+ vex=((full sab) [[1 1] los])
2014-06-07 05:09:44 +04:00
?~ q.vex
2014-01-05 02:57:44 +04:00
~_ (show [%m '{%d %d}'] p.p.vex q.p.vex ~)
2014-01-04 11:28:16 +04:00
~|('syntax-error' !!)
2013-09-29 00:21:18 +04:00
p.u.q.vex
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2eJ, formatting (basic text) ::
::
2014-06-12 21:03:34 +04:00
++ cass :: lowercase
2015-12-20 23:50:45 +03:00
|= vib/tape
2013-09-29 00:21:18 +04:00
%+ rap 3
2015-12-20 23:50:45 +03:00
(turn vib |=(a/@ ?.(&((gte a 'A') (lte a 'Z')) a (add 32 a))))
2014-06-12 21:03:34 +04:00
::
++ cuss :: uppercase
2015-12-20 23:50:45 +03:00
|= vib/tape
^- @t
%+ rap 3
2015-12-20 23:50:45 +03:00
(turn vib |=(a/@ ?.(&((gte a 'a') (lte a 'z')) a (sub a 32))))
2013-09-29 00:21:18 +04:00
::
2015-12-20 23:50:45 +03:00
++ crip |=(a/tape `@t`(rap 3 a)) :: tape to cord
2014-06-12 21:03:34 +04:00
::
++ mesc :: ctrl code escape
2015-12-20 23:50:45 +03:00
|= vib/tape
2013-09-29 00:21:18 +04:00
^- tape
2014-06-07 05:09:44 +04:00
?~ vib
2013-09-29 00:21:18 +04:00
~
?: =('\\' i.vib)
['\\' '\\' $(vib t.vib)]
?: ?|((gth i.vib 126) (lth i.vib 32) =(39 i.vib))
2014-10-23 23:59:15 +04:00
['\\' (welp ~(rux at i.vib) '/' $(vib t.vib))]
2013-09-29 00:21:18 +04:00
[i.vib $(vib t.vib)]
::
2014-10-23 23:59:15 +04:00
++ runt :: prepend repeatedly
2015-12-20 23:50:45 +03:00
|= {{a/@ b/@} c/tape}
2013-09-29 00:21:18 +04:00
^- tape
?: =(0 a)
c
[b $(a (dec a))]
::
++ sand :: atom sanity
2015-12-20 23:50:45 +03:00
|= a/@ta
(flit (sane a))
2013-09-29 00:21:18 +04:00
::
++ sane :: atom sanity
2015-12-20 23:50:45 +03:00
|= a/@ta
|= b/@ ^- ?
2013-09-29 00:21:18 +04:00
?. =(%t (end 3 1 a))
~|(%sane-stub !!)
=+ [inx=0 len=(met 3 b)]
?: =(%tas a)
|- ^- ?
?: =(inx len) &
=+ cur=(cut 3 [inx 1] b)
?& ?| &((gte cur 'a') (lte cur 'z'))
&(=('-' cur) !=(0 inx) !=(len inx))
&(&((gte cur '0') (lte cur '9')) !=(0 inx))
2013-09-29 00:21:18 +04:00
==
$(inx +(inx))
==
?: =(%ta a)
|- ^- ?
?: =(inx len) &
=+ cur=(cut 3 [inx 1] b)
?& ?| &((gte cur 'a') (lte cur 'z'))
2014-09-10 01:38:19 +04:00
&((gte cur '0') (lte cur '9'))
2013-09-29 00:21:18 +04:00
|(=('-' cur) =('~' cur) =('_' cur) =('.' cur))
==
$(inx +(inx))
==
|- ^- ?
?: =(0 b) &
=+ cur=(end 3 1 b)
?: &((lth cur 32) !=(10 cur)) |
=+ len=(teff cur)
?& |(=(1 len) =+(i=1 |-(|(=(i len) &((gte (cut 3 [i 1] b) 128) $(i +(i)))))))
$(b (rsh 3 len b))
==
::
2014-06-12 21:03:34 +04:00
++ trim :: tape split
2015-12-20 23:50:45 +03:00
|= {a/@ b/tape}
^- {p/tape q/tape}
2014-06-07 05:09:44 +04:00
?~ b
2013-09-29 00:21:18 +04:00
[~ ~]
?: =(0 a)
[~ b]
=+ c=$(a (dec a), b t.b)
[[i.b p.c] q.c]
::
2014-06-12 21:03:34 +04:00
++ trip :: cord to tape
2013-09-29 00:21:18 +04:00
~/ %trip
2015-12-20 23:50:45 +03:00
|= a/@ ^- tape
2013-09-29 00:21:18 +04:00
?: =(0 (met 3 a))
~
[^-(@ta (end 3 1 a)) $(a (rsh 3 1 a))]
::
++ teff :: length utf8
2015-12-20 23:50:45 +03:00
|= a/@t ^- @
2013-09-29 00:21:18 +04:00
=+ b=(end 3 1 a)
2015-02-27 05:20:07 +03:00
~| %bad-utf8
2013-09-29 00:21:18 +04:00
?: =(0 b)
?>(=(0 a) 0)
?> |((gte b 32) =(10 b))
?:((lte b 127) 1 ?:((lte b 223) 2 ?:((lte b 239) 3 4)))
::
++ turf :: utf8 to utf32
2015-12-20 23:50:45 +03:00
|= a/@t
2013-09-29 00:21:18 +04:00
^- @c
%+ rap 5
2015-12-04 18:16:34 +03:00
|- ^- (list @c)
2013-09-29 00:21:18 +04:00
=+ b=(teff a)
?: =(0 b) ~
:- %+ can 0
%+ turn
2015-12-20 23:50:45 +03:00
^- (list {p/@ q/@})
2013-09-29 00:21:18 +04:00
?+ b !!
2015-12-08 05:11:14 +03:00
$1 [[0 7] ~]
$2 [[8 6] [0 5] ~]
$3 [[16 6] [8 6] [0 4] ~]
$4 [[24 6] [16 6] [8 6] [0 3] ~]
2013-09-29 00:21:18 +04:00
==
2015-12-20 23:50:45 +03:00
|=({p/@ q/@} [q (cut 0 [p q] a)])
2013-09-29 00:21:18 +04:00
$(a (rsh 3 b a))
::
++ tuba :: utf8 to utf32 tape
2015-12-20 23:50:45 +03:00
|= a/tape
2015-12-04 18:16:34 +03:00
^- (list @c)
2013-09-29 00:21:18 +04:00
(rip 5 (turf (rap 3 a))) :: XX horrible
::
++ tufa :: utf32 to utf8 tape
2015-12-20 23:50:45 +03:00
|= a/(list @c)
2013-09-29 00:21:18 +04:00
^- tape
?~ a ""
(weld (rip 3 (tuft i.a)) $(a t.a))
::
++ tuft :: utf32 to utf8 text
2015-12-20 23:50:45 +03:00
|= a/@c
2013-09-29 00:21:18 +04:00
^- @t
%+ rap 3
2015-12-04 01:58:42 +03:00
|- ^- (list @)
2013-09-29 00:21:18 +04:00
?: =(0 a)
~
=+ b=(end 5 1 a)
=+ c=$(a (rsh 5 1 a))
?: (lth b 0x7f)
[b c]
?: (lth b 0x7ff)
:* (mix 0b1100.0000 (cut 0 [6 5] b))
(mix 0b1000.0000 (end 0 6 b))
c
==
?: (lth b 0xffff)
:* (mix 0b1110.0000 (cut 0 [12 4] b))
(mix 0b1000.0000 (cut 0 [6 6] b))
(mix 0b1000.0000 (end 0 6 b))
c
==
:* (mix 0b1111.0000 (cut 0 [18 3] b))
(mix 0b1000.0000 (cut 0 [12 6] b))
(mix 0b1000.0000 (cut 0 [6 6] b))
(mix 0b1000.0000 (end 0 6 b))
c
==
::
++ wack :: knot format
2015-12-20 23:50:45 +03:00
|= a/@ta
2013-09-29 00:21:18 +04:00
^- @ta
=+ b=(rip 3 a)
%+ rap 3
|- ^- tape
?~ b
~
?: =('~' i.b) ['~' '~' $(b t.b)]
?: =('_' i.b) ['~' '-' $(b t.b)]
[i.b $(b t.b)]
::
++ wick :: knot format
2015-12-20 23:50:45 +03:00
|= a/@
2015-12-04 01:58:42 +03:00
^- (unit @ta)
2013-09-29 00:21:18 +04:00
=+ b=(rip 3 a)
2015-01-14 08:38:39 +03:00
=- ?^(b ~ (some (rap 3 (flop c))))
2015-12-20 23:50:45 +03:00
=| c/tape
|- ^- {b/tape c/tape}
2015-01-14 08:38:39 +03:00
?~ b [~ c]
?. =('~' i.b)
$(b t.b, c [i.b c])
?~ t.b [b ~]
?- i.t.b
2015-12-08 04:23:27 +03:00
$'~' $(b t.t.b, c ['~' c])
$'-' $(b t.t.b, c ['_' c])
2015-01-14 08:38:39 +03:00
@ [b ~]
==
2013-09-29 00:21:18 +04:00
::
2014-10-24 01:08:11 +04:00
++ woad :: cord format
2015-12-20 23:50:45 +03:00
|= a/@ta
2013-09-29 00:21:18 +04:00
^- @t
%+ rap 3
2015-12-04 18:16:34 +03:00
|- ^- (list @)
2013-09-29 00:21:18 +04:00
?: =(0 a)
~
=+ b=(end 3 1 a)
=+ c=(rsh 3 1 a)
?: =('.' b)
[' ' $(a c)]
2013-09-29 00:21:18 +04:00
?. =('~' b)
[b $(a c)]
2013-09-29 00:21:18 +04:00
=> .(b (end 3 1 c), c (rsh 3 1 c))
?+ b =- (weld (rip 3 (tuft p.d)) $(a q.d))
^= d
=+ d=0
2015-12-20 23:50:45 +03:00
|- ^- {p/@ q/@}
2013-12-08 06:55:03 +04:00
?: =('.' b)
[d c]
2013-09-29 00:21:18 +04:00
?< =(0 c)
%= $
2013-12-08 06:55:03 +04:00
b (end 3 1 c)
c (rsh 3 1 c)
d %+ add (mul 16 d)
%+ sub b
?: &((gte b '0') (lte b '9')) 48
?>(&((gte b 'a') (lte b 'z')) 87)
2013-09-29 00:21:18 +04:00
==
2015-12-08 04:23:27 +03:00
$'.' ['.' $(a c)]
$'~' ['~' $(a c)]
==
2013-09-29 00:21:18 +04:00
::
2014-10-24 01:08:11 +04:00
++ wood :: cord format
2015-12-20 23:50:45 +03:00
|= a/@t
2013-09-29 00:21:18 +04:00
^- @ta
%+ rap 3
2015-12-04 01:58:42 +03:00
|- ^- (list @)
?: =(0 a)
2013-09-29 00:21:18 +04:00
~
=+ b=(teff a)
=+ c=(turf (end 3 b a))
=+ d=$(a (rsh 3 b a))
?: ?| &((gte c 'a') (lte c 'z'))
2013-09-29 00:21:18 +04:00
&((gte c '0') (lte c '9'))
=('-' c)
==
[c d]
?+ c
2013-12-15 10:46:41 +04:00
:- '~'
=+ e=(met 2 c)
|- ^- tape
2015-01-14 08:57:55 +03:00
?: =(0 e)
2013-12-15 10:46:41 +04:00
['.' d]
=. e (dec e)
=+ f=(rsh 2 e c)
[(add ?:((lte f 9) 48 87) f) $(c (end 2 e c))]
::
2015-12-08 04:23:27 +03:00
$' ' ['.' d]
$'.' ['~' '.' d]
$'~' ['~' '~' d]
2013-09-29 00:21:18 +04:00
==
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2eK, formatting (layout) ::
::
++ re
2015-12-20 23:50:45 +03:00
|_ tac/tank
2013-09-29 00:21:18 +04:00
++ ram
^- tape
?- -.tac
2015-12-08 04:23:27 +03:00
$leaf p.tac
$palm ram(tac [%rose [p.p.tac (weld q.p.tac r.p.tac) s.p.tac] q.tac])
$rose
2013-09-29 00:21:18 +04:00
%+ weld
q.p.tac
|- ^- tape
2014-06-07 05:09:44 +04:00
?~ q.tac
2013-09-29 00:21:18 +04:00
r.p.tac
=+ voz=$(q.tac t.q.tac)
2014-06-07 05:09:44 +04:00
(weld ram(tac i.q.tac) ?~(t.q.tac voz (weld p.p.tac voz)))
2013-09-29 00:21:18 +04:00
==
::
++ win
2015-12-20 23:50:45 +03:00
|= {tab/@ edg/@}
2013-09-29 00:21:18 +04:00
=+ lug=`wall`~
|^ |- ^- wall
?- -.tac
2015-12-08 04:23:27 +03:00
$leaf (rig p.tac)
$palm
2013-09-29 00:21:18 +04:00
?: fit
(rig ram)
2014-06-07 05:09:44 +04:00
?~ q.tac
2013-09-29 00:21:18 +04:00
(rig q.p.tac)
2014-06-07 05:09:44 +04:00
?~ t.q.tac
2013-09-29 00:21:18 +04:00
(rig(tab (add 2 tab), lug $(tac i.q.tac)) q.p.tac)
=> .(q.tac `(list tank)`q.tac)
=+ lyn=(mul 2 (lent q.tac))
=+ ^= qyr
|- ^- wall
2014-06-07 05:09:44 +04:00
?~ q.tac
2013-09-29 00:21:18 +04:00
lug
%= ^$
2014-01-04 11:28:16 +04:00
tac i.q.tac
tab (add tab (sub lyn 2))
lug $(q.tac t.q.tac, lyn (sub lyn 2))
2013-09-29 00:21:18 +04:00
==
(wig(lug qyr) q.p.tac)
::
2015-12-08 04:23:27 +03:00
$rose
2013-09-29 00:21:18 +04:00
?: fit
(rig ram)
2015-01-10 00:02:47 +03:00
=. lug
2013-09-29 00:21:18 +04:00
|- ^- wall
2014-06-07 05:09:44 +04:00
?~ q.tac
2013-09-29 00:21:18 +04:00
?:(=(%$ r.p.tac) lug (rig r.p.tac))
^$(tac i.q.tac, lug $(q.tac t.q.tac), tab din)
?: =(%$ q.p.tac)
2015-01-10 00:02:47 +03:00
lug
(wig q.p.tac)
2013-09-29 00:21:18 +04:00
==
::
++ din (mod (add 2 tab) (mul 2 (div edg 3)))
++ fit (lte (lent ram) (sub edg tab))
++ rig
2015-12-20 23:50:45 +03:00
|= hom/tape
2013-09-29 00:21:18 +04:00
^- wall
?: (lte (lent hom) (sub edg tab))
[(runt [tab ' '] hom) lug]
=> .(tab (add tab 2), edg (sub edg 2))
=+ mut=(trim (sub edg tab) hom)
2015-12-15 01:21:10 +03:00
:- (runt [(sub tab 2) ' '] ['\\' '/' (weld p.mut `_hom`['\\' '/' ~])])
2013-09-29 00:21:18 +04:00
=> .(hom q.mut)
|-
2014-06-07 05:09:44 +04:00
?~ hom
:- %+ runt
[(sub tab 2) ' ']
2013-09-29 00:21:18 +04:00
['\\' '/' (runt [(sub edg tab) ' '] ['\\' '/' ~])]
lug
=> .(mut (trim (sub edg tab) hom))
[(runt [tab ' '] p.mut) $(hom q.mut)]
::
++ wig
2015-12-20 23:50:45 +03:00
|= hom/tape
2013-09-29 00:21:18 +04:00
^- wall
2014-06-07 05:09:44 +04:00
?~ lug
2013-09-29 00:21:18 +04:00
(rig hom)
=+ lin=(lent hom)
=+ wug=:(add 1 tab lin)
?. =+ mir=i.lug
2014-06-07 05:09:44 +04:00
|- ?~ mir
2013-09-29 00:21:18 +04:00
|
?|(=(0 wug) ?&(=(' ' i.mir) $(mir t.mir, wug (dec wug))))
2014-06-07 05:09:44 +04:00
(rig hom) :: ^ XX regular form?
2013-09-29 00:21:18 +04:00
[(runt [tab ' '] (weld hom `tape`[' ' (slag wug i.lug)])) t.lug]
--
--
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2eL, formatting (path) ::
::
++ ab
2013-09-29 00:21:18 +04:00
|%
++ bix (bass 16 (stun [2 2] six))
2015-12-20 23:50:45 +03:00
++ fem (sear |=(a/@ (cha:fa a)) aln)
2013-09-29 00:21:18 +04:00
++ hif (boss 256 ;~(plug tip tiq (easy ~)))
++ huf %+ cook
2015-12-20 23:50:45 +03:00
|=({a/@ b/@} (wred:un ~(zug mu ~(zag mu [a b]))))
2013-09-29 00:21:18 +04:00
;~(plug hif ;~(pfix hep hif))
++ hyf (bass 0x1.0000.0000 ;~(plug huf ;~(pfix hep huf) (easy ~)))
++ pev (bass 32 ;~(plug sev (stun [0 4] siv)))
++ pew (bass 64 ;~(plug sew (stun [0 4] siw)))
++ piv (bass 32 (stun [5 5] siv))
++ piw (bass 64 (stun [5 5] siw))
++ qeb (bass 2 ;~(plug seb (stun [0 3] sib)))
++ qex (bass 16 ;~(plug sex (stun [0 3] hit)))
++ qib (bass 2 (stun [4 4] sib))
++ qix (bass 16 (stun [4 4] six))
++ seb (cold 1 (just '1'))
2015-12-20 23:50:45 +03:00
++ sed (cook |=(a/@ (sub a '0')) (shim '1' '9'))
2013-09-29 00:21:18 +04:00
++ sev ;~(pose sed sov)
++ sew ;~(pose sed sow)
++ sex ;~(pose sed sox)
2015-12-20 23:50:45 +03:00
++ sib (cook |=(a/@ (sub a '0')) (shim '0' '1'))
++ sid (cook |=(a/@ (sub a '0')) (shim '0' '9'))
2013-09-29 00:21:18 +04:00
++ siv ;~(pose sid sov)
++ siw ;~(pose sid sow)
++ six ;~(pose sid sox)
2015-12-20 23:50:45 +03:00
++ sov (cook |=(a/@ (sub a 87)) (shim 'a' 'v'))
2013-09-29 00:21:18 +04:00
++ sow ;~ pose
2015-12-20 23:50:45 +03:00
(cook |=(a/@ (sub a 87)) (shim 'a' 'z'))
(cook |=(a/@ (sub a 29)) (shim 'A' 'Z'))
2013-09-29 00:21:18 +04:00
(cold 62 (just '-'))
(cold 63 (just '~'))
==
2015-12-20 23:50:45 +03:00
++ sox (cook |=(a/@ (sub a 87)) (shim 'a' 'f'))
2013-09-29 00:21:18 +04:00
++ ted (bass 10 ;~(plug sed (stun [0 2] sid)))
2015-12-20 23:50:45 +03:00
++ tip (sear |=(a/@ (ins:po a)) til)
++ tiq (sear |=(a/@ (ind:po a)) til)
2013-09-29 00:21:18 +04:00
++ tid (bass 10 (stun [3 3] sid))
++ til (boss 256 (stun [3 3] low))
++ urs %+ cook
2015-12-20 23:50:45 +03:00
|=(a/tape (rap 3 ^-((list @) a)))
(star ;~(pose nud low hep dot sig cab))
2014-03-20 05:05:42 +04:00
++ urt %+ cook
2015-12-20 23:50:45 +03:00
|=(a/tape (rap 3 ^-((list @) a)))
(star ;~(pose nud low hep dot sig))
++ urx %+ cook
2015-12-20 23:50:45 +03:00
|=(a/tape (rap 3 ^-((list @) a)))
%- star
;~ pose
nud
low
hep
cab
(cold ' ' dot)
(cook tuft (ifix [sig dot] hex))
;~(pfix sig ;~(pose sig dot))
==
2013-09-29 00:21:18 +04:00
++ voy ;~(pfix bas ;~(pose bas soq bix))
--
++ ag
|%
2015-12-20 23:50:45 +03:00
++ ape |*(fel/rule ;~(pose (cold 0 (just '0')) fel))
2013-09-29 00:21:18 +04:00
++ bay (ape (bass 16 ;~(plug qeb:ab (star ;~(pfix dog qib:ab)))))
2013-12-09 02:40:16 +04:00
++ bip =+ tod=(ape qex:ab)
(bass 0x1.0000 ;~(plug tod (stun [7 7] ;~(pfix dog tod))))
2013-09-29 00:21:18 +04:00
++ dem (ape (bass 1.000 ;~(plug ted:ab (star ;~(pfix dog tid:ab)))))
++ dim (ape (bass 10 ;~(plug sed:ab (star sid:ab))))
++ dum (bass 10 (plus sid:ab))
++ fed ;~ pose
2015-03-13 02:48:24 +03:00
%+ bass 0x1.0000.0000.0000.0000
;~((glue doh) ;~(pose hyf:ab huf:ab) (more doh hyf:ab))
::
hyf:ab
2013-09-29 00:21:18 +04:00
huf:ab
hif:ab
tiq:ab
==
2015-02-25 05:08:20 +03:00
++ fim (sear den:fa (bass 58 (plus fem:ab)))
2013-09-29 00:21:18 +04:00
++ hex (ape (bass 0x1.0000 ;~(plug qex:ab (star ;~(pfix dog qix:ab)))))
++ lip =+ tod=(ape ted:ab)
2013-09-29 00:21:18 +04:00
(bass 256 ;~(plug tod (stun [3 3] ;~(pfix dog tod))))
++ viz (ape (bass 0x200.0000 ;~(plug pev:ab (star ;~(pfix dog piv:ab)))))
2014-03-20 05:05:42 +04:00
++ vum (bass 32 (plus siv:ab))
2013-09-29 00:21:18 +04:00
++ wiz (ape (bass 0x4000.0000 ;~(plug pew:ab (star ;~(pfix dog piw:ab)))))
--
::
++ co !.
~% %co ..co ~
2015-12-20 23:50:45 +03:00
=< |_ lot/coin
++ rear |=(rom/tape =>(.(rex rom) rend))
2013-09-29 00:21:18 +04:00
++ rent `@ta`(rap 3 rend)
++ rend
^- tape
2015-12-08 04:23:27 +03:00
?: ?=($blob -.lot)
2014-03-20 05:05:42 +04:00
['~' '0' ((v-co 1) (jam p.lot))]
2015-12-08 04:23:27 +03:00
?: ?=($many -.lot)
2014-01-04 11:28:16 +04:00
:- '.'
2013-09-29 00:21:18 +04:00
|- ^- tape
?~ p.lot
['_' '_' rex]
2014-03-20 05:05:42 +04:00
['_' (weld (trip (wack rent(lot i.p.lot))) $(p.lot t.p.lot))]
2013-09-29 00:21:18 +04:00
=+ [yed=(end 3 1 p.p.lot) hay=(cut 3 [1 1] p.p.lot)]
|- ^- tape
?+ yed (z-co q.p.lot)
2015-12-08 04:23:27 +03:00
$c ['~' '-' (weld (rip 3 (wood (tuft q.p.lot))) rex)]
$d
2013-09-29 00:21:18 +04:00
?+ hay (z-co q.p.lot)
2015-12-08 04:23:27 +03:00
$a
2013-09-29 00:21:18 +04:00
=+ yod=(yore q.p.lot)
=> ^+(. .(rex ?~(f.t.yod rex ['.' (s-co f.t.yod)])))
=> ^+ .
%= .
rex
?: &(=(~ f.t.yod) =(0 h.t.yod) =(0 m.t.yod) =(0 s.t.yod))
rex
=> .(rex ['.' (y-co s.t.yod)])
=> .(rex ['.' (y-co m.t.yod)])
['.' '.' (y-co h.t.yod)]
==
=> .(rex ['.' (a-co d.t.yod)])
=> .(rex ['.' (a-co m.yod)])
=> .(rex ?:(a.yod rex ['-' rex]))
['~' (a-co y.yod)]
::
2015-12-08 04:23:27 +03:00
$r
2013-09-29 00:21:18 +04:00
=+ yug=(yell q.p.lot)
=> ^+(. .(rex ?~(f.yug rex ['.' (s-co f.yug)])))
:- '~'
?: &(=(0 d.yug) =(0 m.yug) =(0 h.yug) =(0 s.yug))
2015-01-14 08:38:39 +03:00
['s' '0' rex]
2013-09-29 00:21:18 +04:00
=> ^+(. ?:(=(0 s.yug) . .(rex ['.' 's' (a-co s.yug)])))
=> ^+(. ?:(=(0 m.yug) . .(rex ['.' 'm' (a-co m.yug)])))
=> ^+(. ?:(=(0 h.yug) . .(rex ['.' 'h' (a-co h.yug)])))
=> ^+(. ?:(=(0 d.yug) . .(rex ['.' 'd' (a-co d.yug)])))
+.rex
==
::
2015-12-08 04:23:27 +03:00
$f
?: =(& q.p.lot)
['.' 'y' rex]
2013-09-29 00:21:18 +04:00
?:(=(| q.p.lot) ['.' 'n' rex] (z-co q.p.lot))
::
2015-12-08 04:23:27 +03:00
$n ['~' rex]
$i
2013-09-29 00:21:18 +04:00
?+ hay (z-co q.p.lot)
2015-12-20 23:50:45 +03:00
$f ((ro-co [3 10 4] |=(a/@ ~(d ne a))) q.p.lot)
$s ((ro-co [4 16 8] |=(a/@ ~(x ne a))) q.p.lot)
2013-09-29 00:21:18 +04:00
==
::
2015-12-08 04:23:27 +03:00
$p
2013-09-29 00:21:18 +04:00
=+ dyx=(met 3 q.p.lot)
:- '~'
?: (lte dyx 1)
(weld (trip (tod:po q.p.lot)) rex)
?: =(2 dyx)
;: weld
2013-09-29 00:21:18 +04:00
(trip (tos:po (end 3 1 q.p.lot)))
(trip (tod:po (rsh 3 1 q.p.lot)))
rex
==
2015-03-13 02:48:24 +03:00
=+ [dyz=(met 5 q.p.lot) fin=| dub=&]
2013-09-29 00:21:18 +04:00
|- ^- tape
?: =(0 dyz)
rex
%= $
fin &
2015-03-13 02:48:24 +03:00
dub !dub
2013-09-29 00:21:18 +04:00
dyz (dec dyz)
q.p.lot (rsh 5 1 q.p.lot)
rex
=+ syb=(wren:un (end 5 1 q.p.lot))
=+ cog=~(zig mu [(rsh 4 1 syb) (end 4 1 syb)])
;: weld
(trip (tos:po (end 3 1 p.cog)))
(trip (tod:po (rsh 3 1 p.cog)))
`tape`['-' ~]
(trip (tos:po (end 3 1 q.cog)))
(trip (tod:po (rsh 3 1 q.cog)))
2015-03-13 02:48:24 +03:00
`tape`?.(fin ~ ['-' ?.(dub ~ ['-' ~])])
2013-09-29 00:21:18 +04:00
rex
==
==
::
2015-12-08 04:23:27 +03:00
$r
2013-09-29 00:21:18 +04:00
?+ hay (z-co q.p.lot)
2015-12-08 04:23:27 +03:00
$d ['.' '~' (r-co (rlyd q.p.lot))]
$h ['.' '~' '~' (r-co (rlyh q.p.lot))]
$q ['.' '~' '~' '~' (r-co (rlyq q.p.lot))]
$s ['.' (r-co (rlys q.p.lot))]
2013-09-29 00:21:18 +04:00
==
::
2015-12-08 04:23:27 +03:00
$u
?: ?=($c hay)
2015-03-03 04:51:00 +03:00
%+ welp ['0' 'c' (reap (pad:fa q.p.lot) '1')]
(c-co (enc:fa q.p.lot))
2013-09-29 00:21:18 +04:00
=- (weld p.gam ?:(=(0 q.p.lot) `tape`['0' ~] q.gam))
2015-12-20 23:50:45 +03:00
^= gam ^- {p/tape q/tape}
?+ hay [~ ((ox-co [10 3] |=(a/@ ~(d ne a))) q.p.lot)]
$b [['0' 'b' ~] ((ox-co [2 4] |=(a/@ ~(d ne a))) q.p.lot)]
2015-12-08 04:23:27 +03:00
$i [['0' 'i' ~] ((d-co 1) q.p.lot)]
2015-12-20 23:50:45 +03:00
$x [['0' 'x' ~] ((ox-co [16 4] |=(a/@ ~(x ne a))) q.p.lot)]
$v [['0' 'v' ~] ((ox-co [32 5] |=(a/@ ~(x ne a))) q.p.lot)]
$w [['0' 'w' ~] ((ox-co [64 5] |=(a/@ ~(w ne a))) q.p.lot)]
2013-09-29 00:21:18 +04:00
==
::
2015-12-08 04:23:27 +03:00
$s
2013-09-29 00:21:18 +04:00
%+ weld
?:((syn:si q.p.lot) "--" "-")
$(yed 'u', q.p.lot (abs:si q.p.lot))
::
2015-12-08 04:23:27 +03:00
$t
2013-09-29 00:21:18 +04:00
?: =('a' hay)
?: =('s' (cut 3 [2 1] p.p.lot))
(weld (rip 3 q.p.lot) rex)
2014-03-20 05:05:42 +04:00
['~' '.' (weld (rip 3 q.p.lot) rex)]
2013-09-29 00:21:18 +04:00
['~' '~' (weld (rip 3 (wood q.p.lot)) rex)]
==
--
=+ rex=*tape
=< |%
2015-12-20 23:50:45 +03:00
++ a-co |=(dat/@ ((d-co 1) dat))
++ c-co (em-co [58 1] |=({? b/@ c/tape} [~(c ne b) c]))
++ d-co |=(min/@ (em-co [10 min] |=({? b/@ c/tape} [~(d ne b) c])))
2013-09-29 00:21:18 +04:00
++ r-co
2015-12-20 23:50:45 +03:00
|= a/dn
2015-12-08 04:23:27 +03:00
?: ?=({$i *} a) (weld ?:(s.a "inf" "-inf") rex)
?: ?=({$n *} a) (weld "nan" rex)
2015-07-12 20:26:23 +03:00
=+ ^= e %+ ed-co [10 1]
2015-12-20 23:50:45 +03:00
|= {a/? b/@ c/tape}
2015-07-12 20:26:23 +03:00
?: a [~(d ne b) '.' c]
[~(d ne b) c]
=+ ^= f
=>(.(rex ~) (e a.a))
2015-07-13 02:45:49 +03:00
=. e.a (sum:si e.a (sun:si (dec +.f)))
2015-07-12 20:26:23 +03:00
=+ b=?:((syn:si e.a) "e" "e-")
2015-07-13 02:45:49 +03:00
=> .(rex ?~(e.a rex (weld b ((d-co 1) (abs:si e.a)))))
2015-07-12 20:26:23 +03:00
=> .(rex (weld -.f rex))
?:(s.a rex ['-' rex])
2013-09-29 00:21:18 +04:00
::
++ s-co
2015-12-20 23:50:45 +03:00
|= esc/(list @) ^- tape
2013-09-29 00:21:18 +04:00
~| [%so-co esc]
?~ esc
rex
:- '.'
=>(.(rex $(esc t.esc)) ((x-co 4) i.esc))
2015-07-12 20:26:23 +03:00
::
2015-12-20 23:50:45 +03:00
++ v-co |=(min/@ (em-co [32 min] |=({? b/@ c/tape} [~(v ne b) c])))
++ w-co |=(min/@ (em-co [64 min] |=({? b/@ c/tape} [~(w ne b) c])))
++ x-co |=(min/@ (em-co [16 min] |=({? b/@ c/tape} [~(x ne b) c])))
++ y-co |=(dat/@ ((d-co 2) dat))
++ z-co |=(dat/@ `tape`['0' 'x' ((x-co 1) dat)])
2013-09-29 00:21:18 +04:00
--
|%
2013-09-29 00:21:18 +04:00
++ em-co
2015-12-20 23:50:45 +03:00
|= {{bas/@ min/@} par/$+({? @ tape} tape)}
|= hol/@
2013-09-29 00:21:18 +04:00
^- tape
?: &(=(0 hol) =(0 min))
rex
=+ [rad=(mod hol bas) dar=(div hol bas)]
%= $
min ?:(=(0 min) 0 (dec min))
hol dar
rex (par =(0 dar) rad rex)
==
::
2015-07-12 20:26:23 +03:00
++ ed-co
2015-12-20 23:50:45 +03:00
|= {{bas/@ min/@} par/$+({? @ tape} tape)}
2015-07-12 20:26:23 +03:00
=+ [fir=& cou=0]
2015-12-20 23:50:45 +03:00
|= hol/@
2015-12-04 01:58:42 +03:00
^- {tape @}
2015-07-12 20:26:23 +03:00
?: &(=(0 hol) =(0 min))
2015-07-13 02:45:49 +03:00
[rex cou]
2015-07-12 20:26:23 +03:00
=+ [rad=(mod hol bas) dar=(div hol bas)]
%= $
min ?:(=(0 min) 0 (dec min))
hol dar
rex (par &(=(0 dar) !fir) rad rex)
fir |
cou +(cou)
==
::
2013-09-29 00:21:18 +04:00
++ ox-co
2015-12-20 23:50:45 +03:00
|= {{bas/@ gop/@} dug/$+(@ @)}
2013-09-29 00:21:18 +04:00
%+ em-co
[|-(?:(=(0 gop) 1 (mul bas $(gop (dec gop))))) 0]
2015-12-20 23:50:45 +03:00
|= {top/? seg/@ res/tape}
2013-09-29 00:21:18 +04:00
%+ weld
?:(top ~ `tape`['.' ~])
%. seg
%+ em-co(rex res)
[bas ?:(top 0 gop)]
2015-12-20 23:50:45 +03:00
|=({? b/@ c/tape} [(dug b) c])
2013-09-29 00:21:18 +04:00
::
++ ro-co
2015-12-20 23:50:45 +03:00
|= {{buz/@ bas/@ dop/@} dug/$+(@ @)}
|= hol/@
2013-09-29 00:21:18 +04:00
^- tape
?: =(0 dop)
rex
=> .(rex $(dop (dec dop)))
:- '.'
2015-12-20 23:50:45 +03:00
%- (em-co [bas 1] |=({? b/@ c/tape} [(dug b) c]))
2013-09-29 00:21:18 +04:00
[(cut buz [(dec dop) 1] hol)]
--
::
++ ne
2015-12-20 23:50:45 +03:00
|_ tig/@
2015-02-25 05:08:20 +03:00
++ c (cut 3 [tig 1] key:fa)
2013-09-29 00:21:18 +04:00
++ d (add tig '0')
++ x ?:((gte tig 10) (add tig 87) d)
++ v ?:((gte tig 10) (add tig 87) d)
2013-09-29 00:21:18 +04:00
++ w ?:(=(tig 63) '~' ?:(=(tig 62) '-' ?:((gte tig 36) (add tig 29) x)))
--
::
++ mu
2015-12-20 23:50:45 +03:00
|_ {top/@ bot/@}
2013-09-29 00:21:18 +04:00
++ zag [p=(end 4 1 (add top bot)) q=bot]
++ zig [p=(end 4 1 (add top (sub 0x1.0000 bot))) q=bot]
++ zug (mix (lsh 4 1 top) bot)
--
::
++ so
~% %so + ~
|%
2013-09-29 00:21:18 +04:00
++ bisk
~+
2013-09-29 00:21:18 +04:00
;~ pose
;~ pfix (just '0')
;~ pose
(stag %ub ;~(pfix (just 'b') bay:ag))
2015-02-25 05:08:20 +03:00
(stag %uc ;~(pfix (just 'c') fim:ag))
2014-04-16 04:49:11 +04:00
(stag %ui ;~(pfix (just 'i') dim:ag))
2013-09-29 00:21:18 +04:00
(stag %ux ;~(pfix (just 'x') hex:ag))
(stag %uv ;~(pfix (just 'v') viz:ag))
(stag %uw ;~(pfix (just 'w') wiz:ag))
==
==
(stag %ud dem:ag)
==
++ crub
~+
2013-09-29 00:21:18 +04:00
;~ pose
%+ cook
2015-12-20 23:50:45 +03:00
|=(det/date `dime`[%da (year det)])
2013-09-29 00:21:18 +04:00
;~ plug
%+ cook
2015-12-20 23:50:45 +03:00
|=({a/@ b/?} [b a])
2013-09-29 00:21:18 +04:00
;~(plug dim:ag ;~(pose (cold | hep) (easy &)))
;~(pfix dot dim:ag) :: month
;~(pfix dot dim:ag) :: day
;~ pose
;~ pfix
;~(plug dot dot)
;~ plug
dum:ag
;~(pfix dot dum:ag)
;~(pfix dot dum:ag)
;~(pose ;~(pfix ;~(plug dot dot) (most dot qix:ab)) (easy ~))
==
==
(easy [0 0 0 ~])
==
==
::
%+ cook
2015-12-20 23:50:45 +03:00
|= {a/(list {p/?($d $h $m $s) q/@}) b/(list @)}
2013-09-29 00:21:18 +04:00
=+ rop=`tarp`[0 0 0 0 b]
|- ^- dime
?~ a
[%dr (yule rop)]
?- p.i.a
2015-12-08 04:23:27 +03:00
$d $(a t.a, d.rop (add q.i.a d.rop))
$h $(a t.a, h.rop (add q.i.a h.rop))
$m $(a t.a, m.rop (add q.i.a m.rop))
$s $(a t.a, s.rop (add q.i.a s.rop))
2013-09-29 00:21:18 +04:00
==
;~ plug
%+ most
dot
;~ pose
2013-09-29 00:21:18 +04:00
;~(pfix (just 'd') (stag %d dim:ag))
;~(pfix (just 'h') (stag %h dim:ag))
;~(pfix (just 'm') (stag %m dim:ag))
;~(pfix (just 's') (stag %s dim:ag))
==
;~(pose ;~(pfix ;~(plug dot dot) (most dot qix:ab)) (easy ~))
==
::
(stag %p fed:ag)
2014-03-20 05:05:42 +04:00
;~(pfix dot (stag %ta urs:ab))
;~(pfix sig (stag %t urx:ab))
;~(pfix hep (stag %c (cook turf urx:ab)))
2013-09-29 00:21:18 +04:00
==
++ nuck
2015-12-20 23:50:45 +03:00
~/ %nuck |= a/nail %. a
2013-09-29 00:21:18 +04:00
%+ knee *coin |. ~+
%- stew
^. stet ^. limo
:~ :- ['a' 'z'] (cook |=(a/@ta [%$ %tas a]) sym)
:- ['0' '9'] (stag %$ bisk)
:- '-' (stag %$ tash)
:- '.' ;~(pfix dot perd)
:- '~' ;~(pfix sig ;~(pose twid (easy [%$ %n 0])))
2013-09-29 00:21:18 +04:00
==
2014-03-20 05:05:42 +04:00
++ nusk
~+
2015-12-20 23:50:45 +03:00
:(sear |=(a/@ta (rush a nuck)) wick urt:ab)
2013-09-29 00:21:18 +04:00
++ perd
~+
2013-09-29 00:21:18 +04:00
;~ pose
(stag %$ zust)
2014-03-20 05:05:42 +04:00
(stag %many (ifix [cab ;~(plug cab cab)] (more cab nusk)))
2013-09-29 00:21:18 +04:00
==
++ royl
~+
2015-07-12 20:26:23 +03:00
=+ ^= moo
2015-12-20 23:50:45 +03:00
|= a/tape
2015-07-12 20:26:23 +03:00
:- (lent a)
(scan a (bass 10 (plus sid:ab)))
2014-07-18 00:56:08 +04:00
=+ ^= voy
2015-07-13 00:59:10 +03:00
%+ cook royl-cell
;~ pose
2013-09-29 00:21:18 +04:00
;~ plug
2015-08-05 04:27:27 +03:00
(easy %d)
2015-07-13 00:59:10 +03:00
;~ pose (cold | hep) (easy &) ==
2015-07-12 20:26:23 +03:00
;~ plug dim:ag
;~ pose
;~(pfix dot (cook moo (plus (shim '0' '9'))))
(easy [0 0])
==
2015-07-13 00:59:10 +03:00
;~ pose
;~ pfix
(just 'e')
;~(plug ;~(pose (cold | hep) (easy &)) dim:ag)
==
(easy [& 0])
2015-06-12 20:56:30 +03:00
==
2014-07-18 00:56:08 +04:00
==
2013-09-29 00:21:18 +04:00
==
2015-07-13 00:59:10 +03:00
;~ plug
(easy %i)
;~ sfix
;~ pose (cold | hep) (easy &) ==
(jest 'inf')
==
==
;~ plug
(easy %n)
(cold ~ (jest 'nan'))
==
==
2013-09-29 00:21:18 +04:00
;~ pose
2014-06-27 23:24:42 +04:00
(stag %rh (cook rylh ;~(pfix ;~(plug sig sig) voy)))
(stag %rq (cook rylq ;~(pfix ;~(plug sig sig sig) voy)))
(stag %rd (cook ryld ;~(pfix sig voy)))
2015-07-12 20:26:23 +03:00
(stag %rs (cook ryls voy))
2013-09-29 00:21:18 +04:00
==
2015-07-12 20:26:23 +03:00
::
2014-06-27 23:24:42 +04:00
++ royl-cell
2015-12-04 02:53:57 +03:00
|= rn
2015-07-12 20:26:23 +03:00
^- dn
2015-12-04 01:58:42 +03:00
?. ?=({$d *} +<) +<
2015-07-12 20:26:23 +03:00
=+ ^= h
2015-07-13 00:59:10 +03:00
(dif:si (new:si f.b i.b) (sun:si d.b))
2015-08-05 04:27:27 +03:00
[%d a h (add (mul c.b (pow 10 d.b)) e.b)]
2015-07-12 20:26:23 +03:00
::
2013-09-29 00:21:18 +04:00
++ tash
~+
2013-09-29 00:21:18 +04:00
=+ ^= neg
2015-12-20 23:50:45 +03:00
|= {syn/? mol/dime} ^- dime
2013-09-29 00:21:18 +04:00
?> =('u' (end 3 1 p.mol))
[(cat 3 's' (rsh 3 1 p.mol)) (new:si syn q.mol)]
;~ pfix hep
;~ pose
2015-12-20 23:50:45 +03:00
(cook |=(a/dime (neg | a)) bisk)
;~(pfix hep (cook |=(a/dime (neg & a)) bisk))
2013-09-29 00:21:18 +04:00
==
==
2015-07-12 20:26:23 +03:00
::
2013-09-29 00:21:18 +04:00
++ twid
~+
2013-09-29 00:21:18 +04:00
;~ pose
2015-12-20 23:50:45 +03:00
(cook |=(a/@ [%blob (cue a)]) ;~(pfix (just '0') vum:ag))
(stag %$ crub)
2013-09-29 00:21:18 +04:00
==
::
++ zust
~+
2013-09-29 00:21:18 +04:00
;~ pose
(stag %is bip:ag)
(stag %if lip:ag)
(stag %f ;~(pose (cold & (just 'y')) (cold | (just 'n'))))
royl
==
--
++ scot |=(mol/dime ~(rent co %$ mol))
2015-12-20 23:50:45 +03:00
++ scow |=(mol/dime ~(rend co %$ mol))
++ slat |=(mod/@tas |=(txt/@ta (slaw mod txt)))
++ slav |=({mod/@tas txt/@ta} (need (slaw mod txt)))
2013-09-29 00:21:18 +04:00
++ slaw
2015-05-14 20:46:52 +03:00
~/ %slaw
2015-12-20 23:50:45 +03:00
|= {mod/@tas txt/@ta}
2015-12-04 04:24:39 +03:00
^- (unit @)
2013-09-29 00:21:18 +04:00
=+ con=(slay txt)
2015-12-08 04:23:27 +03:00
?.(&(?=({$~ $$ @ @} con) =(p.p.u.con mod)) ~ [~ q.p.u.con])
2013-09-29 00:21:18 +04:00
::
++ slay
2015-12-20 23:50:45 +03:00
|= txt/@ta ^- (unit coin)
=+ ^= vex
?: (gth 0x7fff.ffff txt) :: XX petty cache
~+ ((full nuck:so) [[1 1] (trip txt)])
((full nuck:so) [[1 1] (trip txt)])
2014-06-07 05:09:44 +04:00
?~ q.vex
2013-09-29 00:21:18 +04:00
~
[~ p.u.q.vex]
::
2014-10-28 23:15:44 +03:00
++ smyt :: pretty print path
2015-12-20 23:50:45 +03:00
|= bon/path ^- tank
2015-11-29 01:44:29 +03:00
:+ %rose [['/' ~] ['/' ~] ~]
2015-12-20 23:50:45 +03:00
(turn bon |=(a/@ [%leaf (trip a)]))
2014-10-28 21:55:44 +03:00
::
2015-12-20 23:50:45 +03:00
++ spat |=(pax/path (crip (spud pax))) :: render path to cord
++ spud |=(pax/path ~(ram re (smyt pax))) :: render path to tape
2015-01-26 22:15:35 +03:00
++ stab :: parse cord to path
=+ fel=;~(pfix fas (more fas urs:ab))
2015-12-20 23:50:45 +03:00
|=(zep/@t `path`(rash zep fel))
2014-04-10 00:35:28 +04:00
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2eN, pseudo-cryptography ::
2013-09-29 00:21:18 +04:00
::
++ un :: =(x (wred (wren x)))
|%
++ wren :: conceal structure
2015-12-20 23:50:45 +03:00
|= pyn/@ ^- @
2013-09-29 00:21:18 +04:00
=+ len=(met 3 pyn)
?: =(0 len)
0
=> .(len (dec len))
=+ mig=(zaft (xafo len (cut 3 [len 1] pyn)))
%+ can 3
2015-12-04 18:16:34 +03:00
%- flop ^- (list {@ @})
2013-09-29 00:21:18 +04:00
:- [1 mig]
2015-12-04 18:16:34 +03:00
|- ^- (list {@ @})
2013-09-29 00:21:18 +04:00
?: =(0 len)
~
=> .(len (dec len))
=+ mog=(zyft :(mix mig (end 3 1 len) (cut 3 [len 1] pyn)))
[[1 mog] $(mig mog)]
::
++ wred :: restore structure
2015-12-20 23:50:45 +03:00
|= cry/@ ^- @
2013-09-29 00:21:18 +04:00
=+ len=(met 3 cry)
?: =(0 len)
0
=> .(len (dec len))
=+ mig=(cut 3 [len 1] cry)
%+ can 3
2015-12-04 04:24:39 +03:00
%- flop ^- (list {@ @})
2013-09-29 00:21:18 +04:00
:- [1 (xaro len (zart mig))]
2015-12-04 04:24:39 +03:00
|- ^- (list {@ @})
2013-09-29 00:21:18 +04:00
?: =(0 len)
~
=> .(len (dec len))
=+ mog=(cut 3 [len 1] cry)
[[1 :(mix mig (end 3 1 len) (zyrt mog))] $(mig mog)]
::
2015-12-20 23:50:45 +03:00
++ xafo |=({a/@ b/@} +((mod (add (dec b) a) 255)))
++ xaro |=({a/@ b/@} +((mod (add (dec b) (sub 255 (mod a 255))) 255)))
2013-09-29 00:21:18 +04:00
::
++ zaft :: forward 255-sbox
2015-12-20 23:50:45 +03:00
|= a/@D
2013-09-29 00:21:18 +04:00
=+ ^= b
0xcc.75bc.86c8.2fb1.9a42.f0b3.79a0.92ca.21f6.1e41.cde5.fcc0.
7e85.51ae.1005.c72d.1246.07e8.7c64.a914.8d69.d9f4.59c2.8038.
1f4a.dca2.6fdf.66f9.f561.a12e.5a16.f7b0.a39f.364e.cb70.7318.
1de1.ad31.63d1.abd4.db68.6a33.134d.a760.edee.5434.493a.e323.
930d.8f3d.3562.bb81.0b24.43cf.bea5.a6eb.52b4.0229.06b2.6704.
78c9.45ec.d75e.58af.c577.b7b9.c40e.017d.90c3.87f8.96fa.1153.
0372.7f30.1c32.ac83.ff17.c6e4.d36d.6b55.e2ce.8c71.8a5b.b6f3.
9d4b.eab5.8b3c.e7f2.a8fe.9574.5de0.bf20.3f15.9784.9939.5f9c.
e609.564f.d8a4.b825.9819.94aa.2c08.8e4c.9b22.477a.2840.3ed6.
3750.6ef1.44dd.89ef.6576.d00a.fbda.9ed2.3b6c.7b0c.bde9.2ade.
5c88.c182.481a.1b0f.2bfd.d591.2726.57ba
(cut 3 [(dec a) 1] b)
::
++ zart :: reverse 255-sbox
2015-12-20 23:50:45 +03:00
|= a/@D
=+ ^= b
2013-09-29 00:21:18 +04:00
0x68.4f07.ea1c.73c9.75c2.efc8.d559.5125.f621.a7a8.8591.5613.
dd52.40eb.65a2.60b7.4bcb.1123.ceb0.1bd6.3c84.2906.b164.19b3.
1e95.5fec.ffbc.f187.fbe2.6680.7c77.d30e.e94a.9414.fd9a.017d.
3a7e.5a55.8ff5.8bf9.c181.e5b6.6ab2.35da.50aa.9293.3bc0.cdc6.
f3bf.1a58.4130.f844.3846.744e.36a0.f205.789e.32d8.5e54.5c22.
0f76.fce7.4569.0d99.d26e.e879.dc16.2df4.887f.1ffe.4dba.6f5d.
bbcc.2663.1762.aed7.af8a.ca20.dbb4.9bc7.a942.834c.105b.c4d4.
8202.3e61.a671.90e6.273d.bdab.3157.cfa4.0c2e.df86.2496.f7ed.
2b48.2a9d.5318.a343.d128.be9c.a5ad.6bb5.6dfa.c5e1.3408.128d.
2c04.0339.97a1.2ff0.49d0.eeb8.6c0a.0b37.b967.c347.d9ac.e072.
e409.7b9f.1598.1d3f.33de.8ce3.8970.8e7a
(cut 3 [(dec a) 1] b)
::
++ zyft :: forward 256-sbox
2015-12-20 23:50:45 +03:00
|= a/@D
2013-09-29 00:21:18 +04:00
=+ ^= b
0xbb49.b71f.b881.b402.17e4.6b86.69b5.1647.115f.dddb.7ca5.
8371.4bd5.19a9.b092.605d.0d9b.e030.a0cc.78ba.5706.4d2d.
986a.768c.f8e8.c4c7.2f1c.effe.3cae.01c0.253e.65d3.3872.
ce0e.7a74.8ac6.daac.7e5c.6479.44ec.4143.3d20.4af0.ee6c.
c828.deca.0377.249f.ffcd.7b4f.eb7d.66f2.8951.042e.595a.
8e13.f9c3.a79a.f788.6199.9391.7fab.6200.4ce5.0758.e2f1.
7594.c945.d218.4248.afa1.e61a.54fb.1482.bea4.96a2.3473.
63c2.e7cb.155b.120a.4ed7.bfd8.b31b.4008.f329.fca3.5380.
9556.0cb2.8722.2bea.e96e.3ac5.d1bc.10e3.2c52.a62a.b1d6.
35aa.d05e.f6a8.0f3b.31ed.559d.09ad.f585.6d21.fd1d.8d67.
370b.26f4.70c1.b923.4684.6fbd.cf8b.5036.0539.9cdc.d93f.
9068.1edf.8f33.b632.d427.97fa.9ee1
(cut 3 [a 1] b)
::
++ zyrt :: reverse 256-sbox
2015-12-20 23:50:45 +03:00
|= a/@D
=+ ^= b
2013-09-29 00:21:18 +04:00
0x9fc8.2753.6e02.8fcf.8b35.2b20.5598.7caa.c9a9.30b0.9b48.
47ce.6371.80f6.407d.00dd.0aa5.ed10.ecb7.0f5a.5c3a.e605.
c077.4337.17bd.9eda.62a4.79a7.ccb8.44cd.8e64.1ec4.5b6b.
1842.ffd8.1dfb.fd07.f2f9.594c.3be3.73c6.2cb6.8438.e434.
8d3d.ea6a.5268.72db.a001.2e11.de8c.88d3.0369.4f7a.87e2.
860d.0991.25d0.16b9.978a.4bf4.2a1a.e96c.fa50.85b5.9aeb.
9dbb.b2d9.a2d1.7bba.66be.e81f.1946.29a8.f5d2.f30c.2499.
c1b3.6583.89e1.ee36.e0b4.6092.937e.d74e.2f6f.513e.9615.
9c5d.d581.e7ab.fe74.f01b.78b1.ae75.af57.0ec2.adc7.3245.
12bf.2314.3967.0806.31dc.cb94.d43f.493c.54a6.0421.c3a1.
1c4a.28ac.fc0b.26ca.5870.e576.f7f1.616d.905f.ef41.33bc.
df4d.225e.2d56.7fd6.1395.a3f8.c582
(cut 3 [a 1] b)
--
2015-01-13 02:12:52 +03:00
::
++ ob
|%
++ feen :: conceal structure v2
2015-12-20 23:50:45 +03:00
|= pyn/@ ^- @
2015-01-13 02:12:52 +03:00
?: &((gte pyn 0x1.0000) (lte pyn 0xffff.ffff))
(add 0x1.0000 (fice (sub pyn 0x1.0000)))
?: &((gte pyn 0x1.0000.0000) (lte pyn 0xffff.ffff.ffff.ffff))
=+ lo=(dis pyn 0xffff.ffff)
=+ hi=(dis pyn 0xffff.ffff.0000.0000)
%+ con hi
(add 0x1.0000 (fice (sub lo 0x1.0000)))
pyn
::
++ fend :: restore structure v2
2015-12-20 23:50:45 +03:00
|= cry/@ ^- @
2015-01-13 02:12:52 +03:00
?: &((gte cry 0x1.0000) (lte cry 0xffff.ffff))
(add 0x1.0000 (teil (sub cry 0x1.0000)))
?: &((gte cry 0x1.0000.0000) (lte cry 0xffff.ffff.ffff.ffff))
=+ lo=(dis cry 0xffff.ffff)
=+ hi=(dis cry 0xffff.ffff.0000.0000)
%+ con hi
(add 0x1.0000 (teil (sub lo 0x1.0000)))
cry
::
++ fice :: adapted from
2015-12-20 23:50:45 +03:00
|= nor/@ :: black and rogaway
2015-01-13 02:12:52 +03:00
^- @ :: "ciphers with
=+ ^= sel :: arbitrary finite
%+ rynd 2 :: domains", 2002
%+ rynd 1
%+ rynd 0
[(mod nor 65.535) (div nor 65.535)]
(add (mul 65.535 -.sel) +.sel)
::
++ teil :: reverse ++fice
2015-12-20 23:50:45 +03:00
|= vip/@
2015-01-13 02:12:52 +03:00
^- @
=+ ^= sel
%+ rund 0
%+ rund 1
%+ rund 2
[(mod vip 65.535) (div vip 65.535)]
(add (mul 65.535 -.sel) +.sel)
::
++ rynd :: feistel round
2015-12-20 23:50:45 +03:00
|= {n/@ l/@ r/@}
2015-12-04 04:24:39 +03:00
^- {@ @}
2015-01-13 02:12:52 +03:00
:- r
?~ (mod n 2)
(~(sum fo 65.535) l (en:aesc (snag n raku) r))
(~(sum fo 65.536) l (en:aesc (snag n raku) r))
::
++ rund :: reverse round
2015-12-20 23:50:45 +03:00
|= {n/@ l/@ r/@}
2015-12-04 04:24:39 +03:00
^- {@ @}
2015-01-13 02:12:52 +03:00
:- r
?~ (mod n 2)
(~(dif fo 65.535) l (en:aesc (snag n raku) r))
(~(dif fo 65.536) l (en:aesc (snag n raku) r))
::
++ raku
2015-12-04 04:24:39 +03:00
^- (list @ux)
2015-01-13 02:12:52 +03:00
:~ 0x15f6.25e3.083a.eb3e.7a55.d4db.fb99.32a3.
43af.2750.219e.8a24.e5f8.fac3.6c36.f968
0xf2ff.24fe.54d0.1abd.4b2a.d8aa.4402.8e88.
e82f.19ec.948d.b1bb.ed2e.f791.83a3.8133
0xa3d8.6a7b.400e.9e91.187d.91a7.6942.f34a.
6f5f.ab8e.88b9.c089.b2dc.95a6.aed5.e3a4
==
--
2013-09-29 00:21:18 +04:00
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2014-04-10 00:35:28 +04:00
:: section 2eO, virtualization ::
2013-09-29 00:21:18 +04:00
::
++ mack
2015-12-20 23:50:45 +03:00
|= {sub/* fol/*}
2013-09-29 00:21:18 +04:00
^- (unit)
=+ ton=(mink [sub fol] |~(* ~))
2015-12-08 04:23:27 +03:00
?.(?=({$0 *} ton) ~ [~ p.ton])
2013-09-29 00:21:18 +04:00
::
++ mink
~/ %mink
2016-01-07 10:08:09 +03:00
|= {{sub/* fol/*} sky/$+(^ (unit))}
2015-12-04 04:24:39 +03:00
=+ tax=*(list {@ta *})
2013-09-29 00:21:18 +04:00
|- ^- tone
?@ fol
[%2 tax]
?: ?=(^ -.fol)
=+ hed=$(fol -.fol)
2015-12-04 04:24:39 +03:00
?: ?=($2 -.hed)
2013-09-29 00:21:18 +04:00
hed
=+ tal=$(fol +.fol)
?- -.tal
2015-12-04 04:24:39 +03:00
$0 ?-(-.hed $0 [%0 p.hed p.tal], $1 hed)
$1 ?-(-.hed $0 tal, $1 [%1 (weld p.hed p.tal)])
$2 tal
2013-09-29 00:21:18 +04:00
==
2014-06-09 07:22:11 +04:00
?+ fol
[%2 tax]
2013-09-29 00:21:18 +04:00
::
2015-12-20 23:50:45 +03:00
{$0 b/@}
2013-09-29 00:21:18 +04:00
?: =(0 b.fol) [%2 tax]
?: =(1 b.fol) [%0 sub]
?: ?=(@ sub) [%2 tax]
=+ [now=(cap b.fol) lat=(mas b.fol)]
2013-09-29 00:21:18 +04:00
$(b.fol lat, sub ?:(=(2 now) -.sub +.sub))
::
2015-12-20 23:50:45 +03:00
{$1 b/*}
2013-09-29 00:21:18 +04:00
[%0 b.fol]
::
2015-12-20 23:50:45 +03:00
{$2 b/{^ *}}
2014-06-09 07:22:11 +04:00
=+ ben=$(fol b.fol)
2015-12-08 04:23:27 +03:00
?. ?=($0 -.ben) ben
2013-09-29 00:21:18 +04:00
?>(?=(^ p.ben) $(sub -.p.ben, fol +.p.ben))
::?>(?=(^ p.ben) $([sub fol] p.ben)
2013-09-29 00:21:18 +04:00
::
2015-12-20 23:50:45 +03:00
{$3 b/*}
2013-09-29 00:21:18 +04:00
=+ ben=$(fol b.fol)
2015-12-08 04:23:27 +03:00
?. ?=($0 -.ben) ben
2013-09-29 00:21:18 +04:00
[%0 .?(p.ben)]
::
2015-12-20 23:50:45 +03:00
{$4 b/*}
2013-09-29 00:21:18 +04:00
=+ ben=$(fol b.fol)
2015-12-08 04:23:27 +03:00
?. ?=($0 -.ben) ben
2013-09-29 00:21:18 +04:00
?. ?=(@ p.ben) [%2 tax]
[%0 .+(p.ben)]
::
2015-12-20 23:50:45 +03:00
{$5 b/*}
2013-09-29 00:21:18 +04:00
=+ ben=$(fol b.fol)
2015-12-08 04:23:27 +03:00
?. ?=($0 -.ben) ben
2013-09-29 00:21:18 +04:00
?. ?=(^ p.ben) [%2 tax]
[%0 =(-.p.ben +.p.ben)]
::
2015-12-20 23:50:45 +03:00
{$6 b/* c/* d/*}
2013-09-29 00:21:18 +04:00
$(fol =>(fol [2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b]))
::
2015-12-20 23:50:45 +03:00
{$7 b/* c/*} $(fol =>(fol [2 b 1 c]))
{$8 b/* c/*} $(fol =>(fol [7 [[0 1] b] c]))
{$9 b/* c/*} $(fol =>(fol [7 c 0 b]))
{$10 @ c/*} $(fol c.fol)
{$10 {b/* c/*} d/*}
2013-09-29 00:21:18 +04:00
=+ ben=$(fol c.fol)
2015-12-04 04:24:39 +03:00
?. ?=($0 -.ben) ben
?: ?=(?($hunk $hand $lose $mean $spot) b.fol)
2014-06-09 07:22:11 +04:00
$(fol d.fol, tax [[b.fol p.ben] tax])
$(fol d.fol)
2013-09-29 00:21:18 +04:00
::
2015-12-20 23:50:45 +03:00
{$11 b/*}
2013-09-29 00:21:18 +04:00
=+ ben=$(fol b.fol)
2015-12-04 04:24:39 +03:00
?. ?=($0 -.ben) ben
2016-01-07 10:08:09 +03:00
=+ val=(sky %noun p.ben)
2014-06-09 07:22:11 +04:00
?~(val [%1 p.ben ~] [%0 u.val])
2013-09-29 00:21:18 +04:00
::
==
::
++ mock
2015-12-20 23:50:45 +03:00
|= {{sub/* fol/*} sky/$+(* (unit))}
2013-09-29 00:21:18 +04:00
(mook (mink [sub fol] sky))
::
2015-11-30 21:58:09 +03:00
++ moop
2015-12-20 23:50:45 +03:00
|= pon/(list {@ta *}) ^+ pon
2015-11-29 01:44:29 +03:00
?~ pon ~
:- i.pon
2015-12-08 04:23:27 +03:00
?. ?=({$spot * ^} i.pon)
2015-11-29 01:44:29 +03:00
$(pon t.pon)
2015-12-08 04:23:27 +03:00
?. ?=({{$spot * ^} *} t.pon)
2015-11-29 01:44:29 +03:00
$(pon t.pon)
=> .(pon t.pon)
=+ sot=+.i.pon
2015-12-08 04:23:27 +03:00
|- ^- (list {@ta *})
?. ?=({{$spot * ^} *} t.pon)
2015-11-29 01:44:29 +03:00
[[%spot sot] ^$(pon t.pon)]
=+ sop=+.i.pon
?: ?& =(-.sop -.sot)
(lor +<.sop +<.sot)
(lor +>.sot +>.sop)
==
$(sot sop, pon t.pon)
[[%spot sot] ^$(pon t.pon)]
::
2013-09-29 00:21:18 +04:00
++ mook
2015-12-20 23:50:45 +03:00
|= ton/tone
2013-09-29 00:21:18 +04:00
^- toon
2015-12-04 04:24:39 +03:00
?. ?=({$2 *} ton) ton
2013-09-29 00:21:18 +04:00
:- %2
2015-11-30 21:58:09 +03:00
=. p.ton (moop p.ton)
2013-09-29 00:21:18 +04:00
=+ yel=(lent p.ton)
=. p.ton
2013-09-29 00:21:18 +04:00
?. (gth yel 256) p.ton
%+ weld
(scag 128 p.ton)
2015-12-04 18:16:34 +03:00
^- (list {@ta *})
2013-09-29 00:21:18 +04:00
:_ (slag (sub yel 128) p.ton)
:- %lose
2013-09-29 00:21:18 +04:00
%+ rap 3
2015-11-29 01:44:29 +03:00
"[skipped {(scow %ud (sub yel 256))} frames]"
2013-09-29 00:21:18 +04:00
|- ^- (list tank)
?~ p.ton ~
=+ rex=$(p.ton t.p.ton)
?+ -.i.p.ton rex
2015-12-04 04:24:39 +03:00
$hunk [(tank +.i.p.ton) rex]
2015-12-04 18:16:34 +03:00
$lose [[%leaf (rip 3 (@ +.i.p.ton))] rex]
$hand [[%leaf (scow %p (mug +.i.p.ton))] rex]
2015-12-04 04:24:39 +03:00
$mean :_ rex
2015-12-04 18:16:34 +03:00
?@ +.i.p.ton [%leaf (rip 3 (@ +.i.p.ton))]
2013-09-29 00:21:18 +04:00
=+ mac=(mack +.i.p.ton +<.i.p.ton)
2014-01-04 11:28:16 +04:00
?~(mac [%leaf "####"] (tank u.mac))
2015-12-04 04:24:39 +03:00
$spot :_ rex
2013-09-29 00:21:18 +04:00
=+ sot=(spot +.i.p.ton)
2015-11-29 01:44:29 +03:00
:+ %rose [":" ~ ~]
:~ (smyt p.sot)
2015-12-20 23:50:45 +03:00
=> [ud=|=(a/@u (scow %ud a)) q.sot]
2015-12-21 00:16:39 +03:00
leaf+"<[{(ud p.p)} {(ud q.p)}].[{(ud p.q)} {(ud q.q)}]>"
2015-11-29 01:44:29 +03:00
== ==
2013-09-29 00:21:18 +04:00
::
++ mang
2015-12-20 23:50:45 +03:00
|= {{gat/* sam/*} sky/$+(* (unit))}
2013-09-29 00:21:18 +04:00
^- (unit)
=+ ton=(mong [[gat sam] sky])
2015-12-04 04:24:39 +03:00
?.(?=({$0 *} ton) ~ [~ p.ton])
2013-09-29 00:21:18 +04:00
::
++ mong
2015-12-20 23:50:45 +03:00
|= {{gat/* sam/*} sky/$+(* (unit))}
2013-09-29 00:21:18 +04:00
^- toon
?. &(?=(^ gat) ?=(^ +.gat))
[%2 ~]
(mock [[-.gat [sam +>.gat]] -.gat] sky)
::
++ mung
2015-12-20 23:50:45 +03:00
|= {{gat/* sam/*} sky/$+(* (unit))}
2013-09-29 00:21:18 +04:00
^- tone
?. &(?=(^ gat) ?=(^ +.gat))
[%2 ~]
(mink [[-.gat [sam +>.gat]] -.gat] sky)
2014-03-20 05:05:42 +04:00
::
2015-12-26 13:07:50 +03:00
++ mule :: spand virtual
2014-05-19 03:16:01 +04:00
~/ %mule
2015-12-20 23:50:45 +03:00
|* taq/_|.(**)
2014-03-20 05:05:42 +04:00
=+ mud=(mute taq)
?- -.mud
2016-01-07 10:08:09 +03:00
$& [%& p=$:taq] :: XX transition
2015-12-04 04:24:39 +03:00
$| [%| p=p.mud]
2014-03-20 05:05:42 +04:00
==
::
2015-12-26 13:07:50 +03:00
++ mute :: unspand virtual
2015-12-20 23:50:45 +03:00
|= taq/_^?(|.(**))
2015-12-04 04:24:39 +03:00
^- (each * (list tank))
2014-03-20 05:05:42 +04:00
=+ ton=(mock [taq 9 2 0 1] |=(* ~))
?- -.ton
2015-12-04 04:24:39 +03:00
$0 [%& p.ton]
2015-12-20 23:50:45 +03:00
$1 [%| (turn p.ton |=(a/* (smyt (path a))))]
2015-12-04 04:24:39 +03:00
$2 [%| p.ton]
2014-03-20 05:05:42 +04:00
==
2013-09-29 00:21:18 +04:00
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2014-04-10 00:35:28 +04:00
:: section 2eP, diff (move me) ::
2013-09-29 00:21:18 +04:00
::
::
++ berk :: invert diff patch
2015-12-20 23:50:45 +03:00
|* bur/(urge)
2013-12-20 21:34:13 +04:00
|- ^+ bur
2013-09-29 00:21:18 +04:00
?~ bur ~
:_ $(bur t.bur)
?- -.i.bur
$& i.bur
$| [%| q.i.bur p.i.bur]
2013-09-29 00:21:18 +04:00
==
::
++ diff :: generate patch
2015-12-20 23:50:45 +03:00
|= pum/umph
|= {old/* new/*} ^- udon
2013-09-29 00:21:18 +04:00
:- pum
?+ pum ~|(%unsupported !!)
2015-12-04 04:24:39 +03:00
$a [%d (nude old new)]
$b =+ [hel=(cue ((hard @) old)) hev=(cue ((hard @) new))]
2014-05-20 22:53:49 +04:00
[%d (nude hel hev)]
2015-12-04 04:24:39 +03:00
$c =+ [hel=(lore ((hard @) old)) hev=(lore ((hard @) new))]
2013-09-29 00:21:18 +04:00
[%c (lusk hel hev (loss hel hev))]
==
2013-09-29 00:21:18 +04:00
::
++ loss :: longest subsequence
~/ %loss
2015-12-20 23:50:45 +03:00
|* {hel/(list) hev/(list)}
2013-12-20 21:34:13 +04:00
|- ^+ hev
=+ ^= sev
2015-12-15 01:21:10 +03:00
=+ [inx=0 sev=*(map _i.-.hev (list @ud))]
2013-09-29 00:21:18 +04:00
|- ^+ sev
?~ hev sev
=+ guy=(~(get by sev) i.hev)
$(hev t.hev, inx +(inx), sev (~(put by sev) i.hev [inx ?~(guy ~ u.guy)]))
2015-12-20 23:50:45 +03:00
=| gox/{p/@ud q/(map @ud {p/@ud q/_hev})}
2013-09-29 00:21:18 +04:00
=< abet
=< main
|%
++ abet :: subsequence
^+ hev
?: =(0 p.gox) ~
(flop q:(need (~(get by q.gox) (dec p.gox))))
::
++ hink :: extend fits top
2015-12-20 23:50:45 +03:00
|= {inx/@ud goy/@ud} ^- ?
2013-09-29 00:21:18 +04:00
|(=(p.gox inx) (lth goy p:(need (~(get by q.gox) inx))))
::
++ lonk :: extend fits bottom
2015-12-20 23:50:45 +03:00
|= {inx/@ud goy/@ud} ^- ?
2013-09-29 00:21:18 +04:00
|(=(0 inx) (gth goy p:(need (~(get by q.gox) (dec inx)))))
::
++ lune :: extend
2015-12-20 23:50:45 +03:00
|= {inx/@ud goy/@ud}
2013-09-29 00:21:18 +04:00
^+ +>
%_ +>.$
gox
:- ?:(=(inx p.gox) +(p.gox) p.gox)
%+ ~(put by q.gox) inx
2013-09-29 00:21:18 +04:00
[goy (snag goy hev) ?:(=(0 inx) ~ q:(need (~(get by q.gox) (dec inx))))]
==
::
++ merg :: merge all matches
2015-12-20 23:50:45 +03:00
|= gay/(list @ud)
2013-09-29 00:21:18 +04:00
^+ +>
=+ ^= zes
2015-12-20 23:50:45 +03:00
=+ [inx=0 zes=*(list {p/@ud q/@ud})]
2013-09-29 00:21:18 +04:00
|- ^+ zes
2015-12-08 05:04:19 +03:00
?: |(?=($~ gay) (gth inx p.gox)) zes
2013-09-29 00:21:18 +04:00
?. (lonk inx i.gay) $(gay t.gay)
?. (hink inx i.gay) $(inx +(inx))
$(inx +(inx), gay t.gay, zes [[inx i.gay] zes])
|- ^+ +>.^$
?~(zes +>.^$ $(zes t.zes, +>.^$ (lune i.zes)))
::
++ main
=+ hol=hel
|- ^+ +>
?~ hol +>
=+ guy=(~(get by sev) i.hol)
2015-12-04 04:24:39 +03:00
$(hol t.hol, +> (merg (flop `(list @ud)`?~(guy ~ u.guy))))
2013-09-29 00:21:18 +04:00
--
::
++ lore :: atom to line list
~/ %lore
2015-12-20 23:50:45 +03:00
|= lub/@
=| tez/(list @t)
2013-09-29 00:21:18 +04:00
|- ^+ tez
?: =(0 lub) (flop tez)
=+ ^= meg
=+ meg=0
|- ^- @ud
=+ gam=(cut 3 [meg 1] lub)
?:(|(=(10 gam) =(0 gam)) meg $(meg +(meg)))
2014-05-29 00:19:49 +04:00
=+ res=(rsh 3 +(meg) lub)
?: &(=(0 (cut 3 [meg 1] lub)) !=(0 res))
!!
$(lub res, tez [(end 3 meg lub) tez])
2013-09-29 00:21:18 +04:00
::
2014-10-22 06:04:27 +04:00
++ role :: line list to atom
2015-12-20 23:50:45 +03:00
|= tez/(list @t)
(rap 3 (turn tez |=(a/@t (cat 3 a 10))))
2013-09-29 00:21:18 +04:00
::
++ lump :: apply patch
2015-12-20 23:50:45 +03:00
|= {don/udon src/*}
2013-09-29 00:21:18 +04:00
^- *
?+ p.don ~|(%unsupported !!)
2015-12-04 04:24:39 +03:00
$a
2013-09-29 00:21:18 +04:00
?+ -.q.don ~|(%unsupported !!)
2015-12-04 04:24:39 +03:00
$a q.q.don
$c (lurk ((hard (list)) src) p.q.don)
$d (lure src p.q.don)
2013-09-29 00:21:18 +04:00
==
::
2015-12-04 04:24:39 +03:00
$c
2015-12-04 18:16:34 +03:00
=+ dst=(lore ((hard @) src))
2014-10-22 06:04:27 +04:00
%- role
2013-09-29 00:21:18 +04:00
?+ -.q.don ~|(%unsupported !!)
::
:: XX these hards should not be needed; udon needs parameterized
::
2015-12-04 18:16:34 +03:00
$a ((hard (list @t)) q.q.don)
$c ((hard (list @t)) (lurk `(list *)`dst p.q.don))
2013-09-29 00:21:18 +04:00
==
==
::
2014-04-16 05:25:40 +04:00
++ lure :: apply tree diff
2015-12-20 23:50:45 +03:00
|= {a/* b/upas}
2014-04-16 05:25:40 +04:00
^- *
?^ -.b
[$(b -.b) $(b +.b)]
?+ -.b ~|(%unsupported !!)
2015-12-04 04:24:39 +03:00
$0 .*(a [0 p.b])
$1 .*(a [1 p.b])
2014-04-16 05:25:40 +04:00
==
2013-09-29 00:21:18 +04:00
++ limp :: invert patch
2015-12-20 23:50:45 +03:00
|= don/udon ^- udon
2013-09-29 00:21:18 +04:00
:- p.don
?+ -.q.don ~|(%unsupported !!)
2015-12-04 04:24:39 +03:00
$a [%a q.q.don p.q.don]
$c [%c (berk p.q.don)]
$d [%d q.q.don p.q.don]
2013-09-29 00:21:18 +04:00
==
::
++ hump :: general prepatch
2015-12-20 23:50:45 +03:00
|= {pum/umph src/*} ^- *
2013-09-29 00:21:18 +04:00
?+ pum ~|(%unsupported !!)
2015-12-04 04:24:39 +03:00
$a src
$b (cue ((hard @) src))
$c (lore ((hard @) src))
2013-09-29 00:21:18 +04:00
==
::
++ husk :: unprepatch
2015-12-20 23:50:45 +03:00
|= {pum/umph dst/*} ^- *
2013-09-29 00:21:18 +04:00
?+ pum ~|(%unsupported !!)
2015-12-04 04:24:39 +03:00
$a dst
$b (jam dst)
$c (role ((hard (list @)) dst))
2013-09-29 00:21:18 +04:00
==
::
++ lurk :: apply list patch
2015-12-20 23:50:45 +03:00
|* {hel/(list) rug/(urge)}
2013-09-29 00:21:18 +04:00
^+ hel
2015-12-15 01:21:10 +03:00
=+ war=`_hel`~
2013-09-29 00:21:18 +04:00
|- ^+ hel
?~ rug (flop war)
?- -.i.rug
$&
2013-09-29 00:21:18 +04:00
%= $
rug t.rug
hel (slag p.i.rug hel)
war (weld (flop (scag p.i.rug hel)) war)
==
::
$|
2013-09-29 00:21:18 +04:00
%= $
rug t.rug
hel =+ gur=(flop p.i.rug)
|- ^+ hel
?~ gur hel
?>(&(?=(^ hel) =(i.gur i.hel)) $(hel t.hel, gur t.gur))
war (weld q.i.rug war)
==
==
::
++ lusk :: lcs to list patch
2015-12-20 23:50:45 +03:00
|* {hel/(list) hev/(list) lcs/(list)}
2013-09-29 00:21:18 +04:00
=+ ^= rag
2015-12-20 23:50:45 +03:00
^- {$%({$& p/@ud} {$| p/_lcs q/_lcs})} :: XX translation
2013-09-29 00:21:18 +04:00
[%& 0]
2015-12-15 01:21:10 +03:00
=> .(rag [p=rag q=*(list _rag)])
2013-09-29 00:21:18 +04:00
=< abet =< main
|%
++ abet =.(q.rag ?:(=([& 0] p.rag) q.rag [p.rag q.rag]) (flop q.rag))
++ done
2015-12-20 23:50:45 +03:00
|= new/_p.rag
2013-09-29 00:21:18 +04:00
^+ rag
?- -.p.rag
2015-12-04 04:24:39 +03:00
$| ?- -.new
$| [[%| (weld p.new p.p.rag) (weld q.new q.p.rag)] q.rag]
$& [new [p.rag q.rag]]
2013-09-29 00:21:18 +04:00
==
2015-12-04 04:24:39 +03:00
$& ?- -.new
$| [new ?:(=(0 p.p.rag) q.rag [p.rag q.rag])]
$& [[%& (add p.p.rag p.new)] q.rag]
2013-09-29 00:21:18 +04:00
==
==
::
++ main
|- ^+ +
?~ hel
?~ hev
2015-12-08 05:04:19 +03:00
?>(?=($~ lcs) +)
2013-09-29 00:21:18 +04:00
$(hev t.hev, rag (done %| ~ [i.hev ~]))
?~ hev
$(hel t.hel, rag (done %| [i.hel ~] ~))
?~ lcs
+(rag (done %| (flop hel) (flop hev)))
?: =(i.hel i.lcs)
?: =(i.hev i.lcs)
$(lcs t.lcs, hel t.hel, hev t.hev, rag (done %& 1))
$(hev t.hev, rag (done %| ~ [i.hev ~]))
?: =(i.hev i.lcs)
$(hel t.hel, rag (done %| [i.hel ~] ~))
$(hel t.hel, hev t.hev, rag (done %| [i.hel ~] [i.hev ~]))
--
2014-04-16 03:47:57 +04:00
++ nude :: tree change
2015-12-20 23:50:45 +03:00
=< |= {a/* b/*} ^- {p/upas q/upas}
[p=(tred a b) q=(tred b a)]
2014-04-16 03:47:57 +04:00
|%
++ axes :: locs of nouns
2015-12-20 23:50:45 +03:00
|= {a/@ b/*} ^- (map * axis)
2015-12-04 04:24:39 +03:00
=+ c=*(map * axis)
|- ^- (map * axis)
2014-04-16 03:47:57 +04:00
=> .(c (~(put by c) b a))
?@ b
c
%- ~(uni by c)
%- ~(uni by $(a (mul 2 a), b -.b))
$(a +((mul 2 a)), b +.b)
2014-06-03 09:07:32 +04:00
::
2014-04-16 03:47:57 +04:00
++ tred :: diff a->b
2015-12-20 23:50:45 +03:00
|= {a/* b/*} ^- upas
=| c/(unit *)
2014-04-16 03:47:57 +04:00
=+ d=(axes 1 a)
|- ^- upas
=> .(c (~(get by d) b))
?~ c
?@ b
[%1 b]
=+ e=^-(upas [$(b -.b) $(b +.b)])
?- e
2015-12-04 04:24:39 +03:00
{{$1 *} {$1 *}} [%1 [p.p.e p.q.e]]
2014-04-16 03:47:57 +04:00
* e
==
[%0 u.c]
--
2013-09-29 00:21:18 +04:00
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2eW, lite number theory ::
::
2015-10-27 01:26:49 +03:00
++ egcd !: :: schneier's egcd
2015-12-20 23:50:45 +03:00
|= {a/@ b/@}
=+ si
=+ [c=(sun a) d=(sun b)]
=+ [u=[c=(sun 1) d=--0] v=[c=--0 d=(sun 1)]]
2015-12-20 23:50:45 +03:00
|- ^- {d/@ u/@s v/@s}
?: =(--0 c)
[(abs d) d.u d.v]
:: ?> ?& =(c (sum (pro (sun a) c.u) (pro (sun b) c.v)))
:: =(d (sum (pro (sun a) d.u) (pro (sun b) d.v)))
:: ==
=+ q=(fra d c)
%= $
c (dif d (pro q c))
d c
u [(dif d.u (pro q c.u)) c.u]
v [(dif d.v (pro q c.v)) c.v]
==
::
++ pram :: rabin-miller
2015-12-20 23:50:45 +03:00
|= a/@ ^- ?
?: ?| =(0 (end 0 1 a))
=(1 a)
=+ b=1
|- ^- ?
?: =(512 b)
|
?|(=+(c=+((mul 2 b)) &(!=(a c) =(a (mul c (div a c))))) $(b +(b)))
==
|
=+ ^= b
=+ [s=(dec a) t=0]
2015-12-20 23:50:45 +03:00
|- ^- {s/@ t/@}
?: =(0 (end 0 1 s))
$(s (rsh 0 1 s), t +(t))
[s t]
?> =((mul s.b (bex t.b)) (dec a))
=+ c=0
|- ^- ?
?: =(c 64)
&
=+ d=(~(raw og (add c a)) (met 0 a))
=+ e=(~(exp fo a) s.b d)
?& ?| =(1 e)
=+ f=0
|- ^- ?
?: =(e (dec a))
&
?: =(f (dec t.b))
|
$(e (~(pro fo a) e e), f +(f))
==
$(c +(c))
==
::
++ ramp :: make r-m prime
2015-12-20 23:50:45 +03:00
|= {a/@ b/(list @) c/@} ^- @ux :: {bits snags seed}
=> .(c (shas %ramp c))
=+ d=*@
|-
?: =((mul 100 a) d)
~|(%ar-ramp !!)
=+ e=(~(raw og c) a)
2015-12-20 23:50:45 +03:00
?: &((levy b |=(f/@ !=(1 (mod e f)))) (pram e))
e
$(c +(c), d (shax d))
::
++ fo :: modulo prime
2015-12-20 23:50:45 +03:00
|_ a/@
++ dif
2015-12-20 23:50:45 +03:00
|= {b/@ c/@}
(sit (sub (add a b) (sit c)))
::
++ exp
2015-12-20 23:50:45 +03:00
|= {b/@ c/@}
?: =(0 b)
1
=+ d=$(b (rsh 0 1 b))
=+ e=(pro d d)
?:(=(0 (end 0 1 b)) e (pro c e))
::
++ fra
2015-12-20 23:50:45 +03:00
|= {b/@ c/@}
(pro b (inv c))
::
++ inv
2015-12-20 23:50:45 +03:00
|= b/@
=+ c=(dul:si u:(egcd b a) a)
c
::
++ pro
2015-12-20 23:50:45 +03:00
|= {b/@ c/@}
(sit (mul b c))
::
++ sit
2015-12-20 23:50:45 +03:00
|= b/@
(mod b a)
::
++ sum
2015-12-20 23:50:45 +03:00
|= {b/@ c/@}
(sit (add b c))
--
::
++ ga :: GF (bex p.a)
2015-12-20 23:50:45 +03:00
|= a/{p/@ q/@ r/@} :: dim poly gen
=+ si=(bex p.a)
=+ ma=(dec si)
=> |%
++ dif :: add and sub
2015-12-20 23:50:45 +03:00
|= {b/@ c/@}
2014-05-07 02:49:56 +04:00
~| [%dif-ga a]
?> &((lth b si) (lth c si))
(mix b c)
::
2014-05-07 02:49:56 +04:00
++ dub :: mul by x
2015-12-20 23:50:45 +03:00
|= b/@
2014-05-07 02:49:56 +04:00
~| [%dub-ga a]
?> (lth b si)
?: =(1 (cut 0 [(dec p.a) 1] b))
2014-05-07 02:49:56 +04:00
(dif (sit q.a) (sit (lsh 0 1 b)))
(lsh 0 1 b)
::
2014-05-07 02:49:56 +04:00
++ pro :: slow multiply
2015-12-20 23:50:45 +03:00
|= {b/@ c/@}
?: =(0 b)
0
?: =(1 (dis 1 b))
(dif c $(b (rsh 0 1 b), c (dub c)))
$(b (rsh 0 1 b), c (dub c))
::
2015-12-21 00:16:39 +03:00
++ toe :: exp+log tables
=+ ^= nu
2015-12-20 23:50:45 +03:00
|= {b/@ c/@}
2015-12-04 04:24:39 +03:00
^- (map @ @)
=+ d=*(map @ @)
|-
?: =(0 c)
d
%= $
c (dec c)
d (~(put by d) c b)
==
=+ [p=(nu 0 (bex p.a)) q=(nu ma ma)]
=+ [b=1 c=0]
2015-12-20 23:50:45 +03:00
|- ^- {p/(map @ @) q/(map @ @)}
?: =(ma c)
[(~(put by p) c b) q]
%= $
b (pro r.a b)
c +(c)
p (~(put by p) c b)
q (~(put by q) b c)
==
::
++ sit :: reduce
2015-12-20 23:50:45 +03:00
|= b/@
(mod b (bex p.a))
--
=+ toe
|%
++ fra :: divide
2015-12-20 23:50:45 +03:00
|= {b/@ c/@}
(pro b (inv c))
::
++ inv :: invert
2015-12-20 23:50:45 +03:00
|= b/@
2014-05-07 02:49:56 +04:00
~| [%inv-ga a]
=+ c=(~(get by q) b)
2014-05-07 02:49:56 +04:00
?~ c !!
=+ d=(~(get by p) (sub ma u.c))
(need d)
::
++ pow :: exponent
2015-12-20 23:50:45 +03:00
|= {b/@ c/@}
=+ [d=1 e=c f=0]
|-
?: =(p.a f)
d
?: =(1 (cut 0 [f 1] b))
$(d (pro d e), e (pro e e), f +(f))
$(e (pro e e), f +(f))
::
++ pro :: multiply
2015-12-20 23:50:45 +03:00
|= {b/@ c/@}
2014-05-07 02:49:56 +04:00
~| [%pro-ga a]
=+ d=(~(get by q) b)
?~ d 0
=+ e=(~(get by q) c)
?~ e 0
=+ f=(~(get by p) (mod (add u.d u.e) ma))
(need f)
--
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2eX, jetted crypto ::
2014-04-11 05:05:59 +04:00
::
++ aesc :: AES-256
~% %aesc + ~
|%
++ en :: ECB enc
~/ %en
2015-12-20 23:50:45 +03:00
|= {a/@I b/@H} ^- @uxH
=+ ahem
(be & (ex a) b)
++ de :: ECB dec
~/ %de
2015-12-20 23:50:45 +03:00
|= {a/@I b/@H} ^- @uxH
=+ ahem
(be | (ix (ex a)) b)
--
++ ahem :: AES helpers
2014-04-26 00:30:09 +04:00
:: XX should be in aesc, isn't for performance reasons
=>
=+ =+ [gr=(ga 8 0x11b 3) few==>(fe .(a 5))]
=+ [pro=pro.gr dif=dif.gr pow=pow.gr ror=ror.few]
[pro=pro dif=dif pow=pow ror=ror nnk=8 nnb=4 nnr=14]
=> |%
++ cipa :: AES params
2015-12-14 10:58:14 +03:00
$_ ^? |%
2015-12-20 23:50:45 +03:00
++ co *{p/@ q/@ r/@ s/@} :: col coefs
++ ix |~(a/@ *@) :: key index
2015-12-20 23:50:45 +03:00
++ ro *{p/@ q/@ r/@ s/@} :: row shifts
++ su *@ :: s-box
--
--
|%
2014-05-01 02:54:57 +04:00
++ pen :: encrypt
^- cipa
|%
++ co [0x2 0x3 1 1]
++ ix |~(a/@ a)
++ ro [0 1 2 3]
++ su 0x16bb.54b0.0f2d.9941.6842.e6bf.0d89.a18c.
df28.55ce.e987.1e9b.948e.d969.1198.f8e1.
9e1d.c186.b957.3561.0ef6.0348.66b5.3e70.
8a8b.bd4b.1f74.dde8.c6b4.a61c.2e25.78ba.
08ae.7a65.eaf4.566c.a94e.d58d.6d37.c8e7.
79e4.9591.62ac.d3c2.5c24.0649.0a3a.32e0.
db0b.5ede.14b8.ee46.8890.2a22.dc4f.8160.
7319.5d64.3d7e.a7c4.1744.975f.ec13.0ccd.
d2f3.ff10.21da.b6bc.f538.9d92.8f40.a351.
a89f.3c50.7f02.f945.8533.4d43.fbaa.efd0.
cf58.4c4a.39be.cb6a.5bb1.fc20.ed00.d153.
842f.e329.b3d6.3b52.a05a.6e1b.1a2c.8309.
75b2.27eb.e280.1207.9a05.9618.c323.c704.
1531.d871.f1e5.a534.ccf7.3f36.2693.fdb7.
c072.a49c.afa2.d4ad.f047.59fa.7dc9.82ca.
76ab.d7fe.2b67.0130.c56f.6bf2.7b77.7c63
--
::
2014-05-01 02:54:57 +04:00
++ pin :: decrypt
^- cipa
|%
++ co [0xe 0xb 0xd 0x9]
++ ix |~(a/@ (sub nnr a))
++ ro [0 3 2 1]
++ su 0x7d0c.2155.6314.69e1.26d6.77ba.7e04.2b17.
6199.5383.3cbb.ebc8.b0f5.2aae.4d3b.e0a0.
ef9c.c993.9f7a.e52d.0d4a.b519.a97f.5160.
5fec.8027.5910.12b1.31c7.0788.33a8.dd1f.
f45a.cd78.fec0.db9a.2079.d2c6.4b3e.56fc.
1bbe.18aa.0e62.b76f.89c5.291d.711a.f147.
6edf.751c.e837.f9e2.8535.ade7.2274.ac96.
73e6.b4f0.cecf.f297.eadc.674f.4111.913a.
6b8a.1301.03bd.afc1.020f.3fca.8f1e.2cd0.
0645.b3b8.0558.e4f7.0ad3.bc8c.00ab.d890.
849d.8da7.5746.155e.dab9.edfd.5048.706c.
92b6.655d.cc5c.a4d4.1698.6886.64f6.f872.
25d1.8b6d.49a2.5b76.b224.d928.66a1.2e08.
4ec3.fa42.0b95.4cee.3d23.c2a6.3294.7b54.
cbe9.dec4.4443.8e34.87ff.2f9b.8239.e37c.
fbd7.f381.9ea3.40bf.38a5.3630.d56a.0952
--
::
++ mcol
2015-12-20 23:50:45 +03:00
|= {a/(list @) b/{p/@ q/@ r/@ s/@}} ^- (list @)
=+ c=[p=*@ q=*@ r=*@ s=*@]
2015-12-04 04:24:39 +03:00
|- ^- (list @)
?~ a ~
=> .(p.c (cut 3 [0 1] i.a))
=> .(q.c (cut 3 [1 1] i.a))
=> .(r.c (cut 3 [2 1] i.a))
=> .(s.c (cut 3 [3 1] i.a))
:_ $(a t.a)
%+ rep 3
2014-04-26 00:23:18 +04:00
%+ turn
%- limo
:~ [[p.c p.b] [q.c q.b] [r.c r.b] [s.c s.b]]
[[p.c s.b] [q.c p.b] [r.c q.b] [s.c r.b]]
[[p.c r.b] [q.c s.b] [r.c p.b] [s.c q.b]]
[[p.c q.b] [q.c r.b] [r.c s.b] [s.c p.b]]
==
2015-12-20 23:50:45 +03:00
|= {a/{@ @} b/{@ @} c/{@ @} d/{@ @}}
2014-04-26 00:23:18 +04:00
:(dif (pro a) (pro b) (pro c) (pro d))
::
++ pode :: explode to block
2015-12-20 23:50:45 +03:00
|= {a/bloq b/@ c/@} ^- (list @)
=+ d=(rip a c)
=+ m=(met a c)
|-
?: =(m b)
d
$(m +(m), d (weld d (limo [0 ~])))
++ sube :: s-box word
2015-12-20 23:50:45 +03:00
|= {a/@ b/@} ^- @
(rep 3 (turn (pode 3 4 a) |=(c/@ (cut 3 [c 1] b))))
--
|%
++ be :: block cipher
2015-12-20 23:50:45 +03:00
|= {a/? b/@ c/@H} ^- @uxH
~| %be-aesc
=> %= .
+
=> +
|%
++ ankh
2015-12-20 23:50:45 +03:00
|= {a/cipa b/@ c/@}
(pode 5 nnb (cut 5 [(mul (ix.a b) nnb) nnb] c))
++ sark
2015-12-20 23:50:45 +03:00
|= {c/(list @) d/(list @)} ^- (list @)
?~ c ~
?~ d !!
[(mix i.c i.d) $(c t.c, d t.d)]
++ srow
2015-12-20 23:50:45 +03:00
|= {a/cipa b/(list @)} ^- (list @)
=+ [c=0 d=~ e=ro.a]
|-
?: =(c nnb)
d
:_ $(c +(c))
%+ rep 3
%+ turn
(limo [0 p.e] [1 q.e] [2 r.e] [3 s.e] ~)
2015-12-20 23:50:45 +03:00
|= {f/@ g/@}
(cut 3 [f 1] (snag (mod (add g c) nnb) b))
++ subs
2015-12-20 23:50:45 +03:00
|= {a/cipa b/(list @)} ^- (list @)
?~ b ~
[(sube i.b su.a) $(b t.b)]
--
==
2014-05-01 02:54:57 +04:00
=+ [d=?:(a pen pin) e=(pode 5 nnb c) f=1]
=> .(e (sark e (ankh d 0 b)))
|-
?. =(nnr f)
=> .(e (subs d e))
=> .(e (srow d e))
=> .(e (mcol e co.d))
=> .(e (sark e (ankh d f b)))
$(f +(f))
=> .(e (subs d e))
=> .(e (srow d e))
=> .(e (sark e (ankh d nnr b)))
(rep 5 e)
2015-12-04 04:24:39 +03:00
::
++ ex :: key expand
2015-12-20 23:50:45 +03:00
|= a/@I ^- @
2014-05-01 02:54:57 +04:00
=+ [b=a c=0 d=su:pen i=nnk]
|-
?: =(i (mul nnb +(nnr)))
b
=> .(c (cut 5 [(dec i) 1] b))
=> ?: =(0 (mod i nnk))
=> .(c (ror 3 1 c))
=> .(c (sube c d))
.(c (mix c (pow (dec (div i nnk)) 2)))
?: &((gth nnk 6) =(4 (mod i nnk)))
.(c (sube c d))
.
=> .(c (mix c (cut 5 [(sub i nnk) 1] b)))
=> .(b (can 5 [i b] [1 c] ~))
$(i +(i))
2015-12-04 04:24:39 +03:00
::
++ ix :: key expand, inv
2015-12-20 23:50:45 +03:00
|= a/@ ^- @
=+ [i=1 j=*@ b=*@ c=co:pin]
|-
?: =(nnr i)
a
=> .(b (cut 7 [i 1] a))
=> .(b (rep 5 (mcol (pode 5 4 b) c)))
=> .(j (sub nnr i))
%= $
i +(i)
a
%+ can 7
:~ [i (cut 7 [0 i] a)]
[1 b]
[j (cut 7 [+(i) j] a)]
==
==
--
2014-05-09 01:43:55 +04:00
::
++ curt :: curve25519
2015-12-20 23:50:45 +03:00
|= {a/@ b/@}
2014-05-09 01:43:55 +04:00
=> %= .
+
=> +
=+ =+ [p=486.662 q=(sub (bex 255) 19)]
=+ fq=~(. fo q)
[p=p q=q fq=fq]
|%
++ cla
2015-12-20 23:50:45 +03:00
|= raw/@
2014-05-09 01:43:55 +04:00
=+ low=(dis 248 (cut 3 [0 1] raw))
=+ hih=(con 64 (dis 127 (cut 3 [31 1] raw)))
=+ mid=(cut 3 [1 30] raw)
(can 3 [[1 low] [30 mid] [1 hih] ~])
2015-12-20 23:50:45 +03:00
++ sqr |=(a/@ (mul a a))
++ inv |=(a/@ (~(exp fo q) (sub q 2) a))
2014-05-09 01:43:55 +04:00
++ cad
2015-12-20 23:50:45 +03:00
|= {n/{x/@ z/@} m/{x/@ z/@} d/{x/@ z/@}}
2014-05-09 01:43:55 +04:00
=+ ^= xx
;: mul 4 z.d
%- sqr %- abs:si
%+ dif:si
(sun:si (mul x.m x.n))
(sun:si (mul z.m z.n))
==
=+ ^= zz
;: mul 4 x.d
%- sqr %- abs:si
%+ dif:si
(sun:si (mul x.m z.n))
(sun:si (mul z.m x.n))
==
[(sit.fq xx) (sit.fq zz)]
++ cub
2015-12-20 23:50:45 +03:00
|= {x/@ z/@}
2014-05-09 01:43:55 +04:00
=+ ^= xx
%+ mul
%- sqr %- abs:si
(dif:si (sun:si x) (sun:si z))
(sqr (add x z))
=+ ^= zz
;: mul 4 x z
:(add (sqr x) :(mul p x z) (sqr z))
==
[(sit.fq xx) (sit.fq zz)]
--
==
=+ one=[b 1]
=+ i=253
=+ r=one
=+ s=(cub one)
|-
?: =(i 0)
=+ x=(cub r)
(sit.fq (mul -.x (inv +.x)))
=+ m=(rsh 0 i a)
?: =(0 (mod m 2))
$(i (dec i), s (cad r s one), r (cub r))
$(i (dec i), r (cad r s one), s (cub s))
::
++ ed :: ed25519
=>
=+ =+ [b=256 q=(sub (bex 255) 19)]
=+ fq=~(. fo q)
=+ ^= l
%+ add
(bex 252)
27.742.317.777.372.353.535.851.937.790.883.648.493
=+ d=(dif.fq 0 (fra.fq 121.665 121.666))
=+ ii=(exp.fq (div (dec q) 4) 2)
[b=b q=q fq=fq l=l d=d ii=ii]
~% %coed +> ~
|%
2015-12-20 23:50:45 +03:00
++ norm |=(x/@ ?:(=(0 (mod x 2)) x (sub q x)))
::
++ xrec :: recover x-coord
2015-12-20 23:50:45 +03:00
|= y/@ ^- @
=+ ^= xx
%+ mul (dif.fq (mul y y) 1)
(inv.fq +(:(mul d y y)))
=+ x=(exp.fq (div (add 3 q) 8) xx)
?: !=(0 (dif.fq (mul x x) (sit.fq xx)))
(norm (pro.fq x ii))
(norm x)
::
++ ward :: edwards multiply
2015-12-20 23:50:45 +03:00
|= {pp/{@ @} qq/{@ @}} ^- {@ @}
=+ dp=:(pro.fq d -.pp -.qq +.pp +.qq)
=+ ^= xt
%+ pro.fq
%+ sum.fq
(pro.fq -.pp +.qq)
(pro.fq -.qq +.pp)
(inv.fq (sum.fq 1 dp))
=+ ^= yt
%+ pro.fq
%+ sum.fq
(pro.fq +.pp +.qq)
(pro.fq -.pp -.qq)
(inv.fq (dif.fq 1 dp))
[xt yt]
::
++ scam :: scalar multiply
2015-12-20 23:50:45 +03:00
|= {pp/{@ @} e/@} ^- {@ @}
?: =(0 e)
[0 1]
=+ qq=$(e (div e 2))
=> .(qq (ward qq qq))
?: =(1 (dis 1 e))
(ward qq pp)
qq
::
++ etch :: encode point
2015-12-20 23:50:45 +03:00
|= pp/{@ @} ^- @
(can 0 ~[[(sub b 1) +.pp] [1 (dis 1 -.pp)]])
::
++ curv :: point on curve?
2015-12-20 23:50:45 +03:00
|= {x/@ y/@} ^- ?
.= 0
%+ dif.fq
%+ sum.fq
(pro.fq (sub q (sit.fq x)) x)
(pro.fq y y)
(sum.fq 1 :(pro.fq d x x y y))
::
++ deco :: decode point
2015-12-20 23:50:45 +03:00
|= s/@ ^- (unit {@ @})
=+ y=(cut 0 [0 (dec b)] s)
=+ si=(cut 0 [(dec b) 1] s)
=+ x=(xrec y)
=> .(x ?:(!=(si (dis 1 x)) (sub q x) x))
=+ pp=[x y]
?. (curv pp)
~
[~ pp]
::
++ bb
=+ bby=(pro.fq 4 (inv.fq 5))
2015-12-04 04:24:39 +03:00
[(xrec bby) bby]
::
--
~% %ed + ~
2014-04-11 05:05:59 +04:00
|%
++ puck :: public key
~/ %puck
2015-12-20 23:50:45 +03:00
|= sk/@I ^- @
?: (gth (met 3 sk) 32) !!
2014-04-11 05:05:59 +04:00
=+ h=(shal (rsh 0 3 b) sk)
=+ ^= a
%+ add
(bex (sub b 2))
(lsh 0 3 (cut 0 [3 (sub b 5)] h))
=+ aa=(scam bb a)
(etch aa)
++ suck :: keypair from seed
2015-12-20 23:50:45 +03:00
|= se/@I ^- @uJ
2014-04-17 07:15:49 +04:00
=+ pu=(puck se)
(can 0 ~[[b se] [b pu]])
2014-04-11 05:05:59 +04:00
::
++ sign :: certify
~/ %sign
2015-12-20 23:50:45 +03:00
|= {m/@ se/@} ^- @
2014-04-17 07:15:49 +04:00
=+ sk=(suck se)
=+ pk=(cut 0 [b b] sk)
2014-04-11 05:05:59 +04:00
=+ h=(shal (rsh 0 3 b) sk)
=+ ^= a
%+ add
(bex (sub b 2))
(lsh 0 3 (cut 0 [3 (sub b 5)] h))
=+ ^= r
=+ hm=(cut 0 [b b] h)
=+ ^= i
%+ can 0
:~ [b hm]
[(met 0 m) m]
==
(shaz i)
=+ rr=(scam bb r)
=+ ^= ss
=+ er=(etch rr)
=+ ^= ha
%+ can 0
:~ [b er]
[b pk]
[(met 0 m) m]
==
(~(sit fo l) (add r (mul (shaz ha) a)))
(can 0 ~[[b (etch rr)] [b ss]])
::
++ veri :: validate
2014-04-13 06:59:02 +04:00
~/ %veri
2015-12-20 23:50:45 +03:00
|= {s/@ m/@ pk/@} ^- ?
2014-04-11 05:05:59 +04:00
?: (gth (div b 4) (met 3 s)) |
?: (gth (div b 8) (met 3 pk)) |
2014-04-30 23:59:36 +04:00
=+ cb=(rsh 0 3 b)
2014-04-11 05:05:59 +04:00
=+ rr=(deco (cut 0 [0 b] s))
?~ rr |
=+ aa=(deco pk)
?~ aa |
=+ ss=(cut 0 [b b] s)
2014-04-30 23:59:36 +04:00
=+ ha=(can 3 ~[[cb (etch u.rr)] [cb pk] [(met 3 m) m]])
2014-04-11 05:05:59 +04:00
=+ h=(shaz ha)
=((scam bb ss) (ward u.rr (scam u.aa h)))
::
--
2015-05-04 02:31:45 +03:00
::
++ scr :: scrypt
~% %scr + ~
|%
++ sal
2015-12-20 23:50:45 +03:00
|= {x/@ r/@} :: salsa20 hash
?> =((mod r 2) 0) :: with r rounds
=+ few==>(fe .(a 5))
=+ ^= rot
2015-12-20 23:50:45 +03:00
|= {a/@ b/@}
(mix (end 5 1 (lsh 0 a b)) (rsh 0 (sub 32 a) b))
=+ ^= lea
2015-12-20 23:50:45 +03:00
|= {a/@ b/@}
(net:few (sum:few (net:few a) (net:few b)))
=> |%
++ qr :: quarterround
2015-12-20 23:50:45 +03:00
|= y/{@ @ @ @ $~}
=+ zb=(mix &2.y (rot 7 (sum:few &1.y &4.y)))
=+ zc=(mix &3.y (rot 9 (sum:few zb &1.y)))
=+ zd=(mix &4.y (rot 13 (sum:few zc zb)))
=+ za=(mix &1.y (rot 18 (sum:few zd zc)))
~[za zb zc zd]
++ rr :: rowround
2015-12-20 23:50:45 +03:00
|= {y/(list @)}
=+ za=(qr ~[&1.y &2.y &3.y &4.y])
=+ zb=(qr ~[&6.y &7.y &8.y &5.y])
=+ zc=(qr ~[&11.y &12.y &9.y &10.y])
=+ zd=(qr ~[&16.y &13.y &14.y &15.y])
2015-12-04 04:24:39 +03:00
^- (list @) :~
&1.za &2.za &3.za &4.za
&4.zb &1.zb &2.zb &3.zb
&3.zc &4.zc &1.zc &2.zc
&2.zd &3.zd &4.zd &1.zd ==
++ cr :: columnround
2015-12-20 23:50:45 +03:00
|= {x/(list @)}
=+ ya=(qr ~[&1.x &5.x &9.x &13.x])
=+ yb=(qr ~[&6.x &10.x &14.x &2.x])
=+ yc=(qr ~[&11.x &15.x &3.x &7.x])
=+ yd=(qr ~[&16.x &4.x &8.x &12.x])
2015-12-04 04:24:39 +03:00
^- (list @) :~
&1.ya &4.yb &3.yc &2.yd
&2.ya &1.yb &4.yc &3.yd
&3.ya &2.yb &1.yc &4.yd
&4.ya &3.yb &2.yc &1.yd ==
++ dr :: doubleround
2015-12-20 23:50:45 +03:00
|= {x/(list @)}
(rr (cr x))
++ al :: add two lists
2015-12-20 23:50:45 +03:00
|= {a/(list @) b/(list @)}
2015-12-04 04:24:39 +03:00
|- ^- (list @)
?~ a ~ ?~ b ~
[i=(sum:few -.a -.b) t=$(a +.a, b +.b)]
--
=+ xw=(rpp 5 16 x)
2015-12-04 18:16:34 +03:00
=+ ^= ow |- ^- (list @)
?~ r xw
$(xw (dr xw), r (sub r 2))
(rep 5 (al xw ow))
2015-05-04 02:31:45 +03:00
::
++ rpp
2015-12-21 00:16:39 +03:00
|= {a/bloq b/@ c/@} :: rip w+filler blocks
=+ q=(rip a c)
=+ w=(lent q)
?. =(w b)
?. (lth w b) (slag (sub w b) q)
^+ q (weld q (reap (sub b (lent q)) 0))
q
2015-05-04 02:31:45 +03:00
::
++ bls
2015-12-20 23:50:45 +03:00
|= {a/@ b/(list @)} :: split to sublists
?> =((mod (lent b) a) 0)
2015-12-04 18:16:34 +03:00
|- ^- (list (list @))
?~ b ~
2015-12-04 18:16:34 +03:00
[i=(scag a `(list @)`b) t=$(b (slag a `(list @)`b))]
2015-05-04 02:31:45 +03:00
::
++ slb
2015-12-20 23:50:45 +03:00
|= {a/(list (list @))}
2015-12-04 04:24:39 +03:00
|- ^- (list @)
?~ a ~
2015-12-04 18:16:34 +03:00
(weld `(list @)`-.a $(a +.a))
2015-05-04 02:31:45 +03:00
::
++ sbm
2015-12-20 23:50:45 +03:00
|= {r/@ b/(list @)} :: scryptBlockMix
?> =((lent b) (mul 2 r))
=+ [x=(snag (dec (mul 2 r)) b) c=0]
2015-12-20 23:50:45 +03:00
=| {ya/(list @) yb/(list @)}
2015-12-04 04:24:39 +03:00
|- ^- (list @)
?~ b (flop (weld yb ya))
=. x (sal (mix x -.b) 8)
?~ (mod c 2)
$(c +(c), b +.b, ya [i=x t=ya])
$(c +(c), b +.b, yb [i=x t=yb])
2015-05-04 02:31:45 +03:00
::
++ srm
2015-12-20 23:50:45 +03:00
|= {r/@ b/(list @) n/@} :: scryptROMix
2015-06-26 22:27:46 +03:00
?> ?& =((lent b) (mul 2 r))
=(n (bex (dec (xeb n))))
(lth n (bex (mul r 16)))
==
2015-12-04 04:24:39 +03:00
=+ [v=*(list (list @)) c=0]
=. v
2015-12-04 04:24:39 +03:00
|- ^- (list (list @))
=+ w=(sbm r b)
?: =(c n) (flop v)
$(c +(c), v [i=[b] t=v], b w)
=+ x=(sbm r (snag (dec n) v))
2015-12-04 04:24:39 +03:00
|- ^- (list @)
?: =(c n) x
=+ q=(snag (dec (mul r 2)) x)
2015-12-04 04:24:39 +03:00
=+ z=`(list @)`(snag (mod q n) v)
2015-12-04 18:16:34 +03:00
=+ ^= w |- ^- (list @)
?~ x ~ ?~ z ~
[i=(mix -.x -.z) t=$(x +.x, z +.z)]
$(x (sbm r w), c +(c))
2015-05-04 02:31:45 +03:00
::
++ hmc
2015-12-20 23:50:45 +03:00
|= {k/@ t/@} :: HMAC-SHA-256
(hml k (met 3 k) t (met 3 t))
2015-05-04 02:31:45 +03:00
::
++ hml
2015-12-21 00:16:39 +03:00
|= {k/@ kl/@ t/@ tl/@} :: w+length
=> .(k (end 3 kl k), t (end 3 tl t))
=+ b=64
=. k ?. (gth kl b) k (shay kl k)
=+ ^= q %+ shay (add b tl)
(add (lsh 3 b t) (mix k (fil 3 b 0x36)))
%+ shay (add b 32)
(add (lsh 3 b q) (mix k (fil 3 b 0x5c)))
2015-05-04 02:31:45 +03:00
::
2015-08-04 06:00:09 +03:00
++ pbk :: PBKDF2-HMAC-SHA256
~/ %pbk
2015-12-20 23:50:45 +03:00
|= {p/@ s/@ c/@ d/@}
(pbl p (met 3 p) s (met 3 s) c d)
2015-05-04 02:31:45 +03:00
::
2015-12-21 00:16:39 +03:00
++ pbl :: w+length
2015-08-04 06:00:09 +03:00
~/ %pbl
2015-12-20 23:50:45 +03:00
|= {p/@ pl/@ s/@ sl/@ c/@ d/@}
=> .(p (end 3 pl p), s (end 3 sl s))
=+ h=32
?> ?& (lte d (bex 30)) :: max key length 1GB
(lte c (bex 28)) :: max iterations 2^28
!=(c 0)
==
=+ ^= l ?~ (mod d h)
2015-07-31 05:01:20 +03:00
(div d h)
+((div d h))
=+ r=(sub d (mul h (dec l)))
=+ [t=0 j=1 k=1]
=. t |- ^- @
?: (gth j l) t
=+ u=(add s (lsh 3 sl (rep 3 (flop (rpp 3 4 j)))))
=+ f=0 =. f |- ^- @
2015-06-26 22:27:46 +03:00
?: (gth k c) f
=+ q=(hml p pl u ?:(=(k 1) (add sl 4) h))
$(u q, f (mix f q), k +(k))
$(t (add t (lsh 3 (mul (dec j) h) f)), j +(j))
(end 3 d t)
2015-05-04 02:31:45 +03:00
::
2015-08-04 06:00:09 +03:00
++ hsh :: scrypt
~/ %hsh
2015-12-20 23:50:45 +03:00
|= {p/@ s/@ n/@ r/@ z/@ d/@}
(hsl p (met 3 p) s (met 3 s) n r z d)
2015-05-04 02:31:45 +03:00
::
2015-12-21 00:16:39 +03:00
++ hsl :: w+length
2015-08-04 06:00:09 +03:00
~/ %hsl
2015-12-20 23:50:45 +03:00
|= {p/@ pl/@ s/@ sl/@ n/@ r/@ z/@ d/@}
=| v/(list (list @))
=> .(p (end 3 pl p), s (end 3 sl s))
=+ u=(mul (mul 128 r) z)
?> ?& =(n (bex (dec (xeb n)))) :: n is power of 2
!=(r 0) !=(z 0)
%+ lte :: max 1GB memory
(mul (mul 128 r) (dec (add n z)))
(bex 30)
(lth pl (bex 31))
(lth sl (bex 31))
==
=+ ^= b =+ (rpp 3 u (pbl p pl s sl 1 u))
%+ turn (bls (mul 128 r) -)
2015-12-20 23:50:45 +03:00
|=(a/(list @) (rpp 9 (mul 2 r) (rep 3 a)))
?> =((lent b) z)
=+ ^= q
=+ |- ?~ b (flop v)
$(b +.b, v [i=(srm r -.b n) t=v])
2015-12-04 18:16:34 +03:00
%+ turn `(list (list @))`-
2015-12-20 23:50:45 +03:00
|=(a/(list @) (rpp 3 (mul 128 r) (rep 9 a)))
(pbl p pl (rep 3 (slb q)) u 1 d)
2015-05-04 02:31:45 +03:00
--
2014-04-11 05:05:59 +04:00
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2013-09-29 00:21:18 +04:00
:: section 2eY, SHA-256 (move me) ::
::
2015-12-20 23:50:45 +03:00
++ shad |=(ruz/@ (shax (shax ruz))) :: double sha-256
2013-09-29 00:21:18 +04:00
++ shaf :: half sha-256
2015-12-20 23:50:45 +03:00
|= {sal/@ ruz/@}
2013-09-29 00:21:18 +04:00
=+ haz=(shas sal ruz)
(mix (end 7 1 haz) (rsh 7 1 haz))
::
++ shak :: XX shd be PBKDF
2015-12-20 23:50:45 +03:00
|= {who/@p wud/@}
2013-09-29 00:21:18 +04:00
(shas (mix %shak who) wud)
::
2014-10-22 00:53:27 +04:00
++ sham :: 128bit noun hash
2015-12-20 23:50:45 +03:00
|= yux/* ^- @uvH ^- @
2013-09-29 00:21:18 +04:00
?@ yux
(shaf %mash yux)
(shaf %sham (jam yux))
::
++ shas :: salted hash
2015-12-20 23:50:45 +03:00
|= {sal/@ ruz/@}
2013-09-29 00:21:18 +04:00
(shax (mix sal (shax ruz)))
::
++ shax :: sha-256
~/ %shax
2015-12-20 23:50:45 +03:00
|= ruz/@ ^- @
2015-02-25 05:08:20 +03:00
(shay [(met 3 ruz) ruz])
::
++ shay :: sha-256 with length
~/ %shay
2015-12-20 23:50:45 +03:00
|= {len/@u ruz/@} ^- @
2013-09-29 00:21:18 +04:00
~| %sha
2015-02-25 05:08:20 +03:00
=> .(ruz (cut 3 [0 len] ruz))
2015-12-20 23:50:45 +03:00
=+ [few==>(fe .(a 5)) wac=|=({a/@ b/@} (cut 5 [a 1] b))]
2013-09-29 00:21:18 +04:00
=+ [sum=sum.few ror=ror.few net=net.few inv=inv.few]
2015-02-25 05:08:20 +03:00
=+ ral=(lsh 0 3 len)
2013-09-29 00:21:18 +04:00
=+ ^= ful
%+ can 0
:~ [ral ruz]
[8 128]
[(mod (sub 960 (mod (add 8 ral) 512)) 512) 0]
[64 (~(net fe 6) ral)]
==
=+ lex=(met 9 ful)
=+ ^= kbx 0xc671.78f2.bef9.a3f7.a450.6ceb.90be.fffa.
8cc7.0208.84c8.7814.78a5.636f.748f.82ee.
682e.6ff3.5b9c.ca4f.4ed8.aa4a.391c.0cb3.
34b0.bcb5.2748.774c.1e37.6c08.19a4.c116.
106a.a070.f40e.3585.d699.0624.d192.e819.
c76c.51a3.c24b.8b70.a81a.664b.a2bf.e8a1.
9272.2c85.81c2.c92e.766a.0abb.650a.7354.
5338.0d13.4d2c.6dfc.2e1b.2138.27b7.0a85.
1429.2967.06ca.6351.d5a7.9147.c6e0.0bf3.
bf59.7fc7.b003.27c8.a831.c66d.983e.5152.
76f9.88da.5cb0.a9dc.4a74.84aa.2de9.2c6f.
240c.a1cc.0fc1.9dc6.efbe.4786.e49b.69c1.
c19b.f174.9bdc.06a7.80de.b1fe.72be.5d74.
550c.7dc3.2431.85be.1283.5b01.d807.aa98.
ab1c.5ed5.923f.82a4.59f1.11f1.3956.c25b.
e9b5.dba5.b5c0.fbcf.7137.4491.428a.2f98
=+ ^= hax 0x5be0.cd19.1f83.d9ab.9b05.688c.510e.527f.
a54f.f53a.3c6e.f372.bb67.ae85.6a09.e667
=+ i=0
|- ^- @
?: =(i lex)
(rep 5 (turn (rip 5 hax) net))
=+ ^= wox
=+ dux=(cut 9 [i 1] ful)
=+ wox=(rep 5 (turn (rip 5 dux) net))
=+ j=16
|- ^- @
?: =(64 j)
wox
2013-09-29 00:21:18 +04:00
=+ :* l=(wac (sub j 15) wox)
m=(wac (sub j 2) wox)
n=(wac (sub j 16) wox)
o=(wac (sub j 7) wox)
==
2014-01-25 02:08:37 +04:00
=+ x=:(mix (ror 0 7 l) (ror 0 18 l) (rsh 0 3 l))
=+ y=:(mix (ror 0 17 m) (ror 0 19 m) (rsh 0 10 m))
2013-09-29 00:21:18 +04:00
=+ z=:(sum n x o y)
$(wox (con (lsh 5 j z) wox), j +(j))
=+ j=0
=+ :* a=(wac 0 hax)
b=(wac 1 hax)
c=(wac 2 hax)
d=(wac 3 hax)
e=(wac 4 hax)
f=(wac 5 hax)
g=(wac 6 hax)
h=(wac 7 hax)
==
|- ^- @
?: =(64 j)
%= ^$
i +(i)
hax %+ rep 5
:~ (sum a (wac 0 hax))
(sum b (wac 1 hax))
(sum c (wac 2 hax))
(sum d (wac 3 hax))
(sum e (wac 4 hax))
(sum f (wac 5 hax))
(sum g (wac 6 hax))
(sum h (wac 7 hax))
==
==
2014-01-25 02:08:37 +04:00
=+ l=:(mix (ror 0 2 a) (ror 0 13 a) (ror 0 22 a)) :: s0
2013-09-29 00:21:18 +04:00
=+ m=:(mix (dis a b) (dis a c) (dis b c)) :: maj
=+ n=(sum l m) :: t2
2014-01-25 02:08:37 +04:00
=+ o=:(mix (ror 0 6 e) (ror 0 11 e) (ror 0 25 e)) :: s1
2013-09-29 00:21:18 +04:00
=+ p=(mix (dis e f) (dis (inv e) g)) :: ch
=+ q=:(sum h o p (wac j kbx) (wac j wox)) :: t1
$(j +(j), a (sum q n), b a, c b, d c, e (sum d q), f e, g f, h g)
::
++ shaw :: hash to nbits
2015-12-20 23:50:45 +03:00
|= {sal/@ len/@ ruz/@}
2013-09-29 00:21:18 +04:00
(~(raw og (shas sal (mix len ruz))) len)
::
++ og :: shax-powered rng
~/ %og
2015-12-20 23:50:45 +03:00
|_ a/@
2013-09-29 00:21:18 +04:00
++ rad :: random in range
2015-12-20 23:50:45 +03:00
|= b/@ ^- @
=+ c=(raw (met 0 b))
2013-09-29 00:21:18 +04:00
?:((lth c b) c $(a +(a)))
2015-12-04 04:24:39 +03:00
::
++ rads :: random continuation
2015-12-20 23:50:45 +03:00
|= b/@
=+ r=(rad b)
[r +>.$(a (shas %og-s r))]
2015-12-04 04:24:39 +03:00
::
2013-09-29 00:21:18 +04:00
++ raw :: random bits
~/ %raw
2015-12-20 23:50:45 +03:00
|= b/@ ^- @
2013-09-29 00:21:18 +04:00
%+ can
0
=+ c=(shas %og-a (mix b a))
2015-12-04 04:24:39 +03:00
|- ^- (list {@ @})
2013-09-29 00:21:18 +04:00
?: =(0 b)
~
=+ d=(shas %og-b (mix b (mix a c)))
?: (lth b 256)
[[b (end 0 b d)] ~]
[[256 d] $(c d, b (sub b 256))]
2015-12-04 04:24:39 +03:00
::
++ raws :: random bits
2015-12-20 23:50:45 +03:00
|= b/@ :: continuation
=+ r=(raw b)
[r +>.$(a (shas %og-s r))]
2013-09-29 00:21:18 +04:00
--
2014-01-21 06:07:11 +04:00
++ shaz :: sha-512
2015-12-20 23:50:45 +03:00
|= ruz/@ ^- @
(shal [(met 3 ruz) ruz])
2015-12-04 04:24:39 +03:00
::
++ shal :: sha-512 with length
~/ %shal
2015-12-20 23:50:45 +03:00
|= {len/@ ruz/@} ^- @
2014-01-22 03:37:46 +04:00
=> .(ruz (cut 3 [0 len] ruz))
2015-12-20 23:50:45 +03:00
=+ [few==>(fe .(a 6)) wac=|=({a/@ b/@} (cut 6 [a 1] b))]
2014-01-21 06:07:11 +04:00
=+ [sum=sum.few ror=ror.few net=net.few inv=inv.few]
=+ ral=(lsh 0 3 len)
2014-01-21 06:07:11 +04:00
=+ ^= ful
%+ can 0
:~ [ral ruz]
[8 128]
[(mod (sub 1.920 (mod (add 8 ral) 1.024)) 1.024) 0]
[128 (~(net fe 7) ral)]
==
=+ lex=(met 10 ful)
=+ ^= kbx 0x6c44.198c.4a47.5817.5fcb.6fab.3ad6.faec.
597f.299c.fc65.7e2a.4cc5.d4be.cb3e.42b6.
431d.67c4.9c10.0d4c.3c9e.be0a.15c9.bebc.
32ca.ab7b.40c7.2493.28db.77f5.2304.7d84.
1b71.0b35.131c.471b.113f.9804.bef9.0dae.
0a63.7dc5.a2c8.98a6.06f0.67aa.7217.6fba.
f57d.4f7f.ee6e.d178.eada.7dd6.cde0.eb1e.
d186.b8c7.21c0.c207.ca27.3ece.ea26.619c.
c671.78f2.e372.532b.bef9.a3f7.b2c6.7915.
a450.6ceb.de82.bde9.90be.fffa.2363.1e28.
8cc7.0208.1a64.39ec.84c8.7814.a1f0.ab72.
78a5.636f.4317.2f60.748f.82ee.5def.b2fc.
682e.6ff3.d6b2.b8a3.5b9c.ca4f.7763.e373.
4ed8.aa4a.e341.8acb.391c.0cb3.c5c9.5a63.
34b0.bcb5.e19b.48a8.2748.774c.df8e.eb99.
1e37.6c08.5141.ab53.19a4.c116.b8d2.d0c8.
106a.a070.32bb.d1b8.f40e.3585.5771.202a.
d699.0624.5565.a910.d192.e819.d6ef.5218.
c76c.51a3.0654.be30.c24b.8b70.d0f8.9791.
a81a.664b.bc42.3001.a2bf.e8a1.4cf1.0364.
9272.2c85.1482.353b.81c2.c92e.47ed.aee6.
766a.0abb.3c77.b2a8.650a.7354.8baf.63de.
5338.0d13.9d95.b3df.4d2c.6dfc.5ac4.2aed.
2e1b.2138.5c26.c926.27b7.0a85.46d2.2ffc.
1429.2967.0a0e.6e70.06ca.6351.e003.826f.
d5a7.9147.930a.a725.c6e0.0bf3.3da8.8fc2.
bf59.7fc7.beef.0ee4.b003.27c8.98fb.213f.
a831.c66d.2db4.3210.983e.5152.ee66.dfab.
76f9.88da.8311.53b5.5cb0.a9dc.bd41.fbd4.
4a74.84aa.6ea6.e483.2de9.2c6f.592b.0275.
240c.a1cc.77ac.9c65.0fc1.9dc6.8b8c.d5b5.
efbe.4786.384f.25e3.e49b.69c1.9ef1.4ad2.
c19b.f174.cf69.2694.9bdc.06a7.25c7.1235.
80de.b1fe.3b16.96b1.72be.5d74.f27b.896f.
550c.7dc3.d5ff.b4e2.2431.85be.4ee4.b28c.
1283.5b01.4570.6fbe.d807.aa98.a303.0242.
ab1c.5ed5.da6d.8118.923f.82a4.af19.4f9b.
59f1.11f1.b605.d019.3956.c25b.f348.b538.
e9b5.dba5.8189.dbbc.b5c0.fbcf.ec4d.3b2f.
7137.4491.23ef.65cd.428a.2f98.d728.ae22
=+ ^= hax 0x5be0.cd19.137e.2179.1f83.d9ab.fb41.bd6b.
9b05.688c.2b3e.6c1f.510e.527f.ade6.82d1.
a54f.f53a.5f1d.36f1.3c6e.f372.fe94.f82b.
bb67.ae85.84ca.a73b.6a09.e667.f3bc.c908
=+ i=0
|- ^- @
?: =(i lex)
(rep 6 (turn (rip 6 hax) net))
=+ ^= wox
=+ dux=(cut 10 [i 1] ful)
=+ wox=(rep 6 (turn (rip 6 dux) net))
=+ j=16
|- ^- @
?: =(80 j)
wox
=+ :* l=(wac (sub j 15) wox)
m=(wac (sub j 2) wox)
n=(wac (sub j 16) wox)
o=(wac (sub j 7) wox)
==
2014-01-25 02:08:37 +04:00
=+ x=:(mix (ror 0 1 l) (ror 0 8 l) (rsh 0 7 l))
=+ y=:(mix (ror 0 19 m) (ror 0 61 m) (rsh 0 6 m))
2014-01-21 06:07:11 +04:00
=+ z=:(sum n x o y)
$(wox (con (lsh 6 j z) wox), j +(j))
=+ j=0
=+ :* a=(wac 0 hax)
b=(wac 1 hax)
c=(wac 2 hax)
d=(wac 3 hax)
e=(wac 4 hax)
f=(wac 5 hax)
g=(wac 6 hax)
h=(wac 7 hax)
==
|- ^- @
?: =(80 j)
%= ^$
i +(i)
hax %+ rep 6
:~ (sum a (wac 0 hax))
(sum b (wac 1 hax))
(sum c (wac 2 hax))
(sum d (wac 3 hax))
(sum e (wac 4 hax))
(sum f (wac 5 hax))
(sum g (wac 6 hax))
(sum h (wac 7 hax))
==
==
2014-01-25 02:08:37 +04:00
=+ l=:(mix (ror 0 28 a) (ror 0 34 a) (ror 0 39 a)) :: S0
2014-01-21 06:07:11 +04:00
=+ m=:(mix (dis a b) (dis a c) (dis b c)) :: maj
=+ n=(sum l m) :: t2
2014-01-25 02:08:37 +04:00
=+ o=:(mix (ror 0 14 e) (ror 0 18 e) (ror 0 41 e)) :: S1
2014-01-21 06:07:11 +04:00
=+ p=(mix (dis e f) (dis (inv e) g)) :: ch
=+ q=:(sum h o p (wac j kbx) (wac j wox)) :: t1
$(j +(j), a (sum q n), b a, c b, d c, e (sum d q), f e, g f, h g)
::
++ shan :: sha-1 (deprecated)
2015-12-20 23:50:45 +03:00
|= ruz/@
=+ [few==>(fe .(a 5)) wac=|=({a/@ b/@} (cut 5 [a 1] b))]
=+ [sum=sum.few ror=ror.few rol=rol.few net=net.few inv=inv.few]
=+ ral=(lsh 0 3 (met 3 ruz))
=+ ^= ful
%+ can 0
:~ [ral ruz]
[8 128]
[(mod (sub 960 (mod (add 8 ral) 512)) 512) 0]
[64 (~(net fe 6) ral)]
==
=+ lex=(met 9 ful)
=+ kbx=0xca62.c1d6.8f1b.bcdc.6ed9.eba1.5a82.7999
=+ hax=0xc3d2.e1f0.1032.5476.98ba.dcfe.efcd.ab89.6745.2301
=+ i=0
|-
?: =(i lex)
2014-04-30 08:35:21 +04:00
(rep 5 (flop (rip 5 hax)))
=+ ^= wox
=+ dux=(cut 9 [i 1] ful)
=+ wox=(rep 5 (turn (rip 5 dux) net))
=+ j=16
|- ^- @
?: =(80 j)
wox
=+ :* l=(wac (sub j 3) wox)
m=(wac (sub j 8) wox)
n=(wac (sub j 14) wox)
o=(wac (sub j 16) wox)
==
=+ z=(rol 0 1 :(mix l m n o))
$(wox (con (lsh 5 j z) wox), j +(j))
=+ j=0
=+ :* a=(wac 0 hax)
b=(wac 1 hax)
c=(wac 2 hax)
d=(wac 3 hax)
e=(wac 4 hax)
==
|- ^- @
?: =(80 j)
%= ^$
i +(i)
hax %+ rep 5
2014-04-30 09:05:57 +04:00
:~
(sum a (wac 0 hax))
2014-04-30 08:35:21 +04:00
(sum b (wac 1 hax))
(sum c (wac 2 hax))
(sum d (wac 3 hax))
(sum e (wac 4 hax))
==
==
=+ fx=(con (dis b c) (dis (not 5 1 b) d))
=+ fy=:(mix b c d)
=+ fz=:(con (dis b c) (dis b d) (dis c d))
=+ ^= tem
?: &((gte j 0) (lte j 19))
:(sum (rol 0 5 a) fx e (wac 0 kbx) (wac j wox))
?: &((gte j 20) (lte j 39))
:(sum (rol 0 5 a) fy e (wac 1 kbx) (wac j wox))
?: &((gte j 40) (lte j 59))
:(sum (rol 0 5 a) fz e (wac 2 kbx) (wac j wox))
:(sum (rol 0 5 a) fy e (wac 3 kbx) (wac j wox))
$(j +(j), a tem, b a, c (rol 0 30 b), d c, e d)
::
2013-09-29 00:21:18 +04:00
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2eZ, OLD rendering (kill me) ::
::
2015-12-26 13:07:50 +03:00
++ show :: XX deprecated, use span
2015-12-20 23:50:45 +03:00
|= vem/*
2013-09-29 00:21:18 +04:00
|^ ^- tank
?: ?=(@ vem)
[%leaf (mesc (trip vem))]
?- vem
2015-12-20 23:50:45 +03:00
{s/$~ c/*}
2013-09-29 00:21:18 +04:00
[%leaf '\'' (weld (mesc (tape +.vem)) `tape`['\'' ~])]
::
2015-12-20 23:50:45 +03:00
{s/$a c/@} [%leaf (mesc (trip c.vem))]
{s/$b c/*} (shop c.vem |=(a/@ ~(rub at a)))
{s/{$c p/@} c/*}
2013-09-29 00:21:18 +04:00
:+ %palm
[['.' ~] ['-' ~] ~ ~]
[[%leaf (mesc (trip p.s.vem))] $(vem c.vem) ~]
::
2015-12-20 23:50:45 +03:00
{s/$d c/*} (shop c.vem |=(a/@ ~(rud at a)))
{s/$k c/*} (tank c.vem)
{s/$h c/*}
2013-09-29 00:21:18 +04:00
?: =(0 c.vem) :: XX remove after 220
[%leaf '#' ~]
:+ %rose
[['/' ~] ['/' ~] ~]
2015-12-04 18:16:34 +03:00
=+ yol=((list @ta) c.vem)
2015-12-20 23:50:45 +03:00
(turn yol |=(a/@ta [%leaf (trip a)]))
2013-09-29 00:21:18 +04:00
::
2015-12-20 23:50:45 +03:00
{s/$o c/*}
2013-09-29 00:21:18 +04:00
%= $
vem
:- [%m '%h:<[%d %d].[%d %d]>']
2013-09-29 00:21:18 +04:00
[-.c.vem +<-.c.vem +<+.c.vem +>-.c.vem +>+.c.vem ~]
==
::
2015-12-20 23:50:45 +03:00
{s/$p c/*} (shop c.vem |=(a/@ ~(rup at a)))
{s/$q c/*} (shop c.vem |=(a/@ ~(r at a)))
{s/$r c/*} $(vem [[%r ' ' '{' '}'] c.vem])
{s/$t c/*} (shop c.vem |=(a/@ ~(rt at a)))
{s/$v c/*} (shop c.vem |=(a/@ ~(ruv at a)))
{s/$x c/*} (shop c.vem |=(a/@ ~(rux at a)))
{s/{$m p/@} c/*} (shep p.s.vem c.vem)
{s/{$r p/@} c/*}
2013-09-29 00:21:18 +04:00
$(vem [[%r ' ' (cut 3 [0 1] p.s.vem) (cut 3 [1 1] p.s.vem)] c.vem])
::
2015-12-20 23:50:45 +03:00
{s/{$r p/@ q/@ r/@} c/*}
2013-09-29 00:21:18 +04:00
:+ %rose
:* p=(mesc (trip p.s.vem))
q=(mesc (trip q.s.vem))
r=(mesc (trip r.s.vem))
==
|- ^- (list tank)
?@ c.vem
~
[^$(vem -.c.vem) $(c.vem +.c.vem)]
::
2015-12-20 23:50:45 +03:00
{s/$z c/*} $(vem [[%r %$ %$ %$] c.vem])
2013-09-29 00:21:18 +04:00
* !!
==
++ shep
2015-12-20 23:50:45 +03:00
|= {fom/@ gar/*}
2013-09-29 00:21:18 +04:00
^- tank
=+ l=(met 3 fom)
=+ i=0
:- %leaf
|- ^- tape
?: (gte i l)
~
=+ c=(cut 3 [i 1] fom)
?. =(37 c)
(weld (mesc [c ~]) $(i +(i)))
=+ d=(cut 3 [+(i) 1] fom)
?. .?(gar)
['\\' '#' $(i (add 2 i))]
(weld ~(ram re (show d -.gar)) $(i (add 2 i), gar +.gar))
::
++ shop
2015-12-20 23:50:45 +03:00
|= {aug/* vel/$+(a/@ tape)}
2013-09-29 00:21:18 +04:00
^- tank
?: ?=(@ aug)
[%leaf (vel aug)]
:+ %rose
2013-09-29 00:21:18 +04:00
[[' ' ~] ['[' ~] [']' ~]]
=> .(aug `*`aug)
|- ^- (list tank)
?: ?=(@ aug)
[^$ ~]
[^$(aug -.aug) $(aug +.aug)]
--
++ at
2015-12-20 23:50:45 +03:00
|_ a/@
2013-09-29 00:21:18 +04:00
++ r
?: ?& (gte (met 3 a) 2)
|-
?: =(0 a)
&
=+ vis=(end 3 1 a)
?& ?|(=('-' vis) ?&((gte vis 'a') (lte vis 'z')))
2013-09-29 00:21:18 +04:00
$(a (rsh 3 1 a))
==
==
rtam
?: (lte (met 3 a) 2)
rud
rux
::
2015-12-08 05:04:19 +03:00
++ rf `tape`[?-(a $& '&', $| '|', * !!) ~]
2013-09-29 00:21:18 +04:00
++ rn `tape`[?>(=(0 a) '~') ~]
++ rt `tape`['\'' (weld (mesc (trip a)) `tape`['\'' ~])]
++ rta rt
++ rtam `tape`['%' (trip a)]
2015-12-20 23:50:45 +03:00
++ rub `tape`['0' 'b' (rum 2 ~ |=(b/@ (add '0' b)))]
++ rud (rum 10 ~ |=(b/@ (add '0' b)))
2013-09-29 00:21:18 +04:00
++ rum
2015-12-20 23:50:45 +03:00
|= {b/@ c/tape d/$+(@ @)}
2013-09-29 00:21:18 +04:00
^- tape
?: =(0 a)
[(d 0) c]
=+ e=0
|- ^- tape
?: =(0 a)
2013-09-29 00:21:18 +04:00
c
=+ f=&(!=(0 e) =(0 (mod e ?:(=(10 b) 3 4))))
%= $
a (div a b)
c [(d (mod a b)) ?:(f [?:(=(10 b) ',' '-') c] c)]
e +(e)
==
::
++ rup
=+ b=(met 3 a)
^- tape
:- '-'
|- ^- tape
?: (gth (met 5 a) 1)
%+ weld
$(a (rsh 5 1 a), b (sub b 4))
2013-09-29 00:21:18 +04:00
`tape`['-' '-' $(a (end 5 1 a), b 4)]
?: =(0 b)
['~' ~]
?: (lte b 1)
(trip (tos:po a))
|- ^- tape
?: =(2 b)
=+ c=(rsh 3 1 a)
=+ d=(end 3 1 a)
(weld (trip (tod:po c)) (trip (tos:po (mix c d))))
=+ c=(rsh 3 2 a)
=+ d=(end 3 2 a)
(weld ^$(a c, b (met 3 c)) `tape`['-' $(a (mix c d), b 2)])
::
++ ruv
^- tape
:+ '0'
'v'
%^ rum
64
~
2015-12-20 23:50:45 +03:00
|= b/@
2013-09-29 00:21:18 +04:00
?: =(63 b)
'+'
?: =(62 b)
2013-09-29 00:21:18 +04:00
'-'
?:((lth b 26) (add 65 b) ?:((lth b 52) (add 71 b) (sub b 4)))
::
2015-12-20 23:50:45 +03:00
++ rux `tape`['0' 'x' (rum 16 ~ |=(b/@ (add b ?:((lth b 10) 48 87))))]
2013-09-29 00:21:18 +04:00
--
:::::::::::::::::::::::::::::::::::::::::::::::::::::: ::
:::: chapter 2f, Hoon proper ::::
:: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2fA, miscellaneous funs ::
:: ::
2015-12-21 00:48:02 +03:00
++ cain |=(vax/vase (sell vax)) :: $+(vase tank) for />
2015-12-26 13:07:50 +03:00
++ cell :: make %cell span
2013-09-29 00:21:18 +04:00
~/ %cell
2015-12-26 13:07:50 +03:00
|= {hed/span tal/span}
^- span
2013-09-29 00:21:18 +04:00
?:(=(%void hed) %void ?:(=(%void tal) %void [%cell hed tal]))
::
2015-12-26 13:07:50 +03:00
++ core :: make %core span
~/ %core
2015-12-26 13:07:50 +03:00
|= {pac/span con/coil}
^- span
2013-09-29 00:21:18 +04:00
?:(=(%void pac) %void [%core pac con])
::
2015-12-26 13:07:50 +03:00
++ face :: make %face span
2013-09-29 00:21:18 +04:00
~/ %face
2015-12-27 08:43:40 +03:00
|= {sag/tusk der/span}
2015-12-26 13:07:50 +03:00
^- span
2013-09-29 00:21:18 +04:00
?: =(%void der)
%void
2015-12-27 08:43:40 +03:00
[%face sag der]
2013-09-29 00:21:18 +04:00
::
2016-01-13 21:06:42 +03:00
++ bool `span`(frog [%atom %f `0] [%atom %f `1] ~) :: make loobeal
++ frog :: make %fork span
~/ %frog
|= yed/(list span)
=| lez/(set span)
|- ^- span
?~ yed
?~ lez %void
?: ?=({* $~ $~} lez) n.lez
[%fork lez]
$(yed t.yed, lez ?:(=(%void i.yed) lez (~(put in lez) i.yed)))
::
2014-08-19 08:42:09 +04:00
++ cove :: extract [0 *] axis
2015-12-20 23:50:45 +03:00
|= nug/nock
2013-09-29 00:21:18 +04:00
?- nug
2015-12-04 04:24:39 +03:00
{$0 *} p.nug
{$10 *} $(nug q.nug)
* ~|([%cove nug] !!)
2013-09-29 00:21:18 +04:00
==
2014-08-19 08:42:09 +04:00
++ comb :: combine two formulas
2013-09-29 00:21:18 +04:00
~/ %comb
2015-12-20 23:50:45 +03:00
|= {mal/nock buz/nock}
^- nock
2015-12-04 04:24:39 +03:00
?: ?&(?=({$0 *} mal) !=(0 p.mal))
?: ?&(?=({$0 *} buz) !=(0 p.buz))
2013-09-29 00:21:18 +04:00
[%0 (peg p.mal p.buz)]
2015-12-04 04:24:39 +03:00
?: ?=({$2 {$0 *} {$0 *}} buz)
2013-09-29 00:21:18 +04:00
[%2 [%0 (peg p.mal p.p.buz)] [%0 (peg p.mal p.q.buz)]]
[%7 mal buz]
2015-12-04 04:24:39 +03:00
?: ?=({^ {$0 $1}} mal)
2013-09-29 00:21:18 +04:00
[%8 p.mal buz]
2015-12-04 04:24:39 +03:00
?: =({$0 $1} buz)
2013-09-29 00:21:18 +04:00
mal
2014-08-19 08:42:09 +04:00
[%7 mal buz] :: informative default
2013-09-29 00:21:18 +04:00
::
2014-08-19 08:42:09 +04:00
++ cond :: ?: compile
2013-09-29 00:21:18 +04:00
~/ %cond
2015-12-20 23:50:45 +03:00
|= {pex/nock yom/nock woq/nock}
^- nock
2013-09-29 00:21:18 +04:00
?- pex
2015-12-04 04:24:39 +03:00
{$1 $0} yom
{$1 $1} woq
* [%6 pex yom woq]
2013-09-29 00:21:18 +04:00
==
::
2014-08-19 08:42:09 +04:00
++ cons :: make formula cell
2013-09-29 00:21:18 +04:00
~/ %cons
2015-12-20 23:50:45 +03:00
|= {vur/nock sed/nock}
^- nock
2015-12-04 04:24:39 +03:00
?: ?=({{$0 *} {$0 *}} +<)
2013-09-29 00:21:18 +04:00
?: ?&(=(+(p.vur) p.sed) =((div p.vur 2) (div p.sed 2)))
[%0 (div p.vur 2)]
[vur sed]
2015-12-04 04:24:39 +03:00
?: ?=({{$1 *} {$1 *}} +<)
2013-09-29 00:21:18 +04:00
[%1 p.vur p.sed]
[vur sed]
2013-09-29 00:21:18 +04:00
::
2014-08-19 08:42:09 +04:00
++ fitz :: odor compatibility
2013-09-29 00:21:18 +04:00
~/ %fitz
2015-12-20 23:50:45 +03:00
|= {yaz/term wix/term}
2013-09-29 00:21:18 +04:00
=+ ^= fiz
2015-12-20 23:50:45 +03:00
|= mot/@ta ^- {p/@ q/@ta}
2013-09-29 00:21:18 +04:00
=+ len=(met 3 mot)
?: =(0 len)
[0 %$]
=+ tyl=(rsh 3 (dec len) mot)
?: &((gte tyl 'A') (lte tyl 'Z'))
[(sub tyl 64) (end 3 (dec len) mot)]
[0 mot]
=+ [yoz=(fiz yaz) wux=(fiz wix)]
?& ?| =(0 p.yoz)
=(0 p.wux)
&(!=(0 p.wux) (lte p.wux p.yoz))
==
|- ?| =(%$ p.yoz)
2013-09-29 00:21:18 +04:00
=(%$ p.wux)
?& =((end 3 1 p.yoz) (end 3 1 p.wux))
$(p.yoz (rsh 3 1 p.yoz), p.wux (rsh 3 1 p.wux))
==
==
==
::
2014-08-19 08:42:09 +04:00
++ flan :: loobean &
2013-09-29 00:21:18 +04:00
~/ %flan
2015-12-20 23:50:45 +03:00
|= {bos/nock nif/nock}
^- nock
2013-09-29 00:21:18 +04:00
?- bos
2015-12-04 04:24:39 +03:00
{$1 $1} bos
{$1 $0} nif
2013-09-29 00:21:18 +04:00
*
?- nif
2015-12-04 04:24:39 +03:00
{$1 $1} nif
{$1 $0} bos
2013-09-29 00:21:18 +04:00
* [%6 bos nif [%1 1]]
==
==
::
2014-08-19 08:42:09 +04:00
++ flip :: loobean negation
2013-09-29 00:21:18 +04:00
~/ %flip
2015-12-20 23:50:45 +03:00
|= dyr/nock
2013-09-29 00:21:18 +04:00
[%6 dyr [%1 1] [%1 0]]
::
2014-08-19 08:42:09 +04:00
++ flor :: loobean |
2013-09-29 00:21:18 +04:00
~/ %flor
2015-12-20 23:50:45 +03:00
|= {bos/nock nif/nock}
^- nock
2013-09-29 00:21:18 +04:00
?- bos
2015-12-04 04:24:39 +03:00
{$1 $1} nif
{$1 $0} bos
2013-09-29 00:21:18 +04:00
*
?- nif
2015-12-04 04:24:39 +03:00
{$1 $1} bos
{$1 $0} nif
* [%6 bos [%1 0] nif]
2013-09-29 00:21:18 +04:00
==
==
::
++ hike
2013-09-29 00:21:18 +04:00
~/ %hike
2015-12-20 23:50:45 +03:00
|= {axe/axis pac/(list {p/axis q/nock})}
^- nock
2013-09-29 00:21:18 +04:00
?~ pac
[%0 axe]
2015-12-20 23:50:45 +03:00
=+ zet=(skim pac.$ |=({p/axis q/nock} [=(1 p)]))
2013-09-29 00:21:18 +04:00
?~ zet
2015-12-20 23:50:45 +03:00
=+ tum=(skim pac.$ |=({p/axis q/nock} ?&(!=(1 p) =(2 (cap p)))))
=+ gam=(skim pac.$ |=({p/axis q/nock} ?&(!=(1 p) =(3 (cap p)))))
2013-09-29 00:21:18 +04:00
%+ cons
%= $
2014-01-04 11:28:16 +04:00
axe (peg axe 2)
2015-12-20 23:50:45 +03:00
pac (turn tum |=({p/axis q/nock} [(mas p) q]))
2013-09-29 00:21:18 +04:00
==
%= $
2014-01-04 11:28:16 +04:00
axe (peg axe 3)
2015-12-20 23:50:45 +03:00
pac (turn gam |=({p/axis q/nock} [(mas p) q]))
2013-09-29 00:21:18 +04:00
==
2015-12-04 04:24:39 +03:00
?>(?=({* $~} zet) q.i.zet)
2013-09-29 00:21:18 +04:00
::
++ jock
2015-12-20 23:50:45 +03:00
|= rad/?
|= lot/coin ^- twig
2013-09-29 00:21:18 +04:00
?- -.lot
2015-12-08 05:04:19 +03:00
$~
2015-12-30 00:52:51 +03:00
?:(rad [%rock p.lot] [%sand p.lot])
2013-09-29 00:21:18 +04:00
::
2015-12-04 04:24:39 +03:00
$blob
?: rad
2015-12-30 00:52:51 +03:00
[%rock %$ p.lot]
2015-12-29 22:52:22 +03:00
?@(p.lot [%sand %$ p.lot] [$(p.lot -.p.lot) $(p.lot +.p.lot)])
2013-09-29 00:21:18 +04:00
::
2015-12-04 04:24:39 +03:00
$many
2015-12-20 23:50:45 +03:00
[%cltr (turn p.lot |=(a/coin ^$(lot a)))]
2013-09-29 00:21:18 +04:00
==
::
++ look
~/ %look
2015-12-20 23:50:45 +03:00
|= {cog/term dab/(map term foot)}
2013-09-29 00:21:18 +04:00
=+ axe=1
2015-12-20 23:50:45 +03:00
|- ^- (unit {p/axis q/foot})
2013-09-29 00:21:18 +04:00
?- dab
2015-12-04 04:24:39 +03:00
$~ ~
::
{* $~ $~}
2013-09-29 00:21:18 +04:00
?:(=(cog p.n.dab) [~ axe q.n.dab] ~)
::
2015-12-04 04:24:39 +03:00
{* $~ *}
2013-09-29 00:21:18 +04:00
?: =(cog p.n.dab)
[~ (peg axe 2) q.n.dab]
?: (gor cog p.n.dab)
~
$(axe (peg axe 3), dab r.dab)
::
2015-12-04 04:24:39 +03:00
{* * $~}
2013-09-29 00:21:18 +04:00
?: =(cog p.n.dab)
[~ (peg axe 2) q.n.dab]
?: (gor cog p.n.dab)
$(axe (peg axe 3), dab l.dab)
~
::
2015-12-04 04:24:39 +03:00
{* * *}
2013-09-29 00:21:18 +04:00
?: =(cog p.n.dab)
[~ (peg axe 2) q.n.dab]
?: (gor cog p.n.dab)
$(axe (peg axe 6), dab l.dab)
$(axe (peg axe 7), dab r.dab)
==
::
2014-08-19 08:42:09 +04:00
++ make :: compile cord to nock
2015-12-20 23:50:45 +03:00
|= txt/@
q:(~(mint ut %noun) %noun (ream txt))
2013-09-29 00:21:18 +04:00
::
2015-12-21 00:48:02 +03:00
++ noah |=(vax/vase (pave vax)) :: $+(vase tape) for /<
2015-12-20 23:50:45 +03:00
++ onan |=(vix/vise (seer vix)) :: $+(vise vase) for !>
::
2014-08-19 08:42:09 +04:00
++ rain :: parse with % path
2015-12-20 23:50:45 +03:00
|= {bon/path txt/@}
2014-03-05 23:00:27 +04:00
^- twig
2013-09-29 00:21:18 +04:00
=+ vaz=vast
2014-02-10 21:50:20 +04:00
~| bon
2013-09-29 00:21:18 +04:00
(scan (trip txt) (full (ifix [gay gay] tall:vaz(wer bon))))
::
2014-08-19 08:42:09 +04:00
++ ream :: parse cord to twig
2015-12-20 23:50:45 +03:00
|= txt/@
2013-12-15 11:07:57 +04:00
^- twig
2013-09-29 00:21:18 +04:00
(rash txt vest)
::
2014-08-19 08:42:09 +04:00
++ reck :: parse hoon file
2015-12-20 23:50:45 +03:00
|= bon/path
2015-12-04 18:16:34 +03:00
(rain bon ((hard @t) .^(%cx (weld bon `path`[%hoon ~]))))
2013-09-29 00:21:18 +04:00
::
2015-12-26 13:07:50 +03:00
++ seem |=(toy/typo `span`toy) :: promote typo
2015-12-20 23:50:45 +03:00
++ seer |=(vix/vise `vase`vix) :: promote vise
2014-08-19 08:42:09 +04:00
++ sell :: tank pretty-print
2015-12-20 23:50:45 +03:00
|= vax/vase ^- tank
2013-09-29 00:21:18 +04:00
~| %sell
(~(deal us p.vax) q.vax)
2013-09-29 00:21:18 +04:00
::
2014-08-19 08:42:09 +04:00
++ pave :: tape pretty-print
2015-12-20 23:50:45 +03:00
|= vax/vase ^- tape
2013-09-29 00:21:18 +04:00
~(ram re (sell vax))
::
2014-08-19 08:42:09 +04:00
++ slam :: slam a gate
2015-12-20 23:50:45 +03:00
|= {gat/vase sam/vase} ^- vase
2015-12-26 13:07:50 +03:00
=+ :- ^= typ ^- span
2013-09-29 00:21:18 +04:00
[%cell p.gat p.sam]
2013-12-15 11:07:57 +04:00
^= gen ^- twig
[%cnsg [%$ ~] [%$ 2] [%$ 3] ~]
2013-09-29 00:21:18 +04:00
=+ gun=(~(mint ut typ) %noun gen)
[p.gun .*([q.gat q.sam] q.gun)]
::
2014-08-19 08:42:09 +04:00
++ slim :: identical to seer?
2015-12-20 23:50:45 +03:00
|= old/vise ^- vase
2013-09-29 00:21:18 +04:00
old
::
2015-12-26 13:07:50 +03:00
++ slit :: span of slam
|= {gat/span sam/span}
2014-06-11 18:06:36 +04:00
?> (~(nest ut (~(peek ut gat) %free 6)) & sam)
(~(play ut [%cell gat sam]) [%cnsg [%$ ~] [%$ 2] [%$ 3] ~])
2013-09-29 00:21:18 +04:00
::
2015-12-26 13:07:50 +03:00
++ slym :: slam w+o sample-span
2015-12-20 23:50:45 +03:00
|= {gat/vase sam/*} ^- vase
2015-12-21 08:05:19 +03:00
(slap gat(+<.q sam) [%limb %$])
2014-04-29 02:24:32 +04:00
::
2013-09-29 00:21:18 +04:00
++ slap
2015-12-26 13:07:50 +03:00
|= {vax/vase gen/twig} ^- vase :: unspand vase .*
2013-09-29 00:21:18 +04:00
=+ gun=(~(mint ut p.vax) %noun gen)
[p.gun .*(q.vax q.gun)]
::
2014-08-19 08:42:09 +04:00
++ slop :: cons two vases
2015-12-20 23:50:45 +03:00
|= {hed/vase tal/vase}
2013-09-29 00:21:18 +04:00
^- vase
[[%cell p.hed p.tal] [q.hed q.tal]]
::
2015-12-26 13:07:50 +03:00
++ skol :: $+(span tank) for ~!
|= typ/span ^- tank
2013-09-29 00:21:18 +04:00
~(duck ut typ)
::
2015-12-26 13:07:50 +03:00
++ spec :: reconstruct span
2015-12-20 23:50:45 +03:00
|= vax/vase
2014-05-26 00:35:07 +04:00
^- vase
2014-05-31 00:57:49 +04:00
:_ q.vax
2015-12-28 00:11:01 +03:00
?@ q.vax (~(fuse ut p.vax) [%atom %$ ~])
2014-06-07 05:09:44 +04:00
?@ -.q.vax
2014-06-04 14:40:09 +04:00
^= typ
2014-06-07 05:09:44 +04:00
%- ~(play ut p.vax)
[%wtgr [%wtts [%leaf %tas -.q.vax] [%& 2]~] [%$ 1]]
2014-05-31 00:57:49 +04:00
(~(fuse ut p.vax) [%cell %noun %noun])
::
2015-01-13 01:49:05 +03:00
++ slew :: get axis in vase
2015-12-20 23:50:45 +03:00
|= {axe/@ vax/vase} ^- (unit vase)
2015-01-13 01:49:05 +03:00
?. |- ^- ?
?: =(1 axe) &
?. ?=(^ q.vax) |
$(axe (mas axe), q.vax .*(q.vax [0 (cap axe)]))
~
`[(~(peek ut p.vax) %free axe) .*(q.vax [0 axe])]
::
2015-12-24 08:42:08 +03:00
++ slab :: test if contains
2015-12-26 13:07:50 +03:00
|= {cog/@tas typ/span}
2015-12-26 14:44:32 +03:00
=(& -:(~(find ut typ) %free [cog ~]))
2014-07-29 02:46:03 +04:00
::
++ slob :: superficial arm
2015-12-26 13:07:50 +03:00
|= {cog/@tas typ/span}
^- ?
?+ typ |
2016-01-11 10:04:34 +03:00
{$hold *} $(typ ~(repo ut typ))
2015-12-04 04:24:39 +03:00
{$core *} (~(has by q.r.q.typ) cog)
==
::
2014-08-19 08:42:09 +04:00
++ sloe :: get arms in core
2015-12-26 13:07:50 +03:00
|= typ/span
2014-07-29 02:46:03 +04:00
^- (list term)
?+ typ ~
2016-01-11 10:04:34 +03:00
{$hold *} $(typ ~(repo ut typ))
2015-12-04 04:24:39 +03:00
{$core *}
2015-12-20 23:50:45 +03:00
(turn (~(tap by q.r.q.typ) ~) |=({a/term *} a))
2014-07-29 02:46:03 +04:00
==
2014-08-19 08:42:09 +04:00
++ slot :: got axis in vase
2015-12-20 23:50:45 +03:00
|= {axe/@ vax/vase} ^- vase
2014-05-31 00:57:49 +04:00
[(~(peek ut p.vax) %free axe) .*(q.vax [0 axe])]
2013-09-29 00:21:18 +04:00
::
2014-08-19 08:42:09 +04:00
++ wash :: render tank at width
2015-12-20 23:50:45 +03:00
|= {{tab/@ edg/@} tac/tank} ^- wall
(~(win re tac) tab edg)
2015-01-15 22:10:29 +03:00
::
2015-10-27 01:26:49 +03:00
++ wa !: :: cached compile
2015-01-15 22:10:29 +03:00
|_ worm
2015-12-26 13:07:50 +03:00
++ nell |=(ref/span (nest [%cell %noun %noun] ref)) :: nest in cell
2015-01-15 22:10:29 +03:00
++ nest :: nest:ut
2015-12-26 13:07:50 +03:00
|= {sut/span ref/span}
2015-12-04 04:24:39 +03:00
^- {? worm}
2015-01-15 22:10:29 +03:00
?: (~(has in nes) [sut ref]) [& +>+<]
2015-06-12 20:56:30 +03:00
?. (~(nest ut sut) | ref)
2015-12-12 06:59:24 +03:00
:: ~& %nest-failed
2015-03-06 01:58:04 +03:00
[| +>+<]
2015-01-15 22:10:29 +03:00
[& +>+<(nes (~(put in nes) [sut ref]))]
::
2015-12-26 13:07:50 +03:00
++ nets :: spanless nest
|= {sut/span ref/*}
2015-12-04 04:24:39 +03:00
^- {? worm}
2015-01-15 22:10:29 +03:00
?: (~(has in nes) [sut ref]) [& +>+<]
2015-12-26 13:07:50 +03:00
=+ gat=|=({a/span b/span} (~(nest ut a) | b))
2015-12-08 05:25:01 +03:00
?. (? .*(gat(+< [sut ref]) -.gat))
:: ~& %nets-failed
:: =+ tag=`*`skol
2015-12-12 06:59:24 +03:00
:: =+ foo=(tank .*(tag(+< ref) -.tag))
:: =+ bar=(skol sut)
2015-12-12 06:59:24 +03:00
:: ~& %nets-need
:: ~> %slog.[0 bar]
:: ~& %nets-have
:: ~> %slog.[0 foo]
2015-01-15 22:10:29 +03:00
[| +>+<.$]
[& +>+<.$(nes (~(put in nes) [sut ref]))]
::
++ play :: play:ut
2015-12-26 13:07:50 +03:00
|= {sut/span gen/twig}
^- {span worm}
2015-01-15 22:10:29 +03:00
=+ old=(~(get by pay) [sut gen])
?^ old [u.old +>+<.$]
=+ new=(~(play ut sut) gen)
[new +>+<.$(pay (~(put by pay) [sut gen] new))]
::
++ mint :: mint:ut to noun
2015-12-26 13:07:50 +03:00
|= {sut/span gen/twig}
^- {(pair span nock) worm}
2015-01-15 22:10:29 +03:00
=+ old=(~(get by mit) [sut gen])
?^ old [u.old +>+<.$]
=+ new=(~(mint ut sut) %noun gen)
[new +>+<.$(mit (~(put by mit) [sut gen] new))]
::
++ slap :: ++slap, cached
2015-12-20 23:50:45 +03:00
|= {vax/vase gen/twig}
2015-12-04 18:16:34 +03:00
^- {vase worm}
2015-01-15 22:10:29 +03:00
=^ gun +>+< (mint p.vax gen)
[[p.gun .*(q.vax q.gun)] +>+<.$]
::
++ slot :: ++slot, cached
2015-12-20 23:50:45 +03:00
|= {axe/@ vax/vase}
2015-12-04 18:16:34 +03:00
^- {vase worm}
2015-01-15 22:10:29 +03:00
=^ gun +>+< (mint p.vax [%$ axe])
[[p.gun .*(q.vax [0 axe])] +>+<.$]
::
++ spec :: specialize vase
2015-12-20 23:50:45 +03:00
|= vax/vase
2015-12-04 18:16:34 +03:00
^- {vase worm}
2015-06-12 20:56:30 +03:00
=+ ^= gen ^- twig
2016-01-05 04:29:30 +03:00
?@ q.vax [%wtts [%base [%atom %$]] [%& 1]~]
?@ -.q.vax [%wtts [%leaf %tas -.q.vax] [%& 2]~]
[%wtts [%base %cell] [%& 1]~]
2015-01-15 22:10:29 +03:00
=^ typ +>+<.$ (play p.vax [%wtgr gen [%$ 1]])
[[typ q.vax] +>+<.$]
::
2015-10-26 23:30:13 +03:00
++ spot :: slot then spec
2015-12-20 23:50:45 +03:00
|= {axe/@ vax/vase}
2015-12-04 18:16:34 +03:00
^- {vase worm}
2015-01-15 22:10:29 +03:00
=^ xav +>+< (slot axe vax)
(spec xav)
2015-10-26 23:30:13 +03:00
::
++ stop :: spec then slot
2015-12-20 23:50:45 +03:00
|= {axe/@ vax/vase}
2015-12-04 18:16:34 +03:00
^- {vase worm}
2015-10-26 23:30:13 +03:00
=^ xav +>+< (spec vax)
(slot axe xav)
2015-01-15 22:10:29 +03:00
--
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2013-09-29 00:21:18 +04:00
:: section 2fB, macro expansion ::
::
2014-10-31 06:13:40 +03:00
++ ah :: tiki engine
2015-12-23 07:12:56 +03:00
|_ tik/tiki
2014-01-04 06:59:56 +04:00
++ blue
2015-12-20 23:50:45 +03:00
|= gen/twig
2014-01-04 06:59:56 +04:00
^- twig
2015-12-23 07:12:56 +03:00
?. &(?=($| -.tik) ?=($~ p.tik)) gen
[%tsgr [%$ 3] gen]
2014-01-04 06:59:56 +04:00
::
++ gray
2015-12-20 23:50:45 +03:00
|= gen/twig
2014-01-04 06:59:56 +04:00
^- twig
2015-12-23 07:12:56 +03:00
?- -.tik
$& ?~(p.tik gen [%tstr u.p.tik q.tik gen])
$| [%tsls ?~(p.tik q.tik [%ktts u.p.tik q.tik]) gen]
2014-01-04 06:59:56 +04:00
==
::
++ puce
^- wing
2015-12-23 07:12:56 +03:00
?- -.tik
$& ?~(p.tik q.tik [u.p.tik ~])
$| [[%& 2] ~]
2014-01-04 06:59:56 +04:00
==
2015-12-14 08:51:42 +03:00
::
2015-12-21 23:45:47 +03:00
++ wthp |= opt/(list (pair twig twig))
2015-12-14 08:51:42 +03:00
%+ gray %wthp
2015-12-20 23:50:45 +03:00
[puce (turn opt |=({a/twig b/twig} [a (blue b)]))]
++ wtkt |=({sic/twig non/twig} (gray [%wtkt puce (blue sic) (blue non)]))
2015-12-21 23:45:47 +03:00
++ wtls |= {gen/twig opt/(list (pair twig twig))}
2015-12-14 08:51:42 +03:00
%+ gray %wtls
2015-12-20 23:50:45 +03:00
[puce (blue gen) (turn opt |=({a/twig b/twig} [a (blue b)]))]
++ wtpt |=({sic/twig non/twig} (gray [%wtpt puce (blue sic) (blue non)]))
++ wtsg |=({sic/twig non/twig} (gray [%wtsg puce (blue sic) (blue non)]))
++ wtts |=(gen/twig (gray [%wtts (blue gen) puce]))
2014-01-04 06:59:56 +04:00
--
::
2014-10-31 06:13:40 +03:00
++ al :: tile engine
2013-12-27 06:43:25 +04:00
~% %al
+>+
==
%bunt bunt
2014-01-04 11:28:16 +04:00
%whip whip
2013-12-27 06:43:25 +04:00
==
2013-09-29 00:21:18 +04:00
=+ [nag=`*`& gom=`axis`1]
2015-12-20 23:50:45 +03:00
|_ sec/tile
2013-09-29 00:21:18 +04:00
::::
++ home |=(gen/twig ^-(twig ?:(=(1 gom) gen [%tsgr [%$ gom] gen])))
2013-09-29 00:21:18 +04:00
::::
++ bunt
2013-12-15 11:07:57 +04:00
|- ^- twig
2013-09-29 00:21:18 +04:00
?- sec
2015-12-04 18:16:34 +03:00
{^ *}
2013-09-29 00:21:18 +04:00
[$(sec p.sec) $(sec q.sec)]
::
2015-12-04 18:16:34 +03:00
{$axil *}
2013-09-29 00:21:18 +04:00
?- p.sec
2016-01-05 04:29:30 +03:00
{$atom *} [%sand p.p.sec 0]
2015-12-30 00:52:51 +03:00
$noun [%dttr [%rock %$ 0] [[%rock %$ 0] [%rock %$ 1]]]
2015-12-04 18:16:34 +03:00
$cell =+(nec=$(sec [%axil %noun]) [nec nec])
2015-12-30 00:52:51 +03:00
$bean [%dtts [%rock %$ 0] [%rock %$ 0]]
2015-12-04 18:16:34 +03:00
$void [%zpzp ~]
2015-12-30 00:52:51 +03:00
$null [%rock %n %$]
2013-09-29 00:21:18 +04:00
==
::
2015-12-04 18:16:34 +03:00
{$bark *}
2013-09-29 00:21:18 +04:00
[%ktts p.sec $(sec q.sec)]
::
2015-12-04 18:16:34 +03:00
{$bush *}
2015-12-21 08:05:19 +03:00
[%wtcl [%bust %bean] $(sec p.sec) $(sec q.sec)]
2015-12-23 07:48:20 +03:00
::
2015-12-23 07:57:10 +03:00
{$deet *}
2015-12-23 07:48:20 +03:00
[%dbug p.sec $(sec q.sec)]
::
2015-12-04 18:16:34 +03:00
{$fern *}
2013-12-15 11:07:57 +04:00
|- ^- twig
2014-06-07 05:09:44 +04:00
?~ t.p.sec
2013-09-29 00:21:18 +04:00
^$(sec i.p.sec)
2015-12-21 08:05:19 +03:00
[%wtcl [%bust %bean] ^$(sec i.p.sec) $(p.sec t.p.sec)]
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$herb *}
2015-11-30 16:23:47 +03:00
=+ cys=~(boil ap p.sec)
2015-12-04 18:16:34 +03:00
?: ?=($herb -.cys)
2015-12-21 08:05:19 +03:00
(home [%tsgl [%limb %$] p.sec])
2015-11-30 16:23:47 +03:00
$(sec cys)
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$kelp *}
2013-12-15 11:07:57 +04:00
|- ^- twig
2014-06-07 05:09:44 +04:00
?~ t.p.sec
2013-09-29 00:21:18 +04:00
^$(sec i.p.sec)
2015-12-21 08:05:19 +03:00
[%wtcl [%bust %bean] ^$(sec i.p.sec) $(p.sec t.p.sec)]
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$leaf *}
2015-12-30 00:52:51 +03:00
[%rock p.sec q.sec]
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$reed *}
2015-12-21 08:05:19 +03:00
[%wtcl [%bust %bean] $(sec p.sec) $(sec q.sec)]
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$weed *}
2013-09-29 00:21:18 +04:00
(home p.sec)
==
2015-12-21 08:05:19 +03:00
++ clam ^-(twig [%brts [%base %noun] (whip(gom 7) 6)])
++ cloq
2015-12-20 23:50:45 +03:00
|- ^- {p/toga q/tile}
2015-12-04 18:16:34 +03:00
=. sec ?.(?=($herb -.sec) sec ~(boil ap p.sec))
2015-12-23 07:57:10 +03:00
?: ?=($deet -.sec) $(sec q.sec)
?: ?=(^ -.sec)
=+ [one=$(sec p.sec) two=$(sec q.sec)]
[[%2 p.one p.two] [q.one q.two]]
2015-12-04 18:16:34 +03:00
?. ?=($bark -.sec) [[%0 ~] sec]
=+ got=$(sec q.sec)
:_ q.got
2015-12-04 18:16:34 +03:00
?:(?=({$0 $~} p.got) p.sec [%1 p.sec p.got])
::
2013-09-29 00:21:18 +04:00
++ whip
2015-12-20 23:50:45 +03:00
|= axe/axis
2013-09-29 00:21:18 +04:00
=+ ^= tun
2015-12-20 23:50:45 +03:00
|= noy/$+(* twig)
2013-12-15 11:07:57 +04:00
^- twig
2013-09-29 00:21:18 +04:00
?@ nag
=+ luz=[%cnts [[%& 1] ~] [[[%& axe] ~] bunt(sec [%axil %cell])] ~]
2013-09-29 00:21:18 +04:00
?: =(& nag)
[%tsgr [%wtpt [[%& axe] ~] luz [%$ 1]] (noy [& &])]
2013-09-29 00:21:18 +04:00
[%tsgr luz (noy [& &])]
(noy nag)
2013-12-15 11:07:57 +04:00
^- twig
?- sec
2015-12-04 18:16:34 +03:00
{^ *}
2015-12-20 23:50:45 +03:00
%- tun |= gon/* => .(nag gon) ^- twig
2013-09-29 00:21:18 +04:00
:- ^$(sec -.sec, nag -.nag, axe (peg axe 2))
^$(sec +.sec, nag +.nag, axe (peg axe 3))
::
2015-12-04 18:16:34 +03:00
{$axil *}
2013-09-29 00:21:18 +04:00
?- p.sec
2016-01-05 04:29:30 +03:00
{$atom *}
2013-09-29 00:21:18 +04:00
=+ buv=bunt
2013-12-15 11:07:57 +04:00
|- ^- twig
2013-09-29 00:21:18 +04:00
?@ nag
?:(=(& nag) [%wtpt [[%& axe] ~] $(nag |) buv] [%ktls buv [%$ axe]])
2013-09-29 00:21:18 +04:00
buv
::
2015-12-04 18:16:34 +03:00
$noun
[%kthp [%base %noun] [%$ axe]]
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
$cell
2013-09-29 00:21:18 +04:00
=+ buv=bunt
2013-12-15 11:07:57 +04:00
|- ^- twig
?@ nag
2014-01-01 10:48:21 +04:00
?:(=(& nag) [%wtpt [[%& axe] ~] buv $(nag [& &])] buv)
[%ktls buv [%$ axe]]
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
$bean
2013-09-29 00:21:18 +04:00
:^ %wtcl
2015-12-30 00:52:51 +03:00
[%dtts [%rock %$ |] [%$ axe]]
[%rock %f |]
[%rock %f &]
::
2015-12-04 18:16:34 +03:00
$void
bunt
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
$null
bunt
2013-09-29 00:21:18 +04:00
==
::
2015-12-04 18:16:34 +03:00
{$bark *}
2013-09-29 00:21:18 +04:00
[%ktts p.sec $(sec q.sec)]
::
2015-12-04 18:16:34 +03:00
{$bush *}
2015-12-20 23:50:45 +03:00
%- tun |= gon/* => .(nag gon) ^- twig
2013-12-16 22:53:22 +04:00
?@ -.nag
?: =(& -.nag)
2014-01-01 10:48:21 +04:00
[%wtpt [[%& (peg axe 2)] ~] ^$(sec q.sec) ^$(sec p.sec)]
2013-12-16 22:53:22 +04:00
^$(sec q.sec)
^$(sec p.sec)
2015-12-23 07:48:20 +03:00
::
2015-12-23 07:57:10 +03:00
{$deet *}
2015-12-23 07:48:20 +03:00
[%dbug p.sec $(sec q.sec)]
::
2015-12-04 18:16:34 +03:00
{$fern *}
2013-12-15 11:07:57 +04:00
|- ^- twig
2014-06-07 05:09:44 +04:00
?~ t.p.sec
2013-09-29 00:21:18 +04:00
^$(sec i.p.sec)
:+ %tsls
^$(sec i.p.sec)
=> .(axe (peg 3 axe), gom (peg 3 gom))
:^ %wtcl
[%dtts [%$ axe] [%$ 2]]
[%$ 2]
2013-09-29 00:21:18 +04:00
$(i.p.sec i.t.p.sec, t.p.sec t.t.p.sec)
::
2015-12-04 18:16:34 +03:00
{$herb *}
2015-11-30 16:23:47 +03:00
=+ cys=~(boil ap p.sec)
2015-12-04 18:16:34 +03:00
?: ?=($herb -.cys)
2016-01-05 04:29:30 +03:00
[%cnhp (home p.sec) [%$ axe] ~]
2015-11-30 16:23:47 +03:00
$(sec cys)
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$kelp *}
2015-12-20 23:50:45 +03:00
%- tun |= gon/* => .(nag gon)
2013-12-15 11:07:57 +04:00
|- ^- twig
2014-06-07 05:09:44 +04:00
?~ t.p.sec
2015-12-30 00:52:51 +03:00
:- [%rock +.p.i.p.sec]
2013-09-29 00:21:18 +04:00
^^$(axe (peg axe 3), sec q.i.p.sec, nag &)
:^ %wtcl
2015-12-30 00:52:51 +03:00
[%dtts [%$ (peg axe 2)] [%rock +.p.i.p.sec]]
:- [%rock +.p.i.p.sec]
2013-09-29 00:21:18 +04:00
^^$(axe (peg axe 3), sec q.i.p.sec, nag &)
$(i.p.sec i.t.p.sec, t.p.sec t.t.p.sec)
::
2015-12-04 18:16:34 +03:00
{$leaf *}
2015-12-30 00:52:51 +03:00
[%rock p.sec q.sec]
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$reed *}
2013-12-16 22:53:22 +04:00
?- nag
$& [%wtpt [[%& axe] ~] $(sec p.sec, nag |) $(sec q.sec, nag [& &])]
$| $(sec p.sec)
^ $(sec q.sec)
* !!
2013-12-16 22:53:22 +04:00
==
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$weed *}
2014-01-16 10:43:56 +04:00
(home p.sec)
2013-09-29 00:21:18 +04:00
==
--
2013-09-29 00:21:18 +04:00
::
2014-10-31 06:13:40 +03:00
++ ap :: twig engine
~% %ap
2013-09-29 00:21:18 +04:00
+>
==
%etch etch
%open open
%rake rake
2013-09-29 00:21:18 +04:00
==
2015-12-20 23:50:45 +03:00
|_ gen/twig
2013-09-29 00:21:18 +04:00
++ etch
~| %etch
|- ^- term
2015-12-04 18:16:34 +03:00
?: ?=({$ktts *} gen)
2013-12-18 05:47:20 +04:00
?>(?=(@ p.gen) p.gen)
2013-09-29 00:21:18 +04:00
=+ voq=~(open ap gen)
?<(=(gen voq) $(gen voq))
::
2014-01-04 11:28:16 +04:00
++ feck
|- ^- (unit term)
?- gen
{$sand $tas @} [~ q.gen]
2015-12-21 08:05:19 +03:00
{$dbug *} $(gen q.gen)
2014-01-04 11:28:16 +04:00
* ~
==
::
2016-01-07 10:08:09 +03:00
:: not used at present; see comment at $csng in ++open
::::
::++ hail
:: |= axe/axis
:: =| air/(list (pair wing twig))
:: |- ^+ air
:: =+ hav=half
:: ?~ hav [[[[%| 0 ~] [%& axe] ~] gen] air]
:: $(gen p.u.hav, axe (peg axe 2), air $(gen q.u.hav, axe (peg axe 3)))
::::
::++ half
:: |- ^- (unit (pair twig twig))
:: ?+ gen ~
:: {^ *} `[p.gen q.gen]
:: {$dbug *} $(gen q.gen)
:: {$clcb *} `[q.gen p.gen]
:: {$clcn *} `[[%clsg p.gen] [%bust %null]]
:: {$clhp *} `[p.gen q.gen]
:: {$clkt *} `[p.gen %clls q.gen r.gen s.gen]
:: {$clsg *} ?~(p.gen ~ `[i.p.gen %clsg t.p.gen])
:: {$cltr *} ?~ p.gen ~
:: ?~(t.p.gen $(gen i.p.gen) `[i.p.gen %cltr t.p.gen])
:: ==
::::
2013-12-21 04:59:03 +04:00
++ hock
2014-01-16 10:43:56 +04:00
|- ^- toga
2013-12-17 23:13:44 +04:00
?- gen
2015-12-04 18:16:34 +03:00
{$cnts {@ $~} $~} i.p.gen
2015-12-21 08:05:19 +03:00
{$limb @} p.gen
{$wing {@ $~}} i.p.gen
{$dbug *} $(gen q.gen)
2015-12-04 18:16:34 +03:00
{@ *} =+(neg=open ?:(=(gen neg) [%0 ~] $(gen neg)))
{^ *} =+ toe=[$(gen p.gen) $(gen q.gen)]
?:(=(toe [[%0 ~] [%0 ~]]) [%0 ~] [%2 toe])
2013-12-17 23:13:44 +04:00
==
::
++ bile
2015-12-23 07:57:10 +03:00
=+ sec=boil
2015-12-23 07:48:20 +03:00
|- ^- (each line tile)
2015-12-23 07:57:10 +03:00
?: ?=({$deet *} sec)
$(sec q.sec)
?: ?=({{$deet *} *} sec)
$(p.sec q.p.sec)
?: ?=({{$leaf *} *} sec)
[%& [%leaf p.p.sec q.p.sec] q.sec]
[%| sec]
::
++ boil
^- tile
2015-12-23 07:48:20 +03:00
?+ gen [%herb gen]
{$base *} [%axil p.gen]
2015-12-23 07:57:10 +03:00
{$dbug *} [%deet p.gen boil(gen q.gen)]
2015-12-23 07:48:20 +03:00
{$leaf *} [%leaf p.gen]
::
2015-12-14 10:28:05 +03:00
{$bcpt *} [%reed boil(gen p.gen) boil(gen q.gen)]
{$bccb *} [%weed p.gen]
{$bccl *}
|- ^- tile
?~ p.gen [%axil %null]
?~ t.p.gen boil(gen i.p.gen)
[boil(gen i.p.gen) $(p.gen t.p.gen)]
::
2015-12-14 10:28:05 +03:00
{$bccn *}
?~ p.gen
[%axil %void]
?~ t.p.gen
boil(gen i.p.gen)
=+ :* def=bile(gen i.p.gen)
^= end ^- (list line)
2015-12-23 07:57:10 +03:00
~| %bccn-foul
%+ turn `(list twig)`t.p.gen
2015-12-20 23:50:45 +03:00
|=(a/twig =+(bile(gen a) ?>(?=($& -<) ->)))
==
?- -.def
2015-12-14 05:31:27 +03:00
$& [%kelp p.def end]
$| ?~(end p.def [%fern p.def [%kelp end] ~])
==
::
2015-12-14 10:28:05 +03:00
{$bckt *} [%bush boil(gen p.gen) boil(gen q.gen)]
{$bcls *} [%weed [%brsg p.gen [%cnbc [%tsgr [%$ 7] q.gen]]]]
2015-12-14 10:28:05 +03:00
{$bcts *} [%bark p.gen boil(gen q.gen)]
2015-12-20 23:50:45 +03:00
{$bcwt *} =+ (turn p.gen |=(a/twig boil(gen a)))
?~(- [%axil %void] [%fern -])
==
::
2015-12-12 15:39:13 +03:00
++ open
2013-12-15 11:07:57 +04:00
^- twig
2013-09-29 00:21:18 +04:00
?- gen
{$~ *} [%cnts [[%& p.gen] ~] ~]
2015-12-21 23:45:47 +03:00
::
{$base *} ~(clam al boil)
{$bust *} ~(bunt al %axil p.gen)
{$dbug *} q.gen
::
{$knit *} ::
:+ %tsgr [%ktts %v %$ 1] :: => v=.
2015-12-21 23:45:47 +03:00
:- %brhp :: |-
:+ %ktls :: ^+
:- %brhp :: |-
:^ %wtcl :: ?:
[%bust %bean] :: ?
[%bust %null] :: ~
2015-12-29 22:52:22 +03:00
:- [%ktts %i [%sand 'tD' *@]] :: :- i=~~
2015-12-21 23:45:47 +03:00
[%ktts %t [%limb %$]] :: t=$
|- ^- twig ::
?~ p.gen ::
[%bust %null] :: ~
=+ res=$(p.gen t.p.gen) ::
^- twig ::
?@ i.p.gen ::
2015-12-29 22:52:22 +03:00
[[%sand 'tD' i.p.gen] res] :: [~~{i.p.gen} {res}]
2015-12-21 23:45:47 +03:00
:+ %tsls ::
:- :+ %ktts :: ^=
%a :: a
:+ %ktls :: ^+
[%limb %$] :: $
[%tsgr [%limb %v] p.i.p.gen] :: =>(v {p.i.p.gen})
[%ktts %b res] :: b={res}
^- twig ::
:- %brhp :: |-
:^ %wtpt :: ?@
[%a ~] :: a
[%limb %b] :: b
:- [%tsgl [%$ 2] [%limb %a]] :: :- -.a
2015-12-21 23:45:47 +03:00
:+ %cnts :: %=
[%$ ~] :: $
[[[%a ~] [%tsgl [%$ 3] [%limb %a]]] ~] :: a +.a
2015-12-21 23:45:47 +03:00
::
{$leaf *} ~(clam al boil)
{$limb *} [%cnts [p.gen ~] ~]
2016-01-05 04:29:30 +03:00
{$tell *} [%cnhp [%limb %noah] [%zpgr [%cltr p.gen]] ~]
2015-12-21 23:45:47 +03:00
{$wing *} [%cnts p.gen ~]
2016-01-05 04:29:30 +03:00
{$yell *} [%cnhp [%limb %cain] [%zpgr [%cltr p.gen]] ~]
::
{$bcpt *} ~(clam al boil)
{$bccb *} ~(clam al boil)
{$bccl *} ~(clam al boil)
{$bccn *} ~(clam al boil)
{$bcls *} ~(clam al boil)
{$bckt *} ~(clam al boil)
{$bcwt *} ~(clam al boil)
{$bcts *} ~(clam al boil)
2015-12-14 05:19:24 +03:00
::
2015-12-14 09:52:13 +03:00
{$brcb *} [%tsls [%cnbc p.gen] [%brcn q.gen]]
2015-12-04 18:16:34 +03:00
{$brcl *} [%tsls [%ktsg p.gen] [%brdt q.gen]]
{$brdt *} [%brcn (~(put by *(map term foot)) %$ [%ash p.gen])]
2015-12-21 08:05:19 +03:00
{$brkt *} [%tsgr [%brcn (~(put by q.gen) %$ [%ash p.gen])] [%limb %$]]
{$brhp *} [%tsgl [%limb %$] [%brdt p.gen]]
{$brsg *} [%ktbr [%brts p.gen q.gen]]
2016-01-05 04:29:30 +03:00
{$brtr *} :+ %tsls [%cnbc p.gen]
[%brcn (~(put by *(map term foot)) %$ [%elm q.gen])]
2015-12-04 18:16:34 +03:00
{$brts *} [%brcb p.gen (~(put by *(map term foot)) %$ [%ash q.gen])]
{$brwt *} [%ktwt %brdt p.gen]
::
{$clkt *} [p.gen q.gen r.gen s.gen]
{$clls *} [p.gen q.gen r.gen]
{$clcb *} [q.gen p.gen]
2015-12-21 08:05:19 +03:00
{$clcn *} [[%clsg p.gen] [%bust %null]]
2015-12-04 18:16:34 +03:00
{$clhp *} [p.gen q.gen]
{$clsg *}
2013-12-15 11:07:57 +04:00
|- ^- twig
?~ p.gen
2015-12-30 00:52:51 +03:00
[%rock %n ~]
2014-03-26 04:48:22 +04:00
[i.p.gen $(p.gen t.p.gen)]
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$cltr *}
2013-12-15 11:07:57 +04:00
|- ^- twig
2013-09-29 00:21:18 +04:00
?~ p.gen
[%zpzp ~]
2014-03-26 04:48:22 +04:00
?~ t.p.gen
i.p.gen
[i.p.gen $(p.gen t.p.gen)]
::
2015-12-14 09:52:13 +03:00
{$cnbc *} [%ktsg ~(bunt al %herb p.gen)]
2015-12-21 08:05:19 +03:00
{$cncb *} [%ktls [%wing p.gen] %cnts p.gen q.gen]
2016-01-05 04:29:30 +03:00
{$cndt *} [%cnhp q.gen [p.gen ~]]
{$cnkt *} [%cnhp p.gen q.gen r.gen s.gen ~]
{$cnls *} [%cnhp p.gen q.gen r.gen ~]
{$cnhp *} [%cnsg [%$ ~] p.gen q.gen]
2016-01-07 04:47:03 +03:00
{$cnsg *} :: [%cntr p.gen q.gen (hail(gen [%cltr r.gen]) 6)]
:^ %cntr p.gen q.gen
2016-01-07 10:08:09 +03:00
::
:: the use of ++hail is probably the right language design, but
:: it's impractically slow without validating %=.
2016-01-07 10:08:09 +03:00
::
:: ?:(=(~ r.gen) ~ (hail(gen [%cltr r.gen]) 6))
=+ axe=6
|- ^- (list {wing twig})
?~ r.gen ~
?~ t.r.gen [[[[%| 0 ~] [%& axe] ~] i.r.gen] ~]
2016-01-07 04:47:03 +03:00
:- [[[%| 0 ~] [%& (peg axe 2)] ~] i.r.gen]
$(axe (peg axe 3), r.gen t.r.gen)
::
2015-12-04 18:16:34 +03:00
{$cntr *}
?: =(~ r.gen)
[%tsgr q.gen [%wing p.gen]]
2013-09-29 00:21:18 +04:00
:+ %tsls
q.gen
:+ %cnts
(weld p.gen `wing`[[%& 2] ~])
(turn r.gen |=({p/wing q/twig} [p [%tsgr [%$ 3] q]]))
2013-09-29 00:21:18 +04:00
::
2016-01-05 04:29:30 +03:00
{$ktdt *} [%ktls [%cnhp p.gen q.gen ~] q.gen]
2015-12-12 08:01:41 +03:00
{$kthp *} [%ktls ~(bunt al [%herb p.gen]) q.gen]
2015-12-04 18:16:34 +03:00
{$sgbr *}
2014-01-05 02:57:44 +04:00
:+ %sggr
:- %mean
=+ fek=~(feck ap p.gen)
2015-12-30 00:52:51 +03:00
?^ fek [%rock %tas u.fek]
2016-01-05 04:29:30 +03:00
[%brdt [%cnhp [%limb %cain] [%zpgr [%tsgr [%$ 3] p.gen]] ~]]
q.gen
2014-01-05 02:57:44 +04:00
::
2015-12-04 18:16:34 +03:00
{$sgcb *} [%sggr [%mean [%brdt p.gen]] q.gen]
{$sgcn *}
2013-09-29 00:21:18 +04:00
:+ %sggl
:- %fast
:- %clls
2015-12-30 00:52:51 +03:00
:+ [%rock %$ p.gen]
2013-09-29 00:21:18 +04:00
[%zpts q.gen]
:- %clsg
2013-12-15 11:07:57 +04:00
=+ nob=`(list twig)`~
|- ^- (list twig)
2014-06-07 05:09:44 +04:00
?~ r.gen
2013-09-29 00:21:18 +04:00
nob
2015-12-30 00:52:51 +03:00
[[[%rock %$ p.i.r.gen] [%zpts q.i.r.gen]] $(r.gen t.r.gen)]
2013-09-29 00:21:18 +04:00
s.gen
::
{$sgfs *} [%sgcn p.gen [%$ 7] ~ q.gen]
{$sggl *} [%tsgl [%sggr p.gen [%$ 1]] q.gen]
2015-12-30 00:52:51 +03:00
{$sgbc *} [%sggr [%live [%rock %$ p.gen]] q.gen]
{$sgls *} [%sggr [%memo %rock %$ p.gen] q.gen]
2015-12-04 18:16:34 +03:00
{$sgpm *}
:+ %sggr
2016-01-05 04:29:30 +03:00
[%slog [%sand %$ p.gen] [%cnhp [%limb %cain] [%zpgr q.gen] ~]]
2013-09-29 00:21:18 +04:00
r.gen
::
2015-12-04 18:16:34 +03:00
{$sgts *} [%sggr [%germ p.gen] q.gen]
{$sgwt *}
2015-12-21 08:05:19 +03:00
:+ %tsls [%wtdt q.gen [%bust %null] [[%bust %null] r.gen]]
:^ %wtsg [%& 2]~
[%tsgr [%$ 3] s.gen]
[%sgpm p.gen [%$ 5] [%tsgr [%$ 3] s.gen]]
2015-12-04 18:16:34 +03:00
::
{$smcl *}
2013-09-29 00:21:18 +04:00
?- q.gen
2015-12-08 05:04:19 +03:00
$~ [%zpzp ~]
2015-12-08 04:46:28 +03:00
{* $~} i.q.gen
2013-09-29 00:21:18 +04:00
^
:+ %tsls
p.gen
2013-12-15 11:07:57 +04:00
=+ yex=`(list twig)`q.gen
|- ^- twig
?- yex
{* $~} [%tsgr [%$ 3] i.yex]
2016-01-05 04:29:30 +03:00
{* ^} [%cnhp [%$ 2] [%tsgr [%$ 3] i.yex] $(yex t.yex) ~]
2015-12-08 05:04:19 +03:00
$~ !!
2013-09-29 00:21:18 +04:00
==
==
::
2015-12-30 00:52:51 +03:00
{$smfs *} =+(zoy=[%rock %ta %$] [%clsg [zoy [%clsg [zoy p.gen] ~]] ~])
2015-12-04 18:16:34 +03:00
{$smsg *} :: ;~
2013-12-15 11:07:57 +04:00
|- ^- twig
2013-09-29 00:21:18 +04:00
?- q.gen
2015-12-08 05:04:19 +03:00
$~ ~|(%open-smsg !!)
2013-09-29 00:21:18 +04:00
^
:+ %tsgr [%ktts %v %$ 1] :: => v=.
2013-12-15 11:07:57 +04:00
|- ^- twig ::
2015-12-08 05:04:19 +03:00
?: ?=($~ t.q.gen) ::
2015-12-21 08:05:19 +03:00
[%tsgr [%limb %v] i.q.gen] :: =>(v {i.q.gen})
2013-09-29 00:21:18 +04:00
:+ %tsls [%ktts %a $(q.gen t.q.gen)] :: =+ ^= a
:+ %tsls :: {$(q.gen t.q.gen)}
2015-12-21 08:05:19 +03:00
[%ktts %b [%tsgr [%limb %v] i.q.gen]] :: =+ ^= b
2013-09-29 00:21:18 +04:00
:+ %tsls :: =>(v {i.q.gen})
2016-01-04 03:59:09 +03:00
:+ %ktts %c :: =+ c=,.+6.b
:+ %tsgl ::
[%wing [%| 0 ~] [%& 6] ~] ::
[%limb %b] ::
2013-09-29 00:21:18 +04:00
:- %brdt :: |.
:^ %cnls :: %+
2015-12-21 08:05:19 +03:00
[%tsgr [%limb %v] p.gen] :: =>(v {p.gen})
2016-01-05 04:29:30 +03:00
[%cnhp [%limb %b] [%limb %c] ~] :: (b c)
2016-01-04 03:59:09 +03:00
:+ %cnts [%a ~] :: a(,.+6 c)
[[[[%| 0 ~] [%& 6] ~] [%limb %c]] ~] ::
== ::
2013-09-29 00:21:18 +04:00
::
2015-12-14 05:31:27 +03:00
{$smsm *} :: ;;
:+ %tsgr [%ktts %v %$ 1] :: => v=.
:+ %tsls :+ %ktts %a :: =+ ^= a
2015-12-21 08:05:19 +03:00
[%tsgr [%limb %v] p.gen] :: =>(v {p.gen})
:+ %tsls [%ktts %b [%tsgr [%limb %v] q.gen]] :: =+ b==>(v {q.gen})
2013-09-29 00:21:18 +04:00
:+ %tsls :: =+ c=(a b)
2016-01-05 04:29:30 +03:00
[%ktts %c [%cnhp [%limb %a] [%limb %b] ~]] ::
2015-12-21 08:05:19 +03:00
[%wtgr [%dtts [%limb %c] [%limb %b]] [%limb %c]] :: ?>(=(c b) c)
2013-09-29 00:21:18 +04:00
::
2015-12-14 05:31:27 +03:00
{$tsbr *}
2015-12-14 05:19:24 +03:00
[%tsls ~(bunt al %herb p.gen) q.gen]
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$tscl *}
[%tsgr [%cncb [[%& 1] ~] p.gen] q.gen]
2015-12-23 07:12:56 +03:00
::
{$tscn *}
[%tsls [%kthp p.gen q.gen] r.gen]
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$tsdt *}
[%tsgr [%cncb [[%& 1] ~] [[p.gen q.gen] ~]] r.gen]
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$tskt *} :: =^
2013-09-29 00:21:18 +04:00
=+ cog=rusk(gen p.gen) ::
=+ wuy=(weld rake(gen q.gen) `wing`[%v ~]) ::
:+ %tsgr [%ktts %v %$ 1] :: => v=.
2015-12-21 08:05:19 +03:00
:+ %tsls [%ktts %a %tsgr [%limb %v] r.gen] :: =+ a==>(v \r.gen)
:^ %tsdt wuy [%tsgl [%$ 3] [%limb %a]] :: =. \wuy +.a
2013-09-29 00:21:18 +04:00
:+ %tsgr :- :+ %ktts cog :: => :- ^= \cog
[%tsgl [%$ 2] [%limb %a]] :: -.a
2015-12-21 08:05:19 +03:00
[%limb %v] :: v
2013-09-29 00:21:18 +04:00
s.gen :: s.gen
::
2015-12-04 18:16:34 +03:00
{$tsgl *} [%tsgr q.gen p.gen]
{$tsls *} [%tsgr [p.gen [%$ 1]] q.gen]
2015-12-04 18:16:34 +03:00
{$tshp *} [%tsls q.gen p.gen]
{$tssg *}
2013-12-15 11:07:57 +04:00
|- ^- twig
2014-07-16 22:54:53 +04:00
?~ p.gen [%$ 1]
2013-09-29 00:21:18 +04:00
?~ t.p.gen i.p.gen
[%tsgr i.p.gen $(p.gen t.p.gen)]
2014-02-10 21:50:20 +04:00
::
2015-12-04 18:16:34 +03:00
{$wtbr *}
|-
2015-12-30 00:52:51 +03:00
?~(p.gen [%rock %f 1] [%wtcl i.p.gen [%rock %f 0] $(p.gen t.p.gen)])
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$wtdt *} [%wtcl p.gen r.gen q.gen]
{$wtgl *} [%wtcl p.gen [%zpzp ~] q.gen]
{$wtgr *} [%wtcl p.gen q.gen [%zpzp ~]]
2016-01-05 04:29:30 +03:00
{$wtkt *} [%wtcl [%wtts [%base %atom %$] p.gen] r.gen q.gen]
2015-12-12 15:39:13 +03:00
::
2015-12-13 03:56:29 +03:00
{$wthp *}
2013-09-29 00:21:18 +04:00
|-
2014-06-07 05:09:44 +04:00
?~ q.gen
2015-12-21 08:05:19 +03:00
[%lost [%wing p.gen]]
2013-09-29 00:21:18 +04:00
:^ %wtcl
2015-12-14 08:05:59 +03:00
[%wtts p.i.q.gen p.gen]
2013-09-29 00:21:18 +04:00
q.i.q.gen
$(q.gen t.q.gen)
2013-12-15 10:27:48 +04:00
::
2015-12-13 03:56:29 +03:00
{$wtls *}
2015-12-21 08:05:19 +03:00
[%wthp p.gen (weld r.gen `_r.gen`[[[%base %noun] q.gen] ~])]
2015-12-08 05:25:01 +03:00
::
2015-12-04 18:16:34 +03:00
{$wtpm *}
2013-09-29 00:21:18 +04:00
|-
2015-12-30 00:52:51 +03:00
?~(p.gen [%rock %f 0] [%wtcl i.p.gen $(p.gen t.p.gen) [%rock %f 1]])
2013-09-29 00:21:18 +04:00
::
2016-01-05 04:29:30 +03:00
{$wtpt *} [%wtcl [%wtts [%base %atom %$] p.gen] q.gen r.gen]
2015-12-21 08:05:19 +03:00
{$wtsg *} [%wtcl [%wtts [%base %null] p.gen] q.gen r.gen]
2015-12-30 00:52:51 +03:00
{$wtzp *} [%wtcl p.gen [%rock %f 1] [%rock %f 0]]
2015-12-04 18:16:34 +03:00
{$zpgr *}
2016-01-05 04:29:30 +03:00
[%cnhp [%limb %onan] [%zpsm [%cnbc [%limb %abel]] p.gen] ~]
2014-01-05 06:05:33 +04:00
::
2015-12-04 18:16:34 +03:00
{$zpwt *}
2014-01-05 05:15:52 +04:00
?: ?: ?=(@ p.gen)
2014-07-19 04:51:22 +04:00
(lte hoon p.gen)
&((lte hoon p.p.gen) (gte hoon q.p.gen))
q.gen
2014-07-19 04:51:22 +04:00
~|([%hoon-fail hoon p.gen] !!)
2014-01-05 05:15:52 +04:00
::
2013-09-29 00:21:18 +04:00
* gen
==
::
++ rake ~|(%rake-twig (need reek))
++ reek
^- (unit wing)
?+ gen ~
{$~ *} `[[%& p.gen] ~]
2015-12-21 08:05:19 +03:00
{$limb *} `[p.gen ~]
{$wing *} `p.gen
2015-12-04 18:16:34 +03:00
{$cnts * $~} `p.gen
{$dbug *} reek(gen q.gen)
2013-09-29 00:21:18 +04:00
==
++ rusk
^- term
=+ wig=rake
2015-12-04 18:16:34 +03:00
?. ?=({@ $~} wig)
2013-12-15 11:07:57 +04:00
~|(%rusk-twig !!)
2013-09-29 00:21:18 +04:00
i.wig
--
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2fC, prettyprinting ::
2013-09-29 00:21:18 +04:00
::
++ us
=> |%
++ calf {p/(map @ud wine) q/wine} ::
++ wine ::
$@ $? $noun ::
$path ::
$span ::
$void ::
$wall ::
$wool ::
$yarn ::
== ::
2015-12-27 06:42:45 +03:00
$% {$mato p/term} ::
{$core p/(list @ta) q/wine} ::
{$face p/term q/wine} ::
{$list p/term q/wine} ::
{$pear p/term q/@} ::
{$pick p/(list wine)} ::
{$plot p/(list wine)} ::
{$stop p/@ud} ::
{$tree p/term q/wine} ::
{$unit p/term q/wine} ::
== ::
--
|_ sut/span
2015-01-10 00:02:47 +03:00
++ dash
2015-12-20 23:50:45 +03:00
|= {mil/tape lim/char} ^- tape
2015-01-10 00:02:47 +03:00
:- lim
|- ^- tape
?~ mil [lim ~]
?: =(lim i.mil) ['\\' i.mil $(mil t.mil)]
?: =('\\' i.mil) ['\\' i.mil $(mil t.mil)]
?: (lte ' ' i.mil) [i.mil $(mil t.mil)]
['\\' ~(x ne (rsh 2 1 i.mil)) ~(x ne (end 2 1 i.mil)) $(mil t.mil)]
::
2015-12-20 23:50:45 +03:00
++ deal |=(lum/* (dish dole lum))
2013-09-29 00:21:18 +04:00
++ dial
2015-12-20 23:50:45 +03:00
|= ham/calf
2015-12-04 18:16:34 +03:00
=+ gid=*(set @ud)
2015-12-10 02:24:29 +03:00
=< `tank`-:$
|%
++ many
2015-12-20 23:50:45 +03:00
|= haz/(list wine)
2015-12-10 02:24:29 +03:00
^- {(list tank) (set @ud)}
?~ haz [~ gid]
=^ mor gid $(haz t.haz)
=^ dis gid ^$(q.ham i.haz)
[[dis mor] gid]
::
++ $
^- {tank (set @ud)}
?- q.ham
$noun :_(gid [%leaf '*' ~])
$path :_(gid [%leaf '/' ~])
2015-12-26 13:07:50 +03:00
$span :_(gid [%leaf '#' 't' ~])
2015-12-10 02:24:29 +03:00
$void :_(gid [%leaf '#' ~])
$wool :_(gid [%leaf '*' '"' '"' ~])
$wall :_(gid [%leaf '*' '\'' '\'' ~])
$yarn :_(gid [%leaf '"' '"' ~])
2015-12-27 06:42:45 +03:00
{$mato *} :_(gid [%leaf '@' (trip p.q.ham)])
2015-12-10 02:24:29 +03:00
{$core *}
=^ cox gid $(q.ham q.q.ham)
:_ gid
:+ %rose
[[' ' ~] ['<' ~] ['>' ~]]
|- ^- (list tank)
?~ p.q.ham [cox ~]
[[%leaf (rip 3 i.p.q.ham)] $(p.q.ham t.p.q.ham)]
::
{$face *}
=^ cox gid $(q.ham q.q.ham)
:_(gid [%palm [['=' ~] ~ ~ ~] [%leaf (trip p.q.ham)] cox ~])
::
{$list *}
=^ cox gid $(q.ham q.q.ham)
:_(gid [%rose [" " (weld (trip p.q.ham) "(") ")"] cox ~])
::
{$pick *}
=^ coz gid (many p.q.ham)
2015-12-26 14:44:32 +03:00
:_(gid [%rose [[' ' ~] ['?(' ~] [')' ~]] coz])
2015-12-10 02:24:29 +03:00
::
{$plot *}
=^ coz gid (many p.q.ham)
:_(gid [%rose [[' ' ~] ['[' ~] [']' ~]] coz])
::
{$pear *}
:_(gid [%leaf '%' ~(rend co [%$ p.q.ham q.q.ham])])
2015-12-10 02:24:29 +03:00
::
{$stop *}
=+ num=~(rend co [%$ %ud p.q.ham])
2015-12-10 02:24:29 +03:00
?: (~(has in gid) p.q.ham)
:_(gid [%leaf '$' num])
=^ cox gid
%= $
gid (~(put in gid) p.q.ham)
q.ham (~(got by p.ham) p.q.ham)
==
:_(gid [%palm [['.' ~] ['^' '$' num] ~ ~] cox ~])
::
{$tree *}
=^ cox gid $(q.ham q.q.ham)
:_(gid [%rose [" " (weld (trip p.q.ham) "(") ")"] cox ~])
::
{$unit *}
=^ cox gid $(q.ham q.q.ham)
:_(gid [%rose [" " (weld (trip p.q.ham) "(") ")"] cox ~])
==
--
2013-09-29 00:21:18 +04:00
::
++ dish
2015-12-20 23:50:45 +03:00
|= {ham/calf lum/*} ^- tank
2013-09-29 00:21:18 +04:00
~| [%dish-h ?@(q.ham q.ham -.q.ham)]
2014-03-08 04:31:36 +04:00
~| [%lump lum]
~| [%ham ham]
2013-09-29 00:21:18 +04:00
%- need
2015-12-20 23:50:45 +03:00
=| gil/(set {@ud *})
2013-09-29 00:21:18 +04:00
|- ^- (unit tank)
?- q.ham
2015-12-04 18:16:34 +03:00
$noun
2013-09-29 00:21:18 +04:00
%= $
q.ham
?: ?=(@ lum)
2015-12-27 06:42:45 +03:00
[%mato %$]
2013-09-29 00:21:18 +04:00
:- %plot
|- ^- (list wine)
2015-12-27 06:42:45 +03:00
[%noun ?:(?=(@ +.lum) [[%mato %$] ~] $(lum +.lum))]
2013-09-29 00:21:18 +04:00
==
::
2015-12-04 18:16:34 +03:00
$path
2013-09-29 00:21:18 +04:00
:- ~
:+ %rose
[['/' ~] ['/' ~] ~]
|- ^- (list tank)
2014-06-07 05:09:44 +04:00
?~ lum ~
?@ lum !!
?> ?=(@ -.lum)
2013-09-29 00:21:18 +04:00
[[%leaf (rip 3 -.lum)] $(lum +.lum)]
::
2015-12-26 13:07:50 +03:00
$span
2016-01-01 04:01:19 +03:00
=+ tyr=|.((dial dole))
=+ vol=tyr(sut lum)
=+ cis=((hard tank) .*(vol -:vol))
2015-01-17 05:07:05 +03:00
:^ ~ %palm
2015-06-12 20:56:30 +03:00
[~ ~ ~ ~]
2015-01-27 02:24:31 +03:00
[[%leaf '#' 't' '/' ~] cis ~]
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
$wall
2013-09-29 00:21:18 +04:00
:- ~
:+ %rose
[[' ' ~] ['<' '|' ~] ['|' '>' ~]]
|- ^- (list tank)
2014-06-07 05:09:44 +04:00
?~ lum ~
?@ lum !!
2015-12-04 18:16:34 +03:00
[[%leaf (trip ((hard @) -.lum))] $(lum +.lum)]
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
$wool
2013-09-29 00:21:18 +04:00
:- ~
:+ %rose
[[' ' ~] ['<' '<' ~] ['>' '>' ~]]
|- ^- (list tank)
2014-06-07 05:09:44 +04:00
?~ lum ~
?@ lum !!
2013-09-29 00:21:18 +04:00
[(need ^$(q.ham %yarn, lum -.lum)) $(lum +.lum)]
::
2015-12-04 18:16:34 +03:00
$yarn
2015-01-10 00:02:47 +03:00
[~ %leaf (dash (tape lum) '"')]
2013-09-29 00:21:18 +04:00
::
2015-12-08 04:23:27 +03:00
$void
2013-09-29 00:21:18 +04:00
~
::
2015-12-27 06:42:45 +03:00
{$mato *}
2013-09-29 00:21:18 +04:00
?. ?=(@ lum)
~
:+ ~
%leaf
2015-02-27 05:20:07 +03:00
?+ (rash p.q.ham ;~(sfix (cook crip (star low)) (star hig)))
~(rend co [%$ p.q.ham lum])
$$ ~(rend co [%$ %ud lum])
2015-12-08 04:23:27 +03:00
$t (dash (rip 3 lum) '\'')
$tas ['%' ?.(=(0 lum) (rip 3 lum) ['$' ~])]
2015-01-10 00:02:47 +03:00
==
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$core *}
2013-09-29 00:21:18 +04:00
:: XX needs rethinking for core metal
:: ?. ?=(^ lum) ~
:: => .(lum `*`lum)
:: =- ?~(tok ~ [~ %rose [[' ' ~] ['<' ~] ['>' ~]] u.tok])
:: ^= tok
:: |- ^- (unit (list tank))
:: ?~ p.q.ham
2013-09-29 00:21:18 +04:00
:: =+ den=^$(q.ham q.q.ham)
:: ?~(den ~ [~ u.den ~])
:: =+ mur=$(p.q.ham t.p.q.ham, lum +.lum)
:: ?~(mur ~ [~ [[%leaf (rip 3 i.p.q.ham)] u.mur]])
[~ (dial ham)]
::
2015-12-04 18:16:34 +03:00
{$face *}
2013-09-29 00:21:18 +04:00
=+ wal=$(q.ham q.q.ham)
?~ wal
~
[~ %palm [['=' ~] ~ ~ ~] [%leaf (trip p.q.ham)] u.wal ~]
::
2015-12-04 18:16:34 +03:00
{$list *}
2013-09-29 00:21:18 +04:00
?: =(~ lum)
[~ %leaf '~' ~]
=- ?~ tok
~
2013-09-29 00:21:18 +04:00
[~ %rose [[' ' ~] ['~' '[' ~] [']' ~]] u.tok]
^= tok
|- ^- (unit (list tank))
?: ?=(@ lum)
?.(=(~ lum) ~ [~ ~])
=+ [for=^$(q.ham q.q.ham, lum -.lum) aft=$(lum +.lum)]
?. &(?=(^ for) ?=(^ aft))
~
[~ u.for u.aft]
::
2015-12-04 18:16:34 +03:00
{$pick *}
2013-09-29 00:21:18 +04:00
|- ^- (unit tank)
?~ p.q.ham
~
=+ wal=^$(q.ham i.p.q.ham)
?~ wal
$(p.q.ham t.p.q.ham)
wal
::
2015-12-04 18:16:34 +03:00
{$plot *}
=- ?~ tok
~
2013-09-29 00:21:18 +04:00
[~ %rose [[' ' ~] ['[' ~] [']' ~]] u.tok]
^= tok
|- ^- (unit (list tank))
?~ p.q.ham
~
2015-12-08 04:46:28 +03:00
?: ?=({* $~} p.q.ham)
2013-09-29 00:21:18 +04:00
=+ wal=^$(q.ham i.p.q.ham)
?~(wal ~ [~ [u.wal ~]])
?@ lum
~
=+ gim=^$(q.ham i.p.q.ham, lum -.lum)
2013-09-29 00:21:18 +04:00
?~ gim
~
=+ myd=$(p.q.ham t.p.q.ham, lum +.lum)
?~ myd
~
[~ u.gim u.myd]
::
2015-12-04 18:16:34 +03:00
{$pear *}
2013-09-29 00:21:18 +04:00
?. =(lum q.q.ham)
~
2015-07-28 01:39:36 +03:00
=. p.q.ham
(rash p.q.ham ;~(sfix (cook crip (star low)) (star hig)))
2015-12-27 06:42:45 +03:00
=+ fox=$(q.ham [%mato p.q.ham])
2015-12-08 04:23:27 +03:00
?> ?=({$~ $leaf ^} fox)
?: ?=(?($n $tas) p.q.ham)
2015-07-28 01:39:36 +03:00
fox
[~ %leaf '%' p.u.fox]
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$stop *}
2014-03-05 23:00:27 +04:00
?: (~(has in gil) [p.q.ham lum]) ~
2013-09-29 00:21:18 +04:00
=+ kep=(~(get by p.ham) p.q.ham)
?~ kep
~|([%stop-loss p.q.ham] !!)
2014-03-05 23:00:27 +04:00
$(gil (~(put in gil) [p.q.ham lum]), q.ham u.kep)
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$tree *}
=- ?~ tok
~
2013-09-29 00:21:18 +04:00
[~ %rose [[' ' ~] ['{' ~] ['}' ~]] u.tok]
^= tok
=+ tuk=*(list tank)
|- ^- (unit (list tank))
?: =(~ lum)
[~ tuk]
2015-12-20 23:50:45 +03:00
?. ?=({n/* l/* r/*} lum)
2013-09-29 00:21:18 +04:00
~
=+ rol=$(lum r.lum)
?~ rol
~
=+ tim=^$(q.ham q.q.ham, lum n.lum)
?~ tim
~
$(lum l.lum, tuk [u.tim u.rol])
::
2015-12-04 18:16:34 +03:00
{$unit *}
2013-09-29 00:21:18 +04:00
?@ lum
?.(=(~ lum) ~ [~ %leaf '~' ~])
?. =(~ -.lum)
~
=+ wal=$(q.ham q.q.ham, lum +.lum)
?~ wal
~
[~ %rose [[' ' ~] ['[' ~] [']' ~]] [%leaf '~' ~] u.wal ~]
==
::
++ doge
2015-12-20 23:50:45 +03:00
|= ham/calf
2013-09-29 00:21:18 +04:00
=- ?+ woz woz
2015-12-27 06:42:45 +03:00
{$list * {$mato $'ta'}} %path
{$list * {$mato $'t'}} %wall
{$list * {$mato $'tD'}} %yarn
2015-12-04 18:16:34 +03:00
{$list * $yarn} %wool
2013-09-29 00:21:18 +04:00
==
^= woz
^- wine
2015-12-08 04:23:27 +03:00
?. ?=({$stop *} q.ham)
2015-12-04 18:16:34 +03:00
?: ?& ?= {$pick {$pear $n $0} {$plot {$pear $n $0} {$face *} $~} $~}
2013-09-29 00:21:18 +04:00
q.ham
=(1 (met 3 p.i.t.p.i.t.p.q.ham))
==
[%unit =<([p q] i.t.p.i.t.p.q.ham)]
q.ham
=+ may=(~(get by p.ham) p.q.ham)
?~ may
q.ham
2015-12-04 18:16:34 +03:00
?. ?& ?=({$pick *} u.may)
2013-09-29 00:21:18 +04:00
?=(^ p.u.may)
=([%pear %n 0] i.p.u.may)
==
q.ham
2015-12-04 18:16:34 +03:00
?: ?& ?=({{$plot {$face *} {$face * $stop *} $~} $~} t.p.u.may)
2013-09-29 00:21:18 +04:00
=(p.q.ham p.q.i.t.p.i.t.p.u.may)
=(1 (met 3 p.i.p.i.t.p.u.may))
=(1 (met 3 p.i.t.p.i.t.p.u.may))
==
:+ %list
(cat 3 p.i.p.i.t.p.u.may p.i.t.p.i.t.p.u.may)
q.i.p.i.t.p.u.may
2015-12-14 10:58:14 +03:00
?: ?& ?= $: $: $plot
2015-12-04 18:16:34 +03:00
{$face *}
{$face * $stop *}
{{$face * $stop *} $~}
2013-12-15 10:27:48 +04:00
==
2015-12-08 05:04:19 +03:00
$~
2013-12-15 10:27:48 +04:00
==
2013-09-29 00:21:18 +04:00
t.p.u.may
=(p.q.ham p.q.i.t.p.i.t.p.u.may)
=(p.q.ham p.q.i.t.t.p.i.t.p.u.may)
=(1 (met 3 p.i.p.i.t.p.u.may))
=(1 (met 3 p.i.t.p.i.t.p.u.may))
=(1 (met 3 p.i.t.t.p.i.t.p.u.may))
==
:+ %tree
%^ cat
3
p.i.p.i.t.p.u.may
2013-09-29 00:21:18 +04:00
(cat 3 p.i.t.p.i.t.p.u.may p.i.t.t.p.i.t.p.u.may)
q.i.p.i.t.p.u.may
q.ham
::
++ dole
^- calf
2015-12-26 13:07:50 +03:00
=+ gil=*(set span)
=+ dex=[p=*(map span @) q=*(map @ wine)]
2013-09-29 00:21:18 +04:00
=< [q.p q]
2015-12-26 13:07:50 +03:00
|- ^- {p/{p/(map span @) q/(map @ wine)} q/wine}
2013-09-29 00:21:18 +04:00
=- [p.tez (doge q.p.tez q.tez)]
^= tez
2015-12-26 13:07:50 +03:00
^- {p/{p/(map span @) q/(map @ wine)} q/wine}
:: ?: (~(meet ut sut) -:!>(*span))
:: [dex %span]
2013-09-29 00:21:18 +04:00
?- sut
2015-12-04 18:16:34 +03:00
$noun [dex sut]
$void [dex sut]
{$atom *} [dex ?~(q.sut [%mato p.sut] [%pear p.sut u.q.sut])]
2015-12-04 18:16:34 +03:00
{$cell *}
=+ hin=$(sut p.sut)
2013-09-29 00:21:18 +04:00
=+ yon=$(dex p.hin, sut q.sut)
:- p.yon
:- %plot
2015-12-04 18:16:34 +03:00
?:(?=({$plot *} q.yon) [q.hin p.q.yon] [q.hin q.yon ~])
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$core *}
2013-09-29 00:21:18 +04:00
=+ yad=$(sut p.sut)
:- p.yad
2015-12-20 23:50:45 +03:00
=+ ^= doy ^- {p/(list @ta) q/wine}
2015-12-04 18:16:34 +03:00
?: ?=({$core *} q.yad)
2013-09-29 00:21:18 +04:00
[p.q.yad q.q.yad]
[~ q.yad]
:- %core
:_ q.doy
:_ p.doy
%^ cat 3
%~ rent co
:+ %$ %ud
|- ^- @
?- q.r.q.sut
$~ 0
{* $~ $~} 1
{* $~ *} +($(q.r.q.sut r.q.r.q.sut))
{* * $~} +($(q.r.q.sut l.q.r.q.sut))
{* * *} .+ %+ add
$(q.r.q.sut l.q.r.q.sut)
$(q.r.q.sut r.q.r.q.sut)
== ==
2013-09-29 00:21:18 +04:00
%^ cat 3
2015-12-04 18:16:34 +03:00
?-(p.q.sut $gold '.', $iron '|', $lead '?', $zinc '&')
2013-09-29 00:21:18 +04:00
=+ gum=(mug q.r.q.sut)
%+ can 3
:~ [1 (add 'a' (mod gum 26))]
[1 (add 'a' (mod (div gum 26) 26))]
[1 (add 'a' (mod (div gum 676) 26))]
==
::
2015-12-04 18:16:34 +03:00
{$face *}
2013-09-29 00:21:18 +04:00
=+ yad=$(sut q.sut)
2015-12-27 08:43:40 +03:00
?^(p.sut yad [p.yad [%face p.sut q.yad]])
2013-09-29 00:21:18 +04:00
::
{$fork *}
=+ yed=(~(tap in p.sut))
=- [p [%pick q]]
|- ^- {p/{p/(map span @) q/(map @ wine)} q/(list wine)}
?~ yed
[dex ~]
=+ mor=$(yed t.yed)
=+ dis=^$(dex p.mor, sut i.yed)
[p.dis q.dis q.mor]
::
{$frog *}
=- [p [%pick q]]
|- ^- {p/{p/(map span @) q/(map @ wine)} q/(list wine)}
?~ p.sut
[dex ~]
=+ mor=$(p.sut t.p.sut)
=+ dis=^$(dex p.mor, sut i.p.sut)
[p.dis q.dis q.mor]
2013-09-29 00:21:18 +04:00
::
2016-01-11 10:04:34 +03:00
{$hold *}
2013-09-29 00:21:18 +04:00
=+ hey=(~(get by p.dex) sut)
?^ hey
[dex [%stop u.hey]]
?: (~(has in gil) sut)
=+ dyr=+(~(wyt by p.dex))
2013-09-29 00:21:18 +04:00
[[(~(put by p.dex) sut dyr) q.dex] [%stop dyr]]
=+ rom=$(gil (~(put in gil) sut), sut ~(repo ut sut))
2013-09-29 00:21:18 +04:00
=+ rey=(~(get by p.p.rom) sut)
?~ rey
rom
[[p.p.rom (~(put by q.p.rom) u.rey q.rom)] [%stop u.rey]]
==
::
++ duck (dial dole)
--
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2fD, compilation proper ::
::
++ ut
~% %ut
+>+
==
%fan fan
%rib rib
%vet vet
%fab fab
%burn burn
%busk busk
%crop crop
%duck duck
%dune dune
%dunk dunk
2016-01-08 23:22:42 +03:00
%epla epla
%emin emin
%emul emul
%fire fire
%fish fish
%fuse fuse
%gain gain
%lose lose
%mint mint
%moot moot
%mull mull
%nest nest
%play play
%peek peek
%repo repo
%rest rest
%tack tack
%toss toss
%wrap wrap
==
=+ :* fan=*(set {span twig})
rib=*(set {span span twig})
vet=`?`&
fab=`?`&
==
=+ sut=`span`%noun
|%
::++ burn
:: =+ gil=*(set span)
:: |- ^- *
:: ?- sut
:: {$atom *} ?~(q.sut 0 u.q.sut)
:: {$cell *} [$(sut p.sut) $(sut q.sut)]
:: {$core *} [p.r.q.sut $(sut p.sut)]
:: {$face *} $(sut repo)
:: {$fork *} $(sut -.p.sut)
:: {$frog *} $(sut -.p.sut)
:: {$hold *} ?: (~(has in gil) sut)
:: ~_ (dunk %span)
:: ~|(%burn-loop !!)
:: $(sut repo, gil (~(put in gil) sut))
:: $noun 0
:: $void ~|(%burn-void !!)
:: ==
++ burn
=+ gil=*(set span)
~| %burn
%- need
|- ^- (unit)
?- sut
{$atom *} `?~(q.sut 0 u.q.sut)
{$cell *} %+ biff $(sut p.sut)
|=(* (biff ^$(sut q.sut) |=(* `[+>+< +<])))
{$core *} (biff $(sut p.sut) |=(* `[p.r.q.sut +<]))
{$face *} $(sut repo)
{$fork *} =+ yed=(~(tap in p.sut))
|- ^- (unit)
?~ yed ~
=+ [dis=^$(sut i.yed) mor=$(yed t.yed)]
?~ dis mor
?~ mor dis
?: =(.?(u.mor) .?(u.dis))
?:((gor u.mor u.dis) mor dis)
?@(u.mor mor dis)
{$frog *} $(sut -.p.sut)
2016-01-11 10:04:34 +03:00
{$hold *} ?: (~(has in gil) sut)
~
$(sut repo, gil (~(put in gil) sut))
$noun `0
$void ~
==
::
++ busk
~/ %busk
|= {cog/term hyp/wing}
^- span
2015-12-27 09:18:59 +03:00
(face [[[cog hyp] ~ ~] ~ ~] sut)
::
++ conk
|= got/toga
^- span
?@ got [%face got sut]
?- -.got
$0 sut
$1 [%face p.got $(got q.got)]
$2 ?> |(!vet (nest(sut [%cell %noun %noun]) & sut))
:+ %cell
$(got p.got, sut (peek %both 2))
$(got q.got, sut (peek %both 3))
==
::
++ crop
~/ %crop
|= ref/span
=+ bix=*(set {span span})
=< dext
|%
++ dext
^- span
2016-01-03 09:20:24 +03:00
~| %crop
:: ~_ (dunk 'dext: sut')
:: ~_ (dunk(sut ref) 'dext: ref')
?: |(=(sut ref) =(%noun ref))
%void
?: =(%void ref)
sut
?- sut
2015-12-28 00:11:01 +03:00
{$atom *}
2016-01-03 09:20:24 +03:00
?+ ref sint
{$atom *} ?^ q.sut
?^(q.ref ?:(=(q.ref q.sut) %void sut) %void)
?^(q.ref sut %void)
{$cell *} sut
2015-12-28 00:11:01 +03:00
==
::
{$cell *}
2016-01-03 09:20:24 +03:00
?+ ref sint
2015-12-28 00:11:01 +03:00
{$atom *} sut
2016-01-03 09:20:24 +03:00
{$cell *} ?. (nest(sut p.ref) | p.sut) sut
(cell p.sut dext(sut q.sut, ref q.ref))
==
::
2016-01-03 09:20:24 +03:00
{$core *} ?:(?=(?({$atom *} {$cell *}) ref) sut sint)
{$face *} (face p.sut dext(sut q.sut))
{$fork *} (frog (turn (~(tap in p.sut)) |=(span dext(sut +<))))
{$frog *} (frog (turn p.sut |=(span dext(sut +<))))
2016-01-11 10:04:34 +03:00
{$hold *} ?< (~(has in bix) [sut ref])
2016-01-03 09:20:24 +03:00
dext(sut repo, bix (~(put in bix) [sut ref]))
$noun dext(sut repo)
$void %void
==
::
++ sint
^- span
2016-01-03 09:20:24 +03:00
?+ ref !!
{$core *} sut
{$face *} dext(ref repo(sut ref))
{$fork *} =+ yed=(~(tap in p.ref))
|- ^- span
?~ yed sut
$(yed t.yed, sut dext(ref i.yed))
{$frog *} |- ^- span
?~ p.ref sut
$(p.ref t.p.ref, sut dext(ref i.p.ref))
2016-01-11 10:04:34 +03:00
{$hold *} dext(ref repo(sut ref))
==
--
::
++ cool
|= {pol/? hyp/wing ref/span}
^- span
=+ fid=(find %both hyp)
?- -.fid
$| sut
$& =< q
%+ take p.p.fid
|=(a/span ?:(pol (fuse(sut a) ref) (crop(sut a) ref)))
==
::
++ duck ^-(tank ~(duck us sut))
2013-12-05 02:30:09 +04:00
++ dune |.(duck)
2013-09-29 00:21:18 +04:00
++ dunk
2015-12-20 23:50:45 +03:00
|= paz/term ^- tank
2013-09-29 00:21:18 +04:00
:+ %palm
[['.' ~] ['-' ~] ~ ~]
2015-12-23 07:12:56 +03:00
[[%leaf (mesc (trip paz))] duck ~]
::
2016-01-08 23:22:42 +03:00
++ et
|_ {hyp/wing rig/(list (pair wing twig))}
++ play
2016-01-10 03:22:25 +03:00
~| %play-cents
2016-01-08 23:22:42 +03:00
^- span
=+ lar=(seek hyp)
2016-01-10 03:22:25 +03:00
?: ?=($| -.lar) ?>(?=($~ rig) p.p.lar)
2016-01-08 23:22:42 +03:00
%- fire
|- ^- (list {p/span q/foot})
?~ rig
2016-01-10 03:22:25 +03:00
r.p.lar
$(rig t.rig, r.p.lar q:(toss p.i.rig (^play q.i.rig) r.p.lar))
2016-01-08 23:22:42 +03:00
::
2016-01-10 03:22:25 +03:00
++ mint
2016-01-10 00:20:41 +03:00
|= gol/span
2016-01-10 03:22:25 +03:00
~| %mint-cents
^- (pair span nock)
=+ lar=(seek hyp)
2016-01-10 03:22:25 +03:00
?: ?=($| -.lar) ?>(?=($~ rig) p.lar)
=- ?>(?|(!vet (nest(sut gol) & p.toc)) toc)
=| hej/(list (pair axis nock))
|- ^- toc/(pair span nock)
2016-01-08 23:22:42 +03:00
?~ rig
2016-01-10 03:22:25 +03:00
:- (fire r.p.lar)
=+((hike p.p.lar hej) ?~(q.p.lar - [%9 u.q.p.lar -]))
2016-01-08 23:22:42 +03:00
=+ zil=(^mint %noun q.i.rig)
2016-01-10 03:22:25 +03:00
=+ wip=(toss p.i.rig p.zil r.p.lar)
$(rig t.rig, r.p.lar q.wip, hej [[p.wip q.zil] hej])
2016-01-08 23:22:42 +03:00
::
++ mull
|= {gol/span dox/span}
^- {span span}
2016-01-10 03:22:25 +03:00
~| %mull-cents
=+ lar=(seek hyp)
=+ vug=(seek(sut dox) hyp)
2016-01-10 03:22:25 +03:00
?. &(?=($& -.lar) ?=($& -.vug))
?> &(?=($| -.lar) ?=($| -.vug) =(q.p.lar q.p.vug))
?>(?=($~ rig) [p.p.lar p.p.vug])
?> &(=(p.p.lar p.p.vug) =(q.p.lar q.p.vug))
2016-01-08 23:22:42 +03:00
=- :- =+ typ=(fire p.muy)
?>(?|(!vet (nest(sut gol) & typ)) typ)
(fire(vet |) q.muy)
^= muy
|- ^- {p/(list {p/span q/foot}) q/(list {p/span q/foot})}
?~ rig
2016-01-10 03:22:25 +03:00
[r.p.lar r.p.vug]
2016-01-08 23:22:42 +03:00
=+ zil=(^mull %noun dox q.i.rig)
2016-01-10 03:22:25 +03:00
=+ cuf=(toss p.i.rig p.zil r.p.lar)
=+ dof=(toss p.i.rig q.zil r.p.vug)
?> =(p.cuf p.dof)
$(rig t.rig, r.p.lar q.cuf, r.p.vug q.dof)
2016-01-08 23:22:42 +03:00
--
::
++ epla
~/ %epla
|= {hyp/wing rig/(list (pair wing twig))}
^- span
~(play et hyp rig)
::
++ emin
~/ %emin
|= {gol/span hyp/wing rig/(list (pair wing twig))}
^- (pair span nock)
(~(mint et hyp rig) gol)
::
++ emul
~/ %emul
|= {gol/span dox/span hyp/wing rig/(list (pair wing twig))}
^- (pair span span)
(~(mull et hyp rig) gol dox)
2016-01-08 23:22:42 +03:00
::
2015-12-26 14:44:32 +03:00
++ find
2016-01-03 09:20:24 +03:00
|= {way/vial hyp/wing}
2015-12-27 07:39:38 +03:00
~+
2015-12-25 11:26:07 +03:00
=| nol/vein
|- ^- pony
2015-12-23 07:12:56 +03:00
?~ hyp
[%& nol %& sut]
=+ mor=$(hyp t.hyp)
?- -.mor
$|
?- -.p.mor
$& mor
2015-12-23 07:12:56 +03:00
$|
=+ fex=(mint(sut p.p.p.mor) %noun [%cnts [i.hyp ~] ~])
[%| %| p.fex (comb q.p.p.mor q.fex)]
==
::
$&
=> :_ +
:* axe=`axis`1
lon=p.p.mor
2015-12-23 07:12:56 +03:00
heg=?^(i.hyp i.hyp [%| p=0 q=(some i.hyp)])
2015-12-26 13:07:50 +03:00
^- ref/span
2015-12-23 07:12:56 +03:00
?- -.q.p.mor
$& p.q.p.mor
$| %- fire
2015-12-23 07:12:56 +03:00
%+ turn (~(tap in q.q.p.mor))
2015-12-26 13:07:50 +03:00
|= {a/span b/foot}
[a [%ash %$ 1]]
2015-12-23 07:12:56 +03:00
==
==
?: ?=($& -.heg)
[%& [`p.heg lon] %& (peek(sut ref) way p.heg)]
2015-12-26 13:07:50 +03:00
=| gil/(set span)
2015-12-23 07:12:56 +03:00
=< $
2016-01-04 03:59:09 +03:00
|% ++ here ?: =(0 p.heg)
[%& [~ `axe lon] %& ref]
[%| %& (dec p.heg)]
2016-01-03 09:20:24 +03:00
++ lose [%| %& p.heg]
++ stop ?~(q.heg here lose)
++ fake !!
++ twin |= {hax/pony yor/pony}
~| %find-fork
?: ?=($| -.hax)
?>(=(hax yor) hax)
?< ?=($| -.yor)
?> =(p.p.hax p.p.yor)
:+ %& p.p.hax
?: &(?=($& -.q.p.hax) ?=($& -.q.p.yor))
[%& (frog p.q.p.hax p.q.p.yor ~)]
?> &(?=($| -.q.p.hax) ?=($| -.q.p.yor))
?> =(p.q.p.hax p.q.p.yor)
[%| p.q.p.hax (~(uni by q.q.p.hax) q.q.p.yor)]
2016-01-03 09:20:24 +03:00
++ $
^- pony
2015-12-23 07:12:56 +03:00
?- ref
2016-01-04 03:59:09 +03:00
$void stop
2015-12-23 07:12:56 +03:00
$noun stop
2015-12-28 00:11:01 +03:00
{$atom *} stop
2015-12-23 07:12:56 +03:00
{$cell *}
?~ q.heg here
=+ taf=$(axe (peg axe 2), ref p.ref)
?: |(?=($& -.taf) ?=($| -.p.taf))
taf
2015-12-23 11:03:53 +03:00
$(axe (peg axe 3), p.heg p.p.taf, ref q.ref)
2015-12-23 07:12:56 +03:00
::
{$core *}
?~ q.heg here
=^ zem p.heg
=+ zem=(look u.q.heg q.r.q.ref)
?~ zem [~ p.heg]
2015-12-23 11:03:53 +03:00
?:(=(0 p.heg) [zem 0] [~ (dec p.heg)])
2015-12-23 07:12:56 +03:00
?^ zem
:+ %& [`axe lon]
[%| (peg 2 p.u.zem) [[ref(p.q %gold) q.u.zem] ~ ~]]
2015-12-26 14:44:32 +03:00
=+ pec=(perk way p.q.ref)
?. sam.pec lose
?: con.pec $(ref p.ref, axe (peg axe 3))
2015-12-24 11:20:22 +03:00
$(ref (peek(sut p.ref) way 2), axe (peg axe 6))
2015-12-23 07:12:56 +03:00
::
{$face *}
2015-12-27 08:43:40 +03:00
?@ p.ref
?: |(?=($~ q.heg) =(u.q.heg p.ref))
?. =(0 p.heg)
[%| %& (dec p.heg)]
[%& [~ `axe lon] %& q.ref]
lose
?~ q.heg
2015-12-23 07:12:56 +03:00
?. =(0 p.heg)
[%| %& (dec p.heg)]
[%& [~ `axe lon] %& q.ref]
2015-12-27 08:43:40 +03:00
?: (~(has in q.p.ref) u.q.heg)
lose
=^ hit p.heg
=+ hit=(~(get by p.p.ref) u.q.heg)
?~ hit [~ p.heg]
?: =(0 p.heg) [hit 0] [~ (dec p.heg)]
?~ hit
$(ref q.ref, axe 1, lon [~ `axe lon])
^$(sut q.ref, hyp u.hit, nol [~ `axe lon])
2015-12-23 07:12:56 +03:00
::
{$fork *}
=+ yed=(~(tap in p.ref))
=+ ^= wiz |- ^- (list pony)
?~ yed ~
=+ mor=$(yed t.yed)
?: (~(has in gil) i.yed) mor
[^$(ref i.yed) mor]
?~ wiz [%| %& p.heg]
|- ^- pony
?~ t.wiz i.wiz
(twin i.wiz $(wiz t.wiz))
::
{$frog *}
=+ ^= wiz |- ^- (list pony)
?~ p.ref ~
=+ mor=$(p.ref t.p.ref)
?: (~(has in gil) i.p.ref) mor
[^$(ref i.p.ref) mor]
?~ wiz [%| %& p.heg]
|- ^- pony
?~ t.wiz i.wiz
(twin i.wiz $(wiz t.wiz))
2015-12-23 07:12:56 +03:00
::
2016-01-11 10:04:34 +03:00
{$hold *}
2015-12-23 07:12:56 +03:00
?: (~(has in gil) ref)
[%| %& p.heg]
2015-12-23 11:03:53 +03:00
$(gil (~(put in gil) ref), ref repo(sut ref))
2015-12-23 07:12:56 +03:00
==
--
==
2013-09-29 00:21:18 +04:00
::
++ fire
2015-12-26 13:07:50 +03:00
|= hag/(list {p/span q/foot})
^- span
2015-12-08 04:23:27 +03:00
?: ?=({{* {$elm $~ $1}} $~} hag)
2013-09-29 00:21:18 +04:00
p.i.hag
2016-01-11 09:37:59 +03:00
%- frog
2013-09-29 00:21:18 +04:00
%+ turn
hag.$
2015-12-26 13:07:50 +03:00
|= {p/span q/foot}
2016-01-11 10:04:34 +03:00
:- %hold
2015-12-04 18:16:34 +03:00
?. ?=({$core *} p)
~_ (dunk %fire-span)
2013-09-29 00:21:18 +04:00
~|(%fire-core !!)
=+ dox=[%core q.q.p q.p]
2015-12-04 18:16:34 +03:00
?: ?=($ash -.q)
2013-09-29 00:21:18 +04:00
~| %fire-ash
2014-01-05 02:57:44 +04:00
:: ~_ (dunk(sut [%cell q.q.p p.p]) %fire-dry)
2013-09-29 00:21:18 +04:00
?> ?|(!vet (nest(sut q.q.p) & p.p))
[dox p.q]
~| [%fire-odd -.q]
2015-12-04 18:16:34 +03:00
?> ?=($elm -.q)
2013-09-29 00:21:18 +04:00
~| %fire-elm
2014-01-05 02:57:44 +04:00
:: ~_ (dunk(sut [%cell q.q.p p.p]) %fire-wet)
?> ?| !vet
2013-09-29 00:21:18 +04:00
(~(has in rib) [sut dox p.q])
2016-01-08 23:22:42 +03:00
!=(~ (mull(sut p, rib (~(put in rib) [sut dox p.q])) %noun dox p.q))
2013-09-29 00:21:18 +04:00
==
[p p.q]
::
++ fish
~/ %fish
2015-12-20 23:50:45 +03:00
|= axe/axis
2015-12-26 13:07:50 +03:00
=+ vot=*(set span)
2013-12-26 21:12:07 +04:00
|- ^- nock
2013-09-29 00:21:18 +04:00
?- sut
2015-12-04 18:16:34 +03:00
$void [%1 1]
$noun [%1 0]
2015-12-28 23:53:10 +03:00
{$atom *} ?~ q.sut
(flip [%3 %0 axe])
[%5 [%1 u.q.sut] [%0 axe]]
2015-12-04 18:16:34 +03:00
{$cell *}
2013-09-29 00:21:18 +04:00
%+ flan
[%3 %0 axe]
(flan $(sut p.sut, axe (peg axe 2)) $(sut q.sut, axe (peg axe 3)))
::
2015-12-04 18:16:34 +03:00
{$core *} [%0 0]
{$face *} $(sut q.sut)
{$fork *} =+ yed=(~(tap in p.sut))
|- ^- nock
?~(yed [%1 1] (flor ^$(sut i.yed) $(yed t.yed)))
{$frog *} |- ^- nock
?~(p.sut [%1 1] (flor ^$(sut i.p.sut) $(p.sut t.p.sut)))
2016-01-11 10:04:34 +03:00
{$hold *}
2013-09-29 00:21:18 +04:00
?: (~(has in vot) sut)
[%0 0]
=> %=(. vot (~(put in vot) sut))
$(sut repo)
==
::
++ fuse
~/ %fuse
2015-12-26 13:07:50 +03:00
|= ref/span
=+ bix=*(set {span span})
|- ^- span
2013-09-29 00:21:18 +04:00
?: ?|(=(sut ref) =(%noun ref))
sut
?- sut
2015-12-28 00:11:01 +03:00
{$atom *}
?- ref
{$atom *} =+ foc=?:((fitz p.ref p.sut) p.sut p.ref)
?^ q.sut
?^ q.ref
?: =(q.sut q.ref)
[%atom foc q.sut]
%void
[%atom foc q.sut]
[%atom foc q.ref]
2015-12-04 18:16:34 +03:00
{$cell *} %void
2013-09-29 00:21:18 +04:00
* $(sut ref, ref sut)
==
2015-12-04 18:16:34 +03:00
{$cell *}
2013-09-29 00:21:18 +04:00
?- ref
2015-12-04 18:16:34 +03:00
{$cell *} (cell $(sut p.sut, ref p.ref) $(sut q.sut, ref q.ref))
2013-09-29 00:21:18 +04:00
* $(sut ref, ref sut)
==
::
{$core *} $(sut repo)
{$face *} (face p.sut $(sut q.sut))
{$fork *} (frog (turn (~(tap in p.sut)) |=(span ^$(sut +<))))
{$frog *} (frog (turn p.sut |=(span ^$(sut +<))))
2016-01-11 10:04:34 +03:00
{$hold *}
2013-09-29 00:21:18 +04:00
?: (~(has in bix) [sut ref])
~|(%fuse-loop !!)
2015-12-26 12:54:42 +03:00
$(sut repo, bix (~(put in bix) [sut ref]))
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
$noun ref
$void %void
2013-09-29 00:21:18 +04:00
==
::
++ gain
~/ %gain
2015-12-26 13:07:50 +03:00
|= gen/twig ^- span
2013-09-29 00:21:18 +04:00
(chip & gen)
::
++ harp
2015-12-20 23:50:45 +03:00
|= dab/(map term foot)
2015-12-08 05:04:19 +03:00
^- ?($~ ^)
?: ?=($~ dab)
2013-09-29 00:21:18 +04:00
~
=+ ^= vad
2015-12-27 09:42:53 +03:00
?- -.q.n.dab
2015-12-04 18:16:34 +03:00
$ash q:(mint %noun p.q.n.dab)
$elm q:(mint(vet |) %noun p.q.n.dab)
2013-09-29 00:21:18 +04:00
==
?- dab
2015-12-04 18:16:34 +03:00
{* $~ $~} vad
{* $~ *} [vad $(dab r.dab)]
{* * $~} [vad $(dab l.dab)]
{* * *} [vad $(dab l.dab) $(dab r.dab)]
2013-09-29 00:21:18 +04:00
==
::
++ lose
~/ %lose
2015-12-26 13:07:50 +03:00
|= gen/twig ^- span
2013-09-29 00:21:18 +04:00
(chip | gen)
::
++ chip
~/ %chip
2015-12-26 13:07:50 +03:00
|= {how/? gen/twig} ^- span
2015-12-14 08:05:59 +03:00
?: ?=({$wtts *} gen)
(cool how q.gen (play ~(bunt al [%herb p.gen])))
2015-12-26 04:09:27 +03:00
?: ?&(how ?=({$wtpm *} gen))
2013-12-31 23:30:37 +04:00
|-(?~(p.gen sut $(p.gen t.p.gen, sut ^$(gen i.p.gen))))
2015-12-26 04:09:27 +03:00
?: ?&(!how ?=({$wtbr *} gen))
2013-12-31 23:30:37 +04:00
|-(?~(p.gen sut $(p.gen t.p.gen, sut ^$(gen i.p.gen))))
2013-09-29 00:21:18 +04:00
=+ neg=~(open ap gen)
?:(=(neg gen) sut $(gen neg))
::
++ mint
~/ %mint
2015-12-26 13:07:50 +03:00
|= {gol/span gen/twig}
^- {p/span q/nock}
|^ ^- {p/span q/nock}
2015-12-21 08:05:19 +03:00
?: ?&(=(%void sut) !?=({$dbug *} gen))
?. |(!vet ?=({$lost *} gen) ?=({$zpzp *} gen))
2013-09-29 00:21:18 +04:00
~|(%mint-vain !!)
[%void %0 0]
?- gen
::
2015-12-04 18:16:34 +03:00
{^ *}
2013-09-29 00:21:18 +04:00
=+ hed=$(gen p.gen, gol %noun)
=+ tal=$(gen q.gen, gol %noun)
[(nice (cell p.hed p.tal)) (cons q.hed q.tal)]
::
{$brcn *} (grow %gold [%$ 1] p.gen)
2013-09-29 00:21:18 +04:00
::
2016-01-08 23:22:42 +03:00
{$cnts *} (~(mint et p.gen q.gen) gol)
2015-12-04 18:16:34 +03:00
{$dtkt *} [(nice %noun) [%11 q:$(gen p.gen, gol %noun)]]
2015-12-28 00:11:01 +03:00
{$dtls *} [(nice [%atom %$ ~]) [%4 q:$(gen p.gen, gol [%atom %$ ~])]]
2015-12-29 22:52:22 +03:00
{$sand *} [(nice (play gen)) [%1 q.gen]]
2015-12-30 00:52:51 +03:00
{$rock *} [(nice (play gen)) [%1 q.gen]]
2015-12-04 18:16:34 +03:00
{$dttr *}
2013-09-29 00:21:18 +04:00
[(nice %noun) [%2 q:$(gen p.gen, gol %noun) q:$(gen q.gen, gol %noun)]]
::
2015-12-04 18:16:34 +03:00
{$dtts *}
2014-06-02 01:07:13 +04:00
[(nice bool) [%5 q:$(gen p.gen, gol %noun) q:$(gen q.gen, gol %noun)]]
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$dtwt *} [(nice bool) [%3 q:$(gen p.gen, gol %noun)]]
{$ktbr *} =+(vat=$(gen p.gen) [(wrap(sut p.vat) %iron) q.vat])
2014-06-11 18:06:36 +04:00
::
2015-12-04 18:16:34 +03:00
{$ktls *}
2013-09-29 00:21:18 +04:00
=+(hif=(nice (play p.gen)) [hif q:$(gen q.gen, gol hif)])
::
2015-12-04 18:16:34 +03:00
{$ktpm *} =+(vat=$(gen p.gen) [(wrap(sut p.vat) %zinc) q.vat])
{$ktsg *}
2013-09-29 00:21:18 +04:00
=+ nef=$(gen p.gen)
=+ moc=(mink [burn q.nef] |=(* ~))
2015-12-08 05:11:14 +03:00
[p.nef ?:(?=($0 -.moc) [%1 p.moc] q.nef)]
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$ktts *} =+(vat=$(gen q.gen) [(conk(sut p.vat) p.gen) q.vat])
{$ktwt *} =+(vat=$(gen p.gen) [(wrap(sut p.vat) %lead) q.vat])
{$sgzp *} ~_(duck(sut (play p.gen)) $(gen q.gen))
{$sggr *}
2013-09-29 00:21:18 +04:00
=+ hum=$(gen q.gen)
2015-07-17 21:55:32 +03:00
:: ?: &(huz !?=($|(@ [?(%fast %memo) ^]) p.gen))
:: hum
2013-09-29 00:21:18 +04:00
:- p.hum
:+ %10
?- p.gen
@ p.gen
^ [p.p.gen q:$(gen q.p.gen, gol %noun)]
==
q.hum
::
2015-12-04 18:16:34 +03:00
{$tsgr *}
2013-09-29 00:21:18 +04:00
=+ fid=$(gen p.gen, gol %noun)
=+ dov=$(sut p.fid, gen q.gen)
[p.dov (comb q.fid q.dov)]
2013-12-26 21:12:07 +04:00
::
2015-12-04 18:16:34 +03:00
{$tstr *}
2014-01-04 06:59:56 +04:00
$(gen r.gen, sut (busk p.gen q.gen))
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$wtcl *}
2014-06-02 01:07:13 +04:00
=+ nor=$(gen p.gen, gol bool)
2013-09-29 00:21:18 +04:00
=+ fex=(gain p.gen)
=+ wux=(lose p.gen)
=+ ^= duy
?: =(%void fex)
?:(=(%void wux) [%0 0] [%1 1])
?:(=(%void wux) [%1 0] q.nor)
=+ hiq=$(sut fex, gen q.gen)
=+ ran=$(sut wux, gen r.gen)
[(frog p.hiq p.ran ~) (cond duy q.hiq q.ran)]
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$wtts *}
2014-06-02 01:07:13 +04:00
:- (nice bool)
=+ ref=(play ~(bunt al %herb p.gen))
=+ fid=(find %read q.gen)
~| [%find q.gen]
?- -.fid
$& ?>(?=($& -.q.p.fid) (fish(sut ref) (tend p.p.fid)))
$| ?>(?=($| -.p.fid) [%7 q.p.p.fid (fish(sut ref) 1)])
==
2013-09-29 00:21:18 +04:00
::
2015-12-21 08:05:19 +03:00
{$dbug *}
2014-01-05 02:57:44 +04:00
~_ (show %o p.gen)
2013-09-29 00:21:18 +04:00
=+ hum=$(gen q.gen)
[p.hum [%10 [%spot %1 p.gen] q.hum]]
::
2015-12-04 18:16:34 +03:00
{$zpcm *} [(nice (play p.gen)) [%1 q.gen]] :: XX validate!
2015-12-21 08:05:19 +03:00
{$lost *}
?: vet
2014-01-05 02:57:44 +04:00
~_ (dunk(sut (play p.gen)) 'lost')
2013-09-29 00:21:18 +04:00
~|(%mint-lost !!)
[%void [%0 0]]
::
2015-12-04 18:16:34 +03:00
{$zpsm *}
2013-09-29 00:21:18 +04:00
=+ vos=$(gol %noun, gen q.gen) :: XX validate!
2016-01-07 10:08:09 +03:00
2014-01-05 06:05:33 +04:00
:: [(nice (cell (sift (play p.gen)) p.vos)) (cons [%1 p.vos] q.vos)]
2013-09-29 00:21:18 +04:00
[(nice (cell (play p.gen) p.vos)) (cons [%1 p.vos] q.vos)]
::
2015-12-04 18:16:34 +03:00
{$zpts *} [(nice %noun) [%1 q:$(vet |, gen p.gen)]]
{$zpzp $~} [%void [%0 0]]
*
=+ doz=~(open ap gen)
2013-09-29 00:21:18 +04:00
?: =(doz gen)
2014-01-05 02:57:44 +04:00
~_ (show [%c 'hoon'] [%q gen])
2013-09-29 00:21:18 +04:00
~|(%mint-open !!)
$(gen doz)
==
::
++ nice
2015-12-26 13:07:50 +03:00
|= typ/span
2013-09-29 00:21:18 +04:00
~| %mint-nice
?> ?|(!vet (nest(sut gol) & typ))
typ
::
++ grow
2016-01-03 09:20:24 +03:00
|= {mel/vair ruf/twig dab/(map term foot)}
2015-12-26 13:07:50 +03:00
^- {p/span q/nock}
2013-09-29 00:21:18 +04:00
=+ dan=^$(gen ruf, gol %noun)
=+ toc=(core p.dan [%gold p.dan [~ dab]])
=+ dez=(harp(sut toc) dab)
:- (nice (core p.dan mel p.dan [dez dab]))
(cons [%1 dez] q.dan)
--
::
++ moot
2015-12-26 13:07:50 +03:00
=+ gil=*(set span)
2013-09-29 00:21:18 +04:00
|- ^- ?
?- sut
2015-12-28 00:11:01 +03:00
{$atom *} |
2015-12-04 18:16:34 +03:00
{$cell *} |($(sut p.sut) $(sut q.sut))
{$core *} $(sut p.sut)
{$face *} $(sut q.sut)
{$fork *} (lien (~(tap in p.sut)) |=(span ^$(sut +<)))
{$frog *} (lien p.sut |=(span ^$(sut +<)))
2016-01-11 10:04:34 +03:00
{$hold *} |((~(has in gil) sut) $(gil (~(put in gil) sut), sut repo))
2015-12-04 18:16:34 +03:00
$noun |
$void &
2013-09-29 00:21:18 +04:00
==
::
++ mull
~/ %mull
2015-12-26 13:07:50 +03:00
|= {gol/span dox/span gen/twig}
|^ ^- {p/span q/span}
2013-09-29 00:21:18 +04:00
?: =(%void sut)
~|(%mull-none !!)
?- gen
::
2015-12-04 18:16:34 +03:00
{^ *}
2013-09-29 00:21:18 +04:00
=+ hed=$(gen p.gen, gol %noun)
=+ tal=$(gen q.gen, gol %noun)
[(nice (cell p.hed p.tal)) (cell q.hed q.tal)]
::
{$brcn *} (grow %gold [%$ 1] p.gen)
2016-01-08 23:22:42 +03:00
{$cnts *} (~(mull et p.gen q.gen) gol dox)
2015-12-04 18:16:34 +03:00
{$dtkt *} =+($(gen p.gen, gol %noun) (beth %noun))
2015-12-28 00:11:01 +03:00
{$dtls *} =+($(gen p.gen, gol [%atom %$ ~]) (beth [%atom %$ ~]))
2015-12-29 22:52:22 +03:00
{$sand *} (beth (play gen))
2015-12-30 00:52:51 +03:00
{$rock *} (beth (play gen))
2015-12-04 18:16:34 +03:00
{$dttr *}
2014-07-09 11:37:47 +04:00
=+([$(gen p.gen, gol %noun) $(gen q.gen, gol %noun)] (beth %noun))
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$dtts *}
2014-07-09 11:37:47 +04:00
=+([$(gen p.gen, gol %noun) $(gen q.gen, gol %noun)] (beth bool))
2013-09-29 00:21:18 +04:00
::
{$dtwt *} =+($(gen p.gen, gol %noun) (beth bool)) :: XX =|
2015-12-04 18:16:34 +03:00
{$ktbr *}
2013-09-29 00:21:18 +04:00
=+(vat=$(gen p.gen) [(wrap(sut p.vat) %iron) (wrap(sut q.vat) %iron)])
::
2015-12-04 18:16:34 +03:00
{$ktls *}
2013-09-29 00:21:18 +04:00
=+ hif=[p=(nice (play p.gen)) q=(play(sut dox) p.gen)]
=+($(gen q.gen, gol p.hif) hif)
::
2015-12-04 18:16:34 +03:00
{$ktpm *}
2013-09-29 00:21:18 +04:00
=+(vat=$(gen p.gen) [(wrap(sut p.vat) %zinc) (wrap(sut q.vat) %zinc)])
::
2015-12-04 18:16:34 +03:00
{$ktts *}
2013-12-21 05:02:26 +04:00
=+(vat=$(gen q.gen) [(conk(sut p.vat) p.gen) (conk(sut q.vat) p.gen)])
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$ktwt *}
2013-09-29 00:21:18 +04:00
=+(vat=$(gen p.gen) [(wrap(sut p.vat) %lead) (wrap(sut q.vat) %lead)])
::
2015-12-04 18:16:34 +03:00
{$ktsg *} $(gen p.gen)
{$sgzp *} ~_(duck(sut (play p.gen)) $(gen q.gen))
{$sggr *} $(gen q.gen)
{$tsgr *}
2013-09-29 00:21:18 +04:00
=+ lem=$(gen p.gen, gol %noun)
$(gen q.gen, sut p.lem, dox q.lem)
2013-12-26 21:12:07 +04:00
::
2015-12-04 18:16:34 +03:00
{$tstr *}
2013-12-26 21:12:07 +04:00
%= $
gen r.gen
2014-01-04 06:59:56 +04:00
sut (busk p.gen q.gen)
dox (busk(sut dox) p.gen q.gen)
2013-12-26 21:12:07 +04:00
==
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$wtcl *}
2014-06-02 01:07:13 +04:00
=+ nor=$(gen p.gen, gol bool)
2015-12-26 13:07:50 +03:00
=+ ^= hiq ^- {p/span q/span}
2013-09-29 00:21:18 +04:00
=+ fex=[p=(gain p.gen) q=(gain(sut dox) p.gen)]
?: =(%void p.fex)
[%void ?:(=(%void q.fex) %void ~|(%wtcl-z (play(sut q.fex) q.gen)))]
?: =(%void q.fex)
~|(%mull-bonk-b !!)
$(sut p.fex, dox q.fex, gen q.gen)
2015-12-26 13:07:50 +03:00
=+ ^= ran ^- {p/span q/span}
2013-09-29 00:21:18 +04:00
=+ wux=[p=(lose p.gen) q=(lose(sut dox) p.gen)]
?: =(%void p.wux)
[%void ?:(=(%void q.wux) %void ~|(%wtcl-a (play(sut q.wux) r.gen)))]
?: =(%void q.wux)
~|(%mull-bonk-c !!)
$(sut p.wux, dox q.wux, gen r.gen)
[(nice (frog p.hiq p.ran ~)) (frog q.hiq q.ran ~)]
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$wtts *}
2015-12-14 08:05:59 +03:00
=+ nob=~(bunt al %herb p.gen)
2013-12-27 06:43:25 +04:00
=+ waz=[p=(play nob) q=(play(sut dox) nob)]
2015-12-21 08:05:19 +03:00
=+ ^= syx :- p=(cove q:(mint %noun [%wing q.gen]))
q=(cove q:(mint(sut dox) %noun [%wing q.gen]))
2013-09-29 00:21:18 +04:00
=+ pov=[p=(fish(sut p.waz) p.syx) q=(fish(sut q.waz) q.syx)]
?. &(=(p.syx q.syx) =(p.pov q.pov))
~|(%mull-bonk-a !!)
2014-07-09 11:37:47 +04:00
(beth bool)
2013-09-29 00:21:18 +04:00
::
2015-12-21 08:05:19 +03:00
{$dbug *} ~_((show %o p.gen) $(gen q.gen))
2015-12-04 18:16:34 +03:00
{$zpcm *} [(nice (play p.gen)) (play(sut dox) p.gen)]
2015-12-21 08:05:19 +03:00
{$lost *}
?: vet
2014-01-05 02:57:44 +04:00
:: ~_ (dunk(sut (play p.gen)) 'also')
2013-09-29 00:21:18 +04:00
~|(%mull-skip !!)
2014-07-09 11:37:47 +04:00
(beth %void)
2013-09-29 00:21:18 +04:00
::
2015-12-04 18:16:34 +03:00
{$zpts *} (beth %noun)
{$zpsm *}
2013-09-29 00:21:18 +04:00
=+ vos=$(gol %noun, gen q.gen) :: XX validate!
[(nice (cell (play p.gen) p.vos)) (cell (play(sut dox) p.gen) q.vos)]
::
2015-12-04 18:16:34 +03:00
{$zpzp *} (beth %void)
2013-09-29 00:21:18 +04:00
*
=+ doz=~(open ap gen)
2013-09-29 00:21:18 +04:00
?: =(doz gen)
2014-01-05 02:57:44 +04:00
~_ (show [%c 'hoon'] [%q gen])
2013-09-29 00:21:18 +04:00
~|(%mull-open !!)
$(gen doz)
==
::
2014-07-09 11:37:47 +04:00
++ beth
2015-12-26 13:07:50 +03:00
|= typ/span
2013-09-29 00:21:18 +04:00
[(nice typ) typ]
::
++ nice
2015-12-26 13:07:50 +03:00
|= typ/span
2014-01-05 02:57:44 +04:00
:: ~_ (dunk(sut gol) 'need')
:: ~_ (dunk(sut typ) 'have')
2013-09-29 00:21:18 +04:00
~| %mull-nice
?> ?|(!vet (nest(sut gol) & typ))
typ
::
++ grow
2016-01-03 09:20:24 +03:00
|= {mel/vair ruf/twig dab/(map term foot)}
2013-09-29 00:21:18 +04:00
~| %mull-grow
2015-12-26 13:07:50 +03:00
^- {p/span q/span}
2013-09-29 00:21:18 +04:00
=+ dan=^$(gen ruf, gol %noun)
=+ ^= toc :- p=(core p.dan [%gold p.dan [~ dab]])
q=(core q.dan [%gold q.dan [~ dab]])
=+ (bake(sut p.toc, dox q.toc) dab)
:- (nice (core p.dan mel p.dan [[%0 0] dab]))
(core q.dan [mel q.dan [[%0 0] dab]])
::
++ bake
2015-12-20 23:50:45 +03:00
|= dab/(map term foot)
2013-09-29 00:21:18 +04:00
^- *
2015-12-08 05:04:19 +03:00
?: ?=($~ dab)
2013-09-29 00:21:18 +04:00
~
=+ ^= vad
2015-12-27 09:42:53 +03:00
?- -.q.n.dab
2015-12-04 18:16:34 +03:00
$ash ^$(gol %noun, gen p.q.n.dab)
$elm ~
2013-09-29 00:21:18 +04:00
==
2016-01-03 09:20:24 +03:00
?- dab
{* $~ $~} vad
{* $~ *} [vad $(dab r.dab)]
{* * $~} [vad $(dab l.dab)]
{* * *} [vad $(dab l.dab) $(dab r.dab)]
2013-09-29 00:21:18 +04:00
==
--
::
2015-12-26 13:07:50 +03:00
++ meet |=(ref/span &((nest | ref) (nest(sut ref) | sut)))
2016-01-02 01:47:07 +03:00
++ mite |=(ref/span |((nest | ref) (nest(sut ref) | sut)))
++ nest
~/ %nest
2015-12-26 13:07:50 +03:00
|= {tel/? ref/span}
2016-01-02 01:47:07 +03:00
=| $: seg/(set span) :: degenerate sut
reg/(set span) :: degenerate ref
gil/(set {p/span q/span}) :: assume nest
==
2013-09-29 00:21:18 +04:00
=< dext
|%
2016-01-03 09:20:24 +03:00
++ deem
|= {mel/vair ram/vair}
2013-09-29 00:21:18 +04:00
^- ?
2016-01-03 09:20:24 +03:00
?. |(=(mel ram) =(%lead mel) =(%gold ram)) |
?: ?=($lead mel) &
?: ?=($gold mel) meet
=+ vay=?-(mel $iron %rite, $zinc %read)
dext(sut (peek vay 2), ref (peek(sut ref) vay 2))
2013-09-29 00:21:18 +04:00
::
2016-01-03 09:20:24 +03:00
++ deep
2015-12-20 23:50:45 +03:00
|= {dab/(map term foot) hem/(map term foot)}
2013-09-29 00:21:18 +04:00
^- ?
2016-01-03 09:20:24 +03:00
?: ?=($~ dab) =(hem ~)
?: ?=($~ hem) =(dab ~)
?& =(p.n.dab p.n.hem)
$(dab l.dab, hem l.hem)
$(dab r.dab, hem r.hem)
?- -.q.n.dab
$elm =(q.n.dab q.n.hem)
$ash ?& ?=($ash -.q.n.hem)
%= dext
sut (play p.q.n.dab)
ref (play(sut ref) p.q.n.hem)
== == == ==
2013-09-29 00:21:18 +04:00
::
2016-01-02 01:47:07 +03:00
++ dext
2013-09-29 00:21:18 +04:00
^- ?
2016-01-02 01:47:07 +03:00
=- ?: - &
2016-01-03 09:20:24 +03:00
?. tel |
:: ~_ (dunk %need)
:: ~_ (dunk(sut ref) %have)
~|(%nest-fail !!)
2016-01-02 01:47:07 +03:00
?: =(sut ref) &
2016-01-03 09:20:24 +03:00
?- sut
$void sint
$noun &
{$atom *} ?. ?=({$atom *} ref) sint
?& (fitz p.sut p.ref)
|(?=($~ q.sut) =(q.sut q.ref))
==
{$cell *} ?. ?=({$cell *} ref) sint
?& dext(sut p.sut, ref p.ref, seg ~, reg ~)
dext(sut q.sut, ref q.ref, seg ~, reg ~)
==
{$core *} ?. ?=({$core *} ref) sint
?: =(q.sut q.ref) dext(sut p.sut, ref p.ref)
?& meet(sut q.q.sut, ref p.sut)
dext(sut q.q.ref, ref p.ref)
(deem(sut q.q.sut, ref q.q.ref) p.q.sut p.q.ref)
?| (~(has in gil) [sut ref])
%. [q.r.q.sut q.r.q.ref]
%= deep
gil (~(put in gil) [sut ref])
sut sut(p q.q.sut, p.q %gold)
ref ref(p q.q.ref, p.q %gold)
== ==
==
{$face *} dext(sut q.sut)
{$fork *} ?. ?=(?({$atom *} $noun {$cell *} {$core *}) ref) sint
(lien (~(tap in p.sut)) |=(span dext(tel |, sut +<)))
{$frog *} ?. ?=(?({$atom *} $noun {$cell *} {$core *}) ref) sint
(lien p.sut |=(span dext(tel |, sut +<)))
2016-01-11 10:04:34 +03:00
{$hold *} ?: (~(has in seg) sut) |
2016-01-03 09:20:24 +03:00
?: (~(has in gil) [sut ref]) &
%= dext
sut repo
seg (~(put in seg) sut)
gil (~(put in gil) [sut ref])
== ==
::
++ meet &(dext dext(sut ref, ref sut))
2013-09-29 00:21:18 +04:00
++ sint
^- ?
?- ref
2016-01-03 09:20:24 +03:00
$noun |
$void &
{$atom *} |
{$cell *} |
{$core *} dext(ref repo(sut ref))
{$face *} dext(ref q.ref)
{$fork *} (levy (~(tap in p.ref)) |=(span sint(ref +<)))
{$frog *} (levy p.ref |=(span sint(ref +<)))
2016-01-11 10:04:34 +03:00
{$hold *} ?: (~(has in reg) ref) &
2016-01-03 09:20:24 +03:00
?: (~(has in gil) [sut ref]) &
%= dext
ref repo(sut ref)
reg (~(put in reg) ref)
gil (~(put in gil) [sut ref])
== ==
2013-09-29 00:21:18 +04:00
--
::
2015-12-26 14:44:32 +03:00
++ perk
2016-01-03 09:20:24 +03:00
|= {way/vial met/?($gold $iron $lead $zinc)}
2015-12-26 14:44:32 +03:00
^- {sam/? con/?}
?: ?=($gold met) [& &]
?- way
$both [| |]
$free [& &]
$read [?=($zinc met) |]
$rite [?=($iron met) |]
2013-09-29 00:21:18 +04:00
==
::
++ peek
~/ %peek
2015-12-20 23:50:45 +03:00
|= {way/?($read $rite $both $free) axe/axis}
2015-12-26 13:07:50 +03:00
^- span
2013-09-29 00:21:18 +04:00
?: =(1 axe)
sut
=+ [now=(cap axe) lat=(mas axe)]
2015-12-26 13:07:50 +03:00
=+ gil=*(set span)
|- ^- span
2013-09-29 00:21:18 +04:00
?- sut
2015-12-28 00:11:01 +03:00
{$atom *} %void
2015-12-04 18:16:34 +03:00
{$cell *} ?:(=(2 now) ^$(sut p.sut, axe lat) ^$(sut q.sut, axe lat))
{$core *}
2015-12-26 14:44:32 +03:00
?. =(3 now) %noun
=+ pec=(perk way p.q.sut)
%= ^$
axe lat
sut
?: =([& &] pec) p.sut
%+ cell
?.(sam.pec %noun ^$(sut p.sut, axe 2))
?.(con.pec %noun ^$(sut p.sut, axe 3))
==
2013-09-29 00:21:18 +04:00
::
{$fork *} (frog (turn (~(tap in p.sut)) |=(span ^$(sut +<))))
{$frog *} (frog (turn p.sut |=(span ^$(sut +<))))
2016-01-11 10:04:34 +03:00
{$hold *}
?: (~(has in gil) sut)
%void
2013-09-29 00:21:18 +04:00
$(gil (~(put in gil) sut), sut repo)
::
2015-12-04 18:16:34 +03:00
$void %void
$noun %noun
2013-09-29 00:21:18 +04:00
* $(sut repo)
==
::
++ play
2013-09-29 00:21:18 +04:00
~/ %play
=> .(vet |)
2015-12-20 23:50:45 +03:00
|= gen/twig
2015-12-26 13:07:50 +03:00
^- span
2013-09-29 00:21:18 +04:00
?- gen
2015-12-04 18:16:34 +03:00
{^ *} (cell $(gen p.gen) $(gen q.gen))
{$brcn *} (core sut %gold sut [[%0 0] p.gen])
2016-01-10 03:22:25 +03:00
{$cnts *} ~(play et p.gen q.gen)
2015-12-04 18:16:34 +03:00
{$dtkt *} %noun
2015-12-28 00:11:01 +03:00
{$dtls *} [%atom %$ ~]
2015-12-30 00:52:51 +03:00
{$rock *} |- ^- span
?@ q.gen [%atom p.gen `q.gen]
[%cell $(q.gen -.q.gen) $(q.gen +.q.gen)]
{$sand *} |- ^- span
?@ q.gen
?:(=(%f p.gen) ?>((lte q.gen 1) bool) [%atom p.gen ~])
[%cell $(q.gen -.q.gen) $(q.gen +.q.gen)]
2015-12-04 18:16:34 +03:00
{$dttr *} %noun
{$dtts *} bool
{$dtwt *} bool
{$ktbr *} (wrap(sut $(gen p.gen)) %iron)
{$ktls *} $(gen p.gen)
{$ktpm *} (wrap(sut $(gen p.gen)) %zinc)
{$ktsg *} $(gen p.gen)
{$ktts *} (conk(sut $(gen q.gen)) p.gen)
{$ktwt *} (wrap(sut $(gen p.gen)) %lead)
{$sgzp *} ~_(duck(sut ^$(gen p.gen)) $(gen q.gen))
{$sggr *} $(gen q.gen)
{$tsgr *} $(gen q.gen, sut $(gen p.gen))
{$tstr *} $(gen r.gen, sut (busk p.gen q.gen))
{$wtcl *} =+ [fex=(gain p.gen) wux=(lose p.gen)]
%- frog :~
2013-09-29 00:21:18 +04:00
?:(=(%void fex) %void $(sut fex, gen q.gen))
?:(=(%void wux) %void $(sut wux, gen r.gen))
==
2015-12-14 08:05:59 +03:00
{$wtts *} bool
2015-12-21 08:05:19 +03:00
{$dbug *} ~_((show %o p.gen) $(gen q.gen))
2015-12-04 18:16:34 +03:00
{$zpcm *} (play p.gen)
2015-12-21 08:05:19 +03:00
{$lost *} %void
2015-12-04 18:16:34 +03:00
{$zpsm *} (cell $(gen p.gen) $(gen q.gen))
{$zpts *} %noun
{$zpzp *} %void
* =+ doz=~(open ap gen)
2013-09-29 00:21:18 +04:00
?: =(doz gen)
2014-01-05 02:57:44 +04:00
~_ (show [%c 'hoon'] [%q gen])
2013-09-29 00:21:18 +04:00
~|(%play-open !!)
$(gen doz)
==
::
++ repo
2015-12-26 13:07:50 +03:00
^- span
2013-09-29 00:21:18 +04:00
?- sut
2015-12-04 18:16:34 +03:00
{$core *} [%cell %noun p.sut]
{$face *} q.sut
2016-01-11 10:04:34 +03:00
{$hold *} (rest [[p.sut q.sut] ~])
2016-01-13 21:06:42 +03:00
$noun (frog [%atom %$ ~] [%cell %noun %noun] ~)
2013-09-29 00:21:18 +04:00
* ~|(%repo-fltt !!)
==
::
++ rest
~/ %rest
2015-12-26 13:07:50 +03:00
|= leg/(list {p/span q/twig})
^- span
?: (lien leg |=({p/span q/twig} (~(has in fan) [p q])))
2013-09-29 00:21:18 +04:00
~|(%rest-loop !!)
=> .(fan (~(gas in fan) leg))
2016-01-11 07:43:13 +03:00
%- frog
%- %~ tap in
%- ~(gas in *(set span))
(turn leg |=({p/span q/twig} (play(sut p) q)))
==
~
2013-09-29 00:21:18 +04:00
::
++ seek
2016-01-10 03:22:25 +03:00
|= hyp/wing
^- %+ each
(trel axis (unit axis) (list (pair span foot)))
(pair span nock)
=+ fid=(find %read hyp)
?- -.fid
$& :+ %& (tend p.p.fid)
2016-01-10 03:22:25 +03:00
?- -.q.p.fid
$& [~ [`span`p.q.p.fid `foot`[%elm %$ 1]]~]
$| [`p.q.p.fid (~(tap in q.q.p.fid))]
==
$| ?- -.p.fid
$| [%| p.p.fid]
$& ~|([%find hyp] !!)
== ==
2015-12-25 11:26:07 +03:00
::
++ take
2016-01-10 08:32:20 +03:00
|= {vit/vein duz/$+(span span)}
2015-12-26 13:07:50 +03:00
^- (pair axis span)
:- (tend vit)
2015-12-25 11:26:07 +03:00
=. vit (flop vit)
2015-12-26 13:07:50 +03:00
|- ^- span
2015-12-25 11:26:07 +03:00
?~ vit (duz sut)
?~ i.vit
2015-12-26 13:07:50 +03:00
|- ^- span
2016-01-04 03:59:09 +03:00
?+ sut ^$(vit t.vit)
2015-12-25 11:45:53 +03:00
{$face *} (face p.sut ^$(vit t.vit, sut q.sut))
{$fork *} (frog (turn (~(tap in p.sut)) |=(span ^$(sut +<))))
{$frog *} (frog (turn p.sut |=(span ^$(sut +<))))
2016-01-11 10:04:34 +03:00
{$hold *} $(sut repo)
2015-12-25 11:26:07 +03:00
==
2015-12-26 13:07:50 +03:00
=+ vil=*(set span)
|- ^- span
2015-12-25 11:26:07 +03:00
?: =(1 u.i.vit)
^$(vit t.vit)
=+ [now lat]=(cap u.i.vit)^(mas u.i.vit)
?- sut
$noun $(sut [%cell %noun %noun])
2015-12-26 04:09:27 +03:00
$void %void
2015-12-28 00:11:01 +03:00
{$atom *} %void
2015-12-25 11:26:07 +03:00
{$cell *} ?: =(2 now)
2015-12-25 11:45:53 +03:00
(cell $(sut p.sut, u.i.vit lat) q.sut)
(cell p.sut $(sut q.sut, u.i.vit lat))
2016-01-07 10:08:09 +03:00
{$core *} ?: =(2 now)
$(sut repo)
2016-01-07 04:47:03 +03:00
(core $(sut p.sut, u.i.vit lat) q.sut)
2015-12-25 11:45:53 +03:00
{$face *} (face p.sut $(sut q.sut))
{$fork *} (frog (turn (~(tap in p.sut)) |=(span ^$(sut +<))))
{$frog *} (frog (turn p.sut |=(span ^$(sut +<))))
2016-01-11 10:04:34 +03:00
{$hold *} ?: (~(has in vil) sut)
%void
$(sut repo, vil (~(put in vil) sut))
2015-12-25 11:26:07 +03:00
==
2013-12-15 12:23:23 +04:00
::
2013-09-29 00:21:18 +04:00
++ tack
2015-12-26 14:44:32 +03:00
|= {hyp/wing mur/span}
~| [%tack hyp]
=+ fid=(find %rite hyp)
?> ?=($& -.fid)
(take p.p.fid |=(span mur))
::
++ tend
|= vit/vein
^- axis
?~(vit 1 (peg $(vit t.vit) ?~(i.vit 1 u.i.vit)))
2013-09-29 00:21:18 +04:00
::
2015-12-26 14:44:32 +03:00
++ toss
2016-01-08 23:22:42 +03:00
~/ %toss
2015-12-26 14:44:32 +03:00
|= {hyp/wing mur/span men/(list {p/span q/foot})}
2015-12-26 13:07:50 +03:00
^- {p/axis q/(list {p/span q/foot})}
2013-09-29 00:21:18 +04:00
=- [(need p.wib) q.wib]
^= wib
2015-12-26 13:07:50 +03:00
|- ^- {p/(unit axis) q/(list {p/span q/foot})}
2014-06-07 05:09:44 +04:00
?~ men
2013-09-29 00:21:18 +04:00
[*(unit axis) ~]
2015-12-26 14:44:32 +03:00
=+ geq=(tack(sut p.i.men) hyp mur)
2013-09-29 00:21:18 +04:00
=+ mox=$(men t.men)
2015-12-15 01:21:10 +03:00
[(mate p.mox `_p.mox`[~ p.geq]) [[q.geq q.i.men] q.mox]]
2013-09-29 00:21:18 +04:00
::
++ wrap
~/ %wrap
2015-12-20 23:50:45 +03:00
|= yoz/?($lead $iron $zinc)
~| %wrap
2015-12-26 13:07:50 +03:00
^- span
?+ sut sut
{$cell *} (cell $(sut p.sut) $(sut q.sut))
{$core *} ?>(|(=(%gold p.q.sut) =(%lead yoz)) sut(p.q yoz))
{$face *} (face p.sut $(sut q.sut))
{$fork *} (frog (turn (~(tap in p.sut)) |=(span ^$(sut +<))))
{$frog *} (frog (turn p.sut |=(span ^$(sut +<))))
2016-01-11 10:04:34 +03:00
{$hold *} $(sut repo)
2013-09-29 00:21:18 +04:00
==
--
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2fE, grammar ::
2013-09-29 00:21:18 +04:00
::
++ vang
2015-12-20 23:50:45 +03:00
|= {bug/? wer/path}
2013-09-29 00:21:18 +04:00
%*(. vast bug bug, wer wer)
::
++ vast !.
2013-09-29 00:21:18 +04:00
=+ [bug=`?`| was=*(set path) wer=*path]
|%
2013-09-29 00:21:18 +04:00
++ gash %+ cook
2015-12-20 23:50:45 +03:00
|= a/(list tyke) ^- tyke
2013-09-29 00:21:18 +04:00
?~(a ~ (weld i.a $(a t.a)))
(more fas gasp)
++ gasp ;~ pose
%+ cook
2015-12-20 23:50:45 +03:00
|=({a/tyke b/tyke c/tyke} :(weld a b c))
2013-09-29 00:21:18 +04:00
;~ plug
2015-12-20 23:50:45 +03:00
(cook |=(a/(list) (turn a |=(b/* ~))) (star tis))
(cook |=(a/twig [[~ a] ~]) hasp)
(cook |=(a/(list) (turn a |=(b/* ~))) (star tis))
2013-09-29 00:21:18 +04:00
==
2015-12-20 23:50:45 +03:00
(cook |=(a/(list) (turn a |=(b/* ~))) (plus tis))
2013-09-29 00:21:18 +04:00
==
++ glam ~+((glue ace))
++ hasp ;~ pose
(ifix [sel ser] wide)
2016-01-05 04:29:30 +03:00
(stag %cnhp (ifix [pel per] (most ace wide)))
2015-12-29 22:52:22 +03:00
(stag %sand (stag %t qut))
2013-09-29 00:21:18 +04:00
%+ cook
2015-12-29 22:52:22 +03:00
|=(a/coin [%sand ?:(?=({$~ $tas *} a) %tas %ta) ~(rent co a)])
2013-09-29 00:21:18 +04:00
nuck:so
==
++ mota %+ cook
2015-12-20 23:50:45 +03:00
|=({a/tape b/tape} (rap 3 (weld a b)))
2013-09-29 00:21:18 +04:00
;~(plug (star low) (star hig))
::
++ plex
2015-12-20 23:50:45 +03:00
|= gen/twig ^- (unit path)
2015-12-21 08:05:19 +03:00
?: ?=({$dbug *} gen)
2013-09-29 00:21:18 +04:00
$(gen q.gen)
2015-12-04 22:32:49 +03:00
?. ?=({$clsg *} gen) ~
%+ reel p.gen
2015-12-20 23:50:45 +03:00
|= {a/twig b/_`(unit path)`[~ u=/]}
?~ b ~
?. ?=({$sand $tas @} a) ~
`[q.a u.b]
2013-09-29 00:21:18 +04:00
::
++ pray
2015-12-20 23:50:45 +03:00
|= gen/twig ~| %pray ^- (unit twig)
~& [%pray-disabled gen]
2015-04-04 13:54:25 +03:00
!!
2013-09-29 00:21:18 +04:00
::
++ prey
2015-12-20 23:50:45 +03:00
|= gun/(list twig) ^- (unit twig)
?~ gun `[%$ 1]
=+ gup=(pray i.gun)
?~ gup ~
?~ t.gun gup
2015-12-20 23:50:45 +03:00
(bind $(gun t.gun) |=(a/twig [%tsgr u.gup a]))
2013-09-29 00:21:18 +04:00
::
++ phax
2015-12-20 23:50:45 +03:00
|= ruw/(list (list beer))
2015-12-04 22:32:49 +03:00
=+ [yun=*(list twig) cah=*(list @)]
=+ wod=|=({a/tape b/(list twig)} ^+(b ?~(a b [[%smfs %knit (flop a)] b])))
2013-09-29 00:21:18 +04:00
|- ^+ yun
?~ ruw
2013-09-29 00:21:18 +04:00
(flop (wod cah yun))
?~ i.ruw $(ruw t.ruw)
?@ i.i.ruw
$(i.ruw t.i.ruw, cah [i.i.ruw cah])
$(i.ruw t.i.ruw, cah ~, yun [p.i.i.ruw (wod cah yun)])
::
++ posh
2015-12-20 23:50:45 +03:00
|= {pre/(unit tyke) pof/(unit {p/@ud q/tyke})}
2015-05-22 01:56:14 +03:00
^- (unit (list twig))
=- ?^(- - ~&(%posh-fail -))
2013-09-29 00:21:18 +04:00
=+ wom=(poof wer)
2015-05-22 01:56:14 +03:00
%+ biff
?~ pre `u=wom
%+ bind (poon wom u.pre)
2015-12-20 23:50:45 +03:00
|= moz/(list twig)
2015-05-22 01:56:14 +03:00
?~(pof moz (weld moz (slag (lent u.pre) wom)))
2015-12-20 23:50:45 +03:00
|= yez/(list twig)
2015-05-22 01:56:14 +03:00
?~ pof `yez
2013-09-29 00:21:18 +04:00
=+ zey=(flop yez)
=+ [moz=(scag p.u.pof zey) gul=(slag p.u.pof zey)]
2015-05-22 01:56:14 +03:00
=+ zom=(poon (flop moz) q.u.pof)
?~(zom ~ `(weld (flop gul) u.zom))
2013-09-29 00:21:18 +04:00
::
2015-12-29 22:52:22 +03:00
++ poof |=(pax/path ^-((list twig) (turn pax |=(a/@ta [%sand %ta a]))))
2013-09-29 00:21:18 +04:00
++ poon
2015-12-21 23:45:47 +03:00
|= {pag/(list twig) goo/tyke}
^- (unit (list twig))
2015-05-22 01:56:14 +03:00
?~ goo `~
%+ both
2015-06-12 20:56:30 +03:00
?^(i.goo i.goo ?~(pag ~ `u=i.pag))
2013-09-29 00:21:18 +04:00
$(goo t.goo, pag ?~(pag ~ t.pag))
::
++ poor
2015-05-22 01:56:14 +03:00
%+ sear posh
2013-09-29 00:21:18 +04:00
;~ plug
(stag ~ gash)
2013-09-29 00:21:18 +04:00
;~(pose (stag ~ ;~(pfix cen porc)) (easy ~))
==
::
++ porc
;~ plug
2015-12-20 23:50:45 +03:00
(cook |=(a/(list) (lent a)) (star cen))
2013-09-29 00:21:18 +04:00
;~(pfix fas gash)
==
::
2014-03-26 04:48:22 +04:00
++ rump
%+ sear
2015-12-20 23:50:45 +03:00
|= {a/wing b/(unit twig)} ^- (unit twig)
2015-12-30 00:52:51 +03:00
?~(b [~ %wing a] ?.(?=({@ $~} a) ~ [~ [%rock %tas i.a] u.b]))
2015-12-21 00:16:39 +03:00
;~(plug rope ;~(pose (stag ~ ;~(pfix lus wide)) (easy ~)))
2014-03-26 04:48:22 +04:00
::
2013-09-29 00:21:18 +04:00
++ rood
;~ pfix fas
(stag %clsg poor)
==
2014-03-26 04:48:22 +04:00
::
++ rupl
%+ cook
2015-12-20 23:50:45 +03:00
|= {a/? b/(list twig) c/?}
2014-03-26 04:48:22 +04:00
?: a
?: c
[%clsg [%clsg b] ~]
[%clsg b]
?: c
[%clsg [%cltr b] ~]
[%cltr b]
;~ plug
;~ pose
(cold | (just '['))
(cold & (jest '~['))
==
::
;~ pose
(ifix [ace gap] (most gap tall))
(most ace wide)
==
::
;~ pose
(cold & (jest ']~'))
(cold | (just ']'))
==
==
::
2015-12-26 14:44:32 +03:00
++ sail :: xml template
2015-12-20 23:50:45 +03:00
|= tol/? =| lin/?
2014-04-03 05:06:45 +04:00
|%
++ ape :: product twig
%+ cook
|= tum/tuna ^- twig
?: ?=({$e *} tum)
[p.tum (sag q.tum)]
(sag tum ~)
amp
2014-04-03 05:06:45 +04:00
::
++ amp :: entry point
;~(pfix sem ?:(tol bam bat))
::
++ bam :: tall top
%+ knee *tuna |. ~+
;~ pose
2014-04-06 01:25:16 +04:00
(stag %f ;~(pfix (plus ace) (cook rab puv)))
2014-04-05 23:04:05 +04:00
(stag %e ;~(plug hag nal))
2014-04-06 01:25:16 +04:00
(stag %e hul)
2014-04-05 02:35:59 +04:00
(stag %f nup)
2014-04-03 05:06:45 +04:00
;~(pfix tis (stag %f nol))
;~(pfix hep (stag %a ;~(pfix gap tall)))
;~(pfix lus (stag %b ;~(pfix gap tall)))
;~(pfix tar (stag %c ;~(pfix gap tall)))
;~(pfix cen (stag %d ;~(pfix gap tall)))
2015-12-21 08:05:19 +03:00
(easy [%f [%a [%knit 10 ~]] ~])
2014-04-03 05:06:45 +04:00
==
::
++ bat :: wide outer top
%+ knee *tuna |. ~+
;~ pose
(stag %f nup)
(stag %f ped)
2014-04-06 01:25:16 +04:00
(stag %e ;~(plug hig lif))
2014-04-03 05:06:45 +04:00
==
::
++ bet :: wide inner top
%+ knee *tuna |. ~+
;~ pose
bat
;~(pfix hep (stag %a wide))
;~(pfix lus (stag %b wide))
;~(pfix tar (stag %c wide))
;~(pfix cen (stag %d wide))
==
::
++ fry :: mane as twig
%+ cook
2015-12-20 23:50:45 +03:00
|= {a/@tas b/(unit @tas)}
?~ b
2015-12-30 00:52:51 +03:00
[%rock %tas a]
[[%rock %tas a] [%rock %tas u.b]]
2014-04-05 02:35:59 +04:00
;~(plug sym ;~(pose (stag ~ ;~(pfix cab sym)) (easy ~)))
2014-04-03 05:06:45 +04:00
::
2014-04-05 23:04:05 +04:00
++ hag :: script or style
2015-12-20 23:50:45 +03:00
%+ cook |=(a/twig a)
2014-04-05 23:04:05 +04:00
;~ plug
2015-12-30 00:52:51 +03:00
(stag %rock (stag %tas ;~(pose (jest %script) (jest %style))))
2014-04-05 23:04:05 +04:00
(stag %clsg jaw)
==
::
2014-04-06 01:25:16 +04:00
++ hig :: simple head
2015-12-20 23:50:45 +03:00
(cook |=({a/twig b/(list twig)} [a %clsg b]) hog)
2014-04-06 01:25:16 +04:00
::
++ hog :: tag head
2014-04-05 02:35:59 +04:00
%+ cook
2015-12-04 22:32:49 +03:00
|= hug
^- {twig (list twig)}
2015-12-30 00:52:51 +03:00
=- [a (welp - ?~(c d [[[%rock %tas p.c] q.c] d]))]
2014-12-10 00:52:43 +03:00
=- (~(tap by -))
2015-12-21 08:05:19 +03:00
%. |=(e/(list tank) [%knit ~(ram re %rose [" " `~] e)])
2014-12-10 00:52:43 +03:00
=< ~(run by f:(reel b .))
2015-12-20 23:50:45 +03:00
|= {e/{p/term q/term} f/(jar twig tank)}
(~(add ja f) [%rock %tas p.e] [%leaf (trip q.e)])
2014-04-05 02:35:59 +04:00
;~ plug
fry
2014-12-10 00:52:43 +03:00
=- (star ;~(plug - sym))
;~(pose (cold %class dot) (cold %id hax))
2015-12-21 08:05:19 +03:00
=- ;~(pose ;~(plug - (stag %knit soil)) (easy ~))
2014-12-10 00:52:43 +03:00
;~(pose (cold %href fas) (cold %src pat))
2014-04-05 02:35:59 +04:00
;~ pose
%+ ifix [pel per]
%+ more ;~(plug com ace)
;~(plug fry ;~(pfix ace wide))
::
(easy ~)
==
==
2014-04-09 02:26:01 +04:00
::
++ hoy :: tall attributes
%- star
;~ pfix ;~(plug gap tis)
;~(plug fry ;~(pfix gap tall))
2014-04-09 02:26:01 +04:00
==
::
2015-12-04 22:32:49 +03:00
++ hug :: head shape
2015-12-20 23:50:45 +03:00
$: a/twig :: XX translation
b/(list {@tas @tas})
c/$@($~ {p/@tas q/twig})
d/(list twig)
2015-12-04 22:32:49 +03:00
==
::
2014-04-06 01:25:16 +04:00
++ hul :: tall preface
%+ cook
2015-12-20 23:50:45 +03:00
|= {a/{p/twig q/(list twig)} b/(list twig) c/(list tuna)}
2015-12-08 04:46:28 +03:00
^- {twig (list tuna)}
2014-04-06 01:25:16 +04:00
[[p.a %clsg (weld q.a b)] c]
2014-04-09 02:26:01 +04:00
;~(plug hog hoy nol)
2014-04-03 05:06:45 +04:00
::
2014-04-05 23:04:05 +04:00
++ jaw :: wide attributes
;~ pose
%+ ifix [pel per]
%+ more ;~(plug com ace)
;~(plug fry ;~(pfix ace wide))
::
(easy ~)
==
::
2014-04-03 05:06:45 +04:00
++ lif :: wide elements
2015-12-20 23:50:45 +03:00
%+ cook |=(a/(list tuna) a)
2014-04-05 02:35:59 +04:00
;~(pose ;~(pfix col pep) (cold ~ sem) (easy ~))
2014-04-03 05:06:45 +04:00
::
++ luf :: wide elements
2015-12-20 23:50:45 +03:00
%+ cook |=(a/(list tuna) a)
2014-04-03 05:06:45 +04:00
(star ;~(pfix ace bet))
::
2014-04-05 23:04:05 +04:00
++ nal :: unescaped tall tail
2015-12-20 23:50:45 +03:00
%+ cook |=(a/(list tuna) a)
2014-04-05 23:04:05 +04:00
%+ ifix [gap ;~(plug gap duz)]
%+ most gap
;~ pfix sem
;~ pose
;~ pfix ace
%+ cook
2015-12-20 23:50:45 +03:00
|= a/tape
2015-12-21 08:05:19 +03:00
[%a %knit (weld a `tape`[`@`10 ~])]
(star (shim 32 255))
==
2015-12-21 08:05:19 +03:00
(easy [%a %knit `@`10 ~])
==
2014-04-09 02:26:01 +04:00
==
2014-04-05 23:04:05 +04:00
::
2014-04-03 05:06:45 +04:00
++ nol :: tall tail
?> tol
2015-12-20 23:50:45 +03:00
%+ cook |=(a/(list tuna) a)
2014-04-03 05:06:45 +04:00
;~ pose
(cold ~ sem)
2014-04-05 02:35:59 +04:00
;~(pfix col pep(tol |))
2014-04-06 01:25:16 +04:00
;~(pfix ;~(plug col ace) (cook rab(tol |) puv))
2014-04-05 23:04:05 +04:00
(ifix [gap ;~(plug gap duz)] (most gap amp))
2014-04-03 05:06:45 +04:00
==
::
++ nup :: wide quote
2015-12-20 23:50:45 +03:00
%+ cook |=(a/(list tuna) a)
2014-06-20 03:11:17 +04:00
;~ pose
;~(less (jest '"""') (ifix [doq doq] (cook rab puv)))
(inde (ifix [(jest '"""\0a') (jest '\0a"""')] (cook rab puv(lin |))))
==
2014-04-03 05:06:45 +04:00
::
2014-04-06 01:25:16 +04:00
++ pab (ifix [kel ker] ;~(plug hig luf)) :: bracketed element
++ ped :: wide flow
2015-12-20 23:50:45 +03:00
%+ cook |=(a/(list tuna) a)
2014-04-03 05:06:45 +04:00
(ifix [pel per] (more ace bet))
::
++ pep :: wrapped tuna
2015-12-20 23:50:45 +03:00
%+ cook |=(a/(list tuna) a)
2014-04-03 05:06:45 +04:00
;~ pose
ped
(ifix [pel per] (more ace bet))
2015-12-21 08:05:19 +03:00
(cook |=(@t [%a %knit (trip +<)]~) qut)
2014-04-03 05:06:45 +04:00
;~ plug
bat
(easy ~)
==
==
::
2015-12-21 00:16:39 +03:00
++ puv :: wide+tall flow
2015-12-20 23:50:45 +03:00
%+ cook |=(a/(list beet) a)
2014-04-03 05:06:45 +04:00
%- star
;~ pose
2014-06-20 03:11:17 +04:00
;~(pfix bas ;~(pose (mask "-+*%;\{") bas doq bix:ab))
2014-04-06 01:25:16 +04:00
;~(pfix hep (stag %a sump))
;~(pfix lus (stag %b sump))
;~(pfix tar (stag %c sump))
;~(pfix cen (stag %d sump))
;~(pfix sem (stag %e pab(tol |)))
2014-06-20 03:11:17 +04:00
;~(less bas kel ?:(tol fail doq) prn)
?:(lin fail ;~(less (jest '\0a"""') (just '\0a')))
2014-04-06 01:25:16 +04:00
(stag %a sump)
2014-04-03 05:06:45 +04:00
==
::
2014-04-06 01:25:16 +04:00
++ rab :: beet to tuna
2015-12-20 23:50:45 +03:00
|= reb/(list beet)
2014-04-06 01:25:16 +04:00
^- (list tuna)
2015-12-20 23:50:45 +03:00
=| {sim/(list @) tuz/(list tuna)}
2014-04-06 01:25:16 +04:00
|- ^- (list tuna)
?~ reb
=. sim
?. tol sim
2014-04-09 02:26:01 +04:00
[10 |-(?~(sim sim ?:(=(32 i.sim) $(sim t.sim) sim)))]
2015-12-21 08:05:19 +03:00
?~(sim tuz [[%a %knit (flop sim)] tuz])
2014-04-06 01:25:16 +04:00
?@ i.reb
$(reb t.reb, sim [i.reb sim])
=+ zut=$(reb t.reb, sim ~)
?~ sim [i.reb zut]
2015-12-21 08:05:19 +03:00
[[%a %knit (flop sim)] i.reb zut]
2014-04-06 01:25:16 +04:00
::
++ sag :: tuna to twig
2015-12-20 23:50:45 +03:00
|= lut/(list tuna)
2014-04-06 01:25:16 +04:00
^- twig
:- %cltr
|- ^- (list twig)
2015-12-30 00:52:51 +03:00
?~ lut [[%rock %n ~] ~]
2014-04-06 01:25:16 +04:00
?- -.i.lut
$a [[%smfs p.i.lut] $(lut t.lut)]
2015-12-04 22:32:49 +03:00
$b [p.i.lut $(lut t.lut)]
$c :_ ~
2014-04-06 01:25:16 +04:00
:+ %cndt `twig`[p.i.lut [%cltr $(lut t.lut)]]
2015-12-21 08:05:19 +03:00
:+ %tsbr [%base %cell]
2014-04-06 01:25:16 +04:00
:- %brcn
^- (map term foot)
:_ [~ ~]
=+ sug=[[%& 12] ~]
:+ %$ %elm
:^ %wtsg sug
[%cnts sug [[[[%& 1] ~] [%$ 13]] ~]]
[%cnts sug [[[[%& 3] ~] [%cnts [%$ ~] [[sug [%$ 25]] ~]]] ~]]
2016-01-05 04:29:30 +03:00
$d [[%cnhp p.i.lut [%cltr $(lut t.lut)] ~] ~]
2015-12-04 22:32:49 +03:00
$e [[p.i.lut ^$(lut [[%f q.i.lut] ~])] $(lut t.lut)]
$f $(lut (weld p.i.lut t.lut))
2014-04-06 01:25:16 +04:00
==
2014-04-03 05:06:45 +04:00
--
::
2015-10-27 01:26:49 +03:00
++ scat !:
2013-12-15 11:07:57 +04:00
%+ knee *twig |. ~+
%- stew
^. stet ^. limo
2013-12-21 06:35:33 +04:00
:~
:- ','
(stag %wing rope)
:- '!'
2013-09-29 00:21:18 +04:00
;~ pose
(stag %wtzp ;~(pfix zap wide))
(stag %zpzp (cold ~ ;~(plug zap zap)))
==
2015-12-15 00:37:04 +03:00
:- '_'
2015-12-15 01:15:46 +03:00
;~(pfix cab (stag %bccb wide))
:- '$'
2015-11-30 16:23:47 +03:00
;~ pose
;~ pfix buc
;~ pose
2015-12-21 08:05:19 +03:00
(stag %leaf (stag %tas (cold %$ buc)))
(stag %leaf (stag %f (cold & pam)))
(stag %leaf (stag %f (cold | bar)))
(stag %leaf (stag %t qut))
(stag %leaf (sear |=(a/coin ?:(?=($$ -.a) (some +.a) ~)) nuck:so))
2015-11-30 16:23:47 +03:00
==
==
rump
==
:- '%'
2013-09-29 00:21:18 +04:00
;~ pfix cen
;~ pose
(stag %clsg (sear |~({a/@ud b/tyke} (posh ~ ~ a b)) porc))
2015-12-30 00:52:51 +03:00
(stag %rock (stag %tas (cold %$ buc)))
(stag %rock (stag %f (cold & pam)))
(stag %rock (stag %f (cold | bar)))
(stag %rock (stag %t qut))
2013-09-29 00:21:18 +04:00
(cook (jock &) nuck:so)
2015-12-20 23:50:45 +03:00
(stag %clsg (sear |=(a/(list) (posh ~ ~ (lent a) ~)) (star cen)))
2013-09-29 00:21:18 +04:00
==
==
:- '&'
2013-09-29 00:21:18 +04:00
;~ pose
2015-12-20 23:50:45 +03:00
(cook |=(a/wing [%cnts a ~]) rope)
2013-09-29 00:21:18 +04:00
(stag %wtpm ;~(pfix pam (ifix [pel per] (most ace wide))))
;~(plug (stag %rock (stag %f (cold & pam))) ;~(pfix lus wide))
2015-12-29 22:52:22 +03:00
(stag %sand (stag %f (cold & pam)))
2013-09-29 00:21:18 +04:00
==
:- '\''
2015-12-29 22:52:22 +03:00
(stag %sand (stag %t qut))
:- '('
2016-01-05 04:29:30 +03:00
(stag %cnhp (ifix [pel per] (most ace wide)))
2015-11-30 16:23:47 +03:00
:- '{'
2015-12-14 10:28:05 +03:00
(stag %bccl (ifix [kel ker] (most ace wide)))
:- '*'
2015-11-30 16:23:47 +03:00
;~ pose
2015-12-14 09:52:13 +03:00
(stag %cnbc ;~(pfix tar wide))
2015-12-21 08:05:19 +03:00
(cold [%base %noun] tar)
2015-11-30 16:23:47 +03:00
==
:- '@'
2016-01-05 04:29:30 +03:00
;~(pfix pat (stag %base (stag %atom mota)))
:- '+'
2013-09-29 00:21:18 +04:00
;~ pose
(stag %dtls ;~(pfix lus (ifix [pel per] wide)))
::
%+ cook
2015-12-20 23:50:45 +03:00
|= a/(list (list beer))
:- %smfs
[%knit |-(^-((list beer) ?~(a ~ (weld i.a $(a t.a)))))]
2013-09-29 00:21:18 +04:00
(most dog ;~(pfix lus soil))
::
2015-12-20 23:50:45 +03:00
(cook |=(a/wing [%cnts a ~]) rope)
2013-09-29 00:21:18 +04:00
==
:- '-'
2013-09-29 00:21:18 +04:00
;~ pose
2015-12-29 22:52:22 +03:00
(stag %sand tash:so)
2013-09-29 00:21:18 +04:00
::
%+ cook
2015-12-20 23:50:45 +03:00
|= a/(list (list beer))
2014-03-25 21:46:30 +04:00
[%clsg (phax a)]
2013-09-29 00:21:18 +04:00
(most dog ;~(pfix hep soil))
::
2015-12-20 23:50:45 +03:00
(cook |=(a/wing [%cnts a ~]) rope)
2013-09-29 00:21:18 +04:00
==
:- '.'
2013-09-29 00:21:18 +04:00
;~ pose
2014-10-31 06:13:40 +03:00
(cook (jock |) ;~(pfix dot perd:so))
2015-12-20 23:50:45 +03:00
(cook |=(a/wing [%cnts a ~]) rope)
2013-09-29 00:21:18 +04:00
==
:- ['0' '9']
%+ cook
|= {a/dime b/(unit twig)}
?~(b [%sand a] [[%rock a] u.b])
;~(plug bisk:so (punt ;~(pfix lus wide)))
:- ':'
2014-03-25 21:46:30 +04:00
;~ pfix col
;~ pose
(stag %smcl (ifix [pel per] (most ace wide)))
;~(pfix fas (stag %smfs wide))
2014-03-25 21:46:30 +04:00
==
==
:- '='
2013-09-29 00:21:18 +04:00
(stag %dtts ;~(pfix tis (ifix [pel per] ;~(glam wide wide))))
:- '?'
2015-12-01 03:56:44 +03:00
;~ pose
2015-12-14 10:28:05 +03:00
(stag %bcwt ;~(pfix wut (ifix [pel per] (most ace wide))))
2015-12-21 08:05:19 +03:00
(cold [%base %bean] wut)
2015-12-01 03:56:44 +03:00
==
:- '['
2014-03-26 04:48:22 +04:00
rupl
:- '^'
2013-09-29 00:21:18 +04:00
;~ pose
2015-12-21 08:05:19 +03:00
(stag %wing rope)
(cold [%base %cell] ket)
2013-09-29 00:21:18 +04:00
==
:- '`'
2013-09-29 00:21:18 +04:00
;~ pfix tec
;~ pose
%+ cook
2015-12-29 22:52:22 +03:00
|=({a/@ta b/twig} [%ktls [%sand a 0] [%ktls [%sand %$ 0] b]])
2013-09-29 00:21:18 +04:00
;~(pfix pat ;~(plug mota ;~(pfix tec wide)))
2015-12-08 04:23:27 +03:00
;~ pfix tar
2015-12-21 08:05:19 +03:00
(stag %kthp (stag [%base %noun] ;~(pfix tec wide)))
2015-12-08 04:23:27 +03:00
==
2015-12-12 08:01:41 +03:00
(stag %kthp ;~(plug wide ;~(pfix tec wide)))
2013-12-17 08:48:40 +04:00
(stag %ktls ;~(pfix lus ;~(plug wide ;~(pfix tec wide))))
2015-12-30 00:52:51 +03:00
(cook |=(a/twig [[%rock %n ~] a]) wide)
2013-09-29 00:21:18 +04:00
==
==
:- '"'
2013-09-29 00:21:18 +04:00
%+ cook
2015-12-20 23:50:45 +03:00
|= a/(list (list beer))
[%knit |-(^-((list beer) ?~(a ~ (weld i.a $(a t.a)))))]
2013-09-29 00:21:18 +04:00
(most dog soil)
:- ['a' 'z']
2014-03-26 04:48:22 +04:00
rump
:- '|'
2013-09-29 00:21:18 +04:00
;~ pose
2015-12-20 23:50:45 +03:00
(cook |=(a/wing [%cnts a ~]) rope)
2013-09-29 00:21:18 +04:00
(stag %wtbr ;~(pfix bar (ifix [pel per] (most ace wide))))
;~(plug (stag %rock (stag %f (cold | bar))) ;~(pfix lus wide))
2015-12-29 22:52:22 +03:00
(stag %sand (stag %f (cold | bar)))
2013-09-29 00:21:18 +04:00
==
:- '~'
2013-09-29 00:21:18 +04:00
;~ pose
2014-03-26 04:48:22 +04:00
rupl
2013-09-29 00:21:18 +04:00
::
;~ pfix sig
;~ pose
(stag %clsg (ifix [sel ser] (most ace wide)))
::
%+ stag %cnsg
2013-09-29 00:21:18 +04:00
%+ ifix
[pel per]
;~(glam rope wide (most ace wide))
2013-09-29 00:21:18 +04:00
::
(cook (jock |) twid:so)
(stag [%bust %null] ;~(pfix lus wide))
(easy [%bust %null])
2013-09-29 00:21:18 +04:00
==
==
==
:- '/'
rood
:- '<'
2015-12-21 08:05:19 +03:00
(ifix [gal gar] (stag %tell (most ace wide)))
:- '>'
2015-12-21 08:05:19 +03:00
(ifix [gar gal] (stag %yell (most ace wide)))
2013-09-29 00:21:18 +04:00
==
++ soil
;~ pose
2014-06-18 14:01:17 +04:00
;~ less (jest '"""')
%+ ifix [doq doq]
2015-06-12 20:56:30 +03:00
%- star
2014-07-24 22:16:39 +04:00
;~ pose
2014-06-18 14:01:17 +04:00
;~(pfix bas ;~(pose bas doq kel bix:ab))
;~(less doq bas kel prn)
(stag ~ sump)
2014-07-24 22:16:39 +04:00
==
==
::
2014-06-18 14:01:17 +04:00
%- inde %+ ifix
2014-06-20 03:11:17 +04:00
[(jest '"""\0a') (jest '\0a"""')]
2015-06-12 20:56:30 +03:00
%- star
2014-07-24 22:16:39 +04:00
;~ pose
2014-06-18 14:01:17 +04:00
;~(pfix bas ;~(pose bas kel bix:ab))
;~(less bas kel prn)
;~(less (jest '\0a"""') (just `@`10))
(stag ~ sump)
2014-07-24 22:16:39 +04:00
==
==
2014-04-06 01:25:16 +04:00
++ sump (ifix [kel ker] (stag %cltr (most ace wide)))
2014-08-23 05:38:20 +04:00
++ norm :: rune regular form
2015-12-20 23:50:45 +03:00
|= tol/?
2013-09-29 00:21:18 +04:00
=< %- stew
^. stet ^. limo
:~ :- '|'
2013-09-29 00:21:18 +04:00
;~ pfix bar
%- stew
^. stet ^. limo
2015-12-14 01:27:20 +03:00
:~ ['_' (rune cab %brcb expr)]
['%' (rune cen %brcn expe)]
2015-12-04 01:54:41 +03:00
[':' (rune col %brcl expb)]
['.' (rune dot %brdt expa)]
['/' (rune fas %brcb expr)]
['-' (rune hep %brhp expa)]
['^' (rune ket %brkt expr)]
['~' (rune sig %brsg expb)]
2016-01-05 04:29:30 +03:00
['*' (rune tar %brtr expb)]
2015-12-14 01:27:20 +03:00
['=' (rune tis %brts expb)]
['?' (rune wut %brwt expa)]
2013-09-29 00:21:18 +04:00
==
==
2015-12-14 10:28:05 +03:00
:- '$'
;~ pfix buc
%- stew
^. stet ^. limo
:~ ['@' (rune pat %bcpt expb)]
['_' (rune cab %bccb expa)]
[':' (rune col %bccl exps)]
['%' (rune cen %bccn exps)]
2015-12-14 10:51:58 +03:00
['^' (rune ket %bckt expb)]
2015-12-14 11:00:52 +03:00
['+' (rune lus %bcls expb)]
2015-12-14 10:28:05 +03:00
['=' (rune tis %bcts expg)]
['?' (rune wut %bcwt exps)]
==
==
:- '%'
2013-09-29 00:21:18 +04:00
;~ pfix cen
%- stew
^. stet ^. limo
:~ ['_' (rune cab %cncb exph)]
['.' (rune dot %cndt expb)]
2014-01-04 06:59:56 +04:00
['^' (rune ket %cnkt expd)]
['+' (rune lus %cnls expc)]
2016-01-05 04:29:30 +03:00
['-' (rune hep %cnhp expk)]
['~' (rune sig %cnsg expu)]
['*' (rune tar %cntr expm)]
['=' (rune tis %cnts exph)]
2013-09-29 00:21:18 +04:00
==
==
:- ':'
2013-09-29 00:21:18 +04:00
;~ pfix col
%- stew
^. stet ^. limo
:~ ['_' (rune cab %clcb expb)]
2014-01-04 06:59:56 +04:00
['^' (rune ket %clkt expd)]
['+' (rune lus %clls expc)]
['-' (rune hep %clhp expb)]
['~' (rune sig %clsg exps)]
['*' (rune tar %cltr exps)]
2013-09-29 00:21:18 +04:00
==
==
:- '.'
2013-09-29 00:21:18 +04:00
;~ pfix dot
%- stew
^. stet ^. limo
:~ ['+' (rune lus %dtls expa)]
['*' (rune tar %dttr expb)]
['=' (rune tis %dtts expb)]
['?' (rune wut %dtwt expa)]
['^' (rune ket %dtkt expn)]
2013-09-29 00:21:18 +04:00
==
==
:- '^'
2013-09-29 00:21:18 +04:00
;~ pfix ket
%- stew
^. stet ^. limo
:~ ['|' (rune bar %ktbr expa)]
['.' (rune dot %ktdt expb)]
2015-12-12 08:01:41 +03:00
['-' (rune hep %kthp expb)]
['+' (rune lus %ktls expb)]
['&' (rune pam %ktpm expa)]
['~' (rune sig %ktsg expa)]
['=' (rune tis %ktts expg)]
['?' (rune wut %ktwt expa)]
2013-09-29 00:21:18 +04:00
==
==
:- '~'
2013-09-29 00:21:18 +04:00
;~ pfix sig
%- stew
^. stet ^. limo
:~ ['|' (rune bar %sgbr expb)]
['$' (rune buc %sgbc expg)]
['_' (rune cab %sgcb expb)]
['%' (rune cen %sgcn hind)]
['/' (rune fas %sgfs hine)]
['<' (rune gal %sggl hinb)]
['>' (rune gar %sggr hinb)]
['+' (rune lus %sgls hinc)]
['&' (rune pam %sgpm hinf)]
['?' (rune wut %sgwt hing)]
['=' (rune tis %sgts expb)]
['!' (rune zap %sgzp expb)]
2013-09-29 00:21:18 +04:00
==
==
:- ';'
2013-09-29 00:21:18 +04:00
;~ pfix sem
%- stew
^. stet ^. limo
2014-01-05 08:11:15 +04:00
:~ [':' (rune col %smcl expi)]
['/' (rune fas %smfs expa)]
['~' (rune sig %smsg expi)]
2015-12-14 05:31:27 +03:00
[';' (rune sem %smsm expb)]
2013-09-29 00:21:18 +04:00
==
==
:- '='
2013-09-29 00:21:18 +04:00
;~ pfix tis
%- stew
^. stet ^. limo
2015-12-14 05:31:27 +03:00
:~ ['|' (rune bar %tsbr expb)]
['.' (rune dot %tsdt expq)]
['^' (rune ket %tskt bono)]
[':' (rune col %tscl expp)]
2015-12-25 11:26:07 +03:00
['%' (rune cen %tscn expc)]
['<' (rune gal %tsgl expb)]
['>' (rune gar %tsgr expb)]
['-' (rune hep %tshp expb)]
2013-12-23 03:32:30 +04:00
['*' (rune tar %tstr expj)]
['+' (rune lus %tsls expb)]
['~' (rune sig %tssg expi)]
2013-09-29 00:21:18 +04:00
==
==
:- '?'
2013-09-29 00:21:18 +04:00
;~ pfix wut
%- stew
^. stet ^. limo
:~ ['|' (rune bar %wtbr exps)]
[':' (rune col %wtcl expc)]
['.' (rune dot %wtdt expc)]
['<' (rune gal %wtgl expb)]
['>' (rune gar %wtgr expb)]
2015-12-14 08:51:42 +03:00
['-' ;~(pfix hep (toad tkhp))]
['^' ;~(pfix ket (toad tkkt))]
['=' ;~(pfix tis (toad tkts))]
['+' ;~(pfix lus (toad tkls))]
['&' (rune pam %wtpm exps)]
2015-12-14 08:51:42 +03:00
['@' ;~(pfix pat (toad tkpt))]
['~' ;~(pfix sig (toad tksg))]
['!' (rune zap %wtzp expa)]
2013-09-29 00:21:18 +04:00
==
==
:- '!'
2013-09-29 00:21:18 +04:00
;~ pfix zap
%- stew
^. stet ^. limo
:~ [':' ;~(pfix col (toad expz))]
['.' ;~(pfix dot (toad |.(loaf(bug |))))]
[',' (rune com %zpcm expb)]
[';' (rune sem %zpsm expb)]
['>' (rune gar %zpgr expa)]
['=' (rune tis %zpts expa)]
2014-01-05 05:15:52 +04:00
['?' (rune wut %zpwt hinh)]
2013-09-29 00:21:18 +04:00
==
==
==
|%
2014-08-23 05:38:20 +04:00
++ boog :: core arms
2013-09-29 00:21:18 +04:00
%+ knee [p=*term q=*foot] |. ~+
;~ pfix lus
;~ pose
%+ cook
2015-12-20 23:50:45 +03:00
|=({a/$ash b/term c/twig} [b a c])
2013-09-29 00:21:18 +04:00
;~ gunk
(cold %ash (just '+'))
;~(pose (cold %$ buc) sym)
loaf
==
::
%+ cook
2015-12-20 23:50:45 +03:00
|=({a/$elm b/term c/twig} [b a c])
2013-09-29 00:21:18 +04:00
;~ gunk
(cold %elm (just '-'))
;~(pose (cold %$ buc) sym)
loaf
==
==
==
::
2014-08-23 05:38:20 +04:00
++ wisp :: core tail
2013-09-29 00:21:18 +04:00
%- ulva
%+ cook
2015-12-20 23:50:45 +03:00
|=(a/(list {p/term q/foot}) (~(gas by *(map term foot)) a))
2013-09-29 00:21:18 +04:00
(most muck boog)
::
2014-08-23 05:38:20 +04:00
++ toad :: untrap parser exp
2015-12-20 23:50:45 +03:00
|* har/_expa
2013-09-29 00:21:18 +04:00
=+ dur=(ifix [pel per] $:har(tol |))
?:(tol ;~(pose ;~(pfix gap $:har(tol &)) dur) dur)
::
2014-08-23 05:38:20 +04:00
++ rune :: build rune
2015-12-20 23:50:45 +03:00
|* {dif/rule tuq/* har/_expa}
2013-09-29 00:21:18 +04:00
;~(pfix dif (stag tuq (toad har)))
::
2014-08-24 06:20:02 +04:00
++ glop ~+((glue mash)) :: separated by space
++ gunk ~+((glue muck)) :: separated list
2015-12-20 23:50:45 +03:00
++ butt |* zor/rule :: closing == if tall
2014-08-23 05:38:20 +04:00
?:(tol ;~(sfix zor ;~(plug gap duz)) zor)
2015-12-20 23:50:45 +03:00
++ ulva |* zor/rule :: closing -- and tall
2014-08-23 05:38:20 +04:00
?.(tol fail ;~(sfix zor ;~(plug gap dun)))
2014-08-24 06:20:02 +04:00
++ hank (most muck loaf) :: gapped twigs
2014-08-23 05:38:20 +04:00
++ loaf ?:(tol tall wide) :: hoon, current width
++ mash ?:(tol gap ;~(plug com ace)) :: list separator
++ muck ?:(tol gap ace) :: general separator
++ teak %+ knee *tiki |. ~+ :: wing or twig
2014-01-04 06:59:56 +04:00
=+ ^= gub
2015-12-20 23:50:45 +03:00
|= {a/term b/$%({$& p/wing} {$| p/twig})}
2014-01-04 06:59:56 +04:00
^- tiki
2015-12-08 04:23:27 +03:00
?-(-.b $& [%& [~ a] p.b], $| [%| [~ a] p.b])
2014-01-04 06:59:56 +04:00
=+ ^= wyp
;~ pose
2014-01-04 06:59:56 +04:00
%+ cook gub
;~ plug
2014-01-04 06:59:56 +04:00
sym
;~(pfix tis ;~(pose (stag %& rope) (stag %| wide)))
==
::
(stag %& (stag ~ rope))
(stag %| (stag ~ wide))
==
?. tol wyp
;~ pose
wyp
::
;~ pfix
;~(plug ket tis gap)
%+ cook gub
;~ plug
2014-01-04 06:59:56 +04:00
sym
;~(pfix gap ;~(pose (stag %& rope) (stag %| tall)))
==
==
::
(stag %| (stag ~ tall))
==
2014-08-23 05:38:20 +04:00
++ rack (most mash ;~(gunk loaf loaf)) :: list [twig twig]
++ rick (most mash ;~(gunk rope loaf)) :: list [wing twig]
2015-12-04 22:32:49 +03:00
::
:: rune contents
::
2014-08-23 05:38:20 +04:00
++ expa |.(loaf) :: one twig
++ expb |.(;~(gunk loaf loaf)) :: two twigs
++ expc |.(;~(gunk loaf loaf loaf)) :: three twigs
++ expd |.(;~(gunk loaf loaf loaf loaf)) :: four twigs
++ expe |.(wisp) :: core tail
++ expg |.(;~(gunk sym loaf)) :: term and twig
++ exph |.((butt ;~(gunk rope rick))) :: wing, [tile twig]s
2014-08-24 06:20:02 +04:00
++ expi |.((butt ;~(gunk loaf hank))) :: one or more twigs
++ expj |.(;~(gunk sym rope loaf)) :: term, wing, and twig
++ expk |.(;~(gunk loaf ;~(plug loaf (easy ~)))) :: list of two twigs
++ expm |.((butt ;~(gunk rope loaf rick))) :: several [tile twig]s
++ expn |.((stag %cltr (butt hank))) :: autoconsed twigs
++ expp |.(;~(gunk (butt rick) loaf)) :: [wing twig]s, twig
++ expq |.(;~(gunk rope loaf loaf)) :: wing and two twigs
++ expu |.(;~(gunk rope loaf (butt hank))) :: wing, twig, twigs
2014-08-24 06:20:02 +04:00
++ expr |.(;~(gunk loaf wisp)) :: twig and core tail
++ exps |.((butt hank)) :: closed gapped twigs
++ expz |.(loaf(bug &)) :: twig with tracing
2015-12-04 22:32:49 +03:00
::
2015-12-14 08:51:42 +03:00
:: tiki expansion for %wt runes
::
2015-12-21 23:45:47 +03:00
++ tkhp |. %+ cook |= {a/tiki b/(list (pair twig twig))}
2015-12-14 08:51:42 +03:00
(~(wthp ah a) b)
(butt ;~(gunk teak rack))
2015-12-20 23:50:45 +03:00
++ tkkt |. %+ cook |= {a/tiki b/twig c/twig}
2015-12-14 08:51:42 +03:00
(~(wtkt ah a) b c)
;~(gunk teak loaf loaf)
2015-12-21 23:45:47 +03:00
++ tkls |. %+ cook |= {a/tiki b/twig c/(list (pair twig twig))}
2015-12-14 08:51:42 +03:00
(~(wtls ah a) b c)
(butt ;~(gunk teak loaf rack))
2015-12-20 23:50:45 +03:00
++ tkpt |. %+ cook |= {a/tiki b/twig c/twig}
2015-12-14 08:51:42 +03:00
(~(wtpt ah a) b c)
;~(gunk teak loaf loaf)
2015-12-20 23:50:45 +03:00
++ tksg |. %+ cook |= {a/tiki b/twig c/twig}
2015-12-14 08:51:42 +03:00
(~(wtsg ah a) b c)
;~(gunk teak loaf loaf)
2015-12-20 23:50:45 +03:00
++ tkts |. %+ cook |= {a/twig b/tiki}
2015-12-14 08:51:42 +03:00
(~(wtts ah b) a)
;~(gunk loaf teak)
::
2015-12-04 22:32:49 +03:00
:: hint syntax
::
2014-08-24 06:20:02 +04:00
++ hinb |.(;~(gunk bont loaf)) :: hint and twig
++ hinc |. :: optional =en, twig
;~(pose ;~(gunk bony loaf) ;~(plug (easy ~) loaf))
2014-08-25 08:20:32 +04:00
++ hind |.(;~(gunk bonk loaf bonz loaf)) :: jet twig "bon"s twig
++ hine |.(;~(gunk bonk loaf)) :: jet-hint and twig
++ hinf |. :: 0-3 >s, two twigs
;~ pose
2013-09-29 00:21:18 +04:00
;~(gunk (cook lent (stun [1 3] gar)) loaf loaf)
(stag 0 ;~(gunk loaf loaf))
==
2014-08-25 08:20:32 +04:00
++ hing |. :: 0-3 >s, three twigs
;~ pose
;~(gunk (cook lent (stun [1 3] gar)) loaf loaf loaf)
(stag 0 ;~(gunk loaf loaf loaf))
==
2014-08-24 06:20:02 +04:00
++ bonk :: jet signature
2013-09-29 00:21:18 +04:00
;~ pfix cen
;~ pose
;~(plug sym ;~(pfix col ;~(plug sym ;~(pfix dot ;~(pfix dot dem)))))
;~(plug sym ;~(pfix col ;~(plug sym ;~(pfix dot dem))))
;~(plug sym ;~(pfix dot dem))
sym
==
==
2014-08-25 08:20:32 +04:00
++ hinh |. :: 1/2 numbers, twig
;~ gunk
;~ pose
dem
2014-01-05 05:15:52 +04:00
(ifix [sel ser] ;~(plug dem ;~(pfix ace dem)))
==
loaf
==
++ bono |. :: term, wing, 2 twigs
;~ gunk :: (as twigs)
2015-12-21 08:05:19 +03:00
(cook |=(cog/term [%wing [cog ~]]) sym)
(cook |=(hyp/wing [%wing hyp]) rope)
loaf
loaf
==
2014-08-24 06:20:02 +04:00
++ bont ;~ (bend) :: term, optional twig
;~(pfix cen sym)
2014-01-04 11:28:16 +04:00
;~(pfix dot ;~(pose wide ;~(pfix muck loaf)))
==
2015-12-20 23:50:45 +03:00
++ bony (cook |=(a/(list) (lent a)) (plus tis)) :: base 1 =en count
2014-08-25 08:20:32 +04:00
++ bonz :: term-labelled twigs
2013-09-29 00:21:18 +04:00
;~ pose
(cold ~ sig)
%+ ifix
2013-12-21 04:59:03 +04:00
?:(tol [;~(plug duz gap) ;~(plug gap duz)] [pel per])
2013-09-29 00:21:18 +04:00
(more mash ;~(gunk ;~(pfix cen sym) loaf))
==
--
::
2015-12-04 22:32:49 +03:00
++ lang :: lung sample
2015-12-20 23:50:45 +03:00
$: ros/twig :: XX translation
2015-12-14 10:58:14 +03:00
$= vil
2015-12-20 23:50:45 +03:00
$% {$tis p/twig}
{$col p/twig}
{$ket p/twig}
{$fas p/twig}
2015-12-21 23:45:47 +03:00
{$pel p/(list (pair wing twig))}
2015-12-04 22:32:49 +03:00
==
==
::
2013-09-29 00:21:18 +04:00
++ lung
~+
%- bend
2015-12-04 22:32:49 +03:00
|= lang
2013-12-15 11:07:57 +04:00
^- (unit twig)
2013-09-29 00:21:18 +04:00
?- -.vil
$col ?:(=([%base %bean] ros) ~ [~ %tsgl ros p.vil])
$pel (bind ~(reek ap ros) |=(hyp/wing [%cnts hyp p.vil]))
$ket [~ ros p.vil]
$fas =+ tog=~(hock ap ros)
?.(?=(@ tog) ~ [~ %bcts tog p.vil])
$tis =+ tog=~(hock ap ros)
?:(=([%0 ~] tog) ~ [~ %ktts tog p.vil])
2013-09-29 00:21:18 +04:00
==
::
++ long
2013-12-15 11:07:57 +04:00
%+ knee *twig |. ~+
2013-09-29 00:21:18 +04:00
;~ lung
scat
;~ pose
;~(plug (cold %tis tis) wide)
;~(plug (cold %col col) wide)
;~(plug (cold %ket ket) wide)
2015-12-20 23:26:36 +03:00
;~(plug (cold %fas fas) wide)
2013-09-29 00:21:18 +04:00
;~ plug
(easy %pel)
2013-12-15 12:23:23 +04:00
(ifix [pel per] lobo)
2013-09-29 00:21:18 +04:00
==
==
==
::
2013-12-15 12:23:23 +04:00
++ lobo (most ;~(plug com ace) ;~(glam rope wide))
2013-09-29 00:21:18 +04:00
++ loon (most ;~(plug com ace) ;~(glam wide wide))
2014-08-23 05:38:20 +04:00
++ lute :: tall [] noun
2013-11-23 00:22:14 +04:00
~+
%+ stag %cltr
%+ ifix
[;~(plug sel gap) ;~(plug gap ser)]
(most gap tall)
::
2014-08-23 05:38:20 +04:00
++ rope :: wing form
2013-12-26 21:12:07 +04:00
%+ knee *wing
2013-09-29 00:21:18 +04:00
|. ~+
2015-12-20 23:50:45 +03:00
%+ (slug |=({a/limb b/wing} [a b]))
2013-09-29 00:21:18 +04:00
dot
;~ pose
(cold [%| 0 ~] com)
%+ cook
2015-12-21 01:50:13 +03:00
|=({a/(list) b/term} ?~(a b [%| (lent a) `b]))
2013-09-29 00:21:18 +04:00
;~(plug (star ket) ;~(pose sym (cold %$ buc)))
::
%+ cook
2015-12-20 23:50:45 +03:00
|=(a/axis [%& a])
;~ pose
;~(pfix lus dim:ag)
2015-12-20 23:50:45 +03:00
;~(pfix pam (cook |=(a/@ ?:(=(0 a) 0 (mul 2 +($(a (dec a)))))) dim:ag))
;~(pfix bar (cook |=(a/@ ?:(=(0 a) 1 +((mul 2 $(a (dec a)))))) dim:ag))
ven
2013-09-29 00:21:18 +04:00
(cold 1 dot)
==
==
::
2014-08-23 05:38:20 +04:00
++ tall %+ knee *twig :: full tall form
2014-04-06 01:25:16 +04:00
|.(~+((wart ;~(pose (norm &) long lute ape:(sail &)))))
2014-08-23 05:38:20 +04:00
++ wide %+ knee *twig :: full wide form
|.(~+((wart ;~(pose (norm |) long ape:(sail |)))))
++ wart
2015-12-20 23:50:45 +03:00
|* zor/rule
%+ here
2015-12-20 23:50:45 +03:00
|= {a/pint b/twig}
2015-12-21 08:05:19 +03:00
?:(bug [%dbug [wer a] b] b)
2013-09-29 00:21:18 +04:00
zor
--
::
++ vest
~/ %vest
2015-12-20 23:50:45 +03:00
|= tub/nail
2013-09-29 00:21:18 +04:00
~| %vest
2013-12-15 11:07:57 +04:00
^- (like twig)
2013-09-29 00:21:18 +04:00
%. tub
%- full
(ifix [gay gay] tall:vast)
::
++ vice
2015-12-20 23:50:45 +03:00
|= txt/@ta
2013-12-15 11:07:57 +04:00
^- twig
2013-09-29 00:21:18 +04:00
(rash txt wide:vast)
2014-09-27 06:17:43 +04:00
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::: :::::: profiling support; move me ::::::
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
2015-06-12 20:56:30 +03:00
++ doss
2015-12-20 23:50:45 +03:00
$: mon/moan :: sample count
hit/(map term @ud) :: hit points
cut/(map path hump) :: cut points
2014-09-27 06:17:43 +04:00
==
2014-12-03 00:53:35 +03:00
++ moan :: sample metric
2015-12-20 23:50:45 +03:00
$: fun/@ud :: samples in C
noc/@ud :: samples in nock
glu/@ud :: samples in glue
mal/@ud :: samples in alloc
far/@ud :: samples in frag
coy/@ud :: samples in copy
euq/@ud :: samples in equal
2014-12-03 00:53:35 +03:00
== ::
2014-09-27 06:17:43 +04:00
::
++ hump
2015-12-20 23:50:45 +03:00
$: mon/moan :: sample count
out/(map path @ud) :: calls out of
inn/(map path @ud) :: calls into
2014-09-27 06:17:43 +04:00
==
::
2014-09-27 00:23:27 +04:00
++ pi-heck
2015-12-20 23:50:45 +03:00
|= {nam/@tas day/doss}
2014-09-27 06:17:43 +04:00
^- doss
=+ lam=(~(get by hit.day) nam)
day(hit (~(put by hit.day) nam ?~(lam 1 +(u.lam))))
::
++ pi-noon !. :: sample trace
2015-12-20 23:50:45 +03:00
|= {mot/term paz/(list path) day/doss}
=| lax/(unit path)
2014-09-27 06:17:43 +04:00
|- ^- doss
2014-12-03 00:53:35 +03:00
?~ paz day(mon (pi-mope mot mon.day))
2014-09-27 06:17:43 +04:00
%= $
2014-11-28 23:29:10 +03:00
paz t.paz
lax `i.paz
2014-09-27 06:17:43 +04:00
cut.day
2014-11-28 23:29:10 +03:00
%+ ~(put by cut.day) i.paz
2014-09-27 06:17:43 +04:00
^- hump
2014-11-28 23:29:10 +03:00
=+ nax=`(unit path)`?~(t.paz ~ `i.t.paz)
2014-12-03 00:53:35 +03:00
=+ hup=`hump`=+(hup=(~(get by cut.day) i.paz) ?^(hup u.hup [*moan ~ ~]))
:+ (pi-mope mot mon.hup)
2015-06-12 20:56:30 +03:00
?~ lax out.hup
=+ hag=(~(get by out.hup) u.lax)
2014-12-03 20:36:42 +03:00
(~(put by out.hup) u.lax ?~(hag 1 +(u.hag)))
2015-06-12 20:56:30 +03:00
?~ nax inn.hup
=+ hag=(~(get by inn.hup) u.nax)
2014-12-03 20:36:42 +03:00
(~(put by inn.hup) u.nax ?~(hag 1 +(u.hag)))
2014-09-27 06:17:43 +04:00
==
2014-12-03 00:53:35 +03:00
++ pi-mope :: add sample
2015-12-20 23:50:45 +03:00
|= {mot/term mon/moan}
2014-12-03 00:53:35 +03:00
?+ mot mon
2015-12-04 22:32:49 +03:00
$fun mon(fun +(fun.mon))
$noc mon(noc +(noc.mon))
$glu mon(glu +(glu.mon))
$mal mon(mal +(mal.mon))
$far mon(far +(far.mon))
$coy mon(coy +(coy.mon))
$euq mon(euq +(euq.mon))
2014-12-03 00:53:35 +03:00
==
++ pi-moth :: count sample
2015-12-20 23:50:45 +03:00
|= mon/moan ^- @ud
2015-01-15 22:10:29 +03:00
:(add fun.mon noc.mon glu.mon mal.mon far.mon coy.mon euq.mon)
2014-12-03 00:53:35 +03:00
::
++ pi-mumm :: print sample
2015-12-20 23:50:45 +03:00
|= mon/moan ^- tape
2014-12-03 00:53:35 +03:00
=+ tot=(pi-moth mon)
;: welp
^- tape
?: =(0 noc.mon) ~
2014-12-03 03:26:30 +03:00
(welp (scow %ud (div (mul 100 noc.mon) tot)) "n ")
2014-12-03 00:53:35 +03:00
::
^- tape
?: =(0 fun.mon) ~
2014-12-03 03:26:30 +03:00
(welp (scow %ud (div (mul 100 fun.mon) tot)) "c ")
2014-12-03 00:53:35 +03:00
::
^- tape
?: =(0 glu.mon) ~
2014-12-03 03:26:30 +03:00
(welp (scow %ud (div (mul 100 glu.mon) tot)) "g ")
2014-12-03 00:53:35 +03:00
::
^- tape
?: =(0 mal.mon) ~
2014-12-03 03:26:30 +03:00
(welp (scow %ud (div (mul 100 mal.mon) tot)) "m ")
2014-12-03 00:53:35 +03:00
::
^- tape
?: =(0 far.mon) ~
2014-12-03 03:26:30 +03:00
(welp (scow %ud (div (mul 100 far.mon) tot)) "f ")
2015-01-15 22:10:29 +03:00
::
^- tape
?: =(0 coy.mon) ~
(welp (scow %ud (div (mul 100 coy.mon) tot)) "y ")
::
^- tape
?: =(0 euq.mon) ~
(welp (scow %ud (div (mul 100 euq.mon) tot)) "e ")
2014-12-03 00:53:35 +03:00
==
2014-09-27 06:17:43 +04:00
::
2014-09-27 00:23:27 +04:00
++ pi-tell :: produce dump
2015-12-20 23:50:45 +03:00
|= day/doss
2014-09-27 06:17:43 +04:00
^- (list tape)
2014-12-03 00:53:35 +03:00
=+ tot=(pi-moth mon.day)
2014-09-27 06:17:43 +04:00
;: welp
2014-12-03 00:53:35 +03:00
[(welp "events: " (pi-mumm mon.day)) ~]
2014-09-27 06:17:43 +04:00
::
%+ turn
(~(tap by hit.day) ~)
2015-12-20 23:50:45 +03:00
|= {nam/term num/@ud}
2014-11-30 13:06:41 +03:00
:(welp (trip nam) ": " (scow %ud num))
2014-09-27 06:17:43 +04:00
["" ~]
::
%- zing
^- (list (list tape))
%+ turn
2014-12-01 10:32:19 +03:00
%+ sort (~(tap by cut.day))
2015-12-20 23:50:45 +03:00
|= {one/(pair path hump) two/(pair path hump)}
2014-12-03 00:53:35 +03:00
(gth (pi-moth mon.q.one) (pi-moth mon.q.two))
2015-12-20 23:50:45 +03:00
|= {pax/path hup/hump}
2014-12-03 03:26:30 +03:00
=+ ott=(pi-moth mon.hup)
2014-09-27 06:17:43 +04:00
;: welp
2014-12-01 10:32:19 +03:00
[(welp "label: " (spud pax)) ~]
2014-12-03 00:53:35 +03:00
[(welp "price: " (scow %ud (div (mul 100 ott) tot))) ~]
2014-12-03 03:26:30 +03:00
[(welp "shape: " (pi-mumm mon.hup)) ~]
2014-09-27 06:17:43 +04:00
::
2014-12-03 20:36:42 +03:00
?: =(~ out.hup) ~
:- "into:"
2014-09-27 06:17:43 +04:00
%+ turn
2014-12-03 20:36:42 +03:00
(~(tap by out.hup) ~)
2015-12-20 23:50:45 +03:00
|= {pax/path num/@ud}
2014-09-27 06:17:43 +04:00
^- tape
2014-11-28 23:29:10 +03:00
:(welp " " (spud pax) ": " (scow %ud num))
2014-09-27 06:17:43 +04:00
::
2014-12-03 20:36:42 +03:00
?: =(~ inn.hup) ~
:- "from:"
2014-09-27 06:17:43 +04:00
%+ turn
2014-12-03 20:36:42 +03:00
(~(tap by inn.hup) ~)
2015-12-20 23:50:45 +03:00
|= {pax/path num/@ud}
2014-09-27 06:17:43 +04:00
^- tape
2014-11-28 23:29:10 +03:00
:(welp " " (spud pax) ": " (scow %ud num))
2014-12-01 10:32:19 +03:00
::
2014-12-03 03:26:30 +03:00
["" ~]
2014-12-01 10:32:19 +03:00
~
2014-09-27 06:17:43 +04:00
==
==
2013-09-29 00:21:18 +04:00
--
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::: :::::: volume 3, Arvo models and skeleton ::::::
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
2014-12-03 20:36:42 +03:00
~% %arvo + ~
2013-09-29 00:21:18 +04:00
|%
2015-12-20 23:50:45 +03:00
++ arch {hax/@uvI fil/(unit @uvI) dir/(map @ta $~)} :: fundamental node
++ arvo (mold {p/term q/mill} mill) :: arvo card
++ beam {{p/ship q/desk r/case} s/path} :: global name
++ beak {p/ship q/desk r/case} :: garnish with beak
2015-12-04 22:32:49 +03:00
++ bone @ud :: opaque duct
2015-12-14 10:58:14 +03:00
++ care $?($$ $u $v $w $x $y $z) :: namespace mode
++ case :: version
2015-12-20 23:50:45 +03:00
$% {$da p/@da} :: date
{$tas p/@tas} :: label
{$ud p/@ud} :: sequence
== ::
2015-12-04 22:32:49 +03:00
++ desk @tas :: ship desk case spur
2015-03-11 02:56:08 +03:00
++ cage (cask vase) :: global metadata
2015-12-20 23:50:45 +03:00
++ cask |*(a/$+(* *) (pair mark a)) :: global data
2014-06-02 01:07:13 +04:00
++ cuff :: permissions
2015-12-20 23:50:45 +03:00
$: p/(unit (set monk)) :: can be read by
q/(set monk) :: caused or created by
2014-05-26 00:35:07 +04:00
== ::
2015-12-26 13:07:50 +03:00
++ curd {p/@tas q/*} :: spanless card
2013-09-29 00:21:18 +04:00
++ duct (list wire) :: causal history
2015-12-26 13:07:50 +03:00
++ hypo |*(a/$+(* *) (pair span a)) :: span associated
2015-12-20 23:50:45 +03:00
++ hobo |* a/$+(* *) :: kiss wrapper
$? $% {$soft p/*} ::
2014-06-04 14:40:09 +04:00
== ::
a ::
== ::
++ kirk (unit (set monk)) :: audience
2014-05-28 12:57:00 +04:00
++ lens :: observation core
2015-12-14 10:58:14 +03:00
$_ ^? ::
2015-12-04 22:32:49 +03:00
|% ++ u *(unit (unit $~)) :: existence
2014-05-29 03:43:30 +04:00
++ v *(unit (unit cage)) :: full history
++ w *(unit (unit (unit cage))) :: latest diff
++ x *(unit (unit cage)) :: data at path
2014-05-28 12:57:00 +04:00
++ y *(unit (unit arch)) :: directory
2014-05-29 03:43:30 +04:00
++ z *(unit (unit cage)) :: current subtree
2014-05-28 12:57:00 +04:00
-- ::
2015-02-27 09:35:41 +03:00
++ marc :: structured mark
2015-12-14 10:58:14 +03:00
$@ mark :: plain mark
2015-12-20 23:50:45 +03:00
$% {$tabl p/(list (pair marc marc))} :: map
2015-02-27 09:35:41 +03:00
== ::
2015-12-26 13:07:50 +03:00
++ mark @tas :: content span
2015-12-04 22:32:49 +03:00
++ mash |=(* (mass +<)) :: producing mass
++ mass (pair cord (each noun (list mash))) :: memory usage
2015-12-21 00:16:39 +03:00
++ mill (each vase milt) :: vase+metavase
2015-12-20 23:50:45 +03:00
++ milt {p/* q/*} :: metavase
++ monk (each ship {p/@tas q/@ta}) :: general identity
2014-06-22 09:49:10 +04:00
++ mold :: new kernel action
2015-12-21 00:16:39 +03:00
|* {a/$+(* *) b/$+(* *)} :: forward+reverse
2015-12-20 23:50:45 +03:00
$% {$pass p/path q/a} :: advance
{$slip p/a} :: lateral
{$sick p/b} :: lame refactoring
{$give p/b} :: retreat
2014-05-23 02:21:42 +04:00
== ::
2015-12-20 23:50:45 +03:00
++ muse {p/@tas q/duct r/arvo} :: sourced move
++ move {p/duct q/arvo} :: arvo move
2015-12-26 13:07:50 +03:00
++ ovum {p/wire q/curd} :: spanless ovum
2015-12-20 23:50:45 +03:00
++ pane (list {p/@tas q/vase}) :: kernel modules
++ pone (list {p/@tas q/vise}) :: kernel modules old
2015-12-04 22:32:49 +03:00
++ ship @p :: network identity
2015-05-09 04:08:18 +03:00
++ sink (trel bone ship path) :: subscription
2015-12-14 10:58:14 +03:00
++ sled $+ {(unit (set monk)) term beam} :: namespace function
2014-05-29 22:46:43 +04:00
(unit (unit cage)) ::
2015-12-26 13:07:50 +03:00
++ slad $+ {(unit (set monk)) term beam} :: underspand
2015-03-04 04:05:41 +03:00
(unit (unit (cask))) ::
2015-12-14 10:58:14 +03:00
++ slut $+(* (unit (unit))) :: old namespace
2015-01-13 04:49:31 +03:00
++ vile :: reflexive constants
2015-12-26 13:07:50 +03:00
$: typ/span :: -:!>(*span)
duc/span :: -:!>(*duct)
pah/span :: -:!>(*path)
mev/span :: -:!>([%meta *vase])
2014-05-29 22:46:43 +04:00
== ::
2013-09-29 00:21:18 +04:00
++ wire path :: event pretext
2015-05-09 04:08:18 +03:00
::::: hacks and tools
2015-06-12 20:56:30 +03:00
++ slod
2015-12-20 23:50:45 +03:00
|= sed/slad
2014-05-31 23:40:02 +04:00
^- slut
2015-12-20 23:50:45 +03:00
|= raw/*
2014-05-31 23:40:02 +04:00
=+ pux=((soft path) raw)
?~ pux ~
2015-12-04 22:32:49 +03:00
?. ?=({@ @ @ @ *} u.pux) ~
2014-05-31 23:40:02 +04:00
=+ :* hyr=(slay i.u.pux)
fal=(slay i.t.u.pux)
dyc=(slay i.t.t.u.pux)
ved=(slay i.t.t.t.u.pux)
tyl=t.t.t.t.u.pux
==
2015-12-04 22:32:49 +03:00
?. ?=({$~ $$ $tas @} hyr) ~
?. ?=({$~ $$ $p @} fal) ~
?. ?=({$~ $$ $tas @} dyc) ~
2014-05-31 23:40:02 +04:00
?. ?=(^ ved) ~
=+ ron=q.p.u.hyr
=+ bed=[[q.p.u.fal q.p.u.dyc (case p.u.ved)] (flop tyl)]
=+ bop=(sed ~ ron bed)
?~ bop ~
?~ u.bop [~ ~]
2015-02-27 09:35:41 +03:00
[~ ~ +.q.u.u.bop]
2013-09-29 00:21:18 +04:00
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 3bE, Arvo core ::
::
2014-12-10 00:59:08 +03:00
++ vent :: vane core
2015-12-20 23:50:45 +03:00
|= {lal/@tas vil/vile bud/vase sew/(pair worm vase)}
2014-12-03 20:36:42 +03:00
~% %vent +>+ ~
2013-09-29 00:21:18 +04:00
|%
++ ruck :: update vase
2015-12-20 23:50:45 +03:00
|= {pax/path txt/@ta}
2013-09-29 00:21:18 +04:00
^+ +>
=+ arg=[~2000.1.1 0 =>(~ |~(* ~))]
2015-01-13 04:49:31 +03:00
=+ rig=(slym q.sew arg)
2014-05-22 22:36:37 +04:00
=+ rev=(slym (slap bud (rain pax txt)) bud)
2014-05-09 04:47:34 +04:00
=+ syg=(slym rev arg)
2015-01-21 05:33:01 +03:00
~| %load-lost
2015-12-21 08:05:19 +03:00
+>.$(q.sew (slam (slap syg [%limb %load]) (slap rig [%limb %stay])))
2013-09-29 00:21:18 +04:00
::
++ wink :: deploy
2015-12-20 23:50:45 +03:00
|= {now/@da eny/@ ski/slad}
2015-01-13 04:49:31 +03:00
=+ rig=(slym q.sew +<) :: activate vane
2014-12-03 20:36:42 +03:00
~% %wink +>+> ~
|%
2013-09-29 00:21:18 +04:00
++ doze
2015-12-20 23:50:45 +03:00
|= {now/@da hen/duct}
2015-12-08 04:23:27 +03:00
^- (unit @da)
2015-12-21 08:05:19 +03:00
((hard (unit @da)) q:(slym (slap rig [%limb %doze]) +<))
2013-09-29 00:21:18 +04:00
::
++ slid
2015-12-20 23:50:45 +03:00
|= {hed/mill tal/mill}
^- mill
2015-12-08 05:11:14 +03:00
?: &(?=($& -.hed) ?=($& -.tal))
[%& (slop p.hed p.tal)]
[%| [%cell p.p.hed p.p.tal] [q.p.hed q.p.tal]]
::
2014-06-07 05:03:36 +04:00
++ slix
2015-12-20 23:50:45 +03:00
|= hil/mill
2014-06-07 05:03:36 +04:00
^- mill
?- -.hil
$& [%& (slop [typ.vil p.p.hil] p.hil)]
$| [%| [%cell typ.vil p.p.hil] p.hil]
2014-06-07 05:03:36 +04:00
==
::
2015-06-12 20:56:30 +03:00
++ slur :: call gate on
2015-12-20 23:50:45 +03:00
|= {gat/vase hil/mill}
2015-01-15 22:10:29 +03:00
^- (unit (pair vase worm))
=+ sam=(slot 6 gat)
2015-01-13 04:49:31 +03:00
=+ ^= hig
?- -.hil
$& (~(nest wa p.sew) p.sam p.p.hil)
$| (~(nets wa p.sew) p.sam p.p.hil)
2015-01-13 04:49:31 +03:00
==
2015-12-10 02:28:32 +03:00
?.(-.hig ~ `[(slym gat +>.hil) +.hig])
2015-01-15 22:10:29 +03:00
::
2015-12-20 23:50:45 +03:00
++ slur-a ~/(%slur-a |=({gat/vase hil/mill} =+(%a (slur gat hil))))
++ slur-b ~/(%slur-b |=({gat/vase hil/mill} =+(%b (slur gat hil))))
++ slur-c ~/(%slur-c |=({gat/vase hil/mill} =+(%c (slur gat hil))))
++ slur-d ~/(%slur-d |=({gat/vase hil/mill} =+(%d (slur gat hil))))
++ slur-e ~/(%slur-e |=({gat/vase hil/mill} =+(%e (slur gat hil))))
++ slur-f ~/(%slur-f |=({gat/vase hil/mill} =+(%f (slur gat hil))))
++ slur-g ~/(%slur-g |=({gat/vase hil/mill} =+(%g (slur gat hil))))
++ slur-z ~/(%slur-z |=({gat/vase hil/mill} =+(%z (slur gat hil))))
2015-01-15 22:10:29 +03:00
::
++ slur-pro :: profiling slur
~/ %slur-pro
2015-12-20 23:50:45 +03:00
|= {lal/@tas gat/vase hil/mill}
2015-01-15 22:10:29 +03:00
?+ lal (slur-z gat hil)
2015-12-08 04:23:27 +03:00
$a (slur-a gat hil)
$b (slur-b gat hil)
$c (slur-c gat hil)
$d (slur-d gat hil)
$e (slur-e gat hil)
$f (slur-f gat hil)
$g (slur-g gat hil)
2015-01-15 22:10:29 +03:00
==
2014-05-26 00:35:07 +04:00
::
++ song :: reduce metacard
2014-12-03 20:36:42 +03:00
~/ %song ::
2015-12-20 23:50:45 +03:00
|= mex/vase :: mex: vase of card
2015-01-15 22:10:29 +03:00
^- (unit (pair mill worm)) ::
=^ hip p.sew (~(nell wa p.sew) p.mex) ::
2015-01-13 04:49:31 +03:00
?. hip ~ :: a card is a cell
2015-12-08 04:23:27 +03:00
?. ?=($meta -.q.mex) `[[%& mex] p.sew] :: ordinary card
2015-01-15 22:10:29 +03:00
=^ tiv p.sew (~(slot wa p.sew) 3 mex) ::
=^ hip p.sew (~(nell wa p.sew) p.tiv) ::
2015-01-13 04:49:31 +03:00
?. hip ~ :: a vase is a cell
2015-01-15 22:10:29 +03:00
=^ vax p.sew (~(slot wa p.sew) 2 tiv) ::
=^ hip p.sew (~(nest wa p.sew) typ.vil p.vax) ::
2015-12-26 13:07:50 +03:00
?. hip ~ :: vase head is span
%+ biff ::
=+ mut=(milt q.tiv) :: card span, value
|- ^- (unit (pair milt worm)) ::
?. ?=({$meta p/* q/milt} q.mut) `[mut p.sew] :: ordinary metacard
=^ hip p.sew (~(nets wa p.sew) mev.vil p.mut)::
?. hip ~ :: meta-metacard
$(mut +.q.mut) :: descend into meta
|=(a/(pair milt worm) `[[%| p.a] q.a]) :: milt to mill
2014-05-26 00:35:07 +04:00
::
++ sump :: vase to move
2014-12-03 20:36:42 +03:00
~/ %sump
2015-12-20 23:50:45 +03:00
|= wec/vase
2015-01-15 22:10:29 +03:00
^- (unit (pair move worm))
%+ biff ((soft duct) -.q.wec)
2015-12-20 23:50:45 +03:00
|= a/duct
%+ bind
=- ?- -.har
$| ~& [%dead-card p.har] ~ :: XX properly log?
$& (some p.har)
==
^= har ^- (each (pair arvo worm) term)
=^ caq p.sew (~(spot wa p.sew) 3 wec)
?+ q.caq [%| (cat 3 %funk (@tas q.caq))]
::
{$pass p/* q/@tas r/{p/@tas q/*}}
%- (bond |.([%| p.r.q.caq]))
%+ biff ((soft @) q.q.caq)
|= lal/@tas
?. ((sane %tas) lal) ~
%+ biff ((soft path) p.q.caq)
|= pax/path
=^ yav p.sew (~(spot wa p.sew) 15 caq)
%+ bind (song yav)
|= {hil/mill vel/worm}
[%& [%pass pax lal hil] vel]
::
{$give p/{p/@tas q/*}}
%- (bond |.([%| p.p.q.caq]))
=^ yav p.sew (~(spot wa p.sew) 3 caq)
%+ bind (song yav)
|= {hil/mill vel/worm}
[%& [%give hil] vel]
::
{$sick p/{p/@tas q/*}}
%- (bond |.([%| p.p.q.caq]))
=^ yav p.sew (~(spot wa p.sew) 3 caq)
%+ bind (song yav)
|= {hil/mill vel/worm}
[%& [%sick hil] vel]
::
{$slip p/@tas q/{p/@tas q/*}}
%- (bond |.([%| p.q.q.caq]))
%+ biff ((soft @) p.q.caq)
|= lal/@tas
?. ((sane %tas) lal) ~
=^ yav p.sew (~(spot wa p.sew) 7 caq)
%+ bind (song yav)
|= {hil/mill vel/worm}
[%& [%slip lal hil] vel]
==
|=(b/(pair arvo worm) [`move`[a p.b] q.b])
2014-05-26 00:35:07 +04:00
::
++ said :: vase to (list move)
2015-12-20 23:50:45 +03:00
|= vud/vase
2015-01-15 22:10:29 +03:00
|- ^- (pair (list move) worm)
2015-01-13 04:49:31 +03:00
?: =(~ q.vud) [~ p.sew]
2015-01-15 22:10:29 +03:00
=^ hed p.sew (~(slot wa p.sew) 2 vud)
=^ tal p.sew (~(slot wa p.sew) 3 vud)
=^ mov p.sew (need (sump hed))
=^ moz p.sew $(vud tal)
2015-01-13 04:49:31 +03:00
[[mov moz] p.sew]
2014-05-26 00:35:07 +04:00
::
++ scry :: read namespace
2014-12-03 20:36:42 +03:00
~/ %scry
2015-12-20 23:50:45 +03:00
|= $: fur/(unit (set monk))
ren/care
bed/beam
2013-09-29 00:21:18 +04:00
==
2015-03-04 04:05:41 +03:00
^- (unit (unit (cask)))
2014-10-05 03:20:55 +04:00
:: ~& [%arvo-scry ren bed]
2014-05-31 23:40:02 +04:00
=+ ^= old
:* fur
ren
p.bed
2015-01-13 04:49:31 +03:00
q.bed
2014-05-31 23:40:02 +04:00
`coin`[%$ r.bed]
(flop s.bed)
==
2015-03-04 04:05:41 +03:00
^- (unit (unit (cask)))
2015-12-21 08:05:19 +03:00
=+ pro=(slym (slap rig [%limb %scry]) old)
2014-06-01 00:22:49 +04:00
?~ q.pro ~
?~ +.q.pro [~ ~]
=+ dat=(slot 7 pro)
2015-02-27 09:35:41 +03:00
[~ ~ (mark -.q.dat) +.q.dat]
2014-05-25 02:02:28 +04:00
::
++ soar :: scrub vane
2015-12-20 23:50:45 +03:00
|= sev/vase
2014-05-26 00:35:07 +04:00
^- vase
2015-01-13 04:49:31 +03:00
?: &(=(-.q.q.sew -.q.sev) =(+>.q.q.sew +>.q.sev))
q.sew :: unchanged, use old
sev(+<.q [*@da *@ =>(~ |~(* ~))]) :: clear to stop leak
2014-05-26 00:35:07 +04:00
::
2014-05-25 02:02:28 +04:00
++ swim
2014-12-03 20:36:42 +03:00
~/ %swim
2015-12-20 23:50:45 +03:00
|= $: org/@tas
pux/(unit wire)
hen/duct
hil/mill
2014-05-25 02:02:28 +04:00
==
2015-12-20 23:50:45 +03:00
^- {{p/(list move) q/worm} q/vase}
2015-01-13 15:40:15 +03:00
:: ~& [%swim-wyt `@ud`~(wyt in p.sew)]
2014-06-07 05:03:36 +04:00
=+ ^= pru
2014-05-25 02:02:28 +04:00
?~ pux
2015-12-08 04:23:27 +03:00
~| [%swim-call-vane lal ({term $~} +.p.hil)]
2015-12-21 08:05:19 +03:00
=^ vax p.sew (~(slap wa p.sew) rig [%limb %call])
2015-01-15 22:10:29 +03:00
%^ slur-pro lal vax
2014-06-07 05:03:36 +04:00
(slid [%& duc.vil hen] (slix hil))
2015-12-08 04:23:27 +03:00
~| [%swim-take-vane lal ({term $~} +.p.hil)]
2015-12-21 08:05:19 +03:00
=^ vax p.sew (~(slap wa p.sew) rig [%limb %take])
2015-06-12 20:56:30 +03:00
%^ slur-pro lal vax
;: slid
2015-06-12 20:56:30 +03:00
[%& pah.vil u.pux]
[%& duc.vil hen]
(slix (slid [%& [%atom %tas `org] org] hil))
==
2014-06-07 05:03:36 +04:00
?~ pru
2015-12-08 04:23:27 +03:00
~& [%swim-lost lal (@tas +>-.hil)]
2015-01-13 04:49:31 +03:00
[[~ p.sew] q.sew]
=^ pro p.sew (need pru)
2015-12-21 08:05:19 +03:00
=^ moz p.sew (~(slap wa p.sew) pro [%limb %p])
=^ vem p.sew (~(slap wa p.sew) pro [%limb %q])
2015-01-15 22:10:29 +03:00
[(said moz) (soar vem)]
2013-09-29 00:21:18 +04:00
--
--
::
2014-04-23 21:02:36 +04:00
++ vint :: create vane
2015-12-20 23:50:45 +03:00
|= {lal/@tas vil/vile bud/vase pax/path txt/@ta} ::
2015-01-15 22:10:29 +03:00
(vent lal vil bud *worm (slym (slap bud (rain pax txt)) bud))
2014-04-23 21:02:36 +04:00
::
++ viol :: vane tools
2015-12-26 13:07:50 +03:00
|= but/span
2013-09-29 00:21:18 +04:00
^- vile
2015-12-26 13:07:50 +03:00
=+ pal=|=(a/@t ^-(span (~(play ut but) (vice a))))
:* typ=(pal '*span')
2014-10-31 06:13:40 +03:00
duc=(pal '*duct')
pah=(pal '*path')
2015-12-08 04:23:27 +03:00
mev=(pal '*{$meta $vase}')
2013-09-29 00:21:18 +04:00
==
::
++ is :: operate in time
2015-12-20 23:50:45 +03:00
|= {vil/vile eny/@ bud/vase niz/(pair worm (list {p/@tas q/vase}))}
|_ now/@da
++ beck
2015-02-27 09:35:41 +03:00
^- slad
2015-12-20 23:50:45 +03:00
|= {fur/(unit (set monk)) ron/term bed/beam}
2015-03-04 04:05:41 +03:00
^- (unit (unit (cask)))
2014-05-31 23:40:02 +04:00
=> .(fur ?^(fur fur `[[%& p.bed] ~ ~])) :: XX heinous
2014-06-07 05:03:36 +04:00
=+ lal=(end 3 1 ron)
2014-05-31 23:40:02 +04:00
=+ ren=(care (rsh 3 1 ron))
2015-03-04 04:05:41 +03:00
|- ^- (unit (unit (cask)))
2015-01-13 04:49:31 +03:00
?~ q.niz ~
?. =(lal p.i.q.niz) $(q.niz t.q.niz)
%- scry:(wink:(vent lal vil bud p.niz q.i.q.niz) now (shax now) ..^$)
2014-06-01 00:22:49 +04:00
[fur ren bed]
2013-09-29 00:21:18 +04:00
::
++ dink :: vase by char
2015-12-20 23:50:45 +03:00
|= din/@tas ^- vase
2015-01-13 04:49:31 +03:00
?~(q.niz !! ?:(=(din p.i.q.niz) q.i.q.niz $(q.niz t.q.niz)))
2013-09-29 00:21:18 +04:00
::
2014-05-26 00:35:07 +04:00
++ dint :: input routing
2015-12-20 23:50:45 +03:00
|= hap/path ^- @tas
2013-09-29 00:21:18 +04:00
?+ hap !!
2015-12-04 22:32:49 +03:00
{@ $ames *} %a
{@ $boat *} %c
{@ $newt *} %a
{@ $sync *} %c
{@ $term *} %d
{@ $http *} %e
{@ $behn *} %b
2013-09-29 00:21:18 +04:00
==
::
++ doos :: sleep until
2015-12-20 23:50:45 +03:00
|= hap/path ^- (unit @da)
2014-06-07 05:03:36 +04:00
=+ lal=(dint hap)
2015-01-13 04:49:31 +03:00
(doze:(wink:(vent lal vil bud p.niz (dink lal)) now 0 beck) now [hap ~])
2013-09-29 00:21:18 +04:00
::
2014-05-25 02:02:28 +04:00
++ hurl :: start loop
2015-12-20 23:50:45 +03:00
|= {lac/? ovo/ovum}
2014-06-06 07:41:47 +04:00
~? &(!lac !=(%belt -.q.ovo)) [%unix -.q.ovo p.ovo]
2015-12-20 23:50:45 +03:00
^- {p/(list ovum) q/(pair worm (list {p/@tas q/vase}))}
2014-05-24 01:58:12 +04:00
?> ?=(^ p.ovo)
2014-06-06 07:41:47 +04:00
%+ kick lac
2014-06-06 02:14:49 +04:00
:~ :* i.p.ovo
~
2014-06-24 21:32:59 +04:00
:^ %pass t.p.ovo
2014-06-21 22:42:34 +04:00
(dint p.ovo)
2014-06-06 02:14:49 +04:00
:+ %&
[%cell [%atom %tas `%soft] %noun]
2014-06-06 02:14:49 +04:00
[%soft q.ovo]
==
==
2014-05-24 01:58:12 +04:00
::
++ race :: take
2015-12-20 23:50:45 +03:00
|= {org/@tas lal/@tas pux/(unit wire) hen/duct hil/mill ves/vase}
^- {p/{p/(list move) q/worm} q/vase}
2015-01-13 04:49:31 +03:00
=+ ven=(vent lal vil bud [p.niz ves])
2014-05-31 23:40:02 +04:00
=+ win=(wink:ven now (shax now) beck)
(swim:win org pux hen hil)
2014-05-25 02:02:28 +04:00
::
++ fire :: execute
2015-12-20 23:50:45 +03:00
|= {org/term lal/term pux/(unit wire) hen/duct hil/mill}
2015-12-04 22:32:49 +03:00
?: &(?=(^ pux) ?=($~ hen))
2015-01-13 04:49:31 +03:00
[[[[lal u.pux] (curd +>.hil)]~ ~] niz]
=+ naf=q.niz
2015-12-20 23:50:45 +03:00
|- ^- {{p/(list ovum) q/(list muse)} _niz}
2015-01-13 04:49:31 +03:00
?~ naf [[~ ~] [p.niz ~]]
2014-05-25 02:02:28 +04:00
?. =(lal p.i.naf)
=+ tuh=$(naf t.naf)
2015-01-13 04:49:31 +03:00
[-.tuh [+<.tuh [i.naf +>.tuh]]]
=+ fiq=(race org lal pux hen hil q.i.naf)
2015-12-20 23:50:45 +03:00
[[~ (turn p.p.fiq |=(a/move [lal a]))] [q.p.fiq [[p.i.naf q.fiq] t.naf]]]
2014-05-25 02:02:28 +04:00
::
++ jack :: dispatch card
2015-12-20 23:50:45 +03:00
|= {lac/? gum/muse}
^- {{p/(list ovum) q/(list muse)} _niz}
2015-01-19 17:25:52 +03:00
:: =. lac |(lac ?=(?(%g %f) p.gum))
2015-12-08 04:23:27 +03:00
:: =. lac &(lac !?=($b p.gum))
%+ fire
2015-06-12 20:56:30 +03:00
p.gum
2014-05-25 02:02:28 +04:00
?- -.r.gum
2015-12-08 04:23:27 +03:00
$pass
2014-06-24 21:32:59 +04:00
~? &(!lac !=(%$ p.gum))
2014-06-25 02:00:07 +04:00
:^ %pass [p.gum p.q.r.gum]
2015-12-08 04:23:27 +03:00
[(@tas +>-.q.q.r.gum) p.r.gum]
2014-06-25 02:00:07 +04:00
q.gum
2014-06-22 09:20:42 +04:00
[p.q.r.gum ~ [[p.gum p.r.gum] q.gum] q.q.r.gum]
2014-05-25 02:02:28 +04:00
::
2015-12-08 04:23:27 +03:00
$give
2014-05-25 02:34:00 +04:00
?> ?=(^ q.gum)
2014-12-11 18:49:01 +03:00
?. ?=(^ i.q.gum)
~& [%jack-bad-duct q.gum]
~& [%jack-bad-card +>-.p.r.gum]
!!
2014-06-06 07:41:47 +04:00
~? &(!lac |(!=(%blit +>-.p.r.gum) !=(%d p.gum)))
2015-12-08 04:23:27 +03:00
[%give p.gum (@tas +>-.p.r.gum) `duct`q.gum]
2014-05-25 02:34:00 +04:00
[i.i.q.gum [~ t.i.q.gum] t.q.gum p.r.gum]
2014-05-25 02:02:28 +04:00
::
2015-12-08 04:23:27 +03:00
$slip
~? !lac [%slip p.gum (@tas +>-.q.p.r.gum) q.gum]
2014-06-22 09:20:42 +04:00
[p.p.r.gum ~ q.gum q.p.r.gum]
2014-05-25 02:02:28 +04:00
::
2015-12-08 04:23:27 +03:00
$sick
2014-05-25 02:34:00 +04:00
?> ?=(^ q.gum)
2014-05-25 02:02:28 +04:00
?> ?=(^ i.q.gum)
2015-12-08 04:23:27 +03:00
~? !lac [%sick p.gum (@tas +>-.p.r.gum) `duct`q.gum]
2014-05-25 02:34:00 +04:00
[i.i.q.gum ?~(t.i.q.gum ~ [~ t.i.q.gum]) t.q.gum p.r.gum]
2014-05-25 02:02:28 +04:00
==
2013-09-29 00:21:18 +04:00
::
2014-05-24 02:04:50 +04:00
++ kick :: new main loop
2015-12-20 23:50:45 +03:00
|= {lac/? mor/(list muse)}
=| ova/(list ovum)
|- ^- {p/(list ovum) q/(pair worm (list {p/@tas q/vase}))}
2015-01-13 15:40:15 +03:00
?~ mor [(flop ova) niz]
2015-01-13 04:49:31 +03:00
=^ nyx niz (jack lac i.mor)
2015-04-30 01:48:45 +03:00
$(ova (weld p.nyx ova), mor (weld q.nyx t.mor))
2013-09-29 00:21:18 +04:00
--
--
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::: :::::: Postface ::::::
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
2014-01-06 02:10:49 +04:00
=+ pit=`vase`!>(.) ::
=+ bud=pit :: becomes tang
2014-05-29 22:46:43 +04:00
=+ vil=(viol p.bud) :: cached reflexives
2015-12-20 23:50:45 +03:00
=| $: lac/? :: laconic bit
eny/@ :: entropy
niz/(pair worm (list {p/@tas q/vase})) :: modules
2014-06-06 07:41:47 +04:00
== ::
2013-09-29 00:21:18 +04:00
=< |%
2015-12-04 22:32:49 +03:00
++ come |= {@ (list ovum) pone} :: 11
2015-12-15 01:21:10 +03:00
^- {(list ovum) _+>}
2013-09-29 00:21:18 +04:00
~& %hoon-come
=^ rey +>+ (^come +<)
[rey +>.$]
2015-12-04 22:32:49 +03:00
++ keep |=(* (^keep ((hard {@da path}) +<))) :: 4
++ load |= {@ (list ovum) pane} :: 86
2015-12-15 01:21:10 +03:00
^- {(list ovum) _+>}
2013-09-29 00:21:18 +04:00
~& %hoon-load
=^ rey +>+ (^load +<)
[rey +>.$]
2015-12-04 22:32:49 +03:00
++ peek |=(* (^peek ((hard {@da path}) +<))) :: 87
2013-09-29 00:21:18 +04:00
++ poke |= * :: 42
2015-12-08 04:46:28 +03:00
^- {(list ovum) *}
2015-12-20 23:50:45 +03:00
=> .(+< ((hard {now/@da ovo/ovum}) +<))
2014-06-06 07:41:47 +04:00
?: =(%verb -.q.ovo)
[~ +>.$(lac !lac)]
2015-12-04 22:32:49 +03:00
?: ?=($veer -.q.ovo)
2014-05-31 00:57:49 +04:00
[~ +>.$(+ (veer now q.ovo))]
2013-09-29 00:21:18 +04:00
=^ ova +>+ (^poke now ovo)
2015-12-04 22:32:49 +03:00
|- ^- {(list ovum) *}
2013-09-29 00:21:18 +04:00
?~ ova
[~ +>.^$]
2015-12-04 22:32:49 +03:00
?: ?=($verb -.q.i.ova)
2014-06-06 07:41:47 +04:00
$(ova t.ova, lac !lac)
2015-12-04 22:32:49 +03:00
?: ?=($veer -.q.i.ova)
2014-05-31 00:57:49 +04:00
$(ova t.ova, +>+.^$ (veer now q.i.ova))
2015-12-04 22:32:49 +03:00
?: ?=($vega -.q.i.ova)
2014-01-06 03:38:34 +04:00
(vega now t.ova (path +.q.i.ova))
2015-12-04 22:32:49 +03:00
?: ?=($mass -.q.i.ova)
2015-05-07 05:25:41 +03:00
=+ avo=$(ova t.ova)
:_ +.avo
:_ -.avo
%= i.ova
q.q
2015-05-13 00:18:34 +03:00
:- %userspace
2015-05-07 05:25:41 +03:00
:- %|
2015-12-21 00:16:39 +03:00
:~ hoon+`pit
zuse+`bud
hoon-cache+`p.niz
2015-05-13 00:18:34 +03:00
q.q.i.ova
2015-12-21 00:16:39 +03:00
dot+`.
2015-05-07 05:25:41 +03:00
==
==
2013-09-29 00:21:18 +04:00
=+(avo=$(ova t.ova) [[i.ova -.avo] +.avo])
2015-12-08 04:23:27 +03:00
++ wish |=(* (^wish ((hard @ta) +<))) :: 20
2013-09-29 00:21:18 +04:00
--
|%
++ come :: load incompatible
2015-12-20 23:50:45 +03:00
|= {yen/@ ova/(list ovum) nyf/pone}
2013-09-29 00:21:18 +04:00
^+ [ova +>]
2015-12-20 23:50:45 +03:00
(load yen ova (turn nyf |=({a/@tas b/vise} [a (slim b)])))
2013-09-29 00:21:18 +04:00
::
++ keep :: wakeup delay
2015-12-20 23:50:45 +03:00
|= {now/@da hap/path}
=> .(+< ((hard {now/@da hap/path}) +<))
2015-01-13 04:49:31 +03:00
(~(doos (is vil eny bud niz) now) hap)
2013-09-29 00:21:18 +04:00
::
++ load :: load compatible
2015-12-20 23:50:45 +03:00
|= {yen/@ ova/(list ovum) nyf/pane}
2013-09-29 00:21:18 +04:00
^+ [ova +>]
=: eny yen
2015-01-13 04:49:31 +03:00
q.niz nyf
2013-09-29 00:21:18 +04:00
==
|- ^+ [ova +>.^$]
?~ ova
[~ +>.^$]
2015-12-08 04:23:27 +03:00
?: ?=($verb -.q.i.ova)
2014-06-06 07:41:47 +04:00
$(ova t.ova, lac !lac)
2015-12-08 04:23:27 +03:00
?: ?=($veer -.q.i.ova)
$(ova t.ova, +>.^$ (veer *@da q.i.ova))
2013-09-29 00:21:18 +04:00
=+(avo=$(ova t.ova) [[i.ova -.avo] +.avo])
::
++ peek :: external inspect
2015-12-20 23:50:45 +03:00
|= {now/@da hap/path}
2013-09-29 00:21:18 +04:00
^- (unit)
2014-07-19 04:51:22 +04:00
?~ hap [~ hoon]
2015-01-13 04:49:31 +03:00
=+ rob=((slod ~(beck (is vil eny bud niz) now)) hap)
2014-05-02 03:33:15 +04:00
?~ rob ~
?~ u.rob ~
[~ u.u.rob]
2013-09-29 00:21:18 +04:00
::
++ poke :: external apply
2015-12-20 23:50:45 +03:00
|= {now/@da ovo/ovum}
=. eny (mix eny (shax now))
2014-05-29 23:06:08 +04:00
:: ~& [%poke -.q.ovo]
2015-12-15 01:21:10 +03:00
^- {(list ovum) _+>}
2015-01-13 15:40:15 +03:00
=^ zef niz
2015-01-13 04:49:31 +03:00
(~(hurl (is vil eny bud niz) now) lac ovo)
2013-09-29 00:21:18 +04:00
[zef +>.$]
::
2014-01-06 03:38:34 +04:00
++ vega :: reboot kernel
2015-12-20 23:50:45 +03:00
|= {now/@da ova/(list ovum) hap/path}
^- {p/(list ovum) q/*}
2014-01-06 03:38:34 +04:00
=+ pax=(weld hap `path`[%hoon ~])
~& [%vega-start hap]
2015-12-21 00:16:39 +03:00
=+ src=((hard @t) (need (peek now cx+pax)))
2014-01-06 03:38:34 +04:00
=+ saz=(shax src)
=+ gen=(rain hap src)
2014-01-06 03:38:34 +04:00
~& %vega-parsed
=+ ken=.*(0 q:(~(mint ut %noun) %noun gen))
2014-01-06 04:36:29 +04:00
=+ ^= nex
=+ gat=.*(ken .*(ken [0 87]))
2015-12-04 22:32:49 +03:00
(need ((hard (unit @)) .*([-.gat [[now ~] +>.gat]] -.gat)))
2014-07-19 04:51:22 +04:00
~& [%vega-compiled hoon nex]
?> (lte nex hoon)
=+ gat=.*(ken .*(ken [0 ?:(=(nex hoon) 86 11)]))
2015-01-13 04:49:31 +03:00
=+ sam=[eny ova q.niz]
2014-01-06 03:38:34 +04:00
=+ raw=.*([-.gat [sam +>.gat]] -.gat)
2014-02-15 05:35:22 +04:00
[[[~ %vega hap] ((list ovum) -.raw)] +.raw]
2014-01-06 03:38:34 +04:00
::
2015-12-21 00:16:39 +03:00
++ veer :: install vane+tang
2015-12-20 23:50:45 +03:00
|= {now/@da fav/curd}
=> .(fav ((hard {$veer lal/@ta pax/path txt/@t}) fav))
2014-05-31 00:57:49 +04:00
?: =(%$ lal.fav)
~& [%tang pax.fav `@p`(mug txt.fav)]
2014-05-31 00:57:49 +04:00
=+ gen=(rain pax.fav txt.fav)
2013-09-29 00:21:18 +04:00
=+ vax=(slap pit gen)
+>.$(bud vax)
%_ +>
2015-01-13 04:49:31 +03:00
q.niz
|- ^+ q.niz
?~ q.niz
~& [%vane `@tas`lal.fav pax.fav `@p`(mug txt.fav)]
2015-01-13 04:49:31 +03:00
[[lal.fav q.sew:(vint lal.fav vil bud pax.fav txt.fav)] q.niz]
?. =(lal.fav p.i.q.niz)
[i.q.niz $(q.niz t.q.niz)]
~& [%vane `@tas`lal.fav pax.fav `@p`(mug txt.fav)]
2015-01-13 04:49:31 +03:00
:_ t.q.niz
:- p.i.q.niz
q.sew:(ruck:(vent lal.fav vil bud [p.niz q.i.q.niz]) pax.fav txt.fav)
2013-09-29 00:21:18 +04:00
==
::
++ wish :: external compute
2015-12-20 23:50:45 +03:00
|= txt/@
2013-09-29 00:21:18 +04:00
q:(slap bud (ream txt))
--
2014-01-04 11:28:16 +04:00
. ==