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  has a smart compiler :)
The above expression written in Feldspar and the resulting C code can be
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.
Haskell-Cafe mailing list