Timeline for Sum Lists function in Scala
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 5, 2016 at 17:45 | comment | added | Nathan Davis |
@sweetyBaby, it's not tail-recursive because the last thing the function does (in the recursive cases) is invoke the ::: operator. Thus, the recursive call to sumList is not in tail position. As I mentioned, I think you should use a higher-level abstraction rather than using recursion directly in this particular situation. But if you'd like to learn more about tail-recursion see oldfashionedsoftware.com/2008/09/27/…
|
|
Dec 4, 2016 at 10:47 | vote | accept | sweetyBaby | ||
Dec 4, 2016 at 7:25 | comment | added | sweetyBaby | May I know why you think mine is not tail-recursive ? | |
Dec 4, 2016 at 2:52 | comment | added | sweetyBaby | Hi I am not sure the problem is, can you help to give a solution so that I can compare with mine and to see where is problem, thanks | |
Dec 3, 2016 at 17:53 | history | edited | Nathan Davis | CC BY-SA 3.0 |
added 281 characters in body
|
Dec 3, 2016 at 17:43 | history | answered | Nathan Davis | CC BY-SA 3.0 |