Group Admins

  • Profile picture of Karim
  • Profile picture of Jean

OpenMusic

Public Group active 3 hours, 53 minutes ago

User group for OpenMusic and computer-aided composition. Visit the Forum for discussions.

Adding ".0" into elements of a list

Author 3 Subscribed Users |
Profile photo of BUCK
BUCK

Hello,

Since I’m working with trees I want to add ties (.0) to some elements of a list. I wanted to do it inside an omloop so I could make iterations.

For example, If I had a lis of pulses ((5 4 5 6) (4 3 6 5) (4 5 5 3)) and I wanted it to became ((5 4 5 6) (4.0 3 6 5) (4.0 5 5 3)), what would be the best way to do it? I couldn’t find a function that does this kind of mergging: adding .0 to a regular number or transforming a regular number into a float one.

Thanks in advance!

Alex

February 3, 2017 at 21:16 #20666
Profile photo of Karim
Karim

Dear Alex

you have just multiply your numbers by 1.0

But be careful not to have a starting note by a tie. This actually can lead to further problems.

Best
K

February 3, 2017 at 21:27 #20667
Profile photo of Jean
Jean

… or you can convert an integer to a float using the function ‘FLOAT’
See : http://clhs.lisp.se/Body/f_float.htm

February 3, 2017 at 23:10 #20668

You must be logged in to reply to this topic.

Log in now