Why is Ruby’s array.map () is also known as array.collect ()?

Whenever I see Ruby code saying:

arrayNames.collect {... }

< p>I forgot what I collected, I have to find out what it is, and found that it is the same as map().

Map, I can understand, to map 1 byte to a pixel, the function is Map x to y, a 2 to 4, 5 to 25, etc. But where does the name “collect” come from? Maybe this will help remember what the “collect” method is.

to add to other answers , It is an inside joke in Smalltalk:

>Inject: Enter:
>Collect:
>Select:
>Reject:
>Detect:

Discovery mode?

Whenever I see Ruby code saying:

arrayNames.collect {... }< /pre> 

I forgot what was collected, I had to find out what it was, and found that it is the same as map().

Map, I can understand, maps 1 byte to one Pixel, the function is to map x to y, a 2 to 4, 5 to 25 and so on. But where does the name "collect" come from? Maybe this will help memorize what the "collect" method is.

To add to the other answers, it is an inside joke in Smalltalk: < p>

>Inject: Enter:
>Collect:
>Select:
>Reject:
>Detect:

Discover mode?

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3355 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.