guicho271828 / trivia

Pattern Matcher Compatible with Optima
Other
335 stars 22 forks source link

non-canonical destructuring patterns #62

Closed ghost closed 8 years ago

ghost commented 8 years ago

Eg.

(match (list :x 1 :y 1)
  ((lambda-list-nc &key x &allow-other-keys (list :y 1)) t))
guicho271828 commented 8 years ago

It's not clear to me what means non-canonical. Is it having keyword specification after &allow-other-keys ? According to CLHS, &allow... should be the last element in a list... http://www.lispworks.com/documentation/lw60/CLHS/Body/03_dd.htm

guicho271828 commented 8 years ago

btw, clisp seems to be broken not due to this commit. I should seriously consider running tests periodically...

ghost commented 8 years ago

Yes, it allows for a pattern after &allow-other-keys; this doesn't cause ambiguity in parsing, since the only allowed tokens after &allow-other-keys by CL are nil or &aux.

It has been rather useful to me since using both declared keyword args and &allow-other-keys generally involves using &rest and removing the declared keyword arguments manually.

Looks like 5am needs ASDF >= 3.1, which is not available on clisp.

guicho271828 commented 8 years ago

improvement to property pattern looks neat, thanks.

guicho271828 commented 8 years ago

also add NEWS to readme

guicho271828 commented 8 years ago

the optimization to lambda-list should be in a separate branch because it is apparently different topic, though the commit is based on it. I merge 4cb2720.