Advertisement
Guest User

Untitled

a guest
Dec 9th, 2014
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.86 KB | None | 0 0
  1. object SetPackage {
  2.     val (MIN_RANGE, MAX_RANGE) = (-1000, 1000)
  3.  
  4.     type Set[A] = A => Boolean
  5.  
  6.     def contains[A](s: Set[A], x: Int): Boolean
  7.  
  8.     def union[A](s1: Set[A], s2: Set[A]): Set[A]
  9.  
  10.     def intersection[A](s1: Set[A], s2: Set[A]): Set[A]
  11.  
  12.     def forall[A](s: Set[A], p: A => Boolean): Boolean
  13.  
  14.     def exists[A](s: Set[A], p: A => Boolean): Boolean
  15.  
  16.     def partition[A](s: Set[A], p: A => Boolean): (Set[A], Set[B])
  17.  
  18.     def take[A](s: Set[A], n: Int): Set[A]
  19.  
  20.     def takeWhile[A](s: Set[A], p: A => Boolean): Set[A]
  21.  
  22.     def drop[A](s: Set[A], n: Int): Set[A]
  23.  
  24.     def dropWhile[A](s: Set[A], p: A => Boolean): Set[A]
  25.  
  26.     def filter[A](s: Set[A], p: Int => Boolean): Set[A]
  27.  
  28.     def map[A, B](s: Set[A], f: A => B): Set[B]
  29.  
  30.     def flatten[A](s: Set[Set[A]]): Set[A]
  31.  
  32.     def apply[A, B](f: Set[A => B], s: Set[A]): Set[B]
  33.  
  34.     def bind[A, B](s: Set[A], f: A => Set[B]): Set[B]
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement