> On Sep 16, 2018, at 10:07 PM, Matthew Butterick <m...@mbtype.com> wrote:
> 
> 
>> On Sep 16, 2018, at 2:13 PM, Kevin Forchione <lyss...@gmail.com 
>> <mailto:lyss...@gmail.com>> wrote:
>> 
>> Thanks! That’s just what I wanted. Is there a way in Racket to determine if 
>> a quoted symbol has an associated procedure? 
> 
> 
> 
> #lang racket
> (require rackunit)
> 
> (define-syntax (bound-to-proc? stx)
>   (syntax-case stx ()
>     [(_ 'x)
>      (and (identifier? #'x) (identifier-binding #'x))
>      #'(procedure? x)]
>     [_ #'#f]))
> 
> (define bound-to-proc +)
> (define not-bound-to-proc 42)
> 
> (check-true (bound-to-proc? 'bound-to-proc))
> (check-false (bound-to-proc? 'not-bound-to-proc))

Sorry for the typo and thanks for the further explanation. Your original 
response to my query was more in line with what I’m trying to accomplish, while 
my second question was more in the realm of  curiosity. In a nutshell I’m 
working with some hash tables whose keys are symbol and whose values may be 
other keys or values such as identifiers, and I got a bit tired of quoting all 
my symbols for functions and decided to use some macros when working with the 
tables. Probably more than curiosity as I can foresee a need to retrieve a 
value from a table and either apply it, which means somehow getting at the 
binding. 

Kevin

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to