I need help in racket pl
Using this BINTREE definition, write a (higher-order) function called treemap that takes in a numeric function f and a binary tree, and returns a tree with the same shape but using f(n) for values in its leaves. For example, here is a test case:
(test (tree-map add1 (Node (Leaf 1) (Node (Leaf 2) (Leaf 3))))
=> (Node (Leaf 2) (Node (Leaf 3) (Leaf 4))))
What I did is:
[Node BINTREE BINTREE]
[Leaf Number])
> >
(define(treemap f tree)
[(Leaf Number) f(Number)]
[(Node tree BTREE) treemap(Node)]))