From: Michael Theodore
Subject: with-open-file question
Date: 
Message-ID: <1l6abnINNa3p@MINERVA.CIS.YALE.EDU>
Novice lisper that I am, I've been unable to solve the following simple
(I'm sure) problem. Suppose I want to write a series of files - titled, say,
my-file1, my-file2, my-file3, etc. I would like to have a counter, and simply
pass the counter to the function that writes the file. Something like

(defun writer (counter)
        (with-open-file (stream "my-file(what-goeshere?)" :direction etc.....

Thanks for your help....
        Michael


-- 
Practice random acts of randomness.........
		················@cs.yale.edu
From: Barry Margolin
Subject: Re: with-open-file question
Date: 
Message-ID: <1l7gj9INN220@early-bird.think.com>
In article <············@MINERVA.CIS.YALE.EDU> ················@yale.edu (Michael Theodore) writes:
>(defun writer (counter)
>        (with-open-file (stream "my-file(what-goeshere?)" :direction etc.....

The filename argument to WITH-OPEN-FILE is evaluated, so you can use string
functions to compute the filename:

(defun writer (counter)
  (with-open-file (stream (format nil "my-file~D" counter) ...)
    ...))

-- 
Barry Margolin
System Manager, Thinking Machines Corp.

······@think.com          {uunet,harvard}!think!barmar