Fix reduce usage with max function.

The (reduce #'max ...) requires an initial value to be provided, as the max
function wants at least 1 argument, as we can see here:

CL-USER> (handler-case (reduce #'max nil) (condition (e) (format t "~a" e)))
Too few arguments in call to #<Compiled-function MAX #x300000113C2F>:
0 arguments provided, at least 1 required.
This commit is contained in:
Dimitri Fontaine 2017-06-28 16:37:27 +02:00
parent 17a63e18ed
commit f0d1f4ef8c
3 changed files with 6 additions and 3 deletions

View File

@ -49,7 +49,8 @@
(let ((max (reduce #'max
(mapcar #'length
(mapcar #'column-name
(table-column-list table))))))
(table-column-list table)))
:initial-value 0)))
(loop
:for (col . last?) :on (table-column-list table)
:do (progn

View File

@ -375,7 +375,8 @@
(defmethod max-indexes-per-table ((catalog catalog) &key)
"Count how many indexes maximum per table are listed in SCHEMA."
(reduce #'max (mapcar #'max-indexes-per-table (catalog-schema-list catalog))))
(reduce #'max (mapcar #'max-indexes-per-table (catalog-schema-list catalog))
:initial-value 0))
;;;
;;; Not a generic/method because only used for the table object, and we want

View File

@ -192,7 +192,8 @@
(append (pgstate-tabnames data)
(pgstate-tabnames pre)
(pgstate-tabnames post)
(list legend))))))
(list legend))))
:initial-value 0))
(defun report-full-summary (legend sections total-secs)
"Report the full story when given three different sections of reporting."