Skip to content

Commit d1115f5

Browse files
committed
Add puzzler 54 as a test
1 parent 7b5cdbc commit d1115f5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/run/puzzler54.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)