The wildcard pattern matches any value and binds no variables.
A wildcard pattern matches any type. The matching produces an empty typing context.
{- Showcase various wildcard assignments -} val (_,(_,x),_) = (0,(2,2),[5,5,5]) val [[_,y],[_,z]] = [[1,3],[2,4]] [x, y, z] {- OUTPUT: [2, 3, 4] -}
{- Defining logical implication by cases, using wildcard to abbreviate the 'true' cases. -} def implies(true, false) = false def implies(_, _) = true implies(true, true) {- OUTPUT: true -}
Related Reference Topics
Related Tutorial Sections