Functional
Provides an interface for functional programming.
This module may be slated for significant changes in the future.
Methods
class public Functional.All(table objects
)
Returns bool
- required
objects
: The values to check for truthiness.
Returns whether all the values in the table are truthy.
class public Functional.AllTuple(...
)
Returns bool
- required
...
: The values to check for truthiness.
Returns whether all the values in the tuple are truthy.
class public Functional.Any(table objects
)
Returns bool
- required
objects
: The values to check for truthiness.
Returns whether any one of the values in the table is truthy.
class public Functional.AnyTuple(...
)
Returns bool
- required
...
: The values to check for truthiness.
Returns whether any one of the values in the tuple is truthy.
class public Functional.Filter(function bool method(any value), list list
)
Returns list
- required
method
: The method to use for filtering. Takes in a valid and returns whether it should stay. - required
list
: The list of values to filter over.
Uses a function to filter a list of values.
class public Functional.Map(function any method(any value), list list
)
Returns list
- required
method
: The method to use for mapping. Takes in a value and returns a transformed version of it. - required
list
: The list of values to map over.
Uses a function to perform a mapping of values.
This method (erroneously) modified the list before 1.1.
class public Functional.Range(number a, number b
)
Returns list
- required
a
: The number to start at. - required
b
: The number to end at.
Creates a range in the form of a list.
class public Functional.Reduce(function T method(T total, T current), list list
)
Returns T
- required
method
: The method to use for reduction. Accepts the total and the current value, returns the new total. - required
list
: The list of values to reduce over.
Performs a reduction over the list with the given function.
class public Functional.Unpack(table object
)
Returns tuple
- required
object
: The table to unpack.
Unpacks the table into a tuple. The same as unpack
and table.unpack
.
DEPRECATED in 1.1: Use Carbon.Unpack (added in 1.0.1)
class public Functional.ViewReverse(list list
)
Returns userdata
- required
list
: The list to create a view for.
Creates a view that returns all values of the list reversed.
Properties
[none]