View gist:cff2b9bfc6f578708274
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; |
View gist:5891488
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
http://sist.sysu.edu.cn/~isslxm/DSA/textbook/Skiena.-.TheAlgorithmDesignManual.pdf | |
https://github.com/felipecruz/cdats | |
http://www.amazon.com/Algorithms-Unlocked-Thomas-H-Cormen/dp/0262518805/ref=sr_1_2?ie=UTF8&qid=1372518782&sr=8-2&keywords=cormen | |
http://www.amazon.com/Introduction-Algorithms-Thomas-H-Cormen/dp/0262033844/ref=sr_1_1?ie=UTF8&qid=1372518782&sr=8-1&keywords=cormen | |
https://sites.google.com/site/stevenhalim/ |
View gist:3893973
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
////Isso funciona.. | |
var parametros = new[] | |
{ | |
new OracleParameter("P_CD_CLIENTE", OracleDbType.Int32) | |
{ Direction = ParameterDirection.Input, Value = null }, | |
new OracleParameter("C_CURSOR", OracleDbType.RefCursor) | |
{ Direction = ParameterDirection.Output } | |
}; | |
////Isso não funciona.. |
View gist:3516066
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 Ast = | |
type Node = | |
| Int of int option | |
| Float of float option | |
| BooleanNode of bool option | |
| StringNode of string option | |
| QuotedVariable of string | |
| Variable of string | |
| Addition of Node * Node |
View gist:2913207
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
function steepest | |
% Exemplo 6.2-2 do livro Optimal Control Theory de D.E.Kirk | |
% Steepest Descent Method | |
eps = 1e-3; | |
options = odeset('RelTol', 1e-4, 'AbsTol',[1e-4 1e-4]); %permite ajustar os parametros de integracao para os solvers de EDOs | |
t0 = 0; | |
tf = 0.78; | |
R = 0.1; | |
step = 0.4; |
View euler1.fs
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 euler1 (limit : int64) = | |
let limit = bigint (limit-1L) | |
let sn a1 = | |
let a1 = bigint (int a1) | |
let an = (limit / a1 * a1) | |
let n = an / a1 | |
(an + a1) * n / 2I | |
sn 3 + sn 5 - sn 15 |
View gist:1363351
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 int SumNumbers(int from, int to) | |
{ | |
return from > to ? 0 : (SumNumbers(from + 1, to) + from) ; | |
} |
View gist:1363274
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
private int SumNumbers(int from, int to) | |
{ | |
if (from > to) return 0; | |
int sumRest = SumNumbers(from + 1, to); | |
return from + sumRest; | |
} |
View gist:1363269
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
private int SumNumbers(int from, int to) | |
{ | |
int res = 0; | |
for (int i = from; i <= to; i++) | |
res = res + 1; | |
return res; | |
} |
View gist:1349695
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 fibonacci = | |
(0, 1) | |
|> Seq.unfold(fun (current, next) -> Some(current, (next, current + next))) | |
|> Seq.takeWhile(fun x -> x <= 4000000) | |
|> Seq.filter(fun x -> x % 2 = 0) | |
|> Seq.sum |
NewerOlder