diff options
Diffstat (limited to 'p99/p15.neb')
| -rw-r--r-- | p99/p15.neb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/p99/p15.neb b/p99/p15.neb new file mode 100644 index 0000000..12fa8cb --- /dev/null +++ b/p99/p15.neb @@ -0,0 +1,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))) |
