From 4fe7f49a28d5df40cdad3bcdf959acab5f1c5e55 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20V=C3=A1zquez?= Date: Fri, 3 May 2013 12:36:01 +0100 Subject: [PATCH] Fix: join fails on empty list --- src/utils.lisp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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) -- 1.7.10.4