This file contains hidden or 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 NUnit.Framework; | |
using System; | |
namespace Monads | |
{ | |
public class Unit{ | |
private Unit(){ | |
This file contains hidden or 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
j = { | |
context : {} | |
}; | |
j.namepsace = (function(){ | |
var createnamespace = function(parent, remainder){ | |
if(remainder.length === 0){ | |
return; | |
} |
This file contains hidden or 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
window.application = {}; | |
window.application.search = (function(){ | |
function searchwikipedia(term) { | |
return $.ajaxAsObservable({ | |
url: 'http://en.wikipedia.org/w/api.php', | |
data: { action: 'opensearch', | |
search: term, | |
format: 'json' }, |
This file contains hidden or 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
namespace RegularLanguages | |
open System | |
open NUnit.Framework | |
[<AutoOpen>] | |
module Internals = | |
let private (|Char|_|) x = | |
if Char.IsLetter(x) then | |
Some(x) |
This file contains hidden or 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
namespace PerthCodeDojo | |
open System | |
open NUnit.Framework | |
[<AutoOpen>] | |
module Internals = | |
type Quantity = int | |
type Product = |
This file contains hidden or 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
namespace RegularLanguages | |
open System | |
open NUnit.Framework | |
[<AutoOpen>] | |
module Internals = | |
let private (|Char|_|) x = | |
if Char.IsLetter(x) then | |
Some(x) |
This file contains hidden or 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
namespace JsonParser | |
open System | |
open NUnit.Framework | |
module Json = | |
type Token = | |
| String of string | |
| Number of string |
This file contains hidden or 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 Encryption = | |
module private Helpers = | |
let rec encrypt s = | |
match s with | |
| [] -> [] | |
| h :: t -> ( char ((int h) + 13)) :: (encrypt t) | |
let rot13 (s: string) = | |
let characters = s.ToCharArray () | |
let enc = characters |> List.ofArray |> Helpers.encrypt |> List.toArray |
This file contains hidden or 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 Extensions = | |
type System.Collections.Generic.List<'a> with | |
member this.Split (first: int, last: int) = | |
let count = (last - first) + 1 | |
let result = this.GetRange(first, count) | |
result | |
module Algorithms = | |
open Extensions |
This file contains hidden or 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 Algorithms = | |
let binary_search list value = | |
let rec impl(list: 'a list) (value :'a) (hi: int) (low:int) = | |
let index = (hi + low) / 2 | |
match compare value (list.Item(index)) with | |
| 0 -> Some(index) | |
| 1 -> impl list value hi index | |
| -1 -> impl list value index low | |
| _ -> None | |
match list with |