[erlang-questions] Newbie: Is there a short-circuit for the comma operator?
KatolaZ
me@REDACTED
Wed Oct 10 08:54:07 CEST 2007
On Wed, Oct 10, 2007 at 07:14:11PM +1300, James Cone wrote:
>
> Is there an operator or function that short-circuits the comma operator,
> so if exp1 uses it, exp2 will not be evaluated?
>
> eg (supposing it's called return, which is the name of the equivalent
> operator in C)
>
> > if 1==0 -> -1; true -> return 0 end, 1.
> 1
> >
>
> I want this because I have a function with some deeply nested tests, and
> I want to tail-recurse from only some of the cases, without copying all
> of the following expressions (after a comma operator) into all of the
> other cases.
>
> Am I making sense? Does such a thing exist?
>
Such an operator does not exist in erlang. And I've never needed it
:-) You should perhaps rewrite your code better. Paste it, and let's
see where we can help.
HND
Enzo
--
[ Enzo Nicosia aka KatolaZ --- GLUG Catania -- Freaknet Medialab ]
[ me [at] katolaz.homeunix.net -- http://katolaz.homeunix.net -- ]
[ GNU/Linux User:#325780/ICQ UIN: #258332181/GPG key ID 0B5F062F ]
[ Fingerprint: 8E59 D6AA 445E FDB4 A153 3D5A 5F20 B3AE 0B5F 062F ]
More information about the erlang-questions
mailing list