[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: why are there [v e c t o r s] in Lisp?
From: |
Emanuel Berg |
Subject: |
Re: why are there [v e c t o r s] in Lisp? |
Date: |
Sat, 17 Oct 2015 01:47:23 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
Barry Margolin <barmar@alum.mit.edu> writes:
> Lists and vectors have different performance
> characteristics. With lists, it's easy to insert and
> delete elements anywhere in the sequence, you just
> add another cons in the cdr chain, but accessing the
> nth element is O(n). With vectors, inserting and
> deleting is expensive, because you have to shift all
> the following elements over to make room (and
> appending may require moving the whole thing,
> because you didn't allocate enough room in the
> original location), but accessing the nth element
> can be done in constant time.
>
> So lists are good for flexible data structures that
> you typically access linearly, while vectors are
> good for random-access data. Also, because vectors
> are stored in contiguous memory, they generally
> exhibit better locality -- this was more important
> in the days when RAM was expensive and limited,
> because paging was more likely when you had a large
> working set.
Right, the international press is happy with
this answer.
--
underground experts united
http://user.it.uu.se/~embe8573
- Re: why are there [v e c t o r s] in Lisp?, (continued)
- Message not available
- Re: why are there [v e c t o r s] in Lisp?, Pascal J. Bourguignon, 2015/10/17
- Re: why are there [v e c t o r s] in Lisp?, Emanuel Berg, 2015/10/18
- Message not available
- Re: why are there [v e c t o r s] in Lisp?, Pascal J. Bourguignon, 2015/10/18
- Re: why are there [v e c t o r s] in Lisp?, Emanuel Berg, 2015/10/18
- Re: why are there [v e c t o r s] in Lisp?, Robert Thorpe, 2015/10/18
- Message not available
- Re: why are there [v e c t o r s] in Lisp?, Barry Margolin, 2015/10/18
- Re: why are there [v e c t o r s] in Lisp?, Emanuel Berg, 2015/10/18
- Re: why are there [v e c t o r s] in Lisp?, Random832, 2015/10/18
- Message not available
- Re: why are there [v e c t o r s] in Lisp?, Pascal J. Bourguignon, 2015/10/18
Re: why are there [v e c t o r s] in Lisp?, Barry Margolin, 2015/10/16
- Re: why are there [v e c t o r s] in Lisp?,
Emanuel Berg <=
Re: why are there [v e c t o r s] in Lisp?, Pascal J. Bourguignon, 2015/10/18