Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
All you really need to do is setup
This comment is hidden because it contains spoiler information about the solution
Well, in most languages this can be done with regular expressions
This isn't an issue, but a question. That aside, the test for infinite lists is
The only function that could actually evaluate the list is
isValidWalk
. Does your solution also handleisValidWalk $ repeat 'n'
?If you need more help, post it in a comment, but mark it as a spoiler.
Because
shouldBeFuzzy
usesshouldBe
, which uses(==) :: Eq a => a -> a -> Bool
. That's actually the reason I useFuzzyDouble
, so that I can "override" the behaviour ofshouldBe
forDouble
. That way, I didn't had to write the following code:Which, to be honest, seems actually smaller. Meh.
Yeah, it's definitely the right way to compare doubles and the second piece of code looks good, but why call that function "=="?
In general, yes. However, using equality tests on
Double
is usually bad, given that(+) :: Double -> Double -> Double
isn't associative. For example, the following loop might not halt (depends on the used floating point type, equality test, and interpretation of literals):At least
(==) :: FuzzyDouble -> FuzzyDouble -> Bool
is still symmetric and reflexive. Also, none of the types are exported.That == doesn't look transitive. Don't you think it's a bad practice?
However, you can shorten it to
Best shot at it: post under bkaes' comment and he might be notified about that.
I don't think it is possible. You don't have access to the preloaded section and I'm not the Haskell translator.
Don't worry, it's preloaded for you: nothing to do.