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.
rejecting as C does not have closures, and this makes the task inherently impure :(
moreover, only one instance could work at a time.
rejecting because C does not have closures, and therefore the task cannot be solved without side-effects.
looks like it was rejected
I am rejecting this as C does not support closures and the other languages no longer allow solutions that use global/static variables. A C version of this kata would be too different from the other translations.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I have an assumption that a compiler is likely to optimize the calls to sqrt by making the result a variable in the compiled program anyway. I heard it similarly does this with repeated strlen calls. While it would be good practice to tell the compiler to do that explicitly, it's unlikely to matter in the end anyway, right? And that's besides the question of whether this solution is meant as a code golf solution. Since best practice and code golf are often the antithesis of eachother.
I didn't know about counter but now I do. Thanks for sharing your brilliant solution!
using static variables for sneaking in dynamic state seems like a poor pattern to use
maybe this could pass a
this-like struct pointer to the abc() function?could you use a macro to generate function abc?
otherwise, c++ has capturing closures
This comment is hidden because it contains spoiler information about the solution
Fixed
fixed by mauro-chabby combo
Good that you wrote it. I had the same problem :D
1 -> 2 -> 3 -> None should equal 1 -> 2 -> 3 -> None0 -> 1 -> 4 -> 9 -> 16 -> None should equal 0 -> 1 -> 4 -> 9 -> 16 -> NoneOh data type was str, not int -> error message is a bit obscure
Loading more items...