Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print sequence in F#

Tags:

f#

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.

like image 776
rein Avatar asked Aug 18 '09 14:08

rein


1 Answers

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, e.g.

printfn "%A" (Seq.toList prices);;
like image 150
Brian Avatar answered Dec 21 '22 22:12

Brian