Created
December 29, 2014 09:37
-
-
Save khmylov/6081d8d7d4a6a8723cfb to your computer and use it in GitHub Desktop.
fsharp1
This file contains 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 cleanText (lines: string[]) = | |
lines | |
|> Seq.skipWhile (fun str -> not (bookStarted str)) | |
|> Seq.takeWhile (fun str -> not (bookFinished str)) | |
|> String.concat " " | |
|> Seq.map (fun c -> | |
if Char.IsLetter c then Char.ToLowerInvariant c | |
else ' ') | |
// ----> | |
let cleanText2 : string[] -> char seq = | |
Seq.skipWhile (not << bookStarted) | |
>> Seq.takeWhile (not << bookFinished) | |
>> String.concat " " | |
>> Seq.map (fun c -> | |
if Char.IsLetter c then Char.ToLowerInvariant c | |
else ' ') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My choice:
I think this is more readable for people, because it shows data flow (what is important) instead of beauty of function composition and explicit type annotation.