COMPSCI 1JC3 Study Guide - Summer 2018, Comprehensive Midterm Notes - Programming Language, Haskell Invitational Stakes, Recursion

177 views15 pages
COMPSCI 1JC3
MIDTERM EXAM
STUDY GUIDE
Fall 2018
Unlock document

This preview shows pages 1-3 of the document.
Unlock all 15 pages and 3 million more documents.

Already have an account? Log in
Unlock document

This preview shows pages 1-3 of the document.
Unlock all 15 pages and 3 million more documents.

Already have an account? Log in
01 What is Functional Programming?
William M. Farmer
Department of Computing and Software
McMaster University
September 11, 2017
Admin
Discussion sessions start this week (chapter 1 of CT).
M&Ms start this week.
First programming assignment will be posted this Friday, September 15, and will due on Friday, September 29.
Computers and Programs
What do computers do?
Store and manipulate information.
What determines the behavior of a computer?
A sequence of statements called a program.
Why are computers so useful?
1. 1. Hardware enables massive amounts of data to be stored and manipulated with great speed and accuracy.
1. 2. Software provides the means to control the behavior of the hardware with extraordinary power and exibility.
Programs and Programming
A programming language is a formal language for writing programs.
An imperative statement expresses an action to be performed, while a declarative statement expresses a
property to be employed.
An imperative program is a sequence of imperative statements that expresses how the program will work.
A declarative program is a sequence of declarative statements that expresses what the program will achieve.
A programming paradigm is a well-developed style of programming.
Each programming language supports one or more programming paradigms.
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows pages 1-3 of the document.
Unlock all 15 pages and 3 million more documents.

Already have an account? Log in
Major Programming Paradigms
1. 1. Procedural. Programs are imperative; a program is a collection of procedures possibly having side e ects.
Examples: Fortran, COBOL, C, BASIC, Pascal, Ada.
1. 2. Object Oriented. Programs are imperative; a program behaves as a collection of interacting objects.
Examples: Smalltalk, C++, Java, C#, Python.
1. 3. Functional. Programs are mostly declarative; a program is a collection of side-e ect free function de nitions.
Examples: Lisp family, ML family, Haskell.
1. 4. Logical. Programs are mostly declarative; a program is a collection of logical statements.
Example: Prolog.
Modes of Program Execution
1. The program can be interpreted directly line by line.
I Advantage: Supports interactive development and debugging of code.
I Disadvantage: Interpreting code is generally slower than executing compiled code.
1. 2. The program can be compiled into native machine code.
I Advantage: The machine code is optimized to run fast.
I Disadvantage: Code development is more di cult.
Haskell programs can be executed by both modes!
Values
Values are the information (called data) stored and manipulated by computer programs.
Examples:
I Booleans that represent the truth values true and false.
I Machine integers that represent small integers.
I Floating point numbers that represent rational numbers in scienti c notation.
I Strings that represent sequences of characters.
I Tuples that represent sequences of values of di erent kinds.
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows pages 1-3 of the document.
Unlock all 15 pages and 3 million more documents.

Already have an account? Log in

Document Summary

Discussion sessions start this week (chapter 1 of ct). First programming assignment will be posted this friday, september 15, and will due on friday, september 29. Hardware enables massive amounts of data to be stored and manipulated with great speed and accuracy. Software provides the means to control the behavior of the hardware with extraordinary power and exibility. A programming language is a formal language for writing programs. An imperative statement expresses an action to be performed, while a declarative statement expresses a property to be employed. An imperative program is a sequence of imperative statements that expresses how the program will work. A declarative program is a sequence of declarative statements that expresses what the program will achieve. A programming paradigm is a well-developed style of programming. Each programming language supports one or more programming paradigms. Programs are imperative; a program is a collection of procedures possibly having side e ects. Examples: fortran, cobol, c, basic, pascal, ada: 2.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers