-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quantum js cli #34
base: ltnln-npm-package
Are you sure you want to change the base?
Quantum js cli #34
Conversation
Quantum js vis branch
Update gate to not create default amazonBraketSymbols for gates.
Update bundle.js, no longer creates default AmazonBraketSymbols for Qjs
Reduce width of palette on creation in a JupyterNotebook via braket()…
packages/quantum-js-cli/runner.js
Outdated
console.log("1. From Scratch\n" + | ||
"2. From Text Diagram\n" | ||
/*+ "3. From Table Transposed\n"*/); | ||
selection = +prompt(mark); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Afai understand this is converting the prompt result into a number ? This could be more explicit, it's not quickly obvious what that syntax does
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I can use the Number() cast instead of +() cast to Number to clarity instead.
|
||
|
||
function prepareCircuit() { | ||
let selection = NaN; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason it starts with NaN and not null/0 etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I only wanted to instantiate selection
as some Falsey value.
test("Testing evaluateInput() with input 'help' and an empty circuit.", () => { | ||
let expectedText = runner.printMenu(); | ||
runner.evaluateInput("help", circuit); | ||
expect(console.log).toHaveBeenCalled(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant test
test("Testing evaluateInput() with input '-h' and an empty circuit.", () => { | ||
let expectedText = runner.printMenu(); | ||
runner.evaluateInput("-h", circuit); | ||
expect(console.log).toHaveBeenCalled(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
packages/quantum-js-cli/runner.js
Outdated
} | ||
// | ||
let registerIndices; | ||
let re = /\[(\s*\d+\s*,{0,1}\s*)+\]/g; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this regex for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a regex that selects an array of integers from a string, i.e. any substring of the form "[integer1, integer2, integer3...]". I'll make the clear in a comment in the code.
packages/quantum-js-cli/runner.js
Outdated
break; | ||
default: | ||
let circuitBackup = circuit.clone(); | ||
let re = /((\w+-*)+\(\s*\d+\s*,\s*\[(\s*\d+\s*,{0,1}\s*)+\]\s*(,\s*\d+\.{0,1}\d*\s*)*\))/g; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs better naming
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK. Will update.
… as references to set$ method
…eneration in evaluateInput() method
…e bundle.css to match
Reduce width of palette on creation in a JupyterNotebook via braket()…
Quantum js vis branch
Quantum js cli
…arameters object as an argument
No description provided.