Say for example I want to construct a triplet, taking in every combination of numbers from 1..100 in a triplet; i.e:
[(0,0,0),(0,0,1),(0,1,1),(1,1,1),(0,0,2),(0,1,2),(0,2,2),(1,2,2)]
..etc etc, up until a given bound (i.e: 100: giving us a final triplet of (100,100,100)); is there any reasonable way of doing this within haskell, or would I be best off writing a method that in short held a boundary pointer, and recursively increased each number until it was equal to the number to its right?
I think your description best fits a list comprehension to express what you want to do:
You say you want the numbers 1..100, but mention 0 in the examples. Further, you say "every combination" but then do not mention
(1,0,0)
.to avoid duplicates, enumerate them in the order of their total sum:
The calculation can be accelerated (by keeping the same result), by narrowing down the possible ranges: