[racket] Check for #<undefined>

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Tue May 31 18:35:31 EDT 2011

On Tue, May 31, 2011 at 6:29 PM, Todd O'Bryan <toddobryan at gmail.com> wrote:
> I have a structure with a guard function. It works well.
> However, I want to use it in a (shared ...) construct, and when the
> guard runs, a value is #<undefined>. I'm fine with letting the guard
> accept #<undefined> as a legal value, but I can't figure out any way
> to test for it.
> Is there such a beast, or is #<undefined> untouchable?
> Todd

I believe the "undefined" value is eq? to itself, so you should be
able to use the following:

(define undefined
  (letrec ([x x]) x))

(define (undefined? x)
  (eq? x undefined))


Posted on the users mailing list.