Description
On the Secrets exercise.
The example given in the instructions to create a function combiner, reads:
let multiply = secret_multiply(7)
let divide = secret_divide(3)
let combined = secret_combine(multiply, divide)
combined(6)
// -> 14
From this example, it is not clear if secret_combine
should first apply multiply
and then divide
, or first divide
and then multiply
: (6/3) * 7 = 14, and (6 * 7)/3 = 14 as well. Learners will know which order is right only from reading very carefully, or after running the tests.
I'd propose to change this example so that the intended order of the operations becomes clear. For example:
let multiply = secret_multiply(7)
let add = secret_add(3)
let combined = secret_combine(multiply, add)
combined(6)
// -> 6*7 + 3 -> 45
Here the desired outcome is 6 * 7 + 3 = 45 and not (6 + 7) * 3 = 39 or 6 + 7 * 3 = 27.
For even clearer instructions, I'd also propose to change the exercise wording from "It should return a function which takes one argument and applies to it the two functions passed in to secret_combine in order." to "...in order from left to right."
What do you think? I'm happy to create a PR!