Skip to content

Instantly share code, notes, and snippets.

@ulfbert-inc
Created October 7, 2014 20:33
Show Gist options
  • Save ulfbert-inc/b43ada99c05043196b01 to your computer and use it in GitHub Desktop.
Save ulfbert-inc/b43ada99c05043196b01 to your computer and use it in GitHub Desktop.
object funsets {
type Set = Int => Boolean
def contains(s: Set, elem: Int): Boolean = s(elem)
//> contains: (s: Int => Boolean, elem: Int)Boolean
def singletonSet(elem: Int): Set = Set(elem) //> singletonSet: (elem: Int)Int => Boolean
def union(s: Set, t: Set): Set = i => s(i) || t(i)
//> union: (s: Int => Boolean, t: Int => Boolean)Int => Boolean
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment