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

In this case, you think of `connectWords` as a function that takes two arguments. But since it is curried, you can also do this:

    let prefix = connectWords "Hello "
        world  = prefix "world"
        bob    = prefix "bob"
    in ...
`world` is "Hello world", and `bob` is "Hello bob". That is the power of currying. A maybe more useful example is specifying the mapping function in `List.map` without supplying the list to map over. This allows you to use the same map with multiple lists.


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

Search: