(scm_string_for_each_index): Correction to docstring.
authorKevin Ryde <user42@zip.com.au>
Fri, 12 Aug 2005 01:14:02 +0000 (01:14 +0000)
committerKevin Ryde <user42@zip.com.au>
Fri, 12 Aug 2005 01:14:02 +0000 (01:14 +0000)
libguile/srfi-13.c

index ee4a09a..a98b755 100644 (file)
@@ -3010,8 +3010,22 @@ SCM_DEFINE (scm_string_for_each, "string-for-each", 2, 2, 0,
 
 SCM_DEFINE (scm_string_for_each_index, "string-for-each-index", 2, 2, 0,
            (SCM proc, SCM s, SCM start, SCM end),
-           "@var{proc} is mapped over @var{s} in left-to-right order.  The\n"
-           "return value is not specified.")
+           "Call @code{(@var{proc} i)} for each index i in @var{s}, from\n"
+           "left to right.\n"
+           "\n"
+           "For example, to change characters to alternately upper and\n"
+           "lower case,\n"
+           "\n"
+           "@example\n"
+           "(define str (string-copy \"studly\"))\n"
+           "(string-for-each-index\n"
+           "    (lambda (i)\n"
+           "      (string-set! str i\n"
+           "        ((if (even? i) char-upcase char-downcase)\n"
+           "         (string-ref str i))))\n"
+           "    str)\n"
+           "str @result{} \"StUdLy\"\n"
+           "@end example")
 #define FUNC_NAME s_scm_string_for_each_index
 {
   size_t cstart, cend;