PedroPS (12) [Avatar] Offline

The "concat" function example provided in page 103 (boldface typing) is not "tail-recursive" (I think).
Doesn't it suffer from the same stack troubles as the before mentioned no-TR functions?
What's different in this case to be "acceptable"?

aslam.khan (50) [Avatar] Offline
Re: p 103. concat example
Hi Pedro

I'll look at that example again and get back to you. Stay tuned.
nresni (8) [Avatar] Offline
maybe ...

  def concat(ns: AList): AList = {
    def loop(xs: AList, acc: AList): AList = {
      if(xs.isEmpty) acc
      else loop(xs.tail, xs.head :: acc)
    loop(this, ns)