lOf course, we could have just used map
in this particular case:
lhalve(A) = A/2;
lhalve_all(X) = map(halve, X);
lUse higher order functions such as map when
possible; resort to lower-order ones
when you think you need to.
lHigher-order functions can often tell the story more succinctly.