I'm very new to F# so please excuse the completely newbie question:
I have a sequence stored in a variable called prices. I'd like to output the contents of this sequence to the interactive window. What's the easiest command to do this?
Here is my sequence:
> prices;;
val it : seq<System.DateTime * float> = seq []
I've tried printf'ing it but that gives me the error:
> printf("%A", prices);;
printf("%A", prices);;
-------^^^^^^^^^^^^
stdin(82,8): error FS0001: The type ''b * 'c' is not compatible with the type 'Printf.TextWriterFormat<'a>'
Any help would be appreciated.
printf does not take parentheses:
printfn "%A" prices;;
(See F# function types: fun with tuples and currying for details)
You might also convert the seq to a list, eg
printfn "%A" (Seq.toList prices);;
此外,您可以通过更改fsi。*属性(FloatingPointFormat,PrintWidth,PrintDepth,PrintLength,...)来控制交互式会话打印机功能。请参阅: http ://cs.hubfs.net/forums/post/7438.aspx
> prices;;
val it : seq<System.DateTime * float> = seq []
It's doing its job: seq []
means the sequence is empty.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.