aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/data/coll/list.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/data/coll/list.lux')
-rw-r--r--stdlib/source/lux/data/coll/list.lux32
1 files changed, 16 insertions, 16 deletions
diff --git a/stdlib/source/lux/data/coll/list.lux b/stdlib/source/lux/data/coll/list.lux
index f6c19dcb9..f970ccf9f 100644
--- a/stdlib/source/lux/data/coll/list.lux
+++ b/stdlib/source/lux/data/coll/list.lux
@@ -76,8 +76,8 @@
<then>)
<else>))]
- [take (#.Cons [x (take (n/dec n) xs')]) #.Nil]
- [drop (drop (n/dec n) xs') xs]
+ [take (#.Cons [x (take (dec n) xs')]) #.Nil]
+ [drop (drop (dec n) xs') xs]
)
(do-template [<name> <then> <else>]
@@ -106,7 +106,7 @@
[#.Nil #.Nil]
(#.Cons [x xs'])
- (let [[tail rest] (split (n/dec n) xs')]
+ (let [[tail rest] (split (dec n) xs')]
[(#.Cons [x tail]) rest]))
[#.Nil xs]))
@@ -145,7 +145,7 @@
(All [a]
(-> Nat a (List a)))
(if (n/> +0 n)
- (#.Cons [x (repeat (n/dec n) x)])
+ (#.Cons [x (repeat (dec n) x)])
#.Nil))
(def: (iterate' f x)
@@ -232,7 +232,7 @@
(#.Cons [x xs'])
(if (n/= +0 i)
(#.Some x)
- (nth (n/dec i) xs'))))
+ (nth (dec i) xs'))))
## [Structures]
(struct: #export (Eq<List> Eq<a>)
@@ -303,21 +303,21 @@
xs')]
($_ compose (sort < pre) (list x) (sort < post)))))
-(do-template [<name> <type> <lt> <inc> <gt> <dec>]
+(do-template [<name> <type> <lt> <gt>]
[(def: #export (<name> from to)
{#.doc "Generates an inclusive interval of values [from, to]."}
(-> <type> <type> (List <type>))
(cond (<lt> to from)
- (list& from (<name> (<inc> from) to))
+ (list& from (<name> (inc from) to))
(<gt> to from)
- (list& from (<name> (<dec> from) to))
+ (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]
+ [i/range Int i/< i/>]
+ [n/range Nat n/< n/>]
)
(def: #export (empty? xs)
@@ -362,14 +362,14 @@
(^ (list [_ (#.Nat num-lists)]))
(if (n/> +0 num-lists)
(let [(^open) Functor<List>
- indices (n/range +0 (n/dec num-lists))
+ indices (n/range +0 (dec num-lists))
type-vars (: (List Code) (map (|>> nat/encode symbol$) indices))
zip-type (` (All [(~+ type-vars)]
(-> (~+ (map (: (-> Code Code) (function (_ var) (` (List (~ var)))))
type-vars))
(List [(~+ type-vars)]))))
vars+lists (|> indices
- (map n/inc)
+ (map inc)
(map (function (_ idx)
(let [base (nat/encode idx)]
[(symbol$ base)
@@ -406,7 +406,7 @@
(^ (list [_ (#.Nat num-lists)]))
(if (n/> +0 num-lists)
(let [(^open) Functor<List>
- indices (n/range +0 (n/dec num-lists))
+ indices (n/range +0 (dec num-lists))
g!return-type (symbol$ "\treturn-type\t")
g!func (symbol$ "\tfunc\t")
type-vars (: (List Code) (map (|>> nat/encode symbol$) indices))
@@ -416,7 +416,7 @@
type-vars))
(List (~ g!return-type)))))
vars+lists (|> indices
- (map n/inc)
+ (map inc)
(map (function (_ idx)
(let [base (nat/encode idx)]
[(symbol$ base)
@@ -509,7 +509,7 @@
#.Nil
(#.Cons x xs')
- (#.Cons [idx x] (enumerate' (n/inc idx) xs'))))
+ (#.Cons [idx x] (enumerate' (inc idx) xs'))))
(def: #export (enumerate xs)
{#.doc "Pairs every element in the list with its index, starting at 0."}
@@ -521,4 +521,4 @@
(All [a] (-> Nat (List Nat)))
(if (n/= +0 size)
(list)
- (|> size n/dec (n/range +0))))
+ (|> size dec (n/range +0))))