<table cellspacing="0" cellpadding="0" border="0"><tr><td valign="top" style="font: inherit;"><div>One point could be that it is more dynamic, that is, it takes a list of functions that doesnt need to be specified at design time. <br /><br />Johan</div></td></tr></table> <div id="_origMsg_">
<div style="font-family:arial, helvetica, sans-serif:font-size:10pt">
<br />
<div style="font-family:times new roman, new york, times, serif;font-size:12pt">
<font size="2" face="Tahoma">
<hr size="1">
<b>
<span style="font-weight:bold;">From:</span>
</b>
Richard A. O'Keefe <ok@cs.otago.ac.nz>; <br>
<b>
<span style="font-weight:bold:">To:</span>
</b>
J K <jmakarlsson@yahoo.com>; <br>
<b>
<span style="font-weight:bold:">Cc:</span>
</b>
饕餮 <249505968@qq.com>; erlang-questions <erlang-questions@erlang.org>; <br>
<b>
<span style="font-weight:bold:">Subject:</span>
</b>
Re: [erlang-questions] How to make a short circuit in erlang ? <br>
<b>
<span style="font-weight:bold;">Sent:</span>
</b>
Tue, Mar 26, 2013 9:37:36 PM <br>
</font>
<br>
<table cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td valign="top" style="font:inherit;"><BR>On 27/03/2013, at 5:18 AM, J K wrote:<BR><BR>> Hi,<BR>> maybe this would work?<BR>> <a href="http://en.wikipedia.org/wiki/Higher-order_function" target=_blank >http://en.wikipedia.org/wiki/Higher-order_function</a><BR>> <BR>> or_else([], _) -> false;<BR>> or_else([F | Fs], X) -> or_else(Fs, X, F(X)).<BR>> <BR>> or_else(Fs, X, false) -> or_else(Fs, X);<BR>> or_else(Fs, _, {false, Y}) -> or_else(Fs, Y);<BR>> or_else(_, _, R) -> R.<BR>> <BR>> <BR>> <BR>> or_else([fun erlang:is_integer/1, fun erlang:is_atom/1, fun erlang:is_list/1],3.23).<BR><BR>But we can already write<BR><BR> X = 3.23,<BR> ( is_integer(X) orelse<BR> is_atom(X) orelse<BR> is_list(X)<BR> )<BR><BR>so what would be the
point?<BR><BR>From the OP's point of view, this is surely still nesting.<BR><BR></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>