>
> The recent plot library introduces a new function, `point-pict` which is 
> not yet available as part of a Racket distribution, and the plot package 
> has to be installed separately from GitHub for this function.
>
> In my code I would like to be able to check if this function is available 
> before calling it, so my code compiles correctly even if the function is 
> not available.
>

In addition to the `dynamic-require` solution, you can do this statically 
with macros and `identifier-binding`:

(define-simple-macro (begin-when-bound id:id body ...+)
  #:with (body* ...) (if (identifier-binding #'id) #'(body ...) #'())
  (begin body* ...))

Warning: I have only written the above code, not run it. See also the 
version-case <https://pkgs.racket-lang.org/package/version-case> package 
for a similar, more fleshed out concept.

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