Danh mục tài liệu

Lecture F# - ĐH Công nghiệp TP. HCM

Số trang: 107      Loại file: pptx      Dung lượng: 1.67 MB      Lượt xem: 16      Lượt tải: 0    
Xem trước 10 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Lecture F# include the contents: Functional programming; imperative irogramming; Object – Oriented Programming; organizing, annotating, and quoting; F# libraries; user interfaces; data access; threadings. Inviting you to refer.
Nội dung trích xuất từ tài liệu:
Lecture F# - ĐH Công nghiệp TP. HCMHO CHI MINH UNIVERSITY OF INDUSTRY 1 HO CHI MINH UNIVERSITY OF INDUSTRY ExerciseEX1: Re work all examples in this Slide About 50 examples codeEX2: Make Project Student Manager by FPEX3: Make Project Libraries Manager by FP 2 HO CHI MINH UNIVERSITY OF INDUSTRY 1. Introduction2. Functional Programming3. Imperative Programming4. Object – Oriented Programming5. Organizing, Annotating, and Quoting 6. F# Libraries 7. User Interfaces 8. Data Access 9. Threadings 3 HO CHI MINH UNIVERSITY OF INDUSTRY1. IntroductionØ What is Functional Programming?Ø What is Functional Programming Important Ø What is F#?Ø How to Obtain, Install, and use F# 4 HO CHI MINH UNIVERSITY OF INDUSTRYØ What is Functional Programming? - FP views all programs as collections of functions that accept arguments and return values. - FP allows no side effects and uses recursion instead of loops for iteration. - FP like mathematical functions because they do not change the state of the program. once a value is assigned to an identifier, it never changes, functions do not alter parameter values, and the results that functions return are completely new values 5 HO CHI MINH UNIVERSITY OF INDUSTRYØ What is Functional Programming Important? - Providing more performance and correctness for less effort - FP allows you to treat functions themselves as values and pass them to other functions - Eliminating the distinction between data and function - FP can be shorter and more modular than corresponding imperative and OO programs - A function might return multiple values 6 HO CHI MINH UNIVERSITY OF INDUSTRYØ What is F#? - F# is a general- purpose programming language for .NET that smoothly integrates all three major programming - The paradigms best approach to solving many thorny computing problems - F# is strongly typed but also uses inferred typing 7 HO CHI MINH UNIVERSITY OF INDUSTRYØ How to Obtain, Install, and use F# F# is now included in Visual Studio 2010 http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/release.aspx How to install F# on both Windows and Linux? see pages 8-10 in the Beginning F#toebookHow use?Extension: .fs and use fsc.exe to compile 3 Different ways to write code:- Use Visual Studio- Use SharpDevelop- Use F# Interact Command Line 8 HO CHI MINH UNIVERSITY OF INDUSTRYØ How to Obtain, Install, and use F# Example fsc.exe compile .fs to .exe Open notepad and then write: printfn Hello World  save as to e:hello.fs Need to set Environment Variables to run fsc.exe see demo 9 HO CHI MINH UNIVERSITY OF INDUSTRYØ How to Obtain, Install, and use F# - Use Visual Studio 10 HO CHI MINH UNIVERSITY OF INDUSTRYØ How to Obtain, Install, and use F# - Use SharpDevelop SharpDevelop 4.2 http://www.icsharpcode.net/opensource/sd/download/ 11 HO CHI MINH UNIVERSITY OF INDUSTRYØ How to Obtain, Install, and use F# - Use F# Interact Command Line Run fsi.exe in bin folder 12 HO CHI MINH UNIVERSITY OF INDUSTRY2. Functional Programming Ø LiteralsØ Identifiers, Operators and let, use bindings Ø Functions - Recursion Ø Pattern Matching Ø Control Flow Ø Lists and Options Value Ø Type and Type Inference Ø Lazy EvaluationØ ...