Changeset - 176be211c59a
[Not reviewed]
0 1 0
Sergey Pashinin - 11 years ago 2014-08-23 13:47:48
sergey@pashinin.com
Removed wg-leave
1 file changed with 0 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/workgroups-utils-basic.el
Show inline comments
 
@@ -176,28 +176,24 @@ Otherwise return nil.  KEYS can be any keywords accepted by `remove*'."
 
      (length (setf ,seq-place (cl-remove ,item ,seq-place ,@keys)))))
 

	
 
(defmacro wg-pushnew-p (item seq-place &rest keys)
 
  "If ITEM is not a `member' of SEQ-PLACE, push it to SEQ-PLACE and return t.
 
Otherwise return nil.  KEYS can be any keyword args accepted by `pushnew'."
 
  `(< (length ,seq-place)
 
      (length (cl-pushnew ,item ,seq-place ,@keys))))
 

	
 
(defun wg-take (list n)
 
  "Return a list of the first N elts in LIST."
 
  (butlast list (- (length list) n)))
 

	
 
(defun wg-leave (list n)
 
  "Return a list of the last N elts in LIST."
 
  (nthcdr (- (length list) n) list))
 

	
 
(defun wg-rnth (n list)
 
  "Return the Nth element of LIST, counting from the end."
 
  (nth (- (length list) n 1) list))
 

	
 
(defun wg-take-until-fail (pred list)
 
  "Take elements from LIST up to the first element on which PRED fails."
 
  (let (taken)
 
    (catch 'result
 
      (dolist (elt list (nreverse taken))
 
        (if (funcall pred elt) (push elt taken)
 
          (throw 'result (nreverse taken)))))))
 

	
0 comments (0 inline, 0 general)