News for hackers. Stuff that matters.
Re:Emerging Best Practices in Swift by sinhpham on Wednesday November 18, 2015 @12:32AM (#10586107)
Is the currying example even currying? It looks like it's just a function returning a function to me. I thought currying it's some thing like func contains(subString: String, string: String) -> Bool, and calling contains("a") would automatically return a func(x: String) -> Bool.
Re:Emerging Best Practices in Swift by bdash on Wednesday November 18, 2015 @01:54AM (#10586378)
Currying refers to the process of taking a function that accepts multiple arguments, and turning it into a sequence of functions, each accepting a single argument. The example you provide would be more aptly described as partial application, which is the process of fixing a number of arguments to a function, producing a function of smaller arity.