1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-25 01:37:19 +00:00

Merge branch 'master' of github.com:janet-lang/janet

This commit is contained in:
Calvin Rose 2021-12-04 10:28:16 -06:00
commit 6f4af5fef8
2 changed files with 8 additions and 3 deletions

View File

@ -908,7 +908,7 @@
(while true (while true
(if (= nil (set k1 (next i1 k1))) (break)) (if (= nil (set k1 (next i1 k1))) (break))
(if (= nil (set k2 (next i2 k2))) (break)) (if (= nil (set k2 (next i2 k2))) (break))
(if (= nil (set k3 (next i2 k3))) (break)) (if (= nil (set k3 (next i3 k3))) (break))
(array/push res (f (in i1 k1) (in i2 k2) (in i3 k3))))) (array/push res (f (in i1 k1) (in i2 k2) (in i3 k3)))))
4 (do 4 (do
(var k1 nil) (var k1 nil)
@ -918,8 +918,8 @@
(while true (while true
(if (= nil (set k1 (next i1 k1))) (break)) (if (= nil (set k1 (next i1 k1))) (break))
(if (= nil (set k2 (next i2 k2))) (break)) (if (= nil (set k2 (next i2 k2))) (break))
(if (= nil (set k3 (next i2 k3))) (break)) (if (= nil (set k3 (next i3 k3))) (break))
(if (= nil (set k4 (next i2 k4))) (break)) (if (= nil (set k4 (next i4 k4))) (break))
(array/push res (f (in i1 k1) (in i2 k2) (in i3 k3) (in i4 k4))))) (array/push res (f (in i1 k1) (in i2 k2) (in i3 k3) (in i4 k4)))))
(do (do
(def iterkeys (array/new-filled ninds)) (def iterkeys (array/new-filled ninds))

View File

@ -288,6 +288,11 @@
(assert (deep= (map + [1 2 3] [10 20 30] [100 200 300] [1000 2000 3000]) @[1111 2222 3333])) (assert (deep= (map + [1 2 3] [10 20 30] [100 200 300] [1000 2000 3000]) @[1111 2222 3333]))
(assert (deep= (map + [1 2 3] [10 20 30] [100 200 300] [1000 2000 3000] [10000 20000 30000]) @[11111 22222 33333])) (assert (deep= (map + [1 2 3] [10 20 30] [100 200 300] [1000 2000 3000] [10000 20000 30000]) @[11111 22222 33333]))
# Mapping uses the shortest sequence
(assert (deep= (map + [1 2 3 4] [10 20 30]) @[11 22 33]))
(assert (deep= (map + [1 2 3 4] [10 20 30] [100 200]) @[111 222]))
(assert (deep= (map + [1 2 3 4] [10 20 30] [100 200] [1000]) @[1111]))
# Sort function # Sort function
(assert (deep= (assert (deep=
(range 99) (range 99)