From c2bfe8f125c7fc4f20269eb2c616848c541a369f Mon Sep 17 00:00:00 2001 From: mryouse Date: Thu, 8 Jun 2023 22:18:53 -0400 Subject: more core functions --- core.neb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core.neb b/core.neb index e2678fb..4bbb63e 100644 --- a/core.neb +++ b/core.neb @@ -5,6 +5,15 @@ (func ++ (num) (+ num 1)) (func -- (num) (- num 1)) +(func min (lst) + (reduce + (lambda (acc x) + (if (< x acc) + x + acc)) + (rest lst) + (first lst))) + ; strings (func join (lst joiner) ; TODO this doesn't handle empty lists @@ -26,6 +35,9 @@ (#true str))) ; lists +(func extend (lst1 lst2) + (reduce append lst2 lst1)) + (func slice (lst idx) ; TODO doesn't handle lengths (if (eq? 1 idx) -- cgit v1.2.3