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.
The haskell tests are totally broken; there are several solutions that just return a static string that succeed. Please fix!
I hit that mine too with my first implementation of pass1(), and was a little frustrated that the tree wasn't accepted and I had to refactor.
That said, and to be fair, the grammar for expression and term does define the order the tree should be built in, altough it could be a nice gesture to explicitly state the associativity in the description too.
But your tree does not seem to conform to the associativity described with the grammar syntax? The grammar does not allow for
expression
on the right.Honestly pretty disappointed that the tests only accept a certian tree for
pass1
. I really like the way I implemented it with the tree going the other way but now I have to refactor everything to get it going the other way and I'm having a really tough time of it.for example
1+2+3+4
right:
Add (Add (Add (Imm 1) (Imm 2)) (Imm 3)) (Imm 4)
wrong:
Add (Imm 1) (Add (Imm 2) (Add (Imm 3) (Imm 4)))
Old version
I just finished my solution and I have a habit of working on these without even looking at the function definition. I was surprised when I saw it using
Text
instead ofString
but ultimately it was very easy to adapt my solution to useText
instead.Text
also has a few more useful functions thanString
, but I had to install the package to work with it on my machine. For what it's worth, I thinkText
is fine.I was being rude. But clearly that's a joke. Well, half joke and half truth. Because I was devastated seeing other people's ultra short code without even being able to understand them.
Don't take it seriously man. We need some laughter climbing the programming mountain, the Haskell mountain!
That's a bit rude, but not really. I'm a beginner to haskell and this is the solution that made sense to me. It just means I have more to learn :)
You must be devasted seeing other people's short code :)