[Cs254f11] lets that depend on other things that have been let in the same context

Thomas Helmuth thGST at hampshire.edu
Fri Dec 2 12:16:48 EST 2011


You're "doing this wrong" - your syntax for let is incorrect. You need
to put all of your let definitions within one vector instead of many
vectors. Change your code to

> (defn prediction-test
>  [psize gens]
>  (let [best-fit (evolve_best_fit psize gens)
>    reference-error (error best-fit)
>    test-error (test_error best-fit)
>    error-difference (Math/abs (- reference-error test-error))]
>    (println "The shortest best fit individual over" gens "generations with a
> population size of" psize)
>    (println "was" best-fit)
>    (println "It had an error of" reference-error "against the reference
> songs, and an error of")
>    (println test-error "against the test songs, giving a difference of"
> error-difference)))

and you should be very happy, as long as the rest of it is correct.

-Tom


More information about the Cs254f11 mailing list