Recursion schemes are cool but taught badly.
They're functions that describe a pattern of recursion.
Common kinds include:
- Collapsers: go from bundle of things to a single thing (folds, catamorphisms)
#[rustfmt::skip] | |
fn linear_distance( | |
[x0, y0]: &[f64; 2], | |
[x1, y1]: &[f64; 2], | |
) -> f64 | |
{ | |
let y_component = (y1 - y0).powi(2); | |
let x_component = (x1 - x0).powi(2); | |
(y_component + x_component).sqrt() |
In the process of converting to an RFC format
The following are questions you should be able to answer, and the study of which should be sufficient to succeed in the final exam. These questions are compiled from previous reading, quizzes, and labs. These items are in no particular order.
Welcome to the first of two labs on Prolog! Prolog is a language very different from the ones you've seen so far. Don't worry too much about being productive in it. Just try and focus on the ideas from Prolog that we're focusing on. (Of course, if you find it interesting, then by all means dive in deeper than we go in these labs!)
Prolog is a logic programming language, this is a programming paradigm that looks like and works similarly to formal logic.
Before we dive deeper, let's talk a bit about logic.
In this lab we will be talking about some common and important concepts and patterns in object–oriented design. These are not specific to Java, but we will of course be using Java as the illustrating language.
SOLID is an acronym for five of the most important ideas in object–oriented design:
In this lab we will cover classes, objects, subclassing, composition vs. inheritance, subtype polymorphism, and abstract data types.
This is our first lab with Java, so before anything else, let’s talk a bit about how compilation works in Java.
In Java, you write separate .java
files, each of which contains a single class. The name of the file must exactly match the name of the class contained within; so a file called Blah.java
must contain a class called Blah
.
In this lab we will walk through the ways in which Rust’s design facilitates safety, how Rust’s safety guarantees interact with its low-level programming capabilities, and how Rust’s definition of safety interacts with our understanding of security in low-level programming.
Rust is actually split into two languages: Safe Rust and Unsafe Rust. So far in this class we’ve been working with Safe Rust, but in this lab we’re going to get into Unsafe Rust.
The key difference between Safe Rust and Unsafe Rust is that in Safe Rust, the compiler checks your work. It makes sure that nothing you write violates the rules Rust has. In Unsafe Rust, the compiler doesn’t check everything, and instead just assumes you’ve checked the code yourself.
In today's lab we will introduce the Rust programming language, and the core ideas Rust uses to ensure memory safety without manual memory management or garbage collection. These core ideas are ownership, borrowing, and lifetimes.
Today's lab will be accompanied by copious examples in person, so be sure to show up on time and follow along as we work through them.