File input/output: Difference between revisions

Content added Content deleted
No edit summary
(→‎{{header|F Sharp|F#}}: comply to task description by using an intermediate variable)
Line 788:
 
=={{header|F Sharp|F#}}==
Using an intermediate variable for the input file content is not ideomatic in functional programming. Nevertheless...
 
<lang fsharp>open System.IO
 
let copyFile fromTextFileName toTextFileName =
let readinputContent = File.ReadAllText fromTextFileName
let write file inputContent |> fun text =-> File.WriteAllText(filetoTextFileName, text)
 
[<EntryPoint>]
"input.txt" |> read |> write "output.txt"
let main argv =
copyFile "input.txt" |> read |> write "output.txt"
0
</lang>