93
> printfn "%A" [ 1 .. 5 ];; // Full list using F# formatting [1; 2; 3; 4; 5] > printfn "%O" [ 1 .. 5 ];; // Using ToString (same as WriteLine) [1; 2; 3; ... ]
Console.WriteLine(sprintf "%A" list)
87
[1;2;3;4;5] |> Seq.iter (fun x -> printf "%d " x)
[1;2;3;4;5] |> Seq.iter (printf "%d ")
70
[<StructuredFormatDisplayAttribute("PP {PrettyPrinter}")>] type Foo(a:string array) = let pp = Array.mapi (fun i (s: string) -> sprintf "{idx: %d len: %d contents: '%s'}" i s.Length s) a member x.PrettyPrinter = pp > let foo = Foo [|"one";"two";"three"|];; val foo : Foo = PP [|"{idx: 0 len: 3 contents: 'one'}"; "{idx: 1 len: 3 contents: 'two'}"; "{idx: 2 len: 5 contents: 'three'}"|] > printfn "%A" foo;; PP [|"{idx: 0 len: 3 contents: 'one'}"; "{idx: 1 len: 3 contents: 'two'}"; "{idx: 2 len: 5 contents: 'three'}"|] val it : unit = ()
61
let nums = [1;2;3;4;5;6] let concat acc x = acc + " " + (string x) let full_list = List.fold concat "" nums printfn "%s" full_list