1: let x = 5
2:
int = 5
4:
5: open System.Net
6: open System.IO
7:
//method
string) =
10: let req = WebRequest.Create(url)
11: let resp = req.GetResponse()
12: let stream = resp.GetResponseStream()
new StreamReader(stream)
14: reader.ReadToEnd()
15:
//method type
string
18:
20:
22:
// |> operator
|> http
25:
//string list
]
28:
]
30:
//map method
32: let contents = sites |> List.map http
33:
//list
]
//array
|]
//option
39: Some(4,5,6)
40: None
//seq
42: seq{1..100}
int> = seq[1;2;3;4;..]
44: seq{1..5..100}
in 1 to 100 -> i*i}
//tuple
,5)
48:
//rec function
50: let rec length l =
51: match l with
52: | [] -> 0
53: | h :: t -> 1 + length t
54:
//pattern match
56: match aList with
57: |[] -> 0
58: |h :: t -> 1 + length t
59:
60: match aOption with
a b
63:
//function value
65: List.map (fun x -> x*x - 5) [5;6;7;8]