Skip to content

dmannock/FsharpRampart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FsharpRampart

.NET port (written in F#) of the Haskell Rampart library by Taylor Fausak.

Available on Nuget

Examples

open FsharpRampart
relate (toInterval (2, 4)) (toInterval (3, 5))
// Output: Overlaps
let dt1 = (DateTime(2020,01,01), DateTime(2020,03,14)) |> toInterval
let dt2 = (DateTime(2019,01,01), DateTime(2020,03,14)) |> toInterval
relate dt1 dt2
//Output: Finishes
invert Before
//Output: After
toInterval (2, 4) |> lesser
// Output: 2

toInterval (2, 4) |> greater
// Output: 4
toInterval (2, 2) |> isEmpty
// Output: true

toInterval (2, 3) |> isEmpty
// Output: false

toInterval (2, 3) |> isNonEmpty
// Output: true

C# interop

Usage is similar but to make it easier to consume using directives will be needed depending on which module the function is in.

using FsharpRampart;
using static FsharpRampart.Interval;

relate(toInterval(2, 4), toInterval(3, 5));
//Output: Overlaps

var dt1 = toInterval(new DateTime(2020,01,01), new DateTime(2020,03,14));
var dt2 = toInterval(new DateTime(2019,01,01), new DateTime(2020,03,14));
relate(dt1, dt2);
//Output: Finishes

invert(Relation.Before);
//Output: After

Changelog

View changelog

About

Determine how intervals relate to each other.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages