| Deutsch English Français Italiano |
|
<103rngs$1jidh$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: nntp.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: "B. Pym" <Nobody447095@here-nor-there.org>
Newsgroups: comp.lang.lisp
Subject: Re: Read-from-string
Date: Sun, 29 Jun 2025 15:53:01 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <103rngs$1jidh$1@dont-email.me>
References: <v75sa5$19h6e$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Date: Sun, 29 Jun 2025 17:53:01 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="726ba5b4d27d11335bd49df87c029d8f";
logging-data="1690033"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19tLL0L9z/Om15ibU3OFSwx"
User-Agent: XanaNews/1.18.1.6
Cancel-Lock: sha1:q0qowcVn6IG4u6L/xtFULMsF4EY=
B. Pym wrote:
> Pascal J. Bourguignon wrote:
>
> > >> words, but in reality I'll be reading from an input where the number
> > >> of words is unknown to me. Is there a way to circumvent this "repeat
> > >> 3", because it would be "repeat n" and n is unknwon (it's as many
> > >> words that the string contains).
> > >
> > >
> > > (with-input-from-string (s "lala tata bobo dada qwerty moo goo")
> > > (loop for token = (read s nil nil nil)
> > > while token
> > > collect token))
> > >
> >
> > (let ((data "lala tata bobo dada nil qwerty moo goo"))
> > (with-input-from-string (s data)
> > (loop for token = (read s nil nil nil)
> > while token
> > collect token)))
> > -> (LALA TATA BOBO DADA)
Gauche Scheme
(use srfi-42) ;; list-ec
(let ((data "lala tata bobo dada #f qwerty moo goo"))
(call-with-input-string data
(lambda(in)
(list-ec (:port token in) token))))
===>
(lala tata bobo dada #f qwerty moo goo)