From: David Vázquez Date: Fri, 3 May 2013 11:36:01 +0000 (+0100) Subject: Fix: join fails on empty list X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=4fe7f49a28d5df40cdad3bcdf959acab5f1c5e55;p=jscl.git Fix: join fails on empty list --- diff --git a/src/utils.lisp b/src/utils.lisp index 73fc551..20aa855 100644 --- a/src/utils.lisp +++ b/src/utils.lisp @@ -37,9 +37,11 @@ ;;; Concatenate a list of strings, with a separator (defun join (list &optional (separator "")) - (!reduce (lambda (s o) (concat s separator o)) - (cdr list) - :initial-value (car list))) + (if (null list) + "" + (!reduce (lambda (s o) (concat s separator o)) + (cdr list) + :initial-value (car list)))) (defun join-trailing (list &optional (separator "")) (if (null list)