Talk:Blow your mind

From HaskellWiki
Revision as of 14:37, 20 December 2006 by Dougm (talk | contribs) (Mind-blowing considered harmful)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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