diary at Telent Netowrks

Turns out that my multidimensional plist goop is perhaps not as useful as it could#

Mon, 09 May 2005 14:10:43 +0000

Turns out that my multidimensional plist goop is perhaps not as useful as it could be: because it accepts the keys as a &rest argument, it needs to be used with apply whenever you have a list of keys generated at runtime. Problem:

The following situations involving setf of apply must be supported:

(setf (apply #'aref array subscript more-subscripts) new-element)
(setf (apply #'bit array subscript more-subscripts) new-element)
(setf (apply #'sbit array subscript more-subscripts) new-element)

No other standardized function is required to be supported, but an implementation may define such support. An implementation may also define support for implementation-defined operators.

CLHS 5.1.2.5

Maybe I should rethink the API a little. Shame. I quite liked it.

Yes, I'm still playing with non-OO database APIs.

 (dbs:with-query (q (database-handle "select  from blah where thing"))
    (loop
      (let ((row (dbs:get-row database-handle* q)))
        (unless row (return))
	(destructuring-bind (&key ticket artist promoter venue) row
           (format t "ticket ~S artist ~S promoter ~S venue ~S~~%"
	   	   ticket artist promoter venue)))))

(dbs:insert-row database-handle 'employee '(:empid 22 :forename "John" :lastname "Smith" :managerid 3 :salary 25000))

(dbs:update-row database-handle 'employee '(:salary (* 1.2 salary)) '(= :empid 22))

I might hack the with-query macro around a little so it doesn't need both a database name /and/ a cursor; one should be sufficient. The parenthesized prefix notation stuff is done with sexql.