Re: Probably easy lisp question

Marco Antoniotti <[email protected]> Fri, 9 May 2003 12:26:35 -0400
Newsgroups gmane.lisp.corman
Message-ID <[email protected]>
On Friday, May 9, 2003, at 12:00 America/New_York, Edward O'Connor 
wrote:

>> I want to convert a number into a string.
>>
>> (defun makestrvar (x)
>>  .....
>> )
>>
>> should evalutate to
>>
>> (makestrvar 3) -> "var3"
>> (makestrvar 1000) -> "var1000"
>
> Have you tried using FORMAT? (format t "var~d" x) should do what you
> want.
>

That will NOT work as it will print a string to *STANDARD-OUTPUT*, not 
generate a string as a value.  You want

	(defun make-string-var (n) (format NIL "var~D"))


Yet, from the OP's question this may also be a job for GENSYM or 
GENTEMP.

Cheers

--
Marco Antoniotti
NYU Courant Bioinformatics Group		tel. +1 - 212 - 998 3488
715 Broadway 10th FL				fax. +1 - 212 - 998 3484
New York, NY, 10003, U.S.A.


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Rent DVDs Online - Over 14,500 titles.
No Late Fees & Free Shipping.
Try Netflix for FREE!
http://us.click.yahoo.com/YoVfrB/XP.FAA/uetFAA/SyjtlB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
[email protected]

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/