Skip to content

Add parentheses to all @m ~~ Array to get correct error message#1

Open
schultzdavid wants to merge 1 commit into
raku-community-modules:mainfrom
schultzdavid:patch-1
Open

Add parentheses to all @m ~~ Array to get correct error message#1
schultzdavid wants to merge 1 commit into
raku-community-modules:mainfrom
schultzdavid:patch-1

Conversation

@schultzdavid

@schultzdavid schultzdavid commented Apr 4, 2026

Copy link
Copy Markdown

Matrix.new([1,2,3]) currently raises
"All rows must contains the same number of elements"
whereas it should complain
"Expect an Array of Arrays or List of Lists"

Apparently that's because ~~ binds more tightly than all:
all [1,2,3] ~~ Array # True
all([1,2,3]) ~~ Array # False, as it should be

Thus, add parentheses around @m. Also fix some typos.

`Matrix.new([1,2,3])` currently raises 
    "All rows must contains the same number of elements"
whereas it should complain
    "Expect an Array of Arrays or List of Lists"

Apparently that's because `~~` binds more tightly than `all`:
all [1,2,3]  ~~ Array  # True
all([1,2,3]) ~~ Array  # False, as it should be

Thus, add parentheses around `@m`. Also fix some typos.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant