[plt-scheme] Check for function equality?

From: John Clements (clements at brinckerhoff.org)
Date: Thu Feb 19 18:53:22 EST 2009

On Feb 19, 2009, at 3:34 PM, Robby Findler wrote:

> One can explain this without resort to Turing machines or other  
> automata!
>
> Here's how you might do it.
>
> Imagine you had a function called "halts":
>
>  ;; halts? : program input -> boolean
>  ;; returns true when the program halts on the given input
>  ;; returns false when the program would fail to halt on the given  
> input
>  ;; always returns something.
>
> Now consider this function:
>
>  (define (als-program x)
>    (cond
>      [(halts? x x) (als-program x)]
>      [else 3]))

... looks to me like this is just a teensy more complex than it needs  
to be.  How about:

(define (als-program x)
   (cond
     [(halts? x x) (loop-forever)]
     [else 3]))

(define (loop-forever) (loop-forever))

?

> and ask what is
>
>  (als-program als-program).

John

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2484 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20090219/8ed8ab16/attachment.p7s>

Posted on the users mailing list.