Frank GOENNINGER
5/6/2016 5:10:00 PM
Hi all,
I am trying to come up with some function that takes a definition of
patterns and a function and, when an input string matches, calls the
given function - like so:
(defun set-frequency (arg)
... do some clever stuff here )
(defun get-frequency ()
... read frequency from radio and return it ... )
(defparameter *pattern-defs* (list (cons (list "F *;") 'set-frequency)
(cons (list "f;" 'get-frequency))))
(defun match-and-dispatch (string)
(match-against-all-pattern-defs-and-call-function-on-match
*pattern-defs*))
Ideally, this would take advantage of multicore CPUs as I expect to have
lots of pattern defs like "X *;" ( a character X followed by a space
followed by an undefined number of digits followed by a semicolon -
that's the basic scheme of the patterns).
I have tried to find some library or code but only came up with
cl-unification ... Is this the way to go? How would I make 'unify accept
the list of patterns?
Thanks for providing some hints!
Regards from sunny South-West Germany
Frank