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.lux44
1 files changed, 22 insertions, 22 deletions
diff --git a/stdlib/source/lux/math/logic/fuzzy.lux b/stdlib/source/lux/math/logic/fuzzy.lux
index ba8da7d40..ca1ad0512 100644
--- a/stdlib/source/lux/math/logic/fuzzy.lux
+++ b/stdlib/source/lux/math/logic/fuzzy.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux (data [number "Deg/" Interval<Deg>]
(coll [list]
@@ -17,46 +17,46 @@
(def: #export (union left right)
(All [a] (-> (Fuzzy a) (Fuzzy a) (Fuzzy a)))
(function [elem]
- (&;~or (membership elem left)
+ (&.~or (membership elem left)
(membership elem right))))
(def: #export (intersection left right)
(All [a] (-> (Fuzzy a) (Fuzzy a) (Fuzzy a)))
(function [elem]
- (&;~and (membership elem left)
+ (&.~and (membership elem left)
(membership elem right))))
(def: #export (complement set)
(All [a] (-> (Fuzzy a) (Fuzzy a)))
(function [elem]
- (&;~not (membership elem set))))
+ (&.~not (membership elem set))))
(def: #export (difference sub base)
(All [a] (-> (Fuzzy a) (Fuzzy a) (Fuzzy a)))
(function [elem]
- (&;~and (membership elem base)
- (&;~not (membership elem sub)))))
+ (&.~and (membership elem base)
+ (&.~not (membership elem sub)))))
(def: #export (from-predicate predicate)
(All [a] (-> (-> a Bool) (Fuzzy a)))
(function [elem]
(if (predicate elem)
- &;~true
- &;~false)))
+ &.~true
+ &.~false)))
(def: #export (from-set set)
- (All [a] (-> (set;Set a) (Fuzzy a)))
- (from-predicate (set;member? set)))
+ (All [a] (-> (set.Set a) (Fuzzy a)))
+ (from-predicate (set.member? set)))
(do-template [<ascending> <descending> <gradient> <type> <lt> <gt> <lte> <gte> <sub> <div> <post>]
[(def: (<ascending> from to)
(-> <type> <type> (Fuzzy <type>))
(function [elem]
(cond (<lte> from elem)
- &;~false
+ &.~false
(<gte> to elem)
- &;~true
+ &.~true
## in the middle...
(<post> (<div> (<sub> from to)
@@ -66,10 +66,10 @@
(-> <type> <type> (Fuzzy <type>))
(function [elem]
(cond (<lte> from elem)
- &;~true
+ &.~true
(<gte> to elem)
- &;~false
+ &.~false
## in the middle...
(<post> (<div> (<sub> from to)
@@ -88,7 +88,7 @@
(do-template [<triangle> <trapezoid> <type> <ascending> <descending> <lt>]
[(def: #export (<triangle> bottom middle top)
(-> <type> <type> <type> (Fuzzy <type>))
- (case (list;sort <lt> (list bottom middle top))
+ (case (list.sort <lt> (list bottom middle top))
(^ (list bottom middle top))
(intersection (<ascending> bottom middle)
(<descending> middle top))
@@ -98,7 +98,7 @@
(def: #export (<trapezoid> bottom middle-bottom middle-top top)
(-> <type> <type> <type> <type> (Fuzzy <type>))
- (case (list;sort <lt> (list bottom middle-bottom middle-top top))
+ (case (list.sort <lt> (list bottom middle-bottom middle-top top))
(^ (list bottom middle-bottom middle-top top))
(intersection (<ascending> bottom middle-bottom)
(<descending> middle-top top))
@@ -113,15 +113,15 @@
(def: #export (gaussian deviation center)
(-> Frac Frac (Fuzzy Frac))
(function [elem]
- (let [scale (|> deviation (math;pow 2.0) (f/* 2.0))
+ (let [scale (|> deviation (math.pow 2.0) (f/* 2.0))
membership (|> elem
(f/- center)
- (math;pow 2.0)
+ (math.pow 2.0)
(f/* -1.0)
(f// scale)
- math;exp)]
+ math.exp)]
(if (f/= 1.0 membership)
- &;~true
+ &.~true
(frac-to-deg membership)))))
(def: #export (cut treshold set)
@@ -129,8 +129,8 @@
(function [elem]
(let [membership (set elem)]
(if (d/> treshold membership)
- (|> membership (d/- treshold) (d/* &;~true))
- &;~false))))
+ (|> membership (d/- treshold) (d/* &.~true))
+ &.~false))))
(def: #export (to-predicate treshold set)
(All [a] (-> Deg (Fuzzy a) (-> a Bool)))