Problems with ONEARGCHECK and TWOARGCHECK



Sorry, I did not see that the problem arise because we have no check (for GCL)
for the arguments calling a Lisp function $<function>.

Because I am interested to make the code sure for Maxima Users I have try to
implement the Maxima User function for the Exponential Integrals with defmspec.

The code looks like:

(defmspec $expintegral_ei (l)
  (let ((l (cdr l)))
    (if (= (length l) 1)
      (simplify (list '(%expintegral_ei) (resimplify (car l))))
      (wna-err '$expintegral_ei))))

With this code it works fine and we have a check for the number of args.

The problem with the wrong number of arguments arise in all function which are
directly coded as Lisp functions. Should this be changed like above e. g. for
the Bessel functions or Airy functions to have a more correct and predictable
behaviour of the functions?

Dieter Kaiser

-----Urspr?ngliche Nachricht-----
Von: robert.dodier at gmail.com [mailto:robert.dodier at gmail.com] 
Gesendet: Samstag, 26. Juli 2008 04:00
An: Dieter Kaiser
Cc: maxima at math.utexas.edu
Betreff: Re: [Maxima] Problems with ONEARGCHECK and TWOARGCHECK

On 7/24/08, Dieter Kaiser <drdieterkaiser at web.de> wrote:

>  (%i4) bessel_j(1);
>  (%o4) bessel_j(1, #<compiled-closure 03cd5e38>)

>  (%i7) airy_ai();
>  (NIL . |$;|) is a cons with an atomic cdr - `simplifya'

>  I use gcl 2.6.8 and the Maxiam CVS code on a Windows XP system.

The observed behavior appears to be a bug in GCL.
>From what I can tell, GCL doesn't check the number of arguments
in compiled code. Other Lisp varieties do check, so
airy_ai() and bessel_j() cause errors for them (Clisp, CMUCL,
probably others).

Here's a small example for GCL.

>(defun f (x y) y)

>(f 1)
 => error

>(compile 'f)

>(f 1)
 => #<compiled-function 08473b20>

This last result is incorrect; should be an error.

HTH

Robert Dodier