ITT8060 Advanced Programming

Similar documents
02157 Functional Programming Lecture 1: Introduction and Getting Started

Introduction to SML Getting Started

COS 326 Functional programming: an elegant weapon for the modern age

Functional Programming

02157 Functional Programming. Michael R. Ha. Lecture 1: Introduction and Getting Started. Michael R. Hansen

Scope and Introduction to Functional Languages. Review and Finish Scoping. Announcements. Assignment 3 due Thu at 11:55pm. Website has SML resources

Functional Programming

3. Functional Programming. Oscar Nierstrasz

COS 326 Func,onal Programming: An elegant weapon for the modern age David Walker Princeton University

Functional Programming. Big Picture. Design of Programming Languages

Anders Møller Michael Schwartzbach Erik Ernst Hans Hüttel

Recursion. Lecture 6: More Lambda Calculus Programming. Fixed Points. Recursion

CIS24 Project #3. Student Name: Chun Chung Cheung Course Section: SA Date: 4/28/2003 Professor: Kopec. Subject: Functional Programming Language (ML)

CSC 326H1F, Fall Programming Languages. What languages do you know? Instructor: Ali Juma. A survey of counted loops: FORTRAN

Type Inference. Prof. Clarkson Fall Today s music: Cool, Calm, and Collected by The Rolling Stones

CMSC 330: Organization of Programming Languages. Functional Programming with OCaml

Functional Languages. Hwansoo Han

COSE212: Programming Languages. Lecture 0 Course Overview

Introduction to ML. Based on materials by Vitaly Shmatikov. General-purpose, non-c-like, non-oo language. Related languages: Haskell, Ocaml, F#,

CSCI.4430/6969 Programming Languages Lecture Notes

Chapter 11 :: Functional Languages

Functional Programming Lecture 1: Introduction

Lecture 13 CIS 341: COMPILERS

CSCI-GA Scripting Languages

Programming Language Pragmatics

Welcome to. Instructor Marc Pomplun CS 470/670. Introduction to Artificial Intelligence 1/26/2016. Spring Selectivity in Complex Scenes

Com S 541. Programming Languages I

CSCE 314 TAMU Fall CSCE 314: Programming Languages Dr. Flemming Andersen. Haskell Basics

CS383 PROGRAMMING LANGUAGES. Kenny Q. Zhu Dept. of Computer Science Shanghai Jiao Tong University

Introduction, Functions

Functional Languages. CSE 307 Principles of Programming Languages Stony Brook University

IA010: Principles of Programming Languages

8/27/17. CS-3304 Introduction. What will you learn? Semester Outline. Websites INTRODUCTION TO PROGRAMMING LANGUAGES

Comp 333: Concepts of Programming Languages Fall 2016

The design of a programming language for provably correct programs: success and failure

CMSC 330: Organization of Programming Languages. Lambda Calculus

CSc 372. Comparative Programming Languages. 2 : Functional Programming. Department of Computer Science University of Arizona

Introduction. chapter Functions

Thinking differently. This chapter covers

CMSC 330: Organization of Programming Languages. Lambda Calculus

Programming Language Concepts, cs2104 Lecture 01 ( )

Welcome to CS 135 (Winter 2018)

CS 3110 Lecture 1 Course Overview

Programming Languages and Compilers (CS 421)

! Broaden your language horizons! Different programming languages! Different language features and tradeoffs. ! Study how languages are implemented

CMSC 330: Organization of Programming Languages

SOFTWARE ARCHITECTURE 6. LISP

What is programming? Elements of Programming Languages. From machine code to programming languages. What is a programming language?

Topic I. Introduction and motivation References: Chapter 1 of Concepts in programming languages by J. C. Mitchell. CUP, 2003.

CS 3304 Comparative Languages. Lecture 1: Introduction

Programming Language Concepts

CMSC330. Objects, Functional Programming, and lambda calculus

Programming Languages 2nd edition Tucker and Noonan"

CSCI 3136 Principles of Programming Languages

Introduction to the course and basic programming concepts

CS 242. Fundamentals. Reading: See last slide

General Concepts. Abstraction Computational Paradigms Implementation Application Domains Influence on Success Influences on Design

One of a number of approaches to a mathematical challenge at the time (1930): Constructibility

Introduction to ML. Mooly Sagiv. Cornell CS 3110 Data Structures and Functional Programming

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End

Closures. Mooly Sagiv. Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming

CS 565: Programming Languages. Spring 2008 Tu, Th: 16:30-17:45 Room LWSN 1106

Stop coding Pascal. Saturday, April 6, 13

More Lambda Calculus and Intro to Type Systems

LECTURE 1. Overview and History

CSc 372 Comparative Programming Languages

Programming Languages, Summary CSC419; Odelia Schwartz

11/6/17. Outline. FP Foundations, Scheme. Imperative Languages. Functional Programming. Mathematical Foundations. Mathematical Foundations

The Substitution Model

Concepts of Programming Languages

Introduction to Computer Science I

CS 314 Principles of Programming Languages

Recursion. Tjark Weber. Functional Programming 1. Based on notes by Sven-Olof Nyström. Tjark Weber (UU) Recursion 1 / 37

CS 11 Haskell track: lecture 1

FUNKCIONÁLNÍ A LOGICKÉ PROGRAMOVÁNÍ 1. ÚVOD DO PŘEDMĚTU, LAMBDA CALCULUS

J. Barkley Rosser, 81, a professor emeritus of mathematics and computer science at the University of Wisconsin who had served in government, died

F28PL1 Programming Languages. Lecture 11: Standard ML 1

Lecture 5: The Halting Problem. Michael Beeson

Type Systems Winter Semester 2006

15-411/ Compiler Design

CSCE 314 Programming Languages

! Broaden your language horizons. ! Study how languages are implemented. ! Study how languages are described / specified

Programming Systems in Artificial Intelligence Functional Programming

Introduction to ML. Mooly Sagiv. Cornell CS 3110 Data Structures and Functional Programming

Functional Programming and λ Calculus. Amey Karkare Dept of CSE, IIT Kanpur

G Programming Languages - Fall 2012

CMSC 330: Organization of Programming Languages

CIS 500 Software Foundations Fall September 25

Introduction to Prof. Clarkson Fall Today s music: Prelude from Final Fantasy VII by Nobuo Uematsu (remastered by Sean Schafianski)

Welcome to CS 135 (Fall 2018) Themes of the course. Lectures. cs135/

Conclusions and further reading

COP4020 Programming Languages. Functional Programming Prof. Robert van Engelen

Concepts in Programming Languages

Key components of a lang. Deconstructing OCaml. In OCaml. Units of computation. In Java/Python. In OCaml. Units of computation.

CSE505, Fall 2012, Midterm Examination October 30, 2012

Functional Programming Principles in Scala. Martin Odersky

Seminar in Programming Languages

Functional Programming I *** Functional Programming and Interactive Theorem Proving. Ulrich Berger Michaelmas Term 2006

Programming Languages (CSCI 4430/6430) History, Syntax, Semantics, Essentials, Paradigms

Compiling Techniques

Transcription:

ITT8060 Advanced Programming In F# Juhan Ernits

Welcome to Advanced Programming (in F#)! Teachers: Juhan Ernits Hendrik Maarand Course web page http://courses.cs.ttu.ee/pages/itt8060 Contact: juhan.ernits@ttu.ee Forum for Q&A: Details available on the course web page

Textbooks Main textbook Tomas Petricek with Jon Skeet: Real-world functional programming with examples in F# and C# 10 copies at TUT: http://tallinn.ester.ee/record=b2780259~s1*eng Several copies available in Tartu Additional textbook 1 Michael R. Hansen and Hans Rischel: Functional Programming using F# (lots of electronic copies in the library) Additional textbook Don Syme: Expert F# 5 copies at TUT: http://tallinn.ester.ee/record=b2994544~s1*eng Several copies available in Tartu

Structure of the course The course runs for 16 weeks Lectures Room U06A-201, lectures get recorded Lab sessions Rooms Wed 16:00: ICT-401 (SE students only!) Thu 14:00: ICT-401 (everybody else)

Structure of the assessment Coursework 45% of the final mark 9 courseworks, each counting for 5% The coursework should be your own work. You should be able to explain your work to the lab assistant upon request. Your mark will be cancelled if you are not able to explain your own solutions to courseworks. There may be some bonus courseworks available. An in class test in week 9, 5% of the final mark. (Nov 1, 2017) You need to be there to get the 5%! An indication of your progress. Exam 50% of the final mark Written You need to get at least 40% of the points in order to pass. (Strictly enforced)

Advanced Programming (in F#)

You can all write programs! What is your first programming language? Elixir Java C++ C# C Javascript Python PHP Objective C Swift F# Haskell OCaml Scala ML Whitespace Prolog TypeScript

Imperative programming style IEnumerable<string> GetExpensiveProducts() { List<string> filteredinfos = new List<string(); foreach(product product in Products) { if(product.unitprice > 75.00M) { filteredinfos.add(string.format("{0} - ${1}", product.productname, product.unitprice)); } } return filteredinfos; } State changing operations Object oriented approach involves thinking about collections of objects that pass messages

Declarative programming style IEnumerable<string> GetExpensiveProducts() { return from product in Products where product.unitprice > 75.0M select String.Format("{0} - ${1}", product.productname, product.unitprice); }

Declarative programming style IEnumerable<string> GetExpensiveProducts() { return from product in Products where product.unitprice > 75.0M select String.Format("{0} - ${1}", product.productname, product.unitprice); } Declarative style focuses on what a solution is. Some advantages: Fast prototyping based on abstract concepts More advanced applications are within reach Supplement modelling and problem solving techniques Execute in parallel on multi-core platforms

Example: convenient parallelisation var updated = from m in monsters let nm = m.performstep() where nm.isalive select nm; var updated = from m in monsters.asparallel() let nm = m.performstep() where nm.isalive select nm; LINQ PLINQ

C++ STL language tempate<int N> constexpr int fac() { return N*fac<N-1>(); } STL is a Turing complete compile time functional language

C++14 Has functional features like automatic type inference, e.g.: auto lambda = [](auto x, auto y) {return x + y;};

Course goals To give a generalised perspective to programming. To give an understanding how to think and program functionally and achieve new skills for writing well structured code. To identify problems and domains that lend themselves to be thought about in functional ways. Functional techniques are now commonplace in mainstream programming languages.

Course goals cont. To show that real world business and scientific computing tasks often have a natural functional structure. To show how to test functional programs. To give an overview of various applied techniques, such as asynchronous and parallel programming in the functional context.

A bit of history The model of computation in functional programming is the application of functions to arguments. No side effects Introduction of λ calculus around 1930 by Church and Kleene when investigating function definition, function application, recursion and computable functions. For example, f(x) =x+2 is represented by λ x.x+2

A bit of history cont. Introduction of the type-less functional-like programming: language LISP was developed by McCarthy in the late 1950s.

A bit of history cont. Introduction of the variable-free programming language FP (Backus 1977), by providing a rich collection of functionals (combining forms for functions) Introduction of functional languages with a strong type system like ML (by Milner) and Miranda (by Turner) in the 1970s.

Some background of the SML family Standard Meta Language (SML) was originally designed for theorem proving Logic for Computable Functions (Edinburgh LCF) Gordon, Milner, Wadsworth (1977) High quality compilers, e.g. Standard ML of New Jersey and Moscow ML based on a formal semantics Milner, Tofte, Harper, MacQueen 1990 & 1997

Some background of the SML family SML-like systems (SML, OCAML, F#,...) have now applications far away from its origins Compilers, Artificial Intelligence, Web-applications, Financial sector, ios application development Android application development F# is a.net language: https://blogs.msdn.microsoft.com/dotnet/2017/02/01/the-netlanguage-strategy/ Declarative aspects are sneaking into more main stream languages Often used to teach high-level programming concepts

Quick F# tutorial