1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
<RefEntry id="join">
<!-- This file is generated automatically from the DSSSL source. -->
<!-- Do not edit this file! -->
<?html-filename join.html>
<RefMeta>
<RefEntryTitle>join</RefEntryTitle>
<RefMiscInfo Role="file">dblib.dsl</RefMiscInfo>
</RefMeta>
<RefNameDiv>
<RefName>join</RefName>
<RefPurpose>Joins a list of strings together</RefPurpose>
</RefNameDiv>
<RefSynopsisDiv><Title>Synopsis</Title>
<Synopsis>
(join slist #!optional (space " "))
</Synopsis>
</RefSynopsisDiv>
<RefSect1><Title>Description</Title>
<para>
Given a list of strings and a space string, returns the string
that results from joining all the strings in the list together,
separated by space.
</para>
<variablelist>
<varlistentry><term><literal>slist</literal></term>
<listitem>
<para>
The list of strings.
</para>
</listitem>
</varlistentry>
<varlistentry><term><literal>space</literal></term>
<listitem>
<para>
The string to place between each member of the list. Defaults to
a single space.
</para>
</listitem>
</varlistentry>
</variablelist>
</RefSect1>
<RefSect1><Title>Author</Title>
<para>
David Carlisle</para>
</RefSect1>
<RefSect1><Title>Source Code</Title>
<ProgramListing>
(define (join slist #!optional (space " "))
;; Joins a list of strings together
(letrec ((loop (lambda (l result)
(if (null? l)
result
(loop (cdr l) (cons space (cons (car l) result)))))))
(if (null? slist)
""
(apply string-append (cons (car slist)
(loop (reverse (cdr slist)) '() ))))))
</ProgramListing>
</RefSect1>
</RefEntry>
|