diff options
author | Eduardo Julian | 2021-09-14 03:21:21 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-09-14 03:21:21 -0400 |
commit | ea15b844b51ff60f9785c6791507f813729f85c3 (patch) | |
tree | 601c99cec388abfc199316a7733480bfa34831d6 /stdlib/source/test | |
parent | 971767f1eafb22208912353d8709f11081f2d3c8 (diff) |
Better list pairing.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/test/lux/data/collection/list.lux | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index 5003567ee..a91db974f 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -281,8 +281,18 @@ sample/2 ..random] ($_ _.and (_.cover [/.pairs] - (n.= (n./ 2 (/.size sample/0)) - (/.size (/.pairs sample/0)))) + (let [even_sized? (|> sample/0 + /.size + (n.% 2) + (n.= 0))] + (case (/.pairs sample/0) + {.#Some pairs/0} + (and even_sized? + (n.= (n./ 2 (/.size sample/0)) + (/.size pairs/0))) + + {.#None} + (not even_sized?)))) (_.cover [/.zipped/2] (let [zipped (/.zipped/2 sample/0 sample/1) zipped::size (/.size zipped) @@ -412,7 +422,10 @@ (let [sample+ (/.interposed separator sample)] (and (n.= (|> (/.size sample) (n.* 2) --) (/.size sample+)) - (|> sample+ /.pairs (/.every? (|>> product.right (n.= separator)))))))) + (|> sample+ + /.pairs + (maybe.else (list)) + (/.every? (|>> product.right (n.= separator)))))))) (_.cover [/.iterations] (or (/.empty? sample) (let [size (/.size sample)] |