Skip to content

Commit f31adff

Browse files
authored
Merge pull request #3 from stdgregwar/master
fixed flatmap not working as expected. closes #2.
2 parents 220e6db + cde2f39 commit f31adff

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

iter.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ local function flatmap_collect(state, key, ...)
351351
if key == nil then
352352
local citer, cstate, cinit = map_collect(state, calliter(state))
353353
if not citer then return end
354-
state[4], state[5], state[6], state[7] = citer, cstate, cinit, nil
354+
state[5], state[6], state[7] = citer, cstate, cinit
355355
return flatmap_collect(state, citer(cstate, cinit))
356356
end
357357
state[4] = key
@@ -363,9 +363,9 @@ local function flatmap_iter(state, key)
363363
state[4] = nil
364364
return flatmap_collect(state)
365365
end
366-
local citer, cstate = state[4], state[5]
366+
local citer, cstate = state[5], state[6]
367367
if not citer then return flatmap_collect(state) end
368-
return flatmap_collect(state, citer(cstate, state[7]))
368+
return flatmap_collect(state, citer(cstate, state[4]))
369369
end
370370

371371
local function flatmap(func, ...)

0 commit comments

Comments
 (0)