Y-combinator in Erlang

Hakan Millroth hakanm@REDACTED
Wed Jan 8 15:18:27 CET 2003


>   Now  how the  average  Håkan might  have  written it  is a  entirely
> different matter :-)

As a named function. Whatever you gain in expressive power with funs 
you risk losing by people using them in a way that is hard to 
understand.

Classic example. Consider the higher-order function (standard math 
notation):

twice(F)(X) = F(F(X))

Let double(X)=X+X and figure out what F(1) is, where 
F=twice(twice(twice(twice(double)))).

I'm just arguing that sometimes power tools are not good things.

-- Hakan




More information about the erlang-questions mailing list