As I understand the exercise, I have to write a function that takes in an array and sqare roots each number in it.
I have this solution now
squared :: Array Number -> Array Number
squared arr = (\n -> sqrt(n)) <$> arr
However, it gives me this error output
[info] Build succeeded.
→ Suite: Chapter Examples
✓ Passed: fact
✓ Passed: fib
✓ Passed: length
✓ Passed: factors
✓ Passed: factorsV2
✓ Passed: factorsV3
✓ Passed: factTailRec
✓ Passed: lengthTailRec
✓ Passed: allFiles
✓ Passed: allFiles'
→ Suite: Exercise Group - Recursion
✓ Passed: Exercise - isEven
→ Suite: Exercise - countEven
✓ Passed: [] has none
✓ Passed: [0] has 1
✓ Passed: [1] has 0
✓ Passed: [0, 1, 19, 20] has 2
→ Suite: Exercise Group - Maps, Infix Operators, and Filtering
→ Suite: Exercise - squared
✓ Passed: Do nothing with empty array
☠ Failed: Calculate squares because expected [0.0,1.0,4.0,9.0,10000.0], got [0.0,1.0,1.4142135623730951,1.7320508075688772,10.0]
1 test failed:
In "Exercise Group - Maps, Infix Operators, and Filtering":
In "Exercise - squared":
In "Calculate squares":
expected [0.0,1.0,4.0,9.0,10000.0], got [0.0,1.0,1.4142135623730951,1.7320508075688772,10.0]
[error] Tests failed: exit code: 1
Did I misunderstand the exercise or should I miss a step there? It doesn’t give an error for the function itself