Doubt about funs

Martin Bjorklund <>
Wed Feb 21 23:23:06 CET 2001


Chris Pressey <> wrote:

> Here's the interesting question, though.  How would one go about making
> a tail-recursive (anonymous) fun anyway?  It can't call itself, because
> it doesn't have a name  :-)

You'd have to do something along these lines:

g() ->
  F = fun(G) ->
         io:format("looping forever\n"),
         G(G)
      end,
  F(F).


/martin



More information about the erlang-questions mailing list