Sha256: b4bc16324ad91f659a3480d7f6d5929ae93f0654dd7985767a0fedf9cb0edeaf

Contents?: true

Size: 378 Bytes

Versions: 2

Compression:

Stored size: 378 Bytes

Contents

require "hamster/list"

module Hamster
  module CoreExt
    module Enumerable
      def self.included(base)
        base.class_eval do
          def to_list
            list = EmptyList
            reverse_each { |item| list = list.cons(item) }
            list
          end
        end
      end
    end
  end
end

module Enumerable
  include Hamster::CoreExt::Enumerable
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hamster-1.0.1.pre.rc2 lib/hamster/core_ext/enumerable.rb
hamster-1.0.1.pre.rc.1 lib/hamster/core_ext/enumerable.rb