Re: Problem With tree-before

Subject: Re: Problem With tree-before
From: Richard Light <richard@xxxxxxxxxxxxxxxxx>
Date: Fri, 3 Apr 1998 11:19:08 +0100
In message <3.0.32.19980402224639.0076a38c@xxxxxxxxxx>, "W. Eliot
Kimber" <eliot@xxxxxxxxxx> writes
>I'm trying to implement the preceding XPointer location term using
>tree-before, which I think matches the behavior of preceding(). Using the
>definitions in the DSSSL standard, I copied over all the functions that
>Jade didn't implement. However, I now get an infinite loop somewhere in the
>chain. Before I spend a lot of time chasing down the problem, I was
>wondering if anyone else had tried to do this and ran into a typo in the
>DSSSL spec or something. I looked at the DSSSL list archive but didn't find
>anything. The functions I had to copy are:
>
>node-list-contains?
>node-list-intersection
>node-list-reduce
>node-list-remove-duplicates
>node-list-property
>sort-in-tree-order
>reduce
>subtree
>tree-root
>node-list-filter
>tree-before
>tree-before?

In my copy of the standard I have annotated the following change to
node-list-filter:

(define (node-list-filter proc n1)
        (node-list-reduce n1
                (lambda (result sn1)
                        (if (proc sn1)
                            (node-list result sn1)
; this was (node-list sn1 result) in the standard
                            result))
                (empty-node-list)))

(Just don't ask me how I found out this was wrong, or what the change
does!)

Incidentally, I also have an annotation for (ancestors) with the
commentary 'error (loops)', so you can have that one too:

(define (ancestors n1)
        (node-list-map (lambda (sn1)
                (let loop (cur (parent sn1))
                        (result (empty-node-list)))
                (if (node-list-empty? cur)
                    result
                    (loop (parent cur) ; was sn1 in printed standard
                          (node-list cur result)))))
        n1))

Hope this does it,

Richard.

Richard Light
SGML/XML and Museum Information Consultancy
richard@xxxxxxxxxxxxxxxxx


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


Current Thread
  • Problem With tree-before
    • W. Eliot Kimber - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id XAA19330Thu, 2 Apr 1998 23:56:00 -0500 (EST)
      • Richard Light - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id FAA29410Fri, 3 Apr 1998 05:30:21 -0500 (EST) <=