Closed angelikatyborska closed 4 months ago
Thank you for contributing to exercism/elixir
💜 🎉. This is an automated PR comment 🤖 for the maintainers of this repository that helps with the PR review process. You can safely ignore it and wait for a maintainer to review your changes.
Based on the files changed in this PR, it would be good to pay attention to the following details when reviewing the PR:
General steps
x:size/{tiny,small,medium,large,massive}
)? (A medium reputation amount is awarded by default, see docs)Any exercise changed
<exercise>/.meta/config.json
(see docs)?<exercise>/.meta/design.md
) need to be updated to document new implementation decisions?Concept exercise changed
prerequisites
and practices
in config.json
need to be updated?Concept changed
<concept>/.meta/config.json
(see docs)?Automated comment created by PR Commenter 🤖.
A bit late, but I noticed now that the exemplar solution doesn't even use function capturing 🙃 I'm afraid this change might have added even more confusion...
defmodule TakeANumber do
def start() do
spawn(fn -> loop(0) end)
end
defp loop(state) do
receive do
{:report_state, sender_pid} ->
send(sender_pid, state)
loop(state)
{:take_a_number, sender_pid} ->
state = state + 1
send(sender_pid, state)
loop(state)
:stop ->
nil
_ ->
loop(state)
end
end
end
Partially addresses https://github.com/exercism/elixir/issues/1482
In take-a-number, it was difficult to figure out how to pass a named function to
spawn
. The example in the introduction used an anonymous function, and we actually don't teach anywhere how to use the capture operator to pass named functions as arguments. The only place this is mentioned, is the anonymous function's concept's "about" page, which most people will never see (rendered only if you browse the concept after learning it). None of the concept introductions mention how to use the capture operator for named functions.