From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.help Subject: Re: Generic functions: Specializers like `or' or `memq'? Date: Wed, 03 Nov 2021 18:21:43 +0000 Message-ID: <87y265aymg.fsf@posteo.net> References: <87r1bxcg6g.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40036"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Emacs mailing list To: Michael Heerdegen Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 03 19:22:58 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1miKuY-000AG4-8M for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 03 Nov 2021 19:22:58 +0100 Original-Received: from localhost ([::1]:42810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miKuW-0004Js-0G for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 03 Nov 2021 14:22:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1miKtU-0004G7-8M for help-gnu-emacs@gnu.org; Wed, 03 Nov 2021 14:21:52 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:55465) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1miKtS-0003J2-6j for help-gnu-emacs@gnu.org; Wed, 03 Nov 2021 14:21:51 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 5500D240103 for ; Wed, 3 Nov 2021 19:21:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1635963705; bh=ygCo3cwQUma3Q0YFEKkLDRdKiSTP6xX+8LU+gMQjML0=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=aMtuepdPU7RHka+ZgjMBwIOql11gqy6HZ4U3fRGWhXK6QIJ4Whbic3F2BS2isOEOz nfI0KuqvESfWIqTSwtsQnIqjEZVwjuC/WGXEq1WQ/pmX5j01JKeqYrTvGOWlyreY9J wlwhJYQiGqL0P+Jon7aJUer2VF635yhZCPNBQdWcC1Vg0ID5teOeI/71pw3lmJKCLK 7lR4K7VFflZcCGZISye00vAJRtQazIlpUzMBc7TsbwqpovRIVAcKIK5K2QBwdCQM9W to6HI4It4AgA4J5QMoMhBxEUa5uLU/iw20nCDCpDgKxSfxWMNUmKVynQtKCkhcQTsW nrRVdlssBu9SQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Hkw8S4RtPz6tmH; Wed, 3 Nov 2021 19:21:44 +0100 (CET) Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB In-Reply-To: <87r1bxcg6g.fsf@web.de> (Michael Heerdegen's message of "Wed, 03 Nov 2021 18:17:11 +0100") Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:134338 Archived-At: Michael Heerdegen writes: > Hello, > > I come back to this question again and again, so it's time to just ask: > > Often I want to use a certain method implementation for several very > similar cases and want to avoid code duplication, but I don't know how > to express this using the existing method specializers. > > For example, I want the `head' spec to match one of several symbols who > are synonymous. Or instead of (eql SYM) I would rather want > (memq (SYMS...)). Or I want to combine several SPECS using `or' because > the implementation is the same. > > Am I'm missing something or - this is not possible currently, right? > Would it be possible to implement such stuff then? I haven't tried it myself, but it seems like you would have to use cl-generic-generalizers (see cl-generic.el) to do so. -- Philip Kaludercic