[erlang-in-lisp-devel] fare-match question

Matt Bone thatmattbone at gmail.com
Fri May 30 14:05:39 UTC 2008


This is not a huge deal, and probably a bit out of the order we
discussed.  I started thinking about pattern matching yesterday,
though, and I was trying to do the simple example in fare-matcher (a
simple modification of what's in the docs):
(defun test-match (param)
 (fare-matcher:match param
      (:ping (print :pong))
      (:quit (print :bye))
      ((:add a b) (print :add))))

Matching with the simple symbols ping and quit works just fine, but
things go south when trying to match with add and bind a and b.  I was
attempting to do:
(test-match '(:add 1 2))
But something is wrong in the macroexpansion.  Am I even using my
test-match function properly?  Does match handle quoted sexpr properly
or was I just masking this problem with :ping and :quit by handing it
symbols that evaluate to themselves?

Also, since I believe both authors are on the list, should I consider
using cl-match instead?  Or are our pattern matching requirements so
minimal that a) it does not matter and b) we could even roll our own
ala some of the Norvig examples?

--matt



More information about the Erlang-in-lisp-devel mailing list