[plt-scheme] match single symbol

From: Jon Rafkind (rafkind at cs.utah.edu)
Date: Wed Sep 2 20:44:09 EDT 2009

I was trying to match a single symbol but I didn't see a match pattern 
for it. This code seems to do what I want

(define (match-symbol sym)
  (match sym
    [x (=> f) (if (not (symbol? x)) (f) 'ok)]
    [else 'bad]))

(match-symbol 'a)
(match-symbol 23)
(match-symbol '(1 2 3))


Can something like this be added to scheme/match or is there an 
existing/simpler way to do it?

Posted on the users mailing list.