aboutsummaryrefslogtreecommitdiff
path: root/p99/p14.neb
blob: 5af9fc09b412eb2f1021d7fd44d1f2c17fbde9d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
; P14: Duplicate the elements of a list.

(def a (list "a" "b" "c" "c" "d"))

(func dup (lst)
    (reduce
        (lambda (acc item)
            (append
                (append acc item)
                item))
        lst
        (list)))

(print (->string a))
(print (->string (dup a)))