blob: 8067759262646fd587149ae83e4f54e3729a696f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
object SubList {
implicit def sublistable[A](x: List[A]) = new SubListable(x)
class SubListable[A](x: List[A]) {
def isSubListOf(y: List[A]) = {
x match {
case Nil => true
case h :: t => y.contains(h) && (t.isSubListOf(y.drop(y.indexOf(h) + 1)))
}
}
}
}
|