diff options
Diffstat (limited to 'Scala/sandbox/sum.scala')
-rw-r--r-- | Scala/sandbox/sum.scala | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/Scala/sandbox/sum.scala b/Scala/sandbox/sum.scala deleted file mode 100644 index a09f26b..0000000 --- a/Scala/sandbox/sum.scala +++ /dev/null @@ -1,14 +0,0 @@ - -object Sum { - - def sum (f: Int => Int, a: Int, b: Int) = { - def loop(a: Int, acc: Int): Int = - if (a > b) acc - else loop(a + 1, f(a) + acc) - loop(a, 0) - } - - def run = - println(sum(x => x * x, 3, 5)) - -} |