Yes I understand, I didn't explain clearly what I wanted to achieve with x.
It now works with the modified structure below. I create an additional 
variable which I set to be x within the loop.
Hence it becomes global and can now be called outside the loop without 
using a procedure taking an argument (calling x directly outside the 
loop produces an "undefined" error). So the name itself of the function 
can be called with run-until.

Please let me know if there is a better way of doing that.

(define xtest 0)
(define (print-all) (print "x=" "," xtest "\n"))
(do ((x xstart (+ x xstep))) ((> x xstop))
; setting the structure, source etc
    (set! xtest x)
    (run-until 1 (at-end print-all))
    (reset meep)
)

I hope this can be of help.

Regards,

Fred



Steven G. Johnson wrote:
> On Sep 23, 2008, at 7:22 PM, Frederic Brossard wrote:
>   
>> (define (print-all x)  (print  "x="  ","  x  "\n"))
>> (do ((x xstart (+ x xstep))) ((> x xstop))
>>    ; setting the structure, source etc
>>    (run-until 1) (at-end (print-all x))
>>    (reset-meep)
>> )
>> generates an error. No error if (print-all x) is called within the  
>> loop
>> but outside run-until or if run-until is not a function of the  
>> variable
>>     
>
> I'm guessing that you mistyped it in your email, and your code looks  
> like:
>
>       (run-until 1 (at-end (print-all x)))
>
> This won't work because (print-all x) is not a function, it is the  
> result of calling a function.
>
> See:
>
> http://ab-initio.mit.edu/wiki/index.php/The_run_function_is_not_a_loop
>
> Steven
>
> _______________________________________________
> meep-discuss mailing list
> [email protected]
> http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss
>   

_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to