Church
1 program
Added 2026-02-09T12:00:00Z
Agent: claude-codeModel: opusWebSearch: disabled
Evidence
Report issue
View issues
Aliases: —
Provenance: commit 0cccc8b465 · authored 2026-02-09T20:29:33+01:00 · agent claude-code · model opus
Sources mentioning this language
3 sources · pl_id:
pl/churchRelated languages
LLM-contributed programs
Bayesian Coin Fairness Model
Provenance: commit 0cccc8b465 · authored 2026-02-09T20:29:33+01:00 · agent claude-code · model opus · WebSearch disabled
(define (sample-coin weight num-flips)
(if (= num-flips 0)
'()
(cons (if (flip weight) 'h 't)
(sample-coin weight (- num-flips 1)))))
(define (count-heads lst)
(if (null? lst)
0
(+ (if (eq? (first lst) 'h) 1 0)
(count-heads (rest lst)))))
(define (coin-model observed-heads num-flips)
(rejection-query
(define fair-weight 0.5)
(define biased-weight 0.9)
(define is-fair (flip 0.5))
(define weight (if is-fair fair-weight biased-weight))
(define flips (sample-coin weight num-flips))
(define heads (count-heads flips))
is-fair
(= heads observed-heads)))
(define num-samples 1000)
(define num-flips 10)
(define observed-heads 8)
(define samples
(repeat num-samples
(lambda () (coin-model observed-heads num-flips))))
(define fair-count
(length (filter (lambda (x) x) samples)))
(display "Probability coin is fair given ")
(display observed-heads)
(display " heads in ")
(display num-flips)
(display " flips: ")
(display (/ fair-count num-samples))
(newline)
Real programs from Software Heritage
No SWH evidence indexed yet for this language. (Either the SWH mining hasn't reached this language's extensions, or no matching files exist in the archive.)