"Last value displayed"
val it : string = "Last value displayed"
errors are displayed
input.fsx(1,1): error FS0039: The value or constructor 'errors' is not defined
Util.Html("<b>Inline HTML</b>") |> Display
Util.Url("http://upload.wikimedia.org/wikipedia/commons/9/93/FSharp_Logo.png") |> Display
Util.Math("f(x) = sin(x)") |> Display
let data = [ ("F#", 10); ("C#", 5); ("C++", 20); ("Java", 1); ]
Util.Table(data) |> Display
Item1 | Item2 |
---|---|
F# | 10 |
C# | 5 |
C++ | 20 |
Java | 1 |
Chart.Bar(data) |> Display
Chart.Line(data) |> Display
let xs = [ -10.0 .. 0.1 .. 10.0 ]
let data = xs |> List.map (fun x -> (x, sin(x)))
Chart.Line(data) |> Display
Util.Math "f(x) = sin(x)" |> Display
let linspace (min : float, max : float, dx : float) =
if min > max then failwith (sprintf "min [%f] cannot be greater than max [%f]" min max)
if dx = 0.0 then failwith ("dx cannot be zero")
let x = ref min
seq {
while !x < max do
x := !x + dx
yield !x
}
let plot (data:seq<float>, cb) =
let results =
seq {
for x in data do
yield (x, cb(x))
}
Chart.Line (results)
let x = linspace (-10.0, 10.0, 0.1)
plot(x, fun y -> sin(2.0*y)) |> Display
Util.Math "f(x) = sin(x)" |> Display
$ E[x] = \int_0^{\infty} x \cdot f(x) dx$
open Euler
Euler.FactorInteger(23423423455234L)
input.fsx(1,6): error FS0039: The namespace or module 'Euler' is not defined
(** This actually does animation when running *)
open System.Threading
for i in 1 .. 100 do
Clear() |> ignore
let x = linspace(-10.0 + float(i), float(i), 0.1) |> Seq.toArray
let c1 = plot(x, sin)
let c2 = plot(x, cos)
Chart.Combine([c1; c2])
|> Chart.WithSize(640, 480)
|> Display
|> ignore
Thread.Sleep(20)
type Person =
{ Name : string
Age : int
City : string }
let people =
[{Name="Tom"; Age=10; City="Dallas"}
{Name="Dick"; Age=20; City="Fargo"}
{Name="Harry"; Age=30; City="Boston"}]
Util.Table(people) |> Display
Name | Age | City |
---|---|---|
Tom | 10 | Dallas |
Dick | 20 | Fargo |
Harry | 30 | Boston |