1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

(scm_make_list): New code, moving make-list from boot-9.scm.

This commit is contained in:
Kevin Ryde 2005-04-23 00:06:14 +00:00
parent 1d936c056b
commit 2ac6b60e86

View file

@ -98,6 +98,27 @@ scm_list_n (SCM elt, ...)
}
SCM_DEFINE (scm_make_list, "make-list", 1, 1, 0,
(SCM n, SCM init),
"Create a list containing of @var{n} elements, where each\n"
"element is initialized to @var{init}. @var{init} defaults to\n"
"the empty list @code{()} if not given.")
#define FUNC_NAME s_scm_srfi1_count
{
unsigned nn = scm_to_uint (n);
unsigned i;
SCM ret = SCM_EOL;
if (SCM_UNBNDP (init))
init = SCM_EOL;
for (i = 0; i < nn; i++)
ret = scm_cons (init, ret);
return ret;
}
#undef FUNC_NAME
SCM_DEFINE (scm_cons_star, "cons*", 1, 0, 1,
(SCM arg, SCM rest),
"Like @code{list}, but the last arg provides the tail of the\n"