The Unicalc norm_list method in Java

 

One could do a map followed by a reduce.

It may be simpler to devise a single method which combines both.

For one reason, then we would not have to create the type

QuantityList.

 

Exercise (useful on homework):

Combine previous code for map and reduce, using norm_unit as F, and multiply as B so that one method multiplies together the results of applying norm_unit rather than creating a list.

Next Slide Previous Slide Contents