blob: 4dc825508ec95f00dad9f1401e83601ae9492591 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
(.module:
[lux #*
[control
["." order]]])
## [Signatures]
(signature: #export (Enum e)
{#.doc "Enumerable types, with a notion of moving forward and backwards through a type's instances."}
(: (order.Order e) order)
(: (-> e e) succ)
(: (-> e e) pred))
## [Functions]
(def: (range' <= succ from to)
(All [a] (-> (-> a a Bit) (-> a a) a a (List a)))
(if (<= to from)
(#.Cons from (range' <= succ (succ from) to))
#.Nil))
(def: #export (range (^open) from to)
{#.doc "An inclusive [from, to] range of values."}
(All [a] (-> (Enum a) a a (List a)))
(range' <= succ from to))
|