From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Okamsn Newsgroups: gmane.emacs.help Subject: How to do defmethod dispatch based on the type of a struct's slot? Date: Sat, 04 May 2024 21:57:28 +0000 Message-ID: <147553cc-7c3d-4668-9b1b-3b7285aa8821@protonmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24247"; mail-complaints-to="usenet@ciao.gmane.io" To: "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 04 23:58:32 2024 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 1s3NOp-00069W-Mm for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 04 May 2024 23:58:31 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3NO5-00070z-0m; Sat, 04 May 2024 17:57:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s3NO3-00070L-0a for help-gnu-emacs@gnu.org; Sat, 04 May 2024 17:57:43 -0400 Original-Received: from mail-40131.protonmail.ch ([185.70.40.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s3NO1-00034d-0w for help-gnu-emacs@gnu.org; Sat, 04 May 2024 17:57:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1714859851; x=1715119051; bh=i6xXIlw5z+S4Mpp5l6dIh9zCy3MjzyZ9freFOmrJ+DQ=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=yr42mmPxAJM014VrOW5k1n8OlwLb6gNpmgh1T1p9ogeLx7SBTVCDKyvY62Ruk0P2O QLO+vUJHX/mdqd+cdWdaXZTmodizDfUiJkAy5GP7rLQQ5xk2W4ng0f471wYdnCS9iE gM4REd/VuiY7ZcvFNy8nPrwaTZzgkydBZaGHqSCO1LQnNRd6Lu+w6FYf/NH9h5e/HU xbqFfkitMEytd0ixNJZzXSUdGlCDTCDQ0YZ2gGpjA3iDa4Ssir6SWDeOMBqXsNEBFp mn4Ay6v8VxFO221Eml07hQrQJMt7KxMfnsmhwLJ6eubqEkO1Cddg6hDefFsvA80XVe EEBkZra/bC8CQ== Feedback-ID: 25935600:user:proton X-Pm-Message-ID: 0a54ea6730422f617f78dc8c3a4c117c910dafdb Received-SPF: pass client-ip=185.70.40.131; envelope-from=okamsn@protonmail.com; helo=mail-40131.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:146542 Archived-At: Hello, I am trying to test using a `cl-defstruct` structure to represent a=20 sub-sequence, which would implement `seq-map`. In the structure, I have=20 a slot that contains the original sequence. I would like to be able to=20 use different forms of `seq-map` based on the type of the original=20 sequence. I am having trouble understanding how to create a specializer=20 and a generalizer for this. Is there a way to create a specializer for `cl-defmethod`, something=20 like `(cl-defmethod seq-map (function (sequence (my-test-subseq array)))=20 ...)` ? I have tried using a type defined via `cl-deftype` as the specializer=20 using the `satisfies` type, but that did not seem work. Do types defined=20 via `cl-deftype` work as specializers? Thank you.