
27 Mar
2008
27 Mar
'08
3:12 p.m.
On 27 Mar 2008, at 15:58, Miguel Mitrofanov wrote:
Hmmm, seems like your (-+) is not lazy enough. ... You can fix it by defining (-+) as
x -+ ~(List y) = ...
Yes, this has been pointed out...
Since pattern matching is strict by default, you have
anything -+ (_|_) = (_|_)
Therefore, the function, which is constantly (_|_), is a fixed point for the equation defining h. In other words, if you define
h' x = undefined
then you have
h' x = (-+) anything (h anything)
in particular,
h' x = (-+) (first x) (h (rest x))
But additional explanation is helpful. Thank you. Hans Aberg