Re: Collection utilities

Liste des GroupesRevenir à cl lisp 
Sujet : Re: Collection utilities
De : Nobody447095 (at) *nospam* here-nor-there.org (B. Pym)
Groupes : comp.lang.lisp
Date : 23. Jun 2025, 13:55:11
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <103bire$18v7b$1@dont-email.me>
User-Agent : XanaNews/1.18.1.6
  * (with-collectors (foo)
      (loop for pos upfrom 1
            for l in '((a b c) (one two three) (you and me) (girl))
            do (collect pos :into foo)
            do (loop for sym in l
                     do (collect pos :into foo))
            finally (return foo)))
  (1 A B C 2 ONE TWO THREE 3 YOU AND ME 4 GIRL)
 
;;; Or....
 
* (loop for pos upfrom 1
      for l in '((a b c) (one two three) (you and me) (girl))
      collect pos
      append l)
(1 A B C 2 ONE TWO THREE 3 YOU AND ME 4 GIRL)

Gauche Scheme

(append-map
  cons
  (lrange 1)  ;; Infinite but lazy.
  '((a b c) (one two three) (you and me) (girl)))

  ===>
(1 a b c 2 one two three 3 you and me 4 girl)

Date Sujet#  Auteur
23 Jun 25 * Re: Collection utilities2B. Pym
23 Jun 25 `- Re: Collection utilities1B. Pym

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal