Kyma Forum
  Tips & Techniques
  How to Concatenate mulitple arrays

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   How to Concatenate mulitple arrays
rafe
Member
posted 19 January 2015 12:13         Edit/Delete Message   Reply w/Quote
Hello

I have the following arrays and I would like to concatenate the contents of each into 1 larger array.

(1 to: 6) collect: [:i | (2**i) inverse ]
(1 to: 6) collect: [:i | (3/(2**i)) ]
(1 to: 6) collect: [:i | (1/3)* (1/(2**(i-1)))]

I tried using the aCollection message which resulted in an"extra characters after the period" error. - not entirely sure why. I have searched the smalltalk quick reference for other options but that message seems like it's on the right track.

Thanks
rafe

IP: Logged

SSC
Administrator
posted 19 January 2015 21:06         Edit/Delete Message   Reply w/Quote
quote:
(1 to: 6) collect: [:i | (2**i) inverse ]
(1 to: 6) collect: [:i | (3/(2**i)) ]
(1 to: 6) collect: [:i | (1/3)* (1/(2**(i-1)))]

You could use commas to concatenate the Arrays, for example

(1 to: 6 collect: [:i | (2**i) inverse ]),
(1 to: 6 collect: [:i | (3/(2**i)) ]),
(1 to: 6 collect: [:i | (1/3)* (1/(2**(i-1)))])

IP: Logged

rafe
Member
posted 23 January 2015 12:09         Edit/Delete Message   Reply w/Quote
Hello SSC

Thanks that works great in my text window! Very elegant, thanks.

However I get an error message "instance of #clip to 1 sent to" my array when i attempt to use this in in the delay scale field of a delay protoype.

If anyone has time to explain why this is the case I would appreciate it.

Here's the final expresion

!DelayScale of: # ({(1 to: 6 collect: [:i | (2**i) inverse ]), (1 to: 6 collect: [:i | (3/(2**i)) ]), (1 to: 6 collect: [:i | (1/3)* (1/(2**(i-1)))]) })

The purpose is to have a sync delay expression that creates the standard note subdivisions in one master array. if you evaluate the expresion in a text file there is one value greater than 1 but i removed that value in the delay sync field, during a test and still received the error.

thanks

rafe


IP: Logged

SSC
Administrator
posted 23 January 2015 15:55         Edit/Delete Message   Reply w/Quote
Since you are generating the Array, you don't need the pound sign notation. You could do it this way instead:

!DelayScale of: ((1 to: 6 collect: [ :i | (2**i) inverse ]), (1 to: 6 collect: [ :i | (3/(2**i))]), (1 to: 6 collect: [ :i | (1/3) * (1/(2**(i-1)))]))

IP: Logged

rafe
Member
posted 23 January 2015 16:07         Edit/Delete Message   Reply w/Quote
Ah. Thanks. I never realized that detail

IP: Logged

All times are CT (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply

Contact Us | Symbolic Sound Home

This forum is provided solely for the support and edification of the customers of Symbolic Sound Corporation.


Ultimate Bulletin Board 5.45c