Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-release > by-pkgid > 6b3585ea67ce3e79c9049b5b33294cdd > files > 647

docbook-style-dsssl-doc-1.79-16.mga7.noarch.rpm

<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>