For example, in Ramda the prop(p,obj) method returns the specified property p of the object obj. For example:
returns the value of obj.myProperty as both parameters are specified. However, if you write:
then prop is curried to create a new function which returns the value of myProperty on the specified object, e.g.
Currying is something you come to rely on in functional programming as it provides a way to build new functions using composition. For example add(a,b) adds the two numbers together and mult(a,b) multiplies them. So you can use composition and autocurrying to build up a new function:
Composition applies the functions one after the other, with autocurrying if needed. The first function add is curried to create an add one function then the mult function is curried to create a multiply by 2 function and this is applied to the add one function. That is:
where arg is the single remaining parameter.
So in this case if you write
Autocurrying in Ramda gives you more of the flavour of functional programming than if you have to implement currying manually.
You can use Ramda with Node.js or in browser and it is open source. It looks like a well thought out and implemented library, but currently it has one problem - difficult documentation. You can read through the generated documentation next to the source code and find everything you need to know, but this requires a level of commitment that usually only comes after you know what is available. A simple index of functions grouped by type with a small example of each would make the whole project much more accessible.
Each year since 2000, the World Economic Forum has chosen between 25 and 35 trailblazing companies as Technology Pioneers. Canonical, Couchbase and Raspberry Pi are among the latest to receive the awa [ ... ]