FAQ
Hey all,

I'm trying to write a switch to process data differently, but I get the
following error. Below is the code. Any insight would be greatly
appreciated. For now, I've let the condition to be hard coded, but we can
always make it a dynamic query later.

java.lang.RuntimeException: java.lang.RuntimeException:
java.lang.RuntimeException: java.lang.IllegalArgumentException: No method
in multimethod 'hof-predicate?' for dispatch value: :predicate-macro
(NO_SOURCE_FILE:164)

(use '[cascalog playground api)
(bootstrap)

(defn cond? [int] (< int 5))

(def m
(<- [?a :> ?b]
(inc ?a :> ?b)))

(def n
(<- [?a :> ?b]
(dec ?a :> ?b)))

(def query
(let [pred (if cond? #'m #'n)]
(?<- (stdout)
[?a ?b]
(integer ?a)
(pred ?a :> ?b))))

-------------------------------------------
I'm running with
[org.clojure/clojure "1.3.0"]
[cascalog "1.8.6"]

Thanks!

Search Discussions

  • Nathanmarz at Mar 20, 2012 at 10:54 pm
    Looks like you uncovered a bug in Cascalog. Vars that contain a
    predicate macro are not interpreted correctly as predicate macros,
    leading to the strange error you're seeing. I committed a fix for the
    next release, but in the meantime you can fix your query by just using
    the value of the predicate macro var rather than the var itself. Like
    this:

    (let [pred (if cond? m n)]



    On Mar 20, 3:12 pm, Alice Liang wrote:
    Hey all,

    I'm trying to write a switch to process data differently, but I get the
    following error.  Below is the code.  Any insight would be greatly
    appreciated.  For now, I've let the condition to be hard coded, but we can
    always make it a dynamic query later.

    java.lang.RuntimeException: java.lang.RuntimeException:
    java.lang.RuntimeException: java.lang.IllegalArgumentException: No method
    in multimethod 'hof-predicate?' for dispatch value: :predicate-macro
    (NO_SOURCE_FILE:164)

    (use '[cascalog playground api)
    (bootstrap)

    (defn cond? [int] (< int 5))

    (def m
    (<- [?a :> ?b]
    (inc ?a :> ?b)))

    (def n
    (<- [?a :> ?b]
    (dec ?a :> ?b)))

    (def query
    (let [pred (if cond? #'m #'n)]
    (?<- (stdout)
    [?a ?b]
    (integer ?a)
    (pred ?a :> ?b))))

    -------------------------------------------
    I'm running with
    [org.clojure/clojure "1.3.0"]
    [cascalog "1.8.6"]

    Thanks!

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcascalog-user @
categoriesclojure, hadoop
postedMar 20, '12 at 10:15p
activeMar 20, '12 at 10:54p
posts2
users2
websiteclojure.org
irc#clojure

2 users in discussion

Nathanmarz: 1 post Alice Liang: 1 post

People

Translate

site design / logo © 2022 Grokbase