Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def bar(chars: List[Char]): List[(Char, Int)] = {
- def foo(cFoo: Char, accFoo: List[(Char, Int)]): List[(Char, Int)] = accFoo match {
- case Nil => (cFoo, 1) :: accFoo
- case head :: tail => head match {
- case (`cFoo`, y) => (cFoo, y + 1) :: tail
- case (x, y) => (x, y) :: foo(cFoo, tail)
- }
- }
- def blah(cBlah: List[Char], accBlah: List[(Char, Int)]): List[(Char, Int)] = cBlah match {
- case Nil => accBlah
- case head :: tail =>
- blah(tail, foo(head, accBlah))
- }
- blah(chars, Nil)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement