DSSSL Library Reference: Part of the Modular DocBook Stylesheet distribution
Prev |  | Next

# list-member-find

## Name

list-member-find -- Returns the index of an element in a list

## Synopsis

    (list-member-find element elementlist)

## Description

Returns the index of `element` in the list `elementlist`. The first element in a list has index 0.

## Author

Norman Walsh, <ndw@nwalsh.com>

## Source Code

    (define (list-member-find element elementlist)
      ;; Returns the index of an element in a list
      (let loop ((elemlist elementlist) (count 0))
        (if (null? elemlist)
    	-1
    	(if (equal? element (car elemlist))
    	    count
    	    (loop (cdr elemlist) (+ count 1))))))

Prev | Home | Next
expt | Up | default-uppercase-list