[mochikit] Curry and uncurry

2008-12-17 Thread Arnar Birgisson
One thing I think could be useful is to port Haskell's curry and uncurry. This is basically a convenience method for (un)wrapping an .apply on a function object: function curry(f) { return function () { // first convert arguments to a regular array var args =

[mochikit] Re: Introducing the MochiKit.Text module

2008-12-17 Thread Per Cederberg
On Wed, Dec 17, 2008 at 5:11 PM, Arnar Birgisson arna...@gmail.com wrote: One comment about startsWith, endsWith, contains etc.. currently they take first the haystack and then the needle (I'm talking about parameter order). Perhaps switching this could benefit the usecase where this is used

[mochikit] Introducing the MochiKit.Text module

2008-12-17 Thread Per Cederberg
Hi everyone, I've just finished committing one of my planned additions to MochiKit 1.5 -- a new MochiKit.Text module: http://www.mochikit.com/doc/html/MochiKit/Text.html It basically provides some of the text formatting stuff discussed here on the list previously. With some random string

[mochikit] Re: Introducing the MochiKit.Text module

2008-12-17 Thread Arnar Birgisson
Hi, On Wed, Dec 17, 2008 at 17:32, Per Cederberg cederb...@gmail.com wrote: Ah, well... I didn't look too hard into Python here. Just googled various name ideas and picked the most popular one (think it was from some MS API actually)... ;-) That's not such a bad method :) However, I feel

[mochikit] Re: Curry and uncurry

2008-12-17 Thread Amit Mendapara
I think, for functional programming, we should keep things simple. It's better to keep code simple and readable. Can you explain few more use cases of the proposed functions? Regards -- Amit On Dec 17, 9:22 pm, Arnar Birgisson arna...@gmail.com wrote: One thing I think could be useful is to

[mochikit] Re: Introducing the MochiKit.Text module

2008-12-17 Thread Amit Mendapara
It's very good addition :) especially the new formating functions. I'll improve my MochiKit.String module so that one can create String instance with the new formating patterns. Again, I'm too, agree with Arner. Try to follow Python conventions as much as possible. startsWith = startswith

[mochikit] Re: Curry and uncurry

2008-12-17 Thread Per Cederberg
The names curry and uncurry were a bit confusing to me, so it took me a while to understand these two functions... http://en.wikipedia.org/wiki/Currying To me (and probably other non-Haskell users) the names imply the same thing as bind or partial. It's a confusing world... :-( In