It used to be possible with map-subobjects, using the :type keyword,
but this function seems to have disappeared although still somewhat
documented in the dictionary.

hi -- it got renamed map-objects because it can also map lists of objects as well as containers. It has a :class keyword if you want to only map a certain typ of objects. There is a fold-objects function that you can use to return lists (and other things) from mapping.

given

        (defparameter s1 (import-events "/Lisp/cm/etc/tutorials/source.mid" ))

then to return all the keynum slot values of just MIDI objects in s1:

(fold-objects (lambda (x l) (cons x l)) s1 '() :slot 'keynum :class 'midi)

        => (77 77 77 89 75 86 74 92 87 80 ...)

to collect lists of things, you map the objects rather than a slot and return what you want:

(fold-objects (lambda (x l) (cons (list (sv x :time) (sv x :keynum)) l)) s1 '() :class 'midi)

=> ((18.0 77) (17.875 77) (17.75 77) (17.75 89) (17.625 75) (17.625 86) ...)


for more information see:

http://commonmusic.sourceforge.net/etc/tutorials/editing.lisp

and

http://commonmusic.sourceforge.net/doc/dict/fold-objects-fn.html

_______________________________________________
Cmdist mailing list
[email protected]
http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist

Reply via email to