diff options
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 db526fe..9267f20 100644 --- a/std/String.bruijn +++ b/std/String.bruijn @@ -1,5 +1,7 @@ # MIT License, Copyright (c) 2022 Marvin Borner +:import std/Char C +:import std/Number . :import std/Number/Binary B :input std/List @@ -26,6 +28,11 @@ ni? \in? :test ("ab" ∋ 'b') (true) :test ("ab" ∋ 'c') (false) +# converts a string of digits into a number +number! from-digits ∘ (map C.number!) + +:test ((number! "123") =? (+123)) (true) + # splits string by newline character lines z [[rec]] rec ∅?(~broken) (^broken : empty) (^broken : (1 ~(~broken))) |