aboutsummaryrefslogtreecommitdiffhomepage
path: root/gtwiwtg.lisp
diff options
context:
space:
mode:
authorColin Okay <cbeok@protonmail.com>2020-07-08 18:24:58 -0500
committerColin Okay <cbeok@protonmail.com>2020-07-08 18:24:58 -0500
commit734c478818312040e2de3a3a9ee9bf1f58f2e1d0 (patch)
tree25736d16e37d14e5c4677bdc56338d13f2f425ce /gtwiwtg.lisp
parent505125f0faf8c93a2e9a39148507cd9d21b8f691 (diff)
renamed iter to for
Diffstat (limited to 'gtwiwtg.lisp')
-rw-r--r--gtwiwtg.lisp10
1 files changed, 5 insertions, 5 deletions
diff --git a/gtwiwtg.lisp b/gtwiwtg.lisp
index 8e082c3..e3b571f 100644
--- a/gtwiwtg.lisp
+++ b/gtwiwtg.lisp
@@ -548,7 +548,7 @@ returns NIL."
;;; CONSUMERS
-(defmacro iter ((var-exp gen) &body body)
+(defmacro for ((var-exp gen) &body body)
"The basic generator consumer.
VAR-EXP can be either a symbol, or a form sutible for using as the
@@ -561,7 +561,7 @@ procuded by GEN.
Example:
-(iter ((x y) (zip! (repeater 'a 'b 'c) (times 5)))
+(for ((x y) (zip! (repeater 'a 'b 'c) (times 5)))
(format t \"~a -- ~a~%\" x y))
A -- 0
@@ -627,7 +627,7 @@ Example: building data
"
`(let ((,acc ,init-val))
- (iter (,var-exp ,gen)
+ (for (,var-exp ,gen)
(setf ,acc ,expr))
,acc))
@@ -649,7 +649,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 (1+ (apply #'max indexes)))))
+ (for ((x idx) (zip! gen (times (1+ (apply #'max indexes)))))
(when (member idx indexes)
(loop
:for i :below (length indexes)
@@ -676,7 +676,7 @@ of indexes."
"Consumes GEN, returning its average value."
(let ((sum 0)
(count 0))
- (iter (x gen)
+ (for (x gen)
(incf sum x)
(incf count))
(/ sum count)))