Sha256: bf90027cf422609b19ff1c5c8189b269a368a5bf3239e992981056ff437c4819

Contents?: true

Size: 351 Bytes

Versions: 1

Compression:

Stored size: 351 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.join(", ")
  end
  seems something do
    puts "not matched"
  end
end # => "1, 2, and 3, 4, 5"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
patternmatching-0.2.5 examples/enumerable_matching.rb