# [LON-CAPA-dev] How does formularesponse work

**Peter Riegler
**
lon-capa-dev@mail.lon-capa.org

*Wed, 23 May 2007 10:32:18 +0200*

Hi Guy,
argh, shame on me!
Thanks!
Peter
PS: Funny though that wrong responses are graded as correctly ...
Guy Albertelli II wrote:
>* Hi Peter,
*>*
*>* Looks like a typo.
*>*
*>*
*>>*we have a problem using formula response here, which brings up the
*>>*question how it works internally. Unfortunately, I am not really capable
*>>*of understanding what is going on in caparesponse.pm.
*>>*
*>>*So far, my idea of formularesponse has been that it runs nested
*>>*for-loops w.r.t. the sampling variables. For instance,
*>>*
*>>*<formularesponse samples="x,y@-3,-3,;2,2#4" answer="$answer" id="11">
*>>*
*>>*should result in something like
*>>*
*>>*for each x value
*>>* for each y value
*>>* check whether $answer evaluated at x and y equals
*>>* response evaluated at x an y
*>>* if not break out of the for loops and return false
*>>* end
*>>*end
*>*
*>*
*>* Yes, it should, however you have a ; where you want a :
*>*
*>* x,y@-3,-3,;2,2#4
*>*
*>* Will sample at x=-3,y=-3, and x=2,y=2
*>*
*>* x,y@-3,-3:2,2#4
*>*
*>* Will sample at 4 random points in the box defined by -3 <= x <= 2, and
*>* -3 <= y <= 2
*>*
*>*
*>>*<formularesponse samples="x,z,t,C@-3,-3,-3,-3;2,2,2,2#4"
*>>*answer="$integral" id="11">
*>*
*>*
*>* and similarly here there is a ; where you likely want a :
*
--
Peter Riegler
Fachhochschule Braunschweig/Wolfenbüttel
Salzdahlumer Str. 46/48, 38302 Wolfenbüttel
Tel. +49 5331 939 6314, Fax. +49 5331 939 6002
email: p.riegler@fh-wolfenbuettel.de
http://public.rz.fh-wolfenbuettel.de/~riegler