[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [tlaplus] Flattening a tuple of tuples
- From: Hillel Wayne <hwayne@xxxxxxxxx>
- Date: Wed, 30 Jun 2021 10:55:17 -0500
- Ironport-hdrordr: A9a23:fM6vIa119fRUhW9oyFW//QqjBeZyeYIsimQD101hICG9Lfb15ruTdaUguG6NtN9OYhtQ4OxoS5PwCk80lKQFqbX5WI3MMjUO11HYWL2KgbGSsQEIXheOv9K0O89bAuxD4POZNyk+sS+42nj4Lz4YqOP3spxA/N2uiEuFLjsaHZ2JWmxCe0im+y9NNXx77MECZdWhD6N8zlLKCBNnFLXGdwc4svD41qD2fdDdEG077ngcmUWzZByTiIISeCLoryv2PQk/sYvKvVK15DAQJ82YwpWGI9znpgzuBlZt+ecIerB4dY+xYwQuW1fRYgvCXvUtZ1Vz1wpF6t1HIWxa9air0mgdFvU20WrYeiWeoBfm2QXslBYor1H4z0OA6EGT4fDEeA==
- References: <2f5d6fd4-c82a-472a-b36b-fc0dce4d7555@Spark> <9363e689-106a-4055-aaa8-82955a9c1e8a@Spark>
- User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0
From the community modules we have FoldLeft.
Then we can write flatten as
Flatten(seq) == FoldLeft(LAMBDA x, y: x \o y,
On 6/30/2021 10:46 AM, Mitchell
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.
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/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/df390bf9-6287-fb11-b941-88d83818c527%40gmail.com.