Don Stewart wrote:
default(Int)
divisors i = filter (\j -> i `rem`j == 0) (enumFromTo 1 (i-1))
main = print $ filter (\i -> i == sum (divisors i)) (enumFromTo 1 1)
...
So almost identical types to the C program (bar for the return [Int]).
Finally, we can manually
dons:
> stefanor:
> > On Sun, Oct 28, 2007 at 01:25:19PM -0700, Don Stewart wrote:
> > > Finally, we can manually translate the C code into a confusing set of
> > > nested
> > > loops with interleaved IO,
> > >
> > > main = loop 1
> > > where
> > > loop !i | i > 1 = return
On 10/28/07, Stefan O'Rear <[EMAIL PROTECTED]> wrote:
> On Sun, Oct 28, 2007 at 01:43:07PM -0700, Don Stewart wrote:
> > stefanor:
> > > IO blocks unboxing in GHC. How fast is your mock-C code refactored to
> > > do IO outside of the loops only?
> >
> > It doesn't! The above code yields:
> >
> >
On Sun, Oct 28, 2007 at 01:43:07PM -0700, Don Stewart wrote:
> stefanor:
> > IO blocks unboxing in GHC. How fast is your mock-C code refactored to
> > do IO outside of the loops only?
>
> It doesn't! The above code yields:
>
> Main.$wloop :: GHC.Prim.Int#
>-> GHC.Prim.Sta
stefanor:
> On Sun, Oct 28, 2007 at 01:25:19PM -0700, Don Stewart wrote:
> > Finally, we can manually translate the C code into a confusing set of nested
> > loops with interleaved IO,
> >
> > main = loop 1
> > where
> > loop !i | i > 1 = return ()
> > | othe
On Sun, Oct 28, 2007 at 01:25:19PM -0700, Don Stewart wrote:
> Finally, we can manually translate the C code into a confusing set of nested
> loops with interleaved IO,
>
> main = loop 1
> where
> loop !i | i > 1 = return ()
> | otherwise = if i == go i 0 1 t
rendel:
> Prabhakar Ragde wrote:
> >divisors i = [j | j<-[1..i-1], i `mod` j == 0]
> >main = print [i | i<-[1..1], i == sum (divisors i)]
>
> Jerzy Karczmarczuk wrote:
> >My point didn't concern that point. Haskell compiler cannot change an
> >algorithm using lists into something which deals w