From: danb on
I defined a macro (WHILE) before using it in the same file, but
ACL didn't seem to register its existence during compilation:

;;; Compiling file /usr/home/dan/progg/lib/cl/standard.lisp
Error: attempt to call `WHILE' which is an undefined function.
[condition type: UNDEFINED-FUNCTION]

I just loaded the code into sbcl, and it runs fine. The source file
(uploaded immediately after the error occured) is here:
http://www.prairienet.org/~dsb/mycode/cl/lib/standard.lisp

and the following *may* be all the relevant code, except acl didn't
say what line it errored on. According to emacs (Ctrl-x < Ctrl-s),
the first occurance of WHILE is in the MACX form that defines it,
and the first call is in the definition of DEF.

(defmacro xport (&rest symbols)
`(eval-when (:load-toplevel :execute) (export ',symbols)))

(defmacro macx (macro args &body body)
`(progn
(defmacro ,macro ,args ,@body)
(xport ,macro)))

(macx while (test &body body) `(loop (unless ,test (return)) ,@body))

(macx def (func args &body defn)
(let (preamble (body defn))
(when (listp body)
(when (stringp (car body)) (push (pop body) preamble))
(while (and (listp (car body))
(eq (caar body) 'declare)) (push (pop body) preamble)))
...

--Dan

------------------------------------------------
Dan Bensen http://www.prairienet.org/~dsb/

cl-match: expressive pattern matching in Lisp
http://common-lisp.net/project/cl-match/
From: karsten on
Hello,
don't now why you don't see it, but the acl complains about the form
(defx gensyms (n) (loop repeat n collect (gensym)))
stating:
attempt to call `STANDARD::WHILE' which is an undefined function.
[Condition of type UNDEFINED-FUNCTION]

You omitted the defpackage for standard, i assume it is like
(defpackage :standard
(:use :cl))

The interpreter is fine with the code, did you simply tried load?

Doing the following seems to make allegro happy too
(defmacro macx (macro args &body body)
`(eval-when (:compile-toplevel :load-toplevel :execute)
(defmacro ,macro ,args ,@body)
(xport ,macro)))

But what are you trying to do, is that another arc in lisp?

Karsten

From: Marco Antoniotti on
On May 7, 8:12 pm, danb <sogwal...(a)gmail.com> wrote:
> I defined a macro (WHILE) before using it in the same file,

Why did you define such an utterly useless macro?

Cheers
--
Marco













but
> ACL didn't seem to register its existence during compilation:
>
> ;;; Compiling file /usr/home/dan/progg/lib/cl/standard.lisp
> Error: attempt to call `WHILE' which is an undefined function.
>   [condition type: UNDEFINED-FUNCTION]
>
> I just loaded the code into sbcl, and it runs fine.  The source file
> (uploaded immediately after the error occured) is here:http://www.prairienet.org/~dsb/mycode/cl/lib/standard.lisp
>
> and the following *may* be all the relevant code, except acl didn't
> say what line it errored on.  According to emacs (Ctrl-x < Ctrl-s),
> the first occurance of WHILE is in the MACX form that defines it,
> and the first call is in the definition of DEF.
>
> (defmacro xport (&rest symbols)
>   `(eval-when (:load-toplevel :execute) (export ',symbols)))
>
> (defmacro macx (macro args &body body)
>   `(progn
>     (defmacro ,macro ,args ,@body)
>     (xport ,macro)))
>
> (macx while (test &body body) `(loop (unless ,test (return)) ,@body))
>
> (macx def (func args &body defn)
>   (let (preamble (body defn))
>     (when (listp body)
>       (when (stringp (car body)) (push (pop body) preamble))
>       (while (and (listp (car body))
>                   (eq (caar body) 'declare)) (push (pop body) preamble)))
>         ...
>
> --Dan
>
> ------------------------------------------------
> Dan Bensen  http://www.prairienet.org/~dsb/
>
> cl-match:  expressive pattern matching in Lisphttp://common-lisp.net/project/cl-match/