We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7b5cdbc commit d1115f5Copy full SHA for d1115f5
tests/run/puzzler54.scala
@@ -0,0 +1,13 @@
1
+// Scala Puzzler 54
2
+object Test {
3
+ case class Card(number: Int, suit: String = "clubs") {
4
+ val value = (number % 13) + 1 // ace = 1, king = 13
5
+ def isInDeck(implicit deck: List[Card]) = deck contains this
6
+ }
7
+
8
+ def main(args: Array[String]) = {
9
+ implicit val deck = List(Card(1, "clubs"))
10
+ implicit def intToCard(n: Int): Card = Card(n)
11
+ assert(1.isInDeck)
12
13
+}
0 commit comments