Created
April 1, 2014 18:13
-
-
Save mavant/9919765 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 s-expr->semantic-whitespace "Convert a list of expressions in Clojure to semantic-whitespace form." ([l] (apply str (macroexpand-1 `(s-expr->semantic-whitespace ~l 1)))) ([l n] (map (fn [x] (if (list? x) (apply str "\n" (apply str (repeat n "\t")) (interpose " "(macroexpand-1 `(s-expr->semantic-whitespace ~x ~(+ n 1)))) ) x)) l))) | |
(print (macroexpand-1 '(s-expr->semantic-whitespace (defn | |
tabs->parens [c] (map add-parens (rest | |
(split-on-newlines | |
c)) (list-deltas (code->numtabs c))))))) | |
;=> | |
;defntabs->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