[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sc-devel] RFC: Pseq change



Is there a PUrn?  If not, I think there should be.  I could write it.

Sam

On Dec 3, 2007, at 9:50 AM, ronald kuivila wrote:


On Dec 3, 2007, at 8:56 AM, James Harkins wrote:

I like this for Pseq. I'm not sure how it would work for Prand and its siblings, since they don't iterate over the entire collection. How would you determine when to get the next list?


Hi James.

I am thinking of using Pstep in that context, so the Pseq calls next each time, but gets the same array for a specified time interval.
This makes it a bit unclear if a pattern like Pxrand (which assumes a stable array) should support it, but my thinking is that it is reasonable
to have that functionality over an interval and the semantic blip that changing the array drops the guarantee of a changed value is unavoidable.  

RJK

Very likely the intended use of reverse is where you have a number of short, finite Pbinds being chosen in a higher level pattern (Pseq or Prand, e.g.). But it does seem an odd way to go about it, and one that I don't recall having occasion to use.

hjh


On Dec 3, 2007, at 8:04 AM, ronald kuivila wrote:

Hi all,

I would like to propose that some list patterns (Pseq, Prand, Pwrand) be able to take a pattern in their list argument.
This makes it possible to use Pstep or Pseg to change the collection of values used over time.  

In the case of Pseq, the pattern would get an array from the list stream, iterate and then get another.  This does not change
existing uses at all, but it does add a 'next'. Any objections?

Also, I notice that Pseq has this support for a 'reverse' key.  This seems pretty hackish as it would apply to all
Pseqs in the event stream.  Am I missing something? I wonder if this switch could or should be deleted:

Pseq : ListPattern {
var <>offset;
*new { arg list, repeats=1, offset=0;
^super.new(list, repeats).offset_(offset)
}
embedInStream {  arg inval;
var item, offsetValue,listStream, listVal;
offsetValue = offset.value;
listStream = list.asStream;
if (inval.eventAt('reverse') == true, {
repeats.value.do({ arg j;
listVal = listStream.next(inval);
if (listVal.isNil) {^inval };
listVal.size.reverseDo({ arg i;
item = listVal.wrapAt(i + offsetValue);
inval = item.embedInStream(inval);
});
});
},{
repeats.value.do({ arg j;
listVal = listStream.next(inval);
if (listVal.isNil) {^inval };
listVal.size.do({ arg i;
item = listVal.wrapAt(i + offsetValue);
inval = item.embedInStream(inval);
});
});
});
^inval;
}
storeArgs { ^[ list, repeats, offset ] }
}

RJK
_______________________________________________
Sc-devel mailing list


: H. James Harkins
.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman

_______________________________________________
Sc-devel mailing list

_______________________________________________
Sc-devel mailing list
Sc-devel@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-devel



myspace.com/sampluta
myspace.com/exclusiveor
myspace.com/glissandobinladen