January 2012
2 posts
Evaluating the last expression
In the REPL, +, ++, and +++ have as values the three most recently evaluated expressions. A quick way to evaluate the previous expression, especially handy in a REPL without input history, is
#.+
It’s equivalent to (eval +).
(Thanks to Anton Kovalenko.)
Un-displacing an array
Here’s a function to get the underlying array on which a displaced array is based:
(defun undisplace-array (array)
"Return the fundamental array and the start and end positions into
it of a displaced array."
(let ((length (length array))
(start 0))
(loop
(multiple-value-bind (to offset) (array-displacement array)
(if to
(setq array to
...