Linear partition in Coffeescript (Javascript)