Paste number 10119: macro thang

Index of paste annotations: 2 | 1

Paste number 10119: macro thang
Pasted by: morecowbell
When:3 years, 11 months ago
Share:Tweet this! | http://paste.lisp.org/+7T3
Channel:#lisp
Paste contents:
Raw Source | XML | Display As
(defmacro do-file (filename line-buffer &body body)
  (let ((in-stream (gensym)))
    `(with-open-file (,in-stream ,filename :direction :input)
                     (do ((,line-buffer (read-line ,in-stream nil :eof)
                                        (read-line ,in-stream nil :eof)))
                         ((eql ,line-buffer :eof) nil)
                       ,body))))

the macro expansion looks like I expect but when I run it 
sbcl complains: 

"illegal function call (read-line #:G908 nil :eof)"

Sure looks legal to me!

Annotations for this paste:

Annotation number 2: make baby
Pasted by: sexoman
When:2 years, 5 months ago
Share:Tweet this! | http://paste.lisp.org/+7T3#2
Paste contents:
Raw Source | Display As
sex+sex=fast baby

Annotation number 1: 10119
Pasted by: wwk3492
When:2 years, 11 months ago
Share:Tweet this! | http://paste.lisp.org/+7T3#1
Paste contents:
Raw Source | Display As
(defmacro do-file (filename line-buffer &body body)
  (let ((in-stream (gensym)))
    `(with-open-file (,in-stream ,filename :direction :input)
                     (do ((,line-buffer (read-line ,in-stream nil :eof)
                                        (read-line ,in-stream nil :eof)))
                         ((eql ,line-buffer :eof) nil)
                       ,body))))

Colorize as:
Show Line Numbers
Index of paste annotations: 2 | 1

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.