diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/data/coll/list.lux | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/stdlib/source/lux/data/coll/list.lux b/stdlib/source/lux/data/coll/list.lux index b9b743b2c..f6c19dcb9 100644 --- a/stdlib/source/lux/data/coll/list.lux +++ b/stdlib/source/lux/data/coll/list.lux @@ -303,16 +303,21 @@ xs')] ($_ compose (sort < pre) (list x) (sort < post))))) -(do-template [<name> <type> <comp> <inc>] +(do-template [<name> <type> <lt> <inc> <gt> <dec>] [(def: #export (<name> from to) {#.doc "Generates an inclusive interval of values [from, to]."} (-> <type> <type> (List <type>)) - (if (<comp> to from) - (list& from (<name> (<inc> from) to)) - (list)))] + (cond (<lt> to from) + (list& from (<name> (<inc> from) to)) - [i/range Int i/<= i/inc] - [n/range Nat n/<= n/inc] + (<gt> to from) + (list& from (<name> (<dec> from) to)) + + ## (= to from) + (list from)))] + + [i/range Int i/< i/inc i/> i/dec] + [n/range Nat n/< n/inc n/> n/dec] ) (def: #export (empty? xs) |