Closed j0sht closed 2 years ago
Hi! Thanks for reporting.
The reason for this confusing feedback is that the analyzer expected you to call close_log
as the last thing in send_newsletter
. We did not foresee that people could choose a recursive approach to this exercise. Here's what we expected:
def send_newsletter(emails_path, log_path, send_fun) do
log_pid = open_log(log_path)
emails = read_emails(emails_path)
Enum.each(emails, fn email ->
case send_fun.(email) do
:ok -> log_sent_email(log_pid, email)
_ -> nil
end
end)
close_log(log_pid)
end
@jiegillet Do you have any ideas how we could improve the current check? Do you remember why we wrote "must end with close_log" instead of "cannot end with :ok"?
I guess we should change the check to match the message of "cannot end with :ok". We made that very change for other checks, but I we didn't do this one probably because no one complained before.
Hello! First thanks to all the contributors of the Elixir track at Exercism! Elixir if quickly becoming my favourite programming language :)
I just finished coding my solution to the Newsletter challenge, and here's what I submitted:
The analyzer gave me the following feedback:
However, I do actually implicitly return what
close_log/1
returns with the help of the private functiondo_send
in my solution. I'm sure there's other ways of writing a solution here, but no where do I explicitly return:ok
from any function in the solution, so I'm not sure why the analyzer is claiming I have forsend_newsletter/3
😕