Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5998955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:29:00+00:00 2026-05-23T00:29:00+00:00

Last night i have read about the curry() method in Groovy and i felt

  • 0

Last night i have read about the curry() method in Groovy and i felt the feeling of functional programming, with the use of this curry() method.

As a novice in Groovy language, are there any methods in Groovy which provides functional programming capabilities as curry() method does?

It will be good, if those methods are been explained with an simple example. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:29:01+00:00Added an answer on May 23, 2026 at 12:29 am

    There’s also Closure composition

    def plus2  = { it + 2 }
    def times3 = { it * 3 }
    
    def composed1 = plus2 << times3
    assert composed1(3) == 11
    

    And you can use the Method Reference operator & to get a reference to a class method, which you can then use with currying or composition.

    ie:

    def parseIntRef = Integer.&parseInt
    
    def binaryParse = parseIntRef.rcurry( 2 )
    def hexParse    = parseIntRef.rcurry( 16 )
    
    assert binaryParse( '110' ) == 6
    assert hexParse(    '0A'  ) == 10
    

    There are 3 forms of curry for closures;

    1. The basic curry method which starts currying the parameters of a Closure from the left most parameter
    2. Then there is the rcurry method, which starts currying the parameters from the right
    3. And finally, there is ncurry which starts at the index specified by you.

    All 3 of those curry methods are well described in the documentation if you follow the links 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This was working last night, but I must have accidentally changed something, because it
As of last night, I decided to start learning about WPF and have been
This code have been working until I updated last night. The code works perfectly
Last night I was thining that programming languages can have a feature in which
I have been stuck with this problem on and off since last night and
I have this login code, which works last night before I slept. Nobody used
I have been witnessing this weird behavior since last night. Here's the fiddle: http://jsfiddle.net/Gqndm/
I only noticed this last night, as I have not used the toolbox on
I have been looking at this since last night and just can't figure out
I have no idea how this is happening. Last night it worked fine: My

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.