Created
April 1, 2014 17:43
-
-
Save mavant/9919202 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
(defmacro list-pythonize "Convert a list of expressions in Clojure to semantic-whitespace form." ([l] (macroexpand-1 `(list-pythonize ~l 0))) ([l n] (map (fn [x] (if (list? x) (concat (list "\n") (repeat n "\t") (macroexpand-1 `(list-pythonize ~x ~(+ n 1))) ) x)) l))) | |
(print (macroexpand-1 '(list-pythonize (defn tabs->parens [c] (map add-parens (rest (split-on-newlines c)) (list-deltas (code->numtabs c))))))) | |
;=> | |
;(defn tabs->parens [c] ( | |
; map add-parens ( | |
; rest ( | |
; split-on-newlines c)) ( | |
; list-deltas ( | |
; code->numtabs c)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment