On Wed, 21 Feb 2007, Huazhong Wang wrote:
Hi, i want to display a message on my screen during run. my code is below:
...
(run-until 500 (at-every 100 (display "fine!")))
...
but program stops at point of time 100. the errors are:
ERROR: In  procedure procedure-property:
ERROR: Wrong type argument in position 1: #<unspecified> who could help me correct this code? thanks,

This is a perennial source of confusion: the things that you pass to (run ...) must be *functions*. What you are doing above is calling (display "fine") and passing the *result* of this function (which is #<unspecified>) to run-until. This is not what you want.

You want something like:

(run-until 500 (at-every 100 (lambda () (print "fine!\n"))))

where (lambda () ...) is a Scheme construct to define a function inline. Alternatively, you could define the function on a separate line, e.g.

(define (print-my-message) (print "fine!\n"))
(run-until 500 (at-every 100 print-my-message))

Notice that we pass the *name* of the function, print-my-message, rather than passing the *result* (print-my-message) of evaluating print-my-message.

Note also that I recommend using libctl's "print" function instead of "display". "print" allows you to print multiple arguments, and also does the right thing on a multi-processor machine. Note also that you probably want to print a newline "\n" at the end of your message.

Steven

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

Reply via email to