(define n 2) ; How many options? (let ((m (make-vector n 1)) (tot n) (bc ((fileVal "bCoin") "wntti")) (DoL ((fileVal "Do") 'DoL))) (cons (lambda (P) (let x ((k n)(s tot)) (let* ((n (- n 1)) (g (vector-ref m n)) (c (bc (/ g s)))) (if c (let ((a (P n))) (vector-set! m n (+ g a)) (set! tot (+ tot a))) (x n (- s g)))))) (lambda () (DoL n (lambda (n) (/ (vector-ref m n) tot)))))) ; test ((car q) (lambda (q) (write (list 'chose q)) (newline) 4))