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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:31:27+00:00 2026-05-17T18:31:27+00:00

In the documentation for Clojure special forms ( http://clojure.org/special_forms ) the example for :pre

  • 0

In the documentation for Clojure special forms (http://clojure.org/special_forms) the example for :pre and :post looks like this:

(defn constrained-sqr [x]
    {:pre  [(pos? x)]
     :post [(> % 16), (< % 225)]}
    (* x x))

How can Clojure tell if the map containing the meta-data is not the definition of the function? Shouldn’t the meta-data precede the params vector? According to the documentation for defn (http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/defn), the syntax is

(defn name doc-string? attr-map? [params*] body)

with the attr-map? before the params vector. Isn’t this more correct:

(defn constrained-sqr
    {:pre  [(pos? x)]
     :post [(> % 16), (< % 225)]}
    [x]
    (* x x))

Should I file a bug report or am I misreading this?

Sorry to pick nits.

  • 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-17T18:31:27+00:00Added an answer on May 17, 2026 at 6:31 pm

    The map has to follow the argument vector because it depends on the arguments. And you can have multiple function bodies with different arities. The disambiguation is pretty simple: is the map the only thing in the body, it’s the return value. If there was something else following it, the map would be thrown away. Then add it to the metadata. This is a very straight-forward and pretty simple heuristic which shouldn’t clash with any production code.

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

Sidebar

Related Questions

I just go through various documentation on Clojure concurrency and came accross the example
Documentation can be found here It says in the example: onDrop: Called whenever a
Even looking closely over documentation on Clojure, I do not see any direct confirmation
I'm attempting to learn Clojure from the API and documentation available on the site.
The documentation for Access.BackingField() indicates that this: Sets the access-strategy to use the backing-field
How really commute works. (commute IDENTITY FUNCTION &values) the Clojure Documentation says: Usage: (commute
why does (clojure.repl/source in-ns) not work while (doc in-ns) gives the documentation? I even
Documentation is severely lacking on anything to do with stored procedures in mysql with
Documentation simply states that setting setAutosavingDelay to anything > 0 on the shared doc
The documentation for the round() function states that you pass it a number, and

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.