PiL3
PiL3 copied to clipboard
7.2 wrong start
https://github.com/xfbs/PiL3/blob/master/07Iterators/fromtostep.lua Hey, again : )
your code gives:
> for i in fromto(3,7,2) do print(i) end
4
6
but should be:
> for i in fromto(3,7,2) do print(i) end
3
5
7
my code:
function fromto(f,t,s)
local iter; iter = function(s)
s[1] = s[1] + s[3]
if s[1]<=s[2] then
return s[1]
else
return nil
end
end
return iter, {f-s,t,s}
end
https://github.com/xfbs/PiL3/blob/master/07Iterators/fromtostep.lua#L26
min-1
should be min-step
i guess