LibFunctional-1.0

  • 2 pages found
NameAuthorLast updated byUpdated on
NameAuthorLast updated byUpdated on
API slaren slaren May 23, 2013
all(list, fn) Returns true if all the values in the list list satisfy the truth test fn, false otherwise. aliases: every Parameters list the input list. fn the truth test function. any(list, fn) Returns true if any value in the list list satisfies the truth test fn, false otherwise. aliases: some Parameters list the input list. fn the truth test function. binary_search(list, value[, fn]) Performs a binary search on sorted list list for value value and returns its index and value if found...
Main slaren slaren Apr 23, 2013
Library of helper functions that enable functional style programming and perform commonly used operations on lists and tables. Example: local fn = LibStub("LibFunctional-1.0") local list = { 1, 2, 3, 4, 5 } -- returns a list with the result of applying the specified function to all the values in the list local mapped = fn.map(list, function(x) return x * 2 end) -- returns the product of all the values in the list local s = fn.reduce(mapped, function(a, b) return a * b end) -- prints a sorted...
  • 2 pages found