Hack: How to convert a keyset to a vec

Published: 2020-03-16 12:40:25 -0500 -0500

Reading time: 1 mins (64 words)

Tags: hack hacklang keyset vec


I’ve been using a lot more Hack / hacklang at work and have run into several cases where there’s not great documentation. One of those cases is when trying to convert a keyset to a vec.


To convert a keyset to a vec you can use the Vec\keys function from the standard library.

An example:

$my_keyset = keyset['a', 'b'];
$my_vec = Vec\keys($my_keyset);

About the Ham

Hi I'm Hamilton and I wrote / built this! I like doing lots of things, but mostly I like to build (and then share those buildings). Some things I'm currently building: art, software, and prose. To stay up-to-date with my latest buildings, subscribe to my email list or follow one of my many other accounts. #buildit #shipit #justhamit

comments powered by Disqus