[Cs254f11] lets that depend on other things that have been let in the same context
Wm. Josiah Erikson
wjerikson at hampshire.edu
Fri Dec 2 11:35:20 EST 2011
I find it annoying, just for readability of my program and not having to
do things over and over again, that I can't do this:
(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)))
It tells me that it can't resolve the symbol reference-error in this
context. I assume that this is because it defines those out of order or
something. But why didn't it complain about not knowing what best-fit
was first?
Am I doing this wrong, or can you just not do this?
--
Wm. Josiah Erikson
Network Engineer
Hampshire College
Amherst, MA 01002
(413) 559-6091
More information about the Cs254f11
mailing list