Various fixes and improvements.

This commit is contained in:
C. Guy Yarvin 2014-09-24 16:21:18 -07:00
parent 55e1f24999
commit 68ea2917ae

View File

@ -1154,7 +1154,7 @@
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2cF, signed and modular ints ::
::
++ si :: signed integer
++ si !: :: signed integer
|%
++ abs |=(a=@s (add (end 0 1 a) (rsh 0 1 a))) :: absolute value
++ dif |= [a=@s b=@s] :: subtraction
@ -2502,9 +2502,7 @@
[zac [~ i.q.tub [zac t.q.tub]]]
::
++ sear :: conditional cook
~/ %sear
|* [pyq=_|=(* *(unit)) sef=_rule]
~/ %fun
|= tub=nail
=+ vex=(sef tub)
?~ q.vex
@ -2601,9 +2599,7 @@
[(last p.vex p.wag) [~ (raq p.u.q.vex p.u.q.wag) q.u.q.wag]]
::
++ stun :: parse several times
~/ %stun
|* [[les=@ mos=@] fel=_rule]
~/ %fun
|= tub=nail
^- (like (list ,_(wonk (fel))))
?: =(0 mos)
@ -2946,8 +2942,7 @@
?: =(inx len) &
=+ cur=(cut 3 [inx 1] b)
?& ?| &((gte cur 'a') (lte cur 'z'))
&((gte cur 'A') (lte cur 'Z'))
&(&((gte cur '0') (lte cur '9')) !=(0 inx))
&((gte cur '0') (lte cur '9'))
|(=('-' cur) =('~' cur) =('_' cur) =('.' cur))
==
$(inx +(inx))
@ -4727,7 +4722,7 @@
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2eW, lite number theory ::
::
++ egcd :: schneier's egcd
++ egcd !: :: schneier's egcd
|= [a=@ b=@]
=+ si
=+ [c=(sun a) d=(sun b)]
@ -8468,28 +8463,36 @@
;~(plug (star low) (star hig))
::
++ plex
|= gen=twig ~| [%plex gen] ^- path
|= gen=twig ^- (unit path)
?: ?=([%zpcb *] gen)
$(gen q.gen)
?> ?=([%clsg *] gen)
(turn p.gen |=(a=twig ?>(?=(%dtzy -.a) q.a)))
?. ?=([%clsg *] gen) ~
%+ reel p.gen
|= [a=twig b=_`(unit path)`[~ u=/]]
?~ b ~
?. ?=(%dtzy -.a) ~
`[q.a u.b]
::
++ pray
|= gen=twig ~| %pray ^- twig
|= gen=twig ~| %pray ^- (unit twig)
=+ rev=(plex gen)
?: (~(has in was) rev)
?~ rev ~
:- ~
?: (~(has in was) u.rev)
~|(%pray-loop !!)
=+ ruv=`path`(weld rev `path`[%hoon ~])
=+ ruv=`path`(weld u.rev `path`[%hoon ~])
=+ txt=(,@ta .^(%cx ruv))
~| ruv
%+ rash txt
(ifix [gay gay] tall(was (~(put in was) rev), wer rev))
(ifix [gay gay] tall(was (~(put in was) u.rev), wer u.rev))
::
++ prey
|= gun=(list twig) ^- twig
?~ gun [~ 1]
?~ t.gun (pray i.gun)
[%tsgr (pray i.gun) $(gun t.gun)]
|= gun=(list twig) ^- (unit twig)
?~ gun `[~ 1]
=+ gup=(pray i.gun)
?~ gup ~
?~ t.gun gup
(bind $(gun t.gun) |=(a=twig [%tsgr u.gup a]))
::
++ phax
|= ruw=(list (list beer))
@ -8911,7 +8914,7 @@
[%dtkt %dtzz %$ %cx rev]
;~(plug hill rood)
==
(cook prey (most ket rood))
(sear prey (most ket rood))
==
==
(stag %cnzz rope)
@ -9203,7 +9206,7 @@
:~ [':' ;~(pfix col (toad expz))]
[',' (rune com %zpcm expb)]
[';' (rune sem %zpsm expb)]
['^' ;~(pfix ket (cook prey (toad exps)))]
['^' ;~(pfix ket (sear prey (toad exps)))]
['>' (rune gar %zpgr expa)]
['=' (rune tis %zpts expa)]
['?' (rune wut %zpwt hinh)]