[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: |
Random832 |
Subject: |
Re: why are there [v e c t o r s] in Lisp? |
Date: |
Fri, 16 Oct 2015 00:17:37 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
"Pascal J. Bourguignon" <pjb@informatimago.com> writes:
> Random832 <random832@fastmail.com> writes:
>> Well, what happens if you cdr that list? Does it make a
>> copy?
>
> cdr'ing is no problem you just increment your pointer.
>
>> The thing is, if you can car a string people will wonder why
>> you can't cdr it. And with mutable objects it's hard to make
>> cdr work right. (fsvo "right")
>
> It's rplacd which becomes much more complex.
You didn't mention my issue with "list of 5000 elements, cdr
4000 times" - does the garbage collector know to discard the
first 4000 elements which are no longer reachable?
> Also, when you program with such a system, you might be afraid that
> rplacd leads to fragmented chains, and will have a tendency to call
> copy-list to compact them.
Hmm... can the garbage collector compact them?
> But indeed, copy-list means that less
> structure is shared, and therefore would waste time and memory. This is
> what they do in C++ and why they believe lists are costly.
Also with this kind of list I think you still lose the
ability to have constant-time indexing, since you have to
check every cell for the cdr bit.
- Re: why are there [v e c t o r s] in Lisp?, (continued)
- Re: why are there [v e c t o r s] in Lisp?, Random832, 2015/10/15
- Re: why are there [v e c t o r s] in Lisp?, Emanuel Berg, 2015/10/15
- Re: why are there [v e c t o r s] in Lisp?, Random832, 2015/10/15
- Re: why are there [v e c t o r s] in Lisp?, Emanuel Berg, 2015/10/16
- Message not available
- Re: why are there [v e c t o r s] in Lisp?, Pascal J. Bourguignon, 2015/10/16
- Re: why are there [v e c t o r s] in Lisp?, Emanuel Berg, 2015/10/17
- 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/17
- Message not available
- Re: why are there [v e c t o r s] in Lisp?, Pascal J. Bourguignon, 2015/10/17
- Message not available
- Re: why are there [v e c t o r s] in Lisp?, Pascal J. Bourguignon, 2015/10/16
- Re: why are there [v e c t o r s] in Lisp?,
Random832 <=
- Message not available
- Re: why are there [v e c t o r s] in Lisp?, Pascal J. Bourguignon, 2015/10/16
- Message not available
- Re: why are there [v e c t o r s] in Lisp?, Pascal J. Bourguignon, 2015/10/15
- Re: why are there [v e c t o r s] in Lisp?, Emanuel Berg, 2015/10/16
- Message not available
- Re: why are there [v e c t o r s] in Lisp?, Pascal J. Bourguignon, 2015/10/16
- Re: why are there [v e c t o r s] in Lisp?, Emanuel Berg, 2015/10/17
- Re: why are there [v e c t o r s] in Lisp?, Random832, 2015/10/17
- Re: why are there [v e c t o r s] in Lisp?, Emanuel Berg, 2015/10/17
- Message not available
- Re: why are there [v e c t o r s] in Lisp?, Barry Margolin, 2015/10/17
- Re: why are there [v e c t o r s] in Lisp?, Barry Margolin, 2015/10/17
- Re: why are there [v e c t o r s] in Lisp?, Emanuel Berg, 2015/10/17