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 8665115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:24:19+00:00 2026-06-12T17:24:19+00:00

For practice, I’ve defined (defmacro quote-paren body -> `(body) [& body] `(~@body)) which has

  • 0

For practice, I’ve defined

(defmacro quote-paren
  "body -> `(body)"
  [& body]
  `(~@body))

which has the expected transformation (quote-paren body) => “(body)`. It seems to satisfy a few basic tests:

user=> (macroexpand-1 `(quote-paren 3 4 5))
(3 4 5)
user=> (macroexpand-1 `(quote-paren println "hi"))
(clojure.core/println "hi") 
user=> (macroexpand-1 `(quote-paren (println "hi")))
((clojure.core/println "hi"))

However, I’ve been testing it with this do-while macro (modified from here):

(defmacro do-while
  [test & body]
  (quote-paren loop [] 
    ~@body
    (when ~test
      (recur))))

(def y 4)
(do-while (> y 0)
  (def y (dec y)))

But the result is

IllegalStateException Attempting to call unbound fn: #'clojure.core/unquote-splicing  clojure.lang.Var$Unbound.throwArity (Var.java:43)

I don’t understand this, because from what I can see the `quote-paren’ macro works fine (with ~@body plugged in):

user=> (macroexpand-1 
         `(quote-paren loop [] 
            (def y (dec y))
            (when ~test
              (recur))))

(clojure.core/loop [] (def user/y (clojure.core/dec user/y)) (clojure.core/when #<core$test clojure.core$test@1f07f672> (recur)))

But trying to macroexpand do-while causes an “unbound fn“. Is there something subtle I’m missing?

  • 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-06-12T17:24:21+00:00Added an answer on June 12, 2026 at 5:24 pm

    missing the syntax-quote before quote-paren

    user> (defmacro do-while
      [test & body]
      `(quote-paren loop [] 
        ~@body
        (when ~test
          (recur))))
    #'user/do-while
    

    which then expands properly:

    user> (macroexpand '(do-while (> y 0)
                          (def y (dec y))))
    (loop* [] (def y (dec y)) (clojure.core/when (> y 0) (recur)))
    

    and seems to work:

    user> (def y 4)
    #'user/y
    user> (do-while (> y 0)
      (def y (dec y)))
    nil
    user> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I practice TDD and run my tests very often. Eclipse has a nice command
In practice we are finding the default NHibernate (v2.0 & 2.1) FlushMode=Auto to be
What's the best practice to check if a collection has items? Here's an example
Which is best practice, which results in better performance? using closure or dojo.lang.hitch ?
Which practice would you recommend, and why? class Foo : public boost::noncopyable {}; vs.
Best practice for developing .NET programs seems to be this: never reference dlls from
For practice, I've been working on a compressor which does the find-repeated-parts, make-dictionary, compress-with-huffman
The practice I'm discussing is: Your project/product has a ticketing system for bugs, features,
Which are the best practice to store a credit card and billing information from
Best practice is to use unique ivs, but what is unique? Is it unique

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.