Arc Forumnew | comments | leaders | submitlogin
1 point by almkglor 6162 days ago | link | parent

The problem in a lisplike is how to properly embed checks in destructuring binds. Since code represenetation == data representation, it's rather difficult to do:

  (defpat foo
    (x (isa x 'sym))
        (list x isa))
As it is, I'm already forbidding one symbol from being used for variables: quote. This is so that I can support:

  (defpat cmd
    ('niaw)   "cat"
    ('arf)    "dog"
    ('squeek) "mouse"
    (x)       (ero "unknown sound!"))

I don't know how scheme's pattern matching works; possibly yet another symbol has been removed from the allowed symbols.


1 point by almkglor 6161 days ago | link

I've since added guards in defpat. See the arc-wiki, also http://arclanguage.org/item?id=2276

-----