home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!think.com!barmar
- From: barmar@think.com (Barry Margolin)
- Newsgroups: comp.lang.lisp
- Subject: Re: Use of format or pprint
- Date: 19 Dec 1992 01:42:19 GMT
- Organization: Thinking Machines Corporation, Cambridge MA, USA
- Lines: 30
- Distribution: usa
- Message-ID: <1gtulrINN3gr@early-bird.think.com>
- References: <1992Dec17.173558.18552@grace.boeing.com>
- NNTP-Posting-Host: gandalf.think.com
-
- In article <1992Dec17.173558.18552@grace.boeing.com> ski@atc.boeing.com writes:
- >(setq a "org")
- >(setq b "chris dan ski elaine nick tony charlie jeff jeffw bruce mike kim kelly")
- >
- >or a list of names
- >
- >(setq b '("chris" "dan" "ski"...))
-
- You'll have to write your own routine to convert the single-string form
- into a list of strings. Common Lisp has nothing that will parse the string
- into words and treat them separately for this purpose (the only thing in CL
- that deals with words is STRING-CAPITALIZE).
-
- >What format string will print them in this format
- >
- >org: chris dan ski elaine nick tony charlie
- > jeff jeffw bruce mike kim kelly
-
- Once you've got a list of words in B, you can make use of the ~<...~:;...~>
- FORMAT directive to fill the line with them.
-
- (format t "~&~A:~7T~{~<~%~7T~:; ~A~>~}~%" a b)
-
- This is similar to the example in CLtL for printing a comma-separated list
- of items.
- --
- Barry Margolin
- System Manager, Thinking Machines Corp.
-
- barmar@think.com {uunet,harvard}!think!barmar
-