[erlang-questions] (newbie) Using Functions as Guards in Erlang
Fri Jun 13 10:35:34 CEST 2008
On Fri, 13 Jun 2008 08:25:29 +0200, Doug Edmunds <>
> check out the discussion on
> "The solution is to call the function and store it in a
> variable before we use it in the guard conditions."
Yes, but it's a solution to the particular case you hit
working with if/case/fun; not to the general inability
to use custom functions in guards.
Clearly, you can't "store it in a variable" when you're
at toplevel context (which is what Fuad has been asking
about) or when the object you'd like to inspect comes
from the pattern immediately preceding the guard.
More information about the erlang-questions