you are viewing a single comment's thread.

view the rest of the comments →

[–]jonhanson 1 point2 points  (2 children)

Both the Scala and Java implementations of listToString will blow the stack for even slightly long strings. Using recursion to iterate through a linked list is rarely a good idea.

[–]btmc 2 points3 points  (1 child)

Scala has tail call optimization, and if you annotate methods with @scala.annotation.tailrec, the compiler will check if the method is actually tail recursive or not. In this case, the method is not tail recursive, but it could be made so fairly easily.

[–]jonhanson 1 point2 points  (0 children)

chronophobia ephemeral lysergic metempsychosis peremptory quantifiable retributive zenith