Bill Allombert on Tue, 03 Jan 2023 12:12:37 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Question on using eval...


On Tue, Jan 03, 2023 at 10:43:48AM +0100, Ruud H.G. van Tol wrote:
> The "symbolic equality" also needs to be defined first.
> 
> ? f(a,b,c) = (a / b) + c;
> ? g(a,b,c) = a / b + c;
> ? h(a,b,c) = c + a / b;
> ? print([f == g, f == h, g == h, g == f, f === g]);
> [1, 0, 0, 1, 1]

Indeed, comparing closures means comparing the bytecode generated by the internal compiler.
The parser ignores useless parentheses so f and g are identical.

Cheers,
Bill