mirror of
https://github.com/janet-lang/janet
synced 2024-12-01 04:19:55 +00:00
Make zipcoll more generic.
Work with any iterable (next) type.
This commit is contained in:
parent
ac5de1f96e
commit
6a187a384b
@ -1236,11 +1236,14 @@
|
|||||||
Returns a new table."
|
Returns a new table."
|
||||||
[ks vs]
|
[ks vs]
|
||||||
(def res @{})
|
(def res @{})
|
||||||
(def lk (length ks))
|
(var kk nil)
|
||||||
(def lv (length vs))
|
(var vk nil)
|
||||||
(def len (if (< lk lv) lk lv))
|
(while true
|
||||||
(for i 0 len
|
(set kk (next ks kk))
|
||||||
(put res (in ks i) (in vs i)))
|
(if (= nil kk) (break))
|
||||||
|
(set vk (next vs vk))
|
||||||
|
(if (= nil vk) (break))
|
||||||
|
(put res (in ks kk) (in vs vk)))
|
||||||
res)
|
res)
|
||||||
|
|
||||||
(defn get-in
|
(defn get-in
|
||||||
|
Loading…
Reference in New Issue
Block a user