Well, I ported the following Scheme code to PIR. (The PIR is appended to this message...
;;; Indicate that the computation has failed, and that the program
;;; should try another path. We rebind this variable as needed.
(lambda () (error "Program failed")))
;;; Choose an arbitrary value and return it, with backtracking.
;;; You are not expected to understand this.
(define (choose . all-choices)
(let ((old-fail fail))
(define (try choices)
(if (null? choices)
(set! fail old-fail)
(lambda () (continuation (try (cdr choices)))))
;;; Find two numbers with a product of 15.
(let ((x (choose 1 3 5))
(y (choose 1 5 9)))
(for-each display `("Trying " ,x " and " ,y #\newline))
(unless (= (* x y) 15)
(for-each display `("Found " ,x " * " ,y " = 15" #\newline)))Which (as anyone can plainly see) implements a non deterministic search (and something like it could come in handy when implementing Perl 6 Junctions).