Compiler-level parallelization and languages

Some days ago, Intel announced a new version of their C++ and Fortran compilers. According to their announcement: Application performance is also accelerated by multi-core processors through the use of multiple threads.So... as far as I understand, and as some other news sites mention, this means that the compiler tries to automatically parallelize a program by creating multiple threads; the code executed on each thread is decided at build time through some algorithm that deduces which blocks of code can be executed at the same time.

June 9, 2007 · Tags: compiler, haskell, multicore, optimization, parallelism
Continue reading (about 3 minutes)

Flattening an array of arrays

This evening a friend asked me if I knew how to easily flatten an array of arrays (AoA from now on) in Perl 5. What that means is, basically, to construct a single array that contains the concatenation of all the arrays inside the AoA. My first answer was: "foldr", but I knew beforehand that he wouldn't like it because... this is Haskell. After some time we got to the conclusion that there is no trivial way to flatten an AoA in Perl 5, even though Perl 6 includes a built-in function to do so.

June 7, 2007 · Tags: array, haskell, perl
Continue reading (about 2 minutes)

A split function in Haskell

Splitting a string into parts based on a token delimiter is a very common operation in some problem domains. Languages such as Perl or Java provide a split function in their standard library to execute this algorithm, yet I’m often surprised to see how many languages do not have one. As far as I can tell neither C++ nor Haskell have it so I have coded such a function in the past multiple times in both languages.

August 24, 2006 · Tags: haskell
Continue reading (about 3 minutes)