added some comments to hoon.hoon

This commit is contained in:
johncburnham 2014-04-04 03:00:26 -07:00
parent d97f32f4d5
commit bea2dd0d55

View File

@ -27,7 +27,7 @@
++ abel typo :: original sin: type ++ abel typo :: original sin: type
++ axis ,@ :: tree address ++ axis ,@ :: tree address
++ also ,[p=term q=wing r=type] :: alias ++ also ,[p=term q=wing r=type] :: alias
++ base ?([%atom p=odor] %noun %cell %bean %null) :: ++ base ?([%atom p=odor] %noun %cell %bean %null) :: axils, @ * ^ ? ~
++ beer $|(@ [~ p=twig]) :: simple embed ++ beer $|(@ [~ p=twig]) :: simple embed
++ beet $| @ :: advanced embed ++ beet $| @ :: advanced embed
$% [%a p=twig] :: $% [%a p=twig] ::
@ -38,13 +38,13 @@
== :: == ::
++ bloq ,@ :: blockclass ++ bloq ,@ :: blockclass
++ calf ,[p=(map ,@ud wine) q=wine] :: ++ calf ,[p=(map ,@ud wine) q=wine] ::
++ char ,@tD :: ++ char ,@tD :: UTF-8 byte
++ chum $? lef=term :: ++ chum $? lef=term :: jet name
[std=term kel=@] :: [std=term kel=@] :: kelvin version
[ven=term pro=term kel=@] :: [ven=term pro=term kel=@] :: vendor and product
[ven=term pro=term ver=@ kel=@] :: [ven=term pro=term ver=@ kel=@] :: all of the above
== :: == ::
++ claw $% [%ash p=twig] :: ++ claw $% [%ash p=twig] :: XX not used
[%elm p=twig] :: [%elm p=twig] ::
[%oak ~] :: [%oak ~] ::
[%yew p=(map term claw)] :: [%yew p=(map term claw)] ::
@ -58,28 +58,28 @@
[%blob p=*] :: [%blob p=*] ::
[%many p=(list coin)] :: [%many p=(list coin)] ::
== :: == ::
++ cord ,@t :: ++ cord ,@t :: text atom (UTF-8)
++ date ,[[a=? y=@ud] m=@ud t=tarp] :: parsed date ++ date ,[[a=? y=@ud] m=@ud t=tarp] :: parsed date
++ dime ,[p=@ta q=@] :: ++ dime ,[p=@ta q=@] ::
++ dram $% [| p=(map ,@tas dram)] :: ++ dram $% [| p=(map ,@tas dram)] :: simple unix dir
[& p=@ud q=@] :: [& p=@ud q=@] ::
== :: == ::
++ each |*([a=$+(* *) b=$+(* *)] $%([& p=a] [| p=b])) :: ++ each |*([a=$+(* *) b=$+(* *)] $%([& p=a] [| p=b])) ::
++ edge ,[p=hair q=(unit ,[p=* q=nail])] :: ++ edge ,[p=hair q=(unit ,[p=* q=nail])] :: parsing output
++ foot $% [%ash p=twig] :: ++ foot $% [%ash p=twig] :: dry arm, geometric
[%elm p=twig] :: [%elm p=twig] :: wet arm, generic
[%oak ~] :: [%oak ~] :: XX not used
[%yew p=(map term foot)] :: [%yew p=(map term foot)] :: XX not used
== :: == ::
++ gear |* a=_,* :: list generator ++ gear |* a=_,* :: XX list generator
$_ :: $_ ::
=| b=* :: =| b=* ::
|? :: |? ::
?@ b :: ?@ b ::
~ :: ~ ::
[i=(a -.b) t=^?(..$(b +.b))] :: [i=(a -.b) t=^?(..$(b +.b))] ::
++ hair ,[p=@ud q=@ud] :: ++ hair ,[p=@ud q=@ud] :: parsing trace
++ hapt (list ,@ta) :: ++ hapt (list ,@ta) :: XX not used
++ like |* a=_,* :: generic edge ++ like |* a=_,* :: generic edge
|= b=_`*`[(hair) ~] :: |= b=_`*`[(hair) ~] ::
:- p=(hair -.b) :: :- p=(hair -.b) ::
@ -87,9 +87,9 @@
?@ +.b ~ :: ?@ +.b ~ ::
:- ~ :: :- ~ ::
u=[p=(a +>-.b) q=[p=(hair -.b) q=(tape +.b)]] :: u=[p=(a +>-.b) q=[p=(hair -.b) q=(tape +.b)]] ::
++ limb $|(term $%([%& p=axis] [%| p=@ud q=term])) :: ++ limb $|(term $%([%& p=axis] [%| p=@ud q=term])) ::
++ line ,[p=[%leaf p=odor q=@] q=tile] :: ++ line ,[p=[%leaf p=odor q=@] q=tile] :: %kelp case
++ list |* a=_,* :: ++ list |* a=_,* :: null-term list
$|(~ [i=a t=(list a)]) :: $|(~ [i=a t=(list a)]) ::
++ mane $|(@tas [@tas @tas]) :: XML name/space ++ mane $|(@tas [@tas @tas]) :: XML name/space
++ mano ,[g=marx c=marl] :: normalized manx ++ mano ,[g=marx c=marl] :: normalized manx
@ -98,17 +98,17 @@
++ mars ,[t=[n=%$ a=[i=[n=%$ v=tape] t=~]] c=~] :: XML cdata ++ mars ,[t=[n=%$ a=[i=[n=%$ v=tape] t=~]] c=~] :: XML cdata
++ mart (list ,[n=mane v=tape]) :: XML attributes ++ mart (list ,[n=mane v=tape]) :: XML attributes
++ marx $|(@tas [n=mane a=mart]) :: XML tag ++ marx $|(@tas [n=mane a=mart]) :: XML tag
++ metl ?(%gold %iron %zinc %lead) :: ++ metl ?(%gold %iron %zinc %lead) :: core variance
++ odor ,@ta :: ++ odor ,@ta :: atom format
++ tarp ,[d=@ud h=@ud m=@ud s=@ud f=(list ,@ux)] :: parsed time ++ tarp ,[d=@ud h=@ud m=@ud s=@ud f=(list ,@ux)] :: parsed time
++ time ,@da :: galactic time ++ time ,@da :: galactic time
++ tree |* a=_,* :: binary tree ++ tree |* a=_,* :: binary tree
$|(~ [n=a l=(tree a) r=(tree a)]) :: $|(~ [n=a l=(tree a) r=(tree a)]) ::
++ nail ,[p=hair q=tape] :: ++ nail ,[p=hair q=tape] :: parsing input
++ numb ,@ :: just a number ++ numb ,@ :: just a number
++ pass ,@ :: ++ pass ,@ :: public key
++ path (list span) :: ++ path (list span) :: filesys location
++ pint ,[p=[p=@ q=@] q=[p=@ q=@]] :: ++ pint ,[p=[p=@ q=@] q=[p=@ q=@]] :: line/column range
++ port $: p=axis :: ++ port $: p=axis ::
$= q :: $= q ::
$% [%& p=type] :: $% [%& p=type] ::
@ -126,22 +126,22 @@
$= q :: $= q ::
[p=?(~ axis) q=(list ,[p=type q=foot])] :: [p=?(~ axis) q=(list ,[p=type q=foot])] ::
== :: == ::
++ reef ,[p=[p=? q=@ud] q=@ud] :: ++ reef ,[p=[p=? q=@ud] q=@ud] :: XX not used
++ ring ,@ :: ++ ring ,@ :: private key
++ rule |=(tub=nail `edge`[p.tub ~ ~ tub]) :: ++ rule |=(tub=nail `edge`[p.tub ~ ~ tub]) :: parsing rule
++ shoe $% [%hunk p=tank] :: ++ shoe $% [%hunk p=tank] :: XX not used
[%lose p=term] :: [%lose p=term] ::
[%mean p=*] :: [%mean p=*] ::
[%spot p=spot] :: [%spot p=spot] ::
== :: == ::
++ span ,@ta :: ++ span ,@ta :: text-atom (ASCII)
++ spot ,[p=path q=pint] :: ++ spot ,[p=path q=pint] :: range in file
++ tank $% [%leaf p=tape] :: ++ tank $% [%leaf p=tape] :: printing formats
[%palm p=[p=tape q=tape r=tape s=tape] q=(list tank)] [%palm p=[p=tape q=tape r=tape s=tape] q=(list tank)]
[%rose p=[p=tape q=tape r=tape] q=(list tank)] [%rose p=[p=tape q=tape r=tape] q=(list tank)]
== :: == ::
++ tape (list char) :: ++ tape (list char) :: like a string
++ term ,@tas :: ++ term ,@tas :: Hoon ASCII subset
++ tiki :: test case ++ tiki :: test case
$% [& p=(unit term) q=wing] :: simple wing $% [& p=(unit term) q=wing] :: simple wing
[| p=(unit term) q=twig] :: named wing [| p=(unit term) q=twig] :: named wing
@ -173,129 +173,130 @@
== :: == ::
++ twig $& [p=twig q=twig] :: ++ twig $& [p=twig q=twig] ::
$% :: $% ::
[%$ p=axis] :: [%$ p=axis] :: blip, empty name
[%bccb p=tile] :: :: :::::: tile reductions
[%bccm p=tile] :: [%bccb p=tile] :: bunt a tile
[%bcpt p=wing q=tile] :: [%bccm p=tile] :: clam a tile
[%bctr p=tile] :: [%bcpt p=wing q=tile] :: whip p into q
[%bczp p=base] :: [%bctr p=tile] :: static bunt w/ ^~
:: :: [%bczp p=base] :: bunt an axil
[%brcb p=tile q=(map term foot)] :: :: :::::: cores
[%brcn p=(map term foot)] :: [%brcb p=tile q=(map term foot)] :: %gold tray, sample p
[%brdt p=twig] :: [%brcn p=(map term foot)] :: %gold core, natural
[%brfs p=tile q=(map term foot)] :: [%brdt p=twig] :: dry %gold trap
[%brkt p=twig q=(map term foot)] :: [%brfs p=tile q=(map term foot)] :: vulcan. %gold tray
[%brhp p=twig] :: [%brkt p=twig q=(map term foot)] :: %gold book
[%brls p=tile q=twig] :: [%brhp p=twig] :: kick dry %gold trap
[%brpt p=tile q=tile r=twig] :: [%brls p=tile q=twig] :: dry %iron gate
[%brtr p=tile q=twig] :: [%brpt p=tile q=tile r=twig] :: XX not used
[%brts p=tile q=twig] :: [%brtr p=tile q=twig] :: vulcan. wet gate
[%brwt p=twig] :: [%brts p=tile q=twig] :: dry %gold gate
:: :: [%brwt p=twig] :: dry %lead trap
[%clcb p=twig q=twig] :: :: :::::: tuples
[%clcn p=tusk] :: [%clcb p=twig q=twig] :: [q p]
[%clfs p=twig] :: [%clcn p=tusk] :: [[p ~] ~]
[%clkt p=twig q=twig r=twig s=twig] :: [%clfs p=twig] :: [%$ [%$ p ~] ~]
[%clhp p=twig q=twig] :: [%clkt p=twig q=twig r=twig s=twig] :: [p q r s]
[%clls p=twig q=twig r=twig] :: [%clhp p=twig q=twig] :: [p q]
[%clsg p=tusk] :: [%clls p=twig q=twig r=twig] :: [p q r]
[%cltr p=tusk] :: [%clsg p=tusk] :: [p ~]
[%clzz p=tusk] :: [%cltr p=tusk] :: p as a tuple
:: :: [%clzz p=tusk] :: macro
[%cncb p=wing q=tram] :: :: :::::: invocations
[%cncl p=twig q=twig] :: [%cncb p=wing q=tram] :: %=, then cast to p
[%cndt p=twig q=twig] :: [%cncl p=twig q=twig] :: pull $.p w/ sample q
[%cnhp p=twig q=tusk] :: [%cndt p=twig q=twig] :: %-(q p)
[%cntr p=wing q=twig r=tram] :: [%cnhp p=twig q=tusk] :: slam p w/ sample q
[%cnkt p=twig q=twig r=twig s=twig] :: [%cntr p=wing q=twig r=tram] ::
[%cnls p=twig q=twig r=twig] :: [%cnkt p=twig q=twig r=twig s=twig] :: slam p w/ %*(q r s)
[%cnsg p=wing q=twig r=twig] :: [%cnls p=twig q=twig r=twig] :: slam p w/ %*(q r)
[%cnts p=wing q=tram] :: [%cnsg p=wing q=twig r=twig] :: pull p from q with r
[%cnzy p=term] :: [%cnts p=wing q=tram] :: eval. p w/ q changes
[%cnzz p=wing] :: [%cnzy p=term] :: pulls limb p
:: :: [%cnzz p=wing] :: pulls p
[%dtkt p=twig] :: :: :::::: nock
[%dtls p=twig] :: [%dtkt p=twig] :: Nock 11 data skyhook
[%dtzy p=term q=@] :: [%dtls p=twig] :: Nock 4 increment
[%dtzz p=term q=*] :: [%dtzy p=term q=@] :: atom constant
[%dttr p=twig q=twig] :: [%dtzz p=term q=*] :: cubical constant
[%dtts p=twig q=twig] :: [%dttr p=twig q=twig] :: nock p w/ formula q
[%dtwt p=twig] :: [%dtts p=twig q=twig] :: Nock 5 equality test
:: :: [%dtwt p=twig] :: Nock 3 cell test
[%hxgl p=tusk] :: :: :::::: prettyprinter
[%hxgr p=tusk] :: [%hxgl p=tusk] :: slam noah w/ !>:*(p)
:: :: [%hxgr p=tusk] :: slam cain w/ !>:*(p)
[%ktbr p=twig] :: :: :::::: type conversion
[%ktdt p=twig q=twig] :: [%ktbr p=twig] :: %gold core to %iron
[%ktls p=twig q=twig] :: [%ktdt p=twig q=twig] :: cast q to type (p q)
[%kthp p=tile q=twig] :: [%ktls p=twig q=twig] :: cast q to p, verify
[%ktpm p=twig] :: [%kthp p=tile q=twig] :: cast q to icon of p
[%ktsg p=twig] :: [%ktpm p=twig] :: %gold core to %zinc
[%ktts p=toga q=twig] :: [%ktsg p=twig] :: p as static constant
[%ktwt p=twig] :: [%ktts p=toga q=twig] :: wrap q in toga p
:: :: [%ktwt p=twig] :: %gold core to %lead
[%sgbr p=twig q=twig] :: :: :::::: hints
[%sgcb p=twig q=twig] :: [%sgbr p=twig q=twig] :: print p if q fails
[%sgcn p=chum q=twig r=tyre s=twig] :: [%sgcb p=twig q=twig] :: put p in q's trace
[%sgfs p=chum q=twig] :: [%sgcn p=chum q=twig r=tyre s=twig] :: mark core for jets
[%sggl p=$|(term [p=term q=twig]) q=twig] :: [%sgfs p=chum q=twig] :: jet arm in ~% core
[%sggr p=$|(term [p=term q=twig]) q=twig] :: [%sggl p=$|(term [p=term q=twig]) q=twig] :: hint p to product q
[%sgbc p=term q=twig] :: [%sggr p=$|(term [p=term q=twig]) q=twig] :: hint p to q
[%sgls p=@ q=twig] :: [%sgbc p=term q=twig] :: label q, profiling
[%sgpm p=@ud q=twig r=twig] :: [%sgls p=@ q=twig] :: cache/memoize
[%sgts p=twig q=twig] :: [%sgpm p=@ud q=twig r=twig] :: print q w/priority
[%sgwt p=@ud q=twig r=twig s=twig] :: [%sgts p=twig q=twig] :: avoid duplication
[%sgzp p=twig q=twig] :: [%sgwt p=@ud q=twig r=twig s=twig] :: hint iff q is yes
:: :: [%sgzp p=twig q=twig] :: type in stacktrace
[%smcl p=twig q=tusk] :: :: :::::: miscellaneous
[%smdt p=twig q=tusk] :: [%smcl p=twig q=tusk] :: binary to n-ary
[%smdq p=(list beer)] :: [%smdt p=twig q=tusk] ::
[%smsg p=twig q=tusk] :: [%smdq p=(list beer)] :: assemble string
[%smsm p=twig q=twig] :: [%smsg p=twig q=tusk] :: gonads
:: :: [%smsm p=twig q=twig] :: make sure q is a p
[%tsbr p=tile q=twig] :: :: :::::: compositions
[%tscl p=tram q=twig] :: [%tsbr p=tile q=twig] :: push bunt: =+(_p q)
[%tscn p=twig q=twig] :: [%tscl p=tram q=twig] :: p changes, then q
[%tsdt p=wing q=twig r=twig] :: [%tscn p=twig q=twig] :: XX not used
[%tsfs p=twig q=twig] :: [%tsdt p=wing q=twig r=twig] :: r with p set to q
[%tsgl p=twig q=twig] :: [%tsfs p=twig q=twig] :: XX not used
[%tshp p=twig q=twig] :: [%tsgl p=twig q=twig] :: =>(q p)
[%tsgr p=twig q=twig] :: [%tshp p=twig q=twig] :: flip push: =+(q p)
[%tskt p=twig q=twig r=twig s=twig] :: [%tsgr p=twig q=twig] :: use p as .. of q
[%tsls p=twig q=twig] :: [%tskt p=twig q=twig r=twig s=twig] :: state machine wing
[%tspm p=tile q=twig] :: [%tsls p=twig q=twig] :: push p on .. of q
[%tspt p=tile q=twig] :: [%tspm p=tile q=twig] :: XX not used
[%tstr p=term q=wing r=twig] :: [%tspt p=tile q=twig] :: XX not used
[%tssg p=tusk] :: [%tstr p=term q=wing r=twig] :: make a %bull/alias
:: :: [%tssg p=tusk] :: compose twig list
[%wtbr p=tusk] :: :: :::::: conditionals
[%wthp p=wing q=tine] :: [%wtbr p=tusk] :: logical OR
[%wthz p=tiki q=tine] :: [%wthp p=wing q=tine] :: select case in q
[%wtcl p=twig q=twig r=twig] :: [%wthz p=tiki q=tine] :: tiki %wthp
[%wtdt p=twig q=twig r=twig] :: [%wtcl p=twig q=twig r=twig] :: if p, then q, else r
[%wtkt p=wing q=twig r=twig] :: [%wtdt p=twig q=twig r=twig] :: unless, ?:(p r q)
[%wtkz p=tiki q=twig r=twig] :: [%wtkt p=wing q=twig r=twig] :: if p is not its bunt
[%wtgl p=twig q=twig] :: [%wtkz p=tiki q=twig r=twig] :: tiki %wtkt
[%wtgr p=twig q=twig] :: [%wtgl p=twig q=twig] :: assert |, ?:(p !! q)
[%wtls p=wing q=twig r=tine] :: [%wtgr p=twig q=twig] :: assert &, ?:(p q !!)
[%wtlz p=tiki q=twig r=tine] :: [%wtls p=wing q=twig r=tine] :: %wthp w/ default
[%wtpm p=tusk] :: [%wtlz p=tiki q=twig r=tine] :: tiki %wtls
[%wtpt p=wing q=twig r=twig] :: [%wtpm p=tusk] :: logical AND
[%wtpz p=tiki q=twig r=twig] :: [%wtpt p=wing q=twig r=twig] :: if p is an atom
[%wtsg p=wing q=twig r=twig] :: [%wtpz p=tiki q=twig r=twig] :: tiki %wtpt
[%wtsz p=tiki q=twig r=twig] :: [%wtsg p=wing q=twig r=twig] :: if p is null
[%wtts p=tile q=wing] :: [%wtsz p=tiki q=twig r=twig] :: tiki %wtsg
[%wtzp p=twig] :: [%wtts p=tile q=wing] :: if q is in tile p
:: :: [%wtzp p=twig] :: logical NOT
[%zpcb p=spot q=twig] :: :: :::::: special
[%zpcb p=spot q=twig] :: debug info in trace
[%zpcm p=twig q=twig] :: [%zpcm p=twig q=twig] ::
[%zpcn ~] :: [%zpcn ~] ::
[%zpfs p=twig] :: [%zpfs p=twig] :: report .. as error
[%zpgr p=twig] :: [%zpgr p=twig] :: vase w/ value p
[%zpsm p=twig q=twig] :: [%zpsm p=twig q=twig] :: [type noun] pair
[%zpts p=twig] :: [%zpts p=twig] :: Nock formula of p
[%zpwt p=$|(p=@ [p=@ q=@]) q=twig] :: [%zpwt p=$|(p=@ [p=@ q=@]) q=twig] :: restrict hoon vers.
[%zpzp ~] :: [%zpzp ~] :: always crash
== :: == ::
++ tine (list ,[p=tile q=twig]) :: ++ tine (list ,[p=tile q=twig]) ::
++ tusk (list twig) :: ++ tusk (list twig) ::
@ -306,19 +307,20 @@
[%1 p=(list)] :: [%1 p=(list)] ::
[%2 p=(list ,[@ta *])] :: [%2 p=(list ,[@ta *])] ::
== :: == ::
++ nock $& [p=nock q=nock] :: :: :::::: virtual nock
$% [%0 p=@] :: ++ nock $& [p=nock q=nock] :: autocons
[%1 p=*] :: $% [%0 p=@] :: axis select
[%2 p=nock q=nock] :: [%1 p=*] :: constant
[%3 p=nock] :: [%2 p=nock q=nock] :: compose
[%4 p=nock] :: [%3 p=nock] :: cell test
[%5 p=nock q=nock] :: [%4 p=nock] :: increment
[%6 p=nock q=nock r=nock] :: [%5 p=nock q=nock] :: equality test
[%7 p=nock q=nock] :: [%6 p=nock q=nock r=nock] :: if, then, else
[%8 p=nock q=nock] :: [%7 p=nock q=nock] :: serial compose
[%9 p=@ q=nock] :: [%8 p=nock q=nock] :: push onto subject
[%10 p=?(@ [p=@ q=nock]) q=nock] :: [%9 p=@ q=nock] :: select arm and fire
[%11 p=nock] :: [%10 p=?(@ [p=@ q=nock]) q=nock] :: hint
[%11 p=nock] :: grab data from sky
== :: == ::
++ toon $% [%0 p=*] :: ++ toon $% [%0 p=*] ::
[%1 p=(list)] :: [%1 p=(list)] ::
@ -329,15 +331,15 @@
[%2 p=(list ,[@ta *])] :: [%2 p=(list ,[@ta *])] ::
== :: == ::
++ twin ,[p=term q=wing r=axis s=type] :: ++ twin ,[p=term q=wing r=axis s=type] ::
++ type $| ?(%noun %void) :: ++ type $| ?(%noun %void) :: set all or set none
$% [%atom p=term] :: $% [%atom p=term] :: number and format
[%bull p=twin q=type] :: [%bull p=twin q=type] :: wing synonym
[%cell p=type q=type] :: [%cell p=type q=type] :: ordered pair
[%core p=type q=coil] :: [%core p=type q=coil] ::
[%cube p=* q=type] :: [%cube p=* q=type] :: constant
[%face p=term q=type] :: [%face p=term q=type] :: name
[%fork p=type q=type] :: [%fork p=type q=type] :: union/branch
[%hold p=(list ,[p=type q=twig])] :: [%hold p=(list ,[p=type q=twig])] :: infinite genrator
== :: == ::
++ typo type :: old type ++ typo type :: old type
++ udal :: atomic change (%b) ++ udal :: atomic change (%b)
@ -376,7 +378,7 @@
++ vise ,[p=typo q=*] :: old vase ++ vise ,[p=typo q=*] :: old vase
++ wall (list tape) :: text lines (no \n) ++ wall (list tape) :: text lines (no \n)
++ wain (list cord) :: text lines (no \n) ++ wain (list cord) :: text lines (no \n)
++ wing (list limb) :: ++ wing (list limb) ::
++ wine $| ?(%noun %path %tank %void %wall %wool %yarn) ++ wine $| ?(%noun %path %tank %void %wall %wool %yarn)
$% [%atom p=term] :: $% [%atom p=term] ::
[%core p=(list ,@ta) q=wine] :: [%core p=(list ,@ta) q=wine] ::
@ -1105,17 +1107,20 @@
:: ::
++ si :: signed integer ++ si :: signed integer
|% |%
++ abs |=(a=@s (add (end 0 1 a) (rsh 0 1 a))) ++ abs |=(a=@s (add (end 0 1 a) (rsh 0 1 a))) :: absolute value
++ dif |=([a=@s b=@s] (sum a (new !(syn b) (abs b)))) ++ dif |= [a=@s b=@s] :: subtraction
++ dul |=([a=@s b=@] =+(c=(old a) ?:(-.c (mod +.c b) (sub b +.c)))) (sum a (new !(syn b) (abs b)))
++ fra |= [a=@s b=@s] ++ dul |= [a=@s b=@] :: modulus
=+(c=(old a) ?:(-.c (mod +.c b) (sub b +.c)))
++ fra |= [a=@s b=@s] :: division
(new =(0 (mix (syn a) (syn b))) (div (abs a) (abs b))) (new =(0 (mix (syn a) (syn b))) (div (abs a) (abs b)))
++ new |=([a=? b=@] `@s`?:(a (mul 2 b) ?:(=(0 b) 0 +((mul 2 (dec b)))))) ++ new |= [a=? b=@] :: [sign value] to @s
++ old |=(a=@s [(syn a) (abs a)]) `@s`?:(a (mul 2 b) ?:(=(0 b) 0 +((mul 2 (dec b)))))
++ pro |= [a=@s b=@s] ++ old |=(a=@s [(syn a) (abs a)]) :: [sign value]
++ pro |= [a=@s b=@s] :: multiplication
(new =(0 (mix (syn a) (syn b))) (mul (abs a) (abs b))) (new =(0 (mix (syn a) (syn b))) (mul (abs a) (abs b)))
++ rem |=([a=@s b=@s] (dif a (pro b (fra a b)))) ++ rem |=([a=@s b=@s] (dif a (pro b (fra a b)))) :: remainder
++ sum |= [a=@s b=@s] ++ sum |= [a=@s b=@s] :: addition
~| %si-sum ~| %si-sum
=+ [c=(old a) d=(old b)] =+ [c=(old a) d=(old b)]
?: -.c ?: -.c
@ -1129,8 +1134,8 @@
(new | (sub +.c +.d)) (new | (sub +.c +.d))
(new & (sub +.d +.c)) (new & (sub +.d +.c))
(new | (add +.c +.d)) (new | (add +.c +.d))
++ sun |=(a=@u (mul 2 a)) ++ sun |=(a=@u (mul 2 a)) :: @u to @s
++ syn |=(a=@s =(0 (end 0 1 a))) ++ syn |=(a=@s =(0 (end 0 1 a))) :: sign test
-- --
++ fe :: modulo bloq ++ fe :: modulo bloq
|_ a=bloq |_ a=bloq
@ -1172,7 +1177,7 @@
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2cH, urbit time :: :: section 2cH, urbit time ::
:: ::
++ year ++ year :: date to @d
|= det=date |= det=date
^- @d ^- @d
=+ ^= yer =+ ^= yer
@ -1182,7 +1187,7 @@
=+ day=(yawn yer m.det d.t.det) =+ day=(yawn yer m.det d.t.det)
(yule day h.t.det m.t.det s.t.det f.t.det) (yule day h.t.det m.t.det s.t.det f.t.det)
:: ::
++ yore ++ yore :: @d to date
|= now=@d |= now=@d
^- date ^- date
=+ rip=(yell now) =+ rip=(yell now)
@ -1192,7 +1197,7 @@
[a=| y=+((sub 292.277.024.400 y.ger))] [a=| y=+((sub 292.277.024.400 y.ger))]
[m.ger d.ger h.rip m.rip s.rip f.rip] [m.ger d.ger h.rip m.rip s.rip f.rip]
:: ::
++ yell ++ yell :: tarp from @d
|= now=@d |= now=@d
^- tarp ^- tarp
=+ sec=(rsh 6 1 now) =+ sec=(rsh 6 1 now)
@ -1211,7 +1216,7 @@
=> .(sec (mod sec mit:yo)) => .(sec (mod sec mit:yo))
[day hor mit sec fan] [day hor mit sec fan]
:: ::
++ yule ++ yule :: time atom
|= rip=tarp |= rip=tarp
^- @d ^- @d
=+ ^= sec ;: add =+ ^= sec ;: add
@ -1228,7 +1233,7 @@
(add (lsh 4 muc i.f.rip) $(f.rip t.f.rip)) (add (lsh 4 muc i.f.rip) $(f.rip t.f.rip))
(con (lsh 6 1 sec) fac) (con (lsh 6 1 sec) fac)
:: ::
++ yall ++ yall :: day # to day of year
|= day=@ud |= day=@ud
^- [y=@ud m=@ud d=@ud] ^- [y=@ud m=@ud d=@ud]
=+ [era=0 cet=0 lep=_?] =+ [era=0 cet=0 lep=_?]
@ -1252,7 +1257,7 @@
[yer +(mot) +(day)] [yer +(mot) +(day)]
$(mot +(mot), day (sub day zis)) $(mot +(mot), day (sub day zis))
:: ::
++ yawn ++ yawn :: days since Jesus
|= [yer=@ud mot=@ud day=@ud] |= [yer=@ud mot=@ud day=@ud]
^- @ud ^- @ud
=> .(mot (dec mot), day (dec day)) => .(mot (dec mot), day (dec day))
@ -1277,11 +1282,11 @@
$(yer nec, day (add day ?:((yelp nec) 36.525 36.524))) $(yer nec, day (add day ?:((yelp nec) 36.525 36.524)))
(add day (mul (div yer 400) (add 1 (mul 4 36.524)))) (add day (mul (div yer 400) (add 1 (mul 4 36.524))))
:: ::
++ yelp ++ yelp :: leap year
|= yer=@ud ^- ? |= yer=@ud ^- ?
&(=(0 (mod yer 4)) |(!=(0 (mod yer 100)) =(0 (mod yer 400)))) &(=(0 (mod yer 4)) |(!=(0 (mod yer 100)) =(0 (mod yer 400))))
:: ::
++ yo ++ yo :: time constants
|% ++ cet 36.524 :: (add 24 (mul 100 365)) |% ++ cet 36.524 :: (add 24 (mul 100 365))
++ day 86.400 :: (mul 24 hor) ++ day 86.400 :: (mul 24 hor)
++ era 146.097 :: (add 1 (mul 4 cet)) ++ era 146.097 :: (add 1 (mul 4 cet))