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

Re: [sc-dev] ListPatterns: a modest proposal

The example given will work in the version preceeding James Harkins' change. setting the know flag true causes an IdentityDictionary to respond to its elements.
for example:

a = (x:4, y:5, distance:{|self| sqrt(self.x.squared + self.y.squared)});
a.know = true;


The example was only meant to point out that isKindOf is usually not the best way to solve a problem. Using something like asSomethingThatCanGoInAListPattern which could be overriddden by something other than a SequenceableCollection is better. But I think the fix given is not the right fix for the problem anyway. Pseq(1, inf) should simply be rejected, not silently converted to something that will work.

On Jan 28, 2004, at 4:50 AM, Ronald J. Kuivila wrote:

Hi James,

 I do not understand this example nor can I get it to work.  @@ is an
entry in an Event not a method of it, so Pseq cannot do its stuff.


For example, the following worked until your change:

o = (contents: [\a,\b], '@@':{|self,i| self.contents @@ i });
o.know = true;

x = Pseq(o, 4).asStream;
9.do { x.next.postln };

sc-dev mailing list

--- james mccartney   james@xxxxxxxxxxxxxx   <http://www.audiosynth.com>
SuperCollider - a real time audio synthesis programming language