mumu 0.11.0

Lava Mumu is a language for those in the now and that know
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
  "id": "fn-array-nth",
  "dataComponent": "array",
  "heading": {
    "title": "nth",
    "badges": ["Array", "PARTIAL"]
  },
  "synopsis": "Retrieves the nth element of an array, supporting negative indices (counting from the end). Returns '_' if out of range. Partial usage is supported.",
  "codeBlocks": [
    "extend(\"array\")\\n\\n// Basic usage\\nsput( array:nth(0, [\"A\",\"B\",\"C\"]) )\\n// => \"A\"\\n\\nsput( array:nth(-1, [\"A\",\"B\",\"C\"]) )\\n// => \"C\"\\n\\n// If out of range => returns '_'\\n\\n// Partial usage\\ngetThird = array:nth(2)\\nsput( getThird([10,20,30,40]) )\\n// => 30\\n\\nmyPartial = array:nth(_, [5,6,7,8])\\nsput( myPartial(-2) )\\n// => 7"
  ],
  "notes": [
    "The first argument is an integer index. Negative indices count from the end, e.g. -1 => last element.",
    "The second argument is the array. Must be int[], str[], or bool[].",
    "If the index is out of range, returns '_'. If any argument is missing, you get a partial function requiring the missing parameter."
  ]
}