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 8780417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:02:33+00:00 2026-06-13T20:02:33+00:00

Concerning currying in Ruby 1.9.x, I’ve been using it in some places, and can

  • 0

Concerning currying in Ruby 1.9.x, I’ve been using it in some places, and can be translated like basically supporting default parameters to the proc arguments:

p = proc {|x, y, z|x + y + z}
p.curry[1] #=> returns a lambda
p.curry[1, 2] #=> returns a lambda
p.curry[1, 2, 3] #=> 6
p2 = p.curry[1, 2]
p2.(2) #=> 5
p2.(4) #=> 7

very handy, right? thing is, I would like to be able to curry in reverse, that means, fill the last argument of my proc with a random value. Like this:

p = proc{|x, y| x - y }.curry[1]
p.(4)

my desired result would be 3. this returns -3.

  • 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-06-13T20:02:34+00:00Added an answer on June 13, 2026 at 8:02 pm

    i think there’s no direct way of doing that and what you’re doing is a bit dodgy, there probably is better solution to your problem than back-currying

    what you could do to achieve desired result is wrap more procs around your procs:

    p = proc{|x, y| x - y}
    q = proc{|y, x| p[x, y]}
    q.curry[1].(4)
    

    in fact you can reorder arguments any way you want but believe me it gets messy very quickly

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

Sidebar

Related Questions

I have question concerning a function I created. I would like to show the
Concerning this post, I'd like to add css,images and js to my codeigniter application.
I have a question concerning volatile keyword I can't seem to find an answer
I need some help concerning UnboundID. I heard it was a great choice but
This is a quiestion concerning both, Adobe AIR and MS Outlook. I'd like to
Concerning my previous question , I found out that maven can't really output jboss
I found many questions concerning form elements that are null but I simply can‘t
I have some questions concerning the /sys/module/ in linux Does the /sys/module contain all
Concerning the .htaccess documenation, putting a .htaccess file in a directory should affect this
Concerning data binding I have these classes: public class Foo : List<Bar> { public

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.