Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

About "consing"

7 views
Skip to first unread message

Xue Fuqiao

unread,
Feb 28, 2013, 9:23:12 AM2/28/13
to help-gn...@gnu.org
In the doc string of the function `memory-use-counts':

Return a list of counters that measure how much consing there has been.

I don't know what the "consing" means here. I only know that `cons' is often
used to add a single element to the front of a list. But this seems to be
irrelevant to the topic.

And in (info "(elisp) Garbage Collection"):

-- Function: memory-use-counts
This returns a list of numbers that count the number of objects
created in this Emacs session.

Does "consing" mean creating an object here? Thanks.

--
Best regards, Xue Fuqiao.
http://www.emacswiki.org/emacs/XueFuqiao

Doug Lewan

unread,
Feb 28, 2013, 9:43:02 AM2/28/13
to Xue Fuqiao, help-gn...@gnu.org
You've got it. That's exactly what consing means.

It's actually more general than the use that you've mentioned.

A CONS cell has two parts: (1) its CAR (a value) and (2) its CDR (a pointer to the next CONS cell). (The names are historical. I don't know if their etymologies matter anymore.) A list is built from CONS cells; the CAR is the first element and the CDR is the rest of the list (which is itself a list).

I know that's a little abstract without motivation. See the emacs lisp info on Lists (which has a section on CONS cells). The section on Building Lists has a picture that shows the connection between CONS cells and lists.

,Douglas
Douglas Lewan
Shubert Ticketing
(201) 489-8600 ext 224

When I do good, I feel good. When I do bad, I feel bad and that's my religion. - Abraham Lincoln

Stefan Monnier

unread,
Feb 28, 2013, 9:47:43 AM2/28/13
to help-gn...@gnu.org
> Return a list of counters that measure how much consing there has been.

Here, "consing" means "cons"truct"ing", i.e. calls to constructors.

> Does "consing" mean creating an object here? Thanks.

Yup,


Stefan


Kevin Rodgers

unread,
Feb 28, 2013, 10:05:55 AM2/28/13
to help-gn...@gnu.org
On 2/28/13 7:23 AM, Xue Fuqiao wrote:
> In the doc string of the function `memory-use-counts':
>
> Return a list of counters that measure how much consing there has been.
>
> I don't know what the "consing" means here. I only know that `cons' is often
> used to add a single element to the front of a list. But this seems to be
> irrelevant to the topic.
>
> And in (info "(elisp) Garbage Collection"):
>
> -- Function: memory-use-counts
> This returns a list of numbers that count the number of objects
> created in this Emacs session.
>
> Does "consing" mean creating an object here? Thanks.

Yes: allocating a cons cell.

--
Kevin Rodgers
Denver, Colorado, USA


Eli Zaretskii

unread,
Feb 28, 2013, 10:57:52 AM2/28/13
to help-gn...@gnu.org
> Date: Thu, 28 Feb 2013 22:23:12 +0800
> From: Xue Fuqiao <xfq....@gmail.com>
>
> In the doc string of the function `memory-use-counts':
>
> Return a list of counters that measure how much consing there has been.
>
> I don't know what the "consing" means here.

Always try the help features first. "i consing RET" will land you
where this terminology is described.

Barry Margolin

unread,
Feb 28, 2013, 11:10:56 AM2/28/13
to
In article <mailman.21101.1362063...@gnu.org>,
And arrays, buffers, etc.

--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
0 new messages