mumu 0.9.1

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

describe("array:zip", () => {
  it("zips two int arrays", () => {
    expect_equal(array:zip([1,2,3], [4,5,6]), [[1,4],[2,5],[3,6]])
  })

  it("works with partial usage", () => {
    zipA = array:zip([10,20])
    expect_equal(zipA([100,200]), [[10,100],[20,200]])
  })

  it("supports placeholder usage for first argument", () => {
    partial = array:zip(_, ["a","b"])
    expect_equal(partial(["x","y"]), [["x","a"],["y","b"]])
  })
})

describe("array:zipWith", () => {
  it("zips with a function", () => {
    out = array:zipWith((a,b)=>a+b, [1,2,3], [10,20,30])
    expect_equal(out, [11,22,33])
  })
  # Partial usage could be tested if zipWith supports partials in your bridging.
})

describe("array:intersection", () => {
  it("returns intersection of two int arrays", () => {
    expect_equal(array:intersection([1,2,3,4], [2,4,6]), [2,4])
  })
  it("works with partial usage", () => {
    inter2 = array:intersection([7,8,9])
    expect_equal(inter2([6,7,10]), [7])
  })
  it("supports placeholders", () => {
    partial = array:intersection(_, [1,5,9])
    expect_equal(partial([0,1,2,9]), [1,9])
  })
})

describe("array:difference", () => {
  it("returns difference of two int arrays", () => {
    expect_equal(array:difference([1,2,3,4], [2,4,6]), [1,3])
  })
  it("works with partial usage", () => {
    diff = array:difference([7,8,9])
    expect_equal(diff([8]), [7,9])
  })
  it("supports placeholders", () => {
    partial = array:difference(_, [2,3])
    expect_equal(partial([1,2,3,4]), [1,4])
  })
})

describe("array:union", () => {
  it("returns union of two int arrays", () => {
    expect_equal(array:union([1,2,3], [3,4,5]), [1,2,3,4,5])
  })
  it("works with partial usage", () => {
    unionA = array:union([10,20])
    expect_equal(unionA([20,30,40]), [10,20,30,40])
  })
  it("supports placeholder usage", () => {
    partial = array:union(_, [4,5,6])
    expect_equal(partial([1,4,7]), [1,4,7,5,6])
  })
})