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.
Use spoiler flag next time please. Your post was visible in the homepage.
This comment is hidden because it contains spoiler information about the solution
New to Haskell, how does this work?
nice
Quesion is, why are the bad solutions voted best practice while this one is the best practice?
Can anyone explain why this solution was voted best practice vs other solutions voted best practice? I think its a clever solution for sure though.
@Unnamed, @Blind4Basics: There is a Guido's article about List Comprehensions and Generator Expressions advantages - http://python-history.blogspot.com/2010/06/from-list-comprehensions-to-generator.html
But yeah, it's more about comparison between LCs and (map with lambda). Thanks for correcting me
@Rishat Nuriev:
see the fork: no meaningful difference between the three versions (500 tests on one input of size 500x500). The 3 versions perform about the same. Sometimes one is faster than the others, but not always the same one. You'd need something far more precise to actually see any consistent difference.
@Unnamed: you don't use lambda in there, so no overhead on this side (which is often what is slowing this kind of approach, I believe).
2 Usually true.
1 Who told you that? I know Python folks don't like lambdas, but I haven't heard anything about
map
. One function call is easier to read than an expression where a new variable is introduced for no reason.It seems like I've solved this kata similarly. But I like your precedence check (refactoring is better than mine, for example, when one needs a new operator). Although in the
work
function you could remove all theread
s and only add numbers to your accumulator (the last pattern should, of course, containread
).Counter example: "A4" "A5"
"halvingSum 0 = 0" makes 1 more iteration over "halvingSum 1 = 1" I believe. Becuase "n" is positive in this case.
It is not so important but still.
"/" operator does not return Integer type, and function wants Integer
This comment is hidden because it contains spoiler information about the solution
Loading more items...