changeset 449 | d67c5f7177a6 |
parent 418 | fa7f7144f2bb |
child 450 | 61eb4f9b8d84 |
--- a/progs/lecture4.scala Fri Nov 25 00:03:15 2022 +0000 +++ b/progs/lecture4.scala Fri Dec 02 07:48:03 2022 +0000 @@ -7,11 +7,10 @@ import scala.annotation.tailrec -@tailrec def fact(n: BigInt): BigInt = if (n == 0) 1 else n * fact(n - 1) -@tailrec + def factT(n: BigInt, acc: BigInt): BigInt = if (n == 0) acc else factT(n - 1, n * acc) @@ -22,7 +21,6 @@ def foo[A](args: List[A]) = ??? foo(List("1","2","3","4")) -import scala.annotation.tailrec // from knight1.scala