# Introduction

## Seja bem-vindo à

### ![Introdução](/files/-M1z9HdqDxJK33adrEuh)

## Destaques

#### Utilize *pattern matching* com valores opcionais e valores `Either`

```csharp
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

```csharp
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!

```csharp
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!

```csharp
//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!

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

#### Utilize Curry e Aplicação Parcial!

```csharp
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*!

```csharp
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!

![Capa do livro](/files/-M1z9IJ7gUi2D6EpMnYe)

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

* [Formato PDF](https://www.gitbook.com/download/pdf/book/gabrielschade/tango-br)
* [Formato mobi](https://www.gitbook.com/download/mobi/book/gabrielschade/tango-br)
* [Formato ePub](https://www.gitbook.com/download/epub/book/gabrielschade/tango-br)

## Índice

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

### Começando

* [Recado do desenvolvedor](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Final%20Remarks/From%20me,%20the%20developer.html)
* [O que é a Tango?](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Getting%20Started/What%20is%20Tango.html)
* [Por onde começar? ](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Getting%20Started/Where%20to%20start.html)

### Instalação

* [Instalação via NuGet](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Installation/Based%20on%20NuGet.html)
* [Instalação manual](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Installation/Add%20Manually.html)

### Conceitos

* [Introdução](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Concepts/Introduction.html)
* [Utilizando comparação de padrões (Pattern Matching)](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Concepts/Pattern%20Matching.html)
* [Valores Opcionais](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Concepts/Optional%20Values.html)
* [Valores "Ou um ou outro"](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Concepts/Either%20Values.html)
* [Saindo do void para o Unit](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Concepts/From%20void%20to%20Unit.html)
* [Delegates Func e Action](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Concepts/Function%20and%20Action.html)
* [Utilizando operações encadeadas para processos contínuos](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Concepts/Using%20Chainable%20Operations%20in%20a%20Continuation%20Flow.html)
* [Currying e Aplicação Parcial](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Concepts/Currying%20and%20Partial%20Application.html)

### Funcional

* [Introdução](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Functional/Introduction.html)
* [Currying](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Functional/Currying.html)
* [Aplicação Parcial](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Functional/PartialApplication.html)
* [Extensões](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Functional/FunctionExtensions.html)
* [Cast Rápido para Delegates](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Functional/cast-rapido-para-delegates.html)

### Operações

* [Introdução](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Operations/Introduction.html)
* [Operações com Booleans](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Operations/Bool.html)
* [Operações com Inteiros](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Operations/Int.html)
* [Operações com Decimais](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Operations/Decimal.html)
* [Operações com Doubles](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Operations/Double.html)
* [Operações com Strings](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Operations/String.html)

### Tipos

* [Introdução](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Types/Introduction.html)
* [Unit](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Types/Unit.html)
* [`Option<T>`](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Types/Option/Introduction.html)
* [`Either<TLeft, TRight>`](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Types/Either/Introduction.html)
* [`Continuation<TFail, TSuccess>`](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Types/Continuation/Introduction.html)

### Módulos

* [Introdução](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Introduction.html)
* [Option](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Option.html)
  * [Apply](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Option/apply.html)
  * [AsEnumerable](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Option/asenumerable.html)
  * [Bind](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Option/bind.html)
  * [Count](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Option/count.html)
  * [Exists](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Option/exists.html)
  * [Filter](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Option/filter.html)
  * [Fold](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Option/fold.html)
  * [FoldBack](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Option/foldback.html)
  * [Iterate](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Option/iterate.html)
  * [Map](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Option/map.html)
  * [OfNullable](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Option/ofnullable.html)
  * [ToArray](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Option/toarray.html)
  * [ToList](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Option/tolist.html)
  * [ToNullable](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Option/tonullable.html) &#x20;
* [Either](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Either.html)
  * [Exists](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Either/exists.html)
  * [Iterate](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Either/iterate.html)
  * [Fold](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Either/fold.html)
  * [FoldBack](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Either/foldback.html)
  * [Map](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Either/map.html)
  * [Swap](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Either/swap.html)
  * [ToTuple](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Either/totuple.html)
* [Collection](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection.html)
  * [Append](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/append.html)
  * [Choose](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/choose.html)
  * [ChunkBySize](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/chunkbysize.html)
  * [Collect](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/collect.html)
  * [CompareWith](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/comparewith.html)
  * [CountBy](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/countby.html)
  * [Concat](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/concat.html)
  * [Distinct](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/distinct.html)
  * [Empty](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/empty.html)
  * [Exists](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/exists.html)
  * [Exists2](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/exists2.html)
  * [Filter](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/filter.html)
  * [FindIndex](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/findindex.html)
  * [Fold](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/fold.html)
  * [Fold2](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/fold2.html)
  * [FoldBack](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/foldback.html)
  * [FoldBack2](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/foldback2.html)
  * [ForAll](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/forall.html)
  * [ForAll2](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/forall2.html)
  * [ForAll3](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/forall3.html)
  * [Head](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/head.html)
  * [HeadAndTailEnd](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/headandtailend.html)
  * [Range](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/range.html)
  * [Generate](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/generate.html)
  * [Initialize](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/initialize.html)
  * [Iterate](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/iterate.html)
  * [Iterate2](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/iterate2.html)
  * [IterateIndexed](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/iterateindexed.html)
  * [IterateIndexed2](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/iterateindexed2.html)
  * [Map](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/map.html)
  * [Map2](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/map2.html)
  * [Map3](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/map3.html)
  * [MapIndexed](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/mapindexed.html)
  * [MapIndexed2](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/mapindexed2.html)
  * [MapIndexed3](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/mapindexed3.html)
  * [Partition](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/partition.html)
  * [Permute](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/permute.html)
  * [Pick](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/pick.html)
  * [Reduce](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/reduce.html)
  * [ReduceBack](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/reduceback.html)
  * [Replicate](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/replicate.html)
  * [Scan](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/scan.html)
  * [Scan2](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/scan2.html)
  * [ScanBack](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/scanback.html)
  * [ScanBack2](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/scanback2.html)
  * [Tail](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/tail.html)
  * [TryFind](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/tryfind.html)
  * [TryPick](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/trypick.html)
  * [Unzip](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/unzip.html)
  * [Unzip3](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/unzip3.html)
  * [Zip](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/zip.html)
  * [Zip3](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Modules/Collection/zip3.html)

### Extensões

* [Introdução](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Extensions/Introduction.html)
* [Extensões para Enum](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Extensions/Enum%20Extensions.html)
* [Construtor de EqualityComparer](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Extensions/EqualityComparerBuilder.html)
* [Módulos como extensão](https://github.com/gabrielschade/tango-br/tree/973dafe9d6a8dbad594ebb5c6d71c46ff5727a5a/Extensions/Modules%20as%20Extensions.html)

![Tango](/files/-M1z9IJNBGGUqIsF0N0n)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gabriel-schade-cardoso.gitbook.io/tango-br/master.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
