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.lux68
1 files changed, 34 insertions, 34 deletions
diff --git a/stdlib/source/library/lux/abstract/interval.lux b/stdlib/source/library/lux/abstract/interval.lux
index 9f4a4a6ec..0a538e925 100644
--- a/stdlib/source/library/lux/abstract/interval.lux
+++ b/stdlib/source/library/lux/abstract/interval.lux
@@ -18,22 +18,22 @@
(is a
top)))
-(def: .public (between enum bottom top)
+(def .public (between enum bottom top)
(All (_ a) (-> (Enum a) a a (Interval a)))
(implementation
- (def: enum enum)
- (def: bottom bottom)
- (def: top top)))
+ (def enum enum)
+ (def bottom bottom)
+ (def top top)))
-(def: .public (singleton enum elem)
+(def .public (singleton enum elem)
(All (_ a) (-> (Enum a) a (Interval a)))
(implementation
- (def: enum enum)
- (def: bottom elem)
- (def: top elem)))
+ (def enum enum)
+ (def bottom elem)
+ (def top elem)))
(with_template [<name> <comp>]
- [(def: .public (<name> interval)
+ [(def .public (<name> interval)
(All (_ a) (-> (Interval a) Bit))
(let [(open ",#[0]") interval]
(<comp> ,#bottom ,#top)))]
@@ -43,7 +43,7 @@
[singleton? ,#=]
)
-(def: .public (within? interval elem)
+(def .public (within? interval elem)
(All (_ a) (-> (Interval a) a Bit))
(let [(open ",#[0]") interval]
(cond (inner? interval)
@@ -59,7 +59,7 @@
(,#= ,#top elem)))))
(with_template [<name> <limit>]
- [(def: .public (<name> elem interval)
+ [(def .public (<name> elem interval)
(All (_ a) (-> a (Interval a) Bit))
(let [(open "[0]") interval]
(= <limit> elem)))]
@@ -68,45 +68,45 @@
[ends_with? top]
)
-(def: .public (borders? interval elem)
+(def .public (borders? interval elem)
(All (_ a) (-> (Interval a) a Bit))
(or (starts_with? elem interval)
(ends_with? elem interval)))
-(def: .public (union left right)
+(def .public (union left right)
(All (_ a) (-> (Interval a) (Interval a) (Interval a)))
(implementation
- (def: enum (the enum right))
- (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)))))
+ (def enum (the enum right))
+ (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)))))
-(def: .public (intersection left right)
+(def .public (intersection left right)
(All (_ a) (-> (Interval a) (Interval a) (Interval a)))
(implementation
- (def: enum (the enum right))
- (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)))))
+ (def enum (the enum right))
+ (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)))))
-(def: .public (complement interval)
+(def .public (complement interval)
(All (_ a) (-> (Interval a) (Interval a)))
(implementation
- (def: enum (the enum interval))
- (def: bottom (at interval succ (at interval top)))
- (def: top (at interval pred (at interval bottom)))))
+ (def enum (the enum interval))
+ (def bottom (at interval succ (at interval top)))
+ (def top (at interval pred (at interval bottom)))))
-(def: .public (precedes? reference sample)
+(def .public (precedes? reference sample)
(All (_ a) (-> (Interval a) (Interval a) Bit))
(let [(open "[0]") reference
limit (at reference bottom)]
(and (< limit (at sample bottom))
(< limit (at sample top)))))
-(def: .public (succeeds? reference sample)
+(def .public (succeeds? reference sample)
(All (_ a) (-> (Interval a) (Interval a) Bit))
(precedes? sample reference))
(with_template [<name> <comp>]
- [(def: .public (<name> reference sample)
+ [(def .public (<name> reference sample)
(All (_ a) (-> a (Interval a) Bit))
(let [(open ",#[0]") sample]
(and (<comp> reference ,#bottom)
@@ -116,20 +116,20 @@
[after? (order.> ,#order)]
)
-(def: .public (meets? reference sample)
+(def .public (meets? reference sample)
(All (_ a) (-> (Interval a) (Interval a) Bit))
(let [(open ",#[0]") reference
limit (at reference bottom)]
(and (,#= limit (at sample top))
(order.<= ,#order limit (at sample bottom)))))
-(def: .public (touches? reference sample)
+(def .public (touches? reference sample)
(All (_ a) (-> (Interval a) (Interval a) Bit))
(or (meets? reference sample)
(meets? sample reference)))
(with_template [<name> <eq_side> <ineq> <ineq_side>]
- [(def: .public (<name> reference sample)
+ [(def .public (<name> reference sample)
(All (_ a) (-> (Interval a) (Interval a) Bit))
(let [(open ",#[0]") reference]
(and (,#= (at reference <eq_side>)
@@ -142,15 +142,15 @@
[finishes? ,#top order.>= ,#bottom]
)
-(def: .public equivalence
+(def .public equivalence
(All (_ a) (Equivalence (Interval a)))
(implementation
- (def: (= reference sample)
+ (def (= reference sample)
(let [(open ",#[0]") reference]
(and (,#= ,#bottom (at sample bottom))
(,#= ,#top (at sample top)))))))
-(def: .public (nested? reference sample)
+(def .public (nested? reference sample)
(All (_ a) (-> (Interval a) (Interval a) Bit))
(cond (or (singleton? sample)
(and (inner? reference) (inner? sample))
@@ -171,7 +171,7 @@
(order.<= ,#order (at reference top) (at sample top)))))
))
-(def: .public (overlaps? reference sample)
+(def .public (overlaps? reference sample)
(All (_ a) (-> (Interval a) (Interval a) Bit))
(let [(open ",#[0]") reference]
(and (not (at ..equivalence = reference sample))