Skip to content

Instantly share code, notes, and snippets.

@suhailshergill
Created January 13, 2016 21:26
Show Gist options
  • Save suhailshergill/e1706e8b94185b19498e to your computer and use it in GitHub Desktop.
Save suhailshergill/e1706e8b94185b19498e to your computer and use it in GitHub Desktop.
church-rejection-query
(define (take-sample)
(rejection-query
(define A (if (flip) 1 0))
(define B (if (flip) 1 0))
(define C (if (flip) 1 0))
(define D (+ A B C))
A
(condition (equal? D 3))))
(hist (repeat 100 take-sample) "Value of A, given that D is 3")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment