-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.fs
More file actions
68 lines (41 loc) · 1.56 KB
/
Program.fs
File metadata and controls
68 lines (41 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Learn more about F# at http://fsharp.org
open System
open System.Threading.Tasks
// simple types in one line
type Person = {First:string; Last:string}
// simple type
type Peppo = { Name:string; Age:int }
type SuperPeppo = Ceppa of Peppo | SuperCeppa of SuperPeppo list
// single line comment
(* multi line comment *)
let var1 = 0
let va2 = 1.2
let val3 = "ghjklòà"
let aList = [2;3;4;5]
let oneToFive = 1 :: aList // insert 1 to new created list -> list.insert(0,...aList)
let zeroToFive = [0;1] @ aList // the at operator concatenate two lists -> [0,1].concat(aList)
[<EntryPoint>]
let main argv =
printfn "print string %s" "Test"
List.iter (printfn "%d") zeroToFive
List.iter (printfn "1 to 5 -> %d") oneToFive
// let person1 = {First="john"; Last="Doe"}
// let person2 = {First="john"; Last="Doe"}
// printfn "Equal? %A" (person1 = person2)
// let jd = { Name= "Suka"; Age=12}
// jd.Age |> printfn "Age is %d"
// printfn "Age of Jd is %s" ( jd.Age.ToString() )
// let makeNewString str =
// let newString = str + " new!"
// newString
// printfn "Appended: %s" ( makeNewString "azzo" )
// let a = async { printfn "ghjkl" }
// Async.Start a
// let wk = Ceppa jd
// let addT = (+) 2 >> (*) 3
// printfn "Result %d" ( addT 5 )
// let square x = x * x
// let sq = square 10
// sq |> printfn "Sqaure is %d"
// [1..10] |> List.sum |> printfn "sum=%d"
0 // return an integer exit code