Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun address-of (array &rest indices)
- (make-array 1 :element-type (array-element-type array)
- :displaced-to array
- :displaced-index-offset (if indices
- (loop
- :for i :in indices
- :for d :in (append (rest (array-dimensions array)) '(1))
- :for offset := (* i d) :then (* (+ offset i) d)
- :finally (return offset))
- 0)))
- (defun deref (address) (aref address 0))
- (defun (setf deref) (new-value address) (setf (aref address 0) new-value))
- (nth-value 1 (array-displacement (address-of (make-array '(5 4 3)) 1 1 1)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement