In Visual Studio 2008, when you compile an F # program, a warning (but not an error) occurs, but because this warning makes your program unusable, most of the data will be prompted to use. NET in place of some functions in F #, but these. NET can not be used in the same way as in C #.
For example:
#light
let one = ["one "]
let two = "two " :: one
let three = "three " :: two
let rightWayRound = List.rev three
let printList l =
List.iter print_string l
print_newline()
let main() =
printList one
printList two
printList three
printList rightWayRound
main()
When the above program compiles in Visual Studio 2008, a warning appears, prompting List.iter print_string l print_string to be replaced with Console.Write (), but if you direct print_ String directly with Console.Write () or console.write is also not good.
So what if you use Console.Write () instead of print_string to compile in Viusal Studio 2008,
Note that Console.wirite has multiple overloaded versions, indicating the version when overloaded, using anonymous functions and annotating parameters
So the upper List.iter print_string l
Can be rewritten as list.iter (Fun (x:string)-> Console.Write (x)) L
This can be done by compiling the.