-7891910.6360572055 seems to be the correct result. Have you changed the order of operations anywhere (even addition isn't associative for floating point numbers) or used Float instead of Double? If not, post your code here flagged as a spoiler.

It can't. It's a pure C solution, requiring the minimal possible operations to get the expected result, and is optimized to do the mapping after the filtering but before the expansion step. Your solution, on the other hand (idk whether you were referring to it as faster but still), is 10 times slower in the worst case (no spaces), and hundreds of times slower in the best case (only spaces).

It's hard to judge actual speed of python based on theoretical time complexity, it varies a lot depending on user implementation and the internal C implementation of that code. For example, a, b = min(list), max(list) is usually a bit faster than iterating once with a for loop. Your solution is about 4-5x slower, from my tests at least.

This is almost the same as Python, except the list size is from 1 to 50 instead of 5 to 50 - I hope that's okay.
If not, I can fix it with some nitty gritty <$> and <*> stuff. (I learned that from some of your translations. Clever, but useful. Took me a while to get the hang of it tho.)

You're using the default random generator, which is a bit simplistic for this kata. Could you try to generate something more approaching normal text, like the random generators in JS ( the original ) and Python ( which you solved ) do?

I took another look at it today and appears that indeed my negation parsing was not binding tightly enough! Thanks for the help.

`-7891910.6360572055`

seems to be the correct result. Have you changed the order of operations anywhere (even addition isn't associative for floating point numbers) or used`Float`

instead of`Double`

? If not, post your code here flagged as a spoiler.This comment is hidden because it contains spoiler information about the solution

Nice! So clean

It can't. It's a pure C solution, requiring the minimal possible operations to get the expected result, and is optimized to do the mapping after the filtering but before the expansion step. Your solution, on the other hand (idk whether you were referring to

itas faster but still), is 10 times slower in the worst case (no spaces), and hundreds of times slower in the best case (only spaces).It's hard to judge actual speed of python based on theoretical time complexity, it varies a lot depending on user implementation and the internal C implementation of that code. For example, a, b = min(list), max(list) is usually a bit faster than iterating once with a for loop. Your solution is about 4-5x slower, from my tests at least.

Or just look at the source of

`ListOf1`

and write`ListOf5`

. I've done that for`ListOf2`

once, I think.But

`1`

to`50`

will do nicely.( Shouldn't you be implementing

`concat`

somewhere? I just realised that if you have`foldr`

, you can have`concat`

. Just Hoogle it. :)https://www.codewars.com/kumite/5da2629de0aad70026c7291a?sel=5da27e8a8b5fcc99f2a4852b

This is almost the same as Python, except the list size is from 1 to 50 instead of 5 to 50 - I hope that's okay.

If not, I can fix it with some nitty gritty

`<$>`

and`<*>`

stuff. (I learned that from some of your translations.Clever, but useful. Took me a while to get the hang of it tho.)You're using the default random generator, which is a bit simplistic for this kata. Could you try to generate something more approaching normal text, like the random generators in JS ( the original ) and Python ( which you solved ) do?

Haskell translation!

(.) = flip ($)

Fusion probably saves you. But if you want to know if a list has length

`0`

or`1`

, walking the whole list with`length`

is not the Best Practice way.Ok, here it is with tuples: https://www.codewars.com/kumite/5d74fa8660f1c80016f18068?sel=5d750ade7bf8d0002a293c29

OK, IDK who approved the previous fork, but IMO the arguments should be tuples.

## Loading more items...