aboutsummaryrefslogtreecommitdiff
path: root/core.neb
diff options
context:
space:
mode:
Diffstat (limited to 'core.neb')
-rw-r--r--core.neb21
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))))