Why is consing in Lisp slow?
问题 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: 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