[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-users] Pattern question
Hiho,
On Wednesday 11 March 2009 08:49:38 Julian Rohrhuber wrote:
> >Hiho,
> >
> >is there already another way to do this?
>
> no, there isn't -
> It seems to me that "at" is already used in node proxy to index slots
> - so that this usage assumes too much.
ok.
> I think better this should be implemented in Pbind and in Object:
>
> + Object {
> atKey { |key| ^nil }
> }
>
> + Pbind {
> atKey { |key|
> patternpairs.pairsDo { |k, val|
> if(k === key) { ^val }
> };
> ^nil
> }
> }
>
> then you write Pdefn(\maypattern).source.atKey(\freq)
>
> would this be reasonable, or still too long?
>
> PatternProxy:atKey could be defined then, still.
have a PatternProxy:atKey that forward to the Pbind one would be useful, to
keep things short.
Should we add this stuff to the livecode quark?
sincerely,
Marije
> >// get the frequency value pattern from a Pdef:
> >Pdef( \mypattern ).at( \freq )
> >
> >// using this extension
> >+ Pdef{
> > at{ |key|
> > var ret;
> > try{
> > ret = source.patternpairs.clump(2).detect({
> >
> >|it| it[0] == key })[1]
> >
> > }{ ret = nil };
> > ^ret;
> > }
> >}
> >
> >
> >sincerely,
> >Marije
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/