On Sat, Jul 16, 2016 at 02:16:20PM -0400, David Storrs wrote:
> I saw the #:when keyword for patterns and thought that would do what I
> needed.  The following code seems like it should work, but it doesn't.
> What am I missing?
> 
> 
> (define-syntax (throws stx)
>   (syntax-parse stx
>                 [(_ boom pred msg)
>                  #:when (lambda () (procedure? #'pred))
To address the immediate problem, this `procedure?` test will always return 
`#f`, since `#'pred` is a
syntax object and not a procedure. You need to do `(procedure? (syntax->datum 
#'pred))`. Similarly
reasoning applies to the `string?` test.

I'm not sure your approach is ideal, but I'll let someone else comment.

--
William J. Bowman

-- 
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.

Attachment: signature.asc
Description: PGP signature

Reply via email to