3 ms·
Thanks! You can also feel free to mine http://github.com/osteele/collections-js http://github.com/osteele/collections-js, which is a version with just the coll
by osteele 17y ago
Thanks! You can also feel free to mine http://github.com/osteele/collections-js http://github.com/osteele/collections-js, which is a version with just the collection functions (but still modifies built-in objects, so may not be to other people's taste), that I've been using in conjunction with jQuery. I haven't finished looking over your library, so I don't know if there's anything in there that would still be useful to you. There's a set of unit tests, which might be.
I eventually found that I was accumulating so many string functions that, in a version of this for OpenLaszlo here http://github.com/osteele/lzosutils http://github.com/osteele/lzosutils, I broke them into a separate file.
- jashkenas 17y agoCollections-js looks like a nice split -- I might end up nabbing a few more things out of there. Maybe some of the unit tests too, although, FYI, your Functional.js page has shown "Documentation Failed to Load" for me for the last few days (on Webkit). One thing that it would be nice to agree on is the standard names for some of these things under Javascript. What should reduce be called? Inject? Foldl? I've followed the Prototype/Ruby naming conventions, but it might make sense to provide all of the commonly-used aliases -- especially when you're not extending core objects, and don't need to worry about cluttering them up. What do you think? Does the same function under 5 different names run as sweet?
- iamwil 17y agoI'd say just use the same function name. people will learn what is what as long as it sticks to some sort of consistent convention.
- davidmathers 17y agoNot inject. Inject was borrowed from smalltalk's #inject:into, but dropped the "into" and just ended up being unintuitive for many people. Ruby 1.8.7 and 1.9 now have #reduce, so I'd say that's the way to go. No reason to use foldl unless you're going to also have a foldr.
- jashkenas 17y agoVersion 0.2, which should be out this evening, will call it "reduce", and alias it to "inject". Thanks for the feedback.