CS345 Project Presentation Language: H-- Mikhail Iakhiaev.

Slides:



Advertisements
Similar presentations
Continuation of chapter 6…. Nested while loop A while loop used within another while loop is called nested while loop. Q. An illustration to generate.
Advertisements

Iterations for loop. Outcome Introduction to for loop The use of for loop instead of while loop Nested for loops.
Program Looping EE2372 Software Design I Dr. Gerardo Rosiles.
12-1 Copyright  Oracle Corporation, All rights reserved. What Is a View? EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
Restricting and sorting data 16 May May May Created By Pantharee Sawasdimongkol.
1Eyad Alshareef Enhanced Guide to Oracle 10g Chapter 3: Using SQL Queries to Insert, Update, Delete, and View Data.
Copyright  Oracle Corporation, All rights reserved. 2 Restricting and Sorting Data.
Session 3: SQL (B): Parts 3 & 4 Original materials supplied by the Oracle Academic Initiative (OAI). Edited for classroom use by Professor Laku Chidambaram.
Logical Operators Operator AND OR NOT Meaning Returns TRUE if both component conditions are TRUE Returns TRUE if either component condition is TRUE Returns.
Copyright  Oracle Corporation, All rights reserved. Introduction.
Dr. Philip Cannata 1 Doug Tolbert Unisys Doug Tolbert has been involved with OMG since the early 1990s. He is.
o At the end of this lesson, you will be able to:  Describe the life-cycle development phases  Discuss the theoretical and physical aspects of a relational.
Copyright  Oracle Corporation, All rights reserved. I Introduction.
Slide 1 Vitaly Shmatikov CS 345 Introduction to Scheme.
Copyright  Oracle Corporation, All rights reserved. 1 Writing Basic SQL Statements.
4-1 Copyright  Oracle Corporation, All rights reserved. Displaying Data from Multiple Tables.
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
Dr. Philip Cannata 1 Programming Languages Prolog Part 3 SQL & Prolog.
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Introduction to Relational Databases &
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Cursors These slides are licensed under.
2 Writing Basic SELECT Statements. 1-2 Copyright  Oracle Corporation, All rights reserved. Capabilities of SQL SELECT Statements Selection Projection.
Copyright  Oracle Corporation, All rights reserved. Writing Basic SQL Statements.
Copyright س Oracle Corporation, All rights reserved. I Introduction.
Copyright  Oracle Corporation, All rights reserved. 2 Restricting and Sorting Data.
RELATSIOONILISED ANDMEBAASID(alg) SQLi VÕIMALUSED.
SQL- DQL (Oracle Version). 2 SELECT Statement Syntax SELECT [DISTINCT] column_list FROM table_list [WHERE conditional expression] [GROUP BY column_list]
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Basic SQL These slides are licensed under.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 2: Variables & Data Types.
Session 2: SQL (A): Parts 1 and 2 Original materials supplied by the Oracle Academic Initiative (OAI). Edited for classroom use by Professor Laku Chidambaram.
Dr. Philip Cannata 1 mgr Semantic Data Management.
Copyright س Oracle Corporation, All rights reserved. 4 Displaying Data from Multiple Tables.
1 Writing Basic SQL Statements. 1-2 Objectives At the end of this lesson, you should be able to: List the capabilities of SQL SELECT statements Execute.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
I-1 Copyright س Oracle Corporation, All rights reserved. Data Retrieval.
SQL: Part 2 Original materials supplied by the Oracle Academic Initiative (OAI). Edited for classroom use by Professor Laku Chidambaram. Not for commercial.
Copyright  Oracle Corporation, All rights reserved. 12 Creating Views.
1 Information Retrieval and Use (IRU) An Introduction To SQL Part 2.
User Defined Methods Methods are used to divide complicated programs into manageable pieces. There are predefined methods (methods that are already provided.
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Object-Relational Database Programming.
Dr. Philip Cannata 1 Programming Languages Chapter 19 - Continuations.
Copyright س Oracle Corporation, All rights reserved. I Introduction.
Dr. Philip Cannata 1 Programming Languages Haskell.
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Collection Operators These slides are.
Oracle CONNECT BY function JAVA WEB Programming. Emp 테이블의 내용 ( 상 / 하급자 계층구조 ) SQL> select * from emp; EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
2-1 Limiting Rows Using a Selection “…retrieve all employees in department 10” EMP EMPNO ENAME JOB... DEPTNO 7839KINGPRESIDENT BLAKEMANAGER CLARKMANAGER.
Lecture 2 Functions. Functions in C++ long factorial(int n) The return type is long. That means the function will return a long integer to the calling.
CSED101 INTRODUCTION TO COMPUTING FUNCTION ( 함수 ) 유환조 Hwanjo Yu.
IAP C# 2011 Lecture 2: Delegates, Lambdas, LINQ Geza Kovacs.
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
Expressions Methods if else Statements Loops Potpourri.
Copyright س Oracle Corporation, All rights reserved. 12 Creating Views.
Visitor-Based HMM Israel Perez, Fayz Rahman, Chinedu Egboh.
Copyright  Oracle Corporation, All rights reserved. 2 Restricting and Sorting Data.
Writing Basic SQL Statements. Objectives After completing this lesson, you should be able to do the following: –List the capabilities of SQL SELECT statements.
Copyright  Oracle Corporation, All rights reserved. Introduction.
Displaying Data from Multiple Tables. Objectives After completing this lesson, you should be able to do the following: –Write SELECT statements to access.
4 Displaying Data from Multiple Tables. 4-2 Objectives At the end of this lesson, you should be able to: Write SELECT statements to access data from more.
Copyright س Oracle Corporation, All rights reserved. 1 Writing Basic SQL Statements.
Communicating with a RDBMS Using SQL Database SQL> SELECT loc 2 FROM dept; SQL> SELECT loc 2 FROM dept; SQL statement is entered Statement is sent to database.
CS314 – Section 5 Recitation 9
Relational Normalization Theory
Subqueries.
What Is a View? EMPNO ENAME JOB EMP Table EMPVU10 View
CS345 Project Presentation
Scoping and Binding of Variables
Lecture 16 : The Relational Data Model
Restricting and Sorting Data
Lecture 16 : The Relational Data Model
Presentation transcript:

CS345 Project Presentation Language: H-- Mikhail Iakhiaev

Features Overview List Comprehension Support for Tuples and Lists Lambda expressions For-each loop Support for Strings Miscellaneous features –Declarations can appear anywhere –Built-in functions: "print", "println".

Typing Basic Types – int, bool, float, void, string, list, tuple, object. Function types: –"(bool, bool, bool)": like Huskell Mixed static/dynamic typing: int a = 2, b = 3, c; c = a + b; // Integer plus float x = 5.0, y; y = b + x - a; // Implicit int->float int a = 2; object c; list b = getValues(); c = a + b[2]; // Object plus

Lists/Tuples Support for immediate values: –list a = [1, 2, 3]; tuple b = ("John", 4); Arbitrary level of nesting Accessing the elements: a[3]. Difference: tuple elements can not be assigned values. list createDept() { return [ (10, "ACCOUNTING", "NEW YORK"), (20, "RESEARCH", "DALLAS"), (30, "SALES", "CHICAGO"), (40, "OPERATIONS", "BOSTON") ]; }

List Comprehension Multiple "generators" and conditions "_" are properly recognized Easy to implement the joins of different lists. List comprehension actually declares variables "name", "city", and "date" (all object). list emp = createEmp(); list dept = createDept(); list dbRes = [ (name, date, city) | (_, name, _, _, date, _, d1) <- emp, (d2, _, city) <- dept, d1 == d2 ]; println("Query Result: ", dbRes);

List Comprehension(2) [ (name, date, city) | (_, name, _, _, date, _, d1) <- emp, (d2, _, city) <- dept, d1 == d2]; C:\Documents and Settings\miakhiae\Desktop\proj>hmm test.c Query Result: [ (KING, 17-NOV-81, NEW YORK), (BLAKE, 01-MAY-81, CHICAGO), (CLARK, 09-JUN-81, NEW YORK), (JONES, 02-APR-81, DALLAS), (SCOTT, 09-DEC-82, DALLAS), (FORD, 03-DEC-81, DALLAS), (SMITH, 17-DEC-80, DALLAS), (ALLEN, 20-FEB-81, CHICAGO), (WARD, 22-FEB-81, CHICAGO), (MARTIN, 28-SEP-81, CHICAGO), (TURNER, 08-SEP-81, CHICAGO), (ADAMS, 12-JAN-83, DALLAS), (JAMES, 03-DEC-81, CHICAGO), (MILLER, 23-JAN-82, NEW YORK) ]

Lambda Expressions Use Function Types: (arg1,... argN, returnType) "First-class citizens", because they can be passed into the other functions just like other variables. Only variables of the Function Types can be executed as Lambdas Note, the "x, y" variables are declared by each Lambda int main () { bool eqRes = equivalence2( (\ x, y -> !(x || y)), (\ x, y -> !x && !y) ); println("Result: ", eqRes); } bool equivalence2( (object, object, object) a, (object, object, object) b ) { list l = [a(x, y) == b(x, y) | x <- [true, false], y <- [true, false]]; return and(l); }

For-each loop Somewhat similar to List Comprehension Executes the body instead of creating a list. Declares the loop variable. bool and(list lst) { bool result = true; for (l <- lst) { result = result && l; } return result; } object calcExpense(list emp) { object sum = 0; for ((_, _, _, _, _, sal, _) <- emp) { sum = sum + sal; } return sum; }

Scoping/Binding Static Scoping. The scopes can be: –Block –List comprehension –Lambda Definition Static Binding –Variables in the Lambda expression are bound to where the Lambda is defined. Function arguments: –List/tuple: pass by reference. –Other: pass by value

Static Binding example Note, the variable x in the Lambda expression binds to the x in the getSelector, not the one in the main or selectDept20. int main() { list emp = createEmp(); int x = 6000; println( selectDept20(emp, getSelector()) ); } (object, bool) getSelector() { int x = 1000; return (\ y -> y < x); } list selectDept20(list emp, (object, bool) selector) { int x = 20; return [ (name, sal) | (_, name, _, _, _, sal, dept) <- emp, selector(sal), dept == x]; } OUTPUT: [ (SMITH, 800) ]

Strings are Fun println("All the salesmen: ", [ (name, sal) | (_, name, pos, _, _, sal, _) <- createEmp(), pos == "SALESMAN" ]); println("People who alphabetically follow Martin: ", [ name | (_, name, _, _, _, _, _) "MARTIN"]); C:\Documents and Settings\miakhiae\Desktop\proj>hmm test_str.c All the salesmen: [ (ALLEN, 1600), (WARD, 1250), (MARTIN, 1250), (TURNER, 1500) ] People who alphabetically follow Martin: [SCOTT, SMITH, WARD, TURNER, MILLER]

Questions? ????