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

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

> Al Getz wrote:
> > 
> > ? 1={}
> > 
> > could there really be any interpretation other than to compare
> > every element of the sequence with the atom '1' ?
While I get the distinct feeling I am being trolled here, the obvious answer is
YES!

Clearly, ? 1={} *should* print FALSE

It is what any rational being not previously infected with the flawed concept of
implicit sequence ops would expect. [NB I said implicit.]

Clearly, ? sq_eq(1,{}) should [erm, might] print {}

Obviously, there is need for "deep compare", but I have said before and I will
say again, such need is *very* rare, and more often than not downright confusing
given it would be a different "=" to the 99 above and the 99 below.

> > In this example,
> > 
> > ? 1={1,2,3}
> > 
<snip>
> > A single number like 1 or 0 would not indicate anything useful

<again feeling like I just got trolled>
<i>Au contraire</i>, I consider true and false rather useful!
</again feeling like I just got trolled>

Pop question (for as-is behaviour): 
?{2, {2}, {2}, {{2}}, {{2}}, {{2,2}}, {{2,2}}}=
 {3,  3,  {3}, {3},   {{3}}, {3},     {{3,3}}}

Without checking, write down the theoretically expected output, and/or note any
elements which will trigger the "sequence lengths not the same" error.
I wonder how many will get that 100% right, not many I'll wager. [see PS]

Were I to replace all 3 with 2, I am equally (groan) sure I or someone else
might find good use for a {1,0,1,0,1,0,1} result, ie compare to depth 1.

Jason Gade wrote:
> 
> 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.
The compare() docs state atoms are deemed less than sequences, works for me.

Regards,
Pete
PS OK, the pop question may recurr at a later date "what does sq_eq()" do? But a
core operator such as "=" should deliver one obvious answer and not, as some
fools propose, vary between "if" and "assign" use, like "and" and "or" do, where
this thread all started. (Keep the semantics clean.)

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

Search



Quick Links

User menu

Not signed in.

Misc Menu