Adding return statement in Anglican for BOPP release

Declined
#74 · Created  · Last updated

Declined pull request

overriden by https://bitbucket.org/probprog/anglican/pull-requests/77/add-try-throw/diff

Closed by: ·2017-01-26

Description

Adding a return statement in Anglican which allows ending a program when this statement is executed, returning the arguments of this statement, e.g.

(defquery q [x] (let [a (sample (normal 0 1)) b (if (sample (flip 0.5) (sample (normal 0 1)) (return a))] (observe (normal b 1) x) b))

will return either a value of a or a constrained value of b.

The rationale behind this is to be able to do this thing in BOPP (paper): We want to perform a program transformation which allows early termination depending on whether a specified set of variables has been sampled already or not. Details in section 4 of the paper and section 1.5 of supplementary.

What we do is introduce cps-of-return which returns a return record, i.e. a non-function CPS, which stops execution. See details in the diff (ignore whitespace).

0 attachments

0 comments

Loading commits...