t3x.org / nss / implode.html

(Nils' Scheme Snippets)

 
Paren matching: ON  |  Category: misc  |  Overview  |  Scheme Books  |  License
 

(implode list) => symbol

 
Purpose
Implode a list of single-character symbols into a symbol.
 
Arguments
list list to implode
 
Example
(implode '(b l a c k h o l e)) => blackhole
(define (implode x)
  (letrec
    ((sym->char
       (lambda (x)
         (let ((str (symbol->string x)))
           (if (not (= (string-length str) 1))
               (wrong "bad symbol in implode" x)
               (string-ref str 0))))))
    (string->symbol
      (list->string (map sym->char x)))))

Copyright (C) 2007 Nils M Holm <nmh @ t3x . org>