Finds the first ancestor of inputnd in complist and then returns a list of all the elements in inputlist within that component.
WARNING: this requires walking over *all* the descendants of the ancestor node. This may be *slow*.
(define (component-list-descendant-node-list inputnd inputlist complist) ;; Find all elements of a list of elements in a component (let ((nd (ancestor-member inputnd complist))) (let loop ((nl (descendants nd)) (result (empty-node-list))) (if (node-list-empty? nl) result (if (member (gi (node-list-first nl)) inputlist) (loop (node-list-rest nl) (node-list result (node-list-first nl))) (loop (node-list-rest nl) result))))))