Array#zip_with
Array#zip_with method inspired by Haskell's zipWith function.
Installation
Add this line to your application's Gemfile:
gem 'array_zip_with'
And then execute:
$ bundle
Or install it yourself as:
$ gem install array_zip_with
Usage
With block
a = [1, 2, 3]
a.zip_with([3, 2, 1]) { |x, y| x + y } # => [4, 4, 4]
With symbol
a = [1, 2, 3]
a.zip_with([3, 2, 1], :+) # => [4, 4, 4]
License
The gem is available as open source under the terms of the MIT License.