Spell correction

This commit is contained in:
Yann Esposito 2012-05-23 17:47:16 +02:00
parent d8ced3db48
commit 283da1b418

View file

@ -1,15 +1,15 @@
## First version
I splitted even the first version in two parts.
We can consider two parts.
The first being mostly some boilerplate.
Generally in Haskell you need to declare a lot of import lines.
This is something I find annoying.
In particular, it should be possible to create a special file, Import.hs
which make all the necessary import for you, as you generally need them all.
I understand why this is cleaner to force the programmer not to do so, but, each time I do a copy/paste, I feel something is wrong.
The second part, contain more interresting stuff.
The second part, contain more interesting stuff.
Even in this part, there are some necessary boilerplate.
But it is due to the OpenGL library this time.
But it is due to the OpenGL library this time.
### Let's play the song of our people
@ -65,7 +65,7 @@ We start by giving the main architecture of our program:
> -- We enter the main loop
> mainLoop
The only interresting part is we declared that the function `display` will be used to render the graphics:
The only interesting part is we declared that the function `display` will be used to render the graphics:
> display = do
> clear [ColorBuffer] -- make the window black
@ -73,7 +73,7 @@ The only interresting part is we declared that the function `display` will be us
> preservingMatrix drawMandelbrot
> swapBuffers -- refresh screen
Also here, there is only one interresting part,
Also here, there is only one interesting part,
the draw will occurs in the function `drawMandelbrot`.
Now we must speak a bit about how OpenGL works.
@ -147,11 +147,11 @@ Let us define $f_c: \mathbb{C} \to \mathbb{C}$
$$ f_c(z) = z^2 + c $$
The serie is:
The sequence is:
$$ 0 \rightarrow f_c(0) \rightarrow f_c(f_c(0)) \rightarrow \cdots \rightarrow f^n_c(0) \rightarrow \cdots $$
Of course, instead of trying to test the real limit, we just make a test after a finite number of occurences.
Of course, instead of trying to test the real limit, we just make a test after a finite number of occurrences.
> f :: Complex -> Complex -> Int -> Int
> f c z 0 = 0
@ -163,12 +163,12 @@ Well, if you download this lhs file, compile it and run it this is the result:
blogimage("hglmandel_v01.png","The mandelbrot set version 1")
A first very interresting property of this program is that the computation for all the points is done only once.
A first very interesting property of this program is that the computation for all the points is done only once.
The proof is that it might be a bit long before a first image appears, but if you resize the window, it updates instantaneously.
This property is a direct consequence of purity.
If you look closely, you see that `allPoints` is a pure list.
Therefore, calling `allPoints` will always render the same result.
While Haskell doesn't grabage collect `allPoints` the result is reused for free.
While Haskell doesn't garbage collect `allPoints` the result is reused for free.
We didn't specified this value should be saved for later use.
It is saved for us.
@ -176,7 +176,7 @@ See what occurs if we make the window bigger:
blogimage("hglmandel_v01_too_wide.png","The mandelbrot too wide, black lines and columns")
Wep, we see some black lines.
Why? Simply because we drawed less point than there is on the surface.
Yep, we see some black lines.
Why? Simply because we drawn less point than there is on the surface.
We can repair this by drawing little squares instead of just points.
But, instead we will do something a bit different and unusual.