diff options
author | Martin Odersky <odersky@gmail.com> | 2006-03-31 15:53:37 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2006-03-31 15:53:37 +0000 |
commit | fde7c4cb46c91e05c7ff18a13d528e1b4a458422 (patch) | |
tree | 6ad3949c4aabedf640ae712a96a63d9639b94512 /test/files | |
parent | 5993e28ec5832368e1c1e8fa80679540465f75a9 (diff) | |
download | scala-fde7c4cb46c91e05c7ff18a13d528e1b4a458422.tar.gz scala-fde7c4cb46c91e05c7ff18a13d528e1b4a458422.tar.bz2 scala-fde7c4cb46c91e05c7ff18a13d528e1b4a458422.zip |
added conversion from methods to functions usin...
added conversion from methods to functions using prefix operator `&'
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/Course-2002-02.scala | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/files/run/Course-2002-02.scala b/test/files/run/Course-2002-02.scala index 435b84484f..8983829d79 100644 --- a/test/files/run/Course-2002-02.scala +++ b/test/files/run/Course-2002-02.scala @@ -140,9 +140,9 @@ object M6 { if (a > b) 0 else f(a) + sum(f)(a + 1, b); - def sumInts: (Int, Int) => Double = sum(x => x); - def sumCubes: (Int, Int) => Double = sum(x => x * x * x); - def sumReciprocals: (Int, Int) => Double = sum(x => 1.0/x); + def sumInts = &sum(x => x); + def sumCubes = &sum(x => x * x * x); + def sumReciprocals = &sum(x => 1.0/x); def sumPi = (n: Int => 4 + sum(x => 4.0/(4*x+1) - 4.0/(4*x-1))(1, n)); Console.println(sumInts(1,4)); @@ -163,9 +163,9 @@ object M7 { iter(a, 0) } - def sumInts: (Int, Int) => Double = sum(x => x); - def sumCubes: (Int, Int) => Double = sum(x => x * x * x); - def sumReciprocals: (Int, Int) => Double = sum(x => 1.0/x); + def sumInts = &sum(x => x); + def sumCubes = &sum(x => x * x * x); + def sumReciprocals = &sum(x => 1.0/x); def sumPi = (n: Int => 4 + sum(x => 4.0/(4*x+1) - 4.0/(4*x-1))(1, n)); Console.println(sumInts(1,4)); |