Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
72
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(list1:List[Int],list2:List[Int],temp:List[Int]):List[Int]=
  3. (list1, list2) match {
  4. case (Nil,Nil) => temp.reverse
  5. case (Nil,_) => sumuj_2(list1, list2.tail, list2.head::temp)
  6. case (_,Nil) => sumuj_2(list1.tail, list2, list1.head::temp)
  7. case (_,_) => sumuj_2(list1.tail, list2.tail, (list1.head + list2.head)::temp)
  8. }
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement