From: maxwellhansen Date: Fri, 26 Apr 2013 05:37:09 +0000 (-0700) Subject: Updated join function in utils.lisp X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=ac07b88eb1161935cdbf8836f65258e44bfe7ab9;p=jscl.git Updated join function in utils.lisp Used !reduce instead of verbose conditional recursion. --- diff --git a/src/utils.lisp b/src/utils.lisp index 3cf0103..5a66bf6 100644 --- a/src/utils.lisp +++ b/src/utils.lisp @@ -37,15 +37,9 @@ ;;; Concatenate a list of strings, with a separator (defun join (list &optional (separator "")) - (cond - ((null list) - "") - ((null (cdr list)) - (car list)) - (t - (concat (car list) - separator - (join (cdr list) separator))))) + (!reduce (lambda (s o) (concat s separator o)) + (cdr list) + :initial-value (car list))) (defun join-trailing (list &optional (separator "")) (if (null list)