List of lists and overall data manipulation

flux's icon

Hi,

I am trying to wrap my head around best practices when dealing with constant streams of data, and what are the best ways to manipulate them.

Let's say I have an outlet of an object spitting out lists that look something like this:

A1 A2 B1 B2 C1 C2 ... Z1 Z2

And some examples of what I'm looking to learn how to do:

1. If A1 ... Z1 are floats ranging from 0. to 1. (in no particular order) and A2 ... Z2 are ints ranging from 1 to 100 (in no particular order), what is the best way to get a list of values A2 ... Z2 sorted by the values of A1 ... Z1?

2. The example above, but for the value of A1*A2 ... Z1*Z2 sorted by the value of A1 ... Z1

Any help would be greatly appreciated, thank you!

broc's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Here is a solution of example 1 using [coll] to store and sort the pairs.

flux's icon

Broc, thank you for that. I was using ints as A2-Z2 in the example, but the solution I'm looking for should work for floats as all numbers as well.

flux's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Here's my solution to problem 1

broc's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Nice. I've made some modifications.