Sha256: fdf93356213deebd009d10aa06d26eb7cae0f60e1678411a5fc4200711d9b7c6

Contents?: true

Size: 390 Bytes

Versions: 1

Compression:

Stored size: 390 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe Hamster::List do

  describe "laziness" do

    def prime?(n)
      2.upto(Math.sqrt(n).round) { |i| return false if n % i == 0 }
      true
    end

    it "primes" do
      numbers = Hamster.interval(10000, 1000000)
      primes = numbers.filter { |i| prime?(i) }
      primes.take(3)

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hamster-0.1.11 spec/hamster/list/lazy_spec.rb