On 11.05.2020 23:33, Joe Wicentowski wrote:
I found a version that works. In the original version I must not have been using tail recursion correctly. Here is the version that works. Can anyone explain why the first version doesn't properly trigger tail recursion?
No, but I think you can also apply fold-left
fold-left( 1 to 2000, random-number-generator(), function($a, $i) { head($a)?next(), head($a)?number, tail($a) } ) => tail() => count()
instead of setting up your own tail recursive functions.