You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This exercise currently rejects duplicate triples, but does not mention that requirement. Some options to fix:
Clarify that duplicate triples should be avoided. e.g. "Note: Avoid returning duplicate triples, for example if generating [ 4, 3, 5 ], don't also generate [ 5, 3, 4 ]"
Clarify that duplicate triples should be generated, and modify tests and solutions. I think this adds unnecessary noise.
Automatically remove duplicates in the test suite. This might test suite errors a little confusing, since the "actual" result will be different than what the user's function actually returns, although we already have that same potential for confusion with sort applied in the suite. Returning Set (Set Int) would simplify exercise requirements, but might not be appropriate for this chapter.
Existing exercise text:
(Medium) Write a function triples :: Int -> Array (Array Int) which takes a number n and returns all Pythagorean triples whose components (the a, b and c values) are each less than or equal to n. A Pythagorean triple is an array of numbers [a, b, c] such that a² + b² = c². Hint: Use the guard function in an array comprehension.
This exercise currently rejects duplicate triples, but does not mention that requirement. Some options to fix:
[ 4, 3, 5 ]
, don't also generate[ 5, 3, 4 ]
"sort
applied in the suite. ReturningSet (Set Int)
would simplify exercise requirements, but might not be appropriate for this chapter.Existing exercise text:
https://book.purescript.org/chapter4.html#exercises-2
purescript-book/exercises/chapter4/test/no-peeking/Solutions.purs
Lines 52 to 58 in 6527372
purescript-book/exercises/chapter4/test/Main.purs
Lines 102 to 111 in 6527372
The text was updated successfully, but these errors were encountered: