diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/abstract/fold.lux | 6 | ||||
-rw-r--r-- | stdlib/source/lux/abstract/interval.lux | 28 | ||||
-rw-r--r-- | stdlib/source/lux/abstract/order.lux | 4 |
3 files changed, 18 insertions, 20 deletions
diff --git a/stdlib/source/lux/abstract/fold.lux b/stdlib/source/lux/abstract/fold.lux index 504f41f58..a63dc8e20 100644 --- a/stdlib/source/lux/abstract/fold.lux +++ b/stdlib/source/lux/abstract/fold.lux @@ -12,7 +12,5 @@ (def: #export (with-monoid monoid fold value) (All [F a] (-> (Monoid a) (Fold F) (F a) a)) - (let [(^open "monoid;.") monoid] - (fold monoid;compose - monoid;identity - value))) + (let [(^open "/@.") monoid] + (fold /@compose /@identity value))) 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] diff --git a/stdlib/source/lux/abstract/order.lux b/stdlib/source/lux/abstract/order.lux index 6f992695a..5634aac80 100644 --- a/stdlib/source/lux/abstract/order.lux +++ b/stdlib/source/lux/abstract/order.lux @@ -16,7 +16,7 @@ <) ) -(type: (Comparison a) +(type: #export (Comparison a) (-> (Order a) a a Bit)) (def: #export (<= order parameter subject) @@ -33,7 +33,7 @@ (or (:: order < subject parameter) (:: order = subject parameter))) -(type: (Choice a) +(type: #export (Choice a) (-> (Order a) a a a)) (def: #export (min order x y) |