I just realized that I could have spared (you) (all) my fussing about lazy
equality constraints and projections in function patterns let alone complete
detours while attempting to give negative definitions of infinite data
structures.
I have no clue why it took so long until I found out that Curry let's me write
(^) f = g where g (f x) = x
infixr 0 &=
xs &= ys | head xs =:= head ys
& head ys =:= head zs = zs
where
zs = tail^ (tail xs &= tail ys)
fib = head^ 1
&= (head . tail)^ 1
&= (tail . tail)^ (zipWith (+) fib (tail fib))
Please notice how declarative this is. Ordering of sub-expressions is insignificant
fib = (tail . tail)^ (zipWith (+) fib (tail fib))
&= (head . tail)^ 1
&= head^ 1
for example would do as well.
Cheers,
Sebastian
_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Fr Aug 19 2016 - 16:56:22 CEST