-
Notifications
You must be signed in to change notification settings - Fork 0
Description
In tests/Tests.fs there is a note about why we have code duplication. Need to follow-up with the linked thread and find out if there is a way around this situation through polymorphic record access.
// NOTE: The following two method implementations exist because I can't polymorphically access the Word field
// of two different record types in F#
// See: https://fslang.uservoice.com/forums/245727-f-language/suggestions/9633858-structural-extensible-records-like-elm-concrete
let getUniqueCharsFromInputWords (wl:InputWords) =
new String(
wl
|> Seq.map (fun w -> w.Word.ToLowerInvariant())
|> Seq.collect (fun ltrs -> ltrs.ToCharArray())
|> Seq.sort
|> Seq.toArray)
let getUniqueCharsFromPuzzleWords (pw:PuzzleWords) =
new String(
pw
|> Seq.map (fun w -> w.Word.ToLowerInvariant())
|> Seq.collect (fun ltrs -> ltrs.ToCharArray())
|> Seq.sort
|> Seq.toArray)