Posts

Showing posts from December, 2010

The underappreciated banana and its buddy monoid

Note : This is the blog post that goes with the Channel9 lecture "Going Bananas". You find all material (slides, code) linked up on the web site for my Channel9 series ; see the section on "Going Bananas". I will add a link to the C9 website with the video as soon as it gets available. I am really Ok. Well, but I do see bananas (folds) everywhere. This tells me that data processing is quite regular. For instance, MapReduce computations for parallel data processing are essentially folds that extract some intermediate data from the records of a voluminous input---subject to subsequent, possibly distributed and staged reduction. Also, in program transformation and analysis, many data processing steps are compositional, and thereby suggest themselves as being implemented through "large" bananas. Further, in XML processing, many operations are busy with folding over XML trees. There are bananas for everyone ---not just for lists. If we were just acknowledging s

A brutalized Haskell programmer

In working on a special Xmas lecture for my 1st semester course, I was going through Fritz Ruehr's " The Evolution of a Haskell Programmer " only to notice that there is no imperatively faked version that uses references. This omission could be resolved with the following code: module Control.Pascal where import Data.IORef while :: IORef a -> (a -> Bool) -> IO () -> IO () while ref pred body = while' where while' = do v <- readIORef ref if (pred v) then body >> while' else return () {- ******************************* -} import Data.IORef import Control.Pascal factorial n = do r <- newIORef 1 i <- newIORef n while i (>0) ( readIORef i >>= modifyIORef r . (*) >> modifyIORef i ((+) (-1)) ) readIORef r For instance: Prelude> factorial 5 120

Going bananas

This week I will be visiting Klaus Ostermann and his team. I am going to be a guest lecturer in Klaus' programming languages lecture. I am going to misuse this opportunity for a rehearsal of my upcoming Channel9 lecture on bananas. I eat 2 bananas over the last 42 hours in order to get into the right mood. The talk announcement follows. Speaker : Ralf Lämmel , Software Languages Team, Universität Koblenz-Landau Title : Going bananas Slides: [ .pdf ] Abstract : Banana is functional programming slang for "fold", say an application of the catamorphic recursion scheme---most widely known in higher-order list processing in the tradition of the Bird-Meertens Formalism and the Squiggol community. In this talk, I will present various kinds of folds, and thereby show the omnipresence, versatility, and expressive power of folds in different areas of programming. This presentation will integrate work by others and my own in a balanced manner, while aiming at broad coverage of banan