Dear list,

Another -probably simple- Scheme question. Suppose we wanted to execute one
(and only one) of a few functions, pick this one randomly and assign weights
to them. For example we might like to populate a world with mostly cubes,
some spheres and just a few cylinders. How would we go about this cleanly? I
could nest a train of "if" statements that would compare a (rndf) to a
constant but that's hardly convenient and leads to ugly code. I could also
set up a few (cond) statements to use with a single random number but since
we are basically dealing with picking from a list I could imagine Scheme,
which is specialised in lists, would have some specialised trick up it's
sleeve that might serve?

Yours,
Kas.

Reply via email to