Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7495567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:12:59+00:00 2026-05-29T18:12:59+00:00

I need to generate the following: (clojureql.core/join (clojureql.core/table db :tableA) (clojureql.core/table db :tableA) (clojureql.core/where

  • 0

I need to generate the following:

(clojureql.core/join (clojureql.core/table db :tableA) (clojureql.core/table db :tableA)
     (clojureql.core/where (apply and (= :tableA.id :tableB.id)
                      [(apply or [(clojureql.predicates/in :tableA.id [1 2])
                                  (clojureql.predicates/in :tableA.id [3 4])])])))

But the “apply or” form needs to be “passed” from another function or macro. Here’s what I mean:

(clojureql.core/join (clojureql.core/table db :tableA) (clojureql.core/table db :tableA)
     (clojureql.core/where (apply and (= :tableA.id :tableB.id)
                      [(my-or-f)])))

where this function is:

(defn my-or-f []
    (apply or [(clojureql.predicates/in :tableA.id [1 2])
         (clojureql.predicates/in :tableA.id [3 4])]))

however this function throws this exception:

#<CompilerException java.lang.Exception: Can't take value of a macro: #'clojure.core/or (NO_SOURCE_FILE:2)>

I’ve also tried using a macro. It compiles but it throws the same exception when I try running the query using this macro

(defmacro my-or-f []
    `(apply or [(clojureql.predicates/in :tableA.id [1 2])
         (clojureql.predicates/in :tableA.id [3 4])]))

Is there another way that I could use the “apply or”?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T18:13:02+00:00Added an answer on May 29, 2026 at 6:13 pm

    The issue is that macros are not functions – they run at compile time and are passed the actual syntax (lists and symbols, primarily), so you can’t apply them at runtime to runtime datastructures. Thus, (apply or my-list) throws an error. You have a few options:

    (def my-list (list false false 4 false 5))
    
    (some identity my-list) -- returns 4
    (reduce #(or %1 %2) my-list) -- returns 4
    

    In practice, you probably want some — it stops as soon as it reaches an element that returns true, while reduce always traverses the entire list.

    Note: you will also have the same problem with your (apply and ...) — (every? identity ...) will do what you want.

    In this case, however, why do you need to use apply at all? This should work equally well:

    (clojureql.core/join (clojureql.core/table db :tableA) (clojureql.core/table db :tableA)
                         (clojureql.core/where (and (= :tableA.id :tableB.id)
                                                    (my-or-f))))
    
    (defn my-or-f []
      (or (clojureql.predicates/in :tableA.id [1 2])
          (clojureql.predicates/in :tableA.id [3 4])))
    

    One last suggestion – when you require clojureql.predicates, if you replace clojureql.predicates with [clojurecl.predicates :as qlp], you can use qlp in place of clojureql.predicates in the rest of the file, which makes the above (if we also replace clojureql.core with qlc):

    (qlc/join (qlc/table db :tableA) (qlc/table db :tableA)
              (qlc/where (and (= :tableA.id :tableB.id)
                              (my-or-f))))
    
    (defn my-or-f []
      (or (qlp/in :tableA.id [1 2])
          (qlp/in :tableA.id [3 4])))
    

    which is much easier to read.

    For the purposes of ClojureQL, try (apply clojureql.predicates/or* ...) and (apply clojureql.predicates/and* ...). clojureql’s where replaces any and and or it sees with clojureql.predicates/and* and clojureql.or*, so doing this replacement yourself should work. Both and* and or* are functions, not macros, so there shouldn’t be any issues.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to generate the following in ASP.NET page. What's the best, easiest way
I have the following requirement: Based on some user input, I need to generate
I need to dynamically generate radio or checkbox by jQuery. I use the following
I have the following problem: I need to use XSLFO to generate a 2-column
I need generate thumbnails for a bunch of jpegs (200,000+) but I want to
I need to generate the following XML with SOAP: ... <InternationalShippingServiceOption> <ShippingService>StandardInternational</ShippingService> <ShippingServiceCost currencyID=USD>39.99</ShippingServiceCost>
I need to generate a vector of the following format using R: 1:10, 1:10,
I need so generate XML like the following: <?xml version=1.0 encoding=UTF-8 standalone=yes?> <urlset xmlns=http://www.sitemaps.org/schemas/sitemap/0.9
I need to generate a node in a XML file with the following structure:
I need to generate random string for my automated tests. I use the following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.