[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: APPLYing FORMAT



This works fine for me. Could you please include exactly which 
expression causes the error, and could you be more specific about
what the "interesting error message" is?

I think you will also find your code easier to read by following
some traditional lisp indentation style. In MCL you can type <tab>
to indent any given line, or type <ctrl-meta-q> to reformat a whole
lisp expression (click on on of its parentheses first).

I personally prefer to glom up my close-parentheses (see below)
to save space. I know some folks leave naked close-parens on 
their own line to emphasize which ones correspond. But this isn't 
really necessary with editors which are lisp-savvy (like Fred).
With auto-indenting, and the ability to blink matching parens,
the extent of an expression is usually pretty clear.

steve
-------------
; formatted the traditional way:
;
(defun user-log (string &rest args)
  "Formats the string and args to a User Log file."
  (format t "Calling user-log with ~S ~S~%" string args)
  (with-open-file (stream "User Log"
                          :direction :output
                          :if-exists :append
                          :if-does-not-exist :create)
    (format t "~S~%" stream)
    (apply #'format stream string args))
  (format t "Finishing user-log~%"))

--------
Date: Tue, 7 Jan 1992 12:15:28 -0600
To: info-macl@cambridge.apple.com
From: lynch@aristotle.ils.nwu.edu
Subject: APPLYing FORMAT

;The following code gives interesting error messages and/or crashes my 
mac:
;Seems to be on the first case of a multiple argument format string...
;Any ideas?
(defun user-log (string &rest args)
  "Formats the string and args to a User Log file."
(format t "Calling user-log with ~S ~S~%" string args)
  (with-open-file (stream "home;User Log"
                    :direction :output
                    :if-exists :append
                    :if-does-not-exist :create
                  )
(format t "~S~%" stream)
    (apply #'format stream string args)
  )
(format t "Finishing user-log~%")
)

<rest omitted....>