Implement DISPATCH macro
String matching algorithms implementation for Lisp
Status: Alpha
Brought to you by:
anyakin
Implement DISPATCH macro to provide a convenient way to utilize performance gains offered by Aho-Corasic, Commentz-Walter and other algorithms with finite set of patterns.
This macro will have an API similar to the CASE macros family:
:::lisp
(sm:dispatch (line :start 10)
("syslogd"
(process-syslog-message line))
("kernel"
(process-kernel-message line))
((or "sendmail"
"qmail")
(process-mailer-message line))
(t
(process-generic-message line)))
This will likely require compiling clause forms into lambdas and attaching them to the associated keywords in the index.
Select-Match macro from the Miranda package might serve as an inspiration.
Last edit: Victor Anyakin 2013-08-23