Sha256: 259578d65aab5fd7466894ac719ef658fbac1377bd542a4810c4db9ad6aa65c1
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
require 'patternmatching/version' require 'patternmatching/pattern' module PatternMatching # The module is only for showing usage... #== Using module # # If installed from rubygems # require "rubygems" # gem "patternmatching" # # # for use # require "patternmatching" # #== Structured data example # val = 200 # code = PatternMatching.build {plus(mul(100, 100), val)} # #== Partial func example # class Calc # extend PatternMatching # # func(:calcm).seems as {plus(:a, :b)} do # calcm(a) + calcm(b) # end # func(:calcm).seems as {mul(:a, :b)} do # calcm(a) * calcm(b) # end # func(:calcm).seems as {:value} do # value # end # end # # p Calc.new.calcm(code) # #== Pattern matching example # include PatternMatching # # def calc(code) # make(code) { # seems as {plus(:a, :b)} do calc(a) + calc(b) end # seems as {mul(:a, :b)} do calc(a) * calc(b) end # seems something do code end # } # end # # p calc(code) # #== For more #see README.txt module USAGE end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
patternmatching-0.2.3 | lib/patternmatching.rb |
patternmatching-0.2.4 | lib/patternmatching.rb |
patternmatching-0.2.5 | lib/patternmatching.rb |