Hi.<br><br>I saw something strange about SLIME and tried googling about it. But couldn't find any clues.<br>Please allow me to post here.<br><br>I read "Let Over Lambda", a book about macros, and noticed function, named with "!", on a file couldn't be recognized nor compiled through using SLIME.<br>
<br>The codes are listed below, using some utilities from the book "On Lisp", written by Paul Graham.<br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">
;; *-SIMBOL-P-GENERATOR<br>;; (defmacro *-symbol-p-generator (str)<br>;; (let ((len (1+ (length str)))<br>;; (init-part (string-upcase str)))<br>;; `(defun ,(intern (concatenate 'string init-part "-SYMBOL-P")) (s)<br>
;; (and (symbolp s)<br>;; (> (length (symbol-name s)) ,len)<br>;; (string= (symbol-name s)<br>;; ,init-part<br>;; :start1 0<br>;; :end1 ,len)))))<br><br>;; G-BANG-SYMBOL-PREDICATE<br>
;; (*-symbol-p-generator "g!")<br><br>(defun g!-symbol-p (s)<br> (and (symbolp s)<br> (> (length (symbol-name s)) 2)<br> (string= (symbol-name s)<br> "G!"<br> :start1 0<br>
:end1 2)))<br><br>;; DEFMACRO-WITH-G-BANG!<br>(defmacro defmacro/g! (name args &body body)<br> (let ((syms (remove-duplicates<br> (remove-if-not #'g!-symbol-p<br> (flatten body)))))<br>
`(defmacro ,name ,args<br> (let ,(mapcar<br> (lambda (s)<br> `(,s (gensym ,(subseq<br> (symbol-name s)<br> 2))))<br> syms)<br> ,@body))))<br><br>;; ONCE-ONLY<br>
(defmacro once-only ((&rest names) &body body)<br> (let ((gensyms (loop for n in names collect (gensym))))<br> `(let (,@(loop for g in gensyms collect `(,g (gensym))))<br> `(let (,,@(loop for g in gensyms for n in names collect ``(,,g ,,n)))<br>
,(let (,@(loop for n in names for g in gensyms collect `(,n ,g)))<br> ,@body)))))<br><br>;; O-BANG-SYMBOLS<br>;; (*-symbol-p-generator "o!")<br><br>(defun o!-symbol-p (s)<br> (and (symbolp s)<br> (> (length (symbol-name s)) 2)<br>
(string= (symbol-name s)<br> "O!"<br> :start1 0<br> :end1 2)))<br><br>(defun o!-symbol-to-g!-symbol (s)<br> (symb "G!"<br> (subseq (symbol-name s) 2)))<br><br>;; DEFMACRO-BANG<br>
(defmacro defmacro! (name args &body body)<br> (let ((os (remove-if-not #'o!-symbol-p args)))<br> (let ((gs (mapcar #'o!-symbol-to-g!-symbol os)))<br> `(defmacro/g! ,name ,args<br> `(let ,(mapcar #'list `(,,@gs) `(,,@os))<br>
,(progn ,@body))))))<br><br>;; NIF<br>(defmacro! nif (o!expr pos zero neg)<br> `(cond ((plusp ,g!expr) ,pos)<br> ((zerop ,g!expr) ,zero)<br> (t ,neg)))<br></blockquote><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">
<div> </div></blockquote><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">;;; This is the end of file<br clear="all"></blockquote><div> </div>
C-c C-k shows such a message below.<br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">; in: DEFMACRO! NIF<br>; (DEFMACRO! NIF (O!EXPR POS ZERO NEG)<br>
; `(COND ((PLUSP ,G!EXPR) ,POS) ((ZEROP ,G!EXPR) ,ZERO) (T ,NEG)))<br>; <br>; caught ERROR:<br>; (during macroexpansion of (DEFMACRO! NIF ...))<br>; The function O!-SYMBOL-P is undefined.<br>; <br>; compilation unit finished<br>
; caught 1 ERROR condition<br><br>; /home/cametan/lol.chapter_2.fasl written<br>; compilation finished in 0:00:00.091<br></blockquote><div><br>Strange. The function O!-SYMBOL-P was THERE on the file.<br><br>So I check sbcl repl directly on my bash; in that case, the file could be loaded and compiled without any problem.<br>
Therefore, SLIME must have the problem.<br><br>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.<br><br>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 "!"<br>
are not recognized by SLIME.<br><br>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).<br><br>Here are my lines about SLIME on my .emacs<br>
<br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">;;=======================================================================<br>;; SLIME<br>
;;=======================================================================<br>(setq inferior-lisp-program "/usr/bin/sbcl")<br>(add-to-load-path-recompile<br> (expand-file-name "~/slime"))<br>(add-hook 'lisp-mode-hook (lambda ()<br>
(inferior-slime-mode t)<br> (global-set-key "\C-cH" 'hyperspec-lookup)<br> (push 'ac-source-slime ac-sources)<br> (auto-complete-mode)))<br><br>
(require 'slime)<br><br>(eval-after-load "slime"<br> '(progn<br> (message "Slime configuration...")<br> (slime-setup '(slime-scratch<br> slime-editing-commands<br> slime-fancy<br>
slime-repl<br> slime-asdf<br> anything-slime)))<br> )<br>;;<br></blockquote><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">
<div> (setq slime-net-coding-system 'utf-8-unix<br> ;; inferior-lisp-program "/usr/bin/sbcl"<br> lisp-indent-function 'common-lisp-indent-function<br> slime-complete-symbol*-fancy t<br> slime-complete-symbol-function 'slime-fuzzy-complete-symbol<br>
slime-startup-animation t)<br><br>(slime-autodoc-mode)<br>;;</div></blockquote> <br><br>Thanks<br><br>cametan<br><br>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".<br>
P.S.2. The author of LOL says he hates Emacs. Then, if he spelled and cursed SLIME, I would give all up.<br></div>