Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def divideLists(xs:List[Int]) : (List[Int] , List[Int]) =
- {
- if(xs.isEmpty) (Nil,Nil)
- else if(xs.head < 0 ) (xs.head::divideLists(xs.tail)._1,
- if(xs.head % 2 == 0) divideLists(xs.tail)._2 else xs.head::divideLists(xs.tail)._2)
- else divideLists(xs.tail)
- }
- divideLists(List(-3, -6, 8, -9, 13))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement