diff --git a/PointFreeExtra.Tests/PointFreeExtra.Tests.fsproj b/PointFreeExtra.Tests/PointFreeExtra.Tests.fsproj new file mode 100644 index 0000000..6970220 --- /dev/null +++ b/PointFreeExtra.Tests/PointFreeExtra.Tests.fsproj @@ -0,0 +1,39 @@ + + + + net7.0 + + false + true + true + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive +all + + runtime; build; native; contentfiles; analyzers; buildtransitive +all + + + + + + + + + + + + + + + + diff --git a/PointFreeExtra.Tests/PointFreeTest.fs b/PointFreeExtra.Tests/PointFreeTest.fs new file mode 100644 index 0000000..dc2d067 --- /dev/null +++ b/PointFreeExtra.Tests/PointFreeTest.fs @@ -0,0 +1,19 @@ +module PointFreeExtra.Tests + +open NUnit.Framework +open FsCheck +open PointFree + +[] +let ``Functions are equal test`` () = + let equalityChecker (g: ('a -> 'b)) (l: 'a list) = + if (l.IsEmpty) then + true + else + f'1 g l = f'2 g l + && f'3 g l = f'4 g l + && f'5 g l = (f'6<'a, 'b> g l) + && f'1 g l = f'4 g l + && f'1 g l = f'5 g l + + Check.QuickThrowOnFailure equalityChecker diff --git a/PointFreeExtra/PointFree.fs b/PointFreeExtra/PointFree.fs new file mode 100644 index 0000000..823a10d --- /dev/null +++ b/PointFreeExtra/PointFree.fs @@ -0,0 +1,14 @@ +namespace PointFreeExtra + +module PointFree = + let f'1 g l = List.map g (List.tail l) + + let f'2 g l = l |> List.tail |> List.map g + + let f'3 g = List.tail >> List.map g + + let f'4 g = (>>) List.tail (List.map g) + + let f'5 g = g |> List.map |> (>>) List.tail + + let f'6<'a, 'b> : (('a -> 'b) -> 'a list -> 'b list) = List.map >> (>>) List.tail diff --git a/PointFreeExtra/PointFreeExtra.fsproj b/PointFreeExtra/PointFreeExtra.fsproj new file mode 100644 index 0000000..d49e68a --- /dev/null +++ b/PointFreeExtra/PointFreeExtra.fsproj @@ -0,0 +1,12 @@ + + + + net7.0 + true + + + + + + + diff --git a/PointFreeExtra/PointFreeExtra.sln b/PointFreeExtra/PointFreeExtra.sln new file mode 100644 index 0000000..14ac70f --- /dev/null +++ b/PointFreeExtra/PointFreeExtra.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 25.0.1706.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "PointFreeExtra", "PointFreeExtra.fsproj", "{CA55CD04-B297-440E-AD76-8EBE85FBD1E6}" +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "PointFreeExtra.Tests", "..\PointFreeExtra.Tests\PointFreeExtra.Tests.fsproj", "{75E4B1DE-7366-43DD-A017-ADF62D96A1D5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CA55CD04-B297-440E-AD76-8EBE85FBD1E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CA55CD04-B297-440E-AD76-8EBE85FBD1E6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CA55CD04-B297-440E-AD76-8EBE85FBD1E6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CA55CD04-B297-440E-AD76-8EBE85FBD1E6}.Release|Any CPU.Build.0 = Release|Any CPU + {75E4B1DE-7366-43DD-A017-ADF62D96A1D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {75E4B1DE-7366-43DD-A017-ADF62D96A1D5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {75E4B1DE-7366-43DD-A017-ADF62D96A1D5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {75E4B1DE-7366-43DD-A017-ADF62D96A1D5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B6F62D6F-BCC7-4F29-9AF5-9C8318F753F8} + EndGlobalSection +EndGlobal