I propose to add createHashMapFromArray command variant to take CODE as right operand, with left ARRAY keys passed as arguments into the CODE. The main purpose is shortening and beautifying hashmap creation, with a bit of performance gain.
Syntax: ARRAY createHashMapFromArray CODE
I found myself creating hashmap from single array of keys as base using createHashMapFromArray very often like this:
private _sides = [blufor, opfor, independent, civilian]; _sides createHashMapFromArray (_sides apply { private _side = _x; {side group _x == _side} count allUnits; });
with such new command variant you would be able to write it shorter as
fnc_count_units_of_side = { {side group _x == _this} count allUnits; }; [blufor, opfor, independent, civilian] createHashMapFromArray fnc_count_units_of_side;
or even just
[blufor, opfor, independent, civilian] createHashMapFromArray { {side group _x == _this} count allUnits; };
I think that passing ARRAY elements into CODE as _this instead of _x is a better choice. This will let you feed existing callable functions into it (including BIS_fnc_ stuff) without having to wrap it into additional scope like {_x call BIS_fnc_something}.