chore(i18n,curriculum): processed translations (#43390)
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 594810f028c0303b75339ad5
|
||||
title: Y combinator
|
||||
title: Combinador Y
|
||||
challengeType: 5
|
||||
forumTopicId: 302345
|
||||
dashedName: y-combinator
|
||||
@ -8,11 +8,11 @@ dashedName: y-combinator
|
||||
|
||||
# --description--
|
||||
|
||||
In strict [functional programming](https://en.wikipedia.org/wiki/Functional programming "wp: functional programming") and the [lambda calculus](https://en.wikipedia.org/wiki/lambda calculus "wp: lambda calculus"), functions (lambda expressions) don't have state and are only allowed to refer to arguments of enclosing functions. This rules out the usual definition of a recursive function wherein a function is associated with the state of a variable and this variable's state is used in the body of the function. The [Y combinator](https://mvanier.livejournal.com/2897.html) is itself a stateless function that, when applied to another stateless function, returns a recursive version of the function. The Y combinator is the simplest of the class of such functions, called [fixed-point combinators](https://en.wikipedia.org/wiki/Fixed-point combinator "wp: fixed-point combinator").
|
||||
Em [programação funcional](https://en.wikipedia.org/wiki/Functional programming "wp: functional programming") estrita e em [cálculo de lambda](https://en.wikipedia.org/wiki/lambda calculus "wp: lambda calculus"), funções (expressões lambda) não têm estado e é permitido apenas se referir a argumentos de funções encapsuladas. Isso exclui a definição habitual de uma função recursiva, na qual uma função é associada ao estado de uma variável e o estado dessa variável é usado no corpo da função. O [combinador Y](https://mvanier.livejournal.com/2897.html) é uma função sem estado que, ao ser aplicada a outra função sem estado, retorna uma versão recursiva da função. O combinador Y é a mais simples dessas classes de funções, chamada de [combinador de ponto fixo](https://en.wikipedia.org/wiki/Fixed-point combinator "wp: fixed-point combinator").
|
||||
|
||||
# --instructions--
|
||||
|
||||
Define the stateless Y combinator function and use it to compute [factorial](https://en.wikipedia.org/wiki/Factorial "wp: factorial"). The `factorial(N)` function is already given to you. **See also:**
|
||||
Defina a função de combinador Y sem estado e use-a para calcular o [fatorial](https://en.wikipedia.org/wiki/Factorial "wp: factorial"). A função de fatorial, `factorial(N)`, você já tem. **Consulte também:**
|
||||
|
||||
<ul>
|
||||
<li><a href="https://vimeo.com/45140590" target="_blank">Jim Weirich: Adventures in Functional Programming</a>.</li>
|
||||
@ -20,37 +20,37 @@ Define the stateless Y combinator function and use it to compute [factorial](htt
|
||||
|
||||
# --hints--
|
||||
|
||||
Y should return a function.
|
||||
Y deve retornar uma função.
|
||||
|
||||
```js
|
||||
assert.equal(typeof Y((f) => (n) => n), 'function');
|
||||
```
|
||||
|
||||
factorial(1) should return 1.
|
||||
factorial(1) deve retornar 1.
|
||||
|
||||
```js
|
||||
assert.equal(factorial(1), 1);
|
||||
```
|
||||
|
||||
factorial(2) should return 2.
|
||||
factorial(2) deve retornar 2.
|
||||
|
||||
```js
|
||||
assert.equal(factorial(2), 2);
|
||||
```
|
||||
|
||||
factorial(3) should return 6.
|
||||
factorial(3) deve retornar 6.
|
||||
|
||||
```js
|
||||
assert.equal(factorial(3), 6);
|
||||
```
|
||||
|
||||
factorial(4) should return 24.
|
||||
factorial(4) deve retornar 24.
|
||||
|
||||
```js
|
||||
assert.equal(factorial(4), 24);
|
||||
```
|
||||
|
||||
factorial(10) should return 3628800.
|
||||
factorial(10) deve retornar 3628800.
|
||||
|
||||
```js
|
||||
assert.equal(factorial(10), 3628800);
|
||||
|
Reference in New Issue
Block a user