sirherrbatka/vellum

simple function to get column names

Closed this issue · 4 comments

Is there a better way to get column names than writing my own function to do so such as:

(defun vellum/column-names (table)
  (let ((header (vellum.table:header table)))
    (loop for i below (vellum:column-count table)
       collect (or (ignore-errors
                     (vellum.header:index-to-name header i))
                   (format nil "<Column ~a>" i)))))

Yes, Column-specs in the header. You gotta grab the header first though.

Ya gotta grab the header, than we gotta get the names. I still think something like this would be useful:

(defun vellum/column-names (table)
  (serapeum:~> table
               vellum.table:header
               vellum.header:column-specs
               (mapcar (lambda (x)
                         (getf x :name))
                       _)))

hm, I certainly can see the appeal. I may add such a function.

It is done.