Tango
  • Introduction
  • Getting Started
    • Summary
    • From me, the Developer
    • What is Tango?
    • Where to start?
  • Installation
    • Based on NuGet
    • Manually
  • Fundamentals
    • Introduction
    • Using Pattern Matching
    • Option values
    • Either values
    • From void to Unit
    • Func and Action
    • Chainable operations in a Continuation flow
    • Currying and Partial Application
  • Functional
    • Introduction
    • Currying
    • Partial Application
    • Functional Extensions
    • QuickCast to Delegates
  • Operations
    • Introduction
    • Operations with Booleans
    • Operations with Integers
    • Operations with Decimals
    • Operations with Doubles
    • Operations with Strings
  • Types
    • Introduction
    • Unit
    • Option<T>
    • Either<TLeft, TRight>
    • Continuation<TFail, TSuccess>
  • Modules
    • Introduction
    • 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
  • Extensions
    • Introduction
    • Enum Extensions
    • EqualityComparer Builder
    • Modules as Extensions
Powered by GitBook
On this page
  • Welcome to
  • Highlights
  • It is completely FREE!!
  • Summary
  • Getting Started
  • Installation
  • Fundamentals
  • Functional
  • Operations
  • Types
  • Modules
  • Extensions

Was this helpful?

  1. Getting Started

Summary

PreviousIntroductionNextFrom me, the Developer

Last updated 5 years ago

Was this helpful?

Welcome to

Highlights

Uses pattern matching with Option and Either values

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

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!

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!

//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

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

Uses Curry and Partial Application!

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!

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.

Download your documentation book:

Summary

You can find all topics here!

Getting Started

Installation

Fundamentals

Functional

Operations

Types

Modules

Extensions

Tango
PDF format
mobi format
ePub format
Summary
From me, the Developer
What is Tango?
Where to start?
Based on NuGet
Manually
Introduction
Using Pattern Matching
Option values
Either values
From void to Unit
Func and Action
Chainable operations in a Continuation flow
Currying and Partial Application
Introduction
Currying
Partial Application
Functional Extensions
QuickCast to Delegates
Introduction
Operations with Booleans
Operations with Integers
Operations with Decimals
Operations with Doubles
Operations with Strings
Introduction
Unit
Option<T>
Either<TLeft, TRight>
Continuation<TFail, TSuccess>
Introduction
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
Introduction
Enum Extensions
EqualityComparer Builder
Modules as Extensions
Introdução
Book cover