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)
No edit summary
(→‎Haskell version: Good thought, and a little faster too. (your liftM2 is still the fastest of all))
 
(5 intermediate revisions by 4 users not shown)
Line 1:
= MoB =
 
'''Please sign your posts with <nowiki>--~~~~</nowiki>, as it will make the conversation much easier to follow.''' --[[User:Short Circuit|Short Circuit]] 22:35, 28 March 2008 (MDT)
 
Line 103 ⟶ 105:
Having done some ALGOL programming in the depths of antiquity on a safer version of ALGOL, there are a few things that you need to understand.
* call by value isn't the default you must ask nicely
* procedure call syntax doesn't require () unless you have arguments, hence you can not tell if x is a variable or a function call from looking
* returned values are just assigned to variables representing the function and are subject to scoping conventions
* running with scissors didn't get you any warnings from your Mom
Line 122 ⟶ 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. &mdash;''[[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)
9,655

edits