uiua-lang / uiua

A stack-based array programming language
https://www.uiua.org
MIT License
1.51k stars 106 forks source link

Regex throws "Error: Cannot add shape [1] row to array with shape [2] rows" #521

Closed tankorsmash closed 1 month ago

tankorsmash commented 1 month ago

pad link for repro on pad's Uiua 0.12.0-dev.1

"foo(:?.)?" "foo"
regex
Error: Cannot add shape [1] row to array with shape [2] rows
  at 2:1
2 | regex
    ─────

Here's a rust playground with the regex set up if it helps.

kaikalii commented 1 month ago

Optional captures require fill. Like this

tankorsmash commented 1 month ago

Oh, fill is even mentioned in the docs, thanks!

If this is the only time regex can throw an error, having regex suggest fill in cases like this would be nice.