probcomp / Venturecxx

Primary implementation of the Venture probabilistic programming system
http://probcomp.csail.mit.edu/venture/
GNU General Public License v3.0
28 stars 6 forks source link

Sequencing multiple (non-action) expressions #132

Open lenaqr opened 9 years ago

lenaqr commented 9 years ago

Some functions, such as print and plot, are not inference actions but nevertheless have side effects. If this is intentional, it would be useful to have a construct like Scheme's begin to evaluate multiple expressions in sequence. (Currently, begin is an alias for do, which sequences inference actions.)

Depending on #131, might become irrelevant.

axch commented 9 years ago

A workaround is available: wrapping print or plot in action turns it into an inference action, which can be sequenced with do.

(do
  stuff
  (action (plot "h0" ...)))

This is a hack: action is just an alias for return, but strict evaluation causes the right set of things to happen.