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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:59:44+00:00 2026-06-05T17:59:44+00:00

I noticed that Clojure (1.4) seems to be happy to consider vectors equal to

  • 0

I noticed that Clojure (1.4) seems to be happy to consider vectors equal to the seq of the same vector, but that the same does not apply for maps:

(= [1 2] (seq [1 2]))
=> true

(= {1 2} (seq {1 2}))
=> false

Why should the behaviour of = be different in this way?

  • 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-05T17:59:45+00:00Added an answer on June 5, 2026 at 5:59 pm

    Clojure’s = can be thought of as performing its comparisons in two steps:

    1. Check if the types of the things being compared belong to the same “equality partition”, that is a class of types whose members might potentially be equal (depending on things like the exact members of a given data structure, but not the particular type in the partition);

    2. If so, check if the things being compared actually are equal.

    One such equality partition is that of “sequential” things. Vectors are considered sequential:

    (instance? clojure.lang.Sequential [])
    ;= true
    

    As are seqs of various types:

    (instance? clojure.lang.Sequential (seq {1 2}))
    ;= true
    

    Therefore a vector is considered equal to a seq if (and only if) their corresponding elements are equal.

    (Note that (seq {}) produces nil, which is not sequential and compares “not equal” to (), [] etc.)

    On the other hand, maps constitute an equality partition of their own, so while a hash map might be considered equal to a sorted map, it will never be considered equal to a seq. In particular, it is not equal to the seq of its entries, which is what (seq some-map) produces.

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

Sidebar

Related Questions

I noticed that itertools does not (it seems to me) have a function capable
I noticed that 2147483647 seems to be a popular choice for maxReceivedMessageSize but is
I've noticed over time that Clojure users have nothing but massive enthusiasm for the
I noticed that cherrypy session does not require a secret key configuration. On the
I've noticed that Clojure multiline docstrings seem to be manually formatted in most cases,
I have noticed that lazy sequences in Clojure seem to be represented internally as
I noticed that calling the printf function (with cl_intel_printf extension), the same variable of
I noticed that when I do something like this (with jQuery, but I don't
Noticed that if I want to read some data and if I do not
I noticed that the WPF designer does a very poor job on aligning the

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.