# If installed from gem # require "rubygems" # gem "patternmatching" require "patternmatching" # For DSL style code, include PatternMatching include PatternMatching # match example 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 code = build {plus(mul(100, 100), 200)} p calc(code) #=> 10200