[email protected]
[Top] [All Lists]

Re: [Haskell-cafe] Re: FASTER primes

Subject: Re: [Haskell-cafe] Re: FASTER primes
From: Emil Axelsson
Date: Tue, 5 Jan 2010 11:00:27 +0100
Will Ness skrev:
Emil Axelsson <emax <at> chalmers.se> writes:

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 :)

but it didn't produce

f n m = if n < m then n*(n+1)/2 else
        let (q,r)=quotRem n m
        in q*(m*(m+1)/2) + r*(r+1)/2

Ah, I see... Yes, that would be a very smart compiler :)

/ Emil

Haskell-Cafe mailing list
[email protected]

<Prev in Thread] Current Thread [Next in Thread>