Merge branch 'master' into next

Conflicts:
	.gitignore
	Rules
	img_latest_blog_dir
	latest.ymd
	output/Scratch/en/blog/2010-05-24-Trees--Pragmatism-and-Formalism/graph/The_destination_tree.png
	output/Scratch/en/blog/2010-05-24-Trees--Pragmatism-and-Formalism/graph/The_source_tree.png
	output/Scratch/en/blog/Haskell-OpenGL-Mandelbrot/index.html
	output/Scratch/en/blog/feed/feed.xml
	output/Scratch/fr/blog/2010-05-24-Trees--Pragmatism-and-Formalism/graph/The_destination_tree.png
	output/Scratch/fr/blog/2010-05-24-Trees--Pragmatism-and-Formalism/graph/The_source_tree.png
	output/Scratch/fr/blog/Haskell-OpenGL-Mandelbrot/index.html
	output/Scratch/fr/blog/feed/feed.xml
	output/Scratch/sitemap.xml
	output/index.html
This commit is contained in:
Yann Esposito (Yogsototh) 2013-01-02 16:29:24 +01:00
commit ef059768a0
381 changed files with 115778 additions and 1544 deletions

20
Rules
View file

@ -46,21 +46,17 @@ compile '/html/*' do
# item[:extension] returns 'html.erb' for multi-dotted filename
ext = item[:extension].nil? ? nil : item[:extension].split('.').last
filter :ultraviolet # must be before kramdown
filter :graph
filter :mpost
filter :description
filter :falacy
filter :blogimage
if ext == 'erb'
filter :erb
elsif ext == 'haml' || ext.nil?
filter :haml
elsif ext == 'md' || ext == 'markdown'
filter :erb # I'll try not to use ruby anymore inside content
filter :graph
filter :description
filter :falacy
filter :blogimage
filter :kramdown
# filter :math_repair # after kramdown
filter :fix_img
else
raise "Filter is not configured for #{item.identifier} in Rules file."
end
@ -72,10 +68,10 @@ compile '/html/*' do
# filter :yabbreviations
filter :footnotes
if item[:kind] == 'article'
layout 'article'
elsif not item[:layout].nil?
if not item[:layout].nil?
layout item[:layout]
elsif item[:kind] == 'article'
layout 'article'
else
layout 'default' unless item[:layout] == "none"
end

View file

@ -69,6 +69,9 @@ translations:
loading:
fr: "Chargement en cours..."
en: "loading..."
welcomeloading:
fr: "Bonjour ! Commencez à lire, un meilleur style se charge..."
en: "Hi! Start reading while a better style is loading..."
entirely_done_with:
en: "Entirely done with"
fr: "Site entièrement réalisé avec"

7
content/css/cmu.sass Normal file
View file

@ -0,0 +1,7 @@
-----
-----
pre, code, a.cut
font-family: "cmuntt",Incosolata, Monaco, monospace
body
font-family: "ComputerModern", Georgia, Palatino, "Century Schoolbook L", "Times New Roman", Times, serif

View file

@ -0,0 +1,24 @@
@font-face
font-family: 'cmuntt'
src: url('fonts/cmuntt.eot')
src: local(''), url('fonts/cmuntt.svg') format('svg'), url('fonts/cmuntt.ttf') format('truetype')
font-weight: normal
font-style: normal
@font-face
font-family: 'ComputerModern'
src: url('fonts/cmunrb.eot')
src: local(''), url('fonts/cmunrb.svg') format('svg'), url('fonts/cmunrb.ttf') format('truetype')
font-weight: bold
@font-face
font-family: 'ComputerModern'
src: url('fonts/cmunsl.eot')
src: local(''), url('fonts/cmunsl.svg') format('svg'), url('fonts/cmunsl.ttf') format('truetype')
font-style: italic,oblique
@font-face
font-family: 'ComputerModern'
src: url('fonts/cmunrm.eot')
src: local(''), url('fonts/cmunrm.svg') format('svg'), url('fonts/cmunrm.ttf') format('truetype')
font-weight: normal
font-style: normal

View file

@ -170,7 +170,7 @@ body
color: $base01
pre, code, a.cut
font-family: "cmuntt",Incosolata, Monaco, monospace
font-family: Incosolata, Monaco, monospace
pre
&::selection
@ -210,8 +210,13 @@ ul
.corps ul li:before
content: "- "
ol,ul
ul
padding-left: 0
margin-left: 1.5ex
text-indent: -1.5ex
ol
padding-left: 0
.toc
ol li, ul li
margin: .5em 0
@ -225,7 +230,7 @@ body, h1, h2, h3, h4, #entete, .tagname
line-height: 1.5em
body
font-family: "ComputerModern", Georgia, Palatino, "Century Schoolbook L", "Times New Roman", Times, serif
font-family: Georgia, Palatino, "Century Schoolbook L", "Times New Roman", Times, serif
/* Header Numbering */
.article #afterheader
@ -251,7 +256,7 @@ pre
box-shadow: 0 0 5px ($secondBackgroundColor - #222) inset
border-radius: 3px
padding: 1em
line-height: 1em
line-height: 1.1em
font-size: .9em
p
@ -404,7 +409,7 @@ $VMarginCorps: 3em
// ATTENTION DOIT ETRE 0 pour le bon callage
$HMarginCorps: 0
$content_width: 52em
$content_width: 47em
body
text-align: center
@ -515,23 +520,16 @@ $hauteur_menu: 4em
$contentMargin: 0em
.encadre, .black, .red, .intro, .resume, .shadow
.encadre, .black, .intro, .resume, .shadow
padding: 2em
margin:
top: 2em
bottom: 2em
.encadre, .black, .red, .shadow
.encadre, .black, .shadow
+secondColor
pre .red
background: none
padding: 0
margin: auto
border: none
box-shadow: none
.intro, .resume
font-size: 0.9em
+highlight
@ -573,8 +571,6 @@ $fontcorps: 1.25
margin: 0
p, ol, ul, blockquote
line-height: 1.5em
pre, code
line-height: 1em
ul li ul, ol li ul, ul li ol, ol li ol
margin-top: 0
margin-bottom: 0
@ -600,6 +596,9 @@ figure
text-align: center
margin: .5em 0
figure.left, figure.right
max-width: 30%
img.clean
border: none
background-color: none
@ -717,6 +716,11 @@ img
background: none
border: none
img.right
max-width: 30%
margin:
top: .6em
left: 2em
img.left
float: left
max-width: 30%
@ -1070,3 +1074,44 @@ a.cut
img
max-width: 80%
max-height: 6em
section.slide
border-color: $borderColor
border: solid 1px
margin-bottom: 1em
padding: .5em
font-family: sans-serif
font-size: .8em
.base03
color: $base03
.base02
color: $base02
.base01
color: $base01
.base00
color: $base00
.base0
color: $base0
.base1
color: $base1
.base2
color: $base2
.base3
color: $base3
.yellow
color: $yellow
.orange
color: $orange
.red
color: $red
.magenta
color: $magenta
.violet
color: $violet
.blue
color: $blue
.cyan
color: $cyan
.green
color: $green

262
content/css/main2.sass Normal file
View file

@ -0,0 +1,262 @@
-----
-----
/* Solarized palette */
$base03 : #002b36
$base02 : #073642
$base01 : #586e75
$base00 : #657b83
$base0 : #839496
$base1 : #93a1a1
$base2 : #eee8d5
$base3 : #fdf6e3
$yellow : #b58900
$orange : #cb4b16
$red : #dc322f
$magenta: #d33682
$violet : #6c71c4
$blue : #268bd2
$cyan : #2aa198
$green : #859900
/* $backtext: #FAFAFC */
$backtext: $base3 + #151515
$fronttext: $base02
$hightext: $base03
$borderColor: $base2
$altback: $base3
@import url(/Scratch/assets/css/cmufontface.css)
/* General */
body
font-family: 'Futura', serif
font-size: 20px
color: $base3
background: $base02
a, a:link, a:visited, a:active, a:hover
color: $hightext
text-decoration: none
outline: none
a:hover
color: $orange
hr
color: $borderColor
border:
top: 1px solid $borderColor
bottom: none
left: none
right: none
ul
list-style: none
padding-left: 0
margin-left: 1.5ex
text-indent: -1.5ex
ol
padding-left: 0
ul li:before
content: "- "
ol li ul, ol li ol, ul li ol, ul li ul
margin: .5em 1.5em
list-style: none
/* fix for possible markdown issues */
li p, ol p
display: inline
padding: 0
table tr
&:nth-child(odd)
background-color: $altback
table
border:
top: solid 2px $borderColor
bottom: solid 2px $borderColor
body
text-rendering: optimizelegibility
line-height: 1.5em
h1, h2, h3, h4, h5, h6
color: $hightext
line-height: 1.1em
padding-left: 30px
/* Header Numbering */
.article #afterheader
counter-reset: niv02
h2
counter-increment: niv02
counter-reset: niv03
marker-offset: 3em
&:before
content: counter(niv02) ". "
h3
counter-increment: niv03
counter-reset: niv04
&:before
content: counter(niv02) "." counter(niv03) ". "
h4
counter-increment: niv04
&:before
content: counter(niv02) "." counter(niv03) "." counter(niv04) ". "
p, ul, ol, h1, h2, h3, h4
margin-bottom: 30px
padding: 0 30px
text-align: justify
pre
line-height: 1.1em
margin-bottom: 30px
padding: 30px
overflow: auto
background: $base3
font-size: 18px
=sc
text-transform: uppercase
font-size: 0.8em
abbr, acronym
+sc
text:
decoration: none
border:
bottom:
width: 0
// -- TYPOGRAPHY --
.small
font-size: 0.8em
.sc
+sc
.clear,.flush
clear: both
.impact, .darkimpact
font-size: 2em
margin: 0 auto 1em auto
line-height: 1.3em
figure
margin: 3em 0
img
box-shadow: 0 10px 15px #CCC inset
figcaption
text-align: center
margin: .5em 0
figure.left, figure.right
max-width: 30%
/* Specific */
#afterheader
color: $base01
background-color: $backtext
.intro, .resume, blockquote
font-style: italic
padding: 0.5em 1em
a:hover
color: $orange
i, em
font-style: normal
strong, b
font-weight: normal
.intro, .resume
font-size: 0.9em
blockquote
border: solid 1px $borderColor
background-color: $altback
pre, pre code
background-color: $base2
pre
border: solid 1px rgba(0,0,0,0.1)
ul
padding-left: 1.5em
section.slide
border-color: $borderColor
border: solid 1px
margin-bottom: 1em
padding: .5em
font-family: sans-serif
font-size: .8em
.base03
color: $base03
.base02
color: $base02
.base01
color: $base01
.base00
color: $base00
.base0
color: $base0
.base1
color: $base1
.base2
color: $base2
.base3
color: $base3
.yellow
color: $yellow
.orange
color: $orange
.red
color: $red
.magenta
color: $magenta
.violet
color: $violet
.blue
color: $blue
.cyan
color: $cyan
.green
color: $green
/* Black page */
#blackpage
font-family: sans-serif
font-style: italic
padding-top: 8em
z-index: 9000
cursor: wait
img
background: none
border: none
max-width: 80%
margin: 0 auto
a
cursor: pointer
.cut
font-size: .8em
text-align: right
display: inline-block
width: 100%
opacity: 0.3
.cut:hover
opacity: 1
/* Layout */
#afterheader
width: 35em
margin: 0 auto
img
width: 100%
img.left, img.right
width: 30%

File diff suppressed because it is too large Load diff

View file

@ -141,12 +141,10 @@ But the second one is clearly far superior in architecture.
I don't want to argue why here.
Just believe me that the functional programming approach is superior.
Actually I lack the lambda operator.
If someone has an idea on how to create anonymous functions, just tell me, thanks.
You can find an [updated version of the code (thanks to Arash Rouhani)](https://github.com/Tarrasch/zsh-functional).
An older version is [here thought](https://github.com/yogsototh/zsh_functional).
Here is the (first version) source code:
Here is the (first version[^1]) source code:
[^1]: As stated in the intro, if you want to install it, just go [there](https://github.com/yogsototh/zsh_functional).
<code class="zsh" file="functional.sh">
#!/usr/bin/env zsh

View file

@ -19,7 +19,7 @@ tags:
blogimage("dragon.jpg","Title image")
begindiv(intro)
%tldr My short and higly subjective feelings about programming languages I used.
%tldr My short and highly subjective feelings about the programming languages I used.
enddiv
### `BASIC`
@ -59,7 +59,7 @@ What a pleasure!
leftblogimage("dragon.jpg","Dragon fractal")
I was about 10 when I played with logo to draw on the computer.
I was about 10 when I played with logo to draw things on a screen.
I remember the Bach's music while the program loaded.
@ -67,10 +67,10 @@ At that time we had to load the program into the memory using tapes.
This one was a rare one. It didn't made an awfull 'Krrrkrr cssssss krrr' noise.
Some years after, I used it to learn programming to my college student.
It was really good as a first language.
It was a really good first language.
Making fractals is like a game for children.
Here is an example of code. It draws the dragon fractal.
Here is the code to draw the dragon fractal:
<code class="zsh">
HIDETURTLE
@ -101,7 +101,7 @@ dragon 6 3000
### Pascal
The always second.
The eternal second.
I made my firsts real serious program with Pascal.
I must confess I find it inferior to C.
@ -117,26 +117,26 @@ The pointer's language.
_Le_ programming language.
Once you understand loops and recursivity.
It is time to make things serious.
If you want to have good quality code, knowing C is almost mandatory.
Once you understand loops and recursion,
it is time to do serious things.
If you want to make good quality code, knowing C is almost mandatory.
This language is close to machine language.
This language is close to the machine language.
So much, there is (mostly) a linear relation between the size of your code and the size of the compiled one.
In short, each time you write a C instruction there won't be anything strange that will occurs, like starting a long algorithm behind the scene.
It is very close to the machine while keeping sufficient abstractions to be fun.
While close to the machine, `C` keep sufficient abstractions to be fun.
I made a lot of program with it.
From sort algorithms to AI ones (SAT3), system, network prgramming, etc...
From sort algorithms to AI ones (SAT3), system, network programming, etc...
It is a very useful language that will help you understand how things works on your computer.
Most modern computer language hide a lot of informations on what occurs.
This is not the case with C.
This is not the case with `C`.
### ADA
The super-clean one.
The "super clean" one.
I liked ADA. I must confess I didn't used it a lot.
May be one day I will try it again.
@ -150,11 +150,11 @@ Until here I just described imperative languages without any object notion.
More clearly, the language didn't helped you to structure your program.
In order to limit the number of bugs, particularly for huge programs, we started to think about how to organize computer programs.
In the end, from the imperatives language culture, it produced the Object Oriented programming (OOP).
Beware, the Object Oriented programming isn't a miracle. Proof? How many bug-free software do you use?
In the end, from the imperative language culture, it produced the Object Oriented programming (OOP).
Beware, the Object Oriented programming isn't a miracle. Proof? How many bug free software do you use?
Furthermore, OOP doesn't fit all problems.
But to make a bank application, an application which help to manage stock, clients or text archives.
I mean an information system, the OOP is not so bad.
But to make a bank application, an application which help to manage stock, clients or text archives or more generally
an information system, the OOP is not so bad.
Then Object Oriented Languages appeared everywhere.
@ -165,21 +165,22 @@ leftblogimage("cplusplus.jpg","Messy router")
The ugly
fr:
Industry wanted an Object Oriented Language without losing all their old C code.
Solution, keep C and add an Object layer on it.
My main concern about C++ is: it do too many things.
My main concern about C++ is: it does too many things.
I appreciated multiple inheritance and templates.
In reality I liked a lot C++ while I was working alone.
I used it to write `DEES` my main thesis software.
My only concern was about a lack in the STL.
In the doc, one could use `String<T>`.
But in reality, T have to be only `char` or `char16`.
But in reality, `T` had to be only `char` or `char16`.
Then I had to reduce my alphabet to 2<sup>16</sup> letters.
Except for some application, the alphabet must be far larger than that.
en:
To conclude, I'd say, C++ is very good if you work alone or with a fixed subset of its features.
fr:
### Eiffel
@ -190,7 +191,8 @@ Full object in mind. Far cleaner than C++.
But it isn't so popular.
Behind C++ there is a large community to help new users and to write libraries.
Furthermore, I preferred working with C++.
At that time I programmed a lot with C and like its syntax.
When I learned Eiffel, I programmed a lot with C and liked its syntax.
### Java
@ -198,11 +200,14 @@ leftblogimage("grail.jpg","Holy Grail from the Monty Python")
The first time I heard about Java it was _le Grail_!
Perfect portability, your program will work on all platform.
There was incrusted inside the language architecture concepts to help limit mistakes, and force you to use good programming habits. But...
The language helps limit mistakes, and force you to use good programming habits.
But...
But It is extremely verbose.
And limitations are quite boring if you know what you're doing.
Many limitations are quite boring if you know what you're doing.
For example, there is no multiple inheritance.
Generally it is a coherent choice when there are a way to compensate.
@ -211,29 +216,31 @@ Except, interfaces can only add methods to a class.
You cannot add any attribute to a class except by subclassing.
I really lacked this feature.
I made a GUI using Java Swing and I created my own notification system between different element of the GUI.
Then, at the begining I only needed to send notification 1 to 1.
After some times, I needed to make 1 to many notifications.
And I had to make a bunch of copy/paste inside all my subclasses!
In the beginning I only needed to send notification one to one.
After some time, I wanted to send one to many notifications.
I had to make a bunch of copy/paste inside all my subclasses!
Copy/paste are exactly what should be avoided the most by object oriented languages.
Another thing: threads.
I was forced to make my own thread management system to avoid locks and notifications between threads (wait the end of this thread, ...).
I was forced to make my own thread management system to avoid locks and send notifications between threads (wait the end of this thread, ...).
At that time I used Java 1.5.
This problem should have been solved with Java 1.6.
I wish it is the case, but lacking such an essential feature for a language was very bad.
In the same idea, it was very long to wait for the foreach loops.
In the same idea, it was very long to wait for the "foreach" loops.
After my experience, I don't recommend Java.
Portability does not worth this price.
GUI protability means mediocre experience on all platforms.
GUI portability means mediocre experience on all platforms.
Any system it might be (wxWidget, QT, etc...).
The Java ideology is "closed". But it resolve a big problem.
It helps medium to low quality developper to work in team without the ability to make too much harm to the product.
A good programmer will be able to make very interresting things with it thought.
The Java ideology is "closed".
But it resolve a big problem.
It helps medium to low quality developers to work in team without the ability to make too much harm to the product.
A good programmer will be able to make very interesting things with it thought.
Please note I didn't say Java programmer are bad programmer.
@ -245,17 +252,17 @@ The language I learned and used only to make application on Apple(c) platform.
I learned Objective-C just after Python.
It was hard to do it.
At first I didn't liked the syntax and many other details.
But it is this kind of language you like more and more you use it.
But it is this kind of language the more you use, the more you like.
In fact, Objective-C is a simple language, but associated with the Cocoa framework it is a really good tool.
Cocoa is very different to other framework I used before.
I find many of its idea extermely good.
I find many of its idea extremely good.
Both simple and efficient.
It might seems like small details on paper, but once you start using it, it make all the difference.
It might seems like small details on paper, but once you start using it, it makes all the difference.
Even if Objective-C is a relatively low level language.
Its dynamic typing ability make it very good for GUI programming.
I recommand to continue working with this language.
In the end you'll certainely find it better than expected.
I recommend to continue working with this language.
In the end you'll certainly find it better than expected.
## Modern Scripting Languages
@ -265,7 +272,10 @@ leftblogimage("php.jpg","A Jacky Touch Car")
This small script language that we used all to make our website in the time of animated gifs.
Nice but no more. Apparently there were a lot of progress since PHP5. Maybe one day I'll use it again. But behind it, this language has a "script kiddies only" reputation.
Nice but no more.
Apparently there were a lot of progress since PHP5.
Maybe one day I'll use it again.
But behind it, this language has a "script kiddies only" reputation.
Also long history of easy to make security holes.
In reality PHP is just behind C for the abstraction level.
@ -273,7 +283,8 @@ Therefore it has a lot of organisation problems and make it easier to create bug
For web applications it is a real problem.
PHP remains for me the SQL injection language.
I made a bit of PHP not so long ago, and it was a pain to protect my application to SQL injection. Yep, I didn't found any standard library to make this, but I didn't searched a lot.
I made a bit of PHP not so long ago, and it was a pain to protect my application to SQL injection.
Yep, I didn't found any standard library to make this, but I didn't searched a lot.
### Python
@ -302,31 +313,41 @@ I used it to modify hundreds of XML files in an easier manner than XSLT.
### Perl
Perl is magic, but the syntax is so hideous nobody can like to work in an environment with many different person in Perl.
Or at least, all other collaboratos must be excellent programmers.
But the very good feature is the integration of some perl syntax.
Or at least, all other collaborators must be excellent programmers.
A great feature of perl is its integration with regular expression in its syntax:
<code class="perl">
$var =~ s/toto/titi/g
</code>
This program will replace every toto by titi inside the `$var` variable.
The Perl code is often very compact and usally unreadable.
This program will replace every `toto` by `titi` inside the `$var` variable.
The Perl code is often very compact and generally unreadable.
But it is a language good to know.
It is a kind of `awk` under steroids.
### Ruby
Ruby is a very good language. It is often compared (opposed ?) to Python.
Ruby is a very good language.
It is often compared (opposed ?) to Python.
There are the regular expression operators Perl inside the langage.
But the syntax is extremely clear, like in Python.
Many feature were inspired by functionnal programming (as in Python).
Many feature were inspired by functional programming (as in Python).
I used it a lot.
It is the worst language I know in term of efficiency.
This is the language that lose almost all benchmarks.
But it is the perfect tool for prototypes.
If you want to make a website prototype, RoR (Ruby on Rails) is certainly one of the best system known to mankind.
From idea to realisation, few time will occur. Make this site work for thousands of people, will, on the other hand, certainly require a lot of optimisations.
From idea to realisation, few time will occur.
Make this site work for thousands of people, will, on the other hand, certainly require a lot of optimisations.
One of the greatest Ruby feature is its ability to make the program extremely readable.
It is very close to natural language.
On the other hand, I found the Object Oriented layer a bit disappointing.
The fact there is no real "class variable" but only "tree class variable" for example.
Considering the community, the ruby one feels closer to the creative than the engineer.
I am under the impression designer tends to use Ruby instead of Python.
### Javascript
@ -348,32 +369,49 @@ It is very nice to use.
As I said, this is a good surprise.
Javascript was chosen by chance as the script inside your navigator.
Instead of the java inspired syntax, everything else is very good.
In order to compensate the syntax, you can use CoffeScript.
In order to compensate the syntax, you can use CoffeeScript.
## Functional Languages
### CamL
I learned CamL during the college.
It was really interresting.
It was really interesting.
Functional programming is very different to imperative programming (most of popular languages).
I had good mathematic intuitions to use this language.
But I must confess I never used it for something serious.
### Haskell
I am still learning this language.
I believe I will still learning this language in many years.
I must say it is a pleasure.
Generally it takes me no more than some hours to some days to learn a new programming language.
Concerning haskell, this is very different.
To master haskell you need to understand very hard concepts.
Concerning Haskell, this is very different.
To master Haskell you need to understand very abstract concepts.
Monads and Arrows are some of them.
I didn't understand them before I read some scientific paper.
I didn't understood them before I read some scientific paper.
Many week will be necessary to master it perfectly (if someone does).
Also the community is very friendly and nice. There is no "LOL! URAN00B! RTFM!"
Also the community is very friendly and nice.
There is no "LOL! URAN00B! RTFM!"
And no concession has been made to make this language more popular (I'm looking at you C++, Java and Javascript).
This langage remain pure (I know there are two meaning).
Concerning making real product with Haskell.
In fact, Haskell is very efficient concerning code change.
Refactoring code is incredibly easy with Haskell.
And in the same time, the Haskell type system helps to make your product bug free.
Technically this language is close to perfection.
But it has some major problems:
- not so popular
- hard to learn
- I also believe there is not actually enough success stories with Haskell
On the other hand, knowing Haskell will help you learn a lot of thing about programming in general.
You should at least take a look.
[I made an Haskell introduction if you are curious](/Scratch/en/blog/Haskell-the-Hard-Way/).
## Unpopular Languages
### Metapost
@ -404,8 +442,9 @@ Most programming language should think about adding it.
### zsh
Yes, zsh is a shell.
But it is also a script language extremly well suited to file management.
For now, it is the best shell I used. I prefer zsh to bash.
But it is also a script language very well suited to file management.
For now, it is the best shell I used.
I prefer zsh to bash.
### Prolog
@ -419,7 +458,7 @@ A bit like functional programming but far more powerful.
## Languages to discover
Many languages and framework remains to be learnt and tried.
Actually I believe I will stay a while with haskell.
Actually I believe I will stay a while with Haskell.
Maybe tomorrow I will look at LISP, Scala or Erlang.
I also certainly look at clojure to make web application.

File diff suppressed because it is too large Load diff

View file

@ -133,7 +133,7 @@ Cet article contient cinq parties :
> runhaskell filename.lhs
> </pre>
>
> Certain ne marcheront pas, mais la majorité vous donneront un résultat.
> Certains ne marcheront pas, mais la majorité vous donneront un résultat.
> Vous devriez voir un lien juste en dessous.
enddiv

View file

@ -144,12 +144,10 @@ Mais la seconde est plus bien supérieure en terme d'architecture.
Je ne veux pas discuster ici pourquoi c'est mieux.
Je vous demande simplement de me croire quand je dis que l'approche fonctionnelle est supérieure.
Actuellement il me manque une fonction lambda, si quelqu'un à une idée elle serait la bienvenue.
Je ne sais pas encore comment créer facilement des fonctions anonymes.
Vous pouvez télécharger [une version à jour du code (merci à Arash Rouhani)](https://github.com/Tarrasch/zsh-functional).
Une ancienne version est [ici](https://github.com/yogsototh/zsh_functional).
Voici le code source (de la première version) :
Voici le code source (de la première version[^1]) :
[^1]: Comme précisé dans l'introduction, si vous voulez l'installez allez plutôt voir dans ce [repository](https://github.com/yogsototh/zsh_functional).
<code class="zsh" file="functional.sh">
#!/usr/bin/env zsh

View file

@ -19,7 +19,7 @@ tags:
blogimage("dragon.jpg","Title image")
begindiv(intro)
%tlal Mon avis court et hautement subjectif concernant les différents languages de programmations que j'ai utilisé.
%tlal Mon avis succinct et hautement subjectif concernant les différents languages de programmation que j'ai utilisé.
enddiv
### `BASIC`
@ -138,7 +138,7 @@ Bref il est versatile, et on ne peut pas dire que l'on sait programmer si on ne
### ADA
Le langage super-propre.
Le langage "super propre".
J'avais bien aimé ADA, mais j'avoue que ça n'a duré que le temps d'un semestre de cours.
Peut-être qu'un jour je m'y remettrai.
@ -166,6 +166,8 @@ leftblogimage("cplusplus.jpg","Messy router")
Le malpropre
en:
Et oui l'industrie voulait un langage objet, mais elle n'était pas prête à mettre à la poubelle tout ses codes en C.
La solution, prendre C et lui rajouter une couche objet.
Le problème avec C++ c'est qu'il fait trop de choses.
@ -178,14 +180,14 @@ Du coup, mon alphabet était limité à 2<sup>16</sup> lettres.
Hors, pour certaines application, l'alphabet doit être gigantesque.
fr:
En conclusion je dirai que C++ est un très bon langage si vous vous fixez à l'avance un sous ensemble de ses fonctionnalités.
en:
### Eiffel
leftblogimage("eiffel.jpg","Eiffel tower construction")
Bon, ok c'est un très beau langage objet.
Eiffel est un très beau langage objet.
Bien plus propre que C++.
Mais, à moins que les choses aient changées, il n'est pas très populaire.
Derrière lui il n'a pas la communauté de C++.
@ -197,13 +199,16 @@ Lorsqu'on viens du C, il est désagréable de changer ses habitudes.
leftblogimage("grail.jpg","Holy Grail from the Monty Python")
On continue vers les langages objets. Alors, à une époque où j'en ai entendu parler, c'était _le Graal_ !
La portabilité, votre programme marchera partout. Il était orienté objet. Incrusté à l'intérieur il y avait des concepts d'architecture qui empêchent de faire n'importe quoi... Sauf que.
Sauf qu'il est incroyablement verbeux.
Et que les limitations sont très désagréables si on sait ce que l'on fait.
Par exemple, il n'y a pas d'héritage multiple en Java.
Ce qui est en général un choix que je trouve cohérent s'il est bien appuyé par des systèmes qui compensent ce manque.
En java, il existe les interfaces.
@ -230,11 +235,11 @@ Bon, après cette expérience je déconseillerai Java.
La portabilité, n'est pas si intéressante que ce qu'on pourrait croire.
En ce qui concerne les GUI, portable signifie interface fonctionnelle mais médiocre sur toutes les plateformes.
Quelquesoit le système d'ailleurs (wxWidget, QT, etc...).
Quelque soit le système d'ailleurs (wxWidget, QT, etc...).
Donc, pour des applications à distribuer à des tiers, c'est à éviter.
Le système de Java est très clos.
Par contre il résoud un très bon problème.
Par contre il résout un très bon problème.
Il permet à des développeurs médiocres de travailler en groupe sans faire trop de mal.
Et un bon programmeur sera tout de même capable d'y faire des choses très intéressantes.
Veuillez noter que je n'ai pas dit que les programmeurs Java sont de mauvais programmeurs, ce n'est pas ce que je pense.
@ -333,6 +338,8 @@ Par contre c'est un outil parfait pour faire des prototypes.
Et si vous voulez faire un prototype de site web, RoR est ce qui se fait de mieux.
De l'idée au site, il ne se passera que peu de temps.
### Javascript
C'est la bonne surprise.
@ -383,6 +390,10 @@ Et aussi pas de concession du langage pour devenir populaire.
Le langage est bon, voilà tout.
Alors qu'en Java et C++, typiquement certain choix ont été fait en dépis du bon sens pour "faire plaisir".
## Langages originaux
### Metapost
@ -430,7 +441,7 @@ Un peu comme la programmation fonctionnelle mais en beaucoup plus puissant.
## Les langages à découvrir
Il reste encore pas mal de langages et de framework à essayer.
Actuellement je pense que je vais passer un moment avec haskell.
Actuellement je pense que je vais passer un moment avec Haskell.
Peut-être demain que j'irai apprendre LISP, Scala ou Erlang.
Comme je suis plus dans la création de site web, j'irai certainement jeter un coup d'œil à clojure aussi.
Et certainement beaucoup d'autres choses.

View file

@ -45,7 +45,7 @@ targetTitleFrench = latest_fr_article[:title]
<h3><a href="/Scratch/en/about/contact" onclick="setLanguage('en')">Contact <span class="nicer">»</span> </a></h3>
<h3> <a href="/resume/index.html"> Resume <span class="nicer">»</span> </a> </h3>
</div>
<div class="francais right"style="text-align: right; width: 30%; font-size: 0.8em">
<div class="francais right"style="text-align: right; width: 32%; font-size: 0.8em">
<div style="color: #AAA">Français</div>
<h3>
<a href="/Scratch/fr/blog/" onclick="setLanguage('fr')">
@ -65,7 +65,7 @@ targetTitleFrench = latest_fr_article[:title]
<h3> <a href="http://j.mp/btfRJ2"> Curriculum Vitæ <span class="nicer">»</span> </a> </h3>
<h3> <a href="http://yann.esposito.free.fr/enseignement/enseignement.php"> Enseignement <span class="nicer">»</span> </a> </h3>
</div>
<img class="clean" src="/Scratch/img/presentation.png" alt="Presentation drawing" />
<img class="clean" src="/Scratch/img/presentation.png" alt="Presentation drawing" width="30%"/>
<div class="flush"></div>
<center>
<h2 style="font-size: 15px;">

155
crash.log
View file

@ -1,155 +0,0 @@
Crashlog created at 2012-10-05 10:57:23 +0200
=== MESSAGE:
Sass::SyntaxError: Invalid CSS after "italic": expected expression (e.g. 1px, bold), was ";"
=== COMPILATION STACK:
- [item] /css/main/ (rep default)
=== BACKTRACE:
0. content/css/main.sass:631
1. /var/lib/gems/1.9.1/gems/sass-3.1.19/lib/sass/scss/parser.rb:1010:in `expected'
2. /var/lib/gems/1.9.1/gems/sass-3.1.19/lib/sass/script/lexer.rb:191:in `expected!'
3. /var/lib/gems/1.9.1/gems/sass-3.1.19/lib/sass/script/parser.rb:465:in `assert_done'
4. /var/lib/gems/1.9.1/gems/sass-3.1.19/lib/sass/script/parser.rb:50:in `parse'
5. /var/lib/gems/1.9.1/gems/sass-3.1.19/lib/sass/script/parser.rb:140:in `parse'
6. /var/lib/gems/1.9.1/gems/sass-3.1.19/lib/sass/script.rb:31:in `parse'
7. /var/lib/gems/1.9.1/gems/sass-3.1.19/lib/sass/engine.rb:832:in `parse_script'
8. /var/lib/gems/1.9.1/gems/sass-3.1.19/lib/sass/engine.rb:593:in `parse_property'
9. /var/lib/gems/1.9.1/gems/sass-3.1.19/lib/sass/engine.rb:582:in `parse_property_or_rule'
10. /var/lib/gems/1.9.1/gems/sass-3.1.19/lib/sass/engine.rb:563:in `parse_line'
11. /var/lib/gems/1.9.1/gems/sass-3.1.19/lib/sass/engine.rb:456:in `build_tree'
12. /var/lib/gems/1.9.1/gems/sass-3.1.19/lib/sass/engine.rb:475:in `block in append_children'
13. /var/lib/gems/1.9.1/gems/sass-3.1.19/lib/sass/engine.rb:474:in `each'
14. /var/lib/gems/1.9.1/gems/sass-3.1.19/lib/sass/engine.rb:474:in `append_children'
15. /var/lib/gems/1.9.1/gems/sass-3.1.19/lib/sass/engine.rb:465:in `block in build_tree'
16. /var/lib/gems/1.9.1/gems/sass-3.1.19/lib/sass/engine.rb:458:in `each'
17. /var/lib/gems/1.9.1/gems/sass-3.1.19/lib/sass/engine.rb:458:in `build_tree'
18. /var/lib/gems/1.9.1/gems/sass-3.1.19/lib/sass/engine.rb:475:in `block in append_children'
19. /var/lib/gems/1.9.1/gems/sass-3.1.19/lib/sass/engine.rb:474:in `each'
20. /var/lib/gems/1.9.1/gems/sass-3.1.19/lib/sass/engine.rb:474:in `append_children'
21. /var/lib/gems/1.9.1/gems/sass-3.1.19/lib/sass/engine.rb:330:in `_to_tree'
22. /var/lib/gems/1.9.1/gems/sass-3.1.19/lib/sass/engine.rb:300:in `_render'
23. /var/lib/gems/1.9.1/gems/sass-3.1.19/lib/sass/engine.rb:247:in `render'
24. /var/lib/gems/1.9.1/gems/nanoc-3.4.0/lib/nanoc/filters/sass.rb:62:in `run'
25. /var/lib/gems/1.9.1/gems/nanoc-3.4.0/lib/nanoc/base/result_data/item_rep.rb:343:in `filter'
26. /var/lib/gems/1.9.1/gems/nanoc-3.4.0/lib/nanoc/base/compilation/item_rep_proxy.rb:47:in `filter'
27. /var/lib/gems/1.9.1/gems/nanoc-3.4.0/lib/nanoc/base/compilation/rule_context.rb:54:in `filter'
28. ./Rules:12:in `block in load'
29. /var/lib/gems/1.9.1/gems/nanoc-3.4.0/lib/nanoc/base/compilation/rule.rb:68:in `instance_eval'
30. /var/lib/gems/1.9.1/gems/nanoc-3.4.0/lib/nanoc/base/compilation/rule.rb:68:in `apply_to'
31. /var/lib/gems/1.9.1/gems/nanoc-3.4.0/lib/nanoc/base/compilation/compiler.rb:381:in `compile_rep'
32. /var/lib/gems/1.9.1/gems/nanoc-3.4.0/lib/nanoc/base/compilation/compiler.rb:337:in `block in compile_reps'
33. /var/lib/gems/1.9.1/gems/nanoc-3.4.0/lib/nanoc/base/compilation/compiler.rb:330:in `loop'
34. /var/lib/gems/1.9.1/gems/nanoc-3.4.0/lib/nanoc/base/compilation/compiler.rb:330:in `compile_reps'
35. /var/lib/gems/1.9.1/gems/nanoc-3.4.0/lib/nanoc/base/compilation/compiler.rb:85:in `run'
36. /var/lib/gems/1.9.1/gems/nanoc-3.4.0/lib/nanoc/base/source_data/site.rb:57:in `compile'
37. /var/lib/gems/1.9.1/gems/nanoc-3.4.0/lib/nanoc/cli/commands/compile.rb:57:in `run'
38. /var/lib/gems/1.9.1/gems/nanoc-3.4.0/lib/nanoc/cli/command_runner.rb:14:in `block in call'
39. /var/lib/gems/1.9.1/gems/nanoc-3.4.0/lib/nanoc/cli/error_handler.rb:63:in `handle_while'
40. /var/lib/gems/1.9.1/gems/nanoc-3.4.0/lib/nanoc/cli/error_handler.rb:26:in `handle_while'
41. /var/lib/gems/1.9.1/gems/nanoc-3.4.0/lib/nanoc/cli/command_runner.rb:13:in `call'
42. /var/lib/gems/1.9.1/gems/cri-2.3.0/lib/cri/command_dsl.rb:185:in `block in runner'
43. /var/lib/gems/1.9.1/gems/cri-2.3.0/lib/cri/command.rb:296:in `call'
44. /var/lib/gems/1.9.1/gems/cri-2.3.0/lib/cri/command.rb:296:in `run_this'
45. /var/lib/gems/1.9.1/gems/cri-2.3.0/lib/cri/command.rb:249:in `run'
46. /var/lib/gems/1.9.1/gems/cri-2.3.0/lib/cri/command.rb:262:in `run'
47. /var/lib/gems/1.9.1/gems/nanoc-3.4.0/lib/nanoc/cli.rb:47:in `block in run'
48. /var/lib/gems/1.9.1/gems/nanoc-3.4.0/lib/nanoc/cli/error_handler.rb:63:in `handle_while'
49. /var/lib/gems/1.9.1/gems/nanoc-3.4.0/lib/nanoc/cli/error_handler.rb:26:in `handle_while'
50. /var/lib/gems/1.9.1/gems/nanoc-3.4.0/lib/nanoc/cli.rb:44:in `run'
51. /var/lib/gems/1.9.1/gems/nanoc-3.4.0/bin/nanoc:19:in `<top (required)>'
52. /usr/local/bin/nanoc:19:in `load'
53. /usr/local/bin/nanoc:19:in `<main>'
=== VERSION INFORMATION:
nanoc 3.4.0 © 2007-2012 Denis Defreyne.
Running ruby 1.9.3 (2011-10-30) on i686-linux with RubyGems 1.8.11.
=== INSTALLED GEMS:
builder 3.0.0
colored 1.2
cri 2.2.1, 2.3.0
kgio 2.7.4
kramdown 0.13.5, 0.13.7
mime-types 1.18
nanoc 3.3.6, 3.4.0
rack 1.4.1
rack-contrib 1.1.0
rack-rewrite 1.2.1
raindrops 0.8.0, 0.9.0
rainpress 1.0
rake 0.9.2.2
sass 3.1.16, 3.1.19
spox-plist 3.0.1
spox-textpow 0.10.3
spox-ultraviolet 0.10.5
unicorn 4.3.1
=== ENVIRONMENT:
CAPP_BUILD => "/home/y/tmp/cappuccino/Build"
COLORTERM => "gnome-terminal"
DBUS_SESSION_BUS_ADDRESS => "unix:abstract=/tmp/dbus-Hp98B7Xjn9,guid=15354c350aefacc311107e5100000061"
DEFAULTS_PATH => "/usr/share/gconf/Lubuntu.default.path"
DEFAULT_GHC_OPTIONS => "-O2"
DESKTOP_SESSION => "Lubuntu"
DISPLAY => ":0"
GDMSESSION => "Lubuntu"
GDM_LANG => "fr"
GNOME_KEYRING_CONTROL => "/tmp/keyring-S5aOL0"
GNOME_KEYRING_PID => "1575"
GTK_MODULES => "canberra-gtk-module:canberra-gtk-module"
HOME => "/home/y"
LANG => "fr_FR.UTF-8"
LANGUAGE => "fr:en"
LOGNAME => "y"
LS_COLORS => "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:"
MANDATORY_PATH => "/usr/share/gconf/Lubuntu.mandatory.path"
OLDPWD => "/home/y/Sites/webroot"
PATH => "/home/y/narwhal/bin:/home/y/.cabal/bin:/home/y/bin:/usr/local/bin:/usr/bin:/bin:/usr/games"
PWD => "/home/y/Sites/webroot"
SAL_USE_VCLPLUGIN => "gtk"
SHELL => "/usr/bin/zsh"
SHLVL => "3"
SSH_AGENT_PID => "1659"
SSH_AUTH_SOCK => "/tmp/keyring-S5aOL0/ssh"
TERM => "xterm"
UBUNTU_MENUPROXY => "libappmenu.so"
USER => "y"
USERNAME => "y"
WINDOWID => "39845892"
WINDOWPATH => "7"
XAUTHORITY => "/var/run/gdm/auth-for-y-FEu9Ou/database"
XDG_CONFIG_DIRS => "/etc/xdg/lubuntu/:/etc/xdg/xdg-Lubuntu:/etc/xdg"
XDG_CONFIG_HOME => "/home/y/.config"
XDG_CURRENT_DESKTOP => "LXDE"
XDG_DATA_DIRS => "/etc/xdg/lubuntu:/usr/share/Lubuntu:/usr/local/share/:/usr/share/:/usr/share:/usr/share/gdm:/var/lib/menu-xdg"
XDG_MENU_PREFIX => "lxde-"
XDG_SESSION_COOKIE => "2967f5ac8d4676a86149144a000004ac-1349250736.25162-1033128370"
_ => "/usr/local/bin/nanoc"
_LXSESSION_PID => "1592"
__GIT_PROMPT_DIR => "/home/y/.zsh/git-prompt"
=== $LOAD_PATH:
0. /var/lib/gems/1.9.1/gems/nanoc-3.4.0/lib
1. /var/lib/gems/1.9.1/gems/nanoc-3.4.0/lib
2. /var/lib/gems/1.9.1/gems/colored-1.2/lib
3. /var/lib/gems/1.9.1/gems/cri-2.3.0/lib
4. /var/lib/gems/1.9.1/gems/builder-3.0.0/lib
5. /var/lib/gems/1.9.1/gems/kramdown-0.13.7/lib
6. /var/lib/gems/1.9.1/gems/sass-3.1.19/lib
7. /usr/local/lib/site_ruby/1.9.1
8. /usr/local/lib/site_ruby/1.9.1/i686-linux
9. /usr/local/lib/site_ruby
10. /usr/lib/ruby/vendor_ruby/1.9.1
11. /usr/lib/ruby/vendor_ruby/1.9.1/i686-linux
12. /usr/lib/ruby/vendor_ruby
13. /usr/lib/ruby/1.9.1
14. /usr/lib/ruby/1.9.1/i686-linux

View file

@ -1 +1 @@
./output/Scratch/img/blog/Category-Theory-Programming
./output/Scratch/img/blog/Category-Theory-Presentation

View file

@ -1 +1 @@
multi/blog/Category-Theory-Programming.md
multi/blog/Category-Theory-Presentation.md

View file

@ -93,26 +93,26 @@
<%= tradOf(:subscribe) %>
</a>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('#comment').hide();
$('#clickcomment').click(showComments);
});
function showComments() {
$('#comment').show();
$('#clickcomment').fadeOut();
}
document.write('<div id="clickcomment"><%= tradOf(:clickForComment) %></div>');
</script>
<div class="flush"></div>
<div class="corps" id="comment">
<h2 class="first"><%= tradOf(:comment) %></h2>
<noscript>
<%= tradOf(:enableJavascriptToComment) %>
</noscript>
<%= generateIntenseDebateThread %>
</div>
<div id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'yannesposito'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
</div>
<div id="entete" class="corps_spaced">
<div id="liens">

183
layouts/article2.html Normal file
View file

@ -0,0 +1,183 @@
-----
-----
<% language, languages, blog, article = setItemConf %><?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><%
t=tags
if t.length > 0
%> <meta name="keywords" content="<%= t %>"><%
end
%> <link rel="shortcut icon" type="image/x-icon" href="<%=@config[:webprefix]%>/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="<%=@config[:webprefix]%>/assets/css/main2.css" />
<link rel="stylesheet" type="text/css" href="<%=@config[:webprefix]%>/css/solarized_striped.css" />
<link rel="stylesheet" type="text/css" href="<%=@config[:webprefix]%>/css/idc.css" />
<link href='http://fonts.googleapis.com/css?family=Inconsolata' rel='stylesheet' type='text/css'>
<link rel="alternate" type="application/rss+xml" title="RSS" href="http://feeds.feedburner.com/yannespositocom<%= language %>"/><%
languages.each do |lang|
item_for_lang=item_of_language(lang)
if not item_for_lang.nil? %>
<link rel="alternate" lang="<%= lang %>" xml:lang="<%= lang %>" title="<%= item_for_lang[:title] %>" type="text/html" hreflang="<%= lang %>" href="<%= item_for_lang.reps[0].path %>" /> <%
end
end
%>
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<title><%= @item[:title] %></title>
</head>
<body lang="<%= language %>" class="article">
<script type="text/javascript">// <![CDATA[
document.write('<div id="blackpage"><div><%= tradOf(:welcomeloading)%><img src="<%=@config[:webprefix]%>/img/loading.gif" alt="<%= tradOf(:loading) %>"/></div></div>');
// ]]>
</script>
<div id="content">
<div id="choix">
<div class="return"><a href="#entete">&darr; Menu &darr;</a></div>
<div id="choixlang"><%=
languages.map do |l|
dest=@item_rep.path.sub(%r{#{@config[:webprefix]}/../}, %{#{config[:webprefix]}/#{l}/})
if @item_rep.path != dest
%{<a href="#{dest}" onclick="setLanguage('#{l}')">#{ tradOfKeywordIn(:switchTo,l)}</a>}
else
nil
end
end.join() %>
</div>
<div class="flush"></div>
</div>
<div id="titre">
<h1>
<%= @item[:title] %>
</h1>
<% unless @item[:subtitle].nil? %>
<h2>
<%= @item[:subtitle] %>
</h2>
<% end %>
</div>
<div class="flush"></div>
<% if content_for(@item,:summary) %>
<div class="corps summary">
<% content_for(@item,:summary) %>
</div>
<% end %>
<%= generateSubMenu %>
<div class="flush"></div>
<div id="afterheader">
<div class="corps">
<%= yield %>
</div>
<% depth = depthOf(@item) %>
<% if depth > 3 or ( depth == 3 and @item.children.length > 0 ) %>
<div class="navigation">
<div class="navigationprev"><%= previousFor(@item) %></div>
<div class="navigationnext"><%= nextFor(@item) %></div>
</div>
<div class="flush"></div>
<% end %>
<div id="social">
<div class="left"> <%= twitter_share_button %> </div>
<div class="left"> <%= google_plus_button %> </div>
<div class="flush"></div>
</div>
<div id="choixrss">
<a id="rss" href="http://feeds.feedburner.com/yannespositocom<%= language %>">
<%= tradOf(:subscribe) %>
</a>
</div>
<div class="flush"></div>
<div class="corps" id="comment">
<h2 class="first"><%= tradOf(:comment) %></h2>
<div id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'yannesposito'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
</div>
<div id="entete" class="corps_spaced">
<div id="liens">
<%= generateMenu %>
</div>
<div class="flush"></div>
<hr/>
<div id="next_before_articles">
<div id="previous_articles">
<%= tradOf(:previousArticles) %>
<%
(1..3).each do |n|
a=article_brother(-n)
if not a.nil?
%>
<div class="previous_article">
<%= link_to( %{<span class="nicer">«</span>&nbsp;}+ a[:title], a) %>
</div>
<% end %>
<% end %>
</div>
<div id="next_articles">
<%= tradOf(:nextArticles) %>
<%
(1..3).each do |n|
a=article_brother(n)
if not a.nil?
%>
<div class="next_article">
<%= link_to(a[:title] + %{&nbsp;<span class="nicer">»</span>}, a) %>
</div>
<% end %>
<% end %>
</div>
<div class="flush"></div>
</div>
</div>
<div id="bottom">
<div>
<a href="https://twitter.com/yogsototh">Follow @yogsototh</a>
</div>
<div>
<%=tradOf(:copyright) %>
</div>
<div id="lastmod">
<%=tradOf(:created_at)%>: <%= @item[:created_at].strftime(@config[:dateFormat][language.intern]) %>
<%=tradOf(:last_modified)%>: <%= gitmtime.strftime(@config[:dateFormat][language.intern]) %>
</div>
<div>
<%= tradOf(:entirely_done_with) %>
<a href="http://www.vim.org">Vim</a>
<%= tradOf(:and) %>
<a href="http://nanoc.stoneship.org">nanoc</a>
</div>
</div>
<div class="clear"></div>
</div>
</div>
</body>
<script type="text/javascript" src="<%=@config[:webprefix]%>/js/jquery-1.3.1.min.js"></script>
<script type="text/javascript" src="<%=@config[:webprefix]%>/js/jquery.cookie.js"></script>
<script type="text/javascript" src="<%=@config[:webprefix]%>/js/index.js"></script>
<script type="text/javascript" src="<%=@config[:webprefix]%>/js/highlight/highlight.pack.js"></script>
<script type="text/javascript" src="<%=@config[:webprefix]%>/js/article.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
</html>

8
lib/fix_img.rb Normal file
View file

@ -0,0 +1,8 @@
class FixImage < Nanoc3::Filter
identifier :fix_img
def run(content, params={})
content.gsub(%r{<p>(<img[^>]*>)</p>}) do |m|
$1.to_s
end
end
end

View file

@ -18,6 +18,6 @@ def generateIntenseDebateThread
var idcomments_post_url = 'http://yannesposito.com#{protectedPath}';
</script>
<span id="IDCommentsPostTitle" style="display:none"></span>
<script type='text/javascript' src='#{@config[:webprefix]}/js/genericCommentWrapperV2.js'></script>
<script type=text/javascript src=http://www.intensedebate.com/js/genericCommentWrapperV2.js></script>
}
end

File diff suppressed because it is too large Load diff

View file

@ -187,7 +187,7 @@ fr: > <pre>
fr: > runhaskell filename.lhs
fr: > </pre>
fr: >
fr: > Certain ne marcheront pas, mais la majorité vous donneront un résultat.
fr: > Certains ne marcheront pas, mais la majorité vous donneront un résultat.
fr: > Vous devriez voir un lien juste en dessous.
enddiv

View file

@ -172,16 +172,13 @@ fr: Mais la seconde est plus bien supérieure en terme d'architecture.
fr: Je ne veux pas discuster ici pourquoi c'est mieux.
fr: Je vous demande simplement de me croire quand je dis que l'approche fonctionnelle est supérieure.
fr: Actuellement il me manque une fonction lambda, si quelqu'un à une idée elle serait la bienvenue.
fr: Je ne sais pas encore comment créer facilement des fonctions anonymes.
en: Actually I lack the lambda operator.
en: If someone has an idea on how to create anonymous functions, just tell me, thanks.
en: You can find an [updated version of the code (thanks to Arash Rouhani)](https://github.com/Tarrasch/zsh-functional).
en: An older version is [here thought](https://github.com/yogsototh/zsh_functional).
en: Here is the (first version) source code:
fr: Vous pouvez télécharger [une version à jour du code (merci à Arash Rouhani)](https://github.com/Tarrasch/zsh-functional).
fr: Une ancienne version est [ici](https://github.com/yogsototh/zsh_functional).
fr: Voici le code source (de la première version) :
en: Here is the (first version[^1]) source code:
fr: Voici le code source (de la première version[^1]) :
en: [^1]: As stated in the intro, if you want to install it, just go [there](https://github.com/yogsototh/zsh_functional).
fr: [^1]: Comme précisé dans l'introduction, si vous voulez l'installez allez plutôt voir dans ce [repository](https://github.com/yogsototh/zsh_functional).
<code class="zsh" file="functional.sh">
#!/usr/bin/env zsh

View file

@ -0,0 +1 @@
pre,code,a.cut{font-family:"cmuntt",Incosolata,Monaco,monospace}body{font-family:"ComputerModern",Georgia,Palatino,"Century Schoolbook L","Times New Roman",Times,serif}

File diff suppressed because one or more lines are too long

View file

@ -1,21 +1,21 @@
/*
* http://ethanschoonover.com/solarized
* base03 #002b36
* base02 #073642
* base01 #586e75
* base00 #657b83
* base0 #839496
* base1 #93a1a1
* base2 #eee8d5
* base3 #fdf6e3
* yellow #b58900
* orange #cb4b16
* red #dc322f
* magenta #d33682
* violet #6c71c4
* blue #268bd2
* cyan #2aa198
* green #859900
* base03 #002b36
* base02 #073642
* base01 #586e75
* base00 #657b83
* base0 #839496
* base1 #93a1a1
* base2 #eee8d5
* base3 #fdf6e3
* yellow #b58900
* orange #cb4b16
* red #dc322f
* magenta #d33682
* violet #6c71c4
* blue #268bd2
* cyan #2aa198
* green #859900
*/
/* base03 */
@ -27,12 +27,12 @@ pre {
}
pre .high0 { color:#586e75; }
pre .high,
pre .high,
pre .high1 { color:#073642; }
pre .high2 { color:#002b36; }
/* default text color */
pre,
pre,
pre .DiffInserted,
pre .DiffChanged,
pre .DiffHeader,
@ -90,13 +90,13 @@ pre .InvalidDeprecated {
font-style: italic;
}
pre .magenta,
pre .magenta,
pre .CCCPreprocessorLine,
pre .CCCPreprocessorDirective
pre .CCCPreprocessorDirective
{ color: #d33682; }
pre .violet,
pre .Constant
pre .violet,
pre .Constant
{ color: #6c71c4; }
/* Blue */
@ -133,10 +133,10 @@ pre .CssConstructorArgument {
Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull <sourdrums@gmail.com>
*/
pre {
display: block; }
pre code {
display: block;
/* background: #002b36; */
/* background: #002b36; */
color: #657b83;
background-color: #f3f4f5;
}

View file

@ -0,0 +1,217 @@
/*
* http://ethanschoonover.com/solarized
* base03 #002b36
* base02 #073642
* base01 #586e75
* base00 #657b83
* base0 #839496
* base1 #93a1a1
* base2 #eee8d5
* base3 #fdf6e3
* yellow #b58900
* orange #cb4b16
* red #dc322f
* magenta #d33682
* violet #6c71c4
* blue #268bd2
* cyan #2aa198
* green #859900
*/
/* base03 */
pre {
color: #657b83;
}
pre .high0 { color:#586e75; }
pre .high,
pre .high1 { color:#073642; }
pre .high2 { color:#002b36; }
/* default text color */
pre,
pre .DiffInserted,
pre .DiffChanged,
pre .DiffHeader,
pre .DiffDeleted,
pre .EmbeddedSource,
pre .EmbeddedSourceBright {
color: #839496;
}
pre .DiffHeader { font-style: italic; }
/* Highlighted background */
pre .EmbeddedSource,
pre .EmbeddedSourceBright {
background-color: #073642;
}
/* Present but not intrusive */
pre .low,
pre .line-numbers,
pre .DoctypeXmlProcessing,
pre .Comment {
color: #586e75;
}
pre .Comment {
font-style: italic;
}
/* Yellow */
pre .yellow,
pre .CssClass,
pre .CssPropertyName,
pre .Entity,
pre .MarkupList,
pre .EntityInheritedClass {
color: #b58900;
}
pre .EntityInheritedClass {
font-style: italic;
}
/* Orange */
pre .orange,
pre .String,
pre .StringRegexp,
pre .StringEmbeddedSource,
pre .StringConstant,
pre .MetaTagAll {
color: #cb4b16;
}
/* Red */
pre .red,
pre .InvalidIllegal,
pre .CssAtRule,
pre .InvalidDeprecated {
color: #dc322f ;
font-style: italic;
}
pre .magenta,
pre .CCCPreprocessorLine,
pre .CCCPreprocessorDirective
{ color: #d33682; }
pre .violet,
pre .Constant
{ color: #6c71c4; }
/* Blue */
pre .blue,
pre .Storage,
pre .Variable,
pre .CssId,
pre .SupportFunction,
pre .MetaTagInline,
pre .StringRegexpSpecial,
pre .CssTagName,
pre .StringVariable,
pre .Support {
color: #268bd2 ;
}
/* Cyan */
pre .cyan,
pre .MarkupHeading,
pre .CssAdditionalConstants,
pre .CssPropertyValue,
pre .SupportConstant {
color: #2aa198;
}
/* Green */
pre .green,
pre .CssPseudoClass,
pre .Keyword,
pre .CssConstructorArgument {
color: #859900;
}
/*
Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull <sourdrums@gmail.com>
*/
pre {
display: block; }
pre code {
color: #657b83;
}
pre .comment,
pre .template_comment,
pre .diff .header,
pre .doctype,
pre .lisp .string,
pre .javadoc {
color: #93a1a1;
font-style: italic;
}
pre .keyword,
pre .css .rule .keyword,
pre .winutils,
pre .javascript .title,
pre .method,
pre .addition,
pre .css .tag,
pre .lisp .title {
color: #859900;
}
pre .number,
pre .command,
pre .string,
pre .tag .value,
pre .phpdoc,
pre .tex .formula,
pre .regexp,
pre .hexcolor {
color: #2aa198;
}
pre .title,
pre .localvars,
pre .function .title,
pre .chunk,
pre .decorator,
pre .builtin,
pre .built_in,
pre .lisp .title,
pre .identifier,
pre .title .keymethods,
pre .id {
color: #268bd2;
}
pre .attribute,
pre .variable,
pre .instancevar,
pre .lisp .body,
pre .smalltalk .number,
pre .constant,
pre .class .title,
pre .parent,
pre .haskell .label {
color: #b58900;
}
pre .preprocessor,
pre .pi,
pre .shebang,
pre .symbol,
pre .diff .change,
pre .special,
pre .keymethods,
pre .attr_selector,
pre .important,
pre .subst,
pre .cdata {
color: #cb4b16;
}
pre .deletion {
color: #dc322f;
}
pre .tex .formula {
background: #eee8d5;
}

View file

@ -1,2 +1,2 @@
body {
font-family: Georgia, Palatino, "Century Schoolbook L", "Times New Roman", Times, serif; }
font-family: MathJax_Main, Georgia, Palatino, "Century Schoolbook L", "Times New Roman", Times, serif; }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View file

@ -10,12 +10,7 @@
<link href='http://fonts.googleapis.com/css?family=Inconsolata' rel='stylesheet' type='text/css'>
<link rel="alternate" type="application/rss+xml" title="RSS" href="http://feeds.feedburner.com/yannespositocomen"/>
<link rel="alternate" lang="fr" xml:lang="fr" title="Un example progressif avec Haskell" type="text/html" hreflang="fr" href="/Scratch/fr/blog/Haskell-OpenGL-Mandelbrot/" />
<link rel="alternate" lang="en" xml:lang="en" title="Haskell Progressive Example" type="text/html" hreflang="en" href="/Scratch/en/blog/Haskell-OpenGL-Mandelbrot/" /> <script type="text/javascript" src="/Scratch/js/jquery-1.3.1.min.js"></script>
<script type="text/javascript" src="/Scratch/js/jquery.cookie.js"></script>
<script type="text/javascript" src="/Scratch/js/index.js"></script>
<script type="text/javascript" src="/Scratch/js/highlight/highlight.pack.js"></script>
<script type="text/javascript" src="/Scratch/js/article.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="alternate" lang="en" xml:lang="en" title="Haskell Progressive Example" type="text/html" hreflang="en" href="/Scratch/en/blog/Haskell-OpenGL-Mandelbrot/" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
@ -23,7 +18,7 @@
</head>
<body lang="en" class="article">
<script type="text/javascript">// <![CDATA[
document.write('<div id="blackpage"><img src="/Scratch/img/loading.gif" alt="loading..."/></div>');
document.write('<div id="blackpage"><div>Hi! Start reading while a better style is loading...<img src="/Scratch/img/loading.gif" alt="loading..."/></div></div>');
// ]]>
</script>
@ -72,7 +67,7 @@ Imperative language could also benefit from this functional organization.</p>
<ul id="markdown-toc">
<li><a href="#introduction">Introduction</a></li>
<li><a href="#first-version">First version</a> <ul>
<li><a href="#lets-play-the-song-of-our-people">Lets play the song of our people</a></li>
<li><a href="#lets-play-the-song-of-our-people">Let&rsquo;s play the song of our people</a></li>
<li><a href="#let-us-start">Let us start</a></li>
</ul>
</li>
@ -157,7 +152,7 @@ We start cleaning the code at the 5<sup>th</sup> section.</p>
The first being mostly some boilerplate<sup id="fnref:011"><a href="#fn:011" rel="footnote">2</a></sup>.
And the second part more focused on OpenGL and content.</p>
<h3 id="lets-play-the-song-of-our-people">Lets play the song of our people</h3>
<h3 id="lets-play-the-song-of-our-people">Let&rsquo;s play the song of our people</h3>
<div class="codehighlight">
@ -393,7 +388,7 @@ It is a bit long before the first image appears, but if you resize the window, i
This property is a direct consequence of purity.
If you look closely, you see that <code>allPoints</code> is a pure list.
Therefore, calling <code>allPoints</code> will always render the same result and Haskell is clever enough to use this property.
While Haskell doesnt garbage collect <code>allPoints</code> the result is reused for free.
While Haskell doesn&rsquo;t garbage collect <code>allPoints</code> the result is reused for free.
We did not specified this value should be saved for later use.
It is saved for us.</p>
@ -631,7 +626,7 @@ instead of using a 3D projection of quaternions.
I am pretty sure this construction is not useful for numbers.
But it will be enough for us to create something that look nice.</p>
<p>This section is quite long, but dont be afraid,
<p>This section is quite long, but don&rsquo;t be afraid,
most of the code is some OpenGL boilerplate.
If you just want to skim this section,
here is a high level representation:</p>
@ -647,7 +642,7 @@ here is a high level representation:</p>
<p>Drawing: </p>
<ul>
<li>set doubleBuffer, handle depth, window size</li>
<li>set doubleBuffer, handle depth, window size&hellip;</li>
<li>Use state to apply some transformations</li>
</ul>
</li>
@ -903,7 +898,7 @@ Mainly there are two parts: apply some transformations, draw the object.</p>
<h3 id="the-3d-mandelbrot">The 3D Mandelbrot</h3>
<p>We have finished with the OpenGL section, lets talk about how we
<p>We have finished with the OpenGL section, let&rsquo;s talk about how we
generate the 3D points and colors.
First, we will set the number of details to 200 pixels in the three dimensions.</p>
@ -1017,7 +1012,7 @@ depthPoints = do
<p>If you prefer the first version, then just imagine how hard it will be to change the enumeration of the point from (x,y) to (x,z) for example.</p>
<p>Also, we didnt searched for negative values.
<p>Also, we didn&rsquo;t searched for negative values.
This modified Mandelbrot is no more symmetric relatively to the plan <code>y=0</code>.
But it is symmetric relatively to the plan <code>z=0</code>.
Then I mirror these values. </p>
@ -1242,7 +1237,7 @@ ymandel x y z = mandel (2*x/width) (2*y/height) (2*z/deep) 64
</div>
<p>This code is cleaner but many things doesnt feel right.
<p>This code is cleaner but many things doesn&rsquo;t feel right.
First, all the user interaction code is outside our main file.
I feel it is okay to hide the detail for the rendering.
But I would have preferred to control the user actions.</p>
@ -1276,12 +1271,12 @@ We will have two choices: </p>
</li>
<li>
<p>Our main problem come from user interaction.
If you ask “the Internet”,
If you ask &ldquo;the Internet&rdquo;,
about how to deal with user interaction with a functional paradigm,
the main answer is to use <em>functional reactive programming</em> (FRP).
I wont use FRP in this article.
Instead, Ill use a simpler while less effective way to deal with user interaction.
But The method Ill use will be as pure and functional as possible.</p>
I won&rsquo;t use FRP in this article.
Instead, I&rsquo;ll use a simpler while less effective way to deal with user interaction.
But The method I&rsquo;ll use will be as pure and functional as possible.</p>
</li>
</ol>
@ -1303,7 +1298,7 @@ First, what the main loop should look like if we could make our own:</p>
<li>a function taking two parameters: time and world state and render a new world without user interaction.</li>
</ul>
<p>Here is a real working code, Ive hidden most display functions.
<p>Here is a real working code, I&rsquo;ve hidden most display functions.
The YGL, is a kind of framework to display 3D functions.
But it can easily be extended to many kind of representation.</p>
@ -1523,7 +1518,7 @@ idleAction tnew world = world {
<p>Now the function which will generate points in 3D.
The first parameter (<code>res</code>) is the resolution of the vertex generation.
More precisely, <code>res</code> is distance between two points on one direction.
We need it to “close” our shape.</p>
We need it to &ldquo;close&rdquo; our shape.</p>
<p>The type <code>Function3D</code> is <code>Point -&gt; Point -&gt; Maybe Point</code>.
Because we consider partial functions
@ -1592,7 +1587,7 @@ ymandel x y z = fromIntegral (mandel x y z 64) / 64
</div>
<p>I wont explain how the magic occurs here.
<p>I won&rsquo;t explain how the magic occurs here.
If you are interested, just read the file <a href="code/05_Mandelbulb/YGL.hs"><code>YGL.hs</code></a>.
It is commented a lot.</p>
@ -1612,8 +1607,8 @@ It is commented a lot.</p>
<p>Our code architecture feel very clean.
All the meaningful code is in our main file and all display details are
externalized.
If you read the code of <code>YGL.hs</code>, youll see I didnt made everything perfect.
For example, I didnt finished the code of the lights.
If you read the code of <code>YGL.hs</code>, you&rsquo;ll see I didn&rsquo;t made everything perfect.
For example, I didn&rsquo;t finished the code of the lights.
But I believe it is a good first step and it will be easy to go further.
Unfortunately the program of the preceding session is extremely slow.
We compute the Mandelbulb for each frame now.</p>
@ -1897,20 +1892,20 @@ ymandel x y z = fromIntegral (mandel x y z 64) / 64
<p>As we can use imperative style in a functional language,
know you can use functional style in imperative languages.
This article exposed a way to organize some code in a functional way.
Id like to stress the usage of Haskell made it very simple to achieve this.</p>
I&rsquo;d like to stress the usage of Haskell made it very simple to achieve this.</p>
<p>Once you are used to pure functional style,
it is hard not to see all advantages it offers.</p>
<p>The code in the two last sections is completely pure and functional.
Furthermore I dont use <code>GLfloat</code>, <code>Color3</code> or any other OpenGL type.
Furthermore I don&rsquo;t use <code>GLfloat</code>, <code>Color3</code> or any other OpenGL type.
If I want to use another library in the future,
I would be able to keep all the pure code and simply update the YGL module.</p>
<p>The <code>YGL</code> module can be seen as a “wrapper” around 3D display and user interaction.
<p>The <code>YGL</code> module can be seen as a &ldquo;wrapper&rdquo; around 3D display and user interaction.
It is a clean separator between the imperative paradigm and functional paradigm.</p>
<p>If you want to go further, it shouldnt be hard to add parallelism.
<p>If you want to go further, it shouldn&rsquo;t be hard to add parallelism.
This should be easy mainly because most of the visible code is pure.
Such an optimization would have been harder by using directly the OpenGL library.</p>
@ -1920,7 +1915,7 @@ O(n².log(n)) to O(n³).</p>
<hr/><div class="footnotes">
<ol>
<li id="fn:001">
<p>Unfortunately, I couldnt make this program to work on my Mac. More precisely, I couldnt make the <a href="http://openil.sourceforge.net/">DevIL</a> library work on Mac to output the image. Yes I have done a <code>brew install libdevil</code>. But even a minimal program who simply write some <code>jpg</code> didnt worked. I tried both with <code>Haskell</code> and <code>C</code>.<a href="#fnref:001" rel="reference">&#8617;</a></p>
<p>Unfortunately, I couldn&rsquo;t make this program to work on my Mac. More precisely, I couldn&rsquo;t make the <a href="http://openil.sourceforge.net/">DevIL</a> library work on Mac to output the image. Yes I have done a <code>brew install libdevil</code>. But even a minimal program who simply write some <code>jpg</code> didn&rsquo;t worked. I tried both with <code>Haskell</code> and <code>C</code>.<a href="#fnref:001" rel="reference">&#8617;</a></p>
</li>
<li id="fn:011">
<p>Generally in Haskell you need to declare a lot of import lines.
@ -1961,34 +1956,26 @@ O(n².log(n)) to O(n³).</p>
Subscribe
</a>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('#comment').hide();
$('#clickcomment').click(showComments);
});
function showComments() {
$('#comment').show();
$('#clickcomment').fadeOut();
}
document.write('<div id="clickcomment">Comments &amp; Share</div>');
</script>
<div class="flush"></div>
<div class="corps" id="comment">
<h2 class="first">comments</h2>
<noscript>
You must enable javascript to comment.
</noscript>
<script type="text/javascript">
var idcomments_acct = 'a307f0044511ff1b5cfca573fc0a52e7';
var idcomments_post_id = '/Scratch/en/blog/Haskell-OpenGL-Mandelbrot/';
var idcomments_post_url = 'http://yannesposito.com/Scratch/en/blog/Haskell-OpenGL-Mandelbrot/';
</script>
<span id="IDCommentsPostTitle" style="display:none"></span>
<script type='text/javascript' src='/Scratch/js/genericCommentWrapperV2.js'></script>
</div>
<div id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'yannesposito'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
</div>
<div id="entete" class="corps_spaced">
<div id="liens">
@ -2023,7 +2010,7 @@ O(n².log(n)) to O(n³).</p>
next entries
<div class="next_article">
<a href="/Scratch/en/blog/Category-Theory-Programming/">Category Theory Programming&nbsp;<span class="nicer">»</span></a>
<a href="/Scratch/en/blog/Category-Theory-Presentation/">Category Theory Presentation&nbsp;<span class="nicer">»</span></a>
</div>
@ -2057,4 +2044,10 @@ O(n².log(n)) to O(n³).</p>
</div>
</div>
</body>
<script type="text/javascript" src="/Scratch/js/jquery-1.3.1.min.js"></script>
<script type="text/javascript" src="/Scratch/js/jquery.cookie.js"></script>
<script type="text/javascript" src="/Scratch/js/index.js"></script>
<script type="text/javascript" src="/Scratch/js/highlight/highlight.pack.js"></script>
<script type="text/javascript" src="/Scratch/js/article.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
</html>

View file

@ -2,7 +2,7 @@
<feed xmlns="http://www.w3.org/2005/Atom">
<id>http://yannesposito.com/</id>
<title>Yogsototh's last blogs entries</title>
<updated>2012-10-01T17:16:43Z</updated>
<updated>2012-12-12T08:06:40Z</updated>
<link rel="alternate" href="http://yannesposito.com/"/>
<link rel="self" href="http://feeds.feedburner.com/yannespositocomen"/>
<author>
@ -10,44 +10,31 @@
<uri>http://yannesposito.com</uri>
</author>
<entry>
<id>tag:yannesposito.com,2012-10-01:/Scratch/en/blog/Category-Theory-Programming/</id>
<title type="html">Category Theory Programming</title>
<published>2012-10-01T17:16:43Z</published>
<updated>2012-10-01T17:16:43Z</updated>
<id>tag:yannesposito.com,2012-12-12:/Scratch/en/blog/Category-Theory-Presentation/</id>
<title type="html">Category Theory Presentation</title>
<published>2012-12-12T08:06:40Z</published>
<updated>2012-12-12T08:06:40Z</updated>
<author>
<name>Yann Esposito</name>
<uri>yannesposito.com</uri>
</author>
<link rel="alternate" href="http://yannesposito.com/Scratch/en/blog/Category-Theory-Programming/"/>
<content type="html">
&lt;div class="intro"&gt;
<link rel="alternate" href="http://yannesposito.com/Scratch/en/blog/Category-Theory-Presentation/"/>
<content type="html">&lt;img src="/keynote/categories/img/mp/cat-hask-endofunctor.png" alt="Cateogry of Hask's endofunctors"/&gt;
&lt;p&gt;Yesterday I was happy to make a presentation about Category Theory at &lt;a href="http://www.meetup.com/riviera-scala-clojure"&gt;Riviera Scala Clojure Meetup&lt;/a&gt; (note I used only Haskell for my examples).&lt;/p&gt;
&lt;p&gt;&lt;span class="sc"&gt;&lt;abbr title="Too long; didn't read"&gt;tl;dr&lt;/abbr&gt;: &lt;/span&gt; How to program using category theory.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="/keynote/categories.html"&gt;Click here to go to the HTML presentation.&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a href="/keynote/categories.pdf"&gt;Click Here to download the PDF slides (%latex not rendered properly)&lt;/a&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;blockquote&gt;
&lt;center&gt;&lt;hr style="width:30%;float:left;border-color:#CCCCD0;margin-top:1em" /&gt;&lt;span class="sc"&gt;&lt;b&gt;Table of Content&lt;/b&gt;&lt;/span&gt;&lt;hr style="width:30%;float:right;border-color:#CCCCD0;margin-top:1em" /&gt;&lt;/center&gt;
&lt;p&gt;If you don't want to read them through an HTML presentations framework or downloading a big PDF
just continue to read as a standard web page.
&lt;/p&gt;
&lt;ul id="markdown-toc"&gt;
&lt;li&gt;&lt;a href="#introduction"&gt;Introduction&lt;/a&gt; &lt;ul&gt;
&lt;li&gt;&lt;a href="#programming-paradigms"&gt;Programming Paradigms&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#get-some-intuition"&gt;Get some intuition&lt;/a&gt; &lt;ul&gt;
&lt;li&gt;&lt;a href="#representation-of-category"&gt;Representation of Category&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;%TODO{Do every...&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;</content>
&lt;div style="display:none"&gt;
\(\newcommand{\F}{\mathbf{F}}\)
\(\newcommand{\E}{\mathbf{E}}\)
\(\newcommand{\C}{\mathc...&lt;/div&gt;&lt;/img&gt;</content>
</entry>
<entry>
<id>tag:yannesposito.com,2012-06-15:/Scratch/en/blog/Haskell-OpenGL-Mandelbrot/</id>
@ -59,7 +46,7 @@
<uri>yannesposito.com</uri>
</author>
<link rel="alternate" href="http://yannesposito.com/Scratch/en/blog/Haskell-OpenGL-Mandelbrot/"/>
<content type="html">&lt;p&gt;&lt;img alt="The B in Benoît B. Mandelbrot stand for Benoît B. Mandelbrot" src="/Scratch/img/blog/Haskell-OpenGL-Mandelbrot/BenoitBMandelbrot.jpg" /&gt;&lt;/p&gt;
<content type="html">&lt;p&gt;&lt;img alt="The B in Beno&#238;t B. Mandelbrot stand for Beno&#238;t B. Mandelbrot" src="/Scratch/img/blog/Haskell-OpenGL-Mandelbrot/BenoitBMandelbrot.jpg" /&gt;&lt;/p&gt;
&lt;div class="intro"&gt;
@ -117,7 +104,7 @@ Imperative language could also benefit from this functional organization.&lt;/p&
&lt;div class="intro"&gt;
&lt;p&gt;&lt;span class="sc"&gt;&lt;abbr title="Too long; didn't read"&gt;tl;dr&lt;/abbr&gt;: &lt;/span&gt; Web typography sucks and well have to wait forever before it will be fixed.&lt;/p&gt;
&lt;p&gt;&lt;span class="sc"&gt;&lt;abbr title="Too long; didn't read"&gt;tl;dr&lt;/abbr&gt;: &lt;/span&gt; Web typography sucks and we&amp;rsquo;ll have to wait forever before it will be fixed.&lt;/p&gt;
&lt;/div&gt;
@ -126,13 +113,13 @@ Imperative language could also benefit from this functional organization.&lt;/p&
&lt;p&gt;I stumbled upon &lt;a href="http://opentypography.org/"&gt;open typography&lt;/a&gt;. Their main message is:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;«There is no reason to wait for browser development to catch up.
We can all create better web typography ourselves, today.»&lt;/p&gt;
&lt;p&gt;&#171;There is no reason to wait for browser development to catch up.
We can all create better web typography ourselves, today.&#187;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;As somebody who tried to make my website using some nice typography features and in particular &lt;em&gt;ligatures&lt;/em&gt;, I believe this is wrong.&lt;/p&gt;
&lt;p&gt;I already made an automatic syst...&lt;/p&gt;&lt;/p&gt;</content>
&lt;p&gt;I already made an automa...&lt;/p&gt;&lt;/p&gt;</content>
</entry>
<entry>
<id>tag:yannesposito.com,2012-01-15:/Scratch/en/blog/Yesod-tutorial-for-newbies/</id>
@ -154,7 +141,7 @@ We can all create better web typography ourselves, today.»&lt;/p&gt;
&lt;p&gt;&lt;span class="sc"&gt;&lt;abbr title="Too long; didn't read"&gt;tl;dr&lt;/abbr&gt;: &lt;/span&gt; A simple yesod tutorial.
Yesod is a Haskell web framework.
You shouldnt need to know Haskell. &lt;/p&gt;
You shouldn&amp;rsquo;t need to know Haskell. &lt;/p&gt;
&lt;blockquote&gt;
&lt;center&gt;&lt;span class="sc"&gt;&lt;b&gt;Table of content&lt;/b&gt;&lt;/span&gt;&lt;/center&gt;
@ -167,7 +154,7 @@ You shouldnt need to know Haskell. &lt;/p&gt;
&lt;li&gt;&lt;a href="#some-last-minute-words"&gt;Some last minute words&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;/p&gt;</content>
...&lt;/ul&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;/p&gt;</content>
</entry>
<entry>
<id>tag:yannesposito.com,2011-10-20:/Scratch/en/blog/SVG-and-m4-fractals/</id>
@ -217,7 +204,7 @@ Then some believed it would be a good idea to invent many &lt;span class="sc"&gt
&lt;p&gt;&lt;span class="sc"&gt;&lt;abbr title="Too long; didn't read"&gt;tl;dr&lt;/abbr&gt;: &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.yesodweb.com"&gt;Yesod&lt;/a&gt; is a web framework which recently reached the maturity for which you should consider to use it.
Before telling you why you should learn Haskell and use yesod, I will talk about ideas yesod introduced and I didnt saw in other frameworks before.&lt;/p&gt;
Before telling you why you should learn Haskell and use yesod, I will talk about ideas yesod introduced and I didn&amp;rsquo;t saw in other frameworks before.&lt;/p&gt;
&lt;/div&gt;
@ -225,11 +212,11 @@ Before telling you why you should learn Haskell and use yesod, I will talk about
&lt;h2 id="type-safety"&gt;Type safety&lt;/h2&gt;
&lt;p&gt;Lets start by an obligatory link from &lt;a href="http://xkcd.com"&gt;xkcd&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s start by an obligatory link from &lt;a href="http://xkcd.com"&gt;xkcd&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://imgs.xkcd.com/comics/exploits_of_a_mom.png" alt="SQL injection by a mom" /&gt;&lt;/p&gt;
&lt;p&gt;When you create a web application, a lot of time is spent dealing wit...&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;</content>
&lt;p&gt;When you create a web application, a lot of time is spent...&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;</content>
</entry>
<entry>
<id>tag:yannesposito.com,2011-09-28:/Scratch/en/blog/Higher-order-function-in-zsh/</id>
@ -293,7 +280,7 @@ $ mapl 'echo result $1' $(m...&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;</c
&lt;div class="intro"&gt;
&lt;span class="sc"&gt;&lt;abbr title="Too long; didn't read"&gt;tl;dr&lt;/abbr&gt;: &lt;/span&gt; My short and higly subjective feelings about programming languages I used.
&lt;span class="sc"&gt;&lt;abbr title="Too long; didn't read"&gt;tl;dr&lt;/abbr&gt;: &lt;/span&gt; My short and highly subjective feelings about the programming languages I used.
&lt;/div&gt;
@ -305,11 +292,11 @@ $ mapl 'echo result $1' $(m...&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;</c
&lt;p&gt;The language of my firsts programs!
I was about 10, with an &lt;code&gt;MO5&lt;/code&gt; and &lt;code&gt;Amstrad CPC 6128&lt;/code&gt; and even with my &lt;code&gt;Atari STe&lt;/code&gt;.
This is the language of &lt;code&gt;GOTO&lt;/code&gt;s.
Ô nostalgia.
&#212; nostalgia.
Unfortunately this might be the only interesting part of this language.&lt;/p&gt;
&lt;p&gt;Today this language is obsolescent.
It is not even good to learn pro...&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;</content>
It is not even good to lea...&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;</content>
</entry>
<entry>
<id>tag:yannesposito.com,2011-08-25:/Scratch/en/blog/Learn-Vim-Progressively/</id>
@ -321,7 +308,7 @@ It is not even good to learn pro...&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;</content>
<uri>yannesposito.com</uri>
</author>
<link rel="alternate" href="http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/"/>
<content type="html">&lt;p&gt;&lt;img alt="Über leet use vim!" src="/Scratch/img/blog/Learn-Vim-Progressively/uber_leet_use_vim.jpg" /&gt;&lt;/p&gt;
<content type="html">&lt;p&gt;&lt;img alt="&#220;ber leet use vim!" src="/Scratch/img/blog/Learn-Vim-Progressively/uber_leet_use_vim.jpg" /&gt;&lt;/p&gt;
&lt;div class="intro"&gt;
@ -340,10 +327,10 @@ It is not even good to learn pro...&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;</content>
&lt;/blockquote&gt;
&lt;p&gt;Learn &lt;a href="http://www.vim.org"&gt;vim&lt;/a&gt; and it will be your last text editor.
There isnt any better text editor that I know of.
There isn&amp;rsquo;t any better text editor that I know of.
It is hard to learn, but incredible to use.&lt;/p&gt;
&lt;p&gt;I suggest you teach yourself ...&lt;/p&gt;&lt;/p&gt;</content>
&lt;p&gt;I suggest you teach yo...&lt;/p&gt;&lt;/p&gt;</content>
</entry>
<entry>
<id>tag:yannesposito.com,2011-08-17:/Scratch/en/blog/A-more-convenient-diff/</id>
@ -359,7 +346,7 @@ It is hard to learn, but incredible to use.&lt;/p&gt;
&lt;p&gt;This is why, when you use &lt;code&gt;git&lt;/code&gt; it will use a better formatting and colorize it.&lt;/p&gt;
&lt;p&gt;Here is the script I use when I want to use human readable &lt;code&gt;diff&lt;/code&gt; à la git. &lt;/p&gt;
&lt;p&gt;Here is the script I use when I want to use human readable &lt;code&gt;diff&lt;/code&gt; &#224; la git. &lt;/p&gt;
&lt;div class="codefile"&gt;&lt;a href="/Scratch/en/blog/A-more-convenient-diff/code/ydiff"&gt;&amp;#x27A5; ydiff&lt;/a&gt;&lt;/div&gt;
@ -375,7 +362,7 @@ function colorize_diff {
-) print -n $fg[red];;
@) # Display in cyan the @@ positions @@
if [[ ${line[1]} = '@' ]]; then
line=$(print $line | perl -pe 's#(\@\@[^\@]*\@\@)(.*)$#'$fg[cyan]'$1'$reset_...&lt;/code&gt;&lt;/pre&gt;</content>
line=$(print $line | perl -pe 's#(\@\@[^\@]*\@\@)(.*)$#'$fg[cyan]'$1'$reset...&lt;/code&gt;&lt;/pre&gt;</content>
</entry>
<entry>
<id>tag:yannesposito.com,2011-07-10:/Scratch/en/blog/Haskell-Mandelbrot/</id>
@ -397,8 +384,8 @@ instance Num C where C(x,y)*C(z,t)=C(z*x-y*t,y*z+x*t);C(x,y)+C(z,t)=C(x+z,y+t);a
r(C(x,y))=x;i(C(x,y))=y
f c z 0=0;f c z n=if(r(abs(z))&amp;gt;2)then n else f c ((z*z)+c) (n-1)
h j k = map (\z-&amp;gt;(f (C z) (C(0,0)) 32,(fst z&amp;gt;l - q/2))) [(x,y)|y&amp;lt;-[p,(p+((o-p)/a))..o],x&amp;lt;-[m,(m + q)..l]] where o=i k;p=i j;m=r j;l=r k;q=(l-m)/b
u j k = concat $ map v $ h j k where v (i,p)=(" .,`'°\":;-+oO0123456789=!%*§&amp;amp;$@#"!!i):rst p;rst True="\n";rst False=""
main = putStrLn $ im 0 ...&lt;/code&gt;&lt;/pre&gt;</content>
u j k = concat $ map v $ h j k where v (i,p)=(" .,`'&#176;\":;-+oO0123456789=!%*&#167;&amp;amp;$@#"!!i):rst p;rst True="\n";rst False=""
main = putStrLn $ im ...&lt;/code&gt;&lt;/pre&gt;</content>
</entry>
<entry>
<id>tag:yannesposito.com,2011-05-18:/Scratch/en/blog/Password-Management/</id>
@ -426,9 +413,9 @@ I use a different password on all website.&lt;/p&gt;
&lt;p&gt;Disclamer, this is an unashamed attempt to make you download my iPhone app&amp;nbsp;;-).
Youre always here?
Even if you wont download my app, you should read more.
My method doesnt necessitate my app.
You&amp;rsquo;re always here?
Even if you won&amp;rsquo;t download my app, you should read more.
My method doesn&amp;rsquo;t necessitate my app.
It is both safe and easy to use everyday.&lt;/p&gt;
&lt;p&gt;If you just want to &lt;em&gt;use&lt;/em&gt; the tools without searching to understand why it is safe, just jump at the &lt;/p&gt;&lt;/p&gt;&lt;/div&gt;&lt;/p&gt;</content>
@ -466,7 +453,7 @@ It is both safe and easy to use everyday.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Update&lt;/em&gt;: I might change my mind now. Why?
I just discovered a &lt;a href="https://github.com/rstacruz/js2coffee"&gt;js2coffee converter&lt;/a&gt;. Furthermore Denis Knauf told me about a &lt;code&gt;CoffeeScript.eval&lt;/code&gt; function.
And as Denis said: it is time to use Coffeescript as a javascript with Ruby-like syntax not a Ruby-like programming language.&lt;/p&gt;
And as Denis said: &amp;ldquo;it is time to use Coffeescript as a javascript with Ruby-like syntax not a Ruby-like programming language&amp;rdquo;.&lt;/p&gt;
&lt;/div&gt;
@ -545,7 +532,7 @@ When we are used to &lt;span style="text-transform: uppercase"&gt;L&lt;sup style
&lt;p&gt;&lt;span class="sc"&gt;&lt;abbr title="Too long; didn't read"&gt;tl;dr&lt;/abbr&gt;: &lt;/span&gt; Played to process a &lt;code&gt;wav&lt;/code&gt; file. &lt;code&gt;C&lt;/code&gt; was easier and cleaner than Ruby.&lt;/p&gt;
&lt;p&gt;edit: I wanted this program to work only on one specific machine (a x86 on a 32 bit Ubuntu). Therefore I didnt had any portability consideration. This is only a &lt;em&gt;hack&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;edit: I wanted this program to work only on one specific machine (a x86 on a 32 bit Ubuntu). Therefore I didn&amp;rsquo;t had any portability consideration. This is only a &lt;em&gt;hack&lt;/em&gt;.&lt;/p&gt;
&lt;/div&gt;
@ -554,11 +541,11 @@ When we are used to &lt;span style="text-transform: uppercase"&gt;L&lt;sup style
&lt;p&gt;I had to compute the sum of the absolute values of data of a &lt;code&gt;.wav&lt;/code&gt; file.
For efficiency (and fun) reasons, I had chosen &lt;code&gt;C&lt;/code&gt; language.&lt;/p&gt;
&lt;p&gt;I didnt programmed in &lt;code&gt;C&lt;/code&gt; for a long time.
&lt;p&gt;I didn&amp;rsquo;t programmed in &lt;code&gt;C&lt;/code&gt; for a long time.
From my memory it was a pain to read and write to files.
But in the end I was really impressed by the code I get.
It was really clean.
This is even more impressive knowing I used m...&lt;/p&gt;</content>
This is even more impressive know...&lt;/p&gt;</content>
</entry>
<entry>
<id>tag:yannesposito.com,2010-10-10:/Scratch/en/blog/2010-10-10-Secure-eMail-on-Mac-in-few-steps/</id>
@ -591,12 +578,12 @@ This is even more impressive knowing I used m...&lt;/p&gt;</content>
&lt;/div&gt;
&lt;p&gt;Ive (re)discovered how to become S/MIME compliant.
&lt;p&gt;I&amp;rsquo;ve (re)discovered how to become S/MIME compliant.
I am now suprised how easy it was.
Some years ago it was far more difficult.
Now Im able to sign and encrypt my emails.&lt;/p&gt;
Now I&amp;rsquo;m able to sign and encrypt my emails.&lt;/p&gt;
&lt;h2 id="why-is-it-important"&gt;Why is it...&lt;/h2&gt;&lt;/p&gt;</content>
&lt;/p&gt;</content>
</entry>
<entry>
<id>tag:yannesposito.com,2010-10-06:/Scratch/en/blog/2010-10-06-New-Blog-Design-Constraints/</id>
@ -618,7 +605,7 @@ But the major problem came from, &lt;code&gt;font-shadow&lt;/code&gt; and gradie
Then my new design obey to the following rules:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;no CSS element begining by -moz or -webkit, etc…,&lt;/li&gt;
&lt;li&gt;no CSS element begining by &amp;lsquo;-moz&amp;rsquo; or &amp;lsquo;-webkit&amp;rsquo;, etc&amp;hellip;,&lt;/li&gt;
&lt;li&gt;no text shadow,&lt;/li&gt;
&lt;li&gt;clean (I mean delete) most javascript.&lt;/li&gt;
&lt;/ul&gt;
@ -639,7 +626,7 @@ Then my new design obey to the following rules:&lt;/p&gt;
<content type="html">&lt;p&gt;You can remark at the bottom of each page I provide a last modification date.
This label was first calculated using the &lt;code&gt;mtime&lt;/code&gt; of the file on the file system.
But many times I modify this date just to force some recompilation.
Therefore the date wasnt a date of &lt;em&gt;real&lt;/em&gt; modification.&lt;/p&gt;
Therefore the date wasn&amp;rsquo;t a date of &lt;em&gt;real&lt;/em&gt; modification.&lt;/p&gt;
&lt;p&gt;I use &lt;a href="http://git-scm.org"&gt;git&lt;/a&gt; to version my website.
And fortunately I can know the last date of &lt;em&gt;real&lt;/em&gt; change of a file.
@ -649,7 +636,7 @@ This is how I do this with &lt;a href="http://nanoc.stoneship.org"&gt;nanoc&lt;/
&lt;pre&gt;&lt;code class="ruby"&gt;def gitmtime
filepath=@item.path.sub('/Scratch/','content/html/').sub(/\/$/,'')
ext...&lt;/code&gt;&lt;/pre&gt;</content>
...&lt;/code&gt;&lt;/pre&gt;</content>
</entry>
<entry>
<id>tag:yannesposito.com,2010-09-02:/Scratch/en/blog/2010-09-02-base64-and-sha1-on-iPhone/</id>
@ -691,8 +678,8 @@ NSString *hex_hash = [self hex_sha1:@"some NSString to be sha1'ed"];
</author>
<link rel="alternate" href="http://yannesposito.com/Scratch/en/blog/2010-08-31-send-mail-from-command-line-with-attached-file/"/>
<content type="html">&lt;p&gt;I had to send a mail using only command line.
I was surprised it isnt straightforward at all.
I didnt had &lt;code&gt;pine&lt;/code&gt; nor &lt;code&gt;mutt&lt;/code&gt; or anything like that.
I was surprised it isn&amp;rsquo;t straightforward at all.
I didn&amp;rsquo;t had &lt;code&gt;pine&lt;/code&gt; nor &lt;code&gt;mutt&lt;/code&gt; or anything like that.
Just &lt;code&gt;mail&lt;/code&gt; and &lt;code&gt;mailx&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;What Internet say (via google) is&lt;/p&gt;
@ -702,7 +689,7 @@ Just &lt;code&gt;mail&lt;/code&gt; and &lt;code&gt;mailx&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;I tried it.
And it works almost each times.
But for my file, it didnt worked.
But for my file, it didn&amp;rsquo;t worked.
I compressed it to &lt;code&gt;.gz&lt;/code&gt;, &lt;code&gt;.bz2&lt;/code&gt; and &lt;code&gt;.zip&lt;/code&gt;.
Using &lt;code&gt;.bz2&lt;/code&gt; format it worked nicely, but not with other formats.
Instead of having an attached file I saw this in my email.&lt;/p&gt;
@ -710,7 +697,7 @@ Instead of having an attached file I saw this in my email.&lt;/p&gt;
&lt;pre&gt;
begin 664 fic.jpg
M(R$O=7-R+V)I;B]E;G8@&amp;gt;G-H"GAL&amp;lt;STD,0H*9F]R(&amp;QI;F4@:6X@)"@\("1X
M;',@*0H@("`@9&amp;amp;-R/20H96-H;R`D;&amp;amp;EN92!\(&amp;amp;%...&lt;/pre&gt;</content>
M;',@*0H@("`@9&amp;amp;-R/20H96-H;R`D;...&lt;/pre&gt;</content>
</entry>
<entry>
<id>tag:yannesposito.com,2010-08-23:/Scratch/en/blog/2010-08-23-Now-heberged-on-heroku/</id>
@ -782,7 +769,7 @@ I was inspired by Readability and iBooks&lt;small&gt;&amp;copy;&lt;/small&gt; (t
</author>
<link rel="alternate" href="http://yannesposito.com/Scratch/en/blog/2010-07-07-CSS-rendering-problems-by-navigator/"/>
<content type="html">&lt;p&gt;Some &lt;a href="http://reddit.com"&gt;Reddit&lt;/a&gt; users reported my website was really long to load and to scroll.
They thinks it was because of the 1px shadow I apply on all the text.
They thinks it was because of the &amp;lsquo;1px shadow&amp;rsquo; I apply on all the text.
I was a bit surprised, because I make some test into a really &lt;em&gt;slow&lt;/em&gt; virtual machine. And all have always worked fine. In fact, what slow down so much are by order of importance:&lt;/p&gt;
&lt;ol&gt;
@ -794,7 +781,7 @@ I was a bit surprised, because I make some test into a really &lt;em&gt;slow&lt;
&lt;p&gt;On Safari on Mac there is absolutely no rendering time problem. But when I use Chrome under Linux it is almost unusable.&lt;/p&gt;
&lt;p&gt;Safari and Chrome use webkit, when you access my website with javascript enabled, an additionnal browser specific CSS is loaded. Until now I...&lt;/p&gt;</content>
&lt;p&gt;Safari and Chrome use webkit, when you access my website with javascript enabled, an additionnal browser specific CSS is loaded....&lt;/p&gt;</content>
</entry>
<entry>
<id>tag:yannesposito.com,2010-07-05:/Scratch/en/blog/2010-07-05-Cappuccino-and-Web-applications/</id>
@ -816,7 +803,7 @@ I was a bit surprised, because I make some test into a really &lt;em&gt;slow&lt;
&lt;li&gt;Tried to make &lt;a href="http://yannesposito.com/Softwares/YPassword.html"&gt;YPassword&lt;/a&gt; in jQuery and with Cappuccino.&lt;/li&gt;
&lt;li&gt;Cappuccino nice in desktop browser but 1.4MB, not compatible with iPhone.&lt;/li&gt;
&lt;li&gt;jQuery not as nice as the Cappuccino version but 106KB. iPhone compatible.&lt;/li&gt;
&lt;li&gt;Ill give a try to Dashcode 3.&lt;/li&gt;
&lt;li&gt;I&amp;rsquo;ll give a try to Dashcode 3.&lt;/li&gt;
&lt;/ul&gt;
@ -829,7 +816,7 @@ I was a bit surprised, because I make some test into a really &lt;em&gt;slow&lt;
&lt;p&gt;Before start, I must say I know Cappuccino and jQuery are no more comparable than Cocoa and the C++ standard library. One is oriented for user interface while the other is and helper for low level programming.
Nonetheless I used these two to make the same web application. This is why I compare the experienc...&lt;/p&gt;&lt;/div&gt;&lt;/hr&gt;</content>
Nonetheless I used these two to make the same web application. This is why I compare the exp...&lt;/p&gt;&lt;/div&gt;&lt;/hr&gt;</content>
</entry>
<entry>
<id>tag:yannesposito.com,2010-06-19:/Scratch/en/blog/2010-06-19-jQuery-popup-the-easy-way/</id>
@ -942,7 +929,7 @@ You can get it on &lt;a href="http://github.com/yogsototh/nanoc3_blog"&gt;github
&lt;li&gt;&lt;a href="http://intensedebate.org"&gt;intenseDebate&lt;/a&gt; comments integration (asynchronous)&amp;nbsp;;&lt;/li&gt;
&lt;li&gt;Portable with and without javascript, XHTML Strict 1.0 / CSS3,&lt;/li&gt;
&lt;li&gt;Write in markdown format (no HTML editing needed),&lt;/li&gt;
&lt;li&gt;Typographic ameliorations (no : starting a l...&lt;/li&gt;&lt;/ul&gt;</content>
&lt;li&gt;Typographic ameliorations (no &amp;lsquo;:&amp;rsquo; ...&lt;/li&gt;&lt;/ul&gt;</content>
</entry>
<entry>
<id>tag:yannesposito.com,2010-06-14:/Scratch/en/blog/2010-06-14-multi-language-choices/</id>
@ -960,7 +947,7 @@ Most people advice me to have one file per language. Generally it ends with:&lt;
&lt;pre class="twilight"&gt;
Bonjour,
voici un exemple de texte en français.
voici un exemple de texte en fran&#231;ais.
[image](url)
&lt;/pre&gt;
@ -973,12 +960,12 @@ here is an example of english text.
&lt;p&gt;This way of handling translations force you to write completely an article in one language, copy it, and translate it.&lt;/p&gt;
&lt;p&gt;However, most of time, there are common parts like images, source code, etc
&lt;p&gt;However, most of time, there are common parts like images, source code, etc&amp;hellip;
When I want to correct some mistake on these parts, I have to make twice the work. With sometimes adding another mistake in only one language.&lt;/p&gt;
&lt;p&gt;This is why I preferred to handle it differently.
I use &lt;em&gt;tags&lt;/em&gt; on a single file.
Finally my files looks l...&lt;/p&gt;</content>
Finally my files...&lt;/p&gt;</content>
</entry>
<entry>
<id>tag:yannesposito.com,2010-05-24:/Scratch/en/blog/2010-05-24-Trees--Pragmatism-and-Formalism/</id>
@ -1003,7 +990,7 @@ Finally my files looks l...&lt;/p&gt;</content>
&lt;li&gt;Used a pen and a sheet of paper&lt;/li&gt;
&lt;li&gt;Made some math.&lt;/li&gt;
&lt;li&gt;Crushed the problem in 10 minutes&lt;/li&gt;
&lt;li&gt;Conclusion: The pragmatism shouldnt mean “never use theory”.&lt;/li&gt;
&lt;li&gt;Conclusion: The pragmatism shouldn&amp;rsquo;t mean &amp;ldquo;never use theory&amp;rdquo;.&lt;/li&gt;
&lt;/ul&gt;
@ -1014,7 +1001,7 @@ Finally my files looks l...&lt;/p&gt;</content>
&lt;p&gt;For my job, I needed to resolve a problem. It first seems not too hard.
Then I started working directly on my program.
I entered in the &lt;em&gt;infernal&lt;/em&gt;...&lt;/p&gt;</content>
I entered in the...&lt;/p&gt;</content>
</entry>
<entry>
<id>tag:yannesposito.com,2010-05-19:/Scratch/en/blog/2010-05-19-How-to-cut-HTML-and-repair-it/</id>
@ -1065,14 +1052,14 @@ I entered in the &lt;em&gt;infernal&lt;/em&gt;...&lt;/p&gt;</content>
&lt;p&gt;The more you wait to do something, the more difficult it is to start doing it.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I had to write another post for this blog. I had added many article idea in my todolist. But, I made many other things, and Ive always said (until now), Ill do this later. What changed my mind is the haunt of this simple remark about how to be productive in programming.
&lt;p&gt;I had to write another post for this blog. I had added many article idea in my todolist. But, I made many other things, and I&amp;rsquo;ve always said (until now), I&amp;rsquo;ll do this later. What changed my mind is the haunt of this simple remark about how to be productive in programming.
&amp;gt; Stop write &lt;code&gt;TODO&lt;/code&gt; in your code and make it now!&lt;br /&gt;
&amp;gt; Youll be surprised by the results.&lt;/p&gt;
&amp;gt; You&amp;rsquo;ll be surprised by the results.&lt;/p&gt;
&lt;p&gt;In short:
&amp;gt; &lt;strong&gt;Just do it!&lt;/strong&gt; ou &lt;strong&gt;Juste fait le&lt;/strong&gt; comme auraient dit les nuls.&lt;/p&gt;
&lt;p&gt;Finally Ill certainly write blog post more often for a short period of time.&lt;/p&gt;&lt;/p&gt;</content>
&lt;p&gt;Finally I&amp;rsquo;ll certainly write blog post more often for a ...&lt;/p&gt;&lt;/p&gt;</content>
</entry>
<entry>
<id>tag:yannesposito.com,2010-03-23:/Scratch/en/blog/2010-03-23-Encapsulate-git/</id>
@ -1138,7 +1125,7 @@ clientB: project adapted for client B&lt;/p&gt;
&lt;p&gt;&lt;code&gt;git clone&lt;/code&gt; can only fetch the master branch.&lt;/p&gt;
&lt;p&gt;If you dont have much branches, you can simply use clone your project and then use the following command:&lt;/p&gt;
&lt;p&gt;If you don&amp;rsquo;t have much branches, you can simply use clone your project and then use the following command:&lt;/p&gt;
&lt;div&gt;
@ -1150,7 +1137,7 @@ clientB: project adapted for client B&lt;/p&gt;
&lt;p&gt;for example:&lt;/p&gt;
&lt;div&gt;
&lt;pre&gt;&lt;code class="zsh"&gt;$ git clone git@github:yogsototh/example.git...&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
&lt;pre&gt;&lt;code class="zsh"&gt;$ git clone git@github:yogsototh/examp...&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
</entry>
<entry>
<id>tag:yannesposito.com,2010-02-23:/Scratch/en/blog/2010-02-23-When-regexp-is-not-the-best-solution/</id>
@ -1196,7 +1183,7 @@ ext=File.extname(str)
<uri>yannesposito.com</uri>
</author>
<link rel="alternate" href="http://yannesposito.com/Scratch/en/blog/2010-02-18-split-a-file-by-keyword/"/>
<content type="html">&lt;p&gt;Strangely enough, I didnt find any built-in tool to split a file by keyword. I made one myself in &lt;code&gt;awk&lt;/code&gt;. I put it here mostly for myself. But it could also helps someone else.
<content type="html">&lt;p&gt;Strangely enough, I didn&amp;rsquo;t find any built-in tool to split a file by keyword. I made one myself in &lt;code&gt;awk&lt;/code&gt;. I put it here mostly for myself. But it could also helps someone else.
The following code split a file for each line containing the word &lt;code&gt;UTC&lt;/code&gt;.&lt;/p&gt;
&lt;div&gt;
@ -1227,6 +1214,6 @@ BEGIN{i=0;}
/UTC/ {
date=$1$2$3;
if ( date != olddate ) {
oldda...&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
...&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
</entry>
</feed>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View file

@ -10,12 +10,7 @@
<link href='http://fonts.googleapis.com/css?family=Inconsolata' rel='stylesheet' type='text/css'>
<link rel="alternate" type="application/rss+xml" title="RSS" href="http://feeds.feedburner.com/yannespositocomfr"/>
<link rel="alternate" lang="fr" xml:lang="fr" title="Un example progressif avec Haskell" type="text/html" hreflang="fr" href="/Scratch/fr/blog/Haskell-OpenGL-Mandelbrot/" />
<link rel="alternate" lang="en" xml:lang="en" title="Haskell Progressive Example" type="text/html" hreflang="en" href="/Scratch/en/blog/Haskell-OpenGL-Mandelbrot/" /> <script type="text/javascript" src="/Scratch/js/jquery-1.3.1.min.js"></script>
<script type="text/javascript" src="/Scratch/js/jquery.cookie.js"></script>
<script type="text/javascript" src="/Scratch/js/index.js"></script>
<script type="text/javascript" src="/Scratch/js/highlight/highlight.pack.js"></script>
<script type="text/javascript" src="/Scratch/js/article.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="alternate" lang="en" xml:lang="en" title="Haskell Progressive Example" type="text/html" hreflang="en" href="/Scratch/en/blog/Haskell-OpenGL-Mandelbrot/" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
@ -23,7 +18,7 @@
</head>
<body lang="fr" class="article">
<script type="text/javascript">// <![CDATA[
document.write('<div id="blackpage"><img src="/Scratch/img/loading.gif" alt="Chargement en cours..."/></div>');
document.write('<div id="blackpage"><div>Bonjour ! Commencez à lire, un meilleur style se charge...<img src="/Scratch/img/loading.gif" alt="Chargement en cours..."/></div></div>');
// ]]>
</script>
@ -59,7 +54,7 @@
<div class="intro">
<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span> Un exemple progressif dutilisation dHaskell.
<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span> Un exemple progressif d&rsquo;utilisation d&rsquo;Haskell.
Vous pourrez voir un ensemble de Mandelbrot étendu à la troisième dimension.
De plus le code sera très propre.
Les détails de rendu sont séparés dans un module externe.
@ -72,7 +67,7 @@ Vous pouvez vous inspirer de ce code utilisant le paradigme fonctional dans tous
<ul id="markdown-toc">
<li><a href="#introduction">Introduction</a></li>
<li><a href="#first-version">First version</a> <ul>
<li><a href="#lets-play-the-song-of-our-people">Lets play the song of our people</a></li>
<li><a href="#lets-play-the-song-of-our-people">Let&rsquo;s play the song of our people</a></li>
<li><a href="#let-us-start">Let us start</a></li>
</ul>
</li>
@ -157,7 +152,7 @@ We start cleaning the code at the 5<sup>th</sup> section.</p>
The first being mostly some boilerplate<sup id="fnref:011"><a href="#fn:011" rel="footnote">2</a></sup>.
And the second part more focused on OpenGL and content.</p>
<h3 id="lets-play-the-song-of-our-people">Lets play the song of our people</h3>
<h3 id="lets-play-the-song-of-our-people">Let&rsquo;s play the song of our people</h3>
<div class="codehighlight">
@ -393,7 +388,7 @@ It is a bit long before the first image appears, but if you resize the window, i
This property is a direct consequence of purity.
If you look closely, you see that <code>allPoints</code> is a pure list.
Therefore, calling <code>allPoints</code> will always render the same result and Haskell is clever enough to use this property.
While Haskell doesnt garbage collect <code>allPoints</code> the result is reused for free.
While Haskell doesn&rsquo;t garbage collect <code>allPoints</code> the result is reused for free.
We did not specified this value should be saved for later use.
It is saved for us.</p>
@ -631,7 +626,7 @@ instead of using a 3D projection of quaternions.
I am pretty sure this construction is not useful for numbers.
But it will be enough for us to create something that look nice.</p>
<p>This section is quite long, but dont be afraid,
<p>This section is quite long, but don&rsquo;t be afraid,
most of the code is some OpenGL boilerplate.
If you just want to skim this section,
here is a high level representation:</p>
@ -647,7 +642,7 @@ here is a high level representation:</p>
<p>Drawing: </p>
<ul>
<li>set doubleBuffer, handle depth, window size</li>
<li>set doubleBuffer, handle depth, window size&hellip;</li>
<li>Use state to apply some transformations</li>
</ul>
</li>
@ -903,7 +898,7 @@ Mainly there are two parts: apply some transformations, draw the object.</p>
<h3 id="the-3d-mandelbrot">The 3D Mandelbrot</h3>
<p>We have finished with the OpenGL section, lets talk about how we
<p>We have finished with the OpenGL section, let&rsquo;s talk about how we
generate the 3D points and colors.
First, we will set the number of details to 200 pixels in the three dimensions.</p>
@ -1017,7 +1012,7 @@ depthPoints = do
<p>If you prefer the first version, then just imagine how hard it will be to change the enumeration of the point from (x,y) to (x,z) for example.</p>
<p>Also, we didnt searched for negative values.
<p>Also, we didn&rsquo;t searched for negative values.
This modified Mandelbrot is no more symmetric relatively to the plan <code>y=0</code>.
But it is symmetric relatively to the plan <code>z=0</code>.
Then I mirror these values. </p>
@ -1242,7 +1237,7 @@ ymandel x y z = mandel (2*x/width) (2*y/height) (2*z/deep) 64
</div>
<p>This code is cleaner but many things doesnt feel right.
<p>This code is cleaner but many things doesn&rsquo;t feel right.
First, all the user interaction code is outside our main file.
I feel it is okay to hide the detail for the rendering.
But I would have preferred to control the user actions.</p>
@ -1276,12 +1271,12 @@ We will have two choices: </p>
</li>
<li>
<p>Our main problem come from user interaction.
If you ask “the Internet”,
If you ask &ldquo;the Internet&rdquo;,
about how to deal with user interaction with a functional paradigm,
the main answer is to use <em>functional reactive programming</em> (FRP).
I wont use FRP in this article.
Instead, Ill use a simpler while less effective way to deal with user interaction.
But The method Ill use will be as pure and functional as possible.</p>
I won&rsquo;t use FRP in this article.
Instead, I&rsquo;ll use a simpler while less effective way to deal with user interaction.
But The method I&rsquo;ll use will be as pure and functional as possible.</p>
</li>
</ol>
@ -1303,7 +1298,7 @@ First, what the main loop should look like if we could make our own:</p>
<li>a function taking two parameters: time and world state and render a new world without user interaction.</li>
</ul>
<p>Here is a real working code, Ive hidden most display functions.
<p>Here is a real working code, I&rsquo;ve hidden most display functions.
The YGL, is a kind of framework to display 3D functions.
But it can easily be extended to many kind of representation.</p>
@ -1523,7 +1518,7 @@ idleAction tnew world = world {
<p>Now the function which will generate points in 3D.
The first parameter (<code>res</code>) is the resolution of the vertex generation.
More precisely, <code>res</code> is distance between two points on one direction.
We need it to “close” our shape.</p>
We need it to &ldquo;close&rdquo; our shape.</p>
<p>The type <code>Function3D</code> is <code>Point -&gt; Point -&gt; Maybe Point</code>.
Because we consider partial functions
@ -1592,7 +1587,7 @@ ymandel x y z = fromIntegral (mandel x y z 64) / 64
</div>
<p>I wont explain how the magic occurs here.
<p>I won&rsquo;t explain how the magic occurs here.
If you are interested, just read the file <a href="code/05_Mandelbulb/YGL.hs"><code>YGL.hs</code></a>.
It is commented a lot.</p>
@ -1612,8 +1607,8 @@ It is commented a lot.</p>
<p>Our code architecture feel very clean.
All the meaningful code is in our main file and all display details are
externalized.
If you read the code of <code>YGL.hs</code>, youll see I didnt made everything perfect.
For example, I didnt finished the code of the lights.
If you read the code of <code>YGL.hs</code>, you&rsquo;ll see I didn&rsquo;t made everything perfect.
For example, I didn&rsquo;t finished the code of the lights.
But I believe it is a good first step and it will be easy to go further.
Unfortunately the program of the preceding session is extremely slow.
We compute the Mandelbulb for each frame now.</p>
@ -1897,20 +1892,20 @@ ymandel x y z = fromIntegral (mandel x y z 64) / 64
<p>As we can use imperative style in a functional language,
know you can use functional style in imperative languages.
This article exposed a way to organize some code in a functional way.
Id like to stress the usage of Haskell made it very simple to achieve this.</p>
I&rsquo;d like to stress the usage of Haskell made it very simple to achieve this.</p>
<p>Once you are used to pure functional style,
it is hard not to see all advantages it offers.</p>
<p>The code in the two last sections is completely pure and functional.
Furthermore I dont use <code>GLfloat</code>, <code>Color3</code> or any other OpenGL type.
Furthermore I don&rsquo;t use <code>GLfloat</code>, <code>Color3</code> or any other OpenGL type.
If I want to use another library in the future,
I would be able to keep all the pure code and simply update the YGL module.</p>
<p>The <code>YGL</code> module can be seen as a “wrapper” around 3D display and user interaction.
<p>The <code>YGL</code> module can be seen as a &ldquo;wrapper&rdquo; around 3D display and user interaction.
It is a clean separator between the imperative paradigm and functional paradigm.</p>
<p>If you want to go further, it shouldnt be hard to add parallelism.
<p>If you want to go further, it shouldn&rsquo;t be hard to add parallelism.
This should be easy mainly because most of the visible code is pure.
Such an optimization would have been harder by using directly the OpenGL library.</p>
@ -1920,7 +1915,7 @@ O(n².log(n)) to O(n³).</p>
<hr/><div class="footnotes">
<ol>
<li id="fn:001">
<p>Unfortunately, I couldnt make this program to work on my Mac. More precisely, I couldnt make the <a href="http://openil.sourceforge.net/">DevIL</a> library work on Mac to output the image. Yes I have done a <code>brew install libdevil</code>. But even a minimal program who simply write some <code>jpg</code> didnt worked. I tried both with <code>Haskell</code> and <code>C</code>.<a href="#fnref:001" rel="reference">&#8617;</a></p>
<p>Unfortunately, I couldn&rsquo;t make this program to work on my Mac. More precisely, I couldn&rsquo;t make the <a href="http://openil.sourceforge.net/">DevIL</a> library work on Mac to output the image. Yes I have done a <code>brew install libdevil</code>. But even a minimal program who simply write some <code>jpg</code> didn&rsquo;t worked. I tried both with <code>Haskell</code> and <code>C</code>.<a href="#fnref:001" rel="reference">&#8617;</a></p>
</li>
<li id="fn:011">
<p>Generally in Haskell you need to declare a lot of import lines.
@ -1961,34 +1956,26 @@ O(n².log(n)) to O(n³).</p>
s'abonner
</a>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('#comment').hide();
$('#clickcomment').click(showComments);
});
function showComments() {
$('#comment').show();
$('#clickcomment').fadeOut();
}
document.write('<div id="clickcomment">Commentaires &amp; Partage</div>');
</script>
<div class="flush"></div>
<div class="corps" id="comment">
<h2 class="first">commentaires</h2>
<noscript>
Vous devez activer javascript pour commenter.
</noscript>
<script type="text/javascript">
var idcomments_acct = 'a307f0044511ff1b5cfca573fc0a52e7';
var idcomments_post_id = '/Scratch/fr/blog/Haskell-OpenGL-Mandelbrot/';
var idcomments_post_url = 'http://yannesposito.com/Scratch/fr/blog/Haskell-OpenGL-Mandelbrot/';
</script>
<span id="IDCommentsPostTitle" style="display:none"></span>
<script type='text/javascript' src='/Scratch/js/genericCommentWrapperV2.js'></script>
</div>
<div id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'yannesposito'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
</div>
<div id="entete" class="corps_spaced">
<div id="liens">
@ -2023,7 +2010,7 @@ O(n².log(n)) to O(n³).</p>
articles suivants
<div class="next_article">
<a href="/Scratch/fr/blog/Category-Theory-Programming/">Programmation en Théorie des Catégories&nbsp;<span class="nicer">»</span></a>
<a href="/Scratch/fr/blog/Category-Theory-Presentation/">Category Theory Presentation&nbsp;<span class="nicer">»</span></a>
</div>
@ -2057,4 +2044,10 @@ O(n².log(n)) to O(n³).</p>
</div>
</div>
</body>
<script type="text/javascript" src="/Scratch/js/jquery-1.3.1.min.js"></script>
<script type="text/javascript" src="/Scratch/js/jquery.cookie.js"></script>
<script type="text/javascript" src="/Scratch/js/index.js"></script>
<script type="text/javascript" src="/Scratch/js/highlight/highlight.pack.js"></script>
<script type="text/javascript" src="/Scratch/js/article.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
</html>

File diff suppressed because it is too large Load diff

View file

@ -66,31 +66,35 @@ function detectClient() {
return userAgent;
}
$(document).ready(function(){
var msgh1=$('#titre h1').html();
var msgh2=$('#titre h2').html();
var msgintro=$('.corps').html();
if (!msgh1) { msgh1=""; }
if (!msgh2) { msgh2=""; }
if (!msgintro) { msgintro=""; }
$('#blackpage').prepend('<div class="preh1">'+msgh1+'</div>');
$('#blackpage').prepend('<div class="preh2">'+msgh2+'</div>');
$('#blackpage').append('<div class="preintro"><div class="corps">'+msgintro+'</div></div>');
});
// $(document).ready(function(){
// var msgh1=$('#titre h1').html();
// var msgh2=$('#titre h2').html();
// var msgintro=$('.corps').html();
// if (!msgh1) { msgh1=""; }
// if (!msgh2) { msgh2=""; }
// if (!msgintro) { msgintro=""; }
// $('#blackpage').prepend('<div class="preh1">'+msgh1+'</div>');
// $('#blackpage').prepend('<div class="preh2">'+msgh2+'</div>');
// $('#blackpage').append('<div class="preintro"><div class="corps">'+msgintro+'</div></div>');
// });
// Ce que l'on va lancer à l'init.
$(window).bind("load", function() {
$(document).ready(function() {
var client=detectClient();
if ( ! /msie/.test(client) ) {
initCode();
}
if (/windows/.test(navigator.userAgent.toLowerCase())) {
$('head').append('<link rel="stylesheet" type="text/css" href="/Scratch/css/windows.css"/>');
}
if ( ! /msie/.test(client) ) { initCode(); }
$('#blackpage').fadeOut('slow',function(){ $('#blackpage').remove(); });
analytics();
});
$(window).bind("load", function() {
// lorsque toutes les ressources ont ete chargees
if (/windows/.test(navigator.userAgent.toLowerCase())) {
$('head').append('<link rel="stylesheet" type="text/css" href="/Scratch/css/windows.css"/>');
} else {
$('head').append('<link rel="stylesheet" type="text/css" href="/Scratch/assets/css/cmu.css"/>');
}
});
// --- Google Analytics ---
if ( ! $.cookie('admin') ) {

File diff suppressed because it is too large Load diff

View file

@ -10,9 +10,6 @@
<link rel="alternate" type="application/rss+xml" title="RSS" href="http://feeds.feedburner.com/yannespositocomen"/>
<link rel="alternate" lang="fr" xml:lang="fr" title="Home" type="text/html" hreflang="fr" href="/" />
<link rel="alternate" lang="en" xml:lang="en" title="Home" type="text/html" hreflang="en" href="/" />
<script type="text/javascript" src="/Scratch/js/jquery-1.3.1.min.js"></script>
<script type="text/javascript" src="/Scratch/js/jquery.cookie.js"></script>
<script type="text/javascript" src="/Scratch/js/index.js"></script>
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
@ -24,7 +21,7 @@
</head>
<body lang="en">
<script type="text/javascript">// <![CDATA[
document.write('<div id="blackpage"><img src="/Scratch/img/loading.gif" alt="loading..."/></div>');
document.write('<div id="blackpage"><div>Hi! Start reading while a better style is loading...<img src="/Scratch/img/loading.gif" alt="loading..."/></div></div>');
// ]]>
</script>
@ -65,7 +62,7 @@
&nbsp;&nbsp;
<small>
<em>
<a style="color: #888" href="/Scratch/en/blog/Category-Theory-Programming/">
<a style="color: #888" href="/Scratch/en/blog/Category-Theory-Presentation/">
Latest <span class="nicer">»</span>
</a>
</em>
@ -84,7 +81,7 @@
&nbsp;&nbsp;
<small>
<em>
<a style="color: #888" href="/Scratch/fr/blog/Category-Theory-Programming/">
<a style="color: #888" href="/Scratch/fr/blog/Category-Theory-Presentation/">
Dernier article <span class="nicer">»</span>
</a>
</em>
@ -95,7 +92,7 @@
<h3> <a href="http://j.mp/btfRJ2"> Curriculum Vitæ <span class="nicer">»</span> </a> </h3>
<h3> <a href="http://yann.esposito.free.fr/enseignement/enseignement.php"> Enseignement <span class="nicer">»</span> </a> </h3>
</div>
<img class="clean" src="/Scratch/img/presentation.png" alt="Presentation drawing" />
<img class="clean" src="/Scratch/img/presentation.png" alt="Presentation drawing" width="30%"/>
<div class="flush"></div>
<center>
<h2 style="font-size: 15px;">
@ -110,7 +107,7 @@
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Copyright ©, Yann Esposito</a>
</div>
<div id="lastmod">
Modified: 10/11/2012
Modified: 12/19/2012
</div>
<div>
Entirely done with
@ -122,4 +119,7 @@
</div>
</div>
</body>
<script type="text/javascript" src="/Scratch/js/jquery-1.3.1.min.js"></script>
<script type="text/javascript" src="/Scratch/js/jquery.cookie.js"></script>
<script type="text/javascript" src="/Scratch/js/index.js"></script>
</html>

File diff suppressed because it is too large Load diff

Binary file not shown.

View file

@ -0,0 +1,16 @@
<div style="text-align:center; position:absolute; top: 2em; font-size: .9em; width: 100%">
<h1 style="position: relative;">Category Theory &amp; Programming</h1>
<author><em class="base01">by</em> Yann Esposito</author>
<div style="font-size:.5em">
<twitter>
<a href="http://twitter.com/yogsototh">@yogsototh</a>,
</twitter>
<googleplus>
<a href="https://plus.google.com/117858550730178181663">+yogsototh</a>
</googleplus>
</div>
<div class="base01" style="font-size: .5em; font-weight: 400; font-variant:italic">
<div class="button" style="margin: .5em auto;border: solid 2px; padding: 5px; width: 8em; border-radius: 1em; background:rgba(255,255,255,0.05);" onclick="javascript:gofullscreen();">ENTER FULLSCREEN</div>
HTML presentation: use arrows, space to navigate.
</div>
</div>

View file

@ -0,0 +1,6 @@
<h2>Plan</h2>
<ul style="font-size: 2em; font-weight:bold">
<li><span class="yellow">General overview</li>
<li>Definitions</li>
<li>Applications</li>
</ul>

View file

@ -0,0 +1,16 @@
<h2 id="general-overview">General Overview</h2>
<div style="float:right; width: 18%">
<img src="categories/img/eilenberg.gif" alt="Samuel Eilenberg"/> <img src="categories/img/maclaine.jpg" alt="Saunders Mac Lane"/>
</div>
<p><em>Recent Math Field</em><br />1942-45, Samuel Eilenberg &amp; Saunders Mac Lane</p>
<p>Certainly one of the more abstract branches of math</p>
<ul>
<li><em>New math foundation</em><br /> formalism abstraction, package entire theory<sup></sup></li>
<li><em>Bridge between disciplines</em><br /> Physics, Quantum Physics, Topology, Logic, Computer Science<sup></sup></li>
</ul>
<p class="smaller base01" style="border-top: solid 1px">
★: <a href="http://www.math.harvard.edu/~mazur/preprints/when_is_one.pd">When is one thing equal to some other thing?, Barry Mazur, 2007</a><br/> ☆: <a href="http://math.ucr.edu/home/baez/rosetta.pdf">Physics, Topology, Logic and Computation: A Rosetta Stone, John C. Baez, Mike Stay, 2009</a>
</p>

View file

@ -0,0 +1,20 @@
General Overview
----------------
<div style="float:right; width: 18%">
<img src="categories/img/eilenberg.gif" alt="Samuel Eilenberg"/>
<img src="categories/img/maclaine.jpg" alt="Saunders Mac Lane"/>
</div>
_Recent Math Field_
1942-45, Samuel Eilenberg &amp; Saunders Mac Lane
Certainly one of the more abstract branches of math
- _New math foundation_
formalism abstraction, package entire theory<sup></sup>
- _Bridge between disciplines_
Physics, Quantum Physics, Topology, Logic, Computer Science<sup></sup>
<p class="smaller base01" style="border-top: solid 1px">★: <a href="http://www.math.harvard.edu/~mazur/preprints/when_is_one.pd">When is one thing equal to some other thing?, Barry Mazur, 2007</a><br/>
☆: <a href="http://math.ucr.edu/home/baez/rosetta.pdf">Physics, Topology, Logic and Computation: A Rosetta Stone, John C. Baez, Mike Stay, 2009</a></p>

View file

@ -0,0 +1,4 @@
<h2 id="from-a-programmer-perspective">From a Programmer perspective</h2>
<blockquote>
<p>Category Theory is a new language/framework for Math</p>
</blockquote>

View file

@ -0,0 +1,4 @@
From a Programmer perspective
----------------
> Category Theory is a new language/framework for Math

View file

@ -0,0 +1,5 @@
<h2 id="math-programming-relation">Math Programming relation</h2>
<img class="right" src="categories/img/buddha.gif" alt="Buddha Fractal"/>
<p>Programming <em><span class="yellow">is</span></em> doing Math</p>
<p>Not convinced?<br />Certainly a <em>vocabulary</em> problem.</p>
<p>One of the goal of Category Theory is to create a <em>homogeneous vocabulary</em> between different disciplines.</p>

View file

@ -0,0 +1,11 @@
Math Programming relation
-------------------------
<img class="right" src="categories/img/buddha.gif" alt="Buddha Fractal"/>
Programming *<span class="yellow">is</span>* doing Math
Not convinced?
Certainly a _vocabulary_ problem.
One of the goal of Category Theory is to create a _homogeneous vocabulary_ between different disciplines.

View file

@ -0,0 +1,6 @@
<h2 id="vocabulary">Vocabulary</h2>
<img class="right" src="categories/img/mindblown.gif" alt="mind blown"/>
<p>Math vocabulary used in this presentation:</p>
<blockquote>
<p>Category, Morphism, Associativity, Preorder, Functor, Endofunctor, Categorial property, Commutative diagram, Isomorph, Initial, Dual, Monoid, Natural transformation, Monad, Klesli arrows, κατα-morphism, ...</p>
</blockquote>

View file

@ -0,0 +1,23 @@
Vocabulary
----------
<img class="right" src="categories/img/mindblown.gif" alt="mind blown"/>
Math vocabulary used in this presentation:
> Category,
> Morphism,
> Associativity,
> Preorder,
> Functor, Endofunctor,
> Categorial property,
> Commutative diagram,
> Isomorph,
> Initial,
> Dual,
> Monoid,
> Natural transformation,
> Monad,
> Klesli arrows,
> κατα-morphism,
> ...

View file

@ -0,0 +1,41 @@
<h2 id="programmer-translation">Programmer Translation</h2>
<img class="right" src="categories/img/readingcat.jpg" alt="lolcat"/>
<table style="width:60%">
<tr><th>
Mathematician
</th><th>
Programmer
</th></tr>
<tr><td>
Morphism
</td><td>
Arrow
</td></tr>
<tr><td>
Monoid
</td><td>
String-like
</td></tr>
<tr><td>
Preorder
</td><td>
Acyclic graph
</td></tr>
<tr><td>
Isomorph
</td><td>
The same
</td></tr>
<tr><td>
Natural transformation
</td><td>
rearrangement function
</td></tr>
<tr><td>
Funny Category
</td><td>
LOLCat
</td></tr>
</table>

View file

@ -0,0 +1,14 @@
Programmer Translation
----------------------
<img class="right" src="categories/img/readingcat.jpg" alt="lolcat"/>
<table style="width:60%">
<tr><th>Mathematician</th><th>Programmer</th></tr>
<tr><td>Morphism</td><td>Arrow</td></tr>
<tr><td>Monoid</td><td>String-like</td></tr>
<tr><td>Preorder</td><td>Acyclic graph</td></tr>
<tr><td>Isomorph</td><td>The same</td></tr>
<tr><td>Natural transformation</td><td>rearrangement function</td></tr>
<tr><td>Funny Category</td><td>LOLCat</td></tr>
</table>

View file

@ -0,0 +1,14 @@
<h2>Plan</h2>
<ul style="font-size: 2em; font-weight: bold">
<li>General overview</li>
<li> <span class="yellow">Definitions</span>
<ul class="base01" style="border-left: 2px solid; padding-left: 1em; font-size: .6em; float: right; font-weight: bold; margin: 0 0 0 1em">
<li>Category</li>
<li>Intuition</li>
<li>Examples</li>
<li>Functor</li>
<li>Examples</li>
</ul>
</li>
<li>Applications</li>
</ul>

View file

@ -0,0 +1,11 @@
<h2>Category</h2>
<p>A way of representing <strong><em>things</em></strong> and <strong><em>ways to go between things</em></strong>.</p>
<p> A Category \(\mathcal{C}\) is defined by:</p>
<ul>
<li> <em>Objects <span class="yellow">\(\ob{C}\)</span></em>,</li>
<li> <em>Morphisms <span class="yellow">\(\hom{C}\)</span></em>,</li>
<li> a <em>Composition law <span class="yellow">(∘)</span></em></li>
<li> obeying some <em>Properties</em>.</li>
</ul>

View file

@ -0,0 +1,5 @@
<h2>Category: Objects</h2>
<img src="categories/img/mp/objects.png" alt="objects" />
<p>\(\ob{\mathcal{C}}\) is a collection</p>

View file

@ -0,0 +1,8 @@
<h2>Category: Morphisms</h2>
<img src="categories/img/mp/morphisms.png" alt="morphisms"/>
<p>\(A\) and \(B\) objects of \(\C\)<br/>
\(\hom{A,B}\) is a collection of morphisms<br/>
\(f:A→B\) denote the fact \(f\) belongs to \(\hom{A,B}\)</p>
<p>\(\hom{\C}\) the collection of all morphisms of \(\C\)</p>

View file

@ -0,0 +1,5 @@
<h2>Category: Composition</h2>
<p>Composition (∘): associate to each couple \(f:A→B, g:B→C\)
$$g∘f:A\rightarrow C$$
</p>
<img src="categories/img/mp/composition.png" alt="composition"/>

View file

@ -0,0 +1,4 @@
<h2>Category laws: neutral element</h2>
<p>for each object \(X\), there is an \(\id_X:X→X\),<br/>
such that for each \(f:A→B\):</p>
<img src="categories/img/mp/identity.png" alt="identity"/>

View file

@ -0,0 +1,3 @@
<h2>Category laws: Associativity</h2>
<p> Composition is associative:</p>
<img src="categories/img/mp/associativecomposition.png" alt="associative composition"/>

View file

@ -0,0 +1,19 @@
<h2>Commutative diagrams</h2>
<p>Two path with the same source and destination are equal.</p>
<figure class="left" style="max-width: 40%;margin-left: 10%;">
<img
src="categories/img/mp/commutative-diagram-assoc.png"
alt="Commutative Diagram (Associativity)"/>
<figcaption>
\((h∘g)∘f = h∘(g∘f) \)
</figcaption>
</figure>
<figure class="right" style="max-width:31%;margin-right: 10%;">
<img
src="categories/img/mp/commutative-diagram-id.png"
alt="Commutative Diagram (Identity law)"/>
<figcaption>
\(id_B∘f = f = f∘id_A \)
</figcaption>
</figure>

View file

@ -0,0 +1,8 @@
<h2>Question Time!</h2>
<figure style="width:70%; margin:0 auto">
<img src="categories/img/batquestion.jpg" width="100%"/>
<figcaption>
<em>- French-only joke -</em>
</figcaption>
</figure>

View file

@ -0,0 +1,21 @@
<h2>Can this be a category?</h2>
<p>\(\ob{\C},\hom{\C}\) fixed, is there a valid ∘?</p>
<figure class="left">
<img src="categories/img/mp/cat-example1.png" alt="Category example 1"/>
<figcaption class="slide">
<span class="green">YES</span>
</figcaption>
</figure>
<figure class="left">
<img src="categories/img/mp/cat-example2.png" alt="Category example 2"/>
<figcaption class="slide">
no candidate for \(g∘f\)
<br/><span class="red">NO</span>
</figcaption>
</figure>
<figure class="left">
<img src="categories/img/mp/cat-example3.png" alt="Category example 3"/>
<figcaption class="slide">
<span class="green">YES</span>
</figcaption>
</figure>

View file

@ -0,0 +1,17 @@
<h2>Can this be a category?</h2>
<figure class="left">
<img src="categories/img/mp/cat-example4.png" alt="Category example 4"/>
<figcaption class="slide">
no candidate for \(f:C→B\)
<br/><span class="red">NO</span>
</figcaption>
</figure>
<figure class="right" style="min-width: 59%">
<img src="categories/img/mp/cat-example5.png" alt="Category example 5"/>
<figcaption class="slide">
\((h∘g)∘f=\id_B∘f=f\)<br/>
\(h∘(g∘f)=h∘\id_A=h\)<br/>
but \(h≠f\)<br/>
<span class="red">NO</span>
</figcaption>
</figure>

View file

@ -0,0 +1,8 @@
<h2>Categories Examples</h2>
<figure style="width:70%; margin:0 auto">
<img src="categories/img/basket_of_cats.jpg" alt="Basket of cats"/>
<figcaption>
<em>- Basket of Cats -</em>
</figcaption>
</figure>

View file

@ -0,0 +1,13 @@
<h2>Category \(\Set\)</h2>
<ul>
<li> \(\ob{\Set}\) are <em>all</em> the sets</li>
<li> \(\hom{E,F}\) are <em>all</em> functions from \(E\) to \(F\)</li>
<li> ∘ is functions composition </li>
</ul>
<ul class="slide">
<li>\(\ob{\Set}\) is a proper class ; not a set</li>
<li>\(\hom{E,F}\) is a set</li>
<li>\(\Set\) is then a <em>locally <b>small</b> category</em></li>
</ul>

View file

@ -0,0 +1,11 @@
<h2>Categories Everywhere?</h2>
<img class="right" src="categories/img/cats-everywhere.jpg" alt="Cats everywhere"/>
<ul>
<li>\(\Mon\): (monoids, monoid morphisms,∘)</li>
<li>\(\Vec\): (Vectorial spaces, linear functions,∘)</li>
<li>\(\Grp\): (groups, group morphisms,∘)</li>
<li>\(\Rng\): (rings, ring morphisms,∘)</li>
<li>Any deductive system <i>T</i>: (theorems, proofs, proof concatenation)</li>
<li>\( \Hask\): (Haskell types, functions, <code>(.)</code> )</li>
<li>...</li>
</ul>

View file

@ -0,0 +1,13 @@
<h2>Smaller Examples</h2>
<h3>Strings</h3>
<img class="right" style="max-width:17%" src="categories/img/mp/strings.png" alt="Monoids are one object categories"/>
<ul>
<li> \(\ob{Str}\) is a singleton </li>
<li> \(\hom{Str}\) each string </li>
<li> ∘ is concatenation <code>(++)</code> </li>
</ul>
<ul>
<li> <code>"" ++ u = u = u ++ ""</code> </li>
<li> <code>(u ++ v) ++ w = u ++ (v ++ w)</code> </li>
</ul>

View file

@ -0,0 +1,15 @@
<h2>Finite Example?</h2>
<h3>Graph</h3>
<figure class="right" style="max-width:40%" >
<img src="categories/img/mp/graph-category.png" alt="Each graph is a category"/>
</figure>
<ul>
<li> \(\ob{G}\) are vertices</li>
<li> \(\hom{G}\) each path</li>
<li> ∘ is path concatenation</li>
</ul>
<ul><li>\(\ob{G}=\{X,Y,Z\}\),
</li><li>\(\hom{G}=\{ε,α,β,γ,αβ,βγ,...\}\)
</li><li>\(αβ∘γ=αβγ\)
</li></ul>

View file

@ -0,0 +1,4 @@
<h2>Number construction</h2>
<h3>Each Numbers as a whole category</h3>
<img src="categories/img/mp/numbers.png" alt="Each number as a category"/>

View file

@ -0,0 +1,9 @@
<h2>Degenerated Categories: Monoids</h2>
<img class="right" style="max-width:17%" src="categories/img/mp/monoid.png" alt="Monoids are one object categories"/>
<p>Each Monoid \((M,e,⊙): \ob{M}=\{∙\},\hom{M}=M,\circ = ⊙\)</p>
<p class="yellow">Only one object.</p>
<p>Examples:</p>
<ul><li><code>(Integer,0,+)</code>, <code>(Integer,1,*)</code>,
</li><li><code>(Strings,"",++)</code>, for each <code>a</code>, <code>([a],[],++)</code>
</li></ul>

View file

@ -0,0 +1,10 @@
<h2>Degenerated Categories: Preorders \((P,≤)\)</h2>
<ul><li>\(\ob{P}={P}\),
</li><li>\(\hom{x,y}=\{x≤y\} ⇔ x≤y\),
</li><li>\((y≤z) \circ (x≤y) = (x≤z) \)
</li></ul>
<p><em class="yellow">At most one morphism between two objects.</em></p>
<img src="categories/img/mp/preorder.png" alt="preorder category"/>

View file

@ -0,0 +1,6 @@
<h2>Degenerated Categories: Discrete Categories</h2>
<img class="right" src="categories/img/mp/set.png" alt="Any set can be a category"/>
<h3>Any Set</h3>
<p>Any set \(E: \ob{E}=E, \hom{x,y}=\{x\} ⇔ x=y \)</p>
<p class="yellow">Only identities</p>

View file

@ -0,0 +1,11 @@
<h2 class="base1">Categorical Properties</h2>
<p class="base1">Any property which can be expressed in term of category, objects, morphism and composition.</p>
<ul><li> <em class="yellow">Dual</em>: \(\D\) is \(\C\) with reversed morphisms.
</li><li> <em class="yellow">Initial</em>: \(Z\in\ob{\C}\) s.t. \(∀Y∈\ob{\C}, \#\hom{Z,Y}=1\)
<br/> Unique ("up to isormophism")
</li><li> <em class="yellow">Terminal</em>: \(T\in\ob{\C}\) s.t. \(T\) is initial in the dual of \(\C\)
</li><li> <em class="yellow">Functor</em>: structure preserving mapping between categories
</li><li> ...
</li></ul>

View file

@ -0,0 +1,3 @@
<h2 id="isomorph">Isomorph</h2>
<p><img class="right" alt="isomorph cats" src="categories/img/isomorph-cats.jpg" /> <em class="yellow">isomorphism</em>: \(f:A→B\) which can be &quot;undone&quot; <em>i.e.</em><br />\(∃g:B→A\), \(g∘f=id_A\) &amp; \(f∘g=id_B\)<br />in this case, \(A\) &amp; \(B\) are <em class="yellow">isomorphic</em>.</p>
<p><span class="yellow">A≌B</span> means A and B are essentially the same.<br />In Category Theory, <span class="yellow">=</span> is in fact mostly <span class="yellow"></span>.<br />For example in commutative diagrams.</p>

View file

@ -0,0 +1,11 @@
Isomorph
--------
<img class="right" alt="isomorph cats" src="categories/img/isomorph-cats.jpg" />
<em class="yellow">isomorphism</em>:
\\(f:A→B\\) which can be "undone" _i.e._
\\(∃g:B→A\\), \\(g∘f=id\_A\\) & \\(f∘g=id\_B\\)
in this case, \\(A\\) &amp; \\(B\\) are <em class="yellow">isomorphic</em>.
<span class="yellow">A≌B</span> means A and B are essentially the same.
In Category Theory, <span class="yellow">=</span> is in fact mostly <span class="yellow"></span>.
For example in commutative diagrams.

View file

@ -0,0 +1,15 @@
<h2>Functor</h2>
<p> A functor is a mapping between two categories.
Let \(\C\) and \(\D\) be two categories.
A <em>functor</em> <span class="yellow">\(\F\)</span> from <span class="blue">\(\C\)</span> to <span class="green">\(\D\)</span>:</p>
<ul>
<li> Associate objects: <span class="backblue">\(A\in\ob{\C}\)</span> to <span class="backgreen">\(\F(A)\in\ob{\D}\)</span> </li>
<li> Associate morphisms: <span class="backblue">\(f:A\to B\)</span> to <span class="backgreen">\(\F(f) : \F(A) \to \F(B)\)</span>
such that
<ul>
<li>\( \F (\)<span class="backblue blue">\(\id_X\)</span>\()= \)<span class="backgreen"><span class="green">\(\id\)</span>\(\vphantom{\id}_{\F(}\)<span class="blue">\(\vphantom{\id}_X\)</span>\(\vphantom{\id}_{)} \)</span>,</li>
<li>\( \F (\)<span class="backblue blue">\(g∘f\)</span>\()= \)<span class="backgreen">\( \F(\)<span class="blue">\(g\)</span>\() \)<span class="green">\(\circ\)</span>\( \F(\)<span class="blue">\(f\)</span>\() \)</span></li>
</ul>
</li>
</ul>

View file

@ -0,0 +1,3 @@
<h2>Functor Example (ob → ob)</h2>
<img width="65%" src="categories/img/mp/functor.png" alt="Functor"/>

View file

@ -0,0 +1,3 @@
<h2>Functor Example (hom → hom)</h2>
<img width="65%" src="categories/img/mp/functor-morphism.png" alt="Functor"/>

View file

@ -0,0 +1,3 @@
<h2>Functor Example</h2>
<img width="65%" src="categories/img/mp/functor-morphism-color.png" alt="Functor"/>

View file

@ -0,0 +1,4 @@
<h2>Endofunctors</h2>
<p>An <em>endofunctor</em> for \(\C\) is a functor \(F:\C→\C\).</p>
<img width="75%" src="categories/img/mp/endofunctor.png" alt="Endofunctor"/>

View file

@ -0,0 +1,9 @@
<h2>Category of Categories</h2>
<img style="min-width:43%; width: 43%" class="right" src="categories/img/fractalcat.jpg" />
<p>Categories and functors form a category: \(\Cat\)</p>
<ul><li>\(\ob{\Cat}\) are categories
</li><li>\(\hom{\Cat}\) are functors
</li><li>∘ is functor composition
</li></ul>

View file

@ -0,0 +1,13 @@
<h2>Plan</h2>
<ul style="font-size: 2em; font-weight:bold">
<li>Why?</li>
<li>What?</li>
<li><span class="yellow">How?
<ul class="base01" style="border-left: 2px solid; padding-left: 1em; font-size: .6em; float: right; font-weight: bold; margin: -2em 0 0 1em">
<li>\(\Hask\) category
</li><li> Functors
</li><li> Monads
</li><li> κατα-morphisms
</li></ul>
</li>
</ul>

View file

@ -0,0 +1,15 @@
<h2>Hask</h2>
<p>Category \(\Hask\):</p>
<img class="right" style="max-width:30%" src="categories/img/mp/hask.png" alt="Haskell Category Representation"/>
<ul><li>
\(\ob{\Hask} = \) Haskell types
</li><li>
\(\hom{\Hask} = \) Haskell functions
</li><li>
∘ = <code>(.)</code> Haskell function composition
</li></ul>
<p>Forget glitches because of <code>undefined</code>.</p>

View file

@ -0,0 +1,7 @@
<h2 id="haskell-kinds">Haskell Kinds</h2>
<p>In Haskell some types can take type variable(s). Typically: <code>[a]</code>.</p>
<p>Types have <em>kinds</em>; The kind is to type what type is to function. Kind are the types for types (so meta).</p>
<pre><code>Int, Char :: *
[], Maybe :: * -&gt; *
(,) :: * -&gt; * -&gt; *
[Int], Maybe Char, Maybe [Int] :: *</code></pre>

View file

@ -0,0 +1,16 @@
Haskell Kinds
-------------
In Haskell some types can take type variable(s).
Typically: `[a]`.
Types have _kinds_;
The kind is to type what type is to function.
Kind are the types for types (so meta).
~~~
Int, Char :: *
[], Maybe :: * -> *
(,) :: * -> * -> *
[Int], Maybe Char, Maybe [Int] :: *
~~~

View file

@ -0,0 +1,15 @@
<h2 id="haskell-types">Haskell Types</h2>
<p>Sometimes, the type determine a lot about the function<sup></sup>:</p>
<pre class="haskell"><code>fst :: (a,b) -> a -- Only one choice
snd :: (a,b) -> b -- Only one choice
f :: a -> [a] -- Many choices
-- Possibilities: f x=[], or [x], or [x,x] or [x,...,x]
? :: [a] -> [a] -- Many choices
-- can only rearrange: duplicate/remove/reorder elements
-- for example: the type of addOne isn't [a] -> [a]
addOne l = map <span class="red">(+1)</span> l
-- The (+1) force 'a' to be a Num.</code></pre>
<p>
<p><span class="small base01">★:<a href="http://ttic.uchicago.edu/~dreyer/course/papers/wadler.pdf">Theorems for free!, Philip Wadler, 1989</a></span></p>

View file

@ -0,0 +1,17 @@
Haskell Types
-------------
Sometimes, the type determine a lot about the function<sup></sup>:
<pre class="haskell"><code>fst :: (a,b) -> a -- Only one choice
snd :: (a,b) -> b -- Only one choice
f :: a -> [a] -- Many choices
-- Possibilities: f x=[], or [x], or [x,x] or [x,...,x]
? :: [a] -> [a] -- Many choices
-- can only rearrange: duplicate/remove/reorder elements
-- for example: the type of addOne isn't [a] -> [a]
addOne l = map <span class="red">(+1)</span> l
-- The (+1) force 'a' to be a Num.</code></pre>
<p><span class="small base01">★:<a href="http://ttic.uchicago.edu/~dreyer/course/papers/wadler.pdf">Theorems for free!, Philip Wadler, 1989</a></span>

View file

@ -0,0 +1,11 @@
<h2>Haskell Functor vs \(\Hask\) Functor</h2>
<p>A Haskell Functor is a type <code>F :: * -> *</code> which belong to the type class <code>Functor</code> ; thus instantiate
<code>fmap :: (a -> b) -> (F a -> F b)</code>.
<p><span style="visibility:hidden">&amp;</span> <code>F</code>: \(\ob{\Hask}→\ob{\Hask}\)<br/> &amp; <code>fmap</code>: \(\hom{\Hask}→\hom{\Hask}\)
<p>The couple <code>(F,fmap)</code> is a \(\Hask\)'s functor if for any <code>x :: F a</code>:</p>
<ul><li><code>fmap id x = x</code>
</li><li><code>fmap (f.g) x= (fmap f . fmap g) x</code>
</li></ul>

View file

@ -0,0 +1,10 @@
<h2>Haskell Functors Example: Maybe</h2>
<pre class="haskell"><code>data Maybe a = Just a | Nothing
instance Functor Maybe where
fmap :: (a -> b) -> (Maybe a -> Maybe b)
fmap f (Just a) = Just (f a)
fmap f Nothing = Nothing</code></pre>
<pre class="haskell"><code>fmap (+1) (Just 1) == Just 2
fmap (+1) Nothing == Nothing
fmap head (Just [1,2,3]) == Just 1</code></pre>

View file

@ -0,0 +1,8 @@
<h2>Haskell Functors Example: List</h2>
<pre class="haskell"><code>instance Functor ([]) where
fmap :: (a -> b) -> [a] -> [b]
fmap = map</pre></code>
<pre class="haskell"><code>fmap (+1) [1,2,3] == [2,3,4]
fmap (+1) [] == []
fmap head [[1,2,3],[4,5,6]] == [1,4]</code></pre>

View file

@ -0,0 +1,10 @@
<h2 id="haskell-functors-for-the-programmer">Haskell Functors for the programmer</h2>
<p><code>Functor</code> is a type class used for types that can be mapped over.</p>
<ul>
<li>Containers: <code>[]</code>, Trees, Map, HashMap...</li>
<li>&quot;Feature Type&quot;:
<ul>
<li><code>Maybe a</code>: help to handle absence of <code>a</code>.<br />Ex: <code>safeDiv x 0 ⇒ Nothing</code></li>
<li><code>Either String a</code>: help to handle errors<br />Ex: <code>reportDiv x 0 ⇒ Left &quot;Division by 0!&quot;</code></li>
</ul></li>
</ul>

View file

@ -0,0 +1,11 @@
Haskell Functors for the programmer
------------------------------
`Functor` is a type class used for types that can be mapped over.
- Containers: `[]`, Trees, Map, HashMap...
- "Feature Type":
- `Maybe a`: help to handle absence of `a`.
Ex: `safeDiv x 0 ⇒ Nothing`
- `Either String a`: help to handle errors
Ex: `reportDiv x 0 ⇒ Left "Division by 0!"`

View file

@ -0,0 +1,5 @@
<h2>Haskell Functor intuition</h2>
<p>Put normal function inside a container. Ex: list, trees...<p>
<img width="70%" src="categories/img/mp/boxfunctor.png" alt="Haskell Functor as a box play"/>

View file

@ -0,0 +1,7 @@
<h2>Haskell Functor properties</h2>
<p>Haskell Functors are:</p>
<ul><li><em>endofunctors</em> ; \(F:\C→\C\) here \(\C = \Hask\),
</li><li>a couple <b>(Object,Morphism)</b> in \(\Hask\).
</li></ul>

View file

@ -0,0 +1,6 @@
<h2>Functor as boxes</h2>
<p>Haskell functor can be seen as boxes containing all Haskell types and functions.
Haskell types is fractal:</p>
<img width="70%" src="categories/img/mp/hask-endofunctor.png" alt="Haskell functor representation"/>

View file

@ -0,0 +1,6 @@
<h2>Functor as boxes</h2>
<p>Haskell functor can be seen as boxes containing all Haskell types and functions.
Haskell types is fractal:</p>
<img width="70%" src="categories/img/mp/hask-endofunctor-objects.png" alt="Haskell functor representation"/>

View file

@ -0,0 +1,6 @@
<h2>Functor as boxes</h2>
<p>Haskell functor can be seen as boxes containing all Haskell types and functions.
Haskell types is fractal:</p>
<img width="70%" src="categories/img/mp/hask-endofunctor-morphisms.png" alt="Haskell functor representation"/>

View file

@ -0,0 +1,11 @@
<h2 id="non-haskell-hasks-functors">&quot;Non Haskell&quot; Hask's Functors</h2>
<p>A simple basic example is the \(id_\Hask\) functor. It simply cannot be expressed as a couple (<code>F</code>,<code>fmap</code>) where</p>
<ul>
<li><code>F::* -&gt; *</code></li>
<li><code>fmap :: (a -&gt; b) -&gt; (F a) -&gt; (F b)</code></li>
</ul>
<p>Another example:</p>
<ul>
<li>F(<code>T</code>)=<code>Int</code></li>
<li>F(<code>f</code>)=<code>\_-&gt;0</code></li>
</ul>

Some files were not shown because too many files have changed in this diff Show more