I implement the LINQ clone in Lua, but this is not very relevant here, and I have most of the functions performed (enumerated / requested, not a precompiler), but cannot come up with a smart way to implement Order By ThenBy.
I am currently sorting once and then placing in new lists and then sorting these subcategories and finally combining the results again, but it seems very wasteful and inefficient, I'm sure someone figured out a reasonable way to do this (better algorithm), but I have no idea what it is. Any tips on how to efficiently execute OrderBy / Thenby?
Note. The constructions of the language and the language, I hope, are not relevant here. I am looking for a generalized algorithm, just as they say that binary sorting can be done in any language.
Edit: I am currently working on LINQ to Object, so any ideas how this would be done in particular would be great. I assume that OrberBy / ThenBy is 2 function calls, not one, but I could be wrong.
source
share