A small doubt
Saswat Anand
saswatan@comp.nus.edu.sg
Sun, 21 Oct 2001 13:17:05 +0800 (GMT-8)
Hi,
I think a lazy pattern is "really lazy" if reference to a part of the
pattern does not
cause matching of rest of the pattern.
For example,
\ ~((:) a ((:) b [])) -> [a]
should not try to match ((:) b[]) part of the pattern, since 'a' is only
referenced.
It seems the above pattern should be interpreted as the following patern:
\ ~((:) ~a ~((:) ~b ~[])) -> [a]
Prelude> (\ ~((:) a ((:) b [])) -> [a]) [2]
[
Program error: {v1282 [Num_fromInt instNum_v35 2]}
Prelude> (\ ~((:) ~a ~((:) ~b ~[])) -> [a]) [2]
[2]
What are the cons in this interpretation?
Cheers,
Saswat