Created
May 15, 2015 18:37
-
-
Save ploeh/4f873315fc556f7672f1 to your computer and use it in GitHub Desktop.
F# readability test.
This file contains hidden or 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 nerdCapsToKebabCase (text : string) = | |
let charToString index c = | |
let s = c.ToString().ToLower() | |
match index, Char.IsUpper c with | |
| 0, _ -> s | |
| _, true -> "-" + s | |
| _ -> s | |
text |> Seq.mapi charToString |> String.concat "" |
Yes, it is readable. After seeing @isaacabraham 's active patterns approach I kind of like that more, but regardless, the original is clear enough.
Yes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, readable, but distracting for me. This looks like something I could write just to get something working quickly when I'm really thinking about another problem. When reading, I keep getting distracted by the inefficiencies and will try to fix them in my head before moving on. :)