The result of ("top": tc(len, platform)).values() is (tc(len, platform),). In other words, it is an array, and its only child is tc(len, platform). This is different from tc(len, platform) itself.
You can inspect them with the hover trick. In the following screenshots, x is different from y, but the same as z.
A more natural Typst code
In fact, the constructor function of array is rarely used directly. Quoting from the docs:
Constructor for
arrayConverts a value to an array.
Note that this function is only intended for conversion of a collection-like value to an array, not for creation of an array from individual items. Use the array syntax
(1, 2, 3)(or(1,)for a single-element array) instead.
In addition, .join() usually does not require explicit calls either. If you omit the return keyword, then all expressions in the function body will be implicitly joined. Refer to Defining functions - Function - Typst Documentation for the details.
Therefore, you can achieve the same result like this:
#let sec(platform, actions) = {
let len = actions.len()
(tc(len, platform),)
for (key, value) in actions {
(key, value, [])
}
}


