Hello All!
Addison-Wesley book and in Clean 2.1 Specification state that selector
patterns are translated to projection functions. But (without strictness
analysis and using small heap) test1 terminates ok but test2 fails with out
of heap error. How it must be explained in semantics?
Start = test4 [0..100*1000*1000]
test1 xs = case ab of (_,_) -> n
where
ab = decouple1 xs
(a,b) = ab
n = xsum 0 a xs
test2 xs = case ab of (_,_) -> n
where
ab = decouple1 xs
a = first ab
n = xsum 0 a xs
decouple1 [x:xs] = (x,xs)
first (a,b) = a
xsum 0 a xs = xsum 1 a xs
xsum n a [x:xs] = xsum (n+1) a xs
xsum n a [] = a + n
_______________________________________________
clean-list mailing list
[email protected]
http://mailman.science.ru.nl/mailman/listinfo/clean-list