diff options
author | Sean Allred <code@seanallred.com> | 2014-11-18 15:34:10 -0500 |
---|---|---|
committer | Sean Allred <code@seanallred.com> | 2014-11-18 15:34:10 -0500 |
commit | 821bf636028a38562e18d0da0818cd5d09748f97 (patch) | |
tree | dc0514c652c49f11619fec77021ab19268e7dbbb /sx.el | |
parent | 85268ef6fa01b407e712df8199816f9639a5e539 (diff) | |
parent | 93ba268e78dd4967343f479403719a2e20ebc5bd (diff) |
Merge pull request #71 from vermiculus/hidden-questions
Hidden questions
Diffstat (limited to 'sx.el')
-rw-r--r-- | sx.el | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -27,6 +27,21 @@ ;;; Utility Functions +(defmacro sx-sorted-insert-skip-first (newelt list &optional predicate) + "Inserted NEWELT into LIST sorted by PREDICATE. +This is designed for the (site id id ...) lists. So the first car +is intentionally skipped." + `(let ((tail ,list) + (x ,newelt)) + ;; The first element is never less-than. + (while (and + ;; We're at the end. + (cdr-safe tail) + ;; We're at the right place. + (,(or predicate #'<) x (cadr tail))) + (setq tail (cdr tail))) + (setcdr tail (cons x (cdr tail))))) + (defun sx-message (format-string &rest args) "Display a message" (message "[stack] %s" (apply #'format format-string args))) |