List trick


    Nov 13 2013 | 12:07 pm
    Hello everybody,
    I search a simple a accurate way to create a list as :
    - I have an input list of n items
    - I want to create a new list of m items using only some items of my original list.
    I can use zl.slice to extract the items from the original list, but is there a function which create a list from x items and repeat them to have a m items list.
    Hope it's clear.
    Thank you for your answers.

    • Nov 13 2013 | 1:28 pm
      That's very general.. Perhaps this is useful?
      -
    • Nov 13 2013 | 4:54 pm
      Thank you very much, you just confirm that i am on the good way.
    • Nov 13 2013 | 5:35 pm
      Here is the result, may be you have some improvements to make :
    • Nov 13 2013 | 9:23 pm
      I don't understand what you are trying to do here...
      Example input.. example output? What kind of steps?
    • Nov 14 2013 | 7:06 am
      Ok, here is the patcher spec :
      - In the second inlet, you send a list (of steps). ex. : 1 2 3 4 5 6 7 8
      - In the first inlet, you send the number of steps (or items) of the lists you want to copy (duplicate). ex. : 2
      The patcher must create a list as same length as the original list (inlet 2) but containing copied items (steps, inlet 1) of the original list.
      So for : (Inlet 1 : 2, Inlet 2 : 1 2 3 4 5 6 7 8
      Then the result must be : 1 2 1 2 1 2 1 2
      For : (Inlet 1 : 4, Inlet 2 : 1 2 3 4 5 6 7 8
      Then the result must be : 1 2 3 4 1 2 3 4
      And if the Inlet 1 value is greater or equal to Inlet 2 list length, nothing is made, because it's not usefull.
      Is it more clear ?
    • Nov 14 2013 | 1:28 pm
      Ahh.. I see. Well it looks like you worked it out. Optimization will likely be a function of how you are using it.. Maybe add a modulo object to allow for inlet 1: 3, result: 1 2 3 1 2 3 1 2 etc..
    • Nov 14 2013 | 1:34 pm
      This thread is somewhat related. It might give you some more ideas.. http://cycling74.com/forums/topic/iterate-over-list-n-times/
    • Nov 15 2013 | 11:43 am
      Thank you for your help, I will take a look at your link.
      Regards.