Re: [newbie] I need a function for read user input.

Liste des GroupesRevenir à cl scheme 
Sujet : Re: [newbie] I need a function for read user input.
De : Nobody447095 (at) *nospam* here-nor-there.org (B. Pym)
Groupes : comp.lang.lisp comp.lang.scheme
Date : 07. Jul 2025, 21:36:28
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <104hb4b$33jpf$1@dont-email.me>
References : 1
User-Agent : XanaNews/1.18.1.6
B. Pym wrote:

Gareth McCaughan wrote:
 
    (loop for word = (read input nil) while word collect word)
 
which even the strictest LOOP-hater would have to agree
is clearer.
 
It's shorter in Gauche Scheme:
 
(use gauche.generator)
 
(generator->list (cut  read input))
 
 
Another way:
 
(use srfi-42) ; list-ec
 
(list-ec (:port word input) word)

Using the old-fashioned and primitive "do":

(do ((r () (cons x r))
     (x 0 (read)))
  ((eof-object? x) (cdr (reverse r))))

Date Sujet#  Auteur
13 Sep 24 * Re: [newbie] I need a function for read user input.4B. Pym
7 Jul21:19 +- Re: [newbie] I need a function for read user input.1B. Pym
7 Jul21:36 `* Re: [newbie] I need a function for read user input.2B. Pym
7 Jul22:47  `- Re: [newbie] I need a function for read user input.1B. Pym

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal