Two at a time

Liste des GroupesRevenir à cl lisp 
Sujet : Two at a time
De : Nobody447095 (at) *nospam* here-nor-there.org (B. Pym)
Groupes : comp.lang.lisp
Date : 18. Aug 2024, 23:17:56
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v9toe2$2h8qo$1@dont-email.me>
User-Agent : XanaNews/1.18.1.6


From a list of item '(joe barney cathy kevin stephy ...) I
want a formated output like this:
 
joe barney
cathy kevin
stephy ...
...
 
In other words, I want a formated output in two (or more)
columns, each separated by a tabulation. I don't know if the
number of items is odd or even. I can do it with a simple
function but can I do it within a single format expression? I
have read some doc about the ~[~] and ~{~} directives but, in
despite of a lot of tentatives, I can't do anything.

newLISP

(set 'lst '("joe" "barney" "cathy" "kevin" "stephy" "thomas" "bob"))

(dolist (two (explode (append lst '("")) 2 true))
  (println (format "%s\t%s" two)))

joe     barney
cathy   kevin
stephy  thomas
bob

Date Sujet#  Auteur
18 Aug 24 o Two at a time1B. Pym

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal