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.
Which is pretty much what I did, though I used Haskell. But why do it that way to begin with? I just fail to see the reason for it!
All you really need to do is setup
Why hide away the Node type in a private module? It means one is forced to program in the browser rather than using one's favourite editor and local setup!
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Well, in most languages this can be done with regular expressions
I marked it as an issue since it's a question regarding behaviour that suggests it's an issue with the test ;)
My original solution (not the one I submitted), does handle
isValidWalk $ repeat 'n'
just fine, but the test never returns.Nice, but it doesn't work on quite a few languages of course.
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.
I'm stuck on the code in Test.hs with infinate walks. That is, my solution handles this:
but when running the provided test code the test never terminates. Is there something that's too strict in the test (so the infinate walk is evaluated)?
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
Loading more items...