scala
package scala
- Alphabetic
- By Inheritance
- scala
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- type ::[A] = scala.collection.immutable.::[A]
- type AbstractMethodError = java.lang.AbstractMethodError
- type AnyRef = AnyRef
- type ArrayIndexOutOfBoundsException = java.lang.ArrayIndexOutOfBoundsException
- type BigDecimal = scala.math.BigDecimal
- type BigInt = scala.math.BigInt
- type BufferedIterator[+A] = scala.collection.BufferedIterator[A]
- type ClassCastException = java.lang.ClassCastException
-
trait
Curried extends CurriedWithTypeParameters
A marker trait that enables curried varargs.
A marker trait that enables curried varargs.
Given a function call
f(a, b, c)
, whenf
is a subtype of Curried, it should be rewritten tof.applyBegin.applyNext(a).applyNext(b).applyNext(c).applyEnd
.Optionally, some arguments to a Curried call may be a sequence argument marked as
_*
. Given a function callf(p1, s1: _*, p2)
, when translating it to the curried form, the sequence argument will becomes afoldLeft
call.f.applyBegin .applyNext(p1) .applyNextSeq(s1) .applyNext(p2) .applyEnd
Unlike traditional repeated parameters, which restrict the sequence argument at the last position, sequence arguments in a curried call are allowed at any position.
When a Curried is invoked with some type arguments, those type arguments will be moved to the
applyBegin
method. Therefore,List[Int](1 to 3: _*)
should be translated to(1 to 3).foldLeft(List.applyBegin[Int])(_.applyNext(_)).applyEnd
.Fast list builder
class PartiallyAppliedInitializer[A](builder: collection.mutable.Builder[A, List[A]]) { def applyEnd = builder.result def applyNextSeq(seq: Seq[A]) = { builder ++= seq this } def applyNext(a: A) = { builder += a this } } object FastListInitializer extends Curried { def applyBegin[A]:PartiallyAppliedInitializer[A] = new PartiallyAppliedInitializer(List.newBuilder[A]) } FastListInitializer(0, 4) should be(List(0, 4)) FastListInitializer[Int](0, 100 to 103: _*, 1) should be(List(0, 100, 101, 102, 103, 1))
Example: - type Either[+A, +B] = scala.util.Either[A, B]
- type Equiv[T] = scala.math.Equiv[T]
- type Error = java.lang.Error
- type Exception = java.lang.Exception
- type Fractional[T] = scala.math.Fractional[T]
- type IllegalArgumentException = java.lang.IllegalArgumentException
- type IndexOutOfBoundsException = java.lang.IndexOutOfBoundsException
- type IndexedSeq[+A] = scala.collection.IndexedSeq[A]
- type Integral[T] = scala.math.Integral[T]
- type InterruptedException = java.lang.InterruptedException
- type Iterable[+A] = scala.collection.Iterable[A]
- type Iterator[+A] = scala.collection.Iterator[A]
- type Left[+A, +B] = scala.util.Left[A, B]
- type List[+A] = scala.collection.immutable.List[A]
- type NoSuchElementException = java.util.NoSuchElementException
- type NullPointerException = java.lang.NullPointerException
- type NumberFormatException = java.lang.NumberFormatException
- type Numeric[T] = scala.math.Numeric[T]
- type Ordered[T] = scala.math.Ordered[T]
- type Ordering[T] = scala.math.Ordering[T]
- type PartialOrdering[T] = scala.math.PartialOrdering[T]
- type PartiallyOrdered[T] = scala.math.PartiallyOrdered[T]
- type Range = scala.collection.immutable.Range
- type Right[+A, +B] = scala.util.Right[A, B]
- type RuntimeException = java.lang.RuntimeException
- type Seq[+A] = scala.collection.Seq[A]
- type Stream[+A] = scala.collection.immutable.Stream[A]
- type StringBuilder = scala.collection.mutable.StringBuilder
- type StringIndexOutOfBoundsException = java.lang.StringIndexOutOfBoundsException
- type Throwable = java.lang.Throwable
- type Traversable[+A] = scala.collection.Traversable[A]
- type TraversableOnce[+A] = scala.collection.TraversableOnce[A]
- type UnsupportedOperationException = java.lang.UnsupportedOperationException
- type Vector[+A] = scala.collection.immutable.Vector[A]
Value Members
- val #::: scala.collection.immutable.Stream.#::.type
- val +:: scala.collection.+:.type
- val :+: scala.collection.:+.type
- val ::: scala.collection.immutable.::.type
- val AnyRef: Specializable
- val BigDecimal: scala.math.BigDecimal.type
- val BigInt: scala.math.BigInt.type
- val Either: scala.util.Either.type
- val Equiv: scala.math.Equiv.type
- val Fractional: scala.math.Fractional.type
- val IndexedSeq: scala.collection.IndexedSeq.type
- val Integral: scala.math.Integral.type
- val Iterable: scala.collection.Iterable.type
- val Iterator: scala.collection.Iterator.type
- val Left: scala.util.Left.type
- val List: scala.collection.immutable.List.type
- val Nil: scala.collection.immutable.Nil.type
- val Numeric: scala.math.Numeric.type
- val Ordered: scala.math.Ordered.type
- val Ordering: scala.math.Ordering.type
- val Range: scala.collection.immutable.Range.type
- val Right: scala.util.Right.type
- val Seq: scala.collection.Seq.type
- val Stream: scala.collection.immutable.Stream.type
- val StringBuilder: scala.collection.mutable.StringBuilder.type
- val Traversable: scala.collection.Traversable.type
- val Vector: scala.collection.immutable.Vector.type