Comparing Sequences

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

Hello David, Rob, others interested...


>[ The Problem ]
>
>Euphoria allows logical and comparison binary operators to return
>sequences.

David, I am sorry to have to cast yet another vote AGAINST your
idea. I will explain. I am another person that LIKES the fact
that ALL operators work on sequences. I use '=' on sequences
rather often and not just for graphics. I also DISAGREE that
using the '=' to make a transparency effect in an image should
be considered a "trick". I considder it as legitamite as
normal boolean math. But, to get off that subject, I want to
make as suggestion that could easily and sensibly (IMO) resolve
the issue. In fact it is so simple that I'm surprised it hasn't
been suggested by someone selse:

Don't change how the operators work, change how the conditional
statements work. If conditional statements could handle
sequences as boolean values, instead of breaking code it would
allow new code to work. For example:

if "Hello" = "Help!" then

which becomes

if {1,1,1,0,0} then

which becomes

if (1 or 1 or 1 or 0 or 0) then -- notice "or" instead of "and"

which becomes

if 0 then


It makes sense to me. I know there would be a few kinks to work
out of the concept like what if we compare sequences of different
length? But I think that should obviously return false rather
than error out. Also what if we try to use complex sequences?
I think this would have to be Rob's call (not that the rest isn't).
Should only 1 dimensional sequences be allowed in comparisons?
That way we still have a use for equal(). Or should conditional statements
go as far as to always work even if the structure is
different by simply returning zero? And what about this:

if {} = {} then

which becomes

if {} then

Should an empty sequence evaluate to true or false? considdering
the original statement, I would say "true" but what does everyone
else think.

I like this idea, probably because it's my own, but it makes a
lot of sense to me. Sure there will be a few special cases like
the above that would need some deeper discussion to resolve but
I still think it would be MUCH prefered to changing the way that
comparison operators work!

later,
Lewis Townsend
.     __       _____  __    __    __    __    _____
.    /\ \     /\    \|\ \  /\ \  /\ \  /\ \  /\    \
.   /  \_\   /  \____\ \_\/  \_\/  \_\/  \_\/  \____\
.  /   / /  /   / ___/ |  |  / |   / /   / /\  /  __ \
. /   / /  /   / /_\ | |  | /  |  / /   / /\_\/  /_ \/
./   / /\ /   / ___/ | |  |/   | / /   / /\ \ \__  \
.\  / /__\\  / /__\  \ |    /| |/ /\  / /  \/\_\/  /
. \/_____/ \/_____/   \|___/\|___/  \/_/    \_____/
keroltarr at hotmail.com  http://geocities.com/keroltarr/
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at
http://profiles.msn.com.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu