[Haskell-cafe] Line noise

Jon Harrop jon at ffconsultancy.com
Sun Dec 21 03:54:49 EST 2008


On Tuesday 23 September 2008 02:27:17 Brian Hurt wrote:
> On Sun, 21 Sep 2008, wren ng thornton wrote:
> > Even with functionalists ---of the OCaml and SML ilk---
> > this use of spaces can be confusing if noone explains that function
> > application binds tighter than all operators.
>
> Bwuh?  Ocaml programmers certainly know that application binds tighter
> than operators.  And as:
>
>  	let f x y = ... in
>  	f a b
>
> is more efficient (in Ocaml) than:
>
>  	let f (x, y) = ... in
>  	f (a, b)
>
> (Ocaml doesn't optimize away the tuple allocation)...

That is incorrect. OCaml does optimize away that tuple: both forms compile to 
the same 2-argument function.

OCaml does not optimize away this tuple:

  let a, b = 1, 2

So, when efficiency is important, you write:

  let a = 1 and b = 2

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e


More information about the Haskell-Cafe mailing list