Programming Fundamentals. Lesson 20 Sections

Size: px
Start display at page:

Download "Programming Fundamentals. Lesson 20 Sections"

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) 23-Jan-11 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/) Jan-11 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) Jan-11 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. 23-Jan-11 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 23-Jan-11 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. 23-Jan-11 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')]] 23-Jan-11 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" 23-Jan-11 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. 23-Jan-11 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? 23-Jan-11 Programming Fundamentals - 20 Pedro Guerreiro 11

12 Tomorrow We will study folds, a group of important higher order functions. 23-Jan-11 Programming Fundamentals - 20 Pedro Guerreiro 12

The countdown problem

The 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 information

Introduction to Python

Introduction 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 information

Software Development Phases

Software 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 information

SOLUTION 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 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 information

CSc 372. Comparative Programming Languages. 21 : Haskell Accumulative Recursion. Department of Computer Science University of Arizona

CSc 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 information

Chapter 2: Elements of Java

Chapter 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 information

Functional Programming

Functional 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 information

MAT-71506 Program Verication: Exercises

MAT-71506 Program Verication: Exercises MAT-71506 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 information

Monads for functional programming

Monads 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 information

MLR Institute of Technology

MLR 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 information

Illustration 1: Diagram of program function and data flow

Illustration 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 1-10 to offer a guideline

More information

9/23/2014. http://jatinga.iitg.ernet.in/~asahu/cs431/

9/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 information

Introduction 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 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 information

Habanero Extreme Scale Software Research Project

Habanero 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 information

A green tax proposal to address fiscal and environmental issues

A 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 information

Lecture 12: Abstract data types

Lecture 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 information

Functional Programming. Functional Programming Languages. Chapter 14. Introduction

Functional 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 information

Programming 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. 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 information

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Name: 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 information

Chapter 15 Functional Programming Languages

Chapter 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 information

CHAPTER 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. 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 information

On every sheet please give your first name, last name, and matriculation number.

On 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 D-52056 Aachen GERMANY http://verify.rwth-aachen.de/ LuFG Informatik II Functional Programming Exam,

More information

Operator Overloading. Lecture 8. Operator Overloading. Running Example: Complex Numbers. Syntax. What can be overloaded. Syntax -- First Example

Operator 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 implementer-defined classes to specify class-specific function for operators Benefits allows classes to provide natural semantics

More information

Practice Questions. CS161 Computer Security, Fall 2008

Practice 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 information

POLYTYPIC PROGRAMMING OR: Programming Language Theory is Helpful

POLYTYPIC 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 information

A simple Monadic Parsec based parser in Haskell. Mario Lang Revision: April 10, 2003

A simple Monadic Parsec based parser in Haskell. Mario Lang   Revision: April 10, 2003 A simple Monadic Parsec based parser in Haskell Mario Lang e-mail: mlang@delysid.org Revision: April 10, 2003 1 Abstract This program implements a simple validating parser for a timesheet ASCII file. It

More information

CS 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. 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 information

Programming Languages in Artificial Intelligence

Programming 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 information

CS 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 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 information

Type Classes with Functional Dependencies

Type Classes with Functional Dependencies Appears in Proceedings of the 9th European Symposium on Programming, ESOP 2000, Berlin, Germany, March 2000, Springer-Verlag LNCS 1782. Type Classes with Functional Dependencies Mark P. Jones Department

More information

Chapter 5 Parser Combinators

Chapter 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 information

GJC Web Design Virtuemart 2.0 Radius Shipping Plugin

GJC 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 information

Functional Programming in C++11

Functional Programming in C++11 Functional Programming in C++11 science + computing ag IT-Dienstleistungen und Software für anspruchsvolle Rechnernetze Tübingen München Berlin Düsseldorf An Overview Programming in a functional style

More information

p-values and significance levels (false positive or false alarm rates)

p-values and significance levels (false positive or false alarm rates) p-values 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 information

FUNCTIONAL PROGRAMMING

FUNCTIONAL PROGRAMMING FUNCTIONAL PROGRAMMING User-defined 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 higher-order

More information

Datatype-generic data migrations

Datatype-generic data migrations Datatype-generic 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 information

Documentum Developer Program

Documentum 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 information

4 Operations On Data

4 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 information

COMPUTER SKILLS LESSON 3

COMPUTER 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 information

A) 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

A) 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 information

Special Directions for this Test

Special 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 information

Using SQL Server Management Studio

Using 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 information

Java Crash Course Part I

Java Crash Course Part I Java Crash Course Part I School of Business and Economics Institute of Information Systems HU-Berlin WS 2005 Sebastian Kolbe skolbe@wiwi.hu-berlin.de Overview (Short) introduction to the environment Linux

More information

CSE 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.

CSE 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 information

Computational Semantics, Type Theory, and Functional Programming

Computational 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, Uil-OTS, Utrecht LOLA7 Tutorial, Pecs August 2002

More information

The Clean programming language. Group 25, Jingui Li, Daren Tuzi

The 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 information

High level code and machine code

High 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 information

[MD5 Message Digests] derived from the RSA Data Security, Inc. MD5 Message Digest Algorithm

[MD5 Message Digests] derived from the RSA Data Security, Inc. MD5 Message Digest Algorithm [MD5 Message Digests] derived from the RSA Data Security, Inc. MD5 Message Digest Algorithm [RegExp] Copyright (c) 1986, 1993, 1995 by University of Toronto. Written by Henry Spencer. THIS IS AN ALTERED

More information

Creating Database Tables in Microsoft SQL Server

Creating 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 multi-user network-based applications. SQL Server databases are

More information

Cours 1c: Introduction a Gama

Cours 1c: Introduction a Gama Cours 1c: Introduction a Gama tiré de la GAMA Winter School Nov. 2012, Can Tho University / IRD Alexis Drogoul (a, d), Benoit Gaudou (b), Patrick Taillandier (c) Philippe Caillou (e), Arnaud Grignard (a),

More information

Dependent Types at Work

Dependent Types at Work Dependent Types at Work Ana Bove and Peter Dybjer Chalmers University of Technology, Göteborg, Sweden {bove,peterd}@chalmers.se Abstract. In these lecture notes we give an introduction to functional programming

More information

Discrete 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. 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 information

Qt Signals and Slots. Olivier Goffart. October 2013

Qt 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 information

Testing and Tracing Lazy Functional Programs using QuickCheck and Hat

Testing 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 information

Adjusted/Modified by Nicole Tobias. Chapter 2: Basic Elements of C++

Adjusted/Modified by Nicole Tobias. Chapter 2: Basic Elements of C++ Adjusted/Modified by Nicole Tobias Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types

More information

JAVA - QUICK GUIDE. Java SE is freely available from the link Download Java. So you download a version based on your operating system.

JAVA - QUICK GUIDE. Java SE is freely available from the link Download Java. So you download a version based on your operating system. http://www.tutorialspoint.com/java/java_quick_guide.htm JAVA - QUICK GUIDE Copyright tutorialspoint.com What is Java? Java is: Object Oriented Platform independent: Simple Secure Architectural- neutral

More information

Boolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority)

Boolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority) Boolean Expressions, Conditions, Loops, and Enumerations Relational Operators == // true if two values are equivalent!= // true if two values are not equivalent < // true if left value is less than the

More information

1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal:

1. 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 information

Java Interview Questions and Answers

Java Interview Questions and Answers 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write and compile the java

More information

Helmut Seidl. Virtual Machines. München. Summer 2011

Helmut Seidl. Virtual Machines. München. Summer 2011 Helmut Seidl Virtual Machines München Summer 2011 1 0 Introduction Principle of Interpretation: Program + Input Interpreter Output Advantage: No precomputation on the program text startup-time == no/short

More information

OBJECT ORIENTED PROGRAMMING IN C++

OBJECT ORIENTED PROGRAMMING IN C++ OBJECT ORIENTED PROGRAMMING IN C++ For Off Campus BSc Computer Science Programme UNIT 1 1. The goal of programmers is to develop software that are. A. Correct B. Reliable and maintainable C. Satisfy all

More information

Binary Search Trees. A Generic Tree. Binary Trees. Nodes in a binary search tree ( B-S-T) are of the form. P parent. Key. Satellite data L R

Binary Search Trees. A Generic Tree. Binary Trees. Nodes in a binary search tree ( B-S-T) are of the form. P parent. Key. Satellite data L R Binary Search Trees A Generic Tree Nodes in a binary search tree ( B-S-T) are of the form P parent Key A Satellite data L R B C D E F G H I J The B-S-T has a root node which is the only node whose parent

More information

Google s MapReduce Programming Model Revisited

Google s MapReduce Programming Model Revisited Google s MapReduce Programming Model Revisited Ralf Lämmel Data Programmability Team Microsoft Corp. Redmond, WA, USA Abstract Google s MapReduce programming model serves for processing large data sets

More information

Fun with Phantom Types

Fun with Phantom Types 1 Fun with Phantom Types RALF HINZE Institut für Informatik III, Universität Bonn Römerstraße 164, 53117 Bonn, Germany Email: ralf@informatik.uni-bonn.de Homepage: http://www.informatik.uni-bonn.de/~ralf

More information

SEF s Mission. SEF Portuguese Immigration and Borders Service

SEF s Mission. SEF Portuguese Immigration and Borders Service SEF s Mission SEF Portuguese Immigration and Borders Service To execute the immigration and asylum policy in Portugal, according to the provisions of the Constitution and the law and government guidelines.

More information

Improving type-error messages in functional languages

Improving type-error messages in functional languages Improving type-error messages in Bastiaan Heeren Universiteit Utrecht January 5, 200 Contents Introduction Constraints Type inference rules Solving constraints Solving inconsistencies Future work Conclusion

More information

Describing, manipulating and pricing financial contracts: The MLFi language

Describing, manipulating and pricing financial contracts: The MLFi language Describing, manipulating and pricing financial contracts: The MLFi language Centre for Financial Research, Judge Institute of Management Cambridge, 14 March 2003 (revised January 2005) Jean-Marc Eber LexiFi,

More information

Compositional hardware virtualization. Raphael kena Poss University of Amsterdam January 11th, 2014

Compositional hardware virtualization. Raphael kena Poss University of Amsterdam January 11th, 2014 Compositional hardware virtualization Raphael kena Poss University of Amsterdam January 11th, 2014 Context Programming is a human activity More and people need to program There are programming problems

More information

Integer Set Library: Manual

Integer Set Library: Manual Integer Set Library: Manual Version: isl-0.15 Sven Verdoolaege June 11, 2015 Contents 1 User Manual 3 1.1 Introduction............................... 3 1.1.1 Backward Incompatible Changes...............

More information

Variables, Constants, and Data Types

Variables, Constants, and Data Types Variables, Constants, and Data Types Primitive Data Types Variables, Initialization, and Assignment Constants Characters Strings Reading for this class: L&L, 2.1-2.3, App C 1 Primitive Data There are eight

More information

Data Management Applications with Drupal as Your Framework

Data Management Applications with Drupal as Your Framework Data Management Applications with Drupal as Your Framework John Romine UC Irvine, School of Engineering UCCSC, IR37, August 2013 jromine@uci.edu What is Drupal? Open-source content management system PHP,

More information

String Search. Brute force Rabin-Karp Knuth-Morris-Pratt Right-Left scan

String Search. Brute force Rabin-Karp Knuth-Morris-Pratt Right-Left scan String Search Brute force Rabin-Karp Knuth-Morris-Pratt Right-Left scan String Searching Text with N characters Pattern with M characters match existence: any occurence of pattern in text? enumerate: how

More information

Analyse et Conception Formelle. Lesson 5. Crash Course on Scala

Analyse et Conception Formelle. Lesson 5. Crash Course on Scala Analyse et Conception Formelle Lesson 5 Crash Course on Scala T. Genet (ISTIC/IRISA) ACF-5 1 / 36 Bibliography Simply Scala. Online tutorial: http://www.simply.com/fr http://www.simply.com/ Programming

More information

A Grammar for the C- Programming Language (Version S16) March 12, 2016

A Grammar for the C- Programming Language (Version S16) March 12, 2016 A Grammar for the C- Programming Language (Version S16) 1 Introduction March 12, 2016 This is a grammar for this semester s C- programming language. This language is very similar to C and has a lot of

More information

APPLICATIONS OF THE ORDER FUNCTION

APPLICATIONS OF THE ORDER FUNCTION APPLICATIONS OF THE ORDER FUNCTION LECTURE NOTES: MATH 432, CSUSM, SPRING 2009. PROF. WAYNE AITKEN In this lecture we will explore several applications of order functions including formulas for GCDs and

More information

B.Sc (Honours) - Software Development

B.Sc (Honours) - Software Development Galway-Mayo Institute of Technology B.Sc (Honours) - Software Development E-Commerce Development Technologies II Lab Session Using the Java URLConnection Class The purpose of this lab session is to: (i)

More information

Questions 1 through 25 are worth 2 points each. Choose one best answer for each.

Questions 1 through 25 are worth 2 points each. Choose one best answer for each. Questions 1 through 25 are worth 2 points each. Choose one best answer for each. 1. For the singly linked list implementation of the queue, where are the enqueues and dequeues performed? c a. Enqueue in

More information

Python Evaluation Rules

Python 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 information

Classes and Objects in Java Constructors. In creating objects of the type Fraction, we have used statements similar to the following:

Classes and Objects in Java Constructors. In creating objects of the type Fraction, we have used statements similar to the following: In creating objects of the type, we have used statements similar to the following: f = new (); The parentheses in the expression () makes it look like a method, yet we never created such a method in our

More information

U-HID Pac-LED64 PacDrive U-HID LEDs

U-HID Pac-LED64 PacDrive U-HID LEDs Pac-LED64 PacDrive U-HID LEDs Software Development Kit 1. Introduction... 3 2. Common Functions (all boards)... 4 int PacSetCallbacks((void)(int id) attach, (void)(int id) remove)... 4 int PacInitialize()...

More information

Lecture 18-19 Data Types and Types of a Language

Lecture 18-19 Data Types and Types of a Language Lecture 18-19 Data Types and Types of a Language April 29, 2014 Data Types and Types of a Language Data, Data Types and Types Type: Generalities Type Systems and Type Safety Type Equivalence, Coercion

More information

NP-Completeness I. Lecture 19. 19.1 Overview. 19.2 Introduction: Reduction and Expressiveness

NP-Completeness I. Lecture 19. 19.1 Overview. 19.2 Introduction: Reduction and Expressiveness Lecture 19 NP-Completeness I 19.1 Overview In the past few lectures we have looked at increasingly more expressive problems that we were able to solve using efficient algorithms. In this lecture we introduce

More information

Braindumps.C2150-810.50 questions

Braindumps.C2150-810.50 questions Braindumps.C2150-810.50 questions Number: C2150-810 Passing Score: 800 Time Limit: 120 min File Version: 5.3 http://www.gratisexam.com/ -810 IBM Security AppScan Source Edition Implementation This is the

More information

Big Data & Scripting storage networks and distributed file systems

Big Data & Scripting storage networks and distributed file systems Big Data & Scripting storage networks and distributed file systems 1, 2, in the remainder we use networks of computing nodes to enable computations on even larger datasets for a computation, each node

More information

9.1 Hypothesis Testing

9.1 Hypothesis Testing 9.1 Hypothesis Testing Define: 1. Null Hypothesis 2. Alternative Hypothesis Null Hypothesis: H 0, statement that the population proportion, or population mean is EQUAL TO a number population proportion

More information

ASCII Encoding. The char Type. Manipulating Characters. Manipulating Characters

ASCII Encoding. The char Type. Manipulating Characters. Manipulating Characters The char Type ASCII Encoding The C char type stores small integers. It is usually 8 bits. char variables guaranteed to be able to hold integers 0.. +127. char variables mostly used to store characters

More information

The following themes form the major topics of this chapter: The terms and concepts related to trees (Section 5.2).

The following themes form the major topics of this chapter: The terms and concepts related to trees (Section 5.2). CHAPTER 5 The Tree Data Model There are many situations in which information has a hierarchical or nested structure like that found in family trees or organization charts. The abstraction that models hierarchical

More information

Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void

Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void 1. Explain C tokens Tokens are basic building blocks of a C program. A token is the smallest element of a C program that is meaningful to the compiler. The C compiler recognizes the following kinds of

More information

Introduction FUNCTIONAL PROGRAMMING. The Problem. The Solution. Graham Hutton. Lecture 9 - Interactive Programs. keyboard. screen

Introduction FUNCTIONAL PROGRAMMING. The Problem. The Solution. Graham Hutton. Lecture 9 - Interactive Programs. keyboard. screen FUNCTIONAL PROGRAMMING Introduction To date, we have seen how Haskell can be used to write batch programs that take all their inputs at the start and give all their outputs at the end. Graham Hutton inputs

More information

Data Structure and Algorithm I Midterm Examination 120 points Time: 9:10am-12:10pm (180 minutes), Friday, November 12, 2010

Data Structure and Algorithm I Midterm Examination 120 points Time: 9:10am-12:10pm (180 minutes), Friday, November 12, 2010 Data Structure and Algorithm I Midterm Examination 120 points Time: 9:10am-12:10pm (180 minutes), Friday, November 12, 2010 Problem 1. In each of the following question, please specify if the statement

More information

Selection Statements

Selection Statements Chapter 5 Selection Statements 1 Statements So far, we ve used return statements and expression ess statements. e ts. Most of C s remaining statements fall into three categories: Selection statements:

More information

Compiling CAO: from Cryptographic Specifications to C Implementations

Compiling CAO: from Cryptographic Specifications to C Implementations Compiling CAO: from Cryptographic Specifications to C Implementations Manuel Barbosa David Castro Paulo Silva HASLab/INESC TEC Universidade do Minho Braga, Portugal April 8, 2014 Grenoble Motivation Developing

More information

3.GETTING STARTED WITH ORACLE8i

3.GETTING STARTED WITH ORACLE8i Oracle For Beginners Page : 1 3.GETTING STARTED WITH ORACLE8i Creating a table Datatypes Displaying table definition using DESCRIBE Inserting rows into a table Selecting rows from a table Editing SQL buffer

More information

SQL Server An Overview

SQL Server An Overview SQL Server An Overview SQL Server Microsoft SQL Server is designed to work effectively in a number of environments: As a two-tier or multi-tier client/server database system As a desktop database system

More information

Practical Generic Programming with OCaml

Practical Generic Programming with OCaml Practical Generic Programming with OCaml Jeremy Yallop LFCS, University of Edinburgh ML Workshop 2007 Instead of this... type α tree = Node of α Branch of (α tree) (α tree) val show_tree : (α string) (α

More information

TypeScript for C# developers. Making JavaScript manageable

TypeScript for C# developers. Making JavaScript manageable TypeScript for C# developers Making JavaScript manageable Agenda What is TypeScript OO in TypeScript Closure Generics Iterators Asynchronous programming Modularisation Debugging TypeScript 2 What is TypeScript

More information

Objective-C Tutorial

Objective-C Tutorial Objective-C Tutorial OBJECTIVE-C TUTORIAL Simply Easy Learning by tutorialspoint.com tutorialspoint.com i ABOUT THE TUTORIAL Objective-c tutorial Objective-C is a general-purpose, object-oriented programming

More information

Member Functions of the istream Class

Member Functions of the istream Class Member Functions of the istream Class The extraction operator is of limited use because it always uses whitespace to delimit its reads of the input stream. It cannot be used to read those whitespace characters,

More information