KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
This code is from Querying a Dataset with Scala's Pattern Matching : object & { def unapply[A](a: A) = Some((a, a)) } "Julie" match { case Brothers(_) & Sisters(_) => "Julie has both brother(s) and sister(s)" case Siblings(_) => "Julie's siblings are all the same sex" case _ => "Julie has no siblings" } // => "Julie has both brother(s) and sister(s)" How does & actually work? I don't see a Boolean test anywhere for the conjunction. How does this Scala magic work?
Tags (comma-separated)
Save Edits
Cancel