Is it possible to print full list without using cycle?
I tried:
Console.WriteLine([1;2;3;4;5])
and it prints only three first elements:
[1;2;3; ... ]
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want to use the built-in F# formatting engine (and avoid implementing the same thing yourself), you can use F# printing functions such as
printfn. You can give it a format specifier to print an entire list (using F# formatting) or print just a first few elements (which happens when you callToString):If you want to use
Console.WriteLine(or other .NET method) for some reason, you can also usesprintfwhich behaves similarly toprintf, but returns the formatted string as the result:The benefit of using
printforsprintfis that it also automatically deals with other F# types (for example if you have a list containing tuples, discriminated unions or records).