website/index.txt in patternmatching-0.1.1 vs website/index.txt in patternmatching-0.1.2
- old
+ new
@@ -42,12 +42,12 @@
include PatternMatching
# match example
def calc(code)
make(code) {
- seems as {plus(:x, :y)} do calc(x) + calc(y) end
- seems as {mul(:x, :y)} do calc(x) * calc(y) end
+ 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)}
@@ -65,14 +65,14 @@
class Calc
# At first, extends with the module
extend PatternMatching
# def calcm(o), as 3 partial styles
- func(:calcm).seems as {plus(:x, :y)} do
- calcm(x) + calcm(y)
+ func(:calcm).seems as {plus(:a, :a)} do
+ calcm(b) + calcm(b)
end
- func(:calcm).seems as {mul(:x, :y)} do
- calcm(x) * calcm(y)
+ func(:calcm).seems as {mul(:a, :b)} do
+ calcm(a) * calcm(b)
end
func(:calcm).seems as {:value} do
value
end
end