Hi everyone,

At Andrew's suggestion, I thought I'd take some time and discuss some
of the things we are doing with our Cruiser library and see if they
might be of interest in the form of patches.

I'll start with curry and compose. I love what Prototype has already
done with Array, Hash, and Enumerable. So it struck me as curious that
there was no other FP support. Was this a conscious choice?

I have implementations of both if there is interest.

Docs from our Web page (http://dev.zeraweb.com/cruiser-js):

<b>curry</b>. Curries (binds an argument to) a function or method.
Preserves this if it is bound.

<pre><code>
ltrim = String.prototype.replace.curry(/^\s*/,'');
'  hello'.ltrim(); // => 'hello'
</code></pre>

rcurry. Curries an argument to the end (instead of the beginning) of
the argument list. Useful for binding arguments for things like event
handlers, where the initial argument is always the event.

compose. Composes the given function with another, preserving this.

String.prototype.f = String.prototype.split.curry(':').
  compose(Array.prototype.sort)
'5:4:3:2:1'.f() // => [ '1','2','3','4','5' ]


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to