Re: Curry-on to infinity

From: <h7sa_at_pdx.edu>
Date: Tue, 15 Dec 2015 10:15:09 -0800

Sebastian,

This program is clever, but I like more your original one:

    fib | head x =?= 1
        & head (tail x) =?= 1
        & tail (tail x) =?= zipWith (+) x (tail x) = x where x free

since it more clearly shows the conditions that you impose on the output. I changed the syntax of the equality operator, since I think that you want some kind of equality less strict than the standard one and different from (=:<=) which is intended for a different use.

Laziness desirable. The problem is how much lazy you want to be (or can be) to ensure the conditions. Section 3 of the functional patterns paper shows that this problem is difficult and subtle.

Sergio

On Mon, 14 Dec 2015, at 07:49, Sebastian Hanowski <sebastian_hanowski_at_gmx.de> wrote:

> On Thu, Dec 10, 2015 at 10:53:00PM +0100, Michael Hanus wrote:
> > As I wrote before, the second argument of the non-strict unification
> > operator (=:<=) must be a pattern variable in order to stay in the
> > well-understood framework of functional patterns. Since this is not the
> > case in your definition, it might compute something as intended,
> > but the general declarative semantics is not clear (to me).
>
> Challenge accepted ;)
>
> fibaux fib xs | (1, (1, tail (tail fib))) =:<= xs = fib
>
> fibs = fibaux xs (head xs, (head (tail xs), zipWith (+) xs (tail xs)))
> where xs free
>
>
> And if non-linearity of patterns isn't an issue...
>
> fibaux fib (1, (1, tail (tail fib))) = fib
> _______________________________________________
> 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 Di Dez 15 2015 - 22:26:48 CET

This archive was generated by hypermail 2.3.0 : Fr Mär 29 2024 - 07:15:13 CET