From: His kennyness on
remf does not return the new plist?! It returns an afterthought,
something perfect for a second value?!!

stunning flaw.
From: Joshua Taylor on
His kennyness wrote:
> remf does not return the new plist?! It returns an afterthought,
> something perfect for a second value?!!
>
> stunning flaw.

The Issue PLIST-DUPLICATES Writeup [1] mentions that since REMF only
removes the first occurrence of a property, there are places where "the
idiom (do () ((not (remf plist property)))) is useful." If remf
returned the plist, this wouldn't work. I find the following useful,
though it doesn't give a boolean to indicate whether any properties were
removed.


(defun %remf* (plist indicator)
(do () ((not (remf plist indicator)) plist)))

(define-modify-macro remf* (indicator)
%remf* "Remove all occurrences of indicator from the plist. Returns
the new plist.")


[1] http://www.lispworks.com/documentation/lw50/CLHS/Issues/iss269_w.htm
 | 
Pages: 1
Prev: dynamically creating a string
Next: linedit