Browse files

New `strip-if' and `strip' functions.

  • Loading branch information...
1 parent 927753b commit 205ce2603fe5c492a50d113bab27aa0a5eec207a @davazp committed Feb 8, 2010
Showing with 4 additions and 10 deletions.
  1. +4 −10 utils.lisp
@@ -74,17 +74,11 @@
(defmacro unimp (feature)
`(error "~a is not implemented yet." ,feature))
-(defun strip (list func)
- (with-collecting
- (dolist (i list)
- (if (apply func (list i))
- (return)
- (collect i)))))
-(defun strip-to-item (list item &key (comparator 'eql))
- "Delete from the end to the list to the specified item"
- (strip list (lambda (x)
- (apply comparator (list item x)))))
+(defun strip-if (func seq &rest rest &key &allow-other-keys)
+ (subseq seq 0 (apply #'position-if func seq rest)))
+(defun strip (x seq &rest rest &key &allow-other-keys)
+ (subseq seq 0 (apply #'position x seq rest)))
;;; utils.lisp ends here

0 comments on commit 205ce26

Please sign in to comment.