From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/72488 Path: news.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.gnus.general Subject: Re: Symbol's function definition is void: remove-if-not Date: Mon, 04 Oct 2010 16:15:56 +0900 Organization: Emacsen advocacy group Message-ID: References: <87sk0n9umn.fsf@escher.home> <8739sn2tch.fsf@keller.adm.naquadah.org> <87eic6hb2h.fsf@lifelogs.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1286176647 11561 80.91.229.12 (4 Oct 2010 07:17:27 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 4 Oct 2010 07:17:27 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M20860@lists.math.uh.edu Mon Oct 04 09:17:26 2010 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1P2fIX-0002M5-9O for ding-account@gmane.org; Mon, 04 Oct 2010 09:17:21 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1P2fIR-00045N-2G; Mon, 04 Oct 2010 02:17:15 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1P2fIP-000455-1p for ding@lists.math.uh.edu; Mon, 04 Oct 2010 02:17:13 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1P2fIN-0001dG-Pl for ding@lists.math.uh.edu; Mon, 04 Oct 2010 02:17:12 -0500 Original-Received: from orlando.hostforweb.net ([216.246.45.90]) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1P2fIM-0004r6-00 for ; Mon, 04 Oct 2010 09:17:10 +0200 Original-Received: from localhost ([127.0.0.1]:58271) by orlando.hostforweb.net with esmtpa (Exim 4.69) (envelope-from ) id 1P2fHp-000183-Iz for ding@gnus.org; Mon, 04 Oct 2010 02:16:38 -0500 X-Hashcash: 1:20:101004:ding@gnus.org::Z7laHu1HgljxvDiK:00001w6s X-Face: #kKnN,xUnmKia.'[pp`;Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu;B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:pftxRcOQt47WTs5DF25qA/Vh6Jg= X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - orlando.hostforweb.net X-AntiAbuse: Original Domain - gnus.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - jpl.org X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:72488 Archived-At: Ted Zlatanov wrote: [...] > Can you use `gnus-remove-if' with the predicate inverted? It can be used, if the type of a sequence is `list'. For a non- list sequence, we can convert it to a list as the function `coerce' does (see cl-extra.el). Though the type of a modified sequence has to be changed again into that of the original (if needed). However, it may be hard to make it work for a hash table. So is the genuine `remove-if-not'! > It looks like `remove-if-not' is used in several places actually: > gnus-art.el: (remove-if-not pred (mailcap-mime-types)) > gnus-group.el: (remove-if-not 'symbolp collection))) > gnus-score.el: (remove-if-not > gnus-sum.el: (remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb) > gnus-sum.el: prom (remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb) The use of `remove-if-not' in gnus-sum.el is a wrong approach since it doesn't necessarily recognize all the group names in `gnus-active-hashtb'. That looks like a normal vector of which the length is 4096, however it can hold more than 4096 group names and `remove-if-not' cannot access all of them. For instance: ;; Make a hash table of which the length is 1. (let ((hashtable (make-vector 1 0))) (length hashtable)) => 1 ;; We can put more than 1 symbol to it, ;; but it still looks like a vector of which the size is 1. (let ((hashtable (make-vector 1 0))) (intern "A" hashtable) (intern "B" hashtable) (intern "C" hashtable) (intern "D" hashtable) (list (length hashtable) hashtable)) => (1 [D]) ;; It actually holds four symbols. (let ((hashtable (make-vector 1 0))) (intern "A" hashtable) (intern "B" hashtable) (intern "C" hashtable) (intern "D" hashtable) (let (rest) (mapatoms (lambda (symbol) (push symbol rest)) hashtable) rest)) => (A B C D) ;; `remove-if-not' recognize the hash table in question as [D], ;; therefore: (let ((hashtable (make-vector 1 0))) (intern "A" hashtable) (intern "B" hashtable) (intern "C" hashtable) (intern "D" hashtable) (remove-if-not (lambda (symbol) (string-lessp symbol 'C)) hashtable)) => [] ;; But the expected result of it is like the following, isn't it? (let ((sequence [A B C D])) (remove-if-not (lambda (symbol) (string-lessp symbol 'C)) sequence)) => [A B]