Sha256: d3930608e105a12cc55372fdf2e005f29bfe2cdcc6e7c9ce40032cc20ebebf2c

Contents?: true

Size: 1.07 KB

Versions: 396

Compression:

Stored size: 1.07 KB

Contents

object Zipper {
  // A zipper for a binary tree.
  // ??? Zipper[A] ???

  // Get a zipper focussed on the root node.
  def fromTree[A](bt: BinTree[A]): Zipper[A] = ???

  // Get the complete tree from a zipper.
  def toTree[A](zipper: Zipper[A]): BinTree[A] = ???

  // Get the value of the focus node.
  def value[A](zipper: Zipper[A]): A = ???

  // Get the left child of the focus node, if any.
  def left[A](zipper: Zipper[A]): Option[Zipper[A]] = ???

  // Get the right child of the focus node, if any.
  def right[A](zipper: Zipper[A]): Option[Zipper[A]] = ???

  // Get the parent of the focus node, if any.
  def up[A](zipper: Zipper[A]): Option[Zipper[A]] = ???

  // Set the value of the focus node.
  def setValue[A](v: A, zipper: Zipper[A]): Zipper[A] = ???

  // Replace a left child tree.
  def setLeft[A](l: Option[BinTree[A]], zipper: Zipper[A]): Zipper[A] = ???

  // Replace a right child tree.
  def setRight[A](r: Option[BinTree[A]], zipper: Zipper[A]): Zipper[A] = ???
}

// A binary tree.
case class BinTree[A](value: A, left: Option[BinTree[A]], right: Option[BinTree[A]])

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/scala/exercises/zipper/src/main/scala/Zipper.scala
trackler-2.2.1.179 tracks/scala/exercises/zipper/src/main/scala/Zipper.scala
trackler-2.2.1.178 tracks/scala/exercises/zipper/src/main/scala/Zipper.scala
trackler-2.2.1.177 tracks/scala/exercises/zipper/src/main/scala/Zipper.scala
trackler-2.2.1.176 tracks/scala/exercises/zipper/src/main/scala/Zipper.scala
trackler-2.2.1.175 tracks/scala/exercises/zipper/src/main/scala/Zipper.scala
trackler-2.2.1.174 tracks/scala/exercises/zipper/src/main/scala/Zipper.scala
trackler-2.2.1.173 tracks/scala/exercises/zipper/src/main/scala/Zipper.scala
trackler-2.2.1.172 tracks/scala/exercises/zipper/src/main/scala/Zipper.scala
trackler-2.2.1.171 tracks/scala/exercises/zipper/src/main/scala/Zipper.scala
trackler-2.2.1.170 tracks/scala/exercises/zipper/src/main/scala/Zipper.scala
trackler-2.2.1.169 tracks/scala/exercises/zipper/src/main/scala/Zipper.scala
trackler-2.2.1.167 tracks/scala/exercises/zipper/src/main/scala/Zipper.scala
trackler-2.2.1.166 tracks/scala/exercises/zipper/src/main/scala/Zipper.scala
trackler-2.2.1.165 tracks/scala/exercises/zipper/src/main/scala/Zipper.scala
trackler-2.2.1.164 tracks/scala/exercises/zipper/src/main/scala/Zipper.scala
trackler-2.2.1.163 tracks/scala/exercises/zipper/src/main/scala/Zipper.scala
trackler-2.2.1.162 tracks/scala/exercises/zipper/src/main/scala/Zipper.scala
trackler-2.2.1.161 tracks/scala/exercises/zipper/src/main/scala/Zipper.scala
trackler-2.2.1.160 tracks/scala/exercises/zipper/src/main/scala/Zipper.scala