Function#curry does left-to-right currying only. You would either need
to wrap handler in another function or use what is sometimes called
rcurry [1] (a.k.a right curring):

myElement.observe('click', function(e) {
  myFunction(e, myCallback);
})

[1] http://dev.rubyonrails.org/ticket/9034

- kangax

On May 5, 6:01 am, Rytis Daugirdas <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Is there a way to bind only certain parameters with curry()? Consider
> this example:
>
> function myFunction(event, callback)
> {
>   // ...
>
> }
>
> myElement.observe('click', myFunction.curry(myCallback));
>
> Basically, I'm trying to "preconfigure" myFunction with myCallback and
> yet still have the event object available when myFunction is actually
> executed. The above snippet doesn't do what I want because the event
> parameter inside myFunction is myCallback instead of the actual click
> event object. Looking at myFunction.curry(myCallback) declaration it
> does seem logical that event is bound to myCallback, however, is there
> a way to bind only certain parameters without having to start with the
> first one?
>
> Regards,
> Rytis
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to