382 |
#undef FUNC_NAME |
#undef FUNC_NAME |
383 |
|
|
384 |
|
|
385 |
|
/* This routine differs from the core list-copy in allowing improper lists. |
386 |
|
Maybe the core could allow them similarly. */ |
387 |
|
|
388 |
|
SCM_DEFINE (scm_srfi1_list_copy, "list-copy", 1, 0, 0, |
389 |
|
(SCM lst), |
390 |
|
"Return a copy of the given list @var{lst}.\n" |
391 |
|
"\n" |
392 |
|
"@var{lst} can be a proper or improper list. And if @var{lst}\n" |
393 |
|
"is not a pair then it's treated as the final tail of an\n" |
394 |
|
"improper list and simply returned.") |
395 |
|
#define FUNC_NAME s_scm_srfi1_list_copy |
396 |
|
{ |
397 |
|
SCM newlst; |
398 |
|
SCM * fill_here; |
399 |
|
SCM from_here; |
400 |
|
|
401 |
|
newlst = lst; |
402 |
|
fill_here = &newlst; |
403 |
|
from_here = lst; |
404 |
|
|
405 |
|
while (SCM_CONSP (from_here)) |
406 |
|
{ |
407 |
|
SCM c; |
408 |
|
c = scm_cons (SCM_CAR (from_here), SCM_CDR (from_here)); |
409 |
|
*fill_here = c; |
410 |
|
fill_here = SCM_CDRLOC (c); |
411 |
|
from_here = SCM_CDR (from_here); |
412 |
|
} |
413 |
|
return newlst; |
414 |
|
} |
415 |
|
#undef FUNC_NAME |
416 |
|
|
417 |
|
|
418 |
/* Typechecking for multi-argument MAP and FOR-EACH. |
/* Typechecking for multi-argument MAP and FOR-EACH. |
419 |
|
|
420 |
Verify that each element of the vector ARGV, except for the first, |
Verify that each element of the vector ARGV, except for the first, |