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
open System.Diagnostics | |
let createSources size f = [ | |
"array", (lazy (Array.init size f :> seq<_>)) | |
"list", (lazy (List.init size f :> seq<_>)) | |
"computation expression", (lazy (seq { | |
let mutable x = 0 | |
while x < size do |
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
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | |
namespace Microsoft.FSharp.Collections | |
#nowarn "52" // The value has been copied to ensure the original is not mutated by this operation | |
open System | |
open System.Diagnostics | |
open System.Collections | |
open System.Collections.Generic | |
open Microsoft.FSharp.Core |
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
open System.Diagnostics | |
let createViaStateMachine data = | |
seq { | |
for item in data do | |
if item % 13L <> 0L then | |
let item2 = item * item | |
if item2 % 11L <> 0L then | |
yield item2 } |
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 System; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
using System.Threading; | |
using System.Reflection; | |
namespace LazyTest | |
{ | |
[TestClass] | |
public class LazyRegressionTests | |
{ |
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
open System.Diagnostics | |
let sum1 (a:array<_>) total = | |
total := 0 | |
for i = 0 to a.Length-1 do | |
total := !total + a.[i] | |
!total | |
let sum2 (a:array<_>) total = | |
total := 0 |
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 countPrimes n = | |
let rec outer count i = | |
if i <= n then | |
let sqrtI = int (floor (sqrt (float i))) | |
let rec inner j = | |
if j <= sqrtI then | |
if i % j <> 0 then | |
inner (j+1) | |
else | |
false |
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
open System.Diagnostics | |
#if !INCLUDE_PROJECT_INFO | |
module ProjectInfo = | |
let Name = "Unknown" | |
let AppendResultTo = None | |
#endif | |
[<AutoOpen>] | |
module Helpers = |
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
open System.Diagnostics | |
module ``TheBurningMonk - Euler`` = | |
// collated from :- https://github.com/theburningmonk/ProjectEuler-FSharp-Solutions/tree/master/ProjectEulerSolutions/ProjectEulerSolutions | |
// documentation :- http://theburningmonk.com/project-euler-solutions/ | |
open System | |
open System.Numerics | |
let inline private validate expected received = | |
if expected <> received then |
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
open System | |
open System.IO | |
type Test = { | |
Core : string | |
Bittage : string | |
Name : string | |
Time : float | |
} |
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 Program | |
open System.Diagnostics | |
type Key1 = | |
struct | |
val A : int | |
new (a)= { A = a } | |
end |