Hadoop has its roots in functional programming, which is exemplified in languages such as Lisp and ML. A key feature of functional programming language is the concept of higher-order functions, or functions that can accept another functions as arguments. Two common built-in order functions are map and fold, illustrated in below figure.
Given a list, map takes as an argument a function f (that takes a single argument) and applies it to all elements in a list. Given a list, fold takes as arguments a function g (that takes two arguments) and an initial value: g is first applied to the initial value and the first item in the list, the result of which is stored in an intermediate variable. This intermediate variable and the next item in the list serve as the arguments to a second application of g, the results of which are stored in the intermediate variable. This process repeats until all items in the list have been consumed; fold then returns the final value of the intermediate variable. Typically map and fold are used in combination.
We can view map as a consise way to represent the transformation of a dataset as defined by the function f. In the same vein, we can view fold as an aggregation operation, as defined by the function g. On immediate observation is that the application of f to each item in a list (or more generally, to elements in a large dataset) can be parallelized in a straightforward manner, since each functional application in isolation. In a cluster, these operations can be distributed across many different machines. The fold operation, on the other hand, has more restrictions on data locality. Elements in the list must be "brought together" before the function g can be applied. However, many real-world applications do not require g to be applied to all elements of the list. To the extent that elements in the list can be devided into groups, the fold aggregations can also proceed in parallel. Furthermore, for operations that are commutative and associative, significant efficiencies can be gained in the fold operation through local aggregation and appropriate reordering.
In a nutshell, we have described MapReduce. The map phase in MapReduce roughly corresponds to the map operation in functional programming, whereas the reduce phase roughly corresponds to the fold operation in functional programming.
There is a interesting blog post on how to implement high order functions(HOF) in Java.
TODO --> continued with concrete example, maybe in Java, to illustrate the concept of HOF.
相关推荐
### 计算多项式的根 #### 概述 在计算机辅助几何设计(CAGD)领域,计算多项式的根是一项核心任务。对于多项式方程的解法,传统的代数方法往往只适用于低次多项式,而对于高次多项式,则需要借助数值方法来求解。...
ethylene in the control of sprouting of sweetpotato roots, however, is not known. The aim of this study was to investigate the role of ethylene in control of sprouting in sweetpotato roots by ...
本文将基于题目提供的信息,深入探讨《功能根的功能》("Functional roots of the sine function")一文中涉及的关键概念和技术细节。 #### 标题:功能根的功能 该标题直接指出了研究的主题是针对正弦函数的功能根...
19.2 Roots of Nonlinear Functions 1047 19.3 Interpolation and Extrapolation 1058 19.4 Numerical Integration 1065 19.5 Numerical Solution of Linear Systems of Equations 1077 19.6 Eigenvalues and ...
标题《Paul Graham:The Roots of Lisp@2002》和描述表明,这篇文档是关于解释Lisp编程语言基础的文章。John McCarthy作为Lisp语言的创造者,他发表的论文中提出了使用简单的运算符和函数表示法来构建完整的编程语言...
phrase High Performance Liquid Chromatography Under Salt and Alkali Stress,颜宏,,Several organic acids accumulated in Kochia Scoparia shoots and roots were studied by means of reverse-phrase high ...
本文的研究主题是鱼藤酮类化合物的提取、分离以及高效液相色谱(HPLC)分析方法,特别针对的是鱼藤根(Derris trifoliata Lour.)中一种叫做deguelin的成分。Deguelin是一种天然的植物化合物,具有多方面的生物活性...
roots -Polynomial roots Syntax r = roots(c) Description r = roots(c) returns a column ... For vectors,roots and poly are inverse functions of each other, up to ordering, scaling, and roundoff error.
Roots of futility. San Francisco: Jossey-Bass, 1972, 272 p., [dollar]9.50 B O O K R E V I E W S GILBERT R. GREDLER Temple University POLANSKY, N. A., BORGMAN, R. D. and DESAIX, C. Roots of ...
在给定的压缩包文件"13623-calculate-roots-of-chebyshev-polynomials.zip.zip"中,我们可以推测其内容可能与计算切比雪夫多项式的根有关。切比雪夫多项式是一类在数值分析和工程计算中非常重要的特殊函数,它们在...
Polynomial Root Finder is a reliable and fast C program (+ Matlab gateway) for finding all roots of a complex polynomial.
TPM技术规范与实现硬件Roots of Trust TPM(Trusted Platform Module,信任平台模块)是一种基于硬件的安全模块,旨在提供一个可靠的根信任锚点,以保护计算机系统的安全。TPM技术规范是由Trusted Computing Group...
《Not矩阵的广义平方根及其在隐逻辑算子揭示和全矩阵圆欧拉函数定义中的应用》 本文深入探讨了Not矩阵的广义平方根的概念,并将其应用于逻辑操作的矩阵表示以及全矩阵圆欧拉函数的定义。Not矩阵在量子计算理论中...
【标题】"The roots.rar_V9AP_eveningcah_roots" 涉及的核心概念是函数或方程的根的计算,这是数学中的基本概念,尤其在微积分、数值分析以及计算机科学的求解算法中有着广泛的应用。V9AP和eveningcah可能是某种特定...
Roots of polynomials Sums containing descending factorials Summation formulas References Textbooks Papers Algorithms coded in Pascal and C Searching algorithms Sorting algorithms Selection ...
Roots of polynomials Sums containing descending factorials Summation formulas References Textbooks Papers Algorithms coded in Pascal and C Searching algorithms Sorting algorithms Selection ...
roots-example-project.com, 根堆栈工程( 格,基岩,Sage ) 根示例项目这里知识库是如何集成和使用以下项目的一个示例:基岩网格Sage ( 带土壤的)有关更多的background,请参见这个博客文章。这个项目是一个完整的...
在提供的压缩包文件`roots_of_quadratic.m.zip`中,包含了`roots_of_quadratic.m`文件。这应该是一个MATLAB源代码文件,我们可以打开并查看其内部实现。通常,这样的函数会包含一些输入验证(确保输入是正确的二次...