diff --git a/doc/Builtins.md b/doc/Builtins.md index dbd31c9..6e55367 100644 --- a/doc/Builtins.md +++ b/doc/Builtins.md @@ -1291,9 +1291,9 @@ This function is non-deterministic and automatically vectorized. __Examples__: -- `4Ṗ` → `[1,1,1,1] [1,1,2] [1,3] [2,2] [4] ...` +- `4Ṗ` → `[1,1,1,1] [1,1,2] [1,3] [2,2] [4]` - `0Ṗ` → `[]` -- `4_ Ṗ` → ` ...` +- `4_ Ṗ` → Fail - `[2,2]Ṗ` → `[[1,1],[1,1]] [[1,1],[2]] [[2],[1,1]] [[2],[2]]` ### `sqrt` (`√`, `1 -> 1`) @@ -1321,7 +1321,7 @@ This function is non-deterministic. __Examples__: -- `į` → `[0,1] [1,0] ...` +- `į` → `[0,1] [1,0]` ### `orNeg` (`ŋ`, `1 -> 1`) @@ -1335,9 +1335,9 @@ When the input is a list, each element is optionally negated independently. __Examples__: -- `1ŋ` → `1 -1 ...` -- `0ŋ` → `0 ...` -- `[-1,2]ŋ` → `[-1,2] [-1,-2] [1,2] [1,-2] ...` +- `1ŋ` → `1 -1` +- `0ŋ` → `0` +- `[-1,2]ŋ` → `[-1,2] [-1,-2] [1,2] [1,-2]` ### `bitAnd` (`&`, `2 -> 1`) @@ -1347,6 +1347,13 @@ If one or both of the arguments are chars, they are converted to numbers accordi This function is automatically vectorized and fails when the two lists are of different lengths. +__Examples__: + +- `5 3&` → `1` +- `[5,6] [3,4]&` → `[1,4]` +- `5 [3,4]&` → `[1,4]` +- `[5] [3,4]&` → Fail + ### `bitOr` (`|`, `2 -> 1`) Bitwise OR of two integers. @@ -1355,6 +1362,13 @@ If one or both of the arguments are chars, they are converted to numbers accordi This function is automatically vectorized with padding. +__Examples__: + +- `5 3|` → `7` +- `[5,6] [3,4]|` → `[7,6]` +- `5 [3,4]|` → `[7,5]` +- `[5] [3,4]|` → `[7,4]` + ### `bitXor` (`X`, `2 -> 1`) Bitwise XOR of two integers. @@ -1363,26 +1377,49 @@ If one or both of the arguments are chars, they are converted to numbers accordi This function is automatically vectorized with padding. +__Examples__: + +- `5 3X` → `6` +- `[5,6] [3,4]X` → `[6,2]` +- `5 [3,4]X` → `[6,1]` +- `[5] [3,4]X` → `[6,4]` + ### `popCount` (`Þ`, `1 -> 1`) Count the number of 1s in the binary digits of an integer. +If the number is smaller than zero, the result is also negated. + If the argument is a char, it is converted to a number according to Nekomata's code page. This function is automatically vectorized. +__Examples__: + +- `13Þ` → `3` +- `[-13,0,13]Þ` → `[-3,0,3]` + ### `histogram` (`Ħ`, `1 -> 1`) Compute the histogram of a list of integers. The result is a list, whose length is the maximum of the input list, and whose nth element is the number of occurrences of n in the input. +Fails when the list contains negative integers or fractions. + If the input is a ragged list, it is flattened before computation. If the input is a single integer, it is treated as a singleton list. If the input is a single char, it is converted to a number according to Nekomata's code page, and then treated as a singleton list. +__Examples__: + +- `0Ħ` → `[1]` +- `1Ħ` → `[0,1]` +- `[1,2,3,2,1]Ħ` → `[0,2,2,1]` +- `[[1,2],[3,2],[1]]Ħ` → `[0,2,2,1]` + ### `sumEach` (`Ŝ`, `1 -> 1`) Take the sum of each list in a list of lists of numbers. @@ -1391,6 +1428,12 @@ The addition is automatically vectorized with padding zeros. If some of the elements are chars, they are converted to numbers according to Nekomata's code page. +__Examples__: + +- `[[1,2],[3,4]]Ŝ` → `[3,7]` +- `[[1,2],[3,4],[5]]Ŝ` → `[3,7,5]` +- `[[[1,2],[3,4]],[[5,6],[7,8]]]Ŝ` → `[[4,6],[12,14]]` + ### `charToInt` (`e`, `1 -> 1`) Convert a char to an integer according to Nekomata's code page. @@ -1399,6 +1442,11 @@ If the input is already an integer, it is left unchanged. This function is automatically vectorized. +__Examples__: + +- `'a e` → `97` +- `"Hello"e` → `[72,101,108,108,111]` + ### `intToChar` (`H`, `1 -> 1`) Convert an integer to a char according to Nekomata's code page. @@ -1409,16 +1457,32 @@ Fail when the integer is not in the range 0 to 255. This function is automatically vectorized. +__Examples__: + +- `97H` → `'a'` +- `[72,101,108,108,111]H` → `Hello` + ### `read` (`Ĝ`, `1 -> 1`) Parse a string (a list of chars) or a single char as a Nekomata value. Fail when the string is not a valid Nekomata value. +__Examples__: + +- `'1 Ĝ` → `1` +- `"[1,2,3]"Ĝ` → `[1,2,3]` + ### `show` (`ĝ`, `1 -> 1`) Convert a Nekomata value to a string (a list of chars). +__Examples__: + +- `1ĝU` → `["1"]` +- `[1,2,3]ĝU` → `["[1,2,3]"]` +- `"Hello"ĝU` → `["\"Hello\""]` + ### `anyOf` (`~`, `1 -> 1`) Choose an element from a list. @@ -1427,92 +1491,198 @@ If the argument is a number, it is converted to a range from 0 to that number mi This function is non-deterministic. +__Examples__: + +- `[]~` → Fail +- `[1,2,3]~` → `1 2 3` +- `5~` → `0 1 2 3 4` + ### `emptyList` (`Ø`, `0 -> 1`) Push an empty list. +__Examples__: + +- `Ø` → `[]` + ### `singleton` (`U`, `1 -> 1`) Create a list with a single element. +__Examples__: + +- `1U` → `[1]` +- `[1]U` → `[[1]]` + ### `unsingleton` (`z`, `1 -> 1`) Get the only element of a list with a single element. Fails when the list is empty or has more than one element. +__Examples__: + +- `[1]z` → `1` +- `[[1]]z` → `[1]` +- `[]z` → Fail +- `[1,2]z` → Fail + ### `pair` (`Ð`, `2 -> 1`) Create a list with two elements. +__Examples__: + +- `1 2Ð` → `[1,2]` +- `[1] 2Ð` → `[[1],2]` + ### `unpair` (`đ`, `1 -> 2`) Get the two elements of a list with two elements. Fails when the length of the list is not 2. +__Examples__: + +- `[1,2]đ+` → `3` +- `[]đ` → Fail +- `[1]đ` → Fail +- `[1,2,3]đ` → Fail + ### `removeFail` (`‼`, `1 -> 1`) Remove failed items from a list. +__Examples__: + +- `[1,2,3]‼` → `[1,2,3]` +- `[1,0,3]P‼` → `[1,3]` + ### `length` (`#`, `1 -> 1`) Get the length of a list. +__Examples__: + +- `[1,2,3]#` → `3` +- `[]#` → `0` + ### `lengthIs` (`L`, `2 -> 1`) Check if the length of a list is equal to a given integer. If it is, push the list itself, otherwise fail. +__Examples__: + +- `[1,2,3] 3L` → `[1,2,3]` +- `[1,2,3] 4L` → Fail + ### `nth` (`@`, `2 -> 1`) Get the nth element of a list. +The index is 0-based. + This function is automatically vectorized on the second argument. +__Examples__: + +- `[1,2,3] 1@` → `2` +- `[1,2,3] [1,2]@` → `[2,3]` + ### `head` (`h`, `1 -> 1`) Get the first element of a list. +__Examples__: + +- `[1,2,3]h` → `1` +- `[]h` → Fail + ### `tail` (`t`, `1 -> 1`) Remove the first element of a list. +__Examples__: + +- `[1,2,3]t` → `[2,3]` +- `[]t` → Fail + ### `cons` (`c`, `2 -> 1`) Prepend an element to a list. +__Examples__: + +- `[2,3] 1c` → `[1,2,3]` +- `[] 1c` → `[1]` + ### `uncons` (`C`, `1 -> 2`) Get the first element and the rest of a list. +__Examples__: + +- `[1,2,3]CÐ` → `[[2,3],1]` +- `[]C` → Fail + ### `last` (`l`, `1 -> 1`) Get the last element of a list. +__Examples__: + +- `[1,2,3]l` → `3` +- `[]l` → Fail + ### `init` (`i`, `1 -> 1`) Remove the last element of a list. +__Examples__: + +- `[1,2,3]i` → `[1,2]` +- `[]i` → Fail + ### `snoc` (`ɔ`, `2 -> 1`) Append an element to a list. +__Examples__: + +- `[1,2] 3ɔ` → `[1,2,3]` +- `[] 1ɔ` → `[1]` + ### `unsnoc` (`Ɔ`, `1 -> 2`) Get the last element and the rest of a list. +__Examples__: + +- `[1,2,3]ƆÐ` → `[[1,2],3]` +- `[]Ɔ` → Fail + ### `cons0` (`ç`, `1 -> 1`) Prepend a zero to a list. +__Examples__: + +- `[1,2,3]ç` → `[0,1,2,3]` +- `[]ç` → `[0]` + ### `reverse` (`↔`, `1 -> 1`) Reverse a list. If the argument is a number, it is converted to a range from 0 to that number minus 1. +__Examples__: + +- `[1,2,3]↔` → `[3,2,1]` +- `3↔` → `[2,1,0]` + ### `prefix` (`p`, `1 -> 1`) Get a prefix of a list. @@ -1521,6 +1691,11 @@ If the argument is a number, it is converted to a range from 0 to that number mi This function is non-deterministic. +__Examples__: + +- `[1,2,3]p` → `[] [1] [1,2] [1,2,3]` +- `3p` → `[] [0] [0,1] [0,1,2]` + ### `suffix` (`s`, `1 -> 1`) Get a suffix of a list. @@ -1529,12 +1704,25 @@ If the argument is a number, it is converted to a range from 0 to that number mi This function is non-deterministic. +__Examples__: + +- `[1,2,3]s` → `[1,2,3] [2,3] [3] []` +- `3s` → `[0,1,2] [1,2] [2] []` + ### `take` (`T`, `2 -> 1`) Get the first n elements of a list. +Fail when the list is shorter than n. + This function is automatically vectorized on the second argument. +__Examples__: + +- `[1,2,3] 2T` → `[1,2]` +- `[1,2,3] 4T` → Fail +- `[1,2,3] [2,3]T` → `[[1,2],[1,2,3]]` + ### `subset` (`S`, `1 -> 1`) Get a finite subset of a list. @@ -1543,6 +1731,11 @@ If the argument is a number, it is converted to a range from 0 to that number mi This function is non-deterministic. +__Examples__: + +- `[1,2] S` → `[] [1] [2] [1,2]` +- `2S` → `[] [0] [1] [0,1]` + ### `subsequence` (`q`, `1 -> 1`) Get a finite contiguous subsequence of a list. @@ -1551,6 +1744,11 @@ If the argument is a number, it is converted to a range from 0 to that number mi This function is non-deterministic. +__Examples__: + +- `[1,2,3]q` → `[] [1] [1,2] [1,2,3] [2] [2,3] [3]` +- `3q` → `[] [0] [0,1] [0,1,2] [1] [1,2] [2]` + ### `join` (`,`, `2 -> 1`) Concatenate two lists. @@ -1699,6 +1897,8 @@ For each element in the second list, remove the first occurrence of that element Get the index of any occurrence of an element in a list. +The index is 0-based. + Fail if the element does not occur in the list. This function is non-deterministic. diff --git a/src/Nekomata/Builtin.hs b/src/Nekomata/Builtin.hs index 1945b7d..02afa8c 100644 --- a/src/Nekomata/Builtin.hs +++ b/src/Nekomata/Builtin.hs @@ -1199,9 +1199,9 @@ builtins = \If the argument is a char, \ \it is converted to a number according to Nekomata's code page.\n\ \This function is non-deterministic and automatically vectorized." - [ ("4Ṗ", All True ["[1,1,1,1]", "[1,1,2]", "[1,3]", "[2,2]", "[4]"]) + [ ("4Ṗ", All False ["[1,1,1,1]", "[1,1,2]", "[1,3]", "[2,2]", "[4]"]) , ("0Ṗ", All False ["[]"]) - , ("4_ Ṗ", All True []) + , ("4_ Ṗ", All False []) , ("[2,2]Ṗ", All False ["[[1,1],[1,1]]", "[[1,1],[2]]", "[[2],[1,1]]", "[[2],[2]]"]) ] , Builtin @@ -1224,7 +1224,7 @@ builtins = unitVec2 "Choose one of [0, 1] and [1, 0] non-deterministically.\n\ \This function is non-deterministic." - [("į", All True ["[0,1]", "[1,0]"])] + [("į", All False ["[0,1]", "[1,0]"])] , Builtin "orNeg" 'ŋ' @@ -1235,9 +1235,9 @@ builtins = \This function is non-deterministic and automatically vectorized.\n\ \When the input is a list, \ \each element is optionally negated independently." - [ ("1ŋ", All True ["1", "-1"]) - , ("0ŋ", All True ["0"]) - , ("[-1,2]ŋ", All True ["[-1,2]", "[-1,-2]", "[1,2]", "[1,-2]"]) + [ ("1ŋ", All False ["1", "-1"]) + , ("0ŋ", All False ["0"]) + , ("[-1,2]ŋ", All False ["[-1,2]", "[-1,-2]", "[1,2]", "[1,-2]"]) ] , Builtin "bitAnd" @@ -1248,7 +1248,11 @@ builtins = \they are converted to numbers according to Nekomata's code page.\n\ \This function is automatically vectorized \ \and fails when the two lists are of different lengths." - [] + [ ("5 3&", All False ["1"]) + , ("[5,6] [3,4]&", All False ["[1,4]"]) + , ("5 [3,4]&", All False ["[1,4]"]) + , ("[5] [3,4]&", All False []) + ] , Builtin "bitOr" '|' @@ -1257,7 +1261,11 @@ builtins = \If one or both of the arguments are chars, \ \they are converted to numbers according to Nekomata's code page.\n\ \This function is automatically vectorized with padding." - [] + [ ("5 3|", All False ["7"]) + , ("[5,6] [3,4]|", All False ["[7,6]"]) + , ("5 [3,4]|", All False ["[7,5]"]) + , ("[5] [3,4]|", All False ["[7,4]"]) + ] , Builtin "bitXor" 'X' @@ -1266,16 +1274,23 @@ builtins = \If one or both of the arguments are chars, \ \they are converted to numbers according to Nekomata's code page.\n\ \This function is automatically vectorized with padding." - [] + [ ("5 3X", All False ["6"]) + , ("[5,6] [3,4]X", All False ["[6,2]"]) + , ("5 [3,4]X", All False ["[6,1]"]) + , ("[5] [3,4]X", All False ["[6,4]"]) + ] , Builtin "popCount" 'Þ' popCount' "Count the number of 1s in the binary digits of an integer.\n\ + \If the number is smaller than zero, the result is also negated.\n\ \If the argument is a char, \ \it is converted to a number according to Nekomata's code page.\n\ \This function is automatically vectorized." - [] + [ ("13Þ", All False ["3"]) + , ("[-13,0,13]Þ", All False ["[-3,0,3]"]) + ] , Builtin "histogram" 'Ħ' @@ -1285,6 +1300,7 @@ builtins = \whose length is the maximum of the input list, \ \and whose nth element is the number of occurrences \ \of n in the input.\n\ + \Fails when the list contains negative integers or fractions.\n\ \If the input is a ragged list, \ \it is flattened before computation.\n\ \If the input is a single integer, \ @@ -1292,7 +1308,11 @@ builtins = \If the input is a single char, \ \it is converted to a number according to Nekomata's code page, \ \and then treated as a singleton list." - [] + [ ("0Ħ", All False ["[1]"]) + , ("1Ħ", All False ["[0,1]"]) + , ("[1,2,3,2,1]Ħ", All False ["[0,2,2,1]"]) + , ("[[1,2],[3,2],[1]]Ħ", All False ["[0,2,2,1]"]) + ] , Builtin "sumEach" 'Ŝ' @@ -1301,7 +1321,10 @@ builtins = \The addition is automatically vectorized with padding zeros.\n\ \If some of the elements are chars, \ \they are converted to numbers according to Nekomata's code page." - [] + [ ("[[1,2],[3,4]]Ŝ", All False ["[3,7]"]) + , ("[[1,2],[3,4],[5]]Ŝ", All False ["[3,7,5]"]) + , ("[[[1,2],[3,4]],[[5,6],[7,8]]]Ŝ", All False ["[[4,6],[12,14]]"]) + ] , Builtin "charToInt" 'e' @@ -1309,7 +1332,9 @@ builtins = "Convert a char to an integer according to Nekomata's code page.\n\ \If the input is already an integer, it is left unchanged.\n\ \This function is automatically vectorized." - [] + [ ("'a e", All False ["97"]) + , ("\"Hello\"e", All False ["[72,101,108,108,111]"]) + ] , Builtin "intToChar" 'H' @@ -1318,7 +1343,9 @@ builtins = \If the input is already a char, it is left unchanged.\n\ \Fail when the integer is not in the range 0 to 255.\n\ \This function is automatically vectorized." - [] + [ ("97H", All False ["'a'"]) + , ("[72,101,108,108,111]H", All False ["Hello"]) + ] , Builtin "read" 'Ĝ' @@ -1326,13 +1353,18 @@ builtins = "Parse a string (a list of chars) or a single char \ \as a Nekomata value.\n\ \Fail when the string is not a valid Nekomata value." - [] + [ ("'1 Ĝ", All False ["1"]) + , ("\"[1,2,3]\"Ĝ", All False ["[1,2,3]"]) + ] , Builtin "show" 'ĝ' show' "Convert a Nekomata value to a string (a list of chars)." - [] + [ ("1ĝU", All False ["[\"1\"]"]) + , ("[1,2,3]ĝU", All False ["[\"[1,2,3]\"]"]) + , ("\"Hello\"ĝU", All False ["[\"\\\"Hello\\\"\"]"]) + ] , Builtin "anyOf" '~' @@ -1341,119 +1373,161 @@ builtins = \If the argument is a number, \ \it is converted to a range from 0 to that number minus 1.\n\ \This function is non-deterministic." - [] + [ ("[]~", All False []) + , ("[1,2,3]~", All False ["1", "2", "3"]) + , ("5~", All False ["0", "1", "2", "3", "4"]) + ] , Builtin "emptyList" 'Ø' emptyList "Push an empty list." - [] + [("Ø", All False ["[]"])] , Builtin "singleton" 'U' singleton' "Create a list with a single element." - [] + [ ("1U", All False ["[1]"]) + , ("[1]U", All False ["[[1]]"]) + ] , Builtin "unsingleton" 'z' unsingleton "Get the only element of a list with a single element.\n\ \Fails when the list is empty or has more than one element." - [] + [ ("[1]z", All False ["1"]) + , ("[[1]]z", All False ["[1]"]) + , ("[]z", All False []) + , ("[1,2]z", All False []) + ] , Builtin "pair" 'Ð' pair "Create a list with two elements." - [] + [ ("1 2Ð", All False ["[1,2]"]) + , ("[1] 2Ð", All False ["[[1],2]"]) + ] , Builtin "unpair" 'đ' unpair "Get the two elements of a list with two elements.\n\ \Fails when the length of the list is not 2." - [] + [ ("[1,2]đ+", All False ["3"]) + , ("[]đ", All False []) + , ("[1]đ", All False []) + , ("[1,2,3]đ", All False []) + ] , Builtin "removeFail" '‼' removeFail "Remove failed items from a list." - [] + [ ("[1,2,3]‼", All False ["[1,2,3]"]) + , ("[1,0,3]P‼", All False ["[1,3]"]) + ] , Builtin "length" '#' length' "Get the length of a list." - [] + [ ("[1,2,3]#", All False ["3"]) + , ("[]#", All False ["0"]) + ] , Builtin "lengthIs" 'L' lengthIs "Check if the length of a list is equal to a given integer.\n\ \If it is, push the list itself, otherwise fail." - [] + [ ("[1,2,3] 3L", All False ["[1,2,3]"]) + , ("[1,2,3] 4L", All False []) + ] , Builtin "nth" '@' nth "Get the nth element of a list.\n\ + \The index is 0-based.\n\ \This function is automatically vectorized on the second argument." - [] + [ ("[1,2,3] 1@", All False ["2"]) + , ("[1,2,3] [1,2]@", All False ["[2,3]"]) + ] , Builtin "head" 'h' head' "Get the first element of a list." - [] + [ ("[1,2,3]h", All False ["1"]) + , ("[]h", All False []) + ] , Builtin "tail" 't' tail' "Remove the first element of a list." - [] + [ ("[1,2,3]t", All False ["[2,3]"]) + , ("[]t", All False []) + ] , Builtin "cons" 'c' cons "Prepend an element to a list." - [] + [ ("[2,3] 1c", All False ["[1,2,3]"]) + , ("[] 1c", All False ["[1]"]) + ] , Builtin "uncons" 'C' uncons "Get the first element and the rest of a list." - [] + [ ("[1,2,3]CÐ", All False ["[[2,3],1]"]) + , ("[]C", All False []) + ] , Builtin "last" 'l' last' "Get the last element of a list." - [] + [ ("[1,2,3]l", All False ["3"]) + , ("[]l", All False []) + ] , Builtin "init" 'i' init' "Remove the last element of a list." - [] + [ ("[1,2,3]i", All False ["[1,2]"]) + , ("[]i", All False []) + ] , Builtin "snoc" 'ɔ' snoc "Append an element to a list." - [] + [ ("[1,2] 3ɔ", All False ["[1,2,3]"]) + , ("[] 1ɔ", All False ["[1]"]) + ] , Builtin "unsnoc" 'Ɔ' unsnoc "Get the last element and the rest of a list." - [] + [ ("[1,2,3]ƆÐ", All False ["[[1,2],3]"]) + , ("[]Ɔ", All False []) + ] , Builtin "cons0" 'ç' cons0 "Prepend a zero to a list." - [] + [ ("[1,2,3]ç", All False ["[0,1,2,3]"]) + , ("[]ç", All False ["[0]"]) + ] , Builtin "reverse" '↔' @@ -1461,7 +1535,9 @@ builtins = "Reverse a list.\n\ \If the argument is a number, \ \it is converted to a range from 0 to that number minus 1." - [] + [ ("[1,2,3]↔", All False ["[3,2,1]"]) + , ("3↔", All False ["[2,1,0]"]) + ] , Builtin "prefix" 'p' @@ -1470,7 +1546,9 @@ builtins = \If the argument is a number, \ \it is converted to a range from 0 to that number minus 1.\n\ \This function is non-deterministic." - [] + [ ("[1,2,3]p", All False ["[]", "[1]", "[1,2]", "[1,2,3]"]) + , ("3p", All False ["[]", "[0]", "[0,1]", "[0,1,2]"]) + ] , Builtin "suffix" 's' @@ -1479,14 +1557,20 @@ builtins = \If the argument is a number, \ \it is converted to a range from 0 to that number minus 1.\n\ \This function is non-deterministic." - [] + [ ("[1,2,3]s", All False ["[1,2,3]", "[2,3]", "[3]", "[]"]) + , ("3s", All False ["[0,1,2]", "[1,2]", "[2]", "[]"]) + ] , Builtin "take" 'T' take' "Get the first n elements of a list.\n\ + \Fail when the list is shorter than n.\n\ \This function is automatically vectorized on the second argument." - [] + [ ("[1,2,3] 2T", All False ["[1,2]"]) + , ("[1,2,3] 4T", All False []) + , ("[1,2,3] [2,3]T", All False ["[[1,2],[1,2,3]]"]) + ] , Builtin "subset" 'S' @@ -1495,7 +1579,9 @@ builtins = \If the argument is a number, \ \it is converted to a range from 0 to that number minus 1.\n\ \This function is non-deterministic." - [] + [ ("[1,2] S", All False ["[]", "[1]", "[2]", "[1,2]"]) + , ("2S", All False ["[]", "[0]", "[1]", "[0,1]"]) + ] , Builtin "subsequence" 'q' @@ -1504,7 +1590,9 @@ builtins = \If the argument is a number, \ \it is converted to a range from 0 to that number minus 1.\n\ \This function is non-deterministic." - [] + [ ("[1,2,3]q", All False ["[]", "[1]", "[1,2]", "[1,2,3]", "[2]", "[2,3]", "[3]"]) + , ("3q", All False ["[]", "[0]", "[0,1]", "[0,1,2]", "[1]", "[1,2]", "[2]"]) + ] , Builtin "join" ',' @@ -1680,6 +1768,7 @@ builtins = 'Ĩ' index "Get the index of any occurrence of an element in a list.\n\ + \The index is 0-based.\n\ \Fail if the element does not occur in the list.\n\ \This function is non-deterministic." []