diff options
author | Colin Okay <cbeok@protonmail.com> | 2020-07-08 18:40:05 -0500 |
---|---|---|
committer | Colin Okay <cbeok@protonmail.com> | 2020-07-08 18:40:05 -0500 |
commit | d7cf8b1aa1daf27bd7b64e5c643b7cca4177571f (patch) | |
tree | 857063e4fd8e312270c30e07276e44365dfe0fbb | |
parent | 734c478818312040e2de3a3a9ee9bf1f58f2e1d0 (diff) |
made for form easier on the eyes
-rw-r--r-- | gtwiwtg.lisp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gtwiwtg.lisp b/gtwiwtg.lisp index e3b571f..77f870c 100644 --- a/gtwiwtg.lisp +++ b/gtwiwtg.lisp @@ -548,7 +548,7 @@ returns NIL." ;;; CONSUMERS -(defmacro for ((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: -(for ((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)) - (for (,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)))) - (for ((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)) - (for (x gen) + (for x gen (incf sum x) (incf count)) (/ sum count))) |