another simple defmacro question
From: bufie (bufie_at_spamneggs.com)
Date: 08/28/04
- Next message: bufie: "Re: using defmacro to "wrap" a function"
- Previous message: Barry Margolin: "Re: Request for comments on CLOS code"
- Next in thread: bufie: "Re: another simple defmacro question"
- Reply: bufie: "Re: another simple defmacro question"
- Reply: Jeff: "Re: another simple defmacro question"
- Reply: Barry Margolin: "Re: another simple defmacro question"
- Reply: Peter Lewerin: "Re: another simple defmacro question"
- Reply: Joost Kremers: "Re: another simple defmacro question"
- Reply: Pascal Costanza: "Re: another simple defmacro question"
- Reply: Thomas A. Russ: "Re: another simple defmacro question"
- Reply: Thomas A. Russ: "Re: another simple defmacro question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 28 Aug 2004 02:54:10 GMT
Hi again,
I know I'm missing something simple here, but I've tried a bunch of stuff
and it just doesn't work...
My application needs to read a list of constants at compile time from a
file. I came up with this macro:
(defmacro my-file-to-string-list (fname)
(let ((stringlist)
(tmpstr))
(with-open-file (infile fname :direction :input)
(loop
(setq tmpstr (read-line infile nil nil))
(unless tmpstr
(return))
(push tmpstr stringlist)
))
(setq stringlist (nreverse stringlist))
stringlist
))
When I call this using
(setq mystrings (my-file-to-string-list myfilename))
I get an error that the first line of the file is invalid as a function
(it's apparently considering the opening paren of the list as a function
call). I know there must be something simple here (if I change the defmacro
to defun it will work, but doesn't get evaluated at load time or compile
time), and I think I've solved this (or seen it solved) before, but I'm just
not seeing it this time...
help, please!
thanks!
bufie
- Next message: bufie: "Re: using defmacro to "wrap" a function"
- Previous message: Barry Margolin: "Re: Request for comments on CLOS code"
- Next in thread: bufie: "Re: another simple defmacro question"
- Reply: bufie: "Re: another simple defmacro question"
- Reply: Jeff: "Re: another simple defmacro question"
- Reply: Barry Margolin: "Re: another simple defmacro question"
- Reply: Peter Lewerin: "Re: another simple defmacro question"
- Reply: Joost Kremers: "Re: another simple defmacro question"
- Reply: Pascal Costanza: "Re: another simple defmacro question"
- Reply: Thomas A. Russ: "Re: another simple defmacro question"
- Reply: Thomas A. Russ: "Re: another simple defmacro question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|