Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6800813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:00:56+00:00 2026-05-26T19:00:56+00:00

I’m new to Python, Do someone know what’s relationships between Python (and functional languages’)

  • 0

I’m new to Python,

Do someone know what’s relationships between Python (and functional languages’) functions map() / reduce() and MapReduce concept related to distributed computations?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T19:00:57+00:00Added an answer on May 26, 2026 at 7:00 pm

    The cloud concept of map/reduce is very similar, but changed to work in parallel. First, each data object is passed through a function that maps it to a new object (usually, some sort of dictionary). Then, a reduce function is called on pairs of the objects returned by map until there is only one left. That is the result of the map/reduce operation.

    One important consideration is that, because of the parallelization, the reduce function must be able to take in objects from the map function as well as objects from prior reduce functions. This makes more sense when you think about how the parallelization goes. Many machines will each reduce their data to a single object, and those objects will then be reduced to a final output. Of course, this may happen in more than one layer if there is a lot of data.

    Here’s a simple example of how you might use the map/reduce framework to count words in a list:

    list = ['a', 'foo', 'bar', 'foobar', 'foo', 'a', 'bar', 'bar', 'bar', 'bar', 'foo']
    list2 = ['b', 'foo', 'foo', 'b', 'a', 'bar']
    

    The map function would look like this:

    def wordToDict(word):
      return {word: 1}
    

    And the reduce function would look like this:

    def countReduce(d1, d2):
      out = d1.copy()
      for key in d2: 
        if key in out:
          out[key] += d2[key]
        else:
          out[key] = d2[key]
      return out 
    

    Then you can map/reduce like this:

    reduce(countReduce, map(wordToDict, list + list2))
    
    >>> {'a': 3, 'foobar': 1, 'b': 2, 'bar': 6, 'foo': 5}
    

    But you can also do it like this (which is what parallelization would do):

    reduce(countReduce, [reduce(countReduce, map(wordToDict, list)), reduce(countReduce, map(wordToDict, list2))])
    
    >>> {'a': 3, 'foobar': 1, 'b': 2, 'foo': 5, 'bar': 6}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have a jquery bug and I've been looking for hours now, I can't
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.