Finds the first ancestor of inputnd in complist and then counts all the elements of the types in inputlist from that point on and returns the number of inputnd.
If the node is not found, 0 is returned.
WARNING: this requires walking over *all* the descendants of the ancestor node. This may be *slow*.
(define (component-list-child-number inputnd inputlist complist) ;; Find child-number of a list of children within a component (let loop ((nl (component-list-descendant-node-list inputnd inputlist complist)) (num 1)) (if (node-list-empty? nl) 0 (if (node-list=? (node-list-first nl) inputnd) num (loop (node-list-rest nl) (+ num 1))))))