3 ms·
I went to see if there was anything like ActiveRecord for Lisp, because, well, that's a pretty metaprogramming-heavy domain. What do I get as the first google
by lsb 18y ago
I went to see if there was anything like ActiveRecord for Lisp, because, well, that's a pretty metaprogramming-heavy domain. What do I get as the first google hit? A forum post asking about that, http://coding.derkeiler.com/Archive/Lisp/comp.lang.lisp/2006-04/msg00735.html http://coding.derkeiler.com/Archive/Lisp/comp.lang.lisp/2006... --- never a good sign. Two people answered, one with a link to his rant on comp.lang.lisp, and one talking about the virtues of CLSQL.
The code snippet from CLSQL looks horrendous:
;; select the user with ID 1 and set his username column to joe
(let ((user (first (select 'user :where [= [id] 1] :flatp t :refresh t))))
(setf (username user) "joe")
(update-records-from-instance user))
Compare this to
User.find(1).update_attribute(:username, "joe")
16 tokens vs 45. I don't know CLOS, but
(update-attribute (find *User* 1) 'username "joe")
is a great start.
- antiismist 18y agoI've been using leftparen (a framework written in PLT Scheme) for a project, this would be something like: (rec-set-prop! userid 'username "joe") (store-rec! userid)
- pivo 18y agoI found Elephant really nice to use with Lisp. It can use a SQL db as a data store, but uses it just for key/value mappings, so you can't use normal SQL commands as you might expect. I found the code to be very concise. http://common-lisp.net/project/elephant/ http://common-lisp.net/project/elephant/