CSE 341 Section 2.

Slides:



Advertisements
Similar presentations
Why not just use Arrays? Java ArrayLists.
Advertisements

Introduction to Assembly language
Hand Trace and Output for: int digit = 0; int number = 1423; do { digit = number % 10; System.out.println(digit); number = number / 10; } while (number.
Programming Languages Section 1 1 Programming Languages Section 1. SML Fundamentals Xiaojuan Cai Spring 2015.
CSE341: Programming Languages Lecture 12 Equivalence Dan Grossman Spring 2013.
Operator. Assignation (=). The assignation operator serves to assign a value to a variable. a = 5; It is necessary to emphasize that the assignation operation.
Chapter 4.1 Solving Systems of Linear Equations in two variables.
Patterns in OCaml functions. Formal vs. actual parameters Here's a function definition (in C): –int add (int x, int y) { return x + y; } –x and y are.
CSE 311 Foundations of Computing I Lecture 17 Structural Induction: Regular Expressions, Regular Languages Autumn 2011 CSE 3111.
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #005 (April somthin, 2015)
PHP Logic. Review: Variables Variables: a symbol or name that stands for a value – Data types ( Similar to C++ or Java): Int, Float, Boolean, String,
CMP-MX21: Lecture 4 Selections Steve Hordley. Overview 1. The if-else selection in JAVA 2. More useful JAVA operators 4. Other selection constructs in.
Textbook Section 6-2.  Students can solve a system of equations using substitution.  Students can classify systems as consistent, inconsistent, dependent,
Combine Like terms Simplify 3x+2x= 3x+2y+2x+7y= 3x+5x-2= 14x+y-2x+4y-7= Slide 1- 2.
Sets and Maps Computer Science 4 Mr. Gerb Reference: Objective: Understand the two basic applications of searching.
A: A: double “4” A: “34” 4.
Solving Quadratic Equations Using the Zero Product Property March 18, 2014.
 2007 Pearson Education, Inc. All rights reserved. A Simple C Program 1 /* ************************************************* *** Program: hello_world.
CSE 311 Foundations of Computing I Lecture 19 Recursive Definitions: Context-Free Grammars and Languages Autumn 2012 CSE
CSE-321 Programming Languages Introduction to Functional Programming POSTECH March 8, 2006 박성우.
Identities, Contradictions and Conditional Equations.
Expressions and Assignment
CSE 341 Section 1 (9/28) With thanks to Dan Grossman, et. al. from previous versions of these slides.
CSE341: Programming Languages Lecture 4 Records, Datatypes, Case Expressions Dan Grossman Autumn 2017.
Theory of Computation Lecture 4: Programs and Computable Functions II
Agenda Warmup Finish 2.4 Assignments
CSE341: Programming Languages Lecture 4 Records, Datatypes, Case Expressions Dan Grossman Winter 2013.
Section 2 – CSE341 Patrick Larson, Spring 2013.
CS230 Tutorial Week 3.
CSE 311 Foundations of Computing I
CSE341: Programming Languages Lecture 4 Records, Datatypes, Case Expressions Dan Grossman Spring 2017.
CSE341: Programming Languages Section 1
Programming in C# Comparison (Sorting)
Section 2 – CSE341 Konstantin Weitz.
CSE341: Programming Languages Section 1
Nicholas Shahan Spring 2016
Nicholas Shahan Spring 2016
CSE341: Programming Languages Lecture 4 Records, Datatypes, Case Expressions Dan Grossman Winter 2018.
CSE341: Programming Languages Lecture 12 Equivalence
Agenda SML Docs First-Class Functions Examples Standard Basis
Agenda SML Docs First-Class Functions Examples Standard Basis
CSE 341 Section 7 Winter 2018 Adapted from slides by Eric Mullen, Nicholas Shahan, Dan Grossman, and Tam Dang.
CSE 341 Section 2 Winter 2018 Adapted from slides by Nick Mooney, Nicholas Shahan, Patrick Larson, and Dan Grossman.
Patterns to KNOW.
Lesson Objective: I will be able to …
Conditions and Boolean Expressions
CSE 341 Section 5 Winter 2018.
CSE 341 PL Section 2 Justin Harjanto.
CSE341: Programming Languages Lecture 4 Records, Datatypes, Case Expressions Dan Grossman Autumn 2018.
CSE341: Programming Languages Lecture 12 Equivalence
CSE341: Programming Languages Lecture 12 Equivalence
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Spencer Pearson Spring 2017
CISC124 Labs start this week in JEFF 155.
CSE 341 Section 2 Nick Mooney Spring 2017
Lecture Notes – Week 4 Chapter 5 (Loops).
CSE 341 Section 3 Nick Mooney Spring 2017.
CSE341: Programming Languages Lecture 4 Records, Datatypes, Case Expressions Dan Grossman Spring 2016.
CSE341: Programming Languages Lecture 12 Equivalence
Theory of Computation Lecture 4: Programs and Computable Functions II
Programming Fundamentals Lecture #4 Overview of Computer Programming
Data Types Every variable has a given data type. The most common data types are: String - Text made up of numbers, letters and characters. Integer - Whole.
Variables and Equations
Agenda Warmup Review Finish 1.2 Assignments Lesson 1.3 (If Statements)
AP Statistics Warm-up: Problem 5.26.
CSE341: Programming Languages Lecture 12 Equivalence
CSE341: Programming Languages Lecture 4 Records, Datatypes, Case Expressions Dan Grossman Spring 2019.
CSE341: Programming Languages Section 1
CSE341: Programming Languages Lecture 12 Equivalence
Agenda Warmup Review Finish 1.2 Assignments Lesson 1.3 (If Statements)
Presentation transcript:

CSE 341 Section 2

Me Eric Mullen (the one with the nails) One of the two section leaders First year PhD student, doing research in programming languages I've never been a TA for this PL course before, but...

Type Synonyms What if I want to call an int * int * int a date? type date = int * int * int

Generic Types, and Type Generality What is this 'a thing anyway? It can stand for any type, but only one type. It is often referred to as a type variable. You've seen lists, which can hold ints, or strings, but can't hold both at the same time. Lists have type 'a list

Type Generality, continued What does it mean for one type to be more general than another? Type t1 is more general than t2 if you can consistently replace type variables in t1 with types (or type variables) to get t2.

Which is more general? ('a,'b) -> 'a ('a,int) -> 'a int list -> int 'a list -> int ('a,'b,'b) -> 'a (int,'b,'c) -> int

Equality types What if I want to write code that works over any type, but I want to be able to compare whether an 'a is equal to another 'a?

Function Patterns These are just syntactic sugar, not a fundamentally new concept. fun isEmpty(l) = case l of [] => true | x::xs => false fun isEmpty([]) = true | isEmpty(x::xs) = false

Is if/then/else really necessary? Suppose I tell you there's a bug in the SML compiler, and you can't use if/then/else any more. Also, I want all of your code checked in and working yesterday. What do you do?