summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utilities.lisp8
1 files changed, 8 insertions, 0 deletions
diff --git a/utilities.lisp b/utilities.lisp
index 214189f..69ddcfe 100644
--- a/utilities.lisp
+++ b/utilities.lisp
@@ -55,3 +55,11 @@
(setf (nth n list) (nth m list)
(nth m list) tmp)
list))
+
+(defun pop-nth (n list &optional share-tail)
+ (when (minusp n)
+ (setf n (+ n (length list))))
+ (multiple-value-bind (front back) (take n list share-tail)
+ (values
+ (nconc front (cdr back))
+ (car back))))