On Mon, Oct 9, 2017 at 6:43 PM, Ralf Hemmecke <[email protected]> wrote: > On 10/09/2017 12:36 PM, oldk1331 wrote: >>> List(X): NIL or a pointer to a record r >>> where r holds a value of type X and a NIL pointer >>> Record(x: X): NIL or a pointer to a value of type X >>> >>> So the List version stores an unnecessary NIL pointer together with a >>> heap allocation for a Record(x: X, next: Pointer). >> >> You are misleading here. >> >> List with one element is CONS(X, NIL) >> Record with one slot is CONS(X, NIL) >> >> They are identical. > > But that's only the case for Lisp, right? I still consider that a waste > of memory. > > How would you map List(X) and Record(x: X) to C datastructures? > > Ralf
Since Lisp is dynamic typed, you don't have "sizeof", so you can't have "struct" in stack but a pointer to heap. In C you can do zero-cost abstraction, but not in Lisp. -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/fricas-devel. For more options, visit https://groups.google.com/d/optout.
