Sujet : Re: MAP (and variants) vs LOOP - Popular opinion observation?
De : Nobody447095 (at) *nospam* here-nor-there.org (B. Pym)
Groupes : comp.lang.lispDate : 26. Jun 2025, 23:00:34
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <103kfu1$3mnqh$1@dont-email.me>
User-Agent : XanaNews/1.18.1.6
Pascal Costanza wrote:
- More often than not, the different variables actually iterate over
different kinds of values. Recently, I needed the following costruct
quite often:
(loop for x in some-list
for i from 0
collect `(,x ,i))
This enumerates all elements in a list. You would have to express this
completely manually without LOOP because none of the mapxyz functions
help you here.
Wrong.
Gauche Scheme:
(map list some-list (lrange 0))
Another way:
(use gauche.sequence :only (map-with-index))
(use srfi-1 :only (xcons))
(map-with-index xcons '(20 30 40 50))
===>
((20 . 0) (30 . 1) (40 . 2) (50 . 3))