Thanks Doug and Jachym.<br><br>Jachym is right, Doug's suggestion would work if the guard was inside my function rather than at a top level context. I know that I could rewrite my code and convert it to a bunch of if statements, but I can't think of a way to write such code without it looking ugly.<br>
<br>Being able to use a function with a guard seems like it would be the most elegant solution.<br><br>Any suggestions?<br clear="all"><br>Cheers,<br>/Fuad
<br><br><div class="gmail_quote">On Fri, Jun 13, 2008 at 8:35 PM, Jachym Holecek <<a href="mailto:jachym.holecek@e-fractal.cz">jachym.holecek@e-fractal.cz</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Fri, 13 Jun 2008 08:25:29 +0200, Doug Edmunds <<a href="mailto:dougedmunds@gmail.com" target="_blank">dougedmunds@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
check out the discussion on<br>
<a href="http://wrongnotes.blogspot.com/2007/09/little-erlang.html" target="_blank">http://wrongnotes.blogspot.com/2007/09/little-erlang.html</a><br>
<br>
"The solution is to call the function and store it in a<br>
variable before we use it in the guard conditions."<br>
</blockquote>
<br></div>
Yes, but it's a solution to the particular case you hit<br>
working with if/case/fun; not to the general inability<br>
to use custom functions in guards.<br>
<br>
Clearly, you can't "store it in a variable" when you're<br>
at toplevel context (which is what Fuad has been asking<br>
about) or when the object you'd like to inspect comes<br>
from the pattern immediately preceding the guard.<br><font color="#888888">
<br>
-- Jachym<br>
<br>
</font></blockquote></div><br>