Programming Languages

Slides:



Advertisements
Similar presentations
MATH 224 – Discrete Mathematics
Advertisements

One Dimensional Arrays
CS107 Introduction to Computer Science Lecture 3, 4 An Introduction to Algorithms: Loops.
CS107 Introduction to Computer Science Lecture 2.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part3: Verilog – Part 1.
1 Programming Languages and Paradigms Lisp Programming.
CS 355 – PROGRAMMING LANGUAGES Dr. X. Apply-to-all A functional form that takes a single function as a parameter and yields a list of values obtained.
Computer Science in Practice This course is an introduction to problems (and solutions) that arise in applied fields of computer science such as machine.
Program Design and Development
Chapter 2 The Algorithmic Foundations of Computer Science
Functional programming: LISP Originally developed for symbolic computing First interactive, interpreted language Dynamic typing: values have types, variables.
Programming Languages Meeting 13 December 2/3, 2014.
Implementing RSA Encryption in Java
CS 2430 Day 1. Agenda Load NetBeans Introduction Syllabus Review some array operations.
TDDD55- Compilers and Interpreters Lesson 1 Zeinab Ganjei Department of Computer and Information Science Linköping University.
Lecture 4: Calculating by Iterating. The while Repetition Statement Repetition structure Programmer specifies an action to be repeated while some condition.
Math 15 Introduction to Scientific Data Analysis Lecture 9 Python Programming – #3 University of California, Merced.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Algorithm Discovery and Design Objectives: Interpret pseudocode Write pseudocode, using the three types of operations: * sequential (steps in order written)
Computability Go over homework problems. Godel numbering. Homework: prepare for midterm.
Boolean expressions, part 1: Compare operators. Compare operators Compare operators compare 2 numerical values and return a Boolean (logical) value A.
Invitation to Computer Science 5 th Edition Chapter 2 The Algorithmic Foundations of Computer Science.
Lecture 15: Course Review BJ Furman ME 30 16MAY2011.
Language Find the latest version of this document at
1 FP Foundations, Scheme In Text: Chapter Chapter 14: FP Foundations, Scheme Mathematical Functions Def: A mathematical function is a mapping of.
Sum of Arithmetic Sequences. Definitions Sequence Series.
CS 100Lecture 231 CS100J Lecture 23 n Previous Lecture –MatLab and its implementation, continued. n This Lecture –MatLab demonstration.
1 Functions Function Prototype float sqrt(float x); Function name, type, parameter and parameter type Function Definition float sqrt(float x) { // compute.
Programming Languages Meeting 12 November 18/19, 2014.
Lecture 3: More Java Basics Michael Hsu CSULA. Recall From Lecture Two  Write a basic program in Java  The process of writing, compiling, and running.
1 COMS 261 Computer Science I Title: C++ Fundamentals Date: September 23, 2005 Lecture Number: 11.
PROGRAMMING: What’s It All About?
Functional Programming
UMBC CMSC 104 – Section 01, Fall 2016
DDC 2423 DATA STRUCTURE Main text:
Expressions and Assignment
CSC 221: Computer Programming I Spring 2010
Niu Kun Discrete Mathematics Chapter 1 The Foundations: Logic and Proof, Sets, and Functions Niu Kun 离散数学.
CSC 221: Computer Programming I Fall 2005
CS 326 Programming Languages, Concepts and Implementation
A lightening tour in 45 minutes
Lecture 37: A Universal Computer
Closures and Streams cs784(Prasad) L11Clos
TMC 1414 Introduction to Programming
Lesson 9: "if-else-if" and Conditional Logic
Mini Language Interpreter Programming Languages (CS 550)
File Handling Programming Guides.
Midterm Review In Text: Chapters 1-3, 5-7, 15, 16.
CDA 3100 Summer 2013.
The Metacircular Evaluator
FP Foundations, Scheme In Text: Chapter 14.
Functional Programming
Rosen 5th ed., §2.1 ~31 slides, ~1 lecture
Midterm Review In Text: Chapters 1-3, 5-9, 15.
Midterm Review In Text: Chapters 1-3, 5-10, 15.
CS 201 Fundamental Structures of Computer Science
Algorithm and Ambiguity
Rosen 5th ed., §2.1 ~31 slides, ~1 lecture
Statement-Level Control Structures
Class 4: Repetition Pretest Posttest Counting Flowchart these!
Vocabulary Algorithm - A precise sequence of instructions for processes that can be executed by a computer Low level programming language: A programming.
This Lecture Substitution model
In this class, we will cover:
Midterm Review In Text: Chapters 1-3, 5-9, 15.
Midterm Review In Text: Chapters 1-3, 5-11, 15.
CS100A Lecture 21 Previous Lecture This Lecture
CSCE 206 Lab Structured Programming in C
Programming Languages
Programming Languages
Presentation transcript:

Programming Languages Meeting 11 November 15/16, 2016

Short Exam 2

Planning Ahead November 22/23: No formal class meetings. Project 2, Part 1 due by 9:00 pm, November 22. November 29/30: Regular class meeting December 6/7: Regular class meeting. Project 2, Part 2 due by class time. December 14/15: Final Exam

Project 2: A Vector-Matrix System Step 1: Affirm your team members by Thursday, November 17.

Project 2 (2) Step 2: Submit your LISP implementation of nine primitives and six functionals defined in lecture and to be used as the building blocks of the project Attach two text files to an email message to me, the first named primitive.lsp and the second named functional.lsp Due by 9:00 pm, Tuesday, November 22 I will load these files and test them. Remember that the function definitions must use functional principles: no assignment statements, no loops, only cond for the if-then-else structure

Project 2 (3) Step 3: Develop and test the LISP code for the vector and matrix functions as specified in the project handout. Step 4: Submit your LISP code in a file named matrix.lsp which you attach to an email message. The project description lists the other files you need to submit. Due December 6 or 7, 2016 I will load your file and my primitives and functionals and test your functions against a variety of inputs.

Programming in LISP Our approach; our rules No loops No assignment statements No built-in LISP functions other than those used to define the primitives and functionals, and those are used only in those definitions. Hints: Think recursively Think in parallel Think with composition

Defining Functionals Constant Construction Apply-to-all Apply-to-all1 Reduce

Your Turn Example 1: The function IG, which generates a list of the first n positive integers Example 2: A LISP function that computes the sum of the squares of the first n positive integers Example 3: A LISP function that computes the sum of the squares of the first n positive odd integers

Your Turn (2) Example 4: A LISP function that returns the second element of a list, if it exists Example 5: LISP code to implement the function rotate, which rotates a list k positions. For example, (rotate 2 ‘(A B C D)) returns (C D A B)

Your Turn (3) Example 6: LISP code for the function member? which returns true if x is one of the top level elements of the list y and false otherwise.

An Experiment One way of implementing infinite precision integer arithmetic is to represent an integer as a list of digits. For example 20175 is (2 0 1 7 5). Develop a set of LISP functions that performs integer addition when integers are represented this way. Add a set of LISP functions that performs integer multiplication.