Sha256: 3e79ebb1ef91526714859086ccdf7d0da1a574b175d1112f94b656f6e2cf184d

Contents?: true

Size: 348 Bytes

Versions: 1

Compression:

Stored size: 348 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(add_2))).to eq(sequence(7))
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
totally_lazy-0.1.53 spec/totally_lazy/functions_spec.rb