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.lisp comp.lang.schemeDate : 03. Jul 2025, 14:29:11
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <10460j6$6cm7$1@dont-email.me>
User-Agent : XanaNews/1.18.1.6
Ken Tilton wrote:
(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
I must say, however, I am suspicous of the whole business, and would
like to see the calling code so we can really rake this bum over the coals.
Gauche Scheme
(use srfi-42) ;; first-ec
(define (position things test)
(first-ec #f
(:list e (index i) things)
(if (test e))
(list i e)))
(position '(oh sun is happen four)
(lambda(s) (> (string-length (x->string s)) 4)))
===>
(3 happen)