Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Lisp BigO

Name: Anonymous 2012-01-02 16:07

How fast is:
 
(cdr list...)

Name: Anonymous 2012-01-02 18:27

>>15

yeah, I should have clarified. In dynamic languages, primitives are often wrapped inside of tagged objects. So an int is actually something like:

struct fixnum {
  enum object_type = TYPE_FIXNUM;
  int value;
};

And then this object would be allocated on the heap, possibly using reference counting, or just depending on garbage collection. So in this case, storing a primitive in the cdr is just storing a pointer to something other than a cons cell. So it might be more accurate to just do:

struct simple_cons {
  void *car;
  void *cdr;
};

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List