Re: Curry-on to infinity

From: <h7sa_at_pdx.edu>
Date: Mon, 21 Dec 2015 09:36:01 -0800

The constructors are hidden by tail and head.
Let me introduce a new function, cons, which also hides the constructors.
These functions are related by

    head (cons x xs) = x
    tail (cons x xs) = xs

Now I recode fibmatch as

    fibmatch xs = cons _ (cons _ xs)

which gives

    fib | head xs =:= 1
          & head (tail xs) =:= 1 = xs
            where
            xs = cons _ (cons _ (zipWith (+) xs (tail xs)))

now satisfy the conditions on xs

    fib = xs
            where
            xs = cons 1 (cons 1 (zipWith (+) xs (tail xs)))

now eliminate the renaming

    fib = cons 1 (cons 1 (zipWith (+) fib (tail fib)))

On Mon, 21 Dec 2015, at 09:15, Sebastian Hanowski <sebastian_hanowski_at_gmx.de> wrote:

> On Tue, Dec 15, 2015 at 03:44:34PM +0100, Michael Hanus wrote:
> [...]
> > Hence, the challenge is open...
>
> This is my last resort:
>
> fibmatch (tail (tail xs)) = xs
>
> fib | head xs =:= 1
> & head (tail xs) =:= 1 = xs
> where
> xs = fibmatch (zipWith (+) xs (tail xs))
>
> No non-linear patterns. No (=:<=). And no constructors.
>
> But unfortunately it features too much cyclicity which I had liked to avoid.
>
> Think it's time now for a principled retreat.
>
>
> Best regards
>
> Sebastian
> _______________________________________________
> curry mailing list
> curry_at_lists.RWTH-Aachen.DE
> http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry

Received on Mo Dez 21 2015 - 23:30:44 CET

This archive was generated by hypermail 2.3.0 : Do Jun 20 2024 - 07:15:13 CEST