This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let lista = [1..10] |> List.filter(fun x -> x % 2 = 0) | |
match lista with | |
| [] -> printfn "Lista vazia" | |
| _ -> printfn "Head = %i" y.Head |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let nome = "Rodrigo Vidal" | |
let nome = "Don Syme" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let nome = "Rodrigo Vidal" | |
nome = "Don Syme" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let nome = "Rodrigo Vidal" | |
nome <- "Don Syme" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
OlderNewer