[CM] A question regarding structures

cristopher pierson ewing cewing@u.washington.edu
Sun, 20 Oct 2002 10:39:04 -0700 (PDT)


I'm actually using objects for precisely that reason, but I'm facing a
problem when dealing with CLM.  All of CLM's generators seem to be
implemented as structures, rather than as objects.  I'm trying to work out
an instrument that would allow me to pass as parameters a series of
generators and the envelopes to control them, and would then chain these
generators together into a DSP patch that could be reconfigured with each
call to the instrument.  I'm thinking that in order to do that, without
having to write specific code for each generator that might be used, I
woild need to be able to ask a generator what it's slots were in order to
know what to set.

I've also created a version of this thing that works by using sound-let to
perform each dsp function as an individual instrument, and write its
results to a sound file that is passed on to the next instrument, but
doing this seems to be rather slow, and I'd like to increase the speed of
processing.

I'm in a bit of a quandry here, although it isn't too serious.

Cris

BTW, thanks for the answer to the structures question.

C

********************************
Cris Ewing
CARTAH Assistant
University of Washington
Home Phone: (206) 365-3413
E-mail: cewing@u.washington.edu
*******************************


On Sun, 20 Oct 2002, Rick Taube wrote:

> > Given a structure called joe, whose slots are z y and z, is there a way to
> > obtain a list of the slots in joe?
>
> structs do not support this kind of introspection. but both clos and goops
> do.  so just use objects instead of structs
>
> (defclass foo ((a)(b)(c)))
> (class-slots (find-class 'foo))
>
> to get a list of slot symbol names from  a class do:
> (mapcar #'slot-description-name (class-slots (find-class 'foo)))
>
> look at cm's objects.scm and mop.scm for more examples.
> search in CLTL or the Guile Goops manual for "Metaobject Protocol" to see
> what all is available.
>
>
> ----- Original Message -----
> From: "cristopher pierson ewing" <cewing@u.washington.edu>
> To: <cmdist@ccrma.Stanford.EDU>
> Sent: Saturday, October 19, 2002 5:50 PM
> Subject: [CM] A question regarding structures
>
>
> > I have a question about structures in Common Lisp.
> >
> >
> > I mean to say, if I know there is a structure named joe, and I wish to
> > know what slots is has, can I find that information using a function of
> > some sort?
> >
> > so
> > (deftruct joe x y z)
> > gives the structure,
> > and
> > (slots joe) ;;my imaginary function
> > would return
> > (x y z)
> >
> > Thanks,
> >
> > Cris
> >
> >
> > ********************************
> > Cris Ewing
> > CARTAH Assistant
> > University of Washington
> > Home Phone: (206) 365-3413
> > E-mail: cewing@u.washington.edu
> > *******************************
> >
> >
> > _______________________________________________
> > Cmdist mailing list
> > Cmdist@ccrma.stanford.edu
> > http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist
> >
>
>