Hi all, For chapter 4, I've implmented filter like this: def filter(f: A => Boolean): Option[A] = this map(f) match { case Some(true) => this case _ => None }
but the answer key has it like this: def filter(f: A => Boolean): Option[A] = this match { case Some(a) if f(a) => this case _ => None } Is there something inefficient or not-best-practice about the way I've done it or is this just another possible implementation? Thanks, gjk -- You received this message because you are subscribed to the Google Groups "scala-functional" group. To unsubscribe from this group and stop receiving emails from it, send an email to scala-functional+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.