New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`Cannot read property 'length' of undefined` when concatenating largeish arrays #32

Closed
pseudonom opened this Issue Dec 6, 2014 · 1 comment

Comments

Projects
None yet
1 participant
@pseudonom
Contributor

pseudonom commented Dec 6, 2014

I've defined concat as

concat = A.foldl (\x acc -> log "step" <| x `A.append` acc) A.empty

Using this,

concat << A.repeat 4 <| A.repeat 4 ()

produces

step: Array.fromList [(),(),(),()]
step: Array.fromList [(),(),(),(),(),(),(),()]
step: Array.fromList [(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),()]
step: Array.fromList [(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),()]
Array.fromList [(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),()]
 : Array.Array ()

as expected.

concat << A.repeat 4 <| A.repeat 5 ()

produces

step: Array.fromList [(),(),(),(),()]
step: Array.fromList [(),(),(),(),(),(),(),(),(),()]
step: Array.fromList [(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),()]
TypeError: Cannot read property 'length' of undefined

The line producing the error is https://github.com/elm-lang/core/blob/master/src/Native/Array.js#L477

@pseudonom

This comment has been minimized.

Show comment
Hide comment

@pseudonom pseudonom closed this Dec 15, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment