Difference between revisions of "Talk:Blow your mind"

From HaskellWiki
Jump to navigation Jump to search
(Mind-blowing considered harmful)
m
Line 24: Line 24:
   
 
Unlike the mind-blowing version, this code works on infinite series as well as polynomials. —[[User:dougm:Doug McIlroy]] 20 December 2006
 
Unlike the mind-blowing version, this code works on infinite series as well as polynomials. —[[User:dougm:Doug McIlroy]] 20 December 2006
  +
  +
As can be easily seen from the history, i didn't add the polynomial code and haven't reviewed it due to its "length". This is a wiki; make any changes you think improve the page. Much of my own stuff needs comments or is generally obscure. I'd love it if someone added/removed/altered a few examples to make this page more "user friendly" --[[User:JohannesAhlmann|Johannes Ahlmann]] 22:44, 20 December 2006 (UTC)

Revision as of 22:44, 20 December 2006

Could these be on their own page?

Hi Johannes - Great stuff on your page. Have you thought about making it an actual page in the WIKI? You could then add

[[Category:Idioms]]

and more people would find it. BrettGiles 16:19, 1 March 2006 (UTC)

Name?

Is there a better name for this page? —Ashley Y 00:55, 2 March 2006 (UTC)

i completely agree, the name pretty much sucks. but what i really wanted, was to compile a collection of "idioms" that would enlarge the readers perception of what is possible in Haskell and how to go about it. so, i'll have to find a name that reflects this plan. —--Johannes Ahlmann 14:13, 2 March 2006 (UTC)

Elegance before pyrotechnics

The polynomial algorithms are indeed mind-blowing, like the excess of Mardi Gras. They smuggle in subscripts, which (blessedly) Haskell usually banishes, disguised in a pyrotechnic display of abstraction, replication, concatenation, composition and enumeration.

Gilles Kahn invented a much more docile and beautiful way to do these things with true Haskell elegance long before Haskell:

 instance Num a => [a] where
   fs + [] = fs
   [] + gs = gs
   (f:fs) + (g:gs) = f+g : fs+gs
   (f:fs) * (g:gs) = f*g : [f]*gs + fs*(g:gs)
   _ * _ = []

Unlike the mind-blowing version, this code works on infinite series as well as polynomials. —User:dougm:Doug McIlroy 20 December 2006

As can be easily seen from the history, i didn't add the polynomial code and haven't reviewed it due to its "length". This is a wiki; make any changes you think improve the page. Much of my own stuff needs comments or is generally obscure. I'd love it if someone added/removed/altered a few examples to make this page more "user friendly" --Johannes Ahlmann 22:44, 20 December 2006 (UTC)