c62d7dfcaed7

Add `in-range-p`
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Fri, 16 Dec 2016 15:35:58 -0500
parents 0f2460b0b42e
children 7d475c7bf05e
branches/tags (none)
files DOCUMENTATION.markdown losh.lisp package.lisp

Changes

--- a/DOCUMENTATION.markdown	Thu Dec 15 18:46:31 2016 -0500
+++ b/DOCUMENTATION.markdown	Fri Dec 16 15:35:58 2016 -0500
@@ -860,6 +860,12 @@
 
   
 
+### `IN-RANGE-P` (function)
+
+    (IN-RANGE-P LOW VALUE HIGH)
+
+Return whether `low` <= `value` < `high`.
+
 ### `LERP` (function)
 
     (LERP FROM TO N)
--- a/losh.lisp	Thu Dec 15 18:46:31 2016 -0500
+++ b/losh.lisp	Fri Dec 16 15:35:58 2016 -0500
@@ -158,6 +158,11 @@
       ((< value min) min)
       (t value))))
 
+(defun-inline in-range-p (low value high)
+  "Return whether `low` <= `value` < `high`."
+  (and (<= low value)
+       (< value high)))
+
 
 (defun gnuplot (data &key
                 (filename "plot.png")
--- a/package.lisp	Thu Dec 15 18:46:31 2016 -0500
+++ b/package.lisp	Fri Dec 16 15:35:58 2016 -0500
@@ -38,15 +38,16 @@
     :6/8tau
     :7/8tau
 
-    :radians
+    :clamp
     :degrees
-    :square
     :dividesp
+    :in-range-p
+    :lerp
+    :map-range
     :norm
-    :lerp
     :precise-lerp
-    :map-range
-    :clamp
+    :radians
+    :square
 
     :gnuplot
     :gnuplot-function))