I keep forgetting about the ntuple function, thanks! It seems to be the key to many of the things I want to do.
Would fixed sized tuples with separate variables storing the length do it, perhaps? My impression is we need to have a variable encoding some kind of state, and the tuple lengths might be this state in this case. What I am actually interested in implementing is a merge sort algorithm, for instance, and I’m trying to get a better understanding of how to go about implementing any algorithms like this.
Maybe the best description of what I am looking for is how to avoid writing code that has lots of variables like a1 = ...; a2 = ... ![]()
Maybe a good general approach is to encode your whole state into a struct?