Subject: string comparisons, was: Maxima 5.21.1 release
From: Stavros Macrakis
Date: Mon, 26 Apr 2010 19:34:50 -0400
On Mon, Apr 26, 2010 at 19:12, Richard Fateman <fateman at cs.berkeley.edu>wrote:
...If you overload ">" to apply to strings, it seems to me that you should
> require
> that each of the arguments be a string.
>
Agreed.
> Also, string>, etc. returns a number, related to the location in the
> strings where the order is established.
>
That's cute functionality for programmers, but seems like overkill for
Maxima. is("a"<"b") of course returns a boolean, which is all a Maxima user
will normally need.
> Comparing strings with symbols (symbol names) may possibly make sense,
That would make sense if it was a string-valued symbol (so that I could say
assume(x<"foo",y<x); is(y<"foo") ) -- but should certainly not compare the
*name* of the symbol to the string.
> but comparing complex numbers
> (an UNORDERED field) strikes me as (mathematically) batty, even if you can
> make up something to write into
> a program. There are programs that provide an order for symbolic
> expressions. The underlying
> lisp program can even be called as ?great(a,b) .
>
Agreed.
-s
> RJF
>
>
>
> Robert Dodier 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
>> _______________________________________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
>>
>>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>