I looked for the name of a procedure, which applies a tree structure of procedures to a tree structure of data, yielding a tree structure of results - all three trees having the same structure.
Such a procedure might have the signature:
(map-tree data functree)
Its return value would be the result of elementwise application of functree's elements on the corresponding data elements.
Examples (assuming that the procedure is called map-tree):
Example 1:
(define *2 (lambda (x) (* 2 x))) ; and similar definitions for *3 and *5 (map-tree '(100 (10 1)) '(*2 (*3 *5)))
would yield the result
(200 (30 5))
Example 2:
(map-tree '(((aa . ab) (bb . bc)) (cc . (cd . ce))) '((car cdr) cadr))
yields the result
((aa bc) cd)
However I did not find such a function in the SLIB documentation, which I consulted.
Does such a procedure already exist?
If not, what would be a suitable name for the procedure, and how would you order its arguments?