After some poking around, here is what I can offer:
#lang racket
(module predicates racket
(provide discrete-dist-thing?)
;; ---------------------------------
;; dependencies
(require math/distributions)
;; ---------------------------------
;; implementation
(define (discrete-dist-thing? x)
(define is-it-discrete-dist-values
(with-handlers ([exn:fail? (lambda (xn)
(define msg (exn-message xn))
(if (regexp-match? #rx"expected: discrete-dist-struct" msg)
#false
(raise xn)))])
(discrete-dist-values x)))
(and is-it-discrete-dist-values
(andmap symbol? is-it-discrete-dist-values)
(let ([probs (discrete-dist-probs x)])
(and (andmap flonum? probs) (andmap positive? probs))))))
(module server racket
(require (submod ".." predicates))
(provide
(contract-out
[d discrete-dist-thing?]))
;; ---------------------------------
;; dependencies
(require math/distributions)
;; ---------------------------------
;; implementation
(define d (discrete-dist '(one two))))
(require 'server)
d
Watch for symbol?. You want to abstract over that.
> --
> 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...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.