Subject: Re: Desperate Questions: [1]Absolute-Child-Number From: "W. Eliot Kimber" <eliot@xxxxxxxxxx> Date: Tue, 24 Jun 1997 13:00:14 -0500 |
At 01:45 PM 6/24/97 -0400, Vivek Agrawala wrote: >How about something like this: > >;; loop through the siblings of %element% till you find %element% >;; and return its position number > (define (absolute-child-number %element%) > (let loop ((siblings (children (parent %element%))) > (i 0) ) > (cond > ((node-list-contains? (node-list-first siblings) %element%) i) > ((node-list-empty? siblings) -1) ;; error! > ( else (loop (node-list-rest siblings) (+ i 1) )))) This works if you initialize i to "1". Thanks! I may even come to understand interation in DSSSL (it's starting to seep through the for-loop wall in my brain). Cheers, E. DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Desperate Questions: [1]Absolut, Paul Prescod | Thread | Re: Desperate Questions: [1]Absolut, W. Eliot Kimber |
Re: Desperate Questions: [1]Absolut, W. Eliot Kimber | Date | Re: Desperate Questions: [1]Absolut, Paul Prescod |
Month |