Ar an chéad lá de mí Meitheamh, scríobh Didier Verna:
NOTE: This patch has been committed.
This patch adds a lisp function OBJECT-ADDRESS. See the docstring for
We already have this functionality, as part of the hash table support,
though I admit it’s not documented as such:
DEFUN ("eq-hash", Feq_hash, 1, 1, 0, /*
Return a hash value for OBJECT appropriate for use with `eq.'
return make_integer ((EMACS_INT) XPNTRVAL (object));
So your API becomes:
(defun object-address (object)
(let ((eq-hash (eq-hash object)))
(and (eql 0 (logand eq-hash #b11)) eq-hash)))
Are there equivalent functions in other Lisps?
“Apart from the nine-banded armadillo, man is the only natural host of
Mycobacterium leprae, although it can be grown in the footpads of mice.”
-- Kumar & Clark, Clinical Medicine, summarising improbable leprosy research
XEmacs-Patches mailing list