aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/math/logic/fuzzy.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/math/logic/fuzzy.lux60
1 files changed, 30 insertions, 30 deletions
diff --git a/stdlib/source/lux/math/logic/fuzzy.lux b/stdlib/source/lux/math/logic/fuzzy.lux
index 7c5ee4150..57f5978f3 100644
--- a/stdlib/source/lux/math/logic/fuzzy.lux
+++ b/stdlib/source/lux/math/logic/fuzzy.lux
@@ -1,6 +1,6 @@
(.module:
lux
- (lux (data [number "Deg/" Interval<Deg>]
+ (lux (data [number "Rev/" Interval<Rev>]
(coll [list]
(set ["set" unordered #+ Set]))
text/format)
@@ -8,10 +8,10 @@
(// ["&" continuous]))
(type: #export (Fuzzy a)
- (-> a Deg))
+ (-> a Rev))
(def: #export (membership elem set)
- (All [a] (-> a (Fuzzy a) Deg))
+ (All [a] (-> a (Fuzzy a) Rev))
(set elem))
(def: #export (union left right)
@@ -49,40 +49,40 @@
(from-predicate (set.member? set)))
(def: (ascending from to)
- (-> Deg Deg (Fuzzy Deg))
+ (-> Rev Rev (Fuzzy Rev))
(function (_ elem)
- (cond (d/<= from elem)
+ (cond (r/<= from elem)
&.~false
- (d/>= to elem)
+ (r/>= to elem)
&.~true
## in the middle...
- (d// (d/- from to)
- (d/- from elem)))))
+ (r// (r/- from to)
+ (r/- from elem)))))
(def: (descending from to)
- (-> Deg Deg (Fuzzy Deg))
+ (-> Rev Rev (Fuzzy Rev))
(function (_ elem)
- (cond (d/<= from elem)
+ (cond (r/<= from elem)
&.~true
- (d/>= to elem)
+ (r/>= to elem)
&.~false
## in the middle...
- (d// (d/- from to)
- (d/- elem to)))))
+ (r// (r/- from to)
+ (r/- elem to)))))
(def: #export (gradient from to)
- (-> Deg Deg (Fuzzy Deg))
- (if (d/< to from)
+ (-> Rev Rev (Fuzzy Rev))
+ (if (r/< to from)
(ascending from to)
(descending from to)))
(def: #export (triangle bottom middle top)
- (-> Deg Deg Deg (Fuzzy Deg))
- (case (list.sort d/< (list bottom middle top))
+ (-> Rev Rev Rev (Fuzzy Rev))
+ (case (list.sort r/< (list bottom middle top))
(^ (list bottom middle top))
(intersection (ascending bottom middle)
(descending middle top))
@@ -91,8 +91,8 @@
(undefined)))
(def: #export (trapezoid bottom middle-bottom middle-top top)
- (-> Deg Deg Deg Deg (Fuzzy Deg))
- (case (list.sort d/< (list bottom middle-bottom middle-top top))
+ (-> Rev Rev Rev Rev (Fuzzy Rev))
+ (case (list.sort r/< (list bottom middle-bottom middle-top top))
(^ (list bottom middle-bottom middle-top top))
(intersection (ascending bottom middle-bottom)
(descending middle-top top))
@@ -101,26 +101,26 @@
(undefined)))
(def: #export (cut treshold set)
- (All [a] (-> Deg (Fuzzy a) (Fuzzy a)))
+ (All [a] (-> Rev (Fuzzy a) (Fuzzy a)))
(function (_ elem)
(let [membership (set elem)]
- (if (d/> treshold membership)
- (|> membership (d/- treshold) (d/* &.~true))
+ (if (r/> treshold membership)
+ (|> membership (r/- treshold) (r/* &.~true))
&.~false))))
(def: #export (to-predicate treshold set)
- (All [a] (-> Deg (Fuzzy a) (-> a Bool)))
+ (All [a] (-> Rev (Fuzzy a) (-> a Bool)))
(function (_ elem)
- (d/> treshold (set elem))))
+ (r/> treshold (set elem))))
(type: #export (Fuzzy2 a)
- (-> a [Deg Deg]))
+ (-> a [Rev Rev]))
(def: #export (type-2 lower upper)
(All [a] (-> (Fuzzy a) (Fuzzy a) (Fuzzy2 a)))
(function (_ elem)
- (let [l-deg (lower elem)
- u-deg (upper elem)]
- [(d/min l-deg
- u-deg)
- u-deg])))
+ (let [l-rev (lower elem)
+ u-rev (upper elem)]
+ [(r/min l-rev
+ u-rev)
+ u-rev])))