1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00

srfi-1 concatenate concatenate!: move from C to Scheme

* libguile/srfi-1.c (scm_srfi1_concatenate, scm_srfi1_concatenate_x): delete.
* libguile/srfi-1.h (scm_srfi1_concatenate, scm_srfi1_concatenate_x): delete.
* module/srfi/srfi-1.scm: add concatenate and concatenate!.
This commit is contained in:
Rob Browning 2024-07-16 23:30:05 -05:00
parent a816b2484b
commit c62d2962d4
4 changed files with 21 additions and 39 deletions

View file

@ -143,41 +143,6 @@ SCM_DEFINE (scm_srfi1_append_reverse_x, "append-reverse!", 2, 0, 0,
}
#undef FUNC_NAME
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_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_x
{
SCM_VALIDATE_LIST (SCM_ARG1, lstlst);
return scm_append_x (lstlst);
}
#undef FUNC_NAME
SCM_DEFINE (scm_srfi1_count, "count", 2, 0, 1,
(SCM pred, SCM list1, SCM rest),
"Return a count of the number of times @var{pred} returns true\n"

View file

@ -26,8 +26,6 @@
SCM_INTERNAL SCM scm_srfi1_append_reverse (SCM revhead, SCM tail);
SCM_INTERNAL SCM scm_srfi1_append_reverse_x (SCM revhead, SCM tail);
SCM_INTERNAL SCM scm_srfi1_concatenate (SCM lstlst);
SCM_INTERNAL SCM scm_srfi1_concatenate_x (SCM lstlst);
SCM_INTERNAL SCM scm_srfi1_count (SCM pred, SCM list1, SCM rest);
SCM_INTERNAL SCM scm_srfi1_delete_duplicates (SCM lst, SCM pred);
SCM_INTERNAL SCM scm_srfi1_delete_duplicates_x (SCM lst, SCM pred);