This commit is contained in:
Felix Brendel
2018-11-13 18:39:54 +01:00
parent f9d08ba765
commit 319d6d2041
3 changed files with 48 additions and 3 deletions
+11
View File
@@ -124,6 +124,17 @@ by the key 'from' and ends with the number defined in 'to'."
(when (< from to)
(pair from (range :from (+ 1 from) :to to))))
(defun range-while (:keys from :defaults-to 0 to)
"Returns a sequence of numbers starting with the number defined
by the key 'from' and ends with the number defined in 'to'."
(define result (list from))
(mutate from (incr from))
(while (< from to)
(prog
(append result (copy from))
(mutate from (incr from))))
result)
(defun map (fun seq)
"Takes a function and a sequence as arguments and returns a new
sequence which contains the results of using the first sequences