<p>在严格的<ahref='https://en.wikipedia.org/wiki/Functional programming'title='wp:函数式编程'>函数编程</a>和<ahref='https://en.wikipedia.org/wiki/lambda calculus'title='wp:lambda演算'>lambda演算中</a>,函数(lambda表达式)没有状态,只允许引用封闭函数的参数。这排除了递归函数的通常定义,其中函数与变量的状态相关联,并且该变量的状态在函数体中使用。 </p><p><ahref='http://mvanier.livejournal.com/2897.html'>Y组合</a>器本身是一个无状态函数,当应用于另一个无状态函数时,它返回函数的递归版本。 Y组合器是这类函数中最简单的一种,称为<ahref='https://en.wikipedia.org/wiki/Fixed-point combinator'title='wp:定点组合器'>定点组合器</a> 。 </p>任务: <pre><code>Define the stateless Y combinator function and use it to compute <a href="https://en.wikipedia.org/wiki/Factorial" title="wp: factorial">factorial</a>.</code></pre><p><code>factorial(N)</code>功能已经给你了。另见<ahref='http://vimeo.com/45140590'>Jim Weirich:功能编程中的冒险</a> 。 </p>