Tram<T> class abstract

Class that exposes recursion trampoline functionality, allowing to emulate a tail call optimization.

Represents one of the two states of a recursive computations – following recursive call or a returned value.

Tram<int> recursiveSum(int number, int sum) => number == 0
     ? Tram.done(sum)
     : Tram.call(() => tramSum(number - 1, sum + number));

Constructors

Tram.call(Tram<T> instruction())
Represents a recursive tail call.
const
factory
Tram.done(T value)
Represents a returning value.
const
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

bounce() → T
Runs the function, "bouncing" on the recursion trampoline, returning the result of the wrapped computations.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited