blob: 027e0240c96420cc9cbe6fbd710944be3f40eb8f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2002-2006, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
// generated on Tue Nov 28 17:25:56 CET 2006 (with fancy comment) (with extra methods)
// $Id$
package scala
/**
* Function with 1 parameters. In the following example the definition of
* <code>succ</code> is a shorthand for the anonymous class definition
* <code>anonfun1</code>:
* <pre>
* <b>object</b> Main <b>extends</b> Application {
*
* <b>val</b> succ = (x: Int) => x + 1
*
* <b>val</b> anonfun1 = <b>new</b> Function1[Int, Int] {
* <b>def</b> apply(x: Int): Int = x + 1
* }
*
* Console.println(succ(0))
* Console.println(anonfun1(0))
* }</pre>
*/
trait Function1 [-T1, +R] extends AnyRef {
def apply(v1:T1): R
override def toString() = "<function>"
def compose[A](g: A => T1): A => R = { x => apply(g(x)) }
def andThen[A](g: R => A): T1 => A = { x => g(apply(x)) }
}
|