> In the process of toying with streams & memoization (more below), I've 
> tripped over the question: when does Racket consider two lambdas to be 
> identical?

I came across the same question when working with my constructive reals 
package.  (A constructive real number is basically a function that returns a 
stream of integers of various kinds, depending on the representation.)

For example, could I tell that "one" "plus" "one" equals (returns the same 
stream of integers) "two" "times" "one" (where all the quoted terms are in the 
constructive reals).

Using Gambit, I couldn't figure out how.

But there was a way to see that "one" "plus" "one" equals (another instance of) 
"one" "plus" "one", and that was to serialize both lambdas computing the two 
constructive reals and then to compare the serialized values.  The serialized 
lambdas "remembered" how they were composed from simpler lambdas, so if two of 
them were constructed using the same sequence of operations, then the 
serialized representations could tell that they were the same, while they were 
stored as two different closures in memory.  I still couldn't tell that "one" 
"plus" "two" equals "two" "plus" "one".

I didn't go much further with the question of how different representations of 
lambdas might facilitate checking "equality" of more general terms.

Brad

____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to