1 / 11

Programação Funcional

Programação Funcional. Tipos de Dados. Instalação do GHCi. Para se instalar o ghci (Glossary Haskell Compiler), basta dar o duplo click no icon do setup do ghci e seguir as instruções.

gladys
Télécharger la présentation

Programação Funcional

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Programação Funcional Tipos de Dados

  2. Instalação do GHCi • Para se instalar o ghci (Glossary Haskell Compiler), basta dar o duplo click no icon do setup do ghci e seguir as instruções. • Depois de instalado vamos ao botão do Start, programs e abrimos o WinGHCi, este será o nosso ambiente trabalho durante o semestre.

  3. Simples cálculos aritméticos • Prelude> 4 + 9 • Prelude> 100 - 56 • Prelude> 10 * 2 • Prelude> 5 / 2 • Prelude> (10 + 13) * 2 • Prelude> 10 / (20 - 10) • Prelude> 50 * 10 – 499 • Prelude> 50 * (10 - 499)

  4. Valores Booleanos • Para os valores booleanos os sinais que se seguem significam: • && and (e) booleano; • || or (ou) booleano; • Not nega o True (verdadeiro) ou o False (Falso);

  5. Valores Booleanos • Prelude> True && False • Prelude> True and True • Prelude> False || True • Prelude> not False • Prelude> not (True && False) • Prelude> not (True && True) • Prelude> not (False && False)

  6. Comparação de valores • Para comparar os valores os sinais que se seguem significam: • == igual • /= diferente • > maior que • < menor que

  7. Comparação de valores • Prelude> 5 == 5 • Prelude> 14 == 43 • Prelude> 10 > 11 • Prelude> 14 < 43 • Prelude> 10 /= 11 • Prelude> 11 /= 11 • Prelude>“Bom dia” == “Bom dia” • Prelude>“Bom dia” == “Ola”

  8. Sucessor, máximo e mínimo • Para esses valores vamos usar algumas funções do Haskell, tais como: • Succ; • min; • max; • Prelude> succ 10 • Prelude> succ 1

  9. Sucessor, máximo e mínimo • min 1 2 • min 10 4 • min 2.4 3.4 • max 1 9 • max 20 40 • min 43.4 6.8

  10. Aplicação de funções • Prelude> succ 7 + max 3 9 + 2 • Prelude> (succ 2) + (max 3 4) – 4 • Prelude> succ 6 – min 10 13 - 2 • Prelude> (succ 1) – (min 4 5) – 6 • Prelude> succ 3 + max 2 3 – 1 • Prelude> (succ 1) – max 1 2 + 2

  11. FIM

More Related