Jump to: Site Navigation

answerVariableList.pl - Creates answer checkers that compare the student's answer to a list of variable names.

` ANS(variable_cmp($var_string, %options))`

This answer checker compares the student answer to a list of variable names (so, for example, you can ask for what values a given function depends on).

Use addVariables() to create the list of variables that from which the student can choose, and then use variable_cmp() to generate the answer checker. If the formula passed to variable_cmp contains parentheses around the list, then the student's answer must as well.

You can also include additional parameters to variable_cmp. These can be any of the flags appropriate for List() answer checker.

Usage examples:

```
addVariables('x','y','z');
ANS(variable_cmp("(x,y)"));
addVariables('x','y','z','s','t,);
ANS(variable_cmp("s,t"));
addVariables('x','y','z');
ANS(variable_cmp("(x)",showHints=>0,showLengthHints=>0));
```

` addVariables(@vars)`

Adds each string in @vars as a varible to the current context.