diff options
Diffstat (limited to 'stdlib/source/lux/abstract/interval.lux')
-rw-r--r-- | stdlib/source/lux/abstract/interval.lux | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/stdlib/source/lux/abstract/interval.lux b/stdlib/source/lux/abstract/interval.lux index fbe3a4c8a..e43529890 100644 --- a/stdlib/source/lux/abstract/interval.lux +++ b/stdlib/source/lux/abstract/interval.lux @@ -6,7 +6,7 @@ ["." order] [enum (#+ Enum)]]) -(signature: #export (Interval a) +(interface: #export (Interval a) {#.doc "A representation of top and bottom boundaries for an ordered type."} (: (Enum a) &enum) @@ -19,14 +19,14 @@ (def: #export (between enum bottom top) (All [a] (-> (Enum a) a a (Interval a))) - (structure + (implementation (def: &enum enum) (def: bottom bottom) (def: top top))) (def: #export (singleton enum elem) (All [a] (-> (Enum a) a (Interval a))) - (structure + (implementation (def: &enum enum) (def: bottom elem) (def: top elem))) @@ -74,22 +74,25 @@ (def: #export (union left right) (All [a] (-> (Interval a) (Interval a) (Interval a))) - (structure (def: &enum (get@ #&enum right)) - (def: bottom (order.min (\ right &order) (\ left bottom) (\ right bottom))) - (def: top (order.max (\ right &order) (\ left top) (\ right top))))) + (implementation + (def: &enum (get@ #&enum right)) + (def: bottom (order.min (\ right &order) (\ left bottom) (\ right bottom))) + (def: top (order.max (\ right &order) (\ left top) (\ right top))))) (def: #export (intersection left right) (All [a] (-> (Interval a) (Interval a) (Interval a))) - (structure (def: &enum (get@ #&enum right)) - (def: bottom (order.max (\ right &order) (\ left bottom) (\ right bottom))) - (def: top (order.min (\ right &order) (\ left top) (\ right top))))) + (implementation + (def: &enum (get@ #&enum right)) + (def: bottom (order.max (\ right &order) (\ left bottom) (\ right bottom))) + (def: top (order.min (\ right &order) (\ left top) (\ right top))))) (def: #export (complement interval) (All [a] (-> (Interval a) (Interval a))) (let [(^open ".") interval] - (structure (def: &enum (get@ #&enum interval)) - (def: bottom (succ top)) - (def: top (pred bottom))))) + (implementation + (def: &enum (get@ #&enum interval)) + (def: bottom (succ top)) + (def: top (pred bottom))))) (def: #export (precedes? reference sample) (All [a] (-> (Interval a) (Interval a) Bit)) @@ -139,7 +142,7 @@ [finishes? ,\top order.>= ,\bottom] ) -(structure: #export equivalence (All [a] (Equivalence (Interval a))) +(implementation: #export equivalence (All [a] (Equivalence (Interval a))) (def: (= reference sample) (let [(^open ",\.") reference] (and (,\= ,\bottom (\ sample bottom)) |