Return the sum of values for each class.
-i.e.
(summation '(("one" 1) ("two" 2) ("three" 3)))
> one = 1
two = 2
three = 3
Further, return the sum of values for each class if there are several instances of each class.
-i.e.
(summation '(("one" 1) ("two" 2) ("three" 3)
("one" 4) ("two" 5) ("three" 6)
("one" 7) ("two"
("three" 9)) )
> one = 12
two = 15
three = 18
Rules:
You may only ``go thru'' this list once.
You may return a formatted screen print or a list (which ever is easier for you).
And to make this a bit more challenging, you must use a recursive process.
(You may use variables or a ``wrapper''.)
Note:
o This idea came from a program I just made for reporting/calcing the len and vol of pipe in a selection. (It is a generalized concept of a function I just created.)
o I used variables in my procedure but I would be very interested in seeing a solution that uses neither. (I could not think of a way to do that.)