Courses

Scala Intro

================================ Lecture 6.1: Other Collections ================================ Other Sequences another Seq implementation, Vector has more evenly balanced access patterns than List recall that lists are linear, access to the first elem is faster than access to the middle or end of a list Vector essentially, a very shallow tree A vector of up to 32 elements is just an array, where the elements are stored in sequence.

Scala Intro

================================ Lecture 5.1: More Functions on Lists ================================ Sublists and element access: xs.head xs.tail (all elements except head) xs.length xs.last xs.init => list of all elements of xs exccept the last one (last) xs take n => list of first n elements xs drop n => remaining sublist after taking n elements xs(n) => element of xs at index n Creating New Lists: xs ++ ys: concatenation; xs.

Scala Intro

Lecture 4.1: Objects Everywhere: Pure Object Orientation in which every value is an object if lang is based on classes, this means that the type of each value is also a class what about primitive types? Standard Classes: Pure Booleans the Boolean type maps to the JVM's primitive type boolean but you could define it as a class just as well without any changes in user code thus, scala can be considered Pure OO based on the language's capabilities from test4.

Scala Intro

Week 3: Data and Abstraction Lecture 3.1: CLass Hierarchies: Class Hierarchies: CLasses that extend eachother model of evluation changes method calls might depend on runtime type of receiver of a given method –> dynamic binding revisit family writing Abstract Class Abstract classes can contain members which are missing an implementation abstract class IntSet { def incl(x: Int): IntSet def containes(x: Int): Boolean } IntSet itself cannot be instantiated, must be suplemented by classes that extend it References for Sets represented as binary trees:

Scala Intro

Week 2 Outline: Higher Order Functions Lecture 2.1: Higher-Order Functions: FP languages treat functions as first class values function can be passed as a parameter and returned as a result higher order functions take other functions as parameters or return functions as results, as opposed to first order functions There are many variations of the pattern, $\sum_{x=1}^n f(x)$, and we can generalize this pattern using higher order functions

Scala Intro

The following series of notes and related resources were compiled while taking Martin Odersky's Coursera course, Functional Programming Principles in Scala. I plan to use these as a reference for myself, to review concepts and examples from the course in the future. Also plan to further elaborate on external links I include here. Week 1 Outline: Getting Started + Functions & Evaluation Why Scala? Concurrency and Parallelism, see Working Hard to Keep It Simple, 2011