In my Scala app, I have a function that calls a function which returns a result of type Future[T]. I need to pass the mapped result in my recursive function call. I want t
Make factorialAcc return an Int and only wrap it in a future in the factorial function.
factorialAcc
factorial
def factorial(n: Int): Future[Int] = { @tailrec def factorialAcc(acc: Int, n: Int): Int = { if (n <= 1) { acc } else { factorialAcc(n*acc,n-1) } } future { factorialAcc(1, n) } }
should probably work.