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
type Expr = | |
| X | |
| Const of value: double | |
| Add of Expr * Expr | |
| Sub of Expr * Expr | |
| Mult of Expr * Expr | |
| Div of Expr * Expr | |
| Pow of Expr * Expr | |
| Neg of Expr |
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 e numberStr = | |
match numberStr with | |
| "" -> numberStr | |
| _ -> numberStr + " e " | |
let writeNumber nr : string = | |
let unity = ["zero"; "um"; "dois"; "três"; "quatro"; "cinco"; "seis"; "sete"; "oito"; "nove"; "dez"; "onze"; "doze"; "treze"; "quatorze"; "quinze"; "dezesseis"; "dezessete"; "dezoito"; "dezenove"] | |
let decimals = [""; "cem"; "vinte"; "trinta"; "quarenta"; "cinquenta"; "sessenta"; "setenta"; "oitenta"; "noventa"] | |
let hundreds = [""; "cento"; "duzentos"; "trezentos"; "quatrocentos"; "quinhentos"; "seissentos"; "setecentos"; "oitocentos"; "novecentos"] |
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 e numberStr = | |
match numberStr with | |
| "" -> numberStr | |
| _ -> numberStr + " e " | |
let writeNumber nr : string = | |
let unity = ["zero"; "um"; "dois"; "três"; "quatro"; "cinco"; "seis"; "sete"; "oito"; "nove"; "dez"; "onze"; "doze"; "treze"; "quatorze"; "quinze"; "dezesseis"; "dezessete"; "dezoito"; "dezenove"] | |
let decimals = [""; "cem"; "vinte"; "trinta"; "quarenta"; "cinquenta"; "sessenta"; "setenta"; "oitenta"; "noventa"] | |
let hundreds = [""; "cento"; "duzentos"; "trezentos"; "quatrocentos"; "quinhentos"; "seissentos"; "setecentos"; "oitocentos"; "novecentos"] |
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 inline solution n = | |
[1UL..(n - 1UL)] | |
|> List.filter (fun f -> (f % 3UL = 0UL) || (f % 5UL = 0UL)) | |
|> List.sum | |
let rec iterate count = | |
if count > 0 | |
then | |
System.Console.ReadLine() | |
|> (uint64) |
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
(* --- 0001 --- *) | |
[1..999] | |
|> List.where (fun f -> (f % 3 = 0) || (f % 5 = 0)) | |
|> List.sum | |
(* --- 0002 --- *) | |
let fib = | |
let rec f a b = seq { | |
yield a | |
yield! f b (a + b) |
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
root@ubuntu:/home/elemarjr# mvn archetype:create -DgroupId=com.elemarjr.simpleMath -DartifactId=SimpleMath -DarchetypeArtifactId=maven-archetype-quickstart | |
[INFO] Scanning for projects... | |
[INFO] | |
[INFO] ------------------------------------------------------------------------ | |
[INFO] Building Maven Stub Project (No POM) 1 | |
[INFO] ------------------------------------------------------------------------ | |
[INFO] | |
[INFO] --- maven-archetype-plugin:2.4:create (default-cli) @ standalone-pom --- | |
[INFO] ------------------------------------------------------------------------ | |
[INFO] BUILD FAILURE |
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
[Test] | |
public void ExpressionsWithChildrenShouldOverrideVisitMethod() | |
{ | |
var expressionTypes = typeof(IExpression) | |
.Assembly.GetTypes() | |
.Where(t => typeof(IExpression).IsAssignableFrom(t)) | |
.Where(t => !t.IsInterface); | |
var withChildren = expressionTypes | |
.Where(t => t.GetFields(BindingFlags.Instance | |
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
#include <string> | |
#include <iostream> | |
class Envelope | |
{ | |
private: | |
std::string _value; | |
public: | |
Envelope(const std::string value): | |
_value(value) |
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
#include <iostream> | |
template <unsigned long N> | |
struct binary { | |
static unsigned const value = | |
binary<N/10>::value * 2 | |
+ N % 10; | |
}; | |
template <> |
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
__declspec ( no_refcount ) inline long __stdcall :: WinRTComponentCpp :: Calculator :: | |
__abi_WinRTComponentCpp___ICalculatorPublicNonVirtuals____abi_Add ( int a , int b , int * __abi_returnValue ) | |
{ | |
long __hr = 0 ; | |
* __abi_returnValue = 0 ; | |
try | |
{ | |
auto __tempValue = Add ( a , b ) ; | |
* __abi_returnValue = __tempValue ; | |
} |