Stefan Tilkov's Random Stuff

Lisp OODB

For a few weeks now, I have again been totally fascinated by Lisp and its dialects, have been reading up on it (e.g. with Paul Graham's excellent books), and have played around with different implementations. I'm still trying to find the time to write about my thoughts on this ... in the meantime, please admire Patrick Logan's brilliant example of using Statice to access a database in Lisp:


(defun transfer-between-accounts (from-name to-name amount) 
  (with-database (db *bank-pathname*) 
    (with-transaction () 
      (decf (account-balance (account-named from-name)) amount) 
      (incf (account-balance (account-named to-name)) amount) 
      (when (minusp (account-balance (account-named from-name))) 
        (error "Insufficient funds in ~A's account" from-name)))))

Comments