News for hackers. Stuff that matters.
Re:Nondeterministic programming by motxilo on Wednesday March 30, 2011 @06:49AM (#2386605)
As a practical use, a while ago I "resolved" the Einstein's Riddle using this operator: http://ticsblog.com/2010/12/07/solving-einsteins-riddle-usin...
Re:Nondeterministic programming by yuvadam on Wednesday March 30, 2011 @04:41AM (#2386338)
Nice, but I'm not sure I get it. There is no such thing as a concrete non-deterministic operation. How does the expression evaluate? If all the parameters are evaluated in order, there's nothing non-deterministic about it.
Re:Nondeterministic programming by stiff on Wednesday March 30, 2011 @07:19AM (#2386671)
It is non-deterministic in the sense that the program itself and its inputs are not sufficient to determine the program behavior, as the amb operator creates a set of "possible worlds" in which the same expression has different values. Of course to implement it on a traditional computer, one has to simulate this behavior and decide on some order of evaluation. In SICP, where this is discussed in more depth, one of the exercises asks the reader to modify amb to return a random choice instead of just the subsequent one and this expands the range of problems one can apply this technique to:

http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-28.html... http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-28.html...

Re:Nondeterministic programming by yogsototh on Wednesday March 30, 2011 @05:12AM (#2386385)
There is no known real world non-deterministic Turing Machine. We could only simulate it using a deterministic Turing Machine (like a common computer).

Using this operator make the code really clear (IMHO) and I suppose it is its purpose.

Furthermore, if one day we discover an hardware able to be a non-deterministic Turing machine is discovered, the code will work.

[1]: I doubt such an hardware exists. But you could look about quantum computer for something close to what is a non-deterministic Turing machine.

Re:Nondeterministic programming by szany on Wednesday March 30, 2011 @05:33AM (#2386434)
Navia Systems is designing nondeterministic hardware.

http://www.naviasystems.com/

Re:Nondeterministic programming by kd0amg on Wednesday March 30, 2011 @10:16AM (#2387271)
Maybe I'm missing something, but their web site appears to discuss probabilistic procedures, which is not nondeterminism in the Turing machine sense.
Re:Nondeterministic programming by szany on Wednesday March 30, 2011 @05:05PM (#2389237)
No you're right. I missed the "preferring those choices that cause the program to converge meaningfully" part. Sorry. Disregard.
Re:Nondeterministic programming by calibraxis on Wednesday March 30, 2011 @05:22AM (#2386415)
"Non-deterministic" is a somewhat technical term... Wikipedia gives a good explanation of what aspect of this operation makes it be called nondeterministic. (http://en.wikipedia.org/wiki/Nondeterministic_algorithm)
Re:Nondeterministic programming by gromgull on Wednesday March 30, 2011 @09:36AM (#2387089)
Isn't this just the prolog-ism of backtracking imported into other languages? Especially as long you just evaluate the options in order?
Re:Nondeterministic programming by _delirium on Wednesday March 30, 2011 @10:35AM (#2387382)
The article mentions that it's related, but somewhat simpler because it's "only" backtracking, versus Prolog's full logic programming:

The embedding recalls the continuation strategies used to implement Prolog-style logic programming, but is sparer because the operator provided is much like a Scheme boolean operator, does not require special contexts for its use, and does not rely on linguistic infrastructure such as logic variables and unification.

Re:Nondeterministic programming by zwischenzug on Wednesday March 30, 2011 @08:02AM (#2386803)
I don't understand the point of the solutions - why is a non-deterministic output of a function better than iterating over a list? If anything, it would be worse.
Re:Nondeterministic programming by rincewind on Wednesday March 30, 2011 @05:21AM (#2386410)
Re:Nondeterministic programming by caioariede on Wednesday March 30, 2011 @08:55AM (#2386948)
Re:Nondeterministic programming by lfborjas on Wednesday March 30, 2011 @12:09PM (#2387858)
Cool, I was wondering if it could be implemented in ruby; it's a shame that callcc isn't present anymore in ruby 1.9
Re:Nondeterministic programming by lfborjas on Saturday April 02, 2011 @10:16PM (#2401567)
I was wrong, ruby 1.9 has callcc back since 2009, you have to `require 'continuation'` now, though.
Re:Nondeterministic programming by chrisjsmith on Wednesday March 30, 2011 @06:26AM (#2386559)
SICP covers this too: http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-28.html...

The references are better than the posted link.

I have found a couple of uses for this in the past and deparately tried to port the examples to C# (unsuccessfully).

Re:Nondeterministic programming by shriphani on Wednesday March 30, 2011 @09:20AM (#2387023)
I agree. I had to use NDP for solving a few CSPs recently. SICP was a godsend.