Re: How Come This Binary Op Doesn't Work?
- Posted by Juergen Luethje <j.lue at gmx?de> Jul 14, 2007
- 564 views
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. Erm ... It's not necessary anyway to use atom(temp) here. Just use bool = equal(temp, 1) Regards, Juergen