mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-16 08:40:19 +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:
parent
a816b2484b
commit
c62d2962d4
4 changed files with 21 additions and 39 deletions
|
@ -445,6 +445,25 @@ a list of those after."
|
|||
|
||||
;;; Miscelleneous: length, append, concatenate, reverse, zip & count
|
||||
|
||||
(define (concatenate lists)
|
||||
"Construct a list by appending all lists in @var{lists}.
|
||||
|
||||
@code{concatenate} is the same as @code{(apply append @var{lists})}.
|
||||
It exists because some Scheme implementations have a limit on the number
|
||||
of arguments a function takes, which the @code{apply} might exceed. In
|
||||
Guile there is no such limit."
|
||||
(apply append lists))
|
||||
|
||||
(define (concatenate! lists)
|
||||
"Construct a list by appending all lists in @var{lists}. Those
|
||||
lists may be modified to produce the result.
|
||||
|
||||
@code{concatenate!} is the same as @code{(apply append! @var{lists})}.
|
||||
It exists because some Scheme implementations have a limit on the number
|
||||
of arguments a function takes, which the @code{apply} might exceed. In
|
||||
Guile there is no such limit."
|
||||
(apply append! lists))
|
||||
|
||||
(define (zip clist1 . rest)
|
||||
(let lp ((l (cons clist1 rest)) (acc '()))
|
||||
(if (any null? l)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue