Skip to content

Instantly share code, notes, and snippets.

@RobertKoval
Created July 22, 2023 18:49
Show Gist options
  • Save RobertKoval/d4742ad7792f5ea17729fe1454852084 to your computer and use it in GitHub Desktop.
Save RobertKoval/d4742ad7792f5ea17729fe1454852084 to your computer and use it in GitHub Desktop.
Generic partial application function using new Value and Type Parameter Packs
func partiallyApply<T, U, each V>(_ function: @escaping (T, repeat each V) -> U, with argument: T) -> (repeat each V) -> U {
return { (rest: repeat each V) in
return function(argument, repeat each rest)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment