kill whitespace: was any of it significant markdown?
[lambda.git] / topics / week1.mdwn
index 430cc5d..5ab30bc 100644 (file)
@@ -81,7 +81,7 @@ I've started throwing in some **variables**. We'll say variables are any express
     x?
     xs
 
-We'll follow a *convention* of using variables with short names and a final `s` to represent collections like sequences (to be discussed below). But this is just a convention to help us remember what we're up to, not a strict rule of the language. We'll also follow a convention of only using variables ending in `?` to represent functions that return a boolean value. Thus, for example, `zero?` will be a function that expects a single number argument and returns a boolean corresponding to whether that number is `0`. `odd?` will be a function that expects a single number argument and returns a boolean corresponding to whether than number is odd. Above, I suggested we might use `lessthan?` to represent a function that expects *two* number arguments, and again returns a boolean result. 
+We'll follow a *convention* of using variables with short names and a final `s` to represent collections like sequences (to be discussed below). But this is just a convention to help us remember what we're up to, not a strict rule of the language. We'll also follow a convention of only using variables ending in `?` to represent functions that return a boolean value. Thus, for example, `zero?` will be a function that expects a single number argument and returns a boolean corresponding to whether that number is `0`. `odd?` will be a function that expects a single number argument and returns a boolean corresponding to whether than number is odd. Above, I suggested we might use `lessthan?` to represent a function that expects *two* number arguments, and again returns a boolean result.
 
 We also conventionally reserve variables ending in `!` for a different special class of functions, that we will explain later in the course.
 
@@ -383,7 +383,7 @@ is a pattern, meaning the same as `x1 & x2 & []`. Note that while `x & xs` match
 For the time being, these are the only patterns we'll allow. But since the definition of patterns is recursive, this permits very complex patterns. What would this evaluate to:
 
     let
-      ([xs, ys], [z:zs, ws]) match ([[], [1]], [[10, 20, 30], [0]])
+      ([xs, ys], [z & zs, ws]) match ([[], [1]], [[10, 20, 30], [0]])
     in z & ys
 
 Also, we will permit complex patterns in λ-expressions, too. So you can write:
@@ -610,13 +610,13 @@ The `x` in `F x` and in `H x` are governed by the outermost quantifier, and only
 
 This was a lot of material, and you may need to read it carefully and think about it, but none of it should seem profoundly different from things you're already accustomed to doing. What we worked our way up to was just the kind of recursive definitions of `factorial` and `length` that you volunteered in class, before learning any programming.
 
-You have all the materials you need now to do this week's [[assignment|assignment1]]. Some of you may find it easy. Many of you will not. But if you understand what we've done here, and give it your time and attention, we believe you can do it.
+You have all the materials you need now to do this week's [[assignment|/exercises/assignment1]]. Some of you may find it easy. Many of you will not. But if you understand what we've done here, and give it your time and attention, we believe you can do it.
 
 There are also some [[advanced notes|week1 advanced notes]] extending this week's material.
 
 ### Summary ###
 
-Here is the hierarcy of **values** that we've talked about so far.
+Here is the hierarchy of **values** that we've talked about so far.
 
 *   Multivalues
 *   Singular values, including:
@@ -626,16 +626,19 @@ Here is the hierarcy of **values** that we've talked about so far.
             *   Booleans (or truth-values)
         *   Functions: these are not literals, but instead have to be generated by evaluating complex expressions
     *   Containers, including:
-        *   the literals `[]` and `{}`
-        *   Non-empty sequences
-        *   Non-empty sets
+        *   the **literal containers** `[]` and `{}`
+        *   Non-empty sequences, built using `&`
+        *   Non-empty sets, built using `&`
         *   Tuples proper and other containers, to be introduced later
 
 We've also talked about a variety of **expressions** in our language, that evaluate down to various values (if their evaluation doesn't "crash" or otherwise go awry). These include:
 
 *   All of the literal atoms and literal containers
 *   Variables
-*   Various complex expressions, built using `&` or λ or `let` or `letrec` or `case`
+*   Complex expressions that apply `&` or some variable understood to be bound to a function to some arguments
+*   Various other complex expressions involving λ or `let` or `letrec` or `case`
 
 The special syntaxes `[10, 20, 30]` are just shorthand for the more offical syntax using `&` and `[]`, and likewise for `{10, 20, 30}`. The `if ... then ... else ...` syntax is just shorthand for a `case`-construction using the literal patterns `'true` and `'false`.
 
+We also talked about **patterns**. These aren't themselves expressions, but form part of some larger expressions.
+