length(arg) |
Returns an integer. arg is the name of a string variable. length(arg) is the length of the string with name arg. arg may also reference to an answer of the user (the answer is allways a string first and may be converted to an other type later on.) |
typical use:
length(ans)=length(myvar) OR length(ans)>3 |
correct(arg) |
Boolean. Returns true if answer is correct. arg revers to an answer. Works on the level of questions or answers. |
correct(ans_1)
example in WebMiau |
count(symbol, arg) |
Returns an integer. Specifies how often the symbol occurs in arg. arg is the name of a string variable. It may refer to an answer. |
count(x,ans) returns # of symbols x in ans.
use case: # opening brackets = # closing brackets
count((,ans) = count(),ans) |
valid(arg) |
Boolean. Checks if the given answer is a valid mathematical expression. arg refers to an answer. |
valid(ans) |
equal(arg1, arg2) |
Boolean. Checks if the two expressions are algebraically identical. If this check is not successful a numerical comparison follows. If both arguments are matrix variables the equality of those matrices is checked algebraically. If not all fields of the matrix are filled it will return false. |
equal(ans_2, myvar) |
equalFormat(arg1, arg2) |
Boolean. Checks if the two matrices have the same format. arg1/arg2 is a matrix variable or refers to a matrix. If some fields of the matrices are not filled, it will return false. |
equalFormat(ans_5, aMatrix) |
equalString(arg1, arg2) |
Boolean. Checks if two strings are identical. arg1/arg2 is a variable, a reference to an answer or a string. |
equalString(Hallo,ans_5) , equalString(ans,myStringVar) |
equalTrimmedString(arg1, arg2) |
Boolean. Same as equalString but all blancs are removed. |
|
equalChoice(arg, choices) |
Boolean, mc-/sc-questions only. Compares an answer with one or several choices.<br/><br/> For mc.unique its the choice number that is selected by the user. For mc.yesno, mc.multiple and mc.matrix it's a string of zeros and ones indicating which choices are selected by the user. E.g. 011 means that the last two choices are selected, but not the first. The wildcard '?' can be used. E.g., 0?1 means, that the third choice is selected, but not the first. The second choice can be anything. This of course only works for answer type mc.yesno, mc.multiple and mc.matrix.
For type mc.matrix the strings of zeros and ones are given row-wise seperated by '\\', e.g. 101\\?01 for a multiple choice matrix with two rows and three columns.
arg is an answer reference.
This also works for types mc.unique, mc.yesno and mc.multiple if a subset of permuted choices is selected. |
mc.unique
equalChoice(ans,4)
mc.multiple/mc.yesno
equalChoice(ans,011001) , equalChoice(ans_2,011?01)
mc.matrix
equalChoice(ans,101\\??1)
example in WebMiau example in WebMiau (with subset of permuted choices) |
equalChoice(choices) |
Boolean. Same as equalChoice(arg, choices , but for questions of type mc.unique, mc.yesno and mc.multiple. No answer is referenced, because there are no answer environments. It can also be used for an explanation within an answer. In that case it is short for equalChoice(ans, <choices>) .
This also works for types mc.unique, mc.yesno and mc.multiple if a subset of permuted choices is selected. |
mc.unique
equalChoice(4)
mc.multiple/mc.yesno
equalChoice(011001) , equalChoice(011?01) |
edited |
Boolean. On answer level: Returns true if the current answer was edited. On question level: Returns true if at least one answer of the current question was edited. |
example in WebMiau |
edited(arg) |
Boolean. Returns true if the referenced answer was edited. arg is a reference to an answer. |
edited(ans) , edited(ans_4)
example in WebMiau |
condition(arg) |
Boolean. arg is a string variable. It's value is a valid expression setting a condition. condition(arg) evaluats the string as an expression. That is helpful if one wants to use the same condition multiple times. |
declared variable: \string{cond1}{count(/,ans)=1 }
reusing it: condition{cond1}
example in WebMiau |
answerEqual(arg) |
Boolean. Presently this works for types input.interval and input.finite-number-set only. It compares the current answer with the given expression arg. The expression may contain variables. Be aware that you have to escape interval brackets. (see examples) |
input.interval examples
NOT [edited] OR answerEqual(\[a;3\]) , answerEqual(\[-infinity;3\],\(4;5\))
input.finite-number-set examples
answerEqual({a,b}) , answerEqual({0,2,4,8}) The curly braces are not mandatory, because there is no second argument for the function: answerEqual(a,b) , answerEqual(0,2,4,8)
example in WebMiau |
answerEqual(arg1, arg2) |
Boolean. Works much the same as answerEqual(arg) . Strings arg1 and arg2 are compared. arg2 is for type input.interval either an interval or a list intervals separated by commas and for type input.finite-number-set a set defined using the following syntax: {1st element, 2nd element, ...}. |
input.interval examples
NOT [edited] OR answerEqual(ans_2,\[a;3\]) , answerEqual(ans_1,\[-infinity;3\],\(4;5\))
input.finite-number-set examples
answerEqual(ans_1,{a,b}) , answerEqual(ans_2,{0,2,4,8}) The curly braces are mandatory.
example in WebMiau |
answerExactMatch(arg) |
Boolean. Analog to answerEqual , but the user answer has to be exactly the same. E.g. (3;3) and (4;4) denote both the empty set, but they are not an exact match. |
input.interval examples
NOT [edited] OR answerExactMatch(\[a;3\]) , answerExactMatch(\[-infinity;3\],\(4;5\))
input.finite-number-set examples
answerExactMatch({a,b}) , answerExactMatch({0,2,4,8}) The curly braces are not mandatory, because there is no second argument for the function: answerExactMatch(a,b) , answerExactMatch(0,2,4,8)
example in WebMiau |
answerExactMatch(arg1, arg2) |
Boolean. Works the same as answerExactMatch(arg) but with the first argument arg1 you give a reference (e.g. ans, ans_1, ...) to an answer. It is compared with the expression arg2. arg2 is for type input.interval either an interval or a list of intervals separated by commas and for type input.finite-number-set a set. |