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

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

Me wrote:

> 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?!?!
> 
> A comparison such as
>    temp = 1
> only works as you'd expect when you are sure that 'temp' is an atom.
> If 'temp' is or might be a sequence, and you also don't want those
> special sequence operations to take place, then use 'equal()' instead
> of '='.
> 
>    bool = atom(temp) and equal(temp,1)
> works fine.
> 
> BTW: This is old news, but it's so easy to forget it. smile

Erm ...
It's not necessary anyway to use
   atom(temp)
here. Just use
   bool = equal(temp, 1)
smile

Regards,
   Juergen

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

Search



Quick Links

User menu

Not signed in.

Misc Menu