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.append mutates first argument #691

Closed
AdamLuotonen opened this Issue Aug 15, 2016 · 5 comments

Comments

Projects
None yet
6 participants
@AdamLuotonen

AdamLuotonen commented Aug 15, 2016

Hi!

I think there is a problem with Array.append, as it mutates the first array parameter sent to it. To reproduce, run the following in elm-repl:

> import Array
> a = Array.fromList [1,2,3]
Array.fromList [1,2,3] : Array.Array number
> b = Array.fromList [4,5,6]
Array.fromList [4,5,6] : Array.Array number
> c = Array.append a b
Array.fromList [1,2,3,4,5,6] : Array.Array number
> a
Array.fromList [1,2,3,4,5,6] : Array.Array number

a should still be [1,2,3] here? I'm running Elm 0.17.1 on Windows.

@process-bot

This comment has been minimized.

Show comment
Hide comment
@process-bot

process-bot Aug 15, 2016

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

process-bot commented Aug 15, 2016

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

@lukewestby

This comment has been minimized.

Show comment
Hide comment
@lukewestby

lukewestby Aug 16, 2016

Member

Referencing #649

Member

lukewestby commented Aug 16, 2016

Referencing #649

@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Aug 29, 2016

Member

I added this to #649, track there. Also, there is progress on a mostly Elm implementation that should fix a lot of these issues!

Member

evancz commented Aug 29, 2016

I added this to #649, track there. Also, there is progress on a mostly Elm implementation that should fix a lot of these issues!

@evancz evancz closed this Aug 29, 2016

@evancz evancz referenced this issue Aug 29, 2016

Closed

array problems #649

@eike

This comment has been minimized.

Show comment
Hide comment
@eike

eike Jun 10, 2017

Since this problem still exists in Elm 0.18 (try

import Array
import Html exposing (..)

a = Array.fromList ["foo"]
b = Array.fromList ["bar"]
c = Array.append a b

main = div []
  [ text (toString a)
  , text (toString b)
  , text (toString c)
  ]

on elm-lang.org/try, for example), I think it would be a good idea to mention so in the documentation of Array.

eike commented Jun 10, 2017

Since this problem still exists in Elm 0.18 (try

import Array
import Html exposing (..)

a = Array.fromList ["foo"]
b = Array.fromList ["bar"]
c = Array.append a b

main = div []
  [ text (toString a)
  , text (toString b)
  , text (toString c)
  ]

on elm-lang.org/try, for example), I think it would be a good idea to mention so in the documentation of Array.

@ronanyeah

This comment has been minimized.

Show comment
Hide comment
@ronanyeah

ronanyeah Dec 5, 2017

I think it would be a good idea to mention so in the documentation of Array.

Or at least this comment should be clarified.

ronanyeah commented Dec 5, 2017

I think it would be a good idea to mention so in the documentation of Array.

Or at least this comment should be clarified.

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