Skip to content

Instantly share code, notes, and snippets.

View rodrigovidal's full-sized avatar

Rodrigo Vidal rodrigovidal

View GitHub Profile
[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;
let lista = [1..10] |> List.filter(fun x -> x % 2 = 0)
match lista with
| [] -> printfn "Lista vazia"
| _ -> printfn "Head = %i" y.Head
//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))
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;
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");
let nome = "Rodrigo Vidal"
let nome = "Don Syme"
let nome = "Rodrigo Vidal"
nome = "Don Syme"
let nome = "Rodrigo Vidal"
nome <- "Don Syme"
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
@rodrigovidal
rodrigovidal / gist:1026460
Created June 15, 2011 04:05
Tests usando FUnit
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.