<RefEntry id="list-member-find">
<!-- This file is generated automatically from the DSSSL source. -->
<!-- Do not edit this file! -->
<?html-filename list-member-find.html>

<RefMeta>
  <RefEntryTitle>list-member-find</RefEntryTitle>
  <RefMiscInfo Role="file">dblib.dsl</RefMiscInfo>
</RefMeta>

<RefNameDiv>
  <RefName>list-member-find</RefName>
  <RefPurpose>Returns the index of an element in a list</RefPurpose>
</RefNameDiv>

<RefSynopsisDiv><Title>Synopsis</Title>
<Synopsis>
(list-member-find element elementlist)
</Synopsis>
</RefSynopsisDiv>

<RefSect1><Title>Description</Title>

<para>
Returns the index of <literal>element</literal> in the list <literal>elementlist</literal>. The
first element in a list has index 0.</para>


</RefSect1>

<RefSect1><Title>Author</Title>

<para>
Norman Walsh, &lt;ndw@nwalsh.com&gt;
</para>
</RefSect1>
<RefSect1><Title>Source Code</Title>

<ProgramListing>
(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))))))
</ProgramListing>
</RefSect1>

</RefEntry>
