I keep wanting to have python-like boolean expression evaluation, in which a value of nil, 0, an empty list or an empty tuple are considered to be false.<div><br></div><div>It would be great to have a consise way of saying "the value of this expression is expr1 if expr1 evaluates to a non-false value, or expr2 otherwise".</div>
<div><br></div><div>In python, you would say "X = foo() or bar()", which would evaluate foo(), and if that evaluates to one of None,False,0,[],(),{}, then evaluate bar()</div><div><br></div><div>I cant for the life of me figure out what the most concise way of stating that is in erlang.</div>
<div><br></div><div>perhaps</div><div> X = if (T1=foo()) =/= [] -> T1, false -> bar() end</div><div><br></div><div>it would nice to be able to say something like</div><div> X = foo() otherwise bar().<br></div><div><br>
</div><div>or somesuch</div>