Thank all you guys for the advices.

I see. Macroexpansion before compilation. Then, at that moment, macro-defined couldn't find function-defined...
I never imagined that. I appreciate you all to telling me that.

I will check how to use eval-when. Thank you very much.

Also, C-u RET solves reader macro issue.

Thanks a lot.

cametan

2010/4/30 Helmut Eller <heller@common-lisp.net>
* 亀田馬志 [2010-04-29 16:23+0200] writes:

> C-c C-k shows such a message below.
>
>     ; in: DEFMACRO! NIF
>     ;     (DEFMACRO! NIF (O!EXPR POS ZERO NEG)
>     ;                `(COND ((PLUSP ,G!EXPR) ,POS) ((ZEROP ,G!EXPR) ,ZERO) (T
>     ,NEG)))
>     ;
>     ; caught ERROR:
>     ;   (during macroexpansion of (DEFMACRO! NIF ...))
>     ;   The function O!-SYMBOL-P is undefined.
>     ;
>     ; compilation unit finished
>     ;   caught 1 ERROR condition
>
>     ; /home/cametan/lol.chapter_2.fasl written
>     ; compilation finished in 0:00:00.091
>
> Strange. The function O!-SYMBOL-P was THERE on the file.

Yes, but it's needed "during macroexpansion".  If you only compile
a function you can't call it yet.

You could try to just load it with C-c C-l. Then every toplevel form
is evaluated immediately and available in the following forms.
But there are also other missing function like SYMB and FLATTEN.

> So I check sbcl repl directly on my bash; in that case, the file could be
> loaded and compiled without any problem.
> Therefore, SLIME must have the problem.

If you load it before compiling it you make all definitions available
for macroexpansion.  If you execute (load (compile-file "lol.chatper_2.lisp"))
in a clean session you'll will most likely see the same problem.

> Actually, if I made the function on REPL on SLIME, NO PROBLEM. The problem is
> occured when I made a file, load, and compile THE FILE.
>
> I checked the file, then I found both g!-symbol-p and o!-symbol-to-g!-symbol
> are not recognized by SLIME, either. Then, I concluded functions with "!"
> are not recognized by SLIME.
>
> Is there any solution about that? I use Ubuntu 9.10, SBCL and Emacs 23
> provided by Ubuntu. Also I use cvs version of SLIME(newest).

When you get more experienced you'll recognize that you need EVAL-WHEN in
situations like these.  You will also learn the value of adding an
IN-PACKAGE form at the beginning of a file.

> P.S. I also found SLIME's REPL don't recognized reader macros. Though making
> reader macro with #foo, SLIME says something like "incomplete input".

Well, yes, SLIME assumes that you want to enter Lisp syntax not some
random character noise.  C-u RET will accept the current input anyway
even if it doesn't look like a complete form.

Helmut


_______________________________________________
slime-devel site list
slime-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/slime-devel



--
  亀田馬志
Masahi Kameda