Sha256: ba9d0c861586268037a32cf621b4b81ae6713a5659ad73e119b208d467c7f5de

Contents?: true

Size: 341 Bytes

Versions: 10

Compression:

Stored size: 341 Bytes

Contents

require "patternmatching"

include PatternMatching

# Example for matching Enumerable
inputs = build { exact([1,2,3,4,5]) }
make inputs do
  # _! matches rests of list
  seems as {exact([:a,:b, _!(:c)])} do
    puts a.to_s + ", " + b.to_s  + " and " + c.to_s
  end
  seems something do
    puts "not matched"
  end
end # => "1, 2, and 345"

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
patternmatching-0.1.0 examples/enumerable_matching.rb
patternmatching-0.1.2 examples/enumerable_matching.rb
patternmatching-0.2.1 examples/enumerable_matching.rb
patternmatching-0.1.1 examples/enumerable_matching.rb
patternmatching-0.1.3 examples/enumerable_matching.rb
patternmatching-0.1.4 examples/enumerable_matching.rb
patternmatching-0.2.0 examples/enumerable_matching.rb
patternmatching-0.2.2 examples/enumerable_matching.rb
patternmatching-0.2.3 examples/enumerable_matching.rb
patternmatching-0.2.4 examples/enumerable_matching.rb