I just released the first official version of Odin (
https://github.com/halgari/odin). Odin is a declarative, extensible query
DSL for Clojure that leverages transducers to provide a high amount of
generality while still maintaining acceptable performance.

One of the biggest features of Odin is its ability to rapidly index and
query "normal" Clojure data structures. Here is a quick example of this
feature in practice:

(let [orders [{:customer/name "Sam"
                   :customer/id   3411}
                  {:customer/id 3411
                   :order/items {1212 3}}
                  {:customer/id 3411
                   :order/items {2232 2 4242 3}}
                  {:item/id    1212
                   :item/price 40.0}
                  {:item/id    2232
                   :item/price 100}
                  {:item/id    4242
                   :item/price 1.99}]]
      (->> (o/for-query
             (o/and
               (d/query orders ?customer :customer/name "Sam")
               (d/query orders ?customer :customer/id ?id)
               (d/query orders ?order :customer/id ?id)
               (d/query-in orders ?order [:order/items ?item-id] ?qty)
               (d/query orders ?item :item/id ?item-id)
               (d/query orders ?item :item/price ?price))
             (* ?qty ?price))
           (reduce + 0)))

;; => 325.97


In this example we are given a vector of maps, we are then finding a
customer by name,

then walking a path through the data to find all the items that
customer ordered, the

total price is then calculated via the normal multiply and sum.


There are several other features supported by Odin, including
transformation of data

(based on a query), tabling, Datomic support, and much more.


I also did a video series on the development process of Odin if anyone
is interested:
(https://www.youtube.com/watch?v=JyKySmcTR4g)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to