Skip to content

Instantly share code, notes, and snippets.

Avatar

Rodrigo Vidal rodrigovidal

View GitHub Profile
View gist:cff2b9bfc6f578708274
[EntryPoint]
public static int main(string[] argv)
{
ExtraTopLevelOperators.PrintFormatLine<Unit>((PrintfFormat<Unit, TextWriter, Unit, Unit>) new PrintfFormat<Unit, TextWriter, Unit, Unit, Unit>("2"));
int num = 0;
ExtraTopLevelOperators.PrintFormatLine<Unit>((PrintfFormat<Unit, TextWriter, Unit, Unit>) new PrintfFormat<Unit, TextWriter, Unit, Unit, Unit>("1"));
int a = 0;
ExtraTopLevelOperators.PrintFormatLine<Unit>((PrintfFormat<Unit, TextWriter, Unit, Unit>) new PrintfFormat<Unit, TextWriter, Unit, Unit, Unit>("3"));
int b = 0;
int c = num;
View gist:752710
let lista = [1..10] |> List.filter(fun x -> x % 2 = 0)
match lista with
| [] -> printfn "Lista vazia"
| _ -> printfn "Head = %i" y.Head
View gist:758139
//C#
public T FindInList<T>(IEnumerable<T> source, IEnumerable<T> target)
{
return source.First(target.Contains)
}
//F#
let FindInList (source : seq<_>) (target : seq<_>) = source.First(Func<_,bool>(target.Contains))
View gist:912739
public class Color
{
private readonly int red;
private readonly int green;
private readonly int blue;
public Color(int red, int green, int blue)
{
this.red = red;
this.green = green;
View gist:912741
static void Main(string[] args)
{
Console.WriteLine("--System.String é imutável");
string linguagem = "F#";
string outraLinguagem = linguagem;
outraLinguagem = "Boo";
Console.WriteLine(linguagem);
Console.WriteLine(outraLinguagem);
Console.WriteLine("--StringBuilder é mutável");
View gist:912742
let nome = "Rodrigo Vidal"
let nome = "Don Syme"
View gist:912744
let nome = "Rodrigo Vidal"
nome = "Don Syme"
View gist:912746
let nome = "Rodrigo Vidal"
nome <- "Don Syme"
View gist:958324
let numerosExtenso = ["Um"; "Dois"; "Três"]
let numeros = [1;2;3]
let tupla = List.zip numeros numerosExtenso
for i, j in tupla do
printfn "Numero: %d - Numero por extenso: %s" i j
View gist:1026460
module Tests
open NUnit.Framework
open FsxUnit
open ProjectEuler
type ``Project Euler 1 Tests``() =
[<Test>] member test.
``Given a empty list sum all members should be equal 0``() =
[] |> sumAllMultiplesOf3Or5 |> should be (equal 0)
[<Test>] member test.