J
Josh Susser
Ruby's enumeration message names come directly from its Smalltalk
ancestry. There are also some aliases. Like so:
*method* *alias*
collect map
detect find
select find_all
reject
inject
Ruby 1.9 introduces the K-combinator in the form of the method
Object#tap. I don't get the name #tap at all. So I'm proposing a new
name/alias pair, with a more meaningful name:
*method* *alias*
affect tap
"foo".affect { |s| s << "bar" }
#=> "foobar"
The K-combinator is all about side-effecting the receiver object, so
"affect" seems like a meaningful name for that functionality (whereas
"effect" would be wrong!). "tap" is still cute, and rhymes with "map",
so having both seems like a good Rubyish way to go.
Thoughts?
ancestry. There are also some aliases. Like so:
*method* *alias*
collect map
detect find
select find_all
reject
inject
Ruby 1.9 introduces the K-combinator in the form of the method
Object#tap. I don't get the name #tap at all. So I'm proposing a new
name/alias pair, with a more meaningful name:
*method* *alias*
affect tap
"foo".affect { |s| s << "bar" }
#=> "foobar"
The K-combinator is all about side-effecting the receiver object, so
"affect" seems like a meaningful name for that functionality (whereas
"effect" would be wrong!). "tap" is still cute, and rhymes with "map",
so having both seems like a good Rubyish way to go.
Thoughts?