Better prose is:
"He rushed to the exit, leaped down the stairs, and ran for the train."
Better programming is to factor out the action:
[socket, window, file]*.close()"He rushed to the exit, leaped down the stairs, and ran for the train."
Better programming is to factor out the action:
[socket, window, file]*.close() [socket, window, file].each{|item| item.close()}
http://codepad.org/GqNp94IwIt 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)
http://codepad.org/SNWO1Y6K$_.close() for $socket, $window, $file;
[socket, window, file].map(&:close)
That just sends the :close message to each object in the set and returns a set of the results of each object evaluating that message. Yay, Smalltalk. [socket,window,file].forEach(function(o){o['close']();}); class A{
def close(){println "closed"}
}
def a1= new A()
def a2= new A()
[a1, a2]*.close()