Why is the function named reduce?

Source: Internet
Author: User
My English is poor. I understand reduce. However, I feel that the functions implemented by this function have nothing to do with reduction. So how can we understand reduce? My English is poor. I understand reduce. However, I feel that the functions implemented by this function have nothing to do with reduction. So how can we understand reduce? Reply content: reduce is translated into a statute, meaning it has already been mentioned in other answers.
In fact, the function name should not be set to reduce. It should be called fold and be differentiated between the foldl and foldr versions. The reduce in parallel computing has an implicit premise: reduce over monoid. Therefore, the result is irrelevant to the reduce direction and can be effectively parallelized. Reduction
This is a basic concept in functional programming. However, I first heard this word in parallel computing.
Function programming is sometimes called fold, that is, folding. This is a better understanding. For more information, see wikipedia, which mentions In functional programming. , Fold-Also known variously Reduce, Accumulate, Aggregate, Compress, Or Inject
You can find a word that you think is easy to understand. This is the reduce in MapReduce, also called fold.
Wikipedia link: Fold (higher-order function)

Accumulate is implemented by scheme in the tool.
In C ++, It is std: accumulate.

Wiki Folds in various agesThis function is called in various languages. In functional languages, reduce means to reduce the number of items. to merge the results, convert multiple items into one item. As for how to merge, let's look at the reduce function.
Range to get a collection (or sequence), which contains multiple. The reduce function is add and the result is one.
Of course, a collection can also be used after reduce, because the collection is regarded as a result as a whole. Don't worry about it. This function is so difficult to understand that it does not conform to the python style and is deleted in python3.

Let's take the initiative to correct things, abandon python2, and invest in the camp of python3! Reduce should be translated as "induction" here ". Verb (used with object), brought, bringing.
1.
To carry, convey, conducting, or cause (someone or something) to comewith, to, or toward the speaker:
Bring the suitcase to my house. He brought his brother to my office.
2.
To cause to come to or toward oneself; attract:
Her scream brought the police. He brought honor to his family by hisheroism.
3.
To cause to occur or exist:
The medication brought instant relief.
4.
To cause to come into a participant position, state, or effect:
To bring the car to a stop.
5.
To cause to appear or occur in the mind; evke or recall:
The letter brought her memories of youth.
6.
To persuade, convince, compel, or induce:
She couldn't bring herself to handle the painting.
7.
To operate for; fetch:
These lamps will bring a good price.

Verb phrases
9.
Bring about, to accomplish; cause:
Land reform brought about a great change in the lives of the commonpeople.
10.
Bring around/round,
  1. To convince of a belief or opinion; persuade:
    I think we can bring him around to agreeing with the plan.
  2. To restore to consciousness, as after a faint.
  3. To bring as a visitor:
    They brought around a new employee this morning.
11.
Bring down,
  1. To injure, capture, or kill:
    He brought down several ducks on his last hunting trip.
  2. To lessen; reduce:
    I won't buy that lamp unless they bring down the price.
  3. Slang. to cause to be in low spirits; depress:
    The bad news brought him down.
12.
Bring forth,
  1. To give birth to; deliver; bear:
    To bring forth a son.
  2. To give rise to; introduce:
    To bring forth a proposal for debugging costs.
13.
Bring forward,
  1. To bring to view; show.
  2. To present for consideration; adduce:
    To bring forward an opinion.
14.
Bring in,
  1. To yield, as profits or income:
    My part-time job doesn' t bring in much, but I enjoy it.
  2. To present officially; submit:
    The jury brought in its verdict.
  3. To cause to operate or yield:
    They brought in a gusher on his property.
  4. To present for consideration, approval, etc.; introduce:
    She brought in six new members last month.
15.
Bring off, to accomplish, carry out, or achieve (something ):
He brought off his speech with counter.
16.
Bring on,
  1. To cause to happen or exist; bring about:
    This incident will surely bring on a crisis.
  2. To introduce; cause to appear:
    Bring on the clowns.
17.
Bring out,
  1. To expose; reveal.
  2. To make noticeable or conspicuous in a contrast.
  3. To publish, as a book or play.
  4. To introduce officially into society:
    To bring out a debutante.
18.
Bring,
  1. To bring back to consciousness; revive.
  2. Nautical. to head (a vessel) close to or into the wind so as to halt.
19.
Bring up,
  1. To care for during childhood; rear.
  2. To introduce or mention for attention, discussion, action, orconsideration.
  3. To vomit.
  4. To stop or cause to stop quickly:
    To bring up a car at the curb.
  5. Nautical. (of a vessel) to cause to halt, as by lowering an anchor orrunning aground; fetch up.
....
Reduce many items into one. Is this hard to understand?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.