aboutsummaryrefslogtreecommitdiff
path: root/p99/p15.neb
blob: 12fa8cbd74ea8581a799d8fd3b126b5c21d5689a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
; P15 Replicate the elements of a list a given number of times.

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

(func repli (lst cnt)
    (reduce
        (lambda (acc item)
            (def out acc)
            (for-count cnt
                (redef out
                    (append out item)))
            out)
            lst
            (list)))

(print (->string a))
(print (->string (repli a 3)))