Simon Frost wrote:
> Dear Bugs list,
>
> I've been playing around with WBDev (it's been a long time since I touched a
> Pascal-like program), and I was wondering whether there's a way to test
> functions within WinBUGS without having to close and reopen BlackBox.
Your question is slightly ambiguous here are two interpretations and
solutions:
(Interpretation 1) close WinBUGS and then open BlackBox
Anything that you develop under BlackBox can be recopied back to the
WinBUGS directory so that it then extends the WinBUGS functionality.
But you really don't need to use WinBUGS once you have copied all of its
files into BlackBox as specified in the WBDev_functions.pdf
documentation. BlackBox becomes WinBUGS in that case.
(Interpretation 2) close and reopen BlackBox
Modules that are currently loaded in BlackBox must be freed before a
newer version takes effect. Freeing can be done by either
[^Q] DevDebug.Unload
[^Q] DevDebug.UnloadModuleList moduleList
where [^Q] is a 'commander' which is entered into the log file or any
(.odc) file by typing Ctrl-Q. A black circle enclosing a white
exclamation point results. When clicked on this commander, the
remainder of the line is executed so that DevDebug.Unload "Tries to
unload the module whose source is in the focus view. Unloading fails if
the specified module is not loaded yet, or if it is not a top module"
whereas DevDebug.UnloadModuleList "Tries to unload a list of modules
whose names are selected. Unloading may partially or completely fail if
one of the specified modules is not loaded yet, or if it is still being
imported by at least one client module. Modules must be unloaded from
top to bottom." See the DevDebug documentation in BlackBox.
> In
> addition, in order to test a function, do I _have_ to place it within a
> WinBUGS program?
No. Just execute the procedure. That is, within the module that you
wish to test create a procedure with no arguments such as 'Test' which
calls the procedure(s) with some argument values and then just do
[Q^] MyModule.Test
To get fancier you can export the parameters you wish to vary and then
create a form (Controls->New Form, MyModule) into which you can
succesively type the parameter values you wish to test. The 'Test'
procedure will appear as a button in the new form.
>
> I'm attaching a function and a test program which calculates the binomial
> coefficient recursively. You'll need to add
>
> s <- "binomial.coefficient"(s,s) "WBDevBinomialCoefficient.Install"
>
> to Grammar.odc in WBDev/Rsrc.
>
> I really must express my gratitude to the WinBUGS developers for this step
> towards open source. There have been things I've wanted to do in WinBUGS for a
> while that would either be impossible or terribly clumsy within the WinBUGS
> syntax.
>
> Finally, does anyone have a copy of Stan Warford's book on programming
> BlackBox? Is it any good?
I have a copy of Stan's book and it is good but you must realize that it
is oriented to teaching computer science and not to teaching BlackBox.
It uses BlackBox to teach computer science (list, queues, recursion, etc).
Hope this helps.
-Doug Danforth
>
> Best wishes
> Simon
>
>
> -------------------------------------------------------------------
> This list is for discussion of modelling issues and the BUGS software.
> For help with crashes and error messages, first mail [log in to unmask]
>
> To mail the BUGS list, mail to [log in to unmask]
> Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html
> Please do not mail attachments to the list.
>
> To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
> If this fails, mail [log in to unmask], NOT the whole list
-------------------------------------------------------------------
This list is for discussion of modelling issues and the BUGS software.
For help with crashes and error messages, first mail [log in to unmask]
To mail the BUGS list, mail to [log in to unmask]
Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html
Please do not mail attachments to the list.
To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
If this fails, mail [log in to unmask], NOT the whole list
|