Skip to content

Instantly share code, notes, and snippets.

@slpsys
Last active December 22, 2015 03:19
Show Gist options
  • Save slpsys/6409864 to your computer and use it in GitHub Desktop.
Save slpsys/6409864 to your computer and use it in GitHub Desktop.
(ns generativity
(:use [cascalog api]))
(defn one_of [seq] (vec (map vector seq)))
(deffilterop forbid
([var comparator val]
(not (comparator var val)))
([var op val comparator comparee]
(not (comparator (op var val) comparee))))
(def generativity
(<-
[?alice ?bob ?claire]
((one_of [1 2 3]) ?alice)
((one_of [1 2 3]) ?bob)
((one_of [1 2 3]) ?claire)
(cross-join)
(forbid ?alice = ?bob) (forbid ?bob = ?claire) (forbid ?alice = ?claire)
(forbid ?bob = 3)
(forbid ?alice - ?claire = 1) (forbid ?claire - ?alice = 1)
(forbid ?claire < ?bob)))
; (?- (stdout) generativity)
;
; RESULTS
; -----------------------
; 1 2 3
; -----------------------
(defproject generativity "0.0.1"
:source-path "src"
:dependencies [[cascalog "1.8.8-SNAPSHOT"]]
:profiles {
:provided {
:dependencies [[org.apache.hadoop/hadoop-core "0.20.2-dev"]]
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment