CS 330 Lecture 33 – OOP and HOF via Scala
Agenda what ?s classes in Scala a sepia generator marching squares Intentions I can create classes and objects in Scala. I can reuse Java classes in Scala. I can write for-comprehensions, which are imperative-styled maps. TODO I recommend you walk through tutorials I and II on Simply Scala. No 1/4 sheet. Code Image.scala Main.scala Haiku
CS 330 Iso Homework – due before May 17
See the PDF.
CS 330 Lecture 32 – Filter and Memoization
Agenda what ?s program this type synonyms memoization Intentions I can use the filter pattern with custom predicates to extract a subset of data. I can employ memoization to cache and quickly recall the results of function calls. Program This Write a function maxAll that accepts a list of numbers and yields the maximum. Problems Write […]
CS 330 Lecture 31 – Maps, Filters, and Folds
Agenda what ?s a gallery of maps, filters, and folds pairs lambdas composition TODO On a 1/4 sheet, write these functions using map, filter, or fold: lengths, which accepts a list of strings and yields a list of all their lengths. For example, lengths [“a”, “bcd”, “efghi”] yields [1, 3, 5]. tweens, which accepts a low, a […]
CS 330 Lecture 30 – Pattern Matching, Partial Function Evaluation, and Map
Agenda what ?s more on pattern matching capitalize proportionalize at, a subscript operation partial function evaluation kthSmallest winner runnerUp the map pattern Intentions I can organize my solution to a problem by matching my data against patterns in case statements or function parameters. I can generate functions from other functions by partially applying a subset of their parameters. I […]
CS 330 Lecture 29 – Functional
Agenda what ?s what makes a language functional Haskell expressions functions lists pattern matching partial function application TODO Start the Funfun homework. Due before May 1. Pull down to get revised Funfun spec and fix in Timbre grader. See Piazza @16. No class on Friday. 1/4 sheet: Read first four chapters of Learn You a Haskell […]
CS 330 Funfun Homework – due before May 1
See the PDF.
CS 330 Lecture 28 – Parametric Polymorphism
Agenda what ?s program this the cost of subtype polymorphism a Set class in C++ a Set class in Java C++ templates vs. Java generics Learning Intentions I understand that some methods of making code reusable lead to costs in performance and error detection. I can use templates to achieve parametric polymorphism in C++. I […]
CS 330 Lecture 27 – Polymorphism
Agenda what ?s defining polymorphism theorize this what does this do? TODO 1/4 sheet: Read http://www.insomniacgames.com/tech/articles/0308/three_big_lies.php. (This page rendered improperly for me; I had to highlight the text to read it.) Read http://hacksoflife.blogspot.com/2008/04/what-is-oop-good-for.html. What do you think? Intentions I can define polymorphism and identify the benefits it confers upon developers like me. I can comprehend how dynamic dispatch […]
CS 330 Lecture 26 – C++ I/O, Overloading, References
Agenda what ?s the philosophy of Stroustrup C++ I/O builtin operators references const next up: polymorphism TODO 1/4 sheet: Scour the results of the 2015 Stack Overflow Developer Survey. What’s interesting? Surprising? Devastating? Encouraging? Where do you deviate? Where do you conform? Code Image.h Image.cpp main.cpp Haiku