Created
July 3, 2020 20:43
-
-
Save frodwith/af85cc410ac52beee0ec0b87917e102e to your computer and use it in GitHub Desktop.
mung, a replacement for mug?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- %say | |
|= [* ~ *] | |
:- %noun | |
=< ^- (list @uv) | |
%- turn | |
:_ mung | |
^- (list *) | |
:~ 0 | |
42 | |
[0 0] | |
[1 1] | |
[[1 2] 1 2] | |
[[2 1] 1 2] | |
-:post | |
== | |
|% | |
++ post | |
:: arbitrary atom to 31-bit non-zero value | |
|= a=@ | |
^- @ | |
.+ (end 0 30 a) | |
++ mux | |
:: noun merkle hash from arbitrary atom hash | |
|= [noun=* bits=@ hash=$-(@ @)] | |
^- @ | |
%- hash | |
?@ noun noun | |
%+ con $(noun -.noun) | |
%^ lsh 0 bits | |
$(noun +.noun) | |
++ mung | |
:: 31-bit non-zero murmur3-32 based merkle hash | |
|= noun=* | |
^- @ | |
%^ mux noun 31 | |
|= a=@ | |
%- post | |
(muk 0xcafe.babe (met 3 a) a) | |
-- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment