--- a/losh.lisp Sat Aug 13 18:29:24 2016 +0000
+++ b/losh.lisp Sat Aug 13 18:57:43 2016 +0000
@@ -269,9 +269,6 @@
,@(substitute access-expr '% arguments))))
,store-expr)))
-(defmacro mulf (place n)
- "Multiply `place` by `n` in-place."
- `(zap% ,place #'* % ,n))
(defmacro zapf (&rest args)
"Zap each place with each function."
@@ -279,6 +276,14 @@
,@(iterate (for (place function) :on args :by #'cddr)
(collect `(zap% ,place ,function %)))))
+(defmacro mulf (place n)
+ "Multiply `place` by `n` in-place."
+ `(zap% ,place #'* % ,n))
+
+(defmacro clampf (place from to)
+ "Clamp `place` between `from` and `to` in-place."
+ `(zap% ,place #'clamp ,from ,to %))
+
;;;; Lists
(defun take (n list)
--- a/package.lisp Sat Aug 13 18:29:24 2016 +0000
+++ b/package.lisp Sat Aug 13 18:57:43 2016 +0000
@@ -31,8 +31,9 @@
#:zap%
#:%
+ #:zapf
#:mulf
- #:zapf
+ #:clampf
#:take