From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: member returns list Date: Sun, 06 Sep 2015 04:57:16 +0200 Message-ID: <878u8kl0fn.fsf@debian.uxu> References: <55E5C99B.3020608@yandex.ru> <87lhcpu2wb.fsf_-_@debian.uxu> <874mjchisl.fsf@web.de> <87pp20jxy7.fsf@debian.uxu> <87twrcxyfk.fsf@mbork.pl> <87y4gnt2r5.fsf@debian.uxu> <87twran0dw.fsf@mbork.pl> <87d1xwbwh9.fsf@debian.uxu> <87r3mcagbe.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1441507774 16694 80.91.229.3 (6 Sep 2015 02:49:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 6 Sep 2015 02:49:34 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Sep 06 04:49:25 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZYQ1E-0001UF-5a for geh-help-gnu-emacs@m.gmane.org; Sun, 06 Sep 2015 04:49:24 +0200 Original-Received: from localhost ([::1]:44470 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYQ1E-0002uf-6I for geh-help-gnu-emacs@m.gmane.org; Sat, 05 Sep 2015 22:49:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49027) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYQ14-0002tg-MC for help-gnu-emacs@gnu.org; Sat, 05 Sep 2015 22:49:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZYQ10-0000zs-Eg for help-gnu-emacs@gnu.org; Sat, 05 Sep 2015 22:49:14 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:43398) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYQ10-0000zo-7j for help-gnu-emacs@gnu.org; Sat, 05 Sep 2015 22:49:10 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ZYQ0w-0001Bj-1T for help-gnu-emacs@gnu.org; Sun, 06 Sep 2015 04:49:06 +0200 Original-Received: from nl106-137-244.student.uu.se ([130.243.137.244]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 06 Sep 2015 04:49:06 +0200 Original-Received: from embe8573 by nl106-137-244.student.uu.se with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 06 Sep 2015 04:49:06 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Lines: 43 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: nl106-137-244.student.uu.se Mail-Copies-To: never User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Cancel-Lock: sha1:ghScjOR1gAuup4z5v29VbSonmb8= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:107042 Archived-At: Random832 writes: > How is this different from memq itself > appearing repeatedly? `memq' is a function. What should not be repeated is data (in your case the a function passed as an argument). > Or the substring -eq appearing repeatedly in your > version in symbols like member-eq and assoc-eq? Those are not my versions. I made the examples to show how it could look. It doesn't, which is good. > It's just like using a naming convention, only it > makes it possible (and obvious that it is possible) > to substitute the comparison function with your own > function. It's simpler because instead of having two > functions to do two things with no obvious way to do > the same thing with anything else, you have one > function that can easily discoverably do anything. There should be one function that can do everything but common patterns should be factored out into interfaces and/or optimizations. Code shouldn't look like this: (do-this 1 2 3) (do-this 1 2 3) (do-this 1 2 3) But like this: (defun do-the-one-two-three-thing () (do-this 1 2 3) ) (loop repeat 3 do (do-the-one-two-three-thing)) -- underground experts united http://user.it.uu.se/~embe8573