Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Tree: e14a3a3f2f
Fetching contributors…

Cannot retrieve contributors at this time

46 lines (29 sloc) 1.4 KB


clj-record is an API inspired by Rails’ ActiveRecord but implemented in the Clojure programming language and intended to use its idioms.

This is a learning exercise and (at least for now) not intended for real-world use. Contributions to harden it are welcome, but I’m even more interested in recommendations for how to make it more idiomatically lisp-ey.


To define a model, you do something like this.

  (ns com.example.user)


To define associations, you add something like this.

  (ns com.example.user)

    (belongs-to account)
    (has-many subscriptions))

Then you can do things like this.

  (let [mikey (user/find-record 2)
        subs (user/find-subscriptions mikey)]
    (doseq [subscription subs] (println (format "%s subscribed to %s" (:name mikey) (:name sub))))
    (user/destroy-subscriptions mikey)
    (println "But not any more."))

See core-test.clj and associations-test.clj for everything that works.

The Name…

…is awful. Recommendations are welcome.

Copyright 2008 John D. Hume and released under an MIT license.

Jump to Line
Something went wrong with that request. Please try again.