-
-
Save ober/5126221 to your computer and use it in GitHub Desktop.
Thinatra!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(let ((pattern "/one/:one/:two") | |
(path "/one/x/y")) | |
(let* ((lst (split-string pattern "/" t)) | |
(patlst | |
(let ((i 0)) | |
(loop for part in lst | |
if (string-match-p "^:.*" part) | |
collect (cons i (intern (substring part 1))) | |
do (setq i (+ 1 i))))) | |
(splt (split-string path "/"))) | |
(let ((i 0)) | |
(loop for part in splt | |
if (aget patlst i) | |
collect (cons (aget patlst i) part) | |
do (setq i (+ i 1)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment