extend("test")
extend("array")

describe("Variadic Partial Application With Placeholders", () => {

  it("simple variadic lambda with placeholder", () => {
    a = $ => $[3]
    b = a(11, 2, 3, _)
    result = b(1010)
    expect_equal(result, 1010)
  })

  it("added a parameter first", () => {
    a = (x, $) => $[1]
    b = a(11, 2, 3, _)
    result = b(20)
    expect_equal(result, 3)
  })

  it("added parameters first and last, placeholder last", () => {
    a = (x, $, y, z) => z
    b = a(11, 2, 3, 4, 5, 6, 7, _)
    result = b(999)
    expect_equal(result, 999)
  })

  it("added parameters first and last, no placeholder, final call returns last param", () => {
    a = (x, $, y, z) => z
    b = a(11, 2, 3, 4, 5, 6, 7)
    result = b
    expect_equal(result, 7)
  })
})
