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

**Guy Albertelli II
**
lon-capa-dev@mail.lon-capa.org

*Tue, 22 May 2007 14:57:58 -0400 (EDT)*

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 :
--
guy@albertelli.com 0-7-0-9-27,137