[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlaplus] Flattening a tuple of tuples



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.
To view this discussion on the web visit https://groups.google.com/d/msgid/tlaplus/6dd275b2-c00f-4e32-a47e-cac65a3923c8n%40googlegroups.com.