The following different types of visitors are available for use
(accumulators not used here):
- CountAlgo -- Returns the count of the number of elements
in the list
- SumRevAlgo -- Returns the sum of the elements in a list of
integers using reverse accumulation
- SumFwdAlgo -- Returns the sum of the elements in a list of
integers using forward accumulation
- CopyAlgo -- Returns a copy of the list
- AddToAlgo -- Returns a copy of the list where the integer
parameter is added to all elements
Available accumulators, to be used with the FoldR or FoldL visitor
(above visitors and input parameters not used here).
- SumAcc -- Accumulates the sum of all integer values, starting at zero.
- CopyAcc -- Accumulates a list of all values, in order starting with an
empty list, i.e. the first element of the internally stored list is the last
value received.
- LastNegAcc -- Accumulates (saves) the last negative integer value
received. If no negative numbers received the (base case) value
is Double.NaN ("Not A Number").
Click for full-size image

Additional Resources:
Trouble Running the Demos?
© 2020 by Stephen Wong