;;; Procedure: ;;; weights ;;; Parameters: ;;; steps, a positive integer ;;; Purpose: ;;; Generate a list of weights between ;;; 0 and 1 ;;; Produces: ;;; waits, a list of real numbers ;;; Preconditions: ;;; [No additional] ;;; Postconditions: ;;; The values in waits are "evenly spaced". ;;; For all reasonable i, element i of waits ;;; is 1/steps greater than element i-1 of waits. ;;; waits has (steps+1) elements. ;;; waits only has values between 0 and 1. (define weights (lambda (steps) (map (lambda (n) (/ n steps)) ; "a function that, given n, divide n by steppes" (iota (+ steps 1))))) ; Testing: Does the name we use matter? (define weights1 (lambda (stupendous) (map (lambda (squigglemajig) (/ squigglemajig stupendous)) ; "a function that, given n, divide n by steppes" (iota (+ stupendous 1))))) (define weights2 (lambda (steps) (map / ; "a function that, given n, divide n by steppes" (iota (+ steps 1)) (make-list (+ steps 1) steps)))) (define weights3 (lambda (steps) (map (r-s / steps) ; "a function that, given n, divide n by steppes" (iota (+ steps 1)))))