[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: side effects, list sharing [was: `append' vs. `nconc']
From: |
Drew Adams |
Subject: |
RE: side effects, list sharing [was: `append' vs. `nconc'] |
Date: |
Thu, 31 Dec 2015 11:15:09 -0800 (PST) |
> But other then time/space optimization, what would you
> say is the reason not to play it safe/sane and just
> return stuff, new stuff if necessary, but instead
> modify them directly?
You will know it if you see it or when you really need it!
If you don't see a need for sharing list structure then
playing it safe/sane is the right approach.
If you are modifying someone else's code, and you see
structure-modifying code, that is, code that indicates
that list-sharing is going on, then you need to wake up
and take that into consideration.
Otherwise, there is no need to worry about it - just
play it safe/sane and Bob's your uncle.
If you just want to learn about such use cases, look
through existing Lisp code for uses of `setcar' and
company. I can almost guarantee that they are not
used gratuitously.
And unless you see them used in a clearly local and
safe/encapsulated fashion, look around for what's
really going on, to see why that code uses list-sharing.
- Re: `append' vs. `nconc', (continued)
- Message not available
- Re: `append' vs. `nconc', Pascal J. Bourguignon, 2015/12/31
- Re: `append' vs. `nconc', Emanuel Berg, 2015/12/30
- Message not available
- Re: `append' vs. `nconc', Pascal J. Bourguignon, 2015/12/31
- Re: `append' vs. `nconc', Emanuel Berg, 2015/12/31
- Re: `append' vs. `nconc', tomas, 2015/12/31
- side effects, list sharing [was: `append' vs. `nconc'], Drew Adams, 2015/12/31
- Re: side effects, list sharing [was: `append' vs. `nconc'], Emanuel Berg, 2015/12/31
- RE: side effects, list sharing [was: `append' vs. `nconc'],
Drew Adams <=
- Re: `append' vs. `nconc', Emanuel Berg, 2015/12/31
- Message not available
- Re: `append' vs. `nconc', Barry Margolin, 2015/12/31
- Message not available
- Re: `append' vs. `nconc', Pascal J. Bourguignon, 2015/12/31
- Message not available
- Re: `append' vs. `nconc', Teemu Likonen, 2015/12/31
- Re: `append' vs. `nconc', Emanuel Berg, 2015/12/31
- Re: `append' vs. `nconc', Teemu Likonen, 2015/12/31
- Message not available
- Re: `append' vs. `nconc', Pascal J. Bourguignon, 2015/12/30