Skip to content

Instantly share code, notes, and snippets.

@noelwelsh
Created March 13, 2020 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noelwelsh/17399d699c65b97def192ce06fb5c66e to your computer and use it in GitHub Desktop.
Save noelwelsh/17399d699c65b97def192ce06fb5c66e to your computer and use it in GitHub Desktop.
ScalaBridge Curriculum

Curriculum

Level One

Setup

  • VSCode or IntelliJ?

Expressions, Types, and Values

  • Literals
  • Expressions have types and produce values
  • Compound expressions
  • All values are objects
  • Method call syntax
    • dot notation
    • parameters

Workflow

  • Starting and stopping sbt
  • Wrapping code in object
  • Compiling code
  • Running code and using App
  • Experimenting in the console
  • sbt Workflow
  • TODO Decide on workflow. Are we going with Visual Studio Code or IntelliJ? How do we recommend running code (using run or console)?

Names and Substitution

  • Giving names to values
    • Motivation
  • Using names
    • Names abstract over expressions
  • The substitution model of evaluation
  • Order of evaluation
  • Local reasoning
  • TODO Consider breaking this up into smaller sections. It’s hard to understand the theory without getting some experience, and beginners probably want to get coding before they get a big dose of theory.

Art: Computing with Images

  • Doodle basics

Methods

  • Motivation
  • Method declaration syntax
  • Method call semantics
    • In terms of substitution
  • Methods generalize expressions

Structural Recursion over the Natural Numbers

  • Motivation
    • Do something a variable number of times
  • The natural numbers
    • Recursive definition
  • Structural recursion pattern
    • Structure of code follows structure of definition
    • Solve the cases
  • Reasoning about code
    • Operational reasoning: substitution
    • Denotational reasoning: what is the base case, what is the one-step recursive case?

Art: Structure in Recursion

  • Fractals

Level Two

Functions

  • Functions as values
  • Abstracting over expressions with functions
  • Parametric equations of curves
  • Function composition
  • Composition for parametric equations

Art: Animations

  • Animations as images displayed over time instead of space
  • Animation using reactors (or transducers?)
    • Structural recursion “unrolled” into a reactor
  • Parametric equations as reactors

Lists

  • Paths as lists of path elements
    • Local coordinate systems; bounding box and origin
  • Polygons as paths
  • Structural recursion over lists
  • `map` for transforming lists

Custom Data

  • Case classes as logical ands
  • Animations using custom data
    • Simple physics. Bouncing ball.

FlatMap

  • Changing length of a list to add and remove particles in a particle system
  • flatMap using structural recursion
  • flatMap as changing the length of a List
  • Responding to mouse events
  • Particle systems. Ripples. etc.

Project: Puzzle Game

  • Tile matching video game

Level Three

Algebraic Data Types and Structural Recursion 1: Ands and Ors

  • Modelling data in terms of ands and ors; sealed traits and final case classes
    • Non-recursive data
    • NOTE Keep examples concrete
  • Structural recursion (w/o recursion!)
    • Pattern matching (familiar by now)
    • Polymorphism
      • Abstract methods
  • State machines. FSM animations. E.g. exploding fireworks Or interacting FSMs? FSMs for modelling interaction?

Algebraic Data Types and Structural Recursion 2: Recursion

  • The recursion rule
  • Recursive data
  • Transforming recursive data
  • Grammars and l-systems

Functions and Generic Types

  • Generic types
  • Containers
  • Functions to work with generic types
  • kd-tree? Faster intersection tests?

Standard Library Types

  • Option, Either, Map
  • map, flatMap
  • find, exists

Map and FlatMap

  • We’ve already seen map, but review
  • flatMap
  • L-Systems again?

Fold

  • fold as an abstraction of structural recursion

Level Four

Type Classes and Implicits

  • Implicit parameters
  • Implicit values

Type Classes in Cats

  • Monoid
  • Monad
  • Applicative / Semigroupal

Probability Monad?

  • Generative art w/ randomisation

Level Five

FP Architecture?

Cats Effect?

Reification and Church Encoding?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment