def collate(array)
  transformations = array.inject({}) do |hash, item|
    hash[item] = yield item
    hash
  end
  array.sort_by {|x| transformations[x] }
end

collate(array) {|a| transform(a) }    # ["élan", "épée", "epicurian"]

