[racket] Check for #<undefined>

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Tue May 31 18:35:34 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?

#lang racket

(define (undefined? v) (eq? (letrec ([x x]) x) v))

(undefined? (letrec ([y y]) y))
-- 
sam th
samth at ccs.neu.edu


Posted on the users mailing list.