exercism / gleam

Exercism exercises in Gleam.
https://exercism.org/tracks/gleam
MIT License
89 stars 82 forks source link

Update instructions for Erlang-Extraction Exercise #496

Closed RickHPotter closed 3 months ago

RickHPotter commented 5 months ago

https://exercism.org/tracks/gleam/exercises/erlang-extraction

In the exercise, it says

The function should take three arguments:

The GbTree to insert into.
The key to insert.
The value to insert.

But the correct order is as follows

insert(Key, Value, Tree1) Inserts Key with value Value into Tree1 and returns the new tree. Assumes that the key is not present in the tree, crashes otherwise.

RickHPotter commented 5 months ago

I just realised that the delete_any external function is also with the wrong order. It should be key, Tree1, but the exercise says otherwise.

Varpie commented 3 months ago

I believe the order isn't the same as the Erlang version on purpose: having the tree as the first parameter is better for piping in Gleam, and the hints remind users that a private function can be used to change the order of parameters. Since you created the issue, #514 was also merged, which adds a reminder that the correct order of arguments should be used.

lpil commented 3 months ago

That's right 👍 In Gleam the data structure goes first always.