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
using System; | |
namespace CSharpAdventures | |
{ | |
class MainClass | |
{ | |
public static void Main (string[] args) | |
{ | |
int max = Int32.MaxValue; |
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
using System; | |
namespace CSharpAdventures | |
{ | |
class MainClass | |
{ | |
public static void Main (string[] args) | |
{ | |
int max = Int32.MaxValue; | |
Console.WriteLine (CheckedSum(UncheckedSum(max,1),1)); //Doesn't Break. | |
//Console.WriteLine (UncheckedSum(CheckedSum(max,1),1)); //Will Break! |
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
// In the end | |
if (newIndex == this.stepsInfo.Count) | |
{ | |
return false; // It doesn't even matter | |
} |
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 void Foo(MailBodyFormat bodyFormat) { | |
string emailBody; | |
switch (bodyFormat) | |
{ | |
case MailBodyFormat.PlainText: | |
isHtml = false; | |
emailBody = body; | |
break; |
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
//After working with a Functional Language I can't help to think that the world will be more | |
//safe without all the need to be checking for null values. | |
//This is an small helper I wrote to stop writing 'null' every once in a while. | |
namespace Horacio.Helpers | |
{ | |
using System.Net.NetworkInformation; | |
public static class ObjectHelper | |
{ |
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 empty m n = | |
requires (m = 0 || n = 0) MATRIX_EMPTYCREATION_BADDIMENSIONS | |
new FMatrix(m,n, fun (i,j) -> failwith MATRIX_EMPTY ) | |
let identity m = | |
requires (m >= 0) MATRIX_IDENTITYCREATION_BADDIMENSIONS | |
if m = 0 then | |
empty 0 0 | |
else | |
new FMatrix(m,m, fun (i,j) -> if i = j then 1.0 else 0.0) |
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
##author: Horacio Nunez | |
import decimal, math, functools | |
D = decimal.Decimal | |
C = decimal.getcontext() | |
C.prec = 1024 | |
def multiply(x,y): return C.multiply(x,y) |
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 [Result ResultSudoku] = ResolveSudoku(InputSudoku) | |
A = [1 2 3 4 5 6 7 8 9]; | |
B = [1 2 3 4 4 5 5 6 6 7 7 7 8 8 8 9 9 9]; | |
C = [1 2 2 3 3 3 4 5 5 6 6 6 7 8 8 9 9 9]; | |
f = @(x) sum(sum(power(2,x))) / 1022; | |
g = @(m,r,c) [m(3*r-2,3*c-2:3*c) m(3*r-1,3*c-2:3*c) m(3*r,3*c-2:3*c)]; | |
j = @(m,r,c) g(m,sum(B == r),sum(B == c)); | |
h = @(m,r,c) intersect(intersect(setdiff(A,m(r,:)),setdiff(A,m(:,c))),setdiff(A,j(m,r,c))); | |
function [R RS] = Resolve(IS,ESC) | |
if ESC == 0 |
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 empty m n = | |
requires (m = 0 || n = 0) MATRIX_EMPTYCREATION_BADDIMENSIONS | |
new FMatrix(m,n, fun (i,j) -> failwith MATRIX_EMPTY ) | |
let identity m = | |
requires (m >= 0) MATRIX_IDENTITYCREATION_BADDIMENSIONS | |
if m = 0 then | |
empty 0 0 | |
else | |
new FMatrix(m,m, fun (i,j) -> if i = j then 1.0 else 0.0) |