diff --git a/content/reference.md b/content/reference.md index ea31001..4fd259f 100644 --- a/content/reference.md +++ b/content/reference.md @@ -5820,7 +5820,7 @@ Set the `i`th value of the `LispArray` `v` to `x`. ### Values -#### (ALL F? XS) [FUNCTION] · src +#### (ALL F? XS) [FUNCTION] · src ∀ :A. ((:A → Boolean) → (List :A) → Boolean) Returns `True` if every element in `xs` matches `f?`. @@ -5829,7 +5829,7 @@ Returns `True` if every element in `xs` matches `f?`. *** -#### (ANY F? L) [FUNCTION] · src +#### (ANY F? L) [FUNCTION] · src ∀ :A. ((:A → Boolean) → (List :A) → Boolean) Returns `True` if at least one element in `xs` matches `f?`. @@ -5838,7 +5838,7 @@ Returns `True` if at least one element in `xs` matches `f?`. *** -#### (APPEND XS YS) [FUNCTION] · src +#### (APPEND XS YS) [FUNCTION] · src ∀ :A. ((List :A) → (List :A) → (List :A)) Appends two lists together and returns a new list. @@ -5847,7 +5847,7 @@ Appends two lists together and returns a new list. *** -#### (CAR X) [FUNCTION] · src +#### (CAR X) [FUNCTION] · src ∀ :A. ((List :A) → :A) Return the traditional car of a list. This function is partial @@ -5856,7 +5856,7 @@ Return the traditional car of a list. This function is partial *** -#### (CDR XS) [FUNCTION] · src +#### (CDR XS) [FUNCTION] · src ∀ :A. ((List :A) → (List :A)) Return the traditional cdr of a list. @@ -5865,7 +5865,7 @@ Return the traditional cdr of a list. *** -#### (COMBS L) [FUNCTION] · src +#### (COMBS L) [FUNCTION] · src ∀ :A. ((List :A) → (List (List :A))) Compute a list of all combinations of elements of `l`. This function is sometimes goes by the name "power set" or "subsets". @@ -5876,7 +5876,7 @@ The ordering of elements of `l` is preserved in the ordering of elements in each *** -#### (COMBSOF N L) [FUNCTION] · src +#### (COMBSOF N L) [FUNCTION] · src ∀ :A. (UFix → (List :A) → (List (List :A))) Produce a list of size-N subsets of `l`. @@ -5889,7 +5889,7 @@ This function is equivalent to all size-`n` elements of `(combs l)`. *** -#### (CONCAT XS) [FUNCTION] · src +#### (CONCAT XS) [FUNCTION] · src ∀ :A. ((List (List :A)) → (List :A)) Appends a list of lists together into a single new list. @@ -5898,7 +5898,7 @@ Appends a list of lists together into a single new list. *** -#### (CONCATMAP F XS) [FUNCTION] · src +#### (CONCATMAP F XS) [FUNCTION] · src ∀ :A :B. ((:A → (List :B)) → (List :A) → (List :B)) Apply F to each element in XS and concatenate the results. @@ -5907,7 +5907,7 @@ Apply F to each element in XS and concatenate the results. *** -#### (CONS? XS) [FUNCTION] · src +#### (CONS? XS) [FUNCTION] · src ∀ :A. ((List :A) → Boolean) Returns TRUE if XS is a non-empty list. @@ -5916,7 +5916,7 @@ Returns TRUE if XS is a non-empty list. *** -#### (COUNTBY F THINGS) [FUNCTION] · src +#### (COUNTBY F THINGS) [FUNCTION] · src ∀ :A. ((:A → Boolean) → (List :A) → UFix) Count the number of items in THINGS that satisfy the predicate F. @@ -5925,7 +5925,7 @@ Count the number of items in THINGS that satisfy the predicate F. *** -#### (DIFFERENCE XS YS) [FUNCTION] · src +#### (DIFFERENCE XS YS) [FUNCTION] · src ∀ :A. Eq :A ⇒ ((List :A) → (List :A) → (List :A)) Returns a new list with the first occurence of each element in `ys` removed from `xs`. @@ -5934,7 +5934,7 @@ Returns a new list with the first occurence of each element in `ys` removed from *** -#### (DROP N XS) [FUNCTION] · src +#### (DROP N XS) [FUNCTION] · src ∀ :A. (UFix → (List :A) → (List :A)) Returns a list with the first N elements removed. @@ -5943,19 +5943,19 @@ Returns a list with the first N elements removed. *** -#### (ELEMINDEX X XS) [FUNCTION] · src +#### (ELEMINDEX X XS) [FUNCTION] · src ∀ :A. Eq :A ⇒ (:A → (List :A) → (Optional UFix)) *** -#### (EQUIVALENCE-CLASSES) [FUNCTION] · src +#### (EQUIVALENCE-CLASSES) [FUNCTION] · src ∀ :A. Eq :A ⇒ ((List :A) → (List (List :A))) *** -#### (EQUIVALENCE-CLASSES-BY F L) [FUNCTION] · src +#### (EQUIVALENCE-CLASSES-BY F L) [FUNCTION] · src ∀ :A. ((:A → :A → Boolean) → (List :A) → (List (List :A))) Break a list into a list of equivalence classes according to an equivalence relation. @@ -5964,7 +5964,7 @@ Break a list into a list of equivalence classes according to an equivalence rela *** -#### (FILTER F XS) [FUNCTION] · src +#### (FILTER F XS) [FUNCTION] · src ∀ :A. ((:A → Boolean) → (List :A) → (List :A)) Returns a new list containing every element of XS that matches the predicate function F in the same order. @@ -5973,7 +5973,7 @@ Returns a new list containing every element of XS that matches the predicate fun *** -#### (FIND F XS) [FUNCTION] · src +#### (FIND F XS) [FUNCTION] · src ∀ :A. ((:A → Boolean) → (List :A) → (Optional :A)) Returns the first element in a list matching the predicate function F. @@ -5982,7 +5982,7 @@ Returns the first element in a list matching the predicate function F. *** -#### (FINDINDEX F XS) [FUNCTION] · src +#### (FINDINDEX F XS) [FUNCTION] · src ∀ :A. ((:A → Boolean) → (List :A) → (Optional UFix)) Returns the index of the first element matching the predicate function F. @@ -5991,7 +5991,7 @@ Returns the index of the first element matching the predicate function F. *** -#### (HEAD L) [FUNCTION] · src +#### (HEAD L) [FUNCTION] · src ∀ :A. ((List :A) → (Optional :A)) Returns the first element of a list. @@ -6000,7 +6000,7 @@ Returns the first element of a list. *** -#### (INDEX I XS) [FUNCTION] · src +#### (INDEX I XS) [FUNCTION] · src ∀ :A. (UFix → (List :A) → (Optional :A)) Returns the Ith element of a list. @@ -6009,7 +6009,7 @@ Returns the Ith element of a list. *** -#### (INIT L) [FUNCTION] · src +#### (INIT L) [FUNCTION] · src ∀ :A. ((List :A) → (List :A)) Returns every element except the last in a list. @@ -6018,7 +6018,7 @@ Returns every element except the last in a list. *** -#### (INSERT E LS) [FUNCTION] · src +#### (INSERT E LS) [FUNCTION] · src ∀ :A. Ord :A ⇒ (:A → (List :A) → (List :A)) Inserts an element into a list at the first place it is less than or equal to the next element. @@ -6027,7 +6027,7 @@ Inserts an element into a list at the first place it is less than or equal to th *** -#### (INSERTBY CMP X YS) [FUNCTION] · src +#### (INSERTBY CMP X YS) [FUNCTION] · src ∀ :A. ((:A → :A → Ord) → :A → (List :A) → (List :A)) Generic version of insert @@ -6036,7 +6036,7 @@ Generic version of insert *** -#### (INSERTIONS A L) [FUNCTION] · src +#### (INSERTIONS A L) [FUNCTION] · src ∀ :A. (:A → (List :A) → (List (List :A))) Produce a list of copies of `l`, each with A inserted at a possible position. @@ -6049,7 +6049,7 @@ Produce a list of copies of `l`, each with A inserted at a possible position. *** -#### (INTERCALATE XS XSS) [FUNCTION] · src +#### (INTERCALATE XS XSS) [FUNCTION] · src ∀ :A. ((List :A) → (List (List :A)) → (List :A)) Intersperse `xs` into `xss` and then concatenate the result. @@ -6058,7 +6058,7 @@ Intersperse `xs` into `xss` and then concatenate the result. *** -#### (INTERSECTION XS YS) [FUNCTION] · src +#### (INTERSECTION XS YS) [FUNCTION] · src ∀ :A. Eq :A ⇒ ((List :A) → (List :A) → (List :A)) Returns elements which occur in both lists. Does not return duplicates and does not guarantee order. @@ -6067,7 +6067,7 @@ Returns elements which occur in both lists. Does not return duplicates and does *** -#### (INTERSPERSE E XS) [FUNCTION] · src +#### (INTERSPERSE E XS) [FUNCTION] · src ∀ :A. (:A → (List :A) → (List :A)) Returns a new list by inserting `e` between every element of `xs`. @@ -6076,7 +6076,7 @@ Returns a new list by inserting `e` between every element of `xs`. *** -#### (LAST L) [FUNCTION] · src +#### (LAST L) [FUNCTION] · src ∀ :A. ((List :A) → (Optional :A)) Returns the last element of a list. @@ -6085,7 +6085,7 @@ Returns the last element of a list. *** -#### (LENGTH L) [FUNCTION] · src +#### (LENGTH L) [FUNCTION] · src ∀ :A. ((List :A) → UFix) Returns the length of a list. @@ -6094,7 +6094,7 @@ Returns the length of a list. *** -#### (LOOKUP E XS) [FUNCTION] · src +#### (LOOKUP E XS) [FUNCTION] · src ∀ :A :B. Eq :A ⇒ (:A → (List (Tuple :A :B)) → (Optional :B)) Returns the value of the first (key, value) tuple in XS where the key matches E. @@ -6103,7 +6103,7 @@ Returns the value of the first (key, value) tuple in XS where the key matches E. *** -#### (MAXIMUM L) [FUNCTION] · src +#### (MAXIMUM L) [FUNCTION] · src ∀ :A. Ord :A ⇒ ((List :A) → (Optional :A)) Returns a greatest element of a list, or `None`. @@ -6112,7 +6112,7 @@ Returns a greatest element of a list, or `None`. *** -#### (MEMBER E XS) [FUNCTION] · src +#### (MEMBER E XS) [FUNCTION] · src ∀ :A. Eq :A ⇒ (:A → (List :A) → Boolean) Returns true if any element of XS is equal to E. @@ -6121,7 +6121,7 @@ Returns true if any element of XS is equal to E. *** -#### (MINIMUM L) [FUNCTION] · src +#### (MINIMUM L) [FUNCTION] · src ∀ :A. Ord :A ⇒ ((List :A) → (Optional :A)) Returns a least element of a list, or `None`. @@ -6130,7 +6130,7 @@ Returns a least element of a list, or `None`. *** -#### (NTH N L) [FUNCTION] · src +#### (NTH N L) [FUNCTION] · src ∀ :A. (UFix → (List :A) → :A) Like INDEX, but errors if the index is not found. @@ -6139,7 +6139,7 @@ Like INDEX, but errors if the index is not found. *** -#### (NTH-CDR N L) [FUNCTION] · src +#### (NTH-CDR N L) [FUNCTION] · src ∀ :A. (UFix → (List :A) → (List :A)) Returns the nth-cdr of a list. @@ -6148,7 +6148,7 @@ Returns the nth-cdr of a list. *** -#### (NULL? XS) [FUNCTION] · src +#### (NULL? XS) [FUNCTION] · src ∀ :A. ((List :A) → Boolean) Returns TRUE if XS is an empty list. @@ -6157,7 +6157,7 @@ Returns TRUE if XS is an empty list. *** -#### (OPTIMUMBY F XS) [FUNCTION] · src +#### (OPTIMUMBY F XS) [FUNCTION] · src ∀ :A. ((:A → :A → Boolean) → (List :A) → (Optional :A)) Returns an optimum according to a total order. @@ -6166,7 +6166,7 @@ Returns an optimum according to a total order. *** -#### (PARTITION F XS) [FUNCTION] · src +#### (PARTITION F XS) [FUNCTION] · src ∀ :A. ((:A → Boolean) → (List :A) → (Tuple (List :A) (List :A))) Splits a list into two new lists. The first list contains elements matching predicate F. @@ -6175,7 +6175,7 @@ Splits a list into two new lists. The first list contains elements matching pred *** -#### (PERMS L) [FUNCTION] · src +#### (PERMS L) [FUNCTION] · src ∀ :A. ((List :A) → (List (List :A))) Produce all permutations of the list L. @@ -6184,7 +6184,7 @@ Produce all permutations of the list L. *** -#### (PRODUCT XS) [FUNCTION] · src +#### (PRODUCT XS) [FUNCTION] · src ∀ :A. Num :A ⇒ ((List :A) → :A) Returns the product of `xs`. @@ -6193,7 +6193,7 @@ Returns the product of `xs`. *** -#### (RANGE START END) [FUNCTION] · src +#### (RANGE START END) [FUNCTION] · src ∀ :A. (Num :A) (Ord :A) ⇒ (:A → :A → (List :A)) Returns a list containing the numbers from START to END inclusive, counting by 1. @@ -6209,7 +6209,7 @@ Returns a list containing the numbers from START to END inclusive, counting by 1 *** -#### (REMOVE X YS) [FUNCTION] · src +#### (REMOVE X YS) [FUNCTION] · src ∀ :A. Eq :A ⇒ (:A → (List :A) → (List :A)) Return a new list with the first element equal to `x` removed. @@ -6218,7 +6218,7 @@ Return a new list with the first element equal to `x` removed. *** -#### (REMOVE-DUPLICATES XS) [FUNCTION] · src +#### (REMOVE-DUPLICATES XS) [FUNCTION] · src ∀ :A. Eq :A ⇒ ((List :A) → (List :A)) Returns a new list without duplicate elements. @@ -6227,7 +6227,7 @@ Returns a new list without duplicate elements. *** -#### (REMOVE-IF PRED XS) [FUNCTION] · src +#### (REMOVE-IF PRED XS) [FUNCTION] · src ∀ :A. ((:A → Boolean) → (List :A) → (List :A)) Return a new list with the first element for which PRED is `True` is removed. @@ -6236,7 +6236,7 @@ Return a new list with the first element for which PRED is `True` is removed. *** -#### (REPEAT N X) [FUNCTION] · src +#### (REPEAT N X) [FUNCTION] · src ∀ :A. (UFix → :A → (List :A)) Returns a list with the same value repeated multiple times. @@ -6245,7 +6245,7 @@ Returns a list with the same value repeated multiple times. *** -#### (REVERSE XS) [FUNCTION] · src +#### (REVERSE XS) [FUNCTION] · src ∀ :A. ((List :A) → (List :A)) Returns a new list containing the same elements in reverse order. @@ -6254,7 +6254,7 @@ Returns a new list containing the same elements in reverse order. *** -#### (SINGLETON X) [FUNCTION] · src +#### (SINGLETON X) [FUNCTION] · src ∀ :A. (:A → (List :A)) Returns a list containing one element. @@ -6263,7 +6263,7 @@ Returns a list containing one element. *** -#### (SINGLETON? XS) [FUNCTION] · src +#### (SINGLETON? XS) [FUNCTION] · src ∀ :A. ((List :A) → Boolean) Is `xs` a list containing exactly one element? @@ -6272,7 +6272,7 @@ Is `xs` a list containing exactly one element? *** -#### (SORT XS) [FUNCTION] · src +#### (SORT XS) [FUNCTION] · src ∀ :A. Ord :A ⇒ ((List :A) → (List :A)) Sort `xs`. @@ -6281,7 +6281,7 @@ Sort `xs`. *** -#### (SORTBY CMP XS) [FUNCTION] · src +#### (SORTBY CMP XS) [FUNCTION] · src ∀ :A. ((:A → :A → Ord) → (List :A) → (List :A)) Sort `xs` by a custom comparison function `cmp`. @@ -6290,16 +6290,25 @@ Sort `xs` by a custom comparison function `cmp`. *** -#### (SPLIT C STR) [FUNCTION] · src -(CharString → (List String)) +#### (SPLIT-AROUND N XS) [FUNCTION] · src +∀ :A. (UFix → (List :A) → (Tuple3 (List :A) (Optional :A) (List :A))) + +Splits a list around N into a Tuple of the first N elements, the element at index N, and a tail of all remaining elements. N must be a valid index. + + + +*** + +#### (SPLIT-AT N XS) [FUNCTION] · src +∀ :A. (UFix → (List :A) → (Tuple (List :A) (List :A))) -Split a string `str` into a list of substrings by the character `c`. +Splits a list into a Tuple of the first N elements and all remaining elements. The return value is equivalent to `(Tuple (take n xs) (drop n xs)`. *** -#### (SUM XS) [FUNCTION] · src +#### (SUM XS) [FUNCTION] · src ∀ :A. Num :A ⇒ ((List :A) → :A) Returns the sum of `xs`. @@ -6308,7 +6317,7 @@ Returns the sum of `xs`. *** -#### (TAIL L) [FUNCTION] · src +#### (TAIL L) [FUNCTION] · src ∀ :A. ((List :A) → (Optional (List :A))) Returns every element except the first in a list. @@ -6317,7 +6326,7 @@ Returns every element except the first in a list. *** -#### (TAKE N XS) [FUNCTION] · src +#### (TAKE N XS) [FUNCTION] · src ∀ :A. (UFix → (List :A) → (List :A)) Returns the first N elements of a list. @@ -6326,7 +6335,7 @@ Returns the first N elements of a list. *** -#### (TRANSPOSE XS) [FUNCTION] · src +#### (TRANSPOSE XS) [FUNCTION] · src ∀ :A. ((List (List :A)) → (List (List :A))) Transposes a matrix represented by a list of lists. @@ -6335,7 +6344,7 @@ Transposes a matrix represented by a list of lists. *** -#### (UNION XS YS) [FUNCTION] · src +#### (UNION XS YS) [FUNCTION] · src ∀ :A. Eq :A ⇒ ((List :A) → (List :A) → (List :A)) Returns a new list with the elements from both XS and YS and without duplicates. @@ -6344,7 +6353,7 @@ Returns a new list with the elements from both XS and YS and without duplicates. *** -#### (ZIP XS YS) [FUNCTION] · src +#### (ZIP XS YS) [FUNCTION] · src ∀ :A :B. ((List :A) → (List :B) → (List (Tuple :A :B))) Builds a list of tuples with the elements of XS and YS. @@ -6353,7 +6362,7 @@ Builds a list of tuples with the elements of XS and YS. *** -#### (ZIPWITH F XS YS) [FUNCTION] · src +#### (ZIPWITH F XS YS) [FUNCTION] · src ∀ :A :B :C. ((:A → :B → :C) → (List :A) → (List :B) → (List :C)) Builds a new list by calling `f` with elements of `xs` and `ys`. @@ -6362,7 +6371,7 @@ Builds a new list by calling `f` with elements of `xs` and `ys`. *** -#### (ZIPWITH3 F XS YS ZS) [FUNCTION] · src +#### (ZIPWITH3 F XS YS ZS) [FUNCTION] · src ∀ :A :B :C :D. ((:A → :B → :C → :D) → (List :A) → (List :B) → (List :C) → (List :D)) Build a new list by calling F with elements of XS, YS and ZS @@ -6371,7 +6380,7 @@ Build a new list by calling F with elements of XS, YS and ZS *** -#### (ZIPWITH4 F AS BS CS DS) [FUNCTION] · src +#### (ZIPWITH4 F AS BS CS DS) [FUNCTION] · src ∀ :A :B :C :D :E. ((:A → :B → :C → :D → :E) → (List :A) → (List :B) → (List :C) → (List :D) → (List :E)) Build a new list by calling F with elements of AS, BS, CS and DS @@ -6380,7 +6389,7 @@ Build a new list by calling F with elements of AS, BS, CS and DS *** -#### (ZIPWITH5 F AS BS CS DS ES) [FUNCTION] · src +#### (ZIPWITH5 F AS BS CS DS ES) [FUNCTION] · src ∀ :A :B :C :D :E :F. ((:A → :B → :C → :D → :E → :F) → (List :A) → (List :B) → (List :C) → (List :D) → (List :E) → (List :F)) Build a new list by calling F with elements of AS, BS, CS, DS and ES @@ -9569,7 +9578,7 @@ Set the element at index `idx` in `s` to `item`. ### Values -#### (CHARS STR) [FUNCTION] · src +#### (CHARS STR) [FUNCTION] · src (String → (Iterator Char)) Returns an iterator over the characters in `str`. @@ -9578,7 +9587,7 @@ Returns an iterator over the characters in `str`. *** -#### (CONCAT STR1 STR2) [FUNCTION] · src +#### (CONCAT STR1 STR2) [FUNCTION] · src (StringStringString) Concatenate STR1 and STR2 together, returning a new string. @@ -9587,7 +9596,7 @@ Concatenate STR1 and STR2 together, returning a new string. *** -#### (DOWNCASE STR) [FUNCTION] · src +#### (DOWNCASE STR) [FUNCTION] · src (StringString) Returns a new string with lowercase characters. @@ -9596,7 +9605,7 @@ Returns a new string with lowercase characters. *** -#### (LENGTH STR) [FUNCTION] · src +#### (LENGTH STR) [FUNCTION] · src (StringUFix) The length of a string STR. @@ -9605,7 +9614,7 @@ The length of a string STR. *** -#### (PARSE-INT STR) [FUNCTION] · src +#### (PARSE-INT STR) [FUNCTION] · src (String → (Optional Integer)) Parse the integer in string `str`. @@ -9614,7 +9623,7 @@ Parse the integer in string `str`. *** -#### (REF STR IDX) [FUNCTION] · src +#### (REF STR IDX) [FUNCTION] · src (StringUFix → (Optional Char)) Return the `idx`th character of `str`. @@ -9623,7 +9632,7 @@ Return the `idx`th character of `str`. *** -#### (REF-UNCHECKED STR IDX) [FUNCTION] · src +#### (REF-UNCHECKED STR IDX) [FUNCTION] · src (StringUFixChar) Return the `idx`th character of `str`. This function is partial. @@ -9632,7 +9641,7 @@ Return the `idx`th character of `str`. This function is partial. *** -#### (REVERSE S) [FUNCTION] · src +#### (REVERSE S) [FUNCTION] · src (StringString) Reverse a string. @@ -9641,16 +9650,25 @@ Reverse a string. *** -#### (SPLIT N STR) [FUNCTION] · src +#### (SPLIT C STR) [FUNCTION] · src +(CharString → (List String)) + +Split a string around the separator character `c`. + + + +*** + +#### (SPLIT-AT N STR) [FUNCTION] · src (UFixString → (Tuple String String)) -Splits a string into a head and tail at the nth index. +Splits a string into a substring of the first N characters and a substring of the remaining characters. *** -#### (STRIP-PREFIX PREFIX STR) [FUNCTION] · src +#### (STRIP-PREFIX PREFIX STR) [FUNCTION] · src (StringString → (Optional String)) Returns a string without a give prefix, or `None` if the string @@ -9660,7 +9678,7 @@ does not have that suffix. *** -#### (STRIP-SUFFIX SUFFIX STR) [FUNCTION] · src +#### (STRIP-SUFFIX SUFFIX STR) [FUNCTION] · src (StringString → (Optional String)) Returns a string without a give suffix, or `None` if the string @@ -9670,7 +9688,7 @@ does not have that suffix. *** -#### (SUBSTRING STR START END) [FUNCTION] · src +#### (SUBSTRING STR START END) [FUNCTION] · src (StringUFixUFixString) Compute a substring of a string bounded by given indices. @@ -9679,7 +9697,7 @@ Compute a substring of a string bounded by given indices. *** -#### (SUBSTRING-INDEX SMALL BIG) [FUNCTION] · src +#### (SUBSTRING-INDEX SMALL BIG) [FUNCTION] · src (StringString → (Optional UFix)) If the first argument appears as a substring within the second argument, return the starting index into the second argument. @@ -9688,7 +9706,7 @@ If the first argument appears as a substring within the second argument, return *** -#### (SUBSTRING? SMALL BIG) [FUNCTION] · src +#### (SUBSTRING? SMALL BIG) [FUNCTION] · src (StringStringBoolean) Return true if the first argument appears as a substring within the second argument. @@ -9697,7 +9715,7 @@ Return true if the first argument appears as a substring within the second argum *** -#### (UPCASE STR) [FUNCTION] · src +#### (UPCASE STR) [FUNCTION] · src (StringString) Returns a new string with uppercase characters.