Continuing the discussion from Generic Sequence Concatenation:
I found the preceding thread before posting about my recent problem. I implemented the Sieve of Sundaram, which vends the odd primes, and wanted to cocanenate a
CollectionOfOne with a 2 to get the whole set. I realized that the existing joining facilities assume all the source sequences have the same type. I came up with a type similar to the
Spliced type from the parent thread.
I was thinking we could implement this someday with variadic generics, to extend it beyond two sources. Of course, I could just do what the original post did and tail-recurse the two-source version. I was thinking about what if we conditionally made the set a collection. (It would match all of
Collection and its refinements whenever all the source types match a given refinement.) But how would be implement the
Index. I used a
enum with a
second case. Could we use variadic generics to generalize that to multiple cases. I'm not sure, besides using the tail-recursion for the collection and the corresponding index type (in other words, the types only each directly handle two cases).