aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/abstract/interval.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/abstract/interval.lux28
1 files changed, 14 insertions, 14 deletions
diff --git a/stdlib/source/lux/abstract/interval.lux b/stdlib/source/lux/abstract/interval.lux
index 17e749804..46fe020e1 100644
--- a/stdlib/source/lux/abstract/interval.lux
+++ b/stdlib/source/lux/abstract/interval.lux
@@ -102,12 +102,23 @@
(All [a] (-> (Interval a) (Interval a) Bit))
(precedes? sample reference))
+(template [<name> <comp>]
+ [(def: #export (<name> reference sample)
+ (All [a] (-> a (Interval a) Bit))
+ (let [(^open ",@.") sample]
+ (and (<comp> reference ,@bottom)
+ (<comp> reference ,@top))))]
+
+ [before? ,@<]
+ [after? (order.> ,@&order)]
+ )
+
(def: #export (meets? reference sample)
(All [a] (-> (Interval a) (Interval a) Bit))
(let [(^open ",@.") reference
- limit (:: reference ,@bottom)]
- (and (order.<= ,@&order limit (:: sample ,@bottom))
- (,@= limit (:: sample ,@top)))))
+ limit (:: reference bottom)]
+ (and (,@= limit (:: sample top))
+ (order.<= ,@&order limit (:: sample bottom)))))
(def: #export (touches? reference sample)
(All [a] (-> (Interval a) (Interval a) Bit))
@@ -128,17 +139,6 @@
[finishes? ,@top order.>= ,@bottom]
)
-(template [<name> <comp>]
- [(def: #export (<name> reference sample)
- (All [a] (-> a (Interval a) Bit))
- (let [(^open ",@.") sample]
- (and (<comp> reference ,@bottom)
- (<comp> reference ,@top))))]
-
- [before? ,@<]
- [after? (order.> ,@&order)]
- )
-
(structure: #export equivalence (All [a] (Equivalence (Interval a)))
(def: (= reference sample)
(let [(^open ",@.") reference]