{
"id": "fn-array-chunk",
"dataComponent": "array",
"heading": {
"title": "chunk",
"badges": ["Array", "PARTIAL"]
},
"synopsis": "Splits an array into subarrays of a given size. The last chunk may be smaller if not evenly divisible. Partial and placeholder usage supported.",
"codeBlocks": [
"extend(\"array\")\n\narr = [1,2,3,4,5]\nsput(array:chunk(2, arr))\n# => [[1,2],[3,4],[5]]\n\n# Partial usage:\nc2 = array:chunk(2)\nsput(c2(arr))\n# => [[1,2],[3,4],[5]]\n\n# Placeholder usage:\npart = array:chunk(_, arr)\nsput(part(3))\n# => [[1,2,3],[4,5]]"
],
"notes": [
"Takes two arguments: (size, array).",
"Returns a MixedArray of arrays, each of given chunk size.",
"Last chunk may be shorter if array length is not divisible.",
"Partial and placeholder usage supported."
]
}