Skip to content

Commit

Permalink
Add foreach and filter
Browse files Browse the repository at this point in the history
  • Loading branch information
amanjpro committed Mar 14, 2015
1 parent 4a8ae6b commit 7cc718a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/tree/AATree.scala
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ object AATree {
}



def foreach(f: T => Unit): Unit = toList.foreach(f)

def filter(p: T => Boolean): AATree[T] = Empty.insertAll(toList.filter(p))


def fold[B: Ordering](f: (T, B, B) => B, z: B): B = this match {
case Empty => z
case Fork(v, _, l, r) =>
Expand Down

0 comments on commit 7cc718a

Please sign in to comment.