{
  "id": "fn-array-filter",
  "dataComponent": "array",
  "heading": {
    "title": "filter",
    "badges": [
      "Array",
      "PARTIAL"
    ]
  },
  "synopsis": "Returns an array containing only elements that pass a predicate function. Supports partial usage with placeholders.",
  "codeBlocks": [
    "extend(\"array\")\n\n# Direct\n\narray:filter(\n  n => n > 10,\n [4,8,15,16,23,42]\n)\n// IntArray([15, 16, 23, 42])\n\n# Partial\n\nmyFilter = array:filter(n => n % 2 == 0)\nmyFilter([1,2,3,4,5])\n// IntArray([2, 4])\n\n# Plceholder\n\nmyPartial = array:filter(_, [10,20,3,5])\nmyPartial(x => x < 10)\n// IntArray([3, 5])\n"
  ],
  "notes": [
    "Accepts 1 or 2 arguments: (predicateFn[, data]).",
    "If called with 1 argument (predicate), it returns a partial function waiting for the data array.",
    "If called with 2 arguments, it immediately filters the array.",
    "The data must be int[], str[], or float[]. For each element, the predicate is called. If it returns true, the element is included in the result. If it returns false, it is excluded."
  ]
}
