diff options
author | Marvin Borner | 2024-10-27 18:45:21 +0100 |
---|---|---|
committer | Marvin Borner | 2024-10-27 18:45:21 +0100 |
commit | fe1fe57f358472561041cde12a48d28b8bd247a9 (patch) | |
tree | 53162ad90b27ff93ba8abe17c08c1a92d7b6faf1 /std/String.bruijn | |
parent | c6e39268be197a4eaccc0187271764a646017715 (diff) |
Improvements in maps, sets, and parsing
Diffstat (limited to 'std/String.bruijn')
-rw-r--r-- | std/String.bruijn | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/std/String.bruijn b/std/String.bruijn index 4ee002b..567635b 100644 --- a/std/String.bruijn +++ b/std/String.bruijn @@ -3,6 +3,7 @@ :import std/Char C :import std/Math . :import std/Number/Binary B +:import std/Number/Conversion O :input std/List @@ -129,3 +130,9 @@ lines z [[rec]] ⧗ String → (List String) unlines concat-map (\(…;…) '\n') ⧗ (List String) → String :test (unlines ("ab" : {}"cd")) ("ab\ncd\n") + +# slightly stretched DJB2 +# WARNING: this may give weird results with/without padded zeros due to bad xor +hash O.²³‣ ∘ (foldl [[B.xor! (B.mul (+33b) 1) (B.mul 0 (+208121b))]] (+5381b)) ⧗ String → Number + +#‣ &hash |