diff options
Diffstat (limited to 'stdlib/source/lux/abstract/interval.lux')
-rw-r--r-- | stdlib/source/lux/abstract/interval.lux | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/stdlib/source/lux/abstract/interval.lux b/stdlib/source/lux/abstract/interval.lux index 46fe020e1..c429fa5c8 100644 --- a/stdlib/source/lux/abstract/interval.lux +++ b/stdlib/source/lux/abstract/interval.lux @@ -34,28 +34,28 @@ (template [<name> <comp>] [(def: #export (<name> interval) (All [a] (-> (Interval a) Bit)) - (let [(^open ",@.") interval] - (<comp> ,@bottom ,@top)))] + (let [(^open ",\.") interval] + (<comp> ,\bottom ,\top)))] - [inner? (order.> ,@&order)] - [outer? ,@<] - [singleton? ,@=] + [inner? (order.> ,\&order)] + [outer? ,\<] + [singleton? ,\=] ) (def: #export (within? interval elem) (All [a] (-> (Interval a) a Bit)) - (let [(^open ",@.") interval] + (let [(^open ",\.") interval] (cond (inner? interval) - (and (order.>= ,@&order ,@bottom elem) - (order.<= ,@&order ,@top elem)) + (and (order.>= ,\&order ,\bottom elem) + (order.<= ,\&order ,\top elem)) (outer? interval) - (or (order.>= ,@&order ,@bottom elem) - (order.<= ,@&order ,@top elem)) + (or (order.>= ,\&order ,\bottom elem) + (order.<= ,\&order ,\top elem)) ## singleton - (and (,@= ,@bottom elem) - (,@= ,@top elem))))) + (and (,\= ,\bottom elem) + (,\= ,\top elem))))) (template [<name> <limit>] [(def: #export (<name> elem interval) @@ -105,20 +105,20 @@ (template [<name> <comp>] [(def: #export (<name> reference sample) (All [a] (-> a (Interval a) Bit)) - (let [(^open ",@.") sample] - (and (<comp> reference ,@bottom) - (<comp> reference ,@top))))] + (let [(^open ",\.") sample] + (and (<comp> reference ,\bottom) + (<comp> reference ,\top))))] - [before? ,@<] - [after? (order.> ,@&order)] + [before? ,\<] + [after? (order.> ,\&order)] ) (def: #export (meets? reference sample) (All [a] (-> (Interval a) (Interval a) Bit)) - (let [(^open ",@.") reference + (let [(^open ",\.") reference limit (:: reference bottom)] - (and (,@= limit (:: sample top)) - (order.<= ,@&order limit (:: sample bottom))))) + (and (,\= limit (:: sample top)) + (order.<= ,\&order limit (:: sample bottom))))) (def: #export (touches? reference sample) (All [a] (-> (Interval a) (Interval a) Bit)) @@ -128,47 +128,47 @@ (template [<name> <eq-side> <ineq> <ineq-side>] [(def: #export (<name> reference sample) (All [a] (-> (Interval a) (Interval a) Bit)) - (let [(^open ",@.") reference] - (and (,@= (:: reference <eq-side>) + (let [(^open ",\.") reference] + (and (,\= (:: reference <eq-side>) (:: sample <eq-side>)) - (<ineq> ,@&order + (<ineq> ,\&order (:: reference <ineq-side>) (:: sample <ineq-side>)))))] - [starts? ,@bottom order.<= ,@top] - [finishes? ,@top order.>= ,@bottom] + [starts? ,\bottom order.<= ,\top] + [finishes? ,\top order.>= ,\bottom] ) (structure: #export equivalence (All [a] (Equivalence (Interval a))) (def: (= reference sample) - (let [(^open ",@.") reference] - (and (,@= ,@bottom (:: sample bottom)) - (,@= ,@top (:: sample top)))))) + (let [(^open ",\.") reference] + (and (,\= ,\bottom (:: sample bottom)) + (,\= ,\top (:: sample top)))))) (def: #export (nested? reference sample) (All [a] (-> (Interval a) (Interval a) Bit)) (cond (or (singleton? sample) (and (inner? reference) (inner? sample)) (and (outer? reference) (outer? sample))) - (let [(^open ",@.") reference] - (and (order.>= ,@&order (:: reference bottom) (:: sample bottom)) - (order.<= ,@&order (:: reference top) (:: sample top)))) + (let [(^open ",\.") reference] + (and (order.>= ,\&order (:: reference bottom) (:: sample bottom)) + (order.<= ,\&order (:: reference top) (:: sample top)))) (or (singleton? reference) (and (inner? reference) (outer? sample))) #0 ## (and (outer? reference) (inner? sample)) - (let [(^open ",@.") 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))))) + (let [(^open ",\.") 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))))) )) (def: #export (overlaps? reference sample) (All [a] (-> (Interval a) (Interval a) Bit)) - (let [(^open ",@.") reference] + (let [(^open ",\.") reference] (and (not (:: ..equivalence = reference sample)) (cond (singleton? sample) #0 @@ -178,8 +178,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 (:: reference bottom) (:: sample top)) + (order.<= ,\&order (:: reference top) (:: sample bottom))) ## both inner (inner? sample) |