Skip to content

Instantly share code, notes, and snippets.

@matux
Created May 5, 2019 07:32
Show Gist options
  • Save matux/a082d8342113c91b241d2dea7edfa967 to your computer and use it in GitHub Desktop.
Save matux/a082d8342113c91b241d2dea7edfa967 to your computer and use it in GitHub Desktop.
A special kind of Hello World. In a typical kind of Lisp. For a quantum kind of reality.
;;;; 'sup, quantum physics.
;;; Interview challenge:
;;; Teleport the state of a single qubit existing in a 2-dimensional
;;; complex Hilbert space by way of classical communication without
;;; spawning any more than 4 parallel universes.
;;; "...hold my beer."
((HADAMARD 1) ; Open a Hadamard gate to map the probability basis with an orthogonal, symmetric, involutive, linear Hadamard-Rademacher-Walsh-class quantum Fourier transform over a single qubit, or something.
(CNOT 1 2) ; Entangle 4 2-dimensional
(CNOT 0 1) ; qubits in a Pauli matrix.
(HADAMARD 0) ; Close the gate before any demons cross over.
(MEASURE 0 0) ; Project the quantum state
(MEASURE 1 1) ; of the entanglement.
(WHEN 1 ; Perform some case analysis cause functional programming is so hot right now, but really, to hide the fact that no matter how many decades of rigurous scientific research are spent on the fields of mathematics, quantum physics and the quantum stochastic calculus to model differential equations for quantum computation, programmers will just keep doing if-else.
(PAULI-X 2)) ; rotate the qubit around the Bloch sphere's X axis.
(WHEN 0 ;
(PAULI-Z 2))) ; Phase shift the qubit by horizontally tracing the Bloch sphere.
;;; Beam up, jump to warp speed and go to the closest Federation starbase.
;;; If there's a crew, say "Make it so.", else use the joystick.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment