Sujet : Re: YANQ - When to map, when to iterate, when to recurse?
De : Nobody447095 (at) *nospam* here-nor-there.org (B. Pym)
Groupes : comp.lang.lispDate : 17. Jun 2025, 16:17:48
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <102s0up$2ffeh$1@dont-email.me>
User-Agent : XanaNews/1.18.1.6
(defun find-indices (list test)
(loop for element in list
for index from 1
when (funcall test element) collect index))
Gauche Scheme
(define (find-indices xs test)
(filter-map
(lambda (x i) (and (test x) i))
xs
(lrange 1)))
(find-indices '(3 4 6 7) odd?)
===>
(1 4)