Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. def fun(target : List[Int])(divider : Int) : List[Int] = {
  2. if(target.isEmpty) return target
  3. if (target.head % divider == 0){
  4. target.head :: fun(target.tail)(divider)
  5. }else{
  6. fun(target.tail)(divider)
  7. }
  8. }
  9.  
  10. var s =fun(List(12,14,16,22,23))_
  11.  
  12. println(s(2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement