[Haskell-cafe] let and fixed point operator

Ketil Malde ketil at ii.uib.no
Thu Aug 30 12:38:01 EDT 2007


On Thu, 2007-08-30 at 18:17 +0200, Peter Hercek wrote:

> I find the feature that the construct "let x = f x in expr"
>   assigns fixed point of f to x annoying. 

Any alternative?  Non-recursive assignments?

> f x =
>    let x = x * scale in
>    let x = x + transform in
>    g x

I think it is often it is better to avoid temporary names.  I guess this
is a simplified example, but I think it is better to write:

  f x = g (transform + scale * x)

Or even use point-free style to avoid fixpoint?

   f = g . (+transform) . (* scale)

-k




More information about the Haskell-Cafe mailing list