[Haskell-cafe] Re: FASTER primes

Emil Axelsson emax at chalmers.se
Mon Jan 4 11:41:58 EST 2010


> For me, a real smart compiler is one that would take in e.g. (sum $ take n $ 
> cycle $ [1..m]) and spill out a straight up math formula, inside a few ifs 
> maybe (just an aside). 

(Also an aside, I couldn't resist...)

Then I'm sure you'd say that Feldspar [1] has a smart compiler :)

The above expression written in Feldspar and the resulting C code can be 
found here:

   http://hpaste.org/fastcgi/hpaste.fcgi/view?id=15592#a15593

The C code is somewhat complicated by the fact that Feldspar doesn't 
have infinite vectors.

Feldspar usually works well on small examples like this one, but we're 
very much lacking bigger examples, so I can't advise you to use it for 
prime numbers just yet.

/ Emil


[1] http://feldspar.sourceforge.net/




More information about the Haskell-Cafe mailing list