On 12/09/2015 07:41 AM, Sebastian Hanowski wrote:
> Then would this definition would be a little more acceptable?
>
> fibgen fib | head fib =:<= 1
> & head (tail fib) =:<= 1
> & tail (tail fib) =:<= zipWith (+) fib (tail fib) = fib
>
> fib = fibgen unknown
>
> It just like it how this line
>
> ...
> & tail (tail fib) =:<= zipWith (+) fib (tail fib) = fib
>
> makes so clear that to compute later parts it uses only earlier parts.
>
> And the expression right hand side features only proper sub-parts of the
> one on the left.
> Looks pretty safe like being "structurally recursive" somehow ;)
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).
Best regards,
Michael
_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Do Dez 10 2015 - 22:54:41 CET