charts - Charting with F# does not take in Seq? -
following real-world functional programming blog drawing bar , column charts, trying draw histogram data stored @ set of tuples (data_value, frequency) in lazy sequence.
it not work unless convert sequence list, error message being in case of sequence "the ienumerable 't not support reset function
". there way generate histogram/chart etc. using .net library lazily-evaluated sequence?
also (ok newbie query alert), there way make chart persist when program run console? usual system.console.readkey() |> ignore
makes chart window hang, , otherwise disappears in instant. i've been using "send interactive" see results til now.
the problem sequences (of type seq<t>
, alias ienumerable<t>
) generated using f# sequence expression notation not support reset
method. method required charting library (because needs obtain data each time redraws screen).
this means that, example, following not work:
seq { x in data -> x } |> fsharpchart.line
many of standard library functions seq
module implemented using sequence expressions, result not support reset
. can fix converting data list (using list.ofseq
) or array (using array.ofseq
) or writing code using lists:
[ x in data -> x ] |> fsharpchart.line
... , if you're using function, can take 1 list
(not of seq
functions available list
, need use conversion):
[ x in data -> x ] |> list.choose op |> fsharpchart.line
Comments
Post a Comment