Warning: This is the manual of the legacy Guile 2.2 series. You may want to read the manual of the current stable series instead.

Next: , Up: SRFI-1   [Contents][Index]


7.5.3.1 Constructors

New lists can be constructed by calling one of the following procedures.

Scheme Procedure: xcons d a

Like cons, but with interchanged arguments. Useful mostly when passed to higher-order procedures.

Scheme Procedure: list-tabulate n init-proc

Return an n-element list, where each list element is produced by applying the procedure init-proc to the corresponding list index. The order in which init-proc is applied to the indices is not specified.

Scheme Procedure: list-copy lst

Return a new list containing the elements of the list lst.

This function differs from the core list-copy (see List Constructors) in accepting improper lists too. And if lst is not a pair at all then it’s treated as the final tail of an improper list and simply returned.

Scheme Procedure: circular-list elt1 elt2 …

Return a circular list containing the given arguments elt1 elt2 ….

Scheme Procedure: iota count [start step]

Return a list containing count numbers, starting from start and adding step each time. The default start is 0, the default step is 1. For example,

(iota 6)        ⇒ (0 1 2 3 4 5)
(iota 4 2.5 -2) ⇒ (2.5 0.5 -1.5 -3.5)

This function takes its name from the corresponding primitive in the APL language.