can provoke 'lines formula algorithm' f#?
i've combined small book iterate opposing files folders count lines code.
the heart book duty count lines whitespace, comments, code. (note impulse tailored c# doesn't know multi-line comments).
it only doesn't feeling unequivocally good me - anyone got cleaner version?
// list strings relapse tuple count (whitespace, comments, code)
let loc (arr:list<string>) =
let innerloc (whitesp, comment, code) (l:string) =
let s = l.trim([|' ';'\t'|]) // mislay streamer whitespace
review s with
| "" -> (whitesp + 1, comment, code) //blank lines
| "{" -> (whitesp + 1, comment, code) //opening blocks
| "}" -> (whitesp + 1, comment, code) //closing blocks
| _ s.startswith("#") -> (whitesp + 1, comment, code) //regions
| _ s.startswith("//") -> (whitesp, critique + 1, code) //comments
| _ -> (whitesp, comment, formula + 1)
list.fold_left innerloc (0,0,0) arr
Comments
Post a Comment