Memoization in Erlang?
Ulf Wiger (AL/EAB)
Fri Feb 3 11:17:40 CET 2006
Why? The comparison returns true if:
- it's the *same code*
- All bindings in the two functions are equal
- Otherwise, the functions might still be observably equal,
but that is, as you say, undecidable.
I'd settle for the implemented version of function equality,
especially since the alternative would be, as you say,
a runtime error.
But of course, I'm not an academic.
From: Thomas Johnsson [mailto:thomas@REDACTED]
Sent: den 3 februari 2006 10:37
To: Ulf Wiger (AL/EAB)
Subject: Re: Memoization in Erlang?
Ulf Wiger (AL/EAB) wrote:
What, you can do function equality in Erlang??
I hadn't realized....
You mean I actually have to verify my
suggestions before posting them? ;)
I will admit that I just plainly assumed
that it would work. My original suggestion
was to use erlang:fun_info(F) as a key.
That's highly dubious ... When are two function
equal according the the Erlang implementation?
My point was that it *shouldn't* work (:-)
The traditional view is that two function are equal iff for same
arguments they return the same result.
Ie undecidable since the number of possible arguments is
In my opinion, in Erlang an attempt to compare two functions
should cause a run time error.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions