Functional Programming & Proofs
back
Other collections with illustration
FP is usefull for Data Processing and F# integrates all fundamental datatypes: sequences, sets, maps, etc.
- Statistics on texts: String
let text = "hello world !";;
let letters = [ 'a' .. 'z' ] @ [ 'A' .. 'Z' ];;
let countL = txt |> Seq.filter (fun l -> l='l') |> Seq.length ;;
let count letter = txt |> Seq.filter (fun l -> l=letter) |> Seq.length ;;
let stats = letters |> List.map (fun l -> (l,count l));;
let simple = stats |> List.filter (fun (l,c) -> c<>0 );;
let sort = simple |> List.sortBy (fun (l,c) -> c);;
- Strings are sequences of characters - thus all the functions on sequences are availables (map, filter, fold, etc.)
- (..) generates a list representing an interval
- filter extract the elements having a property - a property is a function
x->bool
- map apply a function to all the elements of a list
- sortBy uses a ordering relation
x->x->bool
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