WeBWorK Main Forum

mixed context lists

Re: mixed context lists

by Alex Jordan -
Number of replies: 0
I haven't figured out how to do this with a Math Object List, but you can make a perl array containing different Math Objects:

@focal = (Compute("focal length"), Compute("10"));
@curve =($string, $number);

Given your final objective though, you might want to make a "nested array"

$array[0][0] = Compute("focal length");
$array[0][1] = Compute("10");
$array[1][0] = $string;
$array[1][1] = $number;

Then you could randomize the first entry:
$i = random(0,1,1)

And program your problem referring to $array[$i][0] and $array[$i][1].

That is, if I understand correctly what you are trying to do.