mumu 0.9.1

Lava Mumu is a language for those in the now and that know
Documentation
extend("array")
extend("test")
extend("string")

describe("array:apply usage", () => {

  it("should call a function with array elements for sum", () => {
    res = array:apply((x,y) => x + y, [10, 20])
    expect_equal(res, 30)
  })

  it("should handle an empty array => call fn() with zero args", () => {
    res = array:apply(() => 9999, [])
    expect_equal(res, 9999)
  })

  it("should allow partial usage => known function, missing array", () => {
    myAdder = array:apply((a,b,c) => a*b*c)
    out = myAdder([2,3,4])
    expect_equal(out, 24)
  })

  it("should allow placeholder usage => known array, missing function", () => {
    arr = [5,7]
    partial = array:apply(_, arr)
    result = partial((a,b) => a - b)
    expect_equal(result, -2)
  })

  it("should handle multiple array elements => e.g. 3 elements => function called with (a,b,c)", () => {
    tripleProduct = array:apply((a,b,c) => a*b*c, [2,3,5])
    expect_equal(tripleProduct, 30)
  })

  it("should handle underscore placeholders => two placeholders => final usage", () => {
    partialBoth = array:apply() # returns partial => needs both
    partialWithFn = partialBoth((x,y)=>x+y)
    finalOut = partialWithFn([1,2])
    expect_equal(finalOut, 3)
  })

})