Perform small math operations in Mercury?
tmhglnd opened this issue · comments
Timo commented
When creating lists it could be useful to just use some simple math to calculate the length that needs to be used instead of having to calculate this on your own. For example when using functions like every
or cosine
current situation
list rtm rotate(every(euclid(11 5) 4 12) 36)
list len cosine(96 1 50 500)
new synth sine note(0 2) shape(1 len) play(rtm) time(1/12)
new situation could look something like:
list rtm rotate(every(euclid(11 5) 4*12) 3*12)
list len cosine(8*12 1 50 500)
new synth sine note(0 2) shape(1 len) play(rtm) time(1/12)
Or maybe possible to create a short alias with the already present list functions
list rtm rotate(every(euclid(11 5) *(4 12)) *(3 12))
list len cosine(*(8 12) 1 50 500)
new synth sine note(0 2) shape(1 len) play(rtm) time(1/12)