Sha256: b036680a2b11bbe1ae069c00adece4a57d9eaf7732501f5bcd457ee63f4698c7

Contents?: true

Size: 526 Bytes

Versions: 396

Compression:

Stored size: 526 Bytes

Contents

object Sublist extends Enumeration {
  def sublist[T](l1: List[T], l2: List[T]): Value = {
    if (equal(l1, l2)) Equal
    else if (isSublist(l1, l2)) Sublist
    else if (isSuperlist(l1, l2)) Superlist
    else Unequal
  }

  private def equal[T](l1: List[T], l2: List[T]) = l1.equals(l2)

  private def isSublist[T](l1: List[T], l2: List[T]) = l2.containsSlice(l1)

  private def isSuperlist[T](l1: List[T], l2: List[T]) = l1.containsSlice(l2)

  type SublistType = Value
  val Equal, Sublist, Superlist, Unequal = Value
}

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.0.6.20 tracks/scala/exercises/sublist/example.scala
trackler-2.0.6.19 tracks/scala/exercises/sublist/example.scala
trackler-2.0.6.18 tracks/scala/exercises/sublist/example.scala
trackler-2.0.6.17 tracks/scala/exercises/sublist/example.scala
trackler-2.0.6.16 tracks/scala/exercises/sublist/example.scala
trackler-2.0.6.15 tracks/scala/exercises/sublist/example.scala
trackler-2.0.6.14 tracks/scala/exercises/sublist/example.scala
trackler-2.0.6.13 tracks/scala/exercises/sublist/example.scala
trackler-2.0.6.12 tracks/scala/exercises/sublist/example.scala
trackler-2.0.6.11 tracks/scala/exercises/sublist/example.scala
trackler-2.0.6.10 tracks/scala/exercises/sublist/example.scala
trackler-2.0.6.9 tracks/scala/exercises/sublist/example.scala
trackler-2.0.6.8 tracks/scala/exercises/sublist/example.scala
trackler-2.0.6.7 tracks/scala/exercises/sublist/example.scala
trackler-2.0.6.6 tracks/scala/exercises/sublist/example.scala
trackler-2.0.6.5 tracks/scala/exercises/sublist/example.scala
trackler-2.0.6.4 tracks/scala/exercises/sublist/example.scala
trackler-2.0.6.3 tracks/scala/exercises/sublist/example.scala
trackler-2.0.6.2 tracks/scala/exercises/sublist/example.scala
trackler-2.0.6.1 tracks/scala/exercises/sublist/example.scala