[cl-unification-devel] MATCH and friends usage and changes
Marco Antoniotti
marcoxa at cs.nyu.edu
Mon Dec 3 15:31:06 UTC 2012
Dear all (the few, the self-chosen :) lurking here)
I have been fiddling about with a "pattern compiler" to be made part of a compiler-macro for MATCH-CASE. After reading a few things here and there, I came to the conclusion that for CL and CL-UNIFICATION there is no need for anything particularly sophisticated (things like "partial test/evaluation merging" and whatnot), but I also started to think that maybe it would be better to introduce new syntax. Something along the lines of
(PAT (<object> &key …) <clauses>)
Now. This may look simple, but suppose you wanted to do something like
(let ((x 42)) (y 123))
(pat (x y)
((42 123) t)
(_ 'not-matched)))
Now, while in principle this is easy (you just have a "list" instead of an object as first element), things may become hairy very soon when you want to add keywords affecting the matching process (cfr the MATCH-CASE syntax
match-case (<object> &key errorp default-substitution) <clauses>
where grouping is used for the keyword variables errorp default-substitution). With this consideration in mind the above example would become
(let ((x 42)) (y 123))
(pat ((x y))
((42 123) t)
(_ 'not-matched)))
So the questions I have for you are two: (1) do you have any ideas about syntax, even at the cost of introducing some "spurious infix" bit? (2) the PAT above should be really be named MATCH-CASE, but that is already taken; for the sake of backward compatibility, do you think that PAT or CASE-MATCH or SELECT or whatever should be used for the new syntax?
Cheers
--
Marco Antoniotti
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cl-unification-devel/attachments/20121203/15a3efe8/attachment.html>
More information about the cl-unification-devel
mailing list