Suppose I’ve got for some Object, two fields, each of which is a list of length N. For example
User.Items = [milk, bread, eggs]
User.Preferences = [2,1,10]
I’d like to sort the first list by the second via a backend workflow (I assume client-side is out of the question). So the updated User.Items = [eggs, milk, bread].
In other words I’ve got a list of tuples [(milk,2), (bread,1), (eggs,10)] and I’m trying to run a basic list comprehension. I’m using this “parallel lists” format because I can’t see another way to store the preference information for each user/item pair (short of creating a new database for each combination, but this would not scale at all with where my app is headed).
I’ve tried everything I can think of short of setting up an API to run this trivial operation on Lambda. I’ve dug around List Shifter but can’t see a way to make this happen with the functionality I can observe.
Any ideas appreciated!