First time here? Check out the FAQ!
x

Collect and dealing with brackets

0 votes
51 views
Hi there

I'm trying to create 64 versions of a message of structure:

(!Segment_nn rounded)

I've tried using {(1 to: 64) collect: [:i| ((!Segment_ suffix2: i) rounded)} and various other similar alternatives can get it to make:

(!Segment_01 rounded !Segment_02 rounded !Segment_03 rounded.....!Segment_64 rounded)

I can't get it a structure where every iteration has it's own bracket.  Is this possible?
asked Aug 6 in Capytalk & Smalltalk by ghood (Adept) (2,840 points)

1 Answer

0 votes

(1 to: 64) collect: [:i| ((!Segment_ suffix2: i) rounded)]

creates an Array with the individually-numbered !Segment EventValues. If you evaluate using CtrlY, the printed result doesn't include the curly braces around each element, but the actual object returned by the code is an Array with !Segment_01 rounded, etc.

You should be able to use the Array value directly without printing it out first (where are you using this Array? Which parameter field?)

answered Aug 8 by ssc (Savant) (108,900 points)
I was using it in a Never Engine Labs Send Osc sound where I was needing to print it out first or it throws a number of signals not equal to number of events. It was expecting 66 arguments/signals and I was wanting to generate 64 and then have another two. I got round it by hardwiring the other two signals into the osc message itself. This then allows me to leave the 64 as curlies without printing first.
...