Skip to content

Instantly share code, notes, and snippets.

(ns lucenalog.core
"Lucenalog = Datalog interface to Lucene in 10 lines.
Simple but powerful.
Use
(db/add (index) {:a \"foo\" :b \"bar\"})
to index a map with Lucene. Then you can use the relation
(ns lucenalog.core
"Lucenalog = Datalog interface to Lucene in 10 lines.
Simple but powerful.
Use
(db/add (index) {:a \"foo\" :b \"bar\"})
to index a map with Lucene. Then you can use the relation
@ohpauleez
ohpauleez / thread.clj
Created October 15, 2012 16:16 — forked from fogus/thread.clj
new thread macros draft
(defmacro test->
"Takes an expression and a set of test/form pairs. Threads expr (via ->)
through each form for which the corresponding test is true."
[expr
& clauses]
(assert (even? (count clauses)))
(let [g (gensym)
pstep (fn [[test step]] `(if ~test (-> ~g ~step) ~g))]
`(let [~g ~expr
~@(interleave (repeat g) (map pstep (partition 2 clauses)))]
@ohpauleez
ohpauleez / fork.clj
Created October 5, 2012 15:51 — forked from cemerick/usage.sh
leiningen.fork
(ns leiningen.fork
(:require [leiningen.core.main :as main]
[leiningen.do :as do]))
(defn fork
[project task-name & args]
(apply println "Forking" task-name args)
(future
(main/apply-task (main/lookup-alias task-name project) project args)))
@ohpauleez
ohpauleez / cl-graph.clj
Created September 27, 2012 19:14 — forked from martintrojer/cl-graph.clj
core.logic graph blog
(ns cl-graph
(:refer-clojure :exclude [==])
(:use clojure.core.logic))
;; Directed Acyclic Graphs
(defrel edge a b)
;; a
;; |