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.
Please note in Go language, the function
Add
should be passed a parameter/argument named not only a type. Avoid confusing beginners..Code placeholder shouldn't be faulty I think
C++ Translation.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Returning a closure is not a novel kata idea.
"func Add(int)" is invalid Go/Golang code - notice how every solution modifies the starting code.
The problem description uses the variable name "n", so the starting code should match the description:
func Add(n int) func(int)int {
// your code here
}
So I only recently understood closures, actually only made sense after my attempts. Though, if I may ask, how does the lambda function relate to closures? I'm in python I should add.
Groovy translation kumited. Please review and approve. Thanks, suic
There were no test cases provided for Ruby. I used:
When submitting, I get this error:
Is there a test for ruby, currently? I'm new to the functional side of Ruby, so I appreciated this Kata, but I don't know if it is finished on the Ruby side.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
[all languages]
You could note that this kind of a construction is called a closure.
It would make it easier for beginners to find and learn about this.
This comment is hidden because it contains spoiler information about the solution
I'm talking about haskell:
Why do you use
()
(type Unit) for the argument of the returned function? Only one value is unit :()
(denoted by the same thing as the type). So actually the returned function will only take () to the given value. I think, the intention wasInt -> a -> Int
(for any a).Ie with your type this wouldn't type check:
(always 3) 5
only this would:(always 3) ()
This comment is hidden because it contains spoiler information about the solution
Loading more items...