[socket, window, file].each{|item| item.close()}
It sort-of exists in Lisp-inspired languages (anything from Arc to Lua to Io) with appropriate boilerplate, for example:
function apply(tbl, func) for key, val in ipairs(tbl) do func(val) end end apply({socket, window, file}, function (item) item.close() end)
$_.close() for $socket, $window, $file;
[socket,window,file].forEach(function(o){o['close']();});
[socket, window, file].map(&:close)
It sort-of exists in Lisp-inspired languages (anything from Arc to Lua to Io) with appropriate boilerplate, for example:
http://codepad.org/SNWO1Y6K