You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: manuscript/ch2.md
+15-15Lines changed: 15 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -15,39 +15,39 @@ A pergunta "O que é uma Função?" superficialmente aparenta ter uma resposta
15
15
16
16
Embora a definição seja razoável, está em falta uma essência muito importante que é o núcleo de uma *funcão* visto que se aplica a FP. Portanto vamos cavar abaixo da superfície para compreender mais completamente as funções .
17
17
18
-
### Brief Math Review
18
+
### Breve Revisão de Matemática
19
19
20
-
I know I've promised we'd stay away from math as much as possible, but bear with me for a moment as we quickly observe some fundamental things about functions and graphs from algebra before we proceed.
20
+
Eu sei que prometi que nos afastaríamos o maximo possível da matemática, mas aguentem comigo por um momento, enquanto observamos de forma rápida.
21
21
22
-
Do you remember learning anything about `f(x)`back in school? What about the equation`y = f(x)`?
22
+
Voltando a escola, você se lembra de aprender algo sobre `f(x)`? e sobre a equação`y = f(x)`?
23
23
24
-
Let's say an equation is defined like this: <code>f(x) = 2x<sup>2</sup> + 3</code>. What does that mean? What does it mean to graph that equation? Here's the graph:
24
+
Digamos que uma equação é definida assim: <code>f(x) = 2x<sup>2</sup> + 3</code>. O que isso significa? O que siginifica representar graficamente essa equação? Aqui está o gráfico:
25
25
26
26
<palign="center">
27
27
<img src="images/fig1.png" width="40%">
28
28
</p>
29
29
30
-
What you can notice is that for any value of `x`, say`2`, if you plug it into the equation, you get `11`. What is `11`, though? It's the *return value* of the`f(x)` function, which earlier we said represents a`y` value.
30
+
O que se pode notar para qualquer valor de `x`, digamos`2`, se inserir na equação, obtém´se `11`. Mas o que é o `11`? É o *valor de retorno* da função`f(x)`, que anteriormente representava o valor de`y`.
31
31
32
-
In other words, we can choose to interpret the input and output values as a point at `(2,11)`on that curve in the graph. And for every value of`x`we plug in, we get another `y`value that pairs with it as a coordinate for a point. Another is`(0,3)`, and another is `(-1,5)`. Put all those points together, and you have the graph of that parabolic curve as shown here.
32
+
Em outras palavras, podemos escolher interpretar o valores de entrada(input) e saída(output) como em um ponto `(2,11)`nessa curva do gráfico. E para cada valor de`x`inserirmos, obteremos outro valor de `y`que se equipara a ele como uma coordenada em um ponto. Outro é`(0,3)`, e o outro é `(-1,5)`. Junto todos esses pontos, e você terá o gráfico desta curva parabólica como mostrado aqui.
33
33
34
-
So what's any of this got to do with FP?
34
+
Então o que isto tem a ver com FP?
35
35
36
-
In math, a function always takes input(s), and always gives an output. A term you'll often hear around FP is "morphism"; this is a fancy way of describing a set of values that maps to another set of values, like the inputs of a function related to the outputs of that function.
36
+
Na Matemática, uma função sempre recebe entradas(input), e sempre devolve uma saída(output). Um termo que se ouve com frequência em torno de FP é "morfismo"; esta é uma forma elegante de descrever um conjunto de valores que mapeia outro conjunto de valores, como as entradas de uma função relacionadas às saídas desta função.
37
37
38
-
In algebraic math, those inputs and outputs are often interpreted as components of coordinates to be graphed. In our programs, however, we can define functions with all sorts of input(s) and output(s), even though they'll rarely be interpreted as a visually plotted curve on a graph.
38
+
Na matemática algébrica, essas entradas são muitas vezes interpretadas como componentes de coordenadas a serem marcadas. Nos nossos programas, contudo, podemos definir funções com todo tipo de entrada(input) e saída(output), mesmo que raramente sejam interpretadas como uma curva visualmente traçada num gráfico.
39
39
40
-
### Function vs Procedure
40
+
### Funcões vs Procedimentos
41
41
42
-
So why all the talk of math and graphs? Because essentially Functional Programming is about embracing using functions as *functions* in this mathematical sense.
42
+
Então porquê toda essa conversa sobre gráficos e matemática? Porque essencialmente a programação funcional consiste em abordar a utilização de funções como *funções* neste sentido matemático.
43
43
44
-
You may be more accustomed to thinking of functions as procedures. What's the difference? A procedure is an arbitrary collection of functionality. It may have inputs, it may not. It may have an output (`return` value), it may not.
44
+
Pode estar acostumado a pensar em funções como procedimentos(procedure). Qual é a diferença? Procedimentos são uma coleção arbitrária de funcionalidades. Pode ter entradas, pode não ter. Pode ter saídas (valor do `return`), pode não ter.
45
45
46
-
A function takes input(s) and definitely always has a `return` value.
46
+
Uma função recebe entradas e definitivamente sempre tem valor de `return`.
47
47
48
-
If you plan to do Functional Programming, **you should be using functions as much as possible**, and trying to avoid procedures wherever possible. All your `function`s should take input(s) and return output(s).
48
+
Se você planeja utilizar programação funcional, **deve usar as funções tanto quanto possível**, e tentar evitar procedimentos sempre que possível. Todas as suas `funções` devem ter entrada e retornar saída.
49
49
50
-
Why? The answer to that will have many levels of meaning that we'll uncover throughout this book.
50
+
Por Que? A resposta a isso tera muitos níveis de significado que iremos descobrir ao longo deste livro .
0 commit comments