Applying a function to every element of a vala array
Question
What is the equivalent of the following python code
map(func, list)
in vala?
Solution
There's no such shortcut. You have to do a foreach:
var res = new YourList ();
foreach (var elem in list) res.add (func (elem));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow