Re: footnotes

Subject: Re: footnotes
From: Holger Klawitter <holger@xxxxxxxxxxxx>
Date: Fri, 30 Jul 1999 00:05:52 +0200
> yes and probably Tony too. You can add your code to the library and then
> others could benefit from it.

Ok, here we go:

; general function to get all predecessors (not in proper order!)
(define (predecessors gi nd)
    (if (is-root? nd)
        (node-list)
        (let ((pre (preced nd)))
            (node-list
                (predecessors gi (parent nd)))
                (select-elements pre gi)       ; get siblings themselves, too!
                (select-elements (descendants pre) gi)
        )
    )
)
; *not* tail recursive :-)

; hack to stop at the root, works not always but quite good for my purposes
(define (is-root? nd) (node-list-empty? (children nd)))

; Returns the position of the current node in a list of element of type
; "gi" conforming to function "proc".
; This function does not check whether the current not would be part of that
; list.
(define (fn-num gi proc #!optional (nd (current-node)))
 (+ 1 (node-list-length (node-list-filter
        proc
        (predecessors gi nd)
    )))
)
 
Have fun,
	Holger Klawitter    
--
Holger Klawitter                                     +49 (0)251 484 0637
holger@xxxxxxxxxxxx                             http://www.klawitter.de/


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


Current Thread