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

(scm_srfi1_concatenate, scm_srfi1_concatenate_x): Add code

to check argument is a list, scm_append and scm_append_x don't do that
on their "rest" list (in a normal build).
This commit is contained in:
Kevin Ryde 2005-04-03 22:41:15 +00:00
parent dc7b50ed09
commit c66c6d535d
2 changed files with 34 additions and 5 deletions

View file

@ -97,12 +97,39 @@ SCM_DEFINE (scm_srfi1_alist_copy, "alist-copy", 1, 0, 0,
#undef FUNC_NAME
/* scm_append and scm_append_x don't modify their list argument (only the
lists within that list in the case of scm_append_x), hence making them
suitable for direct use for concatentate. */
SCM_DEFINE (scm_srfi1_concatenate, "concatenate", 1, 0, 0,
(SCM lstlst),
"Construct a list by appending all lists in @var{lstlst}.\n"
"\n"
"@code{concatenate} is the same as @code{(apply append\n"
"@var{lstlst})}. It exists because some Scheme implementations\n"
"have a limit on the number of arguments a function takes, which\n"
"the @code{apply} might exceed. In Guile there is no such\n"
"limit.")
#define FUNC_NAME s_scm_srfi1_concatenate
{
SCM_VALIDATE_LIST (SCM_ARG1, lstlst);
return scm_append (lstlst);
}
#undef FUNC_NAME
SCM_REGISTER_PROC (s_srfi1_concatenate, "concatenate", 1, 0, 0, scm_append);
SCM_REGISTER_PROC (s_srfi1_concatenate_x, "concatenate!", 1, 0, 0, scm_append_x);
SCM_DEFINE (scm_srfi1_concatenate_x, "concatenate!", 1, 0, 0,
(SCM lstlst),
"Construct a list by appending all lists in @var{lstlst}. Those\n"
"lists may be modified to produce the result.\n"
"\n"
"@code{concatenate!} is the same as @code{(apply append!\n"
"@var{lstlst})}. It exists because some Scheme implementations\n"
"have a limit on the number of arguments a function takes, which\n"
"the @code{apply} might exceed. In Guile there is no such\n"
"limit.")
#define FUNC_NAME s_scm_srfi1_concatenate
{
SCM_VALIDATE_LIST (SCM_ARG1, lstlst);
return scm_append_x (lstlst);
}
#undef FUNC_NAME
SCM_DEFINE (scm_srfi1_count, "count", 2, 0, 1,

View file

@ -33,6 +33,8 @@
#endif
SCM_SRFI1_API SCM scm_srfi1_alist_copy (SCM alist);
SCM_SRFI1_API SCM scm_srfi1_concatenate (SCM lstlst);
SCM_SRFI1_API SCM scm_srfi1_concatenate_x (SCM lstlst);
SCM_SRFI1_API SCM scm_srfi1_count (SCM pred, SCM list1, SCM rest);
SCM_SRFI1_API SCM scm_srfi1_delete (SCM x, SCM lst, SCM pred);
SCM_SRFI1_API SCM scm_srfi1_delete_x (SCM x, SCM lst, SCM pred);