Sha256: 4342cab3bf5c11bb32543fa17aa7b3b8653a1a217b27751fb1dd3877d74fa3f6

Contents?: true

Size: 353 Bytes

Versions: 9

Compression:

Stored size: 353 Bytes

Contents

require_relative '../spec_helper'

describe 'Functions' do
  it 'should allow function composition and method chaining' do
    add_2 = ->(value) { value+2 }
    divide_by_2 = ->(value) { value/2 }
    expect(sequence(10).map(divide_by_2 * add_2)).to eq(sequence(6))
    expect(sequence(10).map(divide_by_2.and_then(add_2))).to eq(sequence(7))
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
totally_lazy-0.1.62 spec/totally_lazy/functions_spec.rb
totally_lazy-0.1.61 spec/totally_lazy/functions_spec.rb
totally_lazy-0.1.60 spec/totally_lazy/functions_spec.rb
totally_lazy-0.1.59 spec/totally_lazy/functions_spec.rb
totally_lazy-0.1.58 spec/totally_lazy/functions_spec.rb
totally_lazy-0.1.57 spec/totally_lazy/functions_spec.rb
totally_lazy-0.1.56 spec/totally_lazy/functions_spec.rb
totally_lazy-0.1.55 spec/totally_lazy/functions_spec.rb
totally_lazy-0.1.54 spec/totally_lazy/functions_spec.rb