tmhglnd / mercury

A minimal and human-readable language and environment for the live coding of algorithmic electronic music.
http://www.timohoogland.com/mercury-livecoding
GNU General Public License v3.0
309 stars 14 forks source link

New generative ring method #59

Closed GuillemGongora closed 3 years ago

GuillemGongora commented 4 years ago

Add new generative ring method similar to fill() that repeats every value in a ring a certain amount of times. ring abc (1 2 3 4) -> (1 2 3 4) ring cba newMethod(abc 4) -> (1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4)

tmhglnd commented 4 years ago

Ah that is a nice suggestions! Currently a way to do this is:

ring vals [1 2 3 4]
ring reps lace(vals vals vals vals)
print vals
//=> [ 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 ]

But this is not really useful and actually more typing than, haha

ring reps fill(1 4 2 4 3 4 4 4)
GuillemGongora commented 4 years ago

Perfect! But it's a problem when working with big complex rings like:

ring offsets spreadInclusiveFloat(16 0.945 0.985) ring offsets invert(offsets) ring offsets lace(offsets offsets offsets offsets)

Cannot do this with fill()

tmhglnd commented 4 years ago

Yeah exactly. Added it to my to do list for the total-serialism package: https://github.com/tmhglnd/total-serialism/issues

tmhglnd commented 3 years ago

Now included in e105a4eebdaa2f6f39342545822dc7ef44bf5c85 as repeat()