Compiling F # programs in Visual Studio 2008

Source: Internet
Author: User
Tags visual studio

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.