Skip to content

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

@stewdio

Description

@stewdio

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.)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions