Talk:Man or boy test: Difference between revisions
→Haskell version: Good thought, and a little faster too. (your liftM2 is still the fastest of all)
(→Haskell version: Good thought, and a little faster too. (your liftM2 is still the fastest of all)) |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 124:
[[User:Dgamey|Dgamey]] 03:25, 6 May 2010 (UTC)-
==Haskell version==
: Perhaps skip the Control.Monad import by using an applicative alternative to liftM2 ?
:: liftM2 (+) x4 x5 is equivalent to pure (+) <*> x4 <*> x5
: [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 00:08, 14 March 2017 (UTC)
:: Tho in fact I notice that the applicative reformulation seems to run a little slower … [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 00:17, 14 March 2017 (UTC)
::: What about:
:::: <code>(+) <$> x4 <*> x5</code>
::: Not sure if that's more readable than the <code>liftM2</code> version, but arguably more idiomatic nowadays. —''[[User:Ruud Koot|Ruud]]'' 08:42, 14 March 2017 (UTC)
:::: Good thought, and a little faster too. Perhaps your first instinct is right though ? liftM2 is not unreadable, and still seems to be the fastest of the three. [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 11:53, 14 March 2017 (UTC)
|