Re: ? 1={}, is there really any other interpretation?

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

Al Getz wrote:
> 
> Hello,
> 
> 
> For the following statement:
> 
> ? 1={}
> 
> could there really be any interpretation other than to compare
> every element of the sequence with the atom '1' ?
> After all, we are not trying to compare what types the two
> arguments are, we are trying to compare all the sequence elements
> to the atom '1'.
> 
> In this example,
> 
> ? 1={1,2,3}
> 
> the number 1 is compared to every element of the sequence, and
> a sequence is returned with the results, and it must be a sequence
> returned in order to show the results.  A single number like 1 or
> 0 would not indicate anything useful, and if we want to know what
> type something is, we have 'atom()' and 'sequence()'.
> 
> 
> Al
> 
> E boa sorte com sua programacao Euphoria!
> 
> 
> My bumper sticker: "I brake for LED's"
> 

I was trying to decide how to respond to this, and I confess that I don't have a
very good answer.

For '=' and '!=' I would prefer to return a boolean determining the actual
equality of the values. I mean, are they the same or not? To compare the equality
of actual sequence elements I would prefer a named function like equal().
Basically, flip the current meaning of the two methods.

With regards to relational operator such as '>' and '<', I don't know how to
define whether an atom is greater than or less than a sequence. That would
require some thought and discussion.

--
"Any programming problem can be solved by adding a level of indirection."
--anonymous
"Any performance problem can be solved by removing a level of indirection."
--M. Haertel
"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare
j.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu