(me:)
> >and it's really nice if you can write f(...,y+1) = ... (... y)
> >instead of f(...,y) = ... (... y-1)
(Craig Dickson:)
> Why do you find this makes a significant difference? Personally, I find
> f x = ... f (x - 1)
> much more intuitive than
> f (x + 1) = ... f x
what we tell the students is basically this:
data Natural = Zero | Successor Natural
so a function definition that does pattern matching
on these constructors looks ... well, natural:
f Zero = ... ; f (Successor x) = .... x ...
however a definition that goes like
f x = ... (x - 1)
had to use an "if" clause (to distinguish from f 0)
(or you get overlapping patterns), and subtraction.
but these are concepts that are secondary
(i. e. you want to prove to students
that they can be expressed by primitive recursion).
(Brian Boutel:)
> The problem is that dropping (n+k) would break lots of stuff -
> but probably more textbooks than programs.
indeed. perhaps the morale is: if you want Peano numerals,
define them on your own (the "data" declaration above).
--
Dr. Johannes Waldmann Institut fur Informatik Universitat Leipzig
[EMAIL PROTECTED] http://www.informatik.uni-leipzig.de/~joe/
Augustusplatz, D-04109 Leipzig, Germany, Tel/Fax (+49) 341 97 32 204/209