Hacker News new | ask | show | jobs
by phoe-krk 872 days ago
The idea seems so similar to the classical AMB ambiguous operator introduced by John McCarthy [0]. The implementation seems similar to what I've done a while ago, too, just in Lisp and using Lisp primitives rather than function decorators.

[0] http://www.randomhacks.net/2005/10/11/amb-operator/

[1] https://github.com/phoe/amb/

3 comments

I would argue that it is an already classical idea in the 70s. Non determinism is nothing new.

The cool stuff here is the simplicity of the interface to it and its integration thanks to high order functional constructs (decorator).

Does Screamer also do something similar? http://nikodemus.github.io/screamer/
Yep, Screamer is the "enterprise" quality of nondeterministic programming - think efficient and optimized Prolog-esque primitives, but in Lisp.

My implementation of AMB is purposefully small (70 LOC, not counting docstrings and tests and system definition), so that it can fit on a page of paper and be easily understood.

amb makes an appearance in the TXR Lisp test suite:

https://www.kylheku.com/cgit/txr/tree/tests/012/cont.tl