Sha256: 4f754ca0ce69b6a45ef17c54151872cb55f1e4d09bf5b7940c17f7d176f6fac2
Contents?: true
Size: 442 Bytes
Versions: 396
Compression:
Stored size: 442 Bytes
Contents
local function reduce(xs, value, f) for _, x in ipairs(xs) do value = f(x, value) end return value end local function map(xs, f) return reduce(xs, {}, function(x, acc) table.insert(acc, f(x)) return acc end) end local function filter(xs, pred) return reduce(xs, {}, function(x, acc) if pred(x) then table.insert(acc, x) end return acc end) end return { map = map, reduce = reduce, filter = filter }
Version data entries
396 entries across 396 versions & 1 rubygems