home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / lisp / 3138 < prev    next >
Encoding:
Text File  |  1992-12-24  |  1.2 KB  |  41 lines

  1. Path: sparky!uunet!dove!cme!kramer
  2. From: kramer@cme.nist.gov (Tom Kramer)
  3. Newsgroups: comp.lang.lisp
  4. Subject: Re: Use of format or pprint
  5. Message-ID: <20483@cosmos.cme.nist.gov>
  6. Date: 24 Dec 92 17:13:19 GMT
  7. References: <1992Dec17.173558.18552@grace.boeing.com>
  8. Distribution: usa
  9. Organization: National Institute of Standards and Technology, Gaithersburg, MD
  10. Lines: 29
  11.  
  12. In article <1992Dec17.173558.18552@grace.boeing.com> ski@atc.boeing.com writes:
  13.  
  14. >(setq a "org")
  15. >(setq b 
  16. >  "chris dan ski elaine nick tony charlie jeff jeffw bruce mike kim kelly")
  17. >or (setq b '("chris" "dan" "ski"...))
  18. >
  19. >What format string
  20. >(format "???" a b)
  21. >will print them in this format
  22. >
  23. >org:    chris dan ski elaine nick tony charlie
  24. >    jeff jeffw bruce mike kim kelly
  25.  
  26. Using (setq b '("chris" "dan" "ski" ...)) the following works
  27.  
  28. (format t "~A:~{~8T~A~^ ~A~^ ~A~^ ~A~^ ~A~^ ~A~^ ~A~^~%~}" a b)
  29.  
  30. The first ~A uses up a.
  31. The ~{...~} is processed repeatedly on elements of b until all are used.
  32. The 8T gets to the correct column.
  33. The ~^ are so processing will stop without error regardless of the
  34. length of b.
  35.  
  36. I wasted an hour on that, but I learned something. Merry Christmas!
  37. This worked in Allegro Common LISP on a SUN4.
  38.  
  39. Tom Kramer
  40. kramer@cme.nist.gov
  41.