
11 Nov
2010
11 Nov
'10
5:28 p.m.
On Thursday 11 November 2010 12:34:21 pm John Lato wrote:
I think the only way this would work would be if you consider functions to be equal only to themselves, i.e. "x+x" and "2*x" are not equal. That's not a trade-off I would be willing to make.
In general, it doesn't even have to be based on a mathematical identity. As has been stated, this would in general simply break referential transparency. Are these two functions equal: f x = k (h x) (h x) g x = let y = h x in k y y Presumably, no, if serialize exists (and they may have different performance characteristics). You cannot factor out or inline subexpressions or without the difference being observable (presumably) by serialize. -- Dan