Skip to content

Tuple.append/2 is deprecated. Use insert_at instead #300

@ghost

Description

I started learning Elixir this week and I'm going through the koans. I got a warning on the following koan at 05_tuples.ex:

koan "Add things at the end" do
  assert Tuple.append({"Huey", "Dewey"}, "Louie") == {"Huey", "Dewey", "Louie"}
end

Apparently, Tuple.append has been deprecated since Elixir v1.18.0.

On Elixir's documentation (at https://hexdocs.pm/elixir/Tuple.html) they say the following:

"To append to a tuple, it is preferable to extract the elements from the old tuple with pattern matching, and then create a new tuple"

Since I'm new to Elixir, I don't know how to do that yet. But if anyone has the time to explain it to me, I'll gladly open a PR with the change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions