Re: How Come This Binary Op Doesn't Work?

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

c.k.lester wrote:
> 
> }}}
<eucode>sequence temp
> integer bool
> 
> temp = {}
> 
> bool = atom(temp) and temp = 1</eucode>
{{{

> 
> bool keeps getting set to an empty sequence, not 0.
> 
> What's up with that?!?!
{} = <any atom> will always yield {}.
<any atom> and {} falls foul of the short circuiting in Eu.
Within an if expression it will yield false if the LHS is false,
but in an assignment it will always yield {}.
This is standard sequence op behaviour.
What you probably need to do is:
bool=False
if atom(temp) and temp=1 then
   bool=True
end if


One of the many reasons I never liked sequence ops.

Regards,
Pete

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

Search



Quick Links

User menu

Not signed in.

Misc Menu