scala - Could a lazy val be tail-recursive? -


lazy val seq: unit = {   println("a")   seq } 

can call expression above tail-recursively?

i guess argue in sense, yes - when evaluated, seq recursively evaluate itself, , evaluation last action performed.

regardless of whether can called tail-recursive, though, there doesn't seem of point it. there no exit condition nor, if try , keep code purely functional, can there one: there no parameter, means there no "state" pass deeper evaluations , nothing test against break recursion.

also, if indeed tail-recursive, it's not form of tail recursion recognised or supported scala - evaluate seq , stackoverflowerror.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -