aboutsummaryrefslogtreecommitdiff
path: root/core.neb
blob: 62e10697c367b4b1607ee33497151c3addd6ed12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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))))