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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:33:48+00:00 2026-06-04T19:33:48+00:00

I’m having a hard time understanding (and therefore remembering) the clojure require syntax described

  • 0

I’m having a hard time understanding (and therefore remembering) the clojure require syntax described here: http://clojuredocs.org/clojure_core/1.3.0/clojure.core/require. It seems both counter intuitive and non-uniform.

For example, in the following why is this vector required to be quoted:

(require '[clj-json.core :as json])

Counter intuitive because normally vectors are not quoted in clojure (lists are quoted and vectors are treated as data).

And non-uniform because in this case the vector is NOT quoted:

(ns xxx 
    (:require [clj-json.core :as json]))

I realize that the require function and the :require usage inside the ns macro are only optically similar, but still.

There are other pieces of weirdness as well, for example I can do this:

(require '(clj-json.core))

But I can’t do this:

(require '(clj-json.core :as json))

Can someone answer these questions:

  1. in the first example why does the vector need to be quoted?
  2. why does it not need to be quoted in the ns macro?
  3. why does the list notation not allow :as?

I’m wondering if there’s reasons why things are the way they are, or if the inconsistency was just not noticed at design time.

  • 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-04T19:33:51+00:00Added an answer on June 4, 2026 at 7:33 pm
    1. in the first example why does the vector need to be quoted?

    require is a function, so you have to quote them in order to prevent evaluation. Otherwise those symbols will be looked up in the current context, likely resulting in an error or possibly unexpected behavior. By the way, I think this not quite right: “Counter intuitive because normally vectors are not quoted in clojure (lists are quoted and vectors are treated as data).”

    It may be counter intuitive to you, however there’s nothing wrong with quoting vectors (or maps or sets). I often do when quickly testing something at the REPL, and don’t want to type a : for each keyword in a map or vector, for instance:

    user=> '{a 1 b 2 c 3}
    

    rather than:

    user=> {:a 1 :b 2 :c 3}
    

    The first is very marginally faster to type if I just want to quickly get some data to test something with.

    1. why does it not need to be quoted in the ns macro?

    Macros don’t evaluate their arguments, they’re sort of lazier than normal function calls, so the symbols (clj-json.core and json) don’t need to be quoted to prevent evaluation.

    1. why does the list notation not allow :as?

    Sorry, I don’t know the answer to this one.

    Ah, I took a look at the docs for require and found out. There’s another form supported:

    “The following would load the libraries clojure.zip and clojure.set
    abbreviated as ‘s’.”

    (require '(clojure zip [set :as s]))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
Specifically, suppose I start with the string string =hello \'i am \' me And
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.