Definição
Funções que recebem ou devolvem funções. Base da composição de pipelines.
Exemplos
1. Receber função
def retry[T](attempts: Int)(fn: => T): T =
try fn catch { case e: Exception if attempts > 1 => retry(attempts - 1)(fn) }
val df = retry(3) { spark.read.parquet(path) }2. Devolver função
def withPrefix(prefix: String): String => String = name => s"$prefix$name"
val stg = withPrefix("stg_")
stg("sales") // stg_sales3. Compor
val clean = (trim _).andThen(toLower).andThen(removeAccents)