curried fun (was: Re: putting laziness back on the parallelized map)

From: Sebastian Hanowski <sebastian.hanowski_at_web.de>
Date: Tue, 18 Mar 2008 16:37:05 +0100

* Am 13.03.08 schrieb Sergio Antoy:
> Sebastian,
>
> Thanks for the thought-provoking example. Parallelism and
> laziness can be nicely combined. There is an experimental
> implementation of curry (codenamed fx) that does just this.
>
> I am attaching a test that works as one would expect from a
> parallel implementation.

Hi Sergio,

before I finally get put on file, here's some more fun with laziness
and equlity :)

Cheers,
Sebastian


        rfak :: (Int -> Int) -> (Int -> Int)
        rfak = \f n -> if n==0
                          then 1
                          else n * f (n-1)


        fix :: (a -> a) -> a
        fix f | x =:<= f x = x where x free

        -- curriedfun> fix rfak 5
        -- Result: 120 ? ;
        -- No more solutions.

Works as expected.



        fix':: ((a -> b) -> (a -> b)) -> (a -> b)
        fix' f a = foldr1 (?) [k a | k <- iterate f failed]

        -- curriedfun> fix' rfak 5
        -- Result: 120 ? ;
        -- Result: 120 ? ;
        -- .
        -- .
        -- .

Is there a way to stop this?
_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Di Mär 18 2008 - 17:58:12 CET

This archive was generated by hypermail 2.3.0 : Do Feb 01 2024 - 07:15:08 CET