diff --git a/Rules b/Rules index d1d6eb2fc..7d0e49448 100644 --- a/Rules +++ b/Rules @@ -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 diff --git a/config.yaml b/config.yaml index 2eac1bf9f..58060cbbb 100644 --- a/config.yaml +++ b/config.yaml @@ -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" diff --git a/content/css/cmu.sass b/content/css/cmu.sass new file mode 100644 index 000000000..ec88e05b7 --- /dev/null +++ b/content/css/cmu.sass @@ -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 diff --git a/content/css/cmufontface.sass b/content/css/cmufontface.sass new file mode 100644 index 000000000..e7ff54934 --- /dev/null +++ b/content/css/cmufontface.sass @@ -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 + diff --git a/content/css/main.sass b/content/css/main.sass index d23392b1e..b4b3f7c83 100644 --- a/content/css/main.sass +++ b/content/css/main.sass @@ -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 diff --git a/content/css/main2.sass b/content/css/main2.sass new file mode 100644 index 000000000..334cb2265 --- /dev/null +++ b/content/css/main2.sass @@ -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% diff --git a/content/html/en/blog/Category-Theory-Presentation.erb b/content/html/en/blog/Category-Theory-Presentation.erb new file mode 100644 index 000000000..e9184394b --- /dev/null +++ b/content/html/en/blog/Category-Theory-Presentation.erb @@ -0,0 +1,1000 @@ +----- +isHidden: false +menupriority: 1 +kind: article +created_at: 2012-12-12T10:06:40+02:00 +title: Category Theory Presentation +author_name: Yann Esposito +author_uri: yannesposito.com +tags: + - category theory + - math + - functor +----- +Cateogry of Hask's endofunctors + +

Yesterday I was happy to make a presentation about Category Theory at Riviera Scala Clojure Meetup (note I used only Haskell for my examples).

+ + + +

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. +

+ +
+\(\newcommand{\F}{\mathbf{F}}\) +\(\newcommand{\E}{\mathbf{E}}\) +\(\newcommand{\C}{\mathcal{C}}\) +\(\newcommand{\D}{\mathcal{D}}\) +\(\newcommand{\id}{\mathrm{id}}\) +\(\newcommand{\ob}[1]{\mathrm{ob}(#1)}\) +\(\newcommand{\hom}[1]{\mathrm{hom}(#1)}\) +\(\newcommand{\Set}{\mathbf{Set}}\) +\(\newcommand{\Mon}{\mathbf{Mon}}\) +\(\newcommand{\Vec}{\mathbf{Vec}}\) +\(\newcommand{\Grp}{\mathbf{Grp}}\) +\(\newcommand{\Rng}{\mathbf{Rng}}\) +\(\newcommand{\ML}{\mathbf{ML}}\) +\(\newcommand{\Hask}{\mathbf{Hask}}\) +\(\newcommand{\Cat}{\mathbf{Cat}}\) +\(\newcommand{\fmap}{\mathtt{fmap}}\) +
+ +
+

Category Theory & Programming

+
for Rivieria Scala Clojure (Note this presentation uses Haskell)
+by Yann Esposito +
+ + @yogsototh, + + + +yogsototh + +
+
+
ENTER FULLSCREEN
+ HTML presentation: use arrows, space, swipe to navigate. +
+
+
+

Plan

+ +
+
+

Not really about: Cat & glory

+
+Cat n glory
credit to Tokuhiro Kawai (川井徳寛)
+
+ + + +
+
+

General Overview

+
+Samuel Eilenberg Saunders Mac Lane +
+ +

Recent Math Field
1942-45, Samuel Eilenberg & Saunders Mac Lane

+

Certainly one of the more abstract branches of math

+ +

+★: When is one thing equal to some other thing?, Barry Mazur, 2007
☆: Physics, Topology, Logic and Computation: A Rosetta Stone, John C. Baez, Mike Stay, 2009 +

+ + +
+
+

From a Programmer perspective

+
+

Category Theory is a new language/framework for Math

+
+ +
+
+

Math Programming relation

+Buddha Fractal +

Programming is doing Math

+

Strong relations between type theory and category theory.

+

Not convinced?
Certainly a vocabulary problem.

+

One of the goal of Category Theory is to create a homogeneous vocabulary between different disciplines.

+
+
+

Vocabulary

+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, ...

+
+
+
+

Programmer Translation

+lolcat + + + + + + + + +
+Mathematician + +Programmer +
+Morphism + +Arrow +
+Monoid + +String-like +
+Preorder + +Acyclic graph +
+Isomorph + +The same +
+Natural transformation + +rearrangement function +
+Funny Category + +LOLCat +
+ + +
+
+

Plan

+ +
+
+

Category

+ +

A way of representing things and ways to go between things.

+ +

A Category \(\mathcal{C}\) is defined by:

+ +
+
+

Category: Objects

+ +objects + +

\(\ob{\mathcal{C}}\) is a collection

+
+
+

Category: Morphisms

+ +morphisms + +

\(A\) and \(B\) objects of \(\C\)
+\(\hom{A,B}\) is a collection of morphisms
+\(f:A→B\) denote the fact \(f\) belongs to \(\hom{A,B}\)

+

\(\hom{\C}\) the collection of all morphisms of \(\C\)

+
+
+

Category: Composition

+

Composition (∘): associate to each couple \(f:A→B, g:B→C\) + $$g∘f:A\rightarrow C$$ +

+composition +
+
+

Category laws: neutral element

+

for each object \(X\), there is an \(\id_X:X→X\),
+such that for each \(f:A→B\):

+identity +
+
+

Category laws: Associativity

+

Composition is associative:

+associative composition +
+
+

Commutative diagrams

+ +

Two path with the same source and destination are equal.

+
+ Commutative Diagram (Associativity) +
+ \((h∘g)∘f = h∘(g∘f) \) +
+
+
+ Commutative Diagram (Identity law) +
+ \(id_B∘f = f = f∘id_A \) +
+
+
+
+

Question Time!

+ +
+ +
+- French-only joke - +
+
+
+
+

Can this be a category?

+

\(\ob{\C},\hom{\C}\) fixed, is there a valid ∘?

+
+ Category example 1 +
+ YES +
+
+
+ Category example 2 +
+ no candidate for \(g∘f\) +
NO +
+
+
+ Category example 3 +
+ YES +
+
+
+
+

Can this be a category?

+
+ Category example 4 +
+ no candidate for \(f:C→B\) +
NO +
+
+
+ Category example 5 +
+ \((h∘g)∘f=\id_B∘f=f\)
+ \(h∘(g∘f)=h∘\id_A=h\)
+ but \(h≠f\)
+ NO +
+
+
+
+

Categories Examples

+ +
+Basket of cats +
+- Basket of Cats - +
+
+
+
+

Category \(\Set\)

+ + + + +
+
+

Categories Everywhere?

+Cats everywhere + +
+
+

Smaller Examples

+ +

Strings

+Monoids are one object categories + + +
+
+

Finite Example?

+ +

Graph

+
+Each graph is a category +
+ + +
+
+

Number construction

+ +

Each Numbers as a whole category

+Each number as a category +
+
+

Degenerated Categories: Monoids

+ +Monoids are one object categories +

Each Monoid \((M,e,⊙): \ob{M}=\{∙\},\hom{M}=M,\circ = ⊙\)

+

Only one object.

+

Examples:

+ +
+
+

Degenerated Categories: Preorders \((P,≤)\)

+ + + +

At most one morphism between two objects.

+ +preorder category +
+
+

Degenerated Categories: Discrete Categories

+ +Any set can be a category +

Any Set

+

Any set \(E: \ob{E}=E, \hom{x,y}=\{x\} ⇔ x=y \)

+

Only identities

+
+
+

Choice

+

The same object can be seen in many different way as a category.

+

You can choose what are object, morphisms and composition.

+

ex: Str and discrete(Σ*)

+
+
+

Categorical Properties

+ +

Any property which can be expressed in term of category, objects, morphism and composition.

+ + +
+
+

Isomorph

+

isomorph cats isomorphism: \(f:A→B\) which can be "undone" i.e.
\(∃g:B→A\), \(g∘f=id_A\) & \(f∘g=id_B\)
in this case, \(A\) & \(B\) are isomorphic.

+

A≌B means A and B are essentially the same.
In Category Theory, = is in fact mostly .
For example in commutative diagrams.

+
+
+

Functor

+ +

A functor is a mapping between two categories. +Let \(\C\) and \(\D\) be two categories. +A functor \(\F\) from \(\C\) to \(\D\):

+ +
+
+

Functor Example (ob → ob)

+ +Functor +
+
+

Functor Example (hom → hom)

+ +Functor +
+
+

Functor Example

+ +Functor +
+
+

Endofunctors

+ +

An endofunctor for \(\C\) is a functor \(F:\C→\C\).

+Endofunctor +
+
+

Category of Categories

+ + + +

Categories and functors form a category: \(\Cat\)

+ +
+
+

Plan

+ +
+
+

Hask

+ +

Category \(\Hask\):

+ +Haskell Category Representation + + + +

Forget glitches because of undefined.

+
+
+

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] :: *
+
+
+

Haskell Types

+

Sometimes, the type determine a lot about the function:

+
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 (+1) l
+-- The (+1) force 'a' to be a Num.
+ +

+

★:Theorems for free!, Philip Wadler, 1989

+
+
+

Haskell Functor vs \(\Hask\) Functor

+ +

A Haskell Functor is a type F :: * -> * which belong to the type class Functor ; thus instantiate +fmap :: (a -> b) -> (F a -> F b). + +

& F: \(\ob{\Hask}→\ob{\Hask}\)
& fmap: \(\hom{\Hask}→\hom{\Hask}\) + +

The couple (F,fmap) is a \(\Hask\)'s functor if for any x :: F a:

+ +
+
+

Haskell Functors Example: Maybe

+ +
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
+
fmap (+1) (Just 1) == Just 2
+fmap (+1) Nothing  == Nothing
+fmap head (Just [1,2,3]) == Just 1
+
+
+

Haskell Functors Example: List

+ +
instance Functor ([]) where
+	fmap :: (a -> b) -> [a] -> [b]
+	fmap = map
+
fmap (+1) [1,2,3]           == [2,3,4]
+fmap (+1) []                == []
+fmap head [[1,2,3],[4,5,6]] == [1,4]
+
+
+

Haskell Functors for the programmer

+

Functor is a type class used for types that can be mapped over.

+ +
+
+

Haskell Functor intuition

+ +

Put normal function inside a container. Ex: list, trees...

+ +Haskell Functor as a box play +

+
+

Haskell Functor properties

+ +

Haskell Functors are:

+ + +
+
+

Functor as boxes

+ +

Haskell functor can be seen as boxes containing all Haskell types and functions. +Haskell types look like a fractal:

+ +Haskell functor representation +
+
+

Functor as boxes

+ +

Haskell functor can be seen as boxes containing all Haskell types and functions. +Haskell types look like a fractal:

+ +Haskell functor representation +
+
+

Functor as boxes

+ +

Haskell functor can be seen as boxes containing all Haskell types and functions. +Haskell types look like a fractal:

+ +Haskell functor representation +
+
+

"Non Haskell" Hask's Functors

+

A simple basic example is the \(id_\Hask\) functor. It simply cannot be expressed as a couple (F,fmap) where

+ +

Another example:

+ +
+
+

Also Functor inside \(\Hask\)

+

\(\mathtt{[a]}∈\ob{\Hask}\) but is also a category. Idem for Int.

+

length is a Functor from the category [a] to the category Int:

+ +

+ +
+ +
+
+

Category of \(\Hask\) Endofunctors

+Category of Hask endofunctors +
+
+

Category of Functors

+

If \(\C\) is small (\(\hom{\C}\) is a set). All functors from \(\C\) to some category \(\D\) form the category \(\mathrm{Func}(\C,\D)\).

+ +

\(\mathrm{Func}(\C,\C)\) is the category of endofunctors of \(\C\).

+
+
+

Natural Transformations

+

Let \(F\) and \(G\) be two functors from \(\C\) to \(\D\).

+

Natural transformation commutative diagram A natural transformation: familly η ; \(η_X\in\hom{\D}\) for \(X\in\ob{\C}\) s.t.

+

ex: between Haskell functors; F a -> G a
Rearragement functions only.

+
+
+

Natural Transformation Examples (1/4)

+
data List a = Nil | Cons a (List a)
+toList :: [a] -> List a
+toList [] = Nil
+toList (x:xs) = Cons x (toList xs)
+ +

toList is a natural transformation. It is also a morphism from [] to List in the Category of \(\Hask\) endofunctors.

+natural transformation commutative diagram +
+natural transformation commutative diagram +
+ + +
+
+

Natural Transformation Examples (2/4)

+
data List a = Nil | Cons a (List a)
+toHList :: List a -> [a]
+toHList Nil = []
+toHList (Cons x xs) = x:toHList xs
+ +

toHList is a natural transformation. It is also a morphism from List to [] in the Category of \(\Hask\) endofunctors.

+natural transformation commutative diagram +
+natural transformation commutative diagram
toList . toHList = id & toHList . toList = id &
therefore [] & List are isomorph.
+
+ + +
+
+

Natural Transformation Examples (3/4)

+
toMaybe :: [a] -> Maybe a
+toMaybe [] = Nothing
+toMaybe (x:xs) = Just x
+ +

toMaybe is a natural transformation. It is also a morphism from [] to Maybe in the Category of \(\Hask\) endofunctors.

+natural transformation commutative diagram +
+natural transformation commutative diagram +
+ + +
+
+

Natural Transformation Examples (4/4)

+
mToList :: Maybe a -> [a]
+mToList Nothing = []
+mToList Just x  = [x]
+ +

toMaybe is a natural transformation. It is also a morphism from [] to Maybe in the Category of \(\Hask\) endofunctors.

+natural transformation commutative diagram +
+relation between [] and Maybe
There is no isomorphism.
Hint: Bool lists longer than 1.
+
+ + +
+
+

Composition problem

+

The Problem; example with lists:

+
f x = [x]       ⇒ f 1 = [1]   ⇒ (f.f) 1 = [[1]] ✗
+g x = [x+1]     ⇒ g 1 = [2]   ⇒ (g.g) 1 = ERROR [2]+1 ✗
+h x = [x+1,x*3] ⇒ h 1 = [2,3] ⇒ (h.h) 1 = ERROR [2,3]+1 ✗ 
+ +

The same problem with most f :: a -> F a functions and functor F.

+
+
+

Composition Fixable?

+

How to fix that? We want to construct an operator which is able to compose:

+

f :: a -> F b & g :: b -> F c.

+

More specifically we want to create an operator ◎ of type

+

◎ :: (b -> F c) -> (a -> F b) -> (a -> F c)

+

Note: if F = I, ◎ = (.).

+
+
+

Fix Composition (1/2)

+

Goal, find: ◎ :: (b -> F c) -> (a -> F b) -> (a -> F c)
f :: a -> F b, g :: b -> F c:

+ +
+
+

Fix Composition (2/2)

+

Goal, find: ◎ :: (b -> F c) -> (a -> F b) -> (a -> F c)
f :: a -> F b, g :: b -> F c, f x :: F b:

+ +
+
+

Necessary laws

+

For ◎ to work like composition, we need join to hold the following properties:

+ +
+
+

Klesli composition

+

Now the composition works as expected. In Haskell ◎ is <=< in Control.Monad.

+

g <=< f = \x -> join ((fmap g) (f x))

+
f x = [x]       ⇒ f 1 = [1]   ⇒ (f <=< f) 1 = [1] ✓
+g x = [x+1]     ⇒ g 1 = [2]   ⇒ (g <=< g) 1 = [3] ✓
+h x = [x+1,x*3] ⇒ h 1 = [2,3] ⇒ (h <=< h) 1 = [3,6,4,9] ✓
+ + +
+
+

We reinvented Monads!

+

A monad is a triplet (M,⊙,η) where

+ +

Satisfying

+ +
+
+

Compare with Monoid

+

A Monoid is a triplet \((E,∙,e)\) s.t.

+ +

Satisfying

+ +
+
+

Monads are just Monoids

+
+

A Monad is just a monoid in the category of endofunctors, what's the problem?

+
+

The real sentence was:

+
+

All told, a monad in X is just a monoid in the category of endofunctors of X, with product × replaced by composition of endofunctors and unit set by the identity endofunctor.

+
+
+
+

Example: List

+ +
-- In Haskell ⊙ is "join" in "Control.Monad"
+join :: [[a]] -> [a]
+join = concat
+
+-- In Haskell the "return" function (unfortunate name)
+η :: a -> [a]
+η x = [x]
+ + +
+
+

Example: List (law verification)

+

Example: List is a functor (join is ⊙)

+ +
join [ join [[x,y,...,z]] ] = join [[x,y,...,z]]
+                            = join (join [[[x,y,...,z]]])
+join (η [x]) = [x] = join [η x]
+ +

Therefore ([],join,η) is a monad.

+
+
+

Monads useful?

+

A LOT of monad tutorial on the net. Just one example; the State Monad

+

DrawScene to State Screen DrawScene ; still pure.

+
main = drawImage (width,height)
+
+drawImage :: Screen -> DrawScene
+drawImage screen = do
+    drawPoint p screen
+    drawCircle c screen
+    drawRectangle r screen
+
+drawPoint point screen = ...
+drawCircle circle screen = ...
+drawRectangle rectangle screen = ...
+
main = do
+    put (Screen 1024 768)
+    drawImage
+
+drawImage :: State Screen DrawScene
+drawImage = do
+    drawPoint p
+    drawCircle c
+    drawRectangle r
+
+drawPoint :: Point -> State Screen DrawScene
+drawPoint p = do
+    Screen width height <- get
+    ...
+
+
+

fold

+fold +
+
+

κατα-morphism

+catamorphism +
+
+

κατα-morphism: fold generalization

+

acc type of the "accumulator":
fold :: (acc -> a -> acc) -> acc -> [a] -> acc

+

Idea: put the accumulated value inside the type.

+
-- Equivalent to fold (+1) 0 "cata"
+(Cons 'c' (Cons 'a' (Cons 't' (Cons 'a' Nil))))
+(Cons 'c' (Cons 'a' (Cons 't' (Cons 'a' 0))))
+(Cons 'c' (Cons 'a' (Cons 't' 1)))
+(Cons 'c' (Cons 'a' 2))
+(Cons 'c' 3)
+4
+ + +

But where are all the informations? (+1) and 0?

+
+
+

κατα-morphism: Missing Information

+

Where is the missing information?

+ +

First example, make length on [Char]

+
+
+

κατα-morphism: Type work

+

+data StrF a = Cons Char a | Nil
+data Str' = StrF Str'
+
+-- generalize the construction of Str to other datatype
+-- Mu: type fixed point
+-- Mu :: (* -> *) -> *
+
+data Mu f = InF { outF :: f (Mu f) }
+data Str = Mu StrF
+
+-- Example
+foo=InF { outF = Cons 'f'
+        (InF { outF = Cons 'o'
+            (InF { outF = Cons 'o'
+                (InF { outF = Nil })})})}
+ + +
+
+

κατα-morphism: missing information retrieved

+
type Algebra f a = f a -> a
+instance Functor (StrF a) =
+    fmap f (Cons c x) = Cons c (f x)
+    fmap _ Nil = Nil
+ +
cata :: Functor f => Algebra f a -> Mu f -> a
+cata f = f . fmap (cata f) . outF
+ + + +
+
+

κατα-morphism: Finally length

+

All needed information for making length.

+
instance Functor (StrF a) =
+    fmap f (Cons c x) = Cons c (f x)
+    fmap _ Nil = Nil
+
+length' :: Str -> Int
+length' = cata phi where
+    phi :: Algebra StrF Int -- StrF Int -> Int
+    phi (Cons a b) = 1 + b
+    phi Nil = 0
+
+main = do
+    l <- length' $ stringToStr "Toto"
+    ...
+
+
+

κατα-morphism: extension to Trees

+

Once you get the trick, it is easy to extent to most Functor.

+
type Tree = Mu TreeF
+data TreeF x = Node Int [x]
+
+instance Functor TreeF where
+  fmap f (Node e xs) = Node e (fmap f xs)
+
+depth = cata phi where
+  phi :: Algebra TreeF Int -- TreeF Int -> Int
+  phi (Node x sons) = 1 + foldr max 0 sons
+
+
+

Conclusion

+

Category Theory oriented Programming:

+ +

No cat were harmed in the making of this presentation.

+
diff --git a/content/html/en/blog/Higher-order-function-in-zsh.md b/content/html/en/blog/Higher-order-function-in-zsh.md index d8f17af97..111841604 100644 --- a/content/html/en/blog/Higher-order-function-in-zsh.md +++ b/content/html/en/blog/Higher-order-function-in-zsh.md @@ -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). #!/usr/bin/env zsh diff --git a/content/html/en/blog/programming-language-experience.md b/content/html/en/blog/programming-language-experience.md index a9d813c0f..b59b57c5a 100644 --- a/content/html/en/blog/programming-language-experience.md +++ b/content/html/en/blog/programming-language-experience.md @@ -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: 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`. -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 216 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: $var =~ s/toto/titi/g -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. diff --git a/content/html/fr/blog/Category-Theory-Presentation.erb b/content/html/fr/blog/Category-Theory-Presentation.erb new file mode 100644 index 000000000..e9184394b --- /dev/null +++ b/content/html/fr/blog/Category-Theory-Presentation.erb @@ -0,0 +1,1000 @@ +----- +isHidden: false +menupriority: 1 +kind: article +created_at: 2012-12-12T10:06:40+02:00 +title: Category Theory Presentation +author_name: Yann Esposito +author_uri: yannesposito.com +tags: + - category theory + - math + - functor +----- +Cateogry of Hask's endofunctors + +

Yesterday I was happy to make a presentation about Category Theory at Riviera Scala Clojure Meetup (note I used only Haskell for my examples).

+ + + +

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. +

+ +
+\(\newcommand{\F}{\mathbf{F}}\) +\(\newcommand{\E}{\mathbf{E}}\) +\(\newcommand{\C}{\mathcal{C}}\) +\(\newcommand{\D}{\mathcal{D}}\) +\(\newcommand{\id}{\mathrm{id}}\) +\(\newcommand{\ob}[1]{\mathrm{ob}(#1)}\) +\(\newcommand{\hom}[1]{\mathrm{hom}(#1)}\) +\(\newcommand{\Set}{\mathbf{Set}}\) +\(\newcommand{\Mon}{\mathbf{Mon}}\) +\(\newcommand{\Vec}{\mathbf{Vec}}\) +\(\newcommand{\Grp}{\mathbf{Grp}}\) +\(\newcommand{\Rng}{\mathbf{Rng}}\) +\(\newcommand{\ML}{\mathbf{ML}}\) +\(\newcommand{\Hask}{\mathbf{Hask}}\) +\(\newcommand{\Cat}{\mathbf{Cat}}\) +\(\newcommand{\fmap}{\mathtt{fmap}}\) +
+ +
+

Category Theory & Programming

+
for Rivieria Scala Clojure (Note this presentation uses Haskell)
+by Yann Esposito +
+ + @yogsototh, + + + +yogsototh + +
+
+
ENTER FULLSCREEN
+ HTML presentation: use arrows, space, swipe to navigate. +
+
+
+

Plan

+
    +
  • General overview
  • +
  • Definitions
  • +
  • Applications
  • +
+
+
+

Not really about: Cat & glory

+
+Cat n glory
credit to Tokuhiro Kawai (川井徳寛)
+
+ + + +
+
+

General Overview

+
+Samuel Eilenberg Saunders Mac Lane +
+ +

Recent Math Field
1942-45, Samuel Eilenberg & Saunders Mac Lane

+

Certainly one of the more abstract branches of math

+
    +
  • New math foundation
    formalism abstraction, package entire theory
  • +
  • Bridge between disciplines
    Physics, Quantum Physics, Topology, Logic, Computer Science
  • +
+

+★: When is one thing equal to some other thing?, Barry Mazur, 2007
☆: Physics, Topology, Logic and Computation: A Rosetta Stone, John C. Baez, Mike Stay, 2009 +

+ + +
+
+

From a Programmer perspective

+
+

Category Theory is a new language/framework for Math

+
+
    +
  • Another way of thinking
  • +
  • Extremely efficient for generalization
  • +
+
+
+

Math Programming relation

+Buddha Fractal +

Programming is doing Math

+

Strong relations between type theory and category theory.

+

Not convinced?
Certainly a vocabulary problem.

+

One of the goal of Category Theory is to create a homogeneous vocabulary between different disciplines.

+
+
+

Vocabulary

+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, ...

+
+
+
+

Programmer Translation

+lolcat + + + + + + + + +
+Mathematician + +Programmer +
+Morphism + +Arrow +
+Monoid + +String-like +
+Preorder + +Acyclic graph +
+Isomorph + +The same +
+Natural transformation + +rearrangement function +
+Funny Category + +LOLCat +
+ + +
+
+

Plan

+
    +
  • General overview
  • +
  • Definitions +
      +
    • Category
    • +
    • Intuition
    • +
    • Examples
    • +
    • Functor
    • +
    • Examples
    • +
    +
  • +
  • Applications
  • +
+
+
+

Category

+ +

A way of representing things and ways to go between things.

+ +

A Category \(\mathcal{C}\) is defined by:

+
    +
  • Objects \(\ob{C}\),
  • +
  • Morphisms \(\hom{C}\),
  • +
  • a Composition law (∘)
  • +
  • obeying some Properties.
  • +
+
+
+

Category: Objects

+ +objects + +

\(\ob{\mathcal{C}}\) is a collection

+
+
+

Category: Morphisms

+ +morphisms + +

\(A\) and \(B\) objects of \(\C\)
+\(\hom{A,B}\) is a collection of morphisms
+\(f:A→B\) denote the fact \(f\) belongs to \(\hom{A,B}\)

+

\(\hom{\C}\) the collection of all morphisms of \(\C\)

+
+
+

Category: Composition

+

Composition (∘): associate to each couple \(f:A→B, g:B→C\) + $$g∘f:A\rightarrow C$$ +

+composition +
+
+

Category laws: neutral element

+

for each object \(X\), there is an \(\id_X:X→X\),
+such that for each \(f:A→B\):

+identity +
+
+

Category laws: Associativity

+

Composition is associative:

+associative composition +
+
+

Commutative diagrams

+ +

Two path with the same source and destination are equal.

+
+ Commutative Diagram (Associativity) +
+ \((h∘g)∘f = h∘(g∘f) \) +
+
+
+ Commutative Diagram (Identity law) +
+ \(id_B∘f = f = f∘id_A \) +
+
+
+
+

Question Time!

+ +
+ +
+- French-only joke - +
+
+
+
+

Can this be a category?

+

\(\ob{\C},\hom{\C}\) fixed, is there a valid ∘?

+
+ Category example 1 +
+ YES +
+
+
+ Category example 2 +
+ no candidate for \(g∘f\) +
NO +
+
+
+ Category example 3 +
+ YES +
+
+
+
+

Can this be a category?

+
+ Category example 4 +
+ no candidate for \(f:C→B\) +
NO +
+
+
+ Category example 5 +
+ \((h∘g)∘f=\id_B∘f=f\)
+ \(h∘(g∘f)=h∘\id_A=h\)
+ but \(h≠f\)
+ NO +
+
+
+
+

Categories Examples

+ +
+Basket of cats +
+- Basket of Cats - +
+
+
+
+

Category \(\Set\)

+ +
    +
  • \(\ob{\Set}\) are all the sets
  • +
  • \(\hom{E,F}\) are all functions from \(E\) to \(F\)
  • +
  • ∘ is functions composition
  • +
+ +
    +
  • \(\ob{\Set}\) is a proper class ; not a set
  • +
  • \(\hom{E,F}\) is a set
  • +
  • \(\Set\) is then a locally small category
  • +
+
+
+

Categories Everywhere?

+Cats everywhere +
    +
  • \(\Mon\): (monoids, monoid morphisms,∘)
  • +
  • \(\Vec\): (Vectorial spaces, linear functions,∘)
  • +
  • \(\Grp\): (groups, group morphisms,∘)
  • +
  • \(\Rng\): (rings, ring morphisms,∘)
  • +
  • Any deductive system T: (theorems, proofs, proof concatenation)
  • +
  • \( \Hask\): (Haskell types, functions, (.) )
  • +
  • ...
  • +
+
+
+

Smaller Examples

+ +

Strings

+Monoids are one object categories +
    +
  • \(\ob{Str}\) is a singleton
  • +
  • \(\hom{Str}\) each string
  • +
  • ∘ is concatenation (++)
  • +
+
    +
  • "" ++ u = u = u ++ ""
  • +
  • (u ++ v) ++ w = u ++ (v ++ w)
  • +
+
+
+

Finite Example?

+ +

Graph

+
+Each graph is a category +
+
    +
  • \(\ob{G}\) are vertices
  • +
  • \(\hom{G}\) each path
  • +
  • ∘ is path concatenation
  • +
+
  • \(\ob{G}=\{X,Y,Z\}\), +
  • \(\hom{G}=\{ε,α,β,γ,αβ,βγ,...\}\) +
  • \(αβ∘γ=αβγ\) +
+
+
+

Number construction

+ +

Each Numbers as a whole category

+Each number as a category +
+
+

Degenerated Categories: Monoids

+ +Monoids are one object categories +

Each Monoid \((M,e,⊙): \ob{M}=\{∙\},\hom{M}=M,\circ = ⊙\)

+

Only one object.

+

Examples:

+
  • (Integer,0,+), (Integer,1,*), +
  • (Strings,"",++), for each a, ([a],[],++) +
+
+
+

Degenerated Categories: Preorders \((P,≤)\)

+ +
  • \(\ob{P}={P}\), +
  • \(\hom{x,y}=\{x≤y\} ⇔ x≤y\), +
  • \((y≤z) \circ (x≤y) = (x≤z) \) +
+ +

At most one morphism between two objects.

+ +preorder category +
+
+

Degenerated Categories: Discrete Categories

+ +Any set can be a category +

Any Set

+

Any set \(E: \ob{E}=E, \hom{x,y}=\{x\} ⇔ x=y \)

+

Only identities

+
+
+

Choice

+

The same object can be seen in many different way as a category.

+

You can choose what are object, morphisms and composition.

+

ex: Str and discrete(Σ*)

+
+
+

Categorical Properties

+ +

Any property which can be expressed in term of category, objects, morphism and composition.

+ +
  • Dual: \(\D\) is \(\C\) with reversed morphisms. +
  • Initial: \(Z\in\ob{\C}\) s.t. \(∀Y∈\ob{\C}, \#\hom{Z,Y}=1\) +
    Unique ("up to isormophism") +
  • Terminal: \(T\in\ob{\C}\) s.t. \(T\) is initial in the dual of \(\C\) +
  • Functor: structure preserving mapping between categories +
  • ... +
+
+
+

Isomorph

+

isomorph cats isomorphism: \(f:A→B\) which can be "undone" i.e.
\(∃g:B→A\), \(g∘f=id_A\) & \(f∘g=id_B\)
in this case, \(A\) & \(B\) are isomorphic.

+

A≌B means A and B are essentially the same.
In Category Theory, = is in fact mostly .
For example in commutative diagrams.

+
+
+

Functor

+ +

A functor is a mapping between two categories. +Let \(\C\) and \(\D\) be two categories. +A functor \(\F\) from \(\C\) to \(\D\):

+
    +
  • Associate objects: \(A\in\ob{\C}\) to \(\F(A)\in\ob{\D}\)
  • +
  • Associate morphisms: \(f:A\to B\) to \(\F(f) : \F(A) \to \F(B)\) + such that +
      +
    • \( \F (\)\(\id_X\)\()= \)\(\id\)\(\vphantom{\id}_{\F(}\)\(\vphantom{\id}_X\)\(\vphantom{\id}_{)} \),
    • +
    • \( \F (\)\(g∘f\)\()= \)\( \F(\)\(g\)\() \)\(\circ\)\( \F(\)\(f\)\() \)
    • +
    +
  • +
+
+
+

Functor Example (ob → ob)

+ +Functor +
+
+

Functor Example (hom → hom)

+ +Functor +
+
+

Functor Example

+ +Functor +
+
+

Endofunctors

+ +

An endofunctor for \(\C\) is a functor \(F:\C→\C\).

+Endofunctor +
+
+

Category of Categories

+ + + +

Categories and functors form a category: \(\Cat\)

+
  • \(\ob{\Cat}\) are categories +
  • \(\hom{\Cat}\) are functors +
  • ∘ is functor composition +
+
+
+

Plan

+
    +
  • General overview
  • +
  • Definitions
  • +
  • Applications +
      +
    • \(\Hask\) category +
    • Functors +
    • Natural transformations +
    • Monads +
    • κατα-morphisms +
    +
  • +
+
+
+

Hask

+ +

Category \(\Hask\):

+ +Haskell Category Representation + +
  • +\(\ob{\Hask} = \) Haskell types +
  • +\(\hom{\Hask} = \) Haskell functions +
  • +∘ = (.) Haskell function composition +
+ +

Forget glitches because of undefined.

+
+
+

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] :: *
+
+
+

Haskell Types

+

Sometimes, the type determine a lot about the function:

+
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 (+1) l
+-- The (+1) force 'a' to be a Num.
+ +

+

★:Theorems for free!, Philip Wadler, 1989

+
+
+

Haskell Functor vs \(\Hask\) Functor

+ +

A Haskell Functor is a type F :: * -> * which belong to the type class Functor ; thus instantiate +fmap :: (a -> b) -> (F a -> F b). + +

& F: \(\ob{\Hask}→\ob{\Hask}\)
& fmap: \(\hom{\Hask}→\hom{\Hask}\) + +

The couple (F,fmap) is a \(\Hask\)'s functor if for any x :: F a:

+
  • fmap id x = x +
  • fmap (f.g) x= (fmap f . fmap g) x +
+
+
+

Haskell Functors Example: Maybe

+ +
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
+
fmap (+1) (Just 1) == Just 2
+fmap (+1) Nothing  == Nothing
+fmap head (Just [1,2,3]) == Just 1
+
+
+

Haskell Functors Example: List

+ +
instance Functor ([]) where
+	fmap :: (a -> b) -> [a] -> [b]
+	fmap = map
+
fmap (+1) [1,2,3]           == [2,3,4]
+fmap (+1) []                == []
+fmap head [[1,2,3],[4,5,6]] == [1,4]
+
+
+

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!"
    • +
  • +
+
+
+

Haskell Functor intuition

+ +

Put normal function inside a container. Ex: list, trees...

+ +Haskell Functor as a box play +

+
+

Haskell Functor properties

+ +

Haskell Functors are:

+ +
  • endofunctors ; \(F:\C→\C\) here \(\C = \Hask\), +
  • a couple (Object,Morphism) in \(\Hask\). +
+
+
+

Functor as boxes

+ +

Haskell functor can be seen as boxes containing all Haskell types and functions. +Haskell types look like a fractal:

+ +Haskell functor representation +
+
+

Functor as boxes

+ +

Haskell functor can be seen as boxes containing all Haskell types and functions. +Haskell types look like a fractal:

+ +Haskell functor representation +
+
+

Functor as boxes

+ +

Haskell functor can be seen as boxes containing all Haskell types and functions. +Haskell types look like a fractal:

+ +Haskell functor representation +
+
+

"Non Haskell" Hask's Functors

+

A simple basic example is the \(id_\Hask\) functor. It simply cannot be expressed as a couple (F,fmap) where

+
    +
  • F::* -> *
  • +
  • fmap :: (a -> b) -> (F a) -> (F b)
  • +
+

Another example:

+
    +
  • F(T)=Int
  • +
  • F(f)=\_->0
  • +
+
+
+

Also Functor inside \(\Hask\)

+

\(\mathtt{[a]}∈\ob{\Hask}\) but is also a category. Idem for Int.

+

length is a Functor from the category [a] to the category Int:

+ +

+ +
+ +
+
+

Category of \(\Hask\) Endofunctors

+Category of Hask endofunctors +
+
+

Category of Functors

+

If \(\C\) is small (\(\hom{\C}\) is a set). All functors from \(\C\) to some category \(\D\) form the category \(\mathrm{Func}(\C,\D)\).

+ +

\(\mathrm{Func}(\C,\C)\) is the category of endofunctors of \(\C\).

+
+
+

Natural Transformations

+

Let \(F\) and \(G\) be two functors from \(\C\) to \(\D\).

+

Natural transformation commutative diagram A natural transformation: familly η ; \(η_X\in\hom{\D}\) for \(X\in\ob{\C}\) s.t.

+

ex: between Haskell functors; F a -> G a
Rearragement functions only.

+
+
+

Natural Transformation Examples (1/4)

+
data List a = Nil | Cons a (List a)
+toList :: [a] -> List a
+toList [] = Nil
+toList (x:xs) = Cons x (toList xs)
+ +

toList is a natural transformation. It is also a morphism from [] to List in the Category of \(\Hask\) endofunctors.

+natural transformation commutative diagram +
+natural transformation commutative diagram +
+ + +
+
+

Natural Transformation Examples (2/4)

+
data List a = Nil | Cons a (List a)
+toHList :: List a -> [a]
+toHList Nil = []
+toHList (Cons x xs) = x:toHList xs
+ +

toHList is a natural transformation. It is also a morphism from List to [] in the Category of \(\Hask\) endofunctors.

+natural transformation commutative diagram +
+natural transformation commutative diagram
toList . toHList = id & toHList . toList = id &
therefore [] & List are isomorph.
+
+ + +
+
+

Natural Transformation Examples (3/4)

+
toMaybe :: [a] -> Maybe a
+toMaybe [] = Nothing
+toMaybe (x:xs) = Just x
+ +

toMaybe is a natural transformation. It is also a morphism from [] to Maybe in the Category of \(\Hask\) endofunctors.

+natural transformation commutative diagram +
+natural transformation commutative diagram +
+ + +
+
+

Natural Transformation Examples (4/4)

+
mToList :: Maybe a -> [a]
+mToList Nothing = []
+mToList Just x  = [x]
+ +

toMaybe is a natural transformation. It is also a morphism from [] to Maybe in the Category of \(\Hask\) endofunctors.

+natural transformation commutative diagram +
+relation between [] and Maybe
There is no isomorphism.
Hint: Bool lists longer than 1.
+
+ + +
+
+

Composition problem

+

The Problem; example with lists:

+
f x = [x]       ⇒ f 1 = [1]   ⇒ (f.f) 1 = [[1]] ✗
+g x = [x+1]     ⇒ g 1 = [2]   ⇒ (g.g) 1 = ERROR [2]+1 ✗
+h x = [x+1,x*3] ⇒ h 1 = [2,3] ⇒ (h.h) 1 = ERROR [2,3]+1 ✗ 
+ +

The same problem with most f :: a -> F a functions and functor F.

+
+
+

Composition Fixable?

+

How to fix that? We want to construct an operator which is able to compose:

+

f :: a -> F b & g :: b -> F c.

+

More specifically we want to create an operator ◎ of type

+

◎ :: (b -> F c) -> (a -> F b) -> (a -> F c)

+

Note: if F = I, ◎ = (.).

+
+
+

Fix Composition (1/2)

+

Goal, find: ◎ :: (b -> F c) -> (a -> F b) -> (a -> F c)
f :: a -> F b, g :: b -> F c:

+ +
+
+

Fix Composition (2/2)

+

Goal, find: ◎ :: (b -> F c) -> (a -> F b) -> (a -> F c)
f :: a -> F b, g :: b -> F c, f x :: F b:

+ +
+
+

Necessary laws

+

For ◎ to work like composition, we need join to hold the following properties:

+ +
+
+

Klesli composition

+

Now the composition works as expected. In Haskell ◎ is <=< in Control.Monad.

+

g <=< f = \x -> join ((fmap g) (f x))

+
f x = [x]       ⇒ f 1 = [1]   ⇒ (f <=< f) 1 = [1] ✓
+g x = [x+1]     ⇒ g 1 = [2]   ⇒ (g <=< g) 1 = [3] ✓
+h x = [x+1,x*3] ⇒ h 1 = [2,3] ⇒ (h <=< h) 1 = [3,6,4,9] ✓
+ + +
+
+

We reinvented Monads!

+

A monad is a triplet (M,⊙,η) where

+ +

Satisfying

+ +
+
+

Compare with Monoid

+

A Monoid is a triplet \((E,∙,e)\) s.t.

+ +

Satisfying

+ +
+
+

Monads are just Monoids

+
+

A Monad is just a monoid in the category of endofunctors, what's the problem?

+
+

The real sentence was:

+
+

All told, a monad in X is just a monoid in the category of endofunctors of X, with product × replaced by composition of endofunctors and unit set by the identity endofunctor.

+
+
+
+

Example: List

+ +
-- In Haskell ⊙ is "join" in "Control.Monad"
+join :: [[a]] -> [a]
+join = concat
+
+-- In Haskell the "return" function (unfortunate name)
+η :: a -> [a]
+η x = [x]
+ + +
+
+

Example: List (law verification)

+

Example: List is a functor (join is ⊙)

+ +
join [ join [[x,y,...,z]] ] = join [[x,y,...,z]]
+                            = join (join [[[x,y,...,z]]])
+join (η [x]) = [x] = join [η x]
+ +

Therefore ([],join,η) is a monad.

+
+
+

Monads useful?

+

A LOT of monad tutorial on the net. Just one example; the State Monad

+

DrawScene to State Screen DrawScene ; still pure.

+
main = drawImage (width,height)
+
+drawImage :: Screen -> DrawScene
+drawImage screen = do
+    drawPoint p screen
+    drawCircle c screen
+    drawRectangle r screen
+
+drawPoint point screen = ...
+drawCircle circle screen = ...
+drawRectangle rectangle screen = ...
+
main = do
+    put (Screen 1024 768)
+    drawImage
+
+drawImage :: State Screen DrawScene
+drawImage = do
+    drawPoint p
+    drawCircle c
+    drawRectangle r
+
+drawPoint :: Point -> State Screen DrawScene
+drawPoint p = do
+    Screen width height <- get
+    ...
+
+
+

fold

+fold +
+
+

κατα-morphism

+catamorphism +
+
+

κατα-morphism: fold generalization

+

acc type of the "accumulator":
fold :: (acc -> a -> acc) -> acc -> [a] -> acc

+

Idea: put the accumulated value inside the type.

+
-- Equivalent to fold (+1) 0 "cata"
+(Cons 'c' (Cons 'a' (Cons 't' (Cons 'a' Nil))))
+(Cons 'c' (Cons 'a' (Cons 't' (Cons 'a' 0))))
+(Cons 'c' (Cons 'a' (Cons 't' 1)))
+(Cons 'c' (Cons 'a' 2))
+(Cons 'c' 3)
+4
+ + +

But where are all the informations? (+1) and 0?

+
+
+

κατα-morphism: Missing Information

+

Where is the missing information?

+ +

First example, make length on [Char]

+
+
+

κατα-morphism: Type work

+

+data StrF a = Cons Char a | Nil
+data Str' = StrF Str'
+
+-- generalize the construction of Str to other datatype
+-- Mu: type fixed point
+-- Mu :: (* -> *) -> *
+
+data Mu f = InF { outF :: f (Mu f) }
+data Str = Mu StrF
+
+-- Example
+foo=InF { outF = Cons 'f'
+        (InF { outF = Cons 'o'
+            (InF { outF = Cons 'o'
+                (InF { outF = Nil })})})}
+ + +
+
+

κατα-morphism: missing information retrieved

+
type Algebra f a = f a -> a
+instance Functor (StrF a) =
+    fmap f (Cons c x) = Cons c (f x)
+    fmap _ Nil = Nil
+ +
cata :: Functor f => Algebra f a -> Mu f -> a
+cata f = f . fmap (cata f) . outF
+ + + +
+
+

κατα-morphism: Finally length

+

All needed information for making length.

+
instance Functor (StrF a) =
+    fmap f (Cons c x) = Cons c (f x)
+    fmap _ Nil = Nil
+
+length' :: Str -> Int
+length' = cata phi where
+    phi :: Algebra StrF Int -- StrF Int -> Int
+    phi (Cons a b) = 1 + b
+    phi Nil = 0
+
+main = do
+    l <- length' $ stringToStr "Toto"
+    ...
+
+
+

κατα-morphism: extension to Trees

+

Once you get the trick, it is easy to extent to most Functor.

+
type Tree = Mu TreeF
+data TreeF x = Node Int [x]
+
+instance Functor TreeF where
+  fmap f (Node e xs) = Node e (fmap f xs)
+
+depth = cata phi where
+  phi :: Algebra TreeF Int -- TreeF Int -> Int
+  phi (Node x sons) = 1 + foldr max 0 sons
+
+
+

Conclusion

+

Category Theory oriented Programming:

+ +

No cat were harmed in the making of this presentation.

+
diff --git a/content/html/fr/blog/Haskell-the-Hard-Way.md b/content/html/fr/blog/Haskell-the-Hard-Way.md index a3d274366..bf51d9cdc 100644 --- a/content/html/fr/blog/Haskell-the-Hard-Way.md +++ b/content/html/fr/blog/Haskell-the-Hard-Way.md @@ -133,7 +133,7 @@ Cet article contient cinq parties : > runhaskell filename.lhs > > - > 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 diff --git a/content/html/fr/blog/Higher-order-function-in-zsh.md b/content/html/fr/blog/Higher-order-function-in-zsh.md index 2a3ab2749..4b2be41e1 100644 --- a/content/html/fr/blog/Higher-order-function-in-zsh.md +++ b/content/html/fr/blog/Higher-order-function-in-zsh.md @@ -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). #!/usr/bin/env zsh diff --git a/content/html/fr/blog/programming-language-experience.md b/content/html/fr/blog/programming-language-experience.md index da0c27150..8b2a4fc70 100644 --- a/content/html/fr/blog/programming-language-experience.md +++ b/content/html/fr/blog/programming-language-experience.md @@ -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é à 216 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. diff --git a/content/html/index.erb b/content/html/index.erb index e3870301a..26dcc4c57 100644 --- a/content/html/index.erb +++ b/content/html/index.erb @@ -45,7 +45,7 @@ targetTitleFrench = latest_fr_article[:title]

Contact »

Resume »

-
+ - Presentation drawing + Presentation drawing

diff --git a/crash.log b/crash.log deleted file mode 100644 index c3e62aabd..000000000 --- a/crash.log +++ /dev/null @@ -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 `' - 52. /usr/local/bin/nanoc:19:in `load' - 53. /usr/local/bin/nanoc:19:in `
' - -=== 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 diff --git a/img_latest_blog_dir b/img_latest_blog_dir index 020d1ef78..fa9bee8c2 120000 --- a/img_latest_blog_dir +++ b/img_latest_blog_dir @@ -1 +1 @@ -./output/Scratch/img/blog/Category-Theory-Programming \ No newline at end of file +./output/Scratch/img/blog/Category-Theory-Presentation \ No newline at end of file diff --git a/latest.ymd b/latest.ymd index 9073bb97c..5a7fd9383 120000 --- a/latest.ymd +++ b/latest.ymd @@ -1 +1 @@ -multi/blog/Category-Theory-Programming.md \ No newline at end of file +multi/blog/Category-Theory-Presentation.md \ No newline at end of file diff --git a/layouts/article.html b/layouts/article.html index e6fc834a9..cfabc7d92 100644 --- a/layouts/article.html +++ b/layouts/article.html @@ -93,26 +93,26 @@ <%= tradOf(:subscribe) %>

-

<%= tradOf(:comment) %>

- - <%= generateIntenseDebateThread %> -
+ +
+ + + comments powered by Disqus +
diff --git a/layouts/article2.html b/layouts/article2.html new file mode 100644 index 000000000..c428ea587 --- /dev/null +++ b/layouts/article2.html @@ -0,0 +1,183 @@ +----- +----- +<% language, languages, blog, article = setItemConf %> + + + + <% + t=tags + if t.length > 0 +%> <% + end +%> + + + + + <% + languages.each do |lang| + item_for_lang=item_of_language(lang) + if not item_for_lang.nil? %> + <% + end + end +%> + + <%= @item[:title] %> + + + + +
+
+ +
<%= + languages.map do |l| + dest=@item_rep.path.sub(%r{#{@config[:webprefix]}/../}, %{#{config[:webprefix]}/#{l}/}) + if @item_rep.path != dest + %{#{ tradOfKeywordIn(:switchTo,l)}} + else + nil + end + end.join() %> +
+
+
+
+

+ <%= @item[:title] %> +

+ <% unless @item[:subtitle].nil? %> +

+ <%= @item[:subtitle] %> +

+ <% end %> +
+
+ + <% if content_for(@item,:summary) %> +
+ <% content_for(@item,:summary) %> +
+ <% end %> + + <%= generateSubMenu %> + +
+
+
+ <%= yield %> +
+ <% depth = depthOf(@item) %> + <% if depth > 3 or ( depth == 3 and @item.children.length > 0 ) %> + +
+ <% end %> + +
+
<%= twitter_share_button %>
+
<%= google_plus_button %>
+
+
+ +
+ +
+

<%= tradOf(:comment) %>

+ +
+ + + comments powered by Disqus +
+ +
+
+ <%= generateMenu %> +
+
+
+
+ + +
+
+
+ + +
+ +
+ <%=tradOf(:copyright) %> +
+
+ <%=tradOf(:created_at)%>: <%= @item[:created_at].strftime(@config[:dateFormat][language.intern]) %> + <%=tradOf(:last_modified)%>: <%= gitmtime.strftime(@config[:dateFormat][language.intern]) %> +
+
+ <%= tradOf(:entirely_done_with) %> + Vim + <%= tradOf(:and) %> + nanoc +
+
+
+
+
+ + + + + + + + diff --git a/lib/fix_img.rb b/lib/fix_img.rb new file mode 100644 index 000000000..d553b07c9 --- /dev/null +++ b/lib/fix_img.rb @@ -0,0 +1,8 @@ +class FixImage < Nanoc3::Filter + identifier :fix_img + def run(content, params={}) + content.gsub(%r{

(]*>)

}) do |m| + $1.to_s + end + end +end diff --git a/lib/intenseDebate.rb b/lib/intenseDebate.rb index 61d500214..46f03ce00 100644 --- a/lib/intenseDebate.rb +++ b/lib/intenseDebate.rb @@ -18,6 +18,6 @@ def generateIntenseDebateThread var idcomments_post_url = 'http://yannesposito.com#{protectedPath}'; - + } end diff --git a/multi/blog/Category-Theory-Presentation.erb b/multi/blog/Category-Theory-Presentation.erb new file mode 100644 index 000000000..0673166cf --- /dev/null +++ b/multi/blog/Category-Theory-Presentation.erb @@ -0,0 +1,1001 @@ +----- +isHidden: false +menupriority: 1 +kind: article +created_at: 2012-12-12T10:06:40+02:00 +en: title: Category Theory Presentation +fr: title: Category Theory Presentation +author_name: Yann Esposito +author_uri: yannesposito.com +tags: + - category theory + - math + - functor +----- +Cateogry of Hask's endofunctors + +

Yesterday I was happy to make a presentation about Category Theory at Riviera Scala Clojure Meetup (note I used only Haskell for my examples).

+ + + +

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. +

+ +
+\(\newcommand{\F}{\mathbf{F}}\) +\(\newcommand{\E}{\mathbf{E}}\) +\(\newcommand{\C}{\mathcal{C}}\) +\(\newcommand{\D}{\mathcal{D}}\) +\(\newcommand{\id}{\mathrm{id}}\) +\(\newcommand{\ob}[1]{\mathrm{ob}(#1)}\) +\(\newcommand{\hom}[1]{\mathrm{hom}(#1)}\) +\(\newcommand{\Set}{\mathbf{Set}}\) +\(\newcommand{\Mon}{\mathbf{Mon}}\) +\(\newcommand{\Vec}{\mathbf{Vec}}\) +\(\newcommand{\Grp}{\mathbf{Grp}}\) +\(\newcommand{\Rng}{\mathbf{Rng}}\) +\(\newcommand{\ML}{\mathbf{ML}}\) +\(\newcommand{\Hask}{\mathbf{Hask}}\) +\(\newcommand{\Cat}{\mathbf{Cat}}\) +\(\newcommand{\fmap}{\mathtt{fmap}}\) +
+ +
+

Category Theory & Programming

+
for Rivieria Scala Clojure (Note this presentation uses Haskell)
+by Yann Esposito +
+ + @yogsototh, + + + +yogsototh + +
+
+
ENTER FULLSCREEN
+ HTML presentation: use arrows, space, swipe to navigate. +
+
+
+

Plan

+
    +
  • General overview
  • +
  • Definitions
  • +
  • Applications
  • +
+
+
+

Not really about: Cat & glory

+
+Cat n glory
credit to Tokuhiro Kawai (川井徳寛)
+
+ + + +
+
+

General Overview

+
+Samuel Eilenberg Saunders Mac Lane +
+ +

Recent Math Field
1942-45, Samuel Eilenberg & Saunders Mac Lane

+

Certainly one of the more abstract branches of math

+
    +
  • New math foundation
    formalism abstraction, package entire theory
  • +
  • Bridge between disciplines
    Physics, Quantum Physics, Topology, Logic, Computer Science
  • +
+

+★: When is one thing equal to some other thing?, Barry Mazur, 2007
☆: Physics, Topology, Logic and Computation: A Rosetta Stone, John C. Baez, Mike Stay, 2009 +

+ + +
+
+

From a Programmer perspective

+
+

Category Theory is a new language/framework for Math

+
+
    +
  • Another way of thinking
  • +
  • Extremely efficient for generalization
  • +
+
+
+

Math Programming relation

+Buddha Fractal +

Programming is doing Math

+

Strong relations between type theory and category theory.

+

Not convinced?
Certainly a vocabulary problem.

+

One of the goal of Category Theory is to create a homogeneous vocabulary between different disciplines.

+
+
+

Vocabulary

+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, ...

+
+
+
+

Programmer Translation

+lolcat + + + + + + + + +
+Mathematician + +Programmer +
+Morphism + +Arrow +
+Monoid + +String-like +
+Preorder + +Acyclic graph +
+Isomorph + +The same +
+Natural transformation + +rearrangement function +
+Funny Category + +LOLCat +
+ + +
+
+

Plan

+
    +
  • General overview
  • +
  • Definitions +
      +
    • Category
    • +
    • Intuition
    • +
    • Examples
    • +
    • Functor
    • +
    • Examples
    • +
    +
  • +
  • Applications
  • +
+
+
+

Category

+ +

A way of representing things and ways to go between things.

+ +

A Category \(\mathcal{C}\) is defined by:

+
    +
  • Objects \(\ob{C}\),
  • +
  • Morphisms \(\hom{C}\),
  • +
  • a Composition law (∘)
  • +
  • obeying some Properties.
  • +
+
+
+

Category: Objects

+ +objects + +

\(\ob{\mathcal{C}}\) is a collection

+
+
+

Category: Morphisms

+ +morphisms + +

\(A\) and \(B\) objects of \(\C\)
+\(\hom{A,B}\) is a collection of morphisms
+\(f:A→B\) denote the fact \(f\) belongs to \(\hom{A,B}\)

+

\(\hom{\C}\) the collection of all morphisms of \(\C\)

+
+
+

Category: Composition

+

Composition (∘): associate to each couple \(f:A→B, g:B→C\) + $$g∘f:A\rightarrow C$$ +

+composition +
+
+

Category laws: neutral element

+

for each object \(X\), there is an \(\id_X:X→X\),
+such that for each \(f:A→B\):

+identity +
+
+

Category laws: Associativity

+

Composition is associative:

+associative composition +
+
+

Commutative diagrams

+ +

Two path with the same source and destination are equal.

+
+ Commutative Diagram (Associativity) +
+ \((h∘g)∘f = h∘(g∘f) \) +
+
+
+ Commutative Diagram (Identity law) +
+ \(id_B∘f = f = f∘id_A \) +
+
+
+
+

Question Time!

+ +
+ +
+- French-only joke - +
+
+
+
+

Can this be a category?

+

\(\ob{\C},\hom{\C}\) fixed, is there a valid ∘?

+
+ Category example 1 +
+ YES +
+
+
+ Category example 2 +
+ no candidate for \(g∘f\) +
NO +
+
+
+ Category example 3 +
+ YES +
+
+
+
+

Can this be a category?

+
+ Category example 4 +
+ no candidate for \(f:C→B\) +
NO +
+
+
+ Category example 5 +
+ \((h∘g)∘f=\id_B∘f=f\)
+ \(h∘(g∘f)=h∘\id_A=h\)
+ but \(h≠f\)
+ NO +
+
+
+
+

Categories Examples

+ +
+Basket of cats +
+- Basket of Cats - +
+
+
+
+

Category \(\Set\)

+ +
    +
  • \(\ob{\Set}\) are all the sets
  • +
  • \(\hom{E,F}\) are all functions from \(E\) to \(F\)
  • +
  • ∘ is functions composition
  • +
+ +
    +
  • \(\ob{\Set}\) is a proper class ; not a set
  • +
  • \(\hom{E,F}\) is a set
  • +
  • \(\Set\) is then a locally small category
  • +
+
+
+

Categories Everywhere?

+Cats everywhere +
    +
  • \(\Mon\): (monoids, monoid morphisms,∘)
  • +
  • \(\Vec\): (Vectorial spaces, linear functions,∘)
  • +
  • \(\Grp\): (groups, group morphisms,∘)
  • +
  • \(\Rng\): (rings, ring morphisms,∘)
  • +
  • Any deductive system T: (theorems, proofs, proof concatenation)
  • +
  • \( \Hask\): (Haskell types, functions, (.) )
  • +
  • ...
  • +
+
+
+

Smaller Examples

+ +

Strings

+Monoids are one object categories +
    +
  • \(\ob{Str}\) is a singleton
  • +
  • \(\hom{Str}\) each string
  • +
  • ∘ is concatenation (++)
  • +
+
    +
  • "" ++ u = u = u ++ ""
  • +
  • (u ++ v) ++ w = u ++ (v ++ w)
  • +
+
+
+

Finite Example?

+ +

Graph

+
+Each graph is a category +
+
    +
  • \(\ob{G}\) are vertices
  • +
  • \(\hom{G}\) each path
  • +
  • ∘ is path concatenation
  • +
+
  • \(\ob{G}=\{X,Y,Z\}\), +
  • \(\hom{G}=\{ε,α,β,γ,αβ,βγ,...\}\) +
  • \(αβ∘γ=αβγ\) +
+
+
+

Number construction

+ +

Each Numbers as a whole category

+Each number as a category +
+
+

Degenerated Categories: Monoids

+ +Monoids are one object categories +

Each Monoid \((M,e,⊙): \ob{M}=\{∙\},\hom{M}=M,\circ = ⊙\)

+

Only one object.

+

Examples:

+
  • (Integer,0,+), (Integer,1,*), +
  • (Strings,"",++), for each a, ([a],[],++) +
+
+
+

Degenerated Categories: Preorders \((P,≤)\)

+ +
  • \(\ob{P}={P}\), +
  • \(\hom{x,y}=\{x≤y\} ⇔ x≤y\), +
  • \((y≤z) \circ (x≤y) = (x≤z) \) +
+ +

At most one morphism between two objects.

+ +preorder category +
+
+

Degenerated Categories: Discrete Categories

+ +Any set can be a category +

Any Set

+

Any set \(E: \ob{E}=E, \hom{x,y}=\{x\} ⇔ x=y \)

+

Only identities

+
+
+

Choice

+

The same object can be seen in many different way as a category.

+

You can choose what are object, morphisms and composition.

+

ex: Str and discrete(Σ*)

+
+
+

Categorical Properties

+ +

Any property which can be expressed in term of category, objects, morphism and composition.

+ +
  • Dual: \(\D\) is \(\C\) with reversed morphisms. +
  • Initial: \(Z\in\ob{\C}\) s.t. \(∀Y∈\ob{\C}, \#\hom{Z,Y}=1\) +
    Unique ("up to isormophism") +
  • Terminal: \(T\in\ob{\C}\) s.t. \(T\) is initial in the dual of \(\C\) +
  • Functor: structure preserving mapping between categories +
  • ... +
+
+
+

Isomorph

+

isomorph cats isomorphism: \(f:A→B\) which can be "undone" i.e.
\(∃g:B→A\), \(g∘f=id_A\) & \(f∘g=id_B\)
in this case, \(A\) & \(B\) are isomorphic.

+

A≌B means A and B are essentially the same.
In Category Theory, = is in fact mostly .
For example in commutative diagrams.

+
+
+

Functor

+ +

A functor is a mapping between two categories. +Let \(\C\) and \(\D\) be two categories. +A functor \(\F\) from \(\C\) to \(\D\):

+
    +
  • Associate objects: \(A\in\ob{\C}\) to \(\F(A)\in\ob{\D}\)
  • +
  • Associate morphisms: \(f:A\to B\) to \(\F(f) : \F(A) \to \F(B)\) + such that +
      +
    • \( \F (\)\(\id_X\)\()= \)\(\id\)\(\vphantom{\id}_{\F(}\)\(\vphantom{\id}_X\)\(\vphantom{\id}_{)} \),
    • +
    • \( \F (\)\(g∘f\)\()= \)\( \F(\)\(g\)\() \)\(\circ\)\( \F(\)\(f\)\() \)
    • +
    +
  • +
+
+
+

Functor Example (ob → ob)

+ +Functor +
+
+

Functor Example (hom → hom)

+ +Functor +
+
+

Functor Example

+ +Functor +
+
+

Endofunctors

+ +

An endofunctor for \(\C\) is a functor \(F:\C→\C\).

+Endofunctor +
+
+

Category of Categories

+ + + +

Categories and functors form a category: \(\Cat\)

+
  • \(\ob{\Cat}\) are categories +
  • \(\hom{\Cat}\) are functors +
  • ∘ is functor composition +
+
+
+

Plan

+
    +
  • General overview
  • +
  • Definitions
  • +
  • Applications +
      +
    • \(\Hask\) category +
    • Functors +
    • Natural transformations +
    • Monads +
    • κατα-morphisms +
    +
  • +
+
+
+

Hask

+ +

Category \(\Hask\):

+ +Haskell Category Representation + +
  • +\(\ob{\Hask} = \) Haskell types +
  • +\(\hom{\Hask} = \) Haskell functions +
  • +∘ = (.) Haskell function composition +
+ +

Forget glitches because of undefined.

+
+
+

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] :: *
+
+
+

Haskell Types

+

Sometimes, the type determine a lot about the function:

+
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 (+1) l
+-- The (+1) force 'a' to be a Num.
+ +

+

★:Theorems for free!, Philip Wadler, 1989

+
+
+

Haskell Functor vs \(\Hask\) Functor

+ +

A Haskell Functor is a type F :: * -> * which belong to the type class Functor ; thus instantiate +fmap :: (a -> b) -> (F a -> F b). + +

& F: \(\ob{\Hask}→\ob{\Hask}\)
& fmap: \(\hom{\Hask}→\hom{\Hask}\) + +

The couple (F,fmap) is a \(\Hask\)'s functor if for any x :: F a:

+
  • fmap id x = x +
  • fmap (f.g) x= (fmap f . fmap g) x +
+
+
+

Haskell Functors Example: Maybe

+ +
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
+
fmap (+1) (Just 1) == Just 2
+fmap (+1) Nothing  == Nothing
+fmap head (Just [1,2,3]) == Just 1
+
+
+

Haskell Functors Example: List

+ +
instance Functor ([]) where
+	fmap :: (a -> b) -> [a] -> [b]
+	fmap = map
+
fmap (+1) [1,2,3]           == [2,3,4]
+fmap (+1) []                == []
+fmap head [[1,2,3],[4,5,6]] == [1,4]
+
+
+

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!"
    • +
  • +
+
+
+

Haskell Functor intuition

+ +

Put normal function inside a container. Ex: list, trees...

+ +Haskell Functor as a box play +

+
+

Haskell Functor properties

+ +

Haskell Functors are:

+ +
  • endofunctors ; \(F:\C→\C\) here \(\C = \Hask\), +
  • a couple (Object,Morphism) in \(\Hask\). +
+
+
+

Functor as boxes

+ +

Haskell functor can be seen as boxes containing all Haskell types and functions. +Haskell types look like a fractal:

+ +Haskell functor representation +
+
+

Functor as boxes

+ +

Haskell functor can be seen as boxes containing all Haskell types and functions. +Haskell types look like a fractal:

+ +Haskell functor representation +
+
+

Functor as boxes

+ +

Haskell functor can be seen as boxes containing all Haskell types and functions. +Haskell types look like a fractal:

+ +Haskell functor representation +
+
+

"Non Haskell" Hask's Functors

+

A simple basic example is the \(id_\Hask\) functor. It simply cannot be expressed as a couple (F,fmap) where

+
    +
  • F::* -> *
  • +
  • fmap :: (a -> b) -> (F a) -> (F b)
  • +
+

Another example:

+
    +
  • F(T)=Int
  • +
  • F(f)=\_->0
  • +
+
+
+

Also Functor inside \(\Hask\)

+

\(\mathtt{[a]}∈\ob{\Hask}\) but is also a category. Idem for Int.

+

length is a Functor from the category [a] to the category Int:

+
    +
  • \(\ob{\mathtt{[a]}}=\{∙\}\)
  • +
  • \(\hom{\mathtt{[a]}}=\mathtt{[a]}\)
  • +
  • \(∘=\mathtt{(++)}\)
  • +
+

+
    +
  • \(\ob{\mathtt{Int}}=\{∙\}\)
  • +
  • \(\hom{\mathtt{Int}}=\mathtt{Int}\)
  • +
  • \(∘=\mathtt{(+)}\)
  • +
+
+
  • id: length [] = 0 +
  • comp: length (l ++ l') = (length l) + (length l') +
+
+
+

Category of \(\Hask\) Endofunctors

+Category of Hask endofunctors +
+
+

Category of Functors

+

If \(\C\) is small (\(\hom{\C}\) is a set). All functors from \(\C\) to some category \(\D\) form the category \(\mathrm{Func}(\C,\D)\).

+
    +
  • \(\ob{\mathrm{Func}(\C,\D)}\): Functors \(F:\C→\D\)
  • +
  • \(\hom{\mathrm{Func}(\C,\D)}\): natural transformations
  • +
  • ∘: Functor composition
  • +
+

\(\mathrm{Func}(\C,\C)\) is the category of endofunctors of \(\C\).

+
+
+

Natural Transformations

+

Let \(F\) and \(G\) be two functors from \(\C\) to \(\D\).

+

Natural transformation commutative diagram A natural transformation: familly η ; \(η_X\in\hom{\D}\) for \(X\in\ob{\C}\) s.t.

+

ex: between Haskell functors; F a -> G a
Rearragement functions only.

+
+
+

Natural Transformation Examples (1/4)

+
data List a = Nil | Cons a (List a)
+toList :: [a] -> List a
+toList [] = Nil
+toList (x:xs) = Cons x (toList xs)
+ +

toList is a natural transformation. It is also a morphism from [] to List in the Category of \(\Hask\) endofunctors.

+natural transformation commutative diagram +
+natural transformation commutative diagram +
+ + +
+
+

Natural Transformation Examples (2/4)

+
data List a = Nil | Cons a (List a)
+toHList :: List a -> [a]
+toHList Nil = []
+toHList (Cons x xs) = x:toHList xs
+ +

toHList is a natural transformation. It is also a morphism from List to [] in the Category of \(\Hask\) endofunctors.

+natural transformation commutative diagram +
+natural transformation commutative diagram
toList . toHList = id & toHList . toList = id &
therefore [] & List are isomorph.
+
+ + +
+
+

Natural Transformation Examples (3/4)

+
toMaybe :: [a] -> Maybe a
+toMaybe [] = Nothing
+toMaybe (x:xs) = Just x
+ +

toMaybe is a natural transformation. It is also a morphism from [] to Maybe in the Category of \(\Hask\) endofunctors.

+natural transformation commutative diagram +
+natural transformation commutative diagram +
+ + +
+
+

Natural Transformation Examples (4/4)

+
mToList :: Maybe a -> [a]
+mToList Nothing = []
+mToList Just x  = [x]
+ +

toMaybe is a natural transformation. It is also a morphism from [] to Maybe in the Category of \(\Hask\) endofunctors.

+natural transformation commutative diagram +
+relation between [] and Maybe
There is no isomorphism.
Hint: Bool lists longer than 1.
+
+ + +
+
+

Composition problem

+

The Problem; example with lists:

+
f x = [x]       ⇒ f 1 = [1]   ⇒ (f.f) 1 = [[1]] ✗
+g x = [x+1]     ⇒ g 1 = [2]   ⇒ (g.g) 1 = ERROR [2]+1 ✗
+h x = [x+1,x*3] ⇒ h 1 = [2,3] ⇒ (h.h) 1 = ERROR [2,3]+1 ✗ 
+ +

The same problem with most f :: a -> F a functions and functor F.

+
+
+

Composition Fixable?

+

How to fix that? We want to construct an operator which is able to compose:

+

f :: a -> F b & g :: b -> F c.

+

More specifically we want to create an operator ◎ of type

+

◎ :: (b -> F c) -> (a -> F b) -> (a -> F c)

+

Note: if F = I, ◎ = (.).

+
+
+

Fix Composition (1/2)

+

Goal, find: ◎ :: (b -> F c) -> (a -> F b) -> (a -> F c)
f :: a -> F b, g :: b -> F c:

+
    +
  • (g ◎ f) x ???
  • +
  • First apply f to xf x :: F b
  • +
  • Then how to apply g properly to an element of type F b?
  • +
+
+
+

Fix Composition (2/2)

+

Goal, find: ◎ :: (b -> F c) -> (a -> F b) -> (a -> F c)
f :: a -> F b, g :: b -> F c, f x :: F b:

+
    +
  • Use fmap :: (t -> u) -> (F t -> F u)!
  • +
  • (fmap g) :: F b -> F (F c) ; (t=b, u=F c)
  • +
  • (fmap g) (f x) :: F (F c) it almost WORKS!
  • +
  • We lack an important component, join :: F (F c) -> F c
  • +
  • (g ◎ f) x = join ((fmap g) (f x))
    ◎ is the Kleisli composition; in Haskell: <=< (in Control.Monad).
  • +
+
+
+

Necessary laws

+

For ◎ to work like composition, we need join to hold the following properties:

+
    +
  • join (join (F (F (F a))))=join (F (join (F (F a))))
  • +
  • abusing notations denoting join by ⊙; this is equivalent to
    (F ⊙ F) ⊙ F = F ⊙ (F ⊙ F)
  • +
  • There exists η :: a -> F a s.t.
    η⊙F=F=F⊙η
  • +
+
+
+

Klesli composition

+

Now the composition works as expected. In Haskell ◎ is <=< in Control.Monad.

+

g <=< f = \x -> join ((fmap g) (f x))

+
f x = [x]       ⇒ f 1 = [1]   ⇒ (f <=< f) 1 = [1] ✓
+g x = [x+1]     ⇒ g 1 = [2]   ⇒ (g <=< g) 1 = [3] ✓
+h x = [x+1,x*3] ⇒ h 1 = [2,3] ⇒ (h <=< h) 1 = [3,6,4,9] ✓
+ + +
+
+

We reinvented Monads!

+

A monad is a triplet (M,⊙,η) where

+
    +
  • \(M\) an Endofunctor (to type a associate M a)
  • +
  • \(⊙:M×M→M\) a nat. trans. (i.e. ⊙::M (M a) → M a ; join)
  • +
  • \(η:I→M\) a nat. trans. (\(I\) identity functor ; η::a → M a)
  • +
+

Satisfying

+
    +
  • \(M ⊙ (M ⊙ M) = (M ⊙ M) ⊙ M\)
  • +
  • \(η ⊙ M = M = M ⊙ η\)
  • +
+
+
+

Compare with Monoid

+

A Monoid is a triplet \((E,∙,e)\) s.t.

+
    +
  • \(E\) a set
  • +
  • \(∙:E×E→E\)
  • +
  • \(e:1→E\)
  • +
+

Satisfying

+
    +
  • \(x∙(y∙z) = (x∙y)∙z, ∀x,y,z∈E\)
  • +
  • \(e∙x = x = x∙e, ∀x∈E\)
  • +
+
+
+

Monads are just Monoids

+
+

A Monad is just a monoid in the category of endofunctors, what's the problem?

+
+

The real sentence was:

+
+

All told, a monad in X is just a monoid in the category of endofunctors of X, with product × replaced by composition of endofunctors and unit set by the identity endofunctor.

+
+
+
+

Example: List

+
    +
  • [] :: * -> * an Endofunctor
  • +
  • \(⊙:M×M→M\) a nat. trans. (join :: M (M a) -> M a)
  • +
  • \(η:I→M\) a nat. trans.
  • +
+
-- In Haskell ⊙ is "join" in "Control.Monad"
+join :: [[a]] -> [a]
+join = concat
+
+-- In Haskell the "return" function (unfortunate name)
+η :: a -> [a]
+η x = [x]
+ + +
+
+

Example: List (law verification)

+

Example: List is a functor (join is ⊙)

+
    +
  • \(M ⊙ (M ⊙ M) = (M ⊙ M) ⊙ M\)
  • +
  • \(η ⊙ M = M = M ⊙ η\)
  • +
+
join [ join [[x,y,...,z]] ] = join [[x,y,...,z]]
+                            = join (join [[[x,y,...,z]]])
+join (η [x]) = [x] = join [η x]
+ +

Therefore ([],join,η) is a monad.

+
+
+

Monads useful?

+

A LOT of monad tutorial on the net. Just one example; the State Monad

+

DrawScene to State Screen DrawScene ; still pure.

+
main = drawImage (width,height)
+
+drawImage :: Screen -> DrawScene
+drawImage screen = do
+    drawPoint p screen
+    drawCircle c screen
+    drawRectangle r screen
+
+drawPoint point screen = ...
+drawCircle circle screen = ...
+drawRectangle rectangle screen = ...
+
main = do
+    put (Screen 1024 768)
+    drawImage
+
+drawImage :: State Screen DrawScene
+drawImage = do
+    drawPoint p
+    drawCircle c
+    drawRectangle r
+
+drawPoint :: Point -> State Screen DrawScene
+drawPoint p = do
+    Screen width height <- get
+    ...
+
+
+

fold

+fold +
+
+

κατα-morphism

+catamorphism +
+
+

κατα-morphism: fold generalization

+

acc type of the "accumulator":
fold :: (acc -> a -> acc) -> acc -> [a] -> acc

+

Idea: put the accumulated value inside the type.

+
-- Equivalent to fold (+1) 0 "cata"
+(Cons 'c' (Cons 'a' (Cons 't' (Cons 'a' Nil))))
+(Cons 'c' (Cons 'a' (Cons 't' (Cons 'a' 0))))
+(Cons 'c' (Cons 'a' (Cons 't' 1)))
+(Cons 'c' (Cons 'a' 2))
+(Cons 'c' 3)
+4
+ + +

But where are all the informations? (+1) and 0?

+
+
+

κατα-morphism: Missing Information

+

Where is the missing information?

+
    +
  • Functor operator fmap
  • +
  • Algebra representing the (+1) and also knowing about the 0.
  • +
+

First example, make length on [Char]

+
+
+

κατα-morphism: Type work

+

+data StrF a = Cons Char a | Nil
+data Str' = StrF Str'
+
+-- generalize the construction of Str to other datatype
+-- Mu: type fixed point
+-- Mu :: (* -> *) -> *
+
+data Mu f = InF { outF :: f (Mu f) }
+data Str = Mu StrF
+
+-- Example
+foo=InF { outF = Cons 'f'
+        (InF { outF = Cons 'o'
+            (InF { outF = Cons 'o'
+                (InF { outF = Nil })})})}
+ + +
+
+

κατα-morphism: missing information retrieved

+
type Algebra f a = f a -> a
+instance Functor (StrF a) =
+    fmap f (Cons c x) = Cons c (f x)
+    fmap _ Nil = Nil
+ +
cata :: Functor f => Algebra f a -> Mu f -> a
+cata f = f . fmap (cata f) . outF
+ + + +
+
+

κατα-morphism: Finally length

+

All needed information for making length.

+
instance Functor (StrF a) =
+    fmap f (Cons c x) = Cons c (f x)
+    fmap _ Nil = Nil
+
+length' :: Str -> Int
+length' = cata phi where
+    phi :: Algebra StrF Int -- StrF Int -> Int
+    phi (Cons a b) = 1 + b
+    phi Nil = 0
+
+main = do
+    l <- length' $ stringToStr "Toto"
+    ...
+
+
+

κατα-morphism: extension to Trees

+

Once you get the trick, it is easy to extent to most Functor.

+
type Tree = Mu TreeF
+data TreeF x = Node Int [x]
+
+instance Functor TreeF where
+  fmap f (Node e xs) = Node e (fmap f xs)
+
+depth = cata phi where
+  phi :: Algebra TreeF Int -- TreeF Int -> Int
+  phi (Node x sons) = 1 + foldr max 0 sons
+
+
+

Conclusion

+

Category Theory oriented Programming:

+
    +
  • Focus on the type and operators
  • +
  • Extreme generalisation
  • +
  • Better modularity
  • +
  • Better control through properties of types
  • +
+

No cat were harmed in the making of this presentation.

+
diff --git a/multi/blog/Haskell-the-Hard-Way.md b/multi/blog/Haskell-the-Hard-Way.md index 5dfedbd11..2def29e25 100644 --- a/multi/blog/Haskell-the-Hard-Way.md +++ b/multi/blog/Haskell-the-Hard-Way.md @@ -187,7 +187,7 @@ fr: >
 fr:  > runhaskell filename.lhs
 fr:  > 
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 diff --git a/multi/blog/Higher-order-function-in-zsh.md b/multi/blog/Higher-order-function-in-zsh.md index d0afec11b..419decd5d 100644 --- a/multi/blog/Higher-order-function-in-zsh.md +++ b/multi/blog/Higher-order-function-in-zsh.md @@ -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). #!/usr/bin/env zsh diff --git a/output/Scratch/assets/css/cmu.css b/output/Scratch/assets/css/cmu.css new file mode 100644 index 000000000..87668771b --- /dev/null +++ b/output/Scratch/assets/css/cmu.css @@ -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} \ No newline at end of file diff --git a/output/Scratch/assets/css/main.css b/output/Scratch/assets/css/main.css index 1462d646f..b3d4aa2ea 100644 --- a/output/Scratch/assets/css/main.css +++ b/output/Scratch/assets/css/main.css @@ -1 +1 @@ -@charset "UTF-8";@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:400;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:700}@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:400;font-style:normal}i,em{font-style:italic}b,strong,h1,h2,h3,h4,h5,h6{font-weight:700}table.description tr td{border:1px solid #eeeef1}.assombris20{background-color:#eeeef1}body{color:#002b36;background-color:#fafafc}::selection{background:#002b36;color:#93a1a1}::-moz-selection{background:#002b36;color:#93a1a1}pre,code,a.cut{font-family:"cmuntt",Incosolata,Monaco,monospace}pre::selection{background:#fdf6e3;color:#586e75}pre *::selection{background:#fdf6e3;color:#586e75}pre::-moz-selection{background:#fdf6e3;color:#586e75}pre *::-moz-selection{background:#fdf6e3;color:#586e75}a:hover{text-shadow:0 0 2px#faa}a,a:link,a:visited,a:active,a:hover{text-decoration:none;outline:none}a,a:link,a:visited,a:active{color:#002b36}a:hover{color:#cb4b16}hr{color:#eeeef1;border-top:1px solid #eeeef1;border-bottom:none;border-left:none;border-right:none}ul{list-style:none}.corps ul li:before{content:"- "}ol,ul{padding-left:0}.toc ol li,.toc ul li{margin:.5em 0}ol li ul,ol li ol,ul li ol,ul li ul{margin:.5em 1.5em;list-style:none}body,h1,h2,h3,h4,#entete,.tagname{text-rendering:optimizelegibility;line-height:1.5em}body{font-family:"ComputerModern",Georgia,Palatino,"Century Schoolbook L","Times New Roman",Times,serif}.article #afterheader{counter-reset:niv02}.article #afterheader h2{counter-increment:niv02;counter-reset:niv03;marker-offset:3em}.article #afterheader h2:before{content:counter(niv02) ". "}.article #afterheader h3{counter-increment:niv03;counter-reset:niv04}.article #afterheader h3:before{content:counter(niv02) "." counter(niv03) ". "}.article #afterheader h4{counter-increment:niv04}.article #afterheader h4:before{content:counter(niv02) "." counter(niv03) "." counter(niv04) ". "}pre{background-color:#002b36;color:#839496;box-shadow:0 0 5px #d0d0d2 inset;border-radius:3px;padding:1em;line-height:1em;font-size:.9em}p{margin-bottom:1.2em}blockquote{border:solid 1px #ccccd0;border-radius:2px;box-shadow:0 0 4px #f2f2f4 inset;background-color:#f8f8fa;font-style:italic;padding:.5em 1em;color:#556}blockquote a:hover{color:#cb4b16}blockquote i,blockquote em{font-weight:400;font-style:normal;color:#002b36}blockquote strong,blockquote b{font-weight:700;color:#002b36}blockquote ul{padding-left:1.5em}abbr,acronym{text-transform:uppercase;font-size:.8em;text-decoration:none;border-bottom-width:0}#titre{letter-spacing:-0.06em;border-bottom:4px double #ccccd0;border-top:4px double #ccccd0}#liens .active,#sousliens{color:#002b36;border:#ccccd0 solid 1px;border-radius:5px;box-shadow:0 0 2px #ccccd0 inset;background-color:#eeeef1}#liens .active a,#sousliens a{color:#667}#liens .active a:hover,#sousliens a:hover{color:#cb4b16}#liens .active a:hover strong,#liens .active a:hover b,#liens .active a:hover i,#liens .active a:hover em,#liens .active a:hover .nicer,#sousliens a:hover strong,#sousliens a:hover b,#sousliens a:hover i,#sousliens a:hover em,#sousliens a:hover .nicer{color:#ffb17c}#liens .active hr,#sousliens hr{color:#667;border-top:1px solid#667}#liens .active strong,#liens .active b,#liens .active i,#liens .active em,#sousliens strong,#sousliens b,#sousliens i,#sousliens em{color:#002b36}#liens a{border:1px solid#eee;background:rgba(0,0,0,0.05);box-shadow:0 0 2px white,0 0 3px#ccc inset;border:1px solid rgba(0,0,0,0.1);border-radius:3px}#liens a:hover{background:rgba(0,0,0,0.1);box-shadow:0 0 6px#555 inset}#liens .active{text-shadow:0 0 2px rgba(0,0,0,0.5);background-color:#f7f7f9;border:1px solid #e9e9eb;box-shadow:0 0 3px #c7c7c9 inset;border-radius:3px;border-top:none}#lastmod{font-size:.9em}.nojsbutton{font-size:2.5em}#clickcomment,#choixlang > a,#choixrss > a,.return > a{display:block;width:25%;cursor:pointer;margin:1em 0;padding:1em;font-size:16px;line-height:1.4em;border:1px solid #fafafc;color:#ccccd0}#clickcomment:hover,#choixlang > a:hover,#choixrss > a:hover,.return > a:hover{border:solid 1px #ccccd0;border-radius:2px;box-shadow:0 0 4px #f2f2f4 inset;background-color:#f8f8fa;color:#dc5c27;text-shadow:0 0 2px#faa}#clickcomment:active,#choixlang > a:active,#choixrss > a:active,.return > a:active{border:solid 1px #ccccd0;border-radius:2px;box-shadow:0 0 4px #f2f2f4 inset;background-color:#f8f8fa;color:#dc5c27;text-shadow:0 0 2px#faa;background:#f4f4f6}.return > a,#choixrss > a{float:right}#choix .return > a,#choix #choixrss > a{margin-top:0}.small{font-size:.8em}.sc{text-transform:uppercase;font-size:.8em}.impact,.darkimpact{font-size:2em;margin:0 auto 1em auto;line-height:1.3em}h1 > .date{font-size:.6em;color:#002b36}.date{font-size:.8em;color:#fafafc;border:1px solid #002b36;text-align:center;width:4.1em;line-height:1.5em;display:inline-block;vertical-align:middle;margin-right:1em}.date .day,.date .month,.date .year{display:block}.date .day{color:#002b36;background-color:#fafafc;float:left;width:1.7em}.date .month{float:right;width:2.3em;background-color:#002b36;color:#fafafc}.date .year{line-height:3ex;clear:both;color:#002b36;border:#ccccd0 solid 1px;border-radius:5px;box-shadow:0 0 2px #ccccd0 inset;background-color:#eeeef1;border-radius:0}.date .year a{color:#667}.date .year a:hover{color:#cb4b16}.date .year a:hover strong,.date .year a:hover b,.date .year a:hover i,.date .year a:hover em,.date .year a:hover .nicer{color:#ffb17c}.date .year hr{color:#667;border-top:1px solid#667}.date .year strong,.date .year b,.date .year i,.date .year em{color:#002b36}body{text-align:center;font-size:16px}body > #entete{position:absolute;left:0;top:.5em;width:100%;min-width:50em;z-index:8000;padding-bottom:1em;margin-bottom:3em}#titre h2{width:80%;margin-left:auto;margin-right:auto;text-align:center;color:#ccccd0}#titre{text-align:center;width:100%}#titre h1,#titre h2{padding-left:1em;padding-right:1em}#bottom{clear:right;margin-right:0;padding:1.5em;line-height:1.5em;color:#224d58;margin-top:2em;text-align:center}#bottom a{color:#113c47}#bottom a:hover{color:#cb4b16}#sousliens{padding:1em 0;line-height:2em}#sousliens ul{list-style:none;margin-left:4em}ul.horizontal li{display:inline;font-size:.9em}ul.horizontal{margin-top:0;margin-bottom:0}#entete{padding-top:.1em;border-top:1px solid #ccccd0;border-bottom:1px solid #ccccd0}#liens{width:100%;padding:0;clear:both;margin-top:.5em}#liens ul{width:100%;clear:both;padding:0;margin:0}#liens ul li{display:inline-block;height:4em;margin-left:.2em;margin-right:.2em;width:23%}#liens ul li a,#liens ul li span{width:100%;display:block;line-height:4em}.clear{clear:both}#content{line-height:4em;margin-left:auto;margin-right:auto;margin-top:0;position:relative;clear:both;width:52em}.encadre,.black,.red,.intro,.resume,.shadow{padding:2em;margin-top:2em;margin-bottom:2em}.encadre,.black,.red,.shadow{color:#002b36;border:#ccccd0 solid 1px;border-radius:5px;box-shadow:0 0 2px #ccccd0 inset;background-color:#eeeef1}.encadre a,.black a,.red a,.shadow a{color:#667}.encadre a:hover,.black a:hover,.red a:hover,.shadow a:hover{color:#cb4b16}.encadre a:hover strong,.encadre a:hover b,.encadre a:hover i,.encadre a:hover em,.encadre a:hover .nicer,.black a:hover strong,.black a:hover b,.black a:hover i,.black a:hover em,.black a:hover .nicer,.red a:hover strong,.red a:hover b,.red a:hover i,.red a:hover em,.red a:hover .nicer,.shadow a:hover strong,.shadow a:hover b,.shadow a:hover i,.shadow a:hover em,.shadow a:hover .nicer{color:#ffb17c}.encadre hr,.black hr,.red hr,.shadow hr{color:#667;border-top:1px solid#667}.encadre strong,.encadre b,.encadre i,.encadre em,.black strong,.black b,.black i,.black em,.red strong,.red b,.red i,.red em,.shadow strong,.shadow b,.shadow i,.shadow em{color:#002b36}pre .red{background:none;padding:0;margin:auto;border:none;box-shadow:none}.intro,.resume{font-size:.9em;font-style:italic;padding:.5em 1em;color:#556}.intro a:hover,.resume a:hover{color:#cb4b16}.intro i,.intro em,.resume i,.resume em{font-weight:400;font-style:normal;color:#002b36}.intro strong,.intro b,.resume strong,.resume b{font-weight:700;color:#002b36}#afterheader > h1{width:100%;padding-top:1.5em;text-align:left}#afterheader{padding-left:0;padding-right:0}#sousliens{margin-top:3em;margin-bottom:3em;font-size:1.2em;letter-spacing:1px;text-align:left;clear:both}.twilight{line-height:1.1em}.corps{font-size:1.25em;line-height:1.5em;text-align:justify;padding:3em 3em;margin:0;clear:both}.corps p,.corps ol,.corps ul,.corps blockquote,.corps pre,.corps code{margin-top:1.5em;margin-bottom:1.5em}.corps pre code{margin:0}.corps p,.corps ol,.corps ul,.corps blockquote{line-height:1.5em}.corps pre,.corps code{line-height:1em}.corps ul li ul,.corps ol li ul,.corps ul li ol,.corps ol li ol{margin-top:0;margin-bottom:0}.corps img{max-width:80%;border:1px solid #ccccd0;background-color:#fafafc;padding:.5em;box-shadow:0 10px 15px#ccc;border-radius:3px}.corps a:hover img{background-color:#dc3a05}figure{margin:3em 0}figure img{box-shadow:0 10px 15px#ccc inset}figure figcaption{text-align:center;margin:.5em 0}img.clean{border:none;background-color:none;box-shadow:none}#address{clear:both}.definitionCell{width:5em;vertical-align:top;text-align:center;font-weight:700}.valueCell{text-align:right}.smallblock{float:left;width:50%;font-size:1em;font-weight:700}.largeblock{float:right;width:70%;font-size:1em}#blackpage,#nojsredirect{top:0;left:0;width:100%;min-height:100%;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;text-align:center}#blackpage{color:#002b36;background-color:#fafafc;font-family:Georgia,serif;font-style:italic;padding-top:8em;z-index:9000;cursor:wait}#blackpage .corps code,#blackpage .corps pre{font-family:monospace}#blackpage img{background:none;border:none;max-width:80%;margin:0 auto}#blackpage a{cursor:pointer}#blackpage .preh1{font-size:1.5em;font-weight:700;margin-bottom:1em}#blackpage .preh2{font-size:1.2em;font-style:italic;margin-bottom:1em}#blackpage .preintro{text-align:left;width:52em;margin:0 auto}#nojsredirect{z-index:9001}.nojsbutton{width:50%;padding:1em;border:solid 3px white;margin-left:auto;margin-right:auto;margin-top:2em;z-index:9002}.codefile{font-size:.8em;text-align:right;padding-right:1em;margin-right:.1;margin-bottom:-1em}.flush{clear:both}table.description{border-spacing:5px;border-collapse:separate;margin-right:auto;margin-left:auto}table.description tr td{padding-left:.5em;padding-right:.5em;padding-top:.5ex;padding-bottom:.5ex;vertical-align:middle;margin-right:5px}ul.long li{margin-bottom:1em}img{display:block;margin:1.2em auto;background:none;border:none}img.left{float:left;max-width:30%;margin-top:.6em;margin-right:2em}img.inside{display:inline;vertical-align:middle}pre{overflow-x:auto;overflow-y:hidden}.navigationprev,.navigationnext{padding:0;margin-left:.2em;margin-right:.2em;margin-bottom:0;margin-top:3em;width:45%}.navigation .navigationprev,.navigation .navigationnext{width:30%;margin-top:0}.navigation{height:4em;border-bottom:#ccccd0 solid 1px}.presarticleleft,.presarticleright{font-size:1em}.navigationprev{float:left;text-align:left}.navigationnext{float:right;text-align:right}.impact,.darkimpact{text-align:left;width:66%;padding-left:.25em;padding-right:.25em}table.impact{text-align:left}table.impact tr td{padding-left:.25em;padding-right:.25em}#liens{font-size:1.2em}#iemessage{font-size:1.2em;color:#ccc;margin:-10px;padding:1px 0;background:#333}#iemessage strong,#iemessage b,#iemessage i,#iemessage em{color:#ccc}#iemessage a,#iemessage a:visited{color:#eca}.tagname{display:inline;cursor:pointer;margin-left:.5em;margin-right:.5em}.list{margin-top:3em}#menuMessage{font-size:1.2em;line-height:1.5em;width:100%;text-align:center}#next_before_articles{clear:both;width:100%;font-size:1.2em;padding-top:1em;padding-bottom:1em}#previous_articles,#next_articles{color:#889;font-size:.8em;font-style:italic}#previous_articles{float:left;margin-left:1em;width:45%;text-align:left}.previous_article,.next_article{margin-top:1em}#next_articles{float:right;width:45%;margin-right:1em;text-align:right}#rss{font-size:1.2em;text-align:center;display:block;width:100%;float:right;padding:1em .1em}.corps .return a{color:#eeeef1;padding:.1em;line-height:1.5em;font-size:1.5em;height:1.5em;float:left;font-size:2em;margin-top:-0.5em;margin-left:-2em;width:1.5em}a.return{color:#eeeef1;padding:.1em;line-height:1.5em;font-size:1.5em;height:1.5em;font-size:2em;width:1.5em;display:block}a.return:hover{color:#889}.corps .return a:hover{color:#cb4b16}.footnotes{font-size:.8em}.footnotes ol{color:#839496;font-weight:700}.footnotes ol p{color:#002b36;font-weight:400;font-style:normal}.fontnotes ol{margin-left:0}.typeset img{display:inline;border:none;margin:0;padding:0}strong,b,i,em{color:#889}strong a,b a,i a,em a{color:#002b36}strong a:hover,b a:hover,i a:hover,em a:hover{color:#cb4b16}.corps p strong,.corps p b,.corps p i,.corps p em{color:#556}a:hover strong,a:hover b,a:hover i,a:hover em{color:#dc5c27}a:hover .nicer{color:#ffb17c}.nicer{color:#ccccd0;font-family:"Lucida Grande",Tahoma}.block{border:solid 1px #ccccd0;border-radius:2px;box-shadow:0 0 4px #f2f2f4 inset;background-color:#f8f8fa;width:26.5%;padding:1em;border-radius:2px;text-align:left;line-height:1em;margin-left:1%;margin-right:1%;font-size:.8em;height:9em}.block a{color:#002b36}.block a:hover{color:#cb4b16}.block h3{margin:0;font-size:1.3em}.block p{line-height:1.2em}.left{float:left}.right{float:right}.corps p a,.corps ul a{color:#556}.corps p a:hover,.corps ul a:hover{color:#cb4b16}ul.bloglist,.archive ul{list-style-type:none;margin:0}ul.bloglist li,.archive ul li{margin-bottom:1em}.button{cursor:pointer;text-align:center}#tagcloud{font-size:.8em;background:#f2f2f4;box-shadow:0 0 6px #ccccd0;border-radius:3px;line-height:2.5em;padding:2em;text-align:justify}.pala{font-family:Palatino}sup{vertical-align:top;font-size:.7em}.article .corps a:after{content:"†";vertical-align:super;line-height:0;font-size:.66em;color:#889}.article .corps .footnotes a:after,.article .corps sup a:after{content:""}.article .corps sup a{font-weight:700;padding:0 .3em;margin-left:2px;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px}.article .corps sup a:hover{color:#cb4b16}ul#markdown-toc,.intro .toc ul{text-transform:uppercase;font-size:.8em;list-style:none;padding-left:1.5em}ul#markdown-toc a:after,.intro .toc ul a:after{content:""}ul#markdown-toc ul ul,.intro .toc ul ul ul{font-variant:normal;line-height:1em;font-size:1em;margin-bottom:1em}table{border:1px solid #ccccd0}table tr td{padding:2px .5em}table tr:nth-child(odd){background-color:#f2f2f4}table tr:nth-child(even){background-color:#fafafc}p pre code,ul li pre code,ol li pre code{background:none;border:none;padding:0}p code,ul li code,ol li code{background:#f0f0f2;border:solid 1px #ccccd0;padding:2px}ul.sameline{list-style:none}ul.sameline li{float:left;margin-left:.5em}.resumearticle{background-color:#f2f2f4;border-radius:7px;box-shadow:0 0 5px #c7c7b8 inset,0 0 5px white;margin:1em 0;padding:1em}a.cut{font-size:12px;text-align:right;display:block;width:100%;opacity:.5;border:1px solid #fafafc;border-radius:3px}a.cut:hover{opacity:1;background-color:#f2f2f4;border-color:#ccccd0;box-shadow:0 0 3px #ccccd0 inset}a.cut strong{font-weight:700}.codehighlight pre{border-left:4px solid #ccccd0}#social{text-align:left;opacity:.3}#social:hover{opacity:1}.popularblock{width:30.333%;margin:0 1.5%;float:left}.popularblock figure{margin:0}.popularblock figure img{max-width:80%;max-height:6em} \ No newline at end of file +@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:400;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:700}@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:400;font-style:normal}i,em{font-style:italic}b,strong,h1,h2,h3,h4,h5,h6{font-weight:700}table.description tr td{border:1px solid #eeeef1}.assombris20{background-color:#eeeef1}body{color:#002b36;background-color:#fafafc}::selection{background:#002b36;color:#93a1a1}::-moz-selection{background:#002b36;color:#93a1a1}pre,code,a.cut{font-family:Incosolata,Monaco,monospace}pre::selection{background:#fdf6e3;color:#586e75}pre *::selection{background:#fdf6e3;color:#586e75}pre::-moz-selection{background:#fdf6e3;color:#586e75}pre *::-moz-selection{background:#fdf6e3;color:#586e75}a:hover{text-shadow:0 0 2px#faa}a,a:link,a:visited,a:active,a:hover{text-decoration:none;outline:none}a,a:link,a:visited,a:active{color:#002b36}a:hover{color:#cb4b16}hr{color:#eeeef1;border-top:1px solid #eeeef1;border-bottom:none;border-left:none;border-right:none}ul{list-style:none}.corps ul li:before{content:"- "}ul{padding-left:0;margin-left:1.5ex;text-indent:-1.5ex}ol{padding-left:0}.toc ol li,.toc ul li{margin:.5em 0}ol li ul,ol li ol,ul li ol,ul li ul{margin:.5em 1.5em;list-style:none}body,h1,h2,h3,h4,#entete,.tagname{text-rendering:optimizelegibility;line-height:1.5em}body{font-family:Georgia,Palatino,"Century Schoolbook L","Times New Roman",Times,serif}.article #afterheader{counter-reset:niv02}.article #afterheader h2{counter-increment:niv02;counter-reset:niv03;marker-offset:3em}.article #afterheader h2:before{content:counter(niv02) ". "}.article #afterheader h3{counter-increment:niv03;counter-reset:niv04}.article #afterheader h3:before{content:counter(niv02) "." counter(niv03) ". "}.article #afterheader h4{counter-increment:niv04}.article #afterheader h4:before{content:counter(niv02) "." counter(niv03) "." counter(niv04) ". "}pre{background-color:#002b36;color:#839496;box-shadow:0 0 5px #d0d0d2 inset;border-radius:3px;padding:1em;line-height:1.1em;font-size:.9em}p{margin-bottom:1.2em}blockquote{border:solid 1px #ccccd0;border-radius:2px;box-shadow:0 0 4px #f2f2f4 inset;background-color:#f8f8fa;font-style:italic;padding:.5em 1em;color:#556}blockquote a:hover{color:#cb4b16}blockquote i,blockquote em{font-weight:400;font-style:normal;color:#002b36}blockquote strong,blockquote b{font-weight:700;color:#002b36}blockquote ul{padding-left:1.5em}abbr,acronym{text-transform:uppercase;font-size:.8em;text-decoration:none;border-bottom-width:0}#titre{letter-spacing:-0.06em;border-bottom:4px double #ccccd0;border-top:4px double #ccccd0}#liens .active,#sousliens{color:#002b36;border:#ccccd0 solid 1px;border-radius:5px;box-shadow:0 0 2px #ccccd0 inset;background-color:#eeeef1}#liens .active a,#sousliens a{color:#667}#liens .active a:hover,#sousliens a:hover{color:#cb4b16}#liens .active a:hover strong,#liens .active a:hover b,#liens .active a:hover i,#liens .active a:hover em,#liens .active a:hover .nicer,#sousliens a:hover strong,#sousliens a:hover b,#sousliens a:hover i,#sousliens a:hover em,#sousliens a:hover .nicer{color:#ffb17c}#liens .active hr,#sousliens hr{color:#667;border-top:1px solid#667}#liens .active strong,#liens .active b,#liens .active i,#liens .active em,#sousliens strong,#sousliens b,#sousliens i,#sousliens em{color:#002b36}#liens a{border:1px solid#eee;background:rgba(0,0,0,0.05);box-shadow:0 0 2px white,0 0 3px#ccc inset;border:1px solid rgba(0,0,0,0.1);border-radius:3px}#liens a:hover{background:rgba(0,0,0,0.1);box-shadow:0 0 6px#555 inset}#liens .active{text-shadow:0 0 2px rgba(0,0,0,0.5);background-color:#f7f7f9;border:1px solid #e9e9eb;box-shadow:0 0 3px #c7c7c9 inset;border-radius:3px;border-top:none}#lastmod{font-size:.9em}.nojsbutton{font-size:2.5em}#clickcomment,#choixlang > a,#choixrss > a,.return > a{display:block;width:25%;cursor:pointer;margin:1em 0;padding:1em;font-size:16px;line-height:1.4em;border:1px solid #fafafc;color:#ccccd0}#clickcomment:hover,#choixlang > a:hover,#choixrss > a:hover,.return > a:hover{border:solid 1px #ccccd0;border-radius:2px;box-shadow:0 0 4px #f2f2f4 inset;background-color:#f8f8fa;color:#dc5c27;text-shadow:0 0 2px#faa}#clickcomment:active,#choixlang > a:active,#choixrss > a:active,.return > a:active{border:solid 1px #ccccd0;border-radius:2px;box-shadow:0 0 4px #f2f2f4 inset;background-color:#f8f8fa;color:#dc5c27;text-shadow:0 0 2px#faa;background:#f4f4f6}.return > a,#choixrss > a{float:right}#choix .return > a,#choix #choixrss > a{margin-top:0}.small{font-size:.8em}.sc{text-transform:uppercase;font-size:.8em}.impact,.darkimpact{font-size:2em;margin:0 auto 1em auto;line-height:1.3em}h1 > .date{font-size:.6em;color:#002b36}.date{font-size:.8em;color:#fafafc;border:1px solid #002b36;text-align:center;width:4.1em;line-height:1.5em;display:inline-block;vertical-align:middle;margin-right:1em}.date .day,.date .month,.date .year{display:block}.date .day{color:#002b36;background-color:#fafafc;float:left;width:1.7em}.date .month{float:right;width:2.3em;background-color:#002b36;color:#fafafc}.date .year{line-height:3ex;clear:both;color:#002b36;border:#ccccd0 solid 1px;border-radius:5px;box-shadow:0 0 2px #ccccd0 inset;background-color:#eeeef1;border-radius:0}.date .year a{color:#667}.date .year a:hover{color:#cb4b16}.date .year a:hover strong,.date .year a:hover b,.date .year a:hover i,.date .year a:hover em,.date .year a:hover .nicer{color:#ffb17c}.date .year hr{color:#667;border-top:1px solid#667}.date .year strong,.date .year b,.date .year i,.date .year em{color:#002b36}body{text-align:center;font-size:16px}body > #entete{position:absolute;left:0;top:.5em;width:100%;min-width:45em;z-index:8000;padding-bottom:1em;margin-bottom:3em}#titre h2{width:80%;margin-left:auto;margin-right:auto;text-align:center;color:#ccccd0}#titre{text-align:center;width:100%}#titre h1,#titre h2{padding-left:1em;padding-right:1em}#bottom{clear:right;margin-right:0;padding:1.5em;line-height:1.5em;color:#224d58;margin-top:2em;text-align:center}#bottom a{color:#113c47}#bottom a:hover{color:#cb4b16}#sousliens{padding:1em 0;line-height:2em}#sousliens ul{list-style:none;margin-left:4em}ul.horizontal li{display:inline;font-size:.9em}ul.horizontal{margin-top:0;margin-bottom:0}#entete{padding-top:.1em;border-top:1px solid #ccccd0;border-bottom:1px solid #ccccd0}#liens{width:100%;padding:0;clear:both;margin-top:.5em}#liens ul{width:100%;clear:both;padding:0;margin:0}#liens ul li{display:inline-block;height:4em;margin-left:.2em;margin-right:.2em;width:23%}#liens ul li a,#liens ul li span{width:100%;display:block;line-height:4em}.clear{clear:both}#content{line-height:4em;margin-left:auto;margin-right:auto;margin-top:0;position:relative;clear:both;width:47em}.encadre,.black,.intro,.resume,.shadow{padding:2em;margin-top:2em;margin-bottom:2em}.encadre,.black,.shadow{color:#002b36;border:#ccccd0 solid 1px;border-radius:5px;box-shadow:0 0 2px #ccccd0 inset;background-color:#eeeef1}.encadre a,.black a,.shadow a{color:#667}.encadre a:hover,.black a:hover,.shadow a:hover{color:#cb4b16}.encadre a:hover strong,.encadre a:hover b,.encadre a:hover i,.encadre a:hover em,.encadre a:hover .nicer,.black a:hover strong,.black a:hover b,.black a:hover i,.black a:hover em,.black a:hover .nicer,.shadow a:hover strong,.shadow a:hover b,.shadow a:hover i,.shadow a:hover em,.shadow a:hover .nicer{color:#ffb17c}.encadre hr,.black hr,.shadow hr{color:#667;border-top:1px solid#667}.encadre strong,.encadre b,.encadre i,.encadre em,.black strong,.black b,.black i,.black em,.shadow strong,.shadow b,.shadow i,.shadow em{color:#002b36}.intro,.resume{font-size:.9em;font-style:italic;padding:.5em 1em;color:#556}.intro a:hover,.resume a:hover{color:#cb4b16}.intro i,.intro em,.resume i,.resume em{font-weight:400;font-style:normal;color:#002b36}.intro strong,.intro b,.resume strong,.resume b{font-weight:700;color:#002b36}#afterheader > h1{width:100%;padding-top:1.5em;text-align:left}#afterheader{padding-left:0;padding-right:0}#sousliens{margin-top:3em;margin-bottom:3em;font-size:1.2em;letter-spacing:1px;text-align:left;clear:both}.twilight{line-height:1.1em}.corps{font-size:1.25em;line-height:1.5em;text-align:justify;padding:3em 3em;margin:0;clear:both}.corps p,.corps ol,.corps ul,.corps blockquote,.corps pre,.corps code{margin-top:1.5em;margin-bottom:1.5em}.corps pre code{margin:0}.corps p,.corps ol,.corps ul,.corps blockquote{line-height:1.5em}.corps ul li ul,.corps ol li ul,.corps ul li ol,.corps ol li ol{margin-top:0;margin-bottom:0}.corps img{max-width:80%;border:1px solid #ccccd0;background-color:#fafafc;padding:.5em;box-shadow:0 10px 15px#ccc;border-radius:3px}.corps a:hover img{background-color:#dc3a05}figure{margin:3em 0}figure img{box-shadow:0 10px 15px#ccc inset}figure figcaption{text-align:center;margin:.5em 0}figure.left,figure.right{max-width:30%}img.clean{border:none;background-color:none;box-shadow:none}#address{clear:both}.definitionCell{width:5em;vertical-align:top;text-align:center;font-weight:700}.valueCell{text-align:right}.smallblock{float:left;width:50%;font-size:1em;font-weight:700}.largeblock{float:right;width:70%;font-size:1em}#blackpage,#nojsredirect{top:0;left:0;width:100%;min-height:100%;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;text-align:center}#blackpage{color:#002b36;background-color:#fafafc;font-family:Georgia,serif;font-style:italic;padding-top:8em;z-index:9000;cursor:wait}#blackpage .corps code,#blackpage .corps pre{font-family:monospace}#blackpage img{background:none;border:none;max-width:80%;margin:0 auto}#blackpage a{cursor:pointer}#blackpage .preh1{font-size:1.5em;font-weight:700;margin-bottom:1em}#blackpage .preh2{font-size:1.2em;font-style:italic;margin-bottom:1em}#blackpage .preintro{text-align:left;width:47em;margin:0 auto}#nojsredirect{z-index:9001}.nojsbutton{width:50%;padding:1em;border:solid 3px white;margin-left:auto;margin-right:auto;margin-top:2em;z-index:9002}.codefile{font-size:.8em;text-align:right;padding-right:1em;margin-right:.1;margin-bottom:-1em}.flush{clear:both}table.description{border-spacing:5px;border-collapse:separate;margin-right:auto;margin-left:auto}table.description tr td{padding-left:.5em;padding-right:.5em;padding-top:.5ex;padding-bottom:.5ex;vertical-align:middle;margin-right:5px}ul.long li{margin-bottom:1em}img{display:block;margin:1.2em auto;background:none;border:none}img.right{max-width:30%;margin-top:.6em;margin-left:2em}img.left{float:left;max-width:30%;margin-top:.6em;margin-right:2em}img.inside{display:inline;vertical-align:middle}pre{overflow-x:auto;overflow-y:hidden}.navigationprev,.navigationnext{padding:0;margin-left:.2em;margin-right:.2em;margin-bottom:0;margin-top:3em;width:45%}.navigation .navigationprev,.navigation .navigationnext{width:30%;margin-top:0}.navigation{height:4em;border-bottom:#ccccd0 solid 1px}.presarticleleft,.presarticleright{font-size:1em}.navigationprev{float:left;text-align:left}.navigationnext{float:right;text-align:right}.impact,.darkimpact{text-align:left;width:66%;padding-left:.25em;padding-right:.25em}table.impact{text-align:left}table.impact tr td{padding-left:.25em;padding-right:.25em}#liens{font-size:1.2em}#iemessage{font-size:1.2em;color:#ccc;margin:-10px;padding:1px 0;background:#333}#iemessage strong,#iemessage b,#iemessage i,#iemessage em{color:#ccc}#iemessage a,#iemessage a:visited{color:#eca}.tagname{display:inline;cursor:pointer;margin-left:.5em;margin-right:.5em}.list{margin-top:3em}#menuMessage{font-size:1.2em;line-height:1.5em;width:100%;text-align:center}#next_before_articles{clear:both;width:100%;font-size:1.2em;padding-top:1em;padding-bottom:1em}#previous_articles,#next_articles{color:#889;font-size:.8em;font-style:italic}#previous_articles{float:left;margin-left:1em;width:45%;text-align:left}.previous_article,.next_article{margin-top:1em}#next_articles{float:right;width:45%;margin-right:1em;text-align:right}#rss{font-size:1.2em;text-align:center;display:block;width:100%;float:right;padding:1em .1em}.corps .return a{color:#eeeef1;padding:.1em;line-height:1.5em;font-size:1.5em;height:1.5em;float:left;font-size:2em;margin-top:-0.5em;margin-left:-2em;width:1.5em}a.return{color:#eeeef1;padding:.1em;line-height:1.5em;font-size:1.5em;height:1.5em;font-size:2em;width:1.5em;display:block}a.return:hover{color:#889}.corps .return a:hover{color:#cb4b16}.footnotes{font-size:.8em}.footnotes ol{color:#839496;font-weight:700}.footnotes ol p{color:#002b36;font-weight:400;font-style:normal}.fontnotes ol{margin-left:0}.typeset img{display:inline;border:none;margin:0;padding:0}strong,b,i,em{color:#889}strong a,b a,i a,em a{color:#002b36}strong a:hover,b a:hover,i a:hover,em a:hover{color:#cb4b16}.corps p strong,.corps p b,.corps p i,.corps p em{color:#556}a:hover strong,a:hover b,a:hover i,a:hover em{color:#dc5c27}a:hover .nicer{color:#ffb17c}.nicer{color:#ccccd0;font-family:"Lucida Grande",Tahoma}.block{border:solid 1px #ccccd0;border-radius:2px;box-shadow:0 0 4px #f2f2f4 inset;background-color:#f8f8fa;width:26.5%;padding:1em;border-radius:2px;text-align:left;line-height:1em;margin-left:1%;margin-right:1%;font-size:.8em;height:9em}.block a{color:#002b36}.block a:hover{color:#cb4b16}.block h3{margin:0;font-size:1.3em}.block p{line-height:1.2em}.left{float:left}.right{float:right}.corps p a,.corps ul a{color:#556}.corps p a:hover,.corps ul a:hover{color:#cb4b16}ul.bloglist,.archive ul{list-style-type:none;margin:0}ul.bloglist li,.archive ul li{margin-bottom:1em}.button{cursor:pointer;text-align:center}#tagcloud{font-size:.8em;background:#f2f2f4;box-shadow:0 0 6px #ccccd0;border-radius:3px;line-height:2.5em;padding:2em;text-align:justify}.pala{font-family:Palatino}sup{vertical-align:top;font-size:.7em}.article .corps a:after{content:"†";vertical-align:super;line-height:0;font-size:.66em;color:#889}.article .corps .footnotes a:after,.article .corps sup a:after{content:""}.article .corps sup a{font-weight:700;padding:0 .3em;margin-left:2px;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px}.article .corps sup a:hover{color:#cb4b16}ul#markdown-toc,.intro .toc ul{text-transform:uppercase;font-size:.8em;list-style:none;padding-left:1.5em}ul#markdown-toc a:after,.intro .toc ul a:after{content:""}ul#markdown-toc ul ul,.intro .toc ul ul ul{font-variant:normal;line-height:1em;font-size:1em;margin-bottom:1em}table{border:1px solid #ccccd0}table tr td{padding:2px .5em}table tr:nth-child(odd){background-color:#f2f2f4}table tr:nth-child(even){background-color:#fafafc}p pre code,ul li pre code,ol li pre code{background:none;border:none;padding:0}p code,ul li code,ol li code{background:#f0f0f2;border:solid 1px #ccccd0;padding:2px}ul.sameline{list-style:none}ul.sameline li{float:left;margin-left:.5em}.resumearticle{background-color:#f2f2f4;border-radius:7px;box-shadow:0 0 5px #c7c7b8 inset,0 0 5px white;margin:1em 0;padding:1em}a.cut{font-size:12px;text-align:right;display:block;width:100%;opacity:.5;border:1px solid #fafafc;border-radius:3px}a.cut:hover{opacity:1;background-color:#f2f2f4;border-color:#ccccd0;box-shadow:0 0 3px #ccccd0 inset}a.cut strong{font-weight:700}.codehighlight pre{border-left:4px solid #ccccd0}#social{text-align:left;opacity:.3}#social:hover{opacity:1}.popularblock{width:30.3333%;margin:0 1.5%;float:left}.popularblock figure{margin:0}.popularblock figure img{max-width:80%;max-height:6em}section.slide{border-color:#ccccd0;border:solid 1px;margin-bottom:1em;padding:.5em;font-family:sans-serif;font-size:.8em}.base03{color:#002b36}.base02{color:#073642}.base01{color:#586e75}.base00{color:#657b83}.base0{color:#839496}.base1{color:#93a1a1}.base2{color:#eee8d5}.base3{color:#fdf6e3}.yellow{color:#b58900}.orange{color:#cb4b16}.red{color:#dc322f}.magenta{color:#d33682}.violet{color:#6c71c4}.blue{color:#268bd2}.cyan{color:#2aa198}.green{color:#859900} \ No newline at end of file diff --git a/output/Scratch/css/solarized.css b/output/Scratch/css/solarized.css index 9b7885a79..973ffa46b 100644 --- a/output/Scratch/css/solarized.css +++ b/output/Scratch/css/solarized.css @@ -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 */ - +pre { + display: block; } pre code { - display: block; - /* background: #002b36; */ + /* background: #002b36; */ color: #657b83; background-color: #f3f4f5; } diff --git a/output/Scratch/css/solarized_striped.css b/output/Scratch/css/solarized_striped.css new file mode 100644 index 000000000..0e107e3cf --- /dev/null +++ b/output/Scratch/css/solarized_striped.css @@ -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 + +*/ +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; +} diff --git a/output/Scratch/css/windows.css b/output/Scratch/css/windows.css index e7e3d2bb5..974569f3d 100644 --- a/output/Scratch/css/windows.css +++ b/output/Scratch/css/windows.css @@ -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; } diff --git a/output/Scratch/en/blog/2010-05-24-Trees--Pragmatism-and-Formalism/graph/The_destination_tree.png b/output/Scratch/en/blog/2010-05-24-Trees--Pragmatism-and-Formalism/graph/The_destination_tree.png index 2fbf4551c..161aad593 100644 Binary files a/output/Scratch/en/blog/2010-05-24-Trees--Pragmatism-and-Formalism/graph/The_destination_tree.png and b/output/Scratch/en/blog/2010-05-24-Trees--Pragmatism-and-Formalism/graph/The_destination_tree.png differ diff --git a/output/Scratch/en/blog/2010-05-24-Trees--Pragmatism-and-Formalism/graph/The_source_tree.png b/output/Scratch/en/blog/2010-05-24-Trees--Pragmatism-and-Formalism/graph/The_source_tree.png index 33cb61405..8b8ece0e1 100644 Binary files a/output/Scratch/en/blog/2010-05-24-Trees--Pragmatism-and-Formalism/graph/The_source_tree.png and b/output/Scratch/en/blog/2010-05-24-Trees--Pragmatism-and-Formalism/graph/The_source_tree.png differ diff --git a/output/Scratch/en/blog/Haskell-OpenGL-Mandelbrot/index.html b/output/Scratch/en/blog/Haskell-OpenGL-Mandelbrot/index.html index 3356207f9..f8432e3ec 100644 --- a/output/Scratch/en/blog/Haskell-OpenGL-Mandelbrot/index.html +++ b/output/Scratch/en/blog/Haskell-OpenGL-Mandelbrot/index.html @@ -10,12 +10,7 @@ - - - - - - + @@ -23,7 +18,7 @@ @@ -72,7 +67,7 @@ Imperative language could also benefit from this functional organization.

  • Introduction
  • First version
  • @@ -157,7 +152,7 @@ We start cleaning the code at the 5th section.

    The first being mostly some boilerplate2. And the second part more focused on OpenGL and content.

    -

    Let’s play the song of our people

    +

    Let’s play the song of our people

    @@ -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 allPoints is a pure list. Therefore, calling allPoints will always render the same result and Haskell is clever enough to use this property. -While Haskell doesn’t garbage collect allPoints the result is reused for free. +While Haskell doesn’t garbage collect allPoints the result is reused for free. We did not specified this value should be saved for later use. It is saved for us.

    @@ -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.

    -

    This section is quite long, but don’t be afraid, +

    This section is quite long, but don’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:

    @@ -647,7 +642,7 @@ here is a high level representation:

    Drawing:

      -
    • set doubleBuffer, handle depth, window size…
    • +
    • set doubleBuffer, handle depth, window size…
    • Use state to apply some transformations
    @@ -903,7 +898,7 @@ Mainly there are two parts: apply some transformations, draw the object.

    The 3D Mandelbrot

    -

    We have finished with the OpenGL section, let’s talk about how we +

    We have finished with the OpenGL section, let’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.

    @@ -1017,7 +1012,7 @@ depthPoints = do

    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.

    -

    Also, we didn’t searched for negative values. +

    Also, we didn’t searched for negative values. This modified Mandelbrot is no more symmetric relatively to the plan y=0. But it is symmetric relatively to the plan z=0. Then I mirror these values.

    @@ -1242,7 +1237,7 @@ ymandel x y z = mandel (2*x/width) (2*y/height) (2*z/deep) 64
    -

    This code is cleaner but many things doesn’t feel right. +

    This code is cleaner but many things doesn’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.

    @@ -1276,12 +1271,12 @@ We will have two choices:

  • Our main problem come from user interaction. -If you ask “the Internet”, +If you ask “the Internet”, about how to deal with user interaction with a functional paradigm, the main answer is to use functional reactive programming (FRP). -I won’t use FRP in this article. -Instead, I’ll use a simpler while less effective way to deal with user interaction. -But The method I’ll use will be as pure and functional as possible.

    +I won’t use FRP in this article. +Instead, I’ll use a simpler while less effective way to deal with user interaction. +But The method I’ll use will be as pure and functional as possible.

  • @@ -1303,7 +1298,7 @@ First, what the main loop should look like if we could make our own:

  • a function taking two parameters: time and world state and render a new world without user interaction.
-

Here is a real working code, I’ve hidden most display functions. +

Here is a real working code, I’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.

@@ -1523,7 +1518,7 @@ idleAction tnew world = world {

Now the function which will generate points in 3D. The first parameter (res) is the resolution of the vertex generation. More precisely, res is distance between two points on one direction. -We need it to “close” our shape.

+We need it to “close” our shape.

The type Function3D is Point -> Point -> Maybe Point. Because we consider partial functions @@ -1592,7 +1587,7 @@ ymandel x y z = fromIntegral (mandel x y z 64) / 64

-

I won’t explain how the magic occurs here. +

I won’t explain how the magic occurs here. If you are interested, just read the file YGL.hs. It is commented a lot.

@@ -1612,8 +1607,8 @@ It is commented a lot.

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 YGL.hs, you’ll see I didn’t made everything perfect. -For example, I didn’t finished the code of the lights. +If you read the code of YGL.hs, you’ll see I didn’t made everything perfect. +For example, I didn’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.

@@ -1897,20 +1892,20 @@ ymandel x y z = fromIntegral (mandel x y z 64) / 64

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. -I’d like to stress the usage of Haskell made it very simple to achieve this.

+I’d like to stress the usage of Haskell made it very simple to achieve this.

Once you are used to pure functional style, it is hard not to see all advantages it offers.

The code in the two last sections is completely pure and functional. -Furthermore I don’t use GLfloat, Color3 or any other OpenGL type. +Furthermore I don’t use GLfloat, Color3 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.

-

The YGL module can be seen as a “wrapper” around 3D display and user interaction. +

The YGL module can be seen as a “wrapper” around 3D display and user interaction. It is a clean separator between the imperative paradigm and functional paradigm.

-

If you want to go further, it shouldn’t be hard to add parallelism. +

If you want to go further, it shouldn’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.

@@ -1920,7 +1915,7 @@ O(n².log(n)) to O(n³).


  1. -

    Unfortunately, I couldn’t make this program to work on my Mac. More precisely, I couldn’t make the DevIL library work on Mac to output the image. Yes I have done a brew install libdevil. But even a minimal program who simply write some jpg didn’t worked. I tried both with Haskell and C.

    +

    Unfortunately, I couldn’t make this program to work on my Mac. More precisely, I couldn’t make the DevIL library work on Mac to output the image. Yes I have done a brew install libdevil. But even a minimal program who simply write some jpg didn’t worked. I tried both with Haskell and C.

  2. Generally in Haskell you need to declare a lot of import lines. @@ -1961,34 +1956,26 @@ O(n².log(n)) to O(n³).

    Subscribe
-

comments

- - - - - - -
+ +
+ + + comments powered by Disqus +
@@ -2023,7 +2010,7 @@ O(n².log(n)) to O(n³).

next entries @@ -2057,4 +2044,10 @@ O(n².log(n)) to O(n³).

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

tlàl : Un exemple progressif d’utilisation d’Haskell. +

tlàl : Un exemple progressif d’utilisation d’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

  • Introduction
  • First version
  • @@ -157,7 +152,7 @@ We start cleaning the code at the 5th section.

    The first being mostly some boilerplate2. And the second part more focused on OpenGL and content.

    -

    Let’s play the song of our people

    +

    Let’s play the song of our people

    @@ -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 allPoints is a pure list. Therefore, calling allPoints will always render the same result and Haskell is clever enough to use this property. -While Haskell doesn’t garbage collect allPoints the result is reused for free. +While Haskell doesn’t garbage collect allPoints the result is reused for free. We did not specified this value should be saved for later use. It is saved for us.

    @@ -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.

    -

    This section is quite long, but don’t be afraid, +

    This section is quite long, but don’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:

    @@ -647,7 +642,7 @@ here is a high level representation:

    Drawing:

      -
    • set doubleBuffer, handle depth, window size…
    • +
    • set doubleBuffer, handle depth, window size…
    • Use state to apply some transformations
    @@ -903,7 +898,7 @@ Mainly there are two parts: apply some transformations, draw the object.

    The 3D Mandelbrot

    -

    We have finished with the OpenGL section, let’s talk about how we +

    We have finished with the OpenGL section, let’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.

    @@ -1017,7 +1012,7 @@ depthPoints = do

    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.

    -

    Also, we didn’t searched for negative values. +

    Also, we didn’t searched for negative values. This modified Mandelbrot is no more symmetric relatively to the plan y=0. But it is symmetric relatively to the plan z=0. Then I mirror these values.

    @@ -1242,7 +1237,7 @@ ymandel x y z = mandel (2*x/width) (2*y/height) (2*z/deep) 64
    -

    This code is cleaner but many things doesn’t feel right. +

    This code is cleaner but many things doesn’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.

    @@ -1276,12 +1271,12 @@ We will have two choices:

  • Our main problem come from user interaction. -If you ask “the Internet”, +If you ask “the Internet”, about how to deal with user interaction with a functional paradigm, the main answer is to use functional reactive programming (FRP). -I won’t use FRP in this article. -Instead, I’ll use a simpler while less effective way to deal with user interaction. -But The method I’ll use will be as pure and functional as possible.

    +I won’t use FRP in this article. +Instead, I’ll use a simpler while less effective way to deal with user interaction. +But The method I’ll use will be as pure and functional as possible.

  • @@ -1303,7 +1298,7 @@ First, what the main loop should look like if we could make our own:

  • a function taking two parameters: time and world state and render a new world without user interaction.
-

Here is a real working code, I’ve hidden most display functions. +

Here is a real working code, I’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.

@@ -1523,7 +1518,7 @@ idleAction tnew world = world {

Now the function which will generate points in 3D. The first parameter (res) is the resolution of the vertex generation. More precisely, res is distance between two points on one direction. -We need it to “close” our shape.

+We need it to “close” our shape.

The type Function3D is Point -> Point -> Maybe Point. Because we consider partial functions @@ -1592,7 +1587,7 @@ ymandel x y z = fromIntegral (mandel x y z 64) / 64

-

I won’t explain how the magic occurs here. +

I won’t explain how the magic occurs here. If you are interested, just read the file YGL.hs. It is commented a lot.

@@ -1612,8 +1607,8 @@ It is commented a lot.

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 YGL.hs, you’ll see I didn’t made everything perfect. -For example, I didn’t finished the code of the lights. +If you read the code of YGL.hs, you’ll see I didn’t made everything perfect. +For example, I didn’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.

@@ -1897,20 +1892,20 @@ ymandel x y z = fromIntegral (mandel x y z 64) / 64

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. -I’d like to stress the usage of Haskell made it very simple to achieve this.

+I’d like to stress the usage of Haskell made it very simple to achieve this.

Once you are used to pure functional style, it is hard not to see all advantages it offers.

The code in the two last sections is completely pure and functional. -Furthermore I don’t use GLfloat, Color3 or any other OpenGL type. +Furthermore I don’t use GLfloat, Color3 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.

-

The YGL module can be seen as a “wrapper” around 3D display and user interaction. +

The YGL module can be seen as a “wrapper” around 3D display and user interaction. It is a clean separator between the imperative paradigm and functional paradigm.

-

If you want to go further, it shouldn’t be hard to add parallelism. +

If you want to go further, it shouldn’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.

@@ -1920,7 +1915,7 @@ O(n².log(n)) to O(n³).


  1. -

    Unfortunately, I couldn’t make this program to work on my Mac. More precisely, I couldn’t make the DevIL library work on Mac to output the image. Yes I have done a brew install libdevil. But even a minimal program who simply write some jpg didn’t worked. I tried both with Haskell and C.

    +

    Unfortunately, I couldn’t make this program to work on my Mac. More precisely, I couldn’t make the DevIL library work on Mac to output the image. Yes I have done a brew install libdevil. But even a minimal program who simply write some jpg didn’t worked. I tried both with Haskell and C.

  2. Generally in Haskell you need to declare a lot of import lines. @@ -1961,34 +1956,26 @@ O(n².log(n)) to O(n³).

    s'abonner
-

commentaires

- - - - - - -
+ +
+ + + comments powered by Disqus +
@@ -2023,7 +2010,7 @@ O(n².log(n)) to O(n³).

articles suivants @@ -2057,4 +2044,10 @@ O(n².log(n)) to O(n³).

+ + + + + + \ No newline at end of file diff --git a/output/Scratch/fr/blog/feed/feed.xml b/output/Scratch/fr/blog/feed/feed.xml index a07580848..c3088ce01 100644 --- a/output/Scratch/fr/blog/feed/feed.xml +++ b/output/Scratch/fr/blog/feed/feed.xml @@ -2,7 +2,7 @@ http://yannesposito.com/ Yogsototh's last blogs entries - 2012-10-01T17:16:43Z + 2012-12-12T08:06:40Z @@ -10,42 +10,31 @@ http://yannesposito.com - tag:yannesposito.com,2012-10-01:/Scratch/fr/blog/Category-Theory-Programming/ - Programmation en Théorie des Catégories - 2012-10-01T17:16:43Z - 2012-10-01T17:16:43Z + tag:yannesposito.com,2012-12-12:/Scratch/fr/blog/Category-Theory-Presentation/ + Category Theory Presentation + 2012-12-12T08:06:40Z + 2012-12-12T08:06:40Z Yann Esposito yannesposito.com - - -<div class="intro"> + + <img src="/keynote/categories/img/mp/cat-hask-endofunctor.png" alt="Cateogry of Hask's endofunctors"/> +<p>Yesterday I was happy to make a presentation about Category Theory at <a href="http://www.meetup.com/riviera-scala-clojure">Riviera Scala Clojure Meetup</a> (note I used only Haskell for my examples).</p> -<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span> Comment programmer en utilisant la théorie des catégories.</p> +<ul><li><a href="/keynote/categories.html">Click here to go to the HTML presentation.</a> +</li><li><a href="/keynote/categories.pdf">Click Here to download the PDF slides (%latex not rendered properly)</a> +</li></ul> -<blockquote> - <center><hr style="width:30%;float:left;border-color:#CCCCD0;margin-top:1em" /><span class="sc"><b>Table of Content</b></span><hr style="width:30%;float:right;border-color:#CCCCD0;margin-top:1em" /></center> +<p>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. +</p> -<ul id="markdown-toc"> - <li><a href="#introduction">Introduction</a> <ul> - <li><a href="#programming-paradigms">Programming Paradigms</a></li> - </ul> - </li> - <li><a href="#get-some-intuition">Get some intuition</a> <ul> - <li><a href="#representation-of-category">Representation of Category</a></li> - </ul> - </li> -</ul> - -</blockquote> - - -</div> - - -<h2 id="introduction">Introduction</h2></blockquote></div> +<div style="display:none"> +\(\newcommand{\F}{\mathbf{F}}\) +\(\newcommand{\E}{\mathbf{E}}\) +\(\newcommand{\C}{\mathc...</div></img> tag:yannesposito.com,2012-06-15:/Scratch/fr/blog/Haskell-OpenGL-Mandelbrot/ @@ -57,21 +46,21 @@ yannesposito.com - <p><img alt="The B in Benoît B. Mandelbrot stand for Benoît B. Mandelbrot" src="/Scratch/img/blog/Haskell-OpenGL-Mandelbrot/BenoitBMandelbrot.jpg" /></p> + <p><img alt="The B in Benoît B. Mandelbrot stand for Benoît B. Mandelbrot" src="/Scratch/img/blog/Haskell-OpenGL-Mandelbrot/BenoitBMandelbrot.jpg" /></p> <div class="intro"> -<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span> Un exemple progressif d’utilisation d’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. -Le code descriptif intéressant est concentré dans un environnement pur et fonctionnel. +<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. +Le code descriptif intéressant est concentré dans un environnement pur et fonctionnel. Vous pouvez vous inspirer de ce code utilisant le paradigme fonctional dans tous les languages.</p> <blockquote> - <center><hr style="width:30%;float:left;border-color:#CCCCD0;margin-top:1em" /><span class="sc"><b>Table of Content</b></span></hr></center></blockquote></div></p> + <center><hr style="width:30%;float:left;border-color:#CCCCD0;margin-top:1em" /><span class="sc"></span></hr></center></blockquote></div></p> tag:yannesposito.com,2012-02-08:/Scratch/fr/blog/Haskell-the-Hard-Way/ @@ -89,12 +78,12 @@ Vous pouvez vous inspirer de ce code utilisant le paradigme fonctional dans tous <div class="intro"> -<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span> Un tutoriel très court mais très dense pour apprendre Haskell.</p> +<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span> Un tutoriel très court mais très dense pour apprendre Haskell.</p> -<p>Merci à <a href="https://plus.google.com/u/0/113751420744109290534">Oleg Taykalo</a> vous pouvez trouver une traduction Russe ici: <a href="http://habrahabr.ru/post/152889/">Partie 1</a> <em class="pala">&amp;</em> <a href="http://habrahabr.ru/post/153383/">Partie 2</a>&nbsp;; </p> +<p>Merci à <a href="https://plus.google.com/u/0/113751420744109290534">Oleg Taykalo</a> vous pouvez trouver une traduction Russe ici: <a href="http://habrahabr.ru/post/152889/">Partie 1</a> <em class="pala">&amp;</em> <a href="http://habrahabr.ru/post/153383/">Partie 2</a>&nbsp;; </p> <blockquote> - <center><hr style="width:30%;float:left;border-color:#CCCCD0;margin-top:1em" /><span class="sc"><b>Table of Content</b></span><hr style="width:30%;float:right;border-color:#CCCCD0;margin-top:1em" /></hr></hr></center></blockquote></div></p> + <center><hr style="width:30%;float:left;border-color:#CCCCD0;margin-top:1em" /><span class="sc"><b>Table of Content</b></span></hr></center></blockquote></div></p> tag:yannesposito.com,2012-02-02:/Scratch/fr/blog/Typography-and-the-Web/ @@ -112,24 +101,24 @@ Vous pouvez vous inspirer de ce code utilisant le paradigme fonctional dans tous <div class="intro"> -<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span> La typography sur le web est pourrie et nous ne somme pas près de voir ce problème réparé.</p> +<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span> La typography sur le web est pourrie et nous ne somme pas près de voir ce problème réparé.</p> </div> -<p>Je suis tombé sur ce site: <a href="http://opentypography.org/">open typography</a>. Leur message principal est&nbsp;:</p> +<p>Je suis tombé sur ce site: <a href="http://opentypography.org/">open typography</a>. Leur message principal est&nbsp;:</p> <blockquote> - <p>«There is no reason to wait for browser development to catch up. -We can all create better web typography ourselves, today.»</p> + <p>«There is no reason to wait for browser development to catch up. +We can all create better web typography ourselves, today.»</p> </blockquote> -<p>ou en français&nbsp;:</p> +<p>ou en français&nbsp;:</p> <blockquote> - <p>«Nous ne somme pas obligé d’attendre le développement des navigateurs. -Nous pouvons créer un web av...</p></blockquote></p> + <p>«Nous ne somme pas obligé d&rsquo;attendre le développement des navigateurs. +Nous pouv...</p></blockquote></p> tag:yannesposito.com,2012-01-15:/Scratch/fr/blog/Yesod-tutorial-for-newbies/ @@ -147,12 +136,12 @@ Nous pouvons créer un web av...</p></blockquote></p> + <li><a href="#initialize">In...</a></li></ul></li></ul></blockquote></div></p> tag:yannesposito.com,2011-10-20:/Scratch/fr/blog/SVG-and-m4-fractals/ - Accroître le pouvoir des languages déficients. + Accroître le pouvoir des languages déficients. 2011-10-20T09:39:36Z 2011-10-20T09:39:36Z @@ -178,21 +167,21 @@ mais je n’ai pas eu le courage de traduire cet article en Français.</p> <div class="intro"> -<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span> Utiliser m4 pour accroître le pouvoir d’<span class="sc">xslt</span> et d’<span class="sc">svg</span>. Example cool, les fractales.</p> +<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span> Utiliser m4 pour accroître le pouvoir d&rsquo;<span class="sc">xslt</span> et d&rsquo;<span class="sc">svg</span>. Example cool, les fractales.</p> </div> -<p>Lorsqu’<span class="sc">xml</span> fût inventé beaucoup pensaient que c’était l’avenir. -Passer de fichiers plat à des fichiers structurés standardisés fût un grand progrès dans beaucoup de domaines. -Cerain se mirent à voir du <span class="sc">xml</span> de partout. -À tel point que les les format compatibles <span class="sc">xml</span> naquirent de toute part. -Non seulement comme format de fichier, mais aussi comme format pour un langage ...</p></p> +<p>Lorsqu&rsquo;<span class="sc">xml</span> fût inventé beaucoup pensaient que c&rsquo;était l&rsquo;avenir. +Passer de fichiers plat à des fichiers structurés standardisés fût un grand progrès dans beaucoup de domaines. +Cerain se mirent à voir du <span class="sc">xml</span> de partout. +À tel point que les les format compatibles <span class="sc">xml</span> naquirent de toute part. +Non seulement comme format de fichie...</p></p> tag:yannesposito.com,2011-10-04:/Scratch/fr/blog/Yesod-excellent-ideas/ - Les idées de yesod + Les idées de yesod 2011-10-04T08:18:59Z 2011-10-04T08:18:59Z @@ -206,11 +195,11 @@ Non seulement comme format de fichier, mais aussi comme format pour un langage . <div class="intro"> -<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span></p> +<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span></p> <p>Cela fait un moment que je suis la progression du <a href="http://www.yesodweb.com">framework yesod</a>. -À mon humble avis on peut commencer à l’utiliser pour des applications sérieuses (comprendre en prod). -Avant de vous dire pourquoi vous devriez aussi le considérer, je préfère vous parler de bonnes idées (parmi d’autres) introduites par yesod que je n’avais jamais vu ailleurs.</p> +À mon humble avis on peut commencer à l&rsquo;utiliser pour des applications sérieuses (comprendre en prod). +Avant de vous dire pourquoi vous devriez aussi le considérer, je préfère vous parler de bonnes idées (parmi d&rsquo;autres) introduites par yesod que je n&rsquo;avais jamais vu ailleurs.</p> </div> @@ -218,13 +207,13 @@ Avant de vous dire pourquoi vous devriez aussi le considérer, je préfère vous <h2 id="types-saufs">Types saufs</h2> -<p>Commençons par une BD d’<a href="http://xkcd.com">xkcd</a>&nbsp;:</p> +<p>Commençons par une BD d&rsquo;<a href="http://xkcd.com">xkcd</a>&nbsp;:</p> <p></p></p> tag:yannesposito.com,2011-09-28:/Scratch/fr/blog/Higher-order-function-in-zsh/ - Fonctions d'ordre supérieur en zsh + Fonctions d'ordre supérieur en zsh 2011-09-28T13:15:23Z 2011-09-28T13:15:23Z @@ -238,12 +227,12 @@ Avant de vous dire pourquoi vous devriez aussi le considérer, je préfère vous <div class="intro"> -<p>UPDATE: <a href="http://nicholassterling.wordpress.com/2012/03/30/a-zsh-map-function/">Nicholas Sterling a découvert un moyen de faire des fonctions anonymes</a> +<p>UPDATE: <a href="http://nicholassterling.wordpress.com/2012/03/30/a-zsh-map-function/">Nicholas Sterling a découvert un moyen de faire des fonctions anonymes</a> Merci!</p> -<p>Avec cette dernière version vous pouvez utiliser <code>map</code> si vous utilisez -des fonctions déclarées. <code>mapl</code> pour les fonctions anonymes -et <code>mapa</code> pour les fonctions arithmétiques.</p> +<p>Avec cette dernière version vous pouvez utiliser <code>map</code> si vous utilisez +des fonctions déclarées. <code>mapl</code> pour les fonctions anonymes +et <code>mapa</code> pour les fonctions arithmétiques.</p> <p>Exemple&nbsp;:</p> @@ -263,11 +252,11 @@ X filter Y X fold Y X map Y -$ mapa '$1*2' {1....</code></pre></div></p> +$ mapa '$1*2...</code></pre></div></p> tag:yannesposito.com,2011-09-28:/Scratch/fr/blog/programming-language-experience/ - Mon expérience avec les languages de programmation + Mon expérience avec les languages de programmation 2011-09-28T10:21:41Z 2011-09-28T10:21:41Z @@ -280,7 +269,7 @@ $ mapa '$1*2' {1....</code></pre></div></p> <div class="intro"> -<span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span> Mon avis court et hautement subjectif concernant les différents languages de programmations que j’ai utilisé. +<span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span> Mon avis succinct et hautement subjectif concernant les différents languages de programmation que j&rsquo;ai utilisé. </div> @@ -291,12 +280,10 @@ $ mapa '$1*2' {1....</code></pre></div></p> <p>Ah&nbsp;! Le language de mes premiers programmes&nbsp;! Je devais avoir 10-11 ans. -Sous <code>MO5</code>, <code>Amstrad CPC 6128</code> et même <code>Atari STe</code>. +Sous <code>MO5</code>, <code>Amstrad CPC 6128</code> et même <code>Atari STe</code>. Le langage des <code>GOTO</code>s. -Je suis empleint de nostalgie rien que d’y penser. -C’est à peu prêt le seul intérêt de ce langage.</p> - -<p>Aujourd’hui ...</p></p></p> +Je suis empleint de nostalgie rien que d&rsquo;y penser. +C&rsquo;est à peu prêt le seul intérêt de ce ...</p></p></p> tag:yannesposito.com,2011-08-25:/Scratch/fr/blog/Learn-Vim-Progressively/ @@ -308,29 +295,27 @@ C’est à peu prêt le seul intérêt de ce langage.</p> yannesposito.com - <p><img alt="Über leet use vim!" src="/Scratch/img/blog/Learn-Vim-Progressively/uber_leet_use_vim.jpg" /></p> + <p><img alt="Über leet use vim!" src="/Scratch/img/blog/Learn-Vim-Progressively/uber_leet_use_vim.jpg" /></p> <div class="intro"> -<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span> Vous désirez apprendre vim (le meilleur editeur de texte connu à ce jour) le plus rapidement possible. Voici mes conseils pour vous aider. Commencez à apprendre le minimum vital, puis apprenez doucement de nouvelles commandes.</p> +<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span> Vous désirez apprendre vim (le meilleur editeur de texte connu à ce jour) le plus rapidement possible. Voici mes conseils pour vous aider. Commencez à apprendre le minimum vital, puis apprenez doucement de nouvelles commandes.</p> </div> -<p><a href="http://www.vim.org">Vim</a> ou l’éditeur qui vallait 3 milliards&nbsp;:</p> +<p><a href="http://www.vim.org">Vim</a> ou l&rsquo;éditeur qui vallait 3 milliards&nbsp;:</p> <blockquote> <p>Meilleur, plus fort, plus rapide.</p> </blockquote> -<p>Apprenez <a href="http://www.vim.org">vim</a> et ce sera votre dernier éditeur. -Aucun éditeur que je connaisse ne le surpasse. -Sa prise en mais est difficile, mais payante.</p> - -</p> +<p>Apprenez <a href="http://www.vim.org">vim</a> et ce sera votre dernier éditeur. +Aucun éditeur que je connaisse ne le surpasse. +Sa prise en mais est difficile, mais p...</p></p> tag:yannesposito.com,2011-08-17:/Scratch/fr/blog/A-more-convenient-diff/ @@ -342,11 +327,11 @@ Sa prise en mais est difficile, mais payante.</p> yannesposito.com - <p><code>diff</code> est un utilitaire très pratique, mais il n’est pas facile à lire pour nous, les Hommes.</p> + <p><code>diff</code> est un utilitaire très pratique, mais il n&rsquo;est pas facile à lire pour nous, les Hommes.</p> -<p>C’est pourquoi, lorsque vous utilisez <code>git</code>, il vous montre un formatage plus agréable avec des couleurs.</p> +<p>C&rsquo;est pourquoi, lorsque vous utilisez <code>git</code>, il vous montre un formatage plus agréable avec des couleurs.</p> -<p>Voici le script que j’utilise lorsque je veux avoir un <code>diff</code> à la git.</p> +<p>Voici le script que j&rsquo;utilise lorsque je veux avoir un <code>diff</code> à la git.</p> <div class="codefile"><a href="/Scratch/fr/blog/A-more-convenient-diff/code/ydiff">&#x27A5; ydiff</a></div> @@ -362,7 +347,7 @@ function colorize_diff { -) print -n $fg[red];; @) # Display in cyan the @@ positions @@ if [[ ${line[1]} = '@' ]]; then - line=$(print $line | perl -pe 's...</code></pre> + line=$(pri...</code></pre> tag:yannesposito.com,2011-07-10:/Scratch/fr/blog/Haskell-Mandelbrot/ @@ -374,7 +359,7 @@ function colorize_diff { yannesposito.com - <p>Voici le code “obfusqué”&nbsp;:</p> + <p>Voici le code &ldquo;obfusqué&rdquo;&nbsp;:</p> <div class="codefile"><a href="/Scratch/fr/blog/Haskell-Mandelbrot/code/animandel.hs">&#x27A5; animandel.hs</a></div> @@ -384,8 +369,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))&gt;2)then n else f c ((z*z)+c) (n-1) h j k = map (\z-&gt;(f (C z) (C(0,0)) 32,(fst z&gt;l - q/2))) [(x,y)|y&lt;-[p,(p+((o-p)/a))..o],x&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;$@#"!!i):rst p;rst True="\n";rst False="" -main = putStrLn $ im...</code></pre> +u j k = concat $ map v $ h j k where v (i,p)=(" .,`'°\":;-+oO0123456789=!%*§&amp;$@#"!!i):rst p;rst True="\n";rst False="" +main ...</code></pre> tag:yannesposito.com,2011-05-18:/Scratch/fr/blog/Password-Management/ @@ -403,24 +388,23 @@ main = putStrLn $ im...</code></pre> <div class="intro"> -<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span> Une méthode de gestion des mots de passes que j’utilise avec succès depuis quelques années.<br /> +<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span> Une méthode de gestion des mots de passes que j&rsquo;utilise avec succès depuis quelques années.<br /> <strong><code>sha1( mot_de_passe + nom_de_domaine )</code></strong><br /> -Je ne mémorise qu’un seul mot de passe de très bonne qualité. -J’utilise des mots de passe différents sur tous les sites.</p> +Je ne mémorise qu&rsquo;un seul mot de passe de très bonne qualité. +J&rsquo;utilise des mots de passe différents sur tous les sites.</p> </div> -<p>Avant de commencer, je tiens à préciser qu’il s’agit d’une tentative de vous vendre mon appli iPhone&nbsp;;-).</p> +<p>Avant de commencer, je tiens à préciser qu&rsquo;il s&rsquo;agit d&rsquo;une tentative de vous vendre mon appli iPhone&nbsp;;-).</p> -<p>Vous êtes toujours là&nbsp;? -Bon, d’accord, même si vous ne téléchargez pas mon application vous pouvez quand même utiliser ma méthode. -Elle est à la fois très sûre et simple à ut...</p></p></div></p> +<p>Vous êtes toujours là&nbsp;? +Bon, d&rsquo;accord, même si vous ne téléchargez pas mon application vous pouvez quand même utili...</p></p></div></p> tag:yannesposito.com,2011-04-20:/Scratch/fr/blog/2011-04-20-Now-hosted-on-github/ - Hébergement github + Hébergement github 2011-04-20T15:22:15Z 2011-04-20T15:22:15Z @@ -430,7 +414,7 @@ Elle est à la fois très sûre et simple à ut...</p></p></div&g <p><img alt="Title image" src="/Scratch/img/blog/2011-04-20-Now-hosted-on-github/main.png" /></p> -<p>J’héberge mon site sur github à partir d’aujourd’hui.</p> +<p>J&rsquo;héberge mon site sur github à partir d&rsquo;aujourd&rsquo;hui.</p> </p> @@ -449,9 +433,9 @@ Elle est à la fois très sûre et simple à ut...</p></p></div&g <div class="encadre"> -<p><em>Mise à jour&nbsp;:</em> Je pense que je vais finallement changer d’avis. +<p><em>Mise à jour&nbsp;:</em> Je pense que je vais finallement changer d&rsquo;avis. Pourquoi&nbsp;? -Tout d’abord, je viens de découvrir un convertisseur javascript vers coffeescript, ensuite Denis Knauf m’a laissé un commentaire et m’a appris l’existence d’une fonction <code>CoffeeScript.eval</code>. De plus, il faut voir CoffeeScript comme javascript avec une syntaxe similaire à Ruby et pas comme un langage similaire à Ruby.</p> +Tout d&rsquo;abord, je viens de découvrir un convertisseur javascript vers coffeescript, ensuite Denis Knauf m&rsquo;a laissé un commentaire et m&rsquo;a appris l&rsquo;existence d&rsquo;une fonction <code>CoffeeScript.eval</code>. De plus, il faut voir CoffeeScript comme javascript avec une syntaxe similaire à Ruby et pas comme un langage similaire à Ruby.</p> </div> @@ -461,11 +445,11 @@ Tout d’abord, je viens de découvrir un convertisseur javascript vers coffeesc <div class="intro"> -<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span> Qu’est-ce qui n’allait pas avec Coffeescript? La meta-programmation, il faut le “vendre” aux autres, une nouvelle éta...</p></div></p> +<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span> Qu&rsquo;est-ce qui n&rsquo;allait pas avec Coffeescript? La meta-programm...</p></div></p> tag:yannesposito.com,2011-01-01:/Scratch/fr/blog/2011-01-03-Happy-New-Year/ - Bonne et heureuse année + Bonne et heureuse année 2011-01-01T06:55:54Z 2011-01-01T06:55:54Z @@ -473,19 +457,19 @@ Tout d’abord, je viens de découvrir un convertisseur javascript vers coffeesc yannesposito.com - <p>Bonne et heureuse année&nbsp;!</p> + <p>Bonne et heureuse année&nbsp;!</p> -<p>J’étais très occupé ces derniers mois. +<p>J&rsquo;étais très occupé ces derniers mois. Maintenant il me semble que je vais pouvoir faire revivre ce blog.</p> -<p>J’ai fait un outil qui permet d’écrire des livre en utilisant une syntaxe proche de markdown. -C’est un markdown avec des macros (essentiel pour les textes longs). -De plus le système gère la génération de pages HTML ainsi que du PDF engendré avec du XeLaTeX. -Je n’en ai pas encore terminé avec ça. Mais si je tarde trop, je communiquerai lorsque j’aurai fini le minimum.</p> +<p>J&rsquo;ai fait un outil qui permet d&rsquo;écrire des livre en utilisant une syntaxe proche de markdown. +C&rsquo;est un markdown avec des macros (essentiel pour les textes longs). +De plus le système gère la génération de pages HTML ainsi que du PDF engendré avec du XeLaTeX. +Je n&rsquo;en ai pas encore terminé avec ça. Mais si je tarde trop, je communiquerai lorsque j&rsquo;aurai fini le minimum.</p> -<p>J’ai écrit un framework MVC pour application javascript simple mais néanmoins très rapide.</p> +<p>J&rsquo;ai écrit un framework MVC pour application javascript simple mais néanmoins très rapide.</p> -<p>Meilleurs vœux à tous&nbsp;!</p> +<p>Meilleurs vœux à tous&nbsp;!</p> @@ -502,14 +486,14 @@ Je n’en ai pas encore terminé avec ça. Mais si je tarde trop, je communiquer <div class="intro"> -<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span> J’ai fait un système simple de macros pour mon blog. Par exemple, il me suffit d’écrire %<span></span>latex et ça affiche <span style="text-transform: uppercase">L<sup style="vertical-align: 0.15em; margin-left: -0.36em; margin-right: -0.15em; font-size: .85em">a</sup>T<sub style="vertical-align: -0.5ex; margin-left: -0.1667em; margin-right: -0.125em; font-size: 1em">e</sub>X</span>.</p> +<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span> J&rsquo;ai fait un système simple de macros pour mon blog. Par exemple, il me suffit d&rsquo;écrire %<span></span>latex et ça affiche <span style="text-transform: uppercase">L<sup style="vertical-align: 0.15em; margin-left: -0.36em; margin-right: -0.15em; font-size: .85em">a</sup>T<sub style="vertical-align: -0.5ex; margin-left: -0.1667em; margin-right: -0.125em; font-size: 1em">e</sub>X</span>.</p> </div> -<p>J’ai ajouter un système de macro pour mon système de blog. -Lorsqu’on est habitué à <span style="text-transform: uppercase">L<sup style="vertical-align: 0.15em; margin-left: -0.36em; margin-right: -0.15em; font-size: .85em">a</sup>T</span></p> +<p>J&rsquo;ai ajouter un système de macro pour mon système de blog. +Lorsqu&rsquo;on est habitué à <span style="text-transform: uppercase">L<sup style="vertical-align: 0.15em; margin-left: -0.36em; margin-right: -0.15em; font-size: .85em">a</sup>T</span></p> tag:yannesposito.com,2010-10-14:/Scratch/fr/blog/2010-10-14-Fun-with-wav/ @@ -525,24 +509,23 @@ Lorsqu’on est habitué à <span style="text-transform: uppercase">L<s <div class="intro"> -<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span> Je me suis amusé à lire un fichier <code>wav</code>. Le <code>C</code> fut le langage le mieux adapté à ce traitement. Bien meilleur que Ruby par exemple.</p> +<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span> Je me suis amusé à lire un fichier <code>wav</code>. Le <code>C</code> fut le langage le mieux adapté à ce traitement. Bien meilleur que Ruby par exemple.</p> -<p>edit: Je voulais que ce programme fonctionne sur une machine spécifique. En aucun cas je ne pensais publier ce code pour une utilisation autre que celle-ci.</p> +<p>edit: Je voulais que ce programme fonctionne sur une machine spécifique. En aucun cas je ne pensais publier ce code pour une utilisation autre que celle-ci.</p> </div> -<p>J’ai eu besoin de calculer la somme des valeurs absolue des données d’un fichier <code>wav</code>. -Pour des raison d’efficacité (et aussi de fun), j’ai fait le programme en <code>C</code>.</p> +<p>J&rsquo;ai eu besoin de calculer la somme des valeurs absolue des données d&rsquo;un fichier <code>wav</code>. +Pour des raison d&rsquo;efficacité (et aussi de fun), j&rsquo;ai fait le programme en <code>C</code>.</p> -<p>Celà faisait longtemps que je n’avais pas programmé en <code>C</code>. -De mémoire il était peu aisé de manipuler des fichiers. -Mais je dois concéder que j’ai été...</p> +<p>Celà faisait longtemps que je n&rsquo;avais pas programmé en <code>C</code>. +De mémoire il était peu aisé de manipuler des ...</p> tag:yannesposito.com,2010-10-10:/Scratch/fr/blog/2010-10-10-Secure-eMail-on-Mac-in-few-steps/ - Sécurisez vos emails + Sécurisez vos emails 2010-10-10T16:39:00Z 2010-10-10T16:39:00Z @@ -556,22 +539,22 @@ Mais je dois concéder que j’ai été...</p> <div class="intro"> -<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span> <em>avec un Mac</em> </p> +<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span> <em>avec un Mac</em> </p> <ul> - <li>Récupérez un certificat signé par une AC: <a href="http://www.instantssl.com/ssl-certificate-products/free-email-certificate.html">cliquez ici pour un certificat gratuit</a>&nbsp;;</li> + <li>Récupérez un certificat signé par une AC: <a href="http://www.instantssl.com/ssl-certificate-products/free-email-certificate.html">cliquez ici pour un certificat gratuit</a>&nbsp;;</li> <li>ouvrez le fichier&nbsp;;</li> - <li>supprimer le fichier en mode sécurisé&nbsp;;</li> - <li>utilisez Mail plutôt que l’interface web de gmail.</li> + <li>supprimer le fichier en mode sécurisé&nbsp;;</li> + <li>utilisez Mail plutôt que l&rsquo;interface web de gmail.</li> </ul> </div> -<p>J’ai (re)découvert comment adoptez la norme S/MIME. -J’ai été surpris de voir à quel point ce fut aisé. -Il y a seulement quelques années c’était bien plus difficile à accom...</p></p> +<p>J&rsquo;ai (re)découvert comment adoptez la norme S/MIME. +J&rsquo;ai été surpris de voir à quel point ce fut aisé. +Il y a seulement quelques années c&r...</p></p> tag:yannesposito.com,2010-10-06:/Scratch/fr/blog/2010-10-06-New-Blog-Design-Constraints/ @@ -583,19 +566,18 @@ Il y a seulement quelques années c’était bien plus difficile à accom...< yannesposito.com - <p>Vous avez pu constater que j’ai modifié le design de mon blog. -Maintenant il doit être beaucoup plus léger qu’avant. -Je n’utilise plus de CSS3 et beaucoup moins de javascript. -Bien entendu, même avant, mes pages étaient parfaitement lisibles sans javascript. -Mais, je me suis aperçu que les systèmes de CSS3 sont loin d’être au point. -J’utilisait des gradient en CSS3, ainsi que des ombres sous le texte. Ça avait un rendu très sympa. Sauf… -Ce n’était pas compatible ie6, sous Chrome le rendu était d’une lenteur incroyable. -J’ai donc décidé de faire un site à minima. -Je voulais qu’il soit joli <em>et</em> le plus simple possible pour assurer sa compatibilité. -Les règles que je me suis fixées sont donc:</p> + <p>Vous avez pu constater que j&rsquo;ai modifié le design de mon blog. +Maintenant il doit être beaucoup plus léger qu&rsquo;avant. +Je n&rsquo;utilise plus de CSS3 et beaucoup moins de javascript. +Bien entendu, même avant, mes pages étaient parfaitement lisibles sans javascript. +Mais, je me suis aperçu que les systèmes de CSS3 sont loin d&rsquo;être au point. +J&rsquo;utilisait des gradient en CSS3, ainsi que des ombres sous le texte. Ça avait un rendu très sympa. Sauf&hellip; +Ce n&rsquo;était pas compatible ie6, sous Chrome le rendu était d&rsquo;une lenteur incroyable. +J&rsquo;ai donc décidé de faire un site à minima. +Je voulais qu&rsquo;il soit joli <em>et</em> le plus simple possible pour assurer sa compatibilité. +Les règles que je me suis fixées sont donc:</p> -<ul> - <li>pas d’élément CSS qui commence par <code>-moz</code> ou <code>-webkit</code></li></ul> + tag:yannesposito.com,2010-09-02:/Scratch/fr/blog/2010-09-02-Use-git-to-calculate-trusted-mtimes/ @@ -607,18 +589,16 @@ Les règles que je me suis fixées sont donc:</p> yannesposito.com - <p>Vous pouvez remarquer qu’à la fin de chaque page je donne une date de dernière modification. -Précédemment cette date était calculée en utilisant la date du fichier. -Mais il arrive fréquemment que je fasse un <code>touch</code> d’un fichier pour engendrer tout le site de nouveau. -Donc la date n’est pas nécessairement la <em>vraie</em> de modification du contenue.</p> + <p>Vous pouvez remarquer qu&rsquo;à la fin de chaque page je donne une date de dernière modification. +Précédemment cette date était calculée en utilisant la date du fichier. +Mais il arrive fréquemment que je fasse un <code>touch</code> d&rsquo;un fichier pour engendrer tout le site de nouveau. +Donc la date n&rsquo;est pas nécessairement la <em>vraie</em> de modification du contenue.</p> -<p>J’utilise <a href="http://git-scm.org">git</a> pour <em>versionner</em> mon site web. -Et cet outil me permet de récupérer la dernière date de <em>vraie</em> modification d’un fichier. -Voici comment je m’y prend avec <a href="http://nanoc.stoneship.org">nanoc</a>&nbsp;:</p> +<p>J&rsquo;utilise <a href="http://git-scm.org">git</a> pour <em>versionner</em> mon site web. +Et cet outil me permet de récupérer la dernière date de <em>vraie</em> modification d&rsquo;un fichier. +Voici comment je m&rsquo;y prend avec <a href="http://nanoc.stoneship.org">nanoc</a>&nbsp;:</p> -<div class="codefile"><a href="/Scratch/fr/blog/2010-09-02-Use-git-to-calculate-trusted-mtimes/code/gitmtime.rb">&#x27A5; gitmtime.rb</a></div> - - +<div class="codefile"></div> tag:yannesposito.com,2010-09-02:/Scratch/fr/blog/2010-09-02-base64-and-sha1-on-iPhone/ @@ -630,10 +610,10 @@ Voici comment je m’y prend avec <a href="http://nanoc.stoneship.org">nan yannesposito.com - <p>Allons directement à l’essentiel&nbsp;: -voici deux fonctions à intégrer à votre application iPhone pour afficher l’encodage en base64 ou en hexadecimal du hash sha1 d’un string en Objective-C pour iPhone.</p> + <p>Allons directement à l&rsquo;essentiel&nbsp;: +voici deux fonctions à intégrer à votre application iPhone pour afficher l&rsquo;encodage en base64 ou en hexadecimal du hash sha1 d&rsquo;un string en Objective-C pour iPhone.</p> -<p>Pour l’usage c’est très simple, copiez le code dans la classe de votre choix. +<p>Pour l&rsquo;usage c&rsquo;est très simple, copiez le code dans la classe de votre choix. Puis&nbsp;:</p> <pre><code class="objective-c">#import &lt;CommonCrypto/CommonDigest.h&gt; @@ -643,14 +623,14 @@ NSString *b64_hash = [self b64_sha1:@"some NSString to be sha1'ed"]; NSString *hex_hash = [self hex_sha1:@"some NSString to be sha1'ed"]; </code></pre> -<p>L’algorithme pour l’encodage en <code>base64</code> doit être programmé sur iPhone. -Il n’y a pas de librairie officielle qui s’occupe de ça.</p> +<p>L&rsquo;algorithme pour l&rsquo;encodage en <code>base64</code> doit être programmé sur iPhone. +Il n&rsquo;y a pas de librairie officielle qui s&rsquo;occupe de ça.</p> <div class="codefile"></div> tag:yannesposito.com,2010-08-31:/Scratch/fr/blog/2010-08-31-send-mail-from-command-line-with-attached-file/ - Envoyer un mail en ligne de commande avec un fichier attaché + Envoyer un mail en ligne de commande avec un fichier attaché 2010-08-31T08:16:04Z 2010-08-31T08:16:04Z @@ -658,21 +638,20 @@ Il n’y a pas de librairie officielle qui s’occupe de ça.</p> yannesposito.com - <p>J’ai dû envoyer un mail en ligne de commande récemment. -Quelle ne fût pas ma surprise lorsque je constatais que ce n’était vraiment pas évident. -Je n’avais ni <code>pine</code> ni <code>mutt</code>. Seulement <code>mail</code> et <code>mailx</code>.</p> + <p>J&rsquo;ai dû envoyer un mail en ligne de commande récemment. +Quelle ne fût pas ma surprise lorsque je constatais que ce n&rsquo;était vraiment pas évident. +Je n&rsquo;avais ni <code>pine</code> ni <code>mutt</code>. Seulement <code>mail</code> et <code>mailx</code>.</p> -<p>Ce qu’on trouve sur internet pour envoyer un mail avec fichier attaché c’est ça&nbsp;:</p> +<p>Ce qu&rsquo;on trouve sur internet pour envoyer un mail avec fichier attaché c&rsquo;est ça&nbsp;:</p> <pre><code class="zsh">uuencode fic.jpg fic.jpg | mail -s 'Subject' </code></pre> -<p>Bon, alors, bête et discipliné j’ai essayé. -Et bien, ça marche <em>presque</em> tout le temps. -Pour mon fichier ça n’a pas marché du tout. -Je l’ai compressé au format <code>.gz</code>, <code>.bz2</code> et <code>.zip</code>. -Avec le format <code>.bz2</code> le mail reçu avait bien un fichier attaché. -Mais avec les formats <code>.gz</code> et <code>.zi...</code></p> +<p>Bon, alors, bête et discipliné j&rsquo;ai essayé. +Et bien, ça marche <em>presque</em> tout le temps. +Pour mon fichier ça n&rsquo;a pas marché du tout. +Je l&rsquo;ai compressé au format <code>.gz</code>, <code>.bz2</code> et <code>.zip</code>. +Avec le format <code>.bz2</code> le mail reçu avait bien un fichie...</p> tag:yannesposito.com,2010-08-23:/Scratch/fr/blog/2010-08-23-Now-heberged-on-heroku/ @@ -686,18 +665,18 @@ Mais avec les formats <code>.gz</code> et <code>.zi...</cod <h1 class="first" id="maintenant-sur-herokuhttpherokucom">Maintenant sur <a href="http://heroku.com">Heroku</a></h1> -<p>J’ai changé mon hébergeur. Mobileme n’est absolument pas adapté à la diffusion de mon blog. C’est pourquoi je suis passé à <a href="http://heroku.com">Heroku</a>.</p> +<p>J&rsquo;ai changé mon hébergeur. Mobileme n&rsquo;est absolument pas adapté à la diffusion de mon blog. C&rsquo;est pourquoi je suis passé à <a href="http://heroku.com">Heroku</a>.</p> -<p>Mais comme vous devez le savoir mon blog est un site complètement statique. -J’utilise <a href="http://nanoc.stoneship.org/">nanoc</a> pour l’engendrer. -Avoir un site statique amène beaucoup d’avantages par rapport à un site dynamique. Surtout en terme de sécurité. +<p>Mais comme vous devez le savoir mon blog est un site complètement statique. +J&rsquo;utilise <a href="http://nanoc.stoneship.org/">nanoc</a> pour l&rsquo;engendrer. +Avoir un site statique amène beaucoup d&rsquo;avantages par rapport à un site dynamique. Surtout en terme de sécurité. Voici comment configurer un site statique sur heroku.</p> -<p>La racine de mes fichiers est ‘/output’. Vous devez simplement créer deux fichiers. Un fichier <code>config.ru</code><sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup>&...</p> +<p>La racine de mes fichiers est &lsquo;/output&rsquo;. Vous devez simplement créer deux fichiers. Un fichier <code>config.ru</code></p> tag:yannesposito.com,2010-08-11:/Scratch/fr/blog/2010-07-09-Indecidabilities/ - Indécidabilités (partie 1) + Indécidabilités (partie 1) 2010-08-11T08:04:31Z 2010-08-11T08:04:31Z @@ -710,7 +689,7 @@ Voici comment configurer un site statique sur heroku.</p> tag:yannesposito.com,2010-07-31:/Scratch/fr/blog/2010-07-31-New-style-after-holidays/ - Nouveau style après les vacances + Nouveau style après les vacances 2010-07-31T21:59:10Z 2010-07-31T21:59:10Z @@ -718,11 +697,11 @@ Voici comment configurer un site statique sur heroku.</p> yannesposito.com - <p>Avant les vacances beaucoup d’utilisateurs se sont plaints de la lenteur de rendu de mon site. -Il s’agit notamment de problèmes avec Chrome en particulier. -Mais pour éviter tout problème. -J’ai complètement modifié le style de mon site web. -Il est inspiré du style de l’application iBooks<small>&copy;</small> sur iPhone<small>&copy;</small>.</p> + <p>Avant les vacances beaucoup d&rsquo;utilisateurs se sont plaints de la lenteur de rendu de mon site. +Il s&rsquo;agit notamment de problèmes avec Chrome en particulier. +Mais pour éviter tout problème. +J&rsquo;ai complètement modifié le style de mon site web. +Il est inspiré du style de l&rsquo;application iBooks<small>&copy;</small> sur iPhone<small>&copy;</small>.</p> <p>Dites moi ce que vous pensez de ce nouveau design.</p> @@ -737,21 +716,19 @@ Il est inspiré du style de l’application iBooks<small>&copy;</sm yannesposito.com - <p>Beaucoup d’utilisateurs de <a href="http://reddit.com">Reddit</a> m’ont rapporté que mon site était très long à charger et à <em>scroller</em>. -Ils pensaient qu’il s’agissait d’un problème dû aux ombres que j’applique sur le texte. -J’étais un peu surpris puisque je fais mes tests sur une machine vraiment très lente et je n’avais jamais détecté ces problèmes. -En réalité, ce qui ralenti le rendu de ce site est par ordre d’importance&nbsp;:</p> + <p>Beaucoup d&rsquo;utilisateurs de <a href="http://reddit.com">Reddit</a> m&rsquo;ont rapporté que mon site était très long à charger et à <em>scroller</em>. +Ils pensaient qu&rsquo;il s&rsquo;agissait d&rsquo;un problème dû aux ombres que j&rsquo;applique sur le texte. +J&rsquo;étais un peu surpris puisque je fais mes tests sur une machine vraiment très lente et je n&rsquo;avais jamais détecté ces problèmes. +En réalité, ce qui ralenti le rendu de ce site est par ordre d&rsquo;importance&nbsp;:</p> <ol> - <li>Les dégradés sur Chrome (pas dans Safari sur Mac)</li> + <li>Les dégradés sur Chrome (pas dans Safari sur Mac)</li> <li>les <em>box shadows</em> sur Firefox</li> </ol> -<h2 id="les-dgrads">les dégradés</h2> +<h2 id="les-dgrads">les dégradés</h2> -<p>Sur Safari il n’y a absolument aucun problème avec les dégradés. Par contre sur Chrome sous Linux le site devient quasiment inutilisable.</p> - -<p>Safari et Chrome utilisent <em>webkit</em></p> +<p>Sur Safari il n&rsquo;y a absolument aucun problème avec les dégradés. Par contre sur Chrome sous Linux le si...</p> tag:yannesposito.com,2010-07-05:/Scratch/fr/blog/2010-07-05-Cappuccino-and-Web-applications/ @@ -767,13 +744,13 @@ En réalité, ce qui ralenti le rendu de ce site est par ordre d’importance&am <div class="intro"> -<p><abbr title="Trop long à lire">tlàl</abbr>:</p> +<p><abbr title="Trop long à lire">tlàl</abbr>:</p> <ul> - <li>J’ai essayé de faire une version de <a href="http://yannesposito.com/Softwares/YPassword.html">YPassword</a> en jQuery et avec Cappuccino.</li> - <li>Cappuccino est très bien sur les navigateurs non mobile mais l’application pèse 1.4Mo et n’est pas compatible avec l’iPhone.</li> - <li>la version jQuery n’est pas aussi jolie que la version réalisée avec Cappuccino mais elle pèse seulement 106Ko et est compatible avec l’iPhone.</li> - <li>J’essayerai Dashcode 3</li> + <li>J&rsquo;ai essayé de faire une version de <a href="http://yannesposito.com/Softwares/YPassword.html">YPassword</a> en jQuery et avec Cappuccino.</li> + <li>Cappuccino est très bien sur les navigateurs non mobile mais l&rsquo;application pèse 1.4Mo et n&rsquo;est pas compatible avec l&rsquo;iPhone.</li> + <li>la version jQuery n&rsquo;est pas aussi jolie que la version réalisée avec Cappuccino mais elle pèse seulement 106Ko et est compatible avec l&rsquo;iPhone.</li> + <li>J&rsquo;essayerai Dashcode 3</li> </ul> @@ -785,7 +762,7 @@ En réalité, ce qui ralenti le rendu de ce site est par ordre d’importance&am <div class="intro"> -<p>Avant de commencer, je dois dire que je sais que Cappuccino et jQuery ne sont pas plus comparable que Cocoa et la <em>standard library</em> en C++. L’un est fait pour créer des interfaces util...</p></div></hr> +<p>Avant de commencer, je dois dire que je sais que Cappuccino et jQuery ne sont pas plus comparable que Cocoa et la <em>standard library</em> en...</p></div></hr> tag:yannesposito.com,2010-06-19:/Scratch/fr/blog/2010-06-19-jQuery-popup-the-easy-way/ @@ -797,7 +774,7 @@ En réalité, ce qui ralenti le rendu de ce site est par ordre d’importance&am yannesposito.com - <p>Voici une façon simple et rapide pour faire des popups avec jQuery.</p> + <p>Voici une façon simple et rapide pour faire des popups avec jQuery.</p> <div class="codefile"><a href="/Scratch/fr/blog/2010-06-19-jQuery-popup-the-easy-way/code/essai.js">&#x27A5; essai.js</a></div> @@ -818,7 +795,7 @@ function initCode() { $('body').append('&lt;div id="_code"&gt;&lt;/div&gt;'); $('#_code').css( { 'text-align': "justify", position: "fixed", left:0, top:0, width: "100%", height: "100%", - "background-color": "rgba(0, 0, 0, 0.8)", 'z-i...</code></pre> + "background-color": "rgba(0, 0, 0, 0.8)", 'z-...</code></pre> tag:yannesposito.com,2010-06-17:/Scratch/fr/blog/2010-06-17-hide-yourself-to-analytics/ @@ -830,23 +807,19 @@ function initCode() { yannesposito.com - <p>Voici un moyen très simple de ne plus être comptabilisé dans les visites de son propre site. -Tout d’abord, vous devriez jeter un coup d’œil sur comment <a href="/Scratch/fr/blog/2010-06-17-track-events-with-google-analytics">je gère les systèmes de récupération de statistiques</a>. + <p>Voici un moyen très simple de ne plus être comptabilisé dans les visites de son propre site. +Tout d&rsquo;abord, vous devriez jeter un coup d&rsquo;œil sur comment <a href="/Scratch/fr/blog/2010-06-17-track-events-with-google-analytics">je gère les systèmes de récupération de statistiques</a>. Je centralise tout dans un seul fichier javascript ce qui facilite le travail.</p> -<p>Cette méthode nécessite l’utilisation de <code>jquery-cookie</code>.</p> +<p>Cette méthode nécessite l&rsquo;utilisation de <code>jquery-cookie</code>.</p> -<p>Avant de comptabiliser les visites, je vérifie que la clé <code>admin</code> n’est pas utilisée dans mes cookies.</p> +<p>Avant de comptabiliser les visites, je vérifie que la clé <code>admin</code> n&rsquo;est pas utilisée dans mes cookies.</p> <pre><code class="javascript"> var admin = $.cookie('admin'); if (! admin) { // put your analytics code here } else { - console.log("[WARNING] you're HIDDEN to analytics"); - } -</code></pre> - -<p>et il...</p> + console.log("[WARNING] you're HIDDEN to analy...</code></pre> tag:yannesposito.com,2010-06-17:/Scratch/fr/blog/2010-06-17-track-events-with-google-analytics/ @@ -858,9 +831,9 @@ Je centralise tout dans un seul fichier javascript ce qui facilite le travail.&l yannesposito.com - <p>Voici comment analyser tous les clics que font vos utilisateurs sur votre blog en incluant google analytics de façon asynchrone.</p> + <p>Voici comment analyser tous les clics que font vos utilisateurs sur votre blog en incluant google analytics de façon asynchrone.</p> -<p>Dans le html, il faut utiliser <a href="http://jquery.com">jQuery</a> et un fichier que j’ai appelé <code>yga.js</code>&nbsp;:</p> +<p>Dans le html, il faut utiliser <a href="http://jquery.com">jQuery</a> et un fichier que j&rsquo;ai appelé <code>yga.js</code>&nbsp;:</p> <pre><code class="html"> &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="yga.js"&gt;&lt;/script&gt; @@ -872,12 +845,11 @@ Je centralise tout dans un seul fichier javascript ce qui facilite le travail.&l <pre><code class="javascript">$(document).ready( function() { // add an event to all link for google analytics - $('a').click(function () { -...</code></pre> + $('a').click(functi...</code></pre> tag:yannesposito.com,2010-06-15:/Scratch/fr/blog/2010-06-15-Get-my-blog-engine/ - Récupérez mon système de blog + Récupérez mon système de blog 2010-06-15T08:56:32Z 2010-06-15T08:56:32Z @@ -885,22 +857,21 @@ Je centralise tout dans un seul fichier javascript ce qui facilite le travail.&l yannesposito.com - <p>J’ai publié une version <em>light</em> de mon système de blog hier soir. Par <em>light</em> il faut comprendre avec un CSS plus épuré et plus portable (sans les bords ronds). -Vous pouvez le récupérer sur <a href="http://github.com/yogsototh/nanoc3_blog">github.com</a>.</p> + <p>J&rsquo;ai publié une version <em>light</em> de mon système de blog hier soir. Par <em>light</em> il faut comprendre avec un CSS plus épuré et plus portable (sans les bords ronds). +Vous pouvez le récupérer sur <a href="http://github.com/yogsototh/nanoc3_blog">github.com</a>.</p> -<p>Que pouvez-vous attendre de ce système de blog&nbsp;?</p> +<p>Que pouvez-vous attendre de ce système de blog&nbsp;?</p> <ul> - <li>Tous les avantages liés à <a href="http://nanoc.stoneship.org">nanoc</a>&nbsp;;</li> - <li>Facilité de la gestion de plusieurs langues&nbsp;;</li> + <li>Tous les avantages liés à <a href="http://nanoc.stoneship.org">nanoc</a>&nbsp;;</li> + <li>Facilité de la gestion de plusieurs langues&nbsp;;</li> <li>coloration syntaxique des codes sources pour la plupart des languages&nbsp;;</li> - <li>commentaires gérés avec <a href="http://intensedebate.org">intenseDebate</a> de façon asynchrone&nbsp;;</li> - <li>très portable avec ou sans javascript, XHTML Strict 1.0 / CSS3&nbsp;;</li> - <li>écrivez v...</li></ul> + <li>commentaires gérés avec <a href="http://intensedebate.org">intenseDebate</a> de façon asynchrone&nbsp;;</li> + <li>très portable avec ou sans javascript, XHTML Strict 1.0 / CSS3&nbsp;;</li></ul> tag:yannesposito.com,2010-06-14:/Scratch/fr/blog/2010-06-14-multi-language-choices/ - choix liés à l'écriture dans plusieurs langues + choix liés à l'écriture dans plusieurs langues 2010-06-14T14:14:57Z 2010-06-14T14:14:57Z @@ -908,13 +879,13 @@ Vous pouvez le récupérer sur <a href="http://github.com/yogsototh/nanoc3_bl yannesposito.com - <p>Je traduis la plupart de mes articles pour qu’ils soient disponibles en français et en anglais. -La façon que l’on m’a conseillé était d’avoir un fichier par langue. En général ça donne ça.</p> + <p>Je traduis la plupart de mes articles pour qu&rsquo;ils soient disponibles en français et en anglais. +La façon que l&rsquo;on m&rsquo;a conseillé était d&rsquo;avoir un fichier par langue. En général ça donne ça.</p> <pre class="twilight"> Bonjour, -voici un exemple de texte en français. +voici un exemple de texte en français. [image](url) </pre> @@ -925,12 +896,12 @@ here is an example of english text. [image](url) </pre> -<p>Cette façon de traduire vous impose une certaine façon de traduire. -D’abord écrire entièrement le texte dans une langue, +<p>Cette façon de traduire vous impose une certaine façon de traduire. +D&rsquo;abord écrire entièrement le texte dans une langue, puis copier le fichier et enfin retraduire dans une nouvelle langue.</p> -<p>Le problème, c’est que très souvent, les articles ont des parties communes non négligeables. Par exemple, les images, les codes sources, etc… -Lorsque je m’aperçoit que j’ai fait une erreur dans ces parties communes...</p> +<p>Le problème, c&rsquo;est que très souvent, les articles ont des parties communes non négligeables. Par exemple, les images, les codes sources, etc&hellip; +Lorsque je m&...</p> tag:yannesposito.com,2010-05-24:/Scratch/fr/blog/2010-05-24-Trees--Pragmatism-and-Formalism/ @@ -946,29 +917,26 @@ Lorsque je m’aperçoit que j’ai fait une erreur dans ces parties communes... <div class="intro"> -<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span>&nbsp;:</p> +<p><span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span>&nbsp;:</p> <ul> - <li>J’ai essayé de programmer un simple filtre&nbsp;;</li> - <li>J’ai été bloqué pendant deux jours&nbsp;;</li> - <li>J’ai arrêté de penser comme un robot&nbsp;;</li> - <li>J’ai utilisé un papier et un stylo&nbsp;;</li> - <li>J’ai fait un peu de maths&nbsp;;</li> - <li>J’ai résolu le problème en 10 minutes&nbsp;;</li> - <li>Conclusion: Pragmatisme n’est pas&nbsp;: «n’utilisez jamais la théorie». + <li>J&rsquo;ai essayé de programmer un simple filtre&nbsp;;</li> + <li>J&rsquo;ai été bloqué pendant deux jours&nbsp;;</li> + <li>J&rsquo;ai arrêté de penser comme un robot&nbsp;;</li> + <li>J&rsquo;ai utilisé un papier et un stylo&nbsp;;</li> + <li>J&rsquo;ai fait un peu de maths&nbsp;;</li> + <li>J&rsquo;ai résolu le problème en 10 minutes&nbsp;;</li> + <li>Conclusion: Pragmatisme n&rsquo;est pas&nbsp;: &laquo;n&rsquo;utilisez jamais la théorie&raquo;. </div> </ul> -<h2 id="rsum-plus-long-que-le--span-classscabbr-titletrop-long--liretllabbr--span">Résumé (plus long que le <span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span>)</h2> - -<p>Je devais résoudre un problème à mon travail. Au début cela -semblait...</p></div> +<h2 id="rsum-plus-long-que-le--span-classscabbr-titletrop-long--liretllabbr--span">Résumé (plus long que le <span class="sc"><abbr title="Trop long à lire">tlàl</abbr>&nbsp;: </span>)</h2></div> tag:yannesposito.com,2010-05-19:/Scratch/fr/blog/2010-05-19-How-to-cut-HTML-and-repair-it/ - Comment réparer un XML coupé ? + Comment réparer un XML coupé ? 2010-05-19T20:20:34Z 2010-05-19T20:20:34Z @@ -976,7 +944,7 @@ semblait...</p></div> yannesposito.com - <p>Sur ma page d’accueil vous pouvez voir la liste des mes derniers articles avec le début de ceux-ci. Pour arriver à faire ça, j’ai besoin de couper le code XHTML de mes pages en plein milieu. Il m’a donc fallu trouver un moyen de les réparer.</p> + <p>Sur ma page d&rsquo;accueil vous pouvez voir la liste des mes derniers articles avec le début de ceux-ci. Pour arriver à faire ça, j&rsquo;ai besoin de couper le code XHTML de mes pages en plein milieu. Il m&rsquo;a donc fallu trouver un moyen de les réparer.</p> <p>Prenons un exemple&nbsp;:</p> @@ -990,17 +958,16 @@ semblait...</p></div> &lt;/div&gt; </code></pre> -<p>Après avoir coupé, j’obtiens&nbsp;:</p> +<p>Après avoir coupé, j&rsquo;obtiens&nbsp;:</p> <pre><code class="html">&lt;div class="corps"&gt; &lt;div class="intro"&gt; &lt;p&gt;Introduction&lt;/p&gt; - &lt;/div&gt; - &lt;p&gt;The first para...</code></pre> + &lt;/div&g...</code></pre> tag:yannesposito.com,2010-05-17:/Scratch/fr/blog/2010-05-17-at-least-this-blog-revive/ - Je reviens à la vie ! + Je reviens à la vie ! 2010-05-17T11:25:51Z 2010-05-17T11:25:51Z @@ -1008,20 +975,18 @@ semblait...</p></div> yannesposito.com - <p>Bonjour à tous&nbsp;!</p> + <p>Bonjour à tous&nbsp;!</p> <blockquote cite="http://www.madore.org/~david/weblog/2010-05.html#d.2010-05-12.1752"> - <p>…plus on retarde quelque chose, plus il devient difficile de s’y mettre…</p> + <p>&hellip;plus on retarde quelque chose, plus il devient difficile de s&rsquo;y mettre&hellip;</p> </blockquote> -<p>Je devais écrire d’autres articles pour ce blog. J’ai noté plein d’idées dans mes <em>todolist</em>. Mais j’avais pas mal d’autres choses à faire. Et jusqu’ici, j’ai toujours dit «je le ferai plus tard». Ce qui m’a fait agir, c’est la petite réflexion que j’avais lu une fois. -&gt; Arrétez d’écrire des <code>TODO</code> dans votre code est faites le maintenant&nbsp;!<br /> -&gt; Vous serez surpris de l’efficacité de cette mesure.</p> +<p>Je devais écrire d&rsquo;autres articles pour ce blog. J&rsquo;ai noté plein d&rsquo;idées dans mes <em>todolist</em>. Mais j&rsquo;avais pas mal d&rsquo;autres choses à faire. Et jusqu&rsquo;ici, j&rsquo;ai toujours dit &laquo;je le ferai plus tard&raquo;. Ce qui m&rsquo;a fait agir, c&rsquo;est la petite réflexion que j&rsquo;avais lu une fois. +&gt; Arrétez d&rsquo;écrire des <code>TODO</code> dans votre code est faites le maintenant&nbsp;!<br /> +&gt; Vous serez surpris de l&rsquo;efficacité de cette mesure.</p> -<p>En résumé&nbsp;: -&gt; <strong>Just do it!</strong> ou <strong>Juste fait le</strong> comme auraient dit les nuls.</p> - -<p>Finallement j’écri...</p></p> +<p>En résumé&nbsp;: +&gt; </p></p> tag:yannesposito.com,2010-03-23:/Scratch/fr/blog/2010-03-23-Encapsulate-git/ @@ -1035,19 +1000,18 @@ semblait...</p></div> <p><span class="intro"> Voici une solution pour conserver des branches divergentes avec <code>git</code>. -Parce qu’il est facile de <em>merger</em> par erreur, je propose un script qui encapsule le comportement de <code>git</code> pour interdire certains <em>merges</em> dangereux. Mais qui permet aussi de faire des merges en cascades de la racines vers les autres branches. +Parce qu&rsquo;il est facile de <em>merger</em> par erreur, je propose un script qui encapsule le comportement de <code>git</code> pour interdire certains <em>merges</em> dangereux. Mais qui permet aussi de faire des merges en cascades de la racines vers les autres branches. </span></p> -<h2 id="se-prmunir-contre-les-erreurs">Se prémunir contre les erreurs</h2> +<h2 id="se-prmunir-contre-les-erreurs">Se prémunir contre les erreurs</h2> -<p>Je travaille sur un projet dans lequel certaines de mes branches <code>git</code> doivent rester divergentes. Et les divergences devraient aller en s’accentuant.</p> +<p>Je travaille sur un projet dans lequel certaines de mes branches <code>git</code> doivent rester divergentes. Et les divergences devraient aller en s&rsquo;accentuant.</p> -<p>J’utilise aussi certaines branches qui contiennent la partie commune de ces projets.</p> +<p>J&rsquo;utilise aussi certaines branches qui contiennent la partie commune de ces projets.</p> -<p>Disons que j’ai les branches&nbsp;:</p> +<p>Disons que j&rsquo;ai les branches&nbsp;:</p> -<ul> - <li>master: commun...</li></ul> +... tag:yannesposito.com,2010-03-22:/Scratch/fr/blog/2010-03-22-Git-Tips/ @@ -1059,9 +1023,9 @@ Parce qu’il est facile de <em>merger</em> par erreur, je propose u yannesposito.com - <h2 class="first" id="cloner-de-github--travers-un-pare-feu">Cloner de github à travers un pare-feu</h2> + <h2 class="first" id="cloner-de-github--travers-un-pare-feu">Cloner de github à travers un pare-feu</h2> -<p>La façon standard:</p> +<p>La façon standard:</p> <div> @@ -1081,18 +1045,17 @@ Parce qu’il est facile de <em>merger</em> par erreur, je propose u <h2 id="cloner-toutes-les-branches">Cloner toutes les branches</h2> -<p><code>git clone</code> peut seulement récuper la branche <code>master</code>.</p> +<p><code>git clone</code> peut seulement récuper la branche <code>master</code>.</p> -<p>Si vous n’avez pas beaucoup de branches, vous pouvez simplement les clone le project et ensuite pour chacune d’entre elle lancer la commande suivante&nbsp;:</p> +<p>Si vous n&rsquo;avez pas beaucoup de branches, vous pouvez simplement les clone le project et ensuite pour chacune d&rsquo;entre elle lancer la commande suivante&nbsp;:</p> <div> -<pre><code class="zsh">git branch --track local_branch remote_branch -</code></pre></div> +<pre><code class="zsh">git branch --track local_branch remote_bran...</code></pre></div> tag:yannesposito.com,2010-02-23:/Scratch/fr/blog/2010-02-23-When-regexp-is-not-the-best-solution/ - Quand se passer des expressions régulières ? + Quand se passer des expressions régulières ? 2010-02-23T08:09:52Z 2010-02-23T08:09:52Z @@ -1100,10 +1063,10 @@ Parce qu’il est facile de <em>merger</em> par erreur, je propose u yannesposito.com - <p>Les expressions régulières sont très utiles. Cependant, elles ne sont pas toujours la meilleure manière d’aborder certain problème autour des chaines de caractères. + <p>Les expressions régulières sont très utiles. Cependant, elles ne sont pas toujours la meilleure manière d&rsquo;aborder certain problème autour des chaines de caractères. Et surtout quand les transformations que vous voulez accomplir sont simples.</p> -<p>Je voulais savoir comment récupérer le plus vite possible l’extension d’un nom de fichier. Il y a trois manière naturelle d’accomplir celà&nbsp;:</p> +<p>Je voulais savoir comment récupérer le plus vite possible l&rsquo;extension d&rsquo;un nom de fichier. Il y a trois manière naturelle d&rsquo;accomplir celà&nbsp;:</p> <div> @@ -1120,11 +1083,11 @@ ext=File.extname(str) </div> -<p>A première vue, je pensais que l’expression régulière serait plus rapide que le <code>split</code> parce qu’il pouvait y avoir plusieurs de <code>.</code> dans un nom de fichier. Mais la majorité du temps il n’y a qu’un seul ...</p> +<p>A première vue, je pensais que l&rsquo;expression régulière serait plus rapide que le <code>split</code> parce qu&rsquo;il pouvait y avoir plusieurs de <code>.</code> dans un nom de fichie...</p> tag:yannesposito.com,2010-02-18:/Scratch/fr/blog/2010-02-18-split-a-file-by-keyword/ - découper un fichier par mots clés + découper un fichier par mots clés 2010-02-18T13:29:14Z 2010-02-18T13:29:14Z @@ -1132,9 +1095,9 @@ ext=File.extname(str) yannesposito.com - <p>Assez bizarrement, je n’ai trouvé aucun outil UNIX pour découper un fichier par mot clé. -Alors j’en ai fait un en <code>awk</code>. Je le met ici principalement pour moi, mais ça peut toujours servir à quelqu’un d’autre. -Le code suivant découpe un fichier pour chacune de ses ligne contenant le mot <code>UTC</code>.</p> + <p>Assez bizarrement, je n&rsquo;ai trouvé aucun outil UNIX pour découper un fichier par mot clé. +Alors j&rsquo;en ai fait un en <code>awk</code>. Je le met ici principalement pour moi, mais ça peut toujours servir à quelqu&rsquo;un d&rsquo;autre. +Le code suivant découpe un fichier pour chacune de ses ligne contenant le mot <code>UTC</code>.</p> <div> @@ -1149,17 +1112,15 @@ BEGIN{i=0;} </div> -<p>En réalité, j’avais besoin de cet outils pour avoir un fichier par jour. Chaque ligne contenant UTC ayant le format suivant&nbsp;:</p> +<p>En réalité, j&rsquo;avais besoin de cet outils pour avoir un fichier par jour. Chaque ligne contenant UTC ayant le format suivant&nbsp;:</p> <pre class="twilight"> Mon Dec 7 10:32:30 UTC 2009 </pre> -<p>J’en suis finallement arrivé au code suivant&nbsp;:</p> +<p>J&rsquo;en suis finallement arrivé au code suivant&nbsp;:</p> <div> - -<pre><code class="perl">#!/usr/bin/env awk -B...</code></pre></div> +...</div> diff --git a/output/Scratch/js/index.js b/output/Scratch/js/index.js index ff3f960f3..4d804e8c9 100644 --- a/output/Scratch/js/index.js +++ b/output/Scratch/js/index.js @@ -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('
'+msgh1+'
'); - $('#blackpage').prepend('
'+msgh2+'
'); - $('#blackpage').append('
'+msgintro+'
'); -}); +// $(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('
'+msgh1+'
'); +// $('#blackpage').prepend('
'+msgh2+'
'); +// $('#blackpage').append('
'+msgintro+'
'); +// }); // 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(''); - } + 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(''); + } else { + $('head').append(''); + } +}); + // --- Google Analytics --- if ( ! $.cookie('admin') ) { diff --git a/output/Scratch/sitemap.xml b/output/Scratch/sitemap.xml index 2e37f12cf..0e8599d6e 100644 --- a/output/Scratch/sitemap.xml +++ b/output/Scratch/sitemap.xml @@ -1,771 +1,775 @@ - http://yannesposito.com/Scratch/sitemap.xml - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/04_drm/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2011-01-03-Happy-New-Year/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2009-09-Disqus-versus-Intense-Debate--Why-I-switched-/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/A-more-convenient-diff/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-08-23-Now-heberged-on-heroku/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/10_Synchronize_Custom_WebSite_with_mobileMe/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2009-09-jQuery-Tag-Cloud/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-06-17-track-events-with-google-analytics/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-01-12-antialias-font-in-Firefox-under-Ubuntu/ - 2012-10-11 + http://yannesposito.com/Scratch/fr/blog/2010-07-09-Indecidabilities/ + 2012-12-19 http://yannesposito.com/Scratch/en/blog/2009-10-Wait-to-hide-a-menu-in-jQuery/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-10-26-LaTeX-like-macro-and-markdown/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2009-12-06-iphone-call-filter/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/03_losthighway/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/11_Load_Disqus_Asynchronously/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-07-31-New-style-after-holidays/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/Yesod-tutorial-for-newbies/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2009-10-launch-daemon-from-command-line/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-06-14-multi-language-choices/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2011-04-20-Now-hosted-on-github/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-08-31-send-mail-from-command-line-with-attached-file/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-10-06-New-Blog-Design-Constraints/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/Haskell-Mandelbrot/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/Haskell-OpenGL-Mandelbrot/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/02_ackgrep/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/01_nanoc/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/05_git_create_remote_branch/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-07-07-CSS-rendering-problems-by-navigator/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/08_Configure_ssh_to_listen_the_port_443_on_Snow_Leopard/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/mvc/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/07_Screensaver_compilation_option_for_Snow_Leopard/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-10-10-Secure-eMail-on-Mac-in-few-steps/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-05-19-How-to-cut-HTML-and-repair-it/ - 2012-10-11 + 2012-12-19 http://yannesposito.com/Scratch/en/blog/2009-09-replace-all-except-some-part/ - 2012-10-11 + 2012-12-19 - http://yannesposito.com/Scratch/en/blog/2009-10-How-to-preload-your-site-with-style/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-10-14-Fun-with-wav/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/09_Why_I_didn-t_keep_whosamung-us/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2009-10-28-custom-website-synchronisation-with-mobileme--2-/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-02-15-All-but-something-regexp/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-09-02-Use-git-to-calculate-trusted-mtimes/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-09-02-base64-and-sha1-on-iPhone/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/SVG-and-m4-fractals/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/Higher-order-function-in-zsh/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-06-19-jQuery-popup-the-easy-way/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-01-04-Change-default-shell-on-Mac-OS-X/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-06-15-Get-my-blog-engine/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/06_How_I_use_git/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2009-12-14-Git-vs--Bzr/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/Password-Management/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-07-05-Cappuccino-and-Web-applications/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/Category-Theory-Programming/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/Typography-and-the-Web/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/Yesod-excellent-ideas/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2009-10-Focus-vs-Minimalism/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-05-24-Trees--Pragmatism-and-Formalism/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/programming-language-experience/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2009-11-12-Git-for-n00b/c-est-parti-pour-l-aventure/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2009-11-12-Git-for-n00b/comprendre/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2009-11-12-Git-for-n00b/Git-pour-quoi-faire/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2009-11-12-Git-for-n00b/conf-et-install/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2009-11-12-Git-for-n00b/commandes-avancees/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2009-10-30-How-to-handle-evil-IE/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2009-11-12-Git-for-n00b/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-03-23-Encapsulate-git/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-02-16-All-but-something-regexp--2-/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-03-22-Git-Tips/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/Haskell-the-Hard-Way/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-02-18-split-a-file-by-keyword/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/03_losthighway/03_losthighway_3/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/03_losthighway/03_losthighway_2/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/03_losthighway/03_losthighway_1/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/03_losthighway/03_losthighway_4/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2011-01-03-Why-I-sadly-won-t-use-coffeescript/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-05-17-at-least-this-blog-revive/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-06-17-hide-yourself-to-analytics/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-07-09-Indecidabilities/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2009-10-untaught-git-usage/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/2010-02-23-When-regexp-is-not-the-best-solution/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/about/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/latest/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/rss/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/softwares/ypassword/iphoneweb/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/softwares/ypassword/web/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/softwares/ypassword/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/softwares/yclock/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/softwares/yaquabubbles/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/softwares/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/validation/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/about/old/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/about/technical_details/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/about/contact/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/04_drm/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2011-01-03-Happy-New-Year/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2009-09-Disqus-versus-Intense-Debate--Why-I-switched-/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/A-more-convenient-diff/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-08-23-Now-heberged-on-heroku/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/10_Synchronize_Custom_WebSite_with_mobileMe/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2009-09-jQuery-Tag-Cloud/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-06-17-track-events-with-google-analytics/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-01-12-antialias-font-in-Firefox-under-Ubuntu/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2009-10-Wait-to-hide-a-menu-in-jQuery/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-10-26-LaTeX-like-macro-and-markdown/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2009-12-06-iphone-call-filter/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/03_losthighway/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/11_Load_Disqus_Asynchronously/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-07-31-New-style-after-holidays/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/Yesod-tutorial-for-newbies/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2009-10-launch-daemon-from-command-line/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-06-14-multi-language-choices/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2011-04-20-Now-hosted-on-github/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-08-31-send-mail-from-command-line-with-attached-file/ - 2012-10-11 + http://yannesposito.com/Scratch/en/blog/2010-05-19-How-to-cut-HTML-and-repair-it/ + 2012-12-19 http://yannesposito.com/Scratch/fr/blog/2010-10-06-New-Blog-Design-Constraints/ - 2012-10-11 + 2012-12-19 - http://yannesposito.com/Scratch/fr/blog/Haskell-Mandelbrot/ - 2012-10-11 + http://yannesposito.com/Scratch/en/blog/2010-09-02-base64-and-sha1-on-iPhone/ + 2012-12-19 - http://yannesposito.com/Scratch/fr/blog/Haskell-OpenGL-Mandelbrot/ - 2012-10-11 + http://yannesposito.com/Scratch/en/blog/2009-12-14-Git-vs--Bzr/ + 2012-12-19 - http://yannesposito.com/Scratch/fr/blog/02_ackgrep/ - 2012-10-11 + http://yannesposito.com/Scratch/en/blog/2010-10-06-New-Blog-Design-Constraints/ + 2012-12-19 - http://yannesposito.com/Scratch/fr/blog/01_nanoc/ - 2012-10-11 + http://yannesposito.com/Scratch/en/blog/2010-06-17-track-events-with-google-analytics/ + 2012-12-19 - http://yannesposito.com/Scratch/fr/blog/05_git_create_remote_branch/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-07-07-CSS-rendering-problems-by-navigator/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/08_Configure_ssh_to_listen_the_port_443_on_Snow_Leopard/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/mvc/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/07_Screensaver_compilation_option_for_Snow_Leopard/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-10-10-Secure-eMail-on-Mac-in-few-steps/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-05-19-How-to-cut-HTML-and-repair-it/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2009-09-replace-all-except-some-part/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2009-10-How-to-preload-your-site-with-style/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-10-14-Fun-with-wav/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/09_Why_I_didn-t_keep_whosamung-us/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2009-10-28-custom-website-synchronisation-with-mobileme--2-/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-02-15-All-but-something-regexp/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-09-02-Use-git-to-calculate-trusted-mtimes/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-09-02-base64-and-sha1-on-iPhone/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/SVG-and-m4-fractals/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/Higher-order-function-in-zsh/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-06-19-jQuery-popup-the-easy-way/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-01-04-Change-default-shell-on-Mac-OS-X/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-06-15-Get-my-blog-engine/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/06_How_I_use_git/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2009-12-14-Git-vs--Bzr/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/Password-Management/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-07-05-Cappuccino-and-Web-applications/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/Category-Theory-Programming/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/Learn-Vim-Progressively/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/Typography-and-the-Web/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/Yesod-excellent-ideas/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2009-10-Focus-vs-Minimalism/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-05-24-Trees--Pragmatism-and-Formalism/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/programming-language-experience/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2009-11-12-Git-for-n00b/c-est-parti-pour-l-aventure/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2009-11-12-Git-for-n00b/comprendre/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2009-11-12-Git-for-n00b/Git-pour-quoi-faire/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2009-11-12-Git-for-n00b/conf-et-install/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2009-11-12-Git-for-n00b/commandes-avancees/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2009-10-30-How-to-handle-evil-IE/ - 2012-10-11 + http://yannesposito.com/Scratch/en/blog/11_Load_Disqus_Asynchronously/ + 2012-12-19 http://yannesposito.com/Scratch/fr/blog/2009-11-12-Git-for-n00b/ - 2012-10-11 + 2012-12-19 - http://yannesposito.com/Scratch/fr/blog/2010-03-23-Encapsulate-git/ - 2012-10-11 + http://yannesposito.com/Scratch/en/blog/Category-Theory-Presentation/ + 2012-12-19 - http://yannesposito.com/Scratch/fr/blog/2010-02-16-All-but-something-regexp--2-/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-03-22-Git-Tips/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/Haskell-the-Hard-Way/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-02-18-split-a-file-by-keyword/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/03_losthighway/03_losthighway_3/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/03_losthighway/03_losthighway_2/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/03_losthighway/03_losthighway_1/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/03_losthighway/03_losthighway_4/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2011-01-03-Why-I-sadly-won-t-use-coffeescript/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-05-17-at-least-this-blog-revive/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-06-17-hide-yourself-to-analytics/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-07-09-Indecidabilities/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2009-10-untaught-git-usage/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/2010-02-23-When-regexp-is-not-the-best-solution/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/about/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/latest/ - 2012-10-11 + http://yannesposito.com/Scratch/en/blog/2010-03-23-Encapsulate-git/ + 2012-12-19 http://yannesposito.com/Scratch/fr/rss/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/softwares/ypassword/iphoneweb/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/softwares/ypassword/web/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/softwares/ypassword/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/softwares/yclock/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/softwares/yaquabubbles/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/softwares/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/validation/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/about/old/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/about/technical_details/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/about/contact/ - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/ - 2012-10-11 - - - http://yannesposito.com/ - 2012-10-11 - - - http://yannesposito.com/Scratch/en/blog/feed/feed.xml - 2012-10-11 - - - http://yannesposito.com/Scratch/fr/blog/feed/feed.xml - 2012-10-11 + 2012-12-19 http://yannesposito.com/Scratch/assets/css/main.css - 2012-10-11 + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/about/contact/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/softwares/yaquabubbles/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2011-04-20-Now-hosted-on-github/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2009-11-12-Git-for-n00b/conf-et-install/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/Higher-order-function-in-zsh/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/04_drm/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/03_losthighway/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2010-02-18-split-a-file-by-keyword/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/Higher-order-function-in-zsh/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-08-23-Now-heberged-on-heroku/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2009-10-30-How-to-handle-evil-IE/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/07_Screensaver_compilation_option_for_Snow_Leopard/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/02_ackgrep/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/softwares/ypassword/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2010-05-17-at-least-this-blog-revive/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/validation/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/03_losthighway/03_losthighway_4/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/softwares/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/mvc/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/Learn-Vim-Progressively/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-10-26-LaTeX-like-macro-and-markdown/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-08-31-send-mail-from-command-line-with-attached-file/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2010-02-23-When-regexp-is-not-the-best-solution/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2010-02-16-All-but-something-regexp--2-/ + 2012-12-19 + + + http://yannesposito.com/Scratch/assets/css/cmu.css + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/Haskell-the-Hard-Way/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2010-06-19-jQuery-popup-the-easy-way/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/03_losthighway/03_losthighway_1/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/03_losthighway/03_losthighway_2/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/softwares/ypassword/iphoneweb/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/Yesod-excellent-ideas/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2011-01-03-Happy-New-Year/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-06-14-multi-language-choices/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-02-18-split-a-file-by-keyword/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/about/old/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2010-08-31-send-mail-from-command-line-with-attached-file/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2011-01-03-Why-I-sadly-won-t-use-coffeescript/ + 2012-12-19 + + + http://yannesposito.com/Scratch/sitemap.xml + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/Yesod-tutorial-for-newbies/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2009-12-06-iphone-call-filter/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/Password-Management/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2011-01-03-Why-I-sadly-won-t-use-coffeescript/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-10-10-Secure-eMail-on-Mac-in-few-steps/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/Haskell-Mandelbrot/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/02_ackgrep/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/07_Screensaver_compilation_option_for_Snow_Leopard/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-09-02-Use-git-to-calculate-trusted-mtimes/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-06-17-track-events-with-google-analytics/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2009-09-replace-all-except-some-part/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2009-11-12-Git-for-n00b/c-est-parti-pour-l-aventure/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/mvc/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-09-02-base64-and-sha1-on-iPhone/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2009-11-12-Git-for-n00b/Git-pour-quoi-faire/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2009-09-Disqus-versus-Intense-Debate--Why-I-switched-/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/about/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/09_Why_I_didn-t_keep_whosamung-us/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/latest/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/rss/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/A-more-convenient-diff/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/softwares/ypassword/web/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/feed/feed.xml + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/programming-language-experience/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-10-14-Fun-with-wav/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/05_git_create_remote_branch/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/06_How_I_use_git/ + 2012-12-19 + + + http://yannesposito.com/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/SVG-and-m4-fractals/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2010-10-26-LaTeX-like-macro-and-markdown/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2011-01-03-Happy-New-Year/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2010-10-10-Secure-eMail-on-Mac-in-few-steps/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/about/technical_details/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2010-07-31-New-style-after-holidays/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-02-16-All-but-something-regexp--2-/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-01-04-Change-default-shell-on-Mac-OS-X/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2010-05-24-Trees--Pragmatism-and-Formalism/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-06-17-hide-yourself-to-analytics/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-06-15-Get-my-blog-engine/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-05-17-at-least-this-blog-revive/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-03-23-Encapsulate-git/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2009-10-untaught-git-usage/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2009-11-12-Git-for-n00b/conf-et-install/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/Yesod-excellent-ideas/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/softwares/ypassword/iphoneweb/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/Haskell-OpenGL-Mandelbrot/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/latest/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2010-06-14-multi-language-choices/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-07-05-Cappuccino-and-Web-applications/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2009-12-06-iphone-call-filter/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2009-09-jQuery-Tag-Cloud/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/03_losthighway/03_losthighway_2/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2010-01-04-Change-default-shell-on-Mac-OS-X/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/03_losthighway/03_losthighway_3/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2010-01-12-antialias-font-in-Firefox-under-Ubuntu/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/10_Synchronize_Custom_WebSite_with_mobileMe/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/10_Synchronize_Custom_WebSite_with_mobileMe/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/softwares/ypassword/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-07-07-CSS-rendering-problems-by-navigator/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-06-19-jQuery-popup-the-easy-way/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2009-11-12-Git-for-n00b/commandes-avancees/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/SVG-and-m4-fractals/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2010-02-15-All-but-something-regexp/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2010-06-17-hide-yourself-to-analytics/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2010-07-07-CSS-rendering-problems-by-navigator/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/08_Configure_ssh_to_listen_the_port_443_on_Snow_Leopard/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/01_nanoc/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/softwares/ypassword/web/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/Haskell-the-Hard-Way/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-05-19-How-to-cut-HTML-and-repair-it/ + 2012-12-19 http://yannesposito.com/Scratch/assets/css/dynamic.css - 2012-10-11 + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2010-07-05-Cappuccino-and-Web-applications/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-05-24-Trees--Pragmatism-and-Formalism/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/05_git_create_remote_branch/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/about/technical_details/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/feed/feed.xml + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/Typography-and-the-Web/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/Category-Theory-Presentation/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2009-10-Focus-vs-Minimalism/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/about/contact/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/03_losthighway/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2009-10-Focus-vs-Minimalism/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2010-10-14-Fun-with-wav/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2009-10-How-to-preload-your-site-with-style/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2009-10-28-custom-website-synchronisation-with-mobileme--2-/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/08_Configure_ssh_to_listen_the_port_443_on_Snow_Leopard/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2009-11-12-Git-for-n00b/comprendre/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2009-10-Wait-to-hide-a-menu-in-jQuery/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2010-06-15-Get-my-blog-engine/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/06_How_I_use_git/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2009-12-14-Git-vs--Bzr/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2009-10-launch-daemon-from-command-line/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/01_nanoc/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2009-10-How-to-preload-your-site-with-style/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2010-08-23-Now-heberged-on-heroku/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2010-03-22-Git-Tips/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2010-07-09-Indecidabilities/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/validation/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-07-31-New-style-after-holidays/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-02-23-When-regexp-is-not-the-best-solution/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2009-09-jQuery-Tag-Cloud/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/11_Load_Disqus_Asynchronously/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2009-11-12-Git-for-n00b/comprendre/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/about/old/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-02-15-All-but-something-regexp/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2009-11-12-Git-for-n00b/c-est-parti-pour-l-aventure/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2009-11-12-Git-for-n00b/commandes-avancees/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2011-04-20-Now-hosted-on-github/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/softwares/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/softwares/yclock/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/Haskell-Mandelbrot/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2009-10-30-How-to-handle-evil-IE/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/03_losthighway/03_losthighway_3/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/03_losthighway/03_losthighway_4/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2009-10-launch-daemon-from-command-line/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-01-12-antialias-font-in-Firefox-under-Ubuntu/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2009-11-12-Git-for-n00b/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/03_losthighway/03_losthighway_1/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2009-10-untaught-git-usage/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/Haskell-OpenGL-Mandelbrot/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/09_Why_I_didn-t_keep_whosamung-us/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/programming-language-experience/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2009-10-28-custom-website-synchronisation-with-mobileme--2-/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/softwares/yclock/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/A-more-convenient-diff/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/Typography-and-the-Web/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/04_drm/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/Password-Management/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/softwares/yaquabubbles/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/Yesod-tutorial-for-newbies/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/blog/2010-03-22-Git-Tips/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2009-11-12-Git-for-n00b/Git-pour-quoi-faire/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2010-09-02-Use-git-to-calculate-trusted-mtimes/ + 2012-12-19 + + + http://yannesposito.com/Scratch/en/blog/2009-09-Disqus-versus-Intense-Debate--Why-I-switched-/ + 2012-12-19 + + + http://yannesposito.com/Scratch/fr/about/ + 2012-12-19 diff --git a/output/index.html b/output/index.html index f180320e5..cdd8c75d0 100644 --- a/output/index.html +++ b/output/index.html @@ -10,9 +10,6 @@ - - - @@ -24,7 +21,7 @@ @@ -65,7 +62,7 @@    - + Latest » @@ -84,7 +81,7 @@    - + Dernier article » @@ -95,7 +92,7 @@

Curriculum Vitæ »

Enseignement »

- Presentation drawing + Presentation drawing

@@ -110,7 +107,7 @@ Copyright ©, Yann Esposito
- Modified: 10/11/2012 + Modified: 12/19/2012
Entirely done with @@ -122,4 +119,7 @@
+ + + \ No newline at end of file diff --git a/output/keynote/categories.html b/output/keynote/categories.html new file mode 100644 index 000000000..e40a038d5 --- /dev/null +++ b/output/keynote/categories.html @@ -0,0 +1,1119 @@ + + + + + + + + Category Theory for Programming + + + + + + + + + + + + + + + + + + + + + + + + + +
+\(\newcommand{\F}{\mathbf{F}}\) +\(\newcommand{\E}{\mathbf{E}}\) +\(\newcommand{\C}{\mathcal{C}}\) +\(\newcommand{\D}{\mathcal{D}}\) +\(\newcommand{\id}{\mathrm{id}}\) +\(\newcommand{\ob}[1]{\mathrm{ob}(#1)}\) +\(\newcommand{\hom}[1]{\mathrm{hom}(#1)}\) +\(\newcommand{\Set}{\mathbf{Set}}\) +\(\newcommand{\Mon}{\mathbf{Mon}}\) +\(\newcommand{\Vec}{\mathbf{Vec}}\) +\(\newcommand{\Grp}{\mathbf{Grp}}\) +\(\newcommand{\Rng}{\mathbf{Rng}}\) +\(\newcommand{\ML}{\mathbf{ML}}\) +\(\newcommand{\Hask}{\mathbf{Hask}}\) +\(\newcommand{\Cat}{\mathbf{Cat}}\) +\(\newcommand{\fmap}{\mathtt{fmap}}\) +
+ + + +
+
+

Category Theory & Programming

+
for Rivieria Scala Clojure (Note this presentation uses Haskell)
+by Yann Esposito +
+ + @yogsototh, + + + +yogsototh + +
+
+
ENTER FULLSCREEN
+ HTML presentation: use arrows, space, swipe to navigate. +
+
+
+
+

Plan

+
    +
  • General overview
  • +
  • Definitions
  • +
  • Applications
  • +
+
+
+

Not really about: Cat & glory

+
+Cat n glory
credit to Tokuhiro Kawai (川井徳寛)
+
+ + +
+
+

General Overview

+
+Samuel Eilenberg Saunders Mac Lane +
+ +

Recent Math Field
1942-45, Samuel Eilenberg & Saunders Mac Lane

+

Certainly one of the more abstract branches of math

+
    +
  • New math foundation
    formalism abstraction, package entire theory
  • +
  • Bridge between disciplines
    Physics, Quantum Physics, Topology, Logic, Computer Science
  • +
+

+★: When is one thing equal to some other thing?, Barry Mazur, 2007
☆: Physics, Topology, Logic and Computation: A Rosetta Stone, John C. Baez, Mike Stay, 2009 +

+ + +
+
+

From a Programmer perspective

+
+

Category Theory is a new language/framework for Math

+
+
    +
  • Another way of thinking
  • +
  • Extremely efficient for generalization
  • +
+
+
+

Math Programming relation

+Buddha Fractal +

Programming is doing Math

+

Strong relations between type theory and category theory.

+

Not convinced?
Certainly a vocabulary problem.

+

One of the goal of Category Theory is to create a homogeneous vocabulary between different disciplines.

+
+
+

Vocabulary

+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, ...

+
+
+
+

Programmer Translation

+lolcat + + + + + + + + +
+Mathematician + +Programmer +
+Morphism + +Arrow +
+Monoid + +String-like +
+Preorder + +Acyclic graph +
+Isomorph + +The same +
+Natural transformation + +rearrangement function +
+Funny Category + +LOLCat +
+ + +
+
+

Plan

+
    +
  • General overview
  • +
  • Definitions +
      +
    • Category
    • +
    • Intuition
    • +
    • Examples
    • +
    • Functor
    • +
    • Examples
    • +
    +
  • +
  • Applications
  • +
+
+
+

Category

+ +

A way of representing things and ways to go between things.

+ +

A Category \(\mathcal{C}\) is defined by:

+
    +
  • Objects \(\ob{C}\),
  • +
  • Morphisms \(\hom{C}\),
  • +
  • a Composition law (∘)
  • +
  • obeying some Properties.
  • +
+
+
+

Category: Objects

+ +objects + +

\(\ob{\mathcal{C}}\) is a collection

+
+
+

Category: Morphisms

+ +morphisms + +

\(A\) and \(B\) objects of \(\C\)
+\(\hom{A,B}\) is a collection of morphisms
+\(f:A→B\) denote the fact \(f\) belongs to \(\hom{A,B}\)

+

\(\hom{\C}\) the collection of all morphisms of \(\C\)

+
+
+

Category: Composition

+

Composition (∘): associate to each couple \(f:A→B, g:B→C\) + $$g∘f:A\rightarrow C$$ +

+composition +
+
+

Category laws: neutral element

+

for each object \(X\), there is an \(\id_X:X→X\),
+such that for each \(f:A→B\):

+identity +
+
+

Category laws: Associativity

+

Composition is associative:

+associative composition +
+
+

Commutative diagrams

+ +

Two path with the same source and destination are equal.

+
+ Commutative Diagram (Associativity) +
+ \((h∘g)∘f = h∘(g∘f) \) +
+
+
+ Commutative Diagram (Identity law) +
+ \(id_B∘f = f = f∘id_A \) +
+
+
+
+

Question Time!

+ +
+ +
+- French-only joke - +
+
+
+
+

Can this be a category?

+

\(\ob{\C},\hom{\C}\) fixed, is there a valid ∘?

+
+ Category example 1 +
+ YES +
+
+
+ Category example 2 +
+ no candidate for \(g∘f\) +
NO +
+
+
+ Category example 3 +
+ YES +
+
+
+
+

Can this be a category?

+
+ Category example 4 +
+ no candidate for \(f:C→B\) +
NO +
+
+
+ Category example 5 +
+ \((h∘g)∘f=\id_B∘f=f\)
+ \(h∘(g∘f)=h∘\id_A=h\)
+ but \(h≠f\)
+ NO +
+
+
+
+

Categories Examples

+ +
+Basket of cats +
+- Basket of Cats - +
+
+
+
+

Category \(\Set\)

+ +
    +
  • \(\ob{\Set}\) are all the sets
  • +
  • \(\hom{E,F}\) are all functions from \(E\) to \(F\)
  • +
  • ∘ is functions composition
  • +
+ +
    +
  • \(\ob{\Set}\) is a proper class ; not a set
  • +
  • \(\hom{E,F}\) is a set
  • +
  • \(\Set\) is then a locally small category
  • +
+
+
+

Categories Everywhere?

+Cats everywhere +
    +
  • \(\Mon\): (monoids, monoid morphisms,∘)
  • +
  • \(\Vec\): (Vectorial spaces, linear functions,∘)
  • +
  • \(\Grp\): (groups, group morphisms,∘)
  • +
  • \(\Rng\): (rings, ring morphisms,∘)
  • +
  • Any deductive system T: (theorems, proofs, proof concatenation)
  • +
  • \( \Hask\): (Haskell types, functions, (.) )
  • +
  • ...
  • +
+
+
+

Smaller Examples

+ +

Strings

+Monoids are one object categories +
    +
  • \(\ob{Str}\) is a singleton
  • +
  • \(\hom{Str}\) each string
  • +
  • ∘ is concatenation (++)
  • +
+
    +
  • "" ++ u = u = u ++ ""
  • +
  • (u ++ v) ++ w = u ++ (v ++ w)
  • +
+
+
+

Finite Example?

+ +

Graph

+
+Each graph is a category +
+
    +
  • \(\ob{G}\) are vertices
  • +
  • \(\hom{G}\) each path
  • +
  • ∘ is path concatenation
  • +
+
  • \(\ob{G}=\{X,Y,Z\}\), +
  • \(\hom{G}=\{ε,α,β,γ,αβ,βγ,...\}\) +
  • \(αβ∘γ=αβγ\) +
+
+
+

Number construction

+ +

Each Numbers as a whole category

+Each number as a category +
+
+

Degenerated Categories: Monoids

+ +Monoids are one object categories +

Each Monoid \((M,e,⊙): \ob{M}=\{∙\},\hom{M}=M,\circ = ⊙\)

+

Only one object.

+

Examples:

+
  • (Integer,0,+), (Integer,1,*), +
  • (Strings,"",++), for each a, ([a],[],++) +
+
+
+

Degenerated Categories: Preorders \((P,≤)\)

+ +
  • \(\ob{P}={P}\), +
  • \(\hom{x,y}=\{x≤y\} ⇔ x≤y\), +
  • \((y≤z) \circ (x≤y) = (x≤z) \) +
+ +

At most one morphism between two objects.

+ +preorder category +
+
+

Degenerated Categories: Discrete Categories

+ +Any set can be a category +

Any Set

+

Any set \(E: \ob{E}=E, \hom{x,y}=\{x\} ⇔ x=y \)

+

Only identities

+
+
+

Choice

+

The same object can be seen in many different way as a category.

+

You can choose what are object, morphisms and composition.

+

ex: Str and discrete(Σ*)

+
+
+

Categorical Properties

+ +

Any property which can be expressed in term of category, objects, morphism and composition.

+ +
  • Dual: \(\D\) is \(\C\) with reversed morphisms. +
  • Initial: \(Z\in\ob{\C}\) s.t. \(∀Y∈\ob{\C}, \#\hom{Z,Y}=1\) +
    Unique ("up to isormophism") +
  • Terminal: \(T\in\ob{\C}\) s.t. \(T\) is initial in the dual of \(\C\) +
  • Functor: structure preserving mapping between categories +
  • ... +
+
+
+

Isomorph

+

isomorph cats isomorphism: \(f:A→B\) which can be "undone" i.e.
\(∃g:B→A\), \(g∘f=id_A\) & \(f∘g=id_B\)
in this case, \(A\) & \(B\) are isomorphic.

+

A≌B means A and B are essentially the same.
In Category Theory, = is in fact mostly .
For example in commutative diagrams.

+
+
+

Functor

+ +

A functor is a mapping between two categories. +Let \(\C\) and \(\D\) be two categories. +A functor \(\F\) from \(\C\) to \(\D\):

+
    +
  • Associate objects: \(A\in\ob{\C}\) to \(\F(A)\in\ob{\D}\)
  • +
  • Associate morphisms: \(f:A\to B\) to \(\F(f) : \F(A) \to \F(B)\) + such that +
      +
    • \( \F (\)\(\id_X\)\()= \)\(\id\)\(\vphantom{\id}_{\F(}\)\(\vphantom{\id}_X\)\(\vphantom{\id}_{)} \),
    • +
    • \( \F (\)\(g∘f\)\()= \)\( \F(\)\(g\)\() \)\(\circ\)\( \F(\)\(f\)\() \)
    • +
    +
  • +
+
+
+

Functor Example (ob → ob)

+ +Functor +
+
+

Functor Example (hom → hom)

+ +Functor +
+
+

Functor Example

+ +Functor +
+
+

Endofunctors

+ +

An endofunctor for \(\C\) is a functor \(F:\C→\C\).

+Endofunctor +
+
+

Category of Categories

+ + + +

Categories and functors form a category: \(\Cat\)

+
  • \(\ob{\Cat}\) are categories +
  • \(\hom{\Cat}\) are functors +
  • ∘ is functor composition +
+
+
+

Plan

+
    +
  • General overview
  • +
  • Definitions
  • +
  • Applications +
      +
    • \(\Hask\) category +
    • Functors +
    • Natural transformations +
    • Monads +
    • κατα-morphisms +
    +
  • +
+
+
+

Hask

+ +

Category \(\Hask\):

+ +Haskell Category Representation + +
  • +\(\ob{\Hask} = \) Haskell types +
  • +\(\hom{\Hask} = \) Haskell functions +
  • +∘ = (.) Haskell function composition +
+ +

Forget glitches because of undefined.

+
+
+

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] :: *
+
+
+

Haskell Types

+

Sometimes, the type determine a lot about the function:

+
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 (+1) l
+-- The (+1) force 'a' to be a Num.
+ +

+

★:Theorems for free!, Philip Wadler, 1989

+
+
+

Haskell Functor vs \(\Hask\) Functor

+ +

A Haskell Functor is a type F :: * -> * which belong to the type class Functor ; thus instantiate +fmap :: (a -> b) -> (F a -> F b). + +

& F: \(\ob{\Hask}→\ob{\Hask}\)
& fmap: \(\hom{\Hask}→\hom{\Hask}\) + +

The couple (F,fmap) is a \(\Hask\)'s functor if for any x :: F a:

+
  • fmap id x = x +
  • fmap (f.g) x= (fmap f . fmap g) x +
+
+
+

Haskell Functors Example: Maybe

+ +
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
+
fmap (+1) (Just 1) == Just 2
+fmap (+1) Nothing  == Nothing
+fmap head (Just [1,2,3]) == Just 1
+
+
+

Haskell Functors Example: List

+ +
instance Functor ([]) where
+	fmap :: (a -> b) -> [a] -> [b]
+	fmap = map
+
fmap (+1) [1,2,3]           == [2,3,4]
+fmap (+1) []                == []
+fmap head [[1,2,3],[4,5,6]] == [1,4]
+
+
+

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!"
    • +
  • +
+
+
+

Haskell Functor intuition

+ +

Put normal function inside a container. Ex: list, trees...

+ +Haskell Functor as a box play +

+
+

Haskell Functor properties

+ +

Haskell Functors are:

+ +
  • endofunctors ; \(F:\C→\C\) here \(\C = \Hask\), +
  • a couple (Object,Morphism) in \(\Hask\). +
+
+
+

Functor as boxes

+ +

Haskell functor can be seen as boxes containing all Haskell types and functions. +Haskell types is fractal:

+ +Haskell functor representation +
+
+

Functor as boxes

+ +

Haskell functor can be seen as boxes containing all Haskell types and functions. +Haskell types is fractal:

+ +Haskell functor representation +
+
+

Functor as boxes

+ +

Haskell functor can be seen as boxes containing all Haskell types and functions. +Haskell types is fractal:

+ +Haskell functor representation +
+
+

"Non Haskell" Hask's Functors

+

A simple basic example is the \(id_\Hask\) functor. It simply cannot be expressed as a couple (F,fmap) where

+
    +
  • F::* -> *
  • +
  • fmap :: (a -> b) -> (F a) -> (F b)
  • +
+

Another example:

+
    +
  • F(T)=Int
  • +
  • F(f)=\_->0
  • +
+
+
+

Also Functor inside \(\Hask\)

+

\(\mathtt{[a]}∈\ob{\Hask}\) but is also a category. Idem for Int.

+

length is a Functor from the category [a] to the category Int:

+
    +
  • \(\ob{\mathtt{[a]}}=\{∙\}\)
  • +
  • \(\hom{\mathtt{[a]}}=\mathtt{[a]}\)
  • +
  • \(∘=\mathtt{(++)}\)
  • +
+

+
    +
  • \(\ob{\mathtt{Int}}=\{∙\}\)
  • +
  • \(\hom{\mathtt{Int}}=\mathtt{Int}\)
  • +
  • \(∘=\mathtt{(+)}\)
  • +
+
+
  • id: length [] = 0 +
  • comp: length (l ++ l') = (length l) + (length l') +
+
+
+

Category of \(\Hask\) Endofunctors

+Category of Hask endofunctors +
+
+

Category of Functors

+

If \(\C\) is small (\(\hom{\C}\) is a set). All functors from \(\C\) to some category \(\D\) form the category \(\mathrm{Func}(\C,\D)\).

+
    +
  • \(\ob{\mathrm{Func}(\C,\D)}\): Functors \(F:\C→\D\)
  • +
  • \(\hom{\mathrm{Func}(\C,\D)}\): natural transformations
  • +
  • ∘: Functor composition
  • +
+

\(\mathrm{Func}(\C,\C)\) is the category of endofunctors of \(\C\).

+
+
+

Natural Transformations

+

Let \(F\) and \(G\) be two functors from \(\C\) to \(\D\).

+

Natural transformation commutative diagram A natural transformation: familly η ; \(η_X\in\hom{\D}\) for \(X\in\ob{\C}\) s.t.

+

ex: between Haskell functors; F a -> G a
Rearragement functions only.

+
+ + +
+

Natural Transformation Examples (1/4)

+
data List a = Nil | Cons a (List a)
+toList :: [a] -> List a
+toList [] = Nil
+toList (x:xs) = Cons x (toList xs)
+ +

toList is a natural transformation. It is also a morphism from [] to List in the Category of \(\Hask\) endofunctors.

+natural transformation commutative diagram +
+natural transformation commutative diagram +
+
+
+

Natural Transformation Examples (2/4)

+
data List a = Nil | Cons a (List a)
+toHList :: List a -> [a]
+toHList Nil = []
+toHList (Cons x xs) = x:toHList xs
+ +

toHList is a natural transformation. It is also a morphism from List to [] in the Category of \(\Hask\) endofunctors.

+natural transformation commutative diagram +
+natural transformation commutative diagram
toList . toHList = id & toHList . toList = id &
therefore [] & List are isomorph.
+
+
+
+

Natural Transformation Examples (3/4)

+
toMaybe :: [a] -> Maybe a
+toMaybe [] = Nothing
+toMaybe (x:xs) = Just x
+ +

toMaybe is a natural transformation. It is also a morphism from [] to Maybe in the Category of \(\Hask\) endofunctors.

+natural transformation commutative diagram +
+natural transformation commutative diagram +
+ + +
+
+

Natural Transformation Examples (4/4)

+
mToList :: Maybe a -> [a]
+mToList Nothing = []
+mToList Just x  = [x]
+ +

toMaybe is a natural transformation. It is also a morphism from [] to Maybe in the Category of \(\Hask\) endofunctors.

+natural transformation commutative diagram +
+relation between [] and Maybe
There is no isomorphism.
Hint: Bool lists longer than 1.
+
+ + +
+
+

Composition problem

+

The Problem; example with lists:

+
f x = [x]       ⇒ f 1 = [1]   ⇒ (f.f) 1 = [[1]] ✗
+g x = [x+1]     ⇒ g 1 = [2]   ⇒ (g.g) 1 = ERROR [2]+1 ✗
+h x = [x+1,x*3] ⇒ h 1 = [2,3] ⇒ (h.h) 1 = ERROR [2,3]+1 ✗ 
+ +

The same problem with most f :: a -> F a functions and functor F.

+
+
+

Composition Fixable?

+

How to fix that? We want to construct an operator which is able to compose:

+

f :: a -> F b & g :: b -> F c.

+

More specifically we want to create an operator ◎ of type

+

◎ :: (b -> F c) -> (a -> F b) -> (a -> F c)

+

Note: if F = I, ◎ = (.).

+
+
+

Fix Composition (1/2)

+

Goal, find: ◎ :: (b -> F c) -> (a -> F b) -> (a -> F c)
f :: a -> F b, g :: b -> F c:

+
    +
  • (g ◎ f) x ???
  • +
  • First apply f to xf x :: F b
  • +
  • Then how to apply g properly to an element of type F b?
  • +
+
+
+

Fix Composition (2/2)

+

Goal, find: ◎ :: (b -> F c) -> (a -> F b) -> (a -> F c)
f :: a -> F b, g :: b -> F c, f x :: F b:

+
    +
  • Use fmap :: (t -> u) -> (F t -> F u)!
  • +
  • (fmap g) :: F b -> F (F c) ; (t=b, u=F c)
  • +
  • (fmap g) (f x) :: F (F c) it almost WORKS!
  • +
  • We lack an important component, join :: F (F c) -> F c
  • +
  • (g ◎ f) x = join ((fmap g) (f x))
    ◎ is the Kleisli composition; in Haskell: <=< (in Control.Monad).
  • +
+
+
+

Necessary laws

+

For ◎ to work like composition, we need join to hold the following properties:

+
    +
  • join (join (F (F (F a))))=join (F (join (F (F a))))
  • +
  • abusing notations denoting join by ⊙; this is equivalent to
    (F ⊙ F) ⊙ F = F ⊙ (F ⊙ F)
  • +
  • There exists η :: a -> F a s.t.
    η⊙F=F=F⊙η
  • +
+
+
+

Klesli composition

+

Now the composition works as expected. In Haskell ◎ is <=< in Control.Monad.

+

g <=< f = \x -> join ((fmap g) (f x))

+
f x = [x]       ⇒ f 1 = [1]   ⇒ (f <=< f) 1 = [1] ✓
+g x = [x+1]     ⇒ g 1 = [2]   ⇒ (g <=< g) 1 = [3] ✓
+h x = [x+1,x*3] ⇒ h 1 = [2,3] ⇒ (h <=< h) 1 = [3,6,4,9] ✓
+ + +
+
+

We reinvented Monads!

+

A monad is a triplet (M,⊙,η) where

+
    +
  • \(M\) an Endofunctor (to type a associate M a)
  • +
  • \(⊙:M×M→M\) a nat. trans. (i.e. ⊙::M (M a) → M a ; join)
  • +
  • \(η:I→M\) a nat. trans. (\(I\) identity functor ; η::a → M a)
  • +
+

Satisfying

+
    +
  • \(M ⊙ (M ⊙ M) = (M ⊙ M) ⊙ M\)
  • +
  • \(η ⊙ M = M = M ⊙ η\)
  • +
+
+
+

Compare with Monoid

+

A Monoid is a triplet \((E,∙,e)\) s.t.

+
    +
  • \(E\) a set
  • +
  • \(∙:E×E→E\)
  • +
  • \(e:1→E\)
  • +
+

Satisfying

+
    +
  • \(x∙(y∙z) = (x∙y)∙z, ∀x,y,z∈E\)
  • +
  • \(e∙x = x = x∙e, ∀x∈E\)
  • +
+
+
+

Monads are just Monoids

+
+

A Monad is just a monoid in the category of endofunctors, what's the problem?

+
+

The real sentence was:

+
+

All told, a monad in X is just a monoid in the category of endofunctors of X, with product × replaced by composition of endofunctors and unit set by the identity endofunctor.

+
+
+
+

Example: List

+
    +
  • [] :: * -> * an Endofunctor
  • +
  • \(⊙:M×M→M\) a nat. trans. (join :: M (M a) -> M a)
  • +
  • \(η:I→M\) a nat. trans.
  • +
+
-- In Haskell ⊙ is "join" in "Control.Monad"
+join :: [[a]] -> [a]
+join = concat
+
+-- In Haskell the "return" function (unfortunate name)
+η :: a -> [a]
+η x = [x]
+ + +
+
+

Example: List (law verification)

+

Example: List is a functor (join is ⊙)

+
    +
  • \(M ⊙ (M ⊙ M) = (M ⊙ M) ⊙ M\)
  • +
  • \(η ⊙ M = M = M ⊙ η\)
  • +
+
join [ join [[x,y,...,z]] ] = join [[x,y,...,z]]
+                            = join (join [[[x,y,...,z]]])
+join (η [x]) = [x] = join [η x]
+ +

Therefore ([],join,η) is a monad.

+
+
+

Monads useful?

+

A LOT of monad tutorial on the net. Just one example; the State Monad

+

DrawScene to State Screen DrawScene ; still pure.

+
main = drawImage (width,height)
+
+drawImage :: Screen -> DrawScene
+drawImage screen = do
+    drawPoint p screen
+    drawCircle c screen
+    drawRectangle r screen
+
+drawPoint point screen = ...
+drawCircle circle screen = ...
+drawRectangle rectangle screen = ...
+
main = do
+    put (Screen 1024 768)
+    drawImage
+
+drawImage :: State Screen DrawScene
+drawImage = do
+    drawPoint p
+    drawCircle c
+    drawRectangle r
+
+drawPoint :: Point -> State Screen DrawScene
+drawPoint p = do
+    Screen width height <- get
+    ...
+
+
+

fold

+fold +
+
+

κατα-morphism

+catamorphism +
+
+

κατα-morphism: fold generalization

+

acc type of the "accumulator":
fold :: (acc -> a -> acc) -> acc -> [a] -> acc

+

Idea: put the accumulated value inside the type.

+
-- Equivalent to fold (+1) 0 "cata"
+(Cons 'c' (Cons 'a' (Cons 't' (Cons 'a' Nil))))
+(Cons 'c' (Cons 'a' (Cons 't' (Cons 'a' 0))))
+(Cons 'c' (Cons 'a' (Cons 't' 1)))
+(Cons 'c' (Cons 'a' 2))
+(Cons 'c' 3)
+4
+ + +

But where are all the informations? (+1) and 0?

+
+
+

κατα-morphism: Missing Information

+

Where is the missing information?

+
    +
  • Functor operator fmap
  • +
  • Algebra representing the (+1) and also knowing about the 0.
  • +
+

First example, make length on [Char]

+
+
+

κατα-morphism: Type work

+

+data StrF a = Cons Char a | Nil
+data Str' = StrF Str'
+
+-- generalize the construction of Str to other datatype
+-- Mu: type fixed point
+-- Mu :: (* -> *) -> *
+
+data Mu f = InF { outF :: f (Mu f) }
+data Str = Mu StrF
+
+-- Example
+foo=InF { outF = Cons 'f'
+        (InF { outF = Cons 'o'
+            (InF { outF = Cons 'o'
+                (InF { outF = Nil })})})}
+ + +
+
+

κατα-morphism: missing information retrieved

+
type Algebra f a = f a -> a
+instance Functor (StrF a) =
+    fmap f (Cons c x) = Cons c (f x)
+    fmap _ Nil = Nil
+ +
cata :: Functor f => Algebra f a -> Mu f -> a
+cata f = f . fmap (cata f) . outF
+ + + +
+
+

κατα-morphism: Finally length

+

All needed information for making length.

+
instance Functor (StrF a) =
+    fmap f (Cons c x) = Cons c (f x)
+    fmap _ Nil = Nil
+
+length' :: Str -> Int
+length' = cata phi where
+    phi :: Algebra StrF Int -- StrF Int -> Int
+    phi (Cons a b) = 1 + b
+    phi Nil = 0
+
+main = do
+    l <- length' $ stringToStr "Toto"
+    ...
+
+
+

κατα-morphism: extension to Trees

+

Once you get the trick, it is easy to extent to most Functor.

+
type Tree = Mu TreeF
+data TreeF x = Node Int [x]
+
+instance Functor TreeF where
+  fmap f (Node e xs) = Node e (fmap f xs)
+
+depth = cata phi where
+  phi :: Algebra TreeF Int -- TreeF Int -> Int
+  phi (Node x sons) = 1 + foldr max 0 sons
+
+
+

Conclusion

+

Category Theory oriented Programming:

+
    +
  • Focus on the type and operators
  • +
  • Extreme generalisation
  • +
  • Better modularity
  • +
  • Better control through properties of types
  • +
+

No cat were harmed in the making of this presentation.

+
+ + + + + + + + + + +

+ + / + +

+ + +
+ + + + +
+ + +# + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/output/keynote/categories.pdf b/output/keynote/categories.pdf new file mode 100644 index 000000000..e24379218 Binary files /dev/null and b/output/keynote/categories.pdf differ diff --git a/output/keynote/categories/10_Introduction/010_.html b/output/keynote/categories/10_Introduction/010_.html new file mode 100644 index 000000000..0fa74fc04 --- /dev/null +++ b/output/keynote/categories/10_Introduction/010_.html @@ -0,0 +1,16 @@ +
+

Category Theory & Programming

+by Yann Esposito +
+ + @yogsototh, + + + +yogsototh + +
+
+
ENTER FULLSCREEN
+ HTML presentation: use arrows, space to navigate. +
+
diff --git a/output/keynote/categories/10_Introduction/020_Plan.html b/output/keynote/categories/10_Introduction/020_Plan.html new file mode 100644 index 000000000..482677269 --- /dev/null +++ b/output/keynote/categories/10_Introduction/020_Plan.html @@ -0,0 +1,6 @@ +

Plan

+
    +
  • General overview
  • +
  • Definitions
  • +
  • Applications
  • +
diff --git a/output/keynote/categories/10_Introduction/030_General_Overview.html b/output/keynote/categories/10_Introduction/030_General_Overview.html new file mode 100644 index 000000000..2a86df26b --- /dev/null +++ b/output/keynote/categories/10_Introduction/030_General_Overview.html @@ -0,0 +1,16 @@ +

General Overview

+
+Samuel Eilenberg Saunders Mac Lane +
+ +

Recent Math Field
1942-45, Samuel Eilenberg & Saunders Mac Lane

+

Certainly one of the more abstract branches of math

+
    +
  • New math foundation
    formalism abstraction, package entire theory
  • +
  • Bridge between disciplines
    Physics, Quantum Physics, Topology, Logic, Computer Science
  • +
+

+★: When is one thing equal to some other thing?, Barry Mazur, 2007
☆: Physics, Topology, Logic and Computation: A Rosetta Stone, John C. Baez, Mike Stay, 2009 +

+ + diff --git a/output/keynote/categories/10_Introduction/030_General_Overview.md b/output/keynote/categories/10_Introduction/030_General_Overview.md new file mode 100644 index 000000000..e93599022 --- /dev/null +++ b/output/keynote/categories/10_Introduction/030_General_Overview.md @@ -0,0 +1,20 @@ +General Overview +---------------- + +
+Samuel Eilenberg +Saunders Mac Lane +
+ +_Recent Math Field_ +1942-45, Samuel Eilenberg & Saunders Mac Lane + +Certainly one of the more abstract branches of math + +- _New math foundation_ + formalism abstraction, package entire theory +- _Bridge between disciplines_ + Physics, Quantum Physics, Topology, Logic, Computer Science + +

★: When is one thing equal to some other thing?, Barry Mazur, 2007
+☆: Physics, Topology, Logic and Computation: A Rosetta Stone, John C. Baez, Mike Stay, 2009

diff --git a/output/keynote/categories/10_Introduction/040_From_a_Programmer_perspective.html b/output/keynote/categories/10_Introduction/040_From_a_Programmer_perspective.html new file mode 100644 index 000000000..010f6d024 --- /dev/null +++ b/output/keynote/categories/10_Introduction/040_From_a_Programmer_perspective.html @@ -0,0 +1,4 @@ +

From a Programmer perspective

+
+

Category Theory is a new language/framework for Math

+
diff --git a/output/keynote/categories/10_Introduction/040_From_a_Programmer_perspective.md b/output/keynote/categories/10_Introduction/040_From_a_Programmer_perspective.md new file mode 100644 index 000000000..a6b9aab89 --- /dev/null +++ b/output/keynote/categories/10_Introduction/040_From_a_Programmer_perspective.md @@ -0,0 +1,4 @@ +From a Programmer perspective +---------------- + +> Category Theory is a new language/framework for Math diff --git a/output/keynote/categories/10_Introduction/050_Math_Programming_relation.html b/output/keynote/categories/10_Introduction/050_Math_Programming_relation.html new file mode 100644 index 000000000..42ddab182 --- /dev/null +++ b/output/keynote/categories/10_Introduction/050_Math_Programming_relation.html @@ -0,0 +1,5 @@ +

Math Programming relation

+Buddha Fractal +

Programming is doing Math

+

Not convinced?
Certainly a vocabulary problem.

+

One of the goal of Category Theory is to create a homogeneous vocabulary between different disciplines.

diff --git a/output/keynote/categories/10_Introduction/050_Math_Programming_relation.md b/output/keynote/categories/10_Introduction/050_Math_Programming_relation.md new file mode 100644 index 000000000..90c39b7b3 --- /dev/null +++ b/output/keynote/categories/10_Introduction/050_Math_Programming_relation.md @@ -0,0 +1,11 @@ +Math Programming relation +------------------------- + +Buddha Fractal + +Programming *is* doing Math + +Not convinced? +Certainly a _vocabulary_ problem. + +One of the goal of Category Theory is to create a _homogeneous vocabulary_ between different disciplines. diff --git a/output/keynote/categories/10_Introduction/060_Vocabulary.html b/output/keynote/categories/10_Introduction/060_Vocabulary.html new file mode 100644 index 000000000..f4dda42c1 --- /dev/null +++ b/output/keynote/categories/10_Introduction/060_Vocabulary.html @@ -0,0 +1,6 @@ +

Vocabulary

+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, ...

+
diff --git a/output/keynote/categories/10_Introduction/060_Vocabulary.md b/output/keynote/categories/10_Introduction/060_Vocabulary.md new file mode 100644 index 000000000..36f69599e --- /dev/null +++ b/output/keynote/categories/10_Introduction/060_Vocabulary.md @@ -0,0 +1,23 @@ +Vocabulary +---------- + +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, +> ... diff --git a/output/keynote/categories/10_Introduction/070_Programmer_Translation.html b/output/keynote/categories/10_Introduction/070_Programmer_Translation.html new file mode 100644 index 000000000..6d069908d --- /dev/null +++ b/output/keynote/categories/10_Introduction/070_Programmer_Translation.html @@ -0,0 +1,41 @@ +

Programmer Translation

+lolcat + + + + + + + + +
+Mathematician + +Programmer +
+Morphism + +Arrow +
+Monoid + +String-like +
+Preorder + +Acyclic graph +
+Isomorph + +The same +
+Natural transformation + +rearrangement function +
+Funny Category + +LOLCat +
+ + diff --git a/output/keynote/categories/10_Introduction/070_Programmer_Translation.md b/output/keynote/categories/10_Introduction/070_Programmer_Translation.md new file mode 100644 index 000000000..0132dc098 --- /dev/null +++ b/output/keynote/categories/10_Introduction/070_Programmer_Translation.md @@ -0,0 +1,14 @@ +Programmer Translation +---------------------- + +lolcat + + + + + + + + + +
MathematicianProgrammer
MorphismArrow
MonoidString-like
PreorderAcyclic graph
IsomorphThe same
Natural transformationrearrangement function
Funny CategoryLOLCat
diff --git a/output/keynote/categories/20_What/010_Plan.html b/output/keynote/categories/20_What/010_Plan.html new file mode 100644 index 000000000..52374ca81 --- /dev/null +++ b/output/keynote/categories/20_What/010_Plan.html @@ -0,0 +1,14 @@ +

Plan

+
    +
  • General overview
  • +
  • Definitions +
      +
    • Category
    • +
    • Intuition
    • +
    • Examples
    • +
    • Functor
    • +
    • Examples
    • +
    +
  • +
  • Applications
  • +
diff --git a/output/keynote/categories/20_What/020_Category.html b/output/keynote/categories/20_What/020_Category.html new file mode 100644 index 000000000..0d14873e3 --- /dev/null +++ b/output/keynote/categories/20_What/020_Category.html @@ -0,0 +1,11 @@ +

Category

+ +

A way of representing things and ways to go between things.

+ +

A Category \(\mathcal{C}\) is defined by:

+
    +
  • Objects \(\ob{C}\),
  • +
  • Morphisms \(\hom{C}\),
  • +
  • a Composition law (∘)
  • +
  • obeying some Properties.
  • +
diff --git a/output/keynote/categories/20_What/030_Category_Objects.html b/output/keynote/categories/20_What/030_Category_Objects.html new file mode 100644 index 000000000..90027988f --- /dev/null +++ b/output/keynote/categories/20_What/030_Category_Objects.html @@ -0,0 +1,5 @@ +

Category: Objects

+ +objects + +

\(\ob{\mathcal{C}}\) is a collection

diff --git a/output/keynote/categories/20_What/040_Category_Morphisms.html b/output/keynote/categories/20_What/040_Category_Morphisms.html new file mode 100644 index 000000000..c05024d65 --- /dev/null +++ b/output/keynote/categories/20_What/040_Category_Morphisms.html @@ -0,0 +1,8 @@ +

Category: Morphisms

+ +morphisms + +

\(A\) and \(B\) objects of \(\C\)
+\(\hom{A,B}\) is a collection of morphisms
+\(f:A→B\) denote the fact \(f\) belongs to \(\hom{A,B}\)

+

\(\hom{\C}\) the collection of all morphisms of \(\C\)

diff --git a/output/keynote/categories/20_What/050_Category_Composition.html b/output/keynote/categories/20_What/050_Category_Composition.html new file mode 100644 index 000000000..757748032 --- /dev/null +++ b/output/keynote/categories/20_What/050_Category_Composition.html @@ -0,0 +1,5 @@ +

Category: Composition

+

Composition (∘): associate to each couple \(f:A→B, g:B→C\) + $$g∘f:A\rightarrow C$$ +

+composition diff --git a/output/keynote/categories/20_What/060_Category_laws_neutral_element.html b/output/keynote/categories/20_What/060_Category_laws_neutral_element.html new file mode 100644 index 000000000..1ad9230d3 --- /dev/null +++ b/output/keynote/categories/20_What/060_Category_laws_neutral_element.html @@ -0,0 +1,4 @@ +

Category laws: neutral element

+

for each object \(X\), there is an \(\id_X:X→X\),
+such that for each \(f:A→B\):

+identity diff --git a/output/keynote/categories/20_What/070_Category_laws_Associativity.html b/output/keynote/categories/20_What/070_Category_laws_Associativity.html new file mode 100644 index 000000000..fc5f0f3e6 --- /dev/null +++ b/output/keynote/categories/20_What/070_Category_laws_Associativity.html @@ -0,0 +1,3 @@ +

Category laws: Associativity

+

Composition is associative:

+associative composition diff --git a/output/keynote/categories/20_What/080_Commutative_diagrams.html b/output/keynote/categories/20_What/080_Commutative_diagrams.html new file mode 100644 index 000000000..6a87acfa3 --- /dev/null +++ b/output/keynote/categories/20_What/080_Commutative_diagrams.html @@ -0,0 +1,19 @@ +

Commutative diagrams

+ +

Two path with the same source and destination are equal.

+
+ Commutative Diagram (Associativity) +
+ \((h∘g)∘f = h∘(g∘f) \) +
+
+
+ Commutative Diagram (Identity law) +
+ \(id_B∘f = f = f∘id_A \) +
+
diff --git a/output/keynote/categories/20_What/090_Question_Time.html b/output/keynote/categories/20_What/090_Question_Time.html new file mode 100644 index 000000000..4644358ba --- /dev/null +++ b/output/keynote/categories/20_What/090_Question_Time.html @@ -0,0 +1,8 @@ +

Question Time!

+ +
+ +
+- French-only joke - +
+
diff --git a/output/keynote/categories/20_What/100_Can_this_be_a_category.html b/output/keynote/categories/20_What/100_Can_this_be_a_category.html new file mode 100644 index 000000000..ce793f696 --- /dev/null +++ b/output/keynote/categories/20_What/100_Can_this_be_a_category.html @@ -0,0 +1,21 @@ +

Can this be a category?

+

\(\ob{\C},\hom{\C}\) fixed, is there a valid ∘?

+
+ Category example 1 +
+ YES +
+
+
+ Category example 2 +
+ no candidate for \(g∘f\) +
NO +
+
+
+ Category example 3 +
+ YES +
+
diff --git a/output/keynote/categories/20_What/110_Can_this_be_a_category.html b/output/keynote/categories/20_What/110_Can_this_be_a_category.html new file mode 100644 index 000000000..91d74f872 --- /dev/null +++ b/output/keynote/categories/20_What/110_Can_this_be_a_category.html @@ -0,0 +1,17 @@ +

Can this be a category?

+
+ Category example 4 +
+ no candidate for \(f:C→B\) +
NO +
+
+
+ Category example 5 +
+ \((h∘g)∘f=\id_B∘f=f\)
+ \(h∘(g∘f)=h∘\id_A=h\)
+ but \(h≠f\)
+ NO +
+
diff --git a/output/keynote/categories/20_What/120_Categories_Examples.html b/output/keynote/categories/20_What/120_Categories_Examples.html new file mode 100644 index 000000000..5207c1d14 --- /dev/null +++ b/output/keynote/categories/20_What/120_Categories_Examples.html @@ -0,0 +1,8 @@ +

Categories Examples

+ +
+Basket of cats +
+- Basket of Cats - +
+
diff --git a/output/keynote/categories/20_What/130_Category_Set.html b/output/keynote/categories/20_What/130_Category_Set.html new file mode 100644 index 000000000..99fab688a --- /dev/null +++ b/output/keynote/categories/20_What/130_Category_Set.html @@ -0,0 +1,13 @@ +

Category \(\Set\)

+ +
    +
  • \(\ob{\Set}\) are all the sets
  • +
  • \(\hom{E,F}\) are all functions from \(E\) to \(F\)
  • +
  • ∘ is functions composition
  • +
+ +
    +
  • \(\ob{\Set}\) is a proper class ; not a set
  • +
  • \(\hom{E,F}\) is a set
  • +
  • \(\Set\) is then a locally small category
  • +
diff --git a/output/keynote/categories/20_What/140_Categories_Everywhere.html b/output/keynote/categories/20_What/140_Categories_Everywhere.html new file mode 100644 index 000000000..1d7868709 --- /dev/null +++ b/output/keynote/categories/20_What/140_Categories_Everywhere.html @@ -0,0 +1,11 @@ +

Categories Everywhere?

+Cats everywhere +
    +
  • \(\Mon\): (monoids, monoid morphisms,∘)
  • +
  • \(\Vec\): (Vectorial spaces, linear functions,∘)
  • +
  • \(\Grp\): (groups, group morphisms,∘)
  • +
  • \(\Rng\): (rings, ring morphisms,∘)
  • +
  • Any deductive system T: (theorems, proofs, proof concatenation)
  • +
  • \( \Hask\): (Haskell types, functions, (.) )
  • +
  • ...
  • +
diff --git a/output/keynote/categories/20_What/150_Smaller_Examples.html b/output/keynote/categories/20_What/150_Smaller_Examples.html new file mode 100644 index 000000000..0b1621bc5 --- /dev/null +++ b/output/keynote/categories/20_What/150_Smaller_Examples.html @@ -0,0 +1,13 @@ +

Smaller Examples

+ +

Strings

+Monoids are one object categories +
    +
  • \(\ob{Str}\) is a singleton
  • +
  • \(\hom{Str}\) each string
  • +
  • ∘ is concatenation (++)
  • +
+
    +
  • "" ++ u = u = u ++ ""
  • +
  • (u ++ v) ++ w = u ++ (v ++ w)
  • +
diff --git a/output/keynote/categories/20_What/160_Finite_Example.html b/output/keynote/categories/20_What/160_Finite_Example.html new file mode 100644 index 000000000..a858b350f --- /dev/null +++ b/output/keynote/categories/20_What/160_Finite_Example.html @@ -0,0 +1,15 @@ +

Finite Example?

+ +

Graph

+
+Each graph is a category +
+
    +
  • \(\ob{G}\) are vertices
  • +
  • \(\hom{G}\) each path
  • +
  • ∘ is path concatenation
  • +
+
  • \(\ob{G}=\{X,Y,Z\}\), +
  • \(\hom{G}=\{ε,α,β,γ,αβ,βγ,...\}\) +
  • \(αβ∘γ=αβγ\) +
diff --git a/output/keynote/categories/20_What/170_Number_construction.html b/output/keynote/categories/20_What/170_Number_construction.html new file mode 100644 index 000000000..6e4cf5811 --- /dev/null +++ b/output/keynote/categories/20_What/170_Number_construction.html @@ -0,0 +1,4 @@ +

Number construction

+ +

Each Numbers as a whole category

+Each number as a category diff --git a/output/keynote/categories/20_What/180_Degenerated_Categories_Monoids.html b/output/keynote/categories/20_What/180_Degenerated_Categories_Monoids.html new file mode 100644 index 000000000..3d5c9a94c --- /dev/null +++ b/output/keynote/categories/20_What/180_Degenerated_Categories_Monoids.html @@ -0,0 +1,9 @@ +

Degenerated Categories: Monoids

+ +Monoids are one object categories +

Each Monoid \((M,e,⊙): \ob{M}=\{∙\},\hom{M}=M,\circ = ⊙\)

+

Only one object.

+

Examples:

+
  • (Integer,0,+), (Integer,1,*), +
  • (Strings,"",++), for each a, ([a],[],++) +
diff --git a/output/keynote/categories/20_What/190_Degenerated_Categories_Preorders_P.html b/output/keynote/categories/20_What/190_Degenerated_Categories_Preorders_P.html new file mode 100644 index 000000000..79a395612 --- /dev/null +++ b/output/keynote/categories/20_What/190_Degenerated_Categories_Preorders_P.html @@ -0,0 +1,10 @@ +

Degenerated Categories: Preorders \((P,≤)\)

+ +
  • \(\ob{P}={P}\), +
  • \(\hom{x,y}=\{x≤y\} ⇔ x≤y\), +
  • \((y≤z) \circ (x≤y) = (x≤z) \) +
+ +

At most one morphism between two objects.

+ +preorder category diff --git a/output/keynote/categories/20_What/200_Degenerated_Categories_Discrete_Categories.html b/output/keynote/categories/20_What/200_Degenerated_Categories_Discrete_Categories.html new file mode 100644 index 000000000..517cb4e5e --- /dev/null +++ b/output/keynote/categories/20_What/200_Degenerated_Categories_Discrete_Categories.html @@ -0,0 +1,6 @@ +

Degenerated Categories: Discrete Categories

+ +Any set can be a category +

Any Set

+

Any set \(E: \ob{E}=E, \hom{x,y}=\{x\} ⇔ x=y \)

+

Only identities

diff --git a/output/keynote/categories/20_What/210_Categorical_Properties.html b/output/keynote/categories/20_What/210_Categorical_Properties.html new file mode 100644 index 000000000..b19473883 --- /dev/null +++ b/output/keynote/categories/20_What/210_Categorical_Properties.html @@ -0,0 +1,11 @@ +

Categorical Properties

+ +

Any property which can be expressed in term of category, objects, morphism and composition.

+ +
  • Dual: \(\D\) is \(\C\) with reversed morphisms. +
  • Initial: \(Z\in\ob{\C}\) s.t. \(∀Y∈\ob{\C}, \#\hom{Z,Y}=1\) +
    Unique ("up to isormophism") +
  • Terminal: \(T\in\ob{\C}\) s.t. \(T\) is initial in the dual of \(\C\) +
  • Functor: structure preserving mapping between categories +
  • ... +
diff --git a/output/keynote/categories/20_What/220_Isomorph.html b/output/keynote/categories/20_What/220_Isomorph.html new file mode 100644 index 000000000..52bf553c0 --- /dev/null +++ b/output/keynote/categories/20_What/220_Isomorph.html @@ -0,0 +1,3 @@ +

Isomorph

+

isomorph cats isomorphism: \(f:A→B\) which can be "undone" i.e.
\(∃g:B→A\), \(g∘f=id_A\) & \(f∘g=id_B\)
in this case, \(A\) & \(B\) are isomorphic.

+

A≌B means A and B are essentially the same.
In Category Theory, = is in fact mostly .
For example in commutative diagrams.

diff --git a/output/keynote/categories/20_What/220_Isomorph.md b/output/keynote/categories/20_What/220_Isomorph.md new file mode 100644 index 000000000..c73e1de77 --- /dev/null +++ b/output/keynote/categories/20_What/220_Isomorph.md @@ -0,0 +1,11 @@ +Isomorph +-------- +isomorph cats +isomorphism: +\\(f:A→B\\) which can be "undone" _i.e._ +\\(∃g:B→A\\), \\(g∘f=id\_A\\) & \\(f∘g=id\_B\\) +in this case, \\(A\\) & \\(B\\) are isomorphic. + +A≌B means A and B are essentially the same. +In Category Theory, = is in fact mostly . +For example in commutative diagrams. diff --git a/output/keynote/categories/20_What/230_Functor.html b/output/keynote/categories/20_What/230_Functor.html new file mode 100644 index 000000000..29d7d20b2 --- /dev/null +++ b/output/keynote/categories/20_What/230_Functor.html @@ -0,0 +1,15 @@ +

Functor

+ +

A functor is a mapping between two categories. +Let \(\C\) and \(\D\) be two categories. +A functor \(\F\) from \(\C\) to \(\D\):

+
    +
  • Associate objects: \(A\in\ob{\C}\) to \(\F(A)\in\ob{\D}\)
  • +
  • Associate morphisms: \(f:A\to B\) to \(\F(f) : \F(A) \to \F(B)\) + such that +
      +
    • \( \F (\)\(\id_X\)\()= \)\(\id\)\(\vphantom{\id}_{\F(}\)\(\vphantom{\id}_X\)\(\vphantom{\id}_{)} \),
    • +
    • \( \F (\)\(g∘f\)\()= \)\( \F(\)\(g\)\() \)\(\circ\)\( \F(\)\(f\)\() \)
    • +
    +
  • +
diff --git a/output/keynote/categories/20_What/240_Functor_Example_ob_ob.html b/output/keynote/categories/20_What/240_Functor_Example_ob_ob.html new file mode 100644 index 000000000..0592c4ec4 --- /dev/null +++ b/output/keynote/categories/20_What/240_Functor_Example_ob_ob.html @@ -0,0 +1,3 @@ +

Functor Example (ob → ob)

+ +Functor diff --git a/output/keynote/categories/20_What/250_Functor_Example_hom_hom.html b/output/keynote/categories/20_What/250_Functor_Example_hom_hom.html new file mode 100644 index 000000000..845d7f4e2 --- /dev/null +++ b/output/keynote/categories/20_What/250_Functor_Example_hom_hom.html @@ -0,0 +1,3 @@ +

Functor Example (hom → hom)

+ +Functor diff --git a/output/keynote/categories/20_What/260_Functor_Example.html b/output/keynote/categories/20_What/260_Functor_Example.html new file mode 100644 index 000000000..ae2030686 --- /dev/null +++ b/output/keynote/categories/20_What/260_Functor_Example.html @@ -0,0 +1,3 @@ +

Functor Example

+ +Functor diff --git a/output/keynote/categories/20_What/270_Endofunctors.html b/output/keynote/categories/20_What/270_Endofunctors.html new file mode 100644 index 000000000..a6333ee3a --- /dev/null +++ b/output/keynote/categories/20_What/270_Endofunctors.html @@ -0,0 +1,4 @@ +

Endofunctors

+ +

An endofunctor for \(\C\) is a functor \(F:\C→\C\).

+Endofunctor diff --git a/output/keynote/categories/20_What/280_Category_of_Categories.html b/output/keynote/categories/20_What/280_Category_of_Categories.html new file mode 100644 index 000000000..2f812adb3 --- /dev/null +++ b/output/keynote/categories/20_What/280_Category_of_Categories.html @@ -0,0 +1,9 @@ +

Category of Categories

+ + + +

Categories and functors form a category: \(\Cat\)

+
  • \(\ob{\Cat}\) are categories +
  • \(\hom{\Cat}\) are functors +
  • ∘ is functor composition +
diff --git a/output/keynote/categories/30_How/010_Plan.html b/output/keynote/categories/30_How/010_Plan.html new file mode 100644 index 000000000..dbe04b5c6 --- /dev/null +++ b/output/keynote/categories/30_How/010_Plan.html @@ -0,0 +1,13 @@ +

Plan

+
    +
  • Why?
  • +
  • What?
  • +
  • How? +
      +
    • \(\Hask\) category +
    • Functors +
    • Monads +
    • κατα-morphisms +
    +
  • +
diff --git a/output/keynote/categories/30_How/020_Hask.html b/output/keynote/categories/30_How/020_Hask.html new file mode 100644 index 000000000..9c66a8432 --- /dev/null +++ b/output/keynote/categories/30_How/020_Hask.html @@ -0,0 +1,15 @@ +

Hask

+ +

Category \(\Hask\):

+ +Haskell Category Representation + +
  • +\(\ob{\Hask} = \) Haskell types +
  • +\(\hom{\Hask} = \) Haskell functions +
  • +∘ = (.) Haskell function composition +
+ +

Forget glitches because of undefined.

diff --git a/output/keynote/categories/30_How/030_Haskell_Kinds.html b/output/keynote/categories/30_How/030_Haskell_Kinds.html new file mode 100644 index 000000000..231862e1c --- /dev/null +++ b/output/keynote/categories/30_How/030_Haskell_Kinds.html @@ -0,0 +1,7 @@ +

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] :: *
diff --git a/output/keynote/categories/30_How/030_Haskell_Kinds.md b/output/keynote/categories/30_How/030_Haskell_Kinds.md new file mode 100644 index 000000000..f01c67b3f --- /dev/null +++ b/output/keynote/categories/30_How/030_Haskell_Kinds.md @@ -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] :: * +~~~ diff --git a/output/keynote/categories/30_How/040_Haskell_Types.html b/output/keynote/categories/30_How/040_Haskell_Types.html new file mode 100644 index 000000000..e136e25c2 --- /dev/null +++ b/output/keynote/categories/30_How/040_Haskell_Types.html @@ -0,0 +1,15 @@ +

Haskell Types

+

Sometimes, the type determine a lot about the function:

+
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 (+1) l
+-- The (+1) force 'a' to be a Num.
+ +

+

★:Theorems for free!, Philip Wadler, 1989

diff --git a/output/keynote/categories/30_How/040_Haskell_Types.md b/output/keynote/categories/30_How/040_Haskell_Types.md new file mode 100644 index 000000000..18aa6830c --- /dev/null +++ b/output/keynote/categories/30_How/040_Haskell_Types.md @@ -0,0 +1,17 @@ +Haskell Types +------------- + +Sometimes, the type determine a lot about the function: + +
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 (+1) l
+-- The (+1) force 'a' to be a Num.
+ +

★:Theorems for free!, Philip Wadler, 1989 diff --git a/output/keynote/categories/30_How/100_Functors/010_Haskell_Functor_vs_Hask_Functor.html b/output/keynote/categories/30_How/100_Functors/010_Haskell_Functor_vs_Hask_Functor.html new file mode 100644 index 000000000..467b64d4a --- /dev/null +++ b/output/keynote/categories/30_How/100_Functors/010_Haskell_Functor_vs_Hask_Functor.html @@ -0,0 +1,11 @@ +

Haskell Functor vs \(\Hask\) Functor

+ +

A Haskell Functor is a type F :: * -> * which belong to the type class Functor ; thus instantiate +fmap :: (a -> b) -> (F a -> F b). + +

& F: \(\ob{\Hask}→\ob{\Hask}\)
& fmap: \(\hom{\Hask}→\hom{\Hask}\) + +

The couple (F,fmap) is a \(\Hask\)'s functor if for any x :: F a:

+
  • fmap id x = x +
  • fmap (f.g) x= (fmap f . fmap g) x +
diff --git a/output/keynote/categories/30_How/100_Functors/020_Haskell_Functors_Example_Maybe.html b/output/keynote/categories/30_How/100_Functors/020_Haskell_Functors_Example_Maybe.html new file mode 100644 index 000000000..1ad864951 --- /dev/null +++ b/output/keynote/categories/30_How/100_Functors/020_Haskell_Functors_Example_Maybe.html @@ -0,0 +1,10 @@ +

Haskell Functors Example: Maybe

+ +
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
+
fmap (+1) (Just 1) == Just 2
+fmap (+1) Nothing  == Nothing
+fmap head (Just [1,2,3]) == Just 1
diff --git a/output/keynote/categories/30_How/100_Functors/030_Haskell_Functors_Example_List.html b/output/keynote/categories/30_How/100_Functors/030_Haskell_Functors_Example_List.html new file mode 100644 index 000000000..67666954b --- /dev/null +++ b/output/keynote/categories/30_How/100_Functors/030_Haskell_Functors_Example_List.html @@ -0,0 +1,8 @@ +

Haskell Functors Example: List

+ +
instance Functor ([]) where
+	fmap :: (a -> b) -> [a] -> [b]
+	fmap = map
+
fmap (+1) [1,2,3]           == [2,3,4]
+fmap (+1) []                == []
+fmap head [[1,2,3],[4,5,6]] == [1,4]
diff --git a/output/keynote/categories/30_How/100_Functors/040_Haskell_Functors_for_the_programmer.html b/output/keynote/categories/30_How/100_Functors/040_Haskell_Functors_for_the_programmer.html new file mode 100644 index 000000000..c392df553 --- /dev/null +++ b/output/keynote/categories/30_How/100_Functors/040_Haskell_Functors_for_the_programmer.html @@ -0,0 +1,10 @@ +

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!"
    • +
  • +
diff --git a/output/keynote/categories/30_How/100_Functors/040_Haskell_Functors_for_the_programmer.md b/output/keynote/categories/30_How/100_Functors/040_Haskell_Functors_for_the_programmer.md new file mode 100644 index 000000000..ea3ba38a5 --- /dev/null +++ b/output/keynote/categories/30_How/100_Functors/040_Haskell_Functors_for_the_programmer.md @@ -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!"` diff --git a/output/keynote/categories/30_How/100_Functors/050_Haskell_Functor_intuition.html b/output/keynote/categories/30_How/100_Functors/050_Haskell_Functor_intuition.html new file mode 100644 index 000000000..02d53099d --- /dev/null +++ b/output/keynote/categories/30_How/100_Functors/050_Haskell_Functor_intuition.html @@ -0,0 +1,5 @@ +

Haskell Functor intuition

+ +

Put normal function inside a container. Ex: list, trees...

+ +Haskell Functor as a box play diff --git a/output/keynote/categories/30_How/100_Functors/060_Haskell_Functor_properties.html b/output/keynote/categories/30_How/100_Functors/060_Haskell_Functor_properties.html new file mode 100644 index 000000000..c35cc8e2b --- /dev/null +++ b/output/keynote/categories/30_How/100_Functors/060_Haskell_Functor_properties.html @@ -0,0 +1,7 @@ +

Haskell Functor properties

+ +

Haskell Functors are:

+ +
  • endofunctors ; \(F:\C→\C\) here \(\C = \Hask\), +
  • a couple (Object,Morphism) in \(\Hask\). +
diff --git a/output/keynote/categories/30_How/100_Functors/070_Functor_as_boxes.html b/output/keynote/categories/30_How/100_Functors/070_Functor_as_boxes.html new file mode 100644 index 000000000..32c1573bd --- /dev/null +++ b/output/keynote/categories/30_How/100_Functors/070_Functor_as_boxes.html @@ -0,0 +1,6 @@ +

Functor as boxes

+ +

Haskell functor can be seen as boxes containing all Haskell types and functions. +Haskell types is fractal:

+ +Haskell functor representation diff --git a/output/keynote/categories/30_How/100_Functors/080_Functor_as_boxes.html b/output/keynote/categories/30_How/100_Functors/080_Functor_as_boxes.html new file mode 100644 index 000000000..40596f626 --- /dev/null +++ b/output/keynote/categories/30_How/100_Functors/080_Functor_as_boxes.html @@ -0,0 +1,6 @@ +

Functor as boxes

+ +

Haskell functor can be seen as boxes containing all Haskell types and functions. +Haskell types is fractal:

+ +Haskell functor representation diff --git a/output/keynote/categories/30_How/100_Functors/090_Functor_as_boxes.html b/output/keynote/categories/30_How/100_Functors/090_Functor_as_boxes.html new file mode 100644 index 000000000..f3912e2e0 --- /dev/null +++ b/output/keynote/categories/30_How/100_Functors/090_Functor_as_boxes.html @@ -0,0 +1,6 @@ +

Functor as boxes

+ +

Haskell functor can be seen as boxes containing all Haskell types and functions. +Haskell types is fractal:

+ +Haskell functor representation diff --git a/output/keynote/categories/30_How/100_Functors/100_Non_Haskell_Hask_s_Functors.html b/output/keynote/categories/30_How/100_Functors/100_Non_Haskell_Hask_s_Functors.html new file mode 100644 index 000000000..d8a5cb463 --- /dev/null +++ b/output/keynote/categories/30_How/100_Functors/100_Non_Haskell_Hask_s_Functors.html @@ -0,0 +1,11 @@ +

"Non Haskell" Hask's Functors

+

A simple basic example is the \(id_\Hask\) functor. It simply cannot be expressed as a couple (F,fmap) where

+
    +
  • F::* -> *
  • +
  • fmap :: (a -> b) -> (F a) -> (F b)
  • +
+

Another example:

+
    +
  • F(T)=Int
  • +
  • F(f)=\_->0
  • +
diff --git a/output/keynote/categories/30_How/100_Functors/100_Non_Haskell_Hask_s_Functors.md b/output/keynote/categories/30_How/100_Functors/100_Non_Haskell_Hask_s_Functors.md new file mode 100644 index 000000000..a03e4a7ce --- /dev/null +++ b/output/keynote/categories/30_How/100_Functors/100_Non_Haskell_Hask_s_Functors.md @@ -0,0 +1,12 @@ +## "Non Haskell" Hask's Functors + +A simple basic example is the \\(id\_\\Hask\\) functor. +It simply cannot be expressed as a couple (`F`,`fmap`) where + +- `F::* -> *` +- `fmap :: (a -> b) -> (F a) -> (F b)` + +Another example: + +- F(`T`)=`Int` +- F(`f`)=`\_->0` diff --git a/output/keynote/categories/30_How/100_Functors/110_Also_Functor_inside_Hask.html b/output/keynote/categories/30_How/100_Functors/110_Also_Functor_inside_Hask.html new file mode 100644 index 000000000..0fd8d0196 --- /dev/null +++ b/output/keynote/categories/30_How/100_Functors/110_Also_Functor_inside_Hask.html @@ -0,0 +1,18 @@ +

Also Functor inside \(\Hask\)

+

\(\mathtt{[a]}∈\ob{\Hask}\) but is also a category. Idem for Int.

+

length is a Functor from the category [a] to the cateogry Int:

+
    +
  • \(\ob{\mathtt{[a]}}=\{∙\}\)
  • +
  • \(\hom{\mathtt{[a]}}=\mathtt{[a]}\)
  • +
  • \(∘=\mathtt{(++)}\)
  • +
+

+
    +
  • \(\ob{\mathtt{Int}}=\{∙\}\)
  • +
  • \(\hom{\mathtt{Int}}=\mathtt{Int}\)
  • +
  • \(∘=\mathtt{(+)}\)
  • +
+
+
  • id: length [] = 0 +
  • comp: length (l ++ l') = (length l) + (length l') +
diff --git a/output/keynote/categories/30_How/100_Functors/120_Category_of_Hask_Endofunctors.html b/output/keynote/categories/30_How/100_Functors/120_Category_of_Hask_Endofunctors.html new file mode 100644 index 000000000..835925206 --- /dev/null +++ b/output/keynote/categories/30_How/100_Functors/120_Category_of_Hask_Endofunctors.html @@ -0,0 +1,2 @@ +

Category of \(\Hask\) Endofunctors

+Category of Hask endofunctors diff --git a/output/keynote/categories/30_How/100_Functors/120_Category_of_Hask_Endofunctors.md b/output/keynote/categories/30_How/100_Functors/120_Category_of_Hask_Endofunctors.md new file mode 100644 index 000000000..23fb9236a --- /dev/null +++ b/output/keynote/categories/30_How/100_Functors/120_Category_of_Hask_Endofunctors.md @@ -0,0 +1,4 @@ +Category of \\(\\Hask\\) Endofunctors +------------------------------------ + +Category of Hask endofunctors diff --git a/output/keynote/categories/30_How/100_Functors/130_Category_of_Functors.html b/output/keynote/categories/30_How/100_Functors/130_Category_of_Functors.html new file mode 100644 index 000000000..fa89915e2 --- /dev/null +++ b/output/keynote/categories/30_How/100_Functors/130_Category_of_Functors.html @@ -0,0 +1,8 @@ +

Category of Functors

+

If \(\C\) is small (\(\hom{\C}\) is a set). All functors from \(\C\) to some category \(\D\) form the category \(\mathrm{Func}(\C,\D)\).

+
    +
  • \(\ob{\mathrm{Func}(\C,\D)}\): Functors \(F:\C→\D\)
  • +
  • \(\hom{\mathrm{Func}(\C,\D)}\): natural transformations
  • +
  • ∘: Functor composition
  • +
+

\(\mathrm{Func}(\C,\C)\) is the category of endofunctors of \(\C\).

diff --git a/output/keynote/categories/30_How/100_Functors/130_Category_of_Functors.md b/output/keynote/categories/30_How/100_Functors/130_Category_of_Functors.md new file mode 100644 index 000000000..4a07c892c --- /dev/null +++ b/output/keynote/categories/30_How/100_Functors/130_Category_of_Functors.md @@ -0,0 +1,12 @@ +Category of Functors +------------------------ + +If \\(\\C\\) is _small_ (\\(\\hom{\\C}\\) is a set). +All functors from \\(\\C\\) to some category \\(\\D\\) +form the category \\(\\mathrm{Func}(\\C,\\D)\\). + +- \\(\\ob{\\mathrm{Func}(\\C,\\D)}\\): Functors \\(F:\\C→\\D\\) +- \\(\\hom{\\mathrm{Func}(\\C,\\D)}\\): _natural transformations_ +- ∘: Functor composition + +\\(\\mathrm{Func}(\\C,\\C)\\) is the category of endofunctors of \\(\\C\\). diff --git a/output/keynote/categories/30_How/100_Functors/140_Natural_Transformations.html b/output/keynote/categories/30_How/100_Functors/140_Natural_Transformations.html new file mode 100644 index 000000000..11020c0a9 --- /dev/null +++ b/output/keynote/categories/30_How/100_Functors/140_Natural_Transformations.html @@ -0,0 +1,4 @@ +

Natural Transformations

+

Let \(F\) and \(G\) be two functors from \(\C\) to \(\D\).

+

Natural transformation commutative diagram A natural transformation: familly η ; \(η_X\in\hom{\D}\) for \(X\in\ob{\C}\) s.t.

+

ex: between Haskell functors; F a -> G a
Rearragement functions only.

diff --git a/output/keynote/categories/30_How/100_Functors/140_Natural_Transformations.md b/output/keynote/categories/30_How/100_Functors/140_Natural_Transformations.md new file mode 100644 index 000000000..9cfb17694 --- /dev/null +++ b/output/keynote/categories/30_How/100_Functors/140_Natural_Transformations.md @@ -0,0 +1,10 @@ +Natural Transformations +----------------------- + +Let \\(F\\) and \\(G\\) be two functors from \\(\\C\\) to \\(\\D\\). + +Natural transformation commutative diagram +_A natural transformation:_ familly η ; \\(η\_X\\in\\hom{\\D}\\) for \\(X\\in\\ob{\\C}\\) s.t. + +ex: between Haskell functors; `F a -> G a` +Rearragement functions only. diff --git a/output/keynote/categories/30_How/200_Monads/010_Natural_Transformation_Examples_1_4.html b/output/keynote/categories/30_How/200_Monads/010_Natural_Transformation_Examples_1_4.html new file mode 100644 index 000000000..716b90f09 --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/010_Natural_Transformation_Examples_1_4.html @@ -0,0 +1,13 @@ +

Natural Transformation Examples (1/4)

+
data Tree a = Empty | Node a [Tree a]
+toTree :: [a] -> Tree a
+toTree [] = Empty
+toTree (x:xs) = Node x [toTree xs]
+ +

toTree is a natural transformation. It is also a morphism from [] to Tree in the Category of \(\Hask\) endofunctors.

+natural transformation commutative diagram +
+natural transformation commutative diagram +
+ + diff --git a/output/keynote/categories/30_How/200_Monads/010_Natural_Transformation_Examples_1_4.md b/output/keynote/categories/30_How/200_Monads/010_Natural_Transformation_Examples_1_4.md new file mode 100644 index 000000000..52ff3b29f --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/010_Natural_Transformation_Examples_1_4.md @@ -0,0 +1,16 @@ +Natural Transformation Examples (1/4) +------------------------------------ + +
data Tree a = Empty | Node a [Tree a]
+toTree :: [a] -> Tree a
+toTree [] = Empty
+toTree (x:xs) = Node x [toTree xs]
+ + +`toTree` is a natural transformation. +It is also a morphism from `[]` to `Tree` in the Category of \\(\\Hask\\) endofunctors. + +natural transformation commutative diagram +
+natural transformation commutative diagram +
diff --git a/output/keynote/categories/30_How/200_Monads/020_Natural_Transformation_Examples_2_4.html b/output/keynote/categories/30_How/200_Monads/020_Natural_Transformation_Examples_2_4.html new file mode 100644 index 000000000..4054c64e0 --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/020_Natural_Transformation_Examples_2_4.html @@ -0,0 +1,13 @@ +

Natural Transformation Examples (2/4)

+
data Tree a = Empty | Node a [Tree a]
+toList :: Tree a -> [a]
+toList Empty = []
+toList (Node x l) = [x] ++ concat (map toList l)
+ +

toList is a natural transformation. It is also a morphism from Tree to [] in the Category of \(\Hask\) endofunctors.

+natural transformation commutative diagram +
+natural transformation commutative diagram
toList . toTree = id & toTree . toList = id &
therefore [] & Tree are isomorph.
+
+ + diff --git a/output/keynote/categories/30_How/200_Monads/020_Natural_Transformation_Examples_2_4.md b/output/keynote/categories/30_How/200_Monads/020_Natural_Transformation_Examples_2_4.md new file mode 100644 index 000000000..f737f65ba --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/020_Natural_Transformation_Examples_2_4.md @@ -0,0 +1,19 @@ +Natural Transformation Examples (2/4) +------------------------------------ + +
data Tree a = Empty | Node a [Tree a]
+toList :: Tree a -> [a]
+toList Empty = []
+toList (Node x l) = [x] ++ concat (map toList l)
+ + +`toList` is a natural transformation. +It is also a morphism from `Tree` to `[]` in the Category of \\(\\Hask\\) endofunctors. + +natural transformation commutative diagram +
+natural transformation commutative diagram +
toList . toTree = id & toTree . toList = id &
+therefore [] & Tree are isomorph. +
+
diff --git a/output/keynote/categories/30_How/200_Monads/030_Natural_Transformation_Examples_3_4.html b/output/keynote/categories/30_How/200_Monads/030_Natural_Transformation_Examples_3_4.html new file mode 100644 index 000000000..aa49249a9 --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/030_Natural_Transformation_Examples_3_4.html @@ -0,0 +1,12 @@ +

Natural Transformation Examples (3/4)

+
toMaybe :: [a] -> Maybe a
+toMaybe [] = Nothing
+toMaybe (x:xs) = Just x
+ +

toMaybe is a natural transformation. It is also a morphism from [] to Maybe in the Category of \(\Hask\) endofunctors.

+natural transformation commutative diagram +
+natural transformation commutative diagram +
+ + diff --git a/output/keynote/categories/30_How/200_Monads/030_Natural_Transformation_Examples_3_4.md b/output/keynote/categories/30_How/200_Monads/030_Natural_Transformation_Examples_3_4.md new file mode 100644 index 000000000..95eb4de3c --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/030_Natural_Transformation_Examples_3_4.md @@ -0,0 +1,15 @@ +Natural Transformation Examples (3/4) +------------------------------------- + +
toMaybe :: [a] -> Maybe a
+toMaybe [] = Nothing
+toMaybe (x:xs) = Just x
+ + +`toMaybe` is a natural transformation. +It is also a morphism from `[]` to `Maybe` in the Category of \\(\\Hask\\) endofunctors. + +natural transformation commutative diagram +
+natural transformation commutative diagram +
diff --git a/output/keynote/categories/30_How/200_Monads/040_Natural_Transformation_Examples_4_4.html b/output/keynote/categories/30_How/200_Monads/040_Natural_Transformation_Examples_4_4.html new file mode 100644 index 000000000..90b11a780 --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/040_Natural_Transformation_Examples_4_4.html @@ -0,0 +1,12 @@ +

Natural Transformation Examples (4/4)

+
mToList :: Maybe a -> [a]
+mToList Nothing = []
+mToList Just x  = [x]
+ +

toMaybe is a natural transformation. It is also a morphism from [] to Maybe in the Category of \(\Hask\) endofunctors.

+natural transformation commutative diagram +
+relation between [] and Maybe
There is no isomorphism.
Hint: Bool lists longer than 1.
+
+ + diff --git a/output/keynote/categories/30_How/200_Monads/040_Natural_Transformation_Examples_4_4.md b/output/keynote/categories/30_How/200_Monads/040_Natural_Transformation_Examples_4_4.md new file mode 100644 index 000000000..512d55811 --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/040_Natural_Transformation_Examples_4_4.md @@ -0,0 +1,18 @@ +Natural Transformation Examples (4/4) +------------------------------------- + +
mToList :: Maybe a -> [a]
+mToList Nothing = []
+mToList Just x  = [x]
+ + +`toMaybe` is a natural transformation. +It is also a morphism from `[]` to `Maybe` in the Category of \\(\\Hask\\) endofunctors. + +natural transformation commutative diagram +
+relation between [] and Maybe +
There is no isomorphism.
+Hint: Bool lists longer than 1. +
+
diff --git a/output/keynote/categories/30_How/200_Monads/050_Composition_problem.html b/output/keynote/categories/30_How/200_Monads/050_Composition_problem.html new file mode 100644 index 000000000..50460414a --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/050_Composition_problem.html @@ -0,0 +1,7 @@ +

Composition problem

+

The Problem; example with lists:

+
f x = [x]       ⇒ f 1 = [1]   ⇒ (f.f) 1 = [[1]] ✗
+g x = [x+1]     ⇒ g 1 = [2]   ⇒ (g.g) 1 = ERROR [2]+1 ✗
+h x = [x+1,x*3] ⇒ h 1 = [2,3] ⇒ (h.h) 1 = ERROR [2,3]+1 ✗ 
+ +

The same problem with most f :: a -> F a functions and functor F.

diff --git a/output/keynote/categories/30_How/200_Monads/050_Composition_problem.md b/output/keynote/categories/30_How/200_Monads/050_Composition_problem.md new file mode 100644 index 000000000..2b1316d74 --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/050_Composition_problem.md @@ -0,0 +1,10 @@ +Composition problem +-------------------------------------------- + +The Problem; example with lists: + +
f x = [x]       ⇒ f 1 = [1]   ⇒ (f.f) 1 = [[1]] ✗
+g x = [x+1]     ⇒ g 1 = [2]   ⇒ (g.g) 1 = ERROR [2]+1 ✗
+h x = [x+1,x*3] ⇒ h 1 = [2,3] ⇒ (h.h) 1 = ERROR [2,3]+1 ✗ 
+ +The same problem with most `f :: a -> F a` functions and functor `F`. diff --git a/output/keynote/categories/30_How/200_Monads/060_Composition_Fixable.html b/output/keynote/categories/30_How/200_Monads/060_Composition_Fixable.html new file mode 100644 index 000000000..a31b901f2 --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/060_Composition_Fixable.html @@ -0,0 +1,6 @@ +

Composition Fixable?

+

How to fix that? We want to construct an operator which is able to compose:

+

f :: a -> F b & g :: b -> F c.

+

More specifically we want to create an operator ◎ of type

+

◎ :: (b -> F c) -> (a -> F b) -> (a -> F c)

+

Note: if F = I, ◎ = (.).

diff --git a/output/keynote/categories/30_How/200_Monads/060_Composition_Fixable.md b/output/keynote/categories/30_How/200_Monads/060_Composition_Fixable.md new file mode 100644 index 000000000..fb7ea475d --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/060_Composition_Fixable.md @@ -0,0 +1,12 @@ +Composition Fixable? +-------------------------------------------- + +How to fix that? We want to construct an operator which is able to compose: + +`f :: a -> F b` & `g :: b -> F c`. + +More specifically we want to create an operator ◎ of type + +`◎ :: (b -> F c) -> (a -> F b) -> (a -> F c)` + +Note: if `F` = I, ◎ = `(.)`. diff --git a/output/keynote/categories/30_How/200_Monads/070_Fix_Composition_1_2.html b/output/keynote/categories/30_How/200_Monads/070_Fix_Composition_1_2.html new file mode 100644 index 000000000..f9e720585 --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/070_Fix_Composition_1_2.html @@ -0,0 +1,7 @@ +

Fix Composition (1/2)

+

Goal, find: ◎ :: (b -> F c) -> (a -> F b) -> (a -> F c)
f :: a -> F b, g :: b -> F c:

+
    +
  • (g ◎ f) x ???
  • +
  • First apply f to xf x :: F b
  • +
  • Then how to apply g properly to an element of type F b?
  • +
diff --git a/output/keynote/categories/30_How/200_Monads/070_Fix_Composition_1_2.md b/output/keynote/categories/30_How/200_Monads/070_Fix_Composition_1_2.md new file mode 100644 index 000000000..9b6709a92 --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/070_Fix_Composition_1_2.md @@ -0,0 +1,9 @@ +Fix Composition (1/2) +-------------------------------------------- + +Goal, find: `◎ :: (b -> F c) -> (a -> F b) -> (a -> F c)` +`f :: a -> F b`, `g :: b -> F c`: + +- `(g ◎ f) x` ??? +- First apply `f` to `x` ⇒ `f x :: F b` +- Then how to apply `g` properly to an element of type `F b`? diff --git a/output/keynote/categories/30_How/200_Monads/080_Fix_Composition_2_2.html b/output/keynote/categories/30_How/200_Monads/080_Fix_Composition_2_2.html new file mode 100644 index 000000000..a4c9e1769 --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/080_Fix_Composition_2_2.html @@ -0,0 +1,9 @@ +

Fix Composition (2/2)

+

Goal, find: ◎ :: (b -> F c) -> (a -> F b) -> (a -> F c)
f :: a -> F b, g :: b -> F c, f x :: F b:

+
    +
  • Use fmap :: (t -> u) -> (F t -> F u)!
  • +
  • (fmap g) :: F b -> F (F c) ; (t=b, u=F c)
  • +
  • (fmap g) (f x) :: F (F c) it almost WORKS!
  • +
  • We lack an important component, join :: F (F c) -> F c
  • +
  • (g ◎ f) x = join ((fmap g) (f x))
    ◎ is the Kleisli composition; in Haskell: <=< (in Control.Monad).
  • +
diff --git a/output/keynote/categories/30_How/200_Monads/080_Fix_Composition_2_2.md b/output/keynote/categories/30_How/200_Monads/080_Fix_Composition_2_2.md new file mode 100644 index 000000000..054a5a795 --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/080_Fix_Composition_2_2.md @@ -0,0 +1,12 @@ +Fix Composition (2/2) +-------------------------------------------- + +Goal, find: `◎ :: (b -> F c) -> (a -> F b) -> (a -> F c)` +`f :: a -> F b`, `g :: b -> F c`, `f x :: F b`: + +- Use `fmap :: (t -> u) -> (F t -> F u)`! +- `(fmap g) :: F b -> F (F c)` ; (`t=b`, `u=F c`) +- `(fmap g) (f x) :: F (F c)` it almost WORKS! +- We lack an important component, `join :: F (F c) -> F c` +- `(g ◎ f) x = join ((fmap g) (f x))` ☺ +◎ is the Kleisli composition; in Haskell: `<=<` (in `Control.Monad`). diff --git a/output/keynote/categories/30_How/200_Monads/090_Necessary_laws.html b/output/keynote/categories/30_How/200_Monads/090_Necessary_laws.html new file mode 100644 index 000000000..0debe6bf8 --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/090_Necessary_laws.html @@ -0,0 +1,7 @@ +

Necessary laws

+

For ◎ to work like composition, we need join to hold the following properties:

+
    +
  • join (join (F (F (F a))))=join (F (join (F (F a))))
  • +
  • abusing notations denoting join by ⊙; this is equivalent to
    (F ⊙ F) ⊙ F = F ⊙ (F ⊙ F)
  • +
  • There exists η :: a -> F a s.t.
    η⊙F=F=F⊙η
  • +
diff --git a/output/keynote/categories/30_How/200_Monads/090_Necessary_laws.md b/output/keynote/categories/30_How/200_Monads/090_Necessary_laws.md new file mode 100644 index 000000000..5b60b0c73 --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/090_Necessary_laws.md @@ -0,0 +1,10 @@ +Necessary laws +-------------------------------------------- + +For ◎ to work like composition, we need join to hold the following properties: + +- `join (join (F (F (F a))))=join (F (join (F (F a))))` +- abusing notations denoting `join` by ⊙; this is equivalent to +`(F ⊙ F) ⊙ F = F ⊙ (F ⊙ F)` +- There exists `η :: a -> F a` s.t. +`η⊙F=F=F⊙η` diff --git a/output/keynote/categories/30_How/200_Monads/100_Klesli_composition.html b/output/keynote/categories/30_How/200_Monads/100_Klesli_composition.html new file mode 100644 index 000000000..359c8ad7b --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/100_Klesli_composition.html @@ -0,0 +1,8 @@ +

Klesli composition

+

Now the composition works as expected. In Haskell ◎ is <=< in Control.Monad.

+

g <=< f = \x -> join ((fmap g) (f x))

+
f x = [x]       ⇒ f 1 = [1]   ⇒ (f <=< f) 1 = [1] ✓
+g x = [x+1]     ⇒ g 1 = [2]   ⇒ (g <=< g) 1 = [3] ✓
+h x = [x+1,x*3] ⇒ h 1 = [2,3] ⇒ (h <=< h) 1 = [3,6,4,9] ✓
+ + diff --git a/output/keynote/categories/30_How/200_Monads/100_Klesli_composition.md b/output/keynote/categories/30_How/200_Monads/100_Klesli_composition.md new file mode 100644 index 000000000..0b0d53ff0 --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/100_Klesli_composition.md @@ -0,0 +1,10 @@ +Klesli composition +------------------ + +Now the composition works as expected. In Haskell ◎ is `<=<` in `Control.Monad`. + +`g <=< f = \x -> join ((fmap g) (f x))` + +
f x = [x]       ⇒ f 1 = [1]   ⇒ (f <=< f) 1 = [1] ✓
+g x = [x+1]     ⇒ g 1 = [2]   ⇒ (g <=< g) 1 = [3] ✓
+h x = [x+1,x*3] ⇒ h 1 = [2,3] ⇒ (h <=< h) 1 = [3,6,4,9] ✓
diff --git a/output/keynote/categories/30_How/200_Monads/110_We_reinvented_Monads.html b/output/keynote/categories/30_How/200_Monads/110_We_reinvented_Monads.html new file mode 100644 index 000000000..17c760d2c --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/110_We_reinvented_Monads.html @@ -0,0 +1,12 @@ +

We reinvented Monads!

+

A monad is a triplet (M,⊙,η) where

+
    +
  • \(M\) an Endofunctor (to type a associate M a)
  • +
  • \(⊙:M×M→M\) a nat. trans. (i.e. ⊙::M (M a) → M a ; join)
  • +
  • \(η:I→M\) a nat. trans. (\(I\) identity functor ; η::a → M a)
  • +
+

Satisfying

+
    +
  • \(M ⊙ (M ⊙ M) = (M ⊙ M) ⊙ M\)
  • +
  • \(η ⊙ M = M = M ⊙ η\)
  • +
diff --git a/output/keynote/categories/30_How/200_Monads/110_We_reinvented_Monads.md b/output/keynote/categories/30_How/200_Monads/110_We_reinvented_Monads.md new file mode 100644 index 000000000..72de83b91 --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/110_We_reinvented_Monads.md @@ -0,0 +1,13 @@ +We reinvented Monads! +--------------------- + +A monad is a triplet `(M,⊙,η)` where + +- \\(M\\) an Endofunctor (to type `a` associate `M a`) +- \\(⊙:M×M→M\\) a nat. trans. (i.e. `⊙::M (M a) → M a` ; `join`) +- \\(η:I→M\\) a nat. trans. (\\(I\\) identity functor ; `η::a → M a`) + +Satisfying + +- \\(M ⊙ (M ⊙ M) = (M ⊙ M) ⊙ M\\) +- \\(η ⊙ M = M = M ⊙ η\\) diff --git a/output/keynote/categories/30_How/200_Monads/120_Compare_with_Monoid.html b/output/keynote/categories/30_How/200_Monads/120_Compare_with_Monoid.html new file mode 100644 index 000000000..699e9d45f --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/120_Compare_with_Monoid.html @@ -0,0 +1,12 @@ +

Compare with Monoid

+

A Monoid is a triplet \((E,∙,e)\) s.t.

+
    +
  • \(E\) a set
  • +
  • \(∙:E×E→E\)
  • +
  • \(e:1→E\)
  • +
+

Satisfying

+
    +
  • \(x∙(y∙z) = (x∙y)∙z, ∀x,y,z∈E\)
  • +
  • \(e∙x = x = x∙e, ∀x∈E\)
  • +
diff --git a/output/keynote/categories/30_How/200_Monads/120_Compare_with_Monoid.md b/output/keynote/categories/30_How/200_Monads/120_Compare_with_Monoid.md new file mode 100644 index 000000000..7e655907b --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/120_Compare_with_Monoid.md @@ -0,0 +1,13 @@ +Compare with Monoid +------------------- + +A Monoid is a triplet \\((E,∙,e)\\) s.t. + +- \\(E\\) a set +- \\(∙:E×E→E\\) +- \\(e:1→E\\) + +Satisfying + +- \\(x∙(y∙z) = (x∙y)∙z, ∀x,y,z∈E\\) +- \\(e∙x = x = x∙e, ∀x∈E\\) diff --git a/output/keynote/categories/30_How/200_Monads/130_Monads_are_just_Monoids.html b/output/keynote/categories/30_How/200_Monads/130_Monads_are_just_Monoids.html new file mode 100644 index 000000000..3188747cd --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/130_Monads_are_just_Monoids.html @@ -0,0 +1,8 @@ +

Monads are just Monoids

+
+

A Monad is just a monoid in the category of endofunctors, what's the problem?

+
+

The real sentence was:

+
+

All told, a monad in X is just a monoid in the category of endofunctors of X, with product × replaced by composition of endofunctors and unit set by the identity endofunctor.

+
diff --git a/output/keynote/categories/30_How/200_Monads/130_Monads_are_just_Monoids.md b/output/keynote/categories/30_How/200_Monads/130_Monads_are_just_Monoids.md new file mode 100644 index 000000000..12ae4ee6c --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/130_Monads_are_just_Monoids.md @@ -0,0 +1,10 @@ +Monads are just Monoids +----------------------- + +> A Monad is just a monoid in the category of endofunctors, what's the problem? + +The real sentence was: + +> All told, a monad in X is just a monoid in the category of endofunctors of X, +> with product × replaced by composition of endofunctors +> and unit set by the identity endofunctor. diff --git a/output/keynote/categories/30_How/200_Monads/140_Example_List.html b/output/keynote/categories/30_How/200_Monads/140_Example_List.html new file mode 100644 index 000000000..03bb7d320 --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/140_Example_List.html @@ -0,0 +1,15 @@ +

Example: List

+
    +
  • [] :: * -> * an Endofunctor
  • +
  • \(⊙:M×M→M\) a nat. trans. (join :: M (M a) -> M a)
  • +
  • \(η:I→M\) a nat. trans.
  • +
+
-- In Haskell ⊙ is "join" in "Control.Monad"
+join :: [[a]] -> [a]
+join = concat
+
+-- In Haskell the "return" function (unfortunate name)
+η :: a -> [a]
+η x = [x]
+ + diff --git a/output/keynote/categories/30_How/200_Monads/140_Example_List.md b/output/keynote/categories/30_How/200_Monads/140_Example_List.md new file mode 100644 index 000000000..db407bde8 --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/140_Example_List.md @@ -0,0 +1,14 @@ +Example: List +------------- + +- `[] :: * -> *` an Endofunctor +- \\(⊙:M×M→M\\) a nat. trans. (`join :: M (M a) -> M a`) +- \\(η:I→M\\) a nat. trans. + +
-- In Haskell ⊙ is "join" in "Control.Monad"
+join :: [[a]] -> [a]
+join = concat
+
+-- In Haskell the "return" function (unfortunate name)
+η :: a -> [a]
+η x = [x]
diff --git a/output/keynote/categories/30_How/200_Monads/150_Example_List_law_verification.html b/output/keynote/categories/30_How/200_Monads/150_Example_List_law_verification.html new file mode 100644 index 000000000..4afa49809 --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/150_Example_List_law_verification.html @@ -0,0 +1,11 @@ +

Example: List (law verification)

+

Example: List is a functor (join is ⊙)

+
    +
  • \(M ⊙ (M ⊙ M) = (M ⊙ M) ⊙ M\)
  • +
  • \(η ⊙ M = M = M ⊙ η\)
  • +
+
join [ join [[x,y,...,z]] ] = join [[x,y,...,z]]
+                            = join (join [[[x,y,...,z]]])
+join (η [x]) = [x] = join [η x]
+ +

Therefore ([],join,η) is a monad.

diff --git a/output/keynote/categories/30_How/200_Monads/150_Example_List_law_verification.md b/output/keynote/categories/30_How/200_Monads/150_Example_List_law_verification.md new file mode 100644 index 000000000..d287edca4 --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/150_Example_List_law_verification.md @@ -0,0 +1,13 @@ +Example: List (law verification) +-------------------------------- + +Example: `List` is a functor (`join` is ⊙) + +- \\(M ⊙ (M ⊙ M) = (M ⊙ M) ⊙ M\\) +- \\(η ⊙ M = M = M ⊙ η\\) + +
join [ join [[x,y,...,z]] ] = join [[x,y,...,z]]
+							= join (join [[[x,y,...,z]]])
+join (η [x]) = [x] = join [η x]
+ +Therefore `([],join,η)` is a monad. diff --git a/output/keynote/categories/30_How/200_Monads/160_Monads_useful.html b/output/keynote/categories/30_How/200_Monads/160_Monads_useful.html new file mode 100644 index 000000000..96508e6ee --- /dev/null +++ b/output/keynote/categories/30_How/200_Monads/160_Monads_useful.html @@ -0,0 +1,28 @@ +

Monads useful?

+

A LOT of monad tutorial on the net. Just one example; the State Monad

+

DrawScene to State Screen DrawScene ; still pure.

+
main = drawImage (width,height)
+
+drawImage :: Screen -> DrawScene
+drawImage screen =
+    drawPoint p screen
+    drawCircle c screen
+    drawRectangle r screen
+
+drawPoint point screen = ...
+drawCircle circle screen = ...
+drawRectangle rectangle screen = ...
+
main = do
+    put (Screen 1024 768)
+    drawImage
+
+drawImage :: State Screen DrawScene
+drawImage = do
+    drawPoint p
+    drawCircle c
+    drawRectangle r
+
+drawPoint :: Point -> State Screen DrawScene
+drawPoint p = do
+    Screen width height <- get
+    ...
diff --git a/output/keynote/categories/30_How/300_Catamorphisms/010_fold.html b/output/keynote/categories/30_How/300_Catamorphisms/010_fold.html new file mode 100644 index 000000000..b34ea5e80 --- /dev/null +++ b/output/keynote/categories/30_How/300_Catamorphisms/010_fold.html @@ -0,0 +1,2 @@ +

fold

+fold diff --git a/output/keynote/categories/30_How/300_Catamorphisms/010_fold.md b/output/keynote/categories/30_How/300_Catamorphisms/010_fold.md new file mode 100644 index 000000000..2149f75d3 --- /dev/null +++ b/output/keynote/categories/30_How/300_Catamorphisms/010_fold.md @@ -0,0 +1,4 @@ +`fold` +------ + +fold diff --git a/output/keynote/categories/30_How/300_Catamorphisms/020_morphism.html b/output/keynote/categories/30_How/300_Catamorphisms/020_morphism.html new file mode 100644 index 000000000..8a865c1e4 --- /dev/null +++ b/output/keynote/categories/30_How/300_Catamorphisms/020_morphism.html @@ -0,0 +1,2 @@ +

κατα-morphism

+catamorphism diff --git a/output/keynote/categories/30_How/300_Catamorphisms/020_morphism.md b/output/keynote/categories/30_How/300_Catamorphisms/020_morphism.md new file mode 100644 index 000000000..cc23a2fc4 --- /dev/null +++ b/output/keynote/categories/30_How/300_Catamorphisms/020_morphism.md @@ -0,0 +1,4 @@ +κατα-morphism +------------- + +catamorphism diff --git a/output/keynote/categories/30_How/300_Catamorphisms/030_morphism_fold_generalization.html b/output/keynote/categories/30_How/300_Catamorphisms/030_morphism_fold_generalization.html new file mode 100644 index 000000000..cee12a2cf --- /dev/null +++ b/output/keynote/categories/30_How/300_Catamorphisms/030_morphism_fold_generalization.html @@ -0,0 +1,13 @@ +

κατα-morphism: fold generalization

+

acc type of the "accumulator":
fold :: (acc -> a -> acc) -> acc -> [a] -> acc

+

Idea: put the accumulated value inside the type.

+
-- Equivalent to fold (+1) 0 "cata"
+(Cons 'c' (Cons 'a' (Cons 't' (Cons 'a' Nil))))
+(Cons 'c' (Cons 'a' (Cons 't' (Cons 'a' 0))))
+(Cons 'c' (Cons 'a' (Cons 't' 1)))
+(Cons 'c' (Cons 'a' 2))
+(Cons 'c' 3)
+4
+ + +

But where are all the informations? (+1) and 0?

diff --git a/output/keynote/categories/30_How/300_Catamorphisms/030_morphism_fold_generalization.md b/output/keynote/categories/30_How/300_Catamorphisms/030_morphism_fold_generalization.md new file mode 100644 index 000000000..c93a80790 --- /dev/null +++ b/output/keynote/categories/30_How/300_Catamorphisms/030_morphism_fold_generalization.md @@ -0,0 +1,18 @@ +κατα-morphism: fold generalization +---------------------------------- + +`acc` type of the "accumulator": +`fold :: (acc -> a -> acc) -> acc -> [a] -> acc` + +Idea: put the accumulated value inside the type. + +
-- Equivalent to fold (+1) 0 "cata"
+(Cons 'c' (Cons 'a' (Cons 't' (Cons 'a' Nil))))
+(Cons 'c' (Cons 'a' (Cons 't' (Cons 'a' 0))))
+(Cons 'c' (Cons 'a' (Cons 't' 1)))
+(Cons 'c' (Cons 'a' 2))
+(Cons 'c' 3)
+4
+ + +But where are all the informations? `(+1)` and `0`? diff --git a/output/keynote/categories/30_How/300_Catamorphisms/040_morphism_Missing_Information.html b/output/keynote/categories/30_How/300_Catamorphisms/040_morphism_Missing_Information.html new file mode 100644 index 000000000..8a6ae9f9c --- /dev/null +++ b/output/keynote/categories/30_How/300_Catamorphisms/040_morphism_Missing_Information.html @@ -0,0 +1,7 @@ +

κατα-morphism: Missing Information

+

Where is the missing information?

+
    +
  • Functor operator fmap
  • +
  • Algebra representing the (+1) and also knowing the 0.
  • +
+

First example, make length on [Char]

diff --git a/output/keynote/categories/30_How/300_Catamorphisms/040_morphism_Missing_Information.md b/output/keynote/categories/30_How/300_Catamorphisms/040_morphism_Missing_Information.md new file mode 100644 index 000000000..d0eed856e --- /dev/null +++ b/output/keynote/categories/30_How/300_Catamorphisms/040_morphism_Missing_Information.md @@ -0,0 +1,9 @@ +κατα-morphism: Missing Information +---------------------------------- + +Where is the missing information? + +- Functor operator `fmap` +- Algebra representing the `(+1)` and also knowing the `0`. + +First example, make `length` on `[Char]` diff --git a/output/keynote/categories/30_How/300_Catamorphisms/050_morphism_Type_work.html b/output/keynote/categories/30_How/300_Catamorphisms/050_morphism_Type_work.html new file mode 100644 index 000000000..540a31b03 --- /dev/null +++ b/output/keynote/categories/30_How/300_Catamorphisms/050_morphism_Type_work.html @@ -0,0 +1,18 @@ +

κατα-morphism: Type work

+

+data StrF a = Cons Char a | Nil
+data Str = StrF Str
+
+-- generalize the construction of Str to other datatype
+-- Mu :: type fixed point
+
+data Mu f = InF { outF :: f (Mu f) }
+data Str = Mu StrF
+
+-- Example
+foo=InF { outF = Cons 'f'
+        (InF { outF = Cons 'o'
+            (InF { outF = Cons 'o'
+                (InF { outF = Nil })})})}
+ + diff --git a/output/keynote/categories/30_How/300_Catamorphisms/050_morphism_Type_work.md b/output/keynote/categories/30_How/300_Catamorphisms/050_morphism_Type_work.md new file mode 100644 index 000000000..b43e65338 --- /dev/null +++ b/output/keynote/categories/30_How/300_Catamorphisms/050_morphism_Type_work.md @@ -0,0 +1,18 @@ +κατα-morphism: Type work +------------------------ + +

+data StrF a = Cons Char a | Nil
+data Str = StrF Str
+
+-- generalize the construction of Str to other datatype
+-- Mu :: type fixed point
+
+data Mu f = InF { outF :: f (Mu f) }
+data Str = Mu StrF
+
+-- Example
+foo=InF { outF = Cons 'f'
+		(InF { outF = Cons 'o'
+			(InF { outF = Cons 'o'
+				(InF { outF = Nil })})})}
diff --git a/output/keynote/categories/30_How/300_Catamorphisms/060_morphism_missing_information_retrieved.html b/output/keynote/categories/30_How/300_Catamorphisms/060_morphism_missing_information_retrieved.html new file mode 100644 index 000000000..b13838407 --- /dev/null +++ b/output/keynote/categories/30_How/300_Catamorphisms/060_morphism_missing_information_retrieved.html @@ -0,0 +1,7 @@ +

κατα-morphism: missing information retrieved

+
type Algebra f a = f a -> a
+instance Functor (StrF a) =
+    fmap f (Cons c x) = Cons c (f x)
+    fmap _ Nil = Nil
+
cata :: Functor f => Algebra f a -> Mu f -> a
+cata f = f . fmap (cata f) . outF
diff --git a/output/keynote/categories/30_How/300_Catamorphisms/060_morphism_missing_information_retrieved.md b/output/keynote/categories/30_How/300_Catamorphisms/060_morphism_missing_information_retrieved.md new file mode 100644 index 000000000..5f4b18b4f --- /dev/null +++ b/output/keynote/categories/30_How/300_Catamorphisms/060_morphism_missing_information_retrieved.md @@ -0,0 +1,15 @@ +κατα-morphism: missing information retrieved +-------------------------------------------- + +~~~ +type Algebra f a = f a -> a +instance Functor (StrF a) = + fmap f (Cons c x) = Cons c (f x) + fmap _ Nil = Nil +~~~ + +~~~ +cata :: Functor f => Algebra f a -> Mu f -> a +cata f = f . fmap (cata f) . outF +~~~ + diff --git a/output/keynote/categories/30_How/300_Catamorphisms/070_morphism_Finally_length.html b/output/keynote/categories/30_How/300_Catamorphisms/070_morphism_Finally_length.html new file mode 100644 index 000000000..e726f0faf --- /dev/null +++ b/output/keynote/categories/30_How/300_Catamorphisms/070_morphism_Finally_length.html @@ -0,0 +1,15 @@ +

κατα-morphism: Finally length

+

All needed information for making length.

+
instance Functor (StrF a) =
+    fmap f (Cons c x) = Cons c (f x)
+    fmap _ Nil = Nil
+
+length' :: Str -> Int
+length' = cata phi where
+    phi :: Algebra StrF Int -- StrF Int -> Int
+    phi (Cons a b) = 1 + b
+    phi Nil = 0
+
+main = do
+    l <- length' $ stringToStr "Toto"
+    ...
diff --git a/output/keynote/categories/30_How/300_Catamorphisms/070_morphism_Finally_length.md b/output/keynote/categories/30_How/300_Catamorphisms/070_morphism_Finally_length.md new file mode 100644 index 000000000..c13632355 --- /dev/null +++ b/output/keynote/categories/30_How/300_Catamorphisms/070_morphism_Finally_length.md @@ -0,0 +1,20 @@ +κατα-morphism: Finally length +----------------------------- + +All needed information for making length. + +~~~ +instance Functor (StrF a) = + fmap f (Cons c x) = Cons c (f x) + fmap _ Nil = Nil + +length' :: Str -> Int +length' = cata phi where + phi :: Algebra StrF Int -- StrF Int -> Int + phi (Cons a b) = 1 + b + phi Nil = 0 + +main = do + l <- length' $ stringToStr "Toto" + ... +~~~ diff --git a/output/keynote/categories/30_How/300_Catamorphisms/080_morphism_extension_to_Trees.html b/output/keynote/categories/30_How/300_Catamorphisms/080_morphism_extension_to_Trees.html new file mode 100644 index 000000000..68b843059 --- /dev/null +++ b/output/keynote/categories/30_How/300_Catamorphisms/080_morphism_extension_to_Trees.html @@ -0,0 +1,11 @@ +

κατα-morphism: extension to Trees

+

Once you get the trick, it is easy to extent to most Functor.

+
type Tree = Mu TreeF
+data TreeF x = Node Int [x]
+
+instance Functor TreeF where
+  fmap f (Node e xs) = Node e (fmap f xs)
+
+depth = cata phi where
+  phi :: Algebra TreeF Int -- TreeF Int -> Int
+  phi (Node x sons) = 1 + foldr max 0 sons
diff --git a/output/keynote/categories/30_How/300_Catamorphisms/080_morphism_extension_to_Trees.md b/output/keynote/categories/30_How/300_Catamorphisms/080_morphism_extension_to_Trees.md new file mode 100644 index 000000000..39a6269b0 --- /dev/null +++ b/output/keynote/categories/30_How/300_Catamorphisms/080_morphism_extension_to_Trees.md @@ -0,0 +1,16 @@ +κατα-morphism: extension to Trees +---------------------------------- + +Once you get the trick, it is easy to extent to most Functor. + +~~~ +type Tree = Mu TreeF +data TreeF x = Node Int [x] + +instance Functor TreeF where + fmap f (Node e xs) = Node e (fmap f xs) + +depth = cata phi where + phi :: Algebra TreeF Int -- TreeF Int -> Int + phi (Node x sons) = 1 + foldr max 0 sons +~~~ diff --git a/output/keynote/categories/40_Conclusion/010_Conclusion.html b/output/keynote/categories/40_Conclusion/010_Conclusion.html new file mode 100644 index 000000000..1dba2f776 --- /dev/null +++ b/output/keynote/categories/40_Conclusion/010_Conclusion.html @@ -0,0 +1,8 @@ +

Conclusion

+

Category Theory oriented Programming:

+
    +
  • Focus on the type and operators
  • +
  • Extreme generalisation
  • +
  • Better modularity
  • +
  • Better control through properties of types
  • +
diff --git a/output/keynote/categories/40_Conclusion/010_Conclusion.md b/output/keynote/categories/40_Conclusion/010_Conclusion.md new file mode 100644 index 000000000..4466ee66d --- /dev/null +++ b/output/keynote/categories/40_Conclusion/010_Conclusion.md @@ -0,0 +1,9 @@ +Conclusion +---------- + +Category Theory oriented Programming: + +- Focus on the type and operators +- Extreme generalisation +- Better modularity +- Better control through properties of types diff --git a/output/keynote/categories/gen b/output/keynote/categories/gen new file mode 100755 index 000000000..925fd6c71 --- /dev/null +++ b/output/keynote/categories/gen @@ -0,0 +1,28 @@ +#!/usr/bin/env zsh + +# get script directory +if [[ ${0[0]} = '/' ]]; then + scriptdir="${0:h}" +else + scriptdir="$PWD/${0:h}" +fi + +cd $scriptdir + +# Convert all slides from markdown +for slide in **/*.md(.N); do + pandoc -f markdown -t html $slide > ${slide:r}.html +done + +{ +cat head.html +for slide in **/*.html(.N); do + case $slide in + head.html|tail.html) continue + esac + print -- '
' + cat $slide | sed 's#&#&#g' + print -- '
' +done +cat tail.html +} > ../categories.html diff --git a/output/keynote/categories/head.html b/output/keynote/categories/head.html new file mode 100644 index 000000000..f1838822b --- /dev/null +++ b/output/keynote/categories/head.html @@ -0,0 +1,68 @@ + + + + + + + + Category Theory for Programming + + + + + + + + + + + + + + + + + + + + + + + + + +
+\(\newcommand{\F}{\mathbf{F}}\) +\(\newcommand{\E}{\mathbf{E}}\) +\(\newcommand{\C}{\mathcal{C}}\) +\(\newcommand{\D}{\mathcal{D}}\) +\(\newcommand{\id}{\mathrm{id}}\) +\(\newcommand{\ob}[1]{\mathrm{ob}(#1)}\) +\(\newcommand{\hom}[1]{\mathrm{hom}(#1)}\) +\(\newcommand{\Set}{\mathbf{Set}}\) +\(\newcommand{\Mon}{\mathbf{Mon}}\) +\(\newcommand{\Vec}{\mathbf{Vec}}\) +\(\newcommand{\Grp}{\mathbf{Grp}}\) +\(\newcommand{\Rng}{\mathbf{Rng}}\) +\(\newcommand{\ML}{\mathbf{ML}}\) +\(\newcommand{\Hask}{\mathbf{Hask}}\) +\(\newcommand{\Cat}{\mathbf{Cat}}\) +\(\newcommand{\fmap}{\mathtt{fmap}}\) +
+ + + diff --git a/output/keynote/categories/img/basket_of_cats.jpg b/output/keynote/categories/img/basket_of_cats.jpg new file mode 100644 index 000000000..5e704cdfa Binary files /dev/null and b/output/keynote/categories/img/basket_of_cats.jpg differ diff --git a/output/keynote/categories/img/batquestion.jpg b/output/keynote/categories/img/batquestion.jpg new file mode 100644 index 000000000..9b5a39793 Binary files /dev/null and b/output/keynote/categories/img/batquestion.jpg differ diff --git a/output/keynote/categories/img/buddha.gif b/output/keynote/categories/img/buddha.gif new file mode 100644 index 000000000..3d18bde4e Binary files /dev/null and b/output/keynote/categories/img/buddha.gif differ diff --git a/output/keynote/categories/img/categlory.jpg b/output/keynote/categories/img/categlory.jpg new file mode 100644 index 000000000..a3fd21f73 Binary files /dev/null and b/output/keynote/categories/img/categlory.jpg differ diff --git a/output/keynote/categories/img/cats-everywhere.jpg b/output/keynote/categories/img/cats-everywhere.jpg new file mode 100644 index 000000000..792995ac7 Binary files /dev/null and b/output/keynote/categories/img/cats-everywhere.jpg differ diff --git a/output/keynote/categories/img/earth_catamorphed.gif b/output/keynote/categories/img/earth_catamorphed.gif new file mode 100644 index 000000000..734db02c8 Binary files /dev/null and b/output/keynote/categories/img/earth_catamorphed.gif differ diff --git a/output/keynote/categories/img/egyptian-hieroglyphics.jpg b/output/keynote/categories/img/egyptian-hieroglyphics.jpg new file mode 100644 index 000000000..471ab86e7 Binary files /dev/null and b/output/keynote/categories/img/egyptian-hieroglyphics.jpg differ diff --git a/output/keynote/categories/img/eilenberg.gif b/output/keynote/categories/img/eilenberg.gif new file mode 100644 index 000000000..cf07d0875 Binary files /dev/null and b/output/keynote/categories/img/eilenberg.gif differ diff --git a/output/keynote/categories/img/first-real-numbers.png b/output/keynote/categories/img/first-real-numbers.png new file mode 100644 index 000000000..c0e57b0a5 Binary files /dev/null and b/output/keynote/categories/img/first-real-numbers.png differ diff --git a/output/keynote/categories/img/fractalcat.jpg b/output/keynote/categories/img/fractalcat.jpg new file mode 100644 index 000000000..683fbc606 Binary files /dev/null and b/output/keynote/categories/img/fractalcat.jpg differ diff --git a/output/keynote/categories/img/functor-cat.gif b/output/keynote/categories/img/functor-cat.gif new file mode 100644 index 000000000..a7e9a21d1 Binary files /dev/null and b/output/keynote/categories/img/functor-cat.gif differ diff --git a/output/keynote/categories/img/isomorph-cats.jpg b/output/keynote/categories/img/isomorph-cats.jpg new file mode 100644 index 000000000..8ba870168 Binary files /dev/null and b/output/keynote/categories/img/isomorph-cats.jpg differ diff --git a/output/keynote/categories/img/lolcat.jpg b/output/keynote/categories/img/lolcat.jpg new file mode 100644 index 000000000..152f879aa Binary files /dev/null and b/output/keynote/categories/img/lolcat.jpg differ diff --git a/output/keynote/categories/img/maclaine.jpg b/output/keynote/categories/img/maclaine.jpg new file mode 100644 index 000000000..797d6e589 Binary files /dev/null and b/output/keynote/categories/img/maclaine.jpg differ diff --git a/output/keynote/categories/img/mindblown.gif b/output/keynote/categories/img/mindblown.gif new file mode 100644 index 000000000..b6f5c3be6 Binary files /dev/null and b/output/keynote/categories/img/mindblown.gif differ diff --git a/output/keynote/categories/img/mp/associativecomposition.png b/output/keynote/categories/img/mp/associativecomposition.png new file mode 100644 index 000000000..1e6a1a64d Binary files /dev/null and b/output/keynote/categories/img/mp/associativecomposition.png differ diff --git a/output/keynote/categories/img/mp/boxfunctor.png b/output/keynote/categories/img/mp/boxfunctor.png new file mode 100644 index 000000000..19838576c Binary files /dev/null and b/output/keynote/categories/img/mp/boxfunctor.png differ diff --git a/output/keynote/categories/img/mp/cat-example1.png b/output/keynote/categories/img/mp/cat-example1.png new file mode 100644 index 000000000..b6b37a57d Binary files /dev/null and b/output/keynote/categories/img/mp/cat-example1.png differ diff --git a/output/keynote/categories/img/mp/cat-example2.png b/output/keynote/categories/img/mp/cat-example2.png new file mode 100644 index 000000000..c64c8c539 Binary files /dev/null and b/output/keynote/categories/img/mp/cat-example2.png differ diff --git a/output/keynote/categories/img/mp/cat-example3.png b/output/keynote/categories/img/mp/cat-example3.png new file mode 100644 index 000000000..c7fca374e Binary files /dev/null and b/output/keynote/categories/img/mp/cat-example3.png differ diff --git a/output/keynote/categories/img/mp/cat-example4.png b/output/keynote/categories/img/mp/cat-example4.png new file mode 100644 index 000000000..f922c8ae2 Binary files /dev/null and b/output/keynote/categories/img/mp/cat-example4.png differ diff --git a/output/keynote/categories/img/mp/cat-example5.png b/output/keynote/categories/img/mp/cat-example5.png new file mode 100644 index 000000000..0da464e91 Binary files /dev/null and b/output/keynote/categories/img/mp/cat-example5.png differ diff --git a/output/keynote/categories/img/mp/cat-hask-endofunctor.png b/output/keynote/categories/img/mp/cat-hask-endofunctor.png new file mode 100644 index 000000000..d09771179 Binary files /dev/null and b/output/keynote/categories/img/mp/cat-hask-endofunctor.png differ diff --git a/output/keynote/categories/img/mp/commutative-diagram-assoc.png b/output/keynote/categories/img/mp/commutative-diagram-assoc.png new file mode 100644 index 000000000..475d27ebd Binary files /dev/null and b/output/keynote/categories/img/mp/commutative-diagram-assoc.png differ diff --git a/output/keynote/categories/img/mp/commutative-diagram-id.png b/output/keynote/categories/img/mp/commutative-diagram-id.png new file mode 100644 index 000000000..7dd1a9f92 Binary files /dev/null and b/output/keynote/categories/img/mp/commutative-diagram-id.png differ diff --git a/output/keynote/categories/img/mp/composition.png b/output/keynote/categories/img/mp/composition.png new file mode 100644 index 000000000..5b57b659d Binary files /dev/null and b/output/keynote/categories/img/mp/composition.png differ diff --git a/output/keynote/categories/img/mp/endofunctor.png b/output/keynote/categories/img/mp/endofunctor.png new file mode 100644 index 000000000..7319ee2a8 Binary files /dev/null and b/output/keynote/categories/img/mp/endofunctor.png differ diff --git a/output/keynote/categories/img/mp/functor-morphism-color.png b/output/keynote/categories/img/mp/functor-morphism-color.png new file mode 100644 index 000000000..4474d459b Binary files /dev/null and b/output/keynote/categories/img/mp/functor-morphism-color.png differ diff --git a/output/keynote/categories/img/mp/functor-morphism.png b/output/keynote/categories/img/mp/functor-morphism.png new file mode 100644 index 000000000..4cbe0b47c Binary files /dev/null and b/output/keynote/categories/img/mp/functor-morphism.png differ diff --git a/output/keynote/categories/img/mp/functor.png b/output/keynote/categories/img/mp/functor.png new file mode 100644 index 000000000..48339b36a Binary files /dev/null and b/output/keynote/categories/img/mp/functor.png differ diff --git a/output/keynote/categories/img/mp/graph-category.png b/output/keynote/categories/img/mp/graph-category.png new file mode 100644 index 000000000..a1aeed0ba Binary files /dev/null and b/output/keynote/categories/img/mp/graph-category.png differ diff --git a/output/keynote/categories/img/mp/hask-endofunctor-morphisms.png b/output/keynote/categories/img/mp/hask-endofunctor-morphisms.png new file mode 100644 index 000000000..fb6052599 Binary files /dev/null and b/output/keynote/categories/img/mp/hask-endofunctor-morphisms.png differ diff --git a/output/keynote/categories/img/mp/hask-endofunctor-objects.png b/output/keynote/categories/img/mp/hask-endofunctor-objects.png new file mode 100644 index 000000000..6308f9ce6 Binary files /dev/null and b/output/keynote/categories/img/mp/hask-endofunctor-objects.png differ diff --git a/output/keynote/categories/img/mp/hask-endofunctor.png b/output/keynote/categories/img/mp/hask-endofunctor.png new file mode 100644 index 000000000..53cf05b34 Binary files /dev/null and b/output/keynote/categories/img/mp/hask-endofunctor.png differ diff --git a/output/keynote/categories/img/mp/hask.png b/output/keynote/categories/img/mp/hask.png new file mode 100644 index 000000000..016474cfa Binary files /dev/null and b/output/keynote/categories/img/mp/hask.png differ diff --git a/output/keynote/categories/img/mp/identity.png b/output/keynote/categories/img/mp/identity.png new file mode 100644 index 000000000..75ef39375 Binary files /dev/null and b/output/keynote/categories/img/mp/identity.png differ diff --git a/output/keynote/categories/img/mp/list-maybe-endofunctor-morphism.png b/output/keynote/categories/img/mp/list-maybe-endofunctor-morphism.png new file mode 100644 index 000000000..4e2797ffe Binary files /dev/null and b/output/keynote/categories/img/mp/list-maybe-endofunctor-morphism.png differ diff --git a/output/keynote/categories/img/mp/list-tree-endofunctor-morphism.png b/output/keynote/categories/img/mp/list-tree-endofunctor-morphism.png new file mode 100644 index 000000000..1e1f2c689 Binary files /dev/null and b/output/keynote/categories/img/mp/list-tree-endofunctor-morphism.png differ diff --git a/output/keynote/categories/img/mp/main.css b/output/keynote/categories/img/mp/main.css new file mode 100644 index 000000000..e69de29bb diff --git a/output/keynote/categories/img/mp/maybe-list-endofunctor-morphsm.png b/output/keynote/categories/img/mp/maybe-list-endofunctor-morphsm.png new file mode 100644 index 000000000..7e7e8d2bd Binary files /dev/null and b/output/keynote/categories/img/mp/maybe-list-endofunctor-morphsm.png differ diff --git a/output/keynote/categories/img/mp/monoid.png b/output/keynote/categories/img/mp/monoid.png new file mode 100644 index 000000000..b5237c91b Binary files /dev/null and b/output/keynote/categories/img/mp/monoid.png differ diff --git a/output/keynote/categories/img/mp/morphisms.png b/output/keynote/categories/img/mp/morphisms.png new file mode 100644 index 000000000..9200a9482 Binary files /dev/null and b/output/keynote/categories/img/mp/morphisms.png differ diff --git a/output/keynote/categories/img/mp/nattrans-list-maybe.png b/output/keynote/categories/img/mp/nattrans-list-maybe.png new file mode 100644 index 000000000..31873f9da Binary files /dev/null and b/output/keynote/categories/img/mp/nattrans-list-maybe.png differ diff --git a/output/keynote/categories/img/mp/nattrans-list-tree.png b/output/keynote/categories/img/mp/nattrans-list-tree.png new file mode 100644 index 000000000..da67c692c Binary files /dev/null and b/output/keynote/categories/img/mp/nattrans-list-tree.png differ diff --git a/output/keynote/categories/img/mp/nattrans-maybe-list.png b/output/keynote/categories/img/mp/nattrans-maybe-list.png new file mode 100644 index 000000000..084237d2f Binary files /dev/null and b/output/keynote/categories/img/mp/nattrans-maybe-list.png differ diff --git a/output/keynote/categories/img/mp/nattrans-tree-list.png b/output/keynote/categories/img/mp/nattrans-tree-list.png new file mode 100644 index 000000000..39c2b25e0 Binary files /dev/null and b/output/keynote/categories/img/mp/nattrans-tree-list.png differ diff --git a/output/keynote/categories/img/mp/natural-transformation.png b/output/keynote/categories/img/mp/natural-transformation.png new file mode 100644 index 000000000..7289f0dd2 Binary files /dev/null and b/output/keynote/categories/img/mp/natural-transformation.png differ diff --git a/output/keynote/categories/img/mp/numbers.png b/output/keynote/categories/img/mp/numbers.png new file mode 100644 index 000000000..57870045f Binary files /dev/null and b/output/keynote/categories/img/mp/numbers.png differ diff --git a/output/keynote/categories/img/mp/objects.png b/output/keynote/categories/img/mp/objects.png new file mode 100644 index 000000000..c5dfaaf46 Binary files /dev/null and b/output/keynote/categories/img/mp/objects.png differ diff --git a/output/keynote/categories/img/mp/preorder.png b/output/keynote/categories/img/mp/preorder.png new file mode 100644 index 000000000..fa3101243 Binary files /dev/null and b/output/keynote/categories/img/mp/preorder.png differ diff --git a/output/keynote/categories/img/mp/set.png b/output/keynote/categories/img/mp/set.png new file mode 100644 index 000000000..dd19a8592 Binary files /dev/null and b/output/keynote/categories/img/mp/set.png differ diff --git a/output/keynote/categories/img/mp/strings.png b/output/keynote/categories/img/mp/strings.png new file mode 100644 index 000000000..e05029b6a Binary files /dev/null and b/output/keynote/categories/img/mp/strings.png differ diff --git a/output/keynote/categories/img/mp/tree-list-endofunctor-morphism.png b/output/keynote/categories/img/mp/tree-list-endofunctor-morphism.png new file mode 100644 index 000000000..f0babea9a Binary files /dev/null and b/output/keynote/categories/img/mp/tree-list-endofunctor-morphism.png differ diff --git a/output/keynote/categories/img/negative-numbers.jpg b/output/keynote/categories/img/negative-numbers.jpg new file mode 100644 index 000000000..d41624c2a Binary files /dev/null and b/output/keynote/categories/img/negative-numbers.jpg differ diff --git a/output/keynote/categories/img/readingcat.jpg b/output/keynote/categories/img/readingcat.jpg new file mode 100644 index 000000000..d35fe0192 Binary files /dev/null and b/output/keynote/categories/img/readingcat.jpg differ diff --git a/output/keynote/categories/img/tally-count.png b/output/keynote/categories/img/tally-count.png new file mode 100644 index 000000000..f46b8e9e5 Binary files /dev/null and b/output/keynote/categories/img/tally-count.png differ diff --git a/output/keynote/categories/img/tower_folded.gif b/output/keynote/categories/img/tower_folded.gif new file mode 100644 index 000000000..7dee0c0fb Binary files /dev/null and b/output/keynote/categories/img/tower_folded.gif differ diff --git a/output/keynote/categories/renameSlideFic.sh b/output/keynote/categories/renameSlideFic.sh new file mode 100755 index 000000000..dc8499745 --- /dev/null +++ b/output/keynote/categories/renameSlideFic.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env zsh + +# get script directory +if [[ ${0[0]} = '/' ]]; then + scriptdir="${0:h}" +else + scriptdir="$PWD/${0:h}" +fi + +cd $scriptdir + +for rep in **/{??,???}_*(N/); do + print "renaming html of $rep" + cd $rep + i=10 + for fic in *.html(.N); do + title=$( <$fic grep h2 | sed 's/<[^>]*>//g;s/&[^;]*;//g;s/[^a-zA-Z0-9]/_/g;s/__*/_/g;s/^_//;s/_$//;') + if ((i<100)); then + num="0$i" + else + num="$i" + fi + ((i+=10)) + newfic=${num}_$title.${fic:e} + [[ $fic == $newfic ]] && { continue } + [[ -e $newfic ]] && { + print -- "$newfic already exists!" >&2 + continue + } + mv $fic $newfic + mdfic=${fic:r}.md + newmdfic=${newfic:r}.md + [[ -e $mdfic ]] && mv $mdfic $newmdfic + done + cd $scriptdir +done diff --git a/output/keynote/categories/tail.html b/output/keynote/categories/tail.html new file mode 100644 index 000000000..8ca4ec3c5 --- /dev/null +++ b/output/keynote/categories/tail.html @@ -0,0 +1,57 @@ + + + + + + + + + + +

+ + / + +

+ + +
+ + + + +
+ + +# + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/output/keynote/core/deck.core.css b/output/keynote/core/deck.core.css new file mode 100644 index 000000000..823af0ff6 --- /dev/null +++ b/output/keynote/core/deck.core.css @@ -0,0 +1,407 @@ +html, body { + height: 100%; + padding: 0; + margin: 0; +} + +body.deck-container { + overflow-y: auto; + position: static; +} + +.deck-container { + position: relative; + min-height: 100%; + margin: 0 auto; + padding: 0 48px; + font-size: 16px; + line-height: 1.25; + overflow: hidden; + /* Resets and base styles from HTML5 Boilerplate */ + /* End HTML5 Boilerplate adaptations */ +} +.js .deck-container { + visibility: hidden; +} +.ready .deck-container { + visibility: visible; +} +.touch .deck-container { + -webkit-text-size-adjust: none; + -moz-text-size-adjust: none; +} +.deck-container div, .deck-container span, .deck-container object, .deck-container iframe, +.deck-container h1, .deck-container h2, .deck-container h3, .deck-container h4, .deck-container h5, .deck-container h6, .deck-container p, .deck-container blockquote, .deck-container pre, +.deck-container abbr, .deck-container address, .deck-container cite, .deck-container code, .deck-container del, .deck-container dfn, .deck-container em, .deck-container img, .deck-container ins, .deck-container kbd, .deck-container q, .deck-container samp, +.deck-container small, .deck-container strong, .deck-container sub, .deck-container sup, .deck-container var, .deck-container b, .deck-container i, .deck-container dl, .deck-container dt, .deck-container dd, .deck-container ol, .deck-container ul, .deck-container li, +.deck-container fieldset, .deck-container form, .deck-container label, .deck-container legend, +.deck-container table, .deck-container caption, .deck-container tbody, .deck-container tfoot, .deck-container thead, .deck-container tr, .deck-container th, .deck-container td, +.deck-container article, .deck-container aside, .deck-container canvas, .deck-container details, .deck-container figcaption, .deck-container figure, +.deck-container footer, .deck-container header, .deck-container hgroup, .deck-container menu, .deck-container nav, .deck-container section, .deck-container summary, +.deck-container time, .deck-container mark, .deck-container audio, .deck-container video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} +.deck-container article, .deck-container aside, .deck-container details, .deck-container figcaption, .deck-container figure, +.deck-container footer, .deck-container header, .deck-container hgroup, .deck-container menu, .deck-container nav, .deck-container section { + display: block; +} +.deck-container blockquote, .deck-container q { + quotes: none; +} +.deck-container blockquote:before, .deck-container blockquote:after, .deck-container q:before, .deck-container q:after { + content: ""; + content: none; +} +.deck-container ins { + background-color: #ff9; + color: #000; + text-decoration: none; +} +.deck-container mark { + background-color: #ff9; + color: #000; + font-style: italic; + font-weight: bold; +} +.deck-container del { + text-decoration: line-through; +} +.deck-container abbr[title], .deck-container dfn[title] { + border-bottom: 1px dotted; + cursor: help; +} +.deck-container table { + border-collapse: collapse; + border-spacing: 0; +} +.deck-container hr { + display: block; + height: 1px; + border: 0; + border-top: 1px solid #ccc; + margin: 1em 0; + padding: 0; +} +.deck-container input, .deck-container select { + vertical-align: middle; +} +.deck-container select, .deck-container input, .deck-container textarea, .deck-container button { + font: 99% sans-serif; +} +.deck-container pre, .deck-container code, .deck-container kbd, .deck-container samp { + font-family: monospace, sans-serif; +} +.deck-container a { + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); +} +.deck-container a:hover, .deck-container a:active { + outline: none; +} +.deck-container ul, .deck-container ol { + margin-left: 2em; + vertical-align: top; +} +.deck-container ol { + list-style-type: decimal; +} +.deck-container nav ul, .deck-container nav li { + margin: 0; + list-style: none; + list-style-image: none; +} +.deck-container small { + font-size: 85%; +} +.deck-container strong, .deck-container th { + font-weight: bold; +} +.deck-container td { + vertical-align: top; +} +.deck-container sub, .deck-container sup { + font-size: 75%; + line-height: 0; + position: relative; +} +.deck-container sup { + top: -0.5em; +} +.deck-container sub { + bottom: -0.25em; +} +.deck-container textarea { + overflow: auto; +} +.ie6 .deck-container legend, .ie7 .deck-container legend { + margin-left: -7px; +} +.deck-container input[type="radio"] { + vertical-align: text-bottom; +} +.deck-container input[type="checkbox"] { + vertical-align: bottom; +} +.ie7 .deck-container input[type="checkbox"] { + vertical-align: baseline; +} +.ie6 .deck-container input { + vertical-align: text-bottom; +} +.deck-container label, .deck-container input[type="button"], .deck-container input[type="submit"], .deck-container input[type="image"], .deck-container button { + cursor: pointer; +} +.deck-container button, .deck-container input, .deck-container select, .deck-container textarea { + margin: 0; +} +.deck-container input:invalid, .deck-container textarea:invalid { + border-radius: 1px; + -moz-box-shadow: 0px 0px 5px red; + -webkit-box-shadow: 0px 0px 5px red; + box-shadow: 0px 0px 5px red; +} +.deck-container input:invalid .no-boxshadow, .deck-container textarea:invalid .no-boxshadow { + background-color: #f0dddd; +} +.deck-container button { + width: auto; + overflow: visible; +} +.ie7 .deck-container img { + -ms-interpolation-mode: bicubic; +} +.deck-container, .deck-container select, .deck-container input, .deck-container textarea { + color: #444; +} +.deck-container a { + color: #607890; +} +.deck-container a:hover, .deck-container a:focus { + color: #036; +} +.deck-container a:link { + -webkit-tap-highlight-color: #fff; +} +.deck-container.deck-loading { + display: none; +} + +.slide { + width: auto; + min-height: 100%; + position: relative; +} +.slide h1 { + font-size: 4.5em; +} +.slide h1, .slide .vcenter { + font-weight: bold; + text-align: center; + padding-top: 1em; + max-height: 100%; +} +.csstransforms .slide h1, .csstransforms .slide .vcenter { + padding: 0 48px; + position: absolute; + left: 0; + right: 0; + top: 50%; + -webkit-transform: translate(0, -50%); + -moz-transform: translate(0, -50%); + -ms-transform: translate(0, -50%); + -o-transform: translate(0, -50%); + transform: translate(0, -50%); +} +.slide .vcenter h1 { + position: relative; + top: auto; + padding: 0; + -webkit-transform: none; + -moz-transform: none; + -ms-transform: none; + -o-transform: none; + transform: none; +} +.slide h2 { + font-size: 2.25em; + font-weight: bold; + padding-top: .5em; + margin: 0 0 .66666em 0; + border-bottom: 3px solid #888; +} +.slide h3 { + font-size: 1.4375em; + font-weight: bold; + margin-bottom: .30435em; +} +.slide h4 { + font-size: 1.25em; + font-weight: bold; + margin-bottom: .25em; +} +.slide h5 { + font-size: 1.125em; + font-weight: bold; + margin-bottom: .2222em; +} +.slide h6 { + font-size: 1em; + font-weight: bold; +} +.slide img, .slide iframe, .slide video { + display: block; + max-width: 100%; +} +.slide video, .slide iframe, .slide img { + display: block; + margin: 0 auto; +} +.slide p, .slide blockquote, .slide iframe, .slide img, .slide ul, .slide ol, .slide pre, .slide video { + margin-bottom: 1em; +} +.slide pre { + white-space: pre; + white-space: pre-wrap; + word-wrap: break-word; + padding: 1em; + border: 1px solid #888; +} +.slide em { + font-style: italic; +} +.slide li { + padding: .25em 0; + vertical-align: middle; +} + +.deck-before, .deck-previous, .deck-next, .deck-after { + position: absolute; + left: -999em; + top: -999em; +} + +.deck-current { + z-index: 2; +} + +.slide .slide { + visibility: hidden; + position: static; + min-height: 0; +} + +.deck-child-current { + position: static; + z-index: 2; +} +.deck-child-current .slide { + visibility: hidden; +} +.deck-child-current .deck-previous, .deck-child-current .deck-before, .deck-child-current .deck-current { + visibility: visible; +} + +@media screen and (max-device-width: 480px) { + /* html { -webkit-text-size-adjust:none; -ms-text-size-adjust:none; } */ +} +@media print { + * { + background: transparent !important; + color: black !important; + text-shadow: none !important; + filter: none !important; + -ms-filter: none !important; + -webkit-box-reflect: none !important; + -moz-box-reflect: none !important; + -webkit-box-shadow: none !important; + -moz-box-shadow: none !important; + box-shadow: none !important; + } + * :before, * :after { + display: none !important; + } + + a, a:visited { + color: #444 !important; + text-decoration: underline; + } + + a[href]:after { + content: " (" attr(href) ")"; + } + + abbr[title]:after { + content: " (" attr(title) ")"; + } + + .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { + content: ""; + } + + pre, blockquote { + border: 1px solid #999; + page-break-inside: avoid; + } + + thead { + display: table-header-group; + } + + tr, img { + page-break-inside: avoid; + } + + @page { + margin: 0.5cm; +} + + p, h2, h3 { + orphans: 3; + widows: 3; + } + + h2, h3 { + page-break-after: avoid; + } + + .slide { + position: static !important; + visibility: visible !important; + display: block !important; + -webkit-transform: none !important; + -moz-transform: none !important; + -o-transform: none !important; + -ms-transform: none !important; + transform: none !important; + opacity: 1 !important; + } + + h1, .vcenter { + -webkit-transform: none !important; + -moz-transform: none !important; + -o-transform: none !important; + -ms-transform: none !important; + transform: none !important; + padding: 0 !important; + position: static !important; + } + + .deck-container > .slide { + page-break-after: always; + } + + .deck-container { + width: 100% !important; + height: auto !important; + padding: 0 !important; + display: block !important; + } + + script { + display: none; + } +} diff --git a/output/keynote/core/deck.core.js b/output/keynote/core/deck.core.js new file mode 100644 index 000000000..997942c5c --- /dev/null +++ b/output/keynote/core/deck.core.js @@ -0,0 +1,498 @@ +/*! +Deck JS - deck.core +Copyright (c) 2011 Caleb Troughton +Dual licensed under the MIT license and GPL license. +https://github.com/imakewebthings/deck.js/blob/master/MIT-license.txt +https://github.com/imakewebthings/deck.js/blob/master/GPL-license.txt +*/ + +/* +The deck.core module provides all the basic functionality for creating and +moving through a deck. It does so by applying classes to indicate the state of +the deck and its slides, allowing CSS to take care of the visual representation +of each state. It also provides methods for navigating the deck and inspecting +its state, as well as basic key bindings for going to the next and previous +slides. More functionality is provided by wholly separate extension modules +that use the API provided by core. +*/ +(function($, deck, document, undefined) { + var slides, // Array of all the uh, slides... + current, // Array index of the current slide + $container, // Keeping this cached + + events = { + /* + This event fires whenever the current slide changes, whether by way of + next, prev, or go. The callback function is passed two parameters, from + and to, equal to the indices of the old slide and the new slide + respectively. If preventDefault is called on the event within this handler + the slide change does not occur. + + $(document).bind('deck.change', function(event, from, to) { + alert('Moving from slide ' + from + ' to ' + to); + }); + */ + change: 'deck.change', + + /* + This event fires at the beginning of deck initialization, after the options + are set but before the slides array is created. This event makes a good hook + for preprocessing extensions looking to modify the deck. + */ + beforeInitialize: 'deck.beforeInit', + + /* + This event fires at the end of deck initialization. Extensions should + implement any code that relies on user extensible options (key bindings, + element selectors, classes) within a handler for this event. Native + events associated with Deck JS should be scoped under a .deck event + namespace, as with the example below: + + var $d = $(document); + $.deck.defaults.keys.myExtensionKeycode = 70; // 'h' + $d.bind('deck.init', function() { + $d.bind('keydown.deck', function(event) { + if (event.which === $.deck.getOptions().keys.myExtensionKeycode) { + // Rock out + } + }); + }); + */ + initialize: 'deck.init' + }, + + options = {}, + $d = $(document), + + /* + Internal function. Updates slide and container classes based on which + slide is the current slide. + */ + updateStates = function() { + var oc = options.classes, + osc = options.selectors.container, + old = $container.data('onSlide'), + $all = $(); + + // Container state + $container.removeClass(oc.onPrefix + old) + .addClass(oc.onPrefix + current) + .data('onSlide', current); + + // Remove and re-add child-current classes for nesting + $('.' + oc.current).parentsUntil(osc).removeClass(oc.childCurrent); + slides[current].parentsUntil(osc).addClass(oc.childCurrent); + + // Remove previous states + $.each(slides, function(i, el) { + $all = $all.add(el); + }); + $all.removeClass([ + oc.before, + oc.previous, + oc.current, + oc.next, + oc.after + ].join(" ")); + + // Add new states back in + slides[current].addClass(oc.current); + if (current > 0) { + slides[current-1].addClass(oc.previous); + } + if (current + 1 < slides.length) { + slides[current+1].addClass(oc.next); + } + if (current > 1) { + $.each(slides.slice(0, current - 1), function(i, el) { + el.addClass(oc.before); + }); + } + if (current + 2 < slides.length) { + $.each(slides.slice(current+2), function(i, el) { + el.addClass(oc.after); + }); + } + }, + + /* Methods exposed in the jQuery.deck namespace */ + methods = { + + /* + jQuery.deck(selector, options) + + selector: string | jQuery | array + options: object, optional + + Initializes the deck, using each element matched by selector as a slide. + May also be passed an array of string selectors or jQuery objects, in + which case each selector in the array is considered a slide. The second + parameter is an optional options object which will extend the default + values. + + $.deck('.slide'); + + or + + $.deck([ + '#first-slide', + '#second-slide', + '#etc' + ]); + */ + init: function(elements, opts) { + var startTouch, + tolerance, + esp = function(e) { + e.stopPropagation(); + }; + + options = $.extend(true, {}, $[deck].defaults, opts); + slides = []; + current = 0; + $container = $(options.selectors.container); + tolerance = options.touch.swipeTolerance; + + // Pre init event for preprocessing hooks + $d.trigger(events.beforeInitialize); + + // Hide the deck while states are being applied to kill transitions + $container.addClass(options.classes.loading); + + // Fill slides array depending on parameter type + if ($.isArray(elements)) { + $.each(elements, function(i, e) { + slides.push($(e)); + }); + } + else { + $(elements).each(function(i, e) { + slides.push($(e)); + }); + } + + /* Remove any previous bindings, and rebind key events */ + $d.unbind('keydown.deck').bind('keydown.deck', function(e) { + if (e.which === options.keys.next || $.inArray(e.which, options.keys.next) > -1) { + methods.next(); + e.preventDefault(); + } + else if (e.which === options.keys.previous || $.inArray(e.which, options.keys.previous) > -1) { + methods.prev(); + e.preventDefault(); + } + }) + /* Stop propagation of key events within editable elements */ + .undelegate('input, textarea, select, button, meter, progress, [contentEditable]', 'keydown', esp) + .delegate('input, textarea, select, button, meter, progress, [contentEditable]', 'keydown', esp); + + /* Bind touch events for swiping between slides on touch devices */ + $container.unbind('touchstart.deck').bind('touchstart.deck', function(e) { + if (!startTouch) { + startTouch = $.extend({}, e.originalEvent.targetTouches[0]); + } + }) + .unbind('touchmove.deck').bind('touchmove.deck', function(e) { + $.each(e.originalEvent.changedTouches, function(i, t) { + if (startTouch && t.identifier === startTouch.identifier) { + if (t.screenX - startTouch.screenX > tolerance || t.screenY - startTouch.screenY > tolerance) { + $[deck]('prev'); + startTouch = undefined; + } + else if (t.screenX - startTouch.screenX < -1 * tolerance || t.screenY - startTouch.screenY < -1 * tolerance) { + $[deck]('next'); + startTouch = undefined; + } + return false; + } + }); + e.preventDefault(); + }) + .unbind('touchend.deck').bind('touchend.deck', function(t) { + $.each(t.originalEvent.changedTouches, function(i, t) { + if (startTouch && t.identifier === startTouch.identifier) { + startTouch = undefined; + } + }); + }) + .scrollLeft(0).scrollTop(0); + + /* + Kick iframe videos, which dont like to redraw w/ transforms. + Remove this if Webkit ever fixes it. + */ + $.each(slides, function(i, $el) { + $el.unbind('webkitTransitionEnd.deck').bind('webkitTransitionEnd.deck', + function(event) { + if ($el.hasClass($[deck]('getOptions').classes.current)) { + var embeds = $(this).find('iframe').css('opacity', 0); + window.setTimeout(function() { + embeds.css('opacity', 1); + }, 100); + } + }); + }); + + if (slides.length) { + updateStates(); + } + + // Show deck again now that slides are in place + $container.removeClass(options.classes.loading); + $d.trigger(events.initialize); + }, + + /* + jQuery.deck('go', index) + + index: integer | string + + Moves to the slide at the specified index if index is a number. Index is + 0-based, so $.deck('go', 0); will move to the first slide. If index is a + string this will move to the slide with the specified id. If index is out + of bounds or doesn't match a slide id the call is ignored. + */ + go: function(index) { + var e = $.Event(events.change), + ndx; + + /* Number index, easy. */ + if (typeof index === 'number' && index >= 0 && index < slides.length) { + ndx = index; + } + /* Id string index, search for it and set integer index */ + else if (typeof index === 'string') { + $.each(slides, function(i, $slide) { + if ($slide.attr('id') === index) { + ndx = i; + return false; + } + }); + }; + + /* Out of bounds, id doesn't exist, illegal input, eject */ + if (typeof ndx === 'undefined') return; + + $d.trigger(e, [current, ndx]); + if (e.isDefaultPrevented()) { + /* Trigger the event again and undo the damage done by extensions. */ + $d.trigger(events.change, [ndx, current]); + } + else { + current = ndx; + updateStates(); + } + }, + + /* + jQuery.deck('next') + + Moves to the next slide. If the last slide is already active, the call + is ignored. + */ + next: function() { + methods.go(current+1); + }, + + /* + jQuery.deck('prev') + + Moves to the previous slide. If the first slide is already active, the + call is ignored. + */ + prev: function() { + methods.go(current-1); + }, + + /* + jQuery.deck('getSlide', index) + + index: integer, optional + + Returns a jQuery object containing the slide at index. If index is not + specified, the current slide is returned. + */ + getSlide: function(index) { + var i = typeof index !== 'undefined' ? index : current; + if (typeof i != 'number' || i < 0 || i >= slides.length) return null; + return slides[i]; + }, + + /* + jQuery.deck('getSlides') + + Returns all slides as an array of jQuery objects. + */ + getSlides: function() { + return slides; + }, + + /* + jQuery.deck('getContainer') + + Returns a jQuery object containing the deck container as defined by the + container option. + */ + getContainer: function() { + return $container; + }, + + /* + jQuery.deck('getOptions') + + Returns the options object for the deck, including any overrides that + were defined at initialization. + */ + getOptions: function() { + return options; + }, + + /* + jQuery.deck('extend', name, method) + + name: string + method: function + + Adds method to the deck namespace with the key of name. This doesn’t + give access to any private member data — public methods must still be + used within method — but lets extension authors piggyback on the deck + namespace rather than pollute jQuery. + + $.deck('extend', 'alert', function(msg) { + alert(msg); + }); + + // Alerts 'boom' + $.deck('alert', 'boom'); + */ + extend: function(name, method) { + methods[name] = method; + } + }; + + /* jQuery extension */ + $[deck] = function(method, arg) { + if (methods[method]) { + return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); + } + else { + return methods.init(method, arg); + } + }; + + /* + The default settings object for a deck. All deck extensions should extend + this object to add defaults for any of their options. + + options.classes.after + This class is added to all slides that appear after the 'next' slide. + + options.classes.before + This class is added to all slides that appear before the 'previous' + slide. + + options.classes.childCurrent + This class is added to all elements in the DOM tree between the + 'current' slide and the deck container. For standard slides, this is + mostly seen and used for nested slides. + + options.classes.current + This class is added to the current slide. + + options.classes.loading + This class is applied to the deck container during loading phases and is + primarily used as a way to short circuit transitions between states + where such transitions are distracting or unwanted. For example, this + class is applied during deck initialization and then removed to prevent + all the slides from appearing stacked and transitioning into place + on load. + + options.classes.next + This class is added to the slide immediately following the 'current' + slide. + + options.classes.onPrefix + This prefix, concatenated with the current slide index, is added to the + deck container as you change slides. + + options.classes.previous + This class is added to the slide immediately preceding the 'current' + slide. + + options.selectors.container + Elements matched by this CSS selector will be considered the deck + container. The deck container is used to scope certain states of the + deck, as with the onPrefix option, or with extensions such as deck.goto + and deck.menu. + + options.keys.next + The numeric keycode used to go to the next slide. + + options.keys.previous + The numeric keycode used to go to the previous slide. + + options.touch.swipeTolerance + The number of pixels the users finger must travel to produce a swipe + gesture. + */ + $[deck].defaults = { + classes: { + after: 'deck-after', + before: 'deck-before', + childCurrent: 'deck-child-current', + current: 'deck-current', + loading: 'deck-loading', + next: 'deck-next', + onPrefix: 'on-slide-', + previous: 'deck-previous' + }, + + selectors: { + container: '.deck-container' + }, + + keys: { + // enter, space, page down, right arrow, down arrow, + next: [13, 32, 34, 39, 40], + // backspace, page up, left arrow, up arrow + previous: [8, 33, 37, 38] + }, + + touch: { + swipeTolerance: 60 + } + }; + + $d.ready(function() { + $('html').addClass('ready'); + }); + + /* + FF + Transforms + Flash video don't get along... + Firefox will reload and start playing certain videos after a + transform. Blanking the src when a previously shown slide goes out + of view prevents this. + */ + $d.bind('deck.change', function(e, from, to) { + var oldFrames = $[deck]('getSlide', from).find('iframe'), + newFrames = $[deck]('getSlide', to).find('iframe'); + + oldFrames.each(function() { + var $this = $(this), + curSrc = $this.attr('src'); + + if(curSrc) { + $this.data('deck-src', curSrc).attr('src', ''); + } + }); + + newFrames.each(function() { + var $this = $(this), + originalSrc = $this.data('deck-src'); + + if (originalSrc) { + $this.attr('src', originalSrc); + } + }); + }); +})(jQuery, 'deck', document); diff --git a/output/keynote/core/deck.core.scss b/output/keynote/core/deck.core.scss new file mode 100755 index 000000000..672105005 --- /dev/null +++ b/output/keynote/core/deck.core.scss @@ -0,0 +1,450 @@ +html, body { + height:100%; + padding:0; + margin:0; +} + +body.deck-container { + overflow-y:auto; + position:static; +} + +.deck-container { + position:relative; + min-height:100%; + margin:0 auto; + padding:0 48px; + font-size:16px; + line-height:1.25; + overflow:hidden; + + .js & { + visibility:hidden; + } + + .ready & { + visibility:visible; + } + + .touch & { + -webkit-text-size-adjust:none; + -moz-text-size-adjust:none; + } + + /* Resets and base styles from HTML5 Boilerplate */ + div, span, object, iframe, + h1, h2, h3, h4, h5, h6, p, blockquote, pre, + abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, + small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, + fieldset, form, label, legend, + table, caption, tbody, tfoot, thead, tr, th, td, + article, aside, canvas, details, figcaption, figure, + footer, header, hgroup, menu, nav, section, summary, + time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; + } + + article, aside, details, figcaption, figure, + footer, header, hgroup, menu, nav, section { + display: block; + } + + blockquote, q { + quotes:none; + + &:before, &:after { + content:""; + content:none; + } + } + + ins { + background-color:#ff9; + color:#000; + text-decoration:none; + } + + mark { + background-color:#ff9; + color:#000; + font-style:italic; + font-weight:bold; + } + + del { + text-decoration:line-through; + } + + abbr[title], dfn[title] { + border-bottom:1px dotted; + cursor:help; + } + + table { + border-collapse:collapse; + border-spacing:0; + } + + hr { + display:block; + height:1px; + border:0; + border-top:1px solid #ccc; + margin:1em 0; + padding:0; + } + + input, select { + vertical-align:middle; + } + + select, input, textarea, button { + font:99% sans-serif; + } + + pre, code, kbd, samp { + font-family:monospace, sans-serif; + } + + a { + -webkit-tap-highlight-color:rgba(0,0,0,0); + + &:hover, &:active { + outline:none; + } + } + + ul, ol { + margin-left:2em; + vertical-align:top; + } + + ol { + list-style-type:decimal; + } + + nav { + ul, li { + margin:0; + list-style:none; + list-style-image:none; + } + } + + small { + font-size:85%; + } + + strong, th { + font-weight:bold; + } + + td { + vertical-align:top; + } + + sub, sup { + font-size:75%; + line-height:0; + position:relative; + } + + sup { + top:-0.5em; + } + + sub { bottom: -0.25em; } + + textarea { + overflow:auto; + } + + legend { + .ie6 &, .ie7 & { + margin-left:-7px; + } + } + + input[type="radio"] { + vertical-align:text-bottom; + } + + input[type="checkbox"] { + vertical-align:bottom; + } + + .ie7 & input[type="checkbox"] { + vertical-align:baseline; + } + + .ie6 & input { + vertical-align:text-bottom; + } + + label, input[type="button"], input[type="submit"], input[type="image"], button { + cursor:pointer; + } + + button, input, select, textarea { + margin: 0; + } + + input, textarea { + &:invalid { + border-radius:1px; + -moz-box-shadow:0px 0px 5px red; + -webkit-box-shadow:0px 0px 5px red; + box-shadow: 0px 0px 5px red; + + .no-boxshadow { + background-color: #f0dddd; + } + } + } + + button { + width:auto; + overflow:visible; + } + + .ie7 & img { + -ms-interpolation-mode: bicubic; } + + &, select, input, textarea { + color:#444; + } + + a { + color:#607890; + + &:hover, &:focus { + color:#036; + } + + &:link { + -webkit-tap-highlight-color: #fff; + } + } + /* End HTML5 Boilerplate adaptations */ + + &.deck-loading { + display:none; + } +} + +.slide { + width:auto; + min-height:100%; + position:relative; + + h1 { + font-size:4.5em; + } + + h1, .vcenter { + font-weight:bold; + text-align:center; + padding-top:1em; + max-height:100%; + + .csstransforms & { + padding:0 48px; + position:absolute; + left:0; + right:0; + top:50%; + -webkit-transform:translate(0, -50%); + -moz-transform:translate(0, -50%); + -ms-transform:translate(0, -50%); + -o-transform:translate(0, -50%); + transform:translate(0, -50%); + } + } + + .vcenter h1 { + position:relative; + top:auto; + padding:0; + -webkit-transform:none; + -moz-transform:none; + -ms-transform:none; + -o-transform:none; + transform:none; + } + + h2 { + font-size:2.25em; + font-weight:bold; + padding-top:.5em; + margin:0 0 .66666em 0; + border-bottom:3px solid #888; + } + + h3 { + font-size:1.4375em; + font-weight:bold; + margin-bottom:.30435em; + } + + h4 { + font-size:1.25em; + font-weight:bold; + margin-bottom:.25em; + } + + h5 { + font-size:1.125em; + font-weight:bold; + margin-bottom:.2222em; + } + + h6 { + font-size:1em; + font-weight:bold; + } + + img, iframe, video { + display:block; + max-width:100%; + } + + video, iframe, img { + display:block; + margin:0 auto; + } + + p, blockquote, iframe, img, ul, ol, pre, video { + margin-bottom:1em; + } + + pre { + white-space:pre; + white-space:pre-wrap; + word-wrap:break-word; + padding: 1em; + border:1px solid #888; + } + + em { + font-style:italic; + } + + li { + padding:.25em 0; + vertical-align:middle; + } +} + +.deck-before, .deck-previous, .deck-next, .deck-after { + position:absolute; + left:-999em; + top:-999em; +} + +.deck-current { + z-index:2; +} + +.slide .slide { + visibility:hidden; + position:static; + min-height:0; +} + +.deck-child-current { + position:static; + z-index:2; + + .slide { + visibility:hidden; + } + + .deck-previous, .deck-before, .deck-current { + visibility:visible; + } +} + +@media all and (orientation:portrait) { + +} + +@media all and (orientation:landscape) { + +} + +@media screen and (max-device-width: 480px) { + + /* html { -webkit-text-size-adjust:none; -ms-text-size-adjust:none; } */ +} + + +@media print { + * { + background: transparent !important; + color: black !important; + text-shadow: none !important; + filter:none !important; + -ms-filter: none !important; + -webkit-box-reflect:none !important; + -moz-box-reflect:none !important; + -webkit-box-shadow:none !important; + -moz-box-shadow:none !important; + box-shadow:none !important; + + :before, :after { + display:none !important; + } +} + a, a:visited { color: #444 !important; text-decoration: underline; } + a[href]:after { content: " (" attr(href) ")"; } + abbr[title]:after { content: " (" attr(title) ")"; } + .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; } + pre, blockquote { border: 1px solid #999; page-break-inside: avoid; } + thead { display: table-header-group; } + tr, img { page-break-inside: avoid; } + @page { margin: 0.5cm; } + p, h2, h3 { orphans: 3; widows: 3; } + h2, h3{ page-break-after: avoid; } + + .slide { + position:static !important; + visibility:visible !important; + display:block !important; + -webkit-transform:none !important; + -moz-transform:none !important; + -o-transform:none !important; + -ms-transform:none !important; + transform:none !important; + opacity:1 !important; + } + + h1, .vcenter { + -webkit-transform:none !important; + -moz-transform:none !important; + -o-transform:none !important; + -ms-transform:none !important; + transform:none !important; + padding:0 !important; + position:static !important; + } + + .deck-container > .slide { + page-break-after: always; + } + + .deck-container { + width:100% !important; + height:auto !important; + padding:0 !important; + display:block !important; + } + + script { + display:none; + } +} diff --git a/output/keynote/deck2png.js b/output/keynote/deck2png.js new file mode 100644 index 000000000..576dbe083 --- /dev/null +++ b/output/keynote/deck2png.js @@ -0,0 +1,58 @@ +var webpage = require('webpage'), + page = webpage.create(), + system = require('system'), + url = system.args[1] || 'index.html', + fs = require('fs'), + imageSources = [], + imageTags; + +page.onLoadFinished = function(status) { + var slideCount; + + if (status !== 'success') { + console.log('Target file not found.'); + phantom.exit(); + } + + page.viewportSize = { + width: 960, + height: 522 + }; + + slideCount = page.evaluate(function() { + var $ = window.jQuery; + + $('html').removeClass('csstransitions cssreflections'); + $('html, body').css({ + 'width': 960, + 'height': 522, + 'overflow': 'hidden' + }); + $.deck('.slide'); + return $.deck('getSlides').length; + }); + + fs.makeDirectory('temp-slides'); + + for (var i = 0; i < slideCount; i++) { + var src = 'temp-slides/output-' + i + '.png'; + imageSources.push(src); + console.log('Rendering slide #' + i); + page.render(src); + page.evaluate(function() { + var $ = window.jQuery; + $.deck('next'); + }); + } + + imageTags = imageSources.map(function(src) { + return ''; + }); + + var output = imageTags.join('') + ''; + fs.write('temp-output.html', output, 'w'); + + phantom.exit(); +}; + +page.open(url); diff --git a/output/keynote/extensions/goto/deck.goto.css b/output/keynote/extensions/goto/deck.goto.css new file mode 100644 index 000000000..108e4f9c4 --- /dev/null +++ b/output/keynote/extensions/goto/deck.goto.css @@ -0,0 +1,41 @@ +.deck-container .goto-form { + position: absolute; + z-index: 3; + bottom: 10px; + left: 50%; + height: 1.75em; + margin: 0 0 0 -9.125em; + line-height: 1.75em; + padding: 0.625em; + display: none; + background: #ccc; + overflow: hidden; +} +.borderradius .deck-container .goto-form { + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + border-radius: 10px; +} +.deck-container .goto-form label { + font-weight: bold; +} +.deck-container .goto-form label, .deck-container .goto-form input { + display: inline-block; + font-family: inherit; +} + +.deck-goto .goto-form { + display: block; +} + +#goto-slide { + width: 8.375em; + margin: 0 0.625em; + height: 1.4375em; +} + +@media print { + .goto-form, #goto-slide { + display: none !important; + } +} diff --git a/output/keynote/extensions/goto/deck.goto.html b/output/keynote/extensions/goto/deck.goto.html new file mode 100644 index 000000000..e3b6a1862 --- /dev/null +++ b/output/keynote/extensions/goto/deck.goto.html @@ -0,0 +1,7 @@ + +
+ + + + +
\ No newline at end of file diff --git a/output/keynote/extensions/goto/deck.goto.js b/output/keynote/extensions/goto/deck.goto.js new file mode 100644 index 000000000..eedba10b1 --- /dev/null +++ b/output/keynote/extensions/goto/deck.goto.js @@ -0,0 +1,170 @@ +/*! +Deck JS - deck.goto +Copyright (c) 2011 Caleb Troughton +Dual licensed under the MIT license and GPL license. +https://github.com/imakewebthings/deck.js/blob/master/MIT-license.txt +https://github.com/imakewebthings/deck.js/blob/master/GPL-license.txt +*/ + +/* +This module adds the necessary methods and key bindings to show and hide a form +for jumping to any slide number/id in the deck (and processes that form +accordingly). The form-showing state is indicated by the presence of a class on +the deck container. +*/ +(function($, deck, undefined) { + var $d = $(document); + + /* + Extends defaults/options. + + options.classes.goto + This class is added to the deck container when showing the Go To Slide + form. + + options.selectors.gotoDatalist + The element that matches this selector is the datalist element that will + be populated with options for each of the slide ids. In browsers that + support the datalist element, this provides a drop list of slide ids to + aid the user in selecting a slide. + + options.selectors.gotoForm + The element that matches this selector is the form that is submitted + when a user hits enter after typing a slide number/id in the gotoInput + element. + + options.selectors.gotoInput + The element that matches this selector is the text input field for + entering a slide number/id in the Go To Slide form. + + options.keys.goto + The numeric keycode used to show the Go To Slide form. + + options.countNested + If false, only top level slides will be counted when entering a + slide number. + */ + $.extend(true, $[deck].defaults, { + classes: { + goto: 'deck-goto' + }, + + selectors: { + gotoDatalist: '#goto-datalist', + gotoForm: '.goto-form', + gotoInput: '#goto-slide' + }, + + keys: { + goto: 71 // g + }, + + countNested: true + }); + + /* + jQuery.deck('showGoTo') + + Shows the Go To Slide form by adding the class specified by the goto class + option to the deck container. + */ + $[deck]('extend', 'showGoTo', function() { + $[deck]('getContainer').addClass($[deck]('getOptions').classes.goto); + $($[deck]('getOptions').selectors.gotoInput).focus(); + }); + + /* + jQuery.deck('hideGoTo') + + Hides the Go To Slide form by removing the class specified by the goto class + option from the deck container. + */ + $[deck]('extend', 'hideGoTo', function() { + $($[deck]('getOptions').selectors.gotoInput).blur(); + $[deck]('getContainer').removeClass($[deck]('getOptions').classes.goto); + }); + + /* + jQuery.deck('toggleGoTo') + + Toggles between showing and hiding the Go To Slide form. + */ + $[deck]('extend', 'toggleGoTo', function() { + $[deck]($[deck]('getContainer').hasClass($[deck]('getOptions').classes.goto) ? 'hideGoTo' : 'showGoTo'); + }); + + $d.bind('deck.init', function() { + var opts = $[deck]('getOptions'), + $datalist = $(opts.selectors.gotoDatalist), + slideTest = $.map([ + opts.classes.before, + opts.classes.previous, + opts.classes.current, + opts.classes.next, + opts.classes.after + ], function(el, i) { + return '.' + el; + }).join(', '), + rootCounter = 1; + + // Bind key events + $d.unbind('keydown.deckgoto').bind('keydown.deckgoto', function(e) { + var key = $[deck]('getOptions').keys.goto; + + if (e.which === key || $.inArray(e.which, key) > -1) { + e.preventDefault(); + $[deck]('toggleGoTo'); + } + }); + + /* Populate datalist and work out countNested*/ + $.each($[deck]('getSlides'), function(i, $slide) { + var id = $slide.attr('id'), + $parentSlides = $slide.parentsUntil(opts.selectors.container, slideTest); + + if (id) { + $datalist.append('