Fixed many script + a bit of intro

This commit is contained in:
Yann Esposito (Yogsototh) 2012-06-05 15:38:57 +02:00
parent f774b17dec
commit 0a79dcf412
5 changed files with 55 additions and 40 deletions

View file

@ -2,6 +2,10 @@
TODO: write something nice after reading.
The B in Benoît B. Mandelbrot stand fro Benoît B. Mandelbrot
[^1]: [Source on reddit](http://www.reddit.com/r/math/comments/uirv8/are_math_jokes_okay_here_i_just_came_up_with_one/c4vr2zo)
Steps:
1. Mandelbrot set with Haskell OpenGL

View file

@ -1,16 +1,20 @@
## First version
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 first being mostly some boilerplate[^1].
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.
[^1]: 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.
I believe this concern can be generalized to the lack of namespace in Haskell.
### Let's play the song of our people
> import Graphics.Rendering.OpenGL
@ -140,10 +144,10 @@ Given two coordinates in pixels, it returns some integer value:
> in
> f (complex r i) 0 64
It uses the main mandelbrot function for each complex $c$.
It uses the main mandelbrot function for each complex \\(c\\).
The mandelbrot set is the set of complex number c such that the following sequence does not escape to infinity.
Let us define $f_c: \mathbb{C} \to \mathbb{C}$
Let us define \\(f_c: \mathbb{C} \to \mathbb{C}\\)
$$ f_c(z) = z^2 + c $$

25
config.ymd Executable file
View file

@ -0,0 +1,25 @@
-----
isHidden: false
menupriority: 1
kind: article
created_at: 2012-04-30T19:17:53+02:00
en: title: Haskell Working Program
en: subtitle: An OpenGL 3D extension of the Mandelbrot set
fr: title: Un programme Haskell fonctionnel
fr: subtitle: Une extension de l'ensemble de Mandelbrot en 3D et en OpenGL
author_name: Yann Esposito
author_uri: yannesposito.com
tags:
- Haskell
- programming
- functional
- tutorial
-----
blogimage("HGL_Plan.png","The plan in image")
begindiv(intro)
en: %tldr A progressive real world example.
fr: %tlal Un exemple progressif de programmation avec Haskell.

View file

@ -1,7 +1,7 @@
#!/usr/bin/env zsh
function writeTOC() {
# Create the TOC
cat <<END
> <center><hr style="width:30%;float:left;border-color:#CCCCD0;margin-top:1em"/><span class="sc"><b>Table of Content</b></span><hr style="width:30%;float:right;border-color:#CCCCD0;margin-top:1em"/></center>
>
@ -12,34 +12,7 @@ END
}
cat <<END
-----
isHidden: false
menupriority: 1
kind: article
created_at: 2012-04-30T19:17:53+02:00
en: title: Haskell OpenGL Mandelbrot
en: subtitle: A kind of real world example
fr: title: Afficher mandelbrot en OpenGL avec Haskell
fr: subtitle: Un exemple d'utilisation d'Haskell
author_name: Yann Esposito
author_uri: yannesposito.com
tags:
- Haskell
- programming
- functional
- tutorial
-----
blogimage("mandelbrot_3D.png","3D Mandelbrot Set")
begindiv(intro)
en: %tldr A progressive real world example.
fr: %tlal Un exemple progressif de programmation avec Haskell.
END
cat config.ymd
writeTOC
@ -49,7 +22,6 @@ enddiv
END
for fic in **/*.lhs(.N); do
contains_haskell=$(( $( egrep '^>' $fic | wc -l) > 0 ))
((contains_haskell)) && \

14
prev
View file

@ -2,12 +2,22 @@
webroot="$HOME/Sites/webroot"
print -- "Search script"
while [[ ! -x ./create_ymd.sh ]]; do
[[ $PWD = "/" ]] && {
print -- "Error: can't find create_ymd.sh" >&2
exit 1
}
cd ..
done
print -- "Create article"
./create_ymd.sh > $webroot/latest.ymd
print -- "Copy sources"
print -- "Copy source codes"
latestArticleDir=$(ls -l $webroot/latest.ymd | perl -pi -e 's#.*/##; s#.md$##')
for langue in en fr; do
dst="$webroot/output/Scratch/$langue/blog/Haskell-OpenGL-Mandelbrot/code"
dst="$webroot/output/Scratch/$langue/blog/$latestArticleDir/code"
[[ ! -d $dst ]] && mkdir -p $dst
cp -r *.lhs ??_*(N/) $dst
done