拆分奇偶数
open System
open System.IO
let a = seq{1..10}
let writeToFile filename obj =
using(File.AppendText(filename)) (fun file1 ->
file1.WriteLine("{0}", obj.ToString() )
)
let e =
a
|> Seq.map(fun i -> i,i*i)
|> Seq.iter(fun (x, y) ->
match x with
//| x when x%2 = 0 -> printfn "%A" x
| x when x%2 = 0 -> writeToFile "偶数.txt" (x,y)
//| x when x%2 = 1 -> printfn "%A" x
| x when x%2 = 1 -> writeToFile "奇数.txt" (x,y)
| _ -> ())