[Haskell-cafe] Comments on Haskell 2010 Report
Julian Fleischer
julian.fleischer at fu-berlin.de
Sat Jul 10 18:40:07 EDT 2010
Hi wren,
>> x**0 := 1, by convention.
> [...]
> So far as I'm aware, the x**0=1 vs 0**y=0 conflict leads to 0**0 [being] undefined
x**0 is 1 /by definition, 0**y naturally is 0, since (for example) 0**2 expands to 0*0 (being 0 of course). So there is not a conflict of two definitions, it's simply a definition somehow /overriding/ the natural attempt. I guess I'm actually messing things up using the word "natural" - how can "expand the multiplication of zero with itself zero times" be natural?
> [...] more helpful in mathematics.
> </source-please>
Try it yourself:
* Prove the binomial theorem *without* the convention 0**0 := 1
* Consider the function f(x) := x**0 - is it continuous (over the set of natural numbers including zero)?
Donald E. Knut writes on the issue [1] (see page 6 of the generated output), defending the position x**0 being 1.
Further: C99, Java define it that way. GHC does it that way.
Standard Prelude of Haskell 98 Report defines ^ (** for natural numbers) as "x ^ 0 = 1" [sic]
The convention is also used in 6.4.3: "The value of x^0 or x^^0 is 1 for any x, including zero" [2]
I know it's about "^" in that section, but why should x^0 be 1 and x**0 be undefined? (or: is the natural zero not the real zero?)
greetings,
Julian
[1] http://www-cs-faculty.stanford.edu/~knuth/papers/tnn.tex.gz
[2] http://www.haskell.org/onlinereport/basic.html#sect6.4.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3633 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20100710/03fa30c4/smime.bin
More information about the Haskell-Cafe
mailing list