Live data from Hacker News

Non-deterministic execution of Python functions

gitlab.inria.fr

1–10 of 17 posts

Re: Non-deterministic execution of Python functions

#3
Makes me think about how non-deterministic computing is basically how you view lists as a context (as opposed to a container) when thinking in terms of Monads in Haskell. Application functors basically form a minimal framework for applying functions to values in a non-deterministic context when working with lists.

Making this further relevant is that perhaps the most well known example of monadic programming of lists is: Python's list comprehensions. Which makes a bit surprised to see that not more explored/exploited in this library.

Interesting nonetheless!

Re: Non-deterministic execution of Python functions

#5
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/

Re: Non-deterministic execution of Python functions

#6
post #5

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/

Does Screamer also do something similar? http://nikodemus.github.io/screamer/

Re: Non-deterministic execution of Python functions

#7
post #6
post #5

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/

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.

Re: Non-deterministic execution of Python functions

#8
post #5

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/

amb makes an appearance in the TXR Lisp test suite:

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

Re: Non-deterministic execution of Python functions

#9
post #2

Useful to explain non-determinism to students. I saw a similar idea before at https://github.com/aeporreca/nondeterminism which uses fork() to (inefficiently) explore all possible guesses concurrently

It doesn't help that CS students will potentially end up hearing the term "nondeterminism" to mean different things in different contexts. In the context of the linked repo, it's used in the way they'll probably encounter it when learning about Turing machines, but in less formal contexts it also gets used a lot to describe stuff like "Heisenbugs" where running something more than once doesn't necessarily end up in the same result

Re: Non-deterministic execution of Python functions

#10
post #9
post #2

Useful to explain non-determinism to students. I saw a similar idea before at https://github.com/aeporreca/nondeterminism which uses fork() to (inefficiently) explore all possible guesses concurrently

It doesn't help that CS students will potentially end up hearing the term "nondeterminism" to mean different things in different contexts. In the context of the linked repo, it's used in the way they'll probably encounter it when learning about Turing machines, but in less formal contexts it also gets used a lot to describe stuff like "Heisenbugs" where running something more than once doesn't necessarily end up in t…

> but in less formal contexts it also gets used a lot to describe stuff like "Heisenbugs"

There are pretty formal contexts in which it also means things like that! It's not about formalism, it's just about context.

Post reply on HN