From Newsgroup: comp.lang.lisp
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)
--- Synchronet 3.21d-Linux NewsLink 1.2