introduction to f# 3cgi.di.uoa.gr/~izambo/fsharp-intromar2014.pdf · some history • (1970) ml by...
TRANSCRIPT
![Page 1: Introduction to F# 3cgi.di.uoa.gr/~izambo/fsharp-introMar2014.pdf · Some history • (1970) ML by Robin Milner, University of Edinburgh • Hindley–Milner type inference algorithm](https://reader036.vdocuments.us/reader036/viewer/2022063006/5fb67ac3aed47a02a71ecb03/html5/thumbnails/1.jpg)
Introduction to F# 3.020/3/2014
Aggelos BiboudisProgramming Languages Researcher
University of Athenswww.di.uoa.gr/~biboudis
![Page 2: Introduction to F# 3cgi.di.uoa.gr/~izambo/fsharp-introMar2014.pdf · Some history • (1970) ML by Robin Milner, University of Edinburgh • Hindley–Milner type inference algorithm](https://reader036.vdocuments.us/reader036/viewer/2022063006/5fb67ac3aed47a02a71ecb03/html5/thumbnails/2.jpg)
Functional Programming in a slide (not; but a quick enough)
• FP emphasizes application of functions• Functions as in math!
• Avoid State and Mutation• Call the function twice and get the same answer• First class in FP
• Imperative, changes in state• Foundations on lambda calculus • (Alonzo Church in the 1930s’)
• Function definition• Function application• Recursion
![Page 3: Introduction to F# 3cgi.di.uoa.gr/~izambo/fsharp-introMar2014.pdf · Some history • (1970) ML by Robin Milner, University of Edinburgh • Hindley–Milner type inference algorithm](https://reader036.vdocuments.us/reader036/viewer/2022063006/5fb67ac3aed47a02a71ecb03/html5/thumbnails/3.jpg)
()
Fortran 1957, John Backus
Lisp 1958, John McCarthy
![Page 4: Introduction to F# 3cgi.di.uoa.gr/~izambo/fsharp-introMar2014.pdf · Some history • (1970) ML by Robin Milner, University of Edinburgh • Hindley–Milner type inference algorithm](https://reader036.vdocuments.us/reader036/viewer/2022063006/5fb67ac3aed47a02a71ecb03/html5/thumbnails/4.jpg)
Some history• (1970) ML by Robin Milner, University of Edinburgh
• Hindley–Milner type inference algorithm• Simply typed polymorphic lambda calculus
• ML → StandardML → Caml → OCaml unifying functional, OOP and imperative
• (2005) F# by Don Syme, Microsoft Research• F# is essentially a .NET adaptation of OCaml
bringing the power of FP to .NET
![Page 5: Introduction to F# 3cgi.di.uoa.gr/~izambo/fsharp-introMar2014.pdf · Some history • (1970) ML by Robin Milner, University of Edinburgh • Hindley–Milner type inference algorithm](https://reader036.vdocuments.us/reader036/viewer/2022063006/5fb67ac3aed47a02a71ecb03/html5/thumbnails/5.jpg)
Imperative, OOP, Functional
![Page 6: Introduction to F# 3cgi.di.uoa.gr/~izambo/fsharp-introMar2014.pdf · Some history • (1970) ML by Robin Milner, University of Edinburgh • Hindley–Milner type inference algorithm](https://reader036.vdocuments.us/reader036/viewer/2022063006/5fb67ac3aed47a02a71ecb03/html5/thumbnails/6.jpg)
…and why it matters
Hughes, John. "Why functional programming matters." The computer journal 32.2 (1989): 98-107.
![Page 7: Introduction to F# 3cgi.di.uoa.gr/~izambo/fsharp-introMar2014.pdf · Some history • (1970) ML by Robin Milner, University of Edinburgh • Hindley–Milner type inference algorithm](https://reader036.vdocuments.us/reader036/viewer/2022063006/5fb67ac3aed47a02a71ecb03/html5/thumbnails/7.jpg)
F# is...
... a programming language.
![Page 8: Introduction to F# 3cgi.di.uoa.gr/~izambo/fsharp-introMar2014.pdf · Some history • (1970) ML by Robin Milner, University of Edinburgh • Hindley–Milner type inference algorithm](https://reader036.vdocuments.us/reader036/viewer/2022063006/5fb67ac3aed47a02a71ecb03/html5/thumbnails/8.jpg)
F# is...
...a functional programming language
![Page 9: Introduction to F# 3cgi.di.uoa.gr/~izambo/fsharp-introMar2014.pdf · Some history • (1970) ML by Robin Milner, University of Edinburgh • Hindley–Milner type inference algorithm](https://reader036.vdocuments.us/reader036/viewer/2022063006/5fb67ac3aed47a02a71ecb03/html5/thumbnails/9.jpg)
F# is...
... a functional programming language for .NET.
![Page 10: Introduction to F# 3cgi.di.uoa.gr/~izambo/fsharp-introMar2014.pdf · Some history • (1970) ML by Robin Milner, University of Edinburgh • Hindley–Milner type inference algorithm](https://reader036.vdocuments.us/reader036/viewer/2022063006/5fb67ac3aed47a02a71ecb03/html5/thumbnails/10.jpg)
F# is...
...a functional and object oriented programming language for .NET
![Page 11: Introduction to F# 3cgi.di.uoa.gr/~izambo/fsharp-introMar2014.pdf · Some history • (1970) ML by Robin Milner, University of Edinburgh • Hindley–Milner type inference algorithm](https://reader036.vdocuments.us/reader036/viewer/2022063006/5fb67ac3aed47a02a71ecb03/html5/thumbnails/11.jpg)
F# is...
...a functional, object oriented and imperative programming language
for .NET
![Page 12: Introduction to F# 3cgi.di.uoa.gr/~izambo/fsharp-introMar2014.pdf · Some history • (1970) ML by Robin Milner, University of Edinburgh • Hindley–Milner type inference algorithm](https://reader036.vdocuments.us/reader036/viewer/2022063006/5fb67ac3aed47a02a71ecb03/html5/thumbnails/12.jpg)
F# is...
...a functional, object oriented, imperative
and explorative programming language for .NET
![Page 13: Introduction to F# 3cgi.di.uoa.gr/~izambo/fsharp-introMar2014.pdf · Some history • (1970) ML by Robin Milner, University of Edinburgh • Hindley–Milner type inference algorithm](https://reader036.vdocuments.us/reader036/viewer/2022063006/5fb67ac3aed47a02a71ecb03/html5/thumbnails/13.jpg)
F# is...
...a multi-paradigm programming language for .NET
![Page 14: Introduction to F# 3cgi.di.uoa.gr/~izambo/fsharp-introMar2014.pdf · Some history • (1970) ML by Robin Milner, University of Edinburgh • Hindley–Milner type inference algorithm](https://reader036.vdocuments.us/reader036/viewer/2022063006/5fb67ac3aed47a02a71ecb03/html5/thumbnails/14.jpg)
An open source compiler
![Page 15: Introduction to F# 3cgi.di.uoa.gr/~izambo/fsharp-introMar2014.pdf · Some history • (1970) ML by Robin Milner, University of Edinburgh • Hindley–Milner type inference algorithm](https://reader036.vdocuments.us/reader036/viewer/2022063006/5fb67ac3aed47a02a71ecb03/html5/thumbnails/15.jpg)
Development Environments
![Page 16: Introduction to F# 3cgi.di.uoa.gr/~izambo/fsharp-introMar2014.pdf · Some history • (1970) ML by Robin Milner, University of Edinburgh • Hindley–Milner type inference algorithm](https://reader036.vdocuments.us/reader036/viewer/2022063006/5fb67ac3aed47a02a71ecb03/html5/thumbnails/16.jpg)
Getting F#
• F# on Mac• F# on Linux• F# on Windows• F# on Android• F# on iOS• F# on GPU• F# on FreeBSD
![Page 17: Introduction to F# 3cgi.di.uoa.gr/~izambo/fsharp-introMar2014.pdf · Some history • (1970) ML by Robin Milner, University of Edinburgh • Hindley–Milner type inference algorithm](https://reader036.vdocuments.us/reader036/viewer/2022063006/5fb67ac3aed47a02a71ecb03/html5/thumbnails/17.jpg)
Books• About F#
• Real-World Functional Programming• Beginning F#• Programming F#• F# For Scientists• Visual F# 2010 for Technical Computing• Professional F# 2.0• Expert F# 3.0
• And more general about programming languages through F#• Programming Language Concepts
![Page 18: Introduction to F# 3cgi.di.uoa.gr/~izambo/fsharp-introMar2014.pdf · Some history • (1970) ML by Robin Milner, University of Edinburgh • Hindley–Milner type inference algorithm](https://reader036.vdocuments.us/reader036/viewer/2022063006/5fb67ac3aed47a02a71ecb03/html5/thumbnails/18.jpg)
Links
• On the Web• http://fsharp.org/ • http://fsharp.github.com/ • http://fsharp.net/ (Visual Studio edition)• http://fsharp.github.com/fsharp (Open Source edition)• http://research.microsoft.com/fsharp • http://www.tryfsharp.org/ • Don Syme - http://blogs.msdn.com/dsyme • http://code.msdn.microsoft.com/fsharpsamples• http://blogs.msdn.com/b/timng/archive/2010/04/05/f-obje
ct-oriented-programming-quick-guide.aspx?wa=wsignin1.0
![Page 19: Introduction to F# 3cgi.di.uoa.gr/~izambo/fsharp-introMar2014.pdf · Some history • (1970) ML by Robin Milner, University of Edinburgh • Hindley–Milner type inference algorithm](https://reader036.vdocuments.us/reader036/viewer/2022063006/5fb67ac3aed47a02a71ecb03/html5/thumbnails/19.jpg)
Links• Community
• F# open source list• News from F# blogs• GitHub and CodePlex projects• F# code snippets• Ask on StackOverflow• Join Twitter conversations (#fsharp)• F# on IRC• Athens F# User Group
![Page 20: Introduction to F# 3cgi.di.uoa.gr/~izambo/fsharp-introMar2014.pdf · Some history • (1970) ML by Robin Milner, University of Edinburgh • Hindley–Milner type inference algorithm](https://reader036.vdocuments.us/reader036/viewer/2022063006/5fb67ac3aed47a02a71ecb03/html5/thumbnails/20.jpg)
The language designer to thank for F#
• Don Syme• Academic info
![Page 21: Introduction to F# 3cgi.di.uoa.gr/~izambo/fsharp-introMar2014.pdf · Some history • (1970) ML by Robin Milner, University of Edinburgh • Hindley–Milner type inference algorithm](https://reader036.vdocuments.us/reader036/viewer/2022063006/5fb67ac3aed47a02a71ecb03/html5/thumbnails/21.jpg)
Just show me the gist*
F# interactive action, driven by Expert F# 2.0;;
* https://gist.github.com/biboudis/9653956
![Page 22: Introduction to F# 3cgi.di.uoa.gr/~izambo/fsharp-introMar2014.pdf · Some history • (1970) ML by Robin Milner, University of Edinburgh • Hindley–Milner type inference algorithm](https://reader036.vdocuments.us/reader036/viewer/2022063006/5fb67ac3aed47a02a71ecb03/html5/thumbnails/22.jpg)
FIN |> not ;;