LibFunctional-1.0

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 list of all the names of global variables that match "CHAT_FRAME"
local addmessage = fn.bind(DEFAULT_CHAT_FRAME.AddMessage, DEFAULT_CHAT_FRAME)
fn.each(fn.sort(fn.filter(fn.keys(_G), function(x) return string.match(x, "CHAT_FRAME") end)), addmessage)

See the API page for more details.

You must login to post a comment. Don't have an account? Register to get one!

Facts

Date created
Apr 21, 2013
Category
Last update
Oct 16, 2014
Development stage
Release
License
BSD License
Curse link
LibFunctional-1.0
Downloads
1,440
Recent files

Authors

Relationships

Embedded library
LibStub