Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


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.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: