Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. def sumuj (list1:List[Int],list2:List[Int]):List[Int]= {
  2. def sumuj_2(l1:List[Int],l2:List[Int],temp:List[Int]):List[Int]=
  3.  
  4. (l1, l2) match {
  5. case (Nil,Nil) => temp.reverse
  6. case (Nil,_) => sumuj_2(l1, l2.tail, l2.head::temp)
  7. case (_,Nil) => sumuj_2(l1.tail, l2, l1.head::temp)
  8. case (_,_) => sumuj_2(l1.tail, l2.tail, (l1.head + l2.head)::temp)
  9. }
  10. sumuj_2(list1,list2,Nil)
  11.  
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement