[squeak-dev] AMB

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[squeak-dev] AMB

Stéphane Rollandin
from the class comment of AMB, in the attached sar
(coming soon to a SqueakMap near you):



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#node_chap_14



Stef



AMB.sar (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] AMB

cedreek
Hi Steph,

2008/6/30 Stéphane Rollandin <[hidden email]>:
> from the class comment of AMB, in the attached sar
> (coming soon to a SqueakMap near you):
>

I was just wondering if there are differences with Amb provided with
Seaside (in the continuation category ?)

Cédrick


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] AMB

Lukas Renggli
> I was just wondering if there are differences with Amb provided with
> Seaside (in the continuation category ?)

The Amb class is no longer part of Seaside-Core. Amb is a very strong
test-case for the Continuation implementation, but other than that it
was not used.

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] AMB

Stéphane Rollandin
In reply to this post by cedreek
cdrick a écrit :
> I was just wondering if there are differences with Amb provided with
> Seaside (in the continuation category ?)
>
> Cédrick

I should look at that :) I was not aware of it...

Stef


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] AMB

Stéphane Rollandin
In reply to this post by cedreek
cdrick a écrit :
> I was just wondering if there are differences with Amb provided with
> Seaside (in the continuation category ?)

I looked at the Seaside code:
http://www.shaffer-consulting.com/david/Seaside/dandelionOutput/index.html

it's exactly the same thing... reinventing the wheel, as they say..

Stef