# cons cell implementation in Clisp



## asp5 (Sep 16, 2012)

Hi all,

I was just wondering how the cons cell is implemented in Clisp and other Lisps. Upon reading briefly, I think that these were registers which can hold 2 pointers (CAR, CDR)... I wanted to know how they are implemented in software? (void *)? but list can hold multiple types, we need to maintain a type of the obj associated with this, for typecasting and stuff. Is there a header for each section (which holds type info and other bookkeeping info). Coming from C land wanted to see how this is implemented. Please share your thoughts or point me to a location where I can get the info. 

Thanks.


----------



## ChalkBored (Sep 18, 2012)

http://www.clisp.org/impnotes/src-files.html
You're probably best off digging through the source to see how it's done.
also:
http://www.bcl.hamilton.ie/~nmh/t3x.org/zzz/scheme-9-from-empty-space.zip  is a book that shows you how to write an implementation of Scheme from scratch. It might be of interest.


----------



## asp5 (Sep 18, 2012)

ChalkBored said:
			
		

> http://www.clisp.org/impnotes/src-files.html
> You're probably best off digging through the source to see how it's done.
> also:
> http://www.bcl.hamilton.ie/~nmh/t3x.org/zzz/scheme-9-from-empty-space.zip  is a book that shows you how to write an implementation of Scheme from scratch. It might be of interest.



Thanks. I'm looking at the code. Thanks for the book link.


----------

