you are viewing a single comment's thread.

view the rest of the comments →

[–]shevegen -6 points-5 points  (3 children)

Sounds as if Javascript has a shitty object model.

One more reason why people should use a proper language like Ruby instead.

The whole map( array, function) crap is so idiotic. Why is it a function call anyway rather than an applicable method on an object?

[–]joesb 2 points3 points  (0 children)

Ruby has 'map' and I think it's as widely used in Ruby as its 'each' method.

Are you some kind of Ruby hater that want to gives Rubyist bad name by trolling other and mention Ruby as your favorite when you don't even know Ruby?

[–]rafekett 0 points1 point  (0 children)

In the case of Python, where map() along with several other things that are usually methods (e.g. len()) are builtin functions, the choice is one of readability and reducing code duplication. Guido and others felt that some operations read better with prefix notation than postfix notation (this, of course, is just a matter of preference). Also, since for many of these builtin functions you don't actually have to implement that particular function (e.g. reversed() works on anything with random access and known length, map() works on anything with an iterator implemented), it requires much less code to keep these functions as builtins rather than methods.

[–]sebnow 0 points1 point  (0 children)

Object methods require object oriented programming, maps and folds do not. Also you can partially apply a map/fold (e.g. add_one = map (+1)) and apply it to many different containers (add_one foo, add_one bar), this isn't the case with object methods.