Divide list into sequences based on another list


#1

Hello community

 

Is there a way to split a list into sublist based on the values from another list?

I have a list of points and a list of the lentgh of the lists.

In the case seen below i have 13 points (A,B,C,D,E,F,G,J,K,L,M)

And a list of lenghts (5,4,4)

I then want:

  1. (A,B,C,D,E)

  2. (F,G,J)

  3. (K,L,M)

list_from_list

 

 

 

 

 

 

 

Any ideas on how to do this?


#2

In one method ill get this far. But i cant get the two set of lists from the input. I just typed in the two correct sequences.

 

list_slice


#3

Use List.SublistByLengths in package Clockwork - I’ll rename this to List.ChopByLengths in the next release so it’ll be easier to find.


#4

Perfect. Just what i was looking for!