;;;; Sample Common Lisp program — samplefiles.com
(defstruct customer id name balance)

(defun vip-p (c)
  (>= (customer-balance c) 10000))

(defun total-balance (customers)
  (reduce #'+ customers :key #'customer-balance))

(let ((customers (list (make-customer :id 1 :name "Ada" :balance 12500.0d0)
                       (make-customer :id 2 :name "Grace" :balance 830.5d0)
                       (make-customer :id 3 :name "Linus" :balance 10000.0d0))))
  (dolist (c customers)
    (let ((name (customer-name c)))
      (format t "~A~A ~10,2F ~A~%"
              name (make-string (- 6 (length name)) :initial-element #\Space)
              (customer-balance c) (if (vip-p c) "VIP" ""))))
  (format t "Total: ~,2F~%" (total-balance customers)))
