diff options
| author | mryouse | 2023-06-07 21:42:54 -0400 |
|---|---|---|
| committer | mryouse | 2023-06-07 21:42:54 -0400 |
| commit | 730a6d777530a33fbb8df86df8b16d842b12c283 (patch) | |
| tree | 1a5b7c8a200c0b2e9568feece006be6f34b0f807 /core.neb | |
| parent | d30e4695f7390c56e2f87dfe76fa4e681eaeb082 (diff) | |
initial commit of the start of the core library
Diffstat (limited to 'core.neb')
| -rw-r--r-- | core.neb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/core.neb b/core.neb new file mode 100644 index 0000000..62e1069 --- /dev/null +++ b/core.neb @@ -0,0 +1,21 @@ +; math +(func ++ (num) (+ num 1)) +(func -- (num) (- num 1)) + +; strings +(func join (lst joiner) + ; TODO this doesn't handle empty lists + (concat + (reduce + (lambda (acc x) + (concat acc x joiner)) + (most lst) + "") + (last lst))) + +; lists +(func slice (lst idx) + ; TODO doesn't handle lengths + (if (eq? 1 idx) + lst + (slice (rest lst) (- idx 1)))) |
