Subject: Re: searching for closest previous element From: stephenng@xxxxxxxxxxxx Date: Wed, 18 Mar 1998 13:25:36 +0000 |
Norm writes: >>(define (node-list-last nl) >>(node-list-ref nl >>(- (node-list-length nl) 1))) I saw node-list-ref in the spec, but it claims that it "could be defined" as and gives a definition that basically walks down the list. I guess "could be defined" isn't the same as "is defined"; maybe node-list-ref is actually fast. I'll try re-writing my code and see if it works better. >From the spec: (node-list-ref nl k) Returns a node-list containing the kth member of nl (zero-based), if there is such a member, and otherwise returns the empty node-list. This could be defined as follows: (define (node-list-ref nl i) (cond ((< i 0) (empty-node-list)) ((zero? i) (node-list-first nl)) (else (node-list-ref (node-list-rest nl) (- i 1))))) --Steve DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: searching for closest previous , Paul Prescod | Thread | Re: searching for closest previous , stephenng |
Re: searching for closest previous , Norman Walsh | Date | Re: modular docbook stylesheets spe, Norman Walsh |
Month |