{
"id": "fn-array-slice",
"dataComponent": "array",
"heading": {
"title": "slice",
"badges": ["Array", "PARTIAL"]
},
"synopsis": "Returns a shallow copy of a portion of an array from start to end (exclusive). Supports negative indices and partial/placeholder usage.",
"codeBlocks": [
"extend(\"array\")\n\narr = [10,20,30,40,50]\nsput(array:slice(1, 3, arr))\n# => [20,30]\n\n# Negative indices:\nsput(array:slice(-3, -1, arr))\n# => [30,40]\n\n# Partial usage: start known\ns1 = array:slice(2)\nsput(s1(4, arr))\n# => [30,40]\n\n# Partial usage: start & end known\ns2 = array:slice(1,3)\nsput(s2(arr))\n# => [20,30]\n\n# Placeholder: array known\np = array:slice(_, _, arr)\nsput(p(2,5))\n# => [30,40,50]"
],
"notes": [
"Takes up to 3 arguments: (start, end, array).",
"Negative indices count from end.",
"If end <= start, result is empty.",
"Partial and placeholder usage supported."
]
}