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
/// Radians | |
[<Measure>] type r | |
let inline unitlessSin value : ^T = sin value | |
let inline unitlessAsin value : ^T = asin value | |
let inline unitlessCos value : ^T = cos value | |
let inline unitlessAcos value : ^T = acos value | |
let inline unitlessTan value : ^T = tan value | |
let inline unitlessAtan value : ^T = atan value | |
let inline unitlessAtan2 (x: ^T1) (y: ^T1) : ^T2 = atan2 x y |
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 inline f tolerance data = | |
let two = LanguagePrimitives.GenericOne + LanguagePrimitives.GenericOne | |
data |> List.mapi (fun i c -> i, c) | |
|>function | |
| (_,c)::tl -> | |
tl | |
|> List.fold (fun (rest, (min, max), x) (i, c) -> | |
if abs (x-c) <= tolerance | |
then rest, (min, max+1), (x+c)/two | |
else ((min,max),x) :: rest, (i, i), c) |
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 Microsoft.FSharp.Data.UnitSystems.SI.UnitNames | |
open Microsoft.FSharp.Data.UnitSystems.SI.UnitSymbols | |
open System | |
open System.Text.RegularExpressions | |
[<Measure>] type g | |
let (|Integer|_|) str = | |
let mutable result = 0 | |
if Int32.TryParse (str, &result) then Some(result) else None |
NewerOlder