With an emulator, you see all the potential results and their probabilities.
In the above diagram, you can see the desired result is 6 (110) and the probability of getting any other result is .007813 . (A green dot is a probabilistic integer, the blue dot is a leaf - think of it as an entry in the "matrix" describing the quantum state).
So - how do we do this... Well, with QPL, we write this code:
dataqbs = intToZeroQubitList(15|);
i = qubitListToInt(dataqbs);
The #Import constructs work similarly to Haskell's import, brining in the code at the named file.
The main function consists of 4 statements. The first creates what can be called a quantum integer, consisting of a list of qubits. The 15 is a classical value and represents the largest integer we would like to store (as an unsigned value). The next statement calls a function that will apply the Hadamard transform to each of the qubits. We then apply Grover's transform to the list (see the next posting), convert back to a probabilistic integer by measuring each of the qubits and voila - the answer appears.
Next posting - more details about the doNGrovers function.