Oliver Mooney wrote:
Arter scratching my head for a few days the best I can do is to use a
difference list for the second accumulator, which does reduce the
number of arguments each call but just hides the use of two variables
rather than eliminating it:
(...)
If that's not the optimal solution, could I have another hint please??
Many thanks,
Oliver.
Well, the trick is very simple: the reversed list is just an unbound
variable
in the scope of the function, which is bound at the end of the recursion.
The final function has four arguments: the two lists, the reversed list
(passed even though it has not been calculated yet), and nil, which is
used to calculate the reversed list.
Peter
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users