Reordering NamedTuples

Not really sure where one would get arbitrarily ordered NamedTuples from, but I agree if that’s the case, then a data structure with the order encoded in the type domain is the wrong data structure (independently of how you try to align them).

Edit: but the function I suggested is type stable: if the compiler knows the types of the input NamesTuples (and thus the order), then the type of the output is known to the compiler too.

4 Likes