Can't reduce an empty list with the max function.

The max function requires at least 1 argument to be given, and in the
case where we have no table to load it then fails badly, as show here:

  CL-USER> (handler-case
               (reduce #'max nil)
             (condition (c)
               (format nil "~a" c)))
  "invalid number of arguments: 0"

Of course Common Lisp comes with a very easy way around that problem:

  CL-USER> (reduce #'max nil :initial-value 0)
  0

Fix #381.
This commit is contained in:
Dimitri Fontaine 2016-03-29 21:02:31 +02:00
parent dcc926e90c
commit 7fc0812f79

View File

@ -322,7 +322,8 @@
"Count how many indexes maximum per table are listed in SCHEMA."
(reduce #'max (mapcar #'length
(mapcar #'table-index-list
(schema-table-list schema)))))
(schema-table-list schema)))
:initial-value 0))
"Count how many indexes maximum per table are listed in SCHEMA."
(defmethod max-indexes-per-table ((catalog catalog) &key)