Skip to content

Reassigning builtins #74

@dloscutoff

Description

@dloscutoff
  • XA should be the "alphanumeric" regex (-`[0-9a-z]`). XZ can be the "any letter" regex (-`[a-z]`).
  • ** should be removed: E is shorter most of the time, and sometimes one wants to do "fold each on multiplication" (currently $* *, could be $** if ** weren't a token).
  • @* should potentially be changed, for similar reasons ("get first of each" is currently @ *, could be @*). Maybe @/? With binary @, it's inverting something and using it as an index; with unary @, it's inverting something and getting its first character (or the first element of an inverted list, although that could just as easily be /@). Both seem like they could theoretically be useful in some situation, but I can't think of one.
  • TBD on removing ++ and -- (in theory, ++ could be useful in a regex expression like XX+ +XD, though I've never had that situation come up).
  • r and u are rarely used and could be repurposed. r could be replaced by a two-byte name (not sure what--most of the good ones starting with R are taken--maybe RO?). In place of u for nil, one can usually use one of the local variables that hasn't been assigned (such as c), or in the worst case write () for two bytes. k, p, and q are also rarely used, but not quite as rarely; I think they're probably worth keeping. I'm on the fence about w; on the one hand, it is used sometimes, and the likely replacement would be +XS for three bytes; on the other hand, it's not used a lot, and it's confusing that w is `\s+` while XW is `\w`.
  • K can be repurposed as Keep, a 1-byte alias for Filter. KleeneStar is rarely used and should be changed to some 2-letter operator (KS? KX?) or maybe a symbol.

Metadata

Metadata

Assignees

No one assigned

    Labels

    compatibility-breakingMaking this change would break backward compatibility.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions