Simplify ex2_18.coffee, remove additional flatten func