[Haskell-cafe] let and fixed point operator

Albert Y. C. Lai trebla at vex.net
Thu Aug 30 15:11:51 EDT 2007

Peter Hercek wrote:
> So the question is what am I missing? Any nice use cases where
>  fixed point search is so good that it is worth the trouble with
>  figuring out new and new variable names for essentially the same
>  stuff?

When I write functional code, I do find myself writing recursions much 
more often than writing imperative-wannabe assignments. I appreciate 
that Haskell's "let" defaults to recursion. I don't appreciate that 
OCaml makes a distinction between "let" and "letrec", since every time I 
change a non-recursive definition to a recursive one, I am prone to 
forget to change "let" to "letrec", IOW it is a hidden hazard to 
maintenance and evolution.

When I write imperative code in Haskell, the notation is so different 
from functional code that "let" doesn't even come into the equation.

When I write imperative code in imperative languages, my mental model 
treats "x:=x+1" as "x'=x+1 and y'=y and z'=z and ...", following several 
treatises on imperative semantics(*). Going back to functional 
programming, when I do write imperative-wannabe assignments, I totally 
like having names x, x', x'', etc., since they're in my head anyway.

Underlying all this is probably the soberness of recognizing that "=" is 
not ":=".

(*) Such as:

Eric C. R. Hehner, "A Practical Theory of Programming". First edition 
Springer 1993. Current edition at

C. A. R. Hoare and He Jifeng, "Unifying Theories of Programming". 
Prentice Hall 1998.

The Z specification language.

More information about the Haskell-Cafe mailing list