Error comparing strings



On Sunday 07 September 2008 20:25:31 Richard Hennessy wrote:
> (%i1) is("John">"Barry");
> Maxima encountered a Lisp error: Error in PROGN [or a callee]:
> Caught fatal error [memory may be damaged]
> Automatically continuing.
> To reenable the Lisp debugger set *debugger-hook* to nil.
>
> (%i2) build_info()$
> Maxima version: 5.16.3
> Maxima build date: 22:48 8/24/2008
> host type: i686-pc-mingw32lisp-implementation-type: GNU Common Lisp
> (GCL) lisp-implementation-version: GCL 2.6.8
>
> Is this a bug or is it illegal to try to compare strings this way?

I think that

  is ("a" < "b")  =>  unknown

is intended. Of course, not a "fatal error".

Try something like

  (defun $strcmp (a b)
      (cond
          ((string< a b) -1)
          ((string= a b) 0)
          (t 1)))

-- 
Setting Orange, Bureaucracy 31, 3174 YOLD
Alexey Beshenov http://beshenov.ru/