From 0a79dcf4126a156832cb7e1ed391bc849fc29cda Mon Sep 17 00:00:00 2001 From: "Yann Esposito (Yogsototh)" Date: Tue, 5 Jun 2012 15:38:57 +0200 Subject: [PATCH] Fixed many script + a bit of intro --- 00_Introduction.lhs | 4 ++++ 01_Introduction/hglmandel.lhs | 20 ++++++++++++-------- config.ymd | 25 +++++++++++++++++++++++++ create_ymd.sh | 32 ++------------------------------ prev | 14 ++++++++++++-- 5 files changed, 55 insertions(+), 40 deletions(-) create mode 100755 config.ymd diff --git a/00_Introduction.lhs b/00_Introduction.lhs index 4ca3b94..1c5e329 100644 --- a/00_Introduction.lhs +++ b/00_Introduction.lhs @@ -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 diff --git a/01_Introduction/hglmandel.lhs b/01_Introduction/hglmandel.lhs index 20206fd..c1da268 100644 --- a/01_Introduction/hglmandel.lhs +++ b/01_Introduction/hglmandel.lhs @@ -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 $$ diff --git a/config.ymd b/config.ymd new file mode 100755 index 0000000..6ff7911 --- /dev/null +++ b/config.ymd @@ -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. + + diff --git a/create_ymd.sh b/create_ymd.sh index 0576ce7..6d6d9af 100755 --- a/create_ymd.sh +++ b/create_ymd.sh @@ -1,7 +1,7 @@ #!/usr/bin/env zsh function writeTOC() { - # Create the TOC + cat <

Table of Content
> @@ -12,34 +12,7 @@ END } - - -cat <' $fic | wc -l) > 0 )) ((contains_haskell)) && \ diff --git a/prev b/prev index 5505f8b..896738d 100755 --- a/prev +++ b/prev @@ -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