Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: b36fe569ca
Fetching contributors…

Cannot retrieve contributors at this time

37 lines (31 sloc) 1.06 kB
#! /usr/bin/env racket
#lang racket/base
(require "question-answer.rkt" racket/function)
(define (normalize . numbers)
(define sum (apply + numbers))
(map (curryr / sum) numbers))
(define (2-measurement-question)
(define probability-bright-given-lane 8/10)
(define probability-dark-given-offroad 9/10)
(print-question
'("2 measurement question"
"probability of bright given on lane marker is ~v"
"probability of dark given off lane marker is ~v"
"x1 is on a lane marker"
"x2 is off lane marker"
"measure bright"
"what's the normalized weight of x1 and x2?"
"there are 3 particles on lane, 3 off lane"
"?")
probability-bright-given-lane
probability-dark-given-offroad)
(print-answer
'("weight of x1 = ~v"
"weight of x2 = ~v")
(list-ref (normalize 8/10 1/10 8/10 8/10 1/10 1/10) 0)
(list-ref (normalize 8/10 1/10 8/10 8/10 1/10 1/10) 1)))
(begin
(printf question-separator)
(2-measurement-question) (printf question-separator)
(printf question-separator))
(provide normalize)
Jump to Line
Something went wrong with that request. Please try again.