> On Sep 16, 2018, at 10:07 PM, Matthew Butterick <m...@mbtype.com> wrote: > > #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))
Thanks, Matthew. This approach works as long as the macro is being used outside of a definition, but I suspect to build any sort of logic around it they’d have to be macros as well. For instance, this fails because the macro captures symptoms and not the value passed to the function: [define [foo symbols) (bound-to-proc? sum)) That seems to be the nature of macros, and I’m not sure what the solution to that paradox is, apart from perhaps building a symbol/function hash table as part of a define. Presumably Racke does something like that for eva & namespaces, but I’m surprised there isn’t a symbol->procedure function. 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.