Tuple doesn't seem to implement Traversable. So, how would one convert a Tuple to a vec in Hack?
Asked
Active
Viewed 272 times
1
-
1Can you not traverse it using a `foreach` loop? It seems to work for me. ` $lst = tuple('a', 'b', 'c'); foreach($lst as $a) { echo($a); } ` So you can reconstruct the tuple to a vec. – MathBunny Aug 15 '20 at 01:58
-
Tuples aren't meant to be traversed, just indexed, so you do need to shuttle the values in manually like `vec[$tup[0], $tup[1], ...]`. Tuples are meant to be small, so this shouldn't be much of a hassle. – concat Aug 15 '20 at 23:42