this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

:sparkles: added let in example on haskell functions

+24
+24
Haskell/Functions.org
··· 33 33 34 34 #+RESULTS: 35 35 : (1.0,-2.5) 36 + 37 + ** Clausula "let in" 38 + Ela eh bem semelhando a clausula ~where~, porem o escopo das definicoes declaradas soh sao acessadas dentro do escopo do ~in~. 39 + #+begin_src haskell 40 + :{ 41 + cylinder :: (RealFloat a) => a -> a -> a 42 + cylinder r h = 43 + let sideArea = 2 * pi * r * h 44 + topArea = pi * r ^2 45 + in sideArea + 2 * topArea 46 + :} 47 + 48 + cylinder 2 5 49 + #+end_src 50 + 51 + #+RESULTS: 52 + : Prelude> 87.96459430051421 53 + 54 + Tambem eh possivel declarar funcoes dentro do escopo do ~let~ 55 + #+begin_src haskell 56 + [let square x = x * x in (square 5, square 3, square 2)] 57 + #+end_src 58 + 59 + #+RESULTS: