RawArrray::collect should use Array.new (SC3d4)
RawArray::collect creates a kind of Collection and uses it to collect the results of iterating a function on each element of itself. If the Collection created is of the same species as the RawArray that "collect" iterates on, then only functions that return the same kind of elements contained in the initial RawArray can be used. That is,
SymbolArray[\a, \b, \c].collect({ arg s; s.asString })
will not work.
To correct this, RawArray::collect should use Array.new
instead of this.species.new
Fix:
+ RawArray {
collect { arg function;
var i, res;
res = Array.new(this.size);
this.do({ arg elem, i; res.add(function.value(elem, i)) })
^res;
}
}
Download this patch as SC file: extRawArrayCollect.sc
Back to Bugs and Fixes
Back to SuperCollider swiki
Link to this Page
- enter. last edited on 29 January 2003 at 10:46 pm by 203.14.169.19