<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-text-plain" wrap="true" graphical-quote="true"
      style="font-family: -moz-fixed; font-size: 12px;" lang="x-western">
      <blockquote type="cite" style="color: #000000;">
        <pre wrap="">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?
</pre>
      </blockquote>
      <pre wrap="">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
</pre>
    </div>
  </body>
</html>