aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/abstract/interval.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/abstract/interval.lux')
-rw-r--r--stdlib/source/library/lux/abstract/interval.lux54
1 files changed, 27 insertions, 27 deletions
diff --git a/stdlib/source/library/lux/abstract/interval.lux b/stdlib/source/library/lux/abstract/interval.lux
index 452121f5e..c38e3a75b 100644
--- a/stdlib/source/library/lux/abstract/interval.lux
+++ b/stdlib/source/library/lux/abstract/interval.lux
@@ -77,29 +77,29 @@
(All (_ a) (-> (Interval a) (Interval a) (Interval a)))
(def: enum (the enum right))
- (def: bottom (order.min (# right order) (# left bottom) (# right bottom)))
- (def: top (order.max (# right order) (# left top) (# right top))))
+ (def: bottom (order.min (at right order) (at left bottom) (at right bottom)))
+ (def: top (order.max (at right order) (at left top) (at right top))))
(implementation: .public (intersection left right)
(All (_ a) (-> (Interval a) (Interval a) (Interval a)))
(def: enum (the enum right))
- (def: bottom (order.max (# right order) (# left bottom) (# right bottom)))
- (def: top (order.min (# right order) (# left top) (# right top))))
+ (def: bottom (order.max (at right order) (at left bottom) (at right bottom)))
+ (def: top (order.min (at right order) (at left top) (at right top))))
(implementation: .public (complement interval)
(All (_ a) (-> (Interval a) (Interval a)))
(def: enum (the enum interval))
- (def: bottom (# interval succ (# interval top)))
- (def: top (# interval pred (# interval bottom))))
+ (def: bottom (at interval succ (at interval top)))
+ (def: top (at interval pred (at interval bottom))))
(def: .public (precedes? reference sample)
(All (_ a) (-> (Interval a) (Interval a) Bit))
(let [(open "[0]") reference
- limit (# reference bottom)]
- (and (< limit (# sample bottom))
- (< limit (# sample top)))))
+ limit (at reference bottom)]
+ (and (< limit (at sample bottom))
+ (< limit (at sample top)))))
(def: .public (succeeds? reference sample)
(All (_ a) (-> (Interval a) (Interval a) Bit))
@@ -119,9 +119,9 @@
(def: .public (meets? reference sample)
(All (_ a) (-> (Interval a) (Interval a) Bit))
(let [(open ",#[0]") reference
- limit (# reference bottom)]
- (and (,#= limit (# sample top))
- (order.<= ,#order limit (# sample bottom)))))
+ limit (at reference bottom)]
+ (and (,#= limit (at sample top))
+ (order.<= ,#order limit (at sample bottom)))))
(def: .public (touches? reference sample)
(All (_ a) (-> (Interval a) (Interval a) Bit))
@@ -132,11 +132,11 @@
[(def: .public (<name> reference sample)
(All (_ a) (-> (Interval a) (Interval a) Bit))
(let [(open ",#[0]") reference]
- (and (,#= (# reference <eq_side>)
- (# sample <eq_side>))
+ (and (,#= (at reference <eq_side>)
+ (at sample <eq_side>))
(<ineq> ,#order
- (# reference <ineq_side>)
- (# sample <ineq_side>)))))]
+ (at reference <ineq_side>)
+ (at sample <ineq_side>)))))]
[starts? ,#bottom order.<= ,#top]
[finishes? ,#top order.>= ,#bottom]
@@ -147,8 +147,8 @@
(def: (= reference sample)
(let [(open ",#[0]") reference]
- (and (,#= ,#bottom (# sample bottom))
- (,#= ,#top (# sample top))))))
+ (and (,#= ,#bottom (at sample bottom))
+ (,#= ,#top (at sample top))))))
(def: .public (nested? reference sample)
(All (_ a) (-> (Interval a) (Interval a) Bit))
@@ -156,8 +156,8 @@
(and (inner? reference) (inner? sample))
(and (outer? reference) (outer? sample)))
(let [(open ",#[0]") reference]
- (and (order.>= ,#order (# reference bottom) (# sample bottom))
- (order.<= ,#order (# reference top) (# sample top))))
+ (and (order.>= ,#order (at reference bottom) (at sample bottom))
+ (order.<= ,#order (at reference top) (at sample top))))
(or (singleton? reference)
(and (inner? reference) (outer? sample)))
@@ -165,16 +165,16 @@
... (and (outer? reference) (inner? sample))
(let [(open ",#[0]") reference]
- (or (and (order.>= ,#order (# reference bottom) (# sample bottom))
- (order.> ,#order (# reference bottom) (# sample top)))
- (and (,#< (# reference top) (# sample bottom))
- (order.<= ,#order (# reference top) (# sample top)))))
+ (or (and (order.>= ,#order (at reference bottom) (at sample bottom))
+ (order.> ,#order (at reference bottom) (at sample top)))
+ (and (,#< (at reference top) (at sample bottom))
+ (order.<= ,#order (at reference top) (at sample top)))))
))
(def: .public (overlaps? reference sample)
(All (_ a) (-> (Interval a) (Interval a) Bit))
(let [(open ",#[0]") reference]
- (and (not (# ..equivalence = reference sample))
+ (and (not (at ..equivalence = reference sample))
(cond (singleton? sample)
#0
@@ -183,8 +183,8 @@
(or (and (inner? sample) (outer? reference))
(and (outer? sample) (inner? reference)))
- (or (order.>= ,#order (# reference bottom) (# sample top))
- (order.<= ,#order (# reference top) (# sample bottom)))
+ (or (order.>= ,#order (at reference bottom) (at sample top))
+ (order.<= ,#order (at reference top) (at sample bottom)))
... both inner
(inner? sample)