Skip to content

Regex protocol implementations for Symbols and Vectors` #12

@ghost

Description

I suggest that both symbols and vectors should by default use equality tests in patterns, rather than be treated as predicate functions (both symbols and vectors implement AFn).

For example, I think it's natural if I want to match an empty vector to do something like this:

user=> (se/exec (se/cat []) (list []))
Execution error (IllegalArgumentException) at net.cgrand.seqexp/boot-grouping-vm$step$fn (seqexp.clj:352).
Key must be integer

On the other hand, I can't imagine ever wanting something like this:

user=> (se/exec (se/cat [1 2 3]) [0])
{:rest (), :match (0)}

Similarly, I think it's natural to expect symbols to act like keywords. Contrast:

user=> (se/exec (se/cat :foo) (list :foo))
{:rest (), :match (:foo)}

with:

user=> (se/exec (se/cat 'foo) (list 'foo))
nil

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions