"Yacao Wang" <yacaowang / gmail.com> writes:

> Actually I've been thinking of creating an auto-backtracking engine for ruby
> based on the Prolog engine, because it's so much fun to play with
> non-deterministic programming. But I haven't got the time to do it. Has
> anyone have similar ideas or implementations?

You might be interested in looking through the solution to ruby quiz
#70: http://www.rubyquiz.com/quiz70.html  (Constraint Processing)

Among other things, that contains a ruby implementation of amb.

A minimalist approach to doing backtracking in ruby was used in my
de-optimized solution to Ruby Quiz #84:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/199337

(Backtracking is bundled into the `flip_coin' and `reflip' methods)

-- 
s=%q(  Daniel Martin -- martin / snowplow.org
       puts "s=%q(#{s})",s.map{|i|i}[1]       )
       puts "s=%q(#{s})",s.map{|i|i}[1]