Why don't you declare a method inside the method that uses it? Then you can simply call him βhelperβ or whatever you like, without worrying about name conflicts.
scala> def reverse[A](l:List[A]) = { | def helper(acc:List[A],rest:List[A]):List[A] = rest match { | case Nil => acc | case x::xs => helper(x::acc, xs) | } | helper(Nil, l) | } reverse: [A](l: List[A])List[A] scala> reverse(1::2::3::Nil) res0: List[Int] = List(3, 2, 1)
Kim stebel
source share