Constructors for expressions
Creates an expression that will construct the valuex
e.betaReduce returns an expression that is functionally equivalent toe, however ife is of the form((y1, ..., yn) => e2)(e1, ..., en) then it optimizes the top most call by returning the result of beta-reducing the application. Similarly, all outermost curried function applications will be beta-reduced, if possible. Otherwise returnsexpr.
e.betaReduce returns an expression that is functionally equivalent toe, however ife is of the form((y1, ..., yn) => e2)(e1, ..., en) then it optimizes the top most call by returning the result of beta-reducing the application. Similarly, all outermost curried function applications will be beta-reduced, if possible. Otherwise returnsexpr.
To retain semantics the argumentei is bound asval yi = ei and by-name arguments todef yi = ei. Some bindings may be elided as an early optimization.
Example:
((a: Int, b: Int) => a + b).apply(x, y)will be reduced to
val a = xval b = ya + bGenerally:
([X1, Y1, ...] => (x1, y1, ...) => ... => [Xn, Yn, ...] => (xn, yn, ...) => f[X1, Y1, ..., Xn, Yn, ...](x1, y1, ..., xn, yn, ...))).apply[Tx1, Ty1, ...](myX1, myY1, ...)....apply[Txn, Tyn, ...](myXn, myYn, ...)will be reduced to
type X1 = Tx1type Y1 = Ty1...val x1 = myX1val y1 = myY1...type Xn = Txntype Yn = Tyn...val xn = myXnval yn = myYn...f[X1, Y1, ..., Xn, Yn, ...](x1, y1, ..., xn, yn, ...)Returns an expression containing a block with the given statements and ending with the expression Given list of statementss1 :: s2 :: ... :: Nil and an expressione the resulting expression will be equivalent to'{ $s1; $s2; ...; $e }.
Returns an expression containing a block with the given statements and ending with the expression Given list of statementss1 :: s2 :: ... :: Nil and an expressione the resulting expression will be equivalent to'{ $s1; $s2; ...; $e }.
Creates an expression that will construct a copy of this list
Creates an expression that will construct a copy of this list
Transforms a list of expressionList(e1, e2, ...) whereei: Expr[T] to an expression equivalent to'{ List($e1, $e2, ...) } typed as anExpr[List[T]]
Creates an expression that will construct a copy of this sequence
Creates an expression that will construct a copy of this sequence
Transforms a sequence of expressionSeq(e1, e2, ...) whereei: Expr[T] to an expression equivalent to'{ Seq($e1, $e2, ...) } typed as anExpr[Seq[T]]
Given a tuple of the form(Expr[A1], ..., Expr[An]), outputs a tupleExpr[(A1, ..., An)].
Given a tuple of the form(Expr[A1], ..., Expr[An]), outputs a tupleExpr[(A1, ..., An)].
Creates an expression that will construct a copy of this tuple
Creates an expression that will construct a copy of this tuple
Transforms a sequence of expressionSeq(e1, e2, ...) whereei: Expr[Any] to an expression equivalent to'{ ($e1, $e2, ...) } typed as anExpr[Tuple]
Find a given instance of typeT in the current scope. ReturnSome containing the expression of the implicit orNone if implicit resolution failed.
Find a given instance of typeT in the current scope. ReturnSome containing the expression of the implicit orNone if implicit resolution failed.
type of the implicit parameter
Find a given instance of typeT in the current scope, while excluding certain symbols from the initial implicit search. ReturnSome containing the expression of the implicit orNone if implicit resolution failed.
Find a given instance of typeT in the current scope, while excluding certain symbols from the initial implicit search. ReturnSome containing the expression of the implicit orNone if implicit resolution failed.
type of the implicit parameter
Symbols ignored during the initial implicit search
if the found given requires additional search for other given instances, this additional search will NOT exclude the symbols from theignored list.
GetSome of a copy of the value if the expression contains a literal constant or constructor ofT. Otherwise returnsNone.
GetSome of a copy of the value if the expression contains a literal constant or constructor ofT. Otherwise returnsNone.
Usage:
case '{ ... ${expr @ Expr(value)}: T ...} => // expr: Expr[T] // value: TTo directly get the value of an expressionexpr: Expr[T] consider usingexpr.value/expr.valueOrError instead.