diff options
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 41 |
1 files changed, 41 insertions, 0 deletions
@@ -8076,6 +8076,47 @@ Examples: ;; split the string where there is a "b" (partition "abcbcbd" (op where @1 (op eql #\eb))) -> ("a" "bc" "bc" "bd") +.SS Funtion partition* + +.TP +Syntax: + + (partition* <sequence> {<index-list> | <index> | <function>}) + +.TP +Description: + +If <sequence> is empty, then partition returns an empty list, and the +second argument is ignored; if it is <function>, it is not called. + +If the second argument is of the form <index-list>, which is a sequence +of strictly increasing non-negative integers, then partition* produces +lazy list of pieces taken from <sequence>. The pieces are formed by +deleting from <sequence> the elements at the positions given +in <index-list>. The pieces are the non-empty sub-strings between +the deleted elements. + +If <index-list> is empty then a one-element list containing the entire +<sequence> is returned. + +If the second argument is a function, then this function is applied +to <sequence>, and the return value of this call is then used in place of the +second argument, which must be an <index> or <index-list>. + +If the second argument is an atom other than a function, it is assumed to be +an integer index, and is turned into an <index-list> of one element. + + +.TP +Examples: + + (partition* '(1 2 3 4 5) '(0 2 4)) -> ((1) (3) (5)) + + (partition* "abcd" '(0 3)) -> "bc" + + (partition* "abcd" '(0 1 2 3)) -> nil + + .SS Function tree-find .TP |