Name: Anonymous 2011-09-29 14:54
What should
do?
a ? b = c : b = d do?
a ? b = c : b = d b = a ? c : d;
(set! b (if a c d))
if(a != 0){
b = c;
}else{ //a==0
b = d;
}
?: operator has lower precedence than assignment, so both of the assignments will be executed (in undefined order). Then a will be evaluated and the expression will return the value of b = c if a is non-zero or b = d otherwise. The assignment operator returns what was assigned, so the result of the expression will be either c or d.
b = c*a + d*a;
b = (c*a) + (-d*(a-1))
input b>acd output >x000
if a!=0 x=c
else x=d
[[-]>>[-]<<]>>[<[-]>[-<<<+>>>]]
is_lisp ? shit : !shit;