home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / lisp / 3119 < prev    next >
Encoding:
Text File  |  1992-12-21  |  1.4 KB  |  43 lines

  1. Path: sparky!uunet!think.com!barmar
  2. From: barmar@think.com (Barry Margolin)
  3. Newsgroups: comp.lang.lisp
  4. Subject: Re: Use of format or pprint
  5. Date: 19 Dec 1992 01:42:19 GMT
  6. Organization: Thinking Machines Corporation, Cambridge MA, USA
  7. Lines: 30
  8. Distribution: usa
  9. Message-ID: <1gtulrINN3gr@early-bird.think.com>
  10. References: <1992Dec17.173558.18552@grace.boeing.com>
  11. NNTP-Posting-Host: gandalf.think.com
  12.  
  13. In article <1992Dec17.173558.18552@grace.boeing.com> ski@atc.boeing.com writes:
  14. >(setq a "org")
  15. >(setq b "chris dan ski elaine nick tony charlie jeff jeffw bruce mike kim kelly")
  16. >
  17. >or a list of names
  18. >
  19. >(setq b '("chris" "dan" "ski"...))
  20.  
  21. You'll have to write your own routine to convert the single-string form
  22. into a list of strings.  Common Lisp has nothing that will parse the string
  23. into words and treat them separately for this purpose (the only thing in CL
  24. that deals with words is STRING-CAPITALIZE).
  25.  
  26. >What format string will print them in this format
  27. >
  28. >org:    chris dan ski elaine nick tony charlie
  29. >    jeff jeffw bruce mike kim kelly
  30.  
  31. Once you've got a list of words in B, you can make use of the ~<...~:;...~>
  32. FORMAT directive to fill the line with them.
  33.  
  34. (format t "~&~A:~7T~{~<~%~7T~:; ~A~>~}~%" a b)
  35.  
  36. This is similar to the example in CLtL for printing a comma-separated list
  37. of items.
  38. -- 
  39. Barry Margolin
  40. System Manager, Thinking Machines Corp.
  41.  
  42. barmar@think.com          {uunet,harvard}!think!barmar
  43.