hi all..
the error message only comes up for the first use of function(map)
and it actually gives correct answer...
------------------
Warning: Function called with two arguments, but wants at least three.
(10 2.4 11.6 83)
------------------
(defun map (proc items)
(if (null items)
nil
(cons (funcall proc (car items))
(map proc (cdr items)))))
(map #'abs (list -10 2.4 -11.6 83))
thank you
"eugene kim" <··········@hotmail.com> ha scritto nel messaggio ·················@newsreader.mailgate.org...
> hi all..
>
> the error message only comes up for the first use of function(map)
> and it actually gives correct answer...
> ------------------
> Warning: Function called with two arguments, but wants at least three.
> (10 2.4 11.6 83)
> ------------------
>
> (defun map (proc items)
> (if (null items)
> nil
> (cons (funcall proc (car items))
> (map proc (cdr items)))))
>
> (map #'abs (list -10 2.4 -11.6 83))
Because there's already a system defined function called MAP
and you are redefining it. In your function application (MAP PROC ...)
the compiler thinks that you are calling the system supplied MAP.
P.