FAQ
How do I make a query in cascalog with an or e.g. suppose in nathan's
original tutorial, I wanted to query for all people whose name is bob
'or' their age is 30? I can't use:

(?<- (stdout) [?person]
(age ?person ?age)
(or (= ?age 30) (= ?person "bob")))

is there an equivalent?

Search Discussions

  • Nathan Marz at Jan 31, 2012 at 1:59 am
    You can do this:

    (defn bool-or [& vars]
    (boolean (some identity vars)))

    (?<- (stdout) [?person]
    (age ?person ?age)
    (= ?age 30 :> ?old)
    (= ?person "bob" :> ?bob)
    (bool-or ?old ?bob))


    bool-or is actually defined in cascalog.ops-impl, but perhaps we should
    promote it to cascalog.ops.

    -Nathan


    On Mon, Jan 30, 2012 at 1:49 AM, Gerrard McNulty
    wrote:
    How do I make a query in cascalog with an or e.g. suppose in nathan's
    original tutorial, I wanted to query for all people whose name is bob
    'or' their age is 30? I can't use:

    (?<- (stdout) [?person]
    (age ?person ?age)
    (or (= ?age 30) (= ?person "bob")))

    is there an equivalent?


    --
    Twitter: @nathanmarz
    http://nathanmarz.com

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcascalog-user @
categoriesclojure, hadoop
postedJan 30, '12 at 9:49a
activeJan 31, '12 at 1:59a
posts2
users2
websiteclojure.org
irc#clojure

2 users in discussion

Gerrard McNulty: 1 post Nathan Marz: 1 post

People

Translate

site design / logo © 2022 Grokbase