(* Features of F# to talk about *) open System; Console.WriteLine("hello");; // .net interop // binding to vars: let x = 1; // immutable let f y = x+y // function def // note type inference let g() = let x = 2 Console.WriteLine((f 10)); g();; // 11 if statically scoped. // currying/uncurrying let f x y = x+y let g(x,y) = x+y // what's the difference? printf "%d %d" 3 (g(4,5)) // there's a syntax error // mutables and assignment, and conventional loops let mutable y = 0; while y<10 do printf "%d\n" y y <- y+1;; /// // more agreesive type inference let I = fun x -> x let K = fun x y -> x let S = fun x y z -> x z (y z);; // what are the types of these "combinators?" // type hints are needed only in cases where multiple types are inferred. let f(x:float,y:float) = x+y;; // using the |> syntax (not deep here) // pattern matching