Merge remote-tracking branch 'urbit/master' into newbreach

Conflicts:
	.gitignore
	Makefile
	urb/urbit.pill

Took both bpt and ed25519, and generated a new pill starting from master's.
This commit is contained in:
Steve Dee 2014-05-08 14:53:12 -07:00
commit 21d00550ed
3 changed files with 101 additions and 2 deletions

View File

@ -797,6 +797,12 @@
1
(mul 2 $(a (dec a)))
::
++ xeb :: binary logarithm
:: ~/ %xeb
|= a=@
^- @
(met 0 a)
::
++ can :: assemble
~/ %can
|= [a=bloq b=(list ,[p=@ q=@])]
@ -820,6 +826,15 @@
|= [a=bloq b=@ c=@]
(mod c (bex (mul (bex a) b)))
::
++ fil :: fill bloqstream
|= [a=bloq b=@ c=@]
=+ n=0
=+ d=c
|- ^- @
?: =(n b)
(rsh a 1 d)
$(d (add c (lsh a 1 d)), n +(n))
::
++ lsh :: left-shift
~/ %lsh
|= [a=bloq b=@ c=@]
@ -865,6 +880,9 @@
~/ %rsh
|= [a=bloq b=@ c=@]
(div c (bex (mul (bex a) b)))
::
++ swap |=([a=bloq b=@] (rep a (flop (rip a b)))) :: reverse bloq order
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2cB, bit logic ::
::
@ -1723,7 +1741,12 @@
~/ %rub
|= [a=@ b=@]
^- [p=@ q=@]
=+ c==+(c=0 |-(?.(=(0 (cut 0 [(add a c) 1] b)) c $(c +(c)))))
=+ ^= c
=+ [c=0 m=(met 0 b)]
|- ?< (gth c m)
?. =(0 (cut 0 [(add a c) 1] b))
c
$(c +(c))
?: =(0 c)
[1 0]
=+ d=(add a +(c))

View File

@ -1293,6 +1293,7 @@
^- tape
?~ tep ~
=+ nex=$(tep t.tep)
=+ xen=|=(tig=@ ?:((gte tig 10) (add tig 55) (add tig '0')))
?: ?| &((gte i.tep 'a') (lte i.tep 'z'))
&((gte i.tep 'A') (lte i.tep 'Z'))
&((gte i.tep '0') (lte i.tep '9'))
@ -1302,7 +1303,7 @@
=('_' i.tep)
==
[i.tep nex]
['%' ~(x ne (rsh 0 4 i.tep)) ~(x ne (end 0 4 i.tep)) nex]
['%' (xen (rsh 0 4 i.tep)) (xen (end 0 4 i.tep)) nex]
::
++ urld :: URL decode
|= tep=tape

75
try/lib/markdown.hoon Normal file
View File

@ -0,0 +1,75 @@
::
:: Markdown in Hoon.
::
=<
|%
++ markdown :: block elements
$& [p=markdown q=markdown]
$% [%$ p=markline] :: plain text
[%cobl p=(list ,@t)] :: code block
[%head p=head-level q=markline] :: heading
[%html p=manx] :: inline html
[%list p=(unit list-order) q=(list markdown)] :: un/ordered list
[%quot p=markdown] :: block quote
==
++ markline :: inline elements
$& [p=markline q=markline]
$% [%$ p=@t] :: plain text
[%bold p=markline-bold] :: strong emphasis
[%coli p=@t] :: inline code
[%emph p=markline-emph] :: emphasis
[%link p=purl q=markline-link r=(unit ,@t)] :: anchor
==
--
|%
++ head-level
|= a=*
?@ a
?:(|((lth a 1) (gth a 6)) 1 a)
1
++ list-order ,[p=?(%a %aa %1) q=@] :: list type/start
++ markline-bold
$& [p=markline-bold q=markline-bold]
$% [%$ p=@t]
[%coli p=@t]
[%emph p=markline-bold-emph]
[%link p=purl q=markline-bold-link r=(unit ,@t)]
==
++ markline-emph
$& [p=markline-emph q=markline-emph]
$% [%$ p=@t]
[%bold p=markline-bold-emph]
[%coli p=@t]
[%link p=purl q=markline-emph-link r=(unit ,@t)]
==
++ markline-link
$& [p=markline-link q=markline-link]
$% [%$ p=@t]
[%bold p=markline-bold-link]
[%coli p=@t]
[%emph p=markline-emph-link]
==
++ markline-bold-emph
$& [p=markline-bold-emph q=markline-bold-emph]
$% [%$ p=@t]
[%coli p=@t]
[%link p=purl q=markline-bold-emph-link r=(unit ,@t)]
==
++ markline-bold-link
$& [p=markline-bold-link q=markline-bold-link]
$% [%$ p=@t]
[%coli p=@t]
[%emph p=markline-bold-emph-link]
==
++ markline-emph-link
$& [p=markline-emph-link q=markline-emph-link]
$% [%$ p=@t]
[%bold p=markline-bold-emph-link]
[%coli p=@t]
==
++ markline-bold-emph-link
$& [p=markline-bold-emph-link q=markline-bold-emph-link]
$% [%$ p=@t]
[%coli p=@t]
==
--