diff options
author | Colin Okay <cbeok@protonmail.com> | 2020-07-08 16:37:35 -0500 |
---|---|---|
committer | Colin Okay <cbeok@protonmail.com> | 2020-07-08 16:37:35 -0500 |
commit | 36ebadc03aba964446e37ae05b72d7f5e7a82389 (patch) | |
tree | a081c62ab0bb7f8485a274d34b12334567ee47fb | |
parent | 4d6ded823b9680c08c27bfd5e50d94dc1209df1a (diff) |
updated users of TIMES after the change to RANGE
-rw-r--r-- | gtwiwtg.lisp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gtwiwtg.lisp b/gtwiwtg.lisp index 5938065..d1b3451 100644 --- a/gtwiwtg.lisp +++ b/gtwiwtg.lisp @@ -551,7 +551,7 @@ B -- 1 A -- 2 B -- 3 A -- 4 -B -- 5 + " (let* ((gen-var (gensym "generator!")) (expr-body (if (consp var-exp) @@ -584,7 +584,7 @@ Example: standard summing > (fold (sum 0) (x (times 10)) (+ sum x)) -55 +45 Example: a usless calculation @@ -620,7 +620,7 @@ Example: building data (defun take (n gen) "Consumes GEN by collecting its first N values into a list" - (nreverse (fold (xs nil) (x (zip! gen (times (1- n)))) + (nreverse (fold (xs nil) (x (zip! gen (times n))) (cons (car x) xs)))) (defun pick-out (indexes gen) @@ -631,7 +631,7 @@ INDEXES is a list of non-negative integers. Returns a list of values from GEN such that each value was an element of indexes." (let ((acc (make-array (length indexes)))) - (iter ((x idx) (zip! gen (times (apply #'max indexes)))) + (iter ((x idx) (zip! gen (times (1+ (apply #'max indexes))))) (when (member idx indexes) (loop :for i :below (length indexes) |