fix links
[lambda.git] / rosetta1.mdwn
index d1fd7ef..6cd0ab1 100644 (file)
@@ -94,7 +94,7 @@ not:
     + 1 2
 
 <a id=pre-curried></a>
-But all three of these languages permits you to enclose an infix operator in parentheses to make a *section*, which no longer has infix syntax. In Kapulet, `( + )` is the same as &lambda; `(x, y). x + y`, whereas in OCaml and Haskell it's a *curried* function, which we can write (in Kapulet syntax) as &lambda; `x y. x + y`. We'll discuss [[sections|#sections]] and [[curried functions|#curried]] below.
+But all three of these languages permits you to enclose an infix operator in parentheses to make a *section*, which no longer has infix syntax. In Kapulet, `( + )` is the same as &lambda; `(x, y). x + y`, whereas in OCaml and Haskell it's a *curried* function, which we can write (in Kapulet syntax) as &lambda; `x y. x + y`. We'll discuss [[sections|rosetta1#sections]] and [[curried functions|rosetta1#curried]] below.
 
 Kapulet and OCaml have some variables made of (or spelled with) letters also taking infix syntax, such as `comp` in Kapulet or `mod` in OCaml. In Haskell, this is never the case: variables that are made of letters are only treated as function terms being applied to arguments *when they're at the start* of a list of expressions; and variables that are made of punctuation symbols, and not enclosed in parentheses, will only be treated as infix operators. However, Haskell permits you to temporarily "flag" a  function term made of letters to behave like an infix operator, by enclosing it in `` ` `` marks. Thus in Haskell you can write:
 
@@ -112,7 +112,7 @@ and the like. Moreover, in Scheme parentheses are never optional and never redun
 
 what that would mean is that `+` is first being applied to *zero* arguments, which is different from not applying it all. (In Kapulet, OCaml, and Haskell, one would write that `f` is being applied to "zero arguments" like this: `f ()`. We will discuss FIXME) Scheme helpfully defines the result of applying `+` to zero arguments to be `0`. So `((+) 3 2)` would evaluate to whatever `(0 3 2)` does, and that's an error, because `0` is not a function.
 
-Note that `(0 3 2)`, although it *is*, qua expression, a list of numbers, does not evaluate to a list. To get an expression that *evaluates to* that list, you'd have to use `(list 0 3 2)` or `'(0 3 2)`. (Notice the initial `'`.) More on this [[below|#writing-scheme-lists]].
+Note that `(0 3 2)`, although it *is*, qua expression, a list of numbers, does not evaluate to a list. To get an expression that *evaluates to* that list, you'd have to use `(list 0 3 2)` or `'(0 3 2)`. (Notice the initial `'`.) More on this [[below|rosetta1#writing-scheme-lists]].
 
 In Scheme, you can also write `(+ 3 2 10)`, and so on. You only have to write `(+ (+ 3 2) 10)` if you really want to.
 
@@ -176,7 +176,7 @@ There are just minor differences between these languages. First, OCaml doesn't h
 
 Second, as a special case, OCaml doesn't permit you to do this with its list cons-ing operator `::`. You have to write `fun x xs -> x :: xs`, not `( :: )`. Whereas in Kapulet `( & )`, `(x & )`, and `( & xs)` are all sections using its sequence cons-ing operator `&`; and in Haskell, `( : )`, `(x : )`, and `( : xs)` are the same.
 
-Third, as [[mentioned above|#pre-curried]], OCaml's and Haskell's `( + )` and the like evaluate to *curried* functions.
+Third, as [[mentioned above|rosetta1#pre-curried]], OCaml's and Haskell's `( + )` and the like evaluate to *curried* functions.
 
 Fourth, in Kapulet, `( - 10)` expresses &lambda; `x. x - 10` (consistently with `(10 - )`), but Haskell (and OCaml) treat this specific form differently, and interpret it as meaning the integer `- 10`. Here's how to express some things in Kapulet:
 
@@ -321,7 +321,7 @@ How does all this look in Scheme? Well, Scheme has a notion they call a (proper)
 2.  in the official Scheme standard, `list`s and `vector`s are both *mutable* containers, that is, one and the same persisting `list` structure can have different
 elements at different stages in a program's evaluation
 
-Many Scheme implementations also provide immutable versions of `list`s and `vector`s, more closely approximating the sequences/lists in Kapulet, Haskell, and OCaml. With some configurations, Racket even makes the immutable versions the defaults. But none of these are yet part of the official Scheme standard. Also, difference 1 is present in all Scheme implementations. This makes Scheme's `list`s and `vector`s in some ways more akin to *tuples* in the other languages (to "proper" tuples in Kapulet) (see [[below|#tuples]]).
+Many Scheme implementations also provide immutable versions of `list`s and `vector`s, more closely approximating the sequences/lists in Kapulet, Haskell, and OCaml. With some configurations, Racket even makes the immutable versions the defaults. But none of these are yet part of the official Scheme standard. Also, difference 1 is present in all Scheme implementations. This makes Scheme's `list`s and `vector`s in some ways more akin to *tuples* in the other languages (to "proper" tuples in Kapulet) (see [[below|rosetta1#tuples]]).
 
 <a id=writing-scheme-lists></a>
 There are also some differences in how `list`s are specified in Scheme versus the other languages. In Scheme, one writes the empty list like this:
@@ -499,7 +499,7 @@ You can also use more complex tests you write on the spot, or your own anteceden
       ((and (> x 10) (< x 20)) 'teenaged)
       (else 'unknown))
 
-Remember that in Scheme, an expression doesn't have to evaluate to `#t` to be treated as "truth-like". *Every* value other than `#f` is treated as truth-like. As I [[said before|#truth-like]] `(if 0 'zero 'nope)` evaluates to `'zero`.
+Remember that in Scheme, an expression doesn't have to evaluate to `#t` to be treated as "truth-like". *Every* value other than `#f` is treated as truth-like. As I [[said before|rosetta1#truth-like]] `(if 0 'zero 'nope)` evaluates to `'zero`.
 
 You may sometimes see Scheme `cond` constructions written with this kind of clause:
 
@@ -643,7 +643,7 @@ If you want to define some mutually recursive functions with `letrec`, OCaml use
       odd   = fun x -> if x = 0 then false else even x
     in ...
 
-Haskell has both of the syntactic forms that Kapulet does, though like OCaml, it uses `=` rather than `match`. And it wraps all the binding clauses with `{ ... }` (see [[earlier remarks|#haskell-whitespace]] about Haskell and whitespace/indentation):
+Haskell has both of the syntactic forms that Kapulet does, though like OCaml, it uses `=` rather than `match`. And it wraps all the binding clauses with `{ ... }` (see [[earlier remarks|rosetta1#haskell-whitespace]] about Haskell and whitespace/indentation):
 
     -- Haskell
     let {
@@ -762,7 +762,7 @@ evaluates the same as this:
             ... ; rest of program
                 )
 
-This is what we can call Scheme's [[fifth|#five-lets]] form of the `let` family.
+This is what we can call Scheme's [[fifth|rosetta1#five-lets]] form of the `let` family.
 
 Some versions of Scheme permit you also to include `define` inside some (but not all) complex expressions. Thus you can write: