Re: searching for closest previous element

Subject: Re: searching for closest previous element
From: Paul Prescod <papresco@xxxxxxxxxxxxxxxx>
Date: Thu, 19 Mar 1998 10:31:40 -0500
stephenng@xxxxxxxxxxxx wrote:
> 
> "Reverse" takes a lot of time with many elements.  

Is that "reverse" or "node-list-reverse"? The first will almost
certainly be implemented eagerly, and thus process the whole list before
it starts it work. The latter may be implemented lazily.

But there seems no
> way around it: there's no quick way to access the last node in a node
> list, so that I can walk the tree list backwards.

I think what you want is

(node-list-last (select-element (tree-before (current-node)) "FOO"))

Only Jade doesn't seem to support either node-list-last or tree-before.

Still, this is interesting to show you how it would be done "in
principle" in DSSSL and to demonstrate that side effects are still not
really necessary. There are various ways this could be optimized in an
implementation. 
 
 Paul Prescod  - http://itrc.uwaterloo.ca/~papresco

"You have the wrong number."
"Eh? Isn't that the Odeon?"
"No, this is the Great Theater of Life. Admission is free, but the 
taxation is mortal. You come when you can, and leave when you must. The 
show is continuous. Good-night." -- Robertson Davies, "The Cunning Man"


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread
  • searching for closest previous element
    • stephenng - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id MAA29235Wed, 18 Mar 1998 12:00:36 -0500 (EST)
      • Norman Walsh - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id MAA00392Wed, 18 Mar 1998 12:40:40 -0500 (EST)
      • Paul Prescod - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id KAA20931Thu, 19 Mar 1998 10:32:32 -0500 (EST) <=
      • <Possible follow-ups>
      • stephenng - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id NAA01051Wed, 18 Mar 1998 13:28:07 -0500 (EST)
        • stephenng - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id OAA17663Thu, 26 Mar 1998 14:25:03 -0500 (EST)
      • Reynolds, Gregg - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id SAA04606Wed, 18 Mar 1998 18:19:21 -0500 (EST)