emacs: define prot-common--rotate

This commit is contained in:
Protesilaos 2026-07-15 16:33:27 +03:00
parent 109919ced3
commit 36844d4ba6
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA
2 changed files with 20 additions and 0 deletions

View file

@ -12440,6 +12440,16 @@ floating points: 16.666666666666664 => 16.667."
(propertize c-string 'face 'success)
(propertize f-string 'face 'error))))
;;;###autoload
(defun prot-common--rotate (elements)
"Rotate list ELEMENTS so that nth 0 is last, nth 1 is nth 0, and so on.
Do it without side effects, unlike `prot-common-rotate-list-of-symbol'."
(declare (side-effect-free t))
(setq elements (copy-sequence elements))
(let ((first (car elements))
(rest (cdr elements)))
(append rest (list first))))
;;;###autoload
(defun prot-common-rotate-list-of-symbol (symbol)
"Rotate list value of SYMBOL by moving its car to the end.

View file

@ -171,6 +171,16 @@ floating points: 16.666666666666664 => 16.667."
(propertize c-string 'face 'success)
(propertize f-string 'face 'error))))
;;;###autoload
(defun prot-common--rotate (elements)
"Rotate list ELEMENTS so that nth 0 is last, nth 1 is nth 0, and so on.
Do it without side effects, unlike `prot-common-rotate-list-of-symbol'."
(declare (side-effect-free t))
(setq elements (copy-sequence elements))
(let ((first (car elements))
(rest (cdr elements)))
(append rest (list first))))
;;;###autoload
(defun prot-common-rotate-list-of-symbol (symbol)
"Rotate list value of SYMBOL by moving its car to the end.