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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:22:23+00:00 2026-06-07T23:22:23+00:00

Say we need a list of numbers, there are two definitions: (def vector1 [1

  • 0

Say we need a list of numbers, there are two definitions:

(def vector1 [1 2 3])
(def list2 '(1 2 3))

So what are the main differences?

  • 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-07T23:22:25+00:00Added an answer on June 7, 2026 at 11:22 pm

    The [1 2 3] is a vector, whereas '(1 2 3) is a list. There are different performance characteristics of these two data structures.

    Vectors provide quick, indexed random access to its elements (v 34) returns element of vector v at index 34 in O(1) time. On the other hand it is generally more expensive to modify vectors.

    Lists are easy to modify at head and/or tail (depending on implementation), but provide linear access to elements: (nth (list 1 2 3 4 5) 3) requires sequential scan of the list.

    For more information on the performance tradeoffs you can google “vector vs. list performance” or something similar.

    [FOLLOW-UP]

    Ok, lets get into some more detail. First of all vectors and lists are concepts that are not specific to Clojure. Along with maps, queues, etc., they are abstract types of collections of data. Algorithms operating on data are defined in terms of those abstractions. Vectors and lists are defined by the behavior that I briefly described above (i.e. something is a vector if it has size, you can access its elements by and index in constant time etc.).

    Clojure, as any other language, wants to fulfill those expectations when providing data structures that are called this way. If you’ll look at the basic implementation of nth in vector, you’ll see a call to arrayFor method which has the complexity of O(log32N) and a lookup in Java array which is O(1).

    Why can we say that (v 34) is in fact O(1)? Because the maximum value of log32 for a Java int is around 7. This means that random access to a vector is de facto constant time.

    In summary, the main difference between vectors and lists really is the performance characteristics. Additionally, as Jeremy Heiler points out, in Clojure there are logical differences in behaviour, i.e. with respect to growing the collection with conj.

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

Sidebar

Related Questions

i have a list of elements (let's say integers), and i need to make
Lets say that I have two tables. Table 1 is a list of vendors
Let's say users can choose any amount of numbers from a list of 1
say I have a list like this {1,2,3,4,5,6,7,8}. Is there a fast way to
Say I need to use s : typedef struct tagSOMESTRUCT // Defined by someone
Lets say I need to fetch some records from the database, and filter them
Let's say I need to upload files to a server programmatically using uploading a
Let's say I need to take names of movies the person likes. I don't
Let's say i need to find all .bar elements inside an element that's assigned
Let's say I need to use Python and C++. I can call Python function

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.