Skip to content

Instantly share code, notes, and snippets.

@zane
Created September 4, 2012 16:10
Show Gist options
  • Select an option

  • Save zane/3622904 to your computer and use it in GitHub Desktop.

Select an option

Save zane/3622904 to your computer and use it in GitHub Desktop.
(let [subquery (<- [?set ?best-x ?best-y]
(tap ?label ?set ?x ?y)
(score-fn-1 ?x ?y :> ?score-1)
(score-fn-2 ?x ?y :> ?score-2)
(:sort ?score-1 ?score-2)
(:reverse true)
(c/limit [1] :< ?x ?y :> ?best-x ?best-y))]
(?<- [?label ?set ?best-x ?best-y]
(tap ?label ?set _ _)
(subquery ?set ?best-x ?best-y)))
@sthuebner

Copy link
Copy Markdown

;; just a guess, but would cascalog.ops/max do the trick?
(<- [?a ?b ?c ?max-score](tap ?a ?b ?c)
(score-fn ?a ?b :> ?score)
(cascalog.ops/max ?score :> ?max-score))

@sthuebner

Copy link
Copy Markdown

meh, code in comments doesn't work as I expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment