AMB

Summary: The ambigous nondeterministic angelic operator (uh?)
Author: Stéphane Rollandin
Owner: Stéphane Rollandin (spfa)
Co-maintainers: <None>
Categories:
Homepage: http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme-Z-H-16.html#node_chap_14
PackageInfo name: AMBInfo
RSS feed:

Description:

This is the "ambigous", "nondeterminist", "angelic" operator aka amb

... more seriously described as a declarative control flow statement able to enumerate over finite domains all values that make a program terminate. It uses continuations to walk the tree of possible tuples, backtracking when the program fails.

The amazing thing is the simplicity of the code: four short or very short methods on the instance side, the class side methods only providing syntactic sugar.

And it can do incredible things such as:

AMB assert: [:string :n :char | (string occurrencesOf: char) = n]
over: #('maman' 'barbapapa' 'guiliguili' 'arthur' 'chtulu')
and: #(2 4 1)
and: #($m $b $a $i $u)

See AMBTest for more magic.

I would have been unable to implement this by myself ! This is a port of the code by Dorai Sitaram which is the reference documentation for amb:

http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme-Z-H-16.html#nodechap14


Releases


Back