Functional Programming & Proofs
Introduction (3): Tuples and Unions
- Product types (tuples)
let pos = (1.0,2.0);; // pos: float * float = (1.0, 2.0)
let right (x,y) = (x+1.0,y);;
right pos;;
With Pattern Matching:
let right p =
match p with
| (x,y) -> (x+1.0,y);;
With types alias
type Pos = float*float;;
type Action = Pos->Pos;;
let pos:Pos = (1.0,2.0);;
let right : Action = fun (x,y) -> (x+1.0,y);;
6 - 8
docteur dr laurent thiry uha mulhouse france functional programming fsharp proof theory coq coqide
docteur dr laurent thiry uha mulhouse france functional programming fsharp proof theory coq coqide
docteur dr laurent thiry uha mulhouse france functional programming fsharp proof theory coq coqide
docteur dr laurent thiry uha mulhouse france functional programming fsharp proof theory coq coqide
docteur dr laurent thiry uha mulhouse france functional programming fsharp proof theory coq coqide
docteur dr laurent thiry uha mulhouse france functional programming fsharp proof theory coq coqide
docteur dr laurent thiry uha mulhouse france functional programming fsharp proof theory coq coqide
docteur dr laurent thiry uha mulhouse france functional programming fsharp proof theory coq coqide
docteur dr laurent thiry uha mulhouse france functional programming fsharp proof theory coq coqide
docteur dr laurent thiry uha mulhouse france functional programming fsharp proof theory coq coqide
docteur dr laurent thiry uha mulhouse france functional programming fsharp proof theory coq coqide