News for hackers. Stuff that matters.
Re:Show HN: Quantum suicide in Python by ridiculous_fish on Thursday March 24, 2016 @03:28AM (#11351154)
Is this the same as the amb form, as seen in SICP?

https://mitpress.mit.edu/sicp/full-text/book/book-Z-H-28.htm...

Re:Show HN: Quantum suicide in Python by dangirsh on Thursday March 24, 2016 @04:37AM (#11351352)
Amb is implemented with a backtracking evaluator and supports a try-again operation for requesting all valid outputs (universes). This library just forks the process for each "universe" and kills the ones where fail is called (including failing assertions). It can only return the first valid value.

This library is significantly less useful than amb for non-deterministic computing, but that doesn't seem to be the goal...

Re:Show HN: Quantum suicide in Python by d0m on Thursday March 24, 2016 @08:29AM (#11352226)
Yes, this is exactly what I was thinking about looking at the quantum example. For the end-user, it's the same high-level concept, but in the background the implementation is different. The quantum one create a new fork for each possible choice rather than using backtracking.

The quantum example is interesting because it gives us a sneak peek into the future for where it will be possible to write similar code in O(1) time!!