#scala
pattern matching statement starting with the match
keyword and consisting of sequences of case Pattern => Body
clauses.
If you want to change selection, open document below and click on "Move attachment"
Case Classes - Scala Documentationot;))
val t = Fun("x", Fun("y", App(Var("x"), Var("y"))))
printTerm(t)
println
println(isIdentityFun(id))
println(isIdentityFun(t))
}
In our example, the function printTerm is expressed as a <span>pattern matching statement starting with the match keyword and consisting of sequences of case Pattern => Body clauses.
The program above also defines a function isIdentityFun which checks if a given term corresponds to a simple identity function. This example uses deep patterns and guards. After matching Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details