1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 21:40:33 +02:00

(scm_string_for_each): Reverse order of first 2 args.

(scm_string_for_each_index): New func.

Thanks to Alex Shinn.
This commit is contained in:
Thien-Thi Nguyen 2001-08-24 22:12:45 +00:00
parent 24205ce1cd
commit 9a6b38abe1

View file

@ -2637,7 +2637,7 @@ SCM_DEFINE (scm_string_unfold_right, "string-unfold-right", 4, 2, 0,
SCM_DEFINE (scm_string_for_each, "string-for-each", 2, 2, 0,
(SCM s, SCM proc, SCM start, SCM end),
(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.")
#define FUNC_NAME s_scm_string_for_each
@ -2645,10 +2645,10 @@ SCM_DEFINE (scm_string_for_each, "string-for-each", 2, 2, 0,
char * cstr;
int cstart, cend;
SCM_VALIDATE_SUBSTRING_SPEC_COPY (1, s, cstr,
SCM_VALIDATE_PROC (1, proc);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s, cstr,
3, start, cstart,
4, end, cend);
SCM_VALIDATE_PROC (2, proc);
while (cstart < cend)
{
scm_call_1 (proc, SCM_MAKE_CHAR (cstr[cstart]));
@ -2658,6 +2658,28 @@ SCM_DEFINE (scm_string_for_each, "string-for-each", 2, 2, 0,
}
#undef FUNC_NAME
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.")
#define FUNC_NAME s_scm_string_for_each
{
char * cstr;
int cstart, cend;
SCM_VALIDATE_PROC (1, proc);
SCM_VALIDATE_SUBSTRING_SPEC_COPY (2, s, cstr,
3, start, cstart,
4, end, cend);
while (cstart < cend)
{
scm_call_1 (proc, SCM_MAKINUM (cstart));
cstart++;
}
return SCM_UNSPECIFIED;
}
#undef FUNC_NAME
SCM_DEFINE (scm_xsubstring, "xsubstring", 2, 3, 0,
(SCM s, SCM from, SCM to, SCM start, SCM end),
"This is the @emph{extended substring} procedure that implements\n"