Why do you want to know about functional programming?

Size: px
Start display at page:

Download "Why do you want to know about functional programming?"

Transcription

1 Why do you want to know about functional programming? A look at LinQ in C# and (perhaps) Java Axel T. Schreiner RIT Computer Science Eric Meijer 04/23/07 linq-1

2 Principles Patterns Examples Implementation Conclusions 04/23/07 linq-2

3 Principles Map a query language to cascading method calls. Implement the necessary methods for IEnumerable, XML- and database-access. Sugar syntax liberally. cs /30/06 linq-3

4 What if... struct Person { string first, last; int phone; IContainer<Person> staff =... Console.WriteLine( from x in staff where x.phone % 2 == 0 orderby x.last select new { x.first, x.phone ); Syntactic sugar patterned after SQL. cs /30/06 linq-4

5 What if... struct Person { string first, last; int phone; IContainer<Person> staff =... Console.WriteLine( from x in staff where x.phone % 2 == 0 orderby x.last select new { x.first, x.phone ); Syntactic sugar patterned after SQL. Actions converted into messages, Expressions converted into functions. cs /30/06 linq-5

6 What if... struct Person { string first, last; int phone; IContainer<Person> staff =... Console.WriteLine( staff.where(x => x.phone % 2 == 0).OrderBy(x => x.last).select(x => new { x.first, x.phone ) ); Functional style [Eric Meijer]: function as arguments, function composition for actions. Anonymous class new { field,.... cs /30/06 linq-6

7 Typing struct Person { string first, last; int phone; IContainer<Person> staff =... Console.WriteLine( staff.where(x => x.phone % 2 == 0).OrderBy(x => x.last).select(x => new { x.first, x.phone ) ); class C<T> { delegate R Func<R, T> (T arg); C<T> Where (Func<bool, T> predicate); C<T> OrderBy<K> (Func<K, T> keyselector); C<U> Select<U> (Func<U, T> selector); cs /30/06 linq-7

8 Typing struct Person { string first, last; int phone; IContainer<Person> staff =... Console.WriteLine( staff.where(x => x.phone % 2 == 0).OrderBy(x => x.last).select(x => new { x.first, x.phone ) ); class C<T> { delegate R Func<R, T> (T arg); C<T> Where (Func<bool, T> predicate); C<T> OrderBy<K> (Func<K, T> keyselector); C<U> Select<U> (Func<U, T> selector); cs /30/06 linq-8

9 Typing struct Person { string first, last; int phone; IContainer<Person> staff =... Console.WriteLine( staff.where(x => x.phone % 2 == 0).OrderBy(x => x.last).select(x => new { x.first, x.phone ) ); class C<T> { delegate R Func<R, T> (T arg); C<T> Where (Func<bool, T> predicate); C<T> OrderBy<K> (Func<K, T> keyselector); C<U> Select<U> (Func<U, T> selector); cs /30/06 linq-9

10 Typing Pattern struct Person { string first, last; int phone; IContainer<Person> staff =... Console.WriteLine( staff.where(x => x.phone % 2 == 0).OrderBy(x => x.last).select(x => new { x.first, x.phone ) ); class C<T> { delegate R Func<R, T> (T arg); C<T> Where (Func<bool, T> predicate); C<T> OrderBy<K> (Func<K, T> keyselector); C<U> Select<U> (Func<U, T> selector); cs /30/06 linq-10

11 Query Expression Pattern from join... introduce iteration variable(s) from let... where introduces iteration variable(s) introduces variable filters orderby rearranges sequence select group by into join... produces flat result produces structured result produces iteration variable(s) to start over cs /30/06 linq-11

12 Query Class Pattern from join... class C<T> { C<V> Join (...) C<V> GroupJoin (...) from let... where C<T> Where (...) orderby O<T> OrderBy[Descending] (...) class O<T> : C<T> { O<T>ThenBy[Descending] (...) select group by C<U> Select[Many] (...) C<G<Key,E>> GroupBy (...) class G<Key,E> : C<E> {... into join... cs /30/06 linq-12

13 Examples /23/07 linq-13

14 cs /30/06 linq-1from let where... / Where let x = e defines name for value. from x in xs where f xs.where(x => f) retains only records satisfying a condition.

15 Implementation 04/23/07 linq-1delegate R Func<R,A> (A a); IEnumerable<T> Where<T> (IEnumerable<T> container, Func<bool,T> predicate) { foreach (var c in container) if (predicate(c)) yield return c;

16 Implementation delegate R Func<R,A> (A a); IEnumerable<T> Where<T> (IEnumerable<T> container, Func<bool,T> predicate) { foreach (var c in container) if (predicate(c)) yield return c; 04/23/07 linq-1public interface Func<R,A> { R f (A a); public<t> Iterable<T> where (Iterable<T> container, Func<Boolean,T> predicate) { List<T> result = newlist(); for (T c: container) if (predicate.f(c)) result.add(c); return result;

17 Lazy Evaluation public<t> IterableImpl<T> where (final Func<Boolean,T> predicate) { return new IterableImpl<T>(this) { public Iterator<T> iterator () { return new IteratorImpl<T> () { final Iterator<T> c = delegate.iterator(); protected void getnext () { while (c.hasnext()) if (predicate.f(next = c.next())) { hasnext = true; return; hasnext = false; eof = true; ; ; 04/23/07 linq-16

18 Use 04/23/07 linq-1int[] xs = { 1, 2, 3, 4, 5 ; from x in xs where x % 2 == 0 select x Where(xs, x => x % 2 == 0)

19 int[] xs = { 1, 2, 3, 4, 5 ; from x in xs where x % 2 == 0 select x Where(xs, x => x % 2 == 0) Use List<Integer> xs = Arrays.asList(new Integer[]{ 1, 2, 3, 4, 5); where(xs, new Func<Boolean,Integer>() { public Boolean f (Integer x) { return x % 2 == 0; ) Arrays are not Iterable. 04/23/07 linq-17

20 Sugar: Extension Methods static class X { static R method (this A parm,...) {... A static class can define (static) extension methods. If the class is imported, the methods can be called as instance methods: A a; a.method(...) cs /30/06 linq-18

21 Sugar: Lambda Syntax parameter => expression (type parameter,...) => { body An anonymous method definition can be significantly simplified. Parameter and result types can be inferred. Proposed for Java 7. cs /30/06 linq-19

22 cs /30/06 linq-2select / Select from x in xs select f xs.select(x => f) creates new records.

23 Implementation 04/23/07 linq-2delegate R Func<R,A> (A a); IEnumerable<U> Select<U,T> (IEnumerable<T> container, Func<U,T> selector) { foreach (var c in container) yield return selector(c);

24 Implementation delegate R Func<R,A> (A a); IEnumerable<U> Select<U,T> (IEnumerable<T> container, Func<U,T> selector) { foreach (var c in container) yield return selector(c); 04/23/07 linq-2public interface Func<R,A> { R f (A a); public<u,t> Iterable<U> select (Iterable<T> container, Func<U,T> selector) { List<U> result = newlist(); for (T c: container) result.add(selector.f(c)); return result;

25 Lazy Evaluation public<u,t> IterableImpl<U> select (final Func<U,T> selector) { return new IterableImpl<U>(this) { public Iterator<U> iterator () { return new IteratorImpl<U> () { final Iterator<T> c = delegate.iterator(); protected void getnext () { if (hasnext = c.hasnext()) next = selector.f(c.next()); else eof = true; ; ; 04/23/07 linq-22

26 cs /30/06 linq-2select / Select[Many] from x in xs select f xs.select(x => f) creates new records. from x in xs from y in ys select f xs.selectmany(x => ys.select(y => f)) creates new records notice scoping.

27 Implementation 04/23/07 linq-2delegate R Func<R,A> (A a); IEnumerable<U> SelectMany<U,T> (IEnumerable<T> container, Func<IEnumerable<U>,T> selector) { foreach (var c in container) foreach (var u in selector(c)) yield return u;

28 Implementation delegate R Func<R,A> (A a); IEnumerable<U> SelectMany<U,T> (IEnumerable<T> container, Func<IEnumerable<U>,T> selector) { foreach (var c in container) foreach (var u in selector(c)) yield return u; 04/23/07 linq-2public interface Func<R,A> { R f (A a); public<u,t> Iterable<U> selectmany (Iterable<T> container, Func<Iterable<U>,T> selector) { List<U> result = newlist(); for (T c: container) for (U u: selector.f(c)) result.add(u); return result;

29 Use 04/23/07 linq-2int[] xs = { 1, 2, 3, 4, 5 ; double[] ys = { 6.0, 7.0, 8.0, 9.0, 10.0 ; from x in xs where x > 3 from y in ys where y < 8.0 select new { y, x SelectMany(Where(xs, x => x > 3), x => Select(Where(ys, y => y < 8.0), y => new { y, x ))

30 Sugar: Tuple Types new { name = expression,... A type can be created on the fly. It has a read/write property for each field (and ToString). The field types (and names) are inferred. cs /30/06 linq-26

31 Review: Use 04/23/07 linq-2int[] xs = { 1, 2, 3, 4, 5 ; double[] ys = { 6.0, 7.0, 8.0, 9.0, 10.0 ; from x in xs where x > 3 from y in ys where y < 8.0 select new { y, x SelectMany(Where(xs, x => x > 3), x => Select(Where(ys, y => y < 8.0), y => new { y, x ))

32 List<Integer> xs = Arrays.asList(new Integer[]{ 1, 2, 3, 4, 5); final List<Double> ys = Arrays.asList(new Double[]{ 6.0, 7.0, 8.0, 9.0, 10.0 ); selectmany( where(xs, new Func<Boolean,Integer>() { public Boolean f (Integer x) { return x > 3; ), new Func<Iterable<HashMap<String,Object>>,Integer>() { public Iterable<HashMap<String,Object>> f (final Integer x) { return select( where(ys, new Func<Boolean,Double>() { public Boolean f (Double y) { return y < 8.0; ), new Func<HashMap<String,Object>,Double>() { public HashMap<String,Object> f (Double y) { HashMap<String,Object> result = new HashMap<String,Object>(); result.put("y", y); result.put("x", x); return result; ); ) 04/23/07 linq-28

33 cs /30/06 linq-2orderby from x in e orderby f [ascending descending] //, g,... e.orderby(x => f) //.ThenBy(x => g)... defines sort key[s] and direction.

34 Implementation: primary key 04/23/07 linq-3public<k extends Comparable<K>,T> Ordered<T> orderby (Iterable<T> container, final Func<K,T> key) { // need a copied list for sorting List<T> values = newlist(); for (T c: container) values.add(c); return new Ordered<T>(values, new Comparator<T>() { public int compare (T a, T b) { return key.f(a).compareto(key.f(b)); ); Comparator is composed from key

35 Implementation: secondary keys public static class Ordered<T> extends Base<T> { protected final Comparator<T> order; protected boolean ordered; // true once sorted public Ordered (List<T> values, Comparator<T> order) { super(values); this.order = order; public<k extends Comparable<K>> Ordered<T> thenby (final Func<K,T> key) { // add to order return new Ordered<T>(super.getValues(), new Comparator<T>() { public int compare (T a, T b) { int c = order.compare(a, b); return c!= 0? c : key.f(a).compareto(key.f(b)); ); next Comparator is composed from order and key 04/23/07 linq-31

36 Implementation: sort protected static class Base<T> extends AbstractList<T> { private final List<T> values; protected List<T> getvalues () { return values; public Base (List<T> values) { this.values = values; public void add (int index, T element) { getvalues().add(index, element); //... get, remove, set, and size are also delegated; any use of values can be overridden: protected List<T> getvalues () { // use order List<T> values = super.getvalues(); if (!ordered) { Collections.sort(values, order); ordered = true; return values; 04/23/07 linq-32

37 Use public static void main (String... _args) { List<String> args = Arrays.asList(_args); orderby(args, new Func<String,String>() { // s => s.tolowercase public String f (String s) { return s.tolowercase(); ).thenby(new Func<String,String>() { // s => s public String f (String s) { return s; ) sorts in dictionary order 04/23/07 linq-33

38 etc. 04/23/07 linq-3join computes for pairs: inner record with same key as outer record group-join computes for group of inner records with same key as outer record group by groups values computed from elements with equal key values

39 cs /30/06 linq-3from join... from x in e defines iteration variable. from x in e join y in f on g equals h //... z e.join(f, x => g, y => h, (x,y) => z) defines anonymous iteration over pairs. from x in e join y in f on g equals h into i //... z e.groupjoin(f, x => g, y => h, (x,i) => z) defines anonymous iteration over groups.

40 Join delegate R F<R,A> (A a); delegate R F<R,A,B> (A a, B b); C<V> Join<U,K,V,T> (C<U> inner, F<K,T> outerkey, F<K,U> innerkey, F<V,T,U> selector) { var result = new C<V>(); foreach (var t in this) // from's container foreach (var i in inner) if (outerkey(t).equals(innerkey(i))) result.add(selector(t, i)); return result; selector combines records with matching keys. cs /30/06 linq-36

41 GroupJoin C<V> GroupJoin<U,K,V,T> (C<U> inner, F<K,T> outerkey, F<K,U> innerkey, F<V,T,C<U>> selector) { var result = new C<V>(); foreach (var t in this) { var group = new C<U>(); foreach (var i in inner) if (outerkey(t).equals(innerkey(i))) group.add(i); result.add(selector(t, group)); return result; selector combines outer record with group of inner records and matching keys. cs /30/06 linq-37

42 cs /30/06 linq-3group by from x in e group x by g e.groupby(x => g) groups elements by key value. from x in e group f by g e.groupby(x => g, x => f) groups new values by key value.

43 GroupBy C<Group<K,T>> GroupBy<K,T> (F<K,T> key) { return GroupBy(key, (F<T,T>)delegate (T t) { return t; ); C<Group<K,E>> GroupBy<K,E,T> (F<K,T> key, F<E,T> selector) { var dictionary = new Dictionary<K,Group<K,E>>(); var result = new C<Group<K,E>>(); foreach (var t in this) { var k = key(t); Group<K,E> group; try { group = dictionary[k]; catch { group = new Group<K,E>(k); result.add(group); dictionary[k] = group; group.add(selector(t)); return result; cs /30/06 linq-39

44 Group class Group<K,T> : C<T> { readonly K key; public Group (K key) { this.key = key; public K Key { get { return key; Group preserves the common key value. cs /30/06 linq-40

45 Think functional! A computer scientist invents this... Action sequence: composition Condition/selection: lambdas as arguments Nested selections: application of lambda Sorting: compose Comparator based on lambda arguments No chance to see this in Java [56]... 04/23/07 linq-41

46 Think functional! A computer scientist invents this... Action sequence: composition, lazy evaluation Condition/selection: lambdas as arguments Nested selections: application of lambda Sorting: compose Comparator based on lambda arguments No chance to see this in Java [56]... 04/23/07 linq-42

47 Think functional! A computer scientist invents this... Action sequence: composition, lazy evaluation Condition/selection: lambdas as arguments Nested selections: application of lambda Sorting: compose Comparator based on lambda arguments No chance to see this in Java [56]... 04/23/07 linq-43

48 Think functional! A computer scientist invents this... Action sequence: composition, lazy evaluation Condition/selection: lambdas as arguments Nested selections: application of lambda Sorting: compose Comparator based on lambda arguments No chance to see this in Java [56]... 04/23/07 linq-44

49 Think functional! A computer scientist invents this... Action sequence: composition, lazy evaluation Condition/selection: lambdas as arguments Nested selections: application of lambda Sorting: compose Comparator based on lambda arguments No chance to see this in Java [56]... 04/23/07 linq-45

50 Think functional! A computer scientist invents this... Action sequence: composition Condition/selection: lambdas as arguments Nested selections: application of lambda Sorting: compose Comparator based on lambda arguments No chance to see this in Java [56]... 04/23/07 linq-46

51 References Erik Meijer C#: LinQ C# Java 7: Closures 04/23/07 linq-47

LinQ Why we have to teach functional programmming

LinQ Why we have to teach functional programmming LinQ Why we have to teach functional programmming Axel T. Schreiner http://www.cs.rit.edu/~ats/talks/linq/ http://www.cs.rit.edu/~ats/cs-2006-1/14_linq.pdf Principles Map a query language to cascading

More information

Previous C# Releases. C# 3.0 Language Features. C# 3.0 Features. C# 3.0 Orcas. Local Variables. Language Integrated Query 3/23/2007

Previous C# Releases. C# 3.0 Language Features. C# 3.0 Features. C# 3.0 Orcas. Local Variables. Language Integrated Query 3/23/2007 Previous C# Releases C# 3.0 Language Features C# Programming March 12, 2007 1.0 2001 1.1 2003 2.0 2005 Generics Anonymous methods Iterators with yield Static classes Covariance and contravariance for delegate

More information

Visual C# 2012 How to Program by Pe ars on Ed uc ati on, Inc. All Ri ght s Re ser ve d.

Visual C# 2012 How to Program by Pe ars on Ed uc ati on, Inc. All Ri ght s Re ser ve d. Visual C# 2012 How to Program 1 99 2-20 14 by Pe ars on Ed uc ati on, Inc. All Ri ght s Re ser ve d. 1992-2014 by Pearson Education, Inc. All 1992-2014 by Pearson Education, Inc. All Although commonly

More information

C # Version 3.0 Specification

C # Version 3.0 Specification C # Version 3.0 Specification May 2006 Copyright Microsoft Corporation 2006. All Rights Reserved. Notice 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Visual Basic, Visual C#, and

More information

IMPLEMENTING THE LINQ QUERY LANGUAGE INTO THE C++ PROGRAMMING LANGUAGE USING A PREPROCESSOR

IMPLEMENTING THE LINQ QUERY LANGUAGE INTO THE C++ PROGRAMMING LANGUAGE USING A PREPROCESSOR IMPLEMENTING THE LINQ QUERY LANGUAGE INTO THE C++ PROGRAMMING LANGUAGE USING A PREPROCESSOR Jakub Judas, Miroslav Virius FJFI ČVUT ABSTRACT: LINQ is a query language similar to SQL that enables to retrieve

More information

OptiQL: LINQ on Delite

OptiQL: LINQ on Delite OptiQL: LINQ on Delite What is LINQ? Language Integrated Query (LINQ) is a set of language and framework features for writing structured typesafe queries over local object collections and remote data sources.

More information

Putting it all together: LINQ as an Example

Putting it all together: LINQ as an Example Putting it all together: LINQ as an Example The Problem: SQL in Code Programs often connect to database servers. Database servers only speak SQL. Programs have to construct SQL strings. PHP example: if

More information

By Jason Roberts. Foreword by Daniel Jebaraj

By Jason Roberts. Foreword by Daniel Jebaraj 1 By Jason Roberts Foreword by Daniel Jebaraj 2 Table of Contents The Story behind the Succinctly Series of Books... 9 About the Author... 11 Chapter 1 LINQ Fundamentals... 12 Why LINQ?... 12 The building

More information

Concepts behind the C# 3 language. Faculty of Mathematics and Physics, Charles University in Prague

Concepts behind the C# 3 language. Faculty of Mathematics and Physics, Charles University in Prague Concepts behind the C# 3 language TomášPetříček(tomas@tomasp.net) Faculty of Mathematics and Physics, Charles University in Prague 1 Introduction The C# 3 (currently available in preliminary version) is

More information

Programming C# 5.0. Ian Griffiths O'REILLY' Beijing Cambridge * Farnham Kbln Sebastopol Tokyo

Programming C# 5.0. Ian Griffiths O'REILLY' Beijing Cambridge * Farnham Kbln Sebastopol Tokyo Programming C# 5.0 Ian Griffiths O'REILLY' Beijing Cambridge * Farnham Kbln Sebastopol Tokyo Preface xvii 1. Introducing C# 1 Why C#? 1 Why Not C#? 3 C#'s Defining Features 5 Managed Code and the CLR 7

More information

Seminar 11 week 11 (11-15 December 2017)

Seminar 11 week 11 (11-15 December 2017) Seminar 11 week 11 (11-15 December 2017) 1. Discuss LINQ from C# using the following examples. 2. Solve the following problems: 2.1. Display the number and frequency of number from given array. 2.2. find

More information

Querying In-Memory Data by Using Query Expressions

Querying In-Memory Data by Using Query Expressions Chapter 21 Querying In-Memory Data by Using Query Expressions LINQ (Language Integrated Query) CUSTOMER CID FName Lname Company 1 Ram Kumar CITech 2 Sam Peter HP 3 Anil Kumar EMC 2 4 Anuj Patil Dell 5

More information

LINQ Queries. Getting Started.

LINQ Queries. Getting Started. 8 LINQ, or Language Integrated Query, is a set of language and framework features for writing structured type-safe queries over local object collections and remote data sources. LINQ was introduced in

More information

C# s A Doddle. Steve Love. ACCU April 2013

C# s A Doddle. Steve Love. ACCU April 2013 C# s A Doddle Steve Love ACCU April 2013 A run through C# (pronounced See Sharp ) is a simple, modern, object-oriented, and type-safe programming language. C# has its roots in the C family of languages,

More information

CHAPTER 1: INTRODUCING C# 3

CHAPTER 1: INTRODUCING C# 3 INTRODUCTION xix PART I: THE OOP LANGUAGE CHAPTER 1: INTRODUCING C# 3 What Is the.net Framework? 4 What s in the.net Framework? 4 Writing Applications Using the.net Framework 5 What Is C#? 8 Applications

More information

S.M.A.R.T. Biml Cathrine Wilhelmsen October 24 th 2015

S.M.A.R.T. Biml Cathrine Wilhelmsen October 24 th 2015 S.M.A.R.T. Biml Cathrine Wilhelmsen October 24 th 2015 Session Description Have you ever wanted to build a Data Warehouse simply by pushing a button? It might not be quite that easy yet, but gone are the

More information

Higher-Order Sequential Operations

Higher-Order Sequential Operations Chapter 9 Higher-Order Sequential Operations Many of the operations we wish to perform over lists have common structure. In this chapter, we investigate the most common of these patterns and how we can

More information

ITI Introduction to Computing II

ITI Introduction to Computing II ITI 1121. Introduction to Computing II Marcel Turcotte School of Information Technology and Engineering Iterator (part II) Inner class Implementation: fail-fast Version of March 20, 2011 Abstract These

More information

C# in Depth THIRD EDITION

C# in Depth THIRD EDITION C# in Depth THIRD EDITION JON SKEET MANNING SHELTER ISLAND brief contents PART 1 PREPARING FOR THE JOURNEY...1 1 The changing face of C# development 3 2 Core foundations: building on C# 1 29 PART 2 C#

More information

Ausblick auf Java 8. Martin Plümicke. 25. Mai Baden-Wuerttemberg Cooperative State University Stuttgart/Horb

Ausblick auf Java 8. Martin Plümicke. 25. Mai Baden-Wuerttemberg Cooperative State University Stuttgart/Horb Ausblick auf Java 8 Martin Plümicke Baden-Wuerttemberg Cooperative State University Stuttgart/Horb 25. Mai 2012 Overview Introduction Introduction Closures Java s motivation λ expressions Functional interfaces

More information

Learn to Love Lambdas

Learn to Love Lambdas Learn to Love Lambdas An overview of Lambda Expressions by JeremyBytes.com Overview Lambda expressions can be confusing the first time you walk up to them. But once you get to know them, you ll see that

More information

CSE341: Programming Languages Lecture 9 Function-Closure Idioms. Dan Grossman Winter 2013

CSE341: Programming Languages Lecture 9 Function-Closure Idioms. Dan Grossman Winter 2013 CSE341: Programming Languages Lecture 9 Function-Closure Idioms Dan Grossman Winter 2013 More idioms We know the rule for lexical scope and function closures Now what is it good for A partial but wide-ranging

More information

Functional programming in C#

Functional programming in C# Functional programming in C# A quick approach to another paradigm Nacho Iborra IES San Vicente This work is licensed under the Creative Commons Attribution- NonCommercial-ShareAlike 4.0 International License.

More information

CPL 2016, week 10. Clojure functional core. Oleg Batrashev. April 11, Institute of Computer Science, Tartu, Estonia

CPL 2016, week 10. Clojure functional core. Oleg Batrashev. April 11, Institute of Computer Science, Tartu, Estonia CPL 2016, week 10 Clojure functional core Oleg Batrashev Institute of Computer Science, Tartu, Estonia April 11, 2016 Overview Today Clojure language core Next weeks Immutable data structures Clojure simple

More information

LINQ Language-Integrated Query Introduction

LINQ Language-Integrated Query Introduction LINQ Language-Integrated Query Introduction Contents Introduction... 1 The var Keyword... 2 IEnumerable... 2 Anonymous Classes... 3 Extension Methods Part I... 3 The this Parameter... 4 Extension Methods

More information

CSE 341 Section 5. Winter 2018

CSE 341 Section 5. Winter 2018 CSE 341 Section 5 Winter 2018 Midterm Review! Variable Bindings, Shadowing, Let Expressions Boolean, Comparison and Arithmetic Operations Equality Types Types, Datatypes, Type synonyms Tuples, Records

More information

Introduction to Object-Oriented Programming

Introduction to Object-Oriented Programming Introduction to Object-Oriented Programming Iterators and Streams Christopher Simpkins chris.simpkins@gatech.edu CS 1331 (Georgia Tech) Iterators and Streams 1 / 20 The Collections Framework A collection

More information

CS Programming Languages: Scala

CS Programming Languages: Scala CS 3101-2 - Programming Languages: Scala Lecture 3: Fun with Functions Daniel Bauer (bauer@cs.columbia.edu) October 29, 2014 Daniel Bauer CS3101-2 Scala - 03 - Fun with Functions 1/37 Contents 1 Defining

More information

Rx is a library for composing asynchronous and event-based programs using observable collections.

Rx is a library for composing asynchronous and event-based programs using observable collections. bartde@microsoft.com Slides license: Creative Commons Attribution Non-Commercial Share Alike See http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode Too hard today (f g)(x) = f(g(x)) Rx is a library

More information

Learn to Love Lambdas

Learn to Love Lambdas Learn to Love Lambdas An overview of Lambda Expressions by JeremyBytes.com Overview Lambda expressions can be confusing the first time you walk up to them. But once you get to know them, you ll see that

More information

LAMBDA EXPRESSIONS AND STREAMS API

LAMBDA EXPRESSIONS AND STREAMS API Java 8 LAMBDA EXPRESSIONS AND STREAMS API An Introduction Methods As Data 2 @FunctionalInterface public interface Runnable { public abstract void run(); public interface ActionListener extends EventListener

More information

CS 231 Data Structures and Algorithms Fall Binary Search Trees Lecture 23 October 29, Prof. Zadia Codabux

CS 231 Data Structures and Algorithms Fall Binary Search Trees Lecture 23 October 29, Prof. Zadia Codabux CS 231 Data Structures and Algorithms Fall 2018 Binary Search Trees Lecture 23 October 29, 2018 Prof. Zadia Codabux 1 Agenda Ternary Operator Binary Search Tree Node based implementation Complexity 2 Administrative

More information

LINQ in Action. Fabrice Marguerie Steve Eichert Jim Wooley. Chapter 3. Copyright 2008 Manning Publications

LINQ in Action. Fabrice Marguerie Steve Eichert Jim Wooley. Chapter 3. Copyright 2008 Manning Publications SAMPLE CHAPTER LINQ in Action Fabrice Marguerie Steve Eichert Jim Wooley Chapter 3 Copyright 2008 Manning Publications brief contents PART 1 GETTING STARTED... 1 1 Introducing LINQ 3 2 C# and VB.NET language

More information

Refactoring to Functional. Hadi Hariri

Refactoring to Functional. Hadi Hariri Refactoring to Functional Hadi Hariri Functional Programming In computer science, functional programming is a programming paradigm, a style of building the structure and elements of computer programs,

More information

Advanced Programming C# Lecture 10. dr inż. Małgorzata Janik

Advanced Programming C# Lecture 10. dr inż. Małgorzata Janik Advanced Programming C# Lecture 10 dr inż. Małgorzata Janik majanik@if.pw.edu.pl Winter Semester 2017/2018 Project (part II) Project part II Date: 18.12.2017 (next week!) Prepare the presentation that

More information

C# in Depth SECOND EDITION JON SKEET. MANNING Greenwich (74 w. long.)

C# in Depth SECOND EDITION JON SKEET. MANNING Greenwich (74 w. long.) C# in Depth SECOND EDITION JON SKEET II MANNING Greenwich (74 w. long.) brief contents PART 1 PREPARING FOR THE JOURNEY 1 The changing face of C# development 2 Core foundations: building on C# 1 27 PART

More information

SWIFT - CLOSURES. Global Functions Nested Functions Closure Expressions. Have a name. Capture values from enclosing function

SWIFT - CLOSURES. Global Functions Nested Functions Closure Expressions. Have a name. Capture values from enclosing function http://www.tutorialspoint.com/swift/swift_closures.htm SWIFT - CLOSURES Copyright tutorialspoint.com Closures in Swift are similar to that of self-contained functions organized as blocks and called anywhere

More information

Whether to Include Java 8 Features in Introductory CS Courses

Whether to Include Java 8 Features in Introductory CS Courses CCSC Eastern Conference 2015 Tutorial Whether to Include Java 8 Features in Introductory CS Courses James Heliotis Computer Science Rochester Inst. of Technology jeh@cs.rit.edu 1 Our History in Java Education

More information

Chapter 8. Statement-Level Control Structures

Chapter 8. Statement-Level Control Structures Chapter 8 Statement-Level Control Structures Chapter 8 Topics Introduction Selection Statements Iterative Statements Unconditional Branching Guarded Commands Conclusions Copyright 2009 Addison-Wesley.

More information

string[] names = { "Tom", "Dick", "Harry", "Mary", "Jay" }; var datacontext = new NutshellContext ("connection string...");

string[] names = { Tom, Dick, Harry, Mary, Jay }; var datacontext = new NutshellContext (connection string...); 9 LINQ Operators This chapter describes each of the LINQ query operators. As well as serving as a reference, two of the sections, Projection and Joining on page 378, cover a number of conceptual areas:

More information

Learning C# 3.0. Jesse Liberty and Brian MacDonald O'REILLY. Beijing Cambridge Farnham Köln Sebastopol Taipei Tokyo

Learning C# 3.0. Jesse Liberty and Brian MacDonald O'REILLY. Beijing Cambridge Farnham Köln Sebastopol Taipei Tokyo Learning C# 3.0 Jesse Liberty and Brian MacDonald O'REILLY Beijing Cambridge Farnham Köln Sebastopol Taipei Tokyo Table of Contents Preface xv 1. C# and.net Programming 1 Installing C# Express 2 C# 3.0

More information

COP4020 Programming Languages. Functional Programming Prof. Robert van Engelen

COP4020 Programming Languages. Functional Programming Prof. Robert van Engelen COP4020 Programming Languages Functional Programming Prof. Robert van Engelen Overview What is functional programming? Historical origins of functional programming Functional programming today Concepts

More information

CS 342 Lecture 6 Scheme Procedures and Closures By: Hridesh Rajan

CS 342 Lecture 6 Scheme Procedures and Closures By: Hridesh Rajan CS 342 Lecture 6 Scheme Procedures and Closures By: Hridesh Rajan 1 Reading Little Schemer Chapter 8 SICP 1, 3.2 2 Lecture Overview In this lecture, we will cover scheme procedures in a bit more detail

More information

LECTURE 16. Functional Programming

LECTURE 16. Functional Programming LECTURE 16 Functional Programming WHAT IS FUNCTIONAL PROGRAMMING? Functional programming defines the outputs of a program as a mathematical function of the inputs. Functional programming is a declarative

More information

חומר עזר לבחינה מבוא למדעי המחשב

חומר עזר לבחינה מבוא למדעי המחשב שיטות במחלקה Object // Indicates whether some other object is "equal to" // this one. boolean equals(object other) // Returns a string representation of the object. String tostring() // Returns the length

More information

CSE341: Programming Languages Lecture 9 Function-Closure Idioms. Dan Grossman Fall 2011

CSE341: Programming Languages Lecture 9 Function-Closure Idioms. Dan Grossman Fall 2011 CSE341: Programming Languages Lecture 9 Function-Closure Idioms Dan Grossman Fall 2011 More idioms We know the rule for lexical scope and function closures Now what is it good for A partial but wide-ranging

More information

ITI Introduction to Computing II

ITI Introduction to Computing II ITI 1121. Introduction to Computing II Iterator 1 (part I) Marcel Turcotte School of Electrical Engineering and Computer Science Version of March 26, 2013 Abstract These lecture notes are meant to be looked

More information

ITI Introduction to Computing II

ITI Introduction to Computing II ITI 1121. Introduction to Computing II Iterator 1 (part I) Marcel Turcotte School of Electrical Engineering and Computer Science Version of March 26, 2013 Abstract These lecture notes are meant to be looked

More information

Background Operators (1E) Young Won Lim 7/7/18

Background Operators (1E) Young Won Lim 7/7/18 Background Operators (1E) Copyright (c) 2016-2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2

More information

Array. Prepared By - Rifat Shahriyar

Array. Prepared By - Rifat Shahriyar Java More Details Array 2 Arrays A group of variables containing values that all have the same type Arrays are fixed length entities In Java, arrays are objects, so they are considered reference types

More information

Java SE 8 Programming

Java SE 8 Programming Oracle University Contact Us: +52 1 55 8525 3225 Java SE 8 Programming Duration: 5 Days What you will learn This Java SE 8 Programming training covers the core language features and Application Programming

More information

MSSQL and.net. Using SQL in.net, running.net code in SQL Server

MSSQL and.net. Using SQL in.net, running.net code in SQL Server MSSQL and.net Using SQL in.net, running.net code in SQL Server Brief Intro to C# Specific Concepts Properties public int SomeInt { get; private set; } Generics Interfaces public interface IQueryable

More information

Level Up Your Biml: Best Practices and Coding Techniques. Cathrine Wilhelmsen

Level Up Your Biml: Best Practices and Coding Techniques. Cathrine Wilhelmsen Level Up Your Biml: Best Practices and Coding Techniques Cathrine Wilhelmsen Session Description You already know how to use Biml to build a staging environment in an hour, so let's dive straight into

More information

Lambda Expressions and Java 8 Streams. Jan Trienes, adapted by Th. Dorssers, Pieter van den Hombergh. Contents of this talk.

Lambda Expressions and Java 8 Streams. Jan Trienes, adapted by Th. Dorssers, Pieter van den Hombergh. Contents of this talk. Java 8 s and Java 8 van den Hombergh Fontys Hogeschool voor Techniek en Logistiek February 23, 2017 and /FHTenL s and Java 8 February 23, 2017 1/28 talk Expression and Internal/External Iteration Java

More information

Patterns The Essence of Functional Programming

Patterns The Essence of Functional Programming Patterns The Essence of Functional Programming Up to now we have defined functions in a very traditional way: function name + variable name parameters Read Chap 7 In functional programming we can exploit

More information

Variable Scope The Main() Function Struct Functions Overloading Functions Using Delegates Chapter 7: Debugging and Error Handling Debugging in Visual

Variable Scope The Main() Function Struct Functions Overloading Functions Using Delegates Chapter 7: Debugging and Error Handling Debugging in Visual Table of Contents Title Page Introduction Who This Book Is For What This Book Covers How This Book Is Structured What You Need to Use This Book Conventions Source Code Errata p2p.wrox.com Part I: The OOP

More information

Java and C# in depth

Java and C# in depth Java and C# in depth ETH Zurich Date: 27 May 2013 Family name, first name:... Student number:.. I confirm with my signature, that I was able to take this exam under regular circumstances and that I have

More information

COPYRIGHTED MATERIAL. Contents. Part I: C# Fundamentals 1. Chapter 1: The.NET Framework 3. Chapter 2: Getting Started with Visual Studio

COPYRIGHTED MATERIAL. Contents. Part I: C# Fundamentals 1. Chapter 1: The.NET Framework 3. Chapter 2: Getting Started with Visual Studio Introduction XXV Part I: C# Fundamentals 1 Chapter 1: The.NET Framework 3 What s the.net Framework? 3 Common Language Runtime 3.NET Framework Class Library 4 Assemblies and the Microsoft Intermediate Language

More information

ITI Introduction to Computing II

ITI Introduction to Computing II ITI 1121. Introduction to Computing II Iterator 1 (part I) Marcel Turcotte School of Electrical Engineering and Computer Science Version of March 24, 2013 Abstract These lecture notes are meant to be looked

More information

With examples in F# and C# SAMPLE CHAPTER. Tomas Petricek. WITH Jon Skeet FOREWORD BY MADS TORGERSEN MANNING

With examples in F# and C# SAMPLE CHAPTER. Tomas Petricek. WITH Jon Skeet FOREWORD BY MADS TORGERSEN MANNING With examples in F# and C# SAMPLE CHAPTER Tomas Petricek WITH Jon Skeet FOREWORD BY MADS TORGERSEN MANNING Real-World Functional Programming by Tomas Petricek with Jon Skeet Chapter 12 Copyright 2010 Manning

More information

Chapter 8. Statement-Level Control Structures ISBN

Chapter 8. Statement-Level Control Structures ISBN Chapter 8 Statement-Level Control Structures ISBN 0-321-49362-1 Chapter 8 Topics Introduction Selection Statements Iterative Statements Unconditional Branching Guarded Commands Conclusions Copyright 2012

More information

INF3110 Programming Languages Runtime Organization part II

INF3110 Programming Languages Runtime Organization part II INF3110 Programming Languages Runtime Organization part II 10/24/17 1 Today: Higher-Order Functions, and Objects at runtime Higher-order functions: Functions passed as arguments Functions that return functions

More information

Prerequisites: The student should have programming experience in a high-level language. ITCourseware, LLC Page 1. Object-Oriented Programming in C#

Prerequisites: The student should have programming experience in a high-level language. ITCourseware, LLC Page 1. Object-Oriented Programming in C# Microsoft s.net is a revolutionary advance in programming technology that greatly simplifies application development and is a good match for the emerging paradigm of Web-based services, as opposed to proprietary

More information

G Programming Languages - Fall 2012

G Programming Languages - Fall 2012 G22.2110-003 Programming Languages - Fall 2012 Lecture 3 Thomas Wies New York University Review Last week Names and Bindings Lifetimes and Allocation Garbage Collection Scope Outline Control Flow Sequencing

More information

LINQ.NET LANGUAGE INTEGRATED QUERY. Dr. Victor Matos Cleveland State University April 2018

LINQ.NET LANGUAGE INTEGRATED QUERY. Dr. Victor Matos Cleveland State University April 2018 LINQ.NET LANGUAGE INTEGRATED QUERY Dr. Victor Matos Cleveland State University April 2018 What is LINQ Language Integrated Query (LINQ, pronounced "link") is a Microsoft.NET technology that adds data querying

More information

Java SE 8 Programming

Java SE 8 Programming Java SE 8 Programming Training Calendar Date Training Time Location 16 September 2019 5 Days Bilginç IT Academy 28 October 2019 5 Days Bilginç IT Academy Training Details Training Time : 5 Days Capacity

More information

Lecture 8: Iterators and More Mutation

Lecture 8: Iterators and More Mutation Integrated Introduction to Computer Science Fisler, Nelson Contents 1 Traversing Lists 1 2 Motivating Iterators 2 3 Writing an Iterator 3 4 Writing Sum with an Iterator 4 Objectives By the end of this

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

G Programming Languages - Fall 2012

G Programming Languages - Fall 2012 G22.2110-003 Programming Languages - Fall 2012 Week 13 - Part 1 Thomas Wies New York University Review Last lecture Object Oriented Programming Outline Today: Scala Sources: Programming in Scala, Second

More information

Basics of Java: Expressions & Statements. Nathaniel Osgood CMPT 858 February 15, 2011

Basics of Java: Expressions & Statements. Nathaniel Osgood CMPT 858 February 15, 2011 Basics of Java: Expressions & Statements Nathaniel Osgood CMPT 858 February 15, 2011 Java as a Formal Language Java supports many constructs that serve different functions Class & Interface declarations

More information

Closures. Mooly Sagiv. Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming

Closures. Mooly Sagiv. Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming Closures Mooly Sagiv Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming Summary 1. Predictive Parsing 2. Large Step Operational Semantics (Natural) 3. Small Step Operational Semantics

More information

.NET Database Technologies. Entity Framework: Queries and Transactions

.NET Database Technologies. Entity Framework: Queries and Transactions .NET Database Technologies Entity Framework: Queries and Transactions ORMs and query languages l With an ORM, queries must define data to be returned and criteria in terms of domain model objects and their

More information

Lost In Translation: Formalizing Proposed Extensions to C

Lost In Translation: Formalizing Proposed Extensions to C Lost In Translation: Formalizing Proposed Extensions to C Gavin M. Bierman Microsoft Research Cambridge, UK gmb@microsoft.com Erik Meijer Microsoft Corporation, USA emeijer@microsoft.com Mads Torgersen

More information

Type Hierarchy. Comp-303 : Programming Techniques Lecture 9. Alexandre Denault Computer Science McGill University Winter 2004

Type Hierarchy. Comp-303 : Programming Techniques Lecture 9. Alexandre Denault Computer Science McGill University Winter 2004 Type Hierarchy Comp-303 : Programming Techniques Lecture 9 Alexandre Denault Computer Science McGill University Winter 2004 February 16, 2004 Lecture 9 Comp 303 : Programming Techniques Page 1 Last lecture...

More information

Java SE 8 Programming

Java SE 8 Programming Oracle University Contact Us: Local: 1800 103 4775 Intl: +91 80 67863102 Java SE 8 Programming Duration: 5 Days What you will learn This Java SE 8 Programming training covers the core language features

More information

C#: framework overview and in-the-small features

C#: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer C#: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer

More information

This exam is open book. Each question is worth 3 points.

This exam is open book. Each question is worth 3 points. This exam is open book. Each question is worth 3 points. Page 1 / 15 Page 2 / 15 Page 3 / 12 Page 4 / 18 Page 5 / 15 Page 6 / 9 Page 7 / 12 Page 8 / 6 Total / 100 (maximum is 102) 1. Are you in CS101 or

More information

Functional Programming

Functional Programming Functional Programming CS 1025 Computer Science Fundamentals I Stephen M. Watt University of Western Ontario When the Function is the Thing In O-O programming, you typically know where an action is needed,

More information

INF3110 Programming Languages Runtime Organization part II

INF3110 Programming Languages Runtime Organization part II INF3110 Programming Languages Runtime Organization part II 10/13/16 1 Higher-Order Functions Language features Functions passed as arguments Functions that return functions from nested blocks Need to maintain

More information

Collections After Eight. Maurice Naftalin Morningside Light

Collections After Eight. Maurice Naftalin Morningside Light Collections After Eight Maurice Naftalin Morningside Light Ltd. @mauricenaftalin Maurice Naftalin Developer, designer, architect, teacher, learner, writer 3 Maurice Naftalin Developer, designer, architect,

More information

CS1622. Semantic Analysis. The Compiler So Far. Lecture 15 Semantic Analysis. How to build symbol tables How to use them to find

CS1622. Semantic Analysis. The Compiler So Far. Lecture 15 Semantic Analysis. How to build symbol tables How to use them to find CS1622 Lecture 15 Semantic Analysis CS 1622 Lecture 15 1 Semantic Analysis How to build symbol tables How to use them to find multiply-declared and undeclared variables. How to perform type checking CS

More information

Microsoft Visual C# Step by Step. John Sharp

Microsoft Visual C# Step by Step. John Sharp Microsoft Visual C# 2013 Step by Step John Sharp Introduction xix PART I INTRODUCING MICROSOFT VISUAL C# AND MICROSOFT VISUAL STUDIO 2013 Chapter 1 Welcome to C# 3 Beginning programming with the Visual

More information

Control Structures. Christopher Simpkins CS 3693, Fall Chris Simpkins (Georgia Tech) CS 3693 Scala / 1

Control Structures. Christopher Simpkins CS 3693, Fall Chris Simpkins (Georgia Tech) CS 3693 Scala / 1 Control Structures Christopher Simpkins csimpkin@spsu.edu CS 3693, Fall 2011 Chris Simpkins (Georgia Tech) CS 3693 Scala 2011-08-31 1 / 1 Control Structures Scala has only four built-in control structures:

More information

CS 61A Interpreters, Tail Calls, Macros, Streams, Iterators. Spring 2019 Guerrilla Section 5: April 20, Interpreters.

CS 61A Interpreters, Tail Calls, Macros, Streams, Iterators. Spring 2019 Guerrilla Section 5: April 20, Interpreters. CS 61A Spring 2019 Guerrilla Section 5: April 20, 2019 1 Interpreters 1.1 Determine the number of calls to scheme eval and the number of calls to scheme apply for the following expressions. > (+ 1 2) 3

More information

CSCI B522 Lecture 11 Naming and Scope 8 Oct, 2009

CSCI B522 Lecture 11 Naming and Scope 8 Oct, 2009 CSCI B522 Lecture 11 Naming and Scope 8 Oct, 2009 Lecture notes for CS 6110 (Spring 09) taught by Andrew Myers at Cornell; edited by Amal Ahmed, Fall 09. 1 Static vs. dynamic scoping The scope of a variable

More information

Chapter 1. Fundamentals of Higher Order Programming

Chapter 1. Fundamentals of Higher Order Programming Chapter 1 Fundamentals of Higher Order Programming 1 The Elements of Programming Any powerful language features: so does Scheme primitive data procedures combinations abstraction We will see that Scheme

More information

List Functions, and Higher-Order Functions

List Functions, and Higher-Order Functions List Functions, and Higher-Order Functions Björn Lisper Dept. of Computer Science and Engineering Mälardalen University bjorn.lisper@mdh.se http://www.idt.mdh.se/ blr/ List Functions, and Higher-Order

More information

CITS2210 Object-Oriented Programming. Topic 10. Java: Nested and Inner Classes

CITS2210 Object-Oriented Programming. Topic 10. Java: Nested and Inner Classes CITS2210 Object-Oriented Programming Topic 10 Java: Nested and Inner Classes Summary: Nested and inner classes allow classes do be defined within other classes, and even within bodies of methods. They

More information

Functional Programming and Haskell

Functional Programming and Haskell Functional Programming and Haskell Tim Dawborn University of Sydney, Australia School of Information Technologies Tim Dawborn Functional Programming and Haskell 1/22 What are Programming Paradigms? A programming

More information

Introduction to ML. Mooly Sagiv. Cornell CS 3110 Data Structures and Functional Programming

Introduction to ML. Mooly Sagiv. Cornell CS 3110 Data Structures and Functional Programming Introduction to ML Mooly Sagiv Cornell CS 3110 Data Structures and Functional Programming Typed Lambda Calculus Chapter 9 Benjamin Pierce Types and Programming Languages Call-by-value Operational Semantics

More information

Chapter 8 Statement-Level Control Structure

Chapter 8 Statement-Level Control Structure Chapter 8 Statement-Level Control Structure To make programs more flexible and powerful: Some means of selecting among alternative control flow paths. Selection statement (conditional statements) Unconditional

More information

CS 209 Functional Programming

CS 209 Functional Programming CS 209 Functional Programming Lecture 03 - Intro to Monads Dr. Greg Lavender Department of Computer Science Stanford University "The most important thing in a programming language is the name. A language

More information

A Second Look At ML. Chapter Seven Modern Programming Languages, 2nd ed. 1

A Second Look At ML. Chapter Seven Modern Programming Languages, 2nd ed. 1 A Second Look At ML Chapter Seven Modern Programming Languages, 2nd ed. 1 Outline Patterns Local variable definitions A sorting example Chapter Seven Modern Programming Languages, 2nd ed. 2 Two Patterns

More information

Chapter 8. Statement-Level Control Structures

Chapter 8. Statement-Level Control Structures Chapter 8 Statement-Level Control Structures Chapter 8 Topics Introduction Selection Statements Iterative Statements Unconditional Branching Guarded Commands Conclusions 1-2 Levels of Control Flow Within

More information

Name Section Number. CS210 Exam #4 *** PLEASE TURN OFF ALL CELL PHONES*** Practice

Name Section Number. CS210 Exam #4 *** PLEASE TURN OFF ALL CELL PHONES*** Practice Name Section Number CS210 Exam #4 *** PLEASE TURN OFF ALL CELL PHONES*** Practice All Sections Bob Wilson OPEN BOOK/OPEN NOTES You will have all 90 minutes until the start of the next class period. Spend

More information

MCSA Universal Windows Platform. A Success Guide to Prepare- Programming in C# edusum.com

MCSA Universal Windows Platform. A Success Guide to Prepare- Programming in C# edusum.com 70-483 MCSA Universal Windows Platform A Success Guide to Prepare- Programming in C# edusum.com Table of Contents Introduction to 70-483 Exam on Programming in C#... 2 Microsoft 70-483 Certification Details:...

More information

Closures. Mooly Sagiv. Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming

Closures. Mooly Sagiv. Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming Closures Mooly Sagiv Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming t ::= x x. t t t Call-by-value big-step Operational Semantics terms variable v ::= values abstraction x.

More information

CSC 1052 Algorithms & Data Structures II: Lists

CSC 1052 Algorithms & Data Structures II: Lists CSC 1052 Algorithms & Data Structures II: Lists Professor Henry Carter Spring 2018 Recap Collections hold and access elements based on content Order and index no longer considered Comparable elements implement

More information

CSCE 314 Programming Languages

CSCE 314 Programming Languages CSCE 314 Programming Languages Haskell 101 Dr. Hyunyoung Lee 1 Contents 1. Historical Background of Haskell 2. Lazy, Pure, and Functional Language 3. Using ghc and ghci 4. Functions 5. Haskell Scripts

More information

Scala. Fernando Medeiros Tomás Paim

Scala. Fernando Medeiros Tomás Paim Scala Fernando Medeiros fernfreire@gmail.com Tomás Paim tomasbmp@gmail.com Topics A Scalable Language Classes and Objects Basic Types Functions and Closures Composition and Inheritance Scala s Hierarchy

More information