mirror of
https://github.com/janet-lang/janet
synced 2024-12-29 09:50:27 +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."
|
||||
[ks vs]
|
||||
(def res @{})
|
||||
(def lk (length ks))
|
||||
(def lv (length vs))
|
||||
(def len (if (< lk lv) lk lv))
|
||||
(for i 0 len
|
||||
(put res (in ks i) (in vs i)))
|
||||
(var kk nil)
|
||||
(var vk nil)
|
||||
(while true
|
||||
(set kk (next ks kk))
|
||||
(if (= nil kk) (break))
|
||||
(set vk (next vs vk))
|
||||
(if (= nil vk) (break))
|
||||
(put res (in ks kk) (in vs vk)))
|
||||
res)
|
||||
|
||||
(defn get-in
|
||||
|
Loading…
Reference in New Issue
Block a user