update untyped code
[lambda.git] / rosetta1.mdwn
index 1c60367..70866b1 100644 (file)
@@ -2,7 +2,7 @@
 
 ## Can you summarize the differences between your made-up language and Scheme, OCaml, and Haskell? ##
 
-The made-up language we wet our toes in in week 1 is called Kapulet. (I'll tell you [the story behind its name](/randj.jpg) sometime.) The purpose of starting with this language is that it represents something of a center of gravity between Scheme, OCaml, and Haskell, and also lacks many of their idiosyncratic warts. One downside is that it's not yet implemented in a form that you can run on your computers. So for now, if you want to try out your code on a real mechanical evaluator, you'll need to use one of the other languages.
+The made-up language we wet our toes in in week 1 is called Kapulet. (I'll tell you [the story behind its name](/images/randj.jpg) sometime.) The purpose of starting with this language is that it represents something of a center of gravity between Scheme, OCaml, and Haskell, and also lacks many of their idiosyncratic warts. One downside is that it's not yet implemented in a form that you can run on your computers. So for now, if you want to try out your code on a real mechanical evaluator, you'll need to use one of the other languages.
 
 Also, if you want to read code written outside this seminar, or have others read your code, for these reasons too you'll need to make the shift over to one of the established languages.
 
@@ -110,7 +110,13 @@ Scheme has no infix operators. It ruthlessly demands that all functions to be ap
 
     (+ 3 2)
 
-and the like. Moreover, in Scheme parentheses are never optional and never redundant. In contexts like this, the parentheses are necessary to express that the function is being applied; `+ 3 2` on its own is not a complete Scheme expression. And if the `+` were surrounded by its own parentheses, as in:
+and the like. Here is an example where the function to be applied is the result of evaluating a more complex expression:
+
+    ((if #t + *) 3 2)
+
+which will evaluate to `5`, not `6`.
+
+In Scheme the parentheses are never optional and never redundant. In expressions like `(+ 3 2)`, the parentheses are necessary to express that the function is being applied; `+ 3 2` on its own is not a complete Scheme expression. And if the `+` were surrounded by its own parentheses, as in:
 
     ((+) 3 2)
 
@@ -209,7 +215,7 @@ Fourth, in Kapulet, `( - 10)` expresses λ `x. x - 10` (consistently with
     ( - 2)         # ( - 2) 10 == 8
     (0 - )
     ( - ) (5, 3)
-    
+
 
 and here are their translations into natural Haskell:
 
@@ -773,7 +779,7 @@ Notice that this form ends with `end`, not with `in result`. The above is roughl
       pat1  match expr1;
       ...
     in ... # rest of program or library
-    
+
 That is, the bindings initiated by the clauses of the `let` construction remain in effect until the end of the program or library. They can of course be "hidden" by subsequent bindings to new variables spelled the same way. The program:
 
     # Kapulet