@@ -0,0 +1,5 @@ | |||
module Pangram | |||
let isPangram (input: string): bool = | |||
let lowerInput = input.ToLower() | |||
['a'..'z'] |> List.filter lowerInput.Contains = ['a'..'z'] |
@@ -0,0 +1,21 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>netcoreapp3.0</TargetFramework> | |||
<IsPackable>false</IsPackable> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<Compile Include="Pangram.fs" /> | |||
<Compile Include="PangramTests.fs" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" /> | |||
<PackageReference Include="xunit" Version="2.4.1" /> | |||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.2" /> | |||
<PackageReference Include="FsUnit.xUnit" Version="3.8.1" /> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,49 @@ | |||
// This file was auto-generated based on version 2.0.0 of the canonical data. | |||
module PangramTests | |||
open FsUnit.Xunit | |||
open Xunit | |||
open Pangram | |||
[<Fact>] | |||
let ``Empty sentence`` () = | |||
isPangram "" |> should equal false | |||
[<Fact>] | |||
let ``Perfect lower case`` () = | |||
isPangram "abcdefghijklmnopqrstuvwxyz" |> should equal true | |||
[<Fact>] | |||
let ``Only lower case`` () = | |||
isPangram "the quick brown fox jumps over the lazy dog" |> should equal true | |||
[<Fact>] | |||
let ``Missing the letter 'x'`` () = | |||
isPangram "a quick movement of the enemy will jeopardize five gunboats" |> should equal false | |||
[<Fact>] | |||
let ``Missing the letter 'h'`` () = | |||
isPangram "five boxing wizards jump quickly at it" |> should equal false | |||
[<Fact>] | |||
let ``With underscores`` () = | |||
isPangram "the_quick_brown_fox_jumps_over_the_lazy_dog" |> should equal true | |||
[<Fact>] | |||
let ``With numbers`` () = | |||
isPangram "the 1 quick brown fox jumps over the 2 lazy dogs" |> should equal true | |||
[<Fact>] | |||
let ``Missing letters replaced by numbers`` () = | |||
isPangram "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog" |> should equal false | |||
[<Fact>] | |||
let ``Mixed case and punctuation`` () = | |||
isPangram "\"Five quacking Zephyrs jolt my wax bed.\"" |> should equal true | |||
[<Fact>] | |||
let ``Case insensitive`` () = | |||
isPangram "the quick brown fox jumps over with lazy FX" |> should equal false | |||
@@ -0,0 +1,29 @@ | |||
# Pangram | |||
Determine if a sentence is a pangram. A pangram (Greek: παν γράμμα, pan gramma, | |||
"every letter") is a sentence using every letter of the alphabet at least once. | |||
The best known English pangram is: | |||
> The quick brown fox jumps over the lazy dog. | |||
The alphabet used consists of ASCII letters `a` to `z`, inclusive, and is case | |||
insensitive. Input will not contain non-ASCII symbols. | |||
## Running the tests | |||
To run the tests, run the command `dotnet test` from within the exercise directory. | |||
## Autoformatting the code | |||
F# source code can be formatted with the [Fantomas](https://github.com/fsprojects/fantomas) tool. | |||
After installing it with `dotnet tool restore`, run `dotnet fantomas .` to format code within the current directory. | |||
## Further information | |||
For more detailed information about the F# track, including how to get help if | |||
you're having trouble, please visit the exercism.io [F# language page](http://exercism.io/languages/fsharp/resources). | |||
## Source | |||
Wikipedia [https://en.wikipedia.org/wiki/Pangram](https://en.wikipedia.org/wiki/Pangram) | |||