expr

com.phasmidsoftware.number.top.expr
object expr

Aggregator object providing convenient imports for working with Expressions.

Usage:

 import expr._

 val result = ∅ + 1 + 2 * 3
 val expr = math"x^2 + 3x - 5"

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
expr.type

Members list

Grouped members

aliases

val ->: Tuple2.type
Exported from Predef

Allows destructuring tuples with the same syntax as constructing them.

Allows destructuring tuples with the same syntax as constructing them.

Attributes

Example
val tup = "foobar" -> 3
val c = tup match {
 case str -> i => str.charAt(i)
}
val Map: Map.type
Exported from Predef

Attributes

val Set: Set.type
Exported from Predef

Attributes

conversions-array-to-wrapped-array

implicit def genericWrapArray[T](xs: Array[T]): ArraySeq[T]
Exported from LowPriorityImplicits

Type parameters

T

the element type of the array

Value parameters

xs

the array to wrap as an ArraySeq

Attributes

implicit def wrapRefArray[T <: AnyRef | Null](xs: Array[T]): ofRef[T]
Exported from LowPriorityImplicits

Type parameters

T

the element type of the array, must be a reference type

Value parameters

xs

the array of reference-typed elements to wrap as an ArraySeq

Attributes

implicit-classes-any

final implicit def ArrowAssoc[A](self: A): ArrowAssoc[A]
Exported from Predef

Type parameters

A

the type of the left-hand side of the arrow association

Value parameters

self

the value to use as the first element of the resulting tuple

Attributes

final implicit def Ensuring[A](self: A): Ensuring[A]
Exported from Predef

Type parameters

A

the type of the value being checked with ensuring

Value parameters

self

the value to check postconditions against

Attributes

final implicit def StringFormat[A](self: A): StringFormat[A]
Exported from Predef

Type parameters

A

the type of the value to be formatted as a string

Value parameters

self

the value to format

Attributes

utilities

def ???: Nothing
Exported from Predef

??? can be used for marking methods that remain to be implemented.

??? can be used for marking methods that remain to be implemented.

Attributes

Throws
NotImplementedError

when ??? is invoked.

def classOf[T]: Class[T]
Exported from Predef

Retrieves the runtime representation of a class type. classOf[T] is equivalent to the class literal T.class in Java.

Retrieves the runtime representation of a class type. classOf[T] is equivalent to the class literal T.class in Java.

Type parameters

T

the type whose runtime class representation is returned

Attributes

Returns

The runtime Class representation of type T.

Example
val listClass = classOf[List[?]]
// listClass is java.lang.Class[List[?]] = class scala.collection.immutable.List
val mapIntString = classOf[Map[Int,String]]
// mapIntString is java.lang.Class[Map[Int,String]] = interface scala.collection.immutable.Map
def identity[A](x: A): A
Exported from Predef

A method that returns its input value.

A method that returns its input value.

Type parameters

A

the type of the input value x

Value parameters

x

the value of type A to be returned

Attributes

Returns

the value x

def implicitly[T](implicit e: T): T
Exported from Predef

Summon an implicit value of type T. Usually, the argument is not passed explicitly.

Summon an implicit value of type T. Usually, the argument is not passed explicitly.

Type parameters

T

the type of the value to be summoned

Value parameters

e

the implicit value of type T

Attributes

Returns

the implicit value of type T

def locally[T](x: T): T
Exported from Predef

Used to mark code blocks as being expressions, instead of being taken as part of anonymous classes and the like. This is just a different name for identity.

Used to mark code blocks as being expressions, instead of being taken as part of anonymous classes and the like. This is just a different name for identity.

Type parameters

T

the type of the expression being guarded

Attributes

Example

Separating code blocks from new:

           val x = new AnyRef
           {
             val y = ...
             println(y)
           }
           // the { ... } block is seen as the body of an anonymous class
           val x = new AnyRef
           {
             val y = ...
             println(y)
           }
           // an empty line is a brittle "fix"
           val x = new AnyRef
           locally {
             val y = ...
             println(y)
           }
           // locally guards the block and helps communicate intent
inline def valueOf[T]: T
Exported from Predef

Retrieves the single value of a type with a unique inhabitant.

Retrieves the single value of a type with a unique inhabitant.

Type parameters

T

the singleton type whose unique value is retrieved

Attributes

Returns

the unique inhabitant of type T

Example
object Foo
val foo = valueOf[Foo.type]
// foo is Foo.type = Foo
val bar = valueOf[23]
// bar is 23.type = 23
def valueOf[T](implicit vt: ValueOf[T]): T
Exported from Predef

Retrieves the single value of a type with a unique inhabitant.

Retrieves the single value of a type with a unique inhabitant.

Type parameters

T

the singleton type whose unique value is retrieved

Value parameters

vt

the implicit ValueOf instance that provides the value

Attributes

Returns

the unique inhabitant of type T

Example
object Foo
val foo = valueOf[Foo.type]
// foo is Foo.type = Foo
val bar = valueOf[23]
// bar is 23.type = 23

Extensions

Extensions

extension (e: Expression)
def +(other: Int): Expression
def +(other: Double): Expression

Exports

Defined exports

implicit def $conforms[A]: A => A
Exported from Predef

An implicit of type A => A is available for all A because it can always be implemented using the identity function. This also means that an implicit of type A => B is always available when A A) B).

An implicit of type A => A is available for all A because it can always be implemented using the identity function. This also means that an implicit of type A => B is always available when A A) B).

Attributes

final type ArrayCharSequence = ArrayCharSequence
Exported from Predef$
final type ArrowAssoc = ArrowAssoc
Exported from Predef$
final type Class = Class
Exported from lang
final type Ensuring = Ensuring
Exported from Predef$
final val Expression: Expression
Exported from expr
final type Expression = Expression
Exported from expr
final type Function = Function1
Exported from scala
val Manifest: Manifest.type
Exported from Predef
final type Manifest = Manifest
Exported from reflect
final type Map = Map
Exported from immutable
val NoManifest: NoManifest.type
Exported from Predef
final type OptManifest = OptManifest
Exported from reflect
final type SeqCharSequence = SeqCharSequence
Exported from Predef$
final type Set = Set
Exported from immutable
final type String = String
Exported from Predef$
final type StringFormat = StringFormat
Exported from Predef$
val e: Expression
Exported from ExpressionPrelude
implicit def genericArrayOps[T](xs: Array[T]): ArrayOps[T]
Exported from Predef
def manifest[T](implicit m: Manifest[T]): Manifest[T]
Exported from Predef
Exported from ExpressionPrelude
def optManifest[T](implicit m: OptManifest[T]): OptManifest[T]
Exported from Predef
implicit def refArrayOps[T <: AnyRef | Null](xs: Array[T]): ArrayOps[T]
Exported from Predef
transparent inline def summon[T](using x: T): x.type
Exported from Predef

Summon a given value of type T. Usually, the argument is not passed explicitly.

Summon a given value of type T. Usually, the argument is not passed explicitly.

Type parameters

T

the type of the value to be summoned

Value parameters

x

the given value of type T

Attributes

Returns

the given value with its singleton type preserved

implicit def tuple2ToZippedOps[T1, T2](x: (T1, T2)): Ops[T1, T2]
Exported from Predef
implicit def tuple3ToZippedOps[T1, T2, T3](x: (T1, T2, T3)): Ops[T1, T2, T3]
Exported from Predef
Exported from ExpressionPrelude
Exported from ExpressionPrelude
val π: Expression
Exported from ExpressionPrelude
final val ∅: ∅
Exported from expr
Exported from ExpressionPrelude
Exported from ExpressionPrelude

Deprecated defined exports

implicit def copyArrayToImmutableIndexedSeq[T](xs: Array[T]): IndexedSeq[T]
Exported from LowPriorityImplicits2

Attributes

Deprecated
[Since version 2.13.0] implicit conversions from Array to immutable.IndexedSeq are implemented by copying; use `toIndexedSeq` explicitly if you want to copy, or use the more efficient non-copying ArraySeq.unsafeWrapArray

Experimental defined exports

final infix type is = [A <: AnyKind, B] =>> is[A, B]
Exported from Predef$

Attributes

Experimental
true