Core.logic is great. Here's a trivial 10-line core.logic relation backed by a Lucene index. Simple and useful (at least to us). Need a library of such things.
Comments and improvements appreciated. Details at https://gist.github.com/3060305 . The gist of the gist is: ;; Generate the Lucene query string. (defn- lucene-query "Query Lucene based on the given object and Substitutions. The query Q should be a map that has some values bound by substitutions A. The generated Lucene query string looks like 'p1:v1 AND p2:v2', where Q contains :p1 lv1 and :p2 lv2 and the substitutions take lv1 to v1 and lv2 to v2. That query string is then used in the Lucene query." ([q a] (db/search (index) (reduce str (interpose " AND " (map (fn [[k v]] (str (subs (str k) 1) ":" v)) (remove (comp logic/lvar? last) (logic/walk* a q))))) (config :max-query-results)))) ;; The core.logic relation. (defn lucenalog-rel [q] "A clojure.core.logic relation backed by Lucene. Lucene query generated by lucene-query based on the given map." (fn [a] (logic/to-stream (map #(logic/unify a % q) (lucene-query q a))))) --Jamie -- 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