Friday, June 8, 2007

Article about McCarthy's Ambiguous Operator in Ruby

I just discovered an article about an implementation of McCarthy's amb operator in Ruby, written by Erid Kidd. What a gem, it's a beautiful construction.

It uses continuations to implement backtracking and provides a straight-forward way of representing constraint satisfaction problems in Ruby.

Find the details, implementation and article here: www.randomhacks.net.
It's also the subject of a Ruby Quiz. Here is an other implementation in scheme with a detailed description.

No comments: