API/Enumerable-Functional

Enumerable.prototype:Let(func)

Bind the enumerable to a parameter so that it can be used multiple times

Parameters

func
a function to act on the enumerable with that should return another sequence

Return value

an Enumerable

Usage

Enumerable.From({ 1, 2, 3 }):Let(function(x) return x:Zip(x:Skip(1), function(a, b) return a..':'..b end) end):ToString() == '["1:2", "2:3"]'


Enumerable.prototype:MemoizeAll()

Creates an enumerable that iterates over the original enumerable only once and caches the results.
Subclasses which represent concrete types will typically override this to return the same object.

Return value

an Enumerable.

Usage

Enumerable.From({ 1, 2, 3 }):Select(function(x) sleep(1000) return x end):MemoizeAll()



Comments

Posts Quoted:
Reply
Clear All Quotes