utils.scm 780 B

12345678910111213141516171819202122232425262728293031
  1. #!r6rs
  2. ;;; utils.sls --- utilities for `include-file'
  3. ;; Copyright (C) 2010 Andreas Rottmann <a.rottmann@gmx.at>
  4. ;; This program is free software, you can redistribute it and/or
  5. ;; modify it under the terms of the MIT/X11 license.
  6. ;; You should have received a copy of the MIT/X11 license along with
  7. ;; this program. If not, see
  8. ;; <http://www.opensource.org/licenses/mit-license.php>.
  9. ;;; Commentary:
  10. ;;; Code:
  11. (library (arguile lib private include utils)
  12. (export string-join)
  13. (import (rnrs base))
  14. (define (string-join lst sep)
  15. (if (null? lst)
  16. ""
  17. (let loop ((result '()) (lst lst))
  18. (if (null? lst)
  19. (apply string-append (cdr (reverse result)))
  20. (loop (cons (car lst) (cons sep result))
  21. (cdr lst))))))
  22. )