Programming Fundamentals. Lesson 20 Sections


 Asher Higgins
 2 years ago
 Views:
Transcription
1 Programming Fundamentals Lesson 20 Sections
2 Today, we will Study sections, in Haskell. Sections are another class of expressions that represent functions. A section is a binary operation where one of the operands is missing. It represents the unary function in which the missing operand is the argument, so to speak For example, the section (>=10) represents the function (\x > x >= 10) 23Jan11 Programming Fundamentals  20 Pedro Guerreiro 2
3 Section examples Let s try some sections at the console: Main> (++ " do algarve") "universidade" "universidade do algarve" Main> (++ " do algarve") "orquestra" "orquestra do algarve" Main> ("grande " ++) "carro" "grande carro" Main> ("grande " ++) "festa" "grande festa" Main> (`mod` 100) Main> (100 `mod`) 32 4 Main> (100 `mod`) Main> (`min` 20) Main> (`min` 20) Main> (/2) Main> (2/) Main> (+1) Main> (<= 20) 20.3 False Main> (*10) Main> (10^) Main> (^10) Main> (1/) Jan11 Programming Fundamentals  20 Pedro Guerreiro 3
4 Section examples Sections, as lambda expressions, are typically used as arguments to higher order functions: Hugs> map (+1) [5,8,2] [6,9,3] Hugs> map (*2) [5,8,2] [10,16,4] Hugs> map (`min` 20) [19.1, 20.4, 21.4, 16.9, 17.7] [19.1,20.0,20.0,16.9,17.7] Hugs> map (++ ", algarve") ["faro", "tavira", "silves"] ["faro, algarve","tavira, algarve","silves, algarve"] Hugs> filter (<=10) [5,8,12,5,23,44,7,9] [5,8,5,7,9] Hugs> filter (/= 0) [0,3,0,1,1,2] [3,1,1,2] Hugs> map (2^) [0..10] [1,2,4,8,16,32,64,128,256,512,1024] Hugs> map (1/) (map (2^) [0..10]) [1.0,0.5,0.25,0.125,0.0625, , , , , , ] Hugs> until (<0.001) (/2) Jan11 Programming Fundamentals  20 Pedro Guerreiro 4
5 Quicksort with sections Using sections, we can further simplify quicksort: qsort :: Ord a => [a] > [a] qsort [] = [] qsort (x : xs) = qsort (filter (<= x) xs) ++ [x] ++ qsort (filter (> x) xs) This is the standard version of quicksort in Haskell. Remember it, when you have to program quicksort in other languages, in the future. 23Jan11 Programming Fundamentals  20 Pedro Guerreiro 5
6 More exemplary functions The most significant digit: front :: Int > Int front = until (<10) (`div` 10) The last element: lastelem :: [a] > a This function is defined by a function expression. Main> front Main> lastelem [1..512] 512 lastelem = head. until (null. tail) tail 23Jan11 Programming Fundamentals  20 Pedro Guerreiro 6
7 Functions with multiple arguments Indeed, a function signature such as f :: a > b > c must be read as f :: a > (b > c). Thus, f :: a > b > c really means that f is a function with an argument of type a and a result of type (b > c). But (b > c) is the type of functions with an argument of type b and result of type c. This implies that, in this case, an expression f x, where x is an expression of type a, represents a function from b to c. We conclude that f is a function with one argument and a function result, and not a function with two arguments. 23Jan11 Programming Fundamentals  20 Pedro Guerreiro 7
8 Examples of function calls with missing arguments Note that the missing argument must be the last. Function calls with missing arguments are expressions that represent functions, and can be used as arguments to higher order functions, just like sections: Hugs> filter (elem 'a') ["faro", "aveiro", "porto"] ["faro","aveiro"] Main> map (take 2) ["faro", "aveiro", "porto"] ["fa","av","po"] Main> map (div 100) (map (^2) [1..10]) [100,25,11,6,4,2,2,1,1,1] map (max 10) [6,9,12,3,45,8] [10,10,12,10,45,10] Main> map (zip [ ]) ["lisboa", "porto"] [[(1,'l'),(2,'i'),(3,'s'),(4,'b'),(5,'o'),(6,'a')],[ (1,'p'),(2,'o'),(3,'r'),(4,'t'),(5,'o')]] 23Jan11 Programming Fundamentals  20 Pedro Guerreiro 8
9 IsVowel A function to check whether a char is a owercase vowel: isvowel :: Char > Bool  isvowel x = elem x "aeiou"  isvowel x = flip elem "aeiou" x  isvowel x = ((flip elem) "aeiou") x isvowel = flip elem "aeiou" Main> isvowel 's' False Main> isvowel 'o' True Main> filter isvowel "portalegre" "oaee" Main> filter (not. isvowel) "portalegre" "prtlgr" Main> filter (not. flip elem "aeiou") "portalegre" 23Jan11 Programming Fundamentals  20 Pedro Guerreiro 9 "prtlgr" flip' :: (a > b > c) > (b > a > c) flip' f x y = f y x
10 Exercises Program a function to remove all vowels from a string. Consider the following two functions: f :: Integral a => (a, Int) > (a, Int) f (x, y) = (div x 10, y+1) d :: Integral a => a > Int d x = snd (until ((==0).fst) f (x, 0)) What does function d compute? Program a function compute the length of a list, based on the idea embodied by functions d and f above. 23Jan11 Programming Fundamentals  20 Pedro Guerreiro 10
11 Control How many arguments does a Haskell function have? What is a section? What does flip (/) mean? What does a function call with a missing last argument represent? 23Jan11 Programming Fundamentals  20 Pedro Guerreiro 11
12 Tomorrow We will study folds, a group of important higher order functions. 23Jan11 Programming Fundamentals  20 Pedro Guerreiro 12
LESSON 1, ACTIVITY 5: SHORT VOWELS FOR A
LESSON 1, ACTIVITY 5: SHORT VOWELS FOR A CHAPTER 13 LESSON 1, ACTIVITY 5: LONG VOWELS FOR A LESSON 2, ACTIVITY 5: SHORT VOWELS FOR E LESSON 2, ACTIVITY 5: LONG VOWELS FOR E LESSON 3, ACTIVITY 5: SHORT
More informationInf1A: Deterministic Finite State Machines
Lecture 2 InfA: Deterministic Finite State Machines 2. Introduction In this lecture we will focus a little more on deterministic Finite State Machines. Also, we will be mostly concerned with Finite State
More information+ addition  subtraction and unary minus * multiplication / division mod modulo
Chapter 4 Basic types We examine in this chapter the Caml basic types. 4.1 Numbers Caml Light provides two numeric types: integers (type int) and floatingpoint numbers (type float). Integers are limited
More informationHaskell Answers 5: map and filter
Haskell Answers 5: map and filter Antoni Diller 4 August 2011 (1) The type String is the same as [Char]. Define a function capitalises, of type String String, which takes a list of characters as its argument
More informationThe countdown problem
JFP 12 (6): 609 616, November 2002. c 2002 Cambridge University Press DOI: 10.1017/S0956796801004300 Printed in the United Kingdom 609 F U N C T I O N A L P E A R L The countdown problem GRAHAM HUTTON
More informationOn every sheet please give your first name, last name, and matriculation number.
RHEINISCH WESTFÄLISCHE TECHNISCHE HOCHSCHULE AACHEN LEHR UND FORSCHUNGSGEBIET INFORMATIK 2 RWTH Aachen D52056 Aachen GERMANY http://verify.rwthaachen.de/ LuFG Informatik II Functional Programming Exam,
More informationProgramming in Haskell Homework Assignment 2
UNIZG FER, 2013/2014 Handed out: October 25, 2013. Due: October 31, 2013 at 17:00 Note: Define each function with the exact name and the type specified. You can (and in most cases you should) define each
More informationIntroduction to Python
Caltech/LEAD Summer 2012 Computer Science Lecture 2: July 10, 2012 Introduction to Python The Python shell Outline Python as a calculator Arithmetic expressions Operator precedence Variables and assignment
More informationSoftware Development Phases
Software Development Phases Specification of the task Design of a solution Implementation of solution Analysis of solution Testing and debugging Maintenance and evolution of the system Obsolescence Specification
More informationSOLUTION Trial Test Grammar & Parsing Deficiency Course for the Master in Software Technology Programme Utrecht University
SOLUTION Trial Test Grammar & Parsing Deficiency Course for the Master in Software Technology Programme Utrecht University Year 2004/2005 1. (a) LM is a language that consists of sentences of L continued
More informationCSc 372. Comparative Programming Languages. 21 : Haskell Accumulative Recursion. Department of Computer Science University of Arizona
1/18 CSc 372 Comparative Programming Languages 21 : Haskell Accumulative Recursion Department of Computer Science University of Arizona collberg@gmail.com Copyright c 2013 Christian Collberg 2/18 Stack
More informationChapter 2: Elements of Java
Chapter 2: Elements of Java Basic components of a Java program Primitive data types Arithmetic expressions Type casting. The String type (introduction) Basic I/O statements Importing packages. 1 Introduction
More informationGroup number 24 Joni Saarinen Daniel Kullberg
C# Group number 24 Joni Saarinen Daniel Kullberg C# (pronounced C sharp) is a multi paradigm programming language developed by Microsoft. It is primarily an imperative language but support for functional
More informationFunctional Programming
FP 2005 1.1 3 Functional Programming WOLFRAM KAHL kahl@mcmaster.ca Department of Computing and Software McMaster University FP 2005 1.2 4 What Kinds of Programming Languages are There? Imperative telling
More informationA First Book of C++ Chapter 2 Data Types, Declarations, and Displays
A First Book of C++ Chapter 2 Data Types, Declarations, and Displays Objectives In this chapter, you will learn about: Data Types Arithmetic Operators Variables and Declarations Common Programming Errors
More informationSearching and Sorting Arrays
L E S S O N S E T 8 Searching and Sorting Arrays PURPOSE PROCEDURE 1. To introduce the concept of a search routine 2. To introduce the linear and binary searches 3. To introduce the concept of a sorting
More informationTable 3.1: Arithmetic operators
26 Chapter 3 Arithmetic Expressions Java programs can solve mathematical problems. Often programs that appear nonmathematical on the surface perform a large number of mathematical calculations behind the
More informationIntroduction to Programming (in C++) Data types and visibility. Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. Computer Science, UPC
Introduction to Programming (in C++) Data types and visibility Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. Computer Science, UPC Outline Data types Type conversion Visibility Introduction to
More informationAssignment #2: Part I:
Assignment #2: To complete this assignment, you will email the following files to the TA prior to the deadline. You may work in pairs. We recommend each member of the pair attempt the theory questions
More informationMAT71506 Program Verication: Exercises
MAT71506 Program Verication: Exercises Antero Kangas Tampere University of Technology Department of Mathematics September 11, 2014 Accomplishment Exercises are obligatory and probably the grades will
More informationExcel Lesson 5 Using Functions
Excel Lesson 5 Using Functions Microsoft Office 2007: Introductory t 1 Objectives Identify the parts of a function. Enter formulas with functions. Use functions to solve mathematical problems. Use functions
More informationIntroduction to String Manipulation
Introduction to Computer Programming Introduction to String Manipulation CSCIUA.0002005 What is a String? A String is a data type in the Python programming language A String can be described as a "sequence
More informationMonads for functional programming
Monads for functional programming Philip Wadler, University of Glasgow Department of Computing Science, University of Glasgow, G12 8QQ, Scotland (wadler@dcs.glasgow.ac.uk) Abstract. The use of monads to
More informationInduction and Recursion
Induction and Recursion Jan van Eijck June 3, 2003 Abstract A very important proof method that is not covered by the recipes from Chapter 3 is the method of proof by Mathematical Induction. Roughly speaking,
More informationCSE115 / CSE503 Introduction to Computer Science I. Dr. Carl Alphonce 343 Davis Hall Office hours:
CSE115 / CSE503 Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall alphonce@buffalo.edu Office hours: Thursday 12:00 PM 2:00 PM Friday 8:30 AM 10:30 AM OR request appointment via email
More informationMLR Institute of Technology
MLR Institute of Technology DUNDIGAL 500 043, HYDERABAD COMPUTER SCIENCE AND ENGINEERING Computer Programming Lab List of Experiments S.No. Program Category List of Programs 1 Operators a) Write a C program
More informationIllustration 1: Diagram of program function and data flow
The contract called for creation of a random access database of plumbing shops within the near perimeter of FIU Engineering school. The database features a rating number from 110 to offer a guideline
More informationArithmetic operators Bitstring Operators BitShift Operators Selection Operators
10  APPENDIX CoDeSys supports all IEC operators. In contrast with the standard functions (see appendix D, Standard library), these operators are recognized implicitly throughout the project. Besides the
More informationIntroduction to Programming (in C++) Sorting. Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC
Introduction to Programming (in C++) Sorting Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC Sorting Let elem be a type with a operation, which is a total order A vector
More informationCS 1133, LAB 2: FUNCTIONS AND TESTING http://www.cs.cornell.edu/courses/cs1133/2015fa/labs/lab02.pdf
CS 1133, LAB 2: FUNCTIONS AND TESTING http://www.cs.cornell.edu/courses/cs1133/2015fa/labs/lab02.pdf First Name: Last Name: NetID: The purpose of this lab is to help you to better understand functions:
More information9/23/2014. http://jatinga.iitg.ernet.in/~asahu/cs431/
Dr A Sahu Dept of Computer Science & Engeerg IIT Guwahati Admistrative thgs SML stallation and Book ML Motivation ML : Meta Language (Basic Concepts) Expression, Type Consistency, Variable & Environment
More informationPrimitives and Arithmetic
CS106A, Stanford Handout #29 Fall, 200405 Nick Parlante Primitives and Arithmetic Objects vs. Primitives Types in Java are divided into two camps: objects and primitives. Objects are relatively complex
More informationA green tax proposal to address fiscal and environmental issues
1 A green tax proposal to address fiscal and environmental issues Claudia Dias Soares Green Tax Reform Commission Portuguese Catholic University soarescl1@gmail.com GETC 2014, Copenhagen, 25 September
More informationThe Haskell Road to Logic, Math and Programming. Kees Doets and Jan van Eijck
The Haskell Road to Logic, Math and Programming Kees Doets and Jan van Eijck March 4, 2004 Contents Preface v 1 Getting Started 1 1.1 Starting up the Haskell Interpreter................. 2 1.2 Implementing
More informationFunctional Programming. Functional Programming Languages. Chapter 14. Introduction
Functional Programming Languages Chapter 14 Introduction Functional programming paradigm History Features and concepts Examples: Lisp ML 1 2 Functional Programming Functional Programming Languages The
More informationLecture 12: Abstract data types
Lecture 12: Abstract data types Algebras Abstract data types Encapsulation and information hiding Parameterization Algebras Definition Which kinds of data do we want to discuss? What can we do with it?
More informationHabanero Extreme Scale Software Research Project
Habanero Extreme Scale Software Research Project Comp215: Java Method Dispatch Zoran Budimlić (Rice University) Always remember that you are absolutely unique. Just like everyone else.  Margaret Mead
More informationComputer is a binary digital system. Data. Unsigned Integers (cont.) Unsigned Integers. Binary (base two) system: Has two states: 0 and 1
Computer Programming Programming Language Is telling the computer how to do something Wikipedia Definition: Applies specific programming languages to solve specific computational problems with solutions
More informationProgramming Language Rankings. Lecture 15: Type Inference, polymorphism & Type Classes. Top Combined. Tiobe Index. CSC 131! Fall, 2014!
Programming Language Rankings Lecture 15: Type Inference, polymorphism & Type Classes CSC 131 Fall, 2014 Kim Bruce Top Combined Tiobe Index 1. JavaScript (+1) 2. Java (1) 3. PHP 4. C# (+2) 5. Python (1)
More informationFinal Exam Review. CS 1428 Fall Jill Seaman. Final Exam
Final Exam Review CS 1428 Fall 2011 Jill Seaman 1 Final Exam Friday, December 9, 11:00am to 1:30pm Derr 241 (here) Closed book, closed notes, clean desk Comprehensive (covers entire course) 25% of your
More informationCHAPTER 2. Logic. 1. Logic Definitions. Notation: Variables are used to represent propositions. The most common variables used are p, q, and r.
CHAPTER 2 Logic 1. Logic Definitions 1.1. Propositions. Definition 1.1.1. A proposition is a declarative sentence that is either true (denoted either T or 1) or false (denoted either F or 0). Notation:
More informationChapter 2: Problem Solving Using C++
Chapter 2: Problem Solving Using C++ 1 Objectives In this chapter, you will learn about: Modular programs Programming style Data types Arithmetic operations Variables and declaration statements Common
More informationFUNCTIONAL PROGRAMMING
FUNCTIONAL PROGRAMMING Userdefined Data Types Prof. Clarkson Summer 2015 Today s music: Pokémon Theme by Jason Paige Review Yesterday: New idioms and library functions: Map, fold, and other higherorder
More informationName: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.
Name: Class: Date: Exam #1  Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to
More informationBinary Search Trees. Yes! So, a binary tree T is a binary search tree if T is a single node.
Which are Binary Search Trees (BST)? Binary Search Trees So, a binary tree T is a binary search tree if T is a single node. Yes! No! All the values on the left subtree must be less than the value at the
More informationFizzBuzzinHaskell by embeddingadsl
FizzBuzzinHaskell by embeddingadsl Maciej Piróg Leuven Haskell User Group 24 May 2016 Players generally sit in a circle. The player designated to go first says the number 1, and each player thenceforth
More informationOperator Overloading. Lecture 8. Operator Overloading. Running Example: Complex Numbers. Syntax. What can be overloaded. Syntax  First Example
Operator Overloading Lecture 8 Operator Overloading C++ feature that allows implementerdefined classes to specify classspecific function for operators Benefits allows classes to provide natural semantics
More informationOn every sheet please give your first name, last name, and matriculation number.
RHEINISCH WESTFÄLISCHE TECHNISCHE HOCHSCHULE AACHEN LEHR UND FORSCHUNGSGEBIET INFORMATIK 2 RWTH Aachen D52056 Aachen GERMANY http://verify.rwthaachen.de/ LuFG Informatik II Functional Programming Exam,
More informationChapter 15 Functional Programming Languages
Chapter 15 Functional Programming Languages Introduction  The design of the imperative languages is based directly on the von Neumann architecture Efficiency (at least at first) is the primary concern,
More informationPOLYTYPIC PROGRAMMING OR: Programming Language Theory is Helpful
POLYTYPIC PROGRAMMING OR: Programming Language Theory is Helpful RALF HINZE Institute of Information and Computing Sciences Utrecht University Email: ralf@cs.uu.nl Homepage: http://www.cs.uu.nl/~ralf/
More informationDept. of CSE, IIT KGP
Programming in C: Basics CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Types of variable We must declare the
More informationA simple Monadic Parsec based parser in Haskell. Mario Lang Revision: April 10, 2003
A simple Monadic Parsec based parser in Haskell Mario Lang email: mlang@delysid.org Revision: April 10, 2003 1 Abstract This program implements a simple validating parser for a timesheet ASCII file. It
More informationRadix Number Systems. Number Systems. Number Systems 4/26/2010. basic idea of a radix number system how do we count:
Number Systems binary, octal, and hexadecimal numbers why used conversions, including to/from decimal negative binary numbers floating point numbers character codes basic idea of a radix number system
More informationPractice Questions. CS161 Computer Security, Fall 2008
Practice Questions CS161 Computer Security, Fall 2008 Name Email address Score % / 100 % Please do not forget to fill up your name, email in the box in the midterm exam you can skip this here. These practice
More informationThey are the standard IO channels: std_in is usually connected to the keyboard, and printing onto std_out and std_err usually appears on the screen.
Chapter 9 Basic input/output We describe in this chapter the Caml Light input/output model and some of its primitive operations. More complete information about IO can be found in the Caml Light manual
More informationPrimitive Data Types Summer 2010 Margaret ReidMiller
Primitive Data Types 15110 Summer 2010 Margaret ReidMiller Data Types Data stored in memory is a string of bits (0 or 1). What does 1000010 mean? 66? 'B'? 9.2E44? How the computer interprets the string
More informationLecture 5: MIPS Examples
Lecture 5: MIPS Examples Today s topics: the compilation process full example sort in C Reminder: 2 nd assignment will be posted later today 1 Dealing with Characters Instructions are also provided to
More informationCS 2112 Spring 2014. 0 Instructions. Assignment 3 Data Structures and Web Filtering. 0.1 Grading. 0.2 Partners. 0.3 Restrictions
CS 2112 Spring 2014 Assignment 3 Data Structures and Web Filtering Due: March 4, 2014 11:59 PM Implementing spam blacklists and web filters requires matching candidate domain names and URLs very rapidly
More informationSYSTEMS PROGRAMMING C++ INTRODUCTION
Faculty of Computer Science / Institute of Systems Architecture / Operating Systems SYSTEMS PROGRAMMING C++ INTRODUCTION Alexander Warg WHY C++? C++ is the language that allows to express ideas from the
More informationThe IC Language Specification. Spring 2006 Cornell University
The IC Language Specification Spring 2006 Cornell University The IC language is a simple objectoriented language that we will use in the CS413 project. The goal is to build a complete optimizing compiler
More informationProgramming Languages in Artificial Intelligence
Programming Languages in Artificial Intelligence Günter Neumann, German Research Center for Artificial Intelligence (LT Lab, DFKI) I. AI programming languages II. Functional programming III. Functional
More informationActivity 2: Arithmetic
Activity 2: Arithmetic Now that you ve written a few programs, let s take a step back and discuss how to do basic arithmetic. But first, there s something important to know about why you re working in
More informationHomework #3 is due Friday by 5pm. Homework #4 will be posted to the class website later this week. It will be due Friday, March 7 th, at 5pm.
Homework #3 is due Friday by 5pm. Homework #4 will be posted to the class website later this week. It will be due Friday, March 7 th, at 5pm. Political Science 15 Lecture 12: Hypothesis Testing Sampling
More information22C:19 Discrete Math. So. What is it? Why discrete math? Fall 2009 Hantao Zhang
22C:19 Discrete Math Fall 2009 Hantao Zhang So. What is it? Discrete mathematics is the study of mathematical structures that are fundamentally discrete, in the sense of not supporting or requiring the
More informationChapter 5 Parser Combinators
Part II Chapter 5 Parser Combinators 5.1 The type of parsers 5.2 Elementary parsers 5.3 Grammars 5.4 Parser combinators 5.5 Parser transformers 5.6 Matching parentheses 5.7 More parser combinators 5.8
More informationGJC Web Design Virtuemart 2.0 Radius Shipping Plugin
GJC Web Design Virtuemart 2.0 Radius Shipping Plugin This is the VirtueMart 2.0 Radius Shipping Plugin that fully integrates and shows real time shipping quotes based on the distance from the vendor's
More informationpvalues and significance levels (false positive or false alarm rates)
pvalues and significance levels (false positive or false alarm rates) Let's say 123 people in the class toss a coin. Call it "Coin A." There are 65 heads. Then they toss another coin. Call it "Coin B."
More informationType Classes with Functional Dependencies
Appears in Proceedings of the 9th European Symposium on Programming, ESOP 2000, Berlin, Germany, March 2000, SpringerVerlag LNCS 1782. Type Classes with Functional Dependencies Mark P. Jones Department
More informationFunctional Programming in C++11
Functional Programming in C++11 science + computing ag ITDienstleistungen und Software für anspruchsvolle Rechnernetze Tübingen München Berlin Düsseldorf An Overview Programming in a functional style
More informationUnit 5: Recursion Part 3. Application of Recursion to Languages. Grammar. Engineering 4892: Data Structures. June 14, 2011
Unit 5: Recursion Part 3 1 Application of Recursion to Languages Engineering 4892: Data Structures 1 Application of Recursion to Linked Lists Faculty of Engineering & Applied Science Memorial University
More informationC++ Programming: From Problem Analysis to Program Design, Fifth Edition. Chapter 2: Basic Elements of C++
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with the basic components of a C++ program,
More informationOperators and Expressions
Chapter 5 Operators and Expressions The purspose of computing is insight, not numbers. Richard Hamming Chapter Objectives ˆ Learn Python s arithmetic, string, relational, logical, bit wise operators ˆ
More informationA) the use of different pens for writing B) learning to write with a pen C) the techniques of writing with the hand using a writing instrument
Level A 1. Your name written in your usual handwriting is called your: A) guarantee B) signature C) handwriting 2. Penmanship is A) the use of different pens for writing B) learning to write with a pen
More informationDatatypegeneric data migrations
Datatypegeneric data migrations IFIP WG 21 meeting #73, Lökeberg, Sweden Andres Löh August 31, 2015 The Haskell Consultants Motivation Datatypes evolve Motivation Datatypes evolve Example: data Person
More informationJava provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups:
JAVA OPERATORS GENERAL Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Arithmetic Operators Relational Operators Bitwise Operators
More informationCOMPUTER SKILLS LESSON 3
COMPUTER SKILLS LESSON 3 Prof. Valeria Cardellini cardellini@ing.uniroma2.it Prof. Emiliano Casalicchio casalicchio@ing.uniroma2.it Computer Skills  Lesson 3  V. Cardellini 2 The professors Valeria Cardellini,
More informationDocumentum Developer Program
Program Enabling Logging in DFC Applications Using the com.documentum.fc.common.dflogger class April 2003 Program 1/5 The Documentum DFC class, DfLogger is available with DFC 5.1 or higher and can only
More informationCommon Errors in C. David Chisnall. February 15, 2011
Common Errors in C David Chisnall February 15, 2011 The C Preprocessor Runs before parsing Allows some metaprogramming Preprocessor Macros Are Not Functions The preprocessor performs token substitution
More information4 Operations On Data
4 Operations On Data 4.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, students should be able to: List the three categories of operations performed on
More informationCSE 326, Data Structures. Sample Final Exam. Problem Max Points Score 1 14 (2x7) 2 18 (3x6) 3 4 4 7 5 9 6 16 7 8 8 4 9 8 10 4 Total 92.
Name: Email ID: CSE 326, Data Structures Section: Sample Final Exam Instructions: The exam is closed book, closed notes. Unless otherwise stated, N denotes the number of elements in the data structure
More informationIntroduction to Java CS 1124, Media Computation November 10, 2008 Steve Harrison
Introduction to Java CS 1124, Media Computation November 10, 2008 Steve Harrison DrJava? DrJava is a free integrated development environment for doing Java programming From Rice University It is written
More informationData Structure. Lecture 3
Data Structure Lecture 3 Data Structure Formally define Data structure as: DS describes not only set of objects but the ways they are related, the set of operations which may be applied to the elements
More informationData Structures  Section AB
CSC212 Data Structures  Section AB Lecture 1: Introduction Instructor: Hao Tang Tao Wang Department of Computer Science City College of New York 1 Course Web Page You can find all the information at ccvcl.org/~tang/cs212.html
More informationSpecial Directions for this Test
1 Spring, 2013 Name: (Please do not write your id number!) COP 4020 Programming Languages I Test on Haskell and Functional Programming Special Directions for this Test This test has 7 questions and pages
More informationHigh level code and machine code
High level code and machine code Teacher s Notes Lesson Plan x Length 60 mins Specification Link 2.1.7/cde Programming languages Learning objective Students should be able to (a) explain the difference
More informationPython Evaluation Rules
Python Evaluation Rules UW CSE 160 http://tinyurl.com/dataprogramming Michael Ernst and Isaac Reynolds mernst@cs.washington.edu August 2, 2016 Contents 1 Introduction 2 1.1 The Structure of a Python Program................................
More informationJava Crash Course Part I
Java Crash Course Part I School of Business and Economics Institute of Information Systems HUBerlin WS 2005 Sebastian Kolbe skolbe@wiwi.huberlin.de Overview (Short) introduction to the environment Linux
More informationBorland C++ Compiler: Operators
Introduction Borland C++ Compiler: Operators An operator is a symbol that specifies which operation to perform in a statement or expression. An operand is one of the inputs of an operator. For example,
More informationComputational Semantics, Type Theory, and Functional Programming
Computational Semantics, Type Theory, and Functional Programming I Converting Montague Grammarians into Programmers Jan van Eijck CWI and ILLC, Amsterdam, UilOTS, Utrecht LOLA7 Tutorial, Pecs August 2002
More informationUsing SQL Server Management Studio
Using SQL Server Management Studio Microsoft SQL Server Management Studio 2005 is a graphical tool for database designer or programmer. With SQL Server Management Studio 2005 you can: Create databases
More informationThe Clean programming language. Group 25, Jingui Li, Daren Tuzi
The Clean programming language Group 25, Jingui Li, Daren Tuzi The Clean programming language Overview The Clean programming language first appeared in 1987 and is still being further developed. It was
More informationDiscrete Maths. Philippa Gardner. These lecture notes are based on previous notes by Iain Phillips.
Discrete Maths Philippa Gardner These lecture notes are based on previous notes by Iain Phillips. This short course introduces some basic concepts in discrete mathematics: sets, relations, and functions.
More informationCreating Database Tables in Microsoft SQL Server
Creating Database Tables in Microsoft SQL Server Microsoft SQL Server is a relational database server that stores and retrieves data for multiuser networkbased applications. SQL Server databases are
More informationDecimal and Fraction Review Sheet
Decimal and Fraction Review Sheet Decimals Addition To add 2 decimals, such as 3.25946 and 3.514253 we write them one over the other with the decimal point lined up like this 3.25946 +3.514253 If one
More information1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal:
Exercises 1  number representations Questions 1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal: (a) 3012 (b)  435 2. For each of
More informationClasses and Structs in C++ Based on materials by Bjarne Stroustrup
Classes and Structs in C++ Based on materials by Bjarne Stroustrup www.stroustrup.com/programming Overview Classes Implementation and interface Constructors Member functions Enumerations Operator overloading
More informationTesting and Tracing Lazy Functional Programs using QuickCheck and Hat
Testing and Tracing Lazy Functional Programs using QuickCheck and Hat Koen Claessen 1, Colin Runciman 2, Olaf Chitil 2, John Hughes 1, and Malcolm Wallace 2 1 Chalmers University of Technology, Sweden
More informationQt Signals and Slots. Olivier Goffart. October 2013
Qt Signals and Slots Olivier Goffart October 2013 About Me About Me QStyleSheetStyle Itemviews Animation Framework QtScript (porting to JSC and V8) QObject, moc QML Debugger Modularisation... About Me
More informationRepresentation of Data
Representation of Data In contrast with higherlevel programming languages, C does not provide strong abstractions for representing data. Indeed, while languages like Racket has a rich notion of data type
More information