splitting a varying size list at a specific character
I have a list such as (this that 13 23 another // more again the same), and I want to split that list at the "//", so that I can route what comes before and after the // to different places. This list is constantly being populate and the number of items on either side of // is not a fixed amount. Can anyone suggest how I could achieve this?
Ah, I've been playing with regexp, that's a very good solution! Just to throw a spanner in it though, how would it work if you didn't know how many separate sections you wanted to separate? I've just been playing around with it and it looks like regexp will only pass the backreferences if the input has the amount stipulated in the arguments.
Oh, that is very elegant, thanks! How would you suggest I split them at the other end? I basically need to send each group to a different inlet elsewhere.
As you don't know how many groups you have, you can't send them to different outlets.
You could tag each sub-list with its position in the main list. Then you could use this tag thru a route or with forward :
That's really interesting, I haven't seen the [forward] object before too, super useful. Huge thanks Patrick!
Here's something related to this that I'm stumped on, wonder if you have any ideas - what if in your last patch the 4 5 6 dropped out of the initial list, but I wanted to keep the other numbers going to the same outputs? And then 10 11 12 get added to the initial list, but are outputted to the first empty slot on the route (what was previously taken by 4 5 6). Any ideas how I could achieve this?