all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Adding many elements to a list
Date: Tue, 22 Sep 2009 14:16:28 +0200	[thread overview]
Message-ID: <87vdjbrx7n.fsf@lola.goethe.zz> (raw)
In-Reply-To: 7cws3rp54a.fsf@pbourguignon.lefevre.anevia.com

pjb@informatimago.com (Pascal J. Bourguignon) writes:

> David Kastrup <dak@gnu.org> writes:
>
>> pjb@anevia.com (Pascal J. Bourguignon) writes:
>>
>>> David Kastrup <dak@gnu.org> writes:
>>>
>>>> pjb@anevia.com (Pascal J. Bourguignon) writes:
>>>>
>>>>> David Kastrup <dak@gnu.org> writes:
>>>>>
>>>>>> pjb@informatimago.com (Pascal J. Bourguignon) writes:
>>>>>>
>>>>>>> So better use (require 'cl) (push new-item list)
>>>>>>>    or (cons new-item list)
>>>>>>>    or (append (list new-items...) list)
>>>>>>
>>>>>> (require 'cl) is quite unnecessary for all of the mentioned
>>>>>> alternatives.
>>
>> Try emacs -Q.  Just because you choose to load some library
>> overloading the default operators does not mean that other people
>> should do the same when Emacs will provide those operators by
>> default, with better performance.
>
> Ah! :-)  
>
> The cl package wouldn't be provided if the default had any performance
> at all...
>
>
> (defvar *a* (cons nil nil))
> (push 1 (car *a*))

Well, consult its doc string for what it does and doesn't.  It's
basically the same issue as with setf/setq: the cl version of push does
a number of different things depending on a vague concept "location".
But you almost never need this sort of flexibility at runtime, and at
compile time, it obfuscates what actually happens, including the
possible performance impacts.

-- 
David Kastrup


  reply	other threads:[~2009-09-22 12:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-18 13:15 Adding many elements to a list Nordlöw
2009-09-18 13:44 ` Pascal J. Bourguignon
2009-09-18 14:23   ` David Kastrup
2009-09-18 14:48     ` Pascal J. Bourguignon
2009-09-18 14:54       ` David Kastrup
2009-09-18 15:13         ` Pascal J. Bourguignon
2009-09-19  7:34           ` Andreas Politz
2009-09-22  7:07           ` David Kastrup
2009-09-22 11:53             ` Pascal J. Bourguignon
2009-09-22 12:16               ` David Kastrup [this message]
2009-09-22 12:37                 ` Pascal J. Bourguignon
2009-09-22 15:18                   ` David Kastrup
2009-09-28 20:03                 ` Samuel Wales
2009-09-18 16:24         ` Thierry Volpiatto
2009-09-18 13:52 ` David Kastrup

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vdjbrx7n.fsf@lola.goethe.zz \
    --to=dak@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.