It is possible that I am misunderstanding your question, said this.
Get the list of paths of the subtrees mapping tree->path on the results of your _expression_
Get the path of the parent tree with (tree->path T)
Use the following to map onto the list of paths (assumes parent is a parent of child!):
(define (relative-path parent child)
(cond ((null? parent) child)
(else (relative-path (cdr parent) (cdr child)))))
With results:
(relative-path '(1 2 3) '(1 2 3))
; ()
(relative-path '(1 2 3) '(1 2 3 4))
(4)
Archive powered by MHonArc 2.6.19.