From: Okamsn <okamsn@protonmail.com>
To: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: How to do defmethod dispatch based on the type of a struct's slot?
Date: Sat, 04 May 2024 21:57:28 +0000 [thread overview]
Message-ID: <147553cc-7c3d-4668-9b1b-3b7285aa8821@protonmail.com> (raw)
Hello,
I am trying to test using a `cl-defstruct` structure to represent a
sub-sequence, which would implement `seq-map`. In the structure, I have
a slot that contains the original sequence. I would like to be able to
use different forms of `seq-map` based on the type of the original
sequence. I am having trouble understanding how to create a specializer
and a generalizer for this.
Is there a way to create a specializer for `cl-defmethod`, something
like `(cl-defmethod seq-map (function (sequence (my-test-subseq array)))
...)` ?
I have tried using a type defined via `cl-deftype` as the specializer
using the `satisfies` type, but that did not seem work. Do types defined
via `cl-deftype` work as specializers?
Thank you.
next reply other threads:[~2024-05-04 21:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-04 21:57 Okamsn [this message]
2024-05-05 10:55 ` How to do defmethod dispatch based on the type of a struct's slot? Michael Heerdegen via Users list for the GNU Emacs text editor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=147553cc-7c3d-4668-9b1b-3b7285aa8821@protonmail.com \
--to=okamsn@protonmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).