Re: brain gymnastics

new topic     » goto parent     » topic index » view thread      » older message » newer message

> >    integer i
> >    i = 1
> >    i = -i
> >    i /= i+1             [note a]
> >    +i = +i              [note b]
> >    i *= i-1             [note c]
> >    -i = -i
> >    ? i

integer i
i = 1
i = -1
i = i / ( i + 1 + ( i = +i ) )
i = i * ( ( i -1 ) - (i = -i) )
? i

Does precize the same.

notice: a sign is first considered to be part of a calculating (i.e.
statement contiuator: 3 + 4; 5 - 7) secondly part of the number (i.e.
sign: -3; + 4) ..

notice: self reflecting calculations (such as *=, /=, +=, -=) convert to
this form:
[left] [*/+-]= [right]

[left] = [left] [*/+-] (   [right]   )

Everything on the right is used on the calculation.
So:

 i /= i -1
+i = +i

Converts to:
i = i / ( i -1 + (i = +i) )

And will therefor not crash.
More cynically explained: euphoria can be just as messy as C.

Ralf N.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu