Subject: string comparisons, was: Maxima 5.21.1 release
From: Stavros Macrakis
Date: Mon, 26 Apr 2010 11:37:27 -0400
You are saying that is(%i>0)=>false is not a bug?
A related bug is is(%i+1>%i) => true (presumably because (%i+1)-%i = 1 and
1>0)
Allowing logically incorrect comparisons like this leads to nonsense like:
map(lambda([a],sort(a,"<")),permutations([1,2,3,%i])) =>
{[1,2,3,%i],[1,2,%i,3],[1,3,%i,2],[1,%i,2,3],[2,3,%i,1],[%i,1,2,3]}
where not only is the result not unique, but even the comparable elements
are not necessarily in order.
-s
On Mon, Apr 26, 2010 at 11:17, Robert Dodier <robert.dodier at gmail.com>wrote:
> On 4/26/10, Stavros Macrakis <macrakis at gmail.com> wrote:
>
> > As for is("x">0) giving an error, that is perfectly correct -- it is
> > meaningless to compare a string to a number.
>
> Disagreed on this point -- %i and 0 are incomparable but is(%i > 0)
> => false, not an error. By analogy, seems like is("x" > 0) should
> likewise yield false.
>
> > But in fact Maxima's comparison functions (other than = and #) don't even
> > work on strings -- probably they should.
>
> Agreed, < <= >= > should be able to compare strings.
>
> best
>
> Robert Dodier
>