Gnus development mailing list
 help / color / mirror / Atom feed
From: prj@po.cwru.edu (Paul Jarc)
Subject: Re: where does this belong?
Date: Wed, 27 Mar 2002 11:06:28 -0500	[thread overview]
Message-ID: <m3u1r22dwl.fsf@multivac.cwru.edu> (raw)
In-Reply-To: <87k7rypaoi.fsf@inanna.rimspace.net> (Daniel Pittman's message of "Wed, 27 Mar 2002 21:27:57 +1100")

Daniel Pittman <daniel@rimspace.net> wrote:
> I agree with Kai -- the right place for this is the `cl' package,
> because I can't see the difference between this and the `defstruct'
> routine...

Well, the most significant difference is that I didn't know about cl's
defstruct. :)  Now that I do, I see that mine is much smaller:

(defmacro nnmaildir--defstruct (name members)
  "Defines NAME-new, NAME-get-MEMBER, and NAME-set-MEMBER macros."
  (let ((index 0)
        (namesym name)
        member)
    (setq name (symbol-name namesym))
    (eval `(defmacro ,(intern (concat name "-new")) ()
             ,(concat "Creates a new \"" name "\" structure.")
             '(make-vector ,(length members) nil)))
    (mapcar
      (lambda (membersym)
        (setq member (symbol-name membersym))
        (eval `(defmacro ,(intern (concat name "-get-" member)) (,namesym)
                 ,(concat "Returns the \"" member "\" member of a \"" name
                          "\" structure.")
                 (list 'aref ,namesym ,index)))
        (eval `(defmacro ,(intern (concat name "-set-" member))
                 (,namesym ,membersym)
                 ,(concat "Sets the \"" member "\" member of a \"" name
                          "\" structure.")
                 (list 'aset ,namesym ,index ,membersym)))
        (setq index (1+ index)))
      members)
    nil))

But I don't think I understand what the cl defstruct does, exactly.
Can someone point me to an example use?


paul



  reply	other threads:[~2002-03-27 16:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-27  0:18 Paul Jarc
2002-03-27  8:57 ` Kai Großjohann
2002-03-27 10:17 ` Simon Josefsson
2002-03-27 10:27   ` Daniel Pittman
2002-03-27 16:06     ` Paul Jarc [this message]
2002-03-27 17:16       ` Kai Großjohann
2002-03-27 19:13         ` Paul Jarc
2002-03-28  2:09       ` Daniel Pittman

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3u1r22dwl.fsf@multivac.cwru.edu \
    --to=prj@po.cwru.edu \
    /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 NNTP newsgroup(s).