Guest User

Untitled

a guest
Jan 19th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. def map(s: Set, f: Int => Int): Set = (x: Int) => {
  2. var flag : Boolean = false
  3. for(i <- -bound to bound) {
  4. if(s(i) && f(i) == x){
  5. flag = true
  6. }
  7. }
  8. flag
  9. }
  10.  
  11. (-bound to bound) exists {i => s(i) && f(i) == x}
  12.  
  13. def map(s: Set[Int], f: Int => Int): (Int => Boolean) =
  14. (x: Int) => {
  15. (-bound to bound).exists(i => s(i) && f(i) == x)
  16. }
Add Comment
Please, Sign In to add comment