Sujet : Re: Can someone please explain me what's wrong with this code ?
De : Nobody447095 (at) *nospam* here-nor-there.org (B. Pym)
Groupes : comp.lang.lispDate : 19. Jun 2025, 09:12:34
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <1030gph$3p2nv$1@dont-email.me>
User-Agent : XanaNews/1.18.1.6
(defun some-thing-pos (list test)
(loop for e in list
for pos upfrom 0
for res = (funcall test e)
when res return (list res e pos res))) ;; order to fit name
Instead of CL, let's use a Lispy language.
Gauche Scheme
(define (search L test)
(any
(lambda (e i)
(and-let* ((res (test e))) (list e i res)))
L
(liota)))
(search '(0 2 4 5 7 8 9) odd?)
===>
(5 3 #t)
(search '(0 2 4 5 7 8 9) negative?)
===>
#f