Closure

com.phasmidsoftware.lascala.fp.Closure
See theClosure companion object
case class Closure[T, R](f: RenderableFunction[R], ps: Parameter[T]*)(using evidence$1: ClassTag[R]) extends () => Try[R]

This case class represents a "closure" on a renderable function (f) and a set of bound parameters (ps).

Type parameters

R

the result type of the closure

T

the parameter type of the closure

Value parameters

f

the (renderable) function

ps

the parameters, each of which may be a value or a Closure

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait () => Try[R]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def apply(): Try[R]

Method to evaluate this closure. If the arity of this is not equal to zero, a Failure will result

Method to evaluate this closure. If the arity of this is not equal to zero, a Failure will result

Attributes

Returns

a Try[R]

def bind(p: Parameter[T], i: Int = ...): Closure[T, R]

Method to bind an additional parameter to this Closure. The resulting Closure will have arity one less than this.

Method to bind an additional parameter to this Closure. The resulting Closure will have arity one less than this.

NOTE: this is currently used only by ClosureSpec

Value parameters

i

the index at which the new parameter should be inserted (defaults to the number of current parameters, which is to say, if index is not specified, the new parameter will be appended to the list).

p

the parameter which will be inserted immediately before the ith bound parameter.

Attributes

Returns

a new Closure with the same function but with the expanded list

def isFullyApplied: Boolean

Method to determine if this Closure is fully applied. That's to say we can invoke apply() without having to evaluate any of the parameters (they are all evaluated already).

Method to determine if this Closure is fully applied. That's to say we can invoke apply() without having to evaluate any of the parameters (they are all evaluated already).

NOTE: not currently used

Attributes

Returns

true if the arity is zero, the function f has no call-by-name parameters and if all of the parameters for this Closure are themselves evaluated.

def partiallyApply: Try[Closure[_, R]]

Method to partially apply this Closure, resulting in a RenderableFunction (i.e. a Closure without any parameters).

Method to partially apply this Closure, resulting in a RenderableFunction (i.e. a Closure without any parameters).

Attributes

Returns

a RenderableFunction[R] wrapped in Try.

override def toString(): String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Function0 -> Any

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product

Concrete fields

lazy val arity: Int

The arity of this Closure.

The arity of this Closure.

Attributes