join

Name

join -- Joins a list of strings together

Synopsis

(join slist #!optional (space " "))

Description

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.

slist

The list of strings.

space

The string to place between each member of the list. Defaults to a single space.

Author

David Carlisle

Source Code

(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)) '() ))))))