Live data from Hacker News

McCarthy's Ambiguous Operator (2005)

randomhacks.net

1–10 of 43 posts

Re: McCarthy's Ambiguous Operator (2005)

#3
amb without side-effects can also be expressed in terms of the List monad, e.g.:

    do x 
which can be equivalently reworded as the list comprehension:

    [(x, y) | x 
i.e., the underlying structure of amb without side-effects can also be understood as just a search of the input space for values that fulfill some criteria, rather than as backtracking via continuations.

Re: McCarthy's Ambiguous Operator (2005)

#4
post #3

amb without side-effects can also be expressed in terms of the List monad, e.g.: do x which can be equivalently reworded as the list comprehension: [(x, y) | x i.e., the underlying structure of amb without side-effects can also be understood as just a search of the input space for values that fulfill some criteria, rather than as backtracking via continuations.

The comments on the article include two more nice Haskell solutions (with much better speed).

Re: McCarthy's Ambiguous Operator (2005)

#9
post #3

amb without side-effects can also be expressed in terms of the List monad, e.g.: do x which can be equivalently reworded as the list comprehension: [(x, y) | x i.e., the underlying structure of amb without side-effects can also be understood as just a search of the input space for values that fulfill some criteria, rather than as backtracking via continuations.

This analogy misses something fundamental. See how the assignments to x and y are of very different character than the predicate? Notice the return path (`else []`). `amb` doesn't need this.

`amb` merges the assignments and predicate - this is important because you may not know your argument count statically, i.e. if your arguments are a list. But beyond that, `amb` may backtrack an arbitrarily deep call stack, so the the error return does not need to be expressed explicitly. You may think that is good or bad but it is not the same as the Haskell solution.

Post reply on HN