Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //custom lookup
- def codeBits(table: CodeTable)(char: Char): List[Bit] = table match {
- case x :: xs => if (x. _1 == char) x._2 else codeBits(xs)(char)
- }
- // using standard find and match Some options
- def codeBits(table: CodeTable)(char: Char): List[Bit] = {
- val couple = table.find({case (c, _) => c == char})
- couple match { case Some((_ , bits)) => bits }
- } /
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement