Scala Library: scala.Function1
scala.Function1
A function of 1 parameter.
In the following example, the definition of succ is a shorthand for the anonymous class definition anonfun1:
Note that the difference between Function1
and scala.PartialFunction is that
the latter can specify inputs which it will not handle.
- Self Type
- (T1) ⇒ R
- Annotations
- @ implicitNotFound (msg =…)
- Source
Abstract Value Members From scala.Function1
abstract def apply(v1: T1): R
Apply the body of this function to the argument.
- returns
- the result of function application.
(defined at scala.Function1)
Concrete Value Members From scala.Function1
def andThen[A](g: (R) ⇒ A): (T1) ⇒ A
Composes two instances of Function1 in a new Function1, with this function applied first.
- A
- the result type of function
g
- the result type of function
- g
- a function R => A
- returns
- a new function
f
such thatf(x) == g(apply(x))
- a new function
- Annotations
- @ unspecialized ()
(defined at scala.Function1)
def compose[A](g: (A) ⇒ T1): (A) ⇒ R
Composes two instances of Function1 in a new Function1, with this function applied last.
- A
- the type to which function
g
can be applied
- the type to which function
- g
- a function A => T1
- returns
- a new function
f
such thatf(x) == apply(g(x))
- a new function
- Annotations
- @ unspecialized () (defined at scala.Function1)
Full Source:
Interested in Scala?
I send out weekly, personalized emails with articles and conference talks.
Subscribe now.