// modules/array.ts
var ARRAY_OPERATORS = {
  "array/len": {
    module: "array",
    category: "std-array",
    minArity: 1,
    maxArity: 1,
    description: "Array length",
    hasSideEffects: false,
    returnType: "number",
    params: [{ name: "arr", type: "array", description: "The array" }],
    example: '["array/len", [1, 2, 3]] // => 3'
  },
  "array/empty?": {
    module: "array",
    category: "std-array",
    minArity: 1,
    maxArity: 1,
    description: "Check if array is empty",
    hasSideEffects: false,
    returnType: "boolean",
    params: [{ name: "arr", type: "array", description: "The array" }],
    example: '["array/empty?", []] // => true'
  },
  "array/first": {
    module: "array",
    category: "std-array",
    minArity: 1,
    maxArity: 1,
    description: "Get first element",
    hasSideEffects: false,
    returnType: "any",
    params: [{ name: "arr", type: "array", description: "The array" }],
    example: '["array/first", [1, 2, 3]] // => 1'
  },
  "array/last": {
    module: "array",
    category: "std-array",
    minArity: 1,
    maxArity: 1,
    description: "Get last element",
    hasSideEffects: false,
    returnType: "any",
    params: [{ name: "arr", type: "array", description: "The array" }],
    example: '["array/last", [1, 2, 3]] // => 3'
  },
  "array/nth": {
    module: "array",
    category: "std-array",
    minArity: 2,
    maxArity: 2,
    description: "Get element at index",
    hasSideEffects: false,
    returnType: "any",
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "index", type: "number", description: "Index (0-based)" }
    ],
    example: '["array/nth", [1, 2, 3], 1] // => 2'
  },
  "array/slice": {
    module: "array",
    category: "std-array",
    minArity: 2,
    maxArity: 3,
    description: "Extract subarray",
    hasSideEffects: false,
    returnType: "array",
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "start", type: "number", description: "Start index" },
      { name: "end", type: "number", description: "End index (exclusive)", optional: true }
    ],
    example: '["array/slice", [1, 2, 3, 4], 1, 3] // => [2, 3]'
  },
  "array/concat": {
    module: "array",
    category: "std-array",
    minArity: 2,
    maxArity: null,
    description: "Concatenate arrays",
    hasSideEffects: false,
    returnType: "array",
    params: [{ name: "...arrs", type: "array[]", description: "Arrays to concatenate" }],
    example: '["array/concat", [1, 2], [3, 4]] // => [1, 2, 3, 4]'
  },
  "array/append": {
    module: "array",
    category: "std-array",
    minArity: 2,
    maxArity: 2,
    description: "Add item to end (returns new array)",
    hasSideEffects: false,
    returnType: "array",
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "item", type: "any", description: "Item to add" }
    ],
    example: '["array/append", [1, 2], 3] // => [1, 2, 3]'
  },
  "array/prepend": {
    module: "array",
    category: "std-array",
    minArity: 2,
    maxArity: 2,
    description: "Add item to start (returns new array)",
    hasSideEffects: false,
    returnType: "array",
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "item", type: "any", description: "Item to add" }
    ],
    example: '["array/prepend", [2, 3], 1] // => [1, 2, 3]'
  },
  "array/insert": {
    module: "array",
    category: "std-array",
    minArity: 3,
    maxArity: 3,
    description: "Insert item at index (returns new array)",
    hasSideEffects: false,
    returnType: "array",
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "index", type: "number", description: "Index to insert at" },
      { name: "item", type: "any", description: "Item to insert" }
    ],
    example: '["array/insert", [1, 3], 1, 2] // => [1, 2, 3]'
  },
  "array/remove": {
    module: "array",
    category: "std-array",
    minArity: 2,
    maxArity: 2,
    description: "Remove item at index (returns new array)",
    hasSideEffects: false,
    returnType: "array",
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "index", type: "number", description: "Index to remove" }
    ],
    example: '["array/remove", [1, 2, 3], 1] // => [1, 3]'
  },
  "array/removeItem": {
    module: "array",
    category: "std-array",
    minArity: 2,
    maxArity: 2,
    description: "Remove first matching item (returns new array)",
    hasSideEffects: false,
    returnType: "array",
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "item", type: "any", description: "Item to remove" }
    ],
    example: '["array/removeItem", [1, 2, 3, 2], 2] // => [1, 3, 2]'
  },
  "array/reverse": {
    module: "array",
    category: "std-array",
    minArity: 1,
    maxArity: 1,
    description: "Reverse array order (returns new array)",
    hasSideEffects: false,
    returnType: "array",
    params: [{ name: "arr", type: "array", description: "The array" }],
    example: '["array/reverse", [1, 2, 3]] // => [3, 2, 1]'
  },
  "array/sort": {
    module: "array",
    category: "std-array",
    minArity: 1,
    maxArity: 3,
    description: "Sort array (returns new array)",
    hasSideEffects: false,
    returnType: "array",
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "key", type: "string", description: "Field to sort by (for objects)", optional: true },
      { name: "dir", type: "string", description: '"asc" or "desc"', optional: true, defaultValue: "asc" }
    ],
    example: '["array/sort", "@items", "price", "desc"]'
  },
  "array/shuffle": {
    module: "array",
    category: "std-array",
    minArity: 1,
    maxArity: 1,
    description: "Randomly shuffle array (returns new array)",
    hasSideEffects: false,
    returnType: "array",
    params: [{ name: "arr", type: "array", description: "The array" }],
    example: '["array/shuffle", [1, 2, 3, 4, 5]]'
  },
  "array/unique": {
    module: "array",
    category: "std-array",
    minArity: 1,
    maxArity: 1,
    description: "Remove duplicates (returns new array)",
    hasSideEffects: false,
    returnType: "array",
    params: [{ name: "arr", type: "array", description: "The array" }],
    example: '["array/unique", [1, 2, 2, 3, 1]] // => [1, 2, 3]'
  },
  "array/flatten": {
    module: "array",
    category: "std-array",
    minArity: 1,
    maxArity: 1,
    description: "Flatten nested arrays one level",
    hasSideEffects: false,
    returnType: "array",
    params: [{ name: "arr", type: "array", description: "The array" }],
    example: '["array/flatten", [[1, 2], [3, 4]]] // => [1, 2, 3, 4]'
  },
  "array/zip": {
    module: "array",
    category: "std-array",
    minArity: 2,
    maxArity: 2,
    description: "Pair elements from two arrays",
    hasSideEffects: false,
    returnType: "array",
    params: [
      { name: "arr1", type: "array", description: "First array" },
      { name: "arr2", type: "array", description: "Second array" }
    ],
    example: '["array/zip", [1, 2], ["a", "b"]] // => [[1, "a"], [2, "b"]]'
  },
  "array/includes": {
    module: "array",
    category: "std-array",
    minArity: 2,
    maxArity: 2,
    description: "Check if array contains item",
    hasSideEffects: false,
    returnType: "boolean",
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "item", type: "any", description: "Item to find" }
    ],
    example: '["array/includes", [1, 2, 3], 2] // => true'
  },
  "array/indexOf": {
    module: "array",
    category: "std-array",
    minArity: 2,
    maxArity: 2,
    description: "Find index of item (-1 if not found)",
    hasSideEffects: false,
    returnType: "number",
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "item", type: "any", description: "Item to find" }
    ],
    example: '["array/indexOf", [1, 2, 3], 2] // => 1'
  },
  "array/find": {
    module: "array",
    category: "std-array",
    minArity: 2,
    maxArity: 2,
    description: "Find first element matching predicate",
    hasSideEffects: false,
    returnType: "any",
    acceptsLambda: true,
    lambdaArgPosition: 1,
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "pred", type: "lambda", description: "Predicate function" }
    ],
    example: '["array/find", "@items", ["fn", "x", ["=", "@x.status", "active"]]]'
  },
  "array/findIndex": {
    module: "array",
    category: "std-array",
    minArity: 2,
    maxArity: 2,
    description: "Find index of first element matching predicate (-1 if none)",
    hasSideEffects: false,
    returnType: "number",
    acceptsLambda: true,
    lambdaArgPosition: 1,
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "pred", type: "lambda", description: "Predicate function" }
    ],
    example: '["array/findIndex", "@items", ["fn", "x", ["=", "@x.status", "active"]]]'
  },
  "array/filter": {
    module: "array",
    category: "std-array",
    minArity: 2,
    maxArity: 2,
    description: "Keep elements matching predicate",
    hasSideEffects: false,
    returnType: "array",
    acceptsLambda: true,
    lambdaArgPosition: 1,
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "pred", type: "lambda", description: "Predicate function" }
    ],
    example: '["array/filter", "@items", ["fn", "x", [">", "@x.price", 100]]]'
  },
  "array/reject": {
    module: "array",
    category: "std-array",
    minArity: 2,
    maxArity: 2,
    description: "Remove elements matching predicate",
    hasSideEffects: false,
    returnType: "array",
    acceptsLambda: true,
    lambdaArgPosition: 1,
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "pred", type: "lambda", description: "Predicate function" }
    ],
    example: '["array/reject", "@items", ["fn", "x", ["=", "@x.status", "deleted"]]]'
  },
  "array/map": {
    module: "array",
    category: "std-array",
    minArity: 2,
    maxArity: 2,
    description: "Transform each element",
    hasSideEffects: false,
    returnType: "array",
    acceptsLambda: true,
    lambdaArgPosition: 1,
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "fn", type: "lambda", description: "Transform function" }
    ],
    example: '["array/map", "@items", ["fn", "x", ["*", "@x.price", 1.1]]]'
  },
  "array/reduce": {
    module: "array",
    category: "std-array",
    minArity: 3,
    maxArity: 3,
    description: "Reduce array to single value",
    hasSideEffects: false,
    returnType: "any",
    acceptsLambda: true,
    lambdaArgPosition: 1,
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "fn", type: "lambda", description: "Reducer function (acc, item) => newAcc" },
      { name: "init", type: "any", description: "Initial accumulator value" }
    ],
    example: '["array/reduce", "@items", ["fn", ["acc", "x"], ["+", "@acc", "@x.price"]], 0]'
  },
  "array/every": {
    module: "array",
    category: "std-array",
    minArity: 2,
    maxArity: 2,
    description: "Check if all elements match predicate",
    hasSideEffects: false,
    returnType: "boolean",
    acceptsLambda: true,
    lambdaArgPosition: 1,
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "pred", type: "lambda", description: "Predicate function" }
    ],
    example: '["array/every", "@items", ["fn", "x", [">", "@x.price", 0]]]'
  },
  "array/some": {
    module: "array",
    category: "std-array",
    minArity: 2,
    maxArity: 2,
    description: "Check if any element matches predicate",
    hasSideEffects: false,
    returnType: "boolean",
    acceptsLambda: true,
    lambdaArgPosition: 1,
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "pred", type: "lambda", description: "Predicate function" }
    ],
    example: '["array/some", "@items", ["fn", "x", ["=", "@x.status", "active"]]]'
  },
  "array/count": {
    module: "array",
    category: "std-array",
    minArity: 1,
    maxArity: 2,
    description: "Count elements (optionally matching predicate)",
    hasSideEffects: false,
    returnType: "number",
    acceptsLambda: true,
    lambdaArgPosition: 1,
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "pred", type: "lambda", description: "Predicate function", optional: true }
    ],
    example: '["array/count", "@tasks", ["fn", "t", ["=", "@t.status", "done"]]]'
  },
  "array/sum": {
    module: "array",
    category: "std-array",
    minArity: 1,
    maxArity: 2,
    description: "Sum values (optionally by field)",
    hasSideEffects: false,
    returnType: "number",
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "key", type: "string", description: "Field to sum", optional: true }
    ],
    example: '["array/sum", "@cart.items", "price"]'
  },
  "array/avg": {
    module: "array",
    category: "std-array",
    minArity: 1,
    maxArity: 2,
    description: "Average of values (optionally by field)",
    hasSideEffects: false,
    returnType: "number",
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "key", type: "string", description: "Field to average", optional: true }
    ],
    example: '["array/avg", "@ratings", "score"]'
  },
  "array/min": {
    module: "array",
    category: "std-array",
    minArity: 1,
    maxArity: 2,
    description: "Minimum value (optionally by field)",
    hasSideEffects: false,
    returnType: "number",
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "key", type: "string", description: "Field to compare", optional: true }
    ],
    example: '["array/min", "@products", "price"]'
  },
  "array/max": {
    module: "array",
    category: "std-array",
    minArity: 1,
    maxArity: 2,
    description: "Maximum value (optionally by field)",
    hasSideEffects: false,
    returnType: "number",
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "key", type: "string", description: "Field to compare", optional: true }
    ],
    example: '["array/max", "@products", "price"]'
  },
  "array/groupBy": {
    module: "array",
    category: "std-array",
    minArity: 2,
    maxArity: 2,
    description: "Group elements by field value",
    hasSideEffects: false,
    returnType: "any",
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "key", type: "string", description: "Field to group by" }
    ],
    example: '["array/groupBy", "@orders", "status"]'
  },
  "array/partition": {
    module: "array",
    category: "std-array",
    minArity: 2,
    maxArity: 2,
    description: "Split array by predicate into [matches, nonMatches]",
    hasSideEffects: false,
    returnType: "array",
    acceptsLambda: true,
    lambdaArgPosition: 1,
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "pred", type: "lambda", description: "Predicate function" }
    ],
    example: '["array/partition", "@items", ["fn", "x", [">", "@x.price", 50]]]'
  },
  "array/take": {
    module: "array",
    category: "std-array",
    minArity: 2,
    maxArity: 2,
    description: "Take first n elements",
    hasSideEffects: false,
    returnType: "array",
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "n", type: "number", description: "Number of elements" }
    ],
    example: '["array/take", "@items", 5]'
  },
  "array/drop": {
    module: "array",
    category: "std-array",
    minArity: 2,
    maxArity: 2,
    description: "Skip first n elements",
    hasSideEffects: false,
    returnType: "array",
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "n", type: "number", description: "Number of elements to skip" }
    ],
    example: '["array/drop", "@items", 5]'
  },
  "array/takeLast": {
    module: "array",
    category: "std-array",
    minArity: 2,
    maxArity: 2,
    description: "Take last n elements",
    hasSideEffects: false,
    returnType: "array",
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "n", type: "number", description: "Number of elements" }
    ],
    example: '["array/takeLast", "@items", 3]'
  },
  "array/dropLast": {
    module: "array",
    category: "std-array",
    minArity: 2,
    maxArity: 2,
    description: "Skip last n elements",
    hasSideEffects: false,
    returnType: "array",
    params: [
      { name: "arr", type: "array", description: "The array" },
      { name: "n", type: "number", description: "Number of elements to skip" }
    ],
    example: '["array/dropLast", "@items", 2]'
  }
};
function getArrayOperators() {
  return Object.keys(ARRAY_OPERATORS);
}
function getLambdaArrayOperators() {
  return Object.entries(ARRAY_OPERATORS).filter(([, meta]) => meta.acceptsLambda).map(([name]) => name);
}

export { ARRAY_OPERATORS, getArrayOperators, getLambdaArrayOperators };
//# sourceMappingURL=array.js.map
//# sourceMappingURL=array.js.map