chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Columnar text display code?


From: foobar
Subject: Re: [Chicken-users] Columnar text display code?
Date: Fri, 06 Jul 2007 07:55:05 +0200
User-agent: Thunderbird 1.5.0.10 (X11/20070403)

Robin Lee Powell schrieb:
> Someone *must* have written this.  Probably lots of someones.  May I
> have your code?
>
> The problem is (very) simple.  I have:
>
> (("foo" "1" "bar") ("baz" "baaaaaaaaz" "2"))
>
> I wish to output (something like):
>
>  foo  1           bar
>  baz  baaaaaaaaz  2
>
> That is, given a list of lists of strings and a given screen width,
> pad the strings appropriately and join them, returning a list of
> strings.
>
> -Robin
>
>   

As the others allready suggested the fmt egg does this
and many things more.
Here is how it might look like:

(use fmt)
(define (list->columnar-string ls)
   (with-output-to-string (lambda ()
      (fmt #t (apply columnar (map dsp ls)))))

(list->columnar-string '("foo" "frooble" "bar"))


greets david






reply via email to

[Prev in Thread] Current Thread [Next in Thread]