# Introduction

## Welcome to

### ![Introdução](https://gabrielschade.gitbooks.io/tango-br/content/assets/logo%20tango.png)

## Highlights

#### Uses *pattern matching* with Option and Either values

```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);
```

#### Continuation flow using Then and Catch

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

#### Continuation flow with pipeline operator!

```csharp
ContinuationModule.Resolve(5)
    >  (value => value + 4)
    >  (value => 
       {
          if( value % 2 == 0)
              return value + 5;
          else
              return "ERROR";
       })
    >  (value => value + 10)
    >= (fail => $"{fail} catched")
```

#### Powerful High Order Functions!

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

#### Uses Simple Functions as Reduction

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

#### Uses Curry and Partial Application!

```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);
```

#### Uses *QuickDelegateCast* feature!

```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);
```

## It is completely FREE!!

The **Tango** is completely free! The code and the documentation as well, you can download your book bellow.

![Book cover](https://2455692763-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1z9EbGtBm_jYFLz1fP%2F-M1z9T9_3iVpKvWQoFky%2F-M1z9U3q3o_MMs3ynTFF%2Fcover%20rotated-us-50.jpg?generation=1583755187918451\&alt=media)

Download your documentation book:

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

## Summary

You can find all topics here!

### Getting Started

* [Summary](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/README.html)
* [From me, the Developer](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Final%20Remarks/From%20me,%20the%20developer.html)
* [What is Tango?](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Getting%20Started/What%20is%20Tango.html)
* [Where to start? ](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Getting%20Started/Where%20to%20start.html)

### Installation

* [Based on NuGet](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Installation/Based%20on%20NuGet.html)
* [Manually](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Installation/Add%20Manually.html)

### Fundamentals

* [Introduction](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Concepts/Introduction.html)
* [Using Pattern Matching](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Concepts/Pattern%20Matching.html)
* [Option values](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Concepts/Optional%20Values.html)
* [Either values](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Concepts/Either%20Values.html)
* [From void to Unit](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Concepts/From%20void%20to%20Unit.html)
* [Func and Action](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Concepts/Function%20and%20Action.html)
* [Chainable operations in a Continuation flow](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Concepts/Using%20Chainable%20Operations%20in%20a%20Continuation%20Flow.html)
* [Currying and Partial Application](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Concepts/Currying%20and%20Partial%20Application.html)

### Functional

* [Introduction](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Functional/Introduction.html)
* [Currying](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Functional/Currying.html)
* [Partial Application](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Functional/PartialApplication.html)
* [Functional Extensions](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Functional/FunctionExtensions.html)
* [QuickCast to Delegates](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Functional/cast-rapido-para-delegates.html)

### Operations

* [Introduction](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Operations/Introduction.html)
* [Operations with Booleans](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Operations/Bool.html)
* [Operations with Integers](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Operations/Int.html)
* [Operations with Decimals](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Operations/Decimal.html)
* [Operations with Doubles](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Operations/Double.html)
* [Operations with Strings](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Operations/String.html)

### Types

* [Introduction](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Types/Introduction.html)
* [Unit](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Types/Unit.html)
* [Option\<T>](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Types/Option/Introduction.html)
* [Either\<TLeft, TRight>](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Types/Either/Introduction.html)
* [Continuation\<TFail, TSuccess>](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Types/Continuation/Introduction.html)

### Modules

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

### Extensions

* [Introduction](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Extensions/Introduction.html)
* [Enum Extensions](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Extensions/Enum%20Extensions.html)
* [EqualityComparer Builder](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Extensions/EqualityComparerBuilder.html)
* [Modules as Extensions](https://github.com/gabrielschade/tango/tree/379cc4a38ae47796971eb875ec66e7dc053a9081/Extensions/Modules%20as%20Extensions.html)

![Tango](https://gabrielschade.gitbooks.io/tango-br/content/assets/logo%20tango%20branco.png)
