Extracting every 3rd element from a list

Just Evan's icon

Just Evan

10月 02 2024 | 12:30 午前

Hi, how can I extract every 3rd element of a list in order and vice versa, extract everything except every 3rd element, simply skipping it?

Example #1: from the list "A B C D E F G" I need to leave only "C F" (every 3rd element).

Example #2: from the list "A B C D E F G" I need to leave only "A B D E G" (everything except every 3rd element).

Just Evan's icon

Just Evan

10月 02 2024 | 1:09 午前

My version:

I’ll just leave it here, maybe it will be useful to someone)

Max Patch
Copy patch and select New From Clipboard in Max.

sousastep's icon

sousastep

10月 02 2024 | 3:15 午前

Max Patch
Copy patch and select New From Clipboard in Max.

idk why the deferlow's needed but it is

Peter Ostry's icon

Peter Ostry

10月 02 2024 | 5:00 午前

Other versions:

[regexp] should be able to do it in a single object, but I don't know how to write it.

Roman Thilenius's icon

Roman Thilenius

10月 02 2024 | 6:25 午前

your counter approach is good, but you do not even have to iter for that - you can use it with [zl nth].

another version would be iter - group 3 - zl slice - group

TFL's icon

TFL

10月 02 2024 | 7:15 午前

Another iter/slice/groupe variation

Max Patch
Copy patch and select New From Clipboard in Max.