comparison lisp/cl-seq.el @ 442:abe6d1db359e r21-2-36

Import from CVS: tag r21-2-36
author cvs
date Mon, 13 Aug 2007 11:35:02 +0200
parents 3ecd8885ac67
children 023b83f4e54b
comparison
equal deleted inserted replaced
441:72a7cfa4a488 442:abe6d1db359e
63 63
64 ;;; Keyword parsing. This is special-cased here so that we can compile 64 ;;; Keyword parsing. This is special-cased here so that we can compile
65 ;;; this file independent from cl-macs. 65 ;;; this file independent from cl-macs.
66 66
67 (defmacro cl-parsing-keywords (kwords other-keys &rest body) 67 (defmacro cl-parsing-keywords (kwords other-keys &rest body)
68 "Helper macro for functions with keyword arguments.
69 This is a temporary solution, until keyword arguments are natively supported.
70 Declare your function ending with (... &rest cl-keys), then wrap the
71 function body in a call to `cl-parsing-keywords'.
72
73 KWORDS is a list of keyword definitions. Each definition should be
74 either a keyword or a list (KEYWORD DEFAULT-VALUE). In the former case,
75 the default value is nil. The keywords are available in BODY as the name
76 of the keyword, minus its initial colon and prepended with `cl-'.
77
78 OTHER-KEYS specifies other keywords that are accepted but ignored. It
79 is either the value 't' (ignore all other keys, equivalent to the
80 &allow-other-keys argument declaration in Common Lisp) or a list in the
81 same format as KWORDS. If keywords are given that are not in KWORDS
82 and not allowed by OTHER-KEYS, an error will normally be signalled; but
83 the caller can override this by specifying a non-nil value for the
84 keyword :allow-other-keys (which defaults to t)."
68 (cons 85 (cons
69 'let* 86 'let*
70 (cons (mapcar 87 (cons (mapcar
71 (function 88 (function
72 (lambda (x) 89 (lambda (x)
336 to avoid corrupting the original SEQ. 353 to avoid corrupting the original SEQ.
337 Also see: `remove*', `delete', `delete*'" 354 Also see: `remove*', `delete', `delete*'"
338 (remove* cl-item cl-seq ':test 'equal)) 355 (remove* cl-item cl-seq ':test 'equal))
339 356
340 (defun remq (cl-elt cl-list) 357 (defun remq (cl-elt cl-list)
341 "Remove all occurances of ELT in LIST, comparing with `eq'. 358 "Remove all occurrences of ELT in LIST, comparing with `eq'.
342 This is a non-destructive function; it makes a copy of LIST to avoid 359 This is a non-destructive function; it makes a copy of LIST to avoid
343 corrupting the original LIST. 360 corrupting the original LIST.
344 Also see: `delq', `delete', `delete*', `remove', `remove*'." 361 Also see: `delq', `delete', `delete*', `remove', `remove*'."
345 (if (memq cl-elt cl-list) 362 (if (memq cl-elt cl-list)
346 (delq cl-elt (copy-list cl-list)) 363 (delq cl-elt (copy-list cl-list))