3.3 Higher-order Functions
Develop the following functions and datatypes in the Intermediate Student with Lambda language.
Rewrite check-temps1, check-temps, convert, average-price, convertFC, and eliminate-exp from the Lists and Trees assignment using map, filter, foldl, or foldr.
procedure
(compose-func after before) → (alpha . -> . gamma)
after : (beta . -> . gamma) before : (alpha . -> . beta)
Obviously, you shouldn’t use compose, because the point is for you to understand how such things work.
Don’t use foldr.
For example, (flatten (list (list 1 2) (list 3 4 5) (list 6))) returns (list 1 2 3 4 5 6).
Use foldr.
Use foldr.
For example, (bucket (list 1 1 2 2 2 3 1 1 1 2 3 3)) returns (list (list 1 1) (list 2 2 2) (list 3) (list 1 1 1) (list 2) (list 3 3)).
procedure
(add-last-name tree lname) → (or/c unknown? person?)
tree : (or/c unknown? person?) lname : string?
You should use tree-map and string-append. If you do not re-use your tree-map, you will get a zero.