From 34d7df624c34f7b909da7db08dbcbf7d05de84af Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 17 Nov 2014 07:13:18 -0800 Subject: * lib.c (split_str): If the separator string is empty, then unless opt_compat is 100 or less, provide a more consistent behavior, rather than splitting the string into characters. This latter behavior was never documented. * txr.1: Documented. * dep.mk: Updated. --- txr.1 | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'txr.1') diff --git a/txr.1 b/txr.1 index 409fe8a3..c4ae19d8 100644 --- a/txr.1 +++ b/txr.1 @@ -15874,6 +15874,15 @@ The string is broken into pieces according to the gaps left behind by the removed separators, and a list of the remaining pieces is returned. +If +.meta sep +is the empty string, then the separator pieces removed from the +string are considered to be the empty strings between its +characters. In this case, if +.meta string +is of length one or zero, then it is considered to have no such pieces, and a +list of one element is returned containing the original string. + If a match for .meta sep is not found in the string at all, then the string is not @@ -15895,6 +15904,17 @@ This operation is nondestructive: .meta string is not modified in any way. +Note: To split a string into pieces of length one such that an empty string +produces +.code nil +rather than +.codn ("") , +use the +.cblk +.meti (tok-str < string #/./) +.cble +pattern. + .coNP Function @ split-str-set .synb .mets (split-str-set < string << set ) @@ -26036,6 +26056,17 @@ can be emulated is \*(TX 97. Here are values which have a special meaning as arguments to the .code -C option, along with a description of what behaviors are affected: +.IP 100 +Up to \*(TX 100, the +.code split-str +function had an undocumented behavior. When the +.code sep +argument was an empty string, it split the string into +individual characters as if by calling +.codn list-str . +This behavior changed to the currently +documented behavior starting in \*(TX 101. + .IP 99 Up to \*(TX 99, the substitution of TXR Lisp expressions in .code @(output) -- cgit v1.2.3