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

  • Home
  • SEARCH
  • 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 895469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:33:48+00:00 2026-05-15T14:33:48+00:00

OK, I understand pretty well how to use both function and macros. What I’m

  • 0

OK, I understand pretty well how to use both function and macros.

What I’m curious about is why the compiler can’t be a bit more clever when integrating the two, e.g. consider the Clojure code:

(defmacro wonky-add [a b] `(+ ~a (* 2 ~b)))

(defn wonky-increment [a] (apply wonky-add a 1))
=> Error: can't take value of a macro

Yes, I know I can make this work by taking out the “apply” – but why is it that the compiler can’t figure out how to do this itself?

Would it be possible in Clojure / other LISPs to create a version of apply or other higher order functions that work equally well with both functions and macros as parameters?

  • 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-15T14:33:49+00:00Added an answer on May 15, 2026 at 2:33 pm

    This answer is not so much about Clojure, but Lisp and macros in general.

    Remember:

    APPLY is there to be able to call functions with argument lists that are created at runtime.

    Macros are there to generate new source code from some source code – and the generated source code will run.

    Now:

    If you allow apply to feed different source code into a macro at runtime, one needs to be able to generate the result code at runtime and also to execute the generated code.

    Thus in a compiled Lisp system, every call of APPLY with a macro potentially creates new code that needs to be compiled at runtime to be able to execute it. This means also that you may get new compiler errors at runtime, when your code is executing and the code has some problem. So to APPLY macros at runtime, you need a compiler and all necessary information (for example other macros) to be able to expand and compile the code.

    This also means that in the general case you can’t compile APPLY with a macro before runtime, since it is not known what the runtime arguments to apply will be.

    In an interpreter-based Lisp, there may be more information and macros can be applied all the time.

    In early Lisp there were normal functions and so-called FEXPRs. FEXPRs allowed flexible calling and runtime code manipulation. Later in the history of Lisp they have been replaced with macros, since macros allow efficient compilation and, in compiler-based systems, allow syntax errors to be handled before runtime.

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

Sidebar

Related Questions

While HTML Scraping is pretty well-documented from what I can see, and I understand
So I feel I pretty well understand the application layer, and everything below (and
I'm a pretty inexperienced programmer (can make tk apps, text processing, sort of understand
I thought I understood Java generics pretty well, but then I came across the
I am digging into LINQ--trying to understand basic models (it seems pretty cool to
Pretty straightforward stuff, here -- I'm just not good enough with mysql to understand
I understand how I can change the dns settings for my domains by editing
I understand what System.WeakReference does, but what I can't seem to grasp is a
I understand how JS is run and I think I understand most of the
I understand that some countries have laws regarding website accessibility. In general, what are

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.