Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to get a variable address in Common Lisp?

I'm trying to implement XOR-linked lists on Common Lisp, but i need to get an address of a variable to perform any bitwise operations on it. Is there any way to get memory address of a variable, similar to python's id() function?

like image 455
Oleg Semenovsky Avatar asked Nov 19 '15 10:11

Oleg Semenovsky


1 Answers

Usually, memory management in Common Lisp is performed by some kind of Garbage Collector. Many of these algorithms move the objects in memory during a collection cycle.

So the consequencies are that you cannot count on a fixed address for each object, and for this reason no operation in the standard is provided to get the address of a Common Lisp object.

like image 137
Renzo Avatar answered Nov 15 '22 08:11

Renzo