Skip to content
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

Q.Matrix ought to accept a Template literal as a solo argument. #38

Open
stewdio opened this issue Feb 1, 2022 · 0 comments
Open

Q.Matrix ought to accept a Template literal as a solo argument. #38

stewdio opened this issue Feb 1, 2022 · 0 comments
Labels
Enhancement New feature or request Good first issue Good for newcomers Q.ComplexNumber Q.Matrix

Comments

@stewdio
Copy link
Owner

stewdio commented Feb 1, 2022

In addition to the current acceptable arguments for Q.Matrix, it ought to accept a Template literal (Template string) as a solo argument to make it trivially easy for something like this:

var m = new Q.Matrix(`
    1 2 3 4
    5 6 7 8`)

This makes the task of creating arbitrary matrices much more human readable than passing nested Arrays, or even just a series of Arrays. Parsing the arguments is simple: line returns indicate row breaks and white space indicates column breaks.

But the complication is that these tokens then need to be passed to Q.ComplexNumber (which Q.Matrix already does internally), and that constructor does not have a parser for interpreting a String. For example, var c = new Q.ComplexNumber( '1+2i' ) is not a handled use case. Yet.

Anyone want to write that complex number String parser? 😅
That’s already an open issue here: #4
(And although there’s a pull request attached to that, the code changes in that request do not seem to correspond to Q.ComplexNumber at all.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Good first issue Good for newcomers Q.ComplexNumber Q.Matrix
Projects
None yet
Development

No branches or pull requests

1 participant