Skip to content

Instantly share code, notes, and snippets.

@drewc
Created January 31, 2019 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drewc/250c558bcf0041c5e43fbc3297893ae8 to your computer and use it in GitHub Desktop.
Save drewc/250c558bcf0041c5e43fbc3297893ae8 to your computer and use it in GitHub Desktop.
(defun sequence-right-trim (thing sequence)
(let ((last (elt sequence (- (length sequence) 1))))
(if (equalp thing last)
(subseq sequence 0 (1+ (position-if-not (lambda (c) (equalp c thing)) sequence :from-end t)))
sequence)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment