diff --git a/content/html/en/blog/Haskell-Mandelbrot.md b/content/html/en/blog/Haskell-Mandelbrot.md index 475200130..a4f4109bf 100644 --- a/content/html/en/blog/Haskell-Mandelbrot.md +++ b/content/html/en/blog/Haskell-Mandelbrot.md @@ -10,7 +10,7 @@ author_uri: yannesposito.com ----- Here is the obfuscated code: - + a=27;b=79;c=C(-2.0,-1.0);d=C(1.0,1.0);e=C(-2.501,-1.003) newtype C = C (Double,Double) deriving (Show,Eq) 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);abs(C(x,y))=C(sqrt(x*x+y*y),0.0) @@ -27,7 +27,7 @@ To launch it, you'll need to have [haskell](http://haskell.org) installed and to Here is some image after 50 iterations: - +
 ###@@@@@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&WWOOClbUOWW&&$$$$$$$$$$$$$$
 ##@@@@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&WWUCUb; ,jUOWW&&&$$$$$$$$$$$$
 #@@@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&WWWWWUb       ooCWW&&&&&&$$$$$$$$
@@ -54,11 +54,11 @@ $$$$$$$$$$$$$$$$$&&WWWWWWW&&&WWWWWWWWOUo                                 jUOWW&&
 $$$$$$$$$$$$$$$$$$$$$&&&&&&&&&&&&WWWWWWOCCbi                              bWWW&&
 $$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&&&&&&WWWWOUC,                         j    llW&&$
 @$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&&WWWUcr,iiCb                o wUUUUUC;OW&$$
-
+
Here is the more readable version. I believe with this far more readable version, no more explanation is needed. - + nbvert = 30 nbhor = 79 zoomfactor = 1.01 diff --git a/content/html/fr/blog/Haskell-Mandelbrot.md b/content/html/fr/blog/Haskell-Mandelbrot.md index 98ef242f0..4c0126909 100644 --- a/content/html/fr/blog/Haskell-Mandelbrot.md +++ b/content/html/fr/blog/Haskell-Mandelbrot.md @@ -10,7 +10,7 @@ author_uri: yannesposito.com ----- Voici le code "obfusqué" : - + a=27;b=79;c=C(-2.0,-1.0);d=C(1.0,1.0);e=C(-2.501,-1.003) newtype C = C (Double,Double) deriving (Show,Eq) 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);abs(C(x,y))=C(sqrt(x*x+y*y),0.0) @@ -27,7 +27,7 @@ Pour le lancer, [haskell](http://haskell.org) doit être installé. Puis vous de Voici le résultat après 50 itérations. - +
 ###@@@@@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&WWOOClbUOWW&&$$$$$$$$$$$$$$
 ##@@@@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&WWUCUb; ,jUOWW&&&$$$$$$$$$$$$
 #@@@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&WWWWWUb       ooCWW&&&&&&$$$$$$$$
@@ -54,11 +54,11 @@ $$$$$$$$$$$$$$$$$&&WWWWWWW&&&WWWWWWWWOUo                                 jUOWW&&
 $$$$$$$$$$$$$$$$$$$$$&&&&&&&&&&&&WWWWWWOCCbi                              bWWW&&
 $$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&&&&&&WWWWOUC,                         j    llW&&$
 @$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&&WWWUcr,iiCb                o wUUUUUC;OW&$$
-
+
Here is the more readable version. I believe with this far more readable version, no more explanation is needed. - + nbvert = 30 nbhor = 79 zoomfactor = 1.01 diff --git a/multi/blog/Haskell-Mandelbrot.md b/multi/blog/Haskell-Mandelbrot.md index 3bf3b3f3d..9876a7e43 100644 --- a/multi/blog/Haskell-Mandelbrot.md +++ b/multi/blog/Haskell-Mandelbrot.md @@ -12,7 +12,7 @@ author_uri: yannesposito.com en: Here is the obfuscated code: fr: Voici le code "obfusqué" : - + a=27;b=79;c=C(-2.0,-1.0);d=C(1.0,1.0);e=C(-2.501,-1.003) newtype C = C (Double,Double) deriving (Show,Eq) 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);abs(C(x,y))=C(sqrt(x*x+y*y),0.0) @@ -31,7 +31,7 @@ fr: Pour le lancer, [haskell](http://haskell.org) doit être installé. Puis vou en: Here is some image after 50 iterations: fr: Voici le résultat après 50 itérations. - +
 ###@@@@@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&WWOOClbUOWW&&$$$$$$$$$$$$$$
 ##@@@@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&WWUCUb; ,jUOWW&&&$$$$$$$$$$$$
 #@@@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&WWWWWUb       ooCWW&&&&&&$$$$$$$$
@@ -58,11 +58,11 @@ $$$$$$$$$$$$$$$$$&&WWWWWWW&&&WWWWWWWWOUo                                 jUOWW&&
 $$$$$$$$$$$$$$$$$$$$$&&&&&&&&&&&&WWWWWWOCCbi                              bWWW&&
 $$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&&&&&&WWWWOUC,                         j    llW&&$
 @$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&&WWWUcr,iiCb                o wUUUUUC;OW&$$
-
+
Here is the more readable version. I believe with this far more readable version, no more explanation is needed. - + nbvert = 30 nbhor = 79 zoomfactor = 1.01 diff --git a/output/Scratch/en/blog/Haskell-Mandelbrot/index.html b/output/Scratch/en/blog/Haskell-Mandelbrot/index.html index 4171034ae..859f9abdb 100644 --- a/output/Scratch/en/blog/Haskell-Mandelbrot/index.html +++ b/output/Scratch/en/blog/Haskell-Mandelbrot/index.html @@ -60,14 +60,14 @@
-a=27;b=79;c=C(-2.0,-1.0);d=C(1.0,1.0);e=C(-2.501,-1.003)
-newtype C = C (Double,Double) deriving (Show,Eq)
-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);abs(C(x,y))=C(sqrt(x*x+y*y),0.0)
-r(C(x,y))=x;i(C(x,y))=y
-f c z 0=0;f c z n=if(r(abs(z))>2)then n else f c ((z*z)+c) (n-1)
-h j k = map (\z->(f (C z) (C(0,0)) 32,(fst z>l - q/2))) [(x,y)|y<-[p,(p+((o-p)/a))..o],x<-[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=!%*§&$@#"!!i):rst p;rst True="\n";rst False=""
-main = putStrLn $ im 0 where cl n (C (x,y))=let cs=(1.1**n-1) in C ((x+cs*(r e))/cs+1,(y+cs*(i e))/cs+1);bl n=cl n c;tr n=cl n d;im n=u (bl n) (tr n)++"\x1b[H\x1b[25A"++im (n+1)
+a=27;b=79;c=C(-2.0,-1.0);d=C(1.0,1.0);e=C(-2.501,-1.003)
+newtype C = C (Double,Double) deriving (Show,Eq)
+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);abs(C(x,y))=C(sqrt(x*x+y*y),0.0)
+r(C(x,y))=x;i(C(x,y))=y
+f c z 0=0;f c z n=if(r(abs(z))>2)then n else f c ((z*z)+c) (n-1)
+h j k = map (\z→(f (C z) (C(0,0)) 32,(fst z>l - q/2))) [(x,y)|y←[p,(p+((o-p)/a))..o],x←[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=!%*§&$@#"!!i):rst p;rst True="\n";rst False=""
+main = putStrLn $ im 0 where cl n (C (x,y))=let cs=(1.1**n-1) in C ((x+cs*(r e))/cs+1,(y+cs*(i e))/cs+1);bl n=cl n c;tr n=cl n d;im n=u (bl n) (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UCl bCiUUUUUCj, bOW& -$$$$$$$$$$$$$$&&&WWOwOOWWWOUUOWWWWWOOUbw j.blW& -$$$$$$$$$$$$$$$$$&&WWWWWWW&&&WWWWWWWWOUo jUOWW&& -$$$$$$$$$$$$$$$$$$$$$&&&&&&&&&&&&WWWWWWOCCbi bWWW&& -$$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&&&&&&WWWWOUC, j llW&&$ -@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&&WWWUcr,iiCb o wUUUUUC;OW&$$ +
+###@@@@@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&WWOOClbUOWW&&$$$$$$$$$$$$$$
+##@@@@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&WWUCUb; ,jUOWW&&&$$$$$$$$$$$$
+#@@@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&WWWWWUb       ooCWW&&&&&&$$$$$$$$
+@@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&WWWWWWWWOU         uUOWWWW&&&&&&$$$$$
+@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&WOUObUOOOUUUCbi      rbCUUUOWWWWWOUW&$$$
+@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&&WWWUcr,iiCb                o wUUUUUC;OW&$$
+$$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&&&&&&WWWWOUC,                         j    llW&&$
+$$$$$$$$$$$$$$$$$$$$$&&&&&&&&&&&&WWWWWWOCCbi                              bWWW&&
+$$$$$$$$$$$$$$$$$&&WWWWWWW&&&WWWWWWWWOUo                                 jUOWW&&
+$$$$$$$$$$$$$$&&&WWOwOOWWWOUUOWWWWWOOUbw                                  j.blW&
+$$$$$$$$$$$&&&&&WWWObiijbUCl bCiUUUUUCj,                                    bOW&
+$$$$$$$$$&&&&&&&WWWOUbw  ;      oobCbl                                     jUWW&
+$$$$$$$&&&&&&&WWWWOcbi             ij                                      jUW&&
+$$$$$&&WWWWWWWOwUUCbw                                                       WW&&
+WWWOWWWWWWWWWUUbo                                                         UWWW&&
+:                                                                      wbUOWW&&&
+WWWOWWWWWWWWWUUbo                                                         UWWW&&
+$$$$$&&WWWWWWWOwUUCbw                                                       WW&&
+$$$$$$$&&&&&&&WWWWOcbi             ij                                      jUW&&
+$$$$$$$$$&&&&&&&WWWOUbw  ;      oobCbl                                     jUWW&
+$$$$$$$$$$$&&&&&WWWObiijbUCl bCiUUUUUCj,                                    bOW&
+$$$$$$$$$$$$$$&&&WWOwOOWWWOUUOWWWWWOOUbw                                  j.blW&
+$$$$$$$$$$$$$$$$$&&WWWWWWW&&&WWWWWWWWOUo                                 jUOWW&&
+$$$$$$$$$$$$$$$$$$$$$&&&&&&&&&&&&WWWWWWOCCbi                              bWWW&&
+$$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&&&&&&WWWWOUC,                         j    llW&&$
+@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&&WWWUcr,iiCb                o wUUUUUC;OW&$$
 

Here is the more readable version. I believe with this far more readable version, no more explanation is needed.

@@ -113,33 +113,33 @@ WWWOWWWWWWWWWUUbo UWWWC
(-2.0,-2.0) +init_top_right = C (3.0,2.0) +interrest = C (-1.713,-0.000) -newtype Complex = C (Float,Float) deriving (Show,Eq) -instance Num Complex where - fromInteger n = C (fromIntegral n,0.0) - 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) - abs (C (x,y)) = C (sqrt (x*x + y*y),0.0) - signum (C (x,y)) = C (signum x , 0.0) +newtype Complex = C (Float,Float) deriving (Show,Eq) +instance Num Complex where + fromInteger n = C (fromIntegral n,0.0) + 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) + abs (C (x,y)) = C (sqrt (x*x + y*y),0.0) + signum (C (x,y)) = C (signum x , 0.0) -real :: Complex -> Float -real (C (x,y)) = x -im :: Complex -> Float -im (C (x,y)) = y +real :: ComplexFloat +real (C (x,y)) = x +im :: ComplexFloat +im (C (x,y)) = y -cabs :: Complex -> Float -cabs = real.abs +cabs :: ComplexFloat +cabs = real.abs -f :: Complex -> Complex -> Int -> Int +f :: ComplexComplexIntInt f c z 0 = 0 -f c z n = if (cabs z > 2) then n else f c ((z*z)+c) (n-1) +f c z n = if (cabs z > 2) then n else f c ((z*z)+c) (n-1) -bmandel bottomleft topright = map (\z -> (f (C z) (C(0,0)) 32, (fst z > right - hstep/2 ))) [(x,y) | y <- [bottom,(bottom + vstep)..top], x<-[left,(left + hstep)..right]] - where +bmandel bottomleft topright = map (\z → (f (C z) (C(0,0)) 32, (fst z > right - hstep/2 ))) [(x,y) | y ← [bottom,(bottom + vstep)..top], x←[left,(left + hstep)..right]] + where top = im topright bottom = im bottomleft left = real bottomleft @@ -147,30 +147,30 @@ bmandel bottomleft topright = map (\z -> String -mandel (bottomleft,topright) = concat $ map treat $ bmandel bottomleft topright - where - treat (i,jump) = " .,:;rcuowijlbCUOW&$@#" !! (div (i*22) 32):rst jump - rst True = "\n" - rst False = "" +mandel :: (Complex,Complex) → String +mandel (bottomleft,topright) = concat $ map treat $ bmandel bottomleft topright + where + treat (i,jump) = " .,:;rcuowijlbCUOW&$@#" !! (div (i*22) 32):rst jump + rst True = "\n" + rst False = "" -cdiv :: Complex -> Float -> Complex -cdiv (C(x,y)) r = C(x/r, y/r) -cmul :: Complex -> Float -> Complex -cmul (C(x,y)) r = C(x*r, y*r) +cdiv :: ComplexFloatComplex +cdiv (C(x,y)) r = C(x/r, y/r) +cmul :: ComplexFloatComplex +cmul (C(x,y)) r = C(x*r, y*r) -zoom :: Complex -> Complex -> Complex -> Float -> (Complex,Complex) +zoom :: ComplexComplexComplexFloat → (Complex,Complex) zoom bl tr center magn = (f bl, f tr) - where - f point = ((center `cmul` magn) + point ) `cdiv` (magn + 1) + where + f point = ((center `cmul` magn) + point ) `cdiv` (magn + 1) main = do - x <- getContents - putStrLn $ infinitemandel 0 - where + x ← getContents + putStrLn $ infinitemandel 0 + where window n = zoom init_bottom_left init_top_right interrest (zoomfactor**n) - infinitemandel n = mandel (window n) ++ "\x1b[H\x1b[25A" ++ infinitemandel (n+1) + infinitemandel n = mandel (window n) ++ "\x1b[H\x1b[25A" ++ infinitemandel (n+1) diff --git a/output/Scratch/en/blog/feed/feed.xml b/output/Scratch/en/blog/feed/feed.xml index 65bea937e..0ab72ae8d 100644 --- a/output/Scratch/en/blog/feed/feed.xml +++ b/output/Scratch/en/blog/feed/feed.xml @@ -23,11 +23,9 @@ <div class="code"><div class="file"><a href="/Scratch/en/blog/Haskell-Mandelbrot/code/animandel.hs"> &#x27A5; animandel.hs </a></div><div class="withfile"> <pre class="twilight"> -a=27<span class="Keyword">;</span>b=79<span class="Keyword">;</span>c=C(-2.0,-1.0)<span class="Keyword">;</span>d=C(1.0,1.0)<span class="Keyword">;</span>e=C(-2.501,-1.003) -newtype C = C (Double,Double) deriving (Show,Eq) -instance Num C where C(x,y)*C(z,t)=C(z*x-y*t,y*z+x*t)<span class="Keyword">;</span>C(x,y)+C(z,t)=C(x+z,y+t)<span class="Keyword">;</span>abs(C(x,y))=C(sqrt(x*x+y*y),0.0) -r(C(x,y))=x<span class="Keyword">;</span>i(C(x,y))=y -f c z 0=0<span class="Keyword">;</span>f c z n=<span class="Keyword">if</span>(r(abs(z))<span class="Keyword">&gt;</span>2)</pre></div></div> +a=27;b=79;c=<span class="Constant">C</span>(-2.0,-1.0);d=<span class="Constant">C</span>(1.0,1.0);e=<span class="Constant">C</span>(-2.501,-1.003) +<span class="Keyword">newtype</span> <span class="Constant">C</span> = <span class="Constant">C</span> (<span class="Constant">Double</span>,<span class="Constant">Double</span>) <span class="Keyword">deriving</span> (<span class="Constant">Show</span>,<span class="Constant">Eq</span>) +<span class="Keyword">instance</span> <span class="Constant">Num</span> <span class="Constant">C</span> <span class="Keyword">where</span> </pre></div></div> tag:yannesposito.com,2011-05-18:/Scratch/en/blog/Password-Management/ diff --git a/output/Scratch/en/blog/index.html b/output/Scratch/en/blog/index.html index b493adde6..e7e73ab5d 100644 --- a/output/Scratch/en/blog/index.html +++ b/output/Scratch/en/blog/index.html @@ -88,11 +88,9 @@ Last 5 Articles
-a=27;b=79;c=C(-2.0,-1.0);d=C(1.0,1.0);e=C(-2.501,-1.003)
-newtype C = C (Double,Double) deriving (Show,Eq)
-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);abs(C(x,y))=C(sqrt(x*x+y*y),0.0)
-r(C(x,y))=x;i(C(x,y))=y
-f c z 0=0;f c z n=if(r(abs(z))>2)
+a=27;b=79;c=C(-2.0,-1.0);d=C(1.0,1.0);e=C(-2.501,-1.003) +newtype C = C (Double,Double) deriving (Show,Eq) +instance Num C where
diff --git a/output/Scratch/fr/blog/Haskell-Mandelbrot/index.html b/output/Scratch/fr/blog/Haskell-Mandelbrot/index.html index 80923ece5..cb98c199d 100644 --- a/output/Scratch/fr/blog/Haskell-Mandelbrot/index.html +++ b/output/Scratch/fr/blog/Haskell-Mandelbrot/index.html @@ -60,14 +60,14 @@
-a=27;b=79;c=C(-2.0,-1.0);d=C(1.0,1.0);e=C(-2.501,-1.003)
-newtype C = C (Double,Double) deriving (Show,Eq)
-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);abs(C(x,y))=C(sqrt(x*x+y*y),0.0)
-r(C(x,y))=x;i(C(x,y))=y
-f c z 0=0;f c z n=if(r(abs(z))>2)then n else f c ((z*z)+c) (n-1)
-h j k = map (\z->(f (C z) (C(0,0)) 32,(fst z>l - q/2))) [(x,y)|y<-[p,(p+((o-p)/a))..o],x<-[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=!%*§&$@#"!!i):rst p;rst True="\n";rst False=""
-main = putStrLn $ im 0 where cl n (C (x,y))=let cs=(1.1**n-1) in C ((x+cs*(r e))/cs+1,(y+cs*(i e))/cs+1);bl n=cl n c;tr n=cl n d;im n=u (bl n) (tr n)++"\x1b[H\x1b[25A"++im (n+1)
+a=27;b=79;c=C(-2.0,-1.0);d=C(1.0,1.0);e=C(-2.501,-1.003)
+newtype C = C (Double,Double) deriving (Show,Eq)
+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);abs(C(x,y))=C(sqrt(x*x+y*y),0.0)
+r(C(x,y))=x;i(C(x,y))=y
+f c z 0=0;f c z n=if(r(abs(z))>2)then n else f c ((z*z)+c) (n-1)
+h j k = map (\z→(f (C z) (C(0,0)) 32,(fst z>l - q/2))) [(x,y)|y←[p,(p+((o-p)/a))..o],x←[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=!%*§&$@#"!!i):rst p;rst True="\n";rst False=""
+main = putStrLn $ im 0 where cl n (C (x,y))=let cs=(1.1**n-1) in C ((x+cs*(r e))/cs+1,(y+cs*(i e))/cs+1);bl n=cl n c;tr n=cl n d;im n=u (bl n) (tr n)++"\x1b[H\x1b[25A"++im (n+1)
 
@@ -78,33 +78,33 @@ u j k = concat $ map v $ h j k where v (i,p)=( -###@@@@@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&WWOOClbUOWW&&$$$$$$$$$$$$$$ -##@@@@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&WWUCUb; ,jUOWW&&&$$$$$$$$$$$$ -#@@@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&WWWWWUb ooCWW&&&&&&$$$$$$$$ -@@@@$$$$$$$$$$$$$$$$$$$$$$$$$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WOOClbUOWW&&$$$$$$$$$$$$$$
+##@@@@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&WWUCUb; ,jUOWW&&&$$$$$$$$$$$$
+#@@@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&WWWWWUb       ooCWW&&&&&&$$$$$$$$
+@@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&WWWWWWWWOU         uUOWWWW&&&&&&$$$$$
+@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&WOUObUOOOUUUCbi      rbCUUUOWWWWWOUW&$$$
+@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&&WWWUcr,iiCb                o wUUUUUC;OW&$$
+$$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&&&&&&WWWWOUC,                         j    llW&&$
+$$$$$$$$$$$$$$$$$$$$$&&&&&&&&&&&&WWWWWWOCCbi                              bWWW&&
+$$$$$$$$$$$$$$$$$&&WWWWWWW&&&WWWWWWWWOUo                                 jUOWW&&
+$$$$$$$$$$$$$$&&&WWOwOOWWWOUUOWWWWWOOUbw                                  j.blW&
+$$$$$$$$$$$&&&&&WWWObiijbUCl bCiUUUUUCj,                                    bOW&
+$$$$$$$$$&&&&&&&WWWOUbw  ;      oobCbl                                     jUWW&
+$$$$$$$&&&&&&&WWWWOcbi             ij                                      jUW&&
+$$$$$&&WWWWWWWOwUUCbw                                                       WW&&
+WWWOWWWWWWWWWUUbo                                                         UWWW&&
+:                                                                      wbUOWW&&&
+WWWOWWWWWWWWWUUbo                                                         UWWW&&
+$$$$$&&WWWWWWWOwUUCbw                                                       WW&&
+$$$$$$$&&&&&&&WWWWOcbi             ij                                      jUW&&
+$$$$$$$$$&&&&&&&WWWOUbw  ;      oobCbl                                     jUWW&
+$$$$$$$$$$$&&&&&WWWObiijbUCl bCiUUUUUCj,                                    bOW&
+$$$$$$$$$$$$$$&&&WWOwOOWWWOUUOWWWWWOOUbw                                  j.blW&
+$$$$$$$$$$$$$$$$$&&WWWWWWW&&&WWWWWWWWOUo                                 jUOWW&&
+$$$$$$$$$$$$$$$$$$$$$&&&&&&&&&&&&WWWWWWOCCbi                              bWWW&&
+$$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&&&&&&WWWWOUC,                         j    llW&&$
+@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&&&&&&WWWUcr,iiCb                o wUUUUUC;OW&$$
 

Here is the more readable version. I believe with this far more readable version, no more explanation is needed.

@@ -113,33 +113,33 @@ WWWOWWWWWWWWWUUbo UWWWC
(-2.0,-2.0) +init_top_right = C (3.0,2.0) +interrest = C (-1.713,-0.000) -newtype Complex = C (Float,Float) deriving (Show,Eq) -instance Num Complex where - fromInteger n = C (fromIntegral n,0.0) - 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) - abs (C (x,y)) = C (sqrt (x*x + y*y),0.0) - signum (C (x,y)) = C (signum x , 0.0) +newtype Complex = C (Float,Float) deriving (Show,Eq) +instance Num Complex where + fromInteger n = C (fromIntegral n,0.0) + 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) + abs (C (x,y)) = C (sqrt (x*x + y*y),0.0) + signum (C (x,y)) = C (signum x , 0.0) -real :: Complex -> Float -real (C (x,y)) = x -im :: Complex -> Float -im (C (x,y)) = y +real :: ComplexFloat +real (C (x,y)) = x +im :: ComplexFloat +im (C (x,y)) = y -cabs :: Complex -> Float -cabs = real.abs +cabs :: ComplexFloat +cabs = real.abs -f :: Complex -> Complex -> Int -> Int +f :: ComplexComplexIntInt f c z 0 = 0 -f c z n = if (cabs z > 2) then n else f c ((z*z)+c) (n-1) +f c z n = if (cabs z > 2) then n else f c ((z*z)+c) (n-1) -bmandel bottomleft topright = map (\z -> (f (C z) (C(0,0)) 32, (fst z > right - hstep/2 ))) [(x,y) | y <- [bottom,(bottom + vstep)..top], x<-[left,(left + hstep)..right]] - where +bmandel bottomleft topright = map (\z → (f (C z) (C(0,0)) 32, (fst z > right - hstep/2 ))) [(x,y) | y ← [bottom,(bottom + vstep)..top], x←[left,(left + hstep)..right]] + where top = im topright bottom = im bottomleft left = real bottomleft @@ -147,30 +147,30 @@ bmandel bottomleft topright = map (\z -> String -mandel (bottomleft,topright) = concat $ map treat $ bmandel bottomleft topright - where - treat (i,jump) = " .,:;rcuowijlbCUOW&$@#" !! (div (i*22) 32):rst jump - rst True = "\n" - rst False = "" +mandel :: (Complex,Complex) → String +mandel (bottomleft,topright) = concat $ map treat $ bmandel bottomleft topright + where + treat (i,jump) = " .,:;rcuowijlbCUOW&$@#" !! (div (i*22) 32):rst jump + rst True = "\n" + rst False = "" -cdiv :: Complex -> Float -> Complex -cdiv (C(x,y)) r = C(x/r, y/r) -cmul :: Complex -> Float -> Complex -cmul (C(x,y)) r = C(x*r, y*r) +cdiv :: ComplexFloatComplex +cdiv (C(x,y)) r = C(x/r, y/r) +cmul :: ComplexFloatComplex +cmul (C(x,y)) r = C(x*r, y*r) -zoom :: Complex -> Complex -> Complex -> Float -> (Complex,Complex) +zoom :: ComplexComplexComplexFloat → (Complex,Complex) zoom bl tr center magn = (f bl, f tr) - where - f point = ((center `cmul` magn) + point ) `cdiv` (magn + 1) + where + f point = ((center `cmul` magn) + point ) `cdiv` (magn + 1) main = do - x <- getContents - putStrLn $ infinitemandel 0 - where + x ← getContents + putStrLn $ infinitemandel 0 + where window n = zoom init_bottom_left init_top_right interrest (zoomfactor**n) - infinitemandel n = mandel (window n) ++ "\x1b[H\x1b[25A" ++ infinitemandel (n+1) + infinitemandel n = mandel (window n) ++ "\x1b[H\x1b[25A" ++ infinitemandel (n+1)
diff --git a/output/Scratch/fr/blog/feed/feed.xml b/output/Scratch/fr/blog/feed/feed.xml index fd2f90722..e81f252c3 100644 --- a/output/Scratch/fr/blog/feed/feed.xml +++ b/output/Scratch/fr/blog/feed/feed.xml @@ -23,11 +23,9 @@ <div class="code"><div class="file"><a href="/Scratch/fr/blog/Haskell-Mandelbrot/code/animandel.hs"> &#x27A5; animandel.hs </a></div><div class="withfile"> <pre class="twilight"> -a=27<span class="Keyword">;</span>b=79<span class="Keyword">;</span>c=C(-2.0,-1.0)<span class="Keyword">;</span>d=C(1.0,1.0)<span class="Keyword">;</span>e=C(-2.501,-1.003) -newtype C = C (Double,Double) deriving (Show,Eq) -instance Num C where C(x,y)*C(z,t)=C(z*x-y*t,y*z+x*t)<span class="Keyword">;</span>C(x,y)+C(z,t)=C(x+z,y+t)<span class="Keyword">;</span>abs(C(x,y))=C(sqrt(x*x+y*y),0.0) -r(C(x,y))=x<span class="Keyword">;</span>i(C(x,y))=y -f c z 0=0<span class="Keyword">;</span>f c z n=<span class="Keyword">if</span>(r(abs(z))<span class="Keyword">&gt;</span></pre></div></div> +a=27;b=79;c=<span class="Constant">C</span>(-2.0,-1.0);d=<span class="Constant">C</span>(1.0,1.0);e=<span class="Constant">C</span>(-2.501,-1.003) +<span class="Keyword">newtype</span> <span class="Constant">C</span> = <span class="Constant">C</span> (<span class="Constant">Double</span>,<span class="Constant">Double</span>) <span class="Keyword">deriving</span> (<span class="Constant">Show</span>,<span class="Constant">Eq</span>) +<span class="Keyword">instance</span> <span class="Constant">Num</span> <span class="Constant">C</span> <span class="Keyword">where...</span></pre></div></div>
tag:yannesposito.com,2011-05-18:/Scratch/fr/blog/Password-Management/ diff --git a/output/Scratch/fr/blog/index.html b/output/Scratch/fr/blog/index.html index f71190ade..7686a3c4e 100644 --- a/output/Scratch/fr/blog/index.html +++ b/output/Scratch/fr/blog/index.html @@ -88,11 +88,9 @@ Les 5 derniers articles
-a=27;b=79;c=C(-2.0,-1.0);d=C(1.0,1.0);e=C(-2.501,-1.003)
-newtype C = C (Double,Double) deriving (Show,Eq)
-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);abs(C(x,y))=C(sqrt(x*x+y*y),0.0)
-r(C(x,y))=x;i(C(x,y))=y
-f c z 0=0;f c z n=if(r(abs(z))>
+a=27;b=79;c=C(-2.0,-1.0);d=C(1.0,1.0);e=C(-2.501,-1.003) +newtype C = C (Double,Double) deriving (Show,Eq) +instance Num C where...
diff --git a/output/Scratch/sitemap.xml b/output/Scratch/sitemap.xml index 00708fc37..74dedd508 100644 --- a/output/Scratch/sitemap.xml +++ b/output/Scratch/sitemap.xml @@ -214,7 +214,7 @@ http://yannesposito.com/Scratch/en/blog/Haskell-Mandelbrot/ - 2011-07-12 + 2011-07-31 http://yannesposito.com/Scratch/fr/about/technical_details/ @@ -486,7 +486,7 @@ http://yannesposito.com/Scratch/fr/blog/Haskell-Mandelbrot/ - 2011-07-12 + 2011-07-31 http://yannesposito.com/Scratch/fr/blog/2010-05-24-Trees--Pragmatism-and-Formalism/