# Re: [tlaplus] Flattening a tuple of tuples

• From: Mitchell Hashimoto <xmitchx@xxxxxxxxx>
• Date: Wed, 30 Jun 2021 09:13:13 -0700 (PDT)
• Ironport-hdrordr: A9a23:57SWiKOOP8oZ48BcThijsMiBIKoaSvp037Dk7TEWdfVwSL36qynIpoV46faUskd1ZJhOo6HmBEDtewKnyXcX2+ks1MmZLXXbUQKTRekMg+rfKlvbalbDH4VmpNpdmsZFeaTNJGk/pcvn5GCDYq4dKaG8gcSVrNab81MoZwRrZ6Z8qy91Bx3zKCYdKWV7OaY=
• References: <2f5d6fd4-c82a-472a-b36b-fc0dce4d7555@Spark> <9363e689-106a-4055-aaa8-82955a9c1e8a@Spark> <df390bf9-6287-fb11-b941-88d83818c527@gmail.com>

That's it. Perfect thank you.

On Wednesday, June 30, 2021 at 8:55:20 AM UTC-7 hwa...@xxxxxxxxx wrote:

Hi,

From the community modules we have FoldLeft. Then we can write flatten as

Flatten(seq) == FoldLeft(LAMBDA x, y: x \o y, <<>>, seq)

H

On 6/30/2021 10:46 AM, Mitchell Hashimoto wrote:
Hello,

I’m sure I’m missing something obvious relating to tuples being functions of Domain 1..Len(Tuple) here but I’m struggling to flatten a tuple of tuples.

i.e. Given T == << <<A>>, <<B>>, <<C>> >> I’m looking to make that <<A, B, C>>. I am able to assure that every element is a tuple, and that the nesting level is only one level deep.

Background on why: I’m validating that a certain traversal of a tree returns the elements in the correct order. I typically use sets, but I’m forced to use tuples since order matters in this specific specification.

I’m effectively looking for something like UNION for tuples.

Thank you!

Best,
Mitchell
--
You received this message because you are subscribed to the Google Groups "tlaplus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tlaplus+u...@xxxxxxxxxxxxxxxx.
To view this discussion on the web visit https://groups.google.com/d/msgid/tlaplus/9363e689-106a-4055-aaa8-82955a9c1e8a%40Spark.

--
You received this message because you are subscribed to the Google Groups "tlaplus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tlaplus+unsubscribe@xxxxxxxxxxxxxxxx.