Tango-br
  • Introduction
  • Começando
    • Índice
    • Recado do desenvolvedor
    • O que é a Tango?
    • Por onde começar?
  • Instalação
    • Instalação via NuGet
    • Instalação manual
  • Conceitos
    • Introdução
    • Utilizando comparação de padrões (Pattern Matching)
    • Valores Opcionais
    • Valores "Ou um ou outro" (Either)
    • Saindo do void para o Unit
    • Delegates Func e Action
    • Utilizando operações encadeadas com processos contínuos
    • Currying e Aplicação Parcial
  • Funcional
    • Introdução
    • Currying
    • Aplicação Parcial
    • Extensões
    • Cast Rápido para Delegates
  • Operações
    • Introdução
    • Operações com Booleans
    • Operações com Inteiros
    • Operações com Decimais
    • Operações com Doubles
    • Operações com Strings
  • Tipos
    • Introdução
    • Unit
    • Option<T>
    • Either<TLeft, TRight>
    • Continuation<TFail, TSuccess>
  • Módulos
    • Introdução
    • Option
      • Apply
      • AsEnumerable
      • Bind
      • Count
      • Exists
      • Filter
      • Fold
      • FoldBack
      • Iterate
      • Map
      • OfNullable
      • ToArray
      • ToList
      • ToNullable
    • Either
      • Exists
      • Iterate
      • Fold
      • FoldBack
      • Map
      • Swap
      • ToTuple
    • Continuation
      • AsContinuation
      • Resolve
      • Reject
      • All
    • Collection
      • Append
      • Choose
      • ChunkBySize
      • Collect
      • CompareWith
      • CountBy
      • Concat
      • Distinct
      • Empty
      • Exists
      • Exists2
      • Filter
      • FindIndex
      • Fold
      • Fold2
      • FoldBack
      • FoldBack2
      • ForAll
      • ForAll2
      • ForAll3
      • Head
      • HeadAndTailEnd
      • Range
      • Generate
      • Initialize
      • Iterate
      • Iterate2
      • IterateIndexed
      • IterateIndexed2
      • Map
      • Map2
      • Map3
      • MapIndexed
      • MapIndexed2
      • MapIndexed3
      • Partition
      • Permute
      • Pick
      • Reduce
      • ReduceBack
      • Replicate
      • Scan
      • Scan2
      • ScanBack
      • ScanBack2
      • Tail
      • TryFind
      • TryPick
      • Unzip
      • Unzip3
      • Zip
      • Zip3
  • Extensões
    • Introdução
    • Extensões para Enum
    • Construtor de EqualityComparer
    • Módulos como extensão
Powered by GitBook
On this page
  • Seja bem-vindo à
  • Destaques
  • Totalmente Gratuita
  • Índice
  • Começando
  • Instalação
  • Conceitos
  • Funcional
  • Operações
  • Tipos
  • Módulos
  • Extensões

Was this helpful?

Introduction

NextÍndice

Last updated 5 years ago

Was this helpful?

Seja bem-vindo à

Destaques

Utilize pattern matching com valores opcionais e valores Either

Option<int> optionalValue = 10;
int value = optionalValue.Match(
        methodWhenSome: number => number,
        methodWhenNone: () => 0);

Either<bool, int> eitherValue = 10;
int value = eitherValue.Match(
        methodWhenRight: number => number,
        methodWhenLeft: boolean => 0);

Crie processos contínuos utilizando Then e Catch

Continuation<string, int> continuation = 5;

continuation.Then(value => value + 4)
            .Then(value => 
                  {
                    if( value % 2 == 0)
                        return value + 5;
                    else
                        return "ERROR";
                  })
            .Then(value => value + 10)
            .Catch(fail => $"{fail} catched");

Crie processos contínuos utilizando pipeline!

continuation 
    >  (value => value + 4)
    >  (value => 
       {
          if( value % 2 == 0)
              return value + 5;
          else
              return "ERROR";
       })
    >  (value => value + 10)
    >= (fail => $"{fail} catched")

Utilize Poderosas Funções de alta ordem!

//IEnumerable<int> source = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }
IEnumerable<IEnumerable<int>> result = source.ChunkBySize(3);

//result = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9},  {10} }

var (resultEvens, resultOdds) = 
    source.Partition(value => value % 2 == 0)

//resultEvens = { 2, 4, 6, 8, 10 }
//resultOdds = { 1, 3, 5, 7, 9 }

Utilize operações para redução!

int result = source.Scan(10, IntegerOperations.Add);
//result = {11, 13, 16, 20, 25, 31, 38, 46, 55, 65}

Utilize Curry e Aplicação Parcial!

Func<int, int, int> add =
    (value, value2) => value + value2;

Func<int, Func<int, int>> addCurried = add.Curry();
curriedResult = addCurried(2)(3);

Func<int, int> addPartial = add.PartialApply(2);
int partialResult = addPartial(3);

Aproveite o QuickDelegateCast!

using static Tango.Functional.QuickDelegateCast;

int SampleAdd(int value1, int value2)
    => value1 + value2;

F<int, int, int>(SampleAdd).Curry();
F<int, int, int>(SampleAdd).PartialApply(1);

Totalmente Gratuita

A Tango é completamente gratuita, tanto a biblioteca quanto sua documentação, além disso, você pode baixar seu PDF para ler offline!

Faça download do livro da documentação :

  • Formato PDF

  • Formato mobi

  • Formato ePub

Índice

Aqui você encontra todos os tópicos disponíveis nesta documentação.

Começando

  • Recado do desenvolvedor

  • O que é a Tango?

  • Por onde começar?

Instalação

  • Instalação via NuGet

  • Instalação manual

Conceitos

  • Introdução

  • Utilizando comparação de padrões (Pattern Matching)

  • Valores Opcionais

  • Valores "Ou um ou outro"

  • Saindo do void para o Unit

  • Delegates Func e Action

  • Utilizando operações encadeadas para processos contínuos

  • Currying e Aplicação Parcial

Funcional

  • Introdução

  • Currying

  • Aplicação Parcial

  • Extensões

  • Cast Rápido para Delegates

Operações

  • Introdução

  • Operações com Booleans

  • Operações com Inteiros

  • Operações com Decimais

  • Operações com Doubles

  • Operações com Strings

Tipos

  • Introdução

  • Unit

  • Option<T>

  • Either<TLeft, TRight>

  • Continuation<TFail, TSuccess>

Módulos

  • Introdução

  • Option

    • Apply

    • AsEnumerable

    • Bind

    • Count

    • Exists

    • Filter

    • Fold

    • FoldBack

    • Iterate

    • Map

    • OfNullable

    • ToArray

    • ToList

    • ToNullable

  • Either

    • Exists

    • Iterate

    • Fold

    • FoldBack

    • Map

    • Swap

    • ToTuple

  • Collection

    • Append

    • Choose

    • ChunkBySize

    • Collect

    • CompareWith

    • CountBy

    • Concat

    • Distinct

    • Empty

    • Exists

    • Exists2

    • Filter

    • FindIndex

    • Fold

    • Fold2

    • FoldBack

    • FoldBack2

    • ForAll

    • ForAll2

    • ForAll3

    • Head

    • HeadAndTailEnd

    • Range

    • Generate

    • Initialize

    • Iterate

    • Iterate2

    • IterateIndexed

    • IterateIndexed2

    • Map

    • Map2

    • Map3

    • MapIndexed

    • MapIndexed2

    • MapIndexed3

    • Partition

    • Permute

    • Pick

    • Reduce

    • ReduceBack

    • Replicate

    • Scan

    • Scan2

    • ScanBack

    • ScanBack2

    • Tail

    • TryFind

    • TryPick

    • Unzip

    • Unzip3

    • Zip

    • Zip3

Extensões

  • Introdução

  • Extensões para Enum

  • Construtor de EqualityComparer

  • Módulos como extensão

Capa do livro
Tango
Introdução