Merge branch 'master' of /home/mdw/public-git/lisp
[lisp] / str.lisp
index 9f43ed8..104c85a 100644 (file)
--- a/str.lisp
+++ b/str.lisp
@@ -30,8 +30,8 @@
 
 (defun join-strings (del strs)
   "Join together the strings STRS with DEL between them.  All the arguments
-are first converted to strings, as if by `stringify'.  Otherwise, this is
-like Perl's join operator."
+   are first converted to strings, as if by `stringify'.  Otherwise, this is
+   like Perl's join operator."
   (setf del (stringify del))
   (with-output-to-string (s)
     (when strs
@@ -43,12 +43,11 @@ like Perl's join operator."
 
 (defun str-next-word (string &key quotedp start end)
   "Extract a whitespace-delimited word from STRING, returning it and the
-index to continue parsing from.  If no word is found, return nil twice.  If
-QUOTEDP, then allow quoting and backslashifying; otherwise don't.  The START
-and END arguments limit the portion of the string to be processed; the
-default to 0 and nil (end of string), as usual."
-  (unless start (setf start 0))
-  (unless end (setf end (length string)))
+   index to continue parsing from.  If no word is found, return nil twice.
+   If QUOTEDP, then allow quoting and backslashifying; otherwise don't.  The
+   START and END arguments limit the portion of the string to be processed;
+   the default to 0 and nil (end of string), as usual."
+  (setf-default start 0 end (length string))
   (let ((i start)
        (q nil)
        (e nil)
@@ -110,11 +109,11 @@ default to 0 and nil (end of string), as usual."
 
 (defun str-split-words (string &key quotedp start end max)
   "Break STRING into words, like str-next-word does, returning the list of
-the individual words.  If QUOTEDP, then allow quoting and backslashifying;
-otherwise don't.  No more than MAX `words' are returned: if the maximum is
-hit, then the last `word' is unbroken, and may still contain quotes and
-escape characters.  The START and END arguments limit the portion of the
-string to be processed in the usual way."
+   the individual words.  If QUOTEDP, then allow quoting and backslashifying;
+   otherwise don't.  No more than MAX `words' are returned: if the maximum is
+   hit, then the last `word' is unbroken, and may still contain quotes and
+   escape characters.  The START and END arguments limit the portion of the
+   string to be processed in the usual way."
   (when (equal max 0)
     (return-from str-split-words nil))
   (let ((l nil) (n 0))