- Trangia
- fuel bottle
- Cobb
- fuel
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
let fibs() = | |
let rec fibs' a b = | |
seq { | |
yield b | |
yield! fibs' b (a+b) | |
} | |
fibs' 1L 1L | |
fibs() |> Seq.take 10 |> List.ofSeq;; |
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
#r "System.Numerics" | |
open System.Numerics | |
/// Find the roots of ax² + bx + c | |
let quadraticRoots a b c = | |
let ``√ B² - 4ac`` = sqrt (b * b - 4.0 * a * c) | |
let ``2a`` = 2.0 * a | |
(-b + ``√ B² - 4ac``) / ``2a``, (-b - ``√ B² - 4ac``) / ``2a`` |
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 StringTimes | |
{ | |
using System; | |
public class Program | |
{ | |
private static void Main(string[] args) | |
{ | |
const int Iterations = 10000000; |
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
let foldBack folder seq state = | |
let arr = Seq.toArray seq | |
Array.foldBack folder arr state | |
let folder a b = | |
let res = a + b | |
//printfn "fold %A and %A giving %A" a b res | |
res | |
let list = seq [1..1000000] |
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
let createTimer() = | |
let sw = System.Diagnostics.Stopwatch.StartNew() | |
fun () -> | |
sw.Elapsed | |
let timer = createTimer() | |
// Do some stuff to time | |
timer();; |
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 Curry | |
{ | |
using System; | |
internal static class Program | |
{ | |
// Curry methods | |
public static TResult Curry<T, TResult>(this Func<T, TResult> f, T arg) | |
{ | |
// Curry'2 is just invoke |
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
@echo off | |
pushd visualfsharp\src | |
msbuild fsharp-library-build.proj /p:TargetFramework=net40 | |
if %errorlevel% neq 0 goto :END | |
msbuild fsharp-library-unittests-build.proj /p:TargetFramework=net40 |
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
let rec change denominations amount = | |
match denominations with | |
| [] -> 0 | |
| _ when amount = 0 -> 1 | |
| head :: tail when amount < head -> change tail amount | |
| head :: tail -> (change denominations (amount - head)) + (change tail amount) | |
change [50; 20; 10; 5; 2; 1] 100;; |
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
[<CompiledName("SortByDescending")>] | |
let sortByDescending keyf source = | |
checkNonNull "source" source | |
mkDelayedSeq (fun () -> | |
let keyf = System.Func<_,_>(keyf) | |
let res = System.Linq.Enumerable.OrderByDescending(source, keyf) | |
res :> seq<_>) | |
[<CompiledName("SortDescending")>] | |
let sortDescending source = |