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

Array slicing beyond the end fails for arrays 32 elements or longer #349

Closed
jconti opened this Issue Aug 15, 2015 · 2 comments

Comments

Projects
None yet
3 participants
@jconti

jconti commented Aug 15, 2015

As I noted in the Google Group (https://groups.google.com/d/msg/elm-discuss/8RXblDRVjas/gpEnMLy-BwAJ) I have created a small example of a runtime failure of Array.slice:

import Array
import List
import Graphics.Element exposing (..)

-- Fails for value of 32, works for 31
aryLast = 32

sliceOffEnd =
  let
    ary = Array.fromList [0..aryLast]
  in
    Array.append (Array.slice 1 aryLast ary) (Array.slice (aryLast + 1) -1 ary)

main : Element
main =
  show sliceOffEnd
@eeue56

This comment has been minimized.

Show comment
Hide comment
@eeue56

eeue56 Sep 13, 2015

Contributor

I've put a fix for this in #399 as I've been hitting the issue a lot with my matrix library.

Contributor

eeue56 commented Sep 13, 2015

I've put a fix for this in #399 as I've been hitting the issue a lot with my matrix library.

@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Jun 25, 2016

Member

Closing in favor of #649 which will track all array issues and progress on a new implementation.

Member

evancz commented Jun 25, 2016

Closing in favor of #649 which will track all array issues and progress on a new implementation.

@evancz evancz closed this Jun 25, 2016

justinlubin referenced this issue in ravichugh/sketch-n-sketch Jun 25, 2017

Switch from Arrays to Lists
Apparently the built-in Elm arrays are broken, so use lists instead.
There does not seem to be much of a performance loss.

See https://github.com/elm-lang/core/issues/349.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment