## WeBWorK Main Forum

### mixed context lists

by Zak Zarychta -
Number of replies: 1
I would like to have an object that is part string and part number where the number and/or string may be replaced with a relevant variable
For example

$focal = list('focal length', 10); or$curve =list($string,$number);

Furthermore i would like to place these objects in a list to be selected randomly ie
list_random($focal,$curve);

Is there an existing context that i could use or easily modify for these type of mixed lists ?

### Re: mixed context lists

by Alex Jordan -
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.