Re: [racket] Value Extraction from Lists vs. Structures

2010-12-07 Thread Matthias Felleisen
Here is an expansion on Noel's answer. When the compiler sees a (struct book (author title)) it creates code that allocates a vector of three words: -- one that says "I am not a vector, but a book struct" -- one that holds the author value -- one that holds the title value The functio

Re: [racket] Value Extraction from Lists vs. Structures

2010-12-06 Thread Noel Welsh
Structure access is implemented by taking the address of the structure and adding an offset giving the memory address of the field. Addition is an O(1) operation, as is memory referencing. HTH, N. PS: Neither of the above statements are completely true, but they suffice for a simple machine model