mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 04:10:18 +02:00
(scm_make_list): New code, moving make-list from boot-9.scm.
This commit is contained in:
parent
1d936c056b
commit
2ac6b60e86
1 changed files with 21 additions and 0 deletions
|
@ -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_DEFINE (scm_cons_star, "cons*", 1, 0, 1,
|
||||||
(SCM arg, SCM rest),
|
(SCM arg, SCM rest),
|
||||||
"Like @code{list}, but the last arg provides the tail of the\n"
|
"Like @code{list}, but the last arg provides the tail of the\n"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue