From cb3adcfb6d0023da523c6a9f04dc8b7b5555e85c Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 8 Dec 2006 18:13:31 +0000 Subject: implemented infix type operators --- src/library/scala/Function1.scala | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/library') diff --git a/src/library/scala/Function1.scala b/src/library/scala/Function1.scala index 027e0240c9..68cf8f3ad4 100644 --- a/src/library/scala/Function1.scala +++ b/src/library/scala/Function1.scala @@ -31,9 +31,16 @@ package scala * } */ trait Function1 [-T1, +R] extends AnyRef { + def apply(v1:T1): R + override def toString() = "" + /** (f compose g)(x) = f(g(x)) + */ def compose[A](g: A => T1): A => R = { x => apply(g(x)) } + + /** (f andThen g)(x) = g(f(x)) + */ def andThen[A](g: R => A): T1 => A = { x => g(apply(x)) } } -- cgit v1.2.3