Skip to content

Instantly share code, notes, and snippets.

@fblundun
Last active January 8, 2016 14:22
Show Gist options
  • Select an option

  • Save fblundun/091ae59fecd265e5cfd6 to your computer and use it in GitHub Desktop.

Select an option

Save fblundun/091ae59fecd265e5cfd6 to your computer and use it in GitHub Desktop.
def f(x: DfType, pairs: List[(String, AType)]): DfType = pairs match {
case head :: tail => f(x.withColumn(head._1, head._2), tail)
case Nil => x
}
implicit class RichDfType(df: DfType) {
def f(pairs: List[(String, AType)]): DfType = pairs match {
case head :: tail => df.withColumn(head._1, head._2).f(tail)
case Nil => df
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment