Every time I learn a new language, the joy of learning the new language makes me feel so good. More important, the new thinking style and new patterns behind the language teaches me a lot.

Recently I've involved in a project written in Groovy. Learning it was fun. Here, I want to share some points of this language which I like.

### Groovy is dynamic

Groovy is dynamic language over the JVM. It's heavily based on dynamic features. So managing the risk of dynamic languages and its error-proneness was a good experience while learning Groovy.

### Groovy is functional

One of its design goals was o fill the gap of functional languages in JVM stack. In addition to being a functional language, it has lots of syntactic sugars to make it more fun.

### Curry: a new pattern of calculus

This one surprises me a lot, as it revealed a new thinking style and pattern in my mind.

While learning Groovy, I've got familiar with Curry Calculus which I haven't heard about. Maybe I used some kinds of Curries in JavaScript before, but I didn't see it as something clear and powerful like curry concept.

Describing it in brief, it's a way to reduce the parameters of a function and generating a new function which is simpler to work with.

Consider * f(x,y) = x+y* as a function.

*is a reduced version of*

**g(y) = f(5,y)***. It always adds*

**f***to*

**5***. But why always 5? A curry is a function to make this process more flexible. In fact a curry itself, is a function which accepts a function as input and return our desired function as output.*

**y**Consider** h(5)**, as a function which returns our famous function

**, just like above:**

*g**. Let's give g a new name:*

**g(y) = f(5,y)***. So*

**FiveAdder***is equivalent to*

**FiveAdder(y)***. It's interesting that h can produce more functions for us:*

**h(5)*** h(10)* returns

**TenAdder(y) = f(10,y)**** h(z)** returns

**ZAdder(z) = f(5,y)**In this example we say that* h* is a curried version of

**.**

*f*So curry is a function that returns a new function, based on its input (which is a function). In this type of calculus functions are being evaluated by sequential currying. For example to evaluate * f(2,3)*, first replace

*with*

**x***and create a new function which accepts one argument, then replace its argument with 3 to create a new function that just works.*

**2**There's a great article about Currying at Wikipedia, check it if you want to know more about this type of calculus.