Mismatch between spec and test on Complex Numbers

This is a very minor issue but I thought I’d report anyway.

On the Complex Numbers exercise, the spec of the functions uses complex | float on many of the core functions to be implemented (add, mul, and div, for example).

However, tests pass integer parameters to the program, so following the spec I implemented the function using a is_float guard, which promptly failed the tests, but replacing those with a is_number guard the tests passed.

I suggest to change the spec to complex | number on the problem.

CC @angelikatyborska

No need to ping me, I’m subscribed to the Elixir category on the forum :slightly_smiling_face:

Thank you for the report. You’re absolutely right. I opened a PR: Fix types in complex numbers by angelikatyborska · Pull Request #1467 · exercism/elixir · GitHub

1 Like