Re: Enumerating all 3-tuples (Posting On Python-List Prohibited)

2018-03-15 Thread Ben Bacarisse
Lawrence D’Oliveiro writes: > On Thursday, March 15, 2018 at 2:56:24 PM UTC+13, Ben Bacarisse wrote: >> >> Lawrence D’Oliveiro writes: >> >>> On Wednesday, March 14, 2018 at 2:18:24 PM UTC+13, Ben Bacarisse wrote: >>> Lawrence D’Oliveiro writes: The

Re: Enumerating all 3-tuples (Posting On Python-List Prohibited)

2018-03-14 Thread Ben Bacarisse
Lawrence D’Oliveiro writes: > On Wednesday, March 14, 2018 at 2:18:24 PM UTC+13, Ben Bacarisse wrote: >> Lawrence D’Oliveiro writes: >> >> The original problem -- triples of natural numbers -- is >> not particularly hard, but the general problem -- enumerating n-tuples

Re: Enumerating all 3-tuples (Posting On Python-List Prohibited)

2018-03-13 Thread Ben Bacarisse
Lawrence D’Oliveiro writes: > On Tuesday, March 13, 2018 at 1:58:48 PM UTC+13, Ben Bacarisse wrote: >> Of course you can always generate n-tuples of N and then map these to >> n-tuples of the intended sequence but that seems inelegant. > > This whole discussion seems to

Re: Enumerating all 3-tuples (Posting On Python-List Prohibited)

2018-03-13 Thread Steven D'Aprano
On Sun, 11 Mar 2018 01:40:01 +, Ben Bacarisse wrote: > I'm sure deep recursion is not needed, it's just tricky translating from > a lazy language when one is not familiar with all the iterator > facilities in Python. For example, I couldn't find an append operation > that returns an

Re: Enumerating all 3-tuples (Posting On Python-List Prohibited)

2018-03-12 Thread Ben Bacarisse
Lawrence D’Oliveiro writes: > On Sunday, March 11, 2018 at 2:40:16 PM UTC+13, Ben Bacarisse wrote: >> It would be nice to avoid relying on any value-based ordering. > > I don’t see why. The set of elements has to have the same cardinality > as the set of natural numbers,

Re: Enumerating all 3-tuples (Posting On Python-List Prohibited)

2018-03-10 Thread Ben Bacarisse
Lawrence D’Oliveiro writes: > On Sunday, March 11, 2018 at 3:24:05 AM UTC+13, Ben Bacarisse wrote: >> Unfortunately my Python is not up to using iterators well enough to >> avoid a "maximum recursion depth exceeded" error. > > My solution only needed recursion up to a