Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

BOFH excuse #30: positron router malfunction


comp / comp.lang.lisp / .Re: YANQ - When to map, when to iterate, when to recurse?

SubjectAuthor
o .Re: YANQ - When to map, when to iterate, when to recurse?B. Pym

1
Subject: .Re: YANQ - When to map, when to iterate, when to recurse?
From: B. Pym
Newsgroups: comp.lang.lisp
Organization: A noiseless patient Spider
Date: Sun, 9 Jun 2024 08:12 UTC
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: No_spamming@noWhere_7073.org (B. Pym)
Newsgroups: comp.lang.lisp
Subject: .Re: YANQ - When to map, when to iterate, when to recurse?
Date: Sun, 9 Jun 2024 08:12:11 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <v43o4n$3auvn$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Date: Sun, 09 Jun 2024 10:12:11 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="96981e22874fd1175713420b87f6d849";
logging-data="3505143"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+eFt3Uuo5fXSsCP3azFFbY"
User-Agent: XanaNews/1.18.1.6
Cancel-Lock: sha1:7vI3e7kebJY9cNfPlrrNoM/PEmw=
View all headers

Wade Humeniuk wrote:

> (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 0)))

(find-indices '(-9 0 3 4 5) odd?)
===>
'(0 2 4)

1

rocksolid light 0.9.8
clearnet tor