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.
This comment is hidden because it contains spoiler information about the solution
Well, you can fuse the map/reduce logic together into one reduce call if you prefer that way. I think it's more clear in this way, although less efficient.
You can simplify this a bit with
unsafeRegex
fromData.String.Regex.Unsafe
.Hey guys,
I've made a Purescript translation of this challenge, would anyone care to review it please? It's my first translation, so I'd be happy to take any feedback on board for future challenges.
It's not even a method, just a function.
If you are new to programming I guess it's recursion that confuses you in this example.
Notice the remove function in the body is the same one that's defined with the function keyword on line 1.
This comment is hidden because it contains spoiler information about the solution
Check out the
Debug.Trace
module in Haskell for quick and dirty debugging.Would you elaborate?
That seems nonsensical to me. Haskell is lazy, so the
head
function should only evaluate the first element of the list. For example I can write something likehead ([2..] ++ [1])
, and it doesn't seem too slow.Absolutely, don't be too obsessed with one-liners.
The Haskell template has wrong type signature:
lostSheep :: [Int] -> [Int] -> Int
Strange, it still gives me the same error.
Can you check the Haskell tests, please? I get the following error:
test/DuckShootSpec.hs:27:21: error:
• Variable not in scope:
sub :: Char -> Char -> Integer -> String -> String
Thanks.
Are you sure? I still get the same error.
I think there is a problem with the random test in Haskell. I get the following error:
Falsifiable (after 8 tests and 5 shrinks):
[0,1,1]
But the problem states there will be only even length lists. Can you confim this?
Loading more items...