;; Copyright (C) 2012, 2013 David Vazquez
;; Copyright (C) 2012 Raimon Grau
;; Copyright (C) 2012, 2013 David Vazquez
;; Copyright (C) 2012 Raimon Grau
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation, either version 3 of the
;; License, or (at your option) any later version.
;;
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation, either version 3 of the
;; License, or (at your option) any later version.
;;
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
(defmacro concatf (variable &body form)
`(setq ,variable (concat ,variable (progn ,@form))))
(defmacro concatf (variable &body form)
`(setq ,variable (concat ,variable (progn ,@form))))
-(defun !reduce (func list &key initial-value)
- (if (null list)
- initial-value
- (!reduce func
- (cdr list)
- :initial-value (funcall func initial-value (car list)))))
+(defun !reduce (func list initial-value)
+ (let ((result initial-value))
+ (dolist (element list result)
+ (setq result (funcall func result element)))))
;;; Concatenate a list of strings, with a separator
(defun join (list &optional (separator ""))
;;; Concatenate a list of strings, with a separator
(defun join (list &optional (separator ""))