coffeescript define function in loop