Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 626471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:25:22+00:00 2026-05-13T19:25:22+00:00

I read in the book ‘On Lisp’ that one should avoid excessive use of

  • 0

I read in the book ‘On Lisp’ that one should avoid excessive use of cons in the body of expanded macros. Why is cons considered to be an inefficient operation? Does Lisp not do structure sharing with the cons cells?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T19:25:22+00:00Added an answer on May 13, 2026 at 7:25 pm

    You need to understand the jargon first.

    CONS is a primitive operation to create a fresh cons cell.

    Consing means allocation of memory on the heap in general, not only cons cells: Consing of numbers, Consing of arrays, Consing of CLOS objects, …

    The definition from the ‘memory management glossary’ says:

    1. cons(1) In Lisp, cons is a primitive operation creating a list element (from English “CONStruct”). By extension, a cons is the element created.
    2. cons(2) (for full details, see allocate) Allocation is the process
      of assigning resources. When
      requested to by the program, an
      application memory manager or
      allocator allocates a block of
      memory(2) for the program to store
      its data in. Allocation is also
      known as consing, from cons(1).

    So, Graham uses the second meaning.

    If Graham says ‘Avoid consing especially. A utility which conses unnecessarily can ruin the performance of an otherwise efficient program.’ – that means: avoid unnecessary memory allocation on the heap. But this can be true for any code – macro, function, whatever.

    That was particular true when computers had less memory and Garbage Collection was more costly (especially when it needed to scan swapped out memory in virtual memory systems, where the physical memory is smaller than the virtual memory).

    Today consing is less an issue, but can still be relevant.

    Take for example a the function READ-LINE, it reads a line from a stream and ‘conses’ a new string. Note that the string is not built out of conses, but it is a vector. We mean here ‘allocates a string on the heap’. If you have a large file with lots of lines, it can be faster to have a routine that gets a buffer and which fills the buffer with the line characters (there are vectors in Common Lisp with a fill pointer for this). That way the line buffer is just one object and can potentially be reused for calls to this line reading function.

    See this example in the Allegro CL documentation: Some techniques for reducing consing when processing very large text files.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 325k
  • Answers 325k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You going to want to use the following: customMod_form_alter(&$form, $form_state,… May 14, 2026 at 1:30 am
  • Editorial Team
    Editorial Team added an answer Well, you just can't do it that way if you… May 14, 2026 at 1:30 am
  • Editorial Team
    Editorial Team added an answer For me it's the good way. May 14, 2026 at 1:30 am

Related Questions

Does LINQ substitute the presentation model? I read in the book ASP.NET MVC in
why we can't Serialize objects into Random Access file ? and on the other
My question is quite relevant to something asked before but I need some practical
I'm working on a user authentication thing for a web site. Having read the
I read in the Essential C# 3.0 and .NET 3.5 book that: GetHashCode()’s returns

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.