テキストファイルを読み込み、その中の母音の数を数えたいと思います。 "ParseFile"コンテンツを文字列に変換してcountVowelsに変数として渡す方法を知りたい場合テキストファイルの内容を文字列に変換してFの関数として渡します
明らかに、私が(関数を渡す)方法は機能していません。
open System.IO
open System
let ParseFile = File.ReadAllLines("C:\\Users\sid\Desktop\AmazonProductAdvertisingAPI\Documents\File3.txt")
\\let countVowels(str : string)
let countVowels (ParseFile) =
let charList = List.ofSeq str
let accFunc(As, Es, Is, Os, Us) letter =
if letter = 'a' then (As+1, Es, Is, Os, Us)
elif letter = 'e' then (As, Es+1, Is, Os, Us)
elif letter = 'i' then (As, Es, Is+1, Os, Us)
elif letter = 'o' then (As, Es, Is, Os+1, Us)
elif letter = 'u' then (As, Es, Is, Os, Us+1)
else (As, Es, Is, Os, Us)
List.fold accFunc (0, 0, 0, 0, 0) charList
パラメータの受け渡しはプログラミング101です。このようなことはほぼ完全にF#の文献でカバーされています。 [MSDN](http://msdn.microsoft.com/en-us/library/dd233213.aspx)から始めることができます。 – Daniel