Various hoon improvements.

This commit is contained in:
C. Guy Yarvin 2013-12-16 20:48:40 -08:00
parent 43e81ec55e
commit 9f3efa799f
4 changed files with 49 additions and 54 deletions

View File

@ -945,7 +945,7 @@
%^ ~(ha go ton.fox) %^ ~(ha go ton.fox)
our our
`mace`[[0 rig] ~] `mace`[[0 rig] ~]
`will`[[(sign:se:loy @ (shaf %self (sham syp))) syp] ~] `will`[[(sign:se:loy _@ (shaf %self (sham syp))) syp] ~]
== ==
:: ::
++ czar :: czar:am ++ czar :: czar:am
@ -955,7 +955,7 @@
?> =(fig:ex:loy (zeno our)) ?> =(fig:ex:loy (zeno our))
=+ mac=`mace`[[0 sec:ex:loy] ~] =+ mac=`mace`[[0 sec:ex:loy] ~]
=+ syp=`step`[`bray`[0 ~ our now] [%en %czar ~] pub:ex:loy] =+ syp=`step`[`bray`[0 ~ our now] [%en %czar ~] pub:ex:loy]
=+ ded=`deed`[(sign:se:loy @ (shaf %self (sham syp))) syp] =+ ded=`deed`[(sign:se:loy _@ (shaf %self (sham syp))) syp]
=+ buq=`buck`[mac [ded ~]] =+ buq=`buck`[mac [ded ~]]
=: ton.fox (~(ha go ton.fox) our buq) =: ton.fox (~(ha go ton.fox) our buq)
zac.fox (~(put by zac.fox) our *oven) zac.fox (~(put by zac.fox) our *oven)

View File

@ -221,7 +221,7 @@
?^ huy ?^ huy
(blob hen) (blob hen)
=+ ^= ptr ^- case =+ ^= ptr ^- case
?: =(0 u.nab) [%da @da] ?: =(0 u.nab) [%da _@da]
=+(old=(slag wid seb) ?>(?=(^ old) `case`[%da p.i.old])) =+(old=(slag wid seb) ?>(?=(^ old) `case`[%da p.i.old]))
(duce hen `rave`[%| ptr q.p.rav]) (duce hen `rave`[%| ptr q.p.rav])
== ==

View File

@ -63,7 +63,7 @@
== :: == ::
++ gear |* a=_,* :: list generator ++ gear |* a=_,* :: list generator
$_ :: $_ ::
=+ b=* :: =| b=* ::
|? :: |? ::
?@ b :: ?@ b ::
~ :: ~ ::
@ -128,11 +128,13 @@
[%reed p=tile q=tile] :: atom/cell [%reed p=tile q=tile] :: atom/cell
[%weed p=twig] :: example [%weed p=twig] :: example
== :: == ::
++ toga $|(term [p=term q=term]) :: face control
++ twig $& [p=twig q=twig] :: ++ twig $& [p=twig q=twig] ::
$% :: $% ::
[%$ p=axis] :: [%$ p=axis] ::
[%bccm p=tile] :: [%bccm p=tile] ::
[%bccb p=tile] :: [%bccb p=tile] ::
[%bcpt p=wing q=tile] :: not yet
[%bctr p=tile] :: [%bctr p=tile] ::
[%bczp p=base] :: [%bczp p=base] ::
:: :: :: ::
@ -242,6 +244,7 @@
[%wtkt p=twig q=twig r=twig] :: [%wtkt p=twig q=twig r=twig] ::
[%wtgl p=twig q=twig] :: [%wtgl p=twig q=twig] ::
[%wtgr p=twig q=twig] :: [%wtgr p=twig q=twig] ::
[%wtfs p=wing q=tile] :: smart
[%wtls p=twig q=twig r=tine] :: [%wtls p=twig q=twig r=tine] ::
[%wtpm p=tusk] :: [%wtpm p=tusk] ::
[%wtpt p=twig q=twig r=twig] :: [%wtpt p=twig q=twig r=twig] ::
@ -292,6 +295,7 @@
== :: == ::
++ type $| ?(%noun %void) :: ++ type $| ?(%noun %void) ::
$% [%atom p=term] :: $% [%atom p=term] ::
:: [%bull p=(map term type) q=type] ::
[%cell p=type q=type] :: [%cell p=type q=type] ::
[%core p=type q=coil] :: [%core p=type q=coil] ::
[%cube p=* q=type] :: [%cube p=* q=type] ::
@ -397,7 +401,7 @@
~| %decrement-underflow ~| %decrement-underflow
^- @ ^- @
?< =(0 a) ?< =(0 a)
=+ b=@ =+ b=0
|- |-
?: =(a +(b)) ?: =(a +(b))
b b
@ -409,7 +413,7 @@
^- @ ^- @
~| 'div' ~| 'div'
?< =(0 b) ?< =(0 b)
=+ c=@ =+ c=0
|- |-
?: (lth a b) ?: (lth a b)
c c
@ -476,7 +480,7 @@
~/ %mul ~/ %mul
|= [a=@ b=@] |= [a=@ b=@]
^- @ ^- @
=+ c=@ =+ c=0
|- |-
?: =(0 a) ?: =(0 a)
c c
@ -566,7 +570,7 @@
^- $_ =< $ ^- $_ =< $
|% |%
+- $ +- $
?: ? ?: _?
~ ~
[i=(snag 0 a) t=$] [i=(snag 0 a) t=$]
-- --
@ -576,7 +580,7 @@
~/ %lent ~/ %lent
|= a=(list) |= a=(list)
^- @ ^- @
=+ b=@ =+ b=0
|- |-
?@(a b $(a t.a, b +(b))) ?@(a b $(a t.a, b +(b)))
:: ::
@ -600,7 +604,7 @@
:: ::
++ reel :: right fold ++ reel :: right fold
~/ %reel ~/ %reel
|* [a=(list) b=_=+([p=* q=*] |.(q))] |* [a=(list) b=_=|([p=* q=*] |.(q))]
|- ^+ q.b |- ^+ q.b
?@ a ?@ a
q.b q.b
@ -608,7 +612,7 @@
:: ::
++ roll :: left fold ++ roll :: left fold
~/ %roll ~/ %roll
|* [a=(list) b=_=+([p=* q=*] |.(q))] |* [a=(list) b=_=|([p=* q=*] |.(q))]
|- |-
^+ q.b ^+ q.b
?@ a ?@ a
@ -859,7 +863,7 @@
++ dis :: binary and ++ dis :: binary and
~/ %dis ~/ %dis
|= [a=@ b=@] |= [a=@ b=@]
=+ [c=@ d=@] =| [c=@ d=@]
|- ^- @ |- ^- @
?: ?|(=(0 a) =(0 b)) ?: ?|(=(0 a) =(0 b))
d d
@ -1164,7 +1168,7 @@
++ yall ++ yall
|= 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=_?]
=> .(era (div day era:yo), day (mod day era:yo)) => .(era (div day era:yo), day (mod day era:yo))
=> ^+ . => ^+ .
?: (lth day +(cet:yo)) ?: (lth day +(cet:yo))
@ -1259,7 +1263,7 @@
|_ a=(set) |_ a=(set)
+- all +- all
~/ %all ~/ %all
|* b=_|=(* ?) |* b=$+(* ?)
|- ^- ? |- ^- ?
?@ a ?@ a
& &
@ -1267,7 +1271,7 @@
:: ::
+- any +- any
~/ %any ~/ %any
|* b=_|=(* ?) |* b=$+(* ?)
|- ^- ? |- ^- ?
?@ a ?@ a
| |
@ -1375,7 +1379,7 @@
|_ a=(map) |_ a=(map)
+- all +- all
~/ %all ~/ %all
|* b=_|=(* ?) |* b=$+(* ?)
|- ^- ? |- ^- ?
?@ a ?@ a
& &
@ -1383,7 +1387,7 @@
:: ::
+- any +- any
~/ %any ~/ %any
|* b=_|=(* ?) |* b=$+(* ?)
|- ^- ? |- ^- ?
?@ a ?@ a
| |
@ -1960,7 +1964,7 @@
|= waq=(list ,@) |= waq=(list ,@)
%+ roll %+ roll
waq waq
=+([p=@ q=@] |.((add p (mul wuc q)))) =|([p=@ q=@] |.((add p (mul wuc q))))
tyd tyd
:: ::
++ boss ++ boss
@ -1969,7 +1973,7 @@
|= waq=(list ,@) |= waq=(list ,@)
%+ reel %+ reel
waq waq
=+([p=@ q=@] |.((add p (mul wuc q)))) =|([p=@ q=@] |.((add p (mul wuc q))))
tyd tyd
:: ::
++ ifix ++ ifix
@ -4047,7 +4051,7 @@
[%weed *] [%weed *]
(home p.sec) (home p.sec)
== ==
++ clam ^-(twig [%brts [%axil %noun] %sgls 0 (whip(gom 7) 6)]) ++ clam ^-(twig [%brts [%axil %noun] (whip(gom 7) 6)])
++ whip ++ whip
|= axe=axis |= axe=axis
=+ ^= tun =+ ^= tun
@ -4238,10 +4242,10 @@
^- twig ^- twig
?- gen ?- gen
[~ *] [%cnts [gen ~] ~] [~ *] [%cnts [gen ~] ~]
[%bczp *] [%bccb %axil p.gen]
[%bccm *] ~(clam al p.gen) [%bccm *] ~(clam al p.gen)
[%bccb *] ~(bunt al p.gen) [%bccb *] ~(bunt al p.gen)
[%bctr *] [%ktsg ~(bunt al p.gen)] [%bctr *] [%ktsg ~(bunt al p.gen)]
[%bczp *] [%bccb %axil p.gen]
[%brcb *] [%tsls [%bctr p.gen] [%brcn q.gen]] [%brcb *] [%tsls [%bctr p.gen] [%brcn q.gen]]
[%brdt *] [%brcn (~(put by *(map term foot)) %$ [%ash p.gen])] [%brdt *] [%brcn (~(put by *(map term foot)) %$ [%ash p.gen])]
[%brkt *] [%tsgr [%brcn (~(put by q.gen) %$ [%ash p.gen])] [%cnbc %$]] [%brkt *] [%tsgr [%brcn (~(put by q.gen) %$ [%ash p.gen])] [%cnbc %$]]
@ -4383,7 +4387,7 @@
:^ %wtcl :: ?: :^ %wtcl :: ?:
[%bczp %bean] :: ? [%bczp %bean] :: ?
[%bczp %null] :: ~ [%bczp %null] :: ~
:- [%ktts %i [%dtpt 'tD' @]] :: :- i=~~ :- [%ktts %i [%dtpt 'tD' _@]] :: :- i=~~
[%ktts %t [%cnbc %$]] :: t=$ [%ktts %t [%cnbc %$]] :: t=$
|- ^- twig :: |- ^- twig ::
?~ p.gen :: ?~ p.gen ::
@ -4740,7 +4744,6 @@
%rest rest %rest rest
%seek seek %seek seek
%snap snap %snap snap
%swab swab
%tack tack %tack tack
%tock tock %tock tock
%wrap wrap %wrap wrap
@ -6327,18 +6330,11 @@
== ==
:: ::
++ snub ++ snub
~/ %swab ~/ %snub
|= har=(list ,[p=wing q=twig]) |= har=(list ,[p=wing q=twig])
^- (list ,[p=wing q=twig]) ^- (list ,[p=wing q=twig])
(turn har |=([a=wing b=twig] [(flop a) b])) (turn har |=([a=wing b=twig] [(flop a) b]))
:: ::
++ swab
~/ %swab
|= har=(list ,[p=twig q=twig])
^- (list ,[p=wing q=twig])
%+ turn
har
|=([a=twig b=twig] [(flop ~(rake ap a)) b])
:: ::
++ tack ++ tack
~/ %tack ~/ %tack
@ -6531,7 +6527,6 @@
:- '*' :- '*'
;~ pose ;~ pose
(stag %bctr ;~(pfix tar hill)) (stag %bctr ;~(pfix tar hill))
(stag %bczp (cold %noun tar))
== ==
:- '+' :- '+'
;~ pose ;~ pose
@ -6580,11 +6575,7 @@
;~ pose ;~ pose
%+ stag %bccm %+ stag %bccm
(stag %fern ;~(pfix wut (ifix [pel per] (most ace toil)))) (stag %fern ;~(pfix wut (ifix [pel per] (most ace toil))))
::
(stag %bczp (cold %bean wut))
== ==
:- '@'
;~(pfix pat (stag %bczp (stag %atom mota)))
:- '[' :- '['
%+ stag %+ stag
%cltr %cltr
@ -6632,6 +6623,7 @@
|=([a=@ta b=twig] [%ktls [%dtpt a 0] [%ktls [%dtpt %$ 0] b]]) |=([a=@ta b=twig] [%ktls [%dtpt a 0] [%ktls [%dtpt %$ 0] b]])
;~(pfix pat ;~(plug mota ;~(pfix tec wide))) ;~(pfix pat ;~(plug mota ;~(pfix tec wide)))
(stag %kthp ;~(plug toil ;~(pfix tec wide))) (stag %kthp ;~(plug toil ;~(pfix tec wide)))
(stag %ktls ;~(pfix lus ;~(plug wide ;~(pfix tec wide))))
== ==
== ==
:- '"' :- '"'
@ -7030,6 +7022,7 @@
$% [%tis p=twig] $% [%tis p=twig]
[%col p=twig] [%col p=twig]
[%ket p=twig] [%ket p=twig]
[%pat p=tile]
[%pel p=tray] [%pel p=tray]
== ==
== ==
@ -7045,6 +7038,7 @@
== ==
%col [~ %tsgl ros p.vil] %col [~ %tsgl ros p.vil]
%pel [~ %cnts ~(rake ap ros) p.vil] %pel [~ %cnts ~(rake ap ros) p.vil]
%pat [~ %bcpt ~(rake ap ros) p.vil]
%ket [~ ros p.vil] %ket [~ ros p.vil]
== ==
:: ::
@ -7056,6 +7050,7 @@
;~(plug (cold %tis tis) wide) ;~(plug (cold %tis tis) wide)
;~(plug (cold %col col) wide) ;~(plug (cold %col col) wide)
;~(plug (cold %ket ket) wide) ;~(plug (cold %ket ket) wide)
;~(plug (cold %pat pat) hill)
;~ plug ;~ plug
(easy %pel) (easy %pel)
(ifix [pel per] lobo) (ifix [pel per] lobo)
@ -7300,7 +7295,7 @@
ves ves
?: &(=(-.q.ves -.q.sev) =(+>.q.ves +>.q.sev)) ?: &(=(-.q.ves -.q.sev) =(+>.q.ves +>.q.sev))
ves ves
sev(+<.q [@da @ =>(~ |+(* ~))]) :: cure memory leak sev(+<.q [_@da _@ =>(~ |+(* ~))]) :: cure memory leak
== ==
:: ::
++ doze ++ doze
@ -7325,11 +7320,11 @@
|= but=type |= but=type
^- vile ^- vile
=+ pal=|=(a=@t ^-(type (~(play ut but) (vice a)))) =+ pal=|=(a=@t ^-(type (~(play ut but) (vice a))))
:* bet=(pal '[*(unit writ) *wire *duct *curd]') :* bet=(pal '_[(unit writ) wire duct curd]')
nim=(pal '[*ship @tas *ship @tas *coin *path]') nim=(pal '_[ship @tas ship @tas coin path]')
vin=(pal '[@da @ |+(* *(unit))]') vin=(pal '_[@da @ $+(* (unit))]')
hoz=(pal '[@da *duct]') hoz=(pal '_[@da duct]')
viz=(pal '*vase') viz=(pal '_vase')
== ==
:: ::
++ vint :: create vane ++ vint :: create vane

View File

@ -65,7 +65,7 @@
++ ramp :: make r-m prime ++ ramp :: make r-m prime
|= [a=@ b=(list ,@) c=@] ^- @ux :: [bits snags seed] |= [a=@ b=(list ,@) c=@] ^- @ux :: [bits snags seed]
=> .(c (shas %ramp c)) => .(c (shas %ramp c))
=+ d=@ =+ d=_@
|- |-
?: =((mul 100 a) d) ?: =((mul 100 a) d)
~|(%ar-ramp !!) ~|(%ar-ramp !!)
@ -146,7 +146,7 @@
:: ::
++ crya :: cryptosuite A (RSA) ++ crya :: cryptosuite A (RSA)
^- acro ^- acro
=+ [mos=@ pon=*(unit ,[p=@ q=@ r=[p=@ q=@] s=_*fu])] =| [mos=@ pon=(unit ,[p=@ q=@ r=[p=@ q=@] s=_*fu])]
=> |% => |%
++ dap :: OEAP decode ++ dap :: OEAP decode
|= [wid=@ xar=@ dog=@] ^- [p=@ q=@] |= [wid=@ xar=@ dog=@] ^- [p=@ q=@]
@ -669,7 +669,7 @@
[p.sab q.sab [p.viq +(let)] [q.viq q.r.sab]] [p.sab q.sab [p.viq +(let)] [q.viq q.r.sab]]
:: ~& [%auld p.mus q.mus [%too r.mus] [%fro s.mus]] :: ~& [%auld p.mus q.mus [%too r.mus] [%fro s.mus]]
=+ kat=(alar s.sab) =+ kat=(alar s.sab)
=+ lem=`nori`[%& [~ mus] `soba`[[@ @] kat]] =+ lem=`nori`[%& [~ mus] `soba`[_[@ @] kat]]
?: =(let p.viq) ?: =(let p.viq)
:: ~& [%nice let] :: ~& [%nice let]
[~ ~ lem] :: perfect fit [~ ~ lem] :: perfect fit
@ -752,7 +752,7 @@
%+ mix ?~(q.ank 0 p.u.q.ank) %+ mix ?~(q.ank 0 p.u.q.ank)
=+ axe=1 =+ axe=1
|- ^- cash |- ^- cash
?~ r.ank @ ?~ r.ank _@
;: mix ;: mix
(shaf %dash (mix axe (shaf %dush (mix p.n.r.ank p.q.n.r.ank)))) (shaf %dash (mix axe (shaf %dush (mix p.n.r.ank p.q.n.r.ank))))
$(r.ank l.r.ank, axe (peg axe 2)) $(r.ank l.r.ank, axe (peg axe 2))
@ -1329,27 +1329,27 @@
++ acro :: asym cryptosuite ++ acro :: asym cryptosuite
$_ ^? |% :: opaque object $_ ^? |% :: opaque object
++ de |+([a=@ b=@] *(unit ,@)) :: symmetric de, soft ++ de |+([a=@ b=@] *(unit ,@)) :: symmetric de, soft
++ dy |+([a=@ b=@] @) :: symmetric de, hard ++ dy |+([a=@ b=@] _@) :: symmetric de, hard
++ en |+([a=@ b=@] @) :: symmetric en ++ en |+([a=@ b=@] _@) :: symmetric en
++ es |+(a=@ @) :: step key to next ++ es |+(a=@ _@) :: step key to next
++ ex ^? :: export ++ ex ^? :: export
|% ++ fig @uvH :: fingerprint |% ++ fig _@uvH :: fingerprint
++ pac @uvG :: default passcode ++ pac _@uvG :: default passcode
++ pub *pass :: public key ++ pub *pass :: public key
++ sec *ring :: private key ++ sec *ring :: private key
-- :: -- ::
++ mx @ :: max direct bytes ++ mx _@ :: max direct bytes
++ nu ^? :: reconstructors ++ nu ^? :: reconstructors
|% ++ pit |=([a=@ b=@] ^?(..nu)) :: from [width seed] |% ++ pit |=([a=@ b=@] ^?(..nu)) :: from [width seed]
++ nol |=(a=@ ^?(..nu)) :: from naked ring ++ nol |=(a=@ ^?(..nu)) :: from naked ring
++ com |=(a=@ ^?(..nu)) :: from naked pass ++ com |=(a=@ ^?(..nu)) :: from naked pass
-- :: -- ::
++ pu ^? :: public-key acts ++ pu ^? :: public-key acts
|% ++ seal |=([a=@ b=@] @) :: encrypt |% ++ seal |=([a=@ b=@] _@) :: encrypt
++ sure |=([a=@ b=@] *(unit ,@)) :: authenticate ++ sure |=([a=@ b=@] *(unit ,@)) :: authenticate
-- :: -- ::
++ se ^? :: secret-key acts ++ se ^? :: secret-key acts
|% ++ sign |=([a=@ b=@] @) :: certify |% ++ sign |=([a=@ b=@] _@) :: certify
++ tear |=(a=@ *(unit ,[p=@ q=@])) :: accept ++ tear |=(a=@ *(unit ,[p=@ q=@])) :: accept
-- :: -- ::
-- :: -- ::