Better introduction

This commit is contained in:
Yann Esposito 2012-06-15 12:18:16 +02:00
parent c9c91cda80
commit dc8f360e88

View file

@ -1,18 +1,20 @@
## Introduction
I wanted to go further than my
[preceding article](/Scratch/en/blog/Haskell-the-Hard-Way/) in which I introduced Haskell.
In my
[preceding article](/Scratch/en/blog/Haskell-the-Hard-Way/) I introduced Haskell.
Instead of arguing that Haskell is better, because it is functional and "Functional Programming! Yeah!", I'll give an example of what benefit
functional programming can provide.
This article go further.
It will show how to use functional programming with interactive programs.
But more than that, it will show how to organize your code in a functional way.
This article is more about functional paradigm than functional language.
The code organization can be used in most imperative language.
As Haskell is designed for functional paradigm, it is easier to talk about functional paradigm using it.
In reality, in the firsts sections I use an imperative paradigm.
As Haskell is designed for functional paradigm, it is easier to use in this context.
In reality, the firsts sections will use an imperative paradigm.
As you can use functional paradigm in imperative language,
you can also use imperative paradigm in functional languages.
This article is about creating a useful program.
This article is about creating a useful and clean program.
It can interact with the user in real time.
It uses OpenGL, a library with imperative programming foundations.
But the final code will be quite clean.
@ -25,27 +27,26 @@ I believe the main audience for this article are:
- Fractal lovers and in particular 3D fractal.
- Game programmers (any language)
I wanted to talk about something cool.
For example I always wanted to make a Mandelbrot set explorer.
I had written a [command line Mandelbrot set generator in Haskell](http://github.com/yogsototh/mandelbrot.git).
The cool part of this utility is that it use all the cores to make the computation (it uses the `repa` package)[^001].
I had in mind for some time now to make a Mandelbrot set explorer.
I had already written a [command line Mandelbrot set generator in Haskell](http://github.com/yogsototh/mandelbrot.git).
This utility is highly parallel; it uses the `repa` package[^001].
[^001]: Unfortunately, I couldn't make this program to work on my Mac. More precisely, I couldn't make the [DevIL](http://openil.sourceforge.net/) library work on Mac to output the image. Yes I have done a `brew install libdevil`. But even a minimal program who simply write some `jpg` didn't worked.
[^001]: Unfortunately, I couldn't make this program to work on my Mac. More precisely, I couldn't make the [DevIL](http://openil.sourceforge.net/) library work on Mac to output the image. Yes I have done a `brew install libdevil`. But even a minimal program who simply write some `jpg` didn't worked. I tried both with `Haskell` and `C`.
This time, we will display the Mandelbrot set extended in 3D using OpenGL and Haskell.
You will be able to move it using your keyboard.
This object is a Mandelbrot set in the plan (z=0),
and something nice to see in 3D.
Here is what you'll end with:
Here are some screenshots of the result:
blogfigure("GoldenMandelbulb.png","The entire Mandelbulb")
blogfigure("3DMandelbulbDetail.png","A Mandelbulb detail")
blogfigure("3DMandelbulbDetail2.png","Another detail of the Mandelbulb")
And here are the intermediate steps:
And you can see the intermediate steps to reach this goal:
blogimage("HGL_Plan.png","The parts of the article")
From the 2nd section to the 4th it will be _dirtier_ and _dirtier_.
We start cleaning everything at the 5th section.
We start cleaning the code at the 5th section.