Skip to content

Instantly share code, notes, and snippets.

@fffej
Created July 14, 2009 20:10
Show Gist options
  • Save fffej/147156 to your computer and use it in GitHub Desktop.
Save fffej/147156 to your computer and use it in GitHub Desktop.
(defvar
dispatch-table
{:single-match
{'?is match-is '?or match-or '?and match-and '?not match-not}
:segment-match
{'?* segment-match '?+ segment-match+ '?? segment-match? '?if match-if}}
"Dispatch table")
(defn single-match-fn
"Get the single-match function for x, if it is a symbol that has one."
[x]
(when (symbol? x) ((dispatch-table :single-match) x)))
(defn segment-match-fn
"Get the segment-match function for x, if it is a symbol that has one."
[x]
(when (symbol? x) ((dispatch-table :segment-match) x)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment