Created
September 1, 2013 14:16
-
-
Save copyninja/6404719 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
(import [glob [glob]] | |
[os.path [expanduser]]) | |
(defmacro pattern-glob [folder pattern] | |
(quasiquote ( | |
(let [[folderpath (expanduser (unquote folder))]] | |
(if (not (.endswith folderpath "/")) | |
(setv folderpath (+ folderpath "/"))) | |
(fn [] (glob (+ folderpath | |
(unquote pattern)))))))) | |
;; (print (pattern-glob "~/Documents/Python" "*.py")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment