chiark
/
gitweb
/
~mdw
/
clg
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
36df51a
)
Added new function PLIST-REMOVE
author
espen
<espen>
Thu, 12 Jul 2007 09:02:53 +0000
(09:02 +0000)
committer
espen
<espen>
Thu, 12 Jul 2007 09:02:53 +0000
(09:02 +0000)
tools/utils.lisp
patch
|
blob
|
blame
|
history
diff --git
a/tools/utils.lisp
b/tools/utils.lisp
index 27aab4dacf248812f87d933a9606440d78218271..ef1ccf0de6c63b4074a43b6a62919af91b26d8e4 100644
(file)
--- a/
tools/utils.lisp
+++ b/
tools/utils.lisp
@@
-20,13
+20,13
@@
;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-;; $Id: utils.lisp,v 1.
2 2006/04/25 20:26:04
espen Exp $
+;; $Id: utils.lisp,v 1.
3 2007/07/12 09:02:53
espen Exp $
(defpackage #:clg-utils
(:use #:common-lisp)
(:export #:read-lines #:mklist #:namep #:funcallable #:return-if #:when-bind
#:visible-char-p #:whitespace-p #:split-string-if #:split-string
(defpackage #:clg-utils
(:use #:common-lisp)
(:export #:read-lines #:mklist #:namep #:funcallable #:return-if #:when-bind
#:visible-char-p #:whitespace-p #:split-string-if #:split-string
- #:concatenate-strings #:string-prefix-p #:get-all
+ #:concatenate-strings #:string-prefix-p #:get-all
#:plist-remove
#:delete-collect-if))
(in-package #:clg-utils)
#:delete-collect-if))
(in-package #:clg-utils)
@@
-109,6
+109,12
@@
(defun get-all (plist property)
(when tail
(cons value (get-all (cddr tail) property)))))
(when tail
(cons value (get-all (cddr tail) property)))))
+(defun plist-remove (key plist &key (test #'eq))
+ (loop
+ for (%key value) on plist by #'cddr
+ while (and %key value)
+ unless (funcall test key %key)
+ nconc (list %key value)))
(defun delete-collect-if (predicate seq)
(let ((head (cons nil seq)))
(defun delete-collect-if (predicate seq)
(let ((head (cons nil seq)))